[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <899c7275-ccca-43bb-b1ae-a3403dd18622@baylibre.com>
Date: Wed, 11 Oct 2023 17:38:11 +0200
From: Alexandre Mergnat <amergnat@...libre.com>
To: Jianjun Wang <jianjun.wang@...iatek.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Rob Herring <robh@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
Cc: linux-pci@...r.kernel.org, linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Ryder Lee <ryder.lee@...iatek.com>, jieyy.yang@...iatek.com,
chuanjia.liu@...iatek.com, qizhong.cheng@...iatek.com,
jian.yang@...iatek.com
Subject: Re: [PATCH] PCI: mediatek-gen3: Fix translation window
On 11/10/2023 14:26, Jianjun Wang wrote:
> The size of translation table should be a power of 2, using fls() cannot
> get the proper value when the size is not a power of 2. For example,
> fls(0x3e00000) - 1 = 25, hence the PCIe translation window size will be
> set to 0x2000000 instead of the expected size 0x3e00000. Fix translation
> window by splitting the MMIO space to multiple tables if its size is not
> a power of 2.
Hi Jianjun,
I've no knowledge in PCIE, so maybe what my suggestion is stupid:
Is it mandatory to fit the translation table size with 0x3e00000 (in
this example) ?
I'm asking because you can have an issue by reaching the maximum
translation table number.
Is it possible to just use only one table with the power of 2 size above
0x3e00000 => 0x4000000 ( fls(0x3e00000) = 26 = 0x4000000). The downside
of this method is wasting allocation space. AFAIK I already see this
kind of method for memory protection/allocation in embedded systems, so
I'm wondering if this method is safer than using multiple table for only
one size which isn't a power of 2.
--
Regards,
Alexandre
Powered by blists - more mailing lists