From nobody Fri Oct 16 20:39:14 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 4j5xcm2nvNz6vhMj for ; Fri, 16 Oct 2026 20:39:20 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4j5xcm1CP8z3DkR for ; Fri, 16 Oct 2026 20:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792183160; 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=u7m9g3xBkC5ulYWcuYc8E3vB1ud+zSXxfX/n90lk57Q=; b=VgLL0Fy1MCpAILfC7iUJLLCOcSrx1Bnu9m+T3j5pEzXQSwWqZhP+XBJ0Rkn4PoEDnmmgV2 DminqiRg/UzdIsJ9ZcZ5AMVXPSfLKB2D/SRGNsu/IwQpsTQ+iZnwg5EdRy6vOu5C9AXKkT nW5XGf0l4JFm6SfwG4mIDWldokgbU3zuz/LeGr3TFn2xH3MWWoelGsW1m6gIm/ZPaRxeyM RyPajZQ7Jlk2ARw+02gRl8NhFFu41NMS2qAgbcv1fcWc5QGbPR6Z6v5GoSnfZvo4VqrSfy 0pzE9xzvPjP8NLiEWvePTiN8yrfU2YTD55DoSJsJUqPIQlsnpTXymM2BrYpitA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792183160; b=wVEtPt5zEAsADUwP3QDNQmHtB8budgTyQsyUdUoCcB9hhEh1rk29oUOdIlUCQngbwgXSG/ 3zuVxuXVmTxpGh4J8zIJdOZBd5PmvdAfMGd9g52JAW+8rwfXONEs3XbEdJEt3uYgfapoGA 37YIrJaK/TYScIrxxqhwjXu3YfG+SU/F6ANRuLu/EH44RWxNDBFKBB+/H/ytUOiJQAzF7F V7OwLAzF8FhILoThtT4JErfXDHVEoWnyDMmNLv5FqpZCaTCDPfQ9hDZaPvR1uv+iVPMp2n 0I/RGmJxp++nmo14TfjXBZORmfaPcmLizHZn8HpbYGInTYP/tmwAlgdtYiTXAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792183160; 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=u7m9g3xBkC5ulYWcuYc8E3vB1ud+zSXxfX/n90lk57Q=; b=jHhKOA1aMlGRzOXpJYmYWthOwoZF5Mw4KF4k6sSHQhTk12zR33ks4nL43JAGeF6JYtsH/v zMx4/HwbrLdNOzZAVozMbjGuRIcw+M/HRt88m+aW8HIeawD08wHdq0obupq4D4gOnhGvGU pFg2jVgpY+jZO5GpToqO7NQwuY+7tDZUyZHWhK3himEW8W2XNiAQjObJjeU0rloAKaPoTq AyR+1wo69XJK/axm1Wc1F630KFgleNnRlvLXb8/PusMn5ABvrPUIhu9Hlo8yScDP8IToxX MlT+TlDNDLhNMgcGY1X179PM2kSicYgu7zqZSwD3GxjbyJ0QGJrsFGu2ggi79w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j5xcm0tN1zcZZ for ; Fri, 16 Oct 2026 20:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33e99 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Oct 2026 20:39:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Austin Shafer Subject: git: 4f2f26fb1e8a - main - linuxkpi: implement irqs_disabled List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: Commit messages for all branches of the src repository 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: ashafer X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f2f26fb1e8aefb529e6186d8f39e1255dc98036 Auto-Submitted: auto-generated Date: Fri, 16 Oct 2026 20:39:14 +0000 Message-Id: <6ad28b72.33e99.654fd0cd@gitrepo.freebsd.org> The branch main has been updated by ashafer: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2f26fb1e8aefb529e6186d8f39e1255dc98036 commit 4f2f26fb1e8aefb529e6186d8f39e1255dc98036 Author: Austin Shafer AuthorDate: 2026-06-23 18:55:31 +0000 Commit: Austin Shafer CommitDate: 2026-10-16 20:32:53 +0000 linuxkpi: implement irqs_disabled This adds a function which is used from various places in drm-kmod to detect if the code can sleep or not. Currently, these locations (such as intel_guc_send_busy_loop) are ifdeffed to freebsd specific solutions (usually drm_can_sleep). This change implements irqs_disabled. We check td_pinned as spinlocks will call sched_pin, and td_critnest to check if we are in a critical section. Approved by: wulf, khng (mentor) Differential Revision: https://reviews.freebsd.org/D57782 --- sys/compat/linuxkpi/common/include/linux/hardirq.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/hardirq.h b/sys/compat/linuxkpi/common/include/linux/hardirq.h index c6cbf1a34f14..97dc387b3e2e 100644 --- a/sys/compat/linuxkpi/common/include/linux/hardirq.h +++ b/sys/compat/linuxkpi/common/include/linux/hardirq.h @@ -36,6 +36,8 @@ #include #include #include +#include +#include #define synchronize_irq(irq) _intr_drain((irq)) @@ -49,4 +51,22 @@ */ #define synchronize_hardirq(irq) _intr_drain((irq)) +/* + * irqs_disabled - returns true if the caller should not sleep + * + * This was originally implemented in drm-kmod in commit 530462939f6. + */ +static inline bool +irqs_disabled(void) +{ + return (curthread->td_critnest != 0 || curthread->td_intr_nesting_level != 0); +} + +/* + * local_irq_disable / local_irq_enable - disable/enable hardware interrupts + * on the current CPU. + */ +#define local_irq_disable() preempt_disable() +#define local_irq_enable() preempt_enable() + #endif /* _LINUXKPI_LINUX_HARDIRQ_H_ */