On Wed, Dec 18, 2024 at 12:57:02 +0100, Michal Privoznik wrote: > In my previous commit v10.10.0-48-g2d222ecf6e I've made us enable > I/O APIC when there is an IOMMU with EIM. This works well. What > does not work is case when there's just an IOMMU without EIM but > with 256+ vCPUS. Problem is that post parsing happens in two > stages: general domain post parse (where > qemuDomainDefEnableDefaultFeatures() is called) and then per > device post parse (where qemuDomainIOMMUDefPostParse() is > called). Now, in aforementioned case it is the device post parse > phase where EIM is enabled but the code that would enable > VIR_DOMAIN_FEATURE_IOAPIC has already run. > > To resolve this, make the domain post parse callback "foresee" > the future enabling of EIM so that it can turn on I/O APIC > beforehand. > > Resolves: https://issues.redhat.com/browse/RHEL-65844 > Fixes: 2d222ecf6e73614a400b830ac56e9aaa1bc55ecc > Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> > --- > src/qemu/qemu_postparse.c | 21 +++++++++--- > ...m-autoadd-v2.x86_64-latest.abi-update.args | 1 + > ...im-autoadd-v2.x86_64-latest.abi-update.xml | 1 + > .../intel-iommu-eim-autoadd-v2.xml | 32 +++++++++++++++++++ > tests/qemuxmlconftest.c | 1 + > 5 files changed, 51 insertions(+), 5 deletions(-) > create mode 120000 tests/qemuxmlconfdata/intel-iommu-eim-autoadd-v2.x86_64-latest.abi-update.args > create mode 120000 tests/qemuxmlconfdata/intel-iommu-eim-autoadd-v2.x86_64-latest.abi-update.xml > create mode 100644 tests/qemuxmlconfdata/intel-iommu-eim-autoadd-v2.xml > > diff --git a/src/qemu/qemu_postparse.c b/src/qemu/qemu_postparse.c > index 4fbd849ebf..34b95ece1b 100644 > --- a/src/qemu/qemu_postparse.c > +++ b/src/qemu/qemu_postparse.c > @@ -783,6 +783,15 @@ qemuDomainPstoreDefPostParse(virDomainPstoreDef *pstore, > } > > > +static bool > +qemuDomainNeedsIOMMUWithEIM(const virDomainDef *def) > +{ > + return ARCH_IS_X86(def->os.arch) && > + virDomainDefGetVcpusMax(def) > QEMU_MAX_VCPUS_WITHOUT_EIM && > + qemuDomainIsQ35(def); Cosmetic: I would align these two lines with the ARCH_IS_X86 above. > +} > + > + > static int > qemuDomainIOMMUDefPostParse(virDomainIOMMUDef *iommu, > const virDomainDef *def, Reviewed-by: Jiri Denemark <jdenemar@xxxxxxxxxx>