From: Ingo Molnar <mingo@kernel.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Alex Thorlton <athorlton@sgi.com>,
linux-kernel@vger.kernel.org, Mike Travis <travis@sgi.com>,
Russ Anderson <rja@sgi.com>, Dimitri Sivanich <sivanich@sgi.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
x86@kernel.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [PATCH] x86/platform/UV: Fix support for EFI_OLD_MEMMAP after BIOS callback updates
Date: Wed, 19 Oct 2016 14:56:26 +0200 [thread overview]
Message-ID: <20161019125626.GA6249@gmail.com> (raw)
In-Reply-To: <20161019113200.GE31476@codeblueprint.co.uk>
* 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
next prev parent reply other threads:[~2016-10-19 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 12:47 Alex Thorlton
2016-10-19 11:32 ` Matt Fleming
2016-10-19 12:56 ` Ingo Molnar [this message]
2016-10-19 12:57 ` Alex Thorlton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161019125626.GA6249@gmail.com \
--to=mingo@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=athorlton@sgi.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
--cc=mingo@redhat.com \
--cc=rja@sgi.com \
--cc=sivanich@sgi.com \
--cc=tglx@linutronix.de \
--cc=travis@sgi.com \
--cc=x86@kernel.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome