Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1986022rwb; Wed, 5 Oct 2022 07:35:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM665kODG2dAigYm/X01n7TM0IFknYAxMLZ/8fg3cnDLYTfAJKPDxTKayNdM08dJMLpzNf9C X-Received: by 2002:a17:906:3e01:b0:781:6462:700f with SMTP id k1-20020a1709063e0100b007816462700fmr24167965eji.307.1664980542836; Wed, 05 Oct 2022 07:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664980542; cv=none; d=google.com; s=arc-20160816; b=h7iONU7/nVPkoHOI6XnMivMIjW40AUwqWC5slKkVw48h2k9p12rJTpmrj++BSZaYQ1 EmInc99UOQ3Rcgd4W3zZMc4hmEDk7JFdbN7JBIDH4gH3aM40q+ym4cJsdofNK23y7h1i o0PYwh3U5dksnCxtexg8S/3kYmiIQe2HGiEba4QVBy1Uer6CssNZHEjH0QOgMfxMFLXe GEMEVqV02Oaq6o+eqr2EiRu3KYamYklPDaVDQ97zV/E50vBzuSp812dARkon7lDYHONj ZALOLGLb3TBdDjxktQsQuSeaJrjMLEb4MmoJ6+9N3Li6eEO0S0paGIFfjVtc2OAFuSbX VHQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=r/Lxg49WUhBxvpZbcIWs5R0quAraa7K7Mv5/sGDNMQI=; b=o1S3Kdp4uKd1LfQYMjwybtMFHRVgX2rP6hCeNE6Q9Jj/d/aV+B+lcxJHrKXwdcZk3V vGzEyzi1FsJnkQK5hjV6JJWHIdYS19XJq8YItP5p+k/GGeSGosX915pdBx/BiOp5rtkj Plh8IhGVTACdL2SzjO1oKM/NB7vpfYRwWEzoVup/NNQ+f+0VQO3XngyZICu0CzRrP2Xy KKmgJp1EVvwna3uecBJbcccz4HDtAgmKpQaN4zzLyb1ngjtRZvM+cY0UTTiaG0TAYIWl nK53AcdBnV9tMuZtKFhEaSfBlO/Gak7b+cFy4mrI84OCohRBxwKWaGrVJbSkFtZ97vZd Ryfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6P1+ils; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p23-20020a170906615700b0077eca9fa444si12555073ejl.187.2022.10.05.07.35.17; Wed, 05 Oct 2022 07:35:42 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X6P1+ils; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229974AbiJEOXj (ORCPT + 99 others); Wed, 5 Oct 2022 10:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbiJEOXi (ORCPT ); Wed, 5 Oct 2022 10:23:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBC83786FA; Wed, 5 Oct 2022 07:23:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 97B68B81BEF; Wed, 5 Oct 2022 14:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AB7EC433C1; Wed, 5 Oct 2022 14:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1664979814; bh=WFaYi+X3bwztuZypZNGHha7U7CNiw0AMJpnPHzXpFJ0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=X6P1+ilsTVaYaESYTCbKcfVD/ZBr0JiVSV8A0kBpux8OIUbZhcCbAC3XttnPwEGYr sIGNEHtLbjjMRj9DDqY7PEF4nKOuHdq7kyxfjo/xsInvA+HUdZHe3FMTsHROVFWKms fbAfere5gNLL1ACirQm9YDHA4bRw3+SHp/Mkapf/6f7V8sAuHL7oDNEaEkB6qul/pT Cx/jFckJB3rTnRysbcdiGfUvja32NB1ccF7OJNyzyAAKRogcpsWKiEedx9mBTy8d0W Id0x4lMOhleqENi5HN2sxqI4nOqKczbJP3vYAyVFs7bvhDIzYaWXJayGf3BHVTlTSB dQ6dzWj6vDyyA== Received: by mail-oi1-f178.google.com with SMTP id w127so3159299oiw.8; Wed, 05 Oct 2022 07:23:34 -0700 (PDT) X-Gm-Message-State: ACrzQf2D9WEQyxTtYvIbApEewngZ5B9KtXWjBqXMjk/SzVqRfFS5mozP 7xJqPcRtJ9D+2qpckOmIAVdnavOefV2uFttxxGo= X-Received: by 2002:aca:6155:0:b0:353:e740:ce01 with SMTP id v82-20020aca6155000000b00353e740ce01mr2320511oib.19.1664979813453; Wed, 05 Oct 2022 07:23:33 -0700 (PDT) MIME-Version: 1.0 References: <20221003223222.448551-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221003223222.448551-3-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: Guo Ren Date: Wed, 5 Oct 2022 22:23:21 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 2/2] soc: renesas: Add L2 cache management for RZ/Five SoC To: "Lad, Prabhakar" Cc: Geert Uytterhoeven , Paul Walmsley , Palmer Dabbelt , Albert Ou , Rob Herring , Krzysztof Kozlowski , Magnus Damm , Heiko Stuebner , Conor Dooley , Philipp Tomsich , Nathan Chancellor , Atish Patra , Anup Patel , linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Wed, Oct 5, 2022 at 8:54 PM Lad, Prabhakar wrote: > > Hi Guo, > > On Wed, Oct 5, 2022 at 2:29 AM Guo Ren wrote: > > > > On Tue, Oct 4, 2022 at 6:32 AM Prabhakar wrote: > > > > > > From: Lad Prabhakar > > > > > > On the AX45MP core, cache coherency is a specification option so it may > > > not be supported. In this case DMA will fail. As a workaround, firstly we > > > allocate a global dma coherent pool from which DMA allocations are taken > > > and marked as non-cacheable + bufferable using the PMA region as specified > > > in the device tree. Synchronization callbacks are implemented to > > > synchronize when doing DMA transactions. > > > > > > The Andes AX45MP core has a Programmable Physical Memory Attributes (PMA) > > > block that allows dynamic adjustment of memory attributes in the runtime. > > > It contains a configurable amount of PMA entries implemented as CSR > > > registers to control the attributes of memory locations in interest. > > > > > > Below are the memory attributes supported: > > > * Device, Non-bufferable > > > * Device, bufferable > > > * Memory, Non-cacheable, Non-bufferable > > > * Memory, Non-cacheable, Bufferable > > > * Memory, Write-back, No-allocate > > > * Memory, Write-back, Read-allocate > > > * Memory, Write-back, Write-allocate > > > * Memory, Write-back, Read and Write-allocate > > Seems Svpbmt's PMA, IO, and NC wouldn't fit your requirements, could > > give a map list of the types of Svpbmt? And give out what you needed, > > but Svpbmt can't. > > > Sorry I didn't get what you meant here, could you please elaborate. I know there is no pbmt in AX45MP, I am just curious how many physical memory attributes you would use in linux? It seems only one type used in the series: cpu_nocache_area_set -> sbi_ecall(SBI_EXT_ANDES, SBI_EXT_ANDES_SET_PMA, offset, vaddr, size, entry_id, 0, 0); I'm not sure how you make emmc/usb/gmac's dma ctrl desc work around without pbmt when they don't have cache coherency protocol. Do you need to inject dma_sync for desc synchronization? What's the effect of dynamic PMA in the patch series? Thx. > > > Here is the Linux dma type to Svpbmt map: > > PMA -> Normal > > IO -> ioremap, pgprot_noncached > > NC -> pgprot_writecombine > > > > How about AX45MP? > > > Svpbmt extension is not supported on AX45MP (reported by > riscv_isa_extension_available()) > > Cheers, > Prabhakar -- Best Regards Guo Ren