mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
hw/nvme: enforce common serial per subsystem
The Identify Controller Serial Number (SN) is the serial number for the NVM subsystem and must be the same across all controller in the NVM subsystem. Enforce this. Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Klaus Jensen <[email protected]>
This commit is contained in:
1 parent
9235a72a5d
commit
a859eb9f8f
2 files changed
+8
No files matched your search
@@ -48,6 +48,7 @@ typedef struct NvmeSubsystem {
|
||||
DeviceState parent_obj;
|
||||
NvmeBus bus;
|
||||
uint8_t subnqn[256];
|
||||
char *serial;
|
||||
|
||||
NvmeCtrl *ctrls[NVME_MAX_CONTROLLERS];
|
||||
NvmeNamespace *namespaces[NVME_MAX_NAMESPACES + 1];
|
||||
|
||||
@@ -27,6 +27,13 @@ int nvme_subsys_register_ctrl(NvmeCtrl *n, Error **errp)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!subsys->serial) {
|
||||
subsys->serial = g_strdup(n->params.serial);
|
||||
} else if (strcmp(subsys->serial, n->params.serial)) {
|
||||
error_setg(errp, "invalid controller serial");
|
||||
return -1;
|
||||
}
|
||||
|
||||
subsys->ctrls[cntlid] = n;
|
||||
|
||||
for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) {
|
||||
|
||||
Reference in new issue
Block a user