Commit Graph

274309 Commits

Author SHA1 Message Date
skrll
f7f69ae002 Define pinctrl-names for sdhci to fix it. From Harold Gutch and discussed
on port-arm.

http://mail-index.netbsd.org/port-arm/2020/02/13/msg006497.html
2020-02-22 09:54:27 +00:00
roy
5403a7a7c1 zfs: build a ramdisk on amd64 with enough to mount rpool/ROOT on /
Until we get ZFS integrated into our boot loader, this is the next best
thing. The idea is simple - have a small FFS partition with a kernel,
modules and this ramdisk. Once the ramdisk boots it will mount the FFS
partition read only, copy the needed ZFS modules to the ramdisk and then
unmount the partition. Then we import the ZFS root pool, mount the
ZFS root filesystem and then pivot to it.

Because the initial FFS partition is not mounted at this point, we
can mount it in /altroot so we can replace the kernel and modules with
newer ones so it's easily maintainable.

This ZFS boot strapper currently makes the following assumptions:
 * The device NAME=boot is the FFS with kernel, modules and this ramdisk.
 * The ZFS root pool and root filesystem are called rpool/ROOT.

A boot.cfg menu entry can then be added like so:
menu=Boot ZFS root:fs /ramdisk-zfsroot.fs;boot
2020-02-22 09:53:47 +00:00
maxv
11fc230787 pass the address of the field, instead of relying on it being the first
field of the structure, no functional change
2020-02-22 09:42:20 +00:00
jmcneill
2426b4c1e2 If the default GOP mode is unavailable, fallback to the first mode defined.
PR# port-amd64/55000
2020-02-22 09:34:26 +00:00
maxv
a4bb61b904 pass the address of the field, instead of relying on it being the first
field of the structure, no functional change
2020-02-22 09:30:42 +00:00
maxv
99c26a8a3e pass the address of the field, instead of relying on it being the first
field of the structure, no functional change, ok kamil
2020-02-22 09:24:05 +00:00
maxv
0d945ea0ff Inline the block in the parent block, for clarity, and also to prevent a
false positive with kMSan.

Here, LLVM reorders the conditions and checks 'vattr' before 'error'. But
if 'error' is non-zero then 'vattr' is not initialized, and kMSan notices
the uninitialized memory read.
2020-02-22 08:58:39 +00:00
maxv
559c53d028 Zero out 'tv', to prevent uninitialized bytes in its padding from leaking
to userland. Found by kMSan.

Reported-by: syzbot+8134380511a82c8f5fd7@syzkaller.appspotmail.com
2020-02-22 08:39:33 +00:00
skrll
adfb9b968c Fix previous for _ARM32_NEED_BUS_DMA_BOUNCE 2020-02-22 08:22:09 +00:00
isaki
4f60b558c3 Make calling get_props() lockless.
get_props() of all MD drivers now can be called without sc_lock.
2020-02-22 08:15:09 +00:00
isaki
6d13f8a36a On audio_[pr]mixer_halt(), it's better to reset parameters in intr_lock. 2020-02-22 08:03:19 +00:00
isaki
710d84f6ac Add KASSERTs. audio_[pr]mixer_start() need exlock. 2020-02-22 08:01:59 +00:00
isaki
3dc846c0d9 Move #if DIAGNOSTIC..#endif to correct place.
It should ignore stray interrupts regardless of DIAGNOSTIC.
2020-02-22 07:59:47 +00:00
isaki
379e7aeb32 hw_if->query_format is already mandatory method. Drop null checks. 2020-02-22 07:09:18 +00:00
isaki
61f731db38 Improve KASSERT messages. 2020-02-22 06:58:39 +00:00
isaki
63cdbdbe8c Change two aprint_error_dev() to device_printf() (and improve messages).
This is also called from other than boot.
2020-02-22 06:36:07 +00:00
isaki
9fd5ffc974 const-ify. These arguments are no longer written back. 2020-02-22 06:28:10 +00:00
isaki
5eda9f581a Fix/Update comments. 2020-02-22 06:22:46 +00:00
isaki
a05df8ab92 Update AUDIO_SETINFO_channels test.
The kernel limits the number of channels that userland apps can set to
the number of channels supported by the hardware or less.
2020-02-22 05:53:19 +00:00
isaki
0b3fcad9a1 Limit the number of channels that userland apps can set (by AUDIO_SETINFO)
to the number of channels supported by the hardware or less, if the hardware
supports multi channels.
- On monaural or stereo hardware, userland apps can always set 1ch or 2ch.
  The kernel (audio layer) can convert mono-stereo each other.
