lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f126c61f-6373-d6c5-59c8-24dea9d9d168@baylibre.com>
Date:   Tue, 31 Jan 2023 14:08:04 +0100
From:   Alexandre Bailon <abailon@...libre.com>
To:     Robin Murphy <robin.murphy@....com>, yong.wu@...iatek.com,
        joro@...tes.org, will@...nel.org
Cc:     matthias.bgg@...il.com, krzysztof.kozlowski@...aro.org,
        robh+dt@...nel.org, iommu@...ts.linux.dev,
        linux-mediatek@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH 2/3] iommu: mediatek: Add support of unmanaged iommu
 domain

Hi Robin

On 1/30/23 13:04, Robin Murphy wrote:
> On 2023-01-30 10:27, Alexandre Bailon wrote:
>> Currently, the driver can allocate an unmanaged iommu domain.
>> But, this only works for SoC having multiple bank or multiple iova 
>> region.
> 
> That is for good reason - there is only a single pagetable per bank, so 
> if there are multiple devices assigned to a single bank, they cannot 
> possibly be attached to different domains at the same time. Hence why 
> the banks are modelled as groups.
I understand.
I am trying to upstream a remoteproc driver but the remote processor is
behind the iommu.
remoteproc can manage the iommu but it requires an unmanaged domain.
I tried a couple of things but this cause code duplication,
implies many hacks and not always reliable.
Do you have any suggestion ?

Thanks,
Alexandre
> 
> Thanks,
> Robin.
> 
>> This updates the driver to also support unmanaged iommu domain if
>> MTK_UNMANAGED_DEVICE is set in the iommu id.
>>
>> Signed-off-by: Alexandre Bailon <abailon@...libre.com>
>> ---
>>   drivers/iommu/mtk_iommu.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
>> index 2badd6acfb23d..5884a1ad409a0 100644
>> --- a/drivers/iommu/mtk_iommu.c
>> +++ b/drivers/iommu/mtk_iommu.c
>> @@ -858,9 +858,15 @@ static int mtk_iommu_get_group_id(struct device 
>> *dev, const struct mtk_iommu_pla
>>   static struct iommu_group *mtk_iommu_device_group(struct device *dev)
>>   {
>>       struct mtk_iommu_data *c_data = dev_iommu_priv_get(dev), *data;
>> +    struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
>>       struct list_head *hw_list = c_data->hw_list;
>>       struct iommu_group *group;
>>       int groupid;
>> +    int i;
>> +
>> +    for (i = 0; i < fwspec->num_ids; i++)
>> +        if (MTK_M4U_UNMANAGED(fwspec->ids[i]))
>> +            return iommu_group_alloc();
>>       data = mtk_iommu_get_frst_data(hw_list);
>>       if (!data)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