platform/x86: p2sb: Don't fail if unknown CPU is found
PATCH 1/1 platform/x86: p2sb: Don't fail if unknown CPU is found
We have accessing P2SB from a very few places for quite known hardware.
When a new SoC appears in intel-family.h it's not obvious that it needs to be added to p2sb.c as well. Instead, provide default BDF and refactor p2sb_get_devfn() to always succeed. If in the future we would need to exclude something, we may add a list of unsupported IDs.
Without this change the iTCO on Intel Commet Lake SoCs became unavailable:
i801_smbus 0000:00:1f.4: failed to create iTCO device
--- drivers/platform/x86/p2sb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/platform/x86/p2sb.c +6 -9
@@ -19,26 +19,23 @@#define P2SBC 0xe0#define P2SBC_HIDE BIT(8) +#define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1) +static const struct x86_cpu_id p2sb_cpu_ids[] = {X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT ,PCI_DEVFN (13 ,0 )), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT_D ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_SILVERMONT_D ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE_L ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE_L ,PCI_DEVFN (31 ,1 )), {} };static int p2sb_get_devfn (unsigned int *devfn) { +unsigned int fn =P2SB_DEVFN_DEFAULT ;const struct x86_cpu_id *id; id =x86_match_cpu (p2sb_cpu_ids); -if (!id) -return -ENODEV ; +if (id) + fn = (unsigned int )id->driver_data; - *devfn = (unsigned int )id->driver_data; + *devfn = fn;return 0 ; }
Signature · 1 line
2.35.1
[Public]
Quoted 11 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, November 4, 2022 10:49
To: Hans de Goede <[email protected]>; Andy Shevchenko <[email protected]>; platform-driver- [email protected]; [email protected]
Cc: Mark Gross <[email protected]>; Jarkko Nikula <[email protected]>
Subject: [PATCH v1 1/1] platform/x86: p2sb: Don't fail if unknown CPU is found
Quoted 8 lines
We have accessing P2SB from a very few places for quite known hardware.
When a new SoC appears in
intel-family.hit's not obvious that it needs to be added top2sb.cas well. Instead, provide default BDF and refactorp2sb_get_devfn()to always succeed. If in the future we would need to exclude something, we may add a list of unsupported IDs.Without this change the iTCO on Intel Commet Lake SoCs became
Isn't it "Comet Lake"?
Quoted 57 lines
unavailable:
i801_smbus0000:00:1f.4: failed to create iTCO deviceFixes 5c7b9167ddf8 ("i2c: i801: convert to use common P2SB accessor")Reported-by Jarkko Nikula <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/platform/x86/p2sb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)drivers/platform/x86/p2sb.c +6
-10@@ -19,26 +19,23 @@#define P2SBC 0xe0#define P2SBC_HIDE BIT(8) +#define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1) +static const struct x86_cpu_id p2sb_cpu_ids[] = {X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT ,PCI_DEVFN (13 ,0 )), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT_D , PCI_DEVFN(31, 1)), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_SILVERMONT_D , PCI_DEVFN(31, 1)), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE , PCI_DEVFN(31, 1)), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE_L , PCI_DEVFN(31, 1)), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE , PCI_DEVFN(31, 1)), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE_L , PCI_DEVFN(31, 1)), {} };static int p2sb_get_devfn (unsigned int *devfn) { +unsigned int fn =P2SB_DEVFN_DEFAULT ;const struct x86_cpu_id *id; id =x86_match_cpu (p2sb_cpu_ids); -if (!id) -return -ENODEV ; +if (id) + fn = (unsigned int )id->driver_data; - *devfn = (unsigned int )id->driver_data; + *devfn = fn;return 0 ; } --2.35.1
Quoted 3 lines · Mario
Quoted 3 lines
-----Original Message-----
From: Andy Shevchenko <[email protected]>
Sent: Friday, November 4, 2022 10:49
...
Quoted 10 lines
Quoted 8 lines
We have accessing P2SB from a very few places for quite known hardware.
When a new SoC appears in
intel-family.hit's not obvious that it needs to be added top2sb.cas well. Instead, provide default BDF and refactorp2sb_get_devfn()to always succeed. If in the future we would need to exclude something, we may add a list of unsupported IDs.Without this change the iTCO on Intel Commet Lake SoCs became
Isn't it "Comet Lake"?
Right, thanks!
In any case I would like to have Jarkko's Tested-by before proceeding with this. Hence v2 is warranted to appear.
Quoted 3 lines
Quoted 3 lines
unavailable:
i801_smbus0000:00:1f.4: failed to create iTCO device
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jarkko Nikula
Tested-byHi
Quoted 8 lines · Andy Shevchenko
Quoted 1 line · Mario
Isn't it "Comet Lake"?
Right, thanks!
In any case I would like to have Jarkko's Tested-by before proceeding with this. Hence v2 is warranted to appear.
Yes, iTCO registration works again with this patch and is functioning, i.e. able to reset the machine.
Hi,
Quoted 7 lines · Andy Shevchenko
We have accessing P2SB from a very few places for quite known hardware.
When a new SoC appears in
intel-family.hit's not obvious that it needs to be added top2sb.cas well. Instead, provide default BDF and refactorp2sb_get_devfn()to always succeed. If in the future we would need to exclude something, we may add a list of unsupported IDs.
Quoted 7 lines
Without this change the iTCO on Intel Commet Lake SoCs became unavailable:
i801_smbus0000:00:1f.4: failed to create iTCO deviceFixes 5c7b9167ddf8 ("i2c: i801: convert to use common P2SB accessor")Reported-by Jarkko Nikula <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Thanks. I've merged this now, with the Commet Lake spelling error fixed and with Jarko's Tested-by added.
I'll include this in my upcoming fixes pull-req to Linus.
Regards,
Hans
Quoted 41 lines
--- drivers/platform/x86/p2sb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)drivers/platform/x86/p2sb.c +6
-9@@ -19,26 +19,23 @@#define P2SBC 0xe0#define P2SBC_HIDE BIT(8) +#define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1) +static const struct x86_cpu_id p2sb_cpu_ids[] = {X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT ,PCI_DEVFN (13 ,0 )), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_GOLDMONT_D ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (ATOM_SILVERMONT_D ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (KABYLAKE_L ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE ,PCI_DEVFN (31 ,1 )), -X86_MATCH_INTEL_FAM6_MODEL (SKYLAKE_L ,PCI_DEVFN (31 ,1 )), {} };static int p2sb_get_devfn (unsigned int *devfn) { +unsigned int fn =P2SB_DEVFN_DEFAULT ;const struct x86_cpu_id *id; id =x86_match_cpu (p2sb_cpu_ids); -if (!id) -return -ENODEV ; +if (id) + fn = (unsigned int )id->driver_data; - *devfn = (unsigned int )id->driver_data; + *devfn = fn;return 0 ; }