@@ -166,6 +166,8 @@ $(XL_OBJS) $(TEST_PROG_OBJS) _libxl.api-for-check: \
$(XL_OBJS): CFLAGS += $(CFLAGS_XL)
$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
+libxl_dom.o: CFLAGS += -I$(XEN_ROOT)/tools # include libacpi/x86.h
+
SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
$(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenevtchn)
@@ -62,4 +62,10 @@ int libxl__arch_domain_construct_memmap(libxl__gc *gc,
uint32_t domid,
struct xc_dom_image *dom);
+#if defined(__i386__) || defined(__x86_64__)
+
+#define LAPIC_BASE_ADDRESS 0xfee00000
+
+#endif
+
#endif
@@ -1077,10 +1077,21 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
dom->target_pages = mem_size >> XC_PAGE_SHIFT;
if (dom->mmio_size == 0 && device_model)
dom->mmio_size = HVM_BELOW_4G_MMIO_LENGTH;
- else if (dom->mmio_size == 0 && !device_model)
- dom->mmio_size = GB(4) -
- ((X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES)
- << XC_PAGE_SHIFT);
+ else if (dom->mmio_size == 0 && !device_model) {
+#if defined(__i386__) || defined(__x86_64__)
+ if (libxl_defbool_val(info->u.hvm.apic)) {
+ /* Make sure LAPIC_BASE_ADDRESS is below special pages */
+ assert(((((X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES)
+ << XC_PAGE_SHIFT) - LAPIC_BASE_ADDRESS)) >= XC_PAGE_SIZE);
+ dom->mmio_size = GB(4) - LAPIC_BASE_ADDRESS;
+ } else
+ dom->mmio_size = GB(4) -
+ ((X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES)
+ << XC_PAGE_SHIFT);
+#else
+ assert(1);
+#endif
+ }
lowmem_end = mem_size;
highmem_end = 0;
mmio_start = (1ull << 32) - dom->mmio_size;
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> --- Changes in v3: * Now that we don't have x86.h define LAPIC_BASE_ADDRESS in libxl_arch.h tools/libxl/Makefile | 2 ++ tools/libxl/libxl_arch.h | 6 ++++++ tools/libxl/libxl_dom.c | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-)