From patchwork Tue May 28 19:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13677259 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2072.outbound.protection.outlook.com [40.107.15.72]) (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 4FABE17B410 for ; Tue, 28 May 2024 19:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925183; cv=fail; b=hJ2ElGis6GfzS5BnUtWpFa7N5FeNut2o777FoyE78EqIZT4nrwAkbGxvd9DEC2aEs5hss7KU5DQqcc3xkOlzVcwfcr5YyTUEUlUGrF8LcO1m5ALkDQPO2zVqZCK5u8kRW/Rz+YzJS6L7ncQvCHUPGrY0gLghmsUOiKymrxxOmq8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716925183; c=relaxed/simple; bh=xuuFZZmFwLzfr3EwP7rBkaowEqdCoyLdbmk+g9T6uJ0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=EuiMfqLyJ0dPKTExdI4XuVjNLzhcl2FsUgOilh9fREnWHc9uscVm4gmui7qSw810z3Gt4waqOglsTj0VPzGnnjQa/JQtOvwB5pIHsCQiWZF2gRJbw5qk1Gye3qD5+aEbjhvmBnIxC5dCQ4lgti7lFSK7HPrmE6hcntGPLIunVXw= 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=SWd7kaGb; arc=fail smtp.client-ip=40.107.15.72 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="SWd7kaGb" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJcotbGmPoo5xFqMSYaJgETR4PvotE8wYYogbxCfBmuXzWII4eKXl4uzQVxJVtbWFGJpT9tLBe3vqKxKi8civD0jN9rf2lX+nsmd/rCzkOzBuZip3vcmQj1pfBloS/Tvjdjrv3vK168PqRFUiDsi05RpZXD81IdPUgWOHix1V0k4WWC9PNx+T/639xGRZEvBEdJsKyi2YYzWkb6WBnpCKocBjejZlEgavZryU26UegOPqYlKOPuJmQxGrXPT36IOtmd7a75OuW1OziM9axkqPUHfIpj+6J7kLPvlEg4EY8z5QerYd4WW7yFK9b+YTyqPGjaDrR2iIaeRwAUrFnGpqA== 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=gusIGSYkHi6d8e7/P6xrgDBiBJjdKRaehtAk6+gU0hQ=; b=ETHhJLg7mVw7VV84+ktTsocU4vguU1OIP1l484rKaih2+3Ge5o8FVT2mXHsIGbz2s4xElub68SWYxDAX5yOwNuQN/rwViTsEG4eoKONGcDpOOh0s5M//OQ2BzDmI6WcLVaDkLsHklDHVkFtB9YKYDiEdH4+VoHPhqFSIJsxP9JSjzDsunWZRS5nItn/07L4XA5R2WBFAUekYStJFmCGuzPpYWUUcTAXwIlHQ0wUdpj84zyKbxNcxIN2jMf9U2uHjGg69GfbPqrWNf3ONXAbXt3ti8Simwnx0vgx+c2r/EjLCFAjGlsdxoXBrR0REsNMqwaKfkevVN9F28JxBPyxypg== 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=gusIGSYkHi6d8e7/P6xrgDBiBJjdKRaehtAk6+gU0hQ=; b=SWd7kaGbr+dnGELY1QS+aR4z87fxX1u0Kk/PpY9tXorJFOV4/+g0y6NX+e0ktg+OYjOZj0KULSqotZunnC8aj+rM1INfierfi3X7xQerIekGf0bb3N6k2f2qnRWjMEXzfi3X/pNaNu8DtjmD0hQfHiSrUlYaKV67y5APunhT+MM= 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 DU2PR04MB8663.eurprd04.prod.outlook.com (2603:10a6:10:2de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 19:39:38 +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.7611.016; Tue, 28 May 2024 19:39:38 +0000 From: Frank Li Date: Tue, 28 May 2024 15:39:15 -0400 Subject: [PATCH v5 02/12] PCI: imx6: Fix i.MX8MP PCIe EP's occasional failure to trigger MSI Message-Id: <20240528-pci2_upstream-v5-2-750aa7edb8e2@nxp.com> References: <20240528-pci2_upstream-v5-0-750aa7edb8e2@nxp.com> In-Reply-To: <20240528-pci2_upstream-v5-0-750aa7edb8e2@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=1716925161; l=1357; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=bSLzEn4WP2o59goDiJt0y+MAE1L3Qob46G2eyxAvsHE=; b=IHsNuLI9KEzqmFrZ9uY6rFIOIDEULpHj4gLoVzwGoipaIvI15rHqC4QksTp2oodPmdD7HuDc7 d17TQt0FG1pBL5u+R0mkEO2BIJ6O4ip30Ooc+UIQWrsYCI9tJ9EghA3 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0021.namprd05.prod.outlook.com (2603:10b6:a03:c0::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DU2PR04MB8663:EE_ X-MS-Office365-Filtering-Correlation-Id: adb3b20d-afda-4ae1-f692-08dc7f4de982 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Ouft4aMCpBqMIYZNI6gIHD6SrL/fWmo?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Y?= =?utf-8?q?M+4ms6uBZNI/EY/YPiKgNaNve61WaX1TuxDP2zKKm2Ir83aprcf5rWQTuCJFBFxak?= =?utf-8?q?4HxDd4AVwpTXNBb6PzFe7NbYeTP3+x/hkwrGSILAH/rjEgJ+hO0H5+Y9htJilrJ7l?= =?utf-8?q?lZ6aoxvSbFI3v8nVnDN3dGUtdu/CFzab30sbKbzqEeXKmtHHzUf1OlRTr7KFExbjq?= =?utf-8?q?YUDAKfyNUEbpF1YlNnQeD14SR7QMM3oQdjFPpMqFIjaTtJpwXb/+AZx9rvDaM2Jg3?= =?utf-8?q?1B8Rp8TVraOoKeamOfLJMvq8vMbOeZJrnoqd1UWICz86MWc2X2JuSx5iNOvoL1q65?= =?utf-8?q?XhxkJhi0XhXiEj24FuGlm/1wny68y29R3Y7zI+kAvXhmADlj+W9tFEI+cB1viPtUX?= =?utf-8?q?a0p98l+IRrkrW20X36chxMLTbHNqFxtV2kX55nYYjLYO5uv32kKDV2s8=3D?= 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:(13230031)(7416005)(376005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?5c6Vv1w8XBDJHg3mNJDgx4sd7+QM?= =?utf-8?q?5KS96r2ehX400EN/so5N3onnyCAcWnxkB+IIvPmV7ooF9CslDPll7iFrhc7kCYDNB?= =?utf-8?q?7DNbvs4BS9Kk0a3PKLbEk1fxJG09cFyBCx/q8dWCX/pdEWYieWSgCYIC8EPW2UDx8?= =?utf-8?q?fyrd9BFVU3LYyFtJP7jdbhaIEYVgej8BcUKSsIPrrC77dFZDj1r+8LykFWyQW5iih?= =?utf-8?q?sALsmPpcGoIaePq7X0lqVxSRkxuIIZ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/nDQ/i9kpebOuof+wcs6ayIPBVsjgZrzkcWaBUhXZuTp?= =?utf-8?q?BOSijmFHt0xWEH5kiBzzeRoUuSkhpUFiPvGFTJNt8w4eE4SsSVxp9VZLdePo/OXc1?= =?utf-8?q?VB5K0Z4ZW4fdDdS6YykcMqXuQ7bCBrjGhJKnhZJGzGwaoE9ERSr/QfFCyxHoKoYRT?= =?utf-8?q?eOnUVjaap5jvOFsHLeh8tHuK7L/QTk+3HT2Jc1R5W/GeldNp6BCVjKWfWs+6ZxiOI?= =?utf-8?q?MoEjFLEblRbDorGDHUKcAR8qrxIHdoIs2y8+q6xDb31Jc3DRbj5cbE+2AXGwi3c0r?= =?utf-8?q?u6Zig4UpQwryyjYzdUXrvXCd39VVAcTe2L/99F/wTt32uqL0cjjsKzb/r1sMWOZjQ?= =?utf-8?q?SKJxYw+MAqAGTHv+InggUeeZ5grvcKGoHFe2LnbcvwRaDo+zINEXVGkk=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: adb3b20d-afda-4ae1-f692-08dc7f4de982 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 19:39:38.7414 (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: pojKYAdk7pH1sdqgZsiDHqjyHbNPleQIDW01QSHE8/qbHLL9a6RbmGBlSRvFLdgkMhQ6zglxlqLFBTHSboQGbg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8663 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 e9a16083d79d8..282261b2e28e5 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -1113,6 +1113,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");