[PATCH] MIPS: use more consistent type for memory size values

2024-06-23 Thread Denis Orlov
-off-by: Denis Orlov --- arch/mips/boot/uncompress.c | 6 +++--- arch/mips/lib/reloc.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/boot/uncompress.c b/arch/mips/boot/uncompress.c index 9344679a6b..0630d03c6b 100644 --- a/arch/mips/boot/uncompress.c +++ b

[PATCH 2/3] mips: cpu-probe: identify more MIPS CPUs

2024-03-28 Thread Denis Orlov
This adds support for identifying more CPUs emulatable by QEMU, so that their names are shown when using 'cpuinfo' command. Signed-off-by: Denis Orlov --- arch/mips/include/asm/cpu.h | 30 +++ arch/mips/lib/cpu-probe.c | 59 - 2 files

[PATCH 3/3] mips: mipsregs: remove duplicate definitions for Config 1 bits

2024-03-28 Thread Denis Orlov
Also reorder some of them to be more uniform. Signed-off-by: Denis Orlov --- arch/mips/include/asm/mipsregs.h | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index 9e7d656542..0b618320ff 100644

[PATCH 1/3] mips: cpuinfo: fix cpu name output for unknown processors

2024-03-28 Thread Denis Orlov
Otherwise it would output as __cpu_name global variable ends up being a null pointer. Signed-off-by: Denis Orlov --- arch/mips/lib/cpu-probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/lib/cpu-probe.c b/arch/mips/lib/cpu-probe.c index cbde43a595..47c9c671eb

[PATCH 0/3] mips: small improvements

2024-03-28 Thread Denis Orlov
Denis Orlov (3): mips: cpuinfo: fix cpu name output for unknown processors mips: cpu-probe: identify more MIPS CPUs mips: mipsregs: remove duplicate definitions for Config 1 bits arch/mips/include/asm/cpu.h | 30 +--- arch/mips/include/asm/mipsregs.h | 12 +++ arch

[PATCH] clk: fix clk_set_rate command help text

2024-03-20 Thread Denis Orlov
It was at odds with the list of options, with the former mentioning RATE and the latter mentioning HZ as a parameter. It seems that every other clk-related command uses HZ, so use it here too. Signed-off-by: Denis Orlov --- commands/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH 2/2] ddr_spd: add routine for printing DDR3 SPD contents

2024-03-11 Thread Denis Orlov
as a hexadecimal value instead of a decoded string. The logic is mostly the same too, but some changes in how calculations are made were required so as not to use floating point arithmetic. Signed-off-by: Denis Orlov --- common/ddr_spd.c | 556 ++- 1

[PATCH 0/2] ddr_spd: extend spd_decode to cover DDR3

2024-03-11 Thread Denis Orlov
This extends the spd_decode command to correctly print out the contents of the DDR3 SPD EEPROMs in addition to the DDR2 ones. Denis Orlov (2): ddr_spd: add DDR3 Load Reduced module specific data ddr_spd: add routine for printing DDR3 SPD contents common/ddr_spd.c | 556

[PATCH 1/2] ddr_spd: add DDR3 Load Reduced module specific data

2024-03-11 Thread Denis Orlov
This will be used by the DDR3 SPD data printing routine and is needed for completeness, to cover all of the DDR3-related cases from the original decode-dimms tool. Signed-off-by: Denis Orlov --- include/ddr_spd.h | 34 ++ 1 file changed, 34 insertions(+) diff

[PATCH 04/21] MIPS: barebox.lds: remove extra whitespace

2023-07-24 Thread Denis Orlov
Signed-off-by: Denis Orlov --- arch/mips/lib/barebox.lds.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S index 1259a4e94f..0720f9295d 100644 --- a/arch/mips/lib/barebox.lds.S +++ b/arch/mips/lib/barebox.lds.S @@ -3,7 +3,6

[PATCH 19/21] MIPS: c-r4k: do flush secondary cache

2023-07-24 Thread Denis Orlov
and calls to them. This will make it easier to add support for boards that do happen to have secondary caches. Signed-off-by: Denis Orlov --- arch/mips/include/asm/cacheops.h | 5 + arch/mips/lib/c-r4k.c| 12 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git

[PATCH 20/21] MIPS: c-r4k: remove extra function declaration

2023-07-24 Thread Denis Orlov
'r4k_cache_init()' is already declared in the appropriate 'asm/cache.h' header. Signed-off-by: Denis Orlov --- arch/mips/lib/c-r4k.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/mips/lib/c-r4k.c b/arch/mips/lib/c-r4k.c index 2fb4e90138..44cf57d99b 100644 --- a/arch/mips/lib/c-r4k.c

[PATCH 17/21] MIPS: c-r4k: prettify code in __BUILD_BLAST_CACHE_RANGE

2023-07-24 Thread Denis Orlov
Even though the original code was taken from Linux, it is quite old and crufty. Replace the 'while (1)' loop with the 'for' one, use const for constant variables and use ALIGN_DOWN macro instead of repeating its code. Signed-off-by: Denis Orlov --- arch/mips/lib/c-r4k.c | 13 + 1

[PATCH 21/21] MIPS: reloc: use IS_ALIGNED macro to check for an alignment

2023-07-24 Thread Denis Orlov
Improves the code readability a tiny little bit. Signed-off-by: Denis Orlov --- arch/mips/lib/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c index 83b4040d95..a9078aa813 100644 --- a/arch/mips/lib/reloc.c +++ b/arch/mips

[PATCH 16/21] MIPS: main_entry: remove exception vector array

2023-07-24 Thread Denis Orlov
to copy now consists of just two instructions. However it feels more safe to calculate that in code instead, so that we don't have to update this value if some code is added there in the future. Signed-off-by: Denis Orlov --- arch/mips/boot/main_entry.c | 39

[PATCH 18/21] MIPS: c-r4k: generate blast_*cache functions via macros

2023-07-24 Thread Denis Orlov
This gets us rid of this logic repeated in 'flush_cache_all()' for each cache and allows to use blast_*cache funcs elsewhere if such a need arises. Signed-off-by: Denis Orlov --- arch/mips/lib/c-r4k.c | 41 - 1 file changed, 24 insertions(+), 17 deletions

[PATCH 01/21] MIPS: addrspace: rectify ksseg segment naming

2023-07-24 Thread Denis Orlov
-by: Denis Orlov --- arch/mips/include/asm/addrspace.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h index 11f10e5011..7a2006a8d1 100644 --- a/arch/mips/include/asm/addrspace.h +++ b/arch/mips

[PATCH 03/21] MIPS: main_entry-pbl: remove unused variable

2023-07-24 Thread Denis Orlov
For some reason we do set 'ttb' global variable, however we never end up using it. Signed-off-by: Denis Orlov --- arch/mips/boot/main_entry-pbl.c | 4 1 file changed, 4 deletions(-) diff --git a/arch/mips/boot/main_entry-pbl.c b/arch/mips/boot/main_entry-pbl.c index f75ec03851..78982fd995

[PATCH 14/21] MIPS: clean up barebox proper entry point

2023-07-24 Thread Denis Orlov
()'. Signed-off-by: Denis Orlov --- arch/mips/boot/start.S | 46 -- arch/mips/boot/start.c | 17 2 files changed, 17 insertions(+), 46 deletions(-) delete mode 100644 arch/mips/boot/start.S create mode 100644 arch/mips/boot/start.c diff

[PATCH 13/21] MIPS: pbl: do enable 64-bit addressing in PBL

2023-07-24 Thread Denis Orlov
It seems more reasonable to do that in PBL code that initializes all the other appropriate CP0 register bits. This also makes a corresponding call in barebox proper entry code redundant, paving the way to its removal. Signed-off-by: Denis Orlov --- arch/mips/include/asm/pbl_macros.h | 1 + 1

[PATCH 15/21] MIPS: main_entry: properly set XTLB handler for 64-bit mode

2023-07-24 Thread Denis Orlov
compatible exception handling scheme (and we even hardcode that), so what are we trying to achieve there anyway? Signed-off-by: Denis Orlov --- arch/mips/boot/main_entry.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot

[PATCH 09/21] MIPS: pbl_macros: use .asciiz instead of .ascii + .byte 0

2023-07-24 Thread Denis Orlov
GAS allows to use '.asciz'/'.asciiz' instead of manually writing '.byte 0' to null-terminate the string specified in '.ascii' directive. Do just that in 'mips_barebox_10h'. The malta-specific entry code currently does the same. Signed-off-by: Denis Orlov --- arch/mips/include/asm/pbl_macros.h

[PATCH 11/21] MIPS: pbl: put mips_barebox_10h into ENTRY_FUNCTION

2023-07-24 Thread Denis Orlov
Remove duplicated macro calls by moving it into a common macro, as is done in ARM code. Some boards were missing this one for no good reason, it seems. Well, now they don't. Signed-off-by: Denis Orlov --- arch/mips/boards/8devices-lima/lowlevel.S | 2 -- arch/mips/boards/dlink-dir-320

[PATCH 10/21] MIPS: malta: remove duplicated barebox magic code

2023-07-24 Thread Denis Orlov
Use 'mips_barebox_10h' macro instead. Remove the comment about the same address being reserved for a Board ID as we don't really do anything about it anyway. Signed-off-by: Denis Orlov --- arch/mips/boards/qemu-malta/lowlevel.S | 11 +-- 1 file changed, 1 insertion(+), 10 deletions

[PATCH 08/21] MIPS: malta: merge GT64120 headers

2023-07-24 Thread Denis Orlov
The various definitions related to GT64120 system controller were split between two headers: 'asm/gt64120.h' and 'mach/mach-gt64120.h'. It seems that they were taken from Linux in this form. No reason to keep it like that though, so unify them into 'mach/gt64120.h'. Signed-off-by: Denis Orlov

[PATCH 12/21] MIPS: pbl: make sure to disable interrupts/watchpoints on entry

