From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v5 23/28] libxc: allow creating domains without emulated devices.
Date: Fri, 21 Aug 2015 18:53:36 +0200 [thread overview]
Message-ID: <1440176021-18910-24-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1440176021-18910-1-git-send-email-roger.pau@citrix.com>
Introduce a new flag in xc_dom_image that turns on and off the emulated
devices. This prevents creating the VGA hole, the hvm_info page and the
ioreq server pages. libxl unconditionally sets it to true for all HVM
domains at the moment.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v4:
- Store the size of the VGA hole inside of the xc_dom_image struct and set
it from libxl.
- Rename dom->emulation to dom->device_model (no functional change).
- Add Wei Liu Acked-by.
Changes since v3:
- Explain the meaning of the "emulation" xc_dom_image field.
---
tools/libxc/include/xc_dom.h | 4 +++
tools/libxc/xc_dom_x86.c | 73 ++++++++++++++++++++++++--------------------
tools/libxl/libxl_dom.c | 2 ++
tools/libxl/libxl_internal.h | 1 +
4 files changed, 47 insertions(+), 33 deletions(-)
diff --git a/tools/libxc/include/xc_dom.h b/tools/libxc/include/xc_dom.h
index cda40d9..507b323 100644
--- a/tools/libxc/include/xc_dom.h
+++ b/tools/libxc/include/xc_dom.h
@@ -193,6 +193,10 @@ struct xc_dom_image {
xen_pfn_t mmio_size;
xen_pfn_t lowmem_end;
xen_pfn_t highmem_end;
+ xen_pfn_t vga_hole_size;
+
+ /* If unset disables the setup of the IOREQ pages. */
+ bool device_model;
/* Extra ACPI tables passed to HVMLOADER */
struct xc_hvm_firmware_module acpi_module;
diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c
index 0a4ac58..fb71717 100644
--- a/tools/libxc/xc_dom_x86.c
+++ b/tools/libxc/xc_dom_x86.c
@@ -49,8 +49,6 @@
#define X86_CR0_PE 0x01
#define X86_CR0_ET 0x10
-#define VGA_HOLE_SIZE (0x20)
-
#define SPECIALPAGE_PAGING 0
#define SPECIALPAGE_ACCESS 1
#define SPECIALPAGE_SHARING 2
@@ -522,12 +520,15 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
xen_pfn_t ioreq_server_array[NR_IOREQ_SERVER_PAGES];
xc_interface *xch = dom->xch;
- if ( (hvm_info_page = xc_map_foreign_range(
- xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
- HVM_INFO_PFN)) == NULL )
- goto error_out;
- build_hvm_info(hvm_info_page, dom);
- munmap(hvm_info_page, PAGE_SIZE);
+ if ( dom->device_model )
+ {
+ if ( (hvm_info_page = xc_map_foreign_range(
+ xch, domid, PAGE_SIZE, PROT_READ | PROT_WRITE,
+ HVM_INFO_PFN)) == NULL )
+ goto error_out;
+ build_hvm_info(hvm_info_page, dom);
+ munmap(hvm_info_page, PAGE_SIZE);
+ }
/* Allocate and clear special pages. */
for ( i = 0; i < NR_SPECIAL_PAGES; i++ )
@@ -559,30 +560,33 @@ static int alloc_magic_pages_hvm(struct xc_dom_image *dom)
xc_hvm_param_set(xch, domid, HVM_PARAM_SHARING_RING_PFN,
special_pfn(SPECIALPAGE_SHARING));
- /*
- * Allocate and clear additional ioreq server pages. The default
- * server will use the IOREQ and BUFIOREQ special pages above.
- */
- for ( i = 0; i < NR_IOREQ_SERVER_PAGES; i++ )
- ioreq_server_array[i] = ioreq_server_pfn(i);
-
- rc = xc_domain_populate_physmap_exact(xch, domid, NR_IOREQ_SERVER_PAGES, 0,
- 0, ioreq_server_array);
- if ( rc != 0 )
+ if ( dom->device_model )
{
- DOMPRINTF("Could not allocate ioreq server pages.");
- goto error_out;
- }
+ /*
+ * Allocate and clear additional ioreq server pages. The default
+ * server will use the IOREQ and BUFIOREQ special pages above.
+ */
+ for ( i = 0; i < NR_IOREQ_SERVER_PAGES; i++ )
+ ioreq_server_array[i] = ioreq_server_pfn(i);
- if ( xc_clear_domain_pages(xch, domid, ioreq_server_pfn(0),
- NR_IOREQ_SERVER_PAGES) )
+ rc = xc_domain_populate_physmap_exact(xch, domid, NR_IOREQ_SERVER_PAGES, 0,
+ 0, ioreq_server_array);
+ if ( rc != 0 )
+ {
+ DOMPRINTF("Could not allocate ioreq server pages.");
goto error_out;
+ }
- /* Tell the domain where the pages are and how many there are */
- xc_hvm_param_set(xch, domid, HVM_PARAM_IOREQ_SERVER_PFN,
- ioreq_server_pfn(0));
- xc_hvm_param_set(xch, domid, HVM_PARAM_NR_IOREQ_SERVER_PAGES,
- NR_IOREQ_SERVER_PAGES);
+ if ( xc_clear_domain_pages(xch, domid, ioreq_server_pfn(0),
+ NR_IOREQ_SERVER_PAGES) )
+ goto error_out;
+
+ /* Tell the domain where the pages are and how many there are */
+ xc_hvm_param_set(xch, domid, HVM_PARAM_IOREQ_SERVER_PFN,
+ ioreq_server_pfn(0));
+ xc_hvm_param_set(xch, domid, HVM_PARAM_NR_IOREQ_SERVER_PAGES,
+ NR_IOREQ_SERVER_PAGES);
+ }
/*
* Identity-map page table is required for running with CR0.PG=0 when
@@ -1319,7 +1323,8 @@ static int meminit_hvm(struct xc_dom_image *dom)
* allocated is pointless.
*/
if ( claim_enabled ) {
- rc = xc_domain_claim_pages(xch, domid, target_pages - VGA_HOLE_SIZE);
+ rc = xc_domain_claim_pages(xch, domid,
+ target_pages - dom->vga_hole_size);
if ( rc != 0 )
{
DOMPRINTF("Could not allocate memory for HVM guest as we cannot claim memory!");
@@ -1335,7 +1340,8 @@ static int meminit_hvm(struct xc_dom_image *dom)
* tot_pages will be target_pages - VGA_HOLE_SIZE after
* this call.
*/
- rc = xc_domain_set_pod_target(xch, domid, target_pages - VGA_HOLE_SIZE,
+ rc = xc_domain_set_pod_target(xch, domid,
+ target_pages - dom->vga_hole_size,
NULL, NULL, NULL);
if ( rc != 0 )
{
@@ -1354,8 +1360,9 @@ static int meminit_hvm(struct xc_dom_image *dom)
* Under 2MB mode, we allocate pages in batches of no more than 8MB to
* ensure that we can be preempted and hence dom0 remains responsive.
*/
- rc = xc_domain_populate_physmap_exact(
- xch, domid, 0xa0, 0, memflags, &dom->p2m_host[0x00]);
+ if ( dom->device_model )
+ rc = xc_domain_populate_physmap_exact(
+ xch, domid, 0xa0, 0, memflags, &dom->p2m_host[0x00]);
stat_normal_pages = 0;
for ( vmemid = 0; vmemid < nr_vmemranges; vmemid++ )
@@ -1374,7 +1381,7 @@ static int meminit_hvm(struct xc_dom_image *dom)
* 0xA0000-0xC0000. Note that 0x00000-0xA0000 is populated just
* before this loop.
*/
- if ( vmemranges[vmemid].start == 0 )
+ if ( vmemranges[vmemid].start == 0 && dom->device_model )
{
cur_pages = 0xc0;
stat_normal_pages += 0xc0;
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index d2cf9e3..4a214e7 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -987,6 +987,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
dom->lowmem_end = lowmem_end;
dom->highmem_end = highmem_end;
dom->mmio_start = mmio_start;
+ dom->vga_hole_size = LIBXL_VGA_HOLE_SIZE
+ dom->device_model = true;
rc = libxl__domain_device_construct_rdm(gc, d_config,
info->u.hvm.rdm_mem_boundary_memkb*1024,
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index ea89f1f..294d442 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -100,6 +100,7 @@
#define LIBXL_HVM_EXTRA_MEMORY 2048
#define LIBXL_MIN_DOM0_MEM (128*1024)
#define LIBXL_INVALID_GFN (~(uint64_t)0)
+#define LIBXL_VGA_HOLE_SIZE 0x20
/* use 0 as the domid of the toolstack domain for now */
#define LIBXL_TOOLSTACK_DOMID 0
#define QEMU_SIGNATURE "DeviceModelRecord0002"
--
1.9.5 (Apple Git-50.3)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-08-21 17:15 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-21 16:53 [PATCH v5 00/28] Introduce HVM without dm and new boot ABI Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 01/28] libxc: split x86 HVM setup_guest into smaller logical functions Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 02/28] libxc: unify xc_dom_p2m_{host/guest} Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 03/28] libxc: introduce the notion of a container type Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 04/28] libxc: introduce a domain loader for HVM guest firmware Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 05/28] libxc: make arch_setup_meminit a xc_dom_arch hook Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 06/28] libxc: make arch_setup_boot{init/late} xc_dom_arch hooks Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 07/28] libxc: rework BSP initialization Roger Pau Monne
2015-08-24 18:26 ` Konrad Rzeszutek Wilk
2015-08-25 8:33 ` Roger Pau Monné
2015-08-25 9:02 ` Wei Liu
2015-08-25 9:22 ` Roger Pau Monné
2015-08-25 9:32 ` Wei Liu
2015-08-25 9:35 ` Andrew Cooper
2015-08-21 16:53 ` [PATCH v5 08/28] libxc: introduce a xc_dom_arch for hvm-3.0-x86_32 guests Roger Pau Monne
2015-08-25 9:17 ` Wei Liu
2015-08-21 16:53 ` [PATCH v5 09/28] libxl: switch HVM domain building to use xc_dom_* helpers Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 10/28] libxc: remove dead HVM building code Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 11/28] xen/x86: add bitmap of enabled emulated devices Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 12/28] xen/x86: allow disabling the emulated local apic Roger Pau Monne
2015-08-31 21:55 ` Boris Ostrovsky
2015-08-21 16:53 ` [PATCH v5 13/28] xen/x86: allow disabling the emulated HPET Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 14/28] xen/x86: allow disabling the pmtimer Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 15/28] xen/x86: allow disabling the emulated RTC Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 16/28] xen/x86: allow disabling the emulated IO APIC Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 17/28] xen/x86: allow disabling the emulated PIC Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 18/28] xen/x86: allow disabling the emulated pmu Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 19/28] xen/x86: allow disabling the emulated VGA Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 20/28] xen/x86: allow disabling the emulated IOMMU Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 21/28] xen/x86: allow disabling all emulated devices inside of Xen Roger Pau Monne
2015-08-21 17:19 ` Andrew Cooper
2015-08-21 16:53 ` [PATCH v5 22/28] elfnotes: intorduce a new PHYS_ENTRY elfnote Roger Pau Monne
2015-08-21 16:53 ` Roger Pau Monne [this message]
2015-08-21 17:42 ` [PATCH v5 23/28] libxc: allow creating domains without emulated devices Andrew Cooper
2015-08-21 16:53 ` [PATCH v5 24/28] xen/x86: allow HVM guests to use hypercalls to bring up vCPUs Roger Pau Monne
2015-08-21 20:36 ` Andrew Cooper
2015-08-24 10:43 ` Roger Pau Monné
2015-08-24 11:57 ` Andrew Cooper
2015-08-21 16:53 ` [PATCH v5 25/28] xenconsole: try to attach to PV console if HVM fails Roger Pau Monne
2015-08-21 16:53 ` [PATCH v5 26/28] libxc/xen: introduce a start info structure for HVMlite guests Roger Pau Monne
2015-08-21 21:00 ` Andrew Cooper
2015-08-24 15:24 ` Roger Pau Monné
2015-08-21 16:53 ` [PATCH v5 27/28] libxc: switch xc_dom_elfloader to be used with HVMlite domains Roger Pau Monne
2015-08-25 9:32 ` Wei Liu
2015-08-21 16:53 ` [PATCH v5 28/28] libxl: allow the creation of HVM domains without a device model Roger Pau Monne
2015-08-25 9:30 ` Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1440176021-18910-24-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).