[5/6] block: add zone attr. to zone mgmt IOCTL struct
diff mbox series

Message ID 20200625122152.17359-6-javier@javigon.com
State New
Headers show
Series
  • ZNS: Extra features for current patches
Related show

Commit Message

Javier González June 25, 2020, 12:21 p.m. UTC
From: Javier González <javier.gonz@samsung.com>

Add zone attributes field to the blk_zone structure. Use ZNS attributes
as base for zoned block devices in general.

Signed-off-by: Javier González <javier.gonz@samsung.com>
Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
---
 drivers/nvme/host/zns.c       |  1 +
 include/uapi/linux/blkzoned.h | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

Comments

Matias Bjørling June 25, 2020, 3:13 p.m. UTC | #1
On 25/06/2020 14.21, Javier González wrote:
> From: Javier González <javier.gonz@samsung.com>
>
> Add zone attributes field to the blk_zone structure. Use ZNS attributes
> as base for zoned block devices in general.
>
> Signed-off-by: Javier González <javier.gonz@samsung.com>
> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
> ---
>   drivers/nvme/host/zns.c       |  1 +
>   include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>   2 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
> index 258d03610cc0..7d8381fe7665 100644
> --- a/drivers/nvme/host/zns.c
> +++ b/drivers/nvme/host/zns.c
> @@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>   	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>   	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>   	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
> +	zone.attr = entry->za;
>   
>   	return cb(&zone, idx, data);
>   }
> diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
> index 0c49a4b2ce5d..2e43a00e3425 100644
> --- a/include/uapi/linux/blkzoned.h
> +++ b/include/uapi/linux/blkzoned.h
> @@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>   	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>   };
>   
> +/**
> + * Zone Attributes
> + */
> +enum blk_zone_attr {
> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
> +	BLK_ZONE_ATTR_RZR	= 1 << 2,

The RZR bit is equivalent to the RESET bit accessible through the reset 
byte in struct blk_zone.

ZFC is tied to Zone Active Excursions, as there is no support in the 
kernel zone model for that. This should probably not be added until 
there is generic support.

Damien, could we overload the struct blk_zine reset variable for FZR? I 
don't believe we can due to backward compatibility. Is that your 
understanding as well?

> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,

There is not currently an equivalent for zone descriptor extensions in 
ZAC/ZBC. The addition of this field should probably be in a patch that 
adds generic support for zone descriptor extensions.

> +};
> +
>   /**
>    * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
>    *
> @@ -108,7 +118,8 @@ struct blk_zone {
>   	__u8	cond;		/* Zone condition */
>   	__u8	non_seq;	/* Non-sequential write resources active */
>   	__u8	reset;		/* Reset write pointer recommended */
> -	__u8	resv[4];
> +	__u8	attr;		/* Zone attributes */
> +	__u8	resv[3];
>   	__u64	capacity;	/* Zone capacity in number of sectors */
>   	__u8	reserved[24];
>   };
Javier González June 25, 2020, 7:51 p.m. UTC | #2
On 25.06.2020 17:13, Matias Bjørling wrote:
>On 25/06/2020 14.21, Javier González wrote:
>>From: Javier González <javier.gonz@samsung.com>
>>
>>Add zone attributes field to the blk_zone structure. Use ZNS attributes
>>as base for zoned block devices in general.
>>
>>Signed-off-by: Javier González <javier.gonz@samsung.com>
>>Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
>>Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
>>Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
>>---
>>  drivers/nvme/host/zns.c       |  1 +
>>  include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>
>>diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
>>index 258d03610cc0..7d8381fe7665 100644
>>--- a/drivers/nvme/host/zns.c
>>+++ b/drivers/nvme/host/zns.c
>>@@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>>  	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>>  	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>>  	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
>>+	zone.attr = entry->za;
>>  	return cb(&zone, idx, data);
>>  }
>>diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
>>index 0c49a4b2ce5d..2e43a00e3425 100644
>>--- a/include/uapi/linux/blkzoned.h
>>+++ b/include/uapi/linux/blkzoned.h
>>@@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>>  	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>>  };
>>+/**
>>+ * Zone Attributes
>>+ */
>>+enum blk_zone_attr {
>>+	BLK_ZONE_ATTR_ZFC	= 1 << 0,
>>+	BLK_ZONE_ATTR_FZR	= 1 << 1,
>>+	BLK_ZONE_ATTR_RZR	= 1 << 2,
>
>The RZR bit is equivalent to the RESET bit accessible through the 
>reset byte in struct blk_zone.
>
>ZFC is tied to Zone Active Excursions, as there is no support in the 
>kernel zone model for that. This should probably not be added until 
>there is generic support.
>
>Damien, could we overload the struct blk_zine reset variable for FZR? 
>I don't believe we can due to backward compatibility. Is that your 
>understanding as well?
>
>>+	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
>
>There is not currently an equivalent for zone descriptor extensions in 
>ZAC/ZBC. The addition of this field should probably be in a patch that 
>adds generic support for zone descriptor extensions.

The intention was to just report the values on the IOCTL and make sure
that changes to struct blk_zone are OK.

>>+};
>>+
>>  /**
>>   * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
>>   *
>>@@ -108,7 +118,8 @@ struct blk_zone {
>>  	__u8	cond;		/* Zone condition */
>>  	__u8	non_seq;	/* Non-sequential write resources active */
>>  	__u8	reset;		/* Reset write pointer recommended */
>>-	__u8	resv[4];
>>+	__u8	attr;		/* Zone attributes */
>>+	__u8	resv[3];
>>  	__u64	capacity;	/* Zone capacity in number of sectors */
>>  	__u8	reserved[24];
>>  };
>
>
Damien Le Moal June 26, 2020, 1:45 a.m. UTC | #3
On 2020/06/25 21:22, Javier González wrote:
> From: Javier González <javier.gonz@samsung.com>
> 
> Add zone attributes field to the blk_zone structure. Use ZNS attributes
> as base for zoned block devices in general.
> 
> Signed-off-by: Javier González <javier.gonz@samsung.com>
> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
> ---
>  drivers/nvme/host/zns.c       |  1 +
>  include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
> index 258d03610cc0..7d8381fe7665 100644
> --- a/drivers/nvme/host/zns.c
> +++ b/drivers/nvme/host/zns.c
> @@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>  	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>  	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>  	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
> +	zone.attr = entry->za;
>  
>  	return cb(&zone, idx, data);
>  }
> diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
> index 0c49a4b2ce5d..2e43a00e3425 100644
> --- a/include/uapi/linux/blkzoned.h
> +++ b/include/uapi/linux/blkzoned.h
> @@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>  	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>  };
>  
> +/**
> + * Zone Attributes

This is a user interface file. Please document the meaning of each attribute.

> + */
> +enum blk_zone_attr {
> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
These are ZNS specific, right ? Integrating the 2 ZBC/ZAC attributes in this
list would be nice, namely non_seq and reset. That will imply patching sd.c.

> +};
> +
>  /**
>   * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
>   *
> @@ -108,7 +118,8 @@ struct blk_zone {
>  	__u8	cond;		/* Zone condition */
>  	__u8	non_seq;	/* Non-sequential write resources active */
>  	__u8	reset;		/* Reset write pointer recommended */
> -	__u8	resv[4];
> +	__u8	attr;		/* Zone attributes */
> +	__u8	resv[3];
>  	__u64	capacity;	/* Zone capacity in number of sectors */
>  	__u8	reserved[24];
>  };
> 

