OSDN Git Service

hw/block/nvme: align zoned.zasl with mdts
authorKlaus Jensen <k.jensen@samsung.com>
Mon, 22 Feb 2021 18:27:58 +0000 (19:27 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Tue, 9 Mar 2021 10:00:57 +0000 (11:00 +0100)
commit578d914b263c1ec71e567b90d744075ea3a8ea74
treec8864eb2ced631b8707c1a9ac0626f41c6a21a57
parentbe5a1c27a3a5576323e910549071be635645aef1
hw/block/nvme: align zoned.zasl with mdts

ZASL (Zone Append Size Limit) is defined exactly like MDTS (Maximum Data
Transfer Size), that is, it is a value in units of the minimum memory
page size (CAP.MPSMIN) and is reported as a power of two.

The 'mdts' nvme device parameter is specified as in the spec, but the
'zoned.append_size_limit' parameter is specified in bytes. This is
suboptimal for a number of reasons:

  1. It is just plain confusing wrt. the definition of mdts.
  2. There is a lot of complexity involved in validating the value; it
     must be a power of two, it should be larger than 4k, if it is zero
     we set it internally to mdts, but still report it as zero.
  3. While "hw/block/nvme: improve invalid zasl value reporting"
     slightly improved the handling of the parameter, the validation is
     still wrong; it does not depend on CC.MPS, it depends on
     CAP.MPSMIN. And we are not even checking that it is actually less
     than or equal to MDTS, which is kinda the *one* condition it must
     satisfy.

Fix this by defining zasl exactly like mdts and checking the one thing
that it must satisfy (that it is less than or equal to mdts). Also,
change the default value from 128KiB to 0 (aka, whatever mdts is).

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
hw/block/nvme.c
hw/block/nvme.h
hw/block/trace-events