From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Maydell Subject: Re: [Qemu-devel] -cpu host (was Re: KVM call minutes for 2013-08-06) Date: Fri, 9 Aug 2013 14:12:17 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: qemu-devel qemu-devel , KVM devel mailing list , Juan Quintela To: kvmarm@lists.cs.columbia.edu Return-path: Received: from mail-pb0-f48.google.com ([209.85.160.48]:54314 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758018Ab3HINMh (ORCPT ); Fri, 9 Aug 2013 09:12:37 -0400 Received: by mail-pb0-f48.google.com with SMTP id ma3so4574845pbc.35 for ; Fri, 09 Aug 2013 06:12:37 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 8 August 2013 13:51, Peter Maydell wrote: > For ARM you can't get at feature info of the host from userspace > (unless you want to get into parsing /proc/cpuinfo), so my current > idea is to have KVM_ARM_VCPU_INIT support a target-cpu-type > which means "whatever host CPU is". To expand on this for the 64 bit situation: * although in theory we could support a 32-bit-compiled QEMU binary on a 64-bit host kernel, I think there's not much need for it * if you run a 64-bit QEMU on a 64-bit host and ask VCPU_INIT for a 'host' CPU, you get a 64 bit CPU * you can add the feature flag '32 bit VM please' when making the VCPU_INIT call, which gets you the same host CPU but forced into 32 bit mode (this flag & behaviour exist in the kernel today) -- in QEMU I guess we have a '-cpu host32' which drives this, or possibly add support for "-cpu host,+32bitvm" style syntax. NB that the API for reading and writing registers isn't the same for "64 bit CPU in 32 bit mode" as for a native 32 bit CPU -- the view of the guest that QEMU sees in the former case is the same view that a 64 bit hypervisor sees of a 32 bit guest. I think that to avoid huge ifdefs it will be cleaner to have target-arm/kvm.c [common functions] target-arm/kvm32.c [init_vcpu, get_registers, etc for 32 bit] target-arm/kvm64.c [ditto, 64 bit] and configure only sets CONFIG_KVM for aarch64-on-aarch64 and arm-on-arm. -- PMM