public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] qemu: IDE/ATAPI emulation fixes
@ 2007-12-19 17:48 Carlo Marcelo Arenas Belon
  2007-12-19 17:55 ` [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access Carlo Marcelo Arenas Belon
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-12-19 17:48 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

The following patch series implements fixes to the IDE/ATAPI emulation
in qemu which affects access to the CD-ROM device preventing installation
of OpenSolaris guests because of an incorrect implementation of the MMC6
GET_CONFIGURATION command when it was extended to also support a DVD-ROM
profile.

  Patch 1/2 : fixes GET_CONFIGURATION to allow OpenSolaris CD-ROM access
  Patch 2/2 : uses DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE

They had been tested in Gentoo Linux 2007.0 amd64 using an Intel Core 2
6320 host and several different versions of Linux, FreeBSD, OpenBSD, NetBSD,
DragonFlyBSD, OpenSolaris and Windows 2000 guests and to match exact
responses when compared with real SATA and ATAPI DVD-ROM hardware.

This is a partial RESEND as the original version of patch 2 will conflict
with the recently merged qemu due to changes on the type signedness of some
variables to avoid warnings when building with gcc4.

Carlo

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access
  2007-12-19 17:48 [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Carlo Marcelo Arenas Belon
@ 2007-12-19 17:55 ` Carlo Marcelo Arenas Belon
  2007-12-19 17:58 ` [PATCH 2/2] use DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE Carlo Marcelo Arenas Belon
  2007-12-19 19:49 ` [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Avi Kivity
  2 siblings, 0 replies; 4+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-12-19 17:55 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

This patch complements "Partial IDE DVD emulation" (revision 1.66 for ide.c
in qemu's cvs) that is generating the following timeouts for OpenSolaris
guests when trying to access the ATAPI cdrom (ex: during installation):

  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1);
          timeout: abort request, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: abort device, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: reset target, target=0 lun=0
  WARNING: /pci@0,0/pci-ide@1,1/ide@1 (ata1):
          timeout: reset bus, target=0 lun=0

The changes required to the "GET CONFIGURATION" implementation are :

* recognize and honor "Allocation Length" input parameter
* only set "current profile" for the response if a profile is current
  (either CD or DVD loaded)
* calculate "data length" including all headers
* refactor code and add comments to help document references to all
  implemented standards (ATAPI-4, SPC-3 and MMC-6)

Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
---
 qemu/hw/ide.c |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 18431e7..3289964 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -1636,6 +1636,7 @@ static void ide_atapi_cmd(IDEState *s)
         break;
     case GPCMD_GET_CONFIGURATION:
         {
+            uint32_t len;
             int64_t total_sectors;
 
             /* only feature 0 is supported */
@@ -1644,17 +1645,27 @@ static void ide_atapi_cmd(IDEState *s)
                                     ASC_INV_FIELD_IN_CMD_PACKET);
                 break;
             }
-            memset(buf, 0, 32);
+            max_len = ube16_to_cpu(packet + 7);
             bdrv_get_geometry(s->bs, &total_sectors);
-            buf[3] = 16;
-            buf[7] = total_sectors <= 1433600 ? 0x08 : 0x10; /* current profile */
-            buf[10] = 0x10 | 0x1;
-            buf[11] = 0x08; /* size of profile list */
+            memset(buf, 0, 32);
+            if (total_sectors) {
+                if (total_sectors > 1433600) {
+                    buf[7] = 0x10; /* DVD-ROM */
+                } else {
+                    buf[7] = 0x08; /* CD-ROM */
+                }
+            } else {
+                buf[7] = 0x00; /* no current profile */
+            }
+            buf[10] = 0x02 | 0x01; /* persistent and current */
+            buf[11] = 0x08; /* size of profile list = 4 bytes per profile */
             buf[13] = 0x10; /* DVD-ROM profile */
-            buf[14] = buf[7] == 0x10; /* (in)active */
+            buf[14] = buf[13] == buf[7]; /* (in)active */
             buf[17] = 0x08; /* CD-ROM profile */
-            buf[18] = buf[7] == 0x08; /* (in)active */
-            ide_atapi_cmd_reply(s, 32, 32);
+            buf[18] = buf[17] == buf[7]; /* (in)active */
+            len = 8 + 4 + buf[11]; /* headers + size of profile list */
+            cpu_to_ube32(buf, len - 4); /* data length */
+            ide_atapi_cmd_reply(s, len, max_len);
             break;
         }
     default:
