mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
hw/nvme: add basic endurance group support
Add the mandatory Endurance Group identify data structures and log pages. For now, all namespaces in a subsystem belongs to a single Endurance Group. Reviewed-by: Keith Busch <kbusch@kernel.org> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
534a93d3a0
commit
771dbc3ac4
4 changed files with 93 additions and 8 deletions
|
@ -58,6 +58,24 @@ enum NvmeBarRegs {
|
|||
NVME_REG_PMRMSCU = offsetof(NvmeBar, pmrmscu),
|
||||
};
|
||||
|
||||
typedef struct QEMU_PACKED NvmeEndGrpLog {
|
||||
uint8_t critical_warning;
|
||||
uint8_t rsvd[2];
|
||||
uint8_t avail_spare;
|
||||
uint8_t avail_spare_thres;
|
||||
uint8_t percet_used;
|
||||
uint8_t rsvd1[26];
|
||||
uint64_t end_estimate[2];
|
||||
uint64_t data_units_read[2];
|
||||
uint64_t data_units_written[2];
|
||||
uint64_t media_units_written[2];
|
||||
uint64_t host_read_commands[2];
|
||||
uint64_t host_write_commands[2];
|
||||
uint64_t media_integrity_errors[2];
|
||||
uint64_t no_err_info_log_entries[2];
|
||||
uint8_t rsvd2[352];
|
||||
} NvmeEndGrpLog;
|
||||
|
||||
enum NvmeCapShift {
|
||||
CAP_MQES_SHIFT = 0,
|
||||
CAP_CQR_SHIFT = 16,
|
||||
|
@ -1005,11 +1023,12 @@ enum {
|
|||
};
|
||||
|
||||
enum NvmeLogIdentifier {
|
||||
NVME_LOG_ERROR_INFO = 0x01,
|
||||
NVME_LOG_SMART_INFO = 0x02,
|
||||
NVME_LOG_FW_SLOT_INFO = 0x03,
|
||||
NVME_LOG_CHANGED_NSLIST = 0x04,
|
||||
NVME_LOG_CMD_EFFECTS = 0x05,
|
||||
NVME_LOG_ERROR_INFO = 0x01,
|
||||
NVME_LOG_SMART_INFO = 0x02,
|
||||
NVME_LOG_FW_SLOT_INFO = 0x03,
|
||||
NVME_LOG_CHANGED_NSLIST = 0x04,
|
||||
NVME_LOG_CMD_EFFECTS = 0x05,
|
||||
NVME_LOG_ENDGRP = 0x09,
|
||||
};
|
||||
|
||||
typedef struct QEMU_PACKED NvmePSD {
|
||||
|
@ -1091,7 +1110,10 @@ typedef struct QEMU_PACKED NvmeIdCtrl {
|
|||
uint16_t mntmt;
|
||||
uint16_t mxtmt;
|
||||
uint32_t sanicap;
|
||||
uint8_t rsvd332[180];
|
||||
uint8_t rsvd332[6];
|
||||
uint16_t nsetidmax;
|
||||
uint16_t endgidmax;
|
||||
uint8_t rsvd342[170];
|
||||
uint8_t sqes;
|
||||
uint8_t cqes;
|
||||
uint16_t maxcmd;
|
||||
|
@ -1134,6 +1156,7 @@ enum NvmeIdCtrlOaes {
|
|||
};
|
||||
|
||||
enum NvmeIdCtrlCtratt {
|
||||
NVME_CTRATT_ENDGRPS = 1 << 4,
|
||||
NVME_CTRATT_ELBAS = 1 << 15,
|
||||
};
|
||||
|
||||
|
@ -1227,6 +1250,7 @@ enum NvmeNsAttachmentOperation {
|
|||
#define NVME_AEC_SMART(aec) (aec & 0xff)
|
||||
#define NVME_AEC_NS_ATTR(aec) ((aec >> 8) & 0x1)
|
||||
#define NVME_AEC_FW_ACTIVATION(aec) ((aec >> 9) & 0x1)
|
||||
#define NVME_AEC_ENDGRP_NOTICE(aec) ((aec >> 14) & 0x1)
|
||||
|
||||
#define NVME_ERR_REC_TLER(err_rec) (err_rec & 0xffff)
|
||||
#define NVME_ERR_REC_DULBE(err_rec) (err_rec & 0x10000)
|
||||
|
@ -1338,7 +1362,10 @@ typedef struct QEMU_PACKED NvmeIdNs {
|
|||
uint16_t mssrl;
|
||||
uint32_t mcl;
|
||||
uint8_t msrc;
|
||||
uint8_t rsvd81[23];
|
||||
uint8_t rsvd81[18];
|
||||
uint8_t nsattr;
|
||||
uint16_t nvmsetid;
|
||||
uint16_t endgid;
|
||||
uint8_t nguid[16];
|
||||
uint64_t eui64;
|
||||
NvmeLBAF lbaf[NVME_MAX_NLBAF];
|
||||
|
@ -1655,5 +1682,6 @@ static inline void _nvme_check_size(void)
|
|||
QEMU_BUILD_BUG_ON(sizeof(NvmePriCtrlCap) != 4096);
|
||||
QEMU_BUILD_BUG_ON(sizeof(NvmeSecCtrlEntry) != 32);
|
||||
QEMU_BUILD_BUG_ON(sizeof(NvmeSecCtrlList) != 4096);
|
||||
QEMU_BUILD_BUG_ON(sizeof(NvmeEndGrpLog) != 512);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue