Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp622918imm; Wed, 13 Jun 2018 06:00:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJJybT9q7BDX/wOwn8l7OAK4jhFocBrgHOPiVn0ooDOF7ZpaV344tTbo7Njqt1ZdyvHexeH X-Received: by 2002:a63:3c4b:: with SMTP id i11-v6mr4008379pgn.414.1528894851326; Wed, 13 Jun 2018 06:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528894851; cv=none; d=google.com; s=arc-20160816; b=UggPF1fMMNWE1bUSKsimGPsrPXqaLFE9UWtaxVIGHU5wnnSw9ZZWpbN+AWY0ZxJcJZ 4hP3tQpsdsNuxyz226TDC4hiDXFElgG43BkdD6lLLxhBDhGuKzxxE9hvCsDl1seLdkxz gA3muYaAWCPOAxOu/XrED9sqOz3eQGLJzQTzDPDsfUduSaDJkBtBcAI3LkzuvKw0hDgv 3vmGR3G12CeSO0qkpwYdb4oGmtdTqjye/PnZjlG5RZubONEEME9BZbS2+g/zN5XTA3hy fMDfKwVco3NJF/Adk+46OAw3+qUnFkrbc7nSOlS4xJ34lr0+yW6gpPmQff/ekRQqlkOJ xyDA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=lo3vSvkbdIxVZwNXNZjX1BmtyWxMsglX4Bkdb/Otqgw=; b=Jhtv1TqrPbJ8Xyz8fOX49qVDhoewgy4N0bDhz7wZmU2Bx30IEyYYY6pHWn/Far83g/ vc48K3kzev1jrQQyipvwwT8sWNO2Re4VaBphJu3q/TXMeN/l7sJW+571leHkHBcXyLGr IcdKGrFS7KAaAB1pefNPpAgIEJuzIFLVW80HaI1d38e5FISQuzeaN3IGqG4MMhWanJjf ehCM/i+yVUKZOV1HRJp4x6JBwGTEgI3HI1oPx+OtlxqSO1T0xoLF2rRRoAEAFTcOJOk+ jZV0GvSf/5rIyNREvzu1A2iF9GLYc8jXIu3koyq5bldCT4kOwFWS+moD8gGDlrE3ibA5 dKkA== 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 m3-v6si2823974pfc.312.2018.06.13.06.00.36; Wed, 13 Jun 2018 06:00:51 -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 S935609AbeFMNAD (ORCPT + 99 others); Wed, 13 Jun 2018 09:00:03 -0400 Received: from foss.arm.com ([217.140.101.70]:47246 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935346AbeFMNAB (ORCPT ); Wed, 13 Jun 2018 09:00:01 -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 7CAF41529; Wed, 13 Jun 2018 06:00:01 -0700 (PDT) Received: from [10.1.206.75] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EDD5B3F25D; Wed, 13 Jun 2018 05:59:59 -0700 (PDT) Subject: Re: [RFC V2 3/3] perf: qcom: Add Falkor CPU PMU IMPLEMENTATION DEFINED event support To: Will Deacon , Agustin Vega-Frias Cc: Mark Rutland , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jeremy Linton , Catalin Marinas , Lorenzo Pieralisi , timur@codeaurora.org References: <1528379808-27970-1-git-send-email-agustinv@codeaurora.org> <1528379808-27970-4-git-send-email-agustinv@codeaurora.org> <20180612144055.m2h26n64spfm6k6o@lakrids.cambridge.arm.com> <9957219b64252d3b2e19724db04a1179@codeaurora.org> <20180613103555.GC26280@arm.com> From: Marc Zyngier Organization: ARM Ltd Message-ID: <06c81a64-904f-59fa-5751-62818d6d2107@arm.com> Date: Wed, 13 Jun 2018 13:59:58 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180613103555.GC26280@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/06/18 11:35, Will Deacon wrote: > On Tue, Jun 12, 2018 at 04:41:32PM -0400, Agustin Vega-Frias wrote: >> Hi Mark, >> >> On 2018-06-12 10:40, Mark Rutland wrote: >>> Hi, >>> >>> On Thu, Jun 07, 2018 at 09:56:48AM -0400, Agustin Vega-Frias wrote: >>>> Selection of these events can be envisioned as indexing them from >>>> a 3D matrix: >>>> - the first index selects a Region Event Selection Register >>>> (PMRESRx_EL0) >>>> - the second index selects a group from which only one event at a time >>>> can be selected >>>> - the third index selects the event >>>> >>>> The event is encoded into perf_event_attr.config as 0xPRCCG, where: >>>> P [config:16 ] = prefix (flag that indicates a matrix-based >>>> event) >>>> R [config:12-15] = register (specifies the PMRESRx_EL0 instance) >>>> G [config:0-3 ] = group (specifies the event group) >>>> CC [config:4-11 ] = code (specifies the event) >>>> >>>> Events with the P flag set to zero are treated as common PMUv3 events >>>> and are directly programmed into PMXEVTYPERx_EL0. >>>> >>>> The first two indexes are set combining the RESR and group number with >>>> a base number and writing it into the architected PMXEVTYPER_EL0 >>>> register. >>>> The third index is set by writing the code into the bits corresponding >>>> with the group into the appropriate IMPLEMENTATION DEFINED PMRESRx_EL0 >>>> register. >>> >>> When are the IMP DEF registers accessible at EL0? Are those goverend by >>> the same controls as the architected registers? >> >> No, there is a separate IMP DEF register to control access. > > Great :( We need to make sure we disable EL0 access during boot then, but > that means we need to prove for the existence of this thing in head.S > (since the PMU driver might not get loaded). > > Also, what's the kvm story here so that we don't accidentally open up a > VM-VM side-channel via these registers? How do the EL1 trapping controls > work? We'd trap the IMPDEF register access and inject an UNDEF (assuming that the IMPDEF trapping works correctly). I have strictly no plan to support this in a guest. Thanks, M. -- Jazz is not dead. It just smells funny...