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

Re: [Xen-devel] [v6][PATCH 5/7] hvmloader: introduce hypercall for xc_reserved_device_memory_map



> From: Chen, Tiejun
> Sent: Tuesday, September 09, 2014 10:50 PM
> 
> We will introduce that hypercall xc_reserved_device_memory_map
> to hvmloader.
> 
> Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx>
> 
> diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
> index 80d822f..90dbb6e 100644
> --- a/tools/firmware/hvmloader/util.c
> +++ b/tools/firmware/hvmloader/util.c
> @@ -828,6 +828,28 @@ int hpet_exists(unsigned long hpet_base)
>      return ((hpet_id >> 16) == 0x8086);
>  }
> 
> +int get_reserved_device_memory_map(struct
> xen_mem_reserved_device_memory entries[],
> +                                   uint32_t max_entries)

usually claim as a pointer instead of array as the parameter.

> +{
> +    static int map_done = 0;

don't see much value of the static variable here. Better for the caller
to judge whether multiple calls are required.

> +    struct xen_mem_reserved_device_memory_map memmap = {
> +        .nr_entries = max_entries
> +    };
> +
> +    if ( map_done )
> +        return 0;
> +
> +    set_xen_guest_handle(memmap.buffer, entries);
> +
> +    if ( hypercall_memory_op(XENMEM_reserved_device_memory_map,
> +                             &memmap) != 0 )
> +        BUG();
> +
> +    map_done = 1;
> +
> +    return 0;
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/tools/firmware/hvmloader/util.h
> b/tools/firmware/hvmloader/util.h
> index a70e4aa..cca0d5b 100644
> --- a/tools/firmware/hvmloader/util.h
> +++ b/tools/firmware/hvmloader/util.h
> @@ -241,6 +241,9 @@ int build_e820_table(struct e820entry *e820,
>                       unsigned int bios_image_base);
>  void dump_e820_table(struct e820entry *e820, unsigned int nr);
> 
> +#include <xen/memory.h>
> +int get_reserved_device_memory_map(struct
> xen_mem_reserved_device_memory entries[],
> +                                   uint32_t max_entries);
>  #ifndef NDEBUG
>  void perform_tests(void);
>  #else
> --
> 1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.