From patchwork Wed Mar 27 10:31:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christoph_M=C3=BCllner?= X-Patchwork-Id: 13606153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4EC93CD1283 for ; Wed, 27 Mar 2024 10:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jNvMdiH68j7U9CU8S2h45knqGrJCYb8G2LcFTCNWLsg=; b=TvLIc9pB/eYoLd T4S9u3FCi30d2UqPd05lLp2nvYe62j4OEFT8PNzRyhrNbU/CcBbq2nfEnYkLi+iB9uXVF89YKJt9L E1Oe908Txh1lElXHKG5FviGd/JxZZ9txlu7PbE+tv3Ats5kbW5jy/o10+Bat67VsUO5NYidNOsxg+ DVt0MIpNwbpxvhaNXbo2DtOTr08NTLV4iVxCDEK4zEFpQQ4U9aEx+BeGiBH2ouGkU/yDJ8oplrJl9 OJLWgQFgUvCPShxYKK9NpCdRgU514RcyTSxk+0pHnLTIKeIMzqhB39GW8wx7bye7pcAtScz0mNU3y S7jsB3BpMXCFebOl5HYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpQZT-00000008QJY-400H; Wed, 27 Mar 2024 10:31:51 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpQZO-00000008QEr-0PB1 for linux-riscv@lists.infradead.org; Wed, 27 Mar 2024 10:31:48 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-56bc8cfc19fso7271239a12.1 for ; Wed, 27 Mar 2024 03:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1711535495; x=1712140295; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qFFjWbcETbPCVovmbM8tpReuGu8aZixvMHFh/xJCQ5U=; b=B+pr8bpDCXazM94BpbGBQz47XcHc3drW9E7Sh1GylG0hsCR6V8WuhvVJRAh20xw4D2 2DlqZ61iiaFhz/ixULpz9UQD4JmjtKRDvKx62b8/Y9hQSuP3vACP0cE4VeN5cX6TAHrk nQxPVyo1xPuBMfzO6xaS+GPSEQYxoO3PqS68o94zJcECGsI4nluJRC4/bgGxKgd/0Zep IRI8RrldCxDk8BHs+UGB4q0rg08UYgrGM10ykPfo2Gnjs7//4fMdv044rerNSqHBcae7 ZlZdjTW31z0t+7U+LHWYSyvgMMmjLypkhg6GF8FhQyI/nc6NatgH+ShCPy3cFSiAU/kb fLnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711535495; x=1712140295; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qFFjWbcETbPCVovmbM8tpReuGu8aZixvMHFh/xJCQ5U=; b=eOovJUXFUUeQS4PZX2dTK07ThvYi1/5RJ5btoQL68NJR95YQd46O8WlMIzjm3IvtGt n2DX0I7xvChZJmyLTC+v+oZmDKnUxiS1UYJ1F23cwJ6spJnygCbEXmVpvEfSGYLjXyAk nU6tM4ZpuymuXLFo4RWizQ/dKPtPqCEu7oomUoMhyyKAR/RC0IcQ0N0YrsCGQ9K2xpTq zMLdh7HJqxwCsZHfZcZtGydPSuAfA6lwJsAAZp9V304a/fDcCc6OzWBAmRZhGSX0+kUV zg4nulK6esFEtNW6NiIGAmWrSoX5quECQPkF/93XPDXBBv8aBoNz5mlO3taRSNcs60c/ bBfw== X-Gm-Message-State: AOJu0Yz3+2qdspP0HDFpBEH6dzeTJvjbOWE/w24TKgwo+xnd3vUixZhR 6W0B9Xp0Ehdgxpfu70soROFi51xz+TjFDVrlctK4GhoFxBSaE1yCNXOqg5Op7XC0++6sM3q6vPO RP3w= X-Google-Smtp-Source: AGHT+IFpb/VYghvSGRAZv/KSjYVbhAxxbRz3wD8nc7CPHRDPIyI0sKYTxchYPDN6RU4YBfPXV3vdmA== X-Received: by 2002:a17:906:d7ae:b0:a44:4c9e:8809 with SMTP id pk14-20020a170906d7ae00b00a444c9e8809mr2772060ejb.32.1711535494767; Wed, 27 Mar 2024 03:31:34 -0700 (PDT) Received: from antares.fritz.box (62-178-148-172.cable.dynamic.surfer.at. [62.178.148.172]) by smtp.gmail.com with ESMTPSA id z15-20020a170906270f00b00a46b8cd9b51sm5294078ejc.185.2024.03.27.03.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 03:31:34 -0700 (PDT) From: =?utf-8?q?Christoph_M=C3=BCllner?= To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Albert Ou , Philipp Tomsich , =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Daniel Henrique Barboza , Heiko Stuebner , Cooper Qu , Zhiwei Liu , Huang Tao , Alistair Francis , Andrew Jones , Conor Dooley Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH 1/2] riscv: thead: Rename T-Head PBMT to MAEE Date: Wed, 27 Mar 2024 11:31:29 +0100 Message-ID: <20240327103130.3651950-2-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327103130.3651950-1-christoph.muellner@vrull.eu> References: <20240327103130.3651950-1-christoph.muellner@vrull.eu> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240327_033146_169693_BDADA89D X-CRM114-Status: GOOD ( 15.39 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org T-Head's vendor extension to set page attributes has the name MAEE (MMU address attribute extension). Let's rename it, so it is clear what this referes to. See also: https://github.com/T-head-Semi/thead-extension-spec/blob/master/xtheadmaee.adoc Signed-off-by: Christoph Müllner --- arch/riscv/Kconfig.errata | 8 ++++---- arch/riscv/errata/thead/errata.c | 8 ++++---- arch/riscv/include/asm/errata_list.h | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/riscv/Kconfig.errata b/arch/riscv/Kconfig.errata index 910ba8837add..2c24bef7e112 100644 --- a/arch/riscv/Kconfig.errata +++ b/arch/riscv/Kconfig.errata @@ -82,14 +82,14 @@ config ERRATA_THEAD Otherwise, please say "N" here to avoid unnecessary overhead. -config ERRATA_THEAD_PBMT - bool "Apply T-Head memory type errata" +config ERRATA_THEAD_MAEE + bool "Apply T-Head's MMU address attribute (MAEE)" depends on ERRATA_THEAD && 64BIT && MMU select RISCV_ALTERNATIVE_EARLY default y help - This will apply the memory type errata to handle the non-standard - memory type bits in page-table-entries on T-Head SoCs. + This will apply the memory type errata to handle T-Head's MMU address + attribute extension (MAEE). If you don't know what to do here, say "Y". diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c index b1c410bbc1ae..8c8a8a4b0421 100644 --- a/arch/riscv/errata/thead/errata.c +++ b/arch/riscv/errata/thead/errata.c @@ -19,10 +19,10 @@ #include #include -static bool errata_probe_pbmt(unsigned int stage, +static bool errata_probe_maee(unsigned int stage, unsigned long arch_id, unsigned long impid) { - if (!IS_ENABLED(CONFIG_ERRATA_THEAD_PBMT)) + if (!IS_ENABLED(CONFIG_ERRATA_THEAD_MAEE)) return false; if (arch_id != 0 || impid != 0) @@ -140,8 +140,8 @@ static u32 thead_errata_probe(unsigned int stage, { u32 cpu_req_errata = 0; - if (errata_probe_pbmt(stage, archid, impid)) - cpu_req_errata |= BIT(ERRATA_THEAD_PBMT); + if (errata_probe_maee(stage, archid, impid)) + cpu_req_errata |= BIT(ERRATA_THEAD_MAEE); errata_probe_cmo(stage, archid, impid); diff --git a/arch/riscv/include/asm/errata_list.h b/arch/riscv/include/asm/errata_list.h index ea33288f8a25..7c377e137b41 100644 --- a/arch/riscv/include/asm/errata_list.h +++ b/arch/riscv/include/asm/errata_list.h @@ -23,7 +23,7 @@ #endif #ifdef CONFIG_ERRATA_THEAD -#define ERRATA_THEAD_PBMT 0 +#define ERRATA_THEAD_MAEE 0 #define ERRATA_THEAD_PMU 1 #define ERRATA_THEAD_NUMBER 2 #endif @@ -53,20 +53,20 @@ asm(ALTERNATIVE("sfence.vma %0", "sfence.vma", SIFIVE_VENDOR_ID, \ * in the default case. */ #define ALT_SVPBMT_SHIFT 61 -#define ALT_THEAD_PBMT_SHIFT 59 +#define ALT_THEAD_MAEE_SHIFT 59 #define ALT_SVPBMT(_val, prot) \ asm(ALTERNATIVE_2("li %0, 0\t\nnop", \ "li %0, %1\t\nslli %0,%0,%3", 0, \ RISCV_ISA_EXT_SVPBMT, CONFIG_RISCV_ISA_SVPBMT, \ "li %0, %2\t\nslli %0,%0,%4", THEAD_VENDOR_ID, \ - ERRATA_THEAD_PBMT, CONFIG_ERRATA_THEAD_PBMT) \ + ERRATA_THEAD_MAEE, CONFIG_ERRATA_THEAD_MAEE) \ : "=r"(_val) \ : "I"(prot##_SVPBMT >> ALT_SVPBMT_SHIFT), \ - "I"(prot##_THEAD >> ALT_THEAD_PBMT_SHIFT), \ + "I"(prot##_THEAD >> ALT_THEAD_MAEE_SHIFT), \ "I"(ALT_SVPBMT_SHIFT), \ - "I"(ALT_THEAD_PBMT_SHIFT)) + "I"(ALT_THEAD_MAEE_SHIFT)) -#ifdef CONFIG_ERRATA_THEAD_PBMT +#ifdef CONFIG_ERRATA_THEAD_MAEE /* * IO/NOCACHE memory types are handled together with svpbmt, * so on T-Head chips, check if no other memory type is set, @@ -83,11 +83,11 @@ asm volatile(ALTERNATIVE( \ "slli t3, t3, %3\n\t" \ "or %0, %0, t3\n\t" \ "2:", THEAD_VENDOR_ID, \ - ERRATA_THEAD_PBMT, CONFIG_ERRATA_THEAD_PBMT) \ + ERRATA_THEAD_MAEE, CONFIG_ERRATA_THEAD_MAEE) \ : "+r"(_val) \ - : "I"(_PAGE_MTMASK_THEAD >> ALT_THEAD_PBMT_SHIFT), \ - "I"(_PAGE_PMA_THEAD >> ALT_THEAD_PBMT_SHIFT), \ - "I"(ALT_THEAD_PBMT_SHIFT) \ + : "I"(_PAGE_MTMASK_THEAD >> ALT_THEAD_MAEE_SHIFT), \ + "I"(_PAGE_PMA_THEAD >> ALT_THEAD_MAEE_SHIFT), \ + "I"(ALT_THEAD_MAEE_SHIFT) \ : "t3") #else #define ALT_THEAD_PMA(_val)