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+LslH5zz7jwTZr1c2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/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;