You are missing a BLK_ZONE_REP_ATTR report flag to indicate to the user that the
attr field is present, used and valid.

enum blk_zone_report_flags {
 	BLK_ZONE_REP_CAPACITY	= (1 << 0),
+	BLK_ZONE_REP_ATTR	= (1 << 1),
 };

is I think needed.
Javier González June 26, 2020, 6:03 a.m. UTC | #4
On 26.06.2020 01:45, Damien Le Moal wrote:
>On 2020/06/25 21:22, Javier González wrote:
>> From: Javier González <javier.gonz@samsung.com>
>>
>> Add zone attributes field to the blk_zone structure. Use ZNS attributes
>> as base for zoned block devices in general.
>>
>> Signed-off-by: Javier González <javier.gonz@samsung.com>
>> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
>> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
>> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
>> ---
>>  drivers/nvme/host/zns.c       |  1 +
>>  include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
>> index 258d03610cc0..7d8381fe7665 100644
>> --- a/drivers/nvme/host/zns.c
>> +++ b/drivers/nvme/host/zns.c
>> @@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>>  	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>>  	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>>  	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
>> +	zone.attr = entry->za;
>>
>>  	return cb(&zone, idx, data);
>>  }
>> diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
>> index 0c49a4b2ce5d..2e43a00e3425 100644
>> --- a/include/uapi/linux/blkzoned.h
>> +++ b/include/uapi/linux/blkzoned.h
>> @@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>>  	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>>  };
>>
>> +/**
>> + * Zone Attributes
>
>This is a user interface file. Please document the meaning of each attribute.
>

Sure.

>> + */
>> +enum blk_zone_attr {
>> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
>> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
>> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
>> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
>These are ZNS specific, right ? Integrating the 2 ZBC/ZAC attributes in this
>list would be nice, namely non_seq and reset. That will imply patching sd.c.
>

Of course. I will look at non_seq and reset. Any other that should go
in here?

>> +};
>> +
>>  /**
>>   * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
>>   *
>> @@ -108,7 +118,8 @@ struct blk_zone {
>>  	__u8	cond;		/* Zone condition */
>>  	__u8	non_seq;	/* Non-sequential write resources active */
>>  	__u8	reset;		/* Reset write pointer recommended */
>> -	__u8	resv[4];
>> +	__u8	attr;		/* Zone attributes */
>> +	__u8	resv[3];
>>  	__u64	capacity;	/* Zone capacity in number of sectors */
>>  	__u8	reserved[24];
>>  };
>>
>
>You are missing a BLK_ZONE_REP_ATTR report flag to indicate to the user that the
>attr field is present, used and valid.
>
>enum blk_zone_report_flags {
> 	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>+	BLK_ZONE_REP_ATTR	= (1 << 1),
> };
>
>is I think needed.

