From patchwork Thu Aug 1 01:02:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 263852 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9EE742C00B8 for ; Thu, 1 Aug 2013 11:03:02 +1000 (EST) Received: from localhost ([::1]:39350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4hIB-0003LC-IZ for incoming@patchwork.ozlabs.org; Wed, 31 Jul 2013 21:02:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4hHq-0003Kp-VH for qemu-devel@nongnu.org; Wed, 31 Jul 2013 21:02:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V4hHl-0004er-0n for qemu-devel@nongnu.org; Wed, 31 Jul 2013 21:02:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:59137 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V4hHk-0004eX-HO; Wed, 31 Jul 2013 21:02:32 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1774AA51B7; Thu, 1 Aug 2013 03:02:30 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Thu, 1 Aug 2013 03:02:21 +0200 Message-Id: <1375318941-17624-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Alexey Kardashevskiy , Alexander Graf , "open list:sPAPR" , Anthony Liguori , Prerna Saxena , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH for-next] spapr: Avoid "HOST@0" CPU node name in SLOF device tree for -cpu host 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 By default on KVM or when user asks for it via -cpu host, cpu_model will be "host" and sPAPR merely upper-cases it for the SLOF device tree. Change it so that we get the underlying CPU type, e.g., "POWER7_V2.3@0". Reported-by: Prerna Saxena Signed-off-by: Andreas Färber --- This avoids a PVR based lookup in common code. Tested with local patches for POWER5+_v2.1 support and modified SLOF. hw/ppc/spapr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 16bfab9..95579b9 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1072,7 +1072,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; const char *boot_device = args->boot_device; - PowerPCCPU *cpu; + PowerPCCPU *cpu = NULL; CPUPPCState *env; PCIHostState *phb; int i; @@ -1307,6 +1307,15 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) register_savevm_live(NULL, "spapr/htab", -1, 1, &savevm_htab_handlers, spapr); + if (kvm_enabled() && strcmp(cpu_model, "host") == 0) { + ObjectClass *cpu_class = object_get_class(OBJECT(cpu)); + ObjectClass *parent_cpu_class = object_class_get_parent(cpu_class); + const char *parent_name = object_class_get_name(parent_cpu_class); + + cpu_model = g_strndup(parent_name, + strlen(parent_name) - strlen("-" TYPE_POWERPC_CPU)); + } + /* Prepare the device tree */ spapr->fdt_skel = spapr_create_fdt_skel(cpu_model, initrd_base, initrd_size,