Skip to content

Commit 7639afa

Browse files
committed
Merge tag 'pci-v5.15-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fixes from Bjorn Helgaas: - Defer VPD sizing until we actually need the contents; fixes a boot-time slowdown reported by Dave Jones (Bjorn Helgaas) - Stop clobbering OF fwnodes when we look for an ACPI fwnode; fixes a virtio-iommu boot regression (Jean-Philippe Brucker) - Add AMD GPU multi-function power dependencies; fixes runtime power management, including GPU resume and temp and fan sensor issues (Evan Quan) - Update VMD maintainer to Nirmal Patel (Jon Derrick) * tag 'pci-v5.15-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: MAINTAINERS: Add Nirmal Patel as VMD maintainer PCI: Add AMD GPU multi-function power dependencies PCI/ACPI: Don't reset a fwnode set by OF PCI/VPD: Defer VPD sizing until first access
2 parents ddf21bd + e042a45 commit 7639afa

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14342,7 +14342,8 @@ F: Documentation/devicetree/bindings/pci/intel,ixp4xx-pci.yaml
1434214342
F: drivers/pci/controller/pci-ixp4xx.c
1434314343

1434414344
PCI DRIVER FOR INTEL VOLUME MANAGEMENT DEVICE (VMD)
14345-
M: Jonathan Derrick <jonathan.derrick@intel.com>
14345+
M: Nirmal Patel <nirmal.patel@linux.intel.com>
14346+
R: Jonathan Derrick <jonathan.derrick@linux.dev>
1434614347
L: linux-pci@vger.kernel.org
1434714348
S: Supported
1434814349
F: drivers/pci/controller/vmd.c

drivers/pci/pci-acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ static struct acpi_device *acpi_pci_find_companion(struct device *dev);
937937

938938
void pci_set_acpi_fwnode(struct pci_dev *dev)
939939
{
940-
if (!ACPI_COMPANION(&dev->dev) && !pci_dev_is_added(dev))
940+
if (!dev_fwnode(&dev->dev) && !pci_dev_is_added(dev))
941941
ACPI_COMPANION_SET(&dev->dev,
942942
acpi_pci_find_companion(&dev->dev));
943943
}

drivers/pci/quirks.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5435,7 +5435,7 @@ DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
54355435
PCI_CLASS_MULTIMEDIA_HD_AUDIO, 8, quirk_gpu_hda);
54365436

54375437
/*
5438-
* Create device link for NVIDIA GPU with integrated USB xHCI Host
5438+
* Create device link for GPUs with integrated USB xHCI Host
54395439
* controller to VGA.
54405440
*/
54415441
static void quirk_gpu_usb(struct pci_dev *usb)
@@ -5444,9 +5444,11 @@ static void quirk_gpu_usb(struct pci_dev *usb)
54445444
}
54455445
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
54465446
PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
5447+
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
5448+
PCI_CLASS_SERIAL_USB, 8, quirk_gpu_usb);
54475449

54485450
/*
5449-
* Create device link for NVIDIA GPU with integrated Type-C UCSI controller
5451+
* Create device link for GPUs with integrated Type-C UCSI controller
54505452
* to VGA. Currently there is no class code defined for UCSI device over PCI
54515453
* so using UNKNOWN class for now and it will be updated when UCSI
54525454
* over PCI gets a class code.
@@ -5459,6 +5461,9 @@ static void quirk_gpu_usb_typec_ucsi(struct pci_dev *ucsi)
54595461
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
54605462
PCI_CLASS_SERIAL_UNKNOWN, 8,
54615463
quirk_gpu_usb_typec_ucsi);
5464+
DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_VENDOR_ID_ATI, PCI_ANY_ID,
5465+
PCI_CLASS_SERIAL_UNKNOWN, 8,
5466+
quirk_gpu_usb_typec_ucsi);
54625467

54635468
/*
54645469
* Enable the NVIDIA GPU integrated HDA controller if the BIOS left it

drivers/pci/vpd.c

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,24 @@ static size_t pci_vpd_size(struct pci_dev *dev)
9999
return off ?: PCI_VPD_SZ_INVALID;
100100
}
101101

102+
static bool pci_vpd_available(struct pci_dev *dev)
103+
{
104+
struct pci_vpd *vpd = &dev->vpd;
105+
106+
if (!vpd->cap)
107+
return false;
108+
109+
if (vpd->len == 0) {
110+
vpd->len = pci_vpd_size(dev);
111+
if (vpd->len == PCI_VPD_SZ_INVALID) {
112+
vpd->cap = 0;
113+
return false;
114+
}
115+
}
116+
117+
return true;
118+
}
119+
102120
/*
103121
* Wait for last operation to complete.
104122
* This code has to spin since there is no other notification from the PCI
@@ -145,7 +163,7 @@ static ssize_t pci_vpd_read(struct pci_dev *dev, loff_t pos, size_t count,
145163
loff_t end = pos + count;
146164
u8 *buf = arg;
147165

148-
if (!vpd->cap)
166+
if (!pci_vpd_available(dev))
149167
return -ENODEV;
150168

151169
if (pos < 0)
@@ -206,7 +224,7 @@ static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count,
206224
loff_t end = pos + count;
207225
int ret = 0;
208226

209-
if (!vpd->cap)
227+
if (!pci_vpd_available(dev))
210228
return -ENODEV;
211229

212230
if (pos < 0 || (pos & 3) || (count & 3))
@@ -242,14 +260,11 @@ static ssize_t pci_vpd_write(struct pci_dev *dev, loff_t pos, size_t count,
242260

243261
void pci_vpd_init(struct pci_dev *dev)
244262
{
263+
if (dev->vpd.len == PCI_VPD_SZ_INVALID)
264+
return;
265+
245266
dev->vpd.cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
246267
mutex_init(&dev->vpd.lock);
247-
248-
if (!dev->vpd.len)
249-
dev->vpd.len = pci_vpd_size(dev);
250-
251-
if (dev->vpd.len == PCI_VPD_SZ_INVALID)
252-
dev->vpd.cap = 0;
253268
}
254269

255270
static ssize_t vpd_read(struct file *filp, struct kobject *kobj,
@@ -294,13 +309,14 @@ const struct attribute_group pci_dev_vpd_attr_group = {
294309

295310
void *pci_vpd_alloc(struct pci_dev *dev, unsigned int *size)
296311
{
297-
unsigned int len = dev->vpd.len;
312+
unsigned int len;
298313
void *buf;
299314
int cnt;
300315

301-
if (!dev->vpd.cap)
316+
if (!pci_vpd_available(dev))
302317
return ERR_PTR(-ENODEV);
303318

319+
len = dev->vpd.len;
304320
buf = kmalloc(len, GFP_KERNEL);
305321
if (!buf)
306322
return ERR_PTR(-ENOMEM);

0 commit comments

Comments
 (0)