From patchwork Wed Mar 11 19:51:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 5988521 Return-Path: X-Original-To: patchwork-kvm@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 73D7A9F399 for ; Wed, 11 Mar 2015 19:51:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9454520374 for ; Wed, 11 Mar 2015 19:51:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AACA620373 for ; Wed, 11 Mar 2015 19:51:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752031AbbCKTvS (ORCPT ); Wed, 11 Mar 2015 15:51:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38568 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751687AbbCKTvR (ORCPT ); Wed, 11 Mar 2015 15:51:17 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2BJpBC0023607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Mar 2015 15:51:12 -0400 Received: from redhat.com (ovpn-116-109.ams2.redhat.com [10.36.116.109]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id t2BJp8Ji013396; Wed, 11 Mar 2015 15:51:09 -0400 Date: Wed, 11 Mar 2015 20:51:08 +0100 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum , Paolo Bonzini , Marcelo Tosatti , Richard Henderson , kvm@vger.kernel.org Subject: [PULL 10/25] machine: query kvm-shadow-mem machine property Message-ID: <20150311205108-mutt-send-email-mst@redhat.com> References: <1426096767-30494-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1426096767-30494-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 From: Marcel Apfelbaum Commit e79d5a6 ("machine: remove qemu_machine_opts global list") removed the global option descriptions and moved them to MachineState's QOM properties. Query kvm-shadow-mem by accessing machine properties through designated wrappers. Signed-off-by: Marcel Apfelbaum Acked-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini --- include/hw/boards.h | 1 + hw/core/machine.c | 6 ++++++ target-i386/kvm.c | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 69ab606..4be3cd1 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -69,6 +69,7 @@ bool machine_usb(MachineState *machine); bool machine_iommu(MachineState *machine); bool machine_kernel_irqchip_allowed(MachineState *machine); bool machine_kernel_irqchip_required(MachineState *machine); +int machine_kvm_shadow_mem(MachineState *machine); /** * MachineClass: diff --git a/hw/core/machine.c b/hw/core/machine.c index e04e5ab..0ad5b12 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -284,6 +284,7 @@ static void machine_initfn(Object *obj) MachineState *ms = MACHINE(obj); ms->kernel_irqchip_allowed = true; + ms->kvm_shadow_mem = -1; object_property_add_str(obj, "accel", machine_get_accel, machine_set_accel, NULL); @@ -414,6 +415,11 @@ bool machine_kernel_irqchip_required(MachineState *machine) return machine->kernel_irqchip_required; } +int machine_kvm_shadow_mem(MachineState *machine) +{ + return machine->kvm_shadow_mem; +} + static const TypeInfo machine_info = { .name = TYPE_MACHINE, .parent = TYPE_OBJECT, diff --git a/target-i386/kvm.c b/target-i386/kvm.c index ce554e4..acb6831 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -890,8 +890,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } qemu_register_reset(kvm_unpoison_all, NULL); - shadow_mem = qemu_opt_get_size(qemu_get_machine_opts(), - "kvm_shadow_mem", -1); + shadow_mem = machine_kvm_shadow_mem(ms); if (shadow_mem != -1) { shadow_mem /= 4096; ret = kvm_vm_ioctl(s, KVM_SET_NR_MMU_PAGES, shadow_mem);