xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition
@ 2010-08-05  3:16 DuanZhenzhong
  2010-08-05  8:16 ` Keir Fraser
  0 siblings, 1 reply; 2+ messages in thread
From: DuanZhenzhong @ 2010-08-05  3:16 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 404 bytes --]

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@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>

[-- Attachment #2: ovs-fix-p2v-chs-issue.patch --]
[-- Type: text/x-patch, Size: 2417 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-05  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-05  3:16 [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition DuanZhenzhong
2010-08-05  8:16 ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).