Re: [PATCH 05/13] KVM: PPC: Book3S HV: Adapt to new HPTE format on POWER9

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

 



On Sat, Nov 19, 2016 at 11:38:40AM +1100, Balbir Singh wrote:
> 
> 
> On 18/11/16 18:28, Paul Mackerras wrote:
> > This adapts the KVM-HV hashed page table (HPT) code to read and write
> > HPT entries in the new format defined in Power ISA v3.00 on POWER9
> > machines.  The new format moves the B (segment size) field from the
> > first doubleword to the second, and trims some bits from the AVA
> > (abbreviated virtual address) and ARPN (abbreviated real page number)
> > fields.  As far as possible, the conversion is done when reading or
> > writing the HPT entries, and the rest of the code continues to use
> > the old format.
[snip]
> > @@ -440,6 +442,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
> >  {
> >  	struct kvm *kvm = vcpu->kvm;
> >  	unsigned long hpte[3], r;
> > +	unsigned long hnow_v, hnow_r;
> >  	__be64 *hptep;
> >  	unsigned long mmu_seq, psize, pte_size;
> >  	unsigned long gpa_base, gfn_base;
> > @@ -488,6 +491,10 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
> >  	unlock_hpte(hptep, hpte[0]);
> >  	preempt_enable();
> >  
> > +	if (cpu_has_feature(CPU_FTR_ARCH_300)) {
> > +		hpte[0] = hpte_new_to_old_v(hpte[0], hpte[1]);
> > +		hpte[1] = hpte_new_to_old_r(hpte[1]);
> > +	}
> 
> I think we can avoid this, if we avoid the conversion in kvmppc_hpte_hv_fault().
> If we decide not to do this, then gpa will need to use a new mask to extract
> the correct gpa.

Yes, we could store vcpu->arch.pgfault[] in native format, i.e. new
format on P9.  That might make the code a bit simpler indeed.

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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux