Page MenuHomeFreeBSD

D55426.id172486.diff
No OneTemporary

D55426.id172486.diff

diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c
--- a/sys/x86/x86/msi.c
+++ b/sys/x86/x86/msi.c
@@ -95,6 +95,15 @@
#define INTEL_DATA(msi) \
(MSI_INTEL_DATA_TRGREDG | MSI_INTEL_DATA_DELFIXED | (msi)->msi_vector)
+/* If in a VM with support for extended destination IDs, use them. */
+static int ext_dest_id = 0;
+SYSCTL_INT(_machdep, OID_AUTO, msi_ext_dest_id, CTLFLAG_RDTUN, &ext_dest_id, 0,
+ "Hypervisor advertises support for APIC Extended Destination IDs");
+#define INTEL_ADDR_EXT(msi) \
+ (MSI_INTEL_ADDR_BASE | ((msi)->msi_cpu & 0xff) << 12 | \
+ ((msi)->msi_cpu & 0x7f00) >> 3 | \
+ MSI_INTEL_ADDR_RH_OFF | MSI_INTEL_ADDR_DM_PHYSICAL)
+
static MALLOC_DEFINE(M_MSI, "msi", "PCI MSI");
/*
@@ -652,13 +661,15 @@
mtx_unlock(&msi_lock);
error = EOPNOTSUPP;
#endif
- if (error == EOPNOTSUPP && msi->msi_cpu > 0xff) {
+ if (error == EOPNOTSUPP &&
+ (msi->msi_cpu > 0x7fff ||
+ (msi->msi_cpu > 0xff && ext_dest_id == 0))) {
printf("%s: unsupported destination APIC ID %u\n", __func__,
msi->msi_cpu);
error = EINVAL;
}
if (error == EOPNOTSUPP) {
- *addr = INTEL_ADDR(msi);
+ *addr = ext_dest_id ? INTEL_ADDR_EXT(msi) : INTEL_ADDR(msi);
*data = INTEL_DATA(msi);
error = 0;
}

File Metadata

Mime Type
text/plain
Expires
Sat, Feb 28, 5:27 PM (8 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28969725
Default Alt Text
D55426.id172486.diff (1 KB)

Event Timeline