Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp37089pxu; Wed, 25 Nov 2020 12:24:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyzdvI68I5+mLJhO5NSvRRHzx9bT7EXyTL3u0dr/8Y7G9Oe4HYtPmIYjfEhrbea86EFxdt X-Received: by 2002:a17:906:e0d2:: with SMTP id gl18mr4756202ejb.412.1606335897423; Wed, 25 Nov 2020 12:24:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606335897; cv=none; d=google.com; s=arc-20160816; b=lD2LjaN0VEh7j8SfAditxTjVQn1VmHJc3CXTrbmLZzc6xb2I0lCF8gfnFVOOte6DuE MD8h77DAbf344/o1jCqw3U0kyLQOGbL2TURea/kQUSSJMo8frQ7KdUwAZUbj/PorJRq0 JNLdEVlOASqI6EfPabj0+4irceKCFvUKi4c2VR6ZJeeBsW9dSj7Kk8fYEt7z85Qzva9U 4hCOUGSSj7Hy9NcPAQE++UmcPubww1OeFMBOM/PZzXBfa1Bp1i7Iy6sGCEji6f3JVvQA f6wrsIOshhVRS67TwD5cWZyksfKy3/IZEALzNh3yWQpaVa2pZqmr4rkTAperaouXIh/3 i2Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WVPNTvoMuQocXBX6B4Z3CjlCN/T/BkddtPlKeTTNYgw=; b=upVYKC4p5oaCKkS5EP5NJeeItVXGBJGJNGkiTT3L+SpK8XOB4iHUQf2YrauPTsnC8t HAv2tvdPjXakcmCp1FU/6dSfdBz/2aHhGjPDEZaxJZoRyLmqRf2DJd3IwSAZtNH/nZIn Elw/H1bQTXGLlXnamZkYSRa9hQX6VKXKq8AgvW9iWzvL2JzMYb7p967jY2XzUFdSARp5 sC+8QK9o7gcGmuPI/w72/s7ZSwKHtcPCC0Jw1f7RV1JLS9KzJcApyTfCdg7vN5SA0Ddp yqbgXg4waRGDOmsdmKYsYlh+N2qDNclKU624NWlwpenET/k2i98RdDxxs7gozKwwFHJj WNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c1itlySO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j7si2030396ejm.476.2020.11.25.12.24.33; Wed, 25 Nov 2020 12:24:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=c1itlySO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730050AbgKYOtN (ORCPT + 99 others); Wed, 25 Nov 2020 09:49:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbgKYOtN (ORCPT ); Wed, 25 Nov 2020 09:49:13 -0500 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 597D1C0613D4; Wed, 25 Nov 2020 06:49:13 -0800 (PST) Received: by mail-pf1-x444.google.com with SMTP id c66so2544865pfa.4; Wed, 25 Nov 2020 06:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WVPNTvoMuQocXBX6B4Z3CjlCN/T/BkddtPlKeTTNYgw=; b=c1itlySO2ll3i6JaldcbD1GGXWzYGcLgqRT0/m/4vT+mxLl2+NStii1ZzLi9yVoOIq HgECDyFXwPCsj7J4AlBmyafeGbKBMvsqJRWrVZbMl7gHslsFkxPyXoK2kCGy1f8V48yA Yb8EEntNmKw+sYNit4lhq/QLeevTBsBvyQF5PeAjd5ZZM37NqSDoFMlP0KPZWiHFKfkE 2+DuQuAE+aw8KuQS8rhnyPKhes39N3Cd3eCnTteL2QuUtB7azTcC6nheJiGpMYap1vGO NF4uwEGBAV2kb4AItJTUP3i6mLOHQeP5SEFKH7s50XUfpO+i8u5N9yJImRw8CkMV7qmC UyyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WVPNTvoMuQocXBX6B4Z3CjlCN/T/BkddtPlKeTTNYgw=; b=qpKM/c0s7Tap4KlMoiWhF/QFLlIbTAA0nhFNNoh+88C07S+NE2GuVmupaLELLEScGU 2zx+ItUKAN7H/r15MOd3+fmzowtDgdSNG/YYC5Udx0db9nmJis3f3+d3f5fUMLiRfMvK 5nNrJLjuPgYlmar9v1O5GjLss3aCijTNB4/11BSDFMqgGsqYbuTVQdWQUQhBXcm0zTqI Ik8isVpaXcs+P+zbsizs186fi4A/J9gS8O4C71ZvlH8lkpXZ216JEjki03ZKjkSGqpdZ ynvMPJL7r4f5C9ChVXrv8HjCtEHhPkkq5mVJ1i3mjm5QxwPEprZc+or2xUBsPm3xB7vP Z/Xg== X-Gm-Message-State: AOAM531nx9O9WsAhO4x1W2e3fS5Db46FY7WpYAnGq4VIMtEg2h73VZmt Ru1WgEUg5YK4I9DVHAXBMl0= X-Received: by 2002:aa7:973d:0:b029:18b:23db:7711 with SMTP id k29-20020aa7973d0000b029018b23db7711mr2792467pfg.13.1606315752854; Wed, 25 Nov 2020 06:49:12 -0800 (PST) Received: from localhost ([2405:6580:31a1:500:1ac0:4dff:fe39:5426]) by smtp.gmail.com with ESMTPSA id d7sm2282649pfd.214.2020.11.25.06.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 06:49:11 -0800 (PST) From: Punit Agrawal To: rjw@rjwysocki.net Cc: Punit Agrawal , wei.huang2@amd.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, bp@alien8.de, x86@kernel.org Subject: [RFC PATCH 1/4] cpufreq: acpi-cpufreq: Re-factor overriding ACPI PSD Date: Wed, 25 Nov 2020 23:48:44 +0900 Message-Id: <20201125144847.3920-2-punitagrawal@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201125144847.3920-1-punitagrawal@gmail.com> References: <20201125144847.3920-1-punitagrawal@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Re-factor the code to override the firmware provided frequency domain information (via PSD) to localise the checks in one function. No functional change intended. Signed-off-by: Punit Agrawal Cc: Wei Huang --- drivers/cpufreq/acpi-cpufreq.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 1e4fbb002a31..b1e7df96d428 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -191,6 +191,20 @@ static int check_amd_hwpstate_cpu(unsigned int cpuid) return cpu_has(cpu, X86_FEATURE_HW_PSTATE); } +static int override_acpi_psd(unsigned int cpu_id) +{ + struct cpuinfo_x86 *c = &boot_cpu_data; + + if (c->x86_vendor == X86_VENDOR_AMD) { + if (!check_amd_hwpstate_cpu(cpu_id)) + return false; + + return c->x86 < 0x19; + } + + return false; +} + static unsigned extract_io(struct cpufreq_policy *policy, u32 value) { struct acpi_cpufreq_data *data = policy->driver_data; @@ -691,8 +705,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) cpumask_copy(policy->cpus, topology_core_cpumask(cpu)); } - if (check_amd_hwpstate_cpu(cpu) && boot_cpu_data.x86 < 0x19 && - !acpi_pstate_strict) { + if (override_acpi_psd(cpu) && !acpi_pstate_strict) { cpumask_clear(policy->cpus); cpumask_set_cpu(cpu, policy->cpus); cpumask_copy(data->freqdomain_cpus, -- 2.29.2