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

2022-09-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 21 06:34:30 UTC 2022

Modified Files:
src/sys/arch/riscv/include: pte.h

Log Message:
Use c99 types. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/include/pte.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/riscv/include/pte.h
diff -u src/sys/arch/riscv/include/pte.h:1.6 src/sys/arch/riscv/include/pte.h:1.7
--- src/sys/arch/riscv/include/pte.h:1.6	Sat May  1 07:41:24 2021
+++ src/sys/arch/riscv/include/pte.h	Wed Sep 21 06:34:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.6 2021/05/01 07:41:24 skrll Exp $ */
+/* $NetBSD: pte.h,v 1.7 2022/09/21 06:34:30 skrll Exp $ */
 
 /*
  * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@@ -38,15 +38,15 @@
 #define	PTE_PPN0	__BITS(18, 10)
 #define	PTE_PPN1	__BITS(27, 19)
 #define	PTE_PPN2	__BITS(53, 28)
-typedef __uint64_t pt_entry_t;
-typedef __uint64_t pd_entry_t;
+typedef uint64_t pt_entry_t;
+typedef uint64_t pd_entry_t;
 #define atomic_cas_pte	atomic_cas_64
 #else		/* Sv32 */
 #define PTE_PPN		__BITS(31, 10)
 #define	PTE_PPN0	__BITS(19, 10)
 #define	PTE_PPN1	__BITS(31, 20)
-typedef __uint32_t pt_entry_t;
-typedef __uint32_t pd_entry_t;
+typedef uint32_t pt_entry_t;
+typedef uint32_t pd_entry_t;
 #define atomic_cas_pte	atomic_cas_32
 #endif
 



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

2022-09-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 21 06:34:30 UTC 2022

Modified Files:
src/sys/arch/riscv/include: pte.h

Log Message:
Use c99 types. NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/riscv/include/pte.h

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



CVS commit: src/lib/libedit

2022-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 21 01:33:53 UTC 2022

Modified Files:
src/lib/libedit: readline.c

