linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Christoph Hellwig <hch@infradead.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Huacai Chen <chenhc@lemote.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Xuefeng Li <lixuefeng@loongson.cn>
Subject: Re: [PATCH v2 2/3] MIPS: Loongson: Add DMA support for 7A1000
Date: Thu, 26 Mar 2020 10:44:06 +0800	[thread overview]
Message-ID: <821ab35b-72d8-59e0-98cb-f5b199ae3a2f@loongson.cn> (raw)
In-Reply-To: <20200325132756.GA13750@infradead.org>

On 03/25/2020 09:27 PM, Christoph Hellwig wrote:
> On Mon, Mar 23, 2020 at 10:59:14AM +0800, Tiezhu Yang wrote:
>> Implement __phys_to_dma() and __dma_to_phys() according to the
>> node id offset in the 7A1000 DMA route config register.
> Can you please try to just use the dma_pfn_offset field in struct device
> for all loongson platforms?  I'm pretty sure I asked for that last time
> around..

Oh, sorry, I don't quite understand what you mean last time.

Do you mean use the default implementation in include/linux/dma-direct.h
when CONFIG_ARCH_HAS_PHYS_TO_DMA is not set?

#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
#include <asm/dma-direct.h>
#else
static inline dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t 
paddr)
{
         dma_addr_t dev_addr = (dma_addr_t)paddr;

         return dev_addr - ((dma_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
}

static inline phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t 
dev_addr)
{
         phys_addr_t paddr = (phys_addr_t)dev_addr;

         return paddr + ((phys_addr_t)dev->dma_pfn_offset << PAGE_SHIFT);
}
#endif /* !CONFIG_ARCH_HAS_PHYS_TO_DMA */

If so, I will verify it used with the AMD RS780E and Loongson 7A1000 
bridge chip.

Thanks,

Tiezhu Yang


  reply	other threads:[~2020-03-26  2:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  2:59 [PATCH v2 0/3] Add basic support for Loongson 7A1000 bridge chip Tiezhu Yang
2020-03-23  2:59 ` [PATCH v2 1/3] MIPS: Loongson: Get host bridge information Tiezhu Yang
2020-03-24  7:36   ` Jiaxun Yang
2020-03-24  9:58     ` Tiezhu Yang
2020-03-24 10:02       ` Jiaxun Yang
2020-03-24 12:38         ` Tiezhu Yang
2020-03-23  2:59 ` [PATCH v2 2/3] MIPS: Loongson: Add DMA support for 7A1000 Tiezhu Yang
2020-03-25 13:27   ` Christoph Hellwig
2020-03-26  2:44     ` Tiezhu Yang [this message]
2020-03-27  6:26     ` Jiaxun Yang
2020-03-31  9:58     ` Tiezhu Yang
2020-03-23  2:59 ` [PATCH v2 3/3] MIPS: Loongson: Add PCI " Tiezhu Yang
2020-03-24  7:28   ` Jiaxun Yang
2020-03-24 10:02     ` Tiezhu Yang
2020-03-24  7:49 ` [PATCH v2 0/3] Add basic support for Loongson 7A1000 bridge chip Jiaxun Yang
2020-03-24  8:12   ` Qiujun Huang
2020-03-24  9:31   ` Tiezhu Yang

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=821ab35b-72d8-59e0-98cb-f5b199ae3a2f@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=chenhc@lemote.com \
    --cc=hch@infradead.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    /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).