Good point. I will add that on a V2.

Javier
Damien Le Moal June 26, 2020, 6:38 a.m. UTC | #5
On 2020/06/26 15:03, Javier González wrote:
> On 26.06.2020 01:45, Damien Le Moal wrote:
>> On 2020/06/25 21:22, Javier González wrote:
>>> From: Javier González <javier.gonz@samsung.com>
>>>
>>> Add zone attributes field to the blk_zone structure. Use ZNS attributes
>>> as base for zoned block devices in general.
>>>
>>> Signed-off-by: Javier González <javier.gonz@samsung.com>
>>> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
>>> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
>>> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
>>> ---
>>>  drivers/nvme/host/zns.c       |  1 +
>>>  include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
>>> index 258d03610cc0..7d8381fe7665 100644
>>> --- a/drivers/nvme/host/zns.c
>>> +++ b/drivers/nvme/host/zns.c
>>> @@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>>>  	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>>>  	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>>>  	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
>>> +	zone.attr = entry->za;
>>>
>>>  	return cb(&zone, idx, data);
>>>  }
>>> diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
>>> index 0c49a4b2ce5d..2e43a00e3425 100644
>>> --- a/include/uapi/linux/blkzoned.h
>>> +++ b/include/uapi/linux/blkzoned.h
>>> @@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>>>  	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>>>  };
>>>
>>> +/**
>>> + * Zone Attributes
>>
>> This is a user interface file. Please document the meaning of each attribute.
>>
> 
> Sure.
> 
>>> + */
>>> +enum blk_zone_attr {
>>> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
>>> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
>>> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
>>> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
>> These are ZNS specific, right ? Integrating the 2 ZBC/ZAC attributes in this
>> list would be nice, namely non_seq and reset. That will imply patching sd.c.
>>
> 
> Of course. I will look at non_seq and reset. Any other that should go
> in here?

See ZBC specs. These are the only 2 zone attributes defined.

> 
>>> +};
>>> +
>>>  /**
>>>   * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
>>>   *
>>> @@ -108,7 +118,8 @@ struct blk_zone {
>>>  	__u8	cond;		/* Zone condition */
>>>  	__u8	non_seq;	/* Non-sequential write resources active */
>>>  	__u8	reset;		/* Reset write pointer recommended */
>>> -	__u8	resv[4];
>>> +	__u8	attr;		/* Zone attributes */
>>> +	__u8	resv[3];
>>>  	__u64	capacity;	/* Zone capacity in number of sectors */
>>>  	__u8	reserved[24];
>>>  };
>>>
>>
>> You are missing a BLK_ZONE_REP_ATTR report flag to indicate to the user that the
>> attr field is present, used and valid.
>>
>> enum blk_zone_report_flags {
>> 	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>> +	BLK_ZONE_REP_ATTR	= (1 << 1),
>> };
>>
>> is I think needed.
> 
> Good point. I will add that on a V2.
> 
> Javier
>
Javier González June 26, 2020, 6:49 a.m. UTC | #6
On 26.06.2020 06:38, Damien Le Moal wrote:
>On 2020/06/26 15:03, Javier González wrote:
>> On 26.06.2020 01:45, Damien Le Moal wrote:
>>> On 2020/06/25 21:22, Javier González wrote:
>>>> From: Javier González <javier.gonz@samsung.com>
>>>>
>>>> Add zone attributes field to the blk_zone structure. Use ZNS attributes
>>>> as base for zoned block devices in general.
>>>>
>>>> Signed-off-by: Javier González <javier.gonz@samsung.com>
>>>> Signed-off-by: SelvaKumar S <selvakuma.s1@samsung.com>
>>>> Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
>>>> Signed-off-by: Nitesh Shetty <nj.shetty@samsung.com>
>>>> ---
>>>>  drivers/nvme/host/zns.c       |  1 +
>>>>  include/uapi/linux/blkzoned.h | 13 ++++++++++++-
>>>>  2 files changed, 13 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
>>>> index 258d03610cc0..7d8381fe7665 100644
>>>> --- a/drivers/nvme/host/zns.c
>>>> +++ b/drivers/nvme/host/zns.c
>>>> @@ -195,6 +195,7 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
>>>>  	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
>>>>  	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
>>>>  	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
>>>> +	zone.attr = entry->za;
>>>>
>>>>  	return cb(&zone, idx, data);
>>>>  }
>>>> diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
>>>> index 0c49a4b2ce5d..2e43a00e3425 100644
>>>> --- a/include/uapi/linux/blkzoned.h
>>>> +++ b/include/uapi/linux/blkzoned.h
>>>> @@ -82,6 +82,16 @@ enum blk_zone_report_flags {
>>>>  	BLK_ZONE_REP_CAPACITY	= (1 << 0),
>>>>  };
>>>>
>>>> +/**
>>>> + * Zone Attributes
>>>
>>> This is a user interface file. Please document the meaning of each attribute.
>>>
>>
>> Sure.
>>
>>>> + */
>>>> +enum blk_zone_attr {
>>>> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
>>>> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
>>>> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
>>>> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
>>> These are ZNS specific, right ? Integrating the 2 ZBC/ZAC attributes in this
>>> list would be nice, namely non_seq and reset. That will imply patching sd.c.
>>>
>>
>> Of course. I will look at non_seq and reset. Any other that should go
>> in here?
>
>See ZBC specs. These are the only 2 zone attributes defined.

Good. We will add this in V2.

Javier
Christoph Hellwig June 26, 2020, 9:14 a.m. UTC | #7
> + * Zone Attributes
> + */
> +enum blk_zone_attr {
> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
> +};

I have no ^$^$#$%#% idea what this is supposed to be.  If you add
userspace ABIs you need to document them in detail.  Until I've seen
that documentation I can't even comment if they make sense.
Javier González June 26, 2020, 10:01 a.m. UTC | #8
On 26.06.2020 11:14, Christoph Hellwig wrote:
>> + * Zone Attributes
>> + */
>> +enum blk_zone_attr {
>> +	BLK_ZONE_ATTR_ZFC	= 1 << 0,
>> +	BLK_ZONE_ATTR_FZR	= 1 << 1,
>> +	BLK_ZONE_ATTR_RZR	= 1 << 2,
>> +	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
>> +};
>
>I have no ^$^$#$%#% idea what this is supposed to be.  If you add
>userspace ABIs you need to document them in detail.  Until I've seen
>that documentation I can't even comment if they make sense.

Understood. I'll add the ZAC/ZBC attributes and document this properly
on V2.

Patch
diff mbox series

diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
index 258d03610cc0..7d8381fe7665 100644
--- a/drivers/nvme/host/zns.c
+++ b/drivers/nvme/host/zns.c
@@ -195,6 +195,7 @@  static int nvme_zone_parse_entry(struct nvme_ns *ns,
 	zone.capacity = nvme_lba_to_sect(ns, le64_to_cpu(entry->zcap));
 	zone.start = nvme_lba_to_sect(ns, le64_to_cpu(entry->zslba));
 	zone.wp = nvme_lba_to_sect(ns, le64_to_cpu(entry->wp));
+	zone.attr = entry->za;
 
 	return cb(&zone, idx, data);
 }
diff --git a/include/uapi/linux/blkzoned.h b/include/uapi/linux/blkzoned.h
index 0c49a4b2ce5d..2e43a00e3425 100644
--- a/include/uapi/linux/blkzoned.h
+++ b/include/uapi/linux/blkzoned.h
@@ -82,6 +82,16 @@  enum blk_zone_report_flags {
 	BLK_ZONE_REP_CAPACITY	= (1 << 0),
 };
 
+/**
+ * Zone Attributes
+ */
+enum blk_zone_attr {
+	BLK_ZONE_ATTR_ZFC	= 1 << 0,
+	BLK_ZONE_ATTR_FZR	= 1 << 1,
+	BLK_ZONE_ATTR_RZR	= 1 << 2,
+	BLK_ZONE_ATTR_ZDEV	= 1 << 7,
+};
+
 /**
  * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
  *
@@ -108,7 +118,8 @@  struct blk_zone {
 	__u8	cond;		/* Zone condition */
 	__u8	non_seq;	/* Non-sequential write resources active */
 	__u8	reset;		/* Reset write pointer recommended */
-	__u8	resv[4];
+	__u8	attr;		/* Zone attributes */
+	__u8	resv[3];
 	__u64	capacity;	/* Zone capacity in number of sectors */
 	__u8	reserved[24];
 };