From patchwork Tue Mar 19 16:07:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13596842 Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on2050.outbound.protection.outlook.com [40.107.15.50]) (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 664A05915E for ; Tue, 19 Mar 2024 16:07:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.15.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710864445; cv=fail; b=r95vtSRtljJSU2qMISJYxFIDAOE26UTCty4MNpNSynWX0FMPEkAFpstTmJFB5hlbS/TVXaGvVCecdReGtPFg8fdn8BM6Gz/asxf4AWHNtop7Rm9jxaKnjAE/cnIihx+bWt3wTC6FYD3ZJHO6Zumtu1D0jBsF1igbBCss54uVt+g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710864445; c=relaxed/simple; bh=JJXqx52t4SOPohvMnQLx1kp/6SCXWc6KO44Qih5BpVc=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=O60/hPwghPbB+ogupe0JEbx/rnC6CC5HtQYbavmeyzcBCHx09RfHrL6GpIEJUs14VyOvjoJbrVWuT8EG5EHLNME6McvcHcKCoj3DZFK+geWcK4jcV//mh4W/iUfPsdKYDf5SIlvOxLZWEsOCz4vt58gCvrzyhL+5C1vO0v2uih0= 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=fsjWrBdP; arc=fail smtp.client-ip=40.107.15.50 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="fsjWrBdP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kBVyIJ4zfycHNqu4jKNxjs6I4+c9EwTzfgutl8e7U0BniYKEPNtG68WG3S6CUhAhuHov5u/8f1Oy0ZTeQ6JkJB3crQAJdCsUaX6I1nNkxxlTSyc5nCh59EGakSX/q83/w6+uWQ4QtFQRLmHVuG/JGLKPQzOz0VvleBmPGXb9tJYft/ojE6B4e2g6jMIXjE/vVIwp2i/FnLF7KdID0KBCDv5HrJBN6SbYUQjHVJeTE6nRWdO/sxYI8DKpsTMlyiKMuZcPQ5WSsmBNEYIk4Y/KJO8mKZR12eEHPbNrjGwupRo5ZmNZUTzVPdyk3rc9ueLji5svSgXuTAqWJypNQkyjMg== 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=7qQZVZ5gYrJyv7FJDP/9J8gx3SfXbvVi+WtgFvAg8J4=; b=ejaCvVPSVdHBMzIyC/i4fp++7Lu0WMa7cwc55zgZPFzItJ7TRyQDaH9MXp/+OZI2H79BofjvX4McVMLzzCihsHIlWMxa7M6gY+dCGgiyBF8LMF3ucjOX865CsJx0B16EdgsJVjYo+TKtutXIzinSragBjFjZx9X7x7GWI/AyJhHKEdJQZOnGBU0GaYxyrNnz+HD869g3ID0HXN2eYaviczbdbVkG9cSD9Wy8aYG328hBJYIu6K2FappS9SzVeJTpSzk/39MtWsP+x0vzoqie/RewMZYaECMSFg9Yx1BK8SlYQTMCZS42oeyovDrAuhfO+nlxqDxKhxmVWRLzdCm0Tg== 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=7qQZVZ5gYrJyv7FJDP/9J8gx3SfXbvVi+WtgFvAg8J4=; b=fsjWrBdP7DZhfdljPulmFWAh0XPcK9b3b0vBYq49FtaTvheb5gXNLqgNmbzbl/Yihw9FlKV7fAkJW9mw41sDBf6dpto6g0Bizx9gerpw7Kx90Gpygnuo61neWrvl0/ruaL3QsX5EfYa3QUiP8DnbAu6n5N4FYg6hqJQOaV3DLLs= 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 DBBPR04MB7772.eurprd04.prod.outlook.com (2603:10a6:10:1e3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.27; Tue, 19 Mar 2024 16:07:20 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::3168:91:27c6:edf6%3]) with mapi id 15.20.7386.025; Tue, 19 Mar 2024 16:07:19 +0000 From: Frank Li Subject: [PATCH v5 0/5] PCI: dwc: Add common pme_turn_off message by using outbound iATU Date: Tue, 19 Mar 2024 12:07:10 -0400 Message-Id: <20240319-pme_msg-v5-0-af9ffe57f432@nxp.com> X-B4-Tracking: v=1; b=H4sIAC64+WUC/2XMTQ7CIBCG4asY1mJgCqV15T2MMcgMlkV/UkyjM b27tBvauPwm87xfFmkMFNn58GUjTSGGvktDHw/MNbZ7Eg+YNgMBSshC8KGlexufHBGwkkR1VZU sfQ8j+fBeS9db2k2Ir378rOFJLtf/xiS54KjhISyidsZduvdwcn3LlsIEWYGQWUFSpSmN0OCpt Gqviq2CrIqkvAfrtbECLO6V2ihZZKWSIrAOFRoLNWQ1z/MPRcq7JD4BAAA= To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , imx@lists.linux.dev Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Frank Li , Yoshihiro Shimoda , Serge Semin X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1710864436; l=3771; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=JJXqx52t4SOPohvMnQLx1kp/6SCXWc6KO44Qih5BpVc=; b=8uWI/GZZl7hhPi4OnAU+pdv3eQw27dcAK6DV6LvVDie/fY6agWJPQBVtK+stV4l9sCFYfqmmg cOyAI39v3n0A8OI8tfR8e7nxnKr2AlHvWxUxuk3BmlE0yrLlIkU8bzB X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR07CA0104.namprd07.prod.outlook.com (2603:10b6:a03:12b::45) 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_|DBBPR04MB7772:EE_ X-MS-Office365-Filtering-Correlation-Id: 44714148-45c1-480f-4b78-08dc482ea7a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: omnXsOMUqnP9KbQ3mlLEP/oneDxM/VoGF8pqRsOBW++VZXsn4AHRsdMldq386VHz4sMohwYkdg9sjonuqIMRsuUec/4tvoRUQoDhSOENqWsT+mOicHj8xwtkKqQyvHyiEFMRi6UfdkT4wpNiy65dCM0HqSCbtbUpmesHPO/1vN6vC8ZBpBm0K6mdXQmoU8d4LzZd8ZJYI3kMRBma1ByzgzlKhwUIQ6cQINTF/DfXQ7a7oa/H8/CPCkArQI5/2aPjKrgVj7sGftjbNh7aWgvd3qvSOoD2TSoU9c9nmAryexnRMQOrlQ8Yh5Co1yRP6AW/Oja9XQw8a/1EvBLTB9Yv+Wg8LzTRMQQz/lhHBJ2lhsxGBfNne0kiMSkNUTzp5z9SawsPUYjtDMg287vUDE4t4HBLo4DRxaZ5s31u/QDZUScFLPWflodismWA3i67RvuZyn/Q8CwvTsAXkSSCMzwgqMI9UoLJPKPWsjislEr2wWZOVcK7RYN6z5tktACfC69tHDeVq0tbWS+G6ns/BCw6OwpuPWJFVgvBkg3nQybA9Lj1egy+fv1r8Z+I2OTTgVmuyrR4Y3X439xORplQuZKb1dQRWp9WbyN+GXQ3P6PrKIgwaCXDZN/KuL52LUwDZSX/DS+dBo6pC9o4f3ll5bm5XLEx5HeYkQ9elQoHKJsFHjhtdwidRUM5TOe/Q0LFMl9u 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)(52116005)(366007)(1800799015)(7416005)(376005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jVzlY/Qc+NM67w4oG/3Fv6d7HaCV?= =?utf-8?q?WYfJVnKZR3mAGh6S5wY0EZpNePHOYHUFM7NE3A0R0DmGyesllKJd90Wsazd1mNl2s?= =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gEAtfHt?= =?utf-8?q?2HEGxpUbV6GAkxQ9/sENifEzlDrSKv7EvIdsLBqQHsMGUBfizAyXJwBR/9Iw+QWED?= =?utf-8?q?R0qnfsyZsG5KjTXHevjl981+IEenp/NyIQq5hVHAx1mILHqXtUrxeH8B+LKeYMHyr?= =?utf-8?q?DlXEbKaRIRuKmzmzS+NFMr2WX2limjx7vA0Fjnpzlj85kzgk4utApJW1i3rH560nz?= =?utf-8?q?Tm1K+n6ZXP5KAsb1Fi+SRRgOyWjg4O/0tbuZ7US6IuoNRbDakBIuhkDErCS/WVNDj?= =?utf-8?q?KUKijBbkbAongp2+a2waoXweWGhqdqaftE04LPXNzDDZRxCyzJvccFPSbwLmvnWS0?= =?utf-8?q?LXBUuLpI82nEmKDh+oFsiWeiFN9aPbDvMS9lJbPbbh7plU+y5N+c5709OLX3YwYvb?= =?utf-8?q?yPrVSoJ9aPTxFxGiZhMh8Cdu92cp1jyoC6t1o91MwOlvsZiAEvfa5IW8+N7FzCfeK?= =?utf-8?q?2I82UPTvOxsmx+QJQPUiXRVcvGrf1zE3vnnXrTomoMYweDFZef8+3Zdep6cZ+QLq0?= =?utf-8?q?OkNlFT2SmMK6sRuQVeuwjJzySwtfdFxF+zdHxEyKRG4JHydxxgiFcSwUvdSKOFMSn?= =?utf-8?q?ugCuDN9Ujtya?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44714148-45c1-480f-4b78-08dc482ea7a9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Mar 2024 16:07:19.9138 (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: naI46od6/sUEIGaFpu7fr5J740eAq0wmxA8yuflUW2aoLu2+yT4MWiU8vvogV7uxT17Fr7rtt5OIAsA/Yifofg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7772 Involve an new and common mathod to send pme_turn_off() message. Previously pme_turn_off() implement by platform related special register to trigge it. But Yoshihiro give good idea by using iATU to send out message. Previously Yoshihiro provide patches to raise INTx message by dummy write to outbound iATU. Use similar mathod to send out pme_turn_off message. Previous two patches is picked from Yoshihiro' big patch serialise. PCI: dwc: Change arguments of dw_pcie_prog_outbound_atu() PCI: Add INTx Mechanism Messages macros PCI: Add PME_TURN_OFF message macro dt-bindings: PCI: dwc: Add 'msg" register region, Add "msg" region to use to map PCI msg. PCI: dwc: Add common pme_turn_off message method Using common pme_turn_off() message if platform have not define their. Signed-off-by: Frank Li --- Changes in v5: - Default disable allocate TLP message memory windows. If driver need use this feature, need set use_atu_msg = true before call dw_host_init(). - Link to v4: https://lore.kernel.org/r/20240213-pme_msg-v4-0-e2acd4d7a292@nxp.com Changes in v4: - Remove dt-binding patch. Needn't change any dts file and binding doc. Reserve a region at end of first IORESOURCE_MEM window by call request_resource(). So PCIe stack will not use this reserve region to any PCIe devices. I tested it by reserve at begin of IORESOURCE_MEM window. PCIe stack will skip it as expection. Fixed a issue, forget set iATU index when sent PME_turn_off. - Link to v3: https://lore.kernel.org/r/20240202-pme_msg-v3-0-ff2af57a02ad@nxp.com Changes in v3: - fix 'MSG" - Add pcie spec ref in head file - using function name dw_pci_pme_turn_off() - Using PCIE_ prefix macro - Link to v2: https://lore.kernel.org/r/20240201-pme_msg-v2-0-6767052fe6a4@nxp.com Changes in v2: - Add my sign off at PCI: dwc: Add outbound MSG TLPs support - Add Bjorn review tag at Add INTx Mechanism Messages macros - using PME_Turn_Off match PCIe spec - ref to pcie spec v6.1 - using section number. - Link to v1: https://lore.kernel.org/r/20240130-pme_msg-v1-0-d52b0add5c7c@nxp.com --- Frank Li (2): PCI: Add PCIE_MSG_CODE_PME_TURN_OFF message macro PCI: dwc: Add common send PME_Turn_Off message method Yoshihiro Shimoda (3): PCI: Add INTx Mechanism Messages macros PCI: dwc: Consolidate args of dw_pcie_prog_outbound_atu() into a structure PCI: dwc: Add outbound MSG TLPs support drivers/pci/controller/dwc/pcie-designware-ep.c | 21 ++-- drivers/pci/controller/dwc/pcie-designware-host.c | 146 +++++++++++++++++++--- drivers/pci/controller/dwc/pcie-designware.c | 54 ++++---- drivers/pci/controller/dwc/pcie-designware.h | 22 +++- drivers/pci/pci.h | 20 +++ 5 files changed, 199 insertions(+), 64 deletions(-) --- base-commit: e08fc59eee9991afa467d406d684d46d543299a9 change-id: 20240130-pme_msg-dd2d81ee9886 Best regards, --- Frank Li