CVS commit: src/sys/kern
Module Name:src Committed By: ryo Date: Sat Aug 14 21:17:11 UTC 2021 Modified Files: src/sys/kern: kern_clock.c Log Message: fix rumpkernel build failure To generate a diff of this commit: cvs rdiff -u -r1.145 -r1.146 src/sys/kern/kern_clock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_clock.c diff -u src/sys/kern/kern_clock.c:1.145 src/sys/kern/kern_clock.c:1.146 --- src/sys/kern/kern_clock.c:1.145 Sat Aug 14 17:51:20 2021 +++ src/sys/kern/kern_clock.c Sat Aug 14 21:17:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_clock.c,v 1.145 2021/08/14 17:51:20 ryo Exp $ */ +/* $NetBSD: kern_clock.c,v 1.146 2021/08/14 21:17:11 ryo Exp $ */ /*- * Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.145 2021/08/14 17:51:20 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.146 2021/08/14 21:17:11 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_dtrace.h" @@ -457,7 +457,7 @@ statclock(struct clockframe *frame) /* * Kernel statistics are just like addupc_intr, only easier. */ -#ifdef MULTIPROCESSOR +#if defined(MULTIPROCESSOR) && !defined(_RUMPKERNEL) g = curcpu()->ci_gmon; if (g != NULL && profsrc == PROFSRC_CLOCK && g->state == GMON_PROF_ON) {
CVS commit: src
Module Name:src Committed By: ryo Date: Sat Aug 14 17:51:20 UTC 2021 Modified Files: src/common/lib/libc/gmon: mcount.c src/sys/arch/aarch64/include: cpu.h src/sys/arch/alpha/include: cpu.h src/sys/arch/arm/include: cpu.h src/sys/arch/hppa/include: cpu.h src/sys/arch/mips/include: cpu.h src/sys/arch/or1k/include: cpu.h src/sys/arch/powerpc/include: cpu.h src/sys/arch/riscv/include: cpu.h src/sys/arch/sparc/include: cpu.h src/sys/arch/sparc64/include: cpu.h src/sys/arch/vax/include: cpu.h src/sys/arch/x86/include: cpu.h src/sys/kern: kern_clock.c subr_prof.c src/sys/sys: gmon.h src/usr.sbin/kgmon: kgmon.8 kgmon.c Log Message: Improved the performance of kernel profiling on MULTIPROCESSOR, and possible to get profiling data for each CPU. In the current implementation, locks are acquired at the entrance of the mcount internal function, so the higher the number of cores, the more lock conflict occurs, making profiling performance in a MULTIPROCESSOR environment unusable and slow. Profiling buffers has been changed to be reserved for each CPU, improving profiling performance in MP by several to several dozen times. - Eliminated cpu_simple_lock in mcount internal function, using per-CPU buffers. - Add ci_gmon member to struct cpu_info of each MP arch. - Add kern.profiling.percpu node in sysctl tree. - Add new -c option to kgmon(8) to specify the cpuid, like openbsd. For compatibility, if the -c option is not specified, the entire system can be operated as before, and the -p option will get the total profiling data for all CPUs. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/gmon/mcount.c cvs rdiff -u -r1.37 -r1.38 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.103 -r1.104 src/sys/arch/alpha/include/cpu.h cvs rdiff -u -r1.118 -r1.119 src/sys/arch/arm/include/cpu.h cvs rdiff -u -r1.10 -r1.11 src/sys/arch/hppa/include/cpu.h cvs rdiff -u -r1.132 -r1.133 src/sys/arch/mips/include/cpu.h cvs rdiff -u -r1.4 -r1.5 src/sys/arch/or1k/include/cpu.h cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/include/cpu.h cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/cpu.h cvs rdiff -u -r1.109 -r1.110 src/sys/arch/sparc/include/cpu.h cvs rdiff -u -r1.132 -r1.133 src/sys/arch/sparc64/include/cpu.h cvs rdiff -u -r1.104 -r1.105 src/sys/arch/vax/include/cpu.h cvs rdiff -u -r1.130 -r1.131 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.144 -r1.145 src/sys/kern/kern_clock.c cvs rdiff -u -r1.49 -r1.50 src/sys/kern/subr_prof.c cvs rdiff -u -r1.10 -r1.11 src/sys/sys/gmon.h cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/kgmon/kgmon.8 cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/kgmon/kgmon.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gmon/mcount.c diff -u src/common/lib/libc/gmon/mcount.c:1.15 src/common/lib/libc/gmon/mcount.c:1.16 --- src/common/lib/libc/gmon/mcount.c:1.15 Sat Aug 14 17:38:44 2021 +++ src/common/lib/libc/gmon/mcount.c Sat Aug 14 17:51:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcount.c,v 1.15 2021/08/14 17:38:44 ryo Exp $ */ +/* $NetBSD: mcount.c,v 1.16 2021/08/14 17:51:18 ryo Exp $ */ /* * Copyright (c) 2003, 2004 Wasabi Systems, Inc. @@ -76,13 +76,14 @@ #if 0 static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: mcount.c,v 1.15 2021/08/14 17:38:44 ryo Exp $"); +__RCSID("$NetBSD: mcount.c,v 1.16 2021/08/14 17:51:18 ryo Exp $"); #endif #endif #include #include #include +#include #ifndef _KERNEL #include "reentrant.h" @@ -94,10 +95,6 @@ extern struct gmonparam _gmondummy; struct gmonparam *_m_gmon_alloc(void); #endif -#if defined(_KERNEL) && !defined(_RUMPKERNEL) && defined(MULTIPROCESSOR) -__cpu_simple_lock_t __mcount_lock; -#endif - #ifndef __LINT__ _MCOUNT_DECL(u_long, u_long) #ifdef _KERNEL @@ -168,8 +165,11 @@ _MCOUNT_DECL(u_long frompc, u_long selfp #if defined(_KERNEL) && !defined(_RUMPKERNEL) MCOUNT_ENTER; #ifdef MULTIPROCESSOR - __cpu_simple_lock(&__mcount_lock); - __insn_barrier(); + p = curcpu()->ci_gmon; + if (p == NULL || p->state != GMON_PROF_ON) { + MCOUNT_EXIT; + return; + } #endif #endif p->state = GMON_PROF_BUSY; @@ -264,10 +264,6 @@ _MCOUNT_DECL(u_long frompc, u_long selfp done: p->state = GMON_PROF_ON; #if defined(_KERNEL) && !defined(_RUMPKERNEL) -#ifdef MULTIPROCESSOR - __insn_barrier(); - __cpu_simple_unlock(&__mcount_lock); -#endif MCOUNT_EXIT; #endif return; @@ -275,10 +271,6 @@ done: overflow: p->state = GMON_PROF_ERROR; #if defined(_KERNEL) && !defined(_RUMPKERNEL) -#ifdef MULTIPROCESSOR - __insn_barrier(); - __cpu_simple_unlock(&__mcount_lock); -#endif MCOUNT_EXIT; #endif return; @@ -293,4 +285,106 @@ overflow: MCOUNT #endif +#if defined(_KERNEL) && !defined(_RUMPKERNEL) && defined(MULTIPROCESSOR) +void
CVS commit: src/common/lib/libc/gmon
Module Name:src Committed By: ryo Date: Sat Aug 14 17:38:44 UTC 2021 Modified Files: src/common/lib/libc/gmon: mcount.c Log Message: don't include "opt_multiprocessor.h" inside an ifdef to work "make depend" properly. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/common/lib/libc/gmon/mcount.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/common/lib/libc/gmon/mcount.c diff -u src/common/lib/libc/gmon/mcount.c:1.14 src/common/lib/libc/gmon/mcount.c:1.15 --- src/common/lib/libc/gmon/mcount.c:1.14 Tue Aug 27 22:48:53 2019 +++ src/common/lib/libc/gmon/mcount.c Sat Aug 14 17:38:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcount.c,v 1.14 2019/08/27 22:48:53 kamil Exp $ */ +/* $NetBSD: mcount.c,v 1.15 2021/08/14 17:38:44 ryo Exp $ */ /* * Copyright (c) 2003, 2004 Wasabi Systems, Inc. @@ -64,19 +64,19 @@ * SUCH DAMAGE. */ -/* If building a standalone libkern, don't include mcount. */ -#if (!defined(_KERNEL) || defined(GPROF)) && !defined(_STANDALONE) - #ifdef _KERNEL_OPT #include "opt_multiprocessor.h" #endif +/* If building a standalone libkern, don't include mcount. */ +#if (!defined(_KERNEL) || defined(GPROF)) && !defined(_STANDALONE) + #include #if !defined(lint) && !defined(_KERNEL) && defined(LIBC_SCCS) #if 0 static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: mcount.c,v 1.14 2019/08/27 22:48:53 kamil Exp $"); +__RCSID("$NetBSD: mcount.c,v 1.15 2021/08/14 17:38:44 ryo Exp $"); #endif #endif
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jun 25 08:41:09 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: fdt "/reserved-memory" node should be handled To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.1 src/sys/dev/fdt/fdt_memory.c:1.2 --- src/sys/dev/fdt/fdt_memory.c:1.1 Sat Dec 12 09:27:31 2020 +++ src/sys/dev/fdt/fdt_memory.c Fri Jun 25 08:41:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $"); #include #include @@ -111,7 +111,7 @@ fdt_memory_remove_reserved(uint64_t min_ { uint64_t lstart = 0, lend = 0; uint64_t addr, size; - int index, error; + int index, error, phandle, child; const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { @@ -139,6 +139,24 @@ fdt_memory_remove_reserved(uint64_t min_ lstart = addr; lend = addr + size; } + + /* + * "no-map" ranges defined in the /reserved-memory node + * must also be excluded. + */ + phandle = OF_finddevice("/reserved-memory"); + if (phandle != -1) { + for (child = OF_child(phandle); child; child = OF_peer(child)) { + if (!of_hasprop(child, "no-map")) +continue; + + if (fdtbus_get_reg(child, 0, , ) != 0) +continue; + if (size == 0) +continue; + fdt_memory_remove_range(addr, size); + } + } } void
CVS commit: src/sys/arch/aarch64/conf
Module Name:src Committed By: ryo Date: Thu May 27 06:19:38 UTC 2021 Modified Files: src/sys/arch/aarch64/conf: Makefile.aarch64 Log Message: In gcc10, -msign-return-address is no longer supported. Instead, (LLVM-compatible) -mbranch-protection option is supported. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/conf/Makefile.aarch64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/conf/Makefile.aarch64 diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.22 src/sys/arch/aarch64/conf/Makefile.aarch64:1.23 --- src/sys/arch/aarch64/conf/Makefile.aarch64:1.22 Wed Feb 10 08:25:01 2021 +++ src/sys/arch/aarch64/conf/Makefile.aarch64 Thu May 27 06:19:38 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.aarch64,v 1.22 2021/02/10 08:25:01 ryo Exp $ +# $NetBSD: Makefile.aarch64,v 1.23 2021/05/27 06:19:38 ryo Exp $ # Makefile for NetBSD # @@ -44,7 +44,6 @@ CFLAGS+= -mno-omit-leaf-frame-pointer CFLAGS+= -fno-optimize-sibling-calls .endif -.if ${HAVE_LLVM:Uno} == "yes" .if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0 CFLAGS+= -mbranch-protection=pac-ret+bti .else @@ -55,16 +54,6 @@ CFLAGS+= -mbranch-protection=pac-ret CFLAGS+= -mbranch-protection=bti .endif .endif -.endif - -.if ${HAVE_GCC:U0} > 0 -.if ${ARMV83_PAC:U0} > 0 -CFLAGS+= -msign-return-address=all -.endif -.if ${ARMV85_BTI:U0} > 0 -# XXX: notyet for gcc -.endif -.endif .if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0 KASANFLAGS= -fsanitize=kernel-address \
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Thu May 27 06:11:20 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: procfs_machdep.c src/sys/arch/aarch64/include: cpufunc.h Log Message: fix build error with options ARMV85_BTI To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/procfs_machdep.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/aarch64/include/cpufunc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/procfs_machdep.c diff -u src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.4 src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.5 --- src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.4 Thu Oct 1 07:31:27 2020 +++ src/sys/arch/aarch64/aarch64/procfs_machdep.c Thu May 27 06:11:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_machdep.c,v 1.4 2020/10/01 07:31:27 skrll Exp $ */ +/* $NetBSD: procfs_machdep.c,v 1.5 2021/05/27 06:11:20 ryo Exp $ */ /*- * Copyright (c) 2020 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.4 2020/10/01 07:31:27 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.5 2021/05/27 06:11:20 ryo Exp $"); #include #include @@ -36,7 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_machd #include #include - +#include /* use variables named 'buf', 'left', 'total' */ #define FORWARD_BUF(_len) \ Index: src/sys/arch/aarch64/include/cpufunc.h diff -u src/sys/arch/aarch64/include/cpufunc.h:1.19 src/sys/arch/aarch64/include/cpufunc.h:1.20 --- src/sys/arch/aarch64/include/cpufunc.h:1.19 Fri Dec 4 08:29:11 2020 +++ src/sys/arch/aarch64/include/cpufunc.h Thu May 27 06:11:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.19 2020/12/04 08:29:11 skrll Exp $ */ +/* $NetBSD: cpufunc.h,v 1.20 2021/05/27 06:11:20 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -63,6 +63,7 @@ extern u_int aarch64_cache_vindexsize; / extern u_int aarch64_cache_prefer_mask; extern u_int cputype; /* compat arm */ +extern int aarch64_bti_enabled; extern int aarch64_pan_enabled; extern int aarch64_pac_enabled;
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: ryo Date: Thu May 20 22:36:09 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c Log Message: fix little-endian dependence To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/dev/pci/ixgbe/ix_txrx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.77 src/sys/dev/pci/ixgbe/ix_txrx.c:1.78 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.77 Thu May 20 10:39:32 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Thu May 20 22:36:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.77 2021/05/20 10:39:32 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.78 2021/05/20 22:36:08 ryo Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1125,7 +1125,7 @@ ixgbe_txeof(struct tx_ring *txr) * or the slot has the DD bit set. */ if (kring->nr_kflags < kring->nkr_num_slots && - txd[kring->nr_kflags].wb.status & IXGBE_TXD_STAT_DD) { + le32toh(txd[kring->nr_kflags].wb.status) & IXGBE_TXD_STAT_DD) { netmap_tx_irq(ifp, txr->me); } return false; @@ -1150,7 +1150,7 @@ ixgbe_txeof(struct tx_ring *txr) if (eop == NULL) /* No work */ break; - if ((eop->wb.status & IXGBE_TXD_STAT_DD) == 0) + if ((le32toh(eop->wb.status) & IXGBE_TXD_STAT_DD) == 0) break; /* I/O not complete */ if (buf->m_head) {
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: ryo Date: Thu May 20 01:02:42 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c Log Message: Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability on aarch64. In ixgbe, TX/RX descriptor rings are configured in 16-byte units. If BUS_DMA_COHERENT is not specified, cpu cache (writeback/invalidate) operations by bus_dmamap_sync() in aarch64 (arm/arm32/bus_dma.c) are done per cache line size (usually 64 bytes). As a result, adjacent descriptors conflict with the DMA operation, resulting in unstable operation. To avoid this, descriptors area should be mapped as non-cache with BUS_DMA_COHERENT. thanks to msaitoh@ for his help in debugging. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/ixgbe/ix_txrx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.75 src/sys/dev/pci/ixgbe/ix_txrx.c:1.76 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.75 Tue May 18 05:29:15 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Thu May 20 01:02:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.75 2021/05/18 05:29:15 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.76 2021/05/20 01:02:42 ryo Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -2208,7 +2208,7 @@ ixgbe_dma_malloc(struct adapter *adapter } r = bus_dmamem_map(dma->dma_tag->dt_dmat, >dma_seg, rsegs, - size, >dma_vaddr, BUS_DMA_NOWAIT); + size, >dma_vaddr, BUS_DMA_NOWAIT | BUS_DMA_COHERENT); if (r != 0) { aprint_error_dev(dev, "%s: bus_dmamem_map failed; error %d\n", __func__, r);
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Wed Apr 21 09:52:21 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: added more attributes of PTE displayed by "ddb>machine pte" To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/arch/aarch64/aarch64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.104 src/sys/arch/aarch64/aarch64/pmap.c:1.105 --- src/sys/arch/aarch64/aarch64/pmap.c:1.104 Sat Apr 17 01:53:58 2021 +++ src/sys/arch/aarch64/aarch64/pmap.c Wed Apr 21 09:52:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.104 2021/04/17 01:53:58 mrg Exp $ */ +/* $NetBSD: pmap.c,v 1.105 2021/04/21 09:52:20 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2021/04/17 01:53:58 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.105 2021/04/21 09:52:20 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -2779,6 +2779,12 @@ pmap_db_pte_print(pt_entry_t pte, int le case LX_BLKPAG_ATTR_DEVICE_MEM: pr(", DEVICE"); break; + case LX_BLKPAG_ATTR_DEVICE_MEM_SO: + pr(", DEVICE(SO)"); + break; + default: + pr(", ATTR(%lu)", __SHIFTOUT(pte, LX_BLKPAG_ATTR_INDX)); + break; } if (pte & LX_BLKPAG_OS_BOOT)
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Fri Apr 16 08:09:40 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: fix typo To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.24 src/sys/dev/pci/if_aq.c:1.25 --- src/sys/dev/pci/if_aq.c:1.24 Fri Apr 16 08:07:02 2021 +++ src/sys/dev/pci/if_aq.c Fri Apr 16 08:09:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.25 2021/04/16 08:09:40 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -1449,11 +1449,11 @@ aq_attach(device_t parent, device_t self ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6; #endif - /* TX hardware checksum offloadding */ + /* TX hardware checksum offloading */ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx; ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv6_Tx; ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv6_Tx; - /* RX hardware checksum offloadding */ + /* RX hardware checksum offloading */ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx; ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx; ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Fri Apr 16 08:07:02 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: when the packet size was just n*MCLBYTES, there was an inconsistency in the length of mbuf. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.23 src/sys/dev/pci/if_aq.c:1.24 --- src/sys/dev/pci/if_aq.c:1.23 Thu Apr 15 09:05:24 2021 +++ src/sys/dev/pci/if_aq.c Fri Apr 16 08:07:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.24 2021/04/16 08:07:02 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -4340,7 +4340,10 @@ aq_rx_intr(void *arg) m->m_len = MCLBYTES; } else { /* last buffer */ - m->m_len = rxd_pktlen % MCLBYTES; + int mlen = rxd_pktlen % MCLBYTES; + if (mlen == 0) +mlen = MCLBYTES; + m->m_len = mlen; m0->m_pkthdr.len = rxd_pktlen; /* VLAN offloading */ if ((sc->sc_ethercom.ec_capenable &
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Apr 15 09:05:24 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: mtu for revision B0 and B1 is supported up to 16338 bytes To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.22 src/sys/dev/pci/if_aq.c:1.23 --- src/sys/dev/pci/if_aq.c:1.22 Thu Apr 15 09:04:42 2021 +++ src/sys/dev/pci/if_aq.c Thu Apr 15 09:05:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.23 2021/04/15 09:05:24 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -116,6 +116,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1. #define AQ_RSS_HASHKEY_SIZE 40 #define AQ_RSS_INDIRECTION_TABLE_MAX 64 +#define AQ_JUMBO_MTU_REV_A 9000 +#define AQ_JUMBO_MTU_REV_B 16338 + /* * TERMINOLOGY * MPI = MAC PHY INTERFACE? @@ -996,6 +999,7 @@ struct aq_softc { #define FEATURES_REV_B0 0x2000 #define FEATURES_REV_B1 0x4000 #define FEATURES_REV_B (FEATURES_REV_B0|FEATURES_REV_B1) + uint32_t sc_max_mtu; uint32_t sc_mbox_addr; bool sc_rbl_enabled; @@ -2118,6 +2122,7 @@ aq_fw_version_init(struct aq_softc *sc) fw_vers); sc->sc_features |= FEATURES_REV_A0 | FEATURES_MPI_AQ | FEATURES_MIPS; + sc->sc_max_mtu = AQ_JUMBO_MTU_REV_A; break; case 0x02: aprint_normal_dev(sc->sc_dev, "Atlantic revision B0, %s\n", @@ -2125,6 +2130,7 @@ aq_fw_version_init(struct aq_softc *sc) sc->sc_features |= FEATURES_REV_B0 | FEATURES_MPI_AQ | FEATURES_MIPS | FEATURES_TPO2 | FEATURES_RPF2; + sc->sc_max_mtu = AQ_JUMBO_MTU_REV_B; break; case 0x0A: aprint_normal_dev(sc->sc_dev, "Atlantic revision B1, %s\n", @@ -2132,10 +2138,13 @@ aq_fw_version_init(struct aq_softc *sc) sc->sc_features |= FEATURES_REV_B1 | FEATURES_MPI_AQ | FEATURES_MIPS | FEATURES_TPO2 | FEATURES_RPF2; + sc->sc_max_mtu = AQ_JUMBO_MTU_REV_B; break; default: aprint_error_dev(sc->sc_dev, "Unknown revision (0x%08x)\n", hwrev); + sc->sc_features = 0; + sc->sc_max_mtu = ETHERMTU; error = ENOTSUP; break; } @@ -4740,7 +4749,19 @@ aq_ioctl(struct ifnet *ifp, unsigned lon error = 0; s = splnet(); - error = ether_ioctl(ifp, cmd, data); + switch (cmd) { + case SIOCSIFMTU: + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > sc->sc_max_mtu) { + error = EINVAL; + } else { + ifp->if_mtu = ifr->ifr_mtu; + error = 0; /* no need to reset (no ENETRESET) */ + } + break; + default: + error = ether_ioctl(ifp, cmd, data); + break; + } splx(s); if (error != ENETRESET)
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Apr 15 09:04:42 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: fixed the problem of instability when changing mtu in IFF_UP state To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.21 src/sys/dev/pci/if_aq.c:1.22 --- src/sys/dev/pci/if_aq.c:1.21 Thu Apr 15 09:04:08 2021 +++ src/sys/dev/pci/if_aq.c Thu Apr 15 09:04:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.22 2021/04/15 09:04:42 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -4487,6 +4487,8 @@ aq_init(struct ifnet *ifp) struct aq_softc *sc = ifp->if_softc; int i, error = 0; + aq_stop(ifp, false); + AQ_LOCK(sc); aq_set_vlan_filters(sc); @@ -4659,6 +4661,9 @@ aq_stop(struct ifnet *ifp, int disable) ifp->if_timer = 0; + if ((ifp->if_flags & IFF_RUNNING) == 0) + goto already_stopped; + /* disable tx/rx interrupts */ aq_enable_intr(sc, true, false); @@ -4679,6 +4684,7 @@ aq_stop(struct ifnet *ifp, int disable) ifp->if_timer = 0; + already_stopped: if (!disable) { /* when pmf stop, disable link status intr and callout */ aq_enable_intr(sc, false, false);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Apr 15 09:04:08 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: add support hardware tcp/udp rx checksum offloading To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.20 src/sys/dev/pci/if_aq.c:1.21 --- src/sys/dev/pci/if_aq.c:1.20 Thu Feb 18 17:56:04 2021 +++ src/sys/dev/pci/if_aq.c Thu Apr 15 09:04:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.21 2021/04/15 09:04:08 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -1445,24 +1445,14 @@ aq_attach(device_t parent, device_t self ifp->if_capabilities |= IFCAP_TSOv4 | IFCAP_TSOv6; #endif -#if notyet - /* - * XXX: - * Rx L4 CSUM doesn't work well for fragment packet. - * aq marks 'CHEDKED' and 'BAD' for them. - * we need to ignore (clear) hw-csum flags if the packet is fragmented - * - * TODO: test with LRO enabled - */ - ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx; - ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx; -#endif /* TX hardware checksum offloadding */ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Tx; ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_TCPv6_Tx; ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_UDPv6_Tx; /* RX hardware checksum offloadding */ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx; + ifp->if_capabilities |= IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv6_Rx; + ifp->if_capabilities |= IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv6_Rx; error = if_initialize(ifp); if (error != 0) { @@ -4365,11 +4355,11 @@ aq_rx_intr(void *arg) m0->m_pkthdr.csum_flags |= M_CSUM_IPv4_BAD; } -#if notyet + /* - * XXX: aq always marks BAD for fragmented packet. - * we should peek L3 header, and ignore cksum flags - * if the packet is fragmented. + * aq will always mark BAD for fragment packets, + * but this is not a problem because the IP stack + * ignores the CSUM flag in fragment packets. */ if (__SHIFTOUT(rxd_type, RXDESC_TYPE_TCPUDP_CSUM_CHECKED)) { @@ -4422,7 +4412,7 @@ aq_rx_intr(void *arg) M_CSUM_TCP_UDP_BAD; } } -#endif + m_set_rcvif(m0, ifp); if_statinc_ref(nsr, if_ipackets); if_statadd_ref(nsr, if_ibytes, m0->m_pkthdr.len);
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Wed Apr 14 05:43:09 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: bus_space.c trap.c Log Message: Fix the problem "pcictl pci0 list" causes "panic: trap_el1h_error" on rockpro64. The panic occures in bus_space_barrier() in rk3399_pcie.c:rkpcie_conf_read(). We expected bus_space_peek_4() to trap and recover in the path trap_el1h_sync() -> data_abort_handler(), but In fact, the read is delayed until bus_space_barrier(), and we get an SError interrupt (trap_el1h_error) instead of a Synchronous Exception (trap_el1h_sync). To catch this correctly, An implicit barrier in bus_space_peek have been added, and trap the SError interrupt to recover from. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/aarch64/bus_space.c cvs rdiff -u -r1.45 -r1.46 src/sys/arch/aarch64/aarch64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/bus_space.c diff -u src/sys/arch/aarch64/aarch64/bus_space.c:1.15 src/sys/arch/aarch64/aarch64/bus_space.c:1.16 --- src/sys/arch/aarch64/aarch64/bus_space.c:1.15 Mon Dec 14 19:32:29 2020 +++ src/sys/arch/aarch64/aarch64/bus_space.c Wed Apr 14 05:43:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_space.c,v 1.15 2020/12/14 19:32:29 skrll Exp $ */ +/* $NetBSD: bus_space.c,v 1.16 2021/04/14 05:43:09 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.15 2020/12/14 19:32:29 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.16 2021/04/14 05:43:09 ryo Exp $"); #include #include @@ -702,6 +702,7 @@ generic_bs_pe_1(void *t, bus_space_handl if ((error = cpu_set_onfault()) == 0) { *datap = generic_dsb_bs_r_1(t, bsh, offset); + dsb(ld); cpu_unset_onfault(); } return error; @@ -716,6 +717,7 @@ generic_bs_pe_2(void *t, bus_space_handl if ((error = cpu_set_onfault()) == 0) { *datap = NSWAP(generic_dsb_bs_r_2)(t, bsh, offset); + dsb(ld); cpu_unset_onfault(); } return error; @@ -730,6 +732,7 @@ generic_bs_pe_4(void *t, bus_space_handl if ((error = cpu_set_onfault()) == 0) { *datap = NSWAP(generic_dsb_bs_r_4)(t, bsh, offset); + dsb(ld); cpu_unset_onfault(); } return error; @@ -744,6 +747,7 @@ generic_bs_pe_8(void *t, bus_space_handl if ((error = cpu_set_onfault()) == 0) { *datap = NSWAP(generic_dsb_bs_r_8)(t, bsh, offset); + dsb(ld); cpu_unset_onfault(); } return error; Index: src/sys/arch/aarch64/aarch64/trap.c diff -u src/sys/arch/aarch64/aarch64/trap.c:1.45 src/sys/arch/aarch64/aarch64/trap.c:1.46 --- src/sys/arch/aarch64/aarch64/trap.c:1.45 Tue Mar 9 16:44:27 2021 +++ src/sys/arch/aarch64/aarch64/trap.c Wed Apr 14 05:43:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.45 2021/03/09 16:44:27 ryo Exp $ */ +/* $NetBSD: trap.c,v 1.46 2021/04/14 05:43:09 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.45 2021/03/09 16:44:27 ryo Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.46 2021/04/14 05:43:09 ryo Exp $"); #include "opt_arm_intr_impl.h" #include "opt_compat_netbsd32.h" @@ -861,6 +861,26 @@ unknown: } } +void +trap_el1h_error(struct trapframe *tf) +{ + /* + * Normally, we should panic unconditionally, + * but SError interrupt may occur when accessing to unmapped(?) I/O + * spaces. bus_space_{peek,poke}_{1,2,4,8}() should trap these case. + */ + struct faultbuf *fb; + + if (curcpu()->ci_intr_depth == 0) { + fb = cpu_disable_onfault(); + if (fb != NULL) { + cpu_jump_onfault(tf, fb, EFAULT); + return; + } + } + panic("%s", __func__); +} + #define bad_trap_panic(trapfunc) \ void \ trapfunc(struct trapframe *tf) \ @@ -872,7 +892,6 @@ bad_trap_panic(trap_el1t_irq) bad_trap_panic(trap_el1t_fiq) bad_trap_panic(trap_el1t_error) bad_trap_panic(trap_el1h_fiq) -bad_trap_panic(trap_el1h_error) bad_trap_panic(trap_el0_fiq) bad_trap_panic(trap_el0_error) bad_trap_panic(trap_el0_32fiq)
CVS commit: src/sys/dev/vmt
Module Name:src Committed By: ryo Date: Sat Mar 27 21:23:15 UTC 2021 Modified Files: src/sys/dev/vmt: vmt_subr.c vmtvar.h Log Message: Removed little endian dependencies. Now vmt(4) works on aarch64eb on vmware ESXIonARM. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/vmt/vmt_subr.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/vmt/vmtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/vmt/vmt_subr.c diff -u src/sys/dev/vmt/vmt_subr.c:1.2 src/sys/dev/vmt/vmt_subr.c:1.3 --- src/sys/dev/vmt/vmt_subr.c:1.2 Tue Nov 17 17:59:31 2020 +++ src/sys/dev/vmt/vmt_subr.c Sat Mar 27 21:23:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt_subr.c,v 1.2 2020/11/17 17:59:31 ryo Exp $ */ +/* $NetBSD: vmt_subr.c,v 1.3 2021/03/27 21:23:14 ryo Exp $ */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ /* @@ -90,12 +90,10 @@ vmt_probe_cmd(struct vm_backdoor *frame, { memset(frame, 0, sizeof(*frame)); - (frame->eax).word = VM_MAGIC; - (frame->ebx).word = ~VM_MAGIC; - (frame->ecx).part.low = cmd; - (frame->ecx).part.high = 0x; - (frame->edx).part.low = VM_PORT_CMD; - (frame->edx).part.high = 0; + frame->eax = VM_MAGIC; + frame->ebx = ~VM_MAGIC & VM_REG_WORD_MASK; + frame->ecx = VM_REG_CMD(0x, cmd); + frame->edx = VM_REG_CMD(0, VM_PORT_CMD); vm_cmd(frame); } @@ -103,26 +101,18 @@ vmt_probe_cmd(struct vm_backdoor *frame, bool vmt_probe(void) { -#if BYTE_ORDER == BIG_ENDIAN - /* - * XXX: doesn't support in big-endian. - * vmt has some code depends on little-endian. - */ - return false; -#else struct vm_backdoor frame; vmt_probe_cmd(, VM_CMD_GET_VERSION); - if (frame.eax.word == 0x || - frame.ebx.word != VM_MAGIC) + if (__SHIFTOUT(frame.eax, VM_REG_WORD_MASK) == 0x || + __SHIFTOUT(frame.ebx, VM_REG_WORD_MASK) != VM_MAGIC) return false; vmt_probe_cmd(, VM_CMD_GET_SPEED); - if (frame.eax.word == VM_MAGIC) + if (__SHIFTOUT(frame.eax, VM_REG_WORD_MASK) == VM_MAGIC) return false; return true; -#endif } void @@ -137,8 +127,8 @@ vmt_common_attach(struct vmt_softc *sc) /* check again */ vmt_probe_cmd(, VM_CMD_GET_VERSION); - if (frame.eax.word == 0x || - frame.ebx.word != VM_MAGIC) { + if (__SHIFTOUT(frame.eax, VM_REG_WORD_MASK) == 0x || + __SHIFTOUT(frame.ebx, VM_REG_WORD_MASK) != VM_MAGIC) { aprint_error_dev(self, "failed to get VMware version\n"); return; } @@ -149,16 +139,17 @@ vmt_common_attach(struct vmt_softc *sc) uint32_t u; vmt_probe_cmd(, VM_CMD_GET_BIOS_UUID); - uuid.time_low = htobe32(frame.eax.word); - u = htobe32(frame.ebx.word); + uuid.time_low = + bswap32(__SHIFTOUT(frame.eax, VM_REG_WORD_MASK)); + u = bswap32(__SHIFTOUT(frame.ebx, VM_REG_WORD_MASK)); uuid.time_mid = u >> 16; uuid.time_hi_and_version = u; - u = htobe32(frame.ecx.word); + u = bswap32(__SHIFTOUT(frame.ecx, VM_REG_WORD_MASK)); uuid.clock_seq_hi_and_reserved = u >> 24; uuid.clock_seq_low = u >> 16; uuid.node[0] = u >> 8; uuid.node[1] = u; - u = htobe32(frame.edx.word); + u = bswap32(__SHIFTOUT(frame.edx, VM_REG_WORD_MASK)); uuid.node[2] = u >> 24; uuid.node[3] = u >> 16; uuid.node[4] = u >> 8; @@ -421,14 +412,16 @@ vmt_sync_guest_clock(struct vmt_softc *s struct timespec ts; memset(, 0, sizeof(frame)); - frame.eax.word = VM_MAGIC; - frame.ecx.part.low = VM_CMD_GET_TIME_FULL; - frame.edx.part.low = VM_PORT_CMD; + frame.eax = VM_MAGIC; + frame.ecx = VM_CMD_GET_TIME_FULL; + frame.edx = VM_REG_CMD(0, VM_PORT_CMD); vm_cmd(); - if (frame.eax.word != 0x) { - ts.tv_sec = ((uint64_t)frame.esi.word << 32) | frame.edx.word; - ts.tv_nsec = frame.ebx.word * 1000; + if (__SHIFTOUT(frame.eax, VM_REG_WORD_MASK) != 0x) { + ts.tv_sec = ((uint64_t)( + __SHIFTOUT(frame.esi, VM_REG_WORD_MASK) << 32)) | + __SHIFTOUT(frame.edx, VM_REG_WORD_MASK); + ts.tv_nsec = __SHIFTOUT(frame.ebx, VM_REG_WORD_MASK) * 1000; tc_setclock(); } } @@ -738,25 +731,25 @@ vm_rpc_open(struct vm_rpc *rpc, uint32_t struct vm_backdoor frame; memset(, 0, sizeof(frame)); - frame.eax.word = VM_MAGIC; - frame.ebx.word = proto | VM_RPC_FLAG_COOKIE; - frame.ecx.part.low = VM_CMD_RPC; - frame.ecx.part.high = VM_RPC_OPEN; - frame.edx.part.low = VM_PORT_CMD; - frame.edx.part.high = 0; + frame.eax = VM_MAGIC; + frame.ebx = proto | VM_RPC_FLAG_COOKIE; + frame.ecx = VM_REG_CMD_RPC(VM_RPC_OPEN); + frame.edx = VM_REG_PORT_CMD(0); vm_cmd(); - if (frame.ecx.part.high != 1 || frame.edx.part.low != 0) { + if (__SHIFTOUT(frame.ecx, VM_REG_HIGH_MASK) != 1 || + __SHIFTOUT(frame.edx, VM_REG_LOW_MASK) != 0) { /* open-vm-tools retries without VM_RPC_FLAG_COOKIE here.. */ - printf("vmware: open failed, eax=%08x, ecx=%08x, edx=%08x\n", - frame.eax.word, frame.ecx.word, frame.edx.word); + printf("vmware: open failed, eax=%#"PRIxREGISTER + ",
CVS commit: src/sys/netinet6
Module Name:src Committed By: ryo Date: Thu Mar 11 11:10:22 UTC 2021 Modified Files: src/sys/netinet6: ip6_var.h Log Message: flowlabel will never return anything other than 1 or 0. s/&&/&/ To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/netinet6/ip6_var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/netinet6/ip6_var.h diff -u src/sys/netinet6/ip6_var.h:1.89 src/sys/netinet6/ip6_var.h:1.90 --- src/sys/netinet6/ip6_var.h:1.89 Mon Mar 8 18:22:16 2021 +++ src/sys/netinet6/ip6_var.h Thu Mar 11 11:10:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_var.h,v 1.89 2021/03/08 18:22:16 christos Exp $ */ +/* $NetBSD: ip6_var.h,v 1.90 2021/03/11 11:10:22 ryo Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -382,7 +382,7 @@ static __inline uint32_t ip6_randomflowlabel(void) { - return cprng_fast32() && 0xf; + return cprng_fast32() & 0xf; } static __inline bool
CVS commit: src
Module Name:src Committed By: ryo Date: Thu Mar 11 10:34:34 UTC 2021 Modified Files: src/share/man/man4: ddb.4 src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: Numeric modifiers conflict with the syntax interpretation of ddb, so use 'b', 'w', 'l', 'q' instead. Also, change load/store('l','s') to 'r','w' like the other arch. >db{0}> machine watch/1 hostname >Bad modifier >db{0}> machine watch/s1 hostname >add watchpoint 0 as c1087848 To generate a diff of this commit: cvs rdiff -u -r1.198 -r1.199 src/share/man/man4/ddb.4 cvs rdiff -u -r1.38 -r1.39 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/ddb.4 diff -u src/share/man/man4/ddb.4:1.198 src/share/man/man4/ddb.4:1.199 --- src/share/man/man4/ddb.4:1.198 Fri Feb 19 08:57:56 2021 +++ src/share/man/man4/ddb.4 Thu Mar 11 10:34:34 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: ddb.4,v 1.198 2021/02/19 08:57:56 msaitoh Exp $ +.\" $NetBSD: ddb.4,v 1.199 2021/03/11 10:34:34 ryo Exp $ .\" .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -56,7 +56,7 @@ .\" any improvements or extensions that they make and grant Carnegie Mellon .\" the rights to redistribute these changes. .\" -.Dd February 19, 2021 +.Dd March 11, 2021 .Dt DDB 4 .Os .Sh NAME @@ -1017,6 +1017,8 @@ set (e.g. Some of these commands are: .Ss AARCH64 .Bl -tag -width "traptrace" -compact +.It Ic break +Set or clear a hardware breakpoint. .It Ic cpu Switch to another CPU. .It Ic cpuinfo @@ -1035,26 +1037,18 @@ Print system registers. Set or clear a hardware watchpoint. Pass the address to be watched, or watchpoint number to clear the watchpoint. Optional modifiers are -.Dq l -for load access, -.Dq s -for store access, -.Dq 1 +.Dq r +for read access, +.Dq w +for write access (default: trap on read or write access), +.Dq b for 8 bit width, -.Dq 2 +.Dq h for 16 bit, -.Dq 3 -for 24 bit, -.Dq 4 -for 32 bit, -.Dq 5 -for 40 bit, -.Dq 6 -for 48 bit, -.Dq 7 -for 56 bit, -.Dq 8 -for 64 bit. +.Dq l +for 32 bit or, +.Dq q +for 64 bit (default: 32 bit). .El .Ss ALPHA .Bl -tag -width "traptrace" -compact Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.38 src/sys/arch/aarch64/aarch64/db_machdep.c:1.39 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.38 Thu Mar 11 09:48:40 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Thu Mar 11 10:34:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.39 2021/03/11 10:34:34 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -179,10 +179,11 @@ const struct db_command db_machine_comma DDB_ADD_CMD( "watch", db_md_watch_cmd, 0, "set or clear watchpoint", - "[/12345678] [address|#]", + "[/rwbhlq] [address|#]", "\taddress: watchpoint address to set\n" - "\t#: watchpoint number to remove" - "\t/1..8: size of data\n") + "\t#: watchpoint number to remove\n" + "\t/rw: read or write access\n" + "\t/bhlq: size of access\n") }, { DDB_ADD_CMD( @@ -978,20 +979,22 @@ db_md_watch_cmd(db_expr_t addr, bool hav ch = *modif; switch (ch) { - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': -watchsize = ch - '0'; + case 'b': +watchsize = 1; +break; + case 'h': +watchsize = 2; break; case 'l': +watchsize = 4; +break; + case 'q': +watchsize = 8; +break; + case 'r': accesstype |= WATCHPOINT_ACCESS_LOAD; break; - case 's': + case 'w': accesstype |= WATCHPOINT_ACCESS_STORE; break; }
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Thu Mar 11 09:48:40 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c src/sys/arch/aarch64/include: db_machdep.h Log Message: - fixed a problem where hardware {break,watch}points other than #0 could not be cleared - hardware {break,watch}point addresses are now strictly checked To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/aarch64/aarch64/db_machdep.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.37 src/sys/arch/aarch64/aarch64/db_machdep.c:1.38 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.37 Tue Mar 9 16:44:27 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Thu Mar 11 09:48:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.38 2021/03/11 09:48:40 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -699,7 +699,7 @@ aarch64_breakpoint_set(int n, vaddr_t ad bvr = 0; bcr = 0; } else { - bvr = addr; + bvr = addr & DBGBVR_MASK; bcr = __SHIFTIN(0, DBGBCR_BT) | __SHIFTIN(0, DBGBCR_LBN) | @@ -714,7 +714,7 @@ aarch64_breakpoint_set(int n, vaddr_t ad } void -aarch64_watchpoint_set(int n, vaddr_t addr, int size, int accesstype) +aarch64_watchpoint_set(int n, vaddr_t addr, u_int size, u_int accesstype) { uint64_t wvr, wcr; uint32_t matchbytebit; @@ -723,9 +723,13 @@ aarch64_watchpoint_set(int n, vaddr_t ad if (size > 8) size = 8; - /* BAS must be all of whose set bits are contiguous */ + /* + * It is always watched in 8byte units, and + * BAS is a bit field of byte offset in 8byte units. + */ matchbytebit = 0xff >> (8 - size); matchbytebit <<= (addr & 7); + addr &= ~7UL; /* load, store, or both */ accesstype &= WATCHPOINT_ACCESS_MASK; @@ -752,24 +756,37 @@ aarch64_watchpoint_set(int n, vaddr_t ad aarch64_set_wcr_wvr(n, wcr, wvr); } -static void +static int db_md_breakpoint_set(int n, vaddr_t addr) { if (n >= __arraycount(breakpoint_buf)) - return; + return -1; + + if ((addr & 3) != 0) { + db_printf("address must be 4bytes aligned\n"); + return -1; + } breakpoint_buf[n].addr = addr; + return 0; } -static void -db_md_watchpoint_set(int n, vaddr_t addr, int size, int accesstype) +static int +db_md_watchpoint_set(int n, vaddr_t addr, u_int size, u_int accesstype) { if (n >= __arraycount(watchpoint_buf)) - return; + return -1; + + if (size != 0 && ((addr) & ~7UL) != ((addr + size - 1) & ~7UL)) { + db_printf( + "address and size must fit within a block of 8bytes\n"); + return -1; + } watchpoint_buf[n].addr = addr; watchpoint_buf[n].size = size; watchpoint_buf[n].accesstype = accesstype; + return 0; } static void @@ -893,7 +910,7 @@ void db_md_break_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) { - int i; + int i, rc; int added, cleared; if (!have_addr) { @@ -901,7 +918,6 @@ db_md_break_cmd(db_expr_t addr, bool hav return; } - addr &= DBGBVR_MASK; added = -1; cleared = -1; if (0 <= addr && addr <= max_breakpoint) { @@ -920,7 +936,9 @@ db_md_break_cmd(db_expr_t addr, bool hav if (cleared == -1) { for (i = 0; i <= max_breakpoint; i++) { if (breakpoint_buf[i].addr == 0) { - db_md_breakpoint_set(i, addr); + rc = db_md_breakpoint_set(i, addr); + if (rc != 0) + return; added = i; break; } @@ -944,16 +962,15 @@ void db_md_watch_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) { - int i; + int i, rc; int added, cleared; - int accesstype, watchsize; + u_int accesstype, watchsize; if (!have_addr) { show_watchpoints(); return; } - addr &= DBGWVR_MASK; accesstype = watchsize = 0; if ((modif != NULL) && (*modif != '\0')) { int ch; @@ -1003,8 +1020,10 @@ db_md_watch_cmd(db_expr_t addr, bool hav if (cleared == -1) { for (i = 0; i <= max_watchpoint; i++) { if (watchpoint_buf[i].addr == 0) { - db_md_watchpoint_set(i, addr, watchsize, - accesstype); + rc = db_md_watchpoint_set(i, addr, + watchsize, accesstype); + if (rc != 0) + return; added = i; break; } Index: src/sys/arch/aarch64/include/db_machdep.h diff -u src/sys/arch/aarch64/include/db_machdep.h:1.12 src/sys/arch/aarch64/include/db_machdep.h:1.13 --- src/sys/arch/aarch64/include/db_machdep.h:1.12 Tue Mar 9 16:44:27 2021 +++
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:44:27 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: cpu.c cpuswitch.S db_machdep.c trap.c vectors.S src/sys/arch/aarch64/include: db_machdep.h Log Message: Add support hardware breakpoint and watchpoint again. Limited support for hardware watchpoint has been available for some time, but it has not been working properly. In addition, it stopped working at the time of the PTRACE support commit on 2018-12-13. This has been fixed to work correctly, and also fixed to be practical by sharing hardware watchpoints and breakpoints between CPUs on MULTIPROCESSOR. Also fixed a bug that causes a malfunction when switching CPUs with "machine cpu N" when entering ddb mode from other than cpu_Debugger(). I have confirmed that the CPU can be switched by "machine cpu N" and return from ddb properly in each case where ddb is called triggered by ddb break/watchpoint, hardware break/watchpoint, and cpu_Debugger(). To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/aarch64/aarch64/cpu.c cvs rdiff -u -r1.32 -r1.33 src/sys/arch/aarch64/aarch64/cpuswitch.S cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/aarch64/db_machdep.c cvs rdiff -u -r1.44 -r1.45 src/sys/arch/aarch64/aarch64/trap.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/vectors.S cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/cpu.c diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.58 src/sys/arch/aarch64/aarch64/cpu.c:1.59 --- src/sys/arch/aarch64/aarch64/cpu.c:1.58 Mon Jan 11 21:58:31 2021 +++ src/sys/arch/aarch64/aarch64/cpu.c Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $ */ +/* $NetBSD: cpu.c,v 1.59 2021/03/09 16:44:27 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,10 +27,11 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.58 2021/01/11 21:58:31 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.59 2021/03/09 16:44:27 ryo Exp $"); #include "locators.h" #include "opt_arm_debug.h" +#include "opt_ddb.h" #include "opt_fdt.h" #include "opt_multiprocessor.h" @@ -53,6 +54,9 @@ __KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.58 #include #include #include +#ifdef DDB +#include +#endif #include #include @@ -681,7 +685,9 @@ cpu_hatch(struct cpu_info *ci) aarch64_getcacheinfo(device_unit(ci->ci_dev)); aarch64_printcacheinfo(ci->ci_dev); cpu_identify2(ci->ci_dev, ci); - +#ifdef DDB + db_machdep_init(); +#endif mutex_exit(_hatch_lock); cpu_init_counter(ci); Index: src/sys/arch/aarch64/aarch64/cpuswitch.S diff -u src/sys/arch/aarch64/aarch64/cpuswitch.S:1.32 src/sys/arch/aarch64/aarch64/cpuswitch.S:1.33 --- src/sys/arch/aarch64/aarch64/cpuswitch.S:1.32 Sat Dec 26 00:55:26 2020 +++ src/sys/arch/aarch64/aarch64/cpuswitch.S Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuswitch.S,v 1.32 2020/12/26 00:55:26 jmcneill Exp $ */ +/* $NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #include "opt_ddb.h" #include "opt_kasan.h" -RCSID("$NetBSD: cpuswitch.S,v 1.32 2020/12/26 00:55:26 jmcneill Exp $") +RCSID("$NetBSD: cpuswitch.S,v 1.33 2021/03/09 16:44:27 ryo Exp $") ARMV8_DEFINE_OPTIONS @@ -310,7 +310,7 @@ END(lwp_trampoline) #ifdef DDB ENTRY_NP(cpu_Debugger) - brk #0 + brk #0x ret END(cpu_Debugger) #endif /* DDB */ Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 src/sys/arch/aarch64/aarch64/db_machdep.c:1.37 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 Tue Mar 9 16:43:13 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:44:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.37 2021/03/09 16:44:27 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -75,6 +75,7 @@ void db_md_reset_cmd(db_expr_t, bool, db void db_md_tlbi_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_ttbr_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_sysreg_cmd(db_expr_t, bool, db_expr_t, const char *); +void db_md_break_cmd(db_expr_t, bool, db_expr_t, const char *); void db_md_watch_cmd(db_expr_t, bool, db_expr_t, const char *); #if defined(_KER
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:43:13 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: "machine cpu" command shows pc of trapframe and the symbol To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 src/sys/arch/aarch64/aarch64/db_machdep.c:1.36 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 Tue Mar 9 16:42:36 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:43:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $ */ +/* $NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.36 2021/03/09 16:43:13 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -944,11 +944,16 @@ db_md_switch_cpu_cmd(db_expr_t addr, boo if (!have_addr) { for (i = 0; i < ncpu; i++) { - if (db_readytoswitch[i] != NULL) -db_printf("cpu%d: ready. tf=%p\n", i, -db_readytoswitch[i]); - else + if (db_readytoswitch[i] != NULL) { +db_printf("cpu%d: ready. tf=%p, pc=%016lx ", i, + db_readytoswitch[i], + db_readytoswitch[i]->tf_pc); +db_printsym(db_readytoswitch[i]->tf_pc, + DB_STGY_ANY, db_printf); +db_printf("\n"); + } else { db_printf("cpu%d: not responding\n", i); + } } return; }
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:42:36 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: match the macro name to the order of the arguments. NFC. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.34 src/sys/arch/aarch64/aarch64/db_machdep.c:1.35 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.34 Tue Feb 23 07:13:51 2021 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Tue Mar 9 16:42:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.34 2021/02/23 07:13:51 mrg Exp $ */ +/* $NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.34 2021/02/23 07:13:51 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.35 2021/03/09 16:42:36 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -606,58 +606,58 @@ db_md_sysreg_cmd(db_expr_t addr, bool ha static void aarch64_set_bcr_bvr(int n, uint64_t bcr, uint64_t bvr) { -#define DBG_BVR_BCR_SET(regno, bcr, bvr) \ +#define DBG_BCR_BVR_SET(regno, bcr, bvr) \ do { \ reg_dbgbcr ## regno ## _el1_write(bcr); \ reg_dbgbvr ## regno ## _el1_write(bvr); \ } while (0 /* CONSTCOND */) switch (n) { - case 0: DBG_BVR_BCR_SET(0, bcr, bvr); break; - case 1: DBG_BVR_BCR_SET(1, bcr, bvr); break; - case 2: DBG_BVR_BCR_SET(2, bcr, bvr); break; - case 3: DBG_BVR_BCR_SET(3, bcr, bvr); break; - case 4: DBG_BVR_BCR_SET(4, bcr, bvr); break; - case 5: DBG_BVR_BCR_SET(5, bcr, bvr); break; - case 6: DBG_BVR_BCR_SET(6, bcr, bvr); break; - case 7: DBG_BVR_BCR_SET(7, bcr, bvr); break; - case 8: DBG_BVR_BCR_SET(8, bcr, bvr); break; - case 9: DBG_BVR_BCR_SET(9, bcr, bvr); break; - case 10: DBG_BVR_BCR_SET(10, bcr, bvr); break; - case 11: DBG_BVR_BCR_SET(11, bcr, bvr); break; - case 12: DBG_BVR_BCR_SET(12, bcr, bvr); break; - case 13: DBG_BVR_BCR_SET(13, bcr, bvr); break; - case 14: DBG_BVR_BCR_SET(14, bcr, bvr); break; - case 15: DBG_BVR_BCR_SET(15, bcr, bvr); break; + case 0: DBG_BCR_BVR_SET(0, bcr, bvr); break; + case 1: DBG_BCR_BVR_SET(1, bcr, bvr); break; + case 2: DBG_BCR_BVR_SET(2, bcr, bvr); break; + case 3: DBG_BCR_BVR_SET(3, bcr, bvr); break; + case 4: DBG_BCR_BVR_SET(4, bcr, bvr); break; + case 5: DBG_BCR_BVR_SET(5, bcr, bvr); break; + case 6: DBG_BCR_BVR_SET(6, bcr, bvr); break; + case 7: DBG_BCR_BVR_SET(7, bcr, bvr); break; + case 8: DBG_BCR_BVR_SET(8, bcr, bvr); break; + case 9: DBG_BCR_BVR_SET(9, bcr, bvr); break; + case 10: DBG_BCR_BVR_SET(10, bcr, bvr); break; + case 11: DBG_BCR_BVR_SET(11, bcr, bvr); break; + case 12: DBG_BCR_BVR_SET(12, bcr, bvr); break; + case 13: DBG_BCR_BVR_SET(13, bcr, bvr); break; + case 14: DBG_BCR_BVR_SET(14, bcr, bvr); break; + case 15: DBG_BCR_BVR_SET(15, bcr, bvr); break; } } static void aarch64_set_wcr_wvr(int n, uint64_t wcr, uint64_t wvr) { -#define DBG_WVR_WCR_SET(regno, wcr, wvr) \ +#define DBG_WCR_WVR_SET(regno, wcr, wvr) \ do { \ reg_dbgwcr ## regno ## _el1_write(wcr); \ reg_dbgwvr ## regno ## _el1_write(wvr); \ } while (0 /* CONSTCOND */) switch (n) { - case 0: DBG_WVR_WCR_SET(0, wcr, wvr); break; - case 1: DBG_WVR_WCR_SET(1, wcr, wvr); break; - case 2: DBG_WVR_WCR_SET(2, wcr, wvr); break; - case 3: DBG_WVR_WCR_SET(3, wcr, wvr); break; - case 4: DBG_WVR_WCR_SET(4, wcr, wvr); break; - case 5: DBG_WVR_WCR_SET(5, wcr, wvr); break; - case 6: DBG_WVR_WCR_SET(6, wcr, wvr); break; - case 7: DBG_WVR_WCR_SET(7, wcr, wvr); break; - case 8: DBG_WVR_WCR_SET(8, wcr, wvr); break; - case 9: DBG_WVR_WCR_SET(9, wcr, wvr); break; - case 10: DBG_WVR_WCR_SET(10, wcr, wvr); break; - case 11: DBG_WVR_WCR_SET(11, wcr, wvr); break; - case 12: DBG_WVR_WCR_SET(12, wcr, wvr); break; - case 13: DBG_WVR_WCR_SET(13, wcr, wvr); break; - case 14: DBG_WVR_WCR_SET(14, wcr, wvr); break; - case 15: DBG_WVR_WCR_SET(15, wcr, wvr); break; + case 0: DBG_WCR_WVR_SET(0, wcr, wvr); break; + case 1: DBG_WCR_WVR_SET(1, wcr, wvr); break; + case 2: DBG_WCR_WVR_SET(2, wcr, wvr); break; + case 3: DBG_WCR_WVR_SET(3, wcr, wvr); break; + case 4: DBG_WCR_WVR_SET(4, wcr, wvr); break; + case 5: DBG_WCR_WVR_SET(5, wcr, wvr); break; + case 6: DBG_WCR_WVR_SET(6, wcr, wvr); break; + case 7: DBG_WCR_WVR_SET(7, wcr, wvr); break; + case 8: DBG_WCR_WVR_SET(8, wcr, wvr); break; + case 9: DBG_WCR_WVR_SET(9, wcr, wvr); break; + case 10: DBG_WCR_WVR_SET(10, wcr, wvr); break; + case 11: DBG_WCR_WVR_SET(11, wcr, wvr); break; + case 12: DBG_WCR_WVR_SET(12, wcr, wvr); break; + case 13: DBG_WCR_WVR_SET(13, wcr, wvr); break; + case 14: DBG_WCR_WVR_SET(14,
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Tue Mar 9 16:41:43 UTC 2021 Modified Files: src/sys/arch/aarch64/include: armreg.h Log Message: fixed mask width of DBGWVR_MASK, and added definition of DBGBVR_MASK To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/aarch64/include/armreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.54 src/sys/arch/aarch64/include/armreg.h:1.55 --- src/sys/arch/aarch64/include/armreg.h:1.54 Wed Sep 30 08:40:49 2020 +++ src/sys/arch/aarch64/include/armreg.h Tue Mar 9 16:41:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.54 2020/09/30 08:40:49 ryo Exp $ */ +/* $NetBSD: armreg.h,v 1.55 2021/03/09 16:41:43 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -1087,6 +1087,8 @@ AARCH64REG_WRITE_INLINE(dbgbvr14_el1) AARCH64REG_READ_INLINE(dbgbvr15_el1) // Debug Breakpoint Value Register 15 AARCH64REG_WRITE_INLINE(dbgbvr15_el1) +#define DBGBVR_MASK __BITS(63,2) + AARCH64REG_READ_INLINE(dbgwcr0_el1) // Debug Watchpoint Control Register 0 AARCH64REG_WRITE_INLINE(dbgwcr0_el1) AARCH64REG_READ_INLINE(dbgwcr1_el1) // Debug Watchpoint Control Register 1 @@ -1163,7 +1165,7 @@ AARCH64REG_WRITE_INLINE(dbgwvr14_el1) AARCH64REG_READ_INLINE(dbgwvr15_el1) // Debug Watchpoint Value Register 15 AARCH64REG_WRITE_INLINE(dbgwvr15_el1) -#define DBGWVR_MASK __BITS(64,3) +#define DBGWVR_MASK __BITS(63,2) AARCH64REG_READ_INLINE(mdscr_el1) // Monitor Debug System Control Register
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Mar 9 16:40:59 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: fix build error without options DDB. kvtopte() is referenced from arm/acpi/acpi_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/aarch64/aarch64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.102 src/sys/arch/aarch64/aarch64/pmap.c:1.103 --- src/sys/arch/aarch64/aarch64/pmap.c:1.102 Sat Feb 13 18:13:53 2021 +++ src/sys/arch/aarch64/aarch64/pmap.c Tue Mar 9 16:40:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $ */ +/* $NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2021/03/09 16:40:59 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -2632,8 +2632,6 @@ pmap_is_referenced(struct vm_page *pg) return (pp->pp_pv.pv_va & VM_PROT_READ); } -#ifdef DDB - /* get pointer to kernel segment L2 or L3 table entry */ pt_entry_t * kvtopte(vaddr_t va) @@ -2643,6 +2641,8 @@ kvtopte(vaddr_t va) return _pmap_pte_lookup_bs(pmap_kernel(), va, NULL); } +#ifdef DDB + /* change attribute of kernel segment */ pt_entry_t pmap_kvattr(vaddr_t va, vm_prot_t prot)
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:38:49 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add ASUSTEK AURALED To generate a diff of this commit: cvs rdiff -u -r1.791 -r1.792 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.791 src/sys/dev/usb/usbdevs:1.792 --- src/sys/dev/usb/usbdevs:1.791 Tue Mar 9 16:37:23 2021 +++ src/sys/dev/usb/usbdevs Tue Mar 9 16:38:49 2021 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.791 2021/03/09 16:37:23 ryo Exp $ +$NetBSD: usbdevs,v 1.792 2021/03/09 16:38:49 ryo Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -961,6 +961,7 @@ product ASUSTEK RTL8192CU 0x17ab RTL8192 product ASUSTEK USBN66 0x17ad USB-N66 product ASUSTEK USBN10NANO 0x17ba USB-N10 Nano product ASUSTEK RTL8192CU_3 0x17c0 RTL8192CU_3 +product ASUSTEK AURALED 0x18f3 AURA LED product ASUSTEK MYPAL_A730 0x4202 MyPal A730 product ASUSTEK2 USBN11 0x0b05 USB-N11
CVS commit: src/sys/dev/usb
Module Name:src Committed By: ryo Date: Tue Mar 9 16:37:24 UTC 2021 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add CoolerMaster, and AMD SR4 lamplight Control device (Wraith Prism RGB CPU Cooler) To generate a diff of this commit: cvs rdiff -u -r1.790 -r1.791 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.790 src/sys/dev/usb/usbdevs:1.791 --- src/sys/dev/usb/usbdevs:1.790 Wed Feb 3 23:23:42 2021 +++ src/sys/dev/usb/usbdevs Tue Mar 9 16:37:23 2021 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.790 2021/02/03 23:23:42 thorpej Exp $ +$NetBSD: usbdevs,v 1.791 2021/03/09 16:37:23 ryo Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -580,6 +580,7 @@ vendor ARDUINO 0x2341 Arduino SA vendor TPLINK 0x2357 TP-Link vendor WMR 0x2405 West Mountain Radio vendor TRIPPLITE 0x2478 Tripp-Lite +vendor COOLERMASTER 0x2516 Cooler Master Technology Inc. vendor HAILUCK 0x258a HAILUCK Co., Ltd vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ @@ -1253,6 +1254,9 @@ product CONCORDCAMERA EYE_Q_3X 0x0100 Ey /* Connectix products */ product CONNECTIX QUICKCAM 0x0001 QuickCam +/* Cooler Master Technology Inc. */ +product COOLERMASTER AMD_SR4_LAMPLIGHT 0x0051 AMD SR4 lamplight Control + /* Corega products */ product COREGA ETHER_USB_T 0x0001 Ether USB-T product COREGA FETHER_USB_TX 0x0004 FEther USB-TX
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 20:34:54 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: adjust tab. NFC To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.14 src/sys/arch/aarch64/aarch64/disasm.c:1.15 --- src/sys/arch/aarch64/aarch64/disasm.c:1.14 Tue Feb 23 20:26:50 2021 +++ src/sys/arch/aarch64/aarch64/disasm.c Tue Feb 23 20:34:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.14 2021/02/23 20:26:50 ryo Exp $ */ +/* $NetBSD: disasm.c,v 1.15 2021/02/23 20:34:54 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.14 2021/02/23 20:26:50 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.15 2021/02/23 20:34:54 ryo Exp $"); #include #include @@ -1324,8 +1324,8 @@ static struct op_sys_table op_sys_table[ { SYSREG_ENC(1, 0, 7, 8, 1), OPE_XT, "at\ts1e1w" }, { SYSREG_ENC(1, 0, 7, 8, 2), OPE_XT, "at\ts1e0r" }, { SYSREG_ENC(1, 0, 7, 8, 3), OPE_XT, "at\ts1e0w" }, - { SYSREG_ENC(1, 0, 7, 9, 0), OPE_XT, "at\ts1e1rp" }, - { SYSREG_ENC(1, 0, 7, 9, 1), OPE_XT, "at\ts1e1wp" }, + { SYSREG_ENC(1, 0, 7, 9, 0), OPE_XT, "at\ts1e1rp" }, + { SYSREG_ENC(1, 0, 7, 9, 1), OPE_XT, "at\ts1e1wp" }, { SYSREG_ENC(1, 4, 7, 8, 0), OPE_XT, "at\ts1e2r" }, { SYSREG_ENC(1, 4, 7, 8, 1), OPE_XT, "at\ts1e2w" }, { SYSREG_ENC(1, 4, 7, 8, 4), OPE_XT, "at\ts12e1r" }, @@ -1335,9 +1335,9 @@ static struct op_sys_table op_sys_table[ { SYSREG_ENC(1, 6, 7, 8, 0), OPE_XT, "at\ts1e3r" }, { SYSREG_ENC(1, 6, 7, 8, 1), OPE_XT, "at\ts1e3w" }, - { SYSREG_ENC(1, 3, 7, 3, 4), OPE_XT, "cfp\trctx" }, - { SYSREG_ENC(1, 3, 7, 3, 5), OPE_XT, "dvp\trctx" }, - { SYSREG_ENC(1, 3, 7, 3, 7), OPE_XT, "cpp\trctx" }, + { SYSREG_ENC(1, 3, 7, 3, 4), OPE_XT, "cfp\trctx" }, + { SYSREG_ENC(1, 3, 7, 3, 5), OPE_XT, "dvp\trctx" }, + { SYSREG_ENC(1, 3, 7, 3, 7), OPE_XT, "cpp\trctx" }, { SYSREG_ENC(1, 0, 8, 3, 0), OPE_NONE, "tlbi\tvmalle1is" }, { SYSREG_ENC(1, 0, 8, 3, 1), OPE_XT, "tlbi\tvae1is" },
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 20:26:50 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: fix wrong target register size of "ldrsh" "ldrsh Xt, [Xn, Xm]" was being output as "ldrsh Wt, [Xn, Xm]" To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.13 src/sys/arch/aarch64/aarch64/disasm.c:1.14 --- src/sys/arch/aarch64/aarch64/disasm.c:1.13 Tue Feb 23 20:15:04 2021 +++ src/sys/arch/aarch64/aarch64/disasm.c Tue Feb 23 20:26:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.13 2021/02/23 20:15:04 ryo Exp $ */ +/* $NetBSD: disasm.c,v 1.14 2021/02/23 20:26:50 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.13 2021/02/23 20:15:04 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.14 2021/02/23 20:26:50 ryo Exp $"); #include #include @@ -919,7 +919,7 @@ regoffset_b_common(const disasm_interfac static void regoffset_h_common(const disasm_interface_t *di, uint64_t pc, uint32_t insn, uint64_t Rm, uint64_t option, uint64_t shift, uint64_t Rn, uint64_t Rt, -const char *op) +uint64_t RtSz, const char *op) { int r; @@ -931,13 +931,13 @@ regoffset_h_common(const disasm_interfac if ((shift == 0) && (option == 3)) { PRINTF("%s\t%s, [%s,%s]\n", op, - ZREGNAME(0, Rt), + ZREGNAME(RtSz, Rt), SREGNAME(1, Rn), ZREGNAME(r, Rm)); } else if (shift == 0) { PRINTF("%s\t%s, [%s,%s,%s]\n", op, - ZREGNAME(0, Rt), + ZREGNAME(RtSz, Rt), SREGNAME(1, Rn), ZREGNAME(r, Rm), SHIFTOP8(option, @@ -945,7 +945,7 @@ regoffset_h_common(const disasm_interfac } else { PRINTF("%s\t%s, [%s,%s,%s #%u]\n", op, - ZREGNAME(0, Rt), + ZREGNAME(RtSz, Rt), SREGNAME(1, Rn), ZREGNAME(r, Rm), SHIFTOP8(option, @@ -2030,7 +2030,7 @@ OP3FUNC(op_ldrh_immunsign, imm12, Rn, Rt OP5FUNC(op_ldrh_reg, Rm, option, shift, Rn, Rt) { - regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, "ldrh"); + regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, 0, "ldrh"); } OP4FUNC(op_ldrsb_immpostidx, opc, imm9, Rn, Rt) @@ -2100,7 +2100,8 @@ OP4FUNC(op_ldrsh_immunsign, opc, imm12, OP6FUNC(op_ldrsh_reg, opc, Rm, option, shift, Rn, Rt) { - regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, "ldrsh"); + regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, opc ^ 1, + "ldrsh"); } OP3FUNC(op_ldrsw_immpostidx, imm9, Rn, Rt) @@ -3016,7 +3017,7 @@ OP3FUNC(op_strh_immunsign, imm12, Rn, Rt OP5FUNC(op_strh_reg, Rm, option, shift, Rn, Rt) { - regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, "strh"); + regoffset_h_common(di, pc, insn, Rm, option, shift, Rn, Rt, 0, "strh"); } OP4FUNC(op_sttr, size, imm9, Rn, Rt)
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 20:15:04 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: make more system registers are disassemblable To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.12 src/sys/arch/aarch64/aarch64/disasm.c:1.13 --- src/sys/arch/aarch64/aarch64/disasm.c:1.12 Tue Feb 23 17:48:46 2021 +++ src/sys/arch/aarch64/aarch64/disasm.c Tue Feb 23 20:15:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.12 2021/02/23 17:48:46 ryo Exp $ */ +/* $NetBSD: disasm.c,v 1.13 2021/02/23 20:15:04 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.12 2021/02/23 17:48:46 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.13 2021/02/23 20:15:04 ryo Exp $"); #include #include @@ -323,9 +323,14 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 0, 0, 2, 3), "id_isar3_el1" }, { SYSREG_ENC(3, 0, 0, 2, 4), "id_isar4_el1" }, { SYSREG_ENC(3, 0, 0, 2, 5), "id_isar5_el1" }, + { SYSREG_ENC(3, 0, 0, 2, 6), "id_mmfr4_el1" }, + { SYSREG_ENC(3, 0, 0, 2, 7), "id_isar6_el1" }, { SYSREG_ENC(3, 0, 0, 3, 0), "mvfr0_el1" }, { SYSREG_ENC(3, 0, 0, 3, 1), "mvfr1_el1" }, { SYSREG_ENC(3, 0, 0, 3, 2), "mvfr2_el1" }, + { SYSREG_ENC(3, 0, 0, 3, 4), "id_pfr2_el1" }, + { SYSREG_ENC(3, 0, 0, 3, 5), "id_dfr1_el1" }, + { SYSREG_ENC(3, 0, 0, 3, 6), "id_mmfr5_el1" }, { SYSREG_ENC(3, 0, 0, 4, 0), "id_aa64pfr0_el1" }, { SYSREG_ENC(3, 0, 0, 4, 1), "id_aa64pfr1_el1" }, { SYSREG_ENC(3, 0, 0, 5, 0), "id_aa64dfr0_el1" }, @@ -336,9 +341,12 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 0, 0, 6, 1), "id_aa64isar1_el1" }, { SYSREG_ENC(3, 0, 0, 7, 0), "id_aa64mmfr0_el1" }, { SYSREG_ENC(3, 0, 0, 7, 1), "id_aa64mmfr1_el1" }, + { SYSREG_ENC(3, 0, 0, 7, 2), "id_aa64mmfr2_el1" }, { SYSREG_ENC(3, 0, 1, 0, 0), "sctlr_el1" }, { SYSREG_ENC(3, 0, 1, 0, 1), "actlr_el1" }, { SYSREG_ENC(3, 0, 1, 0, 2), "cpacr_el1" }, + { SYSREG_ENC(3, 0, 1, 0, 5), "rgsr_el1" }, + { SYSREG_ENC(3, 0, 1, 0, 6), "gcr_el1" }, { SYSREG_ENC(3, 0, 2, 0, 0), "ttbr0_el1" }, { SYSREG_ENC(3, 0, 2, 0, 1), "ttbr1_el1" }, { SYSREG_ENC(3, 0, 2, 0, 2), "tcr_el1" }, @@ -362,21 +370,31 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 0, 5, 1, 0), "afsr0_el1" }, { SYSREG_ENC(3, 0, 5, 1, 1), "afsr1_el1" }, { SYSREG_ENC(3, 0, 5, 2, 0), "esr_el1" }, + { SYSREG_ENC(3, 0, 5, 6, 0), "tfsr_el1" }, + { SYSREG_ENC(3, 0, 5, 6, 1), "tfsre0_el1" }, { SYSREG_ENC(3, 0, 6, 0, 0), "far_el1" }, { SYSREG_ENC(3, 0, 7, 4, 0), "par_el1" }, { SYSREG_ENC(3, 0, 9, 14, 1), "pmintenset_el1" }, { SYSREG_ENC(3, 0, 9, 14, 2), "pmintenclr_el1" }, { SYSREG_ENC(3, 0, 10, 2, 0), "mair_el1" }, { SYSREG_ENC(3, 0, 10, 3, 0), "amair_el1" }, + { SYSREG_ENC(3, 0, 10, 4, 0), "lorsa_el1" }, + { SYSREG_ENC(3, 0, 10, 4, 1), "lorea_el1" }, + { SYSREG_ENC(3, 0, 10, 4, 2), "lorn_el1" }, + { SYSREG_ENC(3, 0, 10, 4, 3), "lorc_el1" }, + { SYSREG_ENC(3, 0, 10, 4, 7), "lorid_el1" }, { SYSREG_ENC(3, 0, 12, 0, 0), "vbar_el1" }, { SYSREG_ENC(3, 0, 12, 0, 1), "rvbar_el1" }, { SYSREG_ENC(3, 0, 12, 0, 2), "rmr_el1" }, { SYSREG_ENC(3, 0, 12, 1, 0), "isr_el1" }, { SYSREG_ENC(3, 0, 13, 0, 1), "contextidr_el1" }, { SYSREG_ENC(3, 0, 13, 0, 4), "tpidr_el1" }, + { SYSREG_ENC(3, 0, 13, 0, 7), "scxtnum_el1" }, { SYSREG_ENC(3, 0, 14, 1, 0), "cntkctl_el1" }, { SYSREG_ENC(3, 1, 0, 0, 0), "ccsidr_el1" }, { SYSREG_ENC(3, 1, 0, 0, 1), "clidr_el1" }, + { SYSREG_ENC(3, 1, 0, 0, 2), "ccsidr2_el1" }, + { SYSREG_ENC(3, 1, 0, 0, 4), "gmid_el1" }, { SYSREG_ENC(3, 1, 0, 0, 7), "aidr_el1" }, { SYSREG_ENC(3, 2, 0, 0, 0), "csselr_el1" }, { SYSREG_ENC(3, 3, 0, 0, 1), "ctr_el0" }, @@ -407,6 +425,7 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 3, 9, 14, 3), "pmovsset_el0" }, { SYSREG_ENC(3, 3, 13, 0, 2), "tpidr_el0" }, { SYSREG_ENC(3, 3, 13, 0, 3), "tpidr
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 17:48:46 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: The immediate offset of "ldtrb", "ldtrh", "sttrb", and "sttrh" was always output as unsigned. Correctly, it is 9bit signed. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.11 src/sys/arch/aarch64/aarch64/disasm.c:1.12 --- src/sys/arch/aarch64/aarch64/disasm.c:1.11 Tue Feb 23 17:30:56 2021 +++ src/sys/arch/aarch64/aarch64/disasm.c Tue Feb 23 17:48:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.11 2021/02/23 17:30:56 ryo Exp $ */ +/* $NetBSD: disasm.c,v 1.12 2021/02/23 17:48:46 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.11 2021/02/23 17:30:56 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.12 2021/02/23 17:48:46 ryo Exp $"); #include #include @@ -2126,7 +2126,7 @@ OP3FUNC(op_ldtrb, imm9, Rn, Rt) PRINTF("ldtrb\t%s, [%s,#%"PRId64"]\n", ZREGNAME(0, Rt), SREGNAME(1, Rn), - SignExtend(12, imm9, 1)); + SignExtend(9, imm9, 1)); } } @@ -2140,7 +2140,7 @@ OP3FUNC(op_ldtrh, imm9, Rn, Rt) PRINTF("ldtrh\t%s, [%s,#%"PRId64"]\n", ZREGNAME(0, Rt), SREGNAME(1, Rn), - SignExtend(12, imm9, 1)); + SignExtend(9, imm9, 1)); } } @@ -3000,7 +3000,7 @@ OP3FUNC(op_sttrb, imm9, Rn, Rt) PRINTF("sttrb\t%s, [%s,#%"PRId64"]\n", ZREGNAME(0, Rt), SREGNAME(1, Rn), - SignExtend(12, imm9, 1)); + SignExtend(9, imm9, 1)); } } @@ -3014,7 +3014,7 @@ OP3FUNC(op_sttrh, imm9, Rn, Rt) PRINTF("sttrh\t%s, [%s,#%"PRId64"]\n", ZREGNAME(0, Rt), SREGNAME(1, Rn), - SignExtend(12, imm9, 1)); + SignExtend(9, imm9, 1)); } }
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 17:30:56 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: The register operand size for "smnegl" and "smsubl' was wrong. not "smsubl Xd, Xn, Xm, Xa", but "smsubl Xd, Wn, Wm, Xa". To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.10 src/sys/arch/aarch64/aarch64/disasm.c:1.11 --- src/sys/arch/aarch64/aarch64/disasm.c:1.10 Sat Sep 5 15:59:09 2020 +++ src/sys/arch/aarch64/aarch64/disasm.c Tue Feb 23 17:30:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.10 2020/09/05 15:59:09 jakllsch Exp $ */ +/* $NetBSD: disasm.c,v 1.11 2021/02/23 17:30:56 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.10 2020/09/05 15:59:09 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.11 2021/02/23 17:30:56 ryo Exp $"); #include #include @@ -2751,13 +2751,13 @@ OP4FUNC(op_smsubl, Rm, Ra, Rn, Rd) if (Ra == 31) { PRINTF("smnegl\t%s, %s, %s\n", ZREGNAME(1, Rd), - ZREGNAME(1, Rn), - ZREGNAME(1, Rm)); + ZREGNAME(0, Rn), + ZREGNAME(0, Rm)); } else { PRINTF("smsubl\t%s, %s, %s, %s\n", ZREGNAME(1, Rd), - ZREGNAME(1, Rn), - ZREGNAME(1, Rm), + ZREGNAME(0, Rn), + ZREGNAME(0, Rm), ZREGNAME(1, Ra)); } }
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Feb 23 14:50:33 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: idle_machdep.S Log Message: Just a few optimizations. - in cpu_idle(), ci_intr_depth is always 0, so there is no need to fetch for increment or conditional branch. - curcpu() is immutable in idle lwp, there is no need to consider KPREEMPT. Therefore, get curcpu() first and keep using it. - add more comment. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/idle_machdep.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/idle_machdep.S diff -u src/sys/arch/aarch64/aarch64/idle_machdep.S:1.8 src/sys/arch/aarch64/aarch64/idle_machdep.S:1.9 --- src/sys/arch/aarch64/aarch64/idle_machdep.S:1.8 Sun Feb 21 23:37:09 2021 +++ src/sys/arch/aarch64/aarch64/idle_machdep.S Tue Feb 23 14:50:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: idle_machdep.S,v 1.8 2021/02/21 23:37:09 jmcneill Exp $ */ +/* $NetBSD: idle_machdep.S,v 1.9 2021/02/23 14:50:33 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ #include #include "assym.h" -RCSID("$NetBSD: idle_machdep.S,v 1.8 2021/02/21 23:37:09 jmcneill Exp $"); +RCSID("$NetBSD: idle_machdep.S,v 1.9 2021/02/23 14:50:33 ryo Exp $"); #ifdef ARM_INTR_IMPL #include ARM_INTR_IMPL @@ -75,28 +75,34 @@ ENTRY(cpu_idle) adr x0, 1f str x0, [sp, #TF_PC] /* CLKF_PC refer to tf_pc */ + /* + * "idle/N" lwp is allocated on a per-CPU basis, + * curcpu() always return the same, and there is no need to + * consider KPREEMPT. safe even with interrupt enabled. + */ mrs x1, tpidr_el1 /* get curlwp */ - ldr x1, [x1, #L_CPU] /* get curcpu */ - ldr w28, [x1, #CI_INTR_DEPTH] /* w28 = ci->ci_intr_depth */ - add w2, w28, #1 /* w2 = intr_depth + 1 */ + ldr x28, [x1, #L_CPU] /* get curcpu */ + mov w2, #1 mov x0, sp/* get pointer to trapframe */ DISABLE_INTERRUPT - wfi + /* + * assert(ci->ci_intr_depth == 0), + * therefore, ci->ci_intr_depth++ would be definitely 1. + */ + str w2, [x28, #CI_INTR_DEPTH] /* ci->ci_intr_depth = 1 */ - str w2, [x1, #CI_INTR_DEPTH] /* ci->ci_intr_depth++ */ + wfi bl ARM_IRQ_HANDLER /* irqhandler(trapframe) */ 1: - mrs x1, tpidr_el1 /* get curlwp */ - ldr x1, [x1, #L_CPU] /* get curcpu */ - str w28, [x1, #CI_INTR_DEPTH] /* ci->ci_intr_depth = old */ + /* x28 is curcpu() */ + str wzr, [x28, #CI_INTR_DEPTH] /* ci->ci_intr_depth = 0 */ #if defined(__HAVE_FAST_SOFTINTS) && !defined(__HAVE_PIC_FAST_SOFTINTS) - cbnz w28, 1f/* Skip if intr_depth > 0 */ - ldr w3, [x1, #CI_SOFTINTS] /* Get pending softint mask */ + ldr w3, [x28, #CI_SOFTINTS] /* Get pending softint mask */ /* CPL should be 0 */ - ldr w2, [x1, #CI_CPL] /* Get current priority level */ + ldr w2, [x28, #CI_CPL] /* Get current priority level */ lsr w3, w3, w2 /* shift mask by cpl */ cbz w3, 1f bl _C_LABEL(dosoftints) /* dosoftints() */
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Mon Feb 22 09:29:38 UTC 2021 Modified Files: src/sys/arch/aarch64/include: cpu_counter.h Log Message: PR/56002: aarch64 has a true 64bit CPU cycle counter, we will use it. This fix solves PR/56002 on aarch64, but this problems can occur on all other architectures where cpu_counter() is 32bit. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/include/cpu_counter.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/cpu_counter.h diff -u src/sys/arch/aarch64/include/cpu_counter.h:1.1 src/sys/arch/aarch64/include/cpu_counter.h:1.2 --- src/sys/arch/aarch64/include/cpu_counter.h:1.1 Sun Aug 10 05:47:38 2014 +++ src/sys/arch/aarch64/include/cpu_counter.h Mon Feb 22 09:29:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_counter.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */ +/* $NetBSD: cpu_counter.h,v 1.2 2021/02/22 09:29:38 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -44,7 +44,12 @@ #include #define cpu_hascounter() (curcpu()->ci_data.cpu_cc_freq != 0) -#define cpu_counter() cpu_counter32() + +static __inline uint64_t +cpu_counter(void) +{ + return reg_pmccntr_el0_read(); +} static __inline uint32_t cpu_counter32(void)
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Mon Feb 22 06:21:35 UTC 2021 Modified Files: src/sys/dev/fdt: cpufreq_dt.c Log Message: It is more appropriate to use clk_get_rate() rather than sc->sc_freq_target * 100. ci_data.cpu_cc_freq should be set to a higher precision value. In addition, when cpufreq_dt_init(), or while throttling, sc->sc_freq_target should not be referenced by cpufreq_dt_change_cb() because it does not have the correct value. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/fdt/cpufreq_dt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/cpufreq_dt.c diff -u src/sys/dev/fdt/cpufreq_dt.c:1.18 src/sys/dev/fdt/cpufreq_dt.c:1.19 --- src/sys/dev/fdt/cpufreq_dt.c:1.18 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/cpufreq_dt.c Mon Feb 22 06:21:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufreq_dt.c,v 1.18 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: cpufreq_dt.c,v 1.19 2021/02/22 06:21:35 ryo Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.18 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.19 2021/02/22 06:21:35 ryo Exp $"); #include #include @@ -86,7 +86,7 @@ cpufreq_dt_change_cb(void *arg1, void *a struct cpufreq_dt_softc * const sc = arg1; struct cpu_info *ci = curcpu(); - ci->ci_data.cpu_cc_freq = sc->sc_freq_target * 100; + ci->ci_data.cpu_cc_freq = clk_get_rate(sc->sc_clk); } static int
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Feb 18 17:56:04 UTC 2021 Modified Files: src/sys/dev/pci: if_aq.c Log Message: - use if_initialize() and if_register() instead of if_attach() - add IFEF_MPSAFE to if_extflags pointed out by msaitoh@, thanks To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.19 src/sys/dev/pci/if_aq.c:1.20 --- src/sys/dev/pci/if_aq.c:1.19 Thu Sep 24 05:13:03 2020 +++ src/sys/dev/pci/if_aq.c Thu Feb 18 17:56:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.20 2021/02/18 17:56:04 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -1407,6 +1407,7 @@ aq_attach(device_t parent, device_t self strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_extflags = IFEF_MPSAFE; ifp->if_baudrate = IF_Gbps(10); ifp->if_init = aq_init; ifp->if_ioctl = aq_ioctl; @@ -1463,11 +1464,18 @@ aq_attach(device_t parent, device_t self /* RX hardware checksum offloadding */ ifp->if_capabilities |= IFCAP_CSUM_IPv4_Rx; - if_attach(ifp); + error = if_initialize(ifp); + if (error != 0) { + aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", + error); + goto attach_failure; + } + ifp->if_percpuq = if_percpuq_create(ifp); if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->sc_enaddr.ether_addr_octet); ether_set_vlan_cb(>sc_ethercom, aq_vlan_cb); ether_set_ifflags_cb(>sc_ethercom, aq_ifflags_cb); + if_register(ifp); aq_enable_intr(sc, true, false); /* only intr about link */
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Sat Feb 13 18:13:54 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: No assignment is needed here. the loop in pmap_page_remove() always removes the first pv, and since the list is managed by _pmap_remove_pv(), pp->pp_pv.pv_next always points to the first. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/arch/aarch64/aarch64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.101 src/sys/arch/aarch64/aarch64/pmap.c:1.102 --- src/sys/arch/aarch64/aarch64/pmap.c:1.101 Mon Feb 1 18:12:11 2021 +++ src/sys/arch/aarch64/aarch64/pmap.c Sat Feb 13 18:13:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.101 2021/02/01 18:12:11 ryo Exp $ */ +/* $NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2021/02/01 18:12:11 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2021/02/13 18:13:53 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -2237,7 +2237,7 @@ pmap_page_remove(struct pmap_page *pp, v KASSERT(pv == >pp_pv); } else { KASSERT(pv == pvtmp); - pp->pp_pv.pv_next = pv->pv_next; + KASSERT(pp->pp_pv.pv_next == pv->pv_next); pv->pv_next = pvtofree; pvtofree = pv; }
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Fri Feb 12 21:39:55 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_uart.c Log Message: UART_RFIFO_REG should be masked before passing to cn_check_magic(). there is any data in other than the lower 8 bits. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/meson_uart.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_uart.c diff -u src/sys/arch/arm/amlogic/meson_uart.c:1.5 src/sys/arch/arm/amlogic/meson_uart.c:1.6 --- src/sys/arch/arm/amlogic/meson_uart.c:1.5 Wed Jan 27 03:10:18 2021 +++ src/sys/arch/arm/amlogic/meson_uart.c Fri Feb 12 21:39:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_uart.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $ */ +/* $NetBSD: meson_uart.c,v 1.6 2021/02/12 21:39:55 ryo Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.5 2021/01/27 03:10:18 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: meson_uart.c,v 1.6 2021/02/12 21:39:55 ryo Exp $"); #define cn_trap() \ do {\ @@ -260,7 +260,7 @@ meson_uart_cngetc(dev_t dev) return -1; } - c = bus_space_read_4(bst, bsh, UART_RFIFO_REG); + c = bus_space_read_4(bst, bsh, UART_RFIFO_REG) & 0xff; #if defined(DDB) extern int db_active; if (!db_active) @@ -272,7 +272,7 @@ meson_uart_cngetc(dev_t dev) splx(s); - return c & 0xff; + return c; } static void
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Feb 11 08:35:12 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: copyinout.S cpufunc_asm_armv8.S fusu.S idle_machdep.S lock_stubs.S pmap_page.S Log Message: include "opt_gprof.h" so that _PROF_PROLOGUE works properly in ENTRY() macro in *.S files To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/aarch64/copyinout.S cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/fusu.S cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/idle_machdep.S cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/lock_stubs.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/pmap_page.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/copyinout.S diff -u src/sys/arch/aarch64/aarch64/copyinout.S:1.15 src/sys/arch/aarch64/aarch64/copyinout.S:1.16 --- src/sys/arch/aarch64/aarch64/copyinout.S:1.15 Wed Aug 12 13:19:35 2020 +++ src/sys/arch/aarch64/aarch64/copyinout.S Thu Feb 11 08:35:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinout.S,v 1.15 2020/08/12 13:19:35 skrll Exp $ */ +/* $NetBSD: copyinout.S,v 1.16 2021/02/11 08:35:11 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,11 +29,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_gprof.h" #include #include #include "assym.h" -RCSID("$NetBSD: copyinout.S,v 1.15 2020/08/12 13:19:35 skrll Exp $"); +RCSID("$NetBSD: copyinout.S,v 1.16 2021/02/11 08:35:11 ryo Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ Index: src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S diff -u src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S:1.7 src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S:1.8 --- src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S:1.7 Sun Jul 19 07:18:07 2020 +++ src/sys/arch/aarch64/aarch64/cpufunc_asm_armv8.S Thu Feb 11 08:35:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc_asm_armv8.S,v 1.7 2020/07/19 07:18:07 ryo Exp $ */ +/* $NetBSD: cpufunc_asm_armv8.S,v 1.8 2021/02/11 08:35:11 ryo Exp $ */ /*- * Copyright (c) 2014 Robin Randhawa @@ -33,6 +33,7 @@ */ #include "opt_cputypes.h" +#include "opt_gprof.h" #include "opt_multiprocessor.h" #include Index: src/sys/arch/aarch64/aarch64/fusu.S diff -u src/sys/arch/aarch64/aarch64/fusu.S:1.10 src/sys/arch/aarch64/aarch64/fusu.S:1.11 --- src/sys/arch/aarch64/aarch64/fusu.S:1.10 Wed Aug 12 13:19:35 2020 +++ src/sys/arch/aarch64/aarch64/fusu.S Thu Feb 11 08:35:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fusu.S,v 1.10 2020/08/12 13:19:35 skrll Exp $ */ +/* $NetBSD: fusu.S,v 1.11 2021/02/11 08:35:11 ryo Exp $ */ /*- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc. @@ -29,10 +29,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_gprof.h" #include #include "assym.h" -RCSID("$NetBSD: fusu.S,v 1.10 2020/08/12 13:19:35 skrll Exp $"); +RCSID("$NetBSD: fusu.S,v 1.11 2021/02/11 08:35:11 ryo Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ Index: src/sys/arch/aarch64/aarch64/idle_machdep.S diff -u src/sys/arch/aarch64/aarch64/idle_machdep.S:1.6 src/sys/arch/aarch64/aarch64/idle_machdep.S:1.7 --- src/sys/arch/aarch64/aarch64/idle_machdep.S:1.6 Wed Aug 12 13:19:35 2020 +++ src/sys/arch/aarch64/aarch64/idle_machdep.S Thu Feb 11 08:35:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: idle_machdep.S,v 1.6 2020/08/12 13:19:35 skrll Exp $ */ +/* $NetBSD: idle_machdep.S,v 1.7 2021/02/11 08:35:12 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -29,13 +29,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_arm_intr_impl.h" +#include "opt_ddb.h" +#include "opt_gprof.h" #include #include #include "assym.h" -#include "opt_arm_intr_impl.h" -#include "opt_ddb.h" -RCSID("$NetBSD: idle_machdep.S,v 1.6 2020/08/12 13:19:35 skrll Exp $"); +RCSID("$NetBSD: idle_machdep.S,v 1.7 2021/02/11 08:35:12 ryo Exp $"); #ifdef ARM_INTR_IMPL #include ARM_INTR_IMPL Index: src/sys/arch/aarch64/aarch64/lock_stubs.S diff -u src/sys/arch/aarch64/aarch64/lock_stubs.S:1.3 src/sys/arch/aarch64/aarch64/lock_stubs.S:1.4 --- src/sys/arch/aarch64/aarch64/lock_stubs.S:1.3 Tue Oct 13 21:27:18 2020 +++ src/sys/arch/aarch64/aarch64/lock_stubs.S Thu Feb 11 08:35:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.3 2020/10/13 21:27:18 skrll Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.4 2021/02/11 08:35:12 ryo Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -29,13 +29,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_gprof.h" #include "opt_lockdebug.h" #include #include "assym.h" -RCSID("$NetBSD: lock_stubs.S,v 1.3 2020/10/13 21:27:18 skrll Exp $") +RCSID("$NetBSD: lock_stubs.S,v 1.4 2021/02/11 08:35:12 ryo Exp $") #ifndef LOCKDEBUG /* Index: src/sys/arch/aarch64/aarch64/pmap_page.S diff -u
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Wed Feb 10 12:31:34 UTC 2021 Modified Files: src/sys/arch/aarch64/include: profile.h Log Message: Oh...the name of the mcount call was different between gcc and llvm. gcc calls it as "_mconut", llvm calls as "__mcount". Change the main name of mcount to "mcount()", and created "_mcount" and "__mcount" entries to work regardless of which compiler the object was created with. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/profile.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/profile.h diff -u src/sys/arch/aarch64/include/profile.h:1.3 src/sys/arch/aarch64/include/profile.h:1.4 --- src/sys/arch/aarch64/include/profile.h:1.3 Wed Feb 10 08:25:01 2021 +++ src/sys/arch/aarch64/include/profile.h Wed Feb 10 12:31:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: profile.h,v 1.3 2021/02/10 08:25:01 ryo Exp $ */ +/* $NetBSD: profile.h,v 1.4 2021/02/10 12:31:34 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #ifdef __aarch64__ -#define _MCOUNT_DECL void _mcount +#define _MCOUNT_DECL void mcount /* * Cannot implement mcount in C as GCC will trash the ip register when it @@ -39,7 +39,8 @@ * prologue. */ -#define MCOUNT_ASM_NAME "__mcount" +#define MCOUNT_ASM_NAME "_mcount" /* gcc */ +#define MCOUNT_ASM_NAME_ALIAS "__mcount" /* llvm */ #define PLTSYM #define MCOUNT\ @@ -47,7 +48,9 @@ __asm(".align 6"); \ __asm(".type " MCOUNT_ASM_NAME ",@function"); \ __asm(".global " MCOUNT_ASM_NAME);\ + __asm(".global " MCOUNT_ASM_NAME_ALIAS); \ __asm(MCOUNT_ASM_NAME ":"); \ + __asm(MCOUNT_ASM_NAME_ALIAS ":");\ /*\ * Preserve registers that are trashed during mcount \ */\ @@ -70,7 +73,7 @@ /*\ * Call the real mcount code \ */\ - __asm("bl " ___STRING(_C_LABEL(_mcount))); \ + __asm("bl " ___STRING(_C_LABEL(mcount))); \ /*\ * Restore registers that were trashed during mcount \ */\
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Wed Feb 10 08:25:01 UTC 2021 Modified Files: src/sys/arch/aarch64/conf: Makefile.aarch64 kern.ldscript src/sys/arch/aarch64/include: profile.h Log Message: add support kernel profiling on aarch64 - add MCOUNT_ENTER, MCOUNT_EXIT macro - __mcount() function should be aligned - add "-fno-optimize-sibling-calls" option when PROF. for accurate profiling, it is better to suppress the tail call. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/conf/Makefile.aarch64 cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/conf/kern.ldscript cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/include/profile.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/conf/Makefile.aarch64 diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.21 src/sys/arch/aarch64/conf/Makefile.aarch64:1.22 --- src/sys/arch/aarch64/conf/Makefile.aarch64:1.21 Mon May 11 03:00:57 2020 +++ src/sys/arch/aarch64/conf/Makefile.aarch64 Wed Feb 10 08:25:01 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.aarch64,v 1.21 2020/05/11 03:00:57 ryo Exp $ +# $NetBSD: Makefile.aarch64,v 1.22 2021/02/10 08:25:01 ryo Exp $ # Makefile for NetBSD # @@ -39,6 +39,11 @@ CFLAGS+= -fno-omit-frame-pointer CFLAGS+= -mno-omit-leaf-frame-pointer #CFLAGS+= -mno-unaligned-access +.if defined(PROF) && ${HAVE_GCC:U0} > 0 +# For accurate profiling, it is better to suppress the tail call. +CFLAGS+= -fno-optimize-sibling-calls +.endif + .if ${HAVE_LLVM:Uno} == "yes" .if ${ARMV83_PAC:U0} > 0 && ${ARMV85_BTI:U0} > 0 CFLAGS+= -mbranch-protection=pac-ret+bti Index: src/sys/arch/aarch64/conf/kern.ldscript diff -u src/sys/arch/aarch64/conf/kern.ldscript:1.11 src/sys/arch/aarch64/conf/kern.ldscript:1.12 --- src/sys/arch/aarch64/conf/kern.ldscript:1.11 Thu Nov 1 20:34:49 2018 +++ src/sys/arch/aarch64/conf/kern.ldscript Wed Feb 10 08:25:01 2021 @@ -11,6 +11,7 @@ SECTIONS .text : { PROVIDE(__kernel_text = .); + PROVIDE(kernel_text = .); *(.text) *(.text.*) *(.stub) Index: src/sys/arch/aarch64/include/profile.h diff -u src/sys/arch/aarch64/include/profile.h:1.2 src/sys/arch/aarch64/include/profile.h:1.3 --- src/sys/arch/aarch64/include/profile.h:1.2 Thu Apr 23 23:22:41 2020 +++ src/sys/arch/aarch64/include/profile.h Wed Feb 10 08:25:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: profile.h,v 1.2 2020/04/23 23:22:41 jakllsch Exp $ */ +/* $NetBSD: profile.h,v 1.3 2021/02/10 08:25:01 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ #define MCOUNT\ __asm(".text"); \ - __asm(".align 0"); \ + __asm(".align 6"); \ __asm(".type " MCOUNT_ASM_NAME ",@function"); \ __asm(".global " MCOUNT_ASM_NAME);\ __asm(MCOUNT_ASM_NAME ":"); \ @@ -82,6 +82,13 @@ __asm("ret"); \ __asm(".size " MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME); +#ifdef _KERNEL +#define MCOUNT_ENTER \ + __asm __volatile ("mrs %x0, daif; msr daifset, #3": "=r"(s):: "memory") +#define MCOUNT_EXIT \ + __asm __volatile ("msr daif, %x0":: "r"(s): "memory") +#endif /* _KERNEL */ + #elif defined(__arm__) #include
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: ryo Date: Tue Feb 9 17:44:01 UTC 2021 Modified Files: src/sys/arch/arm/cortex: gicv3.c Log Message: fix build without MULTIPROCESSOR To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/cortex/gicv3.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/cortex/gicv3.c diff -u src/sys/arch/arm/cortex/gicv3.c:1.40 src/sys/arch/arm/cortex/gicv3.c:1.41 --- src/sys/arch/arm/cortex/gicv3.c:1.40 Sun Feb 7 21:24:50 2021 +++ src/sys/arch/arm/cortex/gicv3.c Tue Feb 9 17:44:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3.c,v 1.40 2021/02/07 21:24:50 jmcneill Exp $ */ +/* $NetBSD: gicv3.c,v 1.41 2021/02/09 17:44:01 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -31,7 +31,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.40 2021/02/07 21:24:50 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.41 2021/02/09 17:44:01 ryo Exp $"); #include #include @@ -79,11 +79,13 @@ gicd_write_4(struct gicv3_softc *sc, bus bus_space_write_4(sc->sc_bst, sc->sc_bsh_d, reg, val); } +#ifdef MULTIPROCESSOR static inline uint64_t gicd_read_8(struct gicv3_softc *sc, bus_size_t reg) { return bus_space_read_8(sc->sc_bst, sc->sc_bsh_d, reg); } +#endif static inline void gicd_write_8(struct gicv3_softc *sc, bus_size_t reg, uint64_t val)
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Mon Feb 1 18:12:11 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c Log Message: It is enough to make a page accessible instead of writable. same fix as r1.76 To generate a diff of this commit: cvs rdiff -u -r1.100 -r1.101 src/sys/arch/aarch64/aarch64/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.100 src/sys/arch/aarch64/aarch64/pmap.c:1.101 --- src/sys/arch/aarch64/aarch64/pmap.c:1.100 Sun Jan 31 04:51:29 2021 +++ src/sys/arch/aarch64/aarch64/pmap.c Mon Feb 1 18:12:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.100 2021/01/31 04:51:29 ryo Exp $ */ +/* $NetBSD: pmap.c,v 1.101 2021/02/01 18:12:11 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2021/01/31 04:51:29 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2021/02/01 18:12:11 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -960,20 +960,17 @@ pmap_icache_sync_range(pmap_t pm, vaddr_ vaddr_t eob = (va + blocksize) & ~(blocksize - 1); vsize_t len = ulmin(eva, eob) - va; - if (l3pte_writable(pte)) { + if (l3pte_readable(pte)) { cpu_icache_sync_range(va, len); } else { /* - * change to writable temporally + * change to accessible temporally * to do cpu_icache_sync_range() */ -pt_entry_t opte = pte; -pte = pte & ~(LX_BLKPAG_AF|LX_BLKPAG_AP); -pte |= (LX_BLKPAG_AF|LX_BLKPAG_AP_RW); -atomic_swap_64(ptep, pte); +atomic_swap_64(ptep, pte | LX_BLKPAG_AF); AARCH64_TLBI_BY_ASID_VA(pm->pm_asid, va, true); cpu_icache_sync_range(va, len); -atomic_swap_64(ptep, opte); +atomic_swap_64(ptep, pte); AARCH64_TLBI_BY_ASID_VA(pm->pm_asid, va, true); } }
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Sun Jan 31 04:51:29 UTC 2021 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c src/sys/arch/aarch64/include: pmap.h Log Message: implement pmap_remove_all(). The size of struct pv_entry has increased, but speed of kernel build has improved by about 1% exec and exit should have been improved. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/arch/aarch64/aarch64/pmap.c cvs rdiff -u -r1.43 -r1.44 src/sys/arch/aarch64/include/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.99 src/sys/arch/aarch64/aarch64/pmap.c:1.100 --- src/sys/arch/aarch64/aarch64/pmap.c:1.99 Sun Dec 20 08:26:32 2020 +++ src/sys/arch/aarch64/aarch64/pmap.c Sun Jan 31 04:51:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.99 2020/12/20 08:26:32 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.100 2021/01/31 04:51:29 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.99 2020/12/20 08:26:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.100 2021/01/31 04:51:29 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -485,6 +485,7 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v kpm->pm_l0table_pa = l0pa; kpm->pm_activated = true; LIST_INIT(>pm_vmlist); + LIST_INIT(>pm_pvlist); /* not used for kernel pmap */ mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_NONE); CTASSERT(sizeof(kpm->pm_stats.wired_count) == sizeof(long)); @@ -719,11 +720,14 @@ _pmap_sweep_pdp(struct pmap *pm) } static void -_pmap_free_pdp_all(struct pmap *pm) +_pmap_free_pdp_all(struct pmap *pm, bool free_l0) { - struct vm_page *pg; + struct vm_page *pg, *pgtmp, *pg_reserve; - while ((pg = LIST_FIRST(>pm_vmlist)) != NULL) { + pg_reserve = free_l0 ? NULL : PHYS_TO_VM_PAGE(pm->pm_l0table_pa); + LIST_FOREACH_SAFE(pg, >pm_vmlist, pageq.list, pgtmp) { + if (pg == pg_reserve) + continue; pmap_free_pdp(pm, pg); } } @@ -1101,6 +1105,7 @@ _pmap_remove_pv(struct pmap_page *pp, st UVMHIST_LOG(pmaphist, "pp=%p, pm=%p, va=%llx, pte=%llx", pp, pm, va, pte); + KASSERT(mutex_owned(>pm_lock)); /* for pv_proc */ KASSERT(mutex_owned(>pp_pvlock)); for (ppv = NULL, pv = >pp_pv; pv != NULL; pv = pv->pv_next) { @@ -1109,6 +1114,10 @@ _pmap_remove_pv(struct pmap_page *pp, st } ppv = pv; } + + if (pm != pmap_kernel() && pv != NULL) + LIST_REMOVE(pv, pv_proc); + if (ppv == NULL) { /* embedded in pmap_page */ pv->pv_pmap = NULL; @@ -1234,6 +1243,9 @@ _pmap_enter_pv(struct pmap_page *pp, str pv->pv_ptep = ptep; PMAP_COUNT(pv_enter); + if (pm != pmap_kernel()) + LIST_INSERT_HEAD(>pm_pvlist, pv, pv_proc); + #ifdef PMAP_PV_DEBUG printf("pv %p alias added va=%016lx -> pa=%016lx\n", pv, va, pa); pv_dump(pp, printf); @@ -1499,6 +1511,7 @@ pmap_create(void) pm->pm_idlepdp = 0; pm->pm_asid = -1; LIST_INIT(>pm_vmlist); + LIST_INIT(>pm_pvlist); mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_NONE); pm->pm_l0table_pa = pmap_alloc_pdp(pm, NULL, 0, true); @@ -1535,9 +1548,13 @@ pmap_destroy(struct pmap *pm) if (refcnt > 0) return; - aarch64_tlbi_by_asid(pm->pm_asid); + KASSERT(LIST_EMPTY(>pm_pvlist)); - _pmap_free_pdp_all(pm); + /* + * no need to call aarch64_tlbi_by_asid(pm->pm_asid). + * TLB should already be invalidated in pmap_remove_all() + */ + _pmap_free_pdp_all(pm, true); mutex_destroy(>pm_lock); pool_cache_put(&_pmap_cache, pm); @@ -2034,8 +2051,64 @@ pmap_enter(struct pmap *pm, vaddr_t va, bool pmap_remove_all(struct pmap *pm) { - /* nothing to do */ - return false; + struct pmap_page *pp; + struct pv_entry *pv, *pvtmp, *opv, *pvtofree = NULL; + pt_entry_t pte, *ptep; + paddr_t pa; + + UVMHIST_FUNC(__func__); + UVMHIST_CALLED(pmaphist); + + UVMHIST_LOG(pmaphist, "pm=%p", pm, 0, 0, 0); + + if (pm == pmap_kernel()) + return false; + + pm_lock(pm); + + LIST_FOREACH_SAFE(pv, >pm_pvlist, pv_proc, pvtmp) { + ptep = pv->pv_ptep; + pte = *ptep; + + KASSERTMSG(lxpde_valid(pte), + "pte is not valid: pmap=%p, asid=%d, va=%016lx\n", + pm, pm->pm_asid, pv->pv_va); + + pa = lxpde_pa(pte); + pp = phys_to_pp(pa); + + KASSERTMSG(pp != NULL, + "no pmap_page of physical address:%016lx, " + "pmap=%p, asid=%d, va=%016lx\n", + pa, pm, pm->pm_asid, pv->pv_va); + + pmap_pv_lock(pp); + opv = _pmap_remove_pv(pp, pm, trunc_page(pv->pv_va), pte); + pmap_pv_unlock(pp); + if (opv != NULL) { + opv->pv_next = pvtofree; + pvtofree = opv; + } + } + /* all PTE should now be cleared */ + pm->pm_stats.wired_count = 0; + pm->pm_stats.re
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Sat Jan 16 09:09:37 UTC 2021 Modified Files: src/sys/dev/fdt: fdtvar.h Log Message: oops, fix mistake in previous commit. removed unwanted member that had been added. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.67 src/sys/dev/fdt/fdtvar.h:1.68 --- src/sys/dev/fdt/fdtvar.h:1.67 Fri Jan 15 22:59:49 2021 +++ src/sys/dev/fdt/fdtvar.h Sat Jan 16 09:09:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.67 2021/01/15 22:59:49 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.68 2021/01/16 09:09:37 ryo Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -77,8 +77,6 @@ struct fdtbus_interrupt_controller_func bool (*intrstr)(device_t, u_int *, char *, size_t); void (*mask)(device_t, void *); void (*unmask)(device_t, void *); - void * (*establish_xname)(device_t, u_int *, int, int, - int (*)(void *), void *, const char *); }; struct fdtbus_spi_controller_func {
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jan 15 20:50:49 UTC 2021 Modified Files: src/sys/dev/fdt: arasan_sdhc_fdt.c dw_apb_uart.c dwc3_fdt.c dwcmmc_fdt.c ehci_fdt.c ohci_fdt.c Log Message: use fdtbus_intr_establish_xname To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/arasan_sdhc_fdt.c \ src/sys/dev/fdt/ohci_fdt.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/dw_apb_uart.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/fdt/dwc3_fdt.c \ src/sys/dev/fdt/dwcmmc_fdt.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/ehci_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/arasan_sdhc_fdt.c diff -u src/sys/dev/fdt/arasan_sdhc_fdt.c:1.3 src/sys/dev/fdt/arasan_sdhc_fdt.c:1.4 --- src/sys/dev/fdt/arasan_sdhc_fdt.c:1.3 Wed Jul 3 23:10:43 2019 +++ src/sys/dev/fdt/arasan_sdhc_fdt.c Fri Jan 15 20:50:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arasan_sdhc_fdt.c,v 1.3 2019/07/03 23:10:43 jmcneill Exp $ */ +/* $NetBSD: arasan_sdhc_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.3 2019/07/03 23:10:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arasan_sdhc_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $"); #include #include @@ -306,7 +306,8 @@ arasan_sdhc_attach(device_t parent, devi fdtbus_register_clock_controller(self, phandle, _sdhc_fdt_clk_funcs); - ih = fdtbus_intr_establish(phandle, 0, IPL_SDMMC, 0, sdhc_intr, >sc_base); + ih = fdtbus_intr_establish_xname(phandle, 0, IPL_SDMMC, 0, + sdhc_intr, >sc_base, device_xname(self)); if (ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n", intrstr); return; Index: src/sys/dev/fdt/ohci_fdt.c diff -u src/sys/dev/fdt/ohci_fdt.c:1.3 src/sys/dev/fdt/ohci_fdt.c:1.4 --- src/sys/dev/fdt/ohci_fdt.c:1.3 Sun Aug 12 16:33:58 2018 +++ src/sys/dev/fdt/ohci_fdt.c Fri Jan 15 20:50:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci_fdt.c,v 1.3 2018/08/12 16:33:58 jmcneill Exp $ */ +/* $NetBSD: ohci_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $ */ /*- * Copyright (c) 2015-2017 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci_fdt.c,v 1.3 2018/08/12 16:33:58 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci_fdt.c,v 1.4 2021/01/15 20:50:49 ryo Exp $"); #include #include @@ -128,8 +128,8 @@ ohci_fdt_attach(device_t parent, device_ return; } - ih = fdtbus_intr_establish(phandle, 0, IPL_USB, FDT_INTR_MPSAFE, - ohci_intr, sc); + ih = fdtbus_intr_establish_xname(phandle, 0, IPL_USB, FDT_INTR_MPSAFE, + ohci_intr, sc, device_xname(self)); if (ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n", intrstr); Index: src/sys/dev/fdt/dw_apb_uart.c diff -u src/sys/dev/fdt/dw_apb_uart.c:1.8 src/sys/dev/fdt/dw_apb_uart.c:1.9 --- src/sys/dev/fdt/dw_apb_uart.c:1.8 Fri Oct 2 14:59:56 2020 +++ src/sys/dev/fdt/dw_apb_uart.c Fri Jan 15 20:50:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dw_apb_uart.c,v 1.8 2020/10/02 14:59:56 rin Exp $ */ +/* $NetBSD: dw_apb_uart.c,v 1.9 2021/01/15 20:50:49 ryo Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.8 2020/10/02 14:59:56 rin Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dw_apb_uart.c,v 1.9 2021/01/15 20:50:49 ryo Exp $"); #include #include @@ -136,8 +136,8 @@ dw_apb_uart_attach(device_t parent, devi return; } - ssc->ssc_ih = fdtbus_intr_establish(faa->faa_phandle, 0, IPL_SERIAL, - FDT_INTR_MPSAFE, comintr, sc); + ssc->ssc_ih = fdtbus_intr_establish_xname(faa->faa_phandle, 0, + IPL_SERIAL, FDT_INTR_MPSAFE, comintr, sc, device_xname(self)); if (ssc->ssc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr); Index: src/sys/dev/fdt/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.11 src/sys/dev/fdt/dwc3_fdt.c:1.12 --- src/sys/dev/fdt/dwc3_fdt.c:1.11 Thu Oct 15 09:33:44 2020 +++ src/sys/dev/fdt/dwc3_fdt.c Fri Jan 15 20:50:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.11 2020/10/15 09:33:44 jmcneill Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.12 2021/01/15 20:50:49 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.11 2020/10/15 09:33:44 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.12 2021/01/15 20:50:49 ryo Exp $"); #include #include @@ -306,8 +306,8 @@ dwc3_fdt_attach(device_t parent, device_ return; } - ih = fdtbus_intr_establish(dwc3_phandle, 0, IPL_USB, FDT_INTR_MPSAFE, - xhci_intr, sc); + ih = fdtbus_intr_establish_xname(dwc3_phandle, 0, IPL_USB, + FDT_INTR_MPSAFE, xhci_intr, sc, device_xname(self)); if (ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n", intrstr); Index:
CVS commit: src/sys/arch/arm
Module Name:src Committed By: ryo Date: Fri Jan 15 18:42:41 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c meson_sdhc.c meson_sdio.c meson_uart.c mesongx_mmc.c src/sys/arch/arm/fdt: a9ptmr_fdt.c a9tmr_fdt.c aaci_fdt.c gtmr_fdt.c plcom_fdt.c plkmi_fdt.c plmmc_fdt.c pmu_fdt.c smsh_fdt.c src/sys/arch/arm/rockchip: rk_gmac.c rk_i2s.c rk_spi.c rk_tsadc.c Log Message: use fdtbus_intr_establish_xname To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/amlogic/meson_dwmac.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/amlogic/meson_sdhc.c \ src/sys/arch/arm/amlogic/meson_sdio.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/amlogic/meson_uart.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/mesongx_mmc.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/a9ptmr_fdt.c \ src/sys/arch/arm/fdt/aaci_fdt.c src/sys/arch/arm/fdt/plkmi_fdt.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/fdt/a9tmr_fdt.c \ src/sys/arch/arm/fdt/plcom_fdt.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/fdt/gtmr_fdt.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/fdt/plmmc_fdt.c \ src/sys/arch/arm/fdt/smsh_fdt.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/pmu_fdt.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/rockchip/rk_gmac.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_i2s.c cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_spi.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/rockchip/rk_tsadc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_dwmac.c diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.9 src/sys/arch/arm/amlogic/meson_dwmac.c:1.10 --- src/sys/arch/arm/amlogic/meson_dwmac.c:1.9 Fri Jan 1 07:18:23 2021 +++ src/sys/arch/arm/amlogic/meson_dwmac.c Fri Jan 15 18:42:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $ */ +/* $NetBSD: meson_dwmac.c,v 1.10 2021/01/15 18:42:40 ryo Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.10 2021/01/15 18:42:40 ryo Exp $"); #include #include @@ -229,8 +229,9 @@ meson_dwmac_attach(device_t parent, devi aprint_naive("\n"); aprint_normal(": Gigabit Ethernet Controller\n"); - if (fdtbus_intr_establish(phandle, 0, IPL_NET, DWCGMAC_FDT_INTR_MPSAFE, - meson_dwmac_intr, sc) == NULL) { + if (fdtbus_intr_establish_xname(phandle, 0, IPL_NET, + DWCGMAC_FDT_INTR_MPSAFE, meson_dwmac_intr, sc, + device_xname(sc->sc_dev)) == NULL) { aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr); return; } Index: src/sys/arch/arm/amlogic/meson_sdhc.c diff -u src/sys/arch/arm/amlogic/meson_sdhc.c:1.1 src/sys/arch/arm/amlogic/meson_sdhc.c:1.2 --- src/sys/arch/arm/amlogic/meson_sdhc.c:1.1 Sun Jan 20 00:44:01 2019 +++ src/sys/arch/arm/amlogic/meson_sdhc.c Fri Jan 15 18:42:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_sdhc.c,v 1.1 2019/01/20 00:44:01 jmcneill Exp $ */ +/* $NetBSD: meson_sdhc.c,v 1.2 2021/01/15 18:42:40 ryo Exp $ */ /*- * Copyright (c) 2015-2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_sdhc.c,v 1.1 2019/01/20 00:44:01 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_sdhc.c,v 1.2 2021/01/15 18:42:40 ryo Exp $"); #include #include @@ -244,8 +244,8 @@ meson_sdhc_attach(device_t parent, devic sc->sc_non_removable = of_hasprop(sc->sc_slot_phandle, "non-removable"); sc->sc_broken_cd = of_hasprop(sc->sc_slot_phandle, "broken-cd"); - sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0, - meson_sdhc_intr, sc); + sc->sc_ih = fdtbus_intr_establish_xname(phandle, 0, IPL_BIO, 0, + meson_sdhc_intr, sc, device_xname(self)); if (sc->sc_ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n", intrstr); Index: src/sys/arch/arm/amlogic/meson_sdio.c diff -u src/sys/arch/arm/amlogic/meson_sdio.c:1.1 src/sys/arch/arm/amlogic/meson_sdio.c:1.2 --- src/sys/arch/arm/amlogic/meson_sdio.c:1.1 Sat Jan 19 20:56:03 2019 +++ src/sys/arch/arm/amlogic/meson_sdio.c Fri Jan 15 18:42:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_sdio.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $ */ +/* $NetBSD: meson_sdio.c,v 1.2 2021/01/15 18:42:40 ryo Exp $ */ /*- * Copyright (c) 2015-2019 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_sdio.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_sdio.c,v 1.2 2021/01/15 18:42:40 ryo Exp $"); #include #include @@ -224,7 +224,8 @@ meson_sdio_attach(device_t parent, devic sc->sc_non_removable = of_hasprop(sc->sc_slot_phandle, "non-removable"); sc->sc_broken_cd = of_hasprop(sc->sc_slot_phandle, "broken-cd"); - sc->sc_ih = fdtbus_intr_establish(phandle, 0,
CVS commit: src/sys
Module Name:src Committed By: ryo Date: Fri Jan 15 17:17:05 UTC 2021 Modified Files: src/sys/arch/arm/fdt: pcihost_fdt.c src/sys/dev/fdt: fdt_intr.c fdtvar.h Log Message: add fdtbus_intr_establish_xname() function To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/fdt/pcihost_fdt.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/fdt/fdt_intr.c cvs rdiff -u -r1.65 -r1.66 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/fdt/pcihost_fdt.c diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.18 src/sys/arch/arm/fdt/pcihost_fdt.c:1.19 --- src/sys/arch/arm/fdt/pcihost_fdt.c:1.18 Sat Oct 10 09:58:16 2020 +++ src/sys/arch/arm/fdt/pcihost_fdt.c Fri Jan 15 17:17:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pcihost_fdt.c,v 1.18 2020/10/10 09:58:16 jmcneill Exp $ */ +/* $NetBSD: pcihost_fdt.c,v 1.19 2021/01/15 17:17:04 ryo Exp $ */ /*- * Copyright (c) 2018 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.18 2020/10/10 09:58:16 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.19 2021/01/15 17:17:04 ryo Exp $"); #include @@ -612,7 +612,8 @@ pcihost_intr_establish(void *v, pci_intr if (specifier == NULL) return NULL; - return fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags, callback, arg); + return fdtbus_intr_establish_raw(ihandle, specifier, ipl, flags, + callback, arg, xname); } static void Index: src/sys/dev/fdt/fdt_intr.c diff -u src/sys/dev/fdt/fdt_intr.c:1.27 src/sys/dev/fdt/fdt_intr.c:1.28 --- src/sys/dev/fdt/fdt_intr.c:1.27 Fri Jan 15 00:38:23 2021 +++ src/sys/dev/fdt/fdt_intr.c Fri Jan 15 17:17:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_intr.c,v 1.27 2021/01/15 00:38:23 jmcneill Exp $ */ +/* $NetBSD: fdt_intr.c,v 1.28 2021/01/15 17:17:04 ryo Exp $ */ /*- * Copyright (c) 2015-2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.27 2021/01/15 00:38:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.28 2021/01/15 17:17:04 ryo Exp $"); #include #include @@ -181,6 +181,14 @@ void * fdtbus_intr_establish(int phandle, u_int index, int ipl, int flags, int (*func)(void *), void *arg) { + return fdtbus_intr_establish_xname(phandle, index, ipl, flags, + func, arg, NULL); +} + +void * +fdtbus_intr_establish_xname(int phandle, u_int index, int ipl, int flags, +int (*func)(void *), void *arg, const char *xname) +{ const u_int *specifier; int ihandle; @@ -189,7 +197,7 @@ fdtbus_intr_establish(int phandle, u_int return NULL; return fdtbus_intr_establish_raw(ihandle, specifier, ipl, - flags, func, arg); + flags, func, arg, xname); } void * @@ -208,7 +216,7 @@ fdtbus_intr_establish_byname(int phandle void * fdtbus_intr_establish_raw(int ihandle, const u_int *specifier, int ipl, -int flags, int (*func)(void *), void *arg) +int flags, int (*func)(void *), void *arg, const char *xname) { struct fdtbus_interrupt_controller *ic; struct fdtbus_interrupt_cookie *c; @@ -235,7 +243,7 @@ fdtbus_intr_establish_raw(int ihandle, c * and hope that the device won't actually interrupt until we return. */ ih = ic->ic_funcs->establish(ic->ic_dev, __UNCONST(specifier), - ipl, flags, func, arg, NULL); + ipl, flags, func, arg, xname); if (ih != NULL) { atomic_store_release(>c_ih, ih); } else { Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.65 src/sys/dev/fdt/fdtvar.h:1.66 --- src/sys/dev/fdt/fdtvar.h:1.65 Fri Jan 15 00:38:23 2021 +++ src/sys/dev/fdt/fdtvar.h Fri Jan 15 17:17:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.65 2021/01/15 00:38:23 jmcneill Exp $ */ +/* $NetBSD: fdtvar.h,v 1.66 2021/01/15 17:17:04 ryo Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -77,6 +77,8 @@ struct fdtbus_interrupt_controller_func bool (*intrstr)(device_t, u_int *, char *, size_t); void (*mask)(device_t, void *); void (*unmask)(device_t, void *); + void * (*establish_xname)(device_t, u_int *, int, int, + int (*)(void *), void *, const char *); }; struct fdtbus_spi_controller_func { @@ -317,10 +319,12 @@ i2c_tag_t fdtbus_get_i2c_tag(int); i2c_tag_t fdtbus_i2c_acquire(int, const char *); void * fdtbus_intr_establish(int, u_int, int, int, int (*func)(void *), void *arg); +void * fdtbus_intr_establish_xname(int, u_int, int, int, + int (*func)(void *), void *arg, const char *); void * fdtbus_intr_establish_byname(int, const char *, int, int, int (*func)(void *), void *arg); void * fdtbus_intr_establish_raw(int, const u_int *, int, int, - int (*func)(void *), void *arg); + int (*func)(void *), void *arg, const char *); void fdtbus_intr_mask(int, void *); void fdtbus_intr_unmask(int, void *); void fdtbus_intr_disestablish(int, void *);
CVS commit: src/usr.sbin/cpuctl/arch
Module Name:src Committed By: ryo Date: Mon Jan 4 05:35:15 UTC 2021 Modified Files: src/usr.sbin/cpuctl/arch: aarch64.c Log Message: sync cpuids[] of sys/arch/aarch64/aarch64/cpu.c r1.43 To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/cpuctl/arch/aarch64.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/cpuctl/arch/aarch64.c diff -u src/usr.sbin/cpuctl/arch/aarch64.c:1.12 src/usr.sbin/cpuctl/arch/aarch64.c:1.13 --- src/usr.sbin/cpuctl/arch/aarch64.c:1.12 Sat Oct 10 08:27:41 2020 +++ src/usr.sbin/cpuctl/arch/aarch64.c Mon Jan 4 05:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: aarch64.c,v 1.12 2020/10/10 08:27:41 jmcneill Exp $ */ +/* $NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -29,7 +29,7 @@ #include #ifndef lint -__RCSID("$NetBSD: aarch64.c,v 1.12 2020/10/10 08:27:41 jmcneill Exp $"); +__RCSID("$NetBSD: aarch64.c,v 1.13 2021/01/04 05:35:14 ryo Exp $"); #endif /* no lint */ #include @@ -72,17 +72,25 @@ struct fieldinfo { #define CPU_PARTMASK (CPU_ID_IMPLEMENTOR_MASK | CPU_ID_PARTNO_MASK) const struct cpuidtab cpuids[] = { - { CPU_ID_CORTEXA53R0 & CPU_PARTMASK, "Cortex-A53", "Cortex", "V8-A" }, - { CPU_ID_CORTEXA57R0 & CPU_PARTMASK, "Cortex-A57", "Cortex", "V8-A" }, - { CPU_ID_CORTEXA72R0 & CPU_PARTMASK, "Cortex-A72", "Cortex", "V8-A" }, - { CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Cortex", "V8-A" }, - { CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Cortex", "V8.2-A" }, - { CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Cortex", "V8.2-A" }, - { CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Cortex", "V8.2-A" }, - { CPU_ID_THUNDERXRX, "Cavium ThunderX", "Cavium", "V8-A" }, - { CPU_ID_THUNDERX81XXRX, "Cavium ThunderX CN81XX", "Cavium", "V8-A" }, - { CPU_ID_THUNDERX83XXRX, "Cavium ThunderX CN83XX", "Cavium", "V8-A" }, - { CPU_ID_THUNDERX2RX, "Cavium ThunderX2", "Cavium", "V8.1-A" }, + { CPU_ID_CORTEXA35R0 & CPU_PARTMASK, "Cortex-A35", "Arm", "v8-A" }, + { CPU_ID_CORTEXA53R0 & CPU_PARTMASK, "Cortex-A53", "Arm", "v8-A" }, + { CPU_ID_CORTEXA57R0 & CPU_PARTMASK, "Cortex-A57", "Arm", "v8-A" }, + { CPU_ID_CORTEXA55R1 & CPU_PARTMASK, "Cortex-A55", "Arm", "v8.2-A+" }, + { CPU_ID_CORTEXA65R0 & CPU_PARTMASK, "Cortex-A65", "Arm", "v8.2-A+" }, + { CPU_ID_CORTEXA72R0 & CPU_PARTMASK, "Cortex-A72", "Arm", "v8-A" }, + { CPU_ID_CORTEXA73R0 & CPU_PARTMASK, "Cortex-A73", "Arm", "v8-A" }, + { CPU_ID_CORTEXA75R2 & CPU_PARTMASK, "Cortex-A75", "Arm", "v8.2-A+" }, + { CPU_ID_CORTEXA76R3 & CPU_PARTMASK, "Cortex-A76", "Arm", "v8.2-A+" }, + { CPU_ID_CORTEXA76AER1 & CPU_PARTMASK, "Cortex-A76AE", "Arm", "v8.2-A+" }, + { CPU_ID_CORTEXA77R0 & CPU_PARTMASK, "Cortex-A77", "Arm", "v8.2-A+" }, + { CPU_ID_NVIDIADENVER2 & CPU_PARTMASK, "Denver2", "NVIDIA", "v8-A" }, + { CPU_ID_EMAG8180 & CPU_PARTMASK, "eMAG", "Ampere", "v8-A" }, + { CPU_ID_NEOVERSEE1R1 & CPU_PARTMASK, "Neoverse E1", "Arm", "v8.2-A+" }, + { CPU_ID_NEOVERSEN1R3 & CPU_PARTMASK, "Neoverse N1", "Arm", "v8.2-A+" }, + { CPU_ID_THUNDERXRX, "ThunderX", "Cavium", "v8-A" }, + { CPU_ID_THUNDERX81XXRX, "ThunderX CN81XX", "Cavium", "v8-A" }, + { CPU_ID_THUNDERX83XXRX, "ThunderX CN83XX", "Cavium", "v8-A" }, + { CPU_ID_THUNDERX2RX, "ThunderX2", "Marvell", "v8.1-A" }, }; const struct impltab implids[] = {
CVS commit: src
Module Name:src Committed By: ryo Date: Sat Jan 2 11:36:36 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb src/sys/dtb/arm64/amlogic: Makefile Added Files: src/sys/arch/arm/dts: meson-g12b-odroid-n2-plus.dts Log Message: add dts for odroid-N2 plus To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/dtb/ad.aarch64eb cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts cvs rdiff -u -r1.1 -r1.2 src/sys/dtb/arm64/amlogic/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.5 src/distrib/sets/lists/dtb/ad.aarch64:1.6 --- src/distrib/sets/lists/dtb/ad.aarch64:1.5 Sat Jan 2 08:38:55 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64 Sat Jan 2 11:36:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64,v 1.5 2021/01/02 08:38:55 ryo Exp $ +# $NetBSD: ad.aarch64,v 1.6 2021/01/02 11:36:36 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/distrib/sets/lists/dtb/ad.aarch64eb diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 src/distrib/sets/lists/dtb/ad.aarch64eb:1.5 --- src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 Sat Jan 2 08:38:55 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64eb Sat Jan 2 11:36:36 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64eb,v 1.4 2021/01/02 08:38:55 ryo Exp $ +# $NetBSD: ad.aarch64eb,v 1.5 2021/01/02 11:36:36 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/sys/dtb/arm64/amlogic/Makefile diff -u src/sys/dtb/arm64/amlogic/Makefile:1.1 src/sys/dtb/arm64/amlogic/Makefile:1.2 --- src/sys/dtb/arm64/amlogic/Makefile:1.1 Mon May 18 21:19:35 2020 +++ src/sys/dtb/arm64/amlogic/Makefile Sat Jan 2 11:36:36 2021 @@ -1,8 +1,11 @@ -# $NetBSD: Makefile,v 1.1 2020/05/18 21:19:35 jmcneill Exp $ +# $NetBSD: Makefile,v 1.2 2021/01/02 11:36:36 ryo Exp $ DTSSUBDIR= amlogic DTSMAKEVARS= CONFIG_ARCH_MESON=y DTSFILESCMD= ${MAKE} -C ${ARCHDTSDIR}/${DTSSUBDIR} ${DTSMAKEVARS} -v dtb-y DTS= ${DTSFILESCMD:sh} +# Extra .dts files from sys/arch/arm/dts +DTS+= meson-g12b-odroid-n2-plus.dts + .include Added files: Index: src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts diff -u /dev/null src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts:1.1 --- /dev/null Sat Jan 2 11:36:36 2021 +++ src/sys/arch/arm/dts/meson-g12b-odroid-n2-plus.dts Sat Jan 2 11:36:36 2021 @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong + */ + +/dts-v1/; + +#include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts" + +/ { + compatible = "hardkernel,odroid-n2-plus", "amlogic,s922x", "amlogic,g12b"; + model = "Hardkernel ODROID-N2Plus"; + + vddcpu_a: regulator-vddcpu-a { + regulator-min-microvolt = <68>; + regulator-max-microvolt = <104>; + + pwms = <_ab 0 1500 0>; + + /delete-property/ pwm-dutycycle-range; + + /* Voltage Duty-Cycle */ + voltage-table = <104 0>, + <103 3>, + <102 6>, + <101 8>, + <100 11>, + <99 14>, + <98 17>, + <97 20>, + <96 23>, + <95 26>, + <94 29>, + <93 31>, + <92 34>, + <91 37>, + <90 40>, + <89 43>, + <88 45>, + <87 48>, + <86 51>, + <85 54>, + <84 56>, + <83 59>, + <82 62>, + <81 65>, + <80 68>, + <79 70>, + <78 73>, + <77 76>, + <76 79>, + <75 81>, + <74 84>, + <73 87>, + <72 89>,
CVS commit: src
Module Name:src Committed By: ryo Date: Sat Jan 2 08:38:56 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile Removed Files: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: meson-g12b-odroid-n2-plus.dts Log Message: revert http://mail-index.netbsd.org/source-changes/2021/01/01/msg125648.html FYI: http://mail-index.netbsd.org/source-changes-d/2021/01/01/msg013085.html To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/dtb/ad.aarch64eb cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile cvs rdiff -u -r1.1 -r0 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.4 src/distrib/sets/lists/dtb/ad.aarch64:1.5 --- src/distrib/sets/lists/dtb/ad.aarch64:1.4 Fri Jan 1 07:41:46 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64 Sat Jan 2 08:38:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64,v 1.4 2021/01/01 07:41:46 ryo Exp $ +# $NetBSD: ad.aarch64,v 1.5 2021/01/02 08:38:55 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,7 +40,6 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb -./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/distrib/sets/lists/dtb/ad.aarch64eb diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.3 src/distrib/sets/lists/dtb/ad.aarch64eb:1.4 --- src/distrib/sets/lists/dtb/ad.aarch64eb:1.3 Fri Jan 1 07:41:46 2021 +++ src/distrib/sets/lists/dtb/ad.aarch64eb Sat Jan 2 08:38:55 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64eb,v 1.3 2021/01/01 07:41:46 ryo Exp $ +# $NetBSD: ad.aarch64eb,v 1.4 2021/01/02 08:38:55 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,7 +40,6 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb -./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.3 --- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2 Fri Jan 1 07:41:46 2021 +++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile Sat Jan 2 08:38:55 2021 @@ -6,7 +6,6 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb -dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb
CVS commit: src/doc
Module Name:src Committed By: ryo Date: Fri Jan 1 10:12:25 UTC 2021 Modified Files: src/doc: CHANGES Log Message: evbarm: Add support for Amlogic G12 family SoCs To generate a diff of this commit: cvs rdiff -u -r1.2773 -r1.2774 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2773 src/doc/CHANGES:1.2774 --- src/doc/CHANGES:1.2773 Thu Dec 31 07:54:13 2020 +++ src/doc/CHANGES Fri Jan 1 10:12:25 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2773 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2774 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -326,3 +326,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: base for headless clients [reinoud 20201227] dhcpcd: Update to version 9.4.0 [roy 20201228] tzdata updated to 2020f (includes update to 2020e) [kre 20201231] + evbarm: Add support for Amlogic G12 family SoCs. [ryo 20210101]
CVS commit: src
Module Name:src Committed By: ryo Date: Fri Jan 1 07:41:46 UTC 2021 Modified Files: src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile Added Files: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: meson-g12b-odroid-n2-plus.dts Log Message: add dts for odroid-N2 plus. meson-g12b-odroid-n2-plus.dts of linux is not optimized for the odroid-N2plus CPU clock. and the dts for odroid-n2-plus in the hardkernel repository is significantly changed, so cannot be imported without modification. Therefore, a simple meson-g12b-odroid-n2-plus.dts has been added based on "meson-g12b-odroid-n2.dts" with only the cpu_opp_table and regulator table changed. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/dtb/ad.aarch64 cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/dtb/ad.aarch64eb cvs rdiff -u -r1.1.1.7 -r1.2 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile cvs rdiff -u -r0 -r1.1 \ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/dtb/ad.aarch64 diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.3 src/distrib/sets/lists/dtb/ad.aarch64:1.4 --- src/distrib/sets/lists/dtb/ad.aarch64:1.3 Wed Jun 10 18:53:31 2020 +++ src/distrib/sets/lists/dtb/ad.aarch64 Fri Jan 1 07:41:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64,v 1.3 2020/06/10 18:53:31 jmcneill Exp $ +# $NetBSD: ad.aarch64,v 1.4 2021/01/01 07:41:46 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/distrib/sets/lists/dtb/ad.aarch64eb diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.2 src/distrib/sets/lists/dtb/ad.aarch64eb:1.3 --- src/distrib/sets/lists/dtb/ad.aarch64eb:1.2 Wed Jun 10 18:53:31 2020 +++ src/distrib/sets/lists/dtb/ad.aarch64eb Fri Jan 1 07:41:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: ad.aarch64eb,v 1.2 2020/06/10 18:53:31 jmcneill Exp $ +# $NetBSD: ad.aarch64eb,v 1.3 2021/01/01 07:41:46 ryo Exp $ # # DO NOT EDIT THIS FILE MANUALLY # Generated by "make update-sets" in sys/dtb @@ -40,6 +40,7 @@ ./boot/dtb/amlogic/meson-g12a-u200.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb dtb-base-boot dtb +./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb dtb-base-boot dtb ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb dtb-base-boot dtb Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.1.1.7 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2 --- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.1.1.7 Fri Jan 3 14:33:37 2020 +++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile Fri Jan 1 07:41:46 2021 @@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb +dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb Added files: Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts diff -u /dev/null src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts:1.1 --- /dev/null Fri Jan 1 07:41:46 2021 +++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts Fri Jan 1 07:41:46 2021 @@ -0,0 +1,228 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 BayLibre, SAS + * Author: Neil Armstrong + */ + +/dts-v1/; + +#include "meson-g12b-odroid-n2.dts" + +/ { + compatible = "hardkernel,odroid-n2-plus",
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Fri Jan 1 07:18:23 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_dwmac.c Log Message: fix to work with various clock frequencies, and add support "amlogic,meson-axg-dwmac" To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/meson_dwmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_dwmac.c diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.8 src/sys/arch/arm/amlogic/meson_dwmac.c:1.9 --- src/sys/arch/arm/amlogic/meson_dwmac.c:1.8 Thu Feb 6 00:32:07 2020 +++ src/sys/arch/arm/amlogic/meson_dwmac.c Fri Jan 1 07:18:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $ */ +/* $NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $"); #include #include @@ -61,6 +61,7 @@ static const char * compatible[] = { "amlogic,meson8b-dwmac", "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", + "amlogic,meson-axg-dwmac", NULL }; @@ -101,7 +102,8 @@ meson_dwmac_set_mode_rgmii(int phandle, u_int tx_delay; uint32_t val; - const u_int div = clk_get_rate(clkin) / 25000; +#define DIV_ROUND_OFF(x, y) (((x) + (y) / 2) / (y)) + const u_int div = DIV_ROUND_OFF(clk_get_rate(clkin), 25000); if (of_getprop_uint32(phandle, "amlogic,tx-delay-ns", _delay) != 0) tx_delay = 2; @@ -153,6 +155,8 @@ meson_dwmac_attach(device_t parent, devi struct dwc_gmac_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; + int miiclk, phandle_phy, phy = MII_PHY_ANY; + u_int miiclk_rate; bus_space_handle_t prgeth_bsh; struct fdtbus_reset *rst_gmac; struct clk *clk_gmac, *clk_in[2]; @@ -196,6 +200,12 @@ meson_dwmac_attach(device_t parent, devi aprint_error(": missing 'phy-mode' property\n"); return; } + phandle_phy = fdtbus_get_phandle(phandle, "phy-handle"); + if (phandle_phy > 0) { + of_getprop_uint32(phandle_phy, "reg", ); + } else { + phandle_phy = phandle; + } if (strcmp(phy_mode, "rgmii") == 0) { meson_dwmac_set_mode_rgmii(phandle, sc->sc_bst, prgeth_bsh, clk_in[0]); @@ -226,10 +236,24 @@ meson_dwmac_attach(device_t parent, devi } aprint_normal_dev(self, "interrupting on %s\n", intrstr); - if (meson_dwmac_reset(phandle) != 0) + if (meson_dwmac_reset(phandle_phy) != 0) aprint_error_dev(self, "PHY reset failed\n"); - dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_100_150M_DIV62); + miiclk_rate = clk_get_rate(clk_gmac); + if (miiclk_rate > 250 * 1000 * 1000) + miiclk = GMAC_MII_CLK_250_300M_DIV124; + else if (miiclk_rate > 150 * 1000 * 1000) + miiclk = GMAC_MII_CLK_150_250M_DIV102; + else if (miiclk_rate > 100 * 1000 * 1000) + miiclk = GMAC_MII_CLK_100_150M_DIV62; + else if (miiclk_rate > 60 * 1000 * 1000) + miiclk = GMAC_MII_CLK_60_100M_DIV42; + else if (miiclk_rate > 35 * 1000 * 1000) + miiclk = GMAC_MII_CLK_35_60M_DIV26; + else + miiclk = GMAC_MII_CLK_25_35M_DIV16; + + dwc_gmac_attach(sc, phy, miiclk); } CFATTACH_DECL_NEW(meson_dwmac, sizeof(struct dwc_gmac_softc),
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Fri Jan 1 07:17:37 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: mesongx_mmc.c Log Message: adapts to some register differences to add support "amlogic,meson-axg-mmc" To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/mesongx_mmc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/mesongx_mmc.c diff -u src/sys/arch/arm/amlogic/mesongx_mmc.c:1.5 src/sys/arch/arm/amlogic/mesongx_mmc.c:1.6 --- src/sys/arch/arm/amlogic/mesongx_mmc.c:1.5 Sun Apr 21 13:08:48 2019 +++ src/sys/arch/arm/amlogic/mesongx_mmc.c Fri Jan 1 07:17:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $ */ +/* $NetBSD: mesongx_mmc.c,v 1.6 2021/01/01 07:17:36 ryo Exp $ */ /*- * Copyright (c) 2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.6 2021/01/01 07:17:36 ryo Exp $"); #include #include @@ -45,10 +45,14 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc. #include #define SD_EMMC_CLOCK 0x00 -#define CLOCK_CFG_IRQ_SDIO_SLEEP __BIT(25) -#define CLOCK_CFG_ALWAYS_ON __BIT(24) -#define CLOCK_CFG_RX_DELAY __BITS(23,20) -#define CLOCK_CFG_TX_DELAY __BITS(19,16) +#define CLOCK_CFG_V2_IRQ_SDIO_SLEEP __BIT(25) +#define CLOCK_CFG_V2_ALWAYS_ON __BIT(24) +#define CLOCK_CFG_V2_RX_DELAY __BITS(23,20) +#define CLOCK_CFG_V2_TX_DELAY __BITS(19,16) +#define CLOCK_CFG_V3_IRQ_SDIO_SLEEP __BIT(29) +#define CLOCK_CFG_V3_ALWAYS_ON __BIT(28) +#define CLOCK_CFG_V3_RX_DELAY __BITS(27,22) +#define CLOCK_CFG_V3_TX_DELAY __BITS(21,16) #define CLOCK_CFG_SRAM_PD __BITS(15,14) #define CLOCK_CFG_RX_PHASE __BITS(13,12) #define CLOCK_CFG_TX_PHASE __BITS(11,10) @@ -56,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc. #define CLOCK_CFG_SRC__BITS(7,6) #define CLOCK_CFG_DIV__BITS(5,0) #define SD_EMMC_DELAY 0x04 -#define SD_EMMC_ADJUST 0x08 +#define SD_EMMC_ADJUST 0x08 /* V2 */ #define ADJUST_ADJ_DELAY __BITS(21,16) #define ADJUST_CALI_RISE __BIT(14) #define ADJUST_ADJ_ENABLE __BIT(13) @@ -66,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc. #define CALOUT_CALI_SETUP __BITS(15,8) #define CALOUT_CALI_VLD __BIT(7) #define CALOUT_CALI_IDX __BITS(5,0) +#define SD_EMMC_V3_ADJUST 0x0c #define SD_EMMC_START 0x40 #define START_DESC_ADDR __BITS(31,2) #define START_DESC_BUSY __BIT(1) @@ -214,6 +219,7 @@ struct mesongx_mmc_softc { device_t sc_sdmmc_dev; uint32_t sc_host_ocr; + int sc_hwtype; struct sdmmc_command *sc_cmd; @@ -257,8 +263,9 @@ CFATTACH_DECL_NEW(mesongx_mmc, sizeof(st bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) static const struct of_compat_data compat_data[] = { - { "amlogic,meson-gx-mmc", 1 }, - { "amlogic,meson-gxbb-mmc", 1 }, + { "amlogic,meson-gx-mmc", 2 }, + { "amlogic,meson-gxbb-mmc", 2 }, + { "amlogic,meson-axg-mmc", 3 }, { NULL } }; @@ -280,6 +287,8 @@ mesongx_mmc_attach(device_t parent, devi bus_addr_t addr; bus_size_t size; + sc->sc_hwtype = (int)of_search_compatible(phandle, compat_data)->data; + if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); return; @@ -483,7 +492,10 @@ mesongx_mmc_set_clock(struct mesongx_mmc return ERANGE; val = MMC_READ(sc, SD_EMMC_CLOCK); - val |= CLOCK_CFG_ALWAYS_ON; + if (sc->sc_hwtype == 3) + val |= CLOCK_CFG_V3_ALWAYS_ON; + else + val |= CLOCK_CFG_V2_ALWAYS_ON; val &= ~CLOCK_CFG_RX_PHASE; val |= __SHIFTIN(0, CLOCK_CFG_RX_PHASE); val &= ~CLOCK_CFG_TX_PHASE;
CVS commit: src/sys/arch/arm/amlogic
Module Name:src Committed By: ryo Date: Fri Jan 1 07:15:18 UTC 2021 Modified Files: src/sys/arch/arm/amlogic: meson_resets.c Log Message: add "amlogic,meson-axg-reset" to compatible To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson_resets.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/amlogic/meson_resets.c diff -u src/sys/arch/arm/amlogic/meson_resets.c:1.2 src/sys/arch/arm/amlogic/meson_resets.c:1.3 --- src/sys/arch/arm/amlogic/meson_resets.c:1.2 Mon Feb 25 19:30:17 2019 +++ src/sys/arch/arm/amlogic/meson_resets.c Fri Jan 1 07:15:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */ +/* $NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $ */ /*- * Copyright (c) 2017-2019 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $"); #include #include @@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: meson_resets static const char * compatible[] = { "amlogic,meson8b-reset", + "amlogic,meson-axg-reset", "amlogic,meson-gxbb-reset", NULL };
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jan 1 03:07:51 UTC 2021 Modified Files: src/sys/dev/fdt: pwmregulator.c Log Message: - remove unnecessary code - handle "enable-gpios" property, and enable/disable GPIOs in pwmregulator_enable() pointed out by thorpej@, thanks To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/pwmregulator.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/pwmregulator.c diff -u src/sys/dev/fdt/pwmregulator.c:1.1 src/sys/dev/fdt/pwmregulator.c:1.2 --- src/sys/dev/fdt/pwmregulator.c:1.1 Thu Dec 31 15:12:33 2020 +++ src/sys/dev/fdt/pwmregulator.c Fri Jan 1 03:07:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $ */ +/* $NetBSD: pwmregulator.c,v 1.2 2021/01/01 03:07:51 ryo Exp $ */ /* * Copyright (c) 2020 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.2 2021/01/01 03:07:51 ryo Exp $"); #include #include @@ -63,6 +63,7 @@ struct voltage_duty { struct pwmregulator_softc { device_t sc_dev; pwm_tag_t sc_pwm; + struct fdtbus_gpio_pin *sc_pin; struct voltage_duty *sc_voltage_table; int sc_voltage_table_num; int sc_phandle; @@ -132,8 +133,6 @@ pwmregulator_attach(device_t parent, dev >sc_dutycycle_unit) != 0) sc->sc_dutycycle_unit = 100; - len = of_getprop_uint32_array(phandle, "pwm-dutycycle-range", - sc->sc_dutycycle_range, 2); if (of_getprop_uint32_array(phandle, "pwm-dutycycle-range", sc->sc_dutycycle_range, 2) != 0) { sc->sc_dutycycle_range[0] = 0; @@ -193,6 +192,10 @@ pwmregulator_acquire(device_t dev) { struct pwmregulator_softc * const sc = device_private(dev); + /* "enable-gpios" is optional */ + sc->sc_pin = fdtbus_gpio_acquire(sc->sc_phandle, "enable-gpios", + GPIO_PIN_OUTPUT); + sc->sc_pwm = fdtbus_pwm_acquire(sc->sc_phandle, "pwms"); if (sc->sc_pwm == NULL) return ENXIO; @@ -205,6 +208,11 @@ pwmregulator_release(device_t dev) { struct pwmregulator_softc * const sc = device_private(dev); + if (sc->sc_pin != NULL) { + fdtbus_gpio_write(sc->sc_pin, 0); + fdtbus_gpio_release(sc->sc_pin); + } + sc->sc_pwm = NULL; } @@ -212,14 +220,22 @@ static int pwmregulator_enable(device_t dev, bool enable) { struct pwmregulator_softc * const sc = device_private(dev); + int error; if (sc->sc_pwm == NULL) return ENXIO; - if (enable) - return pwm_enable(sc->sc_pwm); - else - return pwm_disable(sc->sc_pwm); + if (enable) { + if (sc->sc_pin != NULL) + fdtbus_gpio_write(sc->sc_pin, 1); + error = pwm_enable(sc->sc_pwm); + } else { + error = pwm_disable(sc->sc_pwm); + if (sc->sc_pin != NULL) + fdtbus_gpio_write(sc->sc_pin, 0); + } + + return error; } static int
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Thu Dec 31 15:12:34 UTC 2020 Modified Files: src/sys/dev/fdt: files.fdt Added Files: src/sys/dev/fdt: pwmregulator.c Log Message: add fdt pwm regulator To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/dev/fdt/files.fdt cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/pwmregulator.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/files.fdt diff -u src/sys/dev/fdt/files.fdt:1.59 src/sys/dev/fdt/files.fdt:1.60 --- src/sys/dev/fdt/files.fdt:1.59 Mon Dec 28 20:29:57 2020 +++ src/sys/dev/fdt/files.fdt Thu Dec 31 15:12:33 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.fdt,v 1.59 2020/12/28 20:29:57 thorpej Exp $ +# $NetBSD: files.fdt,v 1.60 2020/12/31 15:12:33 ryo Exp $ include "external/bsd/libfdt/conf/files.libfdt" @@ -21,6 +21,10 @@ device gregulator attach gregulator at fdt file dev/fdt/gpioregulator.c gregulator +device pregulator +attach pregulator at fdt +file dev/fdt/pwmregulator.c pregulator + device fclock: clk attach fclock at fdt file dev/fdt/fixedclock.c fclock Added files: Index: src/sys/dev/fdt/pwmregulator.c diff -u /dev/null src/sys/dev/fdt/pwmregulator.c:1.1 --- /dev/null Thu Dec 31 15:12:34 2020 +++ src/sys/dev/fdt/pwmregulator.c Thu Dec 31 15:12:33 2020 @@ -0,0 +1,309 @@ +/* $NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $ */ + +/* + * Copyright (c) 2020 Ryo Shimizu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $"); + +#include +#include +#include +#include + +#include +#include + +static int pwmregulator_match(device_t, cfdata_t, void *); +static void pwmregulator_attach(device_t, device_t, void *); + +/* fdtbus_regulator_controller_func callback */ +static int pwmregulator_acquire(device_t); +static void pwmregulator_release(device_t); +static int pwmregulator_enable(device_t, bool); +static int pwmregulator_set_voltage(device_t, u_int, u_int); +static int pwmregulator_get_voltage(device_t, u_int *); + +static const struct fdtbus_regulator_controller_func pwmregulator_funcs = { + .acquire = pwmregulator_acquire, + .release = pwmregulator_release, + .enable = pwmregulator_enable, + .set_voltage = pwmregulator_set_voltage, + .get_voltage = pwmregulator_get_voltage +}; + +struct voltage_duty { + uint32_t microvolt; + uint32_t duty; /* percentage; 0-100 */ +}; + +struct pwmregulator_softc { + device_t sc_dev; + pwm_tag_t sc_pwm; + struct voltage_duty *sc_voltage_table; + int sc_voltage_table_num; + int sc_phandle; + uint32_t sc_microvolt_min; + uint32_t sc_microvolt_max; + uint32_t sc_dutycycle_unit; + uint32_t sc_dutycycle_range[2]; + bool sc_always_on; + bool sc_boot_on; +}; + +CFATTACH_DECL_NEW(pregulator, sizeof(struct pwmregulator_softc), +pwmregulator_match, pwmregulator_attach, NULL, NULL); + +static const char * const compatible[] = { + "pwm-regulator", + NULL +}; + +static int +pwmregulator_match(device_t parent, cfdata_t cf, void *aux) +{ + const struct fdt_attach_args *faa = aux; + + return of_match_compatible(faa->faa_phandle, compatible); +} + +static void +pwmregulator_attach(device_t parent, device_t self, void *aux) +{ + struct pwmregulator_softc * const sc = device_private(self); + const struct fdt_attach_args *faa = aux; + const int phandle = faa->faa_phandle; + int len; + char *name; + + sc->sc_dev = self; + sc->sc_phandle = phandle; + + aprint_naive("\n"); + len = OF_getproplen(phandle, "regulator-name"); + if (len > 0) { + name = kmem_zalloc(len, KM_SLEEP
CVS commit: src/sys/dev/ofw
Module Name:src Committed By: ryo Date: Thu Dec 31 15:10:46 UTC 2020 Modified Files: src/sys/dev/ofw: ofw_subr.c openfirm.h Log Message: add of_getprop_uint32_array() To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ofw/ofw_subr.c cvs rdiff -u -r1.39 -r1.40 src/sys/dev/ofw/openfirm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ofw/ofw_subr.c diff -u src/sys/dev/ofw/ofw_subr.c:1.40 src/sys/dev/ofw/ofw_subr.c:1.41 --- src/sys/dev/ofw/ofw_subr.c:1.40 Thu Jul 16 21:32:44 2020 +++ src/sys/dev/ofw/ofw_subr.c Thu Dec 31 15:10:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ofw_subr.c,v 1.40 2020/07/16 21:32:44 jmcneill Exp $ */ +/* $NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $ */ /* * Copyright 1998 @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.40 2020/07/16 21:32:44 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $"); #include #include @@ -603,6 +603,23 @@ of_getprop_uint32(int node, const char * return 0; } +int +of_getprop_uint32_array(int node, const char *prop, uint32_t *array, int n) +{ + uint32_t *v = array; + int len; + + len = OF_getprop(node, prop, array, n * sizeof(*v)); + if (len < (int)(n * sizeof(*v))) + return -1; + + for (; n > 0; n--) { + BE32TOH(*v); + v++; + } + + return 0; +} /* * Get the value of a uint64 property, compensating for host byte order. * Returns 0 on success, non-zero on failure. Index: src/sys/dev/ofw/openfirm.h diff -u src/sys/dev/ofw/openfirm.h:1.39 src/sys/dev/ofw/openfirm.h:1.40 --- src/sys/dev/ofw/openfirm.h:1.39 Thu Jul 16 21:32:44 2020 +++ src/sys/dev/ofw/openfirm.h Thu Dec 31 15:10:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.h,v 1.39 2020/07/16 21:32:44 jmcneill Exp $ */ +/* $NetBSD: openfirm.h,v 1.40 2020/12/31 15:10:46 ryo Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -132,6 +132,7 @@ void of_enter_spi_devs(prop_dictionary_t bool of_hasprop(int, const char *); #define of_getprop_bool of_hasprop int of_getprop_uint32(int, const char *, uint32_t *); +int of_getprop_uint32_array(int, const char *, uint32_t *, int); int of_getprop_uint64(int, const char *, uint64_t *); #endif /*_OPENFIRM_H_*/
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ryo Date: Thu Dec 31 15:09:12 UTC 2020 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: extend the timeout value. dwc_gmac_reset() sometimes takes more time. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.71 src/sys/dev/ic/dwc_gmac.c:1.72 --- src/sys/dev/ic/dwc_gmac.c:1.71 Sat Jun 27 13:34:20 2020 +++ src/sys/dev/ic/dwc_gmac.c Thu Dec 31 15:09:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -379,7 +379,7 @@ dwc_gmac_reset(struct dwc_gmac_softc *sc bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE, bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE) | GMAC_BUSMODE_RESET); - for (cnt = 0; cnt < 3000; cnt++) { + for (cnt = 0; cnt < 3; cnt++) { if ((bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE) & GMAC_BUSMODE_RESET) == 0) return 0;
CVS commit: src/sys/arch/arm/imx/fdt
Module Name:src Committed By: ryo Date: Wed Nov 25 05:18:39 UTC 2020 Modified Files: src/sys/arch/arm/imx/fdt: imx_ccm_div.c Log Message: `best_diff' should be kept to a positive number To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx_ccm_div.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/imx/fdt/imx_ccm_div.c diff -u src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.1 src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.2 --- src/sys/arch/arm/imx/fdt/imx_ccm_div.c:1.1 Wed Jun 10 17:57:50 2020 +++ src/sys/arch/arm/imx/fdt/imx_ccm_div.c Wed Nov 25 05:18:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: imx_ccm_div.c,v 1.1 2020/06/10 17:57:50 jmcneill Exp $ */ +/* $NetBSD: imx_ccm_div.c,v 1.2 2020/11/25 05:18:39 ryo Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imx_ccm_div.c,v 1.1 2020/06/10 17:57:50 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imx_ccm_div.c,v 1.2 2020/11/25 05:18:39 ryo Exp $"); #include #include @@ -97,7 +97,7 @@ imx_ccm_div_set_rate(struct imx_ccm_soft } else { if (abs(diff) < abs(best_diff)) { best_n = n; -best_diff = diff; +best_diff = abs(diff); } } }
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: ryo Date: Tue Nov 17 18:01:09 UTC 2020 Modified Files: src/sys/arch/arm/rockchip: rk3399_pcie_phy.c Log Message: don't expose 'compatible[]' To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk3399_pcie_phy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/rockchip/rk3399_pcie_phy.c diff -u src/sys/arch/arm/rockchip/rk3399_pcie_phy.c:1.2 src/sys/arch/arm/rockchip/rk3399_pcie_phy.c:1.3 --- src/sys/arch/arm/rockchip/rk3399_pcie_phy.c:1.2 Wed Jun 17 06:51:08 2020 +++ src/sys/arch/arm/rockchip/rk3399_pcie_phy.c Tue Nov 17 18:01:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rk3399_pcie_phy.c,v 1.2 2020/06/17 06:51:08 thorpej Exp $ */ +/* $NetBSD: rk3399_pcie_phy.c,v 1.3 2020/11/17 18:01:09 ryo Exp $ */ /* $OpenBSD: rkpcie.c,v 1.6 2018/08/28 09:33:18 jsg Exp $ */ /* * Copyright (c) 2018 Mark Kettenis @@ -18,7 +18,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie_phy.c,v 1.2 2020/06/17 06:51:08 thorpej Exp $"); +__KERNEL_RCSID(1, "$NetBSD: rk3399_pcie_phy.c,v 1.3 2020/11/17 18:01:09 ryo Exp $"); #include #include @@ -47,7 +47,7 @@ static void rkpciephy_attach(device_t, d CFATTACH_DECL_NEW(rkpciephy, sizeof(struct rkpciephy_softc), rkpciephy_match, rkpciephy_attach, NULL, NULL); -const char * const compatible[] = { +static const char * const compatible[] = { "rockchip,rk3399-pcie-phy", NULL };
CVS commit: src/sys/dev/vmt
Module Name:src Committed By: ryo Date: Tue Nov 17 17:59:31 UTC 2020 Modified Files: src/sys/dev/vmt: vmt_subr.c Log Message: use aprint_verbose_dev() To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/vmt/vmt_subr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/vmt/vmt_subr.c diff -u src/sys/dev/vmt/vmt_subr.c:1.1 src/sys/dev/vmt/vmt_subr.c:1.2 --- src/sys/dev/vmt/vmt_subr.c:1.1 Tue Oct 27 08:57:11 2020 +++ src/sys/dev/vmt/vmt_subr.c Tue Nov 17 17:59:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vmt_subr.c,v 1.1 2020/10/27 08:57:11 ryo Exp $ */ +/* $NetBSD: vmt_subr.c,v 1.2 2020/11/17 17:59:31 ryo Exp $ */ /* $OpenBSD: vmt.c,v 1.11 2011/01/27 21:29:25 dtucker Exp $ */ /* @@ -165,7 +165,7 @@ vmt_common_attach(struct vmt_softc *sc) uuid.node[5] = u; uuid_snprintf(sc->sc_uuid, sizeof(sc->sc_uuid), ); - device_printf(sc->sc_dev, "UUID: %s\n", sc->sc_uuid); + aprint_verbose_dev(sc->sc_dev, "UUID: %s\n", sc->sc_uuid); } callout_init(>sc_tick, 0);
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Wed Oct 28 08:36:40 UTC 2020 Added Files: src/sys/dev/fdt: vmt_fdt.c Log Message: add missing vmt_fdt.c. sorry, I forgot to commit vmt_fdt.c in http://mail-index.netbsd.org/source-changes/2020/10/27/msg123452.html To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/vmt_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/fdt/vmt_fdt.c diff -u /dev/null src/sys/dev/fdt/vmt_fdt.c:1.1 --- /dev/null Wed Oct 28 08:36:40 2020 +++ src/sys/dev/fdt/vmt_fdt.c Wed Oct 28 08:36:40 2020 @@ -0,0 +1,71 @@ +/* $NetBSD: vmt_fdt.c,v 1.1 2020/10/28 08:36:40 ryo Exp $ */ + +/* + * Copyright (c) 2020 Ryo Shimizu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: vmt_fdt.c,v 1.1 2020/10/28 08:36:40 ryo Exp $"); + +#include +#include +#include + +#include +#include +#include + +static int vmt_fdt_match(device_t, cfdata_t, void *); +static void vmt_fdt_attach(device_t, device_t, void *); + +CFATTACH_DECL_NEW(vmt_fdt, sizeof(struct vmt_softc), +vmt_fdt_match, vmt_fdt_attach, NULL, NULL); + +static const struct of_compat_data compat_data[] = { + { "vmware", }, + { NULL } +}; + +static int +vmt_fdt_match(device_t parent, cfdata_t cf, void *aux) +{ + const struct fdt_attach_args * const faa = aux; + + if (OF_finddevice("/hypervisor") != faa->faa_phandle) + return 0; + return of_match_compat_data(faa->faa_phandle, compat_data); +} + +static void +vmt_fdt_attach(device_t parent, device_t self, void *aux) +{ + struct vmt_softc * const sc = device_private(self); + + aprint_naive("\n"); + aprint_normal(": VMware Tools driver\n"); + + sc->sc_dev = self; + vmt_common_attach(sc); +}
CVS commit: src
Module Name:src Committed By: ryo Date: Tue Oct 27 08:57:11 UTC 2020 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile src/share/man/man4/man4.x86: Makefile src/sys/arch/evbarm/conf: GENERIC64 src/sys/arch/x86/conf: files.x86 src/sys/arch/x86/x86: identcpu.c lapic.c vmt.c src/sys/conf: files src/sys/dev/fdt: files.fdt src/sys/modules/vmt: Makefile Added Files: src/share/man/man4: vmt.4 src/sys/dev/vmt: files.vmt vmt_subr.c vmtreg.h vmtvar.h Removed Files: src/share/man/man4/man4.x86: vmt.4 src/sys/arch/x86/x86: vmtreg.h vmtvar.h Log Message: move vmt(4) from MD to MI, and add support vmt on aarch64. tested on ESXi-Arm Fling - move from sys/arch/x86/x86/{vmt.c,vmtreg.h,vmtvar.h} to sys/dev/vmt/{vmt_subr.c,vmtreg.h,vmtvar.h}, and split the attach part of the cpufeaturebus and fdt - add aarch64 vmware backdoor op - add include guard to vmt{reg,var}.h - Yet there is still some little-endian dependency. it needs to be fixed in order to work properly on aarch64eb To generate a diff of this commit: cvs rdiff -u -r1.1706 -r1.1707 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.710 -r1.711 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.3 src/share/man/man4/vmt.4 cvs rdiff -u -r1.20 -r1.21 src/share/man/man4/man4.x86/Makefile cvs rdiff -u -r1.6 -r0 src/share/man/man4/man4.x86/vmt.4 cvs rdiff -u -r1.163 -r1.164 src/sys/arch/evbarm/conf/GENERIC64 cvs rdiff -u -r1.119 -r1.120 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.117 -r1.118 src/sys/arch/x86/x86/identcpu.c cvs rdiff -u -r1.84 -r1.85 src/sys/arch/x86/x86/lapic.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/vmt.c cvs rdiff -u -r1.2 -r0 src/sys/arch/x86/x86/vmtreg.h cvs rdiff -u -r1.1 -r0 src/sys/arch/x86/x86/vmtvar.h cvs rdiff -u -r1.1276 -r1.1277 src/sys/conf/files cvs rdiff -u -r1.54 -r1.55 src/sys/dev/fdt/files.fdt cvs rdiff -u -r0 -r1.1 src/sys/dev/vmt/files.vmt src/sys/dev/vmt/vmt_subr.c \ src/sys/dev/vmt/vmtreg.h src/sys/dev/vmt/vmtvar.h cvs rdiff -u -r1.3 -r1.4 src/sys/modules/vmt/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1706 src/distrib/sets/lists/man/mi:1.1707 --- src/distrib/sets/lists/man/mi:1.1706 Fri Oct 16 15:40:40 2020 +++ src/distrib/sets/lists/man/mi Tue Oct 27 08:57:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1706 2020/10/16 15:40:40 ryo Exp $ +# $NetBSD: mi,v 1.1707 2020/10/27 08:57:10 ryo Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -2024,6 +2024,7 @@ ./usr/share/man/cat4/vlan.0 man-sys-catman .cat ./usr/share/man/cat4/vmmon.0 man-sys-catman .cat ./usr/share/man/cat4/vmnet.0 man-sys-catman .cat +./usr/share/man/cat4/vmt.0 man-sys-catman .cat ./usr/share/man/cat4/vmx.0 man-sys-catman .cat ./usr/share/man/cat4/vnd.0 man-sys-catman .cat ./usr/share/man/cat4/voodoofb.0 man-sys-catman .cat @@ -2089,7 +2090,7 @@ ./usr/share/man/cat4/x86/tco.0 man-sys-catman .cat ./usr/share/man/cat4/x86/tprof_amdpmi.0 man-obsolete obsolete ./usr/share/man/cat4/x86/tprof_pmi.0 man-obsolete obsolete -./usr/share/man/cat4/x86/vmt.0 man-sys-catman .cat +./usr/share/man/cat4/x86/vmt.0 man-obsolete obsolete ./usr/share/man/cat4/x86/vmx.0 man-obsolete obsolete ./usr/share/man/cat4/xbd.0 man-sys-catman .cat ./usr/share/man/cat4/xbdback.0 man-sys-catman .cat @@ -5164,6 +5165,7 @@ ./usr/share/man/html4/vlan.html man-sys-htmlman html ./usr/share/man/html4/vmmon.html man-sys-htmlman html ./usr/share/man/html4/vmnet.html man-sys-htmlman html +./usr/share/man/html4/vmt.html man-sys-htmlman html ./usr/share/man/html4/vmx.html man-sys-htmlman html ./usr/share/man/html4/vnd.html man-sys-htmlman html ./usr/share/man/html4/voodoofb.html man-sys-htmlman html @@ -5229,7 +5231,7 @@ ./usr/share/man/html4/x86/tco.html man-sys-htmlman html ./usr/share/man/html4/x86/tprof_amdpmi.html man-obsolete obsolete ./usr/share/man/html4/x86/tprof_pmi.html man-obsolete obsolete -./usr/share/man/html4/x86/vmt.html man-sys-htmlman html +./usr/share/man/html4/x86/vmt.html man-obsolete obsolete ./usr/share/man/html4/x86/vmx.html man-obsolete obsolete ./usr/share/man/html4/xbd.html man-sys-htmlman html ./usr/share/man/html4/xbdback.html man-sys-htmlman html @@ -8236,6 +8238,7 @@ ./usr/share/man/man4/vlan.4 man-sys-man .man ./usr/share/man/man4/vmmon.4 man-sys-man .man ./usr/share/man/man4/vmnet.4 man-sys-man .man +./usr/share/man/man4/vmt.4 man-sys-man .man ./usr/share/man/man4/vmx.4 man-sys-man .man ./usr/share/man/man4/vnd.4 man-sys-man .man ./usr/share/man/man4/voodoofb.4 man-sys-man .man @@ -8301,7 +8304,7 @@ ./usr/share/man/man4/x86/tco.4 man-sys-man .man
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Oct 22 07:16:06 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: locore.S Log Message: Don't trap EL0 accesses to the DCC registers. VMWare use "mrs xzr, mdccsr_el0" for guest side backdoor. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/arch/aarch64/aarch64/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/locore.S diff -u src/sys/arch/aarch64/aarch64/locore.S:1.73 src/sys/arch/aarch64/aarch64/locore.S:1.74 --- src/sys/arch/aarch64/aarch64/locore.S:1.73 Tue Sep 15 09:28:20 2020 +++ src/sys/arch/aarch64/aarch64/locore.S Thu Oct 22 07:16:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.73 2020/09/15 09:28:20 ryo Exp $ */ +/* $NetBSD: locore.S,v 1.74 2020/10/22 07:16:06 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -38,7 +38,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore.S,v 1.73 2020/09/15 09:28:20 ryo Exp $") +RCSID("$NetBSD: locore.S,v 1.74 2020/10/22 07:16:06 ryo Exp $") #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED #define MAIR_DEVICE_MEM MAIR_DEVICE_nGnRnE @@ -241,9 +241,8 @@ ASEND(clear_bss) init_sysregs: stp x0, lr, [sp, #-16]! - /* init debug event */ - ldr x0, mdscr_setting - msr mdscr_el1, x0 + /* init debug registers */ + msr mdscr_el1, xzr msr oslar_el1, xzr /* Clear context id register */ @@ -1041,11 +1040,6 @@ sctlr_pac: SCTLR_EnDB |/* PACDB (APDBKey_EL1) instruction enable */ \ 0) -mdscr_setting: - .quad ( \ - MDSCR_TDCC |/* Trap Debug Communications Channel access */ \ - 0) - .L_devmap_addr: .quad VM_KERNEL_IO_ADDRESS
CVS commit: src/sys/external/bsd/drm2/dist/drm/radeon
Module Name:src Committed By: ryo Date: Tue Oct 20 09:53:59 UTC 2020 Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: radeon_atombios_dp.c Log Message: add header file hack to resolve conflict of ALIGN macro. (on __BIG_ENDIAN) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.3 --- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c:1.2 Tue Jan 7 13:51:38 2020 +++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_atombios_dp.c Tue Oct 20 09:53:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: radeon_atombios_dp.c,v 1.2 2020/01/07 13:51:38 msaitoh Exp $ */ +/* $NetBSD: radeon_atombios_dp.c,v 1.3 2020/10/20 09:53:59 ryo Exp $ */ /* * Copyright 2007-8 Advanced Micro Devices, Inc. @@ -27,7 +27,7 @@ * Jerome Glisse */ #include -__KERNEL_RCSID(0, "$NetBSD: radeon_atombios_dp.c,v 1.2 2020/01/07 13:51:38 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeon_atombios_dp.c,v 1.3 2020/10/20 09:53:59 ryo Exp $"); #include #include @@ -37,6 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_atomb #include "atom-bits.h" #include +#include + /* move these to drm_dp_helper.c/h */ #define DP_LINK_CONFIGURATION_SIZE 9 #define DP_DPCD_SIZE DP_RECEIVER_CAP_SIZE
CVS commit: src/distrib/sets/lists/man
Module Name:src Committed By: ryo Date: Fri Oct 16 15:40:40 UTC 2020 Modified Files: src/distrib/sets/lists/man: mi Log Message: in my previous commit, entries before the move must be obsolete rather than removed pointed out by nonaka@, thanks To generate a diff of this commit: cvs rdiff -u -r1.1705 -r1.1706 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1705 src/distrib/sets/lists/man/mi:1.1706 --- src/distrib/sets/lists/man/mi:1.1705 Wed Oct 14 10:19:10 2020 +++ src/distrib/sets/lists/man/mi Fri Oct 16 15:40:40 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1705 2020/10/14 10:19:10 ryo Exp $ +# $NetBSD: mi,v 1.1706 2020/10/16 15:40:40 ryo Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -2090,6 +2090,7 @@ ./usr/share/man/cat4/x86/tprof_amdpmi.0 man-obsolete obsolete ./usr/share/man/cat4/x86/tprof_pmi.0 man-obsolete obsolete ./usr/share/man/cat4/x86/vmt.0 man-sys-catman .cat +./usr/share/man/cat4/x86/vmx.0 man-obsolete obsolete ./usr/share/man/cat4/xbd.0 man-sys-catman .cat ./usr/share/man/cat4/xbdback.0 man-sys-catman .cat ./usr/share/man/cat4/xbox.0 man-sys-catman .cat @@ -5229,6 +5230,7 @@ ./usr/share/man/html4/x86/tprof_amdpmi.html man-obsolete obsolete ./usr/share/man/html4/x86/tprof_pmi.html man-obsolete obsolete ./usr/share/man/html4/x86/vmt.html man-sys-htmlman html +./usr/share/man/html4/x86/vmx.html man-obsolete obsolete ./usr/share/man/html4/xbd.html man-sys-htmlman html ./usr/share/man/html4/xbdback.html man-sys-htmlman html ./usr/share/man/html4/xbox.html man-sys-htmlman html @@ -8300,6 +8302,7 @@ ./usr/share/man/man4/x86/tprof_amdpmi.4 man-obsolete obsolete ./usr/share/man/man4/x86/tprof_pmi.4 man-obsolete obsolete ./usr/share/man/man4/x86/vmt.4 man-sys-man .man +./usr/share/man/man4/x86/vmx.4 man-obsolete obsolete ./usr/share/man/man4/xbd.4 man-sys-man .man ./usr/share/man/man4/xbdback.4 man-sys-man .man ./usr/share/man/man4/xbox.4 man-sys-man .man
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Oct 15 08:37:20 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: vectors.S Log Message: slightly optimized loop for trap_doast() calls To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/vectors.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/vectors.S diff -u src/sys/arch/aarch64/aarch64/vectors.S:1.20 src/sys/arch/aarch64/aarch64/vectors.S:1.21 --- src/sys/arch/aarch64/aarch64/vectors.S:1.20 Tue Oct 6 06:26:46 2020 +++ src/sys/arch/aarch64/aarch64/vectors.S Thu Oct 15 08:37:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vectors.S,v 1.20 2020/10/06 06:26:46 skrll Exp $ */ +/* $NetBSD: vectors.S,v 1.21 2020/10/15 08:37:20 ryo Exp $ */ #include #include @@ -10,7 +10,7 @@ #include "opt_ddb.h" #include "opt_dtrace.h" -RCSID("$NetBSD: vectors.S,v 1.20 2020/10/06 06:26:46 skrll Exp $") +RCSID("$NetBSD: vectors.S,v 1.21 2020/10/15 08:37:20 ryo Exp $") ARMV8_DEFINE_OPTIONS @@ -255,26 +255,26 @@ ENTRY_NP(el0_trap) nop/* dummy for DDB backtrace (for lr-4) */ #endif ENTRY_NP(el0_trap_exit) - DISABLE_INTERRUPT /* make sure I|F marked */ + + adr lr, 1f /* return address from trap_doast */ 1: /* while (curlwp->l_md.md_astpending != 0) { */ - mrs x8, tpidr_el1 - ldr w9, [x8, #L_MD_ASTPENDING] - cbz w9, 9f + DISABLE_INTERRUPT /* make sure I|F marked */ + mrs x9, tpidr_el1 + ldr w8, [x9, #L_MD_ASTPENDING] + cbz w8, 9f /* curlwp->l_md.md_astpending = 0; */ - str xzr, [x8, #L_MD_ASTPENDING] + str xzr, [x9, #L_MD_ASTPENDING] /* trap_doast(tf); */ ENABLE_INTERRUPT mov x0, sp - bl _C_LABEL(trap_doast) - DISABLE_INTERRUPT - b 1b + b _C_LABEL(trap_doast) /* tail call (return to 1b) */ /* } */ 9: - mrs x9, tpidr_el1 + /* x9 is tpidr_el1 */ ldr x23, [x9, #L_MD_CPACR] msr cpacr_el1, x23 /* FP unit EL0 handover */ isb/* necessary? */
CVS commit: src/sys/arch/evbarm/conf
Module Name:src Committed By: ryo Date: Thu Oct 15 04:39:25 UTC 2020 Modified Files: src/sys/arch/evbarm/conf: GENERIC64 Log Message: add vmx(4) driver. tested on ESXi-Arm To generate a diff of this commit: cvs rdiff -u -r1.162 -r1.163 src/sys/arch/evbarm/conf/GENERIC64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbarm/conf/GENERIC64 diff -u src/sys/arch/evbarm/conf/GENERIC64:1.162 src/sys/arch/evbarm/conf/GENERIC64:1.163 --- src/sys/arch/evbarm/conf/GENERIC64:1.162 Tue Sep 29 19:58:50 2020 +++ src/sys/arch/evbarm/conf/GENERIC64 Thu Oct 15 04:39:24 2020 @@ -1,5 +1,5 @@ # -# $NetBSD: GENERIC64,v 1.162 2020/09/29 19:58:50 jmcneill Exp $ +# $NetBSD: GENERIC64,v 1.163 2020/10/15 04:39:24 ryo Exp $ # # GENERIC ARM (aarch64) kernel # @@ -236,6 +236,7 @@ mcx* at pci? dev ? function ? # Mellano mskc* at pci? dev ? function ? # Marvell Yukon 2 Gigabit Ethernet msk* at mskc? re* at pci? dev ? function ? # Realtek RTL8111GS +vmx* at pci? dev ? function ? # VMware VMXNET3 wm* at pci? dev ? function ? # Intel Gigabit Ethernet # MII/PHY support
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Oct 15 04:37:48 UTC 2020 Modified Files: src/sys/dev/pci: if_vmx.c Log Message: Reduces useless "vmxnet3_read_cmd(sc, VMXNET3_CMD_GET_LINK)" calls To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vmx.c diff -u src/sys/dev/pci/if_vmx.c:1.3 src/sys/dev/pci/if_vmx.c:1.4 --- src/sys/dev/pci/if_vmx.c:1.3 Thu Oct 15 04:33:24 2020 +++ src/sys/dev/pci/if_vmx.c Thu Oct 15 04:37:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.3 2020/10/15 04:33:24 ryo Exp $ */ +/* $NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.3 2020/10/15 04:33:24 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.4 2020/10/15 04:37:48 ryo Exp $"); #include #include @@ -3486,12 +3486,11 @@ static void vmxnet3_if_link_status(struct vmxnet3_softc *sc) { struct ifnet *ifp = >vmx_ethercom.ec_if; - u_int x, link; - - vmxnet3_cmd_link_status(ifp); + u_int link; + bool up; - x = vmxnet3_read_cmd(sc, VMXNET3_CMD_GET_LINK); - if (x & 1) { + up = vmxnet3_cmd_link_status(ifp); + if (up) { sc->vmx_link_active = 1; link = LINK_STATE_UP; } else {
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Oct 15 04:33:24 UTC 2020 Modified Files: src/sys/dev/pci: if_vmx.c Log Message: Fixed a bug where 'ifconfig vmx0 down up' caused a failure to send. This procedure was leaving sc->vmx_link_active = 0. ok nakahara@ To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_vmx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vmx.c diff -u src/sys/dev/pci/if_vmx.c:1.2 src/sys/dev/pci/if_vmx.c:1.3 --- src/sys/dev/pci/if_vmx.c:1.2 Wed Oct 14 10:26:59 2020 +++ src/sys/dev/pci/if_vmx.c Thu Oct 15 04:33:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.2 2020/10/14 10:26:59 ryo Exp $ */ +/* $NetBSD: if_vmx.c,v 1.3 2020/10/15 04:33:24 ryo Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.2 2020/10/14 10:26:59 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.3 2020/10/15 04:33:24 ryo Exp $"); #include #include @@ -2905,7 +2905,7 @@ vmxnet3_init_locked(struct vmxnet3_softc } ifp->if_flags |= IFF_RUNNING; - vmxnet3_cmd_link_status(ifp); + vmxnet3_if_link_status(sc); vmxnet3_enable_all_intrs(sc); callout_reset(>vmx_tick, hz, vmxnet3_tick, sc);
CVS commit: src/sys
Module Name:src Committed By: ryo Date: Wed Oct 14 10:26:59 UTC 2020 Modified Files: src/sys/dev/pci: if_vmx.c src/sys/modules: Makefile Added Files: src/sys/modules/if_vmx: Makefile if_vmx.ioconf Log Message: modularize, and fix build error To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/if_vmx.c cvs rdiff -u -r1.246 -r1.247 src/sys/modules/Makefile cvs rdiff -u -r0 -r1.1 src/sys/modules/if_vmx/Makefile \ src/sys/modules/if_vmx/if_vmx.ioconf Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_vmx.c diff -u src/sys/dev/pci/if_vmx.c:1.1 src/sys/dev/pci/if_vmx.c:1.2 --- src/sys/dev/pci/if_vmx.c:1.1 Wed Oct 14 10:19:11 2020 +++ src/sys/dev/pci/if_vmx.c Wed Oct 14 10:26:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vmx.c,v 1.1 2020/10/14 10:19:11 ryo Exp $ */ +/* $NetBSD: if_vmx.c,v 1.2 2020/10/14 10:26:59 ryo Exp $ */ /* $OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $ */ /* @@ -19,7 +19,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.1 2020/10/14 10:19:11 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.2 2020/10/14 10:26:59 ryo Exp $"); #include #include @@ -29,6 +29,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1 #include #include #include +#include #include #include #include @@ -536,7 +537,7 @@ static inline int vmxnet3_txring_avail(struct vmxnet3_txring *txr) { int avail = txr->vxtxr_next - txr->vxtxr_head - 1; - return (avail < 0 ? txr->vxtxr_ndesc + avail : avail); + return (avail < 0 ? (int)txr->vxtxr_ndesc + avail : avail); } /* @@ -1372,7 +1373,8 @@ vmxnet3_alloc_txq_data(struct vmxnet3_so struct vmxnet3_txring *txr; struct vmxnet3_comp_ring *txc; size_t descsz, compsz; - int i, q, error; + u_int i; + int q, error; dev = sc->vmx_dev; @@ -1424,7 +1426,8 @@ vmxnet3_free_txq_data(struct vmxnet3_sof struct vmxnet3_txring *txr; struct vmxnet3_comp_ring *txc; struct vmxnet3_txbuf *txb; - int i, q; + u_int i; + int q; for (q = 0; q < sc->vmx_ntxqueues; q++) { txq = >vmx_queue[q].vxq_txqueue; @@ -1460,7 +1463,8 @@ vmxnet3_alloc_rxq_data(struct vmxnet3_so struct vmxnet3_rxring *rxr; struct vmxnet3_comp_ring *rxc; int descsz, compsz; - int i, j, q, error; + u_int i, j; + int q, error; dev = sc->vmx_dev; @@ -1536,7 +1540,8 @@ vmxnet3_free_rxq_data(struct vmxnet3_sof struct vmxnet3_rxring *rxr; struct vmxnet3_comp_ring *rxc; struct vmxnet3_rxbuf *rxb; - int i, j, q; + u_int i, j; + int q; for (q = 0; q < sc->vmx_nrxqueues; q++) { rxq = >vmx_queue[q].vxq_rxqueue; @@ -2337,7 +2342,7 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue * struct vmxnet3_rxdesc *rxd __diagused; struct vmxnet3_rxcompdesc *rxcd; struct mbuf *m, *m_head, *m_tail; - int idx, length; + u_int idx, length; bool more = false; sc = rxq->vxrxq_sc; @@ -2648,7 +2653,7 @@ vmxnet3_txstop(struct vmxnet3_softc *sc, { struct vmxnet3_txring *txr; struct vmxnet3_txbuf *txb; - int i; + u_int i; txr = >vxtxq_cmd_ring; @@ -2672,7 +2677,7 @@ vmxnet3_rxstop(struct vmxnet3_softc *sc, { struct vmxnet3_rxring *rxr; struct vmxnet3_rxbuf *rxb; - int i, j; + u_int i, j; if (rxq->vxrxq_mhead != NULL) { m_freem(rxq->vxrxq_mhead); @@ -2780,7 +2785,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, { struct vmxnet3_rxring *rxr; struct vmxnet3_comp_ring *rxc; - int i, populate, idx, error; + u_int i, populate, idx; + int error; /* LRO and jumbo frame is not supported yet */ populate = 1; @@ -3377,7 +3383,7 @@ vmxnet3_ioctl(struct ifnet *ifp, u_long error = EINVAL; break; } - if (ifp->if_mtu != nmtu) { + if (ifp->if_mtu != (uint64_t)nmtu) { s = splnet(); error = ether_ioctl(ifp, cmd, data); splx(s); @@ -3656,3 +3662,33 @@ vmxnet3_dma_free(struct vmxnet3_softc *s memset(dma, 0, sizeof(*dma)); } + +MODULE(MODULE_CLASS_DRIVER, if_vmx, "pci"); + +#ifdef _MODULE +#include "ioconf.c" +#endif + +static int +if_vmx_modcmd(modcmd_t cmd, void *opaque) +{ + int error = 0; + + switch (cmd) { + case MODULE_CMD_INIT: +#ifdef _MODULE + error = config_init_component(cfdriver_ioconf_if_vmx, + cfattach_ioconf_if_vmx, cfdata_ioconf_if_vmx); +#endif + return error; + case MODULE_CMD_FINI: +#ifdef _MODULE + error = config_fini_component(cfdriver_ioconf_if_vmx, + cfattach_ioconf_if_vmx, cfdata_ioconf_if_vmx); +#endif + return error; + default: + return ENOTTY; + } +} + Index: src/sys/modules/Makefile diff -u src/sys/modules/Makefile:1.246 src/sys/modules/Makefile:1.247 --- src/sys/modules/Makefile:1.246 Sat Sep 26 17:49:50 2020 +++ src/sys/modules/Makefile Wed Oct 14 10:26:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.246 2020/09/26 17:49:50 jmcneill Exp $ +# $NetBSD: Makefile,v 1.247 2020/10/14 10:26:59 ryo Exp $ .include @@ -446,6 +446,7 @@ SUBDIR+= cac_eisa SUBDIR+= cac_pci SUBDIR+= if_aq SUBDIR+= if_vioif +SUBDIR+=
CVS commit: src
Module Name:src Committed By: ryo Date: Wed Oct 14 10:19:11 UTC 2020 Modified Files: src/distrib/sets/lists/man: mi src/share/man/man4: Makefile src/share/man/man4/man4.x86: Makefile src/sys/arch/x86/pci: files.pci src/sys/dev/pci: files.pci Added Files: src/share/man/man4: vmx.4 src/sys/dev/pci: if_vmx.c if_vmxreg.h Removed Files: src/share/man/man4/man4.x86: vmx.4 src/sys/arch/x86/pci: if_vmx.c if_vmxreg.h Log Message: vmx(4) should be MI. moved to sys/dev/pci from sys/arch/x86/pci To generate a diff of this commit: cvs rdiff -u -r1.1704 -r1.1705 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.709 -r1.710 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/vmx.4 cvs rdiff -u -r1.19 -r1.20 src/share/man/man4/man4.x86/Makefile cvs rdiff -u -r1.2 -r0 src/share/man/man4/man4.x86/vmx.4 cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/pci/files.pci cvs rdiff -u -r1.60 -r0 src/sys/arch/x86/pci/if_vmx.c cvs rdiff -u -r1.3 -r0 src/sys/arch/x86/pci/if_vmxreg.h cvs rdiff -u -r1.431 -r1.432 src/sys/dev/pci/files.pci cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/if_vmx.c src/sys/dev/pci/if_vmxreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1704 src/distrib/sets/lists/man/mi:1.1705 --- src/distrib/sets/lists/man/mi:1.1704 Sun Sep 27 13:31:04 2020 +++ src/distrib/sets/lists/man/mi Wed Oct 14 10:19:10 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1704 2020/09/27 13:31:04 roy Exp $ +# $NetBSD: mi,v 1.1705 2020/10/14 10:19:10 ryo Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -2024,6 +2024,7 @@ ./usr/share/man/cat4/vlan.0 man-sys-catman .cat ./usr/share/man/cat4/vmmon.0 man-sys-catman .cat ./usr/share/man/cat4/vmnet.0 man-sys-catman .cat +./usr/share/man/cat4/vmx.0 man-sys-catman .cat ./usr/share/man/cat4/vnd.0 man-sys-catman .cat ./usr/share/man/cat4/voodoofb.0 man-sys-catman .cat ./usr/share/man/cat4/vr.0 man-sys-catman .cat @@ -2089,7 +2090,6 @@ ./usr/share/man/cat4/x86/tprof_amdpmi.0 man-obsolete obsolete ./usr/share/man/cat4/x86/tprof_pmi.0 man-obsolete obsolete ./usr/share/man/cat4/x86/vmt.0 man-sys-catman .cat -./usr/share/man/cat4/x86/vmx.0 man-sys-catman .cat ./usr/share/man/cat4/xbd.0 man-sys-catman .cat ./usr/share/man/cat4/xbdback.0 man-sys-catman .cat ./usr/share/man/cat4/xbox.0 man-sys-catman .cat @@ -5163,6 +5163,7 @@ ./usr/share/man/html4/vlan.html man-sys-htmlman html ./usr/share/man/html4/vmmon.html man-sys-htmlman html ./usr/share/man/html4/vmnet.html man-sys-htmlman html +./usr/share/man/html4/vmx.html man-sys-htmlman html ./usr/share/man/html4/vnd.html man-sys-htmlman html ./usr/share/man/html4/voodoofb.html man-sys-htmlman html ./usr/share/man/html4/vr.html man-sys-htmlman html @@ -5228,7 +5229,6 @@ ./usr/share/man/html4/x86/tprof_amdpmi.html man-obsolete obsolete ./usr/share/man/html4/x86/tprof_pmi.html man-obsolete obsolete ./usr/share/man/html4/x86/vmt.html man-sys-htmlman html -./usr/share/man/html4/x86/vmx.html man-sys-htmlman html ./usr/share/man/html4/xbd.html man-sys-htmlman html ./usr/share/man/html4/xbdback.html man-sys-htmlman html ./usr/share/man/html4/xbox.html man-sys-htmlman html @@ -8234,6 +8234,7 @@ ./usr/share/man/man4/vlan.4 man-sys-man .man ./usr/share/man/man4/vmmon.4 man-sys-man .man ./usr/share/man/man4/vmnet.4 man-sys-man .man +./usr/share/man/man4/vmx.4 man-sys-man .man ./usr/share/man/man4/vnd.4 man-sys-man .man ./usr/share/man/man4/voodoofb.4 man-sys-man .man ./usr/share/man/man4/vr.4 man-sys-man .man @@ -8299,7 +8300,6 @@ ./usr/share/man/man4/x86/tprof_amdpmi.4 man-obsolete obsolete ./usr/share/man/man4/x86/tprof_pmi.4 man-obsolete obsolete ./usr/share/man/man4/x86/vmt.4 man-sys-man .man -./usr/share/man/man4/x86/vmx.4 man-sys-man .man ./usr/share/man/man4/xbd.4 man-sys-man .man ./usr/share/man/man4/xbdback.4 man-sys-man .man ./usr/share/man/man4/xbox.4 man-sys-man .man Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.709 src/share/man/man4/Makefile:1.710 --- src/share/man/man4/Makefile:1.709 Sun Sep 27 13:31:04 2020 +++ src/share/man/man4/Makefile Wed Oct 14 10:19:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.709 2020/09/27 13:31:04 roy Exp $ +# $NetBSD: Makefile,v 1.710 2020/10/14 10:19:11 ryo Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -69,7 +69,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 a unix.4 userconf.4 \ vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 \ vio9p.4 vioif.4 viomb.4 viornd.4 vioscsi.4 virt.4 virtio.4 \ - vether.4 vlan.4 vmmon.4 vmnet.4 vnd.4 voodoofb.4 vr.4 vte.4 \ + vether.4 vlan.4 vmmon.4 vmnet.4 vmx.4 vnd.4
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Thu Oct 1 06:40:16 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: procfs_machdep.c src/sys/arch/aarch64/include: cpu.h Log Message: fix build error with LLVM To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/aarch64/procfs_machdep.c cvs rdiff -u -r1.27 -r1.28 src/sys/arch/aarch64/include/cpu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/procfs_machdep.c diff -u src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.2 src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.3 --- src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.2 Wed Sep 30 08:43:47 2020 +++ src/sys/arch/aarch64/aarch64/procfs_machdep.c Thu Oct 1 06:40:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_machdep.c,v 1.2 2020/09/30 08:43:47 ryo Exp $ */ +/* $NetBSD: procfs_machdep.c,v 1.3 2020/10/01 06:40:16 ryo Exp $ */ /*- * Copyright (c) 2020 Ryo Shimizu @@ -27,9 +27,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.2 2020/09/30 08:43:47 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.3 2020/10/01 06:40:16 ryo Exp $"); #include +#include +#include #include #include @@ -188,7 +190,7 @@ procfs_getcpuinfstr(char *buf, size_t *l total = 0; for (CPU_INFO_FOREACH(cii, ci)) { - OUTPUT_BUF("processor\t: %lu\n", cii); + OUTPUT_BUF("processor\t: %d\n", cii); len = procfs_cpuinfo_features(ci, buf, left); FORWARD_BUF(len); Index: src/sys/arch/aarch64/include/cpu.h diff -u src/sys/arch/aarch64/include/cpu.h:1.27 src/sys/arch/aarch64/include/cpu.h:1.28 --- src/sys/arch/aarch64/include/cpu.h:1.27 Mon Sep 14 10:06:35 2020 +++ src/sys/arch/aarch64/include/cpu.h Thu Oct 1 06:40:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.27 2020/09/14 10:06:35 ryo Exp $ */ +/* $NetBSD: cpu.h,v 1.28 2020/10/01 06:40:16 ryo Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -156,7 +156,7 @@ void cpu_hatch(struct cpu_info *); extern struct cpu_info *cpu_info[]; extern struct cpu_info cpu_info_store[]; -#define CPU_INFO_ITERATOR cpuid_t +#define CPU_INFO_ITERATOR int #if defined(MULTIPROCESSOR) || defined(_MODULE) #define cpu_number() (curcpu()->ci_index) #define CPU_IS_PRIMARY(ci) ((ci)->ci_index == 0)
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Wed Sep 30 08:43:47 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: procfs_machdep.c Log Message: add linux compatible /proc/cpuinfo To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/aarch64/procfs_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/procfs_machdep.c diff -u src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.1 src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.2 --- src/sys/arch/aarch64/aarch64/procfs_machdep.c:1.1 Sun Aug 10 05:47:37 2014 +++ src/sys/arch/aarch64/aarch64/procfs_machdep.c Wed Sep 30 08:43:47 2020 @@ -1,12 +1,9 @@ -/* $NetBSD: procfs_machdep.c,v 1.1 2014/08/10 05:47:37 matt Exp $ */ +/* $NetBSD: procfs_machdep.c,v 1.2 2020/09/30 08:43:47 ryo Exp $ */ /*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. + * Copyright (c) 2020 Ryo Shimizu * All rights reserved. * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -16,39 +13,202 @@ *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.1 2014/08/10 05:47:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.2 2020/09/30 08:43:47 ryo Exp $"); #include -#include -#include -#include -#include -#include - #include +#include + + +/* use variables named 'buf', 'left', 'total' */ +#define FORWARD_BUF(_len) \ + do { \ + total += _len; \ + if (_len < left) {\ + buf += _len;\ + left -= _len;\ + } else { \ + buf += left;\ + left = 0;\ + } \ + } while (0 /*CONSTCOND*/) + +#define OUTPUT_BUF(fmt, args...)\ + do { \ + size_t l = snprintf(buf, left, fmt, ## args); \ + FORWARD_BUF(l); \ + } while (0/*CONSTCOND*/) + +static int +procfs_cpuinfo_features(struct cpu_info *ci, char *buf, int buflen) +{ + uint64_t isar0, isar1, mmfr2, pfr0, pfr1; + size_t left, total; + + isar0 = ci->ci_id.ac_aa64isar0; + isar1 = ci->ci_id.ac_aa64isar1; + mmfr2 = ci->ci_id.ac_aa64mmfr2; + pfr0 = ci->ci_id.ac_aa64pfr0; + pfr1 = ci->ci_id.ac_aa64pfr1; + + left = buflen; + total = 0; + + /* + * I don't know if we need to mimic the order of HWCAP in linux + */ + OUTPUT_BUF("Features\t:"); +#define SO_EQ(reg, mask, val) (__SHIFTOUT((reg), (mask)) == (val)) + if (SO_EQ(pfr0, ID_AA64PFR0_EL1_FP, ID_AA64PFR0_EL1_FP_IMPL)) + OUTPUT_BUF(" fp"); + if (SO_EQ(pfr0, ID_AA64PFR0_EL1_ADVSIMD, ID_AA64PFR0_EL1_ADV_SIMD_IMPL)) + OUTPUT_BUF(" asimd"); + /* notyet: " evtstrm" */ + if (SO_EQ(isar0, ID_AA64ISAR0_EL1_AES, ID_AA64ISAR0_EL1_AES_AES)) + OUTPUT_BUF(" aes"); + if (SO_EQ(isar0, ID_AA64ISAR0_EL1_AES, ID_AA64ISAR0_EL1_AES_PMUL)) + OUTPUT_BUF(" pmull"); + if (SO_EQ(isar0, ID_AA64ISAR0_EL1_SHA1, + ID_AA64ISAR0_EL1_SHA1_SHA1CPMHSU)) + OUTPUT_BUF(" sha1"); + if (SO_EQ(isar0, ID_AA64ISAR0_EL1_SHA2, + ID_AA64ISAR0_EL1_SHA2_SHA256HSU)) + OUTPUT_BU
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Wed Sep 30 08:40:49 UTC 2020 Modified Files: src/sys/arch/aarch64/include: armreg.h Log Message: add some fields of ID_AA64ISAR1_EL1 definition (ARMv8.6) To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/arch/aarch64/include/armreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.53 src/sys/arch/aarch64/include/armreg.h:1.54 --- src/sys/arch/aarch64/include/armreg.h:1.53 Tue Sep 15 09:28:21 2020 +++ src/sys/arch/aarch64/include/armreg.h Wed Sep 30 08:40:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: armreg.h,v 1.53 2020/09/15 09:28:21 ryo Exp $ */ +/* $NetBSD: armreg.h,v 1.54 2020/09/30 08:40:49 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -307,6 +307,15 @@ AARCH64REG_READ_INLINE(id_aa64isar0_el1) AARCH64REG_READ_INLINE(id_aa64isar1_el1) +#define ID_AA64ISAR1_EL1_I8MM __BITS(55,52) +#define ID_AA64ISAR1_EL1_I8MM_NONE 0 +#define ID_AA64ISAR1_EL1_I8MM_SUPPORTED 1 +#define ID_AA64ISAR1_EL1_DGH __BITS(51,48) +#define ID_AA64ISAR1_EL1_DGH_NONE 0 +#define ID_AA64ISAR1_EL1_DGH_SUPPORTED 1 +#define ID_AA64ISAR1_EL1_BF16 __BITS(47,44) +#define ID_AA64ISAR1_EL1_BF16_NONE 0 +#define ID_AA64ISAR1_EL1_BF16_BFDOT 1 #define ID_AA64ISAR1_EL1_SPECRES __BITS(43,40) #define ID_AA64ISAR1_EL1_SPECRES_NONE 0 #define ID_AA64ISAR1_EL1_SPECRES_SUPPORTED 1
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Sep 24 16:15:49 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: bus_space_asm_generic.S Log Message: fix *_bs_rm_4_swap(). it was only reading 2 bytes, not 4 bytes. pointed out by skrll@ thanks. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S diff -u src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.4 --- src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3 Thu Sep 24 09:04:38 2020 +++ src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S Thu Sep 24 16:15:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $ */ +/* $NetBSD: bus_space_asm_generic.S,v 1.4 2020/09/24 16:15:49 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -29,7 +29,7 @@ #include #include "assym.h" -RCSID("$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $") +RCSID("$NetBSD: bus_space_asm_generic.S,v 1.4 2020/09/24 16:15:49 ryo Exp $") .macro generate_bsfunc funcname, dsbop /* uint8_t {funcname}_bs_r_1(x0:tag, x1:addr, x2:offset) */ @@ -225,7 +225,7 @@ ENTRY_NP(\funcname\()_bs_rm_4_swap) ldr w8, [x0, #BS_STRIDE] lsl x8, x2, x8 /* offset <<= tag->bs_stride */ 1: - ldrh w9, [x1, x8] + ldr w9, [x1, x8] subs x4, x4, #1 /* count-- */ rev w9, w9 str w9, [x3], #4
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ryo Date: Thu Sep 24 09:59:11 UTC 2020 Modified Files: src/sys/dev/ic: nvme.c Log Message: no need to swap pt.cmd.cdwXX at nvme_set_number_of_queues(). cmd.cdwXX will be swapped in nvme_pt_fill(). To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/nvme.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/nvme.c diff -u src/sys/dev/ic/nvme.c:1.50 src/sys/dev/ic/nvme.c:1.51 --- src/sys/dev/ic/nvme.c:1.50 Tue Sep 22 11:53:10 2020 +++ src/sys/dev/ic/nvme.c Thu Sep 24 09:59:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel Exp $ */ +/* $NetBSD: nvme.c,v 1.51 2020/09/24 09:59:11 ryo Exp $ */ /* $OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */ /* @@ -18,7 +18,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.50 2020/09/22 11:53:10 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.51 2020/09/24 09:59:11 ryo Exp $"); #include #include @@ -1624,8 +1624,8 @@ nvme_set_number_of_queues(struct nvme_so memset(, 0, sizeof(pt)); pt.cmd.opcode = NVM_ADMIN_SET_FEATURES; - htolem32(, NVM_FEATURE_NUMBER_OF_QUEUES); - htolem32(, ((nq - 1) << 16) | (nq - 1)); + pt.cmd.cdw10 = NVM_FEATURE_NUMBER_OF_QUEUES; + pt.cmd.cdw11 = ((nq - 1) << 16) | (nq - 1); memset(, 0, sizeof(state)); state.pt =
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Sep 24 09:04:38 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: bus_space_asm_generic.S Log Message: fix bugs in *_bs_rm_8_swap(). it was only reading 4 bytes, not 8 bytes. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S diff -u src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.2 src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.3 --- src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S:1.2 Mon Jan 13 17:23:07 2020 +++ src/sys/arch/aarch64/aarch64/bus_space_asm_generic.S Thu Sep 24 09:04:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_space_asm_generic.S,v 1.2 2020/01/13 17:23:07 ryo Exp $ */ +/* $NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -29,7 +29,7 @@ #include #include "assym.h" -RCSID("$NetBSD: bus_space_asm_generic.S,v 1.2 2020/01/13 17:23:07 ryo Exp $") +RCSID("$NetBSD: bus_space_asm_generic.S,v 1.3 2020/09/24 09:04:38 ryo Exp $") .macro generate_bsfunc funcname, dsbop /* uint8_t {funcname}_bs_r_1(x0:tag, x1:addr, x2:offset) */ @@ -248,7 +248,7 @@ ENTRY_NP(\funcname\()_bs_rm_8_swap) ldr w8, [x0, #BS_STRIDE] lsl x8, x2, x8 /* offset <<= tag->bs_stride */ 1: - ldrh w9, [x1, x8] + ldr x9, [x1, x8] subs x4, x4, #1 /* count-- */ rev x9, x9 str x9, [x3], #8
CVS commit: src/sys/arch/arm/cortex
Module Name:src Committed By: ryo Date: Thu Sep 24 08:50:09 UTC 2020 Modified Files: src/sys/arch/arm/cortex: gicv3_its.c Log Message: need to swap on big endian machines. "The ITS command queue uses a little endian memory order model." (GIC Architecture Specification) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/cortex/gicv3_its.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/cortex/gicv3_its.c diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.27 src/sys/arch/arm/cortex/gicv3_its.c:1.28 --- src/sys/arch/arm/cortex/gicv3_its.c:1.27 Thu Feb 13 02:12:06 2020 +++ src/sys/arch/arm/cortex/gicv3_its.c Thu Sep 24 08:50:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $ */ +/* $NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #define _INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.27 2020/02/13 02:12:06 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.28 2020/09/24 08:50:09 ryo Exp $"); #include #include @@ -118,7 +118,13 @@ gits_command(struct gicv3_its *its, cons cwriter = gits_read_8(its, GITS_CWRITER); woff = cwriter & GITS_CWRITER_Offset; +#if _BYTE_ORDER == _BIG_ENDIAN + uint64_t *dw = (uint64_t *)(its->its_cmd.base + woff); + for (int i = 0; i < __arraycount(cmd->dw); i++) + dw[i] = htole64(cmd->dw[i]); +#else memcpy(its->its_cmd.base + woff, cmd->dw, sizeof(cmd->dw)); +#endif bus_dmamap_sync(its->its_dmat, its->its_cmd.map, woff, sizeof(cmd->dw), BUS_DMASYNC_PREWRITE); woff += sizeof(cmd->dw);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Sep 24 05:13:03 UTC 2020 Modified Files: src/sys/dev/pci: if_aq.c Log Message: add __aligned() to all __packed structures. suppress warnings, and allow to compiler to generate more efficent code. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.18 src/sys/dev/pci/if_aq.c:1.19 --- src/sys/dev/pci/if_aq.c:1.18 Thu Sep 24 05:09:46 2020 +++ src/sys/dev/pci/if_aq.c Thu Sep 24 05:13:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $ */ +/* $NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.19 2020/09/24 05:13:03 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -653,7 +653,7 @@ typedef struct aq_mailbox_header { uint32_t version; uint32_t transaction_id; int32_t error; -} __packed aq_mailbox_header_t; +} __packed __aligned(4) aq_mailbox_header_t; typedef struct aq_hw_stats_s { uint32_t uprc; @@ -674,12 +674,12 @@ typedef struct aq_hw_stats_s { uint32_t prc; uint32_t dpc; /* not exists in fw2x_msm_statistics */ uint32_t cprc; /* not exists in fw2x_msm_statistics */ -} __packed aq_hw_stats_s_t; +} __packed __aligned(4) aq_hw_stats_s_t; typedef struct fw1x_mailbox { aq_mailbox_header_t header; aq_hw_stats_s_t msm; -} __packed fw1x_mailbox_t; +} __packed __aligned(4) fw1x_mailbox_t; typedef struct fw2x_msm_statistics { uint32_t uprc; @@ -698,16 +698,16 @@ typedef struct fw2x_msm_statistics { uint32_t ubtc; uint32_t ptc; uint32_t prc; -} __packed fw2x_msm_statistics_t; +} __packed __aligned(4) fw2x_msm_statistics_t; typedef struct fw2x_phy_cable_diag_data { uint32_t lane_data[4]; -} __packed fw2x_phy_cable_diag_data_t; +} __packed __aligned(4) fw2x_phy_cable_diag_data_t; typedef struct fw2x_capabilities { uint32_t caps_lo; uint32_t caps_hi; -} __packed fw2x_capabilities_t; +} __packed __aligned(4) fw2x_capabilities_t; typedef struct fw2x_mailbox { /* struct fwHostInterface */ aq_mailbox_header_t header; @@ -726,7 +726,7 @@ typedef struct fw2x_mailbox { /* struct fw2x_capabilities_t caps; /* ... */ -} __packed fw2x_mailbox_t; +} __packed __aligned(4) fw2x_mailbox_t; typedef enum aq_link_speed { AQ_LINK_NONE = 0, @@ -768,7 +768,7 @@ enum aq_media_type { struct aq_rx_desc_read { uint64_t buf_addr; uint64_t hdr_addr; -} __packed; +} __packed __aligned(8); struct aq_rx_desc_wb { uint32_t type; @@ -814,12 +814,12 @@ struct aq_rx_desc_wb { uint16_t pkt_len; uint16_t next_desc_ptr; uint16_t vlan; -} __packed; +} __packed __aligned(4); typedef union aq_rx_desc { struct aq_rx_desc_read read; struct aq_rx_desc_wb wb; -} __packed aq_rx_desc_t; +} __packed __aligned(8) aq_rx_desc_t; typedef struct aq_tx_desc { uint64_t buf_addr; @@ -844,7 +844,7 @@ typedef struct aq_tx_desc { #define AQ_TXDESC_CTL2_LEN __BITS(31,14) #define AQ_TXDESC_CTL2_CTX_EN __BIT(13) #define AQ_TXDESC_CTL2_CTX_IDX __BIT(12) -} __packed aq_tx_desc_t; +} __packed __aligned(8) aq_tx_desc_t; struct aq_txring { struct aq_softc *txr_sc;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: ryo Date: Thu Sep 24 05:09:47 UTC 2020 Modified Files: src/sys/dev/pci: if_aq.c Log Message: no need to swap 32bit-packed macaddr on big endian To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_aq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_aq.c diff -u src/sys/dev/pci/if_aq.c:1.17 src/sys/dev/pci/if_aq.c:1.18 --- src/sys/dev/pci/if_aq.c:1.17 Thu May 14 08:34:18 2020 +++ src/sys/dev/pci/if_aq.c Thu Sep 24 05:09:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_aq.c,v 1.17 2020/05/14 08:34:18 msaitoh Exp $ */ +/* $NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $ */ /** * aQuantia Corporation Network Driver @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.17 2020/05/14 08:34:18 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.18 2020/09/24 05:09:46 ryo Exp $"); #ifdef _KERNEL_OPT #include "opt_if_aq.h" @@ -2564,8 +2564,8 @@ aq_get_mac_addr(struct aq_softc *sc) return ENXIO; } - mac_addr[0] = bswap32(mac_addr[0]); - mac_addr[1] = bswap32(mac_addr[1]); + mac_addr[0] = htobe32(mac_addr[0]); + mac_addr[1] = htobe32(mac_addr[1]); memcpy(sc->sc_enaddr.ether_addr_octet, (uint8_t *)mac_addr, ETHER_ADDR_LEN);
CVS commit: src/sys/arch/arm/rockchip
Module Name:src Committed By: ryo Date: Sat Sep 19 18:19:09 UTC 2020 Modified Files: src/sys/arch/arm/rockchip: rk_i2c.c Log Message: fix to work on big endian To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/rockchip/rk_i2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/rockchip/rk_i2c.c diff -u src/sys/arch/arm/rockchip/rk_i2c.c:1.7 src/sys/arch/arm/rockchip/rk_i2c.c:1.8 --- src/sys/arch/arm/rockchip/rk_i2c.c:1.7 Sun Dec 22 23:23:29 2019 +++ src/sys/arch/arm/rockchip/rk_i2c.c Sat Sep 19 18:19:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_i2c.c,v 1.7 2019/12/22 23:23:29 thorpej Exp $ */ +/* $NetBSD: rk_i2c.c,v 1.8 2020/09/19 18:19:09 ryo Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.7 2019/12/22 23:23:29 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.8 2020/09/19 18:19:09 ryo Exp $"); #include #include @@ -251,6 +251,10 @@ rk_i2c_write(struct rk_i2c_softc *sc, i2 txdata.data8[0] = addr << 1; memcpy([1], cmd, cmdlen); memcpy([1 + cmdlen], buf, buflen); +#if _BYTE_ORDER == _BIG_ENDIAN + for (int i = 0; i < howmany(len + 1, 4); i++) + LE32TOH(txdata.data32[i]); +#endif bus_space_write_region_4(sc->sc_bst, sc->sc_bsh, RKI2C_TXDATA(0), txdata.data32, howmany(len + 1, 4)); WR4(sc, RKI2C_MTXCNT, __SHIFTIN(len + 1, RKI2C_MTXCNT_MTXCNT)); @@ -312,6 +316,11 @@ rk_i2c_read(struct rk_i2c_softc *sc, i2c rxdata[n/4] = RD4(sc, RKI2C_RXDATA(n/4)); #endif +#if _BYTE_ORDER == _BIG_ENDIAN + for (int i = 0; i < howmany(buflen, 4); i++) + HTOLE32(rxdata[i]); +#endif + memcpy(buf, rxdata, buflen); return 0;
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Tue Sep 15 09:28:21 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: genassym.cf locore.S locore_el2.S start.S src/sys/arch/aarch64/include: armreg.h Log Message: fix typo To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.72 -r1.73 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/locore_el2.S cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/start.S cvs rdiff -u -r1.52 -r1.53 src/sys/arch/aarch64/include/armreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/genassym.cf diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.30 src/sys/arch/aarch64/aarch64/genassym.cf:1.31 --- src/sys/arch/aarch64/aarch64/genassym.cf:1.30 Wed Aug 12 13:19:35 2020 +++ src/sys/arch/aarch64/aarch64/genassym.cf Tue Sep 15 09:28:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.30 2020/08/12 13:19:35 skrll Exp $ +# $NetBSD: genassym.cf,v 1.31 2020/09/15 09:28:20 ryo Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -365,7 +365,7 @@ define SCTLR_nTWE SCTLR_nTWE define SCTLR_WXN SCTLR_WXN define SCTLR_IESB SCTLR_IESB define SCTLR_SPAN SCTLR_SPAN -define SCTLR_EOE SCTLR_EOE +define SCTLR_E0E SCTLR_E0E define SCTLR_EE SCTLR_EE define SCTLR_UCI SCTLR_UCI define SCTLR_nTLSMD SCTLR_nTLSMD Index: src/sys/arch/aarch64/aarch64/locore.S diff -u src/sys/arch/aarch64/aarch64/locore.S:1.72 src/sys/arch/aarch64/aarch64/locore.S:1.73 --- src/sys/arch/aarch64/aarch64/locore.S:1.72 Tue Sep 15 09:23:15 2020 +++ src/sys/arch/aarch64/aarch64/locore.S Tue Sep 15 09:28:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.72 2020/09/15 09:23:15 ryo Exp $ */ +/* $NetBSD: locore.S,v 1.73 2020/09/15 09:28:20 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -38,7 +38,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore.S,v 1.72 2020/09/15 09:23:15 ryo Exp $") +RCSID("$NetBSD: locore.S,v 1.73 2020/09/15 09:28:20 ryo Exp $") #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED #define MAIR_DEVICE_MEM MAIR_DEVICE_nGnRnE @@ -390,9 +390,9 @@ ENTRY_NP(cpu_mpstart) 1: mrs x8, sctlr_el1 #ifdef __AARCH64EB__ - orr x8, x8, #(SCTLR_EE | SCTLR_EOE) /* set: Big Endian */ + orr x8, x8, #(SCTLR_EE | SCTLR_E0E) /* set: Big Endian */ #else - bic x8, x8, #(SCTLR_EE | SCTLR_EOE) /* clear: Little Endian */ + bic x8, x8, #(SCTLR_EE | SCTLR_E0E) /* clear: Little Endian */ #endif msr sctlr_el1, x8 isb Index: src/sys/arch/aarch64/aarch64/locore_el2.S diff -u src/sys/arch/aarch64/aarch64/locore_el2.S:1.6 src/sys/arch/aarch64/aarch64/locore_el2.S:1.7 --- src/sys/arch/aarch64/aarch64/locore_el2.S:1.6 Tue Sep 15 09:23:15 2020 +++ src/sys/arch/aarch64/aarch64/locore_el2.S Tue Sep 15 09:28:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_el2.S,v 1.6 2020/09/15 09:23:15 ryo Exp $ */ +/* $NetBSD: locore_el2.S,v 1.7 2020/09/15 09:28:20 ryo Exp $ */ /*- * Copyright (c) 2012-2014 Andrew Turner @@ -32,7 +32,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore_el2.S,v 1.6 2020/09/15 09:23:15 ryo Exp $") +RCSID("$NetBSD: locore_el2.S,v 1.7 2020/09/15 09:28:20 ryo Exp $") /* * For use in #include "locore_el2.S". @@ -76,7 +76,7 @@ in_el2: /* Set the bits that need to be 1 in SCTLR_EL1. */ ldr x2, .Lsctlr_res1 mrs x1, sctlr_el1 - and x1, x1, #(SCTLR_EE | SCTLR_EOE) /* keep SCTLR_EL1.{EE,E0E} */ + and x1, x1, #(SCTLR_EE | SCTLR_E0E) /* keep SCTLR_EL1.{EE,E0E} */ orr x2, x2, x1 msr sctlr_el1, x2 Index: src/sys/arch/aarch64/aarch64/start.S diff -u src/sys/arch/aarch64/aarch64/start.S:1.10 src/sys/arch/aarch64/aarch64/start.S:1.11 --- src/sys/arch/aarch64/aarch64/start.S:1.10 Tue Sep 15 09:23:15 2020 +++ src/sys/arch/aarch64/aarch64/start.S Tue Sep 15 09:28:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: start.S,v 1.10 2020/09/15 09:23:15 ryo Exp $ */ +/* $NetBSD: start.S,v 1.11 2020/09/15 09:28:20 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -33,7 +33,7 @@ #include #include "assym.h" -RCSID("$NetBSD: start.S,v 1.10 2020/09/15 09:23:15 ryo Exp $") +RCSID("$NetBSD: start.S,v 1.11 2020/09/15 09:28:20 ryo Exp $") /* * Padding at start of kernel image to make room for 64-byte header @@ -63,9 +63,9 @@ start: 1: mrs x8, sctlr_el1 #ifdef __AARCH64EB__ - orr x8, x8, #(SCTLR_EE | SCTLR_EOE) /* set: Big Endian */ + orr x8, x8, #(SCTLR_EE | SCTLR_E0E) /* set: Big Endian */ #else - bic x8, x8, #(SCTLR_EE | SCTLR_EOE) /* clear: Little Endian */ + bic x8, x8, #(SCTLR_EE | SCTLR_E0E) /* clear: Little Endian */ #endif msr sctlr_el1, x8 isb Index: src/sys/arch/aarch64/include/armreg.h diff -u src/sys/arch/aarch64/include/armreg.h:1.52 src/sys/arch/aarch64/include/armreg.h:1.53 ---
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Tue Sep 15 09:23:15 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: locore.S locore_el2.S start.S Log Message: fix aarch64eb MULTIPROCESSOR boot - set endian of EL2,EL1 and EL0 at the beginning of start() and cpu_mpstart() - drop_to_el1() keeps the endian setting To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sys/arch/aarch64/aarch64/locore.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/locore_el2.S cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/start.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/locore.S diff -u src/sys/arch/aarch64/aarch64/locore.S:1.71 src/sys/arch/aarch64/aarch64/locore.S:1.72 --- src/sys/arch/aarch64/aarch64/locore.S:1.71 Sun Aug 16 10:08:42 2020 +++ src/sys/arch/aarch64/aarch64/locore.S Tue Sep 15 09:23:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.71 2020/08/16 10:08:42 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.72 2020/09/15 09:23:15 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -38,7 +38,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore.S,v 1.71 2020/08/16 10:08:42 skrll Exp $") +RCSID("$NetBSD: locore.S,v 1.72 2020/09/15 09:23:15 ryo Exp $") #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED #define MAIR_DEVICE_MEM MAIR_DEVICE_nGnRnE @@ -373,6 +373,30 @@ printcpu: #endif /* DEBUG_LOCORE */ ENTRY_NP(cpu_mpstart) + + mrs x8, CurrentEL + lsr x8, x8, #2 + cmp x8, #0x2 + b.lo 1f + + mrs x8, sctlr_el2 +#ifdef __AARCH64EB__ + orr x8, x8, #SCTLR_EE /* set: Big Endian */ +#else + bic x8, x8, #SCTLR_EE /* clear: Little Endian */ +#endif + msr sctlr_el2, x8 + isb +1: + mrs x8, sctlr_el1 +#ifdef __AARCH64EB__ + orr x8, x8, #(SCTLR_EE | SCTLR_EOE) /* set: Big Endian */ +#else + bic x8, x8, #(SCTLR_EE | SCTLR_EOE) /* clear: Little Endian */ +#endif + msr sctlr_el1, x8 + isb + mrs x3, mpidr_el1 ldr x0, =(MPIDR_AFF0 | MPIDR_AFF1 | MPIDR_AFF2 | MPIDR_AFF3) and x3, x3, x0 @@ -925,12 +949,6 @@ mmu_enable: ldr x1, sctlr_set orr x0, x0, x1 - ldr x1, sctlr_ee -#ifdef __AARCH64EB__ - orr x0, x0, x1 /* set: BigEndian */ -#else - bic x0, x0, x1 /* clear: LittleEndian */ -#endif msr sctlr_el1, x0 /* enabling MMU! */ isb @@ -985,8 +1003,6 @@ tcr_setting: #endif -sctlr_ee: - .quad (SCTLR_EE | SCTLR_EOE) /* Endianness of Exception and EL0 */ sctlr_set: .quad ( \ SCTLR_LSMAOE | /* Load/Store Multiple Atomicity and Ordering */ \ Index: src/sys/arch/aarch64/aarch64/locore_el2.S diff -u src/sys/arch/aarch64/aarch64/locore_el2.S:1.5 src/sys/arch/aarch64/aarch64/locore_el2.S:1.6 --- src/sys/arch/aarch64/aarch64/locore_el2.S:1.5 Sat Sep 5 17:49:26 2020 +++ src/sys/arch/aarch64/aarch64/locore_el2.S Tue Sep 15 09:23:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_el2.S,v 1.5 2020/09/05 17:49:26 jakllsch Exp $ */ +/* $NetBSD: locore_el2.S,v 1.6 2020/09/15 09:23:15 ryo Exp $ */ /*- * Copyright (c) 2012-2014 Andrew Turner @@ -32,7 +32,7 @@ #include #include "assym.h" -RCSID("$NetBSD: locore_el2.S,v 1.5 2020/09/05 17:49:26 jakllsch Exp $") +RCSID("$NetBSD: locore_el2.S,v 1.6 2020/09/15 09:23:15 ryo Exp $") /* * For use in #include "locore_el2.S". @@ -75,9 +75,9 @@ in_el2: /* Set the bits that need to be 1 in SCTLR_EL1. */ ldr x2, .Lsctlr_res1 -#ifdef __AARCH64EB__ - orr x2, x2, #SCTLR_EE -#endif + mrs x1, sctlr_el1 + and x1, x1, #(SCTLR_EE | SCTLR_EOE) /* keep SCTLR_EL1.{EE,E0E} */ + orr x2, x2, x1 msr sctlr_el1, x2 /* Don't trap to EL2 on FP instructions. */ Index: src/sys/arch/aarch64/aarch64/start.S diff -u src/sys/arch/aarch64/aarch64/start.S:1.9 src/sys/arch/aarch64/aarch64/start.S:1.10 --- src/sys/arch/aarch64/aarch64/start.S:1.9 Sat Sep 5 17:49:26 2020 +++ src/sys/arch/aarch64/aarch64/start.S Tue Sep 15 09:23:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: start.S,v 1.9 2020/09/05 17:49:26 jakllsch Exp $ */ +/* $NetBSD: start.S,v 1.10 2020/09/15 09:23:15 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -33,7 +33,7 @@ #include #include "assym.h" -RCSID("$NetBSD: start.S,v 1.9 2020/09/05 17:49:26 jakllsch Exp $") +RCSID("$NetBSD: start.S,v 1.10 2020/09/15 09:23:15 ryo Exp $") /* * Padding at start of kernel image to make room for 64-byte header @@ -59,19 +59,18 @@ start: #endif msr sctlr_el2, x8 isb - b 2f 1: mrs x8, sctlr_el1 #ifdef __AARCH64EB__ - orr x8, x8, #SCTLR_EE /* set: Big Endian */ + orr x8, x8, #(SCTLR_EE | SCTLR_EOE) /* set: Big Endian */ #else - bic x8, x8, #SCTLR_EE /* clear: Little Endian */ + bic x8, x8, #(SCTLR_EE | SCTLR_EOE) /* clear: Little Endian */ #endif msr sctlr_el1, x8 isb -2: + adr x9, start ldr x10, =start
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Mon Sep 14 17:14:12 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: kobj_machdep.c Log Message: swap insns for aarch64eb To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/kobj_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/kobj_machdep.c diff -u src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.4 src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.5 --- src/sys/arch/aarch64/aarch64/kobj_machdep.c:1.4 Wed Jul 8 03:45:13 2020 +++ src/sys/arch/aarch64/aarch64/kobj_machdep.c Mon Sep 14 17:14:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kobj_machdep.c,v 1.4 2020/07/08 03:45:13 ryo Exp $ */ +/* $NetBSD: kobj_machdep.c,v 1.5 2020/09/14 17:14:12 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4 2020/07/08 03:45:13 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.5 2020/09/14 17:14:12 ryo Exp $"); #define ELFSIZE ARCH_ELFSIZE @@ -184,7 +184,7 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas old = *where; #ifdef DDB snprintf(disasmbuf, sizeof(disasmbuf), "%08x %s", - *insn, strdisasm((vaddr_t)insn), 0); + le32toh(*insn), strdisasm((vaddr_t)insn), 0); #endif #endif /* KOBJ_MACHDEP_DEBUG */ @@ -247,7 +247,8 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas } val &= WIDTHMASK(12); val >>= shift; - *insn = (*insn & ~__BITS(21,10)) | (val << 10); + *insn = htole32( + (le32toh(*insn) & ~__BITS(21,10)) | (val << 10)); break; case R_AARCH64_ADR_PREL_PG_HI21_NC: @@ -268,8 +269,9 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas } immlo = val & WIDTHMASK(2); immhi = (val >> 2) & WIDTHMASK(19); - *insn = (*insn & ~(__BITS(30,29) | __BITS(23,5))) | - (immlo << 29) | (immhi << 5); + *insn = htole32((le32toh(*insn) & + ~(__BITS(30,29) | __BITS(23,5))) | + (immlo << 29) | (immhi << 5)); break; case R_AARCH_JUMP26: @@ -291,7 +293,7 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas break; } val &= WIDTHMASK(26); - *insn = (*insn & ~__BITS(25,0)) | val; + *insn = htole32((le32toh(*insn) & ~__BITS(25,0)) | val); break; case R_AARCH64_PREL64: @@ -348,7 +350,7 @@ kobj_reloc(kobj_t ko, uintptr_t relocbas #ifdef DDB printf("%s:insn %s\n", __func__, disasmbuf); printf("%s: -> %08x %s\n", __func__, - *insn, strdisasm((vaddr_t)insn, 0)); + le32toh(*insn), strdisasm((vaddr_t)insn, 0)); #endif printf("\n"); #endif /* KOBJ_MACHDEP_DEBUG */
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Mon Sep 14 10:53:02 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: db_interface.c trap.c src/sys/arch/aarch64/include: db_machdep.h Log Message: sprinkle LE32TOH to fetch instructions on aarch64eb To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/aarch64/aarch64/db_interface.c cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/aarch64/trap.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/db_interface.c diff -u src/sys/arch/aarch64/aarch64/db_interface.c:1.9 src/sys/arch/aarch64/aarch64/db_interface.c:1.10 --- src/sys/arch/aarch64/aarch64/db_interface.c:1.9 Tue Aug 11 19:46:56 2020 +++ src/sys/arch/aarch64/aarch64/db_interface.c Mon Sep 14 10:53:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.9 2020/08/11 19:46:56 skrll Exp $ */ +/* $NetBSD: db_interface.c,v 1.10 2020/09/14 10:53:02 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.9 2020/08/11 19:46:56 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.10 2020/09/14 10:53:02 ryo Exp $"); #include #include @@ -234,6 +234,8 @@ SignExtend(int bitwidth, uint64_t imm, u db_addr_t db_branch_taken(db_expr_t inst, db_addr_t pc, db_regs_t *regs) { + LE32TOH(inst); + #define INSN_FMT_RN(insn) (((insn) >> 5) & 0x1f) #define INSN_FMT_IMM26(insn) ((insn) & 0x03ff) #define INSN_FMT_IMM19(insn) (((insn) >> 5) & 0x7) @@ -267,6 +269,8 @@ db_branch_taken(db_expr_t inst, db_addr_ bool db_inst_unconditional_flow_transfer(db_expr_t inst) { + LE32TOH(inst); + if (((inst & 0xfc1f) == 0xd65f) || /* ret xN */ ((inst & 0xfc00) == 0x9400) || /* bl */ ((inst & 0xfc1f) == 0xd63f) || /* blr */ Index: src/sys/arch/aarch64/aarch64/trap.c diff -u src/sys/arch/aarch64/aarch64/trap.c:1.36 src/sys/arch/aarch64/aarch64/trap.c:1.37 --- src/sys/arch/aarch64/aarch64/trap.c:1.36 Sun Aug 2 06:58:16 2020 +++ src/sys/arch/aarch64/aarch64/trap.c Mon Sep 14 10:53:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.36 2020/08/02 06:58:16 maxv Exp $ */ +/* $NetBSD: trap.c,v 1.37 2020/09/14 10:53:02 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.36 2020/08/02 06:58:16 maxv Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.37 2020/09/14 10:53:02 ryo Exp $"); #include "opt_arm_intr_impl.h" #include "opt_compat_netbsd32.h" @@ -386,6 +386,7 @@ emul_aarch64_insn(struct trapframe *tf) return EMUL_ARM_FAULT; } + LE32TOH(insn); if ((insn & 0xffe0) == 0xd53b0020) { /* mrs x?,ctr_el0 */ unsigned int Xt = insn & 31; Index: src/sys/arch/aarch64/include/db_machdep.h diff -u src/sys/arch/aarch64/include/db_machdep.h:1.10 src/sys/arch/aarch64/include/db_machdep.h:1.11 --- src/sys/arch/aarch64/include/db_machdep.h:1.10 Wed Jul 8 03:45:13 2020 +++ src/sys/arch/aarch64/include/db_machdep.h Mon Sep 14 10:53:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.10 2020/07/08 03:45:13 ryo Exp $ */ +/* $NetBSD: db_machdep.h,v 1.11 2020/09/14 10:53:02 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -76,7 +76,11 @@ typedef uintptr_t db_addr_t; #define BKPT_ADDR(addr) (addr) #define BKPT_SIZE 4 +#ifdef __AARCH64EB__ +#define BKPT_INSN 0x20d4 /* brk #0 */ +#else #define BKPT_INSN 0xd420 /* brk #0 */ +#endif #define BKPT_SET(insn, addr) (BKPT_INSN) typedef struct trapframe db_regs_t; @@ -99,18 +103,21 @@ int kdb_trap(int, struct trapframe *); static inline bool inst_return(db_expr_t insn) { + LE32TOH(insn); return ((insn & 0xfc1f) == 0xd65f); /* ret xN */ } static inline bool inst_trap_return(db_expr_t insn) { + LE32TOH(insn); return insn == 0xd69f03e0; /* eret */ } static inline bool inst_call(db_expr_t insn) { + LE32TOH(insn); return ((insn & 0xfc00) == 0x9400) /* bl */ || ((insn & 0xfc1f) == 0xd63f); /* blr */ } @@ -118,6 +125,7 @@ inst_call(db_expr_t insn) static inline bool inst_load(db_expr_t insn) { + LE32TOH(insn); return ((insn & 0xffe00c00) == 0xb880) || /* ldursw */ /* ldrsw imm{pre,post}idx */ @@ -155,6 +163,7 @@ inst_load(db_expr_t insn) static inline bool inst_store(db_expr_t insn) { + LE32TOH(insn); return ((insn & 0xbfe0) == 0x8820) || /* stlxp,stxp */ /* stp {pre,post}idx,stp signed,stnp */ @@ -178,6 +187,7 @@ inst_store(db_expr_t insn) static inline bool inst_branch(db_expr_t insn) { + LE32TOH(insn); return ((insn & 0xff10) == 0x5400) || /* b.cond */ ((insn & 0xfc00) == 0x1400) || /* b imm */
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Mon Sep 14 10:06:35 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c src/sys/arch/aarch64/include: cpu.h types.h Log Message: PID_MAX is just an initial value (soft maximum). Don't use it for CTASSERT. defined __HAVE_CPU_MAXPROC to use function cpu_maxproc(). pointed out by mrg@, thanks. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/aarch64/aarch64/pmap.c cvs rdiff -u -r1.26 -r1.27 src/sys/arch/aarch64/include/cpu.h cvs rdiff -u -r1.15 -r1.16 src/sys/arch/aarch64/include/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.88 src/sys/arch/aarch64/aarch64/pmap.c:1.89 --- src/sys/arch/aarch64/aarch64/pmap.c:1.88 Sun Sep 6 17:38:10 2020 +++ src/sys/arch/aarch64/aarch64/pmap.c Mon Sep 14 10:06:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $ */ +/* $NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2020/09/14 10:06:35 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" @@ -1413,6 +1413,13 @@ pmap_protect(struct pmap *pm, vaddr_t sv pm_unlock(pm); } +/* XXX: due to the current implementation of pmap depends on 16bit ASID */ +int +cpu_maxproc(void) +{ + return 65535; +} + void pmap_activate(struct lwp *l) { @@ -1436,8 +1443,7 @@ pmap_activate(struct lwp *l) reg_tcr_el1_write(tcr | TCR_EPD0); __asm __volatile("isb" ::: "memory"); - /* XXX */ - CTASSERT(PID_MAX <= 65535); /* 16bit ASID */ + /* XXX: allocate asid, and regenerate if needed */ if (pm->pm_asid == -1) pm->pm_asid = l->l_proc->p_pid; Index: src/sys/arch/aarch64/include/cpu.h diff -u src/sys/arch/aarch64/include/cpu.h:1.26 src/sys/arch/aarch64/include/cpu.h:1.27 --- src/sys/arch/aarch64/include/cpu.h:1.26 Wed Aug 12 13:19:35 2020 +++ src/sys/arch/aarch64/include/cpu.h Mon Sep 14 10:06:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.26 2020/08/12 13:19:35 skrll Exp $ */ +/* $NetBSD: cpu.h,v 1.27 2020/09/14 10:06:35 ryo Exp $ */ /*- * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc. @@ -147,6 +147,7 @@ static __inline struct cpu_info *lwp_get #undef curlwp #define curlwp (aarch64_curlwp()) +int cpu_maxproc(void); void cpu_signotify(struct lwp *l); void cpu_need_proftick(struct lwp *l); Index: src/sys/arch/aarch64/include/types.h diff -u src/sys/arch/aarch64/include/types.h:1.15 src/sys/arch/aarch64/include/types.h:1.16 --- src/sys/arch/aarch64/include/types.h:1.15 Mon Aug 3 06:30:00 2020 +++ src/sys/arch/aarch64/include/types.h Mon Sep 14 10:06:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.15 2020/08/03 06:30:00 ryo Exp $ */ +/* $NetBSD: types.h,v 1.16 2020/09/14 10:06:35 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -96,6 +96,7 @@ typedef __uint64_t __register_t; #define __HAVE_COMMON___TLS_GET_ADDR #define __HAVE_CPU_COUNTER #define __HAVE_CPU_DATA_FIRST +#define __HAVE_CPU_MAXPROC #define __HAVE_FAST_SOFTINTS #define __HAVE_MINIMAL_EMUL #define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Mon Sep 7 18:29:48 UTC 2020 Modified Files: src/sys/arch/aarch64/include: ptrace.h Log Message: Oops. revert my previous commit. AArch64 instructions are always LE. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/ptrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/ptrace.h diff -u src/sys/arch/aarch64/include/ptrace.h:1.11 src/sys/arch/aarch64/include/ptrace.h:1.12 --- src/sys/arch/aarch64/include/ptrace.h:1.11 Sun Sep 6 17:43:31 2020 +++ src/sys/arch/aarch64/include/ptrace.h Mon Sep 7 18:29:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.11 2020/09/06 17:43:31 ryo Exp $ */ +/* $NetBSD: ptrace.h,v 1.12 2020/09/07 18:29:48 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -62,11 +62,7 @@ #define PTRACE_REG_SP(r) (r)->r_sp #define PTRACE_REG_INTRV(r) (r)->r_reg[0] -#ifdef __AARCH64EB__ -#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xd4, 0x20, 0x01, 0xa0 }) -#else #define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xa0, 0x01, 0x20, 0xd4 }) -#endif #define PTRACE_BREAKPOINT_ASM __asm __volatile("brk #13" ::: "memory") #define PTRACE_BREAKPOINT_SIZE 4
CVS commit: src/sys/arch/aarch64/include
Module Name:src Committed By: ryo Date: Sun Sep 6 17:43:31 UTC 2020 Modified Files: src/sys/arch/aarch64/include: ptrace.h Log Message: need swap for aarch64be To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/ptrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/include/ptrace.h diff -u src/sys/arch/aarch64/include/ptrace.h:1.10 src/sys/arch/aarch64/include/ptrace.h:1.11 --- src/sys/arch/aarch64/include/ptrace.h:1.10 Thu Jul 2 13:04:47 2020 +++ src/sys/arch/aarch64/include/ptrace.h Sun Sep 6 17:43:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.10 2020/07/02 13:04:47 rin Exp $ */ +/* $NetBSD: ptrace.h,v 1.11 2020/09/06 17:43:31 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -62,7 +62,11 @@ #define PTRACE_REG_SP(r) (r)->r_sp #define PTRACE_REG_INTRV(r) (r)->r_reg[0] +#ifdef __AARCH64EB__ +#define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xd4, 0x20, 0x01, 0xa0 }) +#else #define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xa0, 0x01, 0x20, 0xd4 }) +#endif #define PTRACE_BREAKPOINT_ASM __asm __volatile("brk #13" ::: "memory") #define PTRACE_BREAKPOINT_SIZE 4
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Sun Sep 6 17:38:10 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: pmap.c src/sys/arch/aarch64/include: machdep.h Log Message: Fix panic caused by modload. http://mail-index.netbsd.org/port-arm/2020/08/30/msg006960.html The address space reserved for modules may not be mapped in L1-L3. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/aarch64/aarch64/pmap.c cvs rdiff -u -r1.16 -r1.17 src/sys/arch/aarch64/include/machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/pmap.c diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.87 src/sys/arch/aarch64/aarch64/pmap.c:1.88 --- src/sys/arch/aarch64/aarch64/pmap.c:1.87 Fri Aug 14 08:19:26 2020 +++ src/sys/arch/aarch64/aarch64/pmap.c Sun Sep 6 17:38:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.87 2020/08/14 08:19:26 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,10 +27,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2020/08/14 08:19:26 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2020/09/06 17:38:10 ryo Exp $"); #include "opt_arm_debug.h" #include "opt_ddb.h" +#include "opt_modular.h" #include "opt_multiprocessor.h" #include "opt_pmap.h" #include "opt_uvmhist.h" @@ -282,6 +283,12 @@ phys_to_pp(paddr_t pa) #define IN_KSEG_ADDR(va) \ IN_RANGE((va), AARCH64_KSEG_START, AARCH64_KSEG_END) +#ifdef MODULAR +#define IN_MODULE_VA(va) IN_RANGE((va), module_start, module_end) +#else +#define IN_MODULE_VA(va) false +#endif + #ifdef DIAGNOSTIC #define KASSERT_PM_ADDR(pm,va) \ do {\ @@ -1671,7 +1678,7 @@ _pmap_get_pdp(struct pmap *pm, vaddr_t v idx = l0pde_index(va); pde = l0[idx]; if (!l0pde_valid(pde)) { - KASSERT(!kenter); + KASSERT(!kenter || IN_MODULE_VA(va)); /* no need to increment L0 occupancy. L0 page never freed */ pdppa = pmap_alloc_pdp(pm, , flags, false); /* L1 pdp */ if (pdppa == POOL_PADDR_INVALID) { @@ -1689,7 +1696,7 @@ _pmap_get_pdp(struct pmap *pm, vaddr_t v idx = l1pde_index(va); pde = l1[idx]; if (!l1pde_valid(pde)) { - KASSERT(!kenter); + KASSERT(!kenter || IN_MODULE_VA(va)); pdppa0 = pdppa; pdppg0 = pdppg; pdppa = pmap_alloc_pdp(pm, , flags, false); /* L2 pdp */ @@ -1709,7 +1716,7 @@ _pmap_get_pdp(struct pmap *pm, vaddr_t v idx = l2pde_index(va); pde = l2[idx]; if (!l2pde_valid(pde)) { - KASSERT(!kenter); + KASSERT(!kenter || IN_MODULE_VA(va)); pdppa0 = pdppa; pdppg0 = pdppg; pdppa = pmap_alloc_pdp(pm, , flags, false); /* L3 pdp */ Index: src/sys/arch/aarch64/include/machdep.h diff -u src/sys/arch/aarch64/include/machdep.h:1.16 src/sys/arch/aarch64/include/machdep.h:1.17 --- src/sys/arch/aarch64/include/machdep.h:1.16 Thu Aug 6 06:49:55 2020 +++ src/sys/arch/aarch64/include/machdep.h Sun Sep 6 17:38:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.h,v 1.16 2020/08/06 06:49:55 ryo Exp $ */ +/* $NetBSD: machdep.h,v 1.17 2020/09/06 17:38:10 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -59,6 +59,8 @@ aarch64_kern_phystov(paddr_t pa) extern paddr_t physical_start; extern paddr_t physical_end; +extern vaddr_t module_start; +extern vaddr_t module_end; extern void (*cpu_reset_address0)(void); extern void (*cpu_reset_address)(void);
CVS commit: src/tests/bin/df
Module Name:src Committed By: ryo Date: Sun Aug 23 15:51:30 UTC 2020 Modified Files: src/tests/bin/df: t_df.sh Log Message: adjust the number of spaces to match the current df(1) output. fix NetBSD PR/55600 TODO: it should not be dependent on the number of spaces. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/bin/df/t_df.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/bin/df/t_df.sh diff -u src/tests/bin/df/t_df.sh:1.1 src/tests/bin/df/t_df.sh:1.2 --- src/tests/bin/df/t_df.sh:1.1 Sat Mar 17 16:33:11 2012 +++ src/tests/bin/df/t_df.sh Sun Aug 23 15:51:30 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_df.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $ +# $NetBSD: t_df.sh,v 1.2 2020/08/23 15:51:30 ryo Exp $ # # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. # All rights reserved. @@ -33,51 +33,51 @@ normal_head() { } normal_body() { cat >expout
CVS commit: src/bin/df
Module Name:src Committed By: ryo Date: Fri Aug 21 16:41:06 UTC 2020 Modified Files: src/bin/df: df.c Log Message: - Bump Size/Used/Avail from 10 to 12, and iUsed/iAvail from 8 to 10 for double-digit terabyte storage. - set the field width to the optimal, if "-h" is specified. - if blocksize is greater than M or G, reduce the size field width. To generate a diff of this commit: cvs rdiff -u -r1.96 -r1.97 src/bin/df/df.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/df/df.c diff -u src/bin/df/df.c:1.96 src/bin/df/df.c:1.97 --- src/bin/df/df.c:1.96 Fri Aug 21 16:40:02 2020 +++ src/bin/df/df.c Fri Aug 21 16:41:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: df.c,v 1.96 2020/08/21 16:40:02 ryo Exp $ */ +/* $NetBSD: df.c,v 1.97 2020/08/21 16:41:06 ryo Exp $ */ /* * Copyright (c) 1980, 1990, 1993, 1994 @@ -45,7 +45,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: df.c,v 1.96 2020/08/21 16:40:02 ryo Exp $"); +__RCSID("$NetBSD: df.c,v 1.97 2020/08/21 16:41:06 ryo Exp $"); #endif #endif /* not lint */ @@ -79,8 +79,9 @@ static int aflag, gflag, hflag, iflag, static long usize; static char **typelist; -#define WIDTH_INODE 8 -#define WIDTH_BLKSIZE 10 +#define WIDTH_INODE 10 +#define WIDTH_BLKSIZE 12 +static int blksize_width = WIDTH_BLKSIZE; int main(int argc, char *argv[]) @@ -346,9 +347,9 @@ static void prthuman(const struct statvfs *sfsp, int64_t used, int64_t bavail) { - prthumanval((int64_t)(sfsp->f_blocks * sfsp->f_frsize), WIDTH_BLKSIZE); - prthumanval((int64_t)(used * sfsp->f_frsize), 1 + WIDTH_BLKSIZE); - prthumanval((int64_t)(bavail * sfsp->f_frsize), 1 + WIDTH_BLKSIZE); + prthumanval((int64_t)(sfsp->f_blocks * sfsp->f_frsize), blksize_width); + prthumanval((int64_t)(used * sfsp->f_frsize), 1 + blksize_width); + prthumanval((int64_t)(bavail * sfsp->f_frsize), 1 + blksize_width); } /* @@ -447,10 +448,19 @@ prtstat(const struct statvfs *sfsp, int if (hflag) { header = "Size"; headerlen = (int)strlen(header); +blksize_width = 6; } else header = getbsize(, ); break; } + + if (blocksize >= 1024 * 1024) + blksize_width -= 3; + if (blocksize >= 1024 * 1024 * 1024) + blksize_width -= 3; + if (blksize_width < headerlen) + blksize_width = headerlen; + if (Pflag) { /* * either: @@ -466,9 +476,9 @@ prtstat(const struct statvfs *sfsp, int } else { (void)printf("%-*.*s %*s %*s %*s %%Cap", maxwidth, maxwidth, "Filesystem", - WIDTH_BLKSIZE, header, - WIDTH_BLKSIZE, "Used", - WIDTH_BLKSIZE, "Avail"); + blksize_width, header, + blksize_width, "Used", + blksize_width, "Avail"); if (iflag) { (void)printf(" %*s %*s %%iCap", WIDTH_INODE, "iUsed", @@ -510,10 +520,10 @@ prtstat(const struct statvfs *sfsp, int prthuman(sfsp, used, bavail); else (void)printf("%*" PRId64 " %*" PRId64 " %*" PRId64, - WIDTH_BLKSIZE, + blksize_width, fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize), - WIDTH_BLKSIZE, fsbtoblk(used, sfsp->f_frsize, blocksize), - WIDTH_BLKSIZE, fsbtoblk(bavail, sfsp->f_frsize, blocksize)); + blksize_width, fsbtoblk(used, sfsp->f_frsize, blocksize), + blksize_width, fsbtoblk(bavail, sfsp->f_frsize, blocksize)); (void)printf(" %3s%%", availblks == 0 ? full : strspct(pb, sizeof(pb), used, availblks, 0));
CVS commit: src/bin/df
Module Name:src Committed By: ryo Date: Fri Aug 21 16:40:02 UTC 2020 Modified Files: src/bin/df: df.c Log Message: field width of blocksize and inode can be changed by #define To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/bin/df/df.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/df/df.c diff -u src/bin/df/df.c:1.95 src/bin/df/df.c:1.96 --- src/bin/df/df.c:1.95 Sun Sep 22 22:59:37 2019 +++ src/bin/df/df.c Fri Aug 21 16:40:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: df.c,v 1.95 2019/09/22 22:59:37 christos Exp $ */ +/* $NetBSD: df.c,v 1.96 2020/08/21 16:40:02 ryo Exp $ */ /* * Copyright (c) 1980, 1990, 1993, 1994 @@ -45,7 +45,7 @@ __COPYRIGHT( #if 0 static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: df.c,v 1.95 2019/09/22 22:59:37 christos Exp $"); +__RCSID("$NetBSD: df.c,v 1.96 2020/08/21 16:40:02 ryo Exp $"); #endif #endif /* not lint */ @@ -72,13 +72,16 @@ static int selected(const char *, size_ static void maketypelist(char *); static size_t regetmntinfo(struct statvfs **, size_t); __dead static void usage(void); -static void prthumanval(int64_t, const char *); +static void prthumanval(int64_t, int); static void prthuman(const struct statvfs *, int64_t, int64_t); static int aflag, gflag, hflag, iflag, lflag, nflag, Pflag, Wflag; static long usize; static char **typelist; +#define WIDTH_INODE 8 +#define WIDTH_BLKSIZE 10 + int main(int argc, char *argv[]) { @@ -328,7 +331,7 @@ regetmntinfo(struct statvfs **mntbufp, s } static void -prthumanval(int64_t bytes, const char *pad) +prthumanval(int64_t bytes, int width) { char buf[6]; @@ -336,16 +339,16 @@ prthumanval(int64_t bytes, const char *p bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); - (void)printf("%s %6s", pad, buf); + (void)printf("%*s", width, buf); } static void prthuman(const struct statvfs *sfsp, int64_t used, int64_t bavail) { - prthumanval((int64_t)(sfsp->f_blocks * sfsp->f_frsize), " "); - prthumanval((int64_t)(used * sfsp->f_frsize), ""); - prthumanval((int64_t)(bavail * sfsp->f_frsize), ""); + prthumanval((int64_t)(sfsp->f_blocks * sfsp->f_frsize), WIDTH_BLKSIZE); + prthumanval((int64_t)(used * sfsp->f_frsize), 1 + WIDTH_BLKSIZE); + prthumanval((int64_t)(bavail * sfsp->f_frsize), 1 + WIDTH_BLKSIZE); } /* @@ -461,12 +464,16 @@ prtstat(const struct statvfs *sfsp, int (void)printf("Filesystem %s Used Available Capacity " "Mounted on\n", header); } else { - (void)printf("%-*.*s %s Used Avail %%Cap", - maxwidth - (headerlen - 10), - maxwidth - (headerlen - 10), - "Filesystem", header); - if (iflag) -(void)printf("iUsed iAvail %%iCap"); + (void)printf("%-*.*s %*s %*s %*s %%Cap", + maxwidth, maxwidth, "Filesystem", + WIDTH_BLKSIZE, header, + WIDTH_BLKSIZE, "Used", + WIDTH_BLKSIZE, "Avail"); + if (iflag) { +(void)printf(" %*s %*s %%iCap", +WIDTH_INODE, "iUsed", +WIDTH_INODE, "iAvail"); + } (void)printf(" Mounted on\n"); } } @@ -502,18 +509,20 @@ prtstat(const struct statvfs *sfsp, int if (hflag) prthuman(sfsp, used, bavail); else - (void)printf("%10" PRId64 " %10" PRId64 " %10" PRId64, + (void)printf("%*" PRId64 " %*" PRId64 " %*" PRId64, + WIDTH_BLKSIZE, fsbtoblk(sfsp->f_blocks, sfsp->f_frsize, blocksize), - fsbtoblk(used, sfsp->f_frsize, blocksize), - fsbtoblk(bavail, sfsp->f_frsize, blocksize)); + WIDTH_BLKSIZE, fsbtoblk(used, sfsp->f_frsize, blocksize), + WIDTH_BLKSIZE, fsbtoblk(bavail, sfsp->f_frsize, blocksize)); (void)printf(" %3s%%", availblks == 0 ? full : strspct(pb, sizeof(pb), used, availblks, 0)); if (iflag) { inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; - (void)printf(" %8jd %8jd %4s%%", - (intmax_t)used, (intmax_t)sfsp->f_ffree, + (void)printf(" %*jd %*jd %4s%%", + WIDTH_INODE, (intmax_t)used, + WIDTH_INODE, (intmax_t)sfsp->f_ffree, inodes == 0 ? (used == 0 ? empty : full) : strspct(pb, sizeof(pb), used, inodes, 0)); }
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Thu Aug 6 06:50:39 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: fault.c Log Message: No need to recover from fault from within a hardware interrupt handler. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/aarch64/fault.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/fault.c diff -u src/sys/arch/aarch64/aarch64/fault.c:1.17 src/sys/arch/aarch64/aarch64/fault.c:1.18 --- src/sys/arch/aarch64/aarch64/fault.c:1.17 Thu Aug 6 06:49:55 2020 +++ src/sys/arch/aarch64/aarch64/fault.c Thu Aug 6 06:50:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $ */ +/* $NetBSD: fault.c,v 1.18 2020/08/06 06:50:39 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.18 2020/08/06 06:50:39 ryo Exp $"); #include "opt_compat_netbsd32.h" #include "opt_ddb.h" @@ -223,10 +223,12 @@ data_abort_handler(struct trapframe *tf, do_fault: /* faultbail path? */ - fb = cpu_disable_onfault(); - if (fb != NULL) { - cpu_jump_onfault(tf, fb, EFAULT); - return; + if (curcpu()->ci_intr_depth == 0) { + fb = cpu_disable_onfault(); + if (fb != NULL) { + cpu_jump_onfault(tf, fb, EFAULT); + return; + } } handle_fault:
CVS commit: src/sys/arch/aarch64
ch/aarch64/aarch64/fault.c:1.17 --- src/sys/arch/aarch64/aarch64/fault.c:1.16 Mon Aug 3 05:56:50 2020 +++ src/sys/arch/aarch64/aarch64/fault.c Thu Aug 6 06:49:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fault.c,v 1.16 2020/08/03 05:56:50 ryo Exp $ */ +/* $NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.16 2020/08/03 05:56:50 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.17 2020/08/06 06:49:55 ryo Exp $"); #include "opt_compat_netbsd32.h" #include "opt_ddb.h" @@ -220,18 +220,11 @@ data_abort_handler(struct trapframe *tf, return; } + do_fault: /* faultbail path? */ - fb = l->l_md.md_onfault; - if (fb != NULL && fb->fb_idepth == curcpu()->ci_intr_depth) { - cpu_unset_onfault(); -#ifdef DEBUG_DUMP_ON_FAULTBAIL - printf("fault in failtbail[%p]: " - "fb_sp=%016lx, fb_lr=%016lx, fb_idepth=%u, fb_old=%p\n", - fb, fb->fb_reg[FB_SP], fb->fb_reg[FB_LR], - fb->fb_idepth, fb->fb_old); - dump_trapframe(tf, printf); -#endif + fb = cpu_disable_onfault(); + if (fb != NULL) { cpu_jump_onfault(tf, fb, EFAULT); return; } Index: src/sys/arch/aarch64/aarch64/fusu.S diff -u src/sys/arch/aarch64/aarch64/fusu.S:1.8 src/sys/arch/aarch64/aarch64/fusu.S:1.9 --- src/sys/arch/aarch64/aarch64/fusu.S:1.8 Mon Aug 3 05:56:50 2020 +++ src/sys/arch/aarch64/aarch64/fusu.S Thu Aug 6 06:49:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fusu.S,v 1.8 2020/08/03 05:56:50 ryo Exp $ */ +/* $NetBSD: fusu.S,v 1.9 2020/08/06 06:49:55 ryo Exp $ */ /*- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include #include "assym.h" -RCSID("$NetBSD: fusu.S,v 1.8 2020/08/03 05:56:50 ryo Exp $"); +RCSID("$NetBSD: fusu.S,v 1.9 2020/08/06 06:49:55 ryo Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ @@ -72,8 +72,10 @@ RCSID("$NetBSD: fusu.S,v 1.8 2020/08/03 .endm .macro exit_cpu_onfault - bl cpu_unset_onfault - mov x0, xzr + /* curlwp->l_md.md_onfault = NULL */ + mrs x1, tpidr_el1 /* curcpu */ + ldr x1, [x1, #CI_CURLWP] /* x1 = curlwp */ + str xzr, [x1, #L_MD_ONFAULT] /* lwp->l_md_onfault = NULL */ 9: PAN_ENABLE/* enable PAN */ add sp, sp, #FB_T_SIZE /* pop stack */ Index: src/sys/arch/aarch64/aarch64/genassym.cf diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.28 src/sys/arch/aarch64/aarch64/genassym.cf:1.29 --- src/sys/arch/aarch64/aarch64/genassym.cf:1.28 Mon Aug 3 06:29:59 2020 +++ src/sys/arch/aarch64/aarch64/genassym.cf Thu Aug 6 06:49:55 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.28 2020/08/03 06:29:59 ryo Exp $ +# $NetBSD: genassym.cf,v 1.29 2020/08/06 06:49:55 ryo Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -162,21 +162,20 @@ define L_MD_DB_USER offsetof(struct lwp define L_MD_GA_USER offsetof(struct lwp, l_md.md_ga_user) define LW_SYSTEM LW_SYSTEM -define FB_REG_X19 offsetof(struct faultbuf, fb_reg[FB_X19]) -define FB_REG_X20 offsetof(struct faultbuf, fb_reg[FB_X20]) -define FB_REG_X21 offsetof(struct faultbuf, fb_reg[FB_X21]) -define FB_REG_X22 offsetof(struct faultbuf, fb_reg[FB_X22]) -define FB_REG_X23 offsetof(struct faultbuf, fb_reg[FB_X23]) -define FB_REG_X24 offsetof(struct faultbuf, fb_reg[FB_X24]) -define FB_REG_X25 offsetof(struct faultbuf, fb_reg[FB_X25]) -define FB_REG_X26 offsetof(struct faultbuf, fb_reg[FB_X26]) -define FB_REG_X27 offsetof(struct faultbuf, fb_reg[FB_X27]) -define FB_REG_X28 offsetof(struct faultbuf, fb_reg[FB_X28]) -define FB_REG_X29 offsetof(struct faultbuf, fb_reg[FB_X29]) -define FB_REG_LR offsetof(struct faultbuf, fb_reg[FB_LR]) -define FB_REG_SP offsetof(struct faultbuf, fb_reg[FB_SP]) -define FB_OLD offsetof(struct faultbuf, fb_old) -define FB_IDEPTH offsetof(struct faultbuf, fb_idepth) +define FB_X19 FB_X19 +define FB_X20 FB_X20 +define FB_X21 FB_X21 +define FB_X22 FB_X22 +define FB_X23 FB_X23 +define FB_X24 FB_X24 +define FB_X25 FB_X25 +define FB_X26 FB_X26 +define FB_X27 FB_X27 +define FB_X28 FB_X28 +define FB_X29 FB_X29 +define FB_LR FB_LR +define FB_SP FB_SP +define FB_MAX FB_MAX define FB_T_SIZE roundup(sizeof(struct faultbuf), 16) define LBL_X19 LBL_X19 Index: src/sys/arch/aarch64/include/frame.h diff -u src/sys/arch/aarch64/include/frame.h:1.4 src/sys/arch/aarch64/include/frame.h:1.5 --- src/sys/arch/aarch64/include/frame.h:1.4 Mon Aug 3 05:56:50 2020 +++ src/sys/arch/aarch64/include/frame.h Thu Aug 6 06:49:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: frame.h,v 1.4 2020/08/03 05:56:50 ryo Exp $ */ +/* $NetBSD: frame.h,v 1.5 2020/08/06 06:49:55 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -70,8 +70,6 @@ __CTASSERT((sizeof(struct trapframe) & 1 #define FB_MAX 13 struct faultbuf { register_t fb_reg[FB_MAX]; - struct faultbuf *fb
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Mon Aug 3 19:16:56 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: disasm.c Log Message: make more ARMv8.x system registers are disassemblable To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/disasm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/disasm.c diff -u src/sys/arch/aarch64/aarch64/disasm.c:1.8 src/sys/arch/aarch64/aarch64/disasm.c:1.9 --- src/sys/arch/aarch64/aarch64/disasm.c:1.8 Tue May 26 05:25:21 2020 +++ src/sys/arch/aarch64/aarch64/disasm.c Mon Aug 3 19:16:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: disasm.c,v 1.8 2020/05/26 05:25:21 ryo Exp $ */ +/* $NetBSD: disasm.c,v 1.9 2020/08/03 19:16:56 ryo Exp $ */ /* * Copyright (c) 2018 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.8 2020/05/26 05:25:21 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disasm.c,v 1.9 2020/08/03 19:16:56 ryo Exp $"); #include #include @@ -342,11 +342,23 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 0, 2, 0, 0), "ttbr0_el1" }, { SYSREG_ENC(3, 0, 2, 0, 1), "ttbr1_el1" }, { SYSREG_ENC(3, 0, 2, 0, 2), "tcr_el1" }, + { SYSREG_ENC(3, 0, 2, 1, 0), "apiakeylo_el1" }, + { SYSREG_ENC(3, 0, 2, 1, 1), "apiakeyhi_el1" }, + { SYSREG_ENC(3, 0, 2, 1, 2), "apibkeylo_el1" }, + { SYSREG_ENC(3, 0, 2, 1, 3), "apibkeyhi_el1" }, + { SYSREG_ENC(3, 0, 2, 2, 0), "apdakeylo_el1" }, + { SYSREG_ENC(3, 0, 2, 2, 1), "apdakeyhi_el1" }, + { SYSREG_ENC(3, 0, 2, 2, 2), "apdbkeylo_el1" }, + { SYSREG_ENC(3, 0, 2, 2, 3), "apdbkeyhi_el1" }, + { SYSREG_ENC(3, 0, 2, 3, 0), "apgakeylo_el1" }, + { SYSREG_ENC(3, 0, 2, 3, 1), "apgakeyhi_el1" }, { SYSREG_ENC(3, 0, 4, 0, 0), "spsr_el1" }, { SYSREG_ENC(3, 0, 4, 0, 1), "elr_el1" }, { SYSREG_ENC(3, 0, 4, 1, 0), "sp_el0" }, { SYSREG_ENC(3, 0, 4, 2, 0), "spsel" }, { SYSREG_ENC(3, 0, 4, 2, 2), "currentel" }, + { SYSREG_ENC(3, 0, 4, 2, 3), "pan" }, + { SYSREG_ENC(3, 0, 4, 2, 4), "uao" }, { SYSREG_ENC(3, 0, 5, 1, 0), "afsr0_el1" }, { SYSREG_ENC(3, 0, 5, 1, 1), "afsr1_el1" }, { SYSREG_ENC(3, 0, 5, 2, 0), "esr_el1" }, @@ -369,8 +381,13 @@ const struct sysreg_table sysreg_table[] { SYSREG_ENC(3, 2, 0, 0, 0), "csselr_el1" }, { SYSREG_ENC(3, 3, 0, 0, 1), "ctr_el0" }, { SYSREG_ENC(3, 3, 0, 0, 7), "dczid_el0" }, + { SYSREG_ENC(3, 3, 2, 4, 0), "rndr" }, + { SYSREG_ENC(3, 3, 2, 4, 1), "rndrrs" }, { SYSREG_ENC(3, 3, 4, 2, 0), "nzcv" }, { SYSREG_ENC(3, 3, 4, 2, 1), "daif" }, + { SYSREG_ENC(3, 3, 4, 2, 5), "dit" }, + { SYSREG_ENC(3, 3, 4, 2, 6), "ssbs" }, + { SYSREG_ENC(3, 3, 4, 2, 7), "tco" }, { SYSREG_ENC(3, 3, 4, 4, 0), "fpcr" }, { SYSREG_ENC(3, 3, 4, 4, 1), "fpsr" }, { SYSREG_ENC(3, 3, 4, 5, 0), "dspsr_el0" }, @@ -1239,10 +1256,33 @@ static struct op_sys_table op_sys_table[ { SYSREG_ENC(1, 3, 7, 11, 1), OPE_XT, "dc\tcvau" }, { SYSREG_ENC(1, 3, 7, 14, 1), OPE_XT, "dc\tcivac" }, { SYSREG_ENC(1, 3, 7, 4, 1), OPE_XT, "dc\tzva" }, + { SYSREG_ENC(1, 0, 7, 6, 3), OPE_XT, "dc\tigvac" }, + { SYSREG_ENC(1, 0, 7, 6, 4), OPE_XT, "dc\tigsw" }, + { SYSREG_ENC(1, 0, 7, 6, 5), OPE_XT, "dc\tigdvac" }, + { SYSREG_ENC(1, 0, 7, 6, 6), OPE_XT, "dc\tigdsw" }, + { SYSREG_ENC(1, 0, 7, 10, 4), OPE_XT, "dc\tcgsw" }, + { SYSREG_ENC(1, 0, 7, 10, 6), OPE_XT, "dc\tcgdsw" }, + { SYSREG_ENC(1, 0, 7, 14, 4), OPE_XT, "dc\tcigsw" }, + { SYSREG_ENC(1, 0, 7, 14, 6), OPE_XT, "dc\tcigdsw" }, + { SYSREG_ENC(1, 3, 7, 4, 3), OPE_XT, "dc\tgva" }, + { SYSREG_ENC(1, 3, 7, 4, 4), OPE_XT, "dc\tgzva" }, + { SYSREG_ENC(1, 3, 7, 10, 3), OPE_XT, "dc\tcgvac" }, + { SYSREG_ENC(1, 3, 7, 10, 5), OPE_XT, "dc\tcgdvac" }, + { SYSREG_ENC(1, 3, 7, 12, 3), OPE_XT, "dc\tcgvap" }, + { SYSREG_ENC(1, 3, 7, 12, 5), OPE_XT, "dc\tcgdvap" }, + { SYSREG_ENC(1, 3, 7, 13, 3), OPE_XT, "dc\tcgvadp" }, + { SYSREG_ENC(1, 3, 7, 13, 5), OPE_XT, "dc\tcgdvadp" }, + { SYSREG_ENC(1, 3, 7, 14, 3), OPE_XT, "dc\tcigvac" }, + { SYSREG_ENC(1, 3, 7, 14, 5), OPE_XT, "dc\tcigdvac" }, + { SYSREG_ENC(1, 3, 7, 12, 1), OPE_XT, "dc\tcvap" }, + { SYSREG_ENC(1, 3, 7, 13, 1), OPE_XT, "dc\tcvadp" }, + { SYSREG_ENC(1, 0, 7, 8, 0), OPE_XT
CVS commit: src/sys/arch/aarch64
Module Name:src Committed By: ryo Date: Mon Aug 3 06:30:00 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: TODO copyinout.S genassym.cf src/sys/arch/aarch64/include: cpufunc.h types.h Log Message: Implement MD ucas(9) (__HAVE_UCAS_FULL) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/TODO cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/copyinout.S cvs rdiff -u -r1.27 -r1.28 src/sys/arch/aarch64/aarch64/genassym.cf cvs rdiff -u -r1.17 -r1.18 src/sys/arch/aarch64/include/cpufunc.h cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/include/types.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/TODO diff -u src/sys/arch/aarch64/aarch64/TODO:1.8 src/sys/arch/aarch64/aarch64/TODO:1.9 --- src/sys/arch/aarch64/aarch64/TODO:1.8 Wed Dec 4 13:47:03 2019 +++ src/sys/arch/aarch64/aarch64/TODO Mon Aug 3 06:29:59 2020 @@ -1,7 +1,6 @@ -$NetBSD: TODO,v 1.8 2019/12/04 13:47:03 jmcneill Exp $ +$NetBSD: TODO,v 1.9 2020/08/03 06:29:59 ryo Exp $ TODO list for NetBSD/aarch64 - kernel preemption - - Implement __HAVE_UCAS_FULL or __HAVE_UCAS_MP (don't use full generic impl) - pmap should be work even if PID_MAX >= 65536 (don't depend 16bit ASID) - TLB ASID in pmap should be randomized Index: src/sys/arch/aarch64/aarch64/copyinout.S diff -u src/sys/arch/aarch64/aarch64/copyinout.S:1.12 src/sys/arch/aarch64/aarch64/copyinout.S:1.13 --- src/sys/arch/aarch64/aarch64/copyinout.S:1.12 Mon Aug 3 05:56:49 2020 +++ src/sys/arch/aarch64/aarch64/copyinout.S Mon Aug 3 06:29:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: copyinout.S,v 1.12 2020/08/03 05:56:49 ryo Exp $ */ +/* $NetBSD: copyinout.S,v 1.13 2020/08/03 06:29:59 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #include "assym.h" -RCSID("$NetBSD: copyinout.S,v 1.12 2020/08/03 05:56:49 ryo Exp $"); +RCSID("$NetBSD: copyinout.S,v 1.13 2020/08/03 06:29:59 ryo Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ @@ -348,3 +348,50 @@ ENTRY(kcopy) exit_cpu_onfault ret END(kcopy) + + +/* LINTSTUB: int _ucas_32(volatile uint32_t *uptr, uint32_t old, uint32_t new, uint32_t *retp); */ +ENTRY(_ucas_32) + tbnz x0, AARCH64_ADDRTOP_TAG_BIT, 3f /* not userspace */ + ands x8, x0, #3 + cbnz x8, 3f/* not aligned */ + + enter_cpu_onfault + +1: ldxr w4, [x0] /* load old value */ + cmp w4, w1 /* compare? */ + b.ne 2f /* return if different */ + stxr w5, w2, [x0] /* store new value */ + cbnz w5, 1b /* succeed? nope, try again. */ +2: str w4, [x3] + mov x8, #0 /* error = 0 */ + + exit_cpu_onfault + ret +3: + mov x0, #EFAULT + ret +END(_ucas_32) + +/* LINTSTUB: int _ucas_64(volatile uint64_t *uptr, uint64_t old, uint64_t new, uint64_t *retp); */ +ENTRY(_ucas_64) + tbnz x0, AARCH64_ADDRTOP_TAG_BIT, 3f /* not userspace */ + ands x8, x0, #7 + cbnz x8, 3f/* not aligned */ + + enter_cpu_onfault + +1: ldxr x4, [x0] /* load old value */ + cmp x4, x1 /* compare? */ + b.ne 2f /* return if different */ + stxr w5, x2, [x0] /* store new value */ + cbnz w5, 1b /* succeed? nope, try again. */ +2: str x4, [x3] + mov x8, #0 /* error = 0 */ + + exit_cpu_onfault + ret +3: + mov x0, #EFAULT + ret +END(_ucas_64) Index: src/sys/arch/aarch64/aarch64/genassym.cf diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.27 src/sys/arch/aarch64/aarch64/genassym.cf:1.28 --- src/sys/arch/aarch64/aarch64/genassym.cf:1.27 Mon Aug 3 05:56:50 2020 +++ src/sys/arch/aarch64/aarch64/genassym.cf Mon Aug 3 06:29:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.27 2020/08/03 05:56:50 ryo Exp $ +# $NetBSD: genassym.cf,v 1.28 2020/08/03 06:29:59 ryo Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -56,6 +56,7 @@ include include include include +include include define __HAVE_FAST_SOFTINTS 1 @@ -76,6 +77,8 @@ define USPACE (UPAGES * PAGE_SIZE) #define PV_PA offsetof(pv_addr_t, pv_pa) +define AARCH64_ADDRTOP_TAG_BIT AARCH64_ADDRTOP_TAG_BIT + define L0_ADDR_BITS L0_ADDR_BITS define L0_SHIFT L0_SHIFT define L0_TABLE L0_TABLE Index: src/sys/arch/aarch64/include/cpufunc.h diff -u src/sys/arch/aarch64/include/cpufunc.h:1.17 src/sys/arch/aarch64/include/cpufunc.h:1.18 --- src/sys/arch/aarch64/include/cpufunc.h:1.17 Sun Aug 2 06:58:16 2020 +++ src/sys/arch/aarch64/include/cpufunc.h Mon Aug 3 06:30:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.17 2020/08/02 06:58:16 maxv Exp $ */ +/* $NetBSD: cpufunc.h,v 1.18 2020/08/03 06:30:00 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -167,6 +167,7 @@ cpu_earlydevice_va_p(void) #endif /* _KERNEL */ /* definitions of TAG and PAC in pointers */ +#define AARCH64_ADDRTOP_TAG_BIT 55 #define AARCH64_ADDRTOP_TAG __BIT(55) /* ECR_EL1.TBI[01]=1 */ #define AARCH64_ADDRTOP_MSB __BIT(63)
CVS commit: src/sys/arch/aarch64
abel); Index: src/sys/arch/aarch64/aarch64/fault.c diff -u src/sys/arch/aarch64/aarch64/fault.c:1.15 src/sys/arch/aarch64/aarch64/fault.c:1.16 --- src/sys/arch/aarch64/aarch64/fault.c:1.15 Sun Aug 2 06:58:16 2020 +++ src/sys/arch/aarch64/aarch64/fault.c Mon Aug 3 05:56:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fault.c,v 1.15 2020/08/02 06:58:16 maxv Exp $ */ +/* $NetBSD: fault.c,v 1.16 2020/08/03 05:56:50 ryo Exp $ */ /* * Copyright (c) 2017 Ryo Shimizu @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.15 2020/08/02 06:58:16 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.16 2020/08/03 05:56:50 ryo Exp $"); #include "opt_compat_netbsd32.h" #include "opt_ddb.h" @@ -220,11 +220,18 @@ data_abort_handler(struct trapframe *tf, return; } - do_fault: /* faultbail path? */ - fb = cpu_disable_onfault(); - if (fb != NULL) { + fb = l->l_md.md_onfault; + if (fb != NULL && fb->fb_idepth == curcpu()->ci_intr_depth) { + cpu_unset_onfault(); +#ifdef DEBUG_DUMP_ON_FAULTBAIL + printf("fault in failtbail[%p]: " + "fb_sp=%016lx, fb_lr=%016lx, fb_idepth=%u, fb_old=%p\n", + fb, fb->fb_reg[FB_SP], fb->fb_reg[FB_LR], + fb->fb_idepth, fb->fb_old); + dump_trapframe(tf, printf); +#endif cpu_jump_onfault(tf, fb, EFAULT); return; } Index: src/sys/arch/aarch64/aarch64/fusu.S diff -u src/sys/arch/aarch64/aarch64/fusu.S:1.7 src/sys/arch/aarch64/aarch64/fusu.S:1.8 --- src/sys/arch/aarch64/aarch64/fusu.S:1.7 Sun Aug 2 06:58:16 2020 +++ src/sys/arch/aarch64/aarch64/fusu.S Mon Aug 3 05:56:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fusu.S,v 1.7 2020/08/02 06:58:16 maxv Exp $ */ +/* $NetBSD: fusu.S,v 1.8 2020/08/03 05:56:50 ryo Exp $ */ /*- * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include #include "assym.h" -RCSID("$NetBSD: fusu.S,v 1.7 2020/08/02 06:58:16 maxv Exp $"); +RCSID("$NetBSD: fusu.S,v 1.8 2020/08/03 05:56:50 ryo Exp $"); #ifdef ARMV81_PAN #define PAN_ENABLE \ @@ -72,10 +72,8 @@ RCSID("$NetBSD: fusu.S,v 1.7 2020/08/02 .endm .macro exit_cpu_onfault - /* curlwp->l_md.md_onfault = NULL */ - mrs x1, tpidr_el1 /* curcpu */ - ldr x1, [x1, #CI_CURLWP] /* x1 = curlwp */ - str xzr, [x1, #L_MD_ONFAULT] /* lwp->l_md_onfault = NULL */ + bl cpu_unset_onfault + mov x0, xzr 9: PAN_ENABLE/* enable PAN */ add sp, sp, #FB_T_SIZE /* pop stack */ Index: src/sys/arch/aarch64/aarch64/genassym.cf diff -u src/sys/arch/aarch64/aarch64/genassym.cf:1.26 src/sys/arch/aarch64/aarch64/genassym.cf:1.27 --- src/sys/arch/aarch64/aarch64/genassym.cf:1.26 Thu May 28 04:51:44 2020 +++ src/sys/arch/aarch64/aarch64/genassym.cf Mon Aug 3 05:56:50 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.26 2020/05/28 04:51:44 ryo Exp $ +# $NetBSD: genassym.cf,v 1.27 2020/08/03 05:56:50 ryo Exp $ #- # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -159,20 +159,21 @@ define L_MD_DB_USER offsetof(struct lwp define L_MD_GA_USER offsetof(struct lwp, l_md.md_ga_user) define LW_SYSTEM LW_SYSTEM -define FB_X19 FB_X19 -define FB_X20 FB_X20 -define FB_X21 FB_X21 -define FB_X22 FB_X22 -define FB_X23 FB_X23 -define FB_X24 FB_X24 -define FB_X25 FB_X25 -define FB_X26 FB_X26 -define FB_X27 FB_X27 -define FB_X28 FB_X28 -define FB_X29 FB_X29 -define FB_LR FB_LR -define FB_SP FB_SP -define FB_MAX FB_MAX +define FB_REG_X19 offsetof(struct faultbuf, fb_reg[FB_X19]) +define FB_REG_X20 offsetof(struct faultbuf, fb_reg[FB_X20]) +define FB_REG_X21 offsetof(struct faultbuf, fb_reg[FB_X21]) +define FB_REG_X22 offsetof(struct faultbuf, fb_reg[FB_X22]) +define FB_REG_X23 offsetof(struct faultbuf, fb_reg[FB_X23]) +define FB_REG_X24 offsetof(struct faultbuf, fb_reg[FB_X24]) +define FB_REG_X25 offsetof(struct faultbuf, fb_reg[FB_X25]) +define FB_REG_X26 offsetof(struct faultbuf, fb_reg[FB_X26]) +define FB_REG_X27 offsetof(struct faultbuf, fb_reg[FB_X27]) +define FB_REG_X28 offsetof(struct faultbuf, fb_reg[FB_X28]) +define FB_REG_X29 offsetof(struct faultbuf, fb_reg[FB_X29]) +define FB_REG_LR offsetof(struct faultbuf, fb_reg[FB_LR]) +define FB_REG_SP offsetof(struct faultbuf, fb_reg[FB_SP]) +define FB_OLD offsetof(struct faultbuf, fb_old) +define FB_IDEPTH offsetof(struct faultbuf, fb_idepth) define FB_T_SIZE roundup(sizeof(struct faultbuf), 16) define LBL_X19 LBL_X19 Index: src/sys/arch/aarch64/include/frame.h diff -u src/sys/arch/aarch64/include/frame.h:1.3 src/sys/arch/aarch64/include/frame.h:1.4 --- src/sys/arch/aarch64/include/frame.h:1.3 Tue Dec 3 22:03:14 2019 +++ src/sys/arch/aarch64/include/frame.h Mon Aug 3 05:56:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: frame.h,v 1.3 2019/12/03 22:03:14 jmcneill Exp $ */ +/* $NetBSD: frame.h,v 1.4 2020/08/03 05:56:50 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -70,6 +70,8 @@ __CTASSE
CVS commit: src/sys/arch/aarch64/aarch64
Module Name:src Committed By: ryo Date: Mon Jul 27 07:32:48 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: trap.c Log Message: fix build error. need cast. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/arch/aarch64/aarch64/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/trap.c diff -u src/sys/arch/aarch64/aarch64/trap.c:1.33 src/sys/arch/aarch64/aarch64/trap.c:1.34 --- src/sys/arch/aarch64/aarch64/trap.c:1.33 Sun Jul 26 07:26:52 2020 +++ src/sys/arch/aarch64/aarch64/trap.c Mon Jul 27 07:32:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.33 2020/07/26 07:26:52 ryo Exp $ */ +/* $NetBSD: trap.c,v 1.34 2020/07/27 07:32:48 ryo Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.33 2020/07/26 07:26:52 ryo Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.34 2020/07/27 07:32:48 ryo Exp $"); #include "opt_arm_intr_impl.h" #include "opt_compat_netbsd32.h" @@ -615,10 +615,10 @@ emul_arm_swp(uint32_t insn, struct trapf if ((error = cpu_set_onfault()) == 0) { if (insn & 0x0040) { /* swpb */ - val = atomic_swap_8(vaddr, val); + val = atomic_swap_8((uint8_t *)vaddr, val); } else { /* swp */ - val = atomic_swap_32(vaddr, val); + val = atomic_swap_32((uint32_t *)vaddr, val); } cpu_unset_onfault(); tf->tf_reg[Rd] = val;