Commit Graph

3956 Commits

Author SHA1 Message Date
mrg a56a944e10 avoid a GCC 12 warning.
there's a 1-element long array and a loop conditional that tries to see
if indexes for it are not identical.  as these indexes will always both
be 0, the only valid index, the condition is always false.  GCC 12
triggers a strange warning on this code that can never run (see below),
so simply assert the array size is 1 and comment the rest.

amdgpu_dc_stream.c:470:55: error: array subscript [0, 0] is outside array bounds of 'struct dc_writeback_info[1]' [-Werror=array-bounds]
  470 |                                 stream->writeback_info[j] = stream->writeback_info[i];
2023-08-15 05:01:57 +00:00
mrg c7cd742397 avoid uninitialised variable usage in drm_gem_cma_create_internal().
in the case nothing has returned 'error', 'nsegs' and the dma info
are (potentially) uninitialised, so consider this an error.

found by GCC 12.
2023-08-15 04:57:36 +00:00
andvar 2c4d487849 viadrmums(4): build legacy VIA DRM UMS driver module for amd64.
This driver is not built-in by default, thus loadable module can help (un)lucky
owners of 64-bit capable VIA (Nano/Eden) systems or early AMD/Intel systems
with some VIA chipsets, which include VIA integrated graphics.
I also boldly added product IDs for few later models from VX8xx/VX9xx chipsets
without 3D support (DX9_0) to "expand" the driver support to more systems.
Tested successfully basic functionality on VX800, and partially successfully
on VX900 (on VX900 Xorg failed to initialize due to openchrome related issues,
viadrmums attaches and it is by used the driver).
Didn't test on VX855, I don't have one.

Pull up to netbsd-10 is needed.
2023-08-09 09:36:26 +00:00
mrg a636a908ed nix the NetBSD specific GEM_BUG_ON().
avoids GCC 12 warnings, and matches upstream closer.
2023-08-08 06:59:40 +00:00
mrg 681df724ca comment a function that has a clear overbounds read but it isn't used.
found by GCC 12.
2023-08-08 06:58:20 +00:00
riastradh 58192d9832 radeon: Suspend ioctls while device is suspended.
XXX pullup-10
2023-08-07 16:35:06 +00:00
riastradh cdd0d8dc1e nouveau: Suspend ioctls while device is suspended.
XXX pullup-10
2023-08-07 16:34:57 +00:00
riastradh 602d3f06a0 amdgpu: Suspend ioctls while device is suspended.
XXX pullup-10
2023-08-07 16:34:47 +00:00
christos 397eb5e938 Use the new struct and ioctl names for the compat functions (thanks Ryo) 2023-08-02 10:31:46 +00:00
mrg f8570f8a97 fix simple mis-matched function prototype and definitions.
most of these are like, eg

   void foo(int[2]);

with either of these

   void foo(int*) { ... }
   void foo(int[]) { ... }

in some cases (such as stat or utimes* calls found in our header files),
we now match standard definition from opengroup.

found by GCC 12.
2023-08-01 07:04:14 +00:00
riastradh 1bc3b8615e drm/linux_ww_mutex: Fix ww acquire context ordering.
XXX pullup-8
XXX pullup-9
XXX pullup-10
2023-07-29 23:50:03 +00:00
riastradh b9b36368ff drm/linux_ww_mutex: Fix wait loops.
If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537

XXX pullup-8
XXX pullup-9
XXX pullup-10
2023-07-29 22:43:56 +00:00
riastradh 97560bd7b0 amdgpu: Mark float-dependent variables volatile.
This way they are computed -- using FP instructions -- before
DC_FP_END, after which point FP instructions will trap or behave
unpredictably.

This is a workaround, not a proper solution -- really, the
DC_FP_START/END calls should happen in a separate compilation unit
built without -mhard-float or whatever, but that's a lot more work to
make happen for now.

PR kern/57059

XXX pullup-10
2023-07-20 21:48:49 +00:00
mrg b478b13b30 avoid calling drm_sched_fini() for AMDGPU_RING_TYPE_KIQ rings.
drm_sched_init() is not called for these rings, and we'd panic trying
to mutex_destroy() a mutex that wasn't initialised.

this seems like a general bug, not a bug in netbsd port.
2023-07-20 18:02:45 +00:00
riastradh 9860f317b8 amdgpu: Define CONFIG_DRM_AMD_DC to enable display core logic.
Probably resolves a host of issues with amdgpu not detecting
displays!

Noticed by rjs@.

PR kern/57059
PR kern/57325
PR kern/57452

XXX pullup-10
2023-07-14 13:05:59 +00:00
riastradh 6f9f802778 linux/idr.h: Need <sys/mutex.h> for kmutex_t. 2023-07-11 10:42:36 +00:00
riastradh 8d0cdbc342 i915: Fail gracefully, don't panic, with unsupported ggtt views.
Workaround for part of PR kern/56648.

