From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58E9EC33CA1 for ; Thu, 9 Jan 2020 17:42:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 331682072E for ; Thu, 9 Jan 2020 17:42:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388235AbgAIRmz (ORCPT ); Thu, 9 Jan 2020 12:42:55 -0500 Received: from foss.arm.com ([217.140.110.172]:35130 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728724AbgAIRmz (ORCPT ); Thu, 9 Jan 2020 12:42:55 -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 D8564328; Thu, 9 Jan 2020 09:42:54 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 901EF3F703; Thu, 9 Jan 2020 09:42:53 -0800 (PST) Date: Thu, 9 Jan 2020 17:42:51 +0000 From: Mark Rutland To: Andrew Murray Cc: Marc Zyngier , kvm@vger.kernel.org, Catalin Marinas , linux-kernel@vger.kernel.org, Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 11/18] KVM: arm64: don't trap Statistical Profiling controls to EL2 Message-ID: <20200109174251.GJ3112@lakrids.cambridge.arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-12-andrew.murray@arm.com> <86bls0iqv6.wl-maz@kernel.org> <20191223115651.GA42593@e119886-lin.cambridge.arm.com> <1bb190091362262021dbaf41b5fe601e@www.loen.fr> <20191223121042.GC42593@e119886-lin.cambridge.arm.com> <20200109172511.GA42593@e119886-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200109172511.GA42593@e119886-lin.cambridge.arm.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Andrew, On Thu, Jan 09, 2020 at 05:25:12PM +0000, Andrew Murray wrote: > On Mon, Dec 23, 2019 at 12:10:42PM +0000, Andrew Murray wrote: > > On Mon, Dec 23, 2019 at 12:05:12PM +0000, Marc Zyngier wrote: > > > On 2019-12-23 11:56, Andrew Murray wrote: > > > > My original concern in the cover letter was in how to prevent > > > > the guest from attempting to use these registers in the first > > > > place - I think the solution I was looking for is to > > > > trap-and-emulate ID_AA64DFR0_EL1 such that the PMSVer bits > > > > indicate that SPE is not emulated. > > > > > > That, and active trapping of the SPE system registers resulting in injection > > > of an UNDEF into the offending guest. > > > > Yes that's no problem. > > The spec says that 'direct access to [these registers] are UNDEFINED' - is it > not more correct to handle this with trap_raz_wi than an undefined instruction? The term UNDEFINED specifically means treated as an undefined instruction. The Glossary in ARM DDI 0487E.a says for UNDEFINED: | Indicates cases where an attempt to execute a particular encoding bit | pattern generates an exception, that is taken to the current Exception | level, or to the default Exception level for taking exceptions if the | UNDEFINED encoding was executed at EL0. This applies to: | | * Any encoding that is not allocated to any instruction. | | * Any encoding that is defined as never accessible at the current | Exception level. | | * Some cases where an enable, disable, or trap control means an | encoding is not accessible at the current Exception level. So these should trigger an UNDEFINED exception rather than behaving as RAZ/WI. Thanks, Mark.