# Re: \[PATCH v2 01/12\] x86/ioremap: Fix page aligned size calculation in \_\_ioremap\_caller()

- From: Dave Hansen \<hidden\>
- Date: 2022-11-14 16:59:24 
- List: netdev
- Page: https://ratatoskr.run/netdev/2022/11/2005068
- Thread: https://ratatoskr.run/linux-hyperv/2022/11/2001821/t.md

```text
On 11/14/22 08:53, Michael Kelley (LINUX) wrote:
>> Because, first of all, that "Mappings have to be page-aligned" thing is
>> (now) doing more than page-aligning things.  Second, the moment you mask
>> out the metadata bits, the 'size' calculation gets harder.  Doing it in
>> two phases (page alignment followed by metadata bit masking) breaks up
>> the two logical operations.
>>
> Work for me.  Will do this in v3.

Kirill also made a good point about TDX: it isn't affected by this
because it always passes *real* (no metadata bits set) physical
addresses in here.  Could you double check that you don't want to do the
same for your code?


```
