Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1139782pxk; Fri, 18 Sep 2020 05:02:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2Jq0VRZ1aCZ+p7VYNN36/51Bq7LGgubLRV5tkoOB6vEkCLppzbRRid5n0eGgU0idkRmdc X-Received: by 2002:a17:906:2747:: with SMTP id a7mr35107184ejd.301.1600430525519; Fri, 18 Sep 2020 05:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600430525; cv=none; d=google.com; s=arc-20160816; b=RlBG/v9LR2hrnSCccQU2iHdt4CM6WUZ8ACS+1jX2Y8f91ZLBIalWfDbjazfO3CUAEk OLlFSbtwZysE52hZqjwLdW4nAHXSTU+fsksAlXCfV8YXVMeSgHYe0cn5qp14PUq28x1I JLvE/DMrkYwjZBrI0yqB+GH2H3cdgelZFsEY/22TdFRo7KREKjK2poY20iffkWAmNDWA dDMmvnwqZ0vTranUKOHOwPzfI67l2tR4ZcxhfGifGspwLhJEDFXFsDkqE7OjiszURnC4 /LApWSaW55sER4nTvJeMocnQHe+Kn4IQ2K9MTjZ/DFaVght9S7jGk2D9yyrbfDJA/g7E dQvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KHGaFtseUlsSIy6575YW9u1BCdLbRgQBDDv0+ElaeEs=; b=wcZppSyjIzv1BNbjuJk1LA3prgXrYRPIl7FMg11NgT/HOrDzmJ4QBHeMa0ZGfqyR1j dPMdqVKsFWXUR2AsL8qt1sexZqpO0/JF8QMYlgDI/OAsDTzUeJpA9s/AfwZzJpRMJu0I v/IZQtSKvQt93s2vXO0rYmmHzxu/8RHWD2kGPRi6aKuhxz2c25UDIc3yOVBWb8z5XES+ 0TldGwmIiIco4yMQ3dy5vMswSdzUUffaxfqmjFpyoyRC1oBYqWbs1y3+acaM98J5Qs8a NFlv3Jyt1PDVlnhsZ4NNqqVG6Z98Iwrh56lwG4679Z6zeJ4Bt4beqhb6Hlq3RY90Afa/ MRjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MweCyFFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv10si2496663ejb.539.2020.09.18.05.01.41; Fri, 18 Sep 2020 05:02:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MweCyFFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbgIRL62 (ORCPT + 99 others); Fri, 18 Sep 2020 07:58:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:38070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIRL62 (ORCPT ); Fri, 18 Sep 2020 07:58:28 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (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 A7EED2100A; Fri, 18 Sep 2020 11:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600430307; bh=TpvsNRIT0A6VtxEhgI5MhD7WAEWs8qrYhkK4T++wnP4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MweCyFFMa++URq9mDUFNihVj7Vn8UJNHq5rPnvhtRln3QswuX+9z3bnLYnb+Eu7G3 P7o0kuxSCd1yg1lH5h/+yoJ6ZaBNrRdX3F9VZlxFN3F9u66hEsWGGf8f9nbu0AdDFy Nr7yApqARdgFx0m+TO+rpa325DWaKqY/RU5ZE64E= Date: Fri, 18 Sep 2020 12:58:22 +0100 From: Will Deacon To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, Catalin Marinas , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v3 08/11] kvm: arm64: Create separate instances of kvm_host_data for VHE/nVHE Message-ID: <20200918115821.GA31096@willie-the-truck> References: <20200916173439.32265-1-dbrazdil@google.com> <20200916173439.32265-9-dbrazdil@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200916173439.32265-9-dbrazdil@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 16, 2020 at 06:34:36PM +0100, David Brazdil wrote: > Host CPU context is stored in a global per-cpu variable `kvm_host_data`. > In preparation for introducing independent per-CPU region for nVHE hyp, > create two separate instances of `kvm_host_data`, one for VHE and one > for nVHE. > > Signed-off-by: David Brazdil > --- > arch/arm64/include/asm/kvm_host.h | 2 +- > arch/arm64/kernel/image-vars.h | 1 - > arch/arm64/kvm/arm.c | 5 ++--- > arch/arm64/kvm/hyp/nvhe/switch.c | 3 +++ > arch/arm64/kvm/hyp/vhe/switch.c | 3 +++ > arch/arm64/kvm/pmu.c | 8 ++++---- > 6 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 905c2b87e05a..5d8c63f5e97e 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -565,7 +565,7 @@ void kvm_set_sei_esr(struct kvm_vcpu *vcpu, u64 syndrome); > > struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr); > > -DECLARE_PER_CPU(kvm_host_data_t, kvm_host_data); > +DECLARE_KVM_HYP_PER_CPU(kvm_host_data_t, kvm_host_data); > > static inline void kvm_init_host_cpu_context(struct kvm_cpu_context *cpu_ctxt) > { > diff --git a/arch/arm64/kernel/image-vars.h b/arch/arm64/kernel/image-vars.h > index 59d12a0b4622..80da861b8180 100644 > --- a/arch/arm64/kernel/image-vars.h > +++ b/arch/arm64/kernel/image-vars.h > @@ -67,7 +67,6 @@ KVM_NVHE_ALIAS(kvm_patch_vector_branch); > KVM_NVHE_ALIAS(kvm_update_va_mask); > > /* Global kernel state accessed by nVHE hyp code. */ > -KVM_NVHE_ALIAS(kvm_host_data); > KVM_NVHE_ALIAS(kvm_vgic_global_state); > > /* Kernel constant needed to compute idmap addresses. */ > diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c > index 3bdc2661d276..7af9809fa193 100644 > --- a/arch/arm64/kvm/arm.c > +++ b/arch/arm64/kvm/arm.c > @@ -46,7 +46,6 @@ > __asm__(".arch_extension virt"); > #endif > > -DEFINE_PER_CPU(kvm_host_data_t, kvm_host_data); > static DEFINE_PER_CPU(unsigned long, kvm_arm_hyp_stack_page); > > /* The VMID used in the VTTBR */ > @@ -1308,7 +1307,7 @@ static void cpu_hyp_reset(void) > > static void cpu_hyp_reinit(void) > { > - kvm_init_host_cpu_context(&this_cpu_ptr(&kvm_host_data)->host_ctxt); > + kvm_init_host_cpu_context(&this_cpu_ptr_hyp(kvm_host_data)->host_ctxt); > > cpu_hyp_reset(); > > @@ -1543,7 +1542,7 @@ static int init_hyp_mode(void) > for_each_possible_cpu(cpu) { > kvm_host_data_t *cpu_data; > > - cpu_data = per_cpu_ptr(&kvm_host_data, cpu); > + cpu_data = per_cpu_ptr_hyp(kvm_host_data, cpu); I stand by my earlier comment to add _sym here, given that the ampersand gets dropped from the argument. So assuming you do that in the earlier patch: Acked-by: Will Deacon Will