Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp561162lqr; Wed, 5 Jun 2024 14:07:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW79//M8a1PMQxwXd5onI3Kr1BQZuH1yuFSfWlMwA4ndojNt0PeU9nownZDPHP3a5LMsfOZkbe/v3HMizB++XHYkrIKVubh2+31FJyU5A== X-Google-Smtp-Source: AGHT+IEP78XVdcz+q4PvKdaz/Kv8GxpqUsWsL8+A34gxyK0bqQ/OqZi/aufP0AQMdiFhqyQjS6tw X-Received: by 2002:a05:6a21:998e:b0:1b1:d878:fc02 with SMTP id adf61e73a8af0-1b2b6ecb8e7mr4733181637.9.1717621641476; Wed, 05 Jun 2024 14:07:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717621641; cv=pass; d=google.com; s=arc-20160816; b=MnTpDgHKha/oP7NVZYL5l5M/dhCRhgvatlVIunphH73Z5SX5moJFRO9JCu6LPPuQT4 5g0/Y5yc22jU4p+7Inr/LyLSS94pj2CX4BbAWob/dKdzuxyWGib5qsEVMMEuunfr4vPQ A5sc7bx8NpeXDYJYcPSNuO6tD3UPFUxmQtLP3faz+c2vHCBSv7jJZQkeR3XFEChcFHNT iihptX85dkMEhCOyPVLlnOMef4HUa4d+nSGq49q9lmFlljgS3eo7bz9CoilUsRKDizts pEr3huRL7M5E3Q1UPKAeTDL3CkNoAfDVI2gvd5hMO54ACcYy8sV0/EjMJtHZddpqSB73 S3+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=TSwHeh/cECdPEg7QzwSf8DHXKuWQgQmqUDB+TvkoQ5g=; fh=jtP1C7LWTJD6qyy953J9ReT6WCy9EWYnYv619LXPzfg=; b=gjZ5q6V1JUD1r98tGlBTBNvpnseU5jr1sAIBiPr2+UXnri+Oy/ATO4pkv6tI3ddldf QwIolwXi5COjcgbCzonwvJjMgJRW/b9ul5NdH5dnTqvXipenc/3Q/B+UAmxyF5uaAeHy p7EhQN6OHmNGXG6q4Lg8o31CUWUHYCByl1+oGlei7ewqM/Z6ef97UD1jXKsQCyuR23hq Spttrjx2GT4w7Dzg0FZXynkCNmH5ODLybXNGFwNnHJu4gMQyTs5KPZRxjNP/llAeNOtp uoyg7lSvnL17Qs76+PM6ePGHuGAxQfcjhCWX2Ny9W9roSu6qjr7xnwg6qDVOMSUWxbvt Z25w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=SrPdoyMx; 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-203215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203215-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-70242b12dc8si10842598b3a.217.2024.06.05.14.07.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:07:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=SrPdoyMx; 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-203215-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203215-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C808F289519 for ; Wed, 5 Jun 2024 20:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C40515FA60; Wed, 5 Jun 2024 20:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="SrPdoyMx" Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 5DD8629AF for ; Wed, 5 Jun 2024 20:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717621022; cv=none; b=o1xW3mfvxOSK1gDAfZPHL7v57f2ZXcum1grrtuCmRCDKF1QUT0ed05GOTtfBgnW7N8HaMJ3wPtAkqmtWl8OQALsv06BuRRaLew28089pDV5HSe0xsfzwbx85KE1iHc5BUBHZWgGP3J/ivqfV2j0WCZFiRnGzCcvkbwU+KVW0KfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717621022; c=relaxed/simple; bh=TaGElk/hpAq3VO9VslRc+/HRzTC0o9ENFqw8n9czgjA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=IY/9rltPYQuYrqpy2C4qPFwu/qt2lfugS2GpIuvghE31N534WbRvOg+GLKyiiWe/BpEGdiKoV657FY7VxBIHwVEySf6YR+v+r3PESfm1xHR28x48G1j1Cu/LZBLBMm7IFa+wIf8DYjCX5T0Wl09cS5XKbffZsBwEiaK9FfT0pXs= 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=SrPdoyMx; arc=none smtp.client-ip=209.85.214.169 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-pl1-f169.google.com with SMTP id d9443c01a7336-1f62fae8c1aso2301115ad.3 for ; Wed, 05 Jun 2024 13:57:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1717621020; x=1718225820; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TSwHeh/cECdPEg7QzwSf8DHXKuWQgQmqUDB+TvkoQ5g=; b=SrPdoyMxm9nzsaOUitjGRh4P/NBnex1Rqd/c0XJpzredS7/OkVvzGkYr5IMBXjL5YU DjfXv34tPgd16PRQojsg4+JuJAVtWp3Z7nqpsz9qWfoCacN5td5LdxJBLiH4g+oxYbgP vztjybwEU/T4eY4p1nVWqQshQJ7V9foG8ZoOUr9TLHRfGUJ50Xu7O2vQAIpNaQzLyWUG TX+F8cBDL4eBZWaUNVogkLDbY83hJ+ZHSH1glE+IiwS4kx4AQVmaC7Oo1nJ6y9TN/DQ+ 9dzIr5yU34qeEta+280thn611gjcuF0nGYdkBtUdJjU1M5CI6nv6GDx4ADFitAyHnEId zM1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717621020; x=1718225820; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TSwHeh/cECdPEg7QzwSf8DHXKuWQgQmqUDB+TvkoQ5g=; b=WM04w4JD+SbkzHXwuxBhfuHqHGUj6ZyZkZo2F90n3YJ0Xr2RnwxwVohAGYGbsvaVOI jGR0dyZeDRn05WLO2rIS6nbbjHrqTogvHkiP/kiRd41UKBZtUmBU3+G2tuOYo2DBczUS cwoh3got6iSMFyfL8o8AF3a2wunda9TvMshN6s9yeYA6wUUppO1ZJQNnl2NeXZTNi4nF 3Hrwuv/gytpFB+JNk5vfmdYuXsi35BR1Nl4KQJzXoJN9nLwZyCnVOQO831BN1Z6Q79gu Zt5oD9MEwNHYQ9/UfHfUBPvrVejXw31plMKRkhBm9EbI3WVscpHzxIbc0vUO2QA/ckkt A3yw== X-Forwarded-Encrypted: i=1; AJvYcCUHjhtwwHyPRLbhiDrMgPUFA18XHASEwfe9i2a8fwcsge1U+fCFNhIxk85Vu7ODfrh8iPU7a/K3sspeWri0YGhrEe723wHi/EyZQJ3p X-Gm-Message-State: AOJu0YyEVguAc5weC5X+khTdsnqzprUwKHbFDLuI9qH0E3X8evEximEW Vdo82ZfDkqo9XaZJv3/R88APnIBGrliJuHCuFN5pBLiGmRovrDagIZyaEDAi7/U= X-Received: by 2002:a17:902:e811:b0:1f6:6900:5946 with SMTP id d9443c01a7336-1f6a5a7b559mr39401645ad.66.1717621020437; Wed, 05 Jun 2024 13:57:00 -0700 (PDT) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f6323dd86esm107332135ad.121.2024.06.05.13.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 13:56:59 -0700 (PDT) From: Samuel Holland To: linux-riscv@lists.infradead.org, Palmer Dabbelt Cc: Andrew Jones , Conor Dooley , linux-kernel@vger.kernel.org, Deepak Gupta , Samuel Holland Subject: [PATCH 0/3] riscv: Per-thread envcfg CSR support Date: Wed, 5 Jun 2024 13:56:44 -0700 Message-ID: <20240605205658.184399-1-samuel.holland@sifive.com> X-Mailer: git-send-email 2.44.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series (or equivalent) is a prerequisite for both user-mode pointer masking and CFI support, as those are per-thread features are controlled by fields in the envcfg CSR. These patches are based on v1 of the pointer masking series[1], with significant input from both Deepak and Andrew. By sending this as a separate series, hopefully we can converge on a single implementation of this functionality. [1]: https://lore.kernel.org/linux-riscv/20240319215915.832127-6-samuel.holland@sifive.com/ Samuel Holland (3): riscv: Enable cbo.zero only when all harts support Zicboz riscv: Add support for per-thread envcfg CSR values riscv: Call riscv_user_isa_enable() only on the boot hart arch/riscv/include/asm/cpufeature.h | 2 +- arch/riscv/include/asm/processor.h | 1 + arch/riscv/include/asm/switch_to.h | 8 ++++++++ arch/riscv/kernel/cpufeature.c | 13 +++++++++---- arch/riscv/kernel/smpboot.c | 2 -- arch/riscv/kernel/suspend.c | 4 ++-- 6 files changed, 21 insertions(+), 9 deletions(-) -- 2.44.1