Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1964906ybh; Tue, 14 Jul 2020 11:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIYyjdMmqD7T9eSkkUQDdipVcgGWE/ri3RUaxOntNDg9Ll/gPrT/9+DVX668T32R9zXgpq X-Received: by 2002:a17:906:2b9b:: with SMTP id m27mr5867961ejg.19.1594752621800; Tue, 14 Jul 2020 11:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594752621; cv=none; d=google.com; s=arc-20160816; b=q+HEgB6E9KfgbZEriw01IJ5Qmr1EWWJjzJKeKFqH7fC/NoR4sKdsUJp8Vy1dd6Iz+K DxDz/u6e4+W7yoYpzYI9C2mWxvCmNxVSTmbmBCyQactEX+8q8bTsLhzoTnIcmtqZ49x0 Ef9VerfnPpbPh42U2iqY8Byikg6xRzx57HxcwR1WmgaB/Mb/jWBOXd3xIxjv9/4PktzH papwtCM73mVTw+zjysW66mN3MjyplAMcmpmcIlBcqgD4Lbers6NI83BxLQWmH7K0MCE6 ILFt94TNJg/QQbCshsOs8SJYlPKgEP8vmgiIrT67OJKO5270ZGHsU6BDoF4c320rXYcV yhyg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lICt4t+4hh5nieAaTM0rPWu8c2nbv1ioQIHbHW8hBjg=; b=wXOqkMG2XN+sb9taQv5EspEL5Bg/hGSqrLc58jX7HerxdQ/rUehGMavyaxdbA4hnja va5Lgha8qMAo+KLXaEaRgJCVXegmnrEcwNasC2Xh2vaFjlTNR0lgKJjVPhlFqgt3X23B BAUn8yac69cy3go6CZ4FNNsIFSwamTBKdxbMdx5AozJlhbKhYYokkeAzas1YFRBdLx2Q 2enZdBf+WfNkW7uR7UtHNMJCkBgdfmB1NumGgcn+PqblDoTSeE7y+E+Q1nNdw77pHna7 Y8gVpm3zlpMBkS+6IF2ZCoGhjB/q3MKaQONlqiNrOGdN6psCM4vlOwYma3lGAUqD3yL9 2oUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XJaqcxge; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i22si11008559edy.547.2020.07.14.11.49.58; Tue, 14 Jul 2020 11:50:21 -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=XJaqcxge; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730028AbgGNSsz (ORCPT + 99 others); Tue, 14 Jul 2020 14:48:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:44548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730015AbgGNSsw (ORCPT ); Tue, 14 Jul 2020 14:48:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3C14922B2A; Tue, 14 Jul 2020 18:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594752531; bh=NbpJd0Lm+GZx1BSXzmwTJkP2fHhPnzL6+/cCHrlwfkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJaqcxgePFy+oDGuUrV36KMBpA2H+wGEU6ezfxT832m9flSUKbF98RA3t1gmMYoeu ZKIJ7RmFLmqbvZ2HRyZi+KFnH2xhVQcojzzVxYkNOp/Hh+cJmvcFdvvlL/HugIqbgO tBbpnuST0PsiceHCyUopanCl5sjUqu0oEdCNmrYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , Ingo Molnar , Sasha Levin Subject: [PATCH 5.4 005/109] perf/x86/rapl: Move RAPL support to common x86 code Date: Tue, 14 Jul 2020 20:43:08 +0200 Message-Id: <20200714184105.778466736@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714184105.507384017@linuxfoundation.org> References: <20200714184105.507384017@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 5053a403e4ae0..3c222d6fdee3b 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