[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/43] qdev: Add a granule_mode property
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 24/43] qdev: Add a granule_mode property |
Date: |
Sat, 9 Mar 2024 20:21:51 +0100 |
From: Eric Auger <eric.auger@redhat.com>
Introduce a new enum type property allowing to set an
IOMMU granule. Values are 4k, 8k, 16k, 64k and host.
This latter indicates the vIOMMU granule will match
the host page size.
A subsequent patch will add such a property to the
virtio-iommu device.
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240227165730.14099-2-eric.auger@redhat.com>
---
qapi/virtio.json | 18 ++++++++++++++++++
include/hw/qdev-properties-system.h | 3 +++
hw/core/qdev-properties-system.c | 14 ++++++++++++++
3 files changed, 35 insertions(+)
diff --git a/qapi/virtio.json b/qapi/virtio.json
index a79013fe89..95745fdfd7 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -957,3 +957,21 @@
{ 'struct': 'DummyVirtioForceArrays',
'data': { 'unused-iothread-vq-mapping': ['IOThreadVirtQueueMapping'] } }
+
+##
+# @GranuleMode:
+#
+# @4k: granule page size of 4KiB
+#
+# @8k: granule page size of 8KiB
+#
+# @16k: granule page size of 16KiB
+#
+# @64k: granule page size of 64KiB
+#
+# @host: granule matches the host page size
+#
+# Since: 9.0
+##
+{ 'enum': 'GranuleMode',
+ 'data': [ '4k', '8k', '16k', '64k', 'host' ] }
diff --git a/include/hw/qdev-properties-system.h
b/include/hw/qdev-properties-system.h
index 06c359c190..626be87dd3 100644
--- a/include/hw/qdev-properties-system.h
+++ b/include/hw/qdev-properties-system.h
@@ -8,6 +8,7 @@ extern const PropertyInfo qdev_prop_macaddr;
extern const PropertyInfo qdev_prop_reserved_region;
extern const PropertyInfo qdev_prop_multifd_compression;
extern const PropertyInfo qdev_prop_mig_mode;
+extern const PropertyInfo qdev_prop_granule_mode;
extern const PropertyInfo qdev_prop_losttickpolicy;
extern const PropertyInfo qdev_prop_blockdev_on_error;
extern const PropertyInfo qdev_prop_bios_chs_trans;
@@ -47,6 +48,8 @@ extern const PropertyInfo qdev_prop_iothread_vq_mapping_list;
#define DEFINE_PROP_MIG_MODE(_n, _s, _f, _d) \
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_mig_mode, \
MigMode)
+#define DEFINE_PROP_GRANULE_MODE(_n, _s, _f, _d) \
+ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_granule_mode, GranuleMode)
#define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_losttickpolicy, \
LostTickPolicy)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 1a396521d5..b45e90edb2 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -679,6 +679,20 @@ const PropertyInfo qdev_prop_mig_mode = {
.set_default_value = qdev_propinfo_set_default_value_enum,
};
+/* --- GranuleMode --- */
+
+QEMU_BUILD_BUG_ON(sizeof(GranuleMode) != sizeof(int));
+
+const PropertyInfo qdev_prop_granule_mode = {
+ .name = "GranuleMode",
+ .description = "granule_mode values, "
+ "4k, 8k, 16k, 64k, host",
+ .enum_table = &GranuleMode_lookup,
+ .get = qdev_propinfo_get_enum,
+ .set = qdev_propinfo_set_enum,
+ .set_default_value = qdev_propinfo_set_default_value_enum,
+};
+
/* --- Reserved Region --- */
/*
--
2.41.0
- [PULL 14/43] hw/xen/hvm: Get target page size at runtime, (continued)
- [PULL 14/43] hw/xen/hvm: Get target page size at runtime, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 16/43] hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 17/43] hw/remote/remote-obj: hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 19/43] hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 18/43] target/i386/sev: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 20/43] hw/i386/pc: Use generated NotifyVmexitOption_str(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 21/43] hw/i386/pc: Remove 'host_type' argument from pc_init1(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 22/43] hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 23/43] hw/intc/apic: fix memory leak, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 24/43] qdev: Add a granule_mode property,
Philippe Mathieu-Daudé <=
- [PULL 25/43] hmp: Add option to info qtree to omit details, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 26/43] mac_newworld: change timebase frequency from 100MHz to 25MHz for mac99 machine, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 27/43] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 29/43] docs/interop/firmware.json: Fix doc for FirmwareFlashMode, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 28/43] docs/interop/firmware.json: Align examples, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 31/43] hw/core/machine-smp: Deprecate unsupported "parameter=1" SMP configurations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 32/43] hw/core/machine-smp: Calculate total CPUs once in machine_parse_smp_config(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 34/43] tests/unit/test-smp-parse: Use CPU number macros in invalid topology case, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 30/43] hw/core/machine-smp: Remove deprecated "parameter=0" SMP configurations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 35/43] tests/unit/test-smp-parse: Bump max_cpus to 4096, Philippe Mathieu-Daudé, 2024/03/09