CVS commit: src/sys/arch/arm/sociox

2023-06-12 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Jun 13 00:15:52 UTC 2023

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
major code quality improvements, descriptive comments, code density.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/sociox/if_scx.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/sociox/if_scx.c
diff -u src/sys/arch/arm/sociox/if_scx.c:1.40 src/sys/arch/arm/sociox/if_scx.c:1.41
--- src/sys/arch/arm/sociox/if_scx.c:1.40	Sun May 21 00:35:38 2023
+++ src/sys/arch/arm/sociox/if_scx.c	Tue Jun 13 00:15:52 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_scx.c,v 1.40 2023/05/21 00:35:38 nisimura Exp $	*/
+/*	$NetBSD: if_scx.c,v 1.41 2023/06/13 00:15:52 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.40 2023/05/21 00:35:38 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1.41 2023/06/13 00:15:52 nisimura Exp $");
 
 #include 
 #include 
@@ -75,7 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_scx.c,v 1
 #include 
 #include 
 
-/* SC2A11 GbE 64-bit paddr descriptor */
+/* SC2A11 GbE has 64-bit paddr descriptor */
 struct tdes {
 	uint32_t t0, t1, t2, t3;
 };
@@ -105,8 +105,9 @@ struct rdes {
 #define R0_TDRID	(12)		/* 15:12 target desc ring id */
 #define R0_FS		(1U<<9)		/* first segment of frame */
 #define R0_LS		(1U<<8)		/* last segment of frame */
-#define R0_CSUM		(3U<<6)		/* 7:6 checksum status */
-#define R0_CERR		(2U<<6)		/* 0: undone, 1: found ok, 2: bad */
+#define R0_CSUM		(3U<<6)		/* 7:6 checksum status, 0: undone */
+#define R0_CERR		(2U<<6)		/* 2: found bad */
+#define R0_COK		(1U<<6)		/* 1: found ok */
 /* R1 frame address 63:32 */
 /* R2 frame address 31:0 */
 /* R3 31:16 received frame length, 15:0 buffer length to receive */
@@ -120,11 +121,11 @@ struct rdes {
 #define  INIT_DB	(1U<<2)		/* ???; self clear when done */
 #define  INIT_CLS	(1U<<1)		/* ???; self clear when done */
 #define PKTCTRL		0x140		/* pkt engine control */
-#define  MODENRM	(1U<<28)	/* change mode to normal */
+#define  MODENRM	(1U<<28)	/* set operational mode to 'normal' */
 #define  ENJUMBO	(1U<<27)	/* allow jumbo frame */
 #define  RPTCSUMERR	(1U<<3)		/* log Rx checksum error */
-#define  RPTHDCOMP	(1U<<2)		/* log HD incomplete condition */
-#define  RPTHDERR	(1U<<1)		/* log HD error */
+#define  RPTHDCOMP	(1U<<2)		/* log header incomplete condition */
+#define  RPTHDERR	(1U<<1)		/* log header error */
 #define  DROPNOMATCH	(1U<<0)		/* drop no match frames */
 #define xINTSR		0x200		/* aggregated interrupt status */
 #define  IRQ_UCODE	(1U<<20)	/* ucode load completed; W1C */
@@ -145,16 +146,16 @@ struct rdes {
 #define TXIE_SET	0x428		/* bit to set */
 #define TXIE_CLR	0x42c		/* bit to clr */
 #define  TXI_NTOWNR	(1U<<17)	/* ??? desc array got empty */
-#define  TXI_TR_ERR	(1U<<16)	/* tx error */
-#define  TXI_TXDONE	(1U<<15)	/* tx completed */
-#define  TXI_TMREXP	(1U<<14)	/* coalesce timer expired */
+#define  TXI_TR_ERR	(1U<<16)	/* xmit error */
+#define  TXI_TXDONE	(1U<<15)	/* xmit completed */
+#define  TXI_TMREXP	(1U<<14)	/* coalesce guard timer expired */
 #define RXISR		0x440		/* receive status; W1C */
 #define RXIEN		0x444		/* rx interrupt enable */
 #define RXIE_SET	0x468		/* bit to set */
 #define RXIE_CLR	0x46c		/* bit to clr */
-#define  RXI_RC_ERR	(1U<<16)	/* rx error */
-#define  RXI_PKTCNT	(1U<<15)	/* rx counter has new value */
-#define  RXI_TMREXP	(1U<<14)	/* coalesce timer expired */
+#define  RXI_RC_ERR	(1U<<16)	/* recv error */
+#define  RXI_PKTCNT	(1U<<15)	/* recv counter has new value */
+#define  RXI_TMREXP	(1U<<14)	/* coalesce guard timer expired */
 /* 13 sets of special purpose desc interrupt handling register exist */
 #define TDBA_LO		0x408		/* tdes array base addr 31:0 */
 #define TDBA_HI		0x434		/* tdes array base addr 63:32 */
@@ -163,33 +164,33 @@ struct rdes {
 /* 13 pairs of special purpose desc array base address register exist */
 #define TXCONF		0x430
 #define RXCONF		0x470
-#define  DESCNF_UP	(1U<<31)	/* up-and-running */
+#define  DESCNF_UP	(1U<<31)	/* 'up-and-running' */
 #define  DESCNF_CHRST	(1U<<30)	/* channel reset */
 #define  DESCNF_TMR	(1U<<4)		/* coalesce timer mode select */
 #define  DESCNF_LE	(1)		/* little endian desc format */
 #define TXSUBMIT	0x410		/* submit frame(s) to transmit */
-#define TXCLSCMAX	0x418		/* tx intr coalesce upper bound */
-#define RXCLSCMAX	0x458		/* rx intr coalesce upper bound */
-#define TXITIMER	0x420		/* coalesce timer usec, MSB to use */
-#define RXITIMER	0x460		/* coalesce timer usec, MSB to use */
+#define TXCOALESC	0x418		/* tx intr coalesce upper bound */
+#define RXCOALESC	0x458		/* rx intr coalesce upper bound */
+#define TCLSCTIME	0x420		/* tintr guard time usec, MSB to on */
+#define RCLSCTIME	0x460		/* rintr guard time usec, MSB to on */
 

CVS commit: src/sys/arch/arm/sociox

2023-06-12 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Jun 13 00:15:52 UTC 2023

Modified Files:
src/sys/arch/arm/sociox: if_scx.c

Log Message:
major code quality improvements, descriptive comments, code density.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/sociox/if_scx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/distrib/evbmips/instkernel/ramdisk

2023-06-12 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Mon Jun 12 23:29:32 UTC 2023

Modified Files:
src/distrib/evbmips/instkernel/ramdisk: Makefile

Log Message:
Remove redundant variable assignment

It got clobbered by another assignment later, and this has been the
case since r. 1.1 of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/evbmips/instkernel/ramdisk/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/evbmips/instkernel/ramdisk/Makefile
diff -u src/distrib/evbmips/instkernel/ramdisk/Makefile:1.16 src/distrib/evbmips/instkernel/ramdisk/Makefile:1.17
--- src/distrib/evbmips/instkernel/ramdisk/Makefile:1.16	Fri Jun  9 21:41:52 2023
+++ src/distrib/evbmips/instkernel/ramdisk/Makefile	Mon Jun 12 23:29:32 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2023/06/09 21:41:52 gutteridge Exp $
+#	$NetBSD: Makefile,v 1.17 2023/06/12 23:29:32 gutteridge Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -18,7 +18,7 @@ IMAGEENDIAN=	le
 .else
 IMAGEENDIAN=	be
 .endif
-MAKEDEVTARGETS=	ramdisk
+
 IMAGEDEPENDS=	${CRUNCHBIN} \
 		dot.profile \
 		${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \



CVS commit: src/distrib/evbmips/instkernel/ramdisk

2023-06-12 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Mon Jun 12 23:29:32 UTC 2023

Modified Files:
src/distrib/evbmips/instkernel/ramdisk: Makefile

Log Message:
Remove redundant variable assignment

It got clobbered by another assignment later, and this has been the
case since r. 1.1 of the file.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/evbmips/instkernel/ramdisk/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/misc

2023-06-12 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jun 12 21:00:38 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add DPDK.


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/share/misc/acronyms.comp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/misc

2023-06-12 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Mon Jun 12 21:00:38 UTC 2023

Modified Files:
src/share/misc: acronyms.comp

Log Message:
Add DPDK.


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/share/misc/acronyms.comp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.354 src/share/misc/acronyms.comp:1.355
--- src/share/misc/acronyms.comp:1.354	Sun Jun 11 17:54:18 2023
+++ src/share/misc/acronyms.comp	Mon Jun 12 21:00:38 2023
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.354 2023/06/11 17:54:18 dholland Exp $
+$NetBSD: acronyms.comp,v 1.355 2023/06/12 21:00:38 alnsn Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -446,6 +446,7 @@ DPAA	data path acceleration architecture
 DPC	deferred procedure call
 DPCM	differential pulse code modulation
 DPD	dead peer detection
+DPDK	data plane development kit
 DPI	deep packet inspection
 DPI	dots per inch
 DPL	descriptor privilege level



CVS commit: src/sys/arch/riscv

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 19:04:14 UTC 2023

Modified Files:
src/sys/arch/riscv/conf: files.riscv
src/sys/arch/riscv/fdt: cpu_fdt.c intc_fdt.c riscv_platform.c
src/sys/arch/riscv/include: cpu.h db_machdep.h intr.h machdep.h pmap.h
src/sys/arch/riscv/riscv: clock_machdep.c cpu.c cpu_subr.c
db_interface.c db_machdep.c genassym.cf interrupt.c locore.S
pmap_machdep.c riscv_machdep.c spl.S
Added Files:
src/sys/arch/riscv/fdt: riscv_fdtvar.h
src/sys/arch/riscv/riscv: ipifuncs.c riscv_tlb.c

Log Message:
risc-v: MULTIPROCESSOR support

Add MULTIPROCESSOR support for RISC-V, but leave disabled for the moment
as it's not 100% stable.

Some other improvements to spl and cpu identification / reporting.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/conf/files.riscv
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/fdt/cpu_fdt.c \
src/sys/arch/riscv/fdt/intc_fdt.c src/sys/arch/riscv/fdt/riscv_platform.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/fdt/riscv_fdtvar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/riscv/include/cpu.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/db_machdep.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/include/intr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/include/machdep.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/riscv/include/pmap.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/clock_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/cpu.c \
src/sys/arch/riscv/riscv/interrupt.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/riscv/cpu_subr.c \
src/sys/arch/riscv/riscv/db_interface.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/riscv/riscv/db_machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/riscv/riscv/genassym.cf
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/riscv/ipifuncs.c \
src/sys/arch/riscv/riscv/riscv_tlb.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/riscv/riscv/locore.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/riscv/riscv/pmap_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/spl.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/riscv/conf/files.riscv
diff -u src/sys/arch/riscv/conf/files.riscv:1.12 src/sys/arch/riscv/conf/files.riscv:1.13
--- src/sys/arch/riscv/conf/files.riscv:1.12	Sun May  7 12:41:48 2023
+++ src/sys/arch/riscv/conf/files.riscv	Mon Jun 12 19:04:13 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: files.riscv,v 1.12 2023/05/07 12:41:48 skrll Exp $
+#	$NetBSD: files.riscv,v 1.13 2023/06/12 19:04:13 skrll Exp $
 #
 
 maxpartitions	16
@@ -43,6 +43,7 @@ file	arch/riscv/riscv/kobj_machdep.c		mo
 file	arch/riscv/riscv/pmap_machdep.c
 file	arch/riscv/riscv/process_machdep.c
 file	arch/riscv/riscv/procfs_machdep.c	procfs
+file	arch/riscv/riscv/riscv_tlb.c
 file	arch/riscv/riscv/riscv_generic_dma.c
 file	arch/riscv/riscv/riscv_machdep.c
 file	arch/riscv/riscv/sbi.c			# SBI
@@ -63,6 +64,7 @@ file	kern/subr_disk_mbr.c			disk
 file	uvm/pmap/pmap.c
 file	uvm/pmap/pmap_devmap.c
 file	uvm/pmap/pmap_segtab.c
+file	uvm/pmap/pmap_synci.c
 file	uvm/pmap/pmap_tlb.c
 
 device  plic

Index: src/sys/arch/riscv/fdt/cpu_fdt.c
diff -u src/sys/arch/riscv/fdt/cpu_fdt.c:1.1 src/sys/arch/riscv/fdt/cpu_fdt.c:1.2
--- src/sys/arch/riscv/fdt/cpu_fdt.c:1.1	Sun May  7 12:41:48 2023
+++ src/sys/arch/riscv/fdt/cpu_fdt.c	Mon Jun 12 19:04:13 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.1 2023/05/07 12:41:48 skrll Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.2 2023/06/12 19:04:13 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,13 +29,167 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.1 2023/05/07 12:41:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.2 2023/06/12 19:04:13 skrll Exp $");
 
 #include 
+#include 
 
 #include 
 
+#include 
 #include 
+#include 
+#include 
+
+#include 
+
+
+#ifdef MULTIPROCESSOR
+static bool
+riscv_fdt_cpu_okay(const int child)
+{
+	const char *s;
+
+	s = fdtbus_get_string(child, "device_type");
+	if (!s || strcmp(s, "cpu") != 0)
+		return false;
+
+	s = fdtbus_get_string(child, "status");
+	if (s) {
+		if (strcmp(s, "okay") == 0)
+			return true;
+		if (strcmp(s, "disabled") == 0)
+			return false;
+		return false;
+	} else {
+		return true;
+	}
+}
+#endif /* MULTIPROCESSOR */
+
+void
+riscv_fdt_cpu_bootstrap(void)
+{
+#ifdef MULTIPROCESSOR
+
+	const int cpus = OF_finddevice("/cpus");
+	if (cpus == -1) {
+		aprint_error("%s: no /cpus node found\n", __func__);
+		riscv_cpu_max = 1;
+		return;
+	}
+
+	/* Count harts and add hart IDs to to cpu_hartid array */
+	size_t cpuindex = 1;
+	for (int child = OF_child(cpus); child; child = OF_peer(child)) {
+		if (!riscv_fdt_cpu_okay(child))
+			continue;
+
+		riscv_cpu_max++;
+
+		uint64_t reg;
+		if (fdtbus_get_reg64(child, 0, , NULL) != 0)
+			

CVS commit: src/sys/arch/riscv

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 19:04:14 UTC 2023

Modified Files:
src/sys/arch/riscv/conf: files.riscv
src/sys/arch/riscv/fdt: cpu_fdt.c intc_fdt.c riscv_platform.c
src/sys/arch/riscv/include: cpu.h db_machdep.h intr.h machdep.h pmap.h
src/sys/arch/riscv/riscv: clock_machdep.c cpu.c cpu_subr.c
db_interface.c db_machdep.c genassym.cf interrupt.c locore.S
pmap_machdep.c riscv_machdep.c spl.S
Added Files:
src/sys/arch/riscv/fdt: riscv_fdtvar.h
src/sys/arch/riscv/riscv: ipifuncs.c riscv_tlb.c

Log Message:
risc-v: MULTIPROCESSOR support

Add MULTIPROCESSOR support for RISC-V, but leave disabled for the moment
as it's not 100% stable.

Some other improvements to spl and cpu identification / reporting.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/riscv/conf/files.riscv
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/fdt/cpu_fdt.c \
src/sys/arch/riscv/fdt/intc_fdt.c src/sys/arch/riscv/fdt/riscv_platform.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/fdt/riscv_fdtvar.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/riscv/include/cpu.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/include/db_machdep.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/riscv/include/intr.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/include/machdep.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/riscv/include/pmap.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/clock_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/cpu.c \
src/sys/arch/riscv/riscv/interrupt.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/riscv/cpu_subr.c \
src/sys/arch/riscv/riscv/db_interface.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/riscv/riscv/db_machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/riscv/riscv/genassym.cf
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/riscv/ipifuncs.c \
src/sys/arch/riscv/riscv/riscv_tlb.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/riscv/riscv/locore.S
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/riscv/riscv/pmap_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/spl.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/riscv/fdt

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 18:59:57 UTC 2023

Modified Files:
src/sys/arch/riscv/fdt: files.fdt

Log Message:
sort


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/fdt/files.fdt

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/riscv/fdt/files.fdt
diff -u src/sys/arch/riscv/fdt/files.fdt:1.2 src/sys/arch/riscv/fdt/files.fdt:1.3
--- src/sys/arch/riscv/fdt/files.fdt:1.2	Mon Jun 12 12:58:17 2023
+++ src/sys/arch/riscv/fdt/files.fdt	Mon Jun 12 18:59:57 2023
@@ -1,11 +1,10 @@
-# $NetBSD: files.fdt,v 1.2 2023/06/12 12:58:17 skrll Exp $
+# $NetBSD: files.fdt,v 1.3 2023/06/12 18:59:57 skrll Exp $
 
 include	"dev/pckbport/files.pckbport"
 
-file	arch/riscv/fdt/riscv_platform.c
-
 file	arch/riscv/fdt/cpus_fdt.c
 file	arch/riscv/fdt/fdt_dma_machdep.c
+file	arch/riscv/fdt/riscv_platform.c
 
 attach	cpu at fdt with cpu_fdt
 file	arch/riscv/fdt/cpu_fdt.c		cpu_fdt



CVS commit: src/sys/arch/riscv/fdt

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 18:59:57 UTC 2023

Modified Files:
src/sys/arch/riscv/fdt: files.fdt

Log Message:
sort


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/riscv/fdt/files.fdt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 12:58:17 UTC 2023

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/riscv/fdt: files.fdt
src/sys/dev/fdt: cpus.c fdtvar.h
Added Files:
src/sys/arch/arm/fdt: cpus_fdt.c
src/sys/arch/riscv/fdt: cpus_fdt.c

Log Message:
Call / define fdtbus_cpus_md_attach for platforms with cpus @ fdt.

The RISC-V binding here seems somewhat of an abuse, but it exists in
mainline linux.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/cpus_fdt.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/fdt/cpus_fdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/fdt/files.fdt
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/cpus.c
cvs rdiff -u -r1.78 -r1.79 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/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.34 src/sys/arch/arm/fdt/files.fdt:1.35
--- src/sys/arch/arm/fdt/files.fdt:1.34	Thu Jul 22 00:47:55 2021
+++ src/sys/arch/arm/fdt/files.fdt	Mon Jun 12 12:58:17 2023
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.34 2021/07/22 00:47:55 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.35 2023/06/12 12:58:17 skrll Exp $
 
 include	"dev/pckbport/files.pckbport"
 
@@ -7,6 +7,7 @@ attach	armfdt at root with arm_fdt
 file	arch/arm/fdt/arm_fdt.c			arm_fdt
 file	arch/arm/fdt/arm_platform.c		arm_fdt & gtmr_fdt & psci_fdt
 file	arch/arm/fdt/arm_simplefb.c		arm_fdt & wsdisplay & genfb
+file	arch/arm/fdt/cpus_fdt.c			arm_fdt
 
 attach	cpu at fdt with cpu_fdt
 file	arch/arm/fdt/cpu_fdt.c			cpu_fdt

Index: src/sys/arch/riscv/fdt/files.fdt
diff -u src/sys/arch/riscv/fdt/files.fdt:1.1 src/sys/arch/riscv/fdt/files.fdt:1.2
--- src/sys/arch/riscv/fdt/files.fdt:1.1	Sun May  7 12:41:48 2023
+++ src/sys/arch/riscv/fdt/files.fdt	Mon Jun 12 12:58:17 2023
@@ -1,11 +1,11 @@
-# $NetBSD: files.fdt,v 1.1 2023/05/07 12:41:48 skrll Exp $
+# $NetBSD: files.fdt,v 1.2 2023/06/12 12:58:17 skrll Exp $
 
 include	"dev/pckbport/files.pckbport"
 
 file	arch/riscv/fdt/riscv_platform.c
 
+file	arch/riscv/fdt/cpus_fdt.c
 file	arch/riscv/fdt/fdt_dma_machdep.c
-file	arch/riscv/fdt/fdt_cpus_machdep.c
 
 attach	cpu at fdt with cpu_fdt
 file	arch/riscv/fdt/cpu_fdt.c		cpu_fdt

Index: src/sys/dev/fdt/cpus.c
diff -u src/sys/dev/fdt/cpus.c:1.7 src/sys/dev/fdt/cpus.c:1.8
--- src/sys/dev/fdt/cpus.c:1.7	Sun May  7 12:41:49 2023
+++ src/sys/dev/fdt/cpus.c	Mon Jun 12 12:58:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: cpus.c,v 1.7 2023/05/07 12:41:49 skrll Exp $ */
+/* $NetBSD: cpus.c,v 1.8 2023/06/12 12:58:17 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.7 2023/05/07 12:41:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.8 2023/06/12 12:58:17 skrll Exp $");
 
 #include 
 #include 
@@ -39,10 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.7
 
 #include 
 
-#ifdef __riscv
-#include 
-#endif
-
 static int	cpus_match(device_t, cfdata_t, void *);
 static void	cpus_attach(device_t, device_t, void *);
 
@@ -68,9 +64,8 @@ cpus_attach(device_t parent, device_t se
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-#ifdef __riscv
-	cpus_fdt_md_attach(parent, self, faa);
-#endif
+	fdtbus_cpus_md_attach(parent, self, faa);
+
 	for (child = OF_child(phandle); child; child = OF_peer(child)) {
 		if (!cpus_cpu_enabled(child))
 			continue;

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.78 src/sys/dev/fdt/fdtvar.h:1.79
--- src/sys/dev/fdt/fdtvar.h:1.78	Fri Apr  7 08:55:31 2023
+++ src/sys/dev/fdt/fdtvar.h	Mon Jun 12 12:58:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.78 2023/04/07 08:55:31 skrll Exp $ */
+/* $NetBSD: fdtvar.h,v 1.79 2023/06/12 12:58:17 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -552,6 +552,8 @@ const char *	fdtbus_get_string(int, cons
 const char *	fdtbus_get_string_index(int, const char *, u_int);
 int		fdtbus_get_index(int, const char *, const char *, u_int *);
 
+void		fdtbus_cpus_md_attach(device_t, device_t, void *);
+
 void		fdt_add_bus(device_t, int, struct fdt_attach_args *);
 void		fdt_add_bus_match(device_t, int, struct fdt_attach_args *,
 		bool (*)(void *, int), void *);

Added files:

Index: src/sys/arch/arm/fdt/cpus_fdt.c
diff -u /dev/null src/sys/arch/arm/fdt/cpus_fdt.c:1.1
--- /dev/null	Mon Jun 12 12:58:17 2023
+++ src/sys/arch/arm/fdt/cpus_fdt.c	Mon Jun 12 12:58:17 2023
@@ -0,0 +1,43 @@
+/* $NetBSD: cpus_fdt.c,v 1.1 2023/06/12 12:58:17 skrll Exp $ */
+
+/*-
+ * Copyright (c) 2023 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nick Hudson
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * 

CVS commit: src/sys

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 12:58:17 UTC 2023

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/riscv/fdt: files.fdt
src/sys/dev/fdt: cpus.c fdtvar.h
Added Files:
src/sys/arch/arm/fdt: cpus_fdt.c
src/sys/arch/riscv/fdt: cpus_fdt.c

Log Message:
Call / define fdtbus_cpus_md_attach for platforms with cpus @ fdt.

The RISC-V binding here seems somewhat of an abuse, but it exists in
mainline linux.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/fdt/cpus_fdt.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/fdt/cpus_fdt.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/fdt/files.fdt
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/fdt/cpus.c
cvs rdiff -u -r1.78 -r1.79 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.



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:47:17 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:47:17 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.58 src/sys/uvm/pmap/pmap_tlb.c:1.59
--- src/sys/uvm/pmap/pmap_tlb.c:1.58	Mon Jun 12 06:36:28 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Mon Jun 12 06:47:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -1114,7 +1114,7 @@ void
 pmap_db_tlb_print(struct pmap *pm,
 void (*pr)(const char *, ...) __printflike(1, 2))
 {
-#if PMAP_TLB_MAX == 1
+#if !defined(MULTIPROCESSOR) || PMAP_TLB_MAX == 1
 	pr(" asid %5u\n", pm->pm_pai[0].pai_asid);
 #else
 	for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) {



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:36:28 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fixup UVMHIST builds


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c
diff -u src/sys/uvm/pmap/pmap_tlb.c:1.57 src/sys/uvm/pmap/pmap_tlb.c:1.58
--- src/sys/uvm/pmap/pmap_tlb.c:1.57	Sat Apr 22 10:22:43 2023
+++ src/sys/uvm/pmap/pmap_tlb.c	Mon Jun 12 06:36:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $");
 
 /*
  * Manages address spaces in a TLB.
@@ -557,14 +557,14 @@ pmap_tlb_shootdown_process(void)
 	__func__, ci->ci_cpl, IPL_SCHED);
 
 	TLBINFO_LOCK(ti);
-	UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0);
+	UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0);
 
 	switch (ti->ti_tlbinvop) {
 	case TLBINV_ONE: {
 		/*
 		 * We only need to invalidate one user ASID.
 		 */
-		UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", ti->ti_victim, 0, 0, 0);
+		UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", (uintptr_t)ti->ti_victim, 0, 0, 0);
 		struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti);
 		KASSERT(ti->ti_victim != pmap_kernel());
 		if (pmap_tlb_intersecting_onproc_p(ti->ti_victim, ti)) {
@@ -674,7 +674,7 @@ pmap_tlb_shootdown_bystanders(pmap_t pm)
 		KASSERT(i < pmap_ntlbs);
 		struct pmap_tlb_info * const ti = pmap_tlbs[i];
 		KASSERT(tlbinfo_index(ti) == i);
-		UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0);
+		UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0);
 		/*
 		 * Skip this TLB if there are no active mappings for it.
 		 */



CVS commit: src/sys/uvm/pmap

2023-06-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jun 12 06:36:28 UTC 2023

Modified Files:
src/sys/uvm/pmap: pmap_tlb.c

Log Message:
Fixup UVMHIST builds


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.