Skip to contentSkip to conversation

vhost, pc: fixes

GIT PULL Applied Michael S. Tsirkin 2 participants 4 messages Mar 30, 2017

lore
Share & tools
lore
#0 lore raw

The following changes since commit e839001d5bb6c84932e2d82bd383477b2023f407:

Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging (2017-03-30 15:28:19 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0d876080a394993a8dea494ebf2d806dc0983107:

tests/acpi: don't pack a structure (2017-03-30 19:12:44 +0300)

----------------------------------------------------------------
vhost, pc: fixes

More fixes for 2.9. Region caching is still causing issues around reset, but we seem to be getting there.

----------------------------------------------------------------
Jason Wang (1):
vhost: generalize iommu memory region

Michael S. Tsirkin (1):
tests/acpi: don't pack a structure

 include/hw/virtio/vhost.h | 11 +++++++
 tests/acpi-utils.h        |  2 +-
 hw/virtio/vhost.c         | 84 ++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 76 insertions(+), 21 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/2] vhost: generalize iommu memory region

From: Jason Wang <[email protected]>

We assumes the iommu_ops were attached to the root region of address space. This may not be true for all kinds of IOMMU implementation and especially after commit 3716d5902d74 ("pci: introduce a bus master container"). So fix this by not assuming as->root has iommu_ops, instead depending on the regions reported by memory listener through:

- register a memory listener to dma_as
- during region_add, if it's a region of IOMMU, register a specific IOMMU notifier, and store all notifiers in a list.
- during region_del, compare and delete the IOMMU notifier from the list

This is also a must for making vhost device IOTLB works for all types of IOMMUs. Note, since we register one notifier during each .region_add, the IOTLB may be flushed more than one times, this is suboptimal and could be optimized in the future.

---
 include/hw/virtio/vhost.h | 11 +++++++
 hw/virtio/vhost.c         | 84 ++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 75 insertions(+), 20 deletions(-)
include/hw/virtio/vhost.h +11 -0
index 52f633e..a450321 100644
@@ -37,10 +37,20 @@ struct vhost_log {
     vhost_log_chunk_t *log;
 };
 
+struct vhost_dev;
+struct vhost_iommu {
+    struct vhost_dev *hdev;
+    MemoryRegion *mr;
+    hwaddr iommu_offset;
+    IOMMUNotifier n;
+    QLIST_ENTRY(vhost_iommu) iommu_next;
+};
+
 struct vhost_memory;
 struct vhost_dev {
     VirtIODevice *vdev;
     MemoryListener memory_listener;
+    MemoryListener iommu_listener;
     struct vhost_memory *mem;
     int n_mem_sections;
     MemoryRegionSection *mem_sections;
@@ -64,6 +74,7 @@ struct vhost_dev {
     void *opaque;
     struct vhost_log *log;
     QLIST_ENTRY(vhost_dev) entry;
+    QLIST_HEAD(, vhost_iommu) iommu_list;
     IOMMUNotifier n;
 };
 
hw/virtio/vhost.c +64 -20

121 lines not on this page · raw message

Signature · 1 line
MST
#2 lore raw

[Qemu-devel] [PULL 2/2] tests/acpi: don't pack a structure

In reply to Michael S. Tsirkin

There's no reason to pack structures where we don't care about size or padding, this applies to AcpiStdTable in tests/acpi-utils.h.

OTOH bios-tables-test happens to be passing the address of a field in this struct to a function that expects a pointer to normally aligned data which results in a SIGBUS on architectures like SPARC that have strict alignment requirements.

Fixes 9e8458c02 ("acpi unit-test: compare DSDT and SSDT tables against expected values")
---
 tests/acpi-utils.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/acpi-utils.h +1 -1
index 9f9a2d5..348e4d7 100644
@@ -26,7 +26,7 @@ typedef struct {
     gsize asl_len;
     gchar *asl_file;
     bool tmp_files_retain;   /* do not delete the temp asl/aml */
-} QEMU_PACKED AcpiSdtTable;
+} AcpiSdtTable;
 
 #define ACPI_READ_FIELD(field, addr)           \
     do {                                       \
Signature · 1 line
MST
#3 lore raw
In reply to Michael S. Tsirkin
Quoted 24 lines · Michael S. Tsirkin

The following changes since commit e839001d5bb6c84932e2d82bd383477b2023f407:

Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging (2017-03-30 15:28:19 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0d876080a394993a8dea494ebf2d806dc0983107:

tests/acpi: don't pack a structure (2017-03-30 19:12:44 +0300)

----------------------------------------------------------------
vhost, pc: fixes

More fixes for 2.9. Region caching is still causing issues around reset, but we seem to be getting there.

----------------------------------------------------------------
Jason Wang (1):
vhost: generalize iommu memory region

Quoted 7 lines

Michael S. Tsirkin (1):
tests/acpi: don't pack a structure

 include/hw/virtio/vhost.h | 11 +++++++
 tests/acpi-utils.h        |  2 +-
 hw/virtio/vhost.c         | 84 ++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 76 insertions(+), 21 deletions(-)

Applied, thanks.

-- PMM