On Tue, Feb 27, 2024 at 04:00:33AM +0800, Ethan Zhao wrote: > > + if (!dev || !dev_is_pci(dev)) > > + return -ETIMEDOUT; > > + pdev = to_pci_dev(dev); > > + if (!pci_device_is_present(pdev) && > > + ite_sid == pci_dev_id(pci_physfn(pdev))) > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > Unless the device_rbtree_find() is returning garbage then these things > > must be true. > > > > + return -ETIMEDOUT; > > > > I tried to double check how we were storing devices into the rbtree, > > but then I discovered that the device_rbtree_find() doesn't exist in > > linux-next and this patch breaks the build. > > > > This is very frustrating thing. But let's say a buggy BIOS could mess > > up the rbtree. In that situation, we would still want to change the && > > to an ||. If the divice is not present and^W or the rbtree is corrupted > > Maybe you meant > + if (!pci_device_is_present(pdev) || > + ite_sid != pci_dev_id(pci_physfn(pdev))) Yep, that's what I was asking. > > Unfortunately, the ite_sid we got from the "Invalidation Queue Error Record Register" is the *PCI Requester-id* of faulty device, that could be different > BDF as the sid in the ATS invalidation request for devices: > > 1. behind the PCIe to PCI bridges. > 2. behindConventional PCI Bridges 3.PCI Express* Devices Using Phantom > Functions 4.Intel® Scalable I/O Virtualization Capable Devices (e.g. ADI) > 5. devices with ARI function. > 6. behind root port without ACS enabled. > ... ... Fair enough... Thanks. regards, dan carpenter