Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1502961 > unrolled thread

[PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates

Started byAlex Thorlton <athorlton@sgi.com>
First post2016-10-18 14:50 +0200
Last post2016-10-19 17:00 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates Alex Thorlton <athorlton@sgi.com> - 2016-10-18 14:50 +0200
    Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after  BIOS callback updates Alex Thorlton <athorlton@sgi.com> - 2016-10-19 16:20 +0200
    Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after  BIOS callback updates Matt Fleming <matt@codeblueprint.co.uk> - 2016-10-19 16:30 +0200
      Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after  BIOS callback updates Ingo Molnar <mingo@kernel.org> - 2016-10-19 17:00 +0200

#1502961 — [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates

FromAlex Thorlton <athorlton@sgi.com>
Date2016-10-18 14:50 +0200
Subject[PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
Message-ID<stC0f-1Ip-15@gated-at.bofh.it>
Some time ago, we brought our UV BIOS callback code up to speed with the
new EFI memory mapping scheme, in commit:

    d1be84a232e3 ("x86/uv: Update uv_bios_call() to use efi_call_virt_pointer()")

By leveraging some changes that I made to a few of the EFI runtime
callback mechanisms, in commit:

    80e75596079f ("efi: Convert efi_call_virt() to efi_call_virt_pointer()")

This got everything running smoothly on UV, with the new EFI mapping
code.  However, this left one, small loose end, in that EFI_OLD_MEMMAP
(a.k.a. efi=old_map) will no longer work on UV, on kernels that include
the aforementioned changes.

At the time this was not a major issue (in fact, it still really isn't),
but there's no reason that EFI_OLD_MEMMAP *shouldn't* work on our
systems.  This commit adds a check into uv_bios_call, to see if we have
the EFI_OLD_MEMMAP bit set in efi.flags.  If it is set, we fall back to
using our old callback method, which uses efi_call directly on the __va
of our function pointer.

Signed-off-by: Alex Thorlton <athorlton@sgi.com>
Cc: Mike Travis <travis@sgi.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Dimitri Sivanich <sivanich@sgi.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: x86@kernel.org
---
 arch/x86/platform/uv/bios_uv.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
index b4d5e95..12b6e52 100644
--- a/arch/x86/platform/uv/bios_uv.c
+++ b/arch/x86/platform/uv/bios_uv.c
@@ -40,7 +40,15 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
 		 */
 		return BIOS_STATUS_UNIMPLEMENTED;
 
-	ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
+	/*
+	 * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI
+	 * callback method, which uses efi_call directly, with the kernel page tables.
+	 */
+	if (!test_bit(EFI_OLD_MEMMAP, &efi.flags))
+		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
+	else
+		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
+
 	return ret;
 }
 EXPORT_SYMBOL_GPL(uv_bios_call);
-- 
1.8.5.6

[toc] | [next] | [standalone]


#1503599 — Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates

FromAlex Thorlton <athorlton@sgi.com>
Date2016-10-19 16:20 +0200
SubjectRe: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
Message-ID<stZSN-2nd-11@gated-at.bofh.it>
In reply to#1502961
On Wed, Oct 19, 2016 at 12:32:00PM +0100, Matt Fleming wrote:
> Could you please invert the conditional? I had to read it 3 times to
> make sure it was correct given the comment that precedes it. E.g. this
> is preferable,
> 
> 	if (efi_enabled(EFI_OLD_MEMMAP))
> 		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
> 	else
> 		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);

Sure, no problem!  I generally default to checking for the more common
condition first, but I definitely see how that makes the code kind of
hard to read, in this case.

I'll send another version shortly.

Thanks, Matt!

[toc] | [prev] | [next] | [standalone]


#1503687 — Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2016-10-19 16:30 +0200
SubjectRe: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
Message-ID<stZSN-2nd-13@gated-at.bofh.it>
In reply to#1502961
On Tue, 18 Oct, at 07:47:38AM, Alex Thorlton wrote:
> Some time ago, we brought our UV BIOS callback code up to speed with the
> new EFI memory mapping scheme, in commit:
> 
>     d1be84a232e3 ("x86/uv: Update uv_bios_call() to use efi_call_virt_pointer()")
> 
> By leveraging some changes that I made to a few of the EFI runtime
> callback mechanisms, in commit:
> 
>     80e75596079f ("efi: Convert efi_call_virt() to efi_call_virt_pointer()")
> 
> This got everything running smoothly on UV, with the new EFI mapping
> code.  However, this left one, small loose end, in that EFI_OLD_MEMMAP
> (a.k.a. efi=old_map) will no longer work on UV, on kernels that include
> the aforementioned changes.
> 
> At the time this was not a major issue (in fact, it still really isn't),
> but there's no reason that EFI_OLD_MEMMAP *shouldn't* work on our
> systems.  This commit adds a check into uv_bios_call, to see if we have
> the EFI_OLD_MEMMAP bit set in efi.flags.  If it is set, we fall back to
> using our old callback method, which uses efi_call directly on the __va
> of our function pointer.
> 
> Signed-off-by: Alex Thorlton <athorlton@sgi.com>
> Cc: Mike Travis <travis@sgi.com>
> Cc: Russ Anderson <rja@sgi.com>
> Cc: Dimitri Sivanich <sivanich@sgi.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Matt Fleming <matt@codeblueprint.co.uk>
> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> Cc: x86@kernel.org
> ---
>  arch/x86/platform/uv/bios_uv.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
> index b4d5e95..12b6e52 100644
> --- a/arch/x86/platform/uv/bios_uv.c
> +++ b/arch/x86/platform/uv/bios_uv.c
> @@ -40,7 +40,15 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
>  		 */
>  		return BIOS_STATUS_UNIMPLEMENTED;
>  
> -	ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
> +	/*
> +	 * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI
> +	 * callback method, which uses efi_call directly, with the kernel page tables.
> +	 */
> +	if (!test_bit(EFI_OLD_MEMMAP, &efi.flags))
> +		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
> +	else
> +		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
> +
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(uv_bios_call);

Could you please invert the conditional? I had to read it 3 times to
make sure it was correct given the comment that precedes it. E.g. this
is preferable,

	if (efi_enabled(EFI_OLD_MEMMAP))
		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
	else
		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);

[toc] | [prev] | [next] | [standalone]


#1503776 — Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates

FromIngo Molnar <mingo@kernel.org>
Date2016-10-19 17:00 +0200
SubjectRe: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
Message-ID<su0vw-2D0-21@gated-at.bofh.it>
In reply to#1503687
* Matt Fleming <matt@codeblueprint.co.uk> wrote:

> On Tue, 18 Oct, at 07:47:38AM, Alex Thorlton wrote:
> > Some time ago, we brought our UV BIOS callback code up to speed with the
> > new EFI memory mapping scheme, in commit:
> > 
> >     d1be84a232e3 ("x86/uv: Update uv_bios_call() to use efi_call_virt_pointer()")
> > 
> > By leveraging some changes that I made to a few of the EFI runtime
> > callback mechanisms, in commit:
> > 
> >     80e75596079f ("efi: Convert efi_call_virt() to efi_call_virt_pointer()")
> > 
> > This got everything running smoothly on UV, with the new EFI mapping
> > code.  However, this left one, small loose end, in that EFI_OLD_MEMMAP
> > (a.k.a. efi=old_map) will no longer work on UV, on kernels that include
> > the aforementioned changes.
> > 
> > At the time this was not a major issue (in fact, it still really isn't),
> > but there's no reason that EFI_OLD_MEMMAP *shouldn't* work on our
> > systems.  This commit adds a check into uv_bios_call, to see if we have
> > the EFI_OLD_MEMMAP bit set in efi.flags.  If it is set, we fall back to
> > using our old callback method, which uses efi_call directly on the __va
> > of our function pointer.
> > 
> > Signed-off-by: Alex Thorlton <athorlton@sgi.com>
> > Cc: Mike Travis <travis@sgi.com>
> > Cc: Russ Anderson <rja@sgi.com>
> > Cc: Dimitri Sivanich <sivanich@sgi.com>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Ingo Molnar <mingo@redhat.com>
> > Cc: "H. Peter Anvin" <hpa@zytor.com>
> > Cc: Matt Fleming <matt@codeblueprint.co.uk>
> > Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
> > Cc: x86@kernel.org
> > ---
> >  arch/x86/platform/uv/bios_uv.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
> > index b4d5e95..12b6e52 100644
> > --- a/arch/x86/platform/uv/bios_uv.c
> > +++ b/arch/x86/platform/uv/bios_uv.c
> > @@ -40,7 +40,15 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5)
> >  		 */
> >  		return BIOS_STATUS_UNIMPLEMENTED;
> >  
> > -	ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
> > +	/*
> > +	 * If EFI_OLD_MEMMAP is set, we need to fall back to using our old EFI
> > +	 * callback method, which uses efi_call directly, with the kernel page tables.
> > +	 */
> > +	if (!test_bit(EFI_OLD_MEMMAP, &efi.flags))
> > +		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);
> > +	else
> > +		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
> > +
> >  	return ret;
> >  }
> >  EXPORT_SYMBOL_GPL(uv_bios_call);
> 
> Could you please invert the conditional? I had to read it 3 times to
> make sure it was correct given the comment that precedes it. E.g. this
> is preferable,
> 
> 	if (efi_enabled(EFI_OLD_MEMMAP))
> 		ret = efi_call((void *)__va(tab->function), (u64)which, a1, a2, a3, a4, a5);
> 	else
> 		ret = efi_call_virt_pointer(tab, function, (u64)which, a1, a2, a3, a4, a5);

Also, does 'which' have to be explicitly type-cast to u64? Doesn't the compiler DTRT?

Thanks,

	Ingo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web