From patchwork Wed Feb 14 06:51:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10218117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D60560467 for ; Wed, 14 Feb 2018 06:55:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2FEB128CF2 for ; Wed, 14 Feb 2018 06:55:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23CD628D12; Wed, 14 Feb 2018 06:55:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id A300228CF2 for ; Wed, 14 Feb 2018 06:55:09 +0000 (UTC) Received: from localhost ([::1]:43212 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elqyC-0004W6-KR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 14 Feb 2018 01:55:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elqv9-0002Zu-5V for qemu-devel@nongnu.org; Wed, 14 Feb 2018 01:52:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elqv8-0003gN-31 for qemu-devel@nongnu.org; Wed, 14 Feb 2018 01:51:59 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:34341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elqv5-0003dd-ED; Wed, 14 Feb 2018 01:51:55 -0500 Received: by mail-pl0-x243.google.com with SMTP id bd10so3208517plb.1; Tue, 13 Feb 2018 22:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eA9rjz3HA6Av7Q6zPQkuGNTNGEP6xi1sNmhg4G8rhFE=; b=eMxElDJgzLQKijxAzpfL1nkB2snjtlUglTZ7MxZQkhBAsuPPc2C/NfgVsCGa9mNQT8 pm+XdCgC60UFA3oYDvigYQKOrvACc0JakuFrORw/ZCSWyM0nnqqsGWkFxLdo4PsC2DUf RqeF6UZJszm9tAjgZ0iSxomArK3goUCfPE0bIXuup+uiU/mf+iJKcnO9kwD5gE0PrQDd xEwNPXd7PUGlKoUVk6D4QiUvKGblUnnuhNu9Rj8f0p5b+5dKj8pDXQvxJoQDI5GC6FlE gZ87x+NuW99wwJF+WLsXeKc8M7P9+X1fNH50xRV3/DT8ClD9EQUVA338/vP+T47i1axH ikgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eA9rjz3HA6Av7Q6zPQkuGNTNGEP6xi1sNmhg4G8rhFE=; b=t/Cp2GOip2+8L0NZrnulW7sPbVohcldyfFzLEwUGwFWTGFtRAwjMNioNKM3d292GgI UxgK4l48CzcCx2i0ERoYGokHGQNYbBTwagPQRTVNhLybML2H/gfJAKRgbWAqxv44HZJh tn5wdQAwre5VkFSORb6dr/OhNluXa8b0+5R3VYdoCrOjdxw6idzpUMEuwrk7CpAFRe5U nc5f1Q7eTSdl7hL8lvUgk3lP9czHHHFc1+mx74gMqNz/w6OvGyv++D8Pdhjnd55698oY VpxqeYALqZc4i3rWK/Geo8Zya2JCH+QrGw4uIIdphXV8NdSxWwXmAi7FArB9d9HYqs8j CKSg== X-Gm-Message-State: APf1xPBZKDY0mIooGKiyaNdN/vSGn3hNsHytQ4gZsDA9cQjmJVfa8cY9 gW8eDBwx0whbTYKgcA4hKz4Ue54U X-Google-Smtp-Source: AH8x225SFifg7XjiHGrjw7aWS/8bf3+/H6lj1m8X1ZI2B4nL43Wu9Qe5c4Yy3ipXwDYfTsAt9FLaag== X-Received: by 2002:a17:902:b909:: with SMTP id bf9-v6mr3627973plb.218.1518591114322; Tue, 13 Feb 2018 22:51:54 -0800 (PST) Received: from surajjs1.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id z90sm41215038pfd.78.2018.02.13.22.51.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 22:51:53 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Wed, 14 Feb 2018 17:51:35 +1100 Message-Id: <20180214065135.11633-3-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180214065135.11633-1-sjitindarsingh@gmail.com> References: <20180214065135.11633-1-sjitindarsingh@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [QEMU-PPC] [PATCH V2 3/3] ppc/spapr-caps: For pseries-2.12 change spapr-cap defaults 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: aik@ozlabs.ru, qemu-devel@nongnu.org, Suraj Jitindar Singh , david@gibson.dropbear.id.au Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For the pseries-2.12 machine type, make the spapr-caps SPAPR_CAP_CFPC and SPAPR_CAP_SBBC default to workaround. Thus if the host is capable the guest will be able to take advantage of these workarounds by default. Otherwise if the host doesn't have these capabilities qemu will fail to start and they will have to be explicitly disabled on the command line with: -machine pseries,cap-cfpc=broken,cap-sbbc=broken Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr.c | 11 ++++++++++- hw/ppc/spapr_caps.c | 10 ++++++++++ include/hw/compat.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 969db6cde2..e2ebb76242 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3941,13 +3941,20 @@ static const TypeInfo spapr_machine_info = { /* * pseries-2.12 */ +#define SPAPR_COMPAT_2_12 \ + HW_COMPAT_2_12 + static void spapr_machine_2_12_instance_options(MachineState *machine) { } static void spapr_machine_2_12_class_options(MachineClass *mc) { - /* Defaults for the latest behaviour inherited from the base class */ + sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); + + smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_WORKAROUND; + smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_WORKAROUND; + SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_12); } DEFINE_SPAPR_MACHINE(2_12, "2.12", true); @@ -3969,6 +3976,8 @@ static void spapr_machine_2_11_class_options(MachineClass *mc) spapr_machine_2_12_class_options(mc); smc->default_caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_ON; + smc->default_caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN; + smc->default_caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN; SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_11); } diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 05997b0842..c25c2bca52 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -281,11 +281,21 @@ static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, caps = smc->default_caps; + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, + 0, spapr->max_compat_pvr)) { + caps.caps[SPAPR_CAP_CFPC] = SPAPR_CAP_BROKEN; + } + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_07, 0, spapr->max_compat_pvr)) { caps.caps[SPAPR_CAP_HTM] = SPAPR_CAP_OFF; } + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06_PLUS, + 0, spapr->max_compat_pvr)) { + caps.caps[SPAPR_CAP_SBBC] = SPAPR_CAP_BROKEN; + } + if (!ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06, 0, spapr->max_compat_pvr)) { caps.caps[SPAPR_CAP_VSX] = SPAPR_CAP_OFF; diff --git a/include/hw/compat.h b/include/hw/compat.h index 7f31850dfa..13238239da 100644 --- a/include/hw/compat.h +++ b/include/hw/compat.h @@ -1,6 +1,8 @@ #ifndef HW_COMPAT_H #define HW_COMPAT_H +#define HW_COMPAT_2_12 + #define HW_COMPAT_2_11 \ {\ .driver = "hpet",\