Re: [U-Boot] [PATCH v3 1/5] x86: cpu: introduce scu_ipc_raw_command()

2018-09-16 Thread Bin Meng
On Mon, Sep 17, 2018 at 2:29 PM Bin Meng  wrote:
>
> On Tue, Sep 11, 2018 at 6:33 PM Georgii Staroselskii
>  wrote:
> >
> > This interface will be used to configure properly some pins on
> > Merrifield that are shared with SCU.
> >
> > scu_ipc_raw_command() writes SPTR and DPTR registers before sending
> > a command to SCU.
> >
> > This code has been ported from Linux work done by Andy Shevchenko.
> >
> > Signed-off-by: Georgii Staroselskii 
> > Reviewed-by: Andy Shevchenko 
> > ---
> >  arch/x86/include/asm/scu.h |  4 
> >  arch/x86/lib/scu.c | 51 
> > ++
> >  2 files changed, 55 insertions(+)
> >
>
> Reviewed-by: Bin Meng 

series applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/5] x86: cpu: introduce scu_ipc_raw_command()

2018-09-16 Thread Bin Meng
On Tue, Sep 11, 2018 at 6:33 PM Georgii Staroselskii
 wrote:
>
> This interface will be used to configure properly some pins on
> Merrifield that are shared with SCU.
>
> scu_ipc_raw_command() writes SPTR and DPTR registers before sending
> a command to SCU.
>
> This code has been ported from Linux work done by Andy Shevchenko.
>
> Signed-off-by: Georgii Staroselskii 
> Reviewed-by: Andy Shevchenko 
> ---
>  arch/x86/include/asm/scu.h |  4 
>  arch/x86/lib/scu.c | 51 
> ++
>  2 files changed, 55 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] x86: drop custom CONFIG_SYS_BAUDRATE_TABLE define

2018-09-16 Thread Bin Meng
On Fri, Sep 7, 2018 at 3:35 PM Bin Meng  wrote:
>
> On Fri, Sep 7, 2018 at 3:30 PM Christian Gmeiner
>  wrote:
> >
> > This will add support for a baud rate of 57600.
> >
> > Signed-off-by: Christian Gmeiner 
> > ---
> >  include/configs/x86-common.h | 2 --
> >  1 file changed, 2 deletions(-)
> >
>
> Reviewed-by: Bin Meng 

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 4/8] binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entry

2018-09-16 Thread Bin Meng
On Mon, Sep 3, 2018 at 1:08 PM Jagdish Gediya  wrote:
>
> This entry contains the PowerPC mpc85xx boot page and resetvec
> sections.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Updated README for new binman entry
> - Added test
>
> Changes for v3:
> - Changed text from 'Powerpc' to 'PowerPC'
>
>  tools/binman/README.entries| 14 +++-
>  .../etype/powerpc_mpc85xx_bootpg_resetvec.py   | 25 
> ++
>  tools/binman/ftest.py  |  8 +++
>  .../test/81_powerpc_mpc85xx_bootpg_resetvec.dts| 16 ++
>  4 files changed, 62 insertions(+), 1 deletion(-)
>  create mode 100644 tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
>  create mode 100644 tools/binman/test/81_powerpc_mpc85xx_bootpg_resetvec.dts
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/8] powerpc/dts: Define '_end' symbol in mpc85xx U-Boot lds files

2018-09-16 Thread Bin Meng
On Mon, Sep 3, 2018 at 1:08 PM Jagdish Gediya  wrote:
>
> 'board_fdt_blob_setup' function sets up fdt blob at '&_end' so
> define '_end' symbol in mpc85xx lds files.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Define '_end' symbol in lds file instead of defining new
>   'board_fdt_blob_setup' function using existing '_init_end' symbol.
>
> Changes for v3:
> - Define '_end' symbol in spl lds files too.
>
>  arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot-spl.lds  | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot.lds  | 1 +
>  4 files changed, 4 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] efi_loader: Align runtime section to 64kb

2018-09-16 Thread Heinrich Schuchardt
On 09/17/2018 04:45 AM, Alexander Graf wrote:
> The UEFI spec mandates that runtime sections are 64kb aligned to enable
> support for 64kb page size OSs.

Where in the spec did you find this? I could neither find the term
"runtime section" nor "64kb" in the text.

Best regards

Heinrich

> 
> This patch ensures that we extend the runtime section to 64kb to be spec
> compliant.
> 
> Signed-off-by: Alexander Graf 
> ---
>  lib/efi_loader/efi_memory.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index 4f8cb545ad..66ad54a152 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -526,10 +527,10 @@ static void add_u_boot_and_runtime(void)
>   uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
>   efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false);
>  
> - /* Add Runtime Services */
> - runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK;
> + /* Add Runtime Services,must be 64kb aligned */
> + runtime_start = (ulong)&__efi_runtime_start & ~(SZ_64K - 1);
>   runtime_end = (ulong)&__efi_runtime_stop;
> - runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
> + runtime_end = (runtime_end + SZ_64K - 1) & ~(SZ_64K - 1);
>   runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
>   efi_add_memory_map(runtime_start, runtime_pages,
>  EFI_RUNTIME_SERVICES_CODE, false);
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] efi_loader: Align runtime section to 64kb

2018-09-16 Thread Heinrich Schuchardt
On 09/17/2018 04:45 AM, Alexander Graf wrote:
> The UEFI spec mandates that runtime sections are 64kb aligned to enable
%s/kb/ kiB/g
The spec requires a multiple of 64,000 not of 65,536.

> support for 64kb page size OSs.
> 
> This patch ensures that we extend the runtime section to 64kb to be spec
> compliant.
> 
> Signed-off-by: Alexander Graf 
> ---
>  lib/efi_loader/efi_memory.c | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index 4f8cb545ad..66ad54a152 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -526,10 +527,10 @@ static void add_u_boot_and_runtime(void)
>   uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
>   efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false);
>  
> - /* Add Runtime Services */
> - runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK;
> + /* Add Runtime Services,must be 64kb aligned */
> + runtime_start = (ulong)&__efi_runtime_start & ~(SZ_64K - 1);

Please, add a comment in the code referring to the requirement in the
UEFI spec.

Best regards

Heinrich

>   runtime_end = (ulong)&__efi_runtime_stop;
> - runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
> + runtime_end = (runtime_end + SZ_64K - 1) & ~(SZ_64K - 1);
>   runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
>   efi_add_memory_map(runtime_start, runtime_pages,
>  EFI_RUNTIME_SERVICES_CODE, false);
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] QSPI driver for Zynq and ZynqMP

2018-09-16 Thread Siva Durga Prasad Paladugu
Hi Jagan,

Could you please take some time to look into this mail and let me now your 
comments.

Thanks,
Siva

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Siva
> Durga Prasad Paladugu
> Sent: Wednesday, September 12, 2018 2:47 PM
> To: u-boot@lists.denx.de
> Cc: Michal Simek ; Jagan Teki
> 
> Subject: Re: [U-Boot] QSPI driver for Zynq and ZynqMP
> 
> Ping!
> 
> Thanks,
> Siva
> 
> From: Siva Durga Prasad Paladugu
> Sent: Friday, September 07, 2018 12:59 PM
> To: 'u-boot@lists.denx.de' 
> Cc: Jagan Teki ; Michal Simek
> 
> Subject: QSPI driver for Zynq and ZynqMP
> 
> Hi Jagan,
> 
> We would like to upstream quad and dual modes(parallel and stacked)
> support for qspi drivers of Zynq and ZynqMP. Can we send patches based
> on existing framework(drivers/spi , this is what we are using on Xilinx tree)
> or you want us to use any other?
> I know we had discussion sometime back on this and we completed
> upstreaming driver without dual modes support as a first step. Please let
> me know on how to proceed further on adding quad and dual modes
> support. Any inputs are welcome.
> 
> Thanks,
> Siva
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] config.mk: Remove duplicated -fno-strict-aliasing

2018-09-16 Thread Bin Meng
Now that we already disable the "strict-aliasing" globally, remove
the duplicates in the nds32/riscv/x86 arch-specific Makefiles.

Signed-off-by: Bin Meng 
Reviewed-by: Rick Chen 

---

 arch/nds32/config.mk | 2 +-
 arch/riscv/config.mk | 2 +-
 arch/x86/config.mk   | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index cb3d8b3..c5520fd 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -15,7 +15,7 @@ endif
 CONFIG_STANDALONE_LOAD_ADDR = 0x30 \
  -T $(srctree)/examples/standalone/nds32.lds
 
-PLATFORM_RELFLAGS  += -fno-strict-aliasing -fno-common -mrelax
+PLATFORM_RELFLAGS  += -fno-common -mrelax
 PLATFORM_RELFLAGS  += -gdwarf-2
 PLATFORM_CPPFLAGS  += -D__nds32__ -G0 -ffixed-10 -fpie
 
