CVS commit: src/sys/dev/scsipi

2024-06-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jun 22 10:10:07 UTC 2024

Modified Files:
src/sys/dev/scsipi: scsiconf.c

Log Message:
Add quirk for sparc64/sun4v ldom virtual cd devices


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/dev/scsipi/scsiconf.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/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.303 src/sys/dev/scsipi/scsiconf.c:1.304
--- src/sys/dev/scsipi/scsiconf.c:1.303	Sat Oct 15 18:42:49 2022
+++ src/sys/dev/scsipi/scsiconf.c	Sat Jun 22 10:10:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.303 2022/10/15 18:42:49 jmcneill Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.304 2024/06/22 10:10:07 palle Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.303 2022/10/15 18:42:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.304 2024/06/22 10:10:07 palle Exp $");
 
 #include 
 #include 
@@ -864,6 +864,8 @@ static const struct scsi_quirk_inquiry_p
 	 "SONY", "CDL1100 ", ""}, PQUIRK_NOLUNS},
 	{{T_ENCLOSURE, T_FIXED,
 	 "SUN ", "SENA", ""}, PQUIRK_NOLUNS},
+	{{T_CDROM, T_REMOV,
+	 "SUN ", "Virtual CDROM   ", ""}, PQUIRK_NOREADDISCINFO},
 };
 
 /*



CVS commit: src/sys/dev/scsipi

2024-06-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jun 22 10:10:07 UTC 2024

Modified Files:
src/sys/dev/scsipi: scsiconf.c

Log Message:
Add quirk for sparc64/sun4v ldom virtual cd devices


To generate a diff of this commit:
cvs rdiff -u -r1.303 -r1.304 src/sys/dev/scsipi/scsiconf.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/scsipi

2024-06-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jun 22 10:07:46 UTC 2024

Modified Files:
src/sys/dev/scsipi: cd.c scsipiconf.h

Log Message:
Add quirk for devices that does not handle READ_DISCINFO


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/sys/dev/scsipi/cd.c
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/scsipi/scsipiconf.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/scsipi

2024-06-22 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jun 22 10:07:46 UTC 2024

Modified Files:
src/sys/dev/scsipi: cd.c scsipiconf.h

Log Message:
Add quirk for devices that does not handle READ_DISCINFO


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/sys/dev/scsipi/cd.c
cvs rdiff -u -r1.130 -r1.131 src/sys/dev/scsipi/scsipiconf.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/scsipi/cd.c
diff -u src/sys/dev/scsipi/cd.c:1.354 src/sys/dev/scsipi/cd.c:1.355
--- src/sys/dev/scsipi/cd.c:1.354	Sun Jun 26 21:00:28 2022
+++ src/sys/dev/scsipi/cd.c	Sat Jun 22 10:07:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.354 2022/06/26 21:00:28 andvar Exp $	*/
+/*	$NetBSD: cd.c,v 1.355 2024/06/22 10:07:46 palle Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.354 2022/06/26 21:00:28 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.355 2024/06/22 10:07:46 palle Exp $");
 
 #include 
 #include 
@@ -1545,6 +1545,11 @@ read_cd_capacity(struct scsipi_periph *p
 		*blksize = 2048;	/* some drives lie ! */
 	}
 
+	/* If the device doesn't handle READ_DISCINFO properly, */
+	/* return the dummies */
+	if (periph->periph_quirks & PQUIRK_NOREADDISCINFO)
+		return 0;
+
 	/* recordables have READ_DISCINFO implemented */
 	flags = XS_CTL_DATA_IN | XS_CTL_SILENT;
 	memset(_cmd, 0, sizeof(di_cmd));
@@ -2414,11 +2419,12 @@ cd_setblksize(struct cd_softc *cd)
 	}
 
 	if (bsize == 0) {
-printf("cd_setblksize: trying to change bsize, but no blk_desc\n");
+		printf("cd_setblksize: trying to change bsize, but no blk_desc\n");
+		
 		return (EINVAL);
 	}
 	if (_3btol(bdesc->blklen) == 2048) {
-printf("cd_setblksize: trying to change bsize, but blk_desc is correct\n");
+		printf("cd_setblksize: trying to change bsize, but blk_desc is correct\n");
 		return (EINVAL);
 	}
 

Index: src/sys/dev/scsipi/scsipiconf.h
diff -u src/sys/dev/scsipi/scsipiconf.h:1.130 src/sys/dev/scsipi/scsipiconf.h:1.131
--- src/sys/dev/scsipi/scsipiconf.h:1.130	Thu Mar 28 10:44:29 2019
+++ src/sys/dev/scsipi/scsipiconf.h	Sat Jun 22 10:07:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipiconf.h,v 1.130 2019/03/28 10:44:29 kardel Exp $	*/
+/*	$NetBSD: scsipiconf.h,v 1.131 2024/06/22 10:07:46 palle Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -504,6 +504,8 @@ struct scsipi_periph {
 #define PQUIRK_NOREPSUPPOPC 0x0100  /* does not grok
 		   REPORT SUPPORTED OPCODES
 		   to fetch device timeouts */
+#define PQUIRK_NOREADDISCINFO   0x0200  /* device doesn't do
+		   READ_DISCINFO properly */
 /*
  * Error values an adapter driver may return
  */



CVS commit: src/sys/arch/sparc64/dev

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 18:41:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: change some debug printf() to DPRINTF()


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.17 src/sys/arch/sparc64/dev/vdsk.c:1.18
--- src/sys/arch/sparc64/dev/vdsk.c:1.17	Thu Jun 20 17:49:46 2024
+++ src/sys/arch/sparc64/dev/vdsk.c	Thu Jun 20 18:41:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.17 2024/06/20 17:49:46 palle Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.18 2024/06/20 18:41:45 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -1098,27 +1098,27 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 			return;
 			
 		case SCSI_MODE_SENSE_6:
-			printf("SCSI_MODE_SENSE_6 (not implemented)\n");
+			DPRINTF(("SCSI_MODE_SENSE_6 (not implemented)\n"));
 			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
 			return;
 
 		case SCSI_MODE_SELECT_6:
-			printf("MODE_SELECT_6 (not implemented)\n");
+DPRINTF(("MODE_SELECT_6 (not implemented)\n"));
 			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
 			return;
 
 		case SCSI_MAINTENANCE_IN:
-			printf("MAINTENANCE_IN\n");
+			DPRINTF(("MAINTENANCE_IN\n"));
 			vdsk_scsi_done(xs, XS_NOERROR);
 			return;
 
 		case SCSI_MODE_SENSE_10:
-			printf("SCSI_MODE_SENSE_10 (not implemented)\n");
+			DPRINTF(("SCSI_MODE_SENSE_10 (not implemented)\n"));
 			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
 			return;
 			
 		case READ_TOC:
-			printf("READ_TOC (not implemented)\n");
+			DPRINTF(("READ_TOC (not implemented)\n"));
 			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
 			return;
 



CVS commit: src/sys/arch/sparc64/dev

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 18:41:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: change some debug printf() to DPRINTF()


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/dev/vdsk.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/sparc64/sparc64

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 18:02:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
sun4v: fix booting from both virtual disk (sd) and cdrom (cd) devices


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.240 src/sys/arch/sparc64/sparc64/autoconf.c:1.241
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.240	Wed Dec 20 05:33:59 2023
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Thu Jun 20 18:02:45 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.240 2023/12/20 05:33:59 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.241 2024/06/20 18:02:45 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.240 2023/12/20 05:33:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.241 2024/06/20 18:02:45 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1183,14 +1183,15 @@ device_register(device_t dev, void *aux)
 		 * secondary logical domain
 		 *
 		 * The bootpath looks something like this:
-		 *   /virtual-devices@100/channel-devices@200/disk@1:a
+		 *   /virtual-devices@100/channel-devices@200/disk@1:a (disk)
+		 *   /virtual-devices@100/channel-devices@200/disk@4:f (cdrom)
 		 *
 		 * The device hierarchy constructed during autoconfiguration
 		 * is:
-		 *   /mainbus/vbus/cbus/vdsk/scsibus/sd
+		 *   /mainbus/vbus/cbus/vdsk/scsibus/sd or
+		 *   /mainbus/vbus/cbus/vdsk/scsibus/cd
 		 */
