Re: [GIT PULL] ARC updates for 4.20-rc6

2018-12-05 Thread pr-tracker-bot
The pull request you sent on Wed, 5 Dec 2018 15:46:35 -0800:

> git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/ 
> tags/arc-4.20-rc6

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/369af92ce47a04b2523ec4feea1febcacf8419b1

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[GIT PULL] ARC updates for 4.20-rc6

2018-12-05 Thread Vineet Gupta
Hi Linus,

Please pull.

Thx,
-Vineet

>
The following changes since commit ccda4af0f4b92f7b4c308d3acc262f4a7e3affad:

  Linux 4.20-rc2 (2018-11-11 17:12:31 -0600)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc.git/ 
tags/arc-4.20-rc6

for you to fetch changes up to 10d443431dc2bb733cf7add99b453e3fb9047a2e:

  ARC: io.h: Implement reads{x}()/writes{x}() (2018-11-30 11:26:29 -0800)


ARC fixes/updates for 4.20-rc6

 - Missing reads{x}()/writes{x}() getting in the way of some drivers [Jose 
Abreu]

 - Builds defaulting to ARCv2 ISA based configsa [Kevin Hilman]

 - Miscll fixes


Alexey Brodkin (1):
  arc: [devboards] Add support of NFSv3 ACL

Bartlomiej Zolnierkiewicz (1):
  ARC: remove redundant 'default n' from Kconfig

Eugeniy Paltsev (3):
  ARC: IOC: panic if kernel was started with previously enabled IOC
  ARC: [plat-hsdk] Enable DW APB GPIO support
  ARC: mm: fix uninitialised signal code in do_page_fault

Jose Abreu (1):
  ARC: io.h: Implement reads{x}()/writes{x}()

Kevin Hilman (1):
  ARC: change defconfig defaults to ARCv2

Vineet Gupta (1):
  ARCv2: boot log unaligned access in use

 arch/arc/Kconfig   | 13 +-
 arch/arc/Makefile  |  2 +-
 arch/arc/boot/dts/hsdk.dts | 15 +++
 arch/arc/configs/axs101_defconfig  |  2 +
 arch/arc/configs/axs103_defconfig  |  1 +
 arch/arc/configs/axs103_smp_defconfig  |  1 +
 arch/arc/configs/hsdk_defconfig|  4 ++
 arch/arc/configs/nps_defconfig |  2 +
 arch/arc/configs/nsim_700_defconfig|  1 +
 arch/arc/configs/nsimosci_defconfig|  2 +
 arch/arc/configs/nsimosci_hs_defconfig |  1 +
 arch/arc/configs/nsimosci_hs_smp_defconfig |  1 +
 arch/arc/configs/tb10x_defconfig   |  1 +
 arch/arc/configs/vdk_hs38_defconfig|  1 +
 arch/arc/configs/vdk_hs38_smp_defconfig|  1 +
 arch/arc/include/asm/cache.h   |  2 +
 arch/arc/include/asm/io.h  | 72 ++
 arch/arc/kernel/setup.c|  9 ++--
 arch/arc/mm/cache.c| 20 +++--
 arch/arc/mm/fault.c|  2 +-
 20 files changed, 133 insertions(+), 20 deletions(-)

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 2/5] ARC: perf: introduce Kernel PMU events support

2018-12-05 Thread Vineet Gupta
On 12/5/18 9:06 AM, Eugeniy Paltsev wrote:
> Export all available ARC architected hardware events as
> kernel PMU events to make non-generic events accessible.
>
> ARC PMU HW allow us to read the list of all available
> events names. So we generate kernel PMU event list
> dynamically in arc_pmu_device_probe() using
> human-readable events names we got from HW instead of
> using pre-defined events list.
>
> -->8--
> $ perf list
>   [snip]
>   arc_pmu/bdata64/  [Kernel PMU event]
>   arc_pmu/bdcstall/ [Kernel PMU event]
>   arc_pmu/bdslot/   [Kernel PMU event]
>   arc_pmu/bfbmp/[Kernel PMU event]
>   arc_pmu/bfirqex/  [Kernel PMU event]
>   arc_pmu/bflgstal/ [Kernel PMU event]
>   arc_pmu/bflush/   [Kernel PMU event]

Lets call this pct iso pmu since pmu has more of power mgmt connotation. I know
the code has pmu littered all over but atleast the user interface could be more
intuitive.

BTW this approach seems more user friendly and is different from Alexey's 
earlier
stab at implementing raw events [1]. He didn't keep around any list (and relied 
on
use rlooking in the PRM to find his interesting event of the day) and pass as
*r*foobar.  PeterZ at the time had some reservations with that which I never 
fully
understood.

[1] https://lore.kernel.org/patchwork/patch/568769/

> -->8--
>
> Signed-off-by: Eugeniy Paltsev 
> ---
>  arch/arc/kernel/perf_event.c | 107 
> ++-
>  1 file changed, 106 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
> index 811a07a2ca21..97b88b00c418 100644
> --- a/arch/arc/kernel/perf_event.c
> +++ b/arch/arc/kernel/perf_event.c
> @@ -22,12 +22,28 @@
>  /* HW holds 8 symbols + one for null terminator */
>  #define ARCPMU_EVENT_NAME_LEN9
>  
> +enum arc_pmu_attr_groups {
> + ARCPMU_ATTR_GR_EVENTS,
> + ARCPMU_ATTR_GR_FORMATS,
> + ARCPMU_NR_ATTR_GR
> +};
> +
> +struct arc_pmu_raw_event_entry {
> + char name[ARCPMU_EVENT_NAME_LEN];
> +};
> +
>  struct arc_pmu {
>   struct pmu  pmu;
>   unsigned intirq;
>   int n_counters;
> + int n_events;
>   u64 max_period;
>   int ev_hw_idx[PERF_COUNT_ARC_HW_MAX];
> +
> + struct arc_pmu_raw_event_entry  *raw_entry;
> + struct attribute**attrs;
> + struct perf_pmu_events_attr *attr;
> + const struct attribute_group*attr_groups[ARCPMU_NR_ATTR_GR + 1];
>  };
>  
>  struct arc_pmu_cpu {
> @@ -196,6 +212,17 @@ static int arc_pmu_event_init(struct perf_event *event)
>(int)hwc->config, arc_pmu_ev_hw_map[ret]);
>   return 0;
>  
> + case PERF_TYPE_RAW:
> + if (event->attr.config >= arc_pmu->n_events)
> + return -ENOENT;
> +
> + hwc->config |= event->attr.config;
> + pr_debug("init raw event with idx %lld \'%s\'\n",
> +  event->attr.config,
> +  arc_pmu->raw_entry[event->attr.config].name);
> +
> + return 0;
> +
>   default:
>   return -ENOENT;
>   }
> @@ -446,6 +473,68 @@ static void arc_cpu_pmu_irq_init(void *data)
>   write_aux_reg(ARC_REG_PCT_INT_ACT, 0x);
>  }
>  
> +/* Event field occupies the bottom 15 bits of our config field */
> +PMU_FORMAT_ATTR(event, "config:0-14");
> +static struct attribute *arc_pmu_format_attrs[] = {
> + _attr_event.attr,
> + NULL,
> +};
> +
> +static struct attribute_group arc_pmu_format_attr_gr = {
> + .name = "format",
> + .attrs = arc_pmu_format_attrs,
> +};
> +
> +static ssize_t
> +arc_pmu_events_sysfs_show(struct device *dev,
> +   struct device_attribute *attr, char *page)
> +{
> + struct perf_pmu_events_attr *pmu_attr;
> +
> + pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
> + return sprintf(page, "event=0x%04llx\n", pmu_attr->id);
> +}
> +
> +/*
> + * We don't add attrs here as we don't have pre-defined list of perf events.
> + * We will generate and add attrs dynamically in probe() after we read HW
> + * configuration.
> + */
> +static struct attribute_group arc_pmu_events_attr_gr = {
> + .name = "events",
> +};
> +
> +static void arc_pmu_add_raw_event_attr(int j, char *str)
> +{
> + memmove(arc_pmu->raw_entry[j].name, str, ARCPMU_EVENT_NAME_LEN - 1);
> + arc_pmu->attr[j].attr.attr.name = arc_pmu->raw_entry[j].name;
> + arc_pmu->attr[j].attr.attr.mode = VERIFY_OCTAL_PERMISSIONS(0444);
> + arc_pmu->attr[j].attr.show = arc_pmu_events_sysfs_show;
> + arc_pmu->attr[j].id = j;
> + arc_pmu->attrs[j] = &(arc_pmu->attr[j].attr.attr);
> +}
> +
> +static int arc_pmu_raw_alloc(struct device *dev)
> +{
> + 

Re: [PATCH 3/5] ARC: perf: fix of kernel data types using

2018-12-05 Thread Vineet Gupta
On 12/5/18 9:06 AM, Eugeniy Paltsev wrote:
> Use u32, u64, s64 instead of uint32_t, uint64_t, int64_t
>
> Signed-off-by: Eugeniy Paltsev 


Maybe squash this into trivial cleanups 1/5 ?

Acked-by: Vineet Gupta 

Thx,
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 4/5] ARC: perf: fix description comment

