From nobody Fri Oct 16 20:39:14 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 4j5xcg0HrQz6vhfb for ; Fri, 16 Oct 2026 20:39:15 +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 4j5xcf6Y5Sz3DVr for ; Fri, 16 Oct 2026 20:39:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792183154; 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=EMK9A97OUl/Y3Qa9bmMbYrykkKh+eCkoojAOZ/O0+0Ug6HMVestCOzCMIbm6pNckWi+iqw 1VfC1x/Q2kagdCuCE//W5b+6+uZ+Ub/X9u51HLp++puPwXwcd4G+S1eyru1pFBbK95lzRd RaxuJ9RviEbx2q6DIoXA8YYKWDP1NJu5KjJZO24j7oxkSpDXrEjhniZ5wQeoLwzYmy61ta 24LkfG8bfH5u7w1pPaGnebIwHTjMmp2ug5IA4e9GbOAmT6fjwNOQImzV+VK9I9LMO5gjJ7 AZB9DzwIbA7YjPcNK9KYVS+y0jb5KXEvcdRlY2hiJhNkKAvwCOaAh2j9JX7vkw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1792183154; b=qF/hJzznanq99C8fzfm0YfCV+YE5Pmk3az115XTJVZLe1hiF906xnT6v4Hub3HN9//pbWq TU8CixNtaCZfAui4E4qDdcBF2F9YK9NvHjgSiQj0h/YtiGyzAPaGoRxgnSF0YqFREabKjN CKtsThgF5JlzxG7UGl2iIZ3xlHvnZIFBFg4lErqbRjq1kt3E7K4bLopb2JSXKXV2XXRbmz AKd4Wmw+mH9zzHVU/65UCQQWwwCpbnX4JdjBCirkmXVNs+tvA2f7zxcyCKI9qtdczVe8vy 3e2VxnPFjMtoWh7VU0kmZbmoStxOC5NWDdGfXT09PycMgs1ASNFLVaBp3TZMtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1792183154; 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=AzTt7tovfnTdmD0WZPtr9E4KpEeUx7W2WIJNhZyEh/Vu02X3cHch5XVIBAsfddx9pQuKfG tN3ymMmP+Baa6KysmUWvkFMd/e219VBE1MXWWc78GRV00WLYEsYUVFglRS6T7cYICobAO4 mgKuNG4GiS9AnKjia99vcpIgKsLtYn9PTh739dypPK8oB1vSNHDDCk+NLBu2B69vzvxJF4 bKt442eX7DXbeYvP0iQX9BOvVCM2rRBPNLYSrUIyJPQM+hD0YFCjRCf8MAYnEHD3KVwBKk ZYaJx1M8Lml81KeRW95dLDd99ghwcI6USDz+vvBWhT+jE7mhJ0hfSS57GKp5kg== 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 4j5xcf6Cs2zcJl for ; Fri, 16 Oct 2026 20:39:14 +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-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch 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_ */