Message ID | 20201204011848.2967588-8-dwmw2@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: Add Xen hypercall and shared info pages | expand |
On 12/4/20 1:18 AM, David Woodhouse wrote: > From: David Woodhouse <dwmw@amazon.co.uk> > > There aren't a lot of differences for the things that the kernel needs > to care about, but there are a few. > > Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> > --- > arch/x86/kvm/xen.h | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/arch/x86/kvm/xen.h b/arch/x86/kvm/xen.h > index afc6dad41fb5..870ac7197a3a 100644 > --- a/arch/x86/kvm/xen.h > +++ b/arch/x86/kvm/xen.h > @@ -21,4 +21,43 @@ static inline bool kvm_xen_hypercall_enabled(struct kvm *kvm) > KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL; > } > > + > +/* 32-bit compatibility definitions */ > +#include <asm/pvclock-abi.h> > +#include <asm/xen/interface.h> > + > +struct compat_arch_vcpu_info { > + unsigned int cr2; > + unsigned int pad[5]; > +}; > + > +struct compat_vcpu_info { > + uint8_t evtchn_upcall_pending; > + uint8_t evtchn_upcall_mask; > + uint32_t evtchn_pending_sel; > + struct compat_arch_vcpu_info arch; > + struct pvclock_vcpu_time_info time; > +}; /* 64 bytes (x86) */ > + > +struct compat_arch_shared_info { > + unsigned int max_pfn; > + unsigned int pfn_to_mfn_frame_list_list; > + unsigned int nmi_reason; > + unsigned int p2m_cr3; > + unsigned int p2m_vaddr; > + unsigned int p2m_generation; > + uint32_t wc_sec_hi; > +}; > + > +struct compat_shared_info { > + struct compat_vcpu_info vcpu_info[MAX_VIRT_CPUS]; > + uint32_t evtchn_pending[sizeof(compat_ulong_t) * 8]; > + uint32_t evtchn_mask[sizeof(compat_ulong_t) * 8]; > + uint32_t wc_version; > + uint32_t wc_sec; > + uint32_t wc_nsec; > + struct compat_arch_shared_info arch; > + > +}; > + > #endif /* __ARCH_X86_KVM_XEN_H__ */ > I would fold this into the next patch. For it makes sense to keep separate the xen canonical headers update (patch 10).
On Sat, 2020-12-05 at 18:43 +0000, Joao Martins wrote: > I would fold this into the next patch. Except it's not just the next patch; it's piecemeal across the next three or four. I started out that way but figured it was better to add them in one go. > For it makes sense to keep separate the xen canonical headers update > (patch 10). Right, that affects the structures used for Xen guests too (albeit not really since we don't use that field). That one is indeed separate.
diff --git a/arch/x86/kvm/xen.h b/arch/x86/kvm/xen.h index afc6dad41fb5..870ac7197a3a 100644 --- a/arch/x86/kvm/xen.h +++ b/arch/x86/kvm/xen.h @@ -21,4 +21,43 @@ static inline bool kvm_xen_hypercall_enabled(struct kvm *kvm) KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL; } + +/* 32-bit compatibility definitions */ +#include <asm/pvclock-abi.h> +#include <asm/xen/interface.h> + +struct compat_arch_vcpu_info { + unsigned int cr2; + unsigned int pad[5]; +}; + +struct compat_vcpu_info { + uint8_t evtchn_upcall_pending; + uint8_t evtchn_upcall_mask; + uint32_t evtchn_pending_sel; + struct compat_arch_vcpu_info arch; + struct pvclock_vcpu_time_info time; +}; /* 64 bytes (x86) */ + +struct compat_arch_shared_info { + unsigned int max_pfn; + unsigned int pfn_to_mfn_frame_list_list; + unsigned int nmi_reason; + unsigned int p2m_cr3; + unsigned int p2m_vaddr; + unsigned int p2m_generation; + uint32_t wc_sec_hi; +}; + +struct compat_shared_info { + struct compat_vcpu_info vcpu_info[MAX_VIRT_CPUS]; + uint32_t evtchn_pending[sizeof(compat_ulong_t) * 8]; + uint32_t evtchn_mask[sizeof(compat_ulong_t) * 8]; + uint32_t wc_version; + uint32_t wc_sec; + uint32_t wc_nsec; + struct compat_arch_shared_info arch; + +}; + #endif /* __ARCH_X86_KVM_XEN_H__ */