Skip to content

Commit dc8ea87

Browse files
TSnake41jgross1
authored andcommitted
xen/virtio: Don't use grant-dma-ops when running as Dom0
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: 6136768 ("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>
1 parent db9aded commit dc8ea87

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/xen/grant-dma-ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,8 @@ static int xen_grant_init_backend_domid(struct device *dev,
366366
if (np) {
367367
ret = xen_dt_grant_init_backend_domid(dev, np, backend_domid);
368368
of_node_put(np);
369-
} else if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain()) {
369+
} else if (!xen_initial_domain() &&
370+
(IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain())) {
370371
dev_info(dev, "Using dom0 as backend\n");
371372
*backend_domid = 0;
372373
ret = 0;

0 commit comments

Comments
 (0)