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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AEF09C433EF for ; Wed, 15 Dec 2021 14:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2edl74gz8ym78ji+riXeLsxUGquv6Ga54KR8iWhjIAQ=; b=nC/11tBespXhKp 8sQC00hB015EbgWLefpGonkM8ka1l1mA0qb1CCacjmM05IVm7ybGnkvi1g1I2zqnkoeJVV8ZJ8Hyo rbvYPmCDv8RAMmpVsWbR78v9pg4Uf9Gmjkg3ARU8vsoQ5HEc5NRsIKiS/T1LuYqFWBkImQ9ZMfWiz iJIFhvExFWjFAp/+40d+PWSkf92UZ7UotKDf+HgVCyflSllOGgoFpLEPBjpKixZ5eow46ZpEHT0V5 c89btK71u/QPM9YpPO/U1HLV/O2i4t2wxrqjyKte6ImewvZYiiVFVMQtyTmKiBeRLy9TP6scNVwND 0iggQLjtsUZvaxLx+kRw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxVKI-001AFT-TT; Wed, 15 Dec 2021 14:32:15 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxVKG-001AEO-0J for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 14:32:13 +0000 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 842511FB; Wed, 15 Dec 2021 06:32:09 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.67.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 21DA23F774; Wed, 15 Dec 2021 06:32:07 -0800 (PST) Date: Wed, 15 Dec 2021 14:32:04 +0000 From: Mark Rutland To: Oliver Upton Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, Marc Zyngier , Peter Shier , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 1/6] KVM: arm64: Correctly treat writes to OSLSR_EL1 as undefined Message-ID: References: <20211214172812.2894560-1-oupton@google.com> <20211214172812.2894560-2-oupton@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_063212_114084_6975713A X-CRM114-Status: GOOD ( 19.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 15, 2021 at 01:09:28PM +0000, Oliver Upton wrote: > Hi Mark, > > On Wed, Dec 15, 2021 at 11:39:58AM +0000, Mark Rutland wrote: > > Hi Oliver, > > > > On Tue, Dec 14, 2021 at 05:28:07PM +0000, Oliver Upton wrote: > > > Any valid implementation of the architecture should generate an > > > undefined exception for writes to a read-only register, such as > > > OSLSR_EL1. Nonetheless, the KVM handler actually implements write-ignore > > > behavior. > > > > > > Align the trap handler for OSLSR_EL1 with hardware behavior. If such a > > > write ever traps to EL2, inject an undef into the guest and print a > > > warning. > > > > I think this can still be read amibguously, since we don't explicitly state > > that writes to OSLSR_EL1 should never trap (and the implications of being > > UNDEFINED are subtle). How about: > > > > | Writes to OSLSR_EL1 are UNDEFINED and should never trap from EL1 to EL2, but > > | the KVM trap handler for OSLSR_EL1 handlees writes via ignore_write(). This Whoops, with s/handlees/handles/ > > | is confusing to readers of the code, but shouldn't have any functional impact. > > | > > | For clarity, use write_to_read_only() rather than ignore_write(). If a trap > > | is unexpectedly taken to EL2 in violation of the architecture, this will > > | WARN_ONCE() and inject an undef into the guest. > > Agreed, I like your suggested changelog better :-) Cool! Mark. > > > With that: > > > > Reviewed-by: Mark Rutland > > Thanks! > > -- > Best, > Oliver _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel