From: Abdullah Sevincer <abdullah.sevincer@intel.com>
To: dev@dpdk.org
Cc: jerinj@marvell.com, mike.ximing.chen@intel.com,
bruce.richardson@intel.com,
Abdullah Sevincer <abdullah.sevincer@intel.com>,
stable@dpdk.org
Subject: [PATCH v3] event/dlb2: fix disable PASID for kernel 6.2
Date: Mon, 30 Oct 2023 16:12:44 -0500 [thread overview]
Message-ID: <20231030211244.2516043-1-abdullah.sevincer@intel.com> (raw)
In-Reply-To: <20230607210050.107944-1-abdullah.sevincer@intel.com>
vfio-pci driver in Linux kernel 6.2 enables PASID by default.
In DLB hardware, enabling PASID puts DLB in SIOV mode. This
breaks DLB PF-PMD mode. For DLB PF-PMD mode to function properly
PASID needs to be disabled for kernel 6.2.
In this commit this issue is addressed and PASID is disabled
by writing a zero to PASID control register.
Fixes: 5433956d5185 ("event/dlb2: add eventdev probe")
Cc: stable@dpdk.org
Signed-off-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
---
drivers/event/dlb2/pf/dlb2_main.c | 27 +++++++++++++++++++++++++++
lib/pci/rte_pci.h | 5 +++++
2 files changed, 32 insertions(+)
diff --git a/drivers/event/dlb2/pf/dlb2_main.c b/drivers/event/dlb2/pf/dlb2_main.c
index aa03e4c311..34e47a4e33 100644
--- a/drivers/event/dlb2/pf/dlb2_main.c
+++ b/drivers/event/dlb2/pf/dlb2_main.c
@@ -190,6 +190,7 @@ dlb2_pf_reset(struct dlb2_dev *dlb2_dev)
uint16_t rt_ctl_word;
uint32_t pri_reqs_dword;
uint16_t pri_ctrl_word;
+ uint16_t pasid_ctrl;
off_t pcie_cap_offset;
int pri_cap_offset;
@@ -197,6 +198,7 @@ dlb2_pf_reset(struct dlb2_dev *dlb2_dev)
int err_cap_offset;
int acs_cap_offset;
int wait_count;
+ int pasid_cap_offset;
uint16_t devsta_busy_word;
uint16_t devctl_word;
@@ -514,6 +516,31 @@ dlb2_pf_reset(struct dlb2_dev *dlb2_dev)
}
}
+ /* TODO - The current Linux kernel 6.2 vfio driver does not expose PASID capability to
+ * users. It also enables PASID by default, which breaks DLB PF PMD. We have
+ * to use the hardcoded offset for now to disable PASID. It may be different for
+ * other device drivers since they may have different design. When PASID capability
+ * is exposed to users, please revise this part and add api to disable PASID through
+ * pci common code.
+ */
+ pasid_cap_offset = RTE_PCI_PASID_CAP_OFFSET;
+
+ off = pasid_cap_offset + RTE_PCI_PASID_CTRL;
+ if (rte_pci_read_config(pdev, &pasid_ctrl, 2, off) != 2)
+ pasid_ctrl = 0;
+
+ if (pasid_ctrl) {
+ DLB2_INFO(dlb2_dev, "DLB2 disabling pasid...\n");
+
+ pasid_ctrl = 0;
+ ret = rte_pci_write_config(pdev, &pasid_ctrl, 2, off);
+ if (ret != 2) {
+ DLB2_LOG_ERR("[%s()] failed to write the pcie config space at offset %d\n",
+ __func__, (int)off);
+ return ret;
+ }
+ }
+
return 0;
}
diff --git a/lib/pci/rte_pci.h b/lib/pci/rte_pci.h
index 69e932d910..772a8d5622 100644
--- a/lib/pci/rte_pci.h
+++ b/lib/pci/rte_pci.h
@@ -101,6 +101,11 @@ extern "C" {
#define RTE_PCI_EXT_CAP_ID_ACS 0x0d /* Access Control Services */
#define RTE_PCI_EXT_CAP_ID_SRIOV 0x10 /* SR-IOV */
#define RTE_PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */
+#define RTE_PCI_EXT_CAP_ID_PASID 0x1B /* Process Address Space ID */
+
+/* Process Address Space ID */
+#define RTE_PCI_PASID_CTRL 0x06 /* PASID control register */
+#define RTE_PCI_PASID_CAP_OFFSET 0x148 /* PASID capability offset */
/* Advanced Error Reporting (RTE_PCI_EXT_CAP_ID_ERR) */
#define RTE_PCI_ERR_UNCOR_STATUS 0x04 /* Uncorrectable Error Status */
--
2.25.1
next prev parent reply other threads:[~2023-10-30 21:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 21:00 [PATCH v1] event/dlb2: add support for disabling PASID Abdullah Sevincer
2023-06-08 5:38 ` Jerin Jacob
2023-06-08 7:22 ` Thomas Monjalon
2023-06-08 7:28 ` David Marchand
2023-06-08 11:32 ` Jerin Jacob
2023-06-08 14:25 ` Chen, Mike Ximing
2023-08-03 7:56 ` David Marchand
2023-08-03 16:57 ` Sevincer, Abdullah
2023-10-26 16:46 ` Sevincer, Abdullah
2023-10-26 16:38 ` [PATCH v2] event/dlb2: disable PASID for kernel 6.2 Abdullah Sevincer
2023-10-30 21:12 ` Abdullah Sevincer [this message]
2023-10-31 8:21 ` [PATCH v3] event/dlb2: fix " Jerin Jacob
2023-10-31 15:13 ` Sevincer, Abdullah
2023-10-31 17:06 ` Jerin Jacob
2023-10-31 17:15 ` Bruce Richardson
2023-10-31 18:42 ` Jerin Jacob
2023-10-31 20:44 ` Bruce Richardson
2023-11-01 4:51 ` Jerin Jacob
2023-11-01 19:05 ` Sevincer, Abdullah
2023-11-02 10:23 ` Bruce Richardson
2023-11-02 10:48 ` Thomas Monjalon
2023-11-02 18:17 ` Sevincer, Abdullah
2023-10-31 0:10 ` [PATCH v1] event/dlb2: add support for disabling PASID Stephen Hemminger
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=20231030211244.2516043-1-abdullah.sevincer@intel.com \
--to=abdullah.sevincer@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jerinj@marvell.com \
--cc=mike.ximing.chen@intel.com \
--cc=stable@dpdk.org \
/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).