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=-6.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 D6A36C4338F for ; Thu, 12 Aug 2021 09:51:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 86CB760F21 for ; Thu, 12 Aug 2021 09:51:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86CB760F21 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=rF/N2DljqUApEOtTjmj0SzPegLanagA8NcBOxbT9mGc=; b=QxSC0yO+RcZ1+Q SmNXxVUccdh64Y2gPgN+lH3bYNpZlalrmAWYo9bucLXItoWvsm67IFSwXWFjIIyTths9cB+KhSwZq D0VxJ3nv7l5B57GMK/qIKUSVf5j1sHcz40EFmP+ckfkzYLPzIZVvqgKu48oGwPXXfnWnIO37th874 uMVyRRYqKXExXm4b1+0+x2WNmE1opA7E7bW91U5bVbOWA6lr4H7SV4qU/9WCoGswwF8rZLx+ajGig GKqbXsbOm0zJouRCBHTDJysEPtYLqBxycWOHeA7Ryv9yMkQStQeJNnBGeWf75zRjEPeezLkIHRJr2 7m0CyJU5AEecEIlOZfxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mE7La-009Xe8-27; Thu, 12 Aug 2021 09:49:58 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mE7L0-009XLa-BU for linux-arm-kernel@lists.infradead.org; Thu, 12 Aug 2021 09:49:23 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2219360FBF; Thu, 12 Aug 2021 09:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628761760; bh=Vet1BlDXCatkjIhzZsNSd9OgVltQP2OgvncnfPQIHgk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mgwtokDw57R1/0QIC1V3G8XhgwYX0aj5dOG8HuLi0w3RXIReDiABrTpLAHw1HtIPT Ui1fFOj9TfBHFEG2zN25hDzEfXgoQ9ohQpR+OMVuSfaj4eNtDbO188fx0ukxd6c7+d rIsA8PejX6oQz81l7+b/EMqyFfeqWQPsUiKFuofYOiry9uKdK8F2Um4NPY7QkGyjvb H7g8fP4HP9oEhoEjDMP8IeEoAzoatREKpApte4pKVOE5M388DITB1YU+Wv/pPDNKfv Wr4hLqsNQNkFJxqsQX14xjuCCAfUTmz9R1gQRQ+32v3+94RWVFLs3xh64cmSPgibWc mt8TPoEdJVOpg== Date: Thu, 12 Aug 2021 10:49:14 +0100 From: Will Deacon To: Fuad Tabba Cc: Andrew Jones , kvmarm@lists.cs.columbia.edu, maz@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, pbonzini@redhat.com, qperret@google.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [PATCH v3 06/15] KVM: arm64: Restore mdcr_el2 from vcpu Message-ID: <20210812094914.GJ5912@willie-the-truck> References: <20210719160346.609914-1-tabba@google.com> <20210719160346.609914-7-tabba@google.com> <20210720145258.axhqog3abdvtpqhw@gator> <20210812084600.GA5912@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_024922_455539_9D48557B X-CRM114-Status: GOOD ( 33.86 ) 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 Hey Fuad, On Thu, Aug 12, 2021 at 11:28:50AM +0200, Fuad Tabba wrote: > On Thu, Aug 12, 2021 at 10:46 AM Will Deacon wrote: > > > > On Wed, Jul 21, 2021 at 08:37:21AM +0100, Fuad Tabba wrote: > > > On Tue, Jul 20, 2021 at 3:53 PM Andrew Jones wrote: > > > > > > > > On Mon, Jul 19, 2021 at 05:03:37PM +0100, Fuad Tabba wrote: > > > > > On deactivating traps, restore the value of mdcr_el2 from the > > > > > newly created and preserved host value vcpu context, rather than > > > > > directly reading the hardware register. > > > > > > > > > > Up until and including this patch the two values are the same, > > > > > i.e., the hardware register and the vcpu one. A future patch will > > > > > be changing the value of mdcr_el2 on activating traps, and this > > > > > ensures that its value will be restored. > > > > > > > > > > No functional change intended. > > > > > > > > I'm probably missing something, but I can't convince myself that the host > > > > will end up with the same mdcr_el2 value after deactivating traps after > > > > this patch as before. We clearly now restore whatever we had when > > > > activating traps (presumably whatever we configured at init_el2_state > > > > time), but is that equivalent to what we had before with the masking and > > > > ORing that this patch drops? > > > > > > You're right. I thought that these were actually being initialized to > > > the same values, but having a closer look at the code the mdcr values > > > are not the same as pre-patch. I will fix this. > > > > Can you elaborate on the issue here, please? I was just looking at this > > but aren't you now relying on __init_el2_debug to configure this, which > > should be fine? > > I *think* that it should be fine, but as Drew pointed out, the host > does not end up with the same mdcr_el2 value after the deactivation in > this patch as it did after deactivation before this patch. In my v4 > (not sent out yet), I have fixed it to ensure that the host does end > up with the same value as the one before this patch. That should make > it easier to check that there's no functional change. > > I'll look into it further, and if I can convince myself that there > aren't any issues and that this patch makes the code cleaner, I will > add it as a separate patch instead to make reviewing easier. Cheers. I think the new code might actually be better, as things like MDCR_EL2.E2PB are RES0 if SPE is not implemented. The init code takes care to set those only if if probes SPE first, whereas the code you're removing doesn't seem to check that. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel