qemu/hw/i386
yeeli 515457757f intel_iommu: Fix for IQA reg read dropped DW field
If VT-D hardware supports scalable mode, Linux will set the IQA DW field
(bit11). In qemu, the vtd_mem_write and vtd_update_iq_dw set DW field well.
However, vtd_mem_read the DW field wrong because "& VTD_IQA_QS" dropped the
value of DW.
Replace "&VTD_IQA_QS" with "& (VTD_IQA_QS | VTD_IQA_DW_MASK)" could save
the DW field.

Test patch as below:

config the "x-scalable-mode" option:
"-device intel-iommu,caching-mode=on,x-scalable-mode=on,aw-bits=48"

After Linux OS boot, check the IQA_REG DW Field by usage 1 or 2:

1. IOMMU_DEBUGFS:
Before fix:
cat /sys/kernel/debug/iommu/intel/iommu_regset |grep IQA
IQA             	0x90		0x00000001001da001

After fix:
cat /sys/kernel/debug/iommu/intel/iommu_regset |grep IQA
IQA             	0x90		0x00000001001da801

Check DW field(bit11) is 1.

2. devmem2 read the IQA_REG (offset 0x90):
Before fix:
devmem2 0xfed90090
/dev/mem opened.
Memory mapped at address 0x7f72c795b000.
Value at address 0xFED90090 (0x7f72c795b090): 0x1DA001

After fix:
devmem2 0xfed90090
/dev/mem opened.
Memory mapped at address 0x7fc95281c000.
Value at address 0xFED90090 (0x7fc95281c090): 0x1DA801

Check DW field(bit11) is 1.

Signed-off-by: yeeli <seven.yi.lee@gmail.com>
Message-Id: <20240725031858.1529902-1-seven.yi.lee@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-08-01 04:32:00 -04:00
..
kvm hw/xen_evtchn: Initialize flush_kvm_routes 2024-04-02 16:15:07 +02:00
xen hw/xen: detect when running inside stubdomain 2024-07-01 14:57:18 +02:00
acpi-build.c hw/acpi: Update CPUs AML with cpu-(ctrl)dev change 2024-07-22 20:15:41 -04:00
acpi-build.h
acpi-common.c hw/i386/acpi: Set PCAT_COMPAT bit only when pic is not disabled 2024-04-23 17:35:25 +02:00
acpi-common.h hw/i386/acpi: Declare pc_madt_cpu_entry() in 'acpi-common.h' 2024-02-20 20:34:21 +03:00
acpi-microvm.c hw/i386/acpi-microvm.c: Use common function to add virtio in DSDT 2024-01-10 18:47:46 +10:00
acpi-microvm.h
amd_iommu-stub.c amd_iommu: report x2APIC support to the operating system 2024-02-14 06:09:32 -05:00
amd_iommu.c hw/i386/amd_iommu: Don't leak memory in amdvi_update_iotlb() 2024-08-01 04:32:00 -04:00
amd_iommu.h amd_iommu: report x2APIC support to the operating system 2024-02-14 06:09:32 -05:00
e820_memory_layout.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
e820_memory_layout.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
fw_cfg.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
fw_cfg.h hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
intel_iommu_internal.h intel_iommu: fix type of the mask field in VTDIOTLBPageInvInfo 2024-07-21 14:45:53 -04:00
intel_iommu.c intel_iommu: Fix for IQA reg read dropped DW field 2024-08-01 04:32:00 -04:00
Kconfig kconfig: express dependency of individual boards on libfdt 2024-05-10 15:45:15 +02:00
meson.build hw/i386: move rtc-reset-reinjection command out of hw/rtc 2024-05-10 15:45:15 +02:00
microvm-dt.c
microvm-dt.h
microvm.c hw/i386/fw_cfg: Add etc/e820 to fw_cfg late 2024-07-03 18:14:06 -04:00
monitor.c hw/i386: move rtc-reset-reinjection command out of hw/rtc 2024-05-10 15:45:15 +02:00
multiboot.c
multiboot.h
pc_piix.c smbios: make memory device size configurable per Machine 2024-07-22 20:15:41 -04:00
pc_q35.c smbios: make memory device size configurable per Machine 2024-07-22 20:15:41 -04:00
pc_sysfw_ovmf-stubs.c
pc_sysfw_ovmf.c
pc_sysfw.c hw/i386/sev: Use guest_memfd for legacy ROMs 2024-06-05 11:01:06 +02:00
pc.c i386/sev: Don't allow automatic fallback to legacy KVM_SEV*_INIT 2024-07-16 10:45:06 +02:00
port92.c hw/i386/port92: Add missing 'hw/isa/isa.h' header 2024-02-20 20:34:21 +03:00
sgx-epc.c
sgx-stub.c target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine 2024-07-31 13:13:31 +02:00
sgx.c target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine 2024-07-31 13:13:31 +02:00
trace-events vmmouse: replace DPRINTF with tracing 2023-09-12 10:37:01 +04:00
trace.h
vapic.c hw/i386: Rename kvmvapic.c -> vapic.c 2024-03-09 18:51:45 +01:00
vmmouse.c hw/i386: Constify VMState 2023-12-29 11:17:30 +11:00
vmport.c
x86-common.c hw/i386: Add support for loading BIOS using guest_memfd 2024-06-05 11:01:06 +02:00
x86-cpu.c hw/i386: split x86.c in multiple parts 2024-05-10 15:45:15 +02:00
x86-iommu-stub.c
x86-iommu.c hw/i386/pc: Rename "bus" attribute to "pcibus" 2024-02-27 09:37:30 +01:00
x86.c hw/i386/x86: Fix superfluous trailing semicolon 2024-07-17 14:04:15 +03:00