From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ADC38606A31A for ; Mon, 30 Nov 2026 20:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=shazbot.org header.i=@shazbot.org header.a=rsa-sha256 header.s=fm3 header.b=Ve/pi8c5; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm3 header.b=w+yHKdIR Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xY83U-0000im-M6; Mon, 30 Nov 2026 15:32:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xY83T-0000iG-CP for qemu-arm@nongnu.org; Mon, 30 Nov 2026 15:32:55 -0500 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xY83R-0005No-Bj for qemu-arm@nongnu.org; Mon, 30 Nov 2026 15:32:55 -0500 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id 6CCAC7A0484 for ; Mon, 30 Nov 2026 15:32:50 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 30 Nov 2026 15:32:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shazbot.org; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1796070769; x=1796157169; bh=YjMsXfYj329ptUP6pA1DrCUyNfriJQDI7r37bfmjIbM=; b= Ve/pi8c5Ah0vggGhkdsltfcM67ZfdxurrZ1eDSohpQskaptUXJ5CR/Fh5TMIcF++ 5cWW+ir9E9tr9ulSiEdf+ZlCp1K8sMvV5dFRGqsIhQETpAHMTqpLU4Wr0dowP9sg XKW3VGfKCD6Vp6tx5M8fm+T/2cJwg/Y7vNhfhXav1ziBMIV6bmt2/6aneSPeYAOn u+Ql4VGsHkIgzRf5Ay1k8ajqSez1a8Aeygl+JKLTD6mZddZY7t85g1LdqFTDMBsl Zm4ZN8s5kruBQRZJFIs6drkPPmzwPWgEphKPrbDe0pdY3fqbJ7Iy9M3Tmw3FXg5U PVa+c7041V6igvaExRZ2+w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1796070769; x= 1796157169; bh=YjMsXfYj329ptUP6pA1DrCUyNfriJQDI7r37bfmjIbM=; b=w +yHKdIRpn6Qi5NKFZfJC6NfsnDjQYH7dQmAGtK3CulpPt+jCFJR9Wdzzhll4L1Rd Nam28+7qZg22iuyFcRscxkzkDsgbB2OSNp2gzHEw+O1T6qMssu/dHXl2b1ZCPT0I QsD68rdsjZCBdILCwlju5Bvt/VQS67QCd7GUqHtaonTWxw3NXC80zISmC0e6qx0B R5HMqqnwZpD6uDylSlAzZKFTcyoz1UnT3C2F7+WVJFsxcjZ4PcYKbpLViNDXD0Kx oFDVJmnZ733IyLgAsiKtt1yxtk8Gp9cRQjmZwHd9HKBhpkoMJnVzmJvvs13lJ8Ja 0t6lx4luQrE1Qgaj2vMHw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=shazbot.org a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796070769; d=shazbot.org; mf=PGFsZXhAc2hhemJvdC5vcmc+; rt=PHFlbXUtYXJtQG5vbmdudS5vcmc+; s=fm3:rsa-sha256:hVgodo9H71uPSizPrY7GqgQbivvojfWc4dfJfeXJ4yKnXTY RC8M/JUv0O0BUeUmVrhfiZfeRQkhiC3pYwAn9GIlvbpyEqBZFgFIC7hTylTLcCQn mA4Tpt4Bi+J+dIxlKo1nI4Fizofb8cG1bO8DVnwbLkFgy7QeQwWboKSMk561hY+t Jgc64FX7PJfYSHanDVvFb767M1IhP+d5Ts+HlRhVl5rRG/bOSvpp/IuT9dgQF1kR YJVzW2cRaH1Z4y3k3KPiJej6YAKX/rwGGIAdWDY8qeywpiYQU+a9Jxqk4ODv+TMr He4Qa8jdvVyL0jtZ5UTPzdI5qBmYStX11vuqghw==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-transfer-encoding,content-type,date,feedback-id, from,in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:TXHTJI0+KoQBpDSyh/Mdm6AY0RKGwRTjORqIgjgJRGY=:wceSR86RWXhUMqka5rVHWtxVF3zq0BKAP/ZFKxBSlQo=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTGGbqraqB1MdDvLqydINPZjKvH8XlqL4O9PY6gc/tvWrBEOyEyki/ljBxZn4TQ4C/ WghQHcrJmlTpPhq1PmEufn7cPMO2EYF16dz6QyYxhouRg2Nd90GqGkdRyJX8+jIFEoqR1+ mHKwhuI8HippE80jfOXaEHnFRuQoLgD/TIwxo/XjRAwtiSiuSd5UkGua/3cubP7QJaDITD 71nwv7pfC+pC7bgkBuXapB7Hd5+RxToBr5CyAVo4q3CPJr2ffztOK86zjmnMclpPSySLhQ H0ob1pfLnLs2PY0HiRfKQkwEJRovp8rqmudkpXbqzM4R0LLmuFr9TRJu7C9WMRl2Q8O0pr hXO2K2fe8Y3UKsqxAE73FwBPRRJYPtze0Y7aBzYE8ZIbO8evOU73K33np1MIaobP6qQMdy OwToJkPI1lHkXFiNjl6X2YipFCld9dGxwb4nA41SAZ4Zqjwu9vIZzw/GTSunXReGmMiaHb zaFIxD4IUC9SuEPXOf0HjyY0Cga4tpNzMX3xAcSRwK3KSV0x7QwI84/RxgwslORdGkUm+L altpxPh/brQubvTVdaBNiTJrsSMMcGlA+kSwINGicMxYlRYKtAiYFEbiSPMA9KFTjwZBZw iHo8XhNRbT0FZe0HQe+HYIdjv/nGV8qdvPN60VpzytWsdZbUZNN1bWMiXs2w X-ME-Proxy: Feedback-ID: i03f14258:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 30 Nov 2026 15:32:48 -0500 (EST) Date: Mon, 30 Nov 2026 13:32:47 -0700 From: Alex Williamson To: Shameer Kolothum Thodi Cc: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater , "qemu-devel@nongnu.org" , "qemu-arm@nongnu.org" , Nicolin Chen , Eric Auger , alex@shazbot.org Subject: Re: [PATCH] vfio/region: Skip IOMMU mapping for BARs when dma-buf is unavailable Message-ID: <20261130133247.204c6c44@shazbot.org> In-Reply-To: References: <20261106145144.1352917-1-clg@redhat.com> <8e68a94d-a559-41ae-835d-98c699e583ab@redhat.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=202.12.124.152; envelope-from=alex@shazbot.org; helo=fhigh-b1-smtp.messagingengine.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org X-Spam-Status: No, score=-17.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On Mon, 30 Nov 2026 19:27:21 +0000 Shameer Kolothum Thodi wrote: > > -----Original Message----- > > From: C=C3=A9dric Le Goater > > Sent: 30 November 2026 18:54 > > To: qemu-devel@nongnu.org > > Cc: qemu-arm@nongnu.org; Alex Williamson ; Shameer > > Kolothum Thodi ; Nicolin Chen > > ; Eric Auger > > Subject: Re: [PATCH] vfio/region: Skip IOMMU mapping for BARs when dma- > > buf is unavailable > >=20 > > External email: Use caution opening links or attachments > >=20 > >=20 > > On 11/6/26 15:51, C=C3=A9dric Le Goater wrote: =20 > > > When the kernel does not support the VFIO_DEVICE_FEATURE_DMA_BUF > > > feature (e.g. old kernel or out-of-tree vGPU driver), > > > vfio_region_create_dma_buf() returns with a warning and no fd is > > > assigned to the BAR RAMBlocks. Later, when the VFIO listener tries > > > to DMA-map these BAR regions, the iommufd backend falls back to > > > IOMMU_IOAS_MAP with a vaddr pointing at device MMIO. The kernel =20 > > cannot =20 > > > pin device memory and fails with EFAULT on aarch64, producing these > > > warnings: > > > > > > qemu-kvm: warning: VFIO dma-buf not supported in kernel, using mma= p =20 > > fallback, P2P DMA will not work =20 > > > qemu-kvm: warning: IOMMU_IOAS_MAP failed: Bad address, PCI BAR? > > > qemu-kvm: warning: vfio_container_dma_map(0xaaabb9621a90, =20 > > 0x88400000000, 0x10000, 0xfffe50100000) =3D -14 (Bad address) =20 > > > hostdev0: PCI peer-to-peer transactions on BARs are not supported. > > > > > > memory_region_set_skip_iommu_map() was recently introduced by commit > > > 11b9798c7b52 ("memory: Allow RAM device regions to skip IOMMU > > > mapping") for the Tegra CMDQV case. Use it to mark BAR mmap regions > > > when dma-buf is unavailable so the VFIO listener skips them. This > > > drops the last three messages and covers both the iommufd and legacy > > > Type1 IOMMU backends. > > > > > > Cc: Shameer Kolothum > > > Cc: Nicolin Chen > > > Cc: Eric Auger > > > Fixes: 8cfaf22668c7 ("hw/vfio/region: Create dmabuf for PCI BAR per = =20 > > region") =20 >=20 > But the last three warn messages predate 8cfaf22668c7, right? >=20 > Also, 11b9798c7b52 ("memory: Allow RAM device regions to skip IOMMU > mapping") is a prerequisite which landed later. >=20 > > > Signed-off-by: C=C3=A9dric Le Goater > > > --- > > > hw/vfio/region.c | 3 +++ > > > 1 file changed, 3 insertions(+) > > > > > > diff --git a/hw/vfio/region.c b/hw/vfio/region.c > > > index =20 > > 996bc523edfe10bd256f5b09dec45cb5c9f543f0..4148d0ea8e35496e4c5a2 > > bf97d1ef6974df7ccbb 100644 =20 > > > --- a/hw/vfio/region.c > > > +++ b/hw/vfio/region.c > > > @@ -362,6 +362,9 @@ static bool =20 > > vfio_region_create_dma_buf(VFIORegion *region, Error **errp) =20 > > > if (ret =3D=3D -ENOTTY) { > > > warn_report_once("VFIO dma-buf not supported in kernel,= " > > > "using mmap fallback, P2P DMA will not= work"); > > > + for (i =3D 0; i < region->nr_mmaps; i++) { > > > + memory_region_set_skip_iommu_map(®ion->mmaps[i].m= em, =20 > > true); =20 >=20 > This will affect the legacy VFIO path as well now. I can't recollect whet= her > that had support for mapping these regions or not. Please check. Yes, and it seems to go against the whole warning. If dma-buf support isn't present we fall back to legacy VFIO_IOMMU_MAP_DMA when we're using the type1 backend. That can DMA map against the mmap, but only if we let it by not telling the listener to skip the mapping. The existing warning is also misleading, falling back to mmap is a perfectly functional option for P2P DMA to work in a legacy container. Thanks, Alex