- On 3ch (2.1ch) hardware, for example, userland apps can set 1, 2, or 3ch,
  but not 4ch or more.
This allows userland apps to know actual number of channels supported by
the hardware in the same way as before.
PR kern/54973.
2020-02-22 05:51:39 +00:00
jmcneill
cb1ea6d12b Add ACPI glue for Broadcom GENETv5 2020-02-22 02:28:06 +00:00
kamil
7cd593c092 Avoid undefined behavior
route.c:1523:20, left shift of 1073741824 by 1 places cannot be represented
in type 'int'
2020-02-22 00:42:15 +00:00
kamil
35ea0de335 Avoid unportable left shift construct
left shift of 9 by 28 places cannot be represented in type 'int'
2020-02-22 00:38:14 +00:00
kamil
5c041fb274 Avoid undefined behavior in *_BITMAP_FREE() macros
left shift of 1 by 31 places cannot be represented in type 'int'
2020-02-22 00:32:08 +00:00
jmcneill
75b925d5cf Add support for Broadcom GENET v5 ethernet controller as found on the
Raspberry Pi 4 (BCM2711).
2020-02-22 00:28:35 +00:00
kamil
93226e2fbb Avoid undefined behavior in get_modstat_info
t_modctl.c:114:16, member access within misaligned address 0x71bf5bcede84
for type 'struct modstat_t'

t_modctl.c:116:13, load of misaligned address 0x7e81bc3c9104 for type
'struct modstat_t' which requires 8 byte alignment
2020-02-22 00:24:15 +00:00
kamil
b216505454 Avoid undefined behavior in disabledstat
t_builtin.c:174:16, member access within misaligned address 0x741271c25004
for type 'struct modstat_t'

t_builtin.c:175:4, member access within misaligned address 0x741271c251c4
for type 'struct modstat_t'
2020-02-22 00:18:55 +00:00
jmcneill
cb06b35c41 Translate bus addresses for SCB on BCM2711 2020-02-22 00:17:54 +00:00
maya
7b32337ee9 Make sure to convey a failure to the calling function
Likely fix for PR kern/54999, but that was a one-off panic.
2020-02-21 23:27:06 +00:00
kamil
ea9be1b430 Mark division by 0 as expected in sigfpe_int
Disable ubsan instrumentation on the operation.
2020-02-21 22:25:50 +00:00
kamil
510d9ff8d5 Avoid undefined behavior in is_module_present()
t_fopen.c:339:18, member access within misaligned address 0x7f7ff7ebd004
for type 'modstat_t' (aka 'struct modstat') which requires 8 byte alignment
2020-02-21 22:14:59 +00:00
kamil
ca9a018f12 Avoid undefined behavior in *BIT macros
hash_page.c:792:2, left shift of 1 by 31 places cannot be represented in type 'int'
hash_page.c:855:2, left shift of 1 by 31 places cannot be represented in type 'int'
hash_page.c:779:3, left shift of 1 by 31 places cannot be represented in type 'int'
2020-02-21 22:04:06 +00:00
maxv
e3ba625111 In pmap_changeprot_local(), drop the dirty bit along with the write bit. 2020-02-21 18:34:37 +00:00
maxv
302ce37157 Add comments. 2020-02-21 18:31:55 +00:00
rin
8a8f8609f8 Do not try to recovery from data page fault in interrupt context;
catch up belatedly with powerpc/trap.c rev 1.49 and etc.:

    http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/powerpc/trap.c#rev1.49
