[PATCH kernel 8/9] RFC: PCI: Avoid needless touching of Command register
From: Alexey Kardashevskiy
Date: Wed Feb 25 2026 - 00:43:56 EST
Once locked, a TDI's MSE and BME are not allowed to be cleared.
Skip INTx test as TEE-capable PCI functions are most likely IOV VFs
anyway and those do not support INTx at all.
Add a quirk preventing the probing code from disabling MSE when
updating 64bit BAR (which cannot be done atomically).
Note that normally this happens too early and likely not really
needed for the device attestation happening long after PCI probing.
Signed-off-by: Alexey Kardashevskiy <aik@xxxxxxx>
---
This is also handled in QEMU - it will block clearing BME and MSE
(normally happening on modprobe/rmmod) as long as the TDI is
CONFIG_LOCKED or RUN.
This only patch is not enough but reduces the number of unwanted
writes to MSE/BME.
Also, SRIOV cannot have INTx so pci_intx_mask_broken() could skip
VFs too, should it?
---
drivers/pci/probe.c | 5 +++++
drivers/pci/quirks.c | 9 +++++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 4c3aec1fd53e..cc0613e7c905 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1930,6 +1930,11 @@ static int pci_intx_mask_broken(struct pci_dev *dev)
{
u16 orig, toggle, new;
+ if (dev->devcap & PCI_EXP_DEVCAP_TEE) {
+ pci_warn_once(dev, "(TIO) Disable check for broken INTX");
+ return 1;
+ }
+
pci_read_config_word(dev, PCI_COMMAND, &orig);
toggle = orig ^ PCI_COMMAND_INTX_DISABLE;
pci_write_config_word(dev, PCI_COMMAND, toggle);
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 214ed060ca1b..b875859699ba 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -316,6 +316,15 @@ static void quirk_mmio_always_on(struct pci_dev *dev)
DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_ANY_ID, PCI_ANY_ID,
PCI_CLASS_BRIDGE_HOST, 8, quirk_mmio_always_on);
+static void quirk_mmio_tio_always_on(struct pci_dev *dev)
+{
+ if (dev->devcap & PCI_EXP_DEVCAP_TEE) {
+ pci_info(dev, "(TIO) quirk: MMIO always On");
+ dev->mmio_always_on = 1;
+ }
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, quirk_mmio_tio_always_on);
+
/*
* The Mellanox Tavor device gives false positive parity errors. Disable
* parity error reporting.
--
2.52.0