diff mbox series

[v4,12/14] baseband/acc: add device status and vf2pf comms

Message ID 1663806460-45162-13-git-send-email-nicolas.chautru@intel.com (mailing list archive)
State Superseded
Delegated to: akhil goyal
Headers show
Series [v4,01/14] baseband/acc100: remove unused registers | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

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

Signed-off-by: Nic Chautru <nicolas.chautru@intel.com>
---
 drivers/baseband/acc/rte_acc200_pmd.c | 61 +++++++++++++++++++++++++----------
 1 file changed, 44 insertions(+), 17 deletions(-)

Comments

Maxime Coquelin Sept. 23, 2022, 9:23 a.m. UTC | #1
On 9/22/22 02:27, Nic Chautru wrote:
> Add support to expose the device status seen from the
> host through v2pf mailbox communication.
> 
> Signed-off-by: Nic Chautru <nicolas.chautru@intel.com>
> ---
>   drivers/baseband/acc/rte_acc200_pmd.c | 61 +++++++++++++++++++++++++----------
>   1 file changed, 44 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c
> index b8b621a..3c2931b 100644
> --- a/drivers/baseband/acc/rte_acc200_pmd.c
> +++ b/drivers/baseband/acc/rte_acc200_pmd.c
> @@ -201,23 +201,47 @@
>   	rte_bbdev_log_debug(
>   			"%s Config LLR SIGN IN/OUT %s %s QG %u %u %u %u %u AQ %u %u %u %u %u Len %u %u %u %u %u\n",
>   			(d->pf_device) ? "PF" : "VF",
> -			(acc_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
> -			(acc_conf->output_pos_llr_1_bit) ? "POS" : "NEG",
> -			acc_conf->q_ul_4g.num_qgroups,
> -			acc_conf->q_dl_4g.num_qgroups,
> -			acc_conf->q_ul_5g.num_qgroups,
> -			acc_conf->q_dl_5g.num_qgroups,
> -			acc_conf->q_fft.num_qgroups,
> -			acc_conf->q_ul_4g.num_aqs_per_groups,
> -			acc_conf->q_dl_4g.num_aqs_per_groups,
> -			acc_conf->q_ul_5g.num_aqs_per_groups,
> -			acc_conf->q_dl_5g.num_aqs_per_groups,
> -			acc_conf->q_fft.num_aqs_per_groups,
> -			acc_conf->q_ul_4g.aq_depth_log2,
> -			acc_conf->q_dl_4g.aq_depth_log2,
> -			acc_conf->q_ul_5g.aq_depth_log2,
> -			acc_conf->q_dl_5g.aq_depth_log2,
> -			acc_conf->q_fft.aq_depth_log2);
> +			(acc200_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
> +			(acc200_conf->output_pos_llr_1_bit) ? "POS" : "NEG",
> +			acc200_conf->q_ul_4g.num_qgroups,
> +			acc200_conf->q_dl_4g.num_qgroups,
> +			acc200_conf->q_ul_5g.num_qgroups,
> +			acc200_conf->q_dl_5g.num_qgroups,
> +			acc200_conf->q_fft.num_qgroups,
> +			acc200_conf->q_ul_4g.num_aqs_per_groups,
> +			acc200_conf->q_dl_4g.num_aqs_per_groups,
> +			acc200_conf->q_ul_5g.num_aqs_per_groups,
> +			acc200_conf->q_dl_5g.num_aqs_per_groups,
> +			acc200_conf->q_fft.num_aqs_per_groups,
> +			acc200_conf->q_ul_4g.aq_depth_log2,
> +			acc200_conf->q_dl_4g.aq_depth_log2,
> +			acc200_conf->q_ul_5g.aq_depth_log2,
> +			acc200_conf->q_dl_5g.aq_depth_log2,
> +			acc200_conf->q_fft.aq_depth_log2);
> +}
> +
> +static inline void
> +acc200_vf2pf(struct acc_device *d, unsigned int payload)
> +{
> +	acc_reg_write(d, HWVfHiVfToPfDbellVf, payload);
> +}
> +
> +/* Request device status information */
> +static inline uint32_t
> +acc200_device_status(struct rte_bbdev *dev)
> +{
> +	struct acc_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, ACC_VF2PF_STATUS_REQUEST);
> +	reg = acc_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 = acc_reg_read(d, HWVfHiPfToVfDbellVf);
> +		time_out++;
> +	}
> +	return reg;

Please add new lines for clarity.
>   }
>   
>   /* Checks PF Info Ring to find the interrupt cause and handles it accordingly */
> @@ -537,6 +561,7 @@
>   
>   	/* Mark as configured properly */
>   	d->configured = true;
> +	acc200_vf2pf(d, ACC_VF2PF_USING_VF);
>   
>   	rte_bbdev_log_debug(
>   			"ACC200 (%s) configured  sw_rings = %p, sw_rings_iova = %#"
> @@ -1047,6 +1072,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;

With cosmetics fixed:

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
Nicolas Chautru Sept. 24, 2022, 12:04 a.m. UTC | #2
Hi Maxime, 

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Friday, September 23, 2022 2:23 AM
> To: Chautru, Nicolas <nicolas.chautru@intel.com>; dev@dpdk.org;
> thomas@monjalon.net
> Cc: trix@redhat.com; mdr@ashroe.eu; Richardson, Bruce
> <bruce.richardson@intel.com>; hemant.agrawal@nxp.com;
> david.marchand@redhat.com; stephen@networkplumber.org; Vargas,
> Hernan <hernan.vargas@intel.com>
> Subject: Re: [PATCH v4 12/14] baseband/acc: add device status and vf2pf
> comms
> 
> 
> 
> On 9/22/22 02:27, Nic Chautru wrote:
> > Add support to expose the device status seen from the host through
> > v2pf mailbox communication.
> >
> > Signed-off-by: Nic Chautru <nicolas.chautru@intel.com>
> > ---
> >   drivers/baseband/acc/rte_acc200_pmd.c | 61
> +++++++++++++++++++++++++----------
> >   1 file changed, 44 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/baseband/acc/rte_acc200_pmd.c
> > b/drivers/baseband/acc/rte_acc200_pmd.c
> > index b8b621a..3c2931b 100644
> > --- a/drivers/baseband/acc/rte_acc200_pmd.c
> > +++ b/drivers/baseband/acc/rte_acc200_pmd.c
> > @@ -201,23 +201,47 @@
> >   	rte_bbdev_log_debug(
> >   			"%s Config LLR SIGN IN/OUT %s %s QG %u %u %u %u
> %u AQ %u %u %u %u %u Len %u %u %u %u %u\n",
> >   			(d->pf_device) ? "PF" : "VF",
> > -			(acc_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
> > -			(acc_conf->output_pos_llr_1_bit) ? "POS" : "NEG",
> > -			acc_conf->q_ul_4g.num_qgroups,
> > -			acc_conf->q_dl_4g.num_qgroups,
> > -			acc_conf->q_ul_5g.num_qgroups,
> > -			acc_conf->q_dl_5g.num_qgroups,
> > -			acc_conf->q_fft.num_qgroups,
> > -			acc_conf->q_ul_4g.num_aqs_per_groups,
> > -			acc_conf->q_dl_4g.num_aqs_per_groups,
> > -			acc_conf->q_ul_5g.num_aqs_per_groups,
> > -			acc_conf->q_dl_5g.num_aqs_per_groups,
> > -			acc_conf->q_fft.num_aqs_per_groups,
> > -			acc_conf->q_ul_4g.aq_depth_log2,
> > -			acc_conf->q_dl_4g.aq_depth_log2,
> > -			acc_conf->q_ul_5g.aq_depth_log2,
> > -			acc_conf->q_dl_5g.aq_depth_log2,
> > -			acc_conf->q_fft.aq_depth_log2);
> > +			(acc200_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
> > +			(acc200_conf->output_pos_llr_1_bit) ? "POS" :
> "NEG",
> > +			acc200_conf->q_ul_4g.num_qgroups,
> > +			acc200_conf->q_dl_4g.num_qgroups,
> > +			acc200_conf->q_ul_5g.num_qgroups,
> > +			acc200_conf->q_dl_5g.num_qgroups,
> > +			acc200_conf->q_fft.num_qgroups,
> > +			acc200_conf->q_ul_4g.num_aqs_per_groups,
> > +			acc200_conf->q_dl_4g.num_aqs_per_groups,
> > +			acc200_conf->q_ul_5g.num_aqs_per_groups,
> > +			acc200_conf->q_dl_5g.num_aqs_per_groups,
> > +			acc200_conf->q_fft.num_aqs_per_groups,
> > +			acc200_conf->q_ul_4g.aq_depth_log2,
> > +			acc200_conf->q_dl_4g.aq_depth_log2,
> > +			acc200_conf->q_ul_5g.aq_depth_log2,
> > +			acc200_conf->q_dl_5g.aq_depth_log2,
> > +			acc200_conf->q_fft.aq_depth_log2);
> > +}
> > +
> > +static inline void
> > +acc200_vf2pf(struct acc_device *d, unsigned int payload) {
> > +	acc_reg_write(d, HWVfHiVfToPfDbellVf, payload); }
> > +
> > +/* Request device status information */ static inline uint32_t
> > +acc200_device_status(struct rte_bbdev *dev) {
> > +	struct acc_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, ACC_VF2PF_STATUS_REQUEST);
> > +	reg = acc_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 = acc_reg_read(d, HWVfHiPfToVfDbellVf);
> > +		time_out++;
> > +	}
> > +	return reg;
> 
> Please add new lines for clarity.

OK
Thanks

> >   }
> >
> >   /* Checks PF Info Ring to find the interrupt cause and handles it
> > accordingly */ @@ -537,6 +561,7 @@
> >
> >   	/* Mark as configured properly */
> >   	d->configured = true;
> > +	acc200_vf2pf(d, ACC_VF2PF_USING_VF);
> >
> >   	rte_bbdev_log_debug(
> >   			"ACC200 (%s) configured  sw_rings = %p,
> sw_rings_iova = %#"
> > @@ -1047,6 +1072,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;
> 
> With cosmetics fixed:
> 
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> 
> Thanks,
> Maxime
diff mbox series

Patch

diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c
index b8b621a..3c2931b 100644
--- a/drivers/baseband/acc/rte_acc200_pmd.c
+++ b/drivers/baseband/acc/rte_acc200_pmd.c
@@ -201,23 +201,47 @@ 
 	rte_bbdev_log_debug(
 			"%s Config LLR SIGN IN/OUT %s %s QG %u %u %u %u %u AQ %u %u %u %u %u Len %u %u %u %u %u\n",
 			(d->pf_device) ? "PF" : "VF",
-			(acc_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
-			(acc_conf->output_pos_llr_1_bit) ? "POS" : "NEG",
-			acc_conf->q_ul_4g.num_qgroups,
-			acc_conf->q_dl_4g.num_qgroups,
-			acc_conf->q_ul_5g.num_qgroups,
-			acc_conf->q_dl_5g.num_qgroups,
-			acc_conf->q_fft.num_qgroups,
-			acc_conf->q_ul_4g.num_aqs_per_groups,
-			acc_conf->q_dl_4g.num_aqs_per_groups,
-			acc_conf->q_ul_5g.num_aqs_per_groups,
-			acc_conf->q_dl_5g.num_aqs_per_groups,
-			acc_conf->q_fft.num_aqs_per_groups,
-			acc_conf->q_ul_4g.aq_depth_log2,
-			acc_conf->q_dl_4g.aq_depth_log2,
-			acc_conf->q_ul_5g.aq_depth_log2,
-			acc_conf->q_dl_5g.aq_depth_log2,
-			acc_conf->q_fft.aq_depth_log2);
+			(acc200_conf->input_pos_llr_1_bit) ? "POS" : "NEG",
+			(acc200_conf->output_pos_llr_1_bit) ? "POS" : "NEG",
+			acc200_conf->q_ul_4g.num_qgroups,
+			acc200_conf->q_dl_4g.num_qgroups,
+			acc200_conf->q_ul_5g.num_qgroups,
+			acc200_conf->q_dl_5g.num_qgroups,
+			acc200_conf->q_fft.num_qgroups,
+			acc200_conf->q_ul_4g.num_aqs_per_groups,
+			acc200_conf->q_dl_4g.num_aqs_per_groups,
+			acc200_conf->q_ul_5g.num_aqs_per_groups,
+			acc200_conf->q_dl_5g.num_aqs_per_groups,
+			acc200_conf->q_fft.num_aqs_per_groups,
+			acc200_conf->q_ul_4g.aq_depth_log2,
+			acc200_conf->q_dl_4g.aq_depth_log2,
+			acc200_conf->q_ul_5g.aq_depth_log2,
+			acc200_conf->q_dl_5g.aq_depth_log2,
+			acc200_conf->q_fft.aq_depth_log2);
+}
+
+static inline void
+acc200_vf2pf(struct acc_device *d, unsigned int payload)
+{
+	acc_reg_write(d, HWVfHiVfToPfDbellVf, payload);
+}
+
+/* Request device status information */
+static inline uint32_t
+acc200_device_status(struct rte_bbdev *dev)
+{
+	struct acc_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, ACC_VF2PF_STATUS_REQUEST);
+	reg = acc_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 = acc_reg_read(d, HWVfHiPfToVfDbellVf);
+		time_out++;
+	}
+	return reg;
 }
 
 /* Checks PF Info Ring to find the interrupt cause and handles it accordingly */
@@ -537,6 +561,7 @@ 
 
 	/* Mark as configured properly */
 	d->configured = true;
+	acc200_vf2pf(d, ACC_VF2PF_USING_VF);
 
 	rte_bbdev_log_debug(
 			"ACC200 (%s) configured  sw_rings = %p, sw_rings_iova = %#"
@@ -1047,6 +1072,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;