Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1146234pxb; Fri, 20 Nov 2020 02:16:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVMZUlNWkbkGO287xlcCY4kQ0pyisdOG82ejzOYyBe+HXWocNKwaBbUyqfbW3VjT3ve5HV X-Received: by 2002:a17:906:5955:: with SMTP id g21mr6052730ejr.271.1605867362516; Fri, 20 Nov 2020 02:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605867362; cv=none; d=google.com; s=arc-20160816; b=i0FoJDjIsS6Z37q25vc9afM0b20DKgK0GfL/ndbP9nw30Rw2XWx50wVEOY9qUBa/lj srn2WmEWr6XSDRhAFtllMd3xKqa958MJGDrlRleXuVd12G2++O1PQrkjeAVhBgfTQhK8 LZbxcjcyxdCrS+kYSJTQjVs7FvW2K46DoIv93vEyKGqeVxkZCnuuGHiu7XU61voYHfCC GaNRxafv6UTKOFb/MvuVr7HFs1te+LPvQoa+vGaVbT5kEUOHpeRYIHegVH+bQU3Ckv3C 5c74FQkaROzsqWEmCxTA6EJ4ctIBKZEpJTZ/NdtPosduEOURT2fMKI7AEcIzemQTx+n5 qJaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=X1d9be30UftkCsE8TnFWEn+Q61jsoSlPpCY8uNb4cq4=; b=k77eG4YtL+dlqNke50K4Ill1SZSEdm493J2GF91u74gD/xjsEoVWrr2MuSM5YMobQL Dcqj3FCxKpMvSEpYUR0wmkb47zXemal1ElBbwuHAgTP/FRdc3gC8Vi9c5LZm+f/LiqJ1 0evjfUE5lE/84WWsn3rrIW+xPqDxDT81Q0lqY4BR6O7jd1meO916l2DzVwGwK3thElpA 5ZhMhITTB7knLwUSQ+OnjczUCqD5jrxCHXjYiFh1MtcLdRs4LgPLJwUJFb4LTgmI1uye dK2TmIy+gLmeSsVIVp2pYY4ZyIYsAJNwzLUTKvXSuKxJ5kuvg+hne5FLBu2IafKtbSwQ eYAg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q4si1672259eji.62.2020.11.20.02.15.39; Fri, 20 Nov 2020 02:16:02 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727160AbgKTKNf (ORCPT + 99 others); Fri, 20 Nov 2020 05:13:35 -0500 Received: from foss.arm.com ([217.140.110.172]:46578 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgKTKNe (ORCPT ); Fri, 20 Nov 2020 05:13:34 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3975B1042; Fri, 20 Nov 2020 02:13:34 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.27.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 93C723F70D; Fri, 20 Nov 2020 02:13:31 -0800 (PST) Date: Fri, 20 Nov 2020 10:13:24 +0000 From: Mark Rutland To: Vladimir Murzin Cc: Marc Zyngier , Neeraj Upadhyay , suzuki.poulose@arm.com, ionela.voinescu@arm.com, MSM , lkml , catalin.marinas@arm.com, Will Deacon , valentin.schneider@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: AMU extension v1 support for cortex A76, A77, A78 CPUs Message-ID: <20201120101249.GA2328@C02TD0UTHF1T.local> References: <2cc9dd44-0b4b-94a8-155a-7a2446a1b892@codeaurora.org> <1712842eb0767e51155a5396d282102c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 20, 2020 at 09:09:00AM +0000, Vladimir Murzin wrote: > On 11/20/20 8:56 AM, Marc Zyngier wrote: > > On 2020-11-20 04:30, Neeraj Upadhyay wrote: > >> Hi, > >> > >> For ARM cortex A76, A77, A78 cores (which as per TRM, support AMU) > >> AA64PFR0[47:44] field is not set, and AMU does not get enabled for > >> them. > >> Can you please provide support for these CPUs in cpufeature.c? > > > > If that was the case, that'd be an erratum, and it would need to be > > documented as such. It could also be that this is an optional feature > > for these cores (though the TRM doesn't suggest that). > > > > Can someone at ARM confirm what is the expected behaviour of these CPUs? > > Not a confirmation, but IIRC, these are imp def features, while our cpufeatures > catches architected one. We generally don't make use of IMP-DEF featurees because of all the pain it brings. Looking at the Cortex-A76 TRM, the encoding for AMCNTENCLR is: Op0: 3 (0b11) Op1: 3 (0b011) CRn: 15 (0b1111) CRm: 9 (0b1001) Op2: 7 (0b111) ... whereas the architected encoding (from our sysreg.h) is: Op0: 3 Op1: 3 CRn: 13 CRm: 2 Op2: 4 ... so that's a different register with the same name, which is confusing and unfortunate. The encodings are different (and I haven't checked whether the fields / semantics are the same), so it's not just a matter of wiring up new detection code. There are also IMP-DEF traps in ACTLR_EL3 and ACTLR_EL2 which we can't be certain of the configuration of, and as the registers are in the IMP-DEF encoding space they'll be trapped by HCR_EL2.TIDCP and emulated as UNDEFINED by a hypervisor. All of that means that going by the MIDR alone is not sufficient to know we can safely access the registers. So as usual for IMP-DEF stuff I don't think we can or should make use of this. Thanks, Mark.