From e90f6988d8dc9a910a849937a4c0c054b65d3903 Mon Sep 17 00:00:00 2001 From: Christian Helmuth Date: Thu, 23 May 2024 17:04:16 +0200 Subject: [PATCH] pci_decode: disable MSI/MSI-X capabilities Default disabled initialization prevents follow-up errors if one capability is already enabled on boot, but platform_drv decides to enable the other one. The PCI spec explicitly states that "Behavior is undefined if both MSI and MSI-X are enabled simultaneously". Fixes #5228 --- repos/os/src/app/pci_decode/main.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/repos/os/src/app/pci_decode/main.cc b/repos/os/src/app/pci_decode/main.cc index b9ec181280..b46d299e78 100644 --- a/repos/os/src/app/pci_decode/main.cc +++ b/repos/os/src/app/pci_decode/main.cc @@ -145,6 +145,10 @@ bus_t Main::parse_pci_function(Bdf bdf, bool msi_x = cfg.msi_x_cap.constructed(); irq_pin_t irq_pin = cfg.read(); + /* disable MSI/MSI-X by default */ + if (msi) cfg.msi_cap->write(0); + if (msi_x) cfg.msi_x_cap->write(0); + gen.node("device", [&] { auto string = [&] (uint64_t v) { return String<16>(Hex(v)); };