tests/qtest/nvme-test: add mmio read test
Add a regression test for mmio read on big-endian hosts. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Gollu Appalanaidu <anaidu.gollu@samsung.com>
This commit is contained in:
parent
49e03457f1
commit
9631a8ab21
@ -67,6 +67,30 @@ static void nvmetest_oob_cmb_test(void *obj, void *data, QGuestAllocator *alloc)
|
||||
g_assert_cmpint(qpci_io_readl(pdev, bar, cmb_bar_size - 1), !=, 0x44332211);
|
||||
}
|
||||
|
||||
static void nvmetest_reg_read_test(void *obj, void *data, QGuestAllocator *alloc)
|
||||
{
|
||||
QNvme *nvme = obj;
|
||||
QPCIDevice *pdev = &nvme->dev;
|
||||
QPCIBar bar;
|
||||
uint32_t cap_lo, cap_hi;
|
||||
uint64_t cap;
|
||||
|
||||
qpci_device_enable(pdev);
|
||||
bar = qpci_iomap(pdev, 0, NULL);
|
||||
|
||||
cap_lo = qpci_io_readl(pdev, bar, 0x0);
|
||||
g_assert_cmpint(NVME_CAP_MQES(cap_lo), ==, 0x7ff);
|
||||
|
||||
cap_hi = qpci_io_readl(pdev, bar, 0x4);
|
||||
g_assert_cmpint(NVME_CAP_MPSMAX((uint64_t)cap_hi << 32), ==, 0x4);
|
||||
|
||||
cap = qpci_io_readq(pdev, bar, 0x0);
|
||||
g_assert_cmpint(NVME_CAP_MQES(cap), ==, 0x7ff);
|
||||
g_assert_cmpint(NVME_CAP_MPSMAX(cap), ==, 0x4);
|
||||
|
||||
qpci_iounmap(pdev, bar);
|
||||
}
|
||||
|
||||
static void nvmetest_pmr_reg_test(void *obj, void *data, QGuestAllocator *alloc)
|
||||
{
|
||||
QNvme *nvme = obj;
|
||||
@ -142,6 +166,8 @@ static void nvme_register_nodes(void)
|
||||
&(QOSGraphTestOptions) {
|
||||
.edge.extra_device_opts = "pmrdev=pmr0"
|
||||
});
|
||||
|
||||
qos_add_test("reg-read", "nvme", nvmetest_reg_read_test, NULL);
|
||||
}
|
||||
|
||||
libqos_init(nvme_register_nodes);
|
||||
|
Loading…
Reference in New Issue
Block a user