linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa()
@ 2025-03-13  8:52 Tianyu Lan
  2025-03-13 20:20 ` Michael Kelley
  0 siblings, 1 reply; 4+ messages in thread
From: Tianyu Lan @ 2025-03-13  8:52 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, decui, tglx, mingo, bp, dave.hansen, x86,
	hpa
  Cc: Tianyu Lan, linux-hyperv, linux-kernel, stable

From: Tianyu Lan <tiala@microsoft.com>

snp_set_vmsa() returns 0 as success result and so fix it.

Cc: stable@vger.kernel.org
Fixes: 44676bb9d566 ("x86/hyperv: Add smp support for SEV-SNP guest")
Signed-off-by: Tianyu Lan <tiala@microsoft.com>
---
 arch/x86/hyperv/ivm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
index ec7880271cf9..77bf05f06b9e 100644
--- a/arch/x86/hyperv/ivm.c
+++ b/arch/x86/hyperv/ivm.c
@@ -338,7 +338,7 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
 	vmsa->sev_features = sev_status >> 2;
 
 	ret = snp_set_vmsa(vmsa, true);
-	if (!ret) {
+	if (ret) {
 		pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret);
 		free_page((u64)vmsa);
 		return ret;
-- 
2.25.1


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

* RE: [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa()
  2025-03-13  8:52 [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa() Tianyu Lan
@ 2025-03-13 20:20 ` Michael Kelley
  2025-03-14  1:41   ` Tianyu Lan
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Kelley @ 2025-03-13 20:20 UTC (permalink / raw)
  To: Tianyu Lan, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com
  Cc: Tianyu Lan, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org

From: Tianyu Lan <ltykernel@gmail.com> Sent: Thursday, March 13, 2025 1:52 AM
> 
> snp_set_vmsa() returns 0 as success result and so fix it.
> 
> Cc: stable@vger.kernel.org
> Fixes: 44676bb9d566 ("x86/hyperv: Add smp support for SEV-SNP guest")
> Signed-off-by: Tianyu Lan <tiala@microsoft.com>
> ---
>  arch/x86/hyperv/ivm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> index ec7880271cf9..77bf05f06b9e 100644
> --- a/arch/x86/hyperv/ivm.c
> +++ b/arch/x86/hyperv/ivm.c
> @@ -338,7 +338,7 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
>  	vmsa->sev_features = sev_status >> 2;
> 
>  	ret = snp_set_vmsa(vmsa, true);
> -	if (!ret) {
> +	if (ret) {
>  		pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret);
>  		free_page((u64)vmsa);
>  		return ret;
> --
> 2.25.1
> 

Yes, with this change the code is now consistent with other call sites for
snp_set_vmsa() and for direct invocation of rmpadjust().

Reviewed-by: Michael Kelley <mhklinux@outlook.com>

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

* Re: [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa()
  2025-03-13 20:20 ` Michael Kelley
@ 2025-03-14  1:41   ` Tianyu Lan
  2025-03-14 17:41     ` Wei Liu
  0 siblings, 1 reply; 4+ messages in thread
From: Tianyu Lan @ 2025-03-14  1:41 UTC (permalink / raw)
  To: Michael Kelley
  Cc: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org,
	decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org,
	hpa@zytor.com, Tianyu Lan, linux-hyperv@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org

On Fri, Mar 14, 2025 at 4:20 AM Michael Kelley <mhklinux@outlook.com> wrote:
>
> From: Tianyu Lan <ltykernel@gmail.com> Sent: Thursday, March 13, 2025 1:52 AM
> >
> > snp_set_vmsa() returns 0 as success result and so fix it.
> >
> > Cc: stable@vger.kernel.org
> > Fixes: 44676bb9d566 ("x86/hyperv: Add smp support for SEV-SNP guest")
> > Signed-off-by: Tianyu Lan <tiala@microsoft.com>
> > ---
> >  arch/x86/hyperv/ivm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> > index ec7880271cf9..77bf05f06b9e 100644
> > --- a/arch/x86/hyperv/ivm.c
> > +++ b/arch/x86/hyperv/ivm.c
> > @@ -338,7 +338,7 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
> >       vmsa->sev_features = sev_status >> 2;
> >
> >       ret = snp_set_vmsa(vmsa, true);
> > -     if (!ret) {
> > +     if (ret) {
> >               pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret);
> >               free_page((u64)vmsa);
> >               return ret;
> > --
> > 2.25.1
> >
>
> Yes, with this change the code is now consistent with other call sites for
> snp_set_vmsa() and for direct invocation of rmpadjust().
>
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>

Thank you for your review, Michael!

-- 
Thanks
Tianyu Lan

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

* Re: [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa()
  2025-03-14  1:41   ` Tianyu Lan
@ 2025-03-14 17:41     ` Wei Liu
  0 siblings, 0 replies; 4+ messages in thread
From: Wei Liu @ 2025-03-14 17:41 UTC (permalink / raw)
  To: Tianyu Lan
  Cc: Michael Kelley, kys@microsoft.com, haiyangz@microsoft.com,
	wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com, Tianyu Lan,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org

On Fri, Mar 14, 2025 at 09:41:30AM +0800, Tianyu Lan wrote:
> On Fri, Mar 14, 2025 at 4:20 AM Michael Kelley <mhklinux@outlook.com> wrote:
> >
> > From: Tianyu Lan <ltykernel@gmail.com> Sent: Thursday, March 13, 2025 1:52 AM
> > >
> > > snp_set_vmsa() returns 0 as success result and so fix it.
> > >
> > > Cc: stable@vger.kernel.org
> > > Fixes: 44676bb9d566 ("x86/hyperv: Add smp support for SEV-SNP guest")
> > > Signed-off-by: Tianyu Lan <tiala@microsoft.com>
> > > ---
> > >  arch/x86/hyperv/ivm.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/x86/hyperv/ivm.c b/arch/x86/hyperv/ivm.c
> > > index ec7880271cf9..77bf05f06b9e 100644
> > > --- a/arch/x86/hyperv/ivm.c
> > > +++ b/arch/x86/hyperv/ivm.c
> > > @@ -338,7 +338,7 @@ int hv_snp_boot_ap(u32 cpu, unsigned long start_ip)
> > >       vmsa->sev_features = sev_status >> 2;
> > >
> > >       ret = snp_set_vmsa(vmsa, true);
> > > -     if (!ret) {
> > > +     if (ret) {
> > >               pr_err("RMPADJUST(%llx) failed: %llx\n", (u64)vmsa, ret);
> > >               free_page((u64)vmsa);
> > >               return ret;
> > > --
> > > 2.25.1
> > >
> >
> > Yes, with this change the code is now consistent with other call sites for
> > snp_set_vmsa() and for direct invocation of rmpadjust().
> >
> > Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> 
> Thank you for your review, Michael!

Applied to hyperv-next. Thanks.

Wei.

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

end of thread, other threads:[~2025-03-14 17:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13  8:52 [PATCH] x86/Hyperv: Fix check of return value from snp_set_vmsa() Tianyu Lan
2025-03-13 20:20 ` Michael Kelley
2025-03-14  1:41   ` Tianyu Lan
2025-03-14 17:41     ` Wei Liu

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).