On Mon, Oct 23, 2017 at 03:11:28PM +0530, Aneesh Kumar K.V wrote: > Ram Pai <linux...@us.ibm.com> writes: > > > Total 32 keys are available on power7 and above. However > > pkey 0,1 are reserved. So effectively we have 30 pkeys. > > When you say reserved, reserved by whom? Is that part of ISA or PAPR ? > Also do you expect that to change. If not why all these indirection? > Can we have the mask as a #define for 4K and 64K page size > config?
The reserved keys cannot be determined statically. It depends on the platform and the key info exported to us by the device-tree. Hence it cannot be macro'd. One of the subsequent patch, reads the device tree and sets pkeys_total appropriately. FYI. BTW: key 0 is reserved by the ISA. key 1 is reserved, but its nebulous. There is a programming note in the ISA to avoid key 1. Also testing and experimentation with key 1 lead to unpredicatable behavior on powervm. Key 31 may or may not be used by the hypervisor. The device tree has to be referred to determine that. Bottomline, the mask can be determined only during runtime. RP