[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f549b436-b6f4-4ee8-9086-6f8d08e4e49e@arm.com>
Date: Mon, 12 Aug 2024 14:12:46 +0100
From: Robin Murphy <robin.murphy@....com>
To: Easwar Hariharan <eahariha@...ux.microsoft.com>,
Jason Gunthorpe <jgg@...pe.ca>
Cc: Tomasz Jeznach <tjeznach@...osinc.com>, Joerg Roedel <joro@...tes.org>,
Will Deacon <will@...nel.org>, 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,
Lu Baolu <baolu.lu@...ux.intel.com>, Zong Li <zong.li@...ive.com>
Subject: Re: [PATCH v8 7/7] iommu/riscv: Paging domain support
On 08/08/2024 5:40 pm, Easwar Hariharan wrote:
> On 8/8/2024 6:14 AM, Jason Gunthorpe wrote:
>> On Tue, Aug 06, 2024 at 12:24:40PM -0700, Easwar Hariharan wrote:
>>> On 6/14/2024 10:27 PM, Tomasz Jeznach wrote:
>>>
>>>> @@ -856,7 +1473,7 @@ static struct iommu_domain riscv_iommu_identity_domain = {
>>>>
>>>> static int riscv_iommu_device_domain_type(struct device *dev)
>>>> {
>>>> - return IOMMU_DOMAIN_IDENTITY;
>>>> + return 0;
>>>> }
>>>
>>> <snip>
>>> Sorry for the drive by comment, I just happen to be in the nearby code
>>> context.
>>>
>>> Nit: It may be better to use IOMMU_DOMAIN_BLOCKED here for readability
>>> rather than the bare value.
>>
>> It is weird and confusing, but 0 means "I have nothing to add" not
>> BLOCKED.
>>
>> You can't return BLOCKED from this op right now..
>>
>> Jason
>
> Ok, that's weird and confusing as you say. I went back and looked at the
> kerneldoc for iommu_ops and it IS called out, but it's confusing that a
> function named get_default_domain_type() can return a value that's a
> valid domain type but isn't treated as one.
>
> This was useful to fill in my mental model, thanks!
Yeah, it's perhaps a bit subtle, but the context is that not all domain
types are valid *default domain* types, those are strictly only DMA or
identity, because the other types would be nonsensical. If a driver
really wanted to completely block a device for some specific reason, it
should do that by refusing to attach it to the default domain at all.
Thanks,
Robin.
Powered by blists - more mailing lists