Re: [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
On Wed, 2014-10-22 at 16:31 +1100, Michael Ellerman wrote: > On Wed, 2014-10-22 at 11:32 +0800, Jeremy Kerr wrote: > > Currently, we can't call opal wrappers from modules when using the LE > > ABIv2, which requires a TOC init. > > What happens if we try? Build failure or run time bug? Kaboom. > > This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the > > opal wrappers, so that we can do non-local calls to them. > > Are we doing that now, or we would like to? We do now for a test module (the one that test using the invalid OPAL call), but we would like to use it for real for the new IPMI driver among others. Cheers, Ben. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powerpc: Convert power off logic to pm_power_off
On Wed, 2014-10-22 at 15:37 +1100, Michael Ellerman wrote: > Hi guys, how does this look? > > If it's OK I'll put it in a topic branch for Guenter. No objection. Cheers, Ben. > cheers > > diff --git a/arch/powerpc/include/asm/machdep.h > b/arch/powerpc/include/asm/machdep.h > index 84c8acf40989..15c9150a58cc 100644 > --- a/arch/powerpc/include/asm/machdep.h > +++ b/arch/powerpc/include/asm/machdep.h > @@ -142,7 +142,6 @@ struct machdep_calls { > #endif > > void(*restart)(char *cmd); > - void(*power_off)(void); > void(*halt)(void); > void(*panic)(char *str); > void(*cpu_die)(void); > diff --git a/arch/powerpc/kernel/setup-common.c > b/arch/powerpc/kernel/setup-common.c > index 1362cd62b3fa..44c8d03558ac 100644 > --- a/arch/powerpc/kernel/setup-common.c > +++ b/arch/powerpc/kernel/setup-common.c > @@ -139,8 +139,8 @@ void machine_restart(char *cmd) > void machine_power_off(void) > { > machine_shutdown(); > - if (ppc_md.power_off) > - ppc_md.power_off(); > + if (pm_power_off) > + pm_power_off(); > #ifdef CONFIG_SMP > smp_send_stop(); > #endif > @@ -151,7 +151,7 @@ void machine_power_off(void) > /* Used by the G5 thermal driver */ > EXPORT_SYMBOL_GPL(machine_power_off); > > -void (*pm_power_off)(void) = machine_power_off; > +void (*pm_power_off)(void); > EXPORT_SYMBOL_GPL(pm_power_off); > > void machine_halt(void) > diff --git a/arch/powerpc/platforms/44x/ppc476.c > b/arch/powerpc/platforms/44x/ppc476.c > index 58db9d083969..c11ce6516c8f 100644 > --- a/arch/powerpc/platforms/44x/ppc476.c > +++ b/arch/powerpc/platforms/44x/ppc476.c > @@ -94,7 +94,7 @@ static int avr_probe(struct i2c_client *client, > { > avr_i2c_client = client; > ppc_md.restart = avr_reset_system; > - ppc_md.power_off = avr_power_off_system; > + pm_power_off = avr_power_off_system; > return 0; > } > > diff --git a/arch/powerpc/platforms/52xx/efika.c > b/arch/powerpc/platforms/52xx/efika.c > index 3feffde9128d..6af651e69129 100644 > --- a/arch/powerpc/platforms/52xx/efika.c > +++ b/arch/powerpc/platforms/52xx/efika.c > @@ -212,6 +212,8 @@ static int __init efika_probe(void) > DMA_MODE_READ = 0x44; > DMA_MODE_WRITE = 0x48; > > + pm_power_off = rtas_power_off; > + > return 1; > } > > @@ -225,7 +227,6 @@ define_machine(efika) > .init_IRQ = mpc52xx_init_irq, > .get_irq= mpc52xx_get_irq, > .restart= rtas_restart, > - .power_off = rtas_power_off, > .halt = rtas_halt, > .set_rtc_time = rtas_set_rtc_time, > .get_rtc_time = rtas_get_rtc_time, > diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c > b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c > index 463fa91ee5b6..15e8021ddef9 100644 > --- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c > +++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c > @@ -167,10 +167,10 @@ static int mcu_probe(struct i2c_client *client, const > struct i2c_device_id *id) > if (ret) > goto err; > > - /* XXX: this is potentially racy, but there is no lock for ppc_md */ > - if (!ppc_md.power_off) { > + /* XXX: this is potentially racy, but there is no lock for pm_power_off > */ > + if (!pm_power_off) { > glob_mcu = mcu; > - ppc_md.power_off = mcu_power_off; > + pm_power_off = mcu_power_off; > dev_info(&client->dev, "will provide power-off service\n"); > } > > @@ -197,7 +197,7 @@ static int mcu_remove(struct i2c_client *client) > device_remove_file(&client->dev, &dev_attr_status); > > if (glob_mcu == mcu) { > - ppc_md.power_off = NULL; > + pm_power_off = NULL; > glob_mcu = NULL; > } > > diff --git a/arch/powerpc/platforms/85xx/corenet_generic.c > b/arch/powerpc/platforms/85xx/corenet_generic.c > index e56b89a792ed..1f309ccb096e 100644 > --- a/arch/powerpc/platforms/85xx/corenet_generic.c > +++ b/arch/powerpc/platforms/85xx/corenet_generic.c > @@ -170,7 +170,7 @@ static int __init corenet_generic_probe(void) > > ppc_md.get_irq = ehv_pic_get_irq; > ppc_md.restart = fsl_hv_restart; > - ppc_md.power_off = fsl_hv_halt; > + pm_power_off = fsl_hv_halt; > ppc_md.halt = fsl_hv_halt; > #ifdef CONFIG_SMP > /* > diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c > b/arch/powerpc/platforms/85xx/sgy_cts1000.c > index 8162b0412117..e149c9ec26ae 100644 > --- a/arch/powerpc/platforms/85xx/sgy_cts1000.c > +++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c > @@ -120,7 +120,7 @@ static int gpio_halt_probe(struct platform_device *pdev) > > /* Register our halt function */ > ppc_md.halt = gpio_ha
Re: [PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
On Wed, 2014-10-22 at 11:32 +0800, Jeremy Kerr wrote: > Currently, we can't call opal wrappers from modules when using the LE > ABIv2, which requires a TOC init. What happens if we try? Build failure or run time bug? > This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the > opal wrappers, so that we can do non-local calls to them. Are we doing that now, or we would like to? cheers ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH 2/3] ls1021aqds: add qe node to ls1021aqds dts
add qe node(qe-tdm and qe-uart) into ls1021a-qds.dts Signed-off-by: Zhao Qiang --- arch/arm/boot/dts/ls1021a-qds.dts | 24 1 file changed, 24 insertions(+) diff --git a/arch/arm/boot/dts/ls1021a-qds.dts b/arch/arm/boot/dts/ls1021a-qds.dts index e24a5bc..4231daa 100644 --- a/arch/arm/boot/dts/ls1021a-qds.dts +++ b/arch/arm/boot/dts/ls1021a-qds.dts @@ -308,6 +308,30 @@ }; }; +&uqe { + tdma: ucc@2000 { + compatible = "fsl,ucc-tdm"; + rx-clock-name = "brg1"; + tx-clock-name = "brg1"; + fsl,rx-sync-clock = "none"; + fsl,tx-sync-clock = "none"; + fsl,tx-timeslot = <0xfffe>; + fsl,rx-timeslot = <0xfffe>; + fsl,tdm-framer-type = "e1"; + fsl,tdm-mode = "internal-loopback"; + fsl,tdm-id = <0>; + fsl,siram-entry-id = <0>; + }; + + serial: ucc@2200 { + device_type = "serial"; + compatible = "ucc_uart"; + port-number = <1>; + rx-clock-name = "brg2"; + tx-clock-name = "brg2"; + }; +}; + &pwm3 { status = "okay"; }; -- 2.1.0.27.g96db324 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc: Convert power off logic to pm_power_off
The generic Linux framework to power off the machine is a function pointer called pm_power_off. The trick about this pointer is that device drivers can potentially implement it rather than board files. Today on powerpc we set pm_power_off to invoke our generic full machine power off logic which then calls ppc_md.power_off to invoke machine specific power off. However, when we want to add a power off GPIO via the "gpio-poweroff" driver, this card house falls apart. That driver only registers itself if pm_power_off is NULL to ensure it doesn't override board specific logic. However, since we always set pm_power_off to the generic power off logic (which will just not power off the machine if no ppc_md.power_off call is implemented), we can't implement power off via the generic GPIO power off driver. To fix this up, let's get rid of the ppc_md.power_off logic and just always use pm_power_off as was intended. Then individual drivers such as the GPIO power off driver can implement power off logic via that function pointer. With this patch set applied and a few patches on top of QEMU that implement a power off GPIO on the virt e500 machine, I can successfully turn off my virtual machine after halt. Signed-off-by: Alexander Graf [mpe: Squash into one patch and update changelog based on cover letter] Signed-off-by: Michael Ellerman --- arch/powerpc/include/asm/machdep.h | 1 - arch/powerpc/kernel/setup-common.c | 6 +-- arch/powerpc/platforms/44x/ppc476.c | 2 +- arch/powerpc/platforms/52xx/efika.c | 3 +- arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c | 8 ++-- arch/powerpc/platforms/85xx/corenet_generic.c| 2 +- arch/powerpc/platforms/85xx/sgy_cts1000.c| 4 +- arch/powerpc/platforms/cell/celleb_setup.c | 4 +- arch/powerpc/platforms/cell/qpace_setup.c| 2 +- arch/powerpc/platforms/cell/setup.c | 2 +- arch/powerpc/platforms/chrp/setup.c | 3 +- arch/powerpc/platforms/embedded6xx/gamecube.c| 3 +- arch/powerpc/platforms/embedded6xx/linkstation.c | 4 +- arch/powerpc/platforms/embedded6xx/wii.c | 3 +- arch/powerpc/platforms/maple/setup.c | 4 +- arch/powerpc/platforms/powermac/setup.c | 3 +- arch/powerpc/platforms/powernv/setup.c | 4 +- arch/powerpc/platforms/ps3/setup.c | 2 +- arch/powerpc/platforms/pseries/setup.c | 59 arch/powerpc/sysdev/fsl_soc.c| 2 +- arch/powerpc/xmon/xmon.c | 3 +- 21 files changed, 66 insertions(+), 58 deletions(-) Hi guys, how does this look? If it's OK I'll put it in a topic branch for Guenter. cheers diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 84c8acf40989..15c9150a58cc 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h @@ -142,7 +142,6 @@ struct machdep_calls { #endif void(*restart)(char *cmd); - void(*power_off)(void); void(*halt)(void); void(*panic)(char *str); void(*cpu_die)(void); diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 1362cd62b3fa..44c8d03558ac 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -139,8 +139,8 @@ void machine_restart(char *cmd) void machine_power_off(void) { machine_shutdown(); - if (ppc_md.power_off) - ppc_md.power_off(); + if (pm_power_off) + pm_power_off(); #ifdef CONFIG_SMP smp_send_stop(); #endif @@ -151,7 +151,7 @@ void machine_power_off(void) /* Used by the G5 thermal driver */ EXPORT_SYMBOL_GPL(machine_power_off); -void (*pm_power_off)(void) = machine_power_off; +void (*pm_power_off)(void); EXPORT_SYMBOL_GPL(pm_power_off); void machine_halt(void) diff --git a/arch/powerpc/platforms/44x/ppc476.c b/arch/powerpc/platforms/44x/ppc476.c index 58db9d083969..c11ce6516c8f 100644 --- a/arch/powerpc/platforms/44x/ppc476.c +++ b/arch/powerpc/platforms/44x/ppc476.c @@ -94,7 +94,7 @@ static int avr_probe(struct i2c_client *client, { avr_i2c_client = client; ppc_md.restart = avr_reset_system; - ppc_md.power_off = avr_power_off_system; + pm_power_off = avr_power_off_system; return 0; } diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c index 3feffde9128d..6af651e69129 100644 --- a/arch/powerpc/platforms/52xx/efika.c +++ b/arch/powerpc/platforms/52xx/efika.c @@ -212,6 +212,8 @@ static int __init efika_probe(void) DMA_MODE_READ = 0x44; DMA_MODE_WRITE = 0x48; + pm_power_off = rtas_power_off; + return 1; } @@ -225,7 +227,6 @@ define_machine(efika) .init_IRQ = mpc52xx_init_irq, .get_irq= mpc52xx_get_irq
[PATCH] powernv: Use _GLOBAL_TOC for opal wrappers
Currently, we can't call opal wrappers from modules when using the LE ABIv2, which requires a TOC init. This change uses the _GLOBAL_TOC() macro (rather than _GLOBAL) for the opal wrappers, so that we can do non-local calls to them. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/powernv/opal-wrappers.S |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index e9e2450..845a5c5 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S @@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1); \ */ #define OPAL_CALL(name, token) \ - _GLOBAL(name);\ + _GLOBAL_TOC(name);\ mflrr0; \ std r0,16(r1); \ li r0,token; \ ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] powernv/iommu: disable IOMMU bypass with param iommu=nobypass
On Tue, Oct 21, 2014 at 04:49:43PM -0200, Thadeu Lima de Souza Cascardo wrote: >When IOMMU bypass is enabled, a PCI device can read and write memory >that was not mapped by the driver without causing an EEH. That might >cause memory corruption, for example. > >When we disable bypass, DMA reads and writes to addresses not mapped by >the IOMMU will cause an EEH, allowing us to debug such issues. > >Signed-off-by: Thadeu Lima de Souza Cascardo Reviewed-by: Gavin Shan Except minor things as below. >--- > Documentation/kernel-parameters.txt |2 ++ > arch/powerpc/platforms/powernv/pci-ioda.c | 24 +++- > 2 files changed, 25 insertions(+), 1 deletions(-) > >diff --git a/Documentation/kernel-parameters.txt >b/Documentation/kernel-parameters.txt >index 988160a..b03322a 100644 >--- a/Documentation/kernel-parameters.txt >+++ b/Documentation/kernel-parameters.txt >@@ -1454,6 +1454,8 @@ bytes respectively. Such letter suffixes can also be >entirely omitted. > forcesac > soft > pt [x86, IA-64] >+ nobypass[PPC/POWERNV] >+ Disable IOMMU bypass, using IOMMU for PCI devices. > > > io7=[HW] IO7 for Marvel based alpha systems >diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c >b/arch/powerpc/platforms/powernv/pci-ioda.c >index 468a0f2..58a5a27 100644 >--- a/arch/powerpc/platforms/powernv/pci-ioda.c >+++ b/arch/powerpc/platforms/powernv/pci-ioda.c >@@ -75,6 +75,27 @@ static void pe_level_printk(const struct pnv_ioda_pe *pe, >const char *level, > #define pe_info(pe, fmt, ...) \ > pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__) > >+static int __read_mostly disable_bypass; >+ static bool pnv_iommu_bypass_disabled __read_mostly; >+static int __init iommu_setup(char *str) >+{ >+ if (!*str) >+ return -EINVAL; I guess it would be "if (!str)" for malformed option. >+ while (*str) { >+ if (!strncmp(str, "nobypass", 8)) { >+ disable_bypass = 1; >+ pr_info("ppc iommu: disabling bypass.\n"); It would be more precise since the option is only visible to PowerNV: pr_info("PowerNV: IOMMU bypass window disabled\n"); >+ } >+ str += strcspn(str, ","); >+ if (*str == ',') >+ str++; >+ } >+ >+ return 0; >+} >+ >+early_param("iommu", iommu_setup); >+ > /* > * stdcix is only supposed to be used in hypervisor real mode as per > * the architecture spec >@@ -1243,7 +1264,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb >*phb, > pnv_ioda_setup_bus_dma(pe, pe->pbus, true); > > /* Also create a bypass window */ >- pnv_pci_ioda2_setup_bypass_pe(phb, pe); >+ if (!disable_bypass) >+ pnv_pci_ioda2_setup_bypass_pe(phb, pe); > return; > fail: > if (pe->tce32_seg >= 0) Thanks, Gavin ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] drivers: depend on instead of select BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO
On Sat, Oct 18, 2014 at 12:13:23AM +0300, Jani Nikula wrote: > Documentation/kbuild/kconfig-language.txt warns to use select with care, > and in general use select only for non-visible symbols and for symbols > with no dependencies, because select will force a symbol to a value > without visiting the dependencies. > > Select has become particularly problematic, interdependently, with the > BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO configs. For example: > > scripts/kconfig/conf --randconfig Kconfig > KCONFIG_SEED=0x48312B00 > warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && > DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY > && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI && > EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE > which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT) > warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && > DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY > && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI && > EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE > which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT) > > With tristates it's possible to end up selecting FOO=y depending on > BAR=m in the config, which gets discovered at build time, not config > time, like reported in the thread referenced below. > > Do the following to fix the dependencies: > > * Depend on instead of select BACKLIGHT_CLASS_DEVICE everywhere. Drop > select BACKLIGHT_LCD_SUPPORT in such cases, as it's a dependency of > BACKLIGHT_CLASS_DEVICE. > > * Remove config FB_BACKLIGHT altogether, and replace it with a > dependency on BACKLIGHT_CLASS_DEVICE. All configs selecting > FB_BACKLIGHT select or depend on FB anyway, so we can simplify. > > * Depend on (ACPI && ACPI_VIDEO) || ACPI=n in several places instead of > selecting ACPI_VIDEO and a number of its dependencies if ACPI is > enabled. This is tied to backlight, as ACPI_VIDEO depends on > BACKLIGHT_CLASS_DEVICE. > > * Replace a couple of select INPUT/VT with depends as it seemed to be > necessary. > > Reference: > http://lkml.kernel.org/r/ca+r1zhhmt4drwtf6mbrqo5eqxwx+lxcqh15vsu_d9wpftlh...@mail.gmail.com > Reported-by: Jim Davis > Cc: Randy Dunlap > Cc: David Airlie > Cc: Daniel Vetter > Cc: Greg Kroah-Hartman > Cc: Darren Hart > Cc: Laurent Pinchart > Cc: Benjamin Herrenschmidt > Cc: Jens Frederich > Cc: Daniel Drake > Cc: Jon Nettleton > Cc: Jean-Christophe Plagniol-Villard > Cc: Tomi Valkeinen > Signed-off-by: Jani Nikula As for the drivers/platform/x86/Kconfig: Acked-by: Darren Hart Thanks, -- Darren Hart Intel Open Source Technology Center ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
powerpc: Replace __get_cpu_var uses
This still has not been merged and now powerpc is the only arch that does not have this change. Sorry about missing linuxppc-dev before. V2->V2 - Fix up to work against 3.18-rc1 __get_cpu_var() is used for multiple purposes in the kernel source. One of them is address calculation via the form &__get_cpu_var(x). This calculates the address for the instance of the percpu variable of the current processor based on an offset. Other use cases are for storing and retrieving data from the current processors percpu area. __get_cpu_var() can be used as an lvalue when writing data or on the right side of an assignment. __get_cpu_var() is defined as : #define __get_cpu_var(var) (*this_cpu_ptr(&(var))) __get_cpu_var() always only does an address determination. However, store and retrieve operations could use a segment prefix (or global register on other platforms) to avoid the address calculation. this_cpu_write() and this_cpu_read() can directly take an offset into a percpu area and use optimized assembly code to read and write per cpu variables. This patch converts __get_cpu_var into either an explicit address calculation using this_cpu_ptr() or into a use of this_cpu operations that use the offset. Thereby address calculations are avoided and less registers are used when code is generated. At the end of the patch set all uses of __get_cpu_var have been removed so the macro is removed too. The patch set includes passes over all arches as well. Once these operations are used throughout then specialized macros can be defined in non -x86 arches as well in order to optimize per cpu access by f.e. using a global register that may be set to the per cpu base. Transformations done to __get_cpu_var() 1. Determine the address of the percpu instance of the current processor. DEFINE_PER_CPU(int, y); int *x = &__get_cpu_var(y); Converts to int *x = this_cpu_ptr(&y); 2. Same as #1 but this time an array structure is involved. DEFINE_PER_CPU(int, y[20]); int *x = __get_cpu_var(y); Converts to int *x = this_cpu_ptr(y); 3. Retrieve the content of the current processors instance of a per cpu variable. DEFINE_PER_CPU(int, y); int x = __get_cpu_var(y) Converts to int x = __this_cpu_read(y); 4. Retrieve the content of a percpu struct DEFINE_PER_CPU(struct mystruct, y); struct mystruct x = __get_cpu_var(y); Converts to memcpy(&x, this_cpu_ptr(&y), sizeof(x)); 5. Assignment to a per cpu variable DEFINE_PER_CPU(int, y) __get_cpu_var(y) = x; Converts to __this_cpu_write(y, x); 6. Increment/Decrement etc of a per cpu variable DEFINE_PER_CPU(int, y); __get_cpu_var(y)++ Converts to __this_cpu_inc(y) Cc: Benjamin Herrenschmidt CC: Paul Mackerras Signed-off-by: Christoph Lameter --- arch/powerpc/include/asm/hardirq.h | 4 +++- arch/powerpc/include/asm/tlbflush.h | 4 ++-- arch/powerpc/include/asm/xics.h | 8 arch/powerpc/kernel/dbell.c | 2 +- arch/powerpc/kernel/hw_breakpoint.c | 6 +++--- arch/powerpc/kernel/iommu.c | 2 +- arch/powerpc/kernel/irq.c| 4 ++-- arch/powerpc/kernel/kgdb.c | 2 +- arch/powerpc/kernel/kprobes.c| 6 +++--- arch/powerpc/kernel/mce.c| 24 arch/powerpc/kernel/process.c| 10 +- arch/powerpc/kernel/smp.c| 6 +++--- arch/powerpc/kernel/sysfs.c | 4 ++-- arch/powerpc/kernel/time.c | 22 +++--- arch/powerpc/kernel/traps.c | 6 +++--- arch/powerpc/kvm/e500.c | 14 +++--- arch/powerpc/kvm/e500mc.c| 4 ++-- arch/powerpc/mm/hash_native_64.c | 2 +- arch/powerpc/mm/hash_utils_64.c | 2 +- arch/powerpc/mm/hugetlbpage-book3e.c | 6 +++--- arch/powerpc/mm/hugetlbpage.c| 2 +- arch/powerpc/mm/stab.c | 12 ++-- arch/powerpc/perf/core-book3s.c | 22 +++--- arch/powerpc/perf/core-fsl-emb.c | 6 +++--- arch/powerpc/platforms/cell/interrupt.c | 6 +++--- arch/powerpc/platforms/ps3/interrupt.c | 2 +- arch/powerpc/platforms/pseries/dtl.c | 2 +- arch/powerpc/platforms/pseries/hvCall_inst.c | 4 ++-- arch/powerpc/platforms/pseries/iommu.c | 8 arch/powerpc/platforms/pseries/lpar.c| 6 +++--- arch/powerpc/platforms/pseries/ras.c | 4 ++-- arch/powerpc/sysdev/xics/xics-common.c | 2 +- 32 files changed, 108 insertions(+), 106 deletions(-) Index: linux/arch/powerpc/include/asm/hardirq.h === --- linux.orig/arch/powerpc/incl
[PATCH] powernv/iommu: disable IOMMU bypass with param iommu=nobypass
When IOMMU bypass is enabled, a PCI device can read and write memory that was not mapped by the driver without causing an EEH. That might cause memory corruption, for example. When we disable bypass, DMA reads and writes to addresses not mapped by the IOMMU will cause an EEH, allowing us to debug such issues. Signed-off-by: Thadeu Lima de Souza Cascardo --- Documentation/kernel-parameters.txt |2 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 24 +++- 2 files changed, 25 insertions(+), 1 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 988160a..b03322a 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1454,6 +1454,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. forcesac soft pt [x86, IA-64] + nobypass[PPC/POWERNV] + Disable IOMMU bypass, using IOMMU for PCI devices. io7=[HW] IO7 for Marvel based alpha systems diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 468a0f2..58a5a27 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -75,6 +75,27 @@ static void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level, #define pe_info(pe, fmt, ...) \ pe_level_printk(pe, KERN_INFO, fmt, ##__VA_ARGS__) +static int __read_mostly disable_bypass; + +static int __init iommu_setup(char *str) +{ + if (!*str) + return -EINVAL; + while (*str) { + if (!strncmp(str, "nobypass", 8)) { + disable_bypass = 1; + pr_info("ppc iommu: disabling bypass.\n"); + } + str += strcspn(str, ","); + if (*str == ',') + str++; + } + + return 0; +} + +early_param("iommu", iommu_setup); + /* * stdcix is only supposed to be used in hypervisor real mode as per * the architecture spec @@ -1243,7 +1264,8 @@ static void pnv_pci_ioda2_setup_dma_pe(struct pnv_phb *phb, pnv_ioda_setup_bus_dma(pe, pe->pbus, true); /* Also create a bypass window */ - pnv_pci_ioda2_setup_bypass_pe(phb, pe); + if (!disable_bypass) + pnv_pci_ioda2_setup_bypass_pe(phb, pe); return; fail: if (pe->tce32_seg >= 0) -- 1.7.1 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Build regressions/improvements in v3.18-rc1
On Tue, Oct 21, 2014 at 8:10 PM, Geert Uytterhoeven wrote: > Below is the list of build error/warning regressions/improvements in > v3.18-rc1[1] compared to v3.17[2]. > > Summarized: > - build errors: +21/-15 > [1] http://kisskb.ellerman.id.au/kisskb/head/8002/ (all 119 configs) > [2] http://kisskb.ellerman.id.au/kisskb/head/7938/ (118 out of 119 configs) > + /scratch/kisskb/src/arch/powerpc/kernel/cacheinfo.c: error: 'size_kb' may > be used uninitialized in this function [-Werror=uninitialized]: => 525:2 > + /scratch/kisskb/src/arch/powerpc/lib/rheap.c: error: 'be' may be used > uninitialized in this function [-Werror=uninitialized]: => 417:2 > + /scratch/kisskb/src/arch/powerpc/lib/rheap.c: error: 'bs' may be used > uninitialized in this function [-Werror=uninitialized]: => 424:17 > + /scratch/kisskb/src/arch/powerpc/lib/rheap.c: error: 'start' may be used > uninitialized in this function [-Werror=uninitialized]: => 497:22 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: 'do_lfd' undeclared > (first use in this function): => 1874:29 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: 'do_lfs' undeclared > (first use in this function): => 1872:29 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: 'do_stfd' undeclared > (first use in this function): => 1928:30 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: 'do_stfs' undeclared > (first use in this function): => 1926:30 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: implicit declaration > of function 'do_fp_load' [-Werror=implicit-function-declaration]: => 1872:4 > + /scratch/kisskb/src/arch/powerpc/lib/sstep.c: error: implicit declaration > of function 'do_fp_store' [-Werror=implicit-function-declaration]: => 1926:4 > + /scratch/kisskb/src/arch/powerpc/xmon/xmon.c: error: unused variable > 'badaddr' [-Werror=unused-variable]: => 1141:13 > + /scratch/kisskb/src/arch/powerpc/xmon/xmon.c: error: unused variable > 'mode' [-Werror=unused-variable]: => 1139:6 powerpc-randconfig sstep.c lacks some #ifdef CONFIG_PPC_FPU > + /scratch/kisskb/src/drivers/bcma/main.c: error: implicit declaration of > function 'of_translate_address' [-Werror=implicit-function-declaration]: => > 150:3 sparc64-allmodconfig, sparc-allmodconfig Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] cpuidle/powernv: Populate cpuidle state details by querying the device-tree
On Tuesday, October 14, 2014 01:23:00 PM Preeti U Murthy wrote: > We hard code the metrics relevant for cpuidle states in the kernel today. > Instead pick them up from the device tree so that they remain relevant > and updated for the system that the kernel is running on. > > Cc: linux...@vger.kernel.org > Cc: Rafael J. Wysocki > Cc: devicet...@vger.kernel.org > Cc: linuxppc-dev@lists.ozlabs.org > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Signed-off-by: Preeti U. Murthy > Signed-off-by: Shreyas B. Prabhu Applied, thanks! > --- > > drivers/cpuidle/cpuidle-powernv.c | 27 ++- > 1 file changed, 22 insertions(+), 5 deletions(-) > > diff --git a/drivers/cpuidle/cpuidle-powernv.c > b/drivers/cpuidle/cpuidle-powernv.c > index fa79392..b57681d 100644 > --- a/drivers/cpuidle/cpuidle-powernv.c > +++ b/drivers/cpuidle/cpuidle-powernv.c > @@ -165,7 +165,8 @@ static int powernv_add_idle_states(void) > int nr_idle_states = 1; /* Snooze */ > int dt_idle_states; > const __be32 *idle_state_flags; > - u32 len_flags, flags; > + const __be32 *idle_state_latency; > + u32 len_flags, flags, latency_ns; > int i; > > /* Currently we have snooze statically defined */ > @@ -182,18 +183,32 @@ static int powernv_add_idle_states(void) > return nr_idle_states; > } > > + idle_state_latency = of_get_property(power_mgt, > + "ibm,cpu-idle-state-latencies-ns", NULL); > + if (!idle_state_latency) { > + pr_warn("DT-PowerMgmt: missing > ibm,cpu-idle-state-latencies-ns\n"); > + return nr_idle_states; > + } > + > dt_idle_states = len_flags / sizeof(u32); > > for (i = 0; i < dt_idle_states; i++) { > > flags = be32_to_cpu(idle_state_flags[i]); > + > + /* Cpuidle accepts exit_latency in us and we estimate > + * target residency to be 10x exit_latency > + */ > + latency_ns = be32_to_cpu(idle_state_latency[i]); > if (flags & IDLE_USE_INST_NAP) { > /* Add NAP state */ > strcpy(powernv_states[nr_idle_states].name, "Nap"); > strcpy(powernv_states[nr_idle_states].desc, "Nap"); > powernv_states[nr_idle_states].flags = > CPUIDLE_FLAG_TIME_VALID; > - powernv_states[nr_idle_states].exit_latency = 10; > - powernv_states[nr_idle_states].target_residency = 100; > + powernv_states[nr_idle_states].exit_latency = > + ((unsigned int)latency_ns) / 1000; > + powernv_states[nr_idle_states].target_residency = > + ((unsigned int)latency_ns / 100); > powernv_states[nr_idle_states].enter = &nap_loop; > nr_idle_states++; > } > @@ -204,8 +219,10 @@ static int powernv_add_idle_states(void) > strcpy(powernv_states[nr_idle_states].desc, > "FastSleep"); > powernv_states[nr_idle_states].flags = > CPUIDLE_FLAG_TIME_VALID | > CPUIDLE_FLAG_TIMER_STOP; > - powernv_states[nr_idle_states].exit_latency = 300; > - powernv_states[nr_idle_states].target_residency = > 100; > + powernv_states[nr_idle_states].exit_latency = > + ((unsigned int)latency_ns) / 1000; > + powernv_states[nr_idle_states].target_residency = > + ((unsigned int)latency_ns / 100); > powernv_states[nr_idle_states].enter = &fastsleep_loop; > nr_idle_states++; > } > > -- > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH 1/2] ipr: Convert to generic DMA API
Wendy, Brian, can you give me an ACK for this series? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH] cpufreq: qoriq: Make the driver usable on all QorIQ platforms
On 21 October 2014 14:29, Yuantian Tang wrote: > If I do so, menuconfig will display like this(on PPC): > PowerPC CPU frequency scaling drivers > QorIQ CPU Frequency scaling ---> > <*> CPU frequency scaling driver for Freescale QorIQ SoCs > On ARM, there should be a similar problem. > Isn't weird? Similar is true for cpufreq-cpu0 driver as well.. Maybe we can create a Kconfig.drivers configuration and include it from all architecture specific ones ? @ Rafael ? ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
RE: [PATCH] cpufreq: qoriq: Make the driver usable on all QorIQ platforms
> > -config PPC_CORENET_CPUFREQ > > - tristate "CPU frequency scaling driver for Freescale E500MC SoCs" > > - depends on PPC_E500MC && OF && COMMON_CLK > > +config QORIQ_CPUFREQ > > + tristate "CPU frequency scaling driver for Freescale QorIQ SoCs" > > + depends on OF && COMMON_CLK > > select CLK_PPC_CORENET > > help > > - This adds the CPUFreq driver support for Freescale e500mc, > > - e5500 and e6500 series SoCs which are capable of changing > > - the CPU's frequency dynamically. > > + This adds the CPUFreq driver support for Freescale QorIQ SoCs > > + which are capable of changing the CPU's frequency dynamically. > > > > config CPU_FREQ_PMAC > > bool "Support for Apple PowerBooks" > > Don't need this duplication at all. Just move this to Kconfig instead of .arm > and > ppc. > If I do so, menuconfig will display like this(on PPC): PowerPC CPU frequency scaling drivers QorIQ CPU Frequency scaling ---> <*> CPU frequency scaling driver for Freescale QorIQ SoCs On ARM, there should be a similar problem. Isn't weird? Regards, Yuantian > > diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c > > b/drivers/cpufreq/qoriq-cpufreq.c > > > /** > > * struct cpu_data - per CPU data struct @@ -69,9 +68,6 @@ static > > const u32 *fmask; > > > > static DEFINE_PER_CPU(struct cpu_data *, cpu_data); > > > > -/* cpumask in a cluster */ > > -static DEFINE_PER_CPU(cpumask_var_t, cpu_mask); > > - > > #ifndef CONFIG_SMP > > static inline const struct cpumask *cpu_core_mask(int cpu) { @@ > > -79,6 +75,79 @@ static inline const struct cpumask *cpu_core_mask(int > > cpu) } #endif > > > > +#if defined(CONFIG_PPC_E500MC) > > +static int get_cpu_physical_id(int cpu) { > > + return get_hard_smp_processor_id(cpu); } #elif > > +defined(CONFIG_ARM) > > Wouldn't a #else work here as there are just two platforms we are talking > about ? > > > +static int get_cpu_physical_id(int cpu) { > > + return topology_core_id(cpu); > > +} > > +#endif > > + > > +static u32 get_bus_freq(void) > > +{ > > + struct device_node *soc; > > + u32 sysfreq; > > + > > + soc = of_find_node_by_type(NULL, "soc"); > > + if (!soc) > > + return 0; > > + > > + if (of_property_read_u32(soc, "bus-frequency", &sysfreq)) > > + sysfreq = 0; > > + > > + of_node_put(soc); > > + > > + return sysfreq; > > +} > > + > > +static struct device_node *cpu_to_clk_node(int cpu) { > > + struct device_node *np, *clk_np; > > + > > + if (!cpu_present(cpu)) > > + return NULL; > > + > > + np = of_get_cpu_node(cpu, NULL); > > + if (!np) > > + return NULL; > > + > > + clk_np = of_parse_phandle(np, "clocks", 0); > > + if (!clk_np) > > + return NULL; > > + > > + of_node_put(np); > > + > > + return clk_np; > > +} > > + > > +/* traverse cpu nodes to get cpu mask of sharing clock wire */ static > > +void set_affected_cpus(struct cpufreq_policy *policy) { > > + struct device_node *np, *clk_np; > > + struct cpumask *dstp = policy->cpus; > > + int i; > > + > > + np = cpu_to_clk_node(policy->cpu); > > + if (!np) > > + return; > > + > > + for_each_present_cpu(i) { > > + clk_np = cpu_to_clk_node(i); > > + if (!clk_np) > > + continue; > > + > > + if (clk_np == np) > > + cpumask_set_cpu(i, dstp); > > So you are depending on matching the clock-nodes from DT for getting this > information, right ? There is nothing that the architecture gives? > > > + > > + of_node_put(clk_np); > > + } > > + of_node_put(np); > > +} > > + > > /* reduce the duplicated frequencies in frequency table */ static > > void freq_table_redup(struct cpufreq_frequency_table *freq_table, > > int count) > > @@ -105,6 +174,7 @@ static void freq_table_sort(struct > cpufreq_frequency_table *freq_table, > > int i, j, ind; > > unsigned int freq, max_freq; > > struct cpufreq_frequency_table table; > > + > > for (i = 0; i < count - 1; i++) { > > max_freq = freq_table[i].frequency; > > ind = i; > > @@ -129,7 +199,7 @@ static void freq_table_sort(struct > cpufreq_frequency_table *freq_table, > > } > > } > > > > -static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) > > +static int qoriq_cpufreq_cpu_init(struct cpufreq_policy *policy) > > { > > struct device_node *np; > > int i, count, ret; > > @@ -145,10 +215,8 @@ static int corenet_cpufreq_cpu_init(struct > cpufreq_policy *policy) > > return -ENODEV; > > > > data = kzalloc(sizeof(*data), GFP_KERNEL); > > - if (!data) { > > - pr_err("%s: no memory\n
RE: [PATCH] cpufreq: qoriq: Make the driver usable on all QorIQ platforms
> > #ifndef CONFIG_SMP > > static inline const struct cpumask *cpu_core_mask(int cpu) { @@ -79,6 > > +75,79 @@ static inline const struct cpumask *cpu_core_mask(int cpu) } > > #endif > > > > +#if defined(CONFIG_PPC_E500MC) > > Probably should just be CONFIG_PPC, but do we need this at all. Can't we just > use topology_core_id() on both ARM & PPC? > topology_core_id() doesn't work on PPC. This function only supports PPC64 and non-thread SOCs. I can make it work on PPC, but we are used to use get_hard_smp_processor_id() on ppc. Regards, Yuantian > > +static int get_cpu_physical_id(int cpu) { > > + return get_hard_smp_processor_id(cpu); } #elif defined(CONFIG_ARM) > > +static int get_cpu_physical_id(int cpu) { > > + return topology_core_id(cpu); > > +} > > +#endif > > + ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
kernel 3.17 - perf build failure
LINK perf libperf.a(skip-callchain-idx.o): In function `arch_skip_callchain_idx': /root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:250: undefined reference to `pr_debug' libperf.a(skip-callchain-idx.o): In function `check_return_addr': /root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:188: undefined reference to `pr_debug' libperf.a(skip-callchain-idx.o): In function `arch_skip_callchain_idx': /root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:250: undefined reference to `pr_debug' libperf.a(skip-callchain-idx.o): In function `check_return_addr': /root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:165: undefined reference to `pr_debug' /root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:171: undefined reference to `pr_debug' libperf.a(skip-callchain-idx.o):/root/gen/trunk/knl/tools/perf/arch/powerpc/util/skip-callchain-idx.c:101: more undefined references to `pr_debug' follow collect2: ld returned 1 exit status make[1]: *** [perf] Error 1 make: *** [install] Error 2 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH] powerpc, pseries: All events of EPOW_SYSTEM_SHUTDOWN must initiate shutdown
The current handling of EPOW_SHUTDOWN_ON_UPS event does not shutdown the system after logging the message. All the events of EPOW_SYSTEM_SHUTDOWN action code (EPOW_SHUTDOWN_ON_UPS is a part of it) must initiate system shutdown as per the SPAPR spec. If the LPAR does not shutdown after receiving this rtas based event, it will expose itself to a forced abrupt shutdown initiated by the platform firmware. This patch fixes the situation. Signed-off-by: Anshuman Khandual --- arch/powerpc/platforms/pseries/ras.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index 5a4d0fc..b46cab8 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -89,6 +89,8 @@ static void handle_system_shutdown(char event_modifier) case EPOW_SHUTDOWN_ON_UPS: pr_emerg("Loss of power reported by firmware, system is " "running on UPS/battery"); + pr_emerg("Check RTAS error log for details"); + orderly_poweroff(true); break; case EPOW_SHUTDOWN_LOSS_OF_CRITICAL_FUNCTIONS: -- 1.9.3 ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH v2 0/3] fix a kernel panic on fsl corenet board when CONFIG_CLK_PPC_CORENET is enabled
On Sun, Oct 19, 2014 at 02:11:36PM +0800, Kevin Hao wrote: > Hi, > > I have done a boot test on p2014rdb and t4240qds boards. I don't have an > access > to mpc512x board, so only build test for that. I do find a mpc5121ads board in our lab, the kernel boot well with these changes. Thanks, Kevin pgp1vCaRPP_71.pgp Description: PGP signature ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev