[libvirt] [PATCH v2 06/11] qemu: assign addresses to virtio devices on RISC-V
Andrea Bolognani
abologna at redhat.com
Tue Jun 26 15:05:04 UTC 2018
On Thu, 2018-06-14 at 22:32 +0200, Lubomir Rintel wrote:
[...]
> +static void
> +qemuDomainAssignRISCVVirtioMMIOAddresses(virDomainDefPtr def,
> + virQEMUCapsPtr qemuCaps)
> +{
> + if (!ARCH_IS_RISCV(def->os.arch))
> + return;
> +
> + if (STRNEQ(def->os.machine, "virt"))
> + return;
This will stop working the moment QEMU introduces versioned
machine types for RISC-V, which makes it not very future proof.
You should instead introduce (in a separate, earlier patch)
qemuDomainIsRISCVVirt()
qemuDomainMachineIsRISCVVirt()
functions modeled after the Arm equivalent, and use the former
here.
[...]
> @@ -2940,6 +2957,8 @@ qemuDomainAssignAddresses(virDomainDefPtr def,
>
> qemuDomainAssignARMVirtioMMIOAddresses(def, qemuCaps);
>
> + qemuDomainAssignRISCVVirtioMMIOAddresses(def, qemuCaps);
We should have a
qemuDomainAssignVirtioMMIOAddresses()
wrapper that calls both the Arm and RISC-V variants, and call
that one from qemuDomainAssignAddresses().
You can introduce and start using the wrapper in a separate patch;
then, in this one, you can add the RISC-V variant and modify the
wrapper so that it calls it in addition to the Arm variant.
Everything else looks good.
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list