Re: [PATCH] USB: ehci-fsl: Turn on cache snooping on MPC8xxx
On Fri, Feb 17, 2012 at 1:57 PM, Pan Jiafei wrote: > If a MPC8xxx was being used, 'have_sysif_regs' should be set and > it should setup cache snooping for all the 4GB space on both PPC32 > and PPC64. > > Signed-off-by: Pan Jiafei Hi Jiafei, You should have sent this patch upstream earlier. I remember you asked about it a few months ago. :) Acked-by: Li Yang > --- > drivers/usb/host/ehci-fsl.c | 23 ++- > 1 files changed, 10 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c > index c26a82e..8327d3e 100644 > --- a/drivers/usb/host/ehci-fsl.c > +++ b/drivers/usb/host/ehci-fsl.c > @@ -252,21 +252,18 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci) > if (pdata->have_sysif_regs) { > temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); > out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); > - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); > - } > > -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > - /* > - * Turn on cache snooping hardware, since some PowerPC platforms > - * wholly rely on hardware to deal with cache coherent > - */ > + /* > + * Turn on cache snooping hardware, since some PowerPC > platforms > + * wholly rely on hardware to deal with cache coherent > + */ > > - /* Setup Snooping for all the 4GB space */ > - /* SNOOP1 starts from 0x0, size 2G */ > - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > - /* SNOOP2 starts from 0x8000, size 2G */ > - out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); > -#endif > + /* Setup Snooping for all the 4GB space */ > + /* SNOOP1 starts from 0x0, size 2G */ > + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > + /* SNOOP2 starts from 0x8000, size 2G */ > + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > + } > > if ((pdata->operating_mode == FSL_USB2_DR_HOST) || > (pdata->operating_mode == FSL_USB2_DR_OTG)) > -- > 1.7.5.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: linux-next: build failure after merge of the final tree (akpm tree related)
On Fri, 2012-02-17 at 16:30 +1100, Stephen Rothwell wrote: > Hi Andrew, > > After merging the final tree, today's linux-next build (powerpc > allnoconfig) failed like this: > > In file included from include/linux/posix_types.h:47:0, > from include/linux/types.h:17, > from include/linux/page-flags.h:8, > from kernel/bounds.c:9: > arch/powerpc/include/asm/posix_types.h:15:14: error: conflicting types for > '__kernel_size_t' > arch/powerpc/include/asm/posix_types.h:14:22: note: previous declaration of > '__kernel_size_t' was here > In file included from include/linux/page-flags.h:8:0, > from kernel/bounds.c:9: > include/linux/types.h:68:1: error: unknown type name '__kernel_ssize_t' > > Caused by commit a9dbe86e5995 ("powerpc: use generic posix_types.h"). > > This think was pointed out a couple of days ago, so maybe Andrew needs a > newer version of the patch. Yes, I pointed that out to Peter a while back, maybe it got lost ... Cheers, Ben. > I added this fix patch for today: > > From: Stephen Rothwell > Date: Fri, 17 Feb 2012 16:25:48 +1100 > Subject: [PATCH] powerpc: use generic posix_types.h fix > > Signed-off-by: Stephen Rothwell > --- > arch/powerpc/include/asm/posix_types.h |2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/powerpc/include/asm/posix_types.h > b/arch/powerpc/include/asm/posix_types.h > index 1fbe027f..f139325 100644 > --- a/arch/powerpc/include/asm/posix_types.h > +++ b/arch/powerpc/include/asm/posix_types.h > @@ -12,7 +12,7 @@ typedef unsigned long __kernel_old_dev_t; > #define __kernel_old_dev_t __kernel_old_dev_t > #else > typedef unsigned int __kernel_size_t; > -typedef int __kernel_size_t; > +typedef int __kernel_ssize_t; > typedef long __kernel_ptrdiff_t; > #define __kernel_size_t __kernel_size_t > > -- > 1.7.9 > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] USB: ehci-fsl: Turn on cache snooping on MPC8xxx
If a MPC8xxx was being used, 'have_sysif_regs' should be set and it should setup cache snooping for all the 4GB space on both PPC32 and PPC64. Signed-off-by: Pan Jiafei --- drivers/usb/host/ehci-fsl.c | 23 ++- 1 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index c26a82e..8327d3e 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -252,21 +252,18 @@ static int ehci_fsl_usb_setup(struct ehci_hcd *ehci) if (pdata->have_sysif_regs) { temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); - } -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) - /* -* Turn on cache snooping hardware, since some PowerPC platforms -* wholly rely on hardware to deal with cache coherent -*/ + /* + * Turn on cache snooping hardware, since some PowerPC platforms + * wholly rely on hardware to deal with cache coherent + */ - /* Setup Snooping for all the 4GB space */ - /* SNOOP1 starts from 0x0, size 2G */ - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); - /* SNOOP2 starts from 0x8000, size 2G */ - out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); -#endif + /* Setup Snooping for all the 4GB space */ + /* SNOOP1 starts from 0x0, size 2G */ + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); + /* SNOOP2 starts from 0x8000, size 2G */ + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); + } if ((pdata->operating_mode == FSL_USB2_DR_HOST) || (pdata->operating_mode == FSL_USB2_DR_OTG)) -- 1.7.5.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v1 0/4][makedumpfile] vmalloc translation support for PPC32
On 02/17/2012 06:02 AM, Atsushi Kumagai wrote: Hi, Suzuki On Thu, 16 Feb 2012 09:05:17 +0530 "Suzuki K. Poulose" wrote: The series introduces an infrastructure to define platform specific bits for page translation for PPC and PPC44x support for vmalloc translation. This is similar to what we have implemented for Crash-utility. The patches are based makedumpfile-1.4.2 + PPC32 support patches which is queued in for 1.4.3. --- Suzuki K. Poulose (4): [makedumpfile][ppc] PPC44x page translation definitions [makedumpfile][ppc] Define platform descriptors for page translation [makedumpfile][ppc] Generic vmalloc translation support [makedumpfile] Add read_string routine arch/ppc.c | 108 ++-- makedumpfile.c | 14 +++ makedumpfile.h | 21 +++ 3 files changed, 139 insertions(+), 4 deletions(-) -- Suzuki Poulose Could you tell me what kind of data is stored in vmalloc region in PPC ? I want to estimate importance of your patches for makedumpfile. I know at least the modules are loaded in the vmalloc'd region. I have Cc'ed linux-ppc dev. We should be able to get enough info from the experts here. Josh / Kumar / Others, Could you please let us know your thoughts ? Thanks Suzuki ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
linux-next: build failure after merge of the final tree (akpm tree related)
Hi Andrew, After merging the final tree, today's linux-next build (powerpc allnoconfig) failed like this: In file included from include/linux/posix_types.h:47:0, from include/linux/types.h:17, from include/linux/page-flags.h:8, from kernel/bounds.c:9: arch/powerpc/include/asm/posix_types.h:15:14: error: conflicting types for '__kernel_size_t' arch/powerpc/include/asm/posix_types.h:14:22: note: previous declaration of '__kernel_size_t' was here In file included from include/linux/page-flags.h:8:0, from kernel/bounds.c:9: include/linux/types.h:68:1: error: unknown type name '__kernel_ssize_t' Caused by commit a9dbe86e5995 ("powerpc: use generic posix_types.h"). This think was pointed out a couple of days ago, so maybe Andrew needs a newer version of the patch. I added this fix patch for today: From: Stephen Rothwell Date: Fri, 17 Feb 2012 16:25:48 +1100 Subject: [PATCH] powerpc: use generic posix_types.h fix Signed-off-by: Stephen Rothwell --- arch/powerpc/include/asm/posix_types.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/posix_types.h b/arch/powerpc/include/asm/posix_types.h index 1fbe027f..f139325 100644 --- a/arch/powerpc/include/asm/posix_types.h +++ b/arch/powerpc/include/asm/posix_types.h @@ -12,7 +12,7 @@ typedef unsigned long __kernel_old_dev_t; #define __kernel_old_dev_t __kernel_old_dev_t #else typedef unsigned int __kernel_size_t; -typedef int__kernel_size_t; +typedef int__kernel_ssize_t; typedef long __kernel_ptrdiff_t; #define __kernel_size_t __kernel_size_t -- 1.7.9 -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpifisOXtyoA.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH 1/2] powerpc/85xx: fix problem that prevents PHYS_64BIT from configurable
>Subject: Re: [PATCH 1/2] powerpc/85xx: fix problem that prevents >PHYS_64BIT from configurable > > >On Feb 16, 2012, at 6:10 AM, Li Yang wrote: > >> Fix the problem that large physical address support cannot be disabled >> when some platforms which only provides 36-bit support are selected. >> According to the philosophy of kernel config enabling a platform >> support doesn't mean the kernel is only running on that platform. >> Remove the auto selection of PHYS_64BIT option for these platforms. >> They will need to use a 36bit default config that selects PHYS_64BIT >> explicitly. >> >> The reason why we need to keep PHYS_64BIT option configurable is that >> enabling it cause negative performance impact on various aspects like >> TLB miss and physical address manipulating. We should not enable it >> unless really needed, e.g. use large memory of 4GB or bigger. >> >> Signed-off-by: Li Yang >> --- >> arch/powerpc/platforms/85xx/Kconfig |6 -- >> 1 files changed, 0 insertions(+), 6 deletions(-) > >Nak, this isn't correct. > >For some of these platforms like P2041RDB, P3041DS, P3060QDS, P4080DS, & >P5020DS only a 36-bit physical address map is supported by u-boot and the >device tree. This was a decision that was made to NOT support 32-bit >address map for these boards and accept the performance implication of it >to reduce the # of builds, etc. Ok. Although personally I don't think # of builds matters that much. > >Additionally, outside of maybe P2041RDB I believe the majority of these >boards ship with 4G of DDR (but that off the top of my head) and thus >require the 36-bit / PHYS_64BIT support to be enabled. I know that current support of DPAA boards requires 36-bit. But I don't think they need to select the PHYS_64BIT option directly and make it not configurable. It's conflicting with the logic that enabling a platform support doesn't mean the kernel is only running on that platform. Btw: what's your recommendations on solving this? - Leo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Friday, February 17, 2012 11:43 AM > To: Pan Jiafei-B37022 > Cc: Liu Shengzhou-B36685; linux-...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org > Subject: RE: [PATCH] powerpc/usb: fix bug of kernel hang when > initializing usb > > On Fri, 2012-02-17 at 03:20 +, Pan Jiafei-B37022 wrote: > > FYI, I once fixed this issue when backport P5020 BSP for WR Linux, The > > following is the patch which I have submitted to linuxbj-internal. > > Should I just apply this to upstream ? > > Cheers, > Ben. > [Pan Jiafei-B37022] Ok, thanks, I will resend the patch formally! Best Regards. Jiafei. > > From: linuxbj-internal-boun...@linux.freescale.net > > [mailto:linuxbj-internal-boun...@linux.freescale.net] On Behalf Of Pan > > Jiafei-B37022 > > Sent: Friday, December 16, 2011 12:49 PM > > To: linuxbj-inter...@linux.freescale.net > > Cc: Pan Jiafei-B37022 > > Subject: [Linuxbj-internal] [PATCH] USB: ehci-fsl: Turn on cache > > snooping on MPC8xxx > > > > If a MPC8xxx was being used, 'have_sysif_regs' should be set and it > > should setup cache snooping for all the 4GB space on both PPC32 and > > PPC64. > > > > Signed-off-by: Pan Jiafei > > --- > > drivers/usb/host/ehci-fsl.c | 23 ++- > > 1 files changed, 10 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c > > index 90534cc..ee14fa7 100644 > > --- a/drivers/usb/host/ehci-fsl.c > > +++ b/drivers/usb/host/ehci-fsl.c > > @@ -260,21 +260,18 @@ static void ehci_fsl_usb_setup(struct ehci_hcd > *ehci) > > if (pdata->have_sysif_regs) { > > temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); > > out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); > > - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); > > -} > > > > -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > > -/* > > -* Turn on cache snooping hardware, since some PowerPC platforms > > -* wholly rely on hardware to deal with cache coherent > > -*/ > > + /* > > + * Turn on cache snooping hardware, since some PowerPC > platforms > > + * wholly rely on hardware to deal with cache coherent > > + */ > > > > -/* Setup Snooping for all the 4GB space */ > > -/* SNOOP1 starts from 0x0, size 2G */ > > -out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > > -/* SNOOP2 starts from 0x8000, size 2G */ > > -out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > > -#endif > > + /* Setup Snooping for all the 4GB space */ > > + /* SNOOP1 starts from 0x0, size 2G */ > > + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | > SNOOP_SIZE_2GB); > > + /* SNOOP2 starts from 0x8000, size 2G */ > > + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > > +} > > > > if ((pdata->operating_mode == FSL_USB2_DR_HOST) || > >(pdata->operating_mode == FSL_USB2_DR_OTG)) > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Friday, February 17, 2012 11:43 AM > To: Pan Jiafei-B37022 > Cc: Liu Shengzhou-B36685; linux-...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org > Subject: RE: [PATCH] powerpc/usb: fix bug of kernel hang when > initializing usb > > On Fri, 2012-02-17 at 03:20 +, Pan Jiafei-B37022 wrote: > > FYI, I once fixed this issue when backport P5020 BSP for WR Linux, The > > following is the patch which I have submitted to linuxbj-internal. > > Should I just apply this to upstream ? > > Cheers, > Ben. > [Pan Jiafei-B37022] Feel free to apply this to upstream, thanks Best Regards. Jiafei > > From: linuxbj-internal-boun...@linux.freescale.net > > [mailto:linuxbj-internal-boun...@linux.freescale.net] On Behalf Of Pan > > Jiafei-B37022 > > Sent: Friday, December 16, 2011 12:49 PM > > To: linuxbj-inter...@linux.freescale.net > > Cc: Pan Jiafei-B37022 > > Subject: [Linuxbj-internal] [PATCH] USB: ehci-fsl: Turn on cache > > snooping on MPC8xxx > > > > If a MPC8xxx was being used, 'have_sysif_regs' should be set and it > > should setup cache snooping for all the 4GB space on both PPC32 and > > PPC64. > > > > Signed-off-by: Pan Jiafei > > --- > > drivers/usb/host/ehci-fsl.c | 23 ++- > > 1 files changed, 10 insertions(+), 13 deletions(-) > > > > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c > > index 90534cc..ee14fa7 100644 > > --- a/drivers/usb/host/ehci-fsl.c > > +++ b/drivers/usb/host/ehci-fsl.c > > @@ -260,21 +260,18 @@ static void ehci_fsl_usb_setup(struct ehci_hcd > *ehci) > > if (pdata->have_sysif_regs) { > > temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); > > out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); > > - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); > > -} > > > > -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > > -/* > > -* Turn on cache snooping hardware, since some PowerPC platforms > > -* wholly rely on hardware to deal with cache coherent > > -*/ > > + /* > > + * Turn on cache snooping hardware, since some PowerPC > platforms > > + * wholly rely on hardware to deal with cache coherent > > + */ > > > > -/* Setup Snooping for all the 4GB space */ > > -/* SNOOP1 starts from 0x0, size 2G */ > > -out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > > -/* SNOOP2 starts from 0x8000, size 2G */ > > -out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > > -#endif > > + /* Setup Snooping for all the 4GB space */ > > + /* SNOOP1 starts from 0x0, size 2G */ > > + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | > SNOOP_SIZE_2GB); > > + /* SNOOP2 starts from 0x8000, size 2G */ > > + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > > +} > > > > if ((pdata->operating_mode == FSL_USB2_DR_HOST) || > >(pdata->operating_mode == FSL_USB2_DR_OTG)) > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
FYI, I once fixed this issue when backport P5020 BSP for WR Linux, The following is the patch which I have submitted to linuxbj-internal. From: linuxbj-internal-boun...@linux.freescale.net [mailto:linuxbj-internal-boun...@linux.freescale.net] On Behalf Of Pan Jiafei-B37022 Sent: Friday, December 16, 2011 12:49 PM To: linuxbj-inter...@linux.freescale.net Cc: Pan Jiafei-B37022 Subject: [Linuxbj-internal] [PATCH] USB: ehci-fsl: Turn on cache snooping on MPC8xxx If a MPC8xxx was being used, 'have_sysif_regs' should be set and it should setup cache snooping for all the 4GB space on both PPC32 and PPC64. Signed-off-by: Pan Jiafei --- drivers/usb/host/ehci-fsl.c | 23 ++- 1 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index 90534cc..ee14fa7 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -260,21 +260,18 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci) if (pdata->have_sysif_regs) { temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); -} -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) -/* -* Turn on cache snooping hardware, since some PowerPC platforms -* wholly rely on hardware to deal with cache coherent -*/ + /* + * Turn on cache snooping hardware, since some PowerPC platforms + * wholly rely on hardware to deal with cache coherent + */ -/* Setup Snooping for all the 4GB space */ -/* SNOOP1 starts from 0x0, size 2G */ -out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); -/* SNOOP2 starts from 0x8000, size 2G */ -out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); -#endif + /* Setup Snooping for all the 4GB space */ + /* SNOOP1 starts from 0x0, size 2G */ + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); + /* SNOOP2 starts from 0x8000, size 2G */ + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); +} if ((pdata->operating_mode == FSL_USB2_DR_HOST) || (pdata->operating_mode == FSL_USB2_DR_OTG)) -- 1.7.5.1 > -Original Message- > From: linuxppc-dev-bounces+jiafei.pan=freescale@lists.ozlabs.org > [mailto:linuxppc-dev-bounces+jiafei.pan=freescale@lists.ozlabs.org] > On Behalf Of Liu Shengzhou-B36685 > Sent: Friday, February 17, 2012 10:33 AM > To: Benjamin Herrenschmidt > Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org > Subject: RE: [PATCH] powerpc/usb: fix bug of kernel hang when > initializing usb > > > > -Original Message- > > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > > Sent: Friday, February 17, 2012 8:03 AM > > To: Liu Shengzhou-B36685 > > Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org > > Subject: Re: [PATCH] powerpc/usb: fix bug of kernel hang when > > initializing usb > > > > On Fri, 2012-02-17 at 09:58 +1100, Benjamin Herrenschmidt wrote: > > > On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > > > > If USB UTMI PHY is not enable, writing to portsc register will > > > > lead to kernel hang during boot up. > > > > > > > > Signed-off-by: Shengzhou Liu > > > > --- > > > > Apply for master branch of > > > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux- > > 2.6.git > > > > Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. > > > > > > This fixes the hang, but sadly doesn't make USB work. I now get: > > > > .../... > > > > Ok, found the problem. > > > > First, the SDK kernel had a delay after setting that bit, I added that > > back in. This is not what fixed it but it looks like the right thing > > to do, though please, use msleep rather than udelay here if possible > > (not in atomic context). > > > > Then, the real culprit is (CC'ing Kumar and Scott to figure out why) > > this statement: > > > > #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > > /* > > * Turn on cache snooping hardware, since some PowerPC platforms > > * wholly rely on hardware to deal with cache coherent > > */ > > > > /* Setup Snooping for all the 4GB space */ > > /* SNOOP1 starts from 0x0, size 2G */ > > out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > > /* SNOOP2 starts from 0x8000, size 2G */ > > out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > > #endif > > > > I'm building a 64-bit kernel so this isn't compiled and it looks like > > the EHCI is thus not snooping. > > > > By removing the defined(CONFIG_PPC32) part of the statement, my > > problem goes away. > > > > Cheers, > > Ben. > > > > > > [Shengzhou] I tested the patch with 32bit P5020DS, USB worked well. Not > tested with 64-bit kernel. > Glad to you had
RE: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
On Fri, 2012-02-17 at 03:20 +, Pan Jiafei-B37022 wrote: > FYI, I once fixed this issue when backport P5020 BSP for WR Linux, The > following is the patch which I have submitted to linuxbj-internal. Should I just apply this to upstream ? Cheers, Ben. > From: linuxbj-internal-boun...@linux.freescale.net > [mailto:linuxbj-internal-boun...@linux.freescale.net] On Behalf Of Pan > Jiafei-B37022 > Sent: Friday, December 16, 2011 12:49 PM > To: linuxbj-inter...@linux.freescale.net > Cc: Pan Jiafei-B37022 > Subject: [Linuxbj-internal] [PATCH] USB: ehci-fsl: Turn on cache snooping on > MPC8xxx > > If a MPC8xxx was being used, 'have_sysif_regs' should be set and > it should setup cache snooping for all the 4GB space on both PPC32 > and PPC64. > > Signed-off-by: Pan Jiafei > --- > drivers/usb/host/ehci-fsl.c | 23 ++- > 1 files changed, 10 insertions(+), 13 deletions(-) > > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c > index 90534cc..ee14fa7 100644 > --- a/drivers/usb/host/ehci-fsl.c > +++ b/drivers/usb/host/ehci-fsl.c > @@ -260,21 +260,18 @@ static void ehci_fsl_usb_setup(struct ehci_hcd *ehci) > if (pdata->have_sysif_regs) { > temp = in_be32(non_ehci + FSL_SOC_USB_CTRL); > out_be32(non_ehci + FSL_SOC_USB_CTRL, temp | 0x0004); > - out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x001b); > -} > > -#if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > -/* > -* Turn on cache snooping hardware, since some PowerPC platforms > -* wholly rely on hardware to deal with cache coherent > -*/ > + /* > + * Turn on cache snooping hardware, since some PowerPC platforms > + * wholly rely on hardware to deal with cache coherent > + */ > > -/* Setup Snooping for all the 4GB space */ > -/* SNOOP1 starts from 0x0, size 2G */ > -out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > -/* SNOOP2 starts from 0x8000, size 2G */ > -out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); > -#endif > + /* Setup Snooping for all the 4GB space */ > + /* SNOOP1 starts from 0x0, size 2G */ > + out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > + /* SNOOP2 starts from 0x8000, size 2G */ > + out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); > +} > > if ((pdata->operating_mode == FSL_USB2_DR_HOST) || >(pdata->operating_mode == FSL_USB2_DR_OTG)) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Friday, February 17, 2012 11:18 AM > To: Liu Qiang-B32616 > Cc: jgar...@pobox.com; linux-...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org; linux-ker...@vger.kernel.org > Subject: RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing > > On Fri, 2012-02-17 at 01:54 +, Liu Qiang-B32616 wrote: > > The default will be set in a common interface > > fsl_sata_set_irq_coalescing when initialize the controller. This > > interface will check the range of intr count and ticks and make sure > the values are reasonably. > > Allright, but the current defaults are basically no coalescing right ? > > > It's hard to find a aggressive value to adapt all scenarios, so I use > > echo to adjust the value. I remember P5020 have some performance issue, > I will check it. > > BTW, which filesystem do you use? Ext2 is lower than ext4 because > > metadata is continuously wrote to disk. You can try ext4 or xfs. > > ext3 at the moment, I plan to switch to ext4 when I finish that fsck pass > which is taking hours... I am not aware of the 5020 performance issues, > is this something documented and/or fixable ? > My patch may not meet your requirement:( For your performance requirement, I suggest use ext4 filesystem and SSD. Thanks. > Cheers, > Ben. > > ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing
On Fri, 2012-02-17 at 03:09 +, Li Yang-R58472 wrote: > >I tried a debian install on the p5020ds here and I find SATA to be > >extremely slow, generating millions of interrupts. I think the > defaults > >should be a lot more aggressive at coalescing. > > The P5020 has a hardware problem with SATA, making it generate more > interrupts than it should. A new revision of the silicon will fix it. Ok cool. With a bit of luck you guys can send me a new silicon when it's available then :-) (The one in the board you got me seems to be in a socket). Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing
On Fri, 2012-02-17 at 01:54 +, Liu Qiang-B32616 wrote: > The default will be set in a common interface fsl_sata_set_irq_coalescing when > initialize the controller. This interface will check the range of intr count > and ticks and make sure the values are reasonably. Allright, but the current defaults are basically no coalescing right ? > It's hard to find a aggressive value to adapt all scenarios, so I use echo to > adjust > the value. I remember P5020 have some performance issue, I will check it. > BTW, which filesystem do you use? Ext2 is lower than ext4 because metadata is > continuously wrote to disk. You can try ext4 or xfs. ext3 at the moment, I plan to switch to ext4 when I finish that fsck pass which is taking hours... I am not aware of the 5020 performance issues, is this something documented and/or fixable ? Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing
>I tried a debian install on the p5020ds here and I find SATA to be >extremely slow, generating millions of interrupts. I think the defaults >should be a lot more aggressive at coalescing. The P5020 has a hardware problem with SATA, making it generate more interrupts than it should. A new revision of the silicon will fix it. - Leo ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/2] powerpc: add support for MPIC message register API
Some MPIC implementations contain one or more blocks of message registers that are used to send messages between cores via IPIs. A simple API has been added to access (get/put, read, write, etc ...) these message registers. The available message registers are initially discovered via nodes in the device tree. A separate commit contains a binding for the message register nodes. Signed-off-by: Meador Inge Signed-off-by: Jia Hongtao Signed-off-by: Li Yang --- This patch is an update for : http://patchwork.ozlabs.org/patch/98075/ Meador Inge addressed the following points from Ben's feedback: * Drop the 'mpic_msgr.msr' field. * Drop the 'mpic_msgr.mer' field in favor of address arithmetic off of 'mpic_msgr.addr'. * Document the API. * Disable MPIC register in 'mpic_msgr_put'. * Put locking in 'mpic_msgr_disable'. * s/EXPORT_SYMBOL/EXPORT_SYMBOL_GPL/g. * Make 'mpic_msgr_write' and 'mpic_msgr_read' 'static inline'. I just fixed the checkpatch errors and addressed the following item: * In 'mpic_msgr_set_destination' have a wrapper that goes from Linux CPU number to HW CPU number. arch/powerpc/include/asm/mpic_msgr.h | 132 arch/powerpc/platforms/Kconfig |8 + arch/powerpc/sysdev/Makefile |2 + arch/powerpc/sysdev/mpic_msgr.c | 282 ++ 4 files changed, 424 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/include/asm/mpic_msgr.h create mode 100644 arch/powerpc/sysdev/mpic_msgr.c diff --git a/arch/powerpc/include/asm/mpic_msgr.h b/arch/powerpc/include/asm/mpic_msgr.h new file mode 100644 index 000..3ec37dc --- /dev/null +++ b/arch/powerpc/include/asm/mpic_msgr.h @@ -0,0 +1,132 @@ +/* + * Copyright 2011-2012, Meador Inge, Mentor Graphics Corporation. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 of the + * License. + * + */ + +#ifndef _ASM_MPIC_MSGR_H +#define _ASM_MPIC_MSGR_H + +#include +#include + +struct mpic_msgr { + u32 __iomem *base; + u32 __iomem *mer; + int irq; + unsigned char in_use; + raw_spinlock_t lock; + int num; +}; + +/* Get a message register + * + * @reg_num: the MPIC message register to get + * + * A pointer to the message register is returned. If + * the message register asked for is already in use, then + * EBUSY is returned. If the number given is not associated + * with an actual message register, then ENODEV is returned. + * Successfully getting the register marks it as in use. + */ +extern struct mpic_msgr *mpic_msgr_get(unsigned int reg_num); + +/* Relinquish a message register + * + * @msgr: the message register to return + * + * Disables the given message register and marks it as free. + * After this call has completed successully the message + * register is available to be acquired by a call to + * mpic_msgr_get. + */ +extern void mpic_msgr_put(struct mpic_msgr *msgr); + +/* Enable a message register + * + * @msgr: the message register to enable + * + * The given message register is enabled for sending + * messages. + */ +extern void mpic_msgr_enable(struct mpic_msgr *msgr); + +/* Disable a message register + * + * @msgr: the message register to disable + * + * The given message register is disabled for sending + * messages. + */ +extern void mpic_msgr_disable(struct mpic_msgr *msgr); + +/* Write a message to a message register + * + * @msgr: the message register to write to + * @message: the message to write + * + * The given 32-bit message is written to the given message + * register. Writing to an enabled message registers fires + * an interrupt. + */ +static inline void mpic_msgr_write(struct mpic_msgr *msgr, u32 message) +{ + out_be32(msgr->base, message); +} + +/* Read a message from a message register + * + * @msgr: the message register to read from + * + * Returns the 32-bit value currently in the given message register. + * Upon reading the register any interrupts for that register are + * cleared. + */ +static inline u32 mpic_msgr_read(struct mpic_msgr *msgr) +{ + return in_be32(msgr->base); +} + +/* Clear a message register + * + * @msgr: the message register to clear + * + * Clears any interrupts associated with the given message register. + */ +static inline void mpic_msgr_clear(struct mpic_msgr *msgr) +{ + (void) mpic_msgr_read(msgr); +} + +/* Set the destination CPU for the message register + * + * @msgr: the message register whose destination is to be set + * @cpu_num: the Linux CPU number to bind the message register to + * + * Note that the CPU number given is the CPU number used by the kernel + * and *not* the actual hardware CPU number. + */ +static inline void mpic_msgr_set_destination(struct mpic_msgr *msgr, +u32 cpu_num) +{ + out_be32(msgr->base, 1 << get_hard_s
[PATCH 1/2] powerpc: document the FSL MPIC message register binding
This binding documents how the message register blocks found in some FSL MPIC implementations shall be represented in a device tree. Signed-off-by: Meador Inge Signed-off-by: Jia Hongtao Signed-off-by: Li Yang --- .../devicetree/bindings/powerpc/fsl/mpic-msgr.txt | 62 1 files changed, 62 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/powerpc/fsl/mpic-msgr.txt diff --git a/Documentation/devicetree/bindings/powerpc/fsl/mpic-msgr.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpic-msgr.txt new file mode 100644 index 000..b4ae70e --- /dev/null +++ b/Documentation/devicetree/bindings/powerpc/fsl/mpic-msgr.txt @@ -0,0 +1,62 @@ +* FSL MPIC Message Registers + +This binding specifies what properties must be available in the device tree +representation of the message register blocks found in some FSL MPIC +implementations. + +Required properties: + +- compatible: Specifies the compatibility list for the message register + block. The type shall be and the value shall be of the form + "fsl,mpic-v-msgr", where is the version number of + the MPIC containing the message registers. + +- reg: Specifies the base physical address(s) and size(s) of the + message register block's addressable register space. The type shall be + . + +- interrupts: Specifies a list of interrupt source and level-sense pairs. + The type shall be . The length shall be equal to + the number of registers that are available for receiving interrupts. + +Optional properties: + +- mpic-msgr-receive-mask: Specifies what registers in the containing block + are allowed to receive interrupts. The value is a bit mask where a set + bit at bit 'n' indicates that message register 'n' can receive interrupts. + The type shall be . If not present, then all of + the message registers in the block are available. + +Aliases: + +An alias should be created for every message register block. They are not +required, though. However, a particular implementation of this binding +may require aliases to be present. Aliases are of the form +'mpic-msgr-block', where is an integer specifying the block's number. +Numbers shall start at 0. + +Example: + + aliases { + mpic-msgr-block0 = &mpic_msgr_block0; + mpic-msgr-block1 = &mpic_msgr_block1; + }; + + mpic_msgr_block0: mpic-msgr-block@41400 { + compatible = "fsl,mpic-v3.1-msgr"; + reg = <0x41400 0x200>; + // Message registers 0 and 2 in this block can receive interrupts on + // sources 0xb0 and 0xb2, respectively. + interrupts = <0xb0 2 0xb2 2>; + mpic-msgr-receive-mask = <0x5>; + }; + + mpic_msgr_block1: mpic-msgr-block@42400 { + compatible = "fsl,mpic-v3.1-msgr"; + reg = <0x42400 0x200>; + // Message registers 0 and 2 in this block can receive interrupts on + // sources 0xb4 and 0xb6, respectively. + interrupts = <0xb4 2 0xb6 2>; + mpic-msgr-receive-mask = <0x5>; + }; + -- 1.7.5.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Friday, February 17, 2012 8:03 AM > To: Liu Shengzhou-B36685 > Cc: linux-...@vger.kernel.org; linuxppc-dev@lists.ozlabs.org > Subject: Re: [PATCH] powerpc/usb: fix bug of kernel hang when > initializing usb > > On Fri, 2012-02-17 at 09:58 +1100, Benjamin Herrenschmidt wrote: > > On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > > > If USB UTMI PHY is not enable, writing to portsc register will lead > > > to kernel hang during boot up. > > > > > > Signed-off-by: Shengzhou Liu > > > --- > > > Apply for master branch of > > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux- > 2.6.git > > > Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. > > > > This fixes the hang, but sadly doesn't make USB work. I now get: > > .../... > > Ok, found the problem. > > First, the SDK kernel had a delay after setting that bit, I added that > back in. This is not what fixed it but it looks like the right thing to > do, though please, use msleep rather than udelay here if possible (not > in atomic context). > > Then, the real culprit is (CC'ing Kumar and Scott to figure out why) > this statement: > > #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) > /* >* Turn on cache snooping hardware, since some PowerPC platforms >* wholly rely on hardware to deal with cache coherent >*/ > > /* Setup Snooping for all the 4GB space */ > /* SNOOP1 starts from 0x0, size 2G */ > out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); > /* SNOOP2 starts from 0x8000, size 2G */ > out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | > SNOOP_SIZE_2GB); #endif > > I'm building a 64-bit kernel so this isn't compiled and it looks like > the EHCI is thus not snooping. > > By removing the defined(CONFIG_PPC32) part of the statement, my problem > goes away. > > Cheers, > Ben. > > [Shengzhou] I tested the patch with 32bit P5020DS, USB worked well. Not tested with 64-bit kernel. Glad to you had found the problem in case of 64-bit, thanks! ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for host
On 17.02.2012, at 03:13, Liu Yu-B13201 wrote: > > >> -Original Message- >> From: Alexander Graf [mailto:ag...@suse.de] >> Sent: Thursday, February 16, 2012 6:20 PM >> To: Liu Yu-B13201 >> Cc: ; ; > d...@ozlabs.org>; Wood Scott-B07421; Liu Yu-B13201 >> Subject: Re: [PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for >> host >> >> >> >> On 16.02.2012, at 10:26, Liu Yu wrote: >> >>> And add a new flag definition in kvm_ppc_pvinfo to indicate whether >>> host support EV_IDLE hcall. >>> >>> Signed-off-by: Liu Yu >>> --- >>> v4: >>> no change >>> >>> arch/powerpc/include/asm/kvm_para.h | 14 -- >>> arch/powerpc/kvm/powerpc.c |8 >>> include/linux/kvm.h |2 ++ >>> 3 files changed, 22 insertions(+), 2 deletions(-) >>> >>> diff --git a/arch/powerpc/include/asm/kvm_para.h >>> b/arch/powerpc/include/asm/kvm_para.h >>> index 7b754e7..81a34c9 100644 >>> --- a/arch/powerpc/include/asm/kvm_para.h >>> +++ b/arch/powerpc/include/asm/kvm_para.h >>> @@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared { }; >>> >>> #define KVM_SC_MAGIC_R00x4b564d21 /* "KVM!" */ >>> -#define HC_VENDOR_KVM(42 << 16) >>> + >>> +#include >>> + >>> +/* ePAPR Hypercall Vendor ID */ >>> +#define HC_VENDOR_EPAPR(EV_EPAPR_VENDOR_ID << 16) >>> +#define HC_VENDOR_KVM(EV_KVM_VENDOR_ID << 16) >>> + >>> +/* ePAPR Hypercall Token */ >>> +#define HC_EV_IDLEEV_IDLE >>> + >>> +/* ePAPR Hypercall Return Codes */ >>> #define HC_EV_SUCCESS0 >>> -#define HC_EV_UNIMPLEMENTED12 >>> +#define HC_EV_UNIMPLEMENTEDEV_UNIMPLEMENTED >>> >>> #define KVM_FEATURE_MAGIC_PAGE1 >>> >>> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c >>> index 0e21d15..03ebd5d 100644 >>> --- a/arch/powerpc/kvm/powerpc.c >>> +++ b/arch/powerpc/kvm/powerpc.c >>> @@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) >>> >>> /* Second return value is in r4 */ >>> break; >>> +case HC_VENDOR_EPAPR | HC_EV_IDLE: >>> +r = HC_EV_SUCCESS; >>> +kvm_vcpu_block(vcpu); >>> +break; >>> default: >>> r = HC_EV_UNIMPLEMENTED; >>> break; >>> @@ -746,6 +750,10 @@ static int kvm_vm_ioctl_get_pvinfo(struct >> kvm_ppc_pvinfo *pvinfo) >>> pvinfo->hcall[2] = inst_sc; >>> pvinfo->hcall[3] = inst_nop; >>> >>> +#ifdef CONFIG_BOOKE >>> +pvinfo->flags |= KVM_PPC_PVINFO_FLAGS_EV_IDLE; #endif >>> + >>> return 0; >>> }> >> >> Why limit it to booke? The less ifdefs our code has, the better :) > > The code here tells userspace that kvm support ev_idle. > But I'm not sure if the ev_idle code works for other platforms. > > So I think we should keep the ifdef until other platform test the code :) But the implementation is in generic code and is not #ifdef'ed, so a guest could still call it just fine. It looks simple enough to work without major testing on different platforms, so I'd say just expose it and be done :) Alex ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for host
> -Original Message- > From: Alexander Graf [mailto:ag...@suse.de] > Sent: Thursday, February 16, 2012 6:20 PM > To: Liu Yu-B13201 > Cc: ; ; d...@ozlabs.org>; Wood Scott-B07421; Liu Yu-B13201 > Subject: Re: [PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for > host > > > > On 16.02.2012, at 10:26, Liu Yu wrote: > > > And add a new flag definition in kvm_ppc_pvinfo to indicate whether > > host support EV_IDLE hcall. > > > > Signed-off-by: Liu Yu > > --- > > v4: > > no change > > > > arch/powerpc/include/asm/kvm_para.h | 14 -- > > arch/powerpc/kvm/powerpc.c |8 > > include/linux/kvm.h |2 ++ > > 3 files changed, 22 insertions(+), 2 deletions(-) > > > > diff --git a/arch/powerpc/include/asm/kvm_para.h > > b/arch/powerpc/include/asm/kvm_para.h > > index 7b754e7..81a34c9 100644 > > --- a/arch/powerpc/include/asm/kvm_para.h > > +++ b/arch/powerpc/include/asm/kvm_para.h > > @@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared { }; > > > > #define KVM_SC_MAGIC_R00x4b564d21 /* "KVM!" */ > > -#define HC_VENDOR_KVM(42 << 16) > > + > > +#include > > + > > +/* ePAPR Hypercall Vendor ID */ > > +#define HC_VENDOR_EPAPR(EV_EPAPR_VENDOR_ID << 16) > > +#define HC_VENDOR_KVM(EV_KVM_VENDOR_ID << 16) > > + > > +/* ePAPR Hypercall Token */ > > +#define HC_EV_IDLEEV_IDLE > > + > > +/* ePAPR Hypercall Return Codes */ > > #define HC_EV_SUCCESS0 > > -#define HC_EV_UNIMPLEMENTED12 > > +#define HC_EV_UNIMPLEMENTEDEV_UNIMPLEMENTED > > > > #define KVM_FEATURE_MAGIC_PAGE1 > > > > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > > index 0e21d15..03ebd5d 100644 > > --- a/arch/powerpc/kvm/powerpc.c > > +++ b/arch/powerpc/kvm/powerpc.c > > @@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) > > > >/* Second return value is in r4 */ > >break; > > +case HC_VENDOR_EPAPR | HC_EV_IDLE: > > +r = HC_EV_SUCCESS; > > +kvm_vcpu_block(vcpu); > > +break; > >default: > >r = HC_EV_UNIMPLEMENTED; > >break; > > @@ -746,6 +750,10 @@ static int kvm_vm_ioctl_get_pvinfo(struct > kvm_ppc_pvinfo *pvinfo) > >pvinfo->hcall[2] = inst_sc; > >pvinfo->hcall[3] = inst_nop; > > > > +#ifdef CONFIG_BOOKE > > +pvinfo->flags |= KVM_PPC_PVINFO_FLAGS_EV_IDLE; #endif > > + > >return 0; > > }> > > Why limit it to booke? The less ifdefs our code has, the better :) The code here tells userspace that kvm support ev_idle. But I'm not sure if the ev_idle code works for other platforms. So I think we should keep the ifdef until other platform test the code :) Thanks, Yu ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH V2 RESEND] fsl-sata: I/O load balancing
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Friday, February 17, 2012 8:40 AM > To: Liu Qiang-B32616 > Cc: jgar...@pobox.com; linux-...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org; linux-ker...@vger.kernel.org > Subject: Re: [PATCH V2 RESEND] fsl-sata: I/O load balancing > > On Wed, 2012-02-15 at 13:49 +0800, Qiang Liu wrote: > ] > > diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c index > > 0120b0d..d6577b9 100644 > > --- a/drivers/ata/sata_fsl.c > > +++ b/drivers/ata/sata_fsl.c > > @@ -6,7 +6,7 @@ > > * Author: Ashish Kalra > > * Li Yang > > * > > - * Copyright (c) 2006-2007, 2011 Freescale Semiconductor, Inc. > > + * Copyright (c) 2006-2007, 2011-2012 Freescale Semiconductor, Inc. > > * > > * This program is free software; you can redistribute it and/or > modify it > > * under the terms of the GNU General Public License as published > > by the @@ -26,6 +26,15 @@ #include #include > > > > > > +static unsigned int intr_coalescing_count; > > +module_param(intr_coalescing_count, int, S_IRUGO); > > +MODULE_PARM_DESC(intr_coalescing_count, > > +"INT coalescing count threshold (1..31)"); > > + > > +static unsigned int intr_coalescing_ticks; > > +module_param(intr_coalescing_ticks, int, S_IRUGO); > > +MODULE_PARM_DESC(intr_coalescing_ticks, > > +"INT coalescing timer threshold in AHB ticks"); > > You don't seem to provide very useful defaults... for example, > intr_coalescing_count starts at 0 which isn't even in range (the code > fixes that up but still...). > > I tried a debian install on the p5020ds here and I find SATA to be > extremely slow, generating millions of interrupts. I think the defaults > should be a lot more aggressive at coalescing. Hello Ben, The default will be set in a common interface fsl_sata_set_irq_coalescing when initialize the controller. This interface will check the range of intr count and ticks and make sure the values are reasonably. It's hard to find a aggressive value to adapt all scenarios, so I use echo to adjust the value. I remember P5020 have some performance issue, I will check it. BTW, which filesystem do you use? Ext2 is lower than ext4 because metadata is continuously wrote to disk. You can try ext4 or xfs. Thanks. > > Cheers, > Ben. > > > /* Controller information */ > > enum { > > SATA_FSL_QUEUE_DEPTH= 16, > > @@ -83,6 +92,16 @@ enum { > > }; > > > > /* > > + * Interrupt Coalescing Control Register bitdefs */ enum { > > + ICC_MIN_INT_COUNT_THRESHOLD = 1, > > + ICC_MAX_INT_COUNT_THRESHOLD = ((1 << 5) - 1), > > + ICC_MIN_INT_TICKS_THRESHOLD = 0, > > + ICC_MAX_INT_TICKS_THRESHOLD = ((1 << 19) - 1), > > + ICC_SAFE_INT_TICKS = 1, > > +}; > > + > > +/* > > * Host Controller command register set - per port */ enum { @@ > > -263,8 +282,65 @@ struct sata_fsl_host_priv { > > void __iomem *csr_base; > > int irq; > > int data_snoop; > > + struct device_attribute intr_coalescing; > > }; > > > > +static void fsl_sata_set_irq_coalescing(struct ata_host *host, > > + unsigned int count, unsigned int ticks) { > > + struct sata_fsl_host_priv *host_priv = host->private_data; > > + void __iomem *hcr_base = host_priv->hcr_base; > > + > > + if (count > ICC_MAX_INT_COUNT_THRESHOLD) > > + count = ICC_MAX_INT_COUNT_THRESHOLD; > > + else if (count < ICC_MIN_INT_COUNT_THRESHOLD) > > + count = ICC_MIN_INT_COUNT_THRESHOLD; > > + > > + if (ticks > ICC_MAX_INT_TICKS_THRESHOLD) > > + ticks = ICC_MAX_INT_TICKS_THRESHOLD; > > + else if ((ICC_MIN_INT_TICKS_THRESHOLD == ticks) && > > + (count > ICC_MIN_INT_COUNT_THRESHOLD)) > > + ticks = ICC_SAFE_INT_TICKS; > > + > > + spin_lock(&host->lock); > > + iowrite32((count << 24 | ticks), hcr_base + ICC); > > + > > + intr_coalescing_count = count; > > + intr_coalescing_ticks = ticks; > > + spin_unlock(&host->lock); > > + > > + DPRINTK("intrrupt coalescing, count = 0x%x, ticks = %x\n", > > + intr_coalescing_count, intr_coalescing_ticks); > > + DPRINTK("ICC register status: (hcr base: 0x%x) = 0x%x\n", > > + hcr_base, ioread32(hcr_base + ICC)); } > > + > > +static ssize_t fsl_sata_intr_coalescing_show(struct device *dev, > > + struct device_attribute *attr, char *buf) { > > + return sprintf(buf, "%d %d\n", > > + intr_coalescing_count, intr_coalescing_ticks); } > > + > > +static ssize_t fsl_sata_intr_coalescing_store(struct device *dev, > > + struct device_attribute *attr, > > + const char *buf, size_t count) > > +{ > > + unsigned int coalescing_count, coalescing_ticks; > > + > > + if (sscanf(buf, "%d%d", > > + &coalescing_count, > > + &coalescing_ticks) != 2) { > > + printk(KERN_ERR "fsl-sat
Re: [PATCH 1/2] powerpc/85xx: fix problem that prevents PHYS_64BIT from configurable
On Feb 16, 2012, at 6:10 AM, Li Yang wrote: > Fix the problem that large physical address support cannot be > disabled when some platforms which only provides 36-bit support > are selected. According to the philosophy of kernel config > enabling a platform support doesn't mean the kernel is only > running on that platform. Remove the auto selection of PHYS_64BIT > option for these platforms. They will need to use a 36bit default > config that selects PHYS_64BIT explicitly. > > The reason why we need to keep PHYS_64BIT option configurable is > that enabling it cause negative performance impact on various > aspects like TLB miss and physical address manipulating. We should > not enable it unless really needed, e.g. use large memory of 4GB > or bigger. > > Signed-off-by: Li Yang > --- > arch/powerpc/platforms/85xx/Kconfig |6 -- > 1 files changed, 0 insertions(+), 6 deletions(-) Nak, this isn't correct. For some of these platforms like P2041RDB, P3041DS, P3060QDS, P4080DS, & P5020DS only a 36-bit physical address map is supported by u-boot and the device tree. This was a decision that was made to NOT support 32-bit address map for these boards and accept the performance implication of it to reduce the # of builds, etc. Additionally, outside of maybe P2041RDB I believe the majority of these boards ship with 4G of DDR (but that off the top of my head) and thus require the 36-bit / PHYS_64BIT support to be enabled. - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: 5020 SATA fix
On Feb 16, 2012, at 6:29 PM, Benjamin Herrenschmidt wrote: > Hi Lei ! > > In your SDK kernel I see this commit: > > 92c0ce1e599e788ffc0908739db9bd5e0dbdad69 > sata_fsl: Add the workaround for SATA-A005 erratum on P2040/P3041/P5020 > > Without this commit, SATA doesn't work on the p5020ds board that FSL > just sent me. I see this was committed in June last year, any reason why > this is not upstream yet ? > > Any objection to me just sending it upstream ? > > Cheers, > Ben. > In general we've avoided sending erratum fixes for non-production silicon upstream. - k ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
On Thu, Feb 16, 2012 at 01:48:20PM -0600, Timur Tabi wrote: > Ira W. Snyder wrote: > > > No. I don't have the ability to connect my P2020 up to an FPGA to > > recreate the DMA workload that causes this on my 8349EA. I can run the > > dmatest module, if you'd like. > > I just want to make sure your patch doesn't break 85xx. > I tried both with and without this patch on my P2020 COM Express board. With both kernels, the board locks up after 20 minutes or so, no messages to the serial console. I wouldn't be surprised if there are some memory problems with this board. In any case, I don't have any reason to believe that this patch causes any trouble: the board dies without it. However, the patch doesn't break DMA on 85xx. If I unload the dmatest module after 10 minutes or so, it claims to have passed many thousands of tests without problems. My 8349EA test boards (15 of them) have been running their normal DMA workload plus dmatest on the unused 4th channel, all without errors, for several hours. ~2.5 million successful tests per board, as I write this. Ira ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V2 RESEND] fsl-sata: I/O load balancing
On Wed, 2012-02-15 at 13:49 +0800, Qiang Liu wrote: ] > diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c > index 0120b0d..d6577b9 100644 > --- a/drivers/ata/sata_fsl.c > +++ b/drivers/ata/sata_fsl.c > @@ -6,7 +6,7 @@ > * Author: Ashish Kalra > * Li Yang > * > - * Copyright (c) 2006-2007, 2011 Freescale Semiconductor, Inc. > + * Copyright (c) 2006-2007, 2011-2012 Freescale Semiconductor, Inc. > * > * This program is free software; you can redistribute it and/or modify it > * under the terms of the GNU General Public License as published by the > @@ -26,6 +26,15 @@ > #include > #include > > +static unsigned int intr_coalescing_count; > +module_param(intr_coalescing_count, int, S_IRUGO); > +MODULE_PARM_DESC(intr_coalescing_count, > + "INT coalescing count threshold (1..31)"); > + > +static unsigned int intr_coalescing_ticks; > +module_param(intr_coalescing_ticks, int, S_IRUGO); > +MODULE_PARM_DESC(intr_coalescing_ticks, > + "INT coalescing timer threshold in AHB ticks"); You don't seem to provide very useful defaults... for example, intr_coalescing_count starts at 0 which isn't even in range (the code fixes that up but still...). I tried a debian install on the p5020ds here and I find SATA to be extremely slow, generating millions of interrupts. I think the defaults should be a lot more aggressive at coalescing. Cheers, Ben. > /* Controller information */ > enum { > SATA_FSL_QUEUE_DEPTH= 16, > @@ -83,6 +92,16 @@ enum { > }; > > /* > + * Interrupt Coalescing Control Register bitdefs */ > +enum { > + ICC_MIN_INT_COUNT_THRESHOLD = 1, > + ICC_MAX_INT_COUNT_THRESHOLD = ((1 << 5) - 1), > + ICC_MIN_INT_TICKS_THRESHOLD = 0, > + ICC_MAX_INT_TICKS_THRESHOLD = ((1 << 19) - 1), > + ICC_SAFE_INT_TICKS = 1, > +}; > + > +/* > * Host Controller command register set - per port > */ > enum { > @@ -263,8 +282,65 @@ struct sata_fsl_host_priv { > void __iomem *csr_base; > int irq; > int data_snoop; > + struct device_attribute intr_coalescing; > }; > > +static void fsl_sata_set_irq_coalescing(struct ata_host *host, > + unsigned int count, unsigned int ticks) > +{ > + struct sata_fsl_host_priv *host_priv = host->private_data; > + void __iomem *hcr_base = host_priv->hcr_base; > + > + if (count > ICC_MAX_INT_COUNT_THRESHOLD) > + count = ICC_MAX_INT_COUNT_THRESHOLD; > + else if (count < ICC_MIN_INT_COUNT_THRESHOLD) > + count = ICC_MIN_INT_COUNT_THRESHOLD; > + > + if (ticks > ICC_MAX_INT_TICKS_THRESHOLD) > + ticks = ICC_MAX_INT_TICKS_THRESHOLD; > + else if ((ICC_MIN_INT_TICKS_THRESHOLD == ticks) && > + (count > ICC_MIN_INT_COUNT_THRESHOLD)) > + ticks = ICC_SAFE_INT_TICKS; > + > + spin_lock(&host->lock); > + iowrite32((count << 24 | ticks), hcr_base + ICC); > + > + intr_coalescing_count = count; > + intr_coalescing_ticks = ticks; > + spin_unlock(&host->lock); > + > + DPRINTK("intrrupt coalescing, count = 0x%x, ticks = %x\n", > + intr_coalescing_count, intr_coalescing_ticks); > + DPRINTK("ICC register status: (hcr base: 0x%x) = 0x%x\n", > + hcr_base, ioread32(hcr_base + ICC)); > +} > + > +static ssize_t fsl_sata_intr_coalescing_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + return sprintf(buf, "%d %d\n", > + intr_coalescing_count, intr_coalescing_ticks); > +} > + > +static ssize_t fsl_sata_intr_coalescing_store(struct device *dev, > + struct device_attribute *attr, > + const char *buf, size_t count) > +{ > + unsigned int coalescing_count, coalescing_ticks; > + > + if (sscanf(buf, "%d%d", > + &coalescing_count, > + &coalescing_ticks) != 2) { > + printk(KERN_ERR "fsl-sata: wrong parameter format.\n"); > + return -EINVAL; > + } > + > + fsl_sata_set_irq_coalescing(dev_get_drvdata(dev), > + coalescing_count, coalescing_ticks); > + > + return strlen(buf); > +} > + > static inline unsigned int sata_fsl_tag(unsigned int tag, > void __iomem *hcr_base) > { > @@ -346,10 +422,10 @@ static unsigned int sata_fsl_fill_sg(struct > ata_queued_cmd *qc, void *cmd_desc, > (unsigned long long)sg_addr, sg_len); > > /* warn if each s/g element is not dword aligned */ > - if (sg_addr & 0x03) > + if (unlikely(sg_addr & 0x03)) > ata_port_err(qc->ap, "s/g addr unaligned : 0x%llx\n", >(unsigned long long)sg_addr); > - if (sg_len & 0x03) > + if (unlikely(sg_len & 0x03)) > ata_port_err(qc->ap, "s/g le
5020 SATA fix
Hi Lei ! In your SDK kernel I see this commit: 92c0ce1e599e788ffc0908739db9bd5e0dbdad69 sata_fsl: Add the workaround for SATA-A005 erratum on P2040/P3041/P5020 Without this commit, SATA doesn't work on the p5020ds board that FSL just sent me. I see this was committed in June last year, any reason why this is not upstream yet ? Any objection to me just sending it upstream ? Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
On Fri, 2012-02-17 at 09:58 +1100, Benjamin Herrenschmidt wrote: > On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > > If USB UTMI PHY is not enable, writing to portsc register will lead to > > kernel hang during boot up. > > > > Signed-off-by: Shengzhou Liu > > --- > > Apply for master branch of > > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git > > Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. > > This fixes the hang, but sadly doesn't make USB work. I now get: .../... Ok, found the problem. First, the SDK kernel had a delay after setting that bit, I added that back in. This is not what fixed it but it looks like the right thing to do, though please, use msleep rather than udelay here if possible (not in atomic context). Then, the real culprit is (CC'ing Kumar and Scott to figure out why) this statement: #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE) /* * Turn on cache snooping hardware, since some PowerPC platforms * wholly rely on hardware to deal with cache coherent */ /* Setup Snooping for all the 4GB space */ /* SNOOP1 starts from 0x0, size 2G */ out_be32(non_ehci + FSL_SOC_USB_SNOOP1, 0x0 | SNOOP_SIZE_2GB); /* SNOOP2 starts from 0x8000, size 2G */ out_be32(non_ehci + FSL_SOC_USB_SNOOP2, 0x8000 | SNOOP_SIZE_2GB); #endif I'm building a 64-bit kernel so this isn't compiled and it looks like the EHCI is thus not snooping. By removing the defined(CONFIG_PPC32) part of the statement, my problem goes away. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 00/27] irq_domain generalization and rework
On Thu, Feb 16, 2012 at 02:52:19PM -0800, Andrew Morton wrote: > On Thu, 16 Feb 2012 02:09:01 -0700 > Grant Likely wrote: > > This series generalizes the "irq_host" infrastructure from powerpc > > so that it can be used by all architectures and renames it to "irq_domain". > > drivers/mfd/twl-core.c is fairly horked on i386 allmodconfig: > > drivers/mfd/twl-core.c: In function 'twl_probe': > drivers/mfd/twl-core.c:1218: error: implicit declaration of function > 'irq_alloc_descs' > drivers/mfd/twl-core.c:1226: error: implicit declaration of function > 'irq_domain_add_legacy' > drivers/mfd/twl-core.c:1227: error: 'irq_domain_simple_ops' undeclared (first > use in this function) > drivers/mfd/twl-core.c:1227: error: (Each undeclared identifier is reported > only once > drivers/mfd/twl-core.c:1227: error: for each function it appears in.) > > This is today's linux-next so it has rmk's "ARM: omap: fix broken > twl-core dependencies and ifdefs" in there, which looks like it > attempts to repair this stuff. Yes, you're the third to report this breakage. Grant's response on Tuesday over this was: | This is irq_domain related. It's related to an API change. I'm | tracking to get it solved, either by moving the twl commit into the | irqdomain branch or by deferring the api change to v3.5. | | I've also got a patch that converts x86 over to the new api, but I | don't have sufficient review to put it into the irqdomain tree yet. > btw, Russell, regarding this comment in include/linux/irq.h: > > /* > * Please do not include this file in generic code. There is currently > * no requirement for any architecture to implement anything held > * within this file. > * > * Thanks. --rmk > */ > > A quick grep indicates that we've lost this battle ;) Is the comments > still true? Should we stop discouraging inclusion of linux/irq.h? > Does anyone even know that it's discouraged ;) It's still true for any platform which hasn't been converted to genirq, as such a platform would not have asm/hw_irq.h. That said, since genirq, it's now necessary for any driver which contains interrupt controller code like GPIO drivers. So I suspect the comment should now be lost, even though it's not really a replacement for asm/irq.h. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > If USB UTMI PHY is not enable, writing to portsc register will lead to > kernel hang during boot up. > > Signed-off-by: Shengzhou Liu > --- > Apply for master branch of > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git > Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. This fixes the hang, but sadly doesn't make USB work. I now get: ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver /soc@ffe00/usb@21: Invalid 'dr_mode' property, fallback to host mode fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1 fsl-ehci fsl-ehci.0: irq 44, io mem 0xffe21 fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00 hub 1-0:1.0: USB hub found hub 1-0:1.0: 1 port detected fsl-ehci fsl-ehci.1: Freescale On-Chip EHCI Host Controller fsl-ehci fsl-ehci.1: new USB bus registered, assigned bus number 2 fsl-ehci fsl-ehci.1: irq 45, io mem 0xffe211000 fsl-ehci fsl-ehci.1: USB 2.0 started, EHCI 1.00 .../... usb 1-1: device descriptor read/64, error -110 usb 1-1: device descriptor read/64, error -110 usb 1-1: new full-speed USB device number 3 using fsl-ehci hub 1-0:1.0: unable to enumerate USB device on port 1 usb 1-1: new full-speed USB device number 4 using fsl-ehci usb 1-1: device descriptor read/64, error -110 The blurb about "invalid dr_mode property" makes me think there's some kind of disagreement between the device-tree coming with the machine and what upstream expects. Basically the DT doesn't contain a dr_mode property at all (which should be fine, host mode is what I want, but I suspect some stuff aren't being configured properly by u-boot either...) Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 00/27] irq_domain generalization and rework
On Thu, 16 Feb 2012 02:09:01 -0700 Grant Likely wrote: > > This series generalizes the "irq_host" infrastructure from powerpc > so that it can be used by all architectures and renames it to "irq_domain". drivers/mfd/twl-core.c is fairly horked on i386 allmodconfig: drivers/mfd/twl-core.c: In function 'twl_probe': drivers/mfd/twl-core.c:1218: error: implicit declaration of function 'irq_alloc_descs' drivers/mfd/twl-core.c:1226: error: implicit declaration of function 'irq_domain_add_legacy' drivers/mfd/twl-core.c:1227: error: 'irq_domain_simple_ops' undeclared (first use in this function) drivers/mfd/twl-core.c:1227: error: (Each undeclared identifier is reported only once drivers/mfd/twl-core.c:1227: error: for each function it appears in.) This is today's linux-next so it has rmk's "ARM: omap: fix broken twl-core dependencies and ifdefs" in there, which looks like it attempts to repair this stuff. It's looking for things which are in both linux/irq.h and in linux/irqdomain.h. btw, Russell, regarding this comment in include/linux/irq.h: /* * Please do not include this file in generic code. There is currently * no requirement for any architecture to implement anything held * within this file. * * Thanks. --rmk */ A quick grep indicates that we've lost this battle ;) Is the comments still true? Should we stop discouraging inclusion of linux/irq.h? Does anyone even know that it's discouraged ;) ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2 v4] powerpc/85xx: Add p1025rdb platform support
On Tue, Feb 14, 2012 at 2:06 AM, Zhicheng Fan wrote: > From: Zhicheng Fan > > Signed-off-by: Zhicheng Fan > --- 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
Re: [PATCH 2/2 v4] powerpc/dts: Add dts for p1025rdb board
On Tue, Feb 14, 2012 at 2:06 AM, Zhicheng Fan wrote: > From: Zhicheng Fan > > P1025RDB Overview > -- > 1Gbyte DDR3 SDRAM > 32 Mbyte NAND flash > 16Mbyte NOR flash > 16 Mbyte SPI flash > SD connector to interface with the SD memory card > Real-time clock on I2C bus > > PCIe: > - x1 PCIe slot > - x1 mini-PCIe slot > > 10/100/1000 BaseT Ethernet ports: > - eTSEC1, RGMII: one 10/100/1000 port using AtherosTM AR8021 > - eTSEC2, SGMII: one 10/100/1000 port using VitesseTM VSC8221 > - eTSEC3, RGMII: one 10/100/1000 port using AtherosTM AR8021 > > USB 2.0 port: > - Two USB2.0 Type A receptacles > - One USB2.0 signal to Mini PCIe slot > > Dual RJ45 UART ports: > - DUART interface: supports two UARTs up to 115200 bps for console display > > Signed-off-by: Zhicheng Fan > --- 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
Re: [PATCH 1/2 v5] powerpc/85xx: Add Quicc Engine support for p1025rdb
On Wed, Feb 15, 2012 at 12:58 AM, Zhicheng Fan wrote: > From: Zhicheng Fan > > Signed-off-by: Zhicheng Fan > --- 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
Re: tlb flushing on Power
On Thu, 2012-02-16 at 11:11 -0600, Seth Jennings wrote: > Just wanted to bump you again about this. You mentioned that if I wanted to > do a cpu-local flush of a single tlb entry, that there would have to be a new > hook. Is that right? > > I've been looking through the powerpc arch and I thought that I might have > found the power analog to __flush_tlb_one() for x86 in local_flush_tlb_page() > with a NULL vma argument. This doesn't seem to work though, as indicated > by a crash when I tried it. After looking in tlbflush.h again, it seems > that local_flush_tlb_page() is a no-op when CONFIG_PPC_STD_MMU_64 is set, > as are almost ALL of the tlb flushing functions... which makes no sense to > me. > > Any help you (or anyone) can give me would be greatly appreciated. On ppc64 with hash-table MMU, we handle the flushes very differently. PTEs that are modified are added to a list at the time of the modification and either flushed immediately if no lazy tlb batching is in progress or flushed when leaving the lazy tlb op. This is to avoid a problem where we might otherwise, under some circumstances, create a new TLB which can be hashed in to the hash table before the previous one has been flushed out. That would lead to a dup in the hash table which is architecturally illegal. This happens via the call to hpte_need_flush() in pte_update(). Unfortunately, it will always consider all kernel mappings as global, so the per-cpu "optimization" won't be usable in this case, at least not until we add some kind of additional argument to that function. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
Ira W. Snyder wrote: > No. I don't have the ability to connect my P2020 up to an FPGA to > recreate the DMA workload that causes this on my 8349EA. I can run the > dmatest module, if you'd like. I just want to make sure your patch doesn't break 85xx. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
On Thu, Feb 16, 2012 at 01:34:00PM -0600, Timur Tabi wrote: > Ira W. Snyder wrote: > > This leads me to believe that this occurs mostly (but not always) > > concurrent with the end-of-chain interrupt. > > Have you tested this on an 85xx platform? > No. I don't have the ability to connect my P2020 up to an FPGA to recreate the DMA workload that causes this on my 8349EA. I can run the dmatest module, if you'd like. > I noticed something odd. You're modifying fsldma_chan_irq(), which is for > DMA controllers that have per-channel IRQs. 83xx devices don't have > per-channel IRQs -- all channels on one controller have the same IRQ. > Looking at the device tree, I see that the IRQs are listed in the channel > nodes *and* in the controller node. I don't see how we ever use the > per-controller ISR. > fsldma_ctrl_irq() (the per-controller irq handler) just calls through to fsldma_chan_irq() (the per-channel irq handler). > I wonder if the shared IRQ is the part of the cause of the interrupts > you're seeing. > My device tree is slightly modified to remove the per-controller interrupts and interrupt-parent properties. Each individual channel has identical interrupts and interrupt-parent properties specified. Someone here suggested that I do that, several years ago. It has been too long, and I do not remember who. I can reverse it, and use the per-controller IRQ instead. > > > > In the last month, the "unhandled sr" error has occurred on 92 out of > > 120 boards in production use. The statistics are included below. On some > > boards, it is much more frequent than on others. All boards have roughly > > the same workload. > > > > Another interesting tidbit from my logs: this only occurs on DMA channel > > 2 (the are numbered starting at 0, it is the 3rd channel). Here is an > > example log message: > > What happens if you never register that channel? That is, remove this > node from the device tree: > > dma-channel@100 { > compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; > reg = <0x100 0x80>; > cell-index = <2>; > interrupt-parent = <&ipic>; > interrupts = <71 8>; > }; > I can try that. I hunch the problem will move, as the carma-fpga driver (see drivers/misc/carma/carma-fpga.c) will claim the 4th channel instead. Ira ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
Ira W. Snyder wrote: > This leads me to believe that this occurs mostly (but not always) > concurrent with the end-of-chain interrupt. Have you tested this on an 85xx platform? I noticed something odd. You're modifying fsldma_chan_irq(), which is for DMA controllers that have per-channel IRQs. 83xx devices don't have per-channel IRQs -- all channels on one controller have the same IRQ. Looking at the device tree, I see that the IRQs are listed in the channel nodes *and* in the controller node. I don't see how we ever use the per-controller ISR. I wonder if the shared IRQ is the part of the cause of the interrupts you're seeing. > > In the last month, the "unhandled sr" error has occurred on 92 out of > 120 boards in production use. The statistics are included below. On some > boards, it is much more frequent than on others. All boards have roughly > the same workload. > > Another interesting tidbit from my logs: this only occurs on DMA channel > 2 (the are numbered starting at 0, it is the 3rd channel). Here is an > example log message: What happens if you never register that channel? That is, remove this node from the device tree: dma-channel@100 { compatible = "fsl,mpc8349-dma-channel", "fsl,elo-dma-channel"; reg = <0x100 0x80>; cell-index = <2>; interrupt-parent = <&ipic>; interrupts = <71 8>; }; -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
On Thu, Feb 16, 2012 at 05:50:47PM +, Tabi Timur-B04825 wrote: > On Thu, Jan 26, 2012 at 2:58 PM, Ira W. Snyder wrote: > > The mpc8349ea has been observed to generate spurious end of segments > > interrupts despite the fact that they are not enabled by this driver. > > Check for them and ignore them to avoid a kernel error message. > > When this happens, are there any other status bits set? It seems > weird that there are spurious interrupts from an internal block, > especially since it's the same block on all 83xx parts. > > I wonder if the EOSI bit just happens to be set when the interrupt > occurs for some other reason. > I'm not sure. The fsldma irq handler only prints bits it did not handle. There are several other bits in the driver which should never be seen, but they are handled by the irq handler anyway. This is just a remnant from the original Freescale code. I have a set of 15 test boards that I can use to figure out which other bits are set when this happens, if it is important. I put a variation of this patch (missing the "skip tasklet if not idle" logic) into my production boards roughly a month ago. I've gotten the "controller not idle" error message 748 times, as compared to the "unhandled sr 0x0002" message 3449 times. This leads me to believe that this occurs mostly (but not always) concurrent with the end-of-chain interrupt. In the last month, the "unhandled sr" error has occurred on 92 out of 120 boards in production use. The statistics are included below. On some boards, it is much more frequent than on others. All boards have roughly the same workload. Another interesting tidbit from my logs: this only occurs on DMA channel 2 (the are numbered starting at 0, it is the 3rd channel). Here is an example log message: [3484053.821689] of:fsl-elo-dma e00082a8.dma: chan2: irq: unhandled sr 0x0002 Thanks, Ira 15 serial-number-5 1 serial-number-16 8 serial-number-18 16 serial-number-19 3 serial-number-20 21 serial-number-21 1 serial-number-24 1 serial-number-26 3 serial-number-27 2 serial-number-28 16 serial-number-29 4 serial-number-30 1 serial-number-31 4 serial-number-32 5 serial-number-33 1 serial-number-34 6 serial-number-35 18 serial-number-36 1 serial-number-39 1 serial-number-40 2 serial-number-41 10 serial-number-42 11 serial-number-43 32 serial-number-45 6 serial-number-46 4 serial-number-47 1 serial-number-49 6 serial-number-50 2 serial-number-51 4 serial-number-53 1 serial-number-55 1 serial-number-57 15 serial-number-58 1 serial-number-60 1 serial-number-62 1 serial-number-66 8 serial-number-67 2 serial-number-75 1 serial-number-76 11 serial-number-79 4 serial-number-80 8 serial-number-81 1 serial-number-82 11 serial-number-84 2 serial-number-92 20 serial-number-93 30 serial-number-94 19 serial-number-95 32 serial-number-96 73 serial-number-97 18 serial-number-99 57 serial-number-100 41 serial-number-101 28 serial-number-102 8 serial-number-103 132 serial-number-107 60 serial-number-108 55 serial-number-109 97 serial-number-110 18 serial-number-111 45 serial-number-113 6 serial-number-114 123 serial-number-115 27 serial-number-117 29 serial-number-118 12 serial-number-119 47 serial-number-120 74 serial-number-121 8 serial-number-124 128 serial-number-125 326 serial-number-128 84 serial-number-129 36 serial-number-130 2 serial-number-131 75 serial-number-133 64 serial-number-135 686 serial-number-137 97 serial-number-139 28 serial-number-140 82 serial-number-141 36 serial-number-144 31 serial-number-145 47 serial-number-147 60 serial-number-150 22 serial-number-152 36 serial-number-154 57 serial-number-156 68 serial-number-158 54 serial-number-159 37 serial-number-160 46 serial-number-161 14 serial-number-162 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 08/27] irq_domain: Move irq_domain code from powerpc to kernel/irq
OK, forget about it, I've just seen your email on that and pulled your latest update. Regards, Benoit On 2/16/2012 6:38 PM, Cousson, Benoit wrote: Hi Grant, It looks like there is a small regression in that update, it cannot build due to a missing semi-colon. On 2/16/2012 10:09 AM, Grant Likely wrote: +/** + * irq_find_mapping() - Find a linux irq from an hw irq number. + * @host: domain owning this hardware interrupt + * @hwirq: hardware irq number in that host space + * + * This is a slow path, for use by generic code. It's expected that an + * irq controller implementation directly calls the appropriate low level + * mapping function. + */ +unsigned int irq_find_mapping(struct irq_domain *host, + irq_hw_number_t hwirq) +{ + unsigned int i; + unsigned int hint = hwirq % irq_virq_count; + + /* Look for default host if nececssary */ + if (host == NULL) + host = irq_default_host; + if (host == NULL) + return NO_IRQ; + + /* legacy -> bail early */ + if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) + return hwirq; + + /* Slow path does a linear search of the map */ + if (hint == 0) + hint = 1; + i = hint; + do { + struct irq_data *data = irq_get_irq_data(i); + if (data&& (data->domain == host)&& (data->hwirq == hwirq)) + return i; + i++; + if (i>= irq_virq_count) + i = 1 The ";" is missing. Regards, Benoit ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/1] fsldma: ignore end of segments interrupt
On Thu, Jan 26, 2012 at 2:58 PM, Ira W. Snyder wrote: > The mpc8349ea has been observed to generate spurious end of segments > interrupts despite the fact that they are not enabled by this driver. > Check for them and ignore them to avoid a kernel error message. When this happens, are there any other status bits set? It seems weird that there are spurious interrupts from an internal block, especially since it's the same block on all 83xx parts. I wonder if the EOSI bit just happens to be set when the interrupt occurs for some other reason. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 16.02.2012, at 18:36, Scott Wood wrote: > On 02/16/2012 11:30 AM, Alexander Graf wrote: >> >> On 16.02.2012, at 18:28, Scott Wood wrote: >> >>> On 02/16/2012 11:18 AM, Alexander Graf wrote: Hrm. But we can clobber ctr, right? So how about we make the generic version do a bctr and then just do a small C wrapper that takes lr, moves it to ctr and branches to the generic one? >>> >>> If it's just for this, I would say don't mess with the normal hcall path >>> for the sake of idle. If using CTR would let us get away without >>> creating a stack frame in call sites, maybe that would be worthwhile, >>> depending on what sort of hcalls we end up having. >>> Then we don't have to replicate the hypercall code all over again for every invocation. >>> >>> We shouldn't need to do it for every invocation. Idle is special due to >>> the TLF_NAPPING hack. >> >> Famous last words. If it's the only case, duplication should be ok. Let's >> hope there are no others. > > Actually, we can't use CTR -- it's volatile in the ePAPR hypercall ABI. Ugh. Alrighty, let's duplicate the hc code then. Alex ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 08/27] irq_domain: Move irq_domain code from powerpc to kernel/irq
Hi Grant, It looks like there is a small regression in that update, it cannot build due to a missing semi-colon. On 2/16/2012 10:09 AM, Grant Likely wrote: +/** + * irq_find_mapping() - Find a linux irq from an hw irq number. + * @host: domain owning this hardware interrupt + * @hwirq: hardware irq number in that host space + * + * This is a slow path, for use by generic code. It's expected that an + * irq controller implementation directly calls the appropriate low level + * mapping function. + */ +unsigned int irq_find_mapping(struct irq_domain *host, + irq_hw_number_t hwirq) +{ + unsigned int i; + unsigned int hint = hwirq % irq_virq_count; + + /* Look for default host if nececssary */ + if (host == NULL) + host = irq_default_host; + if (host == NULL) + return NO_IRQ; + + /* legacy -> bail early */ + if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) + return hwirq; + + /* Slow path does a linear search of the map */ + if (hint == 0) + hint = 1; + i = hint; + do { + struct irq_data *data = irq_get_irq_data(i); + if (data&& (data->domain == host)&& (data->hwirq == hwirq)) + return i; + i++; + if (i>= irq_virq_count) + i = 1 The ";" is missing. Regards, Benoit ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 02/16/2012 11:30 AM, Alexander Graf wrote: > > On 16.02.2012, at 18:28, Scott Wood wrote: > >> On 02/16/2012 11:18 AM, Alexander Graf wrote: >>> Hrm. But we can clobber ctr, right? So how about we make the generic >>> version do a bctr and then just do a small C wrapper that takes lr, moves >>> it to ctr and branches to the generic one? >> >> If it's just for this, I would say don't mess with the normal hcall path >> for the sake of idle. If using CTR would let us get away without >> creating a stack frame in call sites, maybe that would be worthwhile, >> depending on what sort of hcalls we end up having. >> >>> Then we don't have to replicate the hypercall code all over again for every >>> invocation. >> >> We shouldn't need to do it for every invocation. Idle is special due to >> the TLF_NAPPING hack. > > Famous last words. If it's the only case, duplication should be ok. Let's > hope there are no others. Actually, we can't use CTR -- it's volatile in the ePAPR hypercall ABI. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 16.02.2012, at 18:28, Scott Wood wrote: > On 02/16/2012 11:18 AM, Alexander Graf wrote: >> >> On 16.02.2012, at 17:58, Scott Wood wrote: >> >>> On 02/16/2012 04:24 AM, Alexander Graf wrote: On 16.02.2012, at 10:26, Liu Yu wrote: > +_GLOBAL(epapr_ev_idle) > +epapr_ev_idle: > +rlwinmr3,r1,0,0,31-THREAD_SHIFT/* current thread_info */ > +lwzr4,TI_LOCAL_FLAGS(r3)/* set napping bit */ > +orir4,r4,_TLF_NAPPING/* so when we take an exception */ > +stwr4,TI_LOCAL_FLAGS(r3)/* it will return to our caller */ > + > +wrteei1 > + > +idle_loop: > +LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) > + > +.global epapr_ev_idle_start > +epapr_ev_idle_start: > +lir3, -1 > +nop > +nop > +nop Can't you just bl into epapr_hypercall_start? You don't even have to save the old lr. because we never return anyways :) >>> >>> The interrupt will branch to LR, so no, we can't trash it or put it >>> anywhere else. >> >> Hrm. But we can clobber ctr, right? So how about we make the generic version >> do a bctr and then just do a small C wrapper that takes lr, moves it to ctr >> and branches to the generic one? > > If it's just for this, I would say don't mess with the normal hcall path > for the sake of idle. If using CTR would let us get away without > creating a stack frame in call sites, maybe that would be worthwhile, > depending on what sort of hcalls we end up having. > >> Then we don't have to replicate the hypercall code all over again for every >> invocation. > > We shouldn't need to do it for every invocation. Idle is special due to > the TLF_NAPPING hack. Famous last words. If it's the only case, duplication should be ok. Let's hope there are no others. Alex ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 02/16/2012 11:18 AM, Alexander Graf wrote: > > On 16.02.2012, at 17:58, Scott Wood wrote: > >> On 02/16/2012 04:24 AM, Alexander Graf wrote: >>> On 16.02.2012, at 10:26, Liu Yu wrote: +_GLOBAL(epapr_ev_idle) +epapr_ev_idle: +rlwinmr3,r1,0,0,31-THREAD_SHIFT/* current thread_info */ +lwzr4,TI_LOCAL_FLAGS(r3)/* set napping bit */ +orir4,r4,_TLF_NAPPING/* so when we take an exception */ +stwr4,TI_LOCAL_FLAGS(r3)/* it will return to our caller */ + +wrteei1 + +idle_loop: +LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) + +.global epapr_ev_idle_start +epapr_ev_idle_start: +lir3, -1 +nop +nop +nop >>> >>> Can't you just bl into epapr_hypercall_start? You don't even have to save >>> the old lr. because we never return anyways :) >> >> The interrupt will branch to LR, so no, we can't trash it or put it >> anywhere else. > > Hrm. But we can clobber ctr, right? So how about we make the generic version > do a bctr and then just do a small C wrapper that takes lr, moves it to ctr > and branches to the generic one? If it's just for this, I would say don't mess with the normal hcall path for the sake of idle. If using CTR would let us get away without creating a stack frame in call sites, maybe that would be worthwhile, depending on what sort of hcalls we end up having. > Then we don't have to replicate the hypercall code all over again for every > invocation. We shouldn't need to do it for every invocation. Idle is special due to the TLF_NAPPING hack. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/2] [v2] powerpc/fsl: add PAMUBYPENR register definition to fsl_guts.h
Add a defintion of register PAMUBYPENR (offset 0x604) to the global utilities structure. PAMUBYPENR is the PAMU bypass enable register. It contains control bits for enabling bypass mode on each PAMU. Signed-off-by: Timur Tabi --- arch/powerpc/include/asm/fsl_guts.h |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h index a880377..23e483d 100644 --- a/arch/powerpc/include/asm/fsl_guts.h +++ b/arch/powerpc/include/asm/fsl_guts.h @@ -69,7 +69,9 @@ struct ccsr_guts { u8 res0c4[0x224 - 0xc4]; __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ - u8 res22c[0x800 - 0x22c]; + u8 res22c[0x604 - 0x22c]; + __be32 pamubypenr; /* 0x.0604 - PAMU bypass enable register */ + u8 res608[0x800 - 0x608]; __be32 clkdvdr;/* 0x.0800 - Clock Divide Register */ u8 res804[0x900 - 0x804]; __be32 ircr; /* 0x.0900 - Infrared Control Register */ -- 1.7.3.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] powerpc/8xxx: remove 85xx/86xx restrictions from fsl_guts.h
Remove the check for CONFIG_PPC_85xx and CONFIG_PPC_86xx from fsl_guts.h. The check was originally intended to allow the same header file to be used on 85xx and 86xx systems, even though the Global Utilities register could be different. It turns out that they're not actually different, and so the check is not necessary. In addition, neither macro is defined for 64-bit e5500 kernels, so that causes a build break. To maintain backwards compatibility, we also define macros for ccsr_guts_85xx and ccsr_guts_86xx. This eliminates the need to change all the files that #include fsl_guts.h. Those files will be updated at a later time, and then the macros can be deleted. Signed-off-by: Timur Tabi --- arch/powerpc/include/asm/fsl_guts.h | 26 +++--- 1 files changed, 7 insertions(+), 19 deletions(-) diff --git a/arch/powerpc/include/asm/fsl_guts.h b/arch/powerpc/include/asm/fsl_guts.h index bebd124..a880377 100644 --- a/arch/powerpc/include/asm/fsl_guts.h +++ b/arch/powerpc/include/asm/fsl_guts.h @@ -16,15 +16,6 @@ #define __ASM_POWERPC_FSL_GUTS_H__ #ifdef __KERNEL__ -/* - * These #ifdefs are safe because it's not possible to build a kernel that - * runs on e500 and e600 cores. - */ - -#if !defined(CONFIG_PPC_85xx) && !defined(CONFIG_PPC_86xx) -#error Only 85xx and 86xx SOCs are supported -#endif - /** * Global Utility Registers. * @@ -36,11 +27,7 @@ * different names. In these cases, one name is chosen to avoid extraneous * #ifdefs. */ -#ifdef CONFIG_PPC_85xx -struct ccsr_guts_85xx { -#else -struct ccsr_guts_86xx { -#endif +struct ccsr_guts { __be32 porpllsr; /* 0x. - POR PLL Ratio Status Register */ __be32 porbmsr;/* 0x.0004 - POR Boot Mode Status Register */ __be32 porimpscr; /* 0x.0008 - POR I/O Impedance Status and Control Register */ @@ -77,11 +64,8 @@ struct ccsr_guts_86xx { u8 res0a8[0xb0 - 0xa8]; __be32 rstcr; /* 0x.00b0 - Reset Control Register */ u8 res0b4[0xc0 - 0xb4]; -#ifdef CONFIG_PPC_85xx - __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register */ -#else - __be32 elbcvselcr; /* 0x.00c0 - eLBC Voltage Select Ctrl Reg */ -#endif + __be32 iovselsr; /* 0x.00c0 - I/O voltage select status register +Called 'elbcvselcr' on 86xx SOCs */ u8 res0c4[0x224 - 0xc4]; __be32 iodelay1; /* 0x.0224 - IO delay control register 1 */ __be32 iodelay2; /* 0x.0228 - IO delay control register 2 */ @@ -114,6 +98,10 @@ struct ccsr_guts_86xx { __be32 srds2cr1; /* 0x.0f44 - SerDes2 Control Register 0 */ } __attribute__ ((packed)); +/* For backwards-compatibility */ +#define ccsr_guts_85xx ccsr_guts +#define ccsr_guts_86xx ccsr_guts + #ifdef CONFIG_PPC_86xx #define CCSR_GUTS_DMACR_DEV_SSI0 /* DMA controller/channel set to SSI */ -- 1.7.3.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 16.02.2012, at 17:58, Scott Wood wrote: > On 02/16/2012 04:24 AM, Alexander Graf wrote: >> On 16.02.2012, at 10:26, Liu Yu wrote: >>> +_GLOBAL(epapr_ev_idle) >>> +epapr_ev_idle: >>> +rlwinmr3,r1,0,0,31-THREAD_SHIFT/* current thread_info */ >>> +lwzr4,TI_LOCAL_FLAGS(r3)/* set napping bit */ >>> +orir4,r4,_TLF_NAPPING/* so when we take an exception */ >>> +stwr4,TI_LOCAL_FLAGS(r3)/* it will return to our caller */ >>> + >>> +wrteei1 >>> + >>> +idle_loop: >>> +LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) >>> + >>> +.global epapr_ev_idle_start >>> +epapr_ev_idle_start: >>> +lir3, -1 >>> +nop >>> +nop >>> +nop >> >> Can't you just bl into epapr_hypercall_start? You don't even have to save >> the old lr. because we never return anyways :) > > The interrupt will branch to LR, so no, we can't trash it or put it > anywhere else. Hrm. But we can clobber ctr, right? So how about we make the generic version do a bctr and then just do a small C wrapper that takes lr, moves it to ctr and branches to the generic one? Then we don't have to replicate the hypercall code all over again for every invocation. Alex ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: tlb flushing on Power
On 02/10/2012 01:14 PM, Seth Jennings wrote: > On 02/08/2012 03:04 PM, Benjamin Herrenschmidt wrote: >> >>> You can look at https://lkml.org/lkml/2012/1/9/389 in zsmalloc-main.c, >>> zs_[un]map_object() functions for the currently uses of set_pte() and >>> __flush_tlb_one(). >>> set_pte() is long gone on all archs really (or if it's still there it's not meant to be used as is), use set_pte_at(). >>> >>> Problem with set_pte_at() for us is that we don't have an mm_struct to pass >>> because the mapping is not for a userspace process but for the kernel >>> itself. >> >> Then use init_mm > > Thanks, that's what I was looking for. > >>> However, I do think this is the portable function we need to be using. Just >>> need to figure out what to pass in for the mm_struct param. >>> __flush_tlb_one() doesn't mean anything as an arch independent functionality. We have a local_flush_tlb_page() that -might- do what you want but why in hell is that patch not using proper existing interfaces ? >>> >>> flush_tlb_page() is the portable function we should be using. However, >>> again, it requires a vma_area_struct. I'm not sure what we should be >>> passing there. >> >> Do you need this to be CPU local flush or global ? In the later, >> flush_tlb_kernel_range() is the right API. >> >> If you want per-cpu, we'll have to add a new arch hook. > > We have interrupts disabled, due to the get_cpu_var() on the percpu variable > zs_map_area in zs_map_object(), while the allocation is mapped. So a CPU > local > would be what we need. Hey Ben, Just wanted to bump you again about this. You mentioned that if I wanted to do a cpu-local flush of a single tlb entry, that there would have to be a new hook. Is that right? I've been looking through the powerpc arch and I thought that I might have found the power analog to __flush_tlb_one() for x86 in local_flush_tlb_page() with a NULL vma argument. This doesn't seem to work though, as indicated by a crash when I tried it. After looking in tlbflush.h again, it seems that local_flush_tlb_page() is a no-op when CONFIG_PPC_STD_MMU_64 is set, as are almost ALL of the tlb flushing functions... which makes no sense to me. Any help you (or anyone) can give me would be greatly appreciated. -- Seth ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 02/16/2012 03:26 AM, Liu Yu wrote: > If the guest hypervisor node contains "has-idle" property. > > Signed-off-by: Liu Yu > --- > v4: > 1. discard the CONFIG_E500 to make code for all powerpc platform > 2. code cleanup Is the TLF_NAPPING stuff supported on all powerpc platforms? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 1/3] KVM: PPC: epapr: Factor out the epapr init
On 02/16/2012 03:26 AM, Liu Yu wrote: > from the kvm guest paravirt init code. > > Signed-off-by: Liu Yu > --- > v4: > 1. code cleanup > 2. move kvm_hypercall_start() to epapr_hypercall_start() > > arch/powerpc/Kconfig|4 ++ > arch/powerpc/include/asm/epapr_hcalls.h |2 + > arch/powerpc/kernel/Makefile|1 + > arch/powerpc/kernel/epapr.S | 25 > arch/powerpc/kernel/epapr_para.c| 49 > +++ > arch/powerpc/kernel/kvm.c | 28 ++ > arch/powerpc/kernel/kvm_emul.S | 10 -- > arch/powerpc/kvm/Kconfig|1 + > 8 files changed, 85 insertions(+), 35 deletions(-) > create mode 100644 arch/powerpc/kernel/epapr.S > create mode 100644 arch/powerpc/kernel/epapr_para.c The comment about spelling out "paravirt" wasnn't meant to be restricted to the kconfig symbol. There are lots of words that begin with "para", and ePAPR isn't just about virtualization. > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index 1919634..1262b43 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -202,6 +202,10 @@ config EPAPR_BOOT > Used to allow a board to specify it wants an ePAPR compliant wrapper. > default n > > +config EPAPR_PARAVIRT > + bool > + default n Why isn't this user-selectable? It's useful on its own. > diff --git a/arch/powerpc/kernel/epapr.S b/arch/powerpc/kernel/epapr.S > new file mode 100644 > index 000..697b390 > --- /dev/null > +++ b/arch/powerpc/kernel/epapr.S epapr-hcall.S > +bool epapr_para_enabled = false; > + > +static int __init epapr_para_init(void) > +{ > + struct device_node *hyper_node; > + const u32 *insts; > + int len, i; > + > + hyper_node = of_find_node_by_path("/hypervisor"); > + if (!hyper_node) > + return -ENODEV; > + > + insts = of_get_property(hyper_node, "hcall-instructions", &len); > + if (!(len % 4) && (len >= (4 * 4))) { > + for (i = 0; i < (len / 4); i++) > + epapr_hypercall_start[i] = insts[i]; > + flush_icache_range((ulong)epapr_hypercall_start, > +(ulong)epapr_hypercall_start + len); > + > + epapr_para_enabled = true; > + } Use patch_instruction(), fix the if test, and remove unnecessary parentheses. Print an error if the if test fails, but return silently if the property is absent. Please make asm/epapr_hcalls.h and asm/fsl_hcalls.h work with this as well. -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 02/16/2012 04:24 AM, Alexander Graf wrote: > On 16.02.2012, at 10:26, Liu Yu wrote: >> +_GLOBAL(epapr_ev_idle) >> +epapr_ev_idle: >> +rlwinmr3,r1,0,0,31-THREAD_SHIFT/* current thread_info */ >> +lwzr4,TI_LOCAL_FLAGS(r3)/* set napping bit */ >> +orir4,r4,_TLF_NAPPING/* so when we take an exception */ >> +stwr4,TI_LOCAL_FLAGS(r3)/* it will return to our caller */ >> + >> +wrteei1 >> + >> +idle_loop: >> +LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) >> + >> +.global epapr_ev_idle_start >> +epapr_ev_idle_start: >> +lir3, -1 >> +nop >> +nop >> +nop > > Can't you just bl into epapr_hypercall_start? You don't even have to save the > old lr. because we never return anyways :) The interrupt will branch to LR, so no, we can't trash it or put it anywhere else. -scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] arch/powerpc/platforms/powernv/setup.c: included asm/xics.h twice
arch/powerpc/platforms/powernv/setup.c: included 'asm/xics.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka --- arch/powerpc/platforms/powernv/setup.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c index 467bd4a..db1ad1c 100644 --- a/arch/powerpc/platforms/powernv/setup.c +++ b/arch/powerpc/platforms/powernv/setup.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "powernv.h" -- 1.7.8.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] arch/powerpc/kvm/book3s_hv.c: included linux/sched.h twice
arch/powerpc/kvm/book3s_hv.c: included 'linux/sched.h' twice, remove the duplicate. Signed-off-by: Danny Kukawka --- arch/powerpc/kvm/book3s_hv.c |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 336983d..a726716 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include -- 1.7.8.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
On Thu, Feb 16, 2012 at 09:39:15PM +1100, Benjamin Herrenschmidt wrote: > On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > > If USB UTMI PHY is not enable, writing to portsc register will lead to > > kernel hang during boot up. > > Thanks, I'll try that tomorrow. > > Greg, you're picking that up or should I ? I can, if you let me know that this fixes your problem :) thanks, greg k-h ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] arch/powerpc/kvm/book3s_hv.c: included linux/sched.h twice
On 02/16/2012 03:55 PM, Danny Kukawka wrote: > arch/powerpc/kvm/book3s_hv.c: included 'linux/sched.h' twice, > remove the duplicate. > Thanks, applied. -- error compiling committee.c: too many arguments to function ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] powerpc/85xx: fix problem that prevents PHYS_64BIT from configurable
On Thu, Feb 16, 2012 at 6:10 AM, Li Yang wrote: > > The reason why we need to keep PHYS_64BIT option configurable is > that enabling it cause negative performance impact on various > aspects like TLB miss and physical address manipulating. We should > not enable it unless really needed, e.g. use large memory of 4GB > or bigger. I think we should make 36-bit the only option for the upstream defconfigs, and if we want a 32-bit "optimized" kernel for the SDK, then we provide that on the SDK only. -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] powerpc/85xx: fix problem that prevents PHYS_64BIT from configurable
On Thu, Feb 16, 2012 at 9:56 AM, Tabi Timur-B04825 wrote: > I think we should make 36-bit the only option for the upstream > defconfigs, and if we want a 32-bit "optimized" kernel for the SDK, > then we provide that on the SDK only. Oops, I meant to post this as a reply to "powerpc/85xx: add a 36-bit corenet default config". -- Timur Tabi Linux kernel developer at Freescale ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v5 08/27] irq_domain: Move irq_domain code from powerpc to kernel/irq
On Thu, Feb 16, 2012 at 2:09 AM, Grant Likely wrote: > This patch only moves the code. It doesn't make any changes, and the > code is still only compiled for powerpc. Follow-on patches will generalize > the code for other architectures. > > Signed-off-by: Grant Likely > Cc: Benjamin Herrenschmidt > Cc: Thomas Gleixner > Cc: Milton Miller > Tested-by: Olof Johansson > --- > +unsigned int irq_find_mapping(struct irq_domain *host, > + irq_hw_number_t hwirq) > +{ > + unsigned int i; > + unsigned int hint = hwirq % irq_virq_count; > + > + /* Look for default host if nececssary */ > + if (host == NULL) > + host = irq_default_host; > + if (host == NULL) > + return NO_IRQ; > + > + /* legacy -> bail early */ > + if (host->revmap_type == IRQ_DOMAIN_MAP_LEGACY) > + return hwirq; > + > + /* Slow path does a linear search of the map */ > + if (hint == 0) > + hint = 1; > + i = hint; > + do { > + struct irq_data *data = irq_get_irq_data(i); > + if (data && (data->domain == host) && (data->hwirq == hwirq)) > + return i; > + i++; > + if (i >= irq_virq_count) > + i = 1 Typo on this line; missing semicolon. Fixed in my tree now. g. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/2] powerpc/85xx: add a 36-bit corenet default config
This default config should be used by platforms that only provides 36-bit software support in tree, such as P3041DS, P3060QDS, P4080DS, P5020DS, and etc. Signed-off-by: Li Yang --- arch/powerpc/configs/corenet36_smp_defconfig | 185 ++ 1 files changed, 185 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/configs/corenet36_smp_defconfig diff --git a/arch/powerpc/configs/corenet36_smp_defconfig b/arch/powerpc/configs/corenet36_smp_defconfig new file mode 100644 index 000..9765b4d --- /dev/null +++ b/arch/powerpc/configs/corenet36_smp_defconfig @@ -0,0 +1,185 @@ +CONFIG_PPC_85xx=y +CONFIG_PHYS_64BIT=y +CONFIG_SMP=y +CONFIG_NR_CPUS=8 +CONFIG_EXPERIMENTAL=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_AUDIT=y +CONFIG_SPARSE_IRQ=y +CONFIG_RCU_TRACE=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_BLK_DEV_INITRD=y +CONFIG_KALLSYMS_ALL=y +CONFIG_EMBEDDED=y +CONFIG_PERF_EVENTS=y +CONFIG_SLAB=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y +CONFIG_MODVERSIONS=y +# CONFIG_BLK_DEV_BSG is not set +CONFIG_P2041_RDB=y +CONFIG_P3041_DS=y +CONFIG_P3060_QDS=y +CONFIG_P4080_DS=y +CONFIG_P5020_DS=y +CONFIG_HIGHMEM=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_BINFMT_MISC=m +CONFIG_KEXEC=y +CONFIG_FORCE_MAX_ZONEORDER=13 +CONFIG_FSL_LBC=y +CONFIG_PCI=y +CONFIG_PCIEPORTBUS=y +# CONFIG_PCIEASPM is not set +CONFIG_RAPIDIO=y +CONFIG_FSL_RIO=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_XFRM_USER=y +CONFIG_XFRM_SUB_POLICY=y +CONFIG_XFRM_STATISTICS=y +CONFIG_NET_KEY=y +CONFIG_NET_KEY_MIGRATE=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_IP_ROUTE_MULTIPATH=y +CONFIG_IP_ROUTE_VERBOSE=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NET_IPIP=y +CONFIG_IP_MROUTE=y +CONFIG_IP_PIMSM_V1=y +CONFIG_IP_PIMSM_V2=y +CONFIG_ARPD=y +CONFIG_INET_AH=y +CONFIG_INET_ESP=y +CONFIG_INET_IPCOMP=y +# CONFIG_INET_LRO is not set +CONFIG_IPV6=y +CONFIG_IP_SCTP=m +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_MTD=y +CONFIG_MTD_CMDLINE_PARTS=y +CONFIG_MTD_CHAR=y +CONFIG_MTD_BLOCK=y +CONFIG_MTD_CFI=y +CONFIG_MTD_CFI_AMDSTD=y +CONFIG_MTD_PHYSMAP_OF=y +CONFIG_MTD_M25P80=y +CONFIG_PROC_DEVICETREE=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_SIZE=131072 +CONFIG_MISC_DEVICES=y +CONFIG_BLK_DEV_SD=y +CONFIG_CHR_DEV_ST=y +CONFIG_BLK_DEV_SR=y +CONFIG_CHR_DEV_SG=y +CONFIG_SCSI_MULTI_LUN=y +CONFIG_SCSI_LOGGING=y +CONFIG_SCSI_SYM53C8XX_2=y +CONFIG_ATA=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_FSL=y +CONFIG_SATA_SIL24=y +CONFIG_SATA_SIL=y +CONFIG_PATA_SIL680=y +CONFIG_NETDEVICES=y +CONFIG_FSL_PQ_MDIO=y +CONFIG_E1000=y +CONFIG_E1000E=y +CONFIG_VITESSE_PHY=y +CONFIG_FIXED_PHY=y +# CONFIG_INPUT_MOUSEDEV is not set +# CONFIG_INPUT_KEYBOARD is not set +# CONFIG_INPUT_MOUSE is not set +CONFIG_SERIO_LIBPS2=y +# CONFIG_LEGACY_PTYS is not set +CONFIG_PPC_EPAPR_HV_BYTECHAN=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_8250_EXTENDED=y +CONFIG_SERIAL_8250_MANY_PORTS=y +CONFIG_SERIAL_8250_DETECT_IRQ=y +CONFIG_SERIAL_8250_RSA=y +CONFIG_HW_RANDOM=y +CONFIG_NVRAM=y +CONFIG_I2C=y +CONFIG_I2C_MPC=y +CONFIG_SPI=y +CONFIG_SPI_GPIO=y +CONFIG_SPI_FSL_SPI=y +CONFIG_SPI_FSL_ESPI=y +# CONFIG_HWMON is not set +CONFIG_VIDEO_OUTPUT_CONTROL=y +CONFIG_USB_HID=m +CONFIG_USB=y +CONFIG_USB_DEVICEFS=y +CONFIG_USB_MON=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_FSL=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PPC_OF_BE=y +CONFIG_USB_OHCI_HCD_PPC_OF_LE=y +CONFIG_USB_STORAGE=y +CONFIG_MMC=y +CONFIG_MMC_SDHCI=y +CONFIG_EDAC=y +CONFIG_EDAC_MM_EDAC=y +CONFIG_EDAC_MPC85XX=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_DS3232=y +CONFIG_RTC_DRV_CMOS=y +CONFIG_UIO=y +CONFIG_STAGING=y +CONFIG_VIRT_DRIVERS=y +CONFIG_FSL_HV_MANAGER=y +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +CONFIG_ISO9660_FS=m +CONFIG_JOLIET=y +CONFIG_ZISOFS=y +CONFIG_UDF_FS=m +CONFIG_MSDOS_FS=m +CONFIG_VFAT_FS=y +CONFIG_NTFS_FS=y +CONFIG_PROC_KCORE=y +CONFIG_TMPFS=y +CONFIG_HUGETLBFS=y +CONFIG_JFFS2_FS=y +CONFIG_CRAMFS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_NFSD=m +CONFIG_PARTITION_ADVANCED=y +CONFIG_MAC_PARTITION=y +CONFIG_NLS_ISO8859_1=y +CONFIG_NLS_UTF8=m +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_SHIRQ=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_DEBUG_INFO=y +CONFIG_SYSCTL_SYSCALL_CHECK=y +CONFIG_CRYPTO_NULL=y +CONFIG_CRYPTO_PCBC=m +CONFIG_CRYPTO_MD4=y +CONFIG_CRYPTO_SHA256=y +CONFIG_CRYPTO_SHA512=y +CONFIG_CRYPTO_AES=y +# CONFIG_CRYPTO_ANSI_CPRNG is not set +CONFIG_CRYPTO_DEV_FSL_CAAM=y -- 1.5.4.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 1/2] powerpc/85xx: fix problem that prevents PHYS_64BIT from configurable
Fix the problem that large physical address support cannot be disabled when some platforms which only provides 36-bit support are selected. According to the philosophy of kernel config enabling a platform support doesn't mean the kernel is only running on that platform. Remove the auto selection of PHYS_64BIT option for these platforms. They will need to use a 36bit default config that selects PHYS_64BIT explicitly. The reason why we need to keep PHYS_64BIT option configurable is that enabling it cause negative performance impact on various aspects like TLB miss and physical address manipulating. We should not enable it unless really needed, e.g. use large memory of 4GB or bigger. Signed-off-by: Li Yang --- arch/powerpc/platforms/85xx/Kconfig |6 -- 1 files changed, 0 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index d7946be..d9bc0bd 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig @@ -80,7 +80,6 @@ config P1010_RDB config P1022_DS bool "Freescale P1022 DS" select DEFAULT_UIMAGE - select PHYS_64BIT # The DTS has 36-bit addresses select SWIOTLB help This option enables support for the Freescale P1022DS reference board. @@ -175,7 +174,6 @@ config P2041_RDB bool "Freescale P2041 RDB" select DEFAULT_UIMAGE select PPC_E500MC - select PHYS_64BIT select SWIOTLB select ARCH_REQUIRE_GPIOLIB select GPIO_MPC8XXX @@ -188,7 +186,6 @@ config P3041_DS bool "Freescale P3041 DS" select DEFAULT_UIMAGE select PPC_E500MC - select PHYS_64BIT select SWIOTLB select ARCH_REQUIRE_GPIOLIB select GPIO_MPC8XXX @@ -201,7 +198,6 @@ config P3060_QDS bool "Freescale P3060 QDS" select DEFAULT_UIMAGE select PPC_E500MC - select PHYS_64BIT select SWIOTLB select GPIO_MPC8XXX select HAS_RAPIDIO @@ -213,7 +209,6 @@ config P4080_DS bool "Freescale P4080 DS" select DEFAULT_UIMAGE select PPC_E500MC - select PHYS_64BIT select SWIOTLB select ARCH_REQUIRE_GPIOLIB select GPIO_MPC8XXX @@ -229,7 +224,6 @@ config P5020_DS select DEFAULT_UIMAGE select E500 select PPC_E500MC - select PHYS_64BIT select SWIOTLB select ARCH_REQUIRE_GPIOLIB select GPIO_MPC8XXX -- 1.5.4.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v7 10/10] fadump: Remove the phyp assisted dump code.
From: Mahesh Salgaonkar Remove the phyp assisted dump implementation which is not is use. Signed-off-by: Mahesh Salgaonkar --- Documentation/powerpc/phyp-assisted-dump.txt | 127 -- arch/powerpc/Kconfig | 10 - arch/powerpc/include/asm/phyp_dump.h | 47 -- arch/powerpc/kernel/prom.c | 87 arch/powerpc/platforms/pseries/Makefile |1 arch/powerpc/platforms/pseries/phyp_dump.c | 513 -- 6 files changed, 0 insertions(+), 785 deletions(-) delete mode 100644 Documentation/powerpc/phyp-assisted-dump.txt delete mode 100644 arch/powerpc/include/asm/phyp_dump.h delete mode 100644 arch/powerpc/platforms/pseries/phyp_dump.c diff --git a/Documentation/powerpc/phyp-assisted-dump.txt b/Documentation/powerpc/phyp-assisted-dump.txt deleted file mode 100644 index ad34020..000 --- a/Documentation/powerpc/phyp-assisted-dump.txt +++ /dev/null @@ -1,127 +0,0 @@ - - Hypervisor-Assisted Dump - - November 2007 - -The goal of hypervisor-assisted dump is to enable the dump of -a crashed system, and to do so from a fully-reset system, and -to minimize the total elapsed time until the system is back -in production use. - -As compared to kdump or other strategies, hypervisor-assisted -dump offers several strong, practical advantages: - --- Unlike kdump, the system has been reset, and loaded - with a fresh copy of the kernel. In particular, - PCI and I/O devices have been reinitialized and are - in a clean, consistent state. --- As the dump is performed, the dumped memory becomes - immediately available to the system for normal use. --- After the dump is completed, no further reboots are - required; the system will be fully usable, and running - in its normal, production mode on its normal kernel. - -The above can only be accomplished by coordination with, -and assistance from the hypervisor. The procedure is -as follows: - --- When a system crashes, the hypervisor will save - the low 256MB of RAM to a previously registered - save region. It will also save system state, system - registers, and hardware PTE's. - --- After the low 256MB area has been saved, the - hypervisor will reset PCI and other hardware state. - It will *not* clear RAM. It will then launch the - bootloader, as normal. - --- The freshly booted kernel will notice that there - is a new node (ibm,dump-kernel) in the device tree, - indicating that there is crash data available from - a previous boot. It will boot into only 256MB of RAM, - reserving the rest of system memory. - --- Userspace tools will parse /sys/kernel/release_region - and read /proc/vmcore to obtain the contents of memory, - which holds the previous crashed kernel. The userspace - tools may copy this info to disk, or network, nas, san, - iscsi, etc. as desired. - - For Example: the values in /sys/kernel/release-region - would look something like this (address-range pairs). - CPU:0x177fee000-0x1: HPTE:0x177ffe020-0x1000: / - DUMP:0x177fff020-0x1000, 0x1000-0x16F1D370A - --- As the userspace tools complete saving a portion of - dump, they echo an offset and size to - /sys/kernel/release_region to release the reserved - memory back to general use. - - An example of this is: - "echo 0x4000 0x1000 > /sys/kernel/release_region" - which will release 256MB at the 1GB boundary. - -Please note that the hypervisor-assisted dump feature -is only available on Power6-based systems with recent -firmware versions. - -Implementation details: --- - -During boot, a check is made to see if firmware supports -this feature on this particular machine. If it does, then -we check to see if a active dump is waiting for us. If yes -then everything but 256 MB of RAM is reserved during early -boot. This area is released once we collect a dump from user -land scripts that are run. If there is dump data, then -the /sys/kernel/release_region file is created, and -the reserved memory is held. - -If there is no waiting dump data, then only the highest -256MB of the ram is reserved as a scratch area. This area -is *not* released: this region will be kept permanently -reserved, so that it can act as a receptacle for a copy -of the low 256MB in the case a crash does occur. See, -however, "open issues" below, as to whether -such a reserved region is really needed. - -Currently the dump will be copied from /proc/vmcore to a -a new file upon user intervention. The starting address -to be read and the range for each data point in provided -in /sys/kernel/release_region. - -The tools to examine the dump will be same as the ones -used for kdump. - -General notes: --- -Security: please note that there are potential security issues -with any sort of dump mechanism. In particular, plaintext -(unencrypted) data, and possibly passwords, may be
[RFC PATCH v7 07/10] fadump: Introduce cleanup routine to invalidate /proc/vmcore.
From: Mahesh Salgaonkar With the firmware-assisted dump support we don't require a reboot when we are in second kernel after crash. The second kernel after crash is a normal kernel boot and has knowledge about entire system RAM with the page tables initialized for entire system RAM. Hence once the dump is saved to disk, we can just release the reserved memory area for general use and continue with second kernel as production kernel. Hence when we release the reserved memory that contains dump data, the '/proc/vmcore' will not be valid anymore. Hence this patch introduces a cleanup routine that invalidates and removes the /proc/vmcore file. This routine will be invoked before we release the reserved dump memory area. Signed-off-by: Mahesh Salgaonkar --- fs/proc/vmcore.c | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index b0f450a..0d5071d 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -700,3 +700,26 @@ static int __init vmcore_init(void) return 0; } module_init(vmcore_init) + +/* Cleanup function for vmcore module. */ +void vmcore_cleanup(void) +{ + struct list_head *pos, *next; + + if (proc_vmcore) { + remove_proc_entry(proc_vmcore->name, proc_vmcore->parent); + proc_vmcore = NULL; + } + + /* clear the vmcore list. */ + list_for_each_safe(pos, next, &vmcore_list) { + struct vmcore *m; + + m = list_entry(pos, struct vmcore, list); + list_del(&m->list); + kfree(m); + } + kfree(elfcorebuf); + elfcorebuf = NULL; +} +EXPORT_SYMBOL_GPL(vmcore_cleanup); ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v7 06/10] fadump: Add PT_NOTE program header for vmcoreinfo
From: Mahesh Salgaonkar Introduce a PT_NOTE program header that points to physical address of vmcoreinfo_note buffer declared in kernel/kexec.c. The vmcoreinfo note buffer is populated during crash_fadump() at the time of system crash. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/kernel/fadump.c | 29 + 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index cab56e7..5689954 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -814,6 +814,19 @@ static void fadump_setup_crash_memory_ranges(void) } } +/* + * If the given physical address falls within the boot memory region then + * return the relocated address that points to the dump region reserved + * for saving initial boot memory contents. + */ +static inline unsigned long fadump_relocate(unsigned long paddr) +{ + if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) + return fdm.rmr_region.destination_address + paddr; + else + return paddr; +} + static int fadump_create_elfcore_headers(char *bufp) { struct elfhdr *elf; @@ -845,6 +858,22 @@ static int fadump_create_elfcore_headers(char *bufp) (elf->e_phnum)++; + /* setup ELF PT_NOTE for vmcoreinfo */ + phdr = (struct elf_phdr *)bufp; + bufp += sizeof(struct elf_phdr); + phdr->p_type= PT_NOTE; + phdr->p_flags = 0; + phdr->p_vaddr = 0; + phdr->p_align = 0; + + phdr->p_paddr = fadump_relocate(paddr_vmcoreinfo_note()); + phdr->p_offset = phdr->p_paddr; + phdr->p_memsz = vmcoreinfo_max_size; + phdr->p_filesz = vmcoreinfo_max_size; + + /* Increment number of program headers. */ + (elf->e_phnum)++; + /* setup PT_LOAD sections. */ for (i = 0; i < crash_mem_ranges; i++) { ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v7 09/10] fadump: Invalidate the fadump registration during machine shutdown.
From: Mahesh Salgaonkar If dump is active during system reboot, shutdown or halt then invalidate the fadump registration as it does not get invalidated automatically. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/kernel/setup-common.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 4e62a56..b0ebdea 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -110,6 +110,14 @@ EXPORT_SYMBOL(ppc_do_canonicalize_irqs); /* also used by kexec */ void machine_shutdown(void) { +#ifdef CONFIG_FA_DUMP + /* +* if fadump is active, cleanup the fadump registration before we +* shutdown. +*/ + fadump_cleanup(); +#endif + if (ppc_md.machine_shutdown) ppc_md.machine_shutdown(); } ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[RFC PATCH v7 08/10] fadump: Invalidate registration and release reserved memory for general use.
From: Mahesh Salgaonkar This patch introduces an sysfs interface '/sys/kernel/fadump_release_mem' to invalidate the last fadump registration, invalidate '/proc/vmcore', release the reserved memory for general use and re-register for future kernel dump. Once the dump is copied to the disk, unlike phyp dump, the userspace tool can release all the memory reserved for dump with one single operation of echo 1 to '/sys/kernel/fadump_release_mem'. Release the reserved memory region excluding the size of the memory required for future kernel dump registration. And therefore, unlike kdump, Fadump doesn't need a 2nd reboot to get back the system to the production configuration. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/include/asm/fadump.h |3 + arch/powerpc/kernel/fadump.c | 158 - 2 files changed, 157 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index 6768195..88dbf96 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h @@ -208,6 +208,9 @@ extern int fadump_reserve_mem(void); extern int setup_fadump(void); extern int is_fadump_active(void); extern void crash_fadump(struct pt_regs *, const char *); +extern void fadump_cleanup(void); + +extern void vmcore_cleanup(void); #else /* CONFIG_FA_DUMP */ static inline int is_fadump_active(void) { return 0; } static inline void crash_fadump(struct pt_regs *regs, const char *str) { } diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 5689954..8874d6b 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include @@ -984,6 +986,132 @@ static int fadump_unregister_dump(struct fadump_mem_struct *fdm) return 0; } +static int fadump_invalidate_dump(struct fadump_mem_struct *fdm) +{ + int rc = 0; + unsigned int wait_time; + + pr_debug("Invalidating firmware-assisted dump registration\n"); + + /* TODO: Add upper time limit for the delay */ + do { + rc = rtas_call(fw_dump.ibm_configure_kernel_dump, 3, 1, NULL, + FADUMP_INVALIDATE, fdm, + sizeof(struct fadump_mem_struct)); + + wait_time = rtas_busy_delay_time(rc); + if (wait_time) + mdelay(wait_time); + } while (wait_time); + + if (rc) { + printk(KERN_ERR "Failed to invalidate firmware-assisted dump " + "rgistration. unexpected error(%d).\n", rc); + return rc; + } + fw_dump.dump_active = 0; + fdm_active = NULL; + return 0; +} + +void fadump_cleanup(void) +{ + /* Invalidate the registration only if dump is active. */ + if (fw_dump.dump_active) { + init_fadump_mem_struct(&fdm, + fdm_active->cpu_state_data.destination_address); + fadump_invalidate_dump(&fdm); + } +} + +/* + * Release the memory that was reserved in early boot to preserve the memory + * contents. The released memory will be available for general use. + */ +static void fadump_release_memory(unsigned long begin, unsigned long end) +{ + unsigned long addr; + unsigned long ra_start, ra_end; + + ra_start = fw_dump.reserve_dump_area_start; + ra_end = ra_start + fw_dump.reserve_dump_area_size; + + for (addr = begin; addr < end; addr += PAGE_SIZE) { + /* +* exclude the dump reserve area. Will reuse it for next +* fadump registration. +*/ + if (addr <= ra_end && ((addr + PAGE_SIZE) > ra_start)) + continue; + + ClearPageReserved(pfn_to_page(addr >> PAGE_SHIFT)); + init_page_count(pfn_to_page(addr >> PAGE_SHIFT)); + free_page((unsigned long)__va(addr)); + totalram_pages++; + } +} + +static void fadump_invalidate_release_mem(void) +{ + unsigned long reserved_area_start, reserved_area_end; + unsigned long destination_address; + + mutex_lock(&fadump_mutex); + if (!fw_dump.dump_active) { + mutex_unlock(&fadump_mutex); + return; + } + + destination_address = fdm_active->cpu_state_data.destination_address; + fadump_cleanup(); + mutex_unlock(&fadump_mutex); + + /* +* Save the current reserved memory bounds we will require them +* later for releasing the memory for general use. +*/ + reserved_area_start = fw_dump.reserve_dump_area_start; + reserved_area_end = reserved_area_start + + fw_dump.reserve_dump_area_size; + /* +* Setup reserve_dump_area_start and its size so that we can +* reuse this reserved memory for Re-registration. +*/ +
[RFC PATCH v7 03/10] fadump: Register for firmware assisted dump.
From: Mahesh Salgaonkar This patch registers for firmware-assisted dump using rtas token ibm,configure-kernel-dump. During registration firmware is informed about the reserved area where it saves the CPU state data, HPTE table and contents of RMR region at the time of kernel crash. Apart from this, firmware also preserves the contents of entire partition memory even if it is not specified during registration. This patch also populates sysfs files under /sys/kernel to display fadump status and reserved memory regions. This patch introduces fadump_registered sysfs control file which will be used by kdump init scripts to start/stop firmware assisted dump. echo 1 to /sys/kernel/fadump_registered file for fadump registration and echo 0 to /sys/kernel/fadump_registered file for fadump un-registration. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/include/asm/fadump.h | 57 ++ arch/powerpc/kernel/fadump.c | 352 + arch/powerpc/kernel/iommu.c |8 + arch/powerpc/mm/hash_utils_64.c | 11 + 4 files changed, 424 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index 7be25d3..bbaf278 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h @@ -48,6 +48,58 @@ #define FADUMP_HPTE_REGION 0x0002 #define FADUMP_REAL_MODE_REGION0x0011 +/* Dump request flag */ +#define FADUMP_REQUEST_FLAG0x0001 + +/* FAD commands */ +#define FADUMP_REGISTER1 +#define FADUMP_UNREGISTER 2 +#define FADUMP_INVALIDATE 3 + +/* Kernel Dump section info */ +struct fadump_section { + u32 request_flag; + u16 source_data_type; + u16 error_flags; + u64 source_address; + u64 source_len; + u64 bytes_dumped; + u64 destination_address; +}; + +/* ibm,configure-kernel-dump header. */ +struct fadump_section_header { + u32 dump_format_version; + u16 dump_num_sections; + u16 dump_status_flag; + u32 offset_first_dump_section; + + /* Fields for disk dump option. */ + u32 dd_block_size; + u64 dd_block_offset; + u64 dd_num_blocks; + u32 dd_offset_disk_path; + + /* Maximum time allowed to prevent an automatic dump-reboot. */ + u32 max_time_auto; +}; + +/* + * Firmware Assisted dump memory structure. This structure is required for + * registering future kernel dump with power firmware through rtas call. + * + * No disk dump option. Hence disk dump path string section is not included. + */ +struct fadump_mem_struct { + struct fadump_section_headerheader; + + /* Kernel dump sections */ + struct fadump_section cpu_state_data; + struct fadump_section hpte_region; + struct fadump_section rmr_region; +}; + +/* Firmware-assisted dump configuration details. */ struct fw_dump { unsigned long cpu_state_data_size; unsigned long hpte_region_size; @@ -62,10 +114,15 @@ struct fw_dump { unsigned long fadump_enabled:1; unsigned long fadump_supported:1; unsigned long dump_active:1; + unsigned long dump_registered:1; }; extern int early_init_dt_scan_fw_dump(unsigned long node, const char *uname, int depth, void *data); extern int fadump_reserve_mem(void); +extern int setup_fadump(void); +extern int is_fadump_active(void); +#else /* CONFIG_FA_DUMP */ +static inline int is_fadump_active(void) { return 0; } #endif #endif diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index deb276a..13c22cd 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -29,6 +29,9 @@ #include #include +#include +#include +#include #include #include @@ -36,6 +39,10 @@ #include static struct fw_dump fw_dump; +static struct fadump_mem_struct fdm; +static const struct fadump_mem_struct *fdm_active; + +static DEFINE_MUTEX(fadump_mutex); /* Scan the Firmware Assisted dump configuration details. */ int __init early_init_dt_scan_fw_dump(unsigned long node, @@ -64,7 +71,8 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, * The 'ibm,kernel-dump' rtas node is present only if there is * dump data waiting for us. */ - if (of_get_flat_dt_prop(node, "ibm,kernel-dump", NULL)) + fdm_active = of_get_flat_dt_prop(node, "ibm,kernel-dump", NULL); + if (fdm_active) fw_dump.dump_active = 1; /* Get the sizes required to store dump data for the firmware provided @@ -98,6 +106,85 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, return 1; } +int is_fadump_active(void) +{ + return fw_dump.dump_active; +} + +/* Print firmware assisted dump configurations for debugging purpose. */ +static void fadump_show_config(void) +{ + pr_de
[RFC PATCH v7 01/10] fadump: Add documentation for firmware-assisted dump.
From: Mahesh Salgaonkar Documentation for firmware-assisted dump. This document is based on the original documentation written for phyp assisted dump by Linas Vepstas and Manish Ahuja, with few changes to reflect the current implementation. Signed-off-by: Mahesh Salgaonkar --- Documentation/powerpc/firmware-assisted-dump.txt | 270 ++ 1 files changed, 270 insertions(+), 0 deletions(-) create mode 100644 Documentation/powerpc/firmware-assisted-dump.txt diff --git a/Documentation/powerpc/firmware-assisted-dump.txt b/Documentation/powerpc/firmware-assisted-dump.txt new file mode 100644 index 000..3007bc9 --- /dev/null +++ b/Documentation/powerpc/firmware-assisted-dump.txt @@ -0,0 +1,270 @@ + + Firmware-Assisted Dump + + July 2011 + +The goal of firmware-assisted dump is to enable the dump of +a crashed system, and to do so from a fully-reset system, and +to minimize the total elapsed time until the system is back +in production use. + +- Firmware assisted dump (fadump) infrastructure is intended to replace + the existing phyp assisted dump. +- Fadump uses the same firmware interfaces and memory reservation model + as phyp assisted dump. +- Unlike phyp dump, fadump exports the memory dump through /proc/vmcore + in the ELF format in the same way as kdump. This helps us reuse the + kdump infrastructure for dump capture and filtering. +- Unlike phyp dump, userspace tool does not need to refer any sysfs + interface while reading /proc/vmcore. +- Unlike phyp dump, fadump allows user to release all the memory reserved + for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem. +- Once enabled through kernel boot parameter, fadump can be + started/stopped through /sys/kernel/fadump_registered interface (see + sysfs files section below) and can be easily integrated with kdump + service start/stop init scripts. + +Comparing with kdump or other strategies, firmware-assisted +dump offers several strong, practical advantages: + +-- Unlike kdump, the system has been reset, and loaded + with a fresh copy of the kernel. In particular, + PCI and I/O devices have been reinitialized and are + in a clean, consistent state. +-- Once the dump is copied out, the memory that held the dump + is immediately available to the running kernel. And therefore, + unlike kdump, fadump doesn't need a 2nd reboot to get back + the system to the production configuration. + +The above can only be accomplished by coordination with, +and assistance from the Power firmware. The procedure is +as follows: + +-- The first kernel registers the sections of memory with the + Power firmware for dump preservation during OS initialization. + These registered sections of memory are reserved by the first + kernel during early boot. + +-- When a system crashes, the Power firmware will save + the low memory (boot memory of size larger of 5% of system RAM + or 256MB) of RAM to the previous registered region. It will + also save system registers, and hardware PTE's. + + NOTE: The term 'boot memory' means size of the low memory chunk + that is required for a kernel to boot successfully when + booted with restricted memory. By default, the boot memory + size will be the larger of 5% of system RAM or 256MB. + Alternatively, user can also specify boot memory size + through boot parameter 'fadump_reserve_mem=' which will + override the default calculated size. Use this option + if default boot memory size is not sufficient for second + kernel to boot successfully. + +-- After the low memory (boot memory) area has been saved, the + firmware will reset PCI and other hardware state. It will + *not* clear the RAM. It will then launch the bootloader, as + normal. + +-- The freshly booted kernel will notice that there is a new + node (ibm,dump-kernel) in the device tree, indicating that + there is crash data available from a previous boot. During + the early boot OS will reserve rest of the memory above + boot memory size effectively booting with restricted memory + size. This will make sure that the second kernel will not + touch any of the dump memory area. + +-- User-space tools will read /proc/vmcore to obtain the contents + of memory, which holds the previous crashed kernel dump in ELF + format. The userspace tools may copy this info to disk, or + network, nas, san, iscsi, etc. as desired. + +-- Once the userspace tool is done saving dump, it will echo + '1' to /sys/kernel/fadump_release_mem to release the reserved + memory back to general use, except the memory required for + next firmware-assisted dump registration. + + e.g. + # echo 1 > /sys/kernel/fadump_release_mem + +Please note that the firmware-assisted dump feature +is only available on Power6 and above systems with recent +firmware versions. +
[RFC PATCH v7 05/10] fadump: Convert firmware-assisted cpu state dump data into elf notes.
From: Mahesh Salgaonkar When registered for firmware assisted dump on powerpc, firmware preserves the registers for the active CPUs during a system crash. This patch reads the cpu register data stored in Firmware-assisted dump format (except for crashing cpu) and converts it into elf notes and updates the PT_NOTE program header accordingly. The exact register state for crashing cpu is saved to fadump crash info structure in scratch area during crash_fadump() and read during second kernel boot. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/include/asm/fadump.h | 44 + arch/powerpc/kernel/fadump.c | 314 arch/powerpc/kernel/setup-common.c |6 + arch/powerpc/kernel/traps.c|3 4 files changed, 365 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index 9e172a5..6768195 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h @@ -65,6 +65,18 @@ /* Dump status flag */ #define FADUMP_ERROR_FLAG 0x2000 +#define FADUMP_CPU_ID_MASK ((1UL << 32) - 1) + +#define CPU_UNKNOWN(~((u32)0)) + +/* Utility macros */ +#define SKIP_TO_NEXT_CPU(reg_entry)\ +({ \ + while (reg_entry->reg_id != REG_ID("CPUEND")) \ + reg_entry++;\ + reg_entry++;\ +}) + /* Kernel Dump section info */ struct fadump_section { u32 request_flag; @@ -119,6 +131,9 @@ struct fw_dump { unsigned long reserve_bootvar; unsigned long fadumphdr_addr; + unsigned long cpu_notes_buf; + unsigned long cpu_notes_buf_size; + int ibm_configure_kernel_dump; unsigned long fadump_enabled:1; @@ -143,13 +158,40 @@ static inline u64 str_to_u64(const char *str) return val; } #define STR_TO_HEX(x) str_to_u64(x) +#define REG_ID(x) str_to_u64(x) #define FADUMP_CRASH_INFO_MAGICSTR_TO_HEX("FADMPINF") +#define REGSAVE_AREA_MAGIC STR_TO_HEX("REGSAVE") + +/* The firmware-assisted dump format. + * + * The register save area is an area in the partition's memory used to preserve + * the register contents (CPU state data) for the active CPUs during a firmware + * assisted dump. The dump format contains register save area header followed + * by register entries. Each list of registers for a CPU starts with + * "CPUSTRT" and ends with "CPUEND". + */ + +/* Register save area header. */ +struct fadump_reg_save_area_header { + u64 magic_number; + u32 version; + u32 num_cpu_offset; +}; + +/* Register entry. */ +struct fadump_reg_entry { + u64 reg_id; + u64 reg_value; +}; /* fadump crash info structure */ struct fadump_crash_info_header { u64 magic_number; u64 elfcorehdr_addr; + u32 crashing_cpu; + struct pt_regs regs; + struct cpumask cpu_online_mask; }; /* Crash memory ranges */ @@ -165,7 +207,9 @@ extern int early_init_dt_scan_fw_dump(unsigned long node, extern int fadump_reserve_mem(void); extern int setup_fadump(void); extern int is_fadump_active(void); +extern void crash_fadump(struct pt_regs *, const char *); #else /* CONFIG_FA_DUMP */ static inline int is_fadump_active(void) { return 0; } +static inline void crash_fadump(struct pt_regs *regs, const char *str) { } #endif #endif diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index f85a63f..cab56e7 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c @@ -240,6 +240,7 @@ static unsigned long get_fadump_area_size(void) size += fw_dump.boot_memory_size; size += sizeof(struct fadump_crash_info_header); size += sizeof(struct elfhdr); /* ELF core header.*/ + size += sizeof(struct elf_phdr); /* place holder for cpu notes */ /* Program headers for crash memory regions. */ size += sizeof(struct elf_phdr) * (memblock_num_regions(memory) + 2); @@ -393,6 +394,285 @@ static void register_fw_dump(struct fadump_mem_struct *fdm) } } +void crash_fadump(struct pt_regs *regs, const char *str) +{ + struct fadump_crash_info_header *fdh = NULL; + + if (!fw_dump.dump_registered || !fw_dump.fadumphdr_addr) + return; + + fdh = __va(fw_dump.fadumphdr_addr); + crashing_cpu = smp_processor_id(); + fdh->crashing_cpu = crashing_cpu; + crash_save_vmcoreinfo(); + + if (regs) + fdh->regs = *regs; + else + ppc_save_regs(&fdh->regs); + + fdh->cpu_online_mask = *cpu_online_mask; + + /* Call ibm,os-term rtas call to trigger firmware assisted dump */ + rtas_os_term((char *)str); +} + +#define GPR_MASK
[RFC PATCH v7 04/10] fadump: Initialize elfcore header and add PT_LOAD program headers.
From: Mahesh Salgaonkar Build the crash memory range list by traversing through system memory during the first kernel before we register for firmware-assisted dump. After the successful dump registration, initialize the elfcore header and populate PT_LOAD program headers with crash memory ranges. The elfcore header is saved in the scratch area within the reserved memory. The scratch area starts at the end of the memory reserved for saving RMR region contents. The scratch area contains fadump crash info structure that contains magic number for fadump validation and physical address where the eflcore header can be found. This structure will also be used to pass some important crash info data to the second kernel which will help second kernel to populate ELF core header with correct data before it gets exported through /proc/vmcore. Since the firmware preserves the entire partition memory at the time of crash the contents of the scratch area will be preserved till second kernel boot. Since the memory dump exported through /proc/vmcore is in ELF format similar to kdump, it will help us to reuse the kdump infrastructure for dump capture and filtering. Unlike phyp dump, userspace tool does not need to refer any sysfs interface while reading /proc/vmcore. NOTE: The current design implementation does not address a possibility of introducing additional fields (in future) to this structure without affecting compatibility. It's on TODO list to come up with better approach to address this. Reserved dump area start => +-+ | CPU state dump data| +-+ | HPTE region data | +-+ | RMR region data| Scratch area start => +-+ | fadump crash info structure { | | magic nummber | +--| elfcorehdr_addr | | | } | +> +-+ | ELF core header| Reserved dump area end => +-+ Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/include/asm/fadump.h | 43 +++ arch/powerpc/kernel/fadump.c | 233 + 2 files changed, 275 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index bbaf278..9e172a5 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h @@ -43,6 +43,12 @@ #define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \ + (0x1UL << 26)) +#define memblock_num_regions(memblock_type)(memblock.memblock_type.cnt) + +#ifndef ELF_CORE_EFLAGS +#define ELF_CORE_EFLAGS 0 +#endif + /* Firmware provided dump sections */ #define FADUMP_CPU_STATE_DATA 0x0001 #define FADUMP_HPTE_REGION 0x0002 @@ -56,6 +62,9 @@ #define FADUMP_UNREGISTER 2 #define FADUMP_INVALIDATE 3 +/* Dump status flag */ +#define FADUMP_ERROR_FLAG 0x2000 + /* Kernel Dump section info */ struct fadump_section { u32 request_flag; @@ -109,6 +118,7 @@ struct fw_dump { /* cmd line option during boot */ unsigned long reserve_bootvar; + unsigned long fadumphdr_addr; int ibm_configure_kernel_dump; unsigned long fadump_enabled:1; @@ -117,6 +127,39 @@ struct fw_dump { unsigned long dump_registered:1; }; +/* + * Copy the ascii values for first 8 characters from a string into u64 + * variable at their respective indexes. + * e.g. + * The string "FADMPINF" will be converted into 0x4641444d50494e46 + */ +static inline u64 str_to_u64(const char *str) +{ + u64 val = 0; + int i; + + for (i = 0; i < sizeof(val); i++) + val = (*str) ? (val << 8) | *str++ : val << 8; + return val; +} +#define STR_TO_HEX(x) str_to_u64(x) + +#define FADUMP_CRASH_INFO_MAGICSTR_TO_HEX("FADMPINF") + +/* fadump crash info structure */ +struct fadump_crash_info_header { + u64 magic_number; + u64 elfcorehdr_addr; +}; + +/* Crash memory ranges */ +#define INIT_CRASHMEM_RANGES (INIT_MEMBLOCK_REGIONS + 2) + +struct fad_crash_memory_ranges { + unsigned long long base; + unsigned long long size; +}; + extern int early_init_dt_scan_fw_dump(unsigned long node, const char *uname, int depth, void *data); extern int fadump_reserve_mem(void); diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 13c22cd..f85a
[RFC PATCH v7 02/10] fadump: Reserve the memory for firmware assisted dump.
From: Mahesh Salgaonkar Reserve the memory during early boot to preserve CPU state data, HPTE region and RMA (real mode area) region data in case of kernel crash. At the time of crash, powerpc firmware will store CPU state data, HPTE region data and move RMA region data to the reserved memory area. If the firmware-assisted dump fails to reserve the memory, then fallback to existing kexec-based kdump. Most of the code implementation to reserve memory has been adapted from phyp assisted dump implementation written by Linas Vepstas and Manish Ahuja This patch also introduces a config option CONFIG_FA_DUMP for firmware assisted dump feature on Powerpc (ppc64) architecture. Signed-off-by: Mahesh Salgaonkar --- arch/powerpc/Kconfig | 13 ++ arch/powerpc/include/asm/fadump.h | 71 +++ arch/powerpc/kernel/Makefile |1 arch/powerpc/kernel/fadump.c | 246 + arch/powerpc/kernel/prom.c| 15 ++ 5 files changed, 345 insertions(+), 1 deletions(-) create mode 100644 arch/powerpc/include/asm/fadump.h create mode 100644 arch/powerpc/kernel/fadump.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1919634..afa4dab 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -386,6 +386,19 @@ config PHYP_DUMP If unsure, say "N" +config FA_DUMP + bool "Firmware-assisted dump" + depends on PPC64 && PPC_RTAS && CRASH_DUMP + help + A robust mechanism to get reliable kernel crash dump with + assistance from firmware. This approach does not use kexec, + instead firmware assists in booting the kdump kernel + while preserving memory contents. Firmware-assisted dump + is meant to be a kdump replacement offering robustness and + speed not possible without system firmware assistance. + + If unsure, say "N" + config IRQ_ALL_CPUS bool "Distribute interrupts on all CPUs by default" depends on SMP && !MV64360 diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h new file mode 100644 index 000..7be25d3 --- /dev/null +++ b/arch/powerpc/include/asm/fadump.h @@ -0,0 +1,71 @@ +/* + * Firmware Assisted dump header file. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * 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, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Copyright 2011 IBM Corporation + * Author: Mahesh Salgaonkar + */ + +#ifndef __PPC64_FA_DUMP_H__ +#define __PPC64_FA_DUMP_H__ + +#ifdef CONFIG_FA_DUMP + +/* + * The RMA region will be saved for later dumping when kernel crashes. + * RMA is Real Mode Area, the first block of logical memory address owned + * by logical partition, containing the storage that may be accessed with + * translate off. + */ +#define RMA_START 0x0 +#define RMA_END(ppc64_rma_size) + +/* + * On some Power systems where RMO is 128MB, it still requires minimum of + * 256MB for kernel to boot successfully. When kdump infrastructure is + * configured to save vmcore over network, we run into OOM issue while + * loading modules related to network setup. Hence we need aditional 64M + * of memory to avoid OOM issue. + */ +#define MIN_BOOT_MEM (((RMA_END < (0x1UL << 28)) ? (0x1UL << 28) : RMA_END) \ + + (0x1UL << 26)) + +/* Firmware provided dump sections */ +#define FADUMP_CPU_STATE_DATA 0x0001 +#define FADUMP_HPTE_REGION 0x0002 +#define FADUMP_REAL_MODE_REGION0x0011 + +struct fw_dump { + unsigned long cpu_state_data_size; + unsigned long hpte_region_size; + unsigned long boot_memory_size; + unsigned long reserve_dump_area_start; + unsigned long reserve_dump_area_size; + /* cmd line option during boot */ + unsigned long reserve_bootvar; + + int ibm_configure_kernel_dump; + + unsigned long fadump_enabled:1; + unsigned long fadump_supported:1; + unsigned long dump_active:1; +}; + +extern int early_init_dt_scan_fw_dump(unsigned long node, + const char *uname, int depth, void *data); +extern int fadump_reserve_mem(void); +#endif +#endif diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index ee728e4..391bf7e 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -60,6 +60,7 @@ obj-$(
[RFC PATCH v7 00/10] fadump: Firmware-assisted dump support for Powerpc.
Hi All, Please find the version 7 of the patchset that implements firmware-assisted dump mechanism to capture kernel crash dump for Powerpc architecture. Firmware-assisted dump is a robust mechanism to get reliable kernel crash dump with the assistance of firmware. This approach does not use kexec, instead firmware assists in booting the kdump kernel while preserving memory contents. - Firmware assisted dump (fadump) infrastructure is intended to replace the existing phyp assisted dump. - Fadump uses the same firmware interfaces and memory reservation model as phyp assisted dump. - Unlike phyp dump, fadump exports the memory dump through /proc/vmcore in the ELF format in the same way as kdump. This helps us reuse the kdump infrastructure for dump capture and filtering. - Unlike phyp dump, userspace tool does not need to refer any sysfs interface while reading /proc/vmcore. - Unlike phyp dump, fadump allows user to release all the memory reserved for dump, with a single operation of echo 1 > /sys/kernel/fadump_release_mem. - Once enabled through kernel boot parameter, fadump can be started/stopped through /sys/kernel/fadump_registered interface and can be easily integrated with kdump service start/stop init scripts. - Once the dump is copied out, the memory that held the dump is immediately available to the running kernel. And therefore, unlike kdump, fadump doesn't need a 2nd reboot to get back the system to the production configuration. Fadump reuses much of the code written by Manish Ahuja and Linas Vepstas for the phyp assisted dump. I have tested the patches on following system configuration: 1. LPAR on Power6 with 4GB RAM and 8 CPUs 2. LPAR on Power7 with 2GB RAM and 20 CPUs 3. LPAR on Power7 with 1TB RAM and 896 CPUs Please review the patchset and let me know your comments. ChangeLog: Change in v7: - - Updated the documentation explaining the enhancement in fadump over old phyp dump. - Re-based patches to commit d65b4e98d7 (v3.3-rc3) Change in v6: - - Use of_read_number and of_read_ulong while reading the dump sizes from rtas node ibm,configure-kernel-kdump-sizes and few minor changes. - Kernel command line option 'fadump' now uses on/off values to enable/disable fadump. - Added the last patch in this series 10/10 to remove phyp dump code. Change in v5: - - Added 'fadump_' prefix to all static functions defined. patch 02/10: - Merged patch 10/10 which introduces a config option CONFIG_FA_DUMP for firmware assisted dump feature on Powerpc (ppc64) architecture. - Increased MIN_BOOT_MEM by 64M to avoid OOM issue during network dump capture. When kdump infrastructure is configured to save vmcore over network, we run into OOM issue while loading modules related to network setup. Changes in v4: -- patch 04/10: - Move the init_elfcore_header() function and 'memblock_num_regions' macro from generic code to power specific code as these are used only by firmware assisted dump implementation which is power specific feature. patch 05/10: - Fixes a issue where memblock_free() is invoked from build_cpu_notes() function during error_out path. Invoke cpu_notes_buf_free() in error_out path instead of memblock_free(). Changes in v3: - - Re-factored the implementation to work with kdump service start/stop. Introduce fadump_registered sysfs control file which will be used by kdump init scripts to start/stop firmware assisted dump. echo 1 to /sys/kernel/fadump_registered file for fadump registration and echo 0 to /sys/kernel/fadump_registered file for fadump un-registration. - Introduced the locking mechanism to handle simultaneous writes to sysfs control files fadump_registered and fadump_release_mem Affected patches are: 01/10, 03/10, 08/10. Changes in v2: - patch 01/10: - Modified the documentation to reflect the change of fadump_region file under debugfs filesystem. patch 02/10: - Modified to use standard pr_debug() macro. - Modified early_init_dt_scan_fw_dump() to get the size of "ibm,configure-kernel-dump-sizes" property and use it to iterate through an array of dump sections. - Introduced boot option 'fadump_reserve_mem=' to let user specify the fadump boot memory to be reserved. patch 03/10: - Removed few debug print statements. - Moved the setup_fadump() call from setup_system() and now calling it subsys_initcall. - Moved fadump_region attribute under debugfs. - Clear the TCE entries if firmware assisted dump is active. patch 05/10: - Moved the crash_fadump() invocation from generic code to panic notifier. - Introduced cpu_notes_buf_alloc() function to allocate cpu notes buffer using get_free_pages(). patch 08/10: - Introduced cpu_notes_buf_free() function to free memory allocated for cpu notes buffer. Thanks, -Mahesh. --- Mahesh Salgaonkar (10): fadump: Add documentation for firmware-assisted dump. fadump: Reserve the memory for firmware a
Re: [PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
On Thu, 2012-02-16 at 18:02 +0800, Shengzhou Liu wrote: > If USB UTMI PHY is not enable, writing to portsc register will lead to > kernel hang during boot up. Thanks, I'll try that tomorrow. Greg, you're picking that up or should I ? Cheers, Ben. > Signed-off-by: Shengzhou Liu > --- > Apply for master branch of > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git > Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. > > drivers/usb/host/ehci-fsl.c |4 > drivers/usb/host/ehci-fsl.h |1 + > 2 files changed, 5 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c > index c26a82e..0090ed2 100644 > --- a/drivers/usb/host/ehci-fsl.c > +++ b/drivers/usb/host/ehci-fsl.c > @@ -216,6 +216,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, > unsigned int port_offset) > { > u32 portsc; > + struct usb_hcd *hcd = ehci_to_hcd(ehci); > + void __iomem *non_ehci = hcd->regs; > > portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); > portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); > @@ -231,6 +233,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, > portsc |= PORT_PTS_PTW; > /* fall through */ > case FSL_USB2_PHY_UTMI: > + /* enable UTMI PHY */ > + setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); > portsc |= PORT_PTS_UTMI; > break; > case FSL_USB2_PHY_NONE: > diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h > index bdf43e2..0e400c2 100644 > --- a/drivers/usb/host/ehci-fsl.h > +++ b/drivers/usb/host/ehci-fsl.h > @@ -45,6 +45,7 @@ > #define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ > #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ > #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ > +#define CTRL_UTMI_PHY_EN (1<<9) > #define CTRL_PHY_CLK_VALID (1 << 17) > #define SNOOP_SIZE_2GB 0x1e > #endif /* _EHCI_FSL_H */ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
On 16.02.2012, at 10:26, Liu Yu wrote: > If the guest hypervisor node contains "has-idle" property. > > Signed-off-by: Liu Yu > --- > v4: > 1. discard the CONFIG_E500 to make code for all powerpc platform > 2. code cleanup > > arch/powerpc/kernel/epapr.S | 29 + > arch/powerpc/kernel/epapr_para.c | 13 - > 2 files changed, 41 insertions(+), 1 deletions(-) > > diff --git a/arch/powerpc/kernel/epapr.S b/arch/powerpc/kernel/epapr.S > index 697b390..f06d636 100644 > --- a/arch/powerpc/kernel/epapr.S > +++ b/arch/powerpc/kernel/epapr.S > @@ -15,6 +15,35 @@ > #include > #include > > +#define HC_VENDOR_EPAPR(1 << 16) > +#define HC_EV_IDLE16 > + > +_GLOBAL(epapr_ev_idle) > +epapr_ev_idle: > +rlwinmr3,r1,0,0,31-THREAD_SHIFT/* current thread_info */ > +lwzr4,TI_LOCAL_FLAGS(r3)/* set napping bit */ > +orir4,r4,_TLF_NAPPING/* so when we take an exception */ > +stwr4,TI_LOCAL_FLAGS(r3)/* it will return to our caller */ > + > +wrteei1 > + > +idle_loop: > +LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) > + > +.global epapr_ev_idle_start > +epapr_ev_idle_start: > +lir3, -1 > +nop > +nop > +nop Can't you just bl into epapr_hypercall_start? You don't even have to save the old lr. because we never return anyways :) Alex > + > +/* > + * Guard against spurious wakeups (e.g. from a hypervisor) -- > + * any real interrupt will cause us to return to LR due to > + * _TLF_NAPPING. > + */ > +bidle_loop > + > /* Hypercall entry point. Will be patched with device tree instructions. */ > .global epapr_hypercall_start > epapr_hypercall_start: > diff --git a/arch/powerpc/kernel/epapr_para.c > b/arch/powerpc/kernel/epapr_para.c > index ea13cac..adee4f1 100644 > --- a/arch/powerpc/kernel/epapr_para.c > +++ b/arch/powerpc/kernel/epapr_para.c > @@ -20,6 +20,10 @@ > #include > #include > #include > +#include > + > +extern void epapr_ev_idle(void); > +extern u32 epapr_ev_idle_start[]; > > bool epapr_para_enabled = false; > > @@ -35,10 +39,17 @@ static int __init epapr_para_init(void) > >insts = of_get_property(hyper_node, "hcall-instructions", &len); >if (!(len % 4) && (len >= (4 * 4))) { > -for (i = 0; i < (len / 4); i++) > +for (i = 0; i < (len / 4); i++) { >epapr_hypercall_start[i] = insts[i]; > +epapr_ev_idle_start[i] = insts[i]; > +} >flush_icache_range((ulong)epapr_hypercall_start, > (ulong)epapr_hypercall_start + len); > +flush_icache_range((ulong)epapr_ev_idle_start, > + (ulong)epapr_ev_idle_start + len); > + > +if (of_get_property(hyper_node, "has-idle", NULL)) > +ppc_md.power_save = epapr_ev_idle; > >epapr_para_enabled = true; >} > -- > 1.7.0.4 > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for host
On 16.02.2012, at 10:26, Liu Yu wrote: > And add a new flag definition in kvm_ppc_pvinfo to indicate > whether host support EV_IDLE hcall. > > Signed-off-by: Liu Yu > --- > v4: > no change > > arch/powerpc/include/asm/kvm_para.h | 14 -- > arch/powerpc/kvm/powerpc.c |8 > include/linux/kvm.h |2 ++ > 3 files changed, 22 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/kvm_para.h > b/arch/powerpc/include/asm/kvm_para.h > index 7b754e7..81a34c9 100644 > --- a/arch/powerpc/include/asm/kvm_para.h > +++ b/arch/powerpc/include/asm/kvm_para.h > @@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared { > }; > > #define KVM_SC_MAGIC_R00x4b564d21 /* "KVM!" */ > -#define HC_VENDOR_KVM(42 << 16) > + > +#include > + > +/* ePAPR Hypercall Vendor ID */ > +#define HC_VENDOR_EPAPR(EV_EPAPR_VENDOR_ID << 16) > +#define HC_VENDOR_KVM(EV_KVM_VENDOR_ID << 16) > + > +/* ePAPR Hypercall Token */ > +#define HC_EV_IDLEEV_IDLE > + > +/* ePAPR Hypercall Return Codes */ > #define HC_EV_SUCCESS0 > -#define HC_EV_UNIMPLEMENTED12 > +#define HC_EV_UNIMPLEMENTEDEV_UNIMPLEMENTED > > #define KVM_FEATURE_MAGIC_PAGE1 > > diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c > index 0e21d15..03ebd5d 100644 > --- a/arch/powerpc/kvm/powerpc.c > +++ b/arch/powerpc/kvm/powerpc.c > @@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) > >/* Second return value is in r4 */ >break; > +case HC_VENDOR_EPAPR | HC_EV_IDLE: > +r = HC_EV_SUCCESS; > +kvm_vcpu_block(vcpu); > +break; >default: >r = HC_EV_UNIMPLEMENTED; >break; > @@ -746,6 +750,10 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo > *pvinfo) >pvinfo->hcall[2] = inst_sc; >pvinfo->hcall[3] = inst_nop; > > +#ifdef CONFIG_BOOKE Why limit it to booke? The less ifdefs our code has, the better :) Alex > +pvinfo->flags |= KVM_PPC_PVINFO_FLAGS_EV_IDLE; > +#endif > + >return 0; > } > > diff --git a/include/linux/kvm.h b/include/linux/kvm.h > index acbe429..6b2c70e 100644 > --- a/include/linux/kvm.h > +++ b/include/linux/kvm.h > @@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo { >__u8 pad[108]; > }; > > +#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) > + > #define KVMIO 0xAE > > /* machine type bits, to be used as argument to KVM_CREATE_VM */ > -- > 1.7.0.4 > > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] powerpc/usb: fix issue of CPU halt when missing USB PHY clock
> -Original Message- > From: Benjamin Herrenschmidt [mailto:b...@kernel.crashing.org] > Sent: Wednesday, February 15, 2012 10:31 AM > To: Liu Shengzhou-B36685 > Cc: Pavan Kondeti; linux-...@vger.kernel.org; linuxppc- > d...@lists.ozlabs.org > Subject: RE: [PATCH] powerpc/usb: fix issue of CPU halt when missing > USB PHY clock > > > > > > + if (!(in_be32(non_ehci + FSL_SOC_USB_CTRL) & > > > > +CTRL_PHY_CLK_VALID)) > > > { > > > > + printk(KERN_WARNING "fsl-ehci: USB PHY clock > invalid\n"); > > > > + return -1; > > > > > > Please return a proper error code. -ENODEV ? > > > > [Shengzhou] Ok, updated in v2, thanks. > > > > > Note that I just got a p5020ds from FSL, and with it's default > configuration, when I build & boot current upstream with FSL USB > support (64-bit kernel) it hangs when initializing USB. > > With or without this patch. > > It complains about invalid dr-mode (there's two USB nodes in the .dts > coming from uboot, an "mph" and "dr", the former has no dr-mode > property in the device-tree. > > Is the current kernel incompatible with old device-tree's ? (that would > be a shame...) > > Cheers, > Ben. > > Looks like there is a bug, please try to add the patch http://patchwork.ozlabs.org/patch/141558 -Shengzhou ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v4 1/3] KVM: PPC: epapr: Factor out the epapr init
On 16.02.2012, at 10:26, Liu Yu wrote: > from the kvm guest paravirt init code. > > Signed-off-by: Liu Yu > --- > v4: > 1. code cleanup > 2. move kvm_hypercall_start() to epapr_hypercall_start() > > arch/powerpc/Kconfig|4 ++ > arch/powerpc/include/asm/epapr_hcalls.h |2 + > arch/powerpc/kernel/Makefile|1 + > arch/powerpc/kernel/epapr.S | 25 > arch/powerpc/kernel/epapr_para.c| 49 +++ > arch/powerpc/kernel/kvm.c | 28 ++ > arch/powerpc/kernel/kvm_emul.S | 10 -- > arch/powerpc/kvm/Kconfig|1 + > 8 files changed, 85 insertions(+), 35 deletions(-) > create mode 100644 arch/powerpc/kernel/epapr.S > create mode 100644 arch/powerpc/kernel/epapr_para.c > > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index 1919634..1262b43 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -202,6 +202,10 @@ config EPAPR_BOOT > Used to allow a board to specify it wants an ePAPR compliant wrapper. >default n > > +config EPAPR_PARAVIRT > +bool > +default n > + > config DEFAULT_UIMAGE >bool >help > diff --git a/arch/powerpc/include/asm/epapr_hcalls.h > b/arch/powerpc/include/asm/epapr_hcalls.h > index f3b0c2c..0ff3f24 100644 > --- a/arch/powerpc/include/asm/epapr_hcalls.h > +++ b/arch/powerpc/include/asm/epapr_hcalls.h > @@ -148,6 +148,8 @@ > #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5" > #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4" > > +extern bool epapr_para_enabled; > +extern u32 epapr_hypercall_start[]; > > /* > * We use "uintptr_t" to define a register because it's guaranteed to be a > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile > index ee728e4..9e807f3 100644 > --- a/arch/powerpc/kernel/Makefile > +++ b/arch/powerpc/kernel/Makefile > @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),) > obj-y+= ppc_save_regs.o > endif > > +obj-$(CONFIG_EPAPR_PARAVIRT)+= epapr_para.o epapr.o > obj-$(CONFIG_KVM_GUEST)+= kvm.o kvm_emul.o > > # Disable GCOV in odd or sensitive code > diff --git a/arch/powerpc/kernel/epapr.S b/arch/powerpc/kernel/epapr.S > new file mode 100644 > index 000..697b390 > --- /dev/null > +++ b/arch/powerpc/kernel/epapr.S > @@ -0,0 +1,25 @@ > +/* > + * Copyright (C) 2012 Freescale Semiconductor, Inc. > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version > + * 2 of the License, or (at your option) any later version. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +/* Hypercall entry point. Will be patched with device tree instructions. */ > +.global epapr_hypercall_start > +epapr_hypercall_start: > +lir3, -1 > +nop > +nop > +nop > +blr > diff --git a/arch/powerpc/kernel/epapr_para.c > b/arch/powerpc/kernel/epapr_para.c > new file mode 100644 > index 000..ea13cac > --- /dev/null > +++ b/arch/powerpc/kernel/epapr_para.c > @@ -0,0 +1,49 @@ > +/* > + * ePAPR para-virtualization support. > + * > + * 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. > + * > + * Copyright (C) 2012 Freescale Semiconductor, Inc. > + */ > + > +#include > +#include > +#include > + > +bool epapr_para_enabled = false; > + > +static int __init epapr_para_init(void) > +{ > +struct device_node *hyper_node; > +const u32 *insts; > +int len, i; > + > +hyper_node = of_find_node_by_path("/hypervisor"); > +if (!hyper_node) > +return -ENODEV; > + > +insts = of_get_property(hyper_node, "hcall-instructions", &len); > +if (!(len % 4) && (len >= (4 * 4))) { > +for (i = 0; i < (len / 4); i++) So if the dt passes in less than 4 ops, you bail out, and for more you overwrite the buffer? Not good :) > +epapr_hypercall_start[i] = insts[i]; > +flush_icache_range((ulong)epapr_hypercall_start, > + (ulong)epapr_hypercall_start + len); > + > +epapr_para_enabled = true; > +} > + > +return 0; > +} > + > +early_initcall(epapr_para_init); > diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc
[PATCH] powerpc/usb: fix bug of kernel hang when initializing usb
If USB UTMI PHY is not enable, writing to portsc register will lead to kernel hang during boot up. Signed-off-by: Shengzhou Liu --- Apply for master branch of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git Tested on P5020DS, the issue was reported by Benjamin Herrenschmidt. drivers/usb/host/ehci-fsl.c |4 drivers/usb/host/ehci-fsl.h |1 + 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index c26a82e..0090ed2 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -216,6 +216,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, unsigned int port_offset) { u32 portsc; + struct usb_hcd *hcd = ehci_to_hcd(ehci); + void __iomem *non_ehci = hcd->regs; portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); @@ -231,6 +233,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, portsc |= PORT_PTS_PTW; /* fall through */ case FSL_USB2_PHY_UTMI: + /* enable UTMI PHY */ + setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); portsc |= PORT_PTS_UTMI; break; case FSL_USB2_PHY_NONE: diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h index bdf43e2..0e400c2 100644 --- a/drivers/usb/host/ehci-fsl.h +++ b/drivers/usb/host/ehci-fsl.h @@ -45,6 +45,7 @@ #define FSL_SOC_USB_PRICTRL0x40c /* NOTE: big-endian */ #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ +#define CTRL_UTMI_PHY_EN (1<<9) #define CTRL_PHY_CLK_VALID (1 << 17) #define SNOOP_SIZE_2GB 0x1e #endif /* _EHCI_FSL_H */ -- 1.6.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 2/3] KVM: PPC: epapr: Add idle hcall support for host
And add a new flag definition in kvm_ppc_pvinfo to indicate whether host support EV_IDLE hcall. Signed-off-by: Liu Yu --- v4: no change arch/powerpc/include/asm/kvm_para.h | 14 -- arch/powerpc/kvm/powerpc.c |8 include/linux/kvm.h |2 ++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h index 7b754e7..81a34c9 100644 --- a/arch/powerpc/include/asm/kvm_para.h +++ b/arch/powerpc/include/asm/kvm_para.h @@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared { }; #define KVM_SC_MAGIC_R00x4b564d21 /* "KVM!" */ -#define HC_VENDOR_KVM (42 << 16) + +#include + +/* ePAPR Hypercall Vendor ID */ +#define HC_VENDOR_EPAPR(EV_EPAPR_VENDOR_ID << 16) +#define HC_VENDOR_KVM (EV_KVM_VENDOR_ID << 16) + +/* ePAPR Hypercall Token */ +#define HC_EV_IDLE EV_IDLE + +/* ePAPR Hypercall Return Codes */ #define HC_EV_SUCCESS 0 -#define HC_EV_UNIMPLEMENTED12 +#define HC_EV_UNIMPLEMENTEDEV_UNIMPLEMENTED #define KVM_FEATURE_MAGIC_PAGE 1 diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 0e21d15..03ebd5d 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu) /* Second return value is in r4 */ break; + case HC_VENDOR_EPAPR | HC_EV_IDLE: + r = HC_EV_SUCCESS; + kvm_vcpu_block(vcpu); + break; default: r = HC_EV_UNIMPLEMENTED; break; @@ -746,6 +750,10 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo) pvinfo->hcall[2] = inst_sc; pvinfo->hcall[3] = inst_nop; +#ifdef CONFIG_BOOKE + pvinfo->flags |= KVM_PPC_PVINFO_FLAGS_EV_IDLE; +#endif + return 0; } diff --git a/include/linux/kvm.h b/include/linux/kvm.h index acbe429..6b2c70e 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h @@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo { __u8 pad[108]; }; +#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0) + #define KVMIO 0xAE /* machine type bits, to be used as argument to KVM_CREATE_VM */ -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v4 1/3] KVM: PPC: epapr: Factor out the epapr init
from the kvm guest paravirt init code. Signed-off-by: Liu Yu --- v4: 1. code cleanup 2. move kvm_hypercall_start() to epapr_hypercall_start() arch/powerpc/Kconfig|4 ++ arch/powerpc/include/asm/epapr_hcalls.h |2 + arch/powerpc/kernel/Makefile|1 + arch/powerpc/kernel/epapr.S | 25 arch/powerpc/kernel/epapr_para.c| 49 +++ arch/powerpc/kernel/kvm.c | 28 ++ arch/powerpc/kernel/kvm_emul.S | 10 -- arch/powerpc/kvm/Kconfig|1 + 8 files changed, 85 insertions(+), 35 deletions(-) create mode 100644 arch/powerpc/kernel/epapr.S create mode 100644 arch/powerpc/kernel/epapr_para.c diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1919634..1262b43 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -202,6 +202,10 @@ config EPAPR_BOOT Used to allow a board to specify it wants an ePAPR compliant wrapper. default n +config EPAPR_PARAVIRT + bool + default n + config DEFAULT_UIMAGE bool help diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h index f3b0c2c..0ff3f24 100644 --- a/arch/powerpc/include/asm/epapr_hcalls.h +++ b/arch/powerpc/include/asm/epapr_hcalls.h @@ -148,6 +148,8 @@ #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5" #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4" +extern bool epapr_para_enabled; +extern u32 epapr_hypercall_start[]; /* * We use "uintptr_t" to define a register because it's guaranteed to be a diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index ee728e4..9e807f3 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),) obj-y += ppc_save_regs.o endif +obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_para.o epapr.o obj-$(CONFIG_KVM_GUEST)+= kvm.o kvm_emul.o # Disable GCOV in odd or sensitive code diff --git a/arch/powerpc/kernel/epapr.S b/arch/powerpc/kernel/epapr.S new file mode 100644 index 000..697b390 --- /dev/null +++ b/arch/powerpc/kernel/epapr.S @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2012 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include + +/* Hypercall entry point. Will be patched with device tree instructions. */ +.global epapr_hypercall_start +epapr_hypercall_start: + li r3, -1 + nop + nop + nop + blr diff --git a/arch/powerpc/kernel/epapr_para.c b/arch/powerpc/kernel/epapr_para.c new file mode 100644 index 000..ea13cac --- /dev/null +++ b/arch/powerpc/kernel/epapr_para.c @@ -0,0 +1,49 @@ +/* + * ePAPR para-virtualization support. + * + * 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. + * + * Copyright (C) 2012 Freescale Semiconductor, Inc. + */ + +#include +#include +#include + +bool epapr_para_enabled = false; + +static int __init epapr_para_init(void) +{ + struct device_node *hyper_node; + const u32 *insts; + int len, i; + + hyper_node = of_find_node_by_path("/hypervisor"); + if (!hyper_node) + return -ENODEV; + + insts = of_get_property(hyper_node, "hcall-instructions", &len); + if (!(len % 4) && (len >= (4 * 4))) { + for (i = 0; i < (len / 4); i++) + epapr_hypercall_start[i] = insts[i]; + flush_icache_range((ulong)epapr_hypercall_start, + (ulong)epapr_hypercall_start + len); + + epapr_para_enabled = true; + } + + return 0; +} + +early_initcall(epapr_para_init); diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 62bdf23..9dfc24a 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c @@ -31,6 +31,7 @@ #include #include #include +#include #define KVM_MAGIC_PAGE (-4096L) #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
[PATCH v4 3/3] KVM: PPC: epapr: install ev_idle hcall for e500 guest
If the guest hypervisor node contains "has-idle" property. Signed-off-by: Liu Yu --- v4: 1. discard the CONFIG_E500 to make code for all powerpc platform 2. code cleanup arch/powerpc/kernel/epapr.S | 29 + arch/powerpc/kernel/epapr_para.c | 13 - 2 files changed, 41 insertions(+), 1 deletions(-) diff --git a/arch/powerpc/kernel/epapr.S b/arch/powerpc/kernel/epapr.S index 697b390..f06d636 100644 --- a/arch/powerpc/kernel/epapr.S +++ b/arch/powerpc/kernel/epapr.S @@ -15,6 +15,35 @@ #include #include +#define HC_VENDOR_EPAPR(1 << 16) +#define HC_EV_IDLE 16 + +_GLOBAL(epapr_ev_idle) +epapr_ev_idle: + rlwinm r3,r1,0,0,31-THREAD_SHIFT /* current thread_info */ + lwz r4,TI_LOCAL_FLAGS(r3) /* set napping bit */ + ori r4,r4,_TLF_NAPPING /* so when we take an exception */ + stw r4,TI_LOCAL_FLAGS(r3) /* it will return to our caller */ + + wrteei 1 + +idle_loop: + LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE) + +.global epapr_ev_idle_start +epapr_ev_idle_start: + li r3, -1 + nop + nop + nop + + /* +* Guard against spurious wakeups (e.g. from a hypervisor) -- +* any real interrupt will cause us to return to LR due to +* _TLF_NAPPING. +*/ + b idle_loop + /* Hypercall entry point. Will be patched with device tree instructions. */ .global epapr_hypercall_start epapr_hypercall_start: diff --git a/arch/powerpc/kernel/epapr_para.c b/arch/powerpc/kernel/epapr_para.c index ea13cac..adee4f1 100644 --- a/arch/powerpc/kernel/epapr_para.c +++ b/arch/powerpc/kernel/epapr_para.c @@ -20,6 +20,10 @@ #include #include #include +#include + +extern void epapr_ev_idle(void); +extern u32 epapr_ev_idle_start[]; bool epapr_para_enabled = false; @@ -35,10 +39,17 @@ static int __init epapr_para_init(void) insts = of_get_property(hyper_node, "hcall-instructions", &len); if (!(len % 4) && (len >= (4 * 4))) { - for (i = 0; i < (len / 4); i++) + for (i = 0; i < (len / 4); i++) { epapr_hypercall_start[i] = insts[i]; + epapr_ev_idle_start[i] = insts[i]; + } flush_icache_range((ulong)epapr_hypercall_start, (ulong)epapr_hypercall_start + len); + flush_icache_range((ulong)epapr_ev_idle_start, + (ulong)epapr_ev_idle_start + len); + + if (of_get_property(hyper_node, "has-idle", NULL)) + ppc_md.power_save = epapr_ev_idle; epapr_para_enabled = true; } -- 1.7.0.4 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 26/27] irq_domain: mostly eliminate slow-path revmap lookups
With the current state of irq_domain, the reverse map is always updated when new IRQs get mapped. This means that the irq_find_mapping() function can be simplified to always execute the revmap-specific lookup function. This patch adds lookup functions for the revmaps that don't yet have one and removes the slow path lookup from most of the code paths. The only place where the slow path legitimately remains is where the linear map is used with a hwirq number larger than the revmap size. v5: rewrite to not use a ->revmap() callback. It is simpler, smaller, safer and faster to open code each of the revmap lookups directly into irq_find_mapping() via a switch statement. v4: Fix build failure on incorrect variable reference. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller --- arch/powerpc/sysdev/xics/icp-hv.c |2 +- arch/powerpc/sysdev/xics/icp-native.c |2 +- arch/powerpc/sysdev/xics/xics-common.c |3 - include/linux/irqdomain.h |4 - kernel/irq/irqdomain.c | 121 5 files changed, 48 insertions(+), 84 deletions(-) diff --git a/arch/powerpc/sysdev/xics/icp-hv.c b/arch/powerpc/sysdev/xics/icp-hv.c index 253dce9..14469cf 100644 --- a/arch/powerpc/sysdev/xics/icp-hv.c +++ b/arch/powerpc/sysdev/xics/icp-hv.c @@ -111,7 +111,7 @@ static unsigned int icp_hv_get_irq(void) if (vec == XICS_IRQ_SPURIOUS) return NO_IRQ; - irq = irq_radix_revmap_lookup(xics_host, vec); + irq = irq_find_mapping(xics_host, vec); if (likely(irq != NO_IRQ)) { xics_push_cppr(vec); return irq; diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerpc/sysdev/xics/icp-native.c index 4c79b6f..48861d3 100644 --- a/arch/powerpc/sysdev/xics/icp-native.c +++ b/arch/powerpc/sysdev/xics/icp-native.c @@ -119,7 +119,7 @@ static unsigned int icp_native_get_irq(void) if (vec == XICS_IRQ_SPURIOUS) return NO_IRQ; - irq = irq_radix_revmap_lookup(xics_host, vec); + irq = irq_find_mapping(xics_host, vec); if (likely(irq != NO_IRQ)) { xics_push_cppr(vec); return irq; diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index ea5e204..1d7067d 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c @@ -330,9 +330,6 @@ static int xics_host_map(struct irq_domain *h, unsigned int virq, pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw); - /* Insert the interrupt mapping into the radix tree for fast lookup */ - irq_radix_revmap_insert(xics_host, virq, hw); - /* They aren't all level sensitive but we just don't really know */ irq_set_status_flags(virq, IRQ_LEVEL); diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 5245488..47af458 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -155,10 +155,6 @@ extern void irq_dispose_mapping(unsigned int virq); extern unsigned int irq_find_mapping(struct irq_domain *host, irq_hw_number_t hwirq); extern unsigned int irq_create_direct_mapping(struct irq_domain *host); -extern void irq_radix_revmap_insert(struct irq_domain *host, unsigned int virq, - irq_hw_number_t hwirq); -extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, - irq_hw_number_t hwirq); extern unsigned int irq_linear_revmap(struct irq_domain *host, irq_hw_number_t hwirq); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index db7adb2..e7d8e96 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -313,7 +313,8 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) domain = irq_default_domain; BUG_ON(domain == NULL); - WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP); + if (WARN_ON(domain->revmap_type != IRQ_DOMAIN_MAP_NOMAP)) + return 0; virq = irq_alloc_desc_from(1, 0); if (!virq) { @@ -389,6 +390,18 @@ unsigned int irq_create_mapping(struct irq_domain *domain, return 0; } + switch(domain->revmap_type) { + case IRQ_DOMAIN_MAP_LINEAR: + if (hwirq < domain->revmap_data.linear.size) + domain->revmap_data.linear.revmap[hwirq] = virq; + break; + case IRQ_DOMAIN_MAP_TREE: + mutex_lock(&revmap_trees_mutex); + radix_tree_insert(&domain->revmap_data.tree, hwirq, + irq_get_irq_data(virq)); + mutex_unlock(&revmap_trees_mutex); + break; + } pr_debug("irq: irq %lu on domain %s mapped to virtual irq %u\n", hwirq, d
[PATCH v5 27/27] irq_domain: For NOMAP revmap, allow users to specify the largest usable virq
This patch replaces the old global setting of irq_virq_count that is only used by the NOMAP mapping and instead uses a revmap_data property so that the maximum NOMAP allocation can be set per NOMAP irq_domain. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller --- arch/powerpc/platforms/cell/axon_msi.c |2 +- arch/powerpc/platforms/cell/beat_interrupt.c |2 +- arch/powerpc/platforms/iseries/irq.c |8 +-- arch/powerpc/platforms/powermac/smp.c|2 +- arch/powerpc/platforms/ps3/interrupt.c |3 +- include/linux/irqdomain.h|7 ++--- kernel/irq/irqdomain.c | 29 ++--- 7 files changed, 15 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index db360fc..369df06 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -392,7 +392,7 @@ static int axon_msi_probe(struct platform_device *device) } memset(msic->fifo_virt, 0xff, MSIC_FIFO_SIZE_BYTES); - msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic); + msic->irq_domain = irq_domain_add_nomap(dn, &msic_host_ops, msic, ~0); if (!msic->irq_domain) { printk(KERN_ERR "axon_msi: couldn't allocate irq_domain for %s\n", dn->full_name); diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c index e5c3a2c..4315349 100644 --- a/arch/powerpc/platforms/cell/beat_interrupt.c +++ b/arch/powerpc/platforms/cell/beat_interrupt.c @@ -239,7 +239,7 @@ void __init beatic_init_IRQ(void) ppc_md.get_irq = beatic_get_irq; /* Allocate an irq host */ - beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL); + beatic_host = irq_domain_add_nomap(NULL, &beatic_pic_host_ops, NULL, ~0); BUG_ON(beatic_host == NULL); irq_set_default_host(beatic_host); } diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c index 05ce516..db48abe 100644 --- a/arch/powerpc/platforms/iseries/irq.c +++ b/arch/powerpc/platforms/iseries/irq.c @@ -371,16 +371,10 @@ void __init iSeries_init_IRQ(void) struct irq_domain *host; int ret; - /* -* The Hypervisor only allows us up to 256 interrupt -* sources (the irq number is passed in a u8). -*/ - irq_set_virq_count(256); - /* Create irq host. No need for a revmap since HV will give us * back our virtual irq number */ - host = irq_domain_add_nomap(NULL, &iseries_irq_domain_ops, NULL); + host = irq_domain_add_nomap(NULL, &iseries_irq_domain_ops, NULL, 256); BUG_ON(host == NULL); irq_set_default_host(host); diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index a81e5a8..40f12af 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c @@ -192,7 +192,7 @@ static int psurge_secondary_ipi_init(void) { int rc = -ENOMEM; - psurge_host = irq_domain_add_nomap(NULL, &psurge_host_ops, NULL); + psurge_host = irq_domain_add_nomap(NULL, &psurge_host_ops, NULL, ~0); if (psurge_host) psurge_secondary_virq = irq_create_direct_mapping(psurge_host); diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c index 2a4ff86..0700a98 100644 --- a/arch/powerpc/platforms/ps3/interrupt.c +++ b/arch/powerpc/platforms/ps3/interrupt.c @@ -753,9 +753,8 @@ void __init ps3_init_IRQ(void) unsigned cpu; struct irq_domain *host; - host = irq_domain_add_nomap(NULL, &ps3_host_ops, NULL); + host = irq_domain_add_nomap(NULL, &ps3_host_ops, NULL, PS3_PLUG_MAX + 1); irq_set_default_host(host); - irq_set_virq_count(PS3_PLUG_MAX + 1); for_each_possible_cpu(cpu) { struct ps3_private *pd = &per_cpu(ps3_private, cpu); diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index 47af458..80bb917 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -105,6 +105,7 @@ struct irq_domain { unsigned int *revmap; } linear; struct radix_tree_root tree; + unsigned int nomap_max_virq; } revmap_data; const struct irq_domain_ops *ops; void *host_data; @@ -126,15 +127,14 @@ struct irq_domain *irq_domain_add_linear(struct device_node *of_node, const struct irq_domain_ops *ops, void *host_data); struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, -const struct irq_domain_ops *ops, -vo
[PATCH v5 17/27] irq_domain: Create common xlate functions that device drivers can use
Rather than having each interrupt controller driver creating its own barely unique .xlate function for irq_domain, create a library of translators which any driver can use directly. v5: - Remove irq_domain_xlate_pci(). It was incorrect. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Mark Salter Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- include/linux/irqdomain.h | 12 kernel/irq/irqdomain.c| 65 ++--- 2 files changed, 67 insertions(+), 10 deletions(-) diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index e7379a3..ea58f36 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -163,6 +163,18 @@ extern unsigned int irq_linear_revmap(struct irq_domain *host, irq_hw_number_t hwirq); extern struct irq_domain_ops irq_domain_simple_ops; + +/* stock xlate functions */ +int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, + const u32 *intspec, unsigned int intsize, + irq_hw_number_t *out_hwirq, unsigned int *out_type); +int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, + const u32 *intspec, unsigned int intsize, + irq_hw_number_t *out_hwirq, unsigned int *out_type); +int irq_domain_xlate_onetwocell(struct irq_domain *d, struct device_node *ctrlr, + const u32 *intspec, unsigned int intsize, + irq_hw_number_t *out_hwirq, unsigned int *out_type); + #if defined(CONFIG_OF_IRQ) extern void irq_domain_generate_simple(const struct of_device_id *match, u64 phys_base, unsigned int irq_start); diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 03f571a..9a8f95e 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -699,25 +699,70 @@ int irq_domain_simple_map(struct irq_domain *d, unsigned int irq, return 0; } -int irq_domain_simple_xlate(struct irq_domain *d, - struct device_node *controller, - const u32 *intspec, unsigned int intsize, - unsigned long *out_hwirq, unsigned int *out_type) +/** + * irq_domain_xlate_onecell() - Generic xlate for direct one cell bindings + * + * Device Tree IRQ specifier translation function which works with one cell + * bindings where the cell value maps directly to the hwirq number. + */ +int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, +const u32 *intspec, unsigned int intsize, +unsigned long *out_hwirq, unsigned int *out_type) { - if (d->of_node != controller) - return -EINVAL; - if (intsize < 1) + if (WARN_ON(intsize < 1)) return -EINVAL; *out_hwirq = intspec[0]; *out_type = IRQ_TYPE_NONE; - if (intsize > 1) - *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; return 0; } +EXPORT_SYMBOL_GPL(irq_domain_xlate_onecell); + +/** + * irq_domain_xlate_twocell() - Generic xlate for direct two cell bindings + * + * Device Tree IRQ specifier translation function which works with two cell + * bindings where the cell values map directly to the hwirq number + * and linux irq flags. + */ +int irq_domain_xlate_twocell(struct irq_domain *d, struct device_node *ctrlr, + const u32 *intspec, unsigned int intsize, + irq_hw_number_t *out_hwirq, unsigned int *out_type) +{ + if (WARN_ON(intsize < 2)) + return -EINVAL; + *out_hwirq = intspec[0]; + *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; + return 0; +} +EXPORT_SYMBOL_GPL(irq_domain_xlate_twocell); + +/** + * irq_domain_xlate_onetwocell() - Generic xlate for one or two cell bindings + * + * Device Tree IRQ specifier translation function which works with either one + * or two cell bindings where the cell values map directly to the hwirq number + * and linux irq flags. + * + * Note: don't use this function unless your interrupt controller explicitly + * supports both one and two cell bindings. For the majority of controllers + * the _onecell() or _twocell() variants above should be used. + */ +int irq_domain_xlate_onetwocell(struct irq_domain *d, + struct device_node *ctrlr, + const u32 *intspec, unsigned int intsize, + unsigned long *out_hwirq, unsigned int *out_type) +{ + if (WARN_ON(intsize < 1)) + return -EINVAL; + *out_hwirq = intspec[0]; + *out_type = (intsize > 1) ? intspec[1] : IRQ_TYPE_NONE; + return 0; +} +EXPORT_SYMBOL_GPL(irq_domain_xlate_onetwocell); struct irq_domain_ops irq_domain_simple_ops = { .map = irq_domain_simple_ma
[PATCH v5 24/27] irq_domain/microblaze: Convert microblaze to use irq_domains
This patch converts Microblaze to use the irq_domain remapper and get away from hard coding the offset between hwirq number and the linux irq number space. This also paves the way for multiple interrupt controllers. v2: Don't enable SPARSE_IRQ and keep NR_IRQS set to 33 Signed-off-by: Grant Likely Signed-off-by: Michal Simek Cc: Rob Herring Cc: John Williams Cc: John Linn --- arch/microblaze/Kconfig |1 + arch/microblaze/include/asm/hardirq.h | 16 - arch/microblaze/include/asm/irq.h | 42 ++- arch/microblaze/kernel/intc.c | 61 - arch/microblaze/kernel/irq.c | 24 ++--- 5 files changed, 45 insertions(+), 99 deletions(-) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index c8d6efb..11060fa 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -14,6 +14,7 @@ config MICROBLAZE select TRACING_SUPPORT select OF select OF_EARLY_FLATTREE + select IRQ_DOMAIN select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_PROBE select GENERIC_IRQ_SHOW diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h index cd1ac9a..fb3c05a 100644 --- a/arch/microblaze/include/asm/hardirq.h +++ b/arch/microblaze/include/asm/hardirq.h @@ -1,17 +1 @@ -/* - * Copyright (C) 2006 Atmark Techno, Inc. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#ifndef _ASM_MICROBLAZE_HARDIRQ_H -#define _ASM_MICROBLAZE_HARDIRQ_H - -/* should be defined in each interrupt controller driver */ -extern unsigned int get_irq(struct pt_regs *regs); - #include - -#endif /* _ASM_MICROBLAZE_HARDIRQ_H */ diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index 7798ad1..bab3b13 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h @@ -9,49 +9,13 @@ #ifndef _ASM_MICROBLAZE_IRQ_H #define _ASM_MICROBLAZE_IRQ_H - -/* - * Linux IRQ# is currently offset by one to map to the hardware - * irq number. So hardware IRQ0 maps to Linux irq 1. - */ -#define NO_IRQ_OFFSET 1 -#define IRQ_OFFSET NO_IRQ_OFFSET -#define NR_IRQS(32 + IRQ_OFFSET) +#define NR_IRQS(32 + 1) #include -/* This type is the placeholder for a hardware interrupt number. It has to - * be big enough to enclose whatever representation is used by a given - * platform. - */ -typedef unsigned long irq_hw_number_t; - -extern unsigned int nr_irq; - struct pt_regs; extern void do_IRQ(struct pt_regs *regs); -/** FIXME - not implement - * irq_dispose_mapping - Unmap an interrupt - * @virq: linux virq number of the interrupt to unmap - */ -static inline void irq_dispose_mapping(unsigned int virq) -{ - return; -} - -struct irq_domain; - -/** - * irq_create_mapping - Map a hardware interrupt into linux virq space - * @host: host owning this hardware interrupt or NULL for default host - * @hwirq: hardware irq number in that host space - * - * Only one mapping per hardware interrupt is permitted. Returns a linux - * virq number. - * If the sense/trigger is to be specified, set_irq_type() should be called - * on the number returned from that call. - */ -extern unsigned int irq_create_mapping(struct irq_domain *host, - irq_hw_number_t hwirq); +/* should be defined in each interrupt controller driver */ +extern unsigned int get_irq(void); #endif /* _ASM_MICROBLAZE_IRQ_H */ diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c index 44b177e..ad12067 100644 --- a/arch/microblaze/kernel/intc.c +++ b/arch/microblaze/kernel/intc.c @@ -9,6 +9,7 @@ */ #include +#include #include #include #include @@ -25,8 +26,6 @@ static unsigned int intc_baseaddr; #define INTC_BASE intc_baseaddr #endif -unsigned int nr_irq; - /* No one else should require these constants, so define them locally here. */ #define ISR 0x00 /* Interrupt Status Register */ #define IPR 0x04 /* Interrupt Pending Register */ @@ -84,24 +83,45 @@ static struct irq_chip intc_dev = { .irq_mask_ack = intc_mask_ack, }; -unsigned int get_irq(struct pt_regs *regs) +static struct irq_domain *root_domain; + +unsigned int get_irq(void) { - int irq; + unsigned int hwirq, irq = -1; - /* -* NOTE: This function is the one that needs to be improved in -* order to handle multiple interrupt controllers. It currently -* is hardcoded to check for interrupts only on the first INTC. -*/ - irq = in_be32(INTC_BASE + IVR) + NO_IRQ_OFFSET; - pr_debug("get_irq: %d\n", irq); + hwirq = in_be32(INTC_BASE + IVR); + if (hwirq != -1U) + irq = irq_find_mapping(root_domain, hwirq); + +
[PATCH v5 25/27] irq_domain: remove "hint" when allocating irq numbers
The 'hint' used to try and line up irq numbers with hw irq numbers is rather a hack and not very useful. Now that /proc/interrupts also outputs the hwirq number, it is even less useful to keep around the 'hint' heuristic. This patch removes it. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- kernel/irq/irqdomain.c | 20 1 files changed, 4 insertions(+), 16 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 2d3dfff..db7adb2 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -350,7 +350,7 @@ unsigned int irq_create_direct_mapping(struct irq_domain *domain) unsigned int irq_create_mapping(struct irq_domain *domain, irq_hw_number_t hwirq) { - unsigned int virq, hint; + unsigned int virq; pr_debug("irq: irq_create_mapping(0x%p, 0x%lx)\n", domain, hwirq); @@ -377,12 +377,7 @@ unsigned int irq_create_mapping(struct irq_domain *domain, return irq_domain_legacy_revmap(domain, hwirq); /* Allocate a virtual interrupt number */ - hint = hwirq % irq_virq_count; - if (hint == 0) - hint++; - virq = irq_alloc_desc_from(hint, 0); - if (!virq) - virq = irq_alloc_desc_from(1, 0); + virq = irq_alloc_desc_from(1, 0); if (!virq) { pr_debug("irq: -> virq allocation failed\n"); return 0; @@ -503,7 +498,6 @@ unsigned int irq_find_mapping(struct irq_domain *domain, irq_hw_number_t hwirq) { unsigned int i; - unsigned int hint = hwirq % irq_virq_count; /* Look for default domain if nececssary */ if (domain == NULL) @@ -516,17 +510,11 @@ unsigned int irq_find_mapping(struct irq_domain *domain, return irq_domain_legacy_revmap(domain, hwirq); /* Slow path does a linear search of the map */ - if (hint == 0) - hint = 1; - i = hint; - do { + for (i = 0; i < irq_virq_count; i++) { struct irq_data *data = irq_get_irq_data(i); if (data && (data->domain == domain) && (data->hwirq == hwirq)) return i; - i++; - if (i >= irq_virq_count) - i = 1 - } while(i != hint); + } return 0; } EXPORT_SYMBOL_GPL(irq_find_mapping); -- 1.7.9 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 22/27] irq_domain/powerpc: constify irq_domain_ops
Make all the irq_domain_ops structures in powerpc 'static const' Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/platforms/512x/mpc5121_ads_cpld.c |2 +- arch/powerpc/platforms/52xx/media5200.c |2 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c|2 +- arch/powerpc/platforms/52xx/mpc52xx_pic.c|2 +- arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |2 +- arch/powerpc/platforms/85xx/socrates_fpga_pic.c |2 +- arch/powerpc/platforms/86xx/gef_pic.c|2 +- arch/powerpc/platforms/cell/axon_msi.c |2 +- arch/powerpc/platforms/cell/beat_interrupt.c |2 +- arch/powerpc/platforms/cell/interrupt.c |2 +- arch/powerpc/platforms/cell/spider-pic.c |2 +- arch/powerpc/platforms/embedded6xx/flipper-pic.c |2 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c|2 +- arch/powerpc/platforms/iseries/irq.c |2 +- arch/powerpc/platforms/powermac/pic.c|2 +- arch/powerpc/platforms/powermac/smp.c|2 +- arch/powerpc/platforms/ps3/interrupt.c |2 +- arch/powerpc/platforms/wsp/opb_pic.c |2 +- arch/powerpc/sysdev/cpm1.c |2 +- arch/powerpc/sysdev/cpm2_pic.c |2 +- arch/powerpc/sysdev/ehv_pic.c|2 +- arch/powerpc/sysdev/fsl_msi.c|2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c index 291d61c..ca3a062 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c @@ -137,7 +137,7 @@ cpld_pic_host_map(struct irq_domain *h, unsigned int virq, return 0; } -static struct irq_domain_ops cpld_pic_host_ops = { +static const struct irq_domain_ops cpld_pic_host_ops = { .match = cpld_pic_host_match, .map = cpld_pic_host_map, }; diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c index 5db5cfb..17d91b7 100644 --- a/arch/powerpc/platforms/52xx/media5200.c +++ b/arch/powerpc/platforms/52xx/media5200.c @@ -136,7 +136,7 @@ static int media5200_irq_xlate(struct irq_domain *h, struct device_node *ct, return 0; } -static struct irq_domain_ops media5200_irq_ops = { +static const struct irq_domain_ops media5200_irq_ops = { .map = media5200_irq_map, .xlate = media5200_irq_xlate, }; diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index b53275d..028470b 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -236,7 +236,7 @@ static int mpc52xx_gpt_irq_xlate(struct irq_domain *h, struct device_node *ct, return 0; } -static struct irq_domain_ops mpc52xx_gpt_irq_ops = { +static const struct irq_domain_ops mpc52xx_gpt_irq_ops = { .map = mpc52xx_gpt_irq_map, .xlate = mpc52xx_gpt_irq_xlate, }; diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c index 41fa671..8520b58 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c @@ -384,7 +384,7 @@ static int mpc52xx_irqhost_map(struct irq_domain *h, unsigned int virq, return 0; } -static struct irq_domain_ops mpc52xx_irqhost_ops = { +static const struct irq_domain_ops mpc52xx_irqhost_ops = { .xlate = mpc52xx_irqhost_xlate, .map = mpc52xx_irqhost_map, }; diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c index 4ef9d69..328d221 100644 --- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c @@ -112,7 +112,7 @@ static int pci_pic_host_map(struct irq_domain *h, unsigned int virq, return 0; } -static struct irq_domain_ops pci_pic_host_ops = { +static const struct irq_domain_ops pci_pic_host_ops = { .map = pci_pic_host_map, }; diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c index 1092c12..3bbbf74 100644 --- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c +++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c @@ -269,7 +269,7 @@ static int socrates_fpga_pic_host_xlate(struct irq_domain *h, return 0; } -static struct irq_domain_ops socrates_fpga_pic_host_ops = { +static const struct irq_domain_ops socrates_fpga_pic_host_ops = { .map= socrates_fpga_pic_host_map, .xlate = socrates_fpga_pic_host_xlate, }; diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/platforms/86xx/gef_pic.c index 126a94b..af3fd69 100644 --- a/arch/powerpc/platforms/86xx/gef_pic.c +++ b/arch/powerpc/platforms/86xx/gef_pic.c @@
[PATCH v5 23/27] irq_domain/powerpc: Replace custom xlate functions with library functions
This patch converts a number of the powerpc drivers to use the common library of irq_domain xlate functions, dropping a bunch of lines in the process. v5: - Remove tsi108 changes from patch Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/platforms/powermac/pic.c | 13 + arch/powerpc/platforms/wsp/opb_pic.c | 13 + arch/powerpc/sysdev/cpm2_pic.c| 14 +- arch/powerpc/sysdev/ipic.c| 18 +- arch/powerpc/sysdev/qe_lib/qe_ic.c| 15 +-- arch/powerpc/sysdev/uic.c | 14 +- drivers/gpio/gpio-mpc8xxx.c | 17 + 7 files changed, 7 insertions(+), 97 deletions(-) diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 46a5f32..92afc38 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c @@ -288,21 +288,10 @@ static int pmac_pic_host_map(struct irq_domain *h, unsigned int virq, return 0; } -static int pmac_pic_host_xlate(struct irq_domain *h, struct device_node *ct, - const u32 *intspec, unsigned int intsize, - irq_hw_number_t *out_hwirq, - unsigned int *out_flags) - -{ - *out_flags = IRQ_TYPE_NONE; - *out_hwirq = *intspec; - return 0; -} - static const struct irq_domain_ops pmac_pic_host_ops = { .match = pmac_pic_host_match, .map = pmac_pic_host_map, - .xlate = pmac_pic_host_xlate, + .xlate = irq_domain_xlate_onecell, }; static void __init pmac_pic_probe_oldstyle(void) diff --git a/arch/powerpc/platforms/wsp/opb_pic.c b/arch/powerpc/platforms/wsp/opb_pic.c index 0c6fe0b..cb565bf 100644 --- a/arch/powerpc/platforms/wsp/opb_pic.c +++ b/arch/powerpc/platforms/wsp/opb_pic.c @@ -196,20 +196,9 @@ static int opb_host_map(struct irq_domain *host, unsigned int virq, return 0; } -static int opb_host_xlate(struct irq_domain *host, struct device_node *dn, - const u32 *intspec, unsigned int intsize, - irq_hw_number_t *out_hwirq, unsigned int *out_type) -{ - /* Interrupt size must == 2 */ - BUG_ON(intsize != 2); - *out_hwirq = intspec[0]; - *out_type = intspec[1]; - return 0; -} - static const struct irq_domain_ops opb_host_ops = { .map = opb_host_map, - .xlate = opb_host_xlate, + .xlate = irq_domain_xlate_twocell, }; irqreturn_t opb_irq_handler(int irq, void *private) diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c index 8c9fc9c..d3be961 100644 --- a/arch/powerpc/sysdev/cpm2_pic.c +++ b/arch/powerpc/sysdev/cpm2_pic.c @@ -224,21 +224,9 @@ static int cpm2_pic_host_map(struct irq_domain *h, unsigned int virq, return 0; } -static int cpm2_pic_host_xlate(struct irq_domain *h, struct device_node *ct, - const u32 *intspec, unsigned int intsize, - irq_hw_number_t *out_hwirq, unsigned int *out_flags) -{ - *out_hwirq = intspec[0]; - if (intsize > 1) - *out_flags = intspec[1]; - else - *out_flags = IRQ_TYPE_NONE; - return 0; -} - static const struct irq_domain_ops cpm2_pic_host_ops = { .map = cpm2_pic_host_map, - .xlate = cpm2_pic_host_xlate, + .xlate = irq_domain_xlate_onetwocell, }; void cpm2_pic_init(struct device_node *node) diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index 0eaaa01..b50f978 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c @@ -692,26 +692,10 @@ static int ipic_host_map(struct irq_domain *h, unsigned int virq, return 0; } -static int ipic_host_xlate(struct irq_domain *h, struct device_node *ct, - const u32 *intspec, unsigned int intsize, - irq_hw_number_t *out_hwirq, unsigned int *out_flags) - -{ - /* interrupt sense values coming from the device tree equal either -* LEVEL_LOW (low assertion) or EDGE_FALLING (high-to-low change) -*/ - *out_hwirq = intspec[0]; - if (intsize > 1) - *out_flags = intspec[1]; - else - *out_flags = IRQ_TYPE_NONE; - return 0; -} - static struct irq_domain_ops ipic_host_ops = { .match = ipic_host_match, .map= ipic_host_map, - .xlate = ipic_host_xlate, + .xlate = irq_domain_xlate_onetwocell, }; struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index e9b3d5c..2fba6ef 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c @@ -272,23 +272,10 @@ static int qe_ic_host_map(struct irq_domain
[PATCH v5 21/27] irq_domain/c6x: Use library of xlate functions
The c6x irq controllers don't need to define custom .xlate hooks Signed-off-by: Grant Likely Cc: Rob Herring Cc: Mark Salter Cc: Thomas Gleixner --- arch/c6x/kernel/irq.c|1 + arch/c6x/platforms/megamod-pic.c | 14 +- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c index c6b36e8..d77bcfd 100644 --- a/arch/c6x/kernel/irq.c +++ b/arch/c6x/kernel/irq.c @@ -88,6 +88,7 @@ static int core_domain_map(struct irq_domain *h, unsigned int virq, static const struct irq_domain_ops core_domain_ops = { .map = core_domain_map, + .xlate = irq_domain_xlate_onecell, }; void __init init_IRQ(void) diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c index 9f35fbf..c1c4e2a 100644 --- a/arch/c6x/platforms/megamod-pic.c +++ b/arch/c6x/platforms/megamod-pic.c @@ -136,21 +136,9 @@ static int megamod_map(struct irq_domain *h, unsigned int virq, return 0; } -static int megamod_xlate(struct irq_domain *h, struct device_node *ct, -const u32 *intspec, unsigned int intsize, -irq_hw_number_t *out_hwirq, unsigned int *out_type) - -{ - /* megamod intspecs must have 1 cell */ - BUG_ON(intsize != 1); - *out_hwirq = intspec[0]; - *out_type = IRQ_TYPE_NONE; - return 0; -} - static const struct irq_domain_ops megamod_domain_ops = { .map= megamod_map, - .xlate = megamod_xlate, + .xlate = irq_domain_xlate_onecell, }; static void __init set_megamod_mux(struct megamod_pic *pic, int src, int output) -- 1.7.9 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 11/27] irq_domain: Replace irq_alloc_host() with revmap-specific initializers
Each revmap type has different arguments for setting up the revmap. This patch splits up the generator functions so that each revmap type can do its own setup and the user doesn't need to keep track of how each revmap type handles the arguments. This patch also adds a host_data argument to the generators. There are cases where the host_data pointer will be needed before the function returns. ie. the legacy map calls the .map callback for each irq before returning. v2: - Add void *host_data argument to irq_domain_add_*() functions - fixed failure to compile - Moved IRQ_DOMAIN_MAP_* defines into irqdomain.c Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/platforms/512x/mpc5121_ads_cpld.c |3 +- arch/powerpc/platforms/52xx/media5200.c |7 +- arch/powerpc/platforms/52xx/mpc52xx_gpt.c|6 +- arch/powerpc/platforms/52xx/mpc52xx_pic.c|4 +- arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |6 +- arch/powerpc/platforms/85xx/socrates_fpga_pic.c |5 +- arch/powerpc/platforms/86xx/gef_pic.c|5 +- arch/powerpc/platforms/cell/axon_msi.c |5 +- arch/powerpc/platforms/cell/beat_interrupt.c |4 +- arch/powerpc/platforms/cell/interrupt.c |4 +- arch/powerpc/platforms/cell/spider-pic.c |6 +- arch/powerpc/platforms/embedded6xx/flipper-pic.c |6 +- arch/powerpc/platforms/embedded6xx/hlwd-pic.c|5 +- arch/powerpc/platforms/iseries/irq.c |3 +- arch/powerpc/platforms/powermac/pic.c|5 +- arch/powerpc/platforms/powermac/smp.c|3 +- arch/powerpc/platforms/ps3/interrupt.c |3 +- arch/powerpc/platforms/wsp/opb_pic.c |7 +- arch/powerpc/sysdev/cpm1.c |3 +- arch/powerpc/sysdev/cpm2_pic.c |3 +- arch/powerpc/sysdev/ehv_pic.c|6 +- arch/powerpc/sysdev/fsl_msi.c|6 +- arch/powerpc/sysdev/i8259.c |3 +- arch/powerpc/sysdev/ipic.c |7 +- arch/powerpc/sysdev/mpc8xx_pic.c |3 +- arch/powerpc/sysdev/mpic.c |7 +- arch/powerpc/sysdev/mv64x60_pic.c|5 +- arch/powerpc/sysdev/qe_lib/qe_ic.c |5 +- arch/powerpc/sysdev/tsi108_pci.c |3 +- arch/powerpc/sysdev/uic.c|6 +- arch/powerpc/sysdev/xics/xics-common.c |3 +- arch/powerpc/sysdev/xilinx_intc.c|5 +- drivers/gpio/gpio-mpc8xxx.c |7 +- include/linux/irqdomain.h| 24 ++- kernel/irq/irqdomain.c | 200 ++ 35 files changed, 198 insertions(+), 185 deletions(-) diff --git a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c index fefa797..291d61c 100644 --- a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c +++ b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c @@ -190,8 +190,7 @@ mpc5121_ads_cpld_pic_init(void) cpld_pic_node = of_node_get(np); - cpld_pic_host = - irq_alloc_host(np, IRQ_DOMAIN_MAP_LINEAR, 16, &cpld_pic_host_ops, 16); + cpld_pic_host = irq_domain_add_linear(np, 16, &cpld_pic_host_ops, NULL); if (!cpld_pic_host) { printk(KERN_ERR "CPLD PIC: failed to allocate irq host!\n"); goto end; diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c index a746415..5db5cfb 100644 --- a/arch/powerpc/platforms/52xx/media5200.c +++ b/arch/powerpc/platforms/52xx/media5200.c @@ -173,15 +173,12 @@ static void __init media5200_init_irq(void) spin_lock_init(&media5200_irq.lock); - media5200_irq.irqhost = irq_alloc_host(fpga_np, IRQ_DOMAIN_MAP_LINEAR, - MEDIA5200_NUM_IRQS, - &media5200_irq_ops, -1); + media5200_irq.irqhost = irq_domain_add_linear(fpga_np, + MEDIA5200_NUM_IRQS, &media5200_irq_ops, &media5200_irq); if (!media5200_irq.irqhost) goto out; pr_debug("%s: allocated irqhost\n", __func__); - media5200_irq.irqhost->host_data = &media5200_irq; - irq_set_handler_data(cascade_virq, &media5200_irq); irq_set_chained_handler(cascade_virq, media5200_irq_cascade); diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c index e90af8f..b53275d 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c @@ -252,14 +252,12 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node) if (!cascade_virq) return;
[PATCH v5 20/27] irq_domain/c6x: constify irq_domain structures
Signed-off-by: Grant Likely Cc: Mark Salter Cc: Thomas Gleixner --- arch/arm/common/gic.c|2 +- arch/c6x/kernel/irq.c|2 +- arch/c6x/platforms/megamod-pic.c |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index 7275d80..f0783be 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c @@ -635,7 +635,7 @@ static int gic_irq_domain_xlate(struct irq_domain *d, return 0; } -struct irq_domain_ops gic_irq_domain_ops = { +const struct irq_domain_ops gic_irq_domain_ops = { .map = gic_irq_domain_map, .xlate = gic_irq_domain_xlate, }; diff --git a/arch/c6x/kernel/irq.c b/arch/c6x/kernel/irq.c index 3d5ac60..c6b36e8 100644 --- a/arch/c6x/kernel/irq.c +++ b/arch/c6x/kernel/irq.c @@ -86,7 +86,7 @@ static int core_domain_map(struct irq_domain *h, unsigned int virq, return 0; } -static struct irq_domain_ops core_domain_ops = { +static const struct irq_domain_ops core_domain_ops = { .map = core_domain_map, }; diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c index 61f5863..9f35fbf 100644 --- a/arch/c6x/platforms/megamod-pic.c +++ b/arch/c6x/platforms/megamod-pic.c @@ -148,7 +148,7 @@ static int megamod_xlate(struct irq_domain *h, struct device_node *ct, return 0; } -static struct irq_domain_ops megamod_domain_ops = { +static const struct irq_domain_ops megamod_domain_ops = { .map= megamod_map, .xlate = megamod_xlate, }; -- 1.7.9 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 19/27] irq_domain/c6x: Convert c6x to use generic irq_domain support.
From: Mark Salter The C6X IRQ support was copied almost verbatim from the PowerPC virtual IRQ code. The PowerPC code was used as the basis for generic irq_domain support, so this patch mostly copies what what done to arch/powerpc by Grant Likely in his irq_domain patch series. Signed-off-by: Mark Salter Signed-off-by: Grant Likely Cc: Aurelien Jacquiot Cc: Thomas Gleixner --- arch/c6x/Kconfig |1 + arch/c6x/include/asm/irq.h | 245 +--- arch/c6x/kernel/irq.c| 611 +- arch/c6x/platforms/megamod-pic.c | 13 +- 4 files changed, 21 insertions(+), 849 deletions(-) diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig index 26e67f0..3c64b28 100644 --- a/arch/c6x/Kconfig +++ b/arch/c6x/Kconfig @@ -12,6 +12,7 @@ config TMS320C6X select HAVE_GENERIC_HARDIRQS select HAVE_MEMBLOCK select HAVE_SPARSE_IRQ + select IRQ_DOMAIN select OF select OF_EARLY_FLATTREE diff --git a/arch/c6x/include/asm/irq.h b/arch/c6x/include/asm/irq.h index a6ae3c9..f13b78d 100644 --- a/arch/c6x/include/asm/irq.h +++ b/arch/c6x/include/asm/irq.h @@ -13,6 +13,7 @@ #ifndef _ASM_C6X_IRQ_H #define _ASM_C6X_IRQ_H +#include #include #include #include @@ -41,253 +42,9 @@ /* This number is used when no interrupt has been assigned */ #define NO_IRQ 0 -/* This type is the placeholder for a hardware interrupt number. It has to - * be big enough to enclose whatever representation is used by a given - * platform. - */ -typedef unsigned long irq_hw_number_t; - -/* Interrupt controller "host" data structure. This could be defined as a - * irq domain controller. That is, it handles the mapping between hardware - * and virtual interrupt numbers for a given interrupt domain. The host - * structure is generally created by the PIC code for a given PIC instance - * (though a host can cover more than one PIC if they have a flat number - * model). It's the host callbacks that are responsible for setting the - * irq_chip on a given irq_desc after it's been mapped. - * - * The host code and data structures are fairly agnostic to the fact that - * we use an open firmware device-tree. We do have references to struct - * device_node in two places: in irq_find_host() to find the host matching - * a given interrupt controller node, and of course as an argument to its - * counterpart host->ops->match() callback. However, those are treated as - * generic pointers by the core and the fact that it's actually a device-node - * pointer is purely a convention between callers and implementation. This - * code could thus be used on other architectures by replacing those two - * by some sort of arch-specific void * "token" used to identify interrupt - * controllers. - */ -struct irq_host; -struct radix_tree_root; -struct device_node; - -/* Functions below are provided by the host and called whenever a new mapping - * is created or an old mapping is disposed. The host can then proceed to - * whatever internal data structures management is required. It also needs - * to setup the irq_desc when returning from map(). - */ -struct irq_host_ops { - /* Match an interrupt controller device node to a host, returns -* 1 on a match -*/ - int (*match)(struct irq_host *h, struct device_node *node); - - /* Create or update a mapping between a virtual irq number and a hw -* irq number. This is called only once for a given mapping. -*/ - int (*map)(struct irq_host *h, unsigned int virq, irq_hw_number_t hw); - - /* Dispose of such a mapping */ - void (*unmap)(struct irq_host *h, unsigned int virq); - - /* Translate device-tree interrupt specifier from raw format coming -* from the firmware to a irq_hw_number_t (interrupt line number) and -* type (sense) that can be passed to set_irq_type(). In the absence -* of this callback, irq_create_of_mapping() and irq_of_parse_and_map() -* will return the hw number in the first cell and IRQ_TYPE_NONE for -* the type (which amount to keeping whatever default value the -* interrupt controller has for that line) -*/ - int (*xlate)(struct irq_host *h, struct device_node *ctrler, -const u32 *intspec, unsigned int intsize, -irq_hw_number_t *out_hwirq, unsigned int *out_type); -}; - -struct irq_host { - struct list_headlink; - - /* type of reverse mapping technique */ - unsigned intrevmap_type; -#define IRQ_HOST_MAP_PRIORITY 0 /* core priority irqs, get irqs 1..15 */ -#define IRQ_HOST_MAP_NOMAP 1 /* no fast reverse mapping */ -#define IRQ_HOST_MAP_LINEAR2 /* linear map of interrupts */ -#define IRQ_HOST_MAP_TREE 3 /* radix tree */ - union { - struct { - unsigned int size; - unsigned int *revmap; - } line
[PATCH v5 15/27] irq_domain: Remove 'new' irq_domain in favour of the ppc one
This patch removes the simplistic implementation of irq_domains and enables the powerpc infrastructure for all irq_domain users. The powerpc infrastructure includes support for complex mappings between Linux and hardware irq numbers, and can manage allocation of irq_descs. This patch also converts the few users of irq_domain_add()/irq_domain_del() to call irq_domain_add_legacy() instead. v3: Fix bug that set up too many irqs in translation range. v2: Fix removal of irq_alloc_descs() call in gic driver Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/arm/common/gic.c | 85 --- arch/arm/common/vic.c | 16 +--- arch/arm/include/asm/hardware/gic.h |4 +- arch/arm/include/asm/hardware/vic.h |2 + arch/arm/mach-exynos/common.c |2 +- arch/arm/mach-versatile/core.c |7 +- drivers/mfd/twl-core.c | 14 +--- include/linux/irqdomain.h | 45 +- kernel/irq/irqdomain.c | 159 +++ 9 files changed, 71 insertions(+), 263 deletions(-) diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index dc19862..7275d80 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c @@ -51,7 +51,6 @@ union gic_base { }; struct gic_chip_data { - unsigned int irq_offset; union gic_base dist_base; union gic_base cpu_base; #ifdef CONFIG_CPU_PM @@ -61,9 +60,7 @@ struct gic_chip_data { u32 __percpu *saved_ppi_enable; u32 __percpu *saved_ppi_conf; #endif -#ifdef CONFIG_IRQ_DOMAIN - struct irq_domain domain; -#endif + struct irq_domain *domain; unsigned int gic_irqs; #ifdef CONFIG_GIC_NON_BANKED void __iomem *(*get_base)(union gic_base *); @@ -282,7 +279,7 @@ asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs) irqnr = irqstat & ~0x1c00; if (likely(irqnr > 15 && irqnr < 1021)) { - irqnr = irq_domain_to_irq(&gic->domain, irqnr); + irqnr = irq_find_mapping(gic->domain, irqnr); handle_IRQ(irqnr, regs); continue; } @@ -314,8 +311,8 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) if (gic_irq == 1023) goto out; - cascade_irq = irq_domain_to_irq(&chip_data->domain, gic_irq); - if (unlikely(gic_irq < 32 || gic_irq > 1020 || cascade_irq >= NR_IRQS)) + cascade_irq = irq_find_mapping(chip_data->domain, gic_irq); + if (unlikely(gic_irq < 32 || gic_irq > 1020)) do_bad_IRQ(cascade_irq, desc); else generic_handle_irq(cascade_irq); @@ -348,10 +345,9 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) static void __init gic_dist_init(struct gic_chip_data *gic) { - unsigned int i, irq; + unsigned int i; u32 cpumask; unsigned int gic_irqs = gic->gic_irqs; - struct irq_domain *domain = &gic->domain; void __iomem *base = gic_data_dist_base(gic); u32 cpu = cpu_logical_map(smp_processor_id()); @@ -386,23 +382,6 @@ static void __init gic_dist_init(struct gic_chip_data *gic) for (i = 32; i < gic_irqs; i += 32) writel_relaxed(0x, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); - /* -* Setup the Linux IRQ subsystem. -*/ - irq_domain_for_each_irq(domain, i, irq) { - if (i < 32) { - irq_set_percpu_devid(irq); - irq_set_chip_and_handler(irq, &gic_chip, -handle_percpu_devid_irq); - set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN); - } else { - irq_set_chip_and_handler(irq, &gic_chip, -handle_fasteoi_irq); - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); - } - irq_set_chip_data(irq, gic); - } - writel_relaxed(1, base + GIC_DIST_CTRL); } @@ -618,7 +597,23 @@ static void __init gic_pm_init(struct gic_chip_data *gic) } #endif -#ifdef CONFIG_OF +static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq, + irq_hw_number_t hw) +{ + if (hw < 32) { + irq_set_percpu_devid(irq); + irq_set_chip_and_handler(irq, &gic_chip, +handle_percpu_devid_irq); + set_irq_flags(irq, IRQF_VALID | IRQF_NOAUTOEN); + } else { + irq_set_chip_and_handler(irq, &gic_chip, +handle_fasteoi_irq); + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); + } + irq_set_chip_data(irq, d->hos
[PATCH v5 18/27] irq_domain: constify irq_domain_ops
Make irq_domain_ops pointer a constant to make it safer for multiple instances to share the same ops pointer and change the irq_domain code so that it does not modify the ops. v4: Fix mismatched type reference in powerpc code Signed-off-by: Grant Likely Cc: Thomas Gleixner Cc: Benjamin Herrenschmidt Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/sysdev/mpic_msi.c |2 +- include/linux/irqdomain.h | 14 +++--- kernel/irq/irqdomain.c | 31 +++ 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c index 00395f4..0622aa9 100644 --- a/arch/powerpc/sysdev/mpic_msi.c +++ b/arch/powerpc/sysdev/mpic_msi.c @@ -32,7 +32,7 @@ void mpic_msi_reserve_hwirq(struct mpic *mpic, irq_hw_number_t hwirq) static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic) { irq_hw_number_t hwirq; - struct irq_domain_ops *ops = mpic->irqhost->ops; + const struct irq_domain_ops *ops = mpic->irqhost->ops; struct device_node *np; int flags, index, i; struct of_irq oirq; diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index ea58f36..5245488 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -106,7 +106,7 @@ struct irq_domain { } linear; struct radix_tree_root tree; } revmap_data; - struct irq_domain_ops *ops; + const struct irq_domain_ops *ops; void *host_data; irq_hw_number_t inval_irq; @@ -119,17 +119,17 @@ struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, unsigned int size, unsigned int first_irq, irq_hw_number_t first_hwirq, -struct irq_domain_ops *ops, +const struct irq_domain_ops *ops, void *host_data); struct irq_domain *irq_domain_add_linear(struct device_node *of_node, unsigned int size, -struct irq_domain_ops *ops, +const struct irq_domain_ops *ops, void *host_data); struct irq_domain *irq_domain_add_nomap(struct device_node *of_node, -struct irq_domain_ops *ops, +const struct irq_domain_ops *ops, void *host_data); struct irq_domain *irq_domain_add_tree(struct device_node *of_node, -struct irq_domain_ops *ops, +const struct irq_domain_ops *ops, void *host_data); extern struct irq_domain *irq_find_host(struct device_node *node); @@ -138,7 +138,7 @@ extern void irq_set_virq_count(unsigned int count); static inline struct irq_domain *irq_domain_add_legacy_isa( struct device_node *of_node, - struct irq_domain_ops *ops, + const struct irq_domain_ops *ops, void *host_data) { return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, @@ -162,7 +162,7 @@ extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host, extern unsigned int irq_linear_revmap(struct irq_domain *host, irq_hw_number_t hwirq); -extern struct irq_domain_ops irq_domain_simple_ops; +extern const struct irq_domain_ops irq_domain_simple_ops; /* stock xlate functions */ int irq_domain_xlate_onecell(struct irq_domain *d, struct device_node *ctrlr, diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 9a8f95e..2d3dfff 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -26,11 +26,6 @@ static DEFINE_MUTEX(revmap_trees_mutex); static unsigned int irq_virq_count = NR_IRQS; static struct irq_domain *irq_default_domain; -static int default_irq_domain_match(struct irq_domain *d, struct device_node *np) -{ - return d->of_node != NULL && d->of_node == np; -} - /** * irq_domain_alloc() - Allocate a new irq_domain data structure * @of_node: optional device-tree node of the interrupt controller @@ -44,7 +39,7 @@ static int default_irq_domain_match(struct irq_domain *d, struct device_node *np */ static struct irq_domain *irq_domain_alloc(struct device_node *of_node, unsigned int revmap_type, - struct irq_domain_ops *ops, + const struct irq_domain_ops *ops, void *host_data) { struct irq_domain *domain; @@
[PATCH v5 16/27] irq_domain: Remove irq_domain_add_simple()
irq_domain_add_simple() was a stop-gap measure until complete irq_domain support was complete. This patch removes the irq_domain_add_simple() interface. This patch also drops the explicit irq_domain initialization performed by the mach-versatile code because the versatile interrupt controller already has irq_domain support built into it. This was a bug that was hanging around quietly for a while, but with the full irq_domain which actually verifies that irq_domain ranges are available it would cause the registration to fail and the system wouldn't boot. v4: Fixed number of irqs in mx5 gpio code v2: Updated to pass in host_data pointer on irq_domain allocation. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Thomas Gleixner Cc: Milton Miller Cc: Russell King Tested-by: Olof Johansson --- arch/arm/mach-imx/imx51-dt.c|4 ++-- arch/arm/mach-imx/imx53-dt.c|4 ++-- arch/arm/mach-imx/mach-imx6q.c |3 ++- arch/arm/mach-msm/board-msm8x60.c |8 ++-- arch/arm/mach-omap2/board-generic.c |2 +- arch/arm/mach-prima2/irq.c |2 +- include/linux/irqdomain.h |1 - kernel/irq/irqdomain.c | 10 ++ 8 files changed, 12 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-imx/imx51-dt.c b/arch/arm/mach-imx/imx51-dt.c index e6bad17..1e03ef4 100644 --- a/arch/arm/mach-imx/imx51-dt.c +++ b/arch/arm/mach-imx/imx51-dt.c @@ -47,7 +47,7 @@ static const struct of_dev_auxdata imx51_auxdata_lookup[] __initconst = { static int __init imx51_tzic_add_irq_domain(struct device_node *np, struct device_node *interrupt_parent) { - irq_domain_add_simple(np, 0); + irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); return 0; } @@ -57,7 +57,7 @@ static int __init imx51_gpio_add_irq_domain(struct device_node *np, static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; gpio_irq_base -= 32; - irq_domain_add_simple(np, gpio_irq_base); + irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx53-dt.c b/arch/arm/mach-imx/imx53-dt.c index 05ebb3e..fd5be0f 100644 --- a/arch/arm/mach-imx/imx53-dt.c +++ b/arch/arm/mach-imx/imx53-dt.c @@ -51,7 +51,7 @@ static const struct of_dev_auxdata imx53_auxdata_lookup[] __initconst = { static int __init imx53_tzic_add_irq_domain(struct device_node *np, struct device_node *interrupt_parent) { - irq_domain_add_simple(np, 0); + irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL); return 0; } @@ -61,7 +61,7 @@ static int __init imx53_gpio_add_irq_domain(struct device_node *np, static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; gpio_irq_base -= 32; - irq_domain_add_simple(np, gpio_irq_base); + irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL); return 0; } diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index c257281..6075d4d 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -97,7 +97,8 @@ static int __init imx6q_gpio_add_irq_domain(struct device_node *np, static int gpio_irq_base = MXC_GPIO_IRQ_START + ARCH_NR_GPIOS; gpio_irq_base -= 32; - irq_domain_add_simple(np, gpio_irq_base); + irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, + NULL); return 0; } diff --git a/arch/arm/mach-msm/board-msm8x60.c b/arch/arm/mach-msm/board-msm8x60.c index 0a11342..962e711 100644 --- a/arch/arm/mach-msm/board-msm8x60.c +++ b/arch/arm/mach-msm/board-msm8x60.c @@ -80,12 +80,8 @@ static struct of_device_id msm_dt_gic_match[] __initdata = { static void __init msm8x60_dt_init(void) { - struct device_node *node; - - node = of_find_matching_node_by_address(NULL, msm_dt_gic_match, - MSM8X60_QGIC_DIST_PHYS); - if (node) - irq_domain_add_simple(node, GIC_SPI_START); + irq_domain_generate_simple(msm_dt_gic_match, MSM8X60_QGIC_DIST_PHYS, + GIC_SPI_START); if (of_machine_is_compatible("qcom,msm8660-surf")) { printk(KERN_INFO "Init surf UART registers\n"); diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index d587560..00b1d02 100644 --- a/arch/arm/mach-omap2/board-generic.c +++ b/arch/arm/mach-omap2/board-generic.c @@ -67,7 +67,7 @@ static void __init omap_generic_init(void) { struct device_node *node = of_find_matching_node(NULL, intc_match); if (node) - irq_domain_add_simple(node, 0); + irq_domain_add_legacy(node, 32, 0, 0, &irq_domain_simple_ops, NULL); omap_sdrc_init(NULL, NULL); diff --git a/arch/arm/mach-prima2/irq.c b/arch/arm/
[PATCH v5 09/27] irq_domain: remove NO_IRQ from irq domain code
zero always means no irq when using irq domains. Get rid of the NO_IRQ references. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- kernel/irq/irqdomain.c | 38 +++--- 1 files changed, 19 insertions(+), 19 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 3fb4880..b1c4e21 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -108,7 +108,7 @@ struct irq_domain *irq_alloc_host(struct device_node *of_node, case IRQ_DOMAIN_MAP_LINEAR: rmap = (unsigned int *)(host + 1); for (i = 0; i < revmap_arg; i++) - rmap[i] = NO_IRQ; + rmap[i] = 0; host->revmap_data.linear.size = revmap_arg; host->revmap_data.linear.revmap = rmap; break; @@ -218,9 +218,9 @@ unsigned int irq_create_direct_mapping(struct irq_domain *host) WARN_ON(host->revmap_type != IRQ_DOMAIN_MAP_NOMAP); virq = irq_alloc_desc_from(1, 0); - if (virq == NO_IRQ) { + if (!virq) { pr_debug("irq: create_direct virq allocation failed\n"); - return NO_IRQ; + return 0; } if (virq >= irq_virq_count) { pr_err("ERROR: no free irqs available below %i maximum\n", @@ -233,7 +233,7 @@ unsigned int irq_create_direct_mapping(struct irq_domain *host) if (irq_setup_virq(host, virq, virq)) { irq_free_desc(virq); - return NO_IRQ; + return 0; } return virq; @@ -263,13 +263,13 @@ unsigned int irq_create_mapping(struct irq_domain *host, printk(KERN_WARNING "irq_create_mapping called for" " NULL host, hwirq=%lx\n", hwirq); WARN_ON(1); - return NO_IRQ; + return 0; } pr_debug("irq: -> using host @%p\n", host); /* Check if mapping already exists */ virq = irq_find_mapping(host, hwirq); - if (virq != NO_IRQ) { + if (virq) { pr_debug("irq: -> existing mapping on virq %d\n", virq); return virq; } @@ -279,7 +279,7 @@ unsigned int irq_create_mapping(struct irq_domain *host, /* Handle legacy */ virq = (unsigned int)hwirq; if (virq == 0 || virq >= NUM_ISA_INTERRUPTS) - return NO_IRQ; + return 0; return virq; } else { /* Allocate a virtual interrupt number */ @@ -289,16 +289,16 @@ unsigned int irq_create_mapping(struct irq_domain *host, virq = irq_alloc_desc_from(hint, 0); if (!virq) virq = irq_alloc_desc_from(1, 0); - if (virq == NO_IRQ) { + if (!virq) { pr_debug("irq: -> virq allocation failed\n"); - return NO_IRQ; + return 0; } } if (irq_setup_virq(host, virq, hwirq)) { if (host->revmap_type != IRQ_DOMAIN_MAP_LEGACY) irq_free_desc(virq); - return NO_IRQ; + return 0; } pr_debug("irq: irq %lu on host %s mapped to virtual irq %u\n", @@ -323,7 +323,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller, if (host == NULL) { printk(KERN_WARNING "irq: no irq host found for %s !\n", controller->full_name); - return NO_IRQ; + return 0; } /* If host has no translation, then we assume interrupt line */ @@ -332,12 +332,12 @@ unsigned int irq_create_of_mapping(struct device_node *controller, else { if (host->ops->xlate(host, controller, intspec, intsize, &hwirq, &type)) - return NO_IRQ; + return 0; } /* Create mapping */ virq = irq_create_mapping(host, hwirq); - if (virq == NO_IRQ) + if (!virq) return virq; /* Set type if specified and different than the current one */ @@ -358,7 +358,7 @@ void irq_dispose_mapping(unsigned int virq) struct irq_domain *host; irq_hw_number_t hwirq; - if (virq == NO_IRQ || !irq_data) + if (!virq || !irq_data) return; host = irq_data->domain; @@ -387,7 +387,7 @@ void irq_dispose_mapping(unsigned int virq) switch(host->revmap_type) { case IRQ_DOMAIN_MAP_LINEAR: if (hwirq < host->revmap_data.linear.size) - host->revmap_data.linear.revmap[hwirq] = NO_IRQ; + host->revmap_data.linear.revmap[hwirq] = 0; break;
[PATCH v5 08/27] irq_domain: Move irq_domain code from powerpc to kernel/irq
This patch only moves the code. It doesn't make any changes, and the code is still only compiled for powerpc. Follow-on patches will generalize the code for other architectures. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/Kconfig |1 + arch/powerpc/include/asm/irq.h | 144 -- arch/powerpc/kernel/irq.c | 502 - include/linux/irqdomain.h | 46 +++- kernel/irq/irqdomain.c | 600 5 files changed, 643 insertions(+), 650 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 1919634..303703d 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -135,6 +135,7 @@ config PPC select HAVE_GENERIC_HARDIRQS select HAVE_SPARSE_IRQ select IRQ_PER_CPU + select IRQ_DOMAIN select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW_LEVEL select IRQ_FORCED_THREADING diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index f80f262..728cc30 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h @@ -42,155 +42,11 @@ extern atomic_t ppc_n_lost_interrupts; /* Same thing, used by the generic IRQ code */ #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS -/* - * The host code and data structures are fairly agnostic to the fact that - * we use an open firmware device-tree. We do have references to struct - * device_node in two places: in irq_find_host() to find the host matching - * a given interrupt controller node, and of course as an argument to its - * counterpart host->ops->match() callback. However, those are treated as - * generic pointers by the core and the fact that it's actually a device-node - * pointer is purely a convention between callers and implementation. This - * code could thus be used on other architectures by replacing those two - * by some sort of arch-specific void * "token" used to identify interrupt - * controllers. - */ - struct irq_data; extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); extern irq_hw_number_t virq_to_hw(unsigned int virq); /** - * irq_alloc_host - Allocate a new irq_domain data structure - * @of_node: optional device-tree node of the interrupt controller - * @revmap_type: type of reverse mapping to use - * @revmap_arg: for IRQ_DOMAIN_MAP_LINEAR linear only: size of the map - * @ops: map/unmap host callbacks - * @inval_irq: provide a hw number in that host space that is always invalid - * - * Allocates and initialize and irq_domain structure. Note that in the case of - * IRQ_DOMAIN_MAP_LEGACY, the map() callback will be called before this returns - * for all legacy interrupts except 0 (which is always the invalid irq for - * a legacy controller). For a IRQ_DOMAIN_MAP_LINEAR, the map is allocated by - * this call as well. For a IRQ_DOMAIN_MAP_TREE, the radix tree will be allocated - * later during boot automatically (the reverse mapping will use the slow path - * until that happens). - */ -extern struct irq_domain *irq_alloc_host(struct device_node *of_node, - unsigned int revmap_type, - unsigned int revmap_arg, - struct irq_domain_ops *ops, - irq_hw_number_t inval_irq); - - -/** - * irq_find_host - Locates a host for a given device node - * @node: device-tree node of the interrupt controller - */ -extern struct irq_domain *irq_find_host(struct device_node *node); - - -/** - * irq_set_default_host - Set a "default" host - * @host: default host pointer - * - * For convenience, it's possible to set a "default" host that will be used - * whenever NULL is passed to irq_create_mapping(). It makes life easier for - * platforms that want to manipulate a few hard coded interrupt numbers that - * aren't properly represented in the device-tree. - */ -extern void irq_set_default_host(struct irq_domain *host); - - -/** - * irq_set_virq_count - Set the maximum number of virt irqs - * @count: number of linux virtual irqs, capped with NR_IRQS - * - * This is mainly for use by platforms like iSeries who want to program - * the virtual irq number in the controller to avoid the reverse mapping - */ -extern void irq_set_virq_count(unsigned int count); - - -/** - * irq_create_mapping - Map a hardware interrupt into linux virq space - * @host: host owning this hardware interrupt or NULL for default host - * @hwirq: hardware irq number in that host space - * - * Only one mapping per hardware interrupt is permitted. Returns a linux - * virq number. - * If the sense/trigger is to be specified, set_irq_type() should be called - * on the number returned from that call. - */ -extern unsigned int irq_create_mapping(struct irq_domain *host, - irq_hw_number_t hwirq); - - -/** - * ir
[PATCH v5 14/27] mfd: twl-core.c: Fix the number of interrupts managed by twl4030
From: Benoit Cousson TWL4030 does handle 3 different interrupts ranges: 8 for the core, 8 for the power events and 18 for the GPIOs. Change the total number of interrupts managed by TWL4030 from 8 to 34. Signed-off-by: Benoit Cousson Signed-off-by: Grant Likely --- drivers/mfd/twl-core.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 8ce3959..4967733 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -149,7 +149,7 @@ #define TWL_MODULE_LAST TWL4030_MODULE_LAST -#define TWL4030_NR_IRQS8 +#define TWL4030_NR_IRQS34 /* core:8, power:8, gpio: 18 */ #define TWL6030_NR_IRQS20 /* Base Address defns for twl4030_map[] */ -- 1.7.9 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH v5 10/27] irq_domain: Remove references to old irq_host names
No functional changes. Replaces non-exported references to 'host' with domain. Does not change any symbol names referenced by other .c files. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- kernel/irq/irqdomain.c | 219 1 files changed, 108 insertions(+), 111 deletions(-) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index b1c4e21..e26b921 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -19,11 +19,11 @@ static DEFINE_MUTEX(irq_domain_mutex); #ifdef CONFIG_PPC static DEFINE_MUTEX(revmap_trees_mutex); static unsigned int irq_virq_count = NR_IRQS; -static struct irq_domain *irq_default_host; +static struct irq_domain *irq_default_domain; -static int default_irq_host_match(struct irq_domain *h, struct device_node *np) +static int default_irq_domain_match(struct irq_domain *d, struct device_node *np) { - return h->of_node != NULL && h->of_node == np; + return d->of_node != NULL && d->of_node == np; } /** @@ -31,8 +31,8 @@ static int default_irq_host_match(struct irq_domain *h, struct device_node *np) * @of_node: optional device-tree node of the interrupt controller * @revmap_type: type of reverse mapping to use * @revmap_arg: for IRQ_DOMAIN_MAP_LINEAR linear only: size of the map - * @ops: map/unmap host callbacks - * @inval_irq: provide a hw number in that host space that is always invalid + * @ops: map/unmap domain callbacks + * @inval_irq: provide a hw number in that domain space that is always invalid * * Allocates and initialize and irq_domain structure. Note that in the case of * IRQ_DOMAIN_MAP_LEGACY, the map() callback will be called before this returns @@ -48,7 +48,7 @@ struct irq_domain *irq_alloc_host(struct device_node *of_node, struct irq_domain_ops *ops, irq_hw_number_t inval_irq) { - struct irq_domain *host, *h; + struct irq_domain *domain, *h; unsigned int size = sizeof(struct irq_domain); unsigned int i; unsigned int *rmap; @@ -56,18 +56,18 @@ struct irq_domain *irq_alloc_host(struct device_node *of_node, /* Allocate structure and revmap table if using linear mapping */ if (revmap_type == IRQ_DOMAIN_MAP_LINEAR) size += revmap_arg * sizeof(unsigned int); - host = kzalloc(size, GFP_KERNEL); - if (host == NULL) + domain = kzalloc(size, GFP_KERNEL); + if (domain == NULL) return NULL; /* Fill structure */ - host->revmap_type = revmap_type; - host->inval_irq = inval_irq; - host->ops = ops; - host->of_node = of_node_get(of_node); + domain->revmap_type = revmap_type; + domain->inval_irq = inval_irq; + domain->ops = ops; + domain->of_node = of_node_get(of_node); - if (host->ops->match == NULL) - host->ops->match = default_irq_host_match; + if (domain->ops->match == NULL) + domain->ops->match = default_irq_domain_match; mutex_lock(&irq_domain_mutex); /* Make sure only one legacy controller can be created */ @@ -75,53 +75,53 @@ struct irq_domain *irq_alloc_host(struct device_node *of_node, list_for_each_entry(h, &irq_domain_list, link) { if (WARN_ON(h->revmap_type == IRQ_DOMAIN_MAP_LEGACY)) { mutex_unlock(&irq_domain_mutex); - of_node_put(host->of_node); - kfree(host); + of_node_put(domain->of_node); + kfree(domain); return NULL; } } } - list_add(&host->link, &irq_domain_list); + list_add(&domain->link, &irq_domain_list); mutex_unlock(&irq_domain_mutex); /* Additional setups per revmap type */ switch(revmap_type) { case IRQ_DOMAIN_MAP_LEGACY: /* 0 is always the invalid number for legacy */ - host->inval_irq = 0; - /* setup us as the host for all legacy interrupts */ + domain->inval_irq = 0; + /* setup us as the domain for all legacy interrupts */ for (i = 1; i < NUM_ISA_INTERRUPTS; i++) { struct irq_data *irq_data = irq_get_irq_data(i); irq_data->hwirq = i; - irq_data->domain = host; + irq_data->domain = domain; /* Legacy flags are left to default at this point, * one can then use irq_create_mapping() to * explicitly change them */ - ops->map(host, i, i); + ops->map(domain, i, i);
[PATCH v5 12/27] irq_domain: Add support for base irq and hwirq in legacy mappings
Add support for a legacy mapping where irq = (hwirq - first_hwirq + first_irq) so that a controller driver can allocate a fixed range of irq_descs and use a simple calculation to translate back and forth between linux and hw irq numbers. This is needed to use an irq_domain with many of the ARM interrupt controller drivers that manage their own irq_desc allocations. Ultimately the goal is to migrate those drivers to use the linear revmap, but doing it this way allows each driver to be converted separately which makes the migration path easier. This patch generalizes the IRQ_DOMAIN_MAP_LEGACY method to use (first_irq-first_hwirq) as the offset between hwirq and linux irq number, and adds checks to make sure that the hwirq number does not exceed range assigned to the controller. Signed-off-by: Grant Likely Cc: Rob Herring Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/include/asm/irq.h |3 - arch/powerpc/sysdev/i8259.c |2 +- arch/powerpc/sysdev/tsi108_pci.c |2 +- include/linux/irqdomain.h| 20 - kernel/irq/irqdomain.c | 96 +- 5 files changed, 85 insertions(+), 38 deletions(-) diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index 728cc30..fe0b09d 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h @@ -36,9 +36,6 @@ extern atomic_t ppc_n_lost_interrupts; /* Total number of virq in the platform */ #define NR_IRQSCONFIG_NR_IRQS -/* Number of irqs reserved for the legacy controller */ -#define NUM_ISA_INTERRUPTS 16 - /* Same thing, used by the generic IRQ code */ #define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c index 573a73b..997df6a 100644 --- a/arch/powerpc/sysdev/i8259.c +++ b/arch/powerpc/sysdev/i8259.c @@ -263,7 +263,7 @@ void i8259_init(struct device_node *node, unsigned long intack_addr) raw_spin_unlock_irqrestore(&i8259_lock, flags); /* create a legacy host */ - i8259_host = irq_domain_add_legacy(node, &i8259_host_ops, NULL); + i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL); if (i8259_host == NULL) { printk(KERN_ERR "i8259: failed to allocate irq host !\n"); return; diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c index 1be26f4..188012c 100644 --- a/arch/powerpc/sysdev/tsi108_pci.c +++ b/arch/powerpc/sysdev/tsi108_pci.c @@ -419,7 +419,7 @@ void __init tsi108_pci_int_init(struct device_node *node) { DBG("Tsi108_pci_int_init: initializing PCI interrupts\n"); - pci_irq_host = irq_domain_add_legacy(node, &pci_irq_domain_ops, NULL); + pci_irq_host = irq_domain_add_legacy_isa(node, &pci_irq_domain_ops, NULL); if (pci_irq_host == NULL) { printk(KERN_ERR "pci_irq_host: failed to allocate irq domain!\n"); return; diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index f95553f..7fef39e 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -39,6 +39,9 @@ struct device_node; struct irq_domain; struct of_device_id; +/* Number of irqs reserved for a legacy isa controller */ +#define NUM_ISA_INTERRUPTS 16 + /* This type is the placeholder for a hardware interrupt number. It has to * be big enough to enclose whatever representation is used by a given * platform. @@ -98,6 +101,11 @@ struct irq_domain { union { struct { unsigned int size; + unsigned int first_irq; + irq_hw_number_t first_hwirq; + } legacy; + struct { + unsigned int size; unsigned int *revmap; } linear; struct radix_tree_root tree; @@ -117,6 +125,9 @@ struct irq_domain { #ifdef CONFIG_IRQ_DOMAIN #ifdef CONFIG_PPC struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, +unsigned int size, +unsigned int first_irq, +irq_hw_number_t first_hwirq, struct irq_domain_ops *ops, void *host_data); struct irq_domain *irq_domain_add_linear(struct device_node *of_node, @@ -130,11 +141,18 @@ struct irq_domain *irq_domain_add_tree(struct device_node *of_node, struct irq_domain_ops *ops, void *host_data); - extern struct irq_domain *irq_find_host(struct device_node *node); extern void irq_set_default_host(struct irq_domain *host); extern void irq_set_virq_count(unsigned int count); +static inline struct irq_domain *irq_domain_add
[PATCH v5 07/27] irq_domain/powerpc: Eliminate virq_is_host()
There is only one user, and it is trivial to open-code. Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Thomas Gleixner Cc: Milton Miller Tested-by: Olof Johansson --- arch/powerpc/include/asm/irq.h |1 - arch/powerpc/kernel/irq.c |7 --- arch/powerpc/sysdev/xics/xics-common.c | 12 ++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h index abdd7ef..f80f262 100644 --- a/arch/powerpc/include/asm/irq.h +++ b/arch/powerpc/include/asm/irq.h @@ -58,7 +58,6 @@ extern atomic_t ppc_n_lost_interrupts; struct irq_data; extern irq_hw_number_t irqd_to_hwirq(struct irq_data *d); extern irq_hw_number_t virq_to_hw(unsigned int virq); -extern bool virq_is_host(unsigned int virq, struct irq_domain *host); /** * irq_alloc_host - Allocate a new irq_domain data structure diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 03c95f0..269fbd5 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -510,13 +510,6 @@ irq_hw_number_t virq_to_hw(unsigned int virq) } EXPORT_SYMBOL_GPL(virq_to_hw); -bool virq_is_host(unsigned int virq, struct irq_domain *host) -{ - struct irq_data *irq_data = irq_get_irq_data(virq); - return irq_data ? irq_data->domain == host : false; -} -EXPORT_SYMBOL_GPL(virq_is_host); - static int default_irq_host_match(struct irq_domain *h, struct device_node *np) { return h->of_node != NULL && h->of_node == np; diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c index c4b3ce1..fb2e303 100644 --- a/arch/powerpc/sysdev/xics/xics-common.c +++ b/arch/powerpc/sysdev/xics/xics-common.c @@ -212,16 +212,16 @@ void xics_migrate_irqs_away(void) /* We can't set affinity on ISA interrupts */ if (virq < NUM_ISA_INTERRUPTS) continue; - if (!virq_is_host(virq, xics_host)) - continue; - irq = (unsigned int)virq_to_hw(virq); - /* We need to get IPIs still. */ - if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) - continue; desc = irq_to_desc(virq); /* We only need to migrate enabled IRQS */ if (!desc || !desc->action) continue; + if (desc->irq_data.domain != xics_host) + continue; + irq = desc->irq_data.hwirq; + /* We need to get IPIs still. */ + if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) + continue; chip = irq_desc_get_chip(desc); if (!chip || !chip->irq_set_affinity) continue; -- 1.7.9 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev