mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xu Yilun <yilun.xu@linux.intel.com>
To: Peter Colberg <peter.colberg@intel.com>
Cc: "Moritz Fischer" <mdf@kernel.org>, "Wu Hao" <hao.wu@intel.com>,
	"Xu Yilun" <yilun.xu@intel.com>, "Tom Rix" <trix@redhat.com>,
	"Lee Jones" <lee@kernel.org>,
	linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Russ Weight" <russ.weight@linux.dev>,
	"Marco Pagani" <marpagan@redhat.com>,
	"Matthew Gerlach" <matthew.gerlach@linux.intel.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Russ Weight" <russell.h.weight@intel.com>
Subject: Re: [PATCH] mfd: intel-m10-bmc: Change staging size to a variable
Date: Mon, 1 Apr 2024 17:46:29 +0800	[thread overview]
Message-ID: <ZgqCdfCSatazEkIj@yilunxu-OptiPlex-7050> (raw)
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 <ilpo.jarvinen@linux.intel.com>
> 
> 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 <russell.h.weight@intel.com>
> Signed-off-by: Russ Weight <russell.h.weight@intel.com>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Signed-off-by: Peter Colberg <peter.colberg@intel.com>
> ---
>  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
> 
> 

  reply	other threads:[~2024-04-01  9:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 23:35 Peter Colberg
2024-04-01  9:46 ` Xu Yilun [this message]
2024-04-01 17:09   ` Russ Weight
2024-04-01 17:19     ` Russ Weight
2024-04-02  6:52       ` Xu Yilun
2024-04-02 18:44         ` Colberg, Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZgqCdfCSatazEkIj@yilunxu-OptiPlex-7050 \
    --to=yilun.xu@linux.intel.com \
    --cc=hao.wu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lee@kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marpagan@redhat.com \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=mdf@kernel.org \
    --cc=peter.colberg@intel.com \
    --cc=russ.weight@linux.dev \
    --cc=russell.h.weight@intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®