Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp2347364rwi; Tue, 1 Nov 2022 06:49:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM77Aql17bx6cKEXhniUCAMN4rzt+DYLKwmicJXSonnEvGA/P7Ugtvm8eD4d3rZNt839eYjs X-Received: by 2002:a17:90a:2fcb:b0:213:a774:6bf0 with SMTP id n11-20020a17090a2fcb00b00213a7746bf0mr19227139pjm.143.1667310540399; Tue, 01 Nov 2022 06:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667310540; cv=none; d=google.com; s=arc-20160816; b=L3EqT3BrLwBOrb0qLnCx+q9YUe6Don7OiWKLf1Dk1mLhymFgmNBvyXCPXTGLNEcm1j +Uhzk5xItrIN9uZHHuBSFPEUYQk8jlFCa99UZ86p4T02/COnyLTH4q6Uk6rQ8d8bspXo dvWHzOINEo9B97UG0uTWafJZXWy1qTDyxRYiwEMFx5J8rf6b4SO0gJH6EgRnYxcYwypl N/VUL3KXDG7C8S2eU0vFeuYWAK2QrZUcitsYDEYlUNRHZybraLNHH905zz/UDfuisweI 1mi8/6MAqeWOrCBePSnJDzWiLbk9INK8fzdvpTot8HJhEQwS/veZJr3PfXT4/f0+pD+0 aSUA== 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=K+9k3LzVJhLHOoT31IHmRkr9T7Wq3FpXbHH08Qx0zJI=; b=AGd9Eto3f5lFl5dCI4vlz7z1oXeL1WeQ6qSJPo5QumeMxekuwvv5kQVXfPMnD/ElxG D+jYvehsPPT9OudKl5m/G/A1UWwu1AAKB6tHIonEveKcO7gqcbcNY9z83gTtLnd74gXr 5KB1yUjTd4tDE7J+BCMqNqs6p7p/FPIEqQLGZZU/Y/AipG9053fjYkFJSRxiFNChLx1Z 7YlZhhk0jGF+yGREPGsK27jlHt4ztMtYXRI4fyfUo4ieNL8SS59lGi+k0egVlwbDRgSZ /cg0gDaBRFDDb8zXZPLd0gjkU44opzPcjY1HgU/FwtF0Wt4WAEr355WhvwawgCp7HfDq GyTQ== 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 e20-20020a63d954000000b004637c92d7ecsi12273664pgj.129.2022.11.01.06.48.47; Tue, 01 Nov 2022 06:49:00 -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; 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 S229867AbiKANi2 (ORCPT + 96 others); Tue, 1 Nov 2022 09:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbiKANi0 (ORCPT ); Tue, 1 Nov 2022 09:38:26 -0400 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5D82BF; Tue, 1 Nov 2022 06:38:23 -0700 (PDT) Received: by mail-qk1-f175.google.com with SMTP id l9so9496640qkk.11; Tue, 01 Nov 2022 06:38:23 -0700 (PDT) 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=K+9k3LzVJhLHOoT31IHmRkr9T7Wq3FpXbHH08Qx0zJI=; b=hW3kqn5frCNP7gxKzAdzOtsJ9VgAwsuQTKx2Nz0m9VKva4jfVyoeKzcmCZzObepQUz X5koGoueEDyIwKUZUA7Ctyq2GOCqLrC3X2OHm1vFokePLGJk3qLAQZrdw0OQFqkt5uxA XeTicxUoyT/wYCydeOeKCkMAs5xGl/bJ68XjfxOokviuvWYNRjIJd1DPYlbwSlxI+3uM kWhIdbp/yHwoxYDCh+GKq6LMOUmuvra4zN/9JxBuUZXHYHtgxNWYovvncx4Uo6+QfSf9 A/jKIn4na+pNnkzqY/AJCMI7WEvk+ELuOKvWW9NQjqZuu1QP9IAm80gL6r8+HWb5d7oN pDDQ== X-Gm-Message-State: ACrzQf3k+UnZpEyb1VLvIiDhbno6Nu6Qz9HQsii4pAryw/wLuHkhZOdY KnVI3d6v5BZExflWbzsPQJ6M2KhQR4+zKQ== X-Received: by 2002:a05:620a:1438:b0:6fa:2196:20fd with SMTP id k24-20020a05620a143800b006fa219620fdmr9671701qkj.78.1667309901708; Tue, 01 Nov 2022 06:38:21 -0700 (PDT) Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com. [209.85.128.177]) by smtp.gmail.com with ESMTPSA id w128-20020a379486000000b006ce76811a07sm6511365qkd.75.2022.11.01.06.38.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Nov 2022 06:38:20 -0700 (PDT) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-3321c2a8d4cso136323477b3.5; Tue, 01 Nov 2022 06:38:20 -0700 (PDT) X-Received: by 2002:a81:12c8:0:b0:36a:bd6b:92fb with SMTP id 191-20020a8112c8000000b0036abd6b92fbmr17487708yws.316.1667309900285; Tue, 01 Nov 2022 06:38:20 -0700 (PDT) MIME-Version: 1.0 References: <20221019220242.4746-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221019220242.4746-3-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: <20221019220242.4746-3-prabhakar.mahadev-lad.rj@bp.renesas.com> From: Geert Uytterhoeven Date: Tue, 1 Nov 2022 14:38:09 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v3 2/2] soc: renesas: Add L2 cache management for RZ/Five SoC To: Prabhakar Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Magnus Damm , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Conor Dooley , Guo Ren , Nick Desaulniers , Nathan Chancellor , Atish Patra , Anup Patel , Andrew Jones , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-renesas-soc@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_H2,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 Thu, Oct 20, 2022 at 12:02 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 > > This patch adds support to configure the memory attributes of the memory > regions as passed from the l2 cache node and exposes the cache management > ops. > > More info about PMA (section 10.3): > http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf > > This feature is based on the work posted [0] by Vincent Chen > for the Andes AndeStart RISC-V CPU. > > [0] https://lore.kernel.org/lkml/1540982130-28248-1-git-send-email-vincentc@andestech.com/ > > Signed-off-by: Lad Prabhakar Thanks for your patch! > --- a/arch/riscv/include/asm/errata_list.h > +++ b/arch/riscv/include/asm/errata_list.h > @@ -89,6 +89,7 @@ asm volatile(ALTERNATIVE( \ > #define ALT_THEAD_PMA(_val) > #endif > > +#ifdef CONFIG_ERRATA_THEAD_CMO > /* > * dcache.ipa rs1 (invalidate, physical address) > * | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 | > @@ -143,5 +144,6 @@ asm volatile(ALTERNATIVE_2( \ > : "a0") > > #endif /* __ASSEMBLY__ */ > +#endif FTR, the new #endif should be above the old #endif. I noticed because after rebasing on top of commit 65e9fb081877a18c ("drivers/perf: riscv_pmu_sbi: add support for PMU variant on T-Head C9xx cores") in riscv/for-next, the build failed because the new ALT_SBI_PMU_OVERFLOW() definition ended up inside both #endifs, instead of between. 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