[PATCH 0/3] conf,qemu: add AIA support for RISC-V 'virt'

Hi, This series adds official support for RISC-V AIA (Advanced Interrupt Architecture). AIA and has been supported by the 'virt' RISC-V board, as a machine property, since QEMU 7.0. Daniel Henrique Barboza (3): qemu: add capability for RISC-V AIA feature conf,qemu: implement RISC-V 'aia' virt domain feature qemu: add RISC-V 'aia' command line docs/formatdomain.rst | 8 ++++ src/conf/domain_conf.c | 39 +++++++++++++++++++ src/conf/domain_conf.h | 11 ++++++ src/conf/schemas/domaincommon.rng | 15 +++++++ src/libvirt_private.syms | 2 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 5 +++ src/qemu/qemu_validate.c | 15 +++++++ .../caps_8.0.0_riscv64.xml | 1 + .../caps_9.1.0_riscv64.xml | 1 + ...cv64-virt-features-aia.riscv64-latest.args | 31 +++++++++++++++ ...scv64-virt-features-aia.riscv64-latest.xml | 1 + .../riscv64-virt-features-aia.xml | 27 +++++++++++++ tests/qemuxmlconftest.c | 2 + 15 files changed, 161 insertions(+) create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args create mode 120000 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.xml -- 2.45.2

