linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Wendy Liang <wendy.liang@xilinx.com>
Cc: arnd@arndb.de, gregkh@linuxfoundation.org,
	michal.simek@xilinx.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, robh+dt@kernel.org,
	Nishad Saraf <nishad.saraf@xilinx.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 9/9] misc: xilinx-ai-engine: Add support for servicing error interrupts
Date: Thu, 19 Nov 2020 16:36:45 +0800	[thread overview]
Message-ID: <20201119083645.544-1-hdanton@sina.com> (raw)
In-Reply-To: <1605743289-26575-10-git-send-email-wendy.liang@xilinx.com>

On Wed, 18 Nov 2020 15:48:09 -0800 Wendy Liang wrote:
> +/**
> + * aie_interrupt() - interrupt handler for AIE.
> + * @irq: Interrupt number.
> + * @data: AI engine device structure.
> + * @return: IRQ_HANDLED.
> + *
> + * This thread function disables level 2 interrupt controllers and schedules a
> + * task in workqueue to backtrack the source of error interrupt. Disabled
> + * interrupts are re-enabled after successful completion of bottom half.
> + */
> +irqreturn_t aie_interrupt(int irq, void *data)
> +{
> +	struct aie_device *adev = data;
> +	struct aie_partition *apart;
> +	int ret;
> +	bool sched_work = false;
> +
> +	ret = mutex_lock_interruptible(&adev->mlock);
> +	if (ret) {
> +		dev_err(&adev->dev,
> +			"Failed to acquire lock. Process was interrupted by fatal signals\n");
> +		return IRQ_NONE;
> +	}
> +
> +	list_for_each_entry(apart, &adev->partitions, node) {
> +		struct aie_location loc;
> +		u32 ttype, l2_mask, l2_status, l2_bitmap_offset  = 0;
> +
> +		ret = mutex_lock_interruptible(&apart->mlock);
> +		if (ret) {
> +			dev_err(&apart->dev,
> +				"Failed to acquire lock. Process was interrupted by fatal signals\n");
> +			return IRQ_NONE;

Though quite unlikely, you need to release adev->mlock before
going home.

> +		}
> +
> +		for (loc.col = apart->range.start.col, loc.row = 0;
> +		     loc.col < apart->range.start.col + apart->range.size.col;
> +		     loc.col++) {
> +			ttype = apart->adev->ops->get_tile_type(&loc);
> +			if (ttype != AIE_TILE_TYPE_SHIMNOC)
> +				continue;
> +
> +			l2_mask = aie_get_l2_mask(apart, &loc);
> +			if (l2_mask) {
> +				aie_resource_cpy_from_arr32(&apart->l2_mask,
> +							    l2_bitmap_offset  *
> +							    32, &l2_mask, 32);
> +				aie_disable_l2_ctrl(apart, &loc, l2_mask);
> +			}
> +			l2_bitmap_offset++;
> +
> +			l2_status = aie_get_l2_status(apart, &loc);
> +			if (l2_status) {
> +				aie_clear_l2_intr(apart, &loc, l2_status);
> +				sched_work = true;
> +			} else {
> +				aie_enable_l2_ctrl(apart, &loc, l2_mask);
> +			}
> +		}
> +		mutex_unlock(&apart->mlock);
> +	}
> +
> +	/* For ES1 silicon, interrupts are latched in NPI */
> +	if (adev->version == VERSAL_ES1_REV_ID) {
> +		ret = zynqmp_pm_clear_aie_npi_isr(adev->pm_node_id,
> +						  AIE_NPI_ERROR_ID);
> +		if (ret < 0)
> +			dev_err(&adev->dev, "Failed to clear NPI ISR\n");
> +	}
> +
> +	mutex_unlock(&adev->mlock);
> +
> +	if (sched_work)
> +		schedule_work(&adev->backtrack);
> +
> +	return IRQ_HANDLED;
> +}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-11-19  8:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 23:48 [PATCH v2 0/9] Xilinx AI engine kernel driver Wendy Liang
2020-11-18 23:48 ` [PATCH v2 1/9] dt-binding: soc: xilinx: ai-engine: Add AI engine binding Wendy Liang
2020-11-18 23:48 ` [PATCH v2 2/9] misc: Add Xilinx AI engine device driver Wendy Liang
2020-11-19 20:12   ` Dave Airlie
2020-11-19 22:08     ` Wendy Liang
2020-11-24  8:27     ` Wendy Liang
2020-11-18 23:48 ` [PATCH v2 3/9] misc: xilinx-ai-engine: Implement AI engine cleanup sequence Wendy Liang
2020-11-18 23:48 ` [PATCH v2 4/9] misc: xilinx-ai-engine: expose AI engine tile memories to userspace Wendy Liang
2020-11-18 23:48 ` [PATCH v2 5/9] misc: xilinx-ai-engine: add setting shim dma bd operation Wendy Liang
2020-11-18 23:48 ` [PATCH v2 6/9] misc: xilinx-ai-engine: add request and release tiles Wendy Liang
2020-11-18 23:48 ` [PATCH v2 7/9] misc: xilinx-ai-engine: Add support to request device management services Wendy Liang
2020-11-18 23:48 ` [PATCH v2 8/9] firmware: xilinx: Add IOCTL support for AIE ISR Clear Wendy Liang
2020-11-18 23:48 ` [PATCH v2 9/9] misc: xilinx-ai-engine: Add support for servicing error interrupts Wendy Liang
2020-11-19  8:36   ` Hillf Danton [this message]
2020-11-19 21:46     ` Wendy Liang
2020-11-24  3:24     ` Wendy Liang

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=20201119083645.544-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=nishad.saraf@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=wendy.liang@xilinx.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).