From: DuanZhenzhong <zhenzhong.duan@oracle.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition
Date: Thu, 05 Aug 2010 11:16:48 +0800 [thread overview]
Message-ID: <4C5A2D20.10703@oracle.com> (raw)
[-- 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
next reply other threads:[~2010-08-05 3:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-05 3:16 DuanZhenzhong [this message]
2010-08-05 8:16 ` [PATCH 1/1] Fix qemu could not boot windows vm which converted from phy-partition Keir Fraser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C5A2D20.10703@oracle.com \
--to=zhenzhong.duan@oracle.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.