From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 49AD228F527 for ; Thu, 29 May 2025 11:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748518400; cv=none; b=tYzCSCJefhZwobcMDjXGdwuyFPHMOQhnFEqcFQbmbDN8oLMcW7iOAk092vxt7a3pMTQ9NY0Ny909YOuoLwgwMOT8zwx6IXNtHuULunr7gWZ8T1OQieAJn1P9BuCiGsEmaISJ25z0I/O/gckDXp9n7F47l3gLqSo7fCv0DI5+59Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748518400; c=relaxed/simple; bh=41eja3GEP0F1NgK0VkDUcr/lsnX2RYh7poVYaCc8trk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Q1V6NyxBmON4geRQsNh+OriJbE5ndr8ENnQM8qS4rDC4+j5U5njhiZk41N85VS7JWGOUrfGSNVAm0t3e07YB4cooo+JP+/RSVRWGk7l4BvtqTEIicTzbLRW9eTwPAgycCHwUf6ugLSjMfw4TbYEQKBasYKGDcVP+a6XaTYW++Gw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tveF6x0L; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tveF6x0L" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-450cd6b511cso5007755e9.2 for ; Thu, 29 May 2025 04:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748518395; x=1749123195; 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=YBZfytqoLfoLLkCHGYVhQ8mByrfQ3MODercYrOljLZA=; b=tveF6x0LTIphKP0aCxdlfKc6YExlp970rewGPdO21OJbNl2+9FGI3ATNw1+E1PWQzK piOir6s5Zg7F923RnCnR+lolV/VDHDGz2kL0a2SDJnpmdeQPOFr9MYqrjWZuzViUGMkk iiOACc1+kD/SAiO0EvAkwYWN8rg4K+54IrCrxAD0Xv4g/+UokivZJiq2Cs9cd8EDqvUw i1T3cJ2XNU//3WyGHgPEXE0FTtUTRMUoFhP71AdThszN18Cv28QWn79uC2KFsg806wT8 XT5X262iL2LUat2vREw/3jzw7Rd1UjSHApYXAdlJY1rxA1Xm4RNNUPS+M0IrmQRbQOoK 6I1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748518395; x=1749123195; 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=YBZfytqoLfoLLkCHGYVhQ8mByrfQ3MODercYrOljLZA=; b=vx9iXTVDkrsLdFVrL4tzicv4IXaZ2Bf9I9P+F1LP351s04XEvjrFEOD81QW/qWXYVp geWgqL+GRLxdubAEjDY5KLj79SfDeED0t30yyG1rchd6kbKWZilNtIAGv33MtezmYg+G 8I4KnhsU1Y/6P471jHaiCfZ9WHOtCJECcoI/RQF2witeZJ8lXcZ8Z5Hi04iM56LsXKqk jKmS8Rnloxx5y53RjLS0iJnW0DQRy1hLQ53ZvzEByn/UZkvK9E0ZySh4NYAvb/GT3YkT 0OfSux2hYX0RyUM04rkFMMKYNg6hi/Ex6Uerm7Q2xYzjmJmENwXvPlTGvAWCAfM5LlQm oVSw== X-Forwarded-Encrypted: i=1; AJvYcCWn2YHonkJzBLLur7m9YuPcsDr8SWaa4+VvAlQQheKw52PrlFQbiHVOWKrRsIRf2ILo5Y7wcRU9RpBnHtI+V/Sw@vger.kernel.org X-Gm-Message-State: AOJu0Yx8kOpU43MRspZT3oVqpquAi7oaDg0PVJToNzwegkyLWaDytQJ2 nTfilr92v0aaP0txdD7rlRzP2+RiNB0ksCJ9ySuJ3W5KLFs9SoP+R97Dtw+aOnQNHBArXQoDrs6 4jTGz63YgUA== X-Gm-Gg: ASbGncuVqJ5Uyb05iRf06fGlFoB7zBeNH1rbxymR4EkqMAWQsXVIVv9/dSEQORlA/Aw LhOQobhOw7Wjtxq0L6amQYb6hZ7MNLwNM/hKQa0TUN6E2CspQgMro/IBVPAfmLJ8jwYwBzrpXtz biRh332LN1EWytJCwHCxQ6FUcbLOBhr49cv9/5a9OlDd0HmQRe7YDzG6WarhzQ2dEULRHGokP9w 5nUTxdmGEuGoaNFWSOUdgoimSnkMQzMmVdcd8Ciq9rIP59GMAGlYquvEdtUnnydxjDkCpWZVNTX FxO4uzoNzqnKVkoGmMuR8VDESsOlY/MSnWYY3/WrPebEipxbAa29psIs+1lb X-Google-Smtp-Source: AGHT+IHMMfVW7IE9nbkSMy9wDfF0tmM1c9IXy+rbxej/RhTBlE7UtH3OLrCFPOGZOGsnCFRe6FkZLQ== X-Received: by 2002:a05:600c:4394:b0:450:cc79:676 with SMTP id 5b1f17b1804b1-450cc79077fmr23266695e9.20.1748518395511; Thu, 29 May 2025 04:33:15 -0700 (PDT) Received: from ho-tower-lan.lan ([37.18.136.128]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-450cfc3785bsm17443945e9.40.2025.05.29.04.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 May 2025 04:33:15 -0700 (PDT) From: James Clark Date: Thu, 29 May 2025 12:30:26 +0100 Subject: [PATCH v2 05/11] arm64/boot: Enable EL2 requirements for SPE_FEAT_FDS Precedence: bulk X-Mailing-List: linux-perf-users@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: <20250529-james-perf-feat_spe_eft-v2-5-a01a9baad06a@linaro.org> References: <20250529-james-perf-feat_spe_eft-v2-0-a01a9baad06a@linaro.org> In-Reply-To: <20250529-james-perf-feat_spe_eft-v2-0-a01a9baad06a@linaro.org> To: Catalin Marinas , Will Deacon , Mark Rutland , Jonathan Corbet , Marc Zyngier , Oliver Upton , Joey Gouly , Suzuki K Poulose , Zenghui Yu , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-doc@vger.kernel.org, kvmarm@lists.linux.dev, James Clark X-Mailer: b4 0.14.0 SPE data source filtering (optional from Armv8.8) requires that traps to the filter register PMSDSFR be disabled. Document the requirements and disable the traps if the feature is present. Signed-off-by: James Clark --- Documentation/arch/arm64/booting.rst | 11 +++++++++++ arch/arm64/include/asm/el2_setup.h | 14 ++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Documentation/arch/arm64/booting.rst b/Documentation/arch/arm64/booting.rst index dee7b6de864f..abd75085a239 100644 --- a/Documentation/arch/arm64/booting.rst +++ b/Documentation/arch/arm64/booting.rst @@ -404,6 +404,17 @@ Before jumping into the kernel, the following conditions must be met: - HDFGWTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1. - HDFGWTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1. + For CPUs with SPE data source filtering (FEAT_SPE_FDS): + + - If EL3 is present: + + - MDCR_EL3.EnPMS3 (bit 42) must be initialised to 0b1. + + - If the kernel is entered at EL1 and EL2 is present: + + - HDFGRTR2_EL2.nPMSDSFR_EL1 (bit 19) must be initialised to 0b1. + - HDFGWTR2_EL2.nPMSDSFR_EL1 (bit 19) must be initialised to 0b1. + For CPUs with Memory Copy and Memory Set instructions (FEAT_MOPS): - If the kernel is entered at EL1 and EL2 is present: diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h index f6d72ca03133..6d0d8c25e912 100644 --- a/arch/arm64/include/asm/el2_setup.h +++ b/arch/arm64/include/asm/el2_setup.h @@ -279,6 +279,20 @@ orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0 orr x0, x0, #HDFGRTR2_EL2_nPMUACR_EL1 .Lskip_pmuv3p9_\@: + mrs x1, id_aa64dfr0_el1 + ubfx x1, x1, #ID_AA64DFR0_EL1_PMSVer_SHIFT, #4 + /* If SPE is implemented, */ + cmp x1, #ID_AA64DFR0_EL1_PMSVer_IMP + b.lt .Lskip_spefds_\@ + /* we can read PMSIDR and */ + mrs_s x1, SYS_PMSIDR_EL1 + and x1, x1, #(1 << PMSIDR_EL1_FDS_SHIFT) + /* if FEAT_SPE_FDS is implemented, */ + cbz x1, .Lskip_spefds_\@ + /* disable traps to PMSDSFR. */ + orr x0, x0, #HDFGRTR2_EL2_nPMSDSFR_EL1 + +.Lskip_spefds_\@: msr_s SYS_HDFGRTR2_EL2, x0 msr_s SYS_HDFGWTR2_EL2, x0 msr_s SYS_HFGRTR2_EL2, xzr -- 2.34.1