2018-12-05 Thread Vineet Gupta
On 12/5/18 9:06 AM, Eugeniy Paltsev wrote:
> Fix description comment as this code doesn't belong only to
> ARC700 anymore.
>
> Also while I'm at it, use SPDX License Identifier.
>
> Signed-off-by: Eugeniy Paltsev 

Maybe squash this into trivial cleanups 1/5 ?

Acked-by: Vineet Gupta 

Thx,
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 5/5] ARC: perf: remove useless ifdefs

2018-12-05 Thread Vineet Gupta
On 12/5/18 9:06 AM, Eugeniy Paltsev wrote:
> ifdef around 'arc_pmu_match' structure declaration is useless
> as we refer to 'arc_pmu_match' in several places which aren't
> guarded with ifdef.
>
> Nevertheless 'ARC' option selects 'OF' unconditionally so we
> can simply get rid of this ifdef.
>
> Signed-off-by: Eugeniy Paltsev 


Maybe squash this into trivial cleanups 1/5 ?

Acked-by: Vineet Gupta 

Thx,
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 1/5] ARC: perf: trivial code cleanup

2018-12-05 Thread Vineet Gupta
On 12/5/18 9:06 AM, Eugeniy Paltsev wrote:
> Use BIT(), lower_32_bits(), upper_32_bits() macroses,
> fix code style violations.
>
> Signed-off-by: Eugeniy Paltsev 

Acked-by: Vineet Gupta 

Thx,
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/5] ARC: perf: fix of kernel data types using

2018-12-05 Thread Eugeniy Paltsev
Use u32, u64, s64 instead of uint32_t, uint64_t, int64_t

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/perf_event.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 97b88b00c418..8c88837fcd83 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -101,10 +101,10 @@ static struct arc_pmu *arc_pmu;
 static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu);
 
 /* read counter #idx; note that counter# != event# on ARC! */
-static uint64_t arc_pmu_read_counter(int idx)
+static u64 arc_pmu_read_counter(int idx)
 {
-   uint32_t tmp;
-   uint64_t result;
+   u32 tmp;
+   u64 result;
 
/*
 * ARC supports making 'snapshots' of the counters, so we don't
@@ -113,7 +113,7 @@ static uint64_t arc_pmu_read_counter(int idx)
write_aux_reg(ARC_REG_PCT_INDEX, idx);
tmp = read_aux_reg(ARC_REG_PCT_CONTROL);
write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN);
-   result = (uint64_t) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32;
+   result = (u64) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32;
result |= read_aux_reg(ARC_REG_PCT_SNAPL);
 
return result;
@@ -122,9 +122,9 @@ static uint64_t arc_pmu_read_counter(int idx)
 static void arc_perf_event_update(struct perf_event *event,
  struct hw_perf_event *hwc, int idx)
 {
-   uint64_t prev_raw_count = local64_read(>prev_count);
-   uint64_t new_raw_count = arc_pmu_read_counter(idx);
-   int64_t delta = new_raw_count - prev_raw_count;
+   u64 prev_raw_count = local64_read(>prev_count);
+   u64 new_raw_count = arc_pmu_read_counter(idx);
+   s64 delta = new_raw_count - prev_raw_count;
 
/*
 * We aren't afraid of hwc->prev_count changing beneath our feet
@@ -231,7 +231,7 @@ static int arc_pmu_event_init(struct perf_event *event)
 /* starts all counters */
 static void arc_pmu_enable(struct pmu *pmu)
 {
-   uint32_t tmp;
+   u32 tmp;
tmp = read_aux_reg(ARC_REG_PCT_CONTROL);
write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0x) | 0x1);
 }