-- 
1.5.2.5


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* [PATCH 2/2] use DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE
  2007-12-19 17:48 [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Carlo Marcelo Arenas Belon
  2007-12-19 17:55 ` [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access Carlo Marcelo Arenas Belon
@ 2007-12-19 17:58 ` Carlo Marcelo Arenas Belon
  2007-12-19 19:49 ` [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Avi Kivity
  2 siblings, 0 replies; 4+ messages in thread
From: Carlo Marcelo Arenas Belon @ 2007-12-19 17:58 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

The following patch report model as DVD-ROM for INQUIRY and IDENTIFY DEVICE
commands instead of CD-ROM to reflect that the device is now able to support
DVDs

Signed-off-by: Carlo Marcelo Arenas Belon <carenas-kLeDWSohozoJb6fo7hG9ng@public.gmane.org>
---
 qemu/hw/ide.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/ide.c b/qemu/hw/ide.c
index 3289964..bd579f8 100644
--- a/qemu/hw/ide.c
+++ b/qemu/hw/ide.c
@@ -541,7 +541,7 @@ static void ide_atapi_identify(IDEState *s)
     put_le16(p + 21, 512); /* cache size in sectors */
     put_le16(p + 22, 4); /* ecc bytes */
     padstr((char *)(p + 23), QEMU_VERSION, 8); /* firmware version */
-    padstr((char *)(p + 27), "QEMU CD-ROM", 40); /* model */
+    padstr((char *)(p + 27), "QEMU DVD-ROM", 40); /* model */
     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
 #ifdef USE_DMA_CDROM
     put_le16(p + 49, 1 << 9 | 1 << 8); /* DMA and LBA supported */
@@ -1630,7 +1630,7 @@ static void ide_atapi_cmd(IDEState *s)
         buf[6] = 0; /* reserved */
         buf[7] = 0; /* reserved */
         padstr8(buf + 8, 8, "QEMU");
-        padstr8(buf + 16, 16, "QEMU CD-ROM");
+        padstr8(buf + 16, 16, "QEMU DVD-ROM");
         padstr8(buf + 32, 4, QEMU_VERSION);
         ide_atapi_cmd_reply(s, 36, max_len);
         break;
-- 
1.5.2.5


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

* Re: [PATCH 0/2] qemu: IDE/ATAPI emulation fixes
  2007-12-19 17:48 [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Carlo Marcelo Arenas Belon
  2007-12-19 17:55 ` [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access Carlo Marcelo Arenas Belon
  2007-12-19 17:58 ` [PATCH 2/2] use DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE Carlo Marcelo Arenas Belon
@ 2007-12-19 19:49 ` Avi Kivity
  2 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2007-12-19 19:49 UTC (permalink / raw)
  To: Carlo Marcelo Arenas Belon; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Carlo Marcelo Arenas Belon wrote:
> The following patch series implements fixes to the IDE/ATAPI emulation
> in qemu which affects access to the CD-ROM device preventing installation
> of OpenSolaris guests because of an incorrect implementation of the MMC6
> GET_CONFIGURATION command when it was extended to also support a DVD-ROM
> profile.
>
>   Patch 1/2 : fixes GET_CONFIGURATION to allow OpenSolaris CD-ROM access
>   Patch 2/2 : uses DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE
>
> They had been tested in Gentoo Linux 2007.0 amd64 using an Intel Core 2
> 6320 host and several different versions of Linux, FreeBSD, OpenBSD, NetBSD,
> DragonFlyBSD, OpenSolaris and Windows 2000 guests and to match exact
> responses when compared with real SATA and ATAPI DVD-ROM hardware.
>
>   

Applied, thanks.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

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

end of thread, other threads:[~2007-12-19 19:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-19 17:48 [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Carlo Marcelo Arenas Belon
2007-12-19 17:55 ` [PATCH 1/2] GET_CONFIGURATION fixes to allow OpenSolaris CD-ROM access Carlo Marcelo Arenas Belon
2007-12-19 17:58 ` [PATCH 2/2] use DVD-ROM as model name for INQUIRY and IDENTIFY DEVICE Carlo Marcelo Arenas Belon
2007-12-19 19:49 ` [PATCH 0/2] qemu: IDE/ATAPI emulation fixes Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox