summaryrefslogtreecommitdiff
path: root/drivers/xen
diff options
context:
space:
mode:
authorTeddy Astie <teddy.astie@vates.tech>2026-01-06 17:36:50 +0000
committerSasha Levin <sashal@kernel.org>2026-03-04 07:19:26 -0500
commit9cc9efa703f0941f39a1f56acd1df81a087a44b6 (patch)
tree73a5f8c3afc2dca9b893f3b92ebd3ea6dfa8caba /drivers/xen
parent7425453ea16dbc3bbb0f6cac4d60b537e5e4d151 (diff)
downloadlinux-9cc9efa703f0941f39a1f56acd1df81a087a44b6.tar.gz
linux-9cc9efa703f0941f39a1f56acd1df81a087a44b6.tar.bz2
linux-9cc9efa703f0941f39a1f56acd1df81a087a44b6.zip
xen/virtio: Don't use grant-dma-ops when running as Dom0
[ Upstream commit dc8ea8714311e549ee93a2b0bdd5487d20bfadbf ] Dom0 inherit devices from the machine and is usually in PV mode. If we are running in a virtual that has virtio devices, these devices would be considered as using grants with Dom0 as backend, while being the said Dom0 itself, while we want to use these devices like regular PCI devices. Fix this by preventing grant-dma-ops from being used when running as Dom0 (initial domain). We still keep the device-tree logic as-is. Signed-off-by: Teddy Astie <teddy.astie@vates.tech> Fixes: 61367688f1fb0 ("xen/virtio: enable grant based virtio on x86") Reviewed-by: Juergen Gross <jgross@suse.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <6698564dd2270a9f7377b78ebfb20cb425cabbe8.1767720955.git.teddy.astie@vates.tech> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/xen')
-rw-r--r--drivers/xen/grant-dma-ops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c
index 76f6f26265a3..12fbe8938259 100644
--- a/drivers/xen/grant-dma-ops.c
+++ b/drivers/xen/grant-dma-ops.c
@@ -362,7 +362,8 @@ static int xen_grant_init_backend_domid(struct device *dev,
if (np) {
ret = xen_dt_grant_init_backend_domid(dev, np, backend_domid);
of_node_put(np);
- } else if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain()) {
+ } else if (!xen_initial_domain() &&
+ (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())) {
dev_info(dev, "Using dom0 as backend\n");
*backend_domid = 0;
ret = 0;