Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1455358ybb; Fri, 29 Mar 2019 05:02:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqz8GJYVL8MVWz61a4rkprfv/qJKloIagNZepIjOLlZVdMSFPFODZnN4CY5Our82FqB2WueX X-Received: by 2002:a17:902:bb92:: with SMTP id m18mr31393278pls.316.1553860944565; Fri, 29 Mar 2019 05:02:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553860944; cv=none; d=google.com; s=arc-20160816; b=t+eplwz/5GZOvs4aBlmnFCOveu24915Ov4UjKfufqc4JWCvLOxFgWk0xglSdpwGRZa UAZpwpiuleNfmDhmbhvq8lmscGRTYoYgxMtxWiFySQpOP5q8jjQGc0zzO5aA43nCs7nS f1FpCAUoqRMOT56HOPApXTEfwL4Ub7kK+ZYr0seBHWDJ96LsyFRr+mJu60EL1VQhgWy2 R0pTZnpVrO6+j/rUHqeBnZA56bMCFLl1iH00y0LBJ1tI/ChvfrbjqA75MZhPSvtsE865 ltrkKXZ6A3HTNek6O139omdnAm3+ad3dclNrEChRYhQLjTFJRzgTKfN86krAwJ2pZ0Dd w8xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=2O3L1y6KM2Q6b0qVANwO0U4VBo4CWXvYKbt3CGrUo3E=; b=H0XNglAVbYb9JyygrovuiuiIMZK2i3/qKhpI7V9XTNItra97iF4aKB+7sWGTCuuWRy j4X6/ph+xcdh/YJEKg1b2ZJeIGYIYXY+FMrFz9b1+T8GJ7XMe9hWtbm2QzqAg8VS1g42 6z4PNSwnKdKS+qciNZzfw4FSH1aUSJjjxLxvEExHJbyIphtJXRKfTtMFTqgVWpvq10yQ yHYTwclMAZMIp5BL1NFslI0LePIP/q32MviBD9OINWe6+ehWEdJCEJqrsNQelnTW8a6L GsJi0d6gEv36GmyMRNxuWyWJPXx8JzqBy0bWQva1DhiFLxOXbnubjOSFLf9KA5KKd/wd eBtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=P8fQvyM7; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si1721730pll.344.2019.03.29.05.01.53; Fri, 29 Mar 2019 05:02:24 -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=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=P8fQvyM7; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729478AbfC2L7a (ORCPT + 99 others); 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 ); 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 To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Robin Murphy 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: 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> Content-Transfer-Encoding: quoted-printable 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Acked-by: Gustavo Pimentel --- 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/pc= i/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 =3D dev->of_node; struct platform_device *pdev =3D 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; =20 - bus =3D bridge->bus; + pp->root_bus =3D bridge->bus; =20 if (pp->ops->scan_bus) pp->ops->scan_bus(pp); =20 - pci_bus_size_bridges(bus); - pci_bus_assign_resources(bus); + pci_bus_size_bridges(pp->root_bus); + pci_bus_assign_resources(pp->root_bus); =20 - list_for_each_entry(child, &bus->children, node) + list_for_each_entry(child, &pp->root_bus->children, node) pcie_bus_configure_settings(child); =20 - pci_bus_add_devices(bus); + pci_bus_add_devices(pp->root_bus); return 0; =20 err_free_msi: diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/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); }; --=20 2.20.1