Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3216052pxb; Mon, 25 Jan 2021 09:48:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWHNVipOtfbw6E0KuNyq7/U/j57oWH5psy97KCsCa+55ECYzyakZ1fmacER200J8qnfhpF X-Received: by 2002:a17:907:2138:: with SMTP id qo24mr1055069ejb.425.1611596914726; Mon, 25 Jan 2021 09:48:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1611596914; cv=pass; d=google.com; s=arc-20160816; b=nA76FsVyVY7VTYeckWDjNoppsfYLKZdu0hpsWkLV4CkdKp9jkVwOKrDjDRbkVt1cH9 Fh2jNemoHzj/ai3XHHBDS+JOkB3e6xKzxIbR7ANGPBdHCIgqapOTAg3WJ1l1hye6u+9s qYtohGMAVEtSZ6PdEdmK18WGBZFFMTFNYmhbabYqXwruYJ6mChAQeRKpC/2ipSA+3IMk MlXjKrun+cniJZk0pbk6hex11G97xqyn5eCFBKpKq2OudkHViA8ZIfvz09H+CRfH6sdf /qc/IKZouoGUrHDjIecQ0OZaTU8dHUuAEWZgfBdjR5sQ+Iy8NLWiq876xA9zQk9f3lHJ kCXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=XceB1BCT5EN97DuHT6dB6Q54FxGRuygR5bRGOk5yhbk=; b=MMCxB6KMuWpyQE+ID3nrKnm2Fuhi8k0nsduQd4e9K8zwI7pEEnb/XLFPJYmt/o2Gmh L9EX2U6WN6bynLHQoMZy/tjaK66NeExo08zIuaW7Cv7Xiz938UZcyKK0RMfUFn727apv /5DKgPBsKrSK2/YfJIoWLJWKp3ciaDMCbqN7UI91/2K2bg29UuctlbjMTCx7MLhUIZBL tZ7OUPCL+AwTD6RSB/C4BIRoQLjjjrwla6XDCLjUAgNG3BP3USZfNJzpAZsr+MKEZ2aA f3Tiz7nAhK3ZcUvpHoi/EX94uUhzTMCiMCXdTk+G5qqVD3Dry4m/Y/mTwAqY3RMwN84v pkxQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=xD9ORPsJ; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=NONE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si6117177ejd.397.2021.01.25.09.48.09; Mon, 25 Jan 2021 09:48:34 -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=@amd.com header.s=selector1 header.b=xD9ORPsJ; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); 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=NONE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731044AbhAYRoW (ORCPT + 99 others); Mon, 25 Jan 2021 12:44:22 -0500 Received: from mail-bn8nam11on2041.outbound.protection.outlook.com ([40.107.236.41]:64288 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730850AbhAYRgp (ORCPT ); Mon, 25 Jan 2021 12:36:45 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JjD+urSjvrz8V8PaFn/a/hRk8W/aqvr5FHePPOekKqj1U1mgy8vfMYRRc1AhRJ7e2nQeueXsFp3X8fNbPzXemalcGqdShwyTpdBSS2Yz0PkCs4L0hhWUT8/MojWlQEsMs7+YKeUP0Su+/ljIy7tjaj+r5AVdfUD/gtjjkYP/tB3Xb/2GEjtAc70JdubHGqI+W+Z+aPWneoD5iYXg/kkl1cUlJSgoTapSrP9b/kRaXgcdC8D/nDVf76kwcWh53QEfJ2gqeRr9cDgIaru+mpF+twjpLXHjkKz9nvcp+Q9rX0mDOurXVM/jJrpu8qVemd+rF3ce9xPwZSFNlqr7MVSqvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XceB1BCT5EN97DuHT6dB6Q54FxGRuygR5bRGOk5yhbk=; b=iZSdw0aVL1i45c8m4vuw7WEmWF82rlqeA8ZG9iFVmL2oYReQldT2y+kz8e6wb6c92rvKtYoAH0ZrTqxbhym6uCfoP7Vt8QpM4ew9CgnTvL38X6mqvcvpxQmvxNUlbbaTstiYJEPH/K0TlWY5gs0NgIDlZD/SEMsaxvnKPis39CJCR0+OVa+gSNgUSPm8OEZ36+r49vUA2n/iKY7zZQASuBI+nHJguUOodh8tUZ9mk7NfJByeva5g69hXRf98qwCTHh5Ncy8yofbzK0n66Ovcj7Qk0z1Y9dbOo+qwfqpIJ6YKicklv2571VhE535VSOu2S4ZuMBapNpfp0Po7aq3FjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XceB1BCT5EN97DuHT6dB6Q54FxGRuygR5bRGOk5yhbk=; b=xD9ORPsJ+yzxfhANipfLEp4/hu/q2h6AGsfciaFUwRZjITpFUw1MvIn71k4GgiiJHahjjfFJZTBPGopxuOdU3VR3My+G9sH4dgI0AiCFHhjOmnYbfPE2FT+pk9OHfQ5xuIfjXDwpDnOPi5ufEGGpDA2iogYcGX/RCrr75lRiY1g= Authentication-Results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB4720.namprd12.prod.outlook.com (2603:10b6:805:e6::31) by SN1PR12MB2576.namprd12.prod.outlook.com (2603:10b6:802:22::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11; Mon, 25 Jan 2021 17:35:51 +0000 Received: from SN6PR12MB4720.namprd12.prod.outlook.com ([fe80::71a3:7df5:647c:1665]) by SN6PR12MB4720.namprd12.prod.outlook.com ([fe80::71a3:7df5:647c:1665%6]) with mapi id 15.20.3784.019; Mon, 25 Jan 2021 17:35:51 +0000 Subject: [PATCH v2 6/8] cpupower: Condense pstate enabled bit checks in decode_pstates() From: Nathan Fontenot To: rrichter@amd.com, shuah@kernel.org, linux-kernel@vger.kernel.org, trenn@suse.com, linux-pm@vger.kernel.org Cc: boris.ostrovsky@oracle.com, joao.m.martins@oracle.com, konrad.wilk@oracle.com Date: Mon, 25 Jan 2021 11:35:23 -0600 Message-ID: <161159612365.68367.13306256100078302569.stgit@ethanol01c7-host.amd.com> In-Reply-To: <161159600371.68367.14890273216040482793.stgit@ethanol01c7-host.amd.com> References: <161159600371.68367.14890273216040482793.stgit@ethanol01c7-host.amd.com> User-Agent: StGit/0.17.1-dirty Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [165.204.78.2] X-ClientProxiedBy: SN1PR12CA0086.namprd12.prod.outlook.com (2603:10b6:802:21::21) To SN6PR12MB4720.namprd12.prod.outlook.com (2603:10b6:805:e6::31) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ethanol01c7-host.amd.com (165.204.78.2) by SN1PR12CA0086.namprd12.prod.outlook.com (2603:10b6:802:21::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Mon, 25 Jan 2021 17:35:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4ac6ab13-0961-47e1-c60b-08d8c157a913 X-MS-TrafficTypeDiagnostic: SN1PR12MB2576: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2JM5vLy8wUd6NII0FxsQY0IKq1M2+WEZlTPrDh9RtSJ/6VDSbpazIwhT5s/uU0+JZP63hE29JceKlkpSRpkxeR1U7dyTcIb0k4aYnS95l8syvTde/xGV+U7C/25rCr79ipW3nP7/+1Xd1+BwONT2SJ3kZUqAF4T06Geg/OScNWMizT0iekK2KrNHOP9XzzDz3wPtV+2vJWu6DmpAuo7awtRzPPv/+XIMxzkH7ZHWHrAs1uoIpPVp6qOUNh9qAW4Yt/BtUNOYb4SagQQva9QC6ezDsQgNDnn1AjvYpuicDk/oqRMvjOLGbjwkKtRxfyQBkRpWA8Youc3KgLHxLPa3aWkJQle6oRwd0dOv6/llFrs58klNnQJ7uAasOoYhk3jjiLntTB9TIvmlZxC93MMvLg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB4720.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(66476007)(66946007)(66556008)(5660300002)(4744005)(7696005)(52116002)(8676002)(956004)(4326008)(83380400001)(44832011)(2906002)(6666004)(86362001)(8936002)(26005)(186003)(16526019)(498600001)(55016002)(103116003);DIR:OU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djbklsKzF0TU1SUzVaSFdYWTZXQnllVzB4?= =?utf-8?B?K1ZIYXJ3emVsc0s1cm5rbWJXT2V2TCtpZWxYM3hWcEMwRDNaUTBBTVhhMkpN?= =?utf-8?B?dFA0NjhwN2l0c1JpZ0ZWTkJ4ZXd4MlZYczJkMXdkaTVvakdtSGZYelROa0FP?= =?utf-8?B?THZQdWZhRE5TUERPai9uc2dtMjY5OHl2RWtPa1IvL3dxdzROeFNPYWdJWGpr?= =?utf-8?B?Z1RNV1JDeTN5TFNhQTBqNHhzZlY2eTk4KzNRcGxWVnAyUUloTDAvT1k2WHRR?= =?utf-8?B?UGZlRVBvVlpQajdyMXJ0TFdaYnpSLytqMEFLOGI3dlVVYXFpMzRyMzR2SUJi?= =?utf-8?B?eTZCekVsZ3VOamZTekw2ZzYrSmUxK1N6MDlBS0l5OE1OVjk0YzBVRm5mNVNE?= =?utf-8?B?UGhwbFVEQS9nYnMrMmViQUFVUXRuVVRVRFlwakhXSFRVVEFUL1ZNMEJyQVZk?= =?utf-8?B?aVZXVUVYdHRWQXVuZThFN2RrWDFrays4bEk4QjA2YithcnEwVDIvbGV2b3gw?= =?utf-8?B?VnFpQ3pTUVNjNnpVUkRFZU91c3ZSRzhpbnBIUE9MaTBEV0pwMUFtWjlVcE1i?= =?utf-8?Q?ehmCVOH5?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ac6ab13-0961-47e1-c60b-08d8c157a913 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB4720.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2021 17:35:51.7105 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pxNeFQjZ0rKxIYjvP6fdUsjEPVwzruH5yiAq4G3QGvzzFZl1d6S/EspF6+2VQaKco513XCbTfWAG5jQ534SVAw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2576 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The enabled bit (bit 63) is common for all families so we can remove the multiple enabled checks based on family and have a common check for HW pstate enabled. Signed-off-by: Nathan Fontenot --- tools/power/cpupower/utils/helpers/amd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c index b4731daa6820..216240e2b771 100644 --- a/tools/power/cpupower/utils/helpers/amd.c +++ b/tools/power/cpupower/utils/helpers/amd.c @@ -113,9 +113,9 @@ int decode_pstates(unsigned int cpu, unsigned int cpu_family, } if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val)) return -1; - if ((cpu_family == 0x17) && (!pstate.pstatedef.en)) - continue; - else if (!pstate.pstate.en) + + /* The enabled bit (bit 63) is common for all families */ + if (!pstate.pstatedef.en) continue; pstates[i] = get_cof(cpu_family, pstate);