From patchwork Fri Mar 1 05:06:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834487 Return-Path: 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 5A10C1390 for ; Fri, 1 Mar 2019 05:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45E062F738 for ; Fri, 1 Mar 2019 05:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 372F52F73D; Fri, 1 Mar 2019 05:06:57 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1A6D2F738 for ; Fri, 1 Mar 2019 05:06:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aHXf9yFRTJK1snwd/j3WDOp6JHuv6qVefUrw4HC88nQ=; b=Ss8FV3DqtPHmPQ L5W16DcUxD7HpjfmRcN5Ae6oc5J2C8lhzDUCGShaVIND2cf3uZkY1TOXLd3sox8tW335kFLZ+bUTJ wCrTNMniBZQ+M9MTIVq043jxJjXyvjcm/341qtoCHJ/ZVs7TtG8khxxrShaV3ddgiqIzPb2lWDEUk 0hCs+9zGGCWHpONi7X1L0cfdj9pnRRKZjGaFok67Wa/n9+f5q2nSep/Fpx0CY3P2slcWvZMahKbvC 0gTHvj6DVr59b71z5pxftpJ7V/9XHnYiUcBC9CmddX7QxFwFahrsETT9YCa9PG8bg8lrzu7OoBvtd BBronACSKoOtQdFCu9pw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaNm-0002EW-Tq; Fri, 01 Mar 2019 05:06:50 +0000 Received: from mail-eopbgr700063.outbound.protection.outlook.com ([40.107.70.63] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaNj-0002Cp-RR for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:06:49 +0000 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=HDfJa/5peeKUsjb5cZhVZj4vd75dEAlF9WieijY3ECo=; b=qjZrbe7GQI+ulV5kBg66rqrMTSVEgV6KQCQB3n7BXT8tNE7VSMf5ZUoKVHfG0nmU140qH4IACwqE9QVvdbK2UovXYinnpTwCPT75UWii1l4+FloH0lXa1k21UlXmmXTJL04v1brtgDDlxnBEOb5BWli2AAzmM41tL7SGG0wvrsY= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4533.namprd03.prod.outlook.com (20.178.50.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Fri, 1 Mar 2019 05:06:46 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1665.015; Fri, 1 Mar 2019 05:06:46 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 5/5] PCI: dwc: Save root bus for driver remove Thread-Topic: [PATCH v2 5/5] PCI: dwc: Save root bus for driver remove Thread-Index: AQHUz+yR42j7VtHHRUKR9O0ghfmT2Q== Date: Fri, 1 Mar 2019 05:06:45 +0000 Message-ID: <20190301125943.47adae82@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TY2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:404:a6::31) 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: 60b36bb6-96a3-4d3e-4395-08d69e03b399 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4533; x-ms-traffictypediagnostic: BYAPR03MB4533: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4533; 23:LqzZwPSNONsoLhj8Yd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qLgkm5C1LiIflzd8ZHptq5AS2UlXGrQtz7cwh+Mu6bBX+VHf+O2+e/cHyX2px1rvjK2oMpw0Y/rCRMX7eSDe4dmD3nlarGQB/b7Of/Qepgv5C7rcF58T/oz6g0VV5Ii8kYWAyeVOsOcDdXEtoBg== x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(136003)(376002)(199004)(189003)(86362001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(5660300002)(476003)(6436002)(2906002)(54906003)(1076003)(9686003)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(8676002)(99286004)(486006)(6506007)(6512007)(105586002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4533; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: X5rcuTo5Kb130uKY7QkJ7wKqSiZ0U5G+VoIz+Vl2Wnp2vK2DlF5Er5LjiTn09zKfY1yiGlhRJ0R4qxrWZqVky3FAqlh/KbTqvC4MH6dSOd/YQWStTWUh/C5zsVZqkdy3kSbhSQ6UeIhivwgSTENQrxJmLJRBQz/eie5NBdRmrX4a2l3dcWvG9BXlIt+4CLZnaae5RRe4q0cJmCj7QsKFyKAJw9R9II/nrKNghBFxCu8wHsDtt3dg1UeSIGeu0gtr1ov7Za3gHWN1jz5O9hnjvTkFnzp1+5INP6LAXyiJF3aFQyNGq8LIfgjjWFZBhxjSOIsPWkzuv1GAIZsjcQ6YVtuJrxg2vbqslM4afNRDzcM56PakF4YDTO8vYINlDHABQ4m9C9LbSD9YtVw5us39JMXHbDNw0TUqANOmiJ1CwhU= Content-ID: <50863B334B294B4CA01863E2F6F8572D@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60b36bb6-96a3-4d3e-4395-08d69e03b399 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:06:45.8022 (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: BYAPR03MB4533 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210647_885139_7AB8CE41 X-CRM114-Status: GOOD ( 10.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 --- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 4831c12fee93..ca45a4471ca0 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -496,6 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp) goto err_free_msi; bus = bridge->bus; + pp->root_bus = bus; if (pp->ops->scan_bus) pp->ops->scan_bus(pp); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 3be7ca9f1fc3..cd92ded606c6 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); };