[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/22] hw/i386/intel_iommu: Fix trivial endianness problems
From: |
Michael S. Tsirkin |
Subject: |
[PULL 15/22] hw/i386/intel_iommu: Fix trivial endianness problems |
Date: |
Thu, 3 Aug 2023 18:21:32 -0400 |
From: Thomas Huth <thuth@redhat.com>
After reading the guest memory with dma_memory_read(), we have
to make sure that we byteswap the little endian data to the host's
byte order.
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20230802135723.178083-2-thuth@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
---
hw/i386/intel_iommu.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index dcc334060c..13fcde8e91 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -756,6 +756,8 @@ static int vtd_get_pdire_from_pdir_table(dma_addr_t
pasid_dir_base,
return -VTD_FR_PASID_TABLE_INV;
}
+ pdire->val = le64_to_cpu(pdire->val);
+
return 0;
}
@@ -780,6 +782,9 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState
*s,
pe, entry_size, MEMTXATTRS_UNSPECIFIED)) {
return -VTD_FR_PASID_TABLE_INV;
}
+ for (size_t i = 0; i < ARRAY_SIZE(pe->val); i++) {
+ pe->val[i] = le64_to_cpu(pe->val[i]);
+ }
/* Do translation type check */
if (!vtd_pe_type_check(x86_iommu, pe)) {
--
MST
- [PULL 07/22] tests: acpi: x86: update expected blobs, (continued)
- [PULL 07/22] tests: acpi: x86: update expected blobs, Michael S. Tsirkin, 2023/08/03
- [PULL 09/22] acpi: x86: remove _ADR on host bridges, Michael S. Tsirkin, 2023/08/03
- [PULL 10/22] tests: acpi: update expected blobs, Michael S. Tsirkin, 2023/08/03
- [PULL 11/22] hw/virtio: qmp: add RING_RESET to 'info virtio-status', Michael S. Tsirkin, 2023/08/03
- [PULL 12/22] virtio: Fix packed virtqueue used_idx mask, Michael S. Tsirkin, 2023/08/03
- [PULL 13/22] pci: do not respond config requests after PCI device eject, Michael S. Tsirkin, 2023/08/03
- [PULL 14/22] vhost: fix the fd leak, Michael S. Tsirkin, 2023/08/03
- [PULL 15/22] hw/i386/intel_iommu: Fix trivial endianness problems,
Michael S. Tsirkin <=
- [PULL 16/22] hw/i386/intel_iommu: Fix endianness problems related to VTD_IR_TableEntry, Michael S. Tsirkin, 2023/08/03
- [PULL 17/22] hw/i386/intel_iommu: Fix struct VTDInvDescIEC on big endian hosts, Michael S. Tsirkin, 2023/08/03
- [PULL 18/22] hw/i386/intel_iommu: Fix index calculation in vtd_interrupt_remap_msi(), Michael S. Tsirkin, 2023/08/03
- [PULL 19/22] hw/i386/x86-iommu: Fix endianness issue in x86_iommu_irq_to_msi_message(), Michael S. Tsirkin, 2023/08/03
- [PULL 20/22] include/hw/i386/x86-iommu: Fix struct X86IOMMU_MSIMessage for big endian hosts, Michael S. Tsirkin, 2023/08/03
- [PULL 21/22] virtio-crypto: verify src&dst buffer length for sym request, Michael S. Tsirkin, 2023/08/03
- [PULL 22/22] cryptodev: Handle unexpected request to avoid crash, Michael S. Tsirkin, 2023/08/03