Remove OPAL pre-v3 support
Subsystems (8)
cover Remove OPAL pre-v3 support
Everything that ever made it out of the lab is OPALv3.
The number of machines in the lab even that are OPAL pre v3 is so likely to be zero it's not funny, and the number of people expecting to run mainline kernels on OPAL pre v3 is even lower than that.
So, this patch series removes things referencing OPAL that isn't OPALv3 and leaves us with a simple FW_FEATURE_OPALv3 define at the end that we can check against.
Anyone mad enough to do an OPALv4 gets to go look at all the things themselves.
Stewart Smith (4):
powerpc/powernv: panic() on OPAL < V3
powerpc/powernv: Remove OPALv2 firmware define and references powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3 powerpc/powernv: remove logic for pre-OPALv3 firmware
arch/powerpc/include/asm/firmware.h | 5 +-- arch/powerpc/mm/numa.c | 4 +- arch/powerpc/platforms/powernv/opal.c | 16 ++------ arch/powerpc/platforms/powernv/pci.c | 2 +- arch/powerpc/platforms/powernv/setup.c | 10 ++--- arch/powerpc/platforms/powernv/smp.c | 72 +++++++++++++++------------------- arch/powerpc/sysdev/xics/ics-opal.c | 2 +- drivers/i2c/busses/i2c-opal.c | 2 +- drivers/rtc/rtc-opal.c | 2 +- drivers/tty/hvc/hvc_opal.c | 2 +- 10 files changed, 46 insertions(+), 71 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/4 powerpc/powernv: panic() on OPAL < V3
The OpenPower Abstraction Layer firmware went through a couple of iterations in the lab before being released. What we now know as OPAL advertises itself as OPALv3.
OPALv2 and OPALv1 never made it outside the lab, and the possibility of anyone at all ever building a mainline kernel today and expecting it to boot on such hardware is zero.
--- arch/powerpc/platforms/powernv/opal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/platforms/powernv/opal.c +1 -4
@@ -103,11 +103,8 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); - }else if (of_flat_dt_is_compatible (node,"ibm,opal-v2" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2; -pr_info ("OPAL V2 detected !\n" ); }else { -pr_info ("OPAL V1 detected !\n" ); + panic("OPAL != V3 detected, no longer supported.\n") }/* Reinit all cores with the right endian */
Signature · 1 line
2.1.4
Re: [PATCH 1/4] powerpc/powernv: panic() on OPAL < V3
Quoted 9 lines · Stewart Smith
The OpenPower Abstraction Layer firmware went through a couple of iterations in the lab before being released. What we now know as OPAL advertises itself as OPALv3.
OPALv2 and OPALv1 never made it outside the lab, and the possibility of anyone at all ever building a mainline kernel today and expecting it to boot on such hardware is zero.
Signed-off-by Stewart Smith <[email protected]>
Comment below.
Quoted 9 lines
--- arch/powerpc/platforms/powernv/opal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)arch/powerpc/platforms/powernv/opal.c +0
-0
arch/powerpc/platforms/powernv/opal.c int __init early_init_dt_scan_opal(unsigned long node, · line 107
Quoted 9 lines
arch/powerpc/platforms/powernv/opal.c +1
-4@@ -103,11 +103,8 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); - }else if (of_flat_dt_is_compatible (node,"ibm,opal-v2" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2; -pr_info ("OPAL V2 detected !\n" ); }else { -pr_info ("OPAL V1 detected !\n" ); +panic ("OPAL != V3 detected, no longer supported.\n" )
In the event of an OPAL v4 that is for some reason not backwards compatible with V3, "*no longer* supported" might not make sense. This isn't a huge problem of course.
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
Re: [PATCH 1/4] powerpc/powernv: panic() on OPAL < V3
Quoted 8 lines · Andrew Donnellan
Quoted 8 lines
arch/powerpc/platforms/powernv/opal.c +0
-2@@ -103,11 +103,8 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); - }else if (of_flat_dt_is_compatible (node,"ibm,opal-v2" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2;
Quoted 8 lines
arch/powerpc/platforms/powernv/opal.c int __init early_init_dt_scan_opal(unsigned long node, · line 107
Quoted 4 lines
arch/powerpc/platforms/powernv/opal.c +1
-2-pr_info ("OPAL V2 detected !\n" ); }else { -pr_info ("OPAL V1 detected !\n" ); +panic ("OPAL != V3 detected, no longer supported.\n" )In the event of an OPAL v4 that is for some reason not backwards compatible with V3, "*no longer* supported" might not make sense. This isn't a huge problem of course.
Considering you need kernel support for any new POWER processor, and we're not about to do an OPALv4 on POWER8 or earlier - we're going to be safe :)
Re: [PATCH 1/4] powerpc/powernv: panic() on OPAL < V3
Quoted 2 lines · Stewart Smith
Considering you need kernel support for any new POWER processor, and we're not about to do an OPALv4 on POWER8 or earlier - we're going to be safe :)
Not a huge problem then :)
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
Re: [PATCH 1/4] powerpc/powernv: panic() on OPAL < V3
In reply to Andrew DonnellanQuoted 1 line · Andrew Donnellan
Reviewed-by Andrew Donnellan <[email protected]>
And withdrawing my Reviewed-by: because apparently I'm not capable of spotting missing semicolons, please move the semicolon from patch 2 to this patch...
Andrew
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
kbuild test robot
build botRe: [PATCH 1/4] powerpc/powernv: panic() on OPAL < V3
In reply to Stewart Smithreproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi Stewart,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.4-rc2 next-20151127]
url: https://github.com/0day-ci/linux/commits/Stewart-Smith/powerpc-powernv-panic-on-OPAL-V3/20151127-125146 base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next config: powerpc-defconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
Note: the linux-review/Stewart-Smith/powerpc-powernv-panic-on-OPAL-V3/20151127-125146 HEAD 152f1c52f2204a99806617c1fcfdff7505ee8506 builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
arch/powerpc/platforms/powernv/opal.c: In function 'early_init_dt_scan_opal':
>> arch/powerpc/platforms/powernv/opal.c:108:2: error: expected ';' before '}' token
}
^vim +108 arch/powerpc/platforms/powernv/opal.c
75b93da4 Benjamin Herrenschmidt 2013-05-14 102 if (of_flat_dt_is_compatible(node, "ibm,opal-v3")) {
75b93da4 Benjamin Herrenschmidt 2013-05-14 103 powerpc_firmware_features |= FW_FEATURE_OPALv2;
75b93da4 Benjamin Herrenschmidt 2013-05-14 104 powerpc_firmware_features |= FW_FEATURE_OPALv3;
9a4f5cd0 Anton Blanchard 2014-09-17 105 pr_info("OPAL V3 detected !\n");
14a43e69 Benjamin Herrenschmidt 2011-09-19 106 } else {
37adb774 Stewart Smith 2015-11-27 107 panic("OPAL != V3 detected, no longer supported.\n")
14a43e69 Benjamin Herrenschmidt 2011-09-19 @108 }
14a43e69 Benjamin Herrenschmidt 2011-09-19 109
4926616c Benjamin Herrenschmidt 2014-05-20 110 /* Reinit all cores with the right endian */
4926616c Benjamin Herrenschmidt 2014-05-20 111 opal_reinit_cores();:::::: The code at line 108 was first introduced by commit
:::::: 14a43e69ed257a1fadadf9fea2c05adb1686419f powerpc/powernv: Basic support for OPAL
:::::: TO: Benjamin Herrenschmidt <[email protected]> :::::: CC: Benjamin Herrenschmidt <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 2/4 powerpc/powernv: Remove OPALv2 firmware define and references
In reply to Stewart SmithOPALv2 only ever existed in the lab and didn't escape to the world. All OPAL systems in the wild are OPALv3.
The probability of there being an OPALv2 system still powered on anywhere inside IBM is approximately zero, let alone anyone expecting to run mainline kernels.
So, start to remove references to OPALv2.
--- arch/powerpc/include/asm/firmware.h | 4 +--- arch/powerpc/platforms/powernv/opal.c | 10 +++------- arch/powerpc/platforms/powernv/setup.c | 2 -- arch/powerpc/platforms/powernv/smp.c | 4 ++-- 4 files changed, 6 insertions(+), 14 deletions(-)
arch/powerpc/include/asm/firmware.h +1 -3
@@ -47,7 +47,6 @@#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000)#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000)#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000) -#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000)#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
@@ -70,8 +69,7 @@ enum {FW_FEATURE_SET_MODE |FW_FEATURE_BEST_ENERGY |FW_FEATURE_TYPE1_AFFINITY |FW_FEATURE_PRRN ,FW_FEATURE_PSERIES_ALWAYS =0 , -FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv2 | - FW_FEATURE_OPALv3, +FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv3,FW_FEATURE_POWERNV_ALWAYS =0 ,FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
arch/powerpc/platforms/powernv/opal.c +3 -7
@@ -100,11 +100,10 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |=FW_FEATURE_OPAL ;if (of_flat_dt_is_compatible (node,"ibm,opal-v3" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); }else { - panic("OPAL != V3 detected, no longer supported.\n") +panic ("OPAL != V3 detected, no longer supported.\n" ); }/* Reinit all cores with the right endian */
@@ -349,7 +348,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)* enough room and be done with it */ spin_lock_irqsave (&opal_write_lock, flags); -if (firmware_has_feature (FW_FEATURE_OPALv2)) { +if (firmware_has_feature (FW_FEATURE_OPALv3)) { rc =opal_console_write_buffer_space (vtermno, &olen); len =be64_to_cpu (olen);if (rc || len < total_len) {
@@ -693,10 +692,7 @@ static int __init opal_init(void) }/* Register OPAL consoles if any ports */ -if (firmware_has_feature (FW_FEATURE_OPALv2)) - consoles =of_find_node_by_path ("/ibm,opal/consoles" ); -else - consoles =of_node_get (opal_node); + consoles =of_find_node_by_path ("/ibm,opal/consoles" );if (consoles) {for_each_child_of_node (consoles, np) {if (strcmp (np->name,"serial" ))
arch/powerpc/platforms/powernv/setup.c +0 -2
@@ -92,8 +92,6 @@ static void pnv_show_cpuinfo(struct seq_file *m)seq_printf (m,"machine\t\t: PowerNV %s\n" , model);if (firmware_has_feature (FW_FEATURE_OPALv3))seq_printf (m,"firmware\t: OPAL v3\n" ); -else if (firmware_has_feature (FW_FEATURE_OPALv2)) -seq_printf (m,"firmware\t: OPAL v2\n" );else if (firmware_has_feature (FW_FEATURE_OPAL ))seq_printf (m,"firmware\t: OPAL v1\n" );else
arch/powerpc/platforms/powernv/smp.c +2 -2
@@ -65,10 +65,10 @@ static int pnv_smp_kick_cpu(int nr)BUG_ON (nr <0 || nr >=NR_CPUS );/* -* If we already started or OPALv2 is not supported, we just +* If we already started or OPALv3 is not supported, we just * kick the CPU via the PACA */ -if (paca[nr].cpu_start || !firmware_has_feature (FW_FEATURE_OPALv2)) +if (paca[nr].cpu_start || !firmware_has_feature (FW_FEATURE_OPALv3)) goto kick;/*
Signature · 1 line
2.1.4
Re: [PATCH 2/4] powerpc/powernv: Remove OPALv2 firmware define and references
Quoted 10 lines · Stewart Smith
OPALv2 only ever existed in the lab and didn't escape to the world. All OPAL systems in the wild are OPALv3.
The probability of there being an OPALv2 system still powered on anywhere inside IBM is approximately zero, let alone anyone expecting to run mainline kernels.
So, start to remove references to OPALv2.
Signed-off-by Stewart Smith <[email protected]>
Was going to comment that you should've removed the OPAL v1 line in cpuinfo, but it seems you do that in the next patch.
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
PATCH 3/4 powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3
In reply to Stewart SmithLong ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
So, let's remove FW_FEATURE_OPAL and instead use FW_FEATURE_OPALv3 exclusively.
--- arch/powerpc/include/asm/firmware.h | 3 +-- arch/powerpc/mm/numa.c | 4 ++-- arch/powerpc/platforms/powernv/opal.c | 3 +-- arch/powerpc/platforms/powernv/pci.c | 2 +- arch/powerpc/platforms/powernv/setup.c | 8 +++----- arch/powerpc/sysdev/xics/ics-opal.c | 2 +- drivers/i2c/busses/i2c-opal.c | 2 +- drivers/rtc/rtc-opal.c | 2 +- drivers/tty/hvc/hvc_opal.c | 2 +- 9 files changed, 12 insertions(+), 16 deletions(-)
arch/powerpc/include/asm/firmware.h +1 -2
@@ -46,7 +46,6 @@#define FW_FEATURE_CMO ASM_CONST(0x0000000002000000)#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000)#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000) -#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000)#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
@@ -69,7 +68,7 @@ enum {FW_FEATURE_SET_MODE |FW_FEATURE_BEST_ENERGY |FW_FEATURE_TYPE1_AFFINITY |FW_FEATURE_PRRN ,FW_FEATURE_PSERIES_ALWAYS =0 , -FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv3, +FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPALv3,FW_FEATURE_POWERNV_ALWAYS =0 ,FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
arch/powerpc/mm/numa.c +2 -2
@@ -297,7 +297,7 @@ static int __init find_min_common_depth(void)int depth;struct device_node *root; -if (firmware_has_feature (FW_FEATURE_OPAL )) +if (firmware_has_feature (FW_FEATURE_OPALv3)) root =of_find_node_by_path ("/ibm,opal" );else root =of_find_node_by_path ("/rtas" );
@@ -327,7 +327,7 @@ static int __init find_min_common_depth(void) distance_ref_points_depth /=sizeof (int ); -if (firmware_has_feature (FW_FEATURE_OPAL ) || +if (firmware_has_feature (FW_FEATURE_OPALv3) ||firmware_has_feature (FW_FEATURE_TYPE1_AFFINITY )) {dbg ("Using form 1 affinity\n" ); form1_affinity =1 ;
arch/powerpc/platforms/powernv/opal.c +1 -2
@@ -98,7 +98,6 @@ int __init early_init_dt_scan_opal(unsigned long node,pr_debug ("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n" , opal.size, sizep, runtimesz); - powerpc_firmware_features |=FW_FEATURE_OPAL ;if (of_flat_dt_is_compatible (node,"ibm,opal-v3" )) { powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" );
@@ -180,7 +179,7 @@ static int __init opal_register_exception_handlers(void)#ifdef __BIG_ENDIAN__u64 glue; -if (!(powerpc_firmware_features &FW_FEATURE_OPAL )) +if (!(powerpc_firmware_features & FW_FEATURE_OPALv3))return -ENODEV ;/* Hookup some exception handlers except machine check. We use the
arch/powerpc/platforms/powernv/pci.c +1 -1
@@ -786,7 +786,7 @@ void __init pnv_pci_init(void)pci_add_flags (PCI_CAN_SKIP_ISA_ALIGN );/* If we don't have OPAL, eg. in sim, just skip PCI probe */ -if (!firmware_has_feature (FW_FEATURE_OPAL )) +if (!firmware_has_feature (FW_FEATURE_OPALv3))return ;/* Look for IODA IO-Hubs. We don't support mixing IODA
arch/powerpc/platforms/powernv/setup.c +3 -5
@@ -49,7 +49,7 @@ static void __init pnv_setup_arch(void)pnv_pci_init ();/* Setup RTC and NVRAM callbacks */ -if (firmware_has_feature (FW_FEATURE_OPAL )) +if (firmware_has_feature (FW_FEATURE_OPALv3))opal_nvram_init ();/* Enable NAP mode */
@@ -67,7 +67,7 @@ static void __init pnv_init_early(void)opal_lpc_init ();#ifdef CONFIG_HVC_OPAL -if (firmware_has_feature (FW_FEATURE_OPAL )) +if (firmware_has_feature (FW_FEATURE_OPALv3))hvc_opal_init_early (); else#endif
@@ -92,8 +92,6 @@ static void pnv_show_cpuinfo(struct seq_file *m)seq_printf (m,"machine\t\t: PowerNV %s\n" , model);if (firmware_has_feature (FW_FEATURE_OPALv3))seq_printf (m,"firmware\t: OPAL v3\n" ); -else if (firmware_has_feature (FW_FEATURE_OPAL )) -seq_printf (m,"firmware\t: OPAL v1\n" );else seq_printf (m,"firmware\t: BML\n" );of_node_put (root);
@@ -277,7 +275,7 @@ static int __init pnv_probe(void)hpte_init_native (); -if (firmware_has_feature (FW_FEATURE_OPAL )) +if (firmware_has_feature (FW_FEATURE_OPALv3))pnv_setup_machdep_opal ();pr_debug ("PowerNV detected !\n" );
arch/powerpc/sysdev/xics/ics-opal.c +1 -1
@@ -226,7 +226,7 @@ static long ics_opal_get_server(struct ics *ics, unsigned long vec)int __init ics_opal_init (void ) { -if (!firmware_has_feature (FW_FEATURE_OPAL )) +if (!firmware_has_feature (FW_FEATURE_OPALv3))return -ENODEV ;/* We need to patch our irq chip's EOI to point to the
drivers/i2c/busses/i2c-opal.c +1 -1
@@ -276,7 +276,7 @@ static struct platform_driver i2c_opal_driver = {static int __init i2c_opal_init (void ) { -if (!firmware_has_feature (FW_FEATURE_OPAL )) +if (!firmware_has_feature (FW_FEATURE_OPALv3))return -ENODEV ;return platform_driver_register (&i2c_opal_driver);
drivers/rtc/rtc-opal.c +1 -1
@@ -244,7 +244,7 @@ static struct platform_driver opal_rtc_driver = {static int __init opal_rtc_init (void ) { -if (!firmware_has_feature (FW_FEATURE_OPAL )) +if (!firmware_has_feature (FW_FEATURE_OPALv3))return -ENODEV ;return platform_driver_register (&opal_rtc_driver);
drivers/tty/hvc/hvc_opal.c +1 -1
@@ -255,7 +255,7 @@ static struct platform_driver hvc_opal_driver = {static int __init hvc_opal_init (void ) { -if (!firmware_has_feature (FW_FEATURE_OPAL )) +if (!firmware_has_feature (FW_FEATURE_OPALv3))return -ENODEV ;/* Register as a vio device to receive callbacks */
Signature · 1 line
2.1.4
Re: [PATCH 3/4] powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3
Quoted 8 lines · Stewart Smith
Long ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
So, let's remove
FW_FEATURE_OPALand instead useFW_FEATURE_OPALv3exclusively.Signed-off-by Stewart Smith <[email protected]>
I haven't checked for any outstanding references you've missed here, but I'm going to assume it compiles...
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
Michael Ellerman
reviewerRe: [PATCH 3/4] powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3
In reply to Stewart SmithQuoted 6 lines · Stewart Smith
Long ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
So, let's remove
FW_FEATURE_OPALand instead useFW_FEATURE_OPALv3exclusively.
It would be less churn if we did the reverse, ie. removed v3 and just used FW_FEATURE_OPAL. It would also read better as v3 is the one and only version we care about, so having it called out everywhere is superfluous.
Or is there a good reason I missed?
cheers
Re: [PATCH 3/4] powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3
Quoted 6 lines · Michael Ellerman
Quoted 4 lines · Stewart Smith
Long ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
Quoted 8 lines
Quoted 2 lines
So, let's remove
FW_FEATURE_OPALand instead useFW_FEATURE_OPALv3exclusively.It would be less churn if we did the reverse, ie. removed v3 and just used
FW_FEATURE_OPAL. It would also read better as v3 is the one and only version we care about, so having it called out everywhere is superfluous.Or is there a good reason I missed?
excessive caution?
I'll send a V2 patchset doing the reverse, leaving FW_FEATURE_OPAL.
Re: [PATCH 3/4] powerpc/powernv: remove FW_FEATURE_OPAL and just use FW_FEATURE_OPALv3
Quoted 12 lines · Stewart Smith
Quoted 10 lines · Michael Ellerman
Quoted 6 lines · Stewart Smith
Long ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
So, let's remove
FW_FEATURE_OPALand instead useFW_FEATURE_OPALv3exclusively.It would be less churn if we did the reverse, ie. removed v3 and just
Quoted 8 lines
used
Quoted 1 line
FW_FEATURE_OPAL. It would also read better as v3 is the one and onlyversion we
Quoted 3 lines
care about, so having it called out everywhere is superfluous.
Or is there a good reason I missed?
excessive caution?
Yeah fair enough.
Quoted 1 line
I'll send a V2 patchset doing the reverse, leaving
FW_FEATURE_OPAL.
Thanks.
cheers
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
PATCH 4/4 powerpc/powernv: remove logic for pre-OPALv3 firmware
In reply to Stewart SmithThere was already a check for OPALv3, so we just remove the if/else check and go for it.
OPAL pre-v3 no longer exists. Anywhere.
--- arch/powerpc/platforms/powernv/smp.c | 68 +++++++++++++++--------------------- 1 file changed, 29 insertions(+), 39 deletions(-)
arch/powerpc/platforms/powernv/smp.c +29 -39
@@ -61,6 +61,7 @@ static int pnv_smp_kick_cpu(int nr)unsigned long start_here =__pa (ppc_function_entry (generic_secondary_smp_init));long rc; +uint8_t status;BUG_ON (nr <0 || nr >=NR_CPUS );
@@ -77,53 +78,42 @@ static int pnv_smp_kick_cpu(int nr)* first time. OPAL v3 allows us to query OPAL to know if it * has the CPUs, so we do that */ -if (firmware_has_feature (FW_FEATURE_OPALv3)) { -uint8_t status; + rc =opal_query_cpu_status (pcpu, &status); +if (rc !=OPAL_SUCCESS ) { +pr_warn ("OPAL Error %ld querying CPU %d state\n" , + rc, nr); +return -ENODEV ; + } + +/* +* Already started, just kick it, probably coming from +* kexec and spinning +*/ +if (status ==OPAL_THREAD_STARTED ) + goto kick; - rc =opal_query_cpu_status (pcpu, &status); +/* +* Available/inactive, let's kick it +*/ +if (status ==OPAL_THREAD_INACTIVE ) { +pr_devel ("OPAL: Starting CPU %d (HW 0x%x)...\n" , + nr, pcpu); + rc =opal_start_cpu (pcpu, start_here);if (rc !=OPAL_SUCCESS ) { -pr_warn ("OPAL Error %ld querying CPU %d state\n" , +pr_warn ("OPAL Error %ld starting CPU %d\n" , rc, nr);return -ENODEV ; } - -/* -* Already started, just kick it, probably coming from -* kexec and spinning -*/ -if (status ==OPAL_THREAD_STARTED ) - goto kick; - -/* -* Available/inactive, let's kick it -*/ -if (status ==OPAL_THREAD_INACTIVE ) { -pr_devel ("OPAL: Starting CPU %d (HW 0x%x)...\n" , - nr, pcpu); - rc =opal_start_cpu (pcpu, start_here); -if (rc !=OPAL_SUCCESS ) { -pr_warn ("OPAL Error %ld starting CPU %d\n" , - rc, nr); -return -ENODEV ; - } - }else { -/* -* An unavailable CPU (or any other unknown status) -* shouldn't be started. It should also -* not be in the possible map but currently it can -* happen -*/ -pr_devel ("OPAL: CPU %d (HW 0x%x) is unavailable" -" (status %d)...\n" , nr, pcpu, status); -return -ENODEV ; - } }else {/* -* On OPAL v2, we just kick it and hope for the best, -* we must not test the error from opal_start_cpu() or -* we would fail to get CPUs from kexec. +* An unavailable CPU (or any other unknown status) +* shouldn't be started. It should also +* not be in the possible map but currently it can +* happen */ -opal_start_cpu (pcpu, start_here); +pr_devel ("OPAL: CPU %d (HW 0x%x) is unavailable" +" (status %d)...\n" , nr, pcpu, status); +return -ENODEV ; } kick:return smp_generic_kick_cpu (nr);
Signature · 1 line
2.1.4
Re: [PATCH 4/4] powerpc/powernv: remove logic for pre-OPALv3 firmware
Quoted 6 lines · Stewart Smith
There was already a check for OPALv3, so we just remove the if/else check and go for it.
OPAL pre-v3 no longer exists. Anywhere.
Signed-off-by Stewart Smith <[email protected]>
Nothing obviously wrong that stood out to me.
Signature · 3 lines
Andrew Donnellan Software Engineer, OzLabs [email protected] Australia Development Lab, Canberra +61 2 6201 8874 (work) IBM Australia Limited
v2 cover Remove OPAL pre-v3 support
In reply to Stewart SmithEverything that ever made it out of the lab is OPALv3.
The number of machines in the lab even that are OPAL pre v3 is so likely to be zero it's not funny, and the number of people expecting to run mainline kernels on OPAL pre v3 is even lower than that.
So, this patch series removes things referencing OPAL that isn't OPALv3 and leaves us with a simple FW_FEATURE_OPALv3 define at the end that we can check against.
Anyone mad enough to do an OPALv4 gets to go look at all the things themselves.
Changes since V1:
- Fix missing ; in patch 1
- remove cpuinfo OPAL v1 line in patch 2 rather than 3
- keep FW_FEATURE_OPAL rather than FW_FEATURE_OPALv3
Stewart Smith (3):
powerpc/powernv: panic() on OPAL < V3
powerpc/powernv: Remove OPALv2 firmware define and references powerpc/powernv: remove FW_FEATURE_OPALv3 and just use FW_FEATURE_OPAL
arch/powerpc/include/asm/firmware.h | 5 +- arch/powerpc/platforms/powernv/eeh-powernv.c | 4 +- arch/powerpc/platforms/powernv/idle.c | 2 +- arch/powerpc/platforms/powernv/opal-xscom.c | 2 +- arch/powerpc/platforms/powernv/opal.c | 36 +++++--------- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- arch/powerpc/platforms/powernv/setup.c | 12 ++--- arch/powerpc/platforms/powernv/smp.c | 74 ++++++++++++---------------- drivers/cpufreq/powernv-cpufreq.c | 2 +- drivers/cpuidle/cpuidle-powernv.c | 2 +- 10 files changed, 56 insertions(+), 85 deletions(-)
Signature · 1 line
2.1.4
PATCH v2 1/3 powerpc/powernv: panic() on OPAL < V3
The OpenPower Abstraction Layer firmware went through a couple of iterations in the lab before being released. What we now know as OPAL advertises itself as OPALv3.
OPALv2 and OPALv1 never made it outside the lab, and the possibility of anyone at all ever building a mainline kernel today and expecting it to boot on such hardware is zero.
--- arch/powerpc/platforms/powernv/opal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/platforms/powernv/opal.c +1 -4
@@ -103,11 +103,8 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); - }else if (of_flat_dt_is_compatible (node,"ibm,opal-v2" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2; -pr_info ("OPAL V2 detected !\n" ); }else { -pr_info ("OPAL V1 detected !\n" ); +panic ("OPAL != V3 detected, no longer supported.\n" ); }/* Reinit all cores with the right endian */
Signature · 1 line
2.1.4
Michael Ellerman
reviewerRe: [v2,1/3] powerpc/powernv: panic() on OPAL < V3
Quoted 9 lines · Stewart Smith
The OpenPower Abstraction Layer firmware went through a couple of iterations in the lab before being released. What we now know as OPAL advertises itself as OPALv3.
OPALv2 and OPALv1 never made it outside the lab, and the possibility of anyone at all ever building a mainline kernel today and expecting it to boot on such hardware is zero.
Signed-off-by Stewart Smith <[email protected]>
Series applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/786842b62f81f20d14894925e8
cheers
PATCH v2 2/3 powerpc/powernv: Remove OPALv2 firmware define and references
In reply to Stewart SmithOPALv2 only ever existed in the lab and didn't escape to the world. All OPAL systems in the wild are OPALv3.
The probability of there being an OPALv2 system still powered on anywhere inside IBM is approximately zero, let alone anyone expecting to run mainline kernels.
So, start to remove references to OPALv2.
--- arch/powerpc/include/asm/firmware.h | 4 +--- arch/powerpc/platforms/powernv/opal.c | 8 ++------ arch/powerpc/platforms/powernv/setup.c | 4 ---- arch/powerpc/platforms/powernv/smp.c | 4 ++-- 4 files changed, 5 insertions(+), 15 deletions(-)
arch/powerpc/include/asm/firmware.h +1 -3
@@ -47,7 +47,6 @@#define FW_FEATURE_VPHN ASM_CONST(0x0000000004000000)#define FW_FEATURE_XCMO ASM_CONST(0x0000000008000000)#define FW_FEATURE_OPAL ASM_CONST(0x0000000010000000) -#define FW_FEATURE_OPALv2 ASM_CONST(0x0000000020000000)#define FW_FEATURE_SET_MODE ASM_CONST(0x0000000040000000)#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)
@@ -70,8 +69,7 @@ enum {FW_FEATURE_SET_MODE |FW_FEATURE_BEST_ENERGY |FW_FEATURE_TYPE1_AFFINITY |FW_FEATURE_PRRN ,FW_FEATURE_PSERIES_ALWAYS =0 , -FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv2 | - FW_FEATURE_OPALv3, +FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv3,FW_FEATURE_POWERNV_ALWAYS =0 ,FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
arch/powerpc/platforms/powernv/opal.c +2 -6
@@ -100,7 +100,6 @@ int __init early_init_dt_scan_opal(unsigned long node, powerpc_firmware_features |=FW_FEATURE_OPAL ;if (of_flat_dt_is_compatible (node,"ibm,opal-v3" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv2; powerpc_firmware_features |= FW_FEATURE_OPALv3;pr_info ("OPAL V3 detected !\n" ); }else {
@@ -349,7 +348,7 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)* enough room and be done with it */ spin_lock_irqsave (&opal_write_lock, flags); -if (firmware_has_feature (FW_FEATURE_OPALv2)) { +if (firmware_has_feature (FW_FEATURE_OPALv3)) { rc =opal_console_write_buffer_space (vtermno, &olen); len =be64_to_cpu (olen);if (rc || len < total_len) {
@@ -693,10 +692,7 @@ static int __init opal_init(void) }/* Register OPAL consoles if any ports */ -if (firmware_has_feature (FW_FEATURE_OPALv2)) - consoles =of_find_node_by_path ("/ibm,opal/consoles" ); -else - consoles =of_node_get (opal_node); + consoles =of_find_node_by_path ("/ibm,opal/consoles" );if (consoles) {for_each_child_of_node (consoles, np) {if (strcmp (np->name,"serial" ))
arch/powerpc/platforms/powernv/setup.c +0 -4
@@ -92,10 +92,6 @@ static void pnv_show_cpuinfo(struct seq_file *m)seq_printf (m,"machine\t\t: PowerNV %s\n" , model);if (firmware_has_feature (FW_FEATURE_OPALv3))seq_printf (m,"firmware\t: OPAL v3\n" ); -else if (firmware_has_feature (FW_FEATURE_OPALv2)) -seq_printf (m,"firmware\t: OPAL v2\n" ); -else if (firmware_has_feature (FW_FEATURE_OPAL )) -seq_printf (m,"firmware\t: OPAL v1\n" );else seq_printf (m,"firmware\t: BML\n" );of_node_put (root);
arch/powerpc/platforms/powernv/smp.c +2 -2
@@ -65,10 +65,10 @@ static int pnv_smp_kick_cpu(int nr)BUG_ON (nr <0 || nr >=NR_CPUS );/* -* If we already started or OPALv2 is not supported, we just +* If we already started or OPALv3 is not supported, we just * kick the CPU via the PACA */ -if (paca[nr].cpu_start || !firmware_has_feature (FW_FEATURE_OPALv2)) +if (paca[nr].cpu_start || !firmware_has_feature (FW_FEATURE_OPALv3)) goto kick;/*
Signature · 1 line
2.1.4
PATCH v2 3/3 powerpc/powernv: remove FW_FEATURE_OPALv3 and just use FW_FEATURE_OPAL
In reply to Stewart SmithLong ago, only in the lab, there was OPALv1 and OPALv2. Now there is just OPALv3, with nobody ever expecting anything on pre-OPALv3 to be cared about or supported by mainline kernels.
So, let's remove FW_FEATURE_OPALv3 and instead use FW_FEATURE_OPAL exclusively.
--- arch/powerpc/include/asm/firmware.h | 3 +- arch/powerpc/platforms/powernv/eeh-powernv.c | 4 +- arch/powerpc/platforms/powernv/idle.c | 2 +- arch/powerpc/platforms/powernv/opal-xscom.c | 2 +- arch/powerpc/platforms/powernv/opal.c | 25 +++++----- arch/powerpc/platforms/powernv/pci-ioda.c | 2 +- arch/powerpc/platforms/powernv/setup.c | 8 +-- arch/powerpc/platforms/powernv/smp.c | 74 ++++++++++++---------------- drivers/cpufreq/powernv-cpufreq.c | 2 +- drivers/cpuidle/cpuidle-powernv.c | 2 +- 10 files changed, 54 insertions(+), 70 deletions(-)
arch/powerpc/include/asm/firmware.h +1 -2
@@ -51,7 +51,6 @@#define FW_FEATURE_BEST_ENERGY ASM_CONST(0x0000000080000000)#define FW_FEATURE_TYPE1_AFFINITY ASM_CONST(0x0000000100000000)#define FW_FEATURE_PRRN ASM_CONST(0x0000000200000000) -#define FW_FEATURE_OPALv3 ASM_CONST(0x0000000400000000)#ifndef __ASSEMBLY__
@@ -69,7 +68,7 @@ enum {FW_FEATURE_SET_MODE |FW_FEATURE_BEST_ENERGY |FW_FEATURE_TYPE1_AFFINITY |FW_FEATURE_PRRN ,FW_FEATURE_PSERIES_ALWAYS =0 , -FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL | FW_FEATURE_OPALv3, +FW_FEATURE_POWERNV_POSSIBLE =FW_FEATURE_OPAL ,FW_FEATURE_POWERNV_ALWAYS =0 ,FW_FEATURE_PS3_POSSIBLE =FW_FEATURE_LPAR |FW_FEATURE_PS3_LV1 , FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
arch/powerpc/platforms/powernv/eeh-powernv.c +2 -2
@@ -48,8 +48,8 @@ static int pnv_eeh_init(void)struct pci_controller *hose;struct pnv_phb *phb; -if (!firmware_has_feature (FW_FEATURE_OPALv3)) { -pr_warn ("%s: OPALv3 is required !\n" , +if (!firmware_has_feature (FW_FEATURE_OPAL )) { +pr_warn ("%s: OPAL is required !\n" , __func__);return -EINVAL ; }
arch/powerpc/platforms/powernv/idle.c +1 -1
@@ -242,7 +242,7 @@ static int __init pnv_init_idle_states(void)if (cpuidle_disable !=IDLE_NO_OVERRIDE ) goto out; -if (!firmware_has_feature (FW_FEATURE_OPALv3)) +if (!firmware_has_feature (FW_FEATURE_OPAL )) goto out; power_mgt =of_find_node_by_path ("/ibm,opal/power-mgt" );
arch/powerpc/platforms/powernv/opal-xscom.c +1 -1
@@ -126,7 +126,7 @@ static const struct scom_controller opal_scom_controller = {static int opal_xscom_init (void ) { -if (firmware_has_feature (FW_FEATURE_OPALv3)) +if (firmware_has_feature (FW_FEATURE_OPAL ))scom_init (&opal_scom_controller);return 0 ; }
arch/powerpc/platforms/powernv/opal.c +11 -14
@@ -98,10 +98,9 @@ int __init early_init_dt_scan_opal(unsigned long node,pr_debug ("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n" , opal.size, sizep, runtimesz); - powerpc_firmware_features |=FW_FEATURE_OPAL ;if (of_flat_dt_is_compatible (node,"ibm,opal-v3" )) { - powerpc_firmware_features |= FW_FEATURE_OPALv3; -pr_info ("OPAL V3 detected !\n" ); + powerpc_firmware_features |=FW_FEATURE_OPAL ; +pr_info ("OPAL detected !\n" ); }else {panic ("OPAL != V3 detected, no longer supported.\n" ); }
@@ -348,17 +347,15 @@ int opal_put_chars(uint32_t vtermno, const char *data, int total_len)* enough room and be done with it */ spin_lock_irqsave (&opal_write_lock, flags); -if (firmware_has_feature (FW_FEATURE_OPALv3)) { - rc =opal_console_write_buffer_space (vtermno, &olen); - len =be64_to_cpu (olen); -if (rc || len < total_len) { -spin_unlock_irqrestore (&opal_write_lock, flags); -/* Closed -> drop characters */ -if (rc) -return total_len; -opal_poll_events (NULL ); -return -EAGAIN ; - } + rc =opal_console_write_buffer_space (vtermno, &olen); + len =be64_to_cpu (olen); +if (rc || len < total_len) { +spin_unlock_irqrestore (&opal_write_lock, flags); +/* Closed -> drop characters */ +if (rc) +return total_len; +opal_poll_events (NULL ); +return -EAGAIN ; }/* We still try to handle partial completions, though they
arch/powerpc/platforms/powernv/pci-ioda.c +1 -1
@@ -344,7 +344,7 @@ static void __init pnv_ioda_parse_m64_window(struct pnv_phb *phb)return ; } -if (!firmware_has_feature (FW_FEATURE_OPALv3)) { +if (!firmware_has_feature (FW_FEATURE_OPAL )) {pr_info (" Firmware too old to support M64 window\n" );return ; }
arch/powerpc/platforms/powernv/setup.c +4 -4
@@ -90,8 +90,8 @@ static void pnv_show_cpuinfo(struct seq_file *m)if (root) model =of_get_property (root,"model" ,NULL );seq_printf (m,"machine\t\t: PowerNV %s\n" , model); -if (firmware_has_feature (FW_FEATURE_OPALv3)) -seq_printf (m,"firmware\t: OPAL v3\n" ); +if (firmware_has_feature (FW_FEATURE_OPAL )) +seq_printf (m,"firmware\t: OPAL\n" );else seq_printf (m,"firmware\t: BML\n" );of_node_put (root);
@@ -220,9 +220,9 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary) {xics_kexec_teardown_cpu (secondary); -/* On OPAL v3, we return all CPUs to firmware */ +/* On OPAL, we return all CPUs to firmware */ -if (!firmware_has_feature (FW_FEATURE_OPALv3)) +if (!firmware_has_feature (FW_FEATURE_OPAL ))return ;if (secondary) {
arch/powerpc/platforms/powernv/smp.c +31 -43
100 lines not on this page · raw message
drivers/cpufreq/powernv-cpufreq.c +1 -1
@@ -586,7 +586,7 @@ static int __init powernv_cpufreq_init(void)int rc =0 ;/* Don't probe on pseries (guest) platforms */ -if (!firmware_has_feature (FW_FEATURE_OPALv3)) +if (!firmware_has_feature (FW_FEATURE_OPAL ))return -ENODEV ;/* Discover pstates from device tree and init */
drivers/cpuidle/cpuidle-powernv.c +1 -1
@@ -264,7 +264,7 @@ static int powernv_idle_probe(void)if (cpuidle_disable !=IDLE_NO_OVERRIDE )return -ENODEV ; -if (firmware_has_feature (FW_FEATURE_OPALv3)) { +if (firmware_has_feature (FW_FEATURE_OPAL )) { cpuidle_state_table = powernv_states;/* Device tree can indicate more idle states */ max_idle_state =powernv_add_idle_states ();
Signature · 1 line
2.1.4