Re: [RFC PATCH] kvmppc: protection keys fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 18, 2017 at 10:02:01AM +1000, Paul Mackerras wrote:
> On Thu, Aug 17, 2017 at 03:01:31PM -0700, Ram Pai wrote:
> > On Thu, Aug 17, 2017 at 05:54:45PM -0300, Thiago Jung Bauermann wrote:
> [snip]
> > > 
> > > I'm currently preparing a patch for that. One question: did I understand
> > > correctly that Paul Mackerras' answer on this thread¹ means that KVM
> > > doesn't need to reserve any keys for itself and can pass on 32 keys to
> > > the guest?
> > 
> > No. KVM does use key 31 for emulated MMIO.
> > 
> > if (!(memslot && !(memslot->flags & KVM_MEMSLOT_INVALID))) {
> > 	/* Emulated MMIO - mark this with key=31 */
> > 	pteh |= HPTE_V_ABSENT;
> > 	ptel |= HPTE_R_KEY_HI |
> > 	HPTE_R_KEY_LO;
> > 	goto do_insert;
> > }
> 
> Actually, the guest *can* use all 32 keys.  We only use key 31 on
> absent HPTEs (see the HPTE_V_ABSENT flag above - these are HPTEs that
> the guest thinks are valid but are not actually mapped in the real
> HPT).

Ok. looks like you use the HPTE_V_ABSENT flag to determine if a key fault
on key 31, needs to be redirected to the guest or handled internally.

RP

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux