All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhou Wang <wangzhou1@hisilicon.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>,
	<dmaengine@vger.kernel.org>, <linuxarm@huawei.com>,
	Zhenfa Qiu <qiuzhenfa@hisilicon.com>
Subject: Re: [PATCH v4] dmaengine: hisilicon: Add Kunpeng DMA engine support
Date: Thu, 16 Jan 2020 09:10:34 +0800	[thread overview]
Message-ID: <5E1FB80A.4030607@hisilicon.com> (raw)
In-Reply-To: <20200115142534.GM2818@vkoul-mobl>

On 2020/1/15 22:25, Vinod Koul wrote:
> On 02-01-20, 10:33, Zhou Wang wrote:
> 
>> +#define HISI_DMA_SQ_BASE_L(i)		(0x0 + (i) * 0x100)
>> +#define HISI_DMA_SQ_BASE_H(i)		(0x4 + (i) * 0x100)
>> +#define HISI_DMA_SQ_DEPTH(i)		(0x8 + (i) * 0x100)
>> +#define HISI_DMA_SQ_TAIL_PTR(i)		(0xc + (i) * 0x100)
>> +#define HISI_DMA_CQ_BASE_L(i)		(0x10 + (i) * 0x100)
>> +#define HISI_DMA_CQ_BASE_H(i)		(0x14 + (i) * 0x100)
>> +#define HISI_DMA_CQ_DEPTH(i)		(0x18 + (i) * 0x100)
>> +#define HISI_DMA_CQ_HEAD_PTR(i)		(0x1c + (i) * 0x100)
>> +#define HISI_DMA_CTRL0(i)		(0x20 + (i) * 0x100)
>> +#define HISI_DMA_CTRL0_QUEUE_EN_S	0
>> +#define HISI_DMA_CTRL0_QUEUE_PAUSE_S	4
>> +#define HISI_DMA_CTRL1(i)		(0x24 + (i) * 0x100)
>> +#define HISI_DMA_CTRL1_QUEUE_RESET_S	0
>> +#define HISI_DMA_Q_FSM_STS(i)		(0x30 + (i) * 0x100)
>> +#define HISI_DMA_FSM_STS_MASK		GENMASK(3, 0)
>> +#define HISI_DMA_INT_STS(i)		(0x40 + (i) * 0x100)
>> +#define HISI_DMA_INT_STS_MASK		GENMASK(12, 0)
>> +#define HISI_DMA_INT_MSK(i)		(0x44 + (i) * 0x100)
> 
> These really sound as offset + i * 0x100, so I think it might be better
> to define this as:
> 
> define HISI_DMA_SQ_BASE_L               0x0
> with HISI_DMA_OFFSET                    0x100
> 
> and then use read/write accessors:
> 
> hisi_channel_read(... , register, index)
> {
>         return readl( register + index * HISI_DMA_OFFSET)
> }
>

OK, I will modify this in v5.

>> +#define HISI_DMA_MODE			0x217c
>> +
>> +#define HISI_DMA_MSI_NUM		30
>> +#define HISI_DMA_CHAN_NUM		30
>> +#define HISI_DMA_Q_DEPTH_VAL		1024
>> +
>> +#define PCI_DEVICE_ID_HISI_DMA		0xa122
> 
> This is used only once so can be removed

OK.

> 
>> +static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan)
>> +{
>> +	struct hisi_dma_dev *hdma_dev = chan->hdma_dev;
>> +	u32 index = chan->qp_num, tmp;
>> +	int ret;
>> +
>> +	hisi_dma_pause_dma(hdma_dev, index, true);
>> +	hisi_dma_enable_dma(hdma_dev, index, false);
>> +	hisi_dma_mask_irq(hdma_dev, index);
>> +
>> +	ret = readl_relaxed_poll_timeout(hdma_dev->base +
>> +		HISI_DMA_Q_FSM_STS(index), tmp,
>> +		FIELD_GET(HISI_DMA_FSM_STS_MASK, tmp) != RUN, 10, 1000);
>> +	if (ret) {
>> +		dev_err(&hdma_dev->pdev->dev, "disable channel timeout!\n");
>> +		BUG_ON(1);
> 
> we dont kill kernel on this! you should probably complain violently
> (dump_stack() etc)...)
> 

OK, will change to WARN_ON in v5.

Thanks for your help!
Zhou


      reply	other threads:[~2020-01-16  1:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02  2:33 [PATCH v4] dmaengine: hisilicon: Add Kunpeng DMA engine support Zhou Wang
2020-01-09  3:08 ` Zhou Wang
2020-01-15 14:25 ` Vinod Koul
2020-01-16  1:10   ` Zhou Wang [this message]

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=5E1FB80A.4030607@hisilicon.com \
    --to=wangzhou1@hisilicon.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=qiuzhenfa@hisilicon.com \
    --cc=vkoul@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.