mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries/pci: Fix misleading VF limit error message
@ 2026-08-13  3:53 Jiangshan Yi
  2026-08-13  4:56 ` Christophe Leroy (CS GROUP)
  0 siblings, 1 reply; 3+ messages in thread
From: Jiangshan Yi @ 2026-08-13  3:53 UTC (permalink / raw)
  To: maddy
  Cc: mpe, npiggin, chleroy, nayna, gcwilson, kees, linuxppc-dev,
	linux-kernel, 13667453960, Jiangshan Yi

When the number of requested VFs exceeds MAX_VFS_FOR_MAP_PE, the
message prints that limit but labels it "Configurable VFs". Print
each limit with its own message so both are reported when both are
exceeded.

Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
---
 arch/powerpc/platforms/pseries/pci.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index d11a64a086c1..1e1903bf3f1d 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -133,10 +133,12 @@ static int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
 	/* First integer stores max config */
 	max_config_vfs = of_read_number(&max_vfs[0], 1);
 	if (max_config_vfs < num_vfs || num_vfs > MAX_VFS_FOR_MAP_PE) {
-		dev_err(&pdev->dev,
-			"Num VFs %x > %x Configurable VFs\n",
-			num_vfs, (num_vfs > MAX_VFS_FOR_MAP_PE) ?
-			MAX_VFS_FOR_MAP_PE : max_config_vfs);
+		if (max_config_vfs < num_vfs)
+			dev_err(&pdev->dev, "Num VFs %x > %x Configurable VFs\n",
+				num_vfs, max_config_vfs);
+		if (num_vfs > MAX_VFS_FOR_MAP_PE)
+			dev_err(&pdev->dev, "Num VFs %x > %x PE mapping limit\n",
+				num_vfs, MAX_VFS_FOR_MAP_PE);
 		return -EINVAL;
 	}
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries/pci: Fix misleading VF limit error message
  2026-08-13  3:53 [PATCH] powerpc/pseries/pci: Fix misleading VF limit error message Jiangshan Yi
@ 2026-08-13  4:56 ` Christophe Leroy (CS GROUP)
  2026-08-13  6:28   ` Jiangshan Yi
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-08-13  4:56 UTC (permalink / raw)
  To: Jiangshan Yi, maddy
  Cc: mpe, npiggin, nayna, gcwilson, kees, linuxppc-dev, linux-kernel,
	13667453960



Le 13/08/2026 à 05:53, Jiangshan Yi a écrit :
> [Vous ne recevez pas souvent de courriers de yijiangshan@kylinos.cn. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> When the number of requested VFs exceeds MAX_VFS_FOR_MAP_PE, the
> message prints that limit but labels it "Configurable VFs". Print
> each limit with its own message so both are reported when both are
> exceeded.
> 
> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
> ---
>   arch/powerpc/platforms/pseries/pci.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
> index d11a64a086c1..1e1903bf3f1d 100644
> --- a/arch/powerpc/platforms/pseries/pci.c
> +++ b/arch/powerpc/platforms/pseries/pci.c
> @@ -133,10 +133,12 @@ static int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
>          /* First integer stores max config */
>          max_config_vfs = of_read_number(&max_vfs[0], 1);
>          if (max_config_vfs < num_vfs || num_vfs > MAX_VFS_FOR_MAP_PE) {
> -               dev_err(&pdev->dev,
> -                       "Num VFs %x > %x Configurable VFs\n",
> -                       num_vfs, (num_vfs > MAX_VFS_FOR_MAP_PE) ?
> -                       MAX_VFS_FOR_MAP_PE : max_config_vfs);
> +               if (max_config_vfs < num_vfs)
> +                       dev_err(&pdev->dev, "Num VFs %x > %x Configurable VFs\n",
> +                               num_vfs, max_config_vfs);
> +               if (num_vfs > MAX_VFS_FOR_MAP_PE)
> +                       dev_err(&pdev->dev, "Num VFs %x > %x PE mapping limit\n",
> +                               num_vfs, MAX_VFS_FOR_MAP_PE);
>                  return -EINVAL;
>          }

What about the following instead, to avoid the double 'if' ?

diff --git a/arch/powerpc/platforms/pseries/pci.c 
b/arch/powerpc/platforms/pseries/pci.c
index d11a64a086c1..6fc13f4a79a3 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -132,11 +132,14 @@ static int pseries_pci_sriov_enable(struct pci_dev 
*pdev, u16 num_vfs)

  	/* First integer stores max config */
  	max_config_vfs = of_read_number(&max_vfs[0], 1);
-	if (max_config_vfs < num_vfs || num_vfs > MAX_VFS_FOR_MAP_PE) {
-		dev_err(&pdev->dev,
-			"Num VFs %x > %x Configurable VFs\n",
-			num_vfs, (num_vfs > MAX_VFS_FOR_MAP_PE) ?
-			MAX_VFS_FOR_MAP_PE : max_config_vfs);
+	if (max_config_vfs < num_vfs) {
+		dev_err(&pdev->dev, "Num VFs %x > %x Configurable VFs\n",
+			num_vfs, max_config_vfs);
+		return -EINVAL;
+	}
+	if (num_vfs > MAX_VFS_FOR_MAP_PE) {
+		dev_err(&pdev->dev, "Num VFs %x > %x PE mapping limit\n",
+			num_vfs, MAX_VFS_FOR_MAP_PE);
  		return -EINVAL;
  	}



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH] powerpc/pseries/pci: Fix misleading VF limit error message
  2026-08-13  4:56 ` Christophe Leroy (CS GROUP)
@ 2026-08-13  6:28   ` Jiangshan Yi
  0 siblings, 0 replies; 3+ messages in thread
From: Jiangshan Yi @ 2026-08-13  6:28 UTC (permalink / raw)
  To: chleroy
  Cc: 13667453960, gcwilson, kees, linux-kernel, linuxppc-dev, maddy,
	mpe, nayna, npiggin, yijiangshan

> What about the following instead, to avoid the double 'if' ?

Hi Christophe,

Thanks for the review.  I've reworked the patch as you suggested in v2: the
two checks are now in separate blocks, each reporting its own limit
before returning -EINVAL.  The PE mapping limit message now appears
only when that cap is the binding constraint.

Best regards,
Jiangshan Yi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-13  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-13  3:53 [PATCH] powerpc/pseries/pci: Fix misleading VF limit error message Jiangshan Yi
2026-08-13  4:56 ` Christophe Leroy (CS GROUP)
2026-08-13  6:28   ` Jiangshan Yi

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®