2020-02-21 15:15:48 +00:00
joerg
1fb1813c28 LLVM doesn't use term.h, so don't check for it when probing here either.
Increase robustness of checks for incremental builds by forcing a
dependency on the Makefile itself.
2020-02-21 15:00:44 +00:00
rin
1b26c2a61c Tiny improvements to copyin() and copyout():
- Use lwz/stw instead of 4-byte lswi/stswi for 405 and later, which
  support unaligned word load/store by hardware. In many cases, both
  source and destination are aligned on word boundaries.

- Use dcbst instead of dcbf to flush cache. The former does not
  invalidate the cache line. Copied data should be used soon after.
2020-02-21 14:49:57 +00:00
rin
17eddb1bb1 Cosmetic changes for assembler codes. No binary changes. 2020-02-21 14:27:20 +00:00
rin
8847bd2d2b When UPAGES > 1, both __HAVE_CPU_UAREA_ROUTINES and PMAP_MAP_POOLPAGE
must be defined in order to allocate physically contiguous memory for
u-area.
2020-02-21 13:38:05 +00:00
skrll
df08bba629 Use designated initialisers 2020-02-21 13:33:07 +00:00
rin
b851f544a9 Comment out badaddr() and badaddr_read() on ibm4xx for now.
They are not used nor exposed externally in any header file; these
functions may have never been tested so far.

Enable them again when necessary.

Note that badaddr() for oea is used by macppc port, where it is
declared as an external function.
2020-02-21 13:32:31 +00:00
rin
2791303760 In ppc4xx_tlb_find_victim(), mark kernel stack page TLBF_REF instead of
TLBF_USED. This should be originally intended behavior of this code
segment, because

- TLBF_USED is already checked just before, so marking this page
  TLBF_USED is no-op.
- TLBF_REF flag exempts that page from being flushed from TLB in next
  scan, when kernel stack may be still there with high probability.
2020-02-21 13:16:16 +00:00
skrll
c02d4e447c Improve a comment 2020-02-21 13:15:54 +00:00
rin
4d2aef8b1b Reduce UPAGES from 2 to 1 for ibm4xx, which was originally 1 and bumped
to 2 in rev 1.29:

    http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/include/param.h#rev1.29

Since page size is 16KB on ibm4xx, USPACE is still 16KB, which is the
same size as on other powerpc processors.

This avoids kernel crash described in PR kern/54994. Also, even if the
PR is resolved, fork(2) easily fails with ENOMEM if UPAGES is 2, which
requires physically contiguous pages for u-area. No bad side effect is
observed as far as I can see.

XXX
Even with this commit, kern/54994 still critically affects other archs
with __HAVE_CPU_UAREA_ROUTINES, i.e., alpha, mips, powerpc/{oea,booke},
and riscv.
2020-02-21 12:56:37 +00:00
skrll
71d602f2c7 Fix a memory leak. Spotted by nat@ 2020-02-21 12:41:29 +00:00
riastradh
00772fbc46 OOPS -- fix mistake in previous commit.
bbusy really needs to return the error; otherwise things are very
bad!
2020-02-21 02:04:40 +00:00
joerg
ce578dfc2b Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.
2020-02-21 00:26:21 +00:00
kamil
4fbe278b92 Refactor dbregs_dont_inherit_lwp()
Switch from native LWP calls to pthread(3) calls.
2020-02-20 23:57:16 +00:00
joerg
8c0c92a33c The global offset table is spelled .TOC. on PPC64, so preserve that symbol. 2020-02-20 22:52:10 +00:00
kamil
8eecffe079 Minor changes to t_ptrace_wait*
Add check for security.models.extensions.user_set_dbregs in the
concurrent event tests.

Use unconditionally atf_tc_skip(); as the test is racy.
2020-02-20 22:38:54 +00:00