@@ -2004,6 +2004,11 @@ static const MemoryRegionOps vtd_mem_ops = {
static Property vtd_properties[] = {
DEFINE_PROP_UINT32("version", IntelIOMMUState, version, 0),
+ /*
+ * TODO: currently EIM is disabled by default. We can enable this
+ * after fully support x2apic.
+ */
+ DEFINE_PROP_BOOL("eim", IntelIOMMUState, eim_supported, false),
DEFINE_PROP_END_OF_LIST(),
};
@@ -2360,7 +2365,10 @@ static void vtd_init(IntelIOMMUState *s)
s->ecap = VTD_ECAP_QI | VTD_ECAP_IRO;
if (x86_iommu->intr_supported) {
- s->ecap |= VTD_ECAP_IR | VTD_ECAP_EIM | VTD_ECAP_MHMV;
+ s->ecap |= VTD_ECAP_IR | VTD_ECAP_MHMV;
+ if (s->eim_supported) {
+ s->ecap |= VTD_ECAP_EIM;
+ }
}
vtd_reset_context_cache(s);
@@ -2464,6 +2472,12 @@ static void vtd_realize(DeviceState *dev, Error **errp)
/* Pseudo address space under root PCI bus. */
pcms->ioapic_as = vtd_host_dma_iommu(bus, s, Q35_PSEUDO_DEVFN_IOAPIC);
+ /* EIM bit requires IR */
+ if (s->eim_supported && !x86_iommu->intr_supported) {
+ error_report("EIM (Extended Interrupt Mode) bit requires intremap=on");
+ exit(1);
+ }
+
/* Currently Intel IOMMU IR only support "kernel-irqchip={off|split}" */
if (x86_iommu->intr_supported && kvm_irqchip_in_kernel() &&
!kvm_irqchip_is_split()) {
@@ -289,6 +289,7 @@ struct IntelIOMMUState {
dma_addr_t intr_root; /* Interrupt remapping table pointer */
uint32_t intr_size; /* Number of IR table entries */
bool intr_eime; /* Extended interrupt mode enabled */
+ bool eim_supported; /* Whether to allow EIM bit */
};
/* Find the VTD Address space associated with the given bus pointer,