Log Message:
PR/57016: Ricky Zhou: declare lastidx


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/lib/libedit/readline.c

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

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.175 src/lib/libedit/readline.c:1.176
--- src/lib/libedit/readline.c:1.175	Tue Sep 20 19:41:14 2022
+++ src/lib/libedit/readline.c	Tue Sep 20 21:33:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.175 2022/09/20 23:41:14 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.176 2022/09/21 01:33:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.175 2022/09/20 23:41:14 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.176 2022/09/21 01:33:53 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -478,6 +478,8 @@ readline(const char *p)
 	ret = el_gets(e, &count);
 
 	if (ret && count > 0) {
+		int lastidx;
+
 		buf = strdup(ret);
 		if (buf == NULL)
 			goto out;



CVS commit: src/lib/libedit

2022-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 21 01:33:53 UTC 2022

Modified Files:
src/lib/libedit: readline.c

Log Message:
PR/57016: Ricky Zhou: declare lastidx


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/lib/libedit/readline.c

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



Re: CVS commit: src/sys/dev/pci

2022-09-20 Thread Ryo Shimizu


>> Module Name: src
>> Committed By:skrll
>> Date:Fri Sep 16 03:55:53 UTC 2022
>>
>> Modified Files:
>>  src/sys/dev/pci: if_aq.c
>>
>> Log Message:
>> Some MP improvements
>>
>> - Remove use of IFF_OACTIVE
>>
>> - Remove use of if_timer and provide an MP safe multiqueue watchdog
>>
>> - Sprinkle some lock assertions.
>>
>> Tested by ryo@. Thanks.
>
>this asserts for me.  perhaps ryo@ didn't have LOCKDEBUG?

I had LOCKDEBUG on, but not DEBUG. 
https://nxr.netbsd.org/xref/src/sys/sys/systm.h#760
I see that adding options DEBUG does indeed cause a panic with 
ASSERT_SLEEPABLE()...

-- 
ryo shimizu


re: CVS commit: src/sys/dev/pci

2022-09-20 Thread matthew green
"Nick Hudson" writes:
> Module Name:  src
> Committed By: skrll
> Date: Fri Sep 16 03:55:53 UTC 2022
>
> Modified Files:
>   src/sys/dev/pci: if_aq.c
>
> Log Message:
> Some MP improvements
>
> - Remove use of IFF_OACTIVE
>
> - Remove use of if_timer and provide an MP safe multiqueue watchdog
>
> - Sprinkle some lock assertions.
>
> Tested by ryo@. Thanks.

this asserts for me.  perhaps ryo@ didn't have LOCKDEBUG?

the problem is that aq_init() calls AQ_LOCK(sc) -- this is
a spin mutex -- and then calls aq_init_locked().  however,
aq_init_locked() calls ASSERT_SLEEPABLE() since it has a
code path that calls callout_halt() (which wants to sleep.)

ie, the function that expects to be called with a spin
mutex held also calls ASSERT_SLEEPABLE().  even if i were
to comment that call, the later call to callout_halt() is
the real problem.

the only way i saw to handle this without investing some
other method to invoke the callout_halt() from another lwp
was to change aq_stop_locked() to return a value that says
that callout_halt is needed here.  that needs to be passed
upto aq_stop() as well as aq_init(), both of which call
aq_stop_locked().  it needs a little re-arrange due to
aq_init_locked() already returning a value for aq_init()
to return directly (and aq_init() is where the mutex will
be dropped, and it's safe to callout_halt().)

for now i'm running with rev 1.32.

thanks.


.mrg.


CVS commit: src/lib/libedit

2022-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 20 23:41:14 UTC 2022

Modified Files:
src/lib/libedit: readline.c

Log Message:
PR/57016: Ricky Zhou: Revert to trimming the last newline instead of the
first one so that multi-line commands work again.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/lib/libedit/readline.c

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

Modified files:

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.174 src/lib/libedit/readline.c:1.175
--- src/lib/libedit/readline.c:1.174	Fri Apr  8 16:11:31 2022
+++ src/lib/libedit/readline.c	Tue Sep 20 19:41:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.175 2022/09/20 23:41:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.174 2022/04/08 20:11:31 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.175 2022/09/20 23:41:14 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -481,7 +481,9 @@ readline(const char *p)
 		buf = strdup(ret);
 		if (buf == NULL)
 			goto out;
-		buf[strcspn(buf, "\n")] = '\0';
+		lastidx = count - 1;
+		if (buf[lastidx] == '\n')
+			buf[lastidx] = '\0';
 	} else
 		buf = NULL;
 



CVS commit: src/lib/libedit

2022-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Sep 20 23:41:14 UTC 2022

Modified Files:
src/lib/libedit: readline.c

Log Message:
PR/57016: Ricky Zhou: Revert to trimming the last newline instead of the
first one so that multi-line commands work again.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/lib/libedit/readline.c

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



CVS commit: src/sys

2022-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Sep 20 23:01:42 UTC 2022

Modified Files:
src/sys/dev/pci: pcireg.h
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_device.c
src/sys/external/bsd/drm2/include/linux: pci.h
src/sys/external/bsd/drm2/linux: linux_pci.c

Log Message:
fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
  pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
  (negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
cvs rdiff -u -r1.53 -r1.54 src/sys/external/bsd/drm2/include/linux/pci.h
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/linux/linux_pci.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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.165 src/sys/dev/pci/pcireg.h:1.166
--- src/sys/dev/pci/pcireg.h:1.165	Mon Jan 31 10:14:55 2022
+++ src/sys/dev/pci/pcireg.h	Tue Sep 20 23:01:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.165 2022/01/31 10:14:55 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.166 2022/09/20 23:01:42 mrg Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1063,7 +1063,20 @@ typedef u_int8_t pci_revision_t;
 #define PCIE_LCSR_LABIE		__BIT(11)  /* Link Autonomous BW Intr En */
 #define	PCIE_LCSR_DRSSGNL	__BITS(15, 14) /* DRS Signaling */
 #define	PCIE_LCSR_LINKSPEED	__BITS(19, 16) /* Link Speed */
+#define  PCIE_LCSR_LINKSPEED_2	1	   /* 2.5GT/s */
+#define  PCIE_LCSR_LINKSPEED_5	2	   /* 5GT/s */
+#define  PCIE_LCSR_LINKSPEED_8	3	   /* 8GT/s */
+#define  PCIE_LCSR_LINKSPEED_16	4	   /* 16GT/s */
+#define  PCIE_LCSR_LINKSPEED_32	5	   /* 32GT/s */
+#define  PCIE_LCSR_LINKSPEED_64	6	   /* 64GT/s */
 #define	PCIE_LCSR_NLW		__BITS(25, 20) /* Negotiated Link Width */
+#define  PCIE_LCSR_NLW_X1	__BIT(20)	/* Negotiated x1 */
+#define  PCIE_LCSR_NLW_X2	__BIT(21)	/* Negotiated x2 */
+#define  PCIE_LCSR_NLW_X4	__BIT(22)	/* Negotiated x4 */
+#define  PCIE_LCSR_NLW_X8	__BIT(23)	/* Negotiated x8 */
+#define  PCIE_LCSR_NLW_X12	__BITS(22, 23)	/* Negotiated x12 */
+#define  PCIE_LCSR_NLW_X16	__BIT(24)	/* Negotiated x16 */
+#define  PCIE_LCSR_NLW_X32	__BIT(25)	/* Negotiated x32 */
 #define	PCIE_LCSR_LINKTRAIN_ERR	__BIT(10 + 16) /* Link Training Error */
 #define	PCIE_LCSR_LINKTRAIN	__BIT(11 + 16) /* Link Training */
 #define	PCIE_LCSR_SLOTCLKCFG	__BIT(12 + 16) /* Slot Clock Configuration */

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.16 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.16	Sun Dec 19 12:41:33 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c	Tue Sep 20 23:01:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_device.c,v 1.16 2021/12/19 12:41:33 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_device.c,v 1.17 2022/09/20 23:01:42 mrg Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *  Jerome Glisse
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.16 2021/12/19 12:41:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.17 2022/09/20 23:01:42 mrg Exp $");
 
 #include 
 #include 
@@ -4447,7 +4447,6 @@ skip_sched_resume:
  */
 static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)
 {
-#ifndef __NetBSD__		/* XXX amdgpu pcie */
 	struct pci_dev *pdev;
 	enum pci_bus_speed speed_cap, platform_speed_cap;
 	enum pcie_link_width platform_link_width;
@@ -4571,7 +4570,6 @@ static void amdgpu_device_get_pcie_info(
 			}
 		}
 	}
-#endif
 }
 
 int amdgpu_device_baco_enter(struct drm_device *dev)

