DMA Engine development
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Dave Jiang <dave.jiang@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, dmaengine@vger.kernel.org
Subject: Re: [PATCH 4/7] dmaengine: idxd: add helper for per interrupt handle drain
Date: Mon, 25 Oct 2021 10:36:47 +0530	[thread overview]
Message-ID: <YXY7Zy/g/jrSDuFD@matsya> (raw)
In-Reply-To: <163474883845.2608004.9330596081850512248.stgit@djiang5-desk3.ch.intel.com>

On 20-10-21, 09:53, Dave Jiang wrote:
> The helper is called at the completion of the interrupt handle refresh
> event. It issues drain descriptors to each of the wq with associated
> interrupt handle. The drain descriptor will have interrupt request set but
> without completion record. This will ensure all descriptors with incorrect
> interrupt completion handle get drained and a completion interrupt is
> triggered for the guest driver to process them.
> 
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/idxd/irq.c |   41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
> 
> diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c
> index 573a2f6d0f7f..8bca0ed2d23c 100644
> --- a/drivers/dma/idxd/irq.c
> +++ b/drivers/dma/idxd/irq.c
> @@ -55,6 +55,47 @@ static void idxd_device_reinit(struct work_struct *work)
>  	idxd_device_clear_state(idxd);
>  }
>  
> +/*
> + * The function sends a drain descriptor for the interrupt handle. The drain ensures
> + * all descriptors with this interrupt handle is flushed and the interrupt
> + * will allow the cleanup of the outstanding descriptors.
> + */
> +static void idxd_int_handle_revoke_drain(struct idxd_irq_entry *ie)
> +{
> +	struct idxd_wq *wq = ie->wq;
> +	struct idxd_device *idxd = ie->idxd;
> +	struct device *dev = &idxd->pdev->dev;
> +	struct dsa_hw_desc desc;
> +	void __iomem *portal;
> +	int rc;
> +
> +	memset(&desc, 0, sizeof(desc));

declare and init it and avoid the memset:
        struct dsa_hw_desc desc = {};

> +
> +	/* Issue a simple drain operation with interrupt but no completion record */
> +	desc.flags = IDXD_OP_FLAG_RCI;
> +	desc.opcode = DSA_OPCODE_DRAIN;
> +	desc.priv = 1;
> +
> +	if (ie->pasid != INVALID_IOASID)
> +		desc.pasid = ie->pasid;
> +	desc.int_handle = ie->int_handle;
> +	portal = idxd_wq_portal_addr(wq);
> +
> +	/*
> +	 * The wmb() makes sure that the descriptor is all there before we
> +	 * issue.
> +	 */
> +	wmb();
> +	if (wq_dedicated(wq)) {
> +		iosubmit_cmds512(portal, &desc, 1);
> +	} else {
> +		rc = enqcmds(portal, &desc);
> +		/* This should not fail unless hardware failed. */
> +		if (rc < 0)
> +			dev_warn(dev, "Failed to submit drain desc on wq %d\n", wq->id);
> +	}
> +}
> +
>  static int process_misc_interrupts(struct idxd_device *idxd, u32 cause)
>  {
>  	struct device *dev = &idxd->pdev->dev;
> 

-- 
~Vinod

  reply	other threads:[~2021-10-25  5:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-20 16:53 [PATCH 0/7] dmaengine: idxd: Add interrupt handle revoke support Dave Jiang
2021-10-20 16:53 ` [PATCH 1/7] dmaengine: idxd: rework descriptor free path on failure Dave Jiang
2021-10-25  4:56   ` Vinod Koul
2021-10-25 16:03     ` Dave Jiang
2021-10-20 16:53 ` [PATCH 2/7] dmaengine: idxd: int handle management refactoring Dave Jiang
2021-10-20 16:53 ` [PATCH 3/7] dmaengine: idxd: move interrupt handle assignment Dave Jiang
2021-10-20 16:53 ` [PATCH 4/7] dmaengine: idxd: add helper for per interrupt handle drain Dave Jiang
2021-10-25  5:06   ` Vinod Koul [this message]
2021-10-25 17:19     ` Dave Jiang
2021-10-20 16:54 ` [PATCH 5/7] dmaengine: idxd: create locked version of idxd_quiesce() call Dave Jiang
2021-10-20 16:54 ` [PATCH 6/7] dmaengine: idxd: handle invalid interrupt handle descriptors Dave Jiang
2021-10-25  5:08   ` Vinod Koul
2021-10-25 17:27     ` Dave Jiang
2021-10-20 16:54 ` [PATCH 7/7] dmaengine: idxd: handle interrupt handle revoked event Dave Jiang

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=YXY7Zy/g/jrSDuFD@matsya \
    --to=vkoul@kernel.org \
    --cc=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kevin.tian@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