diff --git a/hypervisor/boot/dmar_parse.c b/hypervisor/boot/dmar_parse.c index 71323d7b3..7da0410c1 100644 --- a/hypervisor/boot/dmar_parse.c +++ b/hypervisor/boot/dmar_parse.c @@ -19,16 +19,6 @@ enum acpi_dmar_type { ACPI_DMAR_TYPE_RESERVED = 5 }; -/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */ -enum acpi_dmar_scope_type { - ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, - ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, - ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, - ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, - ACPI_DMAR_SCOPE_TYPE_HPET = 4, - ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, - ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ -}; struct acpi_table_dmar { /* Common ACPI table header */ @@ -198,6 +188,8 @@ handle_dmar_devscope(struct dmar_dev_scope *dev_scope, sizeof(struct acpi_dmar_pci_path); bdf = dmar_path_bdf(path_len, apci_devscope->bus, path); + dev_scope->id = apci_devscope->enumeration_id; + dev_scope->type = apci_devscope->entry_type; dev_scope->bus = (bdf >> 8U) & 0xffU; dev_scope->devfun = bdf & 0xffU; @@ -217,9 +209,8 @@ get_drhd_dev_scope_cnt(struct acpi_dmar_hardware_unit *drhd) while (start < end) { scope = (struct acpi_dmar_device_scope *)start; - if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_ENDPOINT || - scope->entry_type == ACPI_DMAR_SCOPE_TYPE_BRIDGE || - scope->entry_type == ACPI_DMAR_SCOPE_TYPE_NAMESPACE) + if ((scope->entry_type != ACPI_DMAR_SCOPE_TYPE_NOT_USED) && + (scope->entry_type < ACPI_DMAR_SCOPE_TYPE_RESERVED)) count++; start += scope->length; } @@ -240,12 +231,6 @@ handle_one_drhd(struct acpi_dmar_hardware_unit *acpi_drhd, drhd->flags = acpi_drhd->flags; drhd->reg_base_addr = acpi_drhd->address; - if (drhd->flags & DRHD_FLAG_INCLUDE_PCI_ALL_MASK) { - drhd->dev_cnt = 0; - drhd->devices = NULL; - return 0; - } - dev_count = get_drhd_dev_scope_cnt(acpi_drhd); drhd->dev_cnt = dev_count; if (dev_count) { @@ -280,9 +265,10 @@ handle_one_drhd(struct acpi_dmar_hardware_unit *acpi_drhd, remaining -= consumed; /* skip IOAPIC & HPET */ ads = (struct acpi_dmar_device_scope *)cp; - if (ads->entry_type != ACPI_DMAR_SCOPE_TYPE_IOAPIC && - ads->entry_type != ACPI_DMAR_SCOPE_TYPE_HPET) + if ((ads->entry_type != ACPI_DMAR_SCOPE_TYPE_NOT_USED) && + (ads->entry_type < ACPI_DMAR_SCOPE_TYPE_RESERVED)) { dev_scope++; + } else pr_dbg("drhd: skip dev_scope type %d", ads->entry_type); diff --git a/hypervisor/bsp/include/sbl/platform_acpi_info.h b/hypervisor/bsp/include/sbl/platform_acpi_info.h index 934dc0bc7..9a73dc640 100644 --- a/hypervisor/bsp/include/sbl/platform_acpi_info.h +++ b/hypervisor/bsp/include/sbl/platform_acpi_info.h @@ -37,19 +37,20 @@ #define DRHD0_DEVSCOPE3_BUS 0U #define DRHD0_DEVSCOPE3_PATH 0U -#define DRHD1_DEV_CNT 0U +#define DRHD1_DEV_CNT 1U #define DRHD1_SEGMENT 0U #define DRHD1_FLAGS DRHD_FLAG_INCLUDE_PCI_ALL_MASK #define DRHD1_REG_BASE 0xFED65000UL #define DRHD1_IGNORE false -#define DRHD1_DEVSCOPE0_BUS 0U -#define DRHD1_DEVSCOPE0_PATH 0U +#define DRHD1_DEVSCOPE0_BUS 0xFAU +#define DRHD1_DEVSCOPE0_PATH 0xF8U #define DRHD1_DEVSCOPE1_BUS 0U #define DRHD1_DEVSCOPE1_PATH 0U #define DRHD1_DEVSCOPE2_BUS 0U #define DRHD1_DEVSCOPE2_PATH 0U #define DRHD1_DEVSCOPE3_BUS 0U #define DRHD1_DEVSCOPE3_PATH 0U +#define DRHD1_IOAPIC_ID 8U #define DRHD2_DEV_CNT 0U #define DRHD2_SEGMENT 0U diff --git a/hypervisor/bsp/sbl/const_dmar.c b/hypervisor/bsp/sbl/const_dmar.c index dfebb8999..41c87b5ab 100644 --- a/hypervisor/bsp/sbl/const_dmar.c +++ b/hypervisor/bsp/sbl/const_dmar.c @@ -32,6 +32,8 @@ static struct dmar_dev_scope drhd0_dev_scope[MAX_DRHD_DEVSCOPES] = { static struct dmar_dev_scope drhd1_dev_scope[MAX_DRHD_DEVSCOPES] = { { + .type = ACPI_DMAR_SCOPE_TYPE_IOAPIC, + .id = DRHD1_IOAPIC_ID, .bus = DRHD1_DEVSCOPE0_BUS, .devfun = DRHD1_DEVSCOPE0_PATH }, diff --git a/hypervisor/include/arch/x86/vtd.h b/hypervisor/include/arch/x86/vtd.h index af4c56ffc..7dd244bf8 100644 --- a/hypervisor/include/arch/x86/vtd.h +++ b/hypervisor/include/arch/x86/vtd.h @@ -35,6 +35,17 @@ #define DMAR_ICS_REG 0x9cU /* Invalidation complete status register */ #define DMAR_IRTA_REG 0xb8U /* Interrupt remapping table addr register */ +/* Values for entry_type in ACPI_DMAR_DEVICE_SCOPE - device types */ +enum acpi_dmar_scope_type { + ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0, + ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1, + ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2, + ACPI_DMAR_SCOPE_TYPE_IOAPIC = 3, + ACPI_DMAR_SCOPE_TYPE_HPET = 4, + ACPI_DMAR_SCOPE_TYPE_NAMESPACE = 5, + ACPI_DMAR_SCOPE_TYPE_RESERVED = 6 /* 6 and greater are reserved */ +}; + static inline uint8_t dmar_ver_major(uint64_t version) { return (((uint8_t)version & 0xf0U) >> 4U); @@ -442,6 +453,8 @@ static inline uint16_t dma_frcd_up_sid(uint64_t up_sid) #define DEVFUN(dev, fun) (((dev & 0x1FU) << 3U) | ((fun & 0x7U))) struct dmar_dev_scope { + enum acpi_dmar_scope_type type; + uint8_t id; uint8_t bus; uint8_t devfun; };