question on FSL_EMB perf
Hi Mike, Ben, I just noticed: arch/powerpc/Kconfig: select HAVE_PERF_EVENTS_NMI if PPC64 But can't ppc32 have FSL_EMB perf? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 6/6] powerpc/kvm: change the condition of identifying hugetlb vm
Hugetlb VMAs are not mergeable, that means a VMA couldn't have VM_HUGETLB and VM_MERGEABLE been set in the same time. So we use VM_HUGETLB to indicate new mergeable VMAs. Because of that a VMA which has VM_HUGETLB been set is a hugetlb VMA only if it doesn't have VM_MERGEABLE been set in the same time. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- arch/powerpc/kvm/e500_mmu_host.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/e500_mmu_host.c b/arch/powerpc/kvm/e500_mmu_host.c index cc536d4..d76f518 100644 --- a/arch/powerpc/kvm/e500_mmu_host.c +++ b/arch/powerpc/kvm/e500_mmu_host.c @@ -423,7 +423,8 @@ static inline int kvmppc_e500_shadow_map(struct kvmppc_vcpu_e500 *vcpu_e500, break; } } else if (vma hva = vma-vm_start - (vma-vm_flags VM_HUGETLB)) { + ((vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == + VM_HUGETLB)) { unsigned long psize = vma_kernel_pagesize(vma); tsize = (gtlbe-mas1 MAS1_TSIZE_MASK) -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 08/19] perf, tools: Support CPU id matching for x86 v2
From: Andi Kleen a...@linux.intel.com Implement the code to match CPU types to mapfile types for x86 based on CPUID. This extends an existing similar function, but changes it to use the x86 mapfile cpu description. This allows to resolve event lists generated by jevents. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- v2: Update to new get_cpuid_str() interface --- tools/perf/arch/x86/util/header.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/x86/util/header.c b/tools/perf/arch/x86/util/header.c index 146d12a..a74a48d 100644 --- a/tools/perf/arch/x86/util/header.c +++ b/tools/perf/arch/x86/util/header.c @@ -19,8 +19,8 @@ cpuid(unsigned int op, unsigned int *a, unsigned int *b, unsigned int *c, : a (op)); } -int -get_cpuid(char *buffer, size_t sz) +static int +__get_cpuid(char *buffer, size_t sz, const char *fmt) { unsigned int a, b, c, d, lvl; int family = -1, model = -1, step = -1; @@ -48,7 +48,7 @@ get_cpuid(char *buffer, size_t sz) if (family = 0x6) model += ((a 16) 0xf) 4; } - nb = scnprintf(buffer, sz, %s,%u,%u,%u$, vendor, family, model, step); + nb = scnprintf(buffer, sz, fmt, vendor, family, model, step); /* look for end marker to ensure the entire data fit */ if (strchr(buffer, '$')) { @@ -57,3 +57,21 @@ get_cpuid(char *buffer, size_t sz) } return -1; } + +int +get_cpuid(char *buffer, size_t sz) +{ + return __get_cpuid(buffer, sz, %s,%u,%u,%u$); +} + +char * +get_cpuid_str(void) +{ + char *buf = malloc(128); + + if (__get_cpuid(buf, 128, %s-%u-%X$) 0) { + free(buf); + return NULL; + } + return buf; +} -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 11/19] perf, tools: Add a --no-desc flag to perf list
From: Andi Kleen a...@linux.intel.com Add a --no-desc flag to perf list to not print the event descriptions that were earlier added for JSON events. This may be useful to get a less crowded listing. It's still default to print descriptions as that is the more useful default for most users. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- v2: Rename --quiet to --no-desc. Add option to man page. --- tools/perf/Documentation/perf-list.txt | 8 +++- tools/perf/builtin-list.c | 12 tools/perf/util/parse-events.c | 4 ++-- tools/perf/util/parse-events.h | 2 +- tools/perf/util/pmu.c | 4 ++-- tools/perf/util/pmu.h | 2 +- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index bada893..9507552 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -8,13 +8,19 @@ perf-list - List all symbolic event types SYNOPSIS [verse] -'perf list' [hw|sw|cache|tracepoint|pmu|event_glob] +'perf list' [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob] DESCRIPTION --- This command displays the symbolic event types which can be selected in the various perf commands with the -e option. +OPTIONS +--- +--no-desc:: +Don't print descriptions. + + [[EVENT_MODIFIERS]] EVENT MODIFIERS --- diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index af5bd05..3f058f7 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -16,16 +16,20 @@ #include util/pmu.h #include util/parse-options.h +static bool desc_flag = true; + int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) { int i; bool raw_dump = false; struct option list_options[] = { OPT_BOOLEAN(0, raw-dump, raw_dump, Dump raw events), + OPT_BOOLEAN('d', desc, desc_flag, + Print extra event descriptions. --no-desc to not print.), OPT_END() }; const char * const list_usage[] = { - perf list [hw|sw|cache|tracepoint|pmu|event_glob], + perf list [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob], NULL }; @@ -40,7 +44,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) printf(\nList of pre-defined events (to be used in -e):\n\n); if (argc == 0) { - print_events(NULL, raw_dump); + print_events(NULL, raw_dump, !desc_flag); return 0; } @@ -59,13 +63,13 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) strcmp(argv[i], hwcache) == 0) print_hwcache_events(NULL, raw_dump); else if (strcmp(argv[i], pmu) == 0) - print_pmu_events(NULL, raw_dump); + print_pmu_events(NULL, raw_dump, !desc_flag); else { char *sep = strchr(argv[i], ':'), *s; int sep_idx; if (sep == NULL) { - print_events(argv[i], raw_dump); + print_events(argv[i], raw_dump, !desc_flag); continue; } sep_idx = sep - argv[i]; diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 2a4d1ec..65f7572 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1521,7 +1521,7 @@ out_enomem: /* * Print the help text for the event symbols: */ -void print_events(const char *event_glob, bool name_only) +void print_events(const char *event_glob, bool name_only, bool quiet_flag) { print_symbol_events(event_glob, PERF_TYPE_HARDWARE, event_symbols_hw, PERF_COUNT_HW_MAX, name_only); @@ -1531,7 +1531,7 @@ void print_events(const char *event_glob, bool name_only) print_hwcache_events(event_glob, name_only); - print_pmu_events(event_glob, name_only); + print_pmu_events(event_glob, name_only, quiet_flag); if (event_glob != NULL) return; diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 131f29b..d11f854 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -133,7 +133,7 @@ void parse_events_update_lists(struct list_head *list_event, void parse_events_evlist_error(struct parse_events_evlist *data, int idx, const char *str); -void print_events(const char *event_glob, bool name_only); +void print_events(const char *event_glob, bool name_only, bool quiet);
Re: [kernel, v12, 17/34] powerpc/spapr: vfio: Switch from iommu_table to new iommu_table_group
On Fri, 2015-05-06 at 06:35:09 UTC, Alexey Kardashevskiy wrote: So far one TCE table could only be used by one IOMMU group. However IODA2 hardware allows programming the same TCE table address to multiple PE allowing sharing tables. ... + pnv_pci_link_table_and_group(phb-hose-node, 0, tbl, pe-table_group); + pnv_pci_link_table_and_group(phb-hose-node, 0, tbl, pe-table_group); + pnv_pci_link_table_and_group(phb-hose-node, 0, + tbl, phb-p5ioc2.table_group); +long pnv_pci_link_table_and_group(int node, int num, + struct iommu_table *tbl, + struct iommu_table_group *table_group) +{ + struct iommu_table_group_link *tgl = NULL; + + BUG_ON(!tbl); + BUG_ON(!table_group); + BUG_ON(!table_group-group); + + tgl = kzalloc_node(sizeof(struct iommu_table_group_link), GFP_KERNEL, + node); + if (!tgl) + return -ENOMEM; + + tgl-table_group = table_group; + list_add_rcu(tgl-next, tbl-it_group_list); + + table_group-tables[num] = tbl; + + return 0; I'm not a fan of the BUG_ONs here. This routine is so important that you have to BUG_ON three times at the start, yet you never check the return code if it fails? That doesn't make sense to me. If anything this should be sufficient: if (WARN_ON(!tbl || !table_group)) return -EINVAL; cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 5/6] x86/mm: change the condition of identifying hugetlb vm
Hugetlb VMAs are not mergeable, that means a VMA couldn't have VM_HUGETLB and VM_MERGEABLE been set in the same time. So we use VM_HUGETLB to indicate new mergeable VMAs. Because of that a VMA which has VM_HUGETLB been set is a hugetlb VMA only if it doesn't have VM_MERGEABLE been set in the same time. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- arch/x86/mm/tlb.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 3250f23..0247916 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -195,7 +195,8 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, goto out; } - if ((end != TLB_FLUSH_ALL) !(vmflag VM_HUGETLB)) + if ((end != TLB_FLUSH_ALL) + !((vmflag (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB)) base_pages_to_flush = (end - start) PAGE_SHIFT; if (base_pages_to_flush tlb_single_page_flush_ceiling) { -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V15 00/19] perf, tools: Add support for PMU events in JSON format
CPUs support a large number of performance monitoring events (PMU events) and often these events are very specific to an architecture/model of the CPU. To use most of these PMU events with perf, we currently have to identify them by their raw codes: perf stat -e r100f2 sleep 1 This patchset allows architectures to specify these PMU events in JSON files located in 'tools/perf/pmu-events/arch/' of the mainline tree. The events from the JSON files for the architecture are then built into the perf binary. At run time, perf identifies the specific set of events for the CPU and creates event aliases. These aliases allow users to specify events by name as: perf stat -e pm_1plus_ppc_cmpl sleep 1 The file, 'tools/perf/pmu-events/README' in [PATCH 19/19] gives more details. Note: - All known events tables for the architecture are included in the perf binary. - For architectures that don't have any JSON files, an empty mapping table is created and they should continue to build) Thanks to input from Andi Kleen, Jiri Olsa, Namhyung Kim and Ingo Molnar. These patches are available from: https://github.com:sukadev/linux.git Branch Description -- json-v15Source Code only json-files-5x86 and Powerpc datafiles only json-v15-with-data Both code and data (build/test) NOTE: Only source code patches (i.e those in json-v15) are being emailed. Please pull the data files from the json-files-5 branch. Changelog[v15] Code changes: - Fix 'perf list' usage string and update man page. - Remove a redundant __maybe_unused tag. - Rebase to recent perf/core branch. Data files updates: json-files-5 branch - Rebase to perf/intel-json-files-5 from Andi Kleen - Add patch from Madhavan Srinivasan for couple more Powerpc models Changelog[v14] Comments from Jiri Olsa: - Change parameter name/type for pmu_add_cpu_aliases (from void *data to list_head *head) - Use asprintf() in file_name_to_tablename() and simplify/reorg code. - Use __weak definition from linux/compile.h - Use fopen() with mode w and eliminate unlink() - Remove minor TODO. - Add error check for return value from strdup() in print_pmu_events(). - Move independent changes from patches 3,11,12 .. to separate patches for easier review/backport. - Clarify mapfile's header line support in patch description. - Fix build failure with DEBUG=1 Comment from Andi Kleen: - In tools/perf/pmu-events/Build, check for 'mapfile.csv' rather than 'mapfile*' Misc: - Minor changes/clarifications to tools/perf/pmu-events/README. Changelog[v13] Version: Individual patches have their own history :-) that I am preserving. Patchset version (v13) is for overall patchset and is somewhat arbitrary. - Added support for categories of events to perf - Add mapfile, jevents build dependency on pmu-events.c - Silence jevents when parsing JSON files unless V=1 is specified - Cleanup error messages - Fix memory leak with -cpuid - Rebase to Arnaldo's tree - Allow overriding CPUID via environment variable - Support long descriptions for events - Handle header line in mapfile.csv - Cleanup JSON files (trim PublicDescription if identical to/prefix of BriefDescription field) *** BLURB HERE *** Andi Kleen (10): perf, tools: Add jsmn `jasmine' JSON parser perf, tools, jevents: Program to convert JSON file to C style file perf, tools: Allow events with dot perf, tools: Support CPU id matching for x86 v2 perf, tools: Support alias descriptions perf, tools: Query terminal width and use in perf list perf, tools: Add a --no-desc flag to perf list perf, tools: Add override support for event list CPUID perf, tools: Add support for event list topics perf, tools: Handle header line in mapfile Sukadev Bhattiprolu (9): Use __weak definition from linux/compiler.h perf, tools: Split perf_pmu__new_alias() perf, tools: Use pmu_events table to create aliases perf, tools: Support CPU ID matching for Powerpc perf, tools, jevents: Add support for long descriptions perf, tools: Add alias support for long descriptions perf, tools: Support long descriptions with perf list perf, tools, jevents: Add support for event topics perf, tools: Add README for info on parsing JSON/map files tools/perf/Documentation/perf-list.txt | 12 +- tools/perf/Makefile.perf | 25 +- tools/perf/arch/powerpc/util/header.c | 11 + tools/perf/arch/x86/util/header.c | 24 +- tools/perf/builtin-list.c | 17 +- tools/perf/pmu-events/Build
[PATCH v15 09/19] perf, tools: Support alias descriptions
From: Andi Kleen a...@linux.intel.com Add support to print alias descriptions in perf list, which are taken from the generated event files. The sorting code is changed to put the events with descriptions at the end. The descriptions are printed as possibly multiple word wrapped lines. Example output: % perf list ... arith.fpu_div [Divide operations executed] arith.fpu_div_active [Cycles when divider is busy executing divide operations] Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog - Delete a redundant free() Changelog[v14] - [Jiri Olsa] Fail, rather than continue if strdup() returns NULL; remove unnecessary __maybe_unused. --- tools/perf/util/pmu.c | 82 +-- tools/perf/util/pmu.h | 1 + 2 files changed, 67 insertions(+), 16 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7863d05..083cbc6 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -209,7 +209,7 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, } static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, -char *desc __maybe_unused, char *val) +char *desc, char *val) { struct perf_pmu_alias *alias; int ret; @@ -241,6 +241,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, perf_pmu__parse_snapshot(alias, dir, name); } + alias-desc = desc ? strdup(desc) : NULL; + list_add_tail(alias-list, list); return 0; @@ -989,11 +991,42 @@ static char *format_alias_or(char *buf, int len, struct perf_pmu *pmu, return buf; } -static int cmp_string(const void *a, const void *b) +struct pair { + char *name; + char *desc; +}; + +static int cmp_pair(const void *a, const void *b) +{ + const struct pair *as = a; + const struct pair *bs = b; + + /* Put extra events last */ + if (!!as-desc != !!bs-desc) + return !!as-desc - !!bs-desc; + return strcmp(as-name, bs-name); +} + +static void wordwrap(char *s, int start, int max, int corr) { - const char * const *as = a; - const char * const *bs = b; - return strcmp(*as, *bs); + int column = start; + int n; + + while (*s) { + int wlen = strcspn(s, \t); + + if (column + wlen = max column start) { + printf(\n%*s, start, ); + column = start + corr; + } + n = printf(%s%.*s, column start ? : , wlen, s); + if (n = 0) + break; + s += wlen; + column += n; + while (isspace(*s)) + s++; + } } void print_pmu_events(const char *event_glob, bool name_only) @@ -1003,7 +1036,9 @@ void print_pmu_events(const char *event_glob, bool name_only) char buf[1024]; int printed = 0; int len, j; - char **aliases; + struct pair *aliases; + int numdesc = 0; + int columns = 78; pmu = NULL; len = 0; @@ -1013,14 +1048,15 @@ void print_pmu_events(const char *event_glob, bool name_only) if (pmu-selectable) len++; } - aliases = zalloc(sizeof(char *) * len); + aliases = zalloc(sizeof(struct pair) * len); if (!aliases) goto out_enomem; pmu = NULL; j = 0; while ((pmu = perf_pmu__scan(pmu)) != NULL) { list_for_each_entry(alias, pmu-aliases, list) { - char *name = format_alias(buf, sizeof(buf), pmu, alias); + char *name = alias-desc ? alias-name : + format_alias(buf, sizeof(buf), pmu, alias); bool is_cpu = !strcmp(pmu-name, cpu); if (event_glob != NULL @@ -1029,37 +1065,51 @@ void print_pmu_events(const char *event_glob, bool name_only) event_glob continue; - if (is_cpu !name_only) + if (is_cpu !name_only !alias-desc) name = format_alias_or(buf, sizeof(buf), pmu, alias); - aliases[j] = strdup(name); - if (aliases[j] == NULL) + aliases[j].name = name; + if (is_cpu !name_only !alias-desc) + aliases[j].name = format_alias_or(buf, sizeof(buf), + pmu, alias); + aliases[j].name = strdup(aliases[j].name); +
[PATCH v15 14/19] perf, tools: Add alias support for long descriptions
Previously we were dropping the useful longer descriptions that some events have in the event list completely. Now that jevents provides support for longer descriptions (see previous patch), add support for parsing the long descriptions Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v14] - [Jiri Olsa] Break up independent parts of the patch into separate patches. --- tools/perf/util/parse-events.c | 5 +++-- tools/perf/util/parse-events.h | 3 ++- tools/perf/util/pmu.c | 15 ++- tools/perf/util/pmu.h | 4 +++- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 65f7572..c4ee41d 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1521,7 +1521,8 @@ out_enomem: /* * Print the help text for the event symbols: */ -void print_events(const char *event_glob, bool name_only, bool quiet_flag) +void print_events(const char *event_glob, bool name_only, bool quiet_flag, + bool long_desc) { print_symbol_events(event_glob, PERF_TYPE_HARDWARE, event_symbols_hw, PERF_COUNT_HW_MAX, name_only); @@ -1531,7 +1532,7 @@ void print_events(const char *event_glob, bool name_only, bool quiet_flag) print_hwcache_events(event_glob, name_only); - print_pmu_events(event_glob, name_only, quiet_flag); + print_pmu_events(event_glob, name_only, quiet_flag, long_desc); if (event_glob != NULL) return; diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index d11f854..5c93814 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -133,7 +133,8 @@ void parse_events_update_lists(struct list_head *list_event, void parse_events_evlist_error(struct parse_events_evlist *data, int idx, const char *str); -void print_events(const char *event_glob, bool name_only, bool quiet); +void print_events(const char *event_glob, bool name_only, bool quiet, + bool long_desc); struct event_symbol { const char *symbol; diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 2a7abac..61c86c8 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -210,7 +210,7 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, } static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, -char *desc, char *val) +char *desc, char *val, char *long_desc) { struct perf_pmu_alias *alias; int ret; @@ -243,6 +243,8 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, } alias-desc = desc ? strdup(desc) : NULL; + alias-long_desc = long_desc ? strdup(long_desc) : + desc ? strdup(desc) : NULL; list_add_tail(alias-list, list); @@ -260,7 +262,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI buf[ret] = 0; - return __perf_pmu__new_alias(list, dir, name, NULL, buf); + return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL); } static inline bool pmu_alias_info_file(char *name) @@ -508,7 +510,8 @@ static int pmu_add_cpu_aliases(struct list_head *head) /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe-name, - (char *)pe-desc, (char *)pe-event); + (char *)pe-desc, (char *)pe-event, + (char *)pe-long_desc); } out: @@ -1036,7 +1039,8 @@ static void wordwrap(char *s, int start, int max, int corr) } } -void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) +void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, + bool long_desc) { struct perf_pmu *pmu; struct perf_pmu_alias *alias; @@ -1083,7 +1087,8 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag) if (!aliases[j].name) goto out_enomem; - aliases[j].desc = alias-desc; + aliases[j].desc = long_desc ? alias-long_desc : + alias-desc; j++; } if (pmu-selectable) { diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 9966c1a..10e981c 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -39,6 +39,7 @@ struct perf_pmu_info { struct perf_pmu_alias { char *name; char *desc; + char *long_desc;
RE: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
Hi Eric, Can you please tell us if this change would be for the better? I was about to say yes to this request but checked and no other Ethernet driver seems to use the queue trans_start. I was able to find your patch net: tx scalability works : trans_start [ http://patchwork.ozlabs.org/patch/27104/ ] but did not find more about this topic. Thank you, Madalin -Original Message- From: Xie Jianhua-B29408 Sent: Wednesday, June 10, 2015 9:00 AM To: Bucur Madalin-Cristian-B32716; net...@vger.kernel.org; linuxppc- d...@lists.ozlabs.org Cc: linux-ker...@vger.kernel.org Subject: RE: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet -Original Message- From: Linuxppc-dev [mailto:linuxppc-dev- bounces+jianhua.xie=freescale@lists.ozlabs.org] On Behalf Of Madalin Bucur Sent: Wednesday, April 29, 2015 10:57 PM To: net...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org Cc: linux-ker...@vger.kernel.org; Bucur Madalin-Cristian-B32716 Subject: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet This introduces the Freescale Data Path Acceleration Architecture (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, BMan, PAMU and FMan drivers to deliver Ethernet connectivity on the Freescale DPAA QorIQ platforms. Snip.. + + if (unlikely(dpa_xmit(priv, percpu_stats, queue_mapping, fd) 0)) + goto xmit_failed; + + net_dev-trans_start = jiffies; It is probably better to use netdev_queue-trans_start to instead of net_dev-trans_start on SMP. Best Regards, Jianhua + return NETDEV_TX_OK; + +xmit_failed: + if (fd.cmd FM_FD_CMD_FCO) { + (*countptr)--; + dpa_fd_release(net_dev, fd); + percpu_stats-tx_errors++; + return NETDEV_TX_OK; + } + _dpa_cleanup_tx_fd(priv, fd); + percpu_stats-tx_errors++; + dev_kfree_skb(skb); + return NETDEV_TX_OK; +} -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 03/12] fsl/fman: Add the FMan port FLIB headers
From: Igal Liberman igal.liber...@freescale.com The FMan Port Flib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../net/ethernet/freescale/fman/flib/fman_common.h | 73 .../ethernet/freescale/fman/flib/fsl_fman_port.h | 427 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 54 +++ 3 files changed, 554 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fman_common.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fman_common.h b/drivers/net/ethernet/freescale/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index
[PATCH 06/12] fsl/fman: Add the FMan MAC FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile |1 + drivers/net/ethernet/freescale/fman/mac/Makefile |5 + .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 + .../freescale/fman/mac/fman_memac_mii_acc.c| 217 .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 7 files changed, 1544 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/mac/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_tgec.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 50a4de2..1841b03 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -5,3 +5,4 @@ obj-y += fsl_fman.o fsl_fman-objs := fman.o obj-y += port/ +obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/mac/Makefile b/drivers/net/ethernet/freescale/fman/mac/Makefile new file mode 100644 index 000..ce03e25 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-y += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_memac_mii_acc.o\ + fman_tgec.o diff --git a/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c new file mode 100644 index 000..290a037 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c @@ -0,0 +1,571 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include fsl_fman_dtsec.h + +void fman_dtsec_stop_rx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(regs-rctrl) | RCTRL_GRS, regs-rctrl); +} + +void fman_dtsec_stop_tx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(regs-tctrl) | DTSEC_TCTRL_GTS, regs-tctrl); +} + +void fman_dtsec_start_tx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(regs-tctrl) ~DTSEC_TCTRL_GTS, regs-tctrl); +} + +void fman_dtsec_start_rx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(regs-rctrl) ~RCTRL_GRS, regs-rctrl); +} + +void fman_dtsec_defconfig(struct dtsec_cfg *cfg) +{ + cfg-halfdup_on = DEFAULT_HALFDUP_ON; + cfg-halfdup_retransmit = DEFAULT_HALFDUP_RETRANSMIT; +
[PATCH 10/12] fsl/fman: Add FMan SP support
From: Igal Liberman igal.liber...@freescale.com Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/sp/Makefile|3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 398 4 files changed, 507 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include service.h +#include fm_ext.h +#include fsl_fman.h + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +struct
[PATCH 02/12] fsl/fman: Add the FMan FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile |2 + drivers/net/ethernet/freescale/fman/Kconfig |7 + drivers/net/ethernet/freescale/fman/Makefile |5 + drivers/net/ethernet/freescale/fman/fman.c | 973 ++ 5 files changed, 988 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/Kconfig create mode 100644 drivers/net/ethernet/freescale/fman/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/fman.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index 25e3425..24e938d 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -55,6 +55,7 @@ config FEC_MPC52xx_MDIO If compiled as module, it will be called fec_mpc52xx_phy. source drivers/net/ethernet/freescale/fs_enet/Kconfig +source drivers/net/ethernet/freescale/fman/Kconfig config FSL_PQ_MDIO tristate Freescale PQ MDIO diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 71debd1..4097c58 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -17,3 +17,5 @@ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool FMan support + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile new file mode 100644 index 000..2799c6f --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c new file mode 100644 index 000..410c498 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -0,0 +1,973 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include fsl_fman.h + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(bmi_rg-fmbm_ievr); + mask = ioread32be(bmi_rg-fmbm_ier); + event = mask; + /* clear the forced events */ + force = ioread32be(bmi_rg-fmbm_ifr); + if (force event) + iowrite32be(force ~event, bmi_rg-fmbm_ifr); + /* clear the
[PATCH 07/12] fsl/fman: Add FMan MURAM support
From: Igal Liberman igal.liber...@freescale.com Add Frame Manager Multi-User RAM support. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |6 +- drivers/net/ethernet/freescale/fman/fm_muram.c | 127 .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 103 4 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ethernet/freescale/fman/fm_muram.c create mode 100644 drivers/net/ethernet/freescale/fman/inc/fm_muram_ext.h diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index af42c3a..825a0d5 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -1,6 +1,7 @@ config FSL_FMAN bool FMan support depends on FSL_SOC || COMPILE_TEST + select GENERIC_ALLOCATOR default n help Freescale Data-Path Acceleration Architecture Frame Manager diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 1841b03..55c91bd 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -1,8 +1,10 @@ -subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib \ + -I$(srctree)/drivers/net/ethernet/freescale/fman/inc \ + -I$(srctree)/drivers/net/ethernet/freescale/fman obj-y += fsl_fman.o -fsl_fman-objs := fman.o +fsl_fman-objs := fman.o fm_muram.o obj-y += port/ obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/fm_muram.c b/drivers/net/ethernet/freescale/fman/fm_muram.c new file mode 100644 index 000..f62042a --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_muram.c @@ -0,0 +1,127 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* FM MURAM ... */ +#include fm_muram_ext.h + +#include linux/io.h +#include linux/string.h +#include linux/slab.h +#include linux/genalloc.h + +struct muram_info { + struct gen_pool *pool; + void __iomem *vbase; + uint64_t size; + phys_addr_t pbase; +}; + +struct muram_info *fm_muram_init(phys_addr_t base, uint64_t size) +{ + struct muram_info *p_muram; + void __iomem *vaddr; + int ret; + + p_muram = kzalloc(sizeof(*p_muram), GFP_KERNEL); + if (!p_muram) + return NULL; + + p_muram-pool = gen_pool_create(ilog2(64), -1); + if (!p_muram-pool) { + pr_err(%s(): MURAM pool create failed\n, __func__); + return NULL; + } + + vaddr = ioremap(base, size); + if (!vaddr) { + pr_err(%s(): MURAM ioremap failed\n, __func__); + return NULL; + } + + ret = gen_pool_add_virt(p_muram-pool, (unsigned long)vaddr, + base, size, -1); + if (ret 0) { + pr_err(%s(): MURAM pool add failed\n,
Re: [PATCH V8 02/10] powerpc, perf: Restore privillege level filter support for BHRB
On 06/10/2015 09:13 AM, Daniel Axtens wrote: In the subject line, privilege should only have 1 l, and I think it should probably start with powerpc/perf: rather than powerpc, perf:. Will fix the typo here. Have been using powerpc, perf: format for some time now :) Seems to be more cleaner compared to powerpc/perf: format. But again its subjective. On Mon, 2015-06-08 at 17:08 +0530, Anshuman Khandual wrote: From: khand...@linux.vnet.ibm.com khand...@linux.vnet.ibm.com 'commit 9de5cb0f6df8 (powerpc/perf: Add per-event excludes on Power8)' Does this need a 'Fixes:' tag then? Not really, it only fixes the BHRB privilege request cases not other scenarios which are impacted by this previous commit. broke the PMU based BHRB privilege level filter. BHRB depends on the same MMCR0 bits for privilege level filter which was used to freeze all the PMCs as a group. Once we moved to individual event based privilege filters through MMCR2 register on POWER8, event associated privilege filters are no longer applicable to the BHRB captured branches. This patch solves the problem by restoring to the previous method of privilege level filters for the event in case BHRB based branch stack sampling is requested. This patch also changes 'check_excludes' for the same reason. Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com --- arch/powerpc/perf/core-book3s.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index c246e65..ae61629 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -930,7 +930,7 @@ static int power_check_constraints(struct cpu_hw_events *cpuhw, * added events. */ Does this comment need to be updated? Not really. The previous commit did not update it, hence this patch would skip it as well. static int check_excludes(struct perf_event **ctrs, unsigned int cflags[], - int n_prev, int n_new) + int n_prev, int n_new, int bhrb_users) { int eu = 0, ek = 0, eh = 0; int i, n, first; @@ -941,7 +941,7 @@ static int check_excludes(struct perf_event **ctrs, unsigned int cflags[], * don't need to do any of this logic. NB. This assumes no PMU has both * per event exclude and limited PMCs. */ Likewise, does this comment need to be updated? Yeah, will update it. -if (ppmu-flags PPMU_ARCH_207S) +if ((ppmu-flags PPMU_ARCH_207S) !bhrb_users) return 0; n = n_prev + n_new; @@ -1259,7 +1259,7 @@ static void power_pmu_enable(struct pmu *pmu) goto out; } -if (!(ppmu-flags PPMU_ARCH_207S)) { +if (!(ppmu-flags PPMU_ARCH_207S) || cpuhw-bhrb_users) You're using cpuhw-bhrb_users as a bool here, where it's an int. Could you make the test more specific so that it's clear exactly what you're expecting bhrb_users to contain? Using cpuhw-bhrb_users as a bool just verifies whether it contains zero or non-zero value in it. The test seems to be doing that as expected. But yes, we can move it as a nested conditional block as well if that is better. { /* * Add in MMCR0 freeze bits corresponding to the attr.exclude_* * bits for the first event. We have already checked that all @@ -1284,7 +1284,7 @@ static void power_pmu_enable(struct pmu *pmu) mtspr(SPRN_MMCR1, cpuhw-mmcr[1]); mtspr(SPRN_MMCR0, (cpuhw-mmcr[0] ~(MMCR0_PMC1CE | MMCR0_PMCjCE)) | MMCR0_FC); -if (ppmu-flags PPMU_ARCH_207S) +if ((ppmu-flags PPMU_ARCH_207S) !cpuhw-bhrb_users) mtspr(SPRN_MMCR2, cpuhw-mmcr[3]); /* @@ -1436,7 +1436,8 @@ static int power_pmu_add(struct perf_event *event, int ef_flags) if (cpuhw-group_flag PERF_EVENT_TXN) goto nocheck; -if (check_excludes(cpuhw-event, cpuhw-flags, n0, 1)) +if (check_excludes(cpuhw-event, cpuhw-flags, +n0, 1, cpuhw-bhrb_users)) goto out; if (power_check_constraints(cpuhw, cpuhw-events, cpuhw-flags, n0 + 1)) goto out; @@ -1615,7 +1616,7 @@ static int power_pmu_commit_txn(struct pmu *pmu) return -EAGAIN; cpuhw = this_cpu_ptr(cpu_hw_events); n = cpuhw-n_events; -if (check_excludes(cpuhw-event, cpuhw-flags, 0, n)) +if (check_excludes(cpuhw-event, cpuhw-flags, 0, n, cpuhw-bhrb_users)) return -EAGAIN; i = power_check_constraints(cpuhw, cpuhw-events, cpuhw-flags, n); if (i 0) @@ -1828,10 +1829,12 @@ static int power_pmu_event_init(struct perf_event *event) events[n] = ev; ctrs[n] = event; cflags[n] = flags; -if (check_excludes(ctrs, cflags, n, 1)) +cpuhw = get_cpu_var(cpu_hw_events); Should this be using a this_cpu_ptr rather than a get_cpu_var? (as with the power_pmu_commit_txn
Re: [PATCH V8 04/10] powerpc, perf: Re organize PMU based branch filter processing in POWER8
On 06/10/2015 10:37 AM, Daniel Axtens wrote: /* Every thing else is unsupported */ return -1; You're returning -1 as a unsigned 64bit number. Other code that reads this value tests for -1 and I think it works everywhere just because it wraps around consistently. But I would still rather not do this and I'm surprised it doesn't throw a warning. Thats the existing code which is going away with this patch series. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V8 01/10] powerpc, perf: Drop the branch sample when 'from' cannot be fetched
On 06/10/2015 08:51 AM, Daniel Axtens wrote: Hi Anshuman, Was there a cover letter for this series that I missed? This is the continuation (rebased and reworked) of the series posted at https://lkml.org/lkml/2014/5/5/153 (which is V6). I remember to have incremented the count for the re-send of the first four patches of the series to Peter Z for generic review which got pulled in last year. These patches here are the remaining powerpc part of the original series. Will list down the current changes as well next time around along with the new ones. On Mon, 2015-06-08 at 17:08 +0530, Anshuman Khandual wrote: BHRB is a rolling buffer. Hence we might end up in a situation where Could you spell out what BHRB stands for? Branch History Rolling Buffer, would you like to have that in the commit message as well ? we have read one target address but when we try to read the next entry indicating the from address of the targe, the buffer just overflows. target? Yeah its target address. In this case, the captured from address will be zero which indicates the end of the buffer. In what sort of situations would this occur? It seems like something we would want to avoid if possible? Its not avoidable. During regular flow of branch recording, the HW would have written both the records correctly but then the new ones came in and we just happen to loose one of them causing this situation. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V8 08/10] powerpc, perf: Change POWER8 PMU configuration to work with SW filters
On 06/10/2015 11:19 AM, Daniel Axtens wrote: On Mon, 2015-06-08 at 17:08 +0530, Anshuman Khandual wrote: The kernel now supports SW based branch filters for book3s systems with some specific requirements while dealing with HW supported branch filters in order to achieve overall OR semantics prevailing in perf branch stack sampling framework. This patch adapts the BHRB branch filter configuration to meet those protocols. POWER8 PMU can only handle one HW based branch filter request at any point of time. For all other combinations PMU will pass it on to the SW. Signed-off-by: Anshuman Khandual khand...@linux.vnet.ibm.com --- arch/powerpc/perf/power8-pmu.c | 51 -- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/perf/power8-pmu.c b/arch/powerpc/perf/power8-pmu.c index 5e17cb5..8fccf6c 100644 --- a/arch/powerpc/perf/power8-pmu.c +++ b/arch/powerpc/perf/power8-pmu.c @@ -656,6 +656,16 @@ static int power8_generic_events[] = { This is, I think, the third time you've modified this function in this patch series. I appreciate the fact that you're trying to keep logical changes separate, but it seems to me like this change might be able to be combined with patch 4, and given a single commit message that clearly explains the complete scope of the changes. Here I have to disagree with you. The changes in this patch like PMU should not handle multiple filter requests as it does not support the OR semantic required in the protocol, the fact that we need to pass on the entire branch filtering responsibility to the SW comes into picture after we have enabled the SW branch filtering support in the previous patch. So these changes have to follow that up logically and sequentially in that order. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 01/12] fsl/fman: Add the FMan FLIB headers
From: Igal Liberman igal.liber...@freescale.com This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../ethernet/freescale/fman/flib/common/general.h | 41 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 2 files changed, 650 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/common/general.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman.h diff --git a/drivers/net/ethernet/freescale/fman/flib/common/general.h b/drivers/net/ethernet/freescale/fman/flib/common/general.h new file mode 100644 index 000..0501f01 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/common/general.h @@ -0,0 +1,41 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __GENERAL_H +#define __GENERAL_H + +#include linux/types.h +#include linux/io.h + +#define iowrite32be(val, addr) out_be32((*addr), val) +#define ioread32be(addr) in_be32((*addr)) + +#endif /* __GENERAL_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h new file mode 100644 index 000..95eef30 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_fman.h @@ -0,0 +1,609 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED
[PATCH 05/12] fsl/fman: Add the FMan MAC FLIB headers
From: Igal Liberman igal.liber...@freescale.com The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 +++ .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 +++ .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 ++ 6 files changed, 2107 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_enet.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_tgec.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ +
[00/12] Freescale DPAA FMan
From: Igal Liberman igal.liber...@freescale.com The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs. The first 6 patches present the FMan Foundation Libraries (FLIBs), the FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. The following patches present the FMan driver itself, split into patches for each required hardware module. This submission is based on prior Freescale DPAA FMan V3,RFC submission. Several issues addresses in this submission: - Reduced MAC layering and complexity - Reduced code base - T1024/T2080 10G best effort support Igal Liberman (12): fsl/fman: Add the FMan FLIB headers fsl/fman: Add the FMan FLIB fsl/fman: Add the FMan port FLIB headers fsl/fman: Add the FMan port FLIB fsl/fman: Add the FMan MAC FLIB headers fsl/fman: Add the FMan MAC FLIB fsl/fman: Add FMan MURAM support fsl/fman: Add Frame Manager support fsl/fman: Add FMan MAC support fsl/fman: Add FMan SP support fsl/fman: Add FMan Port Support fsl/fman: Add FMan MAC driver drivers/net/ethernet/freescale/Kconfig |1 + drivers/net/ethernet/freescale/Makefile|2 + drivers/net/ethernet/freescale/fman/Kconfig| 46 + drivers/net/ethernet/freescale/fman/Makefile | 12 + .../ethernet/freescale/fman/flib/common/general.h | 41 + .../net/ethernet/freescale/fman/flib/fman_common.h | 73 + .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 ++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 + .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 + .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 + .../ethernet/freescale/fman/flib/fsl_fman_port.h | 427 .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 54 + .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 drivers/net/ethernet/freescale/fman/fm.c | 2036 drivers/net/ethernet/freescale/fman/fm.h | 407 drivers/net/ethernet/freescale/fman/fm_common.h| 576 ++ drivers/net/ethernet/freescale/fman/fm_drv.c | 933 + drivers/net/ethernet/freescale/fman/fm_drv.h | 125 ++ drivers/net/ethernet/freescale/fman/fm_muram.c | 127 ++ drivers/net/ethernet/freescale/fman/fm_port_drv.c | 496 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 + drivers/net/ethernet/freescale/fman/fman.c | 973 ++ .../ethernet/freescale/fman/inc/crc_mac_addr_ext.h | 343 drivers/net/ethernet/freescale/fman/inc/enet_ext.h | 199 ++ drivers/net/ethernet/freescale/fman/inc/fm_ext.h | 453 + .../net/ethernet/freescale/fman/inc/fm_muram_ext.h | 103 + .../net/ethernet/freescale/fman/inc/fm_port_ext.h | 376 .../net/ethernet/freescale/fman/inc/fsl_fman_drv.h | 195 ++ drivers/net/ethernet/freescale/fman/inc/mac.h | 136 ++ drivers/net/ethernet/freescale/fman/inc/net_ext.h | 534 + drivers/net/ethernet/freescale/fman/inc/service.h | 90 + drivers/net/ethernet/freescale/fman/mac/Makefile |8 + drivers/net/ethernet/freescale/fman/mac/fm_dtsec.c | 1089 +++ drivers/net/ethernet/freescale/fman/mac/fm_dtsec.h | 227 +++ .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.c | 82 + .../ethernet/freescale/fman/mac/fm_dtsec_mii_acc.h | 43 + drivers/net/ethernet/freescale/fman/mac/fm_mac.h | 250 +++ drivers/net/ethernet/freescale/fman/mac/fm_memac.c | 741 +++ drivers/net/ethernet/freescale/fman/mac/fm_memac.h | 124 ++ .../ethernet/freescale/fman/mac/fm_memac_mii_acc.c | 66 + .../ethernet/freescale/fman/mac/fm_memac_mii_acc.h | 50 + drivers/net/ethernet/freescale/fman/mac/fm_tgec.c | 652 +++ drivers/net/ethernet/freescale/fman/mac/fm_tgec.h | 126 ++ .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 ++ .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 .../freescale/fman/mac/fman_memac_mii_acc.c| 217 +++ .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 +++ drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 drivers/net/ethernet/freescale/fman/mac/mac.c | 526 +
[PATCH 04/12] fsl/fman: Add the FMan port FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig|1 + drivers/net/ethernet/freescale/fman/Makefile |2 + drivers/net/ethernet/freescale/fman/port/Makefile |3 + .../net/ethernet/freescale/fman/port/fman_port.c | 619 4 files changed, 625 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 2799c6f..50a4de2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/port/Makefile b/drivers/net/ethernet/freescale/fman/port/Makefile new file mode 100644 index 000..54b1fa4 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-y += fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/net/ethernet/freescale/fman/port/fman_port.c b/drivers/net/ethernet/freescale/fman/port/fman_port.c new file mode 100644 index 000..6754c35 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/fman_port.c @@ -0,0 +1,619 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include common/general.h + +#include fman_common.h +#include fsl_fman_port.h + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg-errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = port-bmi_regs-rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg-discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, regs-fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg-dma_swap_data BMI_DMA_ATTR_SWP_SHIFT; + if (cfg-dma_ic_stash_on) + tmp |= BMI_DMA_ATTR_IC_STASH_ON; + if
Re: [PATCH V8 06/10] powerpc, lib: Add new branch analysis support functions
On 06/10/2015 11:03 AM, Daniel Axtens wrote: +static int instr_is_branch_xlform(unsigned int instr) +{ +return branch_opcode(instr) == 19; +} Why do these not return bool? The functions below do. Yeah they can, will change it. + +bool instr_is_indirect_func_call(unsigned int instr) +{ +/* XL-form instruction with LR set */ +if (instr_is_branch_xlform(instr) is_branch_link_set(instr)) +return true; + +return false; +} Both of these functions could be made into a single 'return' statement, right? Yeah, right. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V8 03/10] powerpc, perf: Re organize BHRB processing
On 06/10/2015 10:06 AM, Daniel Axtens wrote: +void update_branch_entry(struct cpu_hw_events *cpuhw, +int index, u64 from, u64 to, int pred) +{ +cpuhw-bhrb_entries[index].from = from; +cpuhw-bhrb_entries[index].to = to; +cpuhw-bhrb_entries[index].mispred = pred; +cpuhw-bhrb_entries[index].predicted = ~pred; +} I realise you're copying existing code, but: - could you please rename pred? If we assign .mispred to pred and .predicted to ~pred, we should pick a different name for pred. Agreed. - I'm really uncomfortable with the bitwise inverting a signed integer. Can you explain what is going on here? Looking at include/uapi/linux/perf_event.h, this seems to be a single bit flag: shouldn't this then be a logical flip rather than a bitwise one? (Furthermore, looking at that header, why is pred an int at all? Why not a bool?) Agreed. + /* Processing BHRB entries */ static void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) { -u64 val; -u64 addr; +u64 val, addr, tmp; Please don't use 'tmp' here. As far as I can tell, you use this variable to compute the 'to' address. The name should reflect that. Agreed but then it will be a new preparatory patch at the beginning of this patch series. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 12/12] fsl/fman: Add FMan MAC driver
From: Igal Liberman igal.liber...@freescale.com This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman igal.liber...@freescale.com Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/fman/inc/mac.h | 136 drivers/net/ethernet/freescale/fman/mac/Makefile |3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 + drivers/net/ethernet/freescale/fman/mac/mac.c | 526 ++ 4 files changed, 1429 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..0111f4c --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,136 @@ +/* Copyright 2008-2015 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include linux/device.h /* struct device, BUS_ID_SIZE */ +#include linux/if_ether.h/* ETH_ALEN */ +#include linux/phy.h /* phy_interface_t, struct phy_device */ +#include linux/list.h + +#include enet_ext.h + +#include fsl_fman_drv.h /* struct port_device */ +#include fm_port_ext.h + +struct fm_mac_dev; +enum fm_mac_exceptions; + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port_drv_t*port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int
[PATCH v15 02/19] perf, tools, jevents: Program to convert JSON file to C style file
From: Andi Kleen a...@linux.intel.com This is a modified version of an earlier patch by Andi Kleen. We expect architectures to describe the performance monitoring events for each CPU in a corresponding JSON file, which look like: [ { EventCode: 0x00, UMask: 0x01, EventName: INST_RETIRED.ANY, BriefDescription: Instructions retired from execution., PublicDescription: Instructions retired from execution., Counter: Fixed counter 1, CounterHTOff: Fixed counter 1, SampleAfterValue: 203, SampleAfterValue: 203, MSRIndex: 0, MSRValue: 0, TakenAlone: 0, CounterMask: 0, Invert: 0, AnyThread: 0, EdgeDetect: 0, PEBS: 0, PRECISE_STORE: 0, Errata: null, Offcore: 0 } ] We also expect the architectures to provide a mapping between individual CPUs to their JSON files. Eg: GenuineIntel-6-1E,V1,/NHM-EP/NehalemEP_core_V1.json,core which maps each CPU, identified by [vendor, family, model, version, type] to a JSON file. Given these files, the program, jevents:: - locates all JSON files for the architecture, - parses each JSON file and generates a C-style PMU-events table (pmu-events.c) - locates a mapfile for the architecture - builds a global table, mapping each model of CPU to the corresponding PMU-events table. The 'pmu-events.c' is generated when building perf and added to libperf.a. The global table pmu_events_map[] table in this pmu-events.c will be used in perf in a follow-on patch. If the architecture does not have any JSON files or there is an error in processing them, an empty mapping file is created. This would allow the build of perf to proceed even if we are not able to provide aliases for events. The parser for JSON files allows parsing Intel style JSON event files. This allows to use an Intel event list directly with perf. The Intel event lists can be quite large and are too big to store in unswappable kernel memory. The conversion from JSON to C-style is straight forward. The parser knows (very little) Intel specific information, and can be easily extended to handle fields for other CPUs. The parser code is partially shared with an independent parsing library, which is 2-clause BSD licenced. To avoid any conflicts I marked those files as BSD licenced too. As part of perf they become GPLv2. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- v2: Address review feedback. Rename option to --event-files v3: Add JSON example v4: Update manpages. v5: Don't remove dot in fixname. Fix compile error. Add include protection. Comment realloc. v6: Include debug/util.h v7: (Sukadev Bhattiprolu) Rebase to 4.0 and fix some conflicts. v8: (Sukadev Bhattiprolu) Move jevents.[hc] to tools/perf/pmu-events/ Rewrite to locate and process arch specific JSON and map files; and generate a C file. (Removed acked-by Namhyung Kim due to modest changes to patch) Compile the generated pmu-events.c and add the pmu-events.o to libperf.a v9: [Sukadev Bhattiprolu/Andi Kleen] Rename -vfm to -cpuid and use that field to encode the PVR in Power. Allow blank lines in mapfile. [Jiri Olsa] Pass ARCH as a parameter to jevents so we don't have to detect it. [Jiri Olsa] Use the infrastrastructure to build pmu-events/perf (Makefile changes from Jiri included in this patch). [Jiri Olsa, Andi Kleen] Detect changes to JSON files and rebuild pmu-events.o only if necessary. v11:- [Andi Kleen] Add mapfile, jevents dependency on pmu-events.c - [Jiri Olsa] Be silient if arch doesn't have JSON files - Also silence 'jevents' when parsing JSON files unless V=1 is specified during build. Cleanup error messages. v14:- - [Jiri Olsa] Fix compile error with DEBUG=1; drop unlink() and use w mode with fopen(); simplify file_name_to_table_name() v15:- Fix minor conflict in tools/perf/Makefile.perf when rebasing to recent perf/core. --- tools/perf/Makefile.perf | 25 +- tools/perf/pmu-events/Build| 11 + tools/perf/pmu-events/jevents.c| 686 + tools/perf/pmu-events/jevents.h| 17 + tools/perf/pmu-events/json.h | 3 + tools/perf/pmu-events/pmu-events.h | 35 ++ 6 files changed, 773 insertions(+), 4 deletions(-) create mode 100644 tools/perf/pmu-events/Build create mode 100644 tools/perf/pmu-events/jevents.c create mode 100644 tools/perf/pmu-events/jevents.h create mode 100644 tools/perf/pmu-events/pmu-events.h diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index b1dfcd8..26c90ea 100644 --- a/tools/perf/Makefile.perf +++
[PATCH v15 10/19] perf, tools: Query terminal width and use in perf list
From: Andi Kleen a...@linux.intel.com Automatically adapt the now wider and word wrapped perf list output to wider terminals. This requires querying the terminal before the auto pager takes over, and exporting this information from the pager subsystem. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Namhyung Kim namhy...@kernel.org Acked-by: Jiri Olsa jo...@redhat.com --- tools/perf/util/cache.h | 1 + tools/perf/util/pager.c | 15 +++ tools/perf/util/pmu.c | 3 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index c861373..8e0d4b8 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h @@ -32,6 +32,7 @@ extern const char *perf_config_dirname(const char *, const char *); extern void setup_pager(void); extern int pager_in_use(void); extern int pager_use_color; +int pager_get_columns(void); char *alias_lookup(const char *alias); int split_cmdline(char *cmdline, const char ***argv); diff --git a/tools/perf/util/pager.c b/tools/perf/util/pager.c index 53ef006..1770c88 100644 --- a/tools/perf/util/pager.c +++ b/tools/perf/util/pager.c @@ -1,6 +1,7 @@ #include cache.h #include run-command.h #include sigchain.h +#include sys/ioctl.h /* * This is split up from the rest of git so that we can do @@ -8,6 +9,7 @@ */ static int spawned_pager; +static int pager_columns; static void pager_preexec(void) { @@ -47,9 +49,12 @@ static void wait_for_pager_signal(int signo) void setup_pager(void) { const char *pager = getenv(PERF_PAGER); + struct winsize sz; if (!isatty(1)) return; + if (ioctl(1, TIOCGWINSZ, sz) == 0) + pager_columns = sz.ws_col; if (!pager) pager = getenv(PAGER); if (!(pager || access(/usr/bin/pager, X_OK))) @@ -93,3 +98,13 @@ int pager_in_use(void) env = getenv(PERF_PAGER_IN_USE); return env ? perf_config_bool(PERF_PAGER_IN_USE, env) : 0; } + +int pager_get_columns(void) +{ + char *s; + + s = getenv(COLUMNS); + if (s) + return atoi(s); + return (pager_columns ? pager_columns : 80) - 2; +} diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 083cbc6..f7feb96 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -14,6 +14,7 @@ #include cpumap.h #include header.h #include pmu-events/pmu-events.h +#include cache.h struct perf_pmu_format { char *name; @@ -1038,7 +1039,7 @@ void print_pmu_events(const char *event_glob, bool name_only) int len, j; struct pair *aliases; int numdesc = 0; - int columns = 78; + int columns = pager_get_columns(); pmu = NULL; len = 0; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 15/19] perf, tools: Support long descriptions with perf list
Previously we were dropping the useful longer descriptions that some events have in the event list completely. This patch makes them appear with perf list. Old perf list: baclears: baclears.all [Counts the number of baclears] vs new: perf list -v: ... baclears: baclears.all [The BACLEARS event counts the number of times the front end is resteered, mainly when the Branch Prediction Unit cannot provide a correct prediction and this is corrected by the Branch Address Calculator at the front end. The BACLEARS.ANY event counts the number of baclears for any type of branch] Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v15] - [Jir Olsa, Andi Kleen] Fix usage strings; update man page. Changelog[v14] - [Jiri Olsa] Break up independent parts of the patch into separate patches. --- tools/perf/Documentation/perf-list.txt | 6 +- tools/perf/builtin-list.c | 13 + 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt index 9507552..48202f2 100644 --- a/tools/perf/Documentation/perf-list.txt +++ b/tools/perf/Documentation/perf-list.txt @@ -8,7 +8,7 @@ perf-list - List all symbolic event types SYNOPSIS [verse] -'perf list' [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob] +'perf list' [--no-desc] [--long-desc] [hw|sw|cache|tracepoint|pmu|event_glob] DESCRIPTION --- @@ -20,6 +20,10 @@ OPTIONS --no-desc:: Don't print descriptions. +-v:: +--long-desc:: +Print longer event descriptions. + [[EVENT_MODIFIERS]] EVENT MODIFIERS diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index 3f058f7..f800927 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -22,14 +22,17 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) { int i; bool raw_dump = false; + bool long_desc_flag = false; struct option list_options[] = { OPT_BOOLEAN(0, raw-dump, raw_dump, Dump raw events), OPT_BOOLEAN('d', desc, desc_flag, Print extra event descriptions. --no-desc to not print.), + OPT_BOOLEAN('v', long-desc, long_desc_flag, + Print longer event descriptions.), OPT_END() }; const char * const list_usage[] = { - perf list [--no-desc] [hw|sw|cache|tracepoint|pmu|event_glob], + perf list [options] [hw|sw|cache|tracepoint|pmu|event_glob], NULL }; @@ -44,7 +47,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) printf(\nList of pre-defined events (to be used in -e):\n\n); if (argc == 0) { - print_events(NULL, raw_dump, !desc_flag); + print_events(NULL, raw_dump, !desc_flag, long_desc_flag); return 0; } @@ -63,13 +66,15 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) strcmp(argv[i], hwcache) == 0) print_hwcache_events(NULL, raw_dump); else if (strcmp(argv[i], pmu) == 0) - print_pmu_events(NULL, raw_dump, !desc_flag); + print_pmu_events(NULL, raw_dump, !desc_flag, + long_desc_flag); else { char *sep = strchr(argv[i], ':'), *s; int sep_idx; if (sep == NULL) { - print_events(argv[i], raw_dump, !desc_flag); + print_events(argv[i], raw_dump, !desc_flag, + long_desc_flag); continue; } sep_idx = sep - argv[i]; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 04/19] perf, tools: Split perf_pmu__new_alias()
Separate the event parsing code in perf_pmu__new_alias() out into a separate function __perf_pmu__new_alias() so that code can be called indepdently. This is based on an earlier patch from Andi Kleen. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- tools/perf/util/pmu.c | 42 +++--- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index c6b16b1..7bcb8c3 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -206,17 +206,12 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, return 0; } -static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FILE *file) +static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, +char *desc __maybe_unused, char *val) { struct perf_pmu_alias *alias; - char buf[256]; int ret; - ret = fread(buf, 1, sizeof(buf), file); - if (ret == 0) - return -EINVAL; - buf[ret] = 0; - alias = malloc(sizeof(*alias)); if (!alias) return -ENOMEM; @@ -226,26 +221,43 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI alias-unit[0] = '\0'; alias-per_pkg = false; - ret = parse_events_terms(alias-terms, buf); + ret = parse_events_terms(alias-terms, val); if (ret) { + pr_err(Cannot parse alias %s: %d\n, val, ret); free(alias); return ret; } alias-name = strdup(name); - /* -* load unit name and scale if available -*/ - perf_pmu__parse_unit(alias, dir, name); - perf_pmu__parse_scale(alias, dir, name); - perf_pmu__parse_per_pkg(alias, dir, name); - perf_pmu__parse_snapshot(alias, dir, name); + if (dir) { + /* +* load unit name and scale if available +*/ + perf_pmu__parse_unit(alias, dir, name); + perf_pmu__parse_scale(alias, dir, name); + perf_pmu__parse_per_pkg(alias, dir, name); + perf_pmu__parse_snapshot(alias, dir, name); + } list_add_tail(alias-list, list); return 0; } +static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FILE *file) +{ + char buf[256]; + int ret; + + ret = fread(buf, 1, sizeof(buf), file); + if (ret == 0) + return -EINVAL; + + buf[ret] = 0; + + return __perf_pmu__new_alias(list, dir, name, NULL, buf); +} + static inline bool pmu_alias_info_file(char *name) { size_t len; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 06/19] perf, tools: Support CPU ID matching for Powerpc
Implement code that returns the generic CPU ID string for Powerpc. This will be used to identify the specific table of PMU events to parse/compare user specified events against. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v14] - [Jiri Olsa] Move this independent code off into a separate patch. --- tools/perf/arch/powerpc/util/header.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c index 6c1b8a7..65f9391 100644 --- a/tools/perf/arch/powerpc/util/header.c +++ b/tools/perf/arch/powerpc/util/header.c @@ -32,3 +32,14 @@ get_cpuid(char *buffer, size_t sz) } return -1; } + +char * +get_cpuid_str(void) +{ + char *bufp; + + if (asprintf(bufp, %.8lx, mfspr(SPRN_PVR)) 0) + bufp = NULL; + + return bufp; +} -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 17/19] perf, tools: Add support for event list topics
From: Andi Kleen a...@linux.intel.com Add support to group the output of perf list by the Topic field in the JSON file. Example output: % perf list ... Cache: l1d.replacement [L1D data line replacements] l1d_pend_miss.pending [L1D miss oustandings duration in cycles] l1d_pend_miss.pending_cycles [Cycles with L1D load Misses outstanding] l2_l1d_wb_rqsts.all [Not rejected writebacks from L1D to L2 cache lines in any state] l2_l1d_wb_rqsts.hit_e [Not rejected writebacks from L1D to L2 cache lines in E state] l2_l1d_wb_rqsts.hit_m [Not rejected writebacks from L1D to L2 cache lines in M state] ... Pipeline: arith.fpu_div [Divide operations executed] arith.fpu_div_active [Cycles when divider is busy executing divide operations] baclears.any [Counts the total number when the front end is resteered, mainly when the BPU cannot provide a correct prediction and this is corrected by other branch handling mechanisms at the front end] br_inst_exec.all_branches [Speculative and retired branches] br_inst_exec.all_conditional [Speculative and retired macro-conditional branches] br_inst_exec.all_direct_jmp [Speculative and retired macro-unconditional branches excluding calls and indirects] br_inst_exec.all_direct_near_call [Speculative and retired direct near calls] br_inst_exec.all_indirect_jump_non_call_ret Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v14] - [Jiri Olsa] Move jevents support for Topic to a separate patch. --- tools/perf/util/pmu.c | 37 +++-- tools/perf/util/pmu.h | 1 + 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 61c86c8..7849498 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -210,7 +210,8 @@ static int perf_pmu__parse_snapshot(struct perf_pmu_alias *alias, } static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, -char *desc, char *val, char *long_desc) +char *desc, char *val, char *long_desc, +char *topic) { struct perf_pmu_alias *alias; int ret; @@ -245,6 +246,7 @@ static int __perf_pmu__new_alias(struct list_head *list, char *dir, char *name, alias-desc = desc ? strdup(desc) : NULL; alias-long_desc = long_desc ? strdup(long_desc) : desc ? strdup(desc) : NULL; + alias-topic = topic ? strdup(topic) : NULL; list_add_tail(alias-list, list); @@ -262,7 +264,7 @@ static int perf_pmu__new_alias(struct list_head *list, char *dir, char *name, FI buf[ret] = 0; - return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL); + return __perf_pmu__new_alias(list, dir, name, NULL, buf, NULL, NULL); } static inline bool pmu_alias_info_file(char *name) @@ -511,7 +513,7 @@ static int pmu_add_cpu_aliases(struct list_head *head) /* need type casts to override 'const' */ __perf_pmu__new_alias(head, NULL, (char *)pe-name, (char *)pe-desc, (char *)pe-event, - (char *)pe-long_desc); + (char *)pe-long_desc, (char *)pe-topic); } out: @@ -1001,19 +1003,26 @@ static char *format_alias_or(char *buf, int len, struct perf_pmu *pmu, return buf; } -struct pair { +struct sevent { char *name; char *desc; + char *topic; }; -static int cmp_pair(const void *a, const void *b) +static int cmp_sevent(const void *a, const void *b) { - const struct pair *as = a; - const struct pair *bs = b; + const struct sevent *as = a; + const struct sevent *bs = b; /* Put extra events last */ if (!!as-desc != !!bs-desc) return !!as-desc - !!bs-desc; + if (as-topic bs-topic) { + int n = strcmp(as-topic, bs-topic); + + if (n) + return n; + } return strcmp(as-name, bs-name); } @@ -1047,9 +1056,10 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, char buf[1024]; int printed = 0; int len, j; - struct pair *aliases; + struct sevent *aliases; int numdesc = 0; int columns = pager_get_columns(); + char *topic = NULL; pmu = NULL; len = 0; @@ -1059,7 +1069,7 @@ void print_pmu_events(const char *event_glob, bool name_only, bool quiet_flag, if (pmu-selectable) len++; } - aliases = zalloc(sizeof(struct pair) * len); + aliases = zalloc(sizeof(struct sevent) * len); if
[alsa-devel][PATCH] ASoC: fsl: add imx-wm8960 machine driver
This imx-wm8960 device-tree-only machine driver works with sai driver and have below feature. * support codec master and slave mode * support headphone jack detect * support headphone and micphone jack event * support asrc-sai-wm8960 mode Signed-off-by: Zidan Wang zidan.w...@freescale.com --- .../devicetree/bindings/sound/imx-audio-wm8960.txt | 68 ++ sound/soc/fsl/Kconfig | 13 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/imx-wm8960.c | 711 + 4 files changed, 794 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt create mode 100644 sound/soc/fsl/imx-wm8960.c diff --git a/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt b/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt new file mode 100644 index 000..300d027 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt @@ -0,0 +1,68 @@ +Freescale i.MX audio complex with WM8960 codec + +Required properties: + + - compatible : fsl,imx-audio-wm8960 + + - model : The user-visible name of this sound complex + + - audio-codec: The phandle of the WM8960 audio codec + + - hp-det : ADCLRC/GPIO1, LINPUT3/JD2 and RINPUT3/JD3 pins can + be selected as headphone jack detect inputs to + automatically disable the speaker output and enable + the headphone output. + hp-det = hp-det-pin hp-det-polarity; + hp-det-pin = 1: ADCLRC/GPIO1 used as detect pin + hp-det-pin = 2: LINPUT3/JD2 used as detect pin + hp-det-pin = 3: RINPUT3/JD3 used as detect pin + hp-det-polarity = 0: hp detect high for headphone + hp-det-polarity = 1: hp detect high for speaker + + - codec-master : If codec-master present, codec works as master. + Otherwise, codec works as slave. + + - audio-routing : A list of the connections between audio components. + Each entry is a pair of strings, the first being the + connection's sink, the second being the connection's + source. Valid names could be power supplies, WM8962 + pins, and the jacks on the board: + + Power supplies: + * MICB + + Board connectors: + * Hp MIC + * Main MIC + * Headset Jack + * Ext Spk + +Example: + +sound { + compatible = fsl,imx6ul-evk-wm8960, + fsl,imx-audio-wm8960; + model = wm8960-audio; + cpu-dai = sai2; + audio-codec = codec; + asrc-controller = asrc; + codec-master; + hp-det = 3 0; + audio-routing = + Headset Jack, HP_L, + Headset Jack, HP_R, + Ext Spk, SPK_LP, + Ext Spk, SPK_LN, + Ext Spk, SPK_RP, + Ext Spk, SPK_RN, + LINPUT2, Hp MIC, + LINPUT3, Hp MIC, + RINPUT1, Main MIC, + RINPUT2, Main MIC, + Hp MIC, MICB, + Main MIC, MICB, + CPU-Playback, ASRC-Playback, + Playback, CPU-Playback, + ASRC-Capture, CPU-Capture, + CPU-Capture, Capture; +}; diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 19c302b..0d9aa56 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -229,6 +229,19 @@ config SND_SOC_EUKREA_TLV320 Enable I2S based access to the TLV320AIC23B codec attached to the SSI interface +config SND_SOC_IMX_WM8960 + tristate SoC Audio support for i.MX boards with wm8960 + depends on OF I2C + select SND_SOC_WM8960 + select SND_SOC_IMX_PCM_DMA + select SND_SOC_FSL_SAI + select SND_SOC_FSL_UTILS + select SND_KCTL_JACK + help +SoC Audio support for i.MX boards with WM8960 +Say Y if you want to add support for SoC audio on an i.MX board with +a wm8960 codec. + config SND_SOC_IMX_WM8962 tristate SoC Audio support for i.MX boards with wm8962 depends on OF I2C INPUT diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index d28dc25..84a9a10 100644 --- a/sound/soc/fsl/Makefile +++ b/sound/soc/fsl/Makefile @@ -54,6 +54,7 @@ snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o snd-soc-wm1133-ev1-objs := wm1133-ev1.o snd-soc-imx-es8328-objs := imx-es8328.o
[RFC PATCH 1/6] mm: add defer mechanism to ksm to make it more suitable
I observe that it is unlikely for KSM to merge new pages from an area that has already been scanned twice on Android mobile devices, so it's a waste of power to continue to scan these areas in high frequency. In this patch a defer mechanism is introduced which is borrowed from page compaction to KSM. This defer mechanism can automatic lower the scan frequency in the above case. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- mm/ksm.c | 230 ++ 1 file changed, 203 insertions(+), 27 deletions(-) diff --git a/mm/ksm.c b/mm/ksm.c index 4162dce..54ffcb2 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -104,6 +104,7 @@ struct mm_slot { struct list_head mm_list; struct rmap_item *rmap_list; struct mm_struct *mm; + unsigned long seqnr; }; /** @@ -117,9 +118,12 @@ struct mm_slot { */ struct ksm_scan { struct mm_slot *mm_slot; + struct mm_slot *active_slot; unsigned long address; struct rmap_item **rmap_list; unsigned long seqnr; + unsigned long ksm_considered; + unsigned int ksm_defer_shift; }; /** @@ -182,6 +186,11 @@ struct rmap_item { #define UNSTABLE_FLAG 0x100 /* is a node of the unstable tree */ #define STABLE_FLAG0x200 /* is listed from the stable tree */ +#define ACTIVE_SLOT_FLAG 0x100 +#define ACTIVE_SLOT_SEQNR 0x200 +#define KSM_MAX_DEFER_SHIFT6 + + /* The stable and unstable tree heads */ static struct rb_root one_stable_tree[1] = { RB_ROOT }; static struct rb_root one_unstable_tree[1] = { RB_ROOT }; @@ -197,14 +206,22 @@ static DEFINE_HASHTABLE(mm_slots_hash, MM_SLOTS_HASH_BITS); static struct mm_slot ksm_mm_head = { .mm_list = LIST_HEAD_INIT(ksm_mm_head.mm_list), }; + +static struct mm_slot ksm_mm_active = { + .mm_list = LIST_HEAD_INIT(ksm_mm_active.mm_list), +}; + static struct ksm_scan ksm_scan = { .mm_slot = ksm_mm_head, + .active_slot = ksm_mm_active, }; static struct kmem_cache *rmap_item_cache; static struct kmem_cache *stable_node_cache; static struct kmem_cache *mm_slot_cache; +static bool ksm_merged_or_unstable; + /* The number of nodes in the stable tree */ static unsigned long ksm_pages_shared; @@ -336,6 +353,23 @@ static void insert_to_mm_slots_hash(struct mm_struct *mm, hash_add(mm_slots_hash, mm_slot-link, (unsigned long)mm); } +static void move_to_active_list(struct mm_slot *mm_slot) +{ + if (mm_slot !(mm_slot-seqnr ACTIVE_SLOT_FLAG)) { + if (ksm_run KSM_RUN_UNMERGE mm_slot-rmap_list) + return; + if (mm_slot == ksm_scan.mm_slot) { + if (ksm_scan.active_slot == ksm_mm_active) + return; + ksm_scan.mm_slot = list_entry(mm_slot-mm_list.next, + struct mm_slot, mm_list); + } + list_move_tail(mm_slot-mm_list, + ksm_scan.active_slot-mm_list); + mm_slot-seqnr |= (ACTIVE_SLOT_FLAG | ACTIVE_SLOT_SEQNR); + } +} + /* * ksmd, and unmerge_and_remove_all_rmap_items(), must not touch an mm's * page tables after it has passed through ksm_exit() - which, if necessary, @@ -772,6 +806,15 @@ static int unmerge_and_remove_all_rmap_items(void) int err = 0; spin_lock(ksm_mmlist_lock); + mm_slot = list_entry(ksm_mm_active.mm_list.next, + struct mm_slot, mm_list); + while (mm_slot != ksm_mm_active) { + list_move_tail(mm_slot-mm_list, ksm_mm_head.mm_list); + mm_slot-seqnr = ~(ACTIVE_SLOT_FLAG | ACTIVE_SLOT_SEQNR); + mm_slot = list_entry(ksm_mm_active.mm_list.next, + struct mm_slot, mm_list); + } + ksm_scan.active_slot = ksm_mm_active; ksm_scan.mm_slot = list_entry(ksm_mm_head.mm_list.next, struct mm_slot, mm_list); spin_unlock(ksm_mmlist_lock); @@ -790,8 +833,8 @@ static int unmerge_and_remove_all_rmap_items(void) if (err) goto error; } - remove_trailing_rmap_items(mm_slot, mm_slot-rmap_list); + mm_slot-seqnr = 0; spin_lock(ksm_mmlist_lock); ksm_scan.mm_slot = list_entry(mm_slot-mm_list.next, @@ -806,6 +849,7 @@ static int unmerge_and_remove_all_rmap_items(void) up_read(mm-mmap_sem); mmdrop(mm); } else { + move_to_active_list(mm_slot); spin_unlock(ksm_mmlist_lock); up_read(mm-mmap_sem); } @@ -1401,6 +1445,9 @@ static void stable_tree_append(struct rmap_item *rmap_item, ksm_pages_sharing++; else
[RFC PATCH 3/6] perf: change the condition of identifying hugetlb vm
Hugetlb VMAs are not mergeable, that means a VMA couldn't have VM_HUGETLB and VM_MERGEABLE been set in the same time. So we use VM_HUGETLB to indicate new mergeable VMAs. Because of that a VMA which has VM_HUGETLB been set is a hugetlb VMA only if it doesn't have VM_MERGEABLE been set in the same time. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- kernel/events/core.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index f04daab..6313bdd 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -5624,7 +5624,7 @@ static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) flags |= MAP_EXECUTABLE; if (vma-vm_flags VM_LOCKED) flags |= MAP_LOCKED; - if (vma-vm_flags VM_HUGETLB) + if ((vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) flags |= MAP_HUGETLB; goto got_name; -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 05/19] perf, tools: Use pmu_events table to create aliases
At run time (when 'perf' is starting up), locate the specific table of PMU events that corresponds to the current CPU. Using that table, create aliases for the each of the PMU events in the CPU. The use these aliases to parse the user specified perf event. In short this would allow the user to specify events using their aliases rather than raw event codes. Based on input and some earlier patches from Andi Kleen, Jiri Olsa. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v4] - Split off unrelated code into separate patches. Changelog[v3] - [Jiri Olsa] Fix memory leak in cpuid Changelog[v2] - [Andi Kleen] Replace pmu_events_map-vfm with a generic cpuid. --- tools/perf/util/header.h | 1 + tools/perf/util/pmu.c| 61 2 files changed, 62 insertions(+) diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index d4d5796..996e899 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h @@ -157,4 +157,5 @@ int write_padded(int fd, const void *bf, size_t count, size_t count_aligned); */ int get_cpuid(char *buffer, size_t sz); +char *get_cpuid_str(void); #endif /* __PERF_HEADER_H */ diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7bcb8c3..7863d05 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -12,6 +12,8 @@ #include pmu.h #include parse-events.h #include cpumap.h +#include header.h +#include pmu-events/pmu-events.h struct perf_pmu_format { char *name; @@ -449,6 +451,62 @@ static struct cpu_map *pmu_cpumask(const char *name) return cpus; } +/* + * Return the CPU id as a raw string. + * + * Each architecture should provide a more precise id string that + * can be use to match the architecture's mapfile. + */ +char * __weak get_cpuid_str(void) +{ + return NULL; +} + +/* + * From the pmu_events_map, find the table of PMU events that corresponds + * to the current running CPU. Then, add all PMU events from that table + * as aliases. + */ +static int pmu_add_cpu_aliases(struct list_head *head) +{ + int i; + struct pmu_events_map *map; + struct pmu_event *pe; + char *cpuid; + + cpuid = get_cpuid_str(); + if (!cpuid) + return 0; + + i = 0; + while (1) { + map = pmu_events_map[i++]; + if (!map-table) + goto out; + + if (!strcmp(map-cpuid, cpuid)) + break; + } + + /* +* Found a matching PMU events table. Create aliases +*/ + i = 0; + while (1) { + pe = map-table[i++]; + if (!pe-name) + break; + + /* need type casts to override 'const' */ + __perf_pmu__new_alias(head, NULL, (char *)pe-name, + (char *)pe-desc, (char *)pe-event); + } + +out: + free(cpuid); + return 0; +} + struct perf_event_attr * __weak perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) { @@ -477,6 +535,9 @@ static struct perf_pmu *pmu_lookup(const char *name) if (pmu_aliases(name, aliases)) return NULL; + if (!strcmp(name, cpu)) + (void)pmu_add_cpu_aliases(aliases); + if (pmu_type(name, type)) return NULL; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 07/19] perf, tools: Allow events with dot
From: Andi Kleen a...@linux.intel.com The Intel events use a dot to separate event name and unit mask. Allow dot in names in the scanner, and remove special handling of dot as EOF. Also remove the hack in jevents to replace dot with underscore. This way dotted events can be specified directly by the user. I'm not fully sure this change to the scanner is correct (what was the dot special case good for?), but I haven't found anything that breaks with it so far at least. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Namhyung Kim namhy...@kernel.org Acked-by: Jiri Olsa jo...@redhat.com --- V2: Add the dot to name too, to handle events outside cpu// --- tools/perf/util/parse-events.l | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index 09e738f..13cef3c 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -119,8 +119,8 @@ event [^,{}/]+ num_dec[0-9]+ num_hex0x[a-fA-F0-9]+ num_raw_hex[a-fA-F0-9]+ -name [a-zA-Z_*?][a-zA-Z0-9_*?]* -name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?]* +name [a-zA-Z_*?][a-zA-Z0-9_*?.]* +name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.]* /* If you add a modifier you need to update check_modifier() */ modifier_event [ukhpGHSDI]+ modifier_bp[rwx]{1,3} @@ -165,7 +165,6 @@ modifier_bp [rwx]{1,3} return PE_EVENT_NAME; } -. | EOF{ BEGIN(INITIAL); REWIND(0); -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 16/19] perf, tools, jevents: Add support for event topics
Allow assigning categories Topics field to the PMU events i.e. process the topic field from the JSON file and add a corresponding topic field to the generated C events tables. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v14] [Jiri Olsa] Move this independent code off into a separate patch. --- tools/perf/pmu-events/jevents.c| 12 +--- tools/perf/pmu-events/jevents.h| 2 +- tools/perf/pmu-events/pmu-events.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index a8507c9..ea3474b 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -203,7 +203,7 @@ static void print_events_table_prefix(FILE *fp, const char *tblname) } static int print_events_table_entry(void *data, char *name, char *event, - char *desc, char *long_desc) + char *desc, char *long_desc, char *topic) { FILE *outfp = data; /* @@ -217,6 +217,8 @@ static int print_events_table_entry(void *data, char *name, char *event, fprintf(outfp, \t.desc = \%s\,\n, desc); if (long_desc long_desc[0]) fprintf(outfp, \t.long_desc = \%s\,\n, long_desc); + if (topic) + fprintf(outfp, \t.topic = \%s\,\n, topic); fprintf(outfp, },\n); @@ -238,7 +240,7 @@ static void print_events_table_suffix(FILE *outfp) /* Call func with each event in the json file */ int json_events(const char *fn, int (*func)(void *data, char *name, char *event, char *desc, - char *long_desc), + char *long_desc, char *topic), void *data) { int err = -EIO; @@ -259,6 +261,7 @@ int json_events(const char *fn, char *event = NULL, *desc = NULL, *name = NULL; char *long_desc = NULL; char *extra_desc = NULL; + char *topic = NULL; struct msrmap *msr = NULL; jsmntok_t *msrval = NULL; jsmntok_t *precise = NULL; @@ -297,6 +300,8 @@ int json_events(const char *fn, !json_streq(map, val, null)) { addfield(map, extra_desc, . , Spec update: , val); + } else if (json_streq(map, field, Topic)) { + addfield(map, topic, , , val); } else if (json_streq(map, field, Data_LA) nz) { addfield(map, extra_desc, . , Supports address when precise, @@ -320,12 +325,13 @@ int json_events(const char *fn, addfield(map, event, ,, msr-pname, msrval); fixname(name); - err = func(data, name, event, desc, long_desc); + err = func(data, name, event, desc, long_desc, topic); free(event); free(desc); free(name); free(long_desc); free(extra_desc); + free(topic); if (err) break; tok += j; diff --git a/tools/perf/pmu-events/jevents.h b/tools/perf/pmu-events/jevents.h index b0eb274..9ffcb89 100644 --- a/tools/perf/pmu-events/jevents.h +++ b/tools/perf/pmu-events/jevents.h @@ -3,7 +3,7 @@ int json_events(const char *fn, int (*func)(void *data, char *name, char *event, char *desc, - char *long_desc), + char *long_desc, char *topic), void *data); char *get_cpu_str(void); diff --git a/tools/perf/pmu-events/pmu-events.h b/tools/perf/pmu-events/pmu-events.h index 711f049..6b69f4b 100644 --- a/tools/perf/pmu-events/pmu-events.h +++ b/tools/perf/pmu-events/pmu-events.h @@ -9,6 +9,7 @@ struct pmu_event { const char *event; const char *desc; const char *long_desc; + const char *topic; }; /* -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 2/6] mm: change the condition of identifying hugetlb vm
Hugetlb VMAs are not mergeable, that means a VMA couldn't have VM_HUGETLB and VM_MERGEABLE been set in the same time. So we use VM_HUGETLB to indicate new mergeable VMAs. Because of that a VMA which has VM_HUGETLB been set is a hugetlb VMA only if it doesn't have VM_MERGEABLE been set in the same time. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- include/linux/hugetlb_inline.h |2 +- include/linux/mempolicy.h |2 +- mm/gup.c |6 -- mm/huge_memory.c | 17 - mm/madvise.c |6 -- mm/memory.c|5 +++-- mm/mprotect.c |6 -- 7 files changed, 29 insertions(+), 15 deletions(-) diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h index 2bb681f..08dff6f 100644 --- a/include/linux/hugetlb_inline.h +++ b/include/linux/hugetlb_inline.h @@ -7,7 +7,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) { - return !!(vma-vm_flags VM_HUGETLB); + return !!((vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB); } #else diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 3d385c8..40ad136 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -178,7 +178,7 @@ static inline int vma_migratable(struct vm_area_struct *vma) return 0; #ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION - if (vma-vm_flags VM_HUGETLB) + if ((vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) return 0; #endif diff --git a/mm/gup.c b/mm/gup.c index a6e24e2..5803dab 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -166,7 +166,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma, pud = pud_offset(pgd, address); if (pud_none(*pud)) return no_page_table(vma, flags); - if (pud_huge(*pud) vma-vm_flags VM_HUGETLB) { + if (pud_huge(*pud) + (vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) { page = follow_huge_pud(mm, address, pud, flags); if (page) return page; @@ -178,7 +179,8 @@ struct page *follow_page_mask(struct vm_area_struct *vma, pmd = pmd_offset(pud, address); if (pmd_none(*pmd)) return no_page_table(vma, flags); - if (pmd_huge(*pmd) vma-vm_flags VM_HUGETLB) { + if (pmd_huge(*pmd) + (vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) { page = follow_huge_pmd(mm, address, pmd, flags); if (page) return page; diff --git a/mm/huge_memory.c b/mm/huge_memory.c index fc00c8c..5a9de7f 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1910,7 +1910,6 @@ out: return ret; } -#define VM_NO_THP (VM_SPECIAL | VM_HUGETLB | VM_SHARED | VM_MAYSHARE) int hugepage_madvise(struct vm_area_struct *vma, unsigned long *vm_flags, int advice) @@ -1929,7 +1928,9 @@ int hugepage_madvise(struct vm_area_struct *vma, /* * Be somewhat over-protective like KSM for now! */ - if (*vm_flags (VM_HUGEPAGE | VM_NO_THP)) + if (*vm_flags (VM_HUGEPAGE | VM_SPECIAL | + VM_SHARED | VM_MAYSHARE) || + (*vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) return -EINVAL; *vm_flags = ~VM_NOHUGEPAGE; *vm_flags |= VM_HUGEPAGE; @@ -1945,7 +1946,9 @@ int hugepage_madvise(struct vm_area_struct *vma, /* * Be somewhat over-protective like KSM for now! */ - if (*vm_flags (VM_NOHUGEPAGE | VM_NO_THP)) + if (*vm_flags (VM_NOHUGEPAGE | VM_SPECIAL | + VM_SHARED | VM_MAYSHARE) || + (*vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) return -EINVAL; *vm_flags = ~VM_HUGEPAGE; *vm_flags |= VM_NOHUGEPAGE; @@ -2052,7 +2055,8 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma, if (vma-vm_ops) /* khugepaged not yet working on file or special mappings */ return 0; - VM_BUG_ON_VMA(vm_flags VM_NO_THP, vma); + VM_BUG_ON_VMA(vm_flags (VM_SPECIAL | VM_SHARED | VM_MAYSHARE) || + (vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB, vma); hstart = (vma-vm_start + ~HPAGE_PMD_MASK) HPAGE_PMD_MASK; hend = vma-vm_end HPAGE_PMD_MASK; if (hstart hend) @@ -2396,7 +2400,10 @@ static bool hugepage_vma_check(struct vm_area_struct *vma) return false; if (is_vma_temporary_stack(vma)) return false; - VM_BUG_ON_VMA(vma-vm_flags VM_NO_THP, vma); + VM_BUG_ON_VMA(vma-vm_flags +
[PATCH v15 03/19] Use __weak definition from linux/compiler.h
Jiri Olsa pointed out, that the linux/compiler.h defines the attribute '__weak'. We might as well use that. Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- tools/perf/util/pmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 0fcc624..c6b16b1 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -1,4 +1,5 @@ #include linux/list.h +#include linux/compiler.h #include sys/types.h #include unistd.h #include stdio.h @@ -436,7 +437,7 @@ static struct cpu_map *pmu_cpumask(const char *name) return cpus; } -struct perf_event_attr *__attribute__((weak)) +struct perf_event_attr * __weak perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) { return NULL; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 18/19] perf, tools: Handle header line in mapfile
From: Andi Kleen a...@linux.intel.com To work with existing mapfiles, assume that the first line in 'mapfile.csv' is a header line and skip over it. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v2] All architectures may not use the Family to identify. So, assume first line is header. --- tools/perf/pmu-events/jevents.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index ea3474b..7347cca 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -462,7 +462,12 @@ static int process_mapfile(FILE *outfp, char *fpath) print_mapping_table_prefix(outfp); - line_num = 0; + /* Skip first line (header) */ + p = fgets(line, n, mapfp); + if (!p) + goto out; + + line_num = 1; while (1) { char *cpuid, *version, *type, *fname; @@ -506,8 +511,8 @@ static int process_mapfile(FILE *outfp, char *fpath) fprintf(outfp, },\n); } +out: print_mapping_table_suffix(outfp); - return 0; } -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 0/6] add defer mechanism to ksm to make it more suitable for Android devices
I observe that it is unlikely for KSM to merge new pages from an area that has already been scanned twice on Android mobile devices, so it's a waste of power to scan these areas in high frequency. In this patchset, a defer mechanism is introduced which is borrowed from page compaction to KSM. A new slot list called active_slot is added into ksm_scan. MMs which have VMA marked for merging via madvise are added (MM is new to KSM) or moved to (MM is in the ksm_scan.mm_slot list) active_slot. In scan_get_next_rmap_item(), the active_slot list will be scaned firstly unless it is empty, then the mm_slot list. MMs in the active_slot list will be scaned twice, after that they will be moved to mm_slot list. Once scanning the mm_slot list, the defer mechanism will be activated: a) if KSM scans ksm_thread_pages_to_scan pages but none of them get merged or become unstable, increase the ksm_defer_shift(new member of ksm_scan) by one (no more than 6 by now). And in the next 1UL ksm_scan.ksm_defer_shift times KSM been scheduled or woken up it will not do the actual scan, compare and merge job, it just schedule out. b) if KSM scans ksm_thread_pages_to_scan pages and more than zero of them get merged or become unstable, reset the ksm_defer_shift and ksm_considered to zero. Some applications may continue to produce new mergeable VMAs to KSM, in order to avoid scanning VMAs of these applications that have already been scanned twice, we use VM_HUGETLB to indicate new mergeable VMAs since hugetlb vm are not supported by KSM. Wenwei Tao (6): mm: add defer mechanism to ksm to make it more suitable mm: change the condition of identifying hugetlb vm perf: change the condition of identifying hugetlb vm fs/binfmt_elf.c: change the condition of identifying hugetlb vm x86/mm: change the condition of identifying hugetlb vm powerpc/kvm: change the condition of identifying hugetlb vm arch/powerpc/kvm/e500_mmu_host.c |3 +- arch/x86/mm/tlb.c|3 +- fs/binfmt_elf.c |2 +- include/linux/hugetlb_inline.h |2 +- include/linux/mempolicy.h|2 +- kernel/events/core.c |2 +- mm/gup.c |6 +- mm/huge_memory.c | 17 ++- mm/ksm.c | 230 +- mm/madvise.c |6 +- mm/memory.c |5 +- mm/mprotect.c|6 +- 12 files changed, 238 insertions(+), 46 deletions(-) -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH 4/6] fs/binfmt_elf.c: change the condition of identifying hugetlb vm
Hugetlb VMAs are not mergeable, that means a VMA couldn't have VM_HUGETLB and VM_MERGEABLE been set in the same time. So we use VM_HUGETLB to indicate new mergeable VMAs. Because of that a VMA which has VM_HUGETLB been set is a hugetlb VMA only if it doesn't have VM_MERGEABLE been set in the same time. Signed-off-by: Wenwei Tao wenweitaowen...@gmail.com --- fs/binfmt_elf.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 995986b..f529c8e 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1242,7 +1242,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma, return 0; /* Hugetlb memory check */ - if (vma-vm_flags VM_HUGETLB) { + if ((vma-vm_flags (VM_HUGETLB | VM_MERGEABLE)) == VM_HUGETLB) { if ((vma-vm_flags VM_SHARED) FILTER(HUGETLB_SHARED)) goto whole; if (!(vma-vm_flags VM_SHARED) FILTER(HUGETLB_PRIVATE)) -- 1.7.9.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 01/19] perf, tools: Add jsmn `jasmine' JSON parser
From: Andi Kleen a...@linux.intel.com I need a JSON parser. This adds the simplest JSON parser I could find -- Serge Zaitsev's jsmn `jasmine' -- to the perf library. I merely converted it to (mostly) Linux style and added support for non 0 terminated input. The parser is quite straight forward and does not copy any data, just returns tokens with offsets into the input buffer. So it's relatively efficient and simple to use. The code is not fully checkpatch clean, but I didn't want to completely fork the upstream code. Original source: http://zserge.bitbucket.org/jsmn.html In addition I added a simple wrapper that mmaps a json file and provides some straight forward access functions. Used in follow-on patches to parse event files. Acked-by: Namhyung Kim namhy...@kernel.org Acked-by: Jiri Olsa jo...@redhat.com Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com --- v2: Address review feedback. v3: Minor checkpatch fixes. v4 (by Sukadev Bhattiprolu) - Rebase to 4.0 and fix minor conflicts in tools/perf/Makefile.perf - Report error if specified events file is invalid. v5 (Sukadev Bhattiprolu) - Move files to tools/perf/pmu-events/ since parsing of JSON file now occurs when _building_ rather than running perf. --- tools/perf/pmu-events/jsmn.c | 313 +++ tools/perf/pmu-events/jsmn.h | 67 + tools/perf/pmu-events/json.c | 162 ++ tools/perf/pmu-events/json.h | 36 + 4 files changed, 578 insertions(+) create mode 100644 tools/perf/pmu-events/jsmn.c create mode 100644 tools/perf/pmu-events/jsmn.h create mode 100644 tools/perf/pmu-events/json.c create mode 100644 tools/perf/pmu-events/json.h diff --git a/tools/perf/pmu-events/jsmn.c b/tools/perf/pmu-events/jsmn.c new file mode 100644 index 000..11d1fa1 --- /dev/null +++ b/tools/perf/pmu-events/jsmn.c @@ -0,0 +1,313 @@ +/* + * Copyright (c) 2010 Serge A. Zaitsev + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the Software), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Slightly modified by AK to not assume 0 terminated input. + */ + +#include stdlib.h +#include jsmn.h + +/* + * Allocates a fresh unused token from the token pool. + */ +static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser, + jsmntok_t *tokens, size_t num_tokens) +{ + jsmntok_t *tok; + + if ((unsigned)parser-toknext = num_tokens) + return NULL; + tok = tokens[parser-toknext++]; + tok-start = tok-end = -1; + tok-size = 0; + return tok; +} + +/* + * Fills token type and boundaries. + */ +static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type, + int start, int end) +{ + token-type = type; + token-start = start; + token-end = end; + token-size = 0; +} + +/* + * Fills next available token with JSON primitive. + */ +static jsmnerr_t jsmn_parse_primitive(jsmn_parser *parser, const char *js, + size_t len, + jsmntok_t *tokens, size_t num_tokens) +{ + jsmntok_t *token; + int start; + + start = parser-pos; + + for (; parser-pos len; parser-pos++) { + switch (js[parser-pos]) { +#ifndef JSMN_STRICT + /* +* In strict mode primitive must be followed by , +* or } or ] +*/ + case ':': +#endif + case '\t': + case '\r': + case '\n': + case ' ': + case ',': + case ']': + case '}': + goto found; + default: + break; + } + if (js[parser-pos] 32 || js[parser-pos] = 127) { + parser-pos = start; + return JSMN_ERROR_INVAL; +
[PATCH v15 13/19] perf, tools, jevents: Add support for long descriptions
Implement support in jevents to parse long descriptions for events that may have them in the JSON files. A follow on patch will make this long description available to user through the 'perf list' command. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- Changelog[v14] - [Jiri Olsa] Break up independent parts of the patch into separate patches. --- tools/perf/pmu-events/jevents.c| 31 +++ tools/perf/pmu-events/jevents.h| 3 ++- tools/perf/pmu-events/pmu-events.h | 1 + 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/tools/perf/pmu-events/jevents.c b/tools/perf/pmu-events/jevents.c index 5f7603b..a8507c9 100644 --- a/tools/perf/pmu-events/jevents.c +++ b/tools/perf/pmu-events/jevents.c @@ -203,7 +203,7 @@ static void print_events_table_prefix(FILE *fp, const char *tblname) } static int print_events_table_entry(void *data, char *name, char *event, - char *desc) + char *desc, char *long_desc) { FILE *outfp = data; /* @@ -215,6 +215,8 @@ static int print_events_table_entry(void *data, char *name, char *event, fprintf(outfp, \t.name = \%s\,\n, name); fprintf(outfp, \t.event = \%s\,\n, event); fprintf(outfp, \t.desc = \%s\,\n, desc); + if (long_desc long_desc[0]) + fprintf(outfp, \t.long_desc = \%s\,\n, long_desc); fprintf(outfp, },\n); @@ -235,7 +237,8 @@ static void print_events_table_suffix(FILE *outfp) /* Call func with each event in the json file */ int json_events(const char *fn, - int (*func)(void *data, char *name, char *event, char *desc), + int (*func)(void *data, char *name, char *event, char *desc, + char *long_desc), void *data) { int err = -EIO; @@ -254,6 +257,8 @@ int json_events(const char *fn, tok = tokens + 1; for (i = 0; i tokens-size; i++) { char *event = NULL, *desc = NULL, *name = NULL; + char *long_desc = NULL; + char *extra_desc = NULL; struct msrmap *msr = NULL; jsmntok_t *msrval = NULL; jsmntok_t *precise = NULL; @@ -279,6 +284,9 @@ int json_events(const char *fn, } else if (json_streq(map, field, BriefDescription)) { addfield(map, desc, , , val); fixdesc(desc); + } else if (json_streq(map, field, PublicDescription)) { + addfield(map, long_desc, , , val); + fixdesc(long_desc); } else if (json_streq(map, field, PEBS) nz) { precise = val; } else if (json_streq(map, field, MSRIndex) nz) { @@ -287,10 +295,10 @@ int json_events(const char *fn, msrval = val; } else if (json_streq(map, field, Errata) !json_streq(map, val, null)) { - addfield(map, desc, . , + addfield(map, extra_desc, . , Spec update: , val); } else if (json_streq(map, field, Data_LA) nz) { - addfield(map, desc, . , + addfield(map, extra_desc, . , Supports address when precise, NULL); } @@ -298,19 +306,26 @@ int json_events(const char *fn, } if (precise !strstr(desc, (Precise Event))) { if (json_streq(map, precise, 2)) - addfield(map, desc, , (Must be precise), - NULL); + addfield(map, extra_desc, , + (Must be precise), NULL); else - addfield(map, desc, , + addfield(map, extra_desc, , (Precise event), NULL); } + if (desc extra_desc) + addfield(map, desc, , extra_desc, NULL); + if (long_desc extra_desc) + addfield(map, long_desc, , extra_desc, NULL); if (msr != NULL) addfield(map, event, ,, msr-pname, msrval); fixname(name); - err = func(data, name, event, desc); + + err = func(data, name, event, desc, long_desc); free(event); free(desc); free(name); +
[PATCH v15 12/19] perf, tools: Add override support for event list CPUID
From: Andi Kleen a...@linux.intel.com Add a PERF_CPUID variable to override the CPUID of the current CPU (within the current architecture). This is useful for testing, so that all event lists can be tested on a single system. Signed-off-by: Andi Kleen a...@linux.intel.com Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- v2: Fix double free in earlier version. Print actual CPUID being used with verbose option. --- tools/perf/util/pmu.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index ebbd4c7..2a7abac 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -477,10 +477,16 @@ static int pmu_add_cpu_aliases(struct list_head *head) struct pmu_event *pe; char *cpuid; - cpuid = get_cpuid_str(); + cpuid = getenv(PERF_CPUID); + if (cpuid) + cpuid = strdup(cpuid); + if (!cpuid) + cpuid = get_cpuid_str(); if (!cpuid) return 0; + pr_debug(Using CPUID %s\n, cpuid); + i = 0; while (1) { map = pmu_events_map[i++]; -- 1.8.3.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v15 19/19] perf, tools: Add README for info on parsing JSON/map files
Signed-off-by: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Acked-by: Jiri Olsa jo...@redhat.com --- tools/perf/pmu-events/README | 122 +++ 1 file changed, 122 insertions(+) create mode 100644 tools/perf/pmu-events/README diff --git a/tools/perf/pmu-events/README b/tools/perf/pmu-events/README new file mode 100644 index 000..da57cb5 --- /dev/null +++ b/tools/perf/pmu-events/README @@ -0,0 +1,122 @@ + +The contents of this directory allow users to specify PMU events in +their CPUs by their symbolic names rather than raw event codes (see +example below). + +The main program in this directory, is the 'jevents', which is built and +executed _before_ the perf binary itself is built. + +The 'jevents' program tries to locate and process JSON files in the directory +tree tools/perf/pmu-events/arch/foo. + + - Regular files with '.json' extension in the name are assumed to be + JSON files, each of which describes a set of PMU events. + + - Regular files with basename starting with 'mapfile.csv' are assumed + to be a CSV file that maps a specific CPU to its set of PMU events. + (see below for mapfile format) + + - Directories are traversed, but all other files are ignored. + +Using the JSON files and the mapfile, 'jevents' generates the C source file, +'pmu-events.c', which encodes the two sets of tables: + + - Set of 'PMU events tables' for all known CPUs in the architecture, + (one table like the following, per JSON file; table name 'pme_power8' + is derived from JSON file name, 'power8.json'). + + struct pmu_event pme_power8[] = { + + ... + + { + .name = pm_1plus_ppc_cmpl, + .event = event=0x100f2, + .desc = 1 or more ppc insts finished,, + }, + + ... + } + + - A 'mapping table' that maps each CPU of the architecture, to its + 'PMU events table' + + struct pmu_events_map pmu_events_map[] = { + { + .cpuid = 004b, + .version = 1, + .type = core, + .table = pme_power8 + }, + ... + + }; + +After the 'pmu-events.c' is generated, it is compiled and the resulting +'pmu-events.o' is added to 'libperf.a' which is then used to build perf. + +NOTES: + 1. Several CPUs can support same set of events and hence use a common + JSON file. Hence several entries in the pmu_events_map[] could map + to a single 'PMU events table'. + + 2. The 'pmu-events.h' has an extern declaration for the mapping table + and the generated 'pmu-events.c' defines this table. + + 3. _All_ known CPU tables for architecture are included in the perf + binary. + +At run time, perf determines the actual CPU it is running on, finds the +matching events table and builds aliases for those events. This allows +users to specify events by their name: + + $ perf stat -e pm_1plus_ppc_cmpl sleep 1 + +where 'pm_1plus_ppc_cmpl' is a Power8 PMU event. + +In case of errors when processing files in the tools/perf/pmu-events/arch +directory, 'jevents' tries to create an empty mapping file to allow the perf +build to succeed even if the PMU event aliases cannot be used. + +However some errors in processing may cause the perf build to fail. + +Mapfile format +=== + +The mapfile.csv format is expected to be: + + Header line + CPUID,Version,File/path/name.json,Type + +where: + + Comma: + is the required field delimiter (i.e other fields cannot + have commas within them). + + Comments: + Lines in which the first character is either '\n' or '#' + are ignored. + + Header line + The header line is the first line in the file, which is + _IGNORED_. It can be a comment (begin with '#') or empty. + + CPUID: + CPUID is an arch-specific char string, that can be used + to identify CPU (and associate it with a set of PMU events + it supports). Multiple CPUIDS can point to the same + File/path/name.json. + + Example: + CPUID == 'GenuineIntel-6-2E' (on x86). + CPUID == '004b0100' (PVR value in Powerpc) + Version: + is the Version of the mapfile. + + File/path/name.json: + is the pathname for the JSON file, relative to the directory + containing the mapfile.csv + + Type: + indicates whether the events or core or uncore events. -- 1.8.3.1 ___ Linuxppc-dev mailing list
[RESEND PATCH V2 0/3] Allow user to request memory to be locked on page fault
mlock() allows a user to control page out of program memory, but this comes at the cost of faulting in the entire mapping when it is allocated. For large mappings where the entire area is not necessary this is not ideal. This series introduces new flags for mmap() and mlockall() that allow a user to specify that the covered are should not be paged out, but only after the memory has been used the first time. There are two main use cases that this set covers. The first is the security focussed mlock case. A buffer is needed that cannot be written to swap. The maximum size is known, but on average the memory used is significantly less than this maximum. With lock on fault, the buffer is guaranteed to never be paged out without consuming the maximum size every time such a buffer is created. The second use case is focussed on performance. Portions of a large file are needed and we want to keep the used portions in memory once accessed. This is the case for large graphical models where the path through the graph is not known until run time. The entire graph is unlikely to be used in a given invocation, but once a node has been used it needs to stay resident for further processing. Given these constraints we have a number of options. We can potentially waste a large amount of memory by mlocking the entire region (this can also cause a significant stall at startup as the entire file is read in). We can mlock every page as we access them without tracking if the page is already resident but this introduces large overhead for each access. The third option is mapping the entire region with PROT_NONE and using a signal handler for SIGSEGV to mprotect(PROT_READ) and mlock() the needed page. Doing this page at a time adds a significant performance penalty. Batching can be used to mitigate this overhead, but in order to safely avoid trying to mprotect pages outside of the mapping, the boundaries of each mapping to be used in this way must be tracked and available to the signal handler. This is precisely what the mm system in the kernel should already be doing. For mmap(MAP_LOCKONFAULT) the user is charged against RLIMIT_MEMLOCK as if MAP_LOCKED was used, so when the VMA is created not when the pages are faulted in. For mlockall(MCL_ON_FAULT) the user is charged as if MCL_FUTURE was used. This decision was made to keep the accounting checks out of the page fault path. To illustrate the benefit of this patch I wrote a test program that mmaps a 5 GB file filled with random data and then makes 15,000,000 accesses to random addresses in that mapping. The test program was run 20 times for each setup. Results are reported for two program portions, setup and execution. The setup phase is calling mmap and optionally mlock on the entire region. For most experiments this is trivial, but it highlights the cost of faulting in the entire region. Results are averages across the 20 runs in milliseconds. mmap with MAP_LOCKED: Setup avg: 11821.193 Processing avg: 3404.286 mmap with mlock() before each access: Setup avg: 0.054 Processing avg: 34263.201 mmap with PROT_NONE and signal handler and batch size of 1 page: With the default value in max_map_count, this gets ENOMEM as I attempt to change the permissions, after upping the sysctl significantly I get: Setup avg: 0.050 Processing avg: 67690.625 mmap with PROT_NONE and signal handler and batch size of 8 pages: Setup avg: 0.098 Processing avg: 37344.197 mmap with PROT_NONE and signal handler and batch size of 16 pages: Setup avg: 0.0548 Processing avg: 29295.669 mmap with MAP_LOCKONFAULT: Setup avg: 0.073 Processing avg: 18392.136 The signal handler in the batch cases faulted in memory in two steps to avoid having to know the start and end of the faulting mapping. The first step covers the page that caused the fault as we know that it will be possible to lock. The second step speculatively tries to mlock and mprotect the batch size - 1 pages that follow. There may be a clever way to avoid this without having the program track each mapping to be covered by this handeler in a globally accessible structure, but I could not find it. It should be noted that with a large enough batch size this two step fault handler can still cause the program to crash if it reaches far beyond the end of the mapping. These results show that if the developer knows that a majority of the mapping will be used, it is better to try and fault it in at once, otherwise MAP_LOCKONFAULT is significantly faster. The performance cost of these patches are minimal on the two benchmarks I have tested (stream and kernbench). The following are the average values across 20 runs of each benchmark after a warmup run whose results were discarded. Avg throughput in MB/s from stream using 100 element arrays Test 4.1-rc2 4.1-rc2+lock-on-fault Copy:10,979.0810,917.34 Scale: 11,094.4511,023.01 Add: 12,487.2912,388.65 Triad:
[RESEND PATCH V2 1/3] Add mmap flag to request pages are locked after page fault
The cost of faulting in all memory to be locked can be very high when working with large mappings. If only portions of the mapping will be used this can incur a high penalty for locking. For the example of a large file, this is the usage pattern for a large statical language model (probably applies to other statical or graphical models as well). For the security example, any application transacting in data that cannot be swapped out (credit card data, medical records, etc). This patch introduces the ability to request that pages are not pre-faulted, but are placed on the unevictable LRU when they are finally faulted in. To keep accounting checks out of the page fault path, users are billed for the entire mapping lock as if MAP_LOCKED was used. Signed-off-by: Eric B Munson emun...@akamai.com Cc: Michal Hocko mho...@suse.cz Cc: linux-al...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: sparcli...@vger.kernel.org Cc: linux-xte...@linux-xtensa.org Cc: linux...@kvack.org Cc: linux-a...@vger.kernel.org Cc: linux-...@vger.kernel.org --- arch/alpha/include/uapi/asm/mman.h | 1 + arch/mips/include/uapi/asm/mman.h| 1 + arch/parisc/include/uapi/asm/mman.h | 1 + arch/powerpc/include/uapi/asm/mman.h | 1 + arch/sparc/include/uapi/asm/mman.h | 1 + arch/tile/include/uapi/asm/mman.h| 1 + arch/xtensa/include/uapi/asm/mman.h | 1 + include/linux/mm.h | 1 + include/linux/mman.h | 3 ++- include/uapi/asm-generic/mman.h | 1 + mm/mmap.c| 4 ++-- mm/swap.c| 3 ++- 12 files changed, 15 insertions(+), 4 deletions(-) diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h index 0086b47..15e96e1 100644 --- a/arch/alpha/include/uapi/asm/mman.h +++ b/arch/alpha/include/uapi/asm/mman.h @@ -30,6 +30,7 @@ #define MAP_NONBLOCK 0x4 /* do not block on IO */ #define MAP_STACK 0x8 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB0x10/* create a huge page mapping */ +#define MAP_LOCKONFAULT0x20/* Lock pages after they are faulted in, do not prefault */ #define MS_ASYNC 1 /* sync memory asynchronously */ #define MS_SYNC2 /* synchronous memory sync */ diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h index cfcb876..47846a5 100644 --- a/arch/mips/include/uapi/asm/mman.h +++ b/arch/mips/include/uapi/asm/mman.h @@ -48,6 +48,7 @@ #define MAP_NONBLOCK 0x2 /* do not block on IO */ #define MAP_STACK 0x4 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB0x8 /* create a huge page mapping */ +#define MAP_LOCKONFAULT0x10/* Lock pages after they are faulted in, do not prefault */ /* * Flags for msync diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h index 294d251..1514cd7 100644 --- a/arch/parisc/include/uapi/asm/mman.h +++ b/arch/parisc/include/uapi/asm/mman.h @@ -24,6 +24,7 @@ #define MAP_NONBLOCK 0x2 /* do not block on IO */ #define MAP_STACK 0x4 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB0x8 /* create a huge page mapping */ +#define MAP_LOCKONFAULT0x10/* Lock pages after they are faulted in, do not prefault */ #define MS_SYNC1 /* synchronous memory sync */ #define MS_ASYNC 2 /* sync memory asynchronously */ diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h index 6ea26df..fce74fe 100644 --- a/arch/powerpc/include/uapi/asm/mman.h +++ b/arch/powerpc/include/uapi/asm/mman.h @@ -27,5 +27,6 @@ #define MAP_NONBLOCK 0x1 /* do not block on IO */ #define MAP_STACK 0x2 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB0x4 /* create a huge page mapping */ +#define MAP_LOCKONFAULT0x8 /* Lock pages after they are faulted in, do not prefault */ #endif /* _UAPI_ASM_POWERPC_MMAN_H */ diff --git a/arch/sparc/include/uapi/asm/mman.h b/arch/sparc/include/uapi/asm/mman.h index 0b14df3..12425d8 100644 --- a/arch/sparc/include/uapi/asm/mman.h +++ b/arch/sparc/include/uapi/asm/mman.h @@ -22,6 +22,7 @@ #define MAP_NONBLOCK 0x1 /* do not block on IO */ #define MAP_STACK 0x2 /* give out an address that is best suited for process/thread stacks */ #define MAP_HUGETLB0x4 /* create a huge page mapping */ +#define MAP_LOCKONFAULT0x8 /* Lock pages after they are faulted in, do not
[RESEND PATCH V2 2/3] Add mlockall flag for locking pages on fault
Building on the previous patch, extend mlockall() to give a process a way to specify that pages should be locked when they are faulted in, but that pre-faulting is not needed. MCL_ONFAULT is preferrable to MCL_FUTURE for the use cases enumerated in the previous patch becuase MCL_FUTURE will behave as if each mapping was made with MAP_LOCKED, causing the entire mapping to be faulted in when new space is allocated or mapped. MCL_ONFAULT allows the user to delay the fault in cost of any given page until it is actually needed, but then guarantees that that page will always be resident. As with the mmap(MAP_LOCKONFAULT) case, the user is charged for the mapping against the RLIMIT_MEMLOCK when the address space is allocated, not when the page is faulted in. This decision was made to keep the accounting checks out of the page fault path. Signed-off-by: Eric B Munson emun...@akamai.com Cc: Michal Hocko mho...@suse.cz Cc: linux-al...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux-m...@linux-mips.org Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: sparcli...@vger.kernel.org Cc: linux-xte...@linux-xtensa.org Cc: linux-a...@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux...@kvack.org --- arch/alpha/include/uapi/asm/mman.h | 1 + arch/mips/include/uapi/asm/mman.h| 1 + arch/parisc/include/uapi/asm/mman.h | 1 + arch/powerpc/include/uapi/asm/mman.h | 1 + arch/sparc/include/uapi/asm/mman.h | 1 + arch/tile/include/uapi/asm/mman.h| 1 + arch/xtensa/include/uapi/asm/mman.h | 1 + include/uapi/asm-generic/mman.h | 1 + mm/mlock.c | 13 + 9 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h index 15e96e1..dfdaecf 100644 --- a/arch/alpha/include/uapi/asm/mman.h +++ b/arch/alpha/include/uapi/asm/mman.h @@ -38,6 +38,7 @@ #define MCL_CURRENT 8192 /* lock all currently mapped pages */ #define MCL_FUTURE 16384 /* lock all additions to address space */ +#define MCL_ONFAULT32768 /* lock all pages that are faulted in */ #define MADV_NORMAL0 /* no further special treatment */ #define MADV_RANDOM1 /* expect random page references */ diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h index 47846a5..f0705ff 100644 --- a/arch/mips/include/uapi/asm/mman.h +++ b/arch/mips/include/uapi/asm/mman.h @@ -62,6 +62,7 @@ */ #define MCL_CURRENT1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ +#define MCL_ONFAULT4 /* lock all pages that are faulted in */ #define MADV_NORMAL0 /* no further special treatment */ #define MADV_RANDOM1 /* expect random page references */ diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h index 1514cd7..7c2eb85 100644 --- a/arch/parisc/include/uapi/asm/mman.h +++ b/arch/parisc/include/uapi/asm/mman.h @@ -32,6 +32,7 @@ #define MCL_CURRENT1 /* lock all current mappings */ #define MCL_FUTURE 2 /* lock all future mappings */ +#define MCL_ONFAULT4 /* lock all pages that are faulted in */ #define MADV_NORMAL 0 /* no further special treatment */ #define MADV_RANDOM 1 /* expect random page references */ diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h index fce74fe..761137a 100644 --- a/arch/powerpc/include/uapi/asm/mman.h +++ b/arch/powerpc/include/uapi/asm/mman.h @@ -22,6 +22,7 @@ #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ #define MCL_FUTURE 0x4000 /* lock all additions to address space */ +#define MCL_ONFAULT0x8000 /* lock all pages that are faulted in */ #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x1 /* do not block on IO */ diff --git a/arch/sparc/include/uapi/asm/mman.h b/arch/sparc/include/uapi/asm/mman.h index 12425d8..dd027b8 100644 --- a/arch/sparc/include/uapi/asm/mman.h +++ b/arch/sparc/include/uapi/asm/mman.h @@ -17,6 +17,7 @@ #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */ #define MCL_FUTURE 0x4000 /* lock all additions to address space */ +#define MCL_ONFAULT0x8000 /* lock all pages that are faulted in */ #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ #define MAP_NONBLOCK 0x1 /* do not block on IO */ diff --git a/arch/tile/include/uapi/asm/mman.h b/arch/tile/include/uapi/asm/mman.h index ec04eaf..0f7ae45 100644 --- a/arch/tile/include/uapi/asm/mman.h +++ b/arch/tile/include/uapi/asm/mman.h @@ -37,6 +37,7 @@ */ #define MCL_CURRENT1
[PATCH V2] cxl: Set up and enable PSL Timebase
This patch configures the PSL Timebase function and enables it, after the CAPP has been initialized by OPAL. V2: - Clear CXL_PSL_ErrIVTE_tberror bit - Define the sync count unit - Wait 1ms before each test - Use negative error code - Do not ignore errors - Except if timebase is not supported by OPAL - Be silent on success Signed-off-by: Philippe Bergheaud fe...@linux.vnet.ibm.com --- drivers/misc/cxl/cxl.h |5 drivers/misc/cxl/pci.c | 57 +++- 2 files changed, 61 insertions(+), 1 deletions(-) diff --git a/drivers/misc/cxl/cxl.h b/drivers/misc/cxl/cxl.h index a1cee47..38a7cf9 100644 --- a/drivers/misc/cxl/cxl.h +++ b/drivers/misc/cxl/cxl.h @@ -82,8 +82,10 @@ static const cxl_p1_reg_t CXL_PSL_AFUSEL = {0x00B0}; /* 0x00C0:7EFF Implementation dependent area */ static const cxl_p1_reg_t CXL_PSL_FIR1 = {0x0100}; static const cxl_p1_reg_t CXL_PSL_FIR2 = {0x0108}; +static const cxl_p1_reg_t CXL_PSL_Timebase = {0x0110}; static const cxl_p1_reg_t CXL_PSL_VERSION = {0x0118}; static const cxl_p1_reg_t CXL_PSL_RESLCKTO = {0x0128}; +static const cxl_p1_reg_t CXL_PSL_TB_CTLSTAT = {0x0140}; static const cxl_p1_reg_t CXL_PSL_FIR_CNTL = {0x0148}; static const cxl_p1_reg_t CXL_PSL_DSNDCTL = {0x0150}; static const cxl_p1_reg_t CXL_PSL_SNWRALLOC = {0x0158}; @@ -151,6 +153,9 @@ static const cxl_p2n_reg_t CXL_PSL_WED_An = {0x0A0}; #define CXL_PSL_SPAP_Size_Shift 4 #define CXL_PSL_SPAP_V0x0001ULL +/** CXL_PSL_Control / +#define CXL_PSL_Control_tb 0x0001ULL + /** CXL_PSL_DLCNTL */ #define CXL_PSL_DLCNTL_D (0x1ull (63-28)) #define CXL_PSL_DLCNTL_C (0x1ull (63-29)) diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c index fc938de..ea1a79f 100644 --- a/drivers/misc/cxl/pci.c +++ b/drivers/misc/cxl/pci.c @@ -360,6 +360,55 @@ static int init_implementation_adapter_regs(struct cxl *adapter, struct pci_dev return 0; } +#define TBSYNC_CNT(n) (((u64)n 0x7) (63-6)) +#define _2048_250MHZ_CYCLES 1 + +static int cxl_setup_psl_timebase(struct cxl *adapter, struct pci_dev *dev) +{ + u64 psl_tb; + int delta; + unsigned int retry = 0; + struct device_node *np; + + if (!(np = pnv_pci_to_phb_node(dev))) + return -ENODEV; + + /* Do not fail when CAPP timebase sync is not supported by OPAL */ + of_node_get(np); + if (! of_get_property(np, ibm,capp-timebase-sync, NULL)) { + of_node_put(np); + pr_err(PSL: Timebase sync: OPAL support missing\n); + return 0; + } + of_node_put(np); + + /* +* Setup PSL Timebase Control and Status register +* with the recommended Timebase Sync Count value +*/ + cxl_p1_write(adapter, CXL_PSL_TB_CTLSTAT, +TBSYNC_CNT(2 * _2048_250MHZ_CYCLES)); + + /* Enable PSL Timebase */ + cxl_p1_write(adapter, CXL_PSL_Control, 0x); + cxl_p1_write(adapter, CXL_PSL_Control, CXL_PSL_Control_tb); + + /* Wait until CORE TB and PSL TB difference = 16usecs */ + do { + msleep(1); + if (retry++ 5) { + pr_err(PSL: Timebase sync: giving up!\n); + return -EIO; + } + psl_tb = cxl_p1_read(adapter, CXL_PSL_Timebase); + delta = mftb() - psl_tb; + if (delta 0) + delta = -delta; + } while (cputime_to_usecs(delta) 16); + + return 0; +} + static int init_implementation_afu_regs(struct cxl_afu *afu) { /* read/write masks for this slice */ @@ -952,9 +1001,12 @@ static struct cxl *cxl_alloc_adapter(struct pci_dev *dev) return adapter; } +#define CXL_PSL_ErrIVTE_tberror (0x1ull (63-31)) + static int sanitise_adapter_regs(struct cxl *adapter) { - cxl_p1_write(adapter, CXL_PSL_ErrIVTE, 0x); + /* Clear PSL tberror bit by writing 1 to it */ + cxl_p1_write(adapter, CXL_PSL_ErrIVTE, CXL_PSL_ErrIVTE_tberror); return cxl_tlb_slb_invalidate(adapter); } @@ -995,6 +1047,9 @@ static struct cxl *cxl_init_adapter(struct pci_dev *dev) if ((rc = pnv_phb_to_cxl(dev, OPAL_PHB_CAPI_MODE_CAPI))) goto err3; + if ((rc = cxl_setup_psl_timebase(adapter, dev))) + goto err3; + if ((rc = cxl_register_psl_err_irq(adapter))) goto err3; -- 1.7.2.5 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
On Wed, 2015-06-10 at 07:38 +, Madalin-Cristian Bucur wrote: Hi Eric, Can you please tell us if this change would be for the better? I was about to say yes to this request but checked and no other Ethernet driver seems to use the queue trans_start. I was able to find your patch net: tx scalability works : trans_start [ http://patchwork.ozlabs.org/patch/27104/ ] but did not find more about this topic. Drivers no longer have to worry about updating trans_start themselves. Core networking stack handles this. Check txq_trans_update() done from netdev_start_xmit() ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 08/42] powerpc/powernv: DMA32 cleanup
On Wed, Jun 10, 2015 at 02:17:26PM +1000, Alexey Kardashevskiy wrote: On 06/04/2015 04:41 PM, Gavin Shan wrote: The patch cleans up DMA32 in pci-ioda.c. It shouldn't introduce behavioural changes: * Rename various fields in struct pnv_phb and struct pnv_ioda_pe as 32-bits DMA should be related to DMA, not TCE, and move them around to reflect their relationship and their relative importance. * Removed struct pnv_ioda_pe::tce32_segcount. Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com --- v5: * Split from PATCH[v4 5/21] --- arch/powerpc/platforms/powernv/pci-ioda.c | 48 +++ arch/powerpc/platforms/powernv/pci.h | 13 +++-- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index d9ff739..4af3d06 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -971,7 +971,7 @@ static void pnv_ioda_link_pe_by_weight(struct pnv_phb *phb, struct pnv_ioda_pe *lpe; list_for_each_entry(lpe, phb-ioda.pe_dma_list, dma_link) { - if (lpe-dma_weight pe-dma_weight) { + if (lpe-dma32_weight pe-dma32_weight) { list_add_tail(pe-dma_link, lpe-dma_link); return; } @@ -996,14 +996,14 @@ static unsigned int pnv_ioda_dev_dma_weight(struct pci_dev *dev) if (dev-class == PCI_CLASS_SERIAL_USB_UHCI || dev-class == PCI_CLASS_SERIAL_USB_OHCI || dev-class == PCI_CLASS_SERIAL_USB_EHCI) - return 3 * phb-ioda.tce32_count; + return 3 * phb-ioda.dma32_segcount; /* Increase the weight of RAID (includes Obsidian) */ if ((dev-class 8) == PCI_CLASS_STORAGE_RAID) - return 15 * phb-ioda.tce32_count; + return 15 * phb-ioda.dma32_segcount; /* Default */ - return 10 * phb-ioda.tce32_count; + return 10 * phb-ioda.dma32_segcount; } static int __pnv_ioda_phb_dma_weight(struct pci_dev *pdev, void *data) @@ -1182,7 +1182,7 @@ static void pnv_ioda_setup_same_PE(struct pci_bus *bus, struct pnv_ioda_pe *pe) continue; } pdn-pe_number = pe-pe_number; - pe-dma_weight += pnv_ioda_dev_dma_weight(dev); + pe-dma32_weight += pnv_ioda_dev_dma_weight(dev); if ((pe-flags PNV_IODA_PE_BUS_ALL) dev-subordinate) pnv_ioda_setup_same_PE(dev-subordinate, pe); } @@ -1219,10 +1219,10 @@ static void pnv_ioda_setup_bus_PE(struct pci_bus *bus, int all) pe-flags |= (all ? PNV_IODA_PE_BUS_ALL : PNV_IODA_PE_BUS); pe-pbus = bus; pe-pdev = NULL; - pe-tce32_seg = -1; + pe-dma32_seg = -1; pe-mve_number = -1; pe-rid = bus-busn_res.start 8; - pe-dma_weight = 0; + pe-dma32_weight = 0; if (all) pe_info(pe, Secondary bus %d..%d associated with PE#%d\n, @@ -1585,7 +1585,7 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs) pe-flags = PNV_IODA_PE_VF; pe-pbus = NULL; pe-parent_dev = pdev; - pe-tce32_seg = -1; + pe-dma32_seg = -1; pe-mve_number = -1; pe-rid = (pci_iov_virtfn_bus(pdev, vf_index) 8) | pci_iov_virtfn_devfn(pdev, vf_index); @@ -2061,7 +2061,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, /* XXX FIXME: Allocate multi-level tables on PHB3 */ /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe-tce32_seg = 0)) + if (WARN_ON(pe-dma32_seg = 0)) return; tbl = pnv_pci_table_alloc(phb-hose-node); @@ -2070,7 +2070,7 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, pnv_pci_link_table_and_group(phb-hose-node, 0, tbl, pe-table_group); /* Grab a 32-bit TCE table */ - pe-tce32_seg = base; + pe-dma32_seg = base; pe_info(pe, Setting up 32-bit TCE table at %08x..%08x\n, (base 28), ((base + segs) 28) - 1); @@ -2131,8 +2131,8 @@ static void pnv_pci_ioda_setup_dma_pe(struct pnv_phb *phb, return; fail: /* XXX Failure: Try to fallback to 64-bit only ? */ - if (pe-tce32_seg = 0) - pe-tce32_seg = -1; + if (pe-dma32_seg = 0) + pe-dma32_seg = -1; if (tce_mem) __free_pages(tce_mem, get_order(TCE32_TABLE_SIZE * segs)); if (tbl) { @@ -2520,7 +2520,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, int64_t rc; /* We shouldn't already have a 32-bit DMA associated */ - if (WARN_ON(pe-tce32_seg = 0)) + if (WARN_ON(pe-dma32_seg = 0)) return; /* TVE #1 is selected by PCI address bit 59 */ @@ -2530,7 +2530,7 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, pe-pe_number);
Re: [PATCH v5 11/42] powerpc/powernv: Increase PE# capacity
On Wed, Jun 10, 2015 at 02:41:13PM +1000, Alexey Kardashevskiy wrote: On 06/04/2015 04:41 PM, Gavin Shan wrote: Each PHB maintains an array helping to translate RID (Request ID) to PE# with the assumption that PE# takes 8 bits, indicating that we can't have more than 256 PEs. However, pci_dn-pe_number already had 4-bytes for the PE#. The patch extends the PE# capacity so that each of them will be 4-bytes long. Then we can use IODA_INVALID_PE to check one entry in phb-pe_rmap[] is valid or not. Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com --- v5: * Split from [PATCH v5 v4 06/21] --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 - arch/powerpc/platforms/powernv/pci.h | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 2087c5c..d8b0ef5 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -840,7 +840,7 @@ static int pnv_ioda_deconfigure_pe(struct pnv_phb *phb, struct pnv_ioda_pe *pe) /* Clear the reverse map */ for (rid = pe-rid; rid rid_end; rid++) - phb-ioda.pe_rmap[rid] = 0; + phb-ioda.pe_rmap[rid] = IODA_INVALID_PE; /* Release from all parents PELT-V */ while (parent) { @@ -3303,6 +3303,9 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, if (prop32) phb-ioda.reserved_pe = be32_to_cpup(prop32); + /* Invalidate RID to PE# mapping */ + memset(phb-ioda.pe_rmap, 0xff, sizeof(phb-ioda.pe_rmap)); Above you assign IODA_INVALID_PE in a loop and here you just do 0xff for the entire array. Have a loop here too and assign IODA_INVALID_PE to every entry: for (i = 0; i ARRAY_SIZE(phb-ioda.pe_rmap); ++i) phb-ioda.pe_rmap[i] = IODA_INVALID_PE; Yeah, will change accordingly. + /* Parse 64-bit MMIO range */ pnv_ioda_parse_m64_window(phb); diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h index 94ef1df..590f778 100644 --- a/arch/powerpc/platforms/powernv/pci.h +++ b/arch/powerpc/platforms/powernv/pci.h @@ -175,11 +175,10 @@ struct pnv_phb { struct list_headpe_list; struct mutexpe_list_mutex; - /* Reverse map of PEs, will have to extend if - * we are to support more than 256 PEs, indexed + /* Reverse map of PEs, indexed by * bus { bus, devfn } */ - unsigned char pe_rmap[0x1]; + int pe_rmap[0x1]; Most time most of the array will be empty and it is 256K per PHB... I understand we have quite a lot of RAM but still. Indeed, I'll think about how to save memory here, but not in this patchset. /* Number of 32-bit DMA segments */ unsigned long dma32_segcount; Thanks, Gavin ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 12/42] powerpc/pci: Cleanup on pci_controller_ops
On Wed, Jun 10, 2015 at 02:43:57PM +1000, Alexey Kardashevskiy wrote: On 06/04/2015 04:41 PM, Gavin Shan wrote: Each PHB maintains one instance of struct pci_controller_ops, which includes various callbacks called by PCI subsystem. In the definition of this struct, some callbacks have explicit names for its arguments, but the left don't have. The patch removes all explicit names of the arguments to the callbacks in struct pci_controller_ops to keep the code look consistent. imho it is a bad idea. Self-documeted code gets less self-documented - how do I know what unsigned long parameters are for without grepping? Ok. I'll change the function definations to always have explicit argument names. Cc: Daniel Axtens d...@axtens.net Signed-off-by: Gavin Shan gws...@linux.vnet.ibm.com --- v5: * Newly introduced --- arch/powerpc/include/asm/pci-bridge.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 744884b..1252cd5 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -18,8 +18,8 @@ struct device_node; * PCI controller operations */ struct pci_controller_ops { - void(*dma_dev_setup)(struct pci_dev *dev); - void(*dma_bus_setup)(struct pci_bus *bus); + void(*dma_dev_setup)(struct pci_dev *); + void(*dma_bus_setup)(struct pci_bus *); int (*probe_mode)(struct pci_bus *); @@ -28,8 +28,8 @@ struct pci_controller_ops { bool(*enable_device_hook)(struct pci_dev *); /* Called during PCI resource reassignment */ - resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type); - void(*reset_secondary_bus)(struct pci_dev *dev); + resource_size_t (*window_alignment)(struct pci_bus *, unsigned long); + void(*reset_secondary_bus)(struct pci_dev *); }; /* Thanks, Gavin ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
-Original Message- From: Linuxppc-dev [mailto:linuxppc-dev- bounces+jianhua.xie=freescale@lists.ozlabs.org] On Behalf Of Madalin Bucur Sent: Wednesday, April 29, 2015 10:57 PM To: net...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org Cc: linux-ker...@vger.kernel.org; Bucur Madalin-Cristian-B32716 Subject: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet This introduces the Freescale Data Path Acceleration Architecture (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, BMan, PAMU and FMan drivers to deliver Ethernet connectivity on the Freescale DPAA QorIQ platforms. Snip.. + + if (unlikely(dpa_xmit(priv, percpu_stats, queue_mapping, fd) 0)) + goto xmit_failed; + + net_dev-trans_start = jiffies; It is probably better to use netdev_queue-trans_start to instead of net_dev-trans_start on SMP. Best Regards, Jianhua + return NETDEV_TX_OK; + +xmit_failed: + if (fd.cmd FM_FD_CMD_FCO) { + (*countptr)--; + dpa_fd_release(net_dev, fd); + percpu_stats-tx_errors++; + return NETDEV_TX_OK; + } + _dpa_cleanup_tx_fd(priv, fd); + percpu_stats-tx_errors++; + dev_kfree_skb(skb); + return NETDEV_TX_OK; +} -- 1.7.11.7 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 19/21] drivers/of: Support adding sub-tree
On Mon, Jun 08, 2015 at 10:34:13PM +0100, Grant Likely wrote: On Mon, Jun 8, 2015 at 9:57 PM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Sun, 2015-06-07 at 08:54 +0100, Grant Likely wrote: IE. conceptually, what overlays do today is quite rooted around the idea of having a fixed base DT and some pre-compiled DTB overlays that get added/removed. The design completely ignore the idea of a FW that maintains a live tree which we want to keep in sync, which is what we want to do here, or what we could do with a live open firmware implementation. Right, which is exactly the reason for the changeset/overlay split. Overlays assume a fixed base, and that overlays are kind of like plug-in modules. changeset makes no such assumption. So you suggest we create a function that takes an fdt and an anchor as input, and expands that FDT below that anchor, but does so by using the changeset API under the hood ? Even that looks somewhat tricky (turn that bit of FDT into a pile of changeset actions), however, I can see how we could create a new function inside changeset to attach a subtree. Ie. of_attach_subtree() (which could have it's own reconfig action but we don't care that much yet), which takes an expanded subtree and an anchor, and calls of_attach_node() in effect for all nodes in there. We could then have a two pass mechanism in our hotplug code: - Expand the bit of fdt into a separate tree - Use of_attach_subtree to add that subtree to the main tree What do you think ? I like that. Thanks, Grant and Ben. Currently, I'm collecting more feedbacks for v5. So it's something I will address in v6. Thanks, Gavin g. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 03/12] fsl/fman: Add the FMan port FLIB headers
From: Igal Liberman igal.liber...@freescale.com The FMan Port Flib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../net/ethernet/freescale/fman/flib/fman_common.h | 73 .../ethernet/freescale/fman/flib/fsl_fman_port.h | 427 + .../net/ethernet/freescale/fman/flib/fsl_fman_sp.h | 54 +++ 3 files changed, 554 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fman_common.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_sp.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fman_common.h b/drivers/net/ethernet/freescale/fman/flib/fman_common.h new file mode 100644 index 000..e186ed9 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fman_common.h @@ -0,0 +1,73 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FMAN_COMMON_H +#define __FMAN_COMMON_H + +/* NIA Description */ +#define NIA_ORDER_RESTOR 0x0080 +#define NIA_ENG_FM_CTL 0x +#define NIA_ENG_PRS0x0044 +#define NIA_ENG_KG 0x0048 +#define NIA_ENG_PLCR 0x004C +#define NIA_ENG_BMI0x0050 +#define NIA_ENG_QMI_ENQ0x0054 +#define NIA_ENG_QMI_DEQ0x0058 +#define NIA_ENG_MASK 0x007C + +#define NIA_FM_CTL_AC_CC 0x0006 +#define NIA_FM_CTL_AC_HC 0x000C +#define NIA_FM_CTL_AC_IND_MODE_TX 0x0008 +#define NIA_FM_CTL_AC_IND_MODE_RX 0x000A +#define NIA_FM_CTL_AC_FRAG 0x000e +#define NIA_FM_CTL_AC_PRE_FETCH0x0010 +#define NIA_FM_CTL_AC_POST_FETCH_PCD 0x0012 +#define NIA_FM_CTL_AC_POST_FETCH_PCD_UDP_LEN 0x0018 +#define NIA_FM_CTL_AC_POST_FETCH_NO_PCD0x0012 +#define NIA_FM_CTL_AC_FRAG_CHECK 0x0014 +#define NIA_FM_CTL_AC_PRE_CC 0x0020 + +#define NIA_BMI_AC_ENQ_FRAME 0x0002 +#define NIA_BMI_AC_TX_RELEASE 0x02C0 +#define NIA_BMI_AC_RELEASE 0x00C0 +#define NIA_BMI_AC_DISCARD 0x00C1 +#define NIA_BMI_AC_TX 0x0274 +#define NIA_BMI_AC_FETCH 0x0208 +#define NIA_BMI_AC_MASK0x03FF + +#define NIA_KG_DIRECT 0x0100 +#define NIA_KG_CC_EN 0x0200 +#define NIA_PLCR_ABSOLUTE 0x8000 + +#define NIA_BMI_AC_ENQ_FRAME_WITHOUT_DMA 0x0202 +#define NIA_BMI_AC_FETCH_ALL_FRAME 0x020c + +#endif /* __FMAN_COMMON_H */ diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h b/drivers/net/ethernet/freescale/fman/flib/fsl_fman_port.h new file mode 100644 index 000..719d15e
[PATCH 10/12] fsl/fman: Add FMan SP support
From: Igal Liberman igal.liber...@freescale.com Add Storage Profiles support. The Storage Profiles contain parameters that are used by the FMan in order to store frames being received on the Rx ports, or to determine the parameters that affect writing the Internal Context in the frame margin on Tx. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile | 2 + drivers/net/ethernet/freescale/fman/fm_sp_common.h | 104 ++ drivers/net/ethernet/freescale/fman/sp/Makefile| 3 + drivers/net/ethernet/freescale/fman/sp/fm_sp.c | 398 + 4 files changed, 507 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/fm_sp_common.h create mode 100644 drivers/net/ethernet/freescale/fman/sp/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/sp/fm_sp.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index f61d3a6..c6c3e24 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -8,3 +8,5 @@ fsl_fman-objs := fman.o fm_muram.o fm.o fm_drv.o obj-y += port/ obj-y += mac/ +obj-y += sp/ + diff --git a/drivers/net/ethernet/freescale/fman/fm_sp_common.h b/drivers/net/ethernet/freescale/fman/fm_sp_common.h new file mode 100644 index 000..a99d795 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fm_sp_common.h @@ -0,0 +1,104 @@ +/* + * Copyright 2008-2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* FM SP ... */ +#ifndef __FM_SP_COMMON_H +#define __FM_SP_COMMON_H + +#include service.h +#include fm_ext.h +#include fsl_fman.h + +/* defaults */ +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_DATA_SIZE 0 +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTENT_PRIV_PASS_PRS_RESULT false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_PASS_TIME_STAMP false +#define DEFAULT_FM_SP_BUFFER_PREFIX_CONTEXT_DATA_ALIGN 64 + +/* structure for defining internal context copying */ +struct fm_sp_int_context_data_copy_t { + /* Offset in External buffer to which internal +* context is copied to (Rx) or taken from (Tx, Op). +*/ + uint16_t ext_buf_offset; + /* Offset within internal context to copy from +* (Rx) or to copy to (Tx, Op). +*/ + uint8_t int_context_offset; + /* Internal offset size to be copied */ + uint16_t size; +}; + +/* struct for defining external buffer margins */ +struct fm_sp_buf_margins_t { + /* Number of bytes to be left at the beginning +* of the external buffer (must be divisible by 16) +*/ + uint16_t start_margins; + /* number of bytes to be left at the end +* of the external buffer(must be divisible by 16) +*/ + uint16_t end_margins; +}; + +struct fm_sp_buffer_offsets_t { + uint32_t data_offset; + uint32_t prs_result_offset; + uint32_t time_stamp_offset; + uint32_t hash_result_offset; +}; + +int fm_sp_build_buffer_structure(struct fm_sp_int_context_data_copy_t +*p_fm_port_int_context_data_copy, +struct
[PATCH 12/12] fsl/fman: Add FMan MAC driver
From: Igal Liberman igal.liber...@freescale.com This patch adds the Ethernet MAC driver support. Signed-off-by: Igal Liberman igal.liber...@freescale.com Signed-off-by: Madalin Bucur madalin.bu...@freescale.com --- drivers/net/ethernet/freescale/fman/inc/mac.h | 136 drivers/net/ethernet/freescale/fman/mac/Makefile | 3 +- drivers/net/ethernet/freescale/fman/mac/mac-api.c | 765 ++ drivers/net/ethernet/freescale/fman/mac/mac.c | 526 +++ 4 files changed, 1429 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ethernet/freescale/fman/inc/mac.h create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac-api.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/mac.c diff --git a/drivers/net/ethernet/freescale/fman/inc/mac.h b/drivers/net/ethernet/freescale/fman/inc/mac.h new file mode 100644 index 000..0111f4c --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/inc/mac.h @@ -0,0 +1,136 @@ +/* Copyright 2008-2015 Freescale Semiconductor, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __MAC_H +#define __MAC_H + +#include linux/device.h /* struct device, BUS_ID_SIZE */ +#include linux/if_ether.h/* ETH_ALEN */ +#include linux/phy.h /* phy_interface_t, struct phy_device */ +#include linux/list.h + +#include enet_ext.h + +#include fsl_fman_drv.h /* struct port_device */ +#include fm_port_ext.h + +struct fm_mac_dev; +enum fm_mac_exceptions; + +enum {DTSEC, XGMAC, MEMAC}; + +struct mac_device { + struct device *dev; + void*priv; + u8 cell_index; + struct resource *res; + void __iomem*vaddr; + u8 addr[ETH_ALEN]; + bool promisc; + + struct fm *fm_dev; + struct fm_port_drv_t*port_dev[2]; + + phy_interface_t phy_if; + u32 if_support; + bool link; + u16 speed; + u16 max_speed; + struct device_node *phy_node; + char fixed_bus_id[MII_BUS_ID_SIZE + 3]; + struct device_node *tbi_node; + struct phy_device *phy_dev; + void*fm; + /* List of multicast addresses */ + struct list_head mc_addr_list; + struct platform_device *eth_dev; + + bool autoneg_pause; + bool rx_pause_req; + bool tx_pause_req; + bool rx_pause_active; + bool tx_pause_active; + + int (*init_phy)(struct net_device *net_dev, struct mac_device *mac_dev); + int (*init)(struct mac_device *mac_dev); + int (*start)(struct mac_device *mac_dev); + int (*stop)(struct mac_device *mac_dev); + int (*set_promisc)(struct fm_mac_dev *fm_mac_dev, bool enable); + int (*change_addr)(struct fm_mac_dev *fm_mac_dev, + enet_addr_t *p_enet_addr); + int (*set_multi)(struct net_device *net_dev, +struct mac_device *mac_dev); + int (*uninit)(struct fm_mac_dev *fm_mac_dev); + int (*set_rx_pause)(struct fm_mac_dev *fm_mac_dev, bool en); + int
[PATCH 1/1 linux-next] net: fs_enet: use swap() in fs_enet_rx_napi()
Use kernel.h macro definition. Thanks to Julia Lawall for Coccinelle scripting support. Signed-off-by: Fabian Frederick f...@skynet.be --- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 9b3639e..c5f299d 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -86,7 +86,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) struct net_device *dev = fep-ndev; const struct fs_platform_info *fpi = fep-fpi; cbd_t __iomem *bdp; - struct sk_buff *skb, *skbn, *skbt; + struct sk_buff *skb, *skbn; int received = 0; u16 pkt_len, sc; int curidx; @@ -161,10 +161,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget) skb_reserve(skbn, 2); /* align IP header */ skb_copy_from_linear_data(skb, skbn-data, pkt_len); - /* swap */ - skbt = skb; - skb = skbn; - skbn = skbt; + swap(skb, skbn); } } else { skbn = netdev_alloc_skb(dev, ENET_RX_FRSIZE); -- 2.4.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [patch] ASoC: fsl: add an error check
On Wed, Jun 10, 2015 at 06:37:23PM +0300, Dan Carpenter wrote: My static checker complains that: sound/soc/fsl/imx-wm8962.c:196 imx_wm8962_probe() warn: we tested 'ret' before and it was 'false' The intent was that we use ret to check imx_audmux_v2_configure_port(). Fixes: 8de2ae2a7f1f ('ASoC: fsl: add imx-wm8962 machine driver') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com Could you please use an subject like: ASoC: imx-wm8962: Add a missing error check (Since it only applies to this file) Otherwise, Acked-by: Nicolin Chen nicoleots...@gmail.com Thank you indeed for the fix Nicolin --- I assume checking for an error here will not change anything but I have not tested this patch. diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index cd146d4..b38b98c 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c @@ -190,7 +190,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) dev_err(pdev-dev, audmux internal port setup failed\n); return ret; } - imx_audmux_v2_configure_port(ext_port, + ret = imx_audmux_v2_configure_port(ext_port, IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); if (ret) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 05/12] fsl/fman: Add the FMan MAC FLIB headers
From: Igal Liberman igal.liber...@freescale.com The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../net/ethernet/freescale/fman/flib/fsl_enet.h| 275 +++ .../ethernet/freescale/fman/flib/fsl_fman_dtsec.h | 791 + .../freescale/fman/flib/fsl_fman_dtsec_mii_acc.h | 103 +++ .../ethernet/freescale/fman/flib/fsl_fman_memac.h | 453 .../freescale/fman/flib/fsl_fman_memac_mii_acc.h | 76 ++ .../ethernet/freescale/fman/flib/fsl_fman_tgec.h | 409 +++ 6 files changed, 2107 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_enet.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_dtsec_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_memac_mii_acc.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman_tgec.h diff --git a/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h new file mode 100644 index 000..78e7d04 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/flib/fsl_enet.h @@ -0,0 +1,275 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __FSL_ENET_H +#define __FSL_ENET_H + +/*Ethernet MAC-PHY Interface */ + +enum enet_interface { + E_ENET_IF_MII = 0x0001, /* MII interface */ + E_ENET_IF_RMII = 0x0002, /* RMII interface */ + E_ENET_IF_SMII = 0x0003, /* SMII interface */ + E_ENET_IF_GMII = 0x0004, /* GMII interface */ + E_ENET_IF_RGMII = 0x0005, /* RGMII interface */ + E_ENET_IF_TBI = 0x0006, /* TBI interface */ + E_ENET_IF_RTBI = 0x0007, /* RTBI interface */ + E_ENET_IF_SGMII = 0x0008, /* SGMII interface */ + E_ENET_IF_XGMII = 0x0009, /* XGMII interface */ + E_ENET_IF_QSGMII = 0x000a,/* QSGMII interface */ + E_ENET_IF_XFI = 0x000b/* XFI interface */ +}; + +/* Ethernet Speed (nominal data rate) */ +enum enet_speed { + E_ENET_SPEED_10 = 10, /* 10 Mbps */ + E_ENET_SPEED_100 = 100, /* 100 Mbps */ + E_ENET_SPEED_1000 = 1000, /* 1000 Mbps = 1 Gbps */ + E_ENET_SPEED_1 = 1 /* 1 Mbps = 10 Gbps */ +}; + +enum mac_type { + E_MAC_DTSEC, + E_MAC_TGEC, + E_MAC_MEMAC +}; + +/* Enum for inter-module interrupts registration */ +enum fman_event_modules { + E_FMAN_MOD_PRS, /* Parser event */ + E_FMAN_MOD_KG,/* Keygen event */ + E_FMAN_MOD_PLCR, /* Policer event */ + E_FMAN_MOD_10G_MAC, /* 10G MAC event */ + E_FMAN_MOD_1G_MAC,/* 1G MAC event */ + E_FMAN_MOD_TMR, /* Timer event */ + E_FMAN_MOD_FMAN_CTRL, /* FMAN Controller Timer event */ +
[patch] ASoC: fsl: add an error check
My static checker complains that: sound/soc/fsl/imx-wm8962.c:196 imx_wm8962_probe() warn: we tested 'ret' before and it was 'false' The intent was that we use ret to check imx_audmux_v2_configure_port(). Fixes: 8de2ae2a7f1f ('ASoC: fsl: add imx-wm8962 machine driver') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- I assume checking for an error here will not change anything but I have not tested this patch. diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index cd146d4..b38b98c 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c @@ -190,7 +190,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) dev_err(pdev-dev, audmux internal port setup failed\n); return ret; } - imx_audmux_v2_configure_port(ext_port, + ret = imx_audmux_v2_configure_port(ext_port, IMX_AUDMUX_V2_PTCR_SYN, IMX_AUDMUX_V2_PDCR_RXDSEL(int_port)); if (ret) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 04/12] fsl/fman: Add the FMan port FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan Port FLib provides basic API used by the drivers to configure and control the FMan Port hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Kconfig| 1 + drivers/net/ethernet/freescale/fman/Makefile | 2 + drivers/net/ethernet/freescale/fman/port/Makefile | 3 + .../net/ethernet/freescale/fman/port/fman_port.c | 619 + 4 files changed, 625 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/port/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/port/fman_port.c diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig index 8aeae29..af42c3a 100644 --- a/drivers/net/ethernet/freescale/fman/Kconfig +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -5,3 +5,4 @@ config FSL_FMAN help Freescale Data-Path Acceleration Architecture Frame Manager (FMan) support + diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 2799c6f..50a4de2 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -3,3 +3,5 @@ subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib obj-y += fsl_fman.o fsl_fman-objs := fman.o + +obj-y += port/ diff --git a/drivers/net/ethernet/freescale/fman/port/Makefile b/drivers/net/ethernet/freescale/fman/port/Makefile new file mode 100644 index 000..54b1fa4 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/Makefile @@ -0,0 +1,3 @@ +obj-y += fsl_fman_port.o + +fsl_fman_port-objs := fman_port.o diff --git a/drivers/net/ethernet/freescale/fman/port/fman_port.c b/drivers/net/ethernet/freescale/fman/port/fman_port.c new file mode 100644 index 000..6754c35 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/port/fman_port.c @@ -0,0 +1,619 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include common/general.h + +#include fman_common.h +#include fsl_fman_port.h + +/* problem Eyal: the following should not be here*/ +#define NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME 0x0028 + +static uint32_t get_no_pcd_nia_bmi_ac_enc_frame(struct fman_port_cfg *cfg) +{ + if (cfg-errata_A006675) + return NIA_ENG_FM_CTL | + NIA_FM_CTL_AC_NO_IPACC_PRE_BMI_ENQ_FRAME; + else + return NIA_ENG_BMI | NIA_BMI_AC_ENQ_FRAME; +} + +static int init_bmi_rx(struct fman_port *port, + struct fman_port_cfg *cfg, + struct fman_port_params *params) +{ + struct fman_port_rx_bmi_regs __iomem *regs = port-bmi_regs-rx; + uint32_t tmp; + + /* Rx Configuration register */ + tmp = 0; + if (cfg-discard_override) + tmp |= BMI_PORT_CFG_FDOVR; + iowrite32be(tmp, regs-fmbm_rcfg); + + /* DMA attributes */ + tmp = (uint32_t)cfg-dma_swap_data BMI_DMA_ATTR_SWP_SHIFT; + if (cfg-dma_ic_stash_on) + tmp |= BMI_DMA_ATTR_IC_STASH_ON; + if
[PATCH 02/12] fsl/fman: Add the FMan FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/Kconfig | 1 + drivers/net/ethernet/freescale/Makefile | 2 + drivers/net/ethernet/freescale/fman/Kconfig | 7 + drivers/net/ethernet/freescale/fman/Makefile | 5 + drivers/net/ethernet/freescale/fman/fman.c | 973 +++ 5 files changed, 988 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/Kconfig create mode 100644 drivers/net/ethernet/freescale/fman/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/fman.c diff --git a/drivers/net/ethernet/freescale/Kconfig b/drivers/net/ethernet/freescale/Kconfig index 25e3425..24e938d 100644 --- a/drivers/net/ethernet/freescale/Kconfig +++ b/drivers/net/ethernet/freescale/Kconfig @@ -55,6 +55,7 @@ config FEC_MPC52xx_MDIO If compiled as module, it will be called fec_mpc52xx_phy. source drivers/net/ethernet/freescale/fs_enet/Kconfig +source drivers/net/ethernet/freescale/fman/Kconfig config FSL_PQ_MDIO tristate Freescale PQ MDIO diff --git a/drivers/net/ethernet/freescale/Makefile b/drivers/net/ethernet/freescale/Makefile index 71debd1..4097c58 100644 --- a/drivers/net/ethernet/freescale/Makefile +++ b/drivers/net/ethernet/freescale/Makefile @@ -17,3 +17,5 @@ gianfar_driver-objs := gianfar.o \ gianfar_ethtool.o obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o + +obj-$(CONFIG_FSL_FMAN) += fman/ diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig new file mode 100644 index 000..8aeae29 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Kconfig @@ -0,0 +1,7 @@ +config FSL_FMAN + bool FMan support + depends on FSL_SOC || COMPILE_TEST + default n + help + Freescale Data-Path Acceleration Architecture Frame Manager + (FMan) support diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile new file mode 100644 index 000..2799c6f --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -0,0 +1,5 @@ +subdir-ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/fman/flib + +obj-y += fsl_fman.o + +fsl_fman-objs := fman.o diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c new file mode 100644 index 000..410c498 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -0,0 +1,973 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include fsl_fman.h + +uint32_t fman_get_bmi_err_event(struct fman_bmi_regs __iomem *bmi_rg) +{ + uint32_t event, mask, force; + + event = ioread32be(bmi_rg-fmbm_ievr); + mask = ioread32be(bmi_rg-fmbm_ier); + event = mask; + /* clear the forced events */ + force = ioread32be(bmi_rg-fmbm_ifr); + if (force event) + iowrite32be(force ~event, bmi_rg-fmbm_ifr); + /* clear the
Re: [PATCH 00/12] Freescale DPAA FMan
On Wed, 2015-06-10 at 18:21 +0300, Madalin Bucur wrote: The Freescale Data Path Acceleration Architecture (DPAA) is a set of hardware components on specific QorIQ multicore processors. This architecture provides the infrastructure to support simplified sharing of networking interfaces and accelerators by multiple CPU cores and the accelerators. One of the DPAA accelerators is the Frame Manager (FMan) which contains a series of hardware blocks: ports, Ethernet MACs, a multi user RAM (MURAM) and Storage Profile (SP). This patch set introduced the FMan driver code that configures and initializes the FMan hardware blocks, offering support for three different types of MACs (DTSEC, TGEC, MEMAC). The first 6 patches present the FMan Foundation Libraries (FLIBs). The FMan drivers make use of the basic API the FMan FLib provides to configure and control the FMan hardware. The remaining patches present the required FMan hardware module drivers. The driver structure and a hint on file naming: FMan MAC driver |mac* files -- -- - --- FMan | Port | MAC | MURAM | SP |fm_* files -- -- - --- : : FLib : : fman_* files --- This submission is based on the prior Freescale DPAA FMan V3,RFC submission. Several issues addresses in this submission: - Reduced MAC layering and complexity - Reduced code base - T1024/T2080 10G best effort support How is this different from the patchset Igal posted 7 hours earlier? Please don't use the chained reply option in git send-email (and the patches are in the wrong order, which makes the chained reply especially bad). I don't see any mention of a dependency on the qbman patches. Where is the actual ethernet driver -- the part that sends and receives packets? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v8] powerpc/powernv: Poweroff (EPOW, DPO) events support for PowerNV platform
This patch adds support for FSP (Flexible Service Processor) EPOW (Early Power Off Warning) and DPO (Delayed Power Off) events for the PowerNV platform. EPOW events are generated by FSP due to various critical system conditions that require system shutdown. A few examples of these conditions are high ambient temperature or system running on UPS power with low UPS battery. DPO event is generated in response to admin initiated system shutdown request. Upon receipt of EPOW and DPO events the host kernel invokes orderly_poweroff() for performing graceful system shutdown. Reviewed-by: Joel Stanley j...@jms.id.au Reviewed-by: Vaibhav Jain vaib...@linux.vnet.ibm.com Reviewed-by: Michael Ellerman m...@ellerman.id.au Changes in v8: - Added logic to filter events which doesn't require system shutdown for EPOW scenario. Changes in v7: - Fixed logic to check epow support to avoid EPOW, DPO handling path for BMC systems. Changes in v6: - Made below changes as suggested by Michael Ellerman on previous patch. - Changed EPOW, DPO notifier blocks to use opal_power_control_event() and enhanced opal_power_control_event() to handle EPOW and DPO events. - Reorganized code and added/changed few variable, function names removing older ones. - Minor cleanup like removing unused headers, blank lines etc. Changes in v5: - Made changes to address review comments on previous patch. Changes in v4: - Made changes to address review comments on previous patch. Changes in v3: - Made changes to immediately call orderly_poweroff upon receipt of OPAL EPOW, DPO notifications. - Made code changes to address review comments on previous patch. - Made code changes to use existing OPAL EPOW API. - Removed patch to extract EPOW event timeout from OPAL device-tree. Changes in v2: - Made code changes to improve code as per previous review comments. - Added patch to obtain EPOW event timeout values from OPAL device-tree. Vipin K Parashar (1): powerpc/powernv: Add poweroff (EPOW, DPO) events support for PowerNV platform arch/powerpc/include/asm/opal-api.h| 40 +++ arch/powerpc/include/asm/opal.h| 3 +- arch/powerpc/platforms/powernv/opal-power.c| 147 ++--- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 4 files changed, 173 insertions(+), 18 deletions(-) -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/3] block/ps3vram: Minor updates and fixes
On 06/10/2015 12:00 PM, Geoff Levand wrote: Hi Jens, Here are a few minor updates for the ps3vram driver. The third patch adds me as co-maintainer of the driver, which I think is fitting as I have been maintaining it for the last few years and expect I would be involved in any future inquiries regarding it. Please apply, thanks. Applied to for-4.2/drivers, thanks. -- Jens Axboe ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 0/3] block/ps3vram: Minor updates and fixes
Hi Jens, Here are a few minor updates for the ps3vram driver. The third patch adds me as co-maintainer of the driver, which I think is fitting as I have been maintaining it for the last few years and expect I would be involved in any future inquiries regarding it. Please apply, thanks. -Geoff The following changes since commit d4a4f75cd8f29cd9464a5a32e9224a91571d6649: Linux 4.1-rc7 (2015-06-07 20:23:50 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-2 for you to fetch changes up to 1d082300a03a735c006739907e6aea082007663c: MAINTAINERS: Update ps3vram block driver (2015-06-10 10:46:25 -0700) Geert Uytterhoeven (1): block/ps3vram: Remove obsolete reference to MTD Geoff Levand (2): block/ps3vram: Fix sparse warnings MAINTAINERS: Update ps3vram block driver MAINTAINERS | 2 ++ drivers/block/ps3vram.c | 34 +- 2 files changed, 19 insertions(+), 17 deletions(-) -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: question on FSL_EMB perf
On Wed, 2015-06-10 at 13:41 +0200, Peter Zijlstra wrote: Hi Mike, Ben, I just noticed: arch/powerpc/Kconfig: select HAVE_PERF_EVENTS_NMI if PPC64 But can't ppc32 have FSL_EMB perf? Yes, but it doesn't use NMIs. ppc64 has lazy interrupt disabling which functions as a pseudo-NMI. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: question on FSL_EMB perf
On Wed, 2015-06-10 at 21:27 +0200, Peter Zijlstra wrote: On Wed, 2015-06-10 at 14:17 -0500, Scott Wood wrote: On Wed, 2015-06-10 at 13:41 +0200, Peter Zijlstra wrote: Hi Mike, Ben, I just noticed: arch/powerpc/Kconfig: select HAVE_PERF_EVENTS_NMI if PPC64 But can't ppc32 have FSL_EMB perf? Yes, but it doesn't use NMIs. ppc64 has lazy interrupt disabling which functions as a pseudo-NMI. I know. But you can get the same nesting nonsense as with actual real NMIs. What sort of nesting nonsense would we get on ppc32? I wasn't trying to say that the pseudo-NMIs didn't count -- I was pointing out that we don't even have that on ppc32. And seeing how you select HAVE_PERF_EVENT_NMI for PPC64, I figure you ought to select it too for whatever fsl-emb is. Why? # git grep nmi_enter arch/powerpc/ arch/powerpc/perf/core-book3s.c:nmi_enter(); arch/powerpc/perf/core-fsl-emb.c: nmi_enter(); nmi_enter() only gets called when perf_intr_is_nmi() returns non-zero, which only happens on ppc64. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: question on FSL_EMB perf
On Wed, 2015-06-10 at 14:17 -0500, Scott Wood wrote: On Wed, 2015-06-10 at 13:41 +0200, Peter Zijlstra wrote: Hi Mike, Ben, I just noticed: arch/powerpc/Kconfig: select HAVE_PERF_EVENTS_NMI if PPC64 But can't ppc32 have FSL_EMB perf? Yes, but it doesn't use NMIs. ppc64 has lazy interrupt disabling which functions as a pseudo-NMI. I know. But you can get the same nesting nonsense as with actual real NMIs. And seeing how you select HAVE_PERF_EVENT_NMI for PPC64, I figure you ought to select it too for whatever fsl-emb is. # git grep nmi_enter arch/powerpc/ arch/powerpc/perf/core-book3s.c:nmi_enter(); arch/powerpc/perf/core-fsl-emb.c: nmi_enter(); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [patch] ASoC: fsl: add an error check
Could you please use an subject like: ASoC: imx-wm8962: Add a missing error check (Since it only applies to this file) I have been meaning to say something about this. This is sort of a recurrent problem for me because I'm often the first person to touch a driver after it's added. I just copied your patch prefix from 8de2ae2a7f1f ('ASoC: fsl: add imx-wm8962 machine driver'). Really you should also have used ASoC: imx-wm8962: as well. This is the third new driver today where I have faced this situation. regards, dan carpenter ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v8] powerpc/powernv: Add poweroff (EPOW, DPO) events support for PowerNV platform
This patch adds support for FSP (Flexible Service Processor) EPOW (Early Power Off Warning) and DPO (Delayed Power Off) events for the PowerNV platform. EPOW events are generated by FSP due to various critical system conditions that require system shutdown. A few examples of these conditions are high ambient temperature or system running on UPS power with low UPS battery. DPO event is generated in response to admin initiated system shutdown request. Upon receipt of EPOW and DPO events the host kernel invokes orderly_poweroff() for performing graceful system shutdown. Reviewed-by: Joel Stanley j...@jms.id.au Reviewed-by: Vaibhav Jain vaib...@linux.vnet.ibm.com Reviewed-by: Michael Ellerman m...@ellerman.id.au Signed-off-by: Vipin K Parashar vi...@linux.vnet.ibm.com --- arch/powerpc/include/asm/opal-api.h| 40 +++ arch/powerpc/include/asm/opal.h| 3 +- arch/powerpc/platforms/powernv/opal-power.c| 147 ++--- arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 4 files changed, 173 insertions(+), 18 deletions(-) diff --git a/arch/powerpc/include/asm/opal-api.h b/arch/powerpc/include/asm/opal-api.h index 0321a90..f460435 100644 --- a/arch/powerpc/include/asm/opal-api.h +++ b/arch/powerpc/include/asm/opal-api.h @@ -730,6 +730,46 @@ struct opal_i2c_request { __be64 buffer_ra; /* Buffer real address */ }; +/* + * EPOW status sharing (OPAL and the host) + * + * The host will pass on OPAL, a buffer of length OPAL_SYSEPOW_MAX + * with individual elements being 16 bits wide to fetch the system + * wide EPOW status. Each element in the buffer will contain the + * EPOW status in it's bit representation for a particular EPOW sub + * class as defiend here. So multiple detailed EPOW status bits + * specific for any sub class can be represented in a single buffer + * element as it's bit representation. + */ + +/* System EPOW type */ +enum OpalSysEpow { + OPAL_SYSEPOW_POWER = 0,/* Power EPOW */ + OPAL_SYSEPOW_TEMP = 1,/* Temperature EPOW */ + OPAL_SYSEPOW_COOLING= 2,/* Cooling EPOW */ + OPAL_SYSEPOW_MAX= 3,/* Max EPOW categories */ +}; + +/* Power EPOW */ +enum OpalSysPower { + OPAL_SYSPOWER_UPS = 0x0001, /* System on UPS power */ + OPAL_SYSPOWER_CHNG = 0x0002, /* System power config change */ + OPAL_SYSPOWER_FAIL = 0x0004, /* System impending power failure */ + OPAL_SYSPOWER_INCL = 0x0008, /* System incomplete power */ +}; + +/* Temperature EPOW */ +enum OpalSysTemp { + OPAL_SYSTEMP_AMB= 0x0001, /* System over ambient temperature */ + OPAL_SYSTEMP_INT= 0x0002, /* System over internal temperature */ + OPAL_SYSTEMP_HMD= 0x0004, /* System over ambient humidity */ +}; + +/* Cooling EPOW */ +enum OpalSysCooling { + OPAL_SYSCOOL_INSF = 0x0001, /* System insufficient cooling */ +}; + #endif /* __ASSEMBLY__ */ #endif /* __OPAL_API_H */ diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 042af1a..8b174f3 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -141,7 +141,8 @@ int64_t opal_pci_fence_phb(uint64_t phb_id); int64_t opal_pci_reinit(uint64_t phb_id, uint64_t reinit_scope, uint64_t data); int64_t opal_pci_mask_pe_error(uint64_t phb_id, uint16_t pe_number, uint8_t error_type, uint8_t mask_action); int64_t opal_set_slot_led_status(uint64_t phb_id, uint64_t slot_id, uint8_t led_type, uint8_t led_action); -int64_t opal_get_epow_status(__be64 *status); +int64_t opal_get_epow_status(__be16 *epow_status, __be16 *num_epow_classes); +int64_t opal_get_dpo_status(__be64 *dpo_timeout); int64_t opal_set_system_attention_led(uint8_t led_action); int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe, __be16 *pci_error_type, __be16 *severity); diff --git a/arch/powerpc/platforms/powernv/opal-power.c b/arch/powerpc/platforms/powernv/opal-power.c index ac46c2c..58dc330 100644 --- a/arch/powerpc/platforms/powernv/opal-power.c +++ b/arch/powerpc/platforms/powernv/opal-power.c @@ -9,9 +9,12 @@ * 2 of the License, or (at your option) any later version. */ +#define pr_fmt(fmt)opal-power: fmt + #include linux/kernel.h #include linux/reboot.h #include linux/notifier.h +#include linux/of.h #include asm/opal.h #include asm/machdep.h @@ -19,30 +22,116 @@ #define SOFT_OFF 0x00 #define SOFT_REBOOT 0x01 +/* Detect EPOW event */ +static bool detect_epow(void) +{ + u16 epow; + int i, rc; + __be16 epow_classes; + __be16 opal_epow_status[OPAL_SYSEPOW_MAX] = {0}; + + /* + * Check for EPOW event. Kernel sends supported EPOW classes info + * to OPAL. OPAL returns EPOW info along with classes present. + */ + epow_classes = cpu_to_be16(OPAL_SYSEPOW_MAX); + rc = opal_get_epow_status(opal_epow_status, epow_classes); +
Re: [RFC,v3 02/10] dpaa_eth: add support for DPAA Ethernet
On Wed, 2015-04-29 at 17:56 +0300, Madalin Bucur wrote: This introduces the Freescale Data Path Acceleration Architecture (DPAA) Ethernet driver (dpaa_eth) that builds upon the DPAA QMan, BMan, PAMU and FMan drivers to deliver Ethernet connectivity on the Freescale DPAA QorIQ platforms. ... + /* We're going to store the skb backpointer at the beginning + * of the data buffer, so we need a privately owned skb + */ + + /* Code borrowed from skb_unshare(). */ + if (skb_cloned(skb)) { + struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); + + /* Finally, create a contig FD from this skb */ + skb_to_contig_fd(priv, skb, fd, countptr, offset); + + kfree_skb(skb); + skb = nskb; + /* skb_copy() has now linearized the skbuff. */ + } + You know that TCP packets are clones, right ? This code is killing performance. TCP allows the headers part being modified by a driver if needed. You should use skb_header_cloned() instead. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [alsa-devel][PATCH] ASoC: fsl: add imx-wm8960 machine driver
On Wed, Jun 10, 2015 at 04:26:27PM +0800, Zidan Wang wrote: + - hp-det : ADCLRC/GPIO1, LINPUT3/JD2 and RINPUT3/JD3 pins can + be selected as headphone jack detect inputs to + automatically disable the speaker output and enable + the headphone output. + hp-det = hp-det-pin hp-det-polarity; + hp-det-pin = 1: ADCLRC/GPIO1 used as detect pin + hp-det-pin = 2: LINPUT3/JD2 used as detect pin + hp-det-pin = 3: RINPUT3/JD3 used as detect pin + hp-det-polarity = 0: hp detect high for headphone + hp-det-polarity = 1: hp detect high for speaker This looks like something that should be in the DT binding for the CODEC, not the machine driver. +static int hp_set_status_check(void *data) +{ Why is this in the driver? + hp_status = gpio_get_value(priv-hp_set_gpio) ? 1 : 0; gpio_get_value() already returns a boolean. + if (hp_status != priv-hp_active_low) { + snprintf(buf, 32, STATE=%d, 2); + snd_soc_dapm_disable_pin(priv-codec-dapm, Ext Spk); + snd_soc_dapm_disable_pin(priv-codec-dapm, Main MIC); + ret = imx_hp_set_gpio.report; The generic jack code already has support for disabling and enabling pins, though disabling the speaker looks like a policy decision which probably doesn't belong here. + /* + * As the hp MIC only connect the input for left channel, we + * need to route it for right channel. + */ + snd_soc_update_bits(priv-codec, WM8960_ADDCTL1, 32, 12); This looks like routing which we'd expect userspace to be doing. + snd_kctl_jack_report(priv-snd_card, priv-headset_kctl, 1); Use the ASoC level helpers. + envp[0] = NAME=headset; + envp[1] = buf; + envp[2] = NULL; + kobject_uevent_env(pdev-dev.kobj, KOBJ_CHANGE, envp); + kfree(buf); Let the core deal with notifying userspace - it looks like you want to implement extcon integration there. + /* set cpu DAI configuration */ + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret) { + dev_err(dev, failed to set cpu dai fmt: %d\n, ret); + return ret; + } + /* set codec DAI configuration */ + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret) { + dev_err(dev, failed to set codec dai fmt: %d\n, ret); + return ret; + } Initialise these in the dai_link structure. + for (i = 0; i ARRAY_SIZE(sysclk_divs); ++i) { + if (sysclk_divs[i] == -1) + continue; + sysclk /= sysclk_divs[i]; + for (j = 0; j ARRAY_SIZE(dac_divs); ++j) { + if (sysclk == sample_rate * dac_divs[j]) { + for (k = 0; k ARRAY_SIZE(bclk_divs); ++k) + if (sysclk == bclk * bclk_divs[k] / 10) + break; + if (k != ARRAY_SIZE(bclk_divs)) + break; + } + } + if (j != ARRAY_SIZE(dac_divs)) + break; + } + if (i != ARRAY_SIZE(sysclk_divs)) { + /* Set codec sysclk */ + snd_soc_dai_set_sysclk(codec_dai, +WM8960_SYSCLK_MCLK, sysclk, 0); + snd_soc_dai_set_clkdiv(codec_dai, WM8960_SYSCLKDIV, i 1); + return 0; + } Better, upgrade the CODEC driver to do this. + /* codec mclk should be enabled early to avoid jack detect error */ + ret = clk_prepare_enable(data-codec_clk); + if (ret) { + dev_err(card-dev, Failed to enable MCLK: %d\n, ret); + return ret; + } Similarly integrating clock API support into the CODEC is better - it makes all the DT stuff work a lot more smoothly and avoids things having to get duplicated. signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [alsa-devel][PATCH] ASoC: fsl: add imx-wm8960 machine driver
On Wed, Jun 10, 2015 at 04:26:27PM +0800, Zidan Wang wrote: This imx-wm8960 device-tree-only machine driver works with sai driver and have below feature. * support codec master and slave mode * support headphone jack detect * support headphone and micphone jack event * support asrc-sai-wm8960 mode Signed-off-by: Zidan Wang zidan.w...@freescale.com Above all, could you merge this into fsl-asoc-card? It'd be nicer to have jack detection over there. And we can put PLL settings to the codec driver as Mark suggested. Thanks Nicolin --- .../devicetree/bindings/sound/imx-audio-wm8960.txt | 68 ++ sound/soc/fsl/Kconfig | 13 + sound/soc/fsl/Makefile | 2 + sound/soc/fsl/imx-wm8960.c | 711 + 4 files changed, 794 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt create mode 100644 sound/soc/fsl/imx-wm8960.c diff --git a/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt b/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt new file mode 100644 index 000..300d027 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/imx-audio-wm8960.txt @@ -0,0 +1,68 @@ +Freescale i.MX audio complex with WM8960 codec + +Required properties: + + - compatible : fsl,imx-audio-wm8960 + + - model: The user-visible name of this sound complex + + - audio-codec : The phandle of the WM8960 audio codec + + - hp-det : ADCLRC/GPIO1, LINPUT3/JD2 and RINPUT3/JD3 pins can + be selected as headphone jack detect inputs to + automatically disable the speaker output and enable + the headphone output. + hp-det = hp-det-pin hp-det-polarity; + hp-det-pin = 1: ADCLRC/GPIO1 used as detect pin + hp-det-pin = 2: LINPUT3/JD2 used as detect pin + hp-det-pin = 3: RINPUT3/JD3 used as detect pin + hp-det-polarity = 0: hp detect high for headphone + hp-det-polarity = 1: hp detect high for speaker + + - codec-master : If codec-master present, codec works as master. + Otherwise, codec works as slave. + + - audio-routing: A list of the connections between audio components. + Each entry is a pair of strings, the first being the + connection's sink, the second being the connection's + source. Valid names could be power supplies, WM8962 + pins, and the jacks on the board: + + Power supplies: +* MICB + + Board connectors: +* Hp MIC +* Main MIC +* Headset Jack +* Ext Spk + +Example: + +sound { + compatible = fsl,imx6ul-evk-wm8960, +fsl,imx-audio-wm8960; + model = wm8960-audio; + cpu-dai = sai2; + audio-codec = codec; + asrc-controller = asrc; + codec-master; + hp-det = 3 0; + audio-routing = + Headset Jack, HP_L, + Headset Jack, HP_R, + Ext Spk, SPK_LP, + Ext Spk, SPK_LN, + Ext Spk, SPK_RP, + Ext Spk, SPK_RN, + LINPUT2, Hp MIC, + LINPUT3, Hp MIC, + RINPUT1, Main MIC, + RINPUT2, Main MIC, + Hp MIC, MICB, + Main MIC, MICB, + CPU-Playback, ASRC-Playback, + Playback, CPU-Playback, + ASRC-Capture, CPU-Capture, + CPU-Capture, Capture; +}; diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 19c302b..0d9aa56 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig @@ -229,6 +229,19 @@ config SND_SOC_EUKREA_TLV320 Enable I2S based access to the TLV320AIC23B codec attached to the SSI interface +config SND_SOC_IMX_WM8960 + tristate SoC Audio support for i.MX boards with wm8960 + depends on OF I2C + select SND_SOC_WM8960 + select SND_SOC_IMX_PCM_DMA + select SND_SOC_FSL_SAI + select SND_SOC_FSL_UTILS + select SND_KCTL_JACK + help + SoC Audio support for i.MX boards with WM8960 + Say Y if you want to add support for SoC audio on an i.MX board with + a wm8960 codec. + config SND_SOC_IMX_WM8962 tristate SoC Audio support for i.MX boards with wm8962 depends on OF I2C INPUT diff --git a/sound/soc/fsl/Makefile
[PATCH 2/3] block/ps3vram: Remove obsolete reference to MTD
The ps3vram driver is a plain block device driver since commit f507cd22035fdadd5dbb476dd05e9e7ee21c3b84 (ps3/block: Replace mtd/ps3vram by block/ps3vram). Signed-off-by: Geert Uytterhoeven ge...@linux-m68k.org Signed-off-by: Geoff Levand ge...@infradead.org --- drivers/block/ps3vram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index a7bf836..b1612eb 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -1,5 +1,5 @@ /* - * ps3vram - Use extra PS3 video ram as MTD block device. + * ps3vram - Use extra PS3 video ram as block device. * * Copyright 2009 Sony Corporation * -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2] QorIQ/TMU: add TMU node to device tree for QorIQ T104x
On Wed, 2015-06-10 at 03:56 -0500, Jia Hongtao-B38951 wrote: -Original Message- From: Wood Scott-B07421 Sent: Wednesday, June 10, 2015 1:47 AM To: Jia Hongtao-B38951 Cc: edubez...@gmail.com; linuxppc-dev@lists.ozlabs.org; devicet...@vger.kernel.org; robh...@kernel.org; rui.zh...@intel.com Subject: Re: [PATCH V2] QorIQ/TMU: add TMU node to device tree for QorIQ T104x On Mon, 2015-06-08 at 21:19 -0500, Jia Hongtao-B38951 wrote: -Original Message- From: Wood Scott-B07421 Sent: Wednesday, May 27, 2015 3:38 AM To: Jia Hongtao-B38951 Cc: edubez...@gmail.com; linuxppc-dev@lists.ozlabs.org; devicet...@vger.kernel.org; robh...@kernel.org; rui.zh...@intel.com Subject: Re: [PATCH V2] QorIQ/TMU: add TMU node to device tree for QorIQ T104x On Tue, 2015-05-26 at 01:33 -0500, Jia Hongtao-B38951 wrote: diff --git a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi index 15ae462..bb9f792 100644 --- a/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi +++ b/arch/powerpc/boot/dts/fsl/t1040si-post.dtsi @@ -345,6 +345,7 @@ reg= 0xea000 0x4000; }; +/include/ qoriq-tmu-t104xsi.dtsi /include/ elo3-dma-0.dtsi /include/ elo3-dma-1.dtsi /include/ qoriq-espi-0.dtsi Why is this chip-specific enough to be called t104xsi, but not chip- specific enough to just go directly into t1040si-post? The tmu node includes lots of contents. Is it looks messy if just go directly into t1040si-post? I don't think it's too much to go into the main file. Having too many files is a hassle as well... -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 01/12] fsl/fman: Add the FMan FLIB headers
On Wed, 2015-06-10 at 18:21 +0300, Madalin Bucur wrote: From: Igal Liberman igal.liber...@freescale.com This patch presents the FMan Foundation Libraries (FLIB) headers. The FMan FLib provides the basic API used by the FMan drivers to configure and control the FMan hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- .../ethernet/freescale/fman/flib/common/general.h | 41 ++ .../net/ethernet/freescale/fman/flib/fsl_fman.h| 609 + 2 files changed, 650 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/flib/common/general.h create mode 100644 drivers/net/ethernet/freescale/fman/flib/fsl_fman.h Why do we need separate patches just for headers? What does common refer to? What does the flib directory mean, in the context of Linux? If someone were to add code to this driver, how do they know if the code should go into the flib directory or not? +#define iowrite32be(val, addr) out_be32((*addr), val) +#define ioread32be(addr) in_be32((*addr)) iowrite32be()/ioread32be() are already defined for all relevant architectures. Why are you redefining them into something PPC- specific? +/* do not change! if changed, must be disabled for rev1 ! */ +#define DEFAULT_HALT_ON_EXTERNAL_ACTIVATION false +/* do not change! if changed, must be disabled for rev1 ! */ +#define DEFAULT_HALT_ON_UNRECOVERABLE_ECC_ERROR false rev1 of what chip? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [patch] ASoC: fsl: add an error check
On Wed, Jun 10, 2015 at 06:37:23PM +0300, Dan Carpenter wrote: My static checker complains that: sound/soc/fsl/imx-wm8962.c:196 imx_wm8962_probe() warn: we tested 'ret' before and it was 'false' Applied, thanks. signature.asc Description: Digital signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v7 1/2] arm64: dts: Add the arasan mmc nodes in apm-storm.dtsi
Hi Arnd and all On Mon, May 18, 2015 at 12:34 PM, Suman Tripathi stripa...@apm.com wrote: Hi Arnd, On Wed, May 13, 2015 at 5:21 PM, Suman Tripathi stripa...@apm.com wrote: This patch adds the arasan mmc nodes to reuse the of-arasan driver for APM X-Gene SoC. Signed-off-by: Suman Tripathi stripa...@apm.com --- --- arch/arm64/boot/dts/apm/apm-mustang.dts | 4 +++ arch/arm64/boot/dts/apm/apm-storm.dtsi | 43 + 2 files changed, 47 insertions(+) diff --git a/arch/arm64/boot/dts/apm/apm-mustang.dts b/arch/arm64/boot/dts/apm/apm-mustang.dts index 83578e7..7a3ea72 100644 --- a/arch/arm64/boot/dts/apm/apm-mustang.dts +++ b/arch/arm64/boot/dts/apm/apm-mustang.dts @@ -52,3 +52,7 @@ xgenet { status = ok; }; + +mmc0 { + status = ok; +}; diff --git a/arch/arm64/boot/dts/apm/apm-storm.dtsi b/arch/arm64/boot/dts/apm/apm-storm.dtsi index c8d3e0e..8e03ecd 100644 --- a/arch/arm64/boot/dts/apm/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm/apm-storm.dtsi @@ -145,6 +145,40 @@ clock-output-names = socplldiv2; }; + ahbclk: ahbclk@1f2ac000 { + compatible = apm,xgene-device-clock; + #clock-cells = 1; + clocks = socplldiv2 0; + reg = 0x0 0x1f2ac000 0x0 0x1000 + 0x0 0x1700 0x0 0x2000; + reg-names = csr-reg, div-reg; + csr-offset = 0x0; + csr-mask = 0x1; + enable-offset = 0x8; + enable-mask = 0x1; + divider-offset = 0x164; + divider-width = 0x5; + divider-shift = 0x0; + clock-output-names = ahbclk; + }; + + sdioclk: sdioclk@1f2ac000 { + compatible = apm,xgene-device-clock; + #clock-cells = 1; + clocks = socplldiv2 0; + reg = 0x0 0x1f2ac000 0x0 0x1000 + 0x0 0x1700 0x0 0x2000; + reg-names = csr-reg, div-reg; + csr-offset = 0x0; + csr-mask = 0x2; + enable-offset = 0x8; + enable-mask = 0x2; + divider-offset = 0x178; + divider-width = 0x8; + divider-shift = 0x0; + clock-output-names = sdioclk; + }; + qmlclk: qmlclk { compatible = apm,xgene-device-clock; #clock-cells = 1; @@ -533,6 +567,15 @@ interrupts = 0x0 0x4f 0x4; }; + mmc0: mmc@1c00 { + compatible = arasan,sdhci-4.9a; + reg = 0x0 0x1c00 0x0 0x100; + interrupts = 0x0 0x49 0x4; + dma-coherent; + clock-names = clk_xin, clk_ahb; + clocks = sdioclk 0, ahbclk 0; + }; + phy1: phy@1f21a000 { compatible = apm,xgene-phy; reg = 0x0 0x1f21a000 0x0 0x100; -- 1.8.2.1 Can you review this ? Sorry to bother on this again . Can you review it ? -- Thanks, with regards, Suman Tripathi -- Thanks, with regards, Suman Tripathi ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/3] block/ps3vram: Fix sparse warnings
Fix sparse warnings like these: drivers/block/ps3vram.c: warning: incorrect type in assignment (different address spaces) drivers/block/ps3vram.c:expected unsigned int [usertype] *ctrl drivers/block/ps3vram.c:got void [noderef] asn:2* Cc: Jim Paris j...@jtan.com Cc: Jens Axboe ax...@kernel.dk Signed-off-by: Geoff Levand ge...@infradead.org --- drivers/block/ps3vram.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c index ef45cfb..a7bf836 100644 --- a/drivers/block/ps3vram.c +++ b/drivers/block/ps3vram.c @@ -73,8 +73,8 @@ struct ps3vram_priv { u64 memory_handle; u64 context_handle; - u32 *ctrl; - void *reports; + u32 __iomem *ctrl; + void __iomem *reports; u8 *xdr_buf; u32 *fifo_base; @@ -104,7 +104,7 @@ static char *size = 256M; module_param(size, charp, 0); MODULE_PARM_DESC(size, memory size); -static u32 *ps3vram_get_notifier(void *reports, int notifier) +static u32 __iomem *ps3vram_get_notifier(void __iomem *reports, int notifier) { return reports + DMA_NOTIFIER_OFFSET_BASE + DMA_NOTIFIER_SIZE * notifier; @@ -113,22 +113,22 @@ static u32 *ps3vram_get_notifier(void *reports, int notifier) static void ps3vram_notifier_reset(struct ps3_system_bus_device *dev) { struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); - u32 *notify = ps3vram_get_notifier(priv-reports, NOTIFIER); + u32 __iomem *notify = ps3vram_get_notifier(priv-reports, NOTIFIER); int i; for (i = 0; i 4; i++) - notify[i] = 0x; + iowrite32be(0x, notify + i); } static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev, unsigned int timeout_ms) { struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); - u32 *notify = ps3vram_get_notifier(priv-reports, NOTIFIER); + u32 __iomem *notify = ps3vram_get_notifier(priv-reports, NOTIFIER); unsigned long timeout; for (timeout = 20; timeout; timeout--) { - if (!notify[3]) + if (!ioread32be(notify + 3)) return 0; udelay(10); } @@ -136,7 +136,7 @@ static int ps3vram_notifier_wait(struct ps3_system_bus_device *dev, timeout = jiffies + msecs_to_jiffies(timeout_ms); do { - if (!notify[3]) + if (!ioread32be(notify + 3)) return 0; msleep(1); } while (time_before(jiffies, timeout)); @@ -148,8 +148,8 @@ static void ps3vram_init_ring(struct ps3_system_bus_device *dev) { struct ps3vram_priv *priv = ps3_system_bus_get_drvdata(dev); - priv-ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; - priv-ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET; + iowrite32be(FIFO_BASE + FIFO_OFFSET, priv-ctrl + CTRL_PUT); + iowrite32be(FIFO_BASE + FIFO_OFFSET, priv-ctrl + CTRL_GET); } static int ps3vram_wait_ring(struct ps3_system_bus_device *dev, @@ -159,14 +159,14 @@ static int ps3vram_wait_ring(struct ps3_system_bus_device *dev, unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms); do { - if (priv-ctrl[CTRL_PUT] == priv-ctrl[CTRL_GET]) + if (ioread32be(priv-ctrl + CTRL_PUT) == ioread32be(priv-ctrl + CTRL_GET)) return 0; msleep(1); } while (time_before(jiffies, timeout)); dev_warn(dev-core, FIFO timeout (%08x/%08x/%08x)\n, -priv-ctrl[CTRL_PUT], priv-ctrl[CTRL_GET], -priv-ctrl[CTRL_TOP]); +ioread32be(priv-ctrl + CTRL_PUT), ioread32be(priv-ctrl + CTRL_GET), +ioread32be(priv-ctrl + CTRL_TOP)); return -ETIMEDOUT; } @@ -189,7 +189,7 @@ static void ps3vram_rewind_ring(struct ps3_system_bus_device *dev) ps3vram_out_ring(priv, 0x2000 | (FIFO_BASE + FIFO_OFFSET)); - priv-ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET; + iowrite32be(FIFO_BASE + FIFO_OFFSET, priv-ctrl + CTRL_PUT); /* asking the HV for a blit will kick the FIFO */ status = lv1_gpu_fb_blit(priv-context_handle, 0, 0, 0, 0); @@ -207,8 +207,8 @@ static void ps3vram_fire_ring(struct ps3_system_bus_device *dev) mutex_lock(ps3_gpu_mutex); - priv-ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET + - (priv-fifo_ptr - priv-fifo_base) * sizeof(u32); + iowrite32be(FIFO_BASE + FIFO_OFFSET + (priv-fifo_ptr - priv-fifo_base) + * sizeof(u32), priv-ctrl + CTRL_PUT); /* asking the HV for a blit will kick the FIFO */ status = lv1_gpu_fb_blit(priv-context_handle, 0, 0, 0, 0); -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org
Re: [PATCH RESEND v7 2/2] mmc: host: sdhci: Add support to disable SDR104/SDR50/DDR50 based on capability register 0.
Hi Ulf, Dong On Mon, Jun 8, 2015 at 2:08 PM, Ulf Hansson ulf.hans...@linaro.org wrote: On 8 June 2015 at 10:37, Ulf Hansson ulf.hans...@linaro.org wrote: [...] Can you test this patch on imx SoC ? (Your email have some format issue.) Yeah missed to sent in plain text mode. I have tested this patch and it does not break imx SoC. You can add my tag. Tested-by: Dong Aisheng aisheng.d...@freescale.com Thanks Dong !! However, it looks to me SDHCI_CAN_VDD_180 is only indicating the host VDD capabiliies, not IO voltage capability. I think Dong is correct. I don't think SDHCI_CAN_VDD_180 is not /s /is not /is related to UHS modes at all. At least the name of the field (SDHCI_CAN_VDD_180) indicates it's about VDD/VCC, the core power and not the IO voltage. Are you sure on this ?? If SDHCI host VDD is 1.8V then the cards are also capable to operate at 1.8V ? Didn't understand what you mean by IO voltage capability SD3.0 cards require 1.8v IO voltage support. So should this bit affect SD3.0 support? The preset value resgister says that SDR modes requires 1.8V and we disable the modes based on capability or quirk. It requires 1.8V *IO voltage*, not VDD/VCC. I agree on this now . I will post a version where this quirk will be added for arasan 4.9a that doesn't support 1.8v voltage signalling. [...] Kind regards Uffe -- Thanks, with regards, Suman Tripathi ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] net/ps3_gelic: Fix build error with DEBUG
When the DEBUG preprocessor macro is defined the ps3_gelic_net driver build fails due to an undeclared routine gelic_descr_get_status(). This problem was introduced during the code cleanup of commit 6b0c21cede22be1f68f0a632c0ca38008ce1abe7 (net: Fix p3_gelic_net sparse warnings), which re-arranged the ordering of some of the gelic routines. This change just moves the gelic_descr_get_status() routine up in the ps3_gelic_net.c source file. There is no functional change. Fixes build errors like these: drivers/net/ethernet/toshiba/ps3_gelic_net.c: error: implicit declaration of function gelic_descr_get_status Signed-off-by: Geoff Levand ge...@infradead.org --- Dave, please apply. -Geoff The following changes since commit d4a4f75cd8f29cd9464a5a32e9224a91571d6649: Linux 4.1-rc7 (2015-06-07 20:23:50 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-1 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c index ac62a5e..79f0ec4 100644 --- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c +++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c @@ -102,6 +102,18 @@ static void gelic_card_get_ether_port_status(struct gelic_card *card, } } +/** + * gelic_descr_get_status -- returns the status of a descriptor + * @descr: descriptor to look at + * + * returns the status as in the dmac_cmd_status field of the descriptor + */ +static enum gelic_descr_dma_status +gelic_descr_get_status(struct gelic_descr *descr) +{ + return be32_to_cpu(descr-dmac_cmd_status) GELIC_DESCR_DMA_STAT_MASK; +} + static int gelic_card_set_link_mode(struct gelic_card *card, int mode) { int status; @@ -278,18 +290,6 @@ void gelic_card_down(struct gelic_card *card) } /** - * gelic_descr_get_status -- returns the status of a descriptor - * @descr: descriptor to look at - * - * returns the status as in the dmac_cmd_status field of the descriptor - */ -static enum gelic_descr_dma_status -gelic_descr_get_status(struct gelic_descr *descr) -{ - return be32_to_cpu(descr-dmac_cmd_status) GELIC_DESCR_DMA_STAT_MASK; -} - -/** * gelic_card_free_chain - free descriptor chain * @card: card structure * @descr_in: address of desc -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 3/3] MAINTAINERS: Update ps3vram block driver
Add myself as co-maintainer of the ps3vram block driver, and add linuxppc-dev as a relevant mailing list. I have been acting as maintainer of this driver for the last several years, and if there is some inquiry regarding it I would like to be notified. Signed-off-by: Geoff Levand ge...@infradead.org --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index d8afd29..921809b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7882,6 +7882,8 @@ F:sound/ppc/snd_ps3* PS3VRAM DRIVER M: Jim Paris j...@jtan.com +M: Geoff Levand ge...@infradead.org +L: linuxppc-dev@lists.ozlabs.org L: cbe-oss-...@lists.ozlabs.org S: Maintained F: drivers/block/ps3vram.c -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [BUG] mpc8323_rdb platform doesn't boot since kernel 3.16
On Wed, Jun 10, 2015 at 10:12 AM, leroy christophe christophe.le...@c-s.fr wrote: Le 06/06/2015 17:32, Rob Herring a écrit : On Sat, Jun 6, 2015 at 6:20 AM, christophe leroy christophe.le...@c-s.fr wrote: I've got a MPC8323 RDB evaluation platform from freescale kernel 4.0 doesn't boot kernel 3.16 doesn't boot kernel 3.15 boots ok I disected the issue down to your commit of/fdt: Convert FDT functions to use libfdt (e6a6928c3ea1d0195ed75a091e345696b916c09b) Do you have an idea of what the issue could be ? Is your dtb older version of the dtb format (before 0x10)? libfdt doesn't work on the older versions. Yes, dtb has version 0x11, which seems to be the issue (see below) In that your bootloader doesn't understand 0x11. If not, do you have logs with debug enabled in drivers/of/fdt.c? I get unflatten: error -11 processing FDT Can I get the full debug prints. Indeed, Uboot (version 1.1.6 - installed on that evaluation board) adds a node called chosen at the end of the BLOB. But Uboot doesn't update the FDT len in the BLOB header, therefore the following test fails in fdt_offset_ptr() if (fdt_version(fdt) = 0x11) if (((offset + len) offset) || ((offset + len) fdt_size_dt_struct(fdt))) return NULL; If I comment this test out, Linux 3.16 to 4.0 work properly on my evaluation board. Can we find a proper workaround for this issue ? The options are: - update the ancient bootloader - make dtc build 0x10 version dtb for this platform (-V option will do this) - make the kernel fix the field (I'm not sure how we get the correct length. dt_string offset minus dt_struct offset?) - make the kernel force the version to 0x10 (I don't think there are any other changes from 0x10 to 0x11.) I'd probably lean toward the 2nd option. This is what the bootloader is compatible with and won't break if we rev the format again. I believe there is already some plumbing to pass per platform options to dtc. The question is what other platforms have this problem. Rob Christophe ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v8] powerpc/powernv: Poweroff (EPOW, DPO) events support for PowerNV platform
Vipin K Parashar vi...@linux.vnet.ibm.com writes: This patch adds support for FSP (Flexible Service Processor) EPOW (Early Power Off Warning) and DPO (Delayed Power Off) events for Not restricted to FSP systems, it's a generic OPAL API that any platform could implement. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: question on FSL_EMB perf
On Wed, 2015-06-10 at 15:13 -0500, Scott Wood wrote: What sort of nesting nonsense would we get on ppc32? I wasn't trying to say that the pseudo-NMIs didn't count -- I was pointing out that we don't even have that on ppc32. Oh, I was not aware ppc32 did not have that. # git grep nmi_enter arch/powerpc/ arch/powerpc/perf/core-book3s.c:nmi_enter(); arch/powerpc/perf/core-fsl-emb.c: nmi_enter(); nmi_enter() only gets called when perf_intr_is_nmi() returns non-zero, which only happens on ppc64. ok, so fsl-emb is ppc32 and ppc64, not confusing at all this stuff. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: question on FSL_EMB perf
On Wed, 2015-06-10 at 23:14 +0200, Peter Zijlstra wrote: On Wed, 2015-06-10 at 15:13 -0500, Scott Wood wrote: What sort of nesting nonsense would we get on ppc32? I wasn't trying to say that the pseudo-NMIs didn't count -- I was pointing out that we don't even have that on ppc32. Oh, I was not aware ppc32 did not have that. # git grep nmi_enter arch/powerpc/ arch/powerpc/perf/core-book3s.c:nmi_enter(); arch/powerpc/perf/core-fsl-emb.c: nmi_enter(); nmi_enter() only gets called when perf_intr_is_nmi() returns non- zero, which only happens on ppc64. ok, so fsl-emb is ppc32 and ppc64, not confusing at all this stuff. Both drivers can be used on either 32 or 64 bits. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [RESEND PATCH V2 0/3] Allow user to request memory to be locked on page fault
On Wed, 10 Jun 2015 09:26:47 -0400 Eric B Munson emun...@akamai.com wrote: mlock() allows a user to control page out of program memory, but this comes at the cost of faulting in the entire mapping when it is s/mapping/locked area/ allocated. For large mappings where the entire area is not necessary this is not ideal. This series introduces new flags for mmap() and mlockall() that allow a user to specify that the covered are should not be paged out, but only after the memory has been used the first time. The comparison with MCL_FUTURE is hiding over in the 2/3 changelog. It's important so let's copy it here. : MCL_ONFAULT is preferrable to MCL_FUTURE for the use cases enumerated : in the previous patch becuase MCL_FUTURE will behave as if each mapping : was made with MAP_LOCKED, causing the entire mapping to be faulted in : when new space is allocated or mapped. MCL_ONFAULT allows the user to : delay the fault in cost of any given page until it is actually needed, : but then guarantees that that page will always be resident. I *think* it all looks OK. I'd like someone else to go over it also if poss. I guess the 2/3 changelog should have something like : munlockall() will clear MCL_ONFAULT on all vma's in the process's VM. It's pretty obvious, but the manpage delta should make this clear also. Also the changelog(s) and manpage delta should explain that munlock() clears MCL_ONFAULT. And now I'm wondering what happens if userspace does mmap(MAP_LOCKONFAULT) and later does munlock() on just part of that region. Does the vma get split? Is this tested? Should also be in the changelogs and manpage. Ditto mlockall(MCL_ONFAULT) followed by munlock(). I'm not sure that even makes sense but the behaviour should be understood and tested. What's missing here is a syscall to set VM_LOCKONFAULT on an arbitrary range of memory - mlock() for lock-on-fault. It's a shame that mlock() didn't take a `mode' argument. Perhaps we should add such a syscall - that would make the mmap flag unneeded but I suppose it should be kept for symmetry. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 0/3] block/ps3vram: Minor updates and fixes
Geoff Levand wrote: Hi Jens, Here are a few minor updates for the ps3vram driver. The third patch adds me as co-maintainer of the driver, which I think is fitting as I have been maintaining it for the last few years and expect I would be involved in any future inquiries regarding it. Thanks Geoff. Acked-by: Jim Paris j...@jtan.com Jim Please apply, thanks. -Geoff The following changes since commit d4a4f75cd8f29cd9464a5a32e9224a91571d6649: Linux 4.1-rc7 (2015-06-07 20:23:50 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-2 for you to fetch changes up to 1d082300a03a735c006739907e6aea082007663c: MAINTAINERS: Update ps3vram block driver (2015-06-10 10:46:25 -0700) Geert Uytterhoeven (1): block/ps3vram: Remove obsolete reference to MTD Geoff Levand (2): block/ps3vram: Fix sparse warnings MAINTAINERS: Update ps3vram block driver MAINTAINERS | 2 ++ drivers/block/ps3vram.c | 34 +- 2 files changed, 19 insertions(+), 17 deletions(-) -- 2.1.0 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V8 09/10] powerpc, perf: Enable privilege mode SW branch filters
if (sw_filter PERF_SAMPLE_BRANCH_PLM_ALL) { + flag = false; Would it be possible to use a more meaningful name than flag? Perhaps indicating what is it flagging? + + if (sw_filter PERF_SAMPLE_BRANCH_USER) { + if (to_plm == POWER_ADDR_USER) + flag = true; + } + + if (sw_filter PERF_SAMPLE_BRANCH_KERNEL) { + if (to_plm == POWER_ADDR_KERNEL) + flag = true; + } + + if (sw_filter PERF_SAMPLE_BRANCH_HV) { + if (cpu_has_feature(CPU_FTR_HVMODE)) { + if (to_plm == POWER_ADDR_KERNEL) + flag = true; + } + } Is there any reason these are nested ifs rather than s? + + if (!flag) + return false; + } + @@ -700,7 +710,6 @@ static u64 power8_bhrb_filter_map(u64 branch_sample_type, u64 *bhrb_filter) if (branch_sample_type) { /* Multiple filters will be processed in SW */ pmu_bhrb_filter = 0; - *bhrb_filter = 0; return pmu_bhrb_filter; } else { /* Individual filter will be processed in HW */ What's the justification for the removal of this line? You added it in the previous patch... Regards, Daniel signature.asc Description: This is a digitally signed message part ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 06/12] fsl/fman: Add the FMan MAC FLIB
From: Igal Liberman igal.liber...@freescale.com The FMan MAC FLib provides basic API used by the drivers to configure and control the FMan MAC hardware. Signed-off-by: Igal Liberman igal.liber...@freescale.com --- drivers/net/ethernet/freescale/fman/Makefile | 1 + drivers/net/ethernet/freescale/fman/mac/Makefile | 5 + .../net/ethernet/freescale/fman/mac/fman_dtsec.c | 571 + .../freescale/fman/mac/fman_dtsec_mii_acc.c| 168 ++ .../net/ethernet/freescale/fman/mac/fman_memac.c | 365 + .../freescale/fman/mac/fman_memac_mii_acc.c| 217 .../net/ethernet/freescale/fman/mac/fman_tgec.c| 217 7 files changed, 1544 insertions(+) create mode 100644 drivers/net/ethernet/freescale/fman/mac/Makefile create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_dtsec_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_memac_mii_acc.c create mode 100644 drivers/net/ethernet/freescale/fman/mac/fman_tgec.c diff --git a/drivers/net/ethernet/freescale/fman/Makefile b/drivers/net/ethernet/freescale/fman/Makefile index 50a4de2..1841b03 100644 --- a/drivers/net/ethernet/freescale/fman/Makefile +++ b/drivers/net/ethernet/freescale/fman/Makefile @@ -5,3 +5,4 @@ obj-y += fsl_fman.o fsl_fman-objs := fman.o obj-y += port/ +obj-y += mac/ diff --git a/drivers/net/ethernet/freescale/fman/mac/Makefile b/drivers/net/ethernet/freescale/fman/mac/Makefile new file mode 100644 index 000..ce03e25 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/Makefile @@ -0,0 +1,5 @@ +obj-y += fsl_fman_mac.o + +fsl_fman_mac-objs := fman_dtsec.o fman_dtsec_mii_acc.o\ + fman_memac.o fman_memac_mii_acc.o\ + fman_tgec.o diff --git a/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c new file mode 100644 index 000..290a037 --- /dev/null +++ b/drivers/net/ethernet/freescale/fman/mac/fman_dtsec.c @@ -0,0 +1,571 @@ +/* + * Copyright 2008 - 2015 Freescale Semiconductor Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License (GPL) as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include fsl_fman_dtsec.h + +void fman_dtsec_stop_rx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(regs-rctrl) | RCTRL_GRS, regs-rctrl); +} + +void fman_dtsec_stop_tx(struct dtsec_regs __iomem *regs) +{ + /* Assert the graceful stop bit */ + iowrite32be(ioread32be(regs-tctrl) | DTSEC_TCTRL_GTS, regs-tctrl); +} + +void fman_dtsec_start_tx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(regs-tctrl) ~DTSEC_TCTRL_GTS, regs-tctrl); +} + +void fman_dtsec_start_rx(struct dtsec_regs __iomem *regs) +{ + /* clear the graceful stop bit */ + iowrite32be(ioread32be(regs-rctrl) ~RCTRL_GRS, regs-rctrl); +} + +void fman_dtsec_defconfig(struct dtsec_cfg *cfg) +{ + cfg-halfdup_on = DEFAULT_HALFDUP_ON; + cfg-halfdup_retransmit = DEFAULT_HALFDUP_RETRANSMIT; +
[PATCH v2 1/7]powerpc/powernv: Data structure and macros definition
Create new header file nest-pmu.h to add the data structures and macros needed for the nest pmu support. Cc: Michael Ellerman m...@ellerman.id.au Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Paul Mackerras pau...@samba.org Cc: Anton Blanchard an...@samba.org Cc: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Cc: Anshuman Khandual khand...@linux.vnet.ibm.com Cc: Stephane Eranian eran...@google.com Signed-off-by: Madhavan Srinivasan ma...@linux.vnet.ibm.com --- arch/powerpc/perf/nest-pmu.h | 53 1 file changed, 53 insertions(+) create mode 100644 arch/powerpc/perf/nest-pmu.h diff --git a/arch/powerpc/perf/nest-pmu.h b/arch/powerpc/perf/nest-pmu.h new file mode 100644 index 000..ebe7689 --- /dev/null +++ b/arch/powerpc/perf/nest-pmu.h @@ -0,0 +1,53 @@ +/* + * Nest Performance Monitor counter support for POWER8 processors. + * + * Copyright (C) 2015 Madhavan Srinivasan, IBM Corporation. + * + * 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. + */ + +#include linux/perf_event.h +#include linux/slab.h +#include linux/of.h +#include linux/io.h +#include asm/opal.h + +#define P8_MAX_CHIP32 +#define MAX_PMU_NAME_LEN 256 +#define MAX_EVENTS_SUPPORTED256 +#define P8_NEST_ENGINE_START 1 +#define P8_NEST_ENGINE_STOP0 +#define P8_MAX_NEST_PMUS 32 + +/* + * Structure to hold per chip specific memory address + * information for nest pmus. Nest Counter data are exported + * in per-chip reserved memory region by the PORE Engine. + */ +struct perchip_nest_info { + uint32_t chip_id; + uint64_t pbase; + uint64_t vbase; + uint32_t size; +}; + +/* + * Place holder for nest pmu events and values. + */ +struct ppc64_nest_ima_events { + const char *ev_name; + const char *ev_value; +}; + +/* + * Device tree parser code detects nest pmu support and + * registers new nest pmus. This structure will + * hold the pmu functions and attrs for each nest pmu and + * will be referenced at the time of pmu registration. + */ +struct nest_pmu { + struct pmu pmu; + const struct attribute_group *attr_groups[4]; +}; -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 4/7]powerpc/powernv: detect supported nest pmus and its events
Parse device tree to detect supported nest pmu units. Traverse through each nest pmu unit folder to find supported events and corresponding unit/scale files (if any). Nest unit event file from DT, will contain the offset in the reserves memory region to get the counter data for a gievn event. Kernel code uses the same as event configuration value. Device tree parser code also look for scale/unit in the file name and pass on the file as an event attr for perf tool to use in the post processing. Cc: Michael Ellerman m...@ellerman.id.au Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Paul Mackerras pau...@samba.org Cc: Anton Blanchard an...@samba.org Cc: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Cc: Anshuman Khandual khand...@linux.vnet.ibm.com Cc: Stephane Eranian eran...@google.com Signed-off-by: Madhavan Srinivasan ma...@linux.vnet.ibm.com --- arch/powerpc/perf/nest-pmu.c | 129 ++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/nest-pmu.c b/arch/powerpc/perf/nest-pmu.c index e993630..43d5fde 100644 --- a/arch/powerpc/perf/nest-pmu.c +++ b/arch/powerpc/perf/nest-pmu.c @@ -11,6 +11,124 @@ #include nest-pmu.h static struct perchip_nest_info p8_perchip_nest_info[P8_MAX_CHIP]; +static struct nest_pmu *per_nest_pmu_arr[P8_MAX_NEST_PMUS]; + +static int nest_pmu_create(struct device_node *dev, int pmu_index) +{ + struct ppc64_nest_ima_events **p8_events_arr, *p8_events; + struct nest_pmu *pmu_ptr; + struct property *pp; + char *buf, *start; + const __be32 *lval; + u32 val; + int idx = 0; + + if (!dev) + return -EINVAL; + + pmu_ptr = kzalloc(sizeof(struct nest_pmu), GFP_KERNEL); + if (!pmu_ptr) + return -ENOMEM; + + /* Needed for hotplug/migration */ + per_nest_pmu_arr[pmu_index] = pmu_ptr; + + p8_events_arr = kzalloc((sizeof(struct ppc64_nest_ima_events) * 64), + GFP_KERNEL); + if (!p8_events_arr) + return -ENOMEM; + p8_events = (struct ppc64_nest_ima_events *)p8_events_arr; + + /* + * Loop through each property + */ + for_each_property_of_node(dev, pp) { + start = pp-name; + + if (!strcmp(pp-name, name)) { + if (!pp-value || + (strnlen(pp-value, pp-length) == pp-length)) + return -EINVAL; + + buf = kzalloc(MAX_PMU_NAME_LEN, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + /* Save the name to register the PMU with it */ + sprintf(buf, Nest_%s, (char *)pp-value); + pmu_ptr-pmu.name = (char *)buf; + } + + /* Skip these, we dont need it */ + if (!strcmp(pp-name, name) || + !strcmp(pp-name, phandle) || + !strcmp(pp-name, device_type) || + !strcmp(pp-name, linux,phandle)) + continue; + + buf = kzalloc(MAX_PMU_NAME_LEN, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + if (strncmp(pp-name, unit., 5) == 0) { + start += 5; + strncpy(buf, start, strlen(start)); + p8_events-ev_name = buf; + + if (!pp-value || + (strnlen(pp-value, pp-length) == pp-length)) + return -EINVAL; + + buf = kzalloc(MAX_PMU_NAME_LEN, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + strncpy(buf, (const char *)pp-value, pp-length); + p8_events-ev_value = buf; + idx++; + p8_events++; + + } else if (strncmp(pp-name, scale., 6) == 0) { + start += 6; + strncpy(buf, start, strlen(start)); + p8_events-ev_name = buf; + + if (!pp-value || + (strnlen(pp-value, pp-length) == pp-length)) + return -EINVAL; + + buf = kzalloc(MAX_PMU_NAME_LEN, GFP_KERNEL); + if (!buf) + return -ENOMEM; + + strncpy(buf, (const char *)pp-value, pp-length); + p8_events-ev_value = buf; + idx++; + p8_events++; + + } else { + strncpy(buf, start, strlen(start)); + p8_events-ev_name = buf; + lval = of_get_property(dev, pp-name, NULL); + val = (uint32_t)be32_to_cpup(lval);
[PATCH v2 5/7]powerpc/powernv: add event attribute and group to nest pmu
Add code to create event attribute and attribute group for each nest pmu. Cc: Michael Ellerman m...@ellerman.id.au Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: Paul Mackerras pau...@samba.org Cc: Anton Blanchard an...@samba.org Cc: Sukadev Bhattiprolu suka...@linux.vnet.ibm.com Cc: Anshuman Khandual khand...@linux.vnet.ibm.com Cc: Stephane Eranian eran...@google.com Signed-off-by: Madhavan Srinivasan ma...@linux.vnet.ibm.com --- arch/powerpc/perf/nest-pmu.c | 55 +++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/nest-pmu.c b/arch/powerpc/perf/nest-pmu.c index 43d5fde..8fad2d9 100644 --- a/arch/powerpc/perf/nest-pmu.c +++ b/arch/powerpc/perf/nest-pmu.c @@ -13,6 +13,55 @@ static struct perchip_nest_info p8_perchip_nest_info[P8_MAX_CHIP]; static struct nest_pmu *per_nest_pmu_arr[P8_MAX_NEST_PMUS]; +/* + * Populate event name and string in attribute + */ +struct attribute *dev_str_attr(const char *name, const char *str) +{ + struct perf_pmu_events_attr *attr; + + attr = kzalloc(sizeof(*attr), GFP_KERNEL); + + attr-event_str = str; + attr-attr.attr.name = name; + attr-attr.attr.mode = 0444; + attr-attr.show = perf_event_sysfs_show; + + return attr-attr.attr; +} + +int update_events_in_group( + struct ppc64_nest_ima_events *p8_events, int idx, + struct nest_pmu *pmu) +{ + struct attribute_group *attr_group; + struct attribute **attrs; + int i; + + /* Allocate memory add supported event as event attribute */ + attr_group = kzalloc(((sizeof(struct attribute *) * (idx + 1)) + + sizeof(*attr_group)), GFP_KERNEL); + if (!attr_group) + return -ENOMEM; + + attrs = (struct attribute **)(attr_group + 1); + attr_group-name = events; + + /* +* struct attribute group contains, name and an +* array of attributes, along other elemsnts. +* link attrs with attribute group's attr array. +*/ + attr_group-attrs = attrs; + + for (i = 0; i idx; i++, p8_events++) + attrs[i] = dev_str_attr((char *)p8_events-ev_name, + (char *)p8_events-ev_value); + + pmu-attr_groups[0] = attr_group; + return 0; +} + static int nest_pmu_create(struct device_node *dev, int pmu_index) { struct ppc64_nest_ima_events **p8_events_arr, *p8_events; @@ -68,7 +117,7 @@ static int nest_pmu_create(struct device_node *dev, int pmu_index) buf = kzalloc(MAX_PMU_NAME_LEN, GFP_KERNEL); if (!buf) - return -ENOMEM; + return -ENOMEM; if (strncmp(pp-name, unit., 5) == 0) { start += 5; @@ -126,6 +175,10 @@ static int nest_pmu_create(struct device_node *dev, int pmu_index) } } + update_events_in_group( + (struct ppc64_nest_ima_events *)p8_events_arr, + idx, pmu_ptr); + return 0; } -- 1.9.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v8] powerpc/powernv: Poweroff (EPOW, DPO) events support for PowerNV platform
On 06/11/2015 04:25 AM, Stewart Smith wrote: Vipin K Parashar vi...@linux.vnet.ibm.com writes: This patch adds support for FSP (Flexible Service Processor) EPOW (Early Power Off Warning) and DPO (Delayed Power Off) events for Not restricted to FSP systems, it's a generic OPAL API that any platform could implement. Yes EPOW and DPO APIs are generic any can be used on any platform. But the text describes that it adds support for EPOW, DPO events which exists only for FSP based system as if today. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3] drivers/mtd: add powernv flash MTD abstraction driver
On Fri, 2015-06-05 at 10:16 +0200, Richard Weinberger wrote: On Fri, Jun 5, 2015 at 6:40 AM, Cyril Bur cyril...@gmail.com wrote: On Tue, 2015-06-02 at 14:26 +1000, Cyril Bur wrote: Powerpc powernv platforms allow access to certain system flash devices through a firmwarwe interface. This change adds an mtd driver for these flash devices. Minor updates from Jeremy Kerr and Joel Stanley. Signed-off-by: Cyril Bur cyril...@gmail.com Signed-off-by: Joel Stanley j...@jms.id.au Signed-off-by: Jeremy Kerr j...@ozlabs.org --- Hello Brian and MTD folk, Could I please get an ACK for Michael to take this through the powerpc As we have some deadlines approaching, I am getting pressure to ensure this gets merged upstream as quickly as possible, please let me know if there is anything more which can be done. FYI, Brian is not available for the next 1.5 weeks. So I fear this driver has to wait for the next merge window. OK. We'll merge it via the powerpc tree and if there are any problems with it we can fix them later. cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev