All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gaurav Batra <gbatra@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org,
	Brian King <brking@linux.vnet.ibm.com>
Subject: Re: [PATCH v2] powerpc/iommu: limit number of TCEs to 512 for H_STUFF_TCE hcall
Date: Thu, 25 May 2023 09:40:11 -0500	[thread overview]
Message-ID: <855906e7-4494-6058-aad9-50732899d054@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230525143454.56878-1-gbatra@linux.vnet.ibm.com>

Hello Michael,

Here are the changes in v2 of the patch

1. added some wording to change log to specify why we are seeing the 
issue now. Also added "CC: stable@vger.kernel.org"

2. changed "limit" to unsigned long. I have kept "rpages" as "long"

Thanks,

Gaurav

On 5/25/23 9:34 AM, Gaurav Batra wrote:
> As of now, in tce_freemulti_pSeriesLP(), there is no limit on how many TCEs
> are passed to H_STUFF_TCE hcall. This was not an issue until now. Newer
> firmware releases have started enforcing this requirement.
>
> The interface has been in it's current form since the beginning.
>
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Gaurav Batra <gbatra@linux.vnet.ibm.com>
> Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
> ---
>   arch/powerpc/platforms/pseries/iommu.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index c74b71d4733d..f159a195101d 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -306,13 +306,22 @@ static void tce_free_pSeriesLP(unsigned long liobn, long tcenum, long tceshift,
>   static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
>   {
>   	u64 rc;
> +	long rpages = npages;
> +	unsigned long limit;
>
>   	if (!firmware_has_feature(FW_FEATURE_STUFF_TCE))
>   		return tce_free_pSeriesLP(tbl->it_index, tcenum,
>   					  tbl->it_page_shift, npages);
>
> -	rc = plpar_tce_stuff((u64)tbl->it_index,
> -			     (u64)tcenum << tbl->it_page_shift, 0, npages);
> +	do {
> +		limit = min_t(unsigned long, rpages, 512);
> +
> +		rc = plpar_tce_stuff((u64)tbl->it_index,
> +			     	(u64)tcenum << tbl->it_page_shift, 0, limit);
> +
> +		rpages -= limit;
> +		tcenum += limit;
> +	} while (rpages > 0 && !rc);
>
>   	if (rc && printk_ratelimit()) {
>   		printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");

WARNING: multiple messages have this Message-ID (diff)
From: Gaurav Batra <gbatra@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: Brian King <brking@linux.vnet.ibm.com>,
	linuxppc-dev@lists.ozlabs.org, stable@vger.kernel.org
Subject: Re: [PATCH v2] powerpc/iommu: limit number of TCEs to 512 for H_STUFF_TCE hcall
Date: Thu, 25 May 2023 09:40:11 -0500	[thread overview]
Message-ID: <855906e7-4494-6058-aad9-50732899d054@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230525143454.56878-1-gbatra@linux.vnet.ibm.com>

Hello Michael,

Here are the changes in v2 of the patch

1. added some wording to change log to specify why we are seeing the 
issue now. Also added "CC: stable@vger.kernel.org"

2. changed "limit" to unsigned long. I have kept "rpages" as "long"

Thanks,

Gaurav

On 5/25/23 9:34 AM, Gaurav Batra wrote:
> As of now, in tce_freemulti_pSeriesLP(), there is no limit on how many TCEs
> are passed to H_STUFF_TCE hcall. This was not an issue until now. Newer
> firmware releases have started enforcing this requirement.
>
> The interface has been in it's current form since the beginning.
>
> Cc: stable@vger.kernel.org
>
> Signed-off-by: Gaurav Batra <gbatra@linux.vnet.ibm.com>
> Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
> ---
>   arch/powerpc/platforms/pseries/iommu.c | 13 +++++++++++--
>   1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
> index c74b71d4733d..f159a195101d 100644
> --- a/arch/powerpc/platforms/pseries/iommu.c
> +++ b/arch/powerpc/platforms/pseries/iommu.c
> @@ -306,13 +306,22 @@ static void tce_free_pSeriesLP(unsigned long liobn, long tcenum, long tceshift,
>   static void tce_freemulti_pSeriesLP(struct iommu_table *tbl, long tcenum, long npages)
>   {
>   	u64 rc;
> +	long rpages = npages;
> +	unsigned long limit;
>
>   	if (!firmware_has_feature(FW_FEATURE_STUFF_TCE))
>   		return tce_free_pSeriesLP(tbl->it_index, tcenum,
>   					  tbl->it_page_shift, npages);
>
> -	rc = plpar_tce_stuff((u64)tbl->it_index,
> -			     (u64)tcenum << tbl->it_page_shift, 0, npages);
> +	do {
> +		limit = min_t(unsigned long, rpages, 512);
> +
> +		rc = plpar_tce_stuff((u64)tbl->it_index,
> +			     	(u64)tcenum << tbl->it_page_shift, 0, limit);
> +
> +		rpages -= limit;
> +		tcenum += limit;
> +	} while (rpages > 0 && !rc);
>
>   	if (rc && printk_ratelimit()) {
>   		printk("tce_freemulti_pSeriesLP: plpar_tce_stuff failed\n");

  reply	other threads:[~2023-05-25 14:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 14:34 [PATCH v2] powerpc/iommu: limit number of TCEs to 512 for H_STUFF_TCE hcall Gaurav Batra
2023-05-25 14:34 ` Gaurav Batra
2023-05-25 14:40 ` Gaurav Batra [this message]
2023-05-25 14:40   ` Gaurav Batra
2023-07-03  4:02 ` Michael Ellerman

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=855906e7-4494-6058-aad9-50732899d054@linux.vnet.ibm.com \
    --to=gbatra@linux.vnet.ibm.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.