Message ID | 20230912072510.2510-1-jszhang@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp552379vqx; Tue, 12 Sep 2023 10:06:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfCoxertY4xSVLLEaha+IrJCytqdujg69cYHc2PzCbsKA93lSKZDq1Dot3+4GK0svRB5+e X-Received: by 2002:a17:90b:384e:b0:262:ba7f:30cd with SMTP id nl14-20020a17090b384e00b00262ba7f30cdmr10144311pjb.31.1694538401992; Tue, 12 Sep 2023 10:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694538401; cv=none; d=google.com; s=arc-20160816; b=0yu31d2lxbx7R8CVVxgGMi0+VZpV+/wmefsHJekLgJkqMTvWKPAW3g0rTqqlRHXxw8 fFbED26AAHCM9xLpJJioipssOD0SrpNu9jTTp/EKEVeKfC62Kejk1Zpf81IcAGvzZqrG 4wk3a+quHlUq22Z5YY1uY5VfJvVi5ZPjo+2h+uNwUGBaXbUq/qosi9bwfIjPeaq6vuQE rTXwfQj7CXEmZLtXOT2U9LINYIA83RYauRXNAHkTpMYXDipZALw3t0QF9VPTd+5GcDJ8 wkM8OB8O2pn8VPFFiC7b1KCDLdjVSTEiGktDdbhtOZvenrcu4dvcsUpYbjuNyzteH6n9 x6IQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=URztHhJ3CdiJbLh123RX6f/hIflqfiSUABIsEPVMMMI=; fh=3qRrABpb+1EVpoK5NGEdR+sXhIOD5YxET8exjV6jbTU=; b=bEbpOXfQzi9PSIkkowl1D6hKSEqaWqaCEg5iKrvl4L2hvg931UNWDU44Eh9/BTVdw9 uHK4tVVqgeICB87v/b1q0aK3OzAvr2dgBy0AcWO9P98hj2qEKLqyMM5rr0NR08rLMjai J6G3JXjFYE+E1niT27f30gL+B1iajPazWtAxz1Fmsj+4E15RqAhHdKq8jS46NondcjDd kfa2vCUs1V/mOe4oBHxHWzxscvRa8GbCAVnQ1yQJEfMWqYyGyfwwGJcN23hV6Kb5Qjn4 sVHweTQHXA5oJDbAYL+UJgcqgQXHyRhAA6RHDBCcfjeEuSjZMrGvLOe2OOVgavMr79ta 4f7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rh64MUnC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id n11-20020a17090a9f0b00b002740f52e526si4026353pjp.139.2023.09.12.10.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 10:06:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rh64MUnC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id DCFD1825CD1C; Tue, 12 Sep 2023 00:37:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231691AbjILHhQ (ORCPT <rfc822;pwkd43@gmail.com> + 39 others); Tue, 12 Sep 2023 03:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231689AbjILHhP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 12 Sep 2023 03:37:15 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF987E73 for <linux-kernel@vger.kernel.org>; Tue, 12 Sep 2023 00:37:11 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED340C433C7; Tue, 12 Sep 2023 07:37:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694504231; bh=E+RlzXrhxC9sJ+1xCsa1js9BLmbDx0kmE855Vv+kmoU=; h=From:To:Cc:Subject:Date:From; b=rh64MUnCsOxItgPHmycfAF99QqwrG5YZvkmo5UIvlDpZ9PGj0V/H7jL3fToAoaDCF N7vppkH/RE4oc6W6ik7pFu0LThkmq5gbtPIS1XtXF1Tb00S//F6qiTfjHqKsXOvZ4J u7Cs1vy2JiPKY+PsX3mIa7wfDjl1f7eftvxUBzx+ginILHllH7cr9IrLlvmi2c/gM1 ihP+fSM7vkHF4QR33ViLUYNBR1YaB1EwXrxy+5vCguw24tkx2mD90HJyTKBv4LHlFT Npx6x/9+qjTm/w8NnH2UizDFZLr+OBV6C1ZRqUsOIe6rwA5ZfhnwtGZwwkuET7aOVB cV4LX0jvcsvdA== From: Jisheng Zhang <jszhang@kernel.org> To: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu> Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Guo Ren <guoren@kernel.org>, Drew Fustini <dfustini@baylibre.com> Subject: [PATCH v2] riscv: mm: update T-Head memory type definitions Date: Tue, 12 Sep 2023 15:25:10 +0800 Message-Id: <20230912072510.2510-1-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 00:37:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776852299239027454 X-GMAIL-MSGID: 1776852299239027454 |
Series |
[v2] riscv: mm: update T-Head memory type definitions
|
|
Commit Message
Jisheng Zhang
Sept. 12, 2023, 7:25 a.m. UTC
Update T-Head memory type definitions according to C910 doc [1] For NC and IO, SH property isn't configurable, hardcoded as SH, so set SH for NOCACHE and IO. And also set bit[61](Bufferable) for NOCACHE according to the table 6.1 in the doc [1]. Link: https://github.com/T-head-Semi/openc910 [1] Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Guo Ren <guoren@kernel.org> Tested-by: Drew Fustini <dfustini@baylibre.com> --- Since v1: - collect Reviewed-by and Tested-by tag - rebase on linux 6.6-rc1 arch/riscv/include/asm/pgtable-64.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
Comments
On Tue, Sep 12, 2023 at 03:25:10PM +0800, Jisheng Zhang wrote: > Update T-Head memory type definitions according to C910 doc [1] > For NC and IO, SH property isn't configurable, hardcoded as SH, > so set SH for NOCACHE and IO. > > And also set bit[61](Bufferable) for NOCACHE according to the > table 6.1 in the doc [1]. > > Link: https://github.com/T-head-Semi/openc910 [1] > Signed-off-by: Jisheng Zhang <jszhang@kernel.org> > Reviewed-by: Guo Ren <guoren@kernel.org> > Tested-by: Drew Fustini <dfustini@baylibre.com> Hi Palmer, I believe this is a fix, could you please review and take it for 6.6 fix? Thanks > --- > > Since v1: > - collect Reviewed-by and Tested-by tag > - rebase on linux 6.6-rc1 > > arch/riscv/include/asm/pgtable-64.h | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h > index 7a5097202e15..9a2c780a11e9 100644 > --- a/arch/riscv/include/asm/pgtable-64.h > +++ b/arch/riscv/include/asm/pgtable-64.h > @@ -126,14 +126,18 @@ enum napot_cont_order { > > /* > * [63:59] T-Head Memory Type definitions: > - * > - * 00000 - NC Weakly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable > + * bit[63] SO - Strong Order > + * bit[62] C - Cacheable > + * bit[61] B - Bufferable > + * bit[60] SH - Shareable > + * bit[59] Sec - Trustable > + * 00110 - NC Weakly-ordered, Non-cacheable, Bufferable, Shareable, Non-trustable > * 01110 - PMA Weakly-ordered, Cacheable, Bufferable, Shareable, Non-trustable > - * 10000 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable > + * 10010 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Shareable, Non-trustable > */ > #define _PAGE_PMA_THEAD ((1UL << 62) | (1UL << 61) | (1UL << 60)) > -#define _PAGE_NOCACHE_THEAD 0UL > -#define _PAGE_IO_THEAD (1UL << 63) > +#define _PAGE_NOCACHE_THEAD ((1UL < 61) | (1UL << 60)) > +#define _PAGE_IO_THEAD ((1UL << 63) | (1UL << 60)) > #define _PAGE_MTMASK_THEAD (_PAGE_PMA_THEAD | _PAGE_IO_THEAD | (1UL << 59)) > > static inline u64 riscv_page_mtmask(void) > -- > 2.40.1 > > > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv
On Wed, 04 Oct 2023 05:07:35 PDT (-0700), jszhang@kernel.org wrote: > On Tue, Sep 12, 2023 at 03:25:10PM +0800, Jisheng Zhang wrote: >> Update T-Head memory type definitions according to C910 doc [1] >> For NC and IO, SH property isn't configurable, hardcoded as SH, >> so set SH for NOCACHE and IO. >> >> And also set bit[61](Bufferable) for NOCACHE according to the >> table 6.1 in the doc [1]. >> >> Link: https://github.com/T-head-Semi/openc910 [1] >> Signed-off-by: Jisheng Zhang <jszhang@kernel.org> >> Reviewed-by: Guo Ren <guoren@kernel.org> >> Tested-by: Drew Fustini <dfustini@baylibre.com> > > Hi Palmer, > > I believe this is a fix, could you please review and take it for 6.6 > fix? Sorry for being slow, I'm still pretty behind from getting COVID and such. This LGTM, it's queued up for testing and it'll show up on for-next assuming everything passes. > > Thanks > >> --- >> >> Since v1: >> - collect Reviewed-by and Tested-by tag >> - rebase on linux 6.6-rc1 >> >> arch/riscv/include/asm/pgtable-64.h | 14 +++++++++----- >> 1 file changed, 9 insertions(+), 5 deletions(-) >> >> diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h >> index 7a5097202e15..9a2c780a11e9 100644 >> --- a/arch/riscv/include/asm/pgtable-64.h >> +++ b/arch/riscv/include/asm/pgtable-64.h >> @@ -126,14 +126,18 @@ enum napot_cont_order { >> >> /* >> * [63:59] T-Head Memory Type definitions: >> - * >> - * 00000 - NC Weakly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable >> + * bit[63] SO - Strong Order >> + * bit[62] C - Cacheable >> + * bit[61] B - Bufferable >> + * bit[60] SH - Shareable >> + * bit[59] Sec - Trustable >> + * 00110 - NC Weakly-ordered, Non-cacheable, Bufferable, Shareable, Non-trustable >> * 01110 - PMA Weakly-ordered, Cacheable, Bufferable, Shareable, Non-trustable >> - * 10000 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable >> + * 10010 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Shareable, Non-trustable >> */ >> #define _PAGE_PMA_THEAD ((1UL << 62) | (1UL << 61) | (1UL << 60)) >> -#define _PAGE_NOCACHE_THEAD 0UL >> -#define _PAGE_IO_THEAD (1UL << 63) >> +#define _PAGE_NOCACHE_THEAD ((1UL < 61) | (1UL << 60)) >> +#define _PAGE_IO_THEAD ((1UL << 63) | (1UL << 60)) >> #define _PAGE_MTMASK_THEAD (_PAGE_PMA_THEAD | _PAGE_IO_THEAD | (1UL << 59)) >> >> static inline u64 riscv_page_mtmask(void) >> -- >> 2.40.1 >> >> >> _______________________________________________ >> linux-riscv mailing list >> linux-riscv@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-riscv
Hello: This patch was applied to riscv/linux.git (for-next) by Palmer Dabbelt <palmer@rivosinc.com>: On Tue, 12 Sep 2023 15:25:10 +0800 you wrote: > Update T-Head memory type definitions according to C910 doc [1] > For NC and IO, SH property isn't configurable, hardcoded as SH, > so set SH for NOCACHE and IO. > > And also set bit[61](Bufferable) for NOCACHE according to the > table 6.1 in the doc [1]. > > [...] Here is the summary with links: - [v2] riscv: mm: update T-Head memory type definitions https://git.kernel.org/riscv/c/dbfbda3bd6bf You are awesome, thank you!
diff --git a/arch/riscv/include/asm/pgtable-64.h b/arch/riscv/include/asm/pgtable-64.h index 7a5097202e15..9a2c780a11e9 100644 --- a/arch/riscv/include/asm/pgtable-64.h +++ b/arch/riscv/include/asm/pgtable-64.h @@ -126,14 +126,18 @@ enum napot_cont_order { /* * [63:59] T-Head Memory Type definitions: - * - * 00000 - NC Weakly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable + * bit[63] SO - Strong Order + * bit[62] C - Cacheable + * bit[61] B - Bufferable + * bit[60] SH - Shareable + * bit[59] Sec - Trustable + * 00110 - NC Weakly-ordered, Non-cacheable, Bufferable, Shareable, Non-trustable * 01110 - PMA Weakly-ordered, Cacheable, Bufferable, Shareable, Non-trustable - * 10000 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Non-shareable, Non-trustable + * 10010 - IO Strongly-ordered, Non-cacheable, Non-bufferable, Shareable, Non-trustable */ #define _PAGE_PMA_THEAD ((1UL << 62) | (1UL << 61) | (1UL << 60)) -#define _PAGE_NOCACHE_THEAD 0UL -#define _PAGE_IO_THEAD (1UL << 63) +#define _PAGE_NOCACHE_THEAD ((1UL < 61) | (1UL << 60)) +#define _PAGE_IO_THEAD ((1UL << 63) | (1UL << 60)) #define _PAGE_MTMASK_THEAD (_PAGE_PMA_THEAD | _PAGE_IO_THEAD | (1UL << 59)) static inline u64 riscv_page_mtmask(void)