diff --git a/arch/riscv/config.mk b/arch/riscv/config.mk
index 219e666..c0b3858 100644
--- a/arch/riscv/config.mk
+++ b/arch/riscv/config.mk
@@ -31,7 +31,7 @@ CONFIG_STANDALONE_LOAD_ADDR = 0x \
  -T $(srctree)/examples/standalone/riscv.lds
 
 PLATFORM_CPPFLAGS  += -ffixed-gp -fpic
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -gdwarf-2 
-ffunction-sections
+PLATFORM_RELFLAGS += -fno-common -gdwarf-2 -ffunction-sections
 LDFLAGS_u-boot += --gc-sections -static -pie
 
 EFI_CRT0   := crt0_riscv_efi.o
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 5b04feb..cc94071 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -5,7 +5,6 @@
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x4
 
-PLATFORM_CPPFLAGS += -fno-strict-aliasing
 PLATFORM_CPPFLAGS += -fomit-frame-pointer
 PF_CPPFLAGS_X86   := $(call cc-option, -fno-toplevel-reorder, \
 $(call cc-option, -fno-unit-at-a-time))
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/2] Makefile: Use -fno-strict-aliasing globally

2018-09-16 Thread Bin Meng
The -fstrict-aliasing option is implicitly enabled at levels -O2,
-O3, -Os by GCC. This option allows the compiler to assume the
strictest aliasing rules applicable to the language being compiled.
For example, the practice of reading from a different union member
than the one most recently written to (called "type-punning") is
common. In this case, "type-punning" only works if the memory is
accessed through the union type, but might not work by taking the
address, casting the resulting pointer and dereferencing the result,
which is an undefined behavior per the "strict aliasing rules".

GCC's -Wstrict-aliasing (included in -Wall) option does not catch
all cases, but does attempt to catch the more common pitfalls. So
there are cases that GCC does not report but the codes are violating
the "strict aliasing rules".

Given lots of codes that may be written to rely on "type-punning",
and Linux kernel disables it by -fno-strict-aliasing globally, since
U-Boot currently does this on nds32/riscv/x86 builds only, extend
this for all architecture builds.

Signed-off-by: Bin Meng 
Reviewed-by: Tom Rini 
Reviewed-by: Simon Glass 
---

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1891c3a..12f15ba 100644
--- a/Makefile
+++ b/Makefile
@@ -372,7 +372,7 @@ KBUILD_CPPFLAGS := -D__KERNEL__ -D__UBOOT__
 KBUILD_CFLAGS   := -Wall -Wstrict-prototypes \
   -Wno-format-security \
   -fno-builtin -ffreestanding $(CSTD_FLAG)
-KBUILD_CFLAGS  += -fshort-wchar
+KBUILD_CFLAGS  += -fshort-wchar -fno-strict-aliasing
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 
 # Don't generate position independent code
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 14/15] riscv: Add QEMU virt board support

2018-09-16 Thread Bin Meng
Hi Lukas,

On Mon, Sep 17, 2018 at 5:02 AM Auer, Lukas
 wrote:
>
> Hi Bin,
>
> On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> > This adds QEMU RISC-V 'virt' board target support, with the hope of
> > helping people easily test U-Boot on RISC-V.
> >
> > The QEMU virt machine models a generic RISC-V virtual machine with
> > support for the VirtIO standard networking and block storage devices.
> > It has CLINT, PLIC, 16550A UART devices in addition to VirtIO and
> > it also uses device-tree to pass configuration information to guest
> > software. It implements RISC-V privileged architecture spec v1.10.
> >
> > Both 32-bit and 64-bit builds are supported. Support is pretty much
> > preliminary, only booting to U-Boot shell with the UART driver on
> > a single core. Booting Linux is not supported yet.
> >
> > Signed-off-by: Bin Meng 
> >
> > ---
>
> Reviewed-by: Lukas Auer 
>
> [snip]
>
> >
> > diff --git a/board/emulation/qemu-riscv/Kconfig
> > b/board/emulation/qemu-riscv/Kconfig
> > new file mode 100644
> > index 000..029f5efb
> > --- /dev/null
> > +++ b/board/emulation/qemu-riscv/Kconfig
> > @@ -0,0 +1,21 @@
> > +if TARGET_QEMU_VIRT
> > +
> > +config SYS_BOARD
> > + default "qemu-riscv"
> > +
> > +config SYS_VENDOR
> > + default "emulation"
> > +
> > +config SYS_CPU
> > + default "qemu"
> > +
> > +config SYS_CONFIG_NAME
> > + default "qemu-riscv"
> > +
> > +config SYS_TEXT_BASE
> > + default 0x8000
> > +
> > +config BOARD_SPECIFIC_OPTIONS # dummy
> > + def_bool y
> > +
>
> Out of curiosity, what is BOARD_SPECIFIC_OPTIONS used for? I see that
> other boards have included it as well, but I don't see it actually used
> anywhere.

This option is used to select or imply some board-specific options,
mostly drivers, so that we can avoid specifying them in the board
defconfig files. I think I should have at least moved the
CONFIG_SYS_NS16550 here. I am also working on virtio drivers, and once
they are done, these drivers can be implied here too.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 15/15] riscv: Move do_reset() to a common place

2018-09-16 Thread Bin Meng
Hi Lukas,

On Mon, Sep 17, 2018 at 5:09 AM Auer, Lukas
 wrote:
>
> Hi Bin,
>
> On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> > We don't have a reset method on any RISC-V board yet. Instead of
> > adding the same 'unsupported' message for each CPU variant it might
> > make more sense to add a generic do_reset function for all CPU
> > variants to lib/, similar to the one for ARM (arch/arm/lib/reset.c).
> >
> > Suggested-by: Lukas Auer 
> > Signed-off-by: Bin Meng 
> >
> > ---
> >
> > Changes in v2:
> > - new patch to move do_reset() to a common place
> >
> >  arch/riscv/cpu/ax25/cpu.c |  9 -
> >  arch/riscv/cpu/qemu/cpu.c |  8 
> >  arch/riscv/lib/Makefile   |  1 +
> >  arch/riscv/lib/reset.c| 14 ++
> >  4 files changed, 15 insertions(+), 17 deletions(-)
> >  create mode 100644 arch/riscv/lib/reset.c
> >
> > diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/ax25/cpu.c
> > index ab05b57..fddcc15 100644
> > --- a/arch/riscv/cpu/ax25/cpu.c
> > +++ b/arch/riscv/cpu/ax25/cpu.c
> > @@ -6,9 +6,6 @@
> >
> >  /* CPU specific code */
> >  #include 
> > -#include 
> > -#include 
> > -#include 
> >
> >  /*
> >   * cleanup_before_linux() is called just before we call linux
> > @@ -24,9 +21,3 @@ int cleanup_before_linux(void)
> >
> >   return 0;
> >  }
> > -
> > -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > argv[])
> > -{
> > - disable_interrupts();
> > - panic("ax25-ae350 wdt not support yet.\n");
> > -}
> > diff --git a/arch/riscv/cpu/qemu/cpu.c b/arch/riscv/cpu/qemu/cpu.c
> > index a064639..6c7a327 100644
> > --- a/arch/riscv/cpu/qemu/cpu.c
> > +++ b/arch/riscv/cpu/qemu/cpu.c
> > @@ -4,7 +4,6 @@
> >   */
> >
> >  #include 
> > -#include 
> >
> >  /*
> >   * cleanup_before_linux() is called just before we call linux
> > @@ -20,10 +19,3 @@ int cleanup_before_linux(void)
> >
> >   return 0;
> >  }
> > -
> > -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > argv[])
> > -{
> > - printf("reset unsupported yet\n");
> > -
> > - return 0;
> > -}
> > diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
> > index cc562f9..b58db89 100644
> > --- a/arch/riscv/lib/Makefile
> > +++ b/arch/riscv/lib/Makefile
> > @@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
> >  obj-$(CONFIG_CMD_GO) += boot.o
> >  obj-y+= cache.o
> >  obj-y+= interrupts.o
> > +obj-y+= reset.o
> >  obj-y   += setjmp.o
> >
> >  # For building EFI apps
> > diff --git a/arch/riscv/lib/reset.c b/arch/riscv/lib/reset.c
> > new file mode 100644
> > index 000..5d9b99c
> > --- /dev/null
> > +++ b/arch/riscv/lib/reset.c
> > @@ -0,0 +1,14 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018, Bin Meng 
> > + */
> > +
> > +#include 
> > +#include 
> > +
> > +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> > argv[])
> > +{
> > + printf("reset unsupported yet\n");
> > +
> > + return 0;
> > +}
>
> Thanks for adding this patch!
> I see one possible problem with it. The way you implemented it, arch /
> board code can't overwrite the function to add a reset method. How
> about something like this?
>

Thanks for your review and comments. I believe current implementation
in this patch is an interim approach, for now to save some duplicates.
The problem you mentioned can be resolved by implementing a SYSRESET
uclass driver for that CPU/board in the future.

> - do_reset() only prints "resetting..." and then calls cpu_reset()
> - reset.c includes a weak cpu_reset() function that prints the warning
> you currently have in this patch (by the way, it should say "reset not
> supported yet"). It might also make sense to print the warning with the
> panic() function and define PANIC_HANG, so that u-boot is halted on
> resets. cpu_reset() can then be defined by boards that have an actual
> reset method.

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 08/15] riscv: Add a helper routine to print CPU information

2018-09-16 Thread Bin Meng
Hi Lukas,

On Mon, Sep 17, 2018 at 4:54 AM Auer, Lukas
 wrote:
>
> Hi Bin,
>
> On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> > This adds a helper routine to print CPU information. Currently
> > it prints all the instruction set extensions that the processor
> > core supports.
> >
> > Signed-off-by: Bin Meng 
> > ---
> >
> > Changes in v2: None
> >
> >  arch/riscv/Makefile  |   1 +
> >  arch/riscv/cpu/Makefile  |   5 ++
> >  arch/riscv/cpu/cpu.c |  49 +
> >  arch/riscv/include/asm/csr.h | 124
> > +++
> >  4 files changed, 179 insertions(+)
> >  create mode 100644 arch/riscv/cpu/Makefile
> >  create mode 100644 arch/riscv/cpu/cpu.c
> >  create mode 100644 arch/riscv/include/asm/csr.h
> >
> > diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> > index 084888a..af432e1 100644
> > --- a/arch/riscv/Makefile
> > +++ b/arch/riscv/Makefile
> > @@ -5,5 +5,6 @@
> >
> >  head-y := arch/riscv/cpu/$(CPU)/start.o
> >
> > +libs-y += arch/riscv/cpu/
> >  libs-y += arch/riscv/cpu/$(CPU)/
> >  libs-y += arch/riscv/lib/
> > diff --git a/arch/riscv/cpu/Makefile b/arch/riscv/cpu/Makefile
> > new file mode 100644
> > index 000..63de163
> > --- /dev/null
> > +++ b/arch/riscv/cpu/Makefile
> > @@ -0,0 +1,5 @@
> > +# SPDX-License-Identifier: GPL-2.0+
> > +#
> > +# Copyright (C) 2018, Bin Meng 
> > +
> > +obj-y += cpu.o
> > diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> > new file mode 100644
> > index 000..ae57fb8
> > --- /dev/null
> > +++ b/arch/riscv/cpu/cpu.c
> > @@ -0,0 +1,49 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (C) 2018, Bin Meng 
> > + */
> > +
> > +#include 
> > +#include 
> > +
> > +enum {
> > + ISA_INVALID = 0,
> > + ISA_32BIT,
> > + ISA_64BIT,
> > + ISA_128BIT
> > +};
> > +
> > +static const char * const isa_bits[] = {
> > + [ISA_INVALID] = NULL,
> > + [ISA_32BIT]   = "32",
> > + [ISA_64BIT]   = "64",
> > + [ISA_128BIT]  = "128"
> > +};
> > +
> > +static inline bool supports_extension(char ext)
> > +{
> > + return csr_read(misa) & (1 << (ext - 'a'));
> > +}
> > +
> > +int print_cpuinfo(void)
> > +{
> > + char name[32];
> > + char *s = name;
> > + int bit;
> > +
> > + s += sprintf(name, "rv");
> > + bit = csr_read(misa) >> (sizeof(long) * 8 - 2);
> > + s += sprintf(s, isa_bits[bit]);
> > +
> > + supports_extension('i') ? *s++ = 'i' : 'r';
> > + supports_extension('m') ? *s++ = 'm' : 'i';
> > + supports_extension('a') ? *s++ = 'a' : 's';
> > + supports_extension('f') ? *s++ = 'f' : 'c';
> > + supports_extension('d') ? *s++ = 'd' : '-';
> > + supports_extension('c') ? *s++ = 'c' : 'v';
> > + *s++ = '\0';
>
> Why are you not using the ISA string "riscv,isa" from the device tree?
> This way, the code is not limited to machine mode and we do not have
> update it if the set of extensions to check for changes.

I wanted to use hardware provided information whenever possible.
Reading from DT can be a last resort. I think we wanted to have U-Boot
running in machine mode, no?

Regards,
Bin

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] efi_loader: Align runtime section to 64kb

2018-09-16 Thread Alexander Graf
The UEFI spec mandates that runtime sections are 64kb aligned to enable
support for 64kb page size OSs.

This patch ensures that we extend the runtime section to 64kb to be spec
compliant.

Signed-off-by: Alexander Graf 
---
 lib/efi_loader/efi_memory.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 4f8cb545ad..66ad54a152 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -526,10 +527,10 @@ static void add_u_boot_and_runtime(void)
uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false);
 
-   /* Add Runtime Services */
-   runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK;
+   /* Add Runtime Services,must be 64kb aligned */
+   runtime_start = (ulong)&__efi_runtime_start & ~(SZ_64K - 1);
runtime_end = (ulong)&__efi_runtime_stop;
-   runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
+   runtime_end = (runtime_end + SZ_64K - 1) & ~(SZ_64K - 1);
runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
efi_add_memory_map(runtime_start, runtime_pages,
   EFI_RUNTIME_SERVICES_CODE, false);
-- 
2.12.3

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] efi_loader: Merge memory map entries

2018-09-16 Thread Alexander Graf
We currently do not combine memory entries that are adjacent and have
the same attributes. The problem with that is that our memory map can
easily grow multiple hundreds of entries in a simple UEFI Shell
environment.

So let's make sure we always combine all entries to make the memory
map as small as possible. That way every other piece of code that
loops through it should also gain some nice speed ups.

Signed-off-by: Alexander Graf 
---
 lib/efi_loader/efi_memory.c | 45 +
 1 file changed, 45 insertions(+)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 4f8cb545ad..5bd4f4d7fc 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -65,9 +65,54 @@ static int efi_mem_cmp(void *priv, struct list_head *a, 
struct list_head *b)
return -1;
 }
 
+static uint64_t desc_get_end(struct efi_mem_desc *desc)
+{
+   return desc->physical_start + (desc->num_pages << EFI_PAGE_SHIFT);
+}
+
 static void efi_mem_sort(void)
 {
+   struct list_head *lhandle;
+   struct efi_mem_list *prevmem = NULL;
+   bool merge_again = true;
+
list_sort(NULL, &efi_mem, efi_mem_cmp);
+
+   /* Now merge entries that can be merged */
+   while (merge_again) {
+   merge_again = false;
+   list_for_each(lhandle, &efi_mem) {
+   struct efi_mem_list *lmem;
+   struct efi_mem_desc *prev = &prevmem->desc;
+   struct efi_mem_desc *cur;
+   uint64_t pages;
+
+   lmem = list_entry(lhandle, struct efi_mem_list, link);
+   if (!prevmem) {
+   prevmem = lmem;
+   continue;
+   }
+
+   cur = &lmem->desc;
+
+   if ((desc_get_end(cur) == prev->physical_start) &&
+   (prev->type == cur->type) &&
+   (prev->attribute == cur->attribute)) {
+   /* There is an existing map before, reuse it */
+   pages = cur->num_pages;
+   prev->num_pages += pages;
+   prev->physical_start -= pages << EFI_PAGE_SHIFT;
+   prev->virtual_start -= pages << EFI_PAGE_SHIFT;
+   list_del(&lmem->link);
+   free(lmem);
+
+   merge_again = true;
+   break;
+   }
+
+   prevmem = lmem;
+   }
+   }
 }
 
 /** efi_mem_carve_out - unmap memory region
-- 
2.12.3

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] u-boot: Upgrade 2018.07 -> 2018.09

2018-09-16 Thread Otavio Salvador
On Sun, Sep 16, 2018 at 6:16 PM Otavio Salvador  wrote:
>
> This upgrades U-Boot to 2018.09 release and drop the backported
> security fixes which are now included upstream.
>
> Signed-off-by: Otavio Salvador 

When I mentioned, on IRC, about this bump to Marek, he mentioned that
there is a regression on x86 being worked on upstream so this patch
should wait for this to be sorted out before we update it.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/4] u-boot: Upgrade 2018.07 -> 2018.09

2018-09-16 Thread Otavio Salvador
This upgrades U-Boot to 2018.09 release and drop the backported
security fixes which are now included upstream.

Signed-off-by: Otavio Salvador 
---

 .../u-boot/files/CVE-2018-1000205-1.patch |  59 
 .../u-boot/files/CVE-2018-1000205-2.patch | 143 --
 ..._2018.07.inc => u-boot-common_2018.09.inc} |   7 +-
 ..._2018.07.bb => u-boot-fw-utils_2018.09.bb} |   0
 ...e_2018.07.bb => u-boot-mkimage_2018.09.bb} |   0
 .../{u-boot_2018.07.bb => u-boot_2018.09.bb}  |   0
 6 files changed, 2 insertions(+), 207 deletions(-)
 delete mode 100644 meta/recipes-bsp/u-boot/files/CVE-2018-1000205-1.patch
 delete mode 100644 meta/recipes-bsp/u-boot/files/CVE-2018-1000205-2.patch
 rename meta/recipes-bsp/u-boot/{u-boot-common_2018.07.inc => 
u-boot-common_2018.09.inc} (64%)
 rename meta/recipes-bsp/u-boot/{u-boot-fw-utils_2018.07.bb => 
u-boot-fw-utils_2018.09.bb} (100%)
 rename meta/recipes-bsp/u-boot/{u-boot-mkimage_2018.07.bb => 
u-boot-mkimage_2018.09.bb} (100%)
 rename meta/recipes-bsp/u-boot/{u-boot_2018.07.bb => u-boot_2018.09.bb} (100%)

diff --git a/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-1.patch 
b/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-1.patch
deleted file mode 100644
index fed3c3dcb9..00
--- a/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-1.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 7346c1e192d63cd35f99c7e845e53c5d4d0bdc24 Mon Sep 17 00:00:00 2001
-From: Teddy Reed 
-Date: Sat, 9 Jun 2018 11:45:20 -0400
-Subject: [PATCH] vboot: Do not use hashed-strings offset
-
-The hashed-strings signature property includes two uint32_t values.
-The first is unneeded as there should never be a start offset into the
-strings region. The second, the size, is needed because the added
-signature node appends to this region.
-
-See tools/image-host.c, where a static 0 value is used for the offset.
-
-Signed-off-by: Teddy Reed 
-Reviewed-by: Simon Glass 
-
-Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
- h=7346c1e192d63cd35f99c7e845e53c5d4d0bdc24]
-
-CVE: CVE-2018-1000205
-
-Signed-off-by: Changqing Li 

- common/image-sig.c | 7 +--
- tools/image-host.c | 1 +
- 2 files changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/common/image-sig.c b/common/image-sig.c
-index 8d2fd10..5a269d3 100644
 a/common/image-sig.c
-+++ b/common/image-sig.c
-@@ -377,8 +377,11 @@ int fit_config_check_sig(const void *fit, int noffset, 
int required_keynode,
-   /* Add the strings */
-   strings = fdt_getprop(fit, noffset, "hashed-strings", NULL);
-   if (strings) {
--  fdt_regions[count].offset = fdt_off_dt_strings(fit) +
--  fdt32_to_cpu(strings[0]);
-+  /*
-+   * The strings region offset must be a static 0x0.
-+   * This is set in tool/image-host.c
-+   */
-+  fdt_regions[count].offset = fdt_off_dt_strings(fit);
-   fdt_regions[count].size = fdt32_to_cpu(strings[1]);
-   count++;
-   }
-diff --git a/tools/image-host.c b/tools/image-host.c
-index 8e43671..be2d59b 100644
 a/tools/image-host.c
-+++ b/tools/image-host.c
-@@ -135,6 +135,7 @@ static int fit_image_write_sig(void *fit, int noffset, 
uint8_t *value,
- 
-   ret = fdt_setprop(fit, noffset, "hashed-nodes",
-  region_prop, region_proplen);
-+  /* This is a legacy offset, it is unused, and must remain 0. */
-   strdata[0] = 0;
-   strdata[1] = cpu_to_fdt32(string_size);
-   if (!ret) {
--- 
-2.7.4
-
diff --git a/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-2.patch 
b/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-2.patch
deleted file mode 100644
index bb79af1c7b..00
--- a/meta/recipes-bsp/u-boot/files/CVE-2018-1000205-2.patch
+++ /dev/null
@@ -1,143 +0,0 @@
-From 72239fc85f3eda078547956608c063ab965e90e9 Mon Sep 17 00:00:00 2001
-From: Teddy Reed 
-Date: Sat, 9 Jun 2018 11:38:05 -0400
-Subject: [PATCH] vboot: Add FIT_SIGNATURE_MAX_SIZE protection
-
-This adds a new config value FIT_SIGNATURE_MAX_SIZE, which controls the
-max size of a FIT header's totalsize field. The field is checked before
-signature checks are applied to protect from reading past the intended
-FIT regions.
-
-This field is not part of the vboot signature so it should be sanity
-checked. If the field is corrupted then the structure or string region
-reads may have unintended behavior, such as reading from device memory.
-A default value of 256MB is set and intended to support most max storage
-sizes.
-
-Suggested-by: Simon Glass 
-Signed-off-by: Teddy Reed 
-Reviewed-by: Simon Glass 
-
-Upstream-Status: Backport[http://git.denx.de/?p=u-boot.git;a=commit;
- h=72239fc85f3eda078547956608c063ab965e90e9]
-
-CVE: CVE-2018-1000205
-
-Signed-off-by: Changqing Li 

- Kconfig | 10 ++
- common/image-sig.c  |  5 +
- test/py/tests/test_

Re: [U-Boot] [RESEND PATCH v2 15/15] riscv: Move do_reset() to a common place

2018-09-16 Thread Auer, Lukas
Hi Bin,

On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> We don't have a reset method on any RISC-V board yet. Instead of
> adding the same 'unsupported' message for each CPU variant it might
> make more sense to add a generic do_reset function for all CPU
> variants to lib/, similar to the one for ARM (arch/arm/lib/reset.c).
> 
> Suggested-by: Lukas Auer 
> Signed-off-by: Bin Meng 
> 
> ---
> 
> Changes in v2:
> - new patch to move do_reset() to a common place
> 
>  arch/riscv/cpu/ax25/cpu.c |  9 -
>  arch/riscv/cpu/qemu/cpu.c |  8 
>  arch/riscv/lib/Makefile   |  1 +
>  arch/riscv/lib/reset.c| 14 ++
>  4 files changed, 15 insertions(+), 17 deletions(-)
>  create mode 100644 arch/riscv/lib/reset.c
> 
> diff --git a/arch/riscv/cpu/ax25/cpu.c b/arch/riscv/cpu/ax25/cpu.c
> index ab05b57..fddcc15 100644
> --- a/arch/riscv/cpu/ax25/cpu.c
> +++ b/arch/riscv/cpu/ax25/cpu.c
> @@ -6,9 +6,6 @@
>  
>  /* CPU specific code */
>  #include 
> -#include 
> -#include 
> -#include 
>  
>  /*
>   * cleanup_before_linux() is called just before we call linux
> @@ -24,9 +21,3 @@ int cleanup_before_linux(void)
>  
>   return 0;
>  }
> -
> -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[])
> -{
> - disable_interrupts();
> - panic("ax25-ae350 wdt not support yet.\n");
> -}
> diff --git a/arch/riscv/cpu/qemu/cpu.c b/arch/riscv/cpu/qemu/cpu.c
> index a064639..6c7a327 100644
> --- a/arch/riscv/cpu/qemu/cpu.c
> +++ b/arch/riscv/cpu/qemu/cpu.c
> @@ -4,7 +4,6 @@
>   */
>  
>  #include 
> -#include 
>  
>  /*
>   * cleanup_before_linux() is called just before we call linux
> @@ -20,10 +19,3 @@ int cleanup_before_linux(void)
>  
>   return 0;
>  }
> -
> -int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[])
> -{
> - printf("reset unsupported yet\n");
> -
> - return 0;
> -}
> diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
> index cc562f9..b58db89 100644
> --- a/arch/riscv/lib/Makefile
> +++ b/arch/riscv/lib/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
>  obj-$(CONFIG_CMD_GO) += boot.o
>  obj-y+= cache.o
>  obj-y+= interrupts.o
> +obj-y+= reset.o
>  obj-y   += setjmp.o
>  
>  # For building EFI apps
> diff --git a/arch/riscv/lib/reset.c b/arch/riscv/lib/reset.c
> new file mode 100644
> index 000..5d9b99c
> --- /dev/null
> +++ b/arch/riscv/lib/reset.c
> @@ -0,0 +1,14 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018, Bin Meng 
> + */
> +
> +#include 
> +#include 
> +
> +int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const
> argv[])
> +{
> + printf("reset unsupported yet\n");
> +
> + return 0;
> +}

Thanks for adding this patch!
I see one possible problem with it. The way you implemented it, arch /
board code can't overwrite the function to add a reset method. How
about something like this?

- do_reset() only prints "resetting..." and then calls cpu_reset()
- reset.c includes a weak cpu_reset() function that prints the warning
you currently have in this patch (by the way, it should say "reset not
supported yet"). It might also make sense to print the warning with the
panic() function and define PANIC_HANG, so that u-boot is halted on
resets. cpu_reset() can then be defined by boards that have an actual
reset method.

Thanks,
Lukas
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 14/15] riscv: Add QEMU virt board support

2018-09-16 Thread Auer, Lukas
Hi Bin,

On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> This adds QEMU RISC-V 'virt' board target support, with the hope of
> helping people easily test U-Boot on RISC-V.
> 
> The QEMU virt machine models a generic RISC-V virtual machine with
> support for the VirtIO standard networking and block storage devices.
> It has CLINT, PLIC, 16550A UART devices in addition to VirtIO and
> it also uses device-tree to pass configuration information to guest
> software. It implements RISC-V privileged architecture spec v1.10.
> 
> Both 32-bit and 64-bit builds are supported. Support is pretty much
> preliminary, only booting to U-Boot shell with the UART driver on
> a single core. Booting Linux is not supported yet.
> 
> Signed-off-by: Bin Meng 
> 
> ---

Reviewed-by: Lukas Auer 

[snip]

> 
> diff --git a/board/emulation/qemu-riscv/Kconfig
> b/board/emulation/qemu-riscv/Kconfig
> new file mode 100644
> index 000..029f5efb
> --- /dev/null
> +++ b/board/emulation/qemu-riscv/Kconfig
> @@ -0,0 +1,21 @@
> +if TARGET_QEMU_VIRT
> +
> +config SYS_BOARD
> + default "qemu-riscv"
> +
> +config SYS_VENDOR
> + default "emulation"
> +
> +config SYS_CPU
> + default "qemu"
> +
> +config SYS_CONFIG_NAME
> + default "qemu-riscv"
> +
> +config SYS_TEXT_BASE
> + default 0x8000
> +
> +config BOARD_SPECIFIC_OPTIONS # dummy
> + def_bool y
> +

Out of curiosity, what is BOARD_SPECIFIC_OPTIONS used for? I see that
other boards have included it as well, but I don't see it actually used
anywhere.

Thanks,
Lukas
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 13/15] riscv: kconfig: Select DM and OF_CONTROL

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> RISC-V is a pretty new architecture and should support DM and
> OF_CONTROL by default.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/15] riscv: ae350: Clean up mixed tabs and spaces in the dts

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> There are quite a lot of mixed tabs and spaces in the ae350.dts.
> Clean them up.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 11/15] riscv: Make start.S available for all targets

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> Currently start.S is inside arch/riscv/cpu/ax25/, but it can be
> common for all RISC-V targets.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 10/15] riscv: bootm: Pass mhartid CSR value to kernel

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> So far this is hardcoded to zero, and we should read the value from
> mhartid CSR and pass it to Linux kernel.
> 
> Suggested-by: Lukas Auer 
> Signed-off-by: Bin Meng 
> 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 09/15] riscv: Remove CSR read/write defines in encoding.h

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> There is no reason to keep two versions of CSR read/write defines
> in encoding.h. We already have one set of defines in csr.h, which
> is from Linux kernel, and let's drop the one in encoding.h.
> 
> Signed-off-by: Bin Meng 
> 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 08/15] riscv: Add a helper routine to print CPU information

2018-09-16 Thread Auer, Lukas
Hi Bin,

On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> This adds a helper routine to print CPU information. Currently
> it prints all the instruction set extensions that the processor
> core supports.
> 
> Signed-off-by: Bin Meng 
> ---
> 
> Changes in v2: None
> 
>  arch/riscv/Makefile  |   1 +
>  arch/riscv/cpu/Makefile  |   5 ++
>  arch/riscv/cpu/cpu.c |  49 +
>  arch/riscv/include/asm/csr.h | 124
> +++
>  4 files changed, 179 insertions(+)
>  create mode 100644 arch/riscv/cpu/Makefile
>  create mode 100644 arch/riscv/cpu/cpu.c
>  create mode 100644 arch/riscv/include/asm/csr.h
> 
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 084888a..af432e1 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -5,5 +5,6 @@
>  
>  head-y := arch/riscv/cpu/$(CPU)/start.o
>  
> +libs-y += arch/riscv/cpu/
>  libs-y += arch/riscv/cpu/$(CPU)/
>  libs-y += arch/riscv/lib/
> diff --git a/arch/riscv/cpu/Makefile b/arch/riscv/cpu/Makefile
> new file mode 100644
> index 000..63de163
> --- /dev/null
> +++ b/arch/riscv/cpu/Makefile
> @@ -0,0 +1,5 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Copyright (C) 2018, Bin Meng 
> +
> +obj-y += cpu.o
> diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
> new file mode 100644
> index 000..ae57fb8
> --- /dev/null
> +++ b/arch/riscv/cpu/cpu.c
> @@ -0,0 +1,49 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018, Bin Meng 
> + */
> +
> +#include 
> +#include 
> +
> +enum {
> + ISA_INVALID = 0,
> + ISA_32BIT,
> + ISA_64BIT,
> + ISA_128BIT
> +};
> +
> +static const char * const isa_bits[] = {
> + [ISA_INVALID] = NULL,
> + [ISA_32BIT]   = "32",
> + [ISA_64BIT]   = "64",
> + [ISA_128BIT]  = "128"
> +};
> +
> +static inline bool supports_extension(char ext)
> +{
> + return csr_read(misa) & (1 << (ext - 'a'));
> +}
> +
> +int print_cpuinfo(void)
> +{
> + char name[32];
> + char *s = name;
> + int bit;
> +
> + s += sprintf(name, "rv");
> + bit = csr_read(misa) >> (sizeof(long) * 8 - 2);
> + s += sprintf(s, isa_bits[bit]);
> +
> + supports_extension('i') ? *s++ = 'i' : 'r';
> + supports_extension('m') ? *s++ = 'm' : 'i';
> + supports_extension('a') ? *s++ = 'a' : 's';
> + supports_extension('f') ? *s++ = 'f' : 'c';
> + supports_extension('d') ? *s++ = 'd' : '-';
> + supports_extension('c') ? *s++ = 'c' : 'v';
> + *s++ = '\0';

Why are you not using the ISA string "riscv,isa" from the device tree?
This way, the code is not limited to machine mode and we do not have
update it if the set of extensions to check for changes.

Thanks,
Lukas

> +
> + printf("CPU:   %s\n", name);
> +
> + return 0;
> +}
> diff --git a/arch/riscv/include/asm/csr.h
> b/arch/riscv/include/asm/csr.h
> new file mode 100644
> index 000..50fccea
> --- /dev/null
> +++ b/arch/riscv/include/asm/csr.h
> @@ -0,0 +1,124 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2015 Regents of the University of California
> + *
> + * Taken from Linux arch/riscv/include/asm/csr.h
> + */
> +
> +#ifndef _ASM_RISCV_CSR_H
> +#define _ASM_RISCV_CSR_H
> +
> +/* Status register flags */
> +#define SR_SIE   _AC(0x0002, UL) /* Supervisor
> Interrupt Enable */
> +#define SR_SPIE  _AC(0x0020, UL) /* Previous
> Supervisor IE */
> +#define SR_SPP   _AC(0x0100, UL) /* Previously
> Supervisor */
> +#define SR_SUM   _AC(0x0004, UL) /* Supervisor
> access User Memory */
> +
> +#define SR_FS_AC(0x6000, UL) /* Floating-point
> Status */
> +#define SR_FS_OFF_AC(0x, UL)
> +#define SR_FS_INITIAL_AC(0x2000, UL)
> +#define SR_FS_CLEAN  _AC(0x4000, UL)
> +#define SR_FS_DIRTY  _AC(0x6000, UL)
> +
> +#define SR_XS_AC(0x00018000, UL) /* Extension Status
> */
> +#define SR_XS_OFF_AC(0x, UL)
> +#define SR_XS_INITIAL_AC(0x8000, UL)
> +#define SR_XS_CLEAN  _AC(0x0001, UL)
> +#define SR_XS_DIRTY  _AC(0x00018000, UL)
> +
> +#ifndef CONFIG_64BIT
> +#define SR_SD_AC(0x8000, UL) /* FS/XS dirty */
> +#else
> +#define SR_SD_AC(0x8000, UL) /* FS/XS
> dirty */
> +#endif
> +
> +/* SATP flags */
> +#if __riscv_xlen == 32
> +#define SATP_PPN _AC(0x003F, UL)
> +#define SATP_MODE_32 _AC(0x8000, UL)
> +#define SATP_MODESATP_MODE_32
> +#else
> +#define SATP_PPN _AC(0x0FFF, UL)
> +#define SATP_MODE_39 _AC(0x8000, UL)
> +#define SATP_MODESATP_MODE_39
> +#endif
> +
> +/* Interrupt Enable and Interrupt Pending flags */
> +#define SIE_SSIE _AC(0x0002, UL) /* Software Interrupt
> Enable */
> +#define SIE_STIE _AC(0x0020, UL) /* Timer Interrupt Enable
> */
> +
> +#define EXC_INST_MISALIGNED  0
> +#define EXC_INST_ACCESS  1
> +#define EXC_BREAKPOINT