-		if (CPU_ISSUN4V && device_is_a(dev, "sd") &&
-		device_is_a(busdev, "vdsk")) {
+		if (CPU_ISSUN4V && device_is_a(busdev, "vdsk")) {
 			dev_path_exact_match(dev, ofnode);
 		} else {
 			dev_bi_unit_drive_match(dev, ofnode,



CVS commit: src/sys/arch/sparc64/sparc64

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 18:02:45 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
sun4v: fix booting from both virtual disk (sd) and cdrom (cd) devices


To generate a diff of this commit:
cvs rdiff -u -r1.240 -r1.241 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/dev

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 17:49:46 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: add some DPRINTF() to vdsk


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.16 src/sys/arch/sparc64/dev/vdsk.c:1.17
--- src/sys/arch/sparc64/dev/vdsk.c:1.16	Wed Jun 19 20:04:20 2024
+++ src/sys/arch/sparc64/dev/vdsk.c	Thu Jun 20 17:49:46 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.16 2024/06/19 20:04:20 palle Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.17 2024/06/20 17:49:46 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -631,7 +631,9 @@ vdsk_rx_vio_attr_info(struct vdsk_softc 
 			}
 
 			sc->sc_vdisk_block_size = ai->vdisk_block_size;
+			DPRINTF(("vdisk_block_size %u\n", sc->sc_vdisk_block_size));
 			sc->sc_vdisk_size = ai->vdisk_size;
+			DPRINTF(("vdisk_size %lu\n", sc->sc_vdisk_size));
 			if (sc->sc_major > 1 || sc->sc_minor >= 1)
 sc->sc_vd_mtype = ai->vd_mtype;
 			else
@@ -846,6 +848,8 @@ vdsk_send_attr_info(struct vdsk_softc *s
 	ai.xfer_mode = VIO_DRING_MODE;
 	ai.vdisk_block_size = DEV_BSIZE;
 	ai.max_xfer_sz = MAXPHYS / DEV_BSIZE;
+	DPRINTF(("vdisk_block_size %u\n", ai.vdisk_block_size));
+	DPRINTF(("max_xfer_sz %lu\n", ai.max_xfer_sz));
 	vdsk_sendmsg(sc, , sizeof(ai));
 
 	sc->sc_vio_state |= VIO_SND_ATTR_INFO;
@@ -1023,42 +1027,98 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 	switch (xs->cmd->opcode) {
 
 		case SCSI_READ_6_COMMAND:
+			DPRINTF(("SCSI_READ_6_COMMAND\n"));
+			break;
+			
 		case READ_10:
+			DPRINTF(("SCSI_READ_10\n"));
+			break;
+			
 		case READ_12:
+			DPRINTF(("SCSI_READ_12\n"));
+			break;
+			
 		case READ_16:
+			DPRINTF(("SCSI_READ_16\n"));
+			break;
+			
 		case SCSI_WRITE_6_COMMAND:
+			DPRINTF(("SCSI_WRITE_6\n"));
+			break;
+			
 		case WRITE_10:
+			DPRINTF(("SCSI_WRITE_10\n"));
+			break;
+			
 		case WRITE_12:
+			DPRINTF(("SCSI_WRITE_12\n"));
+			break;
+			
 		case WRITE_16:
+			DPRINTF(("SCSI_WRITE_16\n"));
+			break;
+			
 		case SCSI_SYNCHRONIZE_CACHE_10:
+			DPRINTF(("SCSI_SYNCHRONIZE_CACHE_10WRITE_16\n"));
 			break;
 
 		case INQUIRY:
+			DPRINTF(("INQUIRY\n"));
 			vdsk_scsi_inq(sc, xs);
 			return;
 
 		case READ_CAPACITY_10:
+			DPRINTF(("READ_CAPACITY_10\n"));
 			vdsk_scsi_capacity(sc, xs);
 			return;
 
 		case READ_CAPACITY_16:
+			DPRINTF(("READ_CAPACITY_16\n"));
 			vdsk_scsi_capacity16(sc, xs);
 			return;
 
 		case SCSI_REPORT_LUNS:
+			DPRINTF(("REPORT_LUNS\n"));
 			vdsk_scsi_report_luns(sc, xs);
 			return;
 
 		case SCSI_TEST_UNIT_READY:
+			DPRINTF(("TEST_UNIT_READY\n"));
+			vdsk_scsi_done(xs, XS_NOERROR);
+			return;
+			
 		case START_STOP:
+			DPRINTF(("START_STOP\n"));
+			vdsk_scsi_done(xs, XS_NOERROR);
+			return;
+			
 		case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
+			DPRINTF(("PREVENT_ALLOW_MEDIUM_REMOVAL\n"));
+			vdsk_scsi_done(xs, XS_NOERROR);
+			return;
+			
 		case SCSI_MODE_SENSE_6:
+			printf("SCSI_MODE_SENSE_6 (not implemented)\n");
+			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
+			return;
+
+		case SCSI_MODE_SELECT_6:
+			printf("MODE_SELECT_6 (not implemented)\n");
+			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
+			return;
+
 		case SCSI_MAINTENANCE_IN:
+			printf("MAINTENANCE_IN\n");
 			vdsk_scsi_done(xs, XS_NOERROR);
 			return;
 
 		case SCSI_MODE_SENSE_10:
+			printf("SCSI_MODE_SENSE_10 (not implemented)\n");
+			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
+			return;
+			
 		case READ_TOC:
+			printf("READ_TOC (not implemented)\n");
 			vdsk_scsi_done(xs, XS_DRIVER_STUFFUP);
 			return;
 
@@ -1113,6 +1173,7 @@ vdsk_submit_cmd(struct vdsk_softc *sc, s
 		case READ_10:
 		case READ_12:
 		case READ_16:
+			DPRINTF(("VD_OP_BREAD\n"));
 			operation = VD_OP_BREAD;
 			break;
 
@@ -1120,10 +1181,12 @@ vdsk_submit_cmd(struct vdsk_softc *sc, s
 		case WRITE_10:
 		case WRITE_12:
 		case WRITE_16:
+			DPRINTF(("VD_OP_BWRITE\n"));
 			operation = VD_OP_BWRITE;
 			break;
 
 		case SCSI_SYNCHRONIZE_CACHE_10:
+			DPRINTF(("VD_OP_FLUSH\n"));
 			operation = VD_OP_FLUSH;
 			break;
 
@@ -1157,7 +1220,7 @@ vdsk_submit_cmd(struct vdsk_softc *sc, s
 	len = xs->datalen;
 	va = (vaddr_t)xs->data;
 	while (len > 0) {
-	  DPRINTF(("len = %u\n", len));
+		DPRINTF(("len = %u\n", len));
 		KASSERT(ncookies < MAXPHYS / PAGE_SIZE);
 		pa = 0;
 		pmap_extract(pmap_kernel(), va, );



CVS commit: src/sys/arch/sparc64/dev

2024-06-20 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Jun 20 17:49:46 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: add some DPRINTF() to vdsk


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev

2024-06-19 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jun 19 20:04:20 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: revert two new functions introduced in rev. 1.13 - not necessary yet


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.15 src/sys/arch/sparc64/dev/vdsk.c:1.16
--- src/sys/arch/sparc64/dev/vdsk.c:1.15	Wed Jun 19 20:00:10 2024
+++ src/sys/arch/sparc64/dev/vdsk.c	Wed Jun 19 20:04:20 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.15 2024/06/19 20:00:10 palle Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.16 2024/06/19 20:04:20 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -219,8 +219,6 @@ void	vdsk_scsi_inquiry(struct vdsk_softc
 void	vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *);
-void	vdsk_scsi_read_discinfo(struct vdsk_softc *sc, struct scsipi_xfer *);
-void	vdsk_scsi_read_trackinfo(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_done(struct scsipi_xfer *, int);
 
 int
@@ -1051,14 +1049,6 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 			vdsk_scsi_report_luns(sc, xs);
 			return;
 
-		case READ_DISCINFO:
-			vdsk_scsi_read_discinfo(sc, xs);
-			return;
-
-		case READ_TRACKINFO:
-			vdsk_scsi_read_trackinfo(sc, xs);
-			return;
-
 		case SCSI_TEST_UNIT_READY:
 		case START_STOP:
 		case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
@@ -1350,32 +1340,6 @@ vdsk_scsi_report_luns(struct vdsk_softc 
 }
 
 void
-vdsk_scsi_read_discinfo(struct vdsk_softc *sc, struct scsipi_xfer *xs)
-{
-	DPRINTF(("%s()\n", __FUNCTION__));
-
-	struct scsipi_read_discinfo_data read_discinfo_data;
-	bzero(_discinfo_data, sizeof(read_discinfo_data));
-
-	bcopy(_discinfo_data, xs->data, MIN(sizeof(read_discinfo_data), xs->datalen));
-
-	vdsk_scsi_done(xs, XS_NOERROR);
-}
-
-void
-vdsk_scsi_read_trackinfo(struct vdsk_softc *sc, struct scsipi_xfer *xs)
-{
-	DPRINTF(("%s()\n", __FUNCTION__));
-
-	struct scsipi_read_trackinfo_data read_trackinfo_data;
-	bzero(_trackinfo_data, sizeof(read_trackinfo_data));
-
-	bcopy(_trackinfo_data, xs->data, MIN(sizeof(read_trackinfo_data), xs->datalen));
-
-	vdsk_scsi_done(xs, XS_NOERROR);
-}
-
-void
 vdsk_scsi_done(struct scsipi_xfer *xs, int error)
 {
 	xs->error = error;



CVS commit: src/sys/arch/sparc64/dev

2024-06-19 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jun 19 20:04:20 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: revert two new functions introduced in rev. 1.13 - not necessary yet


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev

2024-06-19 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jun 19 20:00:10 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: fix incorrect string length (product name Virtual CDROM)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev

2024-06-19 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jun 19 20:00:10 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: fix incorrect string length (product name Virtual CDROM)


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.14 src/sys/arch/sparc64/dev/vdsk.c:1.15
--- src/sys/arch/sparc64/dev/vdsk.c:1.14	Wed Jun 12 19:12:44 2024
+++ src/sys/arch/sparc64/dev/vdsk.c	Wed Jun 19 20:00:10 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.14 2024/06/12 19:12:44 riastradh Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.15 2024/06/19 20:00:10 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -1277,7 +1277,7 @@ vdsk_scsi_inquiry(struct vdsk_softc *sc,
 		case VD_MEDIA_TYPE_DVD:
 			inq.device = T_CDROM;
 			inq.dev_qual2 = SID_REMOVABLE;
-			bcopy("Virtual CDROM", inq.product, sizeof(inq.product));
+			bcopy("Virtual CDROM   ", inq.product, sizeof(inq.product));
 			break;
 		case VD_MEDIA_TYPE_FIXED:
 			inq.device = T_DIRECT;



CVS commit: src/sys/arch/sparc64/dev

2024-06-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jun 10 19:54:24 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: add incomplete implementation of the CD-specific READ_DISCINFO and 
READ_TRACKINFO - probably needs some more work though...


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.12 src/sys/arch/sparc64/dev/vdsk.c:1.13
--- src/sys/arch/sparc64/dev/vdsk.c:1.12	Sun Jun  9 19:13:54 2024
+++ src/sys/arch/sparc64/dev/vdsk.c	Mon Jun 10 19:54:24 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.12 2024/06/09 19:13:54 palle Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.13 2024/06/10 19:54:24 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -219,6 +219,8 @@ void	vdsk_scsi_inquiry(struct vdsk_softc
 void	vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *);
+void	vdsk_scsi_read_discinfo(struct vdsk_softc *sc, struct scsipi_xfer *);
+void	vdsk_scsi_read_trackinfo(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_done(struct scsipi_xfer *, int);
 
 int
@@ -1049,6 +1051,14 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 			vdsk_scsi_report_luns(sc, xs);
 			return;
 			
+		case READ_DISCINFO:
+			vdsk_scsi_read_discinfo(sc, xs);
+			return;
+
+		case READ_TRACKINFO:
+			vdsk_scsi_read_trackinfo(sc, xs);
+			return;
+			
 		case SCSI_TEST_UNIT_READY:
 		case START_STOP:
 		case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
@@ -1340,6 +1350,32 @@ vdsk_scsi_report_luns(struct vdsk_softc 
 }
 
 void
+vdsk_scsi_read_discinfo(struct vdsk_softc *sc, struct scsipi_xfer *xs)
+{
+	DPRINTF(("%s()\n", __FUNCTION__));
+
+	struct scsipi_read_discinfo_data read_discinfo_data;
+	bzero(_discinfo_data, sizeof(read_discinfo_data));
+
+	bcopy(_discinfo_data, xs->data, MIN(sizeof(read_discinfo_data), xs->datalen));
+	
+	vdsk_scsi_done(xs, XS_NOERROR);
+}
+
+void
+vdsk_scsi_read_trackinfo(struct vdsk_softc *sc, struct scsipi_xfer *xs)
+{
+	DPRINTF(("%s()\n", __FUNCTION__));
+
+	struct scsipi_read_trackinfo_data read_trackinfo_data;
+	bzero(_trackinfo_data, sizeof(read_trackinfo_data));
+
+	bcopy(_trackinfo_data, xs->data, MIN(sizeof(read_trackinfo_data), xs->datalen));
+	
+	vdsk_scsi_done(xs, XS_NOERROR);
+}
+
+void
 vdsk_scsi_done(struct scsipi_xfer *xs, int error)
 {
 	xs->error = error;



CVS commit: src/sys/arch/sparc64/dev

2024-06-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jun 10 19:54:24 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: add incomplete implementation of the CD-specific READ_DISCINFO and 
READ_TRACKINFO - probably needs some more work though...


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev

2024-06-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jun  9 19:13:54 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: fix vdsk so an iso image exported by the ldom virtual disk service is 
correctly detected as a cd device + some whitespace fixes


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev

2024-06-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jun  9 19:13:54 UTC 2024

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: fix vdsk so an iso image exported by the ldom virtual disk service is 
correctly detected as a cd device + some whitespace fixes


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.11 src/sys/arch/sparc64/dev/vdsk.c:1.12
--- src/sys/arch/sparc64/dev/vdsk.c:1.11	Tue Dec 12 21:34:34 2023
+++ src/sys/arch/sparc64/dev/vdsk.c	Sun Jun  9 19:13:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.11 2023/12/12 21:34:34 andvar Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.12 2024/06/09 19:13:54 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -788,7 +788,6 @@ vdsk_rx_vio_dring_data(struct vdsk_softc
 void
 vdsk_ldc_reset(struct ldc_conn *lc)
 {
-
 	struct vdsk_softc *sc = lc->lc_sc;
 
 	sc->sc_vio_state = 0;
@@ -797,7 +796,6 @@ vdsk_ldc_reset(struct ldc_conn *lc)
 void
 vdsk_ldc_start(struct ldc_conn *lc)
 {
-
 	struct vdsk_softc *sc = lc->lc_sc;
 
 	vdsk_send_ver_info(sc, VDSK_MAJOR, VDSK_MINOR);
@@ -806,7 +804,6 @@ vdsk_ldc_start(struct ldc_conn *lc)
 void
 vdsk_sendmsg(struct vdsk_softc *sc, void *msg, size_t len)
 {
-
 	struct ldc_conn *lc = >sc_lc;
 	int err;
 
@@ -818,7 +815,6 @@ vdsk_sendmsg(struct vdsk_softc *sc, void
 void
 vdsk_send_ver_info(struct vdsk_softc *sc, uint16_t major, uint16_t minor)
 {
-
 	struct vio_ver_info vi;
 
 	/* Allocate new session ID. */
@@ -1255,14 +1251,12 @@ vdsk_complete_cmd(struct vdsk_softc *sc,
 void
 vdsk_scsi_inq(struct vdsk_softc *sc, struct scsipi_xfer *xs)
 {
-
 	vdsk_scsi_inquiry(sc, xs);
 }
 
 void
 vdsk_scsi_inquiry(struct vdsk_softc *sc, struct scsipi_xfer *xs)
 {
-
 	struct scsipi_inquiry_data inq;
 	char buf[5];
 
@@ -1272,20 +1266,21 @@ vdsk_scsi_inquiry(struct vdsk_softc *sc,
 		case VD_MEDIA_TYPE_CD:
 		case VD_MEDIA_TYPE_DVD:
 			inq.device = T_CDROM;
+			inq.dev_qual2 = SID_REMOVABLE;
+			bcopy("Virtual CDROM", inq.product, sizeof(inq.product));
 			break;
-
 		case VD_MEDIA_TYPE_FIXED:
-		default:
 			inq.device = T_DIRECT;
+			bcopy("Virtual Disk", inq.product, sizeof(inq.product));
 			break;
+		default:
+			panic("Unhandled media type %d\n", sc->sc_vd_mtype);
 	}
-
 	inq.version = 0x05; /* SPC-3 */
 	inq.response_format = 2;
 	inq.additional_length = 32;
 	inq.flags3 |= SID_CmdQue;
 	bcopy("SUN ", inq.vendor, sizeof(inq.vendor));
-	bcopy("Virtual Disk", inq.product, sizeof(inq.product));
 	snprintf(buf, sizeof(buf), "%u.%u ", sc->sc_major, sc->sc_minor);
 	bcopy(buf, inq.revision, sizeof(inq.revision));
 
@@ -1297,7 +1292,6 @@ vdsk_scsi_inquiry(struct vdsk_softc *sc,
 void
 vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *xs)
 {
-
 	struct scsipi_read_capacity_10_data rcd;
 	uint64_t capacity;
 
@@ -1321,7 +1315,6 @@ vdsk_scsi_capacity(struct vdsk_softc *sc
 void
 vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *xs)
 {
-
 	struct scsipi_read_capacity_16_data rcd;
 	uint64_t capacity;
 
@@ -1349,7 +1342,6 @@ vdsk_scsi_report_luns(struct vdsk_softc 
 void
 vdsk_scsi_done(struct scsipi_xfer *xs, int error)
 {
-
 	xs->error = error;
 
 	scsipi_done(xs);



CVS commit: src/sys/arch/sparc64/sparc64

2024-02-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 17 19:36:07 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
Ensure that the size of the stack is properly specified (2*USPACE) so it 
matches the allocation of stack pages done in pmap_bootstrap(). If this is not 
properly in sync, then the stack pointer may end up in the redzone right before 
the stack causing mmu faults. This issue has been observed on a T2000 (sun4v) 
system while probing the devices (pci/ebus/com) during bootstrap


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2024-02-17 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 17 19:36:07 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
Ensure that the size of the stack is properly specified (2*USPACE) so it 
matches the allocation of stack pages done in pmap_bootstrap(). If this is not 
properly in sync, then the stack pointer may end up in the redzone right before 
the stack causing mmu faults. This issue has been observed on a T2000 (sun4v) 
system while probing the devices (pci/ebus/com) during bootstrap


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.433 src/sys/arch/sparc64/sparc64/locore.s:1.434
--- src/sys/arch/sparc64/sparc64/locore.s:1.433	Wed Mar  1 08:18:39 2023
+++ src/sys/arch/sparc64/sparc64/locore.s	Sat Feb 17 19:36:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.433 2023/03/01 08:18:39 riastradh Exp $	*/
+/*	$NetBSD: locore.s,v 1.434 2024/02/17 19:36:07 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -5471,7 +5471,7 @@ ENTRY_NOPROFILE(cpu_initialize)	/* for c
 	!! and already accessible here)
 	flushw
 	LDPTR	[%l7 + CI_CPCB], %l0		! load PCB/uarea pointer
-	set	USPACE - TF_SIZE - CC64FSZ, %l1
+	set	2*USPACE - TF_SIZE - CC64FSZ, %l1
  	add	%l1, %l0, %l0
 #ifdef _LP64
 	andn	%l0, 0x0f, %l0			! Needs to be 16-byte aligned



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan  8 19:33:49 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: trap.c

Log Message:
sun4v: only DFA (Data fault address) and DFA (Datafault context) are valid when 
a mem_address_not_aligned fault is triggered, so ajust debug printout to this


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/sparc64/sparc64/trap.c

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/trap.c
diff -u src/sys/arch/sparc64/sparc64/trap.c:1.195 src/sys/arch/sparc64/sparc64/trap.c:1.196
--- src/sys/arch/sparc64/sparc64/trap.c:1.195	Thu Oct  5 19:41:06 2023
+++ src/sys/arch/sparc64/sparc64/trap.c	Mon Jan  8 19:33:49 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.195 2023/10/05 19:41:06 ad Exp $ */
+/*	$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.195 2023/10/05 19:41:06 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.196 2024/01/08 19:33:49 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -747,20 +747,8 @@ dopanic:
 		  
 			printf("Alignment error: pid=%d.%d comm=%s pc=%lx\n",
 			   l->l_proc->p_pid, l->l_lid, l->l_proc->p_comm, pc);
-			paddr_t mmufsa_ift_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ift);
-			paddr_t mmufsa_ifa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifa);
-			paddr_t mmufsa_ifc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, ifc);
-			paddr_t mmufsa_dft_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dft);
 			paddr_t mmufsa_dfa_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfa);
 			paddr_t mmufsa_dfc_addr = cpus->ci_mmufsa + offsetof(struct mmufsa, dfc);
-			int64_t ift = ldxa(mmufsa_ift_addr, ASI_PHYS_CACHED);
-			printf("ift = %016lx\n", ift);
-			int64_t ifa = ldxa(mmufsa_ifa_addr, ASI_PHYS_CACHED);
-			printf("ifa = %016lx\n", ifa);
-			int64_t ifc = ldxa(mmufsa_ifc_addr, ASI_PHYS_CACHED);
-			printf("ifc = %016lx\n", ifc);
-			int64_t dft = ldxa(mmufsa_dft_addr, ASI_PHYS_CACHED);
-			printf("dft = %016lx\n", dft);
 			int64_t dfa = ldxa(mmufsa_dfa_addr, ASI_PHYS_CACHED);
 			printf("dfa = %016lx\n", dfa);
 			int64_t dfc = ldxa(mmufsa_dfc_addr, ASI_PHYS_CACHED);



CVS commit: src/sys/arch/sparc64/sparc64

2024-01-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan  8 19:33:49 UTC 2024

Modified Files:
src/sys/arch/sparc64/sparc64: trap.c

Log Message:
sun4v: only DFA (Data fault address) and DFA (Datafault context) are valid when 
a mem_address_not_aligned fault is triggered, so ajust debug printout to this


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/sparc64/sparc64/trap.c

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



CVS commit: src/tools/compat

2023-09-02 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Sep  2 18:45:48 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 10 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-09-02 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Sep  2 18:45:48 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 10 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.28 src/tools/compat/README:1.29
--- src/tools/compat/README:1.28	Thu Aug 24 19:30:48 2023
+++ src/tools/compat/README	Sat Sep  2 18:45:48 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.28 2023/08/24 19:30:48 palle Exp $
+$NetBSD: README,v 1.29 2023/09/02 18:45:48 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -117,7 +117,7 @@ Solaris 10:
 * Solaris 10 1/13 (u11)
  * POSIX.1-2001, SUSv3 (see standards(7))
  * Using gcc-5 from opencsw.org
- * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin:/usr/ccs/bin
  * Set HOST_CC to /opt/csw/bin/gcc
  * Set HOST_SH to /usr/bin/bash
 



CVS commit: src/tools/compat

2023-08-24 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Aug 24 19:30:48 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.27 src/tools/compat/README:1.28
--- src/tools/compat/README:1.27	Wed Aug 23 19:09:53 2023
+++ src/tools/compat/README	Thu Aug 24 19:30:48 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.27 2023/08/23 19:09:53 palle Exp $
+$NetBSD: README,v 1.28 2023/08/24 19:30:48 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -126,9 +126,9 @@ Solaris 11:
 
 * Solaris 11.3
  * POSIX.1-2001, SUSv3 (see standards(7))
- * Using gcc-12 from pkgsrc.org (installed in GCC12INSTALLDIR)
+ * Using gcc-12 from pkgsrc.org (installed in $GCC12INSTALLDIR)
  * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin:$GCC12INSTALLDIR/bin
- * Set HOST_CC to /usr/bin/gcc
+ * Set HOST_CC to $GCC12INSTALLDIR/bin/gcc
  * Set HOST_SH to /usr/bin/bash
 
 * Solaris 11.4 (CBE)



CVS commit: src/tools/compat

2023-08-24 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Aug 24 19:30:48 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-08-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Aug 23 19:09:53 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.26 src/tools/compat/README:1.27
--- src/tools/compat/README:1.26	Tue Aug 15 19:13:12 2023
+++ src/tools/compat/README	Wed Aug 23 19:09:53 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.26 2023/08/15 19:13:12 palle Exp $
+$NetBSD: README,v 1.27 2023/08/23 19:09:53 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -126,8 +126,8 @@ Solaris 11:
 
 * Solaris 11.3
  * POSIX.1-2001, SUSv3 (see standards(7))
- * Using gcc-??
- * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * Using gcc-12 from pkgsrc.org (installed in GCC12INSTALLDIR)
+ * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin:$GCC12INSTALLDIR/bin
  * Set HOST_CC to /usr/bin/gcc
  * Set HOST_SH to /usr/bin/bash
 



CVS commit: src/tools/compat

2023-08-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Aug 23 19:09:53 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tools/compat/README

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



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto

2023-08-21 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Aug 21 18:46:57 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto: gen

Log Message:
PR57519: Fix awk script script (escape opening curly) so building with non-gnu 
versions of awk is possible (e.g. Solaris 11.4)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssl/lib/libcrypto/gen

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/gen
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/gen:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/gen:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/gen:1.3	Thu Jun  8 21:24:00 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/gen	Mon Aug 21 18:46:57 2023
@@ -11,7 +11,7 @@ awk '
 /use OpenSSL/ {
 	next;
 }
-/^{-/ {
+/^\{-/ {
 	next;
 }
 /^-}/ {



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto

2023-08-21 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Aug 21 18:46:57 UTC 2023

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto: gen

Log Message:
PR57519: Fix awk script script (escape opening curly) so building with non-gnu 
versions of awk is possible (e.g. Solaris 11.4)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/openssl/lib/libcrypto/gen

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



CVS commit: src/tools/compat

2023-08-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Aug 15 19:13:12 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 10 and Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.25 src/tools/compat/README:1.26
--- src/tools/compat/README:1.25	Mon Aug 14 18:49:45 2023
+++ src/tools/compat/README	Tue Aug 15 19:13:12 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.25 2023/08/14 18:49:45 palle Exp $
+$NetBSD: README,v 1.26 2023/08/15 19:13:12 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -88,7 +88,7 @@ NetBSD (earlier releases)
 Solaris
 ---
 
-(updated instruction for Solaris 11 further below)
+(updated instruction for Solaris 10 and 11 further below)
 
 * Tested on Solaris/x86 8 (5.8) with gcc 2.95.2 and Solaris/sparc 8 (5.8)
   with gcc 3.2 (not yet tested with SUNWspro).
@@ -111,11 +111,25 @@ Solaris
   but /usr/ucb *MUST NOT* be before /usr/ccs/bin or before the path to
   the host C and C++ compilers.
 
+
+Solaris 10:
+
+* Solaris 10 1/13 (u11)
+ * POSIX.1-2001, SUSv3 (see standards(7))
+ * Using gcc-5 from opencsw.org
+ * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * Set HOST_CC to /opt/csw/bin/gcc
+ * Set HOST_SH to /usr/bin/bash
+
+
 Solaris 11:
 
 * Solaris 11.3
+ * POSIX.1-2001, SUSv3 (see standards(7))
+ * Using gcc-??
  * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
  * Set HOST_CC to /usr/bin/gcc
+ * Set HOST_SH to /usr/bin/bash
 
 * Solaris 11.4 (CBE)
  * POSIX.1-2008, SUSv4 (see standards(7))



CVS commit: src/tools/compat

2023-08-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Aug 15 19:13:12 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 10 and Solaris 11.3 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-08-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Aug 14 18:49:45 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.4 (CBE) hosts


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.24 src/tools/compat/README:1.25
--- src/tools/compat/README:1.24	Sun Jul 30 19:03:50 2023
+++ src/tools/compat/README	Mon Aug 14 18:49:45 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.24 2023/07/30 19:03:50 palle Exp $
+$NetBSD: README,v 1.25 2023/08/14 18:49:45 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -122,6 +122,7 @@ Solaris 11:
  * Using gcc-11
  * Set PATH to /usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
  * Set HOST_CC to /usr/bin/gcc
+ * Set HOST_SH to /usr/bin/bash
 
 * Solaris 11.4 (SRU57)
  * POSIX.1-2008, SUSv4 (see standards(7))



CVS commit: src/tools/compat

2023-08-14 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Aug 14 18:49:45 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.4 (CBE) hosts


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-07-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jul 30 19:03:50 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instruction for Solaris 11.4 (CBE) hosts


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.23 src/tools/compat/README:1.24
--- src/tools/compat/README:1.23	Sun Jul 16 18:09:54 2023
+++ src/tools/compat/README	Sun Jul 30 19:03:50 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.23 2023/07/16 18:09:54 palle Exp $
+$NetBSD: README,v 1.24 2023/07/30 19:03:50 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -118,7 +118,10 @@ Solaris 11:
  * Set HOST_CC to /usr/bin/gcc
 
 * Solaris 11.4 (CBE)
- * TBD
+ * POSIX.1-2008, SUSv4 (see standards(7))
+ * Using gcc-11
+ * Set PATH to /usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * Set HOST_CC to /usr/bin/gcc
 
 * Solaris 11.4 (SRU57)
  * POSIX.1-2008, SUSv4 (see standards(7))



CVS commit: src/tools/compat

2023-07-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jul 30 19:03:50 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instruction for Solaris 11.4 (CBE) hosts


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-07-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jul 16 18:09:54 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.4 hosts: specify HOST_SH and note 
standards


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.22 src/tools/compat/README:1.23
--- src/tools/compat/README:1.22	Wed Jul  5 16:26:29 2023
+++ src/tools/compat/README	Sun Jul 16 18:09:54 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.22 2023/07/05 16:26:29 palle Exp $
+$NetBSD: README,v 1.23 2023/07/16 18:09:54 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -121,7 +121,8 @@ Solaris 11:
  * TBD
 
 * Solaris 11.4 (SRU57)
+ * POSIX.1-2008, SUSv4 (see standards(7))
  * Using gcc-12
  * Set PATH to /usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
  * Set HOST_CC to /usr/bin/gcc
-
+ * Set HOST_SH to /usr/bin/bash



CVS commit: src/tools/compat

2023-07-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jul 16 18:09:54 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instructions for Solaris 11.4 hosts: specify HOST_SH and note 
standards


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-07-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  8 19:10:00 UTC 2023

Modified Files:
src/tools/compat: compat_defs.h

Log Message:
Add support for missing NAME_MAX when building on Solaris hosts


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/tools/compat/compat_defs.h

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

Modified files:

Index: src/tools/compat/compat_defs.h
diff -u src/tools/compat/compat_defs.h:1.120 src/tools/compat/compat_defs.h:1.121
--- src/tools/compat/compat_defs.h:1.120	Sun May 30 10:39:41 2021
+++ src/tools/compat/compat_defs.h	Sat Jul  8 19:10:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_defs.h,v 1.120 2021/05/30 10:39:41 cjep Exp $	*/
+/*	$NetBSD: compat_defs.h,v 1.121 2023/07/08 19:10:00 palle Exp $	*/
 
 #ifndef	__NETBSD_COMPAT_DEFS_H__
 #define	__NETBSD_COMPAT_DEFS_H__
@@ -31,6 +31,17 @@
 #endif	/* __linux__ && HAVE_FEATURES_H */
 
 /*
+ * Solaris:
+ * No NAME_MAX define is available (as documented in the Solaris
+ * limits.h file), so use the XOPEN defined constant.
+ */
+
+#if defined(__sun__)
+#define NAME_MAX _XOPEN_NAME_MAX
+#endif
+
+
+/*
  * Type substitutes.
  * These are controlled via HAVE_TYPE protections and some of them are needed
  * in other header files (in the build tree not in the host). This is because



CVS commit: src/tools/compat

2023-07-08 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  8 19:10:00 UTC 2023

Modified Files:
src/tools/compat: compat_defs.h

Log Message:
Add support for missing NAME_MAX when building on Solaris hosts


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/tools/compat/compat_defs.h

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



CVS commit: src/tools/compat

2023-07-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jul  5 16:26:29 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instruction for Solaris 11.4 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tools/compat/README

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



CVS commit: src/tools/compat

2023-07-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Wed Jul  5 16:26:29 UTC 2023

Modified Files:
src/tools/compat: README

Log Message:
Update build instruction for Solaris 11.4 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.21 src/tools/compat/README:1.22
--- src/tools/compat/README:1.21	Sun Jul 11 06:15:42 2021
+++ src/tools/compat/README	Wed Jul  5 16:26:29 2023
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.21 2021/07/11 06:15:42 cjep Exp $
+$NetBSD: README,v 1.22 2023/07/05 16:26:29 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -117,9 +117,11 @@ Solaris 11:
  * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
  * Set HOST_CC to /usr/bin/gcc
 
-* Solaris 11.4
- * Install gcc-5 since the default installed gcc-7 has issues when compiling 
-   toolchain version of groff (hypot())
+* Solaris 11.4 (CBE)
+ * TBD
+
+* Solaris 11.4 (SRU57)
+ * Using gcc-12
  * Set PATH to /usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
- * set HOST_CC to /usr/gcc/5/bin/gcc
- * set HOST_CXX to /usr/gcc/5/bin/g++
+ * Set HOST_CC to /usr/bin/gcc
+



CVS commit: src/sys/arch/sparc64/dev

2022-05-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon May 16 17:13:28 UTC 2022

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v/vdsk: add handling of SCSI_REPORT_LUNS


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.9 src/sys/arch/sparc64/dev/vdsk.c:1.10
--- src/sys/arch/sparc64/dev/vdsk.c:1.9	Sat Dec  4 13:23:03 2021
+++ src/sys/arch/sparc64/dev/vdsk.c	Mon May 16 17:13:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.9 2021/12/04 13:23:03 andvar Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.10 2022/05/16 17:13:28 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -218,6 +218,7 @@ void	vdsk_scsi_inq(struct vdsk_softc *sc
 void	vdsk_scsi_inquiry(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_capacity16(struct vdsk_softc *sc, struct scsipi_xfer *);
+void	vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *);
 void	vdsk_scsi_done(struct scsipi_xfer *, int);
 
 int
@@ -1048,6 +1049,10 @@ vdsk_scsi_cmd(struct vdsk_softc *sc, str
 			vdsk_scsi_capacity16(sc, xs);
 			return;
 
+		case SCSI_REPORT_LUNS:
+			vdsk_scsi_report_luns(sc, xs);
+			return;
+			
 		case SCSI_TEST_UNIT_READY:
 		case START_STOP:
 		case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL:
@@ -1333,6 +1338,12 @@ vdsk_scsi_capacity16(struct vdsk_softc *
 }
 
 void
+vdsk_scsi_report_luns(struct vdsk_softc *sc, struct scsipi_xfer *xs)
+{
+	vdsk_scsi_done(xs, XS_NOERROR);
+}
+
+void
 vdsk_scsi_done(struct scsipi_xfer *xs, int error)
 {
 



CVS commit: src/sys/arch/sparc64/dev

2022-05-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon May 16 17:13:28 UTC 2022

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v/vdsk: add handling of SCSI_REPORT_LUNS


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/vdsk.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/sparc/include

2022-02-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Feb 15 20:35:37 UTC 2022

Modified Files:
src/sys/arch/sparc/include: frame.h

Log Message:
Document the calculation of CC64FSZ


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/include/frame.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/sparc/include/frame.h
diff -u src/sys/arch/sparc/include/frame.h:1.10 src/sys/arch/sparc/include/frame.h:1.11
--- src/sys/arch/sparc/include/frame.h:1.10	Wed Apr 11 19:37:58 2018
+++ src/sys/arch/sparc/include/frame.h	Tue Feb 15 20:35:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.10 2018/04/11 19:37:58 palle Exp $ */
+/*	$NetBSD: frame.h,v 1.11 2022/02/15 20:35:37 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -125,7 +125,8 @@ struct frame64 {
 
 /*
  * CC64FSZ (C Compiler 64-bit Frame SiZe) is the size of a stack frame used
- * by the compiler in 64-bit mode.  It is (16)*8; space for 8 ins, 8 outs.
+ * by the compiler in 64-bit mode (see struct frame64 above).
+ * It is 8*8 + 6*8 + 8 + 8 + 6*8 + 0*8 = 176 bytes.
  */
 #define CC64FSZ		176
 



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

2022-02-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Feb 15 20:35:37 UTC 2022

Modified Files:
src/sys/arch/sparc/include: frame.h

Log Message:
Document the calculation of CC64FSZ


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/include/frame.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/sparc64/doc

2022-01-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jan 15 18:45:13 UTC 2022

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with T2000 device configuration state


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.46 src/sys/arch/sparc64/doc/TODO:1.47
--- src/sys/arch/sparc64/doc/TODO:1.46	Wed Jan  5 16:01:54 2022
+++ src/sys/arch/sparc64/doc/TODO	Sat Jan 15 18:45:13 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.46 2022/01/05 16:01:54 andvar Exp $ */
+/* $NetBSD: TODO,v 1.47 2022/01/15 18:45:13 palle Exp $ */
 
 Things to be done:
 
@@ -21,6 +21,7 @@ sun4v:
 		 the 'sh MAKEDEV all' command hangs.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
+	   - device pci/ebus/com failes to enable interrupts (hv_intr_settarget() fails returning 6)
 	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU33):
 	   - same status as T5 ldom
 - 64-bit kernel support



CVS commit: src/sys/arch/sparc64/doc

2022-01-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jan 15 18:45:13 UTC 2022

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with T2000 device configuration state


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64

2022-01-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan 10 20:14:54 UTC 2022

Modified Files:
src/sys/arch/sparc64/include: sparc64.h
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
sun4v: add function to retrieve hypervisor api version


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc64/include/sparc64.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc64/sparc64/ofw_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/sparc64/include/sparc64.h
diff -u src/sys/arch/sparc64/include/sparc64.h:1.14 src/sys/arch/sparc64/include/sparc64.h:1.15
--- src/sys/arch/sparc64/include/sparc64.h:1.14	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/include/sparc64.h	Mon Jan 10 20:14:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sparc64.h,v 1.14 2021/07/03 19:18:55 palle Exp $	*/
+/*	$NetBSD: sparc64.h,v 1.15 2022/01/10 20:14:54 palle Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -60,6 +60,7 @@ bool prom_has_stop_other(void);
 void prom_startcpu(u_int, void *, u_long);
 int prom_startcpu_by_cpuid(u_int, void *, u_long arg);
 uint64_t prom_set_sun4v_api_version(uint64_t, uint64_t, uint64_t, uint64_t *);
+uint64_t prom_get_sun4v_api_version(uint64_t, uint64_t *, uint64_t *);
 void prom_sun4v_soft_state_supported(void);
 
 #endif	/* _MACHINE_SPARC64_H_ */

Index: src/sys/arch/sparc64/sparc64/ofw_machdep.c
diff -u src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.47 src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.48
--- src/sys/arch/sparc64/sparc64/ofw_machdep.c:1.47	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/sparc64/ofw_machdep.c	Mon Jan 10 20:14:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_machdep.c,v 1.47 2021/07/03 19:18:55 palle Exp $	*/
+/*	$NetBSD: ofw_machdep.c,v 1.48 2022/01/10 20:14:54 palle Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.47 2021/07/03 19:18:55 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_machdep.c,v 1.48 2022/01/10 20:14:54 palle Exp $");
 
 #include 
 #include 
@@ -676,7 +676,35 @@ prom_set_sun4v_api_version(uint64_t api_
 	*supported_minor = args.supported_minor;
 	return (uint64_t)args.status;
 }
+#if 1
+uint64_t
+prom_get_sun4v_api_version(uint64_t api_group, uint64_t* major, uint64_t* minor)
+{
+	static struct {
+		cell_t  name;
+		cell_t  nargs;
+		cell_t  nreturns;
+		cell_t  api_group;
+		cell_t	status;
+		cell_t  major;
+		cell_t  minor;
+	} args;
 
+	args.name = ADR2CELL("SUNW,get-sun4v-api-version");
+	args.nargs = 1;
+	args.nreturns = 3;
+	args.api_group = api_group;
+	args.status = -1;
+	args.major = -1;
+	args.minor = -1;
+
+	openfirmware();
+
+	*major = args.major;
+	*minor = args.minor;
+	return (uint64_t)args.status;
+}
+#endif
 void
 prom_sun4v_soft_state_supported(void)
 {



CVS commit: src/sys/arch/sparc64

2022-01-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jan 10 20:14:54 UTC 2022

Modified Files:
src/sys/arch/sparc64/include: sparc64.h
src/sys/arch/sparc64/sparc64: ofw_machdep.c

Log Message:
sun4v: add function to retrieve hypervisor api version


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/sparc64/include/sparc64.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/sparc64/sparc64/ofw_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/arch/sparc64/sparc64

2022-01-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jan  9 20:30:04 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: intr.c

Log Message:
sun4v: enable sun4v_intr_xxx() function previously imported from OpenBSD. Note 
that the sun4v_intr_devino_to_sysino() function is adapted to match OpenBSD 
version 1.57 (the introduction of INTR_DEVINO is done in revision 1.58)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc64/sparc64/intr.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/sparc64/sparc64

2022-01-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jan  9 20:30:04 UTC 2022

Modified Files:
src/sys/arch/sparc64/sparc64: intr.c

Log Message:
sun4v: enable sun4v_intr_xxx() function previously imported from OpenBSD. Note 
that the sun4v_intr_devino_to_sysino() function is adapted to match OpenBSD 
version 1.57 (the introduction of INTR_DEVINO is done in revision 1.58)


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sparc64/sparc64/intr.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/sparc64/sparc64/intr.c
diff -u src/sys/arch/sparc64/sparc64/intr.c:1.70 src/sys/arch/sparc64/sparc64/intr.c:1.71
--- src/sys/arch/sparc64/sparc64/intr.c:1.70	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/sparc64/intr.c	Sun Jan  9 20:30:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.70 2021/07/03 19:18:55 palle Exp $ */
+/*	$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.70 2021/07/03 19:18:55 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.71 2022/01/09 20:30:04 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -368,22 +368,16 @@ softint_trigger(uintptr_t machdep)
 
 uint64_t sun4v_group_interrupt_major;
 
-#if 0
-XXX notyet
-wint64_t
+int64_t
 sun4v_intr_devino_to_sysino(uint64_t devhandle, uint64_t devino, uint64_t *ino)
 {
 	if (sun4v_group_interrupt_major < 3)
 		return hv_intr_devino_to_sysino(devhandle, devino, ino);
 
-	KASSERT(INTVEC(devino) == devino);
-	*ino = devino | INTR_DEVINO;
+	*ino = devino;
 	return H_EOK;
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setcookie(uint64_t devhandle, uint64_t ino, uint64_t cookie_value)
 {
@@ -392,10 +386,7 @@ sun4v_intr_setcookie(uint64_t devhandle,
 	
 	return hv_vintr_setcookie(devhandle, ino, cookie_value);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setenabled(uint64_t devhandle, uint64_t ino, uint64_t intr_enabled)
 {
@@ -404,10 +395,7 @@ sun4v_intr_setenabled(uint64_t devhandle
 
 	return hv_vintr_setenabled(devhandle, ino, intr_enabled);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_setstate(uint64_t devhandle, uint64_t ino, uint64_t intr_state)
 {
@@ -416,10 +404,7 @@ sun4v_intr_setstate(uint64_t devhandle, 
 
 	return hv_vintr_setstate(devhandle, ino, intr_state);
 }
-#endif
 
-#if 0
-XXX notyet		
 int64_t
 sun4v_intr_settarget(uint64_t devhandle, uint64_t ino, uint64_t cpuid)
 {
@@ -428,6 +413,5 @@ sun4v_intr_settarget(uint64_t devhandle,
 
 	return hv_vintr_settarget(devhandle, ino, cpuid);
 }
-#endif
 
 #endif



CVS commit: src/sys/arch/sparc64/doc

2021-09-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Sep 23 17:51:52 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with current status when running on a T5-based system


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.44 src/sys/arch/sparc64/doc/TODO:1.45
--- src/sys/arch/sparc64/doc/TODO:1.44	Mon Jul  5 16:59:54 2021
+++ src/sys/arch/sparc64/doc/TODO	Thu Sep 23 17:51:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.44 2021/07/05 16:59:54 palle Exp $ */
+/* $NetBSD: TODO,v 1.45 2021/09/23 17:51:52 palle Exp $ */
 
 Things to be done:
 
@@ -13,15 +13,12 @@ sun4u:
 sun4v:
  - current status
  T5 ldom with 2 VCPU and 4GB  (primary ldom is Solaris 11.4 SRU30)::
-   - kernel boots from miniroot.fs via ldom fisk (vdsk)
+   - kernel boots from miniroot.fs via ldom disk (vdsk)
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
-	   - the sysinst tool starts, disk setup is working,
-	 but the process crashes when selecting network installation method.
-		 The %i,%l and %o registers are corrupted, after a call to the libcurses
-		 wrefresh() function.
-		 If the sysinst insallation source is local directory, the sets are properly
-		 unpacked, but the system hangs afterwards when running the makedev script.
+	   - the sysinst tool starts, disk setup is working, network configuration is working,
+	 but after the selected (minimal) sets have been downloaded and installed
+		 the 'sh MAKEDEV all' comand hangs.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
 	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU33):



CVS commit: src/sys/arch/sparc64/doc

2021-09-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Sep 23 17:51:52 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with current status when running on a T5-based system


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/doc

2021-07-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jul  5 16:59:54 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update status on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/doc

2021-07-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Jul  5 16:59:54 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update status on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.43 src/sys/arch/sparc64/doc/TODO:1.44
--- src/sys/arch/sparc64/doc/TODO:1.43	Fri Jun 25 19:13:12 2021
+++ src/sys/arch/sparc64/doc/TODO	Mon Jul  5 16:59:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.43 2021/06/25 19:13:12 palle Exp $ */
+/* $NetBSD: TODO,v 1.44 2021/07/05 16:59:54 palle Exp $ */
 
 Things to be done:
 
@@ -12,7 +12,7 @@ sun4u:
 
 sun4v:
  - current status
- T5 ldom with 2 VCPU and 4GB:
+ T5 ldom with 2 VCPU and 4GB  (primary ldom is Solaris 11.4 SRU30)::
- kernel boots from miniroot.fs via ldom fisk (vdsk)
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
@@ -24,9 +24,8 @@ sun4v:
 		 unpacked, but the system hangs afterwards when running the makedev script.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
-	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):
-	   - during autoconfiguration of vnet devices the call to hv_vintr_setenabled()
-	 returns error code 7 (EBADTRAP?)
+	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU33):
+	   - same status as T5 ldom
 - 64-bit kernel support
 - 32-bit kernel support
 - libkvm



CVS commit: src/sys/arch/sparc64/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:39:07 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
sun4v: request hypervisor api major version 3 for the interrupt group - should 
solve issues when setting up interrupts on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.232 src/sys/arch/sparc64/sparc64/autoconf.c:1.233
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.232	Sat Jul  3 19:18:55 2021
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sat Jul  3 19:39:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $ */
+/*	$NetBSD: autoconf.c,v 1.233 2021/07/03 19:39:07 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.233 2021/07/03 19:39:07 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -189,9 +189,9 @@ void	sun4v_set_soft_state(int, const cha
 char sun4v_soft_state_booting[] __align32 = "NetBSD booting";
 char sun4v_soft_state_running[] __align32 = "NetBSD running";
 
+void	sun4v_interrupt_init(void);
 #if 0
 XXX notyet		
-void	sun4v_interrupt_init(void);
 void	sun4v_sdio_init(void);
 #endif
 #endif
@@ -378,9 +378,9 @@ die_old_boot_loader:
 	if (CPU_ISSUN4V) {
 		sun4v_soft_state_init();
 		sun4v_set_soft_state(SIS_TRANSITION, sun4v_soft_state_booting);
+		sun4v_interrupt_init();
 #if 0
 XXX notyet		
-		sun4v_interrupt_init();
 		sun4v_sdio_init();
 #endif 
 	}
@@ -570,8 +570,6 @@ sun4v_set_soft_state(int state, const ch
 		printf("soft_state_set: %d\n", err);
 }
 
-#if 0
-XXX notyet		
 void
 sun4v_interrupt_init(void)
 {
@@ -582,7 +580,6 @@ sun4v_interrupt_init(void)
 
 	sun4v_group_interrupt_major = 3;
 }
-#endif
 
 #if 0
 XXX notyet		



CVS commit: src/sys/arch/sparc64/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:39:07 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
sun4v: request hypervisor api major version 3 for the interrupt group - should 
solve issues when setting up interrupts on S7 systems


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:18:56 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: hypervisor.h sparc64.h
src/sys/arch/sparc64/sparc64: autoconf.c intr.c ofw_machdep.c

Log Message:
sun4v: add support for hypervisor soft state - from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc64/include/hypervisor.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc64/include/sparc64.h
cvs rdiff -u -r1.231 -r1.232 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc64/sparc64/ofw_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/sparc64/include/hypervisor.h
diff -u src/sys/arch/sparc64/include/hypervisor.h:1.7 src/sys/arch/sparc64/include/hypervisor.h:1.8
--- src/sys/arch/sparc64/include/hypervisor.h:1.7	Tue Apr 27 19:09:56 2021
+++ src/sys/arch/sparc64/include/hypervisor.h	Sat Jul  3 19:18:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor.h,v 1.7 2021/04/27 19:09:56 palle Exp $ */
+/*	$NetBSD: hypervisor.h,v 1.8 2021/07/03 19:18:55 palle Exp $ */
 /*	$OpenBSD: hypervisor.h,v 1.14 2011/06/26 17:23:46 kettenis Exp $	*/
 
 /*
@@ -391,4 +391,15 @@ int64_t	hv_rng_data_read(paddr_t raddr, 
 #define H_ETOOMANY	15
 #define H_ECHANNEL	16
 
+#ifndef _LOCORE
+extern uint64_t sun4v_group_interrupt_major;
+extern uint64_t sun4v_group_sdio_major;
+
+int64_t sun4v_intr_devino_to_sysino(uint64_t, uint64_t, uint64_t *);
+int64_t sun4v_intr_setcookie(uint64_t, uint64_t, uint64_t);
+int64_t sun4v_intr_setenabled(uint64_t, uint64_t, uint64_t);
+int64_t	sun4v_intr_setstate(uint64_t, uint64_t, uint64_t);
+int64_t	sun4v_intr_settarget(uint64_t, uint64_t, uint64_t);
+#endif
+
 #endif	/* _HYPERVISOR_H_ */

Index: src/sys/arch/sparc64/include/sparc64.h
diff -u src/sys/arch/sparc64/include/sparc64.h:1.13 src/sys/arch/sparc64/include/sparc64.h:1.14
--- src/sys/arch/sparc64/include/sparc64.h:1.13	Sat Sep  6 20:56:39 2014
+++ src/sys/arch/sparc64/include/sparc64.h	Sat Jul  3 19:18:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sparc64.h,v 1.13 2014/09/06 20:56:39 palle Exp $	*/
+/*	$NetBSD: sparc64.h,v 1.14 2021/07/03 19:18:55 palle Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -59,5 +59,7 @@ int  prom_stop_other(u_int);
 bool prom_has_stop_other(void);
 void prom_startcpu(u_int, void *, u_long);
 int prom_startcpu_by_cpuid(u_int, void *, u_long arg);
+uint64_t prom_set_sun4v_api_version(uint64_t, uint64_t, uint64_t, uint64_t *);
+void prom_sun4v_soft_state_supported(void);
 
 #endif	/* _MACHINE_SPARC64_H_ */

Index: src/sys/arch/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.231 src/sys/arch/sparc64/sparc64/autoconf.c:1.232
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.231	Wed May 12 23:22:33 2021
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sat Jul  3 19:18:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.231 2021/05/12 23:22:33 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.231 2021/05/12 23:22:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.232 2021/07/03 19:18:55 palle Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -181,6 +181,21 @@ struct intrmap intrmap[] = {
 	{ NULL,		0 }
 };
 
+#ifdef SUN4V
+void	sun4v_soft_state_init(void);
+void	sun4v_set_soft_state(int, const char *);
+
+#define __align32 __attribute__((__aligned__(32)))
+char sun4v_soft_state_booting[] __align32 = "NetBSD booting";
+char sun4v_soft_state_running[] __align32 = "NetBSD running";
+
+#if 0
+XXX notyet		
+void	sun4v_interrupt_init(void);
+void	sun4v_sdio_init(void);
+#endif
+#endif
+
 int console_node, console_instance;
 struct genfb_colormap_callback gfb_cb;
 static void of_set_palette(void *, int, int, int, int);
@@ -358,6 +373,18 @@ die_old_boot_loader:
 
 	get_ncpus();
 	pmap_bootstrap(KERNBASE, bi_kend->addr);
+
+#ifdef SUN4V
+	if (CPU_ISSUN4V) {
+		sun4v_soft_state_init();
+		sun4v_set_soft_state(SIS_TRANSITION, sun4v_soft_state_booting);
+#if 0
+XXX notyet		
+		sun4v_interrupt_init();
+		sun4v_sdio_init();
+#endif 
+	}
+#endif
 }
 
 /*
@@ -499,7 +526,79 @@ cpu_configure(void)
 setpstate(getpstate()|PSTATE_IE);
 
 	(void)spl0();
+
+#ifdef SUN4V
+	if (CPU_ISSUN4V)
+		sun4v_set_soft_state(SIS_NORMAL, sun4v_soft_state_running);
+#endif
+}
+
+#ifdef SUN4V
+
+#define HSVC_GROUP_INTERRUPT	0x002
+#define HSVC_GROUP_SOFT_STATE	0x003
+#define HSVC_GROUP_SDIO		0x108
+
+int sun4v_soft_state_initialized = 0;
+
+void
+sun4v_soft_state_init(void)
+{
+	uint64_t minor;
+
+	if (prom_set_sun4v_api_version(HSVC_GROUP_SOFT_STATE, 1, 0, ))
+		return;
+
+	prom_sun4v_soft_state_supported();
+	sun4v_soft_state_initialized = 1;
+}
+
+void
+sun4v_set_soft_state(int state, 

CVS commit: src/sys/arch/sparc64

2021-07-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Jul  3 19:18:56 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: hypervisor.h sparc64.h
src/sys/arch/sparc64/sparc64: autoconf.c intr.c ofw_machdep.c

Log Message:
sun4v: add support for hypervisor soft state - from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc64/include/hypervisor.h
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sparc64/include/sparc64.h
cvs rdiff -u -r1.231 -r1.232 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/sparc64/sparc64/ofw_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/arch/sparc64/doc

2021-06-25 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Jun 25 19:13:12 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with current sun4v progress


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.42 src/sys/arch/sparc64/doc/TODO:1.43
--- src/sys/arch/sparc64/doc/TODO:1.42	Sun Jun 13 17:02:14 2021
+++ src/sys/arch/sparc64/doc/TODO	Fri Jun 25 19:13:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.42 2021/06/13 17:02:14 palle Exp $ */
+/* $NetBSD: TODO,v 1.43 2021/06/25 19:13:12 palle Exp $ */
 
 Things to be done:
 
@@ -20,9 +20,8 @@ sun4v:
 	 but the process crashes when selecting network installation method.
 		 The %i,%l and %o registers are corrupted, after a call to the libcurses
 		 wrefresh() function.
-		 If the sysinst insallation source is local directory, an error in the
-		 ldsk device driver is triggered when a DATA/NACK/DRING_DATA event is received.
-		 The current implementation does not hande this exception properly.
+		 If the sysinst insallation source is local directory, the sets are properly
+		 unpacked, but the system hangs afterwards when running the makedev script.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
 	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):



CVS commit: src/sys/arch/sparc64/doc

2021-06-25 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Jun 25 19:13:12 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with current sun4v progress


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/dev

2021-06-25 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Jun 25 19:10:50 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: vdsk - restart the ldc state machine when the ldc endpoint resets the 
link or a DATA/NACK/DRING_DATA message is received. These changes make the 
driver more robust. In a ldom with Solaris 11.4 SRU30 as primary domain (T5 
host system) frequent resets and NACK messages are observed.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/vdsk.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/sparc64/dev/vdsk.c
diff -u src/sys/arch/sparc64/dev/vdsk.c:1.6 src/sys/arch/sparc64/dev/vdsk.c:1.7
--- src/sys/arch/sparc64/dev/vdsk.c:1.6	Sat Apr 24 23:36:49 2021
+++ src/sys/arch/sparc64/dev/vdsk.c	Fri Jun 25 19:10:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vdsk.c,v 1.6 2021/04/24 23:36:49 thorpej Exp $	*/
+/*	$NetBSD: vdsk.c,v 1.7 2021/06/25 19:10:50 palle Exp $	*/
 /*	$OpenBSD: vdsk.c,v 1.46 2015/01/25 21:42:13 kettenis Exp $	*/
 /*
  * Copyright (c) 2009, 2011 Mark Kettenis
@@ -492,6 +492,7 @@ vdsk_rx_intr(void *arg)
 			break;
 		case LDC_CHANNEL_RESET:
 			DPRINTF(("Rx link reset\n"));
+			ldc_send_vers(lc);
 			break;
 		}
 		lc->lc_rx_state = rx_state;
@@ -773,6 +774,8 @@ vdsk_rx_vio_dring_data(struct vdsk_softc
 
 		case VIO_SUBTYPE_NACK:
 			DPRINTF(("DATA/NACK/DRING_DATA\n"));
+			struct ldc_conn *lc = >sc_lc;
+			ldc_send_vers(lc);
 			break;
 
 		default:



CVS commit: src/sys/arch/sparc64/dev

2021-06-25 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Jun 25 19:10:50 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vdsk.c

Log Message:
sun4v: vdsk - restart the ldc state machine when the ldc endpoint resets the 
link or a DATA/NACK/DRING_DATA message is received. These changes make the 
driver more robust. In a ldom with Solaris 11.4 SRU30 as primary domain (T5 
host system) frequent resets and NACK messages are observed.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/vdsk.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/sparc64/doc

2021-06-13 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jun 13 17:02:14 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with current sun4v state


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.41 src/sys/arch/sparc64/doc/TODO:1.42
--- src/sys/arch/sparc64/doc/TODO:1.41	Sat Apr  3 17:02:31 2021
+++ src/sys/arch/sparc64/doc/TODO	Sun Jun 13 17:02:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.41 2021/04/03 17:02:31 palle Exp $ */
+/* $NetBSD: TODO,v 1.42 2021/06/13 17:02:14 palle Exp $ */
 
 Things to be done:
 
@@ -17,7 +17,12 @@ sun4v:
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
 	   - the sysinst tool starts, disk setup is working,
-	 but the process crashes when selecting network installation method (trap 0x34 ALIGN is received)
+	 but the process crashes when selecting network installation method.
+		 The %i,%l and %o registers are corrupted, after a call to the libcurses
+		 wrefresh() function.
+		 If the sysinst insallation source is local directory, an error in the
+		 ldsk device driver is triggered when a DATA/NACK/DRING_DATA event is received.
+		 The current implementation does not hande this exception properly.
 	 T2000 ldom with 8 VCPU and 4GB:
 	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
 	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):



CVS commit: src/sys/arch/sparc64/doc

2021-06-13 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Jun 13 17:02:14 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with current sun4v state


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64

2021-04-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Apr 27 19:09:56 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: hypervisor.h
src/sys/arch/sparc64/sparc64: hvcall.S

Log Message:
sun4v: add missing method to set hypervisor api version + add defintion for the 
interrupt hypervisor api group (to be used)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/include/hypervisor.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/sparc64/hvcall.S

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



CVS commit: src/sys/arch/sparc64

2021-04-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Apr 27 19:09:56 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: hypervisor.h
src/sys/arch/sparc64/sparc64: hvcall.S

Log Message:
sun4v: add missing method to set hypervisor api version + add defintion for the 
interrupt hypervisor api group (to be used)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/include/hypervisor.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/sparc64/hvcall.S

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

Modified files:

Index: src/sys/arch/sparc64/include/hypervisor.h
diff -u src/sys/arch/sparc64/include/hypervisor.h:1.6 src/sys/arch/sparc64/include/hypervisor.h:1.7
--- src/sys/arch/sparc64/include/hypervisor.h:1.6	Fri Feb 10 23:26:23 2017
+++ src/sys/arch/sparc64/include/hypervisor.h	Tue Apr 27 19:09:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor.h,v 1.6 2017/02/10 23:26:23 palle Exp $ */
+/*	$NetBSD: hypervisor.h,v 1.7 2021/04/27 19:09:56 palle Exp $ */
 /*	$OpenBSD: hypervisor.h,v 1.14 2011/06/26 17:23:46 kettenis Exp $	*/
 
 /*
@@ -36,7 +36,13 @@
 
 #ifndef _LOCORE
 int64_t	hv_api_get_version(uint64_t api_group,
-	uint64_t *major_number, uint64_t *minor_number);
+		   uint64_t *major_number,
+		   uint64_t *minor_number);
+int64_t	hv_api_set_version(uint64_t api_group,
+		   uint64_t major_number,
+		   uint64_t req_minor_number,
+		   uint64_t* actual_minor_number);
+#define HV_API_GROUP_INTERRUPT 0x002
 #endif
 /*
  * Domain services

Index: src/sys/arch/sparc64/sparc64/hvcall.S
diff -u src/sys/arch/sparc64/sparc64/hvcall.S:1.4 src/sys/arch/sparc64/sparc64/hvcall.S:1.5
--- src/sys/arch/sparc64/sparc64/hvcall.S:1.4	Sun Jun  8 17:33:24 2014
+++ src/sys/arch/sparc64/sparc64/hvcall.S	Tue Apr 27 19:09:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvcall.S,v 1.4 2014/06/08 17:33:24 palle Exp $ */
+/*	$NetBSD: hvcall.S,v 1.5 2021/04/27 19:09:56 palle Exp $ */
 /*	$OpenBSD: hvcall.S,v 1.10 2011/06/25 20:45:00 kettenis Exp $	*/
 
 /*
@@ -151,6 +151,13 @@ ENTRY(hv_api_get_version)
 	retl
 	 stx	%o2, [%o4]
 
+ENTRY(hv_api_set_version)
+	mov	%o3, %o4
+	mov	API_SET_VERSION, %o5
+	ta	ST_CORE_TRAP
+	retl
+	 stx	%o1, [%o4]
+	
 ENTRY(hv_mach_desc)
 	mov	%o1, %o2
 	ldx	[%o2], %o1



CVS commit: src/sys/arch/sparc64/dev

2021-04-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Apr  5 12:19:22 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: ldc.c

Log Message:
sun4v: Ignore spurious ldc CTRL/ACK/VERS messages (do not reset the connection 
anymore). Fixes occationals stalls when vdsk uses the ldc service. Observed on 
both T2000 and T5 host systems


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/ldc.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/sparc64/dev/ldc.c
diff -u src/sys/arch/sparc64/dev/ldc.c:1.6 src/sys/arch/sparc64/dev/ldc.c:1.7
--- src/sys/arch/sparc64/dev/ldc.c:1.6	Tue Oct 15 00:13:52 2019
+++ src/sys/arch/sparc64/dev/ldc.c	Mon Apr  5 12:19:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ldc.c,v 1.6 2019/10/15 00:13:52 chs Exp $	*/
+/*	$NetBSD: ldc.c,v 1.7 2021/04/05 12:19:22 palle Exp $	*/
 /*	$OpenBSD: ldc.c,v 1.12 2015/03/21 18:02:58 kettenis Exp $	*/
 /*
  * Copyright (c) 2009 Mark Kettenis
@@ -76,24 +76,25 @@ ldc_rx_ctrl_vers(struct ldc_conn *lc, st
 {
 	switch (lp->stype) {
 	case LDC_INFO:
-		DPRINTF(("CTRL/INFO/VERS\n"));
+		DPRINTF(("CTRL/INFO/VERS major %d minor %d\n", lp->major, lp->minor));
 		if (lp->major == LDC_VERSION_MAJOR &&
 		lp->minor == LDC_VERSION_MINOR)
 			ldc_send_ack(lc);
 		else {
 			/* XXX do nothing for now. */
+			DPRINTF(("CTRL/INFO/VERS unsupported major/minor\n"));
 		}
 		break;
 
 	case LDC_ACK:
+		DPRINTF(("CTRL/ACK/VERS\n"));
 		if (lc->lc_state != LDC_SND_VERS) {
-			DPRINTF(("Spurious CTRL/ACK/VERS: state %d\n",
-			lc->lc_state));
-			ldc_reset(lc);
-			return;
+			DPRINTF(("Spurious CTRL/ACK/VERS: state %d major %d minor %d (ignored)\n",
+	 lc->lc_state, lp->major, lp->minor));
+		}
+		else {		
+			ldc_send_rts(lc);
 		}
-		DPRINTF(("CTRL/ACK/VERS\n"));
-		ldc_send_rts(lc);
 		break;
 
 	case LDC_NACK:
@@ -263,6 +264,7 @@ ldc_send_vers(struct ldc_conn *lc)
 	lp->ctrl = LDC_VERS;
 	lp->major = 1;
 	lp->minor = 0;
+	DPRINTF(("ldc_send_vers() major %d minor %d\n", lp->major, lp->minor));
 
 	tx_tail += sizeof(*lp);
 	tx_tail &= ((lc->lc_txq->lq_nentries * sizeof(*lp)) - 1);
@@ -274,6 +276,7 @@ ldc_send_vers(struct ldc_conn *lc)
 	}
 
 	lc->lc_state = LDC_SND_VERS;
+	DPRINTF(("ldc_send_vers() setting lc->lc_state to %d\n", lc->lc_state));
 	mutex_exit(>lc_txq->lq_mtx);
 }
 
@@ -309,6 +312,7 @@ ldc_send_ack(struct ldc_conn *lc)
 	}
 
 	lc->lc_state = LDC_RCV_VERS;
+	DPRINTF(("ldc_send_ack() setting lc->lc_state to %d\n", lc->lc_state));
 	mutex_exit(>lc_txq->lq_mtx);
 }
 
@@ -344,6 +348,7 @@ ldc_send_rts(struct ldc_conn *lc)
 	}
 
 	lc->lc_state = LDC_SND_RTS;
+	DPRINTF(("ldc_send_rts() setting lc->lc_state to %d\n", lc->lc_state));
 	mutex_exit(>lc_txq->lq_mtx);
 }
 
@@ -379,6 +384,7 @@ ldc_send_rtr(struct ldc_conn *lc)
 	}
 
 	lc->lc_state = LDC_SND_RTR;
+	DPRINTF(("ldc_send_rtr() setting lc->lc_state to %d\n", lc->lc_state));
 	mutex_exit(>lc_txq->lq_mtx);
 }
 
@@ -414,6 +420,7 @@ ldc_send_rdx(struct ldc_conn *lc)
 	}
 
 	lc->lc_state = LDC_SND_RDX;
+	DPRINTF(("ldc_send_rdx() setting lc->lc_state to %d\n", lc->lc_state));
 	mutex_exit(>lc_txq->lq_mtx);
 }
 



CVS commit: src/sys/arch/sparc64/dev

2021-04-05 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Apr  5 12:19:22 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: ldc.c

Log Message:
sun4v: Ignore spurious ldc CTRL/ACK/VERS messages (do not reset the connection 
anymore). Fixes occationals stalls when vdsk uses the ldc service. Observed on 
both T2000 and T5 host systems


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/ldc.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/sparc64/doc

2021-04-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Apr  3 17:02:32 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
update TODO after cpu_idle() has been improved (sun4v only for now)


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.40 src/sys/arch/sparc64/doc/TODO:1.41
--- src/sys/arch/sparc64/doc/TODO:1.40	Tue Mar 30 20:23:45 2021
+++ src/sys/arch/sparc64/doc/TODO	Sat Apr  3 17:02:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.40 2021/03/30 20:23:45 palle Exp $ */
+/* $NetBSD: TODO,v 1.41 2021/04/03 17:02:31 palle Exp $ */
 
 Things to be done:
 
@@ -23,7 +23,6 @@ sun4v:
 	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):
 	   - during autoconfiguration of vnet devices the call to hv_vintr_setenabled()
 	 returns error code 7 (EBADTRAP?)
-- idle handling - call hypervisor trap (openbsd code...??)	   
 - 64-bit kernel support
 - 32-bit kernel support
 - libkvm



CVS commit: src/sys/arch/sparc64/doc

2021-04-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Apr  3 17:02:32 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
update TODO after cpu_idle() has been improved (sun4v only for now)


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64

2021-04-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Apr  3 17:01:24 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: cpu.c genassym.cf locore.s

Log Message:
Improve cpu_idle() by allowing a platform specific implementaion (same logic as 
the sparc implementation) - currently only used by sun4v


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/sparc64/sparc64/cpu.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.426 -r1.427 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/include/cpu.h
diff -u src/sys/arch/sparc64/include/cpu.h:1.130 src/sys/arch/sparc64/include/cpu.h:1.131
--- src/sys/arch/sparc64/include/cpu.h:1.130	Tue Mar 10 03:49:56 2020
+++ src/sys/arch/sparc64/include/cpu.h	Sat Apr  3 17:01:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.130 2020/03/10 03:49:56 christos Exp $ */
+/*	$NetBSD: cpu.h,v 1.131 2021/04/03 17:01:24 palle Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -212,12 +212,14 @@ struct cpu_info {
 	paddr_t			ci_devmq;  /* device mondo queue address */
 	paddr_t			ci_cpuset; /* mondo recipient address */ 
 	paddr_t			ci_mondo;  /* mondo message address */
-	
+
 	/* probe fault in PCI config space reads */
 	bool			ci_pci_probe;
 	bool			ci_pci_fault;
 
 	volatile void		*ci_ddb_regs;	/* DDB regs */
+
+	void (*ci_idlespin)(void);
 };
 
 #endif /* _KERNEL || _KMEMUSER */
@@ -438,6 +440,9 @@ void	switchtoctx_usiii(int);
 void	next_tick(long);
 void	next_stick(long);
 void	next_stick_init(void);
+#ifdef SUN4V
+voidcpu_idle_sun4v(void);
+#endif
 /* trap.c */
 void	cpu_vmspace_exec(struct lwp *, vaddr_t, vaddr_t);
 int	rwindow_save(struct lwp *);

Index: src/sys/arch/sparc64/sparc64/cpu.c
diff -u src/sys/arch/sparc64/sparc64/cpu.c:1.138 src/sys/arch/sparc64/sparc64/cpu.c:1.139
--- src/sys/arch/sparc64/sparc64/cpu.c:1.138	Fri Aug  7 14:20:08 2020
+++ src/sys/arch/sparc64/sparc64/cpu.c	Sat Apr  3 17:01:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.138 2020/08/07 14:20:08 fcambus Exp $ */
+/*	$NetBSD: cpu.c,v 1.139 2021/04/03 17:01:24 palle Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.138 2020/08/07 14:20:08 fcambus Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.139 2021/04/03 17:01:24 palle Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -695,9 +695,22 @@ cpu_attach(device_t parent, device_t dev
 		ci->ci_cpuset = pa;
 		pa += 64;
 	}
-	
+
+	/*
+	 * cpu_idle setup (currently only necessary for sun4v)
+	 */
+	if (CPU_ISSUN4V) {
+	  ci->ci_idlespin = cpu_idle_sun4v;
+	}
 }
 
+#ifdef SUN4V
+void cpu_idle_sun4v(void)
+{
+  hv_cpu_yield();
+}
+#endif
+
 int
 cpu_myid(void)
 {

Index: src/sys/arch/sparc64/sparc64/genassym.cf
diff -u src/sys/arch/sparc64/sparc64/genassym.cf:1.84 src/sys/arch/sparc64/sparc64/genassym.cf:1.85
--- src/sys/arch/sparc64/sparc64/genassym.cf:1.84	Mon Feb 17 09:09:49 2020
+++ src/sys/arch/sparc64/sparc64/genassym.cf	Sat Apr  3 17:01:24 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.84 2020/02/17 09:09:49 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.85 2021/04/03 17:01:24 palle Exp $
 
 #
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -183,6 +183,7 @@ define	CI_DEVMQ	offsetof(struct cpu_info
 ifdef MULTIPROCESSOR
 define	CI_IPIEVC	offsetof(struct cpu_info, ci_ipi_evcnt[0].ev_count)
 endif
+define	CI_IDLESPIN offsetof(struct cpu_info, ci_idlespin)
 
 # CPU boot arguments structure
 define	CBA_NODE	offsetof(struct cpu_bootargs, cb_node)

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.426 src/sys/arch/sparc64/sparc64/locore.s:1.427
--- src/sys/arch/sparc64/sparc64/locore.s:1.426	Tue Mar 30 20:03:14 2021
+++ src/sys/arch/sparc64/sparc64/locore.s	Sat Apr  3 17:01:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.426 2021/03/30 20:03:14 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.427 2021/04/03 17:01:24 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -6619,11 +6619,19 @@ ENTRY(getfp)
 	 mov %fp, %o0
 
 /*
- * nothing MD to do in the idle loop
+ * Call optional cpu_idle handler if provided
  */
 ENTRY(cpu_idle)
-	retl
+	set	CPUINFO_VA, %o0
+	LDPTR	[%o0 + CI_IDLESPIN], %o1
+	tst	%o1
+	bz	1f
+	 nop
+	jmp	%o1
 	 nop
+1:
+	retl
+	nop
 
 /*
  * cpu_switchto() switches to an lwp to run and runs it, saving the



CVS commit: src/sys/arch/sparc64

2021-04-03 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Apr  3 17:01:24 UTC 2021

Modified Files:
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: cpu.c genassym.cf locore.s

Log Message:
Improve cpu_idle() by allowing a platform specific implementaion (same logic as 
the sparc implementation) - currently only used by sun4v


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/sparc64/sparc64/cpu.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.426 -r1.427 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/doc

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:23:45 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO after pcb spill improvements and status when running on a S7 
host


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.39 src/sys/arch/sparc64/doc/TODO:1.40
--- src/sys/arch/sparc64/doc/TODO:1.39	Tue Mar 23 19:13:46 2021
+++ src/sys/arch/sparc64/doc/TODO	Tue Mar 30 20:23:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.39 2021/03/23 19:13:46 palle Exp $ */
+/* $NetBSD: TODO,v 1.40 2021/03/30 20:23:45 palle Exp $ */
 
 Things to be done:
 
@@ -17,11 +17,12 @@ sun4v:
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
 	   - the sysinst tool starts, disk setup is working,
-	 but the process crashes when selecting network installation method
-		 (the pcbspill function in locore.s incorrectly only spills one register
-		 window even if more than one is are present)
+	 but the process crashes when selecting network installation method (trap 0x34 ALIGN is received)
 	 T2000 ldom with 8 VCPU and 4GB:
-	   On this platform it crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
+	   - crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
+	 S7 ldom with 8 VCPU and 16GB (primary ldom is Solaris 11.4 SRU30):
+	   - during autoconfiguration of vnet devices the call to hv_vintr_setenabled()
+	 returns error code 7 (EBADTRAP?)
 - idle handling - call hypervisor trap (openbsd code...??)	   
 - 64-bit kernel support
 - 32-bit kernel support



CVS commit: src/sys/arch/sparc64/doc

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:23:45 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO after pcb spill improvements and status when running on a S7 
host


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:03:15 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
sun4v: handle spill trap properly when trap level is 1 and otherwin is non-zero 
- ensure that all windows are spilled to the pcb like the sun4u winfixsave code 
path


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/sys/arch/sparc64/sparc64/locore.s

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



CVS commit: src/sys/arch/sparc64/sparc64

2021-03-30 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 30 20:03:15 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64: locore.s

Log Message:
sun4v: handle spill trap properly when trap level is 1 and otherwin is non-zero 
- ensure that all windows are spilled to the pcb like the sun4u winfixsave code 
path


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/sparc64/locore.s
diff -u src/sys/arch/sparc64/sparc64/locore.s:1.425 src/sys/arch/sparc64/sparc64/locore.s:1.426
--- src/sys/arch/sparc64/sparc64/locore.s:1.425	Mon Feb 22 09:56:42 2021
+++ src/sys/arch/sparc64/sparc64/locore.s	Tue Mar 30 20:03:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.425 2021/02/22 09:56:42 palle Exp $	*/
+/*	$NetBSD: locore.s,v 1.426 2021/03/30 20:03:14 palle Exp $	*/
 
 /*
  * Copyright (c) 2006-2010 Matthew R. Green
@@ -234,7 +234,7 @@
 	.endm
 
 	.macro sun4v_tl1_uspill_other
-	ba,a,pt	%xcc, pcbspill_others
+	ba,a,pt	%xcc, pcbspill_other
 	 nop
 	.align 128
 	.endm
@@ -3485,6 +3485,77 @@ pcbspill_fail:
 	Debugger()
 	NOTREACHED
 
+
+pcbspill_other:
+	
+	set	CPUINFO_VA, %g6
+	ldx	[%g6 + CI_CPCB], %g6
+	
+	GET_CTXBUSY %g1
+
+	ldx	[%g1], %g1! kernel pmap is ctx 0
+	
+	srlx	%g6, STSHIFT, %g7
+	and	%g7, STMASK, %g7
+	sll	%g7, 3, %g7! byte offset into ctxbusy
+	add	%g7, %g1, %g1
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1		! Load pointer to directory
+
+	srlx	%g6, PDSHIFT, %g7			! Do page directory
+	and	%g7, PDMASK, %g7
+	sll	%g7, 3, %g7
+	brz,pn	%g1, pcbspill_other_fail
+	 add	%g7, %g1, %g1
+	ldxa	[%g1] ASI_PHYS_CACHED, %g1
+	srlx	%g6, PTSHIFT, %g7			! Convert to ptab offset
+	and	%g7, PTMASK, %g7
+	brz	%g1, pcbspill_other_fail
+	 sll	%g7, 3, %g7
+	add	%g1, %g7, %g7
+	ldxa	[%g7] ASI_PHYS_CACHED, %g7		! This one is not
+	brgez	%g7, pcbspill_other_fail
+	 srlx	%g7, PGSHIFT, %g7			! Isolate PA part
+	sll	%g6, 32-PGSHIFT, %g6			! And offset
+	sllx	%g7, PGSHIFT+8, %g7			! There are 8 bits to the left of the PA in the TTE
+	srl	%g6, 32-PGSHIFT, %g6
+	srax	%g7, 8, %g7
+	or	%g7, %g6, %g6! Then combine them to form PA
+
+	wr	%g0, ASI_PHYS_CACHED, %asi		! Use ASI_PHYS_CACHED to prevent possible page faults
+
+	lduba	[%g6 + PCB_NSAVED] %asi, %g7		! Fetch current nsaved from the pcb
+	sllx	%g7, 7, %g5! 8+8 registers each 8 bytes = 128 bytes (2^7)
+	add	%g6, %g5, %g5! Offset into pcb_rw
+1:	
+	SPILL	stxa, %g5 + PCB_RW, 8, %asi		! Store the locals and ins
+
+	add	%g5, 16*8, %g5! Next location for saved register windows
+
+	stxa	%o6, [%g5 + PCB_RW + (14*8)] %asi	! Save %sp so we can write these all out
+	
+	saved		! Increments %cansave and decrements %otherwin
+	
+	rdpr	%cwp, %g1! shift register window forward
+	inc	%g1
+	wrpr	%g1, %cwp
+
+
+	inc	%g7	! increment number of saved register windows
+
+	rdpr	%otherwin, %g1! Check to see if done spill'ing otherwin
+	brnz,pt	%g1, 1b
+	 nop
+	
+	stba	%g7, [%g6 + PCB_NSAVED] %asi
+
+	retry
+	NOTREACHED
+
+pcbspill_other_fail:
+	Debugger()
+	NOTREACHED
+
+
 spill_normal_to_user_stack:
 	mov	%sp, %g6		! calculate virtual address of destination stack
 	add	%g6, BIAS, %g6



CVS commit: src/sys/arch/sparc64/doc

2021-03-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 23 19:13:46 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with findings related to crashes in user processes (pcbspill)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.38 src/sys/arch/sparc64/doc/TODO:1.39
--- src/sys/arch/sparc64/doc/TODO:1.38	Tue Mar 16 20:11:30 2021
+++ src/sys/arch/sparc64/doc/TODO	Tue Mar 23 19:13:46 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.38 2021/03/16 20:11:30 palle Exp $ */
+/* $NetBSD: TODO,v 1.39 2021/03/23 19:13:46 palle Exp $ */
 
 Things to be done:
 
@@ -17,8 +17,9 @@ sun4v:
 	   - ldom virtual network interface (vnet) is working
 	 (verified by exiting sysinst and issuing a ping command)
 	   - the sysinst tool starts, disk setup is working,
-	 but the process crashes when selecting network installtion method
-		 (probably due to trashing of user proces registers)
+	 but the process crashes when selecting network installation method
+		 (the pcbspill function in locore.s incorrectly only spills one register
+		 window even if more than one is are present)
 	 T2000 ldom with 8 VCPU and 4GB:
 	   On this platform it crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
 - idle handling - call hypervisor trap (openbsd code...??)	   



CVS commit: src/sys/arch/sparc64/doc

2021-03-23 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 23 19:13:46 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO with findings related to crashes in user processes (pcbspill)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/doc

2021-03-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 16 20:11:30 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO - update status after hacking on ldom virtual network 
interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.37 src/sys/arch/sparc64/doc/TODO:1.38
--- src/sys/arch/sparc64/doc/TODO:1.37	Thu Mar  4 20:00:51 2021
+++ src/sys/arch/sparc64/doc/TODO	Tue Mar 16 20:11:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.37 2021/03/04 20:00:51 palle Exp $ */
+/* $NetBSD: TODO,v 1.38 2021/03/16 20:11:30 palle Exp $ */
 
 Things to be done:
 
@@ -13,11 +13,12 @@ sun4u:
 sun4v:
  - current status
  T5 ldom with 2 VCPU and 4GB:
-   The kernel boots and starts userland when booting miniroot.fs.
-   The sysinst tool starts properly and is functional.
-	   Installation is not possible, since no driver currently exists
-	   for the ldom network interfaces, but openbsd vnet and vsw drivers are
-	   possible to integrate and this work is progressing.
+   - kernel boots from miniroot.fs via ldom fisk (vdsk)
+	   - ldom virtual network interface (vnet) is working
+	 (verified by exiting sysinst and issuing a ping command)
+	   - the sysinst tool starts, disk setup is working,
+	 but the process crashes when selecting network installtion method
+		 (probably due to trashing of user proces registers)
 	 T2000 ldom with 8 VCPU and 4GB:
 	   On this platform it crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
 - idle handling - call hypervisor trap (openbsd code...??)	   



CVS commit: src/sys/arch/sparc64/doc

2021-03-16 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue Mar 16 20:11:30 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO - update status after hacking on ldom virtual network 
interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/dev

2021-03-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Mar 15 18:44:05 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - cleanup of debug code (no functional changes)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev/vnet.c
diff -u src/sys/arch/sparc64/dev/vnet.c:1.4 src/sys/arch/sparc64/dev/vnet.c:1.5
--- src/sys/arch/sparc64/dev/vnet.c:1.4	Sat Mar 13 20:21:37 2021
+++ src/sys/arch/sparc64/dev/vnet.c	Mon Mar 15 18:44:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnet.c,v 1.4 2021/03/13 20:21:37 palle Exp $	*/
+/*	$NetBSD: vnet.c,v 1.5 2021/03/15 18:44:04 palle Exp $	*/
 /*	$OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $	*/
 /*
  * Copyright (c) 2009, 2015 Mark Kettenis
@@ -16,14 +16,10 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#if 0
-FIXME openbsd
-#include "bpfilter.h"
-#endif
-
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -31,12 +27,6 @@ FIXME openbsd
 #include 
 #include 
 #include 
-#if 0
-FIXME openbsd
-#include 
-#else
-#include 
-#endif
 
 #include 
 #include 
@@ -58,9 +48,6 @@ FIXME openbsd
 #include 
 #include 
 
-#if 1
-#define VNET_DEBUG
-#endif
 #ifdef VNET_DEBUG
 #define DPRINTF(x)	printf x
 #else
@@ -137,12 +124,7 @@ void	vnet_dring_free(bus_dma_tag_t, stru
 
 struct vnet_soft_desc {
 	int		vsd_map_idx;
-#if 0
-FIXME openbsd		
-	caddr_t		vsd_buf;
-#else		
 	unsigned char *vsd_buf;
-#endif		
 };
 
 struct vnet_softc {
@@ -171,12 +153,7 @@ struct vnet_softc {
 #define VIO_ACK_RDX		0x0400
 #define VIO_RCV_RDX		0x0800
 
-#if 0
-FIXME openbsd		
-	struct timeout	sc_handshake_to;
-#else
 	struct callout	sc_handshake_co;
-#endif		
 
 	uint8_t		sc_xfer_mode;
 
@@ -284,19 +261,6 @@ vnet_attach(struct device *parent, struc
 	hv_ldc_tx_qconf(ca->ca_id, 0, 0);
 	hv_ldc_rx_qconf(ca->ca_id, 0, 0);
 
-#if 0
-FIXME openbsd	
-	sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino,
-	IPL_NET, BUS_INTR_ESTABLISH_MPSAFE, vnet_tx_intr,
-	sc, sc->sc_dv.dv_xname);
-	sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino,
-	IPL_NET, BUS_INTR_ESTABLISH_MPSAFE, vnet_rx_intr,
-	sc, sc->sc_dv.dv_xname);
-	if (sc->sc_tx_ih == NULL || sc->sc_rx_ih == NULL) {
-		printf(", can't establish interrupt\n");
-		return;
-	}
-#else
 	sc->sc_tx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_tx_ino,
 	IPL_NET, vnet_tx_intr, sc);
 	sc->sc_rx_ih = bus_intr_establish(ca->ca_bustag, sc->sc_rx_ino,
@@ -305,7 +269,6 @@ FIXME openbsd	
 		printf(", can't establish interrupts\n");
 		return;
 	}
-#endif	
 
 	lc = >sc_lc;
 	lc->lc_id = ca->ca_id;
@@ -314,28 +277,10 @@ FIXME openbsd	
 	lc->lc_start = vnet_ldc_start;
 	lc->lc_rx_data = vio_rx_data;
 
-#if 0
-FIXME openbsd	
-	timeout_set(>sc_handshake_to, vnet_handshake, sc);
-#else
 	callout_init(>sc_handshake_co, 0);
-/* netbsd callout do silmilar function...*/
-#endif 
-	sc->sc_peer_state = VIO_DP_STOPPED;
 
-#if OPENBSD_BUSDMA
-	lc->lc_txq = ldc_queue_alloc(sc->sc_dmatag, VNET_TX_ENTRIES);
-	if (lc->lc_txq == NULL) {
-		printf(", can't allocate tx queue\n");
-		return;
-	}
+	sc->sc_peer_state = VIO_DP_STOPPED;
 
-	lc->lc_rxq = ldc_queue_alloc(sc->sc_dmatag, VNET_RX_ENTRIES);
-	if (lc->lc_rxq == NULL) {
-		printf(", can't allocate rx queue\n");
-		goto free_txqueue;
-	}
-#else	
 	lc->lc_txq = ldc_queue_alloc(VNET_TX_ENTRIES);
 	if (lc->lc_txq == NULL) {
 		printf(", can't allocate tx queue\n");
@@ -347,7 +292,6 @@ FIXME openbsd	
 		printf(", can't allocate rx queue\n");
 		goto free_txqueue;
 	}
-#endif
 	
 	if (OF_getprop(ca->ca_node, "local-mac-address",
    sc->sc_macaddr, ETHER_ADDR_LEN) > 0) {
@@ -360,63 +304,35 @@ FIXME openbsd	
 	/*
 	 * Each interface gets its own pool.
 	 */
-#if 0
-FIXME openbsd	
-	pool_init(>sc_pool, 2048, 0, IPL_NET, 0, sc->sc_dv.dv_xname, NULL);
-#else
 	pool_init(>sc_pool, 2048, 0, 0, 0, sc->sc_dv.dv_xname, NULL, IPL_NET);
-#endif
  
 	ifp = >sc_ethercom.ec_if;
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-#if 0	
-	ifp->if_link_state = LINK_STATE_DOWN;
-#endif	
 	ifp->if_init = vnet_init;
 	ifp->if_ioctl = vnet_ioctl;
 	ifp->if_start = vnet_start;
 	ifp->if_stop = vnet_stop;
 	ifp->if_watchdog = vnet_watchdog;
 	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
-#if 0
-FIXME openbsd	
-	ifq_set_maxlen(>if_snd, 31); /* XXX */
-#else 
- IFQ_SET_MAXLEN(>if_snd, 31); /* XXX */
-#endif 
+	IFQ_SET_MAXLEN(>if_snd, 31); /* XXX */
 
 	ifmedia_init(>sc_media, 0, vnet_media_change, vnet_media_status);
 	ifmedia_add(>sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(>sc_media, IFM_ETHER | IFM_AUTO);
 
-#if 0	
-	int error = if_initialize(ifp);
-	if (error != 0) {
-		printf(", if_initialize() failed\n");
-		return;
-	}
-	ether_ifattach(ifp, sc->sc_macaddr);
-	

CVS commit: src/sys/arch/sparc64/dev

2021-03-15 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Mon Mar 15 18:44:05 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - cleanup of debug code (no functional changes)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev

2021-03-13 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Mar 13 20:21:37 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - reception and transmission of eternet frames seems to work now 
(it is possible to ping 8.8.8.8 from inside a sun4v ldom). Still cleanup of 
debug code to be done.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev

2021-03-13 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Mar 13 20:21:37 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - reception and transmission of eternet frames seems to work now 
(it is possible to ping 8.8.8.8 from inside a sun4v ldom). Still cleanup of 
debug code to be done.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev/vnet.c
diff -u src/sys/arch/sparc64/dev/vnet.c:1.3 src/sys/arch/sparc64/dev/vnet.c:1.4
--- src/sys/arch/sparc64/dev/vnet.c:1.3	Thu Mar 11 19:34:11 2021
+++ src/sys/arch/sparc64/dev/vnet.c	Sat Mar 13 20:21:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnet.c,v 1.3 2021/03/11 19:34:11 palle Exp $	*/
+/*	$NetBSD: vnet.c,v 1.4 2021/03/13 20:21:37 palle Exp $	*/
 /*	$OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $	*/
 /*
  * Copyright (c) 2009, 2015 Mark Kettenis
@@ -221,6 +221,7 @@ void	vnet_rx_vio_ver_info(struct vnet_so
 void	vnet_rx_vio_attr_info(struct vnet_softc *, struct vio_msg_tag *);
 void	vnet_rx_vio_dring_reg(struct vnet_softc *, struct vio_msg_tag *);
 void	vnet_rx_vio_rdx(struct vnet_softc *sc, struct vio_msg_tag *);
+void	vnet_rx_vio_mcast_info(struct vnet_softc *sc, struct vio_msg_tag *);
 void	vnet_rx_vio_data(struct vnet_softc *sc, struct vio_msg *);
 void	vnet_rx_vio_desc_data(struct vnet_softc *sc, struct vio_msg_tag *);
 void	vnet_rx_vio_dring_data(struct vnet_softc *sc, struct vio_msg_tag *);
@@ -655,9 +656,15 @@ vnet_rx_vio_ctrl(struct vnet_softc *sc, 
 	case VIO_RDX:
 		vnet_rx_vio_rdx(sc, tag);
 		break;
+	case VNET_MCAST_INFO:
+		vnet_rx_vio_mcast_info(sc, tag);
+		break;
 	default:
 		printf("%s: CTRL/0x%02x/0x%04x FIXME\n",
  __func__, tag->stype, tag->stype_env);
+#if 0
+		Debugger();
+#endif		
 		break;
 	}
 }
@@ -739,7 +746,9 @@ vnet_rx_vio_attr_info(struct vnet_softc 
 		DPRINTF(("CTRL/INFO/ATTR_INFO\n"));
 #endif		
 		sc->sc_xfer_mode = ai->xfer_mode;
+#if 0		
 		DPRINTF(("sc_xfer_mode %d\n", sc->sc_xfer_mode));
+#endif		
 
 		ai->tag.stype = VIO_SUBTYPE_ACK;
 		ai->tag.sid = sc->sc_local_sid;
@@ -893,6 +902,40 @@ FIXME openbsd	
 }
 
 void
+vnet_rx_vio_mcast_info(struct vnet_softc *sc, struct vio_msg_tag *tag)
+{
+#if 0
+	DPRINTF(("%s: entry\n", __func__));
+#endif	
+
+	switch(tag->stype) {
+			
+		case VIO_SUBTYPE_INFO:
+#if 0
+			DPRINTF(("CTRL/INFO/MCAST_INFO\n"));
+#endif		
+			break;
+
+		case VIO_SUBTYPE_ACK:
+#if 0			
+			DPRINTF(("CTRL/ACK/MCAST_INFO\n"));
+#endif		
+			break;
+
+		case VIO_SUBTYPE_NACK:
+#if 0			
+			DPRINTF(("CTRL/NACK/MCAST_INFO\n"));
+#endif		
+			break;
+			
+		default:
+			printf("%s: CTRL/0x%02x/0x%04x\n",
+   __func__, tag->stype, tag->stype_env);
+			break;
+	}
+}
+
+void
 vnet_rx_vio_data(struct vnet_softc *sc, struct vio_msg *vm)
 {
 #if 0
@@ -1077,7 +1120,7 @@ FIXME openbsd		
 	switch(tag->stype) {
 	case VIO_SUBTYPE_INFO:
 	{
-#if 0			
+#if 0
 		DPRINTF(("%s: VIO_SUBTYPE_INFO\n", __func__));
 #endif		
 		struct vnet_desc desc;
@@ -1148,9 +1191,9 @@ FIXME openbsd			
 			m->m_len = m->m_pkthdr.len = desc.nbytes;
 #endif			
 			nbytes = roundup(desc.nbytes + VNET_ETHER_ALIGN, 8);
-#if 1
-			DPRINTF(("%s: nbytes %" PRId64 " desc.nbytes %" PRId32 "\n",
-	 __func__, nbytes, desc.nbytes));
+#if 0
+			DPRINTF(("%s: RX frame size %" PRId16 "\n",
+	 __func__, (int)nbytes));
 			uint8_t buf[ETHER_MAX_LEN];
 			pmap_extract(pmap_kernel(), (vaddr_t)buf, );
 			err = hv_ldc_copy(lc->lc_id, LDC_COPY_IN,
@@ -1161,11 +1204,12 @@ FIXME openbsd			
 			}
 			for (int i = 0; i < desc.nbytes; i++) {
 	if (i % 16 == 0) {
-		printf("\n");
+		DPRINTF(("\n"));
 	}
-	printf("%02x ", buf[i]);
+	DPRINTF(("%02x ", buf[i]));
 			}
-			printf("\n");
+			DPRINTF(("\n"));
+			DPRINTF(("\n"));
 #endif			
 #if 1
 			pmap_extract(pmap_kernel(), (vaddr_t)m->m_data, );
@@ -1176,6 +1220,7 @@ FIXME openbsd			
 goto skip;
 			}
 			m->m_data += VNET_ETHER_ALIGN;
+			m_set_rcvif(m, ifp);
 
 #if 0
 FIXME openbsd		
@@ -1224,7 +1269,7 @@ FIXME openbd		
 
 	case VIO_SUBTYPE_ACK:
 	{
-#if 0			
+#if 0
 		DPRINTF(("%s: VIO_SUBTYPE_ACK\n", __func__));
 #endif		
 		struct ldc_map *map = sc->sc_lm;
@@ -1399,6 +1444,12 @@ vnet_send_attr_info(struct vnet_softc *s
 		ai.addr |= sc->sc_macaddr[i];
 	}
 	ai.mtu = ETHER_MAX_LEN - ETHER_CRC_LEN;
+#if 0
+	DPRINTF(("%s: ai.addr %" PRIx64 "\n",
+			 __func__, ai.addr));
+	DPRINTF(("%s: ai.mtu %" PRId64 "\n",
+			 __func__, ai.mtu));
+#endif	
 	vnet_sendmsg(sc, , sizeof(ai));
 
 	sc->sc_vio_state |= VIO_SND_ATTR_INFO;
@@ -1407,7 +1458,7 @@ vnet_send_attr_info(struct vnet_softc *s
 void
 vnet_send_dring_reg(struct vnet_softc *sc)
 {
-#if 1
+#if 0
 	DPRINTF(("%s: entry\n", __func__));
 #endif	
 	
@@ -1433,7 +1484,7 @@ vnet_send_dring_reg(struct vnet_softc *s
 void
 vio_send_rdx(struct vnet_softc *sc)
 {
-#if 1
+#if 0
 	

CVS commit: src/sys/arch/sparc64/dev

2021-03-11 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar 11 19:34:11 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - reception of ethernet frames seems to work now (WIP and code is  
still full of debug code)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev/vnet.c
diff -u src/sys/arch/sparc64/dev/vnet.c:1.2 src/sys/arch/sparc64/dev/vnet.c:1.3
--- src/sys/arch/sparc64/dev/vnet.c:1.2	Thu Mar  4 20:59:39 2021
+++ src/sys/arch/sparc64/dev/vnet.c	Thu Mar 11 19:34:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnet.c,v 1.2 2021/03/04 20:59:39 palle Exp $	*/
+/*	$NetBSD: vnet.c,v 1.3 2021/03/11 19:34:11 palle Exp $	*/
 /*	$OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $	*/
 /*
  * Copyright (c) 2009, 2015 Mark Kettenis
@@ -34,6 +34,8 @@ FIXME openbsd
 #if 0
 FIXME openbsd
 #include 
+#else
+#include 
 #endif
 
 #include 
@@ -56,6 +58,9 @@ FIXME openbsd
 #include 
 #include 
 
+#if 1
+#define VNET_DEBUG
+#endif
 #ifdef VNET_DEBUG
 #define DPRINTF(x)	printf x
 #else
@@ -169,6 +174,8 @@ struct vnet_softc {
 #if 0
 FIXME openbsd		
 	struct timeout	sc_handshake_to;
+#else
+	struct callout	sc_handshake_co;
 #endif		
 
 	uint8_t		sc_xfer_mode;
@@ -230,7 +237,7 @@ void	vnet_send_dring_data(struct vnet_so
 
 void	vnet_start(struct ifnet *);
 void	vnet_start_desc(struct ifnet *);
-int		vnet_ioctl (struct ifnet *, u_long, void *);
+int		vnet_ioctl(struct ifnet *, u_long, void *);
 void	vnet_watchdog(struct ifnet *);
 
 int		vnet_media_change(struct ifnet *);
@@ -240,13 +247,14 @@ void	vnet_link_state(struct vnet_softc *
 
 void	vnet_setmulti(struct vnet_softc *, int);
 
-void	vnet_init(struct ifnet *);
-void	vnet_stop(struct ifnet *);
+int		vnet_init(struct ifnet *);
+void	vnet_stop(struct ifnet *, int);
 
 int vnet_match(device_t parent, cfdata_t match, void *aux)
 {
 
 	struct cbus_attach_args *ca = aux;
+	
 	if (strcmp(ca->ca_name, "network") == 0)
 		return (1);
 
@@ -308,6 +316,9 @@ FIXME openbsd	
 #if 0
 FIXME openbsd	
 	timeout_set(>sc_handshake_to, vnet_handshake, sc);
+#else
+	callout_init(>sc_handshake_co, 0);
+/* netbsd callout do silmilar function...*/
 #endif 
 	sc->sc_peer_state = VIO_DP_STOPPED;
 
@@ -358,9 +369,13 @@ FIXME openbsd	
 	ifp = >sc_ethercom.ec_if;
 	ifp->if_softc = sc;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+#if 0	
 	ifp->if_link_state = LINK_STATE_DOWN;
+#endif	
+	ifp->if_init = vnet_init;
 	ifp->if_ioctl = vnet_ioctl;
 	ifp->if_start = vnet_start;
+	ifp->if_stop = vnet_stop;
 	ifp->if_watchdog = vnet_watchdog;
 	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 #if 0
@@ -374,6 +389,7 @@ FIXME openbsd	
 	ifmedia_add(>sc_media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(>sc_media, IFM_ETHER | IFM_AUTO);
 
+#if 0	
 	int error = if_initialize(ifp);
 	if (error != 0) {
 		printf(", if_initialize() failed\n");
@@ -381,7 +397,10 @@ FIXME openbsd	
 	}
 	ether_ifattach(ifp, sc->sc_macaddr);
 	if_register(ifp);
-	
+#else
+	if_attach(ifp);
+	ether_ifattach(ifp, sc->sc_macaddr);
+#endif	
 	printf("\n");
 	return;
 free_txqueue:
@@ -424,7 +443,9 @@ vnet_tx_intr(void *arg)
 int
 vnet_rx_intr(void *arg)
 {
+#if 0		
 	DPRINTF(("%s: entry\n", __func__));
+#endif	
 
 	struct vnet_softc *sc = arg;
 	struct ldc_conn *lc = >sc_lc;
@@ -433,34 +454,47 @@ vnet_rx_intr(void *arg)
 	int err;
 
 	err = hv_ldc_rx_get_state(lc->lc_id, _head, _tail, _state);
-	if (err == H_EINVAL)
+	if (err == H_EINVAL) {
+		printf("hv_ldc_rx_get_state failed\n");
 		return (0);
+	}
 	if (err != H_EOK) {
 		printf("hv_ldc_rx_get_state %d\n", err);
 		return (0);
 	}
+#if 0	
+	DPRINTF(("%s: rx_state %" PRId64 "  head %" PRId64 "  tail %" PRId64 "\n",
+			 __func__, rx_state, rx_head, rx_tail));
+#endif	
 
 	if (rx_state != lc->lc_rx_state) {
+#if 0			
+		DPRINTF(("%s: rx_state %" PRId64 " != lc__rx_state %" PRId64 "\n",
+ __func__, rx_state, lc->lc_rx_state));
+#endif		
 		switch (rx_state) {
 		case LDC_CHANNEL_DOWN:
-			DPRINTF(("%s: Rx link down\n", __func__));
 			lc->lc_tx_seqid = 0;
 			lc->lc_state = 0;
 			lc->lc_reset(lc);
 			if (rx_head == rx_tail)
 break;
 			/* Discard and ack pending I/O. */
-			DPRINTF(("setting rx qhead to %lld\n", rx_tail));
+			DPRINTF(("setting rx qhead to %" PRId64 "\n", rx_tail));
 			err = hv_ldc_rx_set_qhead(lc->lc_id, rx_tail);
 			if (err == H_EOK)
 break;
 			printf("%s: hv_ldc_rx_set_qhead %d\n", __func__, err);
 			break;
 		case LDC_CHANNEL_UP:
+#if 0
 			DPRINTF(("%s: Rx link up\n", __func__));
+#endif			
 #if 0
 FIXME openbsd			
 			timeout_add_msec(>sc_handshake_to, 500);
+#else 
+			callout_reset(>sc_handshake_co, hz / 2, vnet_handshake, sc);
 #endif 
 			break;
 		case LDC_CHANNEL_RESET:
@@ -471,37 +505,73 @@ FIXME openbsd			
 #if 0
 FIXME openbsd			
 			

CVS commit: src/sys/arch/sparc64/dev

2021-03-11 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar 11 19:34:11 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: vnet - reception of ethernet frames seems to work now (WIP and code is  
still full of debug code)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:59:39 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: add vnet driver from openbsd - compiles but probably does not work yet - 
still WIP (now with NetBSD cvs tag and compiles for 32-bit SUN4U


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

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:59:39 UTC 2021

Modified Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: add vnet driver from openbsd - compiles but probably does not work yet - 
still WIP (now with NetBSD cvs tag and compiles for 32-bit SUN4U


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/dev/vnet.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/sparc64/dev/vnet.c
diff -u src/sys/arch/sparc64/dev/vnet.c:1.1 src/sys/arch/sparc64/dev/vnet.c:1.2
--- src/sys/arch/sparc64/dev/vnet.c:1.1	Thu Mar  4 20:17:00 2021
+++ src/sys/arch/sparc64/dev/vnet.c	Thu Mar  4 20:59:39 2021
@@ -1,3 +1,4 @@
+/*	$NetBSD: vnet.c,v 1.2 2021/03/04 20:59:39 palle Exp $	*/
 /*	$OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $	*/
 /*
  * Copyright (c) 2009, 2015 Mark Kettenis
@@ -265,7 +266,7 @@ vnet_attach(struct device *parent, struc
 	sc->sc_tx_ino = ca->ca_tx_ino;
 	sc->sc_rx_ino = ca->ca_rx_ino;
 
-	printf(": ivec 0x%lx, 0x%lx", sc->sc_tx_ino, sc->sc_rx_ino);
+	printf(": ivec 0x%" PRIx64 ", 0x%" PRIx64, sc->sc_tx_ino, sc->sc_rx_ino);
 
 	/*
 	 * Un-configure queues before registering interrupt handlers,
@@ -488,7 +489,7 @@ FIXME openbsd			
 	if (rx_head == rx_tail)
 		return (0);
 
-	lp = (struct ldc_pkt *)(lc->lc_rxq->lq_va + rx_head);
+	lp = (struct ldc_pkt *)(uintptr_t)(lc->lc_rxq->lq_va + rx_head);
 	switch (lp->type) {
 	case LDC_CTRL:
 		ldc_rx_ctrl(lc, lp);



CVS commit: src/sys/arch/sparc64

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:17:00 UTC 2021

Modified Files:
src/sys/arch/sparc64/conf: GENERIC files.sparc64
Added Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: add vnet driver from openbsd - compiles but probably does not work yet - 
still WIP


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/dev/vnet.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/sparc64

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:17:00 UTC 2021

Modified Files:
src/sys/arch/sparc64/conf: GENERIC files.sparc64
Added Files:
src/sys/arch/sparc64/dev: vnet.c

Log Message:
sun4v: add vnet driver from openbsd - compiles but probably does not work yet - 
still WIP


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/arch/sparc64/conf/GENERIC
cvs rdiff -u -r1.163 -r1.164 src/sys/arch/sparc64/conf/files.sparc64
cvs rdiff -u -r0 -r1.1 src/sys/arch/sparc64/dev/vnet.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/sparc64/conf/GENERIC
diff -u src/sys/arch/sparc64/conf/GENERIC:1.234 src/sys/arch/sparc64/conf/GENERIC:1.235
--- src/sys/arch/sparc64/conf/GENERIC:1.234	Sun Jan 31 08:07:25 2021
+++ src/sys/arch/sparc64/conf/GENERIC	Thu Mar  4 20:17:00 2021
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.234 2021/01/31 08:07:25 martin Exp $
+# $NetBSD: GENERIC,v 1.235 2021/03/04 20:17:00 palle Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/sparc64/conf/std.sparc64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.234 $"
+#ident		"GENERIC-$Revision: 1.235 $"
 
 maxusers	64
 
@@ -248,6 +248,7 @@ iic* 	at jbusi2c?
 # Virtual devices for sun4v systems.
 vrtc0	at vbus?
 vdsk*	at cbus?
+vnet*	at cbus?
 
  Serial port configuration
 

Index: src/sys/arch/sparc64/conf/files.sparc64
diff -u src/sys/arch/sparc64/conf/files.sparc64:1.163 src/sys/arch/sparc64/conf/files.sparc64:1.164
--- src/sys/arch/sparc64/conf/files.sparc64:1.163	Wed Oct 21 13:31:52 2020
+++ src/sys/arch/sparc64/conf/files.sparc64	Thu Mar  4 20:17:00 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sparc64,v 1.163 2020/10/21 13:31:52 christos Exp $
+#	$NetBSD: files.sparc64,v 1.164 2021/03/04 20:17:00 palle Exp $
 
 # @(#)files.sparc64	8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -332,3 +332,8 @@ file	arch/sparc64/dev/ldc.c			ldc
 device	vdsk: ldc, scsi
 attach	vdsk at cbus
 file	arch/sparc64/dev/vdsk.c			vdsk
+
+# Virtual network
+device	vnet: ldc
+attach	vnet at cbus
+file	arch/sparc64/dev/vnet.c			vnet

Added files:

Index: src/sys/arch/sparc64/dev/vnet.c
diff -u /dev/null src/sys/arch/sparc64/dev/vnet.c:1.1
--- /dev/null	Thu Mar  4 20:17:00 2021
+++ src/sys/arch/sparc64/dev/vnet.c	Thu Mar  4 20:17:00 2021
@@ -0,0 +1,1889 @@
+/*	$OpenBSD: vnet.c,v 1.62 2020/07/10 13:26:36 patrick Exp $	*/
+/*
+ * Copyright (c) 2009, 2015 Mark Kettenis
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#if 0
+FIXME openbsd
+#include "bpfilter.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#if 0
+FIXME openbsd
+#include 
+#endif
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#if NBPFILTER > 0
+#include 
+#endif
+
+#include 
+
+#include 
+#include 
+#include 
+
+#ifdef VNET_DEBUG
+#define DPRINTF(x)	printf x
+#else
+#define DPRINTF(x)
+#endif
+
+#define VNET_TX_ENTRIES		32
+#define VNET_RX_ENTRIES		32
+
+struct vnet_attr_info {
+	struct vio_msg_tag	tag;
+	uint8_t			xfer_mode;
+	uint8_t			addr_type;
+	uint16_t		ack_freq;
+	uint32_t		_reserved1;
+	uint64_t		addr;
+	uint64_t		mtu;
+	uint64_t		_reserved2[3];
+};
+
+/* Address types. */
+#define VNET_ADDR_ETHERMAC	0x01
+
+/* Sub-Type envelopes. */
+#define VNET_MCAST_INFO		0x0101
+
+#define VNET_NUM_MCAST		7
+
+struct vnet_mcast_info {
+	struct vio_msg_tag	tag;
+	uint8_t			set;
+	uint8_t			count;
+	uint8_t			mcast_addr[VNET_NUM_MCAST][ETHER_ADDR_LEN];
+	uint32_t		_reserved;
+};
+
+struct vnet_desc {
+	struct vio_dring_hdr	hdr;
+	uint32_t		nbytes;
+	uint32_t		ncookies;
+	struct ldc_cookie	cookie[2];
+};
+
+struct vnet_desc_msg {
+	struct vio_msg_tag	tag;
+	uint64_t		seq_no;
+	uint64_t		desc_handle;
+	uint32_t		nbytes;
+	uint32_t		ncookies;
+	struct ldc_cookie	cookie[1];
+};
+
+struct vnet_dring {
+	bus_dmamap_t		vd_map;
+	bus_dma_segment_t	vd_seg;
+	struct vnet_desc	*vd_desc;
+	int			vd_nentries;
+};
+
+struct vnet_dring *vnet_dring_alloc(bus_dma_tag_t, int);
+void	vnet_dring_free(bus_dma_tag_t, struct vnet_dring *);
+
+/*
+ * For now, we only support vNet 1.0.
+ */

CVS commit: src/sys/arch/sparc64/doc

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:00:51 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO - removed leftover OpenFirmware interface comment and add 
comment on idle handling


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/doc

2021-03-04 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Thu Mar  4 20:00:51 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO - removed leftover OpenFirmware interface comment and add 
comment on idle handling


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.36 src/sys/arch/sparc64/doc/TODO:1.37
--- src/sys/arch/sparc64/doc/TODO:1.36	Sat Feb 27 18:29:38 2021
+++ src/sys/arch/sparc64/doc/TODO	Thu Mar  4 20:00:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.36 2021/02/27 18:29:38 palle Exp $ */
+/* $NetBSD: TODO,v 1.37 2021/03/04 20:00:51 palle Exp $ */
 
 Things to be done:
 
@@ -18,9 +18,9 @@ sun4v:
 	   Installation is not possible, since no driver currently exists
 	   for the ldom network interfaces, but openbsd vnet and vsw drivers are
 	   possible to integrate and this work is progressing.
-	   OpenBoot (properly trashed registers).
 	 T2000 ldom with 8 VCPU and 4GB:
 	   On this platform it crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)
+- idle handling - call hypervisor trap (openbsd code...??)	   
 - 64-bit kernel support
 - 32-bit kernel support
 - libkvm



CVS commit: src/sys/arch/sparc64/doc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:29:38 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with OpenFirmware interface related improvements


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.35 src/sys/arch/sparc64/doc/TODO:1.36
--- src/sys/arch/sparc64/doc/TODO:1.35	Sat Feb 27 18:19:57 2021
+++ src/sys/arch/sparc64/doc/TODO	Sat Feb 27 18:29:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.35 2021/02/27 18:19:57 palle Exp $ */
+/* $NetBSD: TODO,v 1.36 2021/02/27 18:29:38 palle Exp $ */
 
 Things to be done:
 
@@ -41,6 +41,19 @@ sun4v:
 - vdsk and ldc drivers: code maked with OPENBSD_BUSDMA - make the bus_dma stuff work properly
 - vbus.c: handle prom_getprop() memory leaks
 - locore.s: rft_user (sun4v specific manaul fill) - seems to work, but is it good enough (compared to openbsds rft_user?
+- openfirmware interface
+bounce handlng could need rework
+  - only #if __arch64__ independent for SUN4V, as OF for all ultrasparcs is
+plain 32bit code too (and this #if only because the point below becomes
+always false otherwise)
+  - only bounce if the address is >= 1UL<<32
+  - perhaps apply the lock to OF calls in general, not only the bounce'd ones
+(in other words: let's protect the OF context with the lock, not
+only the bounce buffer contents).
+	  - Are there any other bounce-worthy OF calls? If so, apply handling 
+	to all of them now
+  - consider method used by Solaris/OpenSolaris/Illumos (look for PROM_32BIT_ADDRS in
+	the Illumos codebase)
  - platforms tested so far:
  -- qemu sun4v/niagara - reaches the point where the kernel needs to mount a root fs
  -- T2000 - mmu fault somewhere



CVS commit: src/sys/arch/sparc64/doc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:29:38 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with OpenFirmware interface related improvements


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc64/doc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:19:57 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with status on sun4v - kernel and userland runs without 
crashing now - next up is network interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc64/doc/TODO

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/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.34 src/sys/arch/sparc64/doc/TODO:1.35
--- src/sys/arch/sparc64/doc/TODO:1.34	Mon Feb 22 10:30:57 2021
+++ src/sys/arch/sparc64/doc/TODO	Sat Feb 27 18:19:57 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO,v 1.34 2021/02/22 10:30:57 palle Exp $ */
+/* $NetBSD: TODO,v 1.35 2021/02/27 18:19:57 palle Exp $ */
 
 Things to be done:
 
@@ -14,8 +14,10 @@ sun4v:
  - current status
  T5 ldom with 2 VCPU and 4GB:
The kernel boots and starts userland when booting miniroot.fs.
-   The sysinst tool starts properly and requests terminal type.
-	   Upon entering characters on the console, a crash occurs inside
+   The sysinst tool starts properly and is functional.
+	   Installation is not possible, since no driver currently exists
+	   for the ldom network interfaces, but openbsd vnet and vsw drivers are
+	   possible to integrate and this work is progressing.
 	   OpenBoot (properly trashed registers).
 	 T2000 ldom with 8 VCPU and 4GB:
 	   On this platform it crashes in /sbin/init doing an access() call where %o0 is corrupted (zero)



CVS commit: src/sys/arch/sparc64/doc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:19:57 UTC 2021

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
sun4v: update TODO file with status on sun4v - kernel and userland runs without 
crashing now - next up is network interfaces


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc64/doc/TODO

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



CVS commit: src/sys/arch/sparc/sparc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:10:46 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: openfirm.c

Log Message:
sun4v: add 32/64 bit workaround for the OF_read() call, similar to the one 
introduced in revision 1.21


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/sparc/openfirm.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/sparc/sparc/openfirm.c
diff -u src/sys/arch/sparc/sparc/openfirm.c:1.23 src/sys/arch/sparc/sparc/openfirm.c:1.24
--- src/sys/arch/sparc/sparc/openfirm.c:1.23	Sun Mar 26 12:38:24 2017
+++ src/sys/arch/sparc/sparc/openfirm.c	Sat Feb 27 18:10:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.24 2021/02/27 18:10:46 palle Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.24 2021/02/27 18:10:46 palle Exp $");
 
 #include 
 #include 
@@ -503,6 +503,15 @@ OF_read(int handle, void *addr, int len)
 	} args;
 	int l, act = 0;
 
+#ifdef SUN4V
+#if __arch64__
+	void *oaddr = addr;
+	__cpu_simple_lock(_lock);
+	if (len > OFBOUNCE_MAXSIZE) 
+		panic("OF_read(len = %d) exceedes bounce buffer\n", len);
+	addr = ofbounce;
+#endif	
+#endif
 	args.name = ADR2CELL("read");
 	args.nargs = 3;
 	args.nreturns = 1;
@@ -511,18 +520,31 @@ OF_read(int handle, void *addr, int len)
 	for (; len > 0; len -= l) {
 		l = MIN(NBPG, len);
 		args.len = l;
-		if (openfirmware() == -1)
-			return -1;
+		if (openfirmware() == -1) {
+			act = -1;
+			goto OF_read_exit;
+		}
 		if (args.actual > 0) {
 			act += args.actual;
 		}
 		if (args.actual < l) {
 			if (act)
-return act;
-			else
-return args.actual;
+goto OF_read_exit;
+			else {
+act = args.actual;	
+goto OF_read_exit;
+			}
 		}
 	}
+OF_read_exit:
+#ifdef SUN4V
+#if __arch64__
+	if (act > 0) {
+		memcpy(oaddr, addr, act);	
+	}
+	__cpu_simple_unlock(_lock);
+#endif
+#endif
 	return act;
 }
 



CVS commit: src/sys/arch/sparc/sparc

2021-02-27 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sat Feb 27 18:10:46 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: openfirm.c

Log Message:
sun4v: add 32/64 bit workaround for the OF_read() call, similar to the one 
introduced in revision 1.21


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/sparc/sparc/openfirm.c

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



  1   2   3   4   5   >