pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
{
/*
- * IOMMU is always present on a PowerNV host (IOMMUv2).
- * IOMMU is also present in a KVM/QEMU VM (IOMMUv1) but is not
- * currently supported by DPDK. Test for our current environment
- * and report VA support as appropriate.
+ * All POWER systems support an IOMMU, but only IOMMUv2 supports
+ * IOVA = VA in DPDK. Check contents of /proc/cpuinfo to find the
+ * system.
+ *
+ * Platform | Model | IOMMU | VA? | Comment
+ * ---------+-------+---------+-----+---------------------------------
+ * PowerNV | N/A | IOMMUv2 | Yes | OpenPOWER (Bare Metal)
+ * pSeries | ~qemu | IOMMUv2 | Yes | PowerVM Logical Partition (LPAR)
+ * pSeries | qemu | IOMMUv1 | No | QEMU Virtual Machine
*/
char *line = NULL;
size_t len = 0;
char filename[PATH_MAX] = "/proc/cpuinfo";
FILE *fp = fopen(filename, "r");
+ bool pseries = false, powernv = false, qemu = false;
bool ret = false;
if (fp == NULL) {
return ret;
}
- /* Check for a PowerNV platform */
+ /* Check the "platform" and "model" fields */
while (getline(&line, &len, fp) != -1) {
- if (strstr(line, "platform") == NULL)
- continue;
-
- if (strstr(line, "PowerNV") != NULL) {
- RTE_LOG(DEBUG, EAL, "Running on a PowerNV system\n");
- ret = true;
- break;
+ if (strstr(line, "platform") != NULL) {
+ if (strstr(line, "PowerNV") != NULL) {
+ RTE_LOG(DEBUG, EAL, "Running on a PowerNV platform\n");
+ powernv = true;
+ } else if (strstr(line, "pSeries") != NULL) {
+ RTE_LOG(DEBUG, EAL, "Running on a pSeries platform\n");
+ pseries = true;
+ }
+ } else if (strstr(line, "model") != NULL) {
+ if (strstr(line, "qemu") != NULL) {
+ RTE_LOG(DEBUG, EAL, "Found qemu emulation\n");
+ qemu = true;
+ }
}
}
free(line);
fclose(fp);
+
+ if (powernv || (pseries && !qemu))
+ ret = true;
return ret;
}
#else