mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: boris.ostrovsky@oracle.com, Juergen Gross <jgross@suse.com>
Subject: [PATCH 4/4] xen: select grant interface version
Date: Fri,  8 Sep 2017 16:48:49 +0200	[thread overview]
Message-ID: <20170908144849.2958-5-jgross@suse.com> (raw)
In-Reply-To: <20170908144849.2958-1-jgross@suse.com>

Based on the maximum page number of the host select either grant v1 or
grant v2.

For testing purposes add a way to specify the grant interface version
via a boot parameter.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 drivers/xen/grant-table.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 573af785c425..c8479cb4c0dc 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -43,6 +43,7 @@
 #include <linux/hardirq.h>
 #include <linux/workqueue.h>
 #include <linux/ratelimit.h>
+#include <linux/moduleparam.h>
 
 #include <xen/xen.h>
 #include <xen/interface/xen.h>
@@ -68,6 +69,8 @@ static int gnttab_free_count;
 static grant_ref_t gnttab_free_head;
 static DEFINE_SPINLOCK(gnttab_list_lock);
 struct grant_frames xen_auto_xlat_grant_frames;
+static unsigned int xen_gnttab_version;
+module_param_named(version, xen_gnttab_version, uint, 0);
 
 static union {
 	struct grant_entry_v1 *v1;
@@ -1191,10 +1194,16 @@ static const struct gnttab_ops gnttab_v2_ops = {
 
 static void gnttab_request_version(void)
 {
-	int rc;
+	long rc;
 	struct gnttab_set_version gsv;
 
-	gsv.version = 1;
+	rc = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
+	if (rc < 0 || !(rc >> 32))
+		gsv.version = 1;
+	else
+		gsv.version = 2;
+	if (xen_gnttab_version >= 1 && xen_gnttab_version <= 2)
+		gsv.version = xen_gnttab_version;
 
 	rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1);
 	if (rc == 0 && gsv.version == 2)
-- 
2.12.3

  parent reply	other threads:[~2017-09-08 16:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 14:48 [PATCH 0/4] xen: grant table interface v2 support Juergen Gross
2017-09-08 14:48 ` [PATCH 1/4] xen: re-introduce support for grant v2 interface Juergen Gross
2017-09-12 15:41   ` [Xen-devel] " Boris Ostrovsky
2017-09-12 15:45     ` Juergen Gross
2017-09-08 14:48 ` [PATCH 2/4] xen: limit grant v2 interface to the v1 functionality Juergen Gross
2017-09-12 15:44   ` Boris Ostrovsky
2017-09-12 15:50     ` Juergen Gross
2017-09-12 16:05       ` Boris Ostrovsky
2017-09-12 16:09         ` Juergen Gross
2017-09-12 16:21           ` Boris Ostrovsky
2017-09-12 18:18             ` Juergen Gross
2017-09-13 13:22               ` Boris Ostrovsky
2017-09-13 13:38                 ` Juergen Gross
2017-09-13 13:50                   ` Boris Ostrovsky
2017-09-13 14:45                     ` Juergen Gross
2017-09-13 16:20                       ` Boris Ostrovsky
2017-09-14  8:13                         ` Juergen Gross
2017-09-08 14:48 ` [PATCH 3/4] xen: add grant interface version dependent constants to gnttab_ops Juergen Gross
2017-09-12 16:02   ` Boris Ostrovsky
2017-09-08 14:48 ` Juergen Gross [this message]
2017-09-12 16:21   ` [Xen-devel] [PATCH 4/4] xen: select grant interface version Boris Ostrovsky
2017-09-12 18:54   ` Andrew Cooper
2017-09-13  9:23     ` Juergen Gross
2017-09-15 13:00       ` Juergen Gross
2017-09-15 13:21         ` Jan Beulich
     [not found]         ` <59BBEFFC020000780017B8EF@suse.com>
2017-09-15 13:27           ` Juergen Gross

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=20170908144849.2958-5-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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

Powered by JetHome