2023-07-24 Thread Denis Orlov
of those actions and ensure that it's used in every board's entry code. Signed-off-by: Denis Orlov --- arch/mips/boards/8devices-lima/lowlevel.S | 2 ++ arch/mips/boards/dlink-dir-320/lowlevel.S | 2 +- arch/mips/boards/img-ci20/lowlevel.S | 2 +- arch/mips/boards/loongson-ls1b

[PATCH 06/21] MIPS: cpuinfo: use appropriate format specifiers in printf

2023-07-24 Thread Denis Orlov
Signed-off-by: Denis Orlov --- arch/mips/lib/cpuinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips/lib/cpuinfo.c b/arch/mips/lib/cpuinfo.c index fd27920f9b..41ec7b8d53 100644 --- a/arch/mips/lib/cpuinfo.c +++ b/arch/mips/lib/cpuinfo.c @@ -25,12 +25,12

[PATCH 00/21] MIPS: semi-random code improvements

2023-07-24 Thread Denis Orlov
Denis Orlov (21): MIPS: addrspace: rectify ksseg segment naming MIPS: addrspace: simplify the header MIPS: main_entry-pbl: remove unused variable MIPS: barebox.lds: remove extra whitespace MIPS: reloc: mark relocate_code() as noreturn MIPS: cpuinfo: use appropriate format specifiers

[PATCH 07/21] MIPS: print BadVAddr CP0 register on exception

2023-07-24 Thread Denis Orlov
This register contains the failing address on Address Error and some TLB-related exceptions, and is useful for debugging purposes. Signed-off-by: Denis Orlov --- arch/mips/include/asm/stackframe.h | 4 arch/mips/lib/traps.c | 3 ++- 2 files changed, 6 insertions(+), 1 deletion

[PATCH 02/21] MIPS: addrspace: simplify the header

2023-07-24 Thread Denis Orlov
Deduplicate some of the definitions for 32/64-bit targets and make KSEG* 32-bit defines available for 64-bit builds, as those might still be useful in certain cases. Signed-off-by: Denis Orlov --- arch/mips/include/asm/addrspace.h | 45 ++- 1 file changed, 20

[PATCH 05/21] MIPS: reloc: mark relocate_code() as noreturn

2023-07-24 Thread Denis Orlov
After relocating the code we jump straight to it, with the function having an 'unreachable()' call at the end. So add an appropriate attribute. Signed-off-by: Denis Orlov --- arch/mips/lib/reloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/reloc.c b

Re: [PATCH] nios2: remove arch remains from drivers

2023-06-30 Thread Denis Orlov
On 6/30/23 11:57, Ian Abbott wrote: > On 29/06/2023 21:13, Denis Orlov wrote: >> The architecture was removed back in the commit efccc13513, however some >> drivers that were available exclusively for NIOS2 were left over. As it >> has been impossible to compile those

[PATCH] nios2: remove arch remains from drivers

2023-06-29 Thread Denis Orlov
The architecture was removed back in the commit efccc13513, however some drivers that were available exclusively for NIOS2 were left over. As it has been impossible to compile those since then, it seems reasonable to just get rid of them. Signed-off-by: Denis Orlov --- drivers/serial/Kconfig

[PATCH 2/2] usb: make sure dma buffers are properly allocated

2023-06-29 Thread Denis Orlov
. This is exactly what dma_alloc() is for, so use that for buffers which we are going to map for dma. Signed-off-by: Denis Orlov --- drivers/usb/core/usb.c | 16 --- drivers/usb/storage/transport.c | 74 +++-- drivers/usb/storage/usb.c | 17 3

[PATCH 0/2] usb: small dma allocation fixes

2023-06-29 Thread Denis Orlov
Make sure dma buffers are both properly allocated and freed (they were not in a few places). Denis Orlov (2): usb: storage: fix missing calls to free() usb: make sure dma buffers are properly allocated drivers/usb/core/usb.c | 16 --- drivers/usb/storage/transport.c | 74

[PATCH 1/2] usb: storage: fix missing calls to free()

2023-06-29 Thread Denis Orlov
Memory allocated with xzalloc() was not actually being freed in a few functions, resulting in memory leaks. Signed-off-by: Denis Orlov --- drivers/usb/storage/usb.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/usb/storage/usb.c b/drivers/usb

[PATCH 1/2] virtio: remove VIRTIO_PCI dependance on MMU for MIPS

2023-06-10 Thread Denis Orlov
The issues that broke the usage of VIRTIO_PCI on MIPS when we are running uncached (i.e. with CONFIG_MMU=n) seem to have been fixed. As such, allow this option to be set for those configurations. Signed-off-by: Denis Orlov --- drivers/virtio/Kconfig | 1 - 1 file changed, 1 deletion(-) diff

[PATCH 2/2] MIPS: enable more options in malta defconfigs

2023-06-10 Thread Denis Orlov
This mainly enables virtio stuff, but also turns on EXT4 and GPT support. The latter two simplify things somewhat, allowing to mount appropriate images, and are enabled in generic defconfigs for other archs. Signed-off-by: Denis Orlov --- arch/mips/configs/qemu-malta64el_defconfig | 10

[PATCH 0/2] MIPS: set virtio and other options in malta defconfigs

