CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: chs Date: Fri Dec 29 22:58:24 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: smp.h Log Message: drm: put_cpu() should enable preemption, not disable it again To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/smp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: chs Date: Fri Dec 29 22:58:24 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: smp.h Log Message: drm: put_cpu() should enable preemption, not disable it again To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/smp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/smp.h diff -u src/sys/external/bsd/drm2/include/linux/smp.h:1.4 src/sys/external/bsd/drm2/include/linux/smp.h:1.5 --- src/sys/external/bsd/drm2/include/linux/smp.h:1.4 Sun Dec 19 11:49:12 2021 +++ src/sys/external/bsd/drm2/include/linux/smp.h Fri Dec 29 22:58:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: smp.h,v 1.4 2021/12/19 11:49:12 riastradh Exp $ */ +/* $NetBSD: smp.h,v 1.5 2023/12/29 22:58:23 chs Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ static inline void put_cpu(void) { - kpreempt_disable(); + kpreempt_enable(); } static inline void
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Jul 11 10:42:36 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: idr.h Log Message: linux/idr.h: Need for kmutex_t. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/idr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/idr.h diff -u src/sys/external/bsd/drm2/include/linux/idr.h:1.10 src/sys/external/bsd/drm2/include/linux/idr.h:1.11 --- src/sys/external/bsd/drm2/include/linux/idr.h:1.10 Tue Oct 25 23:36:32 2022 +++ src/sys/external/bsd/drm2/include/linux/idr.h Tue Jul 11 10:42:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: idr.h,v 1.10 2022/10/25 23:36:32 riastradh Exp $ */ +/* $NetBSD: idr.h,v 1.11 2023/07/11 10:42:36 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -33,6 +33,7 @@ #define _LINUX_IDR_H_ #include +#include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Jul 11 10:42:36 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: idr.h Log Message: linux/idr.h: Need for kmutex_t. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/include/linux/idr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon May 1 09:41:55 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h Log Message: drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/include/linux/interval_tree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/interval_tree.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.14 --- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13 Sun Feb 27 14:18:25 2022 +++ src/sys/external/bsd/drm2/include/linux/interval_tree.h Mon May 1 09:41:55 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree.h,v 1.13 2022/02/27 14:18:25 riastradh Exp $ */ +/* $NetBSD: interval_tree.h,v 1.14 2023/05/01 09:41:55 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -120,7 +120,8 @@ interval_tree_iter_first(struct rb_root_ return NULL; if (last < node->start) return NULL; - KASSERT(node->start <= last && node->last >= start); + KASSERT(node->start <= last); + KASSERT(node->last >= start); return node; } @@ -142,7 +143,8 @@ interval_tree_iter_next(struct rb_root_c return NULL; if (last < next->start) return NULL; - KASSERT(next->start <= last && next->last >= start); + KASSERT(next->start <= last); + KASSERT(next->last >= start); return next; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon May 1 09:41:55 UTC 2023 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h Log Message: drm: KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 \ src/sys/external/bsd/drm2/include/linux/interval_tree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:37:24 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: suspend.h Log Message: linux/suspend.h: Stubs for (un)register_pm_notifier. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/suspend.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/suspend.h diff -u src/sys/external/bsd/drm2/include/linux/suspend.h:1.3 src/sys/external/bsd/drm2/include/linux/suspend.h:1.4 --- src/sys/external/bsd/drm2/include/linux/suspend.h:1.3 Sun Dec 19 12:00:24 2021 +++ src/sys/external/bsd/drm2/include/linux/suspend.h Tue Oct 25 23:37:24 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: suspend.h,v 1.3 2021/12/19 12:00:24 riastradh Exp $ */ +/* $NetBSD: suspend.h,v 1.4 2022/10/25 23:37:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,4 +36,7 @@ #define ksys_sync_helper() __nothing +#define register_pm_notifier(n) __nothing +#define unregister_pm_notifier(n) __nothing + #endif /* _LINUX_SUSPEND_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:37:24 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: suspend.h Log Message: linux/suspend.h: Stubs for (un)register_pm_notifier. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/suspend.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:37:07 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux/pci.h: Stubs for pci_request/release_region(s). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.55 src/sys/external/bsd/drm2/include/linux/pci.h:1.56 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.55 Mon Oct 17 03:05:32 2022 +++ src/sys/external/bsd/drm2/include/linux/pci.h Tue Oct 25 23:37:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.55 2022/10/17 03:05:32 mrg Exp $ */ +/* $NetBSD: pci.h,v 1.56 2022/10/25 23:37:06 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -266,6 +266,10 @@ enum pcie_link_width { #define pci_read_config_byte linux_pci_read_config_byte #define pci_read_config_dword linux_pci_read_config_dword #define pci_read_config_word linux_pci_read_config_word +#define pci_release_region linux_pci_release_region +#define pci_release_regions linux_pci_release_regions +#define pci_request_region linux_pci_request_region +#define pci_request_regions linux_pci_request_regions #define pci_resource_end linux_pci_resource_end #define pci_resource_flags linux_pci_resource_flags #define pci_resource_len linux_pci_resource_len @@ -362,6 +366,11 @@ void pci_unmap_rom(struct pci_dev *, vo int pci_enable_rom(struct pci_dev *); void pci_disable_rom(struct pci_dev *); +int pci_request_regions(struct pci_dev *, const char *); +void pci_release_regions(struct pci_dev *); +int pci_request_region(struct pci_dev *, int, const char *); +void pci_release_region(struct pci_dev *, int); + bus_addr_t pci_resource_start(struct pci_dev *, unsigned); bus_size_t pci_resource_len(struct pci_dev *, unsigned); bus_addr_t pci_resource_end(struct pci_dev *, unsigned);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:37:07 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux/pci.h: Stubs for pci_request/release_region(s). To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:36:32 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: idr.h Log Message: linux/idr.h: Update ida_* API. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/idr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/idr.h diff -u src/sys/external/bsd/drm2/include/linux/idr.h:1.9 src/sys/external/bsd/drm2/include/linux/idr.h:1.10 --- src/sys/external/bsd/drm2/include/linux/idr.h:1.9 Sun Dec 19 01:15:21 2021 +++ src/sys/external/bsd/drm2/include/linux/idr.h Tue Oct 25 23:36:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: idr.h,v 1.9 2021/12/19 01:15:21 riastradh Exp $ */ +/* $NetBSD: idr.h,v 1.10 2022/10/25 23:36:32 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ ida_destroy(struct ida *ida) } static inline void -ida_remove(struct ida *ida, int id) +ida_free(struct ida *ida, int id) { idr_remove(>ida_idr, id); @@ -118,12 +118,19 @@ ida_simple_get(struct ida *ida, unsigned return id; } +static inline int +ida_alloc_max(struct ida *ida, unsigned max, gfp_t gfp) +{ + + return ida_simple_get(ida, 0, max + 1, gfp); +} + static inline void ida_simple_remove(struct ida *ida, unsigned int id) { KASSERT((int)id >= 0); - ida_remove(ida, id); + ida_free(ida, id); } #endif /* _LINUX_IDR_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:36:32 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: idr.h Log Message: linux/idr.h: Update ida_* API. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/idr.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:33:29 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: spinlock.h Log Message: linux/spinlock.h: spin_lock_bh, spin_unlock_bh Nothing special needed here; NetBSD mutex(9) at IPL_* giving spin locks already blocks `BH' (i.e., softints -- although I'm not sure softints are relevant to the one use of this in vmwgfx). To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/spinlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.14 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.15 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.14 Sun Dec 19 11:52:08 2021 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Tue Oct 25 23:33:29 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.14 2021/12/19 11:52:08 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.15 2022/10/25 23:33:29 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -65,6 +65,18 @@ spin_unlock(spinlock_t *spinlock) } static inline void +spin_lock_bh(spinlock_t *spinlock) +{ + spin_lock(spinlock); +} + +static inline void +spin_unlock_bh(spinlock_t *spinlock) +{ + spin_unlock(spinlock); +} + +static inline void spin_lock_irq(spinlock_t *spinlock) { spin_lock(spinlock);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:33:29 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: spinlock.h Log Message: linux/spinlock.h: spin_lock_bh, spin_unlock_bh Nothing special needed here; NetBSD mutex(9) at IPL_* giving spin locks already blocks `BH' (i.e., softints -- although I'm not sure softints are relevant to the one use of this in vmwgfx). To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/spinlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:31:49 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: module.h Log Message: linux/module.h: MODULE_VERSION To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/module.h diff -u src/sys/external/bsd/drm2/include/linux/module.h:1.12 src/sys/external/bsd/drm2/include/linux/module.h:1.13 --- src/sys/external/bsd/drm2/include/linux/module.h:1.12 Sun Dec 19 10:47:38 2021 +++ src/sys/external/bsd/drm2/include/linux/module.h Tue Oct 25 23:31:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: module.h,v 1.12 2021/12/19 10:47:38 riastradh Exp $ */ +/* $NetBSD: module.h,v 1.13 2022/10/25 23:31:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -50,6 +50,7 @@ #define MODULE_DEVICE_TABLE(DESCRIPTION, IDLIST) #define MODULE_FIRMWARE(FIRMWARE) #define MODULE_LICENSE(LICENSE) +#define MODULE_VERSION(VERSION) #define THIS_MODULE 0 #define KBUILD_MODNAME __file__
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Tue Oct 25 23:31:49 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: module.h Log Message: linux/module.h: MODULE_VERSION To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/module.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Jul 17 17:04:02 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: ww_mutex.h Log Message: linux/ww_mutex: Make wwm_debug member unconditional. This way LOCKDEBUG doesn't change any structure sizes. Shuffle members around to make better use of padding, on both LP32 and LP64. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/ww_mutex.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ww_mutex.h diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.14 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.15 --- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.14 Sun Dec 19 10:38:14 2021 +++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h Sun Jul 17 17:04:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ww_mutex.h,v 1.14 2021/12/19 10:38:14 riastradh Exp $ */ +/* $NetBSD: ww_mutex.h,v 1.15 2022/07/17 17:04:02 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -58,13 +58,16 @@ struct ww_acquire_ctx { struct rb_node wwx_rb_node; }; +enum ww_mutex_state { + WW_UNLOCKED, /* nobody owns it */ + WW_OWNED, /* owned by a lwp without a context */ + WW_CTX, /* owned by a context */ + WW_WANTOWN, /* owned by ctx, waiters w/o ctx waiting */ +}; + struct ww_mutex { - enum ww_mutex_state { - WW_UNLOCKED, /* nobody owns it */ - WW_OWNED, /* owned by a lwp without a context */ - WW_CTX, /* owned by a context */ - WW_WANTOWN, /* owned by ctx, waiters w/o ctx waiting */ - } wwm_state; + uint8_t wwm_state; + bool wwm_debug; union { struct lwp *owner; struct ww_acquire_ctx *ctx; @@ -77,9 +80,6 @@ struct ww_mutex { struct ww_class *wwm_class; struct rb_tree wwm_waiters; kcondvar_t wwm_cv; -#ifdef LOCKDEBUG - bool wwm_debug; -#endif }; /* XXX Make the nm output a little more greppable... */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Jul 17 17:04:02 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: ww_mutex.h Log Message: linux/ww_mutex: Make wwm_debug member unconditional. This way LOCKDEBUG doesn't change any structure sizes. Shuffle members around to make better use of padding, on both LP32 and LP64. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/ww_mutex.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 18:06:45 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi: Fix missing hdmi_avi_infoframe_init namespacing. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/hdmi.h diff -u src/sys/external/bsd/drm2/include/linux/hdmi.h:1.17 src/sys/external/bsd/drm2/include/linux/hdmi.h:1.18 --- src/sys/external/bsd/drm2/include/linux/hdmi.h:1.17 Sat Jul 9 17:59:27 2022 +++ src/sys/external/bsd/drm2/include/linux/hdmi.h Sat Jul 9 18:06:45 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: hdmi.h,v 1.17 2022/07/09 17:59:27 riastradh Exp $ */ +/* $NetBSD: hdmi.h,v 1.18 2022/07/09 18:06:45 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -41,6 +41,7 @@ struct device; #define hdmi_audio_infoframe_pack linux_hdmi_audio_infoframe_pack #define hdmi_audio_infoframe_unpack linux_hdmi_audio_infoframe_unpack #define hdmi_avi_infoframe_check linux_hdmi_avi_infoframe_check +#define hdmi_avi_infoframe_init linux_hdmi_avi_infoframe_init #define hdmi_avi_infoframe_pack linux_hdmi_avi_infoframe_pack #define hdmi_avi_infoframe_unpack linux_hdmi_avi_infoframe_unpack #define hdmi_drm_infoframe_check linux_hdmi_drm_infoframe_check
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 18:06:45 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi: Fix missing hdmi_avi_infoframe_init namespacing. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 17:13:04 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi.h: Implement hdmi_infoframe_log. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 17:13:04 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi.h: Implement hdmi_infoframe_log. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/hdmi.h diff -u src/sys/external/bsd/drm2/include/linux/hdmi.h:1.15 src/sys/external/bsd/drm2/include/linux/hdmi.h:1.16 --- src/sys/external/bsd/drm2/include/linux/hdmi.h:1.15 Sat Jul 9 15:24:42 2022 +++ src/sys/external/bsd/drm2/include/linux/hdmi.h Sat Jul 9 17:13:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: hdmi.h,v 1.15 2022/07/09 15:24:42 riastradh Exp $ */ +/* $NetBSD: hdmi.h,v 1.16 2022/07/09 17:13:04 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -37,6 +37,8 @@ #include #include +#include + enum hdmi_3d_structure { HDMI_3D_STRUCTURE_INVALID = -1, HDMI_3D_STRUCTURE_FRAME_PACKING = 0, @@ -995,7 +997,8 @@ static inline void hdmi_infoframe_log(const char *level, struct device *device, const union hdmi_infoframe *frame) { - /* XXX */ + + hexdump(printf, device_xname(device), frame, sizeof(*frame)); } #endif /* _LINUX_HDMI_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 15:24:42 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi.h: Fix spd infoframe header version. Possibly relevant to PR kern/56740. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/hdmi.h diff -u src/sys/external/bsd/drm2/include/linux/hdmi.h:1.14 src/sys/external/bsd/drm2/include/linux/hdmi.h:1.15 --- src/sys/external/bsd/drm2/include/linux/hdmi.h:1.14 Sun Dec 19 11:45:35 2021 +++ src/sys/external/bsd/drm2/include/linux/hdmi.h Sat Jul 9 15:24:42 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: hdmi.h,v 1.14 2021/12/19 11:45:35 riastradh Exp $ */ +/* $NetBSD: hdmi.h,v 1.15 2022/07/09 15:24:42 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -718,7 +718,7 @@ hdmi_spd_infoframe_check(const struct hd int ret; ret = hdmi_infoframe_header_check(>header, - HDMI_INFOFRAME_TYPE_SPD, 2, HDMI_SPD_INFOFRAME_SIZE); + HDMI_INFOFRAME_TYPE_SPD, 1, HDMI_SPD_INFOFRAME_SIZE); if (ret) return ret;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Jul 9 15:24:42 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: hdmi.h Log Message: linux/hdmi.h: Fix spd infoframe header version. Possibly relevant to PR kern/56740. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/hdmi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:44:25 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: ratelimit.h Log Message: linux/ratelimit: Convert to membar_acquire and atomic_store_release. Simplify while here: atomic_swap is enough, no need for atomic_cas. (Maybe drm'll run faster on sparcv8 this way...!) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/ratelimit.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ratelimit.h diff -u src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.5 src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.6 --- src/sys/external/bsd/drm2/include/linux/ratelimit.h:1.5 Sun Dec 19 11:36:57 2021 +++ src/sys/external/bsd/drm2/include/linux/ratelimit.h Sat Apr 9 23:44:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: ratelimit.h,v 1.5 2021/12/19 11:36:57 riastradh Exp $ */ +/* $NetBSD: ratelimit.h,v 1.6 2022/04/09 23:44:25 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -86,14 +86,13 @@ __ratelimit(struct ratelimit_state *r) { int ok; - if (atomic_cas_uint(>rl_lock, 0, 1)) { + if (atomic_swap_uint(>rl_lock, 1)) { ok = false; goto out; } - membar_enter(); + membar_acquire(); ok = ppsratecheck(>rl_lasttime, >rl_curpps, r->rl_maxpps); - membar_exit(); - r->rl_lock = 0; + atomic_store_release(>rl_lock, 0); out: if (!ok) atomic_store_relaxed(>missed, 1);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:44:25 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: ratelimit.h Log Message: linux/ratelimit: Convert to membar_acquire and atomic_store_release. Simplify while here: atomic_swap is enough, no need for atomic_cas. (Maybe drm'll run faster on sparcv8 this way...!) To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/linux/ratelimit.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:43:55 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: llist.h Log Message: linux/llist: Use membar_release and membar_datadep_consumer. No need for membar_acquire here! Loads are all data-dependent. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/llist.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:43:55 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: llist.h Log Message: linux/llist: Use membar_release and membar_datadep_consumer. No need for membar_acquire here! Loads are all data-dependent. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/llist.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/llist.h diff -u src/sys/external/bsd/drm2/include/linux/llist.h:1.6 src/sys/external/bsd/drm2/include/linux/llist.h:1.7 --- src/sys/external/bsd/drm2/include/linux/llist.h:1.6 Sun Dec 19 11:52:08 2021 +++ src/sys/external/bsd/drm2/include/linux/llist.h Sat Apr 9 23:43:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: llist.h,v 1.6 2021/12/19 11:52:08 riastradh Exp $ */ +/* $NetBSD: llist.h,v 1.7 2022/04/09 23:43:55 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ llist_add(struct llist_node *node, struc do { first = head->first; node->next = first; - membar_exit(); + membar_release(); } while (atomic_cas_ptr(>first, first, node) != first); return first == NULL; @@ -96,7 +96,7 @@ llist_del_all(struct llist_head *head) struct llist_node *first; first = atomic_swap_ptr(>first, NULL); - membar_enter(); + membar_datadep_consumer(); return first; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:43:39 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: kref.h Log Message: linux/kref: Fix memory barriers and use membar_release/acquire. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/kref.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/kref.h diff -u src/sys/external/bsd/drm2/include/linux/kref.h:1.12 src/sys/external/bsd/drm2/include/linux/kref.h:1.13 --- src/sys/external/bsd/drm2/include/linux/kref.h:1.12 Sun Dec 19 11:45:01 2021 +++ src/sys/external/bsd/drm2/include/linux/kref.h Sat Apr 9 23:43:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: kref.h,v 1.12 2021/12/19 11:45:01 riastradh Exp $ */ +/* $NetBSD: kref.h,v 1.13 2022/04/09 23:43:39 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -58,10 +58,6 @@ kref_get(struct kref *kref) atomic_inc_uint_nv(>kr_count); KASSERTMSG((count > 1), "getting released kref"); - -#ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_enter(); -#endif } static inline bool @@ -76,10 +72,6 @@ kref_get_unless_zero(struct kref *kref) } while (atomic_cas_uint(>kr_count, count, (count + 1)) != count); -#ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_enter(); -#endif - return true; } @@ -89,7 +81,7 @@ kref_sub(struct kref *kref, unsigned int unsigned int old, new; #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif do { @@ -100,6 +92,9 @@ kref_sub(struct kref *kref, unsigned int } while (atomic_cas_uint(>kr_count, old, new) != old); if (new == 0) { +#ifndef __HAVE_ATOMIC_AS_MEMBAR + membar_acquire(); +#endif (*release)(kref); return 1; } @@ -114,7 +109,7 @@ kref_put_lock(struct kref *kref, void (* unsigned int old, new; #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif do { @@ -123,6 +118,9 @@ kref_put_lock(struct kref *kref, void (* if (old == 1) { spin_lock(interlock); if (atomic_add_int_nv(>kr_count, -1) == 0) { +#ifndef __HAVE_ATOMIC_AS_MEMBAR +membar_acquire(); +#endif (*release)(kref); return 1; } @@ -149,7 +147,7 @@ kref_put_mutex(struct kref *kref, void ( unsigned int old, new; #ifndef __HAVE_ATOMIC_AS_MEMBAR - membar_exit(); + membar_release(); #endif do { @@ -158,6 +156,9 @@ kref_put_mutex(struct kref *kref, void ( if (old == 1) { mutex_lock(interlock); if (atomic_add_int_nv(>kr_count, -1) == 0) { +#ifndef __HAVE_ATOMIC_AS_MEMBAR +membar_acquire(); +#endif (*release)(kref); return 1; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sat Apr 9 23:43:39 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: kref.h Log Message: linux/kref: Fix memory barriers and use membar_release/acquire. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/kref.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Fri Mar 18 23:32:50 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: jiffies.h Log Message: drm: Use getticks(), not hardclock_ticks. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/include/linux/jiffies.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/jiffies.h diff -u src/sys/external/bsd/drm2/include/linux/jiffies.h:1.13 src/sys/external/bsd/drm2/include/linux/jiffies.h:1.14 --- src/sys/external/bsd/drm2/include/linux/jiffies.h:1.13 Fri Feb 14 14:34:59 2020 +++ src/sys/external/bsd/drm2/include/linux/jiffies.h Fri Mar 18 23:32:49 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: jiffies.h,v 1.13 2020/02/14 14:34:59 maya Exp $ */ +/* $NetBSD: jiffies.h,v 1.14 2022/03/18 23:32:49 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -39,8 +39,8 @@ #include -#define jiffies hardclock_ticks -#define jiffies_64 hardclock_ticks /* XXX */ +#define jiffies getticks() +#define jiffies_64 getticks() /* XXX */ /* XXX Er, what? */ #define MAX_JIFFY_OFFSET ((INT_MAX >> 1) - 1) @@ -49,7 +49,7 @@ static inline uint64_t get_jiffies_64(void) { - return (uint64_t)(unsigned)hardclock_ticks; + return (uint64_t)(unsigned)getticks(); } static inline uint64_t
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Fri Mar 18 23:32:50 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: jiffies.h Log Message: drm: Use getticks(), not hardclock_ticks. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/include/linux/jiffies.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:23:08 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.52 src/sys/external/bsd/drm2/include/linux/pci.h:1.53 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.52 Sun Feb 27 14:22:29 2022 +++ src/sys/external/bsd/drm2/include/linux/pci.h Sun Feb 27 14:23:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.52 2022/02/27 14:22:29 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.53 2022/02/27 14:23:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -90,6 +90,12 @@ struct pci_device_id { #define PCI_CLASS_DISPLAY_VGA \ ((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_VGA) +CTASSERT(PCI_CLASS_DISPLAY_VGA == 0x0300); + +#define PCI_CLASS_DISPLAY_OTHER \ + ((PCI_CLASS_DISPLAY << 8) | PCI_SUBCLASS_DISPLAY_MISC) +CTASSERT(PCI_CLASS_DISPLAY_OTHER == 0x0380); + #define PCI_CLASS_BRIDGE_ISA \ ((PCI_CLASS_BRIDGE << 8) | PCI_SUBCLASS_BRIDGE_ISA) CTASSERT(PCI_CLASS_BRIDGE_ISA == 0x0601);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:23:08 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:22:50 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: acpi.h Log Message: linux: Define acpi_size as alias for ACPI_SIZE. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/acpi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/acpi.h diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.8 src/sys/external/bsd/drm2/include/linux/acpi.h:1.9 --- src/sys/external/bsd/drm2/include/linux/acpi.h:1.8 Sun Feb 27 14:22:29 2022 +++ src/sys/external/bsd/drm2/include/linux/acpi.h Sun Feb 27 14:22:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.h,v 1.8 2022/02/27 14:22:29 riastradh Exp $ */ +/* $NetBSD: acpi.h,v 1.9 2022/02/27 14:22:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -45,6 +45,7 @@ typedef ACPI_HANDLE acpi_handle; typedef ACPI_OBJECT_TYPE acpi_object_type; +typedef ACPI_SIZE acpi_size; typedef ACPI_STATUS acpi_status; #define acpi_evaluate_dsm linux_acpi_evaluate_dsm
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:22:50 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: acpi.h Log Message: linux: Define acpi_size as alias for ACPI_SIZE. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/acpi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:18:34 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: New rb_move(, ) to replace `to = from'. NetBSD rbtree(3) is not relocatable, so this extra step is needed. Unfortunately, there's no easy way to automate detection of where we need to apply this in ported code... To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.18 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17 Sun Feb 27 14:18:25 2022 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Sun Feb 27 14:18:34 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.17 2022/02/27 14:18:25 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.18 2022/02/27 14:18:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -203,6 +203,27 @@ rb_next2_postorder(const struct rb_root } } +/* + * Extension to Linux API, which allows copying a struct rb_root object + * with `=' or `memcpy' and no additional relocation. + */ +static inline void +rb_move(struct rb_root *to, struct rb_root *from) +{ + struct rb_node *root; + + *to = *from; + memset(from, 0, sizeof(*from)); /* paranoia */ + if ((root = to->rbr_tree.rbt_root) == NULL) + return; + + /* + * The root node's `parent' is a strict-aliasing-unsafe hack + * pointing at the root of the tree. + */ + RB_SET_FATHER(root, (struct rb_node *)(void *)>rbr_tree.rbt_root); +} + #define rbtree_postorder_for_each_entry_safe(ENTRY, TMP, ROOT, FIELD) \ for ((ENTRY) = rb_entry_safe(rb_first_postorder(ROOT), \ __typeof__(*(ENTRY)), FIELD); \
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:18:34 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: New rb_move(, ) to replace `to = from'. NetBSD rbtree(3) is not relocatable, so this extra step is needed. Unfortunately, there's no easy way to automate detection of where we need to apply this in ported code... To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:18:25 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h rbtree.h Log Message: linux: Actually do post-order tree traversal. Requires breaking the rbtree(3) abstraction, but this is necessary because the body of the loop often frees the element, so as is we had a huge pile of use-after-free going on. Requires changing struct interval_tree_node's rbnode member to match the Linux name, since we now use container_of here, and radeon relies on this. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/sys/external/bsd/drm2/include/linux/interval_tree.h cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/interval_tree.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.12 src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.13 --- src/sys/external/bsd/drm2/include/linux/interval_tree.h:1.12 Sun Dec 19 11:00:18 2021 +++ src/sys/external/bsd/drm2/include/linux/interval_tree.h Sun Feb 27 14:18:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree.h,v 1.12 2021/12/19 11:00:18 riastradh Exp $ */ +/* $NetBSD: interval_tree.h,v 1.13 2022/02/27 14:18:25 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -43,7 +43,7 @@ #include struct interval_tree_node { - struct rb_node itn_node; + struct rb_node rb; unsigned long start; /* inclusive */ unsigned long last; /* inclusive */ }; @@ -81,7 +81,7 @@ interval_tree_compare_key(void *cookie, static const rb_tree_ops_t interval_tree_ops = { .rbto_compare_nodes = interval_tree_compare_nodes, .rbto_compare_key = interval_tree_compare_key, - .rbto_node_offset = offsetof(struct interval_tree_node, itn_node), + .rbto_node_offset = offsetof(struct interval_tree_node, rb), }; static inline void Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.17 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.16 Mon Feb 14 19:13:04 2022 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Sun Feb 27 14:18:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.16 2022/02/14 19:13:04 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.17 2022/02/27 14:18:25 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -144,15 +144,72 @@ rb_replace_node_cached(struct rb_node *o } /* - * XXX This is not actually postorder, but I can't fathom why you would - * want postorder for an ordered tree; different insertion orders lead - * to different traversal orders. + * This violates the abstraction of rbtree(3) for postorder traversal + * -- children first, then parents -- so it is safe for cleanup code + * that just frees all the nodes without removing them from the tree. */ -#define rbtree_postorder_for_each_entry_safe(NODE, TMP, ROOT, FIELD) \ - for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree); \ - ((NODE) != NULL && \ - ((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE), \ - RB_DIR_RIGHT), 1)); \ - (NODE) = (TMP)) +static inline struct rb_node * +rb_first_postorder(const struct rb_root *root) +{ + struct rb_node *node, *child; + + if ((node = root->rbr_tree.rbt_root) == NULL) + return NULL; + for (;; node = child) { + if ((child = node->rb_left) != NULL) + continue; + if ((child = node->rb_right) != NULL) + continue; + return node; + } +} + +static inline struct rb_node * +rb_next2_postorder(const struct rb_root *root, struct rb_node *node) +{ + struct rb_node *parent, *child; + + if (node == NULL) + return NULL; + + /* + * If we're at the root, there are no more siblings and no + * parent, so post-order iteration is done. + */ + if (RB_ROOT_P(>rbr_tree, node)) + return NULL; + parent = RB_FATHER(node); /* kinda sexist, innit */ + KASSERT(parent != NULL); + + /* + * If we're the right child, we've already processed the left + * child (which may be gone by now), so just return the parent. + */ + if (RB_RIGHT_P(node)) + return parent; + + /* + * Otherwise, move down to the leftmost child of our right + * sibling -- or return the parent if there is none. + */ + if ((node = parent->rb_right) == NULL) + return parent; + for (;; node = child) { + if ((child = node->rb_left) != NULL) + continue; + if ((child = node->rb_right) != NULL) + continue; + return node; + } +} + +#define rbtree_postorder_for_each_entry_safe(ENTRY, TMP, ROOT, FIELD) \ + for ((ENTRY) = rb_entry_safe(rb_first_postorder(ROOT), \ + __typeof__(*(ENTRY)), FIELD); \ + ((ENTRY) != NULL && \ + ((TMP) = rb_entry_safe(rb_next2_postorder((ROOT), \ + &(ENTRY)->FIELD), __typeof__(*(ENTRY)),
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Feb 27 14:18:25 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree.h rbtree.h Log Message: linux: Actually do post-order tree traversal. Requires breaking the rbtree(3) abstraction, but this is necessary because the body of the loop often frees the element, so as is we had a huge pile of use-after-free going on. Requires changing struct interval_tree_node's rbnode member to match the Linux name, since we now use container_of here, and radeon relies on this. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 \ src/sys/external/bsd/drm2/include/linux/interval_tree.h cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: rillig Date: Sat Feb 26 15:57:22 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: vmalloc.h Log Message: drm2: do not try to return a value from a void function lint complained: vmalloc.h(79): error: void function vfree cannot return value [213] No functional change. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/vmalloc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/vmalloc.h diff -u src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.11 src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.12 --- src/sys/external/bsd/drm2/include/linux/vmalloc.h:1.11 Sun Dec 19 12:07:55 2021 +++ src/sys/external/bsd/drm2/include/linux/vmalloc.h Sat Feb 26 15:57:22 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: vmalloc.h,v 1.11 2021/12/19 12:07:55 riastradh Exp $ */ +/* $NetBSD: vmalloc.h,v 1.12 2022/02/26 15:57:22 rillig Exp $ */ /*- * Copyright (c) 2013, 2018 The NetBSD Foundation, Inc. @@ -76,7 +76,7 @@ vzalloc(unsigned long size) static inline void vfree(void *ptr) { - return kfree(ptr); + kfree(ptr); } #define PAGE_KERNEL UVM_PROT_RW
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: rillig Date: Sat Feb 26 15:57:22 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: vmalloc.h Log Message: drm2: do not try to return a value from a void function lint complained: vmalloc.h(79): error: void function vfree cannot return value [213] No functional change. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/vmalloc.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Feb 14 19:13:04 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: Don't skip the last node in rbtree iteration. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.15 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.16 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.15 Sun Dec 19 12:00:08 2021 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Mon Feb 14 19:13:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.15 2021/12/19 12:00:08 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.16 2022/02/14 19:13:04 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -152,7 +152,7 @@ rb_replace_node_cached(struct rb_node *o for ((NODE) = RB_TREE_MIN(&(ROOT)->rbr_tree); \ ((NODE) != NULL && \ ((TMP) = rb_tree_iterate(&(ROOT)->rbr_tree, (NODE), \ - RB_DIR_RIGHT))); \ + RB_DIR_RIGHT), 1)); \ (NODE) = (TMP)) #endif /* _LINUX_RBTREE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Feb 14 19:13:04 UTC 2022 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: Don't skip the last node in rbtree iteration. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Mon Dec 27 13:28:41 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: drm: Define TASK_INTERRUPTIBLE so we can reduce diffs a little. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/include/linux/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:45:50 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: linux: Define need_resched as alias for preempt_needed. No need to open-code this (nor to do it slightly wrong). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.21 src/sys/external/bsd/drm2/include/linux/sched.h:1.22 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.21 Sun Dec 19 12:35:54 2021 +++ src/sys/external/bsd/drm2/include/linux/sched.h Sun Dec 19 12:45:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.21 2021/12/19 12:35:54 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.22 2021/12/19 12:45:50 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -97,9 +97,8 @@ schedule_timeout_uninterruptible(long ti static inline bool need_resched(void) { - /* XXX kpreempt_disable */ - /* XXX ci_want_resched */ - return (curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD); + + return preempt_needed(); } static inline void
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:45:50 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: linux: Define need_resched as alias for preempt_needed. No need to open-code this (nor to do it slightly wrong). To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:37:07 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ioport.h Log Message: drm: Make resource_size return resource_size_t like Linux. Because Linux uses resource_size_t for absolute bus addresses, it is actually bus_addr_t rather than bus_size_t. So using bus_size_t here causes trouble with the i915 range_overflows macro, which verifies that types match. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/ioport.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ioport.h diff -u src/sys/external/bsd/drm2/include/linux/ioport.h:1.7 src/sys/external/bsd/drm2/include/linux/ioport.h:1.8 --- src/sys/external/bsd/drm2/include/linux/ioport.h:1.7 Sun Dec 19 11:55:38 2021 +++ src/sys/external/bsd/drm2/include/linux/ioport.h Sun Dec 19 12:37:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ioport.h,v 1.7 2021/12/19 11:55:38 riastradh Exp $ */ +/* $NetBSD: ioport.h,v 1.8 2021/12/19 12:37:07 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,6 +35,8 @@ #include #include +#include + #define IORESOURCE_IO __BIT(0) #define IORESOURCE_MEM __BIT(1) #define IORESOURCE_IRQ __BIT(2) @@ -52,7 +54,7 @@ struct resource { #define DEFINE_RES_MEM(START, SIZE) \ { .start = (START), .end = (START) + ((SIZE) - 1) } -static inline bus_size_t +static inline resource_size_t resource_size(struct resource *resource) { return resource->end - resource->start + 1;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:37:07 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ioport.h Log Message: drm: Make resource_size return resource_size_t like Linux. Because Linux uses resource_size_t for absolute bus addresses, it is actually bus_addr_t rather than bus_size_t. So using bus_size_t here causes trouble with the i915 range_overflows macro, which verifies that types match. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/include/linux/ioport.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:35:54 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: drm: Timeout audit -- linux/sched.h. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/include/linux/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/sched.h diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.20 src/sys/external/bsd/drm2/include/linux/sched.h:1.21 --- src/sys/external/bsd/drm2/include/linux/sched.h:1.20 Sun Dec 19 12:23:17 2021 +++ src/sys/external/bsd/drm2/include/linux/sched.h Sun Dec 19 12:35:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sched.h,v 1.20 2021/12/19 12:23:17 riastradh Exp $ */ +/* $NetBSD: sched.h,v 1.21 2021/12/19 12:35:54 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -66,14 +66,16 @@ task_pid_nr(struct proc *p) static inline long schedule_timeout_uninterruptible(long timeout) { - long remain; - int start, end; + unsigned start, end; + + KASSERT(timeout >= 0); + KASSERT(timeout < MAX_SCHEDULE_TIMEOUT); if (cold) { unsigned us; if (hz <= 1000) { unsigned ms = hztoms(MIN((unsigned long)timeout, - mstohz(INT_MAX))); + mstohz(INT_MAX/2))); us = MIN(ms, INT_MAX/1000)*1000; } else if (hz <= 100) { us = MIN(timeout, (INT_MAX/100)/hz)*hz*100; @@ -86,11 +88,10 @@ schedule_timeout_uninterruptible(long ti start = getticks(); /* Caller is expected to loop anyway, so no harm in truncating. */ - (void)kpause("loonix", false /*!intr*/, MIN(timeout, INT_MAX), NULL); + (void)kpause("loonix", /*intr*/false, MIN(timeout, INT_MAX/2), NULL); end = getticks(); - remain = timeout - (end - start); - return remain > 0 ? remain : 0; + return timeout - MIN(timeout, (end - start)); } static inline bool
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:35:54 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: sched.h Log Message: drm: Timeout audit -- linux/sched.h. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/include/linux/sched.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:33:49 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: drm: Fix semantics of del_timer, del_timer_sync. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/timer.h diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.16 src/sys/external/bsd/drm2/include/linux/timer.h:1.17 --- src/sys/external/bsd/drm2/include/linux/timer.h:1.16 Sun Dec 19 12:02:05 2021 +++ src/sys/external/bsd/drm2/include/linux/timer.h Sun Dec 19 12:33:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.16 2021/12/19 12:02:05 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.17 2021/12/19 12:33:48 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -87,7 +87,11 @@ del_timer(struct timer_list *timer) * NetBSD: `callout_stop will return a non-zero value if the * callout was EXPIRED.', meaning it is no longer pending. */ - return !callout_stop(>tl_callout); + if (!callout_pending(>tl_callout)) + return 0; /* not active */ + if (callout_stop(>tl_callout)) + return 0; /* too late, already expired */ + return 1; /* we stopped it while active */ } static inline int @@ -101,7 +105,11 @@ del_timer_sync(struct timer_list *timer) * NetBSD: `[callout_halt] will return a non-zero value if the * callout was EXPIRED.', meaning it is no longer pending. */ - return !callout_halt(>tl_callout, NULL); + if (!callout_pending(>tl_callout)) + return 0; /* not active */ + if (callout_halt(>tl_callout, NULL)) + return 0; /* too late, already expired */ + return 1; /* we stopped it while active */ } static inline bool
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:33:49 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: drm: Fix semantics of del_timer, del_timer_sync. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:33:11 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree_generic.h Log Message: drm: Fix an even number of sign errors in interval_tree_generic.h. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h diff -u src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h:1.4 src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h:1.5 --- src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h:1.4 Sun Dec 19 12:22:28 2021 +++ src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h Sun Dec 19 12:33:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: interval_tree_generic.h,v 1.4 2021/12/19 12:22:28 riastradh Exp $ */ +/* $NetBSD: interval_tree_generic.h,v 1.5 2021/12/19 12:33:11 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,6 +32,10 @@ #ifndef _LINUX_INTERVAL_TREE_GENERIC_H_ #define _LINUX_INTERVAL_TREE_GENERIC_H_ +/* XXX See interval_tree.h for warnings. */ + +#include + #define INTERVAL_TREE_DEFINE(T, F, KT, KLAST, NSTART, NLAST, QUAL, PREFIX)\ \ static inline int \ @@ -49,7 +53,7 @@ PREFIX##__compare_nodes(void *__cookie, if (__alast < __blast) \ return -1; \ if (__alast > __blast) \ - return -1; \ + return +1; \ return 0; \ } \ \ @@ -103,7 +107,7 @@ PREFIX##_iter_first(struct rb_root_cache __node = rb_tree_find_node_geq(&__root->rb_root.rbr_tree, &__start); \ if (__node == NULL) \ return NULL; \ - KASSERT(START(__node) <= __start); \ + KASSERT(__start <= START(__node)); \ if (__last < START(__node)) \ return NULL; \ \
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:33:11 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: interval_tree_generic.h Log Message: drm: Fix an even number of sign errors in interval_tree_generic.h. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/drm2/include/linux/interval_tree_generic.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:29:09 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: device.h Log Message: drm: Downgrade warnings from aprint_error to aprint_normal. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/device.h diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.14 src/sys/external/bsd/drm2/include/linux/device.h:1.15 --- src/sys/external/bsd/drm2/include/linux/device.h:1.14 Sun Dec 19 11:49:12 2021 +++ src/sys/external/bsd/drm2/include/linux/device.h Sun Dec 19 12:29:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.14 2021/12/19 11:49:12 riastradh Exp $ */ +/* $NetBSD: device.h,v 1.15 2021/12/19 12:29:09 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -57,9 +57,9 @@ #define dev_warn(DEV, FMT, ...) do { \ if (DEV) \ - aprint_error_dev((DEV), "warn: " FMT, ##__VA_ARGS__); \ + aprint_normal_dev((DEV), "warn: " FMT, ##__VA_ARGS__); \ else \ - aprint_error("warn: " FMT, ##__VA_ARGS__); \ + aprint_normal("warn: " FMT, ##__VA_ARGS__); \ } while (0) #define dev_WARN dev_warn
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:29:09 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: device.h Log Message: drm: Downgrade warnings from aprint_error to aprint_normal. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:24:05 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: linux: ktime_get_real_seconds To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/include/linux/ktime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ktime.h diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.19 src/sys/external/bsd/drm2/include/linux/ktime.h:1.20 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.19 Sun Dec 19 12:21:30 2021 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Sun Dec 19 12:24:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.19 2021/12/19 12:21:30 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.20 2021/12/19 12:24:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -216,4 +217,10 @@ ktime_after(ktime_t a, ktime_t b) return ktime_to_ns(a) > ktime_to_ns(b); } +static inline time_t +ktime_get_real_seconds(void) +{ + return time_second; +} + #endif /* _LINUX_KTIME_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:24:05 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: linux: ktime_get_real_seconds To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/include/linux/ktime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:22:10 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: tracepoint.h Log Message: linux: Define trace_*_enabled too, to return false. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/tracepoint.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/tracepoint.h diff -u src/sys/external/bsd/drm2/include/linux/tracepoint.h:1.3 src/sys/external/bsd/drm2/include/linux/tracepoint.h:1.4 --- src/sys/external/bsd/drm2/include/linux/tracepoint.h:1.3 Sun Dec 19 10:58:17 2021 +++ src/sys/external/bsd/drm2/include/linux/tracepoint.h Sun Dec 19 12:22:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tracepoint.h,v 1.3 2021/12/19 10:58:17 riastradh Exp $ */ +/* $NetBSD: tracepoint.h,v 1.4 2021/12/19 12:22:10 riastradh Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -40,6 +40,7 @@ /* nothing */ #define DEFINE_EVENT(CLASS, NAME, PROTOTYPE, ARGS) \ - static inline void trace_##NAME PROTOTYPE {} + static inline void trace_##NAME PROTOTYPE {} \ + static inline bool trace_##NAME##_enabled(void) { return false; } #endif /* _LINUX_TRACEPOINT_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:22:10 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: tracepoint.h Log Message: linux: Define trace_*_enabled too, to return false. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/tracepoint.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:22:03 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: nbsd-namespace.h Log Message: drm: Knuckle under and define sprintf in nbsd-namespace.h. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h diff -u src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h:1.3 src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h:1.4 --- src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h:1.3 Sun Dec 19 09:59:22 2021 +++ src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h Sun Dec 19 12:22:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: nbsd-namespace.h,v 1.3 2021/12/19 09:59:22 riastradh Exp $ */ +/* $NetBSD: nbsd-namespace.h,v 1.4 2021/12/19 12:22:03 riastradh Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -46,4 +46,7 @@ /* Disable our historic malloc(9) compatibility macro. */ #undef free +/* This should not appear in NetBSD code -- we do not sprintf! */ +#define sprintf(BUF, FMT, ARGS...) snprintf(BUF, SIZE_MAX, FMT, ##ARGS) + #endif /* _LINUX_NBSD_NAMESPACE_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:22:03 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: nbsd-namespace.h Log Message: drm: Knuckle under and define sprintf in nbsd-namespace.h. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/nbsd-namespace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:21:56 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: kfifo.h Log Message: linux: INIT_KFIFO To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/kfifo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/kfifo.h diff -u src/sys/external/bsd/drm2/include/linux/kfifo.h:1.4 src/sys/external/bsd/drm2/include/linux/kfifo.h:1.5 --- src/sys/external/bsd/drm2/include/linux/kfifo.h:1.4 Sun Dec 19 10:57:34 2021 +++ src/sys/external/bsd/drm2/include/linux/kfifo.h Sun Dec 19 12:21:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: kfifo.h,v 1.4 2021/12/19 10:57:34 riastradh Exp $ */ +/* $NetBSD: kfifo.h,v 1.5 2021/12/19 12:21:56 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -61,6 +61,21 @@ struct kfifo_meta { #define DECLARE_KFIFO_PTR(FIFO, TYPE) _KFIFO_PTR_TYPE(, TYPE) FIFO #define DECLARE_KFIFO(FIFO, TYPE, N) _KFIFO_TYPE(, TYPE, N) FIFO +#define INIT_KFIFO(FIFO) do \ +{ \ + _init_kfifo(&(FIFO).kf_meta, sizeof((FIFO).kf_buf)); \ +} while (0) + +static inline void +_init_kfifo(struct kfifo_meta *meta, size_t nbytes) +{ + + mutex_init(>kfm_lock, MUTEX_DEFAULT, IPL_VM); + meta->kfm_head = 0; + meta->kfm_tail = 0; + meta->kfm_nbytes = nbytes; +} + _KFIFO_PTR_TYPE(kfifo, void); #define kfifo_alloc(FIFO, SIZE, GFP) \ @@ -78,10 +93,7 @@ _kfifo_alloc(struct kfifo_meta *meta, vo /* Type pun! Hope void * == struct whatever *. */ memcpy(bufp, , sizeof(void *)); - mutex_init(>kfm_lock, MUTEX_DEFAULT, IPL_VM); - meta->kfm_head = 0; - meta->kfm_tail = 0; - meta->kfm_nbytes = nbytes; + _init_kfifo(meta, nbytes); return 0; }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:21:56 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: kfifo.h Log Message: linux: INIT_KFIFO To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/kfifo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:23 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: scatterlist.h Log Message: linux: Side-load asm/io.h in linux/scatterlist.h. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/drm2/include/linux/scatterlist.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/scatterlist.h diff -u src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.7 src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.8 --- src/sys/external/bsd/drm2/include/linux/scatterlist.h:1.7 Sun Dec 19 12:10:42 2021 +++ src/sys/external/bsd/drm2/include/linux/scatterlist.h Sun Dec 19 12:13:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: scatterlist.h,v 1.7 2021/12/19 12:10:42 riastradh Exp $ */ +/* $NetBSD: scatterlist.h,v 1.8 2021/12/19 12:13:23 riastradh Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -34,6 +34,8 @@ #include +#include + #include #include #include
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:23 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: scatterlist.h Log Message: linux: Side-load asm/io.h in linux/scatterlist.h. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 \ src/sys/external/bsd/drm2/include/linux/scatterlist.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:16 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/pci.h diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.50 src/sys/external/bsd/drm2/include/linux/pci.h:1.51 --- src/sys/external/bsd/drm2/include/linux/pci.h:1.50 Sun Dec 19 12:00:16 2021 +++ src/sys/external/bsd/drm2/include/linux/pci.h Sun Dec 19 12:13:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.h,v 1.50 2021/12/19 12:00:16 riastradh Exp $ */ +/* $NetBSD: pci.h,v 1.51 2021/12/19 12:13:16 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -119,8 +119,12 @@ CTASSERT(PCI_CLASS_BRIDGE_ISA == 0x0601) #define PCI_DEVFN(DEV, FN) \ (__SHIFTIN((DEV), __BITS(3, 7)) | __SHIFTIN((FN), __BITS(0, 2))) -#define PCI_SLOT(DEVFN) __SHIFTOUT((DEVFN), __BITS(3, 7)) -#define PCI_FUNC(DEVFN) __SHIFTOUT((DEVFN), __BITS(0, 2)) +#define PCI_SLOT(DEVFN) ((int)__SHIFTOUT((DEVFN), __BITS(3, 7))) +#define PCI_FUNC(DEVFN) ((int)__SHIFTOUT((DEVFN), __BITS(0, 2))) + +#define PCI_DEVID(BUS, DEVFN) \ + (__SHIFTIN((BUS), __BITS(15, 8)) | __SHIFTIN((DEVFN), __BITS(7, 0))) +#define PCI_BUS_NUM(DEVID) ((int)__SHIFTOUT((DEVID), __BITS(15,8))) #define PCI_NUM_RESOURCES ((PCI_MAPREG_END - PCI_MAPREG_START) / 4) #define DEVICE_COUNT_RESOURCE PCI_NUM_RESOURCES
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:16 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: pci.h Log Message: linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/external/bsd/drm2/include/linux/pci.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:08 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: shmem_fs.h Log Message: drm: Need write lock on vmobjlock for pgo_put. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/shmem_fs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/shmem_fs.h diff -u src/sys/external/bsd/drm2/include/linux/shmem_fs.h:1.3 src/sys/external/bsd/drm2/include/linux/shmem_fs.h:1.4 --- src/sys/external/bsd/drm2/include/linux/shmem_fs.h:1.3 Sun Dec 19 11:33:49 2021 +++ src/sys/external/bsd/drm2/include/linux/shmem_fs.h Sun Dec 19 12:13:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: shmem_fs.h,v 1.3 2021/12/19 11:33:49 riastradh Exp $ */ +/* $NetBSD: shmem_fs.h,v 1.4 2021/12/19 12:13:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -80,6 +80,8 @@ shmem_truncate_range(struct uvm_object * KASSERT(0 <= start); KASSERT(start <= end); } + + rw_enter(uobj->vmobjlock, RW_WRITER); (*uobj->pgops->pgo_put)(uobj, start, end, flags); }
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:13:08 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: shmem_fs.h Log Message: drm: Need write lock on vmobjlock for pgo_put. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/shmem_fs.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:10:27 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: pm_runtime.h Log Message: linux: Make pm_runtime_get_if_in_use succeed. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/pm_runtime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:10:27 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: pm_runtime.h Log Message: linux: Make pm_runtime_get_if_in_use succeed. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/include/linux/pm_runtime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/pm_runtime.h diff -u src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.8 src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.9 --- src/sys/external/bsd/drm2/include/linux/pm_runtime.h:1.8 Sun Dec 19 11:49:12 2021 +++ src/sys/external/bsd/drm2/include/linux/pm_runtime.h Sun Dec 19 12:10:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pm_runtime.h,v 1.8 2021/12/19 11:49:12 riastradh Exp $ */ +/* $NetBSD: pm_runtime.h,v 1.9 2021/12/19 12:10:27 riastradh Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ pm_runtime_forbid(struct device *dev __u static inline int pm_runtime_get_if_in_use(struct device *dev __unused) { - return 0; + return 1; } #endif /* _LINUX_PM_RUNTIME_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:04:51 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: io-mapping.h Log Message: drm: Fix io_mapping_map_wc to map all VAs, not just the first one. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/drm2/include/linux/io-mapping.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/io-mapping.h diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.10 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.11 --- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.10 Sun Dec 19 12:03:30 2021 +++ src/sys/external/bsd/drm2/include/linux/io-mapping.h Sun Dec 19 12:04:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io-mapping.h,v 1.10 2021/12/19 12:03:30 riastradh Exp $ */ +/* $NetBSD: io-mapping.h,v 1.11 2021/12/19 12:04:51 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -147,7 +147,7 @@ io_mapping_map_wc(struct io_mapping *map BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE); KASSERT(cookie != (paddr_t)-1); - pmap_kenter_pa(va, pmap_phys_address(cookie), + pmap_kenter_pa(va + pg*PAGE_SIZE, pmap_phys_address(cookie), PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie)); } pmap_update(pmap_kernel()); @@ -166,7 +166,7 @@ io_mapping_unmap(struct io_mapping *mapp KASSERT(!mapping->diom_atomic); KASSERT(mapping->diom_va != va); - pmap_kremove(va, PAGE_SIZE); + pmap_kremove(va, mapping->diom_mapsize); pmap_update(pmap_kernel()); uvm_km_free(kernel_map, va, mapping->diom_mapsize, UVM_KMF_VAONLY);
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:04:51 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: io-mapping.h Log Message: drm: Fix io_mapping_map_wc to map all VAs, not just the first one. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/sys/external/bsd/drm2/include/linux/io-mapping.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:03:30 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: io-mapping.h Log Message: drm: Allow >page-sized io_mapping_map_wc. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/sys/external/bsd/drm2/include/linux/io-mapping.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/io-mapping.h diff -u src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.9 src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.10 --- src/sys/external/bsd/drm2/include/linux/io-mapping.h:1.9 Sun Dec 19 11:57:43 2021 +++ src/sys/external/bsd/drm2/include/linux/io-mapping.h Sun Dec 19 12:03:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io-mapping.h,v 1.9 2021/12/19 11:57:43 riastradh Exp $ */ +/* $NetBSD: io-mapping.h,v 1.10 2021/12/19 12:03:30 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -45,7 +45,8 @@ struct io_mapping { bus_addr_t base; /* Linux API */ bus_size_t size; /* Linux API */ vaddr_t diom_va; - bool diom_mapped; + bus_size_t diom_mapsize; + bool diom_atomic; }; static inline bool @@ -77,7 +78,8 @@ bus_space_io_mapping_init_wc(bus_space_t mapping->diom_bst = bst; mapping->base = addr; mapping->size = size; - mapping->diom_mapped = false; + mapping->diom_mapsize = 0; + mapping->diom_atomic = false; /* Allocate kva for one page. */ mapping->diom_va = uvm_km_alloc(kernel_map, PAGE_SIZE, PAGE_SIZE, @@ -91,7 +93,8 @@ static inline void io_mapping_fini(struct io_mapping *mapping) { - KASSERT(!mapping->diom_mapped); + KASSERT(mapping->diom_mapsize == 0); + KASSERT(!mapping->diom_atomic); uvm_km_free(kernel_map, mapping->diom_va, PAGE_SIZE, UVM_KMF_VAONLY); mapping->diom_va = 0; /* paranoia */ @@ -124,53 +127,93 @@ static inline void * io_mapping_map_wc(struct io_mapping *mapping, bus_addr_t offset, bus_size_t size) { + bus_size_t pg, npgs = size >> PAGE_SHIFT; + vaddr_t va; paddr_t cookie; - KASSERT(size == PAGE_SIZE); KASSERT(0 == (offset & (PAGE_SIZE - 1))); KASSERT(PAGE_SIZE <= mapping->size); KASSERT(offset <= (mapping->size - PAGE_SIZE)); KASSERT(__type_fit(off_t, offset)); - KASSERT(!mapping->diom_mapped); + KASSERT(mapping->diom_mapsize == 0); + KASSERT(!mapping->diom_atomic); - cookie = bus_space_mmap(mapping->diom_bst, mapping->base, offset, - PROT_READ|PROT_WRITE, - BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE); - KASSERT(cookie != (paddr_t)-1); + va = uvm_km_alloc(kernel_map, size, PAGE_SIZE, + UVM_KMF_VAONLY|UVM_KMF_WAITVA); + for (pg = 0; pg < npgs; pg++) { + cookie = bus_space_mmap(mapping->diom_bst, mapping->base, + offset + pg*PAGE_SIZE, + PROT_READ|PROT_WRITE, + BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE); + KASSERT(cookie != (paddr_t)-1); - pmap_kenter_pa(mapping->diom_va, pmap_phys_address(cookie), - PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie)); + pmap_kenter_pa(va, pmap_phys_address(cookie), + PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie)); + } pmap_update(pmap_kernel()); - mapping->diom_mapped = true; - return (void *)mapping->diom_va; + mapping->diom_mapsize = size; + mapping->diom_atomic = false; + return (void *)va; } static inline void io_mapping_unmap(struct io_mapping *mapping, void *ptr __diagused) { + vaddr_t va = (vaddr_t)ptr; - KASSERT(mapping->diom_mapped); - KASSERT(mapping->diom_va == (vaddr_t)ptr); + KASSERT(mapping->diom_mapsize); + KASSERT(!mapping->diom_atomic); + KASSERT(mapping->diom_va != va); - pmap_kremove(mapping->diom_va, PAGE_SIZE); + pmap_kremove(va, PAGE_SIZE); pmap_update(pmap_kernel()); - mapping->diom_mapped = false; + uvm_km_free(kernel_map, va, mapping->diom_mapsize, UVM_KMF_VAONLY); + + mapping->diom_mapsize = 0; + mapping->diom_atomic = false; } static inline void * -io_mapping_map_atomic_wc(struct io_mapping *mapping, unsigned long offset) +io_mapping_map_atomic_wc(struct io_mapping *mapping, bus_addr_t offset) { + paddr_t cookie; + + KASSERT(0 == (offset & (PAGE_SIZE - 1))); + KASSERT(PAGE_SIZE <= mapping->size); + KASSERT(offset <= (mapping->size - PAGE_SIZE)); + KASSERT(__type_fit(off_t, offset)); + KASSERT(mapping->diom_mapsize == 0); + KASSERT(!mapping->diom_atomic); + + cookie = bus_space_mmap(mapping->diom_bst, mapping->base, offset, + PROT_READ|PROT_WRITE, + BUS_SPACE_MAP_LINEAR|BUS_SPACE_MAP_PREFETCHABLE); + KASSERT(cookie != (paddr_t)-1); + + pmap_kenter_pa(mapping->diom_va, pmap_phys_address(cookie), + PROT_READ|PROT_WRITE, pmap_mmap_flags(cookie)); + pmap_update(pmap_kernel()); - return io_mapping_map_wc(mapping, offset, PAGE_SIZE); + mapping->diom_mapsize = PAGE_SIZE; + mapping->diom_atomic = true; + return (void *)mapping->diom_va; } static inline void -io_mapping_unmap_atomic(struct io_mapping *mapping, void *ptr)
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:03:30 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: io-mapping.h Log Message: drm: Allow >page-sized io_mapping_map_wc. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 \ src/sys/external/bsd/drm2/include/linux/io-mapping.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:02:05 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: linux: Add del_timer return value. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/timer.h diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.15 src/sys/external/bsd/drm2/include/linux/timer.h:1.16 --- src/sys/external/bsd/drm2/include/linux/timer.h:1.15 Sun Dec 19 12:01:57 2021 +++ src/sys/external/bsd/drm2/include/linux/timer.h Sun Dec 19 12:02:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.15 2021/12/19 12:01:57 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.16 2021/12/19 12:02:05 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -76,11 +76,18 @@ mod_timer_pinned(struct timer_list *time mod_timer(timer, then); } -static inline void +static inline int del_timer(struct timer_list *timer) { - callout_stop(>tl_callout); + /* + * Linux: `del_timer of an inactive timer returns 0, del_timer + * of an active timer returns 1.' + * + * NetBSD: `callout_stop will return a non-zero value if the + * callout was EXPIRED.', meaning it is no longer pending. + */ + return !callout_stop(>tl_callout); } static inline int
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:02:05 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: linux: Add del_timer return value. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:01:57 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: linux: Fix return value of del_timer_sync. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/timer.h diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.14 src/sys/external/bsd/drm2/include/linux/timer.h:1.15 --- src/sys/external/bsd/drm2/include/linux/timer.h:1.14 Sun Dec 19 11:55:47 2021 +++ src/sys/external/bsd/drm2/include/linux/timer.h Sun Dec 19 12:01:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.14 2021/12/19 11:55:47 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.15 2021/12/19 12:01:57 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -83,12 +83,18 @@ del_timer(struct timer_list *timer) callout_stop(>tl_callout); } -static inline bool +static inline int del_timer_sync(struct timer_list *timer) { - /* XXX return values? */ - return callout_halt(>tl_callout, NULL); + /* + * Linux: `The function returns whether it has deactivated a + * pending timer or not.' + * + * NetBSD: `[callout_halt] will return a non-zero value if the + * callout was EXPIRED.', meaning it is no longer pending. + */ + return !callout_halt(>tl_callout, NULL); } static inline bool
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:01:57 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: timer.h Log Message: linux: Fix return value of del_timer_sync. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/timer.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:01:21 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: linux: ktime_get_ns To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/ktime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ktime.h diff -u src/sys/external/bsd/drm2/include/linux/ktime.h:1.17 src/sys/external/bsd/drm2/include/linux/ktime.h:1.18 --- src/sys/external/bsd/drm2/include/linux/ktime.h:1.17 Sun Dec 19 11:38:04 2021 +++ src/sys/external/bsd/drm2/include/linux/ktime.h Sun Dec 19 12:01:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ktime.h,v 1.17 2021/12/19 11:38:04 riastradh Exp $ */ +/* $NetBSD: ktime.h,v 1.18 2021/12/19 12:01:21 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -146,6 +146,12 @@ ktime_get_raw(void) } static inline uint64_t +ktime_get_ns(void) +{ + return ktime_to_ns(ktime_get()); +} + +static inline uint64_t ktime_get_raw_ns(void) { return ktime_to_ns(ktime_get_raw());
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:01:21 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ktime.h Log Message: linux: ktime_get_ns To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/include/linux/ktime.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:00:24 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: reboot.h suspend.h vga_switcheroo.h Log Message: linux: Misc empty stubs for amdgpu. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/reboot.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/suspend.h cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/reboot.h diff -u src/sys/external/bsd/drm2/include/linux/reboot.h:1.6 src/sys/external/bsd/drm2/include/linux/reboot.h:1.7 --- src/sys/external/bsd/drm2/include/linux/reboot.h:1.6 Wed Jan 1 22:57:17 2020 +++ src/sys/external/bsd/drm2/include/linux/reboot.h Sun Dec 19 12:00:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: reboot.h,v 1.6 2020/01/01 22:57:17 thorpej Exp $ */ +/* $NetBSD: reboot.h,v 1.7 2021/12/19 12:00:24 riastradh Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -61,4 +61,11 @@ unregister_reboot_notifier(struct notifi return 0; } +static inline void +emergency_restart(void) +{ + + kern_reboot(0, NULL); +} + #endif /* _LINUX_REBOOT_H_ */ Index: src/sys/external/bsd/drm2/include/linux/suspend.h diff -u src/sys/external/bsd/drm2/include/linux/suspend.h:1.2 src/sys/external/bsd/drm2/include/linux/suspend.h:1.3 --- src/sys/external/bsd/drm2/include/linux/suspend.h:1.2 Tue Mar 18 18:20:43 2014 +++ src/sys/external/bsd/drm2/include/linux/suspend.h Sun Dec 19 12:00:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: suspend.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: suspend.h,v 1.3 2021/12/19 12:00:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,8 @@ #ifndef _LINUX_SUSPEND_H_ #define _LINUX_SUSPEND_H_ +#include + +#define ksys_sync_helper() __nothing + #endif /* _LINUX_SUSPEND_H_ */ Index: src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h diff -u src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h:1.3 src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h:1.4 --- src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h:1.3 Sun Dec 19 01:48:52 2021 +++ src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h Sun Dec 19 12:00:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vga_switcheroo.h,v 1.3 2021/12/19 01:48:52 riastradh Exp $ */ +/* $NetBSD: vga_switcheroo.h,v 1.4 2021/12/19 12:00:24 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,7 +32,10 @@ #ifndef _LINUX_VGA_SWITCHEROO_H_ #define _LINUX_VGA_SWITCHEROO_H_ +#include + #include +#include #define VGA_SWITCHEROO_CAN_SWITCH_DDC __BIT(0) @@ -42,4 +45,9 @@ vga_switcheroo_handler_flags(void) return 0; } +static inline void +vga_switcheroo_fini_domain_pm_ops(device_t dev) +{ +} + #endif /* _LINUX_VGA_SWITCHEROO_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:00:24 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: reboot.h suspend.h vga_switcheroo.h Log Message: linux: Misc empty stubs for amdgpu. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/reboot.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/suspend.h cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/include/linux/vga_switcheroo.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:00:08 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: Fix rb tree iteration. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.14 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.15 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.14 Sun Dec 19 11:45:41 2021 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Sun Dec 19 12:00:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.14 2021/12/19 11:45:41 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.15 2021/12/19 12:00:08 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -87,7 +87,10 @@ rb_next2(const struct rb_root *root, con char *vnode = (char *)__UNCONST(rbnode); vnode -= root->rbr_tree.rbt_ops->rbto_node_offset; - return RB_TREE_NEXT(__UNCONST(>rbr_tree), vnode); + vnode = RB_TREE_NEXT(__UNCONST(>rbr_tree), vnode); + if (vnode) + vnode += root->rbr_tree.rbt_ops->rbto_node_offset; + return (struct rb_node *)vnode; } static inline struct rb_node *
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 12:00:08 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux: Fix rb tree iteration. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:55:38 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ioport.h Log Message: linux: Define IORESOURCE_* to be bits, not indices. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/ioport.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/ioport.h diff -u src/sys/external/bsd/drm2/include/linux/ioport.h:1.6 src/sys/external/bsd/drm2/include/linux/ioport.h:1.7 --- src/sys/external/bsd/drm2/include/linux/ioport.h:1.6 Sun Dec 19 10:57:27 2021 +++ src/sys/external/bsd/drm2/include/linux/ioport.h Sun Dec 19 11:55:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ioport.h,v 1.6 2021/12/19 10:57:27 riastradh Exp $ */ +/* $NetBSD: ioport.h,v 1.7 2021/12/19 11:55:38 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -35,9 +35,10 @@ #include #include -#define IORESOURCE_IO 0 -#define IORESOURCE_MEM 1 -#define IORESOURCE_IRQ 2 +#define IORESOURCE_IO __BIT(0) +#define IORESOURCE_MEM __BIT(1) +#define IORESOURCE_IRQ __BIT(2) +#define IORESOURCE_UNSET __BIT(3) struct resource { bus_addr_t start;
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:55:38 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: ioport.h Log Message: linux: Define IORESOURCE_* to be bits, not indices. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/ioport.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:50:47 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: xarray.h Log Message: linux: namespace xa_destroy To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/xarray.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/xarray.h diff -u src/sys/external/bsd/drm2/include/linux/xarray.h:1.6 src/sys/external/bsd/drm2/include/linux/xarray.h:1.7 --- src/sys/external/bsd/drm2/include/linux/xarray.h:1.6 Sun Dec 19 11:27:04 2021 +++ src/sys/external/bsd/drm2/include/linux/xarray.h Sun Dec 19 11:50:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: xarray.h,v 1.6 2021/12/19 11:27:04 riastradh Exp $ */ +/* $NetBSD: xarray.h,v 1.7 2021/12/19 11:50:47 riastradh Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -55,6 +55,7 @@ struct xa_limit { #define XA_FLAGS_ALLOC 0 #define xa_alloc linux_xa_alloc +#define xa_destroy linux_xa_destroy #define xa_erase linux_xa_erase #define xa_find linux_xa_find #define xa_find_after linux_xa_find_after
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:50:47 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: xarray.h Log Message: linux: namespace xa_destroy To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/include/linux/xarray.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:48:34 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: math64.h Log Message: Provide not-quite-proper mul_u64_u32_div Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/math64.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/math64.h diff -u src/sys/external/bsd/drm2/include/linux/math64.h:1.11 src/sys/external/bsd/drm2/include/linux/math64.h:1.12 --- src/sys/external/bsd/drm2/include/linux/math64.h:1.11 Sun Dec 19 11:36:57 2021 +++ src/sys/external/bsd/drm2/include/linux/math64.h Sun Dec 19 11:48:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: math64.h,v 1.11 2021/12/19 11:36:57 riastradh Exp $ */ +/* $NetBSD: math64.h,v 1.12 2021/12/19 11:48:34 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -88,6 +88,13 @@ mul_u32_u32(uint32_t a, uint32_t b) return (uint64_t)a * (uint64_t)b; } +static inline uint64_t +mul_u64_u32_div(uint64_t a, uint32_t b, uint32_t div) +{ + /* XXX implement to account for overflow */ + return (a * b) / div; +} + /* return floor((a*b) / 2^c) */ static inline uint64_t mul_u64_u32_shr(uint64_t a, uint32_t b, unsigned c)
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:48:34 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: math64.h Log Message: Provide not-quite-proper mul_u64_u32_div Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/math64.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:47:55 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: spinlock.h Log Message: provide spin_trylock_irqsave Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/spinlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/spinlock.h diff -u src/sys/external/bsd/drm2/include/linux/spinlock.h:1.12 src/sys/external/bsd/drm2/include/linux/spinlock.h:1.13 --- src/sys/external/bsd/drm2/include/linux/spinlock.h:1.12 Sun Dec 19 11:38:37 2021 +++ src/sys/external/bsd/drm2/include/linux/spinlock.h Sun Dec 19 11:47:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: spinlock.h,v 1.12 2021/12/19 11:38:37 riastradh Exp $ */ +/* $NetBSD: spinlock.h,v 1.13 2021/12/19 11:47:55 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -82,6 +82,10 @@ spin_unlock_irq(spinlock_t *spinlock) mutex_enter(&((spinlock_t *)(SPINLOCK))->sl_lock); \ } while (0) +#define spin_trylock_irqsave(SPINLOCK, FLAGS)\ + ( (FLAGS) = 0, \ + mutex_tryenter(&((spinlock_t *)(SPINLOCK))->sl_lock) ) + static inline void spin_unlock_irqrestore(spinlock_t *spinlock, unsigned long __unused flags) {
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:47:55 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: spinlock.h Log Message: provide spin_trylock_irqsave Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/spinlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:46:58 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: mm.h Log Message: Cast, because we get passed void* Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/mm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/mm.h diff -u src/sys/external/bsd/drm2/include/linux/mm.h:1.21 src/sys/external/bsd/drm2/include/linux/mm.h:1.22 --- src/sys/external/bsd/drm2/include/linux/mm.h:1.21 Sun Dec 19 11:33:49 2021 +++ src/sys/external/bsd/drm2/include/linux/mm.h Sun Dec 19 11:46:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.h,v 1.21 2021/12/19 11:33:49 riastradh Exp $ */ +/* $NetBSD: mm.h,v 1.22 2021/12/19 11:46:58 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -49,7 +49,7 @@ struct file; #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_ALIGN(x) (((x) + (PAGE_SIZE-1)) & ~(PAGE_SIZE-1)) -#define offset_in_page(x) ((x) & (PAGE_SIZE-1)) +#define offset_in_page(x) ((uintptr_t)(x) & (PAGE_SIZE-1)) #define untagged_addr(x) (x)
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:46:58 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: mm.h Log Message: Cast, because we get passed void* Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/include/linux/mm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:46:30 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: cpufreq.h Log Message: Provide cpufreq.h Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/cpufreq.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/cpufreq.h diff -u src/sys/external/bsd/drm2/include/linux/cpufreq.h:1.2 src/sys/external/bsd/drm2/include/linux/cpufreq.h:1.3 --- src/sys/external/bsd/drm2/include/linux/cpufreq.h:1.2 Tue Mar 18 18:20:43 2014 +++ src/sys/external/bsd/drm2/include/linux/cpufreq.h Sun Dec 19 11:46:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufreq.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: cpufreq.h,v 1.3 2021/12/19 11:46:30 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -32,4 +32,31 @@ #ifndef _LINUX_CPUFREQ_H_ #define _LINUX_CPUFREQ_H_ +#include +#include +#include +#include + +struct cpufreq_policy { + struct { + unsigned int max_freq; + } cpuinfo; +}; + +static inline struct cpufreq_policy * +cpufreq_cpu_get(int x) +{ + struct cpufreq_policy *policy = kmem_alloc(sizeof(*policy), KM_SLEEP); + policy->cpuinfo.max_freq = cpufreq_get(curcpu()); + return policy; +} + +static inline void +cpufreq_cpu_put(struct cpufreq_policy *policy) +{ + kmem_free(policy, sizeof(*policy)); +} + +#define tsc_khz cpu_frequency(curcpu()) + #endif /* _LINUX_CPUFREQ_H_ */
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:46:30 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: cpufreq.h Log Message: Provide cpufreq.h Author: Maya Rashish Committer: Taylor R Campbell To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/cpufreq.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/include/linux
Module Name:src Committed By: riastradh Date: Sun Dec 19 11:45:42 UTC 2021 Modified Files: src/sys/external/bsd/drm2/include/linux: rbtree.h Log Message: linux/rbtree: Hack up constiness. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/include/linux/rbtree.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/external/bsd/drm2/include/linux/rbtree.h diff -u src/sys/external/bsd/drm2/include/linux/rbtree.h:1.13 src/sys/external/bsd/drm2/include/linux/rbtree.h:1.14 --- src/sys/external/bsd/drm2/include/linux/rbtree.h:1.13 Sun Dec 19 11:45:13 2021 +++ src/sys/external/bsd/drm2/include/linux/rbtree.h Sun Dec 19 11:45:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rbtree.h,v 1.13 2021/12/19 11:45:13 riastradh Exp $ */ +/* $NetBSD: rbtree.h,v 1.14 2021/12/19 11:45:41 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -51,17 +51,30 @@ struct rb_root_cached { __p ? container_of(__p, T, F) : NULL; \ }) +/* + * Several of these functions take const inputs and return non-const + * outputs. That is a deliberate choice. It would be better if these + * functions could be const-polymorphic -- return const if given const, + * return non-const if given non-const -- but C doesn't let us express + * that. We are using them to adapt Linux code that is defined in + * terms of token-substitution macros, without types of their own, + * which happen to work out with both const and non-const variants. + * Presumably the Linux code compiles upstream and has some level of + * const type-checking in Linux, so this abuse of __UNCONST does not + * carry substantial risk over to this code here. + */ + static inline bool -RB_EMPTY_ROOT(struct rb_root *root) +RB_EMPTY_ROOT(const struct rb_root *root) { - return RB_TREE_MIN(>rbr_tree) == NULL; + return RB_TREE_MIN(__UNCONST(>rbr_tree)) == NULL; } static inline struct rb_node * -rb_first(struct rb_root *root) +rb_first(const struct rb_root *root) { - char *vnode = RB_TREE_MIN(>rbr_tree); + char *vnode = RB_TREE_MIN(__UNCONST(>rbr_tree)); if (vnode) vnode += root->rbr_tree.rbt_ops->rbto_node_offset; @@ -69,18 +82,18 @@ rb_first(struct rb_root *root) } static inline struct rb_node * -rb_next2(struct rb_root *root, struct rb_node *rbnode) +rb_next2(const struct rb_root *root, const struct rb_node *rbnode) { - char *vnode = (char *)rbnode; + char *vnode = (char *)__UNCONST(rbnode); vnode -= root->rbr_tree.rbt_ops->rbto_node_offset; - return RB_TREE_NEXT(>rbr_tree, vnode); + return RB_TREE_NEXT(__UNCONST(>rbr_tree), vnode); } static inline struct rb_node * -rb_last(struct rb_root *root) +rb_last(const struct rb_root *root) { - char *vnode = RB_TREE_MAX(>rbr_tree); + char *vnode = RB_TREE_MAX(__UNCONST(>rbr_tree)); if (vnode) vnode += root->rbr_tree.rbt_ops->rbto_node_offset; @@ -88,7 +101,7 @@ rb_last(struct rb_root *root) } static inline struct rb_node * -rb_first_cached(struct rb_root_cached *root) +rb_first_cached(const struct rb_root_cached *root) { return rb_first(>rb_root); }