From 07042bdeb1d8d68d143c0b6e02bd20ef87407a4f Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Fri, 15 Mar 2019 08:06:45 +0100 Subject: [PATCH] env/dpdk: remove the fake rte_bus This practically reverts commit 2fe7aa5e4 [1]. The extra rte_bus was supposed to allow running SPDK as a non-priviledged user by enabling RTE_IOVA_VA mode. DPDK uses RTE_IOVA_PA by default - which means there are physical addresses used as memseg IOVAs and hence the root access is required to retrieve those physical addresses. This patch was supposed to be paired with a different DPDK patch of mine, but DPDK rejected that one. Instead, in DPDK 18.11+ the user can force iova mode by specifying --iova-mode= command line option, where is either pa or va. Either way, apparently there are cases where physical address contiguity is required even without UIO (#707) so let's revert this patch and consistently stick with RTE_IOVA_PA. SPDK requires some more effort to support running as a non-priviledged user anyway. Fixes #707 [1] env_dpdk/vtophys: register a fake rte_bus supporting RTE_IOVA_VA Change-Id: I90bf097fd6a7f129444229dc7cf07a462d4f2d09 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448121 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto --- lib/env_dpdk/memory.c | 46 ------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/lib/env_dpdk/memory.c b/lib/env_dpdk/memory.c index d2d520c28f..f0319dc18c 100644 --- a/lib/env_dpdk/memory.c +++ b/lib/env_dpdk/memory.c @@ -1345,49 +1345,3 @@ spdk_vtophys(void *buf, uint64_t *size) return paddr_2mb + (vaddr & MASK_2MB); } } - -static int -spdk_bus_scan(void) -{ - return 0; -} - -static int -spdk_bus_probe(void) -{ - return 0; -} - -static struct rte_device * -spdk_bus_find_device(const struct rte_device *start, - rte_dev_cmp_t cmp, const void *data) -{ - return NULL; -} - -#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3) -static enum rte_iova_mode -spdk_bus_get_iommu_class(void) { - /* Since we register our PCI drivers after EAL init, we have no chance - * of switching into RTE_IOVA_VA (virtual addresses as iova) iommu - * class. DPDK uses RTE_IOVA_PA by default because for some platforms - * it's the only supported mode, but then SPDK does not support those - * platforms and doesn't mind defaulting to RTE_IOVA_VA. The rte_pci bus - * will force RTE_IOVA_PA if RTE_IOVA_VA simply can not be used - * (i.e. at least one device on the system is bound to uio_pci_generic), - * so we simply return RTE_IOVA_VA here. - */ - return RTE_IOVA_VA; -} -#endif - -struct rte_bus spdk_bus = { - .scan = spdk_bus_scan, - .probe = spdk_bus_probe, - .find_device = spdk_bus_find_device, -#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3) - .get_iommu_class = spdk_bus_get_iommu_class, -#endif -}; - -RTE_REGISTER_BUS(spdk, spdk_bus);