|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 07/12] x86/hyperv: setup hypercall page
> -----Original Message-----
> From: Wei Liu <wei.liu.xen@xxxxxxxxx> On Behalf Of Wei Liu
> Sent: 29 January 2020 20:20
> To: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxxx>
> Cc: Durrant, Paul <pdurrant@xxxxxxxxxxxx>; Michael Kelley
> <mikelley@xxxxxxxxxxxxx>; Wei Liu <liuwe@xxxxxxxxxxxxx>; Jan Beulich
> <jbeulich@xxxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Wei Liu
> <wl@xxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>
> Subject: [PATCH v5 07/12] x86/hyperv: setup hypercall page
>
> Hyper-V uses a technique called overlay page for its hypercall page. It
> will insert a backing page to the guest when the hypercall functionality
> is enabled. That means we can use a page that is not backed by real
> memory for hypercall page.
>
> Use the top-most addressable page for that purpose. Adjust e820 code
> accordingly.
>
> We also need to register Xen's guest OS ID to Hyper-V. Use 0x3 as the
> vendor ID. Fix the comment in hyperv-tlfs.h while at it.
>
> Signed-off-by: Wei Liu <liuwe@xxxxxxxxxxxxx>
> ---
> v5:
> 1. use hypervisor_reserve_top_pages
> 2. add a macro for hypercall page mfn
> 3. address other misc comments
>
> v4:
> 1. Use fixmap
> 2. Follow routines listed in TLFS
> ---
> xen/arch/x86/e820.c | 5 +++
> xen/arch/x86/guest/hyperv/hyperv.c | 57 +++++++++++++++++++++++--
> xen/include/asm-x86/guest/hyperv-tlfs.h | 5 ++-
> xen/include/asm-x86/guest/hyperv.h | 3 ++
> 4 files changed, 65 insertions(+), 5 deletions(-)
>
> diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
> index 3892c9cfb7..99643f3ea0 100644
> --- a/xen/arch/x86/e820.c
> +++ b/xen/arch/x86/e820.c
> @@ -343,6 +343,7 @@ static unsigned long __init find_max_pfn(void)
> {
> unsigned int i;
> unsigned long max_pfn = 0;
> + unsigned long top_pfn = ((1ull << paddr_bits) - 1) >> PAGE_SHIFT;
>
> for (i = 0; i < e820.nr_map; i++) {
> unsigned long start, end;
> @@ -357,6 +358,10 @@ static unsigned long __init find_max_pfn(void)
> max_pfn = end;
> }
>
> + top_pfn -= hypervisor_reserve_top_pages();
> + if ( max_pfn >= top_pfn )
> + max_pfn = top_pfn;
> +
> return max_pfn;
> }
>
> diff --git a/xen/arch/x86/guest/hyperv/hyperv.c
> b/xen/arch/x86/guest/hyperv/hyperv.c
> index 8d38313d7a..2bedcc438c 100644
> --- a/xen/arch/x86/guest/hyperv/hyperv.c
> +++ b/xen/arch/x86/guest/hyperv/hyperv.c
> @@ -19,15 +19,26 @@
> * Copyright (c) 2019 Microsoft.
> */
> #include <xen/init.h>
> +#include <xen/version.h>
>
> +#include <asm/fixmap.h>
> #include <asm/guest.h>
> #include <asm/guest/hyperv-tlfs.h>
> +#include <asm/processor.h>
>
> struct ms_hyperv_info __read_mostly ms_hyperv;
>
> -static const struct hypervisor_ops ops = {
> - .name = "Hyper-V",
> -};
> +static uint64_t generate_guest_id(void)
> +{
> + uint64_t id;
> +
> + id = (uint64_t)HV_XEN_VENDOR_ID << 48;
> + id |= (xen_major_version() << 16) | xen_minor_version();
> +
> + return id;
I think this should use the hv_guest_os_id union. You can then set the values
using the bit-fields and return the raw.
Paul
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |