hw/block/nvme: add mapping helpers
commita80b2ce68251cf5b11c450173128f29223045b9c
authorKlaus Jensen <k.jensen@samsung.com>
Sun, 23 Feb 2020 13:21:52 +0000 (23 14:21 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Wed, 2 Sep 2020 06:48:50 +0000 (2 08:48 +0200)
treeb21544852019b8fe1f8f099dc03f2411cc84fdc8
parentd1322b46684ef38f78760acfd4861b396a9c0264
hw/block/nvme: add mapping helpers

Add nvme_map_addr, nvme_map_addr_cmb and nvme_addr_to_cmb helpers and
use them in nvme_map_prp.

This fixes a bug where in the case of a CMB transfer, the device would
map to the buffer with a wrong length.

Fixes: b2b2b67a00574 ("nvme: Add support for Read Data and Write Data in CMBs.")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
hw/block/nvme.c
hw/block/trace-events