Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2361584lqp; Sun, 24 Mar 2024 15:46:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUG9uCEDGxew+gX/kGtIidQEDNn93a52aLo3kDdeSCDub/RLZiwNGmCDYsaWdbFAYsVeqO2jDc7h3Raop8bQwnLGYlIc6V21DiY8TeYlQ== X-Google-Smtp-Source: AGHT+IGV33TfvfTbOENDJ1y2+FRTpDtPvyiCtmJVFLZYzkeWs7kXDcw56KEGDC+4DLVFgQVvpoSN X-Received: by 2002:ac8:57c5:0:b0:431:409b:8cd3 with SMTP id w5-20020ac857c5000000b00431409b8cd3mr6380531qta.46.1711320375210; Sun, 24 Mar 2024 15:46:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711320375; cv=pass; d=google.com; s=arc-20160816; b=jOKQh8LzCGDjVtWxnqPxvOrBIEmjZTb209H4e9uUX1Is/Y3+foxoUeT3fEHIANNmm9 +HDAmJXHUL2D34FHlhTQLuRaa/DsG6NzAfcEgTuQaTeL4lCrJrwAz7VCwSWNbyNdTuRy 0n/q3rMD4D7T4TcCSlxKCdJxue92arPCMyyhm2RY7UWE5SS83hORdmnb6nANdB20bcam odlsmmB5zbKjnUNfuDqBziEZBfFfznS7j/OiCYi8BNh7WgxLytkZlXceOQa7yidFpXka APm5eE4Y0aVxX40Xw/k+tfbPCz0CzqVs87upQ5ztflW/+k072wB+544rlFdUv6hV4e87 eFZg== 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:dkim-signature; bh=zbkZKsf35H5dyQL2UflubtsutUoZF/cmGaOTlfG9JUY=; fh=QeBAep1dRQ2Qj+0i7uGWKOu3OqyKogpjFL7e4B5W6TM=; b=SKzK9jFYk8Xi0HERz7kXauRt9LBKX/2+qvmrNNbAMpQDL6+UCVYaFqZQd3yYRkxgFQ PWOboP8WPxgJAWm585Y6PTISVkvbe0DxB60uw+Hc5fPhUiMWky6KL4Yh0Cf/Nap7DDGl S5yoTHML8dQfACE6HE8VnbSaglxbkrAbSW5Sa18PIlTqHudYSJP4fiRIgR3kcmEODl2S niX0TvNlqYF+5jyJaCtmg9lPLuWN4hSBeZDcCAMijgPX43Qn5ShNPQLmXDr3+doiUM7i 00PWsZx2kxKTdSnjTH6GzjB2ohaNXupVhXjxRVofICmAELjNi7XQ72P7DrGUpQ7x0Nim W7xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aYcyow/i"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112932-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112932-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v4-20020a05622a014400b004315bae6af7si411967qtw.472.2024.03.24.15.46.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 15:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112932-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="aYcyow/i"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112932-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112932-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E31DF1C21111 for ; Sun, 24 Mar 2024 22:46:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 95CE374C0C; Sun, 24 Mar 2024 22:35:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aYcyow/i" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F6C74BE1; Sun, 24 Mar 2024 22:35:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319744; cv=none; b=rQpm+gRUdXi2vzXKQ9TYmHIVma7dAO9bbNBn/aobp8VswjyKzmbZ6HZXGxSAXb6U3OnaFZzdS8YXPN15dNJG1J5WxOylx/zDcfX3qoLx7pn8hJiA3ya/ae8V3qqIMytkMMndX1GjUGe+ZktWNkIacfqAnLCgCyTTFZNegLafsms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319744; c=relaxed/simple; bh=Bo9STP/2YMxC8WX0+B/N7gU8gl/AULgfdFnHDucbbc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VxQL/6o4KXa5eMcZAaS3Lzms1ppWgg+0RvB5bAoz6uixrg4xeroYTu5279JPwX7R8os4Sg4VemZcsabH4lJJYGak4QPGqlNOximc1G09uKdPWQe+drRDw61msCyNJtVODKUqPh2XDZwGNMdGBf3bfcEYGDw44YDPLb7u1d45dPY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aYcyow/i; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63FAC433F1; Sun, 24 Mar 2024 22:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319744; bh=Bo9STP/2YMxC8WX0+B/N7gU8gl/AULgfdFnHDucbbc8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aYcyow/iH0Zd/vRUD1WEXXcQeZquECfZrG3WBPwLT8Hwk61UeFN4KtmIc7kbRHfcB 10t8tZkG9glyL2AzmFsRwdM2YNtrKm14P/iW9hl+oC0emi1z2BDm/WzGidPRSXab1/ g61urtO4uwkwdLEadmx/KS2BQS1fmPJz1oSL8JxHYSrQ/41v6tNTBpnw1+J2X0fBRn fGuHseGHjqLiBkwRzMyXsJbefxWsaGVSDaslN24eKL8XMof/kAdgo7OS5d0B1buyEs dztyDQSDAZCN4j+bgqJkCBlnKm6nNaKYiyMl57ihk7Rtodh6//yu6UejAdM+q7RbBW ehJJYhBrDnhJQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Babu Moger , Borislav Petkov , Reinette Chatre , Sasha Levin Subject: [PATCH 6.8 045/715] x86/resctrl: Remove hard-coded memory bandwidth limit Date: Sun, 24 Mar 2024 18:23:44 -0400 Message-ID: <20240324223455.1342824-46-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Babu Moger [ Upstream commit 0976783bb123f30981bc1e7a14d9626a6f63aeac ] The QOS Memory Bandwidth Enforcement Limit is reported by CPUID_Fn80000020_EAX_x01 and CPUID_Fn80000020_EAX_x02: Bits Description 31:0 BW_LEN: Size of the QOS Memory Bandwidth Enforcement Limit. Newer processors can support higher bandwidth limit than the current hard-coded value. Remove latter and detect using CPUID instead. Also, update the register variables eax and edx to match the AMD CPUID definition. The CPUID details are documented in the Processor Programming Reference (PPR) Vol 1.1 for AMD Family 19h Model 11h B1 - 55901 Rev 0.25 in the Link tag below. Fixes: 4d05bf71f157 ("x86/resctrl: Introduce AMD QOS feature") Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Reinette Chatre Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Link: https://lore.kernel.org/r/c26a8ca79d399ed076cf8bf2e9fbc58048808289.1705359148.git.babu.moger@amd.com Signed-off-by: Sasha Levin --- arch/x86/kernel/cpu/resctrl/core.c | 10 ++++------ arch/x86/kernel/cpu/resctrl/internal.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 19e0681f04356..d04371e851b4c 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -231,9 +231,7 @@ static bool __get_mem_config_intel(struct rdt_resource *r) static bool __rdt_get_mem_config_amd(struct rdt_resource *r) { struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); - union cpuid_0x10_3_eax eax; - union cpuid_0x10_x_edx edx; - u32 ebx, ecx, subleaf; + u32 eax, ebx, ecx, edx, subleaf; /* * Query CPUID_Fn80000020_EDX_x01 for MBA and @@ -241,9 +239,9 @@ static bool __rdt_get_mem_config_amd(struct rdt_resource *r) */ subleaf = (r->rid == RDT_RESOURCE_SMBA) ? 2 : 1; - cpuid_count(0x80000020, subleaf, &eax.full, &ebx, &ecx, &edx.full); - hw_res->num_closid = edx.split.cos_max + 1; - r->default_ctrl = MAX_MBA_BW_AMD; + cpuid_count(0x80000020, subleaf, &eax, &ebx, &ecx, &edx); + hw_res->num_closid = edx + 1; + r->default_ctrl = 1 << eax; /* AMD does not use delay */ r->membw.delay_linear = false; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index a4f1aa15f0a2a..d2979748fae47 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -18,7 +18,6 @@ #define MBM_OVERFLOW_INTERVAL 1000 #define MAX_MBA_BW 100u #define MBA_IS_LINEAR 0x4 -#define MAX_MBA_BW_AMD 0x800 #define MBM_CNTR_WIDTH_OFFSET_AMD 20 #define RMID_VAL_ERROR BIT_ULL(63) -- 2.43.0