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 80116C4332F for ; Mon, 27 Sep 2021 16:34:12 +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 4FF6F60EE2 for ; Mon, 27 Sep 2021 16:34:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4FF6F60EE2 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.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=922wLaACk7v+b0Tl7u+LhYlake/mb/K66+j2pQB88Uk=; b=RgfVT2opGH2EC3 esqI+vWTXal/fGz+iz5yOwzA4N4AsyOZnNPoJolP34ZtBEDtELE76clA3NQaF0KmHPo0D57rmu4+I pvVB0LTl/mUig7TMN65BFYy5rxTkxLTMqEmRSfMCXNq+/2Fid0S2AoM7ZFRsg+lxJT1JfdvakSeGn TlNWcw246lBBKYq1H+9rwztKG1qhg1kkmgX9TmvW8CytbGFHnNRqF9om/kC0zkKLXjDZTvSX96jsw 3EdOyg+3u8kcplYA5dTnacg5FLfWUYf1OMs4KZOUhGiOh0Ofrwc9wJZ+uOZqK9MLbpYKXMu5XLDkR 42Z9s44YigN3yJKJVBtQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUtY9-003NCD-QM; Mon, 27 Sep 2021 16:32:18 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUtY6-003NBV-BR for linux-arm-kernel@lists.infradead.org; Mon, 27 Sep 2021 16:32:15 +0000 Received: by mail-wr1-x42c.google.com with SMTP id v17so9583710wrv.9 for ; Mon, 27 Sep 2021 09:32:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sDm0X5qQPferwq6fv+ku/0Jsg062MnSmwsDAd1S9+ac=; b=gGwDEcPz9HLzaQCAI7q3j4o5mViGJZZaCFUHWm+LGKKIWsJnbNfUOuirDv9dCdi6DC q+EzRoJzs8owpT/noKmfYmdMYftJd+hO9RgGv4Ti5mip4+SPxvq85IWvAPZkrzgv85Qu HQPKsfQ71rr7WuEzqtGV4az3nA6/UUhEACkdoVHLXF46X2A5J9SaU62v0MtY988HfyRm v0RnGY1SaQMamGv0t41roAMyiOso7/1NX3selVMrSbvvL2NLJc9rxYSfzx2QUGthc6L+ GsRdVMkJ4wrO53K4bTiFMki4C9BQxEPKGSOowkMQCiYCGJu4y2wEyUdsPoql1FTdwg4u +o8g== 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=sDm0X5qQPferwq6fv+ku/0Jsg062MnSmwsDAd1S9+ac=; b=TcixeurhVkqjstkwqwqEnmoQR16v9ETMh9B7vhq7vM/Pn5pBdNAOTTN0ZqTYbMHhkp l/Sv0ZkR0SRaM0Q+8a9tf5pawWFmekzxmCznein/a5vICKxOOGKjq5ROjp5rJYX1ijhp nIOGYP1u6+KoecCZbThigPDv1w3kQ0T7+7kQN0jlvhHp6Ov09g2guLql7/dCkCL/kI7d ICl266bWi5//HafyA4X6aZFO1Ca2+Map3jrJWiZyZb3n7cXtYHZAfcxOEVw6h01yiSUv czm1RIvKGMY8aUuoj5U4sjr7HoecOImEmeNC6Ir6tngqJhfF12Nqew1g+foUc3TInQaX wb1Q== X-Gm-Message-State: AOAM530EAQqr5k4GoQvQ6ya4f9pMt7HGhgKx+ox6Bk0DEUZ5G7Lpotid Qf29XZmqhajQynFvfKHadKAfrQ== X-Google-Smtp-Source: ABdhPJz+nq3KlBHGIoypjiRXZpcfjyQ1XRIJV9AK88Ba7/gCIYfpf+eVqswPyUj0b+aAtePsXm96tg== X-Received: by 2002:adf:8b52:: with SMTP id v18mr875658wra.1.1632760332278; Mon, 27 Sep 2021 09:32:12 -0700 (PDT) Received: from google.com ([2a00:79e0:d:210:fa68:b369:184:c5a]) by smtp.gmail.com with ESMTPSA id j21sm18107813wmj.40.2021.09.27.09.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Sep 2021 09:32:12 -0700 (PDT) Date: Mon, 27 Sep 2021 17:32:09 +0100 From: Quentin Perret To: Fuad Tabba Cc: kvmarm@lists.cs.columbia.edu, maz@kernel.org, will@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, mark.rutland@arm.com, christoffer.dall@arm.com, drjones@redhat.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com Subject: Re: [RFC PATCH v1 11/30] KVM: arm64: create and use a new vcpu_hyp_state struct Message-ID: References: <20210924125359.2587041-1-tabba@google.com> <20210924125359.2587041-12-tabba@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210924125359.2587041-12-tabba@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210927_093214_429956_03396A00 X-CRM114-Status: GOOD ( 28.78 ) 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 Friday 24 Sep 2021 at 13:53:40 (+0100), Fuad Tabba wrote: > Create a struct for the hypervisor state from the related fields > in vcpu_arch. This is needed in future patches to reduce the > scope of functions from the vcpu as a whole to only the relevant > state, via this newly created struct. > > Create a new instance of this struct in vcpu_arch and fix the > accessors to use the new fields. Remove the existing fields from > vcpu_arch. > > Signed-off-by: Fuad Tabba > --- > arch/arm64/include/asm/kvm_host.h | 35 ++++++++++++++++++------------- > arch/arm64/kernel/asm-offsets.c | 2 +- > 2 files changed, 21 insertions(+), 16 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 3e5c173d2360..dc4b5e133d86 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -269,27 +269,35 @@ struct vcpu_reset_state { > bool reset; > }; > > +/* Holds the hyp-relevant data of a vcpu.*/ > +struct vcpu_hyp_state { > + /* HYP configuration */ > + u64 hcr_el2; > + u32 mdcr_el2; > + > + /* Virtual SError ESR to restore when HCR_EL2.VSE is set */ > + u64 vsesr_el2; > + > + /* Exception Information */ > + struct kvm_vcpu_fault_info fault; > + > + /* Miscellaneous vcpu state flags */ > + u64 flags; > +}; > + > struct kvm_vcpu_arch { > struct kvm_cpu_context ctxt; > void *sve_state; > unsigned int sve_max_vl; > > + struct vcpu_hyp_state hyp_state; > + > /* Stage 2 paging state used by the hardware on next switch */ > struct kvm_s2_mmu *hw_mmu; > > - /* HYP configuration */ > - u64 hcr_el2; > - u32 mdcr_el2; > - > - /* Exception Information */ > - struct kvm_vcpu_fault_info fault; > - > /* State of various workarounds, see kvm_asm.h for bit assignment */ > u64 workaround_flags; > > - /* Miscellaneous vcpu state flags */ > - u64 flags; > - > /* > * We maintain more than a single set of debug registers to support > * debugging the guest from the host and to maintain separate host and > @@ -356,9 +364,6 @@ struct kvm_vcpu_arch { > /* Detect first run of a vcpu */ > bool has_run_once; > > - /* Virtual SError ESR to restore when HCR_EL2.VSE is set */ > - u64 vsesr_el2; > - > /* Additional reset state */ > struct vcpu_reset_state reset_state; > > @@ -373,7 +378,7 @@ struct kvm_vcpu_arch { > } steal; > }; > > -#define hyp_state(vcpu) ((vcpu)->arch) > +#define hyp_state(vcpu) ((vcpu)->arch.hyp_state) Aha, so _that_ is the nice thing about the previous patches ... I need to stare at this series for a little longer, but wouldn't it be easier to simply apply the struct kvm_vcpu_arch change and fixup all the users at once instead of having all these preparatory patches? It's probably personal preference at this point, but I must admit I'm finding all these layers of accessors a little confusing. Happy to hear what others think. Thanks, Quentin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel