From mboxrd@z Thu Jan 1 00:00:00 1970 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 6ABDAC433F5 for ; Tue, 5 Oct 2021 14:04:06 +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 9DF3561175 for ; Tue, 5 Oct 2021 14:04:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9DF3561175 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=foundries.io 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 2D31580202; Tue, 5 Oct 2021 16:04:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.b="luK6dUZp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 658BD81196; Tue, 5 Oct 2021 16:04:00 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 195888018E for ; Tue, 5 Oct 2021 16:03:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jorge@foundries.io Received: by mail-wr1-x433.google.com with SMTP id t2so13998151wrb.8 for ; Tue, 05 Oct 2021 07:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=VkFqVYLRVHQ/Ox5Tc+CMkyzXU7GNY1sZW2hmY7G4wwE=; b=luK6dUZpA0hbmm/tYL7p9FJbmnTAg+vHVtaMOdny6178KfMhHSNXXKek712CK9ZzPf 6Vc96fjKo154x9a5LtXeXeK6kd1KS2La6OhRMgqo267qsRZD+9YGx+NuoTIVexzjNWkd 3JLd50vHnLa4JkHgrCbrMEM4ZC4PZlKac9JtKeCfe96MzM2sZ4wQpTLee71VA/bDTte2 YrNUu/L7JaNWlfv+SVj27rzTUw+ETC137zERTzArBK51QvwW6uzLfGksUEDIVDNOzvrW 0GwQFcCfWs9WEUnP01/J+nZ6GCYWdi3MVWFxkheUR50lR/S3al1SPKK3tRW3p+o4S14Q tiBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VkFqVYLRVHQ/Ox5Tc+CMkyzXU7GNY1sZW2hmY7G4wwE=; b=1Gcm6Vby1Bi+SLvbpXI9pBzS19TgBJddNhYDFcDXzC81UEwVH5oSRQTO7dXxnORNFP bwZ3/MI/bIglapRpNvpRfk5KeunpUK782hyzswtxqTQk9gOLIEgPMvLT6OxyS/Mv/+4V KnFT5SlWw1tDT/6uU4C84H+iJEtK1/m8sxjcJd8+K2f2IzVeJep8cMee2QwPEKlcpmIE t4ZjTk11/fxJaO2dWafp39Lh/EhpxEDVaYTzPpOWGWWqL5mfVkAt++slculBQYjOWfzX qiqsru0LPljAluaMv26yMDb2SL/ABSBsgKKaqWm2td1zqQ0qWbdcmvGGE0lkKc3iOgXv bUJA== X-Gm-Message-State: AOAM5328h8ZXcZERITti4b0x8BNvR/NuCThewFpdC7PtpiGwz+/ES9+U pALJJasVhGYGvNTipttp5mwuJA== X-Google-Smtp-Source: ABdhPJyZMPTDBek/6rDYSr0jG5MreN/hP+cSwylpalIyWH10rOpYScv5w5wHfXS7jW7iM4V++mTqZQ== X-Received: by 2002:adf:8b86:: with SMTP id o6mr10213946wra.193.1633442636554; Tue, 05 Oct 2021 07:03:56 -0700 (PDT) Received: from trex (197.red-79-154-202.dynamicip.rima-tde.net. [79.154.202.197]) by smtp.gmail.com with ESMTPSA id z19sm572409wmf.39.2021.10.05.07.03.55 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Oct 2021 07:03:56 -0700 (PDT) From: "Jorge Ramirez-Ortiz, Foundries" X-Google-Original-From: "Jorge Ramirez-Ortiz, Foundries" Date: Tue, 5 Oct 2021 16:03:54 +0200 To: Michal Simek Cc: Jorge Ramirez-Ortiz , trini@konsulko.com, sjg@chromium.org, mr.nuke.me@gmail.com, u-boot@lists.denx.de, ricardo@foundries.io, mike@foundries.io, igor.opaniuk@foundries.io Subject: Re: [RFC PATCH 2/2] fpga: xilinx: allow loading authenticated images (DDR) Message-ID: <20211005140354.GA30050@trex> References: <20211005111324.19749-1-jorge@foundries.io> <20211005111324.19749-3-jorge@foundries.io> <7b6f41a8-7812-c2b6-a4f5-1bdad7d2a784@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7b6f41a8-7812-c2b6-a4f5-1bdad7d2a784@xilinx.com> User-Agent: Mutt/1.9.4 (2018-02-28) 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 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 > 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? 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? > > And the same style should work for SPL and also for U-Boot proper. sure. thanks for the quick response. > > Thanks, > Michal