Files
vfio-native/patches/qemu/02-disk-identity.patch

116 lines
4.7 KiB
Diff

Subject: [PATCH] disk-identity: VIRTUAL_DISK / DISK_SERIAL
Targets VMAware check: VIRTUAL_DISK / DISK_SERIAL
Storage that announces itself as emulated: 'QEMU HARDDISK', 'QEMU DVD-ROM',
empty serials and the QEMU vendor string in SCSI inquiry data.
Applies to QEMU v11.1.1. Apply from the source root with:
patch -p1 < 02-disk-identity.patch
---
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 1b0cce1..0e8ded4 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2551,7 +2551,7 @@ static void scsi_realize(SCSIDevice *dev, Error **errp)
s->version = g_strdup(QEMU_HW_VERSION);
}
if (!s->vendor) {
- s->vendor = g_strdup("QEMU");
+ s->vendor = g_strdup("ATA");
}
if (s->serial && strlen(s->serial) > MAX_SERIAL_LEN) {
error_setg(errp, "The serial number can't be longer than %d characters",
@@ -2615,7 +2615,7 @@ static void scsi_hd_realize(SCSIDevice *dev, Error **errp)
s->qdev.blocksize = s->qdev.conf.logical_block_size;
s->qdev.type = TYPE_DISK;
if (!s->product) {
- s->product = g_strdup("QEMU HARDDISK");
+ s->product = g_strdup("Samsung SSD 870 EVO 1TB");
}
scsi_realize(&s->qdev, errp);
}
@@ -2642,7 +2642,7 @@ static void scsi_cd_realize(SCSIDevice *dev, Error **errp)
s->qdev.type = TYPE_ROM;
s->features |= 1 << SCSI_DISK_F_REMOVABLE;
if (!s->product) {
- s->product = g_strdup("QEMU CD-ROM");
+ s->product = g_strdup("HL-DT-ST BD-RE WH16NS60");
}
scsi_realize(&s->qdev, errp);
}
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index deb43d5..36e4ebd 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -696,8 +696,8 @@ static bool scsi_target_emulate_inquiry(SCSITargetReq *r)
r->buf[3] = 2 | 0x10; /* HiSup, response data format */
r->buf[4] = r->len - 5; /* Additional Length = (Len - 1) - 4 */
r->buf[7] = 0x10 | (r->req.bus->info->tcq ? 0x02 : 0); /* Sync, TCQ. */
- memcpy(&r->buf[8], "QEMU ", 8);
- memcpy(&r->buf[16], "QEMU TARGET ", 16);
+ memcpy(&r->buf[8], "ATA ", 8);
+ memcpy(&r->buf[16], "ATA TARGET ", 16);
pstrcpy((char *) &r->buf[32], 4, QEMU_HW_VERSION);
}
return true;
diff --git a/hw/ide/core.c b/hw/ide/core.c
index fb9bf11..7f44de2 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2640,21 +2640,20 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp)
if (dev->serial) {
pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), dev->serial);
} else {
- snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
- "QM%05d", s->drive_serial);
+ pstrcpy(s->drive_serial_str, sizeof(s->drive_serial_str), "S0123456789ABCD"); /* placeholder; set <serial> on the disk instead */
}
if (dev->model) {
pstrcpy(s->drive_model_str, sizeof(s->drive_model_str), dev->model);
} else {
switch (kind) {
case IDE_CD:
- strcpy(s->drive_model_str, "QEMU DVD-ROM");
+ strcpy(s->drive_model_str, "HL-DT-ST BD-RE WH16NS60");
break;
case IDE_CFATA:
- strcpy(s->drive_model_str, "QEMU MICRODRIVE");
+ strcpy(s->drive_model_str, "Samsung SSD 870 EVO 1TB");
break;
default:
- strcpy(s->drive_model_str, "QEMU HARDDISK");
+ strcpy(s->drive_model_str, "Samsung SSD 870 EVO 1TB");
break;
}
}
diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 0ea149a..f012ad8 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -786,8 +786,8 @@ static void cmd_inquiry(IDEState *s, uint8_t *buf)
buf[5] = 0; /* reserved */
buf[6] = 0; /* reserved */
buf[7] = 0; /* reserved */
- padstr8(buf + 8, 8, "QEMU");
- padstr8(buf + 16, 16, "QEMU DVD-ROM");
+ padstr8(buf + 8, 8, "Samsung");
+ padstr8(buf + 16, 16, "DVD-ROM");
padstr8(buf + 32, 4, s->version);
idx = 36;
}
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 4893cf7..7d05b82 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -9268,7 +9268,7 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
id->vid = cpu_to_le16(pci_get_word(pci_conf + PCI_VENDOR_ID));
id->ssvid = cpu_to_le16(pci_get_word(pci_conf + PCI_SUBSYSTEM_VENDOR_ID));
strpadcpy((char *)id->mn, sizeof(id->mn),
- n->params.model ? n->params.model : "QEMU NVMe Ctrl", ' ');
+ n->params.model ? n->params.model : "NVMe Ctrl", ' ');
strpadcpy((char *)id->fr, sizeof(id->fr),
n->params.firmware_version ? n->params.firmware_version : QEMU_VERSION, ' ');
strpadcpy((char *)id->sn, sizeof(id->sn), n->params.serial, ' ');