Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4342011rwb; Mon, 31 Jul 2023 05:38:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlFaOGX292/FviHxsL9i/ejdSLUcDNHKfm0z3cOtzGhTUdGRK3W8REbkdRu1SP8/IY7YeOde X-Received: by 2002:a05:6512:1591:b0:4f6:d7b:2f19 with SMTP id bp17-20020a056512159100b004f60d7b2f19mr6383065lfb.24.1690807090545; Mon, 31 Jul 2023 05:38:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690807090; cv=none; d=google.com; s=arc-20160816; b=HGnTKeenLlrIboJqiT3zB5hgyyFWymrLlyTueXVfoSiuRIvl2SGjv+rgWhqlh9IIQ3 Dmb+zRc8DuLJxSWkhBDHoy4b7ELaDY3Nt+1ZE7Hx3v3vqj5PiJqViZfPFNTpopT8nX24 6RgxIWdjG/Ra1SDt2r08gaoIDBsP19arwS8h+H6EGdI7fgPKdciRlSqNWA4LAou6P+om M5eWfWA/TiFKOUOSaXV/K2Y2+Py1RZcm6kw2vU+qUqwaaf1YK5M3b23qlvGcNuGCJeTe 9ADzJXwDAs9/Jx/UKt+cWslhSifbK1SWKlH4SPdOkB2il9ak2H6GLXLYaKbDWYI1Iphk D7bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iJH1cy35Z/dyiXUx/UDotPeNv2Pad/0I0FqjA2xNQj4=; fh=FfIXM7A67ShcP3RJ6FoImXcD5/6RmHXsjifl7BnOrMY=; b=PB7bJh+LIwyC0CcQVU1/VtiTBVyZ2KbaxmQ6fa6PnQKDMvTiOoyDd3sAFY/nYsDoXj kMgW4WcK8z4hRD2OUpFJdWrTSkcH8MN1w1HBQTKrkyRCCH7wBAsX9V/mwJuasS5O9lAj eFvk5GEUJTD8CvQG1F7ltTdU5xAEJEw0T08EjB5T+ijT1XmZI/nTT0qy8xf7wvB/Ps+Z AGMzJwCBj3Nn/8CS1O7fsPAboR5K9w8fxLx3WIqYOZDlgUdjmJb15Uxyj3X8ZrwLcsmc MS4RD2zdi22w1tjy45WT0/RZHCYkGX/8FDad8U4cpiq37m/Uc4pDFl02gTn+c5CPireT r8VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=plT+MBU3; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020aa7d502000000b00522c0ee05d9si1937763edq.241.2023.07.31.05.37.43; Mon, 31 Jul 2023 05:38:10 -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=@gmail.com header.s=20221208 header.b=plT+MBU3; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjGaL1a (ORCPT + 99 others); Mon, 31 Jul 2023 07:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbjGaL11 (ORCPT ); Mon, 31 Jul 2023 07:27:27 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A0761B7; Mon, 31 Jul 2023 04:27:25 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7835c92c373so124111739f.0; Mon, 31 Jul 2023 04:27:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690802845; x=1691407645; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iJH1cy35Z/dyiXUx/UDotPeNv2Pad/0I0FqjA2xNQj4=; b=plT+MBU3MkIi3vHhGqYT2gFxn21ipFMcDu9L6V5v+UgoVt4UGJlSS7WtHGYB9h0nCj K6BDb8/scVUG8sgmvxsf473s58PVntywrvrJHDMQHkO8CGZETtaK4iE7wdHqOWGFYMWb MVn58+aWvHr5jLaUMglvUC1usTA0tefQBkfTsQFOBeEtvI7LbH0CVX1VX4ltOdZSBzgP XyS7LBYth80zcJMyJoJsTq+GKr/Wk4wgEbT/0ZibfTgEcO5kTKopATwBVvF+DlC/+KwM 76UXLEgiIpIZUKDz7HObHG8ua0xBkPlIf8PrQubuFj+cXtEjBWotJSQPAbc2jZ+ys/Ga fFtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690802845; x=1691407645; h=content-transfer-encoding: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=iJH1cy35Z/dyiXUx/UDotPeNv2Pad/0I0FqjA2xNQj4=; b=MSuYJdRtSVDdxGxuiE3EPXgKiAZsmiWLJiSl91F4VIaZ+lVU9LrqvrOhzSQXJDgXAc gosP6WUzkN8zG4wrOT+dhxGzNxhSeWg91wh555QXic66IJMepUMe7TPwGKgApGbmMJfV IcmrtXB46O2lpjkuw3Dqpr8WDUKIGy3B9lErEZJtUJdjYt3XvucEXwdld8lSprsA+C2T l+JG3Ds22M51P3TG0rFS9f0RNKVwdJVsp8GewL/yxJo3NuFqefONip9UfoxEi/YpCFpC r+TL4/ZMp1t9VXJ89V6+APbQIZqtHlD77f2xO+Un30rXxzxhgHUjwWmkn/Sont5BJ35s Y7ow== X-Gm-Message-State: ABy/qLbKAVl1scsU9b3Zn3qmBFyz89GBPpaRLyN/HRaGG+ABS1OerGt2 u1RmmICqZVBznPkLqnnATeIP/LozJ32jF1Fea5c= X-Received: by 2002:a05:6602:381:b0:783:4135:5b96 with SMTP id f1-20020a056602038100b0078341355b96mr8488367iov.5.1690802844941; Mon, 31 Jul 2023 04:27:24 -0700 (PDT) MIME-Version: 1.0 References: <20230702203429.237615-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20230702203429.237615-6-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Mon, 31 Jul 2023 12:26:58 +0100 Message-ID: Subject: Re: [PATCH v10 5/6] cache: Add L2 cache management for Andes AX45MP RISC-V core To: Emil Renner Berthing Cc: Arnd Bergmann , Conor Dooley , Geert Uytterhoeven , Guo Ren , Andrew Jones , Paul Walmsley , Palmer Dabbelt , Albert Ou , Samuel Holland , linux-riscv@lists.infradead.org, Christoph Hellwig , Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Emil, Thank you for the review. On Mon, Jul 31, 2023 at 9:53=E2=80=AFAM Emil Renner Berthing wrote: > > On Sun, 2 Jul 2023 at 22:37, 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 (PM= A) > > block that allows dynamic adjustment of memory attributes in the runtim= e. > > 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. > > > > +static const struct riscv_cache_ops ax45mp_cmo_ops =3D { > > + .wback =3D &ax45mp_dma_cache_wback, > > + .inv =3D &ax45mp_dma_cache_inv, > > + .wback_inv =3D &ax45mp_dma_cache_wback_inv, > > +}; > > Hi Prabhakar, > > If you're respinning this patchset anyway, I think you can mark this > struct as __initdata since it's only used by > riscv_noncoherent_register_cache_ops which copies the contents. > Agreed, I will update it in the next version. Cheers, Prabhakar