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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4BF9C433EF for ; Fri, 15 Oct 2021 10:14:30 +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 8CD6D60FDA for ; Fri, 15 Oct 2021 10:14:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8CD6D60FDA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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=x2hfsWAn2SS3LokZGaAogsPVzmUbjggIYv5DwXkpl9k=; b=xVOg9+6vGN/+Nx 7bB5U3S9Gv175AXbrqNbKSWAX2/mbkcDVdwTe25eiYKT9mlEFet7mgyLvyrw/Be1n/awXV2JNNyKQ HLgDMuR8Oxnpe8JH0UiwXKNDo2OOwsQiCz3sNsZVkHkwqtzHGKfIT4WQRUOr8g7B9B3/d/0Cq2dV0 d5ifshBfBZRF+kBoBQViaRIB9onZs5olkCHzbKg0Al/ME0Jkma0HJb5zInLCPYxQsJEuR4Qozmbc1 qUXQr6StXV2OAzfW4R6Uw8e0bgLlWaNNuAAO1CKoQ0uuBr1VZnpA82r7efrpjS4p03rfxElgoc1Ox 13uRgfp6AmNLADSINpTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbKD8-006Rl3-Du; Fri, 15 Oct 2021 10:13:10 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbKD4-006RkJ-NG for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 10:13:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634292784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j2wKSd8eRy2pD7AkaeNeFHMLzezM6aIro+x06mkpfA4=; b=BOESvxw3z4vaxIT8l6YKqg3vHGVbfkcWdl1YwQqE+Efhy1q1AcoiK51CqoV6t8R/ZR4plE P58AiFSDDcepbcKfH0ouAVZwIgyVxxbrPwYCaFglNQ725JHsQ9XbEv4QYkHTolq68PZ3zz q4FfaUkZAvbJCarA++BmKTMbPKAFTw8= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-RUImLZ7gPRKct6x3uA1IwQ-1; Fri, 15 Oct 2021 06:13:03 -0400 X-MC-Unique: RUImLZ7gPRKct6x3uA1IwQ-1 Received: by mail-wr1-f71.google.com with SMTP id h99-20020adf906c000000b001644add8925so2581764wrh.0 for ; Fri, 15 Oct 2021 03:13:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=j2wKSd8eRy2pD7AkaeNeFHMLzezM6aIro+x06mkpfA4=; b=BO6ajokCtAdd5yrP+SBR018TGtLHwxIgk3a0Mrmz9xOxJpUmt3gGn5dtKbmciPWU/k FEwlMGDS+h1djbpcpqNGbBj69OdbWs4ltS7UkoGI365PkH8dit6rmqzcLE6gaglcmsjB 6OcxmeFLlpU4RnNE8CtRWaSPJjibLGa7IHFyUF2RS7MKqaYmptgMK70AC1NjFT4+pj7q U+SZ+QTeGdV2LWwQgSvWRP4EG8Zd9LaHYVmEOZMFJLyZwCN1to4XznyhMgPEnHyowGmd RnaTx/WmUV1aQ5Nm5iBpERPn51DaA5VYAmmOVJ0ivcREp14wOk8PR3YzZlDEBPnVKn+K XjZg== X-Gm-Message-State: AOAM5311JGl1HXPy2+V5J9aPiAu4MQlk6XOPcDWXn6mSAUY0Rs3D6xy/ ZfJ7dMcVtFvntGwBEXUuQli2apk6r1ptuvw0ZqbQzms+GlQ1aunp4GE3d6TxBK75DAek/LGOisI AIWAxVC3cG5QQK1zrX1Aw3W1XvmGHZOr4LP0= X-Received: by 2002:a1c:208:: with SMTP id 8mr25341129wmc.114.1634292781986; Fri, 15 Oct 2021 03:13:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySQyml7m4lUYWHcFoNKT7dSS0DKGc0cSC3P/sTwgEM1cRhAW6jGm/Uuh+3uSwKU+ZfUSK9FQ== X-Received: by 2002:a1c:208:: with SMTP id 8mr25341109wmc.114.1634292781779; Fri, 15 Oct 2021 03:13:01 -0700 (PDT) Received: from gator (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id g1sm11222799wmk.2.2021.10.15.03.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 03:13:01 -0700 (PDT) Date: Fri, 15 Oct 2021 12:12:59 +0200 From: Andrew Jones To: Reiji Watanabe Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, James Morse , Alexandru Elisei , Suzuki K Poulose , Paolo Bonzini , Will Deacon , Peng Liang , Peter Shier , Ricardo Koller , Oliver Upton , Jing Zhang , Raghavendra Rao Anata Subject: Re: [RFC PATCH 01/25] KVM: arm64: Add has_reset_once flag for vcpu Message-ID: <20211015101259.4lmlgk5ll2mrnohd@gator> References: <20211012043535.500493-1-reijiw@google.com> <20211012043535.500493-2-reijiw@google.com> MIME-Version: 1.0 In-Reply-To: <20211012043535.500493-2-reijiw@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=drjones@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_031307_035925_4534F284 X-CRM114-Status: GOOD ( 18.13 ) 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 Mon, Oct 11, 2021 at 09:35:11PM -0700, Reiji Watanabe wrote: > Introduce 'has_reset_once' flag in kvm_vcpu_arch, which indicates > if the vCPU reset has been done once, for later use. > > Signed-off-by: Reiji Watanabe > --- > arch/arm64/include/asm/kvm_host.h | 2 ++ > arch/arm64/kvm/reset.c | 4 ++++ > 2 files changed, 6 insertions(+) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index f8be56d5342b..9b5e7a3b6011 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -384,6 +384,7 @@ struct kvm_vcpu_arch { > u64 last_steal; > gpa_t base; > } steal; > + bool has_reset_once; > }; > > /* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ > @@ -449,6 +450,7 @@ struct kvm_vcpu_arch { > > #define vcpu_has_sve(vcpu) (system_supports_sve() && \ > ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) > +#define vcpu_has_reset_once(vcpu) ((vcpu)->arch.has_reset_once) > > #ifdef CONFIG_ARM64_PTR_AUTH > #define vcpu_has_ptrauth(vcpu) \ > diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c > index 5ce36b0a3343..4d34e5c1586c 100644 > --- a/arch/arm64/kvm/reset.c > +++ b/arch/arm64/kvm/reset.c > @@ -305,6 +305,10 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) > if (loaded) > kvm_arch_vcpu_load(vcpu, smp_processor_id()); > preempt_enable(); > + > + if (!ret && !vcpu->arch.has_reset_once) > + vcpu->arch.has_reset_once = true; > + > return ret; > } > > -- > 2.33.0.882.g93a45727a2-goog > Hi Reiji, Can't we use kvm_vcpu_initialized(vcpu)? vcpu->arch.target should only be >= when we've successfully reset the vcpu at least once. Thanks, drew _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel