All of lore.kernel.org
 help / color / mirror / Atom feed
* [MODERATED] [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1
@ 2018-05-13 21:33 konrad.wilk
  2018-05-13 22:07 ` [MODERATED] " Borislav Petkov
  2018-05-13 23:08 ` [MODERATED] " Linus Torvalds
  0 siblings, 2 replies; 5+ messages in thread
From: konrad.wilk @ 2018-05-13 21:33 UTC (permalink / raw)
  To: speck

Cast val and (val >> 32) to uintptr_t, so that they fit in a
general-purpose register in both 32-bit and 64-bit code.

Fixes: c65732e4f721 ("x86/cpu: Restore CPUID_8000_0008_EBX reload")
Signed-off-by: Jim Mattson <jmattson@google.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 arch/x86/include/asm/nospec-branch.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
index 328ea3cb769f..979aa050d311 100644
--- a/arch/x86/include/asm/nospec-branch.h
+++ b/arch/x86/include/asm/nospec-branch.h
@@ -265,8 +265,8 @@ void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
 {
 	asm volatile(ALTERNATIVE("", "wrmsr", %c[feature])
 		: : "c" (msr),
-		    "a" (val),
-		    "d" (val >> 32),
+		    "a" ((uintptr_t)val),
+		    "d" ((uintptr_t)(val >> 32)),
 		    [feature] "i" (feature)
 		: "memory");
 }
-- 
2.14.3

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

* [MODERATED] Re: [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1
  2018-05-13 21:33 [MODERATED] [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1 konrad.wilk
@ 2018-05-13 22:07 ` Borislav Petkov
  2018-05-13 23:14   ` Linus Torvalds
  2018-05-13 23:08 ` [MODERATED] " Linus Torvalds
  1 sibling, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2018-05-13 22:07 UTC (permalink / raw)
  To: speck

On Sun, May 13, 2018 at 05:33:57PM -0400, speck for konrad.wilk_at_oracle.com wrote:
> x86/cpu: Make alternative_msr_write work for 32-bit code
> 
> Cast val and (val >> 32) to uintptr_t, so that they fit in a
> general-purpose register in both 32-bit and 64-bit code.
> 
> Fixes: c65732e4f721 ("x86/cpu: Restore CPUID_8000_0008_EBX reload")
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
>  arch/x86/include/asm/nospec-branch.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h
> index 328ea3cb769f..979aa050d311 100644
> --- a/arch/x86/include/asm/nospec-branch.h
> +++ b/arch/x86/include/asm/nospec-branch.h
> @@ -265,8 +265,8 @@ void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
>  {
>  	asm volatile(ALTERNATIVE("", "wrmsr", %c[feature])
>  		: : "c" (msr),
> -		    "a" (val),
> -		    "d" (val >> 32),
> +		    "a" ((uintptr_t)val),
> +		    "d" ((uintptr_t)(val >> 32)),

Make those casts (u32) simply as the rest of the MSR code does.

-- 
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
-- 

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

* [MODERATED] Re: [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1
  2018-05-13 21:33 [MODERATED] [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1 konrad.wilk
  2018-05-13 22:07 ` [MODERATED] " Borislav Petkov
@ 2018-05-13 23:08 ` Linus Torvalds
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2018-05-13 23:08 UTC (permalink / raw)
  To: speck



On Sun, 13 May 2018, speck for konrad.wilk_at_oracle.com wrote:
> 
> Cast val and (val >> 32) to uintptr_t, so that they fit in a
> general-purpose register in both 32-bit and 64-bit code.

Fair enough. Except why "uintptr_t"? That feels like an odd choice. The 
values have nothing to do with pointers.

It's a fine type, and I guess it approximates "native register size", but 
so does "long".

So "Ack", albeit with a query about why that particular type was chosen..

                Linus

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

* [MODERATED] Re: [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1
  2018-05-13 22:07 ` [MODERATED] " Borislav Petkov
@ 2018-05-13 23:14   ` Linus Torvalds
  2018-05-14 12:47     ` Thomas Gleixner
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2018-05-13 23:14 UTC (permalink / raw)
  To: speck



On Mon, 14 May 2018, speck for Borislav Petkov wrote:
> 
> Make those casts (u32) simply as the rest of the MSR code does.

Yeah, that's probably the right type.

                  Linus

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

* Re: [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1
  2018-05-13 23:14   ` Linus Torvalds
@ 2018-05-14 12:47     ` Thomas Gleixner
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2018-05-14 12:47 UTC (permalink / raw)
  To: speck

On Sun, 13 May 2018, speck for Linus Torvalds wrote:
> On Mon, 14 May 2018, speck for Borislav Petkov wrote:
> > 
> > Make those casts (u32) simply as the rest of the MSR code does.
> 
> Yeah, that's probably the right type.

Indeed. I fixed it up and applied it.

Thanks,

	tglx

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

end of thread, other threads:[~2018-05-14 12:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-13 21:33 [MODERATED] [PATCH v15.3 1/1] [PATCH v15.3] SSB fixup patch #1 konrad.wilk
2018-05-13 22:07 ` [MODERATED] " Borislav Petkov
2018-05-13 23:14   ` Linus Torvalds
2018-05-14 12:47     ` Thomas Gleixner
2018-05-13 23:08 ` [MODERATED] " Linus Torvalds

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.