From patchwork Tue Feb 14 13:19:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Frager X-Patchwork-Id: 1742349 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; 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=) 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=fPEtEOAK; dkim-atps=neutral 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 (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PGMKC70l5z23qt for ; Wed, 15 Feb 2023 00:20:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 30A8285927; Tue, 14 Feb 2023 14:20:39 +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="fPEtEOAK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F07485929; Tue, 14 Feb 2023 14:20:36 +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,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::61c]) (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 EE28985937 for ; Tue, 14 Feb 2023 14:20:24 +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=neal.frager@amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aI2H5SQOz4GY3C9D9t4ESKMRKc4Bu65Q6Ob6Y/2by7DH1Vd7PP7spIPtoYaVB1UiW4Fai2xhl6YsadBjSZ3KEE4mDuwiqoEp3ctwuCwAYaKXaCFJOVI5oQjaGwJEffI7hcfcLM2QeDvJQre4miF8feLN85NB4W6buhTiK12skhTOG0Mm9I6fDtMN/uXuD3Cou8VudMktpQlwCeQzZuDs7DctVchVp7IKa9w2UHEiQlFtbYxm1/Qgig30jXY1SxPzh3F5Wz9uI1E6Xu+B453zGgxHUL7ecudy8dzdn6qklFzMKle7Tzl0Ryxb8z2QxcBVzPj0yIvoyHs79g+PPf0w3Q== 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=1CnWn2Rjhr3a0cY4497o7BWn2AVhiOaUYyhSZw76gfU=; b=Uhh2eXdXQ4Hor8OZqaAB0LblCG0w6PUgmnyKVCBNrzPmKxhV4d9v+apfytqpycTLfmwkCeI+X+BGsBxqohrq5y0dBL9jj5rP75rK/JQkrtvKqyaCq+ZlVan1o4+Fqq6qLJejxu4kU+A4R2bi7UFM0BjeI+3XqFbMapNBhRJkjKW/JdDuqC4bQJx+/EtpjcRdr2k94V9vZX1A4t/qDp5SwPikehl+XUu0uuy0doahNFQTdqZYIa2JWUrDh9N3T4wWCVEZS+3sO/8siaoEmj4gOkR57R0mnZDjWFhKLRa9a2oUKArcO/tQapFFU9eHlECi3VGJYvPYu/2UbU7FyYV/rA== 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 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=1CnWn2Rjhr3a0cY4497o7BWn2AVhiOaUYyhSZw76gfU=; b=fPEtEOAKzyqtqUBDsjYHqUajm2XwHnToeiNHz8VJMOTpLTuwlEisGNlzTpD1dWNQwBS0nogb5S0sEIodpYSN7uQWeLdTYlioYeADuCDVMHX9FNzXmURrU+i8FI74L9qyunVJPrRY1MqRdPbXkWIIDqdtbZ7zg2aXLUI0LqSmv7c= Received: from BN0PR07CA0021.namprd07.prod.outlook.com (2603:10b6:408:141::16) by SJ0PR12MB7460.namprd12.prod.outlook.com (2603:10b6:a03:48d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.24; Tue, 14 Feb 2023 13:20:18 +0000 Received: from BN8NAM11FT079.eop-nam11.prod.protection.outlook.com (2603:10b6:408:141:cafe::80) by BN0PR07CA0021.outlook.office365.com (2603:10b6:408:141::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26 via Frontend Transport; Tue, 14 Feb 2023 13:20:18 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT079.mail.protection.outlook.com (10.13.177.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6111.10 via Frontend Transport; Tue, 14 Feb 2023 13:20:17 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 14 Feb 2023 07:20:17 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 14 Feb 2023 05:20:16 -0800 Received: from xirengwts08.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 14 Feb 2023 07:20:15 -0600 From: Neal Frager To: , CC: , , , , Neal Frager Subject: [PATCH v1 1/1] fpga: zynqmppl: fix fpga loads command for unencrypted use case Date: Tue, 14 Feb 2023 13:19:59 +0000 Message-ID: <20230214131959.40298-1-neal.frager@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT079:EE_|SJ0PR12MB7460:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b35906c-572b-4cb8-1b1a-08db0e8e375e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fw/hi8GFXbPGmAKIQzGAMcEctt+lvR/JS43Oms7PBPv0zlPBQ12pVfDlpoWwoJfrnaNztLFPi4J8kouzdwC0RoeBT8DVrrawO3yjFIKm6RJe6uceL19WAD4d/2KqZG/YPitTf8ksnOx35Jbcp59z1MVXBn5T6YnuGRtSj4U+K2YIplCj887DucpQEnBf7gJD7rpMj4wRHcnixlSD5d1oC8LSCiRs9G9IkI0iMwpcf2GpLOeTVS3+owp96Z7CyFs/vAWV7zdOuGtgqInh22mfK48eb/qkwWTb4raQAlW/cO/RE9oU1MdhMfixNnky7iNOuCYPtCv1CgZ0kGcJqC2oOLDV0DL4qYDr+fFnKm4k81YLa211l+Q/c4D7v9JD+BDCewcgFLri5IQqYbdodzAyGen/t2wkbb9HwykBh63RvJKZBlxLflV2FBI7S90+1EzwN9km9pCFIQnrTyZOLFdiI6IQgXpU6JvdnbCrz7xDLvs7DMGzqpwm/stecvADDqwpbZFpqMbFUAdm3HSn6LveB/8v3mEKCUFKk45W6aA8k8c752PAuBDFHzIfuBWGwEdIGlkJ3xMuZfkMv6OXEFHjMFmdM8wPNBtTo5EBmVDGVSNSITGf30cKlvJmBx2ZS7g0YjqpQBgWwsT9s4bGg9zLrnU+wN+uMSgwAEdWhfwLfyU5bxaTq8rBXXNMuMeGaSb2sLbECH11+Kaw9Jk7csvEZqmYMBlabrN8RSXt8ueNmdc= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB03.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230025)(4636009)(136003)(396003)(39860400002)(346002)(376002)(451199018)(36840700001)(40470700004)(46966006)(316002)(40460700003)(110136005)(8676002)(47076005)(40480700001)(82310400005)(2616005)(83380400001)(86362001)(336012)(81166007)(426003)(356005)(36860700001)(6636002)(82740400003)(36756003)(54906003)(6666004)(186003)(478600001)(26005)(44832011)(8936002)(2906002)(1076003)(5660300002)(41300700001)(70206006)(70586007)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2023 13:20:17.9647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b35906c-572b-4cb8-1b1a-08db0e8e375e 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT079.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7460 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.6 at phobos.denx.de X-Virus-Status: Clean When using the fpga loads command, the driver is passing the AES encryption key address is all cases. However, for the authenticated, but not encrypted use case, there is no AES encryption key, and this value is 0. When AES encryption is not used on the fpga bitstream, the pmufw assumes that the AES key address is a bitstream size value like what is used by the unsecure fpga load command. To fix the problem, this patch checks to see if the AES key address is zero. If the AES key address is zero, it means that AES is not being used on the bitstream and the bitstream size should be passed instead. Thus, matching the fpga load functionality. Signed-off-by: Neal Frager Acked-by: Ashok Reddy Soma --- drivers/fpga/zynqmppl.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c index 6b394869db..718c04b22c 100644 --- a/drivers/fpga/zynqmppl.c +++ b/drivers/fpga/zynqmppl.c @@ -278,10 +278,16 @@ static int zynqmp_loads(xilinx_desc *desc, const void *buf, size_t bsize, buf_lo = lower_32_bits((ulong)buf); buf_hi = upper_32_bits((ulong)buf); - ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, + if ((u32)(uintptr_t)fpga_sec_info->userkey_addr) + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, buf_hi, - (u32)(uintptr_t)fpga_sec_info->userkey_addr, - flag, ret_payload); + (u32)(uintptr_t)fpga_sec_info->userkey_addr, + flag, ret_payload); + else + ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, + buf_hi, (u32)bsize, + flag, ret_payload); + if (ret) puts("PL FPGA LOAD fail\n"); else