Commit Graph

147384 Commits

Author SHA1 Message Date
martin fdc63a2d7b Pull up following revision(s) (requested by bouyer in ticket #1443):
sys/arch/x86/x86/pmap.c: revision 1.414

return after calling xen_pagezero(), don't fall back to the legacy
pmap_zero_page() method.

This should only affect performances.
2022-05-13 11:10:38 +00:00
martin 8af23c37cf Pull up following revision(s) (requested by gavan in ticket #1441):
sys/nfs/nfs_vfsops.c: revision 1.243

Don't pretend that files are limited to 1TB on NFSv3.
2022-05-04 17:51:20 +00:00
sborrill 9c1b890c98 Pull up the following revisions(s) (requested by martin in ticket #1442):
sys/net/if_pppoe.c:	revision 1.179

pppoe(4): fix CVE-2022-29867 - discovery phase local network
mbuf corruption.
2022-05-04 15:08:47 +00:00
martin 4902d0e29a Pull up following revision(s) (requested by hannken in ticket #1440):
usr.sbin/quotaon/quotaon.c: revision 1.31
	lib/libquota/quota_oldfiles.c: revision 1.10
	sys/ufs/ufs/ufs_quota1.c: revision 1.25

Fix default quota file names, both user and group quota used the
same default name "QUOTAFILENAME, names[USRQUOTA])" resulting in
diagnostic assertion and possibly corrupted quota data.

Keep flag "UFS_QUOTA" set until the last quota is closed.
Prevents a live lock when dqrele() finds a struct with "dq_cnt == 1"
and flag "DQ_MOD" and cannot sync as flag UFS_QUOTA is unset.

As the quota type comes from the kernel and is only valid when
quota is on get the type before quota_off and after quota_on.
2022-04-27 16:53:32 +00:00
martin aefc4e8caa Pull up following revision(s) (requested by reinoud in ticket #1438):
sys/compat/netbsd32/netbsd32.h: revision 1.140
	sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
	sys/fs/udf/udf_subr.c: revision 1.169

Fix endian issue with UDF extended attribute handling

Implement support for mounting UDF in compat32
Fixes PR#56801
2022-04-24 16:39:00 +00:00
martin c3ae8fb2fb Pull up following revision(s) (requested by reinoud in ticket #1437):
sys/fs/udf/udf_allocation.c: revision 1.46

Revere modification of initializer; it can lead to race conditions where two
allocation would pick the `empty' space causing a panic later on.
2022-04-18 10:54:21 +00:00
martin f4ae59f1f3 Pull up following revision(s) (requested by perseant in ticket #1435):
sys/dev/ata/ata.c: revision 1.167

Avoid an unaccounted extra channel freeze, if a reset is requested
more than once before the thread services the request. Closes PR#56745.
2022-03-15 18:00:26 +00:00
martin 8a50d16483 Pull up following revision(s), all via patch,
requested by reinoud in ticket #1432:

	sys/fs/udf/udf_vfsops.c: revision 1.83
	sys/fs/udf/udf_allocation.c: revision 1.45
	sys/fs/udf/udf_subr.c: revision 1.160
	sys/fs/udf/udf_subr.c: revision 1.161

While searching the VAT on recordable media, search the last sector too!
This fixes Win10 formatted discs from being mounted incorrectly.

Make sysctl udf.verbose dependent on UDF_DEBUG instead of DEBUG

Fix serious issue with recordable media formatted with Win10. When closing it
after modification the VAT was written out corrupted making the disc
unreadable anymore on remount. Thanks for ig@ for spotting it in the wild!

On freeing a virtual address in the VAT, use the correct value; this might
confuse other implementations who can reject the VAT on this.
2022-03-13 09:48:32 +00:00
martin 8fe75058e5 Pull up following revision(s) (requested by reinoud in ticket #1431):
sys/fs/udf/udf_strat_sequential.c: revision 1.16
	sys/fs/udf/udf_subr.c: revision 1.167

On switching from writing to reading explicitly synchronize the caches. It
isn't strictly needed but some devices in the wild will otherwise bluntly
ignore all reading commands resulting in a kernel and device lockup.

For bug-compatibility with Windows, the last VAT sector must be a multiple of
16/32 from the start of the track.  To allow for scratches, write out at least
a 32 pieces.
2022-03-13 09:44:33 +00:00
martin bbe0de7840 Pull up following revision(s) (requested by jakllsch in ticket #1428):
sys/dev/usb/uhidev.c: revision 1.82

Do not explicitly set the HID Report Protocol upon attach, some devices
don't like it and should be in Report Protocol after enumeration/reset
anyway.

May address PR kern/55019.
2022-02-16 14:36:12 +00:00
martin 46278ebb46 Pull up following revision(s) (requested by jdolecek in ticket #1426):
sys/dev/ata/ata_recovery.c: revision 1.3
	sys/dev/ata/ata_subr.c: revision 1.9

stop xfer timeouts during recovery, all xfers will be requeued anyway
this avoids race with the timeout routine when processing the xfers
for requeueing

should fix PR kern/54790 by Izumi Tsutsui
2022-02-08 14:45:00 +00:00
martin bf86ce2e65 Pull up the following revisions (requested by msaitoh in ticket #1424):
sys/dev/pci/ixgbe/ix_txrx.c			1.95
	sys/dev/pci/ixgbe/ixgbe.c			1.305 via patch
	sys/dev/pci/ixgbe/ixgbe_mbx.c			1.19
	sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.15-1.16
	sys/dev/pci/ixgbe/ixv.c				1.178 via patch

Use atomic_{load,store}_relaxed() for event counters.
2022-02-02 14:25:49 +00:00
martin c314aa268b Pull up following revision(s) (requested by reinoud in ticket #1421):
sys/dev/scsipi/cd.c: revision 1.351

Limit buffer size for device capabilities requests as a work-around for PR
kern/56109.
2022-02-01 11:41:29 +00:00
martin 1ea7fc2e21 Pull up the following revisions, requested by msaitoh in ticket #1420:
sys/dev/pci/ixgbe/ixgbe.c			1.264,1.269,1.272,
							1.306 via patch

Four INTx related fixes:
- Fix a bug that the all interrupt sources are enabled when the
  interface is UP and the INTx line is shared with other devices.
- Fix a bug that it might incorrectly enable interrupt when
  IFF_RUNNING is not set.
- Don't process TX/RX if a queue interrupt isn't occurred.
- Increment legacy interrupt counter after checking INTx sharing.
2022-02-01 11:35:45 +00:00
martin 4fc8155947 Pull up following revision(s) (requested by msaitoh in ticket #1419):
sys/arch/x86/x86/procfs_machdep.c: revision 1.43
	sys/arch/x86/x86/procfs_machdep.c: revision 1.44

Update for cpuid flags:
  - The table 11 was changed from CPUID 0x0f leaf 0 %edx to a Linux mapping.
  - The table 12 was changed from CPUID 0x0f leaf 1 %edx to CPUID 0x07 leaf 1
    %edx. Print avx_vnni and avx512_bf16.
  - Print cppc, enqcmd and arch_lbr.
  - Modify linux mapping. No used on NetBSD.

Fix procfs_machdep.c rev. 1.143. Print CPUID 0x00000007:1 %eax correctly.
2022-01-31 17:54:59 +00:00
martin 44d58e7ef0 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1417:

	sys/arch/x86/include/specialreg.h		1.179-1.188

- Add CPUID definitions of Last Branch Record, Thread Director,
  AVX version of VNNI, Fast short REP MOV, HRESET, PPIN, Architectural
  LBR, Linear Address Masking and Hybrid Information from the latest
  Intel SDM.
- Add CPUID definitions of AddrMaskExt, INT_WBINVD, IbrsSameMode,
  EferLmsleUnsupported, PSFD and SecureTSC from AMD APM.
- Print CLFSH instead of CLFLUSH because both Intel and AMD documents
  say so.
- Modify comment. Add comment. Fix typo. Use __BIT(). KNF. Sort lines.
  No functional change.
2022-01-31 17:42:17 +00:00
martin b2ec9c35a8 Pull up following revision(s) (requested by msaitoh in ticket #1416):
sys/dev/pci/ixgbe/ixgbe_mbx.h: revision 1.19
	sys/dev/pci/ixgbe/ixgbe_vf.c: revision 1.31
	sys/dev/pci/ixgbe/ixgbe_x540.c: revision 1.23
	sys/dev/pci/ixgbe/if_sriov.c: revision 1.17
	sys/dev/pci/ixgbe/ixv.c: revision 1.172
	sys/dev/pci/ixgbe/ixv.c: revision 1.173
	sys/dev/pci/ixgbe/ixgbe.c: revision 1.301
	sys/dev/pci/ixgbe/ixgbe_type.h: revision 1.55
	sys/dev/pci/ixgbe/ixgbe_82599.c: revision 1.29
	sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.16
	sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.17
	sys/dev/pci/ixgbe/ixgbe_mbx.c: revision 1.18

Add code to support API version 1.5. No functional change.
   - This change adds almost all code to support API 1.5 except real negotiation
     and upgrade mailbox functions.
   - From ix-3.3.18, ix-3.3.22 and ixv-1.5.24.

Enable mailbox API 1.5 support. Tested on ESXi with ixgben 1.10.3.0.

Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_vf().
Don't clear mailbox related counters in ixgbe_upgrade_mbx_params_pf().
2022-01-31 17:36:25 +00:00
martin 790ffd29bd Pull up following revision(s) (requested by riastradh in ticket #1415):
sys/dev/usb/usbnet.c: revision 1.44 (via patch)

usbnet: Defer hardware multicast filter updates to USB task.

Breaks deadlock:
- usbnet_detach holds usbnet lock, awaits kpause in ure_reset
- callout holds softclock `lock' (sequential softints, blocks kpause
  wakeup), awaits softnet_lock in tcp_timer_keep, frag6_fasttimo, &c.
- soclose holds softnet_lock, awaits usbnet lock in SIOCDELMULTI

This change breaks the deadlock by not passing the SIOCADDMULTI or
SIOCDELMULTI ioctl synchronously to the driver, which typically takes
the usbnet lock.

With this change, the ethernet layer still maintains the list of
multicast addresses synchronously, but we defer the driver logic that
updates the hardware multicast filter to an asynchronous USB task
without softnet_lock held.

This doesn't cause exactly the same ioctl to be sent to the driver --
usbnet just sends SIOCDELMULTI with an all-zero struct ifreq, and
might drop some ioctls if issued in quick succession.  This is OK
because none of the drivers actually distinguish between SIOCADDMULTI
and SIOCDELMULTI, or examine the argument; the drivers just commit
whatever multicast addresses are listed in the ethercom.

Other than the different ioctl submitted, there is no change to the
ABI or locking scheme of usbnet, so this is safe to pull up to
netbsd-9.  This means we unfortunately can't guarantee that if a
process issues SIOCADDMULTI and then sendto, the multicast filter
update will be done by the time of the sendto -- and, more
importantly, the packets received in reply to it.  But failing to
guarantee that is better than deadlocking!  Later changes on HEAD
will restore the synchronous multicast filter updates with much more
extensive ABI changes and API simplifications in usbnet(9).
Proposed on tech-net:

https://mail-index.netbsd.org/tech-net/2021/12/30/msg008164.html

XXX pullup-9
2022-01-31 17:30:21 +00:00
martin 2d27bb5999 Pull up the following revisions, requested by msaitoh in ticket #1414:
sys/dev/pci/ixgbe/if_sriov.c			1.12-1.16
	sys/dev/pci/ixgbe/ixgbe.c			1.295-1.297,1.300,1.304 via patch
	sys/dev/pci/ixgbe/ixgbe.h			1.84
	sys/dev/pci/ixgbe/ixgbe_82598.c			1.17-1.18
	sys/dev/pci/ixgbe/ixgbe_82598.h			1.9
	sys/dev/pci/ixgbe/ixgbe_82599.c			1.24-1.28
	sys/dev/pci/ixgbe/ixgbe_82599.h			1.8
	sys/dev/pci/ixgbe/ixgbe_api.c			1.26-1.27
	sys/dev/pci/ixgbe/ixgbe_api.h			1.16
	sys/dev/pci/ixgbe/ixgbe_bypass.h		1.3
	sys/dev/pci/ixgbe/ixgbe_common.c		1.34-1.42
	sys/dev/pci/ixgbe/ixgbe_common.h		1.15-1.16
	sys/dev/pci/ixgbe/ixgbe_dcb.c			1.12-1.13
	sys/dev/pci/ixgbe/ixgbe_dcb.h			1.8-1.9
	sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.10-1.12
	sys/dev/pci/ixgbe/ixgbe_dcb_82598.h		1.8
	sys/dev/pci/ixgbe/ixgbe_dcb_82599.c		1.10-1.11
	sys/dev/pci/ixgbe/ixgbe_dcb_82599.h		1.8
	sys/dev/pci/ixgbe/ixgbe_fdir.h			1.4
	sys/dev/pci/ixgbe/ixgbe_features.h		1.4
	sys/dev/pci/ixgbe/ixgbe_mbx.c			1.13-1.15
	sys/dev/pci/ixgbe/ixgbe_mbx.h			1.15-1.18
	sys/dev/pci/ixgbe/ixgbe_netmap.c		1.5
	sys/dev/pci/ixgbe/ixgbe_osdep.c			1.8
	sys/dev/pci/ixgbe/ixgbe_osdep.h			1.31
	sys/dev/pci/ixgbe/ixgbe_phy.c			1.25-1.29
	sys/dev/pci/ixgbe/ixgbe_phy.h			1.13
	sys/dev/pci/ixgbe/ixgbe_rss.h			1.6
	sys/dev/pci/ixgbe/ixgbe_sriov.h			1.5
	sys/dev/pci/ixgbe/ixgbe_type.h			1.51-1.54
	sys/dev/pci/ixgbe/ixgbe_vf.c			1.28-1.29
	sys/dev/pci/ixgbe/ixgbe_vf.h			1.15
	sys/dev/pci/ixgbe/ixgbe_x540.c			1.20-1.22
	sys/dev/pci/ixgbe/ixgbe_x540.h			1.10
	sys/dev/pci/ixgbe/ixgbe_x550.c			1.21-1.25
	sys/dev/pci/ixgbe/ixgbe_x550.h			1.7
	sys/dev/pci/ixgbe/ixv.c				1.170, 1.174-1.175 via patch

- Add typecast for type mismatch.
- Fix retry count calculation of I2C read/write.
- Wait longer for link after fiber MAC setup.
- ixv(4): Use adapter->mta for the multicast array memory instead of
  the on-stack array.
- Match X550_PHY_ID correctly on X550.
- Print NVM image version on 82598.
- Use 64bit for lxon + lxoff.
- Don't expose garbage data of hw.ixvN.debug.
- Some NetBSD unrelated changes:
  - Fix infinite recursion on PCIe link down if VMDQ is used.
  - Move PF mailbox initialization from ixgbe_attach() to
    ixgbe_init_iov().
  - Add IPv6 mask for flow director.
  - Change error level in ixgbe_fc_autoneg().
  - Check host interface return status when writing NVM.
  - Change DCB credit parameters.
- Restore some mailbox related functions. Revert part of ixgbe_mbx.c
  rev. 1.7 and ixgbe_mbx.h rev. 1.11. No functional change.
- Rename IXGBE_VT_MSGTYPE_{ACK,NACK} to
  IXGBE_VT_MSGTYPE_{SUCCESS,FAILURE}. No functional change.
- Remove unused argument. Change argument.
- Remove unnecessary return value check.
- Remove debug error message.
- Remove dead code.
- Add some unused macros.
- Fix typo in comment.
- Rename some functions.
- Sort lines, modify comment.
- Whitespace fix.
2022-01-30 15:58:28 +00:00
martin 389ea3ab4a Pull up the following revisions, requested by msaitoh in ticket #1412:
sys/dev/pci/pci_subr.c				1.232-1.239 via patch
	sys/dev/pci/pcireg.h				1.62-1.63

- Decode link control2's Compliance Preset/De-emphasis more.
- Decode Physical Layer 16.0 GT/s extended capability.
- Decode Lane Margining at the Receiver extended capability.
- Print "reserved" instead of "unknown" when printing equalization
  preset. One of them is known to be the default value.
- Fix typo.
2022-01-29 17:08:33 +00:00
martin 659719ee95 Pull up following revision(s) (requested by msaitoh in ticket #1411):
sys/net/ppp_tty.c: revision 1.68
	sys/net/ppp_tty.c: revision 1.69

Use unsigned to avoid undefined behavior in pppasyncstart().

Use unsigned to avoid undefined behavior. Found by kUBSan.
2022-01-29 17:03:53 +00:00
martin 81d525ed96 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1410:

	sys/dev/mii/makphy.c				1.67,1.69-1.72
	sys/dev/mii/makphyvar.h				1.3-1.4

- Add I347-AT4 support.
- Add three workarounds for QEMU e1000:
  - QEMU sets BMSR_EXTSTAT but the access to register 15 fails.
    Set EXTSR_1000TFDX and EXTSR_1000THDX if the access failed in the
    attach function. It's just a cosmetic change.
  - Marvell 88E1[01]11 have the Fiber/Copper auto selection feature,
    but QEMU doesn't implement it. If the register access failed,
    the media is regarded as copper only. It's just a cosmetic change.
  - QEMU provides the PHY specific status register at 0x11 but the
    link indication bit (PSSR_LINK) is always 1. It causes
    "virsh domif-setlink xxx yyy down" doesn't work. To avoid this
    problem, read the BMSR and check the BMSR_LINK bit. Add
    MAKPHY_QUIRK_PSSR_LINK bit for this quirk. Set it if MII_EXTSR
    doesn't exist because it's one of the case of QEMU.
- Reduce the number of access to the ESSR register. One of the reason
  is that the register is not implemented on QEMU. Another reason is
  that it's not required to access the register if the device is in
  the copper only mode.
2022-01-29 16:59:31 +00:00
martin 97765c4c7c Pull up following revision(s) (requested by msaitoh in ticket #1409):
sys/dev/mii/igphy.c: revision 1.37
	sys/dev/mii/ihphy.c: revision 1.19
	sys/dev/mii/makphy.c: revision 1.68

  Fix a bug that "ifconfig xx0 media none" set LINK_STATE_UNKNOWN instead of
LINK_STATE_DOWN.

XXX We should check for other PHY drivers, too.
2022-01-29 16:54:42 +00:00
martin 4ef7f4f072 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1408:

	sys/dev/pci/ixgbe/ixgbe_vf.h			1.16-1.17
	sys/dev/pci/ixgbe/ixv.c				1.176-1.177

Make ifconfig -z ixvN clear event counter.
2022-01-29 16:43:23 +00:00
martin 5413c3de38 Pullup the following revisions, requested by msaitoh:
sys/dev/pci/ixgbe/ixgbe.c			1.298, 1.303 via patch

Add some missing error counters to ierror.
2022-01-29 16:33:10 +00:00
martin 3f84e144b6 Pull up following revision(s) (requested by riastradh in ticket #1399):
sys/dev/acpi/acpi_display.c: revision 1.21

acpiout(4): Work around firmware that doesn't like some brightnesses.

Instead of just asking for cur - 5 or cur + 5, repeatedly ask for
that increment, check whether we actually made progress in that
direction, and if not keep going with another increment, until we hit
the bounds of brightness levels.

I can't find anything in the ACPI spec about this, but my laptop
seems to have trouble with certain levels: 15, 75, 85, 95.  It goes
in all other increments of 5 from 5 to 100, just not those ones --
acts as if the change just never happened, so with the old logic the
brightness up/down would get stuck unable to move in either
direction.

This should have no impact on machines where the first increment
actually takes.
2022-01-20 11:42:22 +00:00
snj e602d4409c Pull up following revision(s) (requested by martin in ticket #1405):
sys/dev/usb/usb_quirks.c: revision 1.102

Ignore new APC UPS devices when matching uhid devices.
2022-01-18 20:02:23 +00:00
snj 260a0190a2 regen for ticket 1404 2022-01-18 19:59:58 +00:00
snj 659c853e5a Pull up following revision(s) (requested by martin in ticket #1404):
sys/dev/usb/usbdevs: revision 1.800

Add a new APC UPS device id.
2022-01-18 19:58:54 +00:00
martin 98835de856 Pull up following revision(s) (requested by bouyer in ticket #1403):
sys/dev/usb/usb_quirks.c: revision 1.103

Add UQ_HID_IGNORE for the Microchip PICkit2 and 3 programmers.
2022-01-18 18:48:00 +00:00
martin 4e4fa51a53 Regen for ticket #1402 (add Microchip PICkit3 programmer) 2022-01-18 18:46:19 +00:00
martin 86a88ab122 Pull up following revision(s) (requested by bouyer in ticket #1402):
sys/dev/usb/usbdevs: revision 1.801

Add the Microchip PICkit3 programmer
2022-01-18 18:45:23 +00:00
martin cb56d20bd5 Pull up following revision(s) (requested by jnemeth in ticket #1401):
sys/conf/copyright: revision 1.20

Welcome to 2022!
2022-01-08 13:23:46 +00:00
martin 63c05c827b Pull up following revision(s) (requested by riastradh in ticket #1398):
sys/dev/cgd.c: revision 1.142

cgd(4): Fix criterion for detach when wedgies are held.

The somewhat confusingly named DK_BUSY(dksc, pmask) answers the
following question:

        Suppose I hold either the character or the block device (but
        not both) of all of the partitions in pmask.  Is anyone else
        using the disk, rendering it unsafe to detach?

This is useful for ioctls like CGDIOCCLR and VNDIOCCLR, which must be
issued on open file descriptors for the disk, so the question cannot
simply be answered by testing whether dk_openmask != 0.
Instead, DK_BUSY breaks the question into the following criteria:

        1. Are there any _other_ partitions than those in pmask open
           at all?  If so, it must be someone else, since I only hold
           partitions in pmask -- hence the disk is busy.
        2. Are any of the partitions in pmask open _both_ as a block
           device _and_ as a character device?  If so, it must be
           someone else, since I only hold _either_ the character
           _or_ the block device open but not both -- hence the disk
           is busy.

When config_detach_all runs at shutdown time, it tries to detach
cgd(4), which has DVF_DETACH_SHUTDOWN; this is important so we submit
queued writes to the underlying disk and wait for them to complete
with dk_drain.

If cgd(4) has any dk wedges with file systems mounted still
configured on it, it isn't ready to detach yet.  But asking
DK_BUSY(dksc, 1 << RAW_PART) returns false, because the dk wedges
only hold RAW_PART open as a block device -- so if nobody has
RAW_PART open as a character device, or any other partitions open,
cgd_detach blithely goes on its way to forcibly detach the wedges.

Instead, ask DK_BUSY(dksc, 0), because the caller -- cgd_detach
issued by config_detach_all -- does not, in fact, hold any partitions
open, so it doesn't need to work around them like ioctl(CGDIOCCLR)
does.  Fixes hang in zfs on dk on cgd during shutdown (and probably
also zfs on cgd without any intervening dk but I haven't tested).

(This change might have the side effect that `drvctl -d cgdN' doesn't
work, but I don't care.)

XXX pullup-9
XXX pullup-8 (...-7, -6, -5...)
2021-12-30 12:38:22 +00:00
martin 5f162c25eb Pull up following revision(s) (requested by riastradh in ticket #1397):
sys/dev/pckbport/synaptics.c: revision 1.71

synaptics(4): New sysctl knob for debug output.

Set hw.synaptics.debug=1 to re-enable it; the compile-time DIAGNOSTIC
option was inappropriate for this.
2021-12-30 12:28:56 +00:00
martin dd0fef1b48 Pull up the following (all via patch), requested by msaitoh in ticket #1396:
usr.sbin/cpuctl/arch/i386.c			1.118-1.119, 1.121-1.122
	usr.sbin/cpuctl/arch/cpuctl_i386.h		1.6
	sys/arch/x86/x86/identcpu_subr.c		1.8-1.9
	sys/arch/x86/x86/identcpu.c			1.123
	sys/arch/x86/include/cacheinfo.h		1.30
	sys/arch/x86/include/cpu.h			1.132

- Fix a bug that some TLB related lines were not printed.
- Fix a bug that STLB is printed as DTLB.
- If a TLB is variable sized, print the max size instead of error message.
- Cosmetic changes to improve readability.
2021-12-24 12:58:14 +00:00
martin a726a6b95f Pull up following revision(s) (requested by mrg in ticket #1395):
sys/dev/usb/usb_quirks.c: revision 1.101

add two additional cyperpower ups ids for ignore hid.
2021-12-19 16:38:24 +00:00
martin 8526225ecb regen for ticket #1395 (add two more models of cyperpower UPS) 2021-12-19 16:37:21 +00:00
martin 33e8da80d6 Pull up following revision(s) (requested by mrg in ticket #1395):
sys/dev/usb/usbdevs: revision 1.799

add two more models of cyperpower UPS.
2021-12-19 16:34:39 +00:00
martin 556ae0266b Pull up following revision(s) (requested by mrg in ticket #1394):
sys/dev/raidframe/rf_diskqueue.c: revision 1.63 (patch)

call buf_destroy() after buf_init().  hopefully fixes the lockdebug
problem shown here:

   http://mail-index.netbsd.org/tech-kern/2021/12/10/msg027851.html

but seems unlikely to fix the original problem.

tested on i386/anita.  ok oster@

XXX: pullup-9 (netbsd-8 uses old APIs.)
2021-12-19 16:29:43 +00:00
martin 38524e1360 Pull up following revision(s) (requested by riastradh in ticket #1393):
sys/dev/cgd.c: revision 1.141

cgd(4): Wait for worker threads to complete before destroying mutex.

Fixes PR kern/56546 (probably!).
2021-12-14 19:05:11 +00:00
martin c5596d959f Pull up following revision(s) (requested by hauke in ticket #1392):
sys/dev/ipmi.c: revision 1.6
	sys/dev/ipmi.c: revision 1.7
	sys/dev/ipmi.c: revision 1.8
	sys/dev/ipmi.c: revision 1.9

Fail open when ipmi device was found.
Clear sc_envsys on failure to prevent double-free.

ipmi(4): Use config_pending_incr/decr.
Don't abuse autoconf's private (and incoherent) dv_flags.

ipmi(4): Notify config_pending_decr when ready, not when dying.
Should fix hang at boot.

ipmi(4): Tidy up ipmi_thread a little.
- Join on detach -- don't free anything until thread has exited; thread
  may still be using stuff.
- Nix dead error branch -- malloc(M_WAITOK) cannot fail.
- x = malloc(sizeof(x[0]) * n), not x = malloc(sizeof(type_t) * n)
2021-12-08 15:50:13 +00:00
martin e385cfa46b Pull up the following revisions, requested by msaitoh in ticket #1391:
sys/arch/x86/include/specialreg.h		1.171, 1.173-1.178
	sys/arch/x86/x86/identcpu.c			1.106, 1.117,
							1.122 via patch
	sys/dev/nvmm/x86/nvmm_x86.c			1.18
	sys/external/bsd/drm2/drm/drm_cache.c		1.14
	sys/external/bsd/drm2/include/asm/cpufeature.h	1.5
	usr.sbin/cpuctl/arch/i386.c			1.114-1.117


- Add LA57, PKE, PKS, CET, CET_U, CET_S, HWP, KL, AVX512_BF16, TME_EN
  and PCONFIG.
- Rename some macros to match the x86 specification and the other OSes.
- Print CPUID 0x8000008 %ebx on Intel, too.
- Print CPUID leaf 7 subleaf 1.
- Identify Tiger Lake, 3rd gen Xeon Scalable (Ice Lake), Elkhart Lake
  and Jasper Lake.
- Add comment.
- KNF. Whitespace fix.
2021-12-08 15:44:16 +00:00
martin ad0fe26214 Pull up following revision(s) (requested by msaitoh in ticket #1390):
sys/arch/x86/x86/identcpu.c: revision 1.121

make a numeric literal unsigned as it is bit-negated.
2021-12-07 12:39:23 +00:00
martin a6612aa946 Pull up following revision(s) (requested by msaitoh in ticket #1389):
sys/arch/x86/x86/identcpu.c: revision 1.103
	sys/arch/x86/x86/identcpu.c: revision 1.104
	sys/arch/x86/x86/identcpu.c: revision 1.105

Add EX2 for Vortex86 SoCs (Andrius V)

use __arraycount, and fix comparison

flip the comparison again
2021-12-07 12:35:27 +00:00
martin 78c020d983 Pull up the following revisions, requested by msaitoh in ticket #1388:
sys/dev/i2c/spdmem_i2c.c		1.23-1.25 via patch

- Carefully access to the I2C bus in the match function.
- Improve bank reset code for DDR4.
2021-12-07 11:25:12 +00:00
martin eeed9a4813 Pull up following revision(s) (requested by msaitoh in ticket #1387):
sys/dev/i2c/sdtemp.c: revision 1.41

Use aprint_debug instead of aprint_error for expected failure.
2021-12-06 19:33:07 +00:00
martin dc17167385 Pull up following revision(s) (requested by riastradh in ticket #1386):
sys/dev/usb/ehci.c: revision 1.287

ehci: Replace bogus polling during suspend by taking bus lock.

The system is not at high IPL or limited to a single CPU at this
point; it is running essentially normally, just with some devices
suspended.  Other threads might be trying to touch EHCI registers,
which might have bad outcomes while we're suspending stuff.  Enabling
polling only makes sense if there is a single thread and single CPU
running, such as when we enter ddb on crash.
2021-12-06 19:28:57 +00:00
martin 484c3b3052 Pull up the following revisions, requested by msaitoh in ticket #1385:
sys/arch/x86/x86/procfs_machdep.c		1.40-1.42

- Add v_spec_ctrl, avx512_fp16, sme, sev, sev_es, sgx, sgx_lc,
  serialize and tsxldtrk.
- Whitespace fix.
2021-12-03 19:49:35 +00:00
martin 55a2e21200 Pull up the following revisions, requested by msaitoh in ticket #1384:
sys/dev/pci/pcireg.h			1.152-1.154, 1.156-1.161
	sys/dev/pci/pci_subr.c			1.222, 1.227-1.232 via patch
	sys/dev/pci/nvme_pci.c			1.31
	sys/dev/pci/pci.c			1.158, 1.163
	sys/dev/pci/ppb.c			1.74

- When parsing Enhanced Allocation entries, use the correct calculation
  for finding the next entry.
- Add 32.0GT/s to the list of pcie speeds (PCIe 5.x.).
- Add Some PCI config information:
  - Lane Margining at the Receiver
  - NVME admin interface
  - UFSHCI
  - InfiniBand
  - Host fabric
  - HDA 1.0 with vendor ext
  - USB4 HCI
  - MIPI I3C
  - Cellular controller/modem (+ Ethernet)
- Change PCI_VENDOR_MASK and PCI_PRODUCT_MASK to unsigned values, to
  prevent sign extension of product ID when shifted up into place in
  PCI_ID_CODE(). Fixes PR kern/56176.
- Add LCAP & LCAP2 definitions.
- Use PCI-SIG official acronyms for some macros.
- Fix typo in some messages.
- Fix typo in comments.
- Whitespace fixes.
2021-12-03 19:40:38 +00:00
martin c9965ea7b0 Pull up the followin revisions (all via patch), requested by msaitoh
in ticket #1383:

	sys/dev/sdmmc/sdhc.c				1.110, 1.112
	sys/dev/sdmmc/sdmmc_mem.c			1.74
	sys/dev/pci/sdhc_pci.c				1.18

- Support 64bit BAR.
- Use unsigned to avoid undefined behavior in hwrite[12]() and
  sdmmc_mem_sd_switch().
- Fix typo in comment.
2021-12-03 18:20:40 +00:00
martin 731e37de20 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1382:

	sys/dev/pci/pucdata.c				1.106-1.112
	share/man/man4/puc.4				1.42-1.43

- Add NetMos NM9900 Quad and Octal serial card.
- Add ASIX AX99100 PCIe 4port serial card.
- Add Oxford Semiconductor Exsys EX-41098 PCI serial card.
2021-12-03 18:11:41 +00:00
martin 7c0bf4f7d6 Pull up the following revisions, requested by msaitoh in ticket #1381:
sys/dev/pci/ichsmb.c			1.69, 1.71, 1.73-1.75 via patch

- Add Intel 400, 495, and 500 series support.
- Add Intel Jasper Lake and Elkhart Lake support.
- Ignore the SMBALERT# interrupt. Same as other OSes.
2021-12-03 17:49:41 +00:00
martin edc04220b5 regen (ticket #1380) 2021-12-03 17:34:19 +00:00
martin 3393368710 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1380:

	sys/dev/pci/pcidevs				1.1441-1.1444

- Add Intel Gemini Lake TXE HECI 1.
- Add Intel Elkhart Lake and Rocket Lake devices.
- Update Jasper Lake's Processor Transaction Routers.
2021-12-03 17:32:42 +00:00
martin 8caa92fd22 Apply patch, requested by msaitoh in ticket #1378:
sys/dev/pci/piixpm.c				patch

Fix a bug that I2C access panics on old AMD chipset (e.g SB600).
Fixes PR kern/56525.
2021-11-30 11:44:39 +00:00
martin aa2f9ebb84 Pull up following revision(s) (requested by mrg in ticket #1375):
usr.sbin/cpuctl/arch/i386.c: revision 1.123
	sys/arch/x86/x86/cpu_topology.c: revision 1.20

decode SMT parts for AMD family >= 0x17, not just 0x17.

now zen3 systems are properly identified by cpu topology for the
scheduler and cpuctl identify.
2021-11-22 17:05:32 +00:00
martin 1f54ac7bc9 Pull up the following, requested by msaitoh in ticket #1374:
sys/dev/pci/ixgbe/ixgbe.h			1.81-1.83
	sys/dev/pci/ixgbe/ixgbe.c			1.291-1.292 via patch
	sys/dev/pci/ixgbe/ixgbe_type.h			1.50
	sys/dev/pci/ixgbe/ixv.c				1.167-1.168 via patch
	sys/dev/pci/ixgbe/ix_txrx.c			1.94

- Fix a bug that a near 64KB TSO segment can't send.
- Reduce bus_dmamap_sync() cost.
- Use macro. Fix typos in comment.
2021-11-20 15:16:53 +00:00
martin 2a832e9328 Pull up the following, requested by msaitoh in ticket #1373:
sys/dev/pci/if_wm.c				1.716-1.718 via patch
	sys/dev/pci/if_wmreg.h				1.121
	sys/dev/mii/ihphy.c				1.20

- Fix a bug that device timeout still happens when the link is down
  on ICH/PCH. Fixes PR kern/56478.
- Add some sysctl info for debugging.
- ihphy(4): Don't power down the PHY when the interface goes down.
- Use macro. Fix comment.
2021-11-20 14:59:04 +00:00
martin 5d0a600231 Pull up following revision(s) (requested by ryo in ticket #1369):
sys/net/if_ethersubr.c: revision 1.302

frame's vlan tag must be ntohs()'ed.

VLAN 0 Priority tag was misrecognized on non vlan-hwtagging interfaces.
2021-10-25 18:11:02 +00:00
martin 05d44060d0 Pull up following revision(s) (requested by msaitoh in ticket #1368):
sys/conf/files: revision 1.1288
	sys/kern/uipc_mbuf.c: revision 1.244
	share/man/man4/options.4: revision 1.520

Fix a bug that NMBCLUSTERS(kern.mbuf.nmbclusters) can't be changed by sysctl.

Update the description of the NMBCLUSTERS. Add NMBCLUSTERS_MAX.

defparam NMBCLUSTERS_MAX.
2021-10-25 15:47:50 +00:00
martin 679cb49641 Pull up following revision(s) (requested by jnemeth in ticket #1364):
sys/dev/usb/if_urtwn.c: revision 1.101

add Edimax N150 adapter; tested on my PBP
2021-10-23 11:21:54 +00:00
martin 340856ea2a Regen (ticket #1364, urtwn Edimax N150 addition) 2021-10-23 11:21:27 +00:00
martin 26e861ce5c Pull up following revision(s) (requested by jnemeth in ticket #1364):
sys/dev/usb/usbdevs: revision 1.798

add Edimax N150 adapter; tested on my PBP
2021-10-23 11:17:43 +00:00
martin 11da51e401 Pull up the following, requested by msaitoh in ticket #1363:
share/man/man4/wm.4			1.42
	sys/dev/pci/files.pci			1.434
	sys/dev/pci/if_wm.c			1.690,1.692-1.693,1.697-1.704,
						1.706-1.715 via patch

- Add missing drain for pcq in wm_stop_locked().
- Add support for I219V 15-19 and I219LM 16-19.
- Fix Tx stall.
- Use wm_flush_desc_rings() workaround more on I219.
- Change DMA physical address in wm_flush_desc_rings() to match other
  OSes.
- Check return value correctly in wm_lv_jumbo_workaround_ich8lan().
- Add new sysctl hw.wmN.debug_flags. This sysctl can be used if
  WM_DEBUG is set.
- Add some sysctl values for debugging TX/RX queues.
- Use atomic_{load,store}_relaxed for evcnt 64 bit counter.
- WM_EVENT_COUNTER is enabled by default on 64 bit architectures.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxq->rxq_ptr updating.
- Stop legacy interrupts before calling softint.
- Disable printf()s in wm_flush_desc_rings() because the code is
  verified.
- Print I219's version number.
- Uniform INTx/MSI handler's Tx/Rx behavior to MSI-X's one.
- Fix return value of interrupt handler.
- Only print an error about missing I/O BARs for chips that need it.
- Do not return a void value from a void function.
- Fix comment.
- Whitespace fixes. No functional change.
2021-10-21 14:30:10 +00:00
martin 3fb483ecf7 Regen (for ticket #1362) 2021-10-21 14:24:27 +00:00
martin 856514ee38 Pull up the following revisions (all via patch), requested by msaitoh
in ticket #1362:

	sys/dev/pci/pcidevs			1.1419-1.1440

- Add newer ciss(4) devices.
- Add modern QUMRANET/Red Hat VIRTIO range PCI devices.
- Add some more product IDs for mcx(4).
- Add current generation NVIDIA graphics cards (3050-3090 etc.).
- Add RDC R6022 PCI-Host bridge.
- Add a whole bunch of radeon devices.
- Add Realtek RTL8821CE.
- Add Intel 660p SSD, and expand the 760p description.
- Add Intel I219's version number.
- Add Intel I219V 15-19 and I219LM 16-19.
- Add Intel I225V, I225LM and WiFi 6 AX201.
- Add newer Intel PCH internal devices.
- Add Intel Jasper Lake devices.
- PDC20265 is Ultra/100, not 66.
- Fix Realtek RTL8125 description.
- Sort Cavium devices.
2021-10-21 14:22:56 +00:00
martin 511c12d481 Pull up following revision(s) (requested by oster in ticket #1361):
sys/dev/raidframe/rf_netbsd.h: revision 1.36 (via patch)
	sys/dev/raidframe/rf_diskqueue.c: revision 1.58
	sys/dev/raidframe/rf_diskqueue.c: revision 1.59

remove unnnecessary splbio() in rf_FreeDiskQueueData()

getiobuf() can return NULL if there are no IO buffers available.
RAIDframe can't deal with that, so create a dedicated pool of buffers
to use for IO.  PR_WAITOK is fine here, as we pre-allocate more than
we need to guarantee IO can make progress.  Tuning of pool still to
come.
2021-10-19 10:55:15 +00:00
martin bac8e9e98f Pull up following revision(s) (requested by abs in ticket #1359):
sys/arch/amiga/dev/amidisplaycc.c: revision 1.33
	share/man/man4/man4.amiga/amidisplaycc.4: revision 1.14
	sys/arch/amiga/dev/amidisplaycc.c: revision 1.35
	sys/arch/amiga/dev/amidisplaycc.c: revision 1.36

Implement the WSDISPLAYIO_GET_FBINFO ioctl, needed by X wsfb driver.

Add support for WSDISPLAYIO_MODE_DUMBFB to WSDISPLAYIO_SMODE.

Remove parentheses from return. No functional changes.

Update documentation to mention current status of X11
2021-10-13 16:07:41 +00:00
martin c681ab5445 Pull up following revision(s) (requested by hannken in ticket #1357):
sys/kern/sys_pipe.c: revision 1.157

Fix a deadlock where one thread writes to a pipe, has more data
and no space in the pipe and waits on "pipe_wcv" while the reader
is closing the pipe and waits on "pipe_draincv".

Swap the test for "PIPE_EOF" and the "cv_wait_sig()" in "pipe_write()".

PR bin/56422 "zgrep -l sometimes hangs"
2021-10-08 14:58:08 +00:00
martin 1d9b419295 Pull up following revision(s) (requested by thorpej in ticket #1353):
sys/miscfs/fifofs/fifo_vnops.c: revision 1.90
	tests/kernel/kqueue/write/t_fifo.c: revision 1.5

- Add a new EVFILT_WRITE test case for FIFOs that correctly validates
the writability thresholds.
- Fix a bug in fifo_kqfilter() exposed by the new test case; in the
EVFILT_WRITE case, we were attaching the wrong end of the socket
pair to the knote!
- In filt_fiforead(), use ">= so->so_rcv.sb_lowat" rather than "> 0"
for consistency with fifo_poll().  NFC.
2021-10-04 14:48:25 +00:00
martin 137f935fa5 Pull up following revision(s) (requested by thorpej in ticket #1351):
sys/miscfs/fifofs/fifo_vnops.c: revision 1.88
	sys/kern/uipc_syscalls.c: revision 1.201
	tests/lib/libc/sys/t_poll.c: revision 1.6
	tests/lib/libc/sys/t_poll.c: revision 1.7
	tests/lib/libc/sys/t_poll.c: revision 1.8

- Strenghen the poll(2) fifo_inout test to ensure that once the reader
has read enough that exactly PIPE_BUF space is available that the FIFO
becomes writable again.
- When creating a FIFO, ensure that the receive low water mark is 1
(a FIFO must be readable when at least 1 byte is available); this
was already the case implicitly, but this makes it explicit.
- Similarly, set the send low water mark to PIPE_BUF to ensure that
the pipe is writable when at least PIPE_BUF bytes of space are available
in the send buffer.  Without this change, the strengthened test case
above does not pass (the default send low water mark is larger than
PIPE_BUF; see soreserve()).
- Make the same low water mark changes to the PIPE_SOCKETPAIR case.

In the fifo_hup1 test, also ensure that POLLHUP is de-asserted when a
new writer appears.

Add a fifo_inout test case that validates the expected POLLIN / POLLOUT
behavior for FIFOs:
- A FIFO is readable so long as at least 1 byte is available.
- A FIFO is writable so long as at least PIPE_BUF (obtained with _PC_PIPE_BUF)
  space is avaiable.
This will be cloned for a forthcoming kevent test case.
2021-10-04 14:32:38 +00:00
martin eec26b29e0 Pull up following revision(s) (requested by thorpej in ticket #1350):
sys/kern/uipc_socket2.c: revision 1.140
	tests/lib/libc/sys/t_poll.c: revision 1.5
	sys/miscfs/fifofs/fifo_vnops.c: revision 1.87

- fifo_poll(): If the last writer has disappeared, detect this and return
  POLLHUP, per POSIX.
- fifo_close(): Use the new fifo_socantrcvmore(), which is like the
  garden-variety socantrcvmore(), except it specifies POLL_HUP rather
  than POLL_IN (so the correct code for SIGIO is sent).
- sowakeup(): Allow POLL_HUP as a code (notifies poll'ers with POLLHUP).
- Add test cases for correct POLLHUP behavior with FIFOs.

Fixes PR kern/56429.
2021-10-02 11:07:55 +00:00
martin e57a70ef47 Pull up the following (via patch), requested by msaitoh in ticket #1346:
sys/dev/pci/ixgbe/ixgbe.c			1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
	sys/dev/pci/ixgbe/ixgbe.h			1.73, 1.76-1.80 via patch
	sys/dev/pci/ixgbe/ix_txrx.c			1.68-1.93
	sys/dev/pci/ixgbe/ixv.c				1.153, 1.157-1.161, 1.163-1.166 via patch
	sys/dev/pci/ixgbe/if_bypass.c			1.7-1.9
	sys/dev/pci/ixgbe/if_fdir.c			1.4-1.5
	sys/dev/pci/ixgbe/if_sriov.c			1.10-1.11
	sys/dev/pci/ixgbe/ixgbe_82598.c			1.16
	sys/dev/pci/ixgbe/ixgbe_82599.c			1.23
	sys/dev/pci/ixgbe/ixgbe_api.c			1.25
	sys/dev/pci/ixgbe/ixgbe_bypass.h		1.2
	sys/dev/pci/ixgbe/ixgbe_common.c		1.30-1.33
	sys/dev/pci/ixgbe/ixgbe_dcb.c			1.10-1.11
	sys/dev/pci/ixgbe/ixgbe_dcb.h			1.7
	sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.8-1.9
	sys/dev/pci/ixgbe/ixgbe_dcb_82598.h		1.7
	sys/dev/pci/ixgbe/ixgbe_dcb_82599.c		1.8-1.9
	sys/dev/pci/ixgbe/ixgbe_dcb_82599.h		1.7
	sys/dev/pci/ixgbe/ixgbe_fdir.h			1.3
	sys/dev/pci/ixgbe/ixgbe_features.h		1.3
	sys/dev/pci/ixgbe/ixgbe_mbx.c			1.12
	sys/dev/pci/ixgbe/ixgbe_netbsd.c		1.13, 1.16-1.17
	sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.13-1.14
	sys/dev/pci/ixgbe/ixgbe_netmap.c		1.3-1.4
	sys/dev/pci/ixgbe/ixgbe_netmap.h		1.2
	sys/dev/pci/ixgbe/ixgbe_osdep.c			1.7
	sys/dev/pci/ixgbe/ixgbe_osdep.h			1.29-1.30
	sys/dev/pci/ixgbe/ixgbe_phy.c			1.24
	sys/dev/pci/ixgbe/ixgbe_rss.h			1.5
	sys/dev/pci/ixgbe/ixgbe_sriov.h			1.4
	sys/dev/pci/ixgbe/ixgbe_type.h			1.49
	sys/dev/pci/ixgbe/ixgbe_vf.c			1.27
	sys/dev/pci/ixgbe/ixgbe_x540.c			1.18-1.19
	sys/dev/pci/ixgbe/ixgbe_x540.h			1.9
	sys/dev/pci/ixgbe/ixgbe_x550.c			1.19-1.20
	sys/dev/pci/ixgbe/ixgbe_x550.h			1.6
	sys/dev/pci/files.pci				1.438
	share/man/man4/ixg.4				1.15
	share/man/man4/ixv.4				1.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
    packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of ixgbe_reset_hw() for debugging.
- Remove extra unlock/lock processing around if_percpuq_enqueue().
- Refactor rxr->next_to_check updating.
- Add new sysctl "rx_copy_len".
- Add a new sysctl to read rxr->next_to_refresh.
- Print error number when error occurred.
- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
  change.
- Don't use fixed value.
- Comment out flow director processing in fast path.
- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
- KNF.
- Fix typos.
2021-09-15 16:30:50 +00:00
martin a163257afc Pull up following revision(s) (requested by manu in ticket #1343):
share/man/man7/sysctl.7: revision 1.153
	sys/kern/vfs_lockf.c: revision 1.74
	lib/libc/sys/fcntl.2: revision 1.46
	lib/libc/sys/flock.2: revision 1.23

Tie the maximum file lock per unprivilegied uid to kern.maxfiles

This makes the limit simple to raise at run time. While there, document
that fcntl(2) and flock(2) may return ENOMEM when this limit is reached.
2021-09-07 17:12:21 +00:00
martin 96b2064cf0 Pull up following revision(s) (requested by tsutsui in ticket #1342):
sys/arch/mips/mips/trap.c: revision 1.250
	sys/arch/mips/mips/trap.c: revision 1.251

Add missing newline to a diagnostic printf.

Comment out the diagnostic message in the TLB_MOD handler that's logged if
pmap_tlb_update_addr() indicates that the VA+ASID was not found in the TLB.

It's a harmless race condition that can happen for legitimate reasons (e.g.
a TLB miss in an interrupt handler that evicts the entry from the TLB).

See discussion:
    http://mail-index.netbsd.org/port-mips/2020/03/07/msg000927.html
2021-09-05 10:48:48 +00:00
martin c854106faf Pull up following revision(s) (requested by manu in ticket #1341):
sys/arch/x86/x86/pmap.c: revision 1.410

Make pat_init() a NOOP on XENPV; it causes a trap with Xen 4.15
2021-09-03 10:27:33 +00:00
martin e0d2e865ee Pull up following revision(s) (requested by mrg in ticket #1340):
sys/dev/usb/ehci.c: revision 1.286

add missing newline and fix conditional for askroot/single user
hand over delay message.  PR#56366.
2021-09-03 10:25:36 +00:00
martin 96f71fdd8b Pull up following revision(s) (requested by andvar in ticket #1339):
sys/dev/pci/if_vte.c: revision 1.32

Restore original MDC speed control register value after MAC reset, if
it wasn't default. Fixes PR port-i386/53494.

ok riastradh
2021-09-03 10:20:22 +00:00
martin 57d2d638d2 Pull up following revision(s) (requested by ozaki-r in ticket #1338):
sys/netinet6/nd6.c: revision 1.277

nd6: prevent ln from being freed while releasing held packets
2021-08-20 19:32:49 +00:00
martin 73dee09958 Pull up following revision(s) (requested by christos in ticket #1337):
sys/compat/common/vfs_syscalls_43.c: revision 1.67
	sys/compat/common/vfs_syscalls_50.c: revision 1.26
	sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
  (thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
2021-08-15 09:27:50 +00:00
martin 747822e336 Pull up following revision(s) (requested by kardel in ticket #1332):
sys/netinet6/in6_src.c: revision 1.88

PR kern/56348

MTU discovery fails with IPv6 sockets bound to IPv4 mapped address
pick up the IPv4 route for IPv4 mapped IPv6 address to get the correct
MTU and not any unrelated/inappropriate MTU from IPv6 routes. IPv4 mapped
IPv6 addresses are always handled by the IPv4 stack and MTU discovery
is solely handled with the IPv4 routing table.
2021-08-11 17:22:17 +00:00
martin d4934bafff Pull up following revision(s) (requested by skrll in ticket #1329):
lib/libc/arch/arm/gen/swapcontext.S: revision 1.18
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divsi3.S: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmp.S: revision 1.3
	lib/libc/arch/arm/sys/__clone.S: revision 1.10
	lib/libc/arch/arm/sys/__clone.S: revision 1.11
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S: revision 1.2
	lib/libc/arch/arm/sys/__clone.S: revision 1.12
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/modsi3.S: revision 1.3
	lib/libc/arch/arm/sys/__clone.S: revision 1.13
	lib/libc/arch/arm/sys/__clone.S: revision 1.14
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/divmodsi4.S: revision 1.3
	lib/libc/arch/arm/gen/swapcontext.S: revision 1.16
	lib/libc/arch/arm/gen/swapcontext.S: revision 1.17

Align sp to 8-byte boundary as required by EABI.

This is especially important for non-leaf functions; GCC optimizes codes
based on assumption that sp is aligned properly.

Mostly fix broken earmv5 userland compiled by GCC10 due to alignment
faults in ld.elf_so, where {ld,st}rd are used for [sp, #8x].

No regression for ATF is observed for earmv[67]{,hf}{,eb}.

Align sp to 8-byte boundary as required by EABI.
IIUC, this change only affects libc compiled for ``Thumb-mode userland'',
which we've not officially supported yet.

Fix previous. For Thumb-1:
- sp cannot be manipulated directly
- {add,sub}s should be used instead of {add,sub}

Trailing whitespace

The _INVOKE_CERROR macro deals with thumb so simplify the code (at the
expense of a couple more instructions).

Do previous differently by pushing even number of registers and remove
strange r7 usage.

Do previous differtly by pushing two registers in the same way as the
_INVOKE_CERROR macro
2021-08-08 10:22:04 +00:00
martin 06d10a9f43 Pull up following revision(s) (requested by skrll in ticket #1328):
sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/negsf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/muldf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfhf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.4
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatdidf.c: revision 1.5
	sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c: revision 1.2
	sys/external/bsd/compiler_rt/abi.mk: revision 1.1
	sys/external/bsd/compiler_rt/dist/lib/builtins/divdf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsisf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/comparesf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.4
	sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.5
	sys/external/bsd/compiler_rt/dist/lib/builtins/ashrdi3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/ashldi3.c: revision 1.3
	sys/lib/libkern/Makefile.compiler-rt: revision 1.13
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncdfsf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/subdf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/int_lib.h: revision 1.6
	sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/lshrdi3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatsisf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/extendhfsf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatunsidf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfsi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_frsub.c: revision 1.2
	lib/libm/compiler_rt/Makefile.inc: revision 1.11
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfsi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatsidf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/divsi3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/adddf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_div0.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/mulsf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixdfdi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/divsf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/negdf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunsdfdi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/extendsfdf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/subsf3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/comparedf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatundisf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_drsub.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfsi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/muldi3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfsi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatdisf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/addsf3.c: revision 1.3
	lib/libc/compiler_rt/Makefile.inc: revision 1.40
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixunssfdi.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c: revision 1.2
	sys/external/bsd/compiler_rt/dist/lib/builtins/udivsi3.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/truncsfhf2.c: revision 1.3
	sys/external/bsd/compiler_rt/dist/lib/builtins/floatundidf.c: revision 1.4
	sys/external/bsd/compiler_rt/dist/lib/builtins/fixsfdi.c: revision 1.3

PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 266891:
28e1b977d4 (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[PATCH] builtins: remove use of __attribute__((pcs("aapcs"))) on
  Windows
Windows does not honour the __attribute__((pcs)) on ARM.  Although this will
result in ABI mismatches, compiler-rt should largely be unneeded for resolving
dependencies as we generate MS ABI compliant library calls now for the most
part.
llvm-svn: 266891
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 298974 for lib/builtins/int_lib.h.
d8ca74176e (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[Builtin] Unxfail tests for armhf
Summary:
Originally, a few tests fail for armhf target due to:
1) COMPILER_RT_ARMHF_TARGET was not set when building the lib
2) COMPILER_RT_ABI should not be defined as `__attribute__((pcs("aapcs")))` for armhf when building for both lib and tests
This addresshttps://bugs.llvm.org//show_bug.cgi?id=32261
mulsc3_test.c is a newly exposed issue, which will be addressed separately.
Reviewers: rengolin, compnerd
Reviewed By: compnerd
Subscribers: aemerson, llvm-commits, mgorny
Differential Revision:https://reviews.llvm.org/D31448
llvm-svn: 298974
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303138:
44c45717b9 (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[PATCH] builtins: use reserved spelling (NFC)
llvm-svn: 303138
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303188:
36ac5ddff7 (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[PATCH] builtins: expand out the AEABI function stubs
These actually may change calling conventions.  We cannot simply provide
function aliases as the aliased function may have a different calling
convention.  Provide a forwarding function instead to permit the
compiler to synthesize the calling convention adjustment thunk.
Remove the `ARM_EABI_FNALIAS` macro as that is not safe to use.
Resolves PR33030!
llvm-svn: 303188
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 303207:
4a45838d10 (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[PATCH] builtins: fix guard __AEABI__ -> __ARM_EABI__
llvm-svn: 303207
PR port-arm/55897
Cherry-pick upstream commit llvm-svn: 314851:
0d586d06a7 (diff-549f1733063df365663fe375f336034e33e16d6bf2826cd4f966045aeb136007)
----
[PATCH] [compiler-rt] Add back ARM EABI aliases where legal.
r303188 removed all the uses of aliases for EABI functions from
compiler-rt, because some of them had mismatched calling conventions.
Obviously, we can't use aliases for functions which don't have the same
calling convention, but that's only an issue for floating-point
functions with the hardfloat ABI.  In other cases, the stubs increase
size and reduce performance for no benefit.
This patch adds back the aliases, with appropriate checks to make sure
they're only used in cases where the calling convention matches.
llvm-svn: 314851
PR port-arm/55897
Fix ABI mismatch for armhf runtime routines for floating-point arithmetics;
For hard-float arm variants, provide
(1) generic runtime routines with correct calling convention, and
(2) EABI runtime routines at the same time.
I've confirmed that no binary changes for kernels.
LGTM by skrll
2021-08-08 10:11:39 +00:00
martin f358a001b6 Pull up following revision(s) (requested by riastradh in ticket #1327):
sys/external/bsd/drm2/linux/linux_reservation.c: revision 1.13
	sys/external/bsd/drm2/linux/linux_reservation.c: revision 1.14

drm: Release fence if we're about to return too.

Should fix another fence leak.

XXX pullup-9

 -

drm: Plug another fence leak.

XXX pullup-9
2021-08-08 10:00:16 +00:00
snj 99eb4c31b8 Pull up following revision(s) (requested by isaki in ticket #1325):
sys/dev/audio/audio.c: revision 1.105
AUDIO_SETINFO: fix a bug that the gain and the balance could not be set
at the same time.  Fix PR kern/56308.
2021-07-28 14:59:02 +00:00
snj 273fc6ff2f Pull up following revision(s) (requested by jmcneill in ticket #1324):
sys/arch/arm/rockchip/rk_anxdp.c: revision 1.4
rockchip: edp: Force VOPB as CRTC for eDP.
Fixes display init on Pinebook Pro w/ U-Boot 2021.07.
2021-07-28 14:56:35 +00:00
martin 54d6dcbd50 Pull up following revision(s) (requested by tsutsui in ticket #1323):
sys/arch/hp300/dev/rd.c: revision 1.109
	sys/arch/hp300/stand/Makefile.buildboot: revision 1.37
	sys/arch/hp300/stand/common/ct.c: revision 1.8
	sys/arch/hp300/dev/hpibvar.h: revision 1.22
	sys/arch/hp300/dev/ct.c: revision 1.62
	sys/arch/hp300/dev/hpibvar.h: revision 1.23
	sys/arch/hp300/dev/ct.c: revision 1.63
	sys/arch/hp300/dev/hpibvar.h: revision 1.24
	sys/arch/hp300/dev/mt.c: revision 1.55
	sys/arch/hp300/dev/rdreg.h: revision 1.14
	sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch)
	sys/arch/hp300/dev/rdreg.h: revision 1.15
	sys/arch/hp300/dev/rdreg.h: revision 1.16
	sys/arch/hp300/dev/rdreg.h: revision 1.17
	etc/etc.hp300/MAKEDEV.conf: revision 1.15
	sys/arch/hp300/stand/common/hpibvar.h: revision 1.6
	sys/arch/hp300/stand/common/rd.c: revision 1.11
	sys/arch/hp300/dev/ctreg.h: revision 1.11
	sys/arch/hp300/dev/rdvar.h: revision 1.24
	sys/arch/hp300/dev/rdvar.h: revision 1.25
	sys/arch/hp300/dev/rdvar.h: revision 1.26
	sys/arch/hp300/dev/rd.c: revision 1.103
	sys/arch/hp300/dev/rd.c: revision 1.104
	sys/arch/hp300/dev/rd.c: revision 1.105
	sys/arch/hp300/dev/rd.c: revision 1.106
	sys/arch/hp300/dev/rd.c: revision 1.107
	sys/arch/hp300/dev/rd.c: revision 1.108

Consistently use #define<tab> here.

Consistently use #define<tab> as rdreg.h.

No need to bother to use aprint_debug(9) inside #ifdef DEBUG block.

Pull HP-IB probe fixes from OpenBSD/hp300.
https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2

Overhaul the way HP-IB devices are probed. We will now do an exhaustive
probe of the (slave, punit) tuple space, since this is the only way we
can get a dual disk or dual tape enclosure to attach two devices of the
same kind.

This allows using multiple rd(4) disk images on the same slave emulated
by HPDisk (and probably the real 9122D with dual floppy disk drives).

Thanks to Miod Vallat for suggesting this fix.

Move attach messages from common rdident() to explicit rdattach().

Cleanup duplicated CS/80 indentify structures.  From OpenBSD.
https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2

Define the CS/80 identify structure only once and correctly, instead of
duplicating it in every CS/80 driver and using an hardcoded number for
its size.
No functional change.
https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2

Pick HP-IB describe structures changes from main kernel code here as well.

Add support of multiple rd(4) disks on all punits for HPDisk.

Special thanks to Anders Gustafsson, the author of "HPDisk"
(GPIB disk emulator) http://www.dalton.ax/hpdisk/
for providing bare boards and improving firmwares for NetBSD/hp300.

Specify -fno-unwind-tables to shrink binaries.

Before:
   text    data     bss     dec     hex filename
  77902    4328  137120  219350   358d6 uboot

After:
   text    data     bss     dec     hex filename
  64186    4328  137120  205634   32342 uboot

Create rd3 device nodes, for HPDisk.

Add Device and drive info of 2202A, 7908A, 7911A, and 7941A.

Geometries and description info are taken from hpdrive.ini.sample
in HPDrive.  Briefly tested on HPDisk.

Print rd(4) capacity and geometry info as sd(4) and wd(4) do.

Before:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block

After:
rd0 at hpibbus1 slave 0 punit 0: 7937H
rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
2021-07-14 18:04:04 +00:00
martin 40559796c9 Pull up following revision(s) (requested by tsutsui in ticket #1322):
sys/arch/hppa/dev/sti_sgc.c: revision 1.3

Fix silent freeze on probing sti(4) framebuffer on 712/60.  PR/52162

Ok'ed by skrll@.
Should be pulled up to netbsd-9 and netbsd-8.
2021-07-14 17:52:31 +00:00
martin 67480e8e5f Apply patch, requested by chs in ticket #1321:
sys/rump/librump/rumpvfs/vm_vfs.c		(apply patch)

Adapt the changes from ticket #1317 (the uvm_pageqlock does not exist any
more in HEAD)
2021-07-09 17:51:17 +00:00
martin 8e2931cc71 Pull up following revision(s) (requested by riastradh in ticket #1320):
sys/external/bsd/drm2/linux/linux_reservation.c: revision 1.12

drm: Release fence after use.

May plug the dreaded radeon kmem memory leak.
XXX pullup-9
2021-07-08 11:23:28 +00:00
martin 3fc316a483 Pull up following revision(s) - all via patch -
(requested by riastradh in ticket #1317):

	sys/uvm/uvm_page.c: revision 1.248
	sys/uvm/uvm_anon.c: revision 1.80
	sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.40
	sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.41
	sys/rump/librump/rumpkern/vm.c: revision 1.191
	sys/uvm/uvm_pager.c: revision 1.130
	external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.71
	tests/rump/rumpkern/t_vm.c: revision 1.5
	tests/rump/rumpkern/t_vm.c: revision 1.6
	sys/rump/librump/rumpvfs/vm_vfs.c: revision 1.39

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately.  Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors.  Fixes PR 55702.

fix an incorrect assertion in the previous commit.

Handle PG_PAGEOUT in uvm_anon_release() too.

Commit the ZFS file that I forgot in this previous commit:

Move the handling of PG_PAGEOUT from uvm_aio_aiodone_pages() to
uvm_page_unbusy() so that all callers of uvm_page_unbusy() don't need to
handle this flag separately.  Split out the pages part of uvm_aio_aiodone()
into uvm_aio_aiodone_pages() in rump just like in the real kernel.

In ZFS functions that can fail to copy data between the ARC and VM pages,
use uvm_aio_aiodone_pages() rather than uvm_page_unbusy() so that we can
handle these "I/O" errors.  Fixes PR 55702.
update the rump copy of uvm_page_unbusy() to match the real version,
in particular handle PG_PAGEOUT.  fixes a few atf tests.
the busypage test is buggy, expect it to fail.

make rump's uvm_aio_aiodone_pages() look more like the kernel version.
fixes some more rumpy assertions.

for the busypage test, replace atf_tc_expect_fail() with atf_tc_skip()
because atf apparently has no way to expect a test program to crash.
fixes PR 55945.
2021-07-06 04:22:34 +00:00
martin d586d8c91d Pull up following revision(s) (requested by macallan in ticket #1312):
sys/arch/hppa/hppa/intr.c: revision 1.4

fix off by one which resulted in all idle time reported as interrupt time
final fix from nick@
2021-07-06 04:05:14 +00:00
martin 5a5aff3fb8 Pull up following revision(s) (requested by dholland in ticket #1318):
sys/miscfs/kernfs/kernfs_vnops.c: revision 1.169
	sys/miscfs/kernfs/kernfs_vnops.c: revision 1.170

Add missing VOP_KQFILTER to kernfs.

Not sure if lack of it can be used for local DoS or not, but best to
fix.

 -

Fix perms on /kern/{r,}rootdev.
2021-07-06 03:45:11 +00:00
martin fe5fe697c8 Pull up following revision(s) (requested by thorpej in ticket #1311):
sys/dev/ic/dp8390.c: revision 1.99
	sys/dev/ic/dl10019.c: revision 1.17
	sys/dev/ic/ax88190.c: revision 1.18

Make sure the media / mii members in struct ethercom are initialized
so that the media-related ioctls work.  Problem reported by Björn Johannesson
on current-users@.

XXX pullup-9
2021-07-03 10:18:16 +00:00
martin 497a40430a Fix pullup #1302 by adapting the changes to this branch
(there was a misunderstanding in the ticket handling)
2021-06-22 05:10:50 +00:00
martin 3860d381bf Pull up following revision(s) (requested by riastradh in ticket #1308):
sys/arch/amd64/conf/GENERIC: revision 1.581

Enable tpm @ acpi (now that it can match TPM 1.2 devices, which are not,
as the comment implies, experimental).
2021-06-21 17:34:42 +00:00
martin 3672ac6242 Pull up following revision(s) (requested by riastradh in ticket #1307):
sys/arch/amd64/amd64/db_disasm.c: revision 1.28
	sys/arch/i386/i386/db_disasm.c: revision 1.49

ddb/amd64: Don't go out of the way to detect invalid addresses.

db_disasm had logic to detect invalid addresses before trying to
disassemble them.  But when disassembling a null instruction address,
the logic to detect invalid addresses itself tried to dereference an
invalid address.

db_get_value can already handle this situation gracefully, so there is
no need for this faulty fault-avoidance logic.

Fixes double-fault in ddb on calling null function pointers.  With
any luck, this should make diagnosing such bugs easier in the future!

ddb/i386: Don't go out of the way to detect invalid addresses.
db_read_bytes already does this better (but didn't at the time this
check was originally added back in 1998).  Not sure if this code had
the same mistake as the amd64 code causing it to trip over its own
shoelaces, but there should be no need for it here.
2021-06-21 17:32:52 +00:00
martin 0ea19b48dd Pull up following revision(s) (requested by riastradh in ticket #1306):
sys/dev/usb/umass.c: revision 1.185
	sys/dev/usb/umass_scsipi.c: revision 1.68

umass(4): Use an empty function callback, not null pointer.

This stupid bug, with an `XXX Broken!' comment right above, has been
preventing NetBSD from suspend/resume with a USB drive plugged in for
longer than I want to even think about admitting.  *sigh*
umass(4): Assert that we got a cb up front.

Avoids jump to zero waaaaaaay down the line where we've forgotten why
we wanted to jump into oblivion.
2021-06-21 17:27:57 +00:00
martin 54271dd8db Pull up following revision(s) (requested by riastradh in ticket #1305):
sys/dev/ic/nvmevar.h: revision 1.22
	sys/dev/ic/nvme.c: revision 1.56
	sys/dev/ic/nvme.c: revision 1.57
	sys/dev/pci/nvme_pci.c: revision 1.30

nvme(4): Add suspend/resume, derived from OpenBSD.

nvme(4): Move disestablishment of admin q interrupt to nvme_detach.

Nothing re-established this after suspend/resume, so attempting
suspend/resume/suspend would crash, and presumably we would miss
interrupts after resume.  This keeps the establish/disestablish more
symmetric in attach/detach.
2021-06-21 17:25:48 +00:00
martin eaccb7bb89 Pull up following revision(s) (requested by riastradh in ticket #1304):
sys/dev/ldvar.h: revision 1.35
	sys/dev/ld.c: revision 1.112

ld(4): Block requests while suspended until resumed.

Otherwise nothing stops us from continuing to feed I/O to the disk
controller when it expects that the queues are quiesced as it pokes
registers to change its power states.  Fixes resume during disk
activity on my T480 with nvme.
2021-06-21 17:23:13 +00:00
martin 65b46dd267 Pull up following revision(s) (requested by riastradh in ticket #1303):
sys/arch/x86/pci/dwiic_pci.c: revision 1.5 (patch)

dwiic(4): Attribute output correctly and relegate to debug-level.

Tidy up a little while here.
2021-06-21 17:19:55 +00:00
martin 6c9b1ab64e Pull up following revision(s) (requested by riastradh in ticket #1302):
sys/dev/usb/ualea.c: revision 1.13

ualea(4): Null suspend/resume handler.
2021-06-21 17:15:38 +00:00
martin 53beddbf9b Pull up following revision(s) (requested by riastradh in ticket #1301):
sys/dev/usb/xhci.c: revision 1.140
	sys/dev/usb/xhci.c: revision 1.141
	sys/dev/usb/xhci.c: revision 1.143
	sys/dev/usb/xhcivar.h: revision 1.18
	sys/dev/usb/xhcivar.h: revision 1.19
	sys/dev/usb/xhcireg.h: revision 1.19
	sys/dev/usb/xhci.c: revision 1.139

xhci(4): Draft suspend/resume.

Work almost entirely done and tested by maya@ based on xhci 1.2 spec;
tidied up and tweaked by me.

Not sure about issuing Stop Endpoint commands or ensuring the Command
Ring is in the Stopped or Idle state, but this seems to work as is,
so it's already an improvement over what we had before which was no
xhci suspend/resume at all.

In particular, it's not clear to us:
- if we don't have any pending USB activity whether we need to issue
  the Stop Endpoints or quiesce the command ring; but
- if we do have any pending USB activity whether issuing Stop
  Endpoint is enough or whether we also need to do anything to
  synchronize with other software logic to quiesce it too.

xhci(4): Block commands and issue Stop Endpoint on suspend.

xhci: Fix logic in waiting for command queue access.
_Either_ an existing command in progress, _or_ an existing suspend in
progress that is not done by us, should block us; the logic I wrote
previously erroneously blocked only if both conditions happened at
the same time.

Should fix issue reported by Andrius V in the PR kern/56050 followup
discussion.

xhci(4): Wait USB_RESUME_WAIT ms, not 20 ms.
Better to use the named constant, and although the spec says 20 ms is
enough, apparently for some devices it's not.
2021-06-21 17:11:46 +00:00
martin fb3c8642bb Pull up following revision(s) (requested by riastradh in ticket #1300):
sys/external/bsd/drm2/dist/drm/i915/i915_drv.h: revision 1.33 (patch)

i915drmkms: Fix LOCKDEBUG panic and potential deadlock.

This path is taken with a spin lock held, and possibly even in
interrupt context, where taking vmobjlock is not kosher, but we are
guaranteed to have the queue populated and unchanging.

XXX pullup-9
2021-06-21 16:41:02 +00:00
martin 135329423e Pull up following revision(s) (requested by riastradh in ticket #1299):
sys/kern/kern_ksyms.c: revision 1.90
	sys/kern/kern_ksyms.c: revision 1.91
	sys/kern/kern_ksyms.c: revision 1.92
	sys/kern/kern_ksyms.c: revision 1.93
	sys/kern/kern_ksyms.c: revision 1.94
	sys/kern/kern_ksyms.c: revision 1.95
	sys/kern/kern_ksyms.c: revision 1.96
	sys/kern/kern_ksyms.c: revision 1.97

ksyms(4): Fix ksymsread synchronization.

Fixes crash on concurrent update and read of /dev/ksyms.
XXX Unclear why we have to skip sd_gone entries here -- it seems like
they should be preserved until ksymsclose.
ksyms(4): Modify ksyms_symtabs only at IPL_HIGH.

This limits the opportunities for ddb to witness an inconsistent
state of the symbol table list.
ksyms(4): Don't skip symbol tables that are soon to be freed.

They will not actually be freed until /dev/ksyms is closed, so
continued access to them remains kosher.
Revert "ksyms(4): Don't skip symbol tables that are soon to be freed."

Apparently the equality kassert this restored doesn't work; to be
analyzed.

Fix regression introduced in rev 1.90
in which the last element of ksyms_symtabs is skipped by mistake.

ksyms(4): Fix race in ksymsread iteration.
TAILQ_NEXT(ksyms_last_snapshot) might change while we are iterating,
but ksyms_last_snapshot itself cannot, so invert the loop structure.

Discussed with rin@.

ksyms(4): Don't skip symbol tables that are soon to be freed, take 2.

They will not actually be freed until /dev/ksyms is closed, so
continued access to them remains kosher.
The previous change was busted because of an off-by-one error in a
previous previous change's iteration over the symtabs; that error has
since been corrected.

ksyms(4): Allow multiple concurrent opens of /dev/ksyms.

First one takes a snapshot; others all agree with the snapshot.
Previously this code path was just broken (could fail horribly if
modules were unloaded after one of the opens is closed), so I just
blocked it off in an earlier commit, but that broke crash(8).  So
let's continue allowing multiple opens seeing the same snapshot, but
without the horrible bugs.
2021-06-21 16:14:14 +00:00
martin f1064cde21 Regen for ticket #1296 2021-06-21 14:52:58 +00:00
martin 8cf3305d98 Pull up following revision(s) (requested by dholland in ticket #1296):
sys/sys/namei.src: revision 1.59	(via patch)
	sys/kern/vfs_vnops.c: revision 1.215
	sys/kern/vfs_lookup.c: revision 1.226

Add a new namei flag NONEXCLHACK for open with O_CREAT and not O_EXCL.
This case needs to be distinguished from the other CREATE operations
because it is supposed to successfully return (and open) the target if
it exists. In the case where that target is the root, or a mount
point, such that there's no parent dir, "real" CREATE operations fail,
but O_CREAT without O_EXCL needs to succeed.

So (a) add the flag, (b) test for it in namei in the situation
described above, (c) set it in open under the appropriate
circumstances, and (d) because this can result in namei returning
ni_dvp of NULL, cope with that case.

Should get into -9 and maybe even -8, because it was prompted by
issues with 3rd-party code. The use of a flag (vs. adding an
additional nameiop, which would be more appropriate) was deliberate to
make the patch small and noninvasive.
2021-06-21 14:50:57 +00:00
martin d6f533a42a Pull up following revision(s) (requested by nia in ticket #1282):
sys/dev/pci/if_iwmreg.h: revision 1.8

Can't left shift a signed int by 31. Found by kubsan.
2021-06-05 10:51:41 +00:00
martin 70be12de7e Pull up following revision(s) (requested by tsutsui in ticket #1280):
sys/arch/hp300/conf/INSTALL: revision 1.67
	sys/arch/hp300/conf/INSTALL: revision 1.68

Add missed 'nhpib at intio' for internal HP-IB.  Found on testing HPDisk.
Also fix comments for HP-IB devices.
Should be pulled up to netbsd-8 and netbsd-9.

Reduce maxusers to 8 as GENERIC.
Should be pulled up to netbsd-9 and netbsd-8.
2021-06-05 10:35:28 +00:00
martin 69e0d3737e Pull up following revision(s) (requested by skrll in ticket #1279):
sys/arch/arm/arm32/arm32_boot.c: revision 1.42
	sys/arch/arm/arm32/arm32_boot.c: revision 1.43

G/C

 -

Mirror the changes around passing pages to UVM in aarch64_machdep.c:

Two fixes for loading free pages into UVM

- Only consider a boot_physmem (inner loop) range that has its end
   (bp_end) after the bootconfig.dram (outer loop) range start (start).
   This was harmless as a later condition correctly checks there is only
   something to do if start < bp_end.

- Stop processing boot_physmem ranges if all the bootconfig.dram range has
   been passed to UVM.  This fixes a boot problem for simon@

Copy a comment over and do the VPRINTF before the uvm_page_physload in
the same way as aarch64_machdep.c as well.
2021-06-05 10:27:10 +00:00
martin 50af93f7d5 Pull up following revision(s) (requested by skrll in ticket #1278):
sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.50
	sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.60
	sys/arch/aarch64/aarch64/aarch64_machdep.c: revision 1.61

G/C

 -

More debug

 -

Two fixes for loading free pages into UVM

- Only consider a boot_physmem (inner loop) range that has its end
   (bp_end) after the bootconfig.dram (outer loop) range start (start).
   This was harmless as a later condition correctly checks there is only
   something to do if start < bp_end.

- Stop processing boot_physmem ranges if all the bootconfig.dram range has
   been passed to UVM.  This fixes a boot problem for simon@
2021-06-04 14:00:17 +00:00
martin d78eb71548 Pull up following revision(s) (requested by rin in ticket #1277):
sys/arch/aarch64/aarch64/netbsd32_machdep.c: revision 1.18

Fix conversion between aarch64 and aarch32 fpreg's; in aarch32 mode,
d0-d31 are packed into v0-v15 (== q0-q15).

This fixes crashes in VFP-optimized codes running on COMPAT_NETBSD32.

OK ryo
2021-06-01 10:39:48 +00:00
martin 0229797c59 Pull up following revision(s) (requested by jakllsch in ticket #1273):
sys/dev/pci/xhci_pci.c: revision 1.26

xhci_pci: avoid potential double free of interrupt handles

Found by Kouichi Hashikawa in PR 55855.
2021-05-17 15:50:35 +00:00
martin a718c32c6a Pull up following revision(s) (requested by hannken in ticket #1272):
sys/fs/ntfs/ntfs_subr.c: revision 1.64

ntfs_loadntnode(): Use bread() when ntm_sysvn[NTFS_MFTINO] is NULL.

May happen when loading node 0 (MFT) during mount and some
attributes are stored in another ntnode.

PR kern/56160 (Mount ntfs usb disk)
2021-05-17 15:48:57 +00:00
martin 42352fce30 Welcome to 9.2_STABLE! 2021-05-17 15:46:21 +00:00
martin d3fc9da33a Welcome to NetBSD 9.2! 2021-05-12 13:15:54 +00:00
martin 8fe8b9a08a Pull up following revision(s) (requested by dolecek in ticket #1270):
sys/dev/pci/siisata_pci.c: revision 1.21

disable MSI for SiI3124 - interrupts don't seem to work on this old board
when MSI is enabled, maybe because it's behind a PCI bridge

PR kern/55115 by John D. Baker
2021-05-09 07:09:27 +00:00
martin 2a25fd3c02 Pull up following revision(s) (requested by nia in ticket #1268):
sys/dev/audio/audio.c: revision 1.95

audio: Only score hardware formats by channel count at count<=2

Scoring by channel count makes sense when you are using hardware that
supports mono and stereo formats. However, if your hardware also supports
surround formats, defaulting to those might be confusing. So, don't
prefer them.

Problem reported and fix tested by tcmart14 with a 2015 model Macbook Pro.
2021-05-05 17:01:41 +00:00
bouyer 76be337271 Pull up following revision(s) (requested by martin in ticket #1265):
sys/kern/kern_exec.c: revision 1.505 via patch
Fix copy&pasto in handling of POSIX_SPAWN_RESETIDS in posix_spawn(3)
2021-05-03 09:12:50 +00:00
martin 6298fcb05d Pull up following revision(s) (requested by hannken in ticket #1267):
sys/miscfs/fdesc/fdesc_vnops.c: revision 1.135

Make sure fdesc_lookup() never returns VNON vnodes.
Should fix PR kern/56130 (fdescfs create nodes with wrong major number)
2021-05-03 09:03:22 +00:00
martin c1799e241e Pull up following revision(s) (requested by skrll in ticket #1261):
sys/arch/arm/include/lock.h: revision 1.38
	common/lib/libc/arch/arm/atomic/membar_ops.S: revision 1.7
	common/lib/libc/arch/arm/atomic/atomic_swap_16.S: revision 1.5
	common/lib/libc/arch/arm/atomic/atomic_swap_64.S: revision 1.12
	common/lib/libc/arch/arm/atomic/atomic_swap.S: revision 1.17

Add the appropriate memory barrier before the lock is cleared in
__sync_lock_release_{1,2,4,8}.  That is, all reads and write for the
inner shareability domain before the lock clear store.

Improve the membar_ops barriers - no need to use dsb and wait for
completion.  Also, we only to act on the inner shareability domain.

Fix the barrier confusion.  From Riastradh - thanks!.
2021-04-30 13:54:00 +00:00
martin c8cd50e6c4 Pull up following revision(s) (requested by rin in ticket #1258):
sys/arch/mac68k/mac68k/machdep.c: revision 1.361
	sys/arch/mac68k/mac68k/machdep.c: revision 1.362

Make mac68k_set_io_offsets() a little bit cleaner:
- Via1Base is always ``base'' for all supported models.
- Set sccA and SCSIBase for each model of MACH_CLASSQ class.
- Some style fixes.

No functional changes intended.

Change sccA address for Quadra 800 from base + 0xc000 to 0xc020.

The H/W partially decodes its address, and sccA is available at
offsets 0xc000, 0xc020, .... The functionality is same, but Mac
toolbox ROM routines use 0xc020, and QEMU for Quadra 800 only
supports this address.
2021-04-28 09:46:39 +00:00
martin c91436c9d9 Pull up following revision(s) (requested by rin in ticket #1256):
sys/arch/mac68k/mac68k/machdep.c: revision 1.360
	sys/arch/mac68k/conf/GENERIC: revision 1.234
	sys/arch/mac68k/conf/files.mac68k: revision 1.131

Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
2021-04-27 10:31:17 +00:00
martin 5f4d4c6490 Pull up following revision(s) (requested by rin in ticket #1255):
sys/arch/mac68k/mac68k/locore.s: revision 1.174

Fix DJMEMCMAX option for Quadra/Centris 650/800.
- Use jeq instead of jra for conditional branch.
- Use cmpl instead of cmp (= cmpw) for int variables.

Now, my Quadra 800 recognizes full 520MB memory!
2021-04-27 10:27:30 +00:00
martin 333ba5547b Pull up following revision(s) (requested by skrll in ticket #1254):
sys/arch/arm/include/lock.h: revision 1.37
	common/lib/libc/arch/arm/atomic/atomic_swap_64.S: revision 1.11
	common/lib/libc/arch/arm/atomic/atomic_swap.S: revision 1.15
	common/lib/libc/arch/arm/atomic/atomic_swap.S: revision 1.16
	sys/arch/arm/include/lock.h: revision 1.36

Fix ARMv8 instructions

Fix __sync_lock_release_4 to actually zeroise the whole 4bytes/32bits.

Trailing whitespace

Change #ifdef FOO to #if defined(FOO).  NFCI.
2021-04-26 18:34:28 +00:00
martin 69e918c2a6 Pull up following revision(s) (requested by riastradh in ticket #1252):
sys/arch/arm/sunxi/sun8i_h3_ccu.c: revision 1.18 (patch)
	sys/arch/arm/sunxi/sun8i_crypto.c: revision 1.24 (patch)
	sys/arch/arm/dts/sun50i-h5.dtsi: revision 1.2 (patch)

arm/sunxi: Wire up sun8icrypto(4) on Allwinner H5.

Tested on NanoPi Neo PLUS2.
2021-04-25 11:13:03 +00:00
martin 074bfe0538 Apply patch, requested by tsutsui in ticket #1249:
sys/arch/sparc/conf/GENERIC	(apply patch)

PR 56077: remove DIAGNOSTIC from sparc kernel.
2021-04-21 18:11:06 +00:00
martin c5292c2a0e Pull up following revision(s) (requested by tsutsui in ticket #1248):
sys/arch/hp300/dev/topcat.c: revision 1.5
	sys/arch/hp300/dev/diofb.c: revision 1.5

Fix two problems on old topcat(4) framebuffers found on HP332/340.

- Fix panic on monochrome framebuffers. They don't have palette registers.
  The problem was reported from Anders Gustafsson and also Andrew Gillham
  back in 2013:
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg000086.html
   https://mail-index.netbsd.org/port-hp300/2013/09/28/msg000087.html

- Fix incorrect framebuffer width of 98542/98544 framebuffers on HP332.
  Reported from Andrew Gillham (98542) as above and Chris Hanson (98543):
   https://mail-index.netbsd.org/port-hp300/2013/09/27/msg000083.html
   https://mail-index.netbsd.org/port-hp300/2020/05/01/msg000164.html

Worth to pullup to netbsd-9.
2021-04-21 17:59:47 +00:00
martin 03e820b450 Pull up following revision(s) (requested by tsutsui in ticket #1247):
sys/arch/zaurus/dev/w100lcd.c: revision 1.3

Make LCD BrightnessUp/BrightnessDown work on C7x0/860.

Patch from steleto:
 https://gist.github.com/steleto/10f62a074bff0c188fcc10c14ef40b5a

and also confirmed by me on SL-C700.

Worth to pullup to netbsd-9.
2021-04-21 17:51:34 +00:00
martin 903b9d2b4c Pull up following revision(s) (requested by isaki in ticket #1241):
sys/dev/audio/audiobell.c: revision 1.4

Fix and improve the buffer length calculation to avoid zero length
even if blk_ms is small.

This fixes PR kern/56059.
2021-04-06 17:44:29 +00:00
martin 37cb3b7a0f Pull up following revision(s) (requested by christos in ticket #1240):
sys/arch/sparc/sparc/trap.c: revision 1.199

PR port-sparc/55573: remove kernel message about disabled coprocessor
instructions - it is triggered by userland trying to detect availability
of sparcv9 VIS instructions.
2021-03-31 13:51:04 +00:00
martin c887346904 Apply patch, requested by tsutsui in ticket #1239:
sys/arch/sparc/dev/audioamd.c	(apply patch)

Fix for PR 56078 (different solution applied to -current): fix wrong
lock usage.
2021-03-31 13:45:54 +00:00
martin 22ee2887b3 Pull up following revision(s) (requested by skrll in ticket #1238):
sys/arch/arm/cortex/gic.c: revision 1.47

Only target the boot cpu for real with SPI interrupts.  I tried to do
this back in 2014, but somehow I missed a spot.

This is a quick-and-dirty fix for the USB stack which expects transfer
completions to be in-order.  If interrupts happen across the CPUs then
this isn't guaranteed (yet).

kern/55243 panic at usb_transfer_complete() on raspberry pi 4
2021-03-31 13:41:01 +00:00
martin 860e31549b regen for ticket #1236 (BELKIN F5D7050E fix) 2021-03-27 13:01:58 +00:00
martin 1d128d4afc Pull up following revision(s) (requested by nia in ticket #1236):
sys/dev/usb/usbdevs: revision 1.793

correct usb device id for BELKIN F5D7050E

matches freebsd / openbsd (sources of urtw driver), various online
sources

PR kern/56056
2021-03-27 13:00:45 +00:00
martin 6e177ddea3 Pull up following revision(s) (requested by nat in ticket #1234),
all via patch:

	sys/dev/usb/if_urtwn.c: revision 1.93
	sys/dev/usb/if_urtwn.c: revision 1.95
	sys/dev/usb/if_urtwn.c: revision 1.96

if_urtwn.c: Plug a few leaks
Can be a cause of PR/55968

Also free assocated mbufs.

Opps....Remove irrelavent debug code and don't free_m before IFQ_DEQUEUE().
Identified and reported by Patrick Welche and remedy found by Martin Husemann.
2021-03-22 18:20:38 +00:00
martin 83d05466d9 Pull up following revision(s) (requested by knakahara in ticket #1233):
sys/net/if_l2tp.h: revision 1.10

Fix l2tp(4) ioctl type. Pointed out by yamaguchi@n.o, thanks.
XXX pullup-[89]
2021-03-22 18:06:17 +00:00
martin 2cbceaad59 Pull up the following (all via patch) requested by msaitoh in ticket #1231:
sys/dev/pci/ixgbe/ixgbe.c			1.259, 1.278-1.279
	sys/dev/pci/ixgbe/ixgbe.h			1.75
	sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.12
	sys/dev/pci/ixgbe/ixgbe_vf.c			1.24-1.26
	sys/dev/pci/ixgbe/ixgbe_x550.c			1.17
	sys/dev/pci/ixgbe/ixv.c				1.155-1.156
	sys/dev/pci/ixgbe/ix_txrx.c			1.64-67
	sys/dev/pci/files.pci				1.436
	share/man/man4/ixg.4				1.13-1.14
	share/man/man4/ixv.4				1.6-1.7

- Fix a problem that the RX path stalled when the mbuf cluster is
  exhausted.
- Modify some parameters to reduce packet dropping. See also the
  manual's OPTIONS section for the detail.
- ixv(4): The max number of queue(pair) is not 7 but 8. Correctly
  reset the hardware.
- Add "TX " to "Queue No Descriptor Available" evcnt(9) name to make
  it more understandable.
- Fix a bug that some advertise speeds can't be set with
  hw.ixgN.advertise_speed if both 2.5G and 5G are set. Fix the error
  message, too.
- Fix typo in comment or debug message.
2021-03-11 16:00:24 +00:00
martin e46eba41d1 Pull up following revision(s) (requested by christos in ticket #1229):
sys/netinet/tcp_subr.c: revision 1.286
	sys/netinet/tcp_timer.c: revision 1.96
	sys/netinet/in_var.h: revision 1.102
	sys/netinet/in_var.h: revision 1.99

Don't increment the iss sequence on each connection because it exposes
information (Amit Klein)

Add some randomness to the iss offset

Use a random IPv4 ID because the shuffling algorithm used before could expose
information (Amit Klein)

mv <sys/cprng.h> include to the kernel portion
2021-03-09 15:54:32 +00:00
martin 06fad75928 Pull up following revision(s) (requested by tsutsui in ticket #1228):
sys/dev/ic/mb89352.c: revision 1.58

Fix a possible race condition in spc_msgin() in NO_MANUAL_XFER case.

To avoid the race, check SSTS and INTS after XFR command as
spc_pio_datain() does.

Reported from isaki@, observed on nono emulator.
2021-03-09 15:47:07 +00:00
martin 89ac33ee96 Pull up following revision(s) (requested by christos in ticket #1226):
sys/netinet6/ip6_id.c: revision 1.19-1.21
	sys/netinet6/ip6_var.h: revision 1.88
	sys/netinet/ip_input.c: revision 1.400
	sys/netinet/tcp_subr.c: revision 1.285
	sys/netinet/ip6.h: revision 1.30

netinet: Enable random IP fragment ids by default (from riastradh)

netinet: Enable RFC 1948 pseudorandom TCP ISS selection by default.
(from riastradh)

netinet6: Mark randomid unused.

Will make merging and bisection easier if anything goes wrong with
flow label or fragment id randomization changes.
(from riastradh)

netinet/netinet6: Add necessary includes to make these standalone.
(from riastradh)

Replace randomid() by cprng_fast32()
2021-03-07 19:04:31 +00:00
martin f5772f9340 Pull up following revision(s) (requested by isaki in ticket #1225):
sys/dev/usb/uaudio.c: revision 1.169

Fix my copy-and-paste bug in rev1.160.

This fixes recording sample dropout.
2021-03-07 18:43:25 +00:00
martin 40ef05260a Pull up following revision(s) (requested by tsutsui in ticket #1222):
sys/kern/kern_subr.c: revision 1.229

Restore missing message for RB_ASKNAME.
Cleanups.
2021-03-05 13:48:27 +00:00
martin 55103059ec Pull up following revision(s) (requested by isaki in ticket #1219):
sys/dev/audio/audio.c: revision 1.89
	sys/dev/audio/audio.c: revision 1.90
	sys/dev/audio/audio.c: revision 1.91

Change the lock conditions to call audio_unlink().

This can remove a different copy of audio_exlock_enter() in audio_unlink()
and can use normal one.  Also, in audiodetach(), this can set the exlock
at more natual order (before calling audio_unlink()).

No noticeable functional changes are intended.
Thanks for comments, riastradh@.

Protect also audioopen() and audiobellopen() from audiodetach() with
psref(9), as well as others(audioread, audiowrite, etc..).
- Rename audio_file_enter to audio_sc_acquire_fromfile, audio_file_exit
  to audio_sc_release, for clarify.  These are the reference counter for
  this sc.
- Introduce audio_sc_acquire_foropen for audio{,bell}open.
- audio_open needs to examine sc_dying again before inserting it into
  sc_files, in order to keep sc_files consistency.

The race between audiodetach and audioopen is pointed out by riastradh@.
Thank you for many advices.

Add missing curlwp_bindx() corresponding to curlwp_bind().
Pointed out by riastradh@.
2021-03-01 16:00:08 +00:00
martin ee44fb18dd Pull up following revision(s) (requested by isaki in ticket #1218):
sys/dev/audio/audio.c: revision 1.84

Fix a return value of audiopoll().
fo_poll is expected to return revents rather than errno on error.
2021-02-28 07:07:38 +00:00
martin 322ed0e7af Pull up following revision(s) (requested by isaki in ticket #1217):
sys/dev/audio/audio.c: revision 1.46
	sys/dev/audio/audio.c: revision 1.82
	sys/dev/audio/audio.c: revision 1.85
	sys/dev/audio/audio.c: revision 1.87
	sys/dev/audio/audio.c: revision 1.88

Change two aprint_error_dev() to device_printf() (and improve messages).
This is also called from other than boot.

Add missing newline.

Revise comments.

Change (harmless) zero-length debug messages.
sys/modules is compiled with -Wzero-length-format and this
makes sys/modules compilable even if AUDIO_DEBUG is defined.

Improve error messages.
- prefix MD device name if it's considered to be related to the MD driver.
- revise some messages.
2021-02-28 07:05:14 +00:00
martin 8e258899b6 Pull up following revision(s) (requested by isaki in ticket #1216):
sys/arch/hppa/gsc/harmony.c: revision 1.8
	sys/arch/hppa/gsc/harmony.c: revision 1.9
	sys/arch/hppa/gsc/harmony.c: revision 1.10

Fix locking against myself.
trigger_output will be called with sc_intr_lock held.

From source code review, not tested.

Fix my mistakes in rev1.6.
- I had to merge the channel bit and the speed bits.
  Reported by macallan@.
- I also fix my indent, while I'm here.

Simplify harmony_speed_bits().
It no longer needs to write back the speed value.
2021-02-28 07:01:01 +00:00
martin 139d52cc7a Pull up following revision(s) (requested by tsutsui in ticket #1214):
sys/arch/m68k/m68k/reenter_syscall.s: revision 1.5
	sys/arch/m68k/m68k/reenter_syscall.s: revision 1.6
	sys/arch/m68k/m68k/reenter_syscall.s: revision 1.7

Replace magic numbers with proper macros prepared in assym.h.

No binary changes.

Note this is a preparation for a possible fix of PR port-m68k/55990.

Consistently use motorola style.  No binary changes.
Seems missed in rev 1.3:
 https://mail-index.netbsd.org/source-changes/2013/08/01/msg046378.html

Plug kernel stack leaks in reenter_syscall() for setcontext(2).
This fixes long standing kernel crashes (MMU fault, address error,
and silent freeze by a double bus fault etc. seen for ~10 years)
caused by kernel stack overflow, especially on x68k and sun3 running
Xorg based servers.  See PR/55990 for more details.

"This change seems perfectly reasonable" from thorpej@ and
jklos@ also reported this also solved freeze of his mac68k system
with 10 megabyes of memory.

Should be pulled up to netbsd-9 and netbsd-8.
2021-02-25 09:36:27 +00:00
martin e248229b46 Apply patch, requested by jdolecek in ticket 1213:
Do not panic Dom0 when hypervisor grant_table_op(GNTTABOP_copy) fails
in xennet(4) backend driver, that can be triggered by malicious or buggy
DomU via bad grant reference.

Part of fixes for XSA-362.
2021-02-24 08:05:08 +00:00
martin e0d93292ce Pull up following revision(s) (requested by jdolecek in ticket #1211):
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.92 (via patch)

remove support for legacy rx-flip mode for xennet(4)/xvif(4), making
rx-copy (first shipped in NetBSD 6.0 in 2012) the only supported
mode

this is mostly to simplify maintenance and future development
rx-flip is not supported by Linux Dom0/DomU, and NetBSD Dom0/DomU
defaults to rx-copy for over 8 years now too, so there is little
need to keep the support for compatibility

besides compatibility there is no other reason to keep rx-flip -
page transfer is generally slower than copy due to necessary MMU/TLB
manipulation, especially on MP systems
2021-02-23 18:50:21 +00:00
martin d3162a7d66 Pull up following revision(s) (requested by jdolecek in ticket #1210):
sys/arch/xen/x86/xen_shm_machdep.c: revision 1.17 (via patch)

in xen_shm_map(), make sure to unmap any successfully mapped pages
before returning failure if there is partial failure
fix detection of partial failure - GNTTABOP_map_grant_ref can actually re=
turn

zero for partial failure, so we need to always check all the entries
to detect it

previously, kernel triggered panic() for partial failure, leading to
Dom0 page fault later; since the mapping failure can be triggered by
malicious DomU via bad grant reference, it's important to expect
the calls to fail, and handle it gracefully without crashing Dom0

part of fixes for XSA-362
2021-02-23 11:02:12 +00:00
martin 22427c133f Pull up following revision(s) (requested by knakahara in ticket #1209):
sys/arch/x86/x86/intr.c: revision 1.154 (via patch)

Fix x86's pci_intr_disestablish clean up routine.  Pointed out by t-kusaba@IIJ, thanks.

Fix panic on x86 by the following code.

====================
    sc_ih = pci_intr_establish_xname(sc_pc, ...);
    pci_intr_disestablish(sc_pc, sc_ih);
    sc_ih = pci_intr_establish(sc_pc, ...);
====================

ena(4) do such processing when ifconfig down/up.

XXX pullup-8,9
2021-02-19 17:47:13 +00:00
martin a2827ff801 Pull up following revision(s) (requested by oster in ticket #1206):
sys/dev/raidframe/rf_reconstruct.c: revision 1.125

Fix a long long-standing off-by-one error in computing lastPSID.

SUsPerPU is only really supported for a value of 1, and since the
first PSID is 0, the last will be numStripe-1.  Also update the
setting of pending_writes to reflect the change to lastPSID.

Needs pullups to -8 and -9.
2021-02-17 09:34:20 +00:00
martin 3c2e9902c7 Pull up following revision(s) (requested by tsutsui in ticket #1205):
sys/arch/x68k/x68k/machdep.c: revision 1.204

Restore fixes for PR/51663 lost in r1.195 (uvm_hotplug(9) merge).

The kernel crashdump and savecore(8) on NetBSD/x68k have been broken
(even without EXTNEDED_MEMORY) since NetBSD 8.0. Oops.

Should be pulled up to netbsd-9 and netbsd-8.
2021-02-11 13:02:04 +00:00
martin 54ebbebc4b Pull up following revision(s) (requested by ryoon in ticket #1204):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.136

Enable to mount Raspberry Pi Pico's USB mass storage partition
Fix PR kern/55985.

O.k. by thorpej@.
Pull-up to netbsd-8 and netbsd-9.
2021-02-11 12:58:29 +00:00
martin 295e6569eb Pull up following revision(s) (requested by ryoon in ticket #1203):
sys/dev/scsipi/cd.c: revision 1.350
	sys/dev/scsipi/sd.c: revision 1.331

PR 55986: Ryo Onodera: DK_BUSY must have mask as second argument. Make cd.c
consistent by also using __BIT()
2021-02-11 12:53:28 +00:00
martin 7d584dec1f Apply additional patch, requested by jdolecek in ticket #1191:
sys/kern/kern_event.c				1.110-1.115 (via patch)

Fix merge botch for the EV_ONESHOT branch.
2021-02-07 16:42:41 +00:00
martin 6272c33c16 regen (for ticket #1197) 2021-02-04 19:23:59 +00:00
martin 56fbb69ffe Pull up following revision(s) (requested by nia in ticket #1197):
sys/dev/usb/if_urtwn.c: revision 1.89,1.90
	sys/dev/usb/usbdevs: revision 1.788,1.789

urtwn(4): add TPLINK WN821N to the list of USB device ids
reported by kfmut on the unitedbsd forums.

add another TPLINK RTL8192EU variant
to avoid confusion use TP-Link's names for these variants, matching
FreeBSD
2021-02-04 19:23:10 +00:00
martin 74c6014453 Pull up following revision(s) (requested by riastradh in ticket #1196):
sys/dev/usb/uhid.c: revision 1.115
	sys/dev/usb/uhidev.h: revision 1.21
	sys/dev/usb/uhidev.c: revision 1.79
	(all via patch)

usb: Overhaul uhid(4) and uhidev(4) locking.

- uhidev API rules:
  1. Call uhidev_open when you want exclusive use of a report id.
     After it succeeds, you will get interrupts.
  2. Call uhidev_close when done with exclusive use of a report id.
     After it returns, you will no longer get interrupts.
     => uhidev_open/close do not nest.
  3. uhidev_write no longer requires the caller to have exclusive
     access -- if there is a write in progress, it will block
     interruptibly until done.  This way drivers for individual
     report ids need not work separately to coordinate their writes.
  4. You must uhidev_stop to abort any pending writes on the same
     report id.  (uhidev_stop no longer does anything else -- to
     ensure no more interrupts, just use uhidev_close.)
- Fix uhidev_open/close locking -- uhidev now has an interruptible
  config lock held only on first open and last close by any report id
  in the device, to serialize the transition between zero and nonzero
  numbers of references which requires opening/closing pipes and
  allocating/freeing buffers.
- Make /dev/uhidN selnotify(POLLHUP) when the device is yanked.
- Factor uhid device lookup and reference counting and dying
  detection and so on into uhid_enter/exit.
- Nix struct uhid_softc::sc_access_lock.  This served no purpose but
  to confuse me when trying to understand the logic of this beast
  (and to ensure uhidev_write exclusion, but it was uninterruptible,
  which is wrong for something that implements userland operations,
  and didn't actually work because uhidev_write did nothing to
  coordinate between different report ids).
- Fix locking in select/poll.
- Use atomics to manage UHID_IMMED to keep it simple.  (sc_lock would
  be fine too but it makes the code more verbose.)
- Omit needless UHID_ASLP -- cv_broadcast already has this
  micro-optimization.

With these changes, my Pinebook survives

for i in `jot 100`; do
        echo '###' $i
        for j in `jot 16`; do
                usbhidctl -rf /dev/uhid$j >/dev/null &
        done
        wait
done

while plugging and unplugging uhid(4) devices (U2F keys), and the U2F
keys still work as U2F keys.

ok nick, mrg

XXX pullup-9
XXX pullup-8?

Note on ABI and pullups: This changes the layout of struct
uhidev_softc, but with the sole exception of ucycom(4) -- which at
the moment is completely broken and unusable -- the only members that
USB HID drivers use are sc_udev and sc_iface, which haven't changed.
The layout of struct uhidev, which is allocated by each USB HID
driver in its own softc structure, is unchanged.
2021-02-04 19:16:01 +00:00
martin 044ceda013 Pull up following revision(s) (requested by riastradh in ticket #1195):
sys/miscfs/procfs/procfs_vfsops.c: revision 1.110

Fix procfs environ node.
2021-02-04 17:20:45 +00:00
martin c297959e52 Pull up following revision(s) (requested by nonaka in ticket #1192):
sys/dev/hyperv/if_hvn.c: revision 1.20 (via patch)
	sys/dev/hyperv/hvkbd.c: revision 1.7 (via patch)
	sys/dev/hyperv/vmbus.c: revision 1.12 (via patch)

hvkbd(4): Don't wait forever.
vmbus(4): Don't wait forever.
hvn(4): Don't wait forever.
2021-02-04 17:04:14 +00:00
martin 8131665b4f Pullup the following (requested by jdolecek in ticket #1191):
sys/kern/kern_event.c	r1.110-1.115 (via patch)

fix a race in kqueue_scan() - when multiple threads check the same
kqueue, it could happen other thread seen empty kqueue while kevent
was being checked for re-firing and re-queued

make sure to keep retrying if there are outstanding kevents even
if no kevent is found on first pass through the queue, and only
kq_count when actually completely done with the kevent

PR kern/50094 by Christof Meerwal

Also fixes timer latency in Go, as reported in
https://github.com/golang/go/issues/42515 by Michael Pratt
2021-02-04 16:57:25 +00:00
martin f42f7c8a2e Pull up following revision(s) (requested by nia in ticket #1188):
sys/arch/arm/broadcom/bcm2835_vcaudio.c: revision 1.16

vcaudio: don't advertise CAPTURE when all functions return EINVAL
2021-01-25 14:14:23 +00:00
martin c87056e06e Pull up following revision(s) (requested by riastradh in ticket #1187):
sys/kern/kern_threadpool.c: revision 1.23

threadpool(9): Fix synchronization between cancel and dispatch.
- threadpool_cancel_job_async tried to prevent
  threadpool_dispatcher_thread from taking the job by setting
  job->job_thread = NULL and then removing the job from the queue.
- But threadpool_cancel_job_async didn't notice job->job_thread is
  null until after it also removes the job from the queue =>
  double-remove, *boom*.

The solution is to teach threadpool_dispatcher_thread to wait until
it has acquired the job lock to test whether job->job_thread is still
valid before it decides to remove the job from the queue.

Fixes PR kern/55948.

XXX pullup-9
2021-01-25 14:12:50 +00:00
martin ba01d6fb3d Pull up following revision(s) (requested by jmcneill in ticket #1186):
sys/dev/pci/if_ena.c: revision 1.27

PR kern/55942: destroyed ena(4) evcnts cause panic

Fix event counter teardown code. From KUSABA Takeshi
2021-01-23 13:01:10 +00:00
martin e7a83fcf64 Apply patch, requested by khorben in ticket #1177 (issue solved differently
in -current):

	sys/kern/init_main.c			(apply patch)

PR kern/55906: create the aiodone workqueue before running mountroothooks.
2021-01-03 12:51:33 +00:00
martin 3b31628137 Additionally pull up following revision(s) (requested by rin in ticket #1173):
sys/kern/core_elf32.c: revision 1.67

Use <compat/netbsd32/netbsd32.h> instead of <machine/netbsd32_machdep.h>,
which is not intended for standalone use.

Compile tested for all ports with their own COMPAT_NETBSD32 codes:
aarch64, amd64, arm, mips64, sparc64, and algor64.

Should fix build failure for mips64 in netbsd-9, where netbsd32.h is not
included by other header files.
2021-01-02 10:23:46 +00:00
martin 964bc8eb11 Pull up following revision(s) (requested by nia in ticket #1176):
sys/ufs/ufs/ufs_quota1.c: revision 1.23

Avoid potentially accessing an array with an index out of range.
2021-01-01 13:17:08 +00:00
martin 68e14b84c8 Pull up following revision(s) (requested by rin in ticket #1175):
sys/arch/aarch64/aarch64/trap.c: revision 1.28,1.31,1.32 (patch)

- add support conditionally execution for A32 instruction emulation
- separated the processing of ARM and THUMB emul clearly. do not confuse the Thumb-32bit instruction with the ARM instruction.
- use far_el1 instead of tf_pc to return correct fault address when instruction emulation
2021-01-01 13:14:29 +00:00
martin 541008687a Pull up following revision(s) (requested by rin in ticket #1174):
sys/arch/aarch64/aarch64/vm_machdep.c: revision 1.9 (patch)

Fix clone(2) for COMPAT_NETBSD32.
(1) Set r13 (sp for arm32 processes) appropriately when stack is
     specified to fork1().
(2) For arm32 processes, align stack to 8-byte boundary, instead of
     16-byte for native aarch64 processes, to match our 32-bit ABI:
https://nxr.netbsd.org/xref/src/sys/arch/arm/arm32/vm_machdep.c#150

Note that sp alignment checking is disabled in aarch32 mode, and
this works fine with AARCH64_EL0_STACK_ALIGNMENT_CHECK option.

OK ryo
2021-01-01 13:06:39 +00:00
martin 664a0154ac Pull up following revision(s) (requested by rin in ticket #1173):
sys/kern/core_elf32.c: revision 1.65 (patch)

Use correct note types for register storage in 32-bit core files for
architecture on which 64- and 32-bit ABIs use different values for
PT_GET{,FP}REGS, i.e., aarch64{,eb}.

Now, 32-bit GDB works fine for core files generated by aarch64{,eb}
kernel.

Should be no functional changes for ports other than aarch64{,eb}.
2021-01-01 13:04:08 +00:00
martin 05b3ec4ce1 Pull up following revision(s) (requested by rin in ticket #1172):
sys/arch/aarch64/aarch64/trap.c: revision 1.30
	sys/arch/aarch64/include/ptrace.h: revision 1.10
	sys/arch/aarch64/include/netbsd32_machdep.h: revision 1.4 (patch)
	sys/arch/aarch64/aarch64/netbsd32_machdep.c: revision 1.14
	sys/arch/aarch64/aarch64/netbsd32_machdep.c: revision 1.15

Add support of ptrace(2) for COMPAT_NETBSD32.

Now, GDB for arm32 is usable for debugging 32bit applications.
OK ryo@

For rev 1.14 and before, netbsd32_process_write_regs() returns EINVAL
if non-modifiable bits are set in CPSR.
Instead, mask out non-modifiable bits and make this function success
regardless of value in CPSR. New behavior matches that of arm:
https://nxr.netbsd.org/xref/src/sys/arch/arm/arm/process_machdep.c#187

This fixes lib/libc/sys/t_ptrace_wait*:access_regs6 tests, in which
register contents retrieved by PT_GETREGS are set back by PT_SETREGS.

No new regression is observed in full ATF run.

OK ryo
2021-01-01 12:58:35 +00:00
martin 5df1e63a47 Pull up following revision(s) (requested by rin in ticket #1171):
sys/arch/aarch64/aarch64/pmap.c: revision 1.82
	sys/arch/aarch64/aarch64/pmap.c: revision 1.83

pmap_procwr(): sync icache even if p != curproc. This fixes applications
like GDB for arm32, that rewrite text of other process.

Thanks to ryo@ for discussion.

Use tlen for temporary length variable instead of l, which is usually
used for struct lwp *.
No binary changes.
2021-01-01 12:54:07 +00:00
martin 0fa432e9aa Pull up following revision(s) (requested by rin in ticket #1170):
sys/arch/aarch64/aarch64/cpufunc.c: revision 1.22 (patch)
	sys/arch/aarch64/aarch64/cpufunc.c: revision 1.23 (patch)
	sys/arch/aarch64/aarch64/pmap.c: revision 1.81

Set uvmexp.ncolors appropriately, which is required for some CPU
models with VIPT icache.

Otherwise, alias in virtual address results in inconsistent results,
at least for applications that rewrite text of other process, e.g.,
GDB for arm32.

Also, this hopefully fixes other unexpected failures due to alias.
Confirmed that there's no observable regression in performance;
difference in ``time make -j8'' for GENERIC64 kernel on BCM2837
with and without setting uvmexp.ncolors is within 0.1%.

Thanks to ryo@ for discussion.


Fix uvmexp.ncolors for some big.LITTLE configuration; it is uncertain
which CPU is used as primary, and as a result, secondary CPUs can
require larger number of colors.

In order to solve this problem, update uvmexp.ncolors via
uvm_page_recolor(9) when secondary CPUs are attached, as done for
other ports like x86.

Pointed out by jmcneill@, and discussed on port-arm@:
http://mail-index.netbsd.org/port-arm/2020/07/03/msg006837.html
Tested and OK'd by ryo@.

Fix previous; add missing <uvm/uvm.h> include.
2021-01-01 12:38:49 +00:00
martin bc33b6d0e1 Pull up following revision(s) (requested by rin in ticket #1169):
sys/arch/aarch64/aarch64/trap.c: revision 1.21
	sys/arch/aarch64/aarch64/trap.c: revision 1.26

PR port-arm/54702
Add support for earmv6hf binaries on COMPAT_NETBSD32 for aarch64:
- Emulate ARMv6 instructions with cache operations register (c7), that
   are deprecated since ARMv7, and disabled on ARMv8 with LP64 kernel.

Many thanks to ryo@ for helping me to add support of Thumb-mode,
as well as providing exhaustive test cases:
   https://github.com/ryo/mcr_test/

We've confirmed:
- Emulation works in Thumb-mode.
- T32 16-bit length illegal instruction results in SIGILL, even if
   it is located nearby a boundary b/w mapped and unmapped pages.
- T32 32-bit instruction results in SIGSEGV if it is located across
   a boundary b/w mapped and unmapped pages.


When emulating obsoleted arm32 instructions, use ufetch(9) rather than
dereference tf_pc directly to retrieve an instruction.
Even if tf_pc is valid when processor decodes the instruction, someone
can unmap its page before tf_pc is read in the exception handler.
Now, SIGSEGV is delivered correctly to the process in this case, rather
than kernel panic.

Pointed out by maxv.

Discussed with ryo and skrll.
2021-01-01 12:31:19 +00:00
martin 2d186a7d2a Pull up following revision(s) (requested by jmcneill in ticket #1167):
sys/dev/ic/ahcisata_core.c: revision 1.84
	sys/dev/ic/ahcisata_core.c: revision 1.85
	sys/dev/ic/ahcisata_core.c: revision 1.88
	sys/dev/ic/ahcisata_core.c: revision 1.89
	sys/arch/arm/nvidia/tegra_ahcisata.c: revision 1.13
	sys/dev/ic/ahcisatavar.h: revision 1.26
	sys/dev/ic/ahcisata_core.c: revision 1.90
	sys/dev/ic/ahcisata_core.c: revision 1.91
	sys/dev/ic/ahcisata_core.c: revision 1.92
	sys/dev/ata/satareg.h: revision 1.6

ahci_exec_fis: wait for the correct amount of time when AT_WAIT is set

Retry clearing WDCTL_RST a few times before giving up. Makes SATA work in
Solidrun Honeycomb LX2K.

AHCI 1.3.1 specification says that it is good practice for system software
to 'zero-out' the memory allocated and referenced by PxCLB and PxFB.

ahci_intr: use ffs in the port bitmask instead of looping over all 32 bits

AHCI 1.3.1 section 5.5.3 "Processing Completed Commands" says that we
should clear PxIS before IS.IPS.

Add G3 and DevSleep definitions. This changes the mask used by
SControl_IPM_NONE from 0x3 to 0x7.

Make sure to ack IS after PxIS when polling and when using multiple MSI-X
messages.

Remove the AHCI_QUIRK_SKIP_RESET quirk now that the underlying issue is
fixed.
2020-12-30 15:12:38 +00:00
martin 3838fd60b0 Pull up following revision(s) (requested by jmcneill in ticket #1166):
sys/dev/hdaudio/hdaudio.c: revision 1.13

If the Subordinate Node Count returns 0 nodes, complain and return instead
of trying to kmem_zalloc 0 bytes later on.
2020-12-28 20:21:54 +00:00
martin 2d73392efd Pull up following revision(s) (requested by jmcneill in ticket #1165):
sys/dev/hdaudio/hdaudio.c: revision 1.12

Initialize DMA memory when allocating it. Should fix PR# 51734 (hdaudio
"RIRB timeout" on boot).
2020-12-28 20:18:09 +00:00
martin cbcf134c84 Pull up following revision(s) (requested by tsutsui in ticket #1162):
sys/dev/ic/stivar.h: revision 1.11
	sys/dev/ic/sti.c: revision 1.23
	sys/dev/ic/sti.c: revision 1.24
	sys/dev/ic/sti.c: revision 1.25
	sys/arch/hp300/dev/sti_sgc.c: revision 1.4

Pull the latest OpenBSD sti(4) changes for bitmap framebuffer support.
- bitmap and colormap ops based on old HP ngle X11 driver:
  http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/dev/ic/sti.c#rev1.76
  > Work-in-progress support for non-accelerated X11 on *some* sti(4)
  > frame buffers; based upon the old HP ngle X11 driver.
  > Currently limited to CRX (720/735/750), Timber (710, old 715),
  > Artist (712, 715) and EG (B-series), however the
  > colormap isn't set up correctly on Timber and EG yet.
  >
  > Joint work with Artem Falcon, now in good enough shape to be worked further
  > in the tree.
- misc other cosmetic changes to reduce diffs
No particular comments on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/12/19/msg000184.html
 https://mail-index.netbsd.org/port-hp300/2020/12/20/msg000185.html

The MD hp300 attachment for SGC CRX (A1659-66001) will be committed
separately.

Add bitmap access ops support for SGC CRX (A1659-66001) framebuffer.
Also modify existing 425e EVRX attachment to use updated MI sti(4) ops
more efficiently.

The Xorg server and mlterm-wscons (that support wsdisplay bitmap) work
fine on SGC hp425t.

No particular comments on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/12/19/msg000184.html
 https://mail-index.netbsd.org/port-hp300/2020/12/20/msg000185.html

Special thanks to Miod Vallat again, for contributing the SGC CRX
framebuffer with the SGC connector and flexible cable for HP9000/425t.

He also contributed DIO-II "Hyperion" monochrome framebuffer and
1 plane grayscale SGC GRX (A1924-66001), and I've confirmed hyper(4)
just works even with Xorg server.  I will try GRX as the next project.

Handle WSSCREEN_REVERSE properly.  Based on OpenBSD's sti(4).

Also remove WSSCREEN_UNDERLINE from capabilities that is not handled
by sti(4) ROM routines.

Tested on HP9000/425t with CRX.

Ignore WSDISPLAYIO_PUTCMAP in WSDISPLAYIO_MODE_EMUL, i.e. text mode.

The hardware palette settings are handled by the STI ROM in STI_TEXTMODE
and changing cmap could cause mangled text colors at least on CRX on 425t.

Updating CMAP in EMUL mode isn't expected anyway.

Fixes "red or invisible text" after exiting mlterm-wscons on A1659 CRX.
2020-12-28 20:10:04 +00:00
martin 43d32978d1 Pull up following revision(s) (requested by tsutsui in ticket #1161):
sys/arch/hp300/dev/dnkbd.c: revision 1.11
	sys/arch/hp300/dev/hil_intio.c: revision 1.4

Fix a longstanding bug in hilkbd (and dnkbd) console attachment.
cn_tab->cn_dev is initialized in wsdisplay_emul_attach()
(but not in wsdiaplay_cnattach()) so it cannot be used
when hil(4) is attached before wsdisplay(4) is attached.

Instead, use exported wsdisplay_cnputc() that is actually
set in early wsdisplay_cnattach().

Now we can use ddb and RB_ASKNAME via HIL keyboard console.

Should be pulleld up to netbsd-8 and netbsd-9.
2020-12-28 20:02:30 +00:00
martin 4769008c64 Pull up following revision(s) (requested by riastradh in ticket #1159):
sys/dev/usb/ohci.c: revision 1.314
	sys/external/bsd/dwc2/dwc2.c: revision 1.75
	sys/dev/usb/ehci.c: revision 1.284
	sys/dev/usb/uhci.c: revision 1.305
	sys/dev/usb/xhci.c: revision 1.136

usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.

These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT
endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to
pass the struct usbd_xfer object to usbd_close_pipe to free later.

In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints,
up_intrxfer is never initialized, so the assertion cannot be right.
In principle we might even have more than one outstanding interrupt
transfer at a time, rendering the point of the assertion moot anyway.

Found by interrupting a uhidev write to a u2f device.

ok nick
2020-12-23 12:34:38 +00:00
martin 8eef930f19 Pull up following revision(s) (requested by isaki in ticket #1158):
sys/dev/audio/audio.c: revision 1.83

Avoid a dead lock in audiodetach, since rev 1.63.
audio_unlink() must be called without exlock held (and
audio_mixer_destroy() must be called with exlock held).

This makes unplugging during playing/recording work (again).

Reported by Julian Coleman on current-users:
 http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html
2020-12-19 13:54:56 +00:00
martin b4c6f2e09f Pull up following revision(s) (requested by isaki in ticket #1156):
sys/dev/audio/audio.c: revision 1.80
	sys/dev/audio/audio.c: revision 1.81

Fix that audio_open() didn't halt the recording mixer correctly
if fd_allocfile() failed, since rev 1.65.

Will fix PR kern/55848.

 -

Rewrite error handling on audio_open().
This also fixes a few resource leaks on error case.
2020-12-19 13:48:27 +00:00
martin 2031e882ec Pull up following revision(s) (requested by tsutsui in ticket #1152):
sys/arch/hp300/conf/RAMDISK: revision 1.16
	sys/arch/hp300/conf/INSTALL: revision 1.66

Remove options (NVNODE, NBUF, and BUFPAGES) for small RAM machines.

These options make extracting binary sets much slower even on miniroot.

Instead, use "options BUFCACHE=5" (use 5% of memory for buffercache) and
also specify "-fno-unwind-tables" for COPTS to shrink INSTALL kernel.

Worth to pullup to netbsd-9.
2020-12-14 17:29:35 +00:00
martin 6cdae57e18 Pull up following revision(s) (requested by skrll in ticket #1150):
sys/dev/usb/ohci.c: revision 1.311
	sys/dev/usb/ohci.c: revision 1.312
	sys/dev/usb/ohcivar.h: revision 1.62

Restructure the abort code for TD based transfers (ctrl, bulk, intr).

In PR kern/22646 some TDs can be on the done queue when the abort start
and, if this is the case, they need to processed after the WDH interrupt.
Instead of waiting for WDH we release TDs that have been touched by the
HC and replace them with new ones.  Once WDH happens the floating TDs
will be returned to the free list.

Also addresses the issue seen in PR kern/55835

Thanks to both Andreas Gustafsson and Edgar Fu=C3=9F for testing.  Apologi=
es to
Andreas Gustafsson for not committing this to HEAD for 4y6m.w

Remove leading space that crept in in the last change
2020-12-12 20:29:11 +00:00
martin f09f362a16 Pull up following revision(s) (requested by mrg in ticket #1149):
sys/dev/fdt/pwm_backlight.c: revision 1.7

save the new current level when set by the user.

stops PBP display from going back to default brightness after
dpms, etc.

ok jmcneill.
2020-12-12 13:03:46 +00:00
martin 111a21b041 Pull up following revision(s) (requested by mrg in ticket #1147):
sys/dev/usb/ucom.c: revision 1.128

properly wait for refcounts to drain.
fixes panic at detach that jmnceill saw.

XXX: pullup-[89].
2020-12-12 12:56:40 +00:00
martin 0362684733 Pull up following revision(s) (requested by nonaka in ticket #1146):
sys/dev/hyperv/if_hvn.c: revision 1.19

hvn(4): fix unable to ifconfig up/down.
2020-12-11 15:43:16 +00:00
martin ef0fc785ce Pull up following revision(s) (requested by kardel in ticket #1144):
sys/dev/ic/nvme.c: revision 1.53

PR kern/55839:

handle multiple nvme_rescan()s correctly by doing the
name-space identify only once per nsid.
fixes issue where modloading triggers multiple
rescans.
2020-12-07 20:04:07 +00:00
martin 16fba79676 Pull up following revision(s) (requested by kardel in ticket #1143):
sys/netinet/ip_mroute.c: revision 1.164

PR kern/55779:

restore non-desctructive guarantee of ip_mforward() mbuf
argument. This avoids generation invalid UDP checksums
on multicast packets in ip_output().

XXX the root cause of the misguided fix in 2008 should be
XXX investigated
2020-12-07 19:58:04 +00:00
martin 1db18eea9d Pull up following revision(s) (requested by maya in ticket #1136):
sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c: revision 1.11

Match linux here and wait without interrupts.

From David H. Gutteridge in PR port-amd64/55555
There's a second part to the patch, but "make our code behave the way
the upstream code does" is very welcome.

Also PR kern/54515 and possibly others.
2020-11-29 11:34:04 +00:00
martin 7cb171e7c4 Pull up following revision(s) (requested by rin in ticket #1133):
sys/dev/pci/if_wm.c: revision 1.696

Fix little-endian dependence in wm_rxeof(), by which packets cannot be
received by 82574 and successors on big-endian machines.

Tested by aarch64eb with I210-T1 on ROCKPro64.

Thanks msaitoh for discussion!
XXX
pullup to netbsd-9 and netbsd-8
2020-11-16 18:21:45 +00:00
martin dfc4c78637 Pull up following revision(s) (requested by fair in ticket #1130):
sys/sys/param.h: revision 1.679
	sys/conf/param.c: revision 1.69
	sys/kern/init_main.c: revision 1.533

Set a better default for MAXFILES on larger RAM machines if not
otherwise specified the kernel config file.  Arbitary numbers are
20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or
more.

TODO: Adjust this and other values totally dynamically.
2020-11-14 15:36:11 +00:00
martin a326d90b6d Pull up following revision(s) (requested by hannken in ticket #1131):
sys/coda/coda_vnops.c: revision 1.114 (patch)
	sys/coda/coda.h: revision 1.21 (patch)

Rewrite coda_readdir() to directly process the container file.

Passing this operation down to the file system holding the container
cannot work for anything but UFS and UFS doesn't allow reading
directory from a plain file since ~2015.

Fixes PR kern/55775 Coda client, its in-kernel part, opens wrong files ...
2020-11-14 13:01:55 +00:00
martin 9d3809bc2c Pull up following revision(s) (requested by skrll in ticket #1128):
sys/arch/aarch64/aarch64/pmapboot.c: revision 1.11

Fix the use of the contiguous bit by checking the output address as well.
2020-11-09 11:47:15 +00:00
martin a99ab92ea6 Pull up following revision(s) (requested by kamil in ticket #1127):
sys/compat/linux/common/linux_socket.c: revision 1.151

Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*.  If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
2020-11-08 08:39:12 +00:00
martin 37e1dd8a74 Pull up following revision(s) (requested by knakahara in ticket #1126):
sys/dev/pci/if_wm.c: revision 1.694
	sys/dev/pci/if_wm.c: revision 1.695 (via patch)
	sys/dev/pci/if_wmvar.h: revision 1.47

Add WMPHY_I350. Not used yet.

Workaround for ihphy and atphy(ICH*/PCH*, 82580 and I350).
These phys stop DMA while link is down which causes device timeout.
Fix PR/kern 40981
Reviewed and tested by msaitoh@n.o, thanks.
XXX pullup-[89]
2020-11-04 11:48:26 +00:00
martin 5b87b20a36 Pull up following revision(s) (requested by nia in ticket #1124):
sys/kern/kern_time.c: revision 1.206

kern_time: prevent the system clock from being set too low or high
currently doing this will drive KUBSAN haywire and possibly cause
system lock-ups, so more testing should probably be performed before
we let the clock be set too many thousands of years into the future.

ditto for negative values, which were being passed by chrony for
some reason while my internet connection was being unreliable.
this also triggered some interesting KUBSAN reports.
2020-11-01 17:26:01 +00:00