[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH v11 14/17] hw/arm/virt: Introduce the iommu option
From: |
Peter Maydell |
Subject: |
Re: [Qemu-arm] [PATCH v11 14/17] hw/arm/virt: Introduce the iommu option |
Date: |
Mon, 16 Apr 2018 17:55:05 +0100 |
On 12 April 2018 at 08:38, Eric Auger <address@hidden> wrote:
> ARM virt machine now exposes a new "iommu" option.
> The SMMUv3 IOMMU is instantiated using -machine virt,iommu=smmuv3.
>
> Signed-off-by: Eric Auger <address@hidden>
> Signed-off-by: Prem Mallappa <address@hidden>
>
> ---
> v9 -> v10:
> - remove no_iommu
>
> v7 -> v8:
> - Revert to machine option, now dubbed "iommu", preparing for virtio
> instantiation.
>
> v5 -> v6: machine 2_11
> ---
> hw/arm/virt.c | 36 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index 1799702..a3398d6 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -1560,6 +1560,34 @@ static void virt_set_gic_version(Object *obj, const
> char *value, Error **errp)
> }
> }
>
> +static char *virt_get_iommu(Object *obj, Error **errp)
> +{
> + VirtMachineState *vms = VIRT_MACHINE(obj);
> +
> + switch (vms->iommu) {
> + case VIRT_IOMMU_NONE:
> + return g_strdup("none");
> + case VIRT_IOMMU_SMMUV3:
> + return g_strdup("smmuv3");
> + default:
> + g_assert_not_reached();
> + }
> +}
> +
> +static void virt_set_iommu(Object *obj, const char *value, Error **errp)
> +{
> + VirtMachineState *vms = VIRT_MACHINE(obj);
> +
> + if (!strcmp(value, "smmuv3")) {
> + vms->iommu = VIRT_IOMMU_SMMUV3;
> + } else if (!strcmp(value, "none")) {
> + vms->iommu = VIRT_IOMMU_NONE;
> + } else {
> + error_setg(errp, "Invalid iommu value");
> + error_append_hint(errp, "Valid values are none, smmuv3.\n");
> + }
> +}
> +
> static CpuInstanceProperties
> virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
> {
> @@ -1692,6 +1720,14 @@ static void virt_2_12_instance_init(Object *obj)
> NULL);
> }
>
> + /* Default disallows iommu instantiation */
> + vms->iommu = VIRT_IOMMU_NONE;
> + object_property_add_str(obj, "iommu", virt_get_iommu, virt_set_iommu,
> NULL);
> + object_property_set_description(obj, "iommu",
> + "Set the IOMMU model among "
> + "none, smmuv3 (default none)",
> + NULL);
We should phrase this consistently with how we're describing other
options like the GIC version, so
"Set the IOMMU type. Valid values are none and smmuv3"
Otherwise
Reviewed-by: Peter Maydell <address@hidden>
thanks
-- PMM
- [Qemu-arm] [PATCH v11 09/17] hw/arm/smmuv3: Implement translate callback, (continued)
- [Qemu-arm] [PATCH v11 09/17] hw/arm/smmuv3: Implement translate callback, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 10/17] hw/arm/smmuv3: Abort on vfio or vhost case, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 11/17] target/arm/kvm: Translate the MSI doorbell in kvm_arch_fixup_msi_route, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 12/17] hw/arm/virt: Add SMMUv3 to the virt board, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 13/17] hw/arm/virt-acpi-build: Add smmuv3 node in IORT table, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 14/17] hw/arm/virt: Introduce the iommu option, Eric Auger, 2018/04/12
- Re: [Qemu-arm] [PATCH v11 14/17] hw/arm/virt: Introduce the iommu option,
Peter Maydell <=
- [Qemu-arm] [PATCH v11 15/17] hw/arm/smmuv3: Cache/invalidate config data, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 17/17] hw/arm/smmuv3: Add notifications on invalidation, Eric Auger, 2018/04/12
- [Qemu-arm] [PATCH v11 16/17] hw/arm/smmuv3: IOTLB emulation, Eric Auger, 2018/04/12