Re: [PATCH v8 7/7] iommu/riscv: Paging domain support
From: Easwar Hariharan
Date: Thu Aug 08 2024 - 12:40:38 EST
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!
Easwar