2023-06-10 Thread Denis Orlov
The issues with VIRTIO_PCI on MIPS seems to have been fixes, so enable this option. And, while at it, also enable a few more for which there is no reason not to have them enabled. Denis Orlov (2): virtio: remove VIRTIO_PCI dependance on MMU for MIPS MIPS: enable more options in malta

Re: [PATCH 2/3] test: mips: add QEMU Malta 64le labgrid config

2023-06-09 Thread Denis Orlov
On Fri, 9 Jun 2023 at 12:28, Ahmad Fatoum wrote: > > On 09.06.23 11:17, Denis Orlov wrote: > > On Fri, 9 Jun 2023 at 10:21, Ahmad Fatoum wrote: > >> > >> On 09.06.23 09:14, Denis Orlov wrote: > >>> Hello Ahmad, > >>>

Re: [PATCH 2/3] test: mips: add QEMU Malta 64le labgrid config

2023-06-09 Thread Denis Orlov
On Fri, 9 Jun 2023 at 10:21, Ahmad Fatoum wrote: > > On 09.06.23 09:14, Denis Orlov wrote: > > Hello Ahmad, > > > > On Fri, 9 Jun 2023 at 09:36, Ahmad Fatoum wrote: > >> > >> On 07.06.23 06:59, Denis Orlov wrote: > >>> Signe

Re: [PATCH 3/3] ci: add a job for testing 64BIT MIPS with labgrid

2023-06-09 Thread Denis Orlov
On Fri, 9 Jun 2023 at 09:38, Ahmad Fatoum wrote: > > On 07.06.23 06:59, Denis Orlov wrote: > > Signed-off-by: Denis Orlov > > https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/ > has a dedicated mips64 toolchain. Given that you don't touch the

Re: [PATCH 2/3] test: mips: add QEMU Malta 64le labgrid config

2023-06-09 Thread Denis Orlov
Hello Ahmad, On Fri, 9 Jun 2023 at 09:36, Ahmad Fatoum wrote: > > On 07.06.23 06:59, Denis Orlov wrote: > > Signed-off-by: Denis Orlov > > --- > > test/mips/qemu-malta64el_defconfig.yaml | 22 ++ > > 1 file changed, 22 insertions(+) > >

[PATCH 2/3] include: bitops: allow BIT* macros to be used in assembly code

2023-06-08 Thread Denis Orlov
Use UL/ULL() macros for those so that corresponding suffixes only appear when we are compiling C code. Hide all the other functions/macros that we can't use in assembly with '#ifndef __ASSEMBLY__'. Signed-off-by: Denis Orlov --- include/linux/bitops.h | 18 -- 1 file changed, 12

[PATCH 3/3] include: bitops: import more BITS_TO_* defines from linux

2023-06-08 Thread Denis Orlov
Those seem quite useful, e.g. when defining bitmasks. Signed-off-by: Denis Orlov --- include/linux/bitops.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index d9a5a81a9c..a5f6ac6545 100644 --- a/include/linux/bitops.h

[PATCH 1/3] include: const: make UL/ULL() macros commonly available

2023-06-08 Thread Denis Orlov
. Signed-off-by: Denis Orlov --- arch/arm/include/asm/memory.h| 5 - arch/arm/include/asm/pgtable64.h | 2 -- arch/kvx/include/asm/sfr_defs.h | 2 -- include/linux/const.h| 10 -- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/arch/arm/include/asm

[PATCH 0/3] include: bitops/const: partial update from Linux

2023-06-08 Thread Denis Orlov
This updates some of the definitions in those files, mainly to make BIT*/GENMASK() macros usable in assembly code. Denis Orlov (3): include: const: make UL/ULL() macros commonly available include: bitops: allow BIT* macros to be used in assembly code include: bitops: import more BITS_TO_

[PATCH 3/3] ci: add a job for testing 64BIT MIPS with labgrid

2023-06-06 Thread Denis Orlov
Signed-off-by: Denis Orlov --- .github/workflows/test-labgrid-pytest.yml | 4 1 file changed, 4 insertions(+) diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml index 2c74150066..674e4251d1 100644 --- a/.github/workflows/test-labgrid

[PATCH 2/3] test: mips: add QEMU Malta 64le labgrid config

2023-06-06 Thread Denis Orlov
Signed-off-by: Denis Orlov --- test/mips/qemu-malta64el_defconfig.yaml | 22 ++ 1 file changed, 22 insertions(+) create mode 100644 test/mips/qemu-malta64el_defconfig.yaml diff --git a/test/mips/qemu-malta64el_defconfig.yaml b/test/mips/qemu-malta64el_defconfig.yaml new

[PATCH 1/3] MIPS: add qemu-malta64el_defconfig

2023-06-06 Thread Denis Orlov
-by: Denis Orlov --- arch/mips/configs/qemu-malta64el_defconfig | 87 ++ 1 file changed, 87 insertions(+) create mode 100644 arch/mips/configs/qemu-malta64el_defconfig diff --git a/arch/mips/configs/qemu-malta64el_defconfig b/arch/mips/configs/qemu-malta64el_defconfig new file

