From patchwork Wed Feb 18 03:57:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 440794 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.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 77A571401DD for ; Wed, 18 Feb 2015 14:58:26 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 5614C1A0C78 for ; Wed, 18 Feb 2015 14:58:26 +1100 (AEDT) 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 C5A2F1A0BA2 for ; Wed, 18 Feb 2015 14:58:07 +1100 (AEDT) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id t1I3vVi3028817; Tue, 17 Feb 2015 21:57:46 -0600 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Wed, 18 Feb 2015 14:57:25 +1100 Message-Id: <1424231849-17973-9-git-send-email-benh@kernel.crashing.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1424231849-17973-1-git-send-email-benh@kernel.crashing.org> References: <1424231849-17973-1-git-send-email-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH 09/13] pci: Remove pci_lock 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: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" It only protects actions that are done at boot time in a non-concurrent way anyway. The only useful locking is in the PHB code itself Signed-off-by: Benjamin Herrenschmidt --- core/pci.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/pci.c b/core/pci.c index 693ec21..11bea09 100644 --- a/core/pci.c +++ b/core/pci.c @@ -19,10 +19,8 @@ #include #include #include -#include #include -static struct lock pci_lock = LOCK_UNLOCKED; static struct phb *phbs[64]; #define PCITRACE(_p, _bdfn, fmt, a...) \ @@ -771,7 +769,7 @@ int64_t pci_register_phb(struct phb *phb) int64_t rc = OPAL_SUCCESS; unsigned int i; - lock(&pci_lock); + /* This is called at init time in non-concurrent way, so no lock needed */ for (i = 0; i < ARRAY_SIZE(phbs); i++) if (!phbs[i]) break; @@ -786,7 +784,6 @@ int64_t pci_register_phb(struct phb *phb) PCIDBG(phb, 0, "PCI: Registered PHB\n"); } list_head_init(&phb->devices); - unlock(&pci_lock); return rc; } @@ -799,9 +796,7 @@ int64_t pci_unregister_phb(struct phb *phb) * * Right now we don't unregister so we are fine */ - lock(&pci_lock); phbs[phb->opal_id] = phb; - unlock(&pci_lock); return OPAL_SUCCESS; } @@ -1370,7 +1365,7 @@ void pci_reset(void) prlog(PR_NOTICE, "PCI: Clearing all devices...\n"); - lock(&pci_lock); + /* This is a remnant of fast-reboot, not currently used */ /* XXX Do those in parallel (at least the power up * state machine could be done in parallel) @@ -1380,7 +1375,6 @@ void pci_reset(void) continue; __pci_reset(&phbs[i]->devices); } - unlock(&pci_lock); } static void pci_do_jobs(void (*fn)(void *)) @@ -1429,8 +1423,6 @@ void pci_init_slots(void) { unsigned int i; - lock(&pci_lock); - prlog(PR_NOTICE, "PCI: Resetting PHBs...\n"); pci_do_jobs(pci_reset_phb); @@ -1447,8 +1439,6 @@ void pci_init_slots(void) continue; pci_add_nodes(phbs[i]); } - - unlock(&pci_lock); } /*