From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44499) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bBLji-0005EM-L2 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 08:40:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bBLjh-0003Q6-F3 for qemu-devel@nongnu.org; Fri, 10 Jun 2016 08:40:30 -0400 Date: Fri, 10 Jun 2016 14:40:18 +0200 From: Igor Mammedov Message-ID: <20160610144018.32480226@nial.brq.redhat.com> In-Reply-To: <20160610114833.GF17952@thinpad.lan.raisama.net> References: <1465226212-254093-1-git-send-email-imammedo@redhat.com> <1465226212-254093-4-git-send-email-imammedo@redhat.com> <20160609183430.GC17952@thinpad.lan.raisama.net> <20160610091544.67b6a69a@nial.brq.redhat.com> <20160610113904.GF18662@thinpad.lan.raisama.net> <20160610114833.GF17952@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] target-i386: Remove assert(kvm_enabled()) from host_x86_cpu_initfn() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, qemu-devel@nongnu.org, blauwirbel@gmail.com, qemu-arm@nongnu.org, pbonzini@redhat.com, rth@twiddle.net On Fri, 10 Jun 2016 08:48:33 -0300 Eduardo Habkost wrote: > The code will be changed to allow creation of the CPU object and > report kvm_required errors only at realizefn, so we need to make > the instance_init function more flexible. > > Signed-off-by: Eduardo Habkost > --- > I am applying this before "Move xcc->kvm_required check to > realize time" to avoid triggering the assert(). Reviewed-by: Igor Mammedov > --- > target-i386/cpu.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 647cd30..c91902f 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1547,16 +1547,17 @@ static void host_x86_cpu_initfn(Object *obj) > CPUX86State *env = &cpu->env; > KVMState *s = kvm_state; > > - assert(kvm_enabled()); > - > /* We can't fill the features array here because we don't know yet if > * "migratable" is true or false. > */ > cpu->host_features = true; > > - env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX); > - env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX); > - env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX); > + /* If KVM is disabled, cpu_x86_create() will already report an error */ > + if (kvm_enabled()) { > + env->cpuid_level = kvm_arch_get_supported_cpuid(s, 0x0, 0, R_EAX); > + env->cpuid_xlevel = kvm_arch_get_supported_cpuid(s, 0x80000000, 0, R_EAX); > + env->cpuid_xlevel2 = kvm_arch_get_supported_cpuid(s, 0xC0000000, 0, R_EAX); > + } > > object_property_set_bool(OBJECT(cpu), true, "pmu", &error_abort); > }