From patchwork Tue May 28 15:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 800841 Received: from mail-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (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 27DB513AD3E for ; Tue, 28 May 2024 15:34:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716910492; cv=none; b=pIzBN/98iTfy84QQKWtmmsPXPOt2yWdD5bKPpiAoN5+pdONRnEvj2xbPP7rSBsdIW50QXH9KpsfPyfFnpQME1yY+bWwJy6SOW9taO41TcOsx7G7WOktpRHi5rOTE6j/DAs7SDi89F0Lan53IJ1Om1zi8vTQX3qk9sfdUEf3tO4k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716910492; c=relaxed/simple; bh=vC0w40MGN2WIUDZQtOSvRbjdb/Y8c0Z7+zFOK9yKr8I=; h=Content-Type:Message-ID:Date:MIME-Version:To:Cc:From:Subject; b=ZXYlJhsIgKWNKZ4pvkaZaPURcUZTyHiztYkieyrV+g8fZoLSQh/ZqWTw16J/R9Vfw0vnt8jBcBAchKgBWgR/83BIiSXb8DMGRtq0aEqpE/g9rPEwiMdAVnA6sSCRO4+IX69beLvx24OXKd/z9UWReZEgX5so1wHSoMKbiHlYqNI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=CFC7nai3; arc=none smtp.client-ip=209.85.166.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="CFC7nai3" Received: by mail-il1-f172.google.com with SMTP id e9e14a558f8ab-3745eb24ffaso609575ab.1 for ; Tue, 28 May 2024 08:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1716910489; x=1717515289; darn=vger.kernel.org; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=TxH2CEzWTNvurLJ95G+sh7WKWtr5xdhPqcXGZ3Cn6xg=; b=CFC7nai3soD6DJLGqICdxJeMGlQbqjDfY/Dm4bgNDHu98HuhsZOR5a5o8/2X3pR56N Kmb421hAPRBPqt+30PEVdNMQ0serZ7JPVApImbvoPa09w9X2Iia+aDh14Kxa+3npyqmK oSS5UyyQi7ZYfA/3ryZcjg/Brw5tv29dl49J8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716910489; x=1717515289; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TxH2CEzWTNvurLJ95G+sh7WKWtr5xdhPqcXGZ3Cn6xg=; b=OfgDlzTt6h4ZA3l6wvXv9jAf6CekDLKmFG5YJZMy+1P9uQto6x76wxtEcGOPThICb2 uHUkwfQtOh+PAwdWtigEoEJoSRk5A4YbViZAhMIGBm2oDMMq07XK6ZbmsJ6eusFRJgyM m+l2+I/hZAlahAp0HR+vOAQaVwKa1gHLj2zLgw3vyO8iVXd25zdj3O8IxJRmqAzqtHv7 d5maqqqOZuhwfdro/oBZDm+DIpRngBCVkkkVyisGhvx9QSgsaQw2XMnDqBoEYN6wQirm pMFTWvshqIFK+v3l8rsnct0beBh8OdQkbqXT7FoVBF/sI9OorOGgdkXYKXcBbExWmy/2 HIOg== X-Forwarded-Encrypted: i=1; AJvYcCWXHtE5pP9kz/NILss5DqVUZDhe1cYMpJAAVH5qf4YKJuJ7MAE9BXvbrQT3nO7An0PbPLUuwAz5sLJ47PGgWy+CzYsI+fkA+aU= X-Gm-Message-State: AOJu0Ywwsz7+28lBIrAuk4s7HgpJ5OgxR5AR42XQi8ezm+jhM9G3IrJX 4Tvge/RyF80fAFFhbJjeCtcC4zDEIJlXNNbYuHcKYppYX5vxJg+kkbIXAkFKh6o= X-Google-Smtp-Source: AGHT+IGKblHKqjZqVeSXuMBNjoXyv02VV7eUy0mqVbJikccfABIah4gX7N0Lf1QhvNWDD4UNGgti/A== X-Received: by 2002:a05:6e02:138e:b0:36c:c599:698a with SMTP id e9e14a558f8ab-3737b3607a5mr127316935ab.2.1716910489169; Tue, 28 May 2024 08:34:49 -0700 (PDT) Received: from [192.168.1.128] ([38.175.170.29]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3737c29e251sm21046455ab.2.2024.05.28.08.34.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 May 2024 08:34:48 -0700 (PDT) Message-ID: <9ff1faf8-eec4-4776-a590-4efbc141fe93@linuxfoundation.org> Date: Tue, 28 May 2024 09:34:47 -0600 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "Rafael J. Wysocki" Cc: shuah , Shuah Khan , Thomas Renninger , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org From: Shuah Khan Subject: [GIT PULL] cpupower update for Linux 6.10-rc2 Hi Rafael, Please pull the following cpupower fixes update for Linux 6.10-rc2. This cpupower fixes update for Linux 6.10-rc2 consists of one single fix to cpupower's P-State frequency calculation and reporting with AMD Family 1Ah+ processors, when using the acpi-cpufreq driver. diff is attached. thanks, -- Shuah ---------------------------------------------------------------- The following changes since commit 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0: Linux 6.10-rc1 (2024-05-26 15:20:12 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux tags/linux-cpupower-6.10-rc2 for you to fetch changes up to 43cad521c6d228ea0c51e248f8e5b3a6295a2849: tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs (2024-05-28 09:22:57 -0600) ---------------------------------------------------------------- linux-cpupower-6.10-rc2 This cpupower fixes update for Linux 6.10-rc2 consists of one single fix to cpupower's P-State frequency calculation and reporting with AMD Family 1Ah+ processors, when using the acpi-cpufreq driver. ---------------------------------------------------------------- Dhananjay Ugwekar (1): tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs tools/power/cpupower/utils/helpers/amd.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) ---------------------------------------------------------------- diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c index c519cc89c97f..0a56e22240fc 100644 --- a/tools/power/cpupower/utils/helpers/amd.c +++ b/tools/power/cpupower/utils/helpers/amd.c @@ -41,6 +41,16 @@ union core_pstate { unsigned res1:31; unsigned en:1; } pstatedef; + /* since fam 1Ah: */ + struct { + unsigned fid:12; + unsigned res1:2; + unsigned vid:8; + unsigned iddval:8; + unsigned idddiv:2; + unsigned res2:31; + unsigned en:1; + } pstatedef2; unsigned long long val; }; @@ -48,6 +58,10 @@ static int get_did(union core_pstate pstate) { int t; + /* Fam 1Ah onward do not use did */ + if (cpupower_cpu_info.family >= 0x1A) + return 0; + if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) t = pstate.pstatedef.did; else if (cpupower_cpu_info.family == 0x12) @@ -61,12 +75,18 @@ static int get_did(union core_pstate pstate) static int get_cof(union core_pstate pstate) { int t; - int fid, did, cof; + int fid, did, cof = 0; did = get_did(pstate); if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) { - fid = pstate.pstatedef.fid; - cof = 200 * fid / did; + if (cpupower_cpu_info.family >= 0x1A) { + fid = pstate.pstatedef2.fid; + if (fid > 0x0f) + cof = (fid * 5); + } else { + fid = pstate.pstatedef.fid; + cof = 200 * fid / did; + } } else { t = 0x10; fid = pstate.pstate.fid;