All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
To: Alex Thorlton <athorlton-sJ/iWh9BUns@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Dimitri Sivanich <sivanich-sJ/iWh9BUns@public.gmane.org>,
	Russ Anderson <rja-sJ/iWh9BUns@public.gmane.org>,
	Mike Travis <travis-sJ/iWh9BUns@public.gmane.org>,
	Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Subject: Re: [PATCH 1/2] Create UV efi_call macros
Date: Tue, 17 May 2016 13:11:22 +0100	[thread overview]
Message-ID: <20160517121122.GC21993@codeblueprint.co.uk> (raw)
In-Reply-To: <20160516225840.GL98477-7ppMa7wkY9tKToyKb8PD+Zs2JHu2awxn0E9HWUfgJXw@public.gmane.org>

On Mon, 16 May, at 05:58:40PM, Alex Thorlton wrote:
> 
> I was simply re-using the efi_call implementation.  Boris suggested that
> I re-write this using the efi_call_virt macro, so I just went with that.
> It all seems to work just fine, so I don't see much reason to stray away
> from that implementation.  That being said, I'm obviously not a huge fun
> of the code duplication across the macros.  I think there's probably a
> way to minimize this, though I haven't quite worked out the best method
> yet (ideas are welcome :)

The reason I'm pressing for details is that we have a related issue
with the EFI thunking code (CONFIG_EFI_MIXED), where the function
pointer we want to call isn't accessible via the EFI System Table, see
efi_thunk().

Well, technically it *is* accessible, you just can't dereference the
services at runtime because the pointers in the tables are not 64-bit.

But the same constraints exist for EFI thunk and UV code; given a
function pointer to execute that isn't in efi.systab, setup the EFI
runtime environment and call a custom ABI function.

I haven't tested this (or thought through all the implications), but
could you look at providing a table (or something) for mapping a
function name to a ptr,func pair, e.g.

	thunk_get_time:	runtime_services32(get_time), efi64_thunk
	thunk_set_time:	runtime_services32(set_time), efi64_thunk
	...
	uv_call_func: efi.uv_systab->function, uv_efi_call_virt

which we could use in arch_efi_call_virt()? That should give us much
less code duplication and hide all this inside arch/x86.

WARNING: multiple messages have this Message-ID (diff)
From: Matt Fleming <matt@codeblueprint.co.uk>
To: Alex Thorlton <athorlton@sgi.com>
Cc: linux-kernel@vger.kernel.org, Dimitri Sivanich <sivanich@sgi.com>,
	Russ Anderson <rja@sgi.com>, Mike Travis <travis@sgi.com>,
	Borislav Petkov <bp@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-efi@vger.kernel.org,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 1/2] Create UV efi_call macros
Date: Tue, 17 May 2016 13:11:22 +0100	[thread overview]
Message-ID: <20160517121122.GC21993@codeblueprint.co.uk> (raw)
In-Reply-To: <20160516225840.GL98477@stormcage.americas.sgi.com>

On Mon, 16 May, at 05:58:40PM, Alex Thorlton wrote:
> 
> I was simply re-using the efi_call implementation.  Boris suggested that
> I re-write this using the efi_call_virt macro, so I just went with that.
> It all seems to work just fine, so I don't see much reason to stray away
> from that implementation.  That being said, I'm obviously not a huge fun
> of the code duplication across the macros.  I think there's probably a
> way to minimize this, though I haven't quite worked out the best method
> yet (ideas are welcome :)

The reason I'm pressing for details is that we have a related issue
with the EFI thunking code (CONFIG_EFI_MIXED), where the function
pointer we want to call isn't accessible via the EFI System Table, see
efi_thunk().

Well, technically it *is* accessible, you just can't dereference the
services at runtime because the pointers in the tables are not 64-bit.

But the same constraints exist for EFI thunk and UV code; given a
function pointer to execute that isn't in efi.systab, setup the EFI
runtime environment and call a custom ABI function.

I haven't tested this (or thought through all the implications), but
could you look at providing a table (or something) for mapping a
function name to a ptr,func pair, e.g.

	thunk_get_time:	runtime_services32(get_time), efi64_thunk
	thunk_set_time:	runtime_services32(set_time), efi64_thunk
	...
	uv_call_func: efi.uv_systab->function, uv_efi_call_virt

which we could use in arch_efi_call_virt()? That should give us much
less code duplication and hide all this inside arch/x86.

  parent reply	other threads:[~2016-05-17 12:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-11 19:55 [RFC PATCH 0/2] Fix EFI runtime calls on SGI UV Alex Thorlton
2016-05-11 19:55 ` [PATCH 1/2] Create UV efi_call macros Alex Thorlton
     [not found]   ` <1462996545-98387-2-git-send-email-athorlton-sJ/iWh9BUns@public.gmane.org>
2016-05-12  6:46     ` Ingo Molnar
2016-05-12  6:46       ` Ingo Molnar
     [not found]       ` <20160512064606.GA30717-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-12  7:35         ` Ard Biesheuvel
2016-05-12  7:35           ` Ard Biesheuvel
     [not found]           ` <CAKv+Gu8Z0faffrN8Jnz9fQPkyn6K69cFaRD348w+m_Lv4Jgynw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-12  8:17             ` Ingo Molnar
2016-05-12  8:17               ` Ingo Molnar
     [not found]               ` <20160512081739.GA25826-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-16 23:00                 ` Alex Thorlton
2016-05-16 23:00                   ` Alex Thorlton
2016-05-12 12:06   ` Matt Fleming
2016-05-16 22:58     ` Alex Thorlton
     [not found]       ` <20160516225840.GL98477-7ppMa7wkY9tKToyKb8PD+Zs2JHu2awxn0E9HWUfgJXw@public.gmane.org>
2016-05-17 12:11         ` Matt Fleming [this message]
2016-05-17 12:11           ` Matt Fleming
     [not found]           ` <20160517121122.GC21993-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-05-17 20:14             ` Alex Thorlton
2016-05-17 20:14               ` Alex Thorlton
2016-05-11 19:55 ` [PATCH 2/2] Fix efi_call Alex Thorlton
     [not found]   ` <1462996545-98387-3-git-send-email-athorlton-sJ/iWh9BUns@public.gmane.org>
2016-05-12  6:48     ` Ingo Molnar
2016-05-12  6:48       ` Ingo Molnar
2016-05-12 11:43       ` Matt Fleming
     [not found]       ` <20160512064835.GB30717-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-05-16 16:24         ` Alex Thorlton
2016-05-16 16:24           ` Alex Thorlton
2016-05-12 11:41     ` Matt Fleming
2016-05-12 11:41       ` Matt Fleming
     [not found]       ` <20160512114149.GD2728-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2016-05-16 16:25         ` Alex Thorlton
2016-05-16 16:25           ` 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=20160517121122.GC21993@codeblueprint.co.uk \
    --to=matt-mf/unelci9gs6ibeejttw/xrex20p6io@public.gmane.org \
    --cc=athorlton-sJ/iWh9BUns@public.gmane.org \
    --cc=bp-l3A5Bk7waGM@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rja-sJ/iWh9BUns@public.gmane.org \
    --cc=sivanich-sJ/iWh9BUns@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=travis-sJ/iWh9BUns@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /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 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.