From nobody Thu Oct 17 14:32:14 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 4XTqzf4QtWz5Z48Q; Thu, 17 Oct 2024 14:32:14 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XTqzf3sx5z51JW; Thu, 17 Oct 2024 14:32:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729175534; 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=3cRJOv7GuXGBXK0MNxDx3jdLjRcNwu4jqBiz/xOhUE0=; b=eF1XWUqB75PndlkMj7i/ziVlMhLTkWpLoCO8VCjIso4TZax/zaMKTvjUfjSvl2CVP1+iBB KDZ0AFBgfNOO2u4FkXQM0rlD5HBXLYi7hx87D7eTCWsOn5QpHpDPsJk8Vth3D4WO0iJX1+ YDQALwXRy9gaqp3ZeJLFHk0wBNokBX34ICRmkWStrJvn/7su48YshcprElUqm2WduQI2ER N8O6XJWFa14j1LZyTPKpycE5i7OWvh6WxWs6NMqYi+Y4nsEywOT7qbMem4bGllkQcNbqOD QFkj5c34aLJW4al2avhl0a9CLjhy/iIklJo7OgNCwIrk545n5Cii7AM52Ae4Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729175534; 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=3cRJOv7GuXGBXK0MNxDx3jdLjRcNwu4jqBiz/xOhUE0=; b=B+JR4winwt9p4LsDAVcGzKAn1i2WXumI917fdDOd63RsazcfX2ECqMwBqYjzhtVCfEXrfj bHfHgeV+aes8GADzCzOhrKb3qGb133zQPX0GDdZEAGsy9Rys9Tc0JNdABWtnZszkCQGar5 Z/p18Uz3FLCogt7RaVs/9iw1W135cPIU3WNmfFlXcqpXMHGp9IH9iQoPl7z/1u8tgmkU+W B1ohRwtl9Zcpt8yer5JWe3zMXvAO6vO+/yv8gV597btXfTJ5NFpHVLY3QY4hQc4tFNV0Nl ntQ6bCJMIVtDieGD4l3ejeVzuAqCJl2/0jmVDeVrBARBRF5/BwDnPwJy8iYM2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729175534; a=rsa-sha256; cv=none; b=lgLymV+e/6wNPF8m5w1IQS0Z4rntcV4ufpjqHtsiirEnBQKeoDycJH9pUWc/j7AQ/7+qZZ m8DXJNtmXOJXA2mCn94/GwspuIgz4pO/I+BvDZRdcDwJEK43pJqsqxxU9+IO9nwcGTVlVp +AeLrbMXb1OTgFljfK6sOG1G5jGklS1NwelI0//qp5l1yDQh5pVLCrpmbjKc2NB6Q08YGw andGEp0O3tu+pByZQYlgRgW87cqVCTPNqvicpfC605dGb0BxELMXVgEjizEG/OeyCom0Ap CQTc14y/MGmW1pOQVBLUjfw1rjhqmtiVOG8DAst1vSz77FqvgwQRzMc862m8Zw== 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 4XTqzf3LPTzsqd; Thu, 17 Oct 2024 14:32:14 +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 49HEWEJh026987; Thu, 17 Oct 2024 14:32:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49HEWE9G026984; Thu, 17 Oct 2024 14:32:14 GMT (envelope-from git) Date: Thu, 17 Oct 2024 14:32:14 GMT Message-Id: <202410171432.49HEWE9G026984@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ea4e4449b855 - main - apic: add ioapic_get_dev() method 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ea4e4449b85593025c2eb31bb642732971d96225 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ea4e4449b85593025c2eb31bb642732971d96225 commit ea4e4449b85593025c2eb31bb642732971d96225 Author: Konstantin Belousov AuthorDate: 2024-10-12 22:52:44 +0000 Commit: Konstantin Belousov CommitDate: 2024-10-17 14:31:50 +0000 apic: add ioapic_get_dev() method which returns apic device_t by apic_id, if there exists the pci representer Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/include/apicvar.h | 1 + sys/x86/x86/io_apic.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/sys/x86/include/apicvar.h b/sys/x86/include/apicvar.h index ac6a82659e34..61c726f150df 100644 --- a/sys/x86/include/apicvar.h +++ b/sys/x86/include/apicvar.h @@ -258,6 +258,7 @@ void lapic_handle_intr(int vector, struct trapframe *frame); void lapic_handle_timer(struct trapframe *frame); int ioapic_get_rid(u_int apic_id, uint16_t *ridp); +device_t ioapic_get_dev(u_int apic_id); extern int x2apic_mode; extern int lapic_eoi_suppression; diff --git a/sys/x86/x86/io_apic.c b/sys/x86/x86/io_apic.c index 4337d1adc8a9..525547f9482a 100644 --- a/sys/x86/x86/io_apic.c +++ b/sys/x86/x86/io_apic.c @@ -1081,6 +1081,22 @@ ioapic_get_rid(u_int apic_id, uint16_t *ridp) return (0); } +device_t +ioapic_get_dev(u_int apic_id) +{ + struct ioapic *io; + + mtx_lock_spin(&icu_lock); + STAILQ_FOREACH(io, &ioapic_list, io_next) { + if (io->io_hw_apic_id == apic_id) + break; + } + mtx_unlock_spin(&icu_lock); + if (io != NULL) + return (io->pci_dev); + return (NULL); +} + /* * A new-bus driver to consume the memory resources associated with * the APICs in the system. On some systems ACPI or PnPBIOS system