git: 82281715ef2f - main - puc: be more careful about using MSI
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 12 Sep 2026 21:58:42 UTC
The branch main has been updated by nprice:
URL: https://cgit.FreeBSD.org/src/commit/?id=82281715ef2f08f873a19340c3d00ef7fa9bf728
commit 82281715ef2f08f873a19340c3d00ef7fa9bf728
Author: Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-09-12 21:58:10 +0000
Commit: Nick Price <nprice@FreeBSD.org>
CommitDate: 2026-09-12 21:58:16 +0000
puc: be more careful about using MSI
puc has preferred MSI for every card since MSI support was added, with
only a global tunable to opt out. uart(4) makes the same decision for
the serial devices it attaches directly, and has since grown two
defences: it skips MSI unless the device advertises exactly one vector,
because attaching a single instance to a device offering many has caused
problems (PR 235016), and it lets individual devices be flagged when
they claim MSI support that does not work.
Adopt both.
Approved by: adrian (mentor)
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D59623
Signed-off-by: Nick Price <nprice@FreeBSD.org>
---
sys/dev/puc/puc_cfg.h | 4 ++++
sys/dev/puc/puc_pci.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/sys/dev/puc/puc_cfg.h b/sys/dev/puc/puc_cfg.h
index 962ab86fe6d3..7c6aa74a427a 100644
--- a/sys/dev/puc/puc_cfg.h
+++ b/sys/dev/puc/puc_cfg.h
@@ -52,6 +52,9 @@
#define PUC_ILR_DIGI 1
#define PUC_ILR_QUATECH 2
+/* Configuration flags. */
+#define PUC_FLAGS_NO_MSI 0x01
+
/* Configuration queries. */
enum puc_cfg_cmd {
PUC_CFG_GET_CLOCK,
@@ -80,6 +83,7 @@ struct puc_cfg {
int8_t rid; /* Rid of first port */
int8_t d_rid; /* Delta rid of next ports */
int8_t d_ofs; /* Delta offset of next ports */
+ uint8_t flags; /* PUC_FLAGS_* */
puc_config_f *config_function;
};
diff --git a/sys/dev/puc/puc_pci.c b/sys/dev/puc/puc_pci.c
index 9709a606fb44..a15b6f643fb2 100644
--- a/sys/dev/puc/puc_pci.c
+++ b/sys/dev/puc/puc_pci.c
@@ -133,7 +133,9 @@ puc_pci_attach(device_t dev)
sc = device_get_softc(dev);
- if (!puc_msi_disable) {
+ if (!puc_msi_disable &&
+ (sc->sc_cfg->flags & PUC_FLAGS_NO_MSI) == 0 &&
+ pci_msi_count(dev) == 1) {
count = 1;
if (pci_alloc_msi(dev, &count) == 0) {