From patchwork Fri Apr 26 16:46:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 239890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 62E242C0106 for ; Sat, 27 Apr 2013 02:47:13 +1000 (EST) Received: from localhost ([::1]:34100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVlnj-0005T7-MQ for incoming@patchwork.ozlabs.org; Fri, 26 Apr 2013 12:47:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53022) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVlnS-0005PD-BQ for qemu-devel@nongnu.org; Fri, 26 Apr 2013 12:46:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVlnR-0004xx-6x for qemu-devel@nongnu.org; Fri, 26 Apr 2013 12:46:54 -0400 Received: from cantor2.suse.de ([195.135.220.15]:35863 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVlnQ-0004xp-UJ for qemu-devel@nongnu.org; Fri, 26 Apr 2013 12:46:53 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F01385E000201; Fri, 26 Apr 2013 18:46:51 +0200 (CEST) Message-ID: <517AAF7A.1080604@suse.de> Date: Fri, 26 Apr 2013 18:46:50 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= Organization: SUSE LINUX Products GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: Igor Mammedov References: <1366898737-6201-1-git-send-email-imammedo@redhat.com> <1366898737-6201-5-git-send-email-imammedo@redhat.com> In-Reply-To: <1366898737-6201-5-git-send-email-imammedo@redhat.com> X-Enigmail-Version: 1.6a1pre X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: peter.maydell@linaro.org, aliguori@us.ibm.com, ehabkost@redhat.com, mst@redhat.com, stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, quintela@redhat.com, anthony.perard@citrix.com, pbonzini@redhat.com Subject: Re: [Qemu-devel] [PATCH 04/15] target-i386: introduce apic-id property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 25.04.2013 16:05, schrieb Igor Mammedov: > The property is used from board level to set APIC ID for CPUs it > creates. Do so in a new pc_new_cpu() helper, to be reused for hot-plug. > > Signed-off-by: Igor Mammedov > --- > Note: > * pc_new_cpu() function will be reused later in CPU hot-plug hook. > > v4: > * after switching to qemu_for_each_cpu() in cpu_exists(), first CPU > becomes visible to cpu_exists() early and setting property fails, > skip APIC ID check if value to be set is the same as the current. > * use error_propagate() in pc_new_cpu() > * return CPU from pc_new_cpu(). Moved from "move APIC to ICC bus" > to reduce its size. > v3: > * user error_propagate() in property setter > v2: > * use generic cpu_exists() instead of custom one > * make apic-id dynamic property, so it won't be possible to use it > as global property, since it's instance specific > --- > hw/i386/pc.c | 29 ++++++++++++++++++++++++++++- > target-i386/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 70 insertions(+), 1 deletions(-) Thanks, applied to qom-cpu (with change suggested on v4 below): https://github.com/afaerber/qemu-cpu/commits/qom-cpu Question: This being a dynamic QOM property, QMP qom-set apic-id allows to change the value during runtime. Should we suppress this with a dev->realized check? If so, please supply a follow-up patch. Andreas cpu->env.cpuid_apic_id = value; diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 0be0138..f1cecc0 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1295,16 +1295,14 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, void *opaque, return; } if (value < min || value > max) { - error_setg(&error, "Property %s.%s doesn't take value %" PRId64 + error_setg(errp, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(obj), name, value, min, max); - error_propagate(errp, error); return; } if ((value != cpu->env.cpuid_apic_id) && cpu_exists(value)) { - error_setg(&error, "CPU with APIC ID %" PRIi64 " exists", value); - error_propagate(errp, error); + error_setg(errp, "CPU with APIC ID %" PRIi64 " exists", value); return; }