From: David Christensen <drc@linux.vnet.ibm.com>
To: dev@dpdk.org
Cc: thinhtr@linux.vnet.ibm.com, David Christensen <drc@linux.vnet.ibm.com>
Subject: [dpdk-dev] [PATCH] bus/pci: Add VA support for PowerVM system LPARs
Date: Wed, 23 Jun 2021 13:43:55 -0700 [thread overview]
Message-ID: <20210623204355.74362-1-drc@linux.vnet.ibm.com> (raw)
Add IOMMU detection logic for PowerVM LPARs.
PowerNV $ cat /proc/cpuinfo
...
timebase : 512000000
platform : PowerNV
model : 8335-GTW
PowerVM LPAR $ cat /proc/cpuinfo
...
timebase : 512000000
platform : pSeries
model : IBM,9009-22A
machine : CHRP IBM,9009-22A
MMU : Hash
PowerNV KVM Guest $ cat /proc/cpuinfo
...
timebase : 512000000
platform : pSeries
model : IBM pSeries (emulated by qemu)
machine : CHRP IBM pSeries (emulated by qemu)
MMU : Radix
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: Thinh Tran <thinhtr@linux.vnet.ibm.com>
---
drivers/bus/pci/linux/pci.c | 41 ++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index 0dc99e9cb2..4a0904a53a 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -549,16 +549,22 @@ bool
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) {
@@ -567,20 +573,31 @@ pci_device_iommu_support_va(__rte_unused const struct rte_pci_device *dev)
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
--
2.27.0
next reply other threads:[~2021-06-23 20:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-23 20:43 David Christensen [this message]
2021-07-05 8:58 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210623204355.74362-1-drc@linux.vnet.ibm.com \
--to=drc@linux.vnet.ibm.com \
--cc=dev@dpdk.org \
--cc=thinhtr@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).