From patchwork Thu Feb 1 16:13:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp268459dyb; Thu, 1 Feb 2024 08:18:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0cgYMgdUhjsehbnlXlvFEetEw4rHjMnaS9gtDgSPEtOA99mZnYwCil5IAdWdJ+aR0j5gK X-Received: by 2002:ac8:5c8c:0:b0:42b:fc7e:9a44 with SMTP id r12-20020ac85c8c000000b0042bfc7e9a44mr1231365qta.43.1706804312381; Thu, 01 Feb 2024 08:18:32 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXgNcD6K8CFeP2Y6STVl2lsX4A87W7Wm/HgNYjiXXomSdTJfbcpWTuNPW+OOzPgPoz1UIOrpxFyQUI5PM919m4ll980Ug== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d3-20020a05622a100300b0042ab6f11a5bsi6073750qte.20.2024.02.01.08.18.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:18:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48488-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Fe2nBStb; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48488-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48488-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DE0051C28920 for ; Thu, 1 Feb 2024 16:15:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 76C7415DBA6; Thu, 1 Feb 2024 16:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Fe2nBStb" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2088.outbound.protection.outlook.com [40.107.104.88]) (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 72013779F7; Thu, 1 Feb 2024 16:13:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804031; cv=fail; b=PSTPbhewB+tVLc8wCLavzA/h4oqkYikT4+sNP4egrujgZW2bsOvzpMri4aF8oOV+SxGIyqnu4zDI6Upzy9fXCg7N1XdjWqHRlBHOUbFlpdJ12oCZSc/Nv/zrbYrKm3RlUnE3WHik1YQUhEAqkdnC6M+8z7fb6fUYF1YxNbzhebM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804031; c=relaxed/simple; bh=fr5F/NMvcIdoIVIUI5D13pnNFmYbF3Hf6pub7RqtnLs=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=OErdMjyV6t6CUS5Ob7TJSqNwae0tgF7wBCCRsalVLKRCQa1EL0UR1n7upmmXhrX7ilsEqKvysU4phQ62qpYi5Xo1btCUP91X3NuLqIApLpd1aHbWihWU4UVlEKugPzbySNWIMBRvkQR+jpPHjtXUBCaMrILf/4QGhTIWZotD/04= 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=Fe2nBStb; arc=fail smtp.client-ip=40.107.104.88 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JtZLPWaHHZGD4bBinpaaS2uhXAvcxtT4ohkxUTFckNrd9DroZR8ShHxv3MIgKU+J8dPKaIrZGEjKWQKo+ovITSmpI7nUg8cLUMqEiP4Elcv8ROkRUEzQV3RtXFWDxWn6MJU7atj6gP0JFcgKSrK/wGgFwktFW92v0YmwoWWUN3vh/Rg9XWCJyFTlLlctrdZAUcaCKAgjmu7PWZPgDxP2oApKpXKOTxzo5SzXeez/yd0f/4weE2BXYmQHnKZtnzLRhOLYtI/c4NFTGsT5PKbB9rA+q/Yo3K1+c9cyYp3ih548l515TpR+NIzQ351P15abg4duLygciS3pRDe8Z2E82w== 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=saEmtOwB4Gc3XJl4hmoCStakXVvmGfCb6yNjLIDKTV0=; b=aJ+3QT3h8kD5ywGGtx1YIGFnblIMwTJ/fZrUxwMMmHKeC2p52/rXZsA2iLu180c/BVSVcxJlYG4ZDh8JSNuqYF8AzXRA0nZNQ8e4pJfAeJpKK1hs3oNNCh3uwru4iEyiER6Q4gxUElXbMFywrGe2/r/zo/Q/x0x/FdJUQY5N2r+4KhN7x46PpFY6ZPAfU5nflEWDnM4yfBVExSVKccAdz8Ix6UPoB69ojskmaQ+V2a2jUqxoUPgv/NPCA2KuZ70PDoC4UEmnEWDmgv4vAr8JaTwANYNohszVQYddxHv3J8q1OEgrcSc9D4MW52wO86yQjS229s903rvUUlUj9qVXeQ== 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=saEmtOwB4Gc3XJl4hmoCStakXVvmGfCb6yNjLIDKTV0=; b=Fe2nBStbsfi1decn8ZpuQaHEkfZuWLp3HaI+rySYvnoOXkWF9S4vIUBlPB5pIWeH8oHVjSITFBvUN/dsWs9bKZKQCvsQNBMsHKFfI3JfMUU75eQh/yWr6KJnIqKQBINsXidLbWcbiGdNN6fnH4iFAUyTddmlIQmrzi2CASPdp2c= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:13:48 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:13:48 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:25 -0500 Subject: [PATCH v2 1/6] PCI: Add INTx Mechanism Messages macros Message-Id: <20240201-pme_msg-v2-1-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=1563; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=V63Eq8UBEqU9bY2RF68hjfzqp6UKmY7eoXAuoGScqbw=; b=4wFs5KVa6oOPfJwwRVUlj91CsvWkZFa8SQunJ4/fnoSgZ8jHWvLIWhlzbBsXHizxhAVYn/uIN L3OxHqa9Fe2AHvE6V3o4JyEhQBjsYWIVh7Do+X3Rf8VQTkCgys2YlqF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ca3e157-e0c1-4073-850c-08dc2340c597 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2MJraVC8RC6XcC5wQ5HFLR3BQNDhvFsex2FPByIA4HIc3DvLujtz4A7vgqWdW+8y0zBI9Vwe8nzpfb0F6nHE+ZX7/op/feSSeViIZwi6fBrlxoAYGirFRKEd5Ie5IdEOHpz+wd3GlHTglS68iEHKlsZR+AiAypSgcnEcAtLfIdwrMquuTM3BCwBrWwgb4TFqVjqdhqd9mUf52VDfYNkyK0ONPeOJ0lsd9ipmx2CSjJGXA/WdG2EPvUvYd8pfYilI0FJi5N47Q5snI5YmgG2Uur+pO53xIyj2d87ujUlbmMINNCiZyn+kptJkNBPtYOqf5n32eVohcPKjB2wMfabjM2/48sg9xF6WFNfLJXVc5ZCuhy59fvxm2rzowMs/G48GUJLRevM5mmTmgarF/A2lYN6//hkFzpA7aw5RS8cgzKwJgN/wfPs+B8xOQxKypaMQbrLwxYei4DDRSpVcQDTTrnI89e06aHjffgd7YvO7IykJJsR6kAW924tG21yNJo9E3sYTbH1vVcvqlzcZH5NNr3PYIexgCEk8oCC5vwcjiP3Q1HfBJNZ0HGUHaNsUrpJhVhEtNBocC/OJchp16w2p6mbmmm1f0NzDpQJgnLjjULOobsXAT6yKU8GT+H2exI655HFUoT003hH0on9DADKwgA== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(15650500001)(2906002)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?UqKWMG9c2P+ytboMSKnvv6xTSxjQ?= =?utf-8?q?bANyqZSzLAVbmJTDqGzUW2ID277jaqESX6M71CQurE8oPC2rM2qq6D6dhr1VwYTtm?= =?utf-8?q?9pOGbsNFVKivdsHRBZUQ/OYFFBB/XeN31b5Cr4GmMto+7gJTgf90kdpuUEbyuyx8r?= =?utf-8?q?Xe/HSaKHxnynbBRkwCc94txJE2HPqt+JOsemrIdLMdpOlVFc8Opu+6sKS1R2HWtOX?= =?utf-8?q?l3QVglKDdqy/ekjMPy9ySzYGdW6QkxBSIJfpg8O9emEtscxpUVSV1cubb8e6P2gPS?= =?utf-8?q?SahCwlHcUIkBjdRaAr/lqBhBi+2d9kKqwxg4Zk/JjUAhMMxEqLsp2SmTtl3WtK0iE?= =?utf-8?q?2jhw1N+ZCaOu/c4mO05xhQzq/ZYKDHXOQgV1lZpa1wHg34i0NXmB5NVnlT64uMy+8?= =?utf-8?q?Ucr/r+QE90sPt5So2mmuu3mH5FmLKWDewhnBITJF3D1G+BrNAjZYVZbjJH8QANvta?= =?utf-8?q?7F3ZNyTEhBqbuKEpTqXjyP9FWkqItCT13Wnfia/mj1TSlrfyREj1D+JH/f2OpL0KA?= =?utf-8?q?b2Vg9UYrE+r6czlgKf0dZ25BeLIjNoLr7faezc+XO4x5fw9Ku3xI1a4xelMc4NXuo?= =?utf-8?q?5y6tiMDrgqoOulf0Ly4ZV+ec0KzFvsMfYOxxI1+Ve5NgA5JYzm2s1UWRftKp4XBVv?= =?utf-8?q?c4ShCT3qF0AvBjrT76k02WHNqOz1BkjRikioisKIDJ0J4qw+ALSlVe0Xkshmt7XcF?= =?utf-8?q?bjaURaVbONevOh0Ra/RQEZo/MDdMsa+AOdaCjALSZhIaCEHr45t8OPfQ40IcuUkrR?= =?utf-8?q?NETk33Pq4TzMejKrORgcD2eReLgszmAx1HwHuevN0V2rvAu40B9hdnIErBzAVFCUC?= =?utf-8?q?Y3aGPqlgFLSTWmS9TjPKF6TKdUVR98OWOb1FH9gGz0KObzyqyeMhe2OOYUw2s4ET9?= =?utf-8?q?QaGQ9Zv16a8uCRdt1xRYl9zCdPLxp7B9Z/B2desoQO68AvSLnRWjFG7r5/+/qRFB7?= =?utf-8?q?m6vUXmEzwHqf+MXzXDfjY7hy5B+uxptYoPFVNW01z38BsLUocoedvtOSbRJL0Le5Y?= =?utf-8?q?wUxglHq3kVIIM7UrjRK68rLGbvs6L3N5qQugvAoD9oPbixL2kUAsjb0bsUugB/tAw?= =?utf-8?q?dGsVLLba1SrhgpyFu73TY1iwqAdFqX7s2Q+hxg+UiC3FgZV3zqdorUa32ePTId+YK?= =?utf-8?q?SrylorhvlO4fTELYOTR1mVXUkGpHQ0ljiZrgKgtxsgGSWaAHFoT4lXVtfp57cAxBJ?= =?utf-8?q?ZRb9U15VBIhtbrcKN93o6KKhznZfnytronnbLqDEj2A1Hg5fTS8hpxtH7tktAhblY?= =?utf-8?q?4udujGV8RDVInfU0cS45k7aF+kkHJ2OW7shn7sO5sSxxhl6NFhRyaK2o183WGBk5a?= =?utf-8?q?U/sii63YMZWbiN33/ONW4Y1g+hF7VZWIaGDCW6fs0a/xW234G8w1TGN8+9MTmQ2aT?= =?utf-8?q?1qZUt/LD473lbbaVhkmU1Aa521NGuylesVOi84ltILEbR54fgtJJJ+InpSpjpRCbC?= =?utf-8?q?dpIyf26ZyBQzvDBOJtHVCKacFfz6POUHk5ZiV9WysfrLvnOr56lk7P5A=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ca3e157-e0c1-4073-850c-08dc2340c597 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:13:48.0596 (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: zV0WYE+Sc53pn7jRvwAvZn1orkqi0Clm2CxnNyoVXJTpoUC5Ka5EyQXAvmiT49rQdxMdxUqmSnj4wvThBAUxeg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789714038628984557 X-GMAIL-MSGID: 1789714038628984557 From: Yoshihiro Shimoda Add "Message Routing" and "INTx Mechanism Messages" macros to enable a PCIe driver to send messages for INTx Interrupt Signaling. The "Message Routing" is in the section 2.2.8, and the "INTx Mechanism Messages" is in the section 2.2.8.1 on the PCI Express Base Specification, Rev 6.1. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Acked-by: Bjorn Helgaas Signed-off-by: Frank Li --- drivers/pci/pci.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 2336a8d1edab2..fe42f5d10b010 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -22,6 +22,24 @@ */ #define PCIE_PME_TO_L2_TIMEOUT_US 10000 +/* Message Routing (r[2:0]) */ +#define PCI_MSG_TYPE_R_RC 0 +#define PCI_MSG_TYPE_R_ADDR 1 +#define PCI_MSG_TYPE_R_ID 2 +#define PCI_MSG_TYPE_R_BC 3 +#define PCI_MSG_TYPE_R_LOCAL 4 +#define PCI_MSG_TYPE_R_GATHER 5 + +/* INTx Mechanism Messages */ +#define PCI_MSG_CODE_ASSERT_INTA 0x20 +#define PCI_MSG_CODE_ASSERT_INTB 0x21 +#define PCI_MSG_CODE_ASSERT_INTC 0x22 +#define PCI_MSG_CODE_ASSERT_INTD 0x23 +#define PCI_MSG_CODE_DEASSERT_INTA 0x24 +#define PCI_MSG_CODE_DEASSERT_INTB 0x25 +#define PCI_MSG_CODE_DEASSERT_INTC 0x26 +#define PCI_MSG_CODE_DEASSERT_INTD 0x27 + extern const unsigned char pcie_link_speed[]; extern bool pci_early_dump; From patchwork Thu Feb 1 16:13:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp266963dyb; Thu, 1 Feb 2024 08:16:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7q9In4zu6Tx9+HUB8FSFK66PzFkECjh1urXNMpNUb8jlQytLkmH9RZewZcc6kdq/6v0e4 X-Received: by 2002:a17:903:25ca:b0:1d5:6d76:997a with SMTP id jc10-20020a17090325ca00b001d56d76997amr4930438plb.28.1706804189683; Thu, 01 Feb 2024 08:16:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU+Zj1nRe7efbLD16xAAMdLtEv9rSJgWXdb2RXGz6ls8ZDjASBCd2JM9wA8CVC7G1oTzLcGeIeKMajV6ZVp7oPh4Unz5A== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q5-20020a17090311c500b001d921bbff0bsi37324plh.78.2024.02.01.08.16.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48489-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=QKD9f8hD; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48489-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48489-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5C8CF29D2D3 for ; Thu, 1 Feb 2024 16:16:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D35B6163AA0; Thu, 1 Feb 2024 16:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="QKD9f8hD" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2059.outbound.protection.outlook.com [40.107.104.59]) (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 371A615CD40; Thu, 1 Feb 2024 16:13:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804037; cv=fail; b=h9+/1AKuNwi114NIFvWe8dYxtrqpN6gs1IqjdDn9RuP0SuSt7RTDr4ZKfHF/enE3A+zDHfJgZpdcYmHyezWVmt2a3Y6Vzhy/AaAf5PsDC5Xxsq9veCQNc9Kh5jpdhMuxh16ru79ARHYNAPfRv7AFUUzanquMNHSYw+rOChe1BhU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804037; c=relaxed/simple; bh=hzGYRhAZl9U+Uvuu6aIidx5j0fhBAx2klPXN/eaV8Q8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=iffr3MDhdd8+v+v0PCNgg/CI5AvDRHj4xugJ3sC8IWqm4qpXYivpY3Zq27HZYPKxSv34VG1RODJzZK0Esxx5+h2mhCCV7BXw4ElxEkFUjEktLvven967NX2IAnrWDE3nfXSxPpl969OeZMDQD3g61N9vCehXWzbNYOp1kNaVq6Q= 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=QKD9f8hD; arc=fail smtp.client-ip=40.107.104.59 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ir7oEeMSBi+KMIgd5WSug7eGi1DvXdAyJCqixfn/3SUkqajL+T7Fu1W4U7RpP6opVFAtrmkvuroRUHO6oni9G04ipjDuiKhziylDdKCIks1zZCRCCg0733k+cnCI4RsY+babHhO/OUS57WnYt4qxYBJLC+9DNwm6I/+LmYoKcjJtz6czGtj7G7G7q4Vym6fVPoFLgx1bLJCAMjxmy0pT+RGpEEYr4uji+VLXQBCNyJtxp67uks7JFD++4AoEph12Z8OP2mTuW194hTiuh0p8fsjNusADv+EZ20D2FJVyCdsD2gFnVanVn0SJ1ecbkIq/BZ8WFkXvLUnLaOClRoQxfQ== 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=0z4U3sEC3khiRNkm46MPnkPrIySIybGo6ofqvEZ86Bc=; b=ELvO7lwShuhmNsV4C4OWDjrPB0aihAPWLeS6WclmkunNXSguijy3jXZKUjzdzX/G4bbIuoeEgKh4DRXMdKxH3DL56UBiqdIfD/Q1aWoZcFZuwn4mrAJxKCC3w1K7QQpvV03IhWdHJpvq+M7Xm60GmUcPeS30mXml2Lind1tvh4q+YMaVOJWFKV1IgGHeDHf4CcTgGObxdeqwsNMhmkRJIN8RtbgMa6QSJzU4oM4lKhCAvTq/CtRnFNHYdgz9rFSPSEbdFAoVgGq9XrM7Jy+pE0yjrilaDx66s6PsIsnP95FtDu5cgUeDzpGfzkn2PA2jeQUMG0yg8JfTbJ7I6kin2Q== 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=0z4U3sEC3khiRNkm46MPnkPrIySIybGo6ofqvEZ86Bc=; b=QKD9f8hDqCFrpPCP4x7T3E7mjaa9vfETQVSY6OLsJfTpBq2a+UD/YE0w0/cLS63xGTGhx63BYijM3yF6EuLiHvm7xO99chVH/++htbcjIBYVg8K4jHWzAwi+MM0tj80Ak2WeAf9L/ukGAtkUj+PoUYs8aMD+ZjPIfLJpK0gXWDk= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:13:52 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:13:52 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:26 -0500 Subject: [PATCH v2 2/6] PCI: dwc: Consolidate args of dw_pcie_prog_outbound_atu() into a structure Message-Id: <20240201-pme_msg-v2-2-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=12761; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=HU4ER7vz+HwzR2rHdE/BVWAKQXG5UmDhW10DZ8OHeTA=; b=/nG5ov9U+Bp++6VJGCBINBDC6OCrCbdPcMtVZyZhDf2qNHn1BWG3t0Nib7QeXX6MY9vznuKQY 6pbJRM0J94gAYn9AvFweHAuP4ZFDifKjqi3fPi6ysms0c6WvFoOiIrt X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 2add2321-01cf-4040-8690-08dc2340c7fe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zz4KBrm0vYuUAKpxdPEVv3CERqPqS1BQ50blGOlAFShGqTKofFQ7B+lEtDrgIaWWLcbiT5e+nKntL3ErmnH3X6smDIqienF205H79tjnCO8FHiQymjMGSjr95Oi5bHP3+iPyzL4L29cuT2+K3Yp7Rm7UGv3j98buOw7sKTGwRjKkYYRClpsrB9vnPq+Oq5RYBCXjDeseVnOyIp8DF+KZI8aOg++o/mrlANSE+Y4CmW4fvNub5LaAZYYia5e9dXMq0YprlBK+ZMFFctjGZY3uRnvCksFWmBx0hjCSq6e/blvf63Ay+pBj7os1XKkiioNOL/v6QquM5mVaoEhwNw9svH5zCv/iU0dhSQKQq/XtIWV70PATExaUMVWKdpfTEIUOE1p6P+rI2WFLI2ycU+tgjpH41wBKzhlpmttz9qLbpWEckcHmD/+IIjqRD3BfGJs40U3FeArzsxo8s5dlVVblp1ALDYeS5RYAkmKQoayw7pNn0/D8EzED15GXJfdsmrgk8uBSiGUB713bd4DTxJj5Idgjug3W6F98GdkXseOjkEXd5dtaZh9O6caQqx69rzETotvkUCHanu7iDnlMDfwsJtEk96KxqIwEstGvDfSk17WsWz+s6fRBFb5+Y3qyzJT6iFeve6XvGtZithAaF0b/yg== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(2906002)(30864003)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aH89jKRaRcDrzwTof0dMeHjY83ib?= =?utf-8?q?rpuXnQMxveX+Hr8Qjs6/E1rt1BW0EG2tLkamsdmFMfVSNFXREHUzZ+qi0QUaGoSQv?= =?utf-8?q?wH3mHYM0U2gkSOjYlWcw7NmqxQzZqFaYy+3sDTed5Zm2pff+SMneTJYvsVDGejeYQ?= =?utf-8?q?xOS6Y0kHQHHscH3Jwp2oLdl/oq58ggOSMNAd1mTrlXP7VM1/kCnOzV9HtSb1AqQux?= =?utf-8?q?bmw8TbZ2UEUfJYuWlTygac18oS1Xrutc7Vjzv86DLHfPqmTRu3DPQSqgU2JWINL1L?= =?utf-8?q?xPeGhcjTsxX2fAQlUMAa11wAqmR14mPWkzIS5nf7r6wQVPdpbosy1YfTnBEdt50+N?= =?utf-8?q?VCVtJ44+KAMFflofu6/A8E/HB8KwQq4fWlP2k0awwIMolGvlDdE4jB24hcUVkL8do?= =?utf-8?q?IyRVspHyYvfalo/1cg4mGhvCSa6LwuvAumLZwWewW1H/myb9dOO3zYUge7sv8wZx+?= =?utf-8?q?pvycH5IsN7mxJdExMv7/aM+JmrvJml2D22KAaSM1JXZtm3ONDVupMTtHMz9QZ2nKN?= =?utf-8?q?OEelSX6jqLnCu3R0kgR2/z7nAtQkIY4pKztT9qsQ6ujWDo6E5/Kl84csZVp21C4cz?= =?utf-8?q?BUk6/GPvRkbw8oa5xD8ejpy5Y4rz/lGUFzHkC/qC3Ss2JmrwrRmKvsB+4Mfymv48w?= =?utf-8?q?Fojeq1lscImfo4qO5KQ/oJNRGw+SQLA0B8BwPVA4llqFt57uCTYTRQ3OMNnLaWt0r?= =?utf-8?q?4v+3LryowxhNwN5tY3EpVuc8VngW3bQgxYpAoF9FTnHhWg5QW3ZDh3Ywm8teqidaN?= =?utf-8?q?29YxR/pVU++6dSFTJhc28dNs0WakZtVbStNC9b1tN9TYrRZFCViW+O6aOdrKV01RZ?= =?utf-8?q?Ig2t6ssIp3/8yVe7h+ICNJec5bhwVO04jZywDkBCYGOUOQ4XkVbAPdN8gKM2xoDg/?= =?utf-8?q?ImmD9PDCP35xDmLwF6YNxPLI6jsVYyV1KiTe1JZZUl+W/kQjt1n9tVH+q9IZ77b/H?= =?utf-8?q?66HgKKquVDRjZDC0LaDYvprfBbNJ53GGR2V6aPf571vzhL7NqjTZa5zNdaiSM5Udb?= =?utf-8?q?hjrKvsKOIuZS8hCRywbaDXfS0seveg4mBvVZQpuGnZXGjcbrI8H0PNTbDMrjvYNVu?= =?utf-8?q?eCkOUbzcKJnL6htCnVpWciUx1kcbZaV6BbFRsDLsVXjluQGeOjGIj9mV91wpMUYWF?= =?utf-8?q?lyyHWT1qVyII4FcC99Hhrud/OeRrb6V1cX40aKRD2gYXAunvY7VmrtZZ9Hh63h4l0?= =?utf-8?q?BQ+OsqUvU7UYKrkHfUoAyEBXJ21oExm/ZnueMn5HDTKSZLDGVNPffmoaeU3LvM7IP?= =?utf-8?q?eUC2Ka+N5gXcssC5sDeaMzGgU+zdLSyhiSgPzgPszSZafbsrIEmb2vvL0oRZmDhCG?= =?utf-8?q?YYgDGhNe5cbQYF07quTMxSQQTt+5MERFoyGXRyTYYnOLw5vvgGXvXF8VtD5zpKbXO?= =?utf-8?q?ANL607KVyqf5upR8/UweXTj5QtAmuKuoMJ+cK2KQVoOhCEUQGHMeKVS4ClXu/wNU6?= =?utf-8?q?i+agbEx8ZNWUN4MuOEqxbKUne6A6qjWDMlSK7Vmlu7KC/2TKlT4pXCXQ=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2add2321-01cf-4040-8690-08dc2340c7fe X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:13:52.0804 (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: bI4IkCQyImCsA1kVk5u8IuAtJcCFOnhSfzZuahBc1D6+RdaT1yWgNLyKyyGN3sXna/3A5Yg8RGyfEHdoGuna9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789713909729199518 X-GMAIL-MSGID: 1789713909729199518 From: Yoshihiro Shimoda This is a preparation before adding the Msg-type outbound iATU mapping. The respective update will require two more arguments added to __dw_pcie_prog_outbound_atu(). That will make the already complicated function prototype even more hard to comprehend accepting _eight_ arguments. In order to prevent that and keep the code more-or-less readable all the outbound iATU-related arguments are moved to the new config-structure: struct dw_pcie_ob_atu_cfg pointer to which shall be passed to dw_pcie_prog_outbound_atu(). The structure is supposed to be locally defined and populated with the outbound iATU settings implied by the caller context. As a result of the denoted change there is no longer need in having the two distinctive methods for the Host and End-point outbound iATU setups since the corresponding code can directly call the dw_pcie_prog_outbound_atu() method with the config-structure populated. Thus dw_pcie_prog_ep_outbound_atu() is dropped. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-designware-ep.c | 21 +++++---- drivers/pci/controller/dwc/pcie-designware-host.c | 52 ++++++++++++++++------- drivers/pci/controller/dwc/pcie-designware.c | 49 ++++++++------------- drivers/pci/controller/dwc/pcie-designware.h | 15 +++++-- 4 files changed, 77 insertions(+), 60 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index 5befed2dc02b7..27956b2a73be7 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -159,9 +159,8 @@ static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type, return 0; } -static int dw_pcie_ep_outbound_atu(struct dw_pcie_ep *ep, u8 func_no, - phys_addr_t phys_addr, - u64 pci_addr, size_t size) +static int dw_pcie_ep_outbound_atu(struct dw_pcie_ep *ep, + struct dw_pcie_ob_atu_cfg *atu) { struct dw_pcie *pci = to_dw_pcie_from_ep(ep); u32 free_win; @@ -173,13 +172,13 @@ static int dw_pcie_ep_outbound_atu(struct dw_pcie_ep *ep, u8 func_no, return -EINVAL; } - ret = dw_pcie_prog_ep_outbound_atu(pci, func_no, free_win, PCIE_ATU_TYPE_MEM, - phys_addr, pci_addr, size); + atu->index = free_win; + ret = dw_pcie_prog_outbound_atu(pci, atu); if (ret) return ret; set_bit(free_win, ep->ob_window_map); - ep->outbound_addr[free_win] = phys_addr; + ep->outbound_addr[free_win] = atu->cpu_addr; return 0; } @@ -279,8 +278,14 @@ static int dw_pcie_ep_map_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no, int ret; struct dw_pcie_ep *ep = epc_get_drvdata(epc); struct dw_pcie *pci = to_dw_pcie_from_ep(ep); - - ret = dw_pcie_ep_outbound_atu(ep, func_no, addr, pci_addr, size); + struct dw_pcie_ob_atu_cfg atu = { 0 }; + + atu.func_no = func_no; + atu.type = PCIE_ATU_TYPE_MEM; + atu.cpu_addr = addr; + atu.pci_addr = pci_addr; + atu.size = size; + ret = dw_pcie_ep_outbound_atu(ep, &atu); if (ret) { dev_err(pci->dev, "Failed to enable address\n"); return ret; diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index d5fc31f8345f7..267687ab33cbc 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -549,6 +549,7 @@ static void __iomem *dw_pcie_other_conf_map_bus(struct pci_bus *bus, { struct dw_pcie_rp *pp = bus->sysdata; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct dw_pcie_ob_atu_cfg atu = { 0 }; int type, ret; u32 busdev; @@ -571,8 +572,12 @@ static void __iomem *dw_pcie_other_conf_map_bus(struct pci_bus *bus, else type = PCIE_ATU_TYPE_CFG1; - ret = dw_pcie_prog_outbound_atu(pci, 0, type, pp->cfg0_base, busdev, - pp->cfg0_size); + atu.type = type; + atu.cpu_addr = pp->cfg0_base; + atu.pci_addr = busdev; + atu.size = pp->cfg0_size; + + ret = dw_pcie_prog_outbound_atu(pci, &atu); if (ret) return NULL; @@ -584,6 +589,7 @@ static int dw_pcie_rd_other_conf(struct pci_bus *bus, unsigned int devfn, { struct dw_pcie_rp *pp = bus->sysdata; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct dw_pcie_ob_atu_cfg atu = { 0 }; int ret; ret = pci_generic_config_read(bus, devfn, where, size, val); @@ -591,9 +597,12 @@ static int dw_pcie_rd_other_conf(struct pci_bus *bus, unsigned int devfn, return ret; if (pp->cfg0_io_shared) { - ret = dw_pcie_prog_outbound_atu(pci, 0, PCIE_ATU_TYPE_IO, - pp->io_base, pp->io_bus_addr, - pp->io_size); + atu.type = PCIE_ATU_TYPE_IO; + atu.cpu_addr = pp->io_base; + atu.pci_addr = pp->io_bus_addr; + atu.size = pp->io_size; + + ret = dw_pcie_prog_outbound_atu(pci, &atu); if (ret) return PCIBIOS_SET_FAILED; } @@ -606,6 +615,7 @@ static int dw_pcie_wr_other_conf(struct pci_bus *bus, unsigned int devfn, { struct dw_pcie_rp *pp = bus->sysdata; struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct dw_pcie_ob_atu_cfg atu = { 0 }; int ret; ret = pci_generic_config_write(bus, devfn, where, size, val); @@ -613,9 +623,12 @@ static int dw_pcie_wr_other_conf(struct pci_bus *bus, unsigned int devfn, return ret; if (pp->cfg0_io_shared) { - ret = dw_pcie_prog_outbound_atu(pci, 0, PCIE_ATU_TYPE_IO, - pp->io_base, pp->io_bus_addr, - pp->io_size); + atu.type = PCIE_ATU_TYPE_IO; + atu.cpu_addr = pp->io_base; + atu.pci_addr = pp->io_bus_addr; + atu.size = pp->io_size; + + ret = dw_pcie_prog_outbound_atu(pci, &atu); if (ret) return PCIBIOS_SET_FAILED; } @@ -650,6 +663,7 @@ static struct pci_ops dw_pcie_ops = { static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct dw_pcie_ob_atu_cfg atu = { 0 }; struct resource_entry *entry; int i, ret; @@ -677,10 +691,13 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) if (pci->num_ob_windows <= ++i) break; - ret = dw_pcie_prog_outbound_atu(pci, i, PCIE_ATU_TYPE_MEM, - entry->res->start, - entry->res->start - entry->offset, - resource_size(entry->res)); + atu.index = i; + atu.type = PCIE_ATU_TYPE_MEM; + atu.cpu_addr = entry->res->start; + atu.pci_addr = entry->res->start - entry->offset; + atu.size = resource_size(entry->res); + + ret = dw_pcie_prog_outbound_atu(pci, &atu); if (ret) { dev_err(pci->dev, "Failed to set MEM range %pr\n", entry->res); @@ -690,10 +707,13 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) if (pp->io_size) { if (pci->num_ob_windows > ++i) { - ret = dw_pcie_prog_outbound_atu(pci, i, PCIE_ATU_TYPE_IO, - pp->io_base, - pp->io_bus_addr, - pp->io_size); + atu.index = i; + atu.type = PCIE_ATU_TYPE_IO; + atu.cpu_addr = pp->io_base; + atu.pci_addr = pp->io_bus_addr; + atu.size = pp->io_size; + + ret = dw_pcie_prog_outbound_atu(pci, &atu); if (ret) { dev_err(pci->dev, "Failed to set IO range %pr\n", entry->res); diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 250cf7f40b858..df2575ec5f44c 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -465,56 +465,56 @@ static inline u32 dw_pcie_enable_ecrc(u32 val) return val | PCIE_ATU_TD; } -static int __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, - int index, int type, u64 cpu_addr, - u64 pci_addr, u64 size) +int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, + const struct dw_pcie_ob_atu_cfg *atu) { + u64 cpu_addr = atu->cpu_addr; u32 retries, val; u64 limit_addr; if (pci->ops && pci->ops->cpu_addr_fixup) cpu_addr = pci->ops->cpu_addr_fixup(pci, cpu_addr); - limit_addr = cpu_addr + size - 1; + limit_addr = cpu_addr + atu->size - 1; if ((limit_addr & ~pci->region_limit) != (cpu_addr & ~pci->region_limit) || !IS_ALIGNED(cpu_addr, pci->region_align) || - !IS_ALIGNED(pci_addr, pci->region_align) || !size) { + !IS_ALIGNED(atu->pci_addr, pci->region_align) || !atu->size) { return -EINVAL; } - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_LOWER_BASE, + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_LOWER_BASE, lower_32_bits(cpu_addr)); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_UPPER_BASE, + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_UPPER_BASE, upper_32_bits(cpu_addr)); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_LIMIT, + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_LIMIT, lower_32_bits(limit_addr)); if (dw_pcie_ver_is_ge(pci, 460A)) - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_UPPER_LIMIT, + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_UPPER_LIMIT, upper_32_bits(limit_addr)); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_LOWER_TARGET, - lower_32_bits(pci_addr)); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_UPPER_TARGET, - upper_32_bits(pci_addr)); + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_LOWER_TARGET, + lower_32_bits(atu->pci_addr)); + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_UPPER_TARGET, + upper_32_bits(atu->pci_addr)); - val = type | PCIE_ATU_FUNC_NUM(func_no); + val = atu->type | PCIE_ATU_FUNC_NUM(atu->func_no); if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) && dw_pcie_ver_is_ge(pci, 460A)) val |= PCIE_ATU_INCREASE_REGION_SIZE; if (dw_pcie_ver_is(pci, 490A)) val = dw_pcie_enable_ecrc(val); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_REGION_CTRL1, val); + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL1, val); - dw_pcie_writel_atu_ob(pci, index, PCIE_ATU_REGION_CTRL2, PCIE_ATU_ENABLE); + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2, PCIE_ATU_ENABLE); /* * Make sure ATU enable takes effect before any subsequent config * and I/O accesses. */ for (retries = 0; retries < LINK_WAIT_MAX_IATU_RETRIES; retries++) { - val = dw_pcie_readl_atu_ob(pci, index, PCIE_ATU_REGION_CTRL2); + val = dw_pcie_readl_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2); if (val & PCIE_ATU_ENABLE) return 0; @@ -526,21 +526,6 @@ static int __dw_pcie_prog_outbound_atu(struct dw_pcie *pci, u8 func_no, return -ETIMEDOUT; } -int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, - u64 cpu_addr, u64 pci_addr, u64 size) -{ - return __dw_pcie_prog_outbound_atu(pci, 0, index, type, - cpu_addr, pci_addr, size); -} - -int dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index, - int type, u64 cpu_addr, u64 pci_addr, - u64 size) -{ - return __dw_pcie_prog_outbound_atu(pci, func_no, index, type, - cpu_addr, pci_addr, size); -} - static inline u32 dw_pcie_readl_atu_ib(struct dw_pcie *pci, u32 index, u32 reg) { return dw_pcie_readl_atu(pci, PCIE_ATU_REGION_DIR_IB, index, reg); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 26dae48374627..d21db82e586d5 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -299,6 +299,15 @@ enum dw_pcie_ltssm { DW_PCIE_LTSSM_UNKNOWN = 0xFFFFFFFF, }; +struct dw_pcie_ob_atu_cfg { + int index; + int type; + u8 func_no; + u64 cpu_addr; + u64 pci_addr; + u64 size; +}; + struct dw_pcie_host_ops { int (*init)(struct dw_pcie_rp *pp); void (*deinit)(struct dw_pcie_rp *pp); @@ -434,10 +443,8 @@ void dw_pcie_write_dbi2(struct dw_pcie *pci, u32 reg, size_t size, u32 val); int dw_pcie_link_up(struct dw_pcie *pci); void dw_pcie_upconfig_setup(struct dw_pcie *pci); int dw_pcie_wait_for_link(struct dw_pcie *pci); -int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, - u64 cpu_addr, u64 pci_addr, u64 size); -int dw_pcie_prog_ep_outbound_atu(struct dw_pcie *pci, u8 func_no, int index, - int type, u64 cpu_addr, u64 pci_addr, u64 size); +int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, + const struct dw_pcie_ob_atu_cfg *atu); int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, u64 size); int dw_pcie_prog_ep_inbound_atu(struct dw_pcie *pci, u8 func_no, int index, From patchwork Thu Feb 1 16:13:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195381 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp267825dyb; Thu, 1 Feb 2024 08:17:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGXpGQ+PgqyolezNQmGqpeTExRXG0v+beJUAOoW6iz2bRLF7vI0AaJ9Xl9Tm5lmKz4aUgwx X-Received: by 2002:a17:906:a85a:b0:a28:d9bf:b74e with SMTP id dx26-20020a170906a85a00b00a28d9bfb74emr2243245ejb.63.1706804259888; Thu, 01 Feb 2024 08:17:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXUDpPThrLRWs6FmdmR6a7uR2LcIqIEcXmQzvmWKh+0OerkHHkggp5bAt3ZtfQH1VPfm7+nCwesvf9NChzHatv3bf643A== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ef7-20020a17090697c700b00a316e395165si6522510ejb.529.2024.02.01.08.17.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48490-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=pbD81OBE; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48490-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48490-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 01AE31F26EB6 for ; Thu, 1 Feb 2024 16:16:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15729163AA6; Thu, 1 Feb 2024 16:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="pbD81OBE" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2059.outbound.protection.outlook.com [40.107.104.59]) (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 DB480161B6F; Thu, 1 Feb 2024 16:13:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804039; cv=fail; b=phwgrUhlBPjeTLybvZLhpZnB7yuGg10P4TV/pgW9z0tVtjE4TB6+H64JFj+3PXc9uoODebG6XFg23GigYRPZFsO35VbP7iQP9pG2wobgkt3ZuQKUYGx9y9GNNVueettfQwRZD7MCkfQFsvQQoIRRLvgVsLBO6NI1f0IYNlG1cC0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804039; c=relaxed/simple; bh=iaMVhIlaxnDKrjo/B86UwmBA4lUHgRwjSU/hHDluay0=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=D8neSvWt+xBWm7pJ10ESywZBApIZ5aUbsRrs6appJdOGUj1KEdXf6PD5K2uYh4TLQjqBEMPW88RwQOOP4BFs29CwSZHBgFOizMcsdBBgPNwiGcHcyA56NpAHqXjdP40RUPr76C3U46dNUqbTuf2vENKLfYOBEHJhPuFzhZehJe4= 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=pbD81OBE; arc=fail smtp.client-ip=40.107.104.59 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gElXbfHvu/xeKBgHTT3MlpxGnzx0cEzbqhFa7JzV3nxD+FOZHNT0znyBfv+hQ7mCg0om/9uF1qwXJ6Ao53rBjHK1pUsSjIHCfNnAqe/OIWriO5ujc61A7YUrIA+u01aWMPuN3jJJad+OnW5vsWAzaXiW6I/hOsat44rF3qSCv4yxN9ugzTkqHBqRxTM/6TBh2WyyWj4Dn9w3xRpzlRMIULVTrQdSVkckvoN79OSkC1Q8wNbligEr5L/JGp01G++3XK2zgl+SAC4L/m1YdsXPWJhgFJRgKhhE1LSLfFeIoX6I+ggUd+ddpAyEl3tPZzbnx8mS3gfOtZyabhnWUWRyvg== 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=wqraZNkbMXJ8bdVBUWBtPeGCWP+ilAu0pVj9SSD+e7E=; b=V+n5lSlJTyLbL8VpgmuoCus6tIzJhY1NA/FeKTWIB0gq2iRI5xy8RFDTAFhUKU2mQn6TC8vTO2+6ADqQaEQUpGcvWRCBLSHGHykN0yGQFH2n2AJRzlyC1hrZ6iPY6gCVwcR4cODVyxZroKLUXZB/ohcvwbjRgYQBWx1kl33t9dCRjcHvUdUzSbABuLHZjA0u/UPPfhq2PEEsEMyrf6ZPyNqp4BlzsS4TvBdhdNoJuD9ZmrIhAkqaI9gEI0hmTJfkW3MvrG8DPF/mANixfi+uRdtGW1EtWvYs7n+im0YAg/4H8TI1YWlg39bGfde6xEK2V7Fy8TV5Z9cYKSvi/ofW5w== 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=wqraZNkbMXJ8bdVBUWBtPeGCWP+ilAu0pVj9SSD+e7E=; b=pbD81OBEpFnUndc4c41rY2A6Cz7Kae7lLcawaBUlmEfF76AsyFQflBwL+RzY8RVc//LVWc5oS8+DAUGxSbkwF0nmW1zQhDiIuIbdykQmzHYfX/QKtfawsbMSUsbD28rP5kns02hS9cNQd4sWjqXpZ1lziCorroNKNSxq9dTjUYA= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:13:56 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:13:55 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:27 -0500 Subject: [PATCH v2 3/6] PCI: dwc: Add outbound MSG TLPs support Message-Id: <20240201-pme_msg-v2-3-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=2940; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Vx141tscxeq3VO/J2v1vu73YFB2QjcNfIuChtPapKMY=; b=Cffk8JqUvh8PY17QhvXtW4TF0el3Q7U2/B9EFQpiXMXzhS0l05W2bD/H8dFBF/NQtFGvNG7Fm PM+Sa3mlpnhDK9n8f6LVb2hD1o1D0V1SLzQzVdWYhYeGMEOX6YMsOEl X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 0187632e-e5c4-4717-052c-08dc2340ca42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5djO+f8tUaUzwzahMWxzUeg//wQqeH271+5nO3yvPhYvgwCzELXxWG2efHQvSevxBJuWgE+PXr5LC3OjdlYLQD+ceGSBxzrOnCKf77IKScDyZVgnkO3PQY1CUSt7XWWWC7MHVE9ySTcvy+tyzX7SawaIQBf4Xa6L42NGmW+o+RE614VREguSAMXvN/26NQUlqMhDeikjjQLz9Czv6roWMOJIOObFQexAtAaxR79B8swjnhMoYTvjJSkxSrnWxwRzZWtbRBRdy/zauIBd+cld5kSzRIhmPjYEPTouYlH2O9UXeaXV/WGys4tiJCtKPnKDzFBecK9lwRRpavuuaSRdNeutdCaDihKdecs6qEBW6fd5UKQmrtas27iBn+rGz4rmMUqjp+Rvu6tel2boRouo/8SwWvxaZ1GsX9YgOVlBJXBvBwhhF7p9YvziW7GJ+iAV/7fwO6VlnQYNuA3XU8rYbjry5XKO64a6nDCH9HPGHCTZ9bel7jX/R+TsKxT1bXEurc9+Vbl8sehPqqJPibRbqYtzjypHWKIqpNty3PcWxzltDdEcYZ+q3SZ+4mmK4r0pfCIJs6oFJ7xzEqxTxi5mhST4p6W38n0dziyv1uHOYbd3p3wHwlvvNz42+rmL/fGkOJwqmqcZjzRBoIgpa6sa/g== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(2906002)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8UNJyrJqCDzlTJ8ANuCZeFbDZbkr?= =?utf-8?q?sti2h6ENVe/kUPLcD6+LslH5zz7jwTZr1c2l3Zl114by5vPb6fXYwzYiFkhnMdgiN?= =?utf-8?q?IB+Nw9fTejidqQsCmK0sFIXvA4eKqET0Fl6X3DtGAW2Q8kg3hSuYhpZXf8b+ZEV9l?= =?utf-8?q?3iNQ4y4qiUCloFONYbW92ncZi1nf9prTbSkLzQlmTa8K8VC3Unjm8oKlSuoTHKkFA?= =?utf-8?q?L4iToxPY3gJ2TxiZKcdD3SqXaAEcvuiWpiHr9EaaK14nzYwTaz9fse3ACl2dCg53H?= =?utf-8?q?mTuJoq4AI9QbYkeJKJ+5lagdya2Gq3JeWbLtlky96zsg6mRtpsdbVBYCDfQ2XOfAA?= =?utf-8?q?hc7erPfwpqWMZR07rJlLA8lKhfrbUTdgKwJ/yMDJv28wfoCUs1eRY8TgaMirrvGXK?= =?utf-8?q?NoNGrvDYsVWelLwgYq31cDWYaKzg9M/P3t81lk9JdY3VLVf/awu+ZND07vIzueE9F?= =?utf-8?q?48iuutn4UTCe+4Ipp5VBC0BMcZbfeoDitbom+TiNi/LbrXuGVoIeee6DM+07MLh7F?= =?utf-8?q?EiHLjQlN8BusZQeGFiWl/1A0M8rKB+Zk51RBqtzSiA+8JhP+BkLm6sjj8bQ8WVEOr?= =?utf-8?q?01+fwBNCa6Oa2vHtrH8+2pjDTA1smJdGkK7t/SItWrTdQD+AXToc2oLiUoi0gYUgK?= =?utf-8?q?M9rcPUMfVUKaJj0lFmT+MCj4LlMIyf7xj2GYpZTxClHafKTXJtPhzdFZMvwgmtkU1?= =?utf-8?q?1q0/944dKDuNjTEf4w4BJQ0tSyDUZOutAiN0jTAhzpBJFAAFSGUTBeDUKgagW5zKp?= =?utf-8?q?1XuW17iafUVkQGEgO8KSu7Xi9FQW3SXIjv1MakCPmW4+0+NUufKsVr2DrLJ3csMbP?= =?utf-8?q?PbY7ZJ4SUWEB1lUjhZpdTM3hH3Fdw0TTC1SuA7+18o0mzmFR7wRQ15biSGUWQr3Mw?= =?utf-8?q?TFKP1jeASw0U0wkdPWl74vmv0jq+/9dYaE38U+7Mjc+MuFncs5gFQHSZ+iR8w3VJL?= =?utf-8?q?OLiqShhgi9yjLeNOojejTw6rYHlJcWRk6epUYAafXE5vFwFZ00aaXnJ4VplV6qj+y?= =?utf-8?q?25Y8DlsILxEaJsrGe55cT46CeMPLFMS9elBsFDao2jXhbfelPS/fV5+k1RAbRjeN/?= =?utf-8?q?ASL15x2up84x0KKKDr/qvvAIzphRD+xZY3fCyuX+RIsTxk9jVN95ujxDkTHN/h6n4?= =?utf-8?q?G7s5VzAQQITLSsjwdlIDUhr4ZIRrvk4CCAG/FZnGExR8lyMiBnzd2tR6mxIRmrdmz?= =?utf-8?q?GpV9W+pKX25ZQuGquF4PvCUCH/sPgrVgb/xO5Bl/888iXVDiBwADDn+oiIYe2d4RV?= =?utf-8?q?Q4KwcmTeeEJTw7lB6P08eqON3t8oHGVnPPH2W46EqGPBri5+G5rNg2qAXnM0ikcY4?= =?utf-8?q?eVScdhIMm3MG5iGU4HW2Z3risJkzSP380XmEUYfkM6kEeNNN1rZu2QiNJwqwoGWcw?= =?utf-8?q?Tx9MqdTjZZbMQL4bQo06FXOg4/SbrJZSIzB0VQCjIbhEdUsapPrOpAq1jjZj+9fW6?= =?utf-8?q?duCAf8JycFbkdJvyhXoxc1t9rI/WB13J7mXbYp3sb2BJliJM1a8XhgH8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0187632e-e5c4-4717-052c-08dc2340ca42 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:13:55.9192 (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: IdrLjNZjHVTB8FF4kTvUk4jFWp2T4ZpumpT1s4DP+fiMhSMfTJxDM08z6K3wUQu9cymxYRSW8u4c5utp+5Dq/Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789713984101878596 X-GMAIL-MSGID: 1789713984101878596 From: Yoshihiro Shimoda Add "code" and "routing" into struct dw_pcie_ob_atu_cfg for triggering INTx IRQs by iATU in the PCIe endpoint mode in near the future. PCIE_ATU_INHIBIT_PAYLOAD is set to issue TLP type of Msg instead of MsgD. So, this implementation supports the data-less messages only for now. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-designware.c | 9 +++++++-- drivers/pci/controller/dwc/pcie-designware.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index df2575ec5f44c..ba909fade9db1 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -499,7 +499,7 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_UPPER_TARGET, upper_32_bits(atu->pci_addr)); - val = atu->type | PCIE_ATU_FUNC_NUM(atu->func_no); + val = atu->type | atu->routing | PCIE_ATU_FUNC_NUM(atu->func_no); if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) && dw_pcie_ver_is_ge(pci, 460A)) val |= PCIE_ATU_INCREASE_REGION_SIZE; @@ -507,7 +507,12 @@ int dw_pcie_prog_outbound_atu(struct dw_pcie *pci, val = dw_pcie_enable_ecrc(val); dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL1, val); - dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2, PCIE_ATU_ENABLE); + val = PCIE_ATU_ENABLE; + if (atu->type == PCIE_ATU_TYPE_MSG) { + /* The data-less messages only for now */ + val |= PCIE_ATU_INHIBIT_PAYLOAD | atu->code; + } + dw_pcie_writel_atu_ob(pci, atu->index, PCIE_ATU_REGION_CTRL2, val); /* * Make sure ATU enable takes effect before any subsequent config diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index d21db82e586d5..703b50bc5e0f1 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -148,11 +148,13 @@ #define PCIE_ATU_TYPE_IO 0x2 #define PCIE_ATU_TYPE_CFG0 0x4 #define PCIE_ATU_TYPE_CFG1 0x5 +#define PCIE_ATU_TYPE_MSG 0x10 #define PCIE_ATU_TD BIT(8) #define PCIE_ATU_FUNC_NUM(pf) ((pf) << 20) #define PCIE_ATU_REGION_CTRL2 0x004 #define PCIE_ATU_ENABLE BIT(31) #define PCIE_ATU_BAR_MODE_ENABLE BIT(30) +#define PCIE_ATU_INHIBIT_PAYLOAD BIT(22) #define PCIE_ATU_FUNC_NUM_MATCH_EN BIT(19) #define PCIE_ATU_LOWER_BASE 0x008 #define PCIE_ATU_UPPER_BASE 0x00C @@ -303,6 +305,8 @@ struct dw_pcie_ob_atu_cfg { int index; int type; u8 func_no; + u8 code; + u8 routing; u64 cpu_addr; u64 pci_addr; u64 size; From patchwork Thu Feb 1 16:13:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp267916dyb; Thu, 1 Feb 2024 08:17:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IF69lcBI7SC9XV9Oj945D1A37C45EVgy80o9jKF843rYDASduFY1iUXsJ0PavixHkGWOKEq X-Received: by 2002:a2e:84cd:0:b0:2cf:2db4:cd84 with SMTP id q13-20020a2e84cd000000b002cf2db4cd84mr3802266ljh.49.1706804266811; Thu, 01 Feb 2024 08:17:46 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXYyvo1AGxqucUheNOuqDArHfXcccWsJMPxDYvtL0Pp5GELr6WoLN75mmZSuMGJ3i6CfRjoEXrs3hcG9TcCOYvxZXfRMg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g7-20020a50ee07000000b0055fc08ef164si611975eds.272.2024.02.01.08.17.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:17:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48491-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ks2o1jbz; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48491-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48491-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6DDAE1F2B1A1 for ; Thu, 1 Feb 2024 16:16:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4550915DBDB; Thu, 1 Feb 2024 16:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Ks2o1jbz" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2048.outbound.protection.outlook.com [40.107.104.48]) (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 DA00A163A8D; Thu, 1 Feb 2024 16:14:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804043; cv=fail; b=hgMwm2oj2lTtr0/K7+iGN687sqk4bKrdkJLqkcA9H8uD4TLHGj8ZWNmHY639LTCnRrczOQXWKreKj3N/bGTGD0lR5rjKqlrOBE0muDvpcRAxGo+kcM3LKv2vK+WuCslypwqqGT/lC4+Gb7upPY5Ep2fSPqMX2LiyE/xyF41JvfM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804043; c=relaxed/simple; bh=D3OVyPoQgbl9xXSYR/1BiTXAJm+k9I1uFEMvcHMr1z8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=bEplMuvIuZZ1G8614BPCzS1sf7HFsPE2pIvgzMSkCEVTeTR5D0ZE4DXkYZ3Wsg/Zq4CJ4r69L3unjxSdQAO1D1s3pPGK2KBhvJKaw/G7gbxiRWyl8uFcNSnjytJIzHRiMwH2cdjj57nO6py08/dNtB2xYACx5s1Xf/7LUUQ+A6Y= 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=Ks2o1jbz; arc=fail smtp.client-ip=40.107.104.48 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A+8HhHzFsMXwnNPcQLF94YRsh1ZhAHuYDU0/W8qmSruDzht1mASF5Oe4NfMIbvWMCU5dDUtWFy+hnHR7L7C30Q+9dhUDUwU3tfed4dAKPpA2F2wAEleKALiW3XoyIRfWn5JO+ClnPTPwlArQ7lI2Ljd1qO9j8FvCwPaqKqaUxWMSomJPoVmcB4cRLIitsCrNE52uMiYoDAudmkH0xE+EryxdnOT8zN+7rfo6PdRSUx1SvOA79Wm8u7U8VlmYVyl5u9ld2oNPYnbQECu7+AEAxddBerAfRxY+x3mmjVXxC46iyiOhZmV3grf2Df2yP7ul7O5JgiJOLVBE8ndWW0hcDQ== 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=iyF7iTLz64XOA4J2OBaNogx5ppHO6pakjQq/PoIvIyg=; b=drChc51E6aZfArqiPNhYE/igfmLZs0NHm3j2EFwlIMzGr3E9j6oPVR6K8/sOc0OY9uiAKYIzxPvAQ4ZwELRNYl9TNV/a6JqBl0TXNkiMQ/PNQJOK5J+t/QRquw1Hoi5eiKyp2kb1jLhJs5b2xjRtwOtgV3QAzOU29eG/IA+T3Ipcp5d2Zkb6uGkNvNas0eHjBMcDDQKmJNKlqzkJO1o9d7EbatHvVnlLFEft7+dtJeMjpy8jzaI+zuRBEXmZo6gRw5T54zPf0BNtHI2Z0YzH0/m2d+mS8pYYHjj7k0cmugZdrn9USUbD8YcrF2ImaB59QU8W6Eg0A7htMDmP8EL/UA== 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=iyF7iTLz64XOA4J2OBaNogx5ppHO6pakjQq/PoIvIyg=; b=Ks2o1jbzJynA4dsfFZ0d/kvwLTbHNZMJS+4/8ZhcgkH0Iu1eP5ruDxjtwsGMJVzQhPsD1I1WhjEoCiiNvlKBuCYkxKYEqb266cijNGL9wtES0bcmmUs1jPUd60aoWniLiRRjGtBlr0WMAipz1is5Z0JN4tFFnHM4oWKEeXyznUU= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:13:59 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:13:59 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:28 -0500 Subject: [PATCH v2 4/6] PCI: Add PME_TURN_OFF message macro Message-Id: <20240201-pme_msg-v2-4-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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 X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=581; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=D3OVyPoQgbl9xXSYR/1BiTXAJm+k9I1uFEMvcHMr1z8=; b=Z/MykaJG4lN7Eiy498ABqEaB5K84jhUBMRuzNHiZIQonpO8C+NfdT7mGWSyLdCdXZ/K0/12S8 wHVy0K+btKfCFkUfiSO2NUHSAPSbJ0ZcfPhorZYcRN7PR6NVVJuUPNt X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: d1ef6813-9f81-4e3a-f93a-08dc2340cc47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fpBvu/vARqFGfFJgptP20iruQ3x9w4wvHVrMf5wD3YOnZBYquY4nR/pPvonM3WJBUX99B/8xcmcUDoEBjfECmduu70vDlSJsK0Yp8FxDj8JHnlhQS/KEQYMAI9rEQ6paUx2MSR7xisGcTl+fJyVMoz1ImkrdF4wg4nobaYm6fdHpwQiRsVCwKH1H42bpFBHvbibI2d0wusel4gyamNh4xRluX1SWWbmaswH1n0inGWP/gWvYtGcpiZCGkamK35P+ebgP5vJgKXjGIzImlQwAOihSCXcTCBwvtMvNc/7slxnQaD1WIc3A3rlgdUhTb4YxgRcFpqms/ssewbPgP8EB3aYMilEty788rQqR/xbzR1EmI4UlU548yviLOB/smiadunu8p+c7cPRmXF6GDeUN0+2WGwk+SMxrrKQ1/OwWI2QA04wyIDTN8G0tOTQ/1VvpamsbZxq4Nn+J0THKG2ivlI1x/OwpCbbFmUwf3CYtl/BNJItLCZgFXQ1TNRCvinHTQef7RObM44lR+ApfUbCTpEt0t5d3r8NJnenCcwslfQ/v9ZVvJQIOnaUGLRyOvRfEQIvT5DJaJrEqlH6QU4E09egZkQHlZ3Bg7ESauXtJ9H5LRtYM7ibte/+HKcuovEo2PbodMPj9Z33YY2Gfpw8wew== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(15650500001)(2906002)(4744005)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?8uo6ZcivkTmV/Pa7M1C9ha6thhzN?= =?utf-8?q?FVdu6G2PIIcjP1rPBKXcWsHamS4s+gYYdg0rduHlwFK/aJUt78PFO823JBD6ti2QD?= =?utf-8?q?t6fb6quh2cU+IhiSQ0MDDIcD9CYxxO31MTb4izQMdl9SrL9dxS1CZA9O2psWOAJvl?= =?utf-8?q?2ewHV5cDOh5AV4T6cUfmLjvPb2TOxxRBPg5704sELphhxD1EwC/pj1R5L+3gqkBcf?= =?utf-8?q?TE9J2BdiqrphKoEmB9eaIhmS3h0GwVv71QI2XipRNY2HGlK8PEbddpcbCdLav2rBJ?= =?utf-8?q?CcgY9iCSsZNU3xO4kpRa+mu1vRC8zHyjeTapGSofqqd06MFzFayq2PYDyDF1nvYCX?= =?utf-8?q?/vFT+daJg/jmh4hMdhtXlJQDU3gEgUtbcu2Q0uMEW5aai3ZbNPZS7II2/PS/TXsaY?= =?utf-8?q?o5pMAiAZvaw3g2f3XiS7oZl/lqa0dfdF442hPcVbCR9AWHq0EyrLg260IVBJ3ldxw?= =?utf-8?q?YKU9eXTD6RcRyR4E2mLKck6nyyU9Hg/P4UrXTd8IGkt+ZkpZgyNHe4NC32Qw1scuE?= =?utf-8?q?1DPwAcAW+pMGoLhk5qh/Pxjfz8f6QBgXGCzo3tA5VQDbUYHjnbt/i3vYaKX891eD7?= =?utf-8?q?E+Ve93ixv+N6QYzgoXYIgALKcD/llrsxuxHjesYbN6w1AvfkHBDn7hzJGvFZ7uKH5?= =?utf-8?q?UytpmabdQWu5wfB1jdR7o29dzO962xgZt7vD6bgtrB8T0E091H4HLpLuyPX5+tDgh?= =?utf-8?q?JTtWPHFXufDQrJSzwxUOm+1tvueH+4J4XeGrirQ+cHD7tqxxoxv0JO7oXsrqlQKNQ?= =?utf-8?q?+ZH0QukzyaktRug7QOEViMvFCF+tJtXV2ftw5ay2ZYBsdxhaATAgEfv0Ek1V5/Mec?= =?utf-8?q?A3BM9eEWGZ5acAPGVjesDhckozgVtG2yrPK+/RraaGKTPU8OaHa4CG7ASm88MpRj8?= =?utf-8?q?rpYNrMyvVYEGanoMyv1K9Z/qePej0l4E9HXAozZRJ7ebtwr9pyaiMJvnjAdjRg4W0?= =?utf-8?q?k4nMXCZSZMIqce/rfoSeoUUHh3q3HkxpkH1Dhsz59zUShF9UsS3kYlAY+XiNwLBgw?= =?utf-8?q?x0xZoErOx/OkA34BurJONpNXyZSdQZjfr/VeubsbFxbJaJWlNAdH5AN9ORo1EAn/o?= =?utf-8?q?hnV53i39TGoz9cBFhSb5DBJ6o5qie/AK2/vZ4eiszVUXx34uXZ4p6KjF4jivubZVS?= =?utf-8?q?wk5YL383y7pCGixZZtixBPT5ox+RSLx8cC+VaSACbCEzxa+Wz9UdUeN5LAieUUDyS?= =?utf-8?q?10nBzR5oFX06+2kDhzn/d/Ahc7/xAGl1/Lx5QIsevTrTIBKVpS1JJHjOpIL2HWwMn?= =?utf-8?q?fuk68YWvz9qywv4jwe4uO9BqvgkNvW3JSfbGn9qe7pnB+JTbhYUHz34k8AgTJkHhJ?= =?utf-8?q?XRp7EOdP6bJdALhVvvpZMfcb+7lHncwVkEBtlg+ZIQu1bYOomz8JSdFN7RpFwvniF?= =?utf-8?q?LjBCqAZiJFCvQlD3/DrVcZUoIJyRJ+/UN4uxU9ZZ6H02tWD/7thQWkfciMsZbjYQm?= =?utf-8?q?kzGlfDpbDAJwDbJgUT58gRqKMHh+Zq521tNPxRCFfKw4BXvBOb7l8dOc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1ef6813-9f81-4e3a-f93a-08dc2340cc47 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:13:59.3100 (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: xPwITF6/7Y4hcOeYCspHaZ7VX+MsRfsHdDv/LrE8LNBe6Anc0yYTugFZDCn0taqpAsDoPuP5cseMu8PcBBgxfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789713990633819187 X-GMAIL-MSGID: 1789713990633819187 Add PME_TURN_OFF macros to enable a PCIe host driver to send PME messages. Signed-off-by: Frank Li --- drivers/pci/pci.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index fe42f5d10b010..46bbd815efccf 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -40,6 +40,8 @@ #define PCI_MSG_CODE_DEASSERT_INTC 0x26 #define PCI_MSG_CODE_DEASSERT_INTD 0x27 +#define PCI_MSG_CODE_PME_TURN_OFF 0x19 + extern const unsigned char pcie_link_speed[]; extern bool pci_early_dump; From patchwork Thu Feb 1 16:13:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195384 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp268034dyb; Thu, 1 Feb 2024 08:17:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGH+B9HAX53WWekD1W3U0a0Zzdr4SpJk1Pe494CT7vi9cJ72x5V9iJwz9d3pLLj9/PpvOC2 X-Received: by 2002:a05:6402:b65:b0:55f:5abf:96 with SMTP id cb5-20020a0564020b6500b0055f5abf0096mr3850582edb.17.1706804277539; Thu, 01 Feb 2024 08:17:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUsFfBX94+VTsyavWKCqES2f3TuFBdHy6rf72gOaZMI/i6UYKvsQkMt8jlD98FkjlWPmXel77oP52BsEJYuYpQUB2QBTg== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p14-20020a056402500e00b005540ce731b8si7299275eda.118.2024.02.01.08.17.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:17:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48492-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Xl8T1MAF; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48492-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48492-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 045341F2DA0F for ; Thu, 1 Feb 2024 16:17:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A92251649A0; Thu, 1 Feb 2024 16:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="Xl8T1MAF" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) (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 4623A163A8D; Thu, 1 Feb 2024 16:14:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804050; cv=fail; b=eN2ixhdsv+UfLWiX9l98IBO+E5imMRMnh+ST7phwWCO+mR/oz8ZHjWAvc+evlP6Kwrbje2JOId8WbGT+rrJiImyzQfQVMwQErha84PzAqWv1mNQvpablTklsAMXIM7gNHkYPlmpyz98qXQCgFdPi8VHSWZT9GmyNQsilzpbYeek= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804050; c=relaxed/simple; bh=9vOBvFwLsQFfcUpqiTBHWGAwQEaDEiEalYuERlgzbJg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=jAoeZ9dJ1p4J32Cln9ivLvB7eUMx/qb9rPUTHzUC2hRXcoApdbV4zAv+HozoFLA3cwGBilNhiO0W14la0XfnV4aQDezdK/bo8g06bQA1I/ANGDLGSAhQJUZ6J4bsSRqhjD4HCCCZiRBGQvaYXdH9Qs1V6LY0lC1V/7NOln/yJTU= 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=Xl8T1MAF; arc=fail smtp.client-ip=40.107.104.89 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQscprurEfFmBWpMiArN3UILgt1CVRCjNWlNdSahWFjY0pK6yqeYUmWezXf0dq+Ew4RuBGDBBCBDHRRvSyvD6tqKQZOj+eduS8X5ejZ4OXQDlBSDaLAoJPSGdBqg3a4nf8uMbWlbmqwQXUzPLdNjifDt+1s3JVWUuo2Xv+kr3KudrWlJOpJKchyQkHxFP9tHHzsqkX7Rg/983A/Jzj8RXN4Im0is3uyeU8rIGio/m63Ak4rRWNCdIepDcdiTN7rSTMNXnvxYiLtMU90EI+0c6JEtJHEfrj9gP/9aYFmabowVKp/In0AEHLx4DGJ/xvgE8wCOZ/6eiHnTVt/R3k2Rcg== 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=LkGPA7ShXT2dMqSftoaGZPxvURuUZhBj1jU23CJyNv0=; b=HKxQF/J9lul77coGkEOZ/ZvuK7rflWQUnGkoqTYcgq5akOVydtq8topEagLGAdM2tGH0gOaNxq+VMRbuyAwvvnzYeOOIN2+NshJAr3frfPPxdcoJZmNBXMN4jEhLT3FwmBKsI4YaXmv0Xk6oRrVQ2kAug96vg7fwOBLJ69t0yib9NDvsL6UAIqhNlTL2abcag4PEVqp4A3gzTy4TXukSnEVvmufk+SbIQA6xn8wVBHDfczxcgAlcXto7AmEB+YX6pA6W+xAmY6AuZp1N9VymNaqEsG1xjxdjzrfWRBt1v31gkZM6TExxXoflwuhZ/kWQ7teGxXZr2cZ8cuo9Qp4qyQ== 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=LkGPA7ShXT2dMqSftoaGZPxvURuUZhBj1jU23CJyNv0=; b=Xl8T1MAFu9spWA0R2p9D3Rg2mp2lAxG6nslFB4tg/m7CyQgPfe6sObV3IurRbhKYT+akarmWF61kBkudq73yILXOWLDQrncXF6QDwTziQL6UpYAw/STJq2DQpWNz+ShCObft8ab+NUM+u7Y3jLpOazriz7x8A/GunwjXZMsH8lI= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:14:05 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:14:02 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:29 -0500 Subject: [PATCH v2 5/6] dt-bindings: PCI: dwc: Add 'msg" register region Message-Id: <20240201-pme_msg-v2-5-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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 X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=1219; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=9vOBvFwLsQFfcUpqiTBHWGAwQEaDEiEalYuERlgzbJg=; b=YEAL+LZ6EzxOad+agqt4fr+/qSdbPLTKn71aWkiXrb/K7p3JFDOFJozvSI9unpIFXT23II68V PUYDY4QNi9MDg5/RoCgYSNCoKdgtxWsuL9xWpgwEP5sCL+NpLa9AJly X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: f200f10c-dccb-46e0-e1f3-08dc2340ce4c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ajh/UnJ+qvAWkDgjfusb2i5iRduQ3FsZLEXRL9UM4azylf2E1ph6giUpTZf98/DAn0Xt33DjtKwg5vimCeLf2spVAIXvTWIkPFlDviuM6ibZ4+jeltHbk7sC68kzREkxbpwpRST6ljbgmM56FjvPqT2uFbemt57+BQxYb1mFZZfC674bxhSP/V8xcKT69r3nCoeOPHQia91gg7QCIEij8X/VLbzuQBI40b9IzOddusY7H/93QuG4bg08OdZiVLyJIUATGZSDBYp7haCx00dlzgrn3Gg2uaEVRM61GsGYQMSyUqmc9Z9O+k4tMWDG6j2q6Pu/YGpnwmdyjv4BReOt8uAedVqvuXk1G5Gs61z+51hqnBDDCuC5lZY58OFr2FB5VRXEN2zvE0GvF5kXPJGq5OlhDMsKt9Bqvja8cy2p4Im7SlC5n41NbXZUKALqT5DvsEMDTE6WE8aYxy9EPfDip/l/5sVdrigcOkAhAlsov53fwRtRIt8TMzFGF/coG+XV4Wk6n/wKaIErDm2pX1DCrfOAYvUFXlgL5YsZr9gocP3ThKuH0y+g3HT7b9efId+zkmwCAHA24KKZFzcMSOgUv7ElukA2e7WP/75yYBbp+GuHxFmD3+gaGwUK0c7vkgao96XeIKbLwOb2LIzkeOSVaw== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(2906002)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?YqLYsxDqEbI1Lofl7YewzdxZSrx/?= =?utf-8?q?ZX5CG38k8sgNUefJdHEa8IcmT86BhQf2E6jT9jEME/RP9CcfdJwzY/y2DUqqfM2iJ?= =?utf-8?q?tSKh8hdpZctrz4Ab2SE8JxoIGYnsWJqA1bS93SN60dUHkJuouKOHxJgeOun/822/r?= =?utf-8?q?8TwyUZrUhYeV/u07mnndSwepdNtXJ05axevqZ+TWSOXenpcqU9anz3P9HU2wHqnzf?= =?utf-8?q?j5vCDkDQisY2109TiGXJ7A53ohsuJzyaujKgnKnrUNTr/4neTpkmIf0FrkKvWdFER?= =?utf-8?q?AOxLuH4p+PrGjG6q8D6OtROGfVBKXvv5LGq8NnS73ws71qst2F1hzFNc2RaRtA9sk?= =?utf-8?q?u5of5qM5+7FMj61UowKkaSw+FkCX7dw2g+NwBIcQQaHj8JnUvvBB8B11q9d//unBj?= =?utf-8?q?xQXaYM5kgJ7YmX/is0Ht2WecLUnaf+NYUCUlNUYf1A/9IkY431O+DovIlg/FYZKDD?= =?utf-8?q?3+NKq0+YexnrPnN/gtjk2ftDrpQmuEJQvFVE+9SKlGSiZpC7vuMQ0B77xxY+d/BG6?= =?utf-8?q?PjJJLOgWd48tmp7Bu4D3iz1sGw0Ur31yaSZCp+u9oexrRF80Yc+gWFoGGY7rVv8fa?= =?utf-8?q?70lXP3fsxvueBxexYCdh6oa7kmA4ZWPDC9isAPH1Zk5XuKFyqQmQgcE+aeCdG4Ilv?= =?utf-8?q?dFkPGafPbG534wDOfhpeLaxZvuPWLPEEdM+UZQ2wHv/Z5S72G8TJxtRR2bpFcabPh?= =?utf-8?q?wyeA6cUjolqPh0aavQJQyVLamFAKzysfWUDqyPqrk7jtX2BztVTyIUcXs1j/hIJub?= =?utf-8?q?kAaMA4lF8eL23/NPTD8uyPgEZ0rdXZ1C4xmCxZmOEa7I7CibOOKVSX0nbbNPOWHPL?= =?utf-8?q?JBtsroqya9zJcXwQ4LlIEQ5KAbtmKxwqhxzs1uaZxlTI1huNAi3NDnLC0kHeWWotT?= =?utf-8?q?7gCU3upAq/NjYONK4sAfB0kIY9aipdzxCRxAfKkqzMzZY2dkcLkSsaA/XENVFMo07?= =?utf-8?q?yytN4EigXd4U2XXDxk1a/k3OHCVfvu4iyffQlUeQVdjghMSWQOfa2h16SRst5N5sm?= =?utf-8?q?vQ+mMG8GpmjjNGSE5fMPDBSPijehYa1ipg+JtgTAX/7m8KXfGJKoyDJnpZ9F2fSXJ?= =?utf-8?q?hR7TlsAgOU1LZu+aS1s0Q1Psez8jwUyfA3khv7PSWMISX+yFg61ywEo0XhnUUKNhx?= =?utf-8?q?eaKjVL5MfKdoOWapb0qCET49hPBEFy5BV6G5ceuH8QDdOdyYb+wSLSEtuNE/ba+8y?= =?utf-8?q?Fu9Hi3gf5gpJZR98ngWhdCSOtUOtIINnFbZfHCxSKGoRSWcRw4kfrgI4cuKMkFXD2?= =?utf-8?q?uRQe9PgDfo29MMJY4czhWfWW0FI7f65MUFgP5VevQ8mRyzTzQSurHvziJCC1RT0BQ?= =?utf-8?q?nNcrCVK2iPeYT+fZNscoNrvLCI36WdJFk8dmE48nkNqxv7Nk1hM4i46Y19h83+ebc?= =?utf-8?q?Z0586U0K0V/ZVtO7PQxWKQye1LlFEn9QHHY1C2XjyYusvAoHPYHJP4zpmoBtNIveF?= =?utf-8?q?w0iH9cAD4qtkuOacTOznJtQGrWW4cP4vKxEZ0WtAzWkwlDeo44vdsaCWfRvLOj1GV?= =?utf-8?q?TbMs7LQOTuGr?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f200f10c-dccb-46e0-e1f3-08dc2340ce4c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:14:02.7079 (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: zO8WiIinESM/UWuz3dsr5jaEWG4uxJzWPdsfmgTGhUihQlU82CKHQgsBD3mVp2XD8JFFFwQKkpZi9vQdSludKQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789714001949301352 X-GMAIL-MSGID: 1789714001949301352 Add an outbound iATU-capable memory-region which will be used to send PCIe message (such as PME_Turn_Off) to peripheral. So all platforms can use common method to send out PME_Turn_Off message by using one outbound iATU. Signed-off-by: Frank Li --- Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml b/Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml index 022055edbf9e6..25a5420a9ce1e 100644 --- a/Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml +++ b/Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml @@ -101,6 +101,10 @@ properties: Outbound iATU-capable memory-region which will be used to access the peripheral PCIe devices configuration space. const: config + - description: + Outbound iATU-capable memory-region which will be used to send + PCIe message (such as PME_Turn_Off) to peripheral. + const: msg - description: Vendor-specific CSR names. Consider using the generic names above for new bindings. From patchwork Thu Feb 1 16:13:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 195389 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp268995dyb; Thu, 1 Feb 2024 08:19:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IH2o9vsBol/3cVNuv4SSRQ+pU7rQEHYytqeLKerpvYbbTfRjimUa2BsMJyT4RuuDW33k++Y X-Received: by 2002:a05:6214:2601:b0:681:937f:6e68 with SMTP id gu1-20020a056214260100b00681937f6e68mr5124534qvb.63.1706804359027; Thu, 01 Feb 2024 08:19:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXmffli+n21dMNC+oq6LUc9GsdVjHfrVw1nLE5KL2OfW6bCCyquhLKAvd/pj0loFyiPaVfwUz2z19Ui8gpX0xzMVTqARw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gh1-20020a05621429c100b0067f28fb3f53si14131695qvb.445.2024.02.01.08.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 08:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48493-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="ZAXPm3/S"; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-48493-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48493-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 634C91C2CD15 for ; Thu, 1 Feb 2024 16:17:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 738101649CD; Thu, 1 Feb 2024 16:14:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZAXPm3/S" Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2089.outbound.protection.outlook.com [40.107.104.89]) (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 3B8BC1649A1; Thu, 1 Feb 2024 16:14:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.104.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804052; cv=fail; b=Esj6iRBTSsIYYLkVhLU7/LwKAGqp6FcgUg2qNDtzrwhBgB4+IkR/5xQ2M1eQzr/KerEgNj6zJa4YL0ywSPdDoMj3M7eLE22wBvCz6XewTYVhHGVbg48XwbezZqPfhPwvG/fYaj6TMYgDue4p4vxTZ+6T6Z4+uc51QM9xquPG79g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706804052; c=relaxed/simple; bh=T8i2d5YcwxgVg17BF/Je9te+972ffy5ilUf3q6l9KnY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=DSI12Rr6EpQFQ5Blv1zuQObuTFaZTbXWXa8yAGwFJQl/TMp5S0Vnc3rvQdLiTgLOZMMhmyyeabbHNp81kKmUERwszB5rVrhtbzvWk6DEacfkya+SPkfe5x4K8Lwh435Nh2b81mMl/WZpcKlU5PYYn5uGOMqLovfxpoMsWlB6wqA= 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=ZAXPm3/S; arc=fail smtp.client-ip=40.107.104.89 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AcTpyBXOApbNFOCK3H6VhZR9Bpc1caqeA1/5+Dk8aiVwKMxcfSphGV5pmTpGCp/t1qXqAm4l4OoTyMZw96ctShoW9vkGAmXhbIowwexYrwksfmrHPLp2T/Dpz2liTlV30MWU332ZQCo6Z/Gjf+ZY+RKos1DNALHXtSSEHwi3o/QYFWLGv1OHinw4yioeGNs/ClQ3G1QUxXfk+Awqp2/poE6JyfUayfqRZtlBXXXmvVrdQULT8MG1KnjmsmAQ+9nG2eKqOL16AXL4OyBy8BWuTInUBue2UWZPmlKhqqKduZOFEsPQ0vHAlHZlYaFhbPuWgXXCHLdiPmPsJ9VKf+41Yg== 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=gUTNSMRiKTw9QCuf4fVh7hiPiSF/yV3M3KoyG5PLijw=; b=ewU6gM4D1HObqUgaO0QlybYd5/ZgtrWoBevcEq1KG0Ik717FVqs/ooiBhCWy/9OAQBVivjiNcLT5gqLWcIxbz21VIdRqZ7cazbO8R4Y1+gybG3dkdJBCpxc+5d8v0SUhqt9x7qneihCMa+VUnWy0EcSBmjUirKR4fI5Basy+HeFX8iqtO41Gxye4H/JQC/NranmM7YzfmBK7Kz8xdvloO5m95JCpbOsWFn05VejzzQa24K5rvL0S6fulFH7pL6cs+sXFVOZNLHTf6rp/qgqg0PalA9RPM8+4DtQl2JTpICDBiNn+hkkTC16nW43/jlxHIJk2E44QYnQ7PP9dK9BhFQ== 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=gUTNSMRiKTw9QCuf4fVh7hiPiSF/yV3M3KoyG5PLijw=; b=ZAXPm3/Sjz09hQcBL823GM4xGKEOkTd7nOKpDfZdpWWZ1VIlUTBfI1o7JCh1cAR6ZY15KQsy5rexfjMz7Rmw6GQMnW19UFGGoQU9VG5RyVRZaFrLPRRauCnWzPO/vga7SgClXJT19SBmXW0yiqW79bPNS7zC8jSRcLIABfZWdsc= 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 AS8PR04MB9110.eurprd04.prod.outlook.com (2603:10a6:20b:449::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26; Thu, 1 Feb 2024 16:14:06 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::c8b4:5648:8948:e85c%3]) with mapi id 15.20.7228.029; Thu, 1 Feb 2024 16:14:06 +0000 From: Frank Li Date: Thu, 01 Feb 2024 11:13:30 -0500 Subject: [PATCH v2 6/6] PCI: dwc: Add common send PME_Turn_Off message method Message-Id: <20240201-pme_msg-v2-6-6767052fe6a4@nxp.com> References: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> In-Reply-To: <20240201-pme_msg-v2-0-6767052fe6a4@nxp.com> To: Bjorn Helgaas , Jingoo Han , Gustavo Pimentel , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , 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 X-Mailer: b4 0.13-dev-c87ef X-Developer-Signature: v=1; a=ed25519-sha256; t=1706804020; l=4224; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=T8i2d5YcwxgVg17BF/Je9te+972ffy5ilUf3q6l9KnY=; b=2ogMPxh4HPH8Hgdna2hIpwSM0R5Jt13ZQe3qobHiYtMb81KYKNaL2HzSYVn6QfJtjOcyo8DR5 4jJCrQgP5yPCu84EhumQVgRatgSAq4QHljbyI09wOZUPdnaTF/v8ElM X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0065.namprd05.prod.outlook.com (2603:10b6:a03:74::42) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AS8PR04MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fdf7ccc-a3af-4668-e2f3-08dc2340d054 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: G1i5z8YQFvArJc/mR4i5StItmdwlEVzQUfCuPRhxm1LeQ4FC5aSLbGGyivJoLf+xPBALQ4bexEu98sTkh1isjBXD3b1cVG2EuDj23yZM0vf7vBt8EFLTOm1ZXey0PGY8BDdgSkFLK6w5UG9CMzj9j7AECyYOJl3V1FyhbGnlMQgcOSJ7uXDojzEffM3wUg1XR9i6ogIoR4CHTe4OIGz2mUrcQVrHmUe9WFefwyJJpHrl/kk8eK752BSkxcd2aQfYw7V7/IIeJ4qU3+FPaYOGv/JDJly4KMwVXneKHoirlhV6Zl+RbOX5RJz/yE27as/okQFHKi6nYm+B7fKcmDkHCEHeHuPo5J5dulObHWoNuwocFjlIXPOVxujUcpO1joGeBRtQ7K5X4zcgPVdAZxpazzHAbJhr66yg6GxcSETOveq5nA3mxjJ3kyRYLeStAaGMwrKtDZriaP7bSfB8u/f/i1j/RDtEeElmGke9/fJoKpGHSe8em4DbMmeAkkKyhW3HbYo6lLBqXaWR9whmxc9soTYrOa46vsqeIxQmSw1l6GgfoyxWW/+AKMJngccXKTUEqgZeQY0IeAepm6lm77Qx5nKQhNZGNuc0cN7toJ8AO+RaqoN+z0sWrEZ+WZsGCVTIrZhGOuqMxMBrgD/yJ2ROOg== 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)(346002)(39860400002)(376002)(136003)(396003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(15650500001)(2906002)(7416002)(5660300002)(41300700001)(6486002)(36756003)(86362001)(38100700002)(478600001)(38350700005)(52116002)(83380400001)(6512007)(2616005)(6506007)(26005)(6666004)(8676002)(8936002)(4326008)(921011)(316002)(66556008)(66476007)(110136005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?aEv/LPPVL7JzRqQtRGM7e8C64AQV?= =?utf-8?q?B3GAlVSGvNs5YlaOUfAQ2PI6GsIGTgW3WB1QbNFo7cJiEB0+4t6a24qneXdlwBR3I?= =?utf-8?q?94pYNzPpJD/o07dw/stofqH0UTCmLQIujyPCO1YzvLgJmzEj/uBxZPy6PT18cUZpf?= =?utf-8?q?P2rVot+7G2RvqRUccTIFwQDW6z0o76tGz/GXzQn9/2o8hFS3ZQIH3NpeXt+bxV02k?= =?utf-8?q?UloGXd0LGqwSJYaSvp8krKgD7NsXM91RWmorgjG2iz7dg5Am80/56Q68fbArqg1EM?= =?utf-8?q?FcndFPTMMxRQtFxdGUIwq6vlDFe+iO24PI4567/A0fx1sWtdOzFDJ0+RaBJvAR3EO?= =?utf-8?q?f+LrjEhPVFC8NhO1YV7aCxUg6FwfnYgGSilX/L9+YArE6bSTPJeVZFa+NiryluOag?= =?utf-8?q?f3024QGA4L5CuFha9xEud+sYkvKz3zJVu0sjIbVbS5YTQmSVo3DWjkr+rNhZ1v1qt?= =?utf-8?q?MrWOn4q0KXzwb0C9OjEA6FTelq2rh4QleL6fa+eLsPd8dqFOgBuJkTo6WZDtJFq+l?= =?utf-8?q?A/Dojswbua3NoMK0aLuMHiRzfd7fA/g33Pa97Ttoh/2h9SAr76UzxCc615wxmnThn?= =?utf-8?q?lq5K9Q034KbrvQ/XFihEBrp9qgE8exOVrkV+4kFvNg6bJwX41DBvCUuh1mmqWvnvL?= =?utf-8?q?3yRPOShoJH4iD9dvyBS+LNIlKGL4B2lMxAq4euw/I3ZhJuVe9XoayxQu+6u2VB8FA?= =?utf-8?q?/AVf+G6gI3IMC+4EC/af0k3Gy3vQTr1q5ogBgdQfuClHuhOG+d37Yh+6TWhHa7q9I?= =?utf-8?q?iCUfc+ULpA9IQwBq2QpZtgFKSGkhgrEi7QT40bWSbSoC44cU5KclyoMjgQnT94Ekd?= =?utf-8?q?4bwjsMyj9YmjOcEhLbEGT7CDxhwG2xMO9YCtIamimbCAZwEQJ8Q/VxUXJyRGku/7i?= =?utf-8?q?fcAjOIIwvO3SOC0gXQfqlW7ILUPSKX4iyelx1fKNnpi4GR0Gl3AxFhvxIl1Ijy01+?= =?utf-8?q?4+DUyH4ib1uj/6in5b7/F+0h+i2PhwXgiPwp1GGzdh5garuokTk+8l6LIn9Gs8EIx?= =?utf-8?q?5/g7AbSTA54sj1Hy17C0puctvTyd1AAQozZcPVLepyOYvtqx1ex4PmMABo8d/r4hc?= =?utf-8?q?6aiSYvKqXBe942ktijfzWMeH7zxxs3+kl/HxMCO2CKxiY2lNVScvDh5dgkL8dPm/q?= =?utf-8?q?ixppl6xGdmJYEagCGGOZ5N+yIOEw2FSyIoU4gF8SchslGPwnpxwDzlA0d1AgxR8cA?= =?utf-8?q?iOyIGvIW7EN6qPBFRG9EtT5e54lo57NrVxBjmtQ2+pBQwP7tfPIuuGSByNz1PZ5oq?= =?utf-8?q?h6JEBxi/sJjfO94UnU0WVzi92M96Oq0TedB6OclmOiZXh+783iEVTu+ue5IiGWUVo?= =?utf-8?q?QqlQ3Bch27/CXIZoBGvyZEa5mKGJx4XJxicNPAS21xDc+jXUESJfrkyDJRwBK7YaC?= =?utf-8?q?J2CeTOMgSebTVMxmlTo7qqW0kAEelPULfP//MlvzkkhkMl1LTRPZup2c/EcSNlNlu?= =?utf-8?q?Xf6hQOeYK4cejRYo9orLy+cPU0Zb+PvJkEgG/frh2yl4n1XxdtSQhDtuzVCbg/+py?= =?utf-8?q?g1g8MFz4f9yK?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdf7ccc-a3af-4668-e2f3-08dc2340d054 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2024 16:14:06.1518 (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: kM2tzmi2l+WfADq6NLC6zENN+VfWgg+GuYbN1CwsFCHM7D8bQlwMBYIXpLsRw/WdnP86y2LwXvLJWh3Uzvo2xA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9110 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789714087258343443 X-GMAIL-MSGID: 1789714087258343443 Set outbound ATU map memory write to send PCI message. So one MMIO write can trigger a PCI message, such as PME_Turn_Off. Add common dw_pcie_send_pme_turn_off_by_atu() function. Call dw_pcie_send_pme_turn_off_by_atu() to send out PME_Turn_Off message in general dw_pcie_suspend_noirq() if there are not platform callback pme_turn_off() exist. Signed-off-by: Frank Li --- drivers/pci/controller/dwc/pcie-designware-host.c | 51 +++++++++++++++++++++-- drivers/pci/controller/dwc/pcie-designware.c | 8 ++++ drivers/pci/controller/dwc/pcie-designware.h | 3 ++ 3 files changed, 58 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 267687ab33cbc..2a281060f3aad 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -728,6 +728,8 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp) dev_warn(pci->dev, "Ranges exceed outbound iATU size (%d)\n", pci->num_ob_windows); + pci->msg_atu_index = i; + i = 0; resource_list_for_each_entry(entry, &pp->bridge->dma_ranges) { if (resource_type(entry->res) != IORESOURCE_MEM) @@ -833,11 +835,49 @@ int dw_pcie_setup_rc(struct dw_pcie_rp *pp) } EXPORT_SYMBOL_GPL(dw_pcie_setup_rc); +static int dw_pcie_send_pme_turn_off_by_atu(struct dw_pcie *pci) +{ + struct dw_pcie_ob_atu_cfg atu = { 0 }; + void __iomem *m; + int ret = 0; + + if (pci->num_ob_windows <= pci->msg_atu_index) + return -EINVAL; + + atu.code = PCI_MSG_CODE_PME_TURN_OFF; + atu.routing = PCI_MSG_TYPE_R_BC; + atu.type = PCIE_ATU_TYPE_MSG; + atu.size = pci->msg_io_size; + + if (!atu.size) { + dev_dbg(pci->dev, + "atu memory map windows is zero, please check 'msg' reg in dts\n"); + return -ENOMEM; + } + + atu.cpu_addr = pci->msg_io_base; + + ret = dw_pcie_prog_outbound_atu(pci, &atu); + if (ret) + return ret; + + m = ioremap(atu.cpu_addr, PAGE_SIZE); + if (!m) + return -ENOMEM; + + /* A dummy write is converted to a Msg TLP */ + writel(0, m); + + iounmap(m); + + return ret; +} + int dw_pcie_suspend_noirq(struct dw_pcie *pci) { u8 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); u32 val; - int ret; + int ret = 0; /* * If L1SS is supported, then do not put the link into L2 as some @@ -849,10 +889,13 @@ int dw_pcie_suspend_noirq(struct dw_pcie *pci) if (dw_pcie_get_ltssm(pci) <= DW_PCIE_LTSSM_DETECT_ACT) return 0; - if (!pci->pp.ops->pme_turn_off) - return 0; + if (pci->pp.ops->pme_turn_off) + pci->pp.ops->pme_turn_off(&pci->pp); + else + ret = dw_pcie_send_pme_turn_off_by_atu(pci); - pci->pp.ops->pme_turn_off(&pci->pp); + if (ret) + return ret; ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE, PCIE_PME_TO_L2_TIMEOUT_US/10, diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index ba909fade9db1..eb24362009bb6 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -155,6 +155,14 @@ int dw_pcie_get_resources(struct dw_pcie *pci) } } + if (!pci->msg_io_base) { + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "msg"); + if (res) { + pci->msg_io_base = res->start; + pci->msg_io_size = res->end - res->start + 1; + } + } + /* LLDD is supposed to manually switch the clocks and resets state */ if (dw_pcie_cap_is(pci, REQ_RES)) { ret = dw_pcie_get_clocks(pci); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 703b50bc5e0f1..866ab44df9fd1 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -424,6 +424,9 @@ struct dw_pcie { struct reset_control_bulk_data core_rsts[DW_PCIE_NUM_CORE_RSTS]; struct gpio_desc *pe_rst; bool suspended; + int msg_atu_index; + phys_addr_t msg_io_base; + size_t msg_io_size; }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp)