forked from linux-nvme/libnvme
-
Notifications
You must be signed in to change notification settings - Fork 2
ioctl: nvme_dsm use nvme_passthru_cmd directly #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ea5835a
ioctl: nvme_identify use nvme_passthru_cmd directly
igaw 52926b4
ioctl: reorder nvme_get_log and nvme_get_log_page
igaw 08703bb
ioctl: nvme_get_log use nvme_passthru_cmd directly
igaw 0f642e1
ioctl: nvme_format_nvm use nvme_passthru_cmd directly
igaw 58dedbd
ioctl: nvme_ns_mgmt use nvme_passthru_cmd directly
igaw e9e3621
ioctl: nvme_ns_attach use nvme_passthru_cmd directly
igaw 763dc6a
ioctl: nvme_ns_download use nvme_passthru_cmd directly
igaw 52bf56f
ioctl: nvme_fw_commit use nvme_passthru_cmd directly
igaw 499a108
ioctl: nvme_security_send use nvme_passthru_cmd directly
igaw 3876ec6
ioctl: nvme_dsm use nvme_passthru_cmd directly
ikegami-t 812ebf2
ioctl: nvme_io use nvme_passthru_cmd directly
ikegami-t 825164b
ioctl: add dsm and io commands dword fields
ikegami-t aa9c43f
ioctl: nvme_copy use nvme_passthru_cmd directly
ikegami-t 04bc422
ioctl: reorder nsid argument
ikegami-t File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -335,6 +335,59 @@ enum nvme_cmd_dword_fields { | |
| NVME_DSM_CDW11_IDW_MASK = 0x1, | ||
| NVME_DSM_CDW11_AD_SHIFT = 2, | ||
| NVME_DSM_CDW11_AD_MASK = 0x1, | ||
| NVME_DSM_CDW11_ATTRS_SHIFT = NVME_DSM_CDW11_IDR_SHIFT, | ||
| NVME_DSM_CDW11_ATTRS_MASK = NVME_VAL(DSM_CDW11_IDR) | | ||
| NVME_VAL(DSM_CDW11_IDW) | | ||
| NVME_VAL(DSM_CDW11_AD), | ||
| NVME_NVM_CDW2_ELBTU_SHIFT = 0, | ||
| NVME_NVM_CDW2_ELBTU_MASK = 0xffff, | ||
| NVME_NVM_CDW3_ELBTU_SHIFT = 0, | ||
| NVME_NVM_CDW3_ELBTU_MASK = 0xffffffff, | ||
| NVME_NVM_CDW10_SLBAL_SHIFT = 0, | ||
| NVME_NVM_CDW10_SLBAL_MASK = 0xffffffff, | ||
| NVME_NVM_CDW11_SLBAU_SHIFT = 0, | ||
| NVME_NVM_CDW11_SLBAU_MASK = 0xffffffff, | ||
| NVME_NVM_CDW12_NLB_SHIFT = 0, | ||
| NVME_NVM_CDW12_NLB_MASK = 0xffff, | ||
| NVME_NVM_CDW12_CETYPE_SHIFT = 16, | ||
| NVME_NVM_CDW12_CETYPE_MASK = 0xf, | ||
| NVME_NVM_CDW12_STC_SHIFT = 24, | ||
| NVME_NVM_CDW12_STC_MASK = 0x1, | ||
| NVME_NVM_CDW12_PRINFO_SHIFT = 26, | ||
| NVME_NVM_CDW12_PRINFO_MASK = 0xf, | ||
| NVME_NVM_CDW12_FUA_SHIFT = 30, | ||
| NVME_NVM_CDW12_FUA_MASK = 0x1, | ||
| NVME_NVM_CDW12_LR_SHIFT = 31, | ||
| NVME_NVM_CDW12_LR_MASK = 0x1, | ||
| NVME_NVM_CDW12_CONTROL_SHIFT = NVME_NVM_CDW12_CETYPE_SHIFT, | ||
| NVME_NVM_CDW12_CONTROL_MASK = NVME_VAL(NVM_CDW12_CETYPE) | | ||
| NVME_VAL(NVM_CDW12_STC) | | ||
| NVME_VAL(NVM_CDW12_PRINFO) | | ||
| NVME_VAL(NVM_CDW12_FUA) | | ||
| NVME_VAL(NVM_CDW12_LR), | ||
| NVME_NVM_CDW13_DSM_AF_SHIFT = 0, | ||
| NVME_NVM_CDW13_DSM_AF_MASK = 0xf, | ||
| NVME_NVM_CDW13_DSM_AL_SHIFT = 4, | ||
| NVME_NVM_CDW13_DSM_AL_MASK = 0x3, | ||
| NVME_NVM_CDW13_DSM_SEQREQ_SHIFT = 6, | ||
| NVME_NVM_CDW13_DSM_SEQREQ_MASK = 0x1, | ||
| NVME_NVM_CDW13_DSM_INCPRS_SHIFT = 7, | ||
| NVME_NVM_CDW13_DSM_INCPRS_MASK = 0x1, | ||
| NVME_NVM_CDW13_DSM_SHIFT = NVME_NVM_CDW13_DSM_AF_SHIFT, | ||
| NVME_NVM_CDW13_DSM_MASK = NVME_VAL(NVM_CDW13_DSM_AF) | | ||
| NVME_VAL(NVM_CDW13_DSM_AL) | | ||
| NVME_VAL(NVM_CDW13_DSM_SEQREQ) | | ||
| NVME_VAL(NVM_CDW13_DSM_INCPRS), | ||
| NVME_NVM_CDW13_CEV_AF_SHIFT = 0, | ||
| NVME_NVM_CDW13_CEV_AF_MASK = 0xffff, | ||
| NVME_NVM_CDW13_DSPEC_SHIFT = 16, | ||
| NVME_NVM_CDW13_DSPEC_MASK = 0xffff, | ||
| NVME_NVM_CDW14_ELBTL_SHIFT = 0, | ||
| NVME_NVM_CDW14_ELBTL_MASK = 0xffffffff, | ||
| NVME_NVM_CDW15_ELBAT_SHIFT = 0, | ||
| NVME_NVM_CDW15_ELBAT_MASK = 0xffff, | ||
| NVME_NVM_CDW15_ELBATM_SHIFT = 16, | ||
| NVME_NVM_CDW15_ELBATM_MASK = 0xffff, | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -3709,27 +3762,27 @@ static inline int nvme_set_var_size_tags(__u32 *cmd_dw2, __u32 *cmd_dw3, __u32 * | |
|
|
||
| switch (pif) { | ||
| case NVME_NVM_PIF_16B_GUARD: | ||
| cdw14 = reftag & 0xffffffff; | ||
| cdw14 |= ((storage_tag << (32 - sts)) & 0xffffffff); | ||
| cdw14 = NVME_SET(reftag, NVM_CDW14_ELBTL); | ||
| cdw14 |= NVME_SET(storage_tag << (32 - sts), NVM_CDW14_ELBTL); | ||
| break; | ||
| case NVME_NVM_PIF_32B_GUARD: | ||
| cdw14 = reftag & 0xffffffff; | ||
| cdw3 = reftag >> 32; | ||
| cdw14 |= ((storage_tag << (80 - sts)) & 0xffff0000); | ||
| cdw14 = NVME_SET(reftag, NVM_CDW14_ELBTL); | ||
| cdw3 = NVME_SET(reftag >> 32, NVM_CDW3_ELBTU); | ||
| cdw14 |= NVME_SET((storage_tag << (80 - sts)) & 0xffff0000, NVM_CDW14_ELBTL); | ||
| if (sts >= 48) | ||
| cdw3 |= ((storage_tag >> (sts - 48)) & 0xffffffff); | ||
| cdw3 |= NVME_SET(storage_tag >> (sts - 48), NVM_CDW3_ELBTU); | ||
| else | ||
| cdw3 |= ((storage_tag << (48 - sts)) & 0xffffffff); | ||
| cdw2 = (storage_tag >> (sts - 16)) & 0xffff; | ||
| cdw3 |= NVME_SET(storage_tag << (48 - sts), NVM_CDW3_ELBTU); | ||
| cdw2 = NVME_SET(storage_tag >> (sts - 16), NVM_CDW2_ELBTU); | ||
| break; | ||
| case NVME_NVM_PIF_64B_GUARD: | ||
| cdw14 = reftag & 0xffffffff; | ||
| cdw3 = (reftag >> 32) & 0xffff; | ||
| cdw14 |= ((storage_tag << (48 - sts)) & 0xffffffff); | ||
| cdw14 = NVME_SET(reftag, NVM_CDW14_ELBTL); | ||
| cdw3 = NVME_SET((reftag >> 32) & 0xffff, NVM_CDW3_ELBTU); | ||
| cdw14 |= NVME_SET(storage_tag << (48 - sts), NVM_CDW14_ELBTL); | ||
| if (sts >= 16) | ||
| cdw3 |= ((storage_tag >> (sts - 16)) & 0xffff); | ||
| cdw3 |= NVME_SET((storage_tag >> (sts - 16)) & 0xffff, NVM_CDW3_ELBTU); | ||
| else | ||
| cdw3 |= ((storage_tag << (16 - sts)) & 0xffff); | ||
| cdw3 |= NVME_SET((storage_tag << (16 - sts)) & 0xffff, NVM_CDW3_ELBTU); | ||
| break; | ||
| default: | ||
| perror("Unsupported Protection Information Format"); | ||
|
|
@@ -3788,11 +3841,11 @@ static inline int nvme_io(nvme_link_t l, __u8 opcode, __u64 slba, __u64 storage_ | |
| __u16 dspec, __u8 dsm, __u64 reftag_u64, __u8 sts, __u8 pif, | ||
| __u32 *result) | ||
| { | ||
| __u32 cdw10 = slba & 0xffffffff; | ||
| __u32 cdw11 = slba >> 32; | ||
| __u32 cdw12 = nlb | (control << 16); | ||
| __u32 cdw13 = dsm | (dspec << 16); | ||
| __u32 cdw15 = apptag | (appmask << 16); | ||
| __u32 cdw10 = NVME_SET(slba, NVM_CDW10_SLBAL); | ||
| __u32 cdw11 = NVME_SET(slba >> 32, NVM_CDW11_SLBAU); | ||
| __u32 cdw12 = NVME_SET(nlb, NVM_CDW12_NLB) | NVME_SET(control, NVM_CDW12_CONTROL); | ||
| __u32 cdw13 = NVME_SET(dsm, NVM_CDW13_DSM) | NVME_SET(dspec, NVM_CDW13_DSPEC); | ||
| __u32 cdw15 = NVME_SET(apptag, NVM_CDW15_ELBAT) | NVME_SET(appmask, NVM_CDW15_ELBATM); | ||
|
|
||
| struct nvme_passthru_cmd cmd = { | ||
| .opcode = opcode, | ||
|
|
@@ -4152,7 +4205,7 @@ static inline int nvme_dsm(nvme_link_t l, struct nvme_dsm_range *dsm, __u16 nr_r | |
| __u32 nsid, __u32 *result) | ||
|
||
| { | ||
| __u32 cdw10 = NVME_SET(nr_ranges - 1, DSM_CDW10_NR); | ||
| __u32 cdw11 = attrs; | ||
| __u32 cdw11 = NVME_SET(attrs, DSM_CDW11_ATTRS); | ||
|
|
||
| struct nvme_passthru_cmd cmd = { | ||
| .opcode = nvme_cmd_dsm, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, this masks is already shifted thus it doesn't work as expected. I've added the necessary
>> NVME_NVM_CDW12_CONTROL_SHIFTso it works. Caught bymeson test -C .build:)