From patchwork Fri Jul 27 11:38:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Walton X-Patchwork-Id: 10546933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 008CF1751 for ; Fri, 27 Jul 2018 11:38:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E251E2B7CD for ; Fri, 27 Jul 2018 11:38:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D22572B7D8; Fri, 27 Jul 2018 11:38:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F89D2B7CD for ; Fri, 27 Jul 2018 11:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730575AbeG0M7z (ORCPT ); Fri, 27 Jul 2018 08:59:55 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:40313 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730537AbeG0M7z (ORCPT ); Fri, 27 Jul 2018 08:59:55 -0400 Received: by mail-it0-f65.google.com with SMTP id h23-v6so6918534ita.5 for ; Fri, 27 Jul 2018 04:38:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kepstin.ca; s=google; h=from:to:cc:subject:date:message-id; bh=8X+pkn91M35ugopLay0L/cQmVmMlQKHVL/hCFSfYtvU=; b=GDKLmOaxb6UOaFpTjkIYxn96IDhRVCq+GuMBSgx95kIjHpi+P0lggXLSITww0gWyFP yYMQCsHyLD5iVeiInf5hDBgE6/alrtxsklxHKuUSL7e/oNQbyfuJaiqtC347R9C3iYDN ye/UDrr0vLB8LuQIju2SBveOxVhzYjEZM8dmw= 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; bh=8X+pkn91M35ugopLay0L/cQmVmMlQKHVL/hCFSfYtvU=; b=tG2vItBc41ZS0CH3DKu4qQRU8k5nReTjSfp+L0REFd2I1Hp/7EWcToGZtEe4ZYq/9o TGKN0kMujijZ3C+/fKOAKvPZGZfp0sdSxXXZsWgnO/tvfG9RMU/iQQCHzJp2KRMmdEAx IkVyjr6hP3T2BCE9NzmiWJ7s2GtKEPbL9sq+p3cTUMwe0avDbRT42F/d8mPkkw7KFPUI /nNeJqkgAXr5RqWUZawCKaGUyc82r76Zff8mniyEzv782frEa3Ke7WorJkJy+NbpjSrR qg9tON974GQg1NZc5wgu+0hID6gVswSyXP3wGwoDbR1WXU4pNP/9aZxCXbHMbq2w6JLx qkBA== X-Gm-Message-State: AOUpUlHdonGmPWwjBUaMLLt86uj3C4CFjWOHKpikD5L2eN+/pXnFI5qc F8BmVb8jyEtbL81DSjbDbO1Xew== X-Google-Smtp-Source: AAOMgpdwsGHHSC2dE6WfI9nNmTOgBWCgtulcEerCuHfJ/GeXnFgIPeA+tgiv1TgWnTSy0u04c7C4HQ== X-Received: by 2002:a24:97cd:: with SMTP id k196-v6mr4831805ite.93.1532691503950; Fri, 27 Jul 2018 04:38:23 -0700 (PDT) Received: from fuko.kepstin.ca ([2001:470:b3f4::561]) by smtp.gmail.com with ESMTPSA id e2-v6sm1302869ioa.33.2018.07.27.04.38.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 04:38:23 -0700 (PDT) From: Calvin Walton To: Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Calvin Walton Subject: [PATCH v2] turbostat: Read extended processor family from CPUID Date: Fri, 27 Jul 2018 07:38:09 -0400 Message-Id: <20180727113809.8427-1-calvin.walton@kepstin.ca> X-Mailer: git-send-email 2.18.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes the reported family on modern AMD processors (e.g. Ryzen, which is family 0x17). Previously these processors all showed up as family 0xf. See the document https://support.amd.com/TechDocs/56255_OSRR.pdf section CPUID_Fn00000001_EAX for how to calculate the family from the BaseFamily and ExtFamily values. This matches the code in arch/x86/lib/cpu.c Signed-off-by: Calvin Walton --- I'm still working on updating the RAPL patch on top of the changes for v4.18, but this CPUID fix doesn't have to wait. tools/power/x86/turbostat/turbostat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index bd9c6b31a504..8452ace384b3 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c @@ -4031,7 +4031,9 @@ void process_cpuid() family = (fms >> 8) & 0xf; model = (fms >> 4) & 0xf; stepping = fms & 0xf; - if (family == 6 || family == 0xf) + if (family == 0xf) + family += (fms >> 20) & 0xff; + if (family == 6 || family >= 0xf) model += ((fms >> 16) & 0xf) << 4; if (!quiet) {