qemu-spoof: storage extra identity (IDE WWN/rotation + NVMe EUI64/NGUID) Complements 0017 (model/serial/fw). When a spoof-seed is set and these are unset: - IDE: a NAA-5 World Wide Name (brand OUI) and the ATA nominal rotation rate (1 = SSD, else RPM matching the spoofed model) -- QEMU leaves both at 0/absent. - NVMe: a real-OUI EUI-64 and a 16-byte NGUID -- QEMU advertises none unless asked, itself a tell. Inert unless a spoof-seed is set. (ide/core.c spoof.h include is added by 0017; ns.c adds it here.) diff --git a/hw/ide/core.c b/hw/ide/core.c index 7a15d6c..6dcd4f9 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -2617,6 +2617,14 @@ int ide_init_drive(IDEState *s, IDEDevice *dev, IDEDriveKind kind, Error **errp) s->chs_trans = dev->chs_trans; s->nb_sectors = nb_sectors; s->wwn = dev->wwn; + if (spoof_enabled()) { /* qemu-spoof: NAA WWN + rotation rate */ + if (!s->wwn) { + s->wwn = spoof_disk_wwn(0); + } + if (kind != IDE_CD && dev->rotation_rate == 0) { + dev->rotation_rate = spoof_disk_rotation(0); + } + } /* The SMART values should be preserved across power cycles but they aren't. */ s->smart_enabled = 1; diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c index b0106ea..723216b 100644 --- a/hw/nvme/ns.c +++ b/hw/nvme/ns.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "hw/misc/spoof.h" #include "qemu/units.h" #include "qemu/cutils.h" #include "qemu/error-report.h" @@ -91,6 +92,22 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp) if (!ns->params.eui64 && ns->params.eui64_default) { ns->params.eui64 = ns_count + NVME_EUI64_DEFAULT; } + if (spoof_enabled()) { /* qemu-spoof: real OUI EUI-64 + NGUID identifiers */ + int zi; + bool nguid_zero = true; + if (!ns->params.eui64) { + ns->params.eui64 = spoof_nvme_eui64(0); + } + for (zi = 0; zi < 16; zi++) { + if (ns->params.nguid.data[zi]) { + nguid_zero = false; + break; + } + } + if (nguid_zero) { + spoof_nvme_nguid(ns->params.nguid.data); + } + } /* simple copy */ id_ns->mssrl = cpu_to_le16(ns->params.mssrl);