Revert "x86/pvh: use a custom IO bitmap for PVH hardware domains"
authorJan Beulich <jbeulich@suse.com>
Mon, 11 May 2015 08:34:13 +0000 (10:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 May 2015 08:34:13 +0000 (10:34 +0200)
This reverts commit e5786bae04c3ebf6b122b2d983a946ff29308781 - it
breaks the XSM build.

xen/arch/x86/hvm/hvm.c
xen/arch/x86/hvm/svm/vmcb.c
xen/arch/x86/hvm/vmx/vmcs.c
xen/arch/x86/setup.c
xen/common/domain.c
xen/include/asm-x86/hvm/domain.h
xen/include/asm-x86/setup.h

index 8140a27cea686aa6ca1b836479f41a07a6399409..371fd33ed344457c7a065ab855900aff27c8d462 100644 (file)
@@ -77,13 +77,9 @@ integer_param("hvm_debug", opt_hvm_debug_level);
 
 struct hvm_function_table hvm_funcs __read_mostly;
 
-#define HVM_IOBITMAP_SIZE   (3*PAGE_SIZE)
-/*
- * The I/O permission bitmap is globally shared by all HVM guests except
- * the hardware domain that has a more permissive IO bitmap.
- */
+/* I/O permission bitmap is globally shared by all HVM guests. */
 unsigned long __attribute__ ((__section__ (".bss.page_aligned")))
-    hvm_io_bitmap[HVM_IOBITMAP_SIZE/BYTES_PER_LONG];
+    hvm_io_bitmap[3*PAGE_SIZE/BYTES_PER_LONG];
 
 /* Xen command-line option to enable HAP */
 static bool_t __initdata opt_hap_enabled = 1;
@@ -1465,20 +1461,6 @@ int hvm_domain_initialise(struct domain *d)
         goto fail1;
     d->arch.hvm_domain.io_handler->num_slot = 0;
 
-    /* Set the default IO Bitmap */
-    if ( is_hardware_domain(d) )
-    {
-        d->arch.hvm_domain.io_bitmap = _xmalloc(HVM_IOBITMAP_SIZE, PAGE_SIZE);
-        if ( d->arch.hvm_domain.io_bitmap == NULL )
-        {
-            rc = -ENOMEM;
-            goto fail1;
-        }
-        memset(d->arch.hvm_domain.io_bitmap, ~0, HVM_IOBITMAP_SIZE);
-    }
-    else
-        d->arch.hvm_domain.io_bitmap = hvm_io_bitmap;
-
     if ( is_pvh_domain(d) )
     {
         register_portio_handler(d, 0, 0x10003, handle_pvh_io);
@@ -1514,8 +1496,6 @@ int hvm_domain_initialise(struct domain *d)
     stdvga_deinit(d);
     vioapic_deinit(d);
  fail1:
-    if ( is_hardware_domain(d) )
-        xfree(d->arch.hvm_domain.io_bitmap);
     xfree(d->arch.hvm_domain.io_handler);
     xfree(d->arch.hvm_domain.params);
  fail0:
index 10afd44b2b2bf8e97cd492c1ab469e06d3a941e3..21292bbe97e12559a26e2fcb7e32e47b7a40d89b 100644 (file)
@@ -118,7 +118,7 @@ static int construct_vmcb(struct vcpu *v)
         svm_disable_intercept_for_msr(v, MSR_AMD64_LWP_CBADDR);
 
     vmcb->_msrpm_base_pa = (u64)virt_to_maddr(arch_svm->msrpm);
-    vmcb->_iopm_base_pa = virt_to_maddr(v->domain->arch.hvm_domain.io_bitmap);
+    vmcb->_iopm_base_pa  = (u64)virt_to_maddr(hvm_io_bitmap);
 
     /* Virtualise EFLAGS.IF and LAPIC TPR (CR8). */
     vmcb->_vintr.fields.intr_masking = 1;
index a353351ea24825ae1794852047b081eaa002ff57..3123706f919925a5f37e879d99d174f10705fa68 100644 (file)
@@ -1032,9 +1032,8 @@ static int construct_vmcs(struct vcpu *v)
     }
 
     /* I/O access bitmap. */
-    __vmwrite(IO_BITMAP_A, virt_to_maddr(d->arch.hvm_domain.io_bitmap));
-    __vmwrite(IO_BITMAP_B,
-              virt_to_maddr(d->arch.hvm_domain.io_bitmap) + PAGE_SIZE);
+    __vmwrite(IO_BITMAP_A, virt_to_maddr((char *)hvm_io_bitmap + 0));
+    __vmwrite(IO_BITMAP_B, virt_to_maddr((char *)hvm_io_bitmap + PAGE_SIZE));
 
     if ( cpu_has_vmx_virtual_intr_delivery )
     {
index 3b9aee5beaef268aaa604f809833da4cb62185ae..2b9787a1634fbb07bc25029ec7d8e1d8bb4a6350 100644 (file)
@@ -1446,9 +1446,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     dmi_end_boot();
 
-    if ( is_hardware_domain(dom0) )
-        setup_io_bitmap(dom0);
-
     system_state = SYS_STATE_active;
 
     domain_unpause_by_systemcontroller(dom0);
@@ -1512,32 +1509,6 @@ int __hwdom_init xen_in_range(unsigned long mfn)
     return 0;
 }
 
-static int __hwdom_init io_bitmap_cb(unsigned long s, unsigned long e,
-                                     void *ctx)
-{
-    struct domain *d = ctx;
-    int i;
-
-    ASSERT(s <= INT_MAX && e <= INT_MAX);
-    for ( i = s; i <= e; i++ )
-        __clear_bit(i, d->arch.hvm_domain.io_bitmap);
-
-    return 0;
-}
-
-void __hwdom_init setup_io_bitmap(struct domain *d)
-{
-    int rc;
-
-    ASSERT(is_hardware_domain(d));
-    if ( has_hvm_container_domain(d) )
-    {
-        rc = rangeset_report_ranges(d->arch.ioport_caps, 0, 0x10000,
-                                    io_bitmap_cb, d);
-        BUG_ON(rc);
-    }
-}
-
 /*
  * Local variables:
  * mode: C
index 8e0a7cd8c007dc29ef338a68dda8015faca967fd..6803c4daa446b6186638355f08b819de42b7ab35 100644 (file)
@@ -225,8 +225,6 @@ static int late_hwdom_init(struct domain *d)
 
     iommu_hwdom_init(d);
 
-    setup_io_bitmap(d);
-
     return rv;
 #else
     return 0;
index e2507910723b27609ad159cee961cf0ab16ef48c..0f8b19af2de84fdae64d3ef9da9ded831cdc9138 100644 (file)
@@ -141,8 +141,6 @@ struct hvm_domain {
      */
     uint64_t sync_tsc;
 
-    unsigned long         *io_bitmap;
-
     union {
         struct vmx_domain vmx;
         struct svm_domain svm;
index 381d9f8048fc7a37d0cd183712533075d097bbbe..08bc23a0f0696fb0b1ee3ceb45603630de8de0a8 100644 (file)
@@ -32,7 +32,6 @@ int construct_dom0(
     module_t *initrd,
     void *(*bootstrap_map)(const module_t *),
     char *cmdline);
-void setup_io_bitmap(struct domain *d);
 
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);