Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4864306imm; Tue, 9 Oct 2018 06:27:45 -0700 (PDT) X-Google-Smtp-Source: ACcGV60MwREcPaOKw1G5esWyxlkk7SxzXIb+nUuuSpHfnuEsI3Gi2QKFujmsP2fdNCUuFQMwpL6W X-Received: by 2002:a63:fb54:: with SMTP id w20-v6mr25832628pgj.321.1539091665740; Tue, 09 Oct 2018 06:27:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539091665; cv=none; d=google.com; s=arc-20160816; b=MiGR1cQJ6woiWCll8WZEqU4QUzLc4klQO3I4OouZ8zFNVGKwmfGHjjUKeXkspVyfEV RCSRpcA0Y0izirQRsnLnsRtfT4Ywj1jpRfhZ8gWYNYZd4dmalaq3IvgbVz/VTvClv9OF J6t9IEB2Wr8xyLsuLCk0s/oaEZnML6RqCr/mGOND6kbqrVJi1+uOrg4v9rzWqjMzq3Gp tcFOOulBapYh+pwo4gJAFlp1q5ya93knbXrF5hBYlw9PDxVuF1Ro6eNO6eL05C0XqkoD gR89hrBTSiTW6CVEliXsTHettNC8MJm62M3dWh2z3N6x+0c7z14IvlX5zUA278PamhBG AeZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+1EiEe+f+Zo4Ql+MI1HQ2VxHjecaPGIqGdVcvB4Xz1g=; b=Eg13uDCWmWfx4vyfsANSGGkVzkB8AyhZ0mharWMIV5jt/cGPXbPrw4YgFcO5Em832k zkVNwX91KlmSr/toxqE08Dtbaahb/brjofISKVb/+2P40Jb8OHho3EO6RIfwo32ITQkT 8dsiL6K90yUtq4cnfUwLLedpUw68QjKN80tA1ymkZTGk03upxJ10/FmnvbYPlSLnxs39 9rKUMXC2QbbOOG71t7HSAxvke8IOWi6cKkId5mGeexsxGgeq2hVW6qpTIvbuvhvxiG2Y +Y9nEZfp1C2c3JmBtM3RwXkSXq960afD+LT5VX9b2LATNs6aZzxAVUXVa7gyd+q9EF1f diCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dgI3l1FP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h131-v6si18298795pgc.122.2018.10.09.06.27.31; Tue, 09 Oct 2018 06:27:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dgI3l1FP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727803AbeJIUn1 (ORCPT + 99 others); Tue, 9 Oct 2018 16:43:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50206 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726717AbeJIUn0 (ORCPT ); Tue, 9 Oct 2018 16:43:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+1EiEe+f+Zo4Ql+MI1HQ2VxHjecaPGIqGdVcvB4Xz1g=; b=dgI3l1FP6fHEl6ppF0L+Usvawj Stfrqmo9GTvLyX2Zz36kBGF7+aA556qH1F3T+xRKEbU3UMpeQ/NLOl6xuB1EkPNov0ZiswD7ZXec8 y6CJnsRgXJIB7l2hcHuOqdMMuu+kx7QPmeA7ARrko0L8gBOGhoX58RQY+R7rFRphPo0wSd2qmp67r vBOYnwKHMwz++VxaP6ICWLMlCoACQg5bN/zUmq8fBU+dsCvbgE3GPIvnhtCzxAvGIJW/8CDJfXR0x 3hESA1yBdWle9BwtpgbVGFDlFMD9fb57NK4sm50K6VAQewa0W2nmkG0t90GFDliTke94DB7e7BM9T v7hke3VQ==; Received: from clnet-p19-102.ikbnet.co.at ([83.175.77.102] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9s1L-0001MW-Cu; Tue, 09 Oct 2018 13:25:55 +0000 From: Christoph Hellwig To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 21/33] powerpc/dma: remove get_pci_dma_ops Date: Tue, 9 Oct 2018 15:24:48 +0200 Message-Id: <20181009132500.17643-22-hch@lst.de> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181009132500.17643-1-hch@lst.de> References: <20181009132500.17643-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This function is only used by the Cell iommu code, which can keep track if it is using the iommu internally just as good. Signed-off-by: Christoph Hellwig --- arch/powerpc/include/asm/pci.h | 2 -- arch/powerpc/kernel/pci-common.c | 6 ------ arch/powerpc/platforms/cell/iommu.c | 17 ++++++++--------- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h index a01d2e3d6ff9..4f7cf0a7f89d 100644 --- a/arch/powerpc/include/asm/pci.h +++ b/arch/powerpc/include/asm/pci.h @@ -52,10 +52,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) #ifdef CONFIG_PCI extern void set_pci_dma_ops(const struct dma_map_ops *dma_ops); -extern const struct dma_map_ops *get_pci_dma_ops(void); #else /* CONFIG_PCI */ #define set_pci_dma_ops(d) -#define get_pci_dma_ops() NULL #endif #ifdef CONFIG_PPC64 diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 88e4f69a09e5..a84707680525 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -69,12 +69,6 @@ void set_pci_dma_ops(const struct dma_map_ops *dma_ops) pci_dma_ops = dma_ops; } -const struct dma_map_ops *get_pci_dma_ops(void) -{ - return pci_dma_ops; -} -EXPORT_SYMBOL(get_pci_dma_ops); - /* * This function should run under locking protection, specifically * hose_spinlock. diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index fb51f78035ce..93c7e4aef571 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c @@ -544,6 +544,7 @@ static struct cbe_iommu *cell_iommu_for_node(int nid) static unsigned long cell_dma_nommu_offset; static unsigned long dma_iommu_fixed_base; +static bool cell_iommu_enabled; /* iommu_fixed_is_weak is set if booted with iommu_fixed=weak */ bool iommu_fixed_is_weak; @@ -572,16 +573,14 @@ static u64 cell_iommu_get_fixed_address(struct device *dev); static void cell_dma_dev_setup(struct device *dev) { - if (get_pci_dma_ops() == &dma_iommu_ops) { + if (cell_iommu_enabled) { u64 addr = cell_iommu_get_fixed_address(dev); if (addr != OF_BAD_ADDR) set_dma_offset(dev, addr + dma_iommu_fixed_base); set_iommu_table_base(dev, cell_get_iommu_table(dev)); - } else if (get_pci_dma_ops() == &dma_nommu_ops) { - set_dma_offset(dev, cell_dma_nommu_offset); } else { - BUG(); + set_dma_offset(dev, cell_dma_nommu_offset); } } @@ -599,11 +598,11 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action, if (action != BUS_NOTIFY_ADD_DEVICE) return 0; - /* We use the PCI DMA ops */ - dev->dma_ops = get_pci_dma_ops(); - + if (cell_iommu_enabled) + dev->dma_ops = &dma_iommu_ops; + else + dev->dma_ops = &dma_nommu_ops; cell_dma_dev_setup(dev); - return 0; } @@ -1091,7 +1090,7 @@ static int __init cell_iommu_init(void) cell_pci_iommu_bypass_supported; } set_pci_dma_ops(&dma_iommu_ops); - + cell_iommu_enabled = true; bail: /* Register callbacks on OF platform device addition/removal * to handle linking them to the right DMA operations -- 2.19.0