From patchwork Wed Apr 29 05:01:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 465882 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 EAE12140320 for ; Wed, 29 Apr 2015 15:02:00 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id D32DC1A0751 for ; Wed, 29 Apr 2015 15:02:00 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E5F551A0025 for ; Wed, 29 Apr 2015 15:01:52 +1000 (AEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id t3T51lH0001522 for ; Wed, 29 Apr 2015 00:01:48 -0500 Message-ID: <1430283707.17831.106.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Wed, 29 Apr 2015 15:01:47 +1000 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Subject: [Skiboot] [PATCH 1/2] xscom: Remove recursive locking X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 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" Nothing should be using it nowadays and it's dangerous. Signed-off-by: Benjamin Herrenschmidt --- hw/xscom.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/hw/xscom.c b/hw/xscom.c index 6bd71a3..a3533be 100644 --- a/hw/xscom.c +++ b/hw/xscom.c @@ -342,7 +342,6 @@ static uint32_t xscom_decode_chiplet(uint32_t partid, uint64_t *pcb_addr) */ int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val) { - bool need_unlock; uint32_t gcid; int rc; @@ -360,12 +359,8 @@ int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val) return OPAL_PARAMETER; } - /* - * HW822317 requires locking. We use a recursive lock as error - * conditions might cause printf's which might then try to take - * the lock again - */ - need_unlock = lock_recursive(&xscom_lock); + /* HW822317 requires us to do global locking */ + lock(&xscom_lock); /* Direct vs indirect access */ if (pcb_addr & XSCOM_ADDR_IND_FLAG) @@ -374,8 +369,7 @@ int xscom_read(uint32_t partid, uint64_t pcb_addr, uint64_t *val) rc = __xscom_read(gcid, pcb_addr & 0x7fffffff, val); /* Unlock it */ - if (need_unlock) - unlock(&xscom_lock); + unlock(&xscom_lock); return rc; } @@ -383,7 +377,6 @@ opal_call(OPAL_XSCOM_READ, xscom_read, 3); int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val) { - bool need_unlock; uint32_t gcid; int rc; @@ -401,12 +394,8 @@ int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val) return OPAL_PARAMETER; } - /* - * HW822317 requires locking. We use a recursive lock as error - * conditions might cause printf's which might then try to take - * the lock again - */ - need_unlock = lock_recursive(&xscom_lock); + /* HW822317 requires us to do global locking */ + lock(&xscom_lock); /* Direct vs indirect access */ if (pcb_addr & XSCOM_ADDR_IND_FLAG) @@ -415,8 +404,7 @@ int xscom_write(uint32_t partid, uint64_t pcb_addr, uint64_t val) rc = __xscom_write(gcid, pcb_addr & 0x7fffffff, val); /* Unlock it */ - if (need_unlock) - unlock(&xscom_lock); + unlock(&xscom_lock); return rc; } opal_call(OPAL_XSCOM_WRITE, xscom_write, 3);