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

2023-10-17 Thread SAITOH Masanobu
On 2023/10/12 14:50, SAITOH Masanobu wrote:
> Module Name:  src
> Committed By: msaitoh
> Date: Thu Oct 12 05:50:56 UTC 2023
> 
> Modified Files:
>   src/sys/dev/pci/ixgbe: ixgbe.c
> 
> Log Message:
> ixg(4): Don't print wrong error message about ixgbe_num_queues.
> 
>  Don't override the ixgbe_num_queues global variable. It's the default
> value of the number of queues and should not override it because it
> will be referenced by later device attach. For example, the number of
> MSI-X vector is 64 on X540 and 18 on 82599. When both cards are inserted
> to a machine that the number of CPU is 24 and X540 is probed earlier,
> ixgbe_num_queues is overridden to 24 and the following error message is
> printed when attaching 82599:
> 
>   ixg2: autoconfiguration error: ixgbe_num_queues (24) is too large,
>   using reduced amount (17).
> 
> Note that the number of queues is in sc->num_queuss and referenced
> by hw.ixgN.num_queues sysctl.

The commit message was incorrect.

 - s/82599/82598/
 - Worse thing can happen if a smaller number of MSI-X vector's device is
   attached earlier. The small number is set as the default value and the
   number of queues of the next device is unintentionally limited to it.