Re: [U-Boot] [RESEND PATCH v2 07/15] riscv: Explicitly pass -march and -mabi to the compiler

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> At present the compiler flag against which architecture and abi
> variant the riscv image is built for is not explicitly indicated
> which means the default compiler configuration is used. But this
> does not work if we want to build a different target (eg: 32-bit
> riscv images using a toolchain configured for 64-bit riscv).
> 
> Fix this by explicitly passing -march and -mabi to the compiler.
> Since generically we don't use floating point in U-Boot, specify
> the RV[32|64]IMA ISA and software floating ABI.
> 
> This also fix some alignment coding style issues.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 06/15] riscv: Fix coding style issues in the linker script

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> There are several coding style issues in the linker script. Fix them.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 05/15] riscv: Move the linker script to the CPU root directory

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> The linker script can be shared by all RISC-V targets. Move it to
> a common place.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 04/15] riscv: Remove mach type

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> Since the mach_id is not used by RISC-V, remove it.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 03/15] riscv: bootm: Correct the 1st kernel argument to hart id

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> The first argument of Linux kernel is the risc-v core hart id,
> from which the kernel is booted from. It is not the mach_id,
> which seems to be copied from arm.
> 
> While we are here, this also changes the Linux kernel entry
> parameters' type to support both 32-bit and 64-bit.
> 
> Note the hart id is hardcoded to zero for now, and we should
> change to fill in it with the value read from mhartid CSR of
> the hart which this routine is currently running on.
> 
> Signed-off-by: Bin Meng 
> 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 02/15] riscv: Remove setup.h

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> This was copied from ARM, and does not apply to RISC-V. While we
> are here, bootm.h is eventually removed as its content is only
> the inclusion of setup.h.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 01/15] riscv: kconfig: Normalize architecture name spelling

2018-09-16 Thread Auer, Lukas
On Mon, 2018-09-10 at 21:54 -0700, Bin Meng wrote:
> It's RISC-V that is the official name, not RISCV.
> 
> Signed-off-by: Bin Meng 
> 

Reviewed-by: Lukas Auer 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 07/13] x86: Fix signed shift overflow in MSR_IA32_APICBASE_BASE

2018-09-16 Thread Eugeniu Rosca
Hi Bin,

Apologize for the delay. I came back from vacation a few days ago.

On Tue, Sep 04, 2018 at 12:00:14PM +0800, Bin Meng wrote:
> Hi Eugeniu,
> 
> On Sat, Sep 1, 2018 at 6:59 PM Eugeniu Rosca  wrote:
[..]

> > Just wanted to let you know that coreboot folks are going through
> > similar discussions in [1]. Also, experimenting with various gcc
> > versions and flags in my spare time, I collected some evidence [2]
> > showing that the behavior of GCC UBSAN (-fsanitize=undefined &
> > friends) may differ a lot depending on the gcc version and below
> > flags (none used by U-Boot, but some used in Linux kernel):
> >  -fwrapv
> >  -fstrict-overflow
> >  -fno-strict-overflow
> >
> > Checking how -fno-strict-overflow and -fwrapv compare to each other
> > (since they seem to accomplish similar goals according to many sources),
> > I've used the sample app from [3] to see how gcc handles signed integer
> > wraparound depending on gcc version, flags, optimization level and
> > on whether UBSAN is enabled or not. The variance/inconsistency of the
> > results [4] is very high in my opinion.
> >
> > One clear conclusion of [4] is that questions like why gcc UBSAN
> > complains in U-Boot but not in the Kernel require knowing at least the
> > parameters  tracked in [4] (and maybe more).
> >
> > [1] https://mail.coreboot.org/pipermail/coreboot/2018-February/086146.html
> > [2] UBSAN behavior (printing 1 << 31) is highly dependent on gcc version 
> > and flags
[..]

> Thank you very much for all these details and links. I learned a lot
> from this thread. It looks to me that coreboot folks are not in favor
> of this UBSAN thing. I personally have no preference, but I suspect
> there are a lot more in the U-Boot tree that have such warnings.

I don't think they question the usefulness of UBSAN as a whole. Rather,
they seem to be annoyed by one particular (frequently reproduced) UBSAN
error, specifically what gcc man pages refer to as "left-shifting 1 into
the sign bit". Note that shifting *past* the sign bit is a different
(presumably more serious) subclass of signed integer shift overflow.
Both the coreboot discussion and the fixes from my series are limited
to "left-shifting into (not past) the sign bit" behavior.

Both the C11 [6] standard (to which U-Boot "adhered" via commit [5]) and
the later C18 [7] define the left shifts as follows (§6.5.7p4):

--8<--
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits
are filled with zeros. If E1 has an unsigned type, the value of the result
is E1 × 2^E2, reduced modulo one more than the maximum value representable
in the result type. If E1 has a signed type and nonnegative value, and
E1 × 2^E2 is representable in the result type, then that is the resulting
value; otherwise, the behavior is undefined.
--8<--

With respect to the type of the result, both C11/C18 standards state
in §6.5.7p3:

--8<--
The type of the result is that of the promoted left operand.
--8<--

My understanding of the above is that, purely from C11/C18 standard
perspective, (1 << 31) is undefined behavior since the result can't be
represented in the type of the left operand (signed int).

In spite of this, things are not as simple as we would like them to be
and the DR463 entry of the "Defect Report Summary for C11" [8] tackles
exactly the "Left-shifting into the sign bit" by saying that it should
be harmonized with C++-14 [9]. The latter suffered a change in
"§5.8.2 Shift operators" chapter due to DR1457 ("Undefined behavior in
left-shift") [10], a defect report raised back in 2012. As a result,
C++-14 now considers the "left-shifting into the sign bit" as defined
behavior:

--8<--
...if E1 has a signed type and non-negative value, and E1 ⨯ 2^E2 is
representable in the **corresponding unsigned type of the result type**,
then that value, **converted to the result type**, is the resulting
value; otherwise, the behavior is undefined.
--8<--

To emphasize that the things are far from being settled, I will just
reference the UB-related talk [11] of Chandler Carruth at CppCon 2016,
which (amongst other topics) touches the left shifting of signed
integers and, to my understanding, conveys the message that there are
holes in the mental model of shifting signed integers to the left and
the solution to overcome those is still unclear.

> Given
> the behavior is quite dependent on GCC versions and flags, do kernel
> folks have any final solution on this?

I still didn't fully answer one of your first questions, more exactly
why UBSAN complains about (1 << 31) in U-Boot, but not in Linux kernel.
It turns out there is another gcc option heavily affecting the UBSAN
behavior and it is (somewhat expectedly) the language standard
"-std=" [12]. As already mentioned, U-Boot recently switched to C11
via commit [5], while Linux kernel still sticks to ANSI/C89 C
via commit [13].

Just for the record, the definition of left shift operator provided
by C89/C90

[U-Boot] [PATCH 3/6] Kconfig: tegra: Migrate SYS_I2C_TEGRA

2018-09-16 Thread Peter Robinson
Migrate SYS_I2C_TEGRA from headers to Kconfig

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
Cc: Heiko Schocher 
Cc: Marcel Ziswiler 
Cc: peter.ch...@data61.csiro.au
Cc: Lucas Stach 
Cc: Stefan Agner 
Cc: Alban Bedel 
Cc: Allen Martin 
---
 configs/apalis-tk1_defconfig | 1 +
 configs/apalis_t30_defconfig | 1 +
 configs/beaver_defconfig | 1 +
 configs/cardhu_defconfig | 1 +
 configs/cei-tk1-som_defconfig| 1 +
 configs/colibri_t20_defconfig| 1 +
 configs/colibri_t30_defconfig| 1 +
 configs/dalmore_defconfig| 1 +
 configs/e2220-1170_defconfig | 1 +
 configs/jetson-tk1_defconfig | 1 +
 configs/nyan-big_defconfig   | 1 +
 configs/p2371-_defconfig | 1 +
 configs/p2371-2180_defconfig | 1 +
 configs/p2571_defconfig  | 1 +
 configs/p2771--000_defconfig | 1 +
 configs/p2771--500_defconfig | 1 +
 configs/seaboard_defconfig   | 1 +
 configs/tec-ng_defconfig | 1 +
 configs/trimslice_defconfig  | 1 +
 configs/venice2_defconfig| 1 +
 drivers/i2c/Kconfig  | 6 ++
 include/configs/apalis-tk1.h | 3 ---
 include/configs/apalis_t30.h | 3 ---
 include/configs/beaver.h | 3 ---
 include/configs/cardhu.h | 3 ---
 include/configs/cei-tk1-som.h| 3 ---
 include/configs/colibri_t20.h| 3 ---
 include/configs/colibri_t30.h| 3 ---
 include/configs/dalmore.h| 3 ---
 include/configs/e2220-1170.h | 3 ---
 include/configs/jetson-tk1.h | 3 ---
 include/configs/nyan-big.h   | 3 ---
 include/configs/p2371-.h | 3 ---
 include/configs/p2371-2180.h | 3 ---
 include/configs/p2571.h  | 3 ---
 include/configs/p2771-.h | 3 ---
 include/configs/seaboard.h   | 3 ---
 include/configs/tec-ng.h | 3 ---
 include/configs/trimslice.h  | 3 ---
 include/configs/venice2.h| 3 ---
 scripts/config_whitelist.txt | 1 -
 41 files changed, 26 insertions(+), 58 deletions(-)

diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index 83721b403b5..ca5ded8e946 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-apalis"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 0e6547b72c4..05b1a57ff26 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -26,6 +26,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-apalis"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig
index 28cb04c38be..d8513a0b8c8 100644
--- a/configs/beaver_defconfig
+++ b/configs/beaver_defconfig
@@ -26,6 +26,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-beaver"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/cardhu_defconfig b/configs/cardhu_defconfig
index c046ef5d8be..545b3ee8db4 100644
--- a/configs/cardhu_defconfig
+++ b/configs/cardhu_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-cardhu"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
diff --git a/configs/cei-tk1-som_defconfig b/configs/cei-tk1-som_defconfig
index c782fef89e9..5ea257e778d 100644
--- a/configs/cei-tk1-som_defconfig
+++ b/configs/cei-tk1-som_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_DEFAULT_DEVICE_TREE="tegra124-cei-tk1-som"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index dcb2bcf617b..496f4be0238 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -33,6 +33,7 @@ CONFIG_CMD_UBI=y
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-colibri"
 CONFIG_ENV_IS_IN_NAND=y
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index c8b82a9b582..07f34359d1d 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_EXT4_WRITE=y
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_OF_LIVE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra30-colibri"
+CONFIG_SYS_I2C_TEGRA=y
 CONFIG_SPL_DM=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
diff --git a/configs/dalmore_defconfig b/configs/dalmore_defconfig
index 9c08aadc0d1..f07dc020786 100644
--- a/configs/dalmore_defconfig
+++ b/configs/dalmore_defcon

[U-Boot] [PATCH 2/6] tegra20: common: fix USB_EHCI_TXFIFO_THRESH value

2018-09-16 Thread Peter Robinson
All other Tegra devices that define USB_EHCI_TXFIFO_THRESH use hex
representation, fix tegra20 to be the same format.

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
---
 include/configs/tegra20-common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/tegra20-common.h b/include/configs/tegra20-common.h
index 7f0a5292c2e..3551616cd1e 100644
--- a/include/configs/tegra20-common.h
+++ b/include/configs/tegra20-common.h
@@ -78,7 +78,7 @@
  * parameter, the default (2) causes occasional Data Buffer Errors in OUT
  * packets depending on the buffer address and size.
  */
-#define CONFIG_USB_EHCI_TXFIFO_THRESH  10
+#define CONFIG_USB_EHCI_TXFIFO_THRESH  0x10
 #define CONFIG_EHCI_IS_TDI
 
 #define CONFIG_SYS_NAND_SELF_INIT
-- 
2.19.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/6] Kconfig: tegra: Migrate USB_EHCI_TEGRA

2018-09-16 Thread Peter Robinson
Migrate USB_EHCI_TEGRA from headers to Kconfig

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
Cc: Marek Vasut 
Cc: Marcel Ziswiler 
Cc: peter.ch...@data61.csiro.au
Cc: Lucas Stach 
Cc: Stefan Agner 
Cc: Alban Bedel 
Cc: Allen Martin 
---
 configs/apalis-tk1_defconfig  | 1 +
 configs/apalis_t30_defconfig  | 1 +
 configs/beaver_defconfig  | 1 +
 configs/cardhu_defconfig  | 1 +
 configs/cei-tk1-som_defconfig | 1 +
 configs/colibri_t20_defconfig | 1 +
 configs/colibri_t30_defconfig | 1 +
 configs/dalmore_defconfig | 1 +
 configs/e2220-1170_defconfig  | 1 +
 configs/harmony_defconfig | 1 +
 configs/jetson-tk1_defconfig  | 1 +
 configs/medcom-wide_defconfig | 1 +
 configs/nyan-big_defconfig| 1 +
 configs/p2371-_defconfig  | 1 +
 configs/p2371-2180_defconfig  | 1 +
 configs/p2571_defconfig   | 1 +
 configs/paz00_defconfig   | 1 +
 configs/plutux_defconfig  | 1 +
 configs/seaboard_defconfig| 1 +
 configs/tec-ng_defconfig  | 1 +
 configs/tec_defconfig | 1 +
 configs/trimslice_defconfig   | 1 +
 configs/venice2_defconfig | 1 +
 configs/ventana_defconfig | 1 +
 drivers/usb/host/Kconfig  | 6 ++
 include/configs/apalis-tk1.h  | 3 ---
 include/configs/apalis_t30.h  | 3 ---
 include/configs/beaver.h  | 3 ---
 include/configs/cardhu.h  | 3 ---
 include/configs/cei-tk1-som.h | 3 ---
 include/configs/colibri_t20.h | 4 
 include/configs/colibri_t30.h | 3 ---
 include/configs/dalmore.h | 3 ---
 include/configs/e2220-1170.h  | 3 ---
 include/configs/harmony.h | 3 ---
 include/configs/jetson-tk1.h  | 3 ---
 include/configs/medcom-wide.h | 3 ---
 include/configs/nyan-big.h| 3 ---
 include/configs/p2371-.h  | 3 ---
 include/configs/p2371-2180.h  | 3 ---
 include/configs/p2571.h   | 3 ---
 include/configs/paz00.h   | 3 ---
 include/configs/plutux.h  | 3 ---
 include/configs/seaboard.h| 3 ---
 include/configs/tec-ng.h  | 3 ---
 include/configs/tec.h | 3 ---
 include/configs/trimslice.h   | 3 ---
 include/configs/venice2.h | 3 ---
 include/configs/ventana.h | 3 ---
 scripts/config_whitelist.txt  | 1 -
 50 files changed, 30 insertions(+), 74 deletions(-)

diff --git a/configs/apalis-tk1_defconfig b/configs/apalis-tk1_defconfig
index ca5ded8e946..10eb006ce58 100644
--- a/configs/apalis-tk1_defconfig
+++ b/configs/apalis-tk1_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index 05b1a57ff26..ac2fbc75ce7 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -39,6 +39,7 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/beaver_defconfig b/configs/beaver_defconfig
index d8513a0b8c8..8bf033ed4a7 100644
--- a/configs/beaver_defconfig
+++ b/configs/beaver_defconfig
@@ -43,6 +43,7 @@ CONFIG_TEGRA20_SLINK=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="NVIDIA"
diff --git a/configs/cardhu_defconfig b/configs/cardhu_defconfig
index 545b3ee8db4..ab0c1d886ba 100644
--- a/configs/cardhu_defconfig
+++ b/configs/cardhu_defconfig
@@ -37,6 +37,7 @@ CONFIG_TEGRA20_SLINK=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
diff --git a/configs/cei-tk1-som_defconfig b/configs/cei-tk1-som_defconfig
index 5ea257e778d..cdb8e643480 100644
--- a/configs/cei-tk1-som_defconfig
+++ b/configs/cei-tk1-som_defconfig
@@ -46,6 +46,7 @@ CONFIG_TEGRA114_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="NVIDIA"
diff --git a/configs/colibri_t20_defconfig b/configs/colibri_t20_defconfig
index 496f4be0238..92d426a9927 100644
--- a/configs/colibri_t20_defconfig
+++ b/configs/colibri_t20_defconfig
@@ -47,6 +47,7 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_ULPI_VIEWPORT=y
 CONFIG_USB_ULPI=y
 CONFIG_USB_STORAGE=y
diff --git a/configs/colibri_t30_defconfig b/configs/colibri_t30_defconfig
index 07f34359d1d..e56157a4ca2 100644
--- a/configs/colibri_t30_defconfig
+++ b/configs/colibri_t30_defconfig
@@ -33,6 +33,7 @@ CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TEGRA=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Toradex"
diff --git a/configs/dalmore_defconfig b/configs/dalmore_defconfig
index f07dc020786..43bb6c3f616 100644
--- a/configs/dalmore_defconfig
+++

[U-Boot] [PATCH 6/6] nyan-big: drop CONFIG_KEYBOARD

2018-09-16 Thread Peter Robinson
The CONFIG_KEYBOARD does nothing as it's legacy and unused
so just drop it from the config.

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
Cc: Allen Martin 
---
 include/configs/nyan-big.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/configs/nyan-big.h b/include/configs/nyan-big.h
index 3d43839e413..933f84028f4 100644
--- a/include/configs/nyan-big.h
+++ b/include/configs/nyan-big.h
@@ -31,8 +31,6 @@
 #define CONFIG_SF_DEFAULT_SPEED2400
 #define CONFIG_SPI_FLASH_SIZE  (4 << 20)
 
-#define CONFIG_KEYBOARD
-
 #undef CONFIG_LOADADDR
 #define CONFIG_LOADADDR0x82408000
 
-- 
2.19.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/6] Kconfig: tegra: Migrate TEGRA_KEYBOARD

2018-09-16 Thread Peter Robinson
Migrate TEGRA_KEYBOARD from headers to Kconfig, only the seaboard uses it but we
drop CONFIG_KEYBOARD as the driver doesn't use the legacy drv_keyboard_init.

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
---
 configs/seaboard_defconfig   | 1 +
 drivers/input/Kconfig| 6 ++
 include/configs/seaboard.h   | 4 
 scripts/config_whitelist.txt | 1 -
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/configs/seaboard_defconfig b/configs/seaboard_defconfig
index 917ddcce3f3..f9638e6016d 100644
--- a/configs/seaboard_defconfig
+++ b/configs/seaboard_defconfig
@@ -23,6 +23,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_DEFAULT_DEVICE_TREE="tegra20-seaboard"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_I2C_TEGRA=y
+CONFIG_TEGRA_KEYBOARD=y
 CONFIG_SPL_DM=y
 CONFIG_DM_PMIC=y
 CONFIG_DM_REGULATOR=y
diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig
index 7ffb949f12d..a1353848c22 100644
--- a/drivers/input/Kconfig
+++ b/drivers/input/Kconfig
@@ -25,6 +25,12 @@ config I8042_KEYB
  variable 'keymap' to "de" to select German. Keyboard repeat is
  handled by the keyboard itself.
 
+config TEGRA_KEYBOARD
+   bool "NVIDIA Tegra internal matrix keyboard controller support"
+   help
+ A matrix keyboard connected directly to the internal keyboard
+ controller on Tegra SoCs.
+
 config TWL4030_INPUT
bool "Enable TWL4030 Input controller"
help
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index c5fa9cc4208..5df013b0b32 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -31,10 +31,6 @@
 #define CONFIG_SYS_MMC_ENV_DEV 0
 #define CONFIG_SYS_MMC_ENV_PART 2
 
-/* Enable keyboard */
-#define CONFIG_TEGRA_KEYBOARD
-#define CONFIG_KEYBOARD
-
 /* NAND support */
 #define CONFIG_TEGRA_NAND
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 5813e884e2f..3dc14a2dd92 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -4436,7 +4436,6 @@ CONFIG_TEGRA_ENABLE_UARTC
 CONFIG_TEGRA_ENABLE_UARTD
 CONFIG_TEGRA_ENABLE_UARTE
 CONFIG_TEGRA_GPU
-CONFIG_TEGRA_KEYBOARD
 CONFIG_TEGRA_LP0
 CONFIG_TEGRA_NAND
 CONFIG_TEGRA_PMU
-- 
2.19.0

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/6] tegra: cleanup dangling comments in include/configs

2018-09-16 Thread Peter Robinson
There's a number of dangling comments in various tegra configs post migrations
of various configs so lets clean them up.

Signed-off-by: Peter Robinson 
Cc: Tom Warren 
Cc: Stephen Warren 
Cc: Marcel Ziswiler 
Cc: Tom Warren 
Cc: Stephen Warren 
Cc: peter.ch...@data61.csiro.au
Cc: Lucas Stach 
Cc: Stefan Agner 
Cc: Alban Bedel 
Cc: Allen Martin 
---
 include/configs/apalis-tk1.h  | 2 --
 include/configs/apalis_t30.h  | 4 
 include/configs/beaver.h  | 6 --
 include/configs/cardhu.h  | 6 --
 include/configs/cei-tk1-som.h | 6 --
 include/configs/colibri_t20.h | 6 --
 include/configs/colibri_t30.h | 2 --
 include/configs/dalmore.h | 4 
 include/configs/e2220-1170.h  | 4 
 include/configs/harmony.h | 4 
 include/configs/jetson-tk1.h  | 6 --
 include/configs/medcom-wide.h | 2 --
 include/configs/nyan-big.h| 4 
 include/configs/p2371-.h  | 4 
 include/configs/p2371-2180.h  | 6 --
 include/configs/p2571.h   | 4 
 include/configs/p2771-.h  | 2 --
 include/configs/paz00.h   | 2 --
 include/configs/plutux.h  | 4 
 include/configs/seaboard.h| 2 --
 include/configs/tec-ng.h  | 4 
 include/configs/tec.h | 2 --
 include/configs/tegra-common.h| 6 --
 include/configs/tegra210-common.h | 4 
 include/configs/tegra30-common.h  | 4 
 include/configs/trimslice.h   | 6 --
 include/configs/venice2.h | 4 
 include/configs/ventana.h | 2 --
 28 files changed, 112 deletions(-)

diff --git a/include/configs/apalis-tk1.h b/include/configs/apalis-tk1.h
index 667d0846118..506a9e4f2fe 100644
--- a/include/configs/apalis-tk1.h
+++ b/include/configs/apalis-tk1.h
@@ -14,8 +14,6 @@
 
 #define CONFIG_ARCH_MISC_INIT
 
-/* High-level configuration options */
-
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
diff --git a/include/configs/apalis_t30.h b/include/configs/apalis_t30.h
index 646086a9566..ac012225a77 100644
--- a/include/configs/apalis_t30.h
+++ b/include/configs/apalis_t30.h
@@ -12,8 +12,6 @@
 
 #include "tegra30-common.h"
 
-/* High-level configuration options */
-
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
@@ -32,8 +30,6 @@
 /* USB host support */
 #define CONFIG_USB_EHCI_TEGRA
 
-/* PCI host support */
-
 /* PCI networking support */
 #define CONFIG_E1000_NO_NVM
 
diff --git a/include/configs/beaver.h b/include/configs/beaver.h
index 73629ddeb00..8ea583ddfc4 100644
--- a/include/configs/beaver.h
+++ b/include/configs/beaver.h
@@ -39,12 +39,6 @@
 /* USB Host support */
 #define CONFIG_USB_EHCI_TEGRA
 
-/* USB networking support */
-
-/* PCI host support */
-
-/* General networking support */
-
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
index dcb66a6f9a3..2ad93204443 100644
--- a/include/configs/cardhu.h
+++ b/include/configs/cardhu.h
@@ -43,12 +43,6 @@
 /* USB Host support */
 #define CONFIG_USB_EHCI_TEGRA
 
-/* USB networking support */
-
-/* PCI host support */
-
-/* General networking support */
-
 #include "tegra-common-post.h"
 
 #endif /* __CONFIG_H */
diff --git a/include/configs/cei-tk1-som.h b/include/configs/cei-tk1-som.h
index 14008440dae..b595c482632 100644
--- a/include/configs/cei-tk1-som.h
+++ b/include/configs/cei-tk1-som.h
@@ -38,12 +38,6 @@
 /* USB Host support */
 #define CONFIG_USB_EHCI_TEGRA
 
-/* USB networking support */
-
-/* PCI host support */
-
-/* General networking support */
-
 #include "tegra-common-usb-gadget.h"
 #include "tegra-common-post.h"
 
diff --git a/include/configs/colibri_t20.h b/include/configs/colibri_t20.h
index 4a18c72a533..c34d6d055c3 100644
--- a/include/configs/colibri_t20.h
+++ b/include/configs/colibri_t20.h
@@ -10,8 +10,6 @@
 
 #include "tegra20-common.h"
 
-/* High-level configuration options */
-
 /* Board-specific serial config */
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_TEGRA_UARTA_SDIO1
@@ -26,8 +24,6 @@
 #define CONFIG_USB_EHCI_TEGRA
 #define CONFIG_USB_MAX_CONTROLLER_COUNT3
 
-/* USB networking support */
-
 /* General networking support */
 #define CONFIG_IP_DEFRAG
 #define CONFIG_TFTP_BLOCKSIZE  1536
@@ -40,8 +36,6 @@
 #define CONFIG_TEGRA_NAND
 #define CONFIG_SYS_MAX_NAND_DEVICE 1
 
-/* Dynamic MTD partition support */
-
 /* Environment in NAND, 64K is a bit excessive but erase block is 512K anyway 
*/
 #define CONFIG_ENV_OFFSET  (SZ_2M)
 #undef CONFIG_ENV_SIZE /* undef size from tegra20-common.h */
diff --git a/include/configs/colibri_t30.h b/include/configs/colibri_t30.h
index 908b3bde3e0..6b1a831da9a 100644
--- a/include/configs/colibri_t30.h
+++ b/include/configs/colibri_t30.h
@@ -32,8 +32,6 @@
 /* 

[U-Boot] Some tegra cleanups and Kconfig migrations

2018-09-16 Thread Peter Robinson
The following patches are a few cleanups to dangling comments from Kconfig
cleanups and migrations of SYS_I2C_TEGRA, USB_EHCI_TEGRA and TEGRA_KEYBOARD.
There's also a couple of other minors fixes and cleanups as well.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 00/15] riscv: Add QEMU virt board support

2018-09-16 Thread Bin Meng
Hi Rick,

On Tue, Sep 11, 2018 at 12:50 PM Bin Meng  wrote:
>
> This series adds QEMU RISC-V 'virt' board target support, with the
> hope of helping people easily test U-Boot on RISC-V.
>
> Some existing RISC-V codes have been changed to make it easily to
> support new targets. Some spotted coding style issues are fixed.
>
> This series is available at u-boot-x86/riscv-working for testing.
>
> Resend v2 to rebase on top of v2018.09 release with Tom's tree on
> github, as the git.denx.de is still out of sync ...
>
> Changes in v2:
> - Change Linux kernel entry parameters' type to support 32/64 bit
> - new patch to remove CSR read/write defines in encoding.h
> - new patch to pass mhartid CSR value to kernel
> - new patch to move do_reset() to a common place

Any comments for the v2?

Regards,
Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot