From nobody Mon Dec 16 19:12:11 2024 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 4YBqLz3vrdz5frpn; Mon, 16 Dec 2024 19:12:11 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YBqLz3Sj8z4hCc; Mon, 16 Dec 2024 19:12:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734376331; 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=Us0v/1ihGfmgTPFNJi9SiQNHDa3S7uFgH9dHZ0otCPw=; b=N4QaLfZA1G+Z0RLZ8hmhiHQETwNqpJROA5l3jTLZCalK44YdZ0YJo967IK29Bl1LZ2L0bs czN9NKaxg9HEsdECvHTfkMcHqIGOXvc3Yr1O0L2EU+laX8X/u8EFvz0VvYaiImm7WFt9aS SsBDi/OS1CqOeI27UqfdCloNJHlrlFJe11Tr1/hmZjlfJhAOnh1lJSzdlfFMudIuyMpohq LgLwfEHLG89mBVF+RXoB5uO4xhmS91YmaoWZ5mKNrQ/7rAtfwsMWOWg07WPE6VtuiuVxWe 5ZkaAnKNtb+OgYOY4VutKzrF0cEuGNp2bfAQUR9BfMkER+lBbdVQ4AR+xrcOag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734376331; 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=Us0v/1ihGfmgTPFNJi9SiQNHDa3S7uFgH9dHZ0otCPw=; b=FjsInZfWajpFQQx1YTyMur6bcl0wndI8cpvFG0SQCGZdbVPR+5dls4XQ5RvrnOiABF+Xn8 58/ZwRXddbuZOurop9pQqcN92s+qg4F1eIBfFjBi7hcUUpwsvEUbGlCHJW4tb9I5YU43Yv lJGl0l/ZbxBf6/mkrMwmKck14CD9fvT6vABHDryHEfYC6W+mJ6hjqb7VSPEzWy7QqaprtC lS7VRkeK1bq2yAZ8kPcDlPi/KtlMeVI/c5fqiQwVL0q6aBYDO/2GB/A1HMBsqHJ3kwq+td qBvPe7ndA8UaBjjoWrlwIVQ+DCQ1WdJIabGKYoSoMybht1yL2OzOMHXmqRloyA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734376331; a=rsa-sha256; cv=none; b=em8DOxOQymFR8XDQBF5cSJnwlKpsBjWJJ9CxxulvWUo5Mslx9s0TEJhV9sOfGYvZS3Qgo9 3TfJ8bkpyy2xp+5NrmV/aTi4e0OdumHbnTKbtnQyQjhyHtEUMUSr+RRYtFxIycFIwN8jFm LbxfpwIQorYpXkbPZpoNkPTouZL43MY7CmGYEaYOljqff4C52dsr+qw0QvrUaD7LIADFW4 guS0q/X62mHsUQOLVEp92dvrvK8pNIucpiLYsXtmcky358Fv7jiDAfuF87NKBbaIJP6Ojp TMTG0dPfgDNxymBwdajdDOraxdkzoa56DLpodpr/Q03zAI/n08boYeBjbgCiLA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YBqLz2lpxz14wL; Mon, 16 Dec 2024 19:12:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BGJCBtg057307; Mon, 16 Dec 2024 19:12:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BGJCBoZ057304; Mon, 16 Dec 2024 19:12:11 GMT (envelope-from git) Date: Mon, 16 Dec 2024 19:12:11 GMT Message-Id: <202412161912.4BGJCBoZ057304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 487788a69fa2 - main - intrng: fix INTR_ROOT_* constants 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 487788a69fa2bd57ee04f38c3ad6e995a62d8e00 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=487788a69fa2bd57ee04f38c3ad6e995a62d8e00 commit 487788a69fa2bd57ee04f38c3ad6e995a62d8e00 Author: Elliott Mitchell AuthorDate: 2024-08-09 15:30:15 +0000 Commit: Mitchell Horne CommitDate: 2024-12-16 19:11:52 +0000 intrng: fix INTR_ROOT_* constants Switch to INTR_ROOT_COUNT as this name better describes its purpose. Remove the default INTR_ROOT_IRQ from the core. Define it (redundantly) in each architecture's header, but now placed alongside its sibling values (if defined by the platform, e.g. arm64 INTR_ROOT_FIQ). Reviewed by: mhorne Pull Request: https://github.com/freebsd/freebsd-src/pull/1280 --- sys/arm/include/intr.h | 3 +++ sys/arm64/include/intr.h | 3 ++- sys/kern/subr_intr.c | 19 +++++-------------- sys/riscv/include/intr.h | 3 +++ sys/sys/intr.h | 2 -- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/sys/arm/include/intr.h b/sys/arm/include/intr.h index 5facd5dbccdb..71e853c93ce2 100644 --- a/sys/arm/include/intr.h +++ b/sys/arm/include/intr.h @@ -51,4 +51,7 @@ void arm_irq_memory_barrier(uintptr_t); #define NIRQ 1024 /* XXX - It should be an option. */ #endif +#define INTR_ROOT_IRQ 0 +#define INTR_ROOT_COUNT 1 + #endif /* _MACHINE_INTR_H */ diff --git a/sys/arm64/include/intr.h b/sys/arm64/include/intr.h index 56bce911cd32..ef7fe56e3a13 100644 --- a/sys/arm64/include/intr.h +++ b/sys/arm64/include/intr.h @@ -48,7 +48,8 @@ arm_irq_memory_barrier(uintptr_t irq) #define ACPI_GPIO_XREF 3 #endif +#define INTR_ROOT_IRQ 0 #define INTR_ROOT_FIQ 1 -#define INTR_ROOT_NUM 2 +#define INTR_ROOT_COUNT 2 #endif /* _MACHINE_INTR_H */ diff --git a/sys/kern/subr_intr.c b/sys/kern/subr_intr.c index b8d85bf20f28..b7cb088f58c7 100644 --- a/sys/kern/subr_intr.c +++ b/sys/kern/subr_intr.c @@ -89,15 +89,6 @@ #define INTRNAME_LEN (2*MAXCOMLEN + 1) -/* - * Archs may define multiple roots with INTR_ROOT_NUM to support different kinds - * of interrupts (e.g. arm64 FIQs which use a different exception vector than - * IRQs). - */ -#if !defined(INTR_ROOT_NUM) -#define INTR_ROOT_NUM 1 -#endif - #ifdef DEBUG #define debugf(fmt, args...) do { printf("%s(): ", __func__); \ printf(fmt,##args); } while (0) @@ -115,7 +106,7 @@ struct intr_irq_root { void *arg; }; -static struct intr_irq_root intr_irq_roots[INTR_ROOT_NUM]; +static struct intr_irq_root intr_irq_roots[INTR_ROOT_COUNT]; struct intr_pic_child { SLIST_ENTRY(intr_pic_child) pc_next; @@ -343,7 +334,7 @@ intr_irq_handler(struct trapframe *tf, uint32_t rootnum) struct thread * td; struct intr_irq_root *root; - KASSERT(rootnum < INTR_ROOT_NUM, + KASSERT(rootnum < INTR_ROOT_COUNT, ("%s: invalid interrupt root %d", __func__, rootnum)); root = &intr_irq_roots[rootnum]; @@ -497,7 +488,7 @@ isrc_free_irq(struct intr_irqsrc *isrc) device_t intr_irq_root_device(uint32_t rootnum) { - KASSERT(rootnum < INTR_ROOT_NUM, + KASSERT(rootnum < INTR_ROOT_COUNT, ("%s: invalid interrupt root %d", __func__, rootnum)); return (intr_irq_roots[rootnum].dev); } @@ -925,7 +916,7 @@ intr_pic_claim_root(device_t dev, intptr_t xref, intr_irq_filter_t *filter, * Note that we further suppose that there is not threaded interrupt * routine (handler) on the root. See intr_irq_handler(). */ - KASSERT(rootnum < INTR_ROOT_NUM, + KASSERT(rootnum < INTR_ROOT_COUNT, ("%s: invalid interrupt root %d", __func__, rootnum)); root = &intr_irq_roots[rootnum]; if (root->dev != NULL) { @@ -1586,7 +1577,7 @@ intr_pic_init_secondary(void) * QQQ: Only root PICs are aware of other CPUs ??? */ //mtx_lock(&isrc_table_lock); - for (rootnum = 0; rootnum < INTR_ROOT_NUM; rootnum++) { + for (rootnum = 0; rootnum < INTR_ROOT_COUNT; rootnum++) { dev = intr_irq_roots[rootnum].dev; if (dev != NULL) { PIC_INIT_SECONDARY(dev, rootnum); diff --git a/sys/riscv/include/intr.h b/sys/riscv/include/intr.h index ea98f0632108..da5d420f7e6d 100644 --- a/sys/riscv/include/intr.h +++ b/sys/riscv/include/intr.h @@ -56,4 +56,7 @@ enum { }; #endif /* !LOCORE */ +#define INTR_ROOT_IRQ 0 +#define INTR_ROOT_COUNT 1 + #endif /* !_MACHINE_INTR_MACHDEP_H_ */ diff --git a/sys/sys/intr.h b/sys/sys/intr.h index d60eac937d93..77daf5a35f32 100644 --- a/sys/sys/intr.h +++ b/sys/sys/intr.h @@ -37,8 +37,6 @@ #define INTR_IRQ_INVALID 0xFFFFFFFF -#define INTR_ROOT_IRQ 0 - #ifndef LOCORE enum intr_map_data_type {