From nobody Sun Feb 8 17:04:26 2026 Received: from mail187-9.suw11.mandrillapp.com (mail187-9.suw11.mandrillapp.com [198.2.187.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9459833A9C4 for ; Tue, 6 Jan 2026 17:36:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.2.187.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767721013; cv=none; b=Y/kVPrZ3Pl8AObt7Mhu4HhYK76j9rl8tiRqtytOxOAEgDLSohLcwjK8Q6C3VTCDk5+zKNQFEWl45PU/TVK0eFgIaXS9yGpVSrYZmca2LwSvWRrA8lvfQR8o0o48wOczD6AVIUx5PQ01u0wiFio4KhGj6SpdR1+7n1FMgq8iqJI0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767721013; c=relaxed/simple; bh=5C3WrYz+oa3E4h68i48pyVSESNMBQA/+dZ/h5Y1kiBk=; h=From:Subject:To:Cc:Message-Id:Date:MIME-Version:Content-Type; b=UaNSpcnxVExa0W5Tr0kBICxBGGKjt0oKSG6DN7eOjoU6k7beRDiHmZyI0TpcoiJ+hobHCtXsxgH0lRDs1A9pe8EQgzbDEWXovJ1W8LdLiJ6vr/D9Ltn5e25VksNB01PcThBjfopEBKqFEdcNVkPD77TTPUwt8mtNJcUsgh6JKrM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vates.tech; spf=pass smtp.mailfrom=bounce.vates.tech; dkim=pass (2048-bit key) header.d=mandrillapp.com header.i=@mandrillapp.com header.b=e2ZzoTLY; dkim=pass (2048-bit key) header.d=vates.tech header.i=teddy.astie@vates.tech header.b=cFwiHmj2; arc=none smtp.client-ip=198.2.187.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=vates.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bounce.vates.tech Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=mandrillapp.com header.i=@mandrillapp.com header.b="e2ZzoTLY"; dkim=pass (2048-bit key) header.d=vates.tech header.i=teddy.astie@vates.tech header.b="cFwiHmj2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandrillapp.com; s=mte1; t=1767721010; x=1767991010; bh=w3mV3E2iL19ORVQDih7RkM67id0b/WPDTgHutCZfw84=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=e2ZzoTLYGMKHcbi4GLBfFCIx/Q4k9Umx8xHoFCtUEvNsVFdWixwCiUCLLr8U5kozs oDyqqVIX/pTQv1Cq9W053EovMKCDT5pXudBNxugMrVHXPOO6/rjKL3g+qZ2aWBw8IN 6DSzGPjn3klz85h9ljxWDn/FWXwcUJDQsfq/hIhTC1fff6NHSpbaVOK/8zQ9j2qPJN ENYaMdJvN/ukFUNs+QkxaF9fo5XgU7pWznV5y2FVK9hDN7Sn42jE9BLKn6F3pF25kS TczcbBdG+UC0eINde01WQGncvdAYqrOggI+17JxAojDOuKR7imiOX0Y+vYBYYr0ntE D0TxNhIIAvLXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vates.tech; s=mte1; t=1767721010; x=1767981510; i=teddy.astie@vates.tech; bh=w3mV3E2iL19ORVQDih7RkM67id0b/WPDTgHutCZfw84=; h=From:Subject:To:Cc:Message-Id:Feedback-ID:Date:MIME-Version: Content-Type:Content-Transfer-Encoding:CC:Date:Subject:From; b=cFwiHmj2LoHa3HzAsHi3fhhokIANA2/9a0QR64l8sO/zpYJczkc8T+bn6hTG8rZtT h9yOM8Fgq41LDJtwREQFQ/FPVLsPR8Lg2TD3/xI0HL1u0B/qRLczXcIKO05EKxYANl PSf5oV+sT8663A5kj0hyEH0DEq2z3M1ae4wFNNakYJ/5xf9oklTLb1kRtA9ct3qcZ8 2jQSHqmvXWpn4i7HKy7U8eJEcV/lFQMx1Wfv13PLZh4vaPJwga90TF9F0HS4KYO9Hc f4AZc+Y9PW1By7aXobSPJNWRyULWhxij82m9hGjJA+/7tDk/dCLwFOXZP9y64SJki9 eoTMeQzsGhZFQ== Received: from pmta09.mandrill.prod.suw01.rsglab.com (localhost [127.0.0.1]) by mail187-9.suw11.mandrillapp.com (Mailchimp) with ESMTP id 4dlyyp4W0hzK5vgG1 for ; Tue, 6 Jan 2026 17:36:50 +0000 (GMT) From: "Teddy Astie" Subject: =?utf-8?Q?[PATCH]=20xen/virtio:=20Don't=20use=20grant-dma-ops=20when=20running=20as=20Dom0?= Received: from [37.26.189.201] by mandrillapp.com id 607306fad9df4a90ac5de01569d75f42; Tue, 06 Jan 2026 17:36:50 +0000 X-Mailer: git-send-email 2.52.0 X-Bm-Disclaimer: Yes X-Bm-Milter-Handled: 4ffbd6c1-ee69-4e1b-aabd-f977039bd3e2 X-Bm-Transport-Timestamp: 1767721008494 To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: "Teddy Astie" , "Juergen Gross" , "Stefano Stabellini" , "Oleksandr Tyshchenko" , "Boris Ostrovsky" Message-Id: <6698564dd2270a9f7377b78ebfb20cb425cabbe8.1767720955.git.teddy.astie@vates.tech> X-Native-Encoded: 1 X-Report-Abuse: =?UTF-8?Q?Please=20forward=20a=20copy=20of=20this=20message,=20including=20all=20headers,=20to=20abuse@mandrill.com.=20You=20can=20also=20report=20abuse=20here:=20https://mandrillapp.com/contact/abuse=3Fid=3D30504962.607306fad9df4a90ac5de01569d75f42?= X-Mandrill-User: md_30504962 Feedback-ID: 30504962:30504962.20260106:md Date: Tue, 06 Jan 2026 17:36:50 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Fixes: 61367688f1fb0 ("xen/virtio: enable grant based virtio on x86") Reviewed-by: Juergen Gross --- CC: Juergen Gross CC: Stefano Stabellini CC: Oleksandr Tyshchenko CC: Boris Ostrovsky drivers/xen/grant-dma-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/grant-dma-ops.c b/drivers/xen/grant-dma-ops.c index 14077d23f2a1..c2603e700178 100644 --- a/drivers/xen/grant-dma-ops.c +++ b/drivers/xen/grant-dma-ops.c @@ -366,7 +366,8 @@ static int xen_grant_init_backend_domid(struct device *= dev, if (np) { ret =3D 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 =3D 0; ret =3D 0; --=20 2.52.0 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech