Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2724237rdb; Tue, 12 Sep 2023 10:06:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG6LHcJwSt9BOxP+pBIfijnKeewlkT2f2Y/eXADEOB2C488wUglAq+JUKYcFtHeLD6yOcq8 X-Received: by 2002:a05:6a00:1583:b0:68e:4587:3da9 with SMTP id u3-20020a056a00158300b0068e45873da9mr397590pfk.17.1694538364891; Tue, 12 Sep 2023 10:06:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694538364; cv=none; d=google.com; s=arc-20160816; b=aMaCnXFMqzOCja2nHBSgDu+iZdxoGgs/EyeQbIdNbj9pUBfCJOM61rgCGInB6VZz/N HltoDBZ1wiFOly131oiqQv3FODCTQ7WmcLO3lnAOF28hy3w8EEjFbu9l3Hr3+1jyALpY wm2gGuC9sFqWQ0adQJ4GogRw1kgQ+mhw6Uv+7LIYvh040AwXIRNrxq6d5zJYBbmQ6CLt EUAMbGEfkChgDswiIujF4vhf9RLMuThkaF4n4MMHlC+MOBEpKssO9JB8xykuaFnTffh0 J3kvoROQMX4y4kD/eDLSS87188euhbgi71stnk/qrjail2CjZZnus2BRPnvvgQvQV3q1 qSBg== 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 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id q24-20020a638c58000000b00577448019cbsi6239970pgn.841.2023.09.12.10.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 10:06:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; 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 23.128.96.34 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 C6AE7802461F; Tue, 12 Sep 2023 00:37:14 -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 S231688AbjILHhQ (ORCPT + 99 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 ); 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 ; 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 To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Guo Ren , Drew Fustini 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: 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:14 -0700 (PDT) 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 Reviewed-by: Guo Ren Tested-by: Drew Fustini --- 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