Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4469587pxf; Tue, 30 Mar 2021 08:33:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN/79oZh2RSxopUcHHr+G4oK2f/FomAXh41nRr02t/EK7eWwO2AP1Q/CiNM6R5Urr33Rqf X-Received: by 2002:a05:6402:35c8:: with SMTP id z8mr34153701edc.341.1617118389342; Tue, 30 Mar 2021 08:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617118389; cv=none; d=google.com; s=arc-20160816; b=ohVM9vpg5KC+rpa3gRYmGKYZXRPb5iiW7lfO0KR6mFHIswtQHGZzH7U9JmdEQIHWr3 mdakaIVWqQ9DCJcmLPtNYl8BO0cymWNxjt12hor2NUNtMisglOF6f5M8ZLFyabVX1L1L WWuETjwlND/xgvOVxDNFyUNlQMLPPGUADSEr1lb+Pu5I9Wg++l5T84CfwxKPxYILP5r0 XSQYM12G70VZaRip15FdYyyTITOZhU2klMZHzDHh+/zPWjNFRuJCFSS+Qt+b9NHrhkvS cGRVanVFWyNIeFZk9dde/T6+HyfQVXHyq6q24Rv/UVwP81W5Iw1coPzJOaxtMJkpwPWD 7dqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=nTYiUg/eEDALNrxpTrwWUbo+9C9/0h330uF1jYGGRG0=; b=AZGc3OHeU73haPU9TWK+u9Os6s0ePwY53RzMNUh55edLOwZTK9+rz/POaepV8L8ZTZ jM1DPYc9M1/xU9lUaL0TO3jQSYTw1XqA924fE6C1q3onKe8zfuV4DJMHgOnm+ztGP3/s GyvnSfCMDOzlJLOVQahLUEqT66r+2ipG2OAIis4SHsVYzYrJy+DtoausLY/ackFlXPQk fJczr5OXLmuUsn6eOXJi0YXFZwBb1kwRvGSCxyLp71DpyK6cVUHZxUYD92nXgnYUI91n ZdHMq3gRdxZcHSGNrt8P+YWtliT+3wEeloUz7Hh7LosDaYJ99K2iYtxo4IEm4FklAmxN B5cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aT2+FlGS; 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 gn42si17011366ejc.581.2021.03.30.08.32.45; Tue, 30 Mar 2021 08:33:09 -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=k20201202 header.b=aT2+FlGS; 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 S232403AbhC3PbT (ORCPT + 99 others); Tue, 30 Mar 2021 11:31:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:37796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231782AbhC3Pan (ORCPT ); Tue, 30 Mar 2021 11:30:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D125F619AB; Tue, 30 Mar 2021 15:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617118243; bh=T6HRF4MkN1JTbhxzKjNpUF0eJ6YQtW5OY/mJQ6Hzggk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aT2+FlGS4DuweSJh1LWKX/MUyeNmqYPP2kBRyQLhJhsPW8G9N8oZXqZZQ9XFM7RUN TdyTmMqBmeWebPP8h4rf+DALR21UR/yYWdzGhHTFANOqOSfD5Wx0hZOOEOndMp/HWU JC1PtkEH1xH/RDPALGDmsWib68La5wQY/66BSwJQYeLFfa70+mVetLDl/cI6bLZ6DD 6NP5gjFvRLWaqqf7lGnGKB9MobOzR7Jr08SsNesjZ3C7RzOrynS3yuNMzxF+qZhn1c qh7lxEWiggOMUt5cUtaaJg29q8gAVGcg56foCgO4UIVA7WRgsuzRn2/Nd+XTDJxyVR gkmxmHqnL1f7g== Date: Tue, 30 Mar 2021 16:30:37 +0100 From: Will Deacon To: Rob Herring Cc: Catalin Marinas , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Jiri Olsa , Mark Rutland , Ian Rogers , Alexander Shishkin , honnappa.nagarahalli@arm.com, Zachary.Leaf@arm.com, Raphael Gault , Jonathan Cameron , Namhyung Kim , Itaru Kitayama , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 01/10] arm64: pmu: Add function implementation to update event index in userpage Message-ID: <20210330153036.GA6567@willie-the-truck> References: <20210311000837.3630499-1-robh@kernel.org> <20210311000837.3630499-2-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210311000837.3630499-2-robh@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 05:08:28PM -0700, Rob Herring wrote: > From: Raphael Gault > > In order to be able to access the counter directly for userspace, > we need to provide the index of the counter using the userpage. > We thus need to override the event_idx function to retrieve and > convert the perf_event index to armv8 hardware index. > > Since the arm_pmu driver can be used by any implementation, even > if not armv8, two components play a role into making sure the > behaviour is correct and consistent with the PMU capabilities: > > * the ARMPMU_EL0_RD_CNTR flag which denotes the capability to access > counter from userspace. > * the event_idx call back, which is implemented and initialized by > the PMU implementation: if no callback is provided, the default > behaviour applies, returning 0 as index value. > > Signed-off-by: Raphael Gault > Signed-off-by: Rob Herring > --- > arch/arm64/kernel/perf_event.c | 18 ++++++++++++++++++ > include/linux/perf/arm_pmu.h | 2 ++ > 2 files changed, 20 insertions(+) Acked-by: Will Deacon Will