[PATCH 0/3] Add CI for MIPS64

2023-06-06 Thread Denis Orlov
supported, so naming it as that seems more fitting for me. And if more MIPS64 boards will get support in the future, then this defconfig might be renamed appropriately. Denis Orlov (3): MIPS: add qemu-malta64el_defconfig test: mips: add QEMU Malta 64le labgrid config ci: add a job for testing

Re: [PATCH 04/17] MIPS: o32: provide ta0..ta3 register definitions

2023-06-06 Thread Denis Orlov
On Tue, 6 Jun 2023 at 11:13, Ahmad Fatoum wrote: > > On 05.06.23 22:10, Denis Orlov wrote: > > This allows to write generic assembly code that will compile under both > > o32 and n64 ABIs, as otherwise the register definitions would conflict. > > > > Taken from Linu

Re: [PATCH 11/17] MIPS: Makefile: sign-extend TEXT_BASE value on CONFIG_64BIT

2023-06-06 Thread Denis Orlov
On Tue, 6 Jun 2023 at 12:04, Ahmad Fatoum wrote: > > On 05.06.23 22:10, Denis Orlov wrote: > > The code that uses TEXT_BASE will fail on reading truncated 32-bit > > address if running with 64BIT enabled. As we only support running from > > compatibility segments (i.e.

Re: [PATCH 02/17] MIPS: malta: use CKSEG instead of KSEG macros

2023-06-06 Thread Denis Orlov
On Tue, 6 Jun 2023 at 11:03, Ahmad Fatoum wrote: > > On 05.06.23 22:10, Denis Orlov wrote: > > KSEG macro is not available when compiling with CONFIG_64BIT enabled, so > > use CKSEG instead. > > If they're interchangeable, why do we need KSEG? Hmm, I think maybe we don

Re: [PATCH 00/17] MIPS: fix and improve 64BIT support

2023-06-06 Thread Denis Orlov
Hello Ahmad, On Tue, 6 Jun 2023 at 11:02, Ahmad Fatoum wrote: > > Hello Denis, > > On 05.06.23 22:10, Denis Orlov wrote: > > The existing 64BIT support for MIPS was somewhat incomplete with no > > board having MIPS64 CPUs specified to be available as targets. Define >

[PATCH 16/17] MIPS: make setjmp/longjmp/initjmp available in 64BIT builds

2023-06-05 Thread Denis Orlov
Make the code compatible with 64-bit configurations by storing saved register values with unsigned long type and using generic macros in assembly code. Signed-off-by: Denis Orlov --- arch/mips/Kconfig | 2 +- arch/mips/include/asm/setjmp.h | 2 +- arch/mips/lib/setjmp.S

[PATCH 13/17] MIPS: traps: fix passing wrong sp when returning from exception

2023-06-05 Thread Denis Orlov
the stack pointer. Signed-off-by: Denis Orlov --- arch/mips/lib/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/lib/traps.c b/arch/mips/lib/traps.c index ff0a54af8e..45694fe7ef 100644 --- a/arch/mips/lib/traps.c +++ b/arch/mips/lib/traps.c @@ -173,7 +173

[PATCH 15/17] MIPS: add 64-bit support for optimized string functions

2023-06-05 Thread Denis Orlov
at it, this also removes an unused macro define. Signed-off-by: Denis Orlov --- arch/mips/Kconfig | 1 - arch/mips/lib/memcpy.S | 37 - 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index ab8c8cf176..de2f539cc1

[PATCH 14/17] MIPS: pbl_macros: use generic load/store macros in copy_to_link_location

2023-06-05 Thread Denis Orlov
This may speed up this code a little on MIPS64, however this also allows us to get rid of unnecessary macro definition there, simplifying the code a tiny bit. Signed-off-by: Denis Orlov --- arch/mips/include/asm/pbl_macros.h | 21 ++--- 1 file changed, 10 insertions(+), 11

[PATCH 17/17] MIPS: main_entry-pbl: fix conversion warnings on CONFIG_64BIT

2023-06-05 Thread Denis Orlov
Fix "cast from pointer to integer of different size" warnings by casting pointers into unsigned long values when calculating sizes. While at it, simplify code a bit, removing unnecessary variables and instead giving another variable a more comprehensible name. Signed-off-by: D

[PATCH 04/17] MIPS: o32: provide ta0..ta3 register definitions

2023-06-05 Thread Denis Orlov
-by: Denis Orlov --- arch/mips/include/asm/regdef.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/include/asm/regdef.h b/arch/mips/include/asm/regdef.h index 1300251661..df87582e8e 100644 --- a/arch/mips/include/asm/regdef.h +++ b/arch/mips/include/asm/regdef.h @@ -3,6 +3,8

[PATCH 07/17] MIPS: use MIPS32/MIPS64 generic instruction macros

2023-06-05 Thread Denis Orlov
stead" warnings when compiling assembly code with CONFIG_64BIT. Signed-off-by: Denis Orlov --- arch/mips/boot/start.S | 2 +- arch/mips/include/asm/asm.h | 10 +- arch/mips/include/asm/debug_ll_ns16550.h | 6 +++--- arch/mips/include/asm/pbl_macros.h

[PATCH 10/17] MIPS: fix *ADDR macro usage warnings on CONFIG_64BIT

2023-06-05 Thread Denis Orlov
Fixes "warning: cast from pointer to integer of different size" messages. Signed-off-by: Denis Orlov --- arch/mips/include/asm/dma.h | 16 +--- arch/mips/include/asm/io.h | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/arch/mips/include/asm/dm

[PATCH 09/17] MIPS: fix addresses of exception vectors in 64-bit mode

2023-06-05 Thread Denis Orlov
Do not (accidentally?) truncate addresses when setting them in the handler array. Signed-off-by: Denis Orlov --- arch/mips/boot/main_entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/boot/main_entry.c b/arch/mips/boot/main_entry.c index 2c18bc81c3..d061a0e987

[PATCH 12/17] MIPS: enable 64-bit kernel segment addressing on CONFIG_64BIT

2023-06-05 Thread Denis Orlov
boots into 64BIT barebox in QEMU. Signed-off-by: Denis Orlov --- arch/mips/boot/start.S | 2 ++ arch/mips/include/asm/pbl_macros.h | 11 +++ 2 files changed, 13 insertions(+) diff --git a/arch/mips/boot/start.S b/arch/mips/boot/start.S index 5f134f9ae9..30828ad9ef 100644

[PATCH 11/17] MIPS: Makefile: sign-extend TEXT_BASE value on CONFIG_64BIT

2023-06-05 Thread Denis Orlov
The code that uses TEXT_BASE will fail on reading truncated 32-bit address if running with 64BIT enabled. As we only support running from compatibility segments (i.e. no 'proper' 64-bit base addresses), simply make sure the value is sign-extended when passing it as a define. Signed-off-by: Denis

[PATCH 03/17] MIPS: reloc: fix relocation with CONFIG_64BIT enabled

2023-06-05 Thread Denis Orlov
Use CKSEG instead of KSEG, allowing it to compile on 64BIT configurations. Also make sure that we do not truncate target relocation address by writing it into a 32-bit wide variable. Signed-off-by: Denis Orlov --- arch/mips/lib/reloc.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions

[PATCH 05/17] MIPS: pbl: use o32/n64 compatible register definitions

2023-06-05 Thread Denis Orlov
This allows to compile PBL code with n64 ABI, which we use when CONFIG_64BIT is set. Signed-off-by: Denis Orlov --- arch/mips/include/asm/pbl_macros.h | 28 ++-- arch/mips/include/asm/pbl_nmon.h | 10 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff

[PATCH 00/17] MIPS: fix and improve 64BIT support

2023-06-05 Thread Denis Orlov
The existing 64BIT support for MIPS was somewhat incomplete with no board having MIPS64 CPUs specified to be available as targets. Define Malta as supporting those and fix all the compilation and linking errors. Make some optional features available with 64BIT too. Denis Orlov (17): MIPS: malta

[PATCH 02/17] MIPS: malta: use CKSEG instead of KSEG macros

2023-06-05 Thread Denis Orlov
KSEG macro is not available when compiling with CONFIG_64BIT enabled, so use CKSEG instead. Signed-off-by: Denis Orlov --- arch/mips/boards/qemu-malta/lowlevel.S | 4 ++-- arch/mips/mach-malta/pci.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/mips

[PATCH 06/17] MIPS: pbl: fix linking errors with CONFIG_64BIT

2023-06-05 Thread Denis Orlov
For some reasons, object file format was not passed to the linker when linking PBL, leading for a bunch of "ABI is incompatible with that of the selected emulation" errors. Fix it, and also remove duplicate flags being passed when linking barebox proper. Signed-off-by: Denis Orlov ---

[PATCH 08/17] MIPS: malta: fix GT64120 base virtual address on 64BIT

2023-06-05 Thread Denis Orlov
Use CKSEG1ADDR for it to be properly converted to the 64-bit sign-extended address when building with CONFIG_64BIT set. Signed-off-by: Denis Orlov --- arch/mips/mach-malta/include/mach/mach-gt64120.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/mach-malta

[PATCH 01/17] MIPS: malta: allow to choose MIPS64 target CPU in config

2023-06-05 Thread Denis Orlov
QEMU is able to emulate malta machine with a variety of MIPS CPUs, including MIPS64 ones, so allow to compile barebox for such configurations. Signed-off-by: Denis Orlov --- arch/mips/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index

[PATCH 1/2] dma: rework dma_sync_single_for_*() interface

2023-06-04 Thread Denis Orlov
he virtual address argument of those arch-side functions be properly represented with a void* type. Apply the required changes in device drivers that use the affected functions, making them pass the appropriate device pointer. Signed-off-by: Denis Orlov --- arch/arm/cpu/dma_32.c | 17 ++

[PATCH v2 0/2] dma: rework streaming DMA interface

2023-06-04 Thread Denis Orlov
merging two parts of the patch and dropping changes not really related to the matter at hand. Denis Orlov (2): dma: rework dma_sync_single_for_*() interface net: macb: remove const from dev pointer in macb_device arch/arm/cpu/dma_32.c | 17 +++--- arch/arm/cpu/dma_64.c

[PATCH 2/2] net: macb: remove const from dev pointer in macb_device

2023-06-04 Thread Denis Orlov
Otherwise, it leads to a bunch of warnings on passing those pointers to dma_*() functions. As every other driver seem to be having non-const dev pointers in their private structs, do the same here. Signed-off-by: Denis Orlov --- drivers/net/macb.c | 2 +- 1 file changed, 1 insertion(+), 1

[PATCH] net: r8169: fix builds on archs without system.h header

2023-06-04 Thread Denis Orlov
that. Signed-off-by: Denis Orlov --- drivers/net/r8169_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/r8169_main.c b/drivers/net/r8169_main.c index 5b448fa029..2225c26190 100644 --- a/drivers/net/r8169_main.c +++ b/drivers/net/r8169_main.c @@ -17,7 +17,6 @@ #include #include

Re: [PATCH] Revert "dma: use dma/cpu conversions correctly in dma_map/unmap_single"

2023-05-31 Thread Denis Orlov
Hi! > > On 31.05.23 12:23, Sascha Hauer wrote: > > This reverts commit d13d870986eeecc58d8652268557e4a159b9d4c4. > > > > While the patch itself is correct, it at least breaks USB on the > > Raspberry Pi 3b. > > > > With this patch dma_sync_single_for_device() is passed the DMA address. > > This

[PATCH] video: bochs: fix IOMEM usage

2023-05-11 Thread Denis Orlov
of the latter function having __iomem attributes, we should not be remapping them. So, remove those IOMEM calls and instead do explicit remapping in bochs_isa_detect(), which was missing it. Also fix bochs_hw_probe() declaration missing one __iomem. Signed-off-by: Denis Orlov --- drivers/video/bochs

[PATCH] lib: string: remove duplicated function

2023-03-16 Thread Denis Orlov
af3cd13501eb04ca61d017ff4406f1cbffafdc04). Signed-off-by: Denis Orlov --- include/linux/string.h | 3 --- lib/string.c | 48 +++--- 2 files changed, 17 insertions(+), 34 deletions(-) diff --git a/include/linux/string.h b/include/linux/string.h index 0c79d3e5cf

