From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.50]) (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 9ED1037A829 for ; Sun, 12 Jul 2026 22:11:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783894289; cv=none; b=NPzdUAUnReoTP/XdEllGM2Qpfx2F3FQn0qMsgX9ZDiLYLrkM9B2snP3LA0ZWgNF1Z4lZ7iQy61DG12375DEPZtfqWLr/tC+KIJOaVkz+TAYsssWxWgaXsFbxUemoYlCznCJvmV5pvxR4pfni5ParVUHlU1LjLTiN3ZMgx6lXXRU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783894289; c=relaxed/simple; bh=vICjuJZMyL8ox/LroketggeEi023fKRGGXjlLd3/YVk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BZctkeKo8flFsubtFnTkyBOX0nENjuDaTcbU9r6Xh1aN1zLVR11a97oQYAvuBzEu6a+Srbpb/MQnqb01cBUfcyjlj8dnn3yAlaKHUlIlEYJy5rkVwKZUUbr78jDyUSyoK0qciszd0KMyyIsIcihzj5k2itEFtNUk+cAh3KVNf/s= 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=ZTfD/Az3; arc=none smtp.client-ip=209.85.219.50 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="ZTfD/Az3" Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-8efb708b1a0so21713466d6.3 for ; Sun, 12 Jul 2026 15:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1783894286; x=1784499086; 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=egnmCxbrpH7UR+MZJeffNbFqc9tcIYQZ6W/rYZyeos8=; b=ZTfD/Az33NRTsDpAMPJkFousSSL5hVhynBEYuyfStFhCaqzRx3fuTQ0Oocle9uK0Df Q0RE/ILH4ZpwnKbtvNIywkMfj3ZUw0U/g38lKHr2Wh1rRGhGj4yFxQ/SXgsDxPJPmGFQ wl6BFvTW7VVsh3HxhLjYTXAawHHlDgO0o+Ftnkw9TKyGVz6eGIzcrYH810N4AWkhKBFi dN92zfY9AlRrSvOjizjgcAw+EpNNqfq1ipo1k44jCOTGf0CSBnIQXownnwOXAnoi+a8W S/lWyT0g618Gtw/LZwVBvclRCqL20XNGsu8fEoZcTcRJ2snBubX6ieiArjOk33FNqg6V e/Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783894286; x=1784499086; 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=egnmCxbrpH7UR+MZJeffNbFqc9tcIYQZ6W/rYZyeos8=; b=h73Won5Dya+BYSCUnj1dUZA8PUN5z+ECcAUW2hnLT2j1I13DrfSosHWlhjDKbZqDwz aykpbSb+Pk2bgI2rxBk+WStOOX1apAvwbCuZhOaKp/hvuZOmXyJA2Il9CmzCFKgY4wSH lbqsAibAMzQtHtqMojjBD5jlBjxJixw1nlALu5xPaDOYC5AjoNu6r+XKicV8DGAXwfLl ElRB0HdqCRozycswtgzrqE9teGJoIXHSXzq5FKXYyLYx5sAfg+zo/pKIfpPmKC5jlcq+ nZA+O3l2XnKyNlgpL55zV8fDHMR30Xlxm5BXqbwrj2p1kh8cm0tI+PePoLQh940fuRkB 6uWg== X-Forwarded-Encrypted: i=1; AHgh+Rodd1cPitU4qVgX8CFgg33YLfH7VXNd16G4FQsmvCIuUi8RecMYhEl1sdDrlQCQDOc2k8rnyKmmK5gTDgA=@vger.kernel.org X-Gm-Message-State: AOJu0YxSwG5Y3V2YKqjDMvLBiMmqrj207x6OLt5Ufn9+t8Y6Ijy0cwTK 3SGLpDT2xDC8lNDwZUYworrCPYJQ/jaMFumv3YleUh5dy4CntAFYZTNKStUNoWQw4Ag= X-Gm-Gg: AfdE7ckP5kpuloy/0I32fyezweQF9fozBd0wGbPFOJP0EKSoQpY/7TkW96bmmKKpC5I UZbqzTd2g8vn7zRf+mbdqnsup9qa32m3O6qcjPT4/I5YybU9gFfQbs3Et9ukWZcWDoRpd5IaA1e tZWn3FkIqgg2H0H/0uNj7M31GsWrXWAjf523ipBnBaJPmTWUc74Otm9MtGLhqG7/t4EHdryfHOq XbYTA8yBalq7eiyqZM7dIemicd+OeFHNgWSR19MNCluG4itKbAqkL8ipaPfRdr1rHUqqouZyIOz n8hcbrZu4EELUfxvdANeBq3CAPOj+zaNpZ7C5F5Q2huBVv4bMsMHe4PeU1X2kSlcD5NpYj0zKsj 1OFP+JsfhZS5O5aQ04FJ8LMgI6D40XOByV2l96yHnpkBoQbomu1s3PqEAermF X-Received: by 2002:ad4:5dc3:0:b0:8f1:440c:7f81 with SMTP id 6a1803df08f44-903fe450e71mr71838966d6.4.1783894286578; Sun, 12 Jul 2026 15:11:26 -0700 (PDT) Received: from ziepe.ca ([159.2.72.92]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ffd50e10f4sm113814616d6.1.2026.07.12.15.11.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jul 2026 15:11:26 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wj2OT-0000000Bo42-2Ctj; Sun, 12 Jul 2026 19:11:25 -0300 Date: Sun, 12 Jul 2026 19:11:25 -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 5/6] iommu: Add Broadcom BCM2712 IOMMU driver Message-ID: <20260712221125.GD1835788@ziepe.ca> References: <20260712-bcm2712-iommu-submit-v1-0-80e10cdde2ea@reactivated.net> <20260712-bcm2712-iommu-submit-v1-5-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-5-80e10cdde2ea@reactivated.net> On Sun, Jul 12, 2026 at 10:18:55PM +0100, Daniel Drake wrote: > +static int bcm2712_iommu_of_xlate(struct device *dev, > + const struct of_phandle_args *args) > +{ > + struct platform_device *iommu_dev = of_find_device_by_node(args->np); > + struct bcm2712_iommu *mmu = platform_get_drvdata(iommu_dev); > + > + dev_iommu_priv_set(dev, mmu); > + return 0; > +} Any chance this could work the way that smmuv3 does? I view it as the more modern example.. > +static int bcm2712_iommu_map_pages(struct iommu_domain *domain, > + unsigned long iova, phys_addr_t paddr, > + size_t pgsize, size_t pgcount, int prot, > + gfp_t gfp, size_t *mapped) > +{ > + struct bcm2712_iommu_domain *mydomain = to_bcm2712_domain(domain); > + struct pt_iommu *pt = &mydomain->pt.iommu; > + > + return pt->ops->map_range(pt, bcm2712_iova_to_offset(mydomain, iova), > + paddr, pgsize * pgcount, prot, gfp, mapped); > +} These ops should not be present, the iommpt provides the ops directly through a macro; > +static const struct iommu_ops bcm2712_iommu_ops = { > + .identity_domain = &bcm2712_identity_domain, > + .domain_alloc_paging = bcm2712_iommu_domain_alloc, > + .probe_device = bcm2712_iommu_probe_device, > + .device_group = generic_single_device_group, > + .of_xlate = bcm2712_iommu_of_xlate, > + .default_domain_ops = &(const struct iommu_domain_ops) { > + .attach_dev = bcm2712_iommu_attach_dev, > + .iotlb_sync = bcm2712_iommu_sync, > + .iotlb_sync_map = bcm2712_iommu_sync_map, > + .flush_iotlb_all = bcm2712_iommu_sync_all, > + .free = bcm2712_iommu_domain_free, > + .map_pages = bcm2712_iommu_map_pages, > + .unmap_pages = bcm2712_iommu_unmap_pages, > + .iova_to_phys = bcm2712_iova_to_phys, > + }, "default_domain_ops" should ideally be split out to a "paging domain ops" static and set directly during alloc_paging. They are not really "default" anymore if the driver has unique ops for every domain type. Then use something like: IOMMU_PT_DOMAIN_OPS(bcm2712), To define all the page table related ops automatically. Any chace the HW can do a blocking_domain, or is the only way to do that with an empty paging domain? Jason