From nobody Thu May 09 23:20:50 2024 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 4Vb7Kv1n1lz5KGW7; Thu, 09 May 2024 23:20:51 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vb7Kt5XTbz44FG; Thu, 9 May 2024 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715296850; 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=nra0xFd0HVXxcYBwV0QbL6hqAMnhHrUBc5M1xFldxDc=; b=Q/XERysO8uPO/td7VgiT9kM3zzfCnvTrM9lFO/vz5Jeqekvq9/bT9uTaxXiBLDItmjkEU0 ZWhm1zcA0M/iqj784cdR9XrQeTNH2ixhBHDlLDdcs9flyD/edOZdl0AY8arkDYNOxtOevt 8815w6OgD41/NEmlJGMX/kHdK2Fre9GyTVoCiNFRWCu0TyRox6Wwhs61MRs9PEpz9zOfYC Xcq4b9P7bkZxkIuJs4DZhus8D1EXWNXe47C0LHOnNq11QV2v8MIStk+Sg6ejFQ73yniO92 BIVlfbGTJojY6ftlmJQisJgIiePhnhBppkKqz9hXkMU0oWNcNqd6e8iAXgEBuw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715296850; a=rsa-sha256; cv=none; b=j9wrYuUi7ZP5OpIiTgeNVJJkbLjZ9+b++aJD16rRuz1VhUiax7spD6+ylMXvTPnhokzVml f43H45nuJyhF6Z2M618KBalcTqUBQSuXWQb+7meNEQ58gA67xBn1qVeIjXJuCM5hOTY0aC uQ5WSbc5NFOf9F/E9uyHL8EYKa9Mv8vUZpKqzg1A+i6VAq+c2GlpMC3ZF74/XD/T7ltBYu MxRN61JohowDQH9rjWIJ7GN4Oarm1jfxBns+M8m1VxWukyuwX6uYbANoCjTmFSjV4zqFyH yFvduNQE98SBJqHRO6TEgHG1anMSWPDmvs42zQKyH1+F7VtZigsBsgC5UTfSKw== 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=1715296850; 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=nra0xFd0HVXxcYBwV0QbL6hqAMnhHrUBc5M1xFldxDc=; b=epErLe0K0YtkWsgrQtVcRYQ/IDyBjhzvwIKGhR1F1mIt/jv7EmXnurnHaAG+iNV8str0/d l20P2oNsCG5uLAsP5VJtD3ncVz2Yak8HacPYkeqQ+ygJ84QTkALU9pLdlWydmKsVzSB2JW vB/uudEDZ+fiuE8z8pxGBFuKzCYi/6aboEDUvSAEGKXB95VmDNtk7jlJa9LVQqNgp1EQ8k 2a3rjO5MPB1FsZovWHVOenRYTSwl4sUJOzrLb2StWy3GkSGkfEXXMHbVbPA/666FGls9Fz tnHaKmzpWnzaYPbUKQOE0d0I6oJCmuRr6/AJVcGATc/AFcoMazOgqN0HWWyIqg== 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 4Vb7Kt58kRz1S3H; Thu, 9 May 2024 23:20:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 449NKohK057811; Thu, 9 May 2024 23:20:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 449NKom9057808; Thu, 9 May 2024 23:20:50 GMT (envelope-from git) Date: Thu, 9 May 2024 23:20:50 GMT Message-Id: <202405092320.449NKom9057808@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d9817976625f - main - intr/x86: replace use of vector in interface with intsrc 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9817976625ff9655f481066905cf9abac5520ab Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d9817976625ff9655f481066905cf9abac5520ab commit d9817976625ff9655f481066905cf9abac5520ab Author: Elliott Mitchell AuthorDate: 2024-05-09 23:04:35 +0000 Commit: Warner Losh CommitDate: 2024-05-09 23:15:07 +0000 intr/x86: replace use of vector in interface with intsrc Several x86 interrupt core functions were already operating on intsrc structures. Now switch the remaining 3 to intsrc for consistency. Swap the order of intr_add_handler()'s first two arguments. This matches INTRNG and is more consistent with other functions in this interface. Differential Revision: https://reviews.freebsd.org/D35386 Reviewed by: imp, markj (previous version) Pull Request: https://github.com/freebsd/freebsd-src/pull/1126 --- sys/x86/include/intr_machdep.h | 10 +++++----- sys/x86/include/xen/arch-intr.h | 4 ++-- sys/x86/x86/intr_machdep.c | 19 ++++--------------- sys/x86/x86/nexus.c | 21 +++++++++++++++++---- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/sys/x86/include/intr_machdep.h b/sys/x86/include/intr_machdep.h index 64f0174ea637..d7bfcdc126a9 100644 --- a/sys/x86/include/intr_machdep.h +++ b/sys/x86/include/intr_machdep.h @@ -138,12 +138,12 @@ void elcr_write_trigger(u_int irq, enum intr_trigger trigger); #ifdef SMP void intr_add_cpu(u_int cpu); #endif -int intr_add_handler(const char *name, int vector, driver_filter_t filter, - driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, - int domain); -int intr_config_intr(int vector, enum intr_trigger trig, +int intr_add_handler(struct intsrc *isrc, const char *name, + driver_filter_t filter, driver_intr_t handler, void *arg, + enum intr_type flags, void **cookiep, int domain); +int intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, enum intr_polarity pol); -int intr_describe(u_int vector, void *ih, const char *descr); +int intr_describe(struct intsrc *isrc, void *ih, const char *descr); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); u_int intr_next_cpu(int domain); struct intsrc *intr_lookup_source(int vector); diff --git a/sys/x86/include/xen/arch-intr.h b/sys/x86/include/xen/arch-intr.h index eae3994108cc..5ce0ca06e925 100644 --- a/sys/x86/include/xen/arch-intr.h +++ b/sys/x86/include/xen/arch-intr.h @@ -67,7 +67,7 @@ xen_arch_intr_add_handler(const char *name, driver_filter_t filter, struct xenisrc *isrc, void **cookiep) { - return (intr_add_handler(name, isrc->xi_arch.vector, filter, handler, + return (intr_add_handler(&isrc->xi_arch.intsrc, name, filter, handler, arg, flags, cookiep, 0)); } @@ -75,7 +75,7 @@ static inline int xen_arch_intr_describe(struct xenisrc *isrc, void *cookie, const char *descr) { - return (intr_describe(isrc->xi_arch.vector, cookie, descr)); + return (intr_describe(&isrc->xi_arch.intsrc, cookie, descr)); } static inline int diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c index 458a0cb396bb..023c3df22580 100644 --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -255,16 +255,12 @@ intr_lookup_source(int vector) } int -intr_add_handler(const char *name, int vector, driver_filter_t filter, +intr_add_handler(struct intsrc *isrc, const char *name, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, int domain) { - struct intsrc *isrc; int error; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); error = intr_event_add_handler(isrc->is_event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); if (error == 0) { @@ -303,13 +299,10 @@ intr_remove_handler(void *cookie) } int -intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol) +intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, + enum intr_polarity pol) { - struct intsrc *isrc; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); return (isrc->is_pic->pic_config_intr(isrc, trig, pol)); } @@ -513,14 +506,10 @@ atpic_reset(void) /* Add a description to an active interrupt handler. */ int -intr_describe(u_int vector, void *ih, const char *descr) +intr_describe(struct intsrc *isrc, void *ih, const char *descr) { - struct intsrc *isrc; int error; - isrc = intr_lookup_source(vector); - if (isrc == NULL) - return (EINVAL); error = intr_event_describe_handler(isrc->is_event, ih, descr); if (error) return (error); diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c index 8f55b543eee2..aa62c920bcd8 100644 --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -458,6 +458,7 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, void *arg, void **cookiep) { int error, domain; + struct intsrc *isrc; /* somebody tried to setup an irq that failed to allocate! */ if (irq == NULL) @@ -476,8 +477,11 @@ nexus_setup_intr(device_t bus, device_t child, struct resource *irq, if (bus_get_domain(child, &domain) != 0) domain = 0; - error = intr_add_handler(device_get_nameunit(child), - rman_get_start(irq), filter, ihand, arg, flags, cookiep, domain); + isrc = intr_lookup_source(rman_get_start(irq)); + if (isrc == NULL) + return (EINVAL); + error = intr_add_handler(isrc, device_get_nameunit(child), + filter, ihand, arg, flags, cookiep, domain); if (error == 0) rman_set_irq_cookie(irq, *cookiep); @@ -524,15 +528,24 @@ static int nexus_config_intr(device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol) { - return (intr_config_intr(irq, trig, pol)); + struct intsrc *isrc; + + isrc = intr_lookup_source(irq); + if (isrc == NULL) + return (EINVAL); + return (intr_config_intr(isrc, trig, pol)); } static int nexus_describe_intr(device_t dev, device_t child, struct resource *irq, void *cookie, const char *descr) { + struct intsrc *isrc; - return (intr_describe(rman_get_start(irq), cookie, descr)); + isrc = intr_lookup_source(rman_get_start(irq)); + if (isrc == NULL) + return (EINVAL); + return (intr_describe(isrc, cookie, descr)); } static struct resource_list *