@@ -239,7 +239,7 @@ static void arc_pmu_enable(struct pmu *pmu)
 /* stops all counters */
 static void arc_pmu_disable(struct pmu *pmu)
 {
-   uint32_t tmp;
+   u32 tmp;
tmp = read_aux_reg(ARC_REG_PCT_CONTROL);
write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0x) | 0x0);
 }
@@ -544,7 +544,7 @@ static int arc_pmu_device_probe(struct platform_device 
*pdev)
 
union cc_name {
struct {
-   uint32_t word0, word1;
+   u32 word0, word1;
char sentinel;
} indiv;
char str[ARCPMU_EVENT_NAME_LEN];
-- 
2.14.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 1/5] ARC: perf: trivial code cleanup

2018-12-05 Thread Eugeniy Paltsev
Use BIT(), lower_32_bits(), upper_32_bits() macroses,
fix code style violations.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/perf_event.c | 31 ++-
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 8aec462d90fb..811a07a2ca21 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -19,6 +19,9 @@
 #include 
 #include 
 
+/* HW holds 8 symbols + one for null terminator */
+#define ARCPMU_EVENT_NAME_LEN  9
+
 struct arc_pmu {
struct pmu  pmu;
unsigned intirq;
@@ -155,7 +158,7 @@ static int arc_pmu_event_init(struct perf_event *event)
int ret;
 
if (!is_sampling_event(event)) {
-   hwc->sample_period  = arc_pmu->max_period;
+   hwc->sample_period = arc_pmu->max_period;
hwc->last_period = hwc->sample_period;
local64_set(>period_left, hwc->sample_period);
}
@@ -192,6 +195,7 @@ static int arc_pmu_event_init(struct perf_event *event)
pr_debug("init cache event with h/w %08x \'%s\'\n",
 (int)hwc->config, arc_pmu_ev_hw_map[ret]);
return 0;
+
default:
return -ENOENT;
}
@@ -246,8 +250,8 @@ static int arc_pmu_event_set_period(struct perf_event 
*event)
write_aux_reg(ARC_REG_PCT_INDEX, idx);
 
/* Write value */
-   write_aux_reg(ARC_REG_PCT_COUNTL, (u32)value);
-   write_aux_reg(ARC_REG_PCT_COUNTH, (value >> 32));
+   write_aux_reg(ARC_REG_PCT_COUNTL, lower_32_bits(value));
+   write_aux_reg(ARC_REG_PCT_COUNTH, upper_32_bits(value));
 
perf_event_update_userpage(event);
 
@@ -277,7 +281,7 @@ static void arc_pmu_start(struct perf_event *event, int 
flags)
/* Enable interrupt for this counter */
if (is_sampling_event(event))
write_aux_reg(ARC_REG_PCT_INT_CTRL,
- read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx));
+ read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx));
 
/* enable ARC pmu here */
write_aux_reg(ARC_REG_PCT_INDEX, idx);  /* counter # */
@@ -295,9 +299,9 @@ static void arc_pmu_stop(struct perf_event *event, int 
flags)
 * Reset interrupt flag by writing of 1. This is required
 * to make sure pending interrupt was not left.
 */
-   write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx);
+   write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx));
write_aux_reg(ARC_REG_PCT_INT_CTRL,
- read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~(1 << idx));
+ read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~BIT(idx));
}
 
