PCI: Add ACS quirk for Broadcom BCM5760X NIC
Subsystems (3)
Sasha Levin
maintainerPATCH 1/4 PCI: Add ACS quirk for Broadcom BCM5760X NIC
From: Ajit Khaparde <[email protected]>
[ Upstream commit 524e057b2d66b61f9b63b6db30467ab7b0bb4796 ]
The Broadcom BCM5760X NIC may be a multi-function device.
While it does not advertise an ACS capability, peer-to-peer transactions are not possible between the individual functions. So it is ok to treat them as fully isolated.
Add an ACS quirk for this device so the functions can be in independent IOMMU groups and attached individually to userspace applications using VFIO.
--- drivers/pci/quirks.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/pci/quirks.c +4 -0
@@ -4822,6 +4822,10 @@ static const struct pci_dev_acs_enabled { { PCI_VENDOR_ID_BROADCOM, 0x1750, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1751, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0x1752, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1760, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1761, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1762, pci_quirk_mf_endpoint_acs }, + { PCI_VENDOR_ID_BROADCOM, 0x1763, pci_quirk_mf_endpoint_acs }, { PCI_VENDOR_ID_BROADCOM, 0xD714, pci_quirk_brcm_acs }, { 0 } };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/4 PCI/AER: Disable AER service on suspend
From: Kai-Heng Feng <[email protected]>
[ Upstream commit 5afc2f763edc5daae4722ee46fea4e627d01fa90 ]
If the link is powered off during suspend, electrical noise may cause errors that are logged via AER. If the AER interrupt is enabled and shares an IRQ with PME, that causes a spurious wakeup during suspend.
Disable the AER interrupt during suspend to prevent this. Clear error status before re-enabling IRQ interrupts during resume so we don't get an interrupt for errors that occurred during the suspend/resume process.
--- drivers/pci/pcie/aer.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/pci/pcie/aer.c +18 -0
@@ -1509,6 +1509,22 @@ static int aer_probe(struct pcie_device *dev)return 0 ; } +static int aer_suspend (struct pcie_device *dev) +{ +struct aer_rpc *rpc =get_service_data (dev); + +aer_disable_rootport (rpc); +return 0 ; +} + +static int aer_resume (struct pcie_device *dev) +{ +struct aer_rpc *rpc =get_service_data (dev); + +aer_enable_rootport (rpc); +return 0 ; +} +/** * aer_root_reset - reset link on Root Port * @dev: pointer to Root Port's pci_dev data structure
@@ -1561,6 +1577,8 @@ static struct pcie_port_service_driver aerdriver = { .service = PCIE_PORT_SERVICE_AER, .probe = aer_probe, + .suspend = aer_suspend, + .resume = aer_resume, .remove = aer_remove, .error_resume = aer_error_resume, .reset_link = aer_root_reset,
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/4 PCI: Add missing bridge lock to pci_bus_lock()
In reply to Sasha LevinFrom: Dan Williams <[email protected]>
[ Upstream commit a4e772898f8bf2e7e1cf661a12c60a5612c4afab ]
One of the true positives that the cfg_access_lock lockdep effort identified is this sequence:
WARNING: CPU: 14 PID: 1 at drivers/pci/pci.c:4886 pci_bridge_secondary_bus_reset+0x5d/0x70 RIP: 0010:pci_bridge_secondary_bus_reset+0x5d/0x70 Call Trace: <TASK> ? __warn+0x8c/0x190 ? pci_bridge_secondary_bus_reset+0x5d/0x70 ? report_bug+0x1f8/0x200 ? handle_bug+0x3c/0x70 ? exc_invalid_op+0x18/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? pci_bridge_secondary_bus_reset+0x5d/0x70 pci_reset_bus+0x1d8/0x270 vmd_probe+0x778/0xa10 pci_device_probe+0x95/0x120
Where pci_reset_bus() users are triggering unlocked secondary bus resets. Ironically pci_bus_reset(), several calls down from pci_reset_bus(), uses pci_bus_lock() before issuing the reset which locks everything *but* the bridge itself.
For the same motivation as adding:
bridge = pci_upstream_bridge(dev);
if (bridge)
pci_dev_lock(bridge);to pci_reset_function() for the "bus" and "cxl_bus" reset cases, add pci_dev_lock() for @bus->self to pci_bus_lock().
[bhelgaas: squash in recursive locking deadlock fix from Keith Busch:
https://lore.kernel.org/r/[email protected]]
--- drivers/pci/pci.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-)
drivers/pci/pci.c +21 -14
@@ -4957,10 +4957,12 @@ static void pci_bus_lock(struct pci_bus *bus) {struct pci_dev *dev; +pci_dev_lock (bus->self);list_for_each_entry (dev, &bus->devices, bus_list) { -pci_dev_lock (dev);if (dev->subordinate)pci_bus_lock (dev->subordinate); +else +pci_dev_lock (dev); } }
@@ -4972,8 +4974,10 @@ static void pci_bus_unlock(struct pci_bus *bus)list_for_each_entry (dev, &bus->devices, bus_list) {if (dev->subordinate)pci_bus_unlock (dev->subordinate); -pci_dev_unlock (dev); +else +pci_dev_unlock (dev); } +pci_dev_unlock (bus->self); }/* Return 1 on successful lock, 0 on contention */
@@ -4981,15 +4985,15 @@ static int pci_bus_trylock(struct pci_bus *bus) {struct pci_dev *dev; +if (!pci_dev_trylock (bus->self)) +return 0 ; +list_for_each_entry (dev, &bus->devices, bus_list) { -if (!pci_dev_trylock (dev)) - goto unlock;if (dev->subordinate) { -if (!pci_bus_trylock (dev->subordinate)) { -pci_dev_unlock (dev); +if (!pci_bus_trylock (dev->subordinate)) goto unlock; - } - } + }else if (!pci_dev_trylock (dev)) + goto unlock; }return 1 ;
@@ -4997,8 +5001,10 @@ static int pci_bus_trylock(struct pci_bus *bus)list_for_each_entry_continue_reverse (dev, &bus->devices, bus_list) {if (dev->subordinate)pci_bus_unlock (dev->subordinate); -pci_dev_unlock (dev); +else +pci_dev_unlock (dev); } +pci_dev_unlock (bus->self);return 0 ; }
@@ -5030,9 +5036,10 @@ static void pci_slot_lock(struct pci_slot *slot)list_for_each_entry (dev, &slot->bus->devices, bus_list) {if (!dev->slot || dev->slot != slot)continue ; -pci_dev_lock (dev);if (dev->subordinate)pci_bus_lock (dev->subordinate); +else +pci_dev_lock (dev); } }
@@ -5058,14 +5065,13 @@ static int pci_slot_trylock(struct pci_slot *slot)list_for_each_entry (dev, &slot->bus->devices, bus_list) {if (!dev->slot || dev->slot != slot)continue ; -if (!pci_dev_trylock (dev)) - goto unlock;if (dev->subordinate) {if (!pci_bus_trylock (dev->subordinate)) {pci_dev_unlock (dev); goto unlock; } - } + }else if (!pci_dev_trylock (dev)) + goto unlock; }return 1 ;
@@ -5076,7 +5082,8 @@ static int pci_slot_trylock(struct pci_slot *slot)continue ;if (dev->subordinate)pci_bus_unlock (dev->subordinate); -pci_dev_unlock (dev); +else +pci_dev_unlock (dev); }return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/4 ALSA: usb: Fix UBSAN warning in parse_audio_unit()
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2f38cf730caedaeacdefb7ff35b0a3c1168117f9 ]
A malformed USB descriptor may pass the lengthy mixer description with a lot of channels, and this may overflow the 32bit integer shift size, as caught by syzbot UBSAN test. Although this won't cause any real trouble, it's better to address.
This patch introduces a sanity check of the number of channels to bail out the parsing when too many channels are found.
--- sound/usb/mixer.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/usb/mixer.c +7 -0
@@ -1921,6 +1921,13 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, bmaControls = ftr->bmaControls; } +if (channels >32 ) { +usb_audio_info (state->chip, +"usbmixer: too many channels (%d) in unit %d\n" , + channels, unitid); +return -EINVAL ; + } +/* parse the source unit */ err =parse_audio_unit (state, hdr->bSourceID);if (err <0 )
Signature · 1 line
2.43.0