From patchwork Mon May 2 12:33:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 8992181 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9EE729F1D3 for ; Mon, 2 May 2016 12:50:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 062D3201FE for ; Mon, 2 May 2016 12:50:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 44313201FA for ; Mon, 2 May 2016 12:50:39 +0000 (UTC) Received: from localhost ([::1]:36482 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axDJ5-0007Dh-Bm for patchwork-qemu-devel@patchwork.kernel.org; Mon, 02 May 2016 08:50:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35778) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axD4E-0007J6-Jq for qemu-devel@nongnu.org; Mon, 02 May 2016 08:35:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axD42-0000Ap-SR for qemu-devel@nongnu.org; Mon, 02 May 2016 08:35:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52052) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axD42-00006a-O0 for qemu-devel@nongnu.org; Mon, 02 May 2016 08:35:02 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F95EBF9CB for ; Mon, 2 May 2016 12:34:51 +0000 (UTC) Received: from dell-r430-03.lab.eng.brq.redhat.com (dell-r430-03.lab.eng.brq.redhat.com [10.34.112.60]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u42CXqcK000450; Mon, 2 May 2016 08:34:50 -0400 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Mon, 2 May 2016 14:33:42 +0200 Message-Id: <1462192431-146342-34-git-send-email-imammedo@redhat.com> In-Reply-To: <1462192431-146342-1-git-send-email-imammedo@redhat.com> References: <1462192431-146342-1-git-send-email-imammedo@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 33/42] target-i386: add X86CPU.node property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: drjones@redhat.com, ehabkost@redhat.com, mst@redhat.com, armbru@redhat.com, marcel@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Igor Mammedov --- target-i386/cpu-qom.h | 1 + target-i386/cpu.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index cb75017..7b09fa5 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -101,6 +101,7 @@ typedef struct X86CPU { bool migratable; bool host_features; int64_t apic_id; + int64_t numa_node; /* default: -1: not configured */ /* if true the CPUID code directly forward host cache leaves to the guest */ bool cache_info_passthrough; diff --git a/target-i386/cpu.c b/target-i386/cpu.c index d0b5b69..060131a 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -1802,6 +1802,44 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, const char *name, cpu->apic_id = value; } +static void x86_cpu_get_numa_node(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + int64_t value = cpu->numa_node; + + if (value == -1) { + error_setg(errp, "Attempt to get not initialized property '%s' on '%s'", + name, object_get_typename(obj)); + return; + } + + visit_type_int(v, name, &value, errp); +} + +static void x86_cpu_set_numa_node(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86CPU *cpu = X86_CPU(obj); + DeviceState *dev = DEVICE(obj); + Error *error = NULL; + int64_t value; + + if (dev->realized) { + error_setg(errp, "Attempt to set property '%s' on '%s' after " + "it was realized", name, object_get_typename(obj)); + return; + } + + visit_type_int(v, name, &value, &error); + if (error) { + error_propagate(errp, error); + return; + } + cpu->numa_node = value; +} + + /* Generic getter for "feature-words" and "filtered-features" properties */ static void x86_cpu_get_feature_words(Object *obj, Visitor *v, const char *name, void *opaque, @@ -3133,6 +3171,10 @@ static void x86_cpu_initfn(Object *obj) object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features, NULL); + cpu->numa_node = -1; + object_property_add(obj, "node", "int", + x86_cpu_get_numa_node, + x86_cpu_set_numa_node, NULL, NULL, NULL); cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;