From patchwork Fri Mar 2 03:08:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 880260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zsvQN1PDcz9s72 for ; Fri, 2 Mar 2018 14:08:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zsvQM6C44zF1qC for ; Fri, 2 Mar 2018 14:08:43 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zsvQG2h1xzF1pW for ; Fri, 2 Mar 2018 14:08:38 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 3zsvQG0Tx0z9s72; Fri, 2 Mar 2018 14:08:38 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id CA653EE7901; Fri, 2 Mar 2018 14:08:37 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Fri, 2 Mar 2018 14:08:09 +1100 Message-Id: <20180302030809.19122-1-mikey@neuling.org> X-Mailer: git-send-email 2.14.1 Subject: [Skiboot] [PATCH] Tie tm-suspend fw-feature and opal_reinit_cpus() together X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org, Michael Neuling , cyrilbur@gmail.com MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Currently opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) always returns OPAL_UNSUPPORTED. This ties the tm suspend fw-feature to the opal_reinit_cpus(OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) so that when tm suspend is disabled, we correctly report it to the kernel. For backwards compatibility, it's assumed tm suspend is available if the fw-feature is not present. Signed-off-by: Michael Neuling Reviewed-by: Cyril Bur --- core/cpu.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/core/cpu.c b/core/cpu.c index 2eab522553..7a9dbe5d70 100644 --- a/core/cpu.c +++ b/core/cpu.c @@ -57,6 +57,7 @@ static bool ipi_enabled; static bool pm_enabled; static bool current_hile_mode; static bool current_radix_mode; +static bool tm_suspend_enabled; unsigned long cpu_secondary_start __force_data = 0; @@ -1012,6 +1013,21 @@ static int find_dec_bits(void) return bits; } +static void init_tm_suspend_mode_property(void) +{ + struct dt_node *node; + + /* If we don't find anything, assume TM suspend is enabled */ + tm_suspend_enabled = true; + + node = dt_find_by_path(dt_root, "/ibm,opal/fw-features/tm-suspend-mode"); + if (!node) + return; + + if (dt_find_property(node, "disabled")) + tm_suspend_enabled = false; +} + void init_all_cpus(void) { struct dt_node *cpus, *cpu; @@ -1021,6 +1037,8 @@ void init_all_cpus(void) cpus = dt_find_by_path(dt_root, "/cpus"); assert(cpus); + init_tm_suspend_mode_property(); + /* Iterate all CPUs in the device-tree */ dt_for_each_child(cpus, cpu) { unsigned int pir, server_no, chip_id; @@ -1436,11 +1454,10 @@ static int64_t opal_reinit_cpus(uint64_t flags) if (flags & OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED) { flags &= ~OPAL_REINIT_CPUS_TM_SUSPEND_DISABLED; - /* - * Pending a hostboot change we can't determine the status of - * this, so it always fails. - */ - rc = OPAL_UNSUPPORTED; + if (tm_suspend_enabled) + rc = OPAL_UNSUPPORTED; + else + rc = OPAL_SUCCESS; } /* Handle P8 DD1 SLW reinit */