From: Don Slutz <dslutz@verizon.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Don Slutz <dslutz@verizon.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [RFC PATCH 1/1] Add pci_hole_min_size
Date: Fri, 28 Feb 2014 15:15:35 -0500 [thread overview]
Message-ID: <1393618535-9587-2-git-send-email-dslutz@verizon.com> (raw)
In-Reply-To: <1393618535-9587-1-git-send-email-dslutz@verizon.com>
This allows growing the pci_hole to the size needed.
Signed-off-by: Don Slutz <dslutz@verizon.com>
---
tools/firmware/hvmloader/pci.c | 10 ++++++++++
tools/libxc/xc_hvm_build_x86.c | 22 ++++++++++++++++++++++
tools/libxc/xenguest.h | 11 +++++++++++
tools/libxl/libxl_create.c | 4 +++-
tools/libxl/libxl_dm.c | 13 +++++++++++--
tools/libxl/libxl_dom.c | 3 ++-
tools/libxl/libxl_types.idl | 1 +
tools/libxl/xl_cmdimpl.c | 6 ++++++
8 files changed, 66 insertions(+), 4 deletions(-)
diff --git a/tools/firmware/hvmloader/pci.c b/tools/firmware/hvmloader/pci.c
index 627e8cb..b36d00b 100644
--- a/tools/firmware/hvmloader/pci.c
+++ b/tools/firmware/hvmloader/pci.c
@@ -58,6 +58,7 @@ void pci_setup(void)
uint64_t bar_sz;
} *bars = (struct bars *)scratch_start;
unsigned int i, nr_bars = 0;
+ uint64_t pci_hole_min_size;
const char *s;
/*
@@ -85,6 +86,9 @@ void pci_setup(void)
printf("Relocating guest memory for lowmem MMIO space %s\n",
allow_memory_relocate?"enabled":"disabled");
+ s = xenstore_read("platform/pci_hole_min_size", "0");
+ pci_hole_min_size = strtoll(s, NULL, 0);
+
/* Program PCI-ISA bridge with appropriate link routes. */
isa_irq = 0;
for ( link = 0; link < 4; link++ )
@@ -236,6 +240,12 @@ void pci_setup(void)
pci_writew(devfn, PCI_COMMAND, cmd);
}
+ if (pci_hole_min_size) {
+ pci_mem_start = (1ull << 32) - pci_hole_min_size;
+ printf("pci_mem_start=0x%lx (was 0x%x) for pci_hole_min_size=%llu\n",
+ pci_mem_start, PCI_MEM_START, pci_hole_min_size);
+ }
+
/*
* At the moment qemu-xen can't deal with relocated memory regions.
* It's too close to the release to make a proper fix; for now,
diff --git a/tools/libxc/xc_hvm_build_x86.c b/tools/libxc/xc_hvm_build_x86.c
index dd3b522..4752d58 100644
--- a/tools/libxc/xc_hvm_build_x86.c
+++ b/tools/libxc/xc_hvm_build_x86.c
@@ -603,16 +603,38 @@ int xc_hvm_build_target_mem(xc_interface *xch,
int target,
const char *image_name)
{
+ return xc_hvm_build_target_mem_with_hole(xch, domid, memsize, target, image_name, 0);
+}
+
+int xc_hvm_build_target_mem_with_hole(xc_interface *xch,
+ uint32_t domid,
+ int memsize,
+ int target,
+ const char *image_name,
+ uint64_t pci_hole_min_size)
+{
struct xc_hvm_build_args args = {};
memset(&args, 0, sizeof(struct xc_hvm_build_args));
args.mem_size = (uint64_t)memsize << 20;
args.mem_target = (uint64_t)target << 20;
args.image_file_name = image_name;
+ if (pci_hole_min_size > HVM_BELOW_4G_MMIO_LENGTH)
+ args.mmio_size = pci_hole_min_size;
return xc_hvm_build(xch, domid, &args);
}
+int xc_hvm_build_with_hole(xc_interface *xch, uint32_t domid,
+ struct xc_hvm_build_args *args,
+ uint64_t pci_hole_min_size)
+{
+ if (pci_hole_min_size > HVM_BELOW_4G_MMIO_LENGTH)
+ args->mmio_size = pci_hole_min_size;
+
+ return xc_hvm_build(xch, domid, args);
+}
+
/*
* Local variables:
* mode: C
diff --git a/tools/libxc/xenguest.h b/tools/libxc/xenguest.h
index a0e30e1..44290bd 100644
--- a/tools/libxc/xenguest.h
+++ b/tools/libxc/xenguest.h
@@ -248,12 +248,23 @@ struct xc_hvm_build_args {
int xc_hvm_build(xc_interface *xch, uint32_t domid,
struct xc_hvm_build_args *hvm_args);
+int xc_hvm_build_with_hole(xc_interface *xch, uint32_t domid,
+ struct xc_hvm_build_args *args,
+ uint64_t pci_hole_min_size);
+
int xc_hvm_build_target_mem(xc_interface *xch,
uint32_t domid,
int memsize,
int target,
const char *image_name);
+int xc_hvm_build_target_mem_with_hole(xc_interface *xch,
+ uint32_t domid,
+ int memsize,
+ int target,
+ const char *image_name,
+ uint64_t pci_hole_min_size);
+
int xc_suspend_evtchn_release(xc_interface *xch, xc_evtchn *xce, int domid, int suspend_evtchn);
int xc_suspend_evtchn_init(xc_interface *xch, xc_evtchn *xce, int domid, int port);
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index a604cd8..24ceac6 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -388,13 +388,15 @@ int libxl__domain_build(libxl__gc *gc,
vments[4] = "start_time";
vments[5] = libxl__sprintf(gc, "%lu.%02d", start_time.tv_sec,(int)start_time.tv_usec/10000);
- localents = libxl__calloc(gc, 7, sizeof(char *));
+ localents = libxl__calloc(gc, 9, sizeof(char *));
localents[0] = "platform/acpi";
localents[1] = libxl_defbool_val(info->u.hvm.acpi) ? "1" : "0";
localents[2] = "platform/acpi_s3";
localents[3] = libxl_defbool_val(info->u.hvm.acpi_s3) ? "1" : "0";
localents[4] = "platform/acpi_s4";
localents[5] = libxl_defbool_val(info->u.hvm.acpi_s4) ? "1" : "0";
+ localents[6] = "platform/pci_hole_min_size";
+ localents[7] = libxl__sprintf(gc, "%llu", (unsigned long long)info->u.hvm.pci_hole_min_size);
break;
case LIBXL_DOMAIN_TYPE_PV:
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index f6f7bbd..66ba7cd 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -653,17 +653,26 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
flexarray_append(dm_args, b_info->extra_pv[i]);
break;
case LIBXL_DOMAIN_TYPE_HVM:
+ {
+ char *machinearg;
+
if (!libxl_defbool_val(b_info->u.hvm.xen_platform_pci)) {
/* Switching here to the machine "pc" which does not add
* the xen-platform device instead of the default "xenfv" machine.
*/
- flexarray_append(dm_args, "pc,accel=xen");
+ machinearg = libxl__sprintf(gc, "pc,accel=xen");
} else {
- flexarray_append(dm_args, "xenfv");
+ machinearg = libxl__sprintf(gc, "xenfv");
+ }
+ if (b_info->u.hvm.pci_hole_min_size) {
+ machinearg = libxl__sprintf(gc, "%s,pci_hole_min_size=%llu", machinearg,
+ (unsigned long long) b_info->u.hvm.pci_hole_min_size);
}
+ flexarray_append(dm_args, machinearg);
for (i = 0; b_info->extra_hvm && b_info->extra_hvm[i] != NULL; i++)
flexarray_append(dm_args, b_info->extra_hvm[i]);
break;
+ }
default:
abort();
}
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 55f74b2..6ebc606 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -642,7 +642,8 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
goto out;
}
- ret = xc_hvm_build(ctx->xch, domid, &args);
+ ret = xc_hvm_build_with_hole(ctx->xch, domid, &args,
+ info->u.hvm.pci_hole_min_size);
if (ret) {
LOGEV(ERROR, ret, "hvm building failed");
goto out;
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
index 649ce50..febfbb4 100644
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -346,6 +346,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
("timeoffset", string),
("hpet", libxl_defbool),
("vpt_align", libxl_defbool),
+ ("pci_hole_min_size",uint64),
("timer_mode", libxl_timer_mode),
("nested_hvm", libxl_defbool),
("smbios_firmware", string),
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 4fc46eb..fe247ee 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1025,6 +1025,12 @@ static void parse_config_data(const char *config_source,
xlu_cfg_get_defbool(config, "hpet", &b_info->u.hvm.hpet, 0);
xlu_cfg_get_defbool(config, "vpt_align", &b_info->u.hvm.vpt_align, 0);
+ if (!xlu_cfg_get_long(config, "pci_hole_min_size", &l, 0)) {
+ b_info->u.hvm.pci_hole_min_size = (uint64_t) l;
+ if (dom_info->debug)
+ fprintf(stderr, "pci_hole_min_size: %llu\n", (unsigned long long) b_info->u.hvm.pci_hole_min_size);
+ }
+
if (!xlu_cfg_get_long(config, "timer_mode", &l, 1)) {
const char *s = libxl_timer_mode_to_string(l);
fprintf(stderr, "WARNING: specifying \"timer_mode\" as an integer is deprecated. "
--
1.8.4
next prev parent reply other threads:[~2014-02-28 20:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 20:15 [RFC PATCH 0/1] Add pci_hole_min_size Don Slutz
2014-02-28 20:15 ` Don Slutz [this message]
2014-02-28 22:07 ` [RFC PATCH 1/1] " Boris Ostrovsky
2014-03-03 15:30 ` Don Slutz
2014-03-03 16:07 ` Boris Ostrovsky
2014-03-03 20:43 ` Don Slutz
2014-03-03 22:54 ` Boris Ostrovsky
2014-03-04 13:25 ` George Dunlap
2014-03-04 18:57 ` Don Slutz
2014-03-07 19:28 ` Konrad Rzeszutek Wilk
2014-03-11 12:54 ` George Dunlap
2014-03-11 17:16 ` Don Slutz
-- strict thread matches above, loose matches on Subject: below --
2014-03-11 17:01 [RFC PATCH 0/1] " Don Slutz
2014-03-11 17:01 ` [RFC PATCH 1/1] " Don Slutz
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=1393618535-9587-2-git-send-email-dslutz@verizon.com \
--to=dslutz@verizon.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.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).