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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 90CF4C4741F for ; Tue, 10 Nov 2020 10:01:33 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id A6D50205CA for ; Tue, 10 Nov 2020 10:01:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="U/y1gcA/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6D50205CA 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 DC84F4B368; Tue, 10 Nov 2020 05:01:31 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org 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 JySdBCPZqpUI; Tue, 10 Nov 2020 05:01:22 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2D55B4B7B5; Tue, 10 Nov 2020 05:01:22 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0F0C94B741 for ; Tue, 10 Nov 2020 05:01:21 -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 u+FckugWBVzj for ; Tue, 10 Nov 2020 05:01:20 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id F2A044B73F for ; Tue, 10 Nov 2020 05:01:19 -0500 (EST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6BA9205CA; Tue, 10 Nov 2020 10:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605002478; bh=MpYOqpfrkwMeRZHEzlIP04lGoaO0Nbgm2RSKublJQ1I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U/y1gcA/cMKkNo7E7KkcZpSJMwUYIzi72RorNUsPfOlEtHUk71qt+xVWr0H9C7Zcg 2bpClkgIUABwQH2O8KyHqgjv+mbxUOXpheziOOtyJWE1AO9AdMv26yLNzHyizQGdpL Og/S97nF8WVcHsPZhOvGZhCaxE7o4YLGp0iNmFPk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcQSi-009PMa-8c; Tue, 10 Nov 2020 10:01:16 +0000 MIME-Version: 1.0 Date: Tue, 10 Nov 2020 10:01:16 +0000 From: Marc Zyngier To: James Morse Subject: Re: [PATCH 1/8] KVM: arm64: Move AArch32 exceptions over to AArch64 sysregs In-Reply-To: <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> References: <20201102191609.265711-1-maz@kernel.org> <20201102191609.265711-2-maz@kernel.org> <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <99e4733efb9ec810b52662597e61b92b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: james.morse@arm.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kvm@vger.kernel.org, kernel-team@android.com, 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 2020-11-03 18:29, James Morse wrote: > Hi Marc, > > On 02/11/2020 19:16, Marc Zyngier wrote: >> The use of the AArch32-specific accessors have always been a bit >> annoying on 64bit, and it is time for a change. >> >> Let's move the AArch32 exception injection over to the AArch64 >> encoding, >> which requires us to split the two halves of FAR_EL1 into DFAR and >> IFAR. >> This enables us to drop the preempt_disable() games on VHE, and to >> kill >> the last user of the vcpu_cp15() macro. > > Hurrah! > > >> diff --git a/arch/arm64/kvm/inject_fault.c >> b/arch/arm64/kvm/inject_fault.c >> index e2a2e48ca371..975f65ba6a8b 100644 >> --- a/arch/arm64/kvm/inject_fault.c >> +++ b/arch/arm64/kvm/inject_fault.c >> @@ -100,39 +81,36 @@ static void inject_undef32(struct kvm_vcpu *vcpu) >> * Modelled after TakeDataAbortException() and >> TakePrefetchAbortException >> * pseudocode. >> */ >> -static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, >> - unsigned long addr) >> +static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, u32 >> addr) >> { >> - u32 *far, *fsr; >> - bool is_lpae; >> - bool loaded; >> + u64 far; >> + u32 fsr; > > >> + /* Give the guest an IMPLEMENTATION DEFINED exception */ >> + if (__vcpu_sys_reg(vcpu, TCR_EL1) & TTBCR_EAE) { > > With VHE, won't __vcpu_sys_reg() read the potentially stale copy in > the sys_reg array? > > vcpu_read_sys_reg()? Of course you are right. Now fixed. 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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 7B9DEC4741F for ; Tue, 10 Nov 2020 10:02:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 072A420731 for ; Tue, 10 Nov 2020 10:02:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pEY97j7w"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="U/y1gcA/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 072A420731 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+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=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HPcWD6jNwya3e7+x6VHbdkfNwiDRm698va4w8LICuII=; b=pEY97j7wwuoJTnk8ZAEMfW5b/ Rge1NvffS2q2rz/3RLN2lyBeEoFh2O8ETPi809GdoM+rPojlGRz7acTXbsBRqaq92AXLFwdgNtsVh IgJN5yjwvlV8ZAHPhY0RHTkzjI6k4pS5DblFmbzppaV9Hl44n2/+vYnBv8fU6hQMbtJYVbtOav0tW +vKCRukbZnRf7UC6vlrs6/cOy1uAeO4S8R8pRu2A9e8kqJX8b2H3UKYHP1ctwe4zfiQNjH5d90SV+ c9c/VIV2m6gzFtwju1+6TVn7UGCuchSm9ZxYRSndXE3NFHXxkX7uxIDUvdKhfcNhIa4MR5Oy+AQZF BC8CK0nJQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcQSp-0007no-VV; Tue, 10 Nov 2020 10:01:24 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcQSm-0007nL-9P for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 10:01:21 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6BA9205CA; Tue, 10 Nov 2020 10:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605002478; bh=MpYOqpfrkwMeRZHEzlIP04lGoaO0Nbgm2RSKublJQ1I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U/y1gcA/cMKkNo7E7KkcZpSJMwUYIzi72RorNUsPfOlEtHUk71qt+xVWr0H9C7Zcg 2bpClkgIUABwQH2O8KyHqgjv+mbxUOXpheziOOtyJWE1AO9AdMv26yLNzHyizQGdpL Og/S97nF8WVcHsPZhOvGZhCaxE7o4YLGp0iNmFPk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcQSi-009PMa-8c; Tue, 10 Nov 2020 10:01:16 +0000 MIME-Version: 1.0 Date: Tue, 10 Nov 2020 10:01:16 +0000 From: Marc Zyngier To: James Morse Subject: Re: [PATCH 1/8] KVM: arm64: Move AArch32 exceptions over to AArch64 sysregs In-Reply-To: <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> References: <20201102191609.265711-1-maz@kernel.org> <20201102191609.265711-2-maz@kernel.org> <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <99e4733efb9ec810b52662597e61b92b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: james.morse@arm.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_050120_529298_B8190DAD X-CRM114-Status: GOOD ( 15.74 ) 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, Suzuki K Poulose , Julien Thierry , kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-11-03 18:29, James Morse wrote: > Hi Marc, > > On 02/11/2020 19:16, Marc Zyngier wrote: >> The use of the AArch32-specific accessors have always been a bit >> annoying on 64bit, and it is time for a change. >> >> Let's move the AArch32 exception injection over to the AArch64 >> encoding, >> which requires us to split the two halves of FAR_EL1 into DFAR and >> IFAR. >> This enables us to drop the preempt_disable() games on VHE, and to >> kill >> the last user of the vcpu_cp15() macro. > > Hurrah! > > >> diff --git a/arch/arm64/kvm/inject_fault.c >> b/arch/arm64/kvm/inject_fault.c >> index e2a2e48ca371..975f65ba6a8b 100644 >> --- a/arch/arm64/kvm/inject_fault.c >> +++ b/arch/arm64/kvm/inject_fault.c >> @@ -100,39 +81,36 @@ static void inject_undef32(struct kvm_vcpu *vcpu) >> * Modelled after TakeDataAbortException() and >> TakePrefetchAbortException >> * pseudocode. >> */ >> -static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, >> - unsigned long addr) >> +static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, u32 >> addr) >> { >> - u32 *far, *fsr; >> - bool is_lpae; >> - bool loaded; >> + u64 far; >> + u32 fsr; > > >> + /* Give the guest an IMPLEMENTATION DEFINED exception */ >> + if (__vcpu_sys_reg(vcpu, TCR_EL1) & TTBCR_EAE) { > > With VHE, won't __vcpu_sys_reg() read the potentially stale copy in > the sys_reg array? > > vcpu_read_sys_reg()? Of course you are right. Now fixed. 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=-7.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 4338BC388F7 for ; Tue, 10 Nov 2020 10:01:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C51B8206E3 for ; Tue, 10 Nov 2020 10:01:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="U/y1gcA/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbgKJKBT (ORCPT ); Tue, 10 Nov 2020 05:01:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:59938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726428AbgKJKBT (ORCPT ); Tue, 10 Nov 2020 05:01:19 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A6BA9205CA; Tue, 10 Nov 2020 10:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605002478; bh=MpYOqpfrkwMeRZHEzlIP04lGoaO0Nbgm2RSKublJQ1I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U/y1gcA/cMKkNo7E7KkcZpSJMwUYIzi72RorNUsPfOlEtHUk71qt+xVWr0H9C7Zcg 2bpClkgIUABwQH2O8KyHqgjv+mbxUOXpheziOOtyJWE1AO9AdMv26yLNzHyizQGdpL Og/S97nF8WVcHsPZhOvGZhCaxE7o4YLGp0iNmFPk= Received: from disco-boy.misterjones.org ([51.254.78.96] helo=www.loen.fr) by disco-boy.misterjones.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94) (envelope-from ) id 1kcQSi-009PMa-8c; Tue, 10 Nov 2020 10:01:16 +0000 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 10 Nov 2020 10:01:16 +0000 From: Marc Zyngier To: James Morse Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Julien Thierry , Suzuki K Poulose , kernel-team@android.com Subject: Re: [PATCH 1/8] KVM: arm64: Move AArch32 exceptions over to AArch64 sysregs In-Reply-To: <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> References: <20201102191609.265711-1-maz@kernel.org> <20201102191609.265711-2-maz@kernel.org> <58942c6b-9cf2-a0d7-3ba5-2fc42aeef779@arm.com> User-Agent: Roundcube Webmail/1.4.9 Message-ID: <99e4733efb9ec810b52662597e61b92b@kernel.org> X-Sender: maz@kernel.org X-SA-Exim-Connect-IP: 51.254.78.96 X-SA-Exim-Rcpt-To: james.morse@arm.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 2020-11-03 18:29, James Morse wrote: > Hi Marc, > > On 02/11/2020 19:16, Marc Zyngier wrote: >> The use of the AArch32-specific accessors have always been a bit >> annoying on 64bit, and it is time for a change. >> >> Let's move the AArch32 exception injection over to the AArch64 >> encoding, >> which requires us to split the two halves of FAR_EL1 into DFAR and >> IFAR. >> This enables us to drop the preempt_disable() games on VHE, and to >> kill >> the last user of the vcpu_cp15() macro. > > Hurrah! > > >> diff --git a/arch/arm64/kvm/inject_fault.c >> b/arch/arm64/kvm/inject_fault.c >> index e2a2e48ca371..975f65ba6a8b 100644 >> --- a/arch/arm64/kvm/inject_fault.c >> +++ b/arch/arm64/kvm/inject_fault.c >> @@ -100,39 +81,36 @@ static void inject_undef32(struct kvm_vcpu *vcpu) >> * Modelled after TakeDataAbortException() and >> TakePrefetchAbortException >> * pseudocode. >> */ >> -static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, >> - unsigned long addr) >> +static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, u32 >> addr) >> { >> - u32 *far, *fsr; >> - bool is_lpae; >> - bool loaded; >> + u64 far; >> + u32 fsr; > > >> + /* Give the guest an IMPLEMENTATION DEFINED exception */ >> + if (__vcpu_sys_reg(vcpu, TCR_EL1) & TTBCR_EAE) { > > With VHE, won't __vcpu_sys_reg() read the potentially stale copy in > the sys_reg array? > > vcpu_read_sys_reg()? Of course you are right. Now fixed. Thanks, M. -- Jazz is not dead. It just smells funny...