From patchwork Fri Aug 18 14:57:53 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: 110415 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp941722obb; Fri, 18 Aug 2017 08:03:20 -0700 (PDT) X-Received: by 10.99.190.69 with SMTP id g5mr8957253pgo.152.1503068600682; Fri, 18 Aug 2017 08:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068600; cv=none; d=google.com; s=arc-20160816; b=cb+Bv4fdCsiFUyS039ScJqhDE0bg6zf0WtUpZ5V0u3eUtbul8l9ARhG2uQ7l+hq6dZ F1L4vL1mUmzI8gkESHzjqx4vhtJDQeRAmLR5IP/DXQhyutf7KP1a8nFYdjfZqQU1YUFf oOorLUdPY7G0Oa/L/nUtOCUGu3VZUTCs0QfYpVdXdikjZV0eAbGhI0wjQVYDJ1AZUZTg g9hXEm1dtr75squHq/rV1wAjLjeecV2Mfco3fiQjGoQytYkmfEtfmWihgXFrBMzASdC2 OpXMUTacMoW0ZXQN5+1L51I6UEj7uoWcJUln7DkktEeKft9mW3SlDSdiWyHCoZY/60w+ zMdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=5K0NARlPmGWAv2NLioSkHfA3R8YGxJI7eOZlrSAj8QI=; b=RCp4Fz+2UaGld6EwyL2CHrKP8BLEnkKZprauPAr3O/7EuDM5Jb8oMqCgk2EVrear2z LYPElG8wQnfi7CeNuozxaq7luv275ipDoUYY04I3E0kmVrQuoYP2q5ABITIjktpxaVwb VsPsUkYqOz+LpfRAG4Tcvy4yLrLPj9MZuN7fzUsWrgVJcaACez2yij9r8iOstA2llTtp EiOHyOtwh3Mgvlf0ArzwAe70JidF2KXWgYgLts+4FUKhPKWViwQSDMmG+Gyqj5Puirql 5VQjGZSgjXY61K1m9Bhb0kZPNN5GBV9RmtgBXXHvDhuh0q1LbTXfef+FH2jE1fDje/Y8 Xz3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tayBH4DB; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s198si156774pgc.586.2017.08.18.08.03.20; Fri, 18 Aug 2017 08:03:20 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=tayBH4DB; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751954AbdHRO6g (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:36 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19571 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751075AbdHRO6d (ORCPT ); Fri, 18 Aug 2017 10:58:33 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwQD9007525; Fri, 18 Aug 2017 09:58:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068306; bh=kEo13dr2jBWSxe6D7K2TQwDR1XibZPJC4SyMHn752IY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=tayBH4DBFNhv6ABYhCenznslfLhx+R3tBrAjFqLnywLmOgPne3gHseaeXDc9f2KiR bKx8maj7voksXS8G/oX4MiIbVmxSMwxvb4hfVuayIjb0CCKp4wXfvcaMj0GRNXQ+Gc 606gbSXk/HdtnctZKJvmeUwxazijDs8Sbu2IGDPk= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwQLJ002658; Fri, 18 Aug 2017 09:58:26 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:26 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:26 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:26 -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 v7IEwKjx023721; Fri, 18 Aug 2017 09:58:23 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 01/18] PCI: endpoint: pci-epc-core: Use of_dma_configure() to set initial dma mask Date: Fri, 18 Aug 2017 20:27:53 +0530 Message-ID: <20170818145810.17649-2-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use of_dma_configure() to set the initial dma mask of epf device. This helps to get rid of "Coherent DMA mask 0x0 (pfn 0x0-0x1) covers a smaller range of system memory than the DMA zone pfn" warning in certain platforms like TI's K2G resulting in coherent dma mask not being set. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epc-core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index caa7be10e473..42c2a1156325 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -370,6 +371,7 @@ EXPORT_SYMBOL_GPL(pci_epc_write_header); int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf) { unsigned long flags; + struct device *dev = epc->dev.parent; if (epf->epc) return -EBUSY; @@ -381,8 +383,12 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf) return -EINVAL; epf->epc = epc; - dma_set_coherent_mask(&epf->dev, epc->dev.coherent_dma_mask); - epf->dev.dma_mask = epc->dev.dma_mask; + if (dev->of_node) { + of_dma_configure(&epf->dev, dev->of_node); + } else { + dma_set_coherent_mask(&epf->dev, epc->dev.coherent_dma_mask); + epf->dev.dma_mask = epc->dev.dma_mask; + } spin_lock_irqsave(&epc->lock, flags); list_add_tail(&epf->list, &epc->pci_epf); @@ -500,6 +506,7 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, dma_set_coherent_mask(&epc->dev, dev->coherent_dma_mask); epc->dev.class = pci_epc_class; epc->dev.dma_mask = dev->dma_mask; + epc->dev.parent = dev; epc->ops = ops; ret = dev_set_name(&epc->dev, "%s", dev_name(dev)); From patchwork Fri Aug 18 14:57:54 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: 110398 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935039obb; Fri, 18 Aug 2017 07:58:43 -0700 (PDT) X-Received: by 10.99.190.4 with SMTP id l4mr8812843pgf.46.1503068323511; Fri, 18 Aug 2017 07:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068323; cv=none; d=google.com; s=arc-20160816; b=vnkesoRN++TbivsoJzFAUswycYOp4f5Yg3tb7LKRRihaZeCdzyfOiVM9wlBqZF8FPD 7mrAZhzKYU1PJjcO8Qy4ToCSeMLalU+Xc3Ye5n9yHxDtnk/OzrDgNZPV7yZ7ZpRunLGF vD+H/IpmZWWZl/4q7BD8N+QNp75OqcG6bR3MPTYh6jjAX/PJTnxmL1iTfcYGLd6KbrfE jz7XsRRL2ihWptIXaZpYXtOIBQ5Fu/szc8A0ewR93BYLkek7LphjVAyzNCBMSoDXNFHr OncUx2qDVZb0VUSdqIqLkTg4ihHu2SmgAbDw/nL3sBAKzG+PZXftT9yZgLg0EOid32nR pr6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ZJGL1kutuAMLPNd2CQD2VaEU0L7BApoSNJiIz/xHj/o=; b=QvIWrQbYO6kl6gJxahC2nL+lO85csA13vEJX8xdjQVzGnGYqCn9puOrDctKm21qIHj yHNwtB+bggUXXM9QZRooTZRI4XXJjxZPCTFE0sygPismXICKSfb4HNRJPw7K0R/CU36V 2/ABvhsYeZ2MC7ZccZbTUeV4D4LfDwteX/O6BHlzCO+orJ0WfUdxF1d0W1nGkqgeTg/R CnyeQ3J+c+CoIrgynwKqKiLBUSygncQAdANkGoRkGweEbOsEiWpsSy6NoIlJFtBwe2f6 ZRaPbOGezuve/ovX1TEV4CuNChMy0dKWQn3Jc1C5aQnx+Vnca1mJHA/C+m5RgV+VMaRm 8VPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PcFUfSy7; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si3996467plj.485.2017.08.18.07.58.43; Fri, 18 Aug 2017 07:58:43 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PcFUfSy7; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752167AbdHRO6j (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:39 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25675 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbdHRO6e (ORCPT ); Fri, 18 Aug 2017 10:58:34 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwTUS013876; Fri, 18 Aug 2017 09:58:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068309; bh=67nNEp1fVxtz3Uwu0aX6kFImDso7cNwQ2Tric0wbfuk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PcFUfSy7BLHM9bU4XfDjPBhEZZko0k3zvgowLoPqvaE0QuVUTGuoCXRVudlnzXdjy k9LZ/KNVS4nl77ml+Pfrm4mx8Ej2u0U47iyPLQzdqbvnNUBYdnP84dQAoGU8FZdYRu jo5IwRLWjmXhQI2gJzCvWmI77hi7GHoTMCga5/4Y= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwT5x002716; Fri, 18 Aug 2017 09:58:29 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:29 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:28 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:28 -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 v7IEwKk0023721; Fri, 18 Aug 2017 09:58:26 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 02/18] PCI: endpoint: pci-epf-core: Add an API to get matching "pci_epf_device_id" Date: Fri, 18 Aug 2017 20:27:54 +0530 Message-ID: <20170818145810.17649-3-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an API to get "pci_epf_device_id" matching the epf name. This can be used by the epf driver to get the driver data corresponding to the epf device name. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epf-core.c | 16 ++++++++++++++++ include/linux/pci-epf.h | 2 ++ 2 files changed, 18 insertions(+) -- 2.11.0 diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 6877d6a5bcc9..60ea0c51161e 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -267,6 +267,22 @@ struct pci_epf *pci_epf_create(const char *name) } EXPORT_SYMBOL_GPL(pci_epf_create); +const struct pci_epf_device_id * +pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf) +{ + if (!id || !epf) + return NULL; + + while (id) { + if (strcmp(epf->name, id->name) == 0) + return id; + id++; + } + + return NULL; +} +EXPORT_SYMBOL_GPL(pci_epf_match_device); + static void pci_epf_dev_release(struct device *dev) { struct pci_epf *epf = to_pci_epf(dev); diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 0d529cb90143..6ed63b5e106b 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -149,6 +149,8 @@ static inline void *epf_get_drvdata(struct pci_epf *epf) return dev_get_drvdata(&epf->dev); } +const struct pci_epf_device_id * +pci_epf_match_device(const struct pci_epf_device_id *id, struct pci_epf *epf); struct pci_epf *pci_epf_create(const char *name); void pci_epf_destroy(struct pci_epf *epf); int __pci_epf_register_driver(struct pci_epf_driver *driver, From patchwork Fri Aug 18 14:57:55 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: 110399 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935169obb; Fri, 18 Aug 2017 07:58:51 -0700 (PDT) X-Received: by 10.98.204.10 with SMTP id a10mr9294261pfg.332.1503068331075; Fri, 18 Aug 2017 07:58:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068331; cv=none; d=google.com; s=arc-20160816; b=iSodwKgXEbGrzE+nm/+vvsYX613LiiV52bG2b0bPb9af4K8WWe3Ha1c5+LL8AxbuEx 3vIDTp1MLcXsUhGvdDZidL0YIElNiVev3XzvCwnQIDdd3mJ42NvMkiNeaX57QAvWdvc9 gWGE04MeJU1pmuPr9TIxW85x5UkFf7YiM0tQdBaeTWxb0tpGLDzZMGl0MIZYh8XdDjl3 xsqeTDTDxXQD/GzAEnS85AtQHiaDLUKszYeBt0gZJuPnswJ8xea7W9rQ2Wf1s0Sp7mWk 7ejMQy1XmVDYM7ZDv5YEzFoMbbl8dTbG9gZvl15W5Zr0EZX90kP+86Clb7lvpJ74cSDO coEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=YMTWjWdsm/Wrxpdkfc/Y5xVAsXZH9UI0yI9xQy+UJBU=; b=du8xguSJ6smPwzewi2LisOxg1X7m3iT9t4849q6WYdzO4C8OnyYW/zO7gYZ7pbIoDu e50p2VUZtBTolsnwNTT4HQwU7rzWIn1EJKFvccRryOXK8DvP4Nd3gE0Io6dt/UykKIOT aKVNnnKd6qHxK38IGgglicoR1vHfxr3YTIf/R5+19dgMFexz4bWSEMMKaw0ameS/6dqf JRT6Kv3j1QH7ctLl2Z+EGHC31EamzfpcLdMCVwypSeFyMiTg4FhI0/KfaoHMh1rwxgp4 m8mBdB5lJWXmBvI4v9pgdsnmmN3Ns/K5t+Md2SN/y//AVesGcE/hkRT/H9i3VYQg9e5O 2+2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ybTgLEX0; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si3648674pge.639.2017.08.18.07.58.50; Fri, 18 Aug 2017 07:58:51 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ybTgLEX0; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752280AbdHRO6q (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:46 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19578 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbdHRO6k (ORCPT ); Fri, 18 Aug 2017 10:58:40 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwW7k007546; Fri, 18 Aug 2017 09:58:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068312; bh=WfLmrm5tgta8wN5sD21ZiQmst2rR1av3wcCuKTs28qE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ybTgLEX0Lc+i1IJ+smmjVbxFr5OksUS/XI/CT8wp1PW66YaQHU6sINKLJtMW4VxXz U6yjxbfnsOqPsF89+LvYCV6W/nKQe6UdVx7cY69alF261Lnm39vISakiDrzEMDgNaN vp10LtFbIqhQFB4/bPXQuOjvmkcjNGdfRrCzNZ3k= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwWKP002765; Fri, 18 Aug 2017 09:58:32 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:32 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:31 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:31 -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 v7IEwKk1023721; Fri, 18 Aug 2017 09:58:29 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 03/18] PCI: endpoint: pci-epf-core: Make ->remove() callback optional Date: Fri, 18 Aug 2017 20:27:55 +0530 Message-ID: <20170818145810.17649-4-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make ->remove() callback optional so that endpoint function drivers don't have to populate empty ->remove() callback functions. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epf-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 60ea0c51161e..ae6fac5995e3 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -333,11 +333,12 @@ static int pci_epf_device_probe(struct device *dev) static int pci_epf_device_remove(struct device *dev) { - int ret; + int ret = 0; struct pci_epf *epf = to_pci_epf(dev); struct pci_epf_driver *driver = to_pci_epf_driver(dev->driver); - ret = driver->remove(epf); + if (driver->remove) + ret = driver->remove(epf); epf->driver = NULL; return ret; From patchwork Fri Aug 18 14:57:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 110413 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp940742obb; Fri, 18 Aug 2017 08:02:42 -0700 (PDT) X-Received: by 10.84.247.15 with SMTP id n15mr10072724pll.287.1503068562154; Fri, 18 Aug 2017 08:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068562; cv=none; d=google.com; s=arc-20160816; b=VQIE6bDO1XMbZhCgLdbr+oJgK7XQSKtoKZVbMMtuTpYuKCyH1AajE34UHHFJhblvrt QCWHKx3fEoar11TEIyvX2YeipC+74s2s+GUuY8wzGCoG6Tou9MhqYrIBpEn9P8iPabMv 40fATUGQTklhNkP7Y2dGBPrteWRxqCgxn2OOSxXWdaPXvHytYr3fJZsCxkKhEKmFGi3o GX7G/S0mKaJq8i9ACqaVfhonwhidMIOZjqJDasIRC7wjLQYNsQP5Qi0IqRD3F2G+qSup Q/MhfpNzXDoKvbqLGBmyxkFK0ZXeOd+zeSEDMNLgp3p0ILrBv02dp+jiDLiQ8axK3oSU r3zQ== 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:arc-authentication-results; bh=3IGTlvcqweTZrzwfnzgI+mXLIRtZ+XMqRbmiWM7knrg=; b=nXHswqwuxO64BaAGp7iUVADKuz64bAgqxcXl/qbqTatgqbwjA8V9zwxYvUjNXigzCl FTBol+QoFf1pCRf7cgwzWOX4vuCtdpL6xwJ2oBce+tWP3snVesUwndMFU16qKSPx6IPR hAAydYIOYAUZKvRNmd5/4ffmC7bBn9FDPwO3Sz7DSZL+aQRyu7pIEgXJdhL/aismUgEs ilkhxbQJzVjTx42Pj72raPzyW9qHVPAawhIu5UXsifzuk4Za87GHJVzIQ3BRfnC57ISz wNMxroYhh8fJoDlNskqDsWysjwF8LvTnQlN1zJXp/xjj5J14u4OQlmOLbB4zKfj2PaHc 2o8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JKheMZmq; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37si4101794plg.553.2017.08.18.08.02.41; Fri, 18 Aug 2017 08:02:42 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JKheMZmq; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752249AbdHRO6n (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:43 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25681 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752172AbdHRO6k (ORCPT ); Fri, 18 Aug 2017 10:58:40 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwZSS013884; Fri, 18 Aug 2017 09:58:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068315; bh=v3Kd0UZENv6qrlNL8R0KqxP54rU8v41fz2xJEIHccr8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JKheMZmqwjk7tTkteWOvc4opwpv4cdKsakhf6FPFTeRxEBnCqjvzNVT8Knl44im2P Zydfc/bamn4gLaSY7+s7I+/s4fdHke309DOdJiR3yOXf3k+0x1WNCWq4RbLqpfnjW/ bSEzEUnZGTbeHYHoWx+LflocMl/Cfxi8aBuwA/70= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwZow012110; Fri, 18 Aug 2017 09:58:35 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:35 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:34 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:34 -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 v7IEwKk2023721; Fri, 18 Aug 2017 09:58:32 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 04/18] PCI: endpoint: pci-epc-mem: Add support for configurable page size Date: Fri, 18 Aug 2017 20:27:56 +0530 Message-ID: <20170818145810.17649-5-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci-epc-mem uses a page size equal to *PAGE_SIZE* (usually 4KB) to manage the address space. However certain platforms like TI's K2G has a restriction that this address space should be either divided into 1MB/2MB/4MB or 8MB sizes (Ref: 11.14.4.9.1 Outbound Address Translation in K2G TRM SPRUHY8F January 2016 – Revised May 2017). Add support to handle different page sizes here. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epc-mem.c | 59 ++++++++++++++++++++++++++++++++------ include/linux/pci-epc.h | 8 +++++- 2 files changed, 57 insertions(+), 10 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/pci-epc-mem.c b/drivers/pci/endpoint/pci-epc-mem.c index 3a94cc1caf22..83b7d5d3fc3e 100644 --- a/drivers/pci/endpoint/pci-epc-mem.c +++ b/drivers/pci/endpoint/pci-epc-mem.c @@ -24,21 +24,54 @@ #include /** - * pci_epc_mem_init() - initialize the pci_epc_mem structure + * pci_epc_mem_get_order() - determine the allocation order of a memory size + * @mem: address space of the endpoint controller + * @size: the size for which to get the order + * + * Reimplement get_order() for mem->page_size since the generic get_order + * always gets order with a constant PAGE_SIZE. + */ +static int pci_epc_mem_get_order(struct pci_epc_mem *mem, size_t size) +{ + int order; + unsigned int page_shift = ilog2(mem->page_size); + + size--; + size >>= page_shift; +#if BITS_PER_LONG == 32 + order = fls(size); +#else + order = fls64(size); +#endif + return order; +} + +/** + * __pci_epc_mem_init() - initialize the pci_epc_mem structure * @epc: the EPC device that invoked pci_epc_mem_init * @phys_base: the physical address of the base * @size: the size of the address space + * @page_size: size of each page * * Invoke to initialize the pci_epc_mem structure used by the * endpoint functions to allocate mapped PCI address. */ -int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_base, size_t size) +int __pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_base, size_t size, + size_t page_size) { int ret; struct pci_epc_mem *mem; unsigned long *bitmap; - int pages = size >> PAGE_SHIFT; - int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); + unsigned int page_shift; + int pages; + int bitmap_size; + + if (page_size < PAGE_SIZE) + page_size = PAGE_SIZE; + + page_shift = ilog2(page_size); + pages = size >> page_shift; + bitmap_size = BITS_TO_LONGS(pages) * sizeof(long); mem = kzalloc(sizeof(*mem), GFP_KERNEL); if (!mem) { @@ -54,6 +87,7 @@ int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_base, size_t size) mem->bitmap = bitmap; mem->phys_base = phys_base; + mem->page_size = page_size; mem->pages = pages; mem->size = size; @@ -67,7 +101,7 @@ int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_base, size_t size) err: return ret; } -EXPORT_SYMBOL_GPL(pci_epc_mem_init); +EXPORT_SYMBOL_GPL(__pci_epc_mem_init); /** * pci_epc_mem_exit() - cleanup the pci_epc_mem structure @@ -101,13 +135,17 @@ void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc, int pageno; void __iomem *virt_addr; struct pci_epc_mem *mem = epc->mem; - int order = get_order(size); + unsigned int page_shift = ilog2(mem->page_size); + int order; + + size = ALIGN(size, mem->page_size); + order = pci_epc_mem_get_order(mem, size); pageno = bitmap_find_free_region(mem->bitmap, mem->pages, order); if (pageno < 0) return NULL; - *phys_addr = mem->phys_base + (pageno << PAGE_SHIFT); + *phys_addr = mem->phys_base + (pageno << page_shift); virt_addr = ioremap(*phys_addr, size); if (!virt_addr) bitmap_release_region(mem->bitmap, pageno, order); @@ -129,11 +167,14 @@ void pci_epc_mem_free_addr(struct pci_epc *epc, phys_addr_t phys_addr, void __iomem *virt_addr, size_t size) { int pageno; - int order = get_order(size); struct pci_epc_mem *mem = epc->mem; + unsigned int page_shift = ilog2(mem->page_size); + int order; iounmap(virt_addr); - pageno = (phys_addr - mem->phys_base) >> PAGE_SHIFT; + pageno = (phys_addr - mem->phys_base) >> page_shift; + size = ALIGN(size, mem->page_size); + order = pci_epc_mem_get_order(mem, size); bitmap_release_region(mem->bitmap, pageno, order); } EXPORT_SYMBOL_GPL(pci_epc_mem_free_addr); diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index af5edbf3eea3..f7a04e1af112 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -62,11 +62,13 @@ struct pci_epc_ops { * @size: the size of the PCI address space * @bitmap: bitmap to manage the PCI address space * @pages: number of bits representing the address region + * @page_size: size of each page */ struct pci_epc_mem { phys_addr_t phys_base; size_t size; unsigned long *bitmap; + size_t page_size; int pages; }; @@ -98,6 +100,9 @@ struct pci_epc { #define devm_pci_epc_create(dev, ops) \ __devm_pci_epc_create((dev), (ops), THIS_MODULE) +#define pci_epc_mem_init(epc, phys_addr, size) \ + __pci_epc_mem_init((epc), (phys_addr), (size), PAGE_SIZE) + static inline void epc_set_drvdata(struct pci_epc *epc, void *data) { dev_set_drvdata(&epc->dev, data); @@ -135,7 +140,8 @@ void pci_epc_stop(struct pci_epc *epc); struct pci_epc *pci_epc_get(const char *epc_name); void pci_epc_put(struct pci_epc *epc); -int pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_addr, size_t size); +int __pci_epc_mem_init(struct pci_epc *epc, phys_addr_t phys_addr, size_t size, + size_t page_size); void pci_epc_mem_exit(struct pci_epc *epc); void __iomem *pci_epc_mem_alloc_addr(struct pci_epc *epc, phys_addr_t *phys_addr, size_t size); From patchwork Fri Aug 18 14:57:57 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: 110414 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp940878obb; Fri, 18 Aug 2017 08:02:47 -0700 (PDT) X-Received: by 10.98.8.65 with SMTP id c62mr6755154pfd.267.1503068567688; Fri, 18 Aug 2017 08:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068567; cv=none; d=google.com; s=arc-20160816; b=I/05/I1OVS51GauA/nq/JZLsTTmMnwkKCbB6WvqmK/1ZdWAy39sIeljCEM1dhUfYSW oW62EcmZOb3Q4u0ilBwFPfoGkUthBbf5LWhBfUCWJOvoEOJSsZJUxL05HVNghIz76jOl EUbjr04YmFLYn+frm1UScCOTd5ePU03//4us7tUluBSCnubXtENOO8e4KjKjEICHxfVV /2eTL8WMMsWS2XwPgpn7TdiZ53QPXYHGJNhUhdHF/PzXRAI6IMaEnVUoMZgmLGUUrciJ TpJBZ8eBpoGaR9DL3R/dF9A/jUpzJ8w8nvU0F4bEDXQqxck5RbS9GShUaZsgbB4YlylA +iMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=uX0uyMCufOG8b9/c8UBYPdTmoYq7a9dgxgr6LSzlg8k=; b=y9JErYuQ/5JjYvvgpEMSVSQ13jXwarw+a6vw07Sr7JP5hTrV4B0UrOy8qAwr+w/cqA T4chupjz+NtzvFvifz7q9M5yh9072F+o7SQQ374s1j/HK9Oe4U4F8CqDmv6cHBZvvwRo lmUf9u21+rFnqIff0LZjhVfcsUSOk54OlZvzOgMoqrFVu+WWz5S/T1KAHNqJI/nRqRwu l91rFq+qfoPrlGgjvlX02t3Cv51lxBr5oUjj3SRD/DNFja0VunopYc8djMgfwq9JZrYw pQLhyzHBWN8XHslq8jSVlzFBsBKktdXZEhJh5UD2Ll6+aylCrwNky452xUzF89IGaoYb hs/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t1MOUINa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m37si4101794plg.553.2017.08.18.08.02.47; Fri, 18 Aug 2017 08:02:47 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=t1MOUINa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752813AbdHRPCp (ORCPT + 26 others); Fri, 18 Aug 2017 11:02:45 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19583 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbdHRO6n (ORCPT ); Fri, 18 Aug 2017 10:58:43 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwcMq007559; Fri, 18 Aug 2017 09:58:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068318; bh=k3rKXzZcCVcNr6kT1pu3mg+aA8XcznWbkqB7CAvhhUo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=t1MOUINaJkPfcO8yKRJjIyk+aPpCNhQI8iZXtm66xdyTBe2EEVo6CD0gX9BPBKpBq z02851MQyevaqx0HZge1x9e2tEjpf4bfjffAqm8pXOI36RUQadaLtNhnhotEDvP2q2 ajlTP4UW5nhyRTx9vjDumT948cXuBwtZfJlM9jQw= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwcLW002831; Fri, 18 Aug 2017 09:58:38 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:38 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:37 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:37 -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 v7IEwKk3023721; Fri, 18 Aug 2017 09:58:35 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 05/18] PCI: endpoint: functions/pci-epf-test: Add "volatile" to pci_epf_test_reg Date: Fri, 18 Aug 2017 20:27:57 +0530 Message-ID: <20170818145810.17649-6-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org struct pci_epf_test_reg is the MEMSPACE of pci-epf-test function driver that will be accessed by the "host" for programming the pci-epf-test device. So this structure shouldn't be subjected to compiler optimization in pci_epf_test_cmd_handler() since the values can be changed by code outside the scope of current code at any time. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 53fff8030337..5cbc05a0762d 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -267,7 +267,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) cmd_handler.work); struct pci_epf *epf = epf_test->epf; struct pci_epc *epc = epf->epc; - struct pci_epf_test_reg *reg = epf_test->reg[0]; + volatile struct pci_epf_test_reg *reg = epf_test->reg[0]; if (!reg->command) goto reset_handler; From patchwork Fri Aug 18 14:57:58 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: 110400 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935222obb; Fri, 18 Aug 2017 07:58:53 -0700 (PDT) X-Received: by 10.84.164.165 with SMTP id w34mr9891350pla.119.1503068333661; Fri, 18 Aug 2017 07:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068333; cv=none; d=google.com; s=arc-20160816; b=0NTueKWxr/Ce7ux1wyhqGZYU+LvBA7zDD3xqLOjnx1g/CT1jSemWp8tU34c65fDY85 pb+oWum3jfURd/HLuKJGvWgmXeWDjP8sI8/oVZcVaF8BqWHd8wcrA/MO3++Pvl3VWUEe 1KNGf3OBtb+Ni9EZReGvmpoQ5r6ZA6ngxPe33R1gwAukSnxuw4oqPMbYwPcASSJIlnnv QryurS9E59ScVLtDac77zkT1cpf91CrRWVatFP8bLPd6jgZ4ggqfKq5DtfBcOU4xCjtH QhbRx1TrWpZST1yMqU+0amZE3IItpIdSksfrvM2z4UEl9exvxZFvQxCDHfkUlej7r2a5 4fGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=2frai0v7SicMkuvHZdESCYZRADzJy+rZU4Txh0rZkY4=; b=H3D2q7t2tF1TzL0kt8RcboKWUnkuz/jJG+B1QmE/Z6P7X4iQ7+DECeWf3qSzRBLQ+s vpUSUS3q9NIoBHHh0iPP3TNPpiwM1ztP8xvQSTULLi8Xx/1ktYmolaJtRDK20lqywi6H FpMhJKNd+GBsShaUH6Iu2jJhzf8/VZiQzTBvmMQyZvwL+nCnqTxpR+S4qY0sLLANhWvV jW4JMOH3fX5RO4dnYywi8YmNpza9y8NIYSoMDdkiorw8y1NBDoNCXR2NU84O+9oTZMp2 ZQGU3L5UILJ4t9+w3Bge/DEyPsOoB2yu8NDBZoP6RSgpBimRpmmmvSOWF4XVZFcyYwDm rmtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sMiq7nUg; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si3648674pge.639.2017.08.18.07.58.53; Fri, 18 Aug 2017 07:58:53 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=sMiq7nUg; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752337AbdHRO6t (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:49 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25694 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbdHRO6q (ORCPT ); Fri, 18 Aug 2017 10:58:46 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwfAK013896; Fri, 18 Aug 2017 09:58:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068321; bh=LCl1AleXx8b5PMOn/gtHZXNZ6zyWHiX7gwagk5IvUy4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sMiq7nUgSX3lW45aygNdAxuqtfrmZkR5ZOtEQoU4YLwPLmSFMz66WKb9rJ5/vRTGp bSfjFTfgmyzBuHA/fCm90YnUXocHk5KwnGfUSYQ4e2vHE0gw5hDQEEbmBvKNUJwzyb lDdXaKhj3vLlv0biSU2jGdfKnvtuCFh5jhU23FU0= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwePR002878; Fri, 18 Aug 2017 09:58:41 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:40 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:40 -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 v7IEwKk4023721; Fri, 18 Aug 2017 09:58:38 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 06/18] PCI: endpoint: functions/pci-epf-test: Do not reset *command* inadvertently Date: Fri, 18 Aug 2017 20:27:58 +0530 Message-ID: <20170818145810.17649-7-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci_epf_test_cmd_handler() is the delayed work function which reads *command* (set by the host) and performs various actions requested by the host periodically. If the value in *command* is '0', it goes to the reset_handler where it resets *command* to '0' and queues pci_epf_test_cmd_handler(). However if the host writes a value to the *command* just after the pci-epf-test driver checks *command* for '0' and before the control goes to reset_handler, the *command* will be reset to '0' and the pci-epf-test driver won't be able to perform the actions requested by the host. Fix it here by not resetting the *command* in the reset_handler. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/pci/endpoint/functions/pci-epf-test.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 5cbc05a0762d..1a27d7950f2c 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -263,22 +263,26 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) int ret; u8 irq; u8 msi_count; + u32 command; struct pci_epf_test *epf_test = container_of(work, struct pci_epf_test, cmd_handler.work); struct pci_epf *epf = epf_test->epf; struct pci_epc *epc = epf->epc; volatile struct pci_epf_test_reg *reg = epf_test->reg[0]; - if (!reg->command) + command = reg->command; + if (!command) goto reset_handler; - if (reg->command & COMMAND_RAISE_LEGACY_IRQ) { + reg->command = 0; + + if (command & COMMAND_RAISE_LEGACY_IRQ) { reg->status = STATUS_IRQ_RAISED; pci_epc_raise_irq(epc, PCI_EPC_IRQ_LEGACY, 0); goto reset_handler; } - if (reg->command & COMMAND_WRITE) { + if (command & COMMAND_WRITE) { ret = pci_epf_test_write(epf_test); if (ret) reg->status |= STATUS_WRITE_FAIL; @@ -288,7 +292,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) goto reset_handler; } - if (reg->command & COMMAND_READ) { + if (command & COMMAND_READ) { ret = pci_epf_test_read(epf_test); if (!ret) reg->status |= STATUS_READ_SUCCESS; @@ -298,7 +302,7 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) goto reset_handler; } - if (reg->command & COMMAND_COPY) { + if (command & COMMAND_COPY) { ret = pci_epf_test_copy(epf_test); if (!ret) reg->status |= STATUS_COPY_SUCCESS; @@ -308,9 +312,9 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) goto reset_handler; } - if (reg->command & COMMAND_RAISE_MSI_IRQ) { + if (command & COMMAND_RAISE_MSI_IRQ) { msi_count = pci_epc_get_msi(epc); - irq = (reg->command & MSI_NUMBER_MASK) >> MSI_NUMBER_SHIFT; + irq = (command & MSI_NUMBER_MASK) >> MSI_NUMBER_SHIFT; if (irq > msi_count || msi_count <= 0) goto reset_handler; reg->status = STATUS_IRQ_RAISED; @@ -319,8 +323,6 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) } reset_handler: - reg->command = 0; - queue_delayed_work(kpcitest_workqueue, &epf_test->cmd_handler, msecs_to_jiffies(1)); } From patchwork Fri Aug 18 14:57:59 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: 110407 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp936244obb; Fri, 18 Aug 2017 07:59:49 -0700 (PDT) X-Received: by 10.99.105.201 with SMTP id e192mr8462151pgc.158.1503068389464; Fri, 18 Aug 2017 07:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068389; cv=none; d=google.com; s=arc-20160816; b=aw8ltBV3anqxfcZgKOw0f4kNyXNM6tg9CIZwTuWJj+KozfqdZ1yuKkrU2au77E6a2y 0Euo3ThZLJwna9JZILvP88s8gZ4fF8AZSlBaHlPvhPQPLUJvWcdATc/nsuYnDLawwctU EsErGmNmEnkebHen+y+aC/WiAgv+xHbMTej9Xyljc5zFA9qLHFxOBtaR2RqGQg5tSKLr LqHoZDJWvy7wpjR308bHKED1NuG6ABPJyjPiV+EKvrdsx/XDVh7L6DsgoxBYZNaFDev+ ylVpXw9K7c0FaHE1c2lHBybeP+36U0gmL/ItdQ9z+pBZvZIe6dvInxZ0bOryJIG71e6B ygIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=tr7OjzIgvX3Fq3WlP+1dfudu+Dj+73IizhM7RpuW0CE=; b=TkzUcNL4yF5aWkLqH1Fzyg92Jotrz5i4EE632aR+EKonMnBseikxnNc9+Vhi+wIFqp ytnsVaO+cWxANcYOtxN6nsezEHzaAD2gTKSLkLBhHIR2kKXmw2uwCgooerZS85W3hPeQ jlyqzuTUFQ6C/Sk7ahIrrgOcq1oOlVMvjQr71M/SLMYC9JrsAirb75cMlaDY2W2k+Hgo YMVFi5jCvnNxyo52WVC7ZaKj08bmIQbTEQiVzADfCJ1+R6LDLxjoXF0ayovWUzHP1Ee2 NtccfVH4d/TXx/c81Gum1t27JN3/AWGFAE6ijog3KXDnvm6bcmRZYJOqKHZk0U80UuqG WAZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PIlkYBI9; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8si3778185pfj.74.2017.08.18.07.59.49; Fri, 18 Aug 2017 07:59:49 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PIlkYBI9; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752691AbdHRO7q (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:46 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:64888 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbdHRO7o (ORCPT ); Fri, 18 Aug 2017 10:59:44 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwmtu018532; Fri, 18 Aug 2017 09:58:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068328; bh=VSdcaJJrk83jd59PAcRfeWUYhUGFbGSwoMUo+BATaq0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=PIlkYBI9oYLarmyYOcE7xRCNNe8J0iU34FJkb1pJpAmw3polN+IR1wUho+WI1WyiM i/OimbJbupkMdR7azzEwPG83h80uAZ4DQ6QSzjgAjWHHgkt+zFRm6LkWMZiX8HCMuX Syz3jN+v82so3PJlZF652JvjJrceGUF+P90kkp5c= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwha1012224; Fri, 18 Aug 2017 09:58:43 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:43 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:43 -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 v7IEwKk5023721; Fri, 18 Aug 2017 09:58:41 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 07/18] PCI: endpoint: functions/pci-epf-test: Add support to use _any_ BAR's to map PCI_ENDPOINT_TEST regs Date: Fri, 18 Aug 2017 20:27:59 +0530 Message-ID: <20170818145810.17649-8-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci_epf_test always maps the PCI_ENDPOINT_TEST registers to BAR_0. But if BAR_0 is reserved for some other purpose (like in TI's K2G BAR_0 is mapped to application registers and cannot be used to map any other regions), PCI_ENDPOINT_TEST registers cannot be mapped making pci_epf_test unusable. Add support to use any BAR's to map PCI_ENDPOINT_TEST registers. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 60 +++++++++++++++++++-------- 1 file changed, 42 insertions(+), 18 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 1a27d7950f2c..e378dae9e510 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -54,6 +54,7 @@ static struct workqueue_struct *kpcitest_workqueue; struct pci_epf_test { void *reg[6]; struct pci_epf *epf; + enum pci_barno test_reg_bar; struct delayed_work cmd_handler; }; @@ -74,7 +75,11 @@ static struct pci_epf_header test_header = { .interrupt_pin = PCI_INTERRUPT_INTA, }; -static int bar_size[] = { 512, 1024, 16384, 131072, 1048576 }; +struct pci_epf_test_data { + enum pci_barno test_reg_bar; +}; + +static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; static int pci_epf_test_copy(struct pci_epf_test *epf_test) { @@ -86,7 +91,8 @@ static int pci_epf_test_copy(struct pci_epf_test *epf_test) struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; struct pci_epc *epc = epf->epc; - struct pci_epf_test_reg *reg = epf_test->reg[0]; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; + struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar]; src_addr = pci_epc_mem_alloc_addr(epc, &src_phys_addr, reg->size); if (!src_addr) { @@ -145,7 +151,8 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test) struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; struct pci_epc *epc = epf->epc; - struct pci_epf_test_reg *reg = epf_test->reg[0]; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; + struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar]; src_addr = pci_epc_mem_alloc_addr(epc, &phys_addr, reg->size); if (!src_addr) { @@ -195,7 +202,8 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test) struct pci_epf *epf = epf_test->epf; struct device *dev = &epf->dev; struct pci_epc *epc = epf->epc; - struct pci_epf_test_reg *reg = epf_test->reg[0]; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; + struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar]; dst_addr = pci_epc_mem_alloc_addr(epc, &phys_addr, reg->size); if (!dst_addr) { @@ -247,7 +255,8 @@ static void pci_epf_test_raise_irq(struct pci_epf_test *epf_test) u8 msi_count; struct pci_epf *epf = epf_test->epf; struct pci_epc *epc = epf->epc; - struct pci_epf_test_reg *reg = epf_test->reg[0]; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; + struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar]; reg->status |= STATUS_IRQ_RAISED; msi_count = pci_epc_get_msi(epc); @@ -268,13 +277,15 @@ static void pci_epf_test_cmd_handler(struct work_struct *work) cmd_handler.work); struct pci_epf *epf = epf_test->epf; struct pci_epc *epc = epf->epc; - volatile struct pci_epf_test_reg *reg = epf_test->reg[0]; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; + struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar]; command = reg->command; if (!command) goto reset_handler; reg->command = 0; + reg->status = 0; if (command & COMMAND_RAISE_LEGACY_IRQ) { reg->status = STATUS_IRQ_RAISED; @@ -360,6 +371,7 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) struct pci_epc *epc = epf->epc; struct device *dev = &epf->dev; struct pci_epf_test *epf_test = epf_get_drvdata(epf); + enum pci_barno test_reg_bar = epf_test->test_reg_bar; flags = PCI_BASE_ADDRESS_SPACE_MEMORY | PCI_BASE_ADDRESS_MEM_TYPE_32; if (sizeof(dma_addr_t) == 0x8) @@ -372,7 +384,7 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) if (ret) { pci_epf_free_space(epf, epf_test->reg[bar], bar); dev_err(dev, "failed to set BAR%d\n", bar); - if (bar == BAR_0) + if (bar == test_reg_bar) return ret; } } @@ -386,17 +398,20 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) struct device *dev = &epf->dev; void *base; int bar; + enum pci_barno test_reg_bar = epf_test->test_reg_bar; base = pci_epf_alloc_space(epf, sizeof(struct pci_epf_test_reg), - BAR_0); + test_reg_bar); if (!base) { dev_err(dev, "failed to allocated register space\n"); return -ENOMEM; } - epf_test->reg[0] = base; + epf_test->reg[test_reg_bar] = base; - for (bar = BAR_1; bar <= BAR_5; bar++) { - base = pci_epf_alloc_space(epf, bar_size[bar - 1], bar); + for (bar = BAR_0; bar <= BAR_5; bar++) { + if (bar == test_reg_bar) + continue; + base = pci_epf_alloc_space(epf, bar_size[bar], bar); if (!base) dev_err(dev, "failed to allocate space for BAR%d\n", bar); @@ -437,10 +452,25 @@ static int pci_epf_test_bind(struct pci_epf *epf) return 0; } +static const struct pci_epf_device_id pci_epf_test_ids[] = { + { + .name = "pci_epf_test", + }, + {}, +}; + static int pci_epf_test_probe(struct pci_epf *epf) { struct pci_epf_test *epf_test; struct device *dev = &epf->dev; + const struct pci_epf_device_id *match; + struct pci_epf_test_data *data; + enum pci_barno test_reg_bar = BAR_0; + + match = pci_epf_match_device(pci_epf_test_ids, epf); + data = (struct pci_epf_test_data *)match->driver_data; + if (data) + test_reg_bar = data->test_reg_bar; epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL); if (!epf_test) @@ -448,6 +478,7 @@ static int pci_epf_test_probe(struct pci_epf *epf) epf->header = &test_header; epf_test->epf = epf; + epf_test->test_reg_bar = test_reg_bar; INIT_DELAYED_WORK(&epf_test->cmd_handler, pci_epf_test_cmd_handler); @@ -469,13 +500,6 @@ static struct pci_epf_ops ops = { .linkup = pci_epf_test_linkup, }; -static const struct pci_epf_device_id pci_epf_test_ids[] = { - { - .name = "pci_epf_test", - }, - {}, -}; - static struct pci_epf_driver test_driver = { .driver.name = "pci_epf_test", .probe = pci_epf_test_probe, From patchwork Fri Aug 18 14:58:00 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: 110401 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935275obb; Fri, 18 Aug 2017 07:58:56 -0700 (PDT) X-Received: by 10.84.209.172 with SMTP id y41mr9880480plh.61.1503068336279; Fri, 18 Aug 2017 07:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068336; cv=none; d=google.com; s=arc-20160816; b=OFRKPQRXW6xjV1VpibialmiAaRPsiV0r9Hr3wsFEkZwJjVAgoxnuhRmNZRFESnZklG h11KotLF7CebfuIxDVhbMf7iyoN3Ovvi1wcZJwTJnixzs9rN48UoY1xBNDTdNJ6yWjso g0S7FPpjx7WiFOtd+Upj+pj2H2wyTb3Qhpss6FbADaMRrGAk9mu2pKPmX9DiWXLzX0UG gIDkWte4P/qoMm04tNqYVIYX0a4TstCoQJwFpoZXg4AeIt0COqik8NnITNBH5MKOxBq1 ASbwTxHrU0Ve3ZBqlbPsAkgoMjElYP/didSWj2f66DH1EW6e7akPZwg/TIX5J9RGx/EH Ny2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=mDvR6N2xC92PbapfKy11QiOHSTKEGrjoHQTwd9JvwrM=; b=ZxGfCRSqfMKPw8Ya05Zcf/uUXwN2FJ29O27ZhocDwaWF/pimrC+1cifL8+yJyXTA2N FDZNGSbXfdFhkXkb0XLez1HR1AWM2K6dNuhLj7mqLwsjrjft76CsN7FdAq/8kzoyVu+k lQmoajhsdOAJ8Q5HD2bWTCji3/NHinIA69MKsW9OT9Ij72a5NiskU8o8S7zc5xNwy0Bv cdcphDY3veZeLSNQ7Dt4+bksUVFGuw+wLxAsoQ38kz3K39Y0FZZrJBw7vNbbF2LwdKKm 2It38BWTOAfsaU6p5i9M0PrEOzQ8Vc8sd7Zt6BHoSH58EKyA4vawPRNQs0gxhy792kpy rNnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=S8JtawFC; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si3741542pfa.458.2017.08.18.07.58.55; Fri, 18 Aug 2017 07:58:56 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=S8JtawFC; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752393AbdHRO6x (ORCPT + 26 others); Fri, 18 Aug 2017 10:58:53 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19592 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752111AbdHRO6u (ORCPT ); Fri, 18 Aug 2017 10:58:50 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwkGC007580; Fri, 18 Aug 2017 09:58:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068326; bh=zBftX7ZvIAf+i70hp3Jw7XcMnCyb8BxxQfhrLkcgMow=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=S8JtawFCimrpGQmUQjmRccPzoVZ/RdquSMQ4zZY+BgMpwsOdMzB2g0cK2h33qaqVF IjToSrMHQGM/hsXvDBhByKHrEEWfraoo6ghRuMvoUU4kErOgRmKM/3ZEN2ClFUQ/vs pjjbDvxrIZE/mkcGwA7jPSnUib8SjH2B4mT9Bk6Y= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwkAp012250; Fri, 18 Aug 2017 09:58:46 -0500 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:46 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:46 -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 v7IEwKk6023721; Fri, 18 Aug 2017 09:58:44 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 08/18] PCI: endpoint: functions/pci-epf-test: Add support to poll early for host commands Date: Fri, 18 Aug 2017 20:28:00 +0530 Message-ID: <20170818145810.17649-9-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Certain platforms like TI's K2G doesn't support link-up notification. Add support to poll early (without waiting for the linkup notification) for commands from the host. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index e378dae9e510..a0aea2500690 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -55,6 +55,7 @@ struct pci_epf_test { void *reg[6]; struct pci_epf *epf; enum pci_barno test_reg_bar; + bool linkup_notifier; struct delayed_work cmd_handler; }; @@ -77,6 +78,7 @@ static struct pci_epf_header test_header = { struct pci_epf_test_data { enum pci_barno test_reg_bar; + bool linkup_notifier; }; static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; @@ -424,6 +426,7 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) static int pci_epf_test_bind(struct pci_epf *epf) { int ret; + struct pci_epf_test *epf_test = epf_get_drvdata(epf); struct pci_epf_header *header = epf->header; struct pci_epc *epc = epf->epc; struct device *dev = &epf->dev; @@ -449,6 +452,9 @@ static int pci_epf_test_bind(struct pci_epf *epf) if (ret) return ret; + if (!epf_test->linkup_notifier) + queue_work(kpcitest_workqueue, &epf_test->cmd_handler.work); + return 0; } @@ -466,11 +472,14 @@ static int pci_epf_test_probe(struct pci_epf *epf) const struct pci_epf_device_id *match; struct pci_epf_test_data *data; enum pci_barno test_reg_bar = BAR_0; + bool linkup_notifier = true; match = pci_epf_match_device(pci_epf_test_ids, epf); data = (struct pci_epf_test_data *)match->driver_data; - if (data) + if (data) { test_reg_bar = data->test_reg_bar; + linkup_notifier = data->linkup_notifier; + } epf_test = devm_kzalloc(dev, sizeof(*epf_test), GFP_KERNEL); if (!epf_test) @@ -479,6 +488,7 @@ static int pci_epf_test_probe(struct pci_epf *epf) epf->header = &test_header; epf_test->epf = epf; epf_test->test_reg_bar = test_reg_bar; + epf_test->linkup_notifier = linkup_notifier; INIT_DELAYED_WORK(&epf_test->cmd_handler, pci_epf_test_cmd_handler); From patchwork Fri Aug 18 14:58:01 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: 110402 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935461obb; Fri, 18 Aug 2017 07:59:07 -0700 (PDT) X-Received: by 10.99.67.194 with SMTP id q185mr5886612pga.77.1503068347416; Fri, 18 Aug 2017 07:59:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068347; cv=none; d=google.com; s=arc-20160816; b=bgI0m8oV6okdGGGbKfbU9GQpJCyvjd18hm3NBaQqRLAUSpExnzybj52epIBcKJy8aI U1GadjWTmMF3XEvcWfkdMpnNgfxCeF4zvzgiVqJrOvmore3P2XF3G9XdmkVpEXaAM6Jn L1HOh+CoTctGFMHSuS+2RsC6ByPpIlKQON3WifYlX+5O8EzCHxiUiuQzdmuzeps1O1Le tZLe/5SiRygT5aeznEcsQ2PWtc7Hj43xdF2pasWVTgzzCJOkzS5Rb3RoIRhe+TTfxuPW VbZxkPu39cuqu7mMsFZ0JAXWgmi7/4pnZ6NHOmQ2WRQV6Z50uatPO1PDRRpkfzVeeha7 EGAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Qb/+YdlUn8a2xOpagopMtreZgTRViMiIacc5Sj31gjM=; b=rkHeYx8ty00m0l8uMi84cpmFTxtvDaZsdYASdck348ibWG4r+B3O+AdN0mQBicwQO5 sB1BYrxiTPBdoi+IYdDQncZ7e4cct3vIWpZcH5svwQbTb0cqXinarIH20gqDS2opK5bb 3Tsbih/gILy8SW7u3dam0fggsQtXne+YZPgADyvmfAOK0erYUCCpuKKswwSJ0gzzjnXu EzOlpeVD834jU0uE93I2riqJzhI9B+7oilMyXlSf5lhKq8tLmqqahiB/VeofDr4BvZfG MWoZFt0KIsgFQpCmb1Fxt1gboaO4L2yd4Ztn6NzjjvCC1mKW28wrEy+cdwA8yWmfGfdk 9x+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=x+rr/Dzi; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q20si3741542pfa.458.2017.08.18.07.59.07; Fri, 18 Aug 2017 07:59:07 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=x+rr/Dzi; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752517AbdHRO7E (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:04 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25722 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbdHRO7A (ORCPT ); Fri, 18 Aug 2017 10:59:00 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwoVL013926; Fri, 18 Aug 2017 09:58:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068330; bh=cMrrph7sbGy5d3xe+WD7NVUrGgvDor29aUvPvrSODJE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=x+rr/DzibISZSgiGzjVCVKrnd0jmTeT6bcAGPNKL1VTk5uP9hBpBXD1prxobO2me7 fs6EUvQ/bsehXv4lg9kCUIw3sVHzKkW/SOZliVJ/7jAWWRWg+k0WkesgMWiZ60N5Fy VIOQFhSQqwawjMx4AuBA5is4tRrycGZtOa/2pBhU= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwoaP012284; Fri, 18 Aug 2017 09:58:50 -0500 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:49 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:49 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:49 -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 v7IEwKk7023721; Fri, 18 Aug 2017 09:58:46 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , , Shawn Lin Subject: [PATCH 09/18] PCI: endpoint: functions/pci-epf-test: Remove the ->remove() callback Date: Fri, 18 Aug 2017 20:28:01 +0530 Message-ID: <20170818145810.17649-10-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shawn Lin epf_test is allocated using devm_kzalloc. Hence it's not required to explicitly free it in remove() callback. Since ->remove() callback doesn't do anything other than freeing epf_test, remove the ->remove() callback. Signed-off-by: Shawn Lin Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 9 --------- 1 file changed, 9 deletions(-) -- 2.11.0 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index a0aea2500690..4ddc6e8f9fe7 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -496,14 +496,6 @@ static int pci_epf_test_probe(struct pci_epf *epf) return 0; } -static int pci_epf_test_remove(struct pci_epf *epf) -{ - struct pci_epf_test *epf_test = epf_get_drvdata(epf); - - kfree(epf_test); - return 0; -} - static struct pci_epf_ops ops = { .unbind = pci_epf_test_unbind, .bind = pci_epf_test_bind, @@ -513,7 +505,6 @@ static struct pci_epf_ops ops = { static struct pci_epf_driver test_driver = { .driver.name = "pci_epf_test", .probe = pci_epf_test_probe, - .remove = pci_epf_test_remove, .id_table = pci_epf_test_ids, .ops = &ops, .owner = THIS_MODULE, From patchwork Fri Aug 18 14:58:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 110408 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp936427obb; Fri, 18 Aug 2017 07:59:59 -0700 (PDT) X-Received: by 10.84.137.1 with SMTP id 1mr9991130plm.75.1503068399883; Fri, 18 Aug 2017 07:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068399; cv=none; d=google.com; s=arc-20160816; b=YkDkPz+eY2/VD+rjCpc4bToG1eTztK0+hTKtug+WkpzFEfV1G7/q4fqSBl6eXFEl1J HAaJp4F8sZynufXBipvGIl4qTcrvzTrEoCqF1dUqQeeelBitgDwWx/pJVWSVCyyECueV ZZBGnwUSOVtbhxQBDEZJ6UGjSYosgU7bmCttKW/oqDQpNj+0E00wfCvJbko5oMBWpKUf WX4p4941hz93wfPKqGNCgYvmjQlmaF1eWVlR5zGJmWl2S7rAK/DOpIP+m22UncZg50NY 1884Bnq/KbLSDw1GkrjNBlaWMTxlgQ6vcXrB4ay9z04UoaPvWuGSCiXJNoleAklgxcz4 5q7w== 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:arc-authentication-results; bh=6U1lBUN5OYPIKEN6R2bKzpnQTib0V2TQcg14Vf5WVBA=; b=CVL3ATA5qyUY1g7jgore1rrFfWg4VJOTi5JmYoe3KttAiKN3yzUFgL+WdO7OOLUCv3 tSOQLjYyE7mXVMytwpJ9aB59ZgcbLWBhV7nMqQ3Do8k5TentpzCeckFWREHCmCfL0bRq 0wdSt1g5fCR6xKZpkJ9RlyqM/AvDnmDRqiegXTXuoXYlobRKdBWJ5cvz0S/UQNwtKRHA dwMCry/EePljYQSt22r6bl2h83eQbErxXK1GoTWEnn2nskYz82+MLP1n/A1sYAl4xW+/ vbQnfTaIE1gSlnyu9fZ5Or4B9VAoccxujlzaaYOG68QKLoZqQCOxCMXlILn0NFe0o768 aFgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=C7nuD7q/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e27si3742620pfm.688.2017.08.18.07.59.59; Fri, 18 Aug 2017 07:59:59 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=C7nuD7q/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716AbdHRO74 (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:56 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:64895 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752664AbdHRO7y (ORCPT ); Fri, 18 Aug 2017 10:59:54 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwwp5018543; Fri, 18 Aug 2017 09:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068338; bh=k+Qf6hTs10uRkl4RTe2sZSPtEIFmTnY07XMQiyDMfEg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=C7nuD7q/c+cMOmO3FRSXcDi7zJanQfNPDLtqNlXgDIQ7tE3wb4GDZHsHz2OvpNAQC HIjSsGA17QflAFBqwv+gUZwRF0E7TeytpFS09aoyXIlNhnR4lQG1WE7FRu0/6fam5l i4hkQBFbVu7zSVLreF1KE4um5PC26pqj/rcBdLgc= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwrQE003017; Fri, 18 Aug 2017 09:58:53 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:52 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) 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; Fri, 18 Aug 2017 09:58:52 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:52 -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 v7IEwKk8023721; Fri, 18 Aug 2017 09:58:50 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 10/18] PCI: dwc: designware: Provide page_size to pci_epc_mem Date: Fri, 18 Aug 2017 20:28:02 +0530 Message-ID: <20170818145810.17649-11-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the newly introduced __pci_epc_mem_init instead of pci_epc_mem_init to provide page_size to pci_epc_mem. This is in preparation for adding EP support to K2G which has a restriction that the address region should be either divided into 1MB/2MB/4MB or 8MB sizes (Ref: 11.14.4.9.1 Outbound Address Translation in K2G TRM SPRUHY8F January 2016 – Revised May 2017). Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/dwc/pcie-designware-ep.c | 3 ++- drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index 398406393f37..e70ebe3b9b6f 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -328,7 +328,8 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) if (ret < 0) epc->max_functions = 1; - ret = pci_epc_mem_init(epc, ep->phys_base, ep->addr_size); + ret = __pci_epc_mem_init(epc, ep->phys_base, ep->addr_size, + ep->page_size); if (ret < 0) { dev_err(dev, "Failed to initialize address space\n"); return ret; diff --git a/drivers/pci/dwc/pcie-designware.h b/drivers/pci/dwc/pcie-designware.h index b4d2a89f8e58..714f6f21ea93 100644 --- a/drivers/pci/dwc/pcie-designware.h +++ b/drivers/pci/dwc/pcie-designware.h @@ -186,6 +186,7 @@ struct dw_pcie_ep { struct dw_pcie_ep_ops *ops; phys_addr_t phys_base; size_t addr_size; + size_t page_size; u8 bar_to_atu[6]; phys_addr_t *outbound_addr; unsigned long ib_window_map; From patchwork Fri Aug 18 14:58:03 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: 110411 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp939047obb; Fri, 18 Aug 2017 08:01:40 -0700 (PDT) X-Received: by 10.99.110.1 with SMTP id j1mr8682582pgc.218.1503068500754; Fri, 18 Aug 2017 08:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068500; cv=none; d=google.com; s=arc-20160816; b=QA8K5ZSIbY4XFhn6B9tjjWQlWDD5iAuiKukXr9rz3kYI4Dtvy0bED49ce2Q/ZuiJ5+ 6zJSsJZ+cHX5rvgojRzYzqJi4IwDIgN59xYsdVzR7ckjxpIBzaDUW6IXcpIn4QQ+3elR FC4/kznlzR3rWdDJQ87bheKVbcsTzZ34fQVIrTZBI7E3aHeghyRxLVSHYwqiwPnWis+g lUZWVYOr1vQvm8Qx2e+2SmF+0ac896urrd/oD3hX3fz67/B+SUNrSg55RcPYlacRjp2C GyGYcTAV5naCzHWShTjZXwHoeCPGXU7KwLNTIkzdt4f0WCEYIkw7lOoxMqFysyi3N4Ym ODYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=g/tFayMdLxwm1mZK08I61vJxCNVNSgcz1MBYYGSaK3Y=; b=e50cs7YXhxXR+0fXC3zGN2MzT+qSckpp61n7C0crTCygqECGACruDWWcF1VCkd5C3l 7Y9UBT0rO1Z9tmb6sLYNTWt6B0OOs0fYgW7FuEi+zTHylypfIgSawGIGIaz/jFu2lo/A OpqNu6I/ws79umkQv2Gqcf6mlck6lpy5qWX3TmehBMahgnBccqHexUA10I8TrQGqqcm1 MekR0y05g6+ydCz3uS/6Kmo4vtVuaSSBe7TdpEWZSKWuwCkjOwCmDF5GU8xDokmJIVBo PO6hYg4F8YYeuVd35UYAhUgxS48AXshRV3MRVKP5gW4Oca6QOdfewgPwx6enLh+SfI00 gXYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=exzUB8q+; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190si3735449pfa.691.2017.08.18.08.01.40; Fri, 18 Aug 2017 08:01:40 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=exzUB8q+; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752466AbdHRO7D (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:03 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25723 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752115AbdHRO7A (ORCPT ); Fri, 18 Aug 2017 10:59:00 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwtBC013939; Fri, 18 Aug 2017 09:58:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068335; bh=szPdfEMR28SE0YiKjXg/GN9NSnBS6QKKOM2MFGAN9qg=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=exzUB8q+H95N/FgWTTeVKV3KwqbgKFWU1ALxDvOpVGSSdBy6Lc76q7+ST/0vDuZ4L 4R2P+3ep5FG2H+PDpZi7YrLoyIQNYYlNLtZZDxRQtgx0e9rqMZJdoruNjPxTgDNPSj 4MQs5214w2oGQpCvDAGly4SapXnVcsv5fUSlNGeI= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwtPA003044; Fri, 18 Aug 2017 09:58:55 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:55 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:55 -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 v7IEwKk9023721; Fri, 18 Aug 2017 09:58:52 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 11/18] PCI: dwc: dra7xx: Reset all BARs during initialization Date: Fri, 18 Aug 2017 20:28:03 +0530 Message-ID: <20170818145810.17649-12-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dra7xx has all base address registers (BAR) enabled by default. Reset all BARs during initialization and so that BARs are enabled only if they are actually used. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/dwc/pci-dra7xx.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.11.0 diff --git a/drivers/pci/dwc/pci-dra7xx.c b/drivers/pci/dwc/pci-dra7xx.c index f2fc5f47064e..ee61f833b62c 100644 --- a/drivers/pci/dwc/pci-dra7xx.c +++ b/drivers/pci/dwc/pci-dra7xx.c @@ -335,10 +335,23 @@ static irqreturn_t dra7xx_pcie_irq_handler(int irq, void *arg) return IRQ_HANDLED; } +static void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) +{ + u32 reg; + + reg = PCI_BASE_ADDRESS_0 + (4 * bar); + dw_pcie_writel_dbi2(pci, reg, 0x0); + dw_pcie_writel_dbi(pci, reg, 0x0); +} + static void dra7xx_pcie_ep_init(struct dw_pcie_ep *ep) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci); + enum pci_barno bar; + + for (bar = BAR_0; bar <= BAR_5; bar++) + dw_pcie_ep_reset_bar(pci, bar); dra7xx_pcie_enable_wrapper_interrupts(dra7xx); } From patchwork Fri Aug 18 14:58:04 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: 110412 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp939368obb; Fri, 18 Aug 2017 08:01:53 -0700 (PDT) X-Received: by 10.99.126.69 with SMTP id o5mr8958346pgn.2.1503068513829; Fri, 18 Aug 2017 08:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068513; cv=none; d=google.com; s=arc-20160816; b=Yi1D1yh1yiwLEmZX3kjSShWVHvN6DZvbfRJyMonNJIdL9Xu2QcIotXBsCRJyQ/WKKA yn2hKhKkfdgDZXoHFNm9yft4uYQ6qjdf3MKbRnnn4ElNNgPMMIg8FdeBfE6H4XB0PbB9 ngLdCVbkbeMwqvOpLlgQiMvPHkjU5r423vDvS66MJmmtRT9tLbzSSGQ/J2RKhgOi/FCD irFPCwmbQ1zVBQZLz3ASsZsh8G7gO4xrAD7kcrKwIP52dj2Tc0kM9Jn0VgEt2tqh+A9u e8R5uqTCLVS87cftYBhWnJA0oJZ0IZMNHnJAofLF707/uA+sxFMO+VLtE6e6SsZtoTx1 O8HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=9C/2I1ezyvepFU3mWiWfyAGeZoxBJaQsf6quWTIcJpM=; b=fF52juxqDz4wsPoWKcUPqoM4FhPoV35W0QdKAUQhiHrQBd61/WrpGo7NX3lmTL4PdN rr+ZxaQmJiOpcOLOr+EgFOL2jKcitfGvZmbgxn4sh1KLkrXabgl5e9j3IOmk6SE3QG6+ d4FXUNnXQtutrShyU1WJgiGV720MVT80BmmtUR8rn97TqDSo4eEDLA9O5k1B9KR4+tOG 3IXOJfhuQJcxJHR5B/Q0VJ+gDEY/zFPntL3xNU9Ey2n95FfjattIwME6ulOTDleY5zmi uff57micA1TqOhLtec/B3c2/xypCRtC8XOR8DZyLCKpc+vev042wNxklDHZIsOK4p2gq KDIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wWQNC1/6; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t11si3625368pgo.694.2017.08.18.08.01.53; Fri, 18 Aug 2017 08:01:53 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=wWQNC1/6; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752636AbdHRPBv (ORCPT + 26 others); Fri, 18 Aug 2017 11:01:51 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25728 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbdHRO7C (ORCPT ); Fri, 18 Aug 2017 10:59:02 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEwwjw013947; Fri, 18 Aug 2017 09:58:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068338; bh=9sGw+UyyJSby0H3tFB6DM9gaQQK3WCK4w8X8TDWskJU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wWQNC1/6/g0+3PNXQRs4D7TTQ7lBVGdNS+JuDa4Q1KSqNgHfVo4oyt6w7CRnrUpC3 PICYFD4KRSXcRXfGTrIfMaJ1nXtk6CLQoCEr0tR+egD4pFX7wMJJjcU2gRtI/D3MNN J5gjRTGQl4GeK6uBy+8wUAOlPW/xZaOASOYY1bmw= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEwwoF012393; Fri, 18 Aug 2017 09:58:58 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:58 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:58:58 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:58:58 -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 v7IEwKkA023721; Fri, 18 Aug 2017 09:58:55 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 12/18] PCI: dwc: designware-ep: Do not disable BARs during initialization Date: Fri, 18 Aug 2017 20:28:04 +0530 Message-ID: <20170818145810.17649-13-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms like K2G has reserved use of BAR_0 which shouldn't be disabled by software. Avoid disabling all BARs during initialization. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/dwc/pcie-designware-ep.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.11.0 diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c index e70ebe3b9b6f..b3205df38d52 100644 --- a/drivers/pci/dwc/pcie-designware-ep.c +++ b/drivers/pci/dwc/pcie-designware-ep.c @@ -283,7 +283,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) { int ret; void *addr; - enum pci_barno bar; struct pci_epc *epc; struct dw_pcie *pci = to_dw_pcie_from_ep(ep); struct device *dev = pci->dev; @@ -312,9 +311,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) return -ENOMEM; ep->outbound_addr = addr; - for (bar = BAR_0; bar <= BAR_5; bar++) - dw_pcie_ep_reset_bar(pci, bar); - if (ep->ops->ep_init) ep->ops->ep_init(ep); From patchwork Fri Aug 18 14:58:05 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: 110403 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935597obb; Fri, 18 Aug 2017 07:59:15 -0700 (PDT) X-Received: by 10.98.82.2 with SMTP id g2mr8986762pfb.308.1503068355196; Fri, 18 Aug 2017 07:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068355; cv=none; d=google.com; s=arc-20160816; b=IKE/nLdpdpuVfrpc2QKXbEk4SDLa6pREcAKQp5x5EmWmdyupMF/mn9Mhhg8soLLbT3 NkY9WcH2xu8LRJYFvliWC4eDM1dA1zbMj5m/3Qv3YMnO2JDH6PEKxBBpEVrVmGryno+P 65PmUH9b7SNRqBmYsym2Jl6pUiGXg7NolbpxNHGeow5KjSq/a+N0qgx21LGFFH7tZoLV Vt5apcDTAjtGol4DLCWnqFALtpltvvjxzLDBaPgyo6JjDNklccZM4jsvmVCB5CtUzevT cy7ZQmolQw70i834VxF1nli59bQKFfhOTETjlRfUkiTToXd/fv/6QkpOdjC8wuUjxoj7 7SHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=NK0xdGOpzSl7EGSu23qE9UNE67ae4dT9poQ+QKtPVsA=; b=aJUnwag1uoILPd1nudDrXmDVN9CmjmzYOH4PeMpR0HYmeqvQeId/8B3SezW+h6bx2+ TeeYd8iHC4RF2D6riKAsQ3S36pcO4ejEiKxssFm3D5R9gk46CPiXdzhP8tNmOiHVbP6M ehYBU6iHg6TR1R+wqdKoIfabFtmhWJ7Vz1OCouAeBZhklOcdtcNoIj1B9Csw9VVDvI1U F8WMuHzSEGLmKCWc+3Aa68+RIVYm9KS0W6hn0L5Rp1g8kBET2uF6PHOSp+m0S4x830X1 jn6ZR53G3D7X4jxNk50FjS1LK/bfXWFbRnGde+iQgcxNyRrONjuc9GQlCi2LBMEU6fTb iT8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZoAJI3I7; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3si1406746pfj.46.2017.08.18.07.59.14; Fri, 18 Aug 2017 07:59:15 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ZoAJI3I7; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752555AbdHRO7J (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:09 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25739 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbdHRO7G (ORCPT ); Fri, 18 Aug 2017 10:59:06 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEx1OE013959; Fri, 18 Aug 2017 09:59:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068341; bh=4tTFgdje9oeqN70itoxCnu/zQLubUyfE+LRLxDP3kLw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZoAJI3I7uF5qYijExKpkEgxlucTUVSmdi7TQlf6SBRuwGEClXpMFm/1kSJk7Exe/E pO5Kuer2J/5JbvRV4vEcOLYYj3j0wlNFOJWF5gIf/v4FKF7FIaZiCFHLAEcJH9mMxU /fHZot4lN179E/go4sXdYtQC5G0gGBsJJ492/e+c= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEx179003207; Fri, 18 Aug 2017 09:59:01 -0500 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:01 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:01 -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 v7IEwKkB023721; Fri, 18 Aug 2017 09:58:58 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 13/18] misc: pci_endpoint_test: Add support for PCI_ENDPOINT_TEST regs to be mapped to any BAR Date: Fri, 18 Aug 2017 20:28:05 +0530 Message-ID: <20170818145810.17649-14-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pci_endpoint_test driver assumes the PCI_ENDPOINT_TEST registers will always be mapped to BAR_0. This need not always be the case like in TI's K2G where BAR_0 is mapped to PCI controller application registers. Add support so that PCI_ENDPOINT_TEST registers can be mapped to any BAR. Change the bar_size used for BAR test accordingly. Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 09c10f426b64..5fc0f6c6a9e5 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -90,9 +90,14 @@ struct pci_endpoint_test { /* mutex to protect the ioctls */ struct mutex mutex; struct miscdevice miscdev; + enum pci_barno test_reg_bar; }; -static int bar_size[] = { 4, 512, 1024, 16384, 131072, 1048576 }; +struct pci_endpoint_test_data { + enum pci_barno test_reg_bar; +}; + +static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, u32 offset) @@ -147,6 +152,9 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test, size = bar_size[barno]; + if (barno == test->test_reg_bar) + size = 0x4; + for (j = 0; j < size; j += 4) pci_endpoint_test_bar_writel(test, barno, j, 0xA0A0A0A0); @@ -390,6 +398,8 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, void __iomem *base; struct device *dev = &pdev->dev; struct pci_endpoint_test *test; + struct pci_endpoint_test_data *data; + enum pci_barno test_reg_bar = BAR_0; struct miscdevice *misc_device; if (pci_is_bridge(pdev)) @@ -399,7 +409,13 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, if (!test) return -ENOMEM; + test->test_reg_bar = 0; test->pdev = pdev; + + data = (struct pci_endpoint_test_data *)ent->driver_data; + if (data) + test_reg_bar = data->test_reg_bar; + init_completion(&test->irq_raised); mutex_init(&test->mutex); @@ -441,14 +457,15 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, base = pci_ioremap_bar(pdev, bar); if (!base) { dev_err(dev, "failed to read BAR%d\n", bar); - WARN_ON(bar == BAR_0); + WARN_ON(bar == test_reg_bar); } test->bar[bar] = base; } - test->base = test->bar[0]; + test->base = test->bar[test_reg_bar]; if (!test->base) { - dev_err(dev, "Cannot perform PCI test without BAR0\n"); + dev_err(dev, "Cannot perform PCI test without BAR%d\n", + test_reg_bar); goto err_iounmap; } From patchwork Fri Aug 18 14:58:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 110410 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp937986obb; Fri, 18 Aug 2017 08:01:00 -0700 (PDT) X-Received: by 10.84.217.201 with SMTP id d9mr4443123plj.335.1503068460889; Fri, 18 Aug 2017 08:01:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068460; cv=none; d=google.com; s=arc-20160816; b=MTHllKOWCii3/M3baIbeWUHsP4atoO4HDA9cE/+p1FL8xF5KyFKuZW6GnrbDDvyx/O 4awGNszbjZc2USzVBvAdNuirnhLrm6BQL6wcOidLqHMbd7pLsBdvW5uec4SIEJbsXMs8 A+kJzXB9u/3XBJ5N6SiEGkup6JGv7bNTU0waLYcsfc9UupaDnkH05P9CHLsg3Os8slJ6 c3SbzRbxp2GaJTt+GQbB8pY2sLdbOubOiHmC0fHB1gdg71fIALm8KZrgVi7W7p9t0gKR Ky7L6wldWX5xrTbY2hIqeBMC1RF+I08Kfdkpo22xUOW+mht9w3KTBgO1LAdK3eWO3cCU eNQw== 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:arc-authentication-results; bh=Sduhb9YgT+AV/WXi2t2edT35eqd/evaDO3/qA6Hv6YQ=; b=zORYms//lq9pBYfYIfJzzNO9u4U8+dAgJ7j5PSA7vLTQ3x4J9nZfhGAvDqpuAP66kU oK5u9s0s+KVer5yZ8v9zWxFpUHTUNhoUEGeMyMzCL9XwXPX7RvCQ80wLGLJevC2OAwu9 VgSQSVXEioOZmRK5fGbF24Y0GEwImOcu1x6tE/t+klerRezxwz7WfuKfFUxCEb9ZMVp6 N2U8Dds/eqJNwT28VyH0zyCTEZk84Y/RaqzKAMBl5FTHUKA903lcUsPMbEg0deZphQ0k xYKxa/C8ZuzoQAg6yUbCAbLheyGpCW183ESWZpmGRZkyKmI2afLWzQD47r8GBm/JX8Dk 6CJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UyDKhLr/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si3693856pga.194.2017.08.18.08.00.59; Fri, 18 Aug 2017 08:01:00 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UyDKhLr/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752756AbdHRPA5 (ORCPT + 26 others); Fri, 18 Aug 2017 11:00:57 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25743 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751888AbdHRO7I (ORCPT ); Fri, 18 Aug 2017 10:59:08 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IEx4hJ014076; Fri, 18 Aug 2017 09:59:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068344; bh=XB+qvgptsmUbc2bAVoa3fSQXoXAX/7siMk8VWfrHTLU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=UyDKhLr/Vp9w46WilqC+GaEr+PppyDy1A5gPNdD61HgpDB8ZSc6P05d06fSkXiqR8 lTtXPmaIfrpWtDPrQszQwoH5vZJbrAFGr80XL20VL0cbKdP7h8kudBoT/L2Z+ttEvb tyaGXqcQPspML3qZzPoG3q6F+jMpJgIUtYn+3LCw= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEx4im012728; Fri, 18 Aug 2017 09:59:04 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:04 -0500 Received: from DFLE111.ent.ti.com (10.64.6.32) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:04 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE111.ent.ti.com (10.64.6.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:03 -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 v7IEwKkC023721; Fri, 18 Aug 2017 09:59:01 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 14/18] misc: pci_endpoint_test: Add support to provide aligned buffer addresses Date: Fri, 18 Aug 2017 20:28:06 +0530 Message-ID: <20170818145810.17649-15-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms like TI's K2G have a restriction that the host side buffer address should be aligned to either 1MB/2MB/4MB or 8MB (Ref: 11.14.4.9.1 Outbound Address Translation in K2G TRM SPRUHY8F January 2016 – Revised May 2017) addresses depending on how it is configured in the endpoint. Add support to provide such aligned address here so that pci_endpoint_test driver can be used to test K2G EP. Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 91 +++++++++++++++++++++++++++++++++------- 1 file changed, 76 insertions(+), 15 deletions(-) -- 2.11.0 diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 5fc0f6c6a9e5..5f6bd23ab657 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -91,10 +91,12 @@ struct pci_endpoint_test { struct mutex mutex; struct miscdevice miscdev; enum pci_barno test_reg_bar; + size_t alignment; }; struct pci_endpoint_test_data { enum pci_barno test_reg_bar; + size_t alignment; }; static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; @@ -210,16 +212,32 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) dma_addr_t dst_phys_addr; struct pci_dev *pdev = test->pdev; struct device *dev = &pdev->dev; + void *orig_src_addr; + dma_addr_t orig_src_phys_addr; + void *orig_dst_addr; + dma_addr_t orig_dst_phys_addr; + size_t offset; + size_t alignment = test->alignment; u32 src_crc32; u32 dst_crc32; - src_addr = dma_alloc_coherent(dev, size, &src_phys_addr, GFP_KERNEL); - if (!src_addr) { + orig_src_addr = dma_alloc_coherent(dev, size + alignment, + &orig_src_phys_addr, GFP_KERNEL); + if (!orig_src_addr) { dev_err(dev, "failed to allocate source buffer\n"); ret = false; goto err; } + if (alignment && !IS_ALIGNED(orig_src_phys_addr, alignment)) { + src_phys_addr = PTR_ALIGN(orig_src_phys_addr, alignment); + offset = src_phys_addr - orig_src_phys_addr; + src_addr = orig_src_addr + offset; + } else { + src_phys_addr = orig_src_phys_addr; + src_addr = orig_src_addr; + } + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_LOWER_SRC_ADDR, lower_32_bits(src_phys_addr)); @@ -229,11 +247,21 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) get_random_bytes(src_addr, size); src_crc32 = crc32_le(~0, src_addr, size); - dst_addr = dma_alloc_coherent(dev, size, &dst_phys_addr, GFP_KERNEL); - if (!dst_addr) { + orig_dst_addr = dma_alloc_coherent(dev, size + alignment, + &orig_dst_phys_addr, GFP_KERNEL); + if (!orig_dst_addr) { dev_err(dev, "failed to allocate destination address\n"); ret = false; - goto err_src_addr; + goto err_orig_src_addr; + } + + if (alignment && !IS_ALIGNED(orig_dst_phys_addr, alignment)) { + dst_phys_addr = PTR_ALIGN(orig_dst_phys_addr, alignment); + offset = dst_phys_addr - orig_dst_phys_addr; + dst_addr = orig_dst_addr + offset; + } else { + dst_phys_addr = orig_dst_phys_addr; + dst_addr = orig_dst_addr; } pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_LOWER_DST_ADDR, @@ -253,10 +281,12 @@ static bool pci_endpoint_test_copy(struct pci_endpoint_test *test, size_t size) if (dst_crc32 == src_crc32) ret = true; - dma_free_coherent(dev, size, dst_addr, dst_phys_addr); + dma_free_coherent(dev, size + alignment, orig_dst_addr, + orig_dst_phys_addr); -err_src_addr: - dma_free_coherent(dev, size, src_addr, src_phys_addr); +err_orig_src_addr: + dma_free_coherent(dev, size + alignment, orig_src_addr, + orig_src_phys_addr); err: return ret; @@ -270,15 +300,29 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) dma_addr_t phys_addr; struct pci_dev *pdev = test->pdev; struct device *dev = &pdev->dev; + void *orig_addr; + dma_addr_t orig_phys_addr; + size_t offset; + size_t alignment = test->alignment; u32 crc32; - addr = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL); - if (!addr) { + orig_addr = dma_alloc_coherent(dev, size + alignment, &orig_phys_addr, + GFP_KERNEL); + if (!orig_addr) { dev_err(dev, "failed to allocate address\n"); ret = false; goto err; } + if (alignment && !IS_ALIGNED(orig_phys_addr, alignment)) { + phys_addr = PTR_ALIGN(orig_phys_addr, alignment); + offset = phys_addr - orig_phys_addr; + addr = orig_addr + offset; + } else { + phys_addr = orig_phys_addr; + addr = orig_addr; + } + get_random_bytes(addr, size); crc32 = crc32_le(~0, addr, size); @@ -301,7 +345,7 @@ static bool pci_endpoint_test_write(struct pci_endpoint_test *test, size_t size) if (reg & STATUS_READ_SUCCESS) ret = true; - dma_free_coherent(dev, size, addr, phys_addr); + dma_free_coherent(dev, size + alignment, orig_addr, orig_phys_addr); err: return ret; @@ -314,15 +358,29 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) dma_addr_t phys_addr; struct pci_dev *pdev = test->pdev; struct device *dev = &pdev->dev; + void *orig_addr; + dma_addr_t orig_phys_addr; + size_t offset; + size_t alignment = test->alignment; u32 crc32; - addr = dma_alloc_coherent(dev, size, &phys_addr, GFP_KERNEL); - if (!addr) { + orig_addr = dma_alloc_coherent(dev, size + alignment, &orig_phys_addr, + GFP_KERNEL); + if (!orig_addr) { dev_err(dev, "failed to allocate destination address\n"); ret = false; goto err; } + if (alignment && !IS_ALIGNED(orig_phys_addr, alignment)) { + phys_addr = PTR_ALIGN(orig_phys_addr, alignment); + offset = phys_addr - orig_phys_addr; + addr = orig_addr + offset; + } else { + phys_addr = orig_phys_addr; + addr = orig_addr; + } + pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_LOWER_DST_ADDR, lower_32_bits(phys_addr)); pci_endpoint_test_writel(test, PCI_ENDPOINT_TEST_UPPER_DST_ADDR, @@ -339,7 +397,7 @@ static bool pci_endpoint_test_read(struct pci_endpoint_test *test, size_t size) if (crc32 == pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CHECKSUM)) ret = true; - dma_free_coherent(dev, size, addr, phys_addr); + dma_free_coherent(dev, size + alignment, orig_addr, orig_phys_addr); err: return ret; } @@ -410,11 +468,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, return -ENOMEM; test->test_reg_bar = 0; + test->alignment = 0; test->pdev = pdev; data = (struct pci_endpoint_test_data *)ent->driver_data; - if (data) + if (data) { test_reg_bar = data->test_reg_bar; + test->alignment = data->alignment; + } init_completion(&test->irq_raised); mutex_init(&test->mutex); From patchwork Fri Aug 18 14:58:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 110404 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935651obb; Fri, 18 Aug 2017 07:59:17 -0700 (PDT) X-Received: by 10.98.80.131 with SMTP id g3mr9327942pfj.156.1503068357642; Fri, 18 Aug 2017 07:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068357; cv=none; d=google.com; s=arc-20160816; b=fTh/qcRxeBXW/fRXJOABPmMJP9jnobYl8KzvR+ehHmfTWCWh+hQB95ACSSoMB9wVrU kvwCBD9Gn4FHTq6XuesycyNW7IhBmmx39Ju+kiHaCjNnfuXqniPe5OkBR8KGluzSWK0r K/qsdRdqt4JRndCg6mHnNimmlE4HnJooil9RLapMG82wz1ZCv/WezJkOq41/JHCxU93T WquyjHc5Wh4Suht098lf4Kyc0ngDof7JU13pLl8wV60wMgYLOpjxz5ZQiWRl0k+EasBp WjKB6eivRH+3YeKofb5NQ6OofPZACb3HSE5aEc1VCW7d+gVKYNT4QymqVVGTGcDWTSDb vPsQ== 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:arc-authentication-results; bh=mZbPaONfDOnb0WqNWxNlczqgJny3T/F8aw9S1z5gd6w=; b=rv5GZ0NiZRunwGUMTLu0rJeOW71b0+mnawQro4OzLzOJeKaE46YgMzaixiyyTTIzLD PwTlezFY/4qNLxGjJ3x1lag/UI6reuLNXJSdUCZBV/NA5VrBySBmNvxSfuylmPdWmsjd lPRP1+YjUbxaSoYDDF8ujm4bBk10evQKcsrdvZF6qQuJt0hoK1/5ZTyKVeGn04zUiLPT n4EqTZhWos23J/hSXSvMa31n6QxNOQuXPnmE1M9eWrD1nwg69Nivfci2ut7WR6Bk68Jw T34MPuXBr2v6v0763N3xtBYhPBpNZzjKInevnlnPPPWDtmqDScJ2nzSc5DnBvnisuRXe gouw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=r6qFQsvN; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g192si3623932pgc.466.2017.08.18.07.59.17; Fri, 18 Aug 2017 07:59:17 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=r6qFQsvN; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752587AbdHRO7P (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:15 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:10179 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbdHRO7L (ORCPT ); Fri, 18 Aug 2017 10:59:11 -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 v7IEx707002645; Fri, 18 Aug 2017 09:59:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068347; bh=8AYrMd9NMuxNtI/bH494xUh5tVx9P1GM7evpox9snus=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=r6qFQsvNw/B3hm/WkjP58CdXzuERI6lORKEtp9ClQzDMedQ+Y8XbljaJ96bjJPirm UK8MDn52lAKyT6yzNdPS0Q+377OMtzL03ZIfcOmexmj7JwbulrZnnbLFOsnvUVm48b ySLWJEWk++1ft+/zqLPEG5WAr5D6gspVUZ6hQ8+Q= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IEx73C012761; Fri, 18 Aug 2017 09:59:07 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:06 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:07 -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 v7IEwKkD023721; Fri, 18 Aug 2017 09:59:04 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 15/18] misc: pci_endpoint_test: Add support to not enable MSI interrupts Date: Fri, 18 Aug 2017 20:28:07 +0530 Message-ID: <20170818145810.17649-16-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some platforms like TI's K2G have a restriction that the host side buffer address should be aligned to either 1MB/2MB/4MB or 8MB addresses depending on how it is configured in the endpoint (Ref: 11.14.4.9.1 Outbound Address Translation in K2G TRM SPRUHY8F January 2016 – Revised May 2017). This restriction also applies to the MSI addresses provided by the RC. However it's not possible for the RC to know about this restriction and it may not provide 1MB/2MB/4MB or 8MB aligned address. So MSI interrupts should be disabled even if the K2G EP has MSI capabiltiy register. Add support to not enable MSI interrupts in pci_endpoint_test driver so that it can be used to test K2G EP. Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 5f6bd23ab657..5cbb25cf276c 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -97,6 +97,7 @@ struct pci_endpoint_test { struct pci_endpoint_test_data { enum pci_barno test_reg_bar; size_t alignment; + bool no_msi; }; static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; @@ -449,8 +450,9 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, { int i; int err; - int irq; + int irq = 0; int id; + bool no_msi = false; char name[20]; enum pci_barno bar; void __iomem *base; @@ -475,6 +477,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, if (data) { test_reg_bar = data->test_reg_bar; test->alignment = data->alignment; + no_msi = data->no_msi; } init_completion(&test->irq_raised); @@ -494,9 +497,11 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, pci_set_master(pdev); - irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); - if (irq < 0) - dev_err(dev, "failed to get MSI interrupts\n"); + if (!no_msi) { + irq = pci_alloc_irq_vectors(pdev, 1, 32, PCI_IRQ_MSI); + if (irq < 0) + dev_err(dev, "failed to get MSI interrupts\n"); + } err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler, IRQF_SHARED, DRV_MODULE_NAME, test); From patchwork Fri Aug 18 14:58:08 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: 110409 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp937229obb; Fri, 18 Aug 2017 08:00:31 -0700 (PDT) X-Received: by 10.84.209.202 with SMTP id y68mr9864023plh.474.1503068431839; Fri, 18 Aug 2017 08:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068431; cv=none; d=google.com; s=arc-20160816; b=f/u/hm96AkE8q1d5JAWMxYeQ1h/Zup6WRsyw5RGAR72+VNgOP5TWRz8z0V+2B6JbVG OC6qay07+gvPaAgGCXKCeBAolDeRtDObbNuAYb5698FwdIYmWH1dE+s3G/SomO37BsJ2 Ij9vYt+GPgPolmMvCAcviNVrDYWw1U/meWlX8Sh0aJ0aAr2JafS26WoBHfsWnBVwjTPT 67HtDID6DRsokE3vdYYRTUCV+LXqtEd+mK7YP3bsRzdKC3trrKNUVqeOISTFNPD2b0UL ku9jXeuAXc1ajtp6AJ4/SD9FxQSImtWCCGhmVJ4/0Z6VUnPO05WNS8iX0FyGEQ+ECThk YGOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=MAJauyavRcf1rNwVYE38HftAuZVkyXHVETdxym9W/R0=; b=q89jkYogD2ADMu67hpmIqLxSUJv6t8G8Tg10l+5KWsy1iH6Qce31C5QKk9/8kNqniB Qty/wY208DH6eiHlwBXsuZpTzfxBpj+EP0XaB+DEa6rSYEmnfmqcFxavpGgoElpnhkE8 27af2c4PTrIqviPLani282O9K/T/p+43Li0Op5BSwV5MnnAwBEpH6CvbzLFvuC9xU4yO iGK7GbUmygEuw0TIqt6OU0cotq+kupg3qY0dltM12YAUTprZ3vpmoVhK2ZNMqFKmny6A HgwKxFQUwU7QpMTXpBhp0ff5W4hC447mr9WlwY27FgIo9AUUJEQ/GtnYsFP1eCo/vvv9 LtPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Dvxp3WDl; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b186si3605543pgc.941.2017.08.18.08.00.31; Fri, 18 Aug 2017 08:00:31 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Dvxp3WDl; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752729AbdHRPA3 (ORCPT + 26 others); Fri, 18 Aug 2017 11:00:29 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25754 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752567AbdHRO7O (ORCPT ); Fri, 18 Aug 2017 10:59:14 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IExAwL014088; Fri, 18 Aug 2017 09:59:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068350; bh=4W33kzyt359WePY4agZBEB9xXcmvK91mXeapGMSI1LI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Dvxp3WDlk8r6RiLDyMV+Sh+FHvj4oX2XoR2vEh8cM4M1AV4GLkUGlzCHeY/VlMYMn cgMHTNstpBqGDrgySrhBux1hdabtLkDh50kvvpE4SpRrREWA0XElp/hNc98Qu+jFdp EDB199bnRaVFj779kAFS80oWJKiyPRtxvyNyYuYU= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IExA51012789; Fri, 18 Aug 2017 09:59:10 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:09 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:09 -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 v7IEwKkE023721; Fri, 18 Aug 2017 09:59:07 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 16/18] misc: pci_endpoint_test: Avoid using hard coded BAR sizes Date: Fri, 18 Aug 2017 20:28:08 +0530 Message-ID: <20170818145810.17649-17-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org BAR sizes are hard coded in pci_endpoint_test driver corresponding to the sizes used in pci-epf-test function driver. This might break if the sizes in pci-epf-test function driver is modified (and the corresponding change is not done in pci_endpoint_test pci driver). To avoid hard coding BAR sizes, use pci_resource_len API. Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -- 2.11.0 diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 5cbb25cf276c..1f37ad39b169 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -100,8 +100,6 @@ struct pci_endpoint_test_data { bool no_msi; }; -static int bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; - static inline u32 pci_endpoint_test_readl(struct pci_endpoint_test *test, u32 offset) { @@ -149,11 +147,12 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test, int j; u32 val; int size; + struct pci_dev *pdev = test->pdev; if (!test->bar[barno]) return false; - size = bar_size[barno]; + size = pci_resource_len(pdev, barno); if (barno == test->test_reg_bar) size = 0x4; From patchwork Fri Aug 18 14:58:09 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: 110405 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935744obb; Fri, 18 Aug 2017 07:59:22 -0700 (PDT) X-Received: by 10.99.38.69 with SMTP id m66mr9030760pgm.72.1503068362558; Fri, 18 Aug 2017 07:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068362; cv=none; d=google.com; s=arc-20160816; b=hD/ZRMJsyMG8Yq9jEQWy/7FigQJ0cqvQwd0slZuyX2MAnAuv1onD9gV7M2MPCzF8ry wQbd6tc6nmJLhkY2JhJdrlNC6l90R9xAML/zCay932Ed/on7DEBuDp7jkzRAulS2p+r7 KYLV1KnScflnLQXPYVE4tVVBn150VPzXKRZUjSgshiufizFZYMVXihFyCLSonqtfkBO9 IqFTJro8i3zCNCDJgEIcIpxjmAtLxWCad/cGaQLUIP3ZxoU7YR2T5HhUA8kGMpXH3RPc tPVkqiptEIPswe/EYR0bPIfgOC8EB78A3OGIbh/ldeCqh3/uIYaflVa60xOz8egpV/YU +rcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=Y8witjEzK4BnOS7P+kqGiv1OsENbQRLx2Syn3n7hj9Y=; b=btINr3J+2ohsFoqKUxPiDdIYGVjxuRF+boxGFMqqtNjoqAvwd3Qq76Ud+tCMR87GK3 yPw1IjUEOCimorUY0CUIGxDH/tqu3EO7Fd4SN4mEsAgETlit2iKsduq1wkvmeXIHau0O TwJr+fgazOiISsDSPkCkDfQJ7gbGzSEO7y28BJsxmLxVKV3GCo8prhm9yaJZHtbPtwsy klezwQdu8WVDm0W++hByQBI/8lUEjvr/zthYZ1QSOEMwZx5Ed3W7kDSD37NB7P2MbJnn mpqV62BJCEUX4G8sjVxbZpoWWOEVhJxahuLU5zDSE2rjDEZJhVSMJpl5fVvOZx4lXsRT rL4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QlVDTnV/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g192si3623932pgc.466.2017.08.18.07.59.22; Fri, 18 Aug 2017 07:59:22 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=QlVDTnV/; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbdHRO7T (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:19 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:19607 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbdHRO7R (ORCPT ); Fri, 18 Aug 2017 10:59:17 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IExDe7007625; Fri, 18 Aug 2017 09:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068353; bh=dTBxOHGx15QC3uYsKcAaatuey3z+Ixi7BTw6SAXrv5c=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QlVDTnV/ifXSNmZt37qQ2i289w5H9wD57kz/ou7U5iLLfKkoxRxbALnixMd1TMutd VkQVPL8Q4nIvvbAlKG9PvG3wmmtMFiGD0h/z4lkKstKxO5QAzmaEZbezUU5PVdY94S NMG0EyRzoy45T2b4M1z0crU8Z8W3ijPy5ioAQDHE= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IExDjA012807; Fri, 18 Aug 2017 09:59:13 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:12 -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 v7IEwKkF023721; Fri, 18 Aug 2017 09:59:10 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , Subject: [PATCH 17/18] misc: pci_endpoint_test: Enable/Disable MSI using module param Date: Fri, 18 Aug 2017 20:28:09 +0530 Message-ID: <20170818145810.17649-18-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In certain platforms like TI's DRA7 SoCs, use of legacy PCI interrupt is exclusive with use of MSI (Section 24.9.4.6.2.1 Legacy PCI Interrupts in http://www.ti.com/lit/ug/spruhz6i/spruhz6i.pdf). However pci_endpoint_test driver enables MSI by default in probe. In order for pci_endpoint_test to be able to test legacy interrupt, MSI should be disabled. Add a module param 'no_msi' to disable MSI (only when legacy interrupt has to be tested). Signed-off-by: Kishon Vijay Abraham I --- drivers/misc/pci_endpoint_test.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 1f37ad39b169..1f64d943794d 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -72,6 +72,11 @@ static DEFINE_IDA(pci_endpoint_test_ida); #define to_endpoint_test(priv) container_of((priv), struct pci_endpoint_test, \ miscdev) + +bool no_msi; +module_param(no_msi, bool, 0444); +MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); + enum pci_barno { BAR_0, BAR_1, @@ -451,7 +456,6 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, int err; int irq = 0; int id; - bool no_msi = false; char name[20]; enum pci_barno bar; void __iomem *base; From patchwork Fri Aug 18 14:58:10 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: 110406 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp935854obb; Fri, 18 Aug 2017 07:59:28 -0700 (PDT) X-Received: by 10.84.212.22 with SMTP id d22mr9993827pli.310.1503068368563; Fri, 18 Aug 2017 07:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503068368; cv=none; d=google.com; s=arc-20160816; b=EON0NmKc7FhvphPZUlGYJ3eapXyQHpW1gqYMq7VPl+lepv+lI5tJNgiR4rqwo/1gnX Xe2b0sOSFesFDDCdrzZs56sTsrKtIdgqTcDmjp1jP0aUI0iA1SpljBkEjMHHatL0Uqpf /Vvn2G/wwz6f578ehRbj6GfyOP4032qMFR8/kFB1t1Ry3mB8eyD7tzZvJMFYzZRtIqqV YoLusnNJReFPkgo4oaRUTLYkn9jKviVpCpZlkKHBRsS+31QD7bxXbnzsl6uSt7RUFa91 P0vKw6HqrjxwNzqDFM8tatRfZ/mEMpIhHBOX4z5kOOL9tZrFpaa1jPZyT96FfnXXgibW TgSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=raFtFAAZUoTq8bY3rAygS5eknuRPPORLpn0Da5UQtN8=; b=cx5wtJh76wSX34Cia2DWPtxyrieupvIHWkVxgATI/WEQCpDZX+kfigmKBygkIHWimj LPLgijw1Wgom7yLrOO0UkZS+HIIbATFacKfK9WZgIk6nDMv5jZqD906PJkB8nVupzXPI GmV8kMc5qERj+jyqFqHGoC5KK7fd8yEcCSFfGzu+vJtmVS9nIKx5UD6pIuAVkdxFoRfX 4Gg3eSA/fUr6/LUejEtYLrp6fOOaug1O2O1I6wvqreXh8t/XyeKgRA4yqCo8u49RkbFJ 4TpjUkDvYJkO/nVmIG+9Q9PjUeRtY6LTvVbrZX/lLODzM4R6qg8sC7U5zO1w6A6+Lde2 AGuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pXTSchFa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z73si3702160pgz.402.2017.08.18.07.59.28; Fri, 18 Aug 2017 07:59:28 -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=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pXTSchFa; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752662AbdHRO70 (ORCPT + 26 others); Fri, 18 Aug 2017 10:59:26 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25764 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751849AbdHRO7V (ORCPT ); Fri, 18 Aug 2017 10:59:21 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v7IExGLN014107; Fri, 18 Aug 2017 09:59:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1503068356; bh=NzEOsPaYK+Vh2fgVwjGlleMi6j8edlpWhXNk8COrzD8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pXTSchFa25UQYi2Vf9XZDCFRLrsWNAW7H/LqzTha6vJOYRH3xhoHAMhnn68jbBtBy GsvQVERdUOiNe2pWrg6uqWKXj7Wiq4WR1d7k6eB2F1p59r7RBMwRhaNATpO6zy7+Sv DDi+pnmKe1wAOp3wugofsj/zS5og9Ue7E8xGg9js= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v7IExGxA003478; Fri, 18 Aug 2017 09:59:16 -0500 Received: from DLEE109.ent.ti.com (157.170.170.41) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:16 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Fri, 18 Aug 2017 09:59:15 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Fri, 18 Aug 2017 09:59:15 -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 v7IEwKkG023721; Fri, 18 Aug 2017 09:59:13 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas CC: Joao Pinto , Arnd Bergmann , , , , , , , Stan Drozd Subject: [PATCH 18/18] tools: PCI: Add a missing option help line Date: Fri, 18 Aug 2017 20:28:10 +0530 Message-ID: <20170818145810.17649-19-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818145810.17649-1-kishon@ti.com> References: <20170818145810.17649-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stan Drozd Add a missing option help line for performing legacy interrupt test. Signed-off-by: Stan Drozd Signed-off-by: Kishon Vijay Abraham I --- tools/pci/pcitest.c | 1 + 1 file changed, 1 insertion(+) -- 2.11.0 diff --git a/tools/pci/pcitest.c b/tools/pci/pcitest.c index ad54a58d7dda..caf38c3959bf 100644 --- a/tools/pci/pcitest.c +++ b/tools/pci/pcitest.c @@ -173,6 +173,7 @@ int main(int argc, char **argv) "\t-D PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n" "\t-b BAR test (bar number between 0..5)\n" "\t-m MSI test (msi number between 1..32)\n" + "\t-l Legacy irq test\n" "\t-r Read buffer test\n" "\t-w Write buffer test\n" "\t-c Copy buffer test\n"