[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 31/35] target/ppc/kvm: don't pass cpu to kvm_get_smmu
From: |
David Gibson |
Subject: |
[Qemu-devel] [PULL 31/35] target/ppc/kvm: don't pass cpu to kvm_get_smmu_info() |
Date: |
Tue, 3 Jul 2018 15:58:00 +1000 |
From: Greg Kurz <address@hidden>
In a future patch the machine code will need to retrieve the MMU
information from KVM during machine initialization before the CPUs
are created.
Actually, KVM_PPC_GET_SMMU_INFO is a VM class ioctl, and thus, we
don't need to have a CPU object around. We just need for KVM to
be initialized and use the kvm_state global. This patch just does
that.
Signed-off-by: Greg Kurz <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/kvm.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index b6000f12b9..9211ee2ee1 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -248,19 +248,19 @@ static int kvm_booke206_tlb_init(PowerPCCPU *cpu)
#if defined(TARGET_PPC64)
-static void kvm_get_smmu_info(PowerPCCPU *cpu, struct kvm_ppc_smmu_info *info,
- Error **errp)
+static void kvm_get_smmu_info(struct kvm_ppc_smmu_info *info, Error **errp)
{
- CPUState *cs = CPU(cpu);
int ret;
- if (!kvm_check_extension(cs->kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) {
+ assert(kvm_state != NULL);
+
+ if (!kvm_check_extension(kvm_state, KVM_CAP_PPC_GET_SMMU_INFO)) {
error_setg(errp, "KVM doesn't expose the MMU features it supports");
error_append_hint(errp, "Consider switching to a newer KVM\n");
return;
}
- ret = kvm_vm_ioctl(cs->kvm_state, KVM_PPC_GET_SMMU_INFO, info);
+ ret = kvm_vm_ioctl(kvm_state, KVM_PPC_GET_SMMU_INFO, info);
if (ret == 0) {
return;
}
@@ -326,14 +326,13 @@ target_ulong kvmppc_configure_v3_mmu(PowerPCCPU *cpu,
bool kvmppc_hpt_needs_host_contiguous_pages(void)
{
- PowerPCCPU *cpu = POWERPC_CPU(first_cpu);
static struct kvm_ppc_smmu_info smmu_info;
if (!kvm_enabled()) {
return false;
}
- kvm_get_smmu_info(cpu, &smmu_info, &error_fatal);
+ kvm_get_smmu_info(&smmu_info, &error_fatal);
return !!(smmu_info.flags & KVM_PPC_PAGE_SIZES_REAL);
}
@@ -348,7 +347,7 @@ void kvm_check_mmu(PowerPCCPU *cpu, Error **errp)
return;
}
- kvm_get_smmu_info(cpu, &smmu_info, &local_err);
+ kvm_get_smmu_info(&smmu_info, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
@@ -2091,7 +2090,7 @@ uint64_t kvmppc_rma_size(uint64_t current_size, unsigned
int hash_shift)
/* Find the largest hardware supported page size that's less than
* or equal to the (logical) backing page size of guest RAM */
- kvm_get_smmu_info(POWERPC_CPU(first_cpu), &info, &error_fatal);
+ kvm_get_smmu_info(&info, &error_fatal);
rampagesize = qemu_getrampagesize();
best_page_shift = 0;
--
2.17.1
- [Qemu-devel] [PULL 06/35] ppc/xics: move the instance_init handler under the ics-base class, (continued)
- [Qemu-devel] [PULL 06/35] ppc/xics: move the instance_init handler under the ics-base class, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 07/35] ppx/xics: introduce a parent_reset in ICSStateClass, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 09/35] ppc/xics: rework the ICS classes inheritance tree, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 18/35] target/ppc: Split out gen_ld_atomic, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 21/35] target/ppc: Use atomic min/max helpers, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 04/35] ppc/xics: introduce ICP DeviceRealize and DeviceReset handlers, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 27/35] hw/timer: Add basic M41T80 emulation, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 14/35] target/ppc: Use atomic cmpxchg for STQCX, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 32/35] spapr: compute default value of "hpt-max-page-size" later, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 28/35] sam460ex: Add RTC device, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 31/35] target/ppc/kvm: don't pass cpu to kvm_get_smmu_info(),
David Gibson <=
- [Qemu-devel] [PULL 17/35] target/ppc: Split out gen_load_locked, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 16/35] target/ppc: Tidy gen_conditional_store, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 12/35] target/ppc: Use atomic load for LQ and LQARX, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 13/35] target/ppc: Use atomic store for STQ, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 25/35] hw/ppc: Give sam46ex its own config option, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 15/35] target/ppc: Remove POWERPC_EXCP_STCX, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 19/35] target/ppc: Split out gen_st_atomic, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 22/35] target/ppc: Implement the rest of gen_ld_atomic, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 23/35] target/ppc: Implement the rest of gen_st_atomic, David Gibson, 2018/07/03
- [Qemu-devel] [PULL 24/35] fpu_helper.c: fix setting FPSCR[FI] bit, David Gibson, 2018/07/03