Re: [PATCH v3 08/17] KVM: x86/xen: register shared_info page

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

 



On Mon, 2020-12-14 at 10:45 +0000, Joao Martins wrote:
> On 12/14/20 8:38 AM, David Woodhouse wrote:
> > From: Joao Martins <joao.m.martins@xxxxxxxxxx>
> > 
> > We add a new ioctl, XEN_HVM_SHARED_INFO, to allow hypervisor
> > to know where the guest's shared info page is.
> > 
> > Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
> > Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> > ---
> >  arch/x86/include/asm/kvm_host.h |  2 ++
> >  arch/x86/kvm/xen.c              | 27 +++++++++++++++++++++++++++
> >  arch/x86/kvm/xen.h              |  1 -
> >  include/uapi/linux/kvm.h        |  4 ++++
> >  4 files changed, 33 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/include/asm/kvm_host.h
> > b/arch/x86/include/asm/kvm_host.h
> > index c9a4feaee2e7..8bcd83dacf43 100644
> > --- a/arch/x86/include/asm/kvm_host.h
> > +++ b/arch/x86/include/asm/kvm_host.h
> > @@ -893,6 +893,8 @@ struct msr_bitmap_range {
> >  /* Xen emulation context */
> >  struct kvm_xen {
> >  	bool long_mode;
> > +	bool shinfo_set;
> > +	struct gfn_to_hva_cache shinfo_cache;
> >  };
> >  
> >  enum kvm_irqchip_mode {
> > diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
> > index 52cb9e465542..9dd9c42842b8 100644
> > --- a/arch/x86/kvm/xen.c
> > +++ b/arch/x86/kvm/xen.c
> > @@ -13,9 +13,23 @@
> >  #include <linux/kvm_host.h>
> >  
> >  #include <trace/events/kvm.h>
> > +#include <xen/interface/xen.h>
> >  
> >  #include "trace.h"
> >  
> > +static int kvm_xen_shared_info_init(struct kvm *kvm, gfn_t gfn)
> > +{
> > +	int ret;
> > +
> > +	ret = kvm_gfn_to_hva_cache_init(kvm, &kvm-
> > >arch.xen.shinfo_cache,
> > +					gfn_to_gpa(gfn), PAGE_SIZE);
> > +	if (ret)
> > +		return ret;
> > +
> > +	kvm->arch.xen.shinfo_set = true;
> 
> Can't you just use:
> 
> 	kvm->arch.xen.shinfo_cache.gpa
> 
> Rather than added a bool just to say you set a shinfo?

I see no reason why a guest shouldn't be able to use GPA zero if it
really wanted to. Using a separate boolean matches what KVM does for
the wallclock info.


> > --- a/arch/x86/kvm/xen.h
> > +++ b/arch/x86/kvm/xen.h
> > @@ -13,7 +13,6 @@ int kvm_xen_hvm_set_attr(struct kvm *kvm, struct
> > kvm_xen_hvm_attr *data);
> >  int kvm_xen_hvm_get_attr(struct kvm *kvm, struct kvm_xen_hvm_attr
> > *data);
> >  int kvm_xen_hypercall(struct kvm_vcpu *vcpu);
> >  int kvm_xen_hvm_config(struct kvm_vcpu *vcpu, u64 data);
> > -void kvm_xen_destroy_vm(struct kvm *kvm);
> >  
> 
> spurious deletion ?

Now nothing is kept mapped, there's no need for a destroy function. It
must have been spuriously *added* in a previous patch and then deleted
here. Will fix.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


[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