From: Thomas Huth Date: Wed, 2 Aug 2023 13:57:21 +0000 (+0200) Subject: hw/i386/intel_iommu: Fix index calculation in vtd_interrupt_remap_msi() X-Git-Tag: qemu-xen-4.18.0-rc5~12 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=e0711f74b209b4521f3c0b39ece96772b28db10b;p=qemu-xen.git hw/i386/intel_iommu: Fix index calculation in vtd_interrupt_remap_msi() The values in "addr" are populated locally in this function in host endian byte order, so we must not swap the index_l field here. Signed-off-by: Thomas Huth Message-Id: <20230802135723.178083-5-thuth@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Peter Xu (cherry picked from commit fcd8027423300b201b37842b88393dc5c6c8ee9e) Signed-off-by: Michael Tokarev --- diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 03becd6384..9e6ce71454 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3458,7 +3458,7 @@ static int vtd_interrupt_remap_msi(IntelIOMMUState *iommu, goto out; } - index = addr.addr.index_h << 15 | le16_to_cpu(addr.addr.index_l); + index = addr.addr.index_h << 15 | addr.addr.index_l; #define VTD_IR_MSI_DATA_SUBHANDLE (0x0000ffff) #define VTD_IR_MSI_DATA_RESERVED (0xffff0000)