[PATCH] powerpc/pci: Make both ppc32 and ppc64 use sysdata for pci_controller
Currently, ppc32 uses sysdata for the pci_controller pointer, and ppc64 uses it to hold the device_node pointer. This patch moves the of_node pointer into (struct pci_bus*)->dev.of_node and (struct pci_dev*)->dev.of_node so that sysdata can be converted to always use the pci_controller pointer instead. It also fixes up the allocating of pci devices so that the of_node pointer gets assigned consistently and increments the ref count. Signed-off-by: Grant Likely --- Hi Ben, Please take a look at this. It is based on Sebastian's patch to move some of the OF pci code into driver/of, so it probably doesn't apply cleanly, but it is in my devicetree/next branch if you want to give it a spin. With this patch I'll be able to clean up a lot of the differences between ppc32 and ppc64 pci support. g. arch/microblaze/pci/pci_32.c |1 + arch/powerpc/include/asm/pci-bridge.h | 27 +-- arch/powerpc/include/asm/pci.h |2 +- arch/powerpc/kernel/of_platform.c |2 +- arch/powerpc/kernel/pci-common.c | 11 +++ arch/powerpc/kernel/pci_32.c |2 +- arch/powerpc/kernel/pci_64.c |6 +++--- arch/powerpc/kernel/pci_dn.c |9 ++--- arch/powerpc/kernel/pci_of_scan.c |4 ++-- arch/powerpc/platforms/pseries/pci_dlpar.c |2 +- 10 files changed, 24 insertions(+), 42 deletions(-) diff --git a/arch/microblaze/pci/pci_32.c b/arch/microblaze/pci/pci_32.c index 3c3d808..92728a6 100644 --- a/arch/microblaze/pci/pci_32.c +++ b/arch/microblaze/pci/pci_32.c @@ -332,6 +332,7 @@ static void __devinit pcibios_scan_phb(struct pci_controller *hose) hose->global_number); return; } + bus.dev->of_node = of_node_get(node); bus->secondary = hose->first_busno; hose->bus = bus; diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index edeb80f..5e156e0 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -164,13 +164,13 @@ extern void setup_indirect_pci(struct pci_controller* hose, resource_size_t cfg_addr, resource_size_t cfg_data, u32 flags); -#ifndef CONFIG_PPC64 - static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) { return bus->sysdata; } +#ifndef CONFIG_PPC64 + static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) { struct pci_controller *host; @@ -228,19 +228,10 @@ extern void * update_dn_pci_info(struct device_node *dn, void *data); /* Get a device_node from a pci_dev. This code must be fast except * in the case where the sysdata is incorrect and needs to be fixed - * up (this will only happen once). - * In this case the sysdata will have been inherited from a PCI host - * bridge or a PCI-PCI bridge further up the tree, so it will point - * to a valid struct pci_dn, just not the one we want. - */ + * up (this will only happen once). */ static inline struct device_node *pci_device_to_OF_node(struct pci_dev *dev) { - struct device_node *dn = dev->sysdata; - struct pci_dn *pdn = dn->data; - - if (pdn && pdn->devfn == dev->devfn && pdn->busno == dev->bus->number) - return dn; /* fast path. sysdata is good */ - return fetch_dev_dn(dev); + return dev->dev.of_node ? dev->dev.of_node : fetch_dev_dn(dev); } static inline int pci_device_from_OF_node(struct device_node *np, @@ -258,7 +249,7 @@ static inline struct device_node *pci_bus_to_OF_node(struct pci_bus *bus) if (bus->self) return pci_device_to_OF_node(bus->self); else - return bus->sysdata; /* Must be root bus (PHB) */ + return bus->dev.of_node; /* Must be root bus (PHB) */ } /** Find the bus corresponding to the indicated device node */ @@ -270,14 +261,6 @@ extern void pcibios_remove_pci_devices(struct pci_bus *bus); /** Discover new pci devices under this bus, and add them */ extern void pcibios_add_pci_devices(struct pci_bus *bus); -static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) -{ - struct device_node *busdn = bus->sysdata; - - BUG_ON(busdn == NULL); - return PCI_DN(busdn)->phb; -} - extern void isa_bridge_find_early(struct pci_controller *hose); diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h index a20a9ad..7d77909 100644 --- a/arch/powerpc/include/asm/pci.h +++ b/arch/powerpc/include/asm/pci.h @@ -201,7 +201,7 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar, extern void pcibios_setup_bus_devices(struct pci_bus *bus); extern void pcibios_setup_bus_self(struct pci_bus *bus); extern void pcibios_setup_phb_io_space(struct pci_controller *hose); -extern void pcibios_scan_phb(struct pci_controller
Re: minimum guaranteed alignment of dma_alloc_coherent?
On Feb 4, 2011, at 6:04 PM, Tabi Timur-B04825 wrote: I guess I'm not clear. I was wondering why an API called "dma_alloc_coherent" (that has the word "dma" in it) needs to be told to allocate DMA-safe memory. I understood your question, and I indicated this is used in a platform specific manner. When would it make sense to call dma_alloc_cohernet without GFP_DMA? If you don't want DMA-able memory, then you shouldn't be calling dma_alloc_anything. So, I did a little research. It appears in the case of PowerPC, the GFP_DMA can change the way the allocation operates. Since the coherent allocator works with pages of memory, in the case of a system with highmem, not using GFP_DMA could hand you a physical page out of the highmem pool. If your device is capable of doing a DMA to that physical location, all is good. If your device has some addressing restriction to low memory buffers, you should specify GFP_DMA. I think for all architectures, GFP_DMA will guarantee a DMA buffer for any device in a system. If your device can relax that constraint, you can elect to not use this flag and conserve the DMA pool for those devices that require the restrictions. This behavior is modified if you specify a restricted DMA mask for the device. In this case, dma_alloc_coherent will force GFP_DMA on your behalf (on PowerPC). Thanks. -- Dan ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Problem with Busybox shell
Hi Mohan, Were you able to fix your problem? I am having the same problem with my board. It is PPC750FX with Marvell MV64460. Jacob ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: minimum guaranteed alignment of dma_alloc_coherent?
Dan Malek wrote: > > >> On a side note, do I really need to pass GFP_DMA > > The GFP_DMA is architecture dependent. Are you writing > a driver to be used across multiple architectures? It's conceivable that the driver could work on PowerPC and ARM. > If it's > necessary, I'd document why you are using it (an ISA device > on x86 for example) and then let other architectures > determine if it's necessary for them. I guess I'm not clear. I was wondering why an API called "dma_alloc_coherent" (that has the word "dma" in it) needs to be told to allocate DMA-safe memory. When would it make sense to call dma_alloc_cohernet without GFP_DMA? If you don't want DMA-able memory, then you shouldn't be calling dma_alloc_anything. -- Timur Tabi Linux kernel developer ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: minimum guaranteed alignment of dma_alloc_coherent?
On Feb 4, 2011, at 4:14 PM, Timur Tabi wrote: Is there any official statement on what the minimum alignment is for memory returned by dma_alloc_coherent? This is dependent upon the particular implementation. There have been several over the history of this API, and some would work out of a DMA pool that would only provide word alignment. Would anyone have a complaint if I did this: vaddr = dma_alloc_coherent(dev, ssize, &paddr, GFP_DMA | __GFP_ZERO); BUG_ON(paddr & (alignment - 1)); Well, the usual design for anything that requires alignment is that you never assume you get it unless it can be specified, so over allocate as you are doing currently, and then adjust the base address. Or, you could allocate exactly what you want, if it aligns properly you are good to go, and if not release, over allocate, and adjust. The problem with the suggested implementation is the results aren't predictable. Even if the API doesn't guarantee your alignment, you may get it most of the time, but once in a while this may fail. You could test and all looks good, ship something and it fails. Today, this may work fine, but it would be nice to ensure it continues to work in the future. :-) On a side note, do I really need to pass GFP_DMA The GFP_DMA is architecture dependent. Are you writing a driver to be used across multiple architectures? If it's necessary, I'd document why you are using it (an ISA device on x86 for example) and then let other architectures determine if it's necessary for them. Thanks. -- Dan ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
minimum guaranteed alignment of dma_alloc_coherent?
Is there any official statement on what the minimum alignment is for memory returned by dma_alloc_coherent? I know that since it uses a page allocator to do the actual allocation, that the memory is page aligned (at least on PowerPC). Is this something I can rely on? Would anyone have a complaint if I did this: vaddr = dma_alloc_coherent(dev, ssize, &paddr, GFP_DMA | __GFP_ZERO); BUG_ON(paddr & (alignment - 1)); 'alignment' will always be 32 or less. The reason I ask is that I currently have code that ensures an alignment, but it does so by allocating extra memory, and that seems wasteful. On a side note, do I really need to pass GFP_DMA when calling dma_alloc_coherent? That seems redundant, but I don't see the code force it to be set. Should it be forced on? -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 4/4] powerpc: Replacing "protected-sources" with "pic-no-reset" in DTS files
The "protected-sources" property was being used in the AMP configured MPC8572DS and P2020RDB DTS files. This changeset modifies those files to use "pic-no-reset" instead. Signed-off-by: Meador Inge Cc: Hollis Blanchard Cc: Kumar Gala --- arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts |6 +- arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts | 11 +-- arch/powerpc/boot/dts/p2020rdb_camp_core0.dts |7 +-- arch/powerpc/boot/dts/p2020rdb_camp_core1.dts |7 +-- 4 files changed, 4 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts index 3375c2a..4f7ee6d 100644 --- a/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts +++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts @@ -252,11 +252,7 @@ reg = <0x4 0x4>; compatible = "chrp,open-pic"; device_type = "open-pic"; - protected-sources = < - 31 32 33 37 38 39 /* enet2 enet3 */ - 76 77 78 79 26 42 /* dma2 pci2 serial*/ - 0xe4 0xe5 0xe6 0xe7 /* msi */ - >; + pic-no-reset; }; }; diff --git a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts index e7b477f..62fd64f 100644 --- a/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts +++ b/arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts @@ -178,16 +178,7 @@ reg = <0x4 0x4>; compatible = "chrp,open-pic"; device_type = "open-pic"; - protected-sources = < - 18 16 10 42 45 58 /* MEM L2 mdio serial crypto */ - 29 30 34 35 36 40 /* enet0 enet1 */ - 24 25 20 21 22 23 /* pci0 pci1 dma1 */ - 43 /* i2c */ - 0x1 0x2 0x3 0x4 /* pci slot */ - 0x9 0xa 0xb 0xc /* usb */ - 0x6 0x7 0xe 0x5 /* Audio elgacy SATA */ - 0xe0 0xe1 0xe2 0xe3 /* msi */ - >; + pic-no-reset; }; }; diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts index 0fe93d0..f749cbb 100644 --- a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts +++ b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts @@ -318,12 +318,7 @@ reg = <0x4 0x4>; compatible = "chrp,open-pic"; device_type = "open-pic"; - protected-sources = < - 42 76 77 78 79 /* serial1 , dma2 */ - 29 30 34 26 /* enet0, pci1 */ - 0xe0 0xe1 0xe2 0xe3 /* msi */ - 0xe4 0xe5 0xe6 0xe7 - >; + pic-no-reset; }; global-utilities@e { diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts index e95a512..6ef2e64 100644 --- a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts +++ b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts @@ -129,12 +129,7 @@ reg = <0x4 0x4>; compatible = "chrp,open-pic"; device_type = "open-pic"; - protected-sources = < - 17 18 43 42 59 47 /*ecm, mem, i2c, serial0, spi,gpio */ - 16 20 21 22 23 28 /* L2, dma1, USB */ - 03 35 36 40 31 32 33/* mdio, enet1, enet2 */ - 72 45 58 25 /* sdhci, crypto , pci */ - >; + pic-no-reset; }; msi@41600 { -- 1.6.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 3/4] powerpc: make MPIC honor the "pic-no-reset" device tree property
This property, defined in the Open PIC binding, tells the kernel not to use the reset bit in the global configuration register. Additionally, its presence mandates that only sources which are actually used (i.e. appear in the device tree) should have their VECPRI bits initialized. The presence of "protected-sources" is checked for the backwards compatibility of systems which are already using "protected-sources" in firmware and the firmware can not be updated. Any sources encoded in the "protected-sources" cells are not processed. "protected-sources" is effectively a synonym for "pic-no-reset". Signed-off-by: Meador Inge Cc: Hollis Blanchard Cc: Benjamin Herrenschmidt --- arch/powerpc/include/asm/mpic.h |4 ++- arch/powerpc/sysdev/mpic.c | 64 +++--- 2 files changed, 55 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index 9b94f18..688e3e0 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h @@ -322,6 +322,8 @@ struct mpic #ifdef CONFIG_PM struct mpic_irq_save*save_data; #endif + + int cpu; }; /* @@ -333,7 +335,7 @@ struct mpic */ /* This is the primary controller, only that one has IPIs and - * has afinity control. A non-primary MPIC always uses CPU0 + * has affinity control. A non-primary MPIC always uses CPU0 * registers only */ #define MPIC_PRIMARY 0x0001 diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index a98f41d..8de47ca 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -308,6 +308,15 @@ static inline void mpic_map(struct mpic *mpic, struct device_node *node, #define mpic_map(m,n,p,b,o,s) _mpic_map_mmio(m,p,b,o,s) #endif /* !CONFIG_PPC_DCR */ +static inline void mpic_init_vector(struct mpic *mpic, int source) +{ + /* start with vector = source number, and masked */ + u32 vecpri = MPIC_VECPRI_MASK | source | (8 << MPIC_VECPRI_PRIORITY_SHIFT); + + /* init hw */ + mpic_irq_write(source, MPIC_INFO(IRQ_VECTOR_PRI), vecpri); + mpic_irq_write(source, MPIC_INFO(IRQ_DESTINATION), 1 << mpic->cpu); +} /* Check if we have one of those nice broken MPICs with a flipped endian on @@ -622,6 +631,14 @@ static unsigned int mpic_is_ipi(struct mpic *mpic, unsigned int irq) return (src >= mpic->ipi_vecs[0] && src <= mpic->ipi_vecs[3]); } +/* Determine if the linux irq is a timer interrupt */ +static unsigned int mpic_is_timer_interrupt(struct mpic *mpic, unsigned int irq) +{ + unsigned int src = mpic_irq_to_hw(irq); + + return (src >= mpic->timer_vecs[0] && src <= mpic->timer_vecs[3]); +} + /* Convert a cpu mask from logical to physical cpu numbers. */ static inline u32 mpic_physmask(u32 cpumask) @@ -963,6 +980,15 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq, if (hw >= mpic->irq_count) return -EINVAL; + /* If the MPIC was reset, then all vectors have already been +* initialized. Otherwise, the appropriate vector needs to be +* initialized here to ensure that only used sources are setup with +* a vector. +*/ + if (!(mpic->flags & MPIC_WANTS_RESET)) + if (!(mpic_is_ipi(mpic, hw) || mpic_is_timer_interrupt(mpic, hw))) + mpic_init_vector(mpic, hw); + mpic_msi_reserve_hwirq(mpic, hw); /* Default chip */ @@ -1029,6 +1055,16 @@ static struct irq_host_ops mpic_host_ops = { .xlate = mpic_host_xlate, }; +static int mpic_reset_prohibited(struct device_node *node) +{ + /* The presence of "protected-sources" is checked for the backwards +* compatibility of systems which are already using "protected-sources" +* in firmware and the firmware can not be updated. +*/ + return node && (of_get_property(node, "pic-no-reset", NULL) + || of_get_property(node, "protected-sources", NULL)); +} + /* * Exported functions */ @@ -1129,7 +1165,16 @@ struct mpic * __init mpic_alloc(struct device_node *node, mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); /* Reset */ - if (flags & MPIC_WANTS_RESET) { + + /* When using a device-node, reset requests are only honored if the MPIC +* is allowed to reset. +*/ + if (mpic_reset_prohibited(node)) { + mpic->flags &= ~MPIC_WANTS_RESET; + } + + if (mpic->flags & MPIC_WANTS_RESET) { + printk(KERN_DEBUG "mpic: Resetting\n"); mpic_write(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0), mpic_read(mpic->gregs, MPIC_INFO(GREG_GLOBAL_CONF_0)) | MPIC_GREG_GCONF_RESET); @@ -1246,7 +1291,6 @@ void __init mpic_set_default_senses(struct mpic *mpic, u8 *senses, int count) void __init mpic_init(struct mpic
[PATCH v3 2/4] powerpc: document the Open PIC device tree binding
This binding documents several properties that have been in use for quite some time, and adds one new property 'pic-no-reset', which controls the runtime initialization behavior of the PIC. More specifically, the presence of 'pic-no-reset' mandates that the PIC shall not be reset during runtime initialization and that any initialization related to interrupt sources shall be limited to sources explicitly referenced in the device tree. This functionality is useful in AMP systems where multiple OSes are sharing the PIC and the reinitialization of the PIC can interfere with OSes that are already up and running. The interrupt specifier definition is based off of Stuart Yoder's FSL MPIC binding. Signed-off-by: Meador Inge Cc: Hollis Blanchard Cc: Stuart Yoder --- Documentation/powerpc/dts-bindings/open-pic.txt | 98 +++ 1 files changed, 98 insertions(+), 0 deletions(-) create mode 100644 Documentation/powerpc/dts-bindings/open-pic.txt diff --git a/Documentation/powerpc/dts-bindings/open-pic.txt b/Documentation/powerpc/dts-bindings/open-pic.txt new file mode 100644 index 000..909a902 --- /dev/null +++ b/Documentation/powerpc/dts-bindings/open-pic.txt @@ -0,0 +1,98 @@ +* Open PIC Binding + +This binding specifies what properties must be available in the device tree +representation of an Open PIC compliant interrupt controller. This binding is +based on the binding defined for Open PIC in [1] and is a superset of that +binding. + +Required properties: + + NOTE: Many of these descriptions were paraphrased here from [1] to aid +readability. + +- compatible: Specifies the compatibility list for the PIC. The type + shall be and the value shall include "open-pic". + +- reg: Specifies the base physical address(s) and size(s) of this + PIC's addressable register space. The type shall be . + +- interrupt-controller: The presence of this property identifies the node + as an Open PIC. No property value shall be defined. + +- #interrupt-cells: Specifies the number of cells needed to encode an + interrupt source. The type shall be a and the value shall be 2. + +- #address-cells: Specifies the number of cells needed to encode an + address. The type shall be and the value shall be 0. As such, + 'interrupt-map' nodes do not have to specify a parent unit address. + +Optional properties: + +- pic-no-reset: The presence of this property indicates that the PIC + shall not be reset during runtime initialization. No property value shall + be defined. The presence of this property also mandates that any + initialization related to interrupt sources shall be limited to sources + explicitly referenced in the device tree. + +* Interrupt Specifier Definition + + Interrupt specifiers consists of 2 cells encoded as + follows: + +- <1st-cell>: The interrupt-number that identifies the interrupt source. + +- <2nd-cell>: The level-sense information, encoded as follows: +0 = low-to-high edge triggered +1 = active low level-sensitive +2 = active high level-sensitive +3 = high-to-low edge triggered + +* Examples + +Example 1: + + /* +* An Open PIC interrupt controller +*/ + mpic: pic@4 { + // This is an interrupt controller node. + interrupt-controller; + + // No address cells so that 'interrupt-map' nodes which reference + // this Open PIC node do not need a parent address specifier. + #address-cells = <0>; + + // Two cells to encode interrupt sources. + #interrupt-cells = <2>; + + // Offset address of 0x4 and size of 0x4. + reg = <0x4 0x4>; + + // Compatible with Open PIC. + compatible = "open-pic"; + + // The PIC shall not be reset. + pic-no-reset; + }; + +Example 2: + + /* +* An interrupt generating device that is wired to an Open PIC. +*/ + serial0: serial@4500 { + // Interrupt source '42' that is active high level-sensitive. + // Note that there are only two cells as specified in the interrupt + // parent's '#interrupt-cells' property. + interrupts = <42 2>; + + // The interrupt controller that this device is wired to. + interrupt-parent = <&mpic>; + }; + +* References + +[1] Power.org (TM) Standard for Embedded Power Architecture (TM) Platform +Requirements (ePAPR), Version 1.0, July 2008. +(http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf) + -- 1.6.3.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v3 1/4] powerpc: Removing support for 'protected-sources'
In a recent thread [1,2,3] concerning device trees for AMP systems, the question of whether we really need 'protected-sources' arose. The general consensus was that a new boolean property 'pic-no-reset' (described in more detail in a following patch) could be expanded to cover the use cases that 'protected-sources' was covering. One concern that was raised was for legacy systems which already use the 'protected-sources' property [4]. For legacy use cases, 'protected-sources' will be treated as an alias of 'pic-no-reset'. The sources encoded in the 'protected-sources' cells, however, will not be processed. This legacy check is added in a later patch in the series. [1] http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-January/004038.html [2] http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-January/003991.html [3] http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-January/004043.html [4] http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-February/004254.html Signed-off-by: Meador Inge Cc: Hollis Blanchard Cc: Benjamin Herrenschmidt --- arch/powerpc/include/asm/mpic.h |3 --- arch/powerpc/sysdev/mpic.c | 38 -- 2 files changed, 0 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/include/asm/mpic.h b/arch/powerpc/include/asm/mpic.h index e000cce..9b94f18 100644 --- a/arch/powerpc/include/asm/mpic.h +++ b/arch/powerpc/include/asm/mpic.h @@ -301,9 +301,6 @@ struct mpic struct mpic_reg_bankcpuregs[MPIC_MAX_CPUS]; struct mpic_reg_bankisus[MPIC_MAX_ISU]; - /* Protected sources */ - unsigned long *protected; - #ifdef CONFIG_MPIC_WEIRD /* Pointer to HW info array */ u32 *hw_set; diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index 7c13426..a98f41d 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -947,8 +947,6 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq, if (hw == mpic->spurious_vec) return -EINVAL; - if (mpic->protected && test_bit(hw, mpic->protected)) - return -EINVAL; #ifdef CONFIG_SMP else if (hw >= mpic->ipi_vecs[0]) { @@ -1095,26 +1093,6 @@ struct mpic * __init mpic_alloc(struct device_node *node, if (node && of_get_property(node, "big-endian", NULL) != NULL) mpic->flags |= MPIC_BIG_ENDIAN; - /* Look for protected sources */ - if (node) { - int psize; - unsigned int bits, mapsize; - const u32 *psrc = - of_get_property(node, "protected-sources", &psize); - if (psrc) { - psize /= 4; - bits = intvec_top + 1; - mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); - mpic->protected = kzalloc(mapsize, GFP_KERNEL); - BUG_ON(mpic->protected == NULL); - for (i = 0; i < psize; i++) { - if (psrc[i] > intvec_top) - continue; - __set_bit(psrc[i], mpic->protected); - } - } - } - #ifdef CONFIG_MPIC_WEIRD mpic->hw_set = mpic_infos[MPIC_GET_REGSET(flags)]; #endif @@ -1321,9 +1299,6 @@ void __init mpic_init(struct mpic *mpic) u32 vecpri = MPIC_VECPRI_MASK | i | (8 << MPIC_VECPRI_PRIORITY_SHIFT); - /* check if protected */ - if (mpic->protected && test_bit(i, mpic->protected)) - continue; /* init hw */ mpic_irq_write(i, MPIC_INFO(IRQ_VECTOR_PRI), vecpri); mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu); @@ -1492,13 +1467,6 @@ static unsigned int _mpic_get_one_irq(struct mpic *mpic, int reg) mpic_eoi(mpic); return NO_IRQ; } - if (unlikely(mpic->protected && test_bit(src, mpic->protected))) { - if (printk_ratelimit()) - printk(KERN_WARNING "%s: Got protected source %d !\n", - mpic->name, (int)src); - mpic_eoi(mpic); - return NO_IRQ; - } return irq_linear_revmap(mpic->irqhost, src); } @@ -1532,12 +1500,6 @@ unsigned int mpic_get_coreint_irq(void) mpic_eoi(mpic); return NO_IRQ; } - if (unlikely(mpic->protected && test_bit(src, mpic->protected))) { - if (printk_ratelimit()) - printk(KERN_WARNING "%s: Got protected source %d !\n", - mpic->name, (int)src); - return NO_IRQ; - } return irq_linear_revmap(mpic->irqhost, src); #else -- 1.6.3.3 ___
[PATCH v3 0/4] powerpc: Open PIC binding and "pic-no-reset"
This patch set provides a binding for Open PIC and implements support for a new property, specified by that binding, called "pic-no-reset". With "pic-no-reset" in place the "protected-sources" property is no longer needed and its full implementation was removed. "protected-sources" is still checked for, however, for legacy purposes. For v3 of this patch the Open PIC binding was changed to be more consistent with existing bindings, several DTS files were cleaned up, "no-reset" was changed to "pic-no-reset", and a check to treat "protected-sources" as a synonym for "pic-no-reset" was added. Signed-off-by: Meador Inge Cc: Hollis Blanchard Meador Inge (4): powerpc: Removing support for 'protected-sources' powerpc: document the Open PIC device tree binding powerpc: make MPIC honor the "pic-no-reset" device tree property powerpc: Replacing "protected-sources" with "pic-no-reset" in DTS files Documentation/powerpc/dts-bindings/open-pic.txt | 98 ++ arch/powerpc/boot/dts/mpc8572ds_camp_core0.dts |6 +- arch/powerpc/boot/dts/mpc8572ds_camp_core1.dts | 11 +-- arch/powerpc/boot/dts/p2020rdb_camp_core0.dts |7 +-- arch/powerpc/boot/dts/p2020rdb_camp_core1.dts |7 +-- arch/powerpc/include/asm/mpic.h |7 +- arch/powerpc/sysdev/mpic.c | 102 --- 7 files changed, 157 insertions(+), 81 deletions(-) create mode 100644 Documentation/powerpc/dts-bindings/open-pic.txt ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: BootX
On Fri, 2011-02-04 at 11:21 -0600, kevin diggs wrote: > > P.S.: I posted some documentation for dump_stack()/show_stack() but > have not heard anything? Is that not something we are interested in > doing? Or I haven't had a chance to review it yet ... I'm very very busy at the moment so things are lagging a bit. Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: BootX
Hi, FYI: This driver has some pretty good diagnostics/debug capabilities built in. Once that is enabled it shows that the inquiry works and the sync negotiation works. The next command (I think) is test unit ready, which does not work. It is retried multiple times. The result is 2 which I think is DID_BUS_BUSY. Probably in mesh_start_cmd(), possibly something off in the loop at line 462? kevin P.S.: I posted some documentation for dump_stack()/show_stack() but have not heard anything? Is that not something we are interested in doing? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 4/6] powerpc/44x: don't use tlbivax on AMP systems
On Fri, 2011-02-04 at 08:56 -0500, Josh Boyer wrote: > On Tue, Feb 01, 2011 at 12:48:44PM -0600, Dave Kleikamp wrote: > >diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c > >index 2a030d8..b33c5e6 100644 > >--- a/arch/powerpc/mm/tlb_nohash.c > >+++ b/arch/powerpc/mm/tlb_nohash.c > >@@ -35,6 +35,7 @@ > > #include > > #include > > #include > >+#include > > > > #include > > #include > >@@ -153,6 +154,17 @@ EXPORT_SYMBOL(local_flush_tlb_page); > > */ > > #ifdef CONFIG_SMP > > > >+static int amp; > >+ > >+#ifdef CONFIG_44x > >+void __init early_init_mmu_44x(void) > >+{ > >+unsigned long root = of_get_flat_dt_root(); > >+if (of_flat_dt_is_compatible(root, "ibm,47x-AMP")) > >+amp = 1; > >+} > >+#endif /* CONFIG_44x */ > > Something aside from the property thing sits weirdly with me on this as > well. > > We have this guarded by CONFIG_44x but also CONFIG_SMP, and we're doing > 476 specific checks (for now). There is at least one 44x board that has > dual-CPUs (AMCC Arches, iirc) that can theoretically be run in AMP mode. > However, it won't be using an SMP kernel because it's a single core per CPU. > Admittedly I don't think it supports the tlbivax instruction either so > the patch as it stands doesn't impact that theoretical scenario much. I should have used CONFIG_PPC_47x here. > I do wonder if we really need to guard the call to this behind > CONFIG_SMP though. Maybe a slight performance increase I suppose, but > if we wind up using the AMP check elsewhere then it might be needed > anyway. Something to think about. I agree that it's awkward. The code affected by this is all behind CONFIG_SMP. There's no reason to use tlbivax, or the alternate ipi, in a uni kernel. An alternative would be to define early_init_mmu_44x (or 47x) outside of CONFIG_SMP, but the contents of the function would still be inside CONFIG_SMP, and it would be an empty function otherwise. > Oh, and I agree 'cooperative-partition' or something would be a better > check. I'm good with that then. > > josh -- Dave Kleikamp IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 5/6] powerpc/44x: boot wrapper: allow kernel to load into non-zero address
On Fri, 2011-02-04 at 09:07 -0500, Josh Boyer wrote: > On Tue, Feb 01, 2011 at 12:48:45PM -0600, Dave Kleikamp wrote: > >+static ibm4xx_memstart; > >+ > > static void iss_4xx_fixups(void) > > { > >-ibm4xx_sdram_fixup_memsize(); > >+void *memory; > >+u32 reg[3]; > >+ > >+memory = finddevice("/memory"); > >+if (!memory) > >+fatal("Can't find memory node\n"); > >+getprop(memory, "reg", reg, sizeof(reg)); > >+if (reg[1] || reg[2]) > > Wouldn't this test allow for a faulty device tree that specified a 0 > size (0x0 in reg[2])? Maybe just check reg[2] for non-zero instead? That make sense. > > josh -- Dave Kleikamp IBM Linux Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 5/6] powerpc/44x: boot wrapper: allow kernel to load into non-zero address
On Tue, Feb 01, 2011 at 12:48:45PM -0600, Dave Kleikamp wrote: >+static ibm4xx_memstart; >+ > static void iss_4xx_fixups(void) > { >- ibm4xx_sdram_fixup_memsize(); >+ void *memory; >+ u32 reg[3]; >+ >+ memory = finddevice("/memory"); >+ if (!memory) >+ fatal("Can't find memory node\n"); >+ getprop(memory, "reg", reg, sizeof(reg)); >+ if (reg[1] || reg[2]) Wouldn't this test allow for a faulty device tree that specified a 0 size (0x0 in reg[2])? Maybe just check reg[2] for non-zero instead? josh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 4/6] powerpc/44x: don't use tlbivax on AMP systems
On Tue, Feb 01, 2011 at 12:48:44PM -0600, Dave Kleikamp wrote: >diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c >index 2a030d8..b33c5e6 100644 >--- a/arch/powerpc/mm/tlb_nohash.c >+++ b/arch/powerpc/mm/tlb_nohash.c >@@ -35,6 +35,7 @@ > #include > #include > #include >+#include > > #include > #include >@@ -153,6 +154,17 @@ EXPORT_SYMBOL(local_flush_tlb_page); > */ > #ifdef CONFIG_SMP > >+static int amp; >+ >+#ifdef CONFIG_44x >+void __init early_init_mmu_44x(void) >+{ >+ unsigned long root = of_get_flat_dt_root(); >+ if (of_flat_dt_is_compatible(root, "ibm,47x-AMP")) >+ amp = 1; >+} >+#endif /* CONFIG_44x */ Something aside from the property thing sits weirdly with me on this as well. We have this guarded by CONFIG_44x but also CONFIG_SMP, and we're doing 476 specific checks (for now). There is at least one 44x board that has dual-CPUs (AMCC Arches, iirc) that can theoretically be run in AMP mode. However, it won't be using an SMP kernel because it's a single core per CPU. Admittedly I don't think it supports the tlbivax instruction either so the patch as it stands doesn't impact that theoretical scenario much. I do wonder if we really need to guard the call to this behind CONFIG_SMP though. Maybe a slight performance increase I suppose, but if we wind up using the AMP check elsewhere then it might be needed anyway. Something to think about. Oh, and I agree 'cooperative-partition' or something would be a better check. josh ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 1/3] powerpc: Removing support for 'protected-sources'
On Friday 04 February 2011, Meador Inge wrote: > On 02/03/2011 09:56 AM, Arnd Bergmann wrote: > So in 'mpic_init' we don't initialize anything and then in > 'mpic_host_map' we lazily do the VECPRI and CPU binding initialization with: > > if (!(mpic->flags & MPIC_WANTS_RESET)) > if (!(mpic_is_ipi(mpic, hw) > || mpic_is_timer_interrupt(mpic, hw))) > mpic_init_vector(mpic, hw); > > Thus when 'no-reset' is thrown it ensures that only the sources which > are mentioned in the device tree are actually initialized. The net > effect should be the same as what 'protected-sources' was accomplishing, > but without having to maintain the list of sources in the property cell. That sounds like a good idea, but unfortunately, it's not what SLOF implements on QS21/QS22. It's a legacy product and there won't be any firmware updates. Moreover, it relies on the open firmware implementation and cannot boot with a flattened device tree image, so I don't see how your patch can work on the old systems. Maybe you can treat the presence of a 'protected-sources' property the same way that you treat the no-reset property? Arnd ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev