aur/kernel-6.19.patch

469 lines
18 KiB
Diff

diff --git a/kernel/common/inc/nv-memdbg.h b/kernel/common/inc/nv-memdbg.h
index c618ead..8212d44 100644
--- a/kernel/common/inc/nv-memdbg.h
+++ b/kernel/common/inc/nv-memdbg.h
@@ -28,8 +28,9 @@ void nv_memdbg_exit(void);
#else
-#define NV_MEMDBG_ADD(ptr, size)
-#define NV_MEMDBG_REMOVE(ptr, size)
+// NB: Using while(0) to avoid -Wempty-body warnings
+#define NV_MEMDBG_ADD(ptr, size) while(0)
+#define NV_MEMDBG_REMOVE(ptr, size) while(0)
#endif /* NV_MEM_LOGGER */
diff --git a/kernel/conftest.sh b/kernel/conftest.sh
index 1106ea5..fe2a7b9 100755
--- a/kernel/conftest.sh
+++ b/kernel/conftest.sh
@@ -256,6 +256,11 @@ build_cflags() {
CFLAGS="$CFLAGS -mfentry -DCC_USING_FENTRY"
fi
fi
+
+ # Rel. commit "Kbuild: enable -fms-extensions" (Rasmus Villemoes, 20 Oct 2025)
+ # Enable the flags since the Linux headers use those extensions in some structs
+ # See https://www.phoronix.com/news/Linux-6.19-Patch-Would-MS-Ext
+ CFLAGS="$CFLAGS -fms-extensions"
}
CONFTEST_PREAMBLE="#include \"conftest/headers.h\"
diff --git a/kernel/nvidia-drm/nvidia-drm-crtc.c b/kernel/nvidia-drm/nvidia-drm-crtc.c
index 6d5478e..9253bd5 100644
--- a/kernel/nvidia-drm/nvidia-drm-crtc.c
+++ b/kernel/nvidia-drm/nvidia-drm-crtc.c
@@ -151,7 +151,7 @@ static int nv_drm_plane_atomic_check(struct drm_plane *plane,
goto done;
}
- nv_drm_for_each_crtc_in_state(plane_state->state, crtc, crtc_state, i) {
+ for_each_new_crtc_in_state(plane_state->state, crtc, crtc_state, i) {
struct nv_drm_crtc_state *nv_crtc_state = to_nv_crtc_state(crtc_state);
struct NvKmsKapiHeadRequestedConfig *head_req_config =
&nv_crtc_state->req_config;
@@ -368,8 +368,8 @@ static int nv_drm_crtc_atomic_check(struct drm_crtc *crtc,
req_config->flags.displaysChanged = NV_TRUE;
- nv_drm_for_each_connector_in_state(crtc_state->state,
- connector, connector_state, j) {
+ for_each_new_connector_in_state(crtc_state->state,
+ connector, connector_state, j) {
if (connector_state->crtc != crtc) {
continue;
}
diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
index 2bcf29c..6e8d258 100644
--- a/kernel/nvidia-drm/nvidia-drm-drv.c
+++ b/kernel/nvidia-drm/nvidia-drm-drv.c
@@ -540,13 +540,13 @@ void nv_drm_master_drop(struct drm_device *dev, struct drm_file *file_priv)
drm_modeset_lock_all(dev);
- if ((err = nv_drm_atomic_helper_disable_all(
+ if ((err = drm_atomic_helper_disable_all(
dev,
dev->mode_config.acquire_ctx)) != 0) {
NV_DRM_DEV_LOG_ERR(
nv_dev,
- "nv_drm_atomic_helper_disable_all failed with error code %d !",
+ "drm_atomic_helper_disable_all failed with error code %d !",
err);
}
diff --git a/kernel/nvidia-drm/nvidia-drm-helper.c b/kernel/nvidia-drm/nvidia-drm-helper.c
index 8b89afe..e6ab0e6 100644
--- a/kernel/nvidia-drm/nvidia-drm-helper.c
+++ b/kernel/nvidia-drm/nvidia-drm-helper.c
@@ -62,141 +62,4 @@ static void __nv_drm_framebuffer_put(struct drm_framebuffer *fb)
}
-/*
- * drm_atomic_helper_disable_all() has been added by commit
- * 1494276000db789c6d2acd85747be4707051c801, which is Signed-off-by:
- * Thierry Reding <treding@nvidia.com>
- * Daniel Vetter <daniel.vetter@ffwll.ch>
- *
- * drm_atomic_helper_disable_all() is copied from
- * linux/drivers/gpu/drm/drm_atomic_helper.c and modified to use
- * nv_drm_for_each_crtc instead of drm_for_each_crtc to loop over all crtcs,
- * use nv_drm_for_each_*_in_state instead of for_each_connector_in_state to loop
- * over all modeset object states, and use drm_atomic_state_free() if
- * drm_atomic_state_put() is not available.
- *
- * drm_atomic_helper_disable_all() is copied from
- * linux/drivers/gpu/drm/drm_atomic_helper.c @
- * 49d70aeaeca8f62b72b7712ecd1e29619a445866, which has the following
- * copyright and license information:
- *
- * Copyright (C) 2014 Red Hat
- * Copyright (C) 2014 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rob Clark <robdclark@gmail.com>
- * Daniel Vetter <daniel.vetter@ffwll.ch>
- */
-int nv_drm_atomic_helper_disable_all(struct drm_device *dev,
- struct drm_modeset_acquire_ctx *ctx)
-{
- struct drm_atomic_state *state;
- struct drm_connector_state *conn_state;
- struct drm_connector *conn;
- struct drm_plane_state *plane_state;
- struct drm_plane *plane;
- struct drm_crtc_state *crtc_state;
- struct drm_crtc *crtc;
- unsigned plane_mask = 0;
- int ret, i;
-
- state = drm_atomic_state_alloc(dev);
- if (!state)
- return -ENOMEM;
-
- state->acquire_ctx = ctx;
-
- nv_drm_for_each_crtc(crtc, dev) {
- crtc_state = drm_atomic_get_crtc_state(state, crtc);
- if (IS_ERR(crtc_state)) {
- ret = PTR_ERR(crtc_state);
- goto free;
- }
-
- crtc_state->active = false;
-
- ret = drm_atomic_set_mode_prop_for_crtc(crtc_state, NULL);
- if (ret < 0)
- goto free;
-
- ret = drm_atomic_add_affected_planes(state, crtc);
- if (ret < 0)
- goto free;
-
- ret = drm_atomic_add_affected_connectors(state, crtc);
- if (ret < 0)
- goto free;
- }
-
- nv_drm_for_each_connector_in_state(state, conn, conn_state, i) {
- ret = drm_atomic_set_crtc_for_connector(conn_state, NULL);
- if (ret < 0)
- goto free;
- }
-
- nv_drm_for_each_plane_in_state(state, plane, plane_state, i) {
- ret = drm_atomic_set_crtc_for_plane(plane_state, NULL);
- if (ret < 0)
- goto free;
-
- drm_atomic_set_fb_for_plane(plane_state, NULL);
- plane_mask |= BIT(drm_plane_index(plane));
- plane->old_fb = plane->fb;
- }
-
- ret = drm_atomic_commit(state);
-free:
- if (plane_mask) {
- drm_for_each_plane_mask(plane, dev, plane_mask) {
- if (ret == 0) {
- plane->fb = NULL;
- plane->crtc = NULL;
-
- WARN_ON(plane->state->fb);
- WARN_ON(plane->state->crtc);
-
- if (plane->old_fb)
- __nv_drm_framebuffer_put(plane->old_fb);
- }
- plane->old_fb = NULL;
- }
- }
-
-#if defined(NV_DRM_ATOMIC_STATE_REF_COUNTING_PRESENT)
- drm_atomic_state_put(state);
-#else
- if (ret != 0) {
- drm_atomic_state_free(state);
- } else {
- /*
- * In case of success, drm_atomic_commit() takes care to cleanup and
- * free @state.
- *
- * Comment placed above drm_atomic_commit() says: The caller must not
- * free or in any other way access @state. If the function fails then
- * the caller must clean up @state itself.
- */
- }
-#endif
- return ret;
-}
-
#endif /* NV_DRM_ATOMIC_MODESET_AVAILABLE */
diff --git a/kernel/nvidia-drm/nvidia-drm-helper.h b/kernel/nvidia-drm/nvidia-drm-helper.h
index 831737d..0fce7b2 100644
--- a/kernel/nvidia-drm/nvidia-drm-helper.h
+++ b/kernel/nvidia-drm/nvidia-drm-helper.h
@@ -156,127 +156,6 @@ nv_drm_prime_pages_to_sg(struct drm_device *dev,
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
-int nv_drm_atomic_helper_disable_all(struct drm_device *dev,
- struct drm_modeset_acquire_ctx *ctx);
-
-/*
- * for_each_connector_in_state(), for_each_crtc_in_state() and
- * for_each_plane_in_state() were added by kernel commit
- * df63b9994eaf942afcdb946d27a28661d7dfbf2a which was Signed-off-by:
- * Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
- * Daniel Vetter <daniel.vetter@ffwll.ch>
- *
- * for_each_connector_in_state(), for_each_crtc_in_state() and
- * for_each_plane_in_state() were copied from
- * include/drm/drm_atomic.h @
- * 21a01abbe32a3cbeb903378a24e504bfd9fe0648
- * which has the following copyright and license information:
- *
- * Copyright (C) 2014 Red Hat
- * Copyright (C) 2014 Intel Corp.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Rob Clark <robdclark@gmail.com>
- * Daniel Vetter <daniel.vetter@ffwll.ch>
- */
-
-/**
- * nv_drm_for_each_connector_in_state - iterate over all connectors in an
- * atomic update
- * @__state: &struct drm_atomic_state pointer
- * @connector: &struct drm_connector iteration cursor
- * @connector_state: &struct drm_connector_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all connectors in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- */
-#if !defined(for_each_connector_in_state)
-#define nv_drm_for_each_connector_in_state(__state, \
- connector, connector_state, __i) \
- for ((__i) = 0; \
- (__i) < (__state)->num_connector && \
- ((connector) = (__state)->connectors[__i].ptr, \
- (connector_state) = (__state)->connectors[__i].state, 1); \
- (__i)++) \
- for_each_if (connector)
-#else
-#define nv_drm_for_each_connector_in_state(__state, \
- connector, connector_state, __i) \
- for_each_connector_in_state(__state, connector, connector_state, __i)
-#endif
-
-
-/**
- * nv_drm_for_each_crtc_in_state - iterate over all CRTCs in an atomic update
- * @__state: &struct drm_atomic_state pointer
- * @crtc: &struct drm_crtc iteration cursor
- * @crtc_state: &struct drm_crtc_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all CRTCs in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- */
-#if !defined(for_each_crtc_in_state)
-#define nv_drm_for_each_crtc_in_state(__state, crtc, crtc_state, __i) \
- for ((__i) = 0; \
- (__i) < (__state)->dev->mode_config.num_crtc && \
- ((crtc) = (__state)->crtcs[__i].ptr, \
- (crtc_state) = (__state)->crtcs[__i].state, 1); \
- (__i)++) \
- for_each_if (crtc_state)
-#else
-#define nv_drm_for_each_crtc_in_state(__state, crtc, crtc_state, __i) \
- for_each_crtc_in_state(__state, crtc, crtc_state, __i)
-#endif
-
-/**
- * nv_drm_for_each_plane_in_state - iterate over all planes in an atomic update
- * @__state: &struct drm_atomic_state pointer
- * @plane: &struct drm_plane iteration cursor
- * @plane_state: &struct drm_plane_state iteration cursor
- * @__i: int iteration cursor, for macro-internal use
- *
- * This iterates over all planes in an atomic update. Note that before the
- * software state is committed (by calling drm_atomic_helper_swap_state(), this
- * points to the new state, while afterwards it points to the old state. Due to
- * this tricky confusion this macro is deprecated.
- */
-#if !defined(for_each_plane_in_state)
-#define nv_drm_for_each_plane_in_state(__state, plane, plane_state, __i) \
- for ((__i) = 0; \
- (__i) < (__state)->dev->mode_config.num_total_plane && \
- ((plane) = (__state)->planes[__i].ptr, \
- (plane_state) = (__state)->planes[__i].state, 1); \
- (__i)++) \
- for_each_if (plane_state)
-#else
-#define nv_drm_for_each_plane_in_state(__state, plane, plane_state, __i) \
- for_each_plane_in_state(__state, plane, plane_state, __i)
-#endif
-
static inline struct drm_crtc *nv_drm_crtc_find(struct drm_device *dev,
uint32_t id)
{
diff --git a/kernel/nvidia-drm/nvidia-drm-modeset.c b/kernel/nvidia-drm/nvidia-drm-modeset.c
index 3a57e8e..5bbcd4a 100644
--- a/kernel/nvidia-drm/nvidia-drm-modeset.c
+++ b/kernel/nvidia-drm/nvidia-drm-modeset.c
@@ -112,20 +112,13 @@ nv_drm_atomic_apply_modeset_config(struct drm_device *dev,
struct NvKmsKapiRequestedModeSetConfig *requested_config =
&(to_nv_atomic_state(state)->config);
struct drm_crtc *crtc;
- struct drm_crtc_state *crtc_state;
+ struct drm_crtc_state *old_crtc_state, *new_crtc_state;
int i;
memset(requested_config, 0, sizeof(*requested_config));
/* Loop over affected crtcs and construct NvKmsKapiRequestedModeSetConfig */
- nv_drm_for_each_crtc_in_state(state, crtc, crtc_state, i) {
- /*
- * When commiting a state, the new state is already stored in
- * crtc->state. When checking a proposed state, the proposed state is
- * stored in crtc_state.
- */
- struct drm_crtc_state *new_crtc_state =
- commit ? crtc->state : crtc_state;
+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) {
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
requested_config->headRequestedConfig[nv_crtc->head] =
@@ -134,7 +127,6 @@ nv_drm_atomic_apply_modeset_config(struct drm_device *dev,
requested_config->headsMask |= 1 << nv_crtc->head;
if (commit) {
- struct drm_crtc_state *old_crtc_state = crtc_state;
struct nv_drm_crtc_state *nv_new_crtc_state =
to_nv_crtc_state(new_crtc_state);
@@ -220,7 +212,7 @@ int nv_drm_atomic_commit(struct drm_device *dev,
int i;
struct drm_crtc *crtc = NULL;
- struct drm_crtc_state *crtc_state = NULL;
+ struct drm_crtc_state *new_crtc_state = NULL;
struct nv_drm_device *nv_dev = to_nv_device(dev);
/*
@@ -230,7 +222,7 @@ int nv_drm_atomic_commit(struct drm_device *dev,
* updates to complete.
*/
if (nonblock) {
- nv_drm_for_each_crtc_in_state(state, crtc, crtc_state, i) {
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
/*
@@ -303,7 +295,7 @@ int nv_drm_atomic_commit(struct drm_device *dev,
}
if (ret == 0 && !nonblock) {
- nv_drm_for_each_crtc_in_state(state, crtc, crtc_state, i) {
+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
struct nv_drm_crtc *nv_crtc = to_nv_crtc(crtc);
/*
diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h
index 4f1a0e7..953c2eb 100644
--- a/kernel/nvidia-drm/nvidia-drm-priv.h
+++ b/kernel/nvidia-drm/nvidia-drm-priv.h
@@ -39,6 +39,9 @@
#include <drm/drm_gem.h>
#endif
+// Rel. commit "drm/mm: replace drm_print.h include with a forward declaration" (Jani Nikula, 29 Oct 2025)
+#include <drm/drm_print.h>
+
#include "nvidia-drm-os-interface.h"
#include "nvkms-kapi.h"
diff --git a/kernel/nvidia/nv-dma.c b/kernel/nvidia/nv-dma.c
index a06c12c..c30f8cc 100644
--- a/kernel/nvidia/nv-dma.c
+++ b/kernel/nvidia/nv-dma.c
@@ -13,6 +13,7 @@
#include "os-interface.h"
#include "nv-linux.h"
+#include <linux/version.h>
NV_STATUS nv_create_dma_map_scatterlist (nv_dma_map_t *dma_map);
void nv_destroy_dma_map_scatterlist(nv_dma_map_t *dma_map);
@@ -619,7 +620,13 @@ static NvBool nv_dma_is_map_resource_implemented
#endif
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0)
+ // Rel. commit "dma-mapping: remove unused mapping resource callbacks" (Leon Romanovsky, 15 Oct 2025)
+ // https://lore.kernel.org/all/20251015-remove-map-page-v5-0-3bbfe3a25cdf@kernel.org/
+ return (ops->map_phys != NULL);
+#else
return (ops->map_resource != NULL);
+#endif
#else
return NV_FALSE;
#endif
diff --git a/kernel/nvidia/os-interface.c b/kernel/nvidia/os-interface.c
index 262171f..b08dd28 100644
--- a/kernel/nvidia/os-interface.c
+++ b/kernel/nvidia/os-interface.c
@@ -193,7 +193,7 @@ BOOL NV_API_CALL os_semaphore_may_sleep(void)
BOOL NV_API_CALL os_is_isr(void)
{
- return (in_irq());
+ return (in_hardirq());
}
// return TRUE if the caller is the super-user