]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - include/uapi/linux/blkzoned.h
prctl: Add force disable speculation
[mirror_ubuntu-artful-kernel.git] / include / uapi / linux / blkzoned.h
CommitLineData
6a0cb1bc
HR
1/*
2 * Zoned block devices handling.
3 *
4 * Copyright (C) 2015 Seagate Technology PLC
5 *
6 * Written by: Shaun Tancheff <shaun.tancheff@seagate.com>
7 *
8 * Modified by: Damien Le Moal <damien.lemoal@hgst.com>
9 * Copyright (C) 2016 Western Digital
10 *
11 * This file is licensed under the terms of the GNU General Public
12 * License version 2. This program is licensed "as is" without any
13 * warranty of any kind, whether express or implied.
14 */
15#ifndef _UAPI_BLKZONED_H
16#define _UAPI_BLKZONED_H
17
18#include <linux/types.h>
3ed05a98 19#include <linux/ioctl.h>
6a0cb1bc
HR
20
21/**
22 * enum blk_zone_type - Types of zones allowed in a zoned device.
23 *
24 * @BLK_ZONE_TYPE_CONVENTIONAL: The zone has no write pointer and can be writen
25 * randomly. Zone reset has no effect on the zone.
26 * @BLK_ZONE_TYPE_SEQWRITE_REQ: The zone must be written sequentially
27 * @BLK_ZONE_TYPE_SEQWRITE_PREF: The zone can be written non-sequentially
28 *
29 * Any other value not defined is reserved and must be considered as invalid.
30 */
31enum blk_zone_type {
32 BLK_ZONE_TYPE_CONVENTIONAL = 0x1,
33 BLK_ZONE_TYPE_SEQWRITE_REQ = 0x2,
34 BLK_ZONE_TYPE_SEQWRITE_PREF = 0x3,
35};
36
37/**
38 * enum blk_zone_cond - Condition [state] of a zone in a zoned device.
39 *
40 * @BLK_ZONE_COND_NOT_WP: The zone has no write pointer, it is conventional.
41 * @BLK_ZONE_COND_EMPTY: The zone is empty.
42 * @BLK_ZONE_COND_IMP_OPEN: The zone is open, but not explicitly opened.
43 * @BLK_ZONE_COND_EXP_OPEN: The zones was explicitly opened by an
44 * OPEN ZONE command.
45 * @BLK_ZONE_COND_CLOSED: The zone was [explicitly] closed after writing.
46 * @BLK_ZONE_COND_FULL: The zone is marked as full, possibly by a zone
47 * FINISH ZONE command.
48 * @BLK_ZONE_COND_READONLY: The zone is read-only.
49 * @BLK_ZONE_COND_OFFLINE: The zone is offline (sectors cannot be read/written).
50 *
51 * The Zone Condition state machine in the ZBC/ZAC standards maps the above
52 * deinitions as:
53 * - ZC1: Empty | BLK_ZONE_EMPTY
54 * - ZC2: Implicit Open | BLK_ZONE_COND_IMP_OPEN
55 * - ZC3: Explicit Open | BLK_ZONE_COND_EXP_OPEN
56 * - ZC4: Closed | BLK_ZONE_CLOSED
57 * - ZC5: Full | BLK_ZONE_FULL
58 * - ZC6: Read Only | BLK_ZONE_READONLY
59 * - ZC7: Offline | BLK_ZONE_OFFLINE
60 *
61 * Conditions 0x5 to 0xC are reserved by the current ZBC/ZAC spec and should
62 * be considered invalid.
63 */
64enum blk_zone_cond {
65 BLK_ZONE_COND_NOT_WP = 0x0,
66 BLK_ZONE_COND_EMPTY = 0x1,
67 BLK_ZONE_COND_IMP_OPEN = 0x2,
68 BLK_ZONE_COND_EXP_OPEN = 0x3,
69 BLK_ZONE_COND_CLOSED = 0x4,
70 BLK_ZONE_COND_READONLY = 0xD,
71 BLK_ZONE_COND_FULL = 0xE,
72 BLK_ZONE_COND_OFFLINE = 0xF,
73};
74
75/**
76 * struct blk_zone - Zone descriptor for BLKREPORTZONE ioctl.
77 *
78 * @start: Zone start in 512 B sector units
79 * @len: Zone length in 512 B sector units
80 * @wp: Zone write pointer location in 512 B sector units
81 * @type: see enum blk_zone_type for possible values
82 * @cond: see enum blk_zone_cond for possible values
83 * @non_seq: Flag indicating that the zone is using non-sequential resources
84 * (for host-aware zoned block devices only).
85 * @reset: Flag indicating that a zone reset is recommended.
86 * @reserved: Padding to 64 B to match the ZBC/ZAC defined zone descriptor size.
87 *
88 * start, len and wp use the regular 512 B sector unit, regardless of the
89 * device logical block size. The overall structure size is 64 B to match the
90 * ZBC/ZAC defined zone descriptor and allow support for future additional
91 * zone information.
92 */
93struct blk_zone {
94 __u64 start; /* Zone start sector */
95 __u64 len; /* Zone length in number of sectors */
96 __u64 wp; /* Zone write pointer position */
97 __u8 type; /* Zone type */
98 __u8 cond; /* Zone condition */
99 __u8 non_seq; /* Non-sequential write resources active */
100 __u8 reset; /* Reset write pointer recommended */
101 __u8 reserved[36];
102};
103
3ed05a98
ST
104/**
105 * struct blk_zone_report - BLKREPORTZONE ioctl request/reply
106 *
107 * @sector: starting sector of report
108 * @nr_zones: IN maximum / OUT actual
109 * @reserved: padding to 16 byte alignment
110 * @zones: Space to hold @nr_zones @zones entries on reply.
111 *
112 * The array of at most @nr_zones must follow this structure in memory.
113 */
114struct blk_zone_report {
115 __u64 sector;
116 __u32 nr_zones;
117 __u8 reserved[4];
118 struct blk_zone zones[0];
119} __packed;
120
121/**
122 * struct blk_zone_range - BLKRESETZONE ioctl request
123 * @sector: starting sector of the first zone to issue reset write pointer
124 * @nr_sectors: Total number of sectors of 1 or more zones to reset
125 */
126struct blk_zone_range {
127 __u64 sector;
128 __u64 nr_sectors;
129};
130
131/**
132 * Zoned block device ioctl's:
133 *
134 * @BLKREPORTZONE: Get zone information. Takes a zone report as argument.
135 * The zone report will start from the zone containing the
136 * sector specified in the report request structure.
137 * @BLKRESETZONE: Reset the write pointer of the zones in the specified
138 * sector range. The sector range must be zone aligned.
139 */
140#define BLKREPORTZONE _IOWR(0x12, 130, struct blk_zone_report)
141#define BLKRESETZONE _IOW(0x12, 131, struct blk_zone_range)
142
6a0cb1bc 143#endif /* _UAPI_BLKZONED_H */