Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 11:27:31AM +0800, Barry Song wrote: [...] > > How about we add a non_jedec flag in platform_data, if the flag is 1, we > > let the detection pass even though the ID is 0? Otherwise, we need a > > valid ID? > Here i mean: This will break at least OF-enabled platforms (e.g. PowerPC), they assume that the driver will success for non-JEDEC flashes. OF platforms don't pass platform data, and even if they did, device tree doesn't specify if the flash is JEDEC or non-JEDEC. Which is why I think that, by default, the driver should successfully register the flash even if JEDEC probe fails. So, instead of checking for "!non_jedec", I would recommend "force_jedec" check. > Index: drivers/mtd/devices/m25p80.c > === > --- drivers/mtd/devices/m25p80.c (revision 8927) > +++ drivers/mtd/devices/m25p80.c (revision 8929) > @@ -795,8 +795,13 @@ > > jid = jedec_probe(spi); > if (!jid) { > - dev_info(&spi->dev, "non-JEDEC variant of %s\n", > - id->name); > + if (!data->non_jedec) { > + dev_err(&spi->dev, "fail to detect%s\n", > + id->name); > + return -ENODEV; > + } else > + dev_info(&spi->dev, "non-JEDEC variant of %s\n", > + id->name); > } else if (jid != id) { -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 3:15 PM, Anton Vorontsov wrote: > On Mon, Jun 21, 2010 at 11:27:31AM +0800, Barry Song wrote: > [...] >> > How about we add a non_jedec flag in platform_data, if the flag is 1, we >> > let the detection pass even though the ID is 0? Otherwise, we need a >> > valid ID? >> Here i mean: > > This will break at least OF-enabled platforms (e.g. PowerPC), > they assume that the driver will success for non-JEDEC flashes. > OF platforms don't pass platform data, and even if they did, > device tree doesn't specify if the flash is JEDEC or non-JEDEC. > > Which is why I think that, by default, the driver should > successfully register the flash even if JEDEC probe fails. So, > instead of checking for "!non_jedec", I would recommend > "force_jedec" check. Mike Frysinger suggested to use non_jedec since most devices are standard jedec devices. Only if non_jedec=1, we let the detection pass if ID is 0. > >> Index: drivers/mtd/devices/m25p80.c >> === >> --- drivers/mtd/devices/m25p80.c (revision 8927) >> +++ drivers/mtd/devices/m25p80.c (revision 8929) >> @@ -795,8 +795,13 @@ >> >> jid = jedec_probe(spi); >> if (!jid) { >> - dev_info(&spi->dev, "non-JEDEC variant of %s\n", >> - id->name); >> + if (!data->non_jedec) { >> + dev_err(&spi->dev, "fail to detect%s\n", >> + id->name); >> + return -ENODEV; >> + } else >> + dev_info(&spi->dev, "non-JEDEC variant of >> %s\n", >> + id->name); >> } else if (jid != id) { > > -- > Anton Vorontsov > email: cbouatmai...@gmail.com > irc://irc.freenode.net/bd2 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 03:22:48PM +0800, Barry Song wrote: > On Mon, Jun 21, 2010 at 3:15 PM, Anton Vorontsov > wrote: > > On Mon, Jun 21, 2010 at 11:27:31AM +0800, Barry Song wrote: > > [...] > >> > How about we add a non_jedec flag in platform_data, if the flag is 1, we > >> > let the detection pass even though the ID is 0? Otherwise, we need a > >> > valid ID? > >> Here i mean: > > > > This will break at least OF-enabled platforms (e.g. PowerPC), > > they assume that the driver will success for non-JEDEC flashes. > > OF platforms don't pass platform data, and even if they did, > > device tree doesn't specify if the flash is JEDEC or non-JEDEC. > > > > Which is why I think that, by default, the driver should > > successfully register the flash even if JEDEC probe fails. So, > > instead of checking for "!non_jedec", I would recommend > > "force_jedec" check. > > Mike Frysinger suggested to use non_jedec since most devices are > standard jedec devices. Well, on OF platforms most devices that I'm aware of are non-JEDEC. > Only if non_jedec=1, we let the detection pass > if ID is 0. Then please #ifdef it with CONFIG_OF. Thanks, > >> Index: drivers/mtd/devices/m25p80.c > >> === > >> --- drivers/mtd/devices/m25p80.c (revision 8927) > >> +++ drivers/mtd/devices/m25p80.c (revision 8929) > >> @@ -795,8 +795,13 @@ > >> > >> jid = jedec_probe(spi); > >> if (!jid) { > >> - dev_info(&spi->dev, "non-JEDEC variant of %s\n", > >> - id->name); > >> + if (!data->non_jedec) { > >> + dev_err(&spi->dev, "fail to detect%s\n", > >> + id->name); > >> + return -ENODEV; > >> + } else > >> + dev_info(&spi->dev, "non-JEDEC variant of > >> %s\n", > >> + id->name); > >> } else if (jid != id) { > > > > -- > > Anton Vorontsov > > email: cbouatmai...@gmail.com > > irc://irc.freenode.net/bd2 > > -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 3:39 PM, Anton Vorontsov wrote: > On Mon, Jun 21, 2010 at 03:22:48PM +0800, Barry Song wrote: >> On Mon, Jun 21, 2010 at 3:15 PM, Anton Vorontsov >> wrote: >> > On Mon, Jun 21, 2010 at 11:27:31AM +0800, Barry Song wrote: >> > [...] >> >> > How about we add a non_jedec flag in platform_data, if the flag is 1, we >> >> > let the detection pass even though the ID is 0? Otherwise, we need a >> >> > valid ID? >> >> Here i mean: >> > >> > This will break at least OF-enabled platforms (e.g. PowerPC), >> > they assume that the driver will success for non-JEDEC flashes. >> > OF platforms don't pass platform data, and even if they did, >> > device tree doesn't specify if the flash is JEDEC or non-JEDEC. >> > >> > Which is why I think that, by default, the driver should >> > successfully register the flash even if JEDEC probe fails. So, >> > instead of checking for "!non_jedec", I would recommend >> > "force_jedec" check. >> >> Mike Frysinger suggested to use non_jedec since most devices are >> standard jedec devices. > > Well, on OF platforms most devices that I'm aware of are non-JEDEC. > >> Only if non_jedec=1, we let the detection pass >> if ID is 0. > > Then please #ifdef it with CONFIG_OF. I think the patch has nothing to do with platform. Here SPI Flash is a peripherals, doesn't depend on any platform. Adding a CONFIG_OF doesn't make sense very much. If you think most devices are non-JEDEC, we can change non_JEDEC to force_JEDEC as you said. But anyway, is that real that most devices are non_JEDEC? If not, I think we should change OF platform codes to fit with this patch. > > Thanks, > >> >> Index: drivers/mtd/devices/m25p80.c >> >> === >> >> --- drivers/mtd/devices/m25p80.c (revision 8927) >> >> +++ drivers/mtd/devices/m25p80.c (revision 8929) >> >> @@ -795,8 +795,13 @@ >> >> >> >> jid = jedec_probe(spi); >> >> if (!jid) { >> >> - dev_info(&spi->dev, "non-JEDEC variant of %s\n", >> >> - id->name); >> >> + if (!data->non_jedec) { >> >> + dev_err(&spi->dev, "fail to detect%s\n", >> >> + id->name); >> >> + return -ENODEV; >> >> + } else >> >> + dev_info(&spi->dev, "non-JEDEC variant of >> >> %s\n", >> >> + id->name); >> >> } else if (jid != id) { >> > >> > -- >> > Anton Vorontsov >> > email: cbouatmai...@gmail.com >> > irc://irc.freenode.net/bd2 >> > > > -- > Anton Vorontsov > email: cbouatmai...@gmail.com > irc://irc.freenode.net/bd2 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 06:31:44PM +0800, Barry Song wrote: > On Mon, Jun 21, 2010 at 3:39 PM, Anton Vorontsov > wrote: > > On Mon, Jun 21, 2010 at 03:22:48PM +0800, Barry Song wrote: > >> On Mon, Jun 21, 2010 at 3:15 PM, Anton Vorontsov > >> wrote: > >> > On Mon, Jun 21, 2010 at 11:27:31AM +0800, Barry Song wrote: > >> > [...] > >> >> > How about we add a non_jedec flag in platform_data, if the flag is 1, > >> >> > we > >> >> > let the detection pass even though the ID is 0? Otherwise, we need a > >> >> > valid ID? > >> >> Here i mean: > >> > > >> > This will break at least OF-enabled platforms (e.g. PowerPC), > >> > they assume that the driver will success for non-JEDEC flashes. > >> > OF platforms don't pass platform data, and even if they did, > >> > device tree doesn't specify if the flash is JEDEC or non-JEDEC. > >> > > >> > Which is why I think that, by default, the driver should > >> > successfully register the flash even if JEDEC probe fails. So, > >> > instead of checking for "!non_jedec", I would recommend > >> > "force_jedec" check. > >> > >> Mike Frysinger suggested to use non_jedec since most devices are > >> standard jedec devices. > > > > Well, on OF platforms most devices that I'm aware of are non-JEDEC. > > > >> Only if non_jedec=1, we let the detection pass > >> if ID is 0. > > > > Then please #ifdef it with CONFIG_OF. > I think the patch has nothing to do with platform. Here SPI Flash is a > peripherals, doesn't depend on any platform. Adding a CONFIG_OF > doesn't make sense very much. With OF we don't place non-existent devices into the device tree (or we mark them with status = "not-ok/disabled/absent" property). > If you think most devices are non-JEDEC, we can change non_JEDEC to > force_JEDEC as you said. > But anyway, is that real that most devices are non_JEDEC? Why would this matter? We have to support both. > If not, I think we should change OF platform codes to > fit with this patch. You can't easily change OF. It's like "let's change ACPI tables or BIOS in these PCs". Doable, but involves things like reflashing. And we usually have to support old BIOSes as well. OTOH, I see (git grep m25p arch/powerpc/boot/dts/) that in mainline kernel only MPC8569 board has a correct m25p node, and it is STMicro variant (it is JEDEC capable). As we don't really have to support out of tree code, I'd just go with this patch, assuming that we have to change device tree for boards with non-JEDEC flashes. It's effectively the same thing as platform data flag, except that it works automatically for OF platforms. Signed-off-by: Anton Vorontsov --- diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index 81e49a9..a610ca9 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -680,6 +680,16 @@ static const struct spi_device_id m25p_ids[] = { { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, + { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, + { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, + { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) }, + { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) }, + { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) }, + { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) }, + { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) }, + { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) }, + { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) }, + { "m45pe10", INFO(0x204011, 0, 64 * 1024,2, 0) }, { "m45pe80", INFO(0x204014, 0, 64 * 1024, 16, 0) }, { "m45pe16", INFO(0x204015, 0, 64 * 1024, 32, 0) }, @@ -795,8 +805,7 @@ static int __devinit m25p_probe(struct spi_device *spi) jid = jedec_probe(spi); if (!jid) { - dev_info(&spi->dev, "non-JEDEC variant of %s\n", -id->name); + return -ENODEV; } else if (jid != id) { /* * JEDEC knows better, so overwrite platform ID. We ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] KVM: PPC: Make BAT only guest segments work
When a guest sets its SR entry to invalid, we may still find a corresponding entry in a BAT. So we need to make sure we're not faulting on invalid SR entries, but instead just claim them to be BAT resolved. This resolves breakage experienced when using libogc based guests. Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_32_mmu.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c index 0b10503..3292d76 100644 --- a/arch/powerpc/kvm/book3s_32_mmu.c +++ b/arch/powerpc/kvm/book3s_32_mmu.c @@ -354,10 +354,10 @@ static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid, *vsid = VSID_REAL_DR | gvsid; break; case MSR_DR|MSR_IR: - if (!sr->valid) - return -1; - - *vsid = sr->vsid; + if (sr->valid) + *vsid = sr->vsid; + else + *vsid = VSID_BAT | gvsid; break; default: BUG(); -- 1.6.0.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] KVM: PPC: Use kernel hash function
The linux kernel already provides a hash function. Let's reuse that instead of reinventing the wheel! Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_32_mmu_host.c | 10 ++ arch/powerpc/kvm/book3s_64_mmu_host.c | 11 ++- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index 0bb6600..37779a5 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c @@ -19,6 +19,7 @@ */ #include +#include #include #include @@ -182,14 +183,7 @@ static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu) * a hash, so we don't waste cycles on looping */ static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid) { - return (u16)(((gvsid >> (SID_MAP_BITS * 7)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 6)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 5)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 4)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 3)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 2)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 1)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 0)) & SID_MAP_MASK)); + return hash_64(gvsid, SID_MAP_BITS); } diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index e4b5744..5d0e281 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c @@ -20,6 +20,7 @@ */ #include +#include #include #include @@ -164,17 +165,9 @@ static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu) * a hash, so we don't waste cycles on looping */ static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid) { - return (u16)(((gvsid >> (SID_MAP_BITS * 7)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 6)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 5)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 4)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 3)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 2)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 1)) & SID_MAP_MASK) ^ -((gvsid >> (SID_MAP_BITS * 0)) & SID_MAP_MASK)); + return hash_64(gvsid, SID_MAP_BITS); } - static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid) { struct kvmppc_sid_map *map; -- 1.6.0.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] KVM: PPC: Remove obsolete kvmppc_mmu_find_pte
Initially we had to search for pte entries to invalidate them. Since the logic has improved since then, we can just get rid of the search function. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/kvm_book3s.h |1 - arch/powerpc/kvm/book3s_32_mmu_host.c | 20 arch/powerpc/kvm/book3s_64_mmu_host.c | 20 3 files changed, 0 insertions(+), 41 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index 6f74d93..4e99559 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h @@ -115,7 +115,6 @@ extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); -extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index 37779a5..904f5ac 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c @@ -151,26 +151,6 @@ void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end) } } -struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data) -{ - int i; - u64 guest_vp; - - guest_vp = vcpu->arch.mmu.ea_to_vp(vcpu, ea, false); - for (i=0; iarch.hpte_cache_offset; i++) { - struct hpte_cache *pte; - - pte = &vcpu->arch.hpte_cache[i]; - if (!pte->host_va) - continue; - - if (pte->pte.vpage == guest_vp) - return &pte->pte; - } - - return NULL; -} - static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu) { if (vcpu->arch.hpte_cache_offset == HPTEG_CACHE_NUM) diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c index 5d0e281..4ccdde1 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c @@ -133,26 +133,6 @@ void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end) } } -struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data) -{ - int i; - u64 guest_vp; - - guest_vp = vcpu->arch.mmu.ea_to_vp(vcpu, ea, false); - for (i=0; iarch.hpte_cache_offset; i++) { - struct hpte_cache *pte; - - pte = &vcpu->arch.hpte_cache[i]; - if (!pte->host_va) - continue; - - if (pte->pte.vpage == guest_vp) - return &pte->pte; - } - - return NULL; -} - static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu) { if (vcpu->arch.hpte_cache_offset == HPTEG_CACHE_NUM) -- 1.6.0.2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] KVM: PPC: Add generic hpte management functions
Currently the shadow paging code keeps an array of entries it knows about. Whenever the guest invalidates an entry, we loop through that entry, trying to invalidate matching parts. While this is a really simple implementation, it is probably the most ineffective one possible. So instead, let's keep an array of lists around that are indexed by a hash. This way each PTE can be added by 4 list_add, removed by 4 list_del invocations and the search only needs to loop through entries that share the same hash. This patch implements said lookup and exports generic functions that both the 32-bit and 64-bit backend can use. Signed-off-by: Alexander Graf --- arch/powerpc/kvm/book3s_mmu_hpte.c | 287 1 files changed, 287 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/kvm/book3s_mmu_hpte.c diff --git a/arch/powerpc/kvm/book3s_mmu_hpte.c b/arch/powerpc/kvm/book3s_mmu_hpte.c new file mode 100644 index 000..8ee0f1e --- /dev/null +++ b/arch/powerpc/kvm/book3s_mmu_hpte.c @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2010 SUSE Linux Products GmbH. All rights reserved. + * + * Authors: + * Alexander Graf + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#define PTE_SIZE 12 + +/* #define DEBUG_MMU */ +/* #define DEBUG_SLB */ + +#ifdef DEBUG_MMU +#define dprintk_mmu(a, ...) printk(KERN_INFO a, __VA_ARGS__) +#else +#define dprintk_mmu(a, ...) do { } while(0) +#endif + +#ifdef DEBUG_SLB +#define dprintk_slb(a, ...) printk(KERN_INFO a, __VA_ARGS__) +#else +#define dprintk_slb(a, ...) do { } while(0) +#endif + +static inline u64 kvmppc_mmu_hash_pte(u64 eaddr) { + return hash_64(eaddr >> PTE_SIZE, HPTEG_HASH_BITS); +} + +static inline u64 kvmppc_mmu_hash_vpte(u64 vpage) { + return hash_64(vpage & 0xfULL, HPTEG_HASH_BITS); +} + +static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage) { + return hash_64((vpage & 0xff000ULL) >> 12, HPTEG_HASH_BITS); +} + +void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte) +{ + u64 index; + + /* Add to ePTE list */ + index = kvmppc_mmu_hash_pte(pte->pte.eaddr); + list_add(&pte->list_pte, &vcpu->arch.hpte_hash_pte[index]); + + /* Add to vPTE list */ + index = kvmppc_mmu_hash_vpte(pte->pte.vpage); + list_add(&pte->list_vpte, &vcpu->arch.hpte_hash_vpte[index]); + + /* Add to vPTE_long list */ + index = kvmppc_mmu_hash_vpte_long(pte->pte.vpage); + list_add(&pte->list_vpte_long, &vcpu->arch.hpte_hash_vpte_long[index]); + + /* Add to all list */ + list_add(&pte->list_all, &vcpu->arch.hpte_all); +} + +static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) +{ + dprintk_mmu("KVM: Flushing SPT: 0x%lx (0x%llx) -> 0x%llx\n", + pte->pte.eaddr, pte->pte.vpage, pte->host_va); + + /* Different for 32 and 64 bit */ + kvmppc_mmu_invalidate_pte(vcpu, pte); + + if (pte->pte.may_write) + kvm_release_pfn_dirty(pte->pfn); + else + kvm_release_pfn_clean(pte->pfn); + + list_del(&pte->list_pte); + list_del(&pte->list_vpte); + list_del(&pte->list_vpte_long); + list_del(&pte->list_all); + + kmem_cache_free(vcpu->arch.hpte_cache, pte); +} + +static void kvmppc_mmu_pte_flush_all(struct kvm_vcpu *vcpu) +{ + struct hpte_cache *pte, *tmp; + + list_for_each_entry_safe(pte, tmp, &vcpu->arch.hpte_all, list_all) { + /* Jump over the helper entry */ + if (&pte->list_all == &vcpu->arch.hpte_all) + continue; + + invalidate_pte(vcpu, pte); + } +} + +void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask) +{ + u64 i; + + dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%lx & 0x%lx\n", + vcpu->arch.hpte_cache_count, guest_ea, ea_mask); + + switch (ea_mask) { + case ~0xfffUL: + { + struct list_head *list; + struct hpte_cache *pte, *tmp; + + /* Find the list of entries in the map */ + list = &vcpu->arch.hpte_hash_pte[kvmppc_mmu_hash_pte(guest_ea)]; + + /* Check the list for matching entries */ + lis
[PATCH 2/2] KVM: PPC: Make use of hash based Shadow MMU
We just introduced generic functions to handle shadow pages on PPC. This patch makes the respective backends make use of them, getting rid of a lot of duplicate code along the way. Signed-off-by: Alexander Graf --- arch/powerpc/include/asm/kvm_book3s.h |7 ++ arch/powerpc/include/asm/kvm_host.h | 16 - arch/powerpc/kvm/Makefile |2 + arch/powerpc/kvm/book3s_32_mmu_host.c | 104 +++- arch/powerpc/kvm/book3s_64_mmu_host.c | 98 ++ 5 files changed, 39 insertions(+), 188 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index 4e99559..a96e405 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h @@ -115,6 +115,13 @@ extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu); extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); + +extern void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte); +extern struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu); +extern void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu); +extern int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu); +extern void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte); + extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index 0c9ad86..0e3fc82 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -38,7 +38,9 @@ #define KVM_NR_PAGE_SIZES 1 #define KVM_PAGES_PER_HPAGE(x) (1UL<<31) -#define HPTEG_CACHE_NUM 1024 +#define HPTEG_CACHE_NUM(1 << 15) +#define HPTEG_HASH_BITS13 +#define HPTEG_HASH_NUM (1 << HPTEG_HASH_BITS) struct kvm; struct kvm_run; @@ -151,6 +153,10 @@ struct kvmppc_mmu { }; struct hpte_cache { + struct list_head list_all; + struct list_head list_pte; + struct list_head list_vpte; + struct list_head list_vpte_long; u64 host_va; u64 pfn; ulong slot; @@ -282,8 +288,12 @@ struct kvm_vcpu_arch { unsigned long pending_exceptions; #ifdef CONFIG_PPC_BOOK3S - struct hpte_cache hpte_cache[HPTEG_CACHE_NUM]; - int hpte_cache_offset; + struct kmem_cache *hpte_cache; + struct list_head hpte_hash_pte[HPTEG_HASH_NUM]; + struct list_head hpte_hash_vpte[HPTEG_HASH_NUM]; + struct list_head hpte_hash_vpte_long[HPTEG_HASH_NUM]; + struct list_head hpte_all; + int hpte_cache_count; #endif }; diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile index ff43606..d45c818 100644 --- a/arch/powerpc/kvm/Makefile +++ b/arch/powerpc/kvm/Makefile @@ -45,6 +45,7 @@ kvm-book3s_64-objs := \ book3s.o \ book3s_emulate.o \ book3s_interrupts.o \ + book3s_mmu_hpte.o \ book3s_64_mmu_host.o \ book3s_64_mmu.o \ book3s_32_mmu.o @@ -57,6 +58,7 @@ kvm-book3s_32-objs := \ book3s.o \ book3s_emulate.o \ book3s_interrupts.o \ + book3s_mmu_hpte.o \ book3s_32_mmu_host.o \ book3s_32_mmu.o kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs) diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c index 904f5ac..0b51ef8 100644 --- a/arch/powerpc/kvm/book3s_32_mmu_host.c +++ b/arch/powerpc/kvm/book3s_32_mmu_host.c @@ -58,105 +58,19 @@ static ulong htab; static u32 htabmask; -static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) +void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) { volatile u32 *pteg; - dprintk_mmu("KVM: Flushing SPTE: 0x%llx (0x%llx) -> 0x%llx\n", - pte->pte.eaddr, pte->pte.vpage, pte->host_va); - + /* Remove from host HTAB */ pteg = (u32*)pte->slot; - pteg[0] = 0; + + /* And make sure it's gone from the TLB too */ asm volatile ("sync"); asm volatile ("tlbie %0" : : "r" (pte->pte.eaddr) : "memory"); asm volatile ("sync"); asm volatile ("tlbsync"); - - pte->host_va = 0; - - if (pte->pte.may_write) - kvm_release_pfn_dirty(pte->pfn); - else - kvm_release_pfn_clean(pte->pfn); -} - -void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask) -{ - int i; - - dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%x & 0x%x\n", - vcpu->arch.hpte_cache_offset, guest_ea, ea_mask); - BUG_O
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 07:20, Anton Vorontsov wrote: > You can't easily change OF. It's like "let's change ACPI tables > or BIOS in these PCs". Doable, but involves things like reflashing. > And we usually have to support old BIOSes as well. > > OTOH, I see (git grep m25p arch/powerpc/boot/dts/) that in > mainline kernel only MPC8569 board has a correct m25p > node, and it is STMicro variant (it is JEDEC capable). > > As we don't really have to support out of tree code, I'd > just go with this patch, assuming that we have to change > device tree for boards with non-JEDEC flashes. It's > effectively the same thing as platform data flag, except > that it works automatically for OF platforms. > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index 81e49a9..a610ca9 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -680,6 +680,16 @@ static const struct spi_device_id m25p_ids[] = { > { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, > { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, > > + { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, > + { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, > + { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) }, > + { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) }, > + { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) }, > + { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) }, > + { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) }, > + { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) }, > + { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) }, > + are you picking the m25p because its flash geometry matches whatever you're using, or because you have some weird variant of the m25p that has JEDEC commands removed ? -mike ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 12:34:05PM -0400, Mike Frysinger wrote: > On Mon, Jun 21, 2010 at 07:20, Anton Vorontsov wrote: > > You can't easily change OF. It's like "let's change ACPI tables > > or BIOS in these PCs". Doable, but involves things like reflashing. > > And we usually have to support old BIOSes as well. > > > > OTOH, I see (git grep m25p arch/powerpc/boot/dts/) that in > > mainline kernel only MPC8569 board has a correct m25p > > node, and it is STMicro variant (it is JEDEC capable). > > > > As we don't really have to support out of tree code, I'd > > just go with this patch, assuming that we have to change > > device tree for boards with non-JEDEC flashes. It's > > effectively the same thing as platform data flag, except > > that it works automatically for OF platforms. > > > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > > index 81e49a9..a610ca9 100644 > > --- a/drivers/mtd/devices/m25p80.c > > +++ b/drivers/mtd/devices/m25p80.c > > @@ -680,6 +680,16 @@ static const struct spi_device_id m25p_ids[] = { > > { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, > > { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, > > > > + { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, > > + { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, > > + { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) }, > > + { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) }, > > + { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) }, > > + { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) }, > > + { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) }, > > + { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) }, > > + { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) }, > > + > > are you picking the m25p because its flash geometry matches whatever > you're using, or because you have some weird variant of the m25p that > has JEDEC commands removed ? The latter. It's Numonyx M25Pxx flashes, see http://www.numonyx.com/Documents/Datasheets/M25P80.pdf The RDID instruction is available only for parts made with 110 nm Technology identified with Process letter '4'. -- Anton Vorontsov email: cbouatmai...@gmail.com irc://irc.freenode.net/bd2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [Uclinux-dist-devel] [PATCH 1/2] mtd: m25p80: Reworkprobing/JEDEC code
On Mon, Jun 21, 2010 at 12:47, Anton Vorontsov wrote: > On Mon, Jun 21, 2010 at 12:34:05PM -0400, Mike Frysinger wrote: >> On Mon, Jun 21, 2010 at 07:20, Anton Vorontsov wrote: >> > You can't easily change OF. It's like "let's change ACPI tables >> > or BIOS in these PCs". Doable, but involves things like reflashing. >> > And we usually have to support old BIOSes as well. >> > >> > OTOH, I see (git grep m25p arch/powerpc/boot/dts/) that in >> > mainline kernel only MPC8569 board has a correct m25p >> > node, and it is STMicro variant (it is JEDEC capable). >> > >> > As we don't really have to support out of tree code, I'd >> > just go with this patch, assuming that we have to change >> > device tree for boards with non-JEDEC flashes. It's >> > effectively the same thing as platform data flag, except >> > that it works automatically for OF platforms. >> > >> > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c >> > index 81e49a9..a610ca9 100644 >> > --- a/drivers/mtd/devices/m25p80.c >> > +++ b/drivers/mtd/devices/m25p80.c >> > @@ -680,6 +680,16 @@ static const struct spi_device_id m25p_ids[] = { >> > { "m25p64", INFO(0x202017, 0, 64 * 1024, 128, 0) }, >> > { "m25p128", INFO(0x202018, 0, 256 * 1024, 64, 0) }, >> > >> > + { "m25p05-nonjedec", INFO(0, 0, 32 * 1024, 2, 0) }, >> > + { "m25p10-nonjedec", INFO(0, 0, 32 * 1024, 4, 0) }, >> > + { "m25p20-nonjedec", INFO(0, 0, 64 * 1024, 4, 0) }, >> > + { "m25p40-nonjedec", INFO(0, 0, 64 * 1024, 8, 0) }, >> > + { "m25p80-nonjedec", INFO(0, 0, 64 * 1024, 16, 0) }, >> > + { "m25p16-nonjedec", INFO(0, 0, 64 * 1024, 32, 0) }, >> > + { "m25p32-nonjedec", INFO(0, 0, 64 * 1024, 64, 0) }, >> > + { "m25p64-nonjedec", INFO(0, 0, 64 * 1024, 128, 0) }, >> > + { "m25p128-nonjedec", INFO(0, 0, 256 * 1024, 64, 0) }, >> > + >> >> are you picking the m25p because its flash geometry matches whatever >> you're using, or because you have some weird variant of the m25p that >> has JEDEC commands removed ? > > The latter. It's Numonyx M25Pxx flashes, see > http://www.numonyx.com/Documents/Datasheets/M25P80.pdf > > The RDID instruction is available only for parts made with 110 > nm Technology identified with Process letter '4'. lovely. i guess this patch is the way to go to satisfy everyone's requirements. i'm also of the mindset that a mtd should not be created if the SPI flash isnt there simply because the resources say it might be. -mike ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] serial: Add missing call to init UCC UART port timeout
On Fri, Jun 18, 2010 at 8:22 AM, Chuck Meade wrote: > From: Chuck Meade > > The UCC UART driver is missing a call to uart_update_timeout(). > Without this call, attempting to close the port after outputting large > amounts of data (i.e. using tty and uart buffering) results in long > timeouts before the port will actually be shut down. > > For example, cat a large file to a UCC UART port. With the current > driver, the port will stay open for 30 seconds after the last byte > of data is output. But with this patch, the port is closed as > expected, just after the data has been output (tx fifos empty). > > Signed-off-by: Chuck Meade Acked-by: Timur Tabi -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
UCC interactions
I'm running 2.6.33.3 on MPC8358. I have UCC1+UCC2 working fine for ethernet, but when I add UCC3 as a UART, the network devices quit working. Here are my device tree entries: /* ETH0 (UCC1, MDIO 0x02, RMII) */ enet_eth0: ether...@2000 { device_type = "network"; compatible = "ucc_geth"; cell-index = <1>; reg = <0x2000 0x200>; interrupts = <32>; interrupt-parent = <&qeic>; local-mac-address = [ 00 00 00 00 00 00 ]; rx-clock-name = "none"; tx-clock-name = "clk16"; phy-handle = <&phy_eth0>; phy-connection-type = "rmii"; pio-handle = <&pio_ucc1>; linux,network-index = <0>; }; /* ETH1 (UCC2, MDIO 0x01, GMII) */ enet_eth1: ether...@3000 { device_type = "network"; compatible = "ucc_geth"; cell-index = <2>; reg = <0x3000 0x200>; interrupts = <33>; interrupt-parent = <&qeic>; local-mac-address = [ 00 00 00 00 00 00 ]; rx-clock-name = "clk4"; tx-clock-name = "none"; fixed-link = <1 1 1000 0 0>; phy-connection-type = "gmii"; pio-handle = <&pio_ucc2>; linux,network-index = <1>; }; /* ttyQE0 (UCC3) */ serial_qe0: ser...@4000 { device_type = "serial"; compatible = "ucc_uart"; cell-index = <3>; reg = <0x4000 0x200>; interrupts = <34>; interrupt-parent = <&qeic>; port-number = <0>; rx-clock-name = "brg1"; tx-clock-name = "brg1"; }; Are there known interactions between these two drivers/ports? Maybe there's something obviously wrong with my device tree? Thanks for any ideas/pointers -- Gary Thomas | Consulting for the MLB Associates |Embedded world ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: UCC interactions
I believe the offset for UCC3 is wrong. The usermanual says UCC3's registers are at 0x2200-0x23FF. 0x4000 is SDMA. Hope that helps. > -Original Message- > From: linuxppc-dev-bounces+blakeslees=embeddedplanet@lists.ozlabs.org > [mailto:linuxppc-dev- > bounces+blakeslees=embeddedplanet@lists.ozlabs.org] On Behalf Of Gary > Thomas > Sent: Monday, June 21, 2010 3:00 PM > To: Linux PPC Development > Subject: UCC interactions > > I'm running 2.6.33.3 on MPC8358. I have UCC1+UCC2 working fine > for ethernet, but when I add UCC3 as a UART, the network devices > quit working. > > Here are my device tree entries: > /* ETH0 (UCC1, MDIO 0x02, RMII) */ > enet_eth0: ether...@2000 { > device_type = "network"; > compatible = "ucc_geth"; > cell-index = <1>; > reg = <0x2000 0x200>; > interrupts = <32>; > interrupt-parent = <&qeic>; > local-mac-address = [ 00 00 00 00 00 00 ]; > rx-clock-name = "none"; > tx-clock-name = "clk16"; > phy-handle = <&phy_eth0>; > phy-connection-type = "rmii"; > pio-handle = <&pio_ucc1>; > linux,network-index = <0>; > }; > > /* ETH1 (UCC2, MDIO 0x01, GMII) */ > enet_eth1: ether...@3000 { > device_type = "network"; > compatible = "ucc_geth"; > cell-index = <2>; > reg = <0x3000 0x200>; > interrupts = <33>; > interrupt-parent = <&qeic>; > local-mac-address = [ 00 00 00 00 00 00 ]; > rx-clock-name = "clk4"; > tx-clock-name = "none"; > fixed-link = <1 1 1000 0 0>; > phy-connection-type = "gmii"; > pio-handle = <&pio_ucc2>; > linux,network-index = <1>; > }; > > /* ttyQE0 (UCC3) */ > serial_qe0: ser...@4000 { > device_type = "serial"; > compatible = "ucc_uart"; > cell-index = <3>; > reg = <0x4000 0x200>; > interrupts = <34>; > interrupt-parent = <&qeic>; > port-number = <0>; > rx-clock-name = "brg1"; > tx-clock-name = "brg1"; > }; > > Are there known interactions between these two drivers/ports? > Maybe there's something obviously wrong with my device tree? > > Thanks for any ideas/pointers > > -- > > Gary Thomas | Consulting for the > MLB Associates |Embedded world > > ___ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev -- ExchangeDefender Message Security: Click below to verify authenticity http://www.exchangedefender.com/verify.asp?id=o5LJJcQU009752&from=blakesl...@embeddedplanet.com ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: UCC interactions
On 06/21/2010 01:19 PM, Steven Blakeslee wrote: I believe the offset for UCC3 is wrong. The usermanual says UCC3's registers are at 0x2200-0x23FF. 0x4000 is SDMA. Hope that helps. Looks like that was it (not sure where I got that value from!) Thanks -Original Message- From: linuxppc-dev-bounces+blakeslees=embeddedplanet@lists.ozlabs.org [mailto:linuxppc-dev- bounces+blakeslees=embeddedplanet@lists.ozlabs.org] On Behalf Of Gary Thomas Sent: Monday, June 21, 2010 3:00 PM To: Linux PPC Development Subject: UCC interactions I'm running 2.6.33.3 on MPC8358. I have UCC1+UCC2 working fine for ethernet, but when I add UCC3 as a UART, the network devices quit working. Here are my device tree entries: /* ETH0 (UCC1, MDIO 0x02, RMII) */ enet_eth0: ether...@2000 { device_type = "network"; compatible = "ucc_geth"; cell-index =<1>; reg =<0x2000 0x200>; interrupts =<32>; interrupt-parent =<&qeic>; local-mac-address = [ 00 00 00 00 00 00 ]; rx-clock-name = "none"; tx-clock-name = "clk16"; phy-handle =<&phy_eth0>; phy-connection-type = "rmii"; pio-handle =<&pio_ucc1>; linux,network-index =<0>; }; /* ETH1 (UCC2, MDIO 0x01, GMII) */ enet_eth1: ether...@3000 { device_type = "network"; compatible = "ucc_geth"; cell-index =<2>; reg =<0x3000 0x200>; interrupts =<33>; interrupt-parent =<&qeic>; local-mac-address = [ 00 00 00 00 00 00 ]; rx-clock-name = "clk4"; tx-clock-name = "none"; fixed-link =<1 1 1000 0 0>; phy-connection-type = "gmii"; pio-handle =<&pio_ucc2>; linux,network-index =<1>; }; /* ttyQE0 (UCC3) */ serial_qe0: ser...@4000 { device_type = "serial"; compatible = "ucc_uart"; cell-index =<3>; reg =<0x4000 0x200>; interrupts =<34>; interrupt-parent =<&qeic>; port-number =<0>; rx-clock-name = "brg1"; tx-clock-name = "brg1"; }; Are there known interactions between these two drivers/ports? Maybe there's something obviously wrong with my device tree? Thanks for any ideas/pointers -- Gary Thomas | Consulting for the MLB Associates |Embedded world ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev -- ExchangeDefender Message Security: Click below to verify authenticity http://www.exchangedefender.com/verify.asp?id=o5LJJcQU009752&from=blakesl...@embeddedplanet.com -- Gary Thomas | Consulting for the MLB Associates |Embedded world ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 3/5] of/address: Merge all of the bus translation code
On Thu, Jun 10, 2010 at 8:26 AM, Grant Likely wrote: > On Thu, Jun 10, 2010 at 12:43 AM, Benjamin Herrenschmidt > wrote: >> On Tue, 2010-06-08 at 08:10 -0600, Grant Likely wrote: >>> Microblaze and PowerPC share a large chunk of code for translating >>> OF device tree data into usable addresses. There aren't many differences >> >> Care to comment on these differences ? > > Purely cosmetic IIRC, but I will go back and double check. Things > like printk vs. pr_info and some style differences. I looked at them > side-by-side and fixed each difference individually until they were > identical. > >>> between the two, so merge the codebase wholesale rather than trying to >>> work out the independent bits. >> >> Well, I don't see ifdef's in the resulting code (but I'm a bit blind), >> so what did you do with the differences ? >> >> This is complex and fragile code, so any change to it must be very >> carefully scrutinized. Hi Ben, I've double checked side-by-side. The changes are all cosmetic expect for the addition of dma-ranges support on the powerpc version that hadn't been applied to microblaze. This patch takes the powerpc code plus the cosmetic changes (spaces, pr_debug vs DBG, etc) from the microblaze side. There should be no functional changes to either platform since microblaze doesn't currently use dma-ranges anyway. Here's the new commit text: of/address: Merge all of the bus translation code Microblaze and PowerPC share a large chunk of code for translating OF device tree data into usable addresses. Differences between the two consist of cosmetic differences, and the addition of dma-ranges support to powerpc but not microblaze. This patch moves the powerpc version into common code and applies many of the cosmetic (non-functional) changes from the microblaze version. I've only changed the commit text. The patch remains unchanged. Are you okay with this patch? Cheers, g. >> >> Cheers, >> Ben. >> >>> Signed-off-by: Grant Likely >>> CC: Michal Simek >>> CC: Wolfram Sang >>> CC: Stephen Rothwell >>> CC: Benjamin Herrenschmidt >>> CC: microblaze-ucli...@itee.uq.edu.au >>> CC: linuxppc-...@ozlabs.org ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 3/5] of/irq: merge of_irq_find_parent()
On Thu, Jun 10, 2010 at 12:38 AM, Benjamin Herrenschmidt wrote: > On Fri, 2010-06-04 at 15:21 -0600, Grant Likely wrote: >> Merge common code between PowerPC and Microblaze. Also create a new >> arch hook, of_irq_find_parent_by_phandle() to handle arch-specific >> quirks. > > First, you changeset comment should be much more verbose as to > what that arch specific quirk is about etc... it took me time to figure > it out again :-) > > I dislike the naming you use. Your "of_irq_find_parent_by_phandle" > doesn't ring "right" to me. > > I'm tempted to say we should put the quirks in the common code, your > attempt at "abstracting" them just makes the code much harder to follow. > > Also, if we stick to your approach the "default" variant should either > be an inline protected by an ifndef or a weak function. Alright, I've rewritten all the IRQ changes and I've left the quirk handling in common code, while moving the powermac quirk code into arch/powerpc/platforms/powermac. I'll repost today. g. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 0/5] Consolidate OF IRQ handling code
This series merges the common IRQ handling code between Microblaze and Powerpc Changes in v2: - The 3 patches to merge of_irq_find_parent(), of_irq_map_raw() and of_irq_map_one() have been merged into a single patch. - Patch added to move powermac quirk handing into arch/powerpc/platforms/powermac. - Add endian fixes patch from Rob Herring Ben, please take a look and let me know if you like this better. Thanks, g. --- Grant Likely (4): of/irq: Move irq_of_parse_and_map() to common code of/microblaze: strip out of_irq_workarounds code of/powerpc: Move Powermac irq quirk code into powermac pic driver code of/irq: merge irq mapping code Rob Herring (1): of/irq: little endian fixes arch/microblaze/include/asm/irq.h | 13 - arch/microblaze/include/asm/prom.h| 67 -- arch/microblaze/kernel/irq.c | 14 - arch/microblaze/kernel/prom_parse.c | 331 --- arch/powerpc/include/asm/irq.h| 13 - arch/powerpc/include/asm/prom.h | 68 -- arch/powerpc/kernel/irq.c | 14 - arch/powerpc/kernel/prom_parse.c | 351 - arch/powerpc/platforms/powermac/pic.c | 72 ++- arch/sparc/include/asm/prom.h |1 drivers/of/Kconfig|4 drivers/of/Makefile |1 drivers/of/irq.c | 339 drivers/of/of_mdio.c |1 include/linux/of_irq.h| 70 +++ 15 files changed, 487 insertions(+), 872 deletions(-) create mode 100644 drivers/of/irq.c create mode 100644 include/linux/of_irq.h ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 1/5] of/irq: Move irq_of_parse_and_map() to common code
Merge common code between PowerPC and Microblaze. SPARC implements irq_of_parse_and_map(), but the implementation is different, so it does not use this code. Signed-off-by: Grant Likely Acked-by: Benjamin Herrenschmidt Cc: Michal Simek Cc: "David S. Miller" Cc: Stephen Rothwell Cc: Jeremy Kerr --- arch/microblaze/include/asm/irq.h | 13 --- arch/microblaze/include/asm/prom.h | 26 +-- arch/microblaze/kernel/irq.c | 14 ++-- arch/powerpc/include/asm/irq.h | 13 --- arch/powerpc/include/asm/prom.h| 27 +--- arch/powerpc/kernel/irq.c | 14 ++-- arch/sparc/include/asm/prom.h |1 - drivers/of/Kconfig |4 drivers/of/Makefile|1 + drivers/of/irq.c | 37 drivers/of/of_mdio.c |1 + include/linux/of_irq.h | 41 12 files changed, 90 insertions(+), 102 deletions(-) create mode 100644 drivers/of/irq.c create mode 100644 include/linux/of_irq.h diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index 31a35c3..10d75c1 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -62,17 +62,4 @@ struct irq_host; extern unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq); -/** - * irq_create_of_mapping - Map a hardware interrupt into linux virq space - * @controller: Device node of the interrupt controller - * @inspec: Interrupt specifier from the device-tree - * @intsize: Size of the interrupt specifier from the device-tree - * - * This function is identical to irq_create_mapping except that it takes - * as input informations straight from the device-tree (typically the results - * of the of_irq_map_*() functions. - */ -extern unsigned int irq_create_of_mapping(struct device_node *controller, - u32 *intspec, unsigned int intsize); - #endif /* _ASM_MICROBLAZE_IRQ_H */ diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index e7d67a3..e9fb2eb 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h @@ -20,6 +20,7 @@ #ifndef __ASSEMBLY__ #include +#include #include #include #include @@ -92,18 +93,6 @@ extern const void *of_get_mac_address(struct device_node *np); * OF interrupt mapping */ -/* This structure is returned when an interrupt is mapped. The controller - * field needs to be put() after use - */ - -#define OF_MAX_IRQ_SPEC4 /* We handle specifiers of at most 4 cells */ - -struct of_irq { - struct device_node *controller; /* Interrupt controller node */ - u32 size; /* Specifier size */ - u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ -}; - /** * of_irq_map_init - Initialize the irq remapper * @flags: flags defining workarounds to enable @@ -139,19 +128,6 @@ extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, struct of_irq *out_irq); /** - * of_irq_map_one - Resolve an interrupt for a device - * @device:the device whose interrupt is to be resolved - * @index: index of the interrupt to resolve - * @out_irq: structure of_irq filled by this function - * - * This function resolves an interrupt, walking the tree, for a given - * device-tree node. It's the high level pendant to of_irq_map_raw(). - * It also implements the workarounds for OldWolrd Macs. - */ -extern int of_irq_map_one(struct device_node *device, int index, - struct of_irq *out_irq); - -/** * of_irq_map_pci - Resolve the interrupt for a PCI device * @pdev: the device whose interrupt is to be resolved * @out_irq: structure of_irq filled by this function diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c index 8f120ac..dd32b09 100644 --- a/arch/microblaze/kernel/irq.c +++ b/arch/microblaze/kernel/irq.c @@ -17,20 +17,10 @@ #include #include #include +#include #include -unsigned int irq_of_parse_and_map(struct device_node *dev, int index) -{ - struct of_irq oirq; - - if (of_irq_map_one(dev, index, &oirq)) - return NO_IRQ; - - return oirq.specifier[0]; -} -EXPORT_SYMBOL_GPL(irq_of_parse_and_map); - static u32 concurrent_irq; void __irq_entry do_IRQ(struct pt_regs *regs) @@ -104,7 +94,7 @@ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq) EXPORT_SYMBOL_GPL(irq_create_mapping); unsigned int irq_create_of_mapping(struct device_node *controller, - u32 *intspec, unsigned int intsize) + const u32 *intspec, unsigned int intsize) { return intspec[0]; } diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/
[PATCH v2 2/5] of/microblaze: strip out of_irq_workarounds code
Microblaze doesn't have any legacy workaround in the device tree irq mapping data. All of the of_irq_workarounds stuff can be dropped Signed-off-by: Grant Likely Cc: Michal Simek Cc: Stephen Rothwell --- arch/microblaze/include/asm/prom.h | 10 - arch/microblaze/kernel/prom_parse.c | 41 --- 2 files changed, 0 insertions(+), 51 deletions(-) diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index e9fb2eb..4f34bc5 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h @@ -93,19 +93,9 @@ extern const void *of_get_mac_address(struct device_node *np); * OF interrupt mapping */ -/** - * of_irq_map_init - Initialize the irq remapper - * @flags: flags defining workarounds to enable - * - * Some machines have bugs in the device-tree which require certain workarounds - * to be applied. Call this before any interrupt mapping attempts to enable - * those workarounds. - */ #define OF_IMAP_OLDWORLD_MAC 0x0001 #define OF_IMAP_NO_PHANDLE 0x0002 -extern void of_irq_map_init(unsigned int flags); - /** * of_irq_map_raw - Low level interrupt tree parsing * @parent:the device interrupt parent diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c index bf7e6c2..cba0581 100644 --- a/arch/microblaze/kernel/prom_parse.c +++ b/arch/microblaze/kernel/prom_parse.c @@ -676,47 +676,6 @@ static struct device_node *of_irq_find_parent(struct device_node *child) return p; } -/* This doesn't need to be called if you don't have any special workaround - * flags to pass - */ -void of_irq_map_init(unsigned int flags) -{ - of_irq_workarounds = flags; - - /* OldWorld, don't bother looking at other things */ - if (flags & OF_IMAP_OLDWORLD_MAC) - return; - - /* If we don't have phandles, let's try to locate a default interrupt -* controller (happens when booting with BootX). We do a first match -* here, hopefully, that only ever happens on machines with one -* controller. -*/ - if (flags & OF_IMAP_NO_PHANDLE) { - struct device_node *np; - - for (np = NULL; (np = of_find_all_nodes(np)) != NULL;) { - if (of_get_property(np, "interrupt-controller", NULL) - == NULL) - continue; - /* Skip /chosen/interrupt-controller */ - if (strcmp(np->name, "chosen") == 0) - continue; - /* It seems like at least one person on this planet -* wants to use BootX on a machine with an AppleKiwi -* controller which happens to pretend to be an -* interrupt controller too. -*/ - if (strcmp(np->name, "AppleKiwi") == 0) - continue; - /* I think we found one ! */ - of_irq_dflt_pic = np; - break; - } - } - -} - int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, const u32 *addr, struct of_irq *out_irq) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 4/5] of/irq: merge irq mapping code
Merge common irq mapping code between PowerPC and Microblaze. This patch merges of_irq_find_parent(), of_irq_map_raw() and of_irq_map_one(). The functions are dependent on one another, so all three are merged in a single patch. Other than cosmetic difference (ie. DBG() vs. pr_debug()), the implementations are identical. of_irq_to_resource() is also merged, but in this case the implementations are different. This patch drops the microblaze version and uses the powerpc implementation unchanged. The microblaze version essentially open-coded irq_of_parse_and_map() which it does not need to do. Therefore the powerpc version is safe to adopt. Signed-off-by: Grant Likely CC: Michal Simek CC: Benjamin Herrenschmidt CC: Stephen Rothwell --- arch/microblaze/include/asm/prom.h | 31 arch/microblaze/kernel/prom_parse.c | 290 -- arch/powerpc/include/asm/prom.h | 47 - arch/powerpc/kernel/prom_parse.c| 266 --- drivers/of/irq.c| 301 +++ include/linux/of_irq.h | 29 +++ 6 files changed, 330 insertions(+), 634 deletions(-) diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h index 4f34bc5..5fbdfe7 100644 --- a/arch/microblaze/include/asm/prom.h +++ b/arch/microblaze/include/asm/prom.h @@ -89,34 +89,6 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread); /* Get the MAC address */ extern const void *of_get_mac_address(struct device_node *np); -/* - * OF interrupt mapping - */ - -#define OF_IMAP_OLDWORLD_MAC 0x0001 -#define OF_IMAP_NO_PHANDLE 0x0002 - -/** - * of_irq_map_raw - Low level interrupt tree parsing - * @parent:the device interrupt parent - * @intspec: interrupt specifier ("interrupts" property of the device) - * @ointsize: size of the passed in interrupt specifier - * @addr: address specifier (start of "reg" property of the device) - * @out_irq: structure of_irq filled by this function - * - * Returns 0 on success and a negative number on error - * - * This function is a low-level interrupt tree walking function. It - * can be used to do a partial walk with synthetized reg and interrupts - * properties, for example when resolving PCI interrupts when no device - * node exist for the parent. - * - */ - -extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, - u32 ointsize, const u32 *addr, - struct of_irq *out_irq); - /** * of_irq_map_pci - Resolve the interrupt for a PCI device * @pdev: the device whose interrupt is to be resolved @@ -131,9 +103,6 @@ extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, struct pci_dev; extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); -extern int of_irq_to_resource(struct device_node *dev, int index, - struct resource *r); - /** * of_iomap - Maps the memory mapped IO for a given device_node * @device:the device whose io range will be mapped diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c index cba0581..e28968f 100644 --- a/arch/microblaze/kernel/prom_parse.c +++ b/arch/microblaze/kernel/prom_parse.c @@ -644,267 +644,6 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, *size = of_read_number(dma_window, cells); } -/* - * Interrupt remapper - */ - -static unsigned int of_irq_workarounds; -static struct device_node *of_irq_dflt_pic; - -static struct device_node *of_irq_find_parent(struct device_node *child) -{ - struct device_node *p; - const phandle *parp; - - if (!of_node_get(child)) - return NULL; - - do { - parp = of_get_property(child, "interrupt-parent", NULL); - if (parp == NULL) - p = of_get_parent(child); - else { - if (of_irq_workarounds & OF_IMAP_NO_PHANDLE) - p = of_node_get(of_irq_dflt_pic); - else - p = of_find_node_by_phandle(*parp); - } - of_node_put(child); - child = p; - } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL); - - return p; -} - -int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, - const u32 *addr, struct of_irq *out_irq) -{ - struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; - const u32 *tmp, *imap, *imask; - u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; - int imaplen, match, i; - - pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...]," - "ointsize=%d\n", - parent->full_name, intspec[0], intspec[1], ointsize); - - ipar = of_node_get(parent); - - /* First get th
[PATCH v2 5/5] of/irq: little endian fixes
From: Rob Herring Fix some endian issues in the irq mapping OF code. Signed-off-by: Rob Herring Signed-off-by: Grant Likely CC: Michal Simek CC: Wolfram Sang CC: Stephen Rothwell CC: Benjamin Herrenschmidt --- drivers/of/irq.c | 17 + 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 0b0518f..b68a924 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -87,7 +87,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, const u32 *addr, struct of_irq *out_irq) { struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; - const u32 *tmp, *imap, *imask; + const __be32 *tmp, *imap, *imask; u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; int imaplen, match, i; @@ -103,7 +103,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, do { tmp = of_get_property(ipar, "#interrupt-cells", NULL); if (tmp != NULL) { - intsize = *tmp; + intsize = be32_to_cpu(*tmp); break; } tnode = ipar; @@ -132,7 +132,7 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, } while (old && tmp == NULL); of_node_put(old); old = NULL; - addrsize = (tmp == NULL) ? 2 : *tmp; + addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp); pr_debug(" -> addrsize=%d\n", addrsize); @@ -144,8 +144,9 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, if (of_get_property(ipar, "interrupt-controller", NULL) != NULL) { pr_debug(" -> got it !\n"); - memcpy(out_irq->specifier, intspec, - intsize * sizeof(u32)); + for (i = 0; i < intsize; i++) + out_irq->specifier[i] = + of_read_number(intspec +i, 1); out_irq->size = intsize; out_irq->controller = ipar; of_node_put(old); @@ -215,9 +216,9 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, pr_debug(" -> parent lacks #interrupt-cells!\n"); goto fail; } - newintsize = *tmp; + newintsize = be32_to_cpu(*tmp); tmp = of_get_property(newpar, "#address-cells", NULL); - newaddrsize = (tmp == NULL) ? 0 : *tmp; + newaddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp); pr_debug(" -> newintsize=%d, newaddrsize=%d\n", newintsize, newaddrsize); @@ -299,7 +300,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq tmp = of_get_property(p, "#interrupt-cells", NULL); if (tmp == NULL) goto out; - intsize = *tmp; + intsize = be32_to_cpu(*tmp); pr_debug(" intsize=%d intlen=%d\n", intsize, intlen); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v2 3/5] of/powerpc: Move Powermac irq quirk code into powermac pic driver code
The code that figures out what is wrong with the powermac irq device tree data belongs with the rest of the powermac irq code. This patch moves it out of prom_parse.c and into powermac/pic.c so that it is only compiled in when actually needed. The quirk flags are also conditionally compiled out to discourage their use by other platforms. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Stephen Rothwell --- arch/powerpc/include/asm/prom.h | 24 ++--- arch/powerpc/kernel/prom_parse.c | 85 - arch/powerpc/platforms/powermac/pic.c | 72 ++-- 3 files changed, 81 insertions(+), 100 deletions(-) diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h index 47d41b6..4486765 100644 --- a/arch/powerpc/include/asm/prom.h +++ b/arch/powerpc/include/asm/prom.h @@ -109,18 +109,24 @@ extern const void *of_get_mac_address(struct device_node *np); * OF interrupt mapping */ -/** - * of_irq_map_init - Initialize the irq remapper - * @flags: flags defining workarounds to enable - * - * Some machines have bugs in the device-tree which require certain workarounds - * to be applied. Call this before any interrupt mapping attempts to enable - * those workarounds. - */ #define OF_IMAP_OLDWORLD_MAC 0x0001 #define OF_IMAP_NO_PHANDLE 0x0002 -extern void of_irq_map_init(unsigned int flags); +#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) +/* Workarounds only needed for 32bit powermac machines */ +extern unsigned int of_irq_workarounds; +extern struct device_node *of_irq_dflt_pic; +extern int of_irq_map_oldworld(struct device_node *device, int index, + struct of_irq *out_irq); +#else +#define of_irq_workarounds (0) +#define of_irq_dflt_pic (NULL) +static inline int of_irq_map_oldworld(struct device_node *device, int index, + struct of_irq *out_irq) +{ + return -EINVAL; +} +#endif /** * of_irq_map_raw - Low level interrupt tree parsing diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c index 8362620..dfa6de6 100644 --- a/arch/powerpc/kernel/prom_parse.c +++ b/arch/powerpc/kernel/prom_parse.c @@ -682,9 +682,6 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, * Interrupt remapper */ -static unsigned int of_irq_workarounds; -static struct device_node *of_irq_dflt_pic; - static struct device_node *of_irq_find_parent(struct device_node *child) { struct device_node *p; @@ -710,44 +707,6 @@ static struct device_node *of_irq_find_parent(struct device_node *child) return p; } -/* This doesn't need to be called if you don't have any special workaround - * flags to pass - */ -void of_irq_map_init(unsigned int flags) -{ - of_irq_workarounds = flags; - - /* OldWorld, don't bother looking at other things */ - if (flags & OF_IMAP_OLDWORLD_MAC) - return; - - /* If we don't have phandles, let's try to locate a default interrupt -* controller (happens when booting with BootX). We do a first match -* here, hopefully, that only ever happens on machines with one -* controller. -*/ - if (flags & OF_IMAP_NO_PHANDLE) { - struct device_node *np; - - for_each_node_with_property(np, "interrupt-controller") { - /* Skip /chosen/interrupt-controller */ - if (strcmp(np->name, "chosen") == 0) - continue; - /* It seems like at least one person on this planet wants -* to use BootX on a machine with an AppleKiwi controller -* which happens to pretend to be an interrupt -* controller too. -*/ - if (strcmp(np->name, "AppleKiwi") == 0) - continue; - /* I think we found one ! */ - of_irq_dflt_pic = np; - break; - } - } - -} - int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, const u32 *addr, struct of_irq *out_irq) { @@ -922,50 +881,6 @@ int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, } EXPORT_SYMBOL_GPL(of_irq_map_raw); -#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) -static int of_irq_map_oldworld(struct device_node *device, int index, - struct of_irq *out_irq) -{ - const u32 *ints = NULL; - int intlen; - - /* -* Old machines just have a list of interrupt numbers -* and no interrupt-controller nodes. We also have dodgy -* cases where the APPL,interrupts property is completely -* missing behind pci-pci bridges and we have to get it -* from the parent (th
Re: [PATCH 3/5] of/address: Merge all of the bus translation code
On Mon, 2010-06-21 at 15:06 -0600, Grant Likely wrote: > On Thu, Jun 10, 2010 at 8:26 AM, Grant Likely > wrote: > > On Thu, Jun 10, 2010 at 12:43 AM, Benjamin Herrenschmidt > > wrote: > >> On Tue, 2010-06-08 at 08:10 -0600, Grant Likely wrote: > >>> Microblaze and PowerPC share a large chunk of code for translating > >>> OF device tree data into usable addresses. There aren't many differences > >> > >> Care to comment on these differences ? > > > > Purely cosmetic IIRC, but I will go back and double check. Things > > like printk vs. pr_info and some style differences. I looked at them > > side-by-side and fixed each difference individually until they were > > identical. > > > >>> between the two, so merge the codebase wholesale rather than trying to > >>> work out the independent bits. > >> > >> Well, I don't see ifdef's in the resulting code (but I'm a bit blind), > >> so what did you do with the differences ? > >> > >> This is complex and fragile code, so any change to it must be very > >> carefully scrutinized. > > Hi Ben, > > I've double checked side-by-side. The changes are all cosmetic expect > for the addition of dma-ranges support on the powerpc version that > hadn't been applied to microblaze. This patch takes the powerpc code > plus the cosmetic changes (spaces, pr_debug vs DBG, etc) from the > microblaze side. There should be no functional changes to either > platform since microblaze doesn't currently use dma-ranges anyway. > > Here's the new commit text: Ok. Cheers ,Ben. > > of/address: Merge all of the bus translation code > > Microblaze and PowerPC share a large chunk of code for translating > OF device tree data into usable addresses. Differences between the two > consist of cosmetic differences, and the addition of dma-ranges support > to powerpc but not microblaze. This patch moves the powerpc > version into common code and applies many of the cosmetic (non-functional) > changes from the microblaze version. > > > I've only changed the commit text. The patch remains unchanged. Are > you okay with this patch? > > Cheers, > g. > > > >> > >> Cheers, > >> Ben. > >> > >>> Signed-off-by: Grant Likely > >>> CC: Michal Simek > >>> CC: Wolfram Sang > >>> CC: Stephen Rothwell > >>> CC: Benjamin Herrenschmidt > >>> CC: microblaze-ucli...@itee.uq.edu.au > >>> CC: linuxppc-...@ozlabs.org ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev