DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Nicolas Chautru <nicolas.chautru@intel.com>,
	dev@dpdk.org, gakhil@marvell.com, hernan.vargas@intel.com
Subject: Re: [PATCH v1 3/6] baseband/acc: fix to acc200 access corner case
Date: Wed, 2 Nov 2022 07:52:09 +0100	[thread overview]
Message-ID: <cc24b95a-5006-a91d-98eb-1f9afe35c66a@redhat.com> (raw)
In-Reply-To: <20221101230459.50891-4-nicolas.chautru@intel.com>



On 11/2/22 00:04, Nicolas Chautru wrote:
> To enforce safe access to the ACC200 device, the PMD requires
> to explicitly check that the device is in configured and
> enabled state prior to accessing queue resources.
> This is done by checking the Qmgr ingress queue status.
> 
> Fixes: 40e3adbdd3 ("baseband/acc200: add queue configuration")
> 
> Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
> ---
>   drivers/baseband/acc/rte_acc200_pmd.c | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/baseband/acc/rte_acc200_pmd.c b/drivers/baseband/acc/rte_acc200_pmd.c
> index 76a5986448..10511d8b56 100644
> --- a/drivers/baseband/acc/rte_acc200_pmd.c
> +++ b/drivers/baseband/acc/rte_acc200_pmd.c
> @@ -172,6 +172,21 @@ updateQtop(uint8_t acc, uint8_t qg, struct rte_acc_conf *acc_conf, struct acc_de
>   	}
>   }
>   
> +/* Check device Qmgr is enabled for protection */
> +static inline bool
> +acc200_check_device_enable(struct rte_bbdev *dev)
> +{
> +	uint32_t reg_aq, qg;
> +	struct acc_device *d = dev->data->dev_private;
> +
> +	for (qg = 0; qg < ACC200_NUM_QGRPS; qg++) {
> +		reg_aq = acc_reg_read(d, queue_offset(d->pf_device, 0, qg, 0));
> +		if (reg_aq & ACC_QUEUE_ENABLE)
> +			return true;
> +	}
> +	return false;
> +}
> +
>   /* Fetch configuration enabled for the PF/VF using MMIO Read (slow). */
>   static inline void
>   fetch_acc200_config(struct rte_bbdev *dev)
> @@ -190,6 +205,12 @@ fetch_acc200_config(struct rte_bbdev *dev)
>   	if (d->configured)
>   		return;
>   
> +	if (!acc200_check_device_enable(dev)) {
> +		rte_bbdev_log(NOTICE, "%s has no queue enabled and can't be used.",
> +				dev->data->name);
> +		return;
> +	}
> +
>   	/* Choose correct registry addresses for the device type. */
>   	if (d->pf_device)
>   		reg_addr = &pf_reg_addr;
> @@ -454,6 +475,12 @@ acc200_setup_queues(struct rte_bbdev *dev, uint16_t num_queues, int socket_id)
>   		return -ENODEV;
>   	}
>   
> +	if (!acc200_check_device_enable(dev)) {
> +		rte_bbdev_log(NOTICE, "%s has no queue enabled and can't be used.",
> +				dev->data->name);
> +		return -ENODEV;
> +	}
> +
>   	alloc_sw_rings_min_mem(dev, d, num_queues, socket_id);
>   
>   	/* If minimal memory space approach failed, then allocate

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

Thanks,
Maxime


  reply	other threads:[~2022-11-02  6:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 23:04 [PATCH v1 0/6] baseband/acc: fixes on top of RC2 Nicolas Chautru
2022-11-01 23:04 ` [PATCH v1 1/6] baseband/acc: fix LTE half iteration flag Nicolas Chautru
2022-11-02  6:32   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 2/6] baseband/acc: fix to possible overflow Nicolas Chautru
2022-11-02  6:51   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 3/6] baseband/acc: fix to acc200 access corner case Nicolas Chautru
2022-11-02  6:52   ` Maxime Coquelin [this message]
2022-11-01 23:04 ` [PATCH v1 4/6] baseband/acc: fix PMON register values Nicolas Chautru
2022-11-02  7:01   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 5/6] baseband/acc: fix double MSI intr in TB mode Nicolas Chautru
2022-11-02  7:16   ` Maxime Coquelin
2022-11-01 23:04 ` [PATCH v1 6/6] baseband/acc: fix redundant function definition Nicolas Chautru
2022-11-02  7:19   ` Maxime Coquelin
2022-11-02 17:16     ` Chautru, Nicolas
2022-11-03  8:26 ` [EXT] [PATCH v1 0/6] baseband/acc: fixes on top of RC2 Akhil Goyal

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=cc24b95a-5006-a91d-98eb-1f9afe35c66a@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=hernan.vargas@intel.com \
    --cc=nicolas.chautru@intel.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).