From patchwork Thu Oct 13 01:16:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 681546 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 3svXsC3xWNz9s9x for ; Thu, 13 Oct 2016 12:17:35 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3svXsC38nHzDt0P for ; Thu, 13 Oct 2016 12:17:35 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3svXqm2kZJzDsxs for ; Thu, 13 Oct 2016 12:16:20 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9D1E3T7020151 for ; Wed, 12 Oct 2016 21:16:18 -0400 Received: from e23smtp04.au.ibm.com (e23smtp04.au.ibm.com [202.81.31.146]) by mx0a-001b2d01.pphosted.com with ESMTP id 261qwsxyyt-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 12 Oct 2016 21:16:18 -0400 Received: from localhost by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Oct 2016 11:16:16 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp04.au.ibm.com (202.81.31.210) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Oct 2016 11:16:14 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id D8EB53578056 for ; Thu, 13 Oct 2016 12:16:13 +1100 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9D1GD9Z18677876 for ; Thu, 13 Oct 2016 12:16:13 +1100 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9D1GCan008156 for ; Thu, 13 Oct 2016 12:16:13 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u9D1GB8a008109; Thu, 13 Oct 2016 12:16:12 +1100 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) by ozlabs.au.ibm.com (Postfix) with ESMTP id E92D0A016E; Thu, 13 Oct 2016 12:16:11 +1100 (AEDT) Received: from gwshan (shangw.ozlabs.ibm.com [10.61.2.199]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id E45FAE3C49; Thu, 13 Oct 2016 12:16:11 +1100 (AEDT) Received: by gwshan (Postfix, from userid 1000) id 91444942DC9; Thu, 13 Oct 2016 12:16:56 +1100 (AEDT) From: Gavin Shan To: skiboot@lists.ozlabs.org Date: Thu, 13 Oct 2016 12:16:46 +1100 X-Mailer: git-send-email 2.1.0 In-Reply-To: <1476321413-5245-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1476321413-5245-1-git-send-email-gwshan@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16101301-0012-0000-0000-000001D61E05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16101301-0013-0000-0000-0000063392D0 Message-Id: <1476321413-5245-3-git-send-email-gwshan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-10-12_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1610130018 Subject: [Skiboot] [PATCH v2 2/9] core/pci: Cache power state on slot without power control X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 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" We can have PCI slots where the mandatory power functionality isn't supported. On those PCI slots, we should update (cache) the slot's power state unconditionally because the power state reflects slot's hotplug state (added or removed). Without this fix, the power and slot's hotplug state are mismatched on openPower machines. FSP-based machines don't have the issue. Signed-off-by: Gavin Shan Reviewed-by: Andrew Donnellan --- core/pcie-slot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/pcie-slot.c b/core/pcie-slot.c index 7fe3785..711e2e2 100644 --- a/core/pcie-slot.c +++ b/core/pcie-slot.c @@ -202,9 +202,13 @@ static int64_t pcie_slot_set_power_state(struct pci_slot *slot, uint8_t val) if (slot->power_state == val) return OPAL_PARAMETER; - /* Drop the request if functionality doesn't exist */ - if (!(slot->slot_cap & PCICAP_EXP_SLOTCAP_PWCTRL)) + /* Update the power state and return immediately if the power + * control functionality isn't supported on the PCI slot. + */ + if (!(slot->slot_cap & PCICAP_EXP_SLOTCAP_PWCTRL)) { + slot->power_state = val; return OPAL_SUCCESS; + } pci_slot_set_state(slot, PCI_SLOT_STATE_SPOWER_START); slot->power_state = val;