Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13149513rwl; Wed, 4 Jan 2023 04:20:38 -0800 (PST) X-Google-Smtp-Source: AMrXdXtdh9Ni4J9fNa0bhcWjwmV8mMvjA5iQVB0/ZadklhK4+k+oBRRkivbgAsPc64tThH8thvW5 X-Received: by 2002:a05:6402:220e:b0:483:a6d8:7ad with SMTP id cq14-20020a056402220e00b00483a6d807admr28904036edb.24.1672834838335; Wed, 04 Jan 2023 04:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672834838; cv=none; d=google.com; s=arc-20160816; b=TmHEsjmF2fMlY1Yja47Cd1z41J5ynV9E7VZ273xiEp1Z5+OsQALEOxBhc5qvHi292q ZtYmh+DA5u7CQOdthBdjS05hC07PLN66cIMgTBvzfPmEQbW/EMcIw9aqCnqVVsZpNmr5 D04aHQE38XqaM5jnnktpjQ79jQQmLAtzXlqNi2+LqD5nNf0wzGgXXpkWn3eirphwy3bZ MBX+r1KYMGJuplG1ZuVvr0qogwRBMG5c2UAglK5RNO/yqwCdAFYW1jTK17S/Em/ONlW4 fIu5YlFbujul/fJSboaO3wU37dbobJ/aQbVBC/0DZYFqU3trBwdLWoPkWaSRcg020Q3l /FCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xYEOklgdm95gtQBv4McLKvPzT2ZHWJVtQgxOPEWLvQ4=; b=YlaSKVO1gz1QODRjCIPte9n1zpHL1JArIZ+9aznLuBCwYtKp9ldYuXZ0/epVu7I2ob oQB51TUv7GvV4Nzc0TaATcaFhXRqazI5ilUcY3xU4lvixU5Y1Mv2PTUqi3Jjaze78nNy 6eu1q617YKhtMmF9f5G34au3UVZsgxMvYklx8RSRvFOWBNMGJsS82r5I3yHwbhAmZNLU VcYJgFab/55E+87hmrpR9N8WRZZtLrd7CUAAAwRLlci2WZdIs0i8f2V7evVk6yjb5yYT yTQH2c/p34p+yN5RwQIBDG5xzBMb+d8S0duxq57l58KRypmvbWC5FJpUi+E26FJPnuHG rALw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dn16-20020a17090794d000b0084514612c2fsi33147778ejc.613.2023.01.04.04.20.23; Wed, 04 Jan 2023 04:20:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239080AbjADMQr convert rfc822-to-8bit (ORCPT + 57 others); Wed, 4 Jan 2023 07:16:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239054AbjADMQo (ORCPT ); Wed, 4 Jan 2023 07:16:44 -0500 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6E5DF5AA for ; Wed, 4 Jan 2023 04:16:41 -0800 (PST) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pD2h2-0006Bl-K6; Wed, 04 Jan 2023 13:16:28 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Guo Ren , Icenowy Zheng Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , Conor Dooley , 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 13:16:27 +0100 Message-ID: <2135147.irdbgypaU6@diego> In-Reply-To: References: <20230104074146.578485-1-uwu@icenowy.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Am Mittwoch, 4. Januar 2023, 10:27:53 CET schrieb Icenowy Zheng: > 在 2023-01-04星期三的 17:24 +0800,Guo Ren写道: > > On Wed, Jan 4, 2023 at 4:59 PM Icenowy Zheng wrote: > > > > > > 在 2023-01-04星期三的 16:50 +0800,Guo Ren写道: > > > > On Wed, Jan 4, 2023 at 3:43 PM Icenowy Zheng > > > > 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 > > > > > Signed-off-by: Icenowy Zheng > > > > > --- > > > > > 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. before you spend too much time on this, there is currently a parallel discussion running about including all the other different vendor- specific cache management. See [0] and the thread before that for reference. The consensus seems to be that cache-handling itself is not fast anyway, and therefore to reduce complexity for the cache handling and move non-zicbom cache-handling into a indirect function call that the can be overridden at runtime. Heiko [0] https://lore.kernel.org/all/43aee000-5b89-4d94-98d2-b37b1a18a83e@app.fastmail.com/