drivers/interrupt_controller: Add source id to VT-D interrupt remap

Change the API and apply that change where relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2021-04-06 13:29:27 +02:00 committed by Anas Nashif
commit 4090962386
4 changed files with 28 additions and 6 deletions

View file

@ -346,7 +346,8 @@ static uint32_t vtd_ictl_remap_msi(const struct device *dev,
static int vtd_ictl_remap(const struct device *dev,
uint8_t irte_idx,
uint16_t vector,
uint32_t flags)
uint32_t flags,
uint16_t src_id)
{
struct vtd_ictl_data *data = dev->data;
union vtd_irte irte = { 0 };
@ -362,6 +363,11 @@ static int vtd_ictl_remap(const struct device *dev,
irte.bits.dst_id = 0xFF << 8;
}
if (src_id != USHRT_MAX) {
irte.bits.src_validation_type = 1;
irte.bits.src_id = src_id;
}
delivery_mode = (flags & IOAPIC_DELIVERY_MODE_MASK);
if ((delivery_mode != IOAPIC_FIXED) ||
(delivery_mode != IOAPIC_LOW)) {

View file

@ -120,8 +120,11 @@ static void IoApicRedUpdateLo(unsigned int irq, uint32_t value,
!defined(CONFIG_INTEL_VTD_ICTL_XAPIC_PASSTHROUGH)
#include <drivers/interrupt_controller/intel_vtd.h>
#include <arch/x86/acpi.h>
static const struct device *vtd;
static uint16_t ioapic_id;
static bool get_vtd(void)
{
@ -137,6 +140,8 @@ static bool get_vtd(void)
#define DT_DRV_COMPAT DRV_COMPAT_BAK
#undef DRV_COMPAT_BAK
ioapic_id = z_acpi_get_dev_id_from_dmar(ACPI_DRHD_DEV_SCOPE_IOAPIC);
return vtd == NULL ? false : true;
}
#endif /* CONFIG_INTEL_VTD_ICTL && !INTEL_VTD_ICTL_XAPIC_PASSTHROUGH */
@ -400,7 +405,7 @@ void z_ioapic_irq_set(unsigned int irq, unsigned int vector, uint32_t flags)
(flags & IOAPIC_POLARITY_MASK);
ioApicRedSetLo(irq, rteValue);
vtd_remap(vtd, irte_idx, vector, flags);
vtd_remap(vtd, irte_idx, vector, flags, ioapic_id);
} else {
no_vtd:
#else