From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4A517C53200 for ; Wed, 29 Jul 2026 11:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=C8UU16bHd5hKDwiJjACFQ7VyF2l/Ioe4Nrx+EJKE7Y0=; b=vw98WYeYhnnEJdRyiWsdqZ5984 jhDgr5ZV/j9F3Y7D39w7LzFC+bdwuAfNoLh/5VqOlnsxtm6LKKzEGoqa7O4ow/kUv7swTY0HEIFu8 m4E/3EDj65LMLPsvHwS/i6jSC6M+DEA+7weD5Yn/Qb7SIsPKmmv5ytNXv1kvc+Ve2EcN68Eq33odN QzrxL+gZj3J3ScRHSWf9vDJl/c7q6CatxVtHbge/m2aPwYGeLngInKcUtm19yR1ijebeBWQzXcmUJ Pi5LNErFr9nvZuNYIGms+mYwMGdczjymfWUr4q4WX04pPa/5cIZInLp7jVzKi92qp083lo74rimIY 1FVZQDmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wp2M4-00000007hrK-0LdU; Wed, 29 Jul 2026 11:21:44 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wp2M1-00000007hor-2M5Z; Wed, 29 Jul 2026 11:21:42 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 89C231688; Wed, 29 Jul 2026 04:21:34 -0700 (PDT) Received: from [10.57.44.102] (unknown [10.57.44.102]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 463383F86F; Wed, 29 Jul 2026 04:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1785324098; bh=MB28ZDQXnRUEjS0QpfpMx6wHRzIxNI4OeS25bP12DFc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=qATPPOOiKFq2WOesC8q1NUuqO8LSLfmyaDs5deWapEMmKkCbPR0dThDjYWrbdPVZf dE4OeQNPo2A07MypAALO2HOPX2h9phA76VaX6TLEkiyyCiKdhJ4DG2Cph/4s2dfyBL e8VzRjDJQSsry1xjPn//P0JB30WEF1h5KK4iZn+c= Message-ID: <1361ff13-fd24-4ba6-a048-eb2091d989ea@arm.com> Date: Wed, 29 Jul 2026 12:21:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 4/5] iommu: Add Broadcom BCM2712 IOMMU driver To: Jason Gunthorpe Cc: Daniel Drake , "Joerg Roedel (AMD)" , Will Deacon , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, nick.hollinghurst@raspberrypi.com References: <20260727-bcm2712-iommu-submit-v2-0-0247b5c03de8@reactivated.net> <20260727-bcm2712-iommu-submit-v2-4-0247b5c03de8@reactivated.net> <3e7ba95b-51e7-48e4-aea5-f86db1739ac2@arm.com> From: Robin Murphy Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260729_042141_681960_372635BD X-CRM114-Status: GOOD ( 26.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2026-07-29 1:10 am, Jason Gunthorpe wrote: > On Tue, Jul 28, 2026 at 11:51:04AM +0100, Robin Murphy wrote: >>> + ret = pt_iommu_bcm2712_init(&domain->pt, &cfg, GFP_KERNEL); >>> + if (ret) >>> + goto err; >>> + >>> + /* Set up a default (error) page used to catch illegal reads/writes */ >>> + domain->default_page = iommu_alloc_pages_sz(GFP_KERNEL, PAGE_SIZE); >>> + if (!domain->default_page) >>> + goto err; >>> + >>> + domain->base.geometry.aperture_start = BCM2712_APERTURE_BASE; >>> + domain->base.geometry.aperture_end = BCM2712_APERTURE_END - 1; >>> + domain->base.geometry.force_aperture = true; >> >> ...and thus (as things stand) this is a lie :( > > Well, it shouldn't be here, the iommupt core code should be setting > this from its own internal information. If there is something missing > to add in the full_va_prefix we should fix it. > > But, AFAIK this is the correct way to declare a page table that has a > range of IOVA - which I think is what this is doing.. Nope, aperture_start and aperture_end already indicate the range of what can be used as translatable IOVAs; force_aperture is supposed to indicate whether addresses _outside_ that range are blocked, or may still be able to access memory as with a GART-style device. Heck, a "proper" IOMMU doesn't even have an "aperture", it simply has an entire input address space. >> If you want to operate like an IOMMU, then the translation aperture and the >> bypass window should really be mutually-exclusive; > > I think it is operating like an iommu.. > > It uses generic_single_device_group() so there is only ever one > translation. Also like a GART. > If identity is attached then it clears MMMU_CTRL_OPERATING_FLAGS which > I guess fully disables the IOVA aperture Not unlike a GART. > If paging is attached then it sets MMMU_CTRL_OPERATING_FLAGS and > places the aperture at 40G. Based on the comments about blocking I > wonder if the "bypass" even works when paging is on? Rather like a GART. > If blocking is attached then it sets MMMU_CTRL_OPERATING_FLAGS with > some 0 address cap which aborts everything? Disabling the aperture is also GART-like, but also disabling the bypass window would seem the be the exclusively IOMMU-like behaviour there ;) > It looks to me like some of those comments and choices don't reflect > what the driver actually does. Since there is only ever one > translation we never need to be worried about where the aperture is, > it could be anything so long as the HW gives it priority to bypass. I'm looking at the BYPASS_START/BYPASS_END stuff, where (assuming that's intuitive and not completely misnamed) bcm2712_iommu_attach_dev() sure seems to be opening up a giant hole in all paging domains per the commit message, thus while they can offer the convenience of IOVA remapping, they aren't providing any real memory protection. Thanks, Robin. > Could the aperture be placed at 0 with the bypass fully disabled? Then > it would basically be a normal iommu. > > Jason