Den fre 5 jan. 2024 kl 11:26 skrev Shinichiro Kawasaki <shinichiro.kawasaki@xxxxxxx>: > > On Jan 05, 2024 / 09:44, Lukas Wunner wrote: > > On Fri, Jan 05, 2024 at 08:18:05AM +0000, Shinichiro Kawasaki wrote: > > > --- a/drivers/platform/x86/p2sb.c > > > +++ b/drivers/platform/x86/p2sb.c > > > @@ -150,6 +153,14 @@ static int p2sb_cache_resources(void) > > > if (!bus) > > > return -ENODEV; > > > > > > + /* > > > + * When a device with same devfn exists and it is not P2SB, do not > > > + * touch it. > > > + */ > > > + pci_bus_read_config_dword(bus, devfn_p2sb, PCI_CLASS_REVISION, &class); > > > + if (!PCI_POSSIBLE_ERROR(class) && class >> 8 != P2SB_CLASS_CODE) > > > + return -ENODEV; > > > + > > > > The function should probably return if PCI_POSSIBLE_ERROR() is true. > > At this point, the P2SB device can be still hidden and PCI_POSSIBLE_ERROR() can > be true. In that case, the function should not return. > > > Also I think you can use PCI_CLASS_MEMORY_OTHER, so how about: > > > > if (PCI_POSSIBLE_ERROR(class) || class >> 16 != PCI_CLASS_MEMORY_OTHER) > > return -ENODEV; > > > > Can alternatively use "class >> 8 != PCI_CLASS_MEMORY_OTHER << 8" if you > > want to ensure the lowest byte is 0x00. > > Thanks, it looks the better to use PCI_CLASS_MEMORY_OTHER. Will reflect it when > I create the formal fix patch. Both of the variants seem to work for me. I tried the first patch on its own (059b825c5234), with if (!PCI_POSSIBLE_ERROR(class) && class >> 8 != P2SB_CLASS_CODE) return -ENODEV; Then Lukas' suggestion (b97584391ea7), with if (PCI_POSSIBLE_ERROR(class) || class >> 16 != PCI_CLASS_MEMORY_OTHER) return -ENODEV; Tested-by: Klara Modin <klarasmodin@xxxxxxxxx>
Attachment:
dmesg1.gz
Description: application/gzip
Attachment:
dmesg2.gz
Description: application/gzip