From patchwork Mon Jun 17 20:16:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13701367 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2056.outbound.protection.outlook.com [40.107.103.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FFEE19938A; Mon, 17 Jun 2024 20:17:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655448; cv=fail; b=u9M4bFj9bUZ7nbNSukt6ACoMOreNl6UOk/oA5CAFS6Lv5SMDWiqFF82jbyctalFBZOmDx9XvSCuhQG+Pp9Pf6rzsY3pH7SwfjnVgOQxA0liGprmNibYRK2ssZYh//FXq5rrDf8azqlPOfiUGaNNITlyU2ZjRVRMbUWVcEMrQip0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718655448; c=relaxed/simple; bh=EHyeS3eCsKTVfj4EEn10/36Iugqdn8KqQ8XKGyRIeGQ=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=VXKi8cd1RM+7rBM2fm0Bkr5zVR+nH9ArcBcuGxd1Iy3jn2OT2pB4cYaSDZc5AHSBF0uWX2B0ix58zHh6MHw49MdSO+mDxyO5pcC3Mb55lRGk3Zx+Z2IIzLHsPOV9C3zBm9ra+bOVAZNwcSxjDdiq4Ha9HBM6s2X9wweU/5PYJO4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=iT90QTp0; arc=fail smtp.client-ip=40.107.103.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="iT90QTp0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtaGXGO7AXZ1qVpYGELaYIdiG5O1O9/XyFZekMXA+iocJ+S8sz6pW0P6K5DNfd+00ulDUQd+yTina8sGa58PNRk1/UUs27AJmS+vHnD5hYL0KFKYfdIc8zaJ7OFw7XM9vzf1wMMtQbMA6bJc+W0pSeFULNYDJpqgw2Q2FkRJYMfLJkzhw/S1pS3vmbwv1CP51JTWUmQF+Z5tsucredKzrxEiQL715eAlLvC4i/x3+sDVHgGTp/NcUzohsFMH+9joWIfOy0fap9TSCHbEQ9k+bVXVXtm6pe/wCSqlWtKDcguhM7cxA/NC2eDlma8Vv9yQYtlQqlw3o7VRRdUO6J9XvQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UUBWGHoGKaKMGJh9TkXeHEMhc07ASjRiTyfpTUk9/iE=; b=co3b64GE7AU3c7ps5rF2QuGN3yD+Kk64xy1heqXsBXdnhGEtRL6+NWVIopk4QaPiwlTfEleKJ0UPYuj43bAt9dbuYGDUIScjkoZo7FyyIW6scN0hhWQ711eBuEsFVBbLOzeCSld/CvnMLpHUxAGPo8AYeRcFh1sYJjw4eVqf9AEhHQRNMUdlQqAgPvMadbQm2GdWkzdEg/akb4DZZtybXWIIR1/uUIVA7lBhICjkh24dTdk1NY7BQKkqQTOKCH8QiDWlfDc2oiv1/ihDCn5A+nPHaLT1w9lXZtkBRXrc6WjaiZcEHtMA84ddjgmuAdsrd3WNzTeregBYDkLYcFLDbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UUBWGHoGKaKMGJh9TkXeHEMhc07ASjRiTyfpTUk9/iE=; b=iT90QTp0PGvsvqG5erjGy4z+8ck7NmSENIH2zoV+oDQRLL64M/VohzD4kGlPFnNDtWJ+uiVVTOnNKhueIA2te0yTA314ML/KcBZ+u+MaRi02mK1fUiNqLFGMHmzhrNf85AL4wVNltwDlWwPzUxnO46wbM/q0NvPce4CezS0mi3o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by PA4PR04MB7997.eurprd04.prod.outlook.com (2603:10a6:102:c9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 20:17:23 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 20:17:23 +0000 From: Frank Li Date: Mon, 17 Jun 2024 16:16:38 -0400 Subject: [PATCH v6 02/10] PCI: imx6: Fix i.MX8MP PCIe EP's occasional failure to trigger MSI Message-Id: <20240617-pci2_upstream-v6-2-e0821238f997@nxp.com> References: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> In-Reply-To: <20240617-pci2_upstream-v6-0-e0821238f997@nxp.com> To: Richard Zhu , Lucas Stach , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Bjorn Helgaas , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Philipp Zabel , Liam Girdwood , Mark Brown , Manivannan Sadhasivam , Krzysztof Kozlowski , Conor Dooley Cc: linux-pci@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, devicetree@vger.kernel.org, Frank Li , Jason Liu X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1718655424; l=1357; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=0tg9I2bqWF9gd4zcaTOgOiV9PwF7bz2gPmS25zNUpq8=; b=icFYh2KCatik2YOeIh6B5e1BgU8Dz5wLHv0lscwqBENs3K3lUYYsTOO1g40PbcGJKFNGyBzrt foV+BgSiXYnBXDfeLPGP2+eswK4O5iPCG5aB5pHu0qtojZVDS+3SBfg X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0116.namprd05.prod.outlook.com (2603:10b6:a03:334::31) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|PA4PR04MB7997:EE_ X-MS-Office365-Filtering-Correlation-Id: fa98ef6b-76e5-48c7-0327-08dc8f0a7f67 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|376011|7416011|1800799021|366013|52116011|38350700011|921017; X-Microsoft-Antispam-Message-Info: =?utf-8?q?yT5J7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uS7kRKvZNQwwD?= =?utf-8?q?5AMd92Lq4M9d9taDocfaUgqdxlaSonvXDu5IZN548/9+snK4aJC4pMTFG4SXwyqqa?= =?utf-8?q?epu9JQEBfx7JWW5y6MzAH68DWdF695kcEalnwCLR4ngmUi6Y8KKPa7W3Lc7RaY2VE?= =?utf-8?q?MuZWld3lxkiye/upZPRASRmLbSZjJKU+DMaayuCax3sSxXgMHJ4kmvAv3brb44y1d?= =?utf-8?q?RyD1MX/mBd/1HgOHEyGf7+xhmQcNjViW+G0xr6hMT0S/t2ykD8CBNu3S1u7MSN+jx?= =?utf-8?q?+w2d+wYYmqdncFvP6YzqIoSZJf0OArIKuL91HejIQcVm+Zqzsgm+PAsT4rFX5oqZ2?= =?utf-8?q?Q0AAG5InHSWRstnBXgBPDfp23MJMUmqaXwDg6gCcHGv48wei8cBxlIfkXWh8AmiqI?= =?utf-8?q?h0yuxYE67cRB8fNlpyhB6NcPawTnRfZuJRlzyMPCmX2eZtfHjLfusQe3x+fFZZu2C?= =?utf-8?q?NeWM/UiYvkeO?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(376011)(7416011)(1800799021)(366013)(52116011)(38350700011)(921017);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?NmcKrDIB4pmZhD2dLXD+luWA9iPo?= =?utf-8?q?SkC0ULPE46eg2XiLqeHGJuvTpCxio0NXSZpVYJBtO2mB5LxM+hs0iSLtopa1ACuD6?= =?utf-8?q?lYJE7uiDw3RzlMFzMfxELknOaEw39mtRwJhRUVI/izjl4XGQ/LPjn6WcdPU/cabbu?= =?utf-8?q?bbwBQWRrlsbq9GQKpinjqXDjjkw63vtFPBDNcPG7fWVvsHmNpn0RNYdcDHKQOKCVW?= =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f-8?q?wuLjfyUuFWye/eY/Cd5RX2rOTx98gMDEPw1KZFBuZvZ5w28dZfu5RNtnGryMopjBv?= =?utf-8?q?58eQO6osGH0WYyswjTPjZ3eDSOz+VvZ1h/rv5TU7SX6hwwT+5Vihcpi4q3AjTXQpt?= =?utf-8?q?vo9yW/6aUCCzqdQz079nOO/6Bc3Vdqk6ANyGSBz151o0GoFws41WR7VUV32pIzxra?= =?utf-8?q?/ktQZqYtFGQUqTZ0sAqa0Mob6H80Ufdoi2XSp3w1kucIECeRXsROK7a8MWi9KrFuc?= =?utf-8?q?bozWe3xTNlD0LZLzD2JGx32w8JVhJUTQklLObUFRZ6WITxYZmu4lmHPrFMmfX5CcH?= =?utf-8?q?JvmBK5KcA9l/FfsSRdkd8llVDdSPLRGDwDzQ7N2mnFm49y3R3MSpKmO2NCrzv+MeV?= =?utf-8?q?oEsbQOrT79Play3WHv3TBktGX0xYctzuLhRZUF9B0dvOJaUbrBU8Gh+Xh8dQGk5oc?= =?utf-8?q?jnajwSM/k3+Z?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa98ef6b-76e5-48c7-0327-08dc8f0a7f67 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 20:17:23.0499 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FdTRYRJPlmPW1+Y3MR6cdqeo3pxcwZXY37Jq6XlcIv056HNJHxtkGJdHtEidak2aWvkf2SMN6q2mQJdw9dJlfw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR04MB7997 From: Richard Zhu Correct occasional MSI triggering failures in i.MX8MP PCIe EP by apply 64KB hardware alignment requirement. MSI triggering fail if the outbound MSI memory region (ep->msi_mem) is not aligned to 64KB. In dw_pcie_ep_init(): ep->msi_mem = pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, epc->mem->window.page_size); Set ep->page_size to match drvdata::epc_features::align since different SOCs have different alignment requirements. Fixes: 1bd0d43dcf3b ("PCI: imx6: Clean up addr_space retrieval code") Signed-off-by: Richard Zhu Acked-by: Jason Liu Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pci-imx6.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 9a71b8aa09b3c..ca9a000c9a96d 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1118,6 +1118,8 @@ static int imx6_add_pcie_ep(struct imx6_pcie *imx6_pcie, if (imx6_check_flag(imx6_pcie, IMX6_PCIE_FLAG_SUPPORT_64BIT)) dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)); + ep->page_size = imx6_pcie->drvdata->epc_features->align; + ret = dw_pcie_ep_init(ep); if (ret) { dev_err(dev, "failed to initialize endpoint\n");