diff mbox series

[v1,09/10] baseband/acc200: add device status and vf2pf comms

Message ID 1657238503-143836-10-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers show
Series baseband/acc200 | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chautru, Nicolas July 8, 2022, 12:01 a.m. UTC
Add support to expose the device status seen from the
host through v2pf mailbox communication.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc200/rte_acc200_pmd.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/drivers/baseband/acc200/rte_acc200_pmd.c b/drivers/baseband/acc200/rte_acc200_pmd.c
index ecfbc7a..856ea1c 100644
--- a/drivers/baseband/acc200/rte_acc200_pmd.c
+++ b/drivers/baseband/acc200/rte_acc200_pmd.c
@@ -262,6 +262,31 @@ 
 			acc200_conf->q_fft.aq_depth_log2);
 }
 
+static inline void
+acc200_vf2pf(struct acc200_device *d, unsigned int payload)
+{
+	acc200_reg_write(d, HWVfHiVfToPfDbellVf, payload);
+}
+
+/* Request device status information */
+static inline uint32_t
+acc200_device_status(struct rte_bbdev *dev)
+{
+	struct acc200_device *d = dev->data->dev_private;
+	uint32_t reg, time_out = 0;
+	if (d->pf_device)
+		return RTE_BBDEV_DEV_NOT_SUPPORTED;
+	acc200_vf2pf(d, ACC200_VF2PF_STATUS_REQUEST);
+	reg = acc200_reg_read(d, HWVfHiPfToVfDbellVf);
+	while ((time_out < ACC200_STATUS_TO) && (reg == RTE_BBDEV_DEV_NOSTATUS)) {
+		usleep(ACC200_STATUS_WAIT); /*< Wait or VF->PF->VF Comms */
+		reg = acc200_reg_read(d, HWVfHiPfToVfDbellVf);
+		time_out++;
+	}
+	/* printf("DevStatus %x %s %d\n", reg, rte_bbdev_device_status_str(reg), time_out); */
+	return reg;
+}
+
 static void
 free_base_addresses(void **base_addrs, int size)
 {
@@ -704,6 +729,7 @@ 
 
 	/* Mark as configured properly */
 	d->configured = true;
+	acc200_vf2pf(d, ACC200_VF2PF_USING_VF);
 
 	rte_bbdev_log_debug(
 			"ACC200 (%s) configured  sw_rings = %p, sw_rings_iova = %#"
@@ -1214,6 +1240,8 @@ 
 
 	/* Read and save the populated config from ACC200 registers */
 	fetch_acc200_config(dev);
+	/* Check the status of device */
+	dev_info->device_status = acc200_device_status(dev);
 
 	/* Exposed number of queues */
 	dev_info->num_queues[RTE_BBDEV_OP_NONE] = 0;