Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1330984lqz; Mon, 1 Apr 2024 02:51:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVMTRI3WUTOCkfeFVdcBL9g79e05FSBsdHf8t/55cb97p07mf61aKEypMXIIQmBLrF8WpdtKCHJ15rT4ArdaWkM/z4DIQU4XLZaLGPqdQ== X-Google-Smtp-Source: AGHT+IF4MPs95YFXYmk/0wT/3/EIHTmK/e/5tO89i2/FqagshynRRHwUAugzgPe9uxuY6Ge+Krf5 X-Received: by 2002:a05:6512:2145:b0:513:ec2a:8fd1 with SMTP id s5-20020a056512214500b00513ec2a8fd1mr7369600lfr.47.1711965092039; Mon, 01 Apr 2024 02:51:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711965092; cv=pass; d=google.com; s=arc-20160816; b=AGLKP/VsXArrIM3G4F13gEQtnSkiIJ3DudtJnor8wMyvnbLo3GR1bgaiE3GNYJKZcb Yo3pLDgxrjuK25Psh+G8Tu8F97c+rh9KPS69cT46CMLJSkUtPijqQrolDsTMun+gpLwh xQi9RfQ12mlVb97LIUTzFNGw4CwjJPtwlyaQDbeHgmif7J5y3myqyD4pzqRwPyZtbImu OiJSsncxr03AeKmMMej6ZQ/iVUy9SiTkRpmnplYCzkgEl0uqs+wE7ZU5YtFN5TOoJRtd ahsrtx7a5j97AdSjhM0yxz7eLEe3jNPrAuxRLzevgHyaDMpZNr9AuL0ui5os/rllmsOa XIZA== 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:date:dkim-signature; bh=RqJIKnFrOC+fH4FDLXwAt+DEGwSZUqkqGQESkYUfYmc=; fh=gV0rWXxqbnJAww7dGvwruAisnTDMhXkR5AlFTr5wu8s=; b=l1l1QO8FWN2/BiC9f8XYMVZxniteFWZFvzNwA3dYZKZme697yu/xlTAz6Rb1HDdjkd zdnptfhVIzPG+LBTfU1PXd7hhId5DDelxXzlXk6wCq3tE3qMuQYtrEW4WZCE/U4frpmb eMNKRSQ5jYDHXLr5zkVv5QBobi+IK9O2umTjbIpThJll9s7E2kW5dXUS/49v3XMSSZwg Bo8t7Oto3SU3a6N+vCS9Xi+IvSLJqFkuTzOTTUDYIeqCecPNC+AngisBY0woB/YBLxub 29ndtuoDfXqDA3R2FLu9EuPibxKtojqwDDJssGiv5HrwaBBJnLbvN1aRwfUW5XUZnBnx WyNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LPolHro1; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-126576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s2-20020a17090699c200b00a4e2296aa76si4480709ejn.899.2024.04.01.02.51.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 02:51:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LPolHro1; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-126576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 BC2D01F21F61 for ; Mon, 1 Apr 2024 09:51:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7717D10A31; Mon, 1 Apr 2024 09:51:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LPolHro1" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (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 E3313101C5; Mon, 1 Apr 2024 09:51:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711965084; cv=none; b=jvV1Fzv8pG3P5d0hTZP192ds7a1feN7GqKJE3JiOZ1t+Q94Z5QJ1Z/Iwecqfy6eNssDzROb5OfS4jRDR97xiAuzToMCdp7M3tm8LJIle8yeTCwAUgjTuJ1N38lO3Uk9kFf2+7n7lNvbhN6gdfNuEQECC7RGOdScWpHv8eBYQIyU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711965084; c=relaxed/simple; bh=dws3mIL2bvlkyMP7eYP2wFCJCVIJfmJmMM9Iw67z8U4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DX2/KbL+5cI1xLG5nXFXE9s19sEPez6DW79OZUDRbgaRnCEdKiTlsNtAhA7LyBhY8dsjOqQutL7nUd0CK8HR62YdvEQDRKAr8lKSP5ZpdKdsgdfpnmyNJx7eYOG75Z51gt3fYc53mBjpvXkkEWxYizcQVjeO6uEsExWt1+rwP20= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=LPolHro1; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711965083; x=1743501083; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=dws3mIL2bvlkyMP7eYP2wFCJCVIJfmJmMM9Iw67z8U4=; b=LPolHro1Xe9fG52mdLE7vJq8B5XsWkQuK9233p4PJxAYc4A3NeaaUBbh Sn6d0cU5SUSQtBH36dh2pPVBrOEjkndrxgBW+nqR3Ve0CyU3Kt26ii6l1 YDwF0ZLFuau9RYWVzr4uf0cvCJVnIWYrLudbOTUN4CuoXaBHQUZJ80GLu v4f82NW585y55RAFabBWzabvdtMU4G06zkHrKkWJWUFoB6KRLaPBAjyyt O04bXDr85tdY+i+qRaXmh6y6s52LW7x3X1stq0UV4bZrOTcTyZd0nR23w X5DaAMhZeFINCJTyejRyt+WqA+HwuraDBbQGqFlzyPjSkfwYQ2Ruthmit g==; X-CSE-ConnectionGUID: MBxt0t4vQh2C2ObzNRgW4Q== X-CSE-MsgGUID: RVaEiLyYQOKZegxpSjds7Q== X-IronPort-AV: E=McAfee;i="6600,9927,11030"; a="18527608" X-IronPort-AV: E=Sophos;i="6.07,171,1708416000"; d="scan'208";a="18527608" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2024 02:51:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,171,1708416000"; d="scan'208";a="40829570" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by fmviesa002.fm.intel.com with ESMTP; 01 Apr 2024 02:51:18 -0700 Date: Mon, 1 Apr 2024 17:46:29 +0800 From: Xu Yilun To: Peter Colberg Cc: Moritz Fischer , Wu Hao , Xu Yilun , Tom Rix , Lee Jones , linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, Russ Weight , 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: 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240328233559.6949-1-peter.colberg@intel.com> 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. 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 > >