Index: src/sys/external/bsd/drm2/include/linux/pci.h
diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.53 src/sys/external/bsd/drm2/include/linux/pci.h:1.54
--- src/sys/external/bsd/drm2/include/linux/pci.h:1.53	Sun Feb 27 14:23:08 2022
+++ src/sys/external/bsd/drm2/include/linux/pci.h	Tue Sep 20 23:01:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.h,v 1.53 2022/02/27 14:23:08 riastradh Exp $	*/
+/*	$NetBSD: pci.h,v 1.54 2022/09/20 23:01:42 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -190,6 +190,24 @@ enum pci_bus_speed {
 	PCIE_SPEED_5_0GT,
 	PCIE_SPEED_8_0GT,
 	PCIE_SPEED_16_0GT,
+	PCIE_SPEED_32_0GT,
+	PCIE_SPEED_64_0GT,
+};
+
+/*
+ * Actually values from the Link Status register, bits 16-19.  Don't use
+ * these as a bit-mask -- these are the only known, valid values.
+ */
+enum 

CVS commit: src/sys

2022-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Sep 20 23:01:42 UTC 2022

Modified Files:
src/sys/dev/pci: pcireg.h
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_device.c
src/sys/external/bsd/drm2/include/linux: pci.h
src/sys/external/bsd/drm2/linux: linux_pci.c

Log Message:
fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
  pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
  (negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
cvs rdiff -u -r1.53 -r1.54 src/sys/external/bsd/drm2/include/linux/pci.h
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/drm2/linux/linux_pci.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep 20 12:25:01 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Typo in comment. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.59 src/sys/arch/powerpc/fpu/fpu_emu.c:1.60
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.59	Tue Sep 20 12:12:42 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Tue Sep 20 12:25:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.59 2022/09/20 12:12:42 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.60 2022/09/20 12:25:01 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.59 2022/09/20 12:12:42 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.60 2022/09/20 12:25:01 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -298,7 +298,7 @@ success:
  *format, it is stored as normalized double value in FRs;
  *denormalization is required in this case.
  *  - When magnitude is smaller than the minimum denormalized number in
- *float format, the result is undefined. For G5 (790MP Rev 1.1),
+ *float format, the result is undefined. For G5 (970MP Rev 1.1),
  *(sign | 0) seems to be stored. For G4 and prior, some ``random''
  *garbage is stored in exponent. We mimic G5 for now.
  */



CVS commit: src/sys/arch/powerpc/fpu

2022-09-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep 20 12:25:01 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Typo in comment. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/powerpc/fpu/fpu_emu.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep 20 12:12:42 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
stfs{,x}{,u}: Switch to conversion algorithm specified by Power ISA.

The ISA specifies algorithm for most bit patterns in double format, that
are not representable in float. I believe that sane people do not rely on
such a specification detail, but *REAL* programmers may utilize it ;)

Instead of complicating fpu_explode(), single-purpose helper function,
fpu_to_single(), is introduced. See comment therein for more details.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/powerpc/fpu/fpu_emu.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep 20 12:12:42 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
stfs{,x}{,u}: Switch to conversion algorithm specified by Power ISA.

The ISA specifies algorithm for most bit patterns in double format, that
are not representable in float. I believe that sane people do not rely on
such a specification detail, but *REAL* programmers may utilize it ;)

Instead of complicating fpu_explode(), single-purpose helper function,
fpu_to_single(), is introduced. See comment therein for more details.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.58 src/sys/arch/powerpc/fpu/fpu_emu.c:1.59
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.58	Thu Sep 15 14:25:28 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Tue Sep 20 12:12:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.58 2022/09/15 14:25:28 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.59 2022/09/20 12:12:42 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.58 2022/09/15 14:25:28 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.59 2022/09/20 12:12:42 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -283,6 +283,56 @@ success:
 }
 
 /*
+ * fpu_to_single(): Helper function for stfs{,u}{,x}.
+ *
+ * Single-precision (float) data is internally represented in
+ * double-precision (double) format in floating-point registers (FRs).
+ * Even though double value cannot be translated into float format in
+ * general, Power ISA (2.0.3--3.1) specify conversion algorithm when
+ * stored to memory (see Sec. 4.6.3):
+ *
+ *  - Extra fraction bits are truncated regardless of rounding mode.
+ *  - When magnitude is larger than the maximum number in float format,
+ *bits 63--62 and 58--29 are mechanically copied into bits 31--0.
+ *  - When magnitude is representable as denormalized number in float
+ *format, it is stored as normalized double value in FRs;
+ *denormalization is required in this case.
+ *  - When magnitude is smaller than the minimum denormalized number in
+ *float format, the result is undefined. For G5 (790MP Rev 1.1),
+ *(sign | 0) seems to be stored. For G4 and prior, some ``random''
+ *garbage is stored in exponent. We mimic G5 for now.
+ */
+static uint32_t
+fpu_to_single(uint64_t reg)
+{
+	uint32_t sign, frac, word;
+	int exp, shift;
+
+	sign = (reg & __BIT(63)) >> 32;
+	exp = __SHIFTOUT(reg, __BITS(62, 52)) - 1023;
+	if (exp > -127 || (reg & ~__BIT(63)) == 0) {
+		/*
+		 * No denormalization required: normalized, zero, inf, NaN,
+		 * or numbers larger than MAXFLOAT (see comment above).
+		 *
+		 * Note that MSB and 7-LSBs in exponent are same for double
+		 * and float formats in this case.
+		 */
+		word =  ((reg & __BIT(62)) >> 32) |
+		__SHIFTOUT(reg, __BITS(58, 52) | __BITS(51, 29));
+	} else if (exp <= -127 && exp >= -149) {
+		/* Denormalized. */
+		shift = - 126 - exp; /* 1 ... 23 */
+		frac = __SHIFTOUT(__BIT(52) | reg, __BITS(52, 29 + shift));
+		word = /* __SHIFTIN(0, __BITS(30, 23)) | */ frac;
+	} else {
+		/* Undefined. Mimic G5 for now. */
+		word = 0;
+	}
+	return sign | word;
+}
+
+/*
  * Execute an FPU instruction (one that runs entirely in the FPU; not
  * FBfcc or STF, for instance).  On return, fe->fe_fs->fs_fsr will be
  * modified to reflect the setting the hardware would have left.
@@ -411,28 +461,32 @@ fpu_execute(struct trapframe *tf, struct
 
 		if (store) {
 			/* Store */
+			uint32_t word;
+			const void *kaddr;
+
 			FPU_EMU_EVCNT_INCR(fpstore);
 			if (type != FTYPE_DBL) {
-uint64_t buf;
-
+/*
+ * As Power ISA specifies conversion algorithm
+ * for store floating-point single insns, we
+ * cannot use fpu_explode() and _implode() here.
+ * See fpu_to_single() and comment therein for
+ * more details.
+ */
 DPRINTF(FPE_INSN,
 	("fpu_execute: Store SNG at %p\n",
 		(void *)addr));
-fpu_explode(fe, fp = &fe->fe_f1, FTYPE_DBL,
-FR(rt));
-fpu_implode(fe, fp, type, &buf);
-if (copyout(&buf, (void *)addr, size)) {
-	fe->fe_addr = addr;
-	return (FAULT);
-}
+word = fpu_to_single(FR(rt));
+kaddr = &word;
 			} else {
 DPRINTF(FPE_INSN,
 	("fpu_execute: Store DBL at %p\n",
 		(void *)addr));
-if (copyout(&FR(rt), (void *)addr, size)) {
-	fe->fe_addr = addr;
-	return (FAULT);
-}
+kaddr = &FR(rt);
+			}
+			if (copyout(kaddr, (void *)addr, size)) {
+fe->fe_addr = addr;
+return (FAULT);
 			}
 		} else {
 			/* Load */



CVS commit: src/sys/netinet

2022-09-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep 20 10:12:18 UTC 2022

Modified Files:
src/sys/netinet: tcp_syncache.c tcp_syncache.h

Log Message:
syncache: make some functions static


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/tcp_syncache.c \
src/sys/netinet/tcp_syncache.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/netinet/tcp_syncache.c
diff -u src/sys/netinet/tcp_syncache.c:1.1 src/sys/netinet/tcp_syncache.c:1.2
--- src/sys/netinet/tcp_syncache.c:1.1	Tue Sep 20 07:19:14 2022
+++ src/sys/netinet/tcp_syncache.c	Tue Sep 20 10:12:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_syncache.c,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_syncache.c,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_syncache.c,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -201,7 +201,11 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_syncache
 #endif	/* IPSEC*/
 #endif
 
-static void syn_cache_timer(void *);
+static void	syn_cache_timer(void *);
+static struct syn_cache *
+		syn_cache_lookup(const struct sockaddr *, const struct sockaddr *,
+		struct syn_cache_head **);
+static int	syn_cache_respond(struct syn_cache *);
 
 /* syn hash parameters */
 #define	TCP_SYN_HASH_SIZE	293
@@ -497,7 +501,7 @@ syn_cache_cleanup(struct tcpcb *tp)
 /*
  * Find an entry in the syn cache.
  */
-struct syn_cache *
+static struct syn_cache *
 syn_cache_lookup(const struct sockaddr *src, const struct sockaddr *dst,
 struct syn_cache_head **headp)
 {
@@ -1094,7 +1098,7 @@ syn_cache_add(struct sockaddr *src, stru
  * Returns 0 on success.
  */
 
-int
+static int
 syn_cache_respond(struct syn_cache *sc)
 {
 #ifdef INET6
Index: src/sys/netinet/tcp_syncache.h
diff -u src/sys/netinet/tcp_syncache.h:1.1 src/sys/netinet/tcp_syncache.h:1.2
--- src/sys/netinet/tcp_syncache.h:1.1	Tue Sep 20 07:19:14 2022
+++ src/sys/netinet/tcp_syncache.h	Tue Sep 20 10:12:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_syncache.h,v 1.1 2022/09/20 07:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_syncache.h,v 1.2 2022/09/20 10:12:18 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -207,15 +207,13 @@ int	 syn_cache_add(struct sockaddr *, st
 		struct mbuf *, u_char *, int, struct tcp_opt_info *);
 void	 syn_cache_unreach(const struct sockaddr *, const struct sockaddr *,
 	   struct tcphdr *);
-struct socket *syn_cache_get(struct sockaddr *, struct sockaddr *,
+struct socket
+	*syn_cache_get(struct sockaddr *, struct sockaddr *,
 		struct tcphdr *, struct socket *so, struct mbuf *);
 void	 syn_cache_init(void);
 void	 syn_cache_insert(struct syn_cache *, struct tcpcb *);
-struct syn_cache *syn_cache_lookup(const struct sockaddr *, const struct sockaddr *,
-		struct syn_cache_head **);
 void	 syn_cache_reset(struct sockaddr *, struct sockaddr *,
 		struct tcphdr *);
-int	 syn_cache_respond(struct syn_cache *);
 void	 syn_cache_cleanup(struct tcpcb *);
 #endif
 



CVS commit: src/sys/netinet

2022-09-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep 20 10:12:18 UTC 2022

Modified Files:
src/sys/netinet: tcp_syncache.c tcp_syncache.h

Log Message:
syncache: make some functions static


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/netinet/tcp_syncache.c \
src/sys/netinet/tcp_syncache.h

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



CVS commit: src/doc

2022-09-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 20 07:37:29 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc: note tradcpp import, my fault for ignoring commits that start
with "Initial revision"


To generate a diff of this commit:
cvs rdiff -u -r1.2906 -r1.2907 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.2906 src/doc/CHANGES:1.2907
--- src/doc/CHANGES:1.2906	Tue Sep 20 07:28:06 2022
+++ src/doc/CHANGES	Tue Sep 20 07:37:29 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2906 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2907 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -664,6 +664,10 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	evbarm: Add initial support for the Rockchip RK3588 SoC.
 		[ryo 20220823]
 	acpi(4): Updated ACPICA to 20220331. [christos 20220827]
+	tradcpp(1): Import tradcpp to base for programs that require a
+		C preprocessor to process their configuration but should
+		still work without the compiler set installed.
+		[dholland 20220827]
 	ftp(1): Add TLS/SSL certificate verification. [christos 20220830]
 	xen: Add experimental support for PVH dom0. [bouyer 20220901]
 	make(1): Add .break to terminate .for loops early. [sjg 20220902]



CVS commit: src/doc

2022-09-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 20 07:37:29 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc: note tradcpp import, my fault for ignoring commits that start
with "Initial revision"


To generate a diff of this commit:
cvs rdiff -u -r1.2906 -r1.2907 src/doc/CHANGES

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



CVS commit: src/doc

2022-09-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 20 07:28:06 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc/CHANGES: Update with recent changes from September


To generate a diff of this commit:
cvs rdiff -u -r1.2905 -r1.2906 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.2905 src/doc/CHANGES:1.2906
--- src/doc/CHANGES:1.2905	Fri Sep  9 22:15:13 2022
+++ src/doc/CHANGES	Tue Sep 20 07:28:06 2022
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2905 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2906 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -664,6 +664,22 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	evbarm: Add initial support for the Rockchip RK3588 SoC.
 		[ryo 20220823]
 	acpi(4): Updated ACPICA to 20220331. [christos 20220827]
+	ftp(1): Add TLS/SSL certificate verification. [christos 20220830]
 	xen: Add experimental support for PVH dom0. [bouyer 20220901]
+	make(1): Add .break to terminate .for loops early. [sjg 20220902]
+	udl(4): Improve performance of refreshing mostly static displays.
+		[nat 20220906]
+	amiga: Update loadbsd to version 3.2.  Add detection of A600, fix
+		handling of multiple -n options, fix compiling with recent
+		AmigaOS gcc. [phx 20220906]
 	grep(1): with -r and no file argument, search current directory
 		[wiz 20220909]
+	ftp(1): Support redirects to relative URLs.  [kim 20220911]
+	httpd(8): Add -q option to make httpd quiet.  [martin 20220912]
+	nvmm(4): Add suspend/resume support.  [riastradh 20220913]
+	aq(4): Various improvements to NET_MPSAFE support.  [skrll 20220916]
+	sh(1): Add -l option to create a login shell, overrides
+		the presence (or otherwise) of a '-' as argv[0][0].
+		[kre 20220918]
+	netinet: Remove routes on an address removal if the routes
+		reference the address. [ozaki-r 20220920]



CVS commit: src/doc

2022-09-20 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Sep 20 07:28:06 UTC 2022

Modified Files:
src/doc: CHANGES

Log Message:
doc/CHANGES: Update with recent changes from September


To generate a diff of this commit:
cvs rdiff -u -r1.2905 -r1.2906 src/doc/CHANGES

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



CVS commit: src

2022-09-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep 20 07:19:15 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/netinet: Makefile files.netinet tcp_input.c tcp_subr.c
tcp_usrreq.c tcp_var.h
src/sys/rump/net/lib/libnetinet: Makefile.inc
Added Files:
src/sys/netinet: tcp_syncache.c tcp_syncache.h

Log Message:
tcp: separate syn cache stuffs into tcp_syncache.[ch] files

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2423 -r1.2424 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.30 -r1.31 src/sys/netinet/Makefile
cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/files.netinet
cvs rdiff -u -r1.433 -r1.434 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.290 -r1.291 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r0 -r1.1 src/sys/netinet/tcp_syncache.c \
src/sys/netinet/tcp_syncache.h
cvs rdiff -u -r1.231 -r1.232 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.15 -r1.16 src/sys/rump/net/lib/libnetinet/Makefile.inc

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2423 src/distrib/sets/lists/comp/mi:1.2424
--- src/distrib/sets/lists/comp/mi:1.2423	Sat Sep 10 15:50:57 2022
+++ src/distrib/sets/lists/comp/mi	Tue Sep 20 07:19:14 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2423 2022/09/10 15:50:57 rillig Exp $
+#	$NetBSD: mi,v 1.2424 2022/09/20 07:19:14 ozaki-r Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2745,6 +2745,7 @@
 ./usr/include/netinet/tcp_debug.h		comp-c-include
 ./usr/include/netinet/tcp_fsm.h			comp-c-include
 ./usr/include/netinet/tcp_seq.h			comp-c-include
+./usr/include/netinet/tcp_syncache.h		comp-c-include
 ./usr/include/netinet/tcp_timer.h		comp-c-include
 ./usr/include/netinet/tcp_var.h			comp-c-include
 ./usr/include/netinet/tcp_vtw.h			comp-c-include

Index: src/sys/netinet/Makefile
diff -u src/sys/netinet/Makefile:1.30 src/sys/netinet/Makefile:1.31
--- src/sys/netinet/Makefile:1.30	Thu Sep  6 06:42:00 2018
+++ src/sys/netinet/Makefile	Tue Sep 20 07:19:14 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.30 2018/09/06 06:42:00 maxv Exp $
+#	$NetBSD: Makefile,v 1.31 2022/09/20 07:19:14 ozaki-r Exp $
 
 INCSDIR= /usr/include/netinet
 
@@ -8,8 +8,8 @@ INCS=	dccp.h icmp6.h icmp_var.h if_ether
 	in_var.h ip.h ip_carp.h ip6.h ip_ecn.h ip_encap.h \
 	ip_icmp.h ip_mroute.h ip_var.h pim.h pim_var.h portalgo.h \
 	sctp.h sctp_uio.h \
-	tcp.h tcp_debug.h tcp_fsm.h tcp_seq.h tcp_timer.h tcp_var.h \
-	tcpip.h udp.h udp_var.h \
+	tcp.h tcp_debug.h tcp_fsm.h tcp_seq.h tcp_syncache.h tcp_timer.h \
+	tcp_var.h tcpip.h udp.h udp_var.h \
 	tcp_vtw.h
 
 # ipfilter headers

Index: src/sys/netinet/files.netinet
diff -u src/sys/netinet/files.netinet:1.29 src/sys/netinet/files.netinet:1.30
--- src/sys/netinet/files.netinet:1.29	Mon Mar  8 18:03:25 2021
+++ src/sys/netinet/files.netinet	Tue Sep 20 07:19:14 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.netinet,v 1.29 2021/03/08 18:03:25 christos Exp $
+#	$NetBSD: files.netinet,v 1.30 2022/09/20 07:19:14 ozaki-r Exp $
 
 defflag opt_tcp_debug.h		TCP_DEBUG
 defparam opt_tcp_debug.h	TCP_NDEBUG
@@ -45,6 +45,7 @@ file	netinet/tcp_input.c	inet | inet6
 file	netinet/tcp_output.c	inet | inet6
 file	netinet/tcp_sack.c	inet | inet6
 file	netinet/tcp_subr.c	inet | inet6
+file	netinet/tcp_syncache.c	inet | inet6
 file	netinet/tcp_timer.c	inet | inet6
 file	netinet/tcp_usrreq.c	inet | inet6
 file	netinet/tcp_congctl.c	inet | inet6

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.433 src/sys/netinet/tcp_input.c:1.434
--- src/sys/netinet/tcp_input.c:1.433	Tue May 24 20:50:20 2022
+++ src/sys/netinet/tcp_input.c	Tue Sep 20 07:19:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.433 2022/05/24 20:50:20 andvar Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.434 2022/09/20 07:19:14 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -137,18 +137,8 @@
  *	@(#)tcp_input.c	8.12 (Berkeley) 5/24/95
  */
 
-/*
- *	TODO list for SYN cache stuff:
- *
- *	Find room for a "state" field, which is needed to keep a
- *	compressed state for TIME_WAIT TCBs.  It's been noted already
- *	that this is fairly important for very high-volume web and
- *	mail servers, which use a large number of short-lived
- *	connections.
- */
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.433 2022/05/24 20:50:20 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.434 2022/09/20 07:19:14 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -214,6 +204,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_input.c,
 #include 
 #include 
 #include 
+#include 
 
 #ifdef INET6
 #include "faith.h"
@@ -245,8 +236,6 @@ static struct timeval tcp_rst_ppslim_las
 static int tcp_ackdrop_ppslim_count = 0;
 st

CVS commit: src

2022-09-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Sep 20 07:19:15 UTC 2022

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/netinet: Makefile files.netinet tcp_input.c tcp_subr.c
tcp_usrreq.c tcp_var.h
src/sys/rump/net/lib/libnetinet: Makefile.inc
Added Files:
src/sys/netinet: tcp_syncache.c tcp_syncache.h

Log Message:
tcp: separate syn cache stuffs into tcp_syncache.[ch] files

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.2423 -r1.2424 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.30 -r1.31 src/sys/netinet/Makefile
cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/files.netinet
cvs rdiff -u -r1.433 -r1.434 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.290 -r1.291 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r0 -r1.1 src/sys/netinet/tcp_syncache.c \
src/sys/netinet/tcp_syncache.h
cvs rdiff -u -r1.231 -r1.232 src/sys/netinet/tcp_usrreq.c
cvs rdiff -u -r1.196 -r1.197 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.15 -r1.16 src/sys/rump/net/lib/libnetinet/Makefile.inc

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

2022-09-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 20 07:18:24 UTC 2022

Modified Files:
src/sys/arch/riscv/include: locore.h pmap.h vmparam.h
src/sys/arch/riscv/riscv: genassym.cf locore.S pmap_machdep.c
riscv_machdep.c
Added Files:
src/sys/arch/riscv/include: machdep.h

Log Message:
Checkpoint WIP.

QEMU RV64 virt can boot into virtual mode

OpenSBI v1.0
   _  _
  / __ \  / |  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |) | |_) || |_
  \/| .__/ \___|_| |_|_/|/_|
| |
|_|

Platform Name : riscv-virtio,qemu
Platform Features : medeleg
Platform HART Count   : 1
Platform IPI Device   : aclint-mswi
Platform Timer Device : aclint-mtimer @ 1000Hz
Platform Console Device   : uart8250
Platform HSM Device   : ---
Platform Reboot Device: sifive_test
Platform Shutdown Device  : sifive_test
Firmware Base : 0x8000
Firmware Size : 252 KB
Runtime SBI Version   : 0.3

Domain0 Name  : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00  : 0x0200-0x0200 (I)
Domain0 Region01  : 0x8000-0x8003 ()
Domain0 Region02  : 0x-0x (R,W,X)
Domain0 Next Address  : 0x8020
Domain0 Next Arg1 : 0xbfe0
Domain0 Next Mode : S-mode
Domain0 SysReset  : yes

Boot HART ID  : 0
Boot HART Domain  : root
Boot HART ISA : rv64imafdcsuh
Boot HART Features: scounteren,mcounteren,mcountinhibit,time
Boot HART PMP Count   : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count  : 16
Boot HART MIDELEG : 0x1666
Boot HART MEDELEG : 0x00f0b509


NetBSD start

sp:  0x__80a0_2000
pc:  0x__8020_0090
hart:0x___
dtb: 0x__bfe0_
l1:  0x__80a0_2000
l2:  0x__80a0_3000
uspace:  0x__80a0_
bootstk: 0x__80a0_2000
vtopdiff:0x_ffbf_7fe0_

bss: 0x__808a_8bdc - 0x__80a0_4000

0x__80a0_3800: 0x__2028_0821

kern 0x__80a0_2000: 0x__2008_002f
kern 0x__80a0_2008: 0x__2010_002f
kern 0x__80a0_2010: 0x__2018_002f
kern 0x__80a0_2018: 0x__2020_002f
kern 0x__80a0_2020: 0x__2028_002f
kern 0x__80a0_2028: 0x__2030_002f
kern 0x__80a0_2030: 0x__2038_002f
kern 0x__80a0_2038: 0x__2040_002f
kern 0x__80a0_2040: 0x__2048_002f
kern 0x__80a0_2048: 0x__2050_002f
kern 0x__80a0_2050: 0x__2058_002f
kern 0x__80a0_2058: 0x__2060_002f
kern 0x__80a0_2060: 0x__2068_002f
kern 0x__80a0_2068: 0x__2070_002f
kern 0x__80a0_2070: 0x__2078_002f
kern 0x__80a0_2078: 0x__2080_002f
dtb  0x__80a0_2080: 0x__2ff8_0027
PM
[   1.000] FDT<0xffc00200>
[   1.000] consinit ok
[   1.000] NetBSD/riscv (fdt) booting ...
[   1.000] FDT /memory @ 0x8000 size 0x4000
[   1.000] init_riscv: memory start 8000 end c000 (len 4000)
[   1.000] bootargs: root=ld4a -v -x
[   1.000] bootflag 'r' not recognised
[   1.000] bootflag 'o' not recognised
[   1.000] bootflag 'o' not recognised
[   1.000] bootflag 't' not recognised
[   1.000] bootflag '=' not recognised
[   1.000] bootflag 'l' not recognised
[   1.000] bootflag ' ' not recognised
[   1.000] bootflag ' ' not recognised
[   1.000] --
[   1.000]kern_vtopdiff = 0xffbf7fe0
[   1.000] memory_start = 0x8000
[   1.000]   memory_end = 0xc000
[   1.000]  memory_size = 0x4000
[   1.000]   kernstart_phys = 0x8020
[   1.000] kernend_phys = 0x80a0
[   1.000]VM_MIN_KERNEL_ADDRESS = 0xffc0
[   1.000]   kernstart_mega = 0xffc0
[   1.000]kernstart = 0xffc0
[   1.000]  kernend = 0xffc00080
[   1.000] kernend_mega = 0xffc00080
[   1.000]VM_MAX_KERNEL_ADDRESS = 0xffd0
[   1.000] --
[   1.000] panic: kernel diagnostic assertion "msgbufaddr != 0" failed: 
file "/home/nick/netbsd/nbcvs/src/sys/arch/riscv/riscv/riscv_machdep.c", line 
564


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch

CVS commit: src/sys/arch/riscv

2022-09-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep 20 07:18:24 UTC 2022

Modified Files:
src/sys/arch/riscv/include: locore.h pmap.h vmparam.h
src/sys/arch/riscv/riscv: genassym.cf locore.S pmap_machdep.c
riscv_machdep.c
Added Files:
src/sys/arch/riscv/include: machdep.h

Log Message:
Checkpoint WIP.

QEMU RV64 virt can boot into virtual mode

OpenSBI v1.0
   _  _
  / __ \  / |  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |) | |_) || |_
  \/| .__/ \___|_| |_|_/|/_|
| |
|_|

Platform Name : riscv-virtio,qemu
Platform Features : medeleg
Platform HART Count   : 1
Platform IPI Device   : aclint-mswi
Platform Timer Device : aclint-mtimer @ 1000Hz
Platform Console Device   : uart8250
Platform HSM Device   : ---
Platform Reboot Device: sifive_test
Platform Shutdown Device  : sifive_test
Firmware Base : 0x8000
Firmware Size : 252 KB
Runtime SBI Version   : 0.3

Domain0 Name  : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00  : 0x0200-0x0200 (I)
Domain0 Region01  : 0x8000-0x8003 ()
Domain0 Region02  : 0x-0x (R,W,X)
Domain0 Next Address  : 0x8020
Domain0 Next Arg1 : 0xbfe0
Domain0 Next Mode : S-mode
Domain0 SysReset  : yes

Boot HART ID  : 0
Boot HART Domain  : root
Boot HART ISA : rv64imafdcsuh
Boot HART Features: scounteren,mcounteren,mcountinhibit,time
Boot HART PMP Count   : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 54
Boot HART MHPM Count  : 16
Boot HART MIDELEG : 0x1666
Boot HART MEDELEG : 0x00f0b509


NetBSD start

sp:  0x__80a0_2000
pc:  0x__8020_0090
hart:0x___
dtb: 0x__bfe0_
l1:  0x__80a0_2000
l2:  0x__80a0_3000
uspace:  0x__80a0_
bootstk: 0x__80a0_2000
vtopdiff:0x_ffbf_7fe0_

bss: 0x__808a_8bdc - 0x__80a0_4000

0x__80a0_3800: 0x__2028_0821

kern 0x__80a0_2000: 0x__2008_002f
kern 0x__80a0_2008: 0x__2010_002f
kern 0x__80a0_2010: 0x__2018_002f
kern 0x__80a0_2018: 0x__2020_002f
kern 0x__80a0_2020: 0x__2028_002f
kern 0x__80a0_2028: 0x__2030_002f
kern 0x__80a0_2030: 0x__2038_002f
kern 0x__80a0_2038: 0x__2040_002f
kern 0x__80a0_2040: 0x__2048_002f
kern 0x__80a0_2048: 0x__2050_002f
kern 0x__80a0_2050: 0x__2058_002f
kern 0x__80a0_2058: 0x__2060_002f
kern 0x__80a0_2060: 0x__2068_002f
kern 0x__80a0_2068: 0x__2070_002f
kern 0x__80a0_2070: 0x__2078_002f
kern 0x__80a0_2078: 0x__2080_002f
dtb  0x__80a0_2080: 0x__2ff8_0027
PM
[   1.000] FDT<0xffc00200>
[   1.000] consinit ok
[   1.000] NetBSD/riscv (fdt) booting ...
[   1.000] FDT /memory @ 0x8000 size 0x4000
[   1.000] init_riscv: memory start 8000 end c000 (len 4000)
[   1.000] bootargs: root=ld4a -v -x
[   1.000] bootflag 'r' not recognised
[   1.000] bootflag 'o' not recognised
[   1.000] bootflag 'o' not recognised
[   1.000] bootflag 't' not recognised
[   1.000] bootflag '=' not recognised
[   1.000] bootflag 'l' not recognised
[   1.000] bootflag ' ' not recognised
[   1.000] bootflag ' ' not recognised
[   1.000] --
[   1.000]kern_vtopdiff = 0xffbf7fe0
[   1.000] memory_start = 0x8000
[   1.000]   memory_end = 0xc000
[   1.000]  memory_size = 0x4000
[   1.000]   kernstart_phys = 0x8020
[   1.000] kernend_phys = 0x80a0
[   1.000]VM_MIN_KERNEL_ADDRESS = 0xffc0
[   1.000]   kernstart_mega = 0xffc0
[   1.000]kernstart = 0xffc0
[   1.000]  kernend = 0xffc00080
[   1.000] kernend_mega = 0xffc00080
[   1.000]VM_MAX_KERNEL_ADDRESS = 0xffd0
[   1.000] --
[   1.000] panic: kernel diagnostic assertion "msgbufaddr != 0" failed: 
file "/home/nick/netbsd/nbcvs/src/sys/arch/riscv/riscv/riscv_machdep.c", line 
564


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch

CVS commit: src/sys/dev/usb

2022-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Sep 20 07:15:46 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
revert rev 1.111 (which was 1.106 again, without the 1.107 changes).

fixes an assert reported by msaitoh@.  also fix another missing miilock
assert in usbnet_stop() that triggered for me.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/usb/usbnet.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/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.111 src/sys/dev/usb/usbnet.c:1.112
--- src/sys/dev/usb/usbnet.c:1.111	Tue Sep 13 09:38:19 2022
+++ src/sys/dev/usb/usbnet.c	Tue Sep 20 07:15:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.111 2022/09/13 09:38:19 riastradh Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.111 2022/09/13 09:38:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.112 2022/09/20 07:15:46 mrg Exp $");
 
 #include 
 #include 
@@ -1162,13 +1162,6 @@ usbnet_stop(struct usbnet *un, struct if
 		mutex_exit(&unp->unp_miilock);
 	}
 
-	/*
-	 * Now that we have stopped calling mii_tick, bring the MII
-	 * state machine down.
-	 */
-	if (mii)
-		mii_down(mii);
-
 	/* Stop transfers. */
 	usbnet_ep_stop_pipes(un);
 
@@ -1182,8 +1175,11 @@ usbnet_stop(struct usbnet *un, struct if
 	 * it's been unplugged then there's no point in trying to touch
 	 * the registers.
 	 */
-	if (!usbnet_isdying(un))
+	if (!usbnet_isdying(un)) {
+		mutex_enter(&unp->unp_miilock);
 		uno_stop(un, ifp, disable);
+		mutex_exit(&unp->unp_miilock);
+	}
 
 	/* Free RX/TX resources. */
 	usbnet_rx_list_fini(un);



CVS commit: src/sys/dev/usb

2022-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Sep 20 07:15:46 UTC 2022

Modified Files:
src/sys/dev/usb: usbnet.c

Log Message:
revert rev 1.111 (which was 1.106 again, without the 1.107 changes).

fixes an assert reported by msaitoh@.  also fix another missing miilock
assert in usbnet_stop() that triggered for me.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/usb/usbnet.c

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