From patchwork Wed Feb 27 04:30:05 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: 10831043 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 725A31575 for ; Wed, 27 Feb 2019 04:32:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 507B32D1FF for ; Wed, 27 Feb 2019 04:32:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 419BC2D209; Wed, 27 Feb 2019 04:32:04 +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 EDBA92D1FF for ; Wed, 27 Feb 2019 04:32:02 +0000 (UTC) Received: from localhost ([127.0.0.1]:37729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyqsz-0001Z5-IH for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Feb 2019 23:32:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:48040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyqrf-0000bI-GF for qemu-devel@nongnu.org; Tue, 26 Feb 2019 23:30:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyqre-0008Qo-5v for qemu-devel@nongnu.org; Tue, 26 Feb 2019 23:30:39 -0500 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:36396) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gyqrS-00086d-Na; Tue, 26 Feb 2019 23:30:28 -0500 Received: by mail-pl1-x644.google.com with SMTP id k2so7345770plt.3; Tue, 26 Feb 2019 20:30:19 -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=z009jlxilyphKgBm7mwL2ucTFQCVyXjWYX7AOpZ5zfI=; b=gMWSa1L+TuFd/Lhre7vmJsCE/mN7lMfT5b7zRaX/A3YBXQ7pgczK3fpYqRsb1gmsfq KWe0mxfJ034qBFCAlXDwYNKpP8V0s1VZqLqnRQhgEIKphQZBP3jbwUU2Am2nUvcsuxiI 6sn6uqzXAp3lcXExK0LEBO3PH9IZY0MyaklaiMmBNhZWNq/PUpdRM76E8W+OONf7mhpP VF0655oe9Inreh49LD3Xosud1H4DP2aMIOJIUVVf3AGdCM6075lVSCoOFmyXvv6Lb38B va6RypBWtRrWOgWDvbj4bn8RWRByKKZs1os8aq5uISYfd7WO2HgG5eGbFrvBl5iNfXVA llUg== 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=z009jlxilyphKgBm7mwL2ucTFQCVyXjWYX7AOpZ5zfI=; b=IdRyW8G4FPLJpSMSMTgDEUTTke1LDdoTEl5VoLlybhttuMuYK5nK8N6KG/lXL9oSmh 3ISW+fxXJ7/olAknTjdW9Np07EHmgFM3aAZLiWZukLmDgp9HP4/6rFm50vXZ+upG7ek5 W/21+LwkQ4vJzq/9AFl1Nqz17ScqGPflGo0X2Ag/B5TW4nHXqRVjWkgXEB8naPqGJ0cF yvm5Q2UTBQ6GvyVe46wqlnVxWiuejg04HxqugALaIrjMhp7oxnE/NhtSa9V7MnpX+BXg bM/NEHUJfElEZDxNoom6FPWrYWC7+DXyA8ivl1Q/PHpYWJ4n3cbTdfRbs5aUweJxDPpS bQIA== X-Gm-Message-State: AHQUAub5m656HEWD7CVbZyv5/ynY5+hrX9kR1a4XsWZ6MCQmn05TjswI k0G9ZKuYgav9Z2l5Jxmgh6aP6jxC X-Google-Smtp-Source: AHgI3IZAMp0vhFeXaMGp4LtvgJyr3/kcCGczEj9eErd0CTT8wxL0bFOqPa16yMLK+kKlcVybKBOXjw== X-Received: by 2002:a17:902:f83:: with SMTP id 3mr94699plz.125.1551241817988; Tue, 26 Feb 2019 20:30:17 -0800 (PST) Received: from localhost.au.ibm.com ([43.245.162.131]) by smtp.gmail.com with ESMTPSA id k18sm9203642pfj.92.2019.02.26.20.30.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 20:30:17 -0800 (PST) From: Suraj Jitindar Singh To: qemu-ppc@nongnu.org Date: Wed, 27 Feb 2019 15:30:05 +1100 Message-Id: <20190227043008.12059-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::644 Subject: [Qemu-devel] [QEMU-PPC] [PATCH v2 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, clg@kaod.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 b6a571b6f1..acf62a2b9f 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 } }; @@ -4288,6 +4289,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] = 0; 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 59073a7579..8efc5e0779 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 @@ -828,6 +830,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) {