From: Auger Eric <eric.auger@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: jean-philippe@linaro.org, "Tian, Kevin" <kevin.tian@intel.com>,
tnowicki@marvell.com, Juan Quintela <quintela@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Peter Xu <peterx@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
bharatb.linux@gmail.com, qemu-arm <qemu-arm@nongnu.org>,
Eric Auger <eric.auger.pro@gmail.com>
Subject: Re: [PATCH v15 8/9] hw/arm/virt: Add the virtio-iommu device tree mappings
Date: Tue, 11 Feb 2020 18:31:18 +0100 [thread overview]
Message-ID: <5e4549f4-44c3-6a2c-a270-4923db8b455e@redhat.com> (raw)
In-Reply-To: <CAFEAcA-n97LKaQo9haLdEv+c7k8QkK=LegP_gORr9z4WrBU2Ww@mail.gmail.com>
Hi Peter,
On 2/11/20 4:00 PM, Peter Maydell wrote:
> On Sat, 8 Feb 2020 at 12:01, Eric Auger <eric.auger@redhat.com> wrote:
>>
>> Adds the "virtio,pci-iommu" node in the host bridge node and
>> the RID mapping, excluding the IOMMU RID.
>>
>> This is done in the virtio-iommu-pci hotplug handler which
>> gets called only if no firmware is loaded or if -no-acpi is
>> passed on the command line. As non DT integration is
>> not yet supported by the kernel we must make sure we
>> are in DT mode. This limitation will be removed as soon
>> as the topology description feature gets supported.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>>
>> +static void create_virtio_iommu(VirtMachineState *vms, Error **errp)
>> +{
>> + const char compat[] = "virtio,pci-iommu";
>> + uint16_t bdf = vms->virtio_iommu_bdf;
>> + char *node;
>> +
>> + vms->iommu_phandle = qemu_fdt_alloc_phandle(vms->fdt);
>> +
>> + node = g_strdup_printf("%s/virtio_iommu@%d", vms->pciehb_nodename, bdf);
>> + qemu_fdt_add_subnode(vms->fdt, node);
>> + qemu_fdt_setprop(vms->fdt, node, "compatible", compat, sizeof(compat));
>> + qemu_fdt_setprop_sized_cells(vms->fdt, node, "reg",
>> + 1, bdf << 8, 1, 0, 1, 0,
>> + 1, 0, 1, 0);
>> +
>> + qemu_fdt_setprop_cell(vms->fdt, node, "#iommu-cells", 1);
>> + qemu_fdt_setprop_cell(vms->fdt, node, "phandle", vms->iommu_phandle);
>> + g_free(node);
>> +
>> + qemu_fdt_setprop_cells(vms->fdt, vms->pciehb_nodename, "iommu-map",
>> + 0x0, vms->iommu_phandle, 0x0, bdf,
>> + bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf);
>> +}
>
> This function name implies that we're creating the IOMMU device
> here (which would be a weird thing to do in a hotplug callback
> for some other device), but it looks like we're only adding
> device tree nodes ?
yes the actual iommu device is created through the -device option. I can
rename into create_iommu_dt_bindings
>
> Given that we write the FDT blob into the guest RAM on bootup,
> how does making changes to it here on hotplug (which I assume
> to be 'after boot, whenever the user hot-plugs something') work?
the virtio-iommu is not supposed to be hotplugged but rather
cold-plugged. I use this hotplug mechanism to detect its presence and
add the related dt mappings. Maybe I can add a check to detect if the
bootup is over?
Thoughts?
Eric
>
> thanks
> -- PMM
>
next prev parent reply other threads:[~2020-02-11 17:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-08 12:00 [PATCH v15 0/9] VIRTIO-IOMMU device Eric Auger
2020-02-08 12:00 ` [PATCH v15 1/9] virtio-iommu: Add skeleton Eric Auger
2020-02-08 12:00 ` [PATCH v15 2/9] virtio-iommu: Decode the command payload Eric Auger
2020-02-08 12:00 ` [PATCH v15 3/9] virtio-iommu: Implement attach/detach command Eric Auger
2020-02-08 13:41 ` Peter Xu
2020-02-08 14:00 ` Auger Eric
2020-02-08 12:00 ` [PATCH v15 4/9] virtio-iommu: Implement map/unmap Eric Auger
2020-02-08 12:00 ` [PATCH v15 5/9] virtio-iommu: Implement translate Eric Auger
2020-02-08 12:00 ` [PATCH v15 6/9] virtio-iommu: Implement fault reporting Eric Auger
2020-02-08 12:00 ` [PATCH v15 7/9] virtio-iommu-pci: Add virtio iommu pci support Eric Auger
2020-02-08 12:00 ` [PATCH v15 8/9] hw/arm/virt: Add the virtio-iommu device tree mappings Eric Auger
2020-02-11 15:00 ` Peter Maydell
2020-02-11 17:31 ` Auger Eric [this message]
2020-02-13 13:45 ` Auger Eric
2020-02-08 12:00 ` [PATCH v15 9/9] virtio-iommu: Support migration Eric Auger
2020-02-10 16:45 ` Juan Quintela
2020-02-11 13:56 ` [PATCH v15 0/9] VIRTIO-IOMMU device Michael S. Tsirkin
2020-02-11 15:02 ` Peter Maydell
2020-02-11 16:30 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5e4549f4-44c3-6a2c-a270-4923db8b455e@redhat.com \
--to=eric.auger@redhat.com \
--cc=bharatb.linux@gmail.com \
--cc=dgilbert@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=jean-philippe@linaro.org \
--cc=kevin.tian@intel.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=tnowicki@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).