From nobody Tue Jul 7 16:35:17 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gvmzn3fNpz6k5th for ; Tue, 07 Jul 2026 16:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvmzn1xNkz42Td for ; Tue, 07 Jul 2026 16:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783442117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RKfZIAlZi5qtJd3XTmsBJeF9FjxW5EyWxnuW6jqF5HI=; b=ECnixNPznvIndhaWh2IbUl1dYzGinBr8Gyevg2SGp78TUHLwH21LuYbZtK/NihwaBlK9Gi DDGGD5oYX2G/G4IeMnavGnRwnmQgRVV+UwvjmKt4t1iiFW4GwnYl1TCT7burkw/47/e5FA jtHJDxZxebKPUQyv3aL1Yh091ch2N4DojH2DXRjYlUpDQxoT5hckveEbVuy7vfpV4UG17A rmJkIZn/3O0LZzKw9tbMLRd6VjFdJ+aywiDXG6TZ71inOihoY0UqhiUSGKK9EMV6qqNl2K ri6bDc9yDvZs9j50Um55Rz/Kv2CpQPrD1L7W3/S0UrOCJizbWeBQfDCiYRrjkA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783442117; a=rsa-sha256; cv=none; b=RNY8nubxs4750XoZCwxzR09i5jhDpiR/EJ/gl3IF7msK6w/GEZgytQnl6x1XpjWOwptpAs UiO1kjTni3b4OcofVbXLFX9EUzYChLn6dMjmKuZfhNY/ZE54zGVL7uNhMzSDMACmMTSsRc QXRs9BHoU+Sf0OGGeFcoh38sZSSOBres6PiFbq0aY5eov4nU/kksDzpGOH8NXbhwpu8Z59 YDUEXKif7eeY7kZ0NBU0fzCRunmgL6EjRIfAbsDVq/Rxoo5fxn1zXcrvPGYSdc3BAdQ2rQ OQT8koBoysr8fSjQLBrc3uiWnxCcKjG7CxCt0sm4FTYl308DJGfDfPg5f3wJWQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783442117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RKfZIAlZi5qtJd3XTmsBJeF9FjxW5EyWxnuW6jqF5HI=; b=V4IKKVNItfzVrb06SQ6JEy5jeXxrMXYYaEuiiMpBSMZLM+oCXAJ0mW8iBtD53vF62F9nNY 7zdwYnhSmCcGfWyTDB32v78Pizs6B7UgXj/ANP5p2icWAYUQ4IA6dm8Iwc3anEmdiB3t09 U+Iw3w+tqoyhfgsVw1i54TWbgUCtiBB+oCUx1h0EEQlAE49QtRkxOh9+xh9djyNc2bMXNe MLHyZQN6Kcc+mFeDJzOSdX165PAFgtxz4ETllpGAj0p0/LSb2cnK1l57bRfgkFsfZC5hzm U3gO0F41pEnJbhrTfW73flMcF4wcElRU1AGT0U+hEvacy5wcVD9y1viewPE3Sg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvmzn0MTDzk2q for ; Tue, 07 Jul 2026 16:35:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27180 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 16:35:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: e1f4a8cb8656 - main - x86/local_apic.c: Thermal interrupt support: Additional style fixes List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 16:35:17 +0000 Message-Id: <6a4d2ac5.27180.7af668d7@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 commit e1f4a8cb8656e64a1fe2b1ab519821b14c4985a0 Author: Olivier Certner AuthorDate: 2026-07-02 13:05:09 +0000 Commit: Olivier Certner CommitDate: 2026-07-07 16:34:07 +0000 x86/local_apic.c: Thermal interrupt support: Additional style fixes Rename handler function type 'lapic_thermal_handle_function' to the shorter 'lapic_thermal_handler_t'. Move it closer to the function declaration block where it is used. Make it a true function type (no pointer) and add explicit pointer marks on usage. Rename 'lapic_thermal_function_value' to the more immediately clear 'lapic_thermal_function_arg'. In lapic_thermal_enable(), use 'func_arg' as the argument name for the handler argument, which at least refers to function 'func', rather than the generic 'value'. Finally, rename the global handler variable from 'lapic_thermal_function_ptr' to the shorter 'lapic_thermal_function' (dynamic functions can be referenced only through a pointer). MFC with: 87ba088fa310 ("x86/local_apic.c: Add support for installing a thermal interrupt handler") Sponsored by: The FreeBSD Foundation --- sys/x86/include/apicvar.h | 6 ++++-- sys/x86/x86/local_apic.c | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index 66d53bbf7e5d..54ea5bc655e5 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -199,7 +199,6 @@ extern int *apic_cpuids; extern void (*ipi_vectored)(u_int, int); typedef struct ioapic *ioapic_drv_t; -typedef void (*lapic_thermal_handle_function)(int, void *); void apic_register_enumerator(struct apic_enumerator *enumerator); ioapic_drv_t ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); @@ -215,6 +214,9 @@ int ioapic_set_triggermode(ioapic_drv_t cookie, u_int pin, enum intr_trigger trigger); int ioapic_set_smi(ioapic_drv_t cookie, u_int pin); +/* First argument: 'cpuid' from 'struct pcpu', second: Opaque cookie. */ +typedef void lapic_thermal_handler_t(int, void *); + void lapic_create(u_int apic_id, int boot_cpu); void lapic_init(vm_paddr_t addr); void lapic_xapic_mode(void); @@ -234,7 +236,7 @@ void apic_enable_vector(u_int apic_id, u_int vector); void apic_disable_vector(u_int apic_id, u_int vector); void apic_free_vector(u_int apic_id, u_int vector, u_int irq); void lapic_calibrate_timer(void); -void lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value); +void lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg); void lapic_disable_thermal(void); int lapic_enable_pcint(void); void lapic_disable_pcint(void); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 08748a1fe7c2..9e1c1d70aea7 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -314,8 +314,8 @@ static uint64_t lapic_ipi_wait_mult; static int __read_mostly lapic_ds_idle_timeout = 1000000; #endif unsigned int max_apic_id; -static void *lapic_thermal_function_value; -static lapic_thermal_handle_function lapic_thermal_function_ptr; +static lapic_thermal_handler_t *lapic_thermal_function; +static void *lapic_thermal_function_arg; static int pcint_refcnt = 0; SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, @@ -1642,13 +1642,13 @@ lapic_enable_mca_elvt(void) void lapic_handle_thermal(void) { - lapic_thermal_handle_function func; + lapic_thermal_handler_t *func; - func = (lapic_thermal_handle_function)atomic_load_acq_ptr( - (void *)&lapic_thermal_function_ptr); + func = (lapic_thermal_handler_t *)atomic_load_acq_ptr( + (uintptr_t *)&lapic_thermal_function); if (func != NULL) - func(PCPU_GET(cpuid), lapic_thermal_function_value); + func(PCPU_GET(cpuid), lapic_thermal_function_arg); lapic_eoi(); } @@ -1664,7 +1664,7 @@ lapic_update_thermal(void *dummy __unused) } void -lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value) +lapic_enable_thermal(lapic_thermal_handler_t *func, void *func_arg) { #ifdef DEV_ATPIC /* Fail if the local APIC is not present. */ @@ -1672,9 +1672,9 @@ lapic_enable_thermal(lapic_thermal_handle_function thermfunc, void *value) return; #endif - lapic_thermal_function_value = value; - atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, - (uintptr_t)thermfunc); + lapic_thermal_function_arg = func_arg; + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function, + (uintptr_t)func); lvts[APIC_LVT_THERMAL].lvt_masked = 0; @@ -1698,7 +1698,7 @@ lapic_disable_thermal(void) #endif smp_rendezvous(NULL, lapic_update_thermal, NULL, NULL); - atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function_ptr, + atomic_store_rel_ptr((uintptr_t *)&lapic_thermal_function, (uintptr_t)NULL); }