All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Leif Lindholm <leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	mark.rutland-5wv7dgnIgG8@public.gmane.org,
	linaro-uefi-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	roy.franz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: Re: [PATCH v3 2/3] arm: Add [U]EFI runtime services support
Date: Fri, 6 Dec 2013 18:59:40 +0100	[thread overview]
Message-ID: <201312061859.40224.arnd@arndb.de> (raw)
In-Reply-To: <20131206175449.GD24997-GZEopFhza0F985/tl1ce8aaDwS/vmuI7@public.gmane.org>

On Friday 06 December 2013, Leif Lindholm wrote:
> 
> On Fri, Dec 06, 2013 at 02:59:48AM +0100, Arnd Bergmann wrote:
> > On Thursday 28 November 2013, Leif Lindholm wrote:
> > > @@ -898,6 +900,10 @@ void __init setup_arch(char **cmdline_p)
> > >  	sanity_check_meminfo();
> > >  	arm_memblock_init(&meminfo, mdesc);
> > >  
> > > +#ifdef CONFIG_EFI
> > > +	uefi_memblock_arm_reserve_range();
> > > +#endif
> > > +
> > 
> > Better use 
> > 
> > 	if (IS_ENABLED(CONFIG_EFI))
> > 
> > here for readability and better build-time checking of the interface when
> > CONFIG_EFI is disabled.
> 
> I think I'll do what Grant suggested and stub it out in asm/uefi.h.

That's ok, too. I usually prefer the IS_ENABLED() method if there is only
one caller, since it's harder to get wrong, but the result is similar.

> > > +/*
> > > + * Returns 1 if 'facility' is enabled, 0 otherwise.
> > > + */
> > > +int efi_enabled(int facility)
> > > +{
> > > +	return test_bit(facility, &arm_uefi_facility) != 0;
> > > +}
> > > +EXPORT_SYMBOL(efi_enabled);
> > 
> > I'd use EXPORT_SYMBOL_GPL() unless there is a documented reason why
> > a symbol should be available to GPL-incompatible modules.
> 
> So ... this is duplicating x86 code which Matt Fleming has promised
> to make generic. I'd prefer to keep it identical to x86 until this
> copy goes away.

Ok, makes sense.

> > > +static int __init remap_region(efi_memory_desc_t *md, efi_memory_desc_t *entry)
> > > +{
> > > +	u64 va;
> > > +	u64 paddr;
> > > +	u64 size;
> > > +
> > > +	*entry = *md;
> > > +	paddr = entry->phys_addr;
> > > +	size = entry->num_pages << EFI_PAGE_SHIFT;
> > > +
> > > +	/*
> > > +	 * Map everything writeback-capable as coherent memory,
> > > +	 * anything else as device.
> > > +	 */
> > > +	if (md->attribute & EFI_MEMORY_WB)
> > > +		va = (u64)((u32)uefi_remap(paddr, size) & 0xffffffffUL);
> > > +	else
> > > +		va = (u64)((u32)uefi_ioremap(paddr, size) & 0xffffffffUL);
> > 
> > Same here. Why is 'va' a u64?
> 
> Because the field in the structure (defined by UEFI) is 64-bit:
> 
>         entry->virt_addr = va;

I see. Maybe put the typecast in that final assignment then?

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 2/3] arm: Add [U]EFI runtime services support
Date: Fri, 6 Dec 2013 18:59:40 +0100	[thread overview]
Message-ID: <201312061859.40224.arnd@arndb.de> (raw)
In-Reply-To: <20131206175449.GD24997@rocoto.smurfnet.nu>

On Friday 06 December 2013, Leif Lindholm wrote:
> 
> On Fri, Dec 06, 2013 at 02:59:48AM +0100, Arnd Bergmann wrote:
> > On Thursday 28 November 2013, Leif Lindholm wrote:
> > > @@ -898,6 +900,10 @@ void __init setup_arch(char **cmdline_p)
> > >  	sanity_check_meminfo();
> > >  	arm_memblock_init(&meminfo, mdesc);
> > >  
> > > +#ifdef CONFIG_EFI
> > > +	uefi_memblock_arm_reserve_range();
> > > +#endif
> > > +
> > 
> > Better use 
> > 
> > 	if (IS_ENABLED(CONFIG_EFI))
> > 
> > here for readability and better build-time checking of the interface when
> > CONFIG_EFI is disabled.
> 
> I think I'll do what Grant suggested and stub it out in asm/uefi.h.

