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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham 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 34F5AC2D0C0 for ; Sat, 21 Dec 2019 13:12:25 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id BF13E2072B for ; Sat, 21 Dec 2019 13:12:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF13E2072B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 17F744AEBD; Sat, 21 Dec 2019 08:12:24 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id An+PzJhWe7u9; Sat, 21 Dec 2019 08:12:23 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F3FCA4AEAB; Sat, 21 Dec 2019 08:12:22 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 59B164AD09 for ; Sat, 21 Dec 2019 08:12:22 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iqW64c5ajTn2 for ; Sat, 21 Dec 2019 08:12:21 -0500 (EST) Received: from inca-roads.misterjones.org (inca-roads.misterjones.org [213.251.177.50]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id F32604AC7C for ; Sat, 21 Dec 2019 08:12:20 -0500 (EST) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.80) (envelope-from ) id 1iieYK-0002tv-Gk; Sat, 21 Dec 2019 14:12:16 +0100 Date: Sat, 21 Dec 2019 13:12:14 +0000 From: Marc Zyngier To: Andrew Murray Subject: Re: [PATCH v2 02/18] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Message-ID: <20191221131214.769a140e@why> In-Reply-To: <20191220143025.33853-3-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-3-andrew.murray@arm.com> Organization: Approximate X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: andrew.murray@arm.com, will@kernel.org, catalin.marinas@arm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, Catalin Marinas , linux-kernel@vger.kernel.org, Sudeep Holla , will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, 20 Dec 2019 14:30:09 +0000 Andrew Murray wrote: > From: Sudeep Holla > > On VHE systems, the reset value for MDCR_EL2.E2PB=b00 which defaults > to profiling buffer using the EL2 stage 1 translations. Does the reset value actually matter here? I don't see it being specific to VHE systems, and all we're trying to achieve is to restore the SPE configuration to a state where it can be used by the host. > However if the > guest are allowed to use profiling buffers changing E2PB settings, we How can the guest be allowed to change E2PB settings? Or do you mean here that allowing the guest to use SPE will mandate changes of the E2PB settings, and that we'd better restore the hypervisor state once we exit? > need to ensure we resume back MDCR_EL2.E2PB=b00. Currently we just > do bitwise '&' with MDCR_EL2_E2PB_MASK which will retain the value. > > So fix it by clearing all the bits in E2PB. > > Signed-off-by: Sudeep Holla > Signed-off-by: Andrew Murray > --- > arch/arm64/kvm/hyp/switch.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c > index 72fbbd86eb5e..250f13910882 100644 > --- a/arch/arm64/kvm/hyp/switch.c > +++ b/arch/arm64/kvm/hyp/switch.c > @@ -228,9 +228,7 @@ void deactivate_traps_vhe_put(void) > { > u64 mdcr_el2 = read_sysreg(mdcr_el2); > > - mdcr_el2 &= MDCR_EL2_HPMN_MASK | > - MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | > - MDCR_EL2_TPMS; > + mdcr_el2 &= MDCR_EL2_HPMN_MASK | MDCR_EL2_TPMS; > > write_sysreg(mdcr_el2, mdcr_el2); > I'm OK with this change, but I believe the commit message could use some tidying up. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-8.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=ham 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 2FC1BC2D0C0 for ; Sat, 21 Dec 2019 13:12:36 +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 F0EF421927 for ; Sat, 21 Dec 2019 13:12:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="i3grHLzW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0EF421927 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject: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=ObqtRN1no1ETtYafQXRS//ViY1A4JYKxX0UhYG7kX98=; b=i3grHLzWRMYc47 +KXIe2dnOKCxYimEIZ/eeOVV9AR5+6ZD0TWa9KYalvClBC1nZkWZ2oqVhZPOxsyxM0v1JCq5d6iNT EJW0zNqOUEe79zhtWjdK3OfZ1cduw0xYHiYzopcND7BtYFk+myja7v472yCJUVUt4SQLIoJ2q3QJo 6sBwnt5N6OXkWH5RNsD192Z9X4a3eSfOZ00e/IAD+MlvgK9+EtgEFvIllXoduoBTii+3sRWyLjUBy a6Z6ZAsBRz5WjBURDooHbIWpZZvdD2B30fX/a3fL7GJHBuZD9kSFs6Ej+vGmGYzndLVxeom9h6UPF 8TUkYtHkIAOtQZzHwNjQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iieYW-0004tX-9Z; Sat, 21 Dec 2019 13:12:28 +0000 Received: from inca-roads.misterjones.org ([213.251.177.50]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iieYS-0004sn-Td for linux-arm-kernel@lists.infradead.org; Sat, 21 Dec 2019 13:12:26 +0000 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.80) (envelope-from ) id 1iieYK-0002tv-Gk; Sat, 21 Dec 2019 14:12:16 +0100 Date: Sat, 21 Dec 2019 13:12:14 +0000 From: Marc Zyngier To: Andrew Murray Subject: Re: [PATCH v2 02/18] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Message-ID: <20191221131214.769a140e@why> In-Reply-To: <20191220143025.33853-3-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-3-andrew.murray@arm.com> Organization: Approximate X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: andrew.murray@arm.com, will@kernel.org, catalin.marinas@arm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191221_051225_098789_1D9EDBC5 X-CRM114-Status: GOOD ( 16.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Catalin Marinas , linux-kernel@vger.kernel.org, Sudeep Holla , will@kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 20 Dec 2019 14:30:09 +0000 Andrew Murray wrote: > From: Sudeep Holla > > On VHE systems, the reset value for MDCR_EL2.E2PB=b00 which defaults > to profiling buffer using the EL2 stage 1 translations. Does the reset value actually matter here? I don't see it being specific to VHE systems, and all we're trying to achieve is to restore the SPE configuration to a state where it can be used by the host. > However if the > guest are allowed to use profiling buffers changing E2PB settings, we How can the guest be allowed to change E2PB settings? Or do you mean here that allowing the guest to use SPE will mandate changes of the E2PB settings, and that we'd better restore the hypervisor state once we exit? > need to ensure we resume back MDCR_EL2.E2PB=b00. Currently we just > do bitwise '&' with MDCR_EL2_E2PB_MASK which will retain the value. > > So fix it by clearing all the bits in E2PB. > > Signed-off-by: Sudeep Holla > Signed-off-by: Andrew Murray > --- > arch/arm64/kvm/hyp/switch.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c > index 72fbbd86eb5e..250f13910882 100644 > --- a/arch/arm64/kvm/hyp/switch.c > +++ b/arch/arm64/kvm/hyp/switch.c > @@ -228,9 +228,7 @@ void deactivate_traps_vhe_put(void) > { > u64 mdcr_el2 = read_sysreg(mdcr_el2); > > - mdcr_el2 &= MDCR_EL2_HPMN_MASK | > - MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | > - MDCR_EL2_TPMS; > + mdcr_el2 &= MDCR_EL2_HPMN_MASK | MDCR_EL2_TPMS; > > write_sysreg(mdcr_el2, mdcr_el2); > I'm OK with this change, but I believe the commit message could use some tidying up. Thanks, M. -- Jazz is not dead. It just smells funny... _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable 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 1B687C3F68F for ; Sat, 21 Dec 2019 13:12:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC5A921927 for ; Sat, 21 Dec 2019 13:12:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576933943; bh=Uk9W8Ar9Y9vziNp+Sn34RTMLJfeMXEOdRJQBR5/jPpA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=s6/C5SOPrXNEulWZ+YnQmQOzJVPRcUgKhqQnE//V76GBYKB2hQhg5BMNaKi2nyNzj fv+B7+0zPC+wPH3l+IB0NwXHyWeKokaXzKuQe87NpWqofP8oYPXW/+Tbx6BJ2d7GDp oB0/mNe4Q+GMER7K4xOZx0WNOvsT+7Mctaziivmo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726847AbfLUNMU (ORCPT ); Sat, 21 Dec 2019 08:12:20 -0500 Received: from inca-roads.misterjones.org ([213.251.177.50]:43494 "EHLO inca-roads.misterjones.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726583AbfLUNMT (ORCPT ); Sat, 21 Dec 2019 08:12:19 -0500 Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why) by cheepnis.misterjones.org with esmtpsa (TLSv1.2:AES256-GCM-SHA384:256) (Exim 4.80) (envelope-from ) id 1iieYK-0002tv-Gk; Sat, 21 Dec 2019 14:12:16 +0100 Date: Sat, 21 Dec 2019 13:12:14 +0000 From: Marc Zyngier To: Andrew Murray Cc: will@kernel.org, Catalin Marinas , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Sudeep Holla , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 02/18] arm64: KVM: reset E2PB correctly in MDCR_EL2 when exiting the guest(VHE) Message-ID: <20191221131214.769a140e@why> In-Reply-To: <20191220143025.33853-3-andrew.murray@arm.com> References: <20191220143025.33853-1-andrew.murray@arm.com> <20191220143025.33853-3-andrew.murray@arm.com> Organization: Approximate X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: andrew.murray@arm.com, will@kernel.org, catalin.marinas@arm.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, sudeep.holla@arm.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on cheepnis.misterjones.org); SAEximRunCond expanded to false Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, 20 Dec 2019 14:30:09 +0000 Andrew Murray wrote: > From: Sudeep Holla > > On VHE systems, the reset value for MDCR_EL2.E2PB=b00 which defaults > to profiling buffer using the EL2 stage 1 translations. Does the reset value actually matter here? I don't see it being specific to VHE systems, and all we're trying to achieve is to restore the SPE configuration to a state where it can be used by the host. > However if the > guest are allowed to use profiling buffers changing E2PB settings, we How can the guest be allowed to change E2PB settings? Or do you mean here that allowing the guest to use SPE will mandate changes of the E2PB settings, and that we'd better restore the hypervisor state once we exit? > need to ensure we resume back MDCR_EL2.E2PB=b00. Currently we just > do bitwise '&' with MDCR_EL2_E2PB_MASK which will retain the value. > > So fix it by clearing all the bits in E2PB. > > Signed-off-by: Sudeep Holla > Signed-off-by: Andrew Murray > --- > arch/arm64/kvm/hyp/switch.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c > index 72fbbd86eb5e..250f13910882 100644 > --- a/arch/arm64/kvm/hyp/switch.c > +++ b/arch/arm64/kvm/hyp/switch.c > @@ -228,9 +228,7 @@ void deactivate_traps_vhe_put(void) > { > u64 mdcr_el2 = read_sysreg(mdcr_el2); > > - mdcr_el2 &= MDCR_EL2_HPMN_MASK | > - MDCR_EL2_E2PB_MASK << MDCR_EL2_E2PB_SHIFT | > - MDCR_EL2_TPMS; > + mdcr_el2 &= MDCR_EL2_HPMN_MASK | MDCR_EL2_TPMS; > > write_sysreg(mdcr_el2, mdcr_el2); > I'm OK with this change, but I believe the commit message could use some tidying up. Thanks, M. -- Jazz is not dead. It just smells funny...