[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 29/31] libxc/xen: introduce HVM_PARAM_MODLIST_PFN
This HVM parameter is used to pass a list of loaded modules to the guest. Right now the number of loaded modules is limited to 1 by the current implementation, but this interface allows passing more than one module. Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- tools/libxc/xc_dom_x86.c | 20 ++++++++++++++++++++ xen/arch/x86/hvm/hvm.c | 2 ++ xen/include/public/hvm/params.h | 23 ++++++++++++++++++++++- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 369745d..1599de4 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -579,6 +579,26 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom) xc_hvm_param_set(xch, domid, HVM_PARAM_CMDLINE_PFN, cmdline_pfn); } + if ( dom->ramdisk_blob ) + { + xen_pfn_t modlist_pfn = xc_dom_alloc_page(dom, "module list"); + uint64_t *modlist = xc_map_foreign_range(xch, domid, PAGE_SIZE, + PROT_READ | PROT_WRITE, + modlist_pfn); + if ( modlist == NULL ) { + DOMPRINTF("Unable to map module list page"); + goto error_out; + } + + /* This is currently limited to only one module. */ + modlist[0] = dom->ramdisk_seg.vstart - dom->parms.virt_base; + modlist[1] = dom->ramdisk_seg.vend - dom->ramdisk_seg.vstart; + modlist[2] = 0; + modlist[3] = 0; + munmap(modlist, PAGE_SIZE); + xc_hvm_param_set(xch, domid, HVM_PARAM_MODLIST_PFN, modlist_pfn); + } + if ( dom->emulation ) { /* diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 615ea30..f2223ea 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5867,6 +5867,7 @@ static int hvm_allow_set_param(struct domain *d, case HVM_PARAM_STORE_EVTCHN: case HVM_PARAM_CONSOLE_EVTCHN: case HVM_PARAM_CMDLINE_PFN: + case HVM_PARAM_MODLIST_PFN: break; /* * The following parameters must not be set by the guest @@ -6099,6 +6100,7 @@ static int hvm_allow_get_param(struct domain *d, case HVM_PARAM_CONSOLE_EVTCHN: case HVM_PARAM_ALTP2M: case HVM_PARAM_CMDLINE_PFN: + case HVM_PARAM_MODLIST_PFN: break; /* * The following parameters must not be read by the guest diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index aa926d4..96f944e 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -193,6 +193,27 @@ /* PFN of the command line. */ #define HVM_PARAM_CMDLINE_PFN 36 -#define HVM_NR_PARAMS 37 +/* + * List of modules passed to the kernel. + * + * The PFN returned by this HVM_PARAM points to a page that contains an + * array of unsigned 64bit integers encoded in little endian. + * + * The first integer contains the address where the module has been loaded, + * while the second contains the size of the module in bytes. The last element + * in the array is a module with address 0 and length 0: + * + * module[0] = <address of 1st module> + * module[1] = <size of 1st module> + * [...] + * module[N/2] = <address of module N> + * module[N/2+1] = <size of module N> + * [...] + * module[M] = 0 + * module[M+1] = 0 + */ +#define HVM_PARAM_MODLIST_PFN 37 + +#define HVM_NR_PARAMS 38 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */ -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |