From patchwork Fri Mar 1 02:43:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suraj Jitindar Singh X-Patchwork-Id: 10834361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 917631515 for ; Fri, 1 Mar 2019 02:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73F972FB7A for ; Fri, 1 Mar 2019 02:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FEC22FB97; Fri, 1 Mar 2019 02:45:05 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CDFA52FB7A for ; Fri, 1 Mar 2019 02:45:04 +0000 (UTC) Received: from localhost ([127.0.0.1]:49659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzYAY-0003Mo-UR for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Feb 2019 21:45:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzY9H-0002Jn-80 for qemu-devel@nongnu.org; Thu, 28 Feb 2019 21:43:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzY9G-0000q1-AC for qemu-devel@nongnu.org; Thu, 28 Feb 2019 21:43:43 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:44994) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzY9E-0000ni-8X; Thu, 28 Feb 2019 21:43:40 -0500 Received: by mail-pf1-x444.google.com with SMTP id a3so10665907pff.11; Thu, 28 Feb 2019 18:43:39 -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; bh=gceiMdJ31ODNQn6JNHuOK/7tAAgd51UOCAgfsVz8fVM=; b=kYRFwMzjWvoSgVsh2jNhb+Reegf+FJTJdtXGatC7xUr46m8pUZlB+E+6VQ+J0Am3mC g+u0lP1+Ue7mWorO52kdIbn3IDyTkry2qVJUd2MapdwMLW51Eq+4mfbL41JLX6aYM6Gr hoSkKjpk6dW1sLXj+Jv+dAlQWkcMcPrCWbuILyDO94FAhF42FexpZWH5f//6fp/7tenT acltDUI/JY5slGg38f5IXfR9ak6owREzLrZE0PDS3TxHNLwLlLeZ3hobsO7qO3roWkJu u+b3K3DigcWXW74K+B9Dv+TtjA4fuxbEbiziDOvQb1wj+7iMaIZI2rG7QiImoorHZK6a 1PwA== 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; bh=gceiMdJ31ODNQn6JNHuOK/7tAAgd51UOCAgfsVz8fVM=; b=av3FoVYGpTFC+O2PUwijfB1ep32JXunIBLepb7GtFGtFTNyWKnhBRPwautCbvhpfCB UgKJiLnDFJM0k9jxp1pKyJIzd5SrUq0iItq3lw8FpqSB6BJkSaHjUzHgFwncbz7tq8dX c1aJQYtPDyxYPDcT0yuSH9/SSAVqNTpawjjPmycqpLm/ZwUboX1Ci6LsUlsbNdQncVzc Xdpxg/2wNjgAV2imUbGk3WqlC0mXtlJF/do22+YenuszAuFk625mihhMs2X35yRN4jpM 1LKGG7VfnTCOHJ4L0G6Oclcjs0b0LVABAIjuw1cTWYUb4CTvvtD/XWOXeub6C60xpf/E UQ0A== X-Gm-Message-State: APjAAAX9Khsh5muIj18NH9J4SgS5X1afiNsAkvS+tSQAeR2xVeIrpqXB RsfV3YtW9J6nuhCLRP6rZ8tT427G X-Google-Smtp-Source: APXvYqzdnPdnntuoNCzO2Af0Vj5aIkB08uyrikSDy+sQDK+wEc/JbvMMyYfqjkXNabi8yAoGiUXZHA== X-Received: by 2002:a63:e10:: with SMTP id d16mr2542754pgl.148.1551408217756; Thu, 28 Feb 2019 18:43:37 -0800 (PST) Received: from surajjs2.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id n25sm46929179pfi.173.2019.02.28.18.43.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Feb 2019 18:43:36 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Fri, 1 Mar 2019 13:43:14 +1100 Message-Id: <20190301024317.22137-1-sjitindarsingh@gmail.com> X-Mailer: git-send-email 2.13.6 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [QEMU-PPC] [PATCH v3 1/4] target/ppc/spapr: Add SPAPR_CAP_LARGE_DECREMENTER 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: 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 Add spapr_cap SPAPR_CAP_LARGE_DECREMENTER to be used to control the availability of the large decrementer for a guest. Signed-off-by: Suraj Jitindar Singh --- hw/ppc/spapr.c | 2 ++ hw/ppc/spapr_caps.c | 17 +++++++++++++++++ include/hw/ppc/spapr.h | 5 ++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 6f9208476a..d068982a5e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -2077,6 +2077,7 @@ static const VMStateDescription vmstate_spapr = { &vmstate_spapr_irq_map, &vmstate_spapr_cap_nested_kvm_hv, &vmstate_spapr_dtb, + &vmstate_spapr_cap_large_decr, NULL } }; @@ -4309,6 +4310,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) smc->default_caps.caps[SPAPR_CAP_IBS] = SPAPR_CAP_BROKEN; smc->default_caps.caps[SPAPR_CAP_HPT_MAXPAGESIZE] = 16; /* 64kiB */ smc->default_caps.caps[SPAPR_CAP_NESTED_KVM_HV] = SPAPR_CAP_OFF; + smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER] = SPAPR_CAP_OFF; spapr_caps_add_properties(smc, &error_abort); smc->irq = &spapr_irq_xics; smc->dr_phb_enabled = true; diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 64f98ae68d..3f90f5823e 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -390,6 +390,13 @@ static void cap_nested_kvm_hv_apply(sPAPRMachineState *spapr, } } +static void cap_large_decr_apply(sPAPRMachineState *spapr, + uint8_t val, Error **errp) +{ + if (val) + error_setg(errp, "No large decrementer support, try cap-large-decr=off"); +} + sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { [SPAPR_CAP_HTM] = { .name = "htm", @@ -468,6 +475,15 @@ sPAPRCapabilityInfo capability_table[SPAPR_CAP_NUM] = { .type = "bool", .apply = cap_nested_kvm_hv_apply, }, + [SPAPR_CAP_LARGE_DECREMENTER] = { + .name = "large-decr", + .description = "Allow Large Decrementer", + .index = SPAPR_CAP_LARGE_DECREMENTER, + .get = spapr_cap_get_bool, + .set = spapr_cap_set_bool, + .type = "bool", + .apply = cap_large_decr_apply, + }, }; static sPAPRCapabilities default_caps_with_cpu(sPAPRMachineState *spapr, @@ -596,6 +612,7 @@ SPAPR_CAP_MIG_STATE(cfpc, SPAPR_CAP_CFPC); SPAPR_CAP_MIG_STATE(sbbc, SPAPR_CAP_SBBC); SPAPR_CAP_MIG_STATE(ibs, SPAPR_CAP_IBS); SPAPR_CAP_MIG_STATE(nested_kvm_hv, SPAPR_CAP_NESTED_KVM_HV); +SPAPR_CAP_MIG_STATE(large_decr, SPAPR_CAP_LARGE_DECREMENTER); void spapr_caps_init(sPAPRMachineState *spapr) { diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 86b0488d29..3cd47fb6e8 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -74,8 +74,10 @@ typedef enum { #define SPAPR_CAP_HPT_MAXPAGESIZE 0x06 /* Nested KVM-HV */ #define SPAPR_CAP_NESTED_KVM_HV 0x07 +/* Large Decrementer */ +#define SPAPR_CAP_LARGE_DECREMENTER 0x08 /* Num Caps */ -#define SPAPR_CAP_NUM (SPAPR_CAP_NESTED_KVM_HV + 1) +#define SPAPR_CAP_NUM (SPAPR_CAP_LARGE_DECREMENTER + 1) /* * Capability Values @@ -843,6 +845,7 @@ extern const VMStateDescription vmstate_spapr_cap_cfpc; extern const VMStateDescription vmstate_spapr_cap_sbbc; extern const VMStateDescription vmstate_spapr_cap_ibs; extern const VMStateDescription vmstate_spapr_cap_nested_kvm_hv; +extern const VMStateDescription vmstate_spapr_cap_large_decr; static inline uint8_t spapr_get_cap(sPAPRMachineState *spapr, int cap) {