Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp606547lqp; Thu, 21 Mar 2024 10:03:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVn4JcN9OTiKuNgp1HoKCKiFt4s4tFfyZOF8VaexEaosffUBdSSz6humvDHIoK4xZ0yG8AIsAtwOIwUFskenpToIPMNnlC6kNPTfWaLmA== X-Google-Smtp-Source: AGHT+IEwL/OF/T72RKFuF/873fA7RGQUEthjnbxAezrJ5Z5g8O/fuEIUagL4mnb8T0jk47x/O1VB X-Received: by 2002:a17:902:7616:b0:1dd:e114:121c with SMTP id k22-20020a170902761600b001dde114121cmr9522564pll.56.1711040625185; Thu, 21 Mar 2024 10:03:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711040625; cv=pass; d=google.com; s=arc-20160816; b=mzf2xVS8g0szYJiMIEcVez/G66SxFewE/3hi4/krYK8GaP0x9pxIttLktAp/fRg82V fEjYPPM0yPS0Gbxs4hx/EKnSRXaxOYbgTz1r0KhGF/2c2lqp/cIrvLj2lSk1BI1cHRd+ geWlXsxDOPlp1jKfpfHImA5kAU1lqTE59CAt/YtUJ1kAD4hLBwd8eqtBP0cq+qnX05lh nzARn/q6biLW7w+AwJhdbJNjmvgNPXTXsZKfe4XznORqvpbyf6dU0EgjU8JpN1GhIaKU nBpu5L9Mop4iAwZtf93dRul6LzzAAofOU1GdxNsgBEzXcG3tH+5TMHL8j4Hmwb+bQvOk VfJg== 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:references:in-reply-to:message-id :date:subject:cc:to:from; bh=Inoh9KhiDtu1Es+p3qzbodXSj/Bal4/K8k6je2FffQs=; fh=knouHfhWmUABu+sT2q0nnGKUzC7/WRiZH1KSpGv7uFs=; b=WkJI9096XLLS9k5do4xKm74gz60LGqIfxhu5QVVw4LW7wn0l/0DIkL0feF5kYz/+e3 PJKGcWglkQBqfgPTG+bq6PB1SLVkgPCcD2jwf3UewL6gCDZEgLzDG5G/wW5OTADOxcZ8 Qp6Nxaf836zBMYpNp4WAsI16xVjK3RfnlF2oMkMFHFbdO6GP0m9aHldASkE0+7oyCHSB gZHiYgMsAsQTlamhTDxbOwJJszQek1yxdqD6R5Z0+CDv6MrxhDqxLurMohmrsjK2U18t miWAN6ZBqyqzVIeNlCTsDChaT7DKa9ygOSSnJralnN8Air9cMakfMxI9ZwMV80mMCq8B Exdw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-110438-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 u17-20020a170902e81100b001e073e45b79si100042plg.148.2024.03.21.10.03.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 10:03:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110438-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; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-110438-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 28799282EDA for ; Thu, 21 Mar 2024 17:03:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D661B14036A; Thu, 21 Mar 2024 16:52:39 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0986213F428 for ; Thu, 21 Mar 2024 16:52:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039959; cv=none; b=lO058F8vDu6tloqe6socxXObcjiqVE5zvISkyKwJPLaxLgttkClJhOcY8rxSg+BrN+f4a6EUrNNirrpxw4BtXUmmQ752f2smHrfTpE6ceBqsMwAddZs1BfPC4mGtrHylgKSEVnWBz8Bk5hqvfJG/x9oDn5ZlRyF9HD9DoRizILE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039959; c=relaxed/simple; bh=IwQaaf8zuJ4axtC21pDkJ4vGinVw+XU/Yp1+ON7Papw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mt9cTWvZM3CB8HXyDO0jLteyZJ61RZP7aMLLmM4WXBnkQbQbX4zjXS0nvqA0OgWj86IFbfIb4hjJw5bjLQfkf+zsIJiIJMFdJ3NL+gpmtEVvalfogr9WhdvDPyoQ2xdJq9I6sBetxYw9P9Kp5mgNJP9hrbgo84OcpSq9Od+jkOU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB366168F; Thu, 21 Mar 2024 09:53:11 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AD6953F67D; Thu, 21 Mar 2024 09:52:34 -0700 (PDT) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie , Dave Martin Subject: [PATCH v1 21/31] x86/resctrl: Make prefetch_disable_bits belong to the arch code Date: Thu, 21 Mar 2024 16:50:56 +0000 Message-Id: <20240321165106.31602-22-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240321165106.31602-1-james.morse@arm.com> References: <20240321165106.31602-1-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit prefetch_disable_bits is set by rdtgroup_locksetup_enter() from a value provided by the architecture, but is largely read by other architecture helpers. Instead of exporting this value, make resctrl_arch_get_prefetch_disable_bits() set it so that the other arch-code helpers can use the cached-value. Signed-off-by: James Morse --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c index 856beb6f668b..5a66e3b2c2ea 100644 --- a/arch/x86/kernel/cpu/resctrl/pseudo_lock.c +++ b/arch/x86/kernel/cpu/resctrl/pseudo_lock.c @@ -85,6 +85,8 @@ static const struct class pseudo_lock_class = { */ u64 resctrl_arch_get_prefetch_disable_bits(void) { + prefetch_disable_bits = 0; + if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL || boot_cpu_data.x86 != 6) return 0; @@ -100,7 +102,8 @@ u64 resctrl_arch_get_prefetch_disable_bits(void) * 3 DCU IP Prefetcher Disable (R/W) * 63:4 Reserved */ - return 0xF; + prefetch_disable_bits = 0xF; + break; case INTEL_FAM6_ATOM_GOLDMONT: case INTEL_FAM6_ATOM_GOLDMONT_PLUS: /* @@ -111,10 +114,11 @@ u64 resctrl_arch_get_prefetch_disable_bits(void) * 2 DCU Hardware Prefetcher Disable (R/W) * 63:3 Reserved */ - return 0x5; + prefetch_disable_bits = 0x5; + break; } - return 0; + return prefetch_disable_bits; } /** @@ -715,8 +719,7 @@ int rdtgroup_locksetup_enter(struct rdtgroup *rdtgrp) * Not knowing the bits to disable prefetching implies that this * platform does not support Cache Pseudo-Locking. */ - prefetch_disable_bits = resctrl_arch_get_prefetch_disable_bits(); - if (prefetch_disable_bits == 0) { + if (resctrl_arch_get_prefetch_disable_bits() == 0) { rdt_last_cmd_puts("Pseudo-locking not supported\n"); return -EINVAL; } -- 2.39.2