From patchwork Mon Dec 4 21:56:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 1871728 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=AYw3Nlh1; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Skcvd6qBJz23mj for ; Tue, 5 Dec 2023 08:57:01 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 810708759E; Mon, 4 Dec 2023 22:56:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="AYw3Nlh1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1970A877CE; Mon, 4 Dec 2023 22:56:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2062b.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eb2::62b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A617D86BD6 for ; Mon, 4 Dec 2023 22:56:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=tanmay.shah@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WiEU3mewSIhbN2lZXgL6Rr7facH8fXLdXWvLo41bgxz9Lp/kX42DKr+CWNhRHz2RKEmsAktbkTrChKM8bJjoQ5VdnOj8K/xOC4SWJUktCkhuvDDb5RdifXy2yaqiGt3uIWsXn1K17uPwYLmOBVgQEYS7MBs0INXBiIyKTqeibOBaURm6S8t4EW1R1S4IyMKYwGro2lzG9Qnga5No48ZSeel1ww/Ly7hrLCpSEVfjhYizEq02tknAnTcsMcKP561A6QCFAooxI0X2GCMksAiPkyMUsMQ7UtO33zDBQtlsm+DDoH+4vAOjc5Z5+o9eNdKSS0Hc4Syo0wWp6QKm06UyeQ== 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=cfv7yUBuPAyRI7GUgrl5xw/TfkKutLUDsi0oy7CPhNc=; b=PWRdKi5z6udwYu1I8XIaaqIIi8ArsQx9junpS6WdYswgwi+f3Gn9ZL+lnDiQnLsAsYpMF0Gj+VVNX3Sy/aoCkGWo6RQy91/HdVj4PSIeu781oZKmiTIF4PpuT8EHzPI1+xtj5ajM70JrKIL2ZDhMbSk/7e0aRueF6ZNyuiixMRaE4phQZetJQNkyP+PtPZC5oq5bIdTiqIt86wPNXhisH07zrTfquvqaQBgs+1R1UWzdxlEGX0lQVnYZ2ja5GaKnE7y8wvhpqp7awaHAqOt79sFdPTLKzZPSZPJx3pRmAPBplSaYl4JL+T5ZjOUJ3w8gdlXxyIFjEFCtKTf4HGdugg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cfv7yUBuPAyRI7GUgrl5xw/TfkKutLUDsi0oy7CPhNc=; b=AYw3Nlh16HD4dJan/TyBW26bkTCQXBZOv5vPXXdDi0r+hlQ5HKAh6afdw9PFfjADbdbqkULu8hN/EcSN43nYKHnLcTLPV97mAk9UuS6TApqNB/IlWEcf9WVKo0RpE7jW66+hNqUCn/pHxHrqcljpDT/Dat3VE/NzJ4xH2GMmnzI= Received: from SN7PR04CA0120.namprd04.prod.outlook.com (2603:10b6:806:122::35) by SN7PR12MB8169.namprd12.prod.outlook.com (2603:10b6:806:32f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Mon, 4 Dec 2023 21:56:50 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:122:cafe::f4) by SN7PR04CA0120.outlook.office365.com (2603:10b6:806:122::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33 via Frontend Transport; Mon, 4 Dec 2023 21:56:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Mon, 4 Dec 2023 21:56:49 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 4 Dec 2023 15:56:49 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Mon, 4 Dec 2023 15:56:48 -0600 From: Tanmay Shah To: CC: , Tanmay Shah Subject: [PATCH 1/4] mailbox: zynqmp: support smc calls to TF-A Date: Mon, 4 Dec 2023 13:56:17 -0800 Message-ID: <20231204215620.63334-2-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204215620.63334-1-tanmay.shah@amd.com> References: <20231204215620.63334-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|SN7PR12MB8169:EE_ X-MS-Office365-Filtering-Correlation-Id: 92da87c0-5809-4568-8f1d-08dbf513eb1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RxoTUPgglD2vl8dJHbL3t4p4S9YnZ3kCVT0/yJXBLex281AqB/W9CNK/+lIEgacartVEEx9Y04gWon341YyIjqaevvI216yzMFFox2WmQMBlsgx1GagsdKL/uCoEzJZ5mzorjSxal2onaZx1Oq5XSYI4HoXSSgADGRKANuEMBOe1c4q/V0lD0LfJIGrKtUnL/yslE2MPfYAVBwX6oGoKEgiKGm9jxszYYdXklozIb4wEKBn+yk60m+NQ5INBFdse1pJm5+MI5uAGu0y5gTlaAm3XP4+fomczPG/Bq5ko4UdMw9wKByfVrAXXvF2Fn4rY81ZbZL2dndQM+VnhmGqSfYq2k3y4WO8fVvm044XZsOlQy1DLm8KZwqg+tbEQLgNvVa0+WcKMqTOPopszn2mb+43Ye35E+K8OvPN+eaPMh9aamXPv/Wc7rAg5t6NkfJpALtAMvFZUhwbwQmf9bzBUwkqjIMymEplQJvDyOZBvp75I9PU2dCpXsBLj6iHXuL4OhyXVoIcCzjmDo7+VzweRFYBqLNk0hN1ywzkcqyzOrhTbC2l95oE/RncJ1wR9tLdQOLE5+KxThSQ1nMvPCdRPBQJDxtBGhknZbB42mPIg5guQQfHZYc4xdKxekWyV82RskhKMCVTt/1rYscrNe5+YgR+WoDBF3jyJMJIGihqGOI3blEcmQZ7x+m6/6TXWUzcRZ50p9l7yWsYhfRfTWwYGpL+EO15BmM8ts01VwQVWzbrbHJvBehRJ33JhvaCeaLP0szllUrcTaPFtv9IusTXLnA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(376002)(346002)(39860400002)(136003)(396003)(230922051799003)(82310400011)(186009)(451199024)(64100799003)(1800799012)(36840700001)(40470700004)(46966006)(70586007)(70206006)(6916009)(54906003)(316002)(478600001)(41300700001)(40460700003)(6666004)(36756003)(5660300002)(15650500001)(2906002)(8936002)(4326008)(8676002)(86362001)(44832011)(2616005)(40480700001)(82740400003)(83380400001)(47076005)(81166007)(356005)(26005)(336012)(426003)(1076003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 21:56:49.9911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92da87c0-5809-4568-8f1d-08dbf513eb1b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8169 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Use SMC calls to TF-A to operate IPI for execution level below 3. For EL3 use hardcode IPI registers as TF-A isn't available in EL3. Hence, in EL3 remote and local IPI ids retrieved using xlnx,ipi-id property are unused. Signed-off-by: Tanmay Shah --- drivers/mailbox/zynqmp-ipi.c | 88 +++++++++++++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index 3e4ec47389..acd0b287db 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -8,9 +8,12 @@ #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -21,6 +24,43 @@ #define IPI_BIT_MASK_PMU0 0x10000 #define IPI_INT_REG_BASE_APU 0xFF300000 +/* IPI agent ID any */ +#define IPI_ID_ANY 0xFFUL + +/* indicate if ZynqMP IPI mailbox driver uses SMC calls or HVC calls */ +#define USE_SMC 0 + +/* Default IPI SMC function IDs */ +#define SMC_IPI_MAILBOX_OPEN 0x82001000U +#define SMC_IPI_MAILBOX_RELEASE 0x82001001U +#define SMC_IPI_MAILBOX_STATUS_ENQUIRY 0x82001002U +#define SMC_IPI_MAILBOX_NOTIFY 0x82001003U +#define SMC_IPI_MAILBOX_ACK 0x82001004U +#define SMC_IPI_MAILBOX_ENABLE_IRQ 0x82001005U +#define SMC_IPI_MAILBOX_DISABLE_IRQ 0x82001006U + +/* IPI SMC Macros */ + +/* + * Flag to indicate if notification interrupt + * to be disabled. + */ +#define IPI_SMC_ENQUIRY_DIRQ_MASK BIT(0) + +/* + * Flag to indicate if notification interrupt + * to be enabled. + */ +#define IPI_SMC_ACK_EIRQ_MASK BIT(0) + +/* IPI mailbox status */ +#define IPI_MB_STATUS_IDLE 0 +#define IPI_MB_STATUS_SEND_PENDING 1 +#define IPI_MB_STATUS_RECV_PENDING 2 + +#define IPI_MB_CHNL_TX 0 /* IPI mailbox TX channel */ +#define IPI_MB_CHNL_RX 1 /* IPI mailbox RX channel */ + struct ipi_int_regs { u32 trig; /* 0x0 */ u32 obs; /* 0x4 */ @@ -39,8 +79,23 @@ struct zynqmp_ipi { void __iomem *local_res_regs; void __iomem *remote_req_regs; void __iomem *remote_res_regs; + u32 remote_id; + u32 local_id; }; +static int zynqmp_ipi_fw_call(struct zynqmp_ipi *ipi_mbox, + unsigned long a0, unsigned long a3) +{ + struct arm_smccc_res res = {0}; + unsigned long a1, a2; + + a1 = ipi_mbox->local_id; + a2 = ipi_mbox->remote_id; + arm_smccc_smc(a0, a1, a2, a3, 0, 0, 0, 0, &res); + + return (int)res.a0; +} + static int zynqmp_ipi_send(struct mbox_chan *chan, const void *data) { const struct zynqmp_ipi_msg *msg = (struct zynqmp_ipi_msg *)data; @@ -51,6 +106,15 @@ static int zynqmp_ipi_send(struct mbox_chan *chan, const void *data) for (size_t i = 0; i < msg->len; i++) writel(msg->buf[i], &mbx[i]); + /* Use SMC calls for Exception Level less than 3 where TF-A is available */ + if (!IS_ENABLED(CONFIG_SPL_BUILD) && current_el() < 3) { + ret = zynqmp_ipi_fw_call(zynqmp, SMC_IPI_MAILBOX_NOTIFY, 0); + + debug("%s, send %ld bytes\n", __func__, msg->len); + + return ret; + } + /* Write trigger interrupt */ writel(IPI_BIT_MASK_PMU0, &ipi_int_apu->trig); @@ -67,16 +131,23 @@ static int zynqmp_ipi_recv(struct mbox_chan *chan, void *data) struct zynqmp_ipi_msg *msg = (struct zynqmp_ipi_msg *)data; struct zynqmp_ipi *zynqmp = dev_get_priv(chan->dev); u32 *mbx = (u32 *)zynqmp->local_res_regs; + int ret = 0; /* * PMU Firmware does not trigger IPI interrupt for API call responses so - * there is no need to check ISR flags + * there is no need to check ISR flags for EL3. */ for (size_t i = 0; i < msg->len; i++) msg->buf[i] = readl(&mbx[i]); + /* Ack to remote if EL is not 3 */ + if (!IS_ENABLED(CONFIG_SPL_BUILD) && current_el() < 3) { + ret = zynqmp_ipi_fw_call(zynqmp, SMC_IPI_MAILBOX_ACK, + IPI_SMC_ACK_EIRQ_MASK); + } + debug("%s, recv %ld bytes\n", __func__, msg->len); - return 0; + return ret; }; static int zynqmp_ipi_probe(struct udevice *dev) @@ -84,6 +155,7 @@ static int zynqmp_ipi_probe(struct udevice *dev) struct zynqmp_ipi *zynqmp = dev_get_priv(dev); struct resource res; ofnode node; + int ret; debug("%s(dev=%p)\n", __func__, dev); @@ -91,6 +163,18 @@ static int zynqmp_ipi_probe(struct udevice *dev) /* Note IPI mailbox node needs to be the first one in DT */ node = ofnode_first_subnode(dev_ofnode(dev)); + ret = dev_read_u32(dev, "xlnx,ipi-id", &zynqmp->local_id); + if (ret) { + dev_err(dev, "can't get local ipi id\n"); + return ret; + } + + ret = ofnode_read_u32(node, "xlnx,ipi-id", &zynqmp->remote_id); + if (ret) { + dev_err(dev, "can't get remote ipi id\n"); + return ret; + } + if (ofnode_read_resource_byname(node, "local_request_region", &res)) { dev_err(dev, "No reg property for local_request_region\n"); return -EINVAL; From patchwork Mon Dec 4 21:56:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 1871730 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=kb5Uioth; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Skcw94LrFz23mj for ; Tue, 5 Dec 2023 08:57:29 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 615C587712; Mon, 4 Dec 2023 22:56:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="kb5Uioth"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 021BA87812; Mon, 4 Dec 2023 22:56:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20607.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eaa::607]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EACC3876A4 for ; Mon, 4 Dec 2023 22:56:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=tanmay.shah@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dhCflfemcyjyjS2U9NyFuUjp1Du6OetttkewdI5Ec34kGi35tXLi7JWbb+fFLjya3YvhoxagvTG68yW8OwWkY5f8XH/dNLlCdv9OYuLLuLT1d1MHn+MsnRouvbal212SVnFeH+qeHPouG4Hpj7ohe9xl8bgUkTVQ+JFKTEqFsApasiZckvWoLJMgLtlTvjergI7oeOk3YntJrSY2OZ1TclW9iKvXb28r4DLOq7P6ZHE/77fwX5NixO1rVoGbWCikuofkYaY1BbXIa9e0xBe2IBnA4QRekBseX66fBQwNFpTmu+aE4a7YaT7rJ8PStiMUV/XScHzQR8lT1X9XGxKx/g== 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=7TfF4QnOdQmWYFzBDOYpCIJDq32vCDi8vv9IXlxFNIs=; b=nNM2i1Bk0EBuD0ha6up8wZKnbhnVXibH60pxLvsU9yRK/4QG4zVSJ7p0fRQ0CrHUMwGoMOkcPyeMBexqRgZ+TsFMWSZEO1w8mQyEhKP+NacL15xNy3wG6nOtYS2662H3iemvkN6Fk4PBlph+0t8NTn5s3OhvnZJt+a2C4KuAHO0pQxTDSNpMbhP2gbBu4VbyoGYYPc3liiIjt/QbuwXKS3GZTZSnFQ8oxSiZ40BpvZGxTyiswglAmnb33fS7fk5hZug2owO9csQb73qPkS2UxZhjyewRetObfT8SkmmZys5PeKyDd4UGnorWk5EQ+nXtvNKVPTtc5p7s20S/uSV1rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7TfF4QnOdQmWYFzBDOYpCIJDq32vCDi8vv9IXlxFNIs=; b=kb5UiothkoDLwH91iW558mY81h+n72FaMkdG2VlDyXnCwN4ffmKtpaSqtY1dxlP1IAOE9o/uZkCdgxWhV9ZdJFiGOQbQtQ5dX1e4XhUco9rLq42vIznfEukMGHkiTBNq0STNXM+MAT1XjUFRh7k2ZOOtdqlEtosog44Qooqi+Gs= Received: from SN7PR04CA0106.namprd04.prod.outlook.com (2603:10b6:806:122::21) by SA0PR12MB4544.namprd12.prod.outlook.com (2603:10b6:806:70::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Mon, 4 Dec 2023 21:56:50 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:122:cafe::fc) by SN7PR04CA0106.outlook.office365.com (2603:10b6:806:122::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend Transport; Mon, 4 Dec 2023 21:56:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Mon, 4 Dec 2023 21:56:50 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 4 Dec 2023 15:56:49 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Mon, 4 Dec 2023 15:56:49 -0600 From: Tanmay Shah To: CC: , Tanmay Shah Subject: [PATCH 2/4] mailbox: add el3 support only for zynqmp platform Date: Mon, 4 Dec 2023 13:56:18 -0800 Message-ID: <20231204215620.63334-3-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204215620.63334-1-tanmay.shah@amd.com> References: <20231204215620.63334-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|SA0PR12MB4544:EE_ X-MS-Office365-Filtering-Correlation-Id: 9dac8b13-ed79-484b-a095-08dbf513eb4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lZsIEl28vg32kx8AuXQ50sm344NiNq3cUZMnKCnMbYQayeO5/Fme1aUVJYbqSbAX68pj+Kogh1RReXRcmuSvvIMlyVlJ+e+FUoJWwmKAneRSADWtGiDTXempC630OI41VWbFh6S4+PvBseheZfno1JNshS0oWw8t9f6dwz6uOJCOiX554hIG7oNjCxnYMOi3sW+gZI6PY/WmAOUBUjOAdzWCuJFxyK4q4sTlr283cj5Pq/WQ6DTYo0hczs8ngxwaqlUlvhe91mSgkf5Mj7FwnTFOJUyiI5oBbqfinNZT67VXl4p16S4a3y0FnGFhJ64SmkXfGKQ1mlSd/nMlxHCU2QB/gSvK5XdfilFkaIt7iX9ZKXb9cNvlF7ebKaDDZD0AaGip90v2rzLL6SHpBzPcSYtpyDnonLRT7fgd6GZ2uziba7IwHNWeBqjOdGBYonhiwNx1xEUb4rVw/+4ikjzD+c3ofyNJ1rRnTaOzIetbZ0lA24dfAL3H6Yxjgu+YI0gKd0xZ6taef2H7BiIlK8Ss7RV88JpwLDcp8ooYR0XNmSwS58jnPdi0pISEty+V2EG5ygUpHzdi8kMCEtJ27m2vOVNLze3M6AbmihIRBNLQ/svzM+HlWBW0dujYRe054zcsa7zDoQIjD5aQ9suF+gnDkiI7uL/lAGHSqkjsVwPQHmJ1lAspM3JGbRuvmtkqlNrhS89xm0OWqw5PoCVzjy1BViAywswfRCvJ2s/OUsowqkXlnhlECHetF1c0GIGLj3CPDIuqKgfz0y5F2BUXZtOZQw== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(136003)(396003)(376002)(346002)(230922051799003)(186009)(451199024)(64100799003)(82310400011)(1800799012)(36840700001)(40470700004)(46966006)(54906003)(70206006)(316002)(6916009)(70586007)(6666004)(40460700003)(478600001)(15650500001)(5660300002)(41300700001)(36756003)(2906002)(4326008)(8936002)(8676002)(44832011)(86362001)(83380400001)(2616005)(47076005)(81166007)(36860700001)(356005)(82740400003)(26005)(426003)(336012)(1076003)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 21:56:50.3349 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9dac8b13-ed79-484b-a095-08dbf513eb4d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4544 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean If U-Boot is running in Exception Level 3 then use hardcode register values for mailbox message passing with PMU. This is only supported for zynqmp platform. Signed-off-by: Tanmay Shah --- drivers/mailbox/zynqmp-ipi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index acd0b287db..e76561f310 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -81,6 +81,7 @@ struct zynqmp_ipi { void __iomem *remote_res_regs; u32 remote_id; u32 local_id; + bool el3_supported; }; static int zynqmp_ipi_fw_call(struct zynqmp_ipi *ipi_mbox, @@ -115,6 +116,12 @@ static int zynqmp_ipi_send(struct mbox_chan *chan, const void *data) return ret; } + /* Return if EL3 is not supported */ + if (!zynqmp->el3_supported) { + dev_err(chan->dev, "mailbox in EL3 only supported for zynqmp"); + return -EOPNOTSUPP; + } + /* Write trigger interrupt */ writel(IPI_BIT_MASK_PMU0, &ipi_int_apu->trig); @@ -159,6 +166,9 @@ static int zynqmp_ipi_probe(struct udevice *dev) debug("%s(dev=%p)\n", __func__, dev); + if (IS_ENABLED(CONFIG_SPL_BUILD) || of_machine_is_compatible("xlnx,zynqmp")) + zynqmp->el3_supported = true; + /* Get subnode where the regs are defined */ /* Note IPI mailbox node needs to be the first one in DT */ node = ofnode_first_subnode(dev_ofnode(dev)); From patchwork Mon Dec 4 21:56:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 1871732 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=H0C8Po7q; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Skcwh3GZQz23mj for ; Tue, 5 Dec 2023 08:57:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 26EF287878; Mon, 4 Dec 2023 22:56:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="H0C8Po7q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B62B876A4; Mon, 4 Dec 2023 22:56:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::604]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5F1C5876E0 for ; Mon, 4 Dec 2023 22:56:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=tanmay.shah@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLY1tytxtfX1GRZoCwKHMV92uJQHKuITe6OTU61BzuczDwIBNQKih0+Ha+peRHHWs3Lm9BaJMgP+TBIER2MGDXIUhbTSa2rBZosjMz4wNH9NJnNAerG2nCLxhr0pUN2tfQGWEP0XMfmMCnYTNHa+/wtM0xsgvJu/rO32wEn+0mRAeVAYiIJlLOIBcELtOGcws/lv3bovbAyrOKIADbyGIpc//Rv+Avyit/oYym2pmD0cbupna33vfa1yBldFEVkOxY8uv+BY6dmlUraU+Z6o8rCWQSq8TCi5RXLH27TrckqTW7HuKaos0f65r+PmTqpAy/tMTlMQUQsIsivOnErZxA== 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=HOnuyGZIx7ZPzSd/DYMjX77fPGoygQyneCAm5U7E0hE=; b=cW3Mp8zeDh9ghuUvL7xB/+v1/ywokTcF9YviavP8MFY3hoK7k3GyaQ/AhVybhTQ55L16a02lpUodxm5Ne4tMC4+pAiLZSNSRABLi+LPFkz6Tq2FraBwAfjqWQrg5zp/ml8Gjr+SpYCgcBQUnWevxItsFspObh30zvh1X6Fk93KU2sOfovn+ZEew1xOCphcLwAQmIP4NajI2KfugXdvGTqB1rnVkdrykZl8tw8mlBCuPHuAYGq6djSRz4mrMwze9YGsoJpvNZ/QQdt8wtlcw6ztRVcjh9HS+WlDV9y/nrBshZxoPoFuIfXCtqYkge49dEsIYeZJvWjy8A23CsVFMKug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HOnuyGZIx7ZPzSd/DYMjX77fPGoygQyneCAm5U7E0hE=; b=H0C8Po7qqZm3X8t5Ico5wxitKXmiKq82YiHGeJOA5efIpZYgVzK3AmWGFC1cn93pfHAF4gzj+JVDP/HKN+0rRk8y3iOagT0YS7Z9+L4S/lAY0zstqFacLaVOPHpDs2Mifp8NbVCyP6iX4uGHthHqJxp4dCTRYR7miC/WuChNitg= Received: from SN7PR04CA0108.namprd04.prod.outlook.com (2603:10b6:806:122::23) by SA1PR12MB7038.namprd12.prod.outlook.com (2603:10b6:806:24d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Mon, 4 Dec 2023 21:56:50 +0000 Received: from SN1PEPF0002636B.namprd02.prod.outlook.com (2603:10b6:806:122:cafe::3e) by SN7PR04CA0108.outlook.office365.com (2603:10b6:806:122::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33 via Frontend Transport; Mon, 4 Dec 2023 21:56:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002636B.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Mon, 4 Dec 2023 21:56:50 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 4 Dec 2023 15:56:50 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Mon, 4 Dec 2023 15:56:49 -0600 From: Tanmay Shah To: CC: , Tanmay Shah Subject: [PATCH 3/4] mailbox: zynqmp: support mulitple mboxes via device-tree Date: Mon, 4 Dec 2023 13:56:19 -0800 Message-ID: <20231204215620.63334-4-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204215620.63334-1-tanmay.shah@amd.com> References: <20231204215620.63334-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002636B:EE_|SA1PR12MB7038:EE_ X-MS-Office365-Filtering-Correlation-Id: 57804868-0fdb-4720-8af4-08dbf513eb78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KyXm1aBZfLpM9kOyWlWpb4K8luxnA+hB67D5yePtYuWqY92obfq4PNvn4nnKBi01N2+1pnMjUWv/mQu+jM1WhbXCT8hfBU/OSjluaQtgM+AmuLuny4f6uQ9Dt6S/tx/8OkBpnoxLwsGEg9fMjYMlsw+EuIllua8ZO1pTh/5D5OuM5657sdlsioCX8gtBXZvZYgz8mW8f6xr3r5XVwuKRfusni0p+CD7NTE8uA/yRUmemShXSQ7Ur4tBiUJmp8ACpZGpGaWDLjCjTYnIcXzwyv3rBZHVJkqkGjd3qeS+o23UQEypYToXN/e8mzv9Ch8nGUWfG5obqys6QGEz9Lnx15f5ZiOGWZEcqMPhEDpMSaSkF0h06jgNb1r87SFj86GdO04MJm8GVleeSoUMnAJ7nUdLzFwjQTT47lskKTz8GZ9qUFvaPBenuYSSB3ily/+wLQl9HAFTTeHPxGUPTbbWxwWQ8SYK4+Mmjq7957itGcJhHqoG5XaT7TXmUaazXByDglW9RmvQnKIJuKPNH2OvSxw3Shcg+4/qLr6SRD+R/lLDlVSO+0c7vHq9EF4yde/k5j5RsiSZfV5FYvpFNaaeEMs5IIifvW4BSr7tvgOAepBqlifNiOtAWavdj9JBTTXQH7pR1a3MfuCusStmaNee+3A4aj82jQsxKPCMorGh7GHx8spPgxnbRW8nO+vgogCTX0+NcRllfo07pvWUnUDxmqtTRkrmjgTUluLiLT1dRr0wdgIROxuOXfTBR/8BRtzhWfB8DADrzv5pHJIwseJqLww== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(376002)(396003)(136003)(346002)(39860400002)(230922051799003)(64100799003)(451199024)(82310400011)(1800799012)(186009)(40470700004)(36840700001)(46966006)(40460700003)(6916009)(54906003)(8936002)(86362001)(316002)(8676002)(44832011)(4326008)(70206006)(478600001)(70586007)(36756003)(41300700001)(15650500001)(2906002)(5660300002)(36860700001)(81166007)(47076005)(356005)(26005)(2616005)(426003)(1076003)(83380400001)(82740400003)(336012)(6666004)(40480700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 21:56:50.6161 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57804868-0fdb-4720-8af4-08dbf513eb78 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002636B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7038 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean As of now only one mailbox agent is supported by mailbox driver. On zynqmp platform there are about 7 mailbox agents which can communicate over same IPI channel to U-Boot. This patch series introduces new "zynqmp_ipi_dest" driver which adds one to multi-channel mailbox support. Following format in device-tree is expected as per latest bindings: zynqmp-ipi { compatible = "xlnx,zynqmp-ipi-mailbox"; mbox_1: mailbox@1 { /* New compatible for child node */ compatible = "xlnx,zynqmp-ipi-dest-mailbox"; ... }; ... mbox_n: mailbox@n { compatible = "xlnx,zynqmp-ipi-dest-mailbox"; ... } }; Then mailbox client uses child mailbox node as following: ipi-dest-1 { ... mboxes = , ; mbox-names = "tx", "rx"; ... }; New "zynqmp_ipi_dest" driver is for devices with "xlnx,zynqmp-ipi-dest-mailbox" compatible string. This driver will take care of mailbox send recv ops and it replaces previous "zynqmp_ipi" driver. Now "zynqmp_ipi" driver simply binds each child device with "zynqmp_ipi_dest" driver. However, its important to maintain backward comaptibility with previous bindings where child node does not have compatible string. In such case, new driver isn't probed by U-Boot during boot and system fails to boot. To resolve this issue firmware-zynqmp.c driver probes all the IPI parent node driver which binds each child node device with "zynqmp_ipi_dest" driver. This makes sure corresponding child driver will be probed when requested using mbox_get_by_name or mbox_get_by_idx framework calls. This way multiple mailbox agents are supported in device-tree without breaking previous binding support. Signed-off-by: Tanmay Shah --- drivers/firmware/firmware-zynqmp.c | 22 ++++++++++ drivers/mailbox/zynqmp-ipi.c | 65 ++++++++++++++++++++++++------ 2 files changed, 74 insertions(+), 13 deletions(-) diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 8ea15c7ed3..dfad798a2e 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -290,10 +291,31 @@ int zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size) static int zynqmp_power_probe(struct udevice *dev) { + struct udevice *ipi_dev; + ofnode ipi_node; int ret; debug("%s, (dev=%p)\n", __func__, dev); + /* + * Probe all IPI parent node driver. It is important to have IPI + * devices available when requested by mbox_get_by* API. + * If IPI device isn't available, then mailbox request fails and + * that causes system boot failure. + * To avoid this make sure all IPI parent drivers are probed here, + * and IPI parent driver binds each child node to mailbox driver. + * This way mbox_get_by_* API will have correct mailbox device + * driver probed. + */ + ofnode_for_each_compatible_node(ipi_node, "xlnx,zynqmp-ipi-mailbox") { + ret = uclass_get_device_by_ofnode(UCLASS_NOP, ipi_node, &ipi_dev); + if (ret) { + dev_err(dev, "failed to get IPI device from node %s\n", + ofnode_get_name(ipi_node)); + return ret; + } + } + ret = mbox_get_by_name(dev, "tx", &zynqmp_power.tx_chan); if (ret) { debug("%s: Cannot find tx mailbox\n", __func__); diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index e76561f310..eb86847bbe 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -157,7 +158,7 @@ static int zynqmp_ipi_recv(struct mbox_chan *chan, void *data) return ret; }; -static int zynqmp_ipi_probe(struct udevice *dev) +static int zynqmp_ipi_dest_probe(struct udevice *dev) { struct zynqmp_ipi *zynqmp = dev_get_priv(dev); struct resource res; @@ -166,14 +167,12 @@ static int zynqmp_ipi_probe(struct udevice *dev) debug("%s(dev=%p)\n", __func__, dev); + node = dev_ofnode(dev); + if (IS_ENABLED(CONFIG_SPL_BUILD) || of_machine_is_compatible("xlnx,zynqmp")) zynqmp->el3_supported = true; - /* Get subnode where the regs are defined */ - /* Note IPI mailbox node needs to be the first one in DT */ - node = ofnode_first_subnode(dev_ofnode(dev)); - - ret = dev_read_u32(dev, "xlnx,ipi-id", &zynqmp->local_id); + ret = dev_read_u32(dev->parent, "xlnx,ipi-id", &zynqmp->local_id); if (ret) { dev_err(dev, "can't get local ipi id\n"); return ret; @@ -191,6 +190,8 @@ static int zynqmp_ipi_probe(struct udevice *dev) }; zynqmp->local_req_regs = devm_ioremap(dev, res.start, (res.start - res.end)); + if (!zynqmp->local_req_regs) + return -EINVAL; if (ofnode_read_resource_byname(node, "local_response_region", &res)) { dev_err(dev, "No reg property for local_response_region\n"); @@ -198,6 +199,8 @@ static int zynqmp_ipi_probe(struct udevice *dev) }; zynqmp->local_res_regs = devm_ioremap(dev, res.start, (res.start - res.end)); + if (!zynqmp->local_res_regs) + return -EINVAL; if (ofnode_read_resource_byname(node, "remote_request_region", &res)) { dev_err(dev, "No reg property for remote_request_region\n"); @@ -205,6 +208,8 @@ static int zynqmp_ipi_probe(struct udevice *dev) }; zynqmp->remote_req_regs = devm_ioremap(dev, res.start, (res.start - res.end)); + if (!zynqmp->remote_req_regs) + return -EINVAL; if (ofnode_read_resource_byname(node, "remote_response_region", &res)) { dev_err(dev, "No reg property for remote_response_region\n"); @@ -212,25 +217,59 @@ static int zynqmp_ipi_probe(struct udevice *dev) }; zynqmp->remote_res_regs = devm_ioremap(dev, res.start, (res.start - res.end)); + if (!zynqmp->remote_res_regs) + return -EINVAL; return 0; }; -static const struct udevice_id zynqmp_ipi_ids[] = { - { .compatible = "xlnx,zynqmp-ipi-mailbox" }, - { } +static int zynqmp_ipi_probe(struct udevice *dev) +{ + struct udevice *cdev; + ofnode cnode; + int ret; + + debug("%s(dev=%p)\n", __func__, dev); + + dev_for_each_subnode(cnode, dev) { + ret = device_bind_driver_to_node(dev, "zynqmp_ipi_dest", + ofnode_get_name(cnode), + cnode, &cdev); + if (ret) + return ret; + } + + return 0; }; -struct mbox_ops zynqmp_ipi_mbox_ops = { +struct mbox_ops zynqmp_ipi_dest_mbox_ops = { .send = zynqmp_ipi_send, .recv = zynqmp_ipi_recv, }; +static const struct udevice_id zynqmp_ipi_dest_ids[] = { + { .compatible = "xlnx,zynqmp-ipi-dest-mailbox" }, + { } +}; + +U_BOOT_DRIVER(zynqmp_ipi_dest) = { + .name = "zynqmp_ipi_dest", + .id = UCLASS_MAILBOX, + .of_match = zynqmp_ipi_dest_ids, + .probe = zynqmp_ipi_dest_probe, + .priv_auto = sizeof(struct zynqmp_ipi), + .ops = &zynqmp_ipi_dest_mbox_ops, +}; + +static const struct udevice_id zynqmp_ipi_ids[] = { + { .compatible = "xlnx,zynqmp-ipi-mailbox" }, + { } +}; + U_BOOT_DRIVER(zynqmp_ipi) = { .name = "zynqmp_ipi", - .id = UCLASS_MAILBOX, + .id = UCLASS_NOP, .of_match = zynqmp_ipi_ids, .probe = zynqmp_ipi_probe, - .priv_auto = sizeof(struct zynqmp_ipi), - .ops = &zynqmp_ipi_mbox_ops, + .flags = DM_FLAG_PROBE_AFTER_BIND, }; From patchwork Mon Dec 4 21:56:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tanmay Shah X-Patchwork-Id: 1871731 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=bO7l/s57; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SkcwQ55tNz23mj for ; Tue, 5 Dec 2023 08:57:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2FDC87825; Mon, 4 Dec 2023 22:56:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="bO7l/s57"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 094F0876A4; Mon, 4 Dec 2023 22:56:57 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20626.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::626]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7B8C987712 for ; Mon, 4 Dec 2023 22:56:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=tanmay.shah@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KyW62182ccTHCf6rMt0sZfbP+qYwaF9nWrdo1cKYNveEaYrG0e/JUfAQHyddffWkg4E6uQzsFr5uP8yXLqtjYWTOI69+2vQmxboPDxAUMo+e3XgQwACPWK1siTyAbKrfWFcCtFN9xt9sG0caLe5KGy9L7Fq5kKZRqm509Vnm1+TPIJIZs3u34HmxfBnDp5hF0NPqZ17oap8Zmjuinw5VOZ+F/rMzOn3s9KDG75HjP37jqmlYpyRcGpvDxboI19gCudFmDrUlTnAyXm28s7EvCmIUiIaP6zknR7Nyz9vAmQrXFObQwxLewajSmJWou3eZsCbxkpRqzA8IRYUomgjBVg== 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=s5X9oKVgVTc7jO1I3vbJStI/LHDxAG2E384hRRrEkvk=; b=bWHAQ0vYuaRLLiW4Xt897lr5Np/YhfR0crnrHU1F47+zTH0VdFMW390y03y/meqc7Q/Nr0R2CY9Bi4dEwtTdAnrMANMRxuZl92f+IzLRFQpPukjT4oNhPByR47N7CtGowci5i4xNr1X4mfBcDNdQCMiL1tPC+u2VBS4EcY1SxZeYKzhcw9pfyZs1tz6kGEkwJdd62nwgbHWANPmB+GkppO3lxn4vVTMOwJs0vUvLZXC4vMSP6eOmCFuNTMLqXy2gm1FttGxV7BgtFohnjJxlqHzri/ea+0qogAL8gXys/+vHM+kGmdXzpfdGrO1E5CTchw430MQB24OoliYlnvftLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s5X9oKVgVTc7jO1I3vbJStI/LHDxAG2E384hRRrEkvk=; b=bO7l/s577jdCTSHQjZ+RPJNQbT9UF95U7TBu1SOtQrTHNUozvqT/aWBaEmOulqKNOf+V0waINM0gDhHF5MtZJ+2FHdSuHZMD+7zczGQpvVVDIqFKKO5nDspVqbJD9Z7gAnblkhfY2hguEZYEAcPgkIXQisV5XSH2gjJ8C5UiivU= Received: from SA1P222CA0134.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:3c2::7) by IA1PR12MB6137.namprd12.prod.outlook.com (2603:10b6:208:3eb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Mon, 4 Dec 2023 21:56:51 +0000 Received: from SN1PEPF00026369.namprd02.prod.outlook.com (2603:10b6:806:3c2:cafe::b3) by SA1P222CA0134.outlook.office365.com (2603:10b6:806:3c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.29 via Frontend Transport; Mon, 4 Dec 2023 21:56:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00026369.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7068.20 via Frontend Transport; Mon, 4 Dec 2023 21:56:51 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 4 Dec 2023 15:56:50 -0600 Received: from xsjtanmays50.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Mon, 4 Dec 2023 15:56:50 -0600 From: Tanmay Shah To: CC: , Tanmay Shah Subject: [PATCH 4/4] dts: zynqmp: add missing destination mailbox compatible Date: Mon, 4 Dec 2023 13:56:20 -0800 Message-ID: <20231204215620.63334-5-tanmay.shah@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231204215620.63334-1-tanmay.shah@amd.com> References: <20231204215620.63334-1-tanmay.shah@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00026369:EE_|IA1PR12MB6137:EE_ X-MS-Office365-Filtering-Correlation-Id: 72ab01a5-c8e0-456a-3726-08dbf513ebd3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RUQQSxZKqg7t4xEKVmFz0ZH1FIiV2SSipcbmynrjUbjflM0fvL3FNwmv/uOHR4MpIkYa5g84yv7nf005/KdOjh0t9D0VF1TPJyNkAiSzCKXgFEWBVzQHYCfb3auUrWAnxVRuInoatJnHXbVt4u10Xaw+vlLwKf7mLROyffxW1eYFFioXs9gFylmsQkKGlwE4G3Ygt29j83f2YAaQR6DMBvhzhHAD2TXEVkCFNT4Iue6FwWQ9o9ku7lu/aBbKLMDE74LGZP7nDoGpqfjXRF728481tLUti5aPm+vfGPN4yQktuoNjlrb5GO7K3Mch0/QMPR4V6emF3Uf8c3SStqwwnml4rdC265chCX/veH3iST1U5bWWp7596gII/MftXUUtDrpa9vDkITLJ/v3HlNi0b2VHplYn4LKv6cPdhlbaRkvutPS07crZ6uP1SXkRVY7JH3uH6nQe7pPO0Jc8rFjIe039cjnyoh1UfQoNxWJE2WO0mdPIdyYrLtLIpPHLcSPi/pEDN130pES4JO04Y5zvIJ5afYJre1Q+FiVUTkFjjW5MJTnOUf5kowECpLR+jHI1h6onZ1jrLmXpVVzF5Fq53w9Ck6biFdTf3Jh+S0nrqgUz7MC1TgL0byerHVbL7h0muQFkiM+lxUJj58Ew6SVWOIpMSiExfz50LdzA8i9eTUFZcwjFydCyZuNwHmDOlsh3u0MO2o8OnyxeIl8w2A7j7ZsRRLy/HcKNCbnlOD9y7JPBs83ummLd1b1snOEo5n6L2sPjePJ4luf2mr8nwSrcew== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(4636009)(136003)(396003)(39860400002)(346002)(376002)(230922051799003)(451199024)(64100799003)(186009)(82310400011)(1800799012)(36840700001)(40470700004)(46966006)(5660300002)(40460700003)(44832011)(4744005)(86362001)(4326008)(8676002)(8936002)(2906002)(15650500001)(41300700001)(36756003)(2616005)(40480700001)(1076003)(426003)(81166007)(356005)(82740400003)(83380400001)(478600001)(336012)(26005)(6666004)(47076005)(36860700001)(316002)(54906003)(6916009)(70586007)(70206006)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2023 21:56:51.2103 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72ab01a5-c8e0-456a-3726-08dbf513ebd3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00026369.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6137 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The commit in linux kernel 81186dc16101 ("dt-bindings: zynqmp: add destination mailbox compatible") make compatible string for child nodes mandatory that's why add it. Signed-off-by: Tanmay Shah --- arch/arm/dts/zynqmp.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/dts/zynqmp.dtsi b/arch/arm/dts/zynqmp.dtsi index 58a56bc1bd..21be909b1a 100644 --- a/arch/arm/dts/zynqmp.dtsi +++ b/arch/arm/dts/zynqmp.dtsi @@ -148,6 +148,7 @@ ipi_mailbox_pmu1: mailbox@ff9905c0 { bootph-all; + compatible = "xlnx,zynqmp-ipi-dest-mailbox"; reg = <0x0 0xff9905c0 0x0 0x20>, <0x0 0xff9905e0 0x0 0x20>, <0x0 0xff990e80 0x0 0x20>,