memory: add way of checking iommu usage
Since the fuzz tester will be submitting random commands with random memory addresses and such to the NVMe drives, we want to be especially sure that we are using the IOMMU while running this test to prevent memory corruption in the event that an errant command triggers a bad DMA. This function exposes to the application whether or not we are using the IOMMU. Change-Id: Ie4d26c706967a520967bfc81f72f7b581b792437 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446568 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
961cd6ab7e
commit
d9f92cd3e2
@ -573,6 +573,13 @@ size_t spdk_ring_enqueue(struct spdk_ring *ring, void **objs, size_t count);
|
||||
*/
|
||||
size_t spdk_ring_dequeue(struct spdk_ring *ring, void **objs, size_t count);
|
||||
|
||||
/**
|
||||
* Reports whether the SPDK application is using the IOMMU for DMA
|
||||
*
|
||||
* \return True if we are using the IOMMU, false otherwise.
|
||||
*/
|
||||
bool spdk_iommu_is_enabled(void);
|
||||
|
||||
#define SPDK_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL)
|
||||
|
||||
/**
|
||||
|
@ -779,6 +779,16 @@ spdk_mem_map_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_iommu_is_enabled(void)
|
||||
{
|
||||
#if SPDK_VFIO_ENABLED
|
||||
return g_vfio.enabled && !g_vfio.noiommu_enabled;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct spdk_vtophys_pci_device {
|
||||
struct rte_pci_device *pci_device;
|
||||
TAILQ_ENTRY(spdk_vtophys_pci_device) tailq;
|
||||
|
Loading…
x
Reference in New Issue
Block a user