From 0b363b61f1b7530572d7f4d26a3cff390a2100d5 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 29 Mar 2018 14:51:28 +0200 Subject: hw/i386: Fix IVHD entry length for AMD IOMMU Counting from the IVHD ID field to the all-devices entry, we have 28 bytes, not 36. Signed-off-by: Jan Kiszka Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 9bc6d97..fff1059 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -2537,7 +2537,7 @@ build_amd_iommu(GArray *table_data, BIOSLinker *linker) (1UL << 7), /* PPRSup */ 1); /* IVHD length */ - build_append_int_noprefix(table_data, 0x24, 2); + build_append_int_noprefix(table_data, 28, 2); /* DeviceID */ build_append_int_noprefix(table_data, s->devid, 2); /* Capability offset */ -- cgit v1.1 From 2073bd43bd40ff6fc36f293a569bff113c0923d4 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Tue, 22 May 2018 09:07:53 +0200 Subject: hw/i386: Fix AMDVI GATS and HATS encodings We support up to 6 levels, but those are encoded as 10b according to the AMD IOMMU spec (chapter 3.3.1, Extended Feature Register). Signed-off-by: Jan Kiszka Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/amd_iommu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw') diff --git a/hw/i386/amd_iommu.h b/hw/i386/amd_iommu.h index aeef802..8740305 100644 --- a/hw/i386/amd_iommu.h +++ b/hw/i386/amd_iommu.h @@ -165,8 +165,8 @@ #define AMDVI_DTE_UPPER_QUAD_RESERVED 0x08f0000000000000 /* AMDVI paging mode */ -#define AMDVI_GATS_MODE (6ULL << 12) -#define AMDVI_HATS_MODE (6ULL << 10) +#define AMDVI_GATS_MODE (2ULL << 12) +#define AMDVI_HATS_MODE (2ULL << 10) /* IOTLB */ #define AMDVI_IOTLB_MAX_SIZE 1024 -- cgit v1.1 From 5d9c9ea22ab4f3b3ee497523e34b6f4d3281f62d Mon Sep 17 00:00:00 2001 From: Pankaj Gupta Date: Wed, 27 Jun 2018 16:55:20 +0530 Subject: virtio-rng: process pending requests on DRIVER_OK virtio-rng device causes old guest kernels(2.6.32) to hang on latest qemu. The driver attempts to read from the virtio-rng device too early in it's initialization. Qemu detects guest is not ready and returns, resulting in hang. To fix handle pending requests when guest is running and driver status is set to 'VIRTIO_CONFIG_S_DRIVER_OK'. CC: qemu-stable@nongnu.org Reported-by: Sergio lopez Signed-off-by: Stefan Hajnoczi Signed-off-by: Pankaj Gupta Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-rng.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'hw') diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 289bbca..855f1b4 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -156,6 +156,19 @@ static void check_rate_limit(void *opaque) vrng->activate_timer = true; } +static void virtio_rng_set_status(VirtIODevice *vdev, uint8_t status) +{ + VirtIORNG *vrng = VIRTIO_RNG(vdev); + + if (!vdev->vm_running) { + return; + } + vdev->status = status; + + /* Something changed, try to process buffers */ + virtio_rng_process(vrng); +} + static void virtio_rng_device_realize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); @@ -261,6 +274,7 @@ static void virtio_rng_class_init(ObjectClass *klass, void *data) vdc->realize = virtio_rng_device_realize; vdc->unrealize = virtio_rng_device_unrealize; vdc->get_features = get_features; + vdc->set_status = virtio_rng_set_status; } static const TypeInfo virtio_rng_info = { -- cgit v1.1