From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3296C379980 for ; Sun, 12 Jul 2026 22:02:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783893761; cv=none; b=HPE9GIltjB4SLyBEkmOJa74I8ufCWdBzwnNjFX//XoU39PXJxauuko9hZ2GoLV2iCDrI188JglYcJY2cJUdaY8WbuAZwe0XbDq8UVyFxrw+Ear3GD5K0Suu1f3oe24vf3QgZanqIVCH/ZsGQdikxp09HNBmNkOLNmJTjyDi7ZaE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783893761; c=relaxed/simple; bh=9doQrKp6KwSDaJ9VqtVfvX30Yv5ebNu4lugCON+hGRU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=igczfkKX7aj4hy3wXY025VfpOQz54XYOB1QQTemCbTr+ddxF6xi+uuEsdwJZXIWwjF2z6GD9Bawv0lxkXsIdpNpTW7daN907aEbuzOvM7JAHvdiaWDEgLHVWeiuFKkFyb1IQKBs4peCbLw67xv9GOSXG+3jhs2TJRpKKoCf1wEE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=EETHylX/; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="EETHylX/" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-51bfad59921so18493241cf.0 for ; Sun, 12 Jul 2026 15:02:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783893756; x=1784498556; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=FvL6EjrEIuF0wC64QnMQO+VDujPOa7rrdCG0RMcrsPU=; b=EETHylX/5ENk2vbj6K3EEL0Onyn77l/nN+UoFHmq/+rZE/seCoHowYvoAe0aNenBAS jTJdTuDvDFfm3rSQ5agT0eTT09KrzmInKSRX92nYU2vavpXvR8Dal+xhDBmi5+CVf5T4 p8wG3IK9e0ycqZEsIWHXDPivDNoKibN34XzLJWnnWTLaQfKAXgtOzB9eCTgjNlj/yRn8 KwymwH/P4Rktt4pZtvbJM8fyXt69cyvXwMtKQkbuNiNE+2B0j/yPi9vxNcB2FEjYCurR 14P3W7tzkuiKw5vV8sCLTL05JkvQmy7dgJI4zRByhSZcz1Hy7ndTy74sTDw/CU0LlCZ5 uVTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783893756; x=1784498556; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FvL6EjrEIuF0wC64QnMQO+VDujPOa7rrdCG0RMcrsPU=; b=Dq1BbStFVD3OCjCHjMc1jHiR6cXI2TwYxrQH48mPhFxmgmfEaHvi9+nR6pEAHTS3pO w/Eiue1IGa68UAfzP3aBh/5IXpD1/o+jMfmn3sF/L5MKsV7NdcAoQrycc3D4yGf4Em8z w0zHxGQYZzzmbREGadVMhAqszgz/qJ05r5uzGt8N3N4YJKVrrmDJMu0xiOwBte6SZ6W1 B/yH87em/w7rgY695CfETgupYPH0XXnRE6u92i4rH/lKXxJqwkOW2zUEX82wZ4+4FZeK hZ4l0/Ox5+5Q0Nv/KVbglalokyOQ+m8HEHvvP+UpRdT29KipD/LMDxJBAMjOiIxeQHvH MEPQ== X-Forwarded-Encrypted: i=1; AHgh+Rq8jQN2O1KtnAXpu9JuwoF99LfBOHrFS6DfSfsr8rITEs3q0z0RsS7f2yYFHE5AmlLbK0PB3a7jiVc6+L8=@vger.kernel.org X-Gm-Message-State: AOJu0YzqlAANysgJ9+AmCDKmaR08IM+mznfjfHNrRYlHMFxMDhRFFuCD 0hTNEBdwxCUp0IhQeIeMJv0M8QOPTxsqfCmnB2gcsK/qRaevpfchH98ToZ1Q+D5n8d8= X-Gm-Gg: AfdE7ckovS+gpOknC9HRLHCAZw263miuL4ByM7xAT/8OgW8r5Xo1v03gWP3yo0B95ea N1kjpBs1JgNBbQuf734mp4dfKeQJ52K6DjtBZbxP7w2C1ssc718hK3JmqKdoiMz3zjcLuCcr2Ok +LJLmcFZUQzfI55j2g5r0Q3J/eKBc3VIY0/dvaRBFLBS9ejKFgeX2fxLdCy8S5lyFwEjK9Yh2Vc LVjIRmyCbRgzwSPn4EkOQHmB3Kr90Q4f00Slg69v/ejgfYOix1gKPC1xHTe8UegVdqeER4SzvLO t3awo9seylA+/bKIw+IOIzZOF4Q5kTQ6VY/3aTHU4VKZnsVXZQ1AgaNbE258byMbpDF+u3WPJ1U QyF67AyNBhD0xyI7n9TwC7CM+XwHbbYaUbLItxMvsKt/F//OJ1Wxz2WD+Hlhg X-Received: by 2002:a05:622a:15c4:b0:51a:8e07:59d5 with SMTP id d75a77b69052e-51cbf071548mr72240201cf.12.1783893756428; Sun, 12 Jul 2026 15:02:36 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd56c4b78sm113643606d6.18.2026.07.12.15.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 15:02:35 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wj2Fu-0000000BnNB-2edV; Sun, 12 Jul 2026 19:02:34 -0300 Date: Sun, 12 Jul 2026 19:02:34 -0300 From: Jason Gunthorpe To: Daniel Drake Cc: "Joerg Roedel (AMD)" , Will Deacon , Robin Murphy , 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 Subject: Re: [PATCH 2/6] iommupt: allow full-table contiguous leaves in unit tests Message-ID: <20260712220234.GB1835788@ziepe.ca> References: <20260712-bcm2712-iommu-submit-v1-0-80e10cdde2ea@reactivated.net> <20260712-bcm2712-iommu-submit-v1-2-80e10cdde2ea@reactivated.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260712-bcm2712-iommu-submit-v1-2-80e10cdde2ea@reactivated.net> On Sun, Jul 12, 2026 at 10:18:52PM +0100, Daniel Drake wrote: > The generic_pt tests currently assume that a format should never support > a contiguous page size that spans the entire mapping range of the table > it resides in. > > This assumption breaks for BCM2712, which has a 2-level page table. > Level 1 entries cover 4MB of memory via their corresponding Level 0 > table pages. There is a concept of a 4MB largepage, but that is > represented as a Level 1 entry pointing at a Level 0 table with the 1024 > usual PTEs with an additional largepage hint applied (for TLB > optimization purposes). Unlike typical IOMMUs, it is not possible to have > the Level 1 entry point directly at a 4MB chunk without the need for > Level 0 mapping. > > This BCM2712 format is well supported by generic_pt: SZ_4M can be > advertised as a possible size at Level 0 (so that the iommu core feeds > it 4MB-aligned mapping requests where possible), and drivers can also > advertise that *all* leaf entries are installed at Level 0. This indicates > that the tests are overly strict. > > Transform the test to become a validation of the driver's routing intent: > for every advertised page size, check that pt_pgsz_lg2_to_level() maps that > size back to the table level under test. This is roughly what the original > tests were doing, but also allows the BCM2712 case to pass. Seems fine, but I wonder if it should be conditional on the format somehow, I put it in to detect mistakes on what was the universal case that nothing would do this. Either way Reviewed-by: Jason Gunthorpe Jason