Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1081667ybt; Wed, 1 Jul 2020 18:23:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrNPqV05T/pYWTw/NUgY6yrIZvbSDfmV+dYu9KQt7kdsWPNAcvu8YACSqqb9BNDLQK1Tsq X-Received: by 2002:a17:906:fcb1:: with SMTP id qw17mr24515780ejb.445.1593652995616; Wed, 01 Jul 2020 18:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593652995; cv=none; d=google.com; s=arc-20160816; b=lYJ0GN4Lqq7KQ2OXULcL45iLju4bSpOvsI8LKc03F1g7vuDJzqm+nvjhWSJtYB7kcE 3slJGhtin47fr1FHtXTtjWk3qT3SNP/xz4S7GqnB4RX1FmdgpKAHZ7iG745H5KzfQQU8 B1mjRDthqH3AGGl6LjRODOkE6ZmZE8WSFLvyQXn5AfoJD+DuhElaiCckXXi7Pll0gE4j xIs582o8DtjGQh5MBugVV9yAUw1bx9AQcWZm3dSoui7DFKW8RRlcOnEmwa5cUUugeMs6 0Cohzix66evulZl+haQ3NKSupAGrFPwgNAY0tIf0s+FTSJROhmy+StSDhSBGvAsOAyot Okzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IbhSDzd+QQZhmfnxyft0HPPEvCLz4WMHCFDzwwwvUz0=; b=wEmCHka2FJg1MXnB5Hl5rs0sarbu2ktyJ2SyFo1u5IrShPiH2MdOCFQ5WI18rR7SFt 2Yse9kux+cWOnQCEcw7Hf6AVP1mNCcm3AG2EwoUVJ5Ko6ilNhXCD5oZFBYb65SHRyTpz 5Z4FNUQo7qaumKqOgH0Y38e9qVtzjYBODAT64c07TJL5U7qYUszvVu+jJwHJXOLWabJV 1wpFc9m65GhkdwVcq1t08he7Ah+Xq0gt0QCRjl5vqxm6dPAyPtAGZWq4RYf56zktDjFA vGyK3A1eVc9lZZTi5dSvq92hQzP8faILxMoLayMbnLdJP2ib5MOrX2XdS2hrzSqpldhQ /ZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QD8JIKCM; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si4752945eji.192.2020.07.01.18.22.52; Wed, 01 Jul 2020 18:23:15 -0700 (PDT) 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=@kernel.org header.s=default header.b=QD8JIKCM; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728143AbgGBBWJ (ORCPT + 99 others); Wed, 1 Jul 2020 21:22:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:53048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728108AbgGBBWH (ORCPT ); Wed, 1 Jul 2020 21:22:07 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E822B2085B; Thu, 2 Jul 2020 01:22:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593652926; bh=Sc6/7a4ZFbtbmwQKk3K67o57mnr8p/wUtpto7eiLetM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QD8JIKCM/hOx3Mew1Js1i2YKrCyXNOpXYkqL/odaOJzF4a12DGhBZF2hb8Y9WTlUr OiLZvZk3LE73RfrIEmExxTwmU1BOwhmxHTL6DWNmeVppmDNN8EHNswS9m6srX8iFmw g71iOGQyTgAPtB7yLhlgFjd4ohRF0CMk8RuLuAJw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Stephane Eranian , Ingo Molnar , Sasha Levin Subject: [PATCH AUTOSEL 5.7 03/53] perf/x86/rapl: Move RAPL support to common x86 code Date: Wed, 1 Jul 2020 21:21:12 -0400 Message-Id: <20200702012202.2700645-3-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stephane Eranian [ Upstream commit fd3ae1e1587d64ef8cc8e361903d33625458073e ] To prepare for support of both Intel and AMD RAPL. As per the AMD PPR, Fam17h support Package RAPL counters to monitor power usage. The RAPL counter operates as with Intel RAPL, and as such it is beneficial to share the code. No change in functionality. Signed-off-by: Stephane Eranian Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20200527224659.206129-2-eranian@google.com Signed-off-by: Sasha Levin --- arch/x86/events/Kconfig | 6 +++--- arch/x86/events/Makefile | 1 + arch/x86/events/intel/Makefile | 2 -- arch/x86/events/{intel => }/rapl.c | 9 ++++++--- 4 files changed, 10 insertions(+), 8 deletions(-) rename arch/x86/events/{intel => }/rapl.c (98%) diff --git a/arch/x86/events/Kconfig b/arch/x86/events/Kconfig index 9a7a1446cb3a0..4a809c6cbd2f5 100644 --- a/arch/x86/events/Kconfig +++ b/arch/x86/events/Kconfig @@ -10,11 +10,11 @@ config PERF_EVENTS_INTEL_UNCORE available on NehalemEX and more modern processors. config PERF_EVENTS_INTEL_RAPL - tristate "Intel rapl performance events" - depends on PERF_EVENTS && CPU_SUP_INTEL && PCI + tristate "Intel/AMD rapl performance events" + depends on PERF_EVENTS && (CPU_SUP_INTEL || CPU_SUP_AMD) && PCI default y ---help--- - Include support for Intel rapl performance events for power + Include support for Intel and AMD rapl performance events for power monitoring on modern processors. config PERF_EVENTS_INTEL_CSTATE diff --git a/arch/x86/events/Makefile b/arch/x86/events/Makefile index 9e07f554333fb..b418ef6878796 100644 --- a/arch/x86/events/Makefile +++ b/arch/x86/events/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y += core.o probe.o +obj-$(PERF_EVENTS_INTEL_RAPL) += rapl.o obj-y += amd/ obj-$(CONFIG_X86_LOCAL_APIC) += msr.o obj-$(CONFIG_CPU_SUP_INTEL) += intel/ diff --git a/arch/x86/events/intel/Makefile b/arch/x86/events/intel/Makefile index 3468b0c1dc7c9..e67a5886336c1 100644 --- a/arch/x86/events/intel/Makefile +++ b/arch/x86/events/intel/Makefile @@ -2,8 +2,6 @@ obj-$(CONFIG_CPU_SUP_INTEL) += core.o bts.o obj-$(CONFIG_CPU_SUP_INTEL) += ds.o knc.o obj-$(CONFIG_CPU_SUP_INTEL) += lbr.o p4.o p6.o pt.o -obj-$(CONFIG_PERF_EVENTS_INTEL_RAPL) += intel-rapl-perf.o -intel-rapl-perf-objs := rapl.o obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += intel-uncore.o intel-uncore-objs := uncore.o uncore_nhmex.o uncore_snb.o uncore_snbep.o obj-$(CONFIG_PERF_EVENTS_INTEL_CSTATE) += intel-cstate.o diff --git a/arch/x86/events/intel/rapl.c b/arch/x86/events/rapl.c similarity index 98% rename from arch/x86/events/intel/rapl.c rename to arch/x86/events/rapl.c index a5dbd25852cb7..ece043fb7b494 100644 --- a/arch/x86/events/intel/rapl.c +++ b/arch/x86/events/rapl.c @@ -1,11 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Support Intel RAPL energy consumption counters + * Support Intel/AMD RAPL energy consumption counters * Copyright (C) 2013 Google, Inc., Stephane Eranian * * Intel RAPL interface is specified in the IA-32 Manual Vol3b * section 14.7.1 (September 2013) * + * AMD RAPL interface for Fam17h is described in the public PPR: + * https://bugzilla.kernel.org/show_bug.cgi?id=206537 + * * RAPL provides more controls than just reporting energy consumption * however here we only expose the 3 energy consumption free running * counters (pp0, pkg, dram). @@ -58,8 +61,8 @@ #include #include #include -#include "../perf_event.h" -#include "../probe.h" +#include "perf_event.h" +#include "probe.h" MODULE_LICENSE("GPL"); -- 2.25.1