* [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties
@ 2010-01-14 13:44 Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 1/3] ide: device version property Gerd Hoffmann
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-01-14 13:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
This patch series makes the version reported by ide and scsi drives
configurable using qdev properties. Should help keeping the virtual
hardware more constant on qemu updates, so it becomes less likely
that Windows wants be re-activated.
Maybe 0.12 candidate?
cheers,
Gerd
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 1/3] ide: device version property
2010-01-14 13:44 [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Gerd Hoffmann
@ 2010-01-14 13:44 ` Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 2/3] scsi: " Gerd Hoffmann
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-01-14 13:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch adds a new property named 'ver' to ide-drive which allows to
specify the version which the virtual disk/cdrom should report to the
guest. By default this is the qemu version (i.e. 0.12). usage:
-drive if=none,id=disk,file=...
-device ide-drive,bus=ide.0,unit=0,drive=disk,ver=42
You can also switch the version for all ide drives using:
-global ide-drive.ver=42
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/ide/core.c | 19 ++++++++++++-------
hw/ide/internal.h | 4 +++-
hw/ide/qdev.c | 3 ++-
3 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 76c3820..b6643e8 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -115,7 +115,7 @@ static void ide_identify(IDEState *s)
put_le16(p + 20, 3); /* XXX: retired, remove ? */
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 + 23), s->version, 8); /* firmware version */
padstr((char *)(p + 27), "QEMU HARDDISK", 40); /* model */
#if MAX_MULT_SECTORS > 1
put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
@@ -186,7 +186,7 @@ static void ide_atapi_identify(IDEState *s)
put_le16(p + 20, 3); /* buffer type */
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 + 23), s->version, 8); /* firmware version */
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
@@ -238,7 +238,7 @@ static void ide_cfata_identify(IDEState *s)
put_le16(p + 8, s->nb_sectors); /* Sectors per card */
padstr((char *)(p + 10), s->drive_serial_str, 20); /* serial number */
put_le16(p + 22, 0x0004); /* ECC bytes */
- padstr((char *) (p + 23), QEMU_VERSION, 8); /* Firmware Revision */
+ padstr((char *) (p + 23), s->version, 8); /* Firmware Revision */
padstr((char *) (p + 27), "QEMU MICRODRIVE", 40);/* Model number */
#if MAX_MULT_SECTORS > 1
put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
@@ -1591,7 +1591,7 @@ static void ide_atapi_cmd(IDEState *s)
buf[7] = 0; /* reserved */
padstr8(buf + 8, 8, "QEMU");
padstr8(buf + 16, 16, "QEMU DVD-ROM");
- padstr8(buf + 32, 4, QEMU_VERSION);
+ padstr8(buf + 32, 4, s->version);
ide_atapi_cmd_reply(s, 36, max_len);
break;
case GPCMD_GET_CONFIGURATION:
@@ -2590,7 +2590,7 @@ void ide_bus_reset(IDEBus *bus)
ide_clear_hob(bus);
}
-void ide_init_drive(IDEState *s, DriveInfo *dinfo)
+void ide_init_drive(IDEState *s, DriveInfo *dinfo, const char *version)
{
int cylinders, heads, secs;
uint64_t nb_sectors;
@@ -2619,6 +2619,11 @@ void ide_init_drive(IDEState *s, DriveInfo *dinfo)
if (strlen(s->drive_serial_str) == 0)
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
"QM%05d", s->drive_serial);
+ if (version) {
+ pstrcpy(s->version, sizeof(s->version), version);
+ } else {
+ pstrcpy(s->version, sizeof(s->version), QEMU_VERSION);
+ }
ide_reset(s);
}
@@ -2639,9 +2644,9 @@ void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1,
s->sector_write_timer = qemu_new_timer(vm_clock,
ide_sector_write_timer_cb, s);
if (i == 0)
- ide_init_drive(s, hd0);
+ ide_init_drive(s, hd0, NULL);
if (i == 1)
- ide_init_drive(s, hd1);
+ ide_init_drive(s, hd1, NULL);
}
bus->irq = irq;
}
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index eb5b404..1cc4b55 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -397,6 +397,7 @@ struct IDEState {
/* set for lba48 access */
uint8_t lba48;
BlockDriverState *bs;
+ char version[9];
/* ATAPI specific */
uint8_t sense_key;
uint8_t asc;
@@ -449,6 +450,7 @@ struct IDEDevice {
DeviceState qdev;
uint32_t unit;
DriveInfo *dinfo;
+ char *version;
};
typedef int (*ide_qdev_initfn)(IDEDevice *dev);
@@ -549,7 +551,7 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr);
void ide_data_writel(void *opaque, uint32_t addr, uint32_t val);
uint32_t ide_data_readl(void *opaque, uint32_t addr);
-void ide_init_drive(IDEState *s, DriveInfo *dinfo);
+void ide_init_drive(IDEState *s, DriveInfo *dinfo, const char *version);
void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1,
qemu_irq irq);
void ide_init_ioport(IDEBus *bus, int iobase, int iobase2);
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 81e7995..0b84a4f 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -99,7 +99,7 @@ typedef struct IDEDrive {
static int ide_drive_initfn(IDEDevice *dev)
{
IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
- ide_init_drive(bus->ifs + dev->unit, dev->dinfo);
+ ide_init_drive(bus->ifs + dev->unit, dev->dinfo, dev->version);
return 0;
}
@@ -110,6 +110,7 @@ static IDEDeviceInfo ide_drive_info = {
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1),
DEFINE_PROP_DRIVE("drive", IDEDrive, dev.dinfo),
+ DEFINE_PROP_STRING("ver", IDEDrive, dev.version),
DEFINE_PROP_END_OF_LIST(),
}
};
--
1.6.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 2/3] scsi: device version property
2010-01-14 13:44 [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 1/3] ide: device version property Gerd Hoffmann
@ 2010-01-14 13:44 ` Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 3/3] pc: add driver version compat properties Gerd Hoffmann
2010-01-14 14:31 ` [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Anthony Liguori
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-01-14 13:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch adds a new property named 'ver' to scsi-disk which allows to
specify the version which the virtual disk/cdrom should report to the
guest. By default this is the qemu version (i.e. 0.12). usage:
-drive if=none,id=disk,file=...
-device lsi
-device scsi-disk,drive=disk,bus=scsi.0,unit=0,ver=42
You can also switch the version for all scsi drives using:
-global scsi-disk.ver=42
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/scsi-disk.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index eb5b5a8..e3924de 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -65,6 +65,7 @@ struct SCSIDiskState
int cluster_size;
uint64_t max_lba;
QEMUBH *bh;
+ char *version;
};
static SCSIDiskReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun)
@@ -315,6 +316,7 @@ static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
{
BlockDriverState *bdrv = req->dev->dinfo->bdrv;
+ SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
int buflen = 0;
if (req->cmd.buf[1] & 0x2) {
@@ -432,7 +434,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
memcpy(&outbuf[16], "QEMU HARDDISK ", 16);
}
memcpy(&outbuf[8], "QEMU ", 8);
- memcpy(&outbuf[32], QEMU_VERSION, 4);
+ memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4);
/* Identify device as SCSI-3 rev 1.
Some later commands are also implemented. */
outbuf[2] = 3;
@@ -1029,6 +1031,7 @@ static SCSIDeviceInfo scsi_disk_info = {
.get_buf = scsi_get_buf,
.qdev.props = (Property[]) {
DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.dinfo),
+ DEFINE_PROP_STRING("ver", SCSIDiskState, version),
DEFINE_PROP_END_OF_LIST(),
},
};
--
1.6.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH 3/3] pc: add driver version compat properties
2010-01-14 13:44 [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 1/3] ide: device version property Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 2/3] scsi: " Gerd Hoffmann
@ 2010-01-14 13:44 ` Gerd Hoffmann
2010-01-14 14:31 ` [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Anthony Liguori
3 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-01-14 13:44 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch adds compat property entries for ide-disk.ver and
scsi-disk.ver to pc-0.10 and pc-0.11. With this patch applied
the scsi and ide disks report "0.10" and "0.11" as version when
you start qemu with "-M pc-0.10" or "-M pc-0.11".
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pc.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index a93c5f2..2548c14 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1083,6 +1083,14 @@ static QEMUMachine pc_machine_v0_11 = {
.property = "vectors",
.value = stringify(0),
},{
+ .driver = "ide-drive",
+ .property = "ver",
+ .value = "0.11",
+ },{
+ .driver = "scsi-disk",
+ .property = "ver",
+ .value = "0.11",
+ },{
.driver = "PCI",
.property = "rombar",
.value = stringify(0),
@@ -1114,6 +1122,14 @@ static QEMUMachine pc_machine_v0_10 = {
.property = "vectors",
.value = stringify(0),
},{
+ .driver = "ide-drive",
+ .property = "ver",
+ .value = "0.10",
+ },{
+ .driver = "scsi-disk",
+ .property = "ver",
+ .value = "0.10",
+ },{
.driver = "PCI",
.property = "rombar",
.value = stringify(0),
--
1.6.5.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties
2010-01-14 13:44 [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Gerd Hoffmann
` (2 preceding siblings ...)
2010-01-14 13:44 ` [Qemu-devel] [PATCH 3/3] pc: add driver version compat properties Gerd Hoffmann
@ 2010-01-14 14:31 ` Anthony Liguori
2010-01-14 14:34 ` Gerd Hoffmann
3 siblings, 1 reply; 6+ messages in thread
From: Anthony Liguori @ 2010-01-14 14:31 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 01/14/2010 07:44 AM, Gerd Hoffmann wrote:
> Hi,
>
> This patch series makes the version reported by ide and scsi drives
> configurable using qdev properties. Should help keeping the virtual
> hardware more constant on qemu updates, so it becomes less likely
> that Windows wants be re-activated.
>
> Maybe 0.12 candidate?
>
Definitely, but is there really three patches? I only see two.
Regards,
Anthony Liguori
> cheers,
> Gerd
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties
2010-01-14 14:31 ` [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Anthony Liguori
@ 2010-01-14 14:34 ` Gerd Hoffmann
0 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2010-01-14 14:34 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
On 01/14/10 15:31, Anthony Liguori wrote:
> On 01/14/2010 07:44 AM, Gerd Hoffmann wrote:
>> Hi,
>>
>> This patch series makes the version reported by ide and scsi drives
>> configurable using qdev properties. Should help keeping the virtual
>> hardware more constant on qemu updates, so it becomes less likely
>> that Windows wants be re-activated.
>>
>> Maybe 0.12 candidate?
>
> Definitely, but is there really three patches? I only see two.
Yes. I've got only 1+2 back via qemu-devel so far, guess the list is a
bit slow today.
cheers,
Gerd
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-14 14:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14 13:44 [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 1/3] ide: device version property Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 2/3] scsi: " Gerd Hoffmann
2010-01-14 13:44 ` [Qemu-devel] [PATCH 3/3] pc: add driver version compat properties Gerd Hoffmann
2010-01-14 14:31 ` [Qemu-devel] [PATCH 0/3] add disk/cdrom version properties Anthony Liguori
2010-01-14 14:34 ` Gerd Hoffmann
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).