nvme: remove aligned attribute

When testing vfio-user target with QEMU, there is following error log:

ctrlr.c:2143:31: runtime error: member access within misaligned address 0x7fe526a73d98 for type 'struct spdk_nvme_ctrlr_data', which requires 16 byte alignment

For vfio-user transport, the memory buffer is allocated by clients, so
we can't assume the memory is always aligned, just remove the
aligned attribute.

Change-Id: Ie80530415013ebd7bcb8cdabca97d7d0e34857f9
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7797
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Changpeng Liu 2021-05-07 23:12:13 +08:00 committed by Tomasz Zawadzki
parent 744f401cc9
commit 67eb36c7fa
2 changed files with 7 additions and 7 deletions

View File

@ -1659,18 +1659,18 @@ print_controller(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transport
printf("Number of Power States: %u\n", cdata->npss + 1); printf("Number of Power States: %u\n", cdata->npss + 1);
printf("Current Power State: Power State #%u\n", ps); printf("Current Power State: Power State #%u\n", ps);
for (i = 0; i <= cdata->npss; i++) { for (i = 0; i <= cdata->npss; i++) {
const struct spdk_nvme_power_state *psd = &cdata->psd[i]; const struct spdk_nvme_power_state psd = cdata->psd[i];
printf("Power State #%u: ", i); printf("Power State #%u: ", i);
if (psd->mps) { if (psd.mps) {
/* MP scale is 0.0001 W */ /* MP scale is 0.0001 W */
printf("Max Power: %u.%04u W\n", printf("Max Power: %u.%04u W\n",
psd->mp / 10000, psd.mp / 10000,
psd->mp % 10000); psd.mp % 10000);
} else { } else {
/* MP scale is 0.01 W */ /* MP scale is 0.01 W */
printf("Max Power: %3u.%02u W\n", printf("Max Power: %3u.%02u W\n",
psd->mp / 100, psd.mp / 100,
psd->mp % 100); psd.mp % 100);
} }
/* TODO: print other power state descriptor fields */ /* TODO: print other power state descriptor fields */
} }

View File

@ -1840,7 +1840,7 @@ struct spdk_nvme_cdata_sgls {
uint32_t reserved2 : 10; uint32_t reserved2 : 10;
}; };
struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data { struct __attribute__((packed)) spdk_nvme_ctrlr_data {
/* bytes 0-255: controller capabilities and features */ /* bytes 0-255: controller capabilities and features */
/** pci vendor id */ /** pci vendor id */