Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4598287imm; Fri, 18 May 2018 07:42:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp/Qw0JHp7k51+gqEqg3UlgJMM/wY9sbmuNpevkTAJ/VOvRNQ6VzF5a2ZHaQmlX5iuYBWAv X-Received: by 2002:a17:902:a512:: with SMTP id s18-v6mr9783013plq.223.1526654564156; Fri, 18 May 2018 07:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526654564; cv=none; d=google.com; s=arc-20160816; b=JwyuIlJcyjsfJIeYrheM/el8fFQCdjE8l9Cs6YhD76lNtzol4vzH/bCo+0DVJ6GB93 3MxobrzwJBEBBJu0ZWrDfMBbhUZeR64iYRqn+lOJS0ZvCKjAJDLTVlHYwaEMgE5zRqLZ O3NNzIRpSdc2+tJNZ6jRILJVQmIV73Z+X6khNAEjurvOiypDfBxPBCDTpJFF1Us0Eq11 n4/8G4LXu/0CoDVvKYTPVh4oQU1QUgsBz21W8eqdck2iSPYmL3dSpG8xdZ9uR3+B+yWA D5HcS8WL/QLv9LNGyJL/T8XQbh13RdbhksRtjsZsAV6+GI95YYwT9G3u0zlg+QeeOdL7 TAvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7MT28kGq4JomW7UTZxpOWkcWEZHXUFa0i7PgAZNPFOQ=; b=cp75tJbHaSSwyFSRuTCCGgOTor57iCeE1hMZjWBa3QVq95EUT2MIM9zPBRngo25aqb 6rBPD9BqksmBjTzlK2me6DJcL2Hvil/wQCcS6p51/bus9IcN/w8bUdM3OF6oi2HDyr5c Fc9GC2WRrXGSVfW92XN6m0mYBNJSCgW4iTeoGKKa6FKFPq9LtApPJbMwn1Eh763rZqXx /nJt1+wC2anIlg95TvkfNonKAeHSPuCxUU4vuoPsJCeJ2p375+b+xWR82WiUVz5xHQg2 gpudGB9cnXchusvdrc5Rdrd3HNAJlJiocvzp4JnxjR5E/Y7JQnoEV1VX6lK5Zh0UX+QF VOZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t20-v6si7334035plo.326.2018.05.18.07.42.29; Fri, 18 May 2018 07:42:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751665AbeEROj0 (ORCPT + 99 others); Fri, 18 May 2018 10:39:26 -0400 Received: from foss.arm.com ([217.140.101.70]:54094 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751105AbeEROjY (ORCPT ); Fri, 18 May 2018 10:39:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D4C621529; Fri, 18 May 2018 07:39:23 -0700 (PDT) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.206.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E6D9A3F24A; Fri, 18 May 2018 07:39:21 -0700 (PDT) From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Will Deacon , Mark Rutland , Russell King , Vladimir Murzin , Vince Weaver , Peter Zijlstra , Stefan Wahren , Eric Anholt , Florian Fainelli Subject: [PATCH v3 0/5] Date: Fri, 18 May 2018 15:39:08 +0100 Message-Id: <20180518143913.26306-1-marc.zyngier@arm.com> X-Mailer: git-send-email 2.14.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PMUv3 has been introduced with ARMv8 and, while it has only been used on 64bit systems so far, it would definitely be useful for 32bit guests running under KVM/arm64, for example. There is also the case of people natively running 32bit kernels on 64bit HW and trying to upstream unspeakable hacks, hoping that the stars will align and that they'll win the lottery (see [1]). So let's try again, and make the PMUv3 driver usable for everyone. This is done in three steps: (1) Move the driver from arch/arm64 to drivers/perf (2) Add a handful of system register accessors so that we can reuse the driver on 32bit (3) Provide the same accessors on 32bit, enable compilation, and make it the default selection for mach-virt. Tested on a Seattle box with 32bit guests. * From v1: - Fixed encodings for some CP15 accessors - Added a terse note saying that CPU_V7 also covers ARMv8 - Rebased on v4.12-rc5 * From v2: - SPDX tags on new and moved files. Yeah! - Annual rebase on 4.17-rc5 [1] https://patchwork.kernel.org/patch/10406793/ Marc Zyngier (5): arm64: perf: Move PMUv3 driver to drivers/perf arm64: perf: Abstract system register accesses away ARM: Make CONFIG_CPU_V7 valid for 32bit ARMv8 implementations ARM: perf: Allow the use of the PMUv3 driver on 32bit ARM ARM: mach-virt: Select PMUv3 driver by default arch/arm/Kconfig | 1 + arch/arm/include/asm/arm_pmuv3.h | 125 +++++++++++++++++++++ arch/arm/mm/Kconfig | 2 +- arch/arm64/include/asm/arm_pmuv3.h | 111 ++++++++++++++++++ arch/arm64/include/asm/perf_event.h | 55 --------- arch/arm64/kernel/Makefile | 1 - drivers/perf/Kconfig | 8 ++ drivers/perf/Makefile | 1 + .../perf_event.c => drivers/perf/arm_pmuv3.c | 42 ++++--- include/kvm/arm_pmu.h | 2 +- include/linux/perf/arm_pmuv3.h | 78 +++++++++++++ 11 files changed, 346 insertions(+), 80 deletions(-) create mode 100644 arch/arm/include/asm/arm_pmuv3.h create mode 100644 arch/arm64/include/asm/arm_pmuv3.h rename arch/arm64/kernel/perf_event.c => drivers/perf/arm_pmuv3.c (97%) create mode 100644 include/linux/perf/arm_pmuv3.h -- 2.14.2