if (!(event->hw.state & PERF_HES_STOPPED)) {
@@ -349,9 +353,10 @@ static int arc_pmu_add(struct perf_event *event, int flags)
 
if (is_sampling_event(event)) {
/* Mimic full counter overflow as other arches do */
-   write_aux_reg(ARC_REG_PCT_INT_CNTL, (u32)arc_pmu->max_period);
+   write_aux_reg(ARC_REG_PCT_INT_CNTL,
+ lower_32_bits(arc_pmu->max_period));
write_aux_reg(ARC_REG_PCT_INT_CNTH,
- (arc_pmu->max_period >> 32));
+ upper_32_bits(arc_pmu->max_period));
}
 
write_aux_reg(ARC_REG_PCT_CONFIG, 0);
@@ -392,7 +397,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev)
idx = __ffs(active_ints);
 
/* Reset interrupt flag by writing of 1 */
-   write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx);
+   write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx));
 
/*
 * On reset of "interrupt active" bit corresponding
@@ -400,7 +405,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev)
 * Now we need to re-enable interrupt for the counter.
 */
write_aux_reg(ARC_REG_PCT_INT_CTRL,
-   read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx));
+   read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx));
 
event = pmu_cpu->act_counter[idx];
hwc = >hw;
@@ -414,7 +419,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev)
arc_pmu_stop(event, 0);
}
 
-   active_ints &= ~(1U << idx);
+   active_ints &= ~BIT(idx);
} while (active_ints);
 
 done:
@@ -453,7 +458,7 @@ static int arc_pmu_device_probe(struct platform_device 
*pdev)
uint32_t word0, word1;
char sentinel;
} indiv;
-   char str[9];
+   char str[ARCPMU_EVENT_NAME_LEN];
} cc_name;
 
 
@@ -483,7 +488,7 @@ static int arc_pmu_device_probe(struct platform_device 
*pdev)
  

[PATCH 5/5] ARC: perf: remove useless ifdefs

2018-12-05 Thread Eugeniy Paltsev
ifdef around 'arc_pmu_match' structure declaration is useless
as we refer to 'arc_pmu_match' in several places which aren't
guarded with ifdef.

Nevertheless 'ARC' option selects 'OF' unconditionally so we
can simply get rid of this ifdef.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/perf_event.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index b6207090aaa7..7786c1f005fb 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -643,14 +643,12 @@ static int arc_pmu_device_probe(struct platform_device 
*pdev)
return perf_pmu_register(_pmu->pmu, "arc_pmu", PERF_TYPE_RAW);
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id arc_pmu_match[] = {
{ .compatible = "snps,arc700-pct" },
{ .compatible = "snps,archs-pct" },
{},
 };
 MODULE_DEVICE_TABLE(of, arc_pmu_match);
-#endif
 
 static struct platform_driver arc_pmu_driver = {
.driver = {
-- 
2.14.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 2/5] ARC: perf: introduce Kernel PMU events support

2018-12-05 Thread Eugeniy Paltsev
Export all available ARC architected hardware events as
kernel PMU events to make non-generic events accessible.

ARC PMU HW allow us to read the list of all available
events names. So we generate kernel PMU event list
dynamically in arc_pmu_device_probe() using
human-readable events names we got from HW instead of
using pre-defined events list.

-->8--
$ perf list
  [snip]
  arc_pmu/bdata64/  [Kernel PMU event]
  arc_pmu/bdcstall/ [Kernel PMU event]
  arc_pmu/bdslot/   [Kernel PMU event]
  arc_pmu/bfbmp/[Kernel PMU event]
  arc_pmu/bfirqex/  [Kernel PMU event]
  arc_pmu/bflgstal/ [Kernel PMU event]
  arc_pmu/bflush/   [Kernel PMU event]
-->8--

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/perf_event.c | 107 ++-
 1 file changed, 106 insertions(+), 1 deletion(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 811a07a2ca21..97b88b00c418 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -22,12 +22,28 @@
 /* HW holds 8 symbols + one for null terminator */
 #define ARCPMU_EVENT_NAME_LEN  9
 
+enum arc_pmu_attr_groups {
+   ARCPMU_ATTR_GR_EVENTS,
+   ARCPMU_ATTR_GR_FORMATS,
+   ARCPMU_NR_ATTR_GR
+};
+
+struct arc_pmu_raw_event_entry {
+   char name[ARCPMU_EVENT_NAME_LEN];
+};
+
 struct arc_pmu {
struct pmu  pmu;
unsigned intirq;
int n_counters;
+   int n_events;
u64 max_period;
int ev_hw_idx[PERF_COUNT_ARC_HW_MAX];
+
+   struct arc_pmu_raw_event_entry  *raw_entry;
+   struct attribute**attrs;
+   struct perf_pmu_events_attr *attr;
+   const struct attribute_group*attr_groups[ARCPMU_NR_ATTR_GR + 1];
 };
 
 struct arc_pmu_cpu {
@@ -196,6 +212,17 @@ static int arc_pmu_event_init(struct perf_event *event)
 (int)hwc->config, arc_pmu_ev_hw_map[ret]);
return 0;
 
+   case PERF_TYPE_RAW:
+   if (event->attr.config >= arc_pmu->n_events)
+   return -ENOENT;
+
+   hwc->config |= event->attr.config;
+   pr_debug("init raw event with idx %lld \'%s\'\n",
+event->attr.config,
+arc_pmu->raw_entry[event->attr.config].name);
+
+   return 0;
+
default:
return -ENOENT;
}
@@ -446,6 +473,68 @@ static void arc_cpu_pmu_irq_init(void *data)
write_aux_reg(ARC_REG_PCT_INT_ACT, 0x);
 }
 