[PATCH] common: elf: use proper field to get segment memory size

2023-03-15 Thread Denis Orlov
', instead of 'p_memsz', to 'request_sdram_region', resulting in potentially smaller amount of memory to be reserved. As 'p_memsz' is always greater or equal to 'p_filesz', use only the former for checking memory requirements in 'request_elf_segment'. Signed-off-by: Denis Orlov --- common/elf.c | 7

[PATCH 2/3] MIPS: bootm: do not leak memory on error in of_overlay_load_firmware()

2023-03-15 Thread Denis Orlov
Signed-off-by: Denis Orlov --- arch/mips/lib/bootm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 95e9dc0d7d..69ce9b3904 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -69,7 +69,7 @@ static int

[PATCH 0/3] MIPS: bootm: tiny fixes in do_bootm_elf()

2023-03-15 Thread Denis Orlov
Denis Orlov (3): MIPS: bootm: do not free fdt pointer that contains an error MIPS: bootm: do not leak memory on error in of_overlay_load_firmware() MIPS: bootm: remove unnecessary phys/virt conversions arch/mips/lib/bootm.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions

[PATCH 3/3] MIPS: bootm: remove unnecessary phys/virt conversions

2023-03-15 Thread Denis Orlov
They are not doing anything there - we should already have proper virtual addresses represented by those pointers. Signed-off-by: Denis Orlov --- arch/mips/lib/bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index

