]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme: introduce alloc helper with alignment support
authorDaniel Wagner <dwagner@suse.de>
Thu, 14 Sep 2023 08:53:20 +0000 (10:53 +0200)
committerDaniel Wagner <wagi@monom.org>
Wed, 20 Sep 2023 10:04:25 +0000 (12:04 +0200)
commitfe24b9e9ecc769fa144e80ee8b31c85ff5f8f2e1
tree0ea75e2fc79b1cff1d6fd7983b8ab30bc6ce26d6
parent2e1049f13d47c8d9b8874dc75fc78a4cea5ce7e8
nvme: introduce alloc helper with alignment support

The kernel supports since v5.2 direct mapped DMA buffers to userspace.
Up to this point a bounce buffer was involved. Because the buffers are
now directly accessed by the device, the rules of alignment also apply
for the payloads.

Introduce a helper to allocate all correctly buffers aligned.

Furthermore, ensure that the buffer is a multiple of 4k, because there
are devices on the market which will always transfer a multiple of 4k,
even if we ask for less, e.g 512 bytes. This avoid stack smashes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme.c