Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3313EC433F5 for ; Tue, 5 Oct 2021 15:17:20 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A7C361526 for ; Tue, 5 Oct 2021 15:17:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4A7C361526 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=xilinx.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3053F81197; Tue, 5 Oct 2021 17:17:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=xilinx.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=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="qfSWHem6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C92A181E14; Tue, 5 Oct 2021 17:17:14 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::61e]) (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 685D1807CD for ; Tue, 5 Oct 2021 17:17:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michals@xilinx.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5ZS8OTe7jIzm0tMcrpsnZfoA1Nrow/fHO2er1Jt29gc2+M0ONOOv+XxYWDj7QuQ8bT3eRqu2EsVkHuhUY3B9uH31ACLO073P8/4myAJlowohhZ/F6+s7YyoNbSPz7UjHe/iqBLkouJvpD5eM8r3I6BhB/T3O7yixkzw7k1WCvz2q5FAgvGtP16iERR6Q3Vm/jpJThjBYXOQiw1e8VF31vR400ak5yobMdle/xCyvo+UztoaIk/TDtMI73brktxNTvHlAaVl9rh0KHgfIwza7bJsczldaHNO7DI4h4HKczFhoQw+kQtW7BMsXzAeRQjaXtfm0xkCW2ZfRW1qrmSeOw== 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=VoRSdi5TRJL82RoK8mQmj1pdCaFL7+tC6UzReqXlgwY=; b=T8NydaEnWSkdhuqvHHIiX7QC82EjT2xMobjs5BdXC+m3fBgn12UyTrmIIgFfifgAyl3813q8nilkwIE7QCPRozp4g4M+t3PlyvBzJz2F78LASFVK8JN+K7P3U3pctW02uvh7126G+Vfe2jQIqSjhLaKEPpc3lxSRCkLLbiht0XEs1Ha8Q4aIbxOlcrocTjXvUf0dIXS9ouVWHtdsMvfvWYgFwi9yEt4sDDAcPxmNj9hOzFwvllpJMC+WuarKPWwwh5R6qefU1+wBZipGamyRUmgBB6f0+cIxRnom2EGnA0Og+HV730fyI8DZZeJqwZBVhQBWEJ/x5V1k5vTuyTG4Dg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=foundries.io smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VoRSdi5TRJL82RoK8mQmj1pdCaFL7+tC6UzReqXlgwY=; b=qfSWHem6BWH/TUal9H6GCmltyyFFdiC8uf6gl0pb71ypYQjXplnxiqPSusbEpnEfHsDe2ST+GW0TQ/48JWQCKVyoS/FEpXfoZqk+5blwm+GTMgL5tYn+Y8BH8EvElQpAZTI7T9rkh5wHErNa7tJQ2ZcxRt/2I3bpw0ZTlw59AKo= Received: from SN6PR08CA0023.namprd08.prod.outlook.com (2603:10b6:805:66::36) by BN6PR02MB2227.namprd02.prod.outlook.com (2603:10b6:404:28::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15; Tue, 5 Oct 2021 15:16:58 +0000 Received: from SN1NAM02FT0024.eop-nam02.prod.protection.outlook.com (2603:10b6:805:66:cafe::4a) by SN6PR08CA0023.outlook.office365.com (2603:10b6:805:66::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.14 via Frontend Transport; Tue, 5 Oct 2021 15:16:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; foundries.io; dkim=none (message not signed) header.d=none;foundries.io; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by SN1NAM02FT0024.mail.protection.outlook.com (10.97.5.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4566.14 via Frontend Transport; Tue, 5 Oct 2021 15:16:58 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Tue, 5 Oct 2021 08:16:52 -0700 Received: from smtp.xilinx.com (172.19.127.95) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Tue, 5 Oct 2021 08:16:52 -0700 Envelope-to: igor.opaniuk@foundries.io, mike@foundries.io, ricardo@foundries.io, u-boot@lists.denx.de, mr.nuke.me@gmail.com, sjg@chromium.org, trini@konsulko.com, jorge@foundries.io Received: from [10.254.241.49] (port=46890) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1mXmBX-000CVU-TC; Tue, 05 Oct 2021 08:16:52 -0700 Subject: Re: [RFC PATCH 2/2] fpga: xilinx: allow loading authenticated images (DDR) To: "Jorge Ramirez-Ortiz, Foundries" , Michal Simek CC: , , , , , , References: <20211005111324.19749-1-jorge@foundries.io> <20211005111324.19749-3-jorge@foundries.io> <7b6f41a8-7812-c2b6-a4f5-1bdad7d2a784@xilinx.com> <20211005140354.GA30050@trex> From: Michal Simek Message-ID: Date: Tue, 5 Oct 2021 17:16:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20211005140354.GA30050@trex> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78a71d2f-5fc1-4177-ef43-08d988132cad X-MS-TrafficTypeDiagnostic: BN6PR02MB2227: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F7qGw4fZm6+HEH9f1Awf/O4s3/0eVlPn1sWxNbtQRraATPoBNfqYpVS3kng4DTcxN5gHdfOQggvoxW81EZQ+rVWUo/Hn3TQe1bCHPL4MwEx6HkvmIR4R+Fh//zZg5XXpNiMA57njFWH66QhlzETAUpAVegV/IjFXhvBR5T0wgfyy3X4CTmaF/lm1KHexHXJdh0RQsyfq8Gp/tmGJ8+ZBXEaFM2rmkLgLJ/1DXPRvgfBdbtQYClxx8jiPZm8plSH3t9rNS7g/L2z1JI9nRtvCNGnblE6ud27HF9CaaToHFtXdj/lx1SoWKrvKl3gsulXhHc6KXrWN703pkdNJoh/y6efTbhoqMHdjXZx4dWLMklGt7Mx0u50Hp/57/acUYc+mUNFs7i95SAjlZuueReF9z4vD4chzj5Xrxxx0ZumkOrRtrFDTYNxis8GpzI/mSq4nJTnsqMc0NyTP0dE5GviVTc58nD8tBhm8XnN+k2ptxEqVUbOxAP/LENophxBJmBgg9TtcJPr2xi+9hCuR0T85vqxNwNa1U2JD82BBiy1GgmlHlRnnJSFrw0OdqmiL5s7/U4J4ldSusg9LH2rCTJiiZJBLhNFRl+Mp+4PBJ/LsSOlEz65tt3yOVGrdnhPSwSMs20IDWLUKGN32skUCo+Kn/tqDO3me4Ra4+MqDl3731tmv3wD+szaPPVXX9/dDIpnvaWoH4Y8R9hvS6dP5IFgSTLnlWf87MA1fgYzFJ1E88aiM6/RfWdqHqL2v3OqmPEwUOw/iyXSIilzka3dyNDP3KA== X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(36840700001)(46966006)(186003)(316002)(9786002)(6666004)(36906005)(54906003)(110136005)(70586007)(70206006)(4326008)(53546011)(26005)(36860700001)(47076005)(31696002)(2616005)(44832011)(8936002)(426003)(5660300002)(508600001)(7636003)(31686004)(83380400001)(336012)(36756003)(2906002)(356005)(8676002)(82310400003)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2021 15:16:58.4058 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78a71d2f-5fc1-4177-ef43-08d988132cad X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT0024.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR02MB2227 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean On 10/5/21 4:03 PM, Jorge Ramirez-Ortiz, Foundries wrote: > On 05/10/21, Michal Simek wrote: >> >> >> On 10/5/21 1:13 PM, Jorge Ramirez-Ortiz wrote: >>> Add new compatible string u-boot,zynqmp-fpga-ddrauth to handle this >>> use case. >>> >>> Signed-off-by: Jorge Ramirez-Ortiz >>> --- >>> drivers/fpga/xilinx.c | 29 +++++++++++++++++++++++++---- >>> drivers/fpga/zynqmppl.c | 4 ++-- >>> include/xilinx.h | 2 +- >>> 3 files changed, 28 insertions(+), 7 deletions(-) >>> >>> diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c >>> index cbebefb55f..c8035105e2 100644 >>> --- a/drivers/fpga/xilinx.c >>> +++ b/drivers/fpga/xilinx.c >>> @@ -135,23 +135,44 @@ int fpga_loadbitstream(int devnum, char *fpgadata, size_t size, >>> dataptr += 4; >>> printf(" bytes in bitstream = %d\n", swapsize); >>> >>> - return fpga_load(devnum, dataptr, swapsize, bstype); >>> + return fpga_load(devnum, dataptr, swapsize, bstype, NULL); >>> } >>> >>> int xilinx_load(xilinx_desc *desc, const void *buf, size_t bsize, >>> - bitstream_type bstype) >>> + bitstream_type bstype, const char *compatible) >>> { >>> + struct fpga_secure_info info = { 0 }; >>> + >>> if (!xilinx_validate (desc, (char *)__FUNCTION__)) { >>> printf ("%s: Invalid device descriptor\n", __FUNCTION__); >>> return FPGA_FAIL; >>> } >>> >>> - if (!desc->operations || !desc->operations->load) { >>> + if (!desc->operations) { >>> printf("%s: Missing load operation\n", __func__); >>> return FPGA_FAIL; >>> } >>> >>> - return desc->operations->load(desc, buf, bsize, bstype); >>> + if (!compatible || !strcmp(compatible, "u-boot,fpga-legacy")) { >>> + if (!desc->operations->load) { >>> + printf("%s: Missing load operation\n", __func__); >>> + return FPGA_FAIL; >>> + } >>> + return desc->operations->load(desc, buf, bsize, bstype); >>> + } >>> + >>> + if (!strcmp(compatible, "u-boot,zynqmp-fpga-ddrauth")) { >>> + if (!desc->operations->loads) { >>> + printf("%s: Missing load operation\n", __func__); >>> + return FPGA_FAIL; >>> + } >>> + /* DDR authentication */ >>> + info.authflag = 1; >>> + return desc->operations->loads(desc, buf, bsize, &info); >>> + } >> >> I am not sure about this solution. First of all it forces SPL to have >> additional code which just extending size. It means there must be a way >> to enable/disable it. > > that can be contained of course...so not really an issue (ie compile > out either fpga_load or fpga_loads depending on needs). > >> >> The next thing is that you have zynqmp string in generic xilinx file >> which doesn't look right. It would be better to deal with image types >> directly in driver which is capable to handle it. > > sure that is easy..but the idea is the same We just need to find out how this should be properly propagated and stored. > >> It means record fit image compatible string in the driver with >> hooks/flags and determined what should be called. > > what about the compatible names? will you define those? or should I do > it? Just define it and let's see if this fits. > > For our use case, we need DDR authentication so that must be > defined. I can add others and someone else can add the support needed? > Sure. None is asking you to support everything. Just add support for regular bitstreams and your case. And adding support for something else will be just +1 if interface is right. Thanks, Michal