env_dpdk/vtophys: register a fake rte_bus supporting RTE_IOVA_VA
To use virtual address IOVAs, DPDK has to ensure there are absolutely no predispositions to require physical addresses neither now, nor in future. All available buses, including PCI, report whether they require physical addresses. For PCI, the registered drivers may report RTE_PCI_DRV_IOVA_AS_VA to mark a driver as RTE_IOVA_VA compliant. However, this model assumes that all (PCI) drivers are registered on DPDK init, which is not the case in SPDK. With no devices attached, most buses will report RTE_IOVA_DC (don't care) and EAL will default to RTE_IOVA_PA. SPDK needs a hook to report whether it supports RTE_IOVA_VA, and the fake rte_bus provides it. Change-Id: Iba2d904200d1b70140d81943a57b98fd290783f9 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/423491 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
8c0fc98fb3
commit
2fe7aa5e4d
@ -634,3 +634,45 @@ spdk_vtophys(void *buf)
|
||||
return paddr_2mb + ((uint64_t)buf & 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
struct rte_bus spdk_bus = {
|
||||
.scan = spdk_bus_scan,
|
||||
.probe = spdk_bus_probe,
|
||||
.find_device = spdk_bus_find_device,
|
||||
.get_iommu_class = spdk_bus_get_iommu_class,
|
||||
};
|
||||
|
||||
RTE_REGISTER_BUS(spdk, spdk_bus);
|
||||
|
Loading…
Reference in New Issue
Block a user