[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [v8][PATCH 07/17] hvmloader/util: get reserved device memory maps
On 2014/12/8 16:09, Chen, Tiejun wrote: On 2014/12/3 4:01, Konrad Rzeszutek Wilk wrote:On Mon, Dec 01, 2014 at 05:24:25PM +0800, Tiejun Chen wrote:We need to use reserved device memory maps with multiple times, so provide just one common function should be friend.We need to call reserved device memory maps hypercall (XENMEM_reserved_device_memory_map) many times, hence provide one common function.Rephrased and thanks.Signed-off-by: Tiejun Chen <tiejun.chen@xxxxxxxxx> --- tools/firmware/hvmloader/util.c | 59 +++++++++++++++++++++++++++++++++++++++++ tools/firmware/hvmloader/util.h | 2 ++ 2 files changed, 61 insertions(+) diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 80d822f..dd81fb6 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -22,11 +22,14 @@ #include "config.h" #include "hypercall.h" #include "ctype.h" +#include "errno.h" #include <stdint.h> #include <xen/xen.h> #include <xen/memory.h> #include <xen/sched.h> +struct xen_reserved_device_memory *rdm_map; + void wrmsr(uint32_t idx, uint64_t v) { asm volatile ( @@ -828,6 +831,62 @@ int hpet_exists(unsigned long hpet_base) return ((hpet_id >> 16) == 0x8086); } +static int +get_reserved_device_memory_map(struct xen_reserved_device_memory entries[], + uint32_t *max_entries) +{ + int rc; + struct xen_reserved_device_memory_map xrdmmap = { + .domid = DOMID_SELF, + .nr_entries = *max_entries + }; + + set_xen_guest_handle(xrdmmap.buffer, entries); + + rc = hypercall_memory_op(XENMEM_reserved_device_memory_map, &xrdmmap); + *max_entries = xrdmmap.nr_entries;Don't you want to check rc first before altering 'max_entries' ?- *max_entries = xrdmmap.nr_entries; + if ( rc == -ENOBUFS ) + *max_entries = xrdmmap.nr_entries; Something remind me. That is, in all case we should set max_entries since now we don't count all RMRR ranges again. Instead, we may count those RMRR ranges associated to a assigned device but obviously, it may have no any RMRR. So we always should update max_entries as well. Thanks Tiejun Thanks Tiejun _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |