* Re: [PATCH v5 5/5] powerpc/85xx: add support to JOG feature using cpufreq interface
From: Zhao Chenhui @ 2012-06-05 10:59 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <4FC950AF.90007@freescale.com>
On Fri, Jun 01, 2012 at 06:30:55PM -0500, Scott Wood wrote:
> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
> > Some 85xx silicons like MPC8536 and P1022 have a JOG feature, which provides
> > a dynamic mechanism to lower or raise the CPU core clock at runtime.
>
> Is there a reason P1023 isn't supported?
P1023 support is deferred.
>
> > This patch adds the support to change CPU frequency using the standard
> > cpufreq interface. The ratio CORE to CCB can be 1:1(except MPC8536), 3:2,
> > 2:1, 5:2, 3:1, 7:2 and 4:1.
> >
> > Two CPU cores on P1022 must not in the low power state during the frequency
> > transition. The driver uses a atomic counter to meet the requirement.
> >
> > The jog mode frequency transition process on the MPC8536 is similar to
> > the deep sleep process. The driver need save the CPU state and restore
> > it after CPU warm reset.
> >
> > Note:
> > * The I/O peripherals such as PCIe and eTSEC may lose packets during
> > the jog mode frequency transition.
>
> That might be acceptable for eTSEC, but it is not acceptable to lose
> anything on PCIe. Especially not if you're going to make this "default y".
It is a hardware limitation. Peripherals in the platform will not be operating
during the jog mode frequency transition process.
I can make it "default n".
>
>
> > +static int mpc85xx_job_probe(struct platform_device *ofdev)
>
> Job?
Sorry, It should be "jog".
>
> > +{
> > + struct device_node *np = ofdev->dev.of_node;
> > + unsigned int svr;
> > +
> > + if (of_device_is_compatible(np, "fsl,mpc8536-guts")) {
> > + svr = mfspr(SPRN_SVR);
> > + if ((svr & 0x7fff) == 0x10) {
> > + pr_err("MPC8536 Rev 1.0 do not support JOG.\n");
> > + return -ENODEV;
> > + }
>
> s/do not support JOG/does not support cpufreq/
>
> > + mpc85xx_freqs = mpc8536_freqs_table;
> > + set_pll = mpc8536_set_pll;
> > + } else if (of_device_is_compatible(np, "fsl,p1022-guts")) {
> > + mpc85xx_freqs = p1022_freqs_table;
> > + set_pll = p1022_set_pll;
> > + } else {
> > + return -ENODEV;
> > + }
> > +
> > + sysfreq = fsl_get_sys_freq();
> > +
> > + guts = of_iomap(np, 0);
> > + if (!guts)
> > + return -ENODEV;
> > +
> > + max_pll[0] = get_pll(0);
> > + if (mpc85xx_freqs == p1022_freqs_table)
> > + max_pll[1] = get_pll(1);
> > +
> > + pr_info("Freescale MPC85xx CPU frequency switching(JOG) driver\n");
> > +
> > + return cpufreq_register_driver(&mpc85xx_cpufreq_driver);
> > +}
> > +
> > +static int mpc85xx_jog_remove(struct platform_device *ofdev)
> > +{
> > + iounmap(guts);
> > + cpufreq_unregister_driver(&mpc85xx_cpufreq_driver);
> > +
> > + return 0;
> > +}
> > +
> > +static struct of_device_id mpc85xx_jog_ids[] = {
> > + { .compatible = "fsl,mpc8536-guts", },
> > + { .compatible = "fsl,p1022-guts", },
> > + {}
> > +};
> > +
> > +static struct platform_driver mpc85xx_jog_driver = {
> > + .driver = {
> > + .name = "mpc85xx_cpufreq_jog",
> > + .owner = THIS_MODULE,
> > + .of_match_table = mpc85xx_jog_ids,
> > + },
> > + .probe = mpc85xx_job_probe,
> > + .remove = mpc85xx_jog_remove,
> > +};
>
> Why is this a separate driver from fsl_pmc.c?
>
> Only one driver can bind to a node through normal mechanisms -- you
> don't get to take the entire guts node for this.
You are right. I will not bind this to the guts node.
>
> > +static int __init mpc85xx_jog_init(void)
> > +{
> > + return platform_driver_register(&mpc85xx_jog_driver);
> > +}
> > +
> > +static void __exit mpc85xx_jog_exit(void)
> > +{
> > + platform_driver_unregister(&mpc85xx_jog_driver);
> > +}
> > +
> > +module_init(mpc85xx_jog_init);
> > +module_exit(mpc85xx_jog_exit);
> > +
> > +MODULE_LICENSE("GPL");
> > +MODULE_AUTHOR("Dave Liu <daveliu@freescale.com>");
> > diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
> > index a35ca44..445bedd 100644
> > --- a/arch/powerpc/platforms/Kconfig
> > +++ b/arch/powerpc/platforms/Kconfig
> > @@ -204,6 +204,17 @@ config CPU_FREQ_PMAC64
> > This adds support for frequency switching on Apple iMac G5,
> > and some of the more recent desktop G5 machines as well.
> >
> > +config MPC85xx_CPUFREQ
> > + bool "Support for Freescale MPC85xx CPU freq"
> > + depends on PPC_85xx && PPC32 && !PPC_E500MC
>
> PPC32 is redundant given the !PPC_E500MC.
Yes.
>
> > index 8976534..401cac0 100644
> > --- a/arch/powerpc/sysdev/fsl_soc.h
> > +++ b/arch/powerpc/sysdev/fsl_soc.h
> > @@ -62,5 +62,10 @@ void fsl_hv_halt(void);
> > * code can be compatible with both 32-bit & 36-bit.
> > */
> > extern void mpc85xx_enter_deep_sleep(u64 ccsrbar, u32 powmgtreq);
> > +
> > +static inline void mpc85xx_enter_jog(u64 ccsrbar, u32 powmgtreq)
> > +{
> > + mpc85xx_enter_deep_sleep(ccsrbar, powmgtreq);
> > +}
>
> What value is this function adding over mpc85xx_enter_deep_sleep()?
Just an alias name. If this is improper, I could use mpc85xx_enter_deep_sleep() directly.
-Chenhui
^ permalink raw reply
* Re: [PATCH v5 2/5] powerpc/85xx: add HOTPLUG_CPU support
From: Zhao Chenhui @ 2012-06-05 11:18 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <4FCCE32F.1060301@freescale.com>
On Mon, Jun 04, 2012 at 11:32:47AM -0500, Scott Wood wrote:
> On 06/04/2012 06:04 AM, Zhao Chenhui wrote:
> > On Fri, Jun 01, 2012 at 04:27:27PM -0500, Scott Wood wrote:
> >> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
> >>> -#ifdef CONFIG_KEXEC
> >>> +#if defined(CONFIG_KEXEC) || defined(CONFIG_HOTPLUG_CPU)
> >>
> >> Let's not grow lists like this. Is there any harm in building it
> >> unconditionally?
> >>
> >> -Scott
> >
> > We need this ifdef. We only set give_timebase/take_timebase
> > when CONFIG_KEXEC or CONFIG_HOTPLUG_CPU is defined.
>
> If we really need this to be a compile-time decision, make a new symbol
> for it, but I really think this should be decided at runtime. Just
> because we have kexec or hotplug support enabled doesn't mean that's
> actually what we're doing at the moment.
>
> -Scott
If user does not enable kexec or hotplug, these codes are redundant.
So use CONFIG_KEXEC and CONFIG_HOTPLUG_CPU to gard them.
-Chenhui
^ permalink raw reply
* Re: kernel panic during kernel module load (powerpc specific part)
From: Gabriel Paubert @ 2012-06-05 11:32 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Wrobel Heinz-R39252, Michael Ellerman, Steffen Rumler,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <1338847242.7150.83.camel@pasglop>
On Tue, Jun 05, 2012 at 08:00:42AM +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2012-06-04 at 13:03 +0200, Gabriel Paubert wrote:
> > There is no conflict to the ABI. These functions are supposed to be
> > directly reachable from whatever code
> > section may need them.
> >
> > Now I have a question: how did you get the need for this?
> >
> > None of my kernels uses them:
> > - if I compile with -O2, the compiler simply expands epilogue and
> > prologue to series of lwz and stw
> > - if I compile with -Os, the compiler generates lmw/stmw which give
> > the smallest possible cache footprint
> >
> > Neither did I find a single reference to these functions in several
> > systems that I grepped for.
>
> Newer gcc's ... even worse, with -Os, it does it for a single register
> spill afaik. At least that's how I hit it with grub2 using whatever gcc
> is in fc17.
Well, I've not yet been able to make it call the save/restore routines,
but here on a machine with Debian testing and several gcc installed:
- gcc-4.4 never generates lmw/stmw, it always uses individual
lwz/stw whatever options are set (-Os -mmultiple).
- gcc-4.6 and gcc-4.7 behave identically, if -Os is set, they
generate by default lmw/stmw. But if I combine -Os with
-mno-multiple, they call the helper functions.
In other words, on this system, gcc-4.4 is broken but should not
cause any harm. gcc-4.6 and gcc-4.7 look correct, but are there
any processors on which -mno-multiple is worth setting?
Regards,
Gabriel
^ permalink raw reply
* Re: [PATCH v5 3/5] powerpc/85xx: add sleep and deep sleep support
From: Zhao Chenhui @ 2012-06-05 11:35 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <4FCD3D9E.9010509@freescale.com>
On Mon, Jun 04, 2012 at 05:58:38PM -0500, Scott Wood wrote:
> On 06/04/2012 06:12 AM, Zhao Chenhui wrote:
> > On Fri, Jun 01, 2012 at 04:54:35PM -0500, Scott Wood wrote:
> >> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
> >>> diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
> >>> index 94ec20a..baa000c 100644
> >>> --- a/arch/powerpc/include/asm/cacheflush.h
> >>> +++ b/arch/powerpc/include/asm/cacheflush.h
> >>> @@ -33,6 +33,11 @@ extern void flush_dcache_page(struct page *page);
> >>> #if defined(CONFIG_FSL_BOOKE) || defined(CONFIG_6xx)
> >>> extern void __flush_disable_L1(void);
> >>> #endif
> >>> +#if defined(CONFIG_FSL_BOOKE)
> >>> +extern void flush_dcache_L1(void);
> >>> +#else
> >>> +#define flush_dcache_L1() do { } while (0)
> >>> +#endif
> >>
> >> It doesn't seem right to no-op this on other platforms.
> >
> > The pmc_suspend_enter() in fsl_pmc.c used by mpc85xx and mpc86xx,
> > but flush_dcache_L1() have no definition in mpc86xx platform.
> > I will write flush_dcache_L1() for mpc86xx platform.
>
> How about only calling the function when it's needed? If we didn't need
> an L1 flush here on 86xx before, why do we need it now?
How about using CONFIG_PPC_85xx to gard it, like this.
case PM_SUSPEND_STANDBY:
local_irq_disable();
#ifdef CONFIG_PPC_85xx
flush_dcache_L1();
#endif
setbits32(&pmc_regs->powmgtcsr, POWMGTCSR_SLP);
>
> >>> extern void __flush_icache_range(unsigned long, unsigned long);
> >>> static inline void flush_icache_range(unsigned long start, unsigned long stop)
> >>> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> >>> index f5808a3..cb70dba 100644
> >>> --- a/arch/powerpc/kernel/Makefile
> >>> +++ b/arch/powerpc/kernel/Makefile
> >>> @@ -64,6 +64,9 @@ obj-$(CONFIG_FA_DUMP) += fadump.o
> >>> ifeq ($(CONFIG_PPC32),y)
> >>> obj-$(CONFIG_E500) += idle_e500.o
> >>> endif
> >>> +ifneq ($(CONFIG_PPC_E500MC),y)
> >>> +obj-$(CONFIG_PPC_85xx) += l2cache_85xx.o
> >>> +endif
> >>
> >> Can we introduce a symbol that specifically means pre-e500mc e500,
> >> rather than using negative logic?
> >>
> >> I think something like CONFIG_PPC_E500_V1_V2 has been proposed before.
> >
> > Agree. But CONFIG_PPC_E500_V1_V2 haven't been merged.
>
> Has the concept been NACKed, or just forgotten? If the latter, you
> could include it in this patchset.
>
> -Scott
In patchwork, it's state is "Superseded".
http://patchwork.ozlabs.org/patch/124284/
-Chenhui
^ permalink raw reply
* [PATCH] powerpc: Fix assmption of end_of_DRAM() returns end address
From: Bharat Bhushan @ 2012-06-05 13:55 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel, galak, benh; +Cc: Bharat Bhushan
memblock_end_of_DRAM() returns end_address + 1, not end address.
While some code assumes that it returns end address.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
This patch is based on next branch of https://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
arch/powerpc/platforms/44x/currituck.c | 2 +-
arch/powerpc/platforms/85xx/corenet_ds.c | 2 +-
arch/powerpc/platforms/85xx/ge_imp3a.c | 2 +-
arch/powerpc/platforms/85xx/mpc8536_ds.c | 2 +-
arch/powerpc/platforms/85xx/mpc85xx_ds.c | 2 +-
arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 +-
arch/powerpc/platforms/85xx/p1022_ds.c | 2 +-
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
index 583e67f..9f6c33d 100644
--- a/arch/powerpc/platforms/44x/currituck.c
+++ b/arch/powerpc/platforms/44x/currituck.c
@@ -160,7 +160,7 @@ static void __init ppc47x_setup_arch(void)
/* No need to check the DMA config as we /know/ our windows are all of
* RAM. Lets hope that doesn't change */
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > 0xffffffff) {
+ if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
index dd3617c..925b028 100644
--- a/arch/powerpc/platforms/85xx/corenet_ds.c
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -77,7 +77,7 @@ void __init corenet_ds_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
index 1801462..b6a728b 100644
--- a/arch/powerpc/platforms/85xx/ge_imp3a.c
+++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
@@ -125,7 +125,7 @@ static void __init ge_imp3a_setup_arch(void)
mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 585bd22..767c7cf 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -75,7 +75,7 @@ static void __init mpc8536_ds_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 1fd91e9..d30f6c4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -173,7 +173,7 @@ static void __init mpc85xx_ds_setup_arch(void)
mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index d208ebc..8e4b094 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -359,7 +359,7 @@ static void __init mpc85xx_mds_setup_arch(void)
mpc85xx_mds_qe_init();
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
index f700c81..74e310b 100644
--- a/arch/powerpc/platforms/85xx/p1022_ds.c
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -450,7 +450,7 @@ static void __init p1022_ds_setup_arch(void)
mpc85xx_smp_init();
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 3755e61..817245b 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -102,7 +102,7 @@ mpc86xx_hpcn_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
- if (memblock_end_of_DRAM() > max) {
+ if ((memblock_end_of_DRAM() - 1) > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH v5 5/5] powerpc/85xx: add support to JOG feature using cpufreq interface
From: Scott Wood @ 2012-06-05 15:58 UTC (permalink / raw)
To: Zhao Chenhui; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20120605105929.GA22427@localhost.localdomain>
On 06/05/2012 05:59 AM, Zhao Chenhui wrote:
> On Fri, Jun 01, 2012 at 06:30:55PM -0500, Scott Wood wrote:
>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>> The jog mode frequency transition process on the MPC8536 is similar to
>>> the deep sleep process. The driver need save the CPU state and restore
>>> it after CPU warm reset.
>>>
>>> Note:
>>> * The I/O peripherals such as PCIe and eTSEC may lose packets during
>>> the jog mode frequency transition.
>>
>> That might be acceptable for eTSEC, but it is not acceptable to lose
>> anything on PCIe. Especially not if you're going to make this "default y".
>
> It is a hardware limitation.
Then make sure jog isn't used if PCIe is used.
Maybe you could do something with the suspend infrastructure, but this
is sufficiently heavyweight that transitions should be manually
requested, not triggered by the automatic cpufreq governor.
Does this apply to p1022, or just mpc8536?
> Peripherals in the platform will not be operating
> during the jog mode frequency transition process.
What ensures this?
-Scott
^ permalink raw reply
* Re: [PATCH v5 1/5] powerpc/85xx: implement hardware timebase sync
From: Scott Wood @ 2012-06-05 16:07 UTC (permalink / raw)
To: Zhao Chenhui; +Cc: Matthew McClintock, linuxppc-dev, linux-kernel
In-Reply-To: <20120605090831.GA21929@localhost.localdomain>
On 06/05/2012 04:08 AM, Zhao Chenhui wrote:
> On Fri, Jun 01, 2012 at 10:40:00AM -0500, Scott Wood wrote:
>> I know you say this is for dual-core chips only, but it would be nice if
>> you'd write this in a way that doesn't assume that (even if the
>> corenet-specific timebase freezing comes later).
>
> At this point, I have not thought about how to implement the cornet-specific timebase freezing.
I wasn't asking you to. I was asking you to not have logic that breaks
with more than 2 CPUs.
>> Do we need an isync after setting the timebase, to ensure it's happened
>> before we enable the timebase? Likewise, do we need a readback after
>> disabling the timebase to ensure it's disabled before we read the
>> timebase in give_timebase?
>
> I checked the e500 core manual (Chapter 2.16 Synchronization Requirements for SPRs).
> Only some SPR registers need an isync. The timebase registers do not.
I don't trust that, and the consequences of having the sync be imperfect
are too unpleasant to chance it.
> I did a readback in mpc85xx_timebase_freeze().
Sorry, missed that somehow.
>>> +#ifdef CONFIG_KEXEC
>>> + np = of_find_matching_node(NULL, guts_ids);
>>> + if (np) {
>>> + guts = of_iomap(np, 0);
>>> + smp_85xx_ops.give_timebase = mpc85xx_give_timebase;
>>> + smp_85xx_ops.take_timebase = mpc85xx_take_timebase;
>>> + of_node_put(np);
>>> + } else {
>>> + smp_85xx_ops.give_timebase = smp_generic_give_timebase;
>>> + smp_85xx_ops.take_timebase = smp_generic_take_timebase;
>>> + }
>>
>> Do not use smp_generic_give/take_timebase, ever. If you don't have the
>> guts node, then just assume the timebase is already synced.
>>
>> -Scott
>
> smp_generic_give/take_timebase is the default in KEXEC before.
That was a mistake.
> If do not set them, it may make KEXEC fail on other platforms.
What platforms?
-Scott
^ permalink raw reply
* Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup event source
From: Scott Wood @ 2012-06-05 16:11 UTC (permalink / raw)
To: Li Yang-R58472
Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Zhao Chenhui-B35336
In-Reply-To: <94F013E7935FF44C83EBE7784D62AD3F09335D27@039-SN2MPN1-022.039d.mgd.msft.net>
On 06/04/2012 11:08 PM, Li Yang-R58472 wrote:
>
>
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Tuesday, June 05, 2012 7:03 AM
>> To: Zhao Chenhui-B35336
>> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
>> galak@kernel.crashing.org; Li Yang-R58472
>> Subject: Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup
>> event source
>>
>> On 06/04/2012 06:36 AM, Zhao Chenhui wrote:
>>> On Fri, Jun 01, 2012 at 05:08:52PM -0500, Scott Wood wrote:
>>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>>>> +int mpc85xx_pmc_set_wake(struct platform_device *pdev, bool enable)
>>>>
>>>> Why does it have to be a platform_device? Would a bare device_node
>> work
>>>> here? If it's for stuff like device_may_wakeup() that could be in a
>>>> platform_device wrapper function.
>>>
>>> It does not have to be a platform_device. I think it can be a struct
>> device.
>>
>> Why does it even need that? The low level mechanism for influencing
>> PMCDR should only need a device node, not a Linux device struct.
>
> It does no harm to pass the device structure and makes more sense for object oriented interface design.
It does do harm if you don't have a device structure to pass, if for
some reason you found the device by directly looking for it rather than
going through the device model.
>>>> Who is setting can_wakeup for these devices?
>>>
>>> The device driver is responsible to set can_wakeup.
>>
>> How would the device driver know how to set it? Wouldn't this depend on
>> the particular SoC and low power mode?
>
> It is based on the "fsl,magic-packet" and "fsl,wake-on-filer" device tree properties.
fsl,magic-packet was a mistake. It is equivalent to checking the
compatible for etsec. It does not convey any information about whether
the eTSEC is still active in a given low power mode.
How is fsl,wake-os-filer relevant to this decision? When will it be set
but not fsl,magic-packet?
What about devices other than ethernet? What about differences between
ordinary sleep and deep sleep?
-Scott
^ permalink raw reply
* Re: [PATCH v5 3/5] powerpc/85xx: add sleep and deep sleep support
From: Scott Wood @ 2012-06-05 16:13 UTC (permalink / raw)
To: Zhao Chenhui; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20120605113530.GC22427@localhost.localdomain>
On 06/05/2012 06:35 AM, Zhao Chenhui wrote:
> On Mon, Jun 04, 2012 at 05:58:38PM -0500, Scott Wood wrote:
>> On 06/04/2012 06:12 AM, Zhao Chenhui wrote:
>>> On Fri, Jun 01, 2012 at 04:54:35PM -0500, Scott Wood wrote:
>>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>>>> diff --git a/arch/powerpc/include/asm/cacheflush.h b/arch/powerpc/include/asm/cacheflush.h
>>>>> index 94ec20a..baa000c 100644
>>>>> --- a/arch/powerpc/include/asm/cacheflush.h
>>>>> +++ b/arch/powerpc/include/asm/cacheflush.h
>>>>> @@ -33,6 +33,11 @@ extern void flush_dcache_page(struct page *page);
>>>>> #if defined(CONFIG_FSL_BOOKE) || defined(CONFIG_6xx)
>>>>> extern void __flush_disable_L1(void);
>>>>> #endif
>>>>> +#if defined(CONFIG_FSL_BOOKE)
>>>>> +extern void flush_dcache_L1(void);
>>>>> +#else
>>>>> +#define flush_dcache_L1() do { } while (0)
>>>>> +#endif
>>>>
>>>> It doesn't seem right to no-op this on other platforms.
>>>
>>> The pmc_suspend_enter() in fsl_pmc.c used by mpc85xx and mpc86xx,
>>> but flush_dcache_L1() have no definition in mpc86xx platform.
>>> I will write flush_dcache_L1() for mpc86xx platform.
>>
>> How about only calling the function when it's needed? If we didn't need
>> an L1 flush here on 86xx before, why do we need it now?
>
> How about using CONFIG_PPC_85xx to gard it, like this.
>
> case PM_SUSPEND_STANDBY:
> local_irq_disable();
> #ifdef CONFIG_PPC_85xx
> flush_dcache_L1();
> #endif
> setbits32(&pmc_regs->powmgtcsr, POWMGTCSR_SLP);
We don't support building 85xx/86xx in the same kernel and likely never
will, so this is OK.
>>>> Can we introduce a symbol that specifically means pre-e500mc e500,
>>>> rather than using negative logic?
>>>>
>>>> I think something like CONFIG_PPC_E500_V1_V2 has been proposed before.
>>>
>>> Agree. But CONFIG_PPC_E500_V1_V2 haven't been merged.
>>
>> Has the concept been NACKed, or just forgotten? If the latter, you
>> could include it in this patchset.
>>
>> -Scott
>
> In patchwork, it's state is "Superseded".
> http://patchwork.ozlabs.org/patch/124284/
I still think there's value in adding such a symbol.
-Scott
^ permalink raw reply
* Re: [PATCH v5 2/5] powerpc/85xx: add HOTPLUG_CPU support
From: Scott Wood @ 2012-06-05 16:15 UTC (permalink / raw)
To: Zhao Chenhui; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20120605111823.GB22427@localhost.localdomain>
On 06/05/2012 06:18 AM, Zhao Chenhui wrote:
> On Mon, Jun 04, 2012 at 11:32:47AM -0500, Scott Wood wrote:
>> On 06/04/2012 06:04 AM, Zhao Chenhui wrote:
>>> On Fri, Jun 01, 2012 at 04:27:27PM -0500, Scott Wood wrote:
>>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>>>> -#ifdef CONFIG_KEXEC
>>>>> +#if defined(CONFIG_KEXEC) || defined(CONFIG_HOTPLUG_CPU)
>>>>
>>>> Let's not grow lists like this. Is there any harm in building it
>>>> unconditionally?
>>>>
>>>> -Scott
>>>
>>> We need this ifdef. We only set give_timebase/take_timebase
>>> when CONFIG_KEXEC or CONFIG_HOTPLUG_CPU is defined.
>>
>> If we really need this to be a compile-time decision, make a new symbol
>> for it, but I really think this should be decided at runtime. Just
>> because we have kexec or hotplug support enabled doesn't mean that's
>> actually what we're doing at the moment.
>>
>> -Scott
>
> If user does not enable kexec or hotplug, these codes are redundant.
> So use CONFIG_KEXEC and CONFIG_HOTPLUG_CPU to gard them.
My point is that these lists tend to grow and be a maintenance pain.
For small things it's often better to not worry about saving a few
bytes. For larger things that need to be conditional, define a new
symbol rather than growing ORed lists like this.
-Scott
^ permalink raw reply
* RE: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup event source
From: Li Yang-R58472 @ 2012-06-05 16:49 UTC (permalink / raw)
To: Wood Scott-B07421
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
Zhao Chenhui-B35336
In-Reply-To: <4FCE2FB8.9080307@freescale.com>
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, June 06, 2012 12:12 AM
> To: Li Yang-R58472
> Cc: Wood Scott-B07421; Zhao Chenhui-B35336; linuxppc-dev@lists.ozlabs.org=
;
> linux-kernel@vger.kernel.org; galak@kernel.crashing.org
> Subject: Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup
> event source
>=20
> On 06/04/2012 11:08 PM, Li Yang-R58472 wrote:
> >
> >
> >> -----Original Message-----
> >> From: Wood Scott-B07421
> >> Sent: Tuesday, June 05, 2012 7:03 AM
> >> To: Zhao Chenhui-B35336
> >> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
> >> galak@kernel.crashing.org; Li Yang-R58472
> >> Subject: Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as
> >> wakeup event source
> >>
> >> On 06/04/2012 06:36 AM, Zhao Chenhui wrote:
> >>> On Fri, Jun 01, 2012 at 05:08:52PM -0500, Scott Wood wrote:
> >>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
> >>>>> +int mpc85xx_pmc_set_wake(struct platform_device *pdev, bool
> >>>>> +enable)
> >>>>
> >>>> Why does it have to be a platform_device? Would a bare device_node
> >> work
> >>>> here? If it's for stuff like device_may_wakeup() that could be in
> >>>> a platform_device wrapper function.
> >>>
> >>> It does not have to be a platform_device. I think it can be a struct
> >> device.
> >>
> >> Why does it even need that? The low level mechanism for influencing
> >> PMCDR should only need a device node, not a Linux device struct.
> >
> > It does no harm to pass the device structure and makes more sense for
> object oriented interface design.
>=20
> It does do harm if you don't have a device structure to pass, if for some
> reason you found the device by directly looking for it rather than going
> through the device model.
Whether or not a device is a wakeup source not only depends on the SoC spec=
ification but also the configuration and current state for the device. I o=
nly expect the device driver to have this knowledge and call this function =
rather than some standalone platform code. Therefore I don't think your co=
ncern matters.
=20
>=20
> >>>> Who is setting can_wakeup for these devices?
> >>>
> >>> The device driver is responsible to set can_wakeup.
> >>
> >> How would the device driver know how to set it? Wouldn't this depend
> >> on the particular SoC and low power mode?
> >
> > It is based on the "fsl,magic-packet" and "fsl,wake-on-filer" device
> tree properties.
>=20
> fsl,magic-packet was a mistake. It is equivalent to checking the
> compatible for etsec. It does not convey any information about whether
It can be described either by explicit feature property or by the compatibl=
e. I don't think it is a problem that we choose one against another.
> the eTSEC is still active in a given low power mode.
Whether or not the eTSEC is still active in both sleep and deep sleep is on=
ly depending on if we set it to be a wakeup source. If it behaves differen=
tly for low power modes in the future, we could address that by adding addi=
tional property.
>=20
> How is fsl,wake-os-filer relevant to this decision? When will it be set
> but not fsl,magic-packet?
I mean either fsl,magic-packet or fsl,wake-on-filer shows it can be a wakeu=
p source. Currently we don't have an SoC to have wake-on-filer while not w=
ake-on-magic. But I think it's better to consider both as they are indepen=
dent features.
>=20
> What about devices other than ethernet? What about differences between
> ordinary sleep and deep sleep?
There is no difference for sleep and deep sleep for all wakeup sources curr=
ently. We can address the problem if it is not the case in the future.
Leo
^ permalink raw reply
* Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup event source
From: Scott Wood @ 2012-06-05 18:05 UTC (permalink / raw)
To: Li Yang-R58472
Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org, Zhao Chenhui-B35336
In-Reply-To: <94F013E7935FF44C83EBE7784D62AD3F093360C1@039-SN2MPN1-022.039d.mgd.msft.net>
On 06/05/2012 11:49 AM, Li Yang-R58472 wrote:
>
>
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Wednesday, June 06, 2012 12:12 AM
>> To: Li Yang-R58472
>> Cc: Wood Scott-B07421; Zhao Chenhui-B35336; linuxppc-dev@lists.ozlabs.org;
>> linux-kernel@vger.kernel.org; galak@kernel.crashing.org
>> Subject: Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup
>> event source
>>
>> On 06/04/2012 11:08 PM, Li Yang-R58472 wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Wood Scott-B07421
>>>> Sent: Tuesday, June 05, 2012 7:03 AM
>>>> To: Zhao Chenhui-B35336
>>>> Cc: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org;
>>>> galak@kernel.crashing.org; Li Yang-R58472
>>>> Subject: Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as
>>>> wakeup event source
>>>>
>>>> On 06/04/2012 06:36 AM, Zhao Chenhui wrote:
>>>>> On Fri, Jun 01, 2012 at 05:08:52PM -0500, Scott Wood wrote:
>>>>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>>>>>> +int mpc85xx_pmc_set_wake(struct platform_device *pdev, bool
>>>>>>> +enable)
>>>>>>
>>>>>> Why does it have to be a platform_device? Would a bare device_node
>>>> work
>>>>>> here? If it's for stuff like device_may_wakeup() that could be in
>>>>>> a platform_device wrapper function.
>>>>>
>>>>> It does not have to be a platform_device. I think it can be a struct
>>>> device.
>>>>
>>>> Why does it even need that? The low level mechanism for influencing
>>>> PMCDR should only need a device node, not a Linux device struct.
>>>
>>> It does no harm to pass the device structure and makes more sense for
>> object oriented interface design.
>>
>> It does do harm if you don't have a device structure to pass, if for some
>> reason you found the device by directly looking for it rather than going
>> through the device model.
>
> Whether or not a device is a wakeup source not only depends on the
> SoC specification but also the configuration and current state for
> the device. I only expect the device driver to have this knowledge
> and call this function rather than some standalone platform code.
> Therefore I don't think your concern matters.
First, I think it's bad API to force the passing of a higher level
object when a lower level object would suffice (and there are no
legitimate future-proofing or abstraction reasons for hiding the lower
level object).
But regardless, the entity you call a "device driver" may or may not use
the standard driver model (e.g. look at PCI root complexes), and your
assumption about what platform code knows may or may not be correct. I
could just as well say that only platform code knows about the SoC
clock/power routing during a given low power state.
>>>>>> Who is setting can_wakeup for these devices?
>>>>>
>>>>> The device driver is responsible to set can_wakeup.
>>>>
>>>> How would the device driver know how to set it? Wouldn't this depend
>>>> on the particular SoC and low power mode?
>>>
>>> It is based on the "fsl,magic-packet" and "fsl,wake-on-filer" device
>> tree properties.
>>
>> fsl,magic-packet was a mistake. It is equivalent to checking the
>> compatible for etsec. It does not convey any information about whether
>
> It can be described either by explicit feature property or by the
> compatible. I don't think it is a problem that we choose one against
> another.
I do think it's a problem, because it's unnecessarily complicated, and
more error prone (we probably didn't have fsl,magic-packet on all the
SoCs that support it before the .dtsi refactoring). But my point was
that it says nothing about whether the eTSEC will still be functioning
during a low power state.
>> the eTSEC is still active in a given low power mode.
>
> Whether or not the eTSEC is still active in both sleep and deep sleep
> is only depending on if we set it to be a wakeup source.
Only because we happen to support eTSEC as a wakeup source on all SoCs.
> If it behaves differently for low power modes in the future, we could
> address that by adding additional property.
>
>>
>> How is fsl,wake-os-filer relevant to this decision? When will it be set
>> but not fsl,magic-packet?
>
> I mean either fsl,magic-packet or fsl,wake-on-filer shows it can be a
> wakeup source. Currently we don't have an SoC to have wake-on-filer
> while not wake-on-magic. But I think it's better to consider both as
> they are independent features.
You're not willing to consider an SoC where waking on eTSEC is
unsupported, but you're willing to consider an eTSEC that has
wake-on-filer but magic packet support has for some reason been dropped?
>> What about devices other than ethernet? What about differences between
>> ordinary sleep and deep sleep?
>
> There is no difference for sleep and deep sleep for all wakeup sources currently.
I recall being able to wake an mpc85xx chip (maybe mpc8544?) from
ordinary sleep using the DUART (even though the manual suggests that
only external interrupts can be used -- not even eTSEC). You can't do
that in deep sleep.
You ignored "what about devices other than ethernet".
-Scott
^ permalink raw reply
* Access to http://ozlabs.org/people/dgibson/dldwd/
From: R.P. Burrasca @ 2012-06-05 13:27 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1.1: Type: text/plain, Size: 849 bytes --]
Would it be possible to access the above referenced webpage in order to see
what's available as the Orinoco & Prism 2 Wireless Driver?
I have wireless internet access using Ubuntu 10.10 for powerpc on my G3
iBook 500 Mhz dual usb machine while I'm at home but I don't have any
scanning capability and can't tell when I'm near a hotspot or whether are
wireless networks around me when I'm somewhere else. Unlike the case at
home, it doesn't automatically pickup and use the wireless signal coming
from some other hotspot.
I would very much like to use my iBook when I travel, but so far have been
unsuccessful in getting it to pickup a wireless signal anywhere other than
my home network.
Any access to the above site that you'd be willing to provide would be
greatly appreciated.
Thank you.
Sincerely,
Ray Burrasca
[-- Attachment #1.2: Type: text/html, Size: 6758 bytes --]
[-- Attachment #2: image001.gif --]
[-- Type: image/gif, Size: 2051 bytes --]
^ permalink raw reply
* [PATCH] perf: Don't use SIAR for user addresses
From: Sukadev Bhattiprolu @ 2012-06-05 20:32 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mpjohn, Anton Blanchard
From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Date: Fri, 1 Jun 2012 20:56:02 -0400
Subject: [PATCH] perf: Don't use SIAR for user-space addresses
With the pipelining on Power7, the SIAR can be off by several instructions
leading to incorrect callgraphs. For user space code at least we can be more
accurate by just using the next instruction pointer.
Based on code/input from Anton Blanchard.
Before this fon Power7, we see callgraphs like:
1.90% sprintft sprintft [.] do_my_sprintf
|
--- 00000011.plt_call.strlen@@GLIBC_2.3+0
do_my_sprintf
main
generic_start_main
__libc_start_main
(nil)
...snip...
|
--- __random
rand
|
|--63.16%-- do_my_sprintf
| main
| generic_start_main
| __libc_start_main
| (nil)
|
--36.84%-- rand
do_my_sprintf
main
generic_start_main
__libc_start_main
(nil)
which seems to indicate the libc __random() calls do_my_sprintf(), instead
of the other way around.
After the fix, the same trace looks like this:
4.08% sprintft sprintft [.] do_my_sprintf
|
--- do_my_sprintf
do_my_sprintf
main
generic_start_main
__libc_start_main
(nil)
Cc: Anton Blanchard <anton@samba.org>
Reported-by: Maynard Johnson <mpjohn@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
arch/powerpc/perf/core-book3s.c | 39 ++++++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 8f84bcb..846bd68 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -116,6 +116,26 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
*addrp = mfspr(SPRN_SDAR);
}
+static bool mmcra_sihv(unsigned long mmcra)
+{
+ unsigned long sihv = MMCRA_SIHV;
+
+ if (ppmu->flags & PPMU_ALT_SIPR)
+ sihv = POWER6_MMCRA_SIHV;
+
+ return !!(mmcra & sihv);
+}
+
+static bool mmcra_sipr(unsigned long mmcra)
+{
+ unsigned long sipr = MMCRA_SIPR;
+
+ if (ppmu->flags & PPMU_ALT_SIPR)
+ sipr = POWER6_MMCRA_SIPR;
+
+ return !!(mmcra & sipr);
+}
+
static inline u32 perf_flags_from_msr(struct pt_regs *regs)
{
if (regs->msr & MSR_PR)
@@ -128,8 +148,6 @@ static inline u32 perf_flags_from_msr(struct pt_regs *regs)
static inline u32 perf_get_misc_flags(struct pt_regs *regs)
{
unsigned long mmcra = regs->dsisr;
- unsigned long sihv = MMCRA_SIHV;
- unsigned long sipr = MMCRA_SIPR;
/* Not a PMU interrupt: Make up flags from regs->msr */
if (TRAP(regs) != 0xf00)
@@ -156,15 +174,10 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
return PERF_RECORD_MISC_USER;
}
- if (ppmu->flags & PPMU_ALT_SIPR) {
- sihv = POWER6_MMCRA_SIHV;
- sipr = POWER6_MMCRA_SIPR;
- }
-
/* PR has priority over HV, so order below is important */
- if (mmcra & sipr)
+ if (mmcra_sipr(mmcra))
return PERF_RECORD_MISC_USER;
- if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
+ if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV))
return PERF_RECORD_MISC_HYPERVISOR;
return PERF_RECORD_MISC_KERNEL;
}
@@ -1340,6 +1353,14 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
!(mmcra & MMCRA_SAMPLE_ENABLE))
return regs->nip;
+ /*
+ * With pipelining on P7, addresses in the SIAR can be off by several
+ * instructions. For user space use the next instruction pointer as
+ * that will be more accurate.
+ */
+ if (mmcra_sipr(mmcra))
+ return regs->nip;
+
return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
}
--
1.7.1
^ permalink raw reply related
* Re: kernel panic during kernel module load (powerpc specific part)
From: Benjamin Herrenschmidt @ 2012-06-05 22:14 UTC (permalink / raw)
To: Gabriel Paubert
Cc: Wrobel Heinz-R39252, Michael Ellerman, Steffen Rumler,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20120605113225.GA11215@visitor2.iram.es>
On Tue, 2012-06-05 at 13:32 +0200, Gabriel Paubert wrote:
> - gcc-4.6 and gcc-4.7 behave identically, if -Os is set, they
> generate by default lmw/stmw. But if I combine -Os with
> -mno-multiple, they call the helper functions.
>
> In other words, on this system, gcc-4.4 is broken but should not
> cause any harm. gcc-4.6 and gcc-4.7 look correct, but are there
> any processors on which -mno-multiple is worth setting?
It could be an artifact of the -mtune we use, dunno. And yes, I'm pretty
sure some embedded processors don't like multiple load/store.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] powerpc: Fix assmption of end_of_DRAM() returns end address
From: Benjamin Herrenschmidt @ 2012-06-05 22:17 UTC (permalink / raw)
To: Bharat Bhushan; +Cc: Bharat Bhushan, linuxppc-dev, linux-kernel
In-Reply-To: <1338904504-2750-1-git-send-email-bharat.bhushan@freescale.com>
On Tue, 2012-06-05 at 19:25 +0530, Bharat Bhushan wrote:
> memblock_end_of_DRAM() returns end_address + 1, not end address.
> While some code assumes that it returns end address.
Shouldn't we instead fix it the other way around ? IE, make
memblock_end_of_DRAM() does what the name implies, which is to return
the last byte of DRAM, and fix the -other- callers not to make bad
assumptions ?
Cheers,
Ben.
> Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
> ---
> This patch is based on next branch of https://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
>
> arch/powerpc/platforms/44x/currituck.c | 2 +-
> arch/powerpc/platforms/85xx/corenet_ds.c | 2 +-
> arch/powerpc/platforms/85xx/ge_imp3a.c | 2 +-
> arch/powerpc/platforms/85xx/mpc8536_ds.c | 2 +-
> arch/powerpc/platforms/85xx/mpc85xx_ds.c | 2 +-
> arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 +-
> arch/powerpc/platforms/85xx/p1022_ds.c | 2 +-
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 2 +-
> 8 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/arch/powerpc/platforms/44x/currituck.c b/arch/powerpc/platforms/44x/currituck.c
> index 583e67f..9f6c33d 100644
> --- a/arch/powerpc/platforms/44x/currituck.c
> +++ b/arch/powerpc/platforms/44x/currituck.c
> @@ -160,7 +160,7 @@ static void __init ppc47x_setup_arch(void)
> /* No need to check the DMA config as we /know/ our windows are all of
> * RAM. Lets hope that doesn't change */
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > 0xffffffff) {
> + if ((memblock_end_of_DRAM() - 1) > 0xffffffff) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
> index dd3617c..925b028 100644
> --- a/arch/powerpc/platforms/85xx/corenet_ds.c
> +++ b/arch/powerpc/platforms/85xx/corenet_ds.c
> @@ -77,7 +77,7 @@ void __init corenet_ds_setup_arch(void)
> #endif
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c
> index 1801462..b6a728b 100644
> --- a/arch/powerpc/platforms/85xx/ge_imp3a.c
> +++ b/arch/powerpc/platforms/85xx/ge_imp3a.c
> @@ -125,7 +125,7 @@ static void __init ge_imp3a_setup_arch(void)
> mpc85xx_smp_init();
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
> index 585bd22..767c7cf 100644
> --- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
> @@ -75,7 +75,7 @@ static void __init mpc8536_ds_setup_arch(void)
> #endif
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> index 1fd91e9..d30f6c4 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> @@ -173,7 +173,7 @@ static void __init mpc85xx_ds_setup_arch(void)
> mpc85xx_smp_init();
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> index d208ebc..8e4b094 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -359,7 +359,7 @@ static void __init mpc85xx_mds_setup_arch(void)
> mpc85xx_mds_qe_init();
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
> index f700c81..74e310b 100644
> --- a/arch/powerpc/platforms/85xx/p1022_ds.c
> +++ b/arch/powerpc/platforms/85xx/p1022_ds.c
> @@ -450,7 +450,7 @@ static void __init p1022_ds_setup_arch(void)
> mpc85xx_smp_init();
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> index 3755e61..817245b 100644
> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> @@ -102,7 +102,7 @@ mpc86xx_hpcn_setup_arch(void)
> #endif
>
> #ifdef CONFIG_SWIOTLB
> - if (memblock_end_of_DRAM() > max) {
> + if ((memblock_end_of_DRAM() - 1) > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
^ permalink raw reply
* Re: [PATCH] powerpc: Fix assmption of end_of_DRAM() returns end address
From: David Miller @ 2012-06-05 22:20 UTC (permalink / raw)
To: benh; +Cc: bharat.bhushan, linuxppc-dev, linux-kernel, r65777
In-Reply-To: <1338934659.7150.113.camel@pasglop>
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Wed, 06 Jun 2012 08:17:39 +1000
> On Tue, 2012-06-05 at 19:25 +0530, Bharat Bhushan wrote:
>> memblock_end_of_DRAM() returns end_address + 1, not end address.
>> While some code assumes that it returns end address.
>
> Shouldn't we instead fix it the other way around ? IE, make
> memblock_end_of_DRAM() does what the name implies, which is to return
> the last byte of DRAM, and fix the -other- callers not to make bad
> assumptions ?
That was my impression too when I saw this patch.
^ permalink raw reply
* Re: [PATCH] perf: Don't use SIAR for user addresses
From: Benjamin Herrenschmidt @ 2012-06-05 22:43 UTC (permalink / raw)
To: Sukadev Bhattiprolu; +Cc: mpjohn, linuxppc-dev, Anton Blanchard
In-Reply-To: <20120605203247.GA1525@us.ibm.com>
On Tue, 2012-06-05 at 13:32 -0700, Sukadev Bhattiprolu wrote:
> From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Date: Fri, 1 Jun 2012 20:56:02 -0400
> Subject: [PATCH] perf: Don't use SIAR for user-space addresses
>
> With the pipelining on Power7, the SIAR can be off by several instructions
> leading to incorrect callgraphs. For user space code at least we can be more
> accurate by just using the next instruction pointer.
>
> Based on code/input from Anton Blanchard.
Had a chat with him, we still want to use SIAR for marked events, which
I think off the top of my head is mmcra & MMCRA_SAMPLE_ENABLE.
There's a few more considerations we discussed, such as wanting also
more precise backtraces in kernel space, but still capture in pHyp when
SIHV is set and have maybe some kind of sysfs option to revert back to
SIAR kernel-wide if we are trying to track down hard irq off stuff.
I'll let Anton followup. I'm still technically not working for a couple
of weeks :-)
Cheers,
Ben.
> Before this fon Power7, we see callgraphs like:
>
> 1.90% sprintft sprintft [.] do_my_sprintf
> |
> --- 00000011.plt_call.strlen@@GLIBC_2.3+0
> do_my_sprintf
> main
> generic_start_main
> __libc_start_main
> (nil)
> ...snip...
>
> |
> --- __random
> rand
> |
> |--63.16%-- do_my_sprintf
> | main
> | generic_start_main
> | __libc_start_main
> | (nil)
> |
> --36.84%-- rand
> do_my_sprintf
> main
> generic_start_main
> __libc_start_main
> (nil)
>
> which seems to indicate the libc __random() calls do_my_sprintf(), instead
> of the other way around.
>
> After the fix, the same trace looks like this:
>
> 4.08% sprintft sprintft [.] do_my_sprintf
> |
> --- do_my_sprintf
> do_my_sprintf
> main
> generic_start_main
> __libc_start_main
> (nil)
>
> Cc: Anton Blanchard <anton@samba.org>
> Reported-by: Maynard Johnson <mpjohn@us.ibm.com>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
> arch/powerpc/perf/core-book3s.c | 39 ++++++++++++++++++++++++++++++---------
> 1 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 8f84bcb..846bd68 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -116,6 +116,26 @@ static inline void perf_get_data_addr(struct pt_regs *regs, u64 *addrp)
> *addrp = mfspr(SPRN_SDAR);
> }
>
> +static bool mmcra_sihv(unsigned long mmcra)
> +{
> + unsigned long sihv = MMCRA_SIHV;
> +
> + if (ppmu->flags & PPMU_ALT_SIPR)
> + sihv = POWER6_MMCRA_SIHV;
> +
> + return !!(mmcra & sihv);
> +}
> +
> +static bool mmcra_sipr(unsigned long mmcra)
> +{
> + unsigned long sipr = MMCRA_SIPR;
> +
> + if (ppmu->flags & PPMU_ALT_SIPR)
> + sipr = POWER6_MMCRA_SIPR;
> +
> + return !!(mmcra & sipr);
> +}
> +
> static inline u32 perf_flags_from_msr(struct pt_regs *regs)
> {
> if (regs->msr & MSR_PR)
> @@ -128,8 +148,6 @@ static inline u32 perf_flags_from_msr(struct pt_regs *regs)
> static inline u32 perf_get_misc_flags(struct pt_regs *regs)
> {
> unsigned long mmcra = regs->dsisr;
> - unsigned long sihv = MMCRA_SIHV;
> - unsigned long sipr = MMCRA_SIPR;
>
> /* Not a PMU interrupt: Make up flags from regs->msr */
> if (TRAP(regs) != 0xf00)
> @@ -156,15 +174,10 @@ static inline u32 perf_get_misc_flags(struct pt_regs *regs)
> return PERF_RECORD_MISC_USER;
> }
>
> - if (ppmu->flags & PPMU_ALT_SIPR) {
> - sihv = POWER6_MMCRA_SIHV;
> - sipr = POWER6_MMCRA_SIPR;
> - }
> -
> /* PR has priority over HV, so order below is important */
> - if (mmcra & sipr)
> + if (mmcra_sipr(mmcra))
> return PERF_RECORD_MISC_USER;
> - if ((mmcra & sihv) && (freeze_events_kernel != MMCR0_FCHV))
> + if (mmcra_sihv(mmcra) && (freeze_events_kernel != MMCR0_FCHV))
> return PERF_RECORD_MISC_HYPERVISOR;
> return PERF_RECORD_MISC_KERNEL;
> }
> @@ -1340,6 +1353,14 @@ unsigned long perf_instruction_pointer(struct pt_regs *regs)
> !(mmcra & MMCRA_SAMPLE_ENABLE))
> return regs->nip;
>
> + /*
> + * With pipelining on P7, addresses in the SIAR can be off by several
> + * instructions. For user space use the next instruction pointer as
> + * that will be more accurate.
> + */
> + if (mmcra_sipr(mmcra))
> + return regs->nip;
> +
> return mfspr(SPRN_SIAR) + perf_ip_adjust(regs);
> }
>
^ permalink raw reply
* Re: kernel panic during kernel module load (powerpc specific part)
From: Benjamin Herrenschmidt @ 2012-06-05 22:47 UTC (permalink / raw)
To: Gabriel Paubert
Cc: Wrobel Heinz-R39252, Michael Ellerman, Steffen Rumler,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20120605104449.GA32032@visitor2.iram.es>
On Tue, 2012-06-05 at 12:44 +0200, Gabriel Paubert wrote:
> On Tue, Jun 05, 2012 at 08:00:42AM +1000, Benjamin Herrenschmidt wrote:
> > On Mon, 2012-06-04 at 13:03 +0200, Gabriel Paubert wrote:
> > > There is no conflict to the ABI. These functions are supposed to be
> > > directly reachable from whatever code
> > > section may need them.
> > >
> > > Now I have a question: how did you get the need for this?
> > >
> > > None of my kernels uses them:
> > > - if I compile with -O2, the compiler simply expands epilogue and
> > > prologue to series of lwz and stw
> > > - if I compile with -Os, the compiler generates lmw/stmw which give
> > > the smallest possible cache footprint
> > >
> > > Neither did I find a single reference to these functions in several
> > > systems that I grepped for.
> >
> > Newer gcc's ... even worse, with -Os, it does it for a single register
> > spill afaik. At least that's how I hit it with grub2 using whatever gcc
> > is in fc17.
>
> Ok, it's beyond stupid, and at this point must be considered a gcc bug.
Probably, I haven't had a chance to report it...
It would make more sense if the out of line functions also handled
creating the stack frame & disposing of it (ie, maybe a tail call for
return) but they don't even do that so yes it's quite gross.
Cheers,
Ben.
^ permalink raw reply
* RE: [PATCH] powerpc: Fix assmption of end_of_DRAM() returns end address
From: Bhushan Bharat-R65777 @ 2012-06-06 0:46 UTC (permalink / raw)
To: David Miller, benh@kernel.crashing.org, Andrea Arcangeli
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
In-Reply-To: <20120605.152058.828742127223799137.davem@davemloft.net>
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Wednesday, June 06, 2012 3:51 AM
> To: benh@kernel.crashing.org
> Cc: Bhushan Bharat-R65777; linuxppc-dev@lists.ozlabs.org; linux-
> kernel@vger.kernel.org; galak@kernel.crashing.org; Bhushan Bharat-R65777
> Subject: Re: [PATCH] powerpc: Fix assmption of end_of_DRAM() returns end =
address
>=20
> From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Date: Wed, 06 Jun 2012 08:17:39 +1000
>=20
> > On Tue, 2012-06-05 at 19:25 +0530, Bharat Bhushan wrote:
> >> memblock_end_of_DRAM() returns end_address + 1, not end address.
> >> While some code assumes that it returns end address.
> >
> > Shouldn't we instead fix it the other way around ? IE, make
> > memblock_end_of_DRAM() does what the name implies, which is to return
> > the last byte of DRAM, and fix the -other- callers not to make bad
> > assumptions ?
>=20
> That was my impression too when I saw this patch.
Initially I also intended to do so. I initiated a email on linux-mm@ subje=
ct "memblock_end_of_DRAM() return end address + 1" and the only response I=
received from Andrea was:
"
It's normal that "end" means "first byte offset out of the range". End =3D =
not ok.
end =3D start+size.
This is true for vm_end too. So it's better to keep it that way.
My suggestion is to just fix point 1 below and audit the rest :)
"
Thanks
-Bharat
^ permalink raw reply
* Re: Access to http://ozlabs.org/people/dgibson/dldwd/
From: David Gibson @ 2012-06-06 3:13 UTC (permalink / raw)
To: R.P. Burrasca; +Cc: linuxppc-dev
In-Reply-To: <SNT125-DS202B61C3B77896C6E6D393B00C0@phx.gbl>
On Tue, Jun 05, 2012 at 07:27:44AM -0600, R.P. Burrasca wrote:
>
> Would it be possible to access the above referenced webpage in order to see
> what's available as the Orinoco & Prism 2 Wireless Driver?
Uh, that site hasn't existed for 5 years or more. The latest versions
of the orinoco driver are in the mainline kernel tree.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* [PATCH] PPC: PCI: Fix pcibios_io_space_offset() so it works for 32-bit ptr/64-bit rsrcs
From: Ben Collins @ 2012-06-06 3:50 UTC (permalink / raw)
To: linuxppc-dev
The commit introducing pcibios_io_space_offset() was ignoring 32-bit to
64-bit sign extention, which is the case on ppc32 with 64-bit resource
addresses. This only seems to have shown up while running under QEMU for
e500mc target. It may or may be suboptimal that QEMU has an IO base
address > 32-bits for the e500-pci implementation, but 1) it's still a
regression and 2) it's more correct to handle things this way.
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/pci-common.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/pci-common.c =
b/arch/powerpc/kernel/pci-common.c
index 8e78e93..be9ced7 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1477,9 +1477,15 @@ int pcibios_enable_device(struct pci_dev *dev, =
int mask)
return pci_enable_resources(dev, mask);
}
=20
+/* Before assuming too much here, take care to realize that we need =
sign
+ * extension from 32-bit pointers to 64-bit resource addresses to work.
+ */
resource_size_t pcibios_io_space_offset(struct pci_controller *hose)
{
- return (unsigned long) hose->io_base_virt - _IO_BASE;
+ long vbase =3D (long)hose->io_base_virt;
+ long io_base =3D _IO_BASE;
+
+ return (resource_size_t)(vbase - io_base);
}
=20
static void __devinit pcibios_setup_phb_resources(struct pci_controller =
*hose, struct list_head *resources)
--=20
1.7.9.5
--
Ben Collins
Servergy, Inc.
(757) 243-7557
CONFIDENTIALITY NOTICE: This communication contains privileged and/or =
confidential information; and should be maintained with the strictest =
confidence. It is intended solely for the use of the person or entity in =
which it is addressed. If you are not the intended recipient, you are =
STRICTLY PROHIBITED from disclosing, copying, distributing or using any =
of this information. If you received this communication in error, please =
contact the sender immediately and destroy the material in its entirety, =
whether electronic or hard copy.
^ permalink raw reply related
* Re: [PATCH v5 4/5] fsl_pmc: Add API to enable device as wakeup event source
From: Li Yang @ 2012-06-06 4:06 UTC (permalink / raw)
To: Scott Wood
Cc: Wood Scott-B07421, Li Yang-R58472, Zhao Chenhui-B35336,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <4FCE4A5A.3020603@freescale.com>
On Wed, Jun 6, 2012 at 2:05 AM, Scott Wood <scottwood@freescale.com> wrote:
> On 06/05/2012 11:49 AM, Li Yang-R58472 wrote:
>>
>>
>>>>> On 06/04/2012 06:36 AM, Zhao Chenhui wrote:
>>>>>> On Fri, Jun 01, 2012 at 05:08:52PM -0500, Scott Wood wrote:
>>>>>>> On 05/11/2012 06:53 AM, Zhao Chenhui wrote:
>>>>>>>> +int mpc85xx_pmc_set_wake(struct platform_device *pdev, bool
>>>>>>>> +enable)
>>>>>>>
>>>>>>> Why does it have to be a platform_device? =C2=A0Would a bare device=
_node
>>>>> work
>>>>>>> here? =C2=A0If it's for stuff like device_may_wakeup() that could b=
e in
>>>>>>> a platform_device wrapper function.
>>>>>>
>>>>>> It does not have to be a platform_device. I think it can be a struct
>>>>> device.
>>>>>
>>>>> Why does it even need that? =C2=A0The low level mechanism for influen=
cing
>>>>> PMCDR should only need a device node, not a Linux device struct.
>>>>
>>>> It does no harm to pass the device structure and makes more sense for
>>> object oriented interface design.
>>>
>>> It does do harm if you don't have a device structure to pass, if for so=
me
>>> reason you found the device by directly looking for it rather than goin=
g
>>> through the device model.
>>
>> Whether or not a device is a wakeup source not only depends on the
>> SoC specification but also the configuration and current state for
>> the device. =C2=A0I only expect the device driver to have this knowledge
>> and call this function rather than some standalone platform code.
>> Therefore I don't think your concern matters.
>
> First, I think it's bad API to force the passing of a higher level
> object when a lower level object would suffice (and there are no
> legitimate future-proofing or abstraction reasons for hiding the lower
> level object).
>
> But regardless, the entity you call a "device driver" may or may not use
> the standard driver model (e.g. look at PCI root complexes), and your
> assumption about what platform code knows may or may not be correct. =C2=
=A0I
> could just as well say that only platform code knows about the SoC
> clock/power routing during a given low power state.
Good point. We need to fix such non-standard drivers. The new PM
framework depends a lot on the standard Linux Driver Model. We need
to change our drivers to make them work better with PM. Also we have
already submitted a patch series to change the PCI root complex driver
in that regard.
>
>>>>>>> Who is setting can_wakeup for these devices?
>>>>>>
>>>>>> The device driver is responsible to set can_wakeup.
>>>>>
>>>>> How would the device driver know how to set it? =C2=A0Wouldn't this d=
epend
>>>>> on the particular SoC and low power mode?
>>>>
>>>> It is based on the "fsl,magic-packet" and "fsl,wake-on-filer" device
>>> tree properties.
>>>
>>> fsl,magic-packet was a mistake. =C2=A0It is equivalent to checking the
>>> compatible for etsec. =C2=A0It does not convey any information about wh=
ether
>>
>> It can be described either by explicit feature property or by the
>> compatible. =C2=A0I don't think it is a problem that we choose one again=
st
>> another.
>
> I do think it's a problem, because it's unnecessarily complicated, and
> more error prone (we probably didn't have fsl,magic-packet on all the
> SoCs that support it before the .dtsi refactoring). =C2=A0But my point wa=
s
> that it says nothing about whether the eTSEC will still be functioning
> during a low power state.
>
>>> the eTSEC is still active in a given low power mode.
>>
>> Whether or not the eTSEC is still active in both sleep and deep sleep
>> is only depending on if we set it to be a wakeup source.
>
> Only because we happen to support eTSEC as a wakeup source on all SoCs.
>
>> If it behaves differently for low power modes in the future, we could
>> address that by adding additional property.
>>
>>>
>>> How is fsl,wake-os-filer relevant to this decision? =C2=A0When will it =
be set
>>> but not fsl,magic-packet?
>>
>> I mean either fsl,magic-packet or fsl,wake-on-filer shows it can be a
>> wakeup source. =C2=A0Currently we don't have an SoC to have wake-on-file=
r
>> while not wake-on-magic. =C2=A0But I think it's better to consider both =
as
>> they are independent features.
>
> You're not willing to consider an SoC where waking on eTSEC is
> unsupported, but you're willing to consider an eTSEC that has
> wake-on-filer but magic packet support has for some reason been dropped?
Good findings. :) I think it's fine to keep the extra that have
already been done as long as it does no harm. But we should stop
adding more extras that are not necessary for now.
>
>>> What about devices other than ethernet? =C2=A0What about differences be=
tween
>>> ordinary sleep and deep sleep?
>>
>> There is no difference for sleep and deep sleep for all wakeup sources c=
urrently.
>
> I recall being able to wake an mpc85xx chip (maybe mpc8544?) from
> ordinary sleep using the DUART (even though the manual suggests that
> only external interrupts can be used -- not even eTSEC). =C2=A0You can't =
do
> that in deep sleep.
I doubt that as the blocks are clock gated in sleep. We only have
MPC8536 and P1022 in the e500 family to support deep sleep now. I
agree with you the sleep and deep sleep can imply different wakeup
source in the future. But can we worry about it later?
>
> You ignored "what about devices other than ethernet".
No, I haven't. Other devices are so at least for now.
- Leo
^ permalink raw reply
* Re: [PATCH] PPC: PCI: Fix pcibios_io_space_offset() so it works for 32-bit ptr/64-bit rsrcs
From: Benjamin Herrenschmidt @ 2012-06-06 5:15 UTC (permalink / raw)
To: Ben Collins; +Cc: Bjorn Helgaas, Paul Mackerras, linuxppc-dev
In-Reply-To: <4DC27253-67FC-4A55-8C78-7782D9D0CF53@servergy.com>
On Tue, 2012-06-05 at 23:50 -0400, Ben Collins wrote:
> The commit introducing pcibios_io_space_offset() was ignoring 32-bit to
> 64-bit sign extention, which is the case on ppc32 with 64-bit resource
> addresses. This only seems to have shown up while running under QEMU for
> e500mc target. It may or may be suboptimal that QEMU has an IO base
> address > 32-bits for the e500-pci implementation, but 1) it's still a
> regression and 2) it's more correct to handle things this way.
See Bjorn, we both did end up getting it wrong :-)
> Signed-off-by: Ben Collins <bcollins@ubuntu.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> arch/powerpc/kernel/pci-common.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
> index 8e78e93..be9ced7 100644
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -1477,9 +1477,15 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
> return pci_enable_resources(dev, mask);
> }
>
> +/* Before assuming too much here, take care to realize that we need sign
> + * extension from 32-bit pointers to 64-bit resource addresses to work.
> + */
> resource_size_t pcibios_io_space_offset(struct pci_controller *hose)
> {
> - return (unsigned long) hose->io_base_virt - _IO_BASE;
> + long vbase = (long)hose->io_base_virt;
> + long io_base = _IO_BASE;
> +
> + return (resource_size_t)(vbase - io_base);
> }
>
> static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
^ permalink raw reply
* Re: [PATCH v2 0/2] Add pcibios_device_change_notifier
From: Benjamin Herrenschmidt @ 2012-06-06 5:26 UTC (permalink / raw)
To: Hiroo Matsumoto
Cc: Bjorn Helgaas, linux-pci, linuxppc-dev, jbarnes, Kenji Kaneshige
In-Reply-To: <4FBC4C86.9050206@jp.fujitsu.com>
On Wed, 2012-05-23 at 11:33 +0900, Hiroo Matsumoto wrote:
> This patchset is for PCI hotplug.
>
>
> pcibios_setup_bus_devices which sets DMA and IRQs of PCI device is called
> only when boot. DMA setting in probe for PCI driver, like dma_set_mask,
> does not work on powerpc platform. So it is need to set DMA and IRQs of
> PCI device when hotplug.
>
> 1. Moving pcibios_setup_bus_devices code to pcibios_device_change_notifier
> which is registered to bus notifier in pcibios_init.
> 2. Removing caller and callee of pcibios_setup_bus_devices bus notifier
> works instead of pcibios_setup_bus_devices.
> 3. Using this bus notifier for microblaze because microblaze/PCI is similer
> with powerpc/PCI.
This makes me a bit nervous (that doesn't mean it's not right, but
we need some careful auditing & testing here, which I won't be
able to do until I'm back from leave). Mostly due to the change in when
we do the work.
pcibios_fixup_bus() used to be called early on in the initial scan pass.
Your code causes the code to be called -much- later when registering the
device with the device model. Are we 100% certain nothing will happen in
between that might rely on the stuff being setup already ? It might well
be ok, but I want us to triple check that.
Now, if we are ok to do the setup that late (basically right before the
driver probe() routine gets called), would it make sense to simplify
things even further ... and do it from pcibios_enable_device() ? Thus
avoiding the notifier business completely or is that pushing it too
far ?
Also you seem to add:
+ /* Setup OF node pointer in the device */
+ dev->dev.of_node = pci_device_to_OF_node(dev);
This shouldn't be needed anymore, the device node should be setup by the
core nowadays. Is this just a remnant of you rebasing an old patch or do
you have a good reason to add this statement ?
Cheers,
Ben.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox