Skip to content

Commit

Permalink
Merge tag 'xtensa-20210429' of git://github.com/jcmvbkbc/linux-xtensa
Browse files Browse the repository at this point in the history
Pull Xtensa updates from Max Filippov:

 - switch to generic syscall generation scripts

 - new GDBIO implementation for xtensa semihosting interface

 - various small code fixes and cleanups

 - a few typo fixes in comments and Kconfig help text

* tag 'xtensa-20210429' of git://github.com/jcmvbkbc/linux-xtensa:
  xtensa: ISS: add GDBIO implementation to semihosting interface
  xtensa: ISS: split simcall implementation from semihosting interface
  xtensa: simcall.h: Change compitible to compatible
  xtensa: Couple of typo fixes
  xtensa: drop extraneous register load from initialize_mmu
  xtensa: fix pgprot_noncached assumptions
  xtensa: simplify coherent_kvaddr logic
  xtensa: syscalls: switch to generic syscallhdr.sh
  xtensa: syscalls: switch to generic syscalltbl.sh
  xtensa: stop filling syscall array with sys_ni_syscall
  xtensa: remove unneeded export in boot-elf/Makefile
  xtensa: move CONFIG_CPU_*_ENDIAN defines to Kconfig
  xtensa: fix warning comparing pointer to 0
  xtensa: fix spelling mistake in Kconfig "wont" -> "won't"
  • Loading branch information
torvalds committed Apr 30, 2021
2 parents 8ca5297 + 6a8eb99 commit 437d1a5
Show file tree
Hide file tree
Showing 18 changed files with 198 additions and 220 deletions.
30 changes: 29 additions & 1 deletion arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ config KASAN_SHADOW_OFFSET
hex
default 0x6e400000

config CPU_BIG_ENDIAN
def_bool $(success,test "$(shell,echo __XTENSA_EB__ | $(CC) -E -P -)" = 1)

config CPU_LITTLE_ENDIAN
def_bool !CPU_BIG_ENDIAN

menu "Processor type and features"

choice
Expand Down Expand Up @@ -387,6 +393,28 @@ config PARSE_BOOTPARAM

If unsure, say Y.

choice
prompt "Semihosting interface"
default XTENSA_SIMCALL_ISS
depends on XTENSA_PLATFORM_ISS
help
Choose semihosting interface that will be used for serial port,
block device and networking.

config XTENSA_SIMCALL_ISS
bool "simcall"
help
Use simcall instruction. simcall is only available on simulators,
it does nothing on hardware.

config XTENSA_SIMCALL_GDBIO
bool "GDBIO"
help
Use break instruction. It is available on real hardware when GDB
is attached to it via JTAG.

endchoice

config BLK_DEV_SIMDISK
tristate "Host file-based simulated block device support"
default n
Expand Down Expand Up @@ -466,7 +494,7 @@ config INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
then enter your normal kernel breakpoints once the MMU was mapped
to the kernel mappings (0XC0000000).

This unfortunately won't work for U-Boot and likely also wont
This unfortunately won't work for U-Boot and likely also won't
work for using KEXEC to have a hot kernel ready for doing a
KDUMP.

Expand Down
9 changes: 1 addition & 8 deletions arch/xtensa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ ifneq ($(CONFIG_LD_NO_RELAX),)
KBUILD_LDFLAGS := --no-relax
endif

ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EB__
KBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
endif
ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
CHECKFLAGS += -D__XTENSA_EL__
KBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
endif
CHECKFLAGS += -D$(if $(CONFIG_CPU_BIG_ENDIAN),__XTENSA_EB__,__XTENSA_EL__)

vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
Expand Down
4 changes: 0 additions & 4 deletions arch/xtensa/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
KBUILD_CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS += -Iarch/$(ARCH)/boot/include

BIG_ENDIAN := $(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#")

export BIG_ENDIAN

subdir-y := lib
targets += vmlinux.bin vmlinux.bin.gz
targets += uImage xipImage
Expand Down
11 changes: 3 additions & 8 deletions arch/xtensa/boot/boot-elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,10 @@
# for more details.
#

ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
OBJCOPY_ARGS := -O elf32-xtensa-le
endif
OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)

export OBJCOPY_ARGS
export CPPFLAGS_boot.lds += -P -C
export KBUILD_AFLAGS += -mtext-section-literals
CPPFLAGS_boot.lds += -P -C
KBUILD_AFLAGS += -mtext-section-literals

boot-y := bootstrap.o
targets += $(boot-y) boot.lds
Expand Down
6 changes: 1 addition & 5 deletions arch/xtensa/boot/boot-redboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
# for more details.
#

ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
OBJCOPY_ARGS := -O elf32-xtensa-le
endif
OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)

LD_ARGS = -T $(srctree)/$(obj)/boot.ld

Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/include/asm/initialize_mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
_j 2f

.align 4
1: movi a2, 0x10000000
1:

#if CONFIG_KERNEL_LOAD_ADDRESS < 0x40000000ul
#define TEMP_MAPPING_VADDR 0x40000000
Expand Down
4 changes: 3 additions & 1 deletion arch/xtensa/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ static inline pte_t pte_mkyoung(pte_t pte)
static inline pte_t pte_mkwrite(pte_t pte)
{ pte_val(pte) |= _PAGE_WRITABLE; return pte; }

#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK))
#define pgprot_noncached(prot) \
((__pgprot((pgprot_val(prot) & ~_PAGE_CA_MASK) | \
_PAGE_CA_BYPASS)))

/*
* Conversion functions: convert a page and protection to a page entry,
Expand Down
4 changes: 2 additions & 2 deletions arch/xtensa/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ ENTRY(_startup)
*
* The linker script used to build the Linux kernel image
* creates a table located at __boot_reloc_table_start
* that contans the information what data needs to be unpacked.
* that contains the information what data needs to be unpacked.
*
* Uses a2-a7.
*/
Expand All @@ -222,7 +222,7 @@ ENTRY(_startup)

1: beq a2, a3, 3f # no more entries?
l32i a4, a2, 0 # start destination (in RAM)
l32i a5, a2, 4 # end desination (in RAM)
l32i a5, a2, 4 # end destination (in RAM)
l32i a6, a2, 8 # start source (in ROM)
addi a2, a2, 12 # next entry
beq a4, a5, 1b # skip, empty entry
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma)
struct pci_controller *pci_ctrl = (struct pci_controller*) pdev->sysdata;
resource_size_t ioaddr = pci_resource_start(pdev, bar);

if (pci_ctrl == 0)
if (!pci_ctrl)
return -EINVAL; /* should never happen */

/* Convert to an offset within this PCI controller */
Expand Down
8 changes: 2 additions & 6 deletions arch/xtensa/kernel/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
#include <linux/uaccess.h>
#include <asm/syscall.h>
#include <asm/unistd.h>
#include <linux/linkage.h>
#include <linux/stringify.h>
#include <linux/errno.h>
Expand All @@ -28,12 +27,9 @@
#include <linux/sched/mm.h>
#include <linux/shm.h>

syscall_t sys_call_table[__NR_syscalls] /* FIXME __cacheline_aligned */= {
[0 ... __NR_syscalls - 1] = (syscall_t)&sys_ni_syscall,

#define __SYSCALL(nr, entry, nargs)[nr] = (syscall_t)entry,
syscall_t sys_call_table[] /* FIXME __cacheline_aligned */= {
#define __SYSCALL(nr, entry) (syscall_t)entry,
#include <asm/syscall_table.h>
#undef __SYSCALL
};

#define COLOUR_ALIGN(addr, pgoff) \
Expand Down
14 changes: 4 additions & 10 deletions arch/xtensa/kernel/syscalls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,14 @@ _dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
$(shell [ -d '$(kapi)' ] || mkdir -p '$(kapi)')

syscall := $(src)/syscall.tbl
syshdr := $(srctree)/$(src)/syscallhdr.sh
systbl := $(srctree)/$(src)/syscalltbl.sh
syshdr := $(srctree)/scripts/syscallhdr.sh
systbl := $(srctree)/scripts/syscalltbl.sh

quiet_cmd_syshdr = SYSHDR $@
cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@' \
'$(syshdr_abis_$(basetarget))' \
'$(syshdr_pfx_$(basetarget))' \
'$(syshdr_offset_$(basetarget))'
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr $< $@

quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@' \
'$(systbl_abis_$(basetarget))' \
'$(systbl_abi_$(basetarget))' \
'$(systbl_offset_$(basetarget))'
cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@

$(uapi)/unistd_32.h: $(syscall) $(syshdr) FORCE
$(call if_changed,syshdr)
Expand Down
36 changes: 0 additions & 36 deletions arch/xtensa/kernel/syscalls/syscallhdr.sh

This file was deleted.

32 changes: 0 additions & 32 deletions arch/xtensa/kernel/syscalls/syscalltbl.sh

This file was deleted.

9 changes: 2 additions & 7 deletions arch/xtensa/mm/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,8 @@ static inline void kmap_invalidate_coherent(struct page *page,
static inline void *coherent_kvaddr(struct page *page, unsigned long base,
unsigned long vaddr, unsigned long *paddr)
{
if (PageHighMem(page) || !DCACHE_ALIAS_EQ(page_to_phys(page), vaddr)) {
*paddr = page_to_phys(page);
return (void *)(base + (vaddr & DCACHE_ALIAS_MASK));
} else {
*paddr = 0;
return page_to_virt(page);
}
*paddr = page_to_phys(page);
return (void *)(base + (vaddr & DCACHE_ALIAS_MASK));
}

void clear_user_highpage(struct page *page, unsigned long vaddr)
Expand Down
36 changes: 5 additions & 31 deletions arch/xtensa/mm/misc.S
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,13 @@ ENTRY(clear_page_alias)

abi_entry_default

/* Skip setting up a temporary DTLB if not aliased low page. */

movi a5, PAGE_OFFSET
movi a6, 0
beqz a3, 1f

/* Setup a temporary DTLB for the addr. */

addi a6, a3, (PAGE_KERNEL | _PAGE_HW_WRITE)
mov a4, a2
wdtlb a6, a2
dsync

1: movi a3, 0
movi a3, 0
__loopi a2, a7, PAGE_SIZE, 32
s32i a3, a2, 0
s32i a3, a2, 4
Expand All @@ -143,12 +136,9 @@ ENTRY(clear_page_alias)
s32i a3, a2, 28
__endla a2, a7, 32

bnez a6, 1f
abi_ret_default

/* We need to invalidate the temporary idtlb entry, if any. */
/* We need to invalidate the temporary dtlb entry. */

1: idtlb a4
idtlb a4
dsync

abi_ret_default
Expand All @@ -166,22 +156,12 @@ ENTRY(copy_page_alias)

abi_entry_default

/* Skip setting up a temporary DTLB for destination if not aliased. */

movi a6, 0
movi a7, 0
beqz a4, 1f

/* Setup a temporary DTLB for destination. */

addi a6, a4, (PAGE_KERNEL | _PAGE_HW_WRITE)
wdtlb a6, a2
dsync

/* Skip setting up a temporary DTLB for source if not aliased. */

1: beqz a5, 1f

/* Setup a temporary DTLB for source. */

addi a7, a5, PAGE_KERNEL
Expand Down Expand Up @@ -219,17 +199,11 @@ ENTRY(copy_page_alias)

/* We need to invalidate any temporary mapping! */

bnez a6, 1f
bnez a7, 2f
abi_ret_default

1: addi a2, a2, -PAGE_SIZE
addi a2, a2, -PAGE_SIZE
idtlb a2
dsync
bnez a7, 2f
abi_ret_default

2: addi a3, a3, -PAGE_SIZE+1
addi a3, a3, -PAGE_SIZE+1
idtlb a3
dsync

Expand Down
Loading

0 comments on commit 437d1a5

Please sign in to comment.