[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 2/4] Xen: add a dummy vIOMMU to create/destr
From: |
Chao Gao |
Subject: |
Re: [Qemu-devel] [RFC PATCH 2/4] Xen: add a dummy vIOMMU to create/destroy vIOMMU in Xen |
Date: |
Fri, 31 Mar 2017 04:19:56 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Mar 30, 2017 at 05:24:52PM +0100, Anthony PERARD wrote:
>Hi,
>
>On Fri, Mar 17, 2017 at 07:29:15PM +0800, Lan Tianyu wrote:
>> From: Chao Gao <address@hidden>
>>
>> Since adding a dynamic sysbus device is forbidden, so choose TYPE_DEVICE
>> as parent class.
>>
>> Signed-off-by: Chao Gao <address@hidden>
>> Signed-off-by: Lan Tianyu <address@hidden>
>> ---
>> hw/xen/Makefile.objs | 1 +
>> hw/xen/xen_viommu.c | 116
>> +++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 117 insertions(+)
>> create mode 100644 hw/xen/xen_viommu.c
>>
>> +static void xen_viommu_realize(DeviceState *dev, Error **errp)
>> +{
>> + int rc;
>> + uint64_t cap;
>> + char *dom;
>> + char viommu_path[1024];
>> + XenVIOMMUState *s = XEN_VIOMMU_DEVICE(dev);
>> +
>> + s->id = -1;
>> +
>> + /* Read vIOMMU attributes from Xenstore. */
>> + dom = xs_get_domain_path(xenstore, xen_domid);
>> + snprintf(viommu_path, sizeof(viommu_path), "%s/viommu", dom);
>> + rc = xenstore_read_uint64(viommu_path, "base_addr", &s->base_addr);
>
>Could these informations (base_addr and cap) be read from the command
>line instead of via xenstore?
>Any reason for these informations to be on xenstore?
Actually, we passed both via command line at first. We just concerned
whether it was ok to pass a address through command line since
we find no device does the similar thing.
>
>> + if (rc) {
>> + error_report("Can't get base address of vIOMMU");
>
>I think error_setg should be used instead of error_report.
>
>> + exit(1);
>
>Also, exit should be remove, and return instead. error_setg would be
>enough to signal that the device can not work.
>
>> + }
>> +
>> + rc = xenstore_read_uint64(viommu_path, "cap", &s->cap);
>> + if (rc) {
>> + error_report("Can't get capabilities of vIOMMU");
>> + exit(1);
>> + }
>> +
>> + rc = xc_viommu_query_cap(xen_xc, xen_domid, &cap);
>
>Since xc_viommu_* seems to be new, you should use
>xendevicemodel_viommu_* instead, also you will need to define a stub for
>them to be able to compile QEMU against older version of Xen.
Will follow your suggestions above.
Thanks
Chao
>
>
>The patch looks good otherwise.
>
>Thanks,
>
>--
>Anthony PERARD
- [Qemu-devel] [RFC PATCH 0/4] Qemu: Add Xen vIOMMU support, Lan Tianyu, 2017/03/17
- [Qemu-devel] [RFC PATCH 1/4] I440: Allow adding sysbus devices with -device on I440, Lan Tianyu, 2017/03/17
- [Qemu-devel] [RFC PATCH 3/4] xen-pt: bind/unbind interrupt remapping format MSI, Lan Tianyu, 2017/03/17
- [Qemu-devel] [RFC PATCH 2/4] Xen: add a dummy vIOMMU to create/destroy vIOMMU in Xen, Lan Tianyu, 2017/03/17
- [Qemu-devel] [RFC PATCH 4/4] msi: taking interrupt format into consideration during judging a pirq is binded with a event channel, Lan Tianyu, 2017/03/17
- Re: [Qemu-devel] [RFC PATCH 0/4] Qemu: Add Xen vIOMMU support, no-reply, 2017/03/17
- Re: [Qemu-devel] [RFC PATCH 0/4] Qemu: Add Xen vIOMMU support, Paolo Bonzini, 2017/03/17