lkml.org 
[lkml]   [2023]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] PCI: mediatek-gen3: Fix translation window
From


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

\
 
 \ /
  Last update: 2023-10-11 17:41    [W:0.406 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site