Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp956378lqh; Fri, 29 Mar 2024 02:29:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWGhB//ly4KajqI+oIEHMtY4UP7jXKpjbeeiiaEZ7Y+BYySTaHtSffnF8VRMxFu3U4mzGLTqplQjK7VQGWkjqGWrV6LGymrPJgFPvQ/g== X-Google-Smtp-Source: AGHT+IEA/M0L8ZOpGdR+Uqv2Qd/sEAocX4qKNBOrURYo69gQ6mFOCEdn3QHkJFqe+QncLGMiqswJ X-Received: by 2002:a17:906:c24c:b0:a4a:850f:28fd with SMTP id bl12-20020a170906c24c00b00a4a850f28fdmr1287271ejb.29.1711704588023; Fri, 29 Mar 2024 02:29:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711704588; cv=pass; d=google.com; s=arc-20160816; b=j6/5DEu0i4bIE8I4hrtAuYEatT+SmTA7NkCUvZWWpEZRqeKq20gkyRfQXP9sGvSqG/ dfFdaXlzfywTwWs07cMioVaBixRAo/N6LkO1vPfubk5KQF+sahksjp04uQWDf5YwP6vP tCmY6modeK2wVptUZR0XcpqzmYSYzsas+EwLK0ugky5z9HwbeOL6NnTAr5qEUsIe78Gn uYyiKzPiTYBIhxyTv92w7y0j+xny9KIuBpqYq3asbSgpKSiY/OZvBzL73QfaVzApy+0+ X1DQYrekH1Phk4QWJOocZirO82d2QvkAgds+Qof1gD6DXjvR41PMgLzA5d0p2mvwseZ+ A4sA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=AWJBCH09eu6e6/Y/jgxKzI6AZAa7BXYvEZEuKCZc7nk=; fh=8eBMBBa+yJ3K1tC3CxehXXPAAn/JAbEFCXDaaWkMbtg=; b=VZjkNSvTEac7EhbnxTgfxrKDFX7e5oz+orGO8oRQO3saxcusW969St9Hlsr0XhxFcj F8eHZ0qGxKXG69mN02h2HSpc1YpeXe0VZR9qIlzabbDINElit5BbNyRR0JGGifcVER6+ hQQZtd6Jtf3O4d0LVk2rbJSspsneKT2z1nHF3w1yOaZkHKvmiF/3dnRYodQrH8WTUTZ7 eYk0xsNU1EUBKcL8VGRaOImwM1G9ieWHm9lGNokcI9BrbeoBm1wEZ0XmISrR1AXawojl S+9y9JYqSLSYj5gMWGTBfL4/iE30y57neIrzNhjoiFc9kdoMZtGeg6vhQyFlQCN3cn2j neSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=LJEHAOEX; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-124336-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id kg27-20020a17090776fb00b00a4e3696c22esi471374ejc.368.2024.03.29.02.29.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 02:29:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124336-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=LJEHAOEX; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-124336-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124336-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 908D01F2252D for ; Fri, 29 Mar 2024 09:29:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A54C058239; Fri, 29 Mar 2024 09:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="LJEHAOEX" Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 540EE54BCA for ; Fri, 29 Mar 2024 09:27:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711704476; cv=none; b=TPn1erTmx6ghAckx8YMcl86F+26mMJETHeQbuxMl5OX/iV+1OvdcxD/EelIzlw33BITSKvs+Cz3dWhzf4eM8fjFOjglMBfUOttVclGicn+qonsPoIPtqtA7V1i7WjwdbIPKj/4yW+Eu0Mr81BI8imf2V2wmVIY6bLC0L4gZn1Gw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711704476; c=relaxed/simple; bh=kFYDos5oOuWgkjmYMwk9XxLgUS9cjG+wC5rkcBK9y+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MRgUedw2qnpMsYoBNgF+A59BXDzNmuqfqWvI7cKlCEsAMtacEg09lAMYlpy7+D/+xarpNDUw89WHKj+FJnNQgTyGHCRREKNy6nMOflVNTIyMeMpsu2FXGISqcYirZU7riZA0EMpr4G5QkUkSVgSqZfvbydSgg4P31xzFiRwSgZ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=LJEHAOEX; arc=none smtp.client-ip=209.85.210.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-6e8f765146fso1542992b3a.0 for ; Fri, 29 Mar 2024 02:27:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1711704475; x=1712309275; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=AWJBCH09eu6e6/Y/jgxKzI6AZAa7BXYvEZEuKCZc7nk=; b=LJEHAOEXbmpdLGymnH1Slp9iJZNh7Z2+VK2iLh5CS7SjuzLoCvou6ZsWxFxyQfwoEv Cb8iE9m+wW9K5lTcfCgqGFlss3W+w1DqBd8wdunA2QTsV3NL9JVdqYjFuF8G8kFzIKmB aJWlsNrNBWGiLm6SMFJPD9UHCHWNGM0xZIrYqJVOESB9yQQjvnlJFiMbba7piMh37vTH MHFKZR4UOhRK1tXQvBAarb84ZLnBasrIlwrAIGhMFJBvTM+ECsqFQSH7jC3esPx9jJZz mGa4ENT3h0GuJ1CK2Yqy3nvn46H1GE+6Gvj5PsVzbIK06rqRaFLxpAajWd/617EvtfVx l6wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711704475; x=1712309275; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AWJBCH09eu6e6/Y/jgxKzI6AZAa7BXYvEZEuKCZc7nk=; b=V5D3isH0X44qVvxvYHidYoGKkliJFq2OzP2pYFdF6KfCT1jwuAZXECo+sqYj3rYQw5 53WEddU09zf3nQ8b7Cp4OAWO/E2EpgaIBVpdMAh0RO7ph0ygpphRHUHoHOAlSNAulsUj Eu/th+Pbpn8RNoaZ7SsZEPx1EFynI14/jbY8gf4bckUzSYWrikTPpmhwD3pRRLDVGLDL pmD4z/Sa4Ny4w/rUJz7V3ZuVuYrq5KnVWlcfnw7OBeuFFEmseF3CljArTkmGbD4teeAZ BOfmHbv8Fifu8D5AnkjKLmjz7XEzY8PmjXn80aMKcErAcjbDZt8pQltqh3BclKfYMJnb GqRQ== X-Forwarded-Encrypted: i=1; AJvYcCWuN9BYqtAdamwCeete9EnysCfSP/NhZevBPDS0K73l5HuDosXtjGczEXAPvG7U+2wZ33o2qIYYeDip1EE95jh8vmqSdyNKd+hgu3p7 X-Gm-Message-State: AOJu0YwYL/95bTLfxqpNbmlVqZCOrywKrsnoGC/yCkXoxxllDpZQBHYN NxwsRZ+fNCeRLiUqD1eO65TLZ9e0WL8IGzmoCOSOw+X7Z4N112tINhAL7YVLk10= X-Received: by 2002:a05:6a21:3986:b0:1a3:af50:18bd with SMTP id ad6-20020a056a21398600b001a3af5018bdmr1630725pzc.28.1711704474638; Fri, 29 Mar 2024 02:27:54 -0700 (PDT) Received: from [127.0.1.1] (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id cv17-20020a17090afd1100b002a02f8d350fsm2628830pjb.53.2024.03.29.02.27.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 02:27:54 -0700 (PDT) From: Max Hsu Date: Fri, 29 Mar 2024 17:26:20 +0800 Subject: [PATCH RFC 04/11] riscv: Add Sdtrig CSRs definition, Smstateen bit to access Sdtrig CSRs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240329-dev-maxh-lin-452-6-9-v1-4-1534f93b94a7@sifive.com> References: <20240329-dev-maxh-lin-452-6-9-v1-0-1534f93b94a7@sifive.com> In-Reply-To: <20240329-dev-maxh-lin-452-6-9-v1-0-1534f93b94a7@sifive.com> To: Conor Dooley , Rob Herring , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Rafael J. Wysocki" , Pavel Machek , Anup Patel , Atish Patra , Paolo Bonzini , Shuah Khan Cc: Palmer Dabbelt , linux-riscv@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-kselftest@vger.kernel.org, Max Hsu X-Mailer: b4 0.13.0 Add hcontext/scontext CSRs definition to csr.h As riscv-state-enable [1] Smstateen extension spec: Sdtrig CSRs: hcontext/scontext availability are controlled by bit 57 of Smstateen CSRs. Link: https://github.com/riscvarchive/riscv-state-enable/releases/download/v1.0.0/Smstateen.pdf [1] Signed-off-by: Max Hsu --- arch/riscv/include/asm/csr.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/riscv/include/asm/csr.h b/arch/riscv/include/asm/csr.h index 2468c55933cd..308ae795dc82 100644 --- a/arch/riscv/include/asm/csr.h +++ b/arch/riscv/include/asm/csr.h @@ -204,6 +204,8 @@ #define ENVCFG_FIOM _AC(0x1, UL) /* Smstateen bits */ +#define SMSTATEEN0_HSCONTEXT_SHIFT 57 +#define SMSTATEEN0_HSCONTEXT (_ULL(1) << SMSTATEEN0_HSCONTEXT_SHIFT) #define SMSTATEEN0_AIA_IMSIC_SHIFT 58 #define SMSTATEEN0_AIA_IMSIC (_ULL(1) << SMSTATEEN0_AIA_IMSIC_SHIFT) #define SMSTATEEN0_AIA_SHIFT 59 @@ -480,6 +482,10 @@ #define IE_TIE (_AC(0x1, UL) << RV_IRQ_TIMER) #define IE_EIE (_AC(0x1, UL) << RV_IRQ_EXT) +/* riscv-debug-spec: Sdtrig extension */ +#define CSR_SCONTEXT 0x5a8 +#define CSR_HCONTEXT 0x6a8 + #ifndef __ASSEMBLY__ #define csr_swap(csr, val) \ -- 2.43.2