AIA (Advanced Interrupt Architecture) support was introduced in QEMU 7.0 for the 'virt' machine type. It allows the guest to choose from a more modern interrupt model than the default (CLINT - Core Logical Interrupt Controller). Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml | 1 + 4 files changed, 5 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9322ae9ae6..7b6d881c39 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -719,6 +719,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 465 */ "snapshot-internal-qmp", /* QEMU_CAPS_SNAPSHOT_INTERNAL_QMP */ "chardev-reconnect-miliseconds", /* QEMU_CAPS_CHARDEV_RECONNECT_MILISECONDS */ + "machine.virt.aia", /* QEMU_CAPS_MACHINE_VIRT_AIA */ ); @@ -1748,6 +1749,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsPSeries[] = { static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsVirt[] = { { "iommu", QEMU_CAPS_MACHINE_VIRT_IOMMU }, { "ras", QEMU_CAPS_MACHINE_VIRT_RAS }, + { "aia", QEMU_CAPS_MACHINE_VIRT_AIA }, }; static struct virQEMUCapsStringFlags virQEMUCapsMachinePropsGeneric[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 54c7e30903..d38ab4df28 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -698,6 +698,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ /* 465 */ QEMU_CAPS_SNAPSHOT_INTERNAL_QMP, /* internal snapshot support via QMP commands 'snapshot-save'/'snapshot-delete' */ QEMU_CAPS_CHARDEV_RECONNECT_MILISECONDS, /* 'reconnect-ms' option for chardevs supported */ + QEMU_CAPS_MACHINE_VIRT_AIA, /* -machine virt,aia=(none|aplic|aplic-imsic), RISC-V only */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml index 7959d49c02..0207637ebc 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_riscv64.xml @@ -142,6 +142,7 @@ <flag name='usb-mtp'/> <flag name='netdev.user'/> <flag name='snapshot-internal-qmp'/> + <flag name='machine.virt.aia'/> <version>7002050</version> <microcodeVersion>0</microcodeVersion> <package>v7.2.0-333-g222059a0fc</package> diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml b/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml index 1e7b1e622b..bb6fbbe098 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_riscv64.xml @@ -168,6 +168,7 @@ <flag name='netdev.user'/> <flag name='acpi-erst'/> <flag name='snapshot-internal-qmp'/> + <flag name='machine.virt.aia'/> <version>9001000</version> <microcodeVersion>0</microcodeVersion> <package>v9.1.0</package> -- 2.45.2

This feature is implemented as a string that can range from "none", "aplic" and "aplic-imsic". If the feature isn't present in the domain XML the hypervisor default will be used. For QEMU, at least up to 9.2, the default is "none". Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- docs/formatdomain.rst | 8 +++++++ src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++ src/conf/schemas/domaincommon.rng | 15 ++++++++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_validate.c | 15 ++++++++++++ 6 files changed, 90 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3253a28e5a..780cea9aba 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2028,6 +2028,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. <async-teardown enabled='yes'/> <ras state='on'/> <ps2 state='on'/> + <aia value='aplic-imsic'/> </features> ... @@ -2275,6 +2276,13 @@ are: disable the emulation of a PS/2 controller used by ``ps2`` bus input devices. If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.7.0` (QEMU only) +``aia`` + Configure aia (Advanced Interrupt Architecture) for RISC-V 'virt' + guests. Possible values for the ``value`` attribute are ``aplic`` (one + emulated APLIC device present per socket), ``aplic-imsic`` (one APLIC and + one IMSIC device present per core), or ``none`` (no support for AIA). + If the attribute is not defined, the hypervisor default + will be used. :since:`Since 10.8.0` (QEMU/KVM and RISC-V guests only) Time keeping ------------ diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6d7dee7956..1a677c47d7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -186,6 +186,7 @@ VIR_ENUM_IMPL(virDomainFeature, "async-teardown", "ras", "ps2", + "aia", ); VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, @@ -1522,6 +1523,13 @@ VIR_ENUM_IMPL(virDomainPstoreBackend, "acpi-erst", ); +VIR_ENUM_IMPL(virDomainAIA, + VIR_DOMAIN_AIA_LAST, + "none", + "aplic", + "aplic-imsic", +); + typedef enum { VIR_DOMAIN_NET_VHOSTUSER_MODE_NONE, VIR_DOMAIN_NET_VHOSTUSER_MODE_CLIENT, @@ -17040,6 +17048,18 @@ virDomainFeaturesDefParse(virDomainDef *def, break; } + case VIR_DOMAIN_FEATURE_AIA: { + virDomainAIA value; + + if (virXMLPropEnumDefault(nodes[i], "value", virDomainAIATypeFromString, + VIR_XML_PROP_NONZERO, &value, + VIR_DOMAIN_AIA_NONE) < 0) + return -1; + + def->features[val] = value; + break; + } + case VIR_DOMAIN_FEATURE_TCG: if (virDomainFeaturesTCGDefParse(def, ctxt, nodes[i]) < 0) return -1; @@ -21007,6 +21027,17 @@ virDomainDefFeaturesCheckABIStability(virDomainDef *src, } break; + case VIR_DOMAIN_FEATURE_AIA: + if (src->features[i] != dst->features[i]) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of feature '%1$s' differs: source: '%2$s=%3$s', destination: '%4$s=%5$s'"), + featureName, + "value", virDomainAIATypeToString(src->features[i]), + "value", virDomainAIATypeToString(dst->features[i])); + return false; + } + break; + case VIR_DOMAIN_FEATURE_MSRS: case VIR_DOMAIN_FEATURE_TCG: case VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN: @@ -28001,6 +28032,14 @@ virDomainDefFormatFeatures(virBuffer *buf, virTristateBoolTypeToString(def->features[i])); break; + case VIR_DOMAIN_FEATURE_AIA: + if (def->features[i] == VIR_DOMAIN_AIA_NONE) + break; + + virBufferAsprintf(&childBuf, "<aia value='%s'/>\n", + virDomainAIATypeToString(def->features[i])); + break; + case VIR_DOMAIN_FEATURE_LAST: break; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a15af4fae3..3cc019eb90 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2182,6 +2182,7 @@ typedef enum { VIR_DOMAIN_FEATURE_ASYNC_TEARDOWN, VIR_DOMAIN_FEATURE_RAS, VIR_DOMAIN_FEATURE_PS2, + VIR_DOMAIN_FEATURE_AIA, VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -2398,6 +2399,16 @@ typedef enum { VIR_ENUM_DECL(virDomainIBS); +typedef enum { + VIR_DOMAIN_AIA_NONE = 0, + VIR_DOMAIN_AIA_APLIC, + VIR_DOMAIN_AIA_APLIC_IMSIC, + + VIR_DOMAIN_AIA_LAST +} virDomainAIA; + +VIR_ENUM_DECL(virDomainAIA); + typedef struct _virDomainFeatureKVM virDomainFeatureKVM; struct _virDomainFeatureKVM { int features[VIR_DOMAIN_KVM_LAST]; diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng index efb5f00d77..203b2ca979 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -6922,6 +6922,9 @@ <ref name="featurestate"/> </element> </optional> + <optional> + <ref name="aia"/> + </optional> </interleave> </element> </optional> @@ -7220,6 +7223,18 @@ </element> </define> + <define name="aia"> + <element name="aia"> + <attribute name="value"> + <choice> + <value>none</value> + <value>aplic</value> + <value>aplic-imsic</value> + </choice> + </attribute> + </element> + </define> + <define name="address"> <element name="address"> <choice> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5fb4df3513..deb4ef5ba6 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -229,6 +229,8 @@ virDiskNameParse; virDiskNameToBusDeviceIndex; virDiskNameToIndex; virDomainActualNetDefFree; +virDomainAIATypeFromString; +virDomainAIATypeToString; virDomainAudioDefFree; virDomainAudioFormatTypeFromString; virDomainAudioFormatTypeToString; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index fa23c5f973..8f44205667 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -265,6 +265,21 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, } break; + case VIR_DOMAIN_FEATURE_AIA: + if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && + !qemuDomainIsRISCVVirt(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("aia feature is only supported with RISC-V Virt machines")); + return -1; + } + if (def->features[i] != VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VIRT_AIA)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("aia feature is not available with this QEMU binary")); + return -1; + } + break; + case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_KVM: case VIR_DOMAIN_FEATURE_XEN: -- 2.45.2

On Thu, Oct 24, 2024 at 11:08:19AM -0300, Daniel Henrique Barboza wrote:
This feature is implemented as a string that can range from "none", "aplic" and "aplic-imsic".
If the feature isn't present in the domain XML the hypervisor default will be used. For QEMU, at least up to 9.2, the default is "none".
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- docs/formatdomain.rst | 8 +++++++ src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++ src/conf/schemas/domaincommon.rng | 15 ++++++++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_validate.c | 15 ++++++++++++ 6 files changed, 90 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3253a28e5a..780cea9aba 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2028,6 +2028,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. <async-teardown enabled='yes'/> <ras state='on'/> <ps2 state='on'/> + <aia value='aplic-imsic'/> </features> ...
@@ -2275,6 +2276,13 @@ are: disable the emulation of a PS/2 controller used by ``ps2`` bus input devices. If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.7.0` (QEMU only) +``aia`` + Configure aia (Advanced Interrupt Architecture) for RISC-V 'virt' + guests. Possible values for the ``value`` attribute are ``aplic`` (one + emulated APLIC device present per socket), ``aplic-imsic`` (one APLIC and + one IMSIC device present per core), or ``none`` (no support for AIA). + If the attribute is not defined, the hypervisor default + will be used. :since:`Since 10.8.0` (QEMU/KVM and RISC-V guests only)
This needs to be changed to 11.1.0, sorry for missing this patch for so long. Also, the hypervisor default will be used even the user specifies aia='none' based on the code in patch 3/3. So either we need to add an absent value for this attribute or change the wording. Other than that these patches are all fine and good to go, the only thing above needs to be figured out.

On 1/22/25 8:43 AM, Martin Kletzander wrote:
On Thu, Oct 24, 2024 at 11:08:19AM -0300, Daniel Henrique Barboza wrote:
This feature is implemented as a string that can range from "none", "aplic" and "aplic-imsic".
If the feature isn't present in the domain XML the hypervisor default will be used. For QEMU, at least up to 9.2, the default is "none".
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- docs/formatdomain.rst | 8 +++++++ src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++ src/conf/schemas/domaincommon.rng | 15 ++++++++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_validate.c | 15 ++++++++++++ 6 files changed, 90 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3253a28e5a..780cea9aba 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2028,6 +2028,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. <async-teardown enabled='yes'/> <ras state='on'/> <ps2 state='on'/> + <aia value='aplic-imsic'/> </features> ...
@@ -2275,6 +2276,13 @@ are: disable the emulation of a PS/2 controller used by ``ps2`` bus input devices. If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.7.0` (QEMU only) +``aia`` + Configure aia (Advanced Interrupt Architecture) for RISC-V 'virt' + guests. Possible values for the ``value`` attribute are ``aplic`` (one + emulated APLIC device present per socket), ``aplic-imsic`` (one APLIC and + one IMSIC device present per core), or ``none`` (no support for AIA). + If the attribute is not defined, the hypervisor default + will be used. :since:`Since 10.8.0` (QEMU/KVM and RISC-V guests only)
This needs to be changed to 11.1.0, sorry for missing this patch for so long.
Also, the hypervisor default will be used even the user specifies aia='none' based on the code in patch 3/3. So either we need to add an absent value for this attribute or change the wording.
You're right. I forgot about the 'none' meaning here as 'this option wasn't specified' when writing this doc. I'll add an "off" (or "disabled" - I'll see what libvirt tends to use in these cases) value for it that can be translated to 'none' when building the QEMU command line. Thanks, Daniel
Other than that these patches are all fine and good to go, the only thing above needs to be figured out.

On Wed, Jan 22, 2025 at 09:40:06AM -0300, Daniel Henrique Barboza wrote:
On 1/22/25 8:43 AM, Martin Kletzander wrote:
On Thu, Oct 24, 2024 at 11:08:19AM -0300, Daniel Henrique Barboza wrote:
This feature is implemented as a string that can range from "none", "aplic" and "aplic-imsic".
If the feature isn't present in the domain XML the hypervisor default will be used. For QEMU, at least up to 9.2, the default is "none".
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- docs/formatdomain.rst | 8 +++++++ src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++ src/conf/schemas/domaincommon.rng | 15 ++++++++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_validate.c | 15 ++++++++++++ 6 files changed, 90 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3253a28e5a..780cea9aba 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2028,6 +2028,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. <async-teardown enabled='yes'/> <ras state='on'/> <ps2 state='on'/> + <aia value='aplic-imsic'/> </features> ...
@@ -2275,6 +2276,13 @@ are: disable the emulation of a PS/2 controller used by ``ps2`` bus input devices. If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.7.0` (QEMU only) +``aia`` + Configure aia (Advanced Interrupt Architecture) for RISC-V 'virt' + guests. Possible values for the ``value`` attribute are ``aplic`` (one + emulated APLIC device present per socket), ``aplic-imsic`` (one APLIC and + one IMSIC device present per core), or ``none`` (no support for AIA). + If the attribute is not defined, the hypervisor default + will be used. :since:`Since 10.8.0` (QEMU/KVM and RISC-V guests only)
This needs to be changed to 11.1.0, sorry for missing this patch for so long.
Also, the hypervisor default will be used even the user specifies aia='none' based on the code in patch 3/3. So either we need to add an absent value for this attribute or change the wording.
You're right. I forgot about the 'none' meaning here as 'this option wasn't specified' when writing this doc.
I'll add an "off" (or "disabled" - I'll see what libvirt tends to use in these cases) value for it that can be translated to 'none' when building the QEMU command line.
You can keep the current options the way they are (especially if qemu accepts "none") and just add "default" which will not be documented.
Thanks,
Daniel
Other than that these patches are all fine and good to go, the only thing above needs to be figured out.

On 1/22/25 10:11 AM, Martin Kletzander wrote:
On Wed, Jan 22, 2025 at 09:40:06AM -0300, Daniel Henrique Barboza wrote:
On 1/22/25 8:43 AM, Martin Kletzander wrote:
On Thu, Oct 24, 2024 at 11:08:19AM -0300, Daniel Henrique Barboza wrote:
This feature is implemented as a string that can range from "none", "aplic" and "aplic-imsic".
If the feature isn't present in the domain XML the hypervisor default will be used. For QEMU, at least up to 9.2, the default is "none".
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- docs/formatdomain.rst | 8 +++++++ src/conf/domain_conf.c | 39 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 11 +++++++++ src/conf/schemas/domaincommon.rng | 15 ++++++++++++ src/libvirt_private.syms | 2 ++ src/qemu/qemu_validate.c | 15 ++++++++++++ 6 files changed, 90 insertions(+)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 3253a28e5a..780cea9aba 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2028,6 +2028,7 @@ Hypervisors may allow certain CPU / machine features to be toggled on/off. <async-teardown enabled='yes'/> <ras state='on'/> <ps2 state='on'/> + <aia value='aplic-imsic'/> </features> ...
@@ -2275,6 +2276,13 @@ are: disable the emulation of a PS/2 controller used by ``ps2`` bus input devices. If the attribute is not defined, the hypervisor default will be used. :since:`Since 10.7.0` (QEMU only) +``aia`` + Configure aia (Advanced Interrupt Architecture) for RISC-V 'virt' + guests. Possible values for the ``value`` attribute are ``aplic`` (one + emulated APLIC device present per socket), ``aplic-imsic`` (one APLIC and + one IMSIC device present per core), or ``none`` (no support for AIA). + If the attribute is not defined, the hypervisor default + will be used. :since:`Since 10.8.0` (QEMU/KVM and RISC-V guests only)
This needs to be changed to 11.1.0, sorry for missing this patch for so long.
Also, the hypervisor default will be used even the user specifies aia='none' based on the code in patch 3/3. So either we need to add an absent value for this attribute or change the wording.
You're right. I forgot about the 'none' meaning here as 'this option wasn't specified' when writing this doc.
I'll add an "off" (or "disabled" - I'll see what libvirt tends to use in these cases) value for it that can be translated to 'none' when building the QEMU command line.
You can keep the current options the way they are (especially if qemu accepts "none") and just add "default" which will not be documented.
That's even better. In fact it seems like libvirt already does that with other features as well. I'll send a v2 shortly. Thanks, Daniel
Thanks,
Daniel
Other than that these patches are all fine and good to go, the only thing above needs to be figured out.

The 'aia' feature is added as a machine type option for the 'virt' RISC-V machine, e.g. "-machine virt,aia=<val>". Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> --- src/qemu/qemu_command.c | 5 +++ ...cv64-virt-features-aia.riscv64-latest.args | 31 +++++++++++++++++++ ...scv64-virt-features-aia.riscv64-latest.xml | 1 + .../riscv64-virt-features-aia.xml | 27 ++++++++++++++++ tests/qemuxmlconftest.c | 2 ++ 5 files changed, 66 insertions(+) create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args create mode 120000 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a5ff7695c3..2637138481 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6712,6 +6712,11 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf, virBufferAsprintf(buf, ",i8042=%s", str); } + if (def->features[VIR_DOMAIN_FEATURE_AIA] != VIR_DOMAIN_AIA_NONE) { + const char *str = virDomainAIATypeToString(def->features[VIR_DOMAIN_FEATURE_AIA]); + virBufferAsprintf(buf, ",aia=%s", str); + } + return 0; } diff --git a/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args b/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args new file mode 100644 index 0000000000..75b0f1e425 --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args @@ -0,0 +1,31 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/var/lib/libvirt/qemu/domain--1-guest \ +USER=test \ +LOGNAME=test \ +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-riscv64 \ +-name guest=guest,debug-threads=on \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine virt,usb=off,aia=aplic-imsic,dump-guest-core=off,memory-backend=riscv_virt_board.ram,acpi=off \ +-accel tcg \ +-cpu rv64 \ +-m size=4194304k \ +-object '{"qom-type":"memory-backend-ram","id":"riscv_virt_board.ram","size":4294967296}' \ +-overcommit mem-lock=off \ +-smp 4,sockets=4,cores=1,threads=1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \ +-mon chardev=charmonitor,id=monitor,mode=control \ +-rtc base=utc \ +-no-shutdown \ +-boot strict=on \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \ +-msg timestamp=on diff --git a/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml b/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml new file mode 120000 index 0000000000..1ab55fc10e --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml @@ -0,0 +1 @@ +riscv64-virt-features-aia.xml \ No newline at end of file diff --git a/tests/qemuxmlconfdata/riscv64-virt-features-aia.xml b/tests/qemuxmlconfdata/riscv64-virt-features-aia.xml new file mode 100644 index 0000000000..708a2886f9 --- /dev/null +++ b/tests/qemuxmlconfdata/riscv64-virt-features-aia.xml @@ -0,0 +1,27 @@ +<domain type='qemu'> + <name>guest</name> + <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid> + <memory unit='KiB'>4194304</memory> + <currentMemory unit='KiB'>4194304</currentMemory> + <vcpu placement='static'>4</vcpu> + <os> + <type arch='riscv64' machine='virt'>hvm</type> + <boot dev='hd'/> + </os> + <features> + <aia value='aplic-imsic'/> + </features> + <cpu mode='custom' match='exact' check='none'> + <model fallback='forbid'>rv64</model> + </cpu> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-riscv64</emulator> + <controller type='pci' index='0' model='pcie-root'/> + <audio id='1' type='none'/> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c index 9bcd937447..5fc011d41e 100644 --- a/tests/qemuxmlconftest.c +++ b/tests/qemuxmlconftest.c @@ -2921,6 +2921,8 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-tcg-q35-4.2", "x86_64"); DO_TEST_CAPS_ARCH_LATEST("x86_64-default-cpu-tcg-features", "x86_64"); + DO_TEST_CAPS_ARCH_LATEST("riscv64-virt-features-aia", "riscv64"); + DO_TEST_CAPS_LATEST("virtio-9p-multidevs"); DO_TEST_CAPS_LATEST("virtio-9p-createmode"); -- 2.45.2

ping On 10/24/24 11:08 AM, Daniel Henrique Barboza wrote:
Hi,
This series adds official support for RISC-V AIA (Advanced Interrupt Architecture). AIA and has been supported by the 'virt' RISC-V board, as a machine property, since QEMU 7.0.
Daniel Henrique Barboza (3): qemu: add capability for RISC-V AIA feature conf,qemu: implement RISC-V 'aia' virt domain feature qemu: add RISC-V 'aia' command line
docs/formatdomain.rst | 8 ++++ src/conf/domain_conf.c | 39 +++++++++++++++++++ src/conf/domain_conf.h | 11 ++++++ src/conf/schemas/domaincommon.rng | 15 +++++++ src/libvirt_private.syms | 2 + src/qemu/qemu_capabilities.c | 2 + src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 5 +++ src/qemu/qemu_validate.c | 15 +++++++ .../caps_8.0.0_riscv64.xml | 1 + .../caps_9.1.0_riscv64.xml | 1 + ...cv64-virt-features-aia.riscv64-latest.args | 31 +++++++++++++++ ...scv64-virt-features-aia.riscv64-latest.xml | 1 + .../riscv64-virt-features-aia.xml | 27 +++++++++++++ tests/qemuxmlconftest.c | 2 + 15 files changed, 161 insertions(+) create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.args create mode 120000 tests/qemuxmlconfdata/riscv64-virt-features-aia.riscv64-latest.xml create mode 100644 tests/qemuxmlconfdata/riscv64-virt-features-aia.xml
participants (2)
-
Daniel Henrique Barboza
-
Martin Kletzander