From patchwork Wed Oct 11 08:00:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 824276 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="WLnABALC"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yBmf92jn6z9t4X for ; Wed, 11 Oct 2017 19:01:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756707AbdJKIBW (ORCPT ); Wed, 11 Oct 2017 04:01:22 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:33200 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756206AbdJKIA5 (ORCPT ); Wed, 11 Oct 2017 04:00:57 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v9B80nQN002145; Wed, 11 Oct 2017 03:00:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1507708849; bh=73sA19+nivvphZ6NX6OYSWPopB/IrfkSDWEIWv4Lcd4=; h=From:To:CC:Subject:Date; b=WLnABALC1QBI6Ae5jBOAbTz8UpXONbXSmVEWHf8kgE2VCOrcFwki8WHPWRYt2ujxO ITDnWmb3yj3s5PHz1yab8CYULBCqjQiqqV6UM3vwerGLbw8pqU9ljtv44gZzOx0Poc lzAW5OGfSlGiquKvKxQ9C0UWwjMVH266Rrtuc6Rg= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9B80n46003128; Wed, 11 Oct 2017 03:00:49 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Wed, 11 Oct 2017 03:00:48 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Wed, 11 Oct 2017 03:00:48 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9B80iFw006731; Wed, 11 Oct 2017 03:00:45 -0500 From: Kishon Vijay Abraham I To: Robin Murphy , Christoph Hellwig , Rob Herring , Mark Rutland CC: Kishon Vijay Abraham I , Bjorn Helgaas , , , , , Subject: [PATCH] of: Devices with pci_epf_bus_type require DMA configuration Date: Wed, 11 Oct 2017 13:30:41 +0530 Message-ID: <20171011080041.12918-1-kishon@ti.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org pci-epc-core.c invokes of_dma_configure in order to configure the coherent_dma_mask/dma_mask of endpoint function device. This is required for dma_alloc_coherent to succeed in pci function driver (pci-epf-test.c). However after commit 723288836628bc1c08 ("of: restrict DMA configuration"), of_dma_configure doesn't configure the coherent_dma_mask/dma_mask of endpoint function device (since it doesn't have dma-ranges property), resulting in dma_alloc_coherent in pci endpoint function driver to to fail. Fix it by making sure of_dma_configure configures coherent_dma_mask/dma_mask irrespective of whether the node has dma-ranges property or not. Fixes: 723288836628bc1c08 ("of: restrict DMA configuration") Signed-off-by: Kishon Vijay Abraham I --- drivers/of/device.c | 4 +++- drivers/pci/endpoint/pci-epf-core.c | 3 +-- include/linux/pci-epf.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index 64b710265d39..881cf80a3d69 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -105,7 +106,8 @@ int of_dma_configure(struct device *dev, struct device_node *np) #ifdef CONFIG_ARM_AMBA dev->bus != &amba_bustype && #endif - dev->bus != &platform_bus_type) + dev->bus != &platform_bus_type && + dev->bus != &pci_epf_bus_type) return ret == -ENODEV ? 0 : ret; dma_addr = offset = 0; diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index ae1611a62808..6f354ec6be71 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -26,7 +26,6 @@ #include #include -static struct bus_type pci_epf_bus_type; static const struct device_type pci_epf_type; /** @@ -344,7 +343,7 @@ static int pci_epf_device_remove(struct device *dev) return ret; } -static struct bus_type pci_epf_bus_type = { +struct bus_type pci_epf_bus_type = { .name = "pci-epf", .match = pci_epf_device_match, .probe = pci_epf_device_probe, diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 60d551a9a1ba..83a3fb7e6ac1 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -16,6 +16,7 @@ #include #include +extern struct bus_type pci_epf_bus_type; struct pci_epf; enum pci_barno {