[PATCH 1/3] MIPS: bootm: do not free fdt pointer that contains an error

2023-03-15 Thread Denis Orlov
Also add a proper error message. Signed-off-by: Denis Orlov --- arch/mips/lib/bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 655535737e..95e9dc0d7d 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c

[PATCH 3/3] MIPS: dma-default: do not flush caches in dma_sync_single_* excessively

2023-03-13 Thread Denis Orlov
(). The functional change itself is taken from Linux commit 'MIPS: make dma_sync_*_for_cpu a little less overzealous' (hash: cbf1449ba5aec9cf4c68b69f899391a8d42e9b8f). Signed-off-by: Denis Orlov --- arch/mips/lib/dma-default.c | 36 +--- 1 file changed, 17 insertions

[PATCH 2/3] MIPS: dma-default: use virtual addresses when flushing caches

2023-03-13 Thread Denis Orlov
Cache flushing functions expect virtual addresses, so make sure those are properly converted from the physical ones in dma_sync_single_for_*. QEMU doesn't care as it ignores cache instructions, but without such change this code would result in TLB exceptions on real hardware. Signed-off-by: Denis

[PATCH 1/3] dma: use dma/cpu conversions correctly in dma_map/unmap_single

2023-03-13 Thread Denis Orlov
called directly, and a virtual address treated as one when called from dma_map funcs. Signed-off-by: Denis Orlov --- drivers/dma/map.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/dma/map.c b/drivers/dma/map.c index 114c0f7db3..fea04c38a3 100644

