* [PATCH v2] hw/block/nvme: add missing mor/mar constraint checks
@ 2021-01-26 12:15 Klaus Jensen
2021-02-08 0:13 ` Dmitry Fomichev
0 siblings, 1 reply; 3+ messages in thread
From: Klaus Jensen @ 2021-01-26 12:15 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, qemu-block, Dmitry Fomichev, Klaus Jensen,
Gollu Appalanaidu, Max Reitz, Keith Busch, Klaus Jensen
From: Klaus Jensen <k.jensen@samsung.com>
Firstly, if zoned.max_active is non-zero, zoned.max_open must be less
than or equal to zoned.max_active.
Secondly, if only zones.max_active is set, we have to explicitly set
zones.max_open or we end up with an invalid MAR/MOR configuration. This
is an artifact of the parameters not being zeroes-based like in the
spec.
Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
Reported-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
v2:
* Jumped the gun on removing the check on zoned.max_open. It should
still be done since the device might only have a constraint on open
zones, not active.
* Instead, added an explicit set of zoned.max_open if only
zoned.max_active is specifed.
hw/block/nvme-ns.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
index 62b25cf69bfa..df514287b58f 100644
--- a/hw/block/nvme-ns.c
+++ b/hw/block/nvme-ns.c
@@ -153,6 +153,18 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace *ns, Error **errp)
return -1;
}
+ if (ns->params.max_active_zones) {
+ if (ns->params.max_open_zones > ns->params.max_active_zones) {
+ error_setg(errp, "max_open_zones (%u) exceeds max_active_zones (%u)",
+ ns->params.max_open_zones, ns->params.max_active_zones);
+ return -1;
+ }
+
+ if (!ns->params.max_open_zones) {
+ ns->params.max_open_zones = ns->params.max_active_zones;
+ }
+ }
+
if (ns->params.zd_extension_size) {
if (ns->params.zd_extension_size & 0x3f) {
error_setg(errp,
--
2.30.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/block/nvme: add missing mor/mar constraint checks
2021-01-26 12:15 [PATCH v2] hw/block/nvme: add missing mor/mar constraint checks Klaus Jensen
@ 2021-02-08 0:13 ` Dmitry Fomichev
2021-02-08 8:03 ` Klaus Jensen
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Fomichev @ 2021-02-08 0:13 UTC (permalink / raw)
To: its@irrelevant.dk, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, qemu-block@nongnu.org, k.jensen@samsung.com,
anaidu.gollu@samsung.com, mreitz@redhat.com, kbusch@kernel.org
On Tue, 2021-01-26 at 13:15 +0100, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
>
> Firstly, if zoned.max_active is non-zero, zoned.max_open must be less
> than or equal to zoned.max_active.
>
> Secondly, if only zones.max_active is set, we have to explicitly set
> zones.max_open or we end up with an invalid MAR/MOR configuration. This
> is an artifact of the parameters not being zeroes-based like in the
> spec.
>
> Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> Reported-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> ---
>
> v2:
>
> * Jumped the gun on removing the check on zoned.max_open. It should
> still be done since the device might only have a constraint on open
> zones, not active.
> * Instead, added an explicit set of zoned.max_open if only
> zoned.max_active is specifed.
>
> hw/block/nvme-ns.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/block/nvme-ns.c b/hw/block/nvme-ns.c
> index 62b25cf69bfa..df514287b58f 100644
> --- a/hw/block/nvme-ns.c
> +++ b/hw/block/nvme-ns.c
> @@ -153,6 +153,18 @@ static int nvme_ns_zoned_check_calc_geometry(NvmeNamespace *ns, Error **errp)
> return -1;
> }
>
>
>
>
> + if (ns->params.max_active_zones) {
> + if (ns->params.max_open_zones > ns->params.max_active_zones) {
> + error_setg(errp, "max_open_zones (%u) exceeds max_active_zones (%u)",
> + ns->params.max_open_zones, ns->params.max_active_zones);
> + return -1;
> + }
> +
> + if (!ns->params.max_open_zones) {
> + ns->params.max_open_zones = ns->params.max_active_zones;
> + }
> + }
> +
> if (ns->params.zd_extension_size) {
> if (ns->params.zd_extension_size & 0x3f) {
> error_setg(errp,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] hw/block/nvme: add missing mor/mar constraint checks
2021-02-08 0:13 ` Dmitry Fomichev
@ 2021-02-08 8:03 ` Klaus Jensen
0 siblings, 0 replies; 3+ messages in thread
From: Klaus Jensen @ 2021-02-08 8:03 UTC (permalink / raw)
To: Dmitry Fomichev
Cc: kwolf@redhat.com, qemu-block@nongnu.org, k.jensen@samsung.com,
anaidu.gollu@samsung.com, qemu-devel@nongnu.org,
mreitz@redhat.com, kbusch@kernel.org
[-- Attachment #1: Type: text/plain, Size: 770 bytes --]
On Feb 8 00:13, Dmitry Fomichev wrote:
> On Tue, 2021-01-26 at 13:15 +0100, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> >
> > Firstly, if zoned.max_active is non-zero, zoned.max_open must be less
> > than or equal to zoned.max_active.
> >
> > Secondly, if only zones.max_active is set, we have to explicitly set
> > zones.max_open or we end up with an invalid MAR/MOR configuration. This
> > is an artifact of the parameters not being zeroes-based like in the
> > spec.
> >
> > Cc: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> > Reported-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
> > Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
>
> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
>
Thanks, applied!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-08 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-26 12:15 [PATCH v2] hw/block/nvme: add missing mor/mar constraint checks Klaus Jensen
2021-02-08 0:13 ` Dmitry Fomichev
2021-02-08 8:03 ` Klaus Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).