From patchwork Thu Jan 25 06:21:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepak Gupta X-Patchwork-Id: 13530071 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 936C3C47258 for ; Thu, 25 Jan 2024 06:28:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 28DD26B007D; Thu, 25 Jan 2024 01:28:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 216AA6B007E; Thu, 25 Jan 2024 01:28:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06A2C6B0080; Thu, 25 Jan 2024 01:28:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E62F26B007D for ; Thu, 25 Jan 2024 01:28:18 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7A8B11407C3 for ; Thu, 25 Jan 2024 06:28:18 +0000 (UTC) X-FDA: 81716853876.10.67982F5 Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) by imf24.hostedemail.com (Postfix) with ESMTP id B492118000F for ; Thu, 25 Jan 2024 06:28:16 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=QQSAXrN5; dmarc=none; spf=pass (imf24.hostedemail.com: domain of debug@rivosinc.com designates 209.85.161.43 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706164096; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3e2cTh56cG2GGWTE4NSzcFXiqv/NB8pwrDQ1nq4c+Tw=; b=W7NsVnvRPyTrPthoh9iP39/a37tD+kIKpKrk4t0ZwXP4lN/6vB9Ez/aPLY5eilgXzm+II+ D9HqTudRzqC0gf6rPFT3Ufw2i8tXOr4BwEbZseTZGVz/hOrMJREmtq3hH8M9UsRY651ooB hKbkOYeh4F4O7EiWTS+Kz9frVUoFDq8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=QQSAXrN5; dmarc=none; spf=pass (imf24.hostedemail.com: domain of debug@rivosinc.com designates 209.85.161.43 as permitted sender) smtp.mailfrom=debug@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706164096; a=rsa-sha256; cv=none; b=q8iFNTcsVSlvexeTJcroBCgHV+tizAeo6LfHLaV8sEM0dynPIcv/y+BR9tIDvGtjWEe1S+ 3D64Zt1CvngxzFcoBQHLNK/oMgI9oLFfWclquCT+GIYxVo5xGmDuCfF4jdlVVbVguRjOUw jpQ5ovTghpu3ukZVIQE45X6+YOjkggs= Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-598a5448ef5so3898005eaf.0 for ; Wed, 24 Jan 2024 22:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706164095; x=1706768895; darn=kvack.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=3e2cTh56cG2GGWTE4NSzcFXiqv/NB8pwrDQ1nq4c+Tw=; b=QQSAXrN57kAQkWx+v1rEu1MXPkZ3MQryFMMpd8jjFXQKgoHSUr+iTQaQytmX/erTFH vH2cf2VilQKXUpr5k1GXdwBoijVG3WLEZ2wUINkgvBOAggXXygY9ww1Rg84L9NBt2/eQ rjbHptf5h5ddQiUY1uqUcgIa/mFFLvHzC9qfL4roWRAbmKLBUwm0F6vIy4KBRhXH23RE jarbll88c47wU7PmdGa8eKFy/Pawsw1AZT0ZRqhgDd0KoTWMjbqrJ5KifX2SeDKOpsbA SGnEcherE9XjdkwMVx4nmbJJtEVDs0HkJy8hdKY68ENOjdidKuqsVbCTagpIunt2Qrbd ooHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706164095; x=1706768895; 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=3e2cTh56cG2GGWTE4NSzcFXiqv/NB8pwrDQ1nq4c+Tw=; b=Aj8k4V7DbsddVOGSMVNv5ehi1L/wjmqLw0bleBYvnWVvjSE5Ropd8REKSoufAzc4al VR8LDpI+J2Ebf+qycc69bDTLUloS9BSaQTnMZMMgVpH9KQlYkrYKes/gcI7ENIDqpneR 8rx+SfceuWlDRBWVltuBA7fzOYTetfn5ludtRUXzKYQE9bAMGd3aAlDxune3ZH5JfF7E Hf8v5XzPd0UhLtlwpdwzeiFaskS9kDU3ihk8C1eg1PZ8vvx9a5IkShYDo1JY3yEgETEF 6r8WEQMPPwUJwPL+LE5jZDMh+WY4RBRczrKUvPRxNJd9o75+BB9yU1TiLqXfzWtxLP3E r4jA== X-Gm-Message-State: AOJu0YzyaGTEuyBrYoeoLqeSSIcsj/mPrwCRDX9eFKij1wNh25jJospb ixb/gGbAI8y7HFBp1fFOM4Whc5A33cn1ouu8nq5jAQIk4WioJpg91TnOloFwAgE= X-Google-Smtp-Source: AGHT+IHCIEsJoIeVNjGK2Jx0Div0w47akcVOGWIMmQ12q7OuC1Yo4rjhD3STlwvv6dFXihLIPTns6w== X-Received: by 2002:a05:6358:8404:b0:176:5d11:3071 with SMTP id b4-20020a056358840400b001765d113071mr519801rwk.12.1706164095683; Wed, 24 Jan 2024 22:28:15 -0800 (PST) Received: from debug.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id t19-20020a056a00139300b006dd870b51b8sm3201139pfg.126.2024.01.24.22.28.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 22:28:15 -0800 (PST) From: debug@rivosinc.com To: rick.p.edgecombe@intel.com, broonie@kernel.org, Szabolcs.Nagy@arm.com, kito.cheng@sifive.com, keescook@chromium.org, ajones@ventanamicro.com, paul.walmsley@sifive.com, palmer@dabbelt.com, conor.dooley@microchip.com, cleger@rivosinc.com, atishp@atishpatra.org, alex@ghiti.fr, bjorn@rivosinc.com, alexghiti@rivosinc.com Cc: corbet@lwn.net, aou@eecs.berkeley.edu, oleg@redhat.com, akpm@linux-foundation.org, arnd@arndb.de, ebiederm@xmission.com, shuah@kernel.org, brauner@kernel.org, debug@rivosinc.com, guoren@kernel.org, samitolvanen@google.com, evan@rivosinc.com, xiao.w.wang@intel.com, apatel@ventanamicro.com, mchitale@ventanamicro.com, waylingii@gmail.com, greentime.hu@sifive.com, heiko@sntech.de, jszhang@kernel.org, shikemeng@huaweicloud.com, david@redhat.com, charlie@rivosinc.com, panqinglin2020@iscas.ac.cn, willy@infradead.org, vincent.chen@sifive.com, andy.chiu@sifive.com, gerg@kernel.org, jeeheng.sia@starfivetech.com, mason.huo@starfivetech.com, ancientmodern4@gmail.com, mathis.salmen@matsal.de, cuiyunhui@bytedance.com, bhe@redhat.com, chenjiahao16@huawei.com, ruscur@russell.cc, bgray@linux.ibm.com, alx@kernel.org, baruch@tkos.co.il, zhangqing@loongson.cn, catalin.marinas@arm.com, revest@chromium.org, josh@joshtriplett.org, joey.gouly@arm.com, shr@devkernel.io, omosnace@redhat.com, ojeda@kernel.org, jhubbard@nvidia.com, linux-doc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [RFC PATCH v1 01/28] riscv: abstract envcfg CSR Date: Wed, 24 Jan 2024 22:21:26 -0800 Message-ID: <20240125062739.1339782-2-debug@rivosinc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240125062739.1339782-1-debug@rivosinc.com> References: <20240125062739.1339782-1-debug@rivosinc.com> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B492118000F X-Stat-Signature: 73xian99z5k8ijceyqe3cu761nm4wfue X-Rspam-User: X-HE-Tag: 1706164096-548154 X-HE-Meta: U2FsdGVkX1/h/rSgnPxIUP9B9tnSm0UbX1+LxIP9pDC1qITJApEaFyopXFSAHC6FUsp9F1JEnrBoosW8Y4dAsn8meWZqhEv3uTSK2LiU+pAN3hlU+6CJtiEwvyEWggBzu9z/6OnpJFrzw4LW0Ao+Nm5egTTzb4jD6S1RouC/OJN4JI/WEoiHeKK546I0qFIo0V5+iTJkj7SaBMxMTJFYpwpyIh6BFgkKoVmJ9pGSypP9xSCSDRhg4LbhegeQbA4KuqaDnFbNtgitxkZ8l6RLpG7ZfDGLYfd46kPTSBtwWXJvidNY/dPyLXcEFkr8IqHt/gGiF3lc0tU9mRWBuOghlN0ljepO9RTTJdEd5EYQOc8hNAwdxo1gbHYqwtOQY17JGhT1UBW0V0kqsCgkSDjD7ZCE7Wps/0ueoMvG0PlFfBPj6cPW4dmeqSq4krwjh55ndWxrEJqhvATl942IgIU3Wb+GYvgPGF0l51wW6tO1qerwrPn/J68qVFaX6jImlYmP/tEN88IO71Rg0hYRA/acazGjeS7r9SHXrhJmOiqZKzQvp2BhhexbP8lEadd2rm7p81EveLpb8OwpZ4A6a3EfcNKBT4jpdvCRcpBJB9iaBBMcs3FvjaUt2gLnn1v3/lIWZaNCzgG5haK63kccGpH3wZAk3/upf3uDvUHMpuo+68TfcIc9LJd/VcculbYrjkbutetEJgh+zO4GfEPW1bKEt6nhzLBXu/ALddvLsA3f2CQan4RqiCdlRC1JV+WZVLZfi87WbgF8XPpUCPoVJtIJuooa2ftqyuvnVOQACMQxVwRQhspMt1p8FlFHjVqMP993bK/w2StCNJjU5JcEgA7NhRaujWVZ5v4VtQ8xdx4LcN8anYO+WWXGpu5UnkwBB4JoFR5PmXItP369fRINjgfc8dcvHBZ+I7ncFfJhWvpEECtPzXllL7G3VvxvF+iQlyP+sNw6ubShY5kp7qY1KA+ KU/UrrLV oedFIl+tx7uiOb8TD8j5xXN2hrYXoV8wGpRiFwGAYMxliq4PjuHX9yfu+jLqXyeljDOmSIu4nouwDCNemMXqcj7vlSoVBRuaXAEdkukCC4WLTx15Kaap3b9hJcjC4rm3OfzbYQXiO6oyKodgQsMiRZW9wY/j26PHzAEHSUEYeE4stDVCVlcgXxoJBP6kGlUn2QgLqDiJjBKXN6pTjMjciay46c6TCvbmvKpX+A3+B8BDBIAYha8Gs5qPkrQUjoR/+NSuebB8H2MWd4Ma2Z8bwKOrpC2FTE6JZ6yS2cpmLlz9gNGLt0qz8r76JPRzQVBX77h+F3gaUcqjLoPEEZr18USfT7EKsbbYs4guWEXaTeb3LCJYjHwLq9twY6Mx+CXG3YYgf3RzihKMMhziyTolmNuxqbQp8lmqrRaTUaIf5G3KjsbaiziAEY0N6dTbQkw5pgzNu X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Deepak Gupta This patch abstracts envcfg CSR in kernel (as is done for other homonyn CSRs). CSR_ENVCFG is used as alias for CSR_SENVCFG or CSR_MENVCFG depending on how kernel is compiled. Additionally it changes CBZE enabling to start using CSR_ENVCFG instead of CSR_SENVCFG. Signed-off-by: Deepak Gupta Reviewed-by: Andrew Jones --- arch/riscv/include/asm/csr.h | 2 ++ arch/riscv/kernel/cpufeature.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 306a19a5509c..b3400517b0a9 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -415,6 +415,7 @@ # define CSR_STATUS CSR_MSTATUS # define CSR_IE CSR_MIE # define CSR_TVEC CSR_MTVEC +# define CSR_ENVCFG CSR_MENVCFG # define CSR_SCRATCH CSR_MSCRATCH # define CSR_EPC CSR_MEPC # define CSR_CAUSE CSR_MCAUSE @@ -439,6 +440,7 @@ # define CSR_STATUS CSR_SSTATUS # define CSR_IE CSR_SIE # define CSR_TVEC CSR_STVEC +# define CSR_ENVCFG CSR_SENVCFG # define CSR_SCRATCH CSR_SSCRATCH # define CSR_EPC CSR_SEPC # define CSR_CAUSE CSR_SCAUSE diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c index b3785ffc1570..98623393fd1f 100644 --- a/arch/riscv/kernel/cpufeature.c +++ b/arch/riscv/kernel/cpufeature.c @@ -725,7 +725,7 @@ arch_initcall(check_unaligned_access_all_cpus); void riscv_user_isa_enable(void) { if (riscv_cpu_has_extension_unlikely(smp_processor_id(), RISCV_ISA_EXT_ZICBOZ)) - csr_set(CSR_SENVCFG, ENVCFG_CBZE); + csr_set(CSR_ENVCFG, ENVCFG_CBZE); } #ifdef CONFIG_RISCV_ALTERNATIVE