qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chao Gao <chao.gao@intel.com>
To: Anthony PERARD <anthony.perard@citrix.com>
Cc: Lan Tianyu <tianyu.lan@intel.com>,
	xen-devel@lists.xensource.com, qemu-devel@nongnu.org,
	kevin.tian@intel.com, sstabellini@kernel.org
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	[thread overview]
Message-ID: <20170330201955.GA98879@skl-2s3.sh.intel.com> (raw)
In-Reply-To: <20170330162452.GB1864@perard.uk.xensource.com>

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 <chao.gao@intel.com>
>> 
>> Since adding a dynamic sysbus device is forbidden, so choose TYPE_DEVICE
>> as parent class.
>> 
>> Signed-off-by: Chao Gao <chao.gao@intel.com>
>> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
>> ---
>>  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

  reply	other threads:[~2017-03-31  3:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-17 11:29 [Qemu-devel] [RFC PATCH 0/4] Qemu: Add Xen vIOMMU support Lan Tianyu
2017-03-17 11:29 ` [Qemu-devel] [RFC PATCH 1/4] I440: Allow adding sysbus devices with -device on I440 Lan Tianyu
2017-03-20 19:49   ` Eduardo Habkost
2017-03-21  0:36     ` Lan Tianyu
2017-03-17 11:29 ` [Qemu-devel] [RFC PATCH 2/4] Xen: add a dummy vIOMMU to create/destroy vIOMMU in Xen Lan Tianyu
2017-03-30 16:24   ` Anthony PERARD
2017-03-30 20:19     ` Chao Gao [this message]
2017-03-17 11:29 ` [Qemu-devel] [RFC PATCH 3/4] xen-pt: bind/unbind interrupt remapping format MSI Lan Tianyu
2017-03-30 16:51   ` Anthony PERARD
2017-03-30 20:31     ` Chao Gao
2017-03-17 11:29 ` [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-30 17:29   ` Anthony PERARD
2017-03-30 20:38     ` Chao Gao
2017-03-17 11:46 ` [Qemu-devel] [RFC PATCH 0/4] Qemu: Add Xen vIOMMU support no-reply
2017-03-17 14:48 ` Paolo Bonzini
2017-03-17 20:57   ` Stefano Stabellini
2017-03-20  2:40   ` Lan Tianyu
2017-03-20 11:38     ` Paolo Bonzini
2017-03-20 14:17       ` [Qemu-devel] [Xen-devel] " Roger Pau Monné
2017-03-20 14:35         ` Paolo Bonzini
2017-03-21  1:13       ` [Qemu-devel] " Lan Tianyu

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=20170330201955.GA98879@skl-2s3.sh.intel.com \
    --to=chao.gao@intel.com \
    --cc=anthony.perard@citrix.com \
    --cc=kevin.tian@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sstabellini@kernel.org \
    --cc=tianyu.lan@intel.com \
    --cc=xen-devel@lists.xensource.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).