From: Marc Zyngier <maz@kernel.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
David Brazdil <dbrazdil@google.com>,
Eric Auger <eric.auger@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Nathan Chancellor <natechancellor@gmail.com>,
Qian Cai <qcai@redhat.com>,
Shannon Zhao <shannon.zhao@linux.alibaba.com>,
James Morse <james.morse@arm.com>,
Julien Thierry <julien.thierry.kdev@gmail.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
kernel-team@android.com, kvmarm@lists.cs.columbia.edu,
kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/18] KVM: arm64: Minor cleanup of hyp variables used in host
Date: Thu, 7 Jan 2021 11:20:48 +0000 [thread overview]
Message-ID: <20210107112101.2297944-6-maz@kernel.org> (raw)
In-Reply-To: <20210107112101.2297944-1-maz@kernel.org>
From: David Brazdil <dbrazdil@google.com>
Small cleanup moving declarations of hyp-exported variables to
kvm_host.h and using macros to avoid having to refer to them with
kvm_nvhe_sym() in host.
No functional change intended.
Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201208142452.87237-5-dbrazdil@google.com
---
arch/arm64/include/asm/kvm_host.h | 6 ++++++
arch/arm64/kvm/arm.c | 4 +---
arch/arm64/kvm/hyp/nvhe/hyp-smp.c | 6 +++---
arch/arm64/kvm/va_layout.c | 5 ++---
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
index 828d50d40dc2..bce2452b305c 100644
--- a/arch/arm64/include/asm/kvm_host.h
+++ b/arch/arm64/include/asm/kvm_host.h
@@ -260,6 +260,12 @@ struct kvm_host_psci_config {
extern struct kvm_host_psci_config kvm_nvhe_sym(kvm_host_psci_config);
#define kvm_host_psci_config CHOOSE_NVHE_SYM(kvm_host_psci_config)
+extern s64 kvm_nvhe_sym(hyp_physvirt_offset);
+#define hyp_physvirt_offset CHOOSE_NVHE_SYM(hyp_physvirt_offset)
+
+extern u64 kvm_nvhe_sym(hyp_cpu_logical_map)[NR_CPUS];
+#define hyp_cpu_logical_map CHOOSE_NVHE_SYM(hyp_cpu_logical_map)
+
struct vcpu_reset_state {
unsigned long pc;
unsigned long r0;
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 6a2f4e01b04f..836ca763b91d 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -65,8 +65,6 @@ static bool vgic_present;
static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled);
DEFINE_STATIC_KEY_FALSE(userspace_irqchip_in_use);
-extern u64 kvm_nvhe_sym(__cpu_logical_map)[NR_CPUS];
-
int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
{
return kvm_vcpu_exiting_guest_mode(vcpu) == IN_GUEST_MODE;
@@ -1602,7 +1600,7 @@ static void init_cpu_logical_map(void)
* allow any other CPUs from the `possible` set to boot.
*/
for_each_online_cpu(cpu)
- kvm_nvhe_sym(__cpu_logical_map)[cpu] = cpu_logical_map(cpu);
+ hyp_cpu_logical_map[cpu] = cpu_logical_map(cpu);
}
static bool init_psci_relay(void)
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-smp.c b/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
index cbab0c6246e2..2997aa156d8e 100644
--- a/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
+++ b/arch/arm64/kvm/hyp/nvhe/hyp-smp.c
@@ -14,14 +14,14 @@
* Other CPUs should not be allowed to boot because their features were
* not checked against the finalized system capabilities.
*/
-u64 __ro_after_init __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
+u64 __ro_after_init hyp_cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID };
u64 cpu_logical_map(unsigned int cpu)
{
- if (cpu >= ARRAY_SIZE(__cpu_logical_map))
+ if (cpu >= ARRAY_SIZE(hyp_cpu_logical_map))
hyp_panic();
- return __cpu_logical_map[cpu];
+ return hyp_cpu_logical_map[cpu];
}
unsigned long __hyp_per_cpu_offset(unsigned int cpu)
diff --git a/arch/arm64/kvm/va_layout.c b/arch/arm64/kvm/va_layout.c
index 914732b88c69..70fcd6a12fe1 100644
--- a/arch/arm64/kvm/va_layout.c
+++ b/arch/arm64/kvm/va_layout.c
@@ -34,17 +34,16 @@ static u64 __early_kern_hyp_va(u64 addr)
}
/*
- * Store a hyp VA <-> PA offset into a hyp-owned variable.
+ * Store a hyp VA <-> PA offset into a EL2-owned variable.
*/
static void init_hyp_physvirt_offset(void)
{
- extern s64 kvm_nvhe_sym(hyp_physvirt_offset);
u64 kern_va, hyp_va;
/* Compute the offset from the hyp VA and PA of a random symbol. */
kern_va = (u64)lm_alias(__hyp_text_start);
hyp_va = __early_kern_hyp_va(kern_va);
- CHOOSE_NVHE_SYM(hyp_physvirt_offset) = (s64)__pa(kern_va) - (s64)hyp_va;
+ hyp_physvirt_offset = (s64)__pa(kern_va) - (s64)hyp_va;
}
/*
--
2.29.2
next prev parent reply other threads:[~2021-01-07 11:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 11:20 [GIT PULL] KVM/arm64 fixes for 5.11, take #1 Marc Zyngier
2021-01-07 11:20 ` [PATCH 01/18] KVM: arm64: Don't access PMCR_EL0 when no PMU is available Marc Zyngier
2021-01-07 11:20 ` [PATCH 02/18] KVM: arm64: Prevent use of invalid PSCI v0.1 function IDs Marc Zyngier
2021-01-07 11:20 ` [PATCH 03/18] KVM: arm64: Use lm_alias in nVHE-only VA conversion Marc Zyngier
2021-01-07 11:20 ` [PATCH 04/18] KVM: arm64: Skip computing hyp VA layout for VHE Marc Zyngier
2021-01-07 11:20 ` Marc Zyngier [this message]
2021-01-07 11:20 ` [PATCH 06/18] KVM: arm64: Remove unused includes in psci-relay.c Marc Zyngier
2021-01-07 11:20 ` [PATCH 07/18] KVM: arm64: Move skip_host_instruction to adjust_pc.h Marc Zyngier
2021-01-07 11:20 ` [PATCH 08/18] KVM: arm64: Declutter host PSCI 0.1 handling Marc Zyngier
2021-01-07 11:20 ` [PATCH 09/18] KVM: Documentation: Add arm64 KVM_RUN error codes Marc Zyngier
2021-01-07 11:20 ` [PATCH 10/18] KVM: arm64: arch_timer: Remove VGIC initialization check Marc Zyngier
2021-01-07 11:20 ` [PATCH 11/18] KVM: arm64: Move double-checked lock to kvm_vgic_map_resources() Marc Zyngier
2021-01-07 11:20 ` [PATCH 12/18] KVM: arm64: Update comment in kvm_vgic_map_resources() Marc Zyngier
2021-01-07 11:20 ` [PATCH 13/18] KVM: arm64: Remove redundant call to kvm_pmu_vcpu_reset() Marc Zyngier
2021-01-07 11:20 ` [PATCH 14/18] KVM: arm64: Consolidate dist->ready setting into kvm_vgic_map_resources() Marc Zyngier
2021-01-07 11:20 ` [PATCH 15/18] KVM: arm64: Fix hyp_cpu_pm_{init,exit} __init annotation Marc Zyngier
2021-01-07 11:20 ` [PATCH 16/18] KVM: arm64: Remove spurious semicolon in reg_to_encoding() Marc Zyngier
2021-01-07 11:21 ` [PATCH 17/18] KVM: arm64: Replace KVM_ARM_PMU with HW_PERF_EVENTS Marc Zyngier
2021-01-07 11:21 ` [PATCH 18/18] arm64: cpufeature: remove non-exist CONFIG_KVM_ARM_HOST Marc Zyngier
2021-01-07 18:19 ` [GIT PULL] KVM/arm64 fixes for 5.11, take #1 Paolo Bonzini
2021-01-07 23:09 ` Paolo Bonzini
2021-01-08 8:22 ` Marc Zyngier
2021-01-08 10:03 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210107112101.2297944-6-maz@kernel.org \
--to=maz@kernel.org \
--cc=alexandru.elisei@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dbrazdil@google.com \
--cc=eric.auger@redhat.com \
--cc=james.morse@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kernel-team@android.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=natechancellor@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qcai@redhat.com \
--cc=shannon.zhao@linux.alibaba.com \
--cc=suzuki.poulose@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).