#if defined(__i386__) || defined(__x86_64__)
#define LAPIC_BASE_ADDRESS 0xfee00000
+#define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
int libxl__dom_load_acpi(libxl__gc *gc,
const libxl_domain_build_info *b_info,
dom->mmio_size = HVM_BELOW_4G_MMIO_LENGTH;
else if (dom->mmio_size == 0 && !device_model) {
#if defined(__i386__) || defined(__x86_64__)
- if (libxl_defbool_val(info->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);
+ /*
+ * Make sure the local APIC page, the ACPI tables and the special pages
+ * are inside the MMIO hole.
+ */
+ xen_paddr_t start =
+ (X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES) <<
+ XC_PAGE_SHIFT;
+
+ start = min_t(xen_paddr_t, start, LAPIC_BASE_ADDRESS);
+ start = min_t(xen_paddr_t, start, ACPI_INFO_PHYSICAL_ADDRESS);
+ dom->mmio_size = GB(4) - start;
#else
assert(1);
#endif
if (d_config->rdms[i].policy != LIBXL_RDM_RESERVE_POLICY_INVALID)
e820_entries++;
- /* Add mmio entry for PVH. */
- if (dom->mmio_size && d_config->b_info.type == LIBXL_DOMAIN_TYPE_PVH)
+ /* Add the HVM special pages to PVH memmap as RESERVED. */
+ if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_PVH)
e820_entries++;
/* If we should have a highmem range. */
nr++;
}
- /* mmio area */
- if (dom->mmio_size && d_config->b_info.type == LIBXL_DOMAIN_TYPE_PVH) {
- e820[nr].addr = dom->mmio_start;
- e820[nr].size = dom->mmio_size;
+ /* HVM special pages */
+ if (d_config->b_info.type == LIBXL_DOMAIN_TYPE_PVH) {
+ e820[nr].addr = (X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES)
+ << XC_PAGE_SHIFT;
+ e820[nr].size = X86_HVM_NR_SPECIAL_PAGES << XC_PAGE_SHIFT;
e820[nr].type = E820_RESERVED;
nr++;
}
/* Number of pages holding ACPI tables */
#define NUM_ACPI_PAGES 16
-#define ACPI_INFO_PHYSICAL_ADDRESS 0xfc000000
struct libxl_acpi_ctxt {
struct acpi_ctxt c;