Opened 11 months ago

Last modified 3 months ago

#15212 new bug

Fix nvme_disk on non-x86

Reported by: kallisti5 Owned by: waddlesplash
Priority: normal Milestone: Unscheduled
Component: Drivers/Disk/NVMe Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

nvme_disk has some type-size assertions which are failing on non-x86. Fix nvme_disk to function across all supported architectures.

C++ objects/haiku/arm/release/add-ons/kernel/drivers/disk/nvme/libnvme_haiku.o 
In file included from ../haiku/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp:16:
../haiku/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp: In function 'phys_addr_t nvme_mem_vtophys(void*)':
../haiku/src/add-ons/kernel/drivers/disk/nvme/compat/nvme_mem.h:25:29: warning: conversion from 'long long unsigned int' to 'phys_addr_t' {aka 'unsigned int'} changes value from '18446744073709551615' to '4294967295' [-Woverflow]
 #define NVME_VTOPHYS_ERROR (~0ULL)
                            ~^~~~~~
../haiku/src/add-ons/kernel/drivers/disk/nvme/compat/libnvme_haiku.cpp:88:10: note: in expansion of macro 'NVME_VTOPHYS_ERROR'
   return NVME_VTOPHYS_ERROR;
          ^~~~~~~~~~~~~~~~~~
Cc objects/haiku/arm/release/add-ons/kernel/drivers/disk/nvme/nvme.o 
In file included from ../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme.h:54,
                 from ../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme_common.h:60,
                 from ../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme_internal.h:37,
                 from ../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme.c:34:
../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme_spec.h:79:39: error: static assertion failed: "nvme_tracker is not 4K"
 #define nvme_static_assert(cond, msg) _Static_assert(cond, msg)
                                       ^~~~~~~~~~~~~~
../haiku/src/add-ons/kernel/drivers/disk/nvme/libnvme/nvme_internal.h:336:1: note: in expansion of macro 'nvme_static_assert'
 nvme_static_assert(sizeof(struct nvme_tracker) == 4096,
 ^~~~~~~~~~~~~~~~~~

Change History (1)

comment:1 by waddlesplash, 3 months ago

That static_assert failing is extremely worrying, because all of those fields are supposed to be filled with only fixed size types. Are you sure that you don't have some sort of sizing issue of the int types on ARM?

Note: See TracTickets for help on using tickets.