[PATCH] powerpc/mm/hash: Properly mask the ESID bits when building proto-VSID

Michael Ellerman mpe at ellerman.id.au
Mon Jan 30 15:44:53 AEDT 2017


"Aneesh Kumar K.V" <aneesh.kumar at linux.vnet.ibm.com> writes:

> proto-vsid is built using both mmu context id and ESID. We should not have
> overlapping bits between those. That will result in us having vsid
> collision. With the current code we missed masking the top bits of effective
> address. This implies for kernel address we ended up using the top 4 bits
> as part of proto-vsid, which is wrong. For the kernel we should have the
> below mapping
>
> 0xf000000000000000 -> 0x7ffff  (19 bits context + 6 bits ESID ).
>
> Without the patch we endup with
> 0xf000000000000000 ->  0xf7ffff (0x7ffff | 0xf00000)

As discussed offline, this is missing the << 6.

Which means we end up with:

  ea         = 0xf000000000000000
  context    = 0x7ffff 
  proto_vsid = (0x7ffff << 6 | 0xf000000000000000 >> 40)
             = (0x1ffffc0 | 0xf00000)
             =  0x1ffffc0

ie. the proto-vsid is not affected by the extra bits. Same is true for
the 0xc/d/e regions.

So there is no bug here, as long as we use the current mapping from
kernel EA to context ID.

I'll merge this into next.

cheers


More information about the Linuxppc-dev mailing list