From patchwork Fri Sep 16 06:45:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 670710 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sb6712TQ3z9s36 for ; Fri, 16 Sep 2016 17:17:33 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=U+Tl5Hye; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sb6711J2czDsZW for ; Fri, 16 Sep 2016 17:17:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=U+Tl5Hye; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sb5Rg22BLzDsZR for ; Fri, 16 Sep 2016 16:46:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=U+Tl5Hye; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id 6so264574pfl.2 for ; Thu, 15 Sep 2016 23:46:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9kXZEJqAjpwIREM5iyE5D0mpJgoIlzSKnBErrowNz7w=; b=U+Tl5HyekNjnz/KVPoZgz8ApjASwW/+bKwV4jB/RHXxgdM9F3d70KXSWjU0P+jdpQL WM2ZqkVqVzk/WUX8lG2Q094CYC3R/9lFbikUXG2Us3DB7mJqP+MzY5rMmgQkvSIAgyf/ nl2nJJCSmNWu2Xu3wiWl0P1xf24LST5byP213I5SI+q5hWAREkA7+UmBN85AM9P3Gqp/ 8RWwKHVtuhRnAGaf2SxLt86WBmxyjam/vYTQOam+nWbA4/iJ5RsN4loSXN0Fl+OQmpcP v9NxB11/ZJxh5fAFqrdjOMqlYdxFlazOuxQdr0AQa2MT51yvqc66zqlhZaMfgr6fy/dj v1lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9kXZEJqAjpwIREM5iyE5D0mpJgoIlzSKnBErrowNz7w=; b=PfMJ4+92BI5wUFC/+hRu3ewufFABr/vUMdNXSNUfHvnNYxyOguB6XI9szI8xyZJ4g2 bsLf1LALGKbdgp5x04ES6CcyXzk6ICBaFIU7btEVFqEKvhZNSODSWzLH/BTEZAXBuy9c QNEGcFZHTM2Ha3R2KD0n3WC6CPPO+cV9FYWHXNw2o1aJNtGZy3OL3Gxh+QxiTFt4gWAh 5IGsvI4roIUu0zXGRloXABjZsLHfPYzxX7h6hVEIy7rCxIhVu0auB6NgDoLDadFa0h/B q+8x5w9EBeQhg4ALDxO4J/5M4zinfk5EOHHKGnpU7P4XaFJUr/9OwgcMKiqravlD2X/F R4yw== X-Gm-Message-State: AE9vXwOHDIVRe6yC0VQL8B4NqHzhe5e1vG107T7uo5uG90f8KggKD+8ZzhOFcBlitSdjUQ== X-Received: by 10.98.24.71 with SMTP id 68mr20847939pfy.52.1474008413637; Thu, 15 Sep 2016 23:46:53 -0700 (PDT) Received: from canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id 22sm15920382pft.10.2016.09.15.23.46.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 23:46:53 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 16 Sep 2016 16:45:03 +1000 Message-Id: <1474008303-20365-6-git-send-email-oohall@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1474008303-20365-1-git-send-email-oohall@gmail.com> References: <1474008303-20365-1-git-send-email-oohall@gmail.com> Subject: [Skiboot] [RFC PATCH 5/5] hw/slw: only enable supported STOP states X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This patch adds parsing the ibm,enabled-stop-levels field when building the /ibm,opal/power-mgt/ node so that only the STOP levels that have been advertised by firmware are used. Signed-off-by: Oliver O'Halloran --- hw/slw.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hw/slw.c b/hw/slw.c index 62822dfaefdf..00b747dd7c79 100644 --- a/hw/slw.c +++ b/hw/slw.c @@ -573,6 +573,7 @@ void add_cpu_idle_state_properties(void) u64 *pm_ctrl_reg_val_buf; u64 *pm_ctrl_reg_mask_buf; u32 supported_states_mask; + u32 stop_levels; /* Variables to track buffer length */ u8 name_buf_len; @@ -612,6 +613,12 @@ void add_cpu_idle_state_properties(void) states = power9_cpu_idle_states; nr_states = ARRAY_SIZE(power9_cpu_idle_states); has_stop_inst = true; + + stop_levels = dt_prop_get_u32_def(power_mgt, + "ibm,enabled-stop-levels", 0); + if (!stop_levels) + prerror("SLW: No stop levels available. Power saving is disabled!\n"); + } else if (chip->type == PROC_CHIP_P8_MURANO || chip->type == PROC_CHIP_P8_VENICE || chip->type == PROC_CHIP_P8_NAPLES) { @@ -690,6 +697,13 @@ void add_cpu_idle_state_properties(void) if (!(states[i].flags & supported_states_mask)) continue; + /* We can only use the stop levels that HB has made available */ + if (has_stop_inst) { + u32 level = 1ul << states[i].pm_ctrl_reg_val; + if (!(stop_levels & level)) + continue; + } + /* * If a state is supported add each of its property * to its corresponding property buffer.