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: <c3513a9d-a98f-11de-ba6e-251b0e7f0993@collabora.com>
Date:   Tue, 14 Feb 2023 10:12:21 +0100
From:   AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
To:     Yong Wu <yong.wu@...iatek.com>, Joerg Roedel <joro@...tes.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>,
        Rob Herring <robh+dt@...nel.org>
Cc:     Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Hans Verkuil <hverkuil@...all.nl>, nfraprado@...labora.com,
        linux-media@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
        iommu@...ts.linux.dev, mingyuan.ma@...iatek.com,
        yf.wang@...iatek.com, jianjiao.zeng@...iatek.com,
        Yunfei Dong <yunfei.dong@...iatek.com>,
        kyrie wu <kyrie.wu@...iatek.corp-partner.google.com>,
        chengci.xu@...iatek.com, youlin.pei@...iatek.com,
        anan.sun@...iatek.com
Subject: Re: [PATCH v3 04/11] iommu/mediatek: Get regionid from larb/port id

Il 14/02/23 10:07, AngeloGioacchino Del Regno ha scritto:
> Il 14/02/23 04:11, Yong Wu ha scritto:
>> After commit f1ad5338a4d5 ("of: Fix "dma-ranges" handling for bus
>> controllers"), the dma-ranges is not allowed for dts leaf node.
>> but we still would like to separate to different masters
>> into different iova regions.
>>
>> Thus we have to separate it by the HW larbid and portid. For example,
>> larb1/2 are in region2 and larb3 is in region3. The problem is that
>> some ports inside a larb are in region4 while some ports inside this
>> larb are in region5. Therefore I define a "iova_region_larb_msk" to help
>> record the information for each a port. Take a example for a larb:
>>   [1] = ~0: means all ports in this larb are in region1;
>>   [2] = BIT(3) | BIT(4): means port3/4 in this larb are region2;
>>   [3] = ~(BIT(3) | BIT(4)): means all the other ports except port3/4
>>                             in this larb are region3.
>>
>> This method also avoids the users forget/abuse the iova regions.
>>
>> Signed-off-by: Yong Wu <yong.wu@...iatek.com>
>> ---
>>   drivers/iommu/mtk_iommu.c | 47 ++++++++++++++++++++++-----------------
>>   1 file changed, 27 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
>> index ab53edcb221f..7e2cb3b8cac8 100644
>> --- a/drivers/iommu/mtk_iommu.c
>> +++ b/drivers/iommu/mtk_iommu.c
>> @@ -8,7 +8,6 @@
>>   #include <linux/clk.h>
>>   #include <linux/component.h>
>>   #include <linux/device.h>
>> -#include <linux/dma-direct.h>
>>   #include <linux/err.h>
>>   #include <linux/interrupt.h>
>>   #include <linux/io.h>
>> @@ -212,6 +211,11 @@ struct mtk_iommu_plat_data {
>>       struct {
>>           unsigned int    iova_region_nr;
>>           const struct mtk_iommu_iova_region    *iova_region;
>> +        /*
>> +         * Indicate the correspondence between larbs/ports and regions.
>> +         * The index is same with iova_region.
> 
> * The index is the same as iova_region and larb port numbers are
> * described as bit positions.
> * For example, storing BIT(0) at index 2 means "port 0 is in region 2".
> 

Sorry, I'm reiterating because the proposed comment is wrong.

/*
  * Indicates the correspondance between larbs, ports and regions.
  *
  * The index is the same as iova_region and larb port numbers are
  * described as bit positions.
  * For example, storing BIT(0) at index 2,1 means "larb 1, port0 is in region 2".
  *              [2] = { [1] = BIT(0) }
  */


> That's most probably the best short explanation that we can give, so that nobody
> goes crazy with understanding this one.
> 
> After fixing that comment, you totally deserve my
> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
> 
> Cheers!
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