From patchwork Sat Mar 28 01:08:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 1263134 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48q0xH2FGqz9sSG for ; Sat, 28 Mar 2020 12:09:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48q0xH0D21zDq9y for ; Sat, 28 Mar 2020 12:09:23 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=bauerman@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 48q0wl1wl9zDq8F for ; Sat, 28 Mar 2020 12:08:54 +1100 (AEDT) Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 02S147GE106495 for ; Fri, 27 Mar 2020 21:08:52 -0400 Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ywbv0tbef-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 27 Mar 2020 21:08:51 -0400 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 02S10DBK013871 for ; Sat, 28 Mar 2020 01:08:51 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma03wdc.us.ibm.com with ESMTP id 2ywawapeny-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 28 Mar 2020 01:08:51 +0000 Received: from b03ledav006.gho.boulder.ibm.com (b03ledav006.gho.boulder.ibm.com [9.17.130.237]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 02S18otW14811688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 28 Mar 2020 01:08:50 GMT Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2459FC605B; Sat, 28 Mar 2020 01:08:50 +0000 (GMT) Received: from b03ledav006.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AF76C6055; Sat, 28 Mar 2020 01:08:46 +0000 (GMT) Received: from morokweng.localdomain.com (unknown [9.85.174.163]) by b03ledav006.gho.boulder.ibm.com (Postfix) with ESMTP; Sat, 28 Mar 2020 01:08:45 +0000 (GMT) From: Thiago Jung Bauermann To: skiboot@lists.ozlabs.org Date: Fri, 27 Mar 2020 22:08:04 -0300 Message-Id: <20200328010806.20621-2-bauerman@linux.ibm.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200328010806.20621-1-bauerman@linux.ibm.com> References: <20200328010806.20621-1-bauerman@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.645 definitions=2020-03-27_09:2020-03-27, 2020-03-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_spam_definite policy=outbound score=100 clxscore=1011 priorityscore=1501 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxscore=0 phishscore=0 impostorscore=0 mlxlogscore=481 suspectscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2003280003 Subject: [Skiboot] [PATCH 1/3] SBE: Factor out handling of SBE reset X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" When we get notified that the SBE was reset, there are a few cleanups that need to be done in Skiboot. We'll need the same code when handling SBE interrupts via the Ultravisor, so factor it out. There's no behavior change. Signed-off-by: Thiago Jung Bauermann --- hw/sbe-p9.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/hw/sbe-p9.c b/hw/sbe-p9.c index 53f378e18..5ff44d545 100644 --- a/hw/sbe-p9.c +++ b/hw/sbe-p9.c @@ -534,6 +534,23 @@ static void p9_sbe_timer_response(struct p9_sbe *sbe) lock(&sbe->lock); } +/* Internal cleanups needed after the SBE is reset. */ +static void p9_sbe_after_reset(struct p9_sbe *sbe) +{ + prlog(PR_NOTICE, + "Back from reset [chip id = %x]\n", sbe->chip_id); + /* Reset SBE MBOX state */ + sbe->state = sbe_mbox_idle; + + /* Reset message state */ + if (!list_empty(&sbe->msg_list)) { + struct p9_sbe_msg *msg; + + msg = list_top(&sbe->msg_list, struct p9_sbe_msg, link); + msg->state = sbe_msg_queued; + } +} + /* WARNING: This will drop sbe->lock */ static void __p9_sbe_interrupt(struct p9_sbe *sbe) { @@ -563,16 +580,7 @@ again: if (rc) return; - prlog(PR_NOTICE, - "Back from reset [chip id = %x]\n", sbe->chip_id); - /* Reset SBE MBOX state */ - sbe->state = sbe_mbox_idle; - - /* Reset message state */ - if (!list_empty(&sbe->msg_list)) { - msg = list_top(&sbe->msg_list, struct p9_sbe_msg, link); - msg->state = sbe_msg_queued; - } + p9_sbe_after_reset(sbe); return; }