From patchwork Fri Mar 1 05:04:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834473 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 0C4181390 for ; Fri, 1 Mar 2019 05:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F7D2EF09 for ; Fri, 1 Mar 2019 05:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE7222EF39; Fri, 1 Mar 2019 05:04:18 +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 88D4C2EF09 for ; Fri, 1 Mar 2019 05:04:18 +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=oCbWs20lVQyGWVHDU7oeJAl2JVgJ/p+3KNxGK6PP/+c=; b=iVhx2s7Tx+vR4V fWUHZkGu0gFtE46wSs4htc/qR9/7J+8gTlbu+yuAeO7owqDwmWMA42fZps1o3fXcPmqNhkp647yi2 gnU7qSYk8LuSRs0bJ5WcOeWz2f9tPvyhjyS+QGIyISR9tOxfTsuDGzmowPNCX/CFJAOutLB29v9hZ FETgPeiCPlr0ztFUGiTrSpceKa0lkevLR/w9flJJGd94FvVxswIKiCvi8lbMnnfi/AzVeMCYQtlPj ItJnFv6G1mnDZUyxVFI9I7v1NkndSGjCFpoKx4h49JCnup66H+caFBKgEJtLR+ib09AmU+9Ns/tql HC+SxtOMPE7/EPiEUhFQ==; 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 1gzaLG-0007NH-5E; Fri, 01 Mar 2019 05:04:14 +0000 Received: from mail-eopbgr700046.outbound.protection.outlook.com ([40.107.70.46] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaLD-0007Md-9c for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:04:12 +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=Ex6uyZdWem6jPJGDdDtu1KGRvPYljhIDe98tVWT8nUs=; b=w9U/ygVTDRpBZlzd/E/DLB0reE3jXxIiTgP+LVEI04SCve2cc5k0joGtc2+0ad8hy7DGrEjip0bgOLv9BIVLDJJKXFuSTECwFhwNmnF9TN2vJndYTtJFHUC6BM2kdOKccJW108pJls2ouuNWvC0s1Z5IhuNQBEZzAgfc66nFae8= 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:04:09 +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:04:09 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi() Thread-Topic: [PATCH v2 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi() Thread-Index: AQHUz+w0Gr/59ysaiUqI8xDUOx+UmA== Date: Fri, 1 Mar 2019 05:04:09 +0000 Message-ID: <20190301125707.73563471@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: TY2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:404:f6::23) 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: 533dc7b9-6ae4-4055-455b-08d69e03565d 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; BY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LA9jXOweC1T3rf5Y2CP6VNjHSIoGsYVcku6Lap7Dgp3U/z+Kan4NjkvX6BY9K8jh9/3xTGyM4mUADkNeF+tCbdvvecR8p0BoRFl7MJlrSPDNCq0CnjRX5FNSy6eIdKTotDLqdRM2QS6YGsY87wXwmAR12TUdk9mNasraroLLwCtMCsxKoYfajUok3K3SpG8sVUJ1qMLFWYocCO4nf3I5TpCEfvJFVVbfEjy02j2qMvzMduHS0tCXsca91p6wO7U1q9aiS+ZOK4hJzSaNLjkIdw 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)(1970100003)(117636001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(5660300002)(476003)(6436002)(2906002)(54906003)(70486001)(1076003)(9686003)(97876018)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(8266002)(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: E+A6BVOCD+VDayczPH2qOt4LTeZUucotoYXZjUcoaVtGF2WycUh+ZoaEKCmz4NxQhkSJ7aPIPXd/GXpyeaTHim7Q63CFKX9cu9sGpjnoymvUkMSM+oGME5NgFa39W9Hx/VzIemPaNtah51BpdxZ/T7XzoHN6pv91RCUnMibWirN+at38rFgNFckUN8M1Geh0y3ey+BhvOy0vSJ2ParQE9IomRLyHYa4owPYErr4ZqyVnrinGYgLsIiqjjLLzP4FpqAq5Hmqrto9UaJk7Z7/bp4PeECgabmS3r5sHLqydM2WjJFzhRyEdu8z3UI8+xbDJMlxwzCHwXAvGbuTKJl2RsMPdAL7KHPVGpf8Iatv2bHUuGxAZ60JQmj0QVee/Y1+DTdj0MYue3QpKJroTiW7j5Yc6Iu1bpukPZhKpc4FBFy0= Content-ID: <83DE0D29CDD4F046B36B85F9615806AB@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 533dc7b9-6ae4-4055-455b-08d69e03565d X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:04:09.3929 (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_210411_334438_BB58BD4C X-CRM114-Status: UNSURE ( 9.64 ) X-CRM114-Notice: Please train this message. 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 To avoid memory leak, we need to free the page for MSI in dw_pcie_free_msi(). Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index a94d3530b694..abe3ff5f0867 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -305,6 +305,8 @@ void dw_pcie_free_msi(struct pcie_port *pp) irq_domain_remove(pp->msi_domain); irq_domain_remove(pp->irq_domain); + + __free_page(pp->msi_page); } void dw_pcie_msi_init(struct pcie_port *pp) @@ -322,6 +324,7 @@ void dw_pcie_msi_init(struct pcie_port *pp) return; } msi_target = (u64)pp->msi_data; + pp->msi_page = page; /* Program the msi_data */ dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4, diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f6fb65a40f10..3be7ca9f1fc3 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;