From patchwork Fri Mar 29 12:14:13 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: 13610604 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 15223CD128A for ; Fri, 29 Mar 2024 12:14:30 +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=0zszoSh2AHmwpd rTjeMiAgETdj+TRTI1MjkxxRIRH+nqqm+CHc2+Cp7geTbHumYhaqD7qmcxeVlIHxxebL/tNoPTDUq bUdkvL3cSAy+WBLQV3yaxL1vETraKPnRlH7uqqoM3E5MV5n4AMxU9lXdU8Y6ep7TqQ4+WZEHVC1CS gqH11nYJziWK6Y4pHEaCSnqEbwoRTywbWNx+sy33Tg0dZ4NkVtmvsrifNBAd59wldslyl12RzjU20 alW8AVlqBvuZEa2A9RYw0+R01kuPNchXft8zIdIYabrMd9pXC1ay3EGqy5KPTdSF3OLik10kRSWld CQv6vOwAg4qeVH9Rls2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rqB7q-00000000I2k-1h7F; Fri, 29 Mar 2024 12:14:26 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rqB7l-00000000I1S-3poQ for linux-riscv@lists.infradead.org; Fri, 29 Mar 2024 12:14:23 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a4751063318so244700666b.0 for ; Fri, 29 Mar 2024 05:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vrull.eu; s=google; t=1711714459; x=1712319259; 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=YollhMU9nE45MNEW7erN17FEWgxaOySJZiY7t3vok+eAfLFGN+x2/t296VSE+mWr0A 5snDZCqdJbRQYx/W6q7LZIloSzy8II8o+VYff5Y5pKow+q5x7f9IRAk/uBNopSGh/ALT gZ7iTdZ7mgPw4fJLmPa1Qy15UC7VHa7ta7BvJUcQ5/RuNR8vVfF174E9cQZxMts5DDNI SfTR/V1qsq9ug9Yl3InZ4G8Bmb3VC4ajqRhXBVfP+y8o81TMgA+txOpBDCb6iJtB3+Lb r062suH5Bug6x4Q2FFw5zwmJ208uYETmaGFlQ8At9PpPn+MkAaSg2OrfrK+8MW0Z1bjv kPPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711714459; x=1712319259; 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=ibbVSmanDkUW9XeFdoYCOaxewZFFSEkeyyToQgvSsAgmLu2StlLr4RQ30ZVESJ4JM9 xjKX5ijdI2K+F4PFaWXH0P60v5ZrV7yxOXyB7OMSsaz0/LJ6CWICxnY19Pt2Ee1Opn46 hud2lMsxKU3Zb7ufM5LhdV7JXOW8zUa9uYkQZB42UZOlwHlThbMrCiDmM0B1V1DrP9rZ ufZ9LAiw20aTOJP85XJPPDIFGB3EFsGwk+GM1xIHuinoArWuHGj/kuRtFjD4Tg8LiCwW S2iS35owJXWXBkTA0rYJlFJRk+0kiH3iU//ofquHTDdsKQD1nteiWm0B652F8ZkdNMk2 5Ovw== X-Gm-Message-State: AOJu0Yx2rP+wH8bDXFFLcxtvaeNiSCn1uzMttOWcwA0zooCUp89zDkMq RxlXho9CWXZMgxAuDdUrbytjkYAvRGKi6cRjepxYk++9ZyzZc3uz/hJytoqMfUkgekvohZrwlZh vbf4= X-Google-Smtp-Source: AGHT+IGLABwyH28ATsB0x8W3Kqgj27YWFl1l10nx/AfsG23r+Q9xo/kACBZfAHUxCCRT+b66nkS/bQ== X-Received: by 2002:a17:906:33d9:b0:a4e:220d:ff21 with SMTP id w25-20020a17090633d900b00a4e220dff21mr1346615eja.59.1711714459528; Fri, 29 Mar 2024 05:14:19 -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 g16-20020a170906539000b00a46dd1f7dc1sm1869942ejo.92.2024.03.29.05.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 05:14:19 -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 , Qingfang Deng , Alexandre Ghiti Cc: =?utf-8?q?Christoph_M=C3=BCllner?= Subject: [PATCH v2 1/2] riscv: thead: Rename T-Head PBMT to MAEE Date: Fri, 29 Mar 2024 13:14:13 +0100 Message-ID: <20240329121414.688391-2-christoph.muellner@vrull.eu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240329121414.688391-1-christoph.muellner@vrull.eu> References: <20240329121414.688391-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-20240329_051421_982968_ADDDDC96 X-CRM114-Status: GOOD ( 15.63 ) 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 Reviewed-by: Conor Dooley --- 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)