From patchwork Mon Jan 14 11:15:04 2019 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: 155445 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3537136jaa; Mon, 14 Jan 2019 03:17:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN4iXOEXvw4mRnAejxXPIzxnwMpgfckyhZ4mAMPzhmxK7Hmi16+u/F12M2HQt8tjcQtNS+e5 X-Received: by 2002:a17:902:b592:: with SMTP id a18mr24969398pls.293.1547464632356; Mon, 14 Jan 2019 03:17:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547464632; cv=none; d=google.com; s=arc-20160816; b=HSdt1ptf0G65vPOh9wCH4h+Tiyo2FiktRMRrXpCejv4srFQ5YzrpYroyBL+do6rxsh UNO33IdZUXMY7CJHvmMDp4RW8Co6XXsEFRkxaPg3gRyZ2l5PzMWPgYqjuxcXFXMBjUUF g7awusiJqOCHIeGPiwbZSJzdY2t6CgXN39QcyIq3fq7zOAKJn3jqUEugIjL548CP7/KC w3819nvMTAZkPHYftLyFaEV0FNkPp0bZQWX3Nd0iXVfSG5uQK+7w55y8OkWVLJGEgNH0 hZMEExKK6kmHLJwCeS9+xtIP63RrO8cXB+n605Fa3jueIzuuHHV7XPDkNwZnIZC/obdP 0YCQ== 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; bh=7BZqM5lihQv/21d7TmC8rclZDArMN5iGSCdWQmZG2ac=; b=M9t+Frdu72shE8YI8y8wPZYR3yzCgALLiieJ/0xOvhADMHIqGtPgD4IvIL23N8cur+ EXPKgoXva2hiAv6+KKE4g48B8f7GLqDO3UM2rCtIMNo5ObeWB77Xo/joLQoJ6im23l+p CPxtFFaBCuiWPy463pFVfppjs/mjvdnBHJ2Rjz/Yzxca0PpYVbyuIMZJOAfuLC+j1lWL kfmyUT6BdJyjcw6bZeeiyc0zpa3cEesbyK16nQ7mxX5g3fVbeLWgw1H1jdoVzkbAVjex iufVg39EH/PQZBVvnBQ5Vee/6hWSvWewcYOhDYKgJiyWB6bwsIzM9OR9bzFXDqIEAPF2 tQvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=GIfksZU0; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 s5si113260plr.211.2019.01.14.03.17.12; Mon, 14 Jan 2019 03:17:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=GIfksZU0; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 S1726717AbfANLRL (ORCPT + 5 others); Mon, 14 Jan 2019 06:17:11 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:46942 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfANLRK (ORCPT ); Mon, 14 Jan 2019 06:17:10 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0EBG7v4065534; Mon, 14 Jan 2019 05:16:07 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547464567; bh=7BZqM5lihQv/21d7TmC8rclZDArMN5iGSCdWQmZG2ac=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GIfksZU0asNRdI/5vQsV4tUZexlZKhQB4LfC/1SQ3pNhNql+KyuYm9n/aPAIWmw+/ Cae7oVjCA4PP68r6h8tlYCqxO54dCGj5yuwbEiPZgfN5j6JVvNcBL0ATZsc5ceYj4j pdTHAvjSH7nMSWJuVrQsNFmMguGJa3atG+1y2+/0= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0EBG66f100457 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 05:16:06 -0600 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 05:16:06 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) 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.1591.10 via Frontend Transport; Mon, 14 Jan 2019 05:16:06 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0EBFd1Y011560; Mon, 14 Jan 2019 05:16:03 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Gustavo Pimentel , Alan Douglas , Shawn Lin , Heiko Stuebner CC: Bjorn Helgaas , Jingoo Han , , , , , Subject: [PATCH v2 06/15] PCI: cadence: Populate ->get_features() cdns_pcie_epc_ops Date: Mon, 14 Jan 2019 16:45:04 +0530 Message-ID: <20190114111513.21618-7-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114111513.21618-1-kishon@ti.com> References: <20190114111513.21618-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Populate ->get_features() dw_pcie_ep_ops to return the EPC features supported by Cadence PCIe endpoint controller. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/pcie-cadence-ep.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.17.1 diff --git a/drivers/pci/controller/pcie-cadence-ep.c b/drivers/pci/controller/pcie-cadence-ep.c index c3a088910f48..14c2545bb17e 100644 --- a/drivers/pci/controller/pcie-cadence-ep.c +++ b/drivers/pci/controller/pcie-cadence-ep.c @@ -411,6 +411,18 @@ static int cdns_pcie_ep_start(struct pci_epc *epc) return 0; } +static const struct pci_epc_features cdns_pcie_epc_features = { + .linkup_notifier = false, + .msi_capable = true, + .msix_capable = false, +}; + +static const struct pci_epc_features* +cdns_pcie_ep_get_features(struct pci_epc *epc, u8 func_no) +{ + return &cdns_pcie_epc_features; +} + static const struct pci_epc_ops cdns_pcie_epc_ops = { .write_header = cdns_pcie_ep_write_header, .set_bar = cdns_pcie_ep_set_bar, @@ -421,6 +433,7 @@ static const struct pci_epc_ops cdns_pcie_epc_ops = { .get_msi = cdns_pcie_ep_get_msi, .raise_irq = cdns_pcie_ep_raise_irq, .start = cdns_pcie_ep_start, + .get_features = cdns_pcie_ep_get_features, }; static const struct of_device_id cdns_pcie_ep_of_match[] = { From patchwork Mon Jan 14 11:15:06 2019 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: 155443 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3536973jaa; Mon, 14 Jan 2019 03:17:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5R5Eyj4nqiMwJykdLRr2HfRR/Bwt1XtO/OcBkKXERvD/Y6uBU0VpZQyRbr5iSITx11hZnx X-Received: by 2002:a17:902:c85:: with SMTP id 5mr25312709plt.339.1547464620694; Mon, 14 Jan 2019 03:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547464620; cv=none; d=google.com; s=arc-20160816; b=b8PRoChDqEN26ahHabx8Rwyx5t/WHrrxYGh2fkLZfte/HtvuL9B+uUUgOgvd97UW8+ 1Z08jkjzyPBdkBfc/GqEetRgrFlfTibuMAiKI1Xk3IFGQMR2VoTXmaAms8s/8Edbhn7a 5vpjiE4OZ0D1n/5V0jROApIyJ36uRe69vKTC903IPROtKIVfs8mEEqquZKdFXlgH6D1d 4oTyuBlafaVBE4Y3CDxLkpP8CTHVRXyXCpinRIkR6efTN71gWOvzLcYpRyjGMYrd1OCr 66tbIxaStkZvkC9wglVQB3EaIsdvo4MyTfteyKOWI2+JK9AYhomoby3vD/nt1scMLUlF DzEQ== 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; bh=bomR0TElheZ70a4424n4+PZQ1RpTa9f7juuhG35IGxY=; b=m6gpMyR/P9kLZsyOiBZMagsv2+jclOBmnEp8kHQ152FACo/Enmqz5p1QVNDg8yxIvM HKMIzLZ9OW+eAvbhwVhDBgyLsbF6UmMB1IA+V0RSPMRKAkyu9b6oWAmKHZlwTBLPlnMz LqZ5Nrk49wM3ePmmlEuIgfx82KPRvSGPuRFpDginM5tg3XGDr6LodvWFoA4O4XJ8A/B+ dRVAQyfETDV3LDezKcFEa6jOjKRLUjAV2Ngb0ZISXMhBT6OrouQioEdDj+zftK0FsD+x W315k8osiJYbzgr3QXkpO73C/luRfM0Fp27p9Bvn0GzpU+Vn7tWv8THuB7scySSD6CzC xWMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MNyt1hEx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 j26si92810pgl.537.2019.01.14.03.17.00; Mon, 14 Jan 2019 03:17:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=MNyt1hEx; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 S1726414AbfANLQ7 (ORCPT + 5 others); Mon, 14 Jan 2019 06:16:59 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45532 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbfANLQ7 (ORCPT ); Mon, 14 Jan 2019 06:16:59 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0EBGELg112733; Mon, 14 Jan 2019 05:16:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547464574; bh=bomR0TElheZ70a4424n4+PZQ1RpTa9f7juuhG35IGxY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MNyt1hEx/sd+05mnHce4k7ZLAqhX05iEv7WPS3DZbrh9QcOI5VEiksPADW94LA7km d9lG+mwGo5hZ0ecJLxYddj4+dijpp9vqItQyvNHB9AYP2uMZNVRTkJVbh0lHfyA9D0 QGIlnBxLzdhc/EVSIYHC8/oPux1E+N7pElAOVrJM= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0EBGEAO067802 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 05:16:14 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 05:16:14 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) 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.1591.10 via Frontend Transport; Mon, 14 Jan 2019 05:16:14 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0EBFd1a011560; Mon, 14 Jan 2019 05:16:10 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Gustavo Pimentel , Alan Douglas , Shawn Lin , Heiko Stuebner CC: Bjorn Helgaas , Jingoo Han , , , , , Subject: [PATCH v2 08/15] PCI: endpoint: Fix pci_epf_alloc_space to set correct MEM TYPE flags Date: Mon, 14 Jan 2019 16:45:06 +0530 Message-ID: <20190114111513.21618-9-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114111513.21618-1-kishon@ti.com> References: <20190114111513.21618-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org pci_epf_alloc_space() sets the MEM TYPE flags to indicate a 32-bit Base Address Register irrespective of the size. Fix it here to indicate 64-bit BAR if the size is > 2GB. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/pci-epf-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 825fa24427a3..8bfdcd291196 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -131,7 +131,9 @@ void *pci_epf_alloc_space(struct pci_epf *epf, size_t size, enum pci_barno bar) epf->bar[bar].phys_addr = phys_addr; epf->bar[bar].size = size; epf->bar[bar].barno = bar; - epf->bar[bar].flags = PCI_BASE_ADDRESS_SPACE_MEMORY; + epf->bar[bar].flags |= upper_32_bits(size) ? + PCI_BASE_ADDRESS_MEM_TYPE_64 : + PCI_BASE_ADDRESS_MEM_TYPE_32; return space; } From patchwork Mon Jan 14 11:15:07 2019 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: 155446 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3537252jaa; Mon, 14 Jan 2019 03:17:22 -0800 (PST) X-Google-Smtp-Source: ALg8bN5P+FRlG9FwwbVv7gwlSmqS5sQqBawAbZrdxGIIycvgi0VaMLYLVjDRTVff4TL4bQIoJ4Ir X-Received: by 2002:a63:40c6:: with SMTP id n189mr21874135pga.355.1547464642133; Mon, 14 Jan 2019 03:17:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547464642; cv=none; d=google.com; s=arc-20160816; b=y3wK1DuRbqLloHzftcYqAy8FHPXygYoudWN0JoiLwywz8H5ZxaUFjcvayNL82sPPWI 5gD27qMJZkWWkx83shVH/jQhYsVpE0QER8kNQy5VAYRZD8iesoZTvqLgFf6NgqJspZWT RBUGhpD1rF4IaS5DfesuXvYzn5PlCLEQ9rm1o5UvmHdUlR8xAd5+bkR1sfpTnOwKE0ss 4474EpRLHfsYcoo7TdnQegk9VhI29FQVkdpFm8OLFjBPxYa7y1tfYg6E4Bnb5GdclXH5 ELaM/YSVSIpUrTrG+/syN9a7tCObeDOLRXzJCKoQGVXFMfNgPhGwLFDV4MEynZ5BIqDC 9a5Q== 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; bh=DS7GtGkD91osbAa6RekCVW+2i6NQKOGWzWvT8VJgdzc=; b=dcWxm7sWN3/671tN8eqJwZOwGLgxbsGKlbekWm71RZJhvlcjtHUSsay8wF5RnK/Tin soiT/dVVgG2KJpe+kS2N9Ok+1FVh7VgeQQxJjvIZLO5EttsT77CMpIpqj8v/GQSf7A6B N6bCvh6fIjCeqMrinOeCEfivMhRnUpzvLuWwPPXw2zIsYXKWCy7NR0k8tu0dESOy0J3r sXCg6rxT3vMvmJNH43fEE7LamfD8M8FRFyo9QqXyxYR+uGGcrJ3F/Wo37tyRGygEr7db RVSvfv7pYH3a3ahn9tGQJxX+xvzVGLMtHndbTtHPubqU+txCixe/6f1vXyuOxjORyRC7 zBPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EMhX8BCe; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 s5si113260plr.211.2019.01.14.03.17.21; Mon, 14 Jan 2019 03:17:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=EMhX8BCe; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 S1726691AbfANLRV (ORCPT + 5 others); Mon, 14 Jan 2019 06:17:21 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45618 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726656AbfANLRV (ORCPT ); Mon, 14 Jan 2019 06:17:21 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0EBGIQi112750; Mon, 14 Jan 2019 05:16:18 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547464578; bh=DS7GtGkD91osbAa6RekCVW+2i6NQKOGWzWvT8VJgdzc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EMhX8BCerUESkfaCvKZY5pB58iOub+MoqmPkn9jLeIHBgBJzBsT4i5w534+SQqSMG MMOBv5tuuwVL/HS/oZX5JbdsKcVYGk+Syd7ygKCqMGZx8lmRrkrp439QZQ7CfZ+UX9 Jv39IRtGP3HIvhwQ/kmstYXtatsREnFZca2qh0XM= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0EBGIA7024008 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 05:16:18 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 05:16:17 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) 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.1591.10 via Frontend Transport; Mon, 14 Jan 2019 05:16:18 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0EBFd1b011560; Mon, 14 Jan 2019 05:16:14 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Gustavo Pimentel , Alan Douglas , Shawn Lin , Heiko Stuebner CC: Bjorn Helgaas , Jingoo Han , , , , , Subject: [PATCH v2 09/15] PCI: pci-epf-test: Remove setting epf_bar flags in function driver Date: Mon, 14 Jan 2019 16:45:07 +0530 Message-ID: <20190114111513.21618-10-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114111513.21618-1-kishon@ti.com> References: <20190114111513.21618-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Now that pci_epf_alloc_space() sets BAR MEM TYPE flags as 64Bit or 32Bit based on size, remove setting it in function driver. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 4 ---- 1 file changed, 4 deletions(-) -- 2.17.1 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 3e86fa3c7da3..44cc31343a80 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -406,10 +406,6 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) for (bar = BAR_0; bar <= BAR_5; bar++) { epf_bar = &epf->bar[bar]; - epf_bar->flags |= upper_32_bits(epf_bar->size) ? - PCI_BASE_ADDRESS_MEM_TYPE_64 : - PCI_BASE_ADDRESS_MEM_TYPE_32; - ret = pci_epc_set_bar(epc, epf->func_no, epf_bar); if (ret) { pci_epf_free_space(epf, epf_test->reg[bar], bar); From patchwork Mon Jan 14 11:15:09 2019 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: 155451 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3538111jaa; Mon, 14 Jan 2019 03:18:17 -0800 (PST) X-Google-Smtp-Source: ALg8bN4liyOStupSwEKRZJMOJmjfMx9vhlGRDBxjALedk8P1jUm5hXCRXe/t2n09bznHzjdmF+Pb X-Received: by 2002:a62:a510:: with SMTP id v16mr24694876pfm.18.1547464697854; Mon, 14 Jan 2019 03:18:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547464697; cv=none; d=google.com; s=arc-20160816; b=eOZdO9WQ4gVviFpIGhPsVTOnk00Pu8a8MdS6smM327ozTnBpX1AuwUFDKvho6Fq58Y V5/pqKCmedMn+9J2CtPrhfrR9ypDh5C5cHb0U5XFlTbJjq0tTzKxRK1ClgQ4C4tLteQZ 0C9VenLA4u/zNvHUyWcUxdugmZ/RN+lP/ttA3aXppOe9Pj3Q8rauPqMj5bThv5ZO+/p0 Oupf1aQ2y99MEbYVKAJB26QinejAQ9aJy1ENlpJcohOkNAw4kI4DeLStvJtvC+vwOICj K3QKEC/PH8k3Pri29ySJYzanaM/DvMOyoOYrdxQjVA+xbGjo1YjloJeOtzofhxGxu2ek vyOg== 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; bh=2uDrXrY9NBnXdAPSRPaCNiNMbVveMwv8owns43GbBkk=; b=RqztvC68iH9pB6Pi0TkqQhbYqN04MyIL4Wxkc4uqx0qWf6cuHAY2EOCJqXMHoYJMaP 4MLEdE5NuVRW0lJ3iRcn3aIRsYjCAJ/eYpzzJQiYmUy/AwAzjs2W9HP3S8B0N5gmpmmo 4h1EdyocymH7fhzsFpg+9xTnHuZ8ZuEqCuAy0BfEGJ8fKdwuoMWRaL4ud8piy0Zq905V Sr5tui/mq2cJDgfU4E0Dq5w+TZQLyHM1ML1Sa5ARoHZOA2wNmABQpH9FxohwHE6NC7od 6hStXx0e470M7lUUzNTgnX5gTIX7h65RmOD0kMuc4HJ6Ztzh+Phgo+/PubyEaIZSnxIA EJgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=MnarZvli; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 l135si129233pga.69.2019.01.14.03.18.17; Mon, 14 Jan 2019 03:18:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=MnarZvli; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-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 S1726542AbfANLSR (ORCPT + 5 others); Mon, 14 Jan 2019 06:18:17 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45852 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726467AbfANLSQ (ORCPT ); Mon, 14 Jan 2019 06:18:16 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0EBGQCi112768; Mon, 14 Jan 2019 05:16:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547464586; bh=2uDrXrY9NBnXdAPSRPaCNiNMbVveMwv8owns43GbBkk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=MnarZvlipwvByteR3HR6kltcgVuYCM0wZpb5rzGs4pZVXqEnEZBpmj1sk9kt2QyF4 POUlhOGDIdZ2IpMJHyexPlsRBF9xR64X1xu08d98srBPQvUZ4mSDpDC3vV33FKErrk Hkmr5VYlTuIxOxMrjwC0UdeXhHXDpTVPOgQCbPiM= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0EBGQAU024080 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 05:16:26 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 05:16:25 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 14 Jan 2019 05:16:25 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0EBFd1d011560; Mon, 14 Jan 2019 05:16:22 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Gustavo Pimentel , Alan Douglas , Shawn Lin , Heiko Stuebner CC: Bjorn Helgaas , Jingoo Han , , , , , Subject: [PATCH v2 11/15] PCI: pci-epf-test: Use pci_epc_get_features to get EPC features Date: Mon, 14 Jan 2019 16:45:09 +0530 Message-ID: <20190114111513.21618-12-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114111513.21618-1-kishon@ti.com> References: <20190114111513.21618-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use pci_epc_get_features to get EPC features such as linkup notifier support, MSI/MSIX capable, BAR configuration etc and use it for configuring pci-epf-test. Since these features are now obtained directly from EPC driver, remove pci_epf_test_data which was initially added to have EPC features in endpoint function driver. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/functions/pci-epf-test.c | 87 ++++++++++++------- 1 file changed, 54 insertions(+), 33 deletions(-) -- 2.17.1 diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index ade296180383..2e0fb231ce0c 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -47,9 +47,8 @@ struct pci_epf_test { void *reg[6]; struct pci_epf *epf; enum pci_barno test_reg_bar; - bool linkup_notifier; - bool msix_available; struct delayed_work cmd_handler; + const struct pci_epc_features *epc_features; }; struct pci_epf_test_reg { @@ -71,11 +70,6 @@ static struct pci_epf_header test_header = { .interrupt_pin = PCI_INTERRUPT_INTA, }; -struct pci_epf_test_data { - enum pci_barno test_reg_bar; - bool linkup_notifier; -}; - static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 }; static int pci_epf_test_copy(struct pci_epf_test *epf_test) @@ -402,10 +396,16 @@ static int pci_epf_test_set_bar(struct pci_epf *epf) 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; + const struct pci_epc_features *epc_features; + + epc_features = epf_test->epc_features; for (bar = BAR_0; bar <= BAR_5; bar++) { epf_bar = &epf->bar[bar]; + if (!!(epc_features->reserved_bar & (1 << bar))) + continue; + ret = pci_epc_set_bar(epc, epf->func_no, epf_bar); if (ret) { pci_epf_free_space(epf, epf_test->reg[bar], bar); @@ -433,6 +433,9 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) void *base; int bar; enum pci_barno test_reg_bar = epf_test->test_reg_bar; + const struct pci_epc_features *epc_features; + + epc_features = epf_test->epc_features; base = pci_epf_alloc_space(epf, sizeof(struct pci_epf_test_reg), test_reg_bar); @@ -446,6 +449,10 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) epf_bar = &epf->bar[bar]; if (bar == test_reg_bar) continue; + + if (!!(epc_features->reserved_bar & (1 << 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", @@ -458,25 +465,50 @@ static int pci_epf_test_alloc_space(struct pci_epf *epf) return 0; } +static void pci_epf_configure_bar(struct pci_epf *epf, + const struct pci_epc_features *epc_features) +{ + struct pci_epf_bar *epf_bar; + bool bar_fixed_64bit; + int i; + + for (i = BAR_0; i <= BAR_5; i++) { + epf_bar = &epf->bar[i]; + bar_fixed_64bit = !!(epc_features->bar_fixed_64bit & (1 << i)); + if (bar_fixed_64bit) + epf_bar->flags |= PCI_BASE_ADDRESS_MEM_TYPE_64; + if (epc_features->bar_fixed_size[i]) + bar_size[i] = epc_features->bar_fixed_size[i]; + } +} + 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; + const struct pci_epc_features *epc_features; + enum pci_barno test_reg_bar = BAR_0; struct pci_epc *epc = epf->epc; struct device *dev = &epf->dev; + bool linkup_notifier = false; + bool msix_capable = false; + bool msi_capable = true; if (WARN_ON_ONCE(!epc)) return -EINVAL; - if (epc->features & EPC_FEATURE_NO_LINKUP_NOTIFIER) - epf_test->linkup_notifier = false; - else - epf_test->linkup_notifier = true; - - epf_test->msix_available = epc->features & EPC_FEATURE_MSIX_AVAILABLE; + epc_features = pci_epc_get_features(epc, epf->func_no); + if (epc_features) { + linkup_notifier = epc_features->linkup_notifier; + msix_capable = epc_features->msix_capable; + msi_capable = epc_features->msi_capable; + test_reg_bar = pci_epc_get_first_free_bar(epc_features); + pci_epf_configure_bar(epf, epc_features); + } - epf_test->test_reg_bar = EPC_FEATURE_GET_BAR(epc->features); + epf_test->test_reg_bar = test_reg_bar; + epf_test->epc_features = epc_features; ret = pci_epc_write_header(epc, epf->func_no, header); if (ret) { @@ -492,13 +524,15 @@ static int pci_epf_test_bind(struct pci_epf *epf) if (ret) return ret; - ret = pci_epc_set_msi(epc, epf->func_no, epf->msi_interrupts); - if (ret) { - dev_err(dev, "MSI configuration failed\n"); - return ret; + if (msi_capable) { + ret = pci_epc_set_msi(epc, epf->func_no, epf->msi_interrupts); + if (ret) { + dev_err(dev, "MSI configuration failed\n"); + return ret; + } } - if (epf_test->msix_available) { + if (msix_capable) { ret = pci_epc_set_msix(epc, epf->func_no, epf->msix_interrupts); if (ret) { dev_err(dev, "MSI-X configuration failed\n"); @@ -506,7 +540,7 @@ static int pci_epf_test_bind(struct pci_epf *epf) } } - if (!epf_test->linkup_notifier) + if (!linkup_notifier) queue_work(kpcitest_workqueue, &epf_test->cmd_handler.work); return 0; @@ -523,17 +557,6 @@ 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; - 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) { - 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) @@ -541,8 +564,6 @@ 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);