From patchwork Sat Jun 23 23:53:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Pearson X-Patchwork-Id: 933824 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41Cv9663k8z9s2R for ; Sun, 24 Jun 2018 10:59:54 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="BKeIuvxr"; 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 41Cv964V6SzF158 for ; Sun, 24 Jun 2018 10:59:54 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="BKeIuvxr"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=raptorengineering.com (client-ip=192.119.205.245; helo=mail.rptsys.com; envelope-from=tpearson@raptorengineering.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="BKeIuvxr"; dkim-atps=neutral Received: from mail.rptsys.com (mail.rptsys.com [192.119.205.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Csw063kYzF0Pd for ; Sun, 24 Jun 2018 10:03:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id CEEAA6428B9; Sat, 23 Jun 2018 18:53:55 -0500 (CDT) Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id gAVIfLoSLWam; Sat, 23 Jun 2018 18:53:55 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id 27BFD6428B8; Sat, 23 Jun 2018 18:53:55 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.rptsys.com 27BFD6428B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raptorengineering.com; s=B8E824E6-0BE2-11E6-931D-288C65937AAD; t=1529798035; bh=zdLIaptXyGL1SVERJfxZ2iAPm4/Q3RtGVLG7Ic69xNc=; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=BKeIuvxrMAlIHfP2sCwFK2pGgfilhmCUxRTyk+4Uz35wDDciEcTwvBaQZCm33W+j2 M4U9VDrsDv7/974Kp+4wkqrOpiTlDC92YMP9Ca/3VAu7aja8XzrLuBN+gxXGgNrElk 0Zp4eRLpHmjhbmreQSFTJhk/j5yZBUR4NsQZ/sKE= X-Virus-Scanned: amavisd-new at rptsys.com Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 9lFLP1jjpOdk; Sat, 23 Jun 2018 18:53:54 -0500 (CDT) Received: from vali.starlink.edu (netrouter.starlink.edu [192.168.3.1]) by mail.rptsys.com (Postfix) with ESMTP id D6BB96428B4; Sat, 23 Jun 2018 18:53:54 -0500 (CDT) Date: Sat, 23 Jun 2018 18:53:54 -0500 (CDT) From: Timothy Pearson To: linuxppc-dev@lists.ozlabs.org Message-ID: <955790001.2569251.1529798034743.JavaMail.zimbra@raptorengineeringinc.com> Subject: [PATCH 4/7] powerpc/powernv/pci: Safety fixes for pseudobypass TCE MIME-Version: 1.0 X-Mailer: Zimbra 8.5.0_GA_3042 (ZimbraWebClient - FF3.6 (Linux)/8.5.0_GA_3042) Thread-Topic: powerpc/powernv/pci: Safety fixes for pseudobypass TCE Thread-Index: QW8SWb3YXtahyGZt1Y15YFdVjbGYnQ== X-Mailman-Approved-At: Sun, 24 Jun 2018 10:42:17 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" allocation Signed-off-by: Russell Currey --- arch/powerpc/platforms/powernv/pci-dma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-dma.c b/arch/powerpc/platforms/powernv/pci-dma.c index 1d5409be343e..237940a2a052 100644 --- a/arch/powerpc/platforms/powernv/pci-dma.c +++ b/arch/powerpc/platforms/powernv/pci-dma.c @@ -29,8 +29,9 @@ static int dma_pseudo_bypass_select_tce(struct pnv_ioda_pe *pe, phys_addr_t addr { int tce; __be64 old, new; + unsigned long flags; - spin_lock(&pe->tce_alloc_lock); + spin_lock_irqsave(&pe->tce_alloc_lock, flags); tce = bitmap_find_next_zero_area(pe->tce_bitmap, pe->tce_count, 0, @@ -40,9 +41,10 @@ static int dma_pseudo_bypass_select_tce(struct pnv_ioda_pe *pe, phys_addr_t addr old = pe->tces[tce]; new = cpu_to_be64(addr | TCE_PCI_READ | TCE_PCI_WRITE); pe->tces[tce] = new; + mb(); pe_info(pe, "allocating TCE %i 0x%016llx (old 0x%016llx)\n", tce, new, old); - spin_unlock(&pe->tce_alloc_lock); + spin_unlock_irqrestore(&pe->tce_alloc_lock, flags); return tce; }