* [PATCH 0/2] Fix could not boot vm image which converted from phy-partition
@ 2010-08-05 23:35 Joe Jin
2010-08-05 23:41 ` [PATCH 1/2] QEMU: Don't set all to default C/H/S when vm heads>16 Joe Jin
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Joe Jin @ 2010-08-05 23:35 UTC (permalink / raw)
To: Ian Jackson, Keir Fraser, Zhenzhong Duan
Cc: haobo.zhou, greg.marsden, joe.jin, xen-devel
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.
Thanks,
Joe
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] QEMU: Don't set all to default C/H/S when vm heads>16
2010-08-05 23:35 [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Joe Jin
@ 2010-08-05 23:41 ` Joe Jin
2010-08-05 23:49 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu Joe Jin
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Joe Jin @ 2010-08-05 23:41 UTC (permalink / raw)
To: Ian Jackson, Keir Fraser, Zhenzhong Duan
Cc: haobo.zhou, greg.marsden, joe.jin, xen-devel
Hi,
Current qemu set all C/H/S to default(16383/16/63), when image file converted
from physical scsi/raid disk, use default will cause failed to boot the VM.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
---
block.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 05ff8cb..519f955 100644
--- a/block.c
+++ b/block.c
@@ -890,7 +890,15 @@ void bdrv_guess_geometry(BlockDriverState *bs, int *pcyls, int *pheads, int *pse
*psecs = secs;
} else {
if (guess_disk_lchs(bs, &cylinders, &heads, &secs) == 0) {
- if (heads > 16) {
+ if(secs == 32){
+ /* if image file convert from physical disk to and
+ physical partition on scsi, sector = 32, if set
+ it to default will failed to boot up it */
+ *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 */
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu
2010-08-05 23:35 [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Joe Jin
2010-08-05 23:41 ` [PATCH 1/2] QEMU: Don't set all to default C/H/S when vm heads>16 Joe Jin
@ 2010-08-05 23:49 ` Joe Jin
2010-08-10 15:50 ` [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Ian Jackson
2010-10-25 5:53 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu DuanZhenzhong
3 siblings, 0 replies; 7+ messages in thread
From: Joe Jin @ 2010-08-05 23:49 UTC (permalink / raw)
To: Ian Jackson, Keir Fraser, Zhenzhong Duan
Cc: haobo.zhou, greg.marsden, joe.jin, xen-devel
Hi,
hvmloader->rombios use C/H/S, LBA when have been set by qemu.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Signed-off-by: Joe Jin <joe.jin@oracle.com>
---
rombios.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff -r 3263d0ff9476 tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c Thu Jul 29 16:53:40 2010 +0100
+++ b/tools/firmware/rombios/rombios.c Fri Aug 06 07:09:45 2010 +0800
@@ -2738,8 +2738,7 @@
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;
@@ -5440,6 +5439,7 @@
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);
@@ -5509,9 +5509,10 @@
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Fix could not boot vm image which converted from phy-partition
2010-08-05 23:35 [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Joe Jin
2010-08-05 23:41 ` [PATCH 1/2] QEMU: Don't set all to default C/H/S when vm heads>16 Joe Jin
2010-08-05 23:49 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu Joe Jin
@ 2010-08-10 15:50 ` Ian Jackson
2010-08-11 8:00 ` Joe Jin
2010-10-25 5:53 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu DuanZhenzhong
3 siblings, 1 reply; 7+ messages in thread
From: Ian Jackson @ 2010-08-10 15:50 UTC (permalink / raw)
To: Joe Jin; +Cc: xen-devel, haobo.zhou, Keir Fraser, greg.marsden
Joe Jin writes ("[Xen-devel] [PATCH 0/2] Fix could not boot vm image which converted from phy-partition"):
> 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.
Thanks for this, but I'm afraid I'm kind of missing the background
here. I'm not very familiar with how the CHS-guessing works. Perhaps
you could explain ?
Also, have you looked at upstream qemu to see what is done there ?
We're currently working on a merge of qemu-dm back into upstream qemu
and if possible we'd like to avoid adding more interface
incompatibilities.
Ian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] Fix could not boot vm image which converted from phy-partition
2010-08-10 15:50 ` [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Ian Jackson
@ 2010-08-11 8:00 ` Joe Jin
0 siblings, 0 replies; 7+ messages in thread
From: Joe Jin @ 2010-08-11 8:00 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel, haobo.zhou, Joe Jin, greg.marsden, Keir Fraser
On 2010-08-10 16:50, Ian Jackson wrote:
> Joe Jin writes ("[Xen-devel] [PATCH 0/2] Fix could not boot vm image which converted from phy-partition"):
> > 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.
>
> Thanks for this, but I'm afraid I'm kind of missing the background
> here. I'm not very familiar with how the CHS-guessing works. Perhaps
> you could explain ?
The background is we dd physical MS-Windows partition, physical disk based
on RAID controller, we tried to boot it but failed with "Error Loading
Operation System".
The error message reported by rombios for it could not find the first
sector. qemu calculated CHS by read MBR(the first 512 bytes) of image file,
when H(eads)>16, qemu set it to default value heads(16). in fact disk on
RAID heads is 32, this made qemu pass incorrect offset of image file to
rombios, then rombios failed to find the boot loader.
>
> Also, have you looked at upstream qemu to see what is done there ?
> We're currently working on a merge of qemu-dm back into upstream qemu
> and if possible we'd like to avoid adding more interface
> incompatibilities.
I did not check qemu codes but we have tried to boot up the image file
by qemu, same error, we did not applied the patch to qemu.
Thanks,
Joe
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu
2010-08-05 23:35 [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Joe Jin
` (2 preceding siblings ...)
2010-08-10 15:50 ` [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Ian Jackson
@ 2010-10-25 5:53 ` DuanZhenzhong
2010-10-26 16:23 ` Ian Jackson
3 siblings, 1 reply; 7+ messages in thread
From: DuanZhenzhong @ 2010-10-25 5:53 UTC (permalink / raw)
To: xen-devel; +Cc: joe.jin
Hi,
Multiple guests rebooting, across multiple OVS nodes. Not all guest at
the same time.
Error in /var/log/xend.log taking the form:
...
[2010-09-06 12:19:55 8816] WARNING (image:490) domain 234_sscgrantsd:
device model failure: pid 16657: died due to signal 11; see
...
This is due to some ide state pointer in ide.c is NULL.
Patch from carnold@novell.com fixed this problem.
After applying, our system get steady.
--- xen-3.4.0.old/qemu-xen.git/hw/ide.c 2010-10-19 10:45:23.000000000 +0800
+++ xen-3.4.0/qemu-xen.git/hw/ide.c 2010-10-19 10:52:57.000000000 +0800
@@ -934,8 +934,9 @@ static inline void ide_dma_submit_check(
static inline void ide_set_irq(IDEState *s)
{
- BMDMAState *bm = s->bmdma;
- if (!s->bs) return; /* ouch! (see ide_flush_cb) */
+ BMDMAState *bm;
+ if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
+ bm = s->bmdma;
if (!(s->cmd & IDE_CMD_DISABLE_IRQ)) {
if (bm) {
bm->status |= BM_STATUS_INT;
@@ -1223,14 +1224,14 @@ static void ide_read_dma_cb(void *opaque
int n;
int64_t sector_num;
+ if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
+
if (ret < 0) {
dma_buf_commit(s, 1);
ide_dma_error(s);
return;
}
- if (!s->bs) return; /* ouch! (see ide_flush_cb) */
-
n = s->io_buffer_size >> 9;
sector_num = ide_get_sector(s);
if (n > 0) {
@@ -1334,6 +1335,8 @@ static void ide_write_flush_cb(void *opa
BMDMAState *bm = opaque;
IDEState *s = bm->ide_if;
+ if (!s) return;
+
if (ret != 0) {
ide_dma_error(s);
return;
@@ -1365,6 +1368,8 @@ static void ide_write_dma_cb(void *opaqu
int n;
int64_t sector_num;
+ if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
+
if (ret < 0) {
if (ide_handle_write_error(s, -ret, BM_STATUS_DMA_RETRY))
return;
@@ -1375,8 +1380,6 @@ static void ide_write_dma_cb(void *opaqu
return; /* ouch2 */
}
- if (!s->bs) return; /* ouch! (see ide_flush_cb) */
-
n = s->io_buffer_size >> 9;
sector_num = ide_get_sector(s);
if (n > 0) {
@@ -1433,7 +1436,7 @@ static void ide_flush_cb(void *opaque, i
{
IDEState *s = opaque;
- if (!s->bs) return; /* ouch! (see below) */
+ if (!s || !s->bs) return; /* ouch! (see below) */
if (ret) {
/* We are completely doomed. The IDE spec does not permit us
@@ -1690,7 +1693,7 @@ static void ide_atapi_cmd_read_dma_cb(vo
IDEState *s = bm->ide_if;
int data_offset, n;
- if (!s->bs) return; /* ouch! (see ide_flush_cb) */
+ if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
if (ret < 0) {
ide_atapi_io_error(s, ret);
@@ -2368,7 +2371,7 @@ static void cdrom_change_cb(void *opaque
IDEState *s = opaque;
uint64_t nb_sectors;
- if (!s->bs) return; /* ouch! (see ide_flush_cb) */
+ if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
bdrv_get_geometry(s->bs, &nb_sectors);
s->nb_sectors = nb_sectors;
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu
2010-10-25 5:53 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu DuanZhenzhong
@ 2010-10-26 16:23 ` Ian Jackson
0 siblings, 0 replies; 7+ messages in thread
From: Ian Jackson @ 2010-10-26 16:23 UTC (permalink / raw)
To: DuanZhenzhong; +Cc: xen-devel, joe.jin
DuanZhenzhong writes ("[Xen-devel] [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu"):
> This is due to some ide state pointer in ide.c is NULL.
How did the pointer become null ? I think the bug has happened
earlier and that your patch is therefore not correct.
For example,
> static inline void ide_set_irq(IDEState *s)
> {
> - BMDMAState *bm = s->bmdma;
> - if (!s->bs) return; /* ouch! (see ide_flush_cb) */
> + BMDMAState *bm;
> + if (!s || !s->bs) return; /* ouch! (see ide_flush_cb) */
I think it is always wrong to call ide_set_irq(NULL).
Ian.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-10-26 16:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-05 23:35 [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Joe Jin
2010-08-05 23:41 ` [PATCH 1/2] QEMU: Don't set all to default C/H/S when vm heads>16 Joe Jin
2010-08-05 23:49 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu Joe Jin
2010-08-10 15:50 ` [PATCH 0/2] Fix could not boot vm image which converted from phy-partition Ian Jackson
2010-08-11 8:00 ` Joe Jin
2010-10-25 5:53 ` [PATCH 2/2] hvmloader->rombios use C/H/S, LBA when have been set by qemu DuanZhenzhong
2010-10-26 16:23 ` Ian Jackson
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).