xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Lan Tianyu <tianyu.lan@intel.com>
Cc: kevin.tian@intel.com, sstabellini@kernel.org, mst@redhat.com,
	qemu-devel@nongnu.org, xen-devel@lists.xensource.com,
	marcel@redhat.com, Chao Gao <chao.gao@intel.com>
Subject: Re: [PATCH 2/3] xen-pt: bind/unbind interrupt remapping format MSI
Date: Fri, 30 Jun 2017 16:48:14 +0100	[thread overview]
Message-ID: <20170630154814.GF1598@perard.uk.xensource.com> (raw)
In-Reply-To: <1498715394-16402-3-git-send-email-tianyu.lan@intel.com>

On Thu, Jun 29, 2017 at 01:49:53AM -0400, Lan Tianyu wrote:
> From: Chao Gao <chao.gao@intel.com>
> 
> If a vIOMMU is exposed to guest, guest will configure the msi to remapping
> format. The original code isn't suitable to the new format. A new pair
> bind/unbind interfaces are added for this usage. This patch recognizes
> this case and uses new interfaces to bind/unbind msi.
> 
> Signed-off-by: Chao Gao <chao.gao@intel.com>
> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>

Hi,

The patch series is going to need to be rebased on top of QEMU upstream.
For starter, configure have changed a bit.

> ---
>  configure                     | 54 +++++++++++++++++++++++++++++++++++++++++++
>  hw/xen/xen_pt_msi.c           | 50 ++++++++++++++++++++++++++++-----------
>  include/hw/i386/apic-msidef.h |  1 +
>  include/hw/xen/xen_common.h   | 25 ++++++++++++++++++++
>  4 files changed, 117 insertions(+), 13 deletions(-)
> 
> diff --git a/configure b/configure
> index 476210b..b3ac49f 100755
> --- a/configure
> +++ b/configure
> @@ -1982,6 +1982,60 @@ EOF
>  /*
>   * If we have stable libs the we don't want the libxc compat
>   * layers, regardless of what CFLAGS we may have been given.
> + */
> +#undef XC_WANT_COMPAT_EVTCHN_API
> +#undef XC_WANT_COMPAT_GNTTAB_API
> +#undef XC_WANT_COMPAT_MAP_FOREIGN_API
> +#include <xenctrl.h>
> +#include <xenstore.h>
> +#include <xenevtchn.h>
> +#include <xengnttab.h>
> +#include <xenforeignmemory.h>
> +#include <stdint.h>
> +#include <xen/hvm/hvm_info_table.h>
> +#if !defined(HVM_MAX_VCPUS)
> +# error HVM_MAX_VCPUS not defined
> +#endif
> +int main(void) {
> +  xc_interface *xc = NULL;
> +  xenforeignmemory_handle *xfmem;
> +  xenevtchn_handle *xe;
> +  xengnttab_handle *xg;
> +  xen_domain_handle_t handle;
> +  xengnttab_grant_copy_segment_t* seg = NULL;
> +
> +  xs_daemon_open();
> +
> +  xc = xc_interface_open(0, 0, 0);
> +  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
> +  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
> +  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
> +  xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
> +  xc_domain_create(xc, 0, handle, 0, NULL, NULL);
> +
> +  xfmem = xenforeignmemory_open(0, 0);
> +  xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
> +
> +  xe = xenevtchn_open(0, 0);
> +  xenevtchn_fd(xe);
> +
> +  xg = xengnttab_open(0, 0);
> +  xengnttab_grant_copy(xg, 0, seg);
> +
> +  xc_domain_update_msi_irq_remapping(xc, 0, 0, 0, 0, 0 ,0);
> +
> +  return 0;
> +}
> +EOF
> +      compile_prog "" "$xen_libs $xen_stable_libs"
> +    then
> +    xen_ctrl_version=4100
> +    xen=yes

There have been some change/refactoring in configure, so this won't
work. The xen_ctrl_version got one more digit.

Can you try with this patch? Which is also simpler.
diff --git a/configure b/configure
index c571ad14e5..a06f2c0b92 100755
--- a/configure
+++ b/configure
@@ -2021,6 +2021,24 @@ EOF
     # Xen unstable
     elif
         cat > $TMPC <<EOF &&
+#include <xenctrl.h>
+int main(void) {
+  xc_interface *xc = NULL;
+
+  xc_domain_update_msi_irq_remapping(xc, 0, 0, 0, 0, 0 ,0);
+
+  return 0;
+}
+EOF
+        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
+      then
+      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
+      xen_ctrl_version=41000
+      xen=yes
+
+    # Xen 4.9
+    elif
+        cat > $TMPC <<EOF &&
 #undef XC_WANT_COMPAT_DEVICEMODEL_API
 #define __XEN_TOOLS__
 #include <xendevicemodel.h>


> index 8e1580d..4ba43a8 100644
> --- a/include/hw/xen/xen_common.h
> +++ b/include/hw/xen/xen_common.h
> @@ -438,4 +438,29 @@ static inline int xengnttab_grant_copy(xengnttab_handle *xgt, uint32_t count,
>  }
>  #endif
>  
> +/* Xen before 4.10 */
> +#if CONFIG_XEN_CTRL_INTERFACE_VERSION < 4100

This will needs to be
CONFIG_XEN_CTRL_INTERFACE_VERSION < 41000

The rest of the patch is good, Thanks,

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-06-30 15:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29  5:49 [PATCH 0/3] Qemu: Add Xen vIOMMU interrupt remapping function support Lan Tianyu
2017-06-29  5:49 ` [PATCH 1/3] i386/msi: Correct mask of destination ID in MSI address Lan Tianyu
2017-06-30 13:49   ` Anthony PERARD
2017-07-04  2:31   ` [Qemu-devel] " Peter Xu
2017-06-29  5:49 ` [PATCH 2/3] xen-pt: bind/unbind interrupt remapping format MSI Lan Tianyu
2017-06-30 15:48   ` Anthony PERARD [this message]
2017-07-04  1:52     ` Lan Tianyu
2017-06-29  5:49 ` [PATCH 3/3] msi: Handle remappable format interrupt request Lan Tianyu
2017-06-30 15:52   ` Anthony PERARD
2017-07-06 23:50 ` [Qemu-devel] [PATCH 0/3] Qemu: Add Xen vIOMMU interrupt remapping function support no-reply
2017-07-07  0:02   ` Fam Zheng

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=20170630154814.GF1598@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=chao.gao@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.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).