diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h b/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h index 39cdc4ecd5..172be4326f 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.51 2025/02/11 22:27:09 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn * @@ -112,6 +112,7 @@ void cpu_identify_cleanup(void); #include #include #include +#include struct cpu_info { struct device *ci_dev; /* Device corresponding to this CPU */ @@ -126,6 +127,7 @@ struct cpu_info { struct cpu_info *ci_self; #define __HAVE_CPU_TOPOLOGY + u_int32_t ci_cputype; u_int32_t ci_smt_id; u_int32_t ci_core_id; u_int32_t ci_pkg_id; @@ -162,11 +164,14 @@ struct cpu_info { volatile int ci_opp_max; uint32_t ci_cpu_supply; + uint64_t ci_capacity; + u_long ci_prev_sleep; u_long ci_last_itime; #ifdef MULTIPROCESSOR struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; + struct xcall_cpu ci_xcall; #define __HAVE_UVM_PERCPU struct uvm_pmr_cache ci_uvm; volatile int ci_flags; @@ -339,6 +344,7 @@ intr_restore(u_long daif) restore_daif(daif); } +void cpu_classify(void); void cpu_halt(void); int cpu_suspend_primary(void); void cpu_resume_secondary(struct cpu_info *); diff --git a/lib/libc/include/aarch64-openbsd-none/arm64/intr.h b/lib/libc/include/aarch64-openbsd-none/arm64/intr.h index 8dbf0d06f8..e6b6fcf61a 100644 --- a/lib/libc/include/aarch64-openbsd-none/arm64/intr.h +++ b/lib/libc/include/aarch64-openbsd-none/arm64/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.25 2025/06/30 14:19:20 kettenis Exp $ */ +/* $OpenBSD: intr.h,v 1.26 2025/12/15 01:39:32 dlg Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -84,6 +84,8 @@ #ifndef _LOCORE #include +#define SOFTINTR_XCALL NSOFTINTR + void softintr(int); int splraise(int); @@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int); #define ARM_IPI_NOP 0 #define ARM_IPI_DDB 1 #define ARM_IPI_HALT 2 +#define ARM_IPI_XCALL 3 + +/* kern_xcall calls this to dispatch xcalls */ +#define cpu_xcall_ipi(_ci) arm_send_ipi((_ci), ARM_IPI_XCALL) +/* interrupt controllers call this to get cpu_xcall_dispatch run */ +#define arm_cpu_xcall_dispatch() softintr(SOFTINTR_XCALL) #ifdef DIAGNOSTIC /* diff --git a/lib/libc/include/aarch64-openbsd-none/machine/cpu.h b/lib/libc/include/aarch64-openbsd-none/machine/cpu.h index 39cdc4ecd5..172be4326f 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.51 2025/02/11 22:27:09 kettenis Exp $ */ +/* $OpenBSD: cpu.h,v 1.55 2026/04/03 14:20:23 kettenis Exp $ */ /* * Copyright (c) 2016 Dale Rahn * @@ -112,6 +112,7 @@ void cpu_identify_cleanup(void); #include #include #include +#include struct cpu_info { struct device *ci_dev; /* Device corresponding to this CPU */ @@ -126,6 +127,7 @@ struct cpu_info { struct cpu_info *ci_self; #define __HAVE_CPU_TOPOLOGY + u_int32_t ci_cputype; u_int32_t ci_smt_id; u_int32_t ci_core_id; u_int32_t ci_pkg_id; @@ -162,11 +164,14 @@ struct cpu_info { volatile int ci_opp_max; uint32_t ci_cpu_supply; + uint64_t ci_capacity; + u_long ci_prev_sleep; u_long ci_last_itime; #ifdef MULTIPROCESSOR struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; + struct xcall_cpu ci_xcall; #define __HAVE_UVM_PERCPU struct uvm_pmr_cache ci_uvm; volatile int ci_flags; @@ -339,6 +344,7 @@ intr_restore(u_long daif) restore_daif(daif); } +void cpu_classify(void); void cpu_halt(void); int cpu_suspend_primary(void); void cpu_resume_secondary(struct cpu_info *); diff --git a/lib/libc/include/aarch64-openbsd-none/machine/intr.h b/lib/libc/include/aarch64-openbsd-none/machine/intr.h index 8dbf0d06f8..e6b6fcf61a 100644 --- a/lib/libc/include/aarch64-openbsd-none/machine/intr.h +++ b/lib/libc/include/aarch64-openbsd-none/machine/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.25 2025/06/30 14:19:20 kettenis Exp $ */ +/* $OpenBSD: intr.h,v 1.26 2025/12/15 01:39:32 dlg Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -84,6 +84,8 @@ #ifndef _LOCORE #include +#define SOFTINTR_XCALL NSOFTINTR + void softintr(int); int splraise(int); @@ -199,6 +201,12 @@ extern void (*intr_send_ipi_func)(struct cpu_info *, int); #define ARM_IPI_NOP 0 #define ARM_IPI_DDB 1 #define ARM_IPI_HALT 2 +#define ARM_IPI_XCALL 3 + +/* kern_xcall calls this to dispatch xcalls */ +#define cpu_xcall_ipi(_ci) arm_send_ipi((_ci), ARM_IPI_XCALL) +/* interrupt controllers call this to get cpu_xcall_dispatch run */ +#define arm_cpu_xcall_dispatch() softintr(SOFTINTR_XCALL) #ifdef DIAGNOSTIC /* diff --git a/lib/libc/include/generic-openbsd/db.h b/lib/libc/include/generic-openbsd/db.h index 13678ac00b..1705bc372c 100644 --- a/lib/libc/include/generic-openbsd/db.h +++ b/lib/libc/include/generic-openbsd/db.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db.h,v 1.12 2015/10/17 21:48:42 guenther Exp $ */ +/* $OpenBSD: db.h,v 1.14 2026/03/10 04:30:34 deraadt Exp $ */ /* $NetBSD: db.h,v 1.13 1994/10/26 00:55:48 cgd Exp $ */ /*- @@ -84,15 +84,9 @@ typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE; * is so that the access methods can skip copying the key/data pair when * the DB_LOCK flag isn't set. */ -#if UINT_MAX > 65535 #define DB_LOCK 0x20000000 /* Do locking. */ #define DB_SHMEM 0x40000000 /* Use shared memory. */ #define DB_TXN 0x80000000 /* Do transactions. */ -#else -#define DB_LOCK 0x2000 /* Do locking. */ -#define DB_SHMEM 0x4000 /* Use shared memory. */ -#define DB_TXN 0x8000 /* Do transactions. */ -#endif /* Access method description structure. */ typedef struct __db { diff --git a/lib/libc/include/generic-openbsd/ddb/db_interface.h b/lib/libc/include/generic-openbsd/ddb/db_interface.h index b13f0be9f3..1d21ec6b57 100644 --- a/lib/libc/include/generic-openbsd/ddb/db_interface.h +++ b/lib/libc/include/generic-openbsd/ddb/db_interface.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.h,v 1.28 2024/09/05 08:52:27 bluhm Exp $ */ +/* $OpenBSD: db_interface.h,v 1.29 2026/02/02 15:20:51 claudio Exp $ */ /* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */ /* @@ -41,6 +41,7 @@ vaddr_t db_disasm(vaddr_t, int); /* kern/kern_proc.c */ void db_kill_cmd(db_expr_t, int, db_expr_t, char *); +void db_stop_cmd(db_expr_t, int, db_expr_t, char *); void db_show_all_procs(db_expr_t, int, db_expr_t, char *); /* kern/kern_clockintr.c */ diff --git a/lib/libc/include/generic-openbsd/fnmatch.h b/lib/libc/include/generic-openbsd/fnmatch.h index bb0a769261..63dea304a3 100644 --- a/lib/libc/include/generic-openbsd/fnmatch.h +++ b/lib/libc/include/generic-openbsd/fnmatch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $ */ +/* $OpenBSD: fnmatch.h,v 1.9 2026/03/29 14:08:46 daniel Exp $ */ /* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */ /*- @@ -43,11 +43,15 @@ #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ #define FNM_PERIOD 0x04 /* Period must be matched by period. */ + #if __BSD_VISIBLE #define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ +#define FNM_FILE_NAME FNM_PATHNAME +#endif + +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405 #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ #define FNM_IGNORECASE FNM_CASEFOLD -#define FNM_FILE_NAME FNM_PATHNAME #endif __BEGIN_DECLS diff --git a/lib/libc/include/generic-openbsd/login_cap.h b/lib/libc/include/generic-openbsd/login_cap.h index d0c1169ee0..0320034960 100644 --- a/lib/libc/include/generic-openbsd/login_cap.h +++ b/lib/libc/include/generic-openbsd/login_cap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: login_cap.h,v 1.19 2022/03/01 01:22:11 tedu Exp $ */ +/* $OpenBSD: login_cap.h,v 1.21 2025/11/24 12:37:15 jca Exp $ */ /*- * Copyright (c) 1995,1997 Berkeley Software Design, Inc. All rights reserved. @@ -56,6 +56,8 @@ #define LOGIN_SETENV 0x0080 /* Set environment */ #define LOGIN_SETRTABLE 0x0100 /* Set rtable */ #define LOGIN_SETALL 0x01ff /* Set all. */ +/* The LOGIN defines below are not part of LOGIN_SETALL */ +#define LOGIN_SETXDGENV 0x0200 /* Set XDG environment variables */ #define BI_AUTH "authorize" /* Accepted authentication */ #define BI_REJECT "reject" /* Rejected authentication */ diff --git a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h index c63d514470..ee144d1f9f 100644 --- a/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h +++ b/lib/libc/include/generic-openbsd/miscfs/fuse/fusefs_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: fusefs_node.h,v 1.5 2024/10/31 13:55:21 claudio Exp $ */ +/* $OpenBSD: fusefs_node.h,v 1.6 2026/01/22 11:53:31 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon * @@ -40,6 +40,7 @@ struct fusefs_node { struct fusefs_mnt *i_ump; dev_t i_dev; /* Device associated with the inode. */ ino_t i_number; /* The identity of the inode. */ + ino_t i_parent_cache;/* Parent inode (only dirs). */ struct lockf_state *i_lockf; /* Byte-level lock state. */ struct rrwlock i_lock; /* Inode lock */ diff --git a/lib/libc/include/generic-openbsd/net/bpf.h b/lib/libc/include/generic-openbsd/net/bpf.h index d549a0b2e3..a8a2dba585 100644 --- a/lib/libc/include/generic-openbsd/net/bpf.h +++ b/lib/libc/include/generic-openbsd/net/bpf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bpf.h,v 1.74 2025/03/04 01:01:25 dlg Exp $ */ +/* $OpenBSD: bpf.h,v 1.75 2025/11/16 02:20:08 dlg Exp $ */ /* $NetBSD: bpf.h,v 1.15 1996/12/13 07:57:33 mikel Exp $ */ /* @@ -255,6 +255,8 @@ struct bpf_hdr { #define BPF_LSH 0x60 #define BPF_RSH 0x70 #define BPF_NEG 0x80 +#define BPF_MOD 0x90 +#define BPF_XOR 0xa0 #define BPF_JA 0x00 #define BPF_JEQ 0x10 #define BPF_JGT 0x20 diff --git a/lib/libc/include/generic-openbsd/net/hfsc.h b/lib/libc/include/generic-openbsd/net/hfsc.h index 0e2864cc05..c74731729e 100644 --- a/lib/libc/include/generic-openbsd/net/hfsc.h +++ b/lib/libc/include/generic-openbsd/net/hfsc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hfsc.h,v 1.14 2025/07/07 00:55:15 jsg Exp $ */ +/* $OpenBSD: hfsc.h,v 1.15 2026/03/19 14:59:05 sthen Exp $ */ /* * Copyright (c) 2012-2013 Henning Brauer @@ -45,9 +45,9 @@ struct hfsc_pktcntr { do { (cntr)->packets++; (cntr)->bytes += len; } while (0) struct hfsc_sc { - u_int m1; /* slope of the first segment in bits/sec */ - u_int d; /* the x-projection of the first segment in msec */ - u_int m2; /* slope of the second segment in bits/sec */ + u_int64_t m1; /* slope of the first segment in bits/sec */ + u_int64_t m2; /* slope of the second segment in bits/sec */ + u_int d; /* the x-projection of the first segment in msec */ }; /* special class handles */ diff --git a/lib/libc/include/generic-openbsd/net/if.h b/lib/libc/include/generic-openbsd/net/if.h index f6ccd8ad0e..a309550f95 100644 --- a/lib/libc/include/generic-openbsd/net/if.h +++ b/lib/libc/include/generic-openbsd/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.221 2025/09/09 09:16:18 bluhm Exp $ */ +/* $OpenBSD: if.h,v 1.223 2025/12/09 03:33:06 dlg Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -526,6 +526,9 @@ struct if_sffpage { #include #ifdef _KERNEL + +#define IF_MAX_VECTORS 8 + struct socket; struct ifnet; struct ifq_ops; @@ -555,6 +558,7 @@ void if_group_routechange(const struct sockaddr *, const struct sockaddr *); struct ifnet *if_unit(const char *); struct ifnet *if_get(unsigned int); struct ifnet *if_ref(struct ifnet *); +struct ifnet *if_get_smr(unsigned int); void if_put(struct ifnet *); void ifnewlladdr(struct ifnet *); void if_congestion(void); diff --git a/lib/libc/include/generic-openbsd/net/if_bridge.h b/lib/libc/include/generic-openbsd/net/if_bridge.h index f946c66949..17eaae1a66 100644 --- a/lib/libc/include/generic-openbsd/net/if_bridge.h +++ b/lib/libc/include/generic-openbsd/net/if_bridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.h,v 1.73 2021/11/11 10:03:10 claudio Exp $ */ +/* $OpenBSD: if_bridge.h,v 1.77 2025/11/21 04:44:26 dlg Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -39,6 +39,12 @@ #include #include +#define IFBR_PVID_NULL EVL_VLID_NULL +#define IFBR_PVID_MIN EVL_VLID_MIN +#define IFBR_PVID_MAX EVL_VLID_MAX +#define IFBR_PVID_NONE 0xffff +#define IFBR_PVID_DECLINE 0xfffe + /* * Bridge control request: add/delete member interfaces. */ @@ -51,6 +57,7 @@ struct ifbreq { u_int8_t ifbr_state; /* member stp state */ u_int8_t ifbr_priority; /* member stp priority */ + u_int16_t ifbr_pvid; /* member port vlan id */ u_int32_t ifbr_path_cost; /* member stp path cost */ u_int32_t ifbr_stpflags; /* member stp flags */ u_int8_t ifbr_proto; /* member stp protocol */ @@ -74,6 +81,8 @@ struct ifbreq { #define IFBIF_BSTP_AUTOPTP 0x0080 /* member stp autoptp enabled */ #define IFBIF_SPAN 0x0100 /* ifs is a span port (ro) */ #define IFBIF_LOCAL 0x1000 /* local port in switch(4) */ +#define IFBIF_LOCKED 0x2000 /* restrict rx src mac with fib */ +#define IFBIF_PVLAN_PTAGS 0x4000 /* only use tags for primary pvlans */ #define IFBIF_RO_MASK 0x0f00 /* read only bits */ /* SIOCBRDGFLUSH */ @@ -133,15 +142,19 @@ struct ifbareq { #define IFBAF_DYNAMIC 0x00 /* dynamically learned */ #define IFBAF_STATIC 0x01 /* static address */ +struct ifbvareq; + struct ifbaconf { char ifbac_name[IFNAMSIZ]; /* bridge ifs name */ u_int32_t ifbac_len; /* buffer size */ union { caddr_t ifbacu_buf; /* buffer */ struct ifbareq *ifbacu_req; /* request pointer */ + struct ifbvareq *ifbacu_vreq; /* request pointer */ } ifbac_ifbacu; #define ifbac_buf ifbac_ifbacu.ifbacu_buf #define ifbac_req ifbac_ifbacu.ifbacu_req +#define ifbac_vreq ifbac_ifbacu.ifbacu_vreq }; struct ifbrparam { @@ -237,6 +250,40 @@ struct ifbrlconf { #define ifbrl_req ifbrl_ifbrlu.ifbrlu_req }; +struct ifbvareq { + char ifbva_name[IFNAMSIZ]; /* bridge name */ + char ifbva_ifsname[IFNAMSIZ]; /* destination ifs */ + time_t ifbva_created; /* monotime */ + time_t ifbva_used; /* monotime */ + unsigned int ifbva_flags; /* address flags */ + uint16_t ifbva_vid; /* vlan */ + struct ether_addr ifbva_dst; /* destination addr */ + struct sockaddr_storage ifbva_dstsa; /* tunnel endpoint */ +}; + +struct ifbrvidmap { + char ifbrvm_name[IFNAMSIZ]; + char ifbrvm_ifsname[IFNAMSIZ]; + unsigned int ifbrvm_op; +#define IFBRVM_OP_SET 0x0 /* kernel = ifbrvm_map */ +#define IFBRVM_OP_OR 0x1 /* kernel |= ifbrvm_map */ +#define IFBRVM_OP_ANDNOT 0x2 /* kernel &= ~ifbrvm_map */ + unsigned int ifbrvm_gen; + uint8_t ifbrvm_map[512]; +}; + +struct ifbrpvlan { + char ifbrpv_name[IFNAMSIZ]; + uint16_t ifbrpv_primary; + uint16_t ifbrpv_secondary; + unsigned int ifbrpv_type; +#define IFBRPV_T_PRIMARY 0 +#define IFBRPV_T_SECONDARY 1 /* for searching */ +#define IFBRPV_T_ISOLATED 2 +#define IFBRPV_T_COMMUNITY 3 + unsigned int ifbrpv_gen; +}; + #ifdef _KERNEL #include diff --git a/lib/libc/include/generic-openbsd/net/if_etherbridge.h b/lib/libc/include/generic-openbsd/net/if_etherbridge.h index 57bfe0ad58..11cb6a00c6 100644 --- a/lib/libc/include/generic-openbsd/net/if_etherbridge.h +++ b/lib/libc/include/generic-openbsd/net/if_etherbridge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_etherbridge.h,v 1.5 2024/11/04 00:13:15 jsg Exp $ */ +/* $OpenBSD: if_etherbridge.h,v 1.7 2025/11/21 04:44:26 dlg Exp $ */ /* * Copyright (c) 2018, 2021 David Gwynne @@ -44,16 +44,21 @@ struct eb_entry { uint64_t ebe_addr; void *ebe_port; + uint16_t ebe_vs; /* secondary vid */ unsigned int ebe_type; #define EBE_DYNAMIC 0x0 #define EBE_STATIC 0x1 #define EBE_DEAD 0xdead + time_t ebe_created; time_t ebe_age; struct etherbridge *ebe_etherbridge; struct smr_entry ebe_smr_entry; }; +#define etherbridge_port(_ebe) ((_ebe)->ebe_port) +#define etherbridge_vs(_ebe) ((_ebe)->ebe_vs) + SMR_TAILQ_HEAD(eb_list, eb_entry); RBT_HEAD(eb_tree, eb_entry); TAILQ_HEAD(eb_queue, eb_entry); @@ -80,13 +85,19 @@ int etherbridge_up(struct etherbridge *); int etherbridge_down(struct etherbridge *); void etherbridge_destroy(struct etherbridge *); -void etherbridge_map(struct etherbridge *, void *, uint64_t); +void etherbridge_map(struct etherbridge *, void *, + uint16_t, uint16_t, uint64_t); void etherbridge_map_ea(struct etherbridge *, void *, - const struct ether_addr *); -void *etherbridge_resolve(struct etherbridge *, uint64_t); + uint16_t, uint16_t, const struct ether_addr *); +struct eb_entry * + etherbridge_resolve_entry(struct etherbridge *, + uint16_t, uint64_t); +void *etherbridge_resolve(struct etherbridge *, uint16_t, uint64_t); void *etherbridge_resolve_ea(struct etherbridge *, - const struct ether_addr *); + uint16_t, const struct ether_addr *); void etherbridge_detach_port(struct etherbridge *, void *); +void etherbridge_filter(struct etherbridge *, + int (*)(struct etherbridge *, struct eb_entry *, void *), void *); /* ioctl support */ int etherbridge_set_max(struct etherbridge *, struct ifbrparam *); @@ -94,9 +105,11 @@ int etherbridge_get_max(struct etherbridge *, struct ifbrparam *); int etherbridge_set_tmo(struct etherbridge *, struct ifbrparam *); int etherbridge_get_tmo(struct etherbridge *, struct ifbrparam *); int etherbridge_rtfind(struct etherbridge *, struct ifbaconf *); +int etherbridge_vareq(struct etherbridge *, struct ifbaconf *); int etherbridge_add_addr(struct etherbridge *, void *, - const struct ether_addr *, unsigned int); -int etherbridge_del_addr(struct etherbridge *, const struct ether_addr *); + uint16_t, uint16_t, const struct ether_addr *, unsigned int); +int etherbridge_del_addr(struct etherbridge *, + uint16_t, const struct ether_addr *); void etherbridge_flush(struct etherbridge *, uint32_t); #endif /* _NET_ETHERBRIDGE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/net/if_media.h b/lib/libc/include/generic-openbsd/net/if_media.h index a365fd1349..82f6108a3d 100644 --- a/lib/libc/include/generic-openbsd/net/if_media.h +++ b/lib/libc/include/generic-openbsd/net/if_media.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_media.h,v 1.46 2025/06/13 00:08:16 jsg Exp $ */ +/* $OpenBSD: if_media.h,v 1.47 2026/03/19 16:50:32 chris Exp $ */ /* $NetBSD: if_media.h,v 1.22 2000/02/17 21:53:16 sommerfeld Exp $ */ /*- @@ -327,6 +327,18 @@ uint64_t ifmedia_baudrate(uint64_t); #define IFM_IEEE80211_VHT_MCS7 103 /* 11ac MCS 7 */ #define IFM_IEEE80211_VHT_MCS8 104 /* 11ac MCS 8 */ #define IFM_IEEE80211_VHT_MCS9 105 /* 11ac MCS 9 */ +#define IFM_IEEE80211_HE_MCS0 106 /* 11ax MCS 0 */ +#define IFM_IEEE80211_HE_MCS1 107 /* 11ax MCS 1 */ +#define IFM_IEEE80211_HE_MCS2 108 /* 11ax MCS 2 */ +#define IFM_IEEE80211_HE_MCS3 109 /* 11ax MCS 3 */ +#define IFM_IEEE80211_HE_MCS4 110 /* 11ax MCS 4 */ +#define IFM_IEEE80211_HE_MCS5 111 /* 11ax MCS 5 */ +#define IFM_IEEE80211_HE_MCS6 112 /* 11ax MCS 6 */ +#define IFM_IEEE80211_HE_MCS7 113 /* 11ax MCS 7 */ +#define IFM_IEEE80211_HE_MCS8 114 /* 11ax MCS 8 */ +#define IFM_IEEE80211_HE_MCS9 115 /* 11ax MCS 9 */ +#define IFM_IEEE80211_HE_MCS10 116 /* 11ax MCS 10 */ +#define IFM_IEEE80211_HE_MCS11 117 /* 11ax MCS 11 */ #define IFM_IEEE80211_ADHOC 0x0000000000010000ULL /* Operate in Adhoc mode */ #define IFM_IEEE80211_HOSTAP 0x0000000000020000ULL /* Operate in Host AP mode */ @@ -341,6 +353,7 @@ uint64_t ifmedia_baudrate(uint64_t); #define IFM_IEEE80211_FH 0x0000000400000000ULL /* 2GHz, GFSK mode */ #define IFM_IEEE80211_11N 0x0000000800000000ULL /* 11n/HT 2GHz/5GHz */ #define IFM_IEEE80211_11AC 0x0000001000000000ULL /* 11ac/VHT 5GHz */ +#define IFM_IEEE80211_11AX 0x0000002000000000ULL /* 11ax/HE 2GHz/5GHz */ /* * Digitally multiplexed "Carrier" Serial Interfaces @@ -721,6 +734,18 @@ struct ifmedia_description { { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS7, "VHT-MCS7" }, \ { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS8, "VHT-MCS8" }, \ { IFM_IEEE80211|IFM_IEEE80211_VHT_MCS9, "VHT-MCS9" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS0, "HE-MCS0" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS1, "HE-MCS1" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS2, "HE-MCS2" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS3, "HE-MCS3" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS4, "HE-MCS4" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS5, "HE-MCS5" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS6, "HE-MCS6" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS7, "HE-MCS7" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS8, "HE-MCS8" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS9, "HE-MCS9" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS10, "HE-MCS10" }, \ + { IFM_IEEE80211|IFM_IEEE80211_HE_MCS11, "HE-MCS11" }, \ \ { IFM_TDM|IFM_TDM_T1, "t1" }, \ { IFM_TDM|IFM_TDM_T1_AMI, "t1-ami" }, \ diff --git a/lib/libc/include/generic-openbsd/net/if_pflow.h b/lib/libc/include/generic-openbsd/net/if_pflow.h index 389e5bf0eb..ffbeca2dff 100644 --- a/lib/libc/include/generic-openbsd/net/if_pflow.h +++ b/lib/libc/include/generic-openbsd/net/if_pflow.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.h,v 1.23 2023/12/16 22:16:02 mvs Exp $ */ +/* $OpenBSD: if_pflow.h,v 1.24 2025/11/13 17:12:30 chris Exp $ */ /* * Copyright (c) 2008 Henning Brauer @@ -33,22 +33,26 @@ /* RFC 5102 Information Element Identifiers */ -#define PFIX_IE_octetDeltaCount 1 -#define PFIX_IE_packetDeltaCount 2 -#define PFIX_IE_protocolIdentifier 4 -#define PFIX_IE_ipClassOfService 5 -#define PFIX_IE_sourceTransportPort 7 -#define PFIX_IE_sourceIPv4Address 8 -#define PFIX_IE_ingressInterface 10 -#define PFIX_IE_destinationTransportPort 11 -#define PFIX_IE_destinationIPv4Address 12 -#define PFIX_IE_egressInterface 14 -#define PFIX_IE_flowEndSysUpTime 21 -#define PFIX_IE_flowStartSysUpTime 22 -#define PFIX_IE_sourceIPv6Address 27 -#define PFIX_IE_destinationIPv6Address 28 -#define PFIX_IE_flowStartMilliseconds 152 -#define PFIX_IE_flowEndMilliseconds 153 +#define PFIX_IE_octetDeltaCount 1 +#define PFIX_IE_packetDeltaCount 2 +#define PFIX_IE_protocolIdentifier 4 +#define PFIX_IE_ipClassOfService 5 +#define PFIX_IE_sourceTransportPort 7 +#define PFIX_IE_sourceIPv4Address 8 +#define PFIX_IE_ingressInterface 10 +#define PFIX_IE_destinationTransportPort 11 +#define PFIX_IE_destinationIPv4Address 12 +#define PFIX_IE_egressInterface 14 +#define PFIX_IE_flowEndSysUpTime 21 +#define PFIX_IE_flowStartSysUpTime 22 +#define PFIX_IE_sourceIPv6Address 27 +#define PFIX_IE_destinationIPv6Address 28 +#define PFIX_IE_flowStartMilliseconds 152 +#define PFIX_IE_flowEndMilliseconds 153 +#define PFIX_IE_postNATSourceIPv4Address 225 +#define PFIX_IE_postNATDestinationIPv4Address 226 +#define PFIX_IE_postNAPTSourceTransportPort 227 +#define PFIX_IE_postNAPTDestinationTransportPort 228 struct pflow_flow { u_int32_t src_ip; @@ -110,6 +114,28 @@ struct pflow_ipfix_tmpl_ipv4 { #define PFLOW_IPFIX_TMPL_IPV4_ID 256 } __packed; +struct pflow_ipfix_tmpl_nat_ipv4 { + struct pflow_tmpl_hdr h; + struct pflow_tmpl_fspec src_ip; + struct pflow_tmpl_fspec dest_ip; + struct pflow_tmpl_fspec if_index_in; + struct pflow_tmpl_fspec if_index_out; + struct pflow_tmpl_fspec packets; + struct pflow_tmpl_fspec octets; + struct pflow_tmpl_fspec start; + struct pflow_tmpl_fspec finish; + struct pflow_tmpl_fspec post_src_ip; + struct pflow_tmpl_fspec post_dest_ip; + struct pflow_tmpl_fspec post_src_port; + struct pflow_tmpl_fspec post_dest_port; + struct pflow_tmpl_fspec src_port; + struct pflow_tmpl_fspec dest_port; + struct pflow_tmpl_fspec tos; + struct pflow_tmpl_fspec protocol; +#define PFLOW_IPFIX_TMPL_NAT_IPV4_FIELD_COUNT 16 +#define PFLOW_IPFIX_TMPL_NAT_IPV4_ID 257 +} __packed; + /* update pflow_clone_create() when changing pflow_ipfix_tmpl_v6 */ struct pflow_ipfix_tmpl_ipv6 { struct pflow_tmpl_hdr h; @@ -126,13 +152,14 @@ struct pflow_ipfix_tmpl_ipv6 { struct pflow_tmpl_fspec tos; struct pflow_tmpl_fspec protocol; #define PFLOW_IPFIX_TMPL_IPV6_FIELD_COUNT 12 -#define PFLOW_IPFIX_TMPL_IPV6_ID 257 +#define PFLOW_IPFIX_TMPL_IPV6_ID 258 } __packed; struct pflow_ipfix_tmpl { struct pflow_set_header set_header; - struct pflow_ipfix_tmpl_ipv4 ipv4_tmpl; - struct pflow_ipfix_tmpl_ipv6 ipv6_tmpl; + struct pflow_ipfix_tmpl_ipv4 ipv4_tmpl; + struct pflow_ipfix_tmpl_nat_ipv4 ipv4_nat_tmpl; + struct pflow_ipfix_tmpl_ipv6 ipv6_tmpl; } __packed; struct pflow_ipfix_flow4 { @@ -151,6 +178,26 @@ struct pflow_ipfix_flow4 { /* XXX padding needed? */ } __packed; +struct pflow_ipfix_nat_flow4 { + u_int32_t src_ip; /* sourceIPv4Address*/ + u_int32_t dest_ip; /* destinationIPv4Address */ + u_int32_t if_index_in; /* ingressInterface */ + u_int32_t if_index_out; /* egressInterface */ + u_int64_t flow_packets; /* packetDeltaCount */ + u_int64_t flow_octets; /* octetDeltaCount */ + int64_t flow_start; /* flowStartMilliseconds */ + int64_t flow_finish; /* flowEndMilliseconds */ + u_int32_t post_src_ip; /* postNATSourceIPv4Address */ + u_int32_t post_dest_ip; /* postNATDestinationIPv4Address */ + u_int16_t post_src_port; /* postNAPTSourceTransportPort */ + u_int16_t post_dest_port; /* postNAPTDestinationTransportPort */ + u_int16_t src_port; /* sourceTransportPort */ + u_int16_t dest_port; /* destinationTransportPort */ + u_int8_t tos; /* ipClassOfService */ + u_int8_t protocol; /* protocolIdentifier */ + /* XXX padding needed? */ +} __packed; + struct pflow_ipfix_flow6 { struct in6_addr src_ip; /* sourceIPv6Address */ struct in6_addr dest_ip; /* destinationIPv6Address */ @@ -187,6 +234,7 @@ struct pflow_softc { unsigned int sc_count; /* [m] */ unsigned int sc_count4; /* [m] */ + unsigned int sc_count4_nat; /* [m] */ unsigned int sc_count6; /* [m] */ unsigned int sc_maxcount; /* [m] */ unsigned int sc_maxcount4; /* [m] */ @@ -196,6 +244,7 @@ struct pflow_softc { struct timeout sc_tmo; struct timeout sc_tmo6; struct timeout sc_tmo_tmpl; + struct timeout sc_tmo_nat; struct mbuf_queue sc_outputqueue; struct task sc_outputtask; struct socket *so; /* [p] */ @@ -208,6 +257,8 @@ struct pflow_softc { mbuf */ struct mbuf *sc_mbuf6; /* [m] current cumulative mbuf */ + struct mbuf *sc_mbuf_nat; /* [m] current cumulative + mbuf */ SMR_SLIST_ENTRY(pflow_softc) sc_next; }; diff --git a/lib/libc/include/generic-openbsd/net/if_pfsync.h b/lib/libc/include/generic-openbsd/net/if_pfsync.h index 70445c4146..2715a2a979 100644 --- a/lib/libc/include/generic-openbsd/net/if_pfsync.h +++ b/lib/libc/include/generic-openbsd/net/if_pfsync.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pfsync.h,v 1.65 2025/07/07 00:55:15 jsg Exp $ */ +/* $OpenBSD: if_pfsync.h,v 1.66 2026/04/12 03:16:04 deraadt Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -112,7 +112,7 @@ struct pfsync_header { u_int8_t version; u_int8_t _pad; u_int16_t len; /* in bytes */ - u_int8_t pfcksum[PF_MD5_DIGEST_LENGTH]; + u_int8_t spare[16]; } __packed; /* diff --git a/lib/libc/include/generic-openbsd/net/if_sppp.h b/lib/libc/include/generic-openbsd/net/if_sppp.h index e730e79597..484feeaee3 100644 --- a/lib/libc/include/generic-openbsd/net/if_sppp.h +++ b/lib/libc/include/generic-openbsd/net/if_sppp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sppp.h,v 1.31 2025/01/15 06:15:44 dlg Exp $ */ +/* $OpenBSD: if_sppp.h,v 1.32 2025/11/02 08:04:04 dlg Exp $ */ /* $NetBSD: if_sppp.h,v 1.2.2.1 1999/04/04 06:57:39 explorer Exp $ */ /* @@ -174,6 +174,7 @@ struct sppp { time_t pp_last_receive; /* peer's last "sign of life" */ time_t pp_last_activity; /* second of last payload data s/r */ enum ppp_phase pp_phase; /* phase we're currently in */ + struct task pp_autodial; int state[IDX_COUNT]; /* state machine */ u_char confid[IDX_COUNT]; /* id of last configuration request */ int rst_counter[IDX_COUNT]; /* restart counter */ diff --git a/lib/libc/include/generic-openbsd/net/if_trunk.h b/lib/libc/include/generic-openbsd/net/if_trunk.h index eb5c51916f..4cd0a91a48 100644 --- a/lib/libc/include/generic-openbsd/net/if_trunk.h +++ b/lib/libc/include/generic-openbsd/net/if_trunk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_trunk.h,v 1.32 2025/03/02 21:28:32 bluhm Exp $ */ +/* $OpenBSD: if_trunk.h,v 1.33 2025/11/24 23:40:00 dlg Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Reyk Floeter @@ -159,6 +159,8 @@ struct trunk_softc; struct trunk_port { struct ifnet *tp_if; /* physical interface */ struct trunk_softc *tp_trunk; /* parent trunk */ + struct refcnt tp_refs; + struct ether_port tp_ether_port; u_int8_t tp_lladdr[ETHER_ADDR_LEN]; caddr_t tp_psc; /* protocol data */ @@ -172,7 +174,6 @@ struct trunk_port { int (*tp_ioctl)(struct ifnet *, u_long, caddr_t); int (*tp_output)(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); - void (*tp_input)(struct ifnet *, struct mbuf *, struct netstack *); SLIST_ENTRY(trunk_port) tp_entries; }; diff --git a/lib/libc/include/generic-openbsd/net/if_types.h b/lib/libc/include/generic-openbsd/net/if_types.h index e2603d366a..8cf9aa5ca2 100644 --- a/lib/libc/include/generic-openbsd/net/if_types.h +++ b/lib/libc/include/generic-openbsd/net/if_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_types.h,v 1.24 2022/01/02 22:36:04 jsg Exp $ */ +/* $OpenBSD: if_types.h,v 1.25 2026/03/23 08:42:22 jsg Exp $ */ /* $NetBSD: if_types.h,v 1.17 2000/10/26 06:51:31 onoe Exp $ */ /* @@ -175,7 +175,7 @@ #define IFT_A12MPPSWITCH 0x82 /* Avalon Parallel Processor */ #define IFT_TUNNEL 0x83 /* Encapsulation interface */ #define IFT_COFFEE 0x84 /* coffee pot */ -#define IFT_CES 0x85 /* Circiut Emulation Service */ +#define IFT_CES 0x85 /* Circuit Emulation Service */ #define IFT_ATMSUBINTERFACE 0x86 /* (x) ATM Sub Interface */ #define IFT_L2VLAN 0x87 /* Layer 2 Virtual LAN using 802.1Q */ #define IFT_L3IPVLAN 0x88 /* Layer 3 Virtual LAN - IP Protocol */ diff --git a/lib/libc/include/generic-openbsd/net/if_var.h b/lib/libc/include/generic-openbsd/net/if_var.h index f1fb1fb1cd..d672bc61bf 100644 --- a/lib/libc/include/generic-openbsd/net/if_var.h +++ b/lib/libc/include/generic-openbsd/net/if_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_var.h,v 1.139 2025/07/19 16:40:40 mvs Exp $ */ +/* $OpenBSD: if_var.h,v 1.148 2026/03/22 23:14:00 bluhm Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include @@ -81,6 +81,7 @@ * K kernel lock * N net lock * T if_tmplist_lock + * m interface multicast rwlock if_maddrlock * * For SRP related structures that allow lock-free reads, the write lock * is indicated below. @@ -92,9 +93,12 @@ struct task; struct cpumem; struct netstack { - struct route ns_route; - struct mbuf_list ns_tcp_ml; - struct mbuf_list ns_tcp6_ml; + struct mbuf_list ns_input; + struct mbuf_list ns_proto; + + struct route ns_route; + struct mbuf_list ns_tcp_ml; + struct mbuf_list ns_tcp6_ml; }; /* @@ -141,6 +145,8 @@ enum if_counters { * (Would like to call this struct ``if'', but C isn't PL/1.) */ TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */ +struct carp_softc; +SMR_LIST_HEAD(carp_iflist, carp_softc); struct ifnet { /* and the entries */ void *if_softc; /* [I] lower-level data for this if */ @@ -148,8 +154,9 @@ struct ifnet { /* and the entries */ TAILQ_ENTRY(ifnet) if_list; /* [NK] all struct ifnets are chained */ TAILQ_ENTRY(ifnet) if_tmplist; /* [T] temporary list */ TAILQ_HEAD(, ifaddr) if_addrlist; /* [N] list of addresses per if */ - TAILQ_HEAD(, ifmaddr) if_maddrlist; /* [N] list of multicast records */ + TAILQ_HEAD(, ifmaddr) if_maddrlist; /* [m] list of multicast records */ TAILQ_HEAD(, ifg_list) if_groups; /* [N] list of groups per if */ + struct rwlock if_maddrlock; struct task_list if_addrhooks; /* [I] address change callbacks */ struct task_list if_linkstatehooks; /* [I] link change callbacks*/ struct task_list if_detachhooks; /* [I] detach callbacks */ @@ -163,9 +170,11 @@ struct ifnet { /* and the entries */ caddr_t if_mcast6; /* used by IPv6 multicast code */ caddr_t if_pf_kif; /* pf interface abstraction */ union { - struct srpl carp_s; /* carp if list (used by !carp ifs) */ - unsigned int carp_idx; /* index of carpdev (used by carp - ifs) */ + /* carp if list (used by IFT_ETHER) */ + struct carp_iflist carp_s; + + /* index of carpdev (used by IFT_CARP) */ + unsigned int carp_idx; } if_carp_ptr; #define if_carp if_carp_ptr.carp_s #define if_carpdevidx if_carp_ptr.carp_idx @@ -254,6 +263,7 @@ struct ifaddr { struct ifnet *ifa_ifp; /* back-pointer to interface */ TAILQ_ENTRY(ifaddr) ifa_list; /* [N] list of addresses for interface */ + TAILQ_ENTRY(ifaddr) ifa_tmplist;/* [T] temporary list */ u_int ifa_flags; /* interface flags, see below */ struct refcnt ifa_refcnt; /* number of `rt_ifa` references */ int ifa_metric; /* cost of going out this interface */ @@ -265,10 +275,10 @@ struct ifaddr { * Interface multicast address. */ struct ifmaddr { - struct sockaddr *ifma_addr; /* Protocol address */ - unsigned int ifma_ifidx; /* Index of the interface */ + TAILQ_ENTRY(ifmaddr) ifma_list; /* [m] Per-interface list */ + struct sockaddr *ifma_addr; /* [I] Protocol address */ struct refcnt ifma_refcnt; /* Count of references */ - TAILQ_ENTRY(ifmaddr) ifma_list; /* Per-interface list */ + unsigned int ifma_ifidx; /* [I] Index of the interface */ }; /* @@ -337,6 +347,9 @@ int if_enqueue_ifq(struct ifnet *, struct mbuf *); void if_input(struct ifnet *, struct mbuf_list *); void if_vinput(struct ifnet *, struct mbuf *, struct netstack *); void if_input_process(struct ifnet *, struct mbuf_list *, unsigned int); +void if_input_proto(struct ifnet *, struct mbuf *, + void (*)(struct ifnet *, struct mbuf *, struct netstack *), + struct netstack *); int if_input_local(struct ifnet *, struct mbuf *, sa_family_t, struct netstack *); int if_output_ml(struct ifnet *, struct mbuf_list *, @@ -351,6 +364,15 @@ void p2p_rtrequest(struct ifnet *, int, struct rtentry *); void p2p_input(struct ifnet *, struct mbuf *, struct netstack *); int p2p_bpf_mtap(caddr_t, const struct mbuf *, u_int); +/* this is a helper for if_input_process and similar functions */ +static inline void +if_input_process_proto(struct ifnet *ifp, struct mbuf *m, struct netstack *ns) +{ + void (*input)(struct ifnet *, struct mbuf *, struct netstack *); + input = m->m_pkthdr.ph_cookie; + (*input)(ifp, m, ns); +} + struct ifaddr *ifa_ifwithaddr(const struct sockaddr *, u_int); struct ifaddr *ifa_ifwithdstaddr(const struct sockaddr *, u_int); struct ifaddr *ifaof_ifpforaddr(const struct sockaddr *, struct ifnet *); diff --git a/lib/libc/include/generic-openbsd/net/netisr.h b/lib/libc/include/generic-openbsd/net/netisr.h index 1e515d8b55..67cb799211 100644 --- a/lib/libc/include/generic-openbsd/net/netisr.h +++ b/lib/libc/include/generic-openbsd/net/netisr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netisr.h,v 1.61 2023/07/06 04:55:05 dlg Exp $ */ +/* $OpenBSD: netisr.h,v 1.62 2025/10/30 17:30:46 mvs Exp $ */ /* $NetBSD: netisr.h,v 1.12 1995/08/12 23:59:24 mycroft Exp $ */ /* @@ -44,7 +44,6 @@ #define NETISR_IP 2 /* same as AF_INET */ #define NETISR_ARP 18 /* same as AF_LINK */ #define NETISR_IPV6 24 /* same as AF_INET6 */ -#define NETISR_PIPEX 27 /* for pipex processing */ #define NETISR_PPP 28 /* for PPP processing */ #define NETISR_BRIDGE 29 /* for bridge processing */ #define NETISR_PPPOE 30 /* for pppoe processing */ @@ -63,7 +62,6 @@ void ipintr(void); void ip6intr(void); void pppintr(void); void bridgeintr(void); -void pipexintr(void); void pppoeintr(void); #define schednetisr(anisr) \ diff --git a/lib/libc/include/generic-openbsd/net/pfvar.h b/lib/libc/include/generic-openbsd/net/pfvar.h index 96654afc9d..5303dc2a7a 100644 --- a/lib/libc/include/generic-openbsd/net/pfvar.h +++ b/lib/libc/include/generic-openbsd/net/pfvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar.h,v 1.543 2025/04/14 20:02:34 sf Exp $ */ +/* $OpenBSD: pfvar.h,v 1.548 2026/02/05 03:26:00 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -479,6 +479,13 @@ union pf_rule_ptr { #define PF_ANCHOR_HIWAT 512 #define PF_OPTIMIZER_TABLE_PFX "__automatic_" +enum { + PF_LIMITER_NOMATCH, + PF_LIMITER_BLOCK +}; + +#define PF_LIMITER_DEFAULT PF_LIMITER_BLOCK + struct pf_rule { struct pf_rule_addr src; struct pf_rule_addr dst; @@ -591,6 +598,14 @@ struct pf_rule { u_int8_t set_prio[2]; sa_family_t naf; u_int8_t rcvifnot; + struct { + u_int8_t id; + int limiter_action; + } statelim; + struct { + u_int8_t id; + int limiter_action; + } sourcelim; struct { struct pf_addr addr; @@ -1502,6 +1517,133 @@ struct pfioc_synflwats { u_int32_t lowat; }; +#define PF_STATELIM_NAME_LEN 16 /* kstat istr */ +#define PF_STATELIM_DESCR_LEN 64 + +struct pfioc_statelim { + u_int32_t ticket; + + char name[PF_STATELIM_NAME_LEN]; + uint32_t id; +#define PF_STATELIM_ID_NONE 0 +#define PF_STATELIM_ID_MIN 1 +#define PF_STATELIM_ID_MAX 255 /* fits in pf_state uint8_t */ + + /* limit on the total number of states */ + unsigned int limit; +#define PF_STATELIM_LIMIT_MIN 1 +#define PF_STATELIM_LIMIT_MAX (1 << 24) /* pf is pretty scalable */ + + /* rate limit on the creation of states */ + struct { + unsigned int limit; + unsigned int seconds; + } rate; + + char description[PF_STATELIM_DESCR_LEN]; + + /* kernel state for GET ioctls */ + unsigned int inuse; /* gauge */ + uint64_t admitted; /* counter */ + uint64_t hardlimited; /* counter */ + uint64_t ratelimited; /* counter */ +}; + +#define PF_SOURCELIM_NAME_LEN 16 /* kstat istr */ +#define PF_SOURCELIM_DESCR_LEN 64 + +struct pfioc_sourcelim { + u_int32_t ticket; + + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; +#define PF_SOURCELIM_ID_NONE 0 +#define PF_SOURCELIM_ID_MIN 1 +#define PF_SOURCELIM_ID_MAX 255 /* fits in pf_state uint8_t */ + + /* limit on the total number of address entries */ + unsigned int entries; + + /* limit on the number of states per address entry */ + unsigned int limit; + + /* rate limit on the creation of states by an address entry */ + struct { + unsigned int limit; + unsigned int seconds; + } rate; + + /* + * when the number of states on an entry exceeds hwm, add + * the address to the specified table. when the number of + * states goes below lwm, remove it from the table. + */ + char overload_tblname[PF_TABLE_NAME_SIZE]; + unsigned int overload_hwm; + unsigned int overload_lwm; + + /* + * mask addresses before they're used for entries. /64s + * everywhere for inet6 makes it easy to use too much memory. + */ + unsigned int inet_prefix; + unsigned int inet6_prefix; + + char description[PF_SOURCELIM_DESCR_LEN]; + + /* kernel state for GET ioctls */ + unsigned int nentries; /* gauge */ + unsigned int inuse; /* gauge */ + + uint64_t addrallocs; /* counter */ + uint64_t addrnomem; /* counter */ + uint64_t admitted; /* counter */ + uint64_t addrlimited; /* counter */ + uint64_t hardlimited; /* counter */ + uint64_t ratelimited; /* counter */ +}; + +struct pfioc_source_entry { + sa_family_t af; + unsigned int rdomain; + struct pf_addr addr; + + /* stats */ + + unsigned int inuse; /* gauge */ + uint64_t admitted; /* counter */ + uint64_t hardlimited; /* counter */ + uint64_t ratelimited; /* counter */ +}; + +struct pfioc_source { + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + + /* copied from the parent source limiter */ + + unsigned int inet_prefix; + unsigned int inet6_prefix; + unsigned int limit; + + /* source entries */ + size_t entry_size; /* sizeof(struct pfioc_source_entry) */ + + struct pfioc_source_entry *key; + struct pfioc_source_entry *entries; + size_t entrieslen; /* bytes */ +}; + +struct pfioc_source_kill { + char name[PF_SOURCELIM_NAME_LEN]; + uint32_t id; + unsigned int rdomain; + sa_family_t af; + struct pf_addr addr; + + unsigned int rmstates; /* kill the states too? */ +}; + /* * ioctl operations */ @@ -1570,6 +1712,15 @@ struct pfioc_synflwats { #define DIOCSETSYNCOOKIES _IOWR('D', 98, u_int8_t) #define DIOCGETSYNFLWATS _IOWR('D', 99, struct pfioc_synflwats) #define DIOCXEND _IOWR('D', 100, u_int32_t) +#define DIOCADDSTATELIM _IOW('D', 101, struct pfioc_statelim) +#define DIOCADDSOURCELIM _IOW('D', 102, struct pfioc_sourcelim) +#define DIOCGETSTATELIM _IOWR('D', 103, struct pfioc_statelim) +#define DIOCGETSOURCELIM _IOWR('D', 104, struct pfioc_sourcelim) +#define DIOCGETSOURCE _IOWR('D', 105, struct pfioc_source) +#define DIOCGETNSTATELIM _IOWR('D', 106, struct pfioc_statelim) +#define DIOCGETNSOURCELIM _IOWR('D', 107, struct pfioc_sourcelim) +#define DIOCGETNSOURCE _IOWR('D', 108, struct pfioc_source) +#define DIOCCLRSOURCE _IOWR('D', 109, struct pfioc_source_kill) #ifdef _KERNEL @@ -1723,6 +1874,8 @@ int pfr_clr_tstats(struct pfr_table *, int, int *, int); int pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); int pfr_clr_addrs(struct pfr_table *, int *, int); int pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, time_t); +int pfr_remove_kentry(struct pfr_ktable *, struct pfr_addr *); + int pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, int); int pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, diff --git a/lib/libc/include/generic-openbsd/net/pfvar_priv.h b/lib/libc/include/generic-openbsd/net/pfvar_priv.h index a005b8511a..e33bd69e28 100644 --- a/lib/libc/include/generic-openbsd/net/pfvar_priv.h +++ b/lib/libc/include/generic-openbsd/net/pfvar_priv.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfvar_priv.h,v 1.38 2024/09/07 22:41:55 aisha Exp $ */ +/* $OpenBSD: pfvar_priv.h,v 1.42 2026/02/05 03:26:00 dlg Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -39,6 +39,7 @@ #include #include +#include #include /* @@ -47,6 +48,45 @@ */ struct pfsync_deferral; +struct kstat; + +/* + * PF state links + * + * This is used to augment a struct pf_state so it can be + * tracked/referenced by the state and source address limiter things. + * Each limiter maintains a list of the states they "own", and these + * state links are what the limiters use to wire a state into their + * lists. + * + * Without PF state links, the pf_state struct would have to grow + * a lot to support a feature that may not be used. + * + * pfl_entry is used by the pools to add states to their list. + * pfl_state allows the pools to get from their list of states to + * the states themselves. + * + * pfl_link allows operations on states (well, delete) to be able + * to quickly locate the pf_state_link struct so they can be unwired + * from the pools. + */ + +#define PF_STATE_LINK_TYPE_STATELIM 1 +#define PF_STATE_LINK_TYPE_SOURCELIM 2 + +struct pf_state_link { + /* used by source/state pools to get to states */ + TAILQ_ENTRY(pf_state_link) pfl_link; + + /* used by pf_state to get to source/state pools */ + SLIST_ENTRY(pf_state_link) pfl_linkage; + + struct pf_state *pfl_state; + unsigned int pfl_type; +}; + +TAILQ_HEAD(pf_state_link_list, pf_state_link); +SLIST_HEAD(pf_state_linkage, pf_state_link); /* * pf state items - links from pf_state_key to pf_states @@ -144,6 +184,9 @@ struct pf_state { u_int16_t if_index_out; /* [I] */ u_int16_t delay; /* [I] */ u_int8_t rt; /* [I] */ + uint8_t statelim; + uint8_t sourcelim; + struct pf_state_linkage linkage; }; RBT_HEAD(pf_state_tree_id, pf_state); @@ -256,6 +299,214 @@ struct pf_state_list { .pfs_rwl = RWLOCK_INITIALIZER("pfstates"), \ } +/* + * State limiter + */ + +struct pf_statelim { + RBT_ENTRY(pf_statelim) pfstlim_id_tree; + RBT_ENTRY(pf_statelim) pfstlim_nm_tree; + TAILQ_ENTRY(pf_statelim) pfstlim_list; + struct kstat *pfstlim_ks; + + uint32_t pfstlim_id; + char pfstlim_nm[PF_STATELIM_NAME_LEN]; + + /* config */ + + unsigned int pfstlim_limit; + struct { + unsigned int limit; + unsigned int seconds; + } pfstlim_rate; + + /* run state */ + struct pc_lock pfstlim_lock; + + /* rate limiter */ + uint64_t pfstlim_rate_ts; + uint64_t pfstlim_rate_token; + uint64_t pfstlim_rate_bucket; + + unsigned int pfstlim_inuse; + struct pf_state_link_list pfstlim_states; + + /* counters */ + + struct { + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; + } pfstlim_counters; + + struct { + time_t created; + time_t updated; + time_t cleared; + } pfstlim_timestamps; +}; + +RBT_HEAD(pf_statelim_id_tree, pf_statelim); +RBT_PROTOTYPE(pf_statelim_id_tree, pf_statelim, pfstlim_id_tree, cmp); + +RBT_HEAD(pf_statelim_nm_tree, pf_statelim); +RBT_PROTOTYPE(pf_statelim_nm_tree, pf_statelim, pfstlim_nm_tree, cmp); + +TAILQ_HEAD(pf_statelim_list, pf_statelim); + +extern struct pf_statelim_id_tree pf_statelim_id_tree_active; +extern struct pf_statelim_list pf_statelim_list_active; + +extern struct pf_statelim_id_tree pf_statelim_id_tree_inactive; +extern struct pf_statelim_nm_tree pf_statelim_nm_tree_inactive; +extern struct pf_statelim_list pf_statelim_list_inactive; + +static inline unsigned int +pf_statelim_enter(struct pf_statelim *pfstlim) +{ + return (pc_sprod_enter(&pfstlim->pfstlim_lock)); +} + +static inline void +pf_statelim_leave(struct pf_statelim *pfstlim, unsigned int gen) +{ + pc_sprod_leave(&pfstlim->pfstlim_lock, gen); +} + +/* + * Source address pools + */ + +struct pf_sourcelim; + +struct pf_source { + RBT_ENTRY(pf_source) pfsr_tree; + RBT_ENTRY(pf_source) pfsr_ioc_tree; + struct pf_sourcelim *pfsr_parent; + + sa_family_t pfsr_af; + u_int16_t pfsr_rdomain; + struct pf_addr pfsr_addr; + + /* run state */ + + unsigned int pfsr_inuse; + unsigned int pfsr_intable; + struct pf_state_link_list pfsr_states; + time_t pfsr_empty_ts; + TAILQ_ENTRY(pf_source) pfsr_empty_gc; + + /* rate limiter */ + uint64_t pfsr_rate_ts; + + struct { + uint64_t admitted; + uint64_t hardlimited; + uint64_t ratelimited; + } pfsr_counters; +}; + +RBT_HEAD(pf_source_tree, pf_source); +RBT_PROTOTYPE(pf_source_tree, pf_source, pfsr_tree, cmp); + +RBT_HEAD(pf_source_ioc_tree, pf_source); +RBT_PROTOTYPE(pf_source_ioc_tree, pf_source, pfsr_ioc_tree, cmp); + +TAILQ_HEAD(pf_source_list, pf_source); + +struct pf_sourcelim { + RBT_ENTRY(pf_sourcelim) pfsrlim_id_tree; + RBT_ENTRY(pf_sourcelim) pfsrlim_nm_tree; + TAILQ_ENTRY(pf_sourcelim) pfsrlim_list; + struct kstat *pfsrlim_ks; + + uint32_t pfsrlim_id; + char pfsrlim_nm[PF_SOURCELIM_NAME_LEN]; + unsigned int pfsrlim_disabled; + + /* config */ + + unsigned int pfsrlim_entries; + unsigned int pfsrlim_limit; + unsigned int pfsrlim_ipv4_prefix; + unsigned int pfsrlim_ipv6_prefix; + + struct { + unsigned int limit; + unsigned int seconds; + } pfsrlim_rate; + + struct { + char name[PF_TABLE_NAME_SIZE]; + unsigned int hwm; + unsigned int lwm; + struct pfr_ktable *table; + } pfsrlim_overload; + + /* run state */ + struct pc_lock pfsrlim_lock; + + struct pf_addr pfsrlim_ipv4_mask; + struct pf_addr pfsrlim_ipv6_mask; + + uint64_t pfsrlim_rate_token; + uint64_t pfsrlim_rate_bucket; + + /* number of pf_sources */ + unsigned int pfsrlim_nsources; + struct pf_source_tree pfsrlim_sources; + struct pf_source_ioc_tree pfsrlim_ioc_sources; + + struct { + /* number of times pf_source was allocated */ + uint64_t addrallocs; + /* state was rejected because the address limit was hit */ + uint64_t addrlimited; + /* no memory to create address thing */ + uint64_t addrnomem; + + /* sum of pf_source inuse gauges */ + uint64_t inuse; + /* sum of pf_source admitted counters */ + uint64_t admitted; + /* sum of pf_source hardlimited counters */ + uint64_t hardlimited; + /* sum of pf_source ratelimited counters */ + uint64_t ratelimited; + } pfsrlim_counters; +}; + +RBT_HEAD(pf_sourcelim_id_tree, pf_sourcelim); +RBT_PROTOTYPE(pf_sourcelim_id_tree, pf_sourcelim, pfsrlim_id_tree, cmp); + +RBT_HEAD(pf_sourcelim_nm_tree, pf_sourcelim); +RBT_PROTOTYPE(pf_sourcelim_nm_tree, pf_sourcelim, pfsrlim_nm_tree, cmp); + +TAILQ_HEAD(pf_sourcelim_list, pf_sourcelim); + +extern struct pf_sourcelim_id_tree pf_sourcelim_id_tree_active; +extern struct pf_sourcelim_list pf_sourcelim_list_active; + +extern struct pf_sourcelim_id_tree pf_sourcelim_id_tree_inactive; +extern struct pf_sourcelim_nm_tree pf_sourcelim_nm_tree_inactive; +extern struct pf_sourcelim_list pf_sourcelim_list_inactive; + +static inline unsigned int +pf_sourcelim_enter(struct pf_sourcelim *pfsrlim) +{ + return (pc_sprod_enter(&pfsrlim->pfsrlim_lock)); +} + +static inline void +pf_sourcelim_leave(struct pf_sourcelim *pfsrlim, unsigned int gen) +{ + pc_sprod_leave(&pfsrlim->pfsrlim_lock, gen); +} + +/* + * pf internals + */ + extern struct rwlock pf_lock; struct pf_pdesc { @@ -429,6 +680,10 @@ u_int16_t pf_pkt_hash(sa_family_t, uint8_t, const struct pf_addr *, const struct pf_addr *, uint16_t, uint16_t); +void pf_status_init(void); +void pf_status_clear(void); +void pf_status_read(struct pf_status *); + #endif /* _KERNEL */ #endif /* _NET_PFVAR_PRIV_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211.h b/lib/libc/include/generic-openbsd/net80211/ieee80211.h index 12e9748e9f..ab4838200f 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211.h,v 1.64 2025/08/04 11:39:50 stsp Exp $ */ +/* $OpenBSD: ieee80211.h,v 1.66 2026/03/29 21:16:21 kirill Exp $ */ /* $NetBSD: ieee80211.h,v 1.6 2004/04/30 23:51:53 dyoung Exp $ */ /*- @@ -454,9 +454,16 @@ enum { IEEE80211_ELEMID_QUIET_CHNL = 198, /* 11ac */ IEEE80211_ELEMID_OPMODE_NOTIF = 199, /* 11ac */ /* 200-220 reserved */ - IEEE80211_ELEMID_VENDOR = 221 /* vendor private */ - /* 222-255 reserved */ + IEEE80211_ELEMID_VENDOR = 221, /* vendor private */ + /* 222-254 reserved */ + IEEE80211_ELEMID_EXTENSION = 255 /* Extension */ }; +/* + * Extension element IDs + * Used with IEEE80211_ELEMID_EXTENSION (255) + */ +#define IEEE80211_ELEMID_EXT_HECAPS 35 /* 11ax HE Capabilities */ +#define IEEE80211_ELEMID_EXT_HEOP 36 /* 11ax HE Operation */ /* * Action field category values (see 802.11-2012 8.4.1.11 Table 8-38). @@ -518,6 +525,7 @@ enum { #define IEEE80211_HT_NUM_MCS 77 #define IEEE80211_VHT_NUM_MCS 10 +#define IEEE80211_HE_NUM_MCS 12 /* * BlockAck/BlockAckReq Control field (see 802.11-2012 8.3.1.9 Figure 8-25). @@ -712,7 +720,8 @@ enum { #define IEEE80211_HTOP1_NONGF_STA 0x0004 /* Bit 3 is reserved. */ #define IEEE80211_HTOP1_OBSS_NONHT_STA 0x0010 -/* Bits 5-15 are reserved. */ +#define IEEE80211_HTOP1_CCFS2_SHIFT 5 +#define IEEE80211_HTOP1_CCFS2_MASK 0x1fe0 /* Bytes 4-5. */ /* Bits 0-5 are reserved. */ #define IEEE80211_HTOP2_DUALBEACON 0x0040 @@ -768,6 +777,8 @@ enum { #define IEEE80211_VHTCAP_LINK_ADAPT_MRQ_MFB 3 #define IEEE80211_VHTCAP_RX_ANT_PATTERN 0x10000000 #define IEEE80211_VHTCAP_TX_ANT_PATTERN 0x20000000 +#define IEEE80211_VHTCAP_EXT_NSS_BW_SHIFT 30 +#define IEEE80211_VHTCAP_EXT_NSS_BW_MASK 0xc0000000 /* * VHT-MCS and NSS map (see 802.11ac-2013 8.4.2.160.3, Figure 8-401bs). @@ -784,6 +795,7 @@ enum { #define IEEE80211_VHT_MAX_LGI_MBIT_S_MASK 0x1fff #define IEEE80211_VHT_MAX_LGI_MBIT_S_SHIFT 0 +#define IEEE80211_VHT_EXT_NSS_BW_CAPABLE (1 << 13) /* The highest number of spatial streams supported by VHT. */ #define IEEE80211_VHT_NUM_SS 8 @@ -801,6 +813,66 @@ enum { /* Byte 1 contains channel center frequency index 0 for 80, 80+80, 160 MHz. */ /* Byte 2 contains channel center frequency index 1 for 80+80 MHz only. */ + +/* + * 802.11ax (HE) definitions. + */ + +/* HE Capabilities element fixed fields */ +#define IEEE80211_HE_MAC_CAPS_LEN 6 +#define IEEE80211_HE_PHY_CAPS_LEN 11 +#define IEEE80211_HE_CAPS_FIXED_LEN (IEEE80211_HE_MAC_CAPS_LEN + \ + IEEE80211_HE_PHY_CAPS_LEN) + +/* HE Tx/Rx MCS NSS Support field size for 80 MHz */ +#define IEEE80211_HE_MCS_NSS_80_LEN 4 + +/* Minimum length of the HE Capabilities element body (includes Ext ID) */ +#define IEEE80211_HE_CAPS_MINLEN (1 + IEEE80211_HE_CAPS_FIXED_LEN + \ + IEEE80211_HE_MCS_NSS_80_LEN) + +/* + * Selected HE PHY capability bits (phy_cap_info[0]) + * These are used to determine the presence of additional MCS/NSS maps. + */ +#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_IN_2G 0x02 +#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_40_80_IN_5G 0x04 +#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G 0x08 +#define IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G 0x10 + +/* + * Size of the HE Tx/Rx MCS NSS Support field, in bytes, for a given + * HE PHY capabilities byte 0. + */ +#define IEEE80211_HE_MCS_NSS_SIZE(_phycap0) (IEEE80211_HE_MCS_NSS_80_LEN + \ + ((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_160_IN_5G) ? 4 : 0)) + \ + ((((_phycap0) & IEEE80211_HE_PHYCAP0_CHAN_WIDTH_8080_IN_5G) ? 4 : 0))) + +/* + * HE MCS and NSS map (HE-MCS/NSS set) + * + * Set of HE MCS supported for a given number of spatial streams, `n'. + * Used by the HE capabilities IE and by the basic HE MCS set in + * the HE operation IE. + */ +#define IEEE80211_HE_MCS_FOR_SS_MASK(n) (0x3 << (2 * ((n) - 1))) +#define IEEE80211_HE_MCS_FOR_SS_SHIFT(n) (2 * ((n) - 1)) +#define IEEE80211_HE_MCS_0_7 0 +#define IEEE80211_HE_MCS_0_9 1 +#define IEEE80211_HE_MCS_0_11 2 +#define IEEE80211_HE_MCS_SS_NOT_SUPP 3 + +/* The highest number of spatial streams supported by HE */ +#define IEEE80211_HE_NUM_SS 8 + +/* + * HE Operation element fixed fields (not including the Ext ID byte) + */ +#define IEEE80211_HEOP_PARAMS_LEN 4 +#define IEEE80211_HEOP_BASIC_MCS_LEN 2 +#define IEEE80211_HEOP_FIXED_LEN (IEEE80211_HEOP_PARAMS_LEN + \ + IEEE80211_HEOP_BASIC_MCS_LEN) + /* * EDCA Access Categories. */ diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h index f6a31ee3ff..9221d2afd7 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_ioctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_ioctl.h,v 1.44 2025/03/22 07:24:08 kevlo Exp $ */ +/* $OpenBSD: ieee80211_ioctl.h,v 1.45 2026/03/26 12:15:01 kirill Exp $ */ /* $NetBSD: ieee80211_ioctl.h,v 1.7 2004/04/30 22:51:04 dyoung Exp $ */ /*- @@ -385,9 +385,10 @@ struct ieee80211_nodereq { #define IEEE80211_NODEREQ_ASSOCFAIL_BSSID 0x20 #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_PROTO 0x40 #define IEEE80211_NODEREQ_ASSOCFAIL_WPA_KEY 0x80 +#define IEEE80211_NODEREQ_ASSOCFAIL_CSA 0x100 #define IEEE80211_NODEREQ_ASSOCFAIL_BITS \ "\20\1!CHAN\2!IBSS\3!PRIVACY\4!BASICRATE\5!ESSID\6!BSSID\7!WPAPROTO" \ - "\10!WPAKEY" + "\10!WPAKEY\11!CSA" /* get the entire node cache */ struct ieee80211_nodereq_all { diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h index bdf413bb2d..30b74d46ca 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.97 2025/08/01 20:39:26 stsp Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.101 2026/03/29 21:16:21 kirill Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -370,6 +370,20 @@ struct ieee80211_node { uint8_t ni_vht_chan_center_freq_idx1; uint16_t ni_vht_basic_mcs; + /* HE capabilities */ + uint8_t ni_he_mac_cap[IEEE80211_HE_MAC_CAPS_LEN]; + uint8_t ni_he_phy_cap[IEEE80211_HE_PHY_CAPS_LEN]; + uint16_t ni_he_rxmcs_80; + uint16_t ni_he_txmcs_80; + uint16_t ni_he_rxmcs_160; + uint16_t ni_he_txmcs_160; + uint16_t ni_he_rxmcs_80p80; + uint16_t ni_he_txmcs_80p80; + + /* HE operation */ + uint8_t ni_he_oper_params[IEEE80211_HEOP_PARAMS_LEN]; + uint16_t ni_he_basic_mcs; + /* Timeout handlers which trigger Tx Block Ack negotiation. */ struct timeout ni_addba_req_to[IEEE80211_NUM_TID]; int ni_addba_req_intval[IEEE80211_NUM_TID]; @@ -381,6 +395,7 @@ struct ieee80211_node { int ni_txmcs; /* current MCS used for TX */ int ni_vht_ss; /* VHT # spatial streams */ + int ni_he_ss; /* HE # spatial streams */ /* others */ u_int16_t ni_associd; /* assoc response */ @@ -398,6 +413,7 @@ struct ieee80211_node { #define IEEE80211_NODE_ASSOCFAIL_BSSID 0x20 #define IEEE80211_NODE_ASSOCFAIL_WPA_PROTO 0x40 #define IEEE80211_NODE_ASSOCFAIL_WPA_KEY 0x80 +#define IEEE80211_NODE_ASSOCFAIL_CSA 0x100 int ni_inact; /* inactivity mark count */ int ni_txrate; /* index to ni_rates[] */ @@ -427,6 +443,9 @@ struct ieee80211_node { #define IEEE80211_NODE_VHTCAP 0x40000 /* claims to support VHT */ #define IEEE80211_NODE_VHT_SGI80 0x80000 /* SGI on 80 MHz negotiated */ #define IEEE80211_NODE_VHT_SGI160 0x100000 /* SGI on 160 MHz negotiated */ +#define IEEE80211_NODE_HE 0x200000 /* HE negotiated */ +#define IEEE80211_NODE_HECAP 0x400000 /* claims to support HE */ +#define IEEE80211_NODE_CSA 0x800000 /* channel switch announced */ /* If not NULL, this function gets called when ni_refcnt hits zero. */ void (*ni_unref_cb)(struct ieee80211com *, @@ -590,7 +609,11 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni) cap_chan_width = (ni->ni_vhtcaps & IEEE80211_VHTCAP_CHAN_WIDTH_MASK) >> IEEE80211_VHTCAP_CHAN_WIDTH_SHIFT; - if (cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160) + if (cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160 && + cap_chan_width != IEEE80211_VHTCAP_CHAN_WIDTH_160_8080 && + ((ni->ni_vhtcaps & IEEE80211_VHTCAP_EXT_NSS_BW_MASK) == 0 || + (ni->ni_vht_tx_max_lgi_mbit_s & + IEEE80211_VHT_EXT_NSS_BW_CAPABLE) == 0)) return 0; op_chan_width = (ni->ni_vht_chan_width & @@ -600,6 +623,23 @@ ieee80211_node_supports_vht_chan160(struct ieee80211_node *ni) return (op_chan_width == IEEE80211_VHTOP0_CHAN_WIDTH_160); } +/* + * Check if the peer supports HE. + * Require a HE capabilities IE and support for HE MCS with a single + * spatial stream. + */ +static inline int +ieee80211_node_supports_he(struct ieee80211_node *ni) +{ + uint16_t rx_mcs; + + rx_mcs = (ni->ni_he_rxmcs_80 & IEEE80211_HE_MCS_FOR_SS_MASK(1)) >> + IEEE80211_HE_MCS_FOR_SS_SHIFT(1); + + return ((ni->ni_flags & IEEE80211_NODE_HECAP) && + rx_mcs != IEEE80211_HE_MCS_SS_NOT_SUPP); +} + struct ieee80211com; typedef void ieee80211_iter_func(void *, struct ieee80211_node *); @@ -642,6 +682,11 @@ void ieee80211_setup_vhtcaps(struct ieee80211_node *, const uint8_t *, void ieee80211_clear_vhtcaps(struct ieee80211_node *); int ieee80211_setup_vhtop(struct ieee80211_node *, const uint8_t *, uint8_t, int); +void ieee80211_setup_hecaps(struct ieee80211_node *, const uint8_t *, + uint8_t); +void ieee80211_clear_hecaps(struct ieee80211_node *); +int ieee80211_setup_heop(struct ieee80211_node *, const uint8_t *, + uint8_t, int); int ieee80211_setup_rates(struct ieee80211com *, struct ieee80211_node *, const u_int8_t *, const u_int8_t *, int); enum ieee80211_phymode ieee80211_node_abg_mode(struct ieee80211com *, @@ -656,6 +701,7 @@ void ieee80211_node_join(struct ieee80211com *, void ieee80211_node_leave(struct ieee80211com *, struct ieee80211_node *); int ieee80211_match_bss(struct ieee80211com *, struct ieee80211_node *, int); +void ieee80211_node_switch_bss(struct ieee80211com *, struct ieee80211_node *); void ieee80211_node_tx_stopped(struct ieee80211com *, struct ieee80211_node *); struct ieee80211_node *ieee80211_node_choose_bss(struct ieee80211com *, int, struct ieee80211_node **); diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_proto.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_proto.h index 46443677ce..ddd01c5f2c 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_proto.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_proto.h,v 1.50 2025/06/14 08:46:34 jsg Exp $ */ +/* $OpenBSD: ieee80211_proto.h,v 1.51 2026/03/19 16:50:32 chris Exp $ */ /* $NetBSD: ieee80211_proto.h,v 1.3 2003/10/13 04:23:56 dyoung Exp $ */ /*- @@ -137,6 +137,7 @@ extern u_int8_t *ieee80211_add_xrates(u_int8_t *, extern u_int8_t *ieee80211_add_htcaps(u_int8_t *, struct ieee80211com *); extern u_int8_t *ieee80211_add_htop(u_int8_t *, struct ieee80211com *); extern u_int8_t *ieee80211_add_vhtcaps(u_int8_t *, struct ieee80211com *); +extern u_int8_t *ieee80211_add_hecaps(u_int8_t *, struct ieee80211com *); extern u_int8_t *ieee80211_add_tie(u_int8_t *, u_int8_t, u_int32_t); extern int ieee80211_parse_rsn(struct ieee80211com *, const u_int8_t *, @@ -169,6 +170,8 @@ extern void ieee80211_ht_negotiate(struct ieee80211com *, struct ieee80211_node *); extern void ieee80211_vht_negotiate(struct ieee80211com *, struct ieee80211_node *); +extern void ieee80211_he_negotiate(struct ieee80211com *, + struct ieee80211_node *); extern void ieee80211_tx_ba_timeout(void *); extern void ieee80211_rx_ba_timeout(void *); extern int ieee80211_addba_request(struct ieee80211com *, diff --git a/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h b/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h index 6b03767eae..3311152aaa 100644 --- a/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h +++ b/lib/libc/include/generic-openbsd/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.112 2025/08/01 20:39:26 stsp Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.114 2026/03/19 16:50:32 chris Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -92,8 +92,9 @@ enum ieee80211_phymode { IEEE80211_MODE_11G = 3, /* 2GHz, OFDM */ IEEE80211_MODE_11N = 4, /* 2GHz/5GHz, OFDM/HT */ IEEE80211_MODE_11AC = 5, /* 5GHz, OFDM/VHT */ + IEEE80211_MODE_11AX = 6, /* 2GHz/5GHz, OFDM/HE */ }; -#define IEEE80211_MODE_MAX (IEEE80211_MODE_11AC+1) +#define IEEE80211_MODE_MAX (IEEE80211_MODE_11AX+1) enum ieee80211_opmode { IEEE80211_M_STA = 1, /* infrastructure station */ @@ -142,6 +143,7 @@ struct ieee80211_channel { */ #define IEEE80211_CHANX_80MHZ 0x00000001 /* use of 80 MHz is allowed */ #define IEEE80211_CHANX_160MHZ 0x00000002 /* use of 160 MHz is allowed */ +#define IEEE80211_CHANX_HE 0x00000004 /* 11ax/HE channel */ /* * Useful combinations of channel characteristics. @@ -185,6 +187,8 @@ struct ieee80211_channel { (((_c)->ic_xflags & IEEE80211_CHANX_80MHZ) != 0) #define IEEE80211_CHAN_160MHZ_ALLOWED(_c) \ (((_c)->ic_xflags & IEEE80211_CHANX_160MHZ) != 0) +#define IEEE80211_CHAN_HE(_c) \ + (((_c)->ic_xflags & IEEE80211_CHANX_HE) != 0) /* * EDCA AC parameters. @@ -337,6 +341,8 @@ struct ieee80211com { */ struct ieee80211_edca_ac_params ic_edca_ac[EDCA_NUM_AC]; u_int ic_edca_updtcount; + u_int ic_edca_txop_count[EDCA_NUM_AC]; + struct timeval ic_edca_txop_time[EDCA_NUM_AC]; u_int16_t ic_tid_noack; u_int8_t ic_globalcnt[EAPOL_KEY_NONCE_LEN]; u_int8_t ic_nonce[EAPOL_KEY_NONCE_LEN]; @@ -383,6 +389,15 @@ struct ieee80211com { uint16_t ic_vht_txmcs; uint16_t ic_vht_tx_max_lgi_mbit_s; + u_int8_t ic_he_mac_cap[IEEE80211_HE_MAC_CAPS_LEN]; + u_int8_t ic_he_phy_cap[IEEE80211_HE_PHY_CAPS_LEN]; + uint16_t ic_he_rxmcs_80; + uint16_t ic_he_txmcs_80; + uint16_t ic_he_rxmcs_160; + uint16_t ic_he_txmcs_160; + uint16_t ic_he_rxmcs_80p80; + uint16_t ic_he_txmcs_80p80; + TAILQ_HEAD(, ieee80211_ess) ic_ess; }; #define ic_if ic_ac.ac_if @@ -440,6 +455,7 @@ struct ieee80211_ess { #define IEEE80211_F_BGSCAN 0x08000000 /* STATUS: background scan */ #define IEEE80211_F_AUTO_JOIN 0x10000000 /* CONF: auto-join active */ #define IEEE80211_F_VHTON 0x20000000 /* CONF: VHT enabled */ +#define IEEE80211_F_HEON 0x40000000 /* CONF: HE enabled */ /* ic_xflags */ #define IEEE80211_F_TX_MGMT_ONLY 0x00000001 /* leave data frames on ifq */ diff --git a/lib/libc/include/generic-openbsd/netinet/if_ether.h b/lib/libc/include/generic-openbsd/netinet/if_ether.h index 35eab71804..2c0cd79dc9 100644 --- a/lib/libc/include/generic-openbsd/netinet/if_ether.h +++ b/lib/libc/include/generic-openbsd/netinet/if_ether.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ether.h,v 1.96 2025/07/07 00:55:15 jsg Exp $ */ +/* $OpenBSD: if_ether.h,v 1.99 2025/12/02 03:24:19 dlg Exp $ */ /* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */ /* @@ -220,12 +220,12 @@ do { \ #include /* for "struct ifnet" */ -struct ether_brport { - struct mbuf *(*eb_input)(struct ifnet *, struct mbuf *, +struct ether_port { + struct mbuf *(*ep_input)(struct ifnet *, struct mbuf *, uint64_t, void *, struct netstack *); - void (*eb_port_take)(void *); - void (*eb_port_rele)(void *); - void *eb_port; + void *(*ep_port_take)(void *); + void (*ep_port_rele)(void *, void *); + void *ep_port; }; /* @@ -241,8 +241,8 @@ struct arpcom { int ac_multicnt; /* length of ac_multiaddrs */ int ac_multirangecnt; /* number of mcast ranges */ - void *ac_trunkport; - const struct ether_brport *ac_brport; + const struct ether_port *ac_trport; + const struct ether_port *ac_brport; }; extern int arpt_keep; /* arp resolved cache expire */ @@ -289,11 +289,11 @@ void ether_rtrequest(struct ifnet *, int, struct rtentry *); char *ether_sprintf(u_char *); int ether_brport_isset(struct ifnet *); -void ether_brport_set(struct ifnet *, const struct ether_brport *); +void ether_brport_set(struct ifnet *, const struct ether_port *); void ether_brport_clr(struct ifnet *); -const struct ether_brport * +const struct ether_port * ether_brport_get(struct ifnet *); -const struct ether_brport * +const struct ether_port * ether_brport_get_locked(struct ifnet *); uint64_t ether_addr_to_e64(const struct ether_addr *); @@ -313,6 +313,7 @@ struct ether_extracted { }; void ether_extract_headers(struct mbuf *, struct ether_extracted *); +struct mbuf *ether_offload_ifcap(struct ifnet *, struct mbuf *); /* * Ethernet multicast address structure. There is one of these for each diff --git a/lib/libc/include/generic-openbsd/netinet/igmp_var.h b/lib/libc/include/generic-openbsd/netinet/igmp_var.h index 06624e9aa4..86f33c0799 100644 --- a/lib/libc/include/generic-openbsd/netinet/igmp_var.h +++ b/lib/libc/include/generic-openbsd/netinet/igmp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: igmp_var.h,v 1.16 2025/03/02 21:28:32 bluhm Exp $ */ +/* $OpenBSD: igmp_var.h,v 1.17 2026/02/26 00:53:18 bluhm Exp $ */ /* $NetBSD: igmp_var.h,v 1.9 1996/02/13 23:41:31 christos Exp $ */ /* @@ -105,12 +105,26 @@ igmpstat_inc(enum igmpstat_counters c) */ #define IGMP_RANDOM_DELAY(X) (arc4random_uniform(X) + 1) +struct igmp_pktinfo { + STAILQ_ENTRY(igmp_pktinfo) ipi_list; + struct in_addr ipi_addr; + unsigned int ipi_rdomain; + unsigned int ipi_ifidx; + int ipi_type; +}; +STAILQ_HEAD(igmp_pktlist, igmp_pktinfo); + void igmp_init(void); int igmp_input(struct mbuf **, int *, int, int, struct netstack *); -void igmp_joingroup(struct in_multi *, struct ifnet *); -void igmp_leavegroup(struct in_multi *, struct ifnet *); +void igmp_joingroup(struct in_multi *, struct ifnet *, + struct igmp_pktinfo *); +void igmp_leavegroup(struct in_multi *, struct ifnet *, + struct igmp_pktinfo *); void igmp_fasttimo(void); void igmp_slowtimo(void); int igmp_sysctl(int *, u_int, void *, size_t *, void *, size_t); +void igmp_sendpkt(struct igmp_pktinfo *); + #endif /* _KERNEL */ + #endif /* _NETINET_IGMP_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/netinet/in_pcb.h b/lib/libc/include/generic-openbsd/netinet/in_pcb.h index 8bf9271b74..92376edd8d 100644 --- a/lib/libc/include/generic-openbsd/netinet/in_pcb.h +++ b/lib/libc/include/generic-openbsd/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.171 2025/07/14 09:01:52 jsg Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.174 2026/02/05 03:26:00 dlg Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -357,6 +357,7 @@ void in_setpeeraddr(struct inpcb *, struct mbuf *); void in_setsockaddr(struct inpcb *, struct mbuf *); int in_sockaddr(struct socket *, struct mbuf *); int in_peeraddr(struct socket *, struct mbuf *); +int in_flowid(struct socket *); int in_baddynamic(u_int16_t, u_int16_t); int in_rootonly(u_int16_t, u_int16_t); int in_pcbselsrc(struct in_addr *, const struct sockaddr_in *, diff --git a/lib/libc/include/generic-openbsd/netinet/in_var.h b/lib/libc/include/generic-openbsd/netinet/in_var.h index 9a419c296b..23f4cef8b2 100644 --- a/lib/libc/include/generic-openbsd/netinet/in_var.h +++ b/lib/libc/include/generic-openbsd/netinet/in_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_var.h,v 1.41 2018/10/18 15:23:04 cheloha Exp $ */ +/* $OpenBSD: in_var.h,v 1.47 2026/03/22 23:14:00 bluhm Exp $ */ /* $NetBSD: in_var.h,v 1.16 1996/02/13 23:42:15 christos Exp $ */ /* @@ -35,6 +35,12 @@ #ifndef _NETINET_IN_VAR_H_ #define _NETINET_IN_VAR_H_ +/* + * Locks used to protect struct members in this file: + * I immutable after creation + * m multicast if_maddrlock rwlock of parent interface + */ + #include #ifdef _KERNEL @@ -75,37 +81,9 @@ struct in_aliasreq { struct sockaddr_in ifra_mask; }; - -#ifdef _KERNEL -/* - * Macro for finding the internet address structure (in_ifaddr) corresponding - * to a given interface (ifnet structure). - */ -#define IFP_TO_IA(ifp, ia) \ - /* struct ifnet *ifp; */ \ - /* struct in_ifaddr *ia; */ \ -do { \ - struct ifaddr *ifa; \ - NET_ASSERT_LOCKED(); \ - TAILQ_FOREACH(ifa, &(ifp)->if_addrlist, ifa_list) { \ - if (ifa->ifa_addr->sa_family == AF_INET) \ - break; \ - } \ - (ia) = ifatoia(ifa); \ -} while (/* CONSTCOND */ 0) -#endif - -/* - * Per-interface router version information. - */ -struct router_info { - unsigned int rti_ifidx; - int rti_type; /* type of router on this interface */ - int rti_age; /* time since last v1 query */ - LIST_ENTRY(router_info) rti_list; -}; - #ifdef _KERNEL +struct router_info; + /* * Internet multicast address structure. There is one of these for each IP * multicast group to which this host belongs on a given network interface. @@ -115,11 +93,11 @@ struct in_multi { #define inm_refcnt inm_ifma.ifma_refcnt #define inm_ifidx inm_ifma.ifma_ifidx - struct sockaddr_in inm_sin; /* IPv4 multicast address */ + struct sockaddr_in inm_sin; /* [I] IPv4 multicast address */ #define inm_addr inm_sin.sin_addr - u_int inm_state; /* state of membership */ - u_int inm_timer; /* IGMP membership report timer */ + u_int inm_state; /* [m] state of membership */ + u_int inm_timer; /* [m] IGMP membership report */ struct router_info *inm_rti; /* router version info */ }; @@ -130,37 +108,17 @@ ifmatoinm(struct ifmaddr *ifma) return ((struct in_multi *)(ifma)); } -/* - * Macro for looking up the in_multi record for a given IP multicast - * address on a given interface. If no matching record is found, "inm" - * returns NULL. - */ -#define IN_LOOKUP_MULTI(addr, ifp, inm) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */ \ - /* struct in_multi *inm; */ \ -do { \ - struct ifmaddr *ifma; \ - \ - (inm) = NULL; \ - NET_ASSERT_LOCKED(); \ - TAILQ_FOREACH(ifma, &(ifp)->if_maddrlist, ifma_list) \ - if (ifma->ifma_addr->sa_family == AF_INET && \ - ifmatoinm(ifma)->inm_addr.s_addr == (addr).s_addr) {\ - (inm) = ifmatoinm(ifma); \ - break; \ - } \ -} while (/* CONSTCOND */ 0) - +struct in_ifaddr *in_ifp2ia(struct ifnet *); int in_ifinit(struct ifnet *, struct in_ifaddr *, struct sockaddr_in *, int); -struct in_multi *in_addmulti(struct in_addr *, struct ifnet *); +struct in_multi *in_lookupmulti(const struct in_addr *, struct ifnet *); +struct in_multi *in_addmulti(const struct in_addr *, struct ifnet *); void in_delmulti(struct in_multi *); -int in_hasmulti(struct in_addr *, struct ifnet *); +int in_hasmulti(const struct in_addr *, struct ifnet *); void in_ifscrub(struct ifnet *, struct in_ifaddr *); int in_control(struct socket *, u_long, caddr_t, struct ifnet *); int in_ioctl(u_long, caddr_t, struct ifnet *, int); void in_prefixlen2mask(struct in_addr *, int); -#endif +#endif /* _KERNEL */ #endif /* _NETINET_IN_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/netinet/ip.h b/lib/libc/include/generic-openbsd/netinet/ip.h index d4668ac424..b5d16b2df0 100644 --- a/lib/libc/include/generic-openbsd/netinet/ip.h +++ b/lib/libc/include/generic-openbsd/netinet/ip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip.h,v 1.20 2021/12/14 23:47:36 dtucker Exp $ */ +/* $OpenBSD: ip.h,v 1.22 2025/12/19 13:58:53 tb Exp $ */ /* $NetBSD: ip.h,v 1.9 1995/05/15 01:22:44 cgd Exp $ */ /* @@ -95,7 +95,7 @@ struct ip { #define IPTOS_PREC_ROUTINE 0x00 /* - * Definitions for DiffServ Codepoints as per RFCs 2474, 3246, 4594 & 8622. + * Definitions for DiffServ Codepoints as per RFCs 2474, 3246, 4594, 5865, 8622. * These are the 6 most significant bits as they appear on the wire, so the * two least significant bits must be zero. */ @@ -118,6 +118,7 @@ struct ip { #define IPTOS_DSCP_AF42 0x90 #define IPTOS_DSCP_AF43 0x98 #define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_VA 0xb0 #define IPTOS_DSCP_EF 0xb8 #define IPTOS_DSCP_CS6 0xc0 #define IPTOS_DSCP_CS7 0xe0 diff --git a/lib/libc/include/generic-openbsd/netinet/tcp_timer.h b/lib/libc/include/generic-openbsd/netinet/tcp_timer.h index d15427d2f9..1b45629b25 100644 --- a/lib/libc/include/generic-openbsd/netinet/tcp_timer.h +++ b/lib/libc/include/generic-openbsd/netinet/tcp_timer.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_timer.h,v 1.27 2025/06/08 17:06:19 bluhm Exp $ */ +/* $OpenBSD: tcp_timer.h,v 1.28 2025/12/31 03:47:04 jsg Exp $ */ /* $NetBSD: tcp_timer.h,v 1.6 1995/03/26 20:32:37 jtc Exp $ */ /* @@ -162,7 +162,6 @@ extern int tcp_keepintvl; /* [a] time between keepalive probes */ extern int tcp_keepinit_sec; /* [a] copy of above in seconds for sysctl */ extern int tcp_keepidle_sec; /* [a] copy of above in seconds for sysctl */ extern int tcp_keepintvl_sec; /* [a] copy of above in seconds for sysctl */ -extern int tcp_ttl; /* time to live for TCP segs */ extern const int tcp_backoff[]; #endif /* _KERNEL */ #endif /* _NETINET_TCP_TIMER_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/netinet6/in6_var.h b/lib/libc/include/generic-openbsd/netinet6/in6_var.h index c928f8f619..43705d9a02 100644 --- a/lib/libc/include/generic-openbsd/netinet6/in6_var.h +++ b/lib/libc/include/generic-openbsd/netinet6/in6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_var.h,v 1.81 2025/05/20 05:51:43 bluhm Exp $ */ +/* $OpenBSD: in6_var.h,v 1.85 2026/03/22 23:14:00 bluhm Exp $ */ /* $KAME: in6_var.h,v 1.55 2001/02/16 12:49:45 itojun Exp $ */ /* @@ -64,6 +64,12 @@ #ifndef _NETINET6_IN6_VAR_H_ #define _NETINET6_IN6_VAR_H_ +/* + * Locks used to protect struct members in this file: + * I immutable after creation + * m multicast if_maddrlock rwlock of parent interface + */ + /* * Interface address, Internet version. One of these structures * is allocated for each interface with an Internet address. @@ -316,11 +322,11 @@ struct in6_multi { #define in6m_refcnt in6m_ifma.ifma_refcnt #define in6m_ifidx in6m_ifma.ifma_ifidx - struct sockaddr_in6 in6m_sin; /* IPv6 multicast address */ + struct sockaddr_in6 in6m_sin; /* [I] IPv6 multicast address */ #define in6m_addr in6m_sin.sin6_addr - u_int in6m_state; /* state of membership */ - u_int in6m_timer; /* MLD6 membership report timer */ + u_int in6m_state; /* [m] state of membership */ + u_int in6m_timer; /* [m] MLD6 membership report */ }; static __inline struct in6_multi * @@ -329,32 +335,12 @@ ifmatoin6m(struct ifmaddr *ifma) return ((struct in6_multi *)(ifma)); } -/* - * Macros for looking up the in6_multi record for a given IP6 multicast - * address on a given interface. If no matching record is found, "in6m" - * returns NULL. - */ -#define IN6_LOOKUP_MULTI(addr, ifp, in6m) \ - /* struct in6_addr addr; */ \ - /* struct ifnet *ifp; */ \ - /* struct in6_multi *in6m; */ \ -do { \ - struct ifmaddr *ifma; \ - \ - (in6m) = NULL; \ - TAILQ_FOREACH(ifma, &(ifp)->if_maddrlist, ifma_list) \ - if (ifma->ifma_addr->sa_family == AF_INET6 && \ - IN6_ARE_ADDR_EQUAL(&ifmatoin6m(ifma)->in6m_addr, \ - &(addr))) { \ - (in6m) = ifmatoin6m(ifma); \ - break; \ - } \ -} while (/* CONSTCOND */ 0) - -struct in6_multi *in6_addmulti(struct in6_addr *, struct ifnet *, int *); +struct in6_multi *in6_lookupmulti(const struct in6_addr *, struct ifnet *); +struct in6_multi *in6_addmulti(const struct in6_addr *, struct ifnet *, int *); void in6_delmulti(struct in6_multi *); -int in6_hasmulti(struct in6_addr *, struct ifnet *); -struct in6_multi_mship *in6_joingroup(struct ifnet *, struct in6_addr *, int *); +int in6_hasmulti(const struct in6_addr *, struct ifnet *); +struct in6_multi_mship *in6_joingroup(struct ifnet *, const struct in6_addr *, + int *); void in6_leavegroup(struct in6_multi_mship *); int in6_control(struct socket *, u_long, caddr_t, struct ifnet *); int in6_ioctl(u_long, caddr_t, struct ifnet *, int); diff --git a/lib/libc/include/generic-openbsd/netinet6/ip6_var.h b/lib/libc/include/generic-openbsd/netinet6/ip6_var.h index e35c2be697..2a2112f567 100644 --- a/lib/libc/include/generic-openbsd/netinet6/ip6_var.h +++ b/lib/libc/include/generic-openbsd/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.128 2025/09/16 09:19:16 florian Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.129 2025/12/31 04:10:00 jsg Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -280,7 +280,6 @@ extern int ip6_defmcasthlim; /* default multicast hop limit */ extern int ip6_forwarding; /* act as router? */ extern int ip6_mforwarding; /* act as multicast router? */ extern int ip6_multipath; /* use multipath routes */ -extern int ip6_sendredirect; /* send ICMPv6 redirect? */ extern int ip6_mcast_pmtu; /* path MTU discovery for multicast */ extern int ip6_neighborgcthresh; /* Threshold # of NDP entries for GC */ extern int ip6_maxdynroutes; /* Max # of routes created via redirect */ diff --git a/lib/libc/include/generic-openbsd/netinet6/mld6_var.h b/lib/libc/include/generic-openbsd/netinet6/mld6_var.h index cd4feef7b3..8d053cbfe0 100644 --- a/lib/libc/include/generic-openbsd/netinet6/mld6_var.h +++ b/lib/libc/include/generic-openbsd/netinet6/mld6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mld6_var.h,v 1.6 2008/04/18 06:42:20 djm Exp $ */ +/* $OpenBSD: mld6_var.h,v 1.10 2026/02/26 00:53:18 bluhm Exp $ */ /* $KAME: mld6_var.h,v 1.4 2000/03/25 07:23:54 sumikawa Exp $ */ /* @@ -43,11 +43,24 @@ #define MLD_OTHERLISTENER 0 #define MLD_IREPORTEDLAST 1 +struct mld6_pktinfo { + STAILQ_ENTRY(mld6_pktinfo) mpi_list; + struct in6_addr mpi_addr; + unsigned int mpi_rdomain; + unsigned int mpi_ifidx; + int mpi_type; +}; +STAILQ_HEAD(mld6_pktlist, mld6_pktinfo); + void mld6_init(void); void mld6_input(struct mbuf *, int); -void mld6_start_listening(struct in6_multi *); -void mld6_stop_listening(struct in6_multi *); -void mld6_fasttimeo(void); +void mld6_start_listening(struct in6_multi *, struct ifnet *, + struct mld6_pktinfo *); +void mld6_stop_listening(struct in6_multi *, struct ifnet *, + struct mld6_pktinfo *); +void mld6_fasttimo(void); +void mld6_sendpkt(const struct mld6_pktinfo *); + #endif /* _KERNEL */ #endif /* _NETINET6_MLD6_VAR_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/netinet6/nd6.h b/lib/libc/include/generic-openbsd/netinet6/nd6.h index 9a490a9afb..d2c8f2ab77 100644 --- a/lib/libc/include/generic-openbsd/netinet6/nd6.h +++ b/lib/libc/include/generic-openbsd/netinet6/nd6.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.h,v 1.105 2025/09/16 09:19:43 florian Exp $ */ +/* $OpenBSD: nd6.h,v 1.106 2026/03/23 13:12:39 jsg Exp $ */ /* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */ /* @@ -83,7 +83,7 @@ struct llinfo_nd6 { TAILQ_ENTRY(llinfo_nd6) ln_list; /* [m] global nd6_list */ struct rtentry *ln_rt; /* [I] backpointer to rtentry */ /* keep fields above in sync with struct llinfo_nd6_iterator */ - struct refcnt ln_refcnt; /* entry refereced by list */ + struct refcnt ln_refcnt; /* entry referenced by list */ struct mbuf_queue ln_mq; /* hold packets until resolved */ struct in6_addr ln_saddr6; /* source of prompting packet */ long ln_asked; /* number of queries already sent for addr */ diff --git a/lib/libc/include/generic-openbsd/pthread.h b/lib/libc/include/generic-openbsd/pthread.h index 14141e3992..570545b973 100644 --- a/lib/libc/include/generic-openbsd/pthread.h +++ b/lib/libc/include/generic-openbsd/pthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread.h,v 1.4 2018/03/05 01:15:26 deraadt Exp $ */ +/* $OpenBSD: pthread.h,v 1.5 2025/11/11 18:54:05 semarie Exp $ */ /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu @@ -50,7 +50,7 @@ * Run-time invariant values: */ #define PTHREAD_DESTRUCTOR_ITERATIONS 4 -#define PTHREAD_KEYS_MAX 256 +#define PTHREAD_KEYS_MAX 512 #define PTHREAD_STACK_MIN (1U << _MAX_PAGE_SHIFT) #define PTHREAD_THREADS_MAX ULONG_MAX diff --git a/lib/libc/include/generic-openbsd/signal.h b/lib/libc/include/generic-openbsd/signal.h index 0ab0dbb2e9..c58710e945 100644 --- a/lib/libc/include/generic-openbsd/signal.h +++ b/lib/libc/include/generic-openbsd/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.26 2018/05/30 13:20:38 bluhm Exp $ */ +/* $OpenBSD: signal.h,v 1.27 2026/03/23 21:33:43 daniel Exp $ */ /* $NetBSD: signal.h,v 1.8 1996/02/29 00:04:57 jtc Exp $ */ /*- @@ -132,7 +132,7 @@ int thrkill(pid_t _tid, int _signum, void *_tcb); int sigwait(const sigset_t *__restrict, int *__restrict); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 -void psignal(unsigned int, const char *); +void psignal(int, const char *); #endif #endif /* __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE */ __END_DECLS diff --git a/lib/libc/include/generic-openbsd/sndio.h b/lib/libc/include/generic-openbsd/sndio.h index cb7576053b..f87990f0e1 100644 --- a/lib/libc/include/generic-openbsd/sndio.h +++ b/lib/libc/include/generic-openbsd/sndio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sndio.h,v 1.15 2024/05/24 15:10:26 ratchov Exp $ */ +/* $OpenBSD: sndio.h,v 1.17 2026/01/22 09:31:22 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -27,17 +27,9 @@ /* * limits - * - * For now SIOCTL_DISPLAYMAX is 12 byte only. It nicely fits in the - * padding of the sioctl_desc structure: this allows any binary linked - * to the library version with no sioctl_desc->display to work with - * this library version. Currently, any string reported by the lower - * layers fits in the 12-byte buffer. Once larger strings start - * being used (or the ABI changes for any other reason) increase - * SIOCTL_DISPLAYMAX and properly pad the sioctl_desc structure. */ -#define SIOCTL_NAMEMAX 12 /* max name length */ -#define SIOCTL_DISPLAYMAX 12 /* max display string length */ +#define SIOCTL_NAMEMAX 16 /* max name length */ +#define SIOCTL_DISPLAYMAX 32 /* max display string length */ /* * private ``handle'' structure @@ -119,11 +111,12 @@ struct sioctl_desc { #define SIOCTL_LIST 5 /* switch, element of a list */ #define SIOCTL_SEL 6 /* element of a selector */ unsigned int type; /* one of above */ + unsigned int maxval; /* max value */ + int __pad[3]; /* for future use */ char func[SIOCTL_NAMEMAX]; /* function name, ex. "level" */ char group[SIOCTL_NAMEMAX]; /* group this control belongs to */ struct sioctl_node node0; /* affected node */ struct sioctl_node node1; /* dito for SIOCTL_{VEC,LIST,SEL} */ - unsigned int maxval; /* max value */ char display[SIOCTL_DISPLAYMAX]; /* free-format hint */ }; @@ -169,6 +162,7 @@ int sio_setpar(struct sio_hdl *, struct sio_par *); int sio_getpar(struct sio_hdl *, struct sio_par *); int sio_getcap(struct sio_hdl *, struct sio_cap *); void sio_onmove(struct sio_hdl *, void (*)(void *, int), void *); +void sio_onxrun(struct sio_hdl *, void (*)(void *), void *); size_t sio_write(struct sio_hdl *, const void *, size_t); size_t sio_read(struct sio_hdl *, void *, size_t); int sio_start(struct sio_hdl *); diff --git a/lib/libc/include/generic-openbsd/strings.h b/lib/libc/include/generic-openbsd/strings.h index 5656d59383..f2e6ea006e 100644 --- a/lib/libc/include/generic-openbsd/strings.h +++ b/lib/libc/include/generic-openbsd/strings.h @@ -1,4 +1,4 @@ -/* $OpenBSD: strings.h,v 1.6 2017/09/10 21:50:36 schwarze Exp $ */ +/* $OpenBSD: strings.h,v 1.7 2025/10/24 11:30:06 claudio Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -78,6 +78,10 @@ int strncasecmp(const char *, const char *, size_t); int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif +#if __POSIX_VISIBLE >= 202405 +int ffsl(long); +int ffsll(long long); +#endif __END_DECLS #endif /* _STRINGS_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/sys/device.h b/lib/libc/include/generic-openbsd/sys/device.h index 58468d7f22..6968593939 100644 --- a/lib/libc/include/generic-openbsd/sys/device.h +++ b/lib/libc/include/generic-openbsd/sys/device.h @@ -1,4 +1,4 @@ -/* $OpenBSD: device.h,v 1.70 2025/09/16 12:18:10 hshoexer Exp $ */ +/* $OpenBSD: device.h,v 1.71 2026/03/11 16:18:42 kettenis Exp $ */ /* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */ /* @@ -204,8 +204,9 @@ void config_process_deferred_mountroot(void); int request_sleep(int); int sleep_state(void *, int); -#define SLEEP_SUSPEND 0x01 -#define SLEEP_HIBERNATE 0x02 +#define SLEEP_RESUME 0 +#define SLEEP_SUSPEND 1 +#define SLEEP_HIBERNATE 2 void sleep_mp(void); void resume_mp(void); int sleep_showstate(void *v, int sleepmode); diff --git a/lib/libc/include/generic-openbsd/sys/disklabel.h b/lib/libc/include/generic-openbsd/sys/disklabel.h index a289bc7479..59f50c054d 100644 --- a/lib/libc/include/generic-openbsd/sys/disklabel.h +++ b/lib/libc/include/generic-openbsd/sys/disklabel.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disklabel.h,v 1.93 2025/09/17 10:16:09 deraadt Exp $ */ +/* $OpenBSD: disklabel.h,v 1.94 2025/11/13 20:59:14 deraadt Exp $ */ /* $NetBSD: disklabel.h,v 1.41 1996/05/10 23:07:37 mark Exp $ */ /* @@ -49,14 +49,26 @@ #include +/* + * The dev_t split has 64 partitions, but only 52 are visible + * and easily useable in userland (a-z and A-Z). + * The MD variable MAXPARTITIONS remains 52 (or less). + */ +#define MAXPARTITIONSUNIT 64 + +/* + * Various situations still have structures limited to 16 partitions. + */ +#define MAXPARTITIONS16 16 + /* * Translate between device numbers and major/disk unit/disk partition. */ -#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONS) -#define DISKPART(dev) (minor(dev) % MAXPARTITIONS) +#define DISKUNIT(dev) (minor(dev) / MAXPARTITIONSUNIT) +#define DISKPART(dev) (minor(dev) % MAXPARTITIONSUNIT) #define RAW_PART 2 /* 'c' partition */ #define DISKMINOR(unit, part) \ - (((unit) * MAXPARTITIONS) + (part)) + (((unit) * MAXPARTITIONSUNIT) + (part)) #define MAKEDISKDEV(maj, unit, part) \ (makedev((maj), DISKMINOR((unit), (part)))) #define DISKLABELDEV(dev) \ @@ -117,7 +129,7 @@ struct disklabel { u_int8_t p_fstype; /* filesystem type, see below */ u_int8_t p_fragblock; /* encoded filesystem frag/block */ u_int16_t p_cpg; /* UFS: FS cylinders per group */ - } d_partitions[MAXPARTITIONS]; /* actually may be more */ + } d_partitions[MAXPARTITIONSUNIT]; /* maximum 52 in use */ }; #endif /* _LOCORE */ diff --git a/lib/libc/include/generic-openbsd/sys/dkio.h b/lib/libc/include/generic-openbsd/sys/dkio.h index e283329b75..853dc8a447 100644 --- a/lib/libc/include/generic-openbsd/sys/dkio.h +++ b/lib/libc/include/generic-openbsd/sys/dkio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dkio.h,v 1.13 2025/09/17 10:24:25 deraadt Exp $ */ +/* $OpenBSD: dkio.h,v 1.14 2025/11/13 20:59:14 deraadt Exp $ */ /* $NetBSD: dkio.h,v 1.1 1996/01/30 18:21:48 thorpej Exp $ */ /* @@ -50,11 +50,9 @@ #define DIOCGPDINFO _IOR('d', 114, struct disklabel)/* get physical */ #define DIOCRLDINFO _IO('d', 115) /* reload disklabel */ -#if MAXPARTITIONS != 16 /* XXX temporary to support the transition to more partitions */ -#define O_sizeof_disklabel (offsetof(struct disklabel, d_partitions[16])) -#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_sizeof_disklabel) -#endif +#define O_disklabel offsetof(struct disklabel, d_partitions[MAXPARTITIONS16]) +#define O_DIOCGDINFO _IOC(IOC_OUT, 'd', 101, O_disklabel) struct dk_inquiry { char vendor[64]; diff --git a/lib/libc/include/generic-openbsd/sys/filedesc.h b/lib/libc/include/generic-openbsd/sys/filedesc.h index 77a2106961..92369e56ec 100644 --- a/lib/libc/include/generic-openbsd/sys/filedesc.h +++ b/lib/libc/include/generic-openbsd/sys/filedesc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: filedesc.h,v 1.48 2025/08/04 04:59:30 guenther Exp $ */ +/* $OpenBSD: filedesc.h,v 1.49 2026/03/08 16:41:19 deraadt Exp $ */ /* $NetBSD: filedesc.h,v 1.14 1996/04/09 20:55:28 cgd Exp $ */ /* @@ -114,8 +114,9 @@ struct filedesc0 { * Per-process open flags. */ #define UF_EXCLOSE 0x01 /* auto-close on exec */ -#define UF_PLEDGED 0x02 /* open after pledge(2) */ +#define UF_PLEDGED 0x02 /* opened after pledge(2) */ #define UF_FORKCLOSE 0x04 /* auto-close on fork */ +#define UF_PLEDGEOPEN 0x08 /* opened with __pledge_open() */ /* * Flags on the file descriptor table. diff --git a/lib/libc/include/generic-openbsd/sys/mbuf.h b/lib/libc/include/generic-openbsd/sys/mbuf.h index 5774ff06bb..bcfcfc048f 100644 --- a/lib/libc/include/generic-openbsd/sys/mbuf.h +++ b/lib/libc/include/generic-openbsd/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.267 2025/06/25 20:26:32 miod Exp $ */ +/* $OpenBSD: mbuf.h,v 1.269 2026/02/05 03:26:00 dlg Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* diff --git a/lib/libc/include/generic-openbsd/sys/mman.h b/lib/libc/include/generic-openbsd/sys/mman.h index e6a2f2b3b6..a0648d9f62 100644 --- a/lib/libc/include/generic-openbsd/sys/mman.h +++ b/lib/libc/include/generic-openbsd/sys/mman.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mman.h,v 1.35 2022/10/07 14:59:39 deraadt Exp $ */ +/* $OpenBSD: mman.h,v 1.36 2026/03/26 21:46:24 daniel Exp $ */ /* $NetBSD: mman.h,v 1.11 1995/03/26 20:24:23 jtc Exp $ */ /*- @@ -142,6 +142,11 @@ typedef __size_t size_t; typedef __off_t off_t; #endif +#ifndef _MODE_T_DEFINED_ +#define _MODE_T_DEFINED_ +typedef __mode_t mode_t; +#endif + __BEGIN_DECLS void * mmap(void *, size_t, int, int, int, off_t); int mprotect(void *, size_t, int); @@ -158,7 +163,7 @@ int mimmutable(void *, size_t); void * mquery(void *, size_t, int, int, int, off_t); #endif int posix_madvise(void *, size_t, int); -int shm_open(const char *, int, __mode_t); +int shm_open(const char *, int, mode_t); int shm_unlink(const char *); int shm_mkstemp(char *); __END_DECLS diff --git a/lib/libc/include/generic-openbsd/sys/mutex.h b/lib/libc/include/generic-openbsd/sys/mutex.h index 2e66c66ada..9ad8ee45e9 100644 --- a/lib/libc/include/generic-openbsd/sys/mutex.h +++ b/lib/libc/include/generic-openbsd/sys/mutex.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.h,v 1.23 2025/07/02 14:36:56 claudio Exp $ */ +/* $OpenBSD: mutex.h,v 1.26 2025/12/11 23:34:44 dlg Exp $ */ /* * Copyright (c) 2004 Artur Grabowski @@ -54,7 +54,7 @@ #include struct mutex { - void *volatile mtx_owner; + volatile unsigned long mtx_owner; int mtx_wantipl; int mtx_oldipl; #ifdef WITNESS @@ -64,23 +64,26 @@ struct mutex { #ifdef WITNESS #define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \ - { NULL, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) } + { 0, __MUTEX_IPL((ipl)), IPL_NONE, MTX_LO_INITIALIZER(name, flags) } #else #define MUTEX_INITIALIZER_FLAGS(ipl, name, flags) \ - { NULL, __MUTEX_IPL((ipl)), IPL_NONE } + { 0, __MUTEX_IPL((ipl)), IPL_NONE } #endif void __mtx_init(struct mutex *, int); #define _mtx_init(mtx, ipl) __mtx_init((mtx), __MUTEX_IPL((ipl))) +#define mtx_curcpu() (unsigned long)curcpu() +#define mtx_owner(mtx) ((mtx)->mtx_owner & ~1UL) + #ifdef DIAGNOSTIC #define MUTEX_ASSERT_LOCKED(mtx) do { \ - if (((mtx)->mtx_owner != curcpu()) && !(panicstr || db_active)) \ + if (mtx_owner(mtx) != mtx_curcpu() && !(panicstr || db_active)) \ panic("mutex %p not held in %s", (mtx), __func__); \ } while (0) #define MUTEX_ASSERT_UNLOCKED(mtx) do { \ - if (((mtx)->mtx_owner == curcpu()) && !(panicstr || db_active)) \ + if (mtx_owner(mtx) == mtx_curcpu() && !(panicstr || db_active)) \ panic("mutex %p held in %s", (mtx), __func__); \ } while (0) #else @@ -128,7 +131,7 @@ void mtx_leave(struct mutex *); #define mtx_init(m, ipl) mtx_init_flags(m, ipl, NULL, 0) #define mtx_owned(mtx) \ - (((mtx)->mtx_owner == curcpu()) || panicstr || db_active) + ((mtx_owner(mtx) == mtx_curcpu()) || panicstr || db_active) #ifdef WITNESS diff --git a/lib/libc/include/generic-openbsd/sys/namei.h b/lib/libc/include/generic-openbsd/sys/namei.h index 02339cab41..1a313cc862 100644 --- a/lib/libc/include/generic-openbsd/sys/namei.h +++ b/lib/libc/include/generic-openbsd/sys/namei.h @@ -1,4 +1,4 @@ -/* $OpenBSD: namei.h,v 1.50 2022/01/11 23:59:55 jsg Exp $ */ +/* $OpenBSD: namei.h,v 1.51 2026/03/08 16:41:19 deraadt Exp $ */ /* $NetBSD: namei.h,v 1.11 1996/02/09 18:25:20 christos Exp $ */ /* @@ -264,11 +264,12 @@ struct nchstats { } /* Unveil flags for namei */ -#define UNVEIL_READ 0x01 -#define UNVEIL_WRITE 0x02 -#define UNVEIL_CREATE 0x04 -#define UNVEIL_EXEC 0x08 -#define UNVEIL_USERSET 0x10 -#define UNVEIL_MASK 0x0F +#define UNVEIL_READ 0x01 +#define UNVEIL_WRITE 0x02 +#define UNVEIL_CREATE 0x04 +#define UNVEIL_EXEC 0x08 +#define UNVEIL_USERSET 0x10 +#define UNVEIL_PLEDGEOPEN 0X20 +#define UNVEIL_MASK 0x0f #endif /* !_SYS_NAMEI_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/sys/param.h b/lib/libc/include/generic-openbsd/sys/param.h index e86909313f..dcc616bf77 100644 --- a/lib/libc/include/generic-openbsd/sys/param.h +++ b/lib/libc/include/generic-openbsd/sys/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.145 2025/09/10 16:00:04 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.146 2026/03/11 02:27:20 deraadt Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 diff --git a/lib/libc/include/generic-openbsd/sys/pledge.h b/lib/libc/include/generic-openbsd/sys/pledge.h index 85a1fdc64c..e16767ea08 100644 --- a/lib/libc/include/generic-openbsd/sys/pledge.h +++ b/lib/libc/include/generic-openbsd/sys/pledge.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pledge.h,v 1.52 2025/07/05 09:24:37 jsg Exp $ */ +/* $OpenBSD: pledge.h,v 1.53 2026/02/26 07:42:25 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -28,7 +28,6 @@ #define PLEDGE_WPATH 0x0000000000000002ULL /* allow open for write */ #define PLEDGE_CPATH 0x0000000000000004ULL /* allow creat, mkdir, unlink etc */ #define PLEDGE_STDIO 0x0000000000000008ULL /* operate on own pid */ -#define PLEDGE_TMPPATH 0x0000000000000010ULL /* for mk*temp() */ #define PLEDGE_DNS 0x0000000000000020ULL /* DNS services */ #define PLEDGE_INET 0x0000000000000040ULL /* AF_INET/AF_INET6 sockets */ #define PLEDGE_FLOCK 0x0000000000000080ULL /* file locking */ @@ -78,7 +77,6 @@ static const struct { { PLEDGE_WPATH, "wpath" }, { PLEDGE_CPATH, "cpath" }, { PLEDGE_DPATH, "dpath" }, - { PLEDGE_TMPPATH, "tmppath" }, { PLEDGE_INET, "inet" }, { PLEDGE_MCAST, "mcast" }, { PLEDGE_FATTR, "fattr" }, diff --git a/lib/libc/include/generic-openbsd/sys/protosw.h b/lib/libc/include/generic-openbsd/sys/protosw.h index db18f5f66e..4f289bdf6f 100644 --- a/lib/libc/include/generic-openbsd/sys/protosw.h +++ b/lib/libc/include/generic-openbsd/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.72 2025/03/02 21:28:32 bluhm Exp $ */ +/* $OpenBSD: protosw.h,v 1.73 2025/10/24 15:09:56 bluhm Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -86,6 +86,7 @@ struct pr_usrreqs { struct mbuf *); int (*pru_sockaddr)(struct socket *, struct mbuf *); int (*pru_peeraddr)(struct socket *, struct mbuf *); + int (*pru_flowid)(struct socket *); int (*pru_connect2)(struct socket *, struct socket *); }; @@ -394,6 +395,12 @@ pru_peeraddr(struct socket *so, struct mbuf *addr) return (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, addr); } +static inline int +pru_flowid(struct socket *so) +{ + return (*so->so_proto->pr_usrreqs->pru_flowid)(so); +} + static inline int pru_connect2(struct socket *so1, struct socket *so2) { diff --git a/lib/libc/include/generic-openbsd/sys/ptrace.h b/lib/libc/include/generic-openbsd/sys/ptrace.h index 54ee9d75d2..4edcca384e 100644 --- a/lib/libc/include/generic-openbsd/sys/ptrace.h +++ b/lib/libc/include/generic-openbsd/sys/ptrace.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ptrace.h,v 1.16 2020/03/16 11:58:46 mpi Exp $ */ +/* $OpenBSD: ptrace.h,v 1.17 2025/12/11 14:13:18 kurt Exp $ */ /* $NetBSD: ptrace.h,v 1.21 1996/02/09 18:25:26 christos Exp $ */ /*- @@ -82,8 +82,11 @@ typedef struct ptrace_state { #define PT_GET_THREAD_FIRST 15 #define PT_GET_THREAD_NEXT 16 +#define PT_PTS_NAMELEN 32 + struct ptrace_thread_state { pid_t pts_tid; + char pts_name[PT_PTS_NAMELEN]; }; #define PT_FIRSTMACH 32 /* for machine-specific requests */ diff --git a/lib/libc/include/generic-openbsd/sys/sched.h b/lib/libc/include/generic-openbsd/sys/sched.h index d60605e710..62e9090091 100644 --- a/lib/libc/include/generic-openbsd/sys/sched.h +++ b/lib/libc/include/generic-openbsd/sys/sched.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sched.h,v 1.77 2025/06/09 10:57:46 claudio Exp $ */ +/* $OpenBSD: sched.h,v 1.78 2026/03/31 16:46:21 deraadt Exp $ */ /* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */ /*- @@ -179,8 +179,15 @@ void sched_barrier(struct cpu_info *ci); int sysctl_hwsetperf(void *, size_t *, void *, size_t); int sysctl_hwperfpolicy(void *, size_t *, void *, size_t); int sysctl_hwsmt(void *, size_t *, void *, size_t); +int sysctl_hwblockcpu(void *, size_t *, void *, size_t); int sysctl_hwncpuonline(void); +#define CPUTYP_SMT 0x01 /* SMT cpu */ +#define CPUTYP_P 0x02 /* Performance core */ +#define CPUTYP_E 0x04 /* Efficiency core */ +#define CPUTYP_L 0x08 /* Lethargic, Low Power Efficiency core */ +extern int sched_blockcpu; + #ifdef MULTIPROCESSOR void sched_start_secondary_cpus(void); void sched_stop_secondary_cpus(void); diff --git a/lib/libc/include/generic-openbsd/sys/signal.h b/lib/libc/include/generic-openbsd/sys/signal.h index 9303ad8ac2..e3e3a9d79e 100644 --- a/lib/libc/include/generic-openbsd/sys/signal.h +++ b/lib/libc/include/generic-openbsd/sys/signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signal.h,v 1.29 2018/04/18 16:05:20 deraadt Exp $ */ +/* $OpenBSD: signal.h,v 1.30 2026/03/21 01:56:51 daniel Exp $ */ /* $NetBSD: signal.h,v 1.21 1996/02/09 18:25:32 christos Exp $ */ /* @@ -80,8 +80,10 @@ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ -#if __BSD_VISIBLE +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 202405 #define SIGWINCH 28 /* window size changes */ +#endif +#if __BSD_VISIBLE #define SIGINFO 29 /* information request */ #endif #define SIGUSR1 30 /* user defined signal 1 */ diff --git a/lib/libc/include/generic-openbsd/sys/socketvar.h b/lib/libc/include/generic-openbsd/sys/socketvar.h index e64f148b18..6837a7cee9 100644 --- a/lib/libc/include/generic-openbsd/sys/socketvar.h +++ b/lib/libc/include/generic-openbsd/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.159 2025/07/25 08:58:44 mvs Exp $ */ +/* $OpenBSD: socketvar.h,v 1.160 2025/10/24 15:09:56 bluhm Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -74,6 +74,7 @@ struct sosplice { struct timeval ssp_idletv; /* [I] idle timeout */ struct timeout ssp_idleto; struct task ssp_task; /* task for somove */ + struct taskq *ssp_queue; /* [I] softnet queue where we add */ }; /* diff --git a/lib/libc/include/generic-openbsd/sys/sockio.h b/lib/libc/include/generic-openbsd/sys/sockio.h index 10d85c7923..23636761e7 100644 --- a/lib/libc/include/generic-openbsd/sys/sockio.h +++ b/lib/libc/include/generic-openbsd/sys/sockio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sockio.h,v 1.84 2021/11/11 10:03:10 claudio Exp $ */ +/* $OpenBSD: sockio.h,v 1.86 2025/11/21 04:44:26 dlg Exp $ */ /* $NetBSD: sockio.h,v 1.5 1995/08/23 00:40:47 thorpej Exp $ */ /*- @@ -75,7 +75,11 @@ #define SIOCGLIFPHYADDR _IOWR('i', 75, struct if_laddrreq) /* get gif addrs */ #define SIOCBRDGADD _IOW('i', 60, struct ifbreq) /* add bridge ifs */ +#define SIOCBRDGADDPV _IOW('i', 60, struct ifbrpvlan) /* add pvlan */ +#define SIOCBRDGFINDPV _IOWR('i', 60, struct ifbrpvlan) /* find pvlan */ #define SIOCBRDGDEL _IOW('i', 61, struct ifbreq) /* del bridge ifs */ +#define SIOCBRDGDELPV _IOW('i', 61, struct ifbrpvlan) /* del pvlan */ +#define SIOCBRDGNFINDPV _IOWR('i', 61, struct ifbrpvlan) /* nfind pvlan */ #define SIOCBRDGGIFFLGS _IOWR('i', 62, struct ifbreq) /* get brdg if flags */ #define SIOCBRDGSIFFLGS _IOW('i', 63, struct ifbreq) /* set brdg if flags */ #define SIOCBRDGSCACHE _IOW('i', 64, struct ifbrparam)/* set cache size */ @@ -85,12 +89,17 @@ #define SIOCBRDGDELS _IOW('i', 66, struct ifbreq) /* del span port */ #define SIOCBRDGRTS _IOWR('i', 67, struct ifbaconf) /* get addresses */ #define SIOCBRDGSADDR _IOWR('i', 68, struct ifbareq) /* set addr flags */ +#define SIOCBRDGSVADDR _IOW('i', 68, struct ifbvareq) /* add addr@vid */ #define SIOCBRDGSTO _IOW('i', 69, struct ifbrparam)/* cache timeout */ #define SIOCBRDGGTO _IOWR('i', 70, struct ifbrparam)/* cache timeout */ #define SIOCBRDGDADDR _IOW('i', 71, struct ifbareq) /* delete addr */ +#define SIOCBRDGDVADDR _IOW('i', 71, struct ifbvareq) /* delete addr@vid */ #define SIOCBRDGFLUSH _IOW('i', 72, struct ifbreq) /* flush addr cache */ #define SIOCBRDGADDL _IOW('i', 73, struct ifbreq) /* add local port */ #define SIOCBRDGSIFPROT _IOW('i', 74, struct ifbreq) /* set protected grp */ +#define SIOCBRDGSPVID _IOW('i', 76, struct ifbreq) /* set pvid */ +#define SIOCBRDGSVMAP _IOW('i', 76, struct ifbrvidmap) /* set vid map */ +#define SIOCBRDGGVMAP _IOWR('i', 76, struct ifbrvidmap) /* get vid map */ #define SIOCBRDGARL _IOW('i', 77, struct ifbrlreq) /* add bridge rule */ #define SIOCBRDGFRL _IOW('i', 78, struct ifbrlreq) /* flush brdg rules */ @@ -105,6 +114,7 @@ #define SIOCBRDGSMA _IOW('i', 83, struct ifbrparam)/* set max age */ #define SIOCBRDGSIFPRIO _IOW('i', 84, struct ifbreq) /* set if priority */ #define SIOCBRDGSIFCOST _IOW('i', 85, struct ifbreq) /* set if cost */ +#define SIOCBRDGVRTS _IOWR('i', 86, struct ifbaconf) /* get vaddresses */ #define SIOCBRDGGPARAM _IOWR('i', 88, struct ifbropreq)/* get brdg STP parms */ #define SIOCBRDGSTXHC _IOW('i', 89, struct ifbrparam)/* set tx hold count */ diff --git a/lib/libc/include/generic-openbsd/sys/syscall.h b/lib/libc/include/generic-openbsd/sys/syscall.h index 6aa7b3f897..4ae1c5bab7 100644 --- a/lib/libc/include/generic-openbsd/sys/syscall.h +++ b/lib/libc/include/generic-openbsd/sys/syscall.h @@ -1,10 +1,10 @@ -/* $OpenBSD: syscall.h,v 1.283 2025/05/24 06:50:02 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.284 2026/03/08 16:41:35 deraadt Exp $ */ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from; OpenBSD: syscalls.master,v 1.270 2025/05/24 06:49:16 deraadt Exp + * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp */ /* syscall: "exit" ret: "void" args: "int" */ @@ -371,7 +371,9 @@ /* syscall: "fchmod" ret: "int" args: "int" "mode_t" */ #define SYS_fchmod 124 - /* 125 is obsolete orecvfrom */ +/* syscall: "__pledge_open" ret: "int" args: "const char *" "int" "..." "mode_t" */ +#define SYS___pledge_open 125 + /* syscall: "setreuid" ret: "int" args: "uid_t" "uid_t" */ #define SYS_setreuid 126 diff --git a/lib/libc/include/generic-openbsd/sys/syscallargs.h b/lib/libc/include/generic-openbsd/sys/syscallargs.h index 62f9a6d1e3..bd45b93a35 100644 --- a/lib/libc/include/generic-openbsd/sys/syscallargs.h +++ b/lib/libc/include/generic-openbsd/sys/syscallargs.h @@ -1,10 +1,10 @@ -/* $OpenBSD: syscallargs.h,v 1.286 2025/05/24 06:50:02 deraadt Exp $ */ +/* $OpenBSD: syscallargs.h,v 1.287 2026/03/08 16:41:35 deraadt Exp $ */ /* * System call argument lists. * * DO NOT EDIT-- this file is automatically generated. - * created from; OpenBSD: syscalls.master,v 1.270 2025/05/24 06:49:16 deraadt Exp + * created from; OpenBSD: syscalls.master,v 1.271 2026/03/08 16:41:21 deraadt Exp */ #ifdef syscallarg @@ -640,6 +640,12 @@ struct sys_fchmod_args { syscallarg(mode_t) mode; }; +struct sys___pledge_open_args { + syscallarg(const char *) path; + syscallarg(int) flags; + syscallarg(mode_t) mode; +}; + struct sys_setreuid_args { syscallarg(uid_t) ruid; syscallarg(uid_t) euid; @@ -1291,6 +1297,7 @@ int sys_writev(struct proc *, void *, register_t *); int sys_kill(struct proc *, void *, register_t *); int sys_fchown(struct proc *, void *, register_t *); int sys_fchmod(struct proc *, void *, register_t *); +int sys___pledge_open(struct proc *, void *, register_t *); int sys_setreuid(struct proc *, void *, register_t *); int sys_setregid(struct proc *, void *, register_t *); int sys_rename(struct proc *, void *, register_t *); diff --git a/lib/libc/include/generic-openbsd/sys/sysctl.h b/lib/libc/include/generic-openbsd/sys/sysctl.h index 39620208b0..5e1a05810e 100644 --- a/lib/libc/include/generic-openbsd/sys/sysctl.h +++ b/lib/libc/include/generic-openbsd/sys/sysctl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.h,v 1.246 2025/07/31 09:05:11 mvs Exp $ */ +/* $OpenBSD: sysctl.h,v 1.248 2026/04/16 14:47:24 deraadt Exp $ */ /* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */ /* @@ -684,7 +684,6 @@ do { \ (kp)->p_vm_dsize = (vm)->vm_dused; \ (kp)->p_vm_ssize = (vm)->vm_ssize; \ } \ - (kp)->p_addr = PTRTOINT64((p)->p_addr); \ (kp)->p_stat = (p)->p_stat; \ (kp)->p_slptime = (p)->p_slptime; \ (kp)->p_holdcnt = 1; \ @@ -693,8 +692,10 @@ do { \ if ((p)->p_wchan && (p)->p_wmesg) \ copy_str((kp)->p_wmesg, (p)->p_wmesg, \ sizeof((kp)->p_wmesg)); \ - if (show_addresses) \ + if (show_addresses) { \ (kp)->p_wchan = PTRTOINT64((p)->p_wchan); \ + (kp)->p_addr = PTRTOINT64((p)->p_addr); \ + } \ } \ \ if (((pr)->ps_flags & PS_ZOMBIE) == 0) { \ @@ -926,7 +927,8 @@ struct kinfo_file { #define HW_POWER 26 /* int: machine has wall-power */ #define HW_BATTERY 27 /* node: battery */ #define HW_UCOMNAMES 28 /* strings: ucom names */ -#define HW_MAXID 29 /* number of valid hw ids */ +#define HW_BLOCKCPU 29 /* string: cpu types to block */ +#define HW_MAXID 30 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ @@ -958,6 +960,7 @@ struct kinfo_file { { "power", CTLTYPE_INT }, \ { "battery", CTLTYPE_NODE }, \ { "ucomnames", CTLTYPE_STRING }, \ + { "blockcpu", CTLTYPE_STRING }, \ } /* diff --git a/lib/libc/include/generic-openbsd/sys/types.h b/lib/libc/include/generic-openbsd/sys/types.h index 9ea9bab090..b9eedd8526 100644 --- a/lib/libc/include/generic-openbsd/sys/types.h +++ b/lib/libc/include/generic-openbsd/sys/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.49 2022/08/06 13:31:13 semarie Exp $ */ +/* $OpenBSD: types.h,v 1.50 2026/03/26 21:46:24 daniel Exp $ */ /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ /*- @@ -140,7 +140,6 @@ typedef __gid_t gid_t; /* group id */ typedef __id_t id_t; /* may contain pid, uid or gid */ typedef __ino_t ino_t; /* inode number */ typedef __key_t key_t; /* IPC key (for Sys V IPC) */ -typedef __mode_t mode_t; /* permissions */ typedef __nlink_t nlink_t; /* link count */ typedef __rlim_t rlim_t; /* resource limit */ typedef __segsz_t segsz_t; /* segment size */ @@ -193,6 +192,11 @@ typedef __timer_t timer_t; typedef __off_t off_t; #endif +#ifndef _MODE_T_DEFINED_ +#define _MODE_T_DEFINED_ +typedef __mode_t mode_t; /* permissions */ +#endif + /* * These belong in unistd.h, but are placed here too to ensure that * long arguments will be promoted to off_t if the program fails to diff --git a/lib/libc/include/generic-openbsd/sys/videoio.h b/lib/libc/include/generic-openbsd/sys/videoio.h index 361f46c7ae..c996daac60 100644 --- a/lib/libc/include/generic-openbsd/sys/videoio.h +++ b/lib/libc/include/generic-openbsd/sys/videoio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: videoio.h,v 1.26 2025/08/02 09:27:59 kirill Exp $ */ +/* $OpenBSD: videoio.h,v 1.29 2026/02/19 20:42:45 kirill Exp $ */ /* * Video for Linux Two header file @@ -54,7 +54,7 @@ * * Author: Bill Dirks * Justin Schoeman - * Hans Verkuil + * Hans Verkuil * et al. */ @@ -343,6 +343,12 @@ enum v4l2_colorfx { */ #define V4L2_CID_USER_RKISP1_BASE (V4L2_CID_USER_BASE + 0x1220) +/* + * The base for the Arm Mali-C55 ISP driver controls. + * We reserve 16 controls for this driver + */ +#define V4L2_CID_USER_MALI_C55_BASE (V4L2_CID_USER_BASE + 0x1230) + /* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */ @@ -1299,6 +1305,8 @@ enum v4l2_flash_strobe_source { #define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) #define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) +#define V4L2_CID_FLASH_DURATION (V4L2_CID_FLASH_CLASS_BASE + 13) +#define V4L2_CID_FLASH_STROBE_OE (V4L2_CID_FLASH_CLASS_BASE + 14) /* JPEG-class control IDs */ @@ -1306,7 +1314,7 @@ enum v4l2_flash_strobe_source { #define V4L2_CID_JPEG_CLASS_BASE (V4L2_CTRL_CLASS_JPEG | 0x900) #define V4L2_CID_JPEG_CLASS (V4L2_CTRL_CLASS_JPEG | 1) -#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) +#define V4L2_CID_JPEG_CHROMA_SUBSAMPLING (V4L2_CID_JPEG_CLASS_BASE + 1) enum v4l2_jpeg_chroma_subsampling { V4L2_JPEG_CHROMA_SUBSAMPLING_444 = 0, V4L2_JPEG_CHROMA_SUBSAMPLING_422 = 1, @@ -1315,15 +1323,15 @@ enum v4l2_jpeg_chroma_subsampling { V4L2_JPEG_CHROMA_SUBSAMPLING_410 = 4, V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY = 5, }; -#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) -#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) +#define V4L2_CID_JPEG_RESTART_INTERVAL (V4L2_CID_JPEG_CLASS_BASE + 2) +#define V4L2_CID_JPEG_COMPRESSION_QUALITY (V4L2_CID_JPEG_CLASS_BASE + 3) -#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) -#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) -#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) -#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) -#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) -#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) +#define V4L2_CID_JPEG_ACTIVE_MARKER (V4L2_CID_JPEG_CLASS_BASE + 4) +#define V4L2_JPEG_ACTIVE_MARKER_APP0 (1 << 0) +#define V4L2_JPEG_ACTIVE_MARKER_APP1 (1 << 1) +#define V4L2_JPEG_ACTIVE_MARKER_COM (1 << 16) +#define V4L2_JPEG_ACTIVE_MARKER_DQT (1 << 17) +#define V4L2_JPEG_ACTIVE_MARKER_DHT (1 << 18) /* Image source controls */ @@ -1356,10 +1364,10 @@ enum v4l2_jpeg_chroma_subsampling { #define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900) #define V4L2_CID_DV_CLASS (V4L2_CTRL_CLASS_DV | 1) -#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1) -#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2) -#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3) -#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4) +#define V4L2_CID_DV_TX_HOTPLUG (V4L2_CID_DV_CLASS_BASE + 1) +#define V4L2_CID_DV_TX_RXSENSE (V4L2_CID_DV_CLASS_BASE + 2) +#define V4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE + 3) +#define V4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE + 4) enum v4l2_dv_tx_mode { V4L2_DV_TX_MODE_DVI_D = 0, V4L2_DV_TX_MODE_HDMI = 1, @@ -1380,7 +1388,7 @@ enum v4l2_dv_it_content_type { V4L2_DV_IT_CONTENT_TYPE_NO_ITC = 4, }; -#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100) +#define V4L2_CID_DV_RX_POWER_PRESENT (V4L2_CID_DV_CLASS_BASE + 100) #define V4L2_CID_DV_RX_RGB_RANGE (V4L2_CID_DV_CLASS_BASE + 101) #define V4L2_CID_DV_RX_IT_CONTENT_TYPE (V4L2_CID_DV_CLASS_BASE + 102) @@ -1650,15 +1658,6 @@ struct v4l2_ctrl_h264_pred_weights { struct v4l2_h264_weight_factors weight_factors[2]; }; -#define V4L2_H264_SLICE_TYPE_P 0 -#define V4L2_H264_SLICE_TYPE_B 1 -#define V4L2_H264_SLICE_TYPE_I 2 -#define V4L2_H264_SLICE_TYPE_SP 3 -#define V4L2_H264_SLICE_TYPE_SI 4 - -#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01 -#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02 - #define V4L2_H264_TOP_FIELD_REF 0x1 #define V4L2_H264_BOTTOM_FIELD_REF 0x2 #define V4L2_H264_FRAME_REF 0x3 @@ -1679,8 +1678,17 @@ struct v4l2_h264_reference { * Maximum DPB size, as specified by section 'A.3.1 Level limits * common to the Baseline, Main, and Extended profiles'. */ -#define V4L2_H264_NUM_DPB_ENTRIES 16 -#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES) +#define V4L2_H264_NUM_DPB_ENTRIES 16 +#define V4L2_H264_REF_LIST_LEN (2 * V4L2_H264_NUM_DPB_ENTRIES) + +#define V4L2_H264_SLICE_TYPE_P 0 +#define V4L2_H264_SLICE_TYPE_B 1 +#define V4L2_H264_SLICE_TYPE_I 2 +#define V4L2_H264_SLICE_TYPE_SP 3 +#define V4L2_H264_SLICE_TYPE_SI 4 + +#define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01 +#define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH 0x02 #define V4L2_CID_STATELESS_H264_SLICE_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 6) /** @@ -1820,7 +1828,6 @@ struct v4l2_ctrl_h264_decode_params { u_int32_t flags; }; - /* Stateless FWHT control, used by the vicodec driver */ /* Current FWHT version */ @@ -2207,6 +2214,8 @@ struct v4l2_ctrl_mpeg2_quantisation { #define V4L2_CID_STATELESS_HEVC_DECODE_MODE (V4L2_CID_CODEC_STATELESS_BASE + 405) #define V4L2_CID_STATELESS_HEVC_START_CODE (V4L2_CID_CODEC_STATELESS_BASE + 406) #define V4L2_CID_STATELESS_HEVC_ENTRY_POINT_OFFSETS (V4L2_CID_CODEC_STATELESS_BASE + 407) +#define V4L2_CID_STATELESS_HEVC_EXT_SPS_ST_RPS (V4L2_CID_CODEC_STATELESS_BASE + 408) +#define V4L2_CID_STATELESS_HEVC_EXT_SPS_LT_RPS (V4L2_CID_CODEC_STATELESS_BASE + 409) enum v4l2_stateless_hevc_decode_mode { V4L2_STATELESS_HEVC_DECODE_MODE_SLICE_BASED, @@ -2662,44 +2671,69 @@ struct v4l2_ctrl_hevc_scaling_matrix { u_int8_t scaling_list_dc_coef_32x32[2]; }; -#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900) -#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1) +#define V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_INTER_REF_PIC_SET_PRED 0x1 -#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0) - -struct v4l2_ctrl_hdr10_cll_info { - u_int16_t max_content_light_level; - u_int16_t max_pic_average_light_level; +/* + * struct v4l2_ctrl_hevc_ext_sps_st_rps - HEVC short term RPS parameters + * + * Dynamic size 1-dimension array for short term RPS. The number of elements + * is v4l2_ctrl_hevc_sps::num_short_term_ref_pic_sets. It can contain up to 65 elements. + * + * @delta_idx_minus1: Specifies the delta compare to the index. See details in section 7.4.8 + * "Short-term reference picture set semantics" of the specification. + * @delta_rps_sign: Sign of the delta as specified in section 7.4.8 "Short-term reference picture + * set semantics" of the specification. + * @abs_delta_rps_minus1: Absolute delta RPS as specified in section 7.4.8 "Short-term reference + * picture set semantics" of the specification. + * @num_negative_pics: Number of short-term RPS entries that have picture order count values less + * than the picture order count value of the current picture. + * @num_positive_pics: Number of short-term RPS entries that have picture order count values + * greater than the picture order count value of the current picture. + * @used_by_curr_pic: Bit j specifies if short-term RPS j is used by the current picture. + * @use_delta_flag: Bit j equals to 1 specifies that the j-th entry in the source candidate + * short-term RPS is included in this candidate short-term RPS. + * @delta_poc_s0_minus1: Specifies the negative picture order count delta for the i-th entry in + * the short-term RPS. See details in section 7.4.8 "Short-term reference + * picture set semantics" of the specification. + * @delta_poc_s1_minus1: Specifies the positive picture order count delta for the i-th entry in + * the short-term RPS. See details in section 7.4.8 "Short-term reference + * picture set semantics" of the specification. + * @flags: See V4L2_HEVC_EXT_SPS_ST_RPS_FLAG_{} + */ +struct v4l2_ctrl_hevc_ext_sps_st_rps { + u_int8_t delta_idx_minus1; + u_int8_t delta_rps_sign; + u_int8_t num_negative_pics; + u_int8_t num_positive_pics; + u_int32_t used_by_curr_pic; + u_int32_t use_delta_flag; + u_int16_t abs_delta_rps_minus1; + u_int16_t delta_poc_s0_minus1[16]; + u_int16_t delta_poc_s1_minus1[16]; + u_int16_t flags; }; -#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE + 1) +#define V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_USED_LT 0x1 -#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW 5 -#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH 37000 -#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW 5 -#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH 42000 -#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 5 -#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH 37000 -#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 5 -#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH 42000 -#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW 50000 -#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH 100000000 -#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW 1 -#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH 50000 - -struct v4l2_ctrl_hdr10_mastering_display { - u_int16_t display_primaries_x[3]; - u_int16_t display_primaries_y[3]; - u_int16_t white_point_x; - u_int16_t white_point_y; - u_int32_t max_display_mastering_luminance; - u_int32_t min_display_mastering_luminance; +/* + * struct v4l2_ctrl_hevc_ext_sps_lt_rps - HEVC long term RPS parameters + * + * Dynamic size 1-dimension array for long term RPS. The number of elements + * is v4l2_ctrl_hevc_sps::num_long_term_ref_pics_sps. It can contain up to 65 elements. + * + * @lt_ref_pic_poc_lsb_sps: picture order count modulo MaxPicOrderCntLsb of the i-th candidate + * long-term reference picture. + * @flags: See V4L2_HEVC_EXT_SPS_LT_RPS_FLAG_{} + */ +struct v4l2_ctrl_hevc_ext_sps_lt_rps { + u_int16_t lt_ref_pic_poc_lsb_sps; + u_int16_t flags; }; /* Stateless VP9 controls */ #define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_ENABLED 0x1 -#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE 0x2 +#define V4L2_VP9_LOOP_FILTER_FLAG_DELTA_UPDATE 0x2 /** * struct v4l2_vp9_loop_filter - VP9 loop filter parameters @@ -3625,6 +3659,40 @@ struct v4l2_ctrl_av1_film_grain { #define V4L2_CID_MPEG_BASE V4L2_CID_CODEC_BASE #define V4L2_CID_MPEG_CX2341X_BASE V4L2_CID_CODEC_CX2341X_BASE #define V4L2_CID_MPEG_MFC51_BASE V4L2_CID_CODEC_MFC51_BASE +#define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900) +#define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1) + +#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0) + +struct v4l2_ctrl_hdr10_cll_info { + u_int16_t max_content_light_level; + u_int16_t max_pic_average_light_level; +}; + +#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE + 1) + +#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW 5 +#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH 37000 +#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW 5 +#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH 42000 +#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 5 +#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH 37000 +#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 5 +#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH 42000 +#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW 50000 +#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH 100000000 +#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW 1 +#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH 50000 + +struct v4l2_ctrl_hdr10_mastering_display { + u_int16_t display_primaries_x[3]; + u_int16_t display_primaries_y[3]; + u_int16_t white_point_x; + u_int16_t white_point_y; + u_int32_t max_display_mastering_luminance; + u_int32_t min_display_mastering_luminance; +}; + /* * End of v4l2-controls.h */ @@ -4316,6 +4384,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_H264_SLICE v4l2_fourcc('S', '2', '6', '4') /* H264 parsed slices */ #define V4L2_PIX_FMT_HEVC_SLICE v4l2_fourcc('S', '2', '6', '5') /* HEVC parsed slices */ #define V4L2_PIX_FMT_AV1_FRAME v4l2_fourcc('A', 'V', '1', 'F') /* AV1 parsed frame */ +#define V4L2_PIX_FMT_AV1 v4l2_fourcc('A', 'V', '0', '1') /* AV1 */ #define V4L2_PIX_FMT_SPK v4l2_fourcc('S', 'P', 'K', '0') /* Sorenson Spark */ #define V4L2_PIX_FMT_RV30 v4l2_fourcc('R', 'V', '3', '0') /* RealVideo 8 */ #define V4L2_PIX_FMT_RV40 v4l2_fourcc('R', 'V', '4', '0') /* RealVideo 9 & 10 */ @@ -4425,6 +4494,10 @@ struct v4l2_pix_format { #define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C') /* PiSP FE configuration */ #define V4L2_META_FMT_RPI_FE_STATS v4l2_fourcc('R', 'P', 'F', 'S') /* PiSP FE stats */ +/* Vendor specific - used for Arm Mali-C55 ISP */ +#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P') /* ARM Mali-C55 Parameters */ +#define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S') /* ARM Mali-C55 3A Statistics */ + /* priv field value to indicates that subsequent fields are valid. */ #define V4L2_PIX_FMT_PRIV_MAGIC 0xfeedcafe @@ -5108,8 +5181,8 @@ struct v4l2_bt_timings { } __attribute__ ((packed)); /* Interlaced or progressive format */ -#define V4L2_DV_PROGRESSIVE 0 -#define V4L2_DV_INTERLACED 1 +#define V4L2_DV_PROGRESSIVE 0 +#define V4L2_DV_INTERLACED 1 /* Polarities. If bit is not set, it is assumed to be negative polarity */ #define V4L2_DV_VSYNC_POS_POL 0x00000001 @@ -5478,6 +5551,8 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS = 0x0272, V4L2_CTRL_TYPE_HEVC_SCALING_MATRIX = 0x0273, V4L2_CTRL_TYPE_HEVC_DECODE_PARAMS = 0x0274, + V4L2_CTRL_TYPE_HEVC_EXT_SPS_ST_RPS = 0x0275, + V4L2_CTRL_TYPE_HEVC_EXT_SPS_LT_RPS = 0x0276, V4L2_CTRL_TYPE_AV1_SEQUENCE = 0x280, V4L2_CTRL_TYPE_AV1_TILE_GROUP_ENTRY = 0x281, @@ -6281,15 +6356,15 @@ struct v4l2_remove_buffers { * Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. * You must be root to use these ioctls. Never use these in applications! */ -#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) -#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) +#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) +#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) -#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) -#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) -#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) -#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) -#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) +#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) +#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) +#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) +#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) +#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) #define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) #define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) #define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) diff --git a/lib/libc/include/generic-openbsd/sys/xcall.h b/lib/libc/include/generic-openbsd/sys/xcall.h index b4ec9d497a..9de30b568c 100644 --- a/lib/libc/include/generic-openbsd/sys/xcall.h +++ b/lib/libc/include/generic-openbsd/sys/xcall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xcall.h,v 1.1 2025/07/13 05:45:21 dlg Exp $ */ +/* $OpenBSD: xcall.h,v 1.2 2025/11/10 12:34:52 dlg Exp $ */ /* * Copyright (c) 2025 David Gwynne @@ -45,7 +45,7 @@ * * 4. cpu_xcall_ipi has to be provided by machine/intr.h. * - * 5. The MD xcall IPI handler has to call cpu_xcall_dispatch. + * 5. call cpu_xcall_dispatch at IPL_SOFTCLOCK on the target CPU. */ #ifndef _SYS_XCALL_H diff --git a/lib/libc/include/generic-openbsd/time.h b/lib/libc/include/generic-openbsd/time.h index 2762f0f1dc..c600035bf9 100644 --- a/lib/libc/include/generic-openbsd/time.h +++ b/lib/libc/include/generic-openbsd/time.h @@ -1,4 +1,4 @@ -/* $OpenBSD: time.h,v 1.32 2022/10/25 16:30:30 millert Exp $ */ +/* $OpenBSD: time.h,v 1.33 2025/11/20 10:58:11 tb Exp $ */ /* $NetBSD: time.h,v 1.9 1994/10/26 00:56:35 cgd Exp $ */ /* @@ -106,7 +106,7 @@ struct tm { int tm_yday; /* days since January 1 [0-365] */ int tm_isdst; /* Daylight Saving Time flag */ long tm_gmtoff; /* offset from UTC in seconds */ - char *tm_zone; /* timezone abbreviation */ + const char *tm_zone; /* timezone abbreviation */ }; __BEGIN_DECLS diff --git a/lib/libc/include/generic-openbsd/unistd.h b/lib/libc/include/generic-openbsd/unistd.h index 115e53fda2..913233cd68 100644 --- a/lib/libc/include/generic-openbsd/unistd.h +++ b/lib/libc/include/generic-openbsd/unistd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unistd.h,v 1.112 2025/05/24 06:49:16 deraadt Exp $ */ +/* $OpenBSD: unistd.h,v 1.113 2025/10/07 12:02:21 brynet Exp $ */ /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */ /*- @@ -530,7 +530,7 @@ int setpgrp(pid_t _pid, pid_t _pgrp); /* BSD compat version */ int setthrname(pid_t, const char *); void setusershell(void); int strtofflags(char **, u_int32_t *, u_int32_t *); -int swapctl(int cmd, const void *arg, int misc); +int swapctl(int, const void *, int); int pledge(const char *, const char *); int unveil(const char *, const char *); pid_t __tfork_thread(const struct __tfork *, size_t, void (*)(void *), diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_anon.h b/lib/libc/include/generic-openbsd/uvm/uvm_anon.h index a852f72d72..6e46c65cb5 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_anon.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_anon.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_anon.h,v 1.23 2025/04/16 09:16:48 mpi Exp $ */ +/* $OpenBSD: uvm_anon.h,v 1.24 2025/12/15 13:02:18 mpi Exp $ */ /* $NetBSD: uvm_anon.h,v 1.13 2000/12/27 09:17:04 chs Exp $ */ /* @@ -88,7 +88,7 @@ struct vm_aref { #ifdef _KERNEL struct vm_anon *uvm_analloc(void); -void uvm_anfree_list(struct vm_anon *, struct pglist *); +void uvm_anfree(struct vm_anon *); void uvm_anon_release(struct vm_anon *); void uvm_anwait(void); void uvm_anon_init(void); @@ -96,7 +96,6 @@ void uvm_anon_init_percpu(void); void uvm_anon_dropswap(struct vm_anon *); boolean_t uvm_anon_pagein(struct vm_amap *, struct vm_anon *); -#define uvm_anfree(an) uvm_anfree_list((an), NULL) #endif /* _KERNEL */ diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_extern.h b/lib/libc/include/generic-openbsd/uvm/uvm_extern.h index f3575f0bfc..9df72a98c1 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_extern.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_extern.h,v 1.184 2025/06/03 08:38:17 mpi Exp $ */ +/* $OpenBSD: uvm_extern.h,v 1.187 2025/11/13 10:55:51 mpi Exp $ */ /* $NetBSD: uvm_extern.h,v 1.57 2001/03/09 01:02:12 chs Exp $ */ /* @@ -126,15 +126,6 @@ typedef int vm_prot_t; #define UVM_UNKNOWN_OFFSET ((voff_t) -1) /* offset not known(obj) or don't care(!obj) */ -/* - * the following defines are for uvm_km_kmemalloc's flags - */ -#define UVM_KMF_NOWAIT 0x1 /* matches M_NOWAIT */ -#define UVM_KMF_VALLOC 0x2 /* allocate VA only */ -#define UVM_KMF_CANFAIL 0x4 /* caller handles failure */ -#define UVM_KMF_ZERO 0x08 /* zero pages */ -#define UVM_KMF_TRYLOCK UVM_FLAG_TRYLOCK /* try locking only */ - /* * flags for uvm_pagealloc() */ @@ -286,12 +277,6 @@ int uvm_io(vm_map_t, struct uio *, int); #define UVM_IO_FIXPROT 0x01 -void uvm_km_free(vm_map_t, vaddr_t, vsize_t); -vaddr_t uvm_km_kmemalloc_pla(struct vm_map *, - struct uvm_object *, vsize_t, vsize_t, int, - paddr_t, paddr_t, paddr_t, paddr_t, int); -#define uvm_km_kmemalloc(map, obj, sz, flags) \ - uvm_km_kmemalloc_pla(map, obj, sz, 0, flags, 0, (paddr_t)-1, 0, 0, 0) struct vm_map *uvm_km_suballoc(vm_map_t, vaddr_t *, vaddr_t *, vsize_t, int, boolean_t, vm_map_t); /* @@ -443,9 +428,6 @@ void kmeminit_nkmempages(void); void kmeminit(void); extern u_int nkmempages; -struct vnode; -struct uvm_object *uvn_attach(struct vnode *, vm_prot_t); - struct process; struct kinfo_vmentry; int fill_vmmap(struct process *, struct kinfo_vmentry *, diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_pager.h b/lib/libc/include/generic-openbsd/uvm/uvm_pager.h index f9449680c1..1196c6a4ec 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_pager.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_pager.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pager.h,v 1.33 2021/10/12 07:38:22 mpi Exp $ */ +/* $OpenBSD: uvm_pager.h,v 1.34 2025/12/18 16:05:18 mpi Exp $ */ /* $NetBSD: uvm_pager.h,v 1.20 2000/11/27 08:40:05 chs Exp $ */ /* @@ -110,7 +110,6 @@ struct uvm_pagerops { #define PGO_DOACTCLUST 0x020 /* flag to mk_pcluster to include active */ #define PGO_LOCKED 0x040 /* fault data structures are locked [get] */ #define PGO_PDFREECLUST 0x080 /* daemon's free cluster flag [uvm_pager_put] */ -#define PGO_REALLOCSWAP 0x100 /* reallocate swap area [pager_dropcluster] */ #define PGO_NOWAIT 0x200 /* do not wait for inode lock */ /* page we are not interested in getting */ @@ -120,8 +119,8 @@ struct uvm_pagerops { * prototypes */ -void uvm_pager_dropcluster(struct uvm_object *, struct vm_page *, - struct vm_page **, int *, int); +void uvm_pager_dropcluster(struct uvm_object *, struct vm_page **, + int *, int); void uvm_pager_init(void); int uvm_pager_put(struct uvm_object *, struct vm_page *, struct vm_page ***, int *, int, voff_t, voff_t); diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h b/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h index 49af017d96..c34dfba7b2 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_pmemrange.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.h,v 1.19 2024/11/07 11:12:46 mpi Exp $ */ +/* $OpenBSD: uvm_pmemrange.h,v 1.20 2026/01/28 21:09:41 deraadt Exp $ */ /* * Copyright (c) 2009 Ariane van der Steldt @@ -100,7 +100,6 @@ extern struct uvm_pmalloc nowait_pma; /* [F] */ * uvm_pmalloc flags. */ #define UVM_PMA_LINKED 0x01 /* uvm_pmalloc is on list */ -#define UVM_PMA_BUSY 0x02 /* entry is busy with fpageq unlocked */ #define UVM_PMA_FAIL 0x10 /* page daemon cannot free pages */ #define UVM_PMA_FREED 0x20 /* at least one page in the range was freed */ diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_swap.h b/lib/libc/include/generic-openbsd/uvm/uvm_swap.h index d3eb55d061..1f2600c4a9 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_swap.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_swap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_swap.h,v 1.20 2023/10/27 19:18:53 mpi Exp $ */ +/* $OpenBSD: uvm_swap.h,v 1.22 2026/04/11 01:36:23 deraadt Exp $ */ /* $NetBSD: uvm_swap.h,v 1.5 2000/01/11 06:57:51 chs Exp $ */ /* @@ -37,6 +37,7 @@ #ifdef _KERNEL +int uvm_swap_dropcluster(struct vm_page **, int, int); int uvm_swap_get(struct vm_page *, int, int); int uvm_swap_put(int, struct vm_page **, int, int); int uvm_swap_alloc(int *, boolean_t); @@ -53,6 +54,8 @@ void uvm_swap_initcrypt_all(void); void uvm_swap_finicrypt_all(void); #endif +extern volatile int seb_free; + #endif /* _KERNEL */ #endif /* _UVM_UVM_SWAP_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/uvm/uvm_vnode.h b/lib/libc/include/generic-openbsd/uvm/uvm_vnode.h index 37db256a05..0affeebd5f 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvm_vnode.h +++ b/lib/libc/include/generic-openbsd/uvm/uvm_vnode.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_vnode.h,v 1.22 2025/09/25 09:05:47 mpi Exp $ */ +/* $OpenBSD: uvm_vnode.h,v 1.24 2025/11/10 15:53:06 mpi Exp $ */ /* $NetBSD: uvm_vnode.h,v 1.9 2000/03/26 20:54:48 kleink Exp $ */ /* @@ -72,7 +72,6 @@ struct uvm_vnode { */ #define UVM_VNODE_VALID 0x001 /* we are attached to the vnode */ #define UVM_VNODE_CANPERSIST 0x002 /* we can persist after ref == 0 */ -#define UVM_VNODE_ALOCK 0x004 /* uvn_attach is locked out */ #define UVM_VNODE_DYING 0x008 /* final detach/terminate in progress */ #define UVM_VNODE_RELKILL 0x010 /* uvn should be killed by releasepg @@ -92,9 +91,9 @@ struct uvm_vnode { * UVM_VNODE_BLOCKED: any condition that should new processes from * touching the vnode [set WANTED and sleep to wait for it to clear] */ -#define UVM_VNODE_BLOCKED (UVM_VNODE_ALOCK|UVM_VNODE_DYING|UVM_VNODE_RELKILL) +#define UVM_VNODE_BLOCKED (UVM_VNODE_DYING|UVM_VNODE_RELKILL) -void uvm_vnp_obj_alloc(struct vnode *); +struct uvm_object *uvn_attach(struct vnode *, vm_prot_t); void uvm_vnp_terminate(struct vnode *); #endif /* _UVM_UVM_VNODE_H_ */ \ No newline at end of file diff --git a/lib/libc/include/generic-openbsd/uvm/uvmexp.h b/lib/libc/include/generic-openbsd/uvm/uvmexp.h index 54fcb47a9d..b725328af5 100644 --- a/lib/libc/include/generic-openbsd/uvm/uvmexp.h +++ b/lib/libc/include/generic-openbsd/uvm/uvmexp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvmexp.h,v 1.19 2025/03/10 19:52:57 miod Exp $ */ +/* $OpenBSD: uvmexp.h,v 1.27 2026/03/08 17:06:10 deraadt Exp $ */ #ifndef _UVM_UVMEXP_ #define _UVM_UVMEXP_ @@ -41,13 +41,14 @@ * other than the vm system. * * Locks used to protect struct members in this file: - * a atomic operations + * a atomic operations (signed int, so use atomic_load_sint) * I immutable after creation * K kernel lock * F uvm_lock_fpageq * L uvm_lock_pageq * S uvm_swap_data_lock * p copy of per-CPU counters, used only by userland. + * o updated only by the page daemon */ struct uvmexp { /* vm_page constants */ @@ -57,13 +58,13 @@ struct uvmexp { /* vm_page counters */ int npages; /* [I] number of pages we manage */ - int free; /* [F] number of free pages */ - int active; /* [L] # of active pages */ - int inactive; /* [L] # of pages that we free'd but may want back */ - int paging; /* [a] # of pages in the process of being paged out */ - int wired; /* [a] number of wired pages */ + int free; /* [aF] number of free pages */ + int active; /* [aL] # of active pages */ + int inactive; /* [aL] # of pages that we free'd but may want back */ + int paging; /* [a] # number of pages in the process of being paged out */ + int wired; /* [a] # number of wired pages */ - int zeropages; /* [F] number of zero'd pages */ + int zeropages; /* [aF] number of zero'd pages */ int reserve_pagedaemon; /* [I] # of pages reserved for pagedaemon */ int reserve_kernel; /* [I] # of pages reserved for kernel */ int percpucaches; /* [a] # of pages in per-CPU caches */ @@ -83,9 +84,9 @@ struct uvmexp { int vnodeminpct;/* min percent vnode pages */ /* swap */ - int nswapdev; /* [S] number of configured swap devices in system */ - int swpages; /* [S] number of PAGE_SIZE'ed swap pages */ - int swpginuse; /* [S] number of swap pages in use */ + int nswapdev; /* [aS] number of configured swap devices in system */ + int swpages; /* [aS] number of PAGE_SIZE'ed swap pages */ + int swpginuse; /* [aS] number of swap pages in use */ int swpgonly; /* [a] number of swap pages in use, not also in RAM */ int nswget; /* [a] number of swap pages moved from disk to RAM */ int nanon; /* XXX number total of anon's in system */ @@ -94,23 +95,23 @@ struct uvmexp { /* stat counters */ int faults; /* [p] page fault count */ - int traps; /* trap count */ - int intrs; /* interrupt count */ + int traps; /* [a] trap count */ + int intrs; /* [a] interrupt count */ int swtch; /* context switch count */ - int softs; /* software interrupt count */ - int syscalls; /* system calls */ + int softs; /* [a] software interrupt count */ + int syscalls; /* [a] system calls */ int pageins; /* [p] pagein operation count */ /* pageouts are in pdpageouts below */ int pcphit; /* [a] # of pagealloc from per-CPU cache */ int pcpmiss; /* [a] # of times a per-CPU cache was empty */ int pgswapin; /* pages swapped in */ - int pgswapout; /* pages swapped out */ + int pgswapout; /* [a] pages swapped out */ int forks; /* forks */ int forks_ppwait; /* forks where parent waits */ int forks_sharevm; /* forks where vmspace is shared */ - int pga_zerohit; /* pagealloc where zero wanted and zero + int pga_zerohit; /* [a] pagealloc where zero wanted and zero was available */ - int pga_zeromiss; /* pagealloc where zero wanted and zero + int pga_zeromiss; /* [a] pagealloc where zero wanted and zero not available */ int unused09; /* formerly zeroaborts */ @@ -138,23 +139,22 @@ struct uvmexp { int fltnoup; /* [p] # of times fault upgrade failed */ /* daemon counters */ - int pdwoke; /* [F] # of times daemon woke up */ - int pdrevs; /* number of times daemon scanned for free pages */ - int pdswout; /* number of times daemon called for swapout */ - int pdfreed; /* number of pages daemon freed since boot */ - int pdscans; /* number of pages daemon scanned since boot */ - int pdanscan; /* number of anonymous pages scanned by daemon */ - int pdobscan; /* number of object pages scanned by daemon */ - int pdreact; /* number of pages daemon reactivated since boot */ - int pdbusy; /* number of times daemon found a busy page */ - int pdpageouts; /* number of times daemon started a pageout */ - int pdpending; /* number of times daemon got a pending pagout */ - int pddeact; /* number of pages daemon deactivates */ + int pdwoke; /* [ao] # of times daemon woke up */ + int pdrevs; /* [ao] # of times daemon scanned for free pages */ + int pdswout; /* [o] # of times daemon called for swapout */ + int pdfreed; /* [ao] # of pages daemon freed since boot */ + int pdscans; /* [ao] # of pages daemon scanned since boot */ + int pdanscan; /* [ao] # of anonymous pages scanned by daemon */ + int pdobscan; /* [ao] # of object pages scanned by daemon */ + int pdreact; /* [ao] # of pages daemon reactivated since boot */ + int pdbusy; /* [ao] # of times daemon found a busy page */ + int pdpageouts; /* [ao] # of times daemon started a pageout */ + int pdpending; /* [ao] # of times daemon got a pending pagout */ + int pddeact; /* [ao] # of pages daemon deactivates */ + int swpskip; /* [ao] # of pages delayed because swap crypt busy */ - int unused13; /* formerly pdrevtext */ - - int fpswtch; /* FPU context switches */ - int kmapent; /* number of kernel map entries */ + int fpswtch; /* [a] FPU context switches */ + int kmapent; /* [a] number of kernel map entries */ }; struct _ps_strings { @@ -163,6 +163,12 @@ struct _ps_strings { #ifdef _KERNEL +static inline int +atomic_load_sint(volatile const int *p) +{ + return *p; +} + /* * Per-cpu UVM counters. */ diff --git a/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h b/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h index cc0f782bf3..14faf6c185 100644 --- a/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h +++ b/lib/libc/include/mips64-openbsd-none/machine/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.54 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -335,32 +335,6 @@ int octeon_ioclock_speed(void); #endif /* _KERNEL */ #endif /* _KERNEL || _STANDALONE */ -static inline int -ffs64(uint64_t val) -{ - int ret; - - __asm volatile ( \ - _ASM_PROLOGUE_MIPS64 - " dclz %0, %1 \n" - _ASM_EPILOGUE - : "=r"(ret) : "r"(val)); - return 64 - ret; -} - -static inline int -ffs32(uint32_t val) -{ - int ret; - - __asm volatile ( \ - _ASM_PROLOGUE_MIPS64 - " clz %0, %1 \n" - _ASM_EPILOGUE - : "=r"(ret) : "r"(val)); - return 32 - ret; -} - static inline uint64_t octeon_xkphys_read_8(paddr_t address) { diff --git a/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h b/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h index cc0f782bf3..14faf6c185 100644 --- a/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h +++ b/lib/libc/include/mips64-openbsd-none/octeon/octeonvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: octeonvar.h,v 1.54 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: octeonvar.h,v 1.55 2025/12/30 22:55:07 jsg Exp $ */ /* $NetBSD: maltavar.h,v 1.3 2002/03/18 10:10:16 simonb Exp $ */ /*- @@ -335,32 +335,6 @@ int octeon_ioclock_speed(void); #endif /* _KERNEL */ #endif /* _KERNEL || _STANDALONE */ -static inline int -ffs64(uint64_t val) -{ - int ret; - - __asm volatile ( \ - _ASM_PROLOGUE_MIPS64 - " dclz %0, %1 \n" - _ASM_EPILOGUE - : "=r"(ret) : "r"(val)); - return 64 - ret; -} - -static inline int -ffs32(uint32_t val) -{ - int ret; - - __asm volatile ( \ - _ASM_PROLOGUE_MIPS64 - " clz %0, %1 \n" - _ASM_EPILOGUE - : "=r"(ret) : "r"(val)); - return 32 - ret; -} - static inline uint64_t octeon_xkphys_read_8(paddr_t address) { diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h b/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h index 99c4026f96..6e12da5dc5 100644 --- a/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h +++ b/lib/libc/include/mips64el-openbsd-none/loongson/apmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apmvar.h,v 1.6 2019/01/22 02:36:30 phessler Exp $ */ +/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */ /* * Copyright (c) 2001 Alexander Guy diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/hibernate.h b/lib/libc/include/mips64el-openbsd-none/loongson/hibernate.h deleted file mode 100644 index f0a99c6df6..0000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/hibernate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* $OpenBSD: hibernate.h,v 1.3 2018/06/21 07:33:30 mlarkin Exp $ */ - -/* - * Copyright (c) 2013 Paul Irofti. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#include - -/* Loongson hibernate support structures and functions */ - -int get_hibernate_info_md(union hibernate_info *); -void hibernate_flush(void); -void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int); -int hibernate_inflate_skip(union hibernate_info *, paddr_t); -int hibernate_suspend(void); -void hibernate_switch_stack_machdep(void); -void hibernate_resume_machdep(vaddr_t); -void hibernate_activate_resume_pt_machdep(void); -void hibernate_enable_intr_machdep(void); -void hibernate_disable_intr_machdep(void); \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/hibernate_var.h b/lib/libc/include/mips64el-openbsd-none/loongson/hibernate_var.h deleted file mode 100644 index de84657a4b..0000000000 --- a/lib/libc/include/mips64el-openbsd-none/loongson/hibernate_var.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: hibernate_var.h,v 1.1 2013/06/02 21:46:04 pirofti Exp $ */ - -/* - * Copyright (c) 2013 Paul Irofti. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Loongson hibernate support definitions */ - -#define PAGE_MASK_4M ((256 * PAGE_SIZE) - 1) - -#define PIGLET_PAGE_MASK ~((paddr_t)PAGE_MASK_4M) - -/* - * Steal hibernate pages right after the first page which is reserved - * for the exception area. - * */ -#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 1) -#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 2) -#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 3) -#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 4) - -#define HIBERNATE_RESERVED_PAGES 4 - -/* Use 4MB hibernation chunks */ -#define HIBERNATE_CHUNK_SIZE 0x400000 - -#define HIBERNATE_CHUNK_TABLE_SIZE 0x100000 \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/loongson/param.h b/lib/libc/include/mips64el-openbsd-none/loongson/param.h index cd410bd602..17092fa4a5 100644 --- a/lib/libc/include/mips64el-openbsd-none/loongson/param.h +++ b/lib/libc/include/mips64el-openbsd-none/loongson/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */ /* Public Domain */ @@ -13,8 +13,6 @@ #define _MACHINE_CPU mips64 #define MID_MACHINE MID_MIPS64 -#ifdef _KERNEL - /* * The Loongson level 1 cache expects software to prevent virtual * aliases. Unfortunately, since this cache is physically tagged, @@ -24,8 +22,6 @@ */ #define PAGE_SHIFT 14 -#endif /* _KERNEL */ - #include #endif /* _MACHINE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h b/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h index 99c4026f96..6e12da5dc5 100644 --- a/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h +++ b/lib/libc/include/mips64el-openbsd-none/machine/apmvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: apmvar.h,v 1.6 2019/01/22 02:36:30 phessler Exp $ */ +/* $OpenBSD: apmvar.h,v 1.8 2026/04/09 05:03:42 miod Exp $ */ /* * Copyright (c) 2001 Alexander Guy diff --git a/lib/libc/include/mips64el-openbsd-none/machine/hibernate.h b/lib/libc/include/mips64el-openbsd-none/machine/hibernate.h deleted file mode 100644 index f0a99c6df6..0000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/hibernate.h +++ /dev/null @@ -1,33 +0,0 @@ -/* $OpenBSD: hibernate.h,v 1.3 2018/06/21 07:33:30 mlarkin Exp $ */ - -/* - * Copyright (c) 2013 Paul Irofti. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - - -#include - -/* Loongson hibernate support structures and functions */ - -int get_hibernate_info_md(union hibernate_info *); -void hibernate_flush(void); -void hibernate_enter_resume_mapping(vaddr_t, paddr_t, int); -int hibernate_inflate_skip(union hibernate_info *, paddr_t); -int hibernate_suspend(void); -void hibernate_switch_stack_machdep(void); -void hibernate_resume_machdep(vaddr_t); -void hibernate_activate_resume_pt_machdep(void); -void hibernate_enable_intr_machdep(void); -void hibernate_disable_intr_machdep(void); \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/hibernate_var.h b/lib/libc/include/mips64el-openbsd-none/machine/hibernate_var.h deleted file mode 100644 index de84657a4b..0000000000 --- a/lib/libc/include/mips64el-openbsd-none/machine/hibernate_var.h +++ /dev/null @@ -1,39 +0,0 @@ -/* $OpenBSD: hibernate_var.h,v 1.1 2013/06/02 21:46:04 pirofti Exp $ */ - -/* - * Copyright (c) 2013 Paul Irofti. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* Loongson hibernate support definitions */ - -#define PAGE_MASK_4M ((256 * PAGE_SIZE) - 1) - -#define PIGLET_PAGE_MASK ~((paddr_t)PAGE_MASK_4M) - -/* - * Steal hibernate pages right after the first page which is reserved - * for the exception area. - * */ -#define HIBERNATE_STACK_PAGE (PAGE_SIZE * 1) -#define HIBERNATE_INFLATE_PAGE (PAGE_SIZE * 2) -#define HIBERNATE_COPY_PAGE (PAGE_SIZE * 3) -#define HIBERNATE_HIBALLOC_PAGE (PAGE_SIZE * 4) - -#define HIBERNATE_RESERVED_PAGES 4 - -/* Use 4MB hibernation chunks */ -#define HIBERNATE_CHUNK_SIZE 0x400000 - -#define HIBERNATE_CHUNK_TABLE_SIZE 0x100000 \ No newline at end of file diff --git a/lib/libc/include/mips64el-openbsd-none/machine/param.h b/lib/libc/include/mips64el-openbsd-none/machine/param.h index cd410bd602..17092fa4a5 100644 --- a/lib/libc/include/mips64el-openbsd-none/machine/param.h +++ b/lib/libc/include/mips64el-openbsd-none/machine/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.3 2013/03/23 16:12:23 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.4 2025/12/03 11:59:18 miod Exp $ */ /* Public Domain */ @@ -13,8 +13,6 @@ #define _MACHINE_CPU mips64 #define MID_MACHINE MID_MIPS64 -#ifdef _KERNEL - /* * The Loongson level 1 cache expects software to prevent virtual * aliases. Unfortunately, since this cache is physically tagged, @@ -24,8 +22,6 @@ */ #define PAGE_SHIFT 14 -#endif /* _KERNEL */ - #include #endif /* _MACHINE_PARAM_H_ */ \ No newline at end of file diff --git a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h index 552a8e48d2..6cda42ba12 100644 --- a/lib/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h +++ b/lib/libc/include/powerpc-openbsd-eabihf/powerpc/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.57 2025/05/10 09:54:17 visa Exp $ */ +/* $OpenBSD: intr.h,v 1.58 2026/01/04 23:51:12 jsg Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. @@ -64,7 +64,6 @@ #if defined(_KERNEL) && !defined(_LOCORE) #include -#include #define PPC_NIRQ 66 #define PPC_CLK_IRQ 64 @@ -111,8 +110,6 @@ void splassert_check(int, const char *); #define splsoftassert(wantipl) do { /* nada */ } while (0) #endif -#define set_sint(p) atomic_setbits_int(&curcpu()->ci_ipending, p) - #define splbio() splraise(IPL_BIO) #define splnet() splraise(IPL_NET) #define spltty() splraise(IPL_TTY) diff --git a/lib/libc/include/powerpc64-openbsd-none/machine/atomic.h b/lib/libc/include/powerpc64-openbsd-none/machine/atomic.h index 277291b926..25f3585c97 100644 --- a/lib/libc/include/powerpc64-openbsd-none/machine/atomic.h +++ b/lib/libc/include/powerpc64-openbsd-none/machine/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.3 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: atomic.h,v 1.4 2025/11/18 05:24:38 gkoehler Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v) #define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0) #if defined(MULTIPROCESSOR) || !defined(_KERNEL) -#define membar_enter() __membar("isync") +#define membar_enter() __membar("sync") #define membar_exit() __membar("sync") #define membar_producer() __membar("sync") -#define membar_consumer() __membar("isync") +#define membar_consumer() __membar("sync") #define membar_sync() __membar("sync") #else #define membar_enter() __membar("") diff --git a/lib/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h b/lib/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h index 277291b926..25f3585c97 100644 --- a/lib/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h +++ b/lib/libc/include/powerpc64-openbsd-none/powerpc64/atomic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: atomic.h,v 1.3 2022/08/29 02:01:18 jsg Exp $ */ +/* $OpenBSD: atomic.h,v 1.4 2025/11/18 05:24:38 gkoehler Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -276,10 +276,10 @@ _atomic_addic_long_nv(volatile unsigned long *p, unsigned long v) #define __membar(_f) do { __asm volatile(_f ::: "memory"); } while (0) #if defined(MULTIPROCESSOR) || !defined(_KERNEL) -#define membar_enter() __membar("isync") +#define membar_enter() __membar("sync") #define membar_exit() __membar("sync") #define membar_producer() __membar("sync") -#define membar_consumer() __membar("isync") +#define membar_consumer() __membar("sync") #define membar_sync() __membar("sync") #else #define membar_enter() __membar("") diff --git a/lib/libc/include/riscv64-openbsd-none/machine/cpu.h b/lib/libc/include/riscv64-openbsd-none/machine/cpu.h index 8e6ecc4dca..cb55a811b5 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.24 2024/06/11 16:02:35 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */ /* * Copyright (c) 2019 Mike Larkin @@ -141,13 +141,9 @@ struct cpu_info { #define CPUF_GO (1<<5) #define CPUF_RUNNING (1<<6) -static inline struct cpu_info * -curcpu(void) -{ - struct cpu_info *__ci = NULL; - __asm volatile("mv %0, tp" : "=&r"(__ci)); - return (__ci); -} +register struct cpu_info *__curcpu asm ("tp"); + +#define curcpu() (__curcpu) extern uint32_t boot_hart; /* The hart we booted on. */ extern struct cpu_info cpu_info_primary; diff --git a/lib/libc/include/riscv64-openbsd-none/machine/cpufunc.h b/lib/libc/include/riscv64-openbsd-none/machine/cpufunc.h index f4b61288bb..e4fb12e83c 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/cpufunc.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.6 2023/08/21 20:17:30 miod Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.7 2026/04/05 11:48:17 kettenis Exp $ */ /*- * Copyright (c) 2014 Andrew Turner @@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid) extern int64_t dcache_line_size; extern int64_t icache_line_size; -extern void (*cpu_dcache_wbinv_range)(paddr_t, psize_t); -extern void (*cpu_dcache_inv_range)(paddr_t, psize_t); -extern void (*cpu_dcache_wb_range)(paddr_t, psize_t); +extern void (*cpu_dcache_wbinv_range)(vaddr_t, vsize_t); +extern void (*cpu_dcache_inv_range)(vaddr_t, vsize_t); +extern void (*cpu_dcache_wb_range)(vaddr_t, vsize_t); static __inline void load_satp(uint64_t val) diff --git a/lib/libc/include/riscv64-openbsd-none/machine/pmap.h b/lib/libc/include/riscv64-openbsd-none/machine/pmap.h index d6e867d90f..85f6e1161f 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/pmap.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.14 2025/02/03 17:59:40 jca Exp $ */ +/* $OpenBSD: pmap.h,v 1.15 2026/04/05 11:48:17 kettenis Exp $ */ /* * Copyright (c) 2019-2020 Brian Bamsch @@ -75,6 +75,10 @@ struct pmap { #define PMAP_NOCACHE 0x1 /* non-cacheable memory */ #define PMAP_DEVICE 0x2 /* device memory */ +extern uint64_t pmap_pma; +extern uint64_t pmap_nc; +extern uint64_t pmap_io; + #define PG_PMAP_MOD PG_PMAP0 #define PG_PMAP_REF PG_PMAP1 #define PG_PMAP_EXE PG_PMAP2 diff --git a/lib/libc/include/riscv64-openbsd-none/machine/pte.h b/lib/libc/include/riscv64-openbsd-none/machine/pte.h index c050e38cb2..eebac6727e 100644 --- a/lib/libc/include/riscv64-openbsd-none/machine/pte.h +++ b/lib/libc/include/riscv64-openbsd-none/machine/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.4 2024/10/14 12:02:16 jsg Exp $ */ +/* $OpenBSD: pte.h,v 1.5 2026/04/05 11:48:17 kettenis Exp $ */ /* * Copyright (c) 2019 Brian Bamsch @@ -38,6 +38,14 @@ #define PTE_RX (PTE_R | PTE_X) #define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D) +/* Svpmbt extension */ +#define PTE_PMA (0ULL << 61) +#define PTE_NC (1ULL << 61) +#define PTE_IO (2ULL << 61) + +/* Svnapot extension */ +#define PTE_N (1ULL << 63) + /* T-Head extended page attributes */ #define PTE_THEAD_SO (1ULL << 63) #define PTE_THEAD_C (1ULL << 62) diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h b/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h index 8e6ecc4dca..cb55a811b5 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.24 2024/06/11 16:02:35 jca Exp $ */ +/* $OpenBSD: cpu.h,v 1.25 2026/04/06 08:10:54 jca Exp $ */ /* * Copyright (c) 2019 Mike Larkin @@ -141,13 +141,9 @@ struct cpu_info { #define CPUF_GO (1<<5) #define CPUF_RUNNING (1<<6) -static inline struct cpu_info * -curcpu(void) -{ - struct cpu_info *__ci = NULL; - __asm volatile("mv %0, tp" : "=&r"(__ci)); - return (__ci); -} +register struct cpu_info *__curcpu asm ("tp"); + +#define curcpu() (__curcpu) extern uint32_t boot_hart; /* The hart we booted on. */ extern struct cpu_info cpu_info_primary; diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h b/lib/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h index f4b61288bb..e4fb12e83c 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.6 2023/08/21 20:17:30 miod Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.7 2026/04/05 11:48:17 kettenis Exp $ */ /*- * Copyright (c) 2014 Andrew Turner @@ -89,9 +89,9 @@ sfence_vma_page_asid(uintptr_t addr, uint64_t asid) extern int64_t dcache_line_size; extern int64_t icache_line_size; -extern void (*cpu_dcache_wbinv_range)(paddr_t, psize_t); -extern void (*cpu_dcache_inv_range)(paddr_t, psize_t); -extern void (*cpu_dcache_wb_range)(paddr_t, psize_t); +extern void (*cpu_dcache_wbinv_range)(vaddr_t, vsize_t); +extern void (*cpu_dcache_inv_range)(vaddr_t, vsize_t); +extern void (*cpu_dcache_wb_range)(vaddr_t, vsize_t); static __inline void load_satp(uint64_t val) diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/pmap.h b/lib/libc/include/riscv64-openbsd-none/riscv64/pmap.h index d6e867d90f..85f6e1161f 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/pmap.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/pmap.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.h,v 1.14 2025/02/03 17:59:40 jca Exp $ */ +/* $OpenBSD: pmap.h,v 1.15 2026/04/05 11:48:17 kettenis Exp $ */ /* * Copyright (c) 2019-2020 Brian Bamsch @@ -75,6 +75,10 @@ struct pmap { #define PMAP_NOCACHE 0x1 /* non-cacheable memory */ #define PMAP_DEVICE 0x2 /* device memory */ +extern uint64_t pmap_pma; +extern uint64_t pmap_nc; +extern uint64_t pmap_io; + #define PG_PMAP_MOD PG_PMAP0 #define PG_PMAP_REF PG_PMAP1 #define PG_PMAP_EXE PG_PMAP2 diff --git a/lib/libc/include/riscv64-openbsd-none/riscv64/pte.h b/lib/libc/include/riscv64-openbsd-none/riscv64/pte.h index c050e38cb2..eebac6727e 100644 --- a/lib/libc/include/riscv64-openbsd-none/riscv64/pte.h +++ b/lib/libc/include/riscv64-openbsd-none/riscv64/pte.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pte.h,v 1.4 2024/10/14 12:02:16 jsg Exp $ */ +/* $OpenBSD: pte.h,v 1.5 2026/04/05 11:48:17 kettenis Exp $ */ /* * Copyright (c) 2019 Brian Bamsch @@ -38,6 +38,14 @@ #define PTE_RX (PTE_R | PTE_X) #define PTE_KERN (PTE_V | PTE_R | PTE_W | PTE_A | PTE_D) +/* Svpmbt extension */ +#define PTE_PMA (0ULL << 61) +#define PTE_NC (1ULL << 61) +#define PTE_IO (2ULL << 61) + +/* Svnapot extension */ +#define PTE_N (1ULL << 63) + /* T-Head extended page attributes */ #define PTE_THEAD_SO (1ULL << 63) #define PTE_THEAD_C (1ULL << 62) diff --git a/lib/libc/include/x86-openbsd-none/i386/specialreg.h b/lib/libc/include/x86-openbsd-none/i386/specialreg.h index 6024995d82..d6872cec0b 100644 --- a/lib/libc/include/x86-openbsd-none/i386/specialreg.h +++ b/lib/libc/include/x86-openbsd-none/i386/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.85 2023/08/16 04:07:38 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */ /*- @@ -528,6 +528,8 @@ #define MSR_PATCH_LOADER 0xc0010020 #define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */ +#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */ +#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */ #define MSR_DE_CFG 0xc0011029 /* Decode Configuration */ #define DE_CFG_721 0x00000001 /* errata 721 */ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ diff --git a/lib/libc/include/x86-openbsd-none/machine/specialreg.h b/lib/libc/include/x86-openbsd-none/machine/specialreg.h index 6024995d82..d6872cec0b 100644 --- a/lib/libc/include/x86-openbsd-none/machine/specialreg.h +++ b/lib/libc/include/x86-openbsd-none/machine/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.85 2023/08/16 04:07:38 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.86 2026/04/19 01:10:28 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.7 1994/10/27 04:16:26 cgd Exp $ */ /*- @@ -528,6 +528,8 @@ #define MSR_PATCH_LOADER 0xc0010020 #define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */ +#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */ +#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */ #define MSR_DE_CFG 0xc0011029 /* Decode Configuration */ #define DE_CFG_721 0x00000001 /* errata 721 */ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/conf.h b/lib/libc/include/x86_64-openbsd-none/amd64/conf.h index bd23d33ba7..cce75d8967 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/conf.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.11 2024/09/04 07:45:08 jsg Exp $ */ +/* $OpenBSD: conf.h,v 1.12 2025/11/12 11:34:36 hshoexer Exp $ */ /* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ /* @@ -56,4 +56,13 @@ cdev_decl(pctr); cdev_decl(vmm); #include "psp.h" -cdev_decl(psp); \ No newline at end of file +cdev_decl(psp); + +#include "kexec.h" +#define cdev_kexec_init(c,n) { \ + dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ + (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ + (dev_type_stop((*))) nullop, 0, \ + (dev_type_mmap((*))) enodev } + +cdev_decl(kexec); \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h b/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h index d3cab29e55..cc0b57cdb6 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.180 2025/04/28 16:18:25 bluhm Exp $ */ +/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -53,6 +53,7 @@ #include #include #include +#include #include #ifdef _KERNEL @@ -187,6 +188,7 @@ struct cpu_info { int ci_inatomic; /* [o] */ #define __HAVE_CPU_TOPOLOGY + u_int32_t ci_cputype; /* [I] */ u_int32_t ci_smt_id; /* [I] */ u_int32_t ci_core_id; /* [I] */ u_int32_t ci_pkg_id; /* [I] */ @@ -215,6 +217,7 @@ struct cpu_info { #ifdef MULTIPROCESSOR struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; + struct xcall_cpu ci_xcall; #define __HAVE_UVM_PERCPU struct uvm_pmr_cache ci_uvm; /* [o] page cache */ #endif @@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *); #if defined(MULTIPROCESSOR) -#define MAXCPUS 64 /* bitmask */ +#define MAXCPUS 255 #define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) #define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) @@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void); #define cpu_idle_leave() do { /* nothing */ } while (0) extern void (*initclock_func)(void); extern void (*startclock_func)(void); +extern int hibernate_delay; struct region_descriptor; void lgdt(struct region_descriptor *); @@ -444,6 +448,9 @@ void startclocks(void); void rtcinit(void); void rtcstart(void); void rtcstop(void); +int rtcalarm_suspend(struct timeval *tv); +void rtcalarm_resume(void); +int rtcalarm_fired(void); void i8254_delay(int); void i8254_initclocks(void); void i8254_startclock(void); @@ -496,13 +503,15 @@ void mp_setperf_init(void); #define CPU_CPUFEATURE 8 /* cpuid features */ #define CPU_KBDRESET 10 /* keyboard reset under pcvt */ #define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */ +#define CPU_HIBERNATEDELAY 13 /* hibernate delay after suspend */ #define CPU_LIDACTION 14 /* action caused by lid close */ #define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */ #define CPU_TSCFREQ 16 /* TSC frequency */ #define CPU_INVARIANTTSC 17 /* has invariant TSC */ #define CPU_PWRACTION 18 /* action caused by power button */ #define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */ -#define CPU_MAXID 20 /* number of valid machdep ids */ +#define CPU_VMMODE 20 /* virtualization mode */ +#define CPU_MAXID 21 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -518,13 +527,14 @@ void mp_setperf_init(void); { "kbdreset", CTLTYPE_INT }, \ { 0, 0 }, \ { "xcrypt", CTLTYPE_INT }, \ - { 0, 0 }, \ + { "hibernatedelay", CTLTYPE_INT }, \ { "lidaction", CTLTYPE_INT }, \ { "forceukbd", CTLTYPE_INT }, \ { "tscfreq", CTLTYPE_QUAD }, \ { "invarianttsc", CTLTYPE_INT }, \ { "pwraction", CTLTYPE_INT }, \ { "retpoline", CTLTYPE_INT }, \ + { "vmmode", CTLTYPE_STRING }, \ } #endif /* !_MACHINE_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h b/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h index 6a8420e179..0f7b5cccf2 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.45 2025/06/27 17:23:49 bluhm Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -249,7 +249,7 @@ rdmsr(u_int msr) return (((uint64_t)hi << 32) | (uint64_t) lo); } -static __inline int +static __inline uint32_t rdpkru(u_int ecx) { uint32_t edx, pkru; @@ -304,7 +304,6 @@ wbinvd(void) #ifdef MULTIPROCESSOR int wbinvd_on_all_cpus(void); -void wbinvd_on_all_cpus_acked(void); #else static inline int wbinvd_on_all_cpus(void) diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h b/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h index 73f9484212..159b8d5727 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/ghcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ghcb.h,v 1.6 2025/09/17 18:37:44 sf Exp $ */ +/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */ /* * Copyright (c) 2024, 2025 Hans-Joerg Hoexer @@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int); int ghcb_valbm_isset(uint8_t *, int); int ghcb_verify_bm(uint8_t *, uint8_t *); int ghcb_valid(struct ghcb_sa *); +int ghcb_empty(struct ghcb_sa *); void ghcb_sync_val(int, int, struct ghcb_sync *); void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *, diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/i82489var.h b/lib/libc/include/x86_64-openbsd-none/amd64/i82489var.h index 4477a13266..cc40bc0e60 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/i82489var.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/i82489var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489var.h,v 1.21 2024/11/07 17:24:42 bluhm Exp $ */ +/* $OpenBSD: i82489var.h,v 1.22 2025/11/12 09:48:52 hshoexer Exp $ */ /* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void); #define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0) #define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1) #define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2) -#define LAPIC_IPI_WBINVD (LAPIC_IPI_OFFSET + 3) -#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 4) +#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 3) extern void Xipi_invltlb(void); extern void Xipi_invltlb_pcid(void); @@ -81,7 +80,6 @@ extern void Xipi_invlpg(void); extern void Xipi_invlpg_pcid(void); extern void Xipi_invlrange(void); extern void Xipi_invlrange_pcid(void); -extern void Xipi_wbinvd(void); #if NVMM > 0 extern void Xipi_invept(void); #endif /* NVMM > 0 */ diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/i8259.h b/lib/libc/include/x86_64-openbsd-none/amd64/i8259.h index 28bdcd4743..2448f22f78 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/i8259.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/i8259.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i8259.h,v 1.4 2015/09/02 13:39:23 mikeb Exp $ */ +/* $OpenBSD: i8259.h,v 1.5 2026/01/15 15:43:45 sf Exp $ */ /* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */ /*- @@ -63,82 +63,30 @@ extern void i8259_default_setup(void); #define ICU_LEN 16 /* 32-47 are ISA interrupts */ -#define ICU_HARDWARE_MASK - -/* - * These macros are fairly self explanatory. If ICU_SPECIAL_MASK_MODE is - * defined, we try to take advantage of the ICU's `special mask mode' by only - * EOIing the interrupts on return. This avoids the requirement of masking and - * unmasking. We can't do this without special mask mode, because the ICU - * would also hold interrupts that it thinks are of lower priority. - * - * Many machines do not support special mask mode, so by default we don't try - * to use it. - */ - #define IRQ_BIT(num) (1 << ((num) % 8)) #define IRQ_BYTE(num) ((num) >> 3) #define i8259_late_ack(num) -#ifdef ICU_SPECIAL_MASK_MODE - -#define i8259_asm_ack1(num) -#define i8259_asm_ack2(num) \ - movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\ - outb %al,$IO_ICU1 -#define i8259_asm_mask(num) -#define i8259_asm_unmask(num) \ - movb $(0x60|(num%8)),%al /* specific EOI */ ;\ - outb %al,$ICUADDR - -#else /* ICU_SPECIAL_MASK_MODE */ - -#ifndef AUTO_EOI_1 #define i8259_asm_ack1(num) \ movb $(0x60|(num%8)),%al /* specific EOI */ ;\ outb %al,$IO_ICU1 -#else -#define i8259_asm_ack1(num) -#endif -#ifndef AUTO_EOI_2 #define i8259_asm_ack2(num) \ movb $(0x60|(num%8)),%al /* specific EOI */ ;\ outb %al,$IO_ICU2 /* do the second ICU first */ ;\ movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\ outb %al,$IO_ICU1 -#else -#define i8259_asm_ack2(num) -#endif - -#ifdef PIC_MASKDELAY -#define MASKDELAY pushl %eax ; inb $0x84,%al ; popl %eax -#else -#define MASKDELAY -#endif - -#ifdef ICU_HARDWARE_MASK #define i8259_asm_mask(num) \ movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\ orb $IRQ_BIT(num),%al ;\ movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\ - MASKDELAY ;\ outb %al,$(ICUADDR+1) #define i8259_asm_unmask(num) \ movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\ andb $~IRQ_BIT(num),%al ;\ movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\ - MASKDELAY ;\ outb %al,$(ICUADDR+1) -#else /* ICU_HARDWARE_MASK */ - -#define i8259_asm_mask(num) -#define i8259_asm_unmask(num) - -#endif /* ICU_HARDWARE_MASK */ -#endif /* ICU_SPECIAL_MASK_MODE */ - #endif /* !_MACHINE_I8259_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/intr.h b/lib/libc/include/x86_64-openbsd-none/amd64/intr.h index ca5fda2141..16ae57464a 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/intr.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.36 2025/06/11 09:57:01 kettenis Exp $ */ +/* $OpenBSD: intr.h,v 1.37 2025/11/10 12:34:52 dlg Exp $ */ /* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ /*- @@ -222,7 +222,10 @@ void x86_ipi_handler(void); void x86_setperf_ipi(struct cpu_info *); extern void (*ipifunc[X86_NIPI])(struct cpu_info *); -#endif + +#define cpu_xcall_ipi(_ci) x86_send_ipi((_ci), X86_IPI_XCALL) +void Xxcallintr(void); +#endif /* MULTIPROCESSOR */ #endif /* !_LOCORE */ diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/intrdefs.h b/lib/libc/include/x86_64-openbsd-none/amd64/intrdefs.h index 54fe1358ca..b09691e40e 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/intrdefs.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/intrdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intrdefs.h,v 1.24 2024/05/26 13:37:31 kettenis Exp $ */ +/* $OpenBSD: intrdefs.h,v 1.25 2025/11/10 12:34:52 dlg Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ #ifndef _AMD64_INTRDEFS_H @@ -52,12 +52,13 @@ #define LIR_TIMER 62 /* Soft interrupt masks. */ -#define SIR_CLOCK 61 -#define SIR_NET 60 -#define SIR_TTY 59 +#define SIR_XCALL 61 +#define SIR_CLOCK 60 +#define SIR_NET 59 +#define SIR_TTY 58 -#define LIR_XEN 58 -#define LIR_HYPERV 57 +#define LIR_XEN 57 +#define LIR_HYPERV 56 /* * Maximum # of interrupt sources per CPU. 64 to fit in one word. @@ -85,8 +86,9 @@ #define X86_IPI_START_VMM 0x00000100 #define X86_IPI_STOP_VMM 0x00000200 #define X86_IPI_WBINVD 0x00000400 +#define X86_IPI_XCALL 0x00000800 -#define X86_NIPI 12 +#define X86_NIPI 13 #define IREENT_MAGIC 0x18041969 diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/kexec.h b/lib/libc/include/x86_64-openbsd-none/amd64/kexec.h new file mode 100644 index 0000000000..11c0eeba52 --- /dev/null +++ b/lib/libc/include/x86_64-openbsd-none/amd64/kexec.h @@ -0,0 +1,48 @@ +/* $OpenBSD: kexec.h,v 1.1 2025/11/12 11:34:36 hshoexer Exp $ */ + +/* + * Copyright (c) 2019-2020 Visa Hankala + * Copyright (c) 2025 Hans-Joerg Hoexer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_KEXEC_H_ +#define _MACHINE_KEXEC_H_ + +#include + +#define KEXEC_TRAMPOLINE (35 * NBPG) /* @ 140 Kb */ +#define KEXEC_TRAMP_DATA (36 * NBPG) +#define PA_KERN (16*1024*1024) /* @ 16 Mb */ + +#ifndef _LOCORE + +#define KEXEC_MAX_ARGS 8 /* maximum number of boot arguments */ + +struct kexec_args { + char *kimg; /* kernel image buffer */ + size_t klen; /* size of kernel image */ + int boothowto; + u_char bootduid[8]; +}; + +#define KIOC_KEXEC _IOW('K', 1, struct kexec_args) +#define KIOC_GETBOOTDUID _IOR('K', 2, u_char[8]) + +extern unsigned int kexec_size; +extern void kexec_tramp(vaddr_t, vaddr_t, paddr_t, size_t, vaddr_t); + +#endif /* !_LOCORE */ + +#endif /* _MACHINE_KEXEC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h b/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h index fc0770c81d..7f3b7d6c84 100644 --- a/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h +++ b/lib/libc/include/x86_64-openbsd-none/amd64/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.120 2025/07/16 07:15:41 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ /* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */ @@ -699,9 +699,12 @@ #define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */ #define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */ #define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */ +#define MSR_SYS_CFG 0xc0010010 /* System Configuration */ #define MSR_PATCH_LOADER 0xc0010020 #define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */ +#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */ +#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */ #define MSR_DE_CFG 0xc0011029 /* Decode Configuration */ #define DE_CFG_721 0x00000001 /* errata 721 */ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */ diff --git a/lib/libc/include/x86_64-openbsd-none/machine/conf.h b/lib/libc/include/x86_64-openbsd-none/machine/conf.h index bd23d33ba7..cce75d8967 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/conf.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/conf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.h,v 1.11 2024/09/04 07:45:08 jsg Exp $ */ +/* $OpenBSD: conf.h,v 1.12 2025/11/12 11:34:36 hshoexer Exp $ */ /* $NetBSD: conf.h,v 1.2 1996/05/05 19:28:34 christos Exp $ */ /* @@ -56,4 +56,13 @@ cdev_decl(pctr); cdev_decl(vmm); #include "psp.h" -cdev_decl(psp); \ No newline at end of file +cdev_decl(psp); + +#include "kexec.h" +#define cdev_kexec_init(c,n) { \ + dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \ + (dev_type_write((*))) enodev, dev_init(c,n,ioctl), \ + (dev_type_stop((*))) nullop, 0, \ + (dev_type_mmap((*))) enodev } + +cdev_decl(kexec); \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/cpu.h b/lib/libc/include/x86_64-openbsd-none/machine/cpu.h index d3cab29e55..cc0b57cdb6 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/cpu.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.180 2025/04/28 16:18:25 bluhm Exp $ */ +/* $OpenBSD: cpu.h,v 1.185 2026/03/31 16:46:22 deraadt Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -53,6 +53,7 @@ #include #include #include +#include #include #ifdef _KERNEL @@ -187,6 +188,7 @@ struct cpu_info { int ci_inatomic; /* [o] */ #define __HAVE_CPU_TOPOLOGY + u_int32_t ci_cputype; /* [I] */ u_int32_t ci_smt_id; /* [I] */ u_int32_t ci_core_id; /* [I] */ u_int32_t ci_pkg_id; /* [I] */ @@ -215,6 +217,7 @@ struct cpu_info { #ifdef MULTIPROCESSOR struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM]; + struct xcall_cpu ci_xcall; #define __HAVE_UVM_PERCPU struct uvm_pmr_cache ci_uvm; /* [o] page cache */ #endif @@ -289,7 +292,7 @@ extern void need_resched(struct cpu_info *); #if defined(MULTIPROCESSOR) -#define MAXCPUS 64 /* bitmask */ +#define MAXCPUS 255 #define CPU_STARTUP(_ci) ((_ci)->ci_func->start(_ci)) #define CPU_STOP(_ci) ((_ci)->ci_func->stop(_ci)) @@ -431,6 +434,7 @@ extern void (*cpu_suspend_cycle_fcn)(void); #define cpu_idle_leave() do { /* nothing */ } while (0) extern void (*initclock_func)(void); extern void (*startclock_func)(void); +extern int hibernate_delay; struct region_descriptor; void lgdt(struct region_descriptor *); @@ -444,6 +448,9 @@ void startclocks(void); void rtcinit(void); void rtcstart(void); void rtcstop(void); +int rtcalarm_suspend(struct timeval *tv); +void rtcalarm_resume(void); +int rtcalarm_fired(void); void i8254_delay(int); void i8254_initclocks(void); void i8254_startclock(void); @@ -496,13 +503,15 @@ void mp_setperf_init(void); #define CPU_CPUFEATURE 8 /* cpuid features */ #define CPU_KBDRESET 10 /* keyboard reset under pcvt */ #define CPU_XCRYPT 12 /* supports VIA xcrypt in userland */ +#define CPU_HIBERNATEDELAY 13 /* hibernate delay after suspend */ #define CPU_LIDACTION 14 /* action caused by lid close */ #define CPU_FORCEUKBD 15 /* Force ukbd(4) as console keyboard */ #define CPU_TSCFREQ 16 /* TSC frequency */ #define CPU_INVARIANTTSC 17 /* has invariant TSC */ #define CPU_PWRACTION 18 /* action caused by power button */ #define CPU_RETPOLINE 19 /* cpu requires retpoline pattern */ -#define CPU_MAXID 20 /* number of valid machdep ids */ +#define CPU_VMMODE 20 /* virtualization mode */ +#define CPU_MAXID 21 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ @@ -518,13 +527,14 @@ void mp_setperf_init(void); { "kbdreset", CTLTYPE_INT }, \ { 0, 0 }, \ { "xcrypt", CTLTYPE_INT }, \ - { 0, 0 }, \ + { "hibernatedelay", CTLTYPE_INT }, \ { "lidaction", CTLTYPE_INT }, \ { "forceukbd", CTLTYPE_INT }, \ { "tscfreq", CTLTYPE_QUAD }, \ { "invarianttsc", CTLTYPE_INT }, \ { "pwraction", CTLTYPE_INT }, \ { "retpoline", CTLTYPE_INT }, \ + { "vmmode", CTLTYPE_STRING }, \ } #endif /* !_MACHINE_CPU_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h b/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h index 6a8420e179..0f7b5cccf2 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/cpufunc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpufunc.h,v 1.45 2025/06/27 17:23:49 bluhm Exp $ */ +/* $OpenBSD: cpufunc.h,v 1.47 2025/12/30 03:19:15 jsg Exp $ */ /* $NetBSD: cpufunc.h,v 1.3 2003/05/08 10:27:43 fvdl Exp $ */ /*- @@ -249,7 +249,7 @@ rdmsr(u_int msr) return (((uint64_t)hi << 32) | (uint64_t) lo); } -static __inline int +static __inline uint32_t rdpkru(u_int ecx) { uint32_t edx, pkru; @@ -304,7 +304,6 @@ wbinvd(void) #ifdef MULTIPROCESSOR int wbinvd_on_all_cpus(void); -void wbinvd_on_all_cpus_acked(void); #else static inline int wbinvd_on_all_cpus(void) diff --git a/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h b/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h index 73f9484212..159b8d5727 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/ghcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ghcb.h,v 1.6 2025/09/17 18:37:44 sf Exp $ */ +/* $OpenBSD: ghcb.h,v 1.7 2026/02/16 15:06:03 hshoexer Exp $ */ /* * Copyright (c) 2024, 2025 Hans-Joerg Hoexer @@ -128,6 +128,7 @@ int ghcb_valbm_set(uint8_t *, int); int ghcb_valbm_isset(uint8_t *, int); int ghcb_verify_bm(uint8_t *, uint8_t *); int ghcb_valid(struct ghcb_sa *); +int ghcb_empty(struct ghcb_sa *); void ghcb_sync_val(int, int, struct ghcb_sync *); void ghcb_sync_out(struct trapframe *, const struct ghcb_extra_regs *, diff --git a/lib/libc/include/x86_64-openbsd-none/machine/i82489var.h b/lib/libc/include/x86_64-openbsd-none/machine/i82489var.h index 4477a13266..cc40bc0e60 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/i82489var.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/i82489var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82489var.h,v 1.21 2024/11/07 17:24:42 bluhm Exp $ */ +/* $OpenBSD: i82489var.h,v 1.22 2025/11/12 09:48:52 hshoexer Exp $ */ /* $NetBSD: i82489var.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */ /*- @@ -72,8 +72,7 @@ extern void Xresume_lapic_ipi(void); #define LAPIC_IPI_INVLTLB (LAPIC_IPI_OFFSET + 0) #define LAPIC_IPI_INVLPG (LAPIC_IPI_OFFSET + 1) #define LAPIC_IPI_INVLRANGE (LAPIC_IPI_OFFSET + 2) -#define LAPIC_IPI_WBINVD (LAPIC_IPI_OFFSET + 3) -#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 4) +#define LAPIC_IPI_INVEPT (LAPIC_IPI_OFFSET + 3) extern void Xipi_invltlb(void); extern void Xipi_invltlb_pcid(void); @@ -81,7 +80,6 @@ extern void Xipi_invlpg(void); extern void Xipi_invlpg_pcid(void); extern void Xipi_invlrange(void); extern void Xipi_invlrange_pcid(void); -extern void Xipi_wbinvd(void); #if NVMM > 0 extern void Xipi_invept(void); #endif /* NVMM > 0 */ diff --git a/lib/libc/include/x86_64-openbsd-none/machine/i8259.h b/lib/libc/include/x86_64-openbsd-none/machine/i8259.h index 28bdcd4743..2448f22f78 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/i8259.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/i8259.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i8259.h,v 1.4 2015/09/02 13:39:23 mikeb Exp $ */ +/* $OpenBSD: i8259.h,v 1.5 2026/01/15 15:43:45 sf Exp $ */ /* $NetBSD: i8259.h,v 1.3 2003/05/04 22:01:56 fvdl Exp $ */ /*- @@ -63,82 +63,30 @@ extern void i8259_default_setup(void); #define ICU_LEN 16 /* 32-47 are ISA interrupts */ -#define ICU_HARDWARE_MASK - -/* - * These macros are fairly self explanatory. If ICU_SPECIAL_MASK_MODE is - * defined, we try to take advantage of the ICU's `special mask mode' by only - * EOIing the interrupts on return. This avoids the requirement of masking and - * unmasking. We can't do this without special mask mode, because the ICU - * would also hold interrupts that it thinks are of lower priority. - * - * Many machines do not support special mask mode, so by default we don't try - * to use it. - */ - #define IRQ_BIT(num) (1 << ((num) % 8)) #define IRQ_BYTE(num) ((num) >> 3) #define i8259_late_ack(num) -#ifdef ICU_SPECIAL_MASK_MODE - -#define i8259_asm_ack1(num) -#define i8259_asm_ack2(num) \ - movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\ - outb %al,$IO_ICU1 -#define i8259_asm_mask(num) -#define i8259_asm_unmask(num) \ - movb $(0x60|(num%8)),%al /* specific EOI */ ;\ - outb %al,$ICUADDR - -#else /* ICU_SPECIAL_MASK_MODE */ - -#ifndef AUTO_EOI_1 #define i8259_asm_ack1(num) \ movb $(0x60|(num%8)),%al /* specific EOI */ ;\ outb %al,$IO_ICU1 -#else -#define i8259_asm_ack1(num) -#endif -#ifndef AUTO_EOI_2 #define i8259_asm_ack2(num) \ movb $(0x60|(num%8)),%al /* specific EOI */ ;\ outb %al,$IO_ICU2 /* do the second ICU first */ ;\ movb $(0x60|IRQ_SLAVE),%al /* specific EOI for IRQ2 */ ;\ outb %al,$IO_ICU1 -#else -#define i8259_asm_ack2(num) -#endif - -#ifdef PIC_MASKDELAY -#define MASKDELAY pushl %eax ; inb $0x84,%al ; popl %eax -#else -#define MASKDELAY -#endif - -#ifdef ICU_HARDWARE_MASK #define i8259_asm_mask(num) \ movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\ orb $IRQ_BIT(num),%al ;\ movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\ - MASKDELAY ;\ outb %al,$(ICUADDR+1) #define i8259_asm_unmask(num) \ movb CVAROFF(i8259_imen, IRQ_BYTE(num)),%al ;\ andb $~IRQ_BIT(num),%al ;\ movb %al,CVAROFF(i8259_imen, IRQ_BYTE(num)) ;\ - MASKDELAY ;\ outb %al,$(ICUADDR+1) -#else /* ICU_HARDWARE_MASK */ - -#define i8259_asm_mask(num) -#define i8259_asm_unmask(num) - -#endif /* ICU_HARDWARE_MASK */ -#endif /* ICU_SPECIAL_MASK_MODE */ - #endif /* !_MACHINE_I8259_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/intr.h b/lib/libc/include/x86_64-openbsd-none/machine/intr.h index ca5fda2141..16ae57464a 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/intr.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.36 2025/06/11 09:57:01 kettenis Exp $ */ +/* $OpenBSD: intr.h,v 1.37 2025/11/10 12:34:52 dlg Exp $ */ /* $NetBSD: intr.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ /*- @@ -222,7 +222,10 @@ void x86_ipi_handler(void); void x86_setperf_ipi(struct cpu_info *); extern void (*ipifunc[X86_NIPI])(struct cpu_info *); -#endif + +#define cpu_xcall_ipi(_ci) x86_send_ipi((_ci), X86_IPI_XCALL) +void Xxcallintr(void); +#endif /* MULTIPROCESSOR */ #endif /* !_LOCORE */ diff --git a/lib/libc/include/x86_64-openbsd-none/machine/intrdefs.h b/lib/libc/include/x86_64-openbsd-none/machine/intrdefs.h index 54fe1358ca..b09691e40e 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/intrdefs.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/intrdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intrdefs.h,v 1.24 2024/05/26 13:37:31 kettenis Exp $ */ +/* $OpenBSD: intrdefs.h,v 1.25 2025/11/10 12:34:52 dlg Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ #ifndef _AMD64_INTRDEFS_H @@ -52,12 +52,13 @@ #define LIR_TIMER 62 /* Soft interrupt masks. */ -#define SIR_CLOCK 61 -#define SIR_NET 60 -#define SIR_TTY 59 +#define SIR_XCALL 61 +#define SIR_CLOCK 60 +#define SIR_NET 59 +#define SIR_TTY 58 -#define LIR_XEN 58 -#define LIR_HYPERV 57 +#define LIR_XEN 57 +#define LIR_HYPERV 56 /* * Maximum # of interrupt sources per CPU. 64 to fit in one word. @@ -85,8 +86,9 @@ #define X86_IPI_START_VMM 0x00000100 #define X86_IPI_STOP_VMM 0x00000200 #define X86_IPI_WBINVD 0x00000400 +#define X86_IPI_XCALL 0x00000800 -#define X86_NIPI 12 +#define X86_NIPI 13 #define IREENT_MAGIC 0x18041969 diff --git a/lib/libc/include/x86_64-openbsd-none/machine/kexec.h b/lib/libc/include/x86_64-openbsd-none/machine/kexec.h new file mode 100644 index 0000000000..11c0eeba52 --- /dev/null +++ b/lib/libc/include/x86_64-openbsd-none/machine/kexec.h @@ -0,0 +1,48 @@ +/* $OpenBSD: kexec.h,v 1.1 2025/11/12 11:34:36 hshoexer Exp $ */ + +/* + * Copyright (c) 2019-2020 Visa Hankala + * Copyright (c) 2025 Hans-Joerg Hoexer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_KEXEC_H_ +#define _MACHINE_KEXEC_H_ + +#include + +#define KEXEC_TRAMPOLINE (35 * NBPG) /* @ 140 Kb */ +#define KEXEC_TRAMP_DATA (36 * NBPG) +#define PA_KERN (16*1024*1024) /* @ 16 Mb */ + +#ifndef _LOCORE + +#define KEXEC_MAX_ARGS 8 /* maximum number of boot arguments */ + +struct kexec_args { + char *kimg; /* kernel image buffer */ + size_t klen; /* size of kernel image */ + int boothowto; + u_char bootduid[8]; +}; + +#define KIOC_KEXEC _IOW('K', 1, struct kexec_args) +#define KIOC_GETBOOTDUID _IOR('K', 2, u_char[8]) + +extern unsigned int kexec_size; +extern void kexec_tramp(vaddr_t, vaddr_t, paddr_t, size_t, vaddr_t); + +#endif /* !_LOCORE */ + +#endif /* _MACHINE_KEXEC_H_ */ \ No newline at end of file diff --git a/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h b/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h index fc0770c81d..7f3b7d6c84 100644 --- a/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h +++ b/lib/libc/include/x86_64-openbsd-none/machine/specialreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: specialreg.h,v 1.120 2025/07/16 07:15:41 jsg Exp $ */ +/* $OpenBSD: specialreg.h,v 1.122 2026/04/19 01:10:28 jsg Exp $ */ /* $NetBSD: specialreg.h,v 1.1 2003/04/26 18:39:48 fvdl Exp $ */ /* $NetBSD: x86/specialreg.h,v 1.2 2003/04/25 21:54:30 fvdl Exp $ */ @@ -699,9 +699,12 @@ #define MSR_FSBASE 0xc0000100 /* 64bit offset for fs: */ #define MSR_GSBASE 0xc0000101 /* 64bit offset for gs: */ #define MSR_KERNELGSBASE 0xc0000102 /* storage for swapgs ins */ +#define MSR_SYS_CFG 0xc0010010 /* System Configuration */ #define MSR_PATCH_LOADER 0xc0010020 #define MSR_INT_PEN_MSG 0xc0010055 /* Interrupt pending message */ +#define MSR_FP_CFG 0xc0011028 /* Floating Point Configuration */ +#define FP_CFG_9 (1 << 9) /* FP-DSS chickenbit */ #define MSR_DE_CFG 0xc0011029 /* Decode Configuration */ #define DE_CFG_721 0x00000001 /* errata 721 */ #define DE_CFG_SERIALIZE_LFENCE (1 << 1) /* Enable serializing lfence */