WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] nestedhvm: Fix wrong memory size of neste

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] nestedhvm: Fix wrong memory size of nested shadow_io_bitmap
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Thu, 16 Jun 2011 11:12:07 +0100
Delivery-date: Thu, 16 Jun 2011 03:21:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1306846362 -3600
# Node ID 7ba15e5287df13b40f675cffc13f8f569339e1a3
# Parent  d7c755c25bb9d6ed77d64cb6736b6c4f339db1bf
nestedhvm: Fix wrong memory size of nested shadow_io_bitmap
Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>

While there, simplify and tidy the code.
Signed-off-by: Keir Fraser <keir@xxxxxxx>
---


diff -r d7c755c25bb9 -r 7ba15e5287df xen/arch/x86/hvm/nestedhvm.c
--- a/xen/arch/x86/hvm/nestedhvm.c      Sat May 28 08:58:08 2011 +0100
+++ b/xen/arch/x86/hvm/nestedhvm.c      Tue May 31 13:52:42 2011 +0100
@@ -153,16 +153,16 @@
  * iomap[2]      set        set
  */
 
-/* same format and size as hvm_io_bitmap */
-#define IOBITMAP_SIZE          3*PAGE_SIZE/BYTES_PER_LONG
-/* same format as hvm_io_bitmap */
-#define IOBITMAP_VMX_SIZE      2*PAGE_SIZE/BYTES_PER_LONG
-
 static unsigned long *shadow_io_bitmap[3];
 
 void
 nestedhvm_setup(void)
 {
+    /* Same format and size as hvm_io_bitmap (Intel needs only 2 pages). */
+    unsigned int sz = (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
+        ? 2*PAGE_SIZE : 3*PAGE_SIZE;
+    unsigned int i;
+
     /* shadow_io_bitmaps can't be declared static because
      *   they must fulfill hw requirements (page aligned section)
      *   and doing so triggers the ASSERT(va >= XEN_VIRT_START)
@@ -173,23 +173,10 @@
      * it is valid to use _xmalloc()
      */
 
-    /* shadow I/O permission bitmaps */
-    if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) {
-        /* Same format as hvm_io_bitmap */
-        shadow_io_bitmap[0] = _xmalloc(IOBITMAP_VMX_SIZE, PAGE_SIZE);
-        shadow_io_bitmap[1] = _xmalloc(IOBITMAP_VMX_SIZE, PAGE_SIZE);
-        shadow_io_bitmap[2] = _xmalloc(IOBITMAP_VMX_SIZE, PAGE_SIZE);
-        memset(shadow_io_bitmap[0], ~0U, IOBITMAP_VMX_SIZE);
-        memset(shadow_io_bitmap[1], ~0U, IOBITMAP_VMX_SIZE);
-        memset(shadow_io_bitmap[2], ~0U, IOBITMAP_VMX_SIZE);
-    } else {
-        /* Same size and format as hvm_io_bitmap */
-        shadow_io_bitmap[0] = _xmalloc(IOBITMAP_SIZE, PAGE_SIZE);
-        shadow_io_bitmap[1] = _xmalloc(IOBITMAP_SIZE, PAGE_SIZE);
-        shadow_io_bitmap[2] = _xmalloc(IOBITMAP_SIZE, PAGE_SIZE);
-        memset(shadow_io_bitmap[0], ~0U, IOBITMAP_SIZE);
-        memset(shadow_io_bitmap[1], ~0U, IOBITMAP_SIZE);
-        memset(shadow_io_bitmap[2], ~0U, IOBITMAP_SIZE);
+    for ( i = 0; i < ARRAY_SIZE(shadow_io_bitmap); i++ )
+    {
+        shadow_io_bitmap[i] = _xmalloc(sz, PAGE_SIZE);
+        memset(shadow_io_bitmap[i], ~0U, sz);
     }
 
     __clear_bit(0x80, shadow_io_bitmap[0]);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] nestedhvm: Fix wrong memory size of nested shadow_io_bitmap, Xen patchbot-unstable <=