> To generate a diff of this commit:
> cvs rdiff -u -r1.341 -r1.342 src/sys/dev/pci/ixgbe/ixgbe.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
>
-- 
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)



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

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 18 03:52:55 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.191 -r1.192 src/sys/dev/pci/ixgbe/ixv.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/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.343 src/sys/dev/pci/ixgbe/ixgbe.c:1.344
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.343	Thu Oct 12 08:06:13 2023
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Oct 18 03:52:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.343 2023/10/12 08:06:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.344 2023/10/18 03:52:55 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.343 2023/10/12 08:06:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.344 2023/10/18 03:52:55 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5080,7 +5080,7 @@ ixgbe_update_link_status(struct ixgbe_so
 			for (int i = 0; i < sc->num_queues; i++, que++)
 que->eitr_setting = 0;
 
-			if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL){
+			if (sc->link_speed == IXGBE_LINK_SPEED_10GB_FULL) {
 /*
  *  Discard count for both MAC Local Fault and
  * Remote Fault because those registers are
@@ -6043,7 +6043,7 @@ ixgbe_sysctl_phy_overtemp_occurred(SYSCT
 		return (EPERM);
 
 	if ((hw->device_id != IXGBE_DEV_ID_X550EM_X_10G_T) &&
-	(hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)){
+	(hw->device_id != IXGBE_DEV_ID_X550EM_A_10G_T)) {
 		device_printf(sc->dev,
 		"Device has no supported external thermal sensor.\n");
 		return (ENODEV);

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.191 src/sys/dev/pci/ixgbe/ixv.c:1.192
--- src/sys/dev/pci/ixgbe/ixv.c:1.191	Thu Oct 12 08:06:13 2023
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Oct 18 03:52:55 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.191 2023/10/12 08:06:13 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.192 2023/10/18 03:52:55 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.191 2023/10/12 08:06:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.192 2023/10/18 03:52:55 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -573,7 +573,7 @@ ixv_attach(device_t parent, device_t dev
 
 	/* Check if VF was disabled by PF */
 	error = hw->mac.ops.get_link_state(hw, >link_enabled);
-	if (error) {		
+	if (error) {
 		/* PF is not capable of controlling VF state. Enable the link. */
 		sc->link_enabled = TRUE;
 	}
@@ -807,7 +807,7 @@ ixv_init_locked(struct ixgbe_softc *sc)
 
 	/* Config/Enable Link */
 	error = hw->mac.ops.get_link_state(hw, >link_enabled);
-	if (error) {		
+	if (error) {
 		/* PF is not capable of controlling VF state. Enable the link. */
 		sc->link_enabled = TRUE;
 	} else if (sc->link_enabled == FALSE)



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

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Oct 18 03:52:55 UTC 2023

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
ixgbe: Whitespace. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.191 -r1.192 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: src/usr.bin/xlint/lint1

2023-10-17 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 17 19:33:16 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: resolve shift/reduce conflict in labels with attributes


To generate a diff of this commit:
cvs rdiff -u -r1.475 -r1.476 src/usr.bin/xlint/lint1/cgram.y

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.475 src/usr.bin/xlint/lint1/cgram.y:1.476
--- src/usr.bin/xlint/lint1/cgram.y:1.475	Tue Oct 17 19:29:09 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Oct 17 19:33:16 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.475 2023/10/17 19:29:09 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.476 2023/10/17 19:33:16 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.475 2023/10/17 19:29:09 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.476 2023/10/17 19:33:16 rillig Exp $");
 #endif
 
 #include 
@@ -132,7 +132,7 @@ is_either(const char *s, const char *a, 
 
 %}
 
-%expect 104
+%expect 103
 
 %union {
 	val_t	*y_val;
@@ -386,7 +386,9 @@ is_either(const char *s, const char *a, 
 /* No type for init_rbrace. */
 %type		asm_or_symbolrename_opt
 /* No type for statement. */
+/* No type for no_attr_statement. */
 /* No type for non_expr_statement. */
+/* No type for no_attr_non_expr_statement. */
 /* No type for labeled_statement. */
 /* No type for label. */
 /* No type for compound_statement. */
@@ -1752,9 +1754,20 @@ statement:
 |	non_expr_statement
 ;
 
+/* Helper to avoid shift/reduce conflict in 'label: __attribute__ ;'. */
+no_attr_statement:
+	expression_statement
+|	no_attr_non_expr_statement
+;
+
 non_expr_statement:		/* helper for C99 6.8 */
 	gcc_attribute_specifier /* ((__fallthrough__)) */ T_SEMI
-|	labeled_statement
+|	no_attr_non_expr_statement
+;
+
+/* Helper to avoid shift/reduce conflict in 'label: __attribute__ ;'. */
+no_attr_non_expr_statement:
+	labeled_statement
 |	compound_statement
 |	selection_statement
 |	iteration_statement
@@ -1765,7 +1778,7 @@ non_expr_statement:		/* helper for C99 6
 ;
 
 labeled_statement:		/* C99 6.8.1 */
-	label gcc_attribute_specifier_list_opt statement
+	label gcc_attribute_specifier_list_opt no_attr_statement
 ;
 
 label:



CVS commit: src/usr.bin/xlint/lint1

2023-10-17 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 17 19:33:16 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: resolve shift/reduce conflict in labels with attributes


To generate a diff of this commit:
cvs rdiff -u -r1.475 -r1.476 src/usr.bin/xlint/lint1/cgram.y

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



CVS commit: src/usr.bin/xlint/lint1

2023-10-17 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 17 19:29:09 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c

Log Message:
lint: fix debug output of convert/cast operators

The default name of the 'CVT' operator is 'convert', therefore the
override is only needed for 'cast'.


To generate a diff of this commit:
cvs rdiff -u -r1.474 -r1.475 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/debug.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.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.474 src/usr.bin/xlint/lint1/cgram.y:1.475
--- src/usr.bin/xlint/lint1/cgram.y:1.474	Thu Sep 14 22:20:08 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Oct 17 19:29:09 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.474 2023/09/14 22:20:08 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.475 2023/10/17 19:29:09 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.474 2023/09/14 22:20:08 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.475 2023/10/17 19:29:09 rillig Exp $");
 #endif
 
 #include 
@@ -159,7 +159,7 @@ is_either(const char *s, const char *a, 
 /* for Bison:
 %printer {
 	if (is_integer($$->v_tspec))
-		fprintf(yyo, "%lld", (unsigned long long)$$->u.integer);
+		fprintf(yyo, "%lld", (long long)$$->u.integer);
 	else
 		fprintf(yyo, "%Lg", $$->u.floating);
 } 
@@ -2280,8 +2280,8 @@ cgram_declare(sym_t *decl, bool has_init
 }
 
 /*
- * Discard all input tokens up to and including the next
- * unmatched right paren
+ * Discard all input tokens up to and including the next unmatched right
+ * parenthesis.
  */
 static void
 read_until_rparen(void)

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.62 src/usr.bin/xlint/lint1/debug.c:1.63
--- src/usr.bin/xlint/lint1/debug.c:1.62	Wed Sep 13 20:31:58 2023
+++ src/usr.bin/xlint/lint1/debug.c	Tue Oct 17 19:29:09 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.62 2023/09/13 20:31:58 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.63 2023/10/17 19:29:09 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.62 2023/09/13 20:31:58 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.63 2023/10/17 19:29:09 rillig Exp $");
 #endif
 
 #include 
@@ -187,16 +187,15 @@ debug_type(const type_t *tp)
 void
 debug_node(const tnode_t *tn) // NOLINT(misc-no-recursion)
 {
-	op_t op;
 
 	if (tn == NULL) {
 		debug_step("null");
 		return;
 	}
 
-	op = tn->tn_op;
+	op_t op = tn->tn_op;
 	debug_printf("'%s'",
-	op == CVT && !tn->tn_cast ? "convert" : op_name(op));
+	op == CVT && tn->tn_cast ? "cast" : op_name(op));
 	if (op == NAME)
 		debug_printf(" '%s' with %s",
 		tn->tn_sym->s_name,



CVS commit: src/usr.bin/xlint/lint1

2023-10-17 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Oct 17 19:29:09 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c

Log Message:
lint: fix debug output of convert/cast operators

The default name of the 'CVT' operator is 'convert', therefore the
override is only needed for 'cast'.


To generate a diff of this commit:
cvs rdiff -u -r1.474 -r1.475 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/xlint/lint1/debug.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/arm/rockchip

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.c

Log Message:
rk3588_cru: fix clock id for BIGCORE1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.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/rk3588_cru.c
diff -u src/sys/arch/arm/rockchip/rk3588_cru.c:1.1 src/sys/arch/arm/rockchip/rk3588_cru.c:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.c:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.c	Tue Oct 17 19:13:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.1 2022/08/23 05:39:06 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk3588_cru.c,v 1.2 2023/10/17 19:13:05 tnn Exp $");
 
 #include 
 #include 
@@ -636,7 +636,7 @@ static struct rk_cru_clk rk3588_cru_clks
 	CLKSEL_CON(BIGCORE0, 1),	/* div1_reg */
 	__BITS(4,0),		/* div1_mask */
 	armclk_b01_rates),
-	RK_CPU_CORE2(RK3588_ARMCLK_B01, "armclk_b23", mux_armclkb23_parents,
+	RK_CPU_CORE2(RK3588_ARMCLK_B23, "armclk_b23", mux_armclkb23_parents,
 	CLKSEL_CON(BIGCORE1, 0),	/* reg */
 	__BITS(7,6), 2, 1,		/* mux_mask, mux_main, mux_alt */
 	CLKSEL_CON(BIGCORE1, 0),	/* div0_reg */
@@ -673,7 +673,6 @@ static struct rk_cru_clk rk3588_cru_clks
 	"armclk_b23",
 	CLKGATE_CON(BIGCORE1, 0), 13),
 
-
 	RK_COMPOSITE(RK3588_CLK_50M_SRC, "clk_50m_src",
 	gpll_cpll_parents,
 	CLKSEL_CON(0, 0), __BITS(5,5), __BITS(4,0),



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 19:13:05 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.c

Log Message:
rk3588_cru: fix clock id for BIGCORE1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.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/arm/rockchip

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.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/rockchip/rk3588_cru.h
diff -u src/sys/arch/arm/rockchip/rk3588_cru.h:1.1 src/sys/arch/arm/rockchip/rk3588_cru.h:1.2
--- src/sys/arch/arm/rockchip/rk3588_cru.h:1.1	Tue Aug 23 05:39:06 2022
+++ src/sys/arch/arm/rockchip/rk3588_cru.h	Tue Oct 17 18:23:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk3588_cru.h,v 1.1 2022/08/23 05:39:06 ryo Exp $	*/
+/*	$NetBSD: rk3588_cru.h,v 1.2 2023/10/17 18:23:55 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2022 Ryo Shimizu 
@@ -28,727 +28,726 @@
 #ifndef _RK3588_CRU_H_
 #define _RK3588_CRU_H_
 
-#define RK3588_PLL_B0PLL			1
-#define RK3588_PLL_B1PLL			2
-#define RK3588_PLL_LPLL3
-#define RK3588_PLL_V0PLL			4
-#define RK3588_PLL_AUPLL			5
-#define RK3588_PLL_CPLL6
-#define RK3588_PLL_GPLL7
-#define RK3588_PLL_NPLL8
-#define RK3588_PLL_PPLL9
-#define RK3588_ARMCLK_L10
-#define RK3588_ARMCLK_B01			11
-#define RK3588_ARMCLK_B23			12
-/* 13 */
-/* 14 */
-/* 15 */
-/* 16 */
-/* 17 */
-/* 18 */
-/* 19 */
-#define RK3588_PCLK_BIGCORE0_ROOT		20
-#define RK3588_PCLK_BIGCORE0_PVTM		21
-#define RK3588_PCLK_BIGCORE1_ROOT		22
-#define RK3588_PCLK_BIGCORE1_PVTM		23
-#define RK3588_PCLK_DSU_S_ROOT			24
-#define RK3588_PCLK_DSU_ROOT			25
-#define RK3588_PCLK_DSU_NS_ROOT			26
-#define RK3588_PCLK_LITCORE_PVTM		27
-#define RK3588_PCLK_DBG28
-#define RK3588_PCLK_DSU29
-#define RK3588_PCLK_S_DAPLITE			30
-#define RK3588_PCLK_M_DAPLITE			31
-#define RK3588_MBIST_MCLK_PDM1			32
-#define RK3588_MBIST_CLK_ACDCDIG		33
-#define RK3588_HCLK_I2S2_2CH			34
-#define RK3588_HCLK_I2S3_2CH			35
-#define RK3588_CLK_I2S2_2CH_SRC			36
-#define RK3588_CLK_I2S2_2CH_FRAC		37
-#define RK3588_CLK_I2S2_2CH			38
-#define RK3588_MCLK_I2S2_2CH			39
-#define RK3588_I2S2_2CH_MCLKOUT			40
-#define RK3588_CLK_DAC_ACDCDIG			41
-#define RK3588_CLK_I2S3_2CH_SRC			42
-#define RK3588_CLK_I2S3_2CH_FRAC		43
-#define RK3588_CLK_I2S3_2CH			44
-#define RK3588_MCLK_I2S3_2CH			45
-#define RK3588_I2S3_2CH_MCLKOUT			46
-#define RK3588_PCLK_ACDCDIG			47
-#define RK3588_HCLK_I2S0_8CH			48
-#define RK3588_CLK_I2S0_8CH_TX_SRC		49
-#define RK3588_CLK_I2S0_8CH_TX_FRAC		50
-#define RK3588_MCLK_I2S0_8CH_TX			51
-#define RK3588_CLK_I2S0_8CH_TX			52
-#define RK3588_CLK_I2S0_8CH_RX_SRC		53
-#define RK3588_CLK_I2S0_8CH_RX_FRAC		54
-#define RK3588_MCLK_I2S0_8CH_RX			55
-#define RK3588_CLK_I2S0_8CH_RX			56
-#define RK3588_I2S0_8CH_MCLKOUT			57
-#define RK3588_HCLK_PDM1			58
-#define RK3588_MCLK_PDM1			59
-#define RK3588_HCLK_AUDIO_ROOT			60
-#define RK3588_PCLK_AUDIO_ROOT			61
-#define RK3588_HCLK_SPDIF0			62
-#define RK3588_CLK_SPDIF0_SRC			63
-#define RK3588_CLK_SPDIF0_FRAC			64
-#define RK3588_MCLK_SPDIF0			65
-#define RK3588_CLK_SPDIF0			66
-#define RK3588_CLK_SPDIF1			67
-#define RK3588_HCLK_SPDIF1			68
-#define RK3588_CLK_SPDIF1_SRC			69
-#define RK3588_CLK_SPDIF1_FRAC			70
-#define RK3588_MCLK_SPDIF1			71
-#define RK3588_ACLK_AV1_ROOT			72
-#define RK3588_ACLK_AV173
-#define RK3588_PCLK_AV1_ROOT			74
-#define RK3588_PCLK_AV175
-#define RK3588_PCLK_MAILBOX0			76
-#define RK3588_PCLK_MAILBOX1			77
-#define RK3588_PCLK_MAILBOX2			78
-#define RK3588_PCLK_PMU2			79
-#define RK3588_PCLK_PMUCM0_INTMUX		80
-#define RK3588_PCLK_DDRCM0_INTMUX		81
-#define RK3588_PCLK_TOP82
-#define RK3588_PCLK_PWM1			83
-#define RK3588_CLK_PWM184
-#define RK3588_CLK_PWM1_CAPTURE			85
-#define RK3588_PCLK_PWM2			86
-#define RK3588_CLK_PWM287
-#define RK3588_CLK_PWM2_CAPTURE			88
-#define RK3588_PCLK_PWM3			89
-#define RK3588_CLK_PWM390
-#define RK3588_CLK_PWM3_CAPTURE			91
-#define RK3588_PCLK_BUSTIMER0			92
-#define RK3588_PCLK_BUSTIMER1			93
-#define RK3588_CLK_BUS_TIMER_ROOT		94
-#define RK3588_CLK_BUSTIMER0			95
-#define RK3588_CLK_BUSTIMER1			96
-#define RK3588_CLK_BUSTIMER2			97
-#define RK3588_CLK_BUSTIMER3			98
-#define RK3588_CLK_BUSTIMER4			99
-#define RK3588_CLK_BUSTIMER5			100
-#define RK3588_CLK_BUSTIMER6			101
-#define RK3588_CLK_BUSTIMER7			102
-#define RK3588_CLK_BUSTIMER8			103
-#define RK3588_CLK_BUSTIMER9			104
-#define RK3588_CLK_BUSTIMER10			105
-#define RK3588_CLK_BUSTIMER11			106
-#define RK3588_PCLK_WDT0			107
-#define RK3588_TCLK_WDT0			108
-/* 109 */
-/* 110 */
-#define RK3588_PCLK_CAN0			111
-#define RK3588_CLK_CAN0112
-#define RK3588_PCLK_CAN1			113
-#define RK3588_CLK_CAN1114
-#define RK3588_PCLK_CAN2			115
-#define RK3588_CLK_CAN2116
-#define RK3588_ACLK_DECOM			117
-#define RK3588_PCLK_DECOM			118

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 18:23:55 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3588_cru.h

Log Message:
rk3588_cru: sync clock id numbers with mainline Linux

The previous constants came from the Rockchip board support package,
but we want to be compatible with upstream device tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3588_cru.h

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_gpio.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_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.6 src/sys/arch/arm/rockchip/rk_gpio.c:1.7
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.6	Tue Oct 17 15:09:18 2023
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 17:31:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.7 2023/10/17 17:31:12 tnn Exp $");
 
 #include 
 #include 
@@ -55,6 +55,26 @@ __KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 
 #define	GPIO_PORTA_EOI_REG		0x004c
 #define	GPIO_EXT_PORTA_REG		0x0050
 #define	GPIO_LS_SYNC_REG		0x0060
+#define	GPIO_VER_ID_REG			0x0078
+#define	GPIO_VER_ID_GPIOV2		0x0101157c
+
+/*
+ * In "version 2" GPIO controllers, half of each register is used by the
+ * write_enable mask, so the 32 pins are spread over two registers.
+ *
+ * pins  0 - 15 go into the GPIO_SWPORT_*_L register
+ * pins 16 - 31 go into the GPIO_SWPORT_*_H register
+ */
+#define GPIOV2_SWPORT_DR_BASE		0x
+#define GPIOV2_SWPORT_DR_REG(pin)	\
+	(GPIOV2_SWPORT_DR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_SWPORT_DDR_BASE		0x0008
+#define	GPIOV2_SWPORT_DDR_REG(pin)	\
+	(GPIOV2_SWPORT_DDR_BASE + GPIOV2_REG_OFFSET(pin))
+#define	GPIOV2_EXT_PORT_REG		0x0070
+#define	GPIOV2_REG_OFFSET(pin)		(((pin) >> 4) << 2)
+#define	GPIOV2_DATA_MASK(pin)		(__BIT((pin) & 0xF))
+#define	GPIOV2_WRITE_MASK(pin)		(__BIT(((pin) & 0xF) | 0x10))
 
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "rockchip,gpio-bank" },
@@ -223,18 +243,58 @@ rk_gpio_pin_ctl(void *priv, int pin, int
 	mutex_exit(>sc_lock);
 }
 
+static int
+rk_gpio_v2_pin_read(void *priv, int pin)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+	int val;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t data_mask = __BIT(pin);
+
+	/* No lock required for reads */
+	data = RD4(sc, GPIOV2_EXT_PORT_REG);
+	val = __SHIFTOUT(data, data_mask);
+
+	return val;
+}
+
+static void
+rk_gpio_v2_pin_write(void *priv, int pin, int val)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t data;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	const uint32_t write_mask = GPIOV2_WRITE_MASK(pin);
+
+	/* No lock required for writes on v2 controllers  */
+	data = val ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DR_REG(pin), write_mask | data);
+}
+
+static void
+rk_gpio_v2_pin_ctl(void *priv, int pin, int flags)
+{
+	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
+
+	KASSERT(pin < __arraycount(sc->sc_pins));
+
+	/* No lock required for writes on v2 controllers  */
+	ddr = (flags & GPIO_PIN_OUTPUT) ? GPIOV2_DATA_MASK(pin) : 0;
+	WR4(sc, GPIOV2_SWPORT_DDR_REG(pin), GPIOV2_WRITE_MASK(pin) | ddr);
+}
+
 static void
 rk_gpio_attach_ports(struct rk_gpio_softc *sc)
 {
-	struct gpio_chipset_tag *gp = >sc_gp;
 	struct gpiobus_attach_args gba;
 	u_int pin;
 
-	gp->gp_cookie = sc;
-	gp->gp_pin_read = rk_gpio_pin_read;
-	gp->gp_pin_write = rk_gpio_pin_write;
-	gp->gp_pin_ctl = rk_gpio_pin_ctl;
-
 	for (pin = 0; pin < __arraycount(sc->sc_pins); pin++) {
 		sc->sc_pins[pin].pin_num = pin;
 		sc->sc_pins[pin].pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT;
@@ -242,7 +302,7 @@ rk_gpio_attach_ports(struct rk_gpio_soft
 	}
 
 	memset(, 0, sizeof(gba));
-	gba.gba_gc = gp;
+	gba.gba_gc = >sc_gp;
 	gba.gba_pins = sc->sc_pins;
 	gba.gba_npins = __arraycount(sc->sc_pins);
 	sc->sc_gpiodev = config_found(sc->sc_dev, , NULL, CFARGS_NONE);
@@ -260,11 +320,14 @@ static void
 rk_gpio_attach(device_t parent, device_t self, void *aux)
 {
 	struct rk_gpio_softc * const sc = device_private(self);
+	struct gpio_chipset_tag * const gp = >sc_gp;
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
 	struct clk *clk;
 	bus_addr_t addr;
 	bus_size_t size;
+	uint32_t ver_id;
+	int ver;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
@@ -282,10 +345,31 @@ rk_gpio_attach(device_t parent, device_t
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
+
+	gp->gp_cookie = sc;
+	ver_id = RD4(sc, GPIO_VER_ID_REG);
+	switch (ver_id) {
+	case 0: /* VER_ID not implemented in v1 but reads back as 0 */
+		ver = 1;
+		gp->gp_pin_read = rk_gpio_pin_read;
+		gp->gp_pin_write = rk_gpio_pin_write;
+		gp->gp_pin_ctl = 

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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 17:31:12 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: add support for version 2 controller

Based on PR 57597 from Johann Rudloff.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_gpio.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/xen/xen

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:09:12 UTC 2023

Modified Files:
src/sys/arch/xen/xen: genfb_xen.c

Log Message:
for a dom0 PVH, the dom0_vga_console_info structure has to be retrieved
using a platform hypercall; do so in the XENPVHVM case.
Now genfb works in a PVH dom0 running on Xen 4.18 (Xen 4.15 doesn't support
this platoform op, so no way to make it work here).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/xen/genfb_xen.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/xen/xen

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:09:12 UTC 2023

Modified Files:
src/sys/arch/xen/xen: genfb_xen.c

Log Message:
for a dom0 PVH, the dom0_vga_console_info structure has to be retrieved
using a platform hypercall; do so in the XENPVHVM case.
Now genfb works in a PVH dom0 running on Xen 4.18 (Xen 4.15 doesn't support
this platoform op, so no way to make it work here).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/xen/xen/genfb_xen.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/xen/xen/genfb_xen.c
diff -u src/sys/arch/xen/xen/genfb_xen.c:1.1 src/sys/arch/xen/xen/genfb_xen.c:1.2
--- src/sys/arch/xen/xen/genfb_xen.c:1.1	Tue Oct 17 12:07:42 2023
+++ src/sys/arch/xen/xen/genfb_xen.c	Tue Oct 17 16:09:12 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: genfb_xen.c,v 1.1 2023/10/17 12:07:42 bouyer Exp $  */
+/*  $NetBSD: genfb_xen.c,v 1.2 2023/10/17 16:09:12 bouyer Exp $  */
 
 /*
  * Copyright (c) 2023 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb_xen.c,v 1.1 2023/10/17 12:07:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_xen.c,v 1.2 2023/10/17 16:09:12 bouyer Exp $");
 
 
 #include 
@@ -42,6 +42,7 @@ const struct btinfo_framebuffer *
 xen_genfb_getbtinfo(void)
 {
 	dom0_vga_console_info_t *d0_consi;
+	int info_size;
 
 	if (!xendomain_is_dom0())
 		return NULL;
@@ -49,8 +50,21 @@ xen_genfb_getbtinfo(void)
 	if (_xen_genfb_btinfo.common.type == BTINFO_FRAMEBUFFER)
 		return &_xen_genfb_btinfo;
 
+#ifdef XENPVHVM
+	struct xen_platform_op op = {
+		.cmd = XENPF_get_dom0_console,
+	};
+	info_size = HYPERVISOR_platform_op();
+	if (info_size < sizeof(dom0_vga_console_info_t)) {
+		printf("XENPF_get_dom0_console fail %d\n", info_size);
+		return NULL;
+	}
+	d0_consi = _console;
+#else
 	d0_consi = (void *)((char *)_start_info +
 	xen_start_info.console.dom0.info_off);
+	info_size = xen_start_info.console.dom0.info_size;
+#endif
 
 	if (d0_consi->video_type != XEN_VGATYPE_VESA_LFB &&
 	d0_consi->video_type != XEN_VGATYPE_EFI_LFB)
@@ -59,7 +73,7 @@ xen_genfb_getbtinfo(void)
 	_xen_genfb_btinfo.common.type = BTINFO_FRAMEBUFFER;
 	_xen_genfb_btinfo.common.len = sizeof(struct btinfo_framebuffer);
 	_xen_genfb_btinfo.physaddr = d0_consi->u.vesa_lfb.lfb_base;
-	if (xen_start_info.console.dom0.info_size >=
+	if (info_size >=
 	offsetof(dom0_vga_console_info_t, u.vesa_lfb.ext_lfb_base)) {
 		_xen_genfb_btinfo.physaddr |=
 		(uint64_t)d0_consi->u.vesa_lfb.ext_lfb_base << 32;



CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:06:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86: consinit.c
src/sys/arch/xen/conf: files.xen

Log Message:
XENPVH option is not used. Fix consinit.c to use XENPVHVM as intended
and XENPVH from defflag


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/xen/conf/files.xen

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/x86/x86/consinit.c
diff -u src/sys/arch/x86/x86/consinit.c:1.37 src/sys/arch/x86/x86/consinit.c:1.38
--- src/sys/arch/x86/x86/consinit.c:1.37	Tue Oct 17 12:07:42 2023
+++ src/sys/arch/x86/x86/consinit.c	Tue Oct 17 16:06:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.37 2023/10/17 12:07:42 bouyer Exp $	*/
+/*	$NetBSD: consinit.c,v 1.38 2023/10/17 16:06:36 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.37 2023/10/17 12:07:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.38 2023/10/17 16:06:36 bouyer Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_puc.h"
@@ -100,6 +100,7 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v
 #endif
 
 #ifdef XENPVHVM
+#include 
 #include 
 #endif
 
@@ -189,7 +190,7 @@ consinit(void)
 		consinfo = _consinfo;
 
 #if (NGENFB > 0)
-#if defined(XENPVH) && defined(DOM0OPS)
+#if defined(XENPVHVM) && defined(DOM0OPS)
 	if (vm_guest == VM_GUEST_XENPVH && xendomain_is_dom0())
 		fbinfo = xen_genfb_getbtinfo();
 	else

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.188 src/sys/arch/xen/conf/files.xen:1.189
--- src/sys/arch/xen/conf/files.xen:1.188	Tue Oct 17 12:07:42 2023
+++ src/sys/arch/xen/conf/files.xen	Tue Oct 17 16:06:36 2023
@@ -1,6 +1,6 @@
-#	$NetBSD: files.xen,v 1.188 2023/10/17 12:07:42 bouyer Exp $
+#	$NetBSD: files.xen,v 1.189 2023/10/17 16:06:36 bouyer Exp $
 
-defflag	opt_xen.h			XEN XENPVH XENPVHVM PAE DOM0OPS
+defflag	opt_xen.h			XEN XENPVHVM PAE DOM0OPS
 
 file	arch/xen/x86/hypervisor_machdep.c	xen
 file	arch/xen/x86/xen_intr.c			xen



CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:06:37 UTC 2023

Modified Files:
src/sys/arch/x86/x86: consinit.c
src/sys/arch/xen/conf: files.xen

Log Message:
XENPVH option is not used. Fix consinit.c to use XENPVHVM as intended
and XENPVH from defflag


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/xen/conf/files.xen

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



CVS commit: src/sys/external/mit/xen-include-public/dist/xen/include/public

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:02:55 UTC 2023

Modified Files:
src/sys/external/mit/xen-include-public/dist/xen/include/public:
platform.h

Log Message:
Add XENPF_get_dom0_console, which gets a dom0_vga_console_info stucture
from the hypervisor. To be used by PVH dom0 kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.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/external/mit/xen-include-public/dist/xen/include/public/platform.h
diff -u src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h:1.1.1.1 src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h:1.2
--- src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h:1.1.1.1	Sat Feb  2 08:03:48 2019
+++ src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h	Tue Oct 17 16:02:55 2023
@@ -615,6 +615,15 @@ typedef struct xenpf_symdata xenpf_symda
 DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t);
 
 /*
+ * Fetch the video console information and mode setup by Xen.  A non-
+ * negative return value indicates the size of the (part of the) structure
+ * which was filled.
+ */
+#define XENPF_get_dom0_console 64
+typedef struct dom0_vga_console_info xenpf_dom0_console_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_dom0_console_t);
+
+/*
  * ` enum neg_errnoval
  * ` HYPERVISOR_platform_op(const struct xen_platform_op*);
  */
@@ -644,6 +653,7 @@ struct xen_platform_op {
 struct xenpf_core_parking  core_parking;
 struct xenpf_resource_op   resource_op;
 struct xenpf_symdata   symdata;
+xenpf_dom0_console_t   dom0_console;
 uint8_tpad[128];
 } u;
 };



CVS commit: src/sys/external/mit/xen-include-public/dist/xen/include/public

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 16:02:55 UTC 2023

Modified Files:
src/sys/external/mit/xen-include-public/dist/xen/include/public:
platform.h

Log Message:
Add XENPF_get_dom0_console, which gets a dom0_vga_console_info stucture
from the hypervisor. To be used by PVH dom0 kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/platform.h

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



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

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_gpio.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/arm/rockchip

2023-10-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Oct 17 15:09:18 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk_gpio.c

Log Message:
rk_gpio: de-duplicate some code from the fdtbus accessors

Make fdtbus accessors implementation agnostic and use the chipset tag
to call into implementation code. This makes it easy to populate the
chipset tag with alternate implementation needed for v2 controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_gpio.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_gpio.c
diff -u src/sys/arch/arm/rockchip/rk_gpio.c:1.5 src/sys/arch/arm/rockchip/rk_gpio.c:1.6
--- src/sys/arch/arm/rockchip/rk_gpio.c:1.5	Sat Aug  7 16:18:45 2021
+++ src/sys/arch/arm/rockchip/rk_gpio.c	Tue Oct 17 15:09:18 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $ */
+/* $NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.5 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gpio.c,v 1.6 2023/10/17 15:09:18 tnn Exp $");
 
 #include 
 #include 
@@ -90,30 +90,12 @@ static void	rk_gpio_attach(device_t, dev
 CFATTACH_DECL_NEW(rk_gpio, sizeof(struct rk_gpio_softc),
 	rk_gpio_match, rk_gpio_attach, NULL, NULL);
 
-static int
-rk_gpio_ctl(struct rk_gpio_softc *sc, u_int pin, int flags)
-{
-	uint32_t ddr;
-
-	KASSERT(mutex_owned(>sc_lock));
-
-	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
-	if (flags & GPIO_PIN_INPUT)
-		ddr &= ~__BIT(pin);
-	else if (flags & GPIO_PIN_OUTPUT)
-		ddr |= __BIT(pin);
-	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
-
-	return 0;
-}
-
 static void *
 rk_gpio_acquire(device_t dev, const void *data, size_t len, int flags)
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *gpin;
 	const u_int *gpio = data;
-	int error;
 
 	if (len != 12)
 		return NULL;
@@ -124,12 +106,7 @@ rk_gpio_acquire(device_t dev, const void
 	if (pin >= __arraycount(sc->sc_pins))
 		return NULL;
 
-	mutex_enter(>sc_lock);
-	error = rk_gpio_ctl(sc, pin, flags);
-	mutex_exit(>sc_lock);
-
-	if (error != 0)
-		return NULL;
+	sc->sc_gp.gp_pin_ctl(sc, pin, flags);
 
 	gpin = kmem_zalloc(sizeof(*gpin), KM_SLEEP);
 	gpin->pin_sc = sc;
@@ -146,9 +123,9 @@ rk_gpio_release(device_t dev, void *priv
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
 
-	mutex_enter(>sc_lock);
-	rk_gpio_ctl(pin->pin_sc, pin->pin_nr, GPIO_PIN_INPUT);
-	mutex_exit(>sc_lock);
+	KASSERT(sc == pin->pin_sc);
+
+	sc->sc_gp.gp_pin_ctl(sc, pin->pin_nr, GPIO_PIN_INPUT);
 
 	kmem_free(pin, sizeof(*pin));
 }
@@ -158,16 +135,11 @@ rk_gpio_read(device_t dev, void *priv, b
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 	int val;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
-	/* No lock required for reads */
-	data = RD4(sc, GPIO_EXT_PORTA_REG);
-	val = __SHIFTOUT(data, data_mask);
+	val = sc->sc_gp.gp_pin_read(sc, pin->pin_nr);
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
@@ -179,23 +151,13 @@ rk_gpio_write(device_t dev, void *priv, 
 {
 	struct rk_gpio_softc * const sc = device_private(dev);
 	struct rk_gpio_pin *pin = priv;
-	uint32_t data;
 
 	KASSERT(sc == pin->pin_sc);
 
-	const uint32_t data_mask = __BIT(pin->pin_nr);
-
 	if (!raw && pin->pin_actlo)
 		val = !val;
 
-	mutex_enter(>sc_lock);
-	data = RD4(sc, GPIO_SWPORTA_DR_REG);
-	if (val)
-		data |= data_mask;
-	else
-		data &= ~data_mask;
-	WR4(sc, GPIO_SWPORTA_DR_REG, data);
-	mutex_exit(>sc_lock);
+	sc->sc_gp.gp_pin_write(sc, pin->pin_nr, val);
 }
 
 static struct fdtbus_gpio_controller_func rk_gpio_funcs = {
@@ -247,11 +209,17 @@ static void
 rk_gpio_pin_ctl(void *priv, int pin, int flags)
 {
 	struct rk_gpio_softc * const sc = priv;
+	uint32_t ddr;
 
 	KASSERT(pin < __arraycount(sc->sc_pins));
 
 	mutex_enter(>sc_lock);
-	rk_gpio_ctl(sc, pin, flags);
+	ddr = RD4(sc, GPIO_SWPORTA_DDR_REG);
+	if (flags & GPIO_PIN_INPUT)
+		ddr &= ~__BIT(pin);
+	else if (flags & GPIO_PIN_OUTPUT)
+		ddr |= __BIT(pin);
+	WR4(sc, GPIO_SWPORTA_DDR_REG, ddr);
 	mutex_exit(>sc_lock);
 }
 



CVS commit: src/sys/arch/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 14:17:42 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Revert "x86: Panic early if fpu save size is too large, take 2."

Apparently this is too early to print anything useful, so it just
causes a reboot loop.

PR kern/57661


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.127 src/sys/arch/x86/x86/identcpu.c:1.128
--- src/sys/arch/x86/x86/identcpu.c:1.127	Tue Oct 17 11:12:33 2023
+++ src/sys/arch/x86/x86/identcpu.c	Tue Oct 17 14:17:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.127 2023/10/17 11:12:33 riastradh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.128 2023/10/17 14:17:42 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.127 2023/10/17 11:12:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.128 2023/10/17 14:17:42 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -52,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: identcpu.c,v
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -770,16 +769,8 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	/* Get features and maximum size of the save area */
 	x86_cpuid(0xd, descs);
-	if (descs[2] > sizeof(struct fxsave)) {
-		CTASSERT(offsetof(struct pcb, pcb_savefpu) < PAGE_SIZE);
-		const unsigned max_fpu_save_size =
-		PAGE_SIZE - offsetof(struct pcb, pcb_savefpu);
-		if (descs[2] > max_fpu_save_size) {
-			panic("CPU's FPU save size too large: %u > %u",
-			descs[2], max_fpu_save_size);
-		}
+	if (descs[2] > sizeof(struct fxsave))
 		x86_fpu_save_size = descs[2];
-	}
 
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
 



CVS commit: src/sys/arch/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 14:17:42 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
Revert "x86: Panic early if fpu save size is too large, take 2."

Apparently this is too early to print anything useful, so it just
causes a reboot loop.

PR kern/57661


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/x86/identcpu.c

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



CVS commit: src/sys/external/mit/xen-include-public/dist/xen/include/public

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 14:15:54 UTC 2023

Modified Files:
src/sys/external/mit/xen-include-public/dist/xen/include/public: xen.h

Log Message:
Add ext_lfb_base to dom0_vga_console_info, from recent Xen. We know if it's
present or not by checking dom0.info_size


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.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/external/mit/xen-include-public/dist/xen/include/public/xen.h
diff -u src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h:1.1.1.1 src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h:1.2
--- src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h:1.1.1.1	Sat Feb  2 08:03:48 2019
+++ src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h	Tue Oct 17 14:15:54 2023
@@ -922,6 +922,8 @@ typedef struct dom0_vga_console_info {
 uint32_t gbl_caps;
 /* Mode attributes (offset 0x0, VESA command 0x4f01). */
 uint16_t mode_attrs;
+	/* high 32 bits of lfb_base */
+	uint32_t ext_lfb_base;
 #endif
 } vesa_lfb;
 } u;



CVS commit: src/sys/external/mit/xen-include-public/dist/xen/include/public

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 14:15:54 UTC 2023

Modified Files:
src/sys/external/mit/xen-include-public/dist/xen/include/public: xen.h

Log Message:
Add ext_lfb_base to dom0_vga_console_info, from recent Xen. We know if it's
present or not by checking dom0.info_size


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/xen.h

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



CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:08:13 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
miidevs: Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/mii/miidevs_data.h

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



CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:08:13 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
miidevs: Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.157 -r1.158 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.168 src/sys/dev/mii/miidevs.h:1.169
--- src/sys/dev/mii/miidevs.h:1.168	Fri Sep 29 09:08:30 2023
+++ src/sys/dev/mii/miidevs.h	Tue Oct 17 14:08:13 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.168 2023/09/29 09:08:30 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.169 2023/10/17 14:08:13 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp
  */
 
 /*-
@@ -417,6 +417,8 @@
 #define	MII_STR_INTEL2_I226_2	"I226 2.5G media interface (2)"
 #define	MII_MODEL_INTEL2_I225	0x000c		/* I225 2.5G media interface */
 #define	MII_STR_INTEL2_I225	"I225 2.5G media interface"
+#define	MII_MODEL_INTEL2_GPY115	0x0030		/* MaxLinear GPY115 Gigabit PHY */
+#define	MII_STR_INTEL2_GPY115	"MaxLinear GPY115 Gigabit PHY"
 
 /* JMicron PHYs */
 #define	MII_MODEL_JMICRON_JMP211	0x0021		/* JMP211 10/100/1000 media interface */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.157 src/sys/dev/mii/miidevs_data.h:1.158
--- src/sys/dev/mii/miidevs_data.h:1.157	Fri Sep 29 09:08:30 2023
+++ src/sys/dev/mii/miidevs_data.h	Tue Oct 17 14:08:13 2023
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.157 2023/09/29 09:08:30 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.158 2023/10/17 14:08:13 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp
+ *	NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp
  */
 
 /*-
@@ -364,218 +364,220 @@ static const uint32_t mii_products[] = {
 	1656, 1651, 565, 571, 1665, 0,
 	MII_OUI_INTEL2, MII_MODEL_INTEL2_I225, 
 	1669, 1651, 565, 571, 0,
+	MII_OUI_INTEL2, MII_MODEL_INTEL2_GPY115, 
+	419, 1674, 1550, 497, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP211, 
-	1674, 625, 565, 571, 0,
+	1681, 625, 565, 571, 0,
 	MII_OUI_JMICRON, MII_MODEL_JMICRON_JMP202, 
-	1681, 558, 565, 571, 0,
-	MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, 
 	1688, 558, 565, 571, 0,
+	MII_OUI_xxLEVEL1, MII_MODEL_xxLEVEL1_LXT970, 
+	1695, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000_OLD, 
-	1695, 804, 565, 571, 0,
+	1702, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT974, 
-	1703, 558, 748, 497, 0,
-	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT975, 
 	1710, 558, 748, 497, 0,
+	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT975, 
+	1717, 558, 748, 497, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT1000, 
-	1695, 804, 565, 571, 0,
+	1702, 804, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT971, 
-	1717, 558, 565, 571, 0,
+	1724, 558, 565, 571, 0,
 	MII_OUI_LEVEL1, MII_MODEL_LEVEL1_LXT973, 
-	1726, 558, 761, 497, 0,
+	1733, 558, 761, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1011, 
-	236, 1741, 1550, 497, 0,
+	236, 1748, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_3, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000S, 
-	236, 1749, 1550, 497, 0,
+	236, 1756, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1000_5, 
-	236, 1733, 1550, 497, 0,
+	236, 1740, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1101, 
-	236, 1758, 1550, 497, 0,
+	236, 1765, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E3082, 
-	236, 1766, 558, 1774, 1779, 497, 0,
+	236, 1773, 558, 1781, 1786, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1112, 
-	236, 1788, 1550, 497, 0,
+	236, 1795, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1149, 
-	236, 1796, 1550, 497, 0,
+	236, 1803, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E, 
-	236, 1804, 1550, 497, 0,
+	236, 1811, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1145, 
-	236, 1812, 748, 1550, 497, 0,
+	236, 1819, 748, 1550, 497, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E6060, 
-	236, 1820, 1828, 558, 1774, 1779, 1835, 0,
+	236, 1827, 1835, 558, 1781, 1786, 1842, 0,
 	MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I347, 
-	305, 1842, 1550, 497, 0,
+	305, 1849, 1550, 497, 0,
 	  

CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:07:51 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Add MaxLinear GPY115.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.170 src/sys/dev/mii/miidevs:1.171
--- src/sys/dev/mii/miidevs:1.170	Fri Sep 29 09:08:16 2023
+++ src/sys/dev/mii/miidevs	Tue Oct 17 14:07:51 2023
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.170 2023/09/29 09:08:16 msaitoh Exp $
+$NetBSD: miidevs,v 1.171 2023/10/17 14:07:51 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -284,6 +284,7 @@ model INTEL2 GPY211		0x MaxLinear GP
 model INTEL2 I226_1		0x0001 I226 2.5G media interface (1)
 model INTEL2 I226_2		0x0005 I226 2.5G media interface (2)
 model INTEL2 I225		0x000c I225 2.5G media interface
+model INTEL2 GPY115		0x0030 MaxLinear GPY115 Gigabit PHY
 
 /* JMicron PHYs */
 model JMICRON JMP211		0x0021 JMP211 10/100/1000 media interface



CVS commit: src/sys/dev/mii

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 14:07:51 UTC 2023

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
miidevs: Add MaxLinear GPY115.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/dev/mii/miidevs

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



CVS commit: src

2023-10-17 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Oct 17 13:51:52 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile

Log Message:
The t_fdrestart test requires rump.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1294 -r1.1295 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.76 -r1.77 src/tests/kernel/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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.420 src/distrib/sets/lists/debug/mi:1.421
--- src/distrib/sets/lists/debug/mi:1.420	Tue Oct 17 13:45:37 2023
+++ src/distrib/sets/lists/debug/mi	Tue Oct 17 13:51:52 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.420 2023/10/17 13:45:37 rjs Exp $
+# $NetBSD: mi,v 1.421 2023/10/17 13:51:52 rjs Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -1792,7 +1792,7 @@
 ./usr/libdata/debug/usr/tests/kernel/t_extattrctl.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kernel/t_extent.debug			tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_fcntl.debug			tests-kernel-tests	debug,atf
-./usr/libdata/debug/usr/tests/kernel/t_fdrestart.debug			tests-kernel-tests	debug,atf
+./usr/libdata/debug/usr/tests/kernel/t_fdrestart.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kernel/t_filedesc.debug			tests-kernel-tests	debug,atf,rump
 ./usr/libdata/debug/usr/tests/kernel/t_kauth_pr_47598.debug		tests-kernel-tests	debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/kernel/t_ksem.debug			tests-kernel-tests	debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1294 src/distrib/sets/lists/tests/mi:1.1295
--- src/distrib/sets/lists/tests/mi:1.1294	Sun Oct 15 13:22:52 2023
+++ src/distrib/sets/lists/tests/mi	Tue Oct 17 13:51:52 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1294 2023/10/15 13:22:52 riastradh Exp $
+# $NetBSD: mi,v 1.1295 2023/10/17 13:51:52 rjs Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2311,7 +2311,7 @@
 ./usr/tests/kernel/t_extattrctltests-kernel-tests	atf,rump
 ./usr/tests/kernel/t_extenttests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_fcntltests-kernel-tests	atf
-./usr/tests/kernel/t_fdrestarttests-kernel-tests	atf
+./usr/tests/kernel/t_fdrestarttests-kernel-tests	atf,rump
 ./usr/tests/kernel/t_fexecvetests-kernel-tests	atf
 ./usr/tests/kernel/t_filedesctests-kernel-tests	atf,rump
 ./usr/tests/kernel/t_fpuforktests-kernel-tests	atf

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.76 src/tests/kernel/Makefile:1.77
--- src/tests/kernel/Makefile:1.76	Sun Oct 15 13:22:52 2023
+++ src/tests/kernel/Makefile	Tue Oct 17 13:51:52 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.76 2023/10/15 13:22:52 riastradh Exp $
+# $NetBSD: Makefile,v 1.77 2023/10/17 13:51:52 rjs Exp $
 
 NOMAN=		# defined
 
@@ -9,7 +9,9 @@ TESTSDIR=	${TESTSBASE}/kernel
 TESTS_SUBDIRS+=	kqueue
 #TESTS_C=	t_epoll
 TESTS_C+=	t_fcntl
+.if ${MKRUMP} != "no"
 TESTS_C+=	t_fdrestart
+.endif
 TESTS_C+=	t_lock
 TESTS_C+=	t_lockf
 TESTS_C+=	t_pty



CVS commit: src

2023-10-17 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Oct 17 13:51:52 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile

Log Message:
The t_fdrestart test requires rump.


To generate a diff of this commit:
cvs rdiff -u -r1.420 -r1.421 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1294 -r1.1295 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.76 -r1.77 src/tests/kernel/Makefile

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



CVS commit: src/distrib/sets/lists/debug

2023-10-17 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Oct 17 13:45:37 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
The inpcb tests are only built when rump is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.419 -r1.420 src/distrib/sets/lists/debug/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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.419 src/distrib/sets/lists/debug/mi:1.420
--- src/distrib/sets/lists/debug/mi:1.419	Sun Oct 15 13:22:52 2023
+++ src/distrib/sets/lists/debug/mi	Tue Oct 17 13:45:37 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.419 2023/10/15 13:22:52 riastradh Exp $
+# $NetBSD: mi,v 1.420 2023/10/17 13:45:37 rjs Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2432,8 +2432,8 @@
 ./usr/libdata/debug/usr/tests/net/if_tap/rump_open_tap.debug	tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/if_vlan/bpfopen.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/if_vlan/siocXmulti.debug	tests-net-debug		debug,atf,rump
-./usr/libdata/debug/usr/tests/net/inpcb/broadcast_bind.debug	tests-net-debug		debug,atf,compattestfile
-./usr/libdata/debug/usr/tests/net/inpcb/inpcb_bind.debug	tests-net-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/net/inpcb/broadcast_bind.debug	tests-net-debug		debug,atf,rump,compattestfile
+./usr/libdata/debug/usr/tests/net/inpcb/inpcb_bind.debug	tests-net-debug		debug,atf,rump,compattestfile
 ./usr/libdata/debug/usr/tests/net/in_cksum/in_cksum.debug	tests-net-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/net/ipsec/natt_terminator.debug	tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/mcast/mcast.debug		tests-net-debug		debug,atf,rump



CVS commit: src/distrib/sets/lists/debug

2023-10-17 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Oct 17 13:45:37 UTC 2023

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
The inpcb tests are only built when rump is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.419 -r1.420 src/distrib/sets/lists/debug/mi

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



CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 13:30:57 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
Enable genfb in DOM0 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/conf/XEN3PAE_DOM0

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/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.200 src/sys/arch/amd64/conf/XEN3_DOM0:1.201
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.200	Wed Oct  4 07:48:55 2023
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Tue Oct 17 13:30:56 2023
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.200 2023/10/04 07:48:55 rin Exp $
+# $NetBSD: XEN3_DOM0,v 1.201 2023/10/17 13:30:56 bouyer Exp $
 
 # XEN3_DOM0 machine description file
 #
@@ -14,7 +14,7 @@ include 	"arch/amd64/conf/std.xen"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"XEN3_DOM0-$Revision: 1.200 $"
+#ident		"XEN3_DOM0-$Revision: 1.201 $"
 
 maxusers	32		# estimated number of users
 
@@ -443,8 +443,8 @@ options 	PMS_SYNAPTICS_TOUCHPAD	# Enable
 options 	PMS_ELANTECH_TOUCHPAD	# Enable support for Elantech Touchpads
 options 	PMS_ALPS_TOUCHPAD	# Enable support for Alps Touchpads
 vga*		at pci? dev ? function ?
-#genfb*		at pci? dev ? function ?# Needs acpi_md_vesa_modenum
-	# in acpi_wakeup.c (!xenpv)
+genfb*		at pci? dev ? function ?
+
 #options 	VCONS_DRAW_INTR
 #wsdisplay*	at vga? console ?
 wsdisplay*	at wsemuldisplaydev?

Index: src/sys/arch/i386/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.40 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.41
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.40	Sat Aug  5 14:38:43 2023
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Tue Oct 17 13:30:56 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.40 2023/08/05 14:38:43 riastradh Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.41 2023/10/17 13:30:56 bouyer Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -531,6 +531,7 @@ pms*		at pckbc?		# PS/2 mouse for wsmous
 options 	PMS_SYNAPTICS_TOUCHPAD	# Enable support for Synaptics Touchpads
 #vga0		at isa?
 vga*		at pci? dev ? function ?
+genfb*		at pci? dev ? function ?
 #pcdisplay0	at isa?			# CGA, MDA, EGA, HGA
 #machfb* 	at pci? dev ? function ? # ATI Mach64 framebuffer driver
 wsdisplay*	at vga? console ?



CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 13:30:57 UTC 2023

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
Enable genfb in DOM0 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/i386/conf/XEN3PAE_DOM0

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



CVS commit: src/sys/arch/xen/x86

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 13:27:58 UTC 2023

Modified Files:
src/sys/arch/xen/x86: pvh_consinit.c

Log Message:
Make sure to always fall back to xen_early_console, even for dom0


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/pvh_consinit.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/xen/x86

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 13:27:58 UTC 2023

Modified Files:
src/sys/arch/xen/x86: pvh_consinit.c

Log Message:
Make sure to always fall back to xen_early_console, even for dom0


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/pvh_consinit.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/xen/x86/pvh_consinit.c
diff -u src/sys/arch/xen/x86/pvh_consinit.c:1.5 src/sys/arch/xen/x86/pvh_consinit.c:1.6
--- src/sys/arch/xen/x86/pvh_consinit.c:1.5	Mon Oct 16 17:31:18 2023
+++ src/sys/arch/xen/x86/pvh_consinit.c	Tue Oct 17 13:27:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pvh_consinit.c,v 1.5 2023/10/16 17:31:18 bouyer Exp $ */
+/* $NetBSD: pvh_consinit.c,v 1.6 2023/10/17 13:27:58 bouyer Exp $ */
 
 /*
  * Copyright (c) 2020 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pvh_consinit.c,v 1.5 2023/10/16 17:31:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pvh_consinit.c,v 1.6 2023/10/17 13:27:58 bouyer Exp $");
 
 #include "xencons.h"
 #include 
@@ -51,6 +51,11 @@ xen_pvh_consinit(void)
 	 * boot stage.
 	 */
 	static int initted = 0;
+
+	if (initted == 0) {
+		/* fall back to printk() until we can setup our console */
+		xen_early_console();
+	}
 	if (xendomain_is_dom0()) {
 		union xen_cmdline_parseinfo xcp;
 		xen_parse_cmdline(XEN_PARSE_CONSOLE, );
@@ -61,12 +66,12 @@ xen_pvh_consinit(void)
 		if (strcmp(xcp.xcp_console, "tty0") == 0 || /* linux name */
 		strcmp(xcp.xcp_console, "pc") == 0) { /* NetBSD name */
 #endif /* CONS_OVERRIDE */
+			initted++;
 			return 0; /* native console code will do it */
 		}
 	}
 	if (initted == 0 && !xendomain_is_dom0()) {
-		/* pmap not up yet, fall back to printk() */
-		xen_early_console();
+		/* pmap not up yet */
 		initted++;
 		return 1;
 	} else if (initted > 1) {



CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 12:07:42 UTC 2023

Modified Files:
src/sys/arch/x86/include: genfb_machdep.h
src/sys/arch/x86/pci: pci_machdep.c
src/sys/arch/x86/x86: consinit.c genfb_machdep.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: autoconf.c consinit.c
Added Files:
src/sys/arch/xen/xen: genfb_xen.c

Log Message:
Support non-VGA framebuffers for Xen dom0. This is mandatory for graphic
console on EFI-only hardware.
Add a xen_genfb_getbtinfo() function which will return a btinfo_framebuffer
structure, filled in with parameters provided by Xen
when runing as a Xen dom0, call xen_genfb_getbtinfo() instead of
lookup_bootinfo(BTINFO_FRAMEBUFFER) when adding properties to the
PCI graphic device (when genfb is attached) and in x86_genfb_init()
when genfb is used as console.
x86/x86/consinit.c: If running as a Xen dom0, use xen_genfb_getbtinfo()
to check if we have a genfb console
xen/x86/consinit.c: support genfb as possible console
xen/x86/consinit.c: use the hypervior IO as console until a better one
is found. If the hypervisor is using a serial port for boot messages,
we'll get NetBSD's boot message on the serial port too until
the real console takes over.
xen/x86/autoconf.c: rework device_register() to be closer to the x86 version.
Especially make sure that device_pci_register() is called.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/x86/consinit.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/xen/genfb_xen.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/x86/include/genfb_machdep.h
diff -u src/sys/arch/x86/include/genfb_machdep.h:1.6 src/sys/arch/x86/include/genfb_machdep.h:1.7
--- src/sys/arch/x86/include/genfb_machdep.h:1.6	Mon Oct 16 17:27:02 2023
+++ src/sys/arch/x86/include/genfb_machdep.h	Tue Oct 17 12:07:42 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.6 2023/10/16 17:27:02 bouyer Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.7 2023/10/17 12:07:42 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -34,6 +34,8 @@ int	x86_genfb_cnattach(void);
 void	x86_genfb_set_console_dev(device_t);
 void	x86_genfb_ddb_trap_callback(int);
 
+const struct btinfo_framebuffer * xen_genfb_getbtinfo(void);
+
 extern int acpi_md_vesa_modenum;
 extern int acpi_md_vbios_reset;
 extern struct vcons_screen x86_genfb_console_screen;

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.96 src/sys/arch/x86/pci/pci_machdep.c:1.97
--- src/sys/arch/x86/pci/pci_machdep.c:1.96	Mon Oct 16 17:27:02 2023
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Oct 17 12:07:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.96 2023/10/16 17:27:02 bouyer Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.96 2023/10/16 17:27:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.97 2023/10/17 12:07:42 bouyer Exp $");
 
 #include 
 #include 
@@ -103,6 +103,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include "acpica.h"
@@ -116,6 +118,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
 #include "pci.h"
 #include "wsdisplay.h"
 #include "com.h"
+#include "opt_xen.h"
 
 #ifdef DDB
 #include 
@@ -1110,9 +1113,18 @@ populate_fbinfo(device_t dev, prop_dicti
 #if NWSDISPLAY > 0 && NGENFB > 0
 	struct rasops_info *ri = _genfb_console_screen.scr_ri;
 #endif
-	const void *fbptr = lookup_bootinfo(BTINFO_FRAMEBUFFER);
+	const void *fbptr = NULL;
 	struct btinfo_framebuffer fbinfo;
 
+
+#if NWSDISPLAY > 0 && NGENFB > 0 && defined(XEN) && defined(DOM0OPS)
+	if ((vm_guest == VM_GUEST_XENPVH || vm_guest == VM_GUEST_XENPV) &&
+	xendomain_is_dom0())
+		fbptr = xen_genfb_getbtinfo();
+#endif
+	if (fbptr == NULL)
+		fbptr = lookup_bootinfo(BTINFO_FRAMEBUFFER);
+
 	if (fbptr == NULL)
 		return;
 

Index: src/sys/arch/x86/x86/consinit.c
diff -u src/sys/arch/x86/x86/consinit.c:1.36 src/sys/arch/x86/x86/consinit.c:1.37
--- src/sys/arch/x86/x86/consinit.c:1.36	Fri Mar 24 12:28:42 2023
+++ src/sys/arch/x86/x86/consinit.c	Tue Oct 17 12:07:42 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.36 2023/03/24 12:28:42 bouyer Exp $	*/
+/*	$NetBSD: consinit.c,v 1.37 2023/10/17 12:07:42 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 

CVS commit: src/sys/arch

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 12:07:42 UTC 2023

Modified Files:
src/sys/arch/x86/include: genfb_machdep.h
src/sys/arch/x86/pci: pci_machdep.c
src/sys/arch/x86/x86: consinit.c genfb_machdep.c
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/x86: autoconf.c consinit.c
Added Files:
src/sys/arch/xen/xen: genfb_xen.c

Log Message:
Support non-VGA framebuffers for Xen dom0. This is mandatory for graphic
console on EFI-only hardware.
Add a xen_genfb_getbtinfo() function which will return a btinfo_framebuffer
structure, filled in with parameters provided by Xen
when runing as a Xen dom0, call xen_genfb_getbtinfo() instead of
lookup_bootinfo(BTINFO_FRAMEBUFFER) when adding properties to the
PCI graphic device (when genfb is attached) and in x86_genfb_init()
when genfb is used as console.
x86/x86/consinit.c: If running as a Xen dom0, use xen_genfb_getbtinfo()
to check if we have a genfb console
xen/x86/consinit.c: support genfb as possible console
xen/x86/consinit.c: use the hypervior IO as console until a better one
is found. If the hypervisor is using a serial port for boot messages,
we'll get NetBSD's boot message on the serial port too until
the real console takes over.
xen/x86/autoconf.c: rework device_register() to be closer to the x86 version.
Especially make sure that device_pci_register() is called.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/x86/consinit.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/xen/xen/genfb_xen.c

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



CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:57:20 UTC 2023

Modified Files:
src/sys/kern: subr_thmap.c

Log Message:
thmap(9): Preallocate GC list storage for thmap_del.

thmap_del can't fail, and it is used in places in npf where sleeping
is forbidden, so it can't rely on allocating memory either.

Instead of having thmap_del allocate memory on the fly for each
object to defer freeing until thmap_gc, arrange to have thmap(9)
preallocate the same storage when allocating all the objects in the
first place, with a GC header.

This is suboptimal for memory usage, especially on insertion- and
lookup-heavy but deletion-light workloads, but it's not clear rmind's
alternative (https://github.com/rmind/thmap/tree/thmap_del_mem_fail)
is ready to use yet, so we'll go with this for correctness.

PR kern/57208
https://github.com/rmind/npf/issues/129

XXX pullup-10
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_thmap.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/subr_thmap.c
diff -u src/sys/kern/subr_thmap.c:1.14 src/sys/kern/subr_thmap.c:1.15
--- src/sys/kern/subr_thmap.c:1.14	Tue Oct 17 11:55:28 2023
+++ src/sys/kern/subr_thmap.c	Tue Oct 17 11:57:20 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_thmap.c,v 1.14 2023/10/17 11:55:28 riastradh Exp $	*/
+/*	$NetBSD: subr_thmap.c,v 1.15 2023/10/17 11:57:20 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 Mindaugas Rasiukevicius 
@@ -112,7 +112,7 @@
 #include "utils.h"
 #endif
 
-THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.14 2023/10/17 11:55:28 riastradh Exp $");
+THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.15 2023/10/17 11:57:20 riastradh Exp $");
 
 #include 
 
@@ -212,11 +212,17 @@ typedef struct {
 	uint32_t	hashval;	// current hash value
 } thmap_query_t;
 
-typedef struct {
-	uintptr_t	addr;
+union thmap_align {
+	void *		p;
+	uint64_t	v;
+};
+
+typedef struct thmap_gc thmap_gc_t;
+struct thmap_gc {
 	size_t		len;
-	void *		next;
-} thmap_gc_t;
+	thmap_gc_t *	next;
+	char		data[] __aligned(sizeof(union thmap_align));
+};
 
 #define	THMAP_ROOT_LEN	(sizeof(thmap_ptr_t) * ROOT_SIZE)
 
@@ -252,6 +258,34 @@ static const thmap_ops_t thmap_default_o
 	.free = free_wrapper
 };
 
+static uintptr_t
+gc_alloc(const thmap_t *thmap, size_t len)
+{
+	const size_t alloclen = offsetof(struct thmap_gc, data[len]);
+	const uintptr_t gcaddr = thmap->ops->alloc(alloclen);
+
+	if (!gcaddr)
+		return 0;
+
+	thmap_gc_t *const gc = THMAP_GETPTR(thmap, gcaddr);
+	gc->len = len;
+	return THMAP_GETOFF(thmap, >data[0]);
+}
+
+static void
+gc_free(const thmap_t *thmap, uintptr_t addr, size_t len)
+{
+	const size_t alloclen = offsetof(struct thmap_gc, data[len]);
+	char *const ptr = THMAP_GETPTR(thmap, addr);
+	thmap_gc_t *const gc = container_of(ptr, struct thmap_gc, data[0]);
+	const uintptr_t gcaddr = THMAP_GETOFF(thmap, gc);
+
+	KASSERTMSG(gc->len == len, "thmap=%p ops=%p addr=%p len=%zu"
+	" gc=%p gc->len=%zu",
+	thmap, thmap->ops, (void *)addr, len, gc, gc->len);
+	thmap->ops->free(gcaddr, alloclen);
+}
+
 /*
  * NODE LOCKING.
  */
@@ -395,7 +429,7 @@ node_create(thmap_t *thmap, thmap_inode_
 	thmap_inode_t *node;
 	uintptr_t p;
 
-	p = thmap->ops->alloc(THMAP_INODE_LEN);
+	p = gc_alloc(thmap, THMAP_INODE_LEN);
 	if (!p) {
 		return NULL;
 	}
@@ -456,7 +490,7 @@ leaf_create(const thmap_t *thmap, const 
 	thmap_leaf_t *leaf;
 	uintptr_t leaf_off, key_off;
 
-	leaf_off = thmap->ops->alloc(sizeof(thmap_leaf_t));
+	leaf_off = gc_alloc(thmap, sizeof(thmap_leaf_t));
 	if (!leaf_off) {
 		return NULL;
 	}
@@ -467,9 +501,9 @@ leaf_create(const thmap_t *thmap, const 
 		/*
 		 * Copy the key.
 		 */
-		key_off = thmap->ops->alloc(len);
+		key_off = gc_alloc(thmap, len);
 		if (!key_off) {
-			thmap->ops->free(leaf_off, sizeof(thmap_leaf_t));
+			gc_free(thmap, leaf_off, sizeof(thmap_leaf_t));
 			return NULL;
 		}
 		memcpy(THMAP_GETPTR(thmap, key_off), key, len);
@@ -487,9 +521,9 @@ static void
 leaf_free(const thmap_t *thmap, thmap_leaf_t *leaf)
 {
 	if ((thmap->flags & THMAP_NOCOPY) == 0) {
-		thmap->ops->free(leaf->key, leaf->len);
+		gc_free(thmap, leaf->key, leaf->len);
 	}
-	thmap->ops->free(THMAP_GETOFF(thmap, leaf), sizeof(thmap_leaf_t));
+	gc_free(thmap, THMAP_GETOFF(thmap, leaf), sizeof(thmap_leaf_t));
 }
 
 static thmap_leaf_t *
@@ -547,7 +581,7 @@ root_try_put(thmap_t *thmap, const thmap
 	nptr = THMAP_GETOFF(thmap, node);
 again:
 	if (atomic_load_relaxed(>root[i])) {
-		thmap->ops->free(nptr, THMAP_INODE_LEN);
+		gc_free(thmap, nptr, THMAP_INODE_LEN);
 		return EEXIST;
 	}
 	/* Release to subsequent consume in find_edge_node(). */
@@ -927,11 +961,13 @@ thmap_del(thmap_t *thmap, const void *ke
 static void
 stage_mem_gc(thmap_t *thmap, uintptr_t addr, size_t len)
 {
+	char *const ptr = THMAP_GETPTR(thmap, addr);
 	thmap_gc_t *head, *gc;
 
-	gc = kmem_intr_alloc(sizeof(thmap_gc_t), KM_NOSLEEP);
-	gc->addr 

CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:57:20 UTC 2023

Modified Files:
src/sys/kern: subr_thmap.c

Log Message:
thmap(9): Preallocate GC list storage for thmap_del.

thmap_del can't fail, and it is used in places in npf where sleeping
is forbidden, so it can't rely on allocating memory either.

Instead of having thmap_del allocate memory on the fly for each
object to defer freeing until thmap_gc, arrange to have thmap(9)
preallocate the same storage when allocating all the objects in the
first place, with a GC header.

This is suboptimal for memory usage, especially on insertion- and
lookup-heavy but deletion-light workloads, but it's not clear rmind's
alternative (https://github.com/rmind/thmap/tree/thmap_del_mem_fail)
is ready to use yet, so we'll go with this for correctness.

PR kern/57208
https://github.com/rmind/npf/issues/129

XXX pullup-10
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_thmap.c

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



CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:55:28 UTC 2023

Modified Files:
src/sys/kern: subr_thmap.c

Log Message:
thmap(9): Test alloc failure, not THMAP_GETPTR failure.

THMAP_GETPTR may return nonnull even though alloc returned zero.

Note that this failure branch is not actually appropriate;
thmap_create should not fail.  We really need to pass KM_SLEEP
through in this call site even though there are other call sites for
which KM_NOSLEEP is appropriate.

Adapted from: https://github.com/rmind/thmap/pull/14

PR kern/57666
https://github.com/rmind/thmap/issues/13

XXX pullup-10
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_thmap.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/subr_thmap.c
diff -u src/sys/kern/subr_thmap.c:1.13 src/sys/kern/subr_thmap.c:1.14
--- src/sys/kern/subr_thmap.c:1.13	Tue Apr 11 13:06:21 2023
+++ src/sys/kern/subr_thmap.c	Tue Oct 17 11:55:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_thmap.c,v 1.13 2023/04/11 13:06:21 riastradh Exp $	*/
+/*	$NetBSD: subr_thmap.c,v 1.14 2023/10/17 11:55:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 Mindaugas Rasiukevicius 
@@ -112,7 +112,7 @@
 #include "utils.h"
 #endif
 
-THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.13 2023/04/11 13:06:21 riastradh Exp $");
+THMAP_RCSID("$NetBSD: subr_thmap.c,v 1.14 2023/10/17 11:55:28 riastradh Exp $");
 
 #include 
 
@@ -987,11 +987,11 @@ thmap_create(uintptr_t baseptr, const th
 	if ((thmap->flags & THMAP_SETROOT) == 0) {
 		/* Allocate the root level. */
 		root = thmap->ops->alloc(THMAP_ROOT_LEN);
-		thmap->root = THMAP_GETPTR(thmap, root);
-		if (!thmap->root) {
+		if (!root) {
 			kmem_free(thmap, sizeof(thmap_t));
 			return NULL;
 		}
+		thmap->root = THMAP_GETPTR(thmap, root);
 		memset(thmap->root, 0, THMAP_ROOT_LEN);
 	}
 



CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:55:28 UTC 2023

Modified Files:
src/sys/kern: subr_thmap.c

Log Message:
thmap(9): Test alloc failure, not THMAP_GETPTR failure.

THMAP_GETPTR may return nonnull even though alloc returned zero.

Note that this failure branch is not actually appropriate;
thmap_create should not fail.  We really need to pass KM_SLEEP
through in this call site even though there are other call sites for
which KM_NOSLEEP is appropriate.

Adapted from: https://github.com/rmind/thmap/pull/14

PR kern/57666
https://github.com/rmind/thmap/issues/13

XXX pullup-10
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_thmap.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/xen/xenbus

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 11:52:45 UTC 2023

Modified Files:
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
xenbus: if dom0 support is not compiled in, panic with a usefull message
instead of waiting for an event which will never happen


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/xenbus/xenbus_probe.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/xen/xenbus

2023-10-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Oct 17 11:52:45 UTC 2023

Modified Files:
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
xenbus: if dom0 support is not compiled in, panic with a usefull message
instead of waiting for an event which will never happen


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/xenbus/xenbus_probe.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/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.59 src/sys/arch/xen/xenbus/xenbus_probe.c:1.60
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.59	Tue Aug  1 07:58:41 2023
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Oct 17 11:52:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.59 2023/08/01 07:58:41 mrg Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.60 2023/10/17 11:52:45 bouyer Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.59 2023/08/01 07:58:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.60 2023/10/17 11:52:45 bouyer Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -722,7 +722,7 @@ xenbus_probe_init(void *unused)
 
 		DELAY(1000);
 #else /* DOM0OPS */
-		kthread_exit(0); /* can't get a working xenstore in this case */
+		panic("dom0 support not compiled in");
 #endif /* DOM0OPS */
 	}
 



CVS commit: src/sys/arch/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:12:33 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
x86: Panic early if fpu save size is too large, take 2.

This shouldn't break any existing systems (for real this time), but
it should make the failure mode more obvious on systems that are
already broken.

PR kern/57661

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x86/x86/identcpu.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/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:12:33 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
x86: Panic early if fpu save size is too large, take 2.

This shouldn't break any existing systems (for real this time), but
it should make the failure mode more obvious on systems that are
already broken.

PR kern/57661

XXX pullup-10
XXX pullup-9
XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.126 src/sys/arch/x86/x86/identcpu.c:1.127
--- src/sys/arch/x86/x86/identcpu.c:1.126	Tue Oct 17 11:11:49 2023
+++ src/sys/arch/x86/x86/identcpu.c	Tue Oct 17 11:12:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.126 2023/10/17 11:11:49 riastradh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.127 2023/10/17 11:12:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.126 2023/10/17 11:11:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.127 2023/10/17 11:12:33 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: identcpu.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -769,8 +770,16 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	/* Get features and maximum size of the save area */
 	x86_cpuid(0xd, descs);
-	if (descs[2] > sizeof(struct fxsave))
+	if (descs[2] > sizeof(struct fxsave)) {
+		CTASSERT(offsetof(struct pcb, pcb_savefpu) < PAGE_SIZE);
+		const unsigned max_fpu_save_size =
+		PAGE_SIZE - offsetof(struct pcb, pcb_savefpu);
+		if (descs[2] > max_fpu_save_size) {
+			panic("CPU's FPU save size too large: %u > %u",
+			descs[2], max_fpu_save_size);
+		}
 		x86_fpu_save_size = descs[2];
+	}
 
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
 



CVS commit: src/sys/arch/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:11:49 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
x86: Remove incomplete fpu save size check.

Will fix it later, but this makes pullups easier.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.125 src/sys/arch/x86/x86/identcpu.c:1.126
--- src/sys/arch/x86/x86/identcpu.c:1.125	Sun Oct 15 16:11:22 2023
+++ src/sys/arch/x86/x86/identcpu.c	Tue Oct 17 11:11:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.125 2023/10/15 16:11:22 riastradh Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.126 2023/10/17 11:11:49 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.125 2023/10/15 16:11:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.126 2023/10/17 11:11:49 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -769,15 +769,8 @@ cpu_probe_fpu(struct cpu_info *ci)
 
 	/* Get features and maximum size of the save area */
 	x86_cpuid(0xd, descs);
-	if (descs[2] > sizeof(struct fxsave)) {
-#if 0/* XXX breaks boot because of pcb abuse */
-		if (descs[2] > sizeof(union savefpu)) {
-			panic("CPU's FPU save size too large: %u > %zu",
-			descs[2], sizeof(union savefpu));
-		}
-#endif
+	if (descs[2] > sizeof(struct fxsave))
 		x86_fpu_save_size = descs[2];
-	}
 
 	x86_xsave_features = (uint64_t)descs[3] << 32 | descs[0];
 



CVS commit: src/sys/arch/x86/x86

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 11:11:49 UTC 2023

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
x86: Remove incomplete fpu save size check.

Will fix it later, but this makes pullups easier.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/x86/x86/identcpu.c

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



CVS commit: src/sys/sys

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:28:06 UTC 2023

Modified Files:
src/sys/sys: pipe.h

Log Message:
sys/pipe.h: #define

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/sys/pipe.h

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



CVS commit: src/sys/sys

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:28:06 UTC 2023

Modified Files:
src/sys/sys: pipe.h

Log Message:
sys/pipe.h: #define

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/sys/pipe.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/sys/pipe.h
diff -u src/sys/sys/pipe.h:1.40 src/sys/sys/pipe.h:1.41
--- src/sys/sys/pipe.h:1.40	Fri Oct 13 19:07:09 2023
+++ src/sys/sys/pipe.h	Tue Oct 17 10:28:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pipe.h,v 1.40 2023/10/13 19:07:09 ad Exp $	*/
+/*	$NetBSD: pipe.h,v 1.41 2023/10/17 10:28:06 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996 John S. Dyson
@@ -24,7 +24,7 @@
  */
 
 #ifndef _SYS_PIPE_H_
-#define _SYS_PIPE_H_
+#define	_SYS_PIPE_H_
 
 #include 		/* for struct selinfo */
 #include 			/* for struct timespec */
@@ -35,11 +35,11 @@
  * Pipe buffer size, keep moderate in value, pipes take kva space.
  */
 #ifndef PIPE_SIZE
-#define PIPE_SIZE	16384
+#define	PIPE_SIZE	16384
 #endif
 
 #ifndef BIG_PIPE_SIZE
-#define BIG_PIPE_SIZE	(4*PIPE_SIZE)
+#define	BIG_PIPE_SIZE	(4*PIPE_SIZE)
 #endif
 
 /*
@@ -48,7 +48,7 @@
  * size.
  */
 #ifndef PIPE_DIRECT_CHUNK
-#define PIPE_DIRECT_CHUNK	(1*1024*1024)
+#define	PIPE_DIRECT_CHUNK	(1*1024*1024)
 #endif
 
 /*
@@ -56,7 +56,7 @@
  * than PIPE_BUF.
  */
 #ifndef PIPE_MINDIRECT
-#define PIPE_MINDIRECT	8192
+#define	PIPE_MINDIRECT	8192
 #endif
 
 /*
@@ -75,12 +75,12 @@ struct pipebuf {
 /*
  * Bits in pipe_state.
  */
-#define PIPE_RDASYNC	0x001	/* Async I/O on reader side */
-#define PIPE_WRASYNC	0x002	/* Async I/O on writer side */
-#define PIPE_RDOPEN	0x010	/* Reader side open */
-#define PIPE_WROPEN	0x020	/* Writer side open */
-#define PIPE_EOF	0x100	/* Pipe is in EOF condition */
-#define PIPE_SIGNALR	0x200	/* Do selwakeup() on read(2) */
+#define	PIPE_RDASYNC	0x001	/* Async I/O on reader side */
+#define	PIPE_WRASYNC	0x002	/* Async I/O on writer side */
+#define	PIPE_RDOPEN	0x010	/* Reader side open */
+#define	PIPE_WROPEN	0x020	/* Writer side open */
+#define	PIPE_EOF	0x100	/* Pipe is in EOF condition */
+#define	PIPE_SIGNALR	0x200	/* Do selwakeup() on read(2) */
 #define	PIPE_RESIZED	0x400	/* Attempted to resize */
 
 /*



CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:27:35 UTC 2023

Modified Files:
src/sys/kern: kern_ktrace.c

Log Message:
kern_ktrace.c: Sort includes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/kern/kern_ktrace.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_ktrace.c
diff -u src/sys/kern/kern_ktrace.c:1.183 src/sys/kern/kern_ktrace.c:1.184
--- src/sys/kern/kern_ktrace.c:1.183	Sun Oct 15 10:27:11 2023
+++ src/sys/kern/kern_ktrace.c	Tue Oct 17 10:27:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ktrace.c,v 1.183 2023/10/15 10:27:11 riastradh Exp $	*/
+/*	$NetBSD: kern_ktrace.c,v 1.184 2023/10/17 10:27:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -61,26 +61,26 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.183 2023/10/15 10:27:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.184 2023/10/17 10:27:34 riastradh Exp $");
 
 #include 
-#include 
-#include 
+
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
-
+#include 
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
 
 /*
  * TODO:



CVS commit: src/sys/kern

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:27:35 UTC 2023

Modified Files:
src/sys/kern: kern_ktrace.c

Log Message:
kern_ktrace.c: Sort includes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/kern/kern_ktrace.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/xen/xen

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:24:11 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
xen_machdep.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/xen/xen_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/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.28 src/sys/arch/xen/xen/xen_machdep.c:1.29
--- src/sys/arch/xen/xen/xen_machdep.c:1.28	Mon Oct 16 17:31:18 2023
+++ src/sys/arch/xen/xen/xen_machdep.c	Tue Oct 17 10:24:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.28 2023/10/16 17:31:18 bouyer Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.29 2023/10/17 10:24:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.28 2023/10/16 17:31:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.29 2023/10/17 10:24:11 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -466,7 +466,7 @@ early_xenconscn_getc(dev_t dev)
 	return -1;
 }
 
-static void 
+static void
 early_xenconscn_putc(dev_t dev, int c)
 {
 	printk("%c", c);



CVS commit: src/sys/arch/xen/xen

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:24:11 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
xen_machdep.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/xen/xen_machdep.c

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



CVS commit: src/sys/dev/ic

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 10:23:00 UTC 2023

Modified Files:
src/sys/dev/ic: dwc_eqos_reg.h

Log Message:
eqos(4): Fix definition of GMAC_MAC_HW_FEATURE1_RXFIFOSIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/dwc_eqos_reg.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/ic/dwc_eqos_reg.h
diff -u src/sys/dev/ic/dwc_eqos_reg.h:1.6 src/sys/dev/ic/dwc_eqos_reg.h:1.7
--- src/sys/dev/ic/dwc_eqos_reg.h:1.6	Wed Aug 24 19:21:41 2022
+++ src/sys/dev/ic/dwc_eqos_reg.h	Tue Oct 17 10:23:00 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_eqos_reg.h,v 1.6 2022/08/24 19:21:41 ryo Exp $ */
+/* $NetBSD: dwc_eqos_reg.h,v 1.7 2023/10/17 10:23:00 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2022 Jared McNeill 
@@ -94,7 +94,7 @@
 #define	GMAC_MAC_DEBUG0x0114
 #define	GMAC_MAC_HW_FEATURE(n)			(0x011C + 0x4 * (n))
 #define	 GMAC_MAC_HW_FEATURE1_TXFIFOSIZE	__BITS(10,6)
-#define	 GMAC_MAC_HW_FEATURE1_RXFIFOSIZE	__BITS(5,0)
+#define	 GMAC_MAC_HW_FEATURE1_RXFIFOSIZE	__BITS(4,0)
 #define	 GMAC_MAC_HW_FEATURE1_ADDR64_SHIFT	14
 #define	 GMAC_MAC_HW_FEATURE1_ADDR64_MASK	(0x3U << GMAC_MAC_HW_FEATURE1_ADDR64_SHIFT)
 #define	 GMAC_MAC_HW_FEATURE1_ADDR64_32BIT	(0x0U << GMAC_MAC_HW_FEATURE1_ADDR64_SHIFT)



CVS commit: src/sys/dev/ic

2023-10-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 17 10:23:00 UTC 2023

Modified Files:
src/sys/dev/ic: dwc_eqos_reg.h

Log Message:
eqos(4): Fix definition of GMAC_MAC_HW_FEATURE1_RXFIFOSIZE.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/dwc_eqos_reg.h

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



CVS commit: src/sys/arch/vax/vax

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:22:07 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax/pmap.c: Sort includes.  Nix traliing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/vax/vax/pmap.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/vax/vax

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 10:22:07 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
vax/pmap.c: Sort includes.  Nix traliing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/vax/vax/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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.197 src/sys/arch/vax/vax/pmap.c:1.198
--- src/sys/arch/vax/vax/pmap.c:1.197	Mon Oct 16 17:04:38 2023
+++ src/sys/arch/vax/vax/pmap.c	Tue Oct 17 10:22:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $	   */
+/*	$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,26 +25,27 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.197 2023/10/16 17:04:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.198 2023/10/17 10:22:07 riastradh Exp $");
 
-#include "opt_ddb.h"
 #include "opt_cputype.h"
+#include "opt_ddb.h"
+#include "opt_lockdebug.h"
 #include "opt_modular.h"
 #include "opt_multiprocessor.h"
-#include "opt_lockdebug.h"
 #include "opt_pipe.h"
 
 #include 
-#include 
+
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
@@ -54,20 +55,20 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.1
 #endif
 
 #include 
-#include 
-#include 
 #include 
+#include 
+#include 
 
 /* QDSS console mapping hack */
 #include "qd.h"
 void	qdearly(void);
 
-/* 
- * This code uses bitfield operators for most page table entries.  
+/*
+ * This code uses bitfield operators for most page table entries.
  */
 #define PROTSHIFT	27
 #define PROT_KW		(PG_KW >> PROTSHIFT)
-#define PROT_KR		(PG_KR >> PROTSHIFT) 
+#define PROT_KR		(PG_KR >> PROTSHIFT)
 #define PROT_RW		(PG_RW >> PROTSHIFT)
 #define PROT_RO		(PG_RO >> PROTSHIFT)
 #define PROT_URKW	(PG_URKW >> PROTSHIFT)
@@ -275,10 +276,10 @@ pmap_bootstrap(void)
 	usrptsize = (1024*1024*1024)/VAX_NBPG;	/* 1GB total VM */
 	if (vax_btop(usrptsize)* PPTESZ > avail_end/20)
 		usrptsize = (avail_end/(20 * PPTESZ)) * VAX_NBPG;
-		
+
 	kvmsize = calc_kvmsize(usrptsize);
 	/*
-	 * Ensure that not more than 1G is allocated, since that is 
+	 * Ensure that not more than 1G is allocated, since that is
 	 * max size of S0 space.
 	 * Also note that for full S0 space the SLR should be 0x20,
 	 * since the comparison in the vax microcode is >= SLR.
@@ -290,7 +291,7 @@ pmap_bootstrap(void)
 	/*
 	 * Virtual_* and avail_* is used for mapping of system page table.
 	 * The need for kernel virtual memory is linear dependent of the
-	 * amount of physical memory also, therefore sysptsize is 
+	 * amount of physical memory also, therefore sysptsize is
 	 * a variable here that is changed dependent of the physical
 	 * memory size.
 	 */
@@ -478,8 +479,8 @@ pmap_steal_memory(vsize_t size, vaddr_t 
  * is enabled. It is meant to do machine-specific allocations.
  * Here is the resource map for the user page tables inited.
  */
-void 
-pmap_init(void) 
+void
+pmap_init(void)
 {
 	/*
 	 * Create the extent map used to manage the page table space.
@@ -529,7 +530,7 @@ rmpage(pmap_t pm, int *br)
 		return; /* Forget mappings of IO space */
 
 	pv = pv_table + ((br[0] & PG_FRAME) >> LTOHPS);
-	if (((br[0] & PG_PROT) == PG_RW) && 
+	if (((br[0] & PG_PROT) == PG_RW) &&
 	((pv->pv_attr & PG_M) != PG_M))
 		pv->pv_attr |= br[0]|br[1]|br[2]|br[3]|br[4]|br[5]|br[6]|br[7];
 	pmap_decrement_stats(pm, (br[0] & PG_W) != 0);
@@ -565,10 +566,10 @@ update_pcbs(struct pmap *pm)
 		pcb->P0LR = pm->pm_p0lr | (pcb->P0LR & AST_MASK);
 		pcb->P1BR = pm->pm_p1br;
 		pcb->P1LR = pm->pm_p1lr;
-		
+
 	}
 
-	/* If curlwp uses this pmap update the regs too */ 
+	/* If curlwp uses this pmap update the regs too */
 	if (pm == curproc->p_vmspace->vm_map.pmap) {
 		mtpr((uintptr_t)pm->pm_p0br, PR_P0BR);
 		mtpr(pm->pm_p0lr, PR_P0LR);
@@ -773,7 +774,7 @@ rmptep(struct pte *pte)
 	*ptpp = 0;
 }
 
-static int 
+static int
 grow_p0(struct pmap *pm, int reqlen)
 {
 	vaddr_t nptespc;
@@ -781,7 +782,7 @@ grow_p0(struct pmap *pm, int reqlen)
 	int srclen, dstlen;
 	int inuse, len, p0lr;
 	u_long p0br;
- 
+
 	PMDEBUG(("grow_p0: pmap %p reqlen %d\n", pm, reqlen));
 
 	/* Get new pte space */
@@ -791,7 +792,7 @@ grow_p0(struct pmap *pm, int reqlen)
 	PMAP_UNLOCK;
 	nptespc = pmap_getusrptes(pm, len);
 	PMAP_LOCK;
- 
+
 	if (nptespc == 0)
 		return 0;
 	/*
@@ -826,7 +827,7 @@ grow_p1(struct pmap *pm, int len)
 {
 	vaddr_t nptespc, optespc;
 	int nlen, olen;
- 
+
 	PMDEBUG(("grow_p1: pm %p len %x\n", pm, len));
 
 	/* Get new pte space */
@@ -867,7 +868,7 @@ pmap_pinit(pmap_t pmap)
 {
 
 	/*
-	 * Do not allocate any pte's here, we don't 

CVS commit: src/sys/dev

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 09:59:46 UTC 2023

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/sequencer.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/sequencer.c
diff -u src/sys/dev/sequencer.c:1.83 src/sys/dev/sequencer.c:1.84
--- src/sys/dev/sequencer.c:1.83	Mon Oct 16 13:31:33 2023
+++ src/sys/dev/sequencer.c	Tue Oct 17 09:59:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sequencer.c,v 1.83 2023/10/16 13:31:33 oster Exp $	*/
+/*	$NetBSD: sequencer.c,v 1.84 2023/10/17 09:59:46 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.83 2023/10/16 13:31:33 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.84 2023/10/17 09:59:46 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "midi.h"
@@ -126,7 +126,7 @@ extern struct cfdriver sequencer_cd;
 #define DPRINTFN(n,x)	do { if (sequencerdebug >= (n)) printf x; } while (0)
 int	sequencerdebug = 0;
 #else
-#define DPRINTF(x)	do { } while (0)	
+#define DPRINTF(x)	do { } while (0)
 #define DPRINTFN(n,x)	do { } while (0)
 #endif
 



CVS commit: src/sys/dev

2023-10-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Oct 17 09:59:46 UTC 2023

Modified Files:
src/sys/dev: sequencer.c

Log Message:
sequencer.c: Nix trailing whitespace.

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/sequencer.c

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