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-devel

[Xen-devel] [PATCH 1/1] Fix qemu could not boot windows vm which convert

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition
From: DuanZhenzhong <zhenzhong.duan@xxxxxxxxxx>
Date: Thu, 05 Aug 2010 11:16:48 +0800
Delivery-date: Wed, 04 Aug 2010 20:17:46 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Oracle Corporation
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.24 (X11/20100721)
Hi,

When booting up windows VM which converted by dd windows physical
partition,
it failed with "Error Loading Operating System", the partition build on
scsi/raid controller. The root cause is qemu and hvmloader could not
calaulated C/H/S correctly, then ntloader could not found the root
partition.

Signed-off-by: zhenzhong.duan <zhenzhong.duan@xxxxxxxxxx>
Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
diff -urNp xen-3.4.0/qemu-xen.git/block.c xen-3.4.0_lba/qemu-xen.git/block.c
--- xen-3.4.0/qemu-xen.git/block.c      2010-08-02 15:32:21.000000000 +0800
+++ xen-3.4.0_lba/qemu-xen.git/block.c  2010-08-02 13:37:56.000000000 +0800
@@ -884,7 +884,12 @@ void bdrv_guess_geometry(BlockDriverStat
         *psecs = secs;
     } else {
         if (guess_disk_lchs(bs, &cylinders, &heads, &secs) == 0) {
-            if (heads > 16) {
+            if(secs==32){
+                *pcyls = cylinders;
+                *pheads = heads;
+                *psecs = secs;
+                 bdrv_set_translation_hint(bs, BIOS_ATA_TRANSLATION_LBA);
+            } else if (heads > 16) {
                 /* if heads > 16, it means that a BIOS LBA
                    translation was active, so the default
                    hardware geometry is OK */
diff -urNp xen-3.4.0/tools/firmware/rombios/rombios.c 
xen-3.4.0_lba/tools/firmware/rombios/rombios.c
--- xen-3.4.0/tools/firmware/rombios/rombios.c  2009-05-19 02:20:46.000000000 
+0800
+++ xen-3.4.0_lba/tools/firmware/rombios/rombios.c      2010-08-02 
15:46:43.000000000 +0800
@@ -2740,8 +2740,7 @@ void ata_detect( )
         case ATA_TRANSLATION_NONE:
           break;
         case ATA_TRANSLATION_LBA:
-          spt = 63;
-          sectors_low /= 63;
+          sectors_low /= spt;
           heads = sectors_low / 1024;
           if (heads>128) heads = 255;
           else if (heads>64) heads = 128;
@@ -5442,6 +5441,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP,
   Bit16u npc, nph, npspt, nlc, nlh, nlspt;
   Bit16u size, count;
   Bit8u  device, status;
+  Bit8u  translation;
 
   BX_DEBUG_INT13_HD("int13_harddisk: AX=%04x BX=%04x CX=%04x DX=%04x 
ES=%04x\n", AX, BX, CX, DX, ES);
 
@@ -5512,8 +5512,10 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP,
       nph   = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.heads);
       npspt = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.spt);
 
+       translation = 
read_byte(ebda_seg,&EbdaData->ata.devices[device].translation);
+
       // if needed, translate lchs to lba, and execute command
-      if ( (nph != nlh) || (npspt != nlspt)) {
+      if ( (nph != nlh) || (npspt != nlspt) || (translation == 
(ATA_TRANSLATION_LBA))) {
         lba_low = ((((Bit32u)cylinder * (Bit32u)nlh) + (Bit32u)head) * 
(Bit32u)nlspt) + (Bit32u)sector - 1;
         lba_high = 0;
         sector = 0; // this forces the command to be lba
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>