stubdom: add xenstore pvh stubdom support
cover stubdom: add xenstore pvh stubdom support
Add support for creating a PVH Xenstore stub-domain.
This includes building the stubdom and loading it at system boot.
It should be noted that currently this stubdom is not in a working state as there is some support in Mini-OS missing. I'm working on adding this support.
Juergen Gross (3):
tools/init-xenstore-domain: add logging tools/init-xenstore-domain: support xenstore pvh stubdom
stubdom: add xenstore pvh stubdom
.gitignore | 1 + stubdom/Makefile | 31 ++++- stubdom/configure | 47 ++++++++ stubdom/configure.ac | 1 + stubdom/xenstorepvh-minios.cfg | 10 ++ tools/helpers/init-xenstore-domain.c | 170 ++++++++++++++++++++------- 6 files changed, 213 insertions(+), 47 deletions(-) create mode 100644 stubdom/xenstorepvh-minios.cfg
Signature · 1 line
2.26.2
PATCH 1/3 tools/init-xenstore-domain: add logging
Add a possibility to do logging in init-xenstore-domain: use -v[...] for selecting the log-level as in xl, log to stderr.
--- tools/helpers/init-xenstore-domain.c | 51 ++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 11 deletions(-)
tools/helpers/init-xenstore-domain.c +40 -11
@@ -10,6 +10,7 @@#include <xenctrl.h> #include <xenctrl_dom.h> #include <xenstore.h> +#include <xentoollog.h> #include <xen/sys/xenbus_dev.h> #include <xen-xsm/flask/flask.h> #include <xen/io/xenbus.h>
@@ -36,6 +37,7 @@ static struct option options[] = { { "param", 1, NULL, 'p' }, { "name", 1, NULL, 'n' }, { "maxmem", 1, NULL, 'M' }, + { "verbose", 0, NULL, 'v' }, { NULL, 0, NULL, 0 } };
@@ -57,7 +59,8 @@ static void usage(void)" --maxmem <max size> maximum memory size in the format:\n" " <MB val>|<a>/<b>|<MB val>:<a>/<b>\n" " (an absolute value in MB, a fraction a/b of\n" -" the host memory, or the maximum of both)\n"); +" the host memory, or the maximum of both)\n" +" -v[v[v]] verbosity of domain building\n"); }static int build (xc_interface *xch)
@@ -349,8 +352,10 @@ int main(int argc, char** argv)char buf[16 ], be_path[64 ], fe_path[64 ];int rv, fd;char *maxmem_str =NULL ; +xentoollog_level minmsglevel =XTL_PROGRESS ; +xentoollog_logger *logger =NULL ; -while ( (opt =getopt_long (argc, argv,"" , options,NULL )) !=-1 ) +while ( (opt =getopt_long (argc, argv,"v" , options,NULL )) !=-1 ) {switch ( opt ) {
@@ -375,6 +380,10 @@ int main(int argc, char** argv)case 'M' : maxmem_str = optarg;break ; +case 'v' : +if ( minmsglevel ) + minmsglevel--; +break ;default :usage ();return 2 ;
@@ -387,11 +396,15 @@ int main(int argc, char** argv)return 2 ; } - xch =xc_interface_open (NULL ,NULL ,0 ); + logger = (xentoollog_logger *)xtl_createlogger_stdiostream (stderr, + minmsglevel,0 ); + + xch =xc_interface_open (logger, logger,0 );if ( !xch ) {fprintf (stderr,"xc_interface_open() failed\n" ); -return 1 ; + rv =1 ; + goto out; }if ( maxmem_str )
@@ -400,7 +413,8 @@ int main(int argc, char** argv)if ( maxmem <0 ) {xc_interface_close (xch); -return 1 ; + rv =1 ; + goto out; } }
@@ -414,17 +428,24 @@ int main(int argc, char** argv)xc_interface_close (xch);if ( rv ) -return 1 ; + { + rv =1 ; + goto out; + } rv =gen_stub_json_config (domid,NULL );if ( rv ) -return 3 ; + { + rv =3 ; + goto out; + } xsh =xs_open (0 );if ( !xsh ) {fprintf (stderr,"xs_open() failed.\n" ); -return 3 ; + rv =3 ; + goto out; }snprintf (buf,16 ,"%d" , domid);do_xs_write (xsh,"/tool/xenstored/domid" , buf);
@@ -460,7 +481,8 @@ int main(int argc, char** argv)if ( fd <0 ) {fprintf (stderr,"Creating " XEN_RUN_DIR "/xenstored.pid failed\n" ); -return 3 ; + rv =3 ; + goto out; } rv =snprintf (buf,16 ,"domid:%d\n" , domid); rv =write (fd, buf, rv);
@@ -469,10 +491,17 @@ int main(int argc, char** argv) {fprintf (stderr,"Writing domid to " XEN_RUN_DIR "/xenstored.pid failed\n" ); -return 3 ; + rv =3 ; + goto out; } -return 0 ; + rv =0 ; + + out: +if ( logger ) +xtl_logger_destroy (logger); + +return rv; }/*
Signature · 1 line
2.26.2
Re: [PATCH 1/3] tools/init-xenstore-domain: add logging
Quoted 4 lines · Juergen Gross
Add a possibility to do logging in init-xenstore-domain: use -v[...] for selecting the log-level as in xl, log to stderr.
Signed-off-by Juergen Gross <[email protected]>
PATCH 2/3 tools/init-xenstore-domain: support xenstore pvh stubdom
In reply to Juergen GrossInstead of creating the xenstore-stubdom domain first and parsing the kernel later do it the other way round. This enables to probe for the domain type supported by the xenstore-stubdom and to support both, pv and pvh type stubdoms.
Try to parse the stubdom image first for PV support, if this fails use HVM. Then create the domain with the appropriate type selected.
--- tools/helpers/init-xenstore-domain.c | 119 +++++++++++++++++++-------- 1 file changed, 85 insertions(+), 34 deletions(-)
tools/helpers/init-xenstore-domain.c +85 -34
@@ -18,6 +18,10 @@#include "init-dom-json.h" #include "_paths.h" +#define LAPIC_BASE_ADDRESS 0xfee00000UL +#define MB (x) ((uint64_t)x << 20) +#define GB (x) ((uint64_t)x << 30) +static uint32_t domid = ~0 ;static char *kernel;static char *ramdisk;
@@ -69,6 +73,8 @@ static int build(xc_interface *xch)int rv, xs_fd;struct xc_dom_image *dom =NULL ;int limit_kb = (maxmem ? : (memory +1 )) *1024 ; +uint64_t mem_size =MB (memory); +struct e820entry e820[3 ];struct xen_domctl_createdomain config = { .ssidref =SECINITSID_DOMU , .flags = XEN_DOMCTL_CDF_xs_domain,
@@ -101,6 +107,66 @@ static int build(xc_interface *xch) } } + dom =xc_dom_allocate (xch,NULL ,NULL ); +if ( !dom ) + { +fprintf (stderr,"xc_dom_allocate failed\n" ); + rv =-1 ; + goto err; + } + + rv =xc_dom_kernel_file (dom, kernel); +if ( rv ) + { +fprintf (stderr,"xc_dom_kernel_file failed\n" ); + goto err; + } + +if ( ramdisk ) + { + rv =xc_dom_module_file (dom, ramdisk,NULL ); +if ( rv ) + { +fprintf (stderr,"xc_dom_module_file failed\n" ); + goto err; + } + } + + dom->container_type =XC_DOM_HVM_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { + dom->container_type =XC_DOM_PV_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { +fprintf (stderr,"xc_dom_parse_image failed\n" ); + goto err; + } + } +else + { + config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap; + config.arch.emulation_flags =XEN_X86_EMU_LAPIC ; + dom->target_pages = mem_size >>XC_PAGE_SHIFT ; + dom->mmio_size =GB (4 ) -LAPIC_BASE_ADDRESS ; + dom->lowmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +LAPIC_BASE_ADDRESS : mem_size; + dom->highmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +GB (4 ) + mem_size -LAPIC_BASE_ADDRESS :0 ; + dom->mmio_start =LAPIC_BASE_ADDRESS ; + dom->max_vcpus =1 ; + e820[0 ].addr =0 ; + e820[0 ].size = dom->lowmem_end; + e820[0 ].type =E820_RAM ; + e820[1 ].addr =LAPIC_BASE_ADDRESS ; + e820[1 ].size = dom->mmio_size; + e820[1 ].type =E820_RESERVED ; + e820[2 ].addr =GB (4 ); + e820[2 ].size = dom->highmem_end -GB (4 ); + e820[2 ].type =E820_RAM ; + } + rv =xc_domain_create (xch, &domid, &config);if ( rv ) {
@@ -125,11 +191,15 @@ static int build(xc_interface *xch)fprintf (stderr,"xc_evtchn_alloc_unbound failed\n" ); goto err; } - rv =xc_domain_set_memmap_limit (xch, domid, limit_kb); -if ( rv ) + +if ( dom->container_type ==XC_DOM_PV_CONTAINER ) { -fprintf (stderr,"xc_domain_set_memmap_limit failed\n" ); - goto err; + rv =xc_domain_set_memmap_limit (xch, domid, limit_kb); +if ( rv ) + { +fprintf (stderr,"xc_domain_set_memmap_limit failed\n" ); + goto err; + } } rv =ioctl (xs_fd,IOCTL_XENBUS_BACKEND_SETUP , domid);
@@ -144,45 +214,16 @@ static int build(xc_interface *xch)else snprintf (cmdline,512 ,"--event %d --internal-db" , rv); - dom =xc_dom_allocate (xch, cmdline,NULL ); -if ( !dom ) - { -fprintf (stderr,"xc_dom_allocate failed\n" ); - goto err; - } - dom->container_type =XC_DOM_PV_CONTAINER ; + dom->cmdline =xc_dom_strdup (dom, cmdline); dom->xenstore_domid = domid; dom->console_evtchn = console_evtchn; - rv =xc_dom_kernel_file (dom, kernel); -if ( rv ) - { -fprintf (stderr,"xc_dom_kernel_file failed\n" ); - goto err; - } - -if ( ramdisk ) - { - rv =xc_dom_module_file (dom, ramdisk,NULL ); -if ( rv ) - { -fprintf (stderr,"xc_dom_module_file failed\n" ); - goto err; - } - } - rv =xc_dom_boot_xen_init (dom, xch, domid);if ( rv ) {fprintf (stderr,"xc_dom_boot_xen_init failed\n" ); goto err; } - rv =xc_dom_parse_image (dom); -if ( rv ) - { -fprintf (stderr,"xc_dom_parse_image failed\n" ); - goto err; - } rv =xc_dom_mem_init (dom, memory);if ( rv ) {
@@ -195,6 +236,16 @@ static int build(xc_interface *xch)fprintf (stderr,"xc_dom_boot_mem_init failed\n" ); goto err; } +if ( dom->container_type ==XC_DOM_HVM_CONTAINER ) + { + rv =xc_domain_set_memory_map (xch, domid, e820, + dom->highmem_end ?3 :2 ); +if ( rv ) + { +fprintf (stderr,"xc_domain_set_memory_map failed\n" ); + goto err; + } + } rv =xc_dom_build_image (dom);if ( rv ) {
Signature · 1 line
2.26.2
Re: [PATCH 2/3] tools/init-xenstore-domain: support xenstore pvh stubdom
Quoted 9 lines · Juergen Gross
Instead of creating the xenstore-stubdom domain first and parsing the kernel later do it the other way round. This enables to probe for the domain type supported by the xenstore-stubdom and to support both, pv and pvh type stubdoms.
Try to parse the stubdom image first for PV support, if this fails use HVM. Then create the domain with the appropriate type selected.
Signed-off-by Juergen Gross <[email protected]>
[...]
Quoted 22 lines
tools/helpers/init-xenstore-domain.c +22
-0+ dom->container_type =XC_DOM_HVM_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { + dom->container_type =XC_DOM_PV_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { +fprintf (stderr,"xc_dom_parse_image failed\n" ); + goto err; + } + } +else + { + config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap; + config.arch.emulation_flags =XEN_X86_EMU_LAPIC ; + dom->target_pages = mem_size >>XC_PAGE_SHIFT ; + dom->mmio_size =GB (4 ) -LAPIC_BASE_ADDRESS ; + dom->lowmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +LAPIC_BASE_ADDRESS : mem_size; + dom->highmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +GB (4 ) + mem_size -LAPIC_BASE_ADDRESS :0 ;
tools/helpers/init-xenstore-domain.c static int build(xc_interface *xch) · line 166
Quoted 10 lines
tools/helpers/init-xenstore-domain.c +10
-0+ dom->mmio_start =LAPIC_BASE_ADDRESS ; + dom->max_vcpus =1 ; + e820[0 ].addr =0 ; + e820[0 ].size = dom->lowmem_end; + e820[0 ].type =E820_RAM ; + e820[1 ].addr =LAPIC_BASE_ADDRESS ; + e820[1 ].size = dom->mmio_size; + e820[1 ].type =E820_RESERVED ; + e820[2 ].addr =GB (4 ); + e820[2 ].size = dom->highmem_end -GB (4 );
Do you not want to check if highmem_end is larger than GB(4) before putting in this region?
tools/helpers/init-xenstore-domain.c static int build(xc_interface *xch) · line 168
Quoted 2 lines
tools/helpers/init-xenstore-domain.c +2
-0+ e820[2 ].type =E820_RAM ; + }
This hardcoded e820 map doesn't seem very flexible, but we control the guest kernel anyway so I think this should be fine.
The rest of this patch looks okay to me.
Wei.
Re: [PATCH 2/3] tools/init-xenstore-domain: support xenstore pvh stubdom
Quoted 44 lines · Wei Liu
Quoted 9 lines · Juergen Gross
Instead of creating the xenstore-stubdom domain first and parsing the kernel later do it the other way round. This enables to probe for the domain type supported by the xenstore-stubdom and to support both, pv and pvh type stubdoms.
Try to parse the stubdom image first for PV support, if this fails use HVM. Then create the domain with the appropriate type selected.
Signed-off-by Juergen Gross <[email protected]>[...]
Quoted 22 lines
tools/helpers/init-xenstore-domain.c +22
-0+ dom->container_type =XC_DOM_HVM_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { + dom->container_type =XC_DOM_PV_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { +fprintf (stderr,"xc_dom_parse_image failed\n" ); + goto err; + } + } +else + { + config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap; + config.arch.emulation_flags =XEN_X86_EMU_LAPIC ; + dom->target_pages = mem_size >>XC_PAGE_SHIFT ; + dom->mmio_size =GB (4 ) -LAPIC_BASE_ADDRESS ; + dom->lowmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +LAPIC_BASE_ADDRESS : mem_size; + dom->highmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +GB (4 ) + mem_size -LAPIC_BASE_ADDRESS :0 ;tools/helpers/init-xenstore-domain.c static int build(xc_interface *xch) · line 166
Quoted 10 lines
tools/helpers/init-xenstore-domain.c +10
-0+ dom->mmio_start =LAPIC_BASE_ADDRESS ; + dom->max_vcpus =1 ; + e820[0 ].addr =0 ; + e820[0 ].size = dom->lowmem_end; + e820[0 ].type =E820_RAM ; + e820[1 ].addr =LAPIC_BASE_ADDRESS ; + e820[1 ].size = dom->mmio_size; + e820[1 ].type =E820_RESERVED ; + e820[2 ].addr =GB (4 ); + e820[2 ].size = dom->highmem_end -GB (4 );
Quoted 2 lines
Do you not want to check if
highmem_endis larger than GB(4) before putting in this region?
Oh, indeed I should.
Quoted 8 lines
tools/helpers/init-xenstore-domain.c static int build(xc_interface *xch) · line 168
Quoted 3 lines
tools/helpers/init-xenstore-domain.c +2
-0+ e820[2 ].type =E820_RAM ; + }This hardcoded e820 map doesn't seem very flexible, but we control the guest kernel anyway so I think this should be fine.
The rest of this patch looks okay to me.
Thanks.
Juergen
Re: [PATCH 2/3] tools/init-xenstore-domain: support xenstore pvh stubdom
In reply to Wei LiuQuoted 44 lines · Wei Liu
Quoted 9 lines · Juergen Gross
Instead of creating the xenstore-stubdom domain first and parsing the kernel later do it the other way round. This enables to probe for the domain type supported by the xenstore-stubdom and to support both, pv and pvh type stubdoms.
Try to parse the stubdom image first for PV support, if this fails use HVM. Then create the domain with the appropriate type selected.
Signed-off-by Juergen Gross <[email protected]>[...]
Quoted 22 lines
tools/helpers/init-xenstore-domain.c +22
-0+ dom->container_type =XC_DOM_HVM_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { + dom->container_type =XC_DOM_PV_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { +fprintf (stderr,"xc_dom_parse_image failed\n" ); + goto err; + } + } +else + { + config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap; + config.arch.emulation_flags =XEN_X86_EMU_LAPIC ; + dom->target_pages = mem_size >>XC_PAGE_SHIFT ; + dom->mmio_size =GB (4 ) -LAPIC_BASE_ADDRESS ; + dom->lowmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +LAPIC_BASE_ADDRESS : mem_size; + dom->highmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +GB (4 ) + mem_size -LAPIC_BASE_ADDRESS :0 ;tools/helpers/init-xenstore-domain.c static int build(xc_interface *xch) · line 166
Quoted 10 lines
tools/helpers/init-xenstore-domain.c +10
-0+ dom->mmio_start =LAPIC_BASE_ADDRESS ; + dom->max_vcpus =1 ; + e820[0 ].addr =0 ; + e820[0 ].size = dom->lowmem_end; + e820[0 ].type =E820_RAM ; + e820[1 ].addr =LAPIC_BASE_ADDRESS ; + e820[1 ].size = dom->mmio_size; + e820[1 ].type =E820_RESERVED ; + e820[2 ].addr =GB (4 ); + e820[2 ].size = dom->highmem_end -GB (4 );
Quoted 2 lines
Do you not want to check if
highmem_endis larger than GB(4) before putting in this region?
Oh, just realized: further down I'm setting the guest's map with either 2 or 3 entries depending on dom->highmem_end value.
So I think this is fine.
Juergen
Wei Liu
Acked-byRe: [PATCH 2/3] tools/init-xenstore-domain: support xenstore pvh stubdom
Quoted 45 lines · Jürgen Groß
Quoted 44 lines · Wei Liu
Quoted 9 lines · Juergen Gross
Instead of creating the xenstore-stubdom domain first and parsing the kernel later do it the other way round. This enables to probe for the domain type supported by the xenstore-stubdom and to support both, pv and pvh type stubdoms.
Try to parse the stubdom image first for PV support, if this fails use HVM. Then create the domain with the appropriate type selected.
Signed-off-by Juergen Gross <[email protected]>[...]
Quoted 32 lines
tools/helpers/init-xenstore-domain.c +32
-0+ dom->container_type =XC_DOM_HVM_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { + dom->container_type =XC_DOM_PV_CONTAINER ; + rv =xc_dom_parse_image (dom); +if ( rv ) + { +fprintf (stderr,"xc_dom_parse_image failed\n" ); + goto err; + } + } +else + { + config.flags |= XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap; + config.arch.emulation_flags =XEN_X86_EMU_LAPIC ; + dom->target_pages = mem_size >>XC_PAGE_SHIFT ; + dom->mmio_size =GB (4 ) -LAPIC_BASE_ADDRESS ; + dom->lowmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +LAPIC_BASE_ADDRESS : mem_size; + dom->highmem_end = (mem_size >LAPIC_BASE_ADDRESS ) ? +GB (4 ) + mem_size -LAPIC_BASE_ADDRESS :0 ; + dom->mmio_start =LAPIC_BASE_ADDRESS ; + dom->max_vcpus =1 ; + e820[0 ].addr =0 ; + e820[0 ].size = dom->lowmem_end; + e820[0 ].type =E820_RAM ; + e820[1 ].addr =LAPIC_BASE_ADDRESS ; + e820[1 ].size = dom->mmio_size; + e820[1 ].type =E820_RESERVED ; + e820[2 ].addr =GB (4 ); + e820[2 ].size = dom->highmem_end -GB (4 );
Quoted 8 lines
Quoted 2 lines
Do you not want to check if
highmem_endis larger than GB(4) before putting in this region?Oh, just realized: further down I'm setting the guest's map with either 2 or 3 entries depending on
dom->highmem_endvalue.So I think this is fine.
Fair enough.
Wei.
Quoted 3 lines
Juergen
PATCH 3/3 stubdom: add xenstore pvh stubdom
In reply to Juergen GrossAdd a PVH xenstore stubdom in order to support a Xenstore stubdom on a hypervisor built without PV-support.
--- .gitignore | 1 + stubdom/Makefile | 31 ++++++++++++++++++++-- stubdom/configure | 47 ++++++++++++++++++++++++++++++++++ stubdom/configure.ac | 1 + stubdom/xenstorepvh-minios.cfg | 10 ++++++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 stubdom/xenstorepvh-minios.cfg
.gitignore +1 -0
@@ -91,6 +91,7 @@ stubdom/stubdompath.sh stubdom/tpm_emulator-* stubdom/vtpm/vtpm_manager.h stubdom/xenstore +stubdom/xenstorepvh stubdom/zlib-* tools/*/build/lib*/*.py tools/autom4te.cache/
stubdom/Makefile +29 -2
@@ -367,7 +367,10 @@ $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib)))) xenstore/stamp: $(XEN_ROOT)/tools/xenstore/Makefile $(do_links) -LINK_DIRS := xenstore $(foreach dir,$(STUB_LIBS),libs-$(XEN_TARGET_ARCH)/$(dir)) +xenstorepvh/stamp: $(XEN_ROOT)/tools/xenstore/Makefile + $(do_links) + +LINK_DIRS := xenstore xenstorepvh $(foreach dir,$(STUB_LIBS),libs-$(XEN_TARGET_ARCH)/$(dir)) LINK_STAMPS := $(foreach dir,$(LINK_DIRS),$(dir)/stamp) mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET) $(LINK_STAMPS)
@@ -486,6 +489,17 @@ xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg xenstore: $(CROSS_ROOT) xenstore-minios-config.mk CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y +############# +# xenstorepvh +############# + +xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg + MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config + +.PHONY: xenstorepvh +xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk + CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y + ######## # minios ########
@@ -519,6 +533,10 @@ pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a +.PHONY: xenstorepvh-stubdom +xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh + DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a + ######### # install #########
@@ -548,6 +566,10 @@ install-xenstore: xenstore-stubdom $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz" +install-xenstorepvh: xenstorepvh-stubdom + $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" + $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstorepvh/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/xenstorepvh-stubdom.gz" + install-vtpm: vtpm-stubdom $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-vtpm/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/vtpm-stubdom.gz"
@@ -581,6 +603,9 @@ uninstall-grub: uninstall-xenstore: rm -f $(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz +uninstall-xenstorepvh: + rm -f $(DESTDIR)$(XENFIRMWAREDIR)/xenstorepvh-stubdom.gz + uninstall-vtpm: rm -f $(DESTDIR)$(XENFIRMWAREDIR)/vtpm-stubdom.gz
@@ -600,6 +625,7 @@ clean: rm -fr mini-os-$(XEN_TARGET_ARCH)-caml rm -fr mini-os-$(XEN_TARGET_ARCH)-grub rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore + rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstorepvh rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpm rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpmmgr $(MAKE) DESTDIR= -C caml clean
@@ -612,6 +638,7 @@ clean: rm -fr pkg-config -[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean -[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean + -[ ! -d xenstorepvh ] || $(MAKE) DESTDIR= -C xenstorepvh clean # clean the cross-compilation result .PHONY: crossclean
@@ -620,7 +647,7 @@ crossclean: clean rm -fr newlib-$(XEN_TARGET_ARCH) rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH) rm -fr libs-$(XEN_TARGET_ARCH) - rm -fr ioemu xenstore + rm -fr ioemu xenstore xenstorepvh rm -fr gmp-$(XEN_TARGET_ARCH) rm -fr polarssl-$(XEN_TARGET_ARCH) rm -fr openssl-$(XEN_TARGET_ARCH)
stubdom/configure +47 -0
71 lines not on this page · raw message
stubdom/configure.ac +1 -0
@@ -23,6 +23,7 @@ AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c]) AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml]) AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub]) AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore]) +AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh]) AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm]) AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])
stubdom/xenstorepvh-minios.cfg new file +10 -0
@@ -0,0 +1,10 @@ +CONFIG_PARAVIRT=n +CONFIG_BLKFRONT=n +CONFIG_NETFRONT=n +CONFIG_FBFRONT=n +CONFIG_KBDFRONT=n +CONFIG_CONSFRONT=n +CONFIG_XENBUS=n +CONFIG_LWIP=n +CONFIG_BALLOON=y +XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__
Signature · 1 line
2.26.2
Re: [PATCH 3/3] stubdom: add xenstore pvh stubdom
Juergen Gross, le mer. 23 sept. 2020 08:45:41 +0200, a ecrit:
Quoted 4 lines
Add a PVH xenstore stubdom in order to support a Xenstore stubdom on a hypervisor built without PV-support.
Signed-off-by Juergen Gross <[email protected]>
Quoted 222 lines
--- .gitignore | 1 + stubdom/Makefile | 31 ++++++++++++++++++++-- stubdom/configure | 47 ++++++++++++++++++++++++++++++++++ stubdom/configure.ac | 1 + stubdom/xenstorepvh-minios.cfg | 10 ++++++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 stubdom/xenstorepvh-minios.cfg.gitignore +1
-0@@ -91,6 +91,7 @@ stubdom/stubdompath.sh stubdom/tpm_emulator-* stubdom/vtpm/vtpm_manager.h stubdom/xenstore +stubdom/xenstorepvh stubdom/zlib-* tools/*/build/lib*/*.py tools/autom4te.cache/stubdom/Makefile +29
-2@@ -367,7 +367,10 @@ $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib)))) xenstore/stamp: $(XEN_ROOT)/tools/xenstore/Makefile $(do_links) -LINK_DIRS := xenstore $(foreach dir,$(STUB_LIBS),libs-$(XEN_TARGET_ARCH)/$(dir)) +xenstorepvh/stamp: $(XEN_ROOT)/tools/xenstore/Makefile + $(do_links) + +LINK_DIRS := xenstore xenstorepvh $(foreach dir,$(STUB_LIBS),libs-$(XEN_TARGET_ARCH)/$(dir)) LINK_STAMPS := $(foreach dir,$(LINK_DIRS),$(dir)/stamp) mk-headers-$(XEN_TARGET_ARCH): $(IOEMU_LINKFARM_TARGET) $(LINK_STAMPS)@@ -486,6 +489,17 @@ xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg xenstore: $(CROSS_ROOT) xenstore-minios-config.mk CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstore-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y +############# +# xenstorepvh +############# + +xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg + MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config + +.PHONY: xenstorepvh +xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk + CPPFLAGS="$(TARGET_CPPFLAGS) $(shell cat xenstorepvh-minios-config.mk)" CFLAGS="$(TARGET_CFLAGS)" $(MAKE) DESTDIR= -C $@ xenstored.a CONFIG_STUBDOM=y + ######## # minios ########@@ -519,6 +533,10 @@ pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a +.PHONY: xenstorepvh-stubdom +xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh + DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a + ######### # install #########@@ -548,6 +566,10 @@ install-xenstore: xenstore-stubdom $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstore/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz" +install-xenstorepvh: xenstorepvh-stubdom + $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" + $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-xenstorepvh/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/xenstorepvh-stubdom.gz" + install-vtpm: vtpm-stubdom $(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)" $(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-vtpm/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/vtpm-stubdom.gz"@@ -581,6 +603,9 @@ uninstall-grub: uninstall-xenstore: rm -f $(DESTDIR)$(XENFIRMWAREDIR)/xenstore-stubdom.gz +uninstall-xenstorepvh: + rm -f $(DESTDIR)$(XENFIRMWAREDIR)/xenstorepvh-stubdom.gz + uninstall-vtpm: rm -f $(DESTDIR)$(XENFIRMWAREDIR)/vtpm-stubdom.gz@@ -600,6 +625,7 @@ clean: rm -fr mini-os-$(XEN_TARGET_ARCH)-caml rm -fr mini-os-$(XEN_TARGET_ARCH)-grub rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstore + rm -fr mini-os-$(XEN_TARGET_ARCH)-xenstorepvh rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpm rm -fr mini-os-$(XEN_TARGET_ARCH)-vtpmmgr $(MAKE) DESTDIR= -C caml clean@@ -612,6 +638,7 @@ clean: rm -fr pkg-config -[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean -[ ! -d xenstore ] || $(MAKE) DESTDIR= -C xenstore clean + -[ ! -d xenstorepvh ] || $(MAKE) DESTDIR= -C xenstorepvh clean # clean the cross-compilation result .PHONY: crossclean@@ -620,7 +647,7 @@ crossclean: clean rm -fr newlib-$(XEN_TARGET_ARCH) rm -fr zlib-$(XEN_TARGET_ARCH) pciutils-$(XEN_TARGET_ARCH) rm -fr libs-$(XEN_TARGET_ARCH) - rm -fr ioemu xenstore + rm -fr ioemu xenstore xenstorepvh rm -fr gmp-$(XEN_TARGET_ARCH) rm -fr polarssl-$(XEN_TARGET_ARCH) rm -fr openssl-$(XEN_TARGET_ARCH)stubdom/configure +47
-0@@ -630,6 +630,7 @@ WGET CMAKE extfiles debug +xenstorepvh xenstore grub caml@@ -689,6 +690,7 @@ enable_c_stubdom enable_caml_stubdom enable_pv_grub enable_xenstore_stubdom +enable_xenstore_pvh_stubdom enable_vtpm_stubdom enable_vtpmmgr_stubdom enable_qemu_traditional@@ -1344,6 +1346,9 @@ Optional Features: --disable-xenstore-stubdom Build and install xenstore-stubdom (default is ENABLED) + --disable-xenstorepvh-stubdom + Build and install xenstorepvh-stubdom (default is + ENABLED) --enable-vtpm-stubdom Build and install vtpm-stubdom --enable-vtpmmgr-stubdom Build and install vtpmmgr-stubdom@@ -2178,6 +2183,48 @@ fi +# Check whether --enable-xenstorepvh-stubdom was given. +if test "${enable_xenstore_pvh_stubdom+set}" = set; then : + enableval=$enable_xenstore_pvh_stubdom; + +if test "x$enableval" = "xyes"; then : + + +xenstorepvh=y +STUBDOM_TARGETS="$STUBDOM_TARGETS xenstorepvh" +STUBDOM_BUILD="$STUBDOM_BUILD xenstorepvh-stubdom" +STUBDOM_INSTALL="$STUBDOM_INSTALL install-xenstorepvh" +STUBDOM_UNINSTALL="$STUBDOM_UNINSTALL install-xenstorepvh" + + +else + +if test "x$enableval" = "xno"; then : + + +xenstorepvh=n + + +fi + +fi + + +else + + +xenstorepvh=y +STUBDOM_TARGETS="$STUBDOM_TARGETS xenstorepvh" +STUBDOM_BUILD="$STUBDOM_BUILD xenstorepvh-stubdom" +STUBDOM_INSTALL="$STUBDOM_INSTALL install-xenstorepvh" +STUBDOM_UNINSTALL="$STUBDOM_UNINSTALL install-xenstorepvh" + + +fi + + + + # Check whether --enable-vtpm-stubdom was given. if test "${enable_vtpm_stubdom+set}" = set; then : enableval=$enable_vtpm_stubdom;stubdom/configure.ac +1
-0@@ -23,6 +23,7 @@ AX_STUBDOM_DEFAULT_DISABLE([c-stubdom], [c]) AX_STUBDOM_DEFAULT_DISABLE([caml-stubdom], [caml]) AX_STUBDOM_DEFAULT_ENABLE([pv-grub], [grub]) AX_STUBDOM_DEFAULT_ENABLE([xenstore-stubdom], [xenstore]) +AX_STUBDOM_DEFAULT_ENABLE([xenstorepvh-stubdom], [xenstorepvh]) AX_STUBDOM_CONDITIONAL([vtpm-stubdom], [vtpm]) AX_STUBDOM_CONDITIONAL([vtpmmgr-stubdom], [vtpmmgr])stubdom/xenstorepvh-minios.cfg new file +10
-0@@ -0,0 +1,10 @@ +CONFIG_PARAVIRT=n +CONFIG_BLKFRONT=n +CONFIG_NETFRONT=n +CONFIG_FBFRONT=n +CONFIG_KBDFRONT=n +CONFIG_CONSFRONT=n +CONFIG_XENBUS=n +CONFIG_LWIP=n +CONFIG_BALLOON=y +XEN_INTERFACE_VERSION=__XEN_LATEST_INTERFACE_VERSION__Signature · 1 line
2.26.2
Re: [PATCH 3/3] stubdom: add xenstore pvh stubdom
In reply to Juergen GrossQuoted 4 lines · Juergen Gross
Add a PVH xenstore stubdom in order to support a Xenstore stubdom on a hypervisor built without PV-support.
Signed-off-by Juergen Gross <[email protected]>
Note to self: may need to regenerate stubdom/configure.
Quoted 13 lines · Juergen Gross
Add support for creating a PVH Xenstore stub-domain.
This includes building the stubdom and loading it at system boot.
It should be noted that currently this stubdom is not in a working state as there is some support in Mini-OS missing. I'm working on adding this support.
Juergen Gross (3):
tools/init-xenstore-domain: add loggingtools/init-xenstore-domain: support xenstore pvh stubdom
stubdom: add xenstore pvh stubdom
Quoted 9 lines
.gitignore | 1 + stubdom/Makefile | 31 ++++- stubdom/configure | 47 ++++++++ stubdom/configure.ac | 1 + stubdom/xenstorepvh-minios.cfg | 10 ++ tools/helpers/init-xenstore-domain.c | 170 ++++++++++++++++++++------- 6 files changed, 213 insertions(+), 47 deletions(-)create mode 100644 stubdom/xenstorepvh-minios.cfg
Anything missing for this series to be committed?
Juergen