mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 01:03:55 -06:00
hw/nvme: add support for the lbafee hbs feature
Add support for up to 64 LBA formats through the LBAFEE field of the Host Behavior Support feature. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Naveen Nagar <naveen.n1@samsung.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
a6de6ed509
commit
763c05dfb0
4 changed files with 47 additions and 12 deletions
17
hw/nvme/ns.c
17
hw/nvme/ns.c
|
@ -112,10 +112,11 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
|
|||
[7] = { .ds = 12, .ms = 64 },
|
||||
};
|
||||
|
||||
memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
|
||||
id_ns->nlbaf = 7;
|
||||
ns->nlbaf = 8;
|
||||
|
||||
for (i = 0; i <= id_ns->nlbaf; i++) {
|
||||
memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
|
||||
|
||||
for (i = 0; i < ns->nlbaf; i++) {
|
||||
NvmeLBAF *lbaf = &id_ns->lbaf[i];
|
||||
if (lbaf->ds == ds) {
|
||||
if (lbaf->ms == ms) {
|
||||
|
@ -126,12 +127,14 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
|
|||
}
|
||||
|
||||
/* add non-standard lba format */
|
||||
id_ns->nlbaf++;
|
||||
id_ns->lbaf[id_ns->nlbaf].ds = ds;
|
||||
id_ns->lbaf[id_ns->nlbaf].ms = ms;
|
||||
id_ns->flbas |= id_ns->nlbaf;
|
||||
id_ns->lbaf[ns->nlbaf].ds = ds;
|
||||
id_ns->lbaf[ns->nlbaf].ms = ms;
|
||||
ns->nlbaf++;
|
||||
|
||||
id_ns->flbas |= i;
|
||||
|
||||
lbaf_found:
|
||||
id_ns->nlbaf = ns->nlbaf - 1;
|
||||
nvme_ns_init_format(ns);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue