Messages in this thread | | | Date | Wed, 11 Oct 2023 17:38:11 +0200 | Subject | Re: [PATCH] PCI: mediatek-gen3: Fix translation window | From | Alexandre Mergnat <> |
| |
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
| |