aboutsummaryrefslogtreecommitdiff
path: root/hw/nvme/ns.c
diff options
context:
space:
mode:
authorNaveen Nagar <naveen.n1@samsung.com>2021-10-06 08:53:30 +0200
committerKlaus Jensen <k.jensen@samsung.com>2022-03-03 09:28:49 +0100
commit763c05dfb08c5fff86275788de7f11e899167167 (patch)
tree67b2471decddddc6cc35e78383a61a8d7f2102ff /hw/nvme/ns.c
parenta6de6ed5092c1d6d33450e53bb8f4b711c0320ea (diff)
downloadqemu-763c05dfb08c5fff86275788de7f11e899167167.zip
qemu-763c05dfb08c5fff86275788de7f11e899167167.tar.gz
qemu-763c05dfb08c5fff86275788de7f11e899167167.tar.bz2
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>
Diffstat (limited to 'hw/nvme/ns.c')
-rw-r--r--hw/nvme/ns.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index ee673f1..8dfb551 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -112,10 +112,11 @@ static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
[7] = { .ds = 12, .ms = 64 },
};
+ ns->nlbaf = 8;
+
memcpy(&id_ns->lbaf, &lbaf, sizeof(lbaf));
- id_ns->nlbaf = 7;
- for (i = 0; i <= id_ns->nlbaf; i++) {
+ 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;