[PATCH 0/3] MIPS: dma-default: fix dma_sync_single_for_*

2023-03-13 Thread Denis Orlov
This fixes a few issues with streaming DMA functions, which should make those work on real hardware. It also improves the code a bit, removing unnecessary cache flushing in some cases. Denis Orlov (3): dma: use dma/cpu conversions correctly in dma_map/unmap_single MIPS: dma-default: use

Re: [RFC 1/2] dma: rework dma_sync_single interface

2023-03-06 Thread Denis Orlov
Hi! On Fri, 3 Mar 2023 at 13:06, Sascha Hauer wrote: > > Hi Denis, > > On Tue, Feb 28, 2023 at 01:32:47PM +0300, Denis Orlov wrote: > > -#ifndef dma_sync_single_for_device > > -static inline void dma_sync_single_for_device(dma_addr_t a

[RFC 2/2] dma: update dma_sync_single uses in drivers

2023-02-28 Thread Denis Orlov
for those. This should not make any functional change, as there is no driver at the moment that requires non 1-to-1 dma mappings, and thus would actually utilize those device pointers. Signed-off-by: Denis Orlov --- arch/arm/mach-bcm283x/mbox.c| 4 ++-- drivers/crypto/caam/caam

[RFC 1/2] dma: rework dma_sync_single interface

2023-02-28 Thread Denis Orlov
t, i.e. we would have to do all dma/cpu conversions in arch-specific code, unlike how it is done in this patch. This would lead to some code duplication though. TODO: dma_alloc/free_coherent do need same kind of changes to utilise cpu/dma conversions properly Signed-off-by: Denis Orlov --- arch/a

[RFC 0/2] dma: clean up streaming DMA API

2023-02-28 Thread Denis Orlov
usage in drivers. Denis Orlov (2): dma: rework dma_sync_single interface dma: update dma_sync_single uses in drivers arch/arm/cpu/mmu-common.c| 9 +-- arch/arm/cpu/mmu.c | 17 +++-- arch/arm/cpu/mmu_64.c| 13 ++-- arch/arm/include/asm/dma.h

[PATCH 0/4] MIPS: dma: random fixes and improvements

2023-02-10 Thread Denis Orlov
Denis Orlov (4): MIPS: dma: fix nullptr handling in dma_free_coherent MIPS: dma: remove unnecessary ifdefs MIPS: dma: add arch-specific dma_alloc() implementation MIPS: dma: simplify source structure arch/mips/include/asm/dma-mapping.h | 40 --- arch/mips/include

[PATCH 1/4] MIPS: dma: fix nullptr handling in dma_free_coherent

2023-02-10 Thread Denis Orlov
it to free(), actually trying to deallocate stuff. Signed-off-by: Denis Orlov --- arch/mips/include/asm/dma-mapping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 8e6ea08168..9f6ec03e3b 100644

[PATCH 4/4] MIPS: dma: simplify source structure

2023-02-10 Thread Denis Orlov
There is no reason to keep code from 'dma-mapping.h' in a separate file, so merge it into 'dma.h'. Signed-off-by: Denis Orlov --- arch/mips/include/asm/dma-mapping.h | 40 - arch/mips/include/asm/dma.h | 31 +- 2 files changed, 30

[PATCH 2/4] MIPS: dma: remove unnecessary ifdefs

2023-02-10 Thread Denis Orlov
We do not support any MIPS CPUs that are not MIPS32/MIPS64, so there is no reason to check for those. Signed-off-by: Denis Orlov --- arch/mips/lib/dma-default.c | 8 1 file changed, 8 deletions(-) diff --git a/arch/mips/lib/dma-default.c b/arch/mips/lib/dma-default.c index fbe627c24c

[PATCH 3/4] MIPS: dma: add arch-specific dma_alloc() implementation

2023-02-10 Thread Denis Orlov
-by: Denis Orlov --- arch/mips/include/asm/dma.h | 12 1 file changed, 12 insertions(+) diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h index e0b4689172..49eeaac1a2 100644 --- a/arch/mips/include/asm/dma.h +++ b/arch/mips/include/asm/dma.h @@ -6,6 +6,18 @@ #ifndef

[PATCH 2/2] dma: use virt/phys conversions when no dma_offset is specified

2023-02-10 Thread Denis Orlov
. Signed-off-by: Denis Orlov --- drivers/dma/map.c | 25 ++--- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/dma/map.c b/drivers/dma/map.c index a00abf6421..13dbf2840f 100644 --- a/drivers/dma/map.c +++ b/drivers/dma/map.c @@ -3,25 +3,20

[PATCH 0/2] make e1000 work on MIPS

2023-02-10 Thread Denis Orlov
With these changes, e1000 driver now works on MIPS Malta in QEMU with the corresponding network controller attached: -netdev user,tftp=/tftpboot,id=net0 -device e1000,netdev=net0 Antony Pavlov (1): net: e1000: properly map dma allocations Denis Orlov (1): dma: use virt/phys conversions

  1   2   >