Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp844005rwb; Thu, 15 Dec 2022 03:16:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4CdCeAW/2I58eAXQatcfwDSPYKTPqXQhOmn3d5EcM1rDOkooaO9jWLcLy6NoiagqCACVnw X-Received: by 2002:a05:6402:3215:b0:470:362f:6ba9 with SMTP id g21-20020a056402321500b00470362f6ba9mr10039983eda.41.1671102979478; Thu, 15 Dec 2022 03:16:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671102979; cv=none; d=google.com; s=arc-20160816; b=Qc1aqLJddSFrIyijIGDEUa63JR02hqm+HRVZnSFsOxJxygwNr/d358CIqiLjADylNb +di+X3e0ETw9C0dIcpusBg0jda4D7alu+f0cjy/DSHdAlpiciAStkpZybgJmhf51Yqn1 XuKXYMvm2WAwbs4/WwCDLHalAjE+Cq0I6Qy/DRxfemsCTcDD/2NqADKqWhQ5eeWQUKUA jvkwSUB5eK1/yz0Fj6ngvNEne2dnKRDTxiEjyOOHU3/HOLD4bmq4ZsVw7bBXADUsJTE9 lbOBMJVbEpdc1cmFxBGIS8Hn8DCzP4Zad/DLePZEgXm8haMTEuObnoEqIfdyA/7Rr6ld u+0g== 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; bh=cXs1XYWr/pP458PMqmcZ7/vhvq2oQvHQUyPM29QzkCE=; b=t+fPyYaFTFoSD7zItbhvcIxi7+irbVSZd86VfBeEoPQu0P6/BdzRhc790Z3nvEA2lT 9d82qvH1aWnbefveNgiSyOPxwUbeyickwHkbDknhK3DMxaz5KJaAMOwnqEp0NUakh9Bv FzYQWMEzC/ffPVpse8Jo1z7ik+BTuUBIrP1VFnGCmxG5qFJio6itK0ODbdWMqpb30K4N XUq96w0Dua11iFxmlYcuddvxy5fpLeBEvDkzQnR/c9TaNB8rdS26urfZZbo30Q/jjlcY t16aX3ytVD0Yv4AUGzuAmWlzUWLVKrgmW1A3ljRtAJ7RGkUWLSBQMKM+SxDPgLrG+N+J ir/g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c16-20020aa7df10000000b0046c33d9ea8csi13031125edy.599.2022.12.15.03.16.02; Thu, 15 Dec 2022 03:16:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbiLOKfV (ORCPT + 69 others); Thu, 15 Dec 2022 05:35:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiLOKfH (ORCPT ); Thu, 15 Dec 2022 05:35:07 -0500 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E22D52CCA1; Thu, 15 Dec 2022 02:35:04 -0800 (PST) Received: by mail-qt1-f173.google.com with SMTP id h16so4797028qtu.2; Thu, 15 Dec 2022 02:35:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cXs1XYWr/pP458PMqmcZ7/vhvq2oQvHQUyPM29QzkCE=; b=dUmOC/XFaW+k85IcvvfWC9J7qKx4561NkX7OUPDr2fiXPmd0hB2DEgREsDeoRdD1iO Zbp1YFH7ARspk7MFPMLoXQwBTIAPDFSbfzvWoGk1T9TSjs7tLXEquzBnuRJlESDb4ziQ MP5POmMJCSN/3MxIlzkkxK3UksB+4p7kT+wW5m0p+fR8BUIhmL7McSWji7RGbRoIuoaU h0utFuzaq8g//UUlGaxf1lY+LqoF9CU4HZdUS34OsD1ChNGrl3y35bZhuFXj+nvWdVwX APEIuiEGPsGsrHsvcilE/Nlk9JBF6YngU7NLgxyG6zZlXI4Xpet8kOzU0BSltTJ+6zI7 Z1Cw== X-Gm-Message-State: ANoB5pmx4i8m3bFQc1HIBAMk5sO4qUDTiaIuOarEhrQPLD2d2Tin2jSU ob1Iupcf7KCkVCfWa3j+1FSgNMwn4oUipg== X-Received: by 2002:ac8:708b:0:b0:3a5:74e5:8b81 with SMTP id y11-20020ac8708b000000b003a574e58b81mr15180451qto.21.1671100503469; Thu, 15 Dec 2022 02:35:03 -0800 (PST) Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com. [209.85.219.174]) by smtp.gmail.com with ESMTPSA id s8-20020a05620a29c800b006fba0a389a4sm12185241qkp.88.2022.12.15.02.35.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 15 Dec 2022 02:35:02 -0800 (PST) Received: by mail-yb1-f174.google.com with SMTP id c140so2932150ybf.11; Thu, 15 Dec 2022 02:35:01 -0800 (PST) X-Received: by 2002:a25:7104:0:b0:702:90b4:2e24 with SMTP id m4-20020a257104000000b0070290b42e24mr13843656ybc.365.1671100501623; Thu, 15 Dec 2022 02:35:01 -0800 (PST) MIME-Version: 1.0 References: <20221212115505.36770-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221212115505.36770-7-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20221212115505.36770-7-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Geert Uytterhoeven Date: Thu, 15 Dec 2022 11:34:48 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 6/6] soc: renesas: Add L2 cache management for RZ/Five SoC To: Prabhakar Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Geert Uytterhoeven , Magnus Damm , Heiko Stuebner , Conor Dooley , Samuel Holland , Guo Ren , Rob Herring , Krzysztof Kozlowski , Jisheng Zhang , Atish Patra , Anup Patel , Andrew Jones , Nathan Chancellor , Philipp Tomsich , devicetree@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no 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 Prabhakar, On Mon, Dec 12, 2022 at 12:58 PM Prabhakar wrote: > From: Lad Prabhakar > > I/O Coherence Port (IOCP) provides an AXI interface for connecting > external non-caching masters, such as DMA controllers. The accesses > from IOCP are coherent with D-Caches and L2 Cache. > > IOCP is a specification option and is disabled on the Renesas RZ/Five > SoC due to this reason IP blocks using DMA will fail. > > 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 > > More info about PMA (section 10.3): > Link: http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf > > As a workaround for SoCs with IOCP disabled CMO needs to be handled by > software. Firstly OpenSBI configures the memory region as > "Memory, Non-cacheable, Bufferable" and passes this region as a global > shared dma pool as a DT node. With DMA_GLOBAL_POOL enabled all DMA > allocations happen from this region and synchronization callbacks are > implemented to synchronize when doing DMA transactions. > > Example PMA region passes as a DT node from OpenSBI: > reserved-memory { > #address-cells = <2>; > #size-cells = <2>; > ranges; > > pma_resv0@58000000 { > compatible = "shared-dma-pool"; > reg = <0x0 0x58000000 0x0 0x08000000>; > no-map; > linux,dma-default; > }; > }; > > Signed-off-by: Lad Prabhakar Thanks for your patch! > arch/riscv/include/asm/cacheflush.h | 8 + > arch/riscv/include/asm/errata_list.h | 28 ++- > drivers/soc/renesas/Kconfig | 6 + > drivers/soc/renesas/Makefile | 2 + > drivers/soc/renesas/rzfive/Kconfig | 6 + > drivers/soc/renesas/rzfive/Makefile | 3 + > drivers/soc/renesas/rzfive/ax45mp_cache.c | 256 ++++++++++++++++++++++ Given this touches arch/riscv/include/asm/, I don't think the code belongs under drivers/soc/renesas/. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds