qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 2/3] virtio-iommu: Add a granule property


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v4 2/3] virtio-iommu: Add a granule property
Date: Fri, 23 Feb 2024 08:57:24 +0100
User-agent: Mozilla Thunderbird

On 23/2/24 08:27, Eric Auger wrote:
This allows to choose which granule will be used by
default by the virtio-iommu. Current page size mask
default is qemu_target_page_mask so this translates
into a 4K granule.

Signed-off-by: Eric Auger <eric.auger@redhat.com>

---

v3 -> v4:
- granule_mode introduction moved to that patch
---
  include/hw/virtio/virtio-iommu.h |  1 +
  hw/virtio/virtio-iommu.c         | 27 ++++++++++++++++++++++++---
  qemu-options.hx                  |  3 +++
  3 files changed, 28 insertions(+), 3 deletions(-)


@@ -1324,7 +1324,26 @@ static void virtio_iommu_device_realize(DeviceState 
*dev, Error **errp)
       * in vfio realize
       */
      s->config.bypass = s->boot_bypass;
-    s->config.page_size_mask = qemu_target_page_mask();
+
+    switch (s->granule_mode) {
+    case GRANULE_MODE_4K:
+        s->config.page_size_mask = ~0xFFF;

Alternatively:

          s->config.page_size_mask = -(4 * KiB);

+        break;
+    case GRANULE_MODE_8K:
+        s->config.page_size_mask = ~0x1FFF;

          s->config.page_size_mask = -(8 * KiB);

+        break;
+    case GRANULE_MODE_16K:
+        s->config.page_size_mask = ~0x3FFF;

...

+        break;
+    case GRANULE_MODE_64K:
+        s->config.page_size_mask = ~0xFFFF;
+        break;
+    case GRANULE_MODE_HOST:
+        s->config.page_size_mask = qemu_real_host_page_mask();
+        break;
+    default:
+        error_setg(errp, "Unsupported granule mode");
+    }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]