That's ok, too. I usually prefer the IS_ENABLED() method if there is only
one caller, since it's harder to get wrong, but the result is similar.

> > > +/*
> > > + * Returns 1 if 'facility' is enabled, 0 otherwise.
> > > + */
> > > +int efi_enabled(int facility)
> > > +{
> > > +	return test_bit(facility, &arm_uefi_facility) != 0;
> > > +}
> > > +EXPORT_SYMBOL(efi_enabled);
> > 
> > I'd use EXPORT_SYMBOL_GPL() unless there is a documented reason why
> > a symbol should be available to GPL-incompatible modules.
> 
> So ... this is duplicating x86 code which Matt Fleming has promised
> to make generic. I'd prefer to keep it identical to x86 until this
> copy goes away.

Ok, makes sense.

> > > +static int __init remap_region(efi_memory_desc_t *md, efi_memory_desc_t *entry)
> > > +{
> > > +	u64 va;
> > > +	u64 paddr;
> > > +	u64 size;
> > > +
> > > +	*entry = *md;
> > > +	paddr = entry->phys_addr;
> > > +	size = entry->num_pages << EFI_PAGE_SHIFT;
> > > +
> > > +	/*
> > > +	 * Map everything writeback-capable as coherent memory,
> > > +	 * anything else as device.
> > > +	 */
> > > +	if (md->attribute & EFI_MEMORY_WB)
> > > +		va = (u64)((u32)uefi_remap(paddr, size) & 0xffffffffUL);
> > > +	else
> > > +		va = (u64)((u32)uefi_ioremap(paddr, size) & 0xffffffffUL);
> > 
> > Same here. Why is 'va' a u64?
> 
> Because the field in the structure (defined by UEFI) is 64-bit:
> 
>         entry->virt_addr = va;

I see. Maybe put the typecast in that final assignment then?

	Arnd

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: matt.fleming@intel.com, linux-arm-kernel@lists.infradead.org,
	linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux@arm.linux.org.uk, mark.rutland@arm.com,
	linaro-uefi@lists.linaro.org, patches@linaro.org,
	roy.franz@linaro.org, msalter@redhat.com,
	grant.likely@linaro.org
Subject: Re: [PATCH v3 2/3] arm: Add [U]EFI runtime services support
Date: Fri, 6 Dec 2013 18:59:40 +0100	[thread overview]
Message-ID: <201312061859.40224.arnd@arndb.de> (raw)
In-Reply-To: <20131206175449.GD24997@rocoto.smurfnet.nu>

On Friday 06 December 2013, Leif Lindholm wrote:
> 
> On Fri, Dec 06, 2013 at 02:59:48AM +0100, Arnd Bergmann wrote:
> > On Thursday 28 November 2013, Leif Lindholm wrote:
> > > @@ -898,6 +900,10 @@ void __init setup_arch(char **cmdline_p)
> > >  	sanity_check_meminfo();
> > >  	arm_memblock_init(&meminfo, mdesc);
> > >  
> > > +#ifdef CONFIG_EFI
> > > +	uefi_memblock_arm_reserve_range();
> > > +#endif
> > > +
> > 
> > Better use 
> > 
> > 	if (IS_ENABLED(CONFIG_EFI))
> > 
> > here for readability and better build-time checking of the interface when
> > CONFIG_EFI is disabled.
> 
> I think I'll do what Grant suggested and stub it out in asm/uefi.h.

That's ok, too. I usually prefer the IS_ENABLED() method if there is only
one caller, since it's harder to get wrong, but the result is similar.

> > > +/*
> > > + * Returns 1 if 'facility' is enabled, 0 otherwise.
> > > + */
> > > +int efi_enabled(int facility)
> > > +{
> > > +	return test_bit(facility, &arm_uefi_facility) != 0;
> > > +}
> > > +EXPORT_SYMBOL(efi_enabled);
> > 
> > I'd use EXPORT_SYMBOL_GPL() unless there is a documented reason why
> > a symbol should be available to GPL-incompatible modules.
> 
> So ... this is duplicating x86 code which Matt Fleming has promised
> to make generic. I'd prefer to keep it identical to x86 until this
> copy goes away.

Ok, makes sense.

> > > +static int __init remap_region(efi_memory_desc_t *md, efi_memory_desc_t *entry)
> > > +{
> > > +	u64 va;
> > > +	u64 paddr;
> > > +	u64 size;
> > > +
> > > +	*entry = *md;
> > > +	paddr = entry->phys_addr;
> > > +	size = entry->num_pages << EFI_PAGE_SHIFT;
> > > +
> > > +	/*
> > > +	 * Map everything writeback-capable as coherent memory,
> > > +	 * anything else as device.
> > > +	 */
> > > +	if (md->attribute & EFI_MEMORY_WB)
> > > +		va = (u64)((u32)uefi_remap(paddr, size) & 0xffffffffUL);
> > > +	else
> > > +		va = (u64)((u32)uefi_ioremap(paddr, size) & 0xffffffffUL);
> > 
> > Same here. Why is 'va' a u64?
> 
> Because the field in the structure (defined by UEFI) is 64-bit:
> 
>         entry->virt_addr = va;

I see. Maybe put the typecast in that final assignment then?

	Arnd

  parent reply	other threads:[~2013-12-06 17:59 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-28 16:41 [PATCH v3 0/3] (U)EFI runtime services for arm Leif Lindholm
2013-11-28 16:41 ` Leif Lindholm
     [not found] ` < 20131129115319.GC11775@console-pimps.org>
     [not found] ` < 1385656883-4420-2-git-send-email-leif.lindholm@linaro.org>
     [not found]   ` < CAHCPf3t5dEzVWbYZ6DWcFCENNO2dbrx-YeZvKRk0MkEsJMTE3A@mail.gmail.com>
     [not found]     ` < 20131202210719.GQ24997@rocoto.smurfnet.nu>
     [not found]       ` < CAHCPf3tsWdV+dJGm6mX6N4Ou5EQoGukdLyRvsRX6VQFjtKgxtg@mail.gmail.com>
     [not found]         ` < 20131204224447.GA19265@srcf.ucam.org>
     [not found]           ` < CAHCPf3s_SXYXLRwvn7tzqTCQ-gB=emRMK_dXkEmw_HWigiD7Mw@mail.gmail.com>
     [not found]             ` < 20131210123035.D1586C40A27@trevor.secretlab.ca>
     [not found] ` <1385656883-4420-1-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-11-28 16:41   ` [PATCH v3 1/3] Documentation: arm: add UEFI support documentation Leif Lindholm
2013-11-28 16:41     ` Leif Lindholm
2013-11-28 16:41     ` Leif Lindholm
2013-12-02 19:51     ` Matt Sealey
2013-12-02 19:51       ` Matt Sealey
2013-12-02 21:07       ` Leif Lindholm
2013-12-02 21:07         ` Leif Lindholm
2013-12-02 21:07         ` Leif Lindholm
2013-12-04 21:06         ` Matt Sealey
2013-12-04 21:06           ` Matt Sealey
2013-12-04 22:44           ` Matthew Garrett
2013-12-04 22:44             ` Matthew Garrett
     [not found]             ` <20131204224447.GA19265-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2013-12-06 17:20               ` Matt Sealey
2013-12-06 17:20                 ` Matt Sealey
2013-12-06 17:20                 ` Matt Sealey
2013-12-10 12:30                 ` Grant Likely
2013-12-10 12:30                   ` Grant Likely
     [not found]                   ` <20131210123035.D1586C40A27-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2013-12-10 18:29                     ` Roy Franz
2013-12-10 18:29                       ` Roy Franz
2013-12-10 18:29                       ` Roy Franz
2013-12-10 22:42                       ` Grant Likely
2013-12-10 22:42                         ` Grant Likely
     [not found]           ` <CAHCPf3tsWdV+dJGm6mX6N4Ou5EQoGukdLyRvsRX6VQFjtKgxtg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-04 22:31             ` Mark Salter
2013-12-04 22:31               ` Mark Salter
2013-12-04 22:31               ` Mark Salter
2013-12-05 11:08             ` Grant Likely
2013-12-05 11:08               ` Grant Likely
2013-12-05 11:08               ` Grant Likely
2013-12-05 12:58             ` Leif Lindholm
2013-12-05 12:58               ` Leif Lindholm
2013-12-05 12:58               ` Leif Lindholm
2013-12-05 10:55       ` Grant Likely
2013-12-05 10:55         ` Grant Likely
2013-12-05 11:16     ` Grant Likely
2013-12-05 11:16       ` Grant Likely
2013-12-05 11:16       ` Grant Likely
2013-11-28 16:41   ` [PATCH v3 3/3] init: efi: arm: enable (U)EFI runtime services on arm Leif Lindholm
2013-11-28 16:41     ` Leif Lindholm
2013-11-28 16:41     ` Leif Lindholm
2013-11-29 11:53   ` [PATCH v3 0/3] (U)EFI runtime services for arm Matt Fleming
2013-11-29 11:53     ` Matt Fleming
2013-11-29 11:53     ` Matt Fleming
     [not found]     ` <20131129115319.GC11775-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2013-11-29 17:58       ` Leif Lindholm
2013-11-29 17:58         ` Leif Lindholm
2013-11-29 17:58         ` Leif Lindholm
2013-12-05 12:04         ` Grant Likely
2013-12-05 12:04           ` Grant Likely
2013-11-28 16:41 ` [PATCH v3 2/3] arm: Add [U]EFI runtime services support Leif Lindholm
2013-11-28 16:41   ` Leif Lindholm
     [not found]   ` <1385656883-4420-3-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-11-29 16:10     ` Will Deacon
2013-11-29 16:10       ` Will Deacon
2013-11-29 16:10       ` Will Deacon
     [not found]       ` <20131129161015.GE31000-MRww78TxoiP5vMa5CHWGZ34zcgK1vI+I0E9HWUfgJXw@public.gmane.org>
2013-11-29 17:43         ` Leif Lindholm
2013-11-29 17:43           ` Leif Lindholm
2013-11-29 17:43           ` Leif Lindholm
2013-12-06 12:20           ` Will Deacon
2013-12-06 12:20             ` Will Deacon
2013-12-06 12:20             ` Will Deacon
2013-12-06  1:59     ` Arnd Bergmann
2013-12-06  1:59       ` Arnd Bergmann
2013-12-06  1:59       ` Arnd Bergmann
2013-12-06 17:54       ` Leif Lindholm
2013-12-06 17:54         ` Leif Lindholm
     [not found]         ` <20131206175449.GD24997-GZEopFhza0F985/tl1ce8aaDwS/vmuI7@public.gmane.org>
2013-12-06 17:59           ` Arnd Bergmann [this message]
2013-12-06 17:59             ` Arnd Bergmann
2013-12-06 17:59             ` Arnd Bergmann
2013-12-05 11:59   ` Grant Likely
2013-12-05 11:59     ` Grant Likely
2013-12-05 11:59     ` Grant Likely
     [not found] ` < 1385656883-4420-4-git-send-email-leif.lindholm@linaro.org>
     [not found]   ` <1385656883-4420-4-git-send-email-leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-12-05 12:03     ` [PATCH v3 3/3] init: efi: arm: enable (U)EFI runtime services on arm Grant Likely
2013-12-05 12:03       ` Grant Likely
2013-12-05 12:03       ` Grant Likely

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=201312061859.40224.arnd@arndb.de \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linaro-uefi-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=msalter-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=roy.franz-QSEj5FYQhm4dnm+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.