···11* Freescale MSI interrupt controller2233Required properties:44-- compatible : compatible list, contains 2 entries,55- first is "fsl,CHIP-msi", where CHIP is the processor(mpc8610, mpc8572,66- etc.) and the second is "fsl,mpic-msi" or "fsl,ipic-msi" depending on77- the parent type.44+- compatible : compatible list, may contain one or two entries55+ The first is "fsl,CHIP-msi", where CHIP is the processor(mpc8610, mpc8572,66+ etc.) and the second is "fsl,mpic-msi" or "fsl,ipic-msi" or77+ "fsl,mpic-msi-v4.3" depending on the parent type and version. If mpic88+ version is 4.3, the number of MSI registers is increased to 16, MSIIR1 is99+ provided to access these 16 registers, and compatible "fsl,mpic-msi-v4.3"1010+ should be used. The first entry is optional; the second entry is1111+ required.812913- reg : It may contain one or two regions. The first region should contain1014 the address and the length of the shared message interrupt register set.1111- The second region should contain the address of aliased MSIIR register for1212- platforms that have such an alias.1313-1414-- msi-available-ranges: use <start count> style section to define which1515- msi interrupt can be used in the 256 msi interrupts. This property is1616- optional, without this, all the 256 MSI interrupts can be used.1717- Each available range must begin and end on a multiple of 32 (i.e.1818- no splitting an individual MSI register or the associated PIC interrupt).1515+ The second region should contain the address of aliased MSIIR or MSIIR11616+ register for platforms that have such an alias, if using MSIIR1, the second1717+ region must be added because different MSI group has different MSIIR1 offset.19182019- interrupts : each one of the interrupts here is one entry per 32 MSIs,2120 and routed to the host interrupt controller. the interrupts should···2728 to MPIC.28292930Optional properties:3131+- msi-available-ranges: use <start count> style section to define which3232+ msi interrupt can be used in the 256 msi interrupts. This property is3333+ optional, without this, all the MSI interrupts can be used.3434+ Each available range must begin and end on a multiple of 32 (i.e.3535+ no splitting an individual MSI register or the associated PIC interrupt).3636+ MPIC v4.3 does not support this property because the 32 interrupts of an3737+ individual register are not continuous when using MSIIR1.3838+3039- msi-address-64: 64-bit PCI address of the MSIIR register. The MSIIR register3140 is used for MSI messaging. The address of MSIIR in PCI address space is3241 the MSI message address.···5952 0xe6 06053 0xe7 0>;6154 interrupt-parent = <&mpic>;5555+ };5656+5757+ msi@41600 {5858+ compatible = "fsl,mpic-msi-v4.3";5959+ reg = <0x41600 0x200 0x44148 4>;6060+ interrupts = <6161+ 0xe0 0 0 06262+ 0xe1 0 0 06363+ 0xe2 0 0 06464+ 0xe3 0 0 06565+ 0xe4 0 0 06666+ 0xe5 0 0 06767+ 0xe6 0 0 06868+ 0xe7 0 0 06969+ 0x100 0 0 07070+ 0x101 0 0 07171+ 0x102 0 0 07272+ 0x103 0 0 07373+ 0x104 0 0 07474+ 0x105 0 0 07575+ 0x106 0 0 07676+ 0x107 0 0 0>;6277 };63786479The Freescale hypervisor and msi-address-64
···4242# CONFIG_IPV6 is not set4343CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"4444CONFIG_DEVTMPFS=y4545+CONFIG_DEVTMPFS_MOUNT=y4546# CONFIG_FW_LOADER is not set4647CONFIG_MTD=y4748CONFIG_MTD_CHAR=y
···105105extern bool epapr_paravirt_enabled;106106extern u32 epapr_hypercall_start[];107107108108+#ifdef CONFIG_EPAPR_PARAVIRT109109+int __init epapr_paravirt_early_init(void);110110+#else111111+static inline int epapr_paravirt_early_init(void) { return 0; }112112+#endif113113+108114/*109115 * We use "uintptr_t" to define a register because it's guaranteed to be a110116 * 32-bit integer on a 32-bit platform, and a 64-bit integer on a 64-bit
+7
arch/powerpc/include/asm/mpic.h
···396396#define MPIC_REGSET_TSI108 MPIC_REGSET(1) /* Tsi108/109 PIC */397397398398/* Get the version of primary MPIC */399399+#ifdef CONFIG_MPIC399400extern u32 fsl_mpic_primary_get_version(void);401401+#else402402+static inline u32 fsl_mpic_primary_get_version(void)403403+{404404+ return 0;405405+}406406+#endif400407401408/* Allocate the controller structure and setup the linux irq descs402409 * for the range if interrupts passed in. No HW initialization is
···30303131bool epapr_paravirt_enabled;32323333-static int __init epapr_paravirt_init(void)3333+static int __init early_init_dt_scan_epapr(unsigned long node,3434+ const char *uname,3535+ int depth, void *data)3436{3535- struct device_node *hyper_node;3637 const u32 *insts;3737- int len, i;3838+ unsigned long len;3939+ int i;38403939- hyper_node = of_find_node_by_path("/hypervisor");4040- if (!hyper_node)4141- return -ENODEV;4242-4343- insts = of_get_property(hyper_node, "hcall-instructions", &len);4141+ insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);4442 if (!insts)4545- return -ENODEV;4343+ return 0;46444745 if (len % 4 || len > (4 * 4))4848- return -ENODEV;4646+ return -1;49475048 for (i = 0; i < (len / 4); i++) {5149 patch_instruction(epapr_hypercall_start + i, insts[i]);···5355 }54565557#if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)5656- if (of_get_property(hyper_node, "has-idle", NULL))5858+ if (of_get_flat_dt_prop(node, "has-idle", NULL))5759 ppc_md.power_save = epapr_ev_idle;5860#endif59616062 epapr_paravirt_enabled = true;61636464+ return 1;6565+}6666+6767+int __init epapr_paravirt_early_init(void)6868+{6969+ of_scan_flat_dt(early_init_dt_scan_epapr, NULL);7070+6271 return 0;6372}64736565-early_initcall(epapr_paravirt_init);
+3-1
arch/powerpc/kernel/setup_32.c
···3838#include <asm/serial.h>3939#include <asm/udbg.h>4040#include <asm/mmu_context.h>4141+#include <asm/epapr_hcalls.h>41424243#include "setup.h"4344···128127129128 /* Do some early initialization based on the flat device tree */130129 early_init_devtree(__va(dt_ptr));130130+131131+ epapr_paravirt_early_init();131132132133 early_init_mmu();133134···329326330327 /* Initialize the MMU context management stuff */331328 mmu_context_init();332332-333329}
+3
arch/powerpc/kernel/setup_64.c
···6666#include <asm/code-patching.h>6767#include <asm/kvm_ppc.h>6868#include <asm/hugetlb.h>6969+#include <asm/epapr_hcalls.h>69707071#include "setup.h"7172···215214 * calculating/retrieving the hash table size.216215 */217216 early_init_devtree(__va(dt_ptr));217217+218218+ epapr_paravirt_early_init();218219219220 /* Now we know the logical id of our boot cpu, setup the paca. */220221 setup_paca(&paca[boot_cpuid]);
+8
arch/powerpc/kernel/swsusp_booke.S
···141141 lis r11,swsusp_save_area@h142142 ori r11,r11,swsusp_save_area@l143143144144+ /*145145+ * Mappings from virtual addresses to physical addresses may be146146+ * different than they were prior to restoring hibernation state. 147147+ * Invalidate the TLB so that the boot CPU is using the new148148+ * mappings.149149+ */150150+ bl _tlbil_all151151+144152 lwz r4,SL_SPRG0(r11)145153 mtsprg 0,r4146154 lwz r4,SL_SPRG1(r11)
+3
arch/powerpc/kernel/traps.c
···6262#include <asm/switch_to.h>6363#include <asm/tm.h>6464#include <asm/debug.h>6565+#include <sysdev/fsl_pci.h>65666667#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)6768int (*__debugger)(struct pt_regs *regs) __read_mostly;···567566568567 if (reason & MCSR_BUS_RBERR) {569568 if (fsl_rio_mcheck_exception(regs))569569+ return 1;570570+ if (fsl_pci_mcheck_exception(regs))570571 return 1;571572 }572573
···7070 case 3:7171 val = mfpmr(PMRN_PMC3);7272 break;7373+ case 4:7474+ val = mfpmr(PMRN_PMC4);7575+ break;7676+ case 5:7777+ val = mfpmr(PMRN_PMC5);7878+ break;7379 default:7480 printk(KERN_ERR "oops trying to read PMC%d\n", idx);7581 val = 0;···10094 break;10195 case 3:10296 mtpmr(PMRN_PMC3, val);9797+ break;9898+ case 4:9999+ mtpmr(PMRN_PMC4, val);100100+ break;101101+ case 5:102102+ mtpmr(PMRN_PMC5, val);103103 break;104104 default:105105 printk(KERN_ERR "oops trying to write PMC%d\n", idx);···132120 case 3:133121 mtpmr(PMRN_PMLCA3, val);134122 break;123123+ case 4:124124+ mtpmr(PMRN_PMLCA4, val);125125+ break;126126+ case 5:127127+ mtpmr(PMRN_PMLCA5, val);128128+ break;135129 default:136130 printk(KERN_ERR "oops trying to write PMLCA%d\n", idx);137131 }···162144 break;163145 case 3:164146 mtpmr(PMRN_PMLCB3, val);147147+ break;148148+ case 4:149149+ mtpmr(PMRN_PMLCB4, val);150150+ break;151151+ case 5:152152+ mtpmr(PMRN_PMLCB5, val);165153 break;166154 default:167155 printk(KERN_ERR "oops trying to write PMLCB%d\n", idx);···485461 int err;486462 int num_restricted;487463 int i;464464+465465+ if (ppmu->n_counter > MAX_HWEVENTS) {466466+ WARN(1, "No. of perf counters (%d) is higher than max array size(%d)\n",467467+ ppmu->n_counter, MAX_HWEVENTS);468468+ ppmu->n_counter = MAX_HWEVENTS;469469+ }488470489471 switch (event->attr.type) {490472 case PERF_TYPE_HARDWARE:
+121
arch/powerpc/perf/e6500-pmu.c
···11+/*22+ * Performance counter support for e6500 family processors.33+ *44+ * Author: Priyanka Jain, Priyanka.Jain@freescale.com55+ * Based on e500-pmu.c66+ * Copyright 2013 Freescale Semiconductor, Inc.77+ * Copyright 2008-2009 Paul Mackerras, IBM Corporation.88+ *99+ * This program is free software; you can redistribute it and/or1010+ * modify it under the terms of the GNU General Public License1111+ * as published by the Free Software Foundation; either version1212+ * 2 of the License, or (at your option) any later version.1313+ */1414+1515+#include <linux/string.h>1616+#include <linux/perf_event.h>1717+#include <asm/reg.h>1818+#include <asm/cputable.h>1919+2020+/*2121+ * Map of generic hardware event types to hardware events2222+ * Zero if unsupported2323+ */2424+static int e6500_generic_events[] = {2525+ [PERF_COUNT_HW_CPU_CYCLES] = 1,2626+ [PERF_COUNT_HW_INSTRUCTIONS] = 2,2727+ [PERF_COUNT_HW_CACHE_MISSES] = 221,2828+ [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,2929+ [PERF_COUNT_HW_BRANCH_MISSES] = 15,3030+};3131+3232+#define C(x) PERF_COUNT_HW_CACHE_##x3333+3434+/*3535+ * Table of generalized cache-related events.3636+ * 0 means not supported, -1 means nonsensical, other values3737+ * are event codes.3838+ */3939+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {4040+ [C(L1D)] = {4141+ /*RESULT_ACCESS RESULT_MISS */4242+ [C(OP_READ)] = { 27, 222 },4343+ [C(OP_WRITE)] = { 28, 223 },4444+ [C(OP_PREFETCH)] = { 29, 0 },4545+ },4646+ [C(L1I)] = {4747+ /*RESULT_ACCESS RESULT_MISS */4848+ [C(OP_READ)] = { 2, 254 },4949+ [C(OP_WRITE)] = { -1, -1 },5050+ [C(OP_PREFETCH)] = { 37, 0 },5151+ },5252+ /*5353+ * Assuming LL means L2, it's not a good match for this model.5454+ * It does not have separate read/write events (but it does have5555+ * separate instruction/data events).5656+ */5757+ [C(LL)] = {5858+ /*RESULT_ACCESS RESULT_MISS */5959+ [C(OP_READ)] = { 0, 0 },6060+ [C(OP_WRITE)] = { 0, 0 },6161+ [C(OP_PREFETCH)] = { 0, 0 },6262+ },6363+ /*6464+ * There are data/instruction MMU misses, but that's a miss on6565+ * the chip's internal level-one TLB which is probably not6666+ * what the user wants. Instead, unified level-two TLB misses6767+ * are reported here.6868+ */6969+ [C(DTLB)] = {7070+ /*RESULT_ACCESS RESULT_MISS */7171+ [C(OP_READ)] = { 26, 66 },7272+ [C(OP_WRITE)] = { -1, -1 },7373+ [C(OP_PREFETCH)] = { -1, -1 },7474+ },7575+ [C(BPU)] = {7676+ /*RESULT_ACCESS RESULT_MISS */7777+ [C(OP_READ)] = { 12, 15 },7878+ [C(OP_WRITE)] = { -1, -1 },7979+ [C(OP_PREFETCH)] = { -1, -1 },8080+ },8181+ [C(NODE)] = {8282+ /* RESULT_ACCESS RESULT_MISS */8383+ [C(OP_READ)] = { -1, -1 },8484+ [C(OP_WRITE)] = { -1, -1 },8585+ [C(OP_PREFETCH)] = { -1, -1 },8686+ },8787+};8888+8989+static int num_events = 512;9090+9191+/* Upper half of event id is PMLCb, for threshold events */9292+static u64 e6500_xlate_event(u64 event_id)9393+{9494+ u32 event_low = (u32)event_id;9595+ if (event_low >= num_events ||9696+ (event_id & (FSL_EMB_EVENT_THRESHMUL | FSL_EMB_EVENT_THRESH)))9797+ return 0;9898+9999+ return FSL_EMB_EVENT_VALID;100100+}101101+102102+static struct fsl_emb_pmu e6500_pmu = {103103+ .name = "e6500 family",104104+ .n_counter = 6,105105+ .n_restricted = 0,106106+ .xlate_event = e6500_xlate_event,107107+ .n_generic = ARRAY_SIZE(e6500_generic_events),108108+ .generic_events = e6500_generic_events,109109+ .cache_events = &e6500_cache_events,110110+};111111+112112+static int init_e6500_pmu(void)113113+{114114+ if (!cur_cpu_spec->oprofile_cpu_type ||115115+ strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc/e6500"))116116+ return -ENODEV;117117+118118+ return register_fsl_emb_pmu(&e6500_pmu);119119+}120120+121121+early_initcall(init_e6500_pmu);