public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] xen: don't require virtio with grants for non-PV guests
@ 2022-06-16  5:37 Juergen Gross
  2022-06-16  6:03 ` Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Juergen Gross @ 2022-06-16  5:37 UTC (permalink / raw)
  To: xen-devel, linux-kernel
  Cc: viresh.kumar, hch, Juergen Gross, Stefano Stabellini,
	Oleksandr Tyshchenko

Commit fa1f57421e0b ("xen/virtio: Enable restricted memory access using
Xen grant mappings") introduced a new requirement for using virtio
devices: the backend now needs to support the VIRTIO_F_ACCESS_PLATFORM
feature.

This is an undue requirement for non-PV guests, as those can be operated
with existing backends without any problem, as long as those backends
are running in dom0.

Per default allow virtio devices without grant support for non-PV
guests.

Add a new config item to always force use of grants for virtio.

Fixes: fa1f57421e0b ("xen/virtio: Enable restricted memory access using Xen grant mappings")
Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
V2:
- remove command line parameter (Christoph Hellwig)
---
 drivers/xen/Kconfig | 9 +++++++++
 include/xen/xen.h   | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig
index bfd5f4f706bc..a65bd92121a5 100644
--- a/drivers/xen/Kconfig
+++ b/drivers/xen/Kconfig
@@ -355,4 +355,13 @@ config XEN_VIRTIO
 
 	  If in doubt, say n.
 
+config XEN_VIRTIO_FORCE_GRANT
+	bool "Require Xen virtio support to use grants"
+	depends on XEN_VIRTIO
+	help
+	  Require virtio for Xen guests to use grant mappings.
+	  This will avoid the need to give the backend the right to map all
+	  of the guest memory. This will need support on the backend side
+	  (e.g. qemu or kernel, depending on the virtio device types used).
+
 endmenu
diff --git a/include/xen/xen.h b/include/xen/xen.h
index 0780a81e140d..4d4188f20337 100644
--- a/include/xen/xen.h
+++ b/include/xen/xen.h
@@ -56,7 +56,7 @@ extern u64 xen_saved_max_mem_size;
 
 static inline void xen_set_restricted_virtio_memory_access(void)
 {
-	if (IS_ENABLED(CONFIG_XEN_VIRTIO) && xen_domain())
+	if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())
 		platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS);
 }
 
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-06-17  8:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-16  5:37 [PATCH v2] xen: don't require virtio with grants for non-PV guests Juergen Gross
2022-06-16  6:03 ` Christoph Hellwig
2022-06-16  6:15   ` Juergen Gross
2022-06-16  7:31 ` Oleksandr
2022-06-16  8:56   ` Juergen Gross
2022-06-16 20:33     ` Oleksandr
2022-06-17  0:03       ` Stefano Stabellini
2022-06-17  5:49         ` Juergen Gross
2022-06-17  8:15           ` Oleksandr
2022-06-17  5:41       ` Juergen Gross
2022-06-16 18:20 ` Stefano Stabellini
2022-06-17  5:38   ` Juergen Gross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox