public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Alex Thorlton <athorlton@sgi.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Dimitri Sivanich <sivanich@sgi.com>, Russ Anderson <rja@sgi.com>,
	Mike Travis <travis@sgi.com>,
	Matt Fleming <matt@codeblueprint.co.uk>,
	Borislav Petkov <bp@suse.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>
Subject: Re: [PATCH 1/2] Create UV efi_call macros
Date: Thu, 12 May 2016 10:17:39 +0200	[thread overview]
Message-ID: <20160512081739.GA25826@gmail.com> (raw)
In-Reply-To: <CAKv+Gu8Z0faffrN8Jnz9fQPkyn6K69cFaRD348w+m_Lv4Jgynw@mail.gmail.com>


* Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> On 12 May 2016 at 08:46, Ingo Molnar <mingo@kernel.org> wrote:
> >
> > * Alex Thorlton <athorlton@sgi.com> wrote:
> >
> >> +#define efi_call_virt(f, args...)                                    \
> >> +({                                                                   \
> >> +     efi_status_t __s;                                               \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     __s = arch_efi_call_virt(f, args);                              \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +     __s;                                                            \
> >> +})
> >> +
> >> +#define __efi_call_virt(f, args...)                                  \
> >> +({                                                                   \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     arch_efi_call_virt(f, args);                                    \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +})
> >> +
> >> +#define uv_call_virt(f, args...)                                     \
> >> +({                                                                   \
> >> +     efi_status_t __s;                                               \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     __s = uv_efi_call_virt(f, args);                                \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +     __s;                                                            \
> >> +})
> >
> > Btw., a very (very!) small stylistic nit that caught my eyes, and I realize that
> > you just moved code, but could you please improve these macros a bit and make it
> > look like regular kernel code? I.e. something like:
> >
> > #define efi_call_virt(f, args...)                                       \
> > ({                                                                      \
> >         efi_status_t __s;                                               \
> >         unsigned long flags;                                            \
> >                                                                         \
> >         arch_efi_call_virt_setup();                                     \
> >                                                                         \
> >         local_save_flags(flags);                                        \
> >         __s = arch_efi_call_virt(f, args);                              \
> >         efi_call_virt_check_flags(flags, __stringify(f));               \
> >         arch_efi_call_virt_teardown();                                  \
> >                                                                         \
> >         __s;                                                            \
> > })
> >
> > This delineates the various blocks of code: variables, setup, the saving/calling
> > block plus the return code.
> >
> > (Assuming the EFI folks like the whole approach.)
> >
> 
> Fine by me, although having a newline after arch_efi_call_virt_setup()
> but not before arch_efi_call_virt_teardown() seems rather arbitrary

It's an oversight! :-)

#define efi_call_virt(f, args...)					\
({									\
	efi_status_t __s;						\
	unsigned long flags;						\
									\
	arch_efi_call_virt_setup();					\
									\
	local_save_flags(flags);					\
	__s = arch_efi_call_virt(f, args);				\
	efi_call_virt_check_flags(flags, __stringify(f));		\
									\
	arch_efi_call_virt_teardown();					\
									\
	__s;								\
})

But if it's too segmented this is fine too:

#define efi_call_virt(f, args...)					\
({									\
	efi_status_t __s;						\
	unsigned long flags;						\
									\
	arch_efi_call_virt_setup();					\
	local_save_flags(flags);					\
	__s = arch_efi_call_virt(f, args);				\
	efi_call_virt_check_flags(flags, __stringify(f));		\
	arch_efi_call_virt_teardown();					\
									\
	__s;								\
})

Thanks,

	Ingo

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

Thread overview: 16+ 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
2016-05-12  6:46   ` Ingo Molnar
2016-05-12  7:35     ` Ard Biesheuvel
2016-05-12  8:17       ` Ingo Molnar [this message]
2016-05-16 23:00         ` Alex Thorlton
2016-05-12 12:06   ` Matt Fleming
2016-05-16 22:58     ` Alex Thorlton
2016-05-17 12:11       ` Matt Fleming
2016-05-17 20:14         ` Alex Thorlton
2016-05-11 19:55 ` [PATCH 2/2] Fix efi_call Alex Thorlton
2016-05-12  6:48   ` Ingo Molnar
2016-05-12 11:43     ` Matt Fleming
2016-05-16 16:24     ` Alex Thorlton
2016-05-12 11:41   ` Matt Fleming
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=20160512081739.GA25826@gmail.com \
    --to=mingo@kernel.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=athorlton@sgi.com \
    --cc=bp@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --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 \
    /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