The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fea3cf1d6da0acf40bc1d3dadeeea7eeccbc10dd

commit fea3cf1d6da0acf40bc1d3dadeeea7eeccbc10dd
Author:     Warner Losh <[email protected]>
AuthorDate: 2021-07-02 21:58:19 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2021-07-02 22:05:19 +0000

    nvme: Fix alignment on nvme structures
    
    Remove __packed from nvme_command, nvme_completion and
    nvme_dsm_trim. Add super-alignment to nvme_completion since it's always
    at least that aligned in hardware (and in our existing uses of it
    embedded in structures). It generates better code in
    nvme_qpair_process_completions on riscv64 because otherwise the ABI
    assumes a 4-byte alignment, and the same on all other platforms.
    
    Reviewed by:            jrtc27@, mav@, chuck@
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D31001
---
 sys/dev/nvme/nvme.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h
index d63a074f321d..7d153c61165c 100644
--- a/sys/dev/nvme/nvme.h
+++ b/sys/dev/nvme/nvme.h
@@ -578,8 +578,8 @@ struct nvme_registers {
        struct {
            uint32_t    sq_tdbl; /* submission queue tail doorbell */
            uint32_t    cq_hdbl; /* completion queue head doorbell */
-       } doorbell[1] __packed;
-} __packed;
+       } doorbell[1];
+};
 
 _Static_assert(sizeof(struct nvme_registers) == 0x1008, "bad size for 
nvme_registers");
 
@@ -612,7 +612,7 @@ struct nvme_command {
        uint32_t cdw13;         /* command-specific */
        uint32_t cdw14;         /* command-specific */
        uint32_t cdw15;         /* command-specific */
-} __packed;
+};
 
 _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for 
nvme_command");
 
@@ -630,7 +630,7 @@ struct nvme_completion {
        /* dword 3 */
        uint16_t                cid;    /* command identifier */
        uint16_t                status;
-} __packed;
+} __aligned(8);        /* riscv: nvme_qpair_process_completions has better 
code gen */
 
 _Static_assert(sizeof(struct nvme_completion) == 4 * 4, "bad size for 
nvme_completion");
 
@@ -638,7 +638,7 @@ struct nvme_dsm_range {
        uint32_t attributes;
        uint32_t length;
        uint64_t starting_lba;
-} __packed;
+};
 
 /* Largest DSM Trim that can be done */
 #define NVME_MAX_DSM_TRIM              4096
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to