powerpc/mm/radix: Simplify split mapping logic
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 14 Aug 2018 12:37:32 +0000 (22:37 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 20 Oct 2018 02:26:47 +0000 (13:26 +1100)
commit232aa407633cef2b43806c1603fc8689aecf826c
tree8e997292282b96b7811be5117fa14c274668abb4
parent57306c663d53f2e4fd856950703dc6bcfc98f7cb
powerpc/mm/radix: Simplify split mapping logic

If we look closely at the logic in create_physical_mapping(), when
we're doing STRICT_KERNEL_RWX, we do the following steps:
  - determine the gap from where we are to the end of the range
  - choose an appropriate mapping_size based on the gap
  - check if that mapping_size would overlap the __init_begin
    boundary, and if not choose an appropriate mapping_size

We can simplify the logic by taking the __init_begin boundary into
account when we calculate the initial gap.

So add a next_boundary() function which tells us what the next
boundary is, either the __init_begin boundary or end. In future we can
add more boundaries.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/pgtable-radix.c