XXX pullup-10
2023-07-09 20:24:06 +00:00
msaitoh 676286b5ea Fix typo in comment. 2023-06-24 05:12:03 +00:00
lukem 58beaa2b43 adapt to ${CC_WNO_MAYBE_UNINITIALIZED}
Use ${CC_WNO_MAYBE_UNINITIALIZED} instead of
the older style more complex expressions.

Remove workarounds if they were for a specific
version of gcc < 10.
2023-06-03 21:31:45 +00:00
lukem 230c41e44c adapt to ${CC_WNO_IMPLICIT_FALLTHROUGH}
Use ${CC_WNO_IMPLICIT_FALLTHROUGH} instead of
the older style more complex expressions.
2023-06-03 21:30:20 +00:00
riastradh 358e900576 amdgpu: Fix mostly harmless merge botch.
Avoids confusing error message that should have been confined to an
error branch.
2023-05-25 12:07:43 +00:00
nat 2f0ff0f472 Use the offset in mmap calculations.
It fixes wsfb(4) when used with intelfb(4).

Ok riastradh@

XXX pullup-10
2023-05-22 22:36:53 +00:00
riastradh 350d0ac436 i915: Avoid dereferencing null fence if resv has changed.
PR kern/57402

XXX pullup-10
2023-05-12 10:13:37 +00:00
skrll 75b842b847 RISC-V support that works on QEMU with a single hart.
Thanks for Simon Burge for plic(4).
2023-05-07 12:41:45 +00:00
riastradh 7432c30ad5 drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-05-01 09:41:55 +00:00
riastradh 0864f7bbd1 dwc2: KASSERT(A && B) -> KASSERT(A); KASSERT(B) 2023-04-09 12:31:10 +00:00
mrg 958f5a78b3 remove "nouveau" from a comment. noted by jmcneill. 2023-03-07 20:23:00 +00:00
mrg e52584ba70 radeon: Kick out genfb on firmware framebuffer before initializing.
this is the same change as nouveau_pci.c:1.37, and should fix at
least PR#56714 and i thought at least another PR i can't find right
now.  it fixes at least 2 different radeon cards for me on UEFI
booted system.

XXX: pullup-10 also include the original change:
   http://mail-index.netbsd.org/source-changes/2023/03/01/msg143606.html
2023-03-07 09:47:48 +00:00
riastradh afe5f4042f nouveau: Kick out genfb on firmware framebuffer before initializing.
PR kern/53126
2023-03-01 08:42:33 +00:00
riastradh ef7f915eda amdgpu: Fix bogus loop invariant assertions in amdgpu_gart_map. 2023-03-01 08:14:13 +00:00
riastradh 67201c1e64 linux asm/barrier.h: Fix !MULTIPROCESSOR build. 2023-02-25 12:23:36 +00:00
riastradh 68de6bb2f1 drm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals.
Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html
2023-02-24 11:02:05 +00:00
riastradh b6203ff2c1 drm: Teach dmabuf to handle lseek.
Needed by libdrm_amdgpu.

Based on patch from Jeff Frasca -- thanks!

XXX pullup-10
2023-02-21 11:40:13 +00:00
riastradh be8f7ff572 amdgpu: Fix scale factor for 64-bit doorbell indexing.
The register is 64 bits wide, but the indexing is for 32-bit
quantities (and presumably index must be even here).

Found by Jeff Frasca -- thanks!
2023-02-21 11:39:39 +00:00
christos dae3cea673 Fix use after free on packet with broken lengths
Under the scenario with a packet with length of 67 bytes, a header length
using the default of 20 bytes and a TCP data offset (th_off) of 48 will
cause m_pullup() to fail to make sure bytes are arranged contiguously.
m_pullup() will free the mbuf chain and return a null. ipfilter stores
the resultant mbuf address (or the resulting NULL) in its fr_info_t
structure. Unfortunately the erroneous packet is not flagged for drop.
From FreeBSD via CY Schubert; originally reported by: Robert Morris
<rtm at lcs.mit.edu>
2023-02-03 19:01:08 +00:00
chs ac513d3efb remove the PPP HDLC ioctls from more copies of sanitizers. 2022-12-26 22:22:22 +00:00
christos 121a054849 merge acpica 20220331 to 20221020 2022-12-10 17:40:49 +00:00
christos 82065f3b3e Import acpica 2022-10-20
20 October 2022. Summary of changes for version 20221020:

This release is available at https://acpica.org/downloads

0) Global changes:

Allow disabling of -Werror. For distro maintainers having `-Werror`
can delay update of GCC. Since every GCC release might add new
warnings that were not yet captured, it might break the build of
packages. With this change, distros can now build with `NOWERROR=TRUE`
instead of patching either the errors or the makefiles. The default
behavior keeps on using `-Werror`.

1) ACPICA kernel-resident subsystem:

