From patchwork Thu Sep 24 11:05:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 11797037 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1DC5139A for ; Thu, 24 Sep 2020 11:10:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCA1B20702 for ; Thu, 24 Sep 2020 11:10:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Synaptics.onmicrosoft.com header.i=@Synaptics.onmicrosoft.com header.b="hw3dFdzK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727654AbgIXLKE (ORCPT ); Thu, 24 Sep 2020 07:10:04 -0400 Received: from mail-bn8nam08on2046.outbound.protection.outlook.com ([40.107.100.46]:62368 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726444AbgIXLKE (ORCPT ); Thu, 24 Sep 2020 07:10:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=myrwH2prxCysjqyRQ9NmsYKefdx6EODWmyKSiBkdJtjkP8jdNkWlQxd5GQ9RhOGUpNErPhkg8n/RANEnONJ4ha9YqSOtkklPYcRz/CBiuWejQdjyImM8JYyl5fADdU6StTryz7wrPjnSvhWgnf7BZPD1plmeRBXtlz4qK+7lGVPS6Y/4Ev0E5USerrUVJr3YkcEhQshe+2BLxja3RmcHlHnu4cKCyRi/jArBXJjAnYEAsi9GrNuNiFiCVRij3YmvKS+0pCxJXRgdfTLqhihCJYhozp4+Oe3KpTlLRErFpKwH4gKSgCE/FlvhrwfDziIZM5m62vHs0h0SDR+ra1KkAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4gr8URCQhuY2RFqeQmkI6Ro4/AoeXVwtQdjg2RLYvyI=; b=NM6mLQfxnoAj1COvU2IGRKDtm+RAc58kyQywpmA/KMTTHnQ9tiRidysor3272v50kaKgrZ4+emzmf7UzQZG2+BwlByXQkaph1O/xZ25Av5RmcW2mw9aLI8DBAy1dQtpqVP2dkirrZMFQGDZ0tOzN+6kAQxuwFDTJjm5v2AYOGtLRUnegOaIsO/j+AERdoZTGEfUJGgra9PcoQrz6jflGnlhJpd8GPuN3D5RgfeOt4j4/s4lUs9foEXVtfKKyT86GAMn8SXSE5DJeCfV1bySCr3o9cz3bUyhBedB2QnT9IimI0eo7ITbJQs1v45pIgIHGXnCsBqjmBkwy036ejEf2gw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4gr8URCQhuY2RFqeQmkI6Ro4/AoeXVwtQdjg2RLYvyI=; b=hw3dFdzKT/m1Q4gd5j+bgyDBkJgEI7QnrDjIlZvgZ8n5VbDYw8ZAE+NO/dBB5ZAtjetqbC6urgpj/abyu8P6wFZS/AWMMiD/Jwsg5xC73QKmRI1zkLLbabVsc+ZFa+S04kenMrSTiC+KfhkjnsOGSbvg6CnQS1dbB9goJIweIH0= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:10:01 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:10:01 +0000 Date: Thu, 24 Sep 2020 19:05:57 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 1/5] PCI: dwc: Call dma_unmap_page() before freeing the msi page Message-ID: <20200924190557.48fddba5@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:09:49 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 97e6328e-44ed-4b53-ea52-08d8607a61c6 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:341; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YLRK+Q860l81NtKAbjitc9IGolFRH2/MNFk2SU7s2/CkGHmGfJNTJsn60BEl29d84AT2Db26qrQjNCEvab3Bp1dVzqzH2o14UoUEQcJaKm+AfLgXg7udxbTuIgcBuQcCjJGxklnbq3i8Wt6wWi0pbh50nrOTJ/IRIC8C8GxvIloFHJQxm0Rd3c1rh39FCocssaOTjQDTSiAyV9GjXDgUbegc5H1StWugO1dPEow7/MIGG0JJgnfmR2RFaVP0rdFwt4MrClRvoTF8LvGIL6Yp8KRdLwSYO5yUSn7s2gLxAgOsE0j6cl45+a+4qAqr5mUY1FfLA2qDEkuuU67EIG5UpLvDBbJdqh36Eg2LENnypjgxgVGTrANAquXLPMEqaSxe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(86362001)(6506007)(52116002)(7696005)(83380400001)(478600001)(5660300002)(6666004)(186003)(4744005)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yBWSSQcE7+pQD/oYeVrS2GjzUN0irP0sYfuE8WT/gNfUdqPS2PXR2j0al1rVRoxbJef48hDMyFxZSJR4I7uv4Jyk2TwYgImaNcv1eYobXecCf9ju3tuYNswY8iSte4YSFZ3SSkSVHEf+MW0kHpygUDpeXB6N20r7nYYWzAWULFaGUtnujjTBEYLyf9MmarAvjG9OSs5oRF4oFKsfCFPBtus3JcBNN+StqRnsbxVDF2KhlUZsAuwnSAMiSOwLh079PgmIRZdx4V+Kvs2HcuA38QU2enPQpkJQKx664DIAo7vNqR5KnvHX39p6b6QhcP83K3htVeT1MA8EdaKd3LfO9T3eO2yCskjhmqWBdXbPYD4o5I4jcZzFFxubN+E0H4ENeyM7aVCg3VIzRdvhJj9At6nnEe60Dcb5QQxCY5SiZeyx0dqq2x7qX9H8uZ5csU2zWgGtWUc63WZqbwm966BjUXai/t1M9TXU8SNqiF/NV5FVBVofPAHTr3QYifKdUQmdx+ccJ7c46DuYGJ8SYosR7ZivpOxdVi+4CNjDrgsxL30oxlTKcGpZV7+fiCb5KkPfhuLLxMs9uqUay/r741atUoxApFkk8MaEMmNt5jq5GNGtDvuD5TSS6NnG/ZNoI3ipMfG73U2bSR+zVvBjbnjPkg== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97e6328e-44ed-4b53-ea52-08d8607a61c6 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:10:01.7916 (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-CrossTenant-UserPrincipalName: M6VpEICNadgMOphZdDbgMYnp3pOfn1ZKvcUI35slE0RXyQnC4/3nQlMoXR2HuIPnmzQf5Naix+x59047xx+VGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org In dw_pcie_free_msi(), call dma_unmap_page() before freeing. Signed-off-by: Jisheng Zhang Acked-by: Gustavo Pimentel --- drivers/pci/controller/dwc/pcie-designware-host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 9dafecba347f..0a19de946351 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -288,8 +288,12 @@ 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) + if (pp->msi_page) { + struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct device *dev = pci->dev; + dma_unmap_page(dev, pp->msi_data, PAGE_SIZE, DMA_FROM_DEVICE); __free_page(pp->msi_page); + } } void dw_pcie_msi_init(struct pcie_port *pp) From patchwork Thu Sep 24 11:06:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 11797043 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 468CE139A for ; Thu, 24 Sep 2020 11:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 20D032396E for ; Thu, 24 Sep 2020 11:10:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Synaptics.onmicrosoft.com header.i=@Synaptics.onmicrosoft.com header.b="Jk6IOAGo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727386AbgIXLKg (ORCPT ); Thu, 24 Sep 2020 07:10:36 -0400 Received: from mail-bn8nam08on2080.outbound.protection.outlook.com ([40.107.100.80]:53920 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726415AbgIXLKg (ORCPT ); Thu, 24 Sep 2020 07:10:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bI6sZj9pjliX3u3QjifeWsBYi2gdtehhL8OkVFqpYWLP+Virgb6RRd4CXIbXrxdAQvnYQFC7fqA7heLKSfXXa0EvpJdq5qOUYdxBRmq/nSqP2ErAT3NbrwxjyAYe4mZyT+tKazfEiZ0/53leSZyVDC4BD5hbX7U1XMy7/AZJxeUlr/L2F17fosMJeAcf4pg0q26KcsuLB3e9Uz52456KtDdhtKtY7pBMzxmy06X63j785aA+En3tQ652JJpsQp2uw1svdesQkOx/ByXgVAZQxLjZ0IktY31EbWqaJpYmKREBNpcVbWvtqkftlq+yCWsynlGXvdxEDw8fIngGe4l0qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Acz77/pflNcVdEV1U42qoD+DQZydsUzkqwBd3G+9rkI=; b=VKZN9Pjtfenp30Da1UlrbguJvYtahjcY19Mhcp0DYEbt68GTp2h+anXqerIMMd6UrBMyK/D5jknakNQ6juAryvcBH3dBSATeJxFV+yHVHxmPOJz6biz5zVZoZuDoQLWaqTRQjMo1AvUMEHR697xaJqxOCDfmrawRME8TgXHu4YIPeKQxQZmGGeK59BeoHZoRsflIdj5zIxa7rKcCCYlQy7b2Tn4zckpSMQvhRtADsK711GCUa0AI33X6j2ONO1z932kkZ5YTuSirQheWXbGamPuA6brryYb4yCkQFelgv4rrPbGDQ42Dao5JiOeDMAPIaYB7nhkMhc2fFr5/kh878Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Acz77/pflNcVdEV1U42qoD+DQZydsUzkqwBd3G+9rkI=; b=Jk6IOAGo0hMtAydUGk9ZxtjtDZdCUH85ScOE373R27xi1fxiFBSdoEk4yIQ7P8RkRQJN1OrNtZ299rFBNrOVRKei6Qs5nVeY+75ZnYm3roShaCxI+zDBwgPrkRSkyDXtBDTG8OjZcESVVq8WiaqjAMITnXYLezE/VMuedOzdC18= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:10:33 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:10:33 +0000 Date: Thu, 24 Sep 2020 19:06:23 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 2/5] PCI: dwc: Check alloc_page() return value Message-ID: <20200924190623.3251c2ac@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:10:21 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9297cf5e-76d2-4fea-a169-08d8607a7492 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1051; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t0btgccwOGojDdAaCv0wgZnNV7PTN/TCuiwSg0FB6OVX9+F/Qk8dnVynC0N31ulPlq3OK5gCgp44WWNxEnSV0PwsP9v3PVu0zV6g1JUPI0f5GT7nzTg81bBOnkFIXUXO3YY04SJ/NSx3MCnY/ZVbeMz6sb6xRQZMma311tRKdi26KUVdUEAFx2dtCLuUfzcqoWyKnj6mIHDu1JGLO4I/mHphOC18G7+HqsJXMbJSQ6vV/oi0W6uapMruuD/ES3esOyT/NIcQ4UJKI+zroy6IsZYx6ZEc9+Fq/6BgiibfIhq3NECEqOzXFvRL9iPGbOrQZlZEQHDk9pvst6dItYg5FFzbZy8/UJXzmEA8NuXLWxV0lB2jT/N8DLb8SkgfgCyX X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(86362001)(6506007)(52116002)(7696005)(478600001)(5660300002)(186003)(4744005)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: ThZuJR8ax+hGtWKFSItGEbCRsjR1hkm8jqwn6FE6pwMjVlNErjiiAw7/3GqWJMZKyZ/xBy2Wo0ARd1VoDZCzNPQuzumlhDOnebY0LKZV38005FjqPYn8wAq/X1bzIven6vOjB+UhHJqlAbZjXyafJ3RQajm05duMupTMqWOkuY0iDTwBP3FUEbo/QAlCZlsQL9IxfDp7LRaBxyvF6sJJ/td832GaqDajF5Kf6AvYGOhxIorC3DgXiCeqT8B7nqGcNEE7scN1UC1BL6vGZ9d/YA6DudNV0Fe3b2b0BuMt7pPehY6KrF1VnGJykbExDFHfnF633KEo2FhlswFQek5byOtC5Ay9luGHpjyvfIywmTEaC1oHy6JerSI2ebDIZaksi7LaHUt64bkLgxcKCHuycCWJYJ46sNgMXbbBAKh8pffyhEE/xST/MH6RQejJTAn4GIxz+c3GsVV1V2jGTYMJjvxddIxyZ1XFBZB5wprziBlbaKcyk9HqvtaD0bwef7P9EifDYdi50jZObmq1ZuiwWiOGtq8TY0WzcQChFZ+nVPsMLmgjv/SurcIeC4Ej44zKrk4Z/IO6zsD/39NxBYW3cbam/i6XC8CtPiXjUIwgSjHKoMh3W0xHMSdHeED0ryVopEar0gaFYmk8a+36QHcxXQ== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9297cf5e-76d2-4fea-a169-08d8607a7492 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:10:33.2917 (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-CrossTenant-UserPrincipalName: 0KdVNy1pp8q56TtyKEyqSK+JlCejxU8JAZeVAODVEtdXvVukYoN8MgZuqQPhZRWeP7SO7vx7BL8tuKJ6tiJ0yw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org We need to check alloc_page() succeed or not before continuing. Signed-off-by: Jisheng Zhang Acked-by: Gustavo Pimentel --- drivers/pci/controller/dwc/pcie-designware-host.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 0a19de946351..9e04e8ef3aa4 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -303,6 +303,11 @@ void dw_pcie_msi_init(struct pcie_port *pp) u64 msi_target; pp->msi_page = alloc_page(GFP_KERNEL); + if (!pp->msi_page) { + dev_err(dev, "Failed to alloc MSI page\n"); + return; + } + pp->msi_data = dma_map_page(dev, pp->msi_page, 0, PAGE_SIZE, DMA_FROM_DEVICE); if (dma_mapping_error(dev, pp->msi_data)) { From patchwork Thu Sep 24 11:06:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 11797013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C523F59D for ; Thu, 24 Sep 2020 11:09:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 96020239D2 for ; Thu, 24 Sep 2020 11:09:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Synaptics.onmicrosoft.com header.i=@Synaptics.onmicrosoft.com header.b="RbHSaCf0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727482AbgIXLJP (ORCPT ); Thu, 24 Sep 2020 07:09:15 -0400 Received: from mail-bn8nam08on2084.outbound.protection.outlook.com ([40.107.100.84]:64678 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726444AbgIXLJO (ORCPT ); Thu, 24 Sep 2020 07:09:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NN63WzLqfgiVjMApbMdERdPzHyYwwpTblAlGcK/aY/jdk0/w6t4MXo9ag3jfu+omCFJIRBRiWs+Ays2p/1d3HwuvhllxVOtg5gUx+6mjMoEjzgOfZuFdimh/EUewDNfrZqCfz5c/ogrrTU7gr59E2vzoc1Q+3iUIeoZzEWhxccEbfw02FHIEgcXiMJGowC8aFbZXbhtCs5VbPDWEmL7ruPeGglD8N+P7T74E9vgY/CFGc45lvUACTOvwclTScSEFmDedqE6OdZjW3BBiYLKlfocDmIGrYj7i8X47t2cpg15MQOINpwwNMFdZTO0d1wzF2RJf7OlZj7LlRVGPF0dTtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gUNQDYZ9rMtqPs8FD/2qndtHl/sKXX6XLTpbfHpTPjI=; b=PISMAJ5/xIASxQ4cc6f/OK++dqy0FwSJlTMRsZ0HLHmIfYmlYmvVGfiOckh3/u1tYwHf8MpAyYIgBBJDp8hwXsKbxM4e5dH+irIWr3GVA/zfSTW3CRniR/YL1FHwCRjAVAm8qt6m69pVEr2+PmpJ+wyOUAcmBC5ybb3ErLhJn48sIJhHew3uw8q0REvHs+yKN0D0I9eAbBL1E8nkAG1HyypL0PAdB/S3ZQk1MUYXn2dAQfnzuFSBBQIHQ0Gl9tAN7SWDFaOx8myZSrhhn7cxWO8nwX0YSlj28Aaa6J5bX+az8ALQlBSo0XogMHhiZnhXRjuCA7ogGUA+uPqjyTzewg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gUNQDYZ9rMtqPs8FD/2qndtHl/sKXX6XLTpbfHpTPjI=; b=RbHSaCf02xATKfDCh0a0ELsjV8gKwRsr3FwT9W/A+xUVPdZrWnFOGhYMyHgCeuzAbkZzUQO0mVDFNg3nLZiHkRYGMT7Rh0JGgfX8PqCS8sUkRSxm122+CDPctYHUzJ6k3yD03cJZHrWSJGVAfR/b6ha85itEC67wEGd+QdPdr+Y= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:09:11 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:09:11 +0000 Date: Thu, 24 Sep 2020 19:06:50 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 3/5] PCI: dwc: Rename dw_pcie_free_msi to dw_pcie_msi_deinit Message-ID: <20200924190650.24c0ff8c@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:08:59 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d82951b3-e5a0-464f-600d-08d8607a43a9 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3276; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c58m6BnVFVuqq+u8mtMx0QULUVIkBXS8UUTKjHsQk8GLzJgSYdeLrePi+33M9QnlKO+KAT036xCrCgqQ9a36FBchaZ5YgZkdh6YiQfpcAh69bY3GGI4kK23rgfEf2h0Sh0fucoACMDAt1KPFpOv3tnUnGwSO8BTjNMhel6ZSGCcjvVPtNCviJ1OlFIGM9ZF8eR5RTTA+xKWFUBUSOr5SHYXqOxvFzxFuxvgO26UheMPf6HNA0bn3r6+fAQN9C2E5+34w/9BKV3fILQZMRci1JmRrcyJAbPnSsYawrnIAIjw0VhmOUzleewsL2V58AedJNiHlToZ4PP8hpEyxQ4GsKXelvtuTQeplqJGox6BosqivGaZG1ZUfgAub5LGveqgB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(86362001)(6506007)(52116002)(7696005)(83380400001)(478600001)(5660300002)(6666004)(186003)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: V8596LdB2ey4bVQREk1T2QDQ+we/64vEdOEbR0tk32bMl6axDZIUbgnTkru6Y223GYnBaYqDMJC++/W1UNbu3mpQUSrVcS50wh6+OEET3K03Fg+QNVVQO3JxMa/ZS8KO5AcAUZQA1sLg3lxThKSvN4klRA82ed09RTe67F2O1XxfwGY/K70IJdNn3rwQiFnMeuLd026qk4Adj4uxaj6sE6rHxsTRJ/nNB9WWGEO9BNp9df8G34CQtYE9JjgC8OdktiFK/tWXi5zuXfvjK4I8OuFfjqFsUiTkbmFlWBxMV+SGqJUcxX+IQYeG/yW1rJG+bb3RZQ1B2t5cVxwcFONuAwIzWQTnb6Ji5DXouQIkSeIhCF1pAi1jTXS6QgzuWbi590cMYZypDstRDixIUT0Cnql3Z3+VK1LXAjkvaesI02ZzYyIn/HQmDX3CjIbRHBj6din1WHBePqrnFlnB2wma1xEJnNdi35Cqng9cdb9Y0muL1wWx7vjN2O557nUGdUL4NCLJ2SWEiIRChb+6xE8jS47SmCrNXw5VgPmapts3QNojwgYr+iuP2oPfaM7fIsd/nKdtzKWjKJbcyA6HgPe59DP8tbDOqsXQ3wKyfX6MvbAE6d6KoKvaFA+iTC19/9taONI3haGATtsHbHtDkPOv7w== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: d82951b3-e5a0-464f-600d-08d8607a43a9 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:09:11.3883 (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-CrossTenant-UserPrincipalName: IXafrv2u/U7dpykpeXQ+d8GzArDWb+WRVaJ0Frhb9VzfeMxXZPpOcLbZRkmAmNhtMKzEd/fNkE2g1rcNW1B4SA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The dw_pcie_free_msi() does more things than freeing the msi page, for example, remove irq domain etc., rename it as dw_pcie_msi_deinit. Signed-off-by: Jisheng Zhang Acked-by: Gustavo Pimentel --- drivers/pci/controller/dwc/pcie-designware-host.c | 6 +++--- drivers/pci/controller/dwc/pcie-designware.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 9e04e8ef3aa4..d2de8bc5db91 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -278,7 +278,7 @@ int dw_pcie_allocate_domains(struct pcie_port *pp) return 0; } -void dw_pcie_free_msi(struct pcie_port *pp) +void dw_pcie_msi_deinit(struct pcie_port *pp) { if (pp->msi_irq) { irq_set_chained_handler(pp->msi_irq, NULL); @@ -500,7 +500,7 @@ 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); + dw_pcie_msi_deinit(pp); return ret; } EXPORT_SYMBOL_GPL(dw_pcie_host_init); @@ -510,7 +510,7 @@ void dw_pcie_host_deinit(struct pcie_port *pp) pci_stop_root_bus(pp->root_bus); pci_remove_root_bus(pp->root_bus); if (pci_msi_enabled() && !pp->ops->msi_host_init) - dw_pcie_free_msi(pp); + dw_pcie_msi_deinit(pp); } EXPORT_SYMBOL_GPL(dw_pcie_host_deinit); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f911760dcc69..43b8061e1bec 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -371,7 +371,7 @@ static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci) #ifdef CONFIG_PCIE_DW_HOST irqreturn_t dw_handle_msi_irq(struct pcie_port *pp); void dw_pcie_msi_init(struct pcie_port *pp); -void dw_pcie_free_msi(struct pcie_port *pp); +void dw_pcie_msi_deinit(struct pcie_port *pp); void dw_pcie_setup_rc(struct pcie_port *pp); int dw_pcie_host_init(struct pcie_port *pp); void dw_pcie_host_deinit(struct pcie_port *pp); @@ -386,7 +386,7 @@ static inline void dw_pcie_msi_init(struct pcie_port *pp) { } -static inline void dw_pcie_free_msi(struct pcie_port *pp) +static inline void dw_pcie_msi_deinit(struct pcie_port *pp) { } From patchwork Thu Sep 24 11:07:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 11797065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 05D8359D for ; Thu, 24 Sep 2020 11:11:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF293239A1 for ; Thu, 24 Sep 2020 11:11:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Synaptics.onmicrosoft.com header.i=@Synaptics.onmicrosoft.com header.b="jvVYZTbU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727361AbgIXLLI (ORCPT ); Thu, 24 Sep 2020 07:11:08 -0400 Received: from mail-bn8nam08on2041.outbound.protection.outlook.com ([40.107.100.41]:27744 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726415AbgIXLLH (ORCPT ); Thu, 24 Sep 2020 07:11:07 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TM9SpLwEeg6oLi7NlR7/t0U17BLXanesMxkADL+MuVH+M6ktEoPoeG2moSTcCflC4G1uXx8Z0iZej5O1g5k2a/piWLx/Up1nxZcJXzVAGUdYpmwHa3B53CG0d80q5op70I12ei/1m799gI3Zm83eMRU2Qmee2oS+16OEzV1KbKcP5aOoK61cTEYKDqMIDuVrv0JV5m0nP53QCktg/uJ+OQ9Md6TnJqxHimdw6EpY5EBRq9NmssVE0o0bHSKMyzAD09pYUV6WGA/lH836evSvq0T00JmcqNQIIYuys1BK49lgI7kLdPIOaYJQw6Jw9M6JR6046enG0tdasih2YMR6JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HtOzPxEd2XeU73giEScASx6cZtQ7qwm5SynZkZNyfv0=; b=d8Km32gPvsWv5GSgOx6xv1YDPEHNhx5frjoj0RtYdtn9JyGHFp7kIv3qCTls3AK/3V4DcSz35CtzuUMBR2Vy4nbdFteutrMVylO2OTJVZ05A8xBmeNqHWDD2n2zrdtIeZSnfbOLqCYlOP61O62VOmZ+9yb0qhTRnu1RN3A6WAAmOpDP89X724U453F4JZvMYhAvhQiE6XTNpnY2i2/Z05I6ehyrq9OgFcF/v8URCk1iSaP00C1TwBh5kgv3oNDkWiT5aGDKvId0wVrWHA3jGSXwkEvc5pdfnUkfvy9rIrSRoIEllniu+XUeg0kwiI6Nb1nyUfkS4h4mHN6B3tOBG8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HtOzPxEd2XeU73giEScASx6cZtQ7qwm5SynZkZNyfv0=; b=jvVYZTbUmYw+cVvr5YLgwZA1fcpsg8izLMgVul4WxPtesI/vrOavkllKtgD4uiVx9meeA6i3+rvkicvWkIwdcMpTBV6eMZTsEsUiPXzZt4XCbhO9l6W2dXCMUvShUeh6cLz9645KdtiZMTo4zcu52w3u3L9AvoXiUd6fCo9Ka9Y= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:11:05 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:11:05 +0000 Date: Thu, 24 Sep 2020 19:07:13 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 4/5] PCI: dwc: Skip PCIE_MSI_INTR0* programming if MSI is disabled Message-ID: <20200924190713.74e0afd6@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:10:53 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cda9a7c4-8c37-4316-0a00-08d8607a8767 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:431; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3NcT+TuzlBmVhDbUoRrr/Zz90zWnbTyTIRe/P718GtIp2mQ3COxi/Rx/G6Y2Y5kQ/P0f6nWhVrnBtHApbUdnOIAx6/rFhqSa1NZ3ELJFC5pvSB83VfA+SvIEOqvO4KkqjMfYUZ9YV0mrqDNg3yPxo/YLbSF+yPgX8QN7QnBil6te2dW1imEc3TiK08Q9INs97ce+dqCFUoVHvHC1lvoG6JNNbPIDhitLxkGS83LHFC//cHP0oTtbW4SWtSEJ1DxEbQ0Ehbao2ccQN1bGGxo4EOue/Dz/kOKrsUQYFn1JIAlyFw8Onwr+d3hnl/ptMA0ssF+mkSie/uW3JWdJye6nbERt9y8x6s8kXLP1EbgjwjRU4W+GL+UMQ0eOWq0vJ4EQ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(86362001)(6506007)(52116002)(7696005)(83380400001)(478600001)(5660300002)(6666004)(186003)(4744005)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: pFUCKi/e3MQfScHMBXJ9XIE2toLno9ke/16VPQ0r2BBTTRdj0ARZlvU8jsq093gVo2+bRO6UlS4ERPNoVYomWctRX5gx/3Ra0BgOLZGaqEMACAlj8LXo1JLwevuFw4PmsPyIjBmj5oH/9ZuXsvOxAQDeDH0QNtEXuCdH4oXA565fHiTI5IurmEjaZ5nNqWOjuC34F4U6vU9/E7b2+ChSvqNZI4yNkkdaJb8Koclv+rDAG2hGvOARufIHosHYRwvLJyO3pVBDqUBfYQaZqrsH5RV25KVgk3muOAuz4NjY+QqaIkUE3AGa7CLlgEev6EwK44mNbO5wcCNgMvSaOoZXOwOWmmg4BbrwSktdSP5UEqMfwHJ9Pau4LGFGtlI3m++ysMORDoWmwDzcul4wX8/QmuevP4ZKQBw8rZTBAQiZzHfDU6MS6vNaH+FN0RbVxW95R6KpZ+C2buuCLfFlIjbr2e93L3KIq1xYgi9wLRB/E1wufrxX8QkifEp5fcyGeat8ywGcCOoMDvO7q/eGVs4MEC6RGbxbBXIW5ZyC36jj4rY9UNjajiGQLzC7VMAveak0VzyKp2TL48AUtsigacRv/HzABprWeeLT274Al1zXUjnUSCTnYLY5u0A/AZK+WqokatgdUVpVkqsPC+TZq6zwfw== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: cda9a7c4-8c37-4316-0a00-08d8607a8767 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:11:04.9087 (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-CrossTenant-UserPrincipalName: rqzjjtd3RED+PHw7LhAfPmrXAUeo0ginqVyZN95C2zUzEGVPRENa1r3Mp9vpjIbA/h+3x7kYG/wgPT9HeS5bhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org If MSI is disabled, there's no need to program PCIE_MSI_INTR0_MASK and PCIE_MSI_INTR0_ENABLE registers. Signed-off-by: Jisheng Zhang Acked-by: Gustavo Pimentel --- drivers/pci/controller/dwc/pcie-designware-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index d2de8bc5db91..7a8adf597803 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -641,7 +641,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) dw_pcie_setup(pci); - if (!pp->ops->msi_host_init) { + if (pci_msi_enabled() && !pp->ops->msi_host_init) { num_ctrls = pp->num_vectors / MAX_MSI_IRQS_PER_CTRL; /* Initialize IRQ Status array */ From patchwork Thu Sep 24 11:07:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 11797001 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0384D6CB for ; Thu, 24 Sep 2020 11:09:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA4D3239CF for ; Thu, 24 Sep 2020 11:09:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=Synaptics.onmicrosoft.com header.i=@Synaptics.onmicrosoft.com header.b="W8ex16ZN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727276AbgIXLJB (ORCPT ); Thu, 24 Sep 2020 07:09:01 -0400 Received: from mail-bn8nam08on2061.outbound.protection.outlook.com ([40.107.100.61]:62176 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726444AbgIXLJB (ORCPT ); Thu, 24 Sep 2020 07:09:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZE7r/R0rBVRwUHL1VeGAVaLhZKGdysgboTfmhIkefRYkjAK8+DMDbI7KfEj9fNdEgO3vPxsHZLMl5vxlkJhgD+wZ5LBO0Fc4aTq8Vb/X/3mODWXloFxQXqRt1iauQff0WEDoaoti/06tgXQO4t289YemLAIuhMlUc54MAAcVrWXQ5BpcUHMY0Tx7JhBWjwbSp5Gg0MbVU9lJHo0kejdM9q0eEtMuSKLmRtWICwl+FPEDL+LAnAcCn1AgUXSYZgEIE3LobFeizv13gbRklCOnRjCMHQtP4iRNBuRTmNeiVJ7wW5fNnPbyv5E+G86YL5GnWV+8K5P3ypGdFwG73W4ReQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=egHxvw+w9N0tvNHpaDO8CSDWOi3GV6GGHWZAPQoRtuc=; b=YnY4C0wpZ6ZeLtXZcQy2lB1LS/tj4+lV0VkqGqjw6WawRTo92kvuL4+thjkFANOHXVqYXDxu7IeRmNaontOvq34YI5QhaIXGjTMAQSizeYSPBhKkX7JVk1/O7b+pg4KMHEy2/UMA9hx54b6mAt3ehWCjeLYsrqTeCKd9Zi7HY6P9Bix07ktU67A61ZsYqAh/E0m9UEPKuxwjR56D98f8N8PmLAR1rMnaks12pGaoLtOZJHP7PbfYt+fzT0fQiXJgktOJTkNWve0u9bo/saEskDC9//VGrviJjCo+KxJZtp/CGJhoFpSfo+JcBwCyLAgw6BCmSSCHyS1/5E7hQqT1XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=egHxvw+w9N0tvNHpaDO8CSDWOi3GV6GGHWZAPQoRtuc=; b=W8ex16ZN48IvWrNgg/3qQVUwbpCePl0Fl4RP4HmmDdxQnkA+/+VgC7CHSV71F3gelXYwuVVp8eNJ7jjt7MtFM/5KqID7r0YJwUc8WK4AAQaFyQsYGQMbhVt9XZprbTujrAKmloX5rUPmQmsJ7+QRuMHjEp58iOUNDsm5D6gY7Bc= Authentication-Results: ti.com; dkim=none (message not signed) header.d=none;ti.com; dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) by DM6PR03MB4698.namprd03.prod.outlook.com (2603:10b6:5:180::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20; Thu, 24 Sep 2020 11:08:55 +0000 Received: from DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38]) by DM6PR03MB4555.namprd03.prod.outlook.com ([fe80::e494:740f:155:4a38%7]) with mapi id 15.20.3391.027; Thu, 24 Sep 2020 11:08:55 +0000 Date: Thu, 24 Sep 2020 19:07:42 +0800 From: Jisheng Zhang To: Kishon Vijay Abraham I , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Jingoo Han , Kukjin Kim , Krzysztof Kozlowski , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Yue Wang , Kevin Hilman , Neil Armstrong , Jerome Brunet , Martin Blumenstingl , Jesper Nilsson , Gustavo Pimentel , Xiaowei Song , Binghui Wang , Andy Gross , Bjorn Andersson , Stanimir Varbanov , Pratyush Anand , Thierry Reding , Jonathan Hunter , Kunihiko Hayashi , Masahiro Yamada Cc: linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@axis.com, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH v2 5/5] PCI: dwc: Move dw_pcie_msi_init() from each users to designware host Message-ID: <20200924190742.76939458@xhacker.debian> In-Reply-To: <20200924190421.549cb8fc@xhacker.debian> References: <20200924190421.549cb8fc@xhacker.debian> X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-ClientProxiedBy: TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) To DM6PR03MB4555.namprd03.prod.outlook.com (2603:10b6:5:102::17) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (124.74.246.114) by TYAPR01CA0072.jpnprd01.prod.outlook.com (2603:1096:404:2b::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Thu, 24 Sep 2020 11:08:43 +0000 X-Mailer: Claws Mail 3.17.6 (GTK+ 2.24.32; x86_64-pc-linux-gnu) X-Originating-IP: [124.74.246.114] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 950f8817-b4a3-49a6-84ba-08d8607a3a43 X-MS-TrafficTypeDiagnostic: DM6PR03MB4698: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uOBA/EWW6Sn2tsmw18k8nJIRW08dSetQAc8YWMA9aQ8fVxlVQ4+g41omqmKjEhTiy+W1qnrSRvEwrNSff9Ase8AHPSKLZtwqx49Gyv68PLfKL7O73qEM+amypm34hFyhB0AEySuo5dSMkLRAJt7rDCBPEydN+JGAGede3C4JmDWVwpDObiO1jUC4vLR3b2WbuuSQm8tCADjwFjNq77MapoikCbxIvCTMfEEZ2Ag2XP3R16I3A2Tp10QvPcauZQbS7wSjZqAsWWJL9g8CVeTercalZfYqIqBcimi8fbdux6J+/df3cqHhltDy+BYtKGklGPrz1wucSIOOkQ1mlvz1EFzh9tOKTn6eLFoaaYF1/OETJmiiZ38/G4LGwtE41MuI X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB4555.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(346002)(396003)(366004)(39860400002)(376002)(136003)(2906002)(30864003)(86362001)(6506007)(52116002)(7696005)(83380400001)(478600001)(5660300002)(186003)(66556008)(16526019)(956004)(1076003)(26005)(316002)(66476007)(7406005)(66946007)(9686003)(55016002)(8676002)(8936002)(110136005)(4326008)(7416002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RMlcwVeKDKiEtrsFAaYSr1uIYx+ljMIdpOqJ4n8kZbE+1xKsSZlRCVUMA+ev/EgO7x4dO0n1ZueApqf9AHB5TAo6a23nDadZat/RuidMWanoSEhtiZZhiFP/0pNB2QJlSCpmdVbS6shGP7dax+pDgitP3klrMwVl/ncLOUNMQYF4p9otoYQJ3d2MMjsyaAqkCF5C7+cEZMN4nZPM6MDIl6C5AW6edB0jRPTiFrxrQHmCQkcpWVD0CpH4FkMzAG2vNX2VM2j7ppUdys54spK4vdagYdL6lZuFwOJ3BkVdco7s5amBsOPtwwsaDv5gVanevqYZld8r7mg78KwP08YpDk4xHNzitfR9fXtu1rE0FOQ7s9v8WPJnwdztU/7WXH4mgHagmCQWR3xnh/k275grRmnvwYkFbi2SFe8dCbBiBm9IgxZcStF1vSmfo2KCJk9y9XmnZb3UED2nqN7aj1f16WYF7vHZYoATNIHvEMsGi5MkkwhjMYI60NtMQAea1GmNz5ao0ZhwgEw5Cut7yKfCET0zIT3TCTwEf8TuGt9xoV9+p1MjV28eQMj1Zkb7OyEs9yyn2bHJIL8ITRmRO19a9PEX9yiVjxlTJSxG+fuinKlX1vnUMsTHZ5FviMOvlNA325S/KazSCMLmrMwFx6OIUw== X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 950f8817-b4a3-49a6-84ba-08d8607a3a43 X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB4555.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2020 11:08:55.6822 (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-CrossTenant-UserPrincipalName: XPTytS6VDF0pwFMYxJZGwIxIqb7SWCwf77ORKRYIyr9oDX4MVobpNC8gHkda+kK5sH03dQjTvSBW6i5NDgqitw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB4698 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently, dw_pcie_msi_init() allocates and maps page for msi, then program the PCIE_MSI_ADDR_LO and PCIE_MSI_ADDR_HI. The Root Complex may lose power during suspend-to-RAM, so when we resume, we want to redo the latter but not the former. If designware based driver (for example, pcie-tegra194.c) calls dw_pcie_msi_init() in resume path, the previous msi page will be leaked. From another side, except pci-dra7xx.c we can move the dw_pcie_msi_init() from each users to designware host, I.E move the msi page allocation and mapping to dw_pcie_host_init() and move the PCIE_MSI_ADDR_* programming to dw_pcie_setup_rc(). After this moving, we solve the msi page leakage as well. Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pci-dra7xx.c | 1 + drivers/pci/controller/dwc/pci-exynos.c | 2 -- drivers/pci/controller/dwc/pci-imx6.c | 3 --- drivers/pci/controller/dwc/pci-meson.c | 8 ------- drivers/pci/controller/dwc/pcie-artpec6.c | 10 -------- .../pci/controller/dwc/pcie-designware-host.c | 24 ++++++++++++------- .../pci/controller/dwc/pcie-designware-plat.c | 3 --- drivers/pci/controller/dwc/pcie-designware.h | 5 ++++ drivers/pci/controller/dwc/pcie-histb.c | 3 --- drivers/pci/controller/dwc/pcie-kirin.c | 3 --- drivers/pci/controller/dwc/pcie-qcom.c | 3 --- drivers/pci/controller/dwc/pcie-spear13xx.c | 1 - drivers/pci/controller/dwc/pcie-tegra194.c | 2 -- drivers/pci/controller/dwc/pcie-uniphier.c | 9 +------ 14 files changed, 22 insertions(+), 55 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c index dc387724cf08..d8b74389e353 100644 --- a/drivers/pci/controller/dwc/pci-dra7xx.c +++ b/drivers/pci/controller/dwc/pci-dra7xx.c @@ -210,6 +210,7 @@ static int dra7xx_pcie_host_init(struct pcie_port *pp) dra7xx_pcie_establish_link(pci); dw_pcie_wait_for_link(pci); dw_pcie_msi_init(pp); + dw_pcie_msi_config(pp); dra7xx_pcie_enable_interrupts(dra7xx); return 0; diff --git a/drivers/pci/controller/dwc/pci-exynos.c b/drivers/pci/controller/dwc/pci-exynos.c index 8d82c43ae299..9cca0ce79777 100644 --- a/drivers/pci/controller/dwc/pci-exynos.c +++ b/drivers/pci/controller/dwc/pci-exynos.c @@ -298,8 +298,6 @@ static void exynos_pcie_msi_init(struct exynos_pcie *ep) struct pcie_port *pp = &pci->pp; u32 val; - dw_pcie_msi_init(pp); - /* enable MSI interrupt */ val = exynos_pcie_readl(ep->mem_res->elbi_base, PCIE_IRQ_EN_LEVEL); val |= IRQ_MSI_ENABLE; diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 5fef2613b223..dba6e351e3df 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -848,9 +848,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) dw_pcie_setup_rc(pp); imx6_pcie_establish_link(imx6_pcie); - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - return 0; } diff --git a/drivers/pci/controller/dwc/pci-meson.c b/drivers/pci/controller/dwc/pci-meson.c index 4f183b96afbb..cd0d9dd8dd61 100644 --- a/drivers/pci/controller/dwc/pci-meson.c +++ b/drivers/pci/controller/dwc/pci-meson.c @@ -377,12 +377,6 @@ static int meson_pcie_establish_link(struct meson_pcie *mp) return dw_pcie_wait_for_link(pci); } -static void meson_pcie_enable_interrupts(struct meson_pcie *mp) -{ - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(&mp->pci.pp); -} - static int meson_pcie_rd_own_conf(struct pcie_port *pp, int where, int size, u32 *val) { @@ -467,8 +461,6 @@ static int meson_pcie_host_init(struct pcie_port *pp) if (ret) return ret; - meson_pcie_enable_interrupts(mp); - return 0; } diff --git a/drivers/pci/controller/dwc/pcie-artpec6.c b/drivers/pci/controller/dwc/pcie-artpec6.c index 97d50bb50f06..af1e6bb28e7a 100644 --- a/drivers/pci/controller/dwc/pcie-artpec6.c +++ b/drivers/pci/controller/dwc/pcie-artpec6.c @@ -346,15 +346,6 @@ static void artpec6_pcie_deassert_core_reset(struct artpec6_pcie *artpec6_pcie) usleep_range(100, 200); } -static void artpec6_pcie_enable_interrupts(struct artpec6_pcie *artpec6_pcie) -{ - struct dw_pcie *pci = artpec6_pcie->pci; - struct pcie_port *pp = &pci->pp; - - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); -} - static int artpec6_pcie_host_init(struct pcie_port *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); @@ -368,7 +359,6 @@ static int artpec6_pcie_host_init(struct pcie_port *pp) dw_pcie_setup_rc(pp); artpec6_pcie_establish_link(pci); dw_pcie_wait_for_link(pci); - artpec6_pcie_enable_interrupts(artpec6_pcie); return 0; } diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 7a8adf597803..6603d7c36f2e 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -296,11 +296,23 @@ void dw_pcie_msi_deinit(struct pcie_port *pp) } } +void dw_pcie_msi_config(struct pcie_port *pp) +{ + if (pp->msi_page) { + u64 msi_target = (u64)pp->msi_data; + + /* Program the msi_data */ + dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4, + lower_32_bits(msi_target)); + dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_HI, 4, + upper_32_bits(msi_target)); + } +} + void dw_pcie_msi_init(struct pcie_port *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); struct device *dev = pci->dev; - u64 msi_target; pp->msi_page = alloc_page(GFP_KERNEL); if (!pp->msi_page) { @@ -314,15 +326,7 @@ void dw_pcie_msi_init(struct pcie_port *pp) dev_err(dev, "Failed to map MSI data\n"); __free_page(pp->msi_page); pp->msi_page = NULL; - return; } - msi_target = (u64)pp->msi_data; - - /* Program the msi_data */ - dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4, - lower_32_bits(msi_target)); - dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_HI, 4, - upper_32_bits(msi_target)); } EXPORT_SYMBOL_GPL(dw_pcie_msi_init); @@ -449,6 +453,7 @@ int dw_pcie_host_init(struct pcie_port *pp) irq_set_chained_handler_and_data(pp->msi_irq, dw_chained_msi_isr, pp); + dw_pcie_msi_init(pp); } else { ret = pp->ops->msi_host_init(pp); if (ret < 0) @@ -654,6 +659,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) (ctrl * MSI_REG_CTRL_BLOCK_SIZE), 4, ~0); } + dw_pcie_msi_config(pp); } /* Setup RC BARs */ diff --git a/drivers/pci/controller/dwc/pcie-designware-plat.c b/drivers/pci/controller/dwc/pcie-designware-plat.c index 712456f6ce36..9ccf69a3dcf4 100644 --- a/drivers/pci/controller/dwc/pcie-designware-plat.c +++ b/drivers/pci/controller/dwc/pcie-designware-plat.c @@ -40,9 +40,6 @@ static int dw_plat_pcie_host_init(struct pcie_port *pp) dw_pcie_setup_rc(pp); dw_pcie_wait_for_link(pci); - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - return 0; } diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 43b8061e1bec..40d22fe33afe 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -372,6 +372,7 @@ static inline void dw_pcie_dbi_ro_wr_dis(struct dw_pcie *pci) irqreturn_t dw_handle_msi_irq(struct pcie_port *pp); void dw_pcie_msi_init(struct pcie_port *pp); void dw_pcie_msi_deinit(struct pcie_port *pp); +void dw_pcie_msi_config(struct pcie_port *pp); void dw_pcie_setup_rc(struct pcie_port *pp); int dw_pcie_host_init(struct pcie_port *pp); void dw_pcie_host_deinit(struct pcie_port *pp); @@ -390,6 +391,10 @@ static inline void dw_pcie_msi_deinit(struct pcie_port *pp) { } +static inline void dw_pcie_msi_config(struct pcie_port *pp) +{ +} + static inline void dw_pcie_setup_rc(struct pcie_port *pp) { } diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c index 2a2835746077..fbf53e897ca7 100644 --- a/drivers/pci/controller/dwc/pcie-histb.c +++ b/drivers/pci/controller/dwc/pcie-histb.c @@ -196,9 +196,6 @@ static int histb_pcie_host_init(struct pcie_port *pp) { histb_pcie_establish_link(pp); - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - return 0; } diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c index e496f51e0152..d7246995daf0 100644 --- a/drivers/pci/controller/dwc/pcie-kirin.c +++ b/drivers/pci/controller/dwc/pcie-kirin.c @@ -425,9 +425,6 @@ static int kirin_pcie_host_init(struct pcie_port *pp) { kirin_pcie_establish_link(pp); - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - return 0; } diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 3aac77a295ba..2abbb850fb56 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1281,9 +1281,6 @@ static int qcom_pcie_host_init(struct pcie_port *pp) dw_pcie_setup_rc(pp); - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - qcom_ep_reset_deassert(pcie); ret = qcom_pcie_establish_link(pcie); diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c index 62846562da0b..760e27de0082 100644 --- a/drivers/pci/controller/dwc/pcie-spear13xx.c +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c @@ -157,7 +157,6 @@ static void spear13xx_pcie_enable_interrupts(struct spear13xx_pcie *spear13xx_pc /* Enable MSI interrupt */ if (IS_ENABLED(CONFIG_PCI_MSI)) { - dw_pcie_msi_init(pp); writel(readl(&app_reg->int_mask) | MSI_CTRL_INT, &app_reg->int_mask); } diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c index 70498689d0c0..b51fe136d345 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -783,8 +783,6 @@ static void tegra_pcie_enable_msi_interrupts(struct pcie_port *pp) struct tegra_pcie_dw *pcie = to_tegra_pcie(pci); u32 val; - dw_pcie_msi_init(pp); - /* Enable MSI interrupt generation */ val = appl_readl(pcie, APPL_INTR_EN_L0_0); val |= APPL_INTR_EN_L0_0_SYS_MSI_INTR_EN; diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c index 3a7f403b57b8..d7b465b669f4 100644 --- a/drivers/pci/controller/dwc/pcie-uniphier.c +++ b/drivers/pci/controller/dwc/pcie-uniphier.c @@ -318,14 +318,7 @@ static int uniphier_pcie_host_init(struct pcie_port *pp) uniphier_pcie_irq_enable(priv); dw_pcie_setup_rc(pp); - ret = uniphier_pcie_establish_link(pci); - if (ret) - return ret; - - if (IS_ENABLED(CONFIG_PCI_MSI)) - dw_pcie_msi_init(pp); - - return 0; + return uniphier_pcie_establish_link(pci); } static const struct dw_pcie_host_ops uniphier_pcie_host_ops = {