[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23ef7fbd-7498-4fb0-895b-81c618acedc1@linux.intel.com>
Date: Mon, 22 Apr 2024 15:40:51 +0800
From: Baolu Lu <baolu.lu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...pe.ca>, Tomasz Jeznach <tjeznach@...osinc.com>
Cc: baolu.lu@...ux.intel.com, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt
<palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Anup Patel <apatel@...tanamicro.com>, Sunil V L <sunilvl@...tanamicro.com>,
Nick Kossifidis <mick@....forth.gr>, Sebastien Boeuf <seb@...osinc.com>,
Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, devicetree@...r.kernel.org,
iommu@...ts.linux.dev, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux@...osinc.com
Subject: Re: [PATCH v2 7/7] iommu/riscv: Paging domain support
On 2024/4/19 20:56, Jason Gunthorpe wrote:
>> + riscv_iommu_cmd_inval_vma(&cmd);
>> + riscv_iommu_cmd_inval_set_pscid(&cmd, domain->pscid);
>> + if (len > 0 && len < RISCV_IOMMU_IOTLB_INVAL_LIMIT) {
>> + for (iova = start; iova < end; iova += PAGE_SIZE) {
>> + riscv_iommu_cmd_inval_set_addr(&cmd, iova);
>> + riscv_iommu_cmd_send(iommu, &cmd, 0);
>> + }
>> + } else {
>> + riscv_iommu_cmd_send(iommu, &cmd, 0);
>> + }
>> + }
> This seems suboptimal, you probably want to copy the new design that
> Intel is doing where you allocate "bonds" that are already
> de-duplicated. Ie if I have 10 devices on the same iommu sharing the
> domain the above will invalidate the PSCID 10 times. It should only be
> done once.
>
> ie add a "bond" for the (iommu,pscid) and refcount that based on how
> many devices are used. Then another "bond" for the ATS stuff eventually.
The latest version is under discussion here.
https://lore.kernel.org/linux-iommu/20240416080656.60968-1-baolu.lu@linux.intel.com/
Supposedly, you can make such optimization after the base code is landed
in the mainline tree if the change is big.
Best regards,
baolu
Powered by blists - more mailing lists