Added support for FFH Operation Region special context data.
FFH(Fixed Function Hardware) Opregion is approved to be added in
ACPI 6.5 via code first approach[1]. It requires special context
data similar to GPIO and Generic Serial Bus as it needs to know
platform specific offset and length.

Reverted this commit "executer/exsystem: Warn about sleeps greater
than 10 ms." Due to user complaints about valid sleeps greater than
10ms seen in some existing machines -- generating lots of warnings.

Do not touch VGA memory when EBDA < 1KiB. The ACPICA code assumes
that EBDA region must be at least 1KiB in size. Because this is
not guaranteed, it might happen that while scanning the memory for
RSDP pointer, the kernel touches memory above 640KiB. This is
unwanted as the VGA memory range may not be decoded or even present
when running under virtualization.

Check that EBDA pointer is in valid memory. If the memory at 0x40e
is uninitialized, the retrieved physical memory address of EBDA
may be beyond the low memory (i.e. above 640K). If so, the kernel
may unintentionally access the VGA memory, that might not be decoded
or even present in case of virtualization.

2) iASL Compiler/Disassembler and ACPICA tools:

Completed the existing partial support for the CDAT "table". Although
this isn't technically an ACPI table (It doesn't go into the XSDT),
it is possible to support this table in the Data Table compiler.
Created one new file, "utilities/utcksum.c", used to centralize
checksum generation/validation into one location. Includes changes
to makefiles and MSVC project files.

Updated support for the IORT table - update to version E.e

Added CXL 3.0 structures (CXIMS & RDPAS) to the CEDT table

iASL: Added CCEL table to both compiler/disassembler.

iASL: NHLT table: Fixed compilation of optional undocumented fields

iASL: Fix iASL compile error due to ACPI_TDEL_OFFSET. Commit #
10e4763 ("iASL: Add CCEL table to both compiler/disassembler")
introduced the iASL build issue. The issue is due to using
ACPI_TDEL_OFFSET for CCEL table member reference. To fix it, change
ACPI_TDEL_OFFSET with ACPI_CCEL_OFFSET.
2022-12-10 16:34:37 +00:00
gutteridge f1fc3e162b exsystem.c: revert ACPI warning about sleep values >10ms
acpica 20220331 introduced the following change:

For the ASL Sleep() operator, issue a warning if the sleep value is
greater than 10 Milliseconds. Quick boottime is important, so warn about
sleeps greater than 10 ms. Distribution Linux kernels reach initrd in 350
ms, so excessive delays should be called out. 10 ms is chosen randomly,
but three of such delays would already make up ten percent of the
boottime.

This can generate many console messages like:
[    26.055036] ACPI Warning: Firmware issue: Excessive sleep time (0x0000000000000064 ms > 10 ms) in ACPI Control Method (20220331/exsystem-239)
(60 of them in the latest boot on one older Ivy Bridge laptop.)

This has been reverted upstream and is not present in the next release.
df896f452f
(Also previously reverted in FreeBSD and Linux.)
2022-12-07 05:38:27 +00:00
riastradh c9d323e3a9 drm(4): Mark PCI interrupt handlers as MP-safe. 2022-10-28 21:58:48 +00:00
riastradh dbfa10e52a ddb/db_active.h: New home for extern db_active.
This can be included unconditionally, and db_active can then be
queried unconditionally; if DDB is not in the kernel, then db_active
is a constant zero.  Reduces need for #include opt_ddb.h, #ifdef DDB.
2022-10-26 23:38:05 +00:00
riastradh 4f91c309aa vmwgfx(4): Partially adapt rbtree. 2022-10-25 23:39:13 +00:00
riastradh a19ec08765 linux asm/vmware.h: Fill this in with hypercall asm.
Not sure if it's necessary to support vmcall or vmmcall -- if so,
need to deal with binary patching inline asm, ugh.
2022-10-25 23:39:01 +00:00
riastradh 99851fd018 linux asm/uaccess.h: strncpy_from_user
(which does not actually have strncpy semantics, naturally, from what
I can gather)
2022-10-25 23:38:33 +00:00
riastradh 5f4852e265 linux/frame.h: STACK_FRAME_NON_STANDARD 2022-10-25 23:38:02 +00:00
riastradh 6db1fce331 linux/kernel.h: S16_MIN, S32_MIN, S64_MIN 2022-10-25 23:37:36 +00:00
riastradh 60bf48dc00 linux/suspend.h: Stubs for (un)register_pm_notifier. 2022-10-25 23:37:24 +00:00
riastradh daf90d8307 linux/pci.h: Stubs for pci_request/release_region(s). 2022-10-25 23:37:06 +00:00
riastradh 8b12ddb0ba linux/idr.h: Update ida_* API. 2022-10-25 23:36:32 +00:00
riastradh 1328700703 vmwgfx(4): Hand-cruft threaded irq with a workqueue(9). 2022-10-25 23:36:21 +00:00