+/* Event field occupies the bottom 15 bits of our config field */
+PMU_FORMAT_ATTR(event, "config:0-14");
+static struct attribute *arc_pmu_format_attrs[] = {
+   _attr_event.attr,
+   NULL,
+};
+
+static struct attribute_group arc_pmu_format_attr_gr = {
+   .name = "format",
+   .attrs = arc_pmu_format_attrs,
+};
+
+static ssize_t
+arc_pmu_events_sysfs_show(struct device *dev,
+ struct device_attribute *attr, char *page)
+{
+   struct perf_pmu_events_attr *pmu_attr;
+
+   pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
+   return sprintf(page, "event=0x%04llx\n", pmu_attr->id);
+}
+
+/*
+ * We don't add attrs here as we don't have pre-defined list of perf events.
+ * We will generate and add attrs dynamically in probe() after we read HW
+ * configuration.
+ */
+static struct attribute_group arc_pmu_events_attr_gr = {
+   .name = "events",
+};
+
+static void arc_pmu_add_raw_event_attr(int j, char *str)
+{
+   memmove(arc_pmu->raw_entry[j].name, str, ARCPMU_EVENT_NAME_LEN - 1);
+   arc_pmu->attr[j].attr.attr.name = arc_pmu->raw_entry[j].name;
+   arc_pmu->attr[j].attr.attr.mode = VERIFY_OCTAL_PERMISSIONS(0444);
+   arc_pmu->attr[j].attr.show = arc_pmu_events_sysfs_show;
+   arc_pmu->attr[j].id = j;
+   arc_pmu->attrs[j] = &(arc_pmu->attr[j].attr.attr);
+}
+
+static int arc_pmu_raw_alloc(struct device *dev)
+{
+   arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
+   sizeof(struct perf_pmu_events_attr), GFP_KERNEL | __GFP_ZERO);
+   if (!arc_pmu->attr)
+   return -ENOMEM;
+
+   arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1,
+   sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO);
+   if (!arc_pmu->attrs)
+   return -ENOMEM;
+
+   arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events,
+   sizeof(struct arc_pmu_raw_event_entry),
+   GFP_KERNEL | __GFP_ZERO);
+   if (!arc_pmu->raw_entry)
+   return -ENOMEM;
+
+   return 0;
+}
+
 static int arc_pmu_device_probe(struct platform_device *pdev)
 {
struct arc_reg_pct_build pct_bcr;
@@ -477,6 

[PATCH 4/5] ARC: perf: fix description comment

2018-12-05 Thread Eugeniy Paltsev
Fix description comment as this code doesn't belong only to
ARC700 anymore.

Also while I'm at it, use SPDX License Identifier.

Signed-off-by: Eugeniy Paltsev 
---
 arch/arc/kernel/perf_event.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c
index 8c88837fcd83..b6207090aaa7 100644
--- a/arch/arc/kernel/perf_event.c
+++ b/arch/arc/kernel/perf_event.c
@@ -1,15 +1,10 @@
-/*
- * Linux performance counter support for ARC700 series
- *
- * Copyright (C) 2013-2015 Synopsys, Inc. (www.synopsys.com)
- *
- * This code is inspired by the perf support of various other architectures.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Linux performance counter support for ARC CPUs.
+// This code is inspired by the perf support of various other architectures.
+//
+// Copyright (C) 2013-2018 Synopsys, Inc. (www.synopsys.com)
+
 #include 
 #include 
 #include 
-- 
2.14.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/5] introduce Kernel PMU events support

2018-12-05 Thread Eugeniy Paltsev
Introduce Kernel PMU events support and refactor ARC-specific perf code. 

Eugeniy Paltsev (5):
  ARC: perf: trivial code cleanup
  ARC: perf: introduce Kernel PMU events support
  ARC: perf: fix of kernel data types using
  ARC: perf: fix description comment
  ARC: perf: remove useless ifdefs

 arch/arc/kernel/perf_event.c | 179 ++-
 1 file changed, 141 insertions(+), 38 deletions(-)

-- 
2.14.5


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 3/3] arch: remove redundant generic-y defines

2018-12-05 Thread Christoph Hellwig
On Wed, Dec 05, 2018 at 06:44:38AM -0800, Christoph Hellwig wrote:
> On Wed, Dec 05, 2018 at 08:28:06PM +0900, Masahiro Yamada wrote:
> > Now that Kbuild automatically creates asm-generic wrappers for missing
> > mandatory headers, it is redundant to list the same headers in
> > generic-y and mandatory-y.
> > 
> > Suggested-by: Sam Ravnborg 
> > Signed-off-by: Masahiro Yamada 
> 
> Oh, that is very useful, especially as maintainance of those
> generic-y lines has been a mess!
> 
> Acked-by: Christoph Hellwig 

Actually - it seems like you are keeping some generic-y lines, what
is the reason for that?

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 3/3] arch: remove redundant generic-y defines

2018-12-05 Thread Christoph Hellwig
On Wed, Dec 05, 2018 at 08:28:06PM +0900, Masahiro Yamada wrote:
> Now that Kbuild automatically creates asm-generic wrappers for missing
> mandatory headers, it is redundant to list the same headers in
> generic-y and mandatory-y.
> 
> Suggested-by: Sam Ravnborg 
> Signed-off-by: Masahiro Yamada 

Oh, that is very useful, especially as maintainance of those
generic-y lines has been a mess!

Acked-by: Christoph Hellwig 

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/3] arch: remove redundant generic-y defines

2018-12-05 Thread Masahiro Yamada
Now that Kbuild automatically creates asm-generic wrappers for missing
mandatory headers, it is redundant to list the same headers in
generic-y and mandatory-y.

Suggested-by: Sam Ravnborg 
Signed-off-by: Masahiro Yamada 
---

 arch/alpha/include/uapi/asm/Kbuild  |  5 -
 arch/arc/include/uapi/asm/Kbuild| 23 ---
 arch/arm/include/uapi/asm/Kbuild| 15 ---
 arch/arm64/include/uapi/asm/Kbuild  | 17 -
 arch/c6x/include/uapi/asm/Kbuild| 25 -
 arch/h8300/include/uapi/asm/Kbuild  | 25 -
 arch/hexagon/include/uapi/asm/Kbuild| 22 --
 arch/ia64/include/uapi/asm/Kbuild   |  5 -
 arch/m68k/include/uapi/asm/Kbuild   | 18 --
 arch/microblaze/include/uapi/asm/Kbuild | 24 
 arch/mips/include/uapi/asm/Kbuild   |  1 -
 arch/nds32/include/uapi/asm/Kbuild  | 24 
 arch/nios2/include/uapi/asm/Kbuild  | 24 
 arch/openrisc/include/uapi/asm/Kbuild   | 26 --
 arch/parisc/include/uapi/asm/Kbuild |  5 -
 arch/powerpc/include/uapi/asm/Kbuild|  6 --
 arch/riscv/include/uapi/asm/Kbuild  | 25 -
 arch/s390/include/uapi/asm/Kbuild   | 14 --
 arch/sh/include/uapi/asm/Kbuild | 17 -
 arch/sparc/include/uapi/asm/Kbuild  |  1 -
 arch/unicore32/include/uapi/asm/Kbuild  | 27 ---
 arch/x86/include/uapi/asm/Kbuild|  1 -
 arch/xtensa/include/uapi/asm/Kbuild |  8 
 23 files changed, 358 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/Kbuild 
b/arch/alpha/include/uapi/asm/Kbuild
index 1a5b753..14a2e9a 100644
--- a/arch/alpha/include/uapi/asm/Kbuild
+++ b/arch/alpha/include/uapi/asm/Kbuild
@@ -2,8 +2,3 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += bpf_perf_event.h
-generic-y += ipcbuf.h
-generic-y += msgbuf.h
-generic-y += poll.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
diff --git a/arch/arc/include/uapi/asm/Kbuild b/arch/arc/include/uapi/asm/Kbuild
index 170b5db..f53f8e4 100644
--- a/arch/arc/include/uapi/asm/Kbuild
+++ b/arch/arc/include/uapi/asm/Kbuild
@@ -1,29 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bpf_perf_event.h
-generic-y += errno.h
-generic-y += fcntl.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += kvm_para.h
-generic-y += mman.h
-generic-y += msgbuf.h
-generic-y += param.h
-generic-y += poll.h
-generic-y += posix_types.h
-generic-y += resource.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += stat.h
-generic-y += statfs.h
-generic-y += termbits.h
-generic-y += termios.h
-generic-y += types.h
 generic-y += ucontext.h
diff --git a/arch/arm/include/uapi/asm/Kbuild b/arch/arm/include/uapi/asm/Kbuild
index 4d1cc18..279edb1 100644
--- a/arch/arm/include/uapi/asm/Kbuild
+++ b/arch/arm/include/uapi/asm/Kbuild
@@ -6,19 +6,4 @@ generated-y += unistd-common.h
 generated-y += unistd-oabi.h
 generated-y += unistd-eabi.h
 
-generic-y += bitsperlong.h
 generic-y += bpf_perf_event.h
-generic-y += errno.h
-generic-y += ioctl.h
-generic-y += ipcbuf.h
-generic-y += msgbuf.h
-generic-y += param.h
-generic-y += poll.h
-generic-y += resource.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
-generic-y += siginfo.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += termbits.h
-generic-y += termios.h
diff --git a/arch/arm64/include/uapi/asm/Kbuild 
b/arch/arm64/include/uapi/asm/Kbuild
index 6c5adf4..bca548a 100644
--- a/arch/arm64/include/uapi/asm/Kbuild
+++ b/arch/arm64/include/uapi/asm/Kbuild
@@ -2,21 +2,4 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-generic-y += errno.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += kvm_para.h
-generic-y += mman.h
-generic-y += msgbuf.h
-generic-y += poll.h
-generic-y += resource.h
-generic-y += sembuf.h
-generic-y += shmbuf.h
-generic-y += socket.h
-generic-y += sockios.h
-generic-y += swab.h
-generic-y += termbits.h
-generic-y += termios.h
-generic-y += types.h
-generic-y += siginfo.h
diff --git a/arch/c6x/include/uapi/asm/Kbuild b/arch/c6x/include/uapi/asm/Kbuild
index 26644e1..f53f8e4 100644
--- a/arch/c6x/include/uapi/asm/Kbuild
+++ b/arch/c6x/include/uapi/asm/Kbuild
@@ -1,31 +1,6 @@
 # UAPI Header export list
 include include/uapi/asm-generic/Kbuild.asm
 
-generic-y += auxvec.h
-generic-y += bitsperlong.h
 generic-y += bpf_perf_event.h
-generic-y += errno.h
-generic-y += fcntl.h
-generic-y += ioctl.h
-generic-y += ioctls.h
-generic-y += ipcbuf.h
 generic-y += kvm_para.h
-generic-y += mman.h
-generic-y += msgbuf.h
-generic-y += param.h
-generic-y += poll.h
-generic-y +=