linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
@ 2021-11-26  5:21 Nicholas Piggin
  2021-11-26  7:13 ` Cédric Le Goater
  2021-12-21 12:14 ` Michael Ellerman
  0 siblings, 2 replies; 8+ messages in thread
From: Nicholas Piggin @ 2021-11-26  5:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Haren Myneni, Nicholas Piggin

KVM does not support VAS so guests always print a useless error on boot

    vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000

Change this to only print the message if the error is not H_FUNCTION.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/platforms/pseries/vas.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
index b043e3936d21..734523e2272f 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -151,8 +151,15 @@ int h_query_vas_capabilities(const u64 hcall, u8 query_type, u64 result)
 	if (rc == H_SUCCESS)
 		return 0;
 
-	pr_err("HCALL(%llx) error %ld, query_type %u, result buffer 0x%llx\n",
-			hcall, rc, query_type, result);
+	/* H_FUNCTION means HV does not support VAS so don't print an error */
+	if (rc != H_FUNCTION) {
+		pr_err("%s error %ld, query_type %u, result buffer 0x%llx\n",
+			(hcall == H_QUERY_VAS_CAPABILITIES) ?
+				"H_QUERY_VAS_CAPABILITIES" :
+				"H_QUERY_NX_CAPABILITIES",
+			rc, query_type, result);
+	}
+
 	return -EIO;
 }
 EXPORT_SYMBOL_GPL(h_query_vas_capabilities);
-- 
2.23.0


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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-26  5:21 [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable Nicholas Piggin
@ 2021-11-26  7:13 ` Cédric Le Goater
  2021-11-26 10:31   ` Nicholas Piggin
  2021-12-21 12:14 ` Michael Ellerman
  1 sibling, 1 reply; 8+ messages in thread
From: Cédric Le Goater @ 2021-11-26  7:13 UTC (permalink / raw)
  To: Nicholas Piggin, linuxppc-dev; +Cc: Haren Myneni

On 11/26/21 06:21, Nicholas Piggin wrote:
> KVM does not support VAS so guests always print a useless error on boot
> 
>      vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000
> 
> Change this to only print the message if the error is not H_FUNCTION.


Just being curious, why is it even called since "ibm,compression" should
not be exposed in the DT ?

C.

> 
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
>   arch/powerpc/platforms/pseries/vas.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
> index b043e3936d21..734523e2272f 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -151,8 +151,15 @@ int h_query_vas_capabilities(const u64 hcall, u8 query_type, u64 result)
>   	if (rc == H_SUCCESS)
>   		return 0;
>   
> -	pr_err("HCALL(%llx) error %ld, query_type %u, result buffer 0x%llx\n",
> -			hcall, rc, query_type, result);
> +	/* H_FUNCTION means HV does not support VAS so don't print an error */
> +	if (rc != H_FUNCTION) {
> +		pr_err("%s error %ld, query_type %u, result buffer 0x%llx\n",
> +			(hcall == H_QUERY_VAS_CAPABILITIES) ?
> +				"H_QUERY_VAS_CAPABILITIES" :
> +				"H_QUERY_NX_CAPABILITIES",
> +			rc, query_type, result);
> +	}
> +
>   	return -EIO;
>   }
>   EXPORT_SYMBOL_GPL(h_query_vas_capabilities);
> 


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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-26  7:13 ` Cédric Le Goater
@ 2021-11-26 10:31   ` Nicholas Piggin
  2021-11-29 18:13     ` Tyrel Datwyler
  2021-11-29 23:25     ` Michael Ellerman
  0 siblings, 2 replies; 8+ messages in thread
From: Nicholas Piggin @ 2021-11-26 10:31 UTC (permalink / raw)
  To: Cédric Le Goater, linuxppc-dev; +Cc: Haren Myneni

Excerpts from Cédric Le Goater's message of November 26, 2021 5:13 pm:
> On 11/26/21 06:21, Nicholas Piggin wrote:
>> KVM does not support VAS so guests always print a useless error on boot
>> 
>>      vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000
>> 
>> Change this to only print the message if the error is not H_FUNCTION.
> 
> 
> Just being curious, why is it even called since "ibm,compression" should
> not be exposed in the DT ?

It looks like vas does not test for it. I guess in theory there can be 
other functions than compression implemented as an accelerator. Maybe
that's why?

Thanks,
Nick


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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-26 10:31   ` Nicholas Piggin
@ 2021-11-29 18:13     ` Tyrel Datwyler
  2021-11-29 23:25     ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Tyrel Datwyler @ 2021-11-29 18:13 UTC (permalink / raw)
  To: Nicholas Piggin, Cédric Le Goater, linuxppc-dev; +Cc: Haren Myneni

On 11/26/21 2:31 AM, Nicholas Piggin wrote:
> Excerpts from Cédric Le Goater's message of November 26, 2021 5:13 pm:
>> On 11/26/21 06:21, Nicholas Piggin wrote:
>>> KVM does not support VAS so guests always print a useless error on boot
>>>
>>>      vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000
>>>
>>> Change this to only print the message if the error is not H_FUNCTION.
>>
>>
>> Just being curious, why is it even called since "ibm,compression" should
>> not be exposed in the DT ?
> 
> It looks like vas does not test for it. I guess in theory there can be 
> other functions than compression implemented as an accelerator. Maybe
> that's why?
> 
> Thanks,
> Nick
> 
Looks like pseries_vas_init() simply calls h_query_vas_capabilities() to test
for VAS coprocessor support. I would assume KVM doesn't expose hcall-vas or
hcall-nx in /rtas/ibm,hypertas-functions? Doesn't look like hcall-vas or
hcall-nx have been added to the hypertas_fw_feature matching, but maybe they
should and we can gate VAS initialization on those, or at the minimum
FW_FEATURE_VAS?

-Tyrel

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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-26 10:31   ` Nicholas Piggin
  2021-11-29 18:13     ` Tyrel Datwyler
@ 2021-11-29 23:25     ` Michael Ellerman
  2021-11-30  7:35       ` Haren Myneni
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Ellerman @ 2021-11-29 23:25 UTC (permalink / raw)
  To: Nicholas Piggin, Cédric Le Goater, linuxppc-dev; +Cc: Haren Myneni

Nicholas Piggin <npiggin@gmail.com> writes:
> Excerpts from Cédric Le Goater's message of November 26, 2021 5:13 pm:
>> On 11/26/21 06:21, Nicholas Piggin wrote:
>>> KVM does not support VAS so guests always print a useless error on boot
>>> 
>>>      vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000
>>> 
>>> Change this to only print the message if the error is not H_FUNCTION.
>> 
>> 
>> Just being curious, why is it even called since "ibm,compression" should
>> not be exposed in the DT ?
>
> It looks like vas does not test for it. I guess in theory there can be 
> other functions than compression implemented as an accelerator. Maybe
> that's why?

Yeah I guess, or it's just not structured that well. The vas platform
code is a bit awkward, it's there to support drivers, but it's not
actually driver code.

I think we can probably rework it so the vas code does nothing until a
driver calls in to it.

eg. something like below.

cheers


diff --git a/arch/powerpc/platforms/pseries/vas.c b/arch/powerpc/platforms/pseries/vas.c
index b043e3936d21..dc3491fc919d 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -454,6 +454,8 @@ static const struct vas_user_win_ops vops_pseries = {
 	.close_win	= vas_deallocate_window, /* Close window */
 };
 
+static int pseries_vas_init(void);
+
 /*
  * Supporting only nx-gzip coprocessor type now, but this API code
  * extended to other coprocessor types later.
@@ -463,7 +465,8 @@ int vas_register_api_pseries(struct module *mod, enum vas_cop_type cop_type,
 {
 	int rc;
 
-	if (!copypaste_feat)
+	rc = pseries_vas_init();
+	if (rc || !copypaste_feat)
 		return -ENOTSUPP;
 
 	rc = vas_register_coproc_api(mod, cop_type, name, &vops_pseries);
@@ -531,7 +534,7 @@ static int get_vas_capabilities(u8 feat, enum vas_cop_feat_type type,
 	return 0;
 }
 
-static int __init pseries_vas_init(void)
+static int pseries_vas_init(void)
 {
 	struct hv_vas_cop_feat_caps *hv_cop_caps;
 	struct hv_vas_all_caps *hv_caps;
@@ -592,4 +595,3 @@ static int __init pseries_vas_init(void)
 	kfree(hv_caps);
 	return rc;
 }
-machine_device_initcall(pseries, pseries_vas_init);

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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-29 23:25     ` Michael Ellerman
@ 2021-11-30  7:35       ` Haren Myneni
  2021-11-30 11:21         ` Michael Ellerman
  0 siblings, 1 reply; 8+ messages in thread
From: Haren Myneni @ 2021-11-30  7:35 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Cédric Le Goater, linuxppc-dev

On Tue, 2021-11-30 at 10:25 +1100, Michael Ellerman wrote:
> Nicholas Piggin <npiggin@gmail.com> writes:
> > Excerpts from Cédric Le Goater's message of November 26, 2021 5:13
> > pm:
> > > On 11/26/21 06:21, Nicholas Piggin wrote:
> > > > KVM does not support VAS so guests always print a useless error
> > > > on boot
> > > > 
> > > >      vas: HCALL(398) error -2, query_type 0, result buffer
> > > > 0x57f2000
> > > > 
> > > > Change this to only print the message if the error is not
> > > > H_FUNCTION.
> > > 
> > > Just being curious, why is it even called since "ibm,compression"
> > > should
> > > not be exposed in the DT ?
> > 
> > It looks like vas does not test for it. I guess in theory there can
> > be 
> > other functions than compression implemented as an accelerator.
> > Maybe
> > that's why?
> 
> Yeah I guess, or it's just not structured that well. The vas platform
> code is a bit awkward, it's there to support drivers, but it's not
> actually driver code.
> 
> I think we can probably rework it so the vas code does nothing until
> a
> driver calls in to it.
> 
> eg. something like below.

Correct, Even though NXGZIP is the only usage right now, VAS is
accelerator switchboard which should support other coprocessor types
such as GZIP and 842 or SW type solutions such as fast thread wakeup
and fast memory copy. 

So can we leave VAS initialization separate from drivers and use some
feature such as FW_FEATURE_LPAR to differentiate from KVM guests?

Thanks
Haren

> 
> cheers
> 
> 
> diff --git a/arch/powerpc/platforms/pseries/vas.c
> b/arch/powerpc/platforms/pseries/vas.c
> index b043e3936d21..dc3491fc919d 100644
> --- a/arch/powerpc/platforms/pseries/vas.c
> +++ b/arch/powerpc/platforms/pseries/vas.c
> @@ -454,6 +454,8 @@ static const struct vas_user_win_ops vops_pseries
> = {
>  	.close_win	= vas_deallocate_window, /* Close window */
>  };
>  
> +static int pseries_vas_init(void);
> +
>  /*
>   * Supporting only nx-gzip coprocessor type now, but this API code
>   * extended to other coprocessor types later.
> @@ -463,7 +465,8 @@ int vas_register_api_pseries(struct module *mod,
> enum vas_cop_type cop_type,
>  {
>  	int rc;
>  
> -	if (!copypaste_feat)
> +	rc = pseries_vas_init();
> +	if (rc || !copypaste_feat)
>  		return -ENOTSUPP;
>  
>  	rc = vas_register_coproc_api(mod, cop_type, name,
> &vops_pseries);
> @@ -531,7 +534,7 @@ static int get_vas_capabilities(u8 feat, enum
> vas_cop_feat_type type,
>  	return 0;
>  }
>  
> -static int __init pseries_vas_init(void)
> +static int pseries_vas_init(void)
>  {
>  	struct hv_vas_cop_feat_caps *hv_cop_caps;
>  	struct hv_vas_all_caps *hv_caps;
> @@ -592,4 +595,3 @@ static int __init pseries_vas_init(void)
>  	kfree(hv_caps);
>  	return rc;
>  }
> -machine_device_initcall(pseries, pseries_vas_init);


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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-30  7:35       ` Haren Myneni
@ 2021-11-30 11:21         ` Michael Ellerman
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2021-11-30 11:21 UTC (permalink / raw)
  To: Haren Myneni, Nicholas Piggin, Cédric Le Goater, linuxppc-dev

Haren Myneni <haren@linux.ibm.com> writes:
> On Tue, 2021-11-30 at 10:25 +1100, Michael Ellerman wrote:
>> Nicholas Piggin <npiggin@gmail.com> writes:
>> > Excerpts from Cédric Le Goater's message of November 26, 2021 5:13
>> > pm:
>> > > On 11/26/21 06:21, Nicholas Piggin wrote:
>> > > > KVM does not support VAS so guests always print a useless error
>> > > > on boot
>> > > > 
>> > > >      vas: HCALL(398) error -2, query_type 0, result buffer
>> > > > 0x57f2000
>> > > > 
>> > > > Change this to only print the message if the error is not
>> > > > H_FUNCTION.
>> > > 
>> > > Just being curious, why is it even called since "ibm,compression"
>> > > should
>> > > not be exposed in the DT ?
>> > 
>> > It looks like vas does not test for it. I guess in theory there can
>> > be 
>> > other functions than compression implemented as an accelerator.
>> > Maybe
>> > that's why?
>> 
>> Yeah I guess, or it's just not structured that well. The vas platform
>> code is a bit awkward, it's there to support drivers, but it's not
>> actually driver code.
>> 
>> I think we can probably rework it so the vas code does nothing until
>> a
>> driver calls in to it.
>> 
>> eg. something like below.
>
> Correct, Even though NXGZIP is the only usage right now, VAS is
> accelerator switchboard which should support other coprocessor types
> such as GZIP and 842 or SW type solutions such as fast thread wakeup
> and fast memory copy. 
>
> So can we leave VAS initialization separate from drivers and use some
> feature such as FW_FEATURE_LPAR to differentiate from KVM guests?

FW_FEATURE_LPAR is true on KVM guests as well.

As Tyrel pointed out, you should be looking for "hcall-vas" in
"ibm,hypertas-functions" and setting a new FW_FEATURE_VAS based on that.
Then use that to gate the vas init routine.

cheers

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

* Re: [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable
  2021-11-26  5:21 [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable Nicholas Piggin
  2021-11-26  7:13 ` Cédric Le Goater
@ 2021-12-21 12:14 ` Michael Ellerman
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Ellerman @ 2021-12-21 12:14 UTC (permalink / raw)
  To: linuxppc-dev, Nicholas Piggin; +Cc: Haren Myneni

On Fri, 26 Nov 2021 15:21:33 +1000, Nicholas Piggin wrote:
> KVM does not support VAS so guests always print a useless error on boot
> 
>     vas: HCALL(398) error -2, query_type 0, result buffer 0x57f2000
> 
> Change this to only print the message if the error is not H_FUNCTION.
> 
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/pseries/vas: Don't print an error when VAS is unavailable
      https://git.kernel.org/powerpc/c/0a006ace634dcaf1bbf9125fb8089a4a50bf33d6

cheers

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

end of thread, other threads:[~2021-12-21 12:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-26  5:21 [PATCH] powerpc/pseries/vas: Don't print an error when VAS is unavailable Nicholas Piggin
2021-11-26  7:13 ` Cédric Le Goater
2021-11-26 10:31   ` Nicholas Piggin
2021-11-29 18:13     ` Tyrel Datwyler
2021-11-29 23:25     ` Michael Ellerman
2021-11-30  7:35       ` Haren Myneni
2021-11-30 11:21         ` Michael Ellerman
2021-12-21 12:14 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).