mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Icenowy Zheng <uwu@icenowy.me>
To: Guo Ren <guoren@kernel.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Heiko Stuebner <heiko@sntech.de>,
	Samuel Holland <samuel@sholland.org>,
	Conor Dooley <conor.dooley@microchip.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/3] riscv: use VA+PA variant of CMO macros for DMA synchorization
Date: Wed, 04 Jan 2023 17:27:53 +0800	[thread overview]
Message-ID: <bcce507a31662004262fa3bbe911f1b1ff7f27af.camel@icenowy.me> (raw)
In-Reply-To: <CAJF2gTTO3jx8FqMVRmfgkjO02sCVx2SVbe-Sn1uKXojyn8RDaA@mail.gmail.com>

在 2023-01-04星期三的 17:24 +0800,Guo Ren写道:
> On Wed, Jan 4, 2023 at 4:59 PM Icenowy Zheng <uwu@icenowy.me> wrote:
> > 
> > 在 2023-01-04星期三的 16:50 +0800,Guo Ren写道:
> > > On Wed, Jan 4, 2023 at 3:43 PM Icenowy Zheng <uwu@icenowy.me>
> > > wrote:
> > > > 
> > > > DMA synchorization is done on PA and the VA is calculated from
> > > > the
> > > > PA.
> > > > 
> > > > Use the alternative macro variant that takes both VA and PA as
> > > > parameters, thus in case the ISA extension used support PA
> > > > directly, the
> > > > overhead for re-converting VA to PA can be omitted.
> > > > 
> > > > Suggested-by: Guo Ren <guoren@kernel.org>
> > > > Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
> > > > ---
> > > >  arch/riscv/mm/dma-noncoherent.c | 8 ++++----
> > > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/arch/riscv/mm/dma-noncoherent.c
> > > > b/arch/riscv/mm/dma-
> > > > noncoherent.c
> > > > index d919efab6eba..a751f4aece62 100644
> > > > --- a/arch/riscv/mm/dma-noncoherent.c
> > > > +++ b/arch/riscv/mm/dma-noncoherent.c
> > > > @@ -19,13 +19,13 @@ void arch_sync_dma_for_device(phys_addr_t
> > > > paddr, size_t size,
> > > > 
> > > >         switch (dir) {
> > > >         case DMA_TO_DEVICE:
> > > > -               ALT_CMO_OP(clean, vaddr, size,
> > > > riscv_cbom_block_size);
> > > > +               ALT_CMO_OP_VPA(clean, vaddr, paddr, size,
> > > > riscv_cbom_block_size);
> > > ALT_CMO_OP -> ALT_CMO_OP_VPA, is the renaming necessary?
> > 
> > I didn't rename the original ALT_CMO_OP, ALT_CMO_OP_VPA is
> > something
> > new.
> The ##_VPA is really strange.
> 
> How about:
> ALT_CMO_OP          -> ALT_CMO_OP_VA
> ALT_CMO_OP_VPA -> ALT_CMO_OP

It's thus a much bigger change.

If you are not fond of _VPA, I can rename it to _VA_PA.

> 
> > 
> > > 
> > > Others:
> > > Reviewed-by: Guo Ren <guoren@kernel.org>
> > > 
> > > >                 break;
> > > >         case DMA_FROM_DEVICE:
> > > > -               ALT_CMO_OP(clean, vaddr, size,
> > > > riscv_cbom_block_size);
> > > > +               ALT_CMO_OP_VPA(clean, vaddr, paddr, size,
> > > > riscv_cbom_block_size);
> > > >                 break;
> > > >         case DMA_BIDIRECTIONAL:
> > > > -               ALT_CMO_OP(flush, vaddr, size,
> > > > riscv_cbom_block_size);
> > > > +               ALT_CMO_OP_VPA(flush, vaddr, paddr, size,
> > > > riscv_cbom_block_size);
> > > >                 break;
> > > >         default:
> > > >                 break;
> > > > @@ -42,7 +42,7 @@ void arch_sync_dma_for_cpu(phys_addr_t paddr,
> > > > size_t size,
> > > >                 break;
> > > >         case DMA_FROM_DEVICE:
> > > >         case DMA_BIDIRECTIONAL:
> > > > -               ALT_CMO_OP(flush, vaddr, size,
> > > > riscv_cbom_block_size);
> > > > +               ALT_CMO_OP_VPA(flush, vaddr, paddr, size,
> > > > riscv_cbom_block_size);
> > > >                 break;
> > > >         default:
> > > >                 break;
> > > > --
> > > > 2.38.1
> > > > 
> > > 
> > > 
> > 
> 
> 


  reply	other threads:[~2023-01-04  9:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230104074146.578485-1-uwu@icenowy.me>
     [not found] ` <20230104074146.578485-2-uwu@icenowy.me>
2023-01-04  8:48   ` [RFC PATCH 1/3] riscv: errata: cmo: add CMO macro variant with both VA and PA Guo Ren
     [not found] ` <20230104074146.578485-3-uwu@icenowy.me>
2023-01-04  8:50   ` [RFC PATCH 2/3] riscv: use VA+PA variant of CMO macros for DMA synchorization Guo Ren
2023-01-04  8:59     ` Icenowy Zheng
2023-01-04  9:24       ` Guo Ren
2023-01-04  9:27         ` Icenowy Zheng [this message]
2023-01-04 12:16           ` Heiko Stübner
2023-01-06  7:38             ` Icenowy Zheng

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=bcce507a31662004262fa3bbe911f1b1ff7f27af.camel@icenowy.me \
    --to=uwu@icenowy.me \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor.dooley@microchip.com \
    --cc=guoren@kernel.org \
    --cc=heiko@sntech.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=samuel@sholland.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®