mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-10 12:32:45 +00:00
hv: Enumerate IOAPIC info from DMAR table
IOAPIC info from DMAR table is needed to match the IOAPIC info from MADT. This patch adds support to get id and bus, devfn for IOAPIC from DMAR. IOAPIC info for SBL platform is hardcoded in the header file. Tracked-On: #2426 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com> Reviewed-by: Binbin Wu <binbin.wu@intel.com>
This commit is contained in:
parent
4ff9f5dfb2
commit
cb46937bf5
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
},
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user