[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/16] amd_iommu: fix wrong MMIO operations
From: |
Michael S. Tsirkin |
Subject: |
[PULL 06/16] amd_iommu: fix wrong MMIO operations |
Date: |
Fri, 14 May 2021 12:04:21 -0400 |
From: Roman Kapl <rka@sysgo.com>
Address was swapped with value when writing MMIO registers, so the user
saw garbage in lot of cases. The interrupt status was not correctly set.
Signed-off-by: Roman Kapl <rka@sysgo.com>
Message-Id: <20210427110504.10878-1-rka@sysgo.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/i386/amd_iommu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index 43b6e9bf51..2801dff97c 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -99,7 +99,7 @@ static uint64_t amdvi_readq(AMDVIState *s, hwaddr addr)
}
/* internal write */
-static void amdvi_writeq_raw(AMDVIState *s, uint64_t val, hwaddr addr)
+static void amdvi_writeq_raw(AMDVIState *s, hwaddr addr, uint64_t val)
{
stq_le_p(&s->mmior[addr], val);
}
@@ -382,7 +382,7 @@ static void amdvi_completion_wait(AMDVIState *s, uint64_t
*cmd)
}
/* set completion interrupt */
if (extract64(cmd[0], 1, 1)) {
- amdvi_test_mask(s, AMDVI_MMIO_STATUS, AMDVI_MMIO_STATUS_COMP_INT);
+ amdvi_assign_orq(s, AMDVI_MMIO_STATUS, AMDVI_MMIO_STATUS_COMP_INT);
/* generate interrupt */
amdvi_generate_msi_interrupt(s);
}
@@ -553,7 +553,7 @@ static void amdvi_cmdbuf_run(AMDVIState *s)
trace_amdvi_command_exec(s->cmdbuf_head, s->cmdbuf_tail, s->cmdbuf);
amdvi_cmdbuf_exec(s);
s->cmdbuf_head += AMDVI_COMMAND_SIZE;
- amdvi_writeq_raw(s, s->cmdbuf_head, AMDVI_MMIO_COMMAND_HEAD);
+ amdvi_writeq_raw(s, AMDVI_MMIO_COMMAND_HEAD, s->cmdbuf_head);
/* wrap head pointer */
if (s->cmdbuf_head >= s->cmdbuf_len * AMDVI_COMMAND_SIZE) {
--
MST
- [PULL 03/16] hw/virtio: Pass virtio_feature_get_config_size() a const argument, (continued)
- [PULL 03/16] hw/virtio: Pass virtio_feature_get_config_size() a const argument, Michael S. Tsirkin, 2021/05/14
- [PULL 04/16] virtio-blk: Constify VirtIOFeature feature_sizes[], Michael S. Tsirkin, 2021/05/14
- [PULL 05/16] virtio-net: Constify VirtIOFeature feature_sizes[], Michael S. Tsirkin, 2021/05/14
- [PULL 07/16] pc-dimm: remove unnecessary get_vmstate_memory_region() method, Michael S. Tsirkin, 2021/05/14
- [PULL 08/16] virtio-blk: Fix rollback path in virtio_blk_data_plane_start(), Michael S. Tsirkin, 2021/05/14
- [PULL 09/16] virtio-blk: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 10/16] virtio-scsi: Set host notifiers and callbacks separately, Michael S. Tsirkin, 2021/05/14
- [PULL 11/16] virtio-scsi: Configure all host notifiers in a single MR transaction, Michael S. Tsirkin, 2021/05/14
- [PULL 12/16] checkpatch: Fix use of uninitialized value, Michael S. Tsirkin, 2021/05/14
- [PULL 15/16] vhost-vdpa: Make vhost_vdpa_get_device_id() static, Michael S. Tsirkin, 2021/05/14
- [PULL 06/16] amd_iommu: fix wrong MMIO operations,
Michael S. Tsirkin <=
- [PULL 02/16] x86: acpi: use offset instead of pointer when using build_header(), Michael S. Tsirkin, 2021/05/14
- [PULL 14/16] hw/virtio: enable ioeventfd configuring for mmio, Michael S. Tsirkin, 2021/05/14
- [PULL 13/16] hw/smbios: support for type 41 (onboard devices extended information), Michael S. Tsirkin, 2021/05/14
- [PULL 16/16] Fix build with 64 bits time_t, Michael S. Tsirkin, 2021/05/14
- Re: [PULL 00/16] pc,pci,virtio: bugfixes, improvements, Peter Maydell, 2021/05/16