From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Jingoo Han <jingoohan1@gmail.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH v4 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid
Date: Fri, 29 Mar 2019 11:56:25 +0000 [thread overview]
Message-ID: <20190329194844.5c2cde53@xhacker.debian> (raw)
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
We should check msi_irq before calling irq_set_chained_handler() and
irq_set_handler_data().
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 25087d3c9a82..1040939f45b4 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -298,8 +298,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
void dw_pcie_free_msi(struct pcie_port *pp)
{
- irq_set_chained_handler(pp->msi_irq, NULL);
- irq_set_handler_data(pp->msi_irq, NULL);
+ if (pp->msi_irq) {
+ irq_set_chained_handler(pp->msi_irq, NULL);
+ irq_set_handler_data(pp->msi_irq, NULL);
+ }
irq_domain_remove(pp->msi_domain);
irq_domain_remove(pp->irq_domain);
--
2.20.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Vidya Sagar <vidyas@nvidia.com>
To: <jingoohan1@gmail.com>, <gustavo.pimentel@synopsys.com>,
<lorenzo.pieralisi@arm.com>, <bhelgaas@google.com>,
<Jisheng.Zhang@synaptics.com>, <thierry.reding@gmail.com>
Cc: mmaddireddy@nvidia.com, kthota@nvidia.com,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
vidyas@nvidia.com, Robin Murphy <robin.murphy@arm.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
sagar.tv@gmail.com
Subject: [PATCH v4 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid
Date: Thu, 4 Apr 2019 17:50:25 +0530 [thread overview]
Message-ID: <20190329194844.5c2cde53@xhacker.debian> (raw)
Message-ID: <20190404122025.x97iBJgm1EL-q2NkARxQhVWM7JSnMpPy6j1rPNK2blI@z> (raw)
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
We should check msi_irq before calling irq_set_chained_handler() and
irq_set_handler_data().
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 25087d3c9a82..1040939f45b4 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -298,8 +298,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp)
void dw_pcie_free_msi(struct pcie_port *pp)
{
- irq_set_chained_handler(pp->msi_irq, NULL);
- irq_set_handler_data(pp->msi_irq, NULL);
+ if (pp->msi_irq) {
+ irq_set_chained_handler(pp->msi_irq, NULL);
+ irq_set_handler_data(pp->msi_irq, NULL);
+ }
irq_domain_remove(pp->msi_domain);
irq_domain_remove(pp->irq_domain);
From patchwork Fri Mar 29 11:57:17 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
X-Patchwork-Id: 10876925
Return-Path: <linux-pci-owner@kernel.org>
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4708B922
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:22 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 304DF2906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:22 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 1E71C29106; Fri, 29 Mar 2019 11:57:22 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B25382906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:21 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1729482AbfC2L5U (ORCPT
<rfc822;patchwork-linux-pci@patchwork.kernel.org>);
Fri, 29 Mar 2019 07:57:20 -0400
Received: from mail-eopbgr790079.outbound.protection.outlook.com
([40.107.79.79]:5884
"EHLO NAM03-CO1-obe.outbound.protection.outlook.com"
rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP
id S1729469AbfC2L5U (ORCPT <rfc822;linux-pci@vger.kernel.org>);
Fri, 29 Mar 2019 07:57:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=bvDpzMGyizyHrjiB0dVAXTb1Ho3YNcs21pjZeXB9wjk=;
b=lBsKfENCCVCTL2BIua7YOQQS/ax79sNf4m7D9Hl65okWDgza61cTyBKzGHiFdcmxEBBH74BAglUogwD184atBJZUlkyjDgaU8bd0gh/mA66DNB1EkKm/6z3cf4Ap80mxR7zg6UgNOhNnm+D+tajluAaVYSvADZlSCayS23ocN2I=
Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by
BYAPR03MB4677.namprd03.prod.outlook.com (20.179.91.94) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.1730.18; Fri, 29 Mar 2019 11:57:17 +0000
Received: from BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b]) by BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b%2]) with mapi id 15.20.1750.017; Fri, 29 Mar 2019
11:57:17 +0000
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Jingoo Han <jingoohan1@gmail.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
CC: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v4 2/5] PCI: dwc: Free the page for MSI IRQ in
dw_pcie_free_msi()
Thread-Topic: [PATCH v4 2/5] PCI: dwc: Free the page for MSI IRQ in
dw_pcie_free_msi()
Thread-Index: AQHU5iaOgs5m4jcCLEKOwYgOAI2HSQ==
Date: Fri, 29 Mar 2019 11:57:17 +0000
Message-ID: <20190329194934.6be48292@xhacker.debian>
References: <20190329194750.265f6df6@xhacker.debian>
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [124.74.246.114]
x-clientproxiedby: TYAPR01CA0152.jpnprd01.prod.outlook.com
(2603:1096:404:7e::20) To BYAPR03MB4773.namprd03.prod.outlook.com
(2603:10b6:a03:134::24)
authentication-results: spf=none (sender IP is )
smtp.mailfrom=Jisheng.Zhang@synaptics.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: d414ebf8-a007-4070-f133-08d6b43db0c4
x-microsoft-antispam:
BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR03MB4677;
x-ms-traffictypediagnostic: BYAPR03MB4677:
x-microsoft-antispam-prvs:
<BYAPR03MB467730024D65E12F378355E4ED5A0@BYAPR03MB4677.namprd03.prod.outlook.com>
x-forefront-prvs: 0991CAB7B3
x-forefront-antispam-report:
SFV:NSPM;SFS:(10009020)(136003)(366004)(39860400002)(396003)(346002)(376002)(189003)(199004)(110136005)(53936002)(54906003)(478600001)(97736004)(106356001)(446003)(316002)(105586002)(86362001)(102836004)(7736002)(476003)(9686003)(66066001)(305945005)(11346002)(256004)(71200400001)(3846002)(72206003)(71190400001)(8676002)(50226002)(6116002)(4326008)(25786009)(8936002)(2906002)(6512007)(14454004)(486006)(6436002)(1076003)(81166006)(81156014)(186003)(68736007)(52116002)(26005)(76176011)(99286004)(5660300002)(6506007)(6486002)(386003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4677;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0;
received-spf: None (protection.outlook.com: synaptics.com does not designate
permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info:
qL8/S+G7thLsFOHYWaWKJyCC+SE7awYRREe3BJSDxYzCJLvIvrHVVrLNqe4G1Uoe9nuX5ttDaYvvoqBTww7R4aatkoUNSKb1kAWoKRJ2zdS9y0ltRX77BE2bfm1NDrNlLuRmwBRrE4c3V4CQeFGDcTERNp/cimh00WGhS8K4wMWjl9Sc/x/Q+g7bEkCWuPRqd9NAfMJnvscDCIX2wFB3UkiZLHyke4FGzFUnt2rPH3SmSpZ+PWHrg9GW2M31vMCqnBTigtVmVH2/7PKvY76YoIyMg5QsmZP1PFHHHMaSwU7XonHkBAP8qdXKayID74l8RylON4Jteyzlt7u2rkocdxa4cSxGPR+oCSFCd+CbSHePwVKq7ieIQ6HA5AkYVfjk5Z3mn2pmeohVul/5GKWP/GvbFkrJUHZ6NWA4slnkwRM=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <3D3C0C9B4EF25A44AD8A1CEF9428E6DF@namprd03.prod.outlook.com>
MIME-Version: 1.0
X-OriginatorOrg: synaptics.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
d414ebf8-a007-4070-f133-08d6b43db0c4
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 11:57:17.4017
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4677
Sender: linux-pci-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-pci.vger.kernel.org>
X-Mailing-List: linux-pci@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
To avoid memory leak, we need to free the page for MSI in
dw_pcie_free_msi().
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++++----
drivers/pci/controller/dwc/pcie-designware.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 1040939f45b4..a71b874ae3c0 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -305,20 +305,24 @@ void dw_pcie_free_msi(struct pcie_port *pp)
irq_domain_remove(pp->msi_domain);
irq_domain_remove(pp->irq_domain);
+
+ if (pp->msi_page)
+ __free_page(pp->msi_page);
}
void dw_pcie_msi_init(struct pcie_port *pp)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
struct device *dev = pci->dev;
- struct page *page;
u64 msi_target;
- page = alloc_page(GFP_KERNEL);
- pp->msi_data = dma_map_page(dev, page, 0, PAGE_SIZE, DMA_FROM_DEVICE);
+ pp->msi_page = alloc_page(GFP_KERNEL);
+ pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE,
+ DMA_FROM_DEVICE);
if (dma_mapping_error(dev, pp->msi_data)) {
dev_err(dev, "Failed to map MSI data\n");
- __free_page(page);
+ __free_page(pp->msi_page);
+ pp->msi_page = NULL;
return;
}
msi_target = (u64)pp->msi_data;
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 377f4c0b52da..6fb0a1879932 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -179,6 +179,7 @@ struct pcie_port {
struct irq_domain *irq_domain;
struct irq_domain *msi_domain;
dma_addr_t msi_data;
+ struct page *msi_page;
u32 num_vectors;
u32 irq_mask[MAX_MSI_CTRLS];
raw_spinlock_t lock;
From patchwork Fri Mar 29 11:57:54 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
X-Patchwork-Id: 10876929
Return-Path: <linux-pci-owner@kernel.org>
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49EF315AC
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:59 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 36F462906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:59 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 2B53529110; Fri, 29 Mar 2019 11:57:59 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B77512906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:57:58 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1729468AbfC2L56 (ORCPT
<rfc822;patchwork-linux-pci@patchwork.kernel.org>);
Fri, 29 Mar 2019 07:57:58 -0400
Received: from mail-eopbgr790084.outbound.protection.outlook.com
([40.107.79.84]:23352
"EHLO NAM03-CO1-obe.outbound.protection.outlook.com"
rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP
id S1729453AbfC2L56 (ORCPT <rfc822;linux-pci@vger.kernel.org>);
Fri, 29 Mar 2019 07:57:58 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=b37RT4uKXDdbkxNeUhAAhSpdbcyTyUQD7FOeyCs8KSw=;
b=uqWpgKAfCHU3XjcU11CDcG7d9IZMHMS2Eh08QDv/bhdnPxoZt3ye5cUFYVsaYnMhi+CXBMAPhiysuLYqhK6+75NX5PyOrutztOuHRKxg9DpJUcnmE4IWC6H1YOmejtl3+giSOWyxibbZfhp3JnePexY6K+oxuNgnyB3UAfLmoUQ=
Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by
BYAPR03MB4677.namprd03.prod.outlook.com (20.179.91.94) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.1730.18; Fri, 29 Mar 2019 11:57:54 +0000
Received: from BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b]) by BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b%2]) with mapi id 15.20.1750.017; Fri, 29 Mar 2019
11:57:54 +0000
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Jingoo Han <jingoohan1@gmail.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
CC: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v4 3/5] PCI: dwc: Free MSI in the error code path of
dw_pcie_host_init()
Thread-Topic: [PATCH v4 3/5] PCI: dwc: Free MSI in the error code path of
dw_pcie_host_init()
Thread-Index: AQHU5iakPXqGrGU6TUeWd4NIoGI2eA==
Date: Fri, 29 Mar 2019 11:57:54 +0000
Message-ID: <20190329195014.54e54c45@xhacker.debian>
References: <20190329194750.265f6df6@xhacker.debian>
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [124.74.246.114]
x-clientproxiedby: TY2PR01CA0003.jpnprd01.prod.outlook.com
(2603:1096:404:a::15) To BYAPR03MB4773.namprd03.prod.outlook.com
(2603:10b6:a03:134::24)
authentication-results: spf=none (sender IP is )
smtp.mailfrom=Jisheng.Zhang@synaptics.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 60148251-00ad-4915-5425-08d6b43dc6f6
x-microsoft-antispam:
BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR03MB4677;
x-ms-traffictypediagnostic: BYAPR03MB4677:
x-microsoft-antispam-prvs:
<BYAPR03MB4677883E06035160ADBC7987ED5A0@BYAPR03MB4677.namprd03.prod.outlook.com>
x-forefront-prvs: 0991CAB7B3
x-forefront-antispam-report:
SFV:NSPM;SFS:(10009020)(136003)(366004)(39860400002)(396003)(346002)(376002)(189003)(199004)(110136005)(53936002)(54906003)(478600001)(97736004)(106356001)(446003)(316002)(105586002)(86362001)(102836004)(7736002)(476003)(9686003)(66066001)(305945005)(11346002)(256004)(71200400001)(3846002)(72206003)(71190400001)(8676002)(50226002)(6116002)(4326008)(25786009)(8936002)(2906002)(6512007)(14454004)(486006)(6436002)(1076003)(81166006)(81156014)(186003)(68736007)(52116002)(26005)(76176011)(99286004)(5660300002)(6506007)(6486002)(386003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4677;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0;
received-spf: None (protection.outlook.com: synaptics.com does not designate
permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info:
XpEU/8iu7x6u9BEOAQxuLy0ANXGqqMmF2KGS/9hlc/aiWj8JCRi3adUUiwxgU9AiOwEJObwsTZxXowHOyTZWCLOASbVvi9A8u3uv2zW1qxI2Xacc+za5DgOk0RCcGSXtR2P40UDg18LhJAAyEWTUtgADTymTRUOkdgE1rnNjiN7YKquePSthJ2qZ7MbLcSgUo2Pjwr4PXPgBFZxYhZfgcaNUfek9f8/D4YJKa/Bg64KbEspxTpOLWebJlUoGNBlGUS1nJDFIOuoDW1iSIgChtnrVEk+76qo5MsHSSdenmgfFvRuIzpe3k4Jicx3GAlqmiMNoeKnmFa4Bna7eFzJ/0gNB8Ckw1/8Hun9AxPbvMOK2oYEmxp+D3DO9Fptj08JUqmb4OrQjw2EijJlwYmF2/l4xN/dfYLam4ZNsFBXBZoA=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <5CF048EA27826E449B67FB5B91E2B4A7@namprd03.prod.outlook.com>
MIME-Version: 1.0
X-OriginatorOrg: synaptics.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
60148251-00ad-4915-5425-08d6b43dc6f6
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 11:57:54.6703
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4677
Sender: linux-pci-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-pci.vger.kernel.org>
X-Mailing-List: linux-pci@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
If we ever did some msi related initializations, we need to call
dw_pcie_free_msi() in the error code path.
We also remove the IS_ENABLED(CONFIG_PCI_MSI) check for MSI init,
because pci_msi_enabled() already has a stub for !CONFIG_PCI_MSI.
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index a71b874ae3c0..acc9be5cf34a 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -445,7 +445,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (ret)
pci->num_viewport = 2;
- if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled()) {
+ if (pci_msi_enabled()) {
/*
* If a specific SoC driver needs to change the
* default number of vectors, it needs to implement
@@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (pp->ops->host_init) {
ret = pp->ops->host_init(pp);
if (ret)
- goto error;
+ goto err_free_msi;
}
pp->root_bus_nr = pp->busn->start;
@@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
ret = pci_scan_root_bus_bridge(bridge);
if (ret)
- goto error;
+ goto err_free_msi;
bus = bridge->bus;
@@ -513,6 +513,9 @@ int dw_pcie_host_init(struct pcie_port *pp)
pci_bus_add_devices(bus);
return 0;
+err_free_msi:
+ if (pci_msi_enabled() && !pp->ops->msi_host_init)
+ dw_pcie_free_msi(pp);
error:
pci_free_host_bridge(bridge);
return ret;
From patchwork Fri Mar 29 11:58:53 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
X-Patchwork-Id: 10876933
Return-Path: <linux-pci-owner@kernel.org>
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 490CA15AC
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:58:58 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 373352906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:58:58 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 2B63829106; Fri, 29 Mar 2019 11:58:58 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B07622906E
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:58:57 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1729081AbfC2L64 (ORCPT
<rfc822;patchwork-linux-pci@patchwork.kernel.org>);
Fri, 29 Mar 2019 07:58:56 -0400
Received: from mail-eopbgr790058.outbound.protection.outlook.com
([40.107.79.58]:33702
"EHLO NAM03-CO1-obe.outbound.protection.outlook.com"
rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP
id S1729406AbfC2L64 (ORCPT <rfc822;linux-pci@vger.kernel.org>);
Fri, 29 Mar 2019 07:58:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=7v47moEqUBbS6CG9iXSUFR2k+rZtFMLmVbAjCEzZ3P0=;
b=XnNc5RhCrInW3ZMz6m4s9iYn7y5Ghraj+Wo6fwQ0AZPVkZYnJ4ALD8tJNkPQaiP9/cyTB4gEpDJ0SLfNmiK/7sQP6KrBRbGzV9VI/o010WdOYcgdPEr9BToDXxDkGhTmKIzEXbIzMtTfSeKnTj0p2g+mXjm1gshP1AgEH9fbH/Q=
Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by
BYAPR03MB4677.namprd03.prod.outlook.com (20.179.91.94) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.1730.18; Fri, 29 Mar 2019 11:58:53 +0000
Received: from BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b]) by BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b%2]) with mapi id 15.20.1750.017; Fri, 29 Mar 2019
11:58:53 +0000
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Jingoo Han <jingoohan1@gmail.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
CC: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v4 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify
the code
Thread-Topic: [PATCH v4 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to
simplify the code
Thread-Index: AQHU5ibHIJJqTWvLzUuMnrUhdu3x1g==
Date: Fri, 29 Mar 2019 11:58:53 +0000
Message-ID: <20190329195112.11abef0d@xhacker.debian>
References: <20190329194750.265f6df6@xhacker.debian>
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [124.74.246.114]
x-clientproxiedby: TY2PR01CA0033.jpnprd01.prod.outlook.com
(2603:1096:404:ce::21) To BYAPR03MB4773.namprd03.prod.outlook.com
(2603:10b6:a03:134::24)
authentication-results: spf=none (sender IP is )
smtp.mailfrom=Jisheng.Zhang@synaptics.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: d9e84a40-cc01-4cab-9ab4-08d6b43de9e1
x-microsoft-antispam:
BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR03MB4677;
x-ms-traffictypediagnostic: BYAPR03MB4677:
x-microsoft-antispam-prvs:
<BYAPR03MB467749D8CB51266D69E4166CED5A0@BYAPR03MB4677.namprd03.prod.outlook.com>
x-forefront-prvs: 0991CAB7B3
x-forefront-antispam-report:
SFV:NSPM;SFS:(10009020)(136003)(366004)(39860400002)(396003)(346002)(376002)(189003)(199004)(110136005)(53936002)(54906003)(478600001)(97736004)(106356001)(446003)(316002)(105586002)(86362001)(102836004)(7736002)(476003)(9686003)(66066001)(305945005)(11346002)(256004)(14444005)(71200400001)(3846002)(72206003)(71190400001)(8676002)(50226002)(6116002)(4326008)(25786009)(8936002)(2906002)(6512007)(14454004)(486006)(6436002)(1076003)(81166006)(81156014)(186003)(68736007)(52116002)(26005)(76176011)(99286004)(5660300002)(6506007)(6486002)(386003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4677;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0;
received-spf: None (protection.outlook.com: synaptics.com does not designate
permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info:
BZ7niUt8SEoFU8W60tVSqmrLEmH2543h/NThyXb+kNf3Jxi6eITEZAfbuaDfYxrwng71sgpKPfeIIQ8Bl4B6rB8035kVGrxbdbNGF/nONKgFlpEDjfURlKrbJmjTYI7d4yK3Qgf1bE4hmOwv8zIZmOUQd71EvSQ0Cq7jpMk2bWwA6YRiNFsW//ToE3CbxvocEn7zzEZ6D2GVUAfc/pKS06qnFwutBjOCa17lXUJUxLoFyYs45KI0S7stl4RrEZqoBzMJwT1EWFi5O8sVt+XgUV9xMNpu4Q+WSq0DGckX7tTxIcYKU5c83nqSDnhmImxsOejH0uZYlsJAkv4fJUV9R2MB6e3U1s9f2CH7Fkc+SzLRuLzQ31ywZWfncFOb6Uk3ESu2J9EM+m853pFbuSKWy/XB+7TAuXgGyf5O8pJEZ2Q=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <E2856F75F34FEC4E843E0D69B62D1068@namprd03.prod.outlook.com>
MIME-Version: 1.0
X-OriginatorOrg: synaptics.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
d9e84a40-cc01-4cab-9ab4-08d6b43de9e1
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 11:58:53.1666
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4677
Sender: linux-pci-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-pci.vger.kernel.org>
X-Mailing-List: linux-pci@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
Use devm_pci_alloc_host_bridge() to simplify the error code path.
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
.../pci/controller/dwc/pcie-designware-host.c | 21 +++++++------------
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index acc9be5cf34a..dcc7405aff9a 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -358,7 +358,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
dev_err(dev, "Missing *config* reg space\n");
}
- bridge = pci_alloc_host_bridge(0);
+ bridge = devm_pci_alloc_host_bridge(dev, 0);
if (!bridge)
return -ENOMEM;
@@ -369,7 +369,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
ret = devm_request_pci_bus_resources(dev, &bridge->windows);
if (ret)
- goto error;
+ return ret;
/* Get the I/O and memory ranges from DT */
resource_list_for_each_entry_safe(win, tmp, &bridge->windows) {
@@ -413,8 +413,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
resource_size(pp->cfg));
if (!pci->dbi_base) {
dev_err(dev, "Error with ioremap\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}
@@ -425,8 +424,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->cfg0_base, pp->cfg0_size);
if (!pp->va_cfg0_base) {
dev_err(dev, "Error with ioremap in function\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}
@@ -436,8 +434,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->cfg1_size);
if (!pp->va_cfg1_base) {
dev_err(dev, "Error with ioremap\n");
- ret = -ENOMEM;
- goto error;
+ return -ENOMEM;
}
}
@@ -460,14 +457,14 @@ int dw_pcie_host_init(struct pcie_port *pp)
pp->num_vectors == 0) {
dev_err(dev,
"Invalid number of vectors\n");
- goto error;
+ return -EINVAL;
}
}
if (!pp->ops->msi_host_init) {
ret = dw_pcie_allocate_domains(pp);
if (ret)
- goto error;
+ return ret;
if (pp->msi_irq)
irq_set_chained_handler_and_data(pp->msi_irq,
@@ -476,7 +473,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
} else {
ret = pp->ops->msi_host_init(pp);
if (ret < 0)
- goto error;
+ return ret;
}
}
@@ -516,8 +513,6 @@ int dw_pcie_host_init(struct pcie_port *pp)
err_free_msi:
if (pci_msi_enabled() && !pp->ops->msi_host_init)
dw_pcie_free_msi(pp);
-error:
- pci_free_host_bridge(bridge);
return ret;
}
From patchwork Fri Mar 29 11:59:26 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
X-Patchwork-Id: 10876937
Return-Path: <linux-pci-owner@kernel.org>
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B759F922
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:59:31 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A040528711
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:59:31 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 90D6C2876D; Fri, 29 Mar 2019 11:59:31 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2092128711
for <patchwork-linux-pci@patchwork.kernel.org>;
Fri, 29 Mar 2019 11:59:31 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1729466AbfC2L7a (ORCPT
<rfc822;patchwork-linux-pci@patchwork.kernel.org>);
Fri, 29 Mar 2019 07:59:30 -0400
Received: from mail-eopbgr790082.outbound.protection.outlook.com
([40.107.79.82]:9959
"EHLO NAM03-CO1-obe.outbound.protection.outlook.com"
rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP
id S1729463AbfC2L73 (ORCPT <rfc822;linux-pci@vger.kernel.org>);
Fri, 29 Mar 2019 07:59:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=2O3L1y6KM2Q6b0qVANwO0U4VBo4CWXvYKbt3CGrUo3E=;
b=P8fQvyM7fmLqsDuCx/eTDizZquxrtknLoGA/dIKh+G+20V6lavAupqT8PwUoW0NZfbyfkfa/7lWfxtbVPDkSJ4cB0PxbU6QIz4R0wxKL8eXCixiktr3ISV46JR4DlQi4iB2sMuf7J54kxFlgEbsukUMivHTpfvVRPFZwmBWj/V8=
Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by
BYAPR03MB4677.namprd03.prod.outlook.com (20.179.91.94) with Microsoft SMTP
Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
15.20.1730.18; Fri, 29 Mar 2019 11:59:26 +0000
Received: from BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b]) by BYAPR03MB4773.namprd03.prod.outlook.com
([fe80::1a8:1bc4:174b:472b%2]) with mapi id 15.20.1750.017; Fri, 29 Mar 2019
11:59:26 +0000
From: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
To: Jingoo Han <jingoohan1@gmail.com>,
Gustavo Pimentel <gustavo.pimentel@synopsys.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Bjorn Helgaas <bhelgaas@google.com>
CC: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Robin Murphy <robin.murphy@arm.com>
Subject: [PATCH v4 5/5] PCI: dwc: Save root bus for driver remove
Thread-Topic: [PATCH v4 5/5] PCI: dwc: Save root bus for driver remove
Thread-Index: AQHU5ibbnD0hZoEW0kmtfkvI6C/+vA==
Date: Fri, 29 Mar 2019 11:59:26 +0000
Message-ID: <20190329195146.3b15dcac@xhacker.debian>
References: <20190329194750.265f6df6@xhacker.debian>
In-Reply-To: <20190329194750.265f6df6@xhacker.debian>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [124.74.246.114]
x-clientproxiedby: TYXPR01CA0047.jpnprd01.prod.outlook.com
(2603:1096:403:a::17) To BYAPR03MB4773.namprd03.prod.outlook.com
(2603:10b6:a03:134::24)
authentication-results: spf=none (sender IP is )
smtp.mailfrom=Jisheng.Zhang@synaptics.com;
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: cf96f3e6-aa27-430c-3406-08d6b43dfdb4
x-microsoft-antispam:
BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600127)(711020)(4605104)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:BYAPR03MB4677;
x-ms-traffictypediagnostic: BYAPR03MB4677:
x-microsoft-antispam-prvs:
<BYAPR03MB46779508F6F375457010D9FEED5A0@BYAPR03MB4677.namprd03.prod.outlook.com>
x-forefront-prvs: 0991CAB7B3
x-forefront-antispam-report:
SFV:NSPM;SFS:(10009020)(136003)(366004)(39860400002)(396003)(346002)(376002)(189003)(199004)(110136005)(53936002)(54906003)(478600001)(97736004)(106356001)(446003)(316002)(105586002)(86362001)(102836004)(7736002)(476003)(9686003)(66066001)(305945005)(11346002)(256004)(71200400001)(3846002)(72206003)(71190400001)(8676002)(50226002)(6116002)(4326008)(25786009)(8936002)(2906002)(6512007)(14454004)(486006)(6436002)(1076003)(81166006)(81156014)(186003)(68736007)(52116002)(26005)(76176011)(99286004)(5660300002)(6506007)(6486002)(386003)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4677;H:BYAPR03MB4773.namprd03.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:0;
received-spf: None (protection.outlook.com: synaptics.com does not designate
permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info:
KLYrOAccSPqrNfrLuFOq0SU49FcPJgz1IkfyTu18TBXBuSopBujyK1MTyZ+YvF6g7kraDgnfp6cAedVDsAWB3JRYPK+red3IZtLgodKtGIGm8pR63Uxx4k5bO6ghelncX446jV63fMNJ64lXTa1yVbmfkalzABSaAPLc2UjUMLHBA4lS4S3pKe8QMZ+ug00LNJZ4Qvq4+TmvGDtIZxKCdzGiy0caw65H+BoVuwMyVDdD/qKtQfXeDTUk9mrTI3iO0UKViyXd3EFPHkSvI2eAsxGS+n7sbEhCXGsl4S/l4zK4Le8h0ZaC++tHOxJcd54Bv/JX16TaoqrIX8Jm8ZPUVuOSzHXA1UE215R/bSHC3j8WnRaOAcCrEUFQfu6YVGZrOTZGYnHUOsNc7JTWnbkwuL5kVMwwUsfQVOF13g3RtgQ=
Content-Type: text/plain; charset="us-ascii"
Content-ID: <41385B38B83CC14EA7F859BE693DD822@namprd03.prod.outlook.com>
MIME-Version: 1.0
X-OriginatorOrg: synaptics.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
cf96f3e6-aa27-430c-3406-08d6b43dfdb4
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2019 11:59:26.4315
(UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4677
Sender: linux-pci-owner@vger.kernel.org
Precedence: bulk
List-ID: <linux-pci.vger.kernel.org>
X-Mailing-List: linux-pci@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
Currently dwc host doesn't support the remove, but nothing prevent us
from supporting it. Save the root bus for clean up work in driver
remove code path.
After this patch, the dwc host users could implement its remove as:
static int foo_pcie_remove(struct platform_device *pdev)
{
...
pci_stop_root_bus(pp->root_bus);
pci_remove_root_bus(pp->root_bus);
dw_pcie_free_msi(pp);
...
}
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------
drivers/pci/controller/dwc/pcie-designware.h | 1 +
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index dcc7405aff9a..3e4169e738a5 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -341,7 +341,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
struct device_node *np = dev->of_node;
struct platform_device *pdev = to_platform_device(dev);
struct resource_entry *win, *tmp;
- struct pci_bus *bus, *child;
+ struct pci_bus *child;
struct pci_host_bridge *bridge;
struct resource *cfg_res;
int ret;
@@ -496,18 +496,18 @@ int dw_pcie_host_init(struct pcie_port *pp)
if (ret)
goto err_free_msi;
- bus = bridge->bus;
+ pp->root_bus = bridge->bus;
if (pp->ops->scan_bus)
pp->ops->scan_bus(pp);
- pci_bus_size_bridges(bus);
- pci_bus_assign_resources(bus);
+ pci_bus_size_bridges(pp->root_bus);
+ pci_bus_assign_resources(pp->root_bus);
- list_for_each_entry(child, &bus->children, node)
+ list_for_each_entry(child, &pp->root_bus->children, node)
pcie_bus_configure_settings(child);
- pci_bus_add_devices(bus);
+ pci_bus_add_devices(pp->root_bus);
return 0;
err_free_msi:
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index 6fb0a1879932..adff0c713665 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -182,6 +182,7 @@ struct pcie_port {
struct page *msi_page;
u32 num_vectors;
u32 irq_mask[MAX_MSI_CTRLS];
+ struct pci_bus *root_bus;
raw_spinlock_t lock;
DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS);
};
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-03-29 11:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 11:55 [PATCH v4 0/5] PCI: dwc: Support remove Jisheng Zhang
2019-03-29 11:56 ` Jisheng Zhang [this message]
2019-04-04 12:20 ` [PATCH v4 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid Vidya Sagar
2019-03-29 11:57 ` [PATCH v4 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi() Jisheng Zhang
2019-03-29 11:57 ` [PATCH v4 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() Jisheng Zhang
2019-03-29 11:58 ` [PATCH v4 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify the code Jisheng Zhang
2019-03-29 11:59 ` [PATCH v4 5/5] PCI: dwc: Save root bus for driver remove Jisheng Zhang
2019-04-01 13:50 ` [PATCH v4 0/5] PCI: dwc: Support remove Lorenzo Pieralisi
2019-04-03 13:36 ` Vidya Sagar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190329194844.5c2cde53@xhacker.debian \
--to=jisheng.zhang@synaptics.com \
--cc=bhelgaas@google.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=jingoohan1@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=robin.murphy@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).