From nobody Fri Jul 3 15:33:17 2026 X-Original-To: dev-commits-src-main@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 4gsHp61Msfz6jkhM for ; Fri, 03 Jul 2026 15:33:18 +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 4gsHp56vf5z3XmC for ; Fri, 03 Jul 2026 15:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783092798; 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=zKKy2d1P8YEY/XpbcQdwY34Dr8e46OQjk1Niqs0KlBM=; b=Oly26+IvBYtB14LDze4s0jRfqY8MIiqO1lRCIoGcQeFEaSHqouHcr3AtZxe7Rwml7LmZxi kyb88M414Gfv0WHcRtYwDKUkgVPVSAMLHd1eG6h7GuPFwTFxggewEtJ2Ekbl7XNPGjx6OL bf22ksLxqh6dfl3kAYIrW1S8CDzowd+NZuIGva/xC+aDFYh3NOnTm2Md8lpGXcUUQNudQZ jWh6TSdmtfV5aHuuaFqBWoMNFM9gzQaJxLdT/9zoKyj24oGXnW5yQ/PGsa2aD7DnTSEQD0 zW8JPftufobc1OKmvV9PI8Cot8XVjYjc6+j12i0K1sM5FP3cDl9fQDplJPsPww== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783092798; a=rsa-sha256; cv=none; b=xgLPXDhcCNUMKaohMLOlffwtR3MKwk4S9XBnr8pFVbx94u3IXq57HL6odWEDGm2EJPhSFs +oHTdrX/rDWdAd2G4pqym4q+WoSqb6iVgIBmK2N+m8iCo/xPYc0gz1fIvbmFgNAssa9XBG VnFfrU1KwKpVZbcgCyWhhX43cjF2El1zY/+cQpB3OyI5XO0QDcWZ9xwwRSxIhykffOWeP+ xZWBFQsbe9yz1LfYVXY/MHBurBZX9g03eC6ttOdv/5/46DbQM/Q/Xm+U9gudblb/RzdJWh GKY6dvsinhkVRQLkvF0FR8SpC5MBc89XiRBGghG2d5zz1p2WT7+TgWlOQzjjhA== 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=1783092798; 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=zKKy2d1P8YEY/XpbcQdwY34Dr8e46OQjk1Niqs0KlBM=; b=uDaWsoInTvB+5NTMkdY0crj5DVjC91y/Jra0B/T5SJybZzooPAmxAAeg3hXre4jPiSeOj8 f1tMs5362MnRUu2rafJQ8KacaQZnH9p5Eyy8zkGQEHpFeg3JG8uiWASomtDk3s8HCKGRVf n9rdIVLxlfHuy4VYrjYNDjQ5MBAqbttHJ2nSvaWZV8y5cUl+J8yyH2rBs1H36UVopicuvQ 90uP+X3iOyHB6swTsH0I9oa42jJlTuSjei2G2Q46nhnONmD821hTbnhRkrcGJglDSZKfqJ nv/ogbb3t4x44R6toLCSoNX/MRgFtSD8sYuKW8W7CNY1wNzUKYyKUas8chpF1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gsHp55pRZztjP for ; Fri, 03 Jul 2026 15:33:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 46209 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 03 Jul 2026 15:33:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: c3c8f4d9e662 - main - cpu: New cpu_get_pcpuid(), retrieves internal CPU ID List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: c3c8f4d9e66287b24af2b3881c528236b836f2f1 Auto-Submitted: auto-generated Date: Fri, 03 Jul 2026 15:33:17 +0000 Message-Id: <6a47d63d.46209.5445b6f0@gitrepo.freebsd.org> The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c3c8f4d9e66287b24af2b3881c528236b836f2f1 commit c3c8f4d9e66287b24af2b3881c528236b836f2f1 Author: Olivier Certner AuthorDate: 2026-06-26 22:17:35 +0000 Commit: Olivier Certner CommitDate: 2026-07-03 15:32:25 +0000 cpu: New cpu_get_pcpuid(), retrieves internal CPU ID It is a handy shortcut that will be used extensively in hwpstate_intel(4) and hwpstate_amd(4). Warn users that it panics if the parent bus does not provide the CPU_IVAR_PCPU instance variable. That condition should be tested by callers (doing so once is enough). Suggest to do that in driver's attach method. Reviewed by: jhb (code) Event: Halifax Hackathon 202606 Location: Seat 36K in AC667, waiting for a gate at Montréal-Trudeau Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57897 --- sys/sys/cpu.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/cpu.h b/sys/sys/cpu.h index 21e79e6db6a4..9156fa9f723d 100644 --- a/sys/sys/cpu.h +++ b/sys/sys/cpu.h @@ -51,6 +51,17 @@ cpu_get_pcpu(device_t dev) return ((struct pcpu *)v); } +/* + * Assumes the parent bus sets the CPU_IVAR_PCPU instance variable, which most + * CPU buses do. A panic will ensure if not the case. Calling devices should + * check for that condition (most probably in their attach function). + */ +static __inline u_int +cpu_get_pcpuid(device_t dev) +{ + return (cpu_get_pcpu(dev)->pc_cpuid); +} + static __inline int32_t cpu_get_nominal_mhz(device_t dev) {