# Re: \[PATCH 1/1\] powerpc/pseries/iommu: Fix window size for direct mapping with pmem

- From: Leonardo Bras \<hidden\>
- Date: 2021-04-20 05:29:47 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2021/04/6344631
- Thread: https://ratatoskr.run/linuxppc-dev/2021/04/6344621/t.md

```text
On Tue, 2021-04-20 at 15:18 +1000, Alexey Kardashevskiy wrote:
> 
> On 20/04/2021 14:54, Leonardo Bras wrote:
> > As of today, if the DDW is big enough to fit (1 << MAX_PHYSMEM_BITS) it's
> > possible to use direct DMA mapping even with pmem region.
> > 
> > But, if that happens, the window size (len) is set to
> > (MAX_PHYSMEM_BITS - page_shift) instead of MAX_PHYSMEM_BITS, causing a
> > pagesize times smaller DDW to be created, being insufficient for correct
> > usage.
> > 
> > Fix this so the correct window size is used in this case.
> 
> Good find indeed.
> 
> afaict this does not create a huge problem though as 
> query.largest_available_block is always smaller than (MAX_PHYSMEM_BITS - 
> page_shift) where it matters (phyp).
> 
> 
> Reviewed-by: Alexey Kardashevskiy <redacted>
> 

Thanks for reviewing!

Leonardo Bras

```
