[efi:next 2/3] drivers/firmware/efi/libstub/random.c:163:21: error: 'RANDOM_SEED_SIZE' undeclared

2017-08-22 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git next
head:   ff1f49b2ed7c150a69d1537a374c27e9db8acbb0
commit: 19c5678d5c1bad385a1beb8eaa00c9d50f4ce836 [2/3] efi/random: Increase 
size of firmware supplied randomness
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget 
https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 19c5678d5c1bad385a1beb8eaa00c9d50f4ce836
# save the attached .config to linux build tree
make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   In file included from drivers/firmware/efi/libstub/random.c:12:0:
   drivers/firmware/efi/libstub/random.c: In function 'efi_random_get_seed':
>> drivers/firmware/efi/libstub/random.c:163:21: error: 'RANDOM_SEED_SIZE' 
>> undeclared (first use in this function)
sizeof(*seed) + RANDOM_SEED_SIZE,
^
   arch/arm64/include/asm/efi.h:73:60: note: in definition of macro 
'efi_call_early'
#define efi_call_early(f, ...)  sys_table_arg->boottime->f(__VA_ARGS__)
   ^~~
   drivers/firmware/efi/libstub/random.c:163:21: note: each undeclared 
identifier is reported only once for each function it appears in
sizeof(*seed) + RANDOM_SEED_SIZE,
^
   arch/arm64/include/asm/efi.h:73:60: note: in definition of macro 
'efi_call_early'
#define efi_call_early(f, ...)  sys_table_arg->boottime->f(__VA_ARGS__)
   ^~~

vim +/RANDOM_SEED_SIZE +163 drivers/firmware/efi/libstub/random.c

e4fbf476 Ard Biesheuvel 2016-01-10  @12  #include 
e4fbf476 Ard Biesheuvel 2016-01-10   13  
e4fbf476 Ard Biesheuvel 2016-01-10   14  #include "efistub.h"
e4fbf476 Ard Biesheuvel 2016-01-10   15  
e4fbf476 Ard Biesheuvel 2016-01-10   16  struct efi_rng_protocol {
e4fbf476 Ard Biesheuvel 2016-01-10   17 efi_status_t (*get_info)(struct 
efi_rng_protocol *,
e4fbf476 Ard Biesheuvel 2016-01-10   18  
unsigned long *, efi_guid_t *);
e4fbf476 Ard Biesheuvel 2016-01-10   19 efi_status_t (*get_rng)(struct 
efi_rng_protocol *,
e4fbf476 Ard Biesheuvel 2016-01-10   20 
efi_guid_t *, unsigned long, u8 *out);
e4fbf476 Ard Biesheuvel 2016-01-10   21  };
e4fbf476 Ard Biesheuvel 2016-01-10   22  
e4fbf476 Ard Biesheuvel 2016-01-10   23  efi_status_t 
efi_get_random_bytes(efi_system_table_t *sys_table_arg,
e4fbf476 Ard Biesheuvel 2016-01-10   24   
unsigned long size, u8 *out)
e4fbf476 Ard Biesheuvel 2016-01-10   25  {
e4fbf476 Ard Biesheuvel 2016-01-10   26 efi_guid_t rng_proto = 
EFI_RNG_PROTOCOL_GUID;
e4fbf476 Ard Biesheuvel 2016-01-10   27 efi_status_t status;
e4fbf476 Ard Biesheuvel 2016-01-10   28 struct efi_rng_protocol *rng;
e4fbf476 Ard Biesheuvel 2016-01-10   29  
e4fbf476 Ard Biesheuvel 2016-01-10   30 status = 
efi_call_early(locate_protocol, _proto, NULL,
e4fbf476 Ard Biesheuvel 2016-01-10   31 (void 
**));
e4fbf476 Ard Biesheuvel 2016-01-10   32 if (status != EFI_SUCCESS)
e4fbf476 Ard Biesheuvel 2016-01-10   33 return status;
e4fbf476 Ard Biesheuvel 2016-01-10   34  
e4fbf476 Ard Biesheuvel 2016-01-10   35 return rng->get_rng(rng, NULL, 
size, out);
e4fbf476 Ard Biesheuvel 2016-01-10   36  }
2ddbfc81 Ard Biesheuvel 2016-01-11   37  
2ddbfc81 Ard Biesheuvel 2016-01-11   38  /*
2ddbfc81 Ard Biesheuvel 2016-01-11   39   * Return the number of slots covered 
by this entry, i.e., the number of
2ddbfc81 Ard Biesheuvel 2016-01-11   40   * addresses it covers that are 
suitably aligned and supply enough room
2ddbfc81 Ard Biesheuvel 2016-01-11   41   * for the allocation.
2ddbfc81 Ard Biesheuvel 2016-01-11   42   */
2ddbfc81 Ard Biesheuvel 2016-01-11   43  static unsigned long 
get_entry_num_slots(efi_memory_desc_t *md,
2ddbfc81 Ard Biesheuvel 2016-01-11   44 
 unsigned long size,
a6a14469 Ard Biesheuvel 2016-11-12   45 
 unsigned long align_shift)
2ddbfc81 Ard Biesheuvel 2016-01-11   46  {
a6a14469 Ard Biesheuvel 2016-11-12   47 unsigned long align = 1UL << 
align_shift;
018edcfa Ard Biesheuvel 2016-11-24   48 u64 first_slot, last_slot, 
region_end;
2ddbfc81 Ard Biesheuvel 2016-01-11   49  
2ddbfc81 Ard Biesheuvel 2016-01-11   50 if (md->type != 
EFI_CONVENTIONAL_MEMORY)
2ddbfc81 Ard Biesheuvel 2016-01-11   51 return 0;
2ddbfc81 Ard Biesheuvel 2016-01-11   52  
018edcfa Ard Biesheuvel 2016-11-24   53 region_end = 
min((u64)ULONG_MAX, md->phys_addr + md->num_pages*EFI_PAGE_SIZE - 1);
2ddbfc81 Ard Biesheuvel 2016-01-11   54  
018edcfa Ard Biesheuvel 

Re: [RFC Part1 PATCH v3 13/17] x86/io: Unroll string I/O when SEV is active

2017-08-22 Thread Borislav Petkov
On Wed, Jul 26, 2017 at 03:07:14PM -0500, Brijesh Singh wrote:
> Are you commenting on amount of code duplication ? If so, I can certainly 
> improve
> and use the similar macro used into header file to generate the functions 
> body.

So the argument about having CONFIG_AMD_MEM_ENCRYPT disabled doesn't
bring a whole lot because distro kernels will all have it enabled.

Optimally, it would be best if when SEV is enabled, we patch those IO
insns but we can't patch at arbitrary times - we just do it once, at
pre-SMP time.

And from looking at the code, we do set sev_enabled very early, as
part of __startup_64() -> sme_enable() so I guess we can make that
set a synthetic X86_FEATURE_ bit and then patch REP IN/OUT* with a
CALL, similar to what we do in arch/x86/include/asm/arch_hweight.h with
POPCNT.

But there you need to pay attention to registers being clobbered, see

  f5967101e9de ("x86/hweight: Get rid of the special calling convention")

Yap, it does sound a bit more complex but if done right, we will be
patching all call sites the same way we patch hweight*() calls and there
should be no change to kernel size...

As always, the devil is in the detail.

-- 
Regards/Gruss,
Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 
(AG Nürnberg)
-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH][next] efi/reboot: make function pointer orig_pm_power_off static

2017-08-22 Thread Ard Biesheuvel
On 22 August 2017 at 16:50, Colin King  wrote:
> From: Colin Ian King 
>
> The function pointer orig_pm_power_off is local to the source and does
> not need to be in global scope, so make it static.
>
> Cleans up sparse warning:
> symbol 'orig_pm_power_off' was not declared. Should it be static?
>
> Signed-off-by: Colin Ian King 

Queued, thanks.

> ---
>  drivers/firmware/efi/reboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
> index 7117e2d0c7f9..22874544d301 100644
> --- a/drivers/firmware/efi/reboot.c
> +++ b/drivers/firmware/efi/reboot.c
> @@ -5,7 +5,7 @@
>  #include 
>  #include 
>
> -void (*orig_pm_power_off)(void);
> +static void (*orig_pm_power_off)(void);
>
>  int efi_reboot_quirk_mode = -1;
>
> --
> 2.14.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH][next] efi/reboot: make function pointer orig_pm_power_off static

2017-08-22 Thread Colin King
From: Colin Ian King 

The function pointer orig_pm_power_off is local to the source and does
not need to be in global scope, so make it static.

Cleans up sparse warning:
symbol 'orig_pm_power_off' was not declared. Should it be static?

Signed-off-by: Colin Ian King 
---
 drivers/firmware/efi/reboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c
index 7117e2d0c7f9..22874544d301 100644
--- a/drivers/firmware/efi/reboot.c
+++ b/drivers/firmware/efi/reboot.c
@@ -5,7 +5,7 @@
 #include 
 #include 
 
-void (*orig_pm_power_off)(void);
+static void (*orig_pm_power_off)(void);
 
 int efi_reboot_quirk_mode = -1;
 
-- 
2.14.1

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html