Commit Graph

147384 Commits

Author SHA1 Message Date
martin 2872de667c Pull up following revision(s) (requested by reinoud in ticket #1657):
sys/fs/nilfs/nilfs_subr.h: revision 1.5

Remove old prototypes from writing that shouldn't have been comitted at all!
2023-06-27 18:44:05 +00:00
martin 52f9354288 Pull up the following revisions, requested by msaitoh in #1656:
sys/dev/pci/if_wm.c				1.768-1.782 via patch
	sys/dev/pci/if_wmreg.h				1.129-1.130
	sys/dev/pci/if_wmvar.h				1.49

wm(4):
- Rework for event counters:
  - Fix calculation of GORC, GOTC, TOR and TOT counters correctly.
  - Rearrange the order of the registers so that they are roughly
    in ascending order.
  - Reorder evcnt_attach_dynamic(), WM_EVCNT_ADD() and evcnt_detach()
    to match.
  - IC{TX,RX}*C registers are for older than 82575.
  - Fix a bug that the transmit underrun counter is incorrectly
    counted.
  - Don't add "Count" for event counter's description.
  - Some statistics registers were replaced with new counters on newer
    chips. Treat 0x403c(CEXTERR->HTDPMC), 0x40fc(TSCTFC->CBRMPC),
    0x4124(ICRXOC->HTCBDPC) and from 0x4104 to 0x4124.
  - Add some new counters:
    - Circuit Breaker TX Manageability Packet
    - Circuit Breaker RX Dropped Packet
    - Host Good Octets RX
    - Host Good Octets TX
    - Length Errors
    - SerDes/SGMII Code Violation Packet
    - Header Redirection Missed Packet
    - EEE TX LPI
    - EEE RX LPI
  - Fix prc511's comment and description.
- Add SOICZIFDATA (ifconfig -z) support for evcnt(9).
- Use WM_IS_ICHPCH(). No functional change.
- Fix typo. s/ictxact/ictxatc/. No functional change.
- Add comment.
2023-06-27 18:32:46 +00:00
martin 73fedd9799 Regen for ticket #1654 2023-06-21 22:21:21 +00:00
martin 9ccb6f6f3c Pull up following revision(s) (requested by msaitoh in ticket #1654):
sys/dev/pci/pcidevs: revision 1.1478
	sys/dev/pci/pcidevs: revision 1.1479
	sys/dev/pci/pcidevs: revision 1.1480

Add Samsung SM990.

Add devices from PPR for AMD Family 19h Model 61h Revision B1 processors.

The SATA device ID for Apollo Lake is not 0x5ae0 but 0x5ae3.
2023-06-21 22:20:31 +00:00
martin ecc3003d2c Pull up following revision(s) (requested by riastradh in ticket #1650):
sys/compat/sunos32/sunos32_misc.c: revision 1.86
	sys/compat/ossaudio/ossaudio.c: revision 1.85
	sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
2023-06-21 21:24:37 +00:00
martin 21ae7356a1 Pull up following revision(s) (requested by msaitoh in ticket #1649):
sys/arch/x86/x86/procfs_machdep.c: revision 1.47

Add Intel lam and AMD vnmi.
2023-06-21 19:52:39 +00:00
martin 2ac09dd770 Pull up the following revisions, requested by msaitoh in ticket #1647:
sys/dev/pci/ixgbe/ixgbe.c		1.325-1.326 via patch
	sys/dev/pci/ixgbe/ixgbe_common.c	1.44
	sys/dev/pci/ixgbe/ixgbe_type.h		1.56

- PCI device ID 0x15c8 also uses X557-AT PHY, so create the thermal
  sensor sysctl for it, too.
- Count the number of link down events in the MAC using with
  LINK_DN_CNT register.
2023-06-21 19:20:50 +00:00
martin 196381424d Pull up following revision(s) (requested by abs in ticket #1648):
sys/arch/vax/vax/pmap.c: revision 1.196
	sys/arch/vax/include/trap.h: revision 1.25

Change CASMAGIC to 0xFEDABABE so that it cannot accidentally end up in
valid kernel memory.  Due to the VARM accesses above S0 should always
give a ptelen trap.

Bug found by Kalvis Duckmanton.


Ensure that the kernel do not try to allocate a S0 segment larger than 1G,
since the hardware prohibits that.
2023-06-21 19:10:28 +00:00
martin aab0fea348 Pull up following revision(s) (requested by msaitoh in ticket #1646):
sys/arch/x86/include/specialreg.h: revision 1.202
	sys/arch/x86/include/specialreg.h: revision 1.203
	usr.sbin/cpuctl/arch/i386.c: revision 1.136

Add some CPUID bits from PPR for AMD Family 19h Model 61h Revision B1.

Add AMD CPUID Fn0000_0008 %ebx bit 3 INVLPGB.
2023-06-21 19:04:19 +00:00
martin 0e352e0818 Pull up following revision(s) (requested by msaitoh in ticket #1644):
sys/arch/x86/pci/amdsmn.c: revision 1.16
	sys/arch/x86/pci/amdzentemp.c: revision 1.17
	sys/arch/x86/pci/amdzentemp.c: revision 1.18

Reduce diff against DragonFly. No functional change.
amdsmn(4),amdzentemp(4): Add Zen3+ Rembrandt(19h/4xh) & Zen4 Genoa(19h/1xh).
2023-06-21 18:56:58 +00:00
martin 2a0a3f463a Pull up following revision(s) (requested by ozaki-r in ticket #1642):
sys/net/route.c: revision 1.237

route: run workqueue kthreads with KERNEL_LOCK unless NET_MPSAFE

Without KERNEL_LOCK, rt_timer_work and rt_free_work can run in parallel
with other LWPs running in the network stack, which eventually results
in say use-after-free of a deleted route.
2023-06-08 11:17:18 +00:00
martin 423383f8ab Pull up following revision(s) (requested by sborrill in ticket #1639):
sys/dev/ipmi.c: revision 1.10

Ignore non-recoverable and critical limits smaller than the warning limits.
These are usually invalid.

Name the limit flags to make code more readable.
2023-06-03 15:17:31 +00:00
martin 1c4711c40d Pull up following revision(s) (requested by abs in ticket #1638):
sys/arch/amiga/stand/loadbsd/loadbsd.c: revision 1.38
	distrib/amiga/stand/loadbsd.uue: revision 1.4
	sys/arch/amiga/stand/loadbsd/startit.s: revision 1.1
	sys/arch/amiga/stand/loadbsd/Makefile: revision 1.5
	sys/arch/amiga/stand/loadbsd/vmakefile: revision 1.1
	sys/arch/amiga/stand/loadbsd/README: revision 1.6

Update loadbsd source and distribution binary to version 3.3.
- Loading the kernel to the highest priority memory segment is default now.
- New option -l to revert the to the previous behaviour of largest segment.
- New option -M to define a minimum size for the memory segment.
- Fixed some warnings and typos.
- Put assembler inline source into its own source text startit.s.
- Can be built with Bebbo's gcc6 Amiga port or with vbcc.
2023-06-03 15:07:53 +00:00
martin eef842b365 Pull up following revision(s) (requested by rin in ticket #1637):
sys/dev/pci/if_aq.c: revision 1.45

aq(4): if_transmit: Invoke softint_schedule(9) with kpreempt disabled.
2023-06-03 14:46:07 +00:00
martin ac5c0db93c Pull up following revision(s) (requested by rin in ticket #1636):
sys/lib/libsa/subr_prf.c: revision 1.30

libsa/printf: Do not fetch long va_arg as long long.

This does real harm iff all of the following conditions are satisfied:
(1) On ILP32 architectures.
(2) Both LIBSA_PRINTF_LONGLONG_SUPPORT and LIBSA_PRINTF_WIDTH_SUPPORT
    compile-time options are enabled.
(3) Width field is used with 'l' modifier.

This is an implicit-fallthrough bug, but unfortunately, GCC 10.4 cannot
find this out somehow...
2023-06-03 14:35:18 +00:00
martin c315d92035 Apply patch, requested by manu in ticket #1632:
sys/arch/xen/conf/files.xen		(apply patch)

Build fix to define the SELFRELOC option for XEN kernels.
This is not needed in newer branches as those include amd64/conf/files.amd64
from x86/conf/files.x86 (and get the definition via that path)
2023-05-15 10:25:31 +00:00
martin 66a0de5235 Pull up following revision(s) (requested by chs in ticket #1633):
sys/ufs/ffs/ffs_snapshot.c: revision 1.155

ffs: apply the remaining ffs_snapshot.c part of this FreeBSD commit:
  commit 364ed814e7285c8216d8a201d3ab3674eb34ce29
  Author: Kirk McKusick <mckusick@FreeBSD.org>
  Date:   Thu Dec 9 21:24:00 2004 +0000
    Fixes a bug that caused UFS2 filesystems bigger than 2TB to
    prematurely report that they were full and/or to panic the kernel
    with the message ``ffs_clusteralloc: allocated out of group''.
    Submitted by:   Henry Whincup <henry@jot.to>
    MFC after:      1 week

all the other changes in that commit were applied previously by others:
 - sborrill commmitted ffs_alloc.c rev 1.123 in 2009
 - simonb committed ffs_alloc.c rev 1.110 in 2008
 - the ffs_clusteralloc() part is not needed because we no longer have
   that function.

fixes PR 57307
2023-05-13 12:23:13 +00:00
martin 8420f92950 Pull up following revision(s) (requested by manu in ticket #1632):
share/man/man8/man8.x86/boot.8: revision 1.27
	sys/arch/i386/stand/efiboot/version: revision 1.3
	share/man/man8/man8.x86/boot.8: revision 1.28 (via patch)
	share/man/man8/man8.x86/boot.8: revision 1.29 (via patch)
	sys/arch/i386/stand/lib/exec.c: revision 1.79
	sys/arch/i386/stand/efiboot/efiboot.c: revision 1.13
	sys/arch/i386/stand/efiboot/bootx64/efibootx64.c: revision 1.6
	sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.6
	sys/arch/i386/stand/efiboot/boot.c: revision 1.22
	sys/arch/amd64/amd64/locore.S: revision 1.219
	sys/arch/i386/stand/efiboot/bootia32/startprog32.S: revision 1.3
	sys/arch/i386/stand/efiboot/efiboot.h: revision 1.12
	sys/arch/amd64/conf/files.amd64: revision 1.121
	sys/arch/amd64/conf/std.amd64: revision 1.13
	share/man/man8/man8.x86/pxeboot.8: revision 1.6
	sys/arch/i386/stand/efiboot/bootx64/startprog64.S: revision 1.4
	sys/arch/amd64/amd64/locore.S: revision 1.220
	share/man/man8/man8.x86/dosboot.8: revision 1.4
	share/man/man4/options.4: revision 1.524

Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address

EFI bootstrap assumes it can copy the amd64 kernel to its ELF load
address (that is KERNTEXTOFF - KERNBASE = 0x200000), but it can
clash with previous UEFI memory allocation, as described here:
http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html

This change adds a reloc keyword for controling where the EFI
boostrap will copy the kernel image. Possible values are:
default - the default and prior behavior, copy at 0x200000.
none - do not copy and use the kernel image where it was loaded.
address - specify an explicit address where to copy the kernel.

This comes with an amd64 kernel patch that makes it self-relocatable.
It first discover where it was loaded in memory, and if this is
different than the expected 0x200000, hhe the kernel relocates
itself and start over at the right address.

Merge x86 boot options in x86/boot(8) and add undocumented UEFI options

We were supposed to keep the option list in x86/boot(8), x86/dosoot(8)
and x86/pxeboot(8) in sync, but it did not happen, hence it may work
better with all the options in x86/boot(8). Also add the undocumented
UEFI boot options.

Add a SELFRELOC kernel option for the sake of documentation clarity.
Instead of telling that x86/boot(8) reloc command needs a kernel able
to self relocate, we can tell it needs a kernel built with the
SELFRELOC option. This keeps the reader from wondering what could
make a kernel able to self relocate.

Remove XXX todo marker left by mistake

Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH
2023-05-13 11:45:53 +00:00
martin 56ff39a829 Pull up following revision(s) (requested by tsutsui in ticket #1628):
sys/arch/dreamcast/dev/microcode/aica_armcode.h: revision 1.5
	sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.4
	sys/arch/dreamcast/dev/microcode/aica_arm_locore.S: revision 1.5
	sys/arch/dreamcast/dev/microcode/Makefile: revision 1.6
	sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.7
	sys/arch/dreamcast/dev/microcode/aica_arm.c: revision 1.8

arm side of aica(4) sometimes became unresponsive when audioplay was performed several times.
- disabled data cache at startup.
- compiled with cross-arm-none-eabi-gcc-8.3.0nb4 of pkg.
- added memset() in asm because gcc8 (and later) detects the zero clear part in
  own bzero function and calls memset internally, and bzero were replaced with memset.
improve comment, update mailaddr, and remove clause 3 from my licenses.
2023-04-20 14:08:07 +00:00
martin 0ac828a033 Pull up following revision(s) (requested by tsutsui in ticket #1627):
sys/arch/luna68k/conf/Makefile.luna68k: revision 1.30

Fix missing locore.d dependency output on make depend.
Reported from isaki@.  Looks missed in rev 1.13 (22 years ago):

https://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/luna68k/conf/Makefile.luna68k#rev1.13
2023-04-20 13:47:02 +00:00
martin cb81130d74 Backout accidental commit (branch/ticket mismatch) 2023-04-19 16:45:37 +00:00
martin 2e5361aff4 Pull up following revision(s) (requested by tsutsui in ticket #1627):
sys/arch/luna68k/luna68k/mainbus.c: revision 1.20

Fix device name for xpbus at mainbus for LUNA-II, missed on psgpam merge.

Fortunately harmless because xpbus_match() doesn't check ma_name in
mainbus_attach_args.
2023-04-19 16:43:23 +00:00
martin 6ff454faa1 Pull up following revision(s) (requested by riastradh in ticket #1625):
sys/uvm/uvm_map.c: revision 1.403

mmap(2): Avoid arithmetic overflow in search for free space.

PR kern/56900
2023-04-01 16:22:14 +00:00
martin 6cb45a21d3 Pull up following revision(s) (requested by riastradh in ticket #1623):
sys/uvm/uvm_map.c: revision 1.396

uvm(9): Fix mmap optimization for topdown case.

PR kern/51393
2023-04-01 16:03:48 +00:00
martin e7f7424d79 Pull up following revision(s) (requested by riastradh in ticket #1622):
sys/uvm/uvm_map.c: revision 1.395

uvm(9): Fix 19-year-old bug in assertion about mmap hint.

Previously this would _first_ remember the original hint, and _then_
clamp the hint to the VM map's range:

        orig_hint = hint;
        if (hint < vm_map_min(map)) {   /* check ranges ... */
                if (flags & UVM_FLAG_FIXED) {
                        UVMHIST_LOG(maphist,"<- VA below map range",0,0,0,0);
                        return (NULL);
                }
                hint = vm_map_min(map);
        ...
        KASSERTMSG(!topdown || hint <= orig_hint, "hint: %#jx, orig_hint: %#jx",
            (uintmax_t)hint, (uintmax_t)orig_hint);

Even if nothing else happens in the ellipsis, taking the branch
guarantees the assertion will fail in the topdown case.
2023-04-01 16:00:28 +00:00
martin ad029167bd Pull up following revision(s) (requested by riastradh in ticket #1621):
sys/uvm/uvm_mmap.c: revision 1.180

mmap(2): If we fail with a hint, try again without it.
`Hint' here means nonzero addr, but no MAP_FIXED or MAP_TRYFIXED.

This is suboptimal -- we could teach uvm_mmap to do a fancier search
using the address as a hint.  But this should do for now.

Candidate fix for PR kern/55533.
2023-04-01 15:54:35 +00:00
martin e0d20e0298 Pull up following revision(s) (requested by riastradh in ticket #1620):
sys/compat/netbsd32/netbsd32_fs.c: revision 1.89

data_len == 0 on mount means "the kernel knows". Fixes amd on compat32.
2023-04-01 15:51:16 +00:00
martin 9450b6d742 Pull up following revision(s) (requested by riastradh in ticket #1617):
sys/nfs/nfs_serv.c: revision 1.184
	sys/nfs/nfs_srvsubs.c: revision 1.17
	sys/nfs/nfsm_subs.h: revision 1.56
	sys/nfs/nfsm_subs.h: revision 1.57

nfs: Use unsigned fhlen so we don't trip over negative values.

nfs: Avoid integer overflow in nfs_namei bounds check.

nfs: Use unsigned name lengths so we don't trip over negative ones.
- nfsm_strsiz is only used with uint32_t in callers, but let's not
  leave it as a rake to step on.
- nfsm_srvnamesiz is abused with signed s.  The internal conversion
  to unsigned serves to reject both negative and too-large values in
  such callers.
  XXX Should make all callers use unsigned, rather than flipping back
  and forth between signed and unsigned for name lengths.

nfs: Avoid free of uninitialized on bad name size in create, mknod.
XXX These error branches are a nightmare and need to be more
systematically cleaned up.  Even if they are correct now, they are
impossible to audit and extremely fragile in case anyone ever needs
to make other changes to them.
2023-03-30 11:59:24 +00:00
martin e354349144 Pull up following revision(s) (requested by ozaki-r in ticket #1615):
sys/netinet6/raw_ip6.c: revision 1.183 (via patch)
	sys/netinet6/ip6_output.c: revision 1.233

in6: reject setting negative values but -1 via setsockopt(IPV6_CHECKSUM)
Same as OpenBSD.

in6: make sure a user-specified checksum field is within a packet
From OpenBSD
2023-03-23 12:06:49 +00:00
martin 3a958457dc Pull up following revision(s) (requested by hannken in ticket #1614):
sys/dev/vnd.c: revision 1.288

Do not limit the number of pending requests for the worker thread.

With wedge on vnd it prevents a deadlock when requests get queued with
biodone() -> dkstart() -> vndstrategy().

Fixes PR kern/57263 "vnd locks up when using vn_rdwr"
2023-03-15 18:43:28 +00:00
martin ad8d7d81dc Pull up following revision(s) (requested by kardel in ticket #119):
sys/net/npf/npf_mbuf.c: revision 1.25
	sys/net/npf/npf.h: revision 1.64
	sys/net/npf/npf_sendpkt.c: revision 1.23

PR kern/56052:
allow block-return packets passed through without rule matching.
Included up-stream ashttps://github.com/rmind/npf/pull/115
2023-03-14 17:11:13 +00:00
martin 62ece7108d Pull up following revision(s) (requested by kardel in ticket #1612):
usr.sbin/npf/npf-params.7: revision 1.9
	sys/net/npf/npf_params.c: revision 1.6

PR kern/55654:

Switch default for parameter npf ip4.reassembly to 1.

This makes the NPF default configuration comply with host
requirements for IPv4.
2023-03-14 17:04:51 +00:00
martin c5f0fb4614 Pull up following revision(s) (requested by riastradh in ticket #1610):
sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

    SA_RESTART
        This flag affects the behavior of interruptible functions;
        that is, those specified to fail with errno set to [EINTR].
        If set, and a function specified as interruptible is
        interrupted by this signal, the function shall restart and
        shall not fail with [EINTR] unless otherwise specified.  If
        an interruptible function which uses a timeout is restarted,
        the duration of the timeout following the restart is set to
        an unspecified value that does not exceed the original
        timeout value.  If the flag is not set, interruptible
        functions interrupted by this signal shall fail with errno
        set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick <mckusick>
Date:   Tue Apr 10 19:36:33 1990 -0800
    eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- *     @(#)vfs_syscalls.c      7.42 (Berkeley) 3/26/90
+ *     @(#)vfs_syscalls.c      7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
        if (error = vn_open(ndp, fmode, (cmode & 07777) &~ S_ISVTX)) {
                crfree(fp->f_cred);
                fp->f_count--;
-               if (error == -1)        /* XXX from fdopen */
-                       return (0);     /* XXX from fdopen */
+               if (error == EJUSTRETURN)       /* XXX from fdopen */
+                       return (0);             /* XXX from fdopen */
+               if (error == ERESTART)
+                       error = EINTR;
                scp->sc_ofile[indx] = NULL;
                return (error);
        }

(found via this git import of the CSRG history:
cce2869b7a

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 +0000 (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:      2 weeks

Index: vfs_syscalls.c
===================================================================
--- vfs_syscalls.c      (revision 246471)
+++ vfs_syscalls.c      (revision 246472)
@@ -1106,8 +1106,6 @@
                                goto success;
                }
-               if (error == ERESTART)
-                       error = EINTR;
                goto bad;
        }
        td->td_dupfd = 0;

https://cgit.freebsd.org/src/commit/sys/kern/vfs_syscalls.c?id=2ca49983425886121b506cb5126b60a705afc38c">https://cgit.freebsd.org/src/commit/sys/kern/vfs_syscalls.c?id=2ca49983425886121b506cb5126b60a705afc38c

It's not clear to me that there's any reason to treat device nodes
specially here; in fact, if a driver's .d_open routine sleeps and is
woken by a concurrent revoke without a signal pending or with an
SA_RESTART signal pending, it is wrong for it to fail with EINTR.

But it MUST restart the whole system call rather than continue
sleeping in a loop or just exit the loop and continue to open,
because it is mandatory in the security model of revoke for open(2)
to retry the permissions check at that point.

PR kern/57260
2023-03-07 20:01:06 +00:00
martin 4d750db448 Pull up following revision(s) (requested by sekiya in ticket #1609):
sys/arch/arm/ti/if_cpsw.c: revision 1.17

Uncomment and protect sanity checks that would drop into the debugger with a
CPSW_DEBUG_DMA define.

This handles a condition where checking for DMA_RXEOQ in the received packet
results in the console being spammed with "rxeoq" messages, which soon results
in a kernel panic.  The corresponding Debugger() call for this check was
commented out.

The TI documentation ("AM335x and AMIC110 Sitara(TM) Processors Technical
Reference Manual") documents the EOQ bit thus:

        (14.3.2.4.1.2.4) This bit is set by the EMAC when the EMAC identifies
        that a descriptor is the last for a given packet received (also sets
        the EOP flag), and there are no more descriptors in the receive list
        (next descriptor pointer is NULL).  The software application can use
        this bit to detect when the EMAC receiver for the corresponding channel
        has halted. This is useful when the application appends additional free
        buffer descriptors to an active receive queue. Note that this flag is
        valid on EOP descriptors only.

Moving this check (and the offending printf() ) into a debug #ifdef results in
the BeagleBone Green surviving the nightly checks; it would always drop into
the debugger before this change.
2023-03-03 17:04:17 +00:00
martin cc8c8117a4 Pull up following revision(s) (requested by abs in ticket #1607):
sys/arch/amiga/stand/loadbsd/loadbsd.c: revision 1.37
	distrib/amiga/stand/loadbsd.uue: revision 1.3
	sys/arch/amiga/stand/loadbsd/Makefile: revision 1.4
	sys/arch/amiga/stand/loadbsd/README: revision 1.5

Update loadbsd source and distribution binary to version 3.2.

Including the following changes by Gunther Nikl:
- Added detection of A600.
- Fix handling of multiple -n options.
Make it compile with recent AmigaOS gcc ports (for example gcc6), as
older ports no longer work with current NetBSD header files.
2023-02-24 13:51:43 +00:00
martin 6c5eda55a7 Pull up following revision(s) (requested by riastradh in ticket #1605):
sys/net/bpf.c: revision 1.247 (manually merged)

bpf(4): Reject bogus timeout values before arithmetic overflows.
2023-02-22 19:50:33 +00:00
martin de765e5dd2 Pull up following revision(s) (requested by riastradh in ticket #1603):
sys/arch/x86/x86/efi_machdep.c: revision 1.3
	(applied to sys/arch/x86/x86/efi.c)

x86/efi: Print uuids in slightly more standard notation.

Anyone need a spare hyphen?  We had a few extras, apparently.
2023-02-22 19:20:45 +00:00
martin 587a9264f6 Pull up following revision(s) (requested by riastradh in ticket #1602):
sys/net/route.c: revision 1.236

route(4): Work around deadlock in rt_free wait path.
PR kern/56844
2023-02-22 18:53:56 +00:00
martin 62f4d2be02 Pull up following revision(s) (requested by tsutsui in ticket #1600):
sys/arch/next68k/stand/boot/en.c: revision 1.20
	sys/arch/next68k/stand/boot/scsi.c: revision 1.13
	sys/arch/next68k/stand/boot/scsi.c: revision 1.14
	sys/arch/next68k/stand/boot/conf.c: revision 1.8
	sys/arch/next68k/stand/boot/sd.c: revision 1.17
	sys/arch/next68k/stand/boot/samachdep.h: revision 1.1
	sys/arch/next68k/stand/boot/samachdep.h: revision 1.2
	sys/arch/next68k/stand/boot/rtc.c: revision 1.8
	sys/arch/next68k/stand/boot/machdep.c: revision 1.9
	sys/arch/next68k/stand/boot/boot.c: revision 1.14
	sys/arch/next68k/stand/boot/boot.c: revision 1.15
	sys/arch/next68k/stand/boot/scsivar.h: revision 1.2
	sys/arch/next68k/stand/boot/devopen.c: revision 1.8
	sys/arch/next68k/stand/boot/version: revision 1.7

Use common declarations and macros in proper headers.

Also fix inconsistent sdopen() and sdstrategy() args and
remove useless #if 0'ed out code.
No functional change.

Replace DELAY() with one in hp300 bootloader and adjust cpuspeed counts.

Fix boot failure on my ancient Seagate ST52160N drive.
It looks some of such old drives can't respond to SCSI
test-unit-ready command without proper wait after SCSI bus reset.

Bump version again to denote a fix.

XXX we should re-evaluate cpuspeed counts for DELAY() in bootloaders
    (where cache is disabled) on other m68k ports, hp300 and luna68k etc.

Actually bump version (missed in the previous commit).
2023-02-22 12:09:16 +00:00
martin 13ef3b7e97 Pull up following revision(s) (requested by nia in ticket #1599):
share/man/man4/urndis.4: revision 1.11
	sys/dev/usb/if_urndis.c: revision 1.48

urndis(4): Add OnePlus 5T to the quirky devices list. This allows it to
be attached as an urndis instead of ugen, and to transmit this commit
message across the tubes.

urndis.4: Add OnePlus 5T
2023-02-17 17:41:24 +00:00
martin 14e5b8b6da Regen for ticket #1599 2023-02-17 17:41:10 +00:00
martin 0471ec6f3d Pull up following revision(s) (requested by nia in ticket #1599):
sys/dev/usb/usbdevs: revision 1.807

Add OnePlus 5T
2023-02-17 17:40:28 +00:00
martin e39f040604 Pull up following revision(s) (requested by tsutsui in ticket #1598):
sys/arch/next68k/next68k/nextrom.h: revision 1.13
	sys/arch/next68k/dev/nextdisplayvar.h: revision 1.6
	sys/arch/next68k/dev/intiovar.h: revision 1.8
	sys/arch/next68k/dev/nextcons.c: revision 1.12
	sys/arch/next68k/next68k/locore.s: revision 1.69
	sys/arch/next68k/dev/nextcons.c: revision 1.13
	sys/arch/next68k/dev/nextcons.c: revision 1.14
	sys/arch/next68k/include/bus_space.h: revision 1.18
	sys/arch/next68k/dev/nextdisplay.c: revision 1.30
	sys/arch/next68k/include/bus_space.h: revision 1.19
	sys/arch/next68k/stand/boot/boot.c: revision 1.13
	sys/arch/next68k/next68k/nextrom.c: revision 1.28
	sys/arch/next68k/next68k/nextrom.c: revision 1.29
	sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.46
	sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.47
	sys/arch/next68k/include/cpu.h: revision 1.52
	sys/arch/next68k/dev/intio.c: revision 1.17 (patch)
	sys/arch/next68k/dev/intio.c: revision 1.18 (patch)
	sys/arch/next68k/dev/intio.c: revision 1.19 (patch)
	sys/arch/next68k/next68k/locore.s: revision 1.72
	sys/arch/next68k/stand/boot/version: revision 1.6
	sys/arch/next68k/include/bus_space.h: revision 1.21
	sys/arch/next68k/include/bus_space.h: revision 1.22
	sys/arch/next68k/dev/nextdisplay.c: revision 1.26
	sys/arch/next68k/include/bus_space.h: revision 1.23
	sys/arch/next68k/dev/nextdisplay.c: revision 1.27
	sys/arch/next68k/dev/nextdisplay.c: revision 1.28
	sys/arch/next68k/dev/nextdisplay.c: revision 1.29

 s/impliment/implement/ in comment.

Remove cargo-culted '#if 0' code that was designed to produce a
compile-time error if any of the bus_space_*_8 functions was used,
but was documented that it produces a link-time error.

Misc KNF and cosmetics.

Use proper C99 int types.

Remove trailing spaces and TABs.

Handle NeXT Turbo VRAM regions properly.
Info from Andreas Grabher on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/06/msg000052.html

Also refactor bus_space_map(9) and fix (unused) bus_space_mmap(9).

Add and check machine type NeXT_CUBE_TURBO (type 8).
Info from Andreas Grabher on port-next68k@.

NeXT Turbo Color doesn't have NEXT_P_C16_CMD_REG.
Info from Andreas Grabher on port-next68k@.

Bump version again to denote NeXT_CUBE_TURBO support.
2023-02-15 19:28:29 +00:00
martin 8d064fb69c Pull up following revision(s) (requested by tsutsui in ticket #1597):
sys/arch/next68k/conf/GENERIC: revision 1.155 (patch)

next68k:  Specify -fno-unwind-tables to shrink kernel binary size.

next68k bootloader cannot load a kernel larger than ~3.8 MB.
2023-02-15 19:19:38 +00:00
martin 6b5fa60b4d Pull up following revision(s) (requested by buhrow in ticket #1595):
sys/kern/subr_devsw.c: revision 1.50

        When a device driver calls devsw_attach() it has the option of attaching a block device
structure and a character device structure, or, just the character device structure.
With the existing code, if a driver elects not to attach a block device structure and if it
asks for a major number to be dynamically assigned to its character interface,
that driver will not be able to detach and reattach its character driver interface.  This is a very
long standing bug which didn't come to light until we began using loadable kernel modules more
heavily.  this patch fixes this problem.  With this patch in place, drivers that implement only
a character device interface may detach and reattach that character interface as often as they
need to.

Fixes PR kern/57229
2023-02-14 16:19:00 +00:00
martin 9c1c9756e2 Pull up following revision(s) (requested by manu in ticket #1594):
sys/dev/usb/u3g.c: revision 1.44

Add support for ZTE MF112 and D-Link DWM222 3G USB modems
2023-02-14 16:10:00 +00:00
martin 50f9f91407 Pull up following revision(s) (requested by tsutsui in ticket #1591):
sys/arch/next68k/stand/boot/scsi.c: revision 1.11
	sys/arch/next68k/stand/boot/sd.c: revision 1.13
	sys/arch/next68k/stand/boot/scsi.c: revision 1.12
	sys/arch/next68k/stand/boot/sd.c: revision 1.14
	sys/arch/next68k/stand/boot/sd.c: revision 1.15
	sys/arch/next68k/stand/boot/sd.c: revision 1.16
	sys/arch/next68k/stand/boot/rtc.c: revision 1.7
	sys/arch/next68k/stand/boot/dmareg.h: revision 1.4
	sys/arch/next68k/stand/boot/machdep.c: revision 1.8
	sys/arch/next68k/stand/boot/srt0.s: revision 1.3
	sys/arch/next68k/stand/boot/README: revision 1.2
	sys/arch/next68k/stand/boot/devopen.c: revision 1.7
	sys/arch/next68k/stand/boot/Makefile: revision 1.30
	sys/arch/next68k/stand/boot/Makefile: revision 1.31
	sys/arch/next68k/stand/boot/version: revision 1.5

Remove trailing spaces and TABs.

Make sure to specify volatile explicitly on DMA register accesses.

It looks booting from SCSI disks on next68k have been broken
since NetBSD 1.6 days, but now it works.

Avoid possible division by zero trap in error cases to make debug easier.

Request only 36 bytes for a response of INQUIRY command for legacy drives.
Some drives don't respond larger requested size for newer
SCSI3 devices and not all drivers can handle short xfers.
We should fix drivers to handle such short xfers properly,
but we need only SCSI device type here (and the 36 bytes are
enough even if we want vendor and product names on a bootloader).
The problem is reported from Andreas Grabher (a maintainer of NeXT
Computer Emulator) on port-next68k@:
 https://mail-index.netbsd.org/port-next68k/2023/02/thread1.html

Disable DEBUG options properly.

Bump version to 1.6 to denote recent bootloader's >20 years old bug fixes.
2023-02-12 12:22:44 +00:00
martin 6676131d63 Pull up following revision(s) (requested by tsutsui in ticket #1590):
sys/arch/next68k/include/vmparam.h: revision 1.29
	sys/arch/next68k/next68k/machdep.c: revision 1.118
	sys/arch/next68k/include/param.h: revision 1.13
	sys/arch/next68k/next68k/pmap_bootstrap.c: revision 1.45
	sys/arch/next68k/next68k/locore.s: revision 1.70
	sys/arch/next68k/next68k/locore.s: revision 1.71

Use explicit CPU strings and remove hp300 derived stuff.

Remove #ifdef'ed out hp300 specific stuff.

Remove leftover "last kernel PT page" settings derived from hp300.

Whilehere, also remove VM definitions for obsolete COMPAT_HPUX stuff.

All hp300 machines has RAMs at a region from the highest address
i.e. 0xFFFFFFFF to smaller address (as HP claims "it's the MSB first"),
so kernels have to prepare PA==KVA mappings as the "last PT page" to
guarantee the running kernel works both before and after the MMU is
turned on.  For such a special mapping, we have to set up necessary
segment table and page table during early startup, in pmap_bootstrap()
invoked from locore.s.

On the other hand, NeXT machines have RAMs at a region from 0x40000000
to below (i.e. to larger address) so we still need a PA==KVA mapping.
However currently NetBSD/next68k just uses the transparent translation
registers to achieve the PA==KVA mapping, so unlike hp300 we don't have
to prepare special segment table and page table for it.

Note many other m68k ports (like luna68k, news68k, x68k etc.) have
RAMs at a region from 0x00000000 so usually we can assume PA==KVA
and don't have to bother to prepare such speicial mappings.

No user visible changes (except now freed wasted pages for the tables).

Tested on my NeXTstation slab.
2023-02-12 11:47:10 +00:00
martin 6a8fda3af3 Pull up following revision(s) (requested by tsutsui in ticket #1589):
sys/arch/i386/conf/GENERIC: revision 1.1243

Enable options DISKLABEL_EI by default as amd64.

No particular comment no port-i386@:
https://mail-index.netbsd.org/port-i386/2022/12/02/msg004063.html
2023-02-12 11:43:29 +00:00
martin e5224cc784 Pull up following revision(s) (requested by hgutch in ticket #1588):
sys/arch/sparc64/include/vmparam.h: revision 1.43

Avoid using (1<<64)-1 for VM_MAX{,USER}_ADDRESS as rounding that up to
the next page boundary gives 0 and instead make the VA space end one
page earlier.

Fixes PR sparc64/57219.
2023-02-08 16:42:12 +00:00