Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1578635lqz; Mon, 1 Apr 2024 10:17:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQbtG0sDya/5qBX+Xap35PilQpOY/s4ihSJh2yUnn2p+90eJYwAtEcQRszkhxbrwSLfPoAZYThyBYIdt3L5zyzwcPx5xOKLY6LNW4RDA== X-Google-Smtp-Source: AGHT+IFXBMR7Zjt/B7kjPyuOJnDShAxbxYp8MAkn2JBNY4TeftR5VQatdddk5Io5LuUrIlLYPReb X-Received: by 2002:a17:907:1b1c:b0:a4e:2608:691e with SMTP id mp28-20020a1709071b1c00b00a4e2608691emr12410184ejc.4.1711991844794; Mon, 01 Apr 2024 10:17:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711991844; cv=pass; d=google.com; s=arc-20160816; b=r9EqjpvmJuL3Kwo67djDf2R6VPbYapEoBzCD8TYdA4i4b0E+uXskg1OSO2yA4Urmlw 5NpEFWk0IAr+EbWZC5G1nR0ZKqfVK1UF7A7bihQ0g9fEroHzDnDYHs7hgeJgiXoPBeCU falZxm+N31bkKQ60jejIqRMfBcnGakJXoTLA/eZf+vV3UPG3lQ7DFgQ2oGYA9iYKXqg3 EqLHr4jqduhGbOjw5fGj/GnjrQf87TKdv8nWbpjT2Y3tOyv50IAsnB6xj34ZkZmdO8sJ VmijYLBslw+UXDhj3e/fcknA6wFXGr8ITqo4+cqTrOOXYc91fXW5gMZ/bhwj6ZxJNGUV gtmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=sexo4Zkg76Uel66nm+BJLgt6nMmfGgQ4IH7dkpFb5+A=; fh=g++MLXS4L0HdLnP+vzbPYdiE1VVfYf0RKRE+i6X598E=; b=oGEZbmqiA8s/4PgjmLpgmXob4t1pWWeOn2laVaKs3V3f9I7TRyNNqaTs6Go7SrtUEv LifcFMgZ8SfqQ6LRW6pqrXbwVzjy4/N3qDxYA/W9UEnYkSluaKnhczkNLDS8K7Ht60LL zvRD1KNEpBCTavcRG8Pi5MThM50WDwTnfZ+vJhcgvEzmf69xq11YjWKWWSHmB0YvwfC5 b93M1Ox35iUMA9lJM6QTaWiTW9oUI5CsdemcDulISyGA2l8V8bL+JXn/htuDK/M2a45b K6GqtHJtmXX9KuNmS+8hNXXQ0yuIBvbPTr03gp0K7EX64pkXC7G+UfqeWBBKF+SGQjPZ yVKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RTj9Hu0D; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-126891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y6-20020a170906448600b00a4657cc568asi4675233ejo.505.2024.04.01.10.17.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 10:17:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RTj9Hu0D; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-126891-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126891-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 81BCA1F271BD for ; Mon, 1 Apr 2024 17:09:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 052E94AEF0; Mon, 1 Apr 2024 17:09:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="RTj9Hu0D" Received: from out-181.mta1.migadu.com (out-181.mta1.migadu.com [95.215.58.181]) (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 2893447A5D for ; Mon, 1 Apr 2024 17:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711991366; cv=none; b=qKPiC5ntMnjtPG3soY1DzZgAzvGEmxfw+O5TuB3Sge9AzHQCPtYGYwawupagFyB7/4klESvvQihElM4tOOa6eeFyWR9SkEls/jMVdUAhlecvFteQ41YRsi6wgO7l68ya55B3UKNZKlN41yw1IA7e7L2U3d23E4qrB46IGXgr0ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711991366; c=relaxed/simple; bh=ot6xw/EmgVnST3njxlFas/su5E7yZBlVuz8eV3G6UPY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bGKqWKGj0bDNF6RIB741FVKTLMaI7U1CyC8avcXM3eKgKLOxaNnA3JIvrMhp37F3dX6eT7WGGj4CjahNzkF3k9lHHpYwt1s2YER8DX5TuDe77uqL5h6O/xSeAkI288Lj9/KZ36PG05dzw9PmMRbYOATZYTq9Iy9J+zX5uZkAufw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=RTj9Hu0D; arc=none smtp.client-ip=95.215.58.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Mon, 1 Apr 2024 10:09:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1711991361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sexo4Zkg76Uel66nm+BJLgt6nMmfGgQ4IH7dkpFb5+A=; b=RTj9Hu0DT2ERBTjCK3MMs7EpeNZMfQ1BGeQtNAdS24hwlbCzJ5ciAmy40V9LkSJqVv+3Wv L5EdU9Qpu8tGgLjqCSDgn93dUlo6VJUUyWIQJfFduwPudROlxnZX4yWAuvllGPtdNorzCw 5xWxaDgf5iYx6vnIQLqLHTLA5o+Mhh0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Russ Weight To: Xu Yilun Cc: Peter Colberg , Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Lee Jones , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, Marco Pagani , Matthew Gerlach , Ilpo =?utf-8?B?SsOkcnZpbmVu?= , Russ Weight Subject: Re: [PATCH] mfd: intel-m10-bmc: Change staging size to a variable Message-ID: <20240401170905.v2xin3fzoe3m3tmz@4VRSMR2-DT.corp.robot.car> References: <20240328233559.6949-1-peter.colberg@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Mon, Apr 01, 2024 at 05:46:29PM +0800, Xu Yilun wrote: > On Thu, Mar 28, 2024 at 07:35:59PM -0400, Peter Colberg wrote: > > From: Ilpo J?rvinen > > > > The size of the staging area in FLASH for FPGA updates is dependent on the > > size of the FPGA. Currently, the staging size is defined as a constant. > > Larger FPGAs are coming soon and it will soon be necessary to support > > Soon? When? You cannot add some feature without a user case. If you do > have a use case, put the patch in the same patchset. There may never be an up-streamed use-case. This is a very small change intended to make it easier for a third-party vendor to build a card that requires a larger staging area in FLASH. They would have to add a new "struct m10bmc_csr_map", but they wouldn't have to refactor this code as part of the change This change does not introduce an unused function or variable. It is more of a clean-up, making the code more flexible. Can it not be taken as is? - Russ > > Thanks, > Yilun > > > different sizes for the staging area. Add a new staging_size member to the > > csr_map structure to support a variable staging size. > > > > The secure update driver does a sanity-check of the image size in > > comparison to the size of the staging area in FLASH. Change the > > staging size reference to a variable instead of a constant in order > > to more readily support future, larger FPGAs. > > > > Co-developed-by: Russ Weight > > Signed-off-by: Russ Weight > > Signed-off-by: Ilpo J?rvinen > > Signed-off-by: Peter Colberg > > --- > > drivers/fpga/intel-m10-bmc-sec-update.c | 3 ++- > > drivers/mfd/intel-m10-bmc-pmci.c | 1 + > > drivers/mfd/intel-m10-bmc-spi.c | 1 + > > include/linux/mfd/intel-m10-bmc.h | 1 + > > 4 files changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/fpga/intel-m10-bmc-sec-update.c b/drivers/fpga/intel-m10-bmc-sec-update.c > > index 89851b133709..7ac9f9f5af12 100644 > > --- a/drivers/fpga/intel-m10-bmc-sec-update.c > > +++ b/drivers/fpga/intel-m10-bmc-sec-update.c > > @@ -529,11 +529,12 @@ static enum fw_upload_err m10bmc_sec_prepare(struct fw_upload *fwl, > > const u8 *data, u32 size) > > { > > struct m10bmc_sec *sec = fwl->dd_handle; > > + const struct m10bmc_csr_map *csr_map = sec->m10bmc->info->csr_map; > > u32 ret; > > > > sec->cancel_request = false; > > > > - if (!size || size > M10BMC_STAGING_SIZE) > > + if (!size || size > csr_map->staging_size) > > return FW_UPLOAD_ERR_INVALID_SIZE; > > > > if (sec->m10bmc->flash_bulk_ops) > > diff --git a/drivers/mfd/intel-m10-bmc-pmci.c b/drivers/mfd/intel-m10-bmc-pmci.c > > index 0392ef8b57d8..698c5933938b 100644 > > --- a/drivers/mfd/intel-m10-bmc-pmci.c > > +++ b/drivers/mfd/intel-m10-bmc-pmci.c > > @@ -370,6 +370,7 @@ static const struct m10bmc_csr_map m10bmc_n6000_csr_map = { > > .pr_reh_addr = M10BMC_N6000_PR_REH_ADDR, > > .pr_magic = M10BMC_N6000_PR_PROG_MAGIC, > > .rsu_update_counter = M10BMC_N6000_STAGING_FLASH_COUNT, > > + .staging_size = M10BMC_STAGING_SIZE, > > }; > > > > static const struct intel_m10bmc_platform_info m10bmc_pmci_n6000 = { > > diff --git a/drivers/mfd/intel-m10-bmc-spi.c b/drivers/mfd/intel-m10-bmc-spi.c > > index cbeb7de9e041..d64d28199df6 100644 > > --- a/drivers/mfd/intel-m10-bmc-spi.c > > +++ b/drivers/mfd/intel-m10-bmc-spi.c > > @@ -109,6 +109,7 @@ static const struct m10bmc_csr_map m10bmc_n3000_csr_map = { > > .pr_reh_addr = M10BMC_N3000_PR_REH_ADDR, > > .pr_magic = M10BMC_N3000_PR_PROG_MAGIC, > > .rsu_update_counter = M10BMC_N3000_STAGING_FLASH_COUNT, > > + .staging_size = M10BMC_STAGING_SIZE, > > }; > > > > static struct mfd_cell m10bmc_d5005_subdevs[] = { > > diff --git a/include/linux/mfd/intel-m10-bmc.h b/include/linux/mfd/intel-m10-bmc.h > > index ee66c9751003..988f1cd90032 100644 > > --- a/include/linux/mfd/intel-m10-bmc.h > > +++ b/include/linux/mfd/intel-m10-bmc.h > > @@ -205,6 +205,7 @@ struct m10bmc_csr_map { > > unsigned int pr_reh_addr; > > unsigned int pr_magic; > > unsigned int rsu_update_counter; > > + unsigned int staging_size; > > }; > > > > /** > > -- > > 2.44.0 > > > >