From nobody Wed Aug 09 18:17:12 2023 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 4RLdZ04KHgz4m64w; Wed, 9 Aug 2023 18:17:12 +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 4RLdZ03gqLz3TZV; Wed, 9 Aug 2023 18:17:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691605032; 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=TPFwY6g7WsQuXlSUY7oXPIcGRvojOGHr7kDE09aksM4=; b=JeX++kEv+CQfOZ3r7LW7AfXyE012b2lw24m51UOScKQ3vKghbx7lniApX1MgWfWZuW9CB5 CsGWn1ReAwfsKQYgeZNTQMtrJx8Li5z+xCZ5uUwr0yaOgtpOUfgu1cMfVtMT3vUZFyxEdp KJxg45oiVkl0g7Luqd6x6hO08zoQLZ5kTLc5FGZcWbHJuN9dqAgrEuEfHRF8AWwRVJZ+au m55iWPpW3K2Hb8+Cj+M4Xg2QUptM2i+9cQTr3Xv3vTytt6YkvJbYoP2Rq8RdyqPD564M37 BzYtG/twPqJ+m448AExkmL8iQg6pPXgQHHm0IeJGOEFgXrHz5LTgt3mwusqe0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1691605032; 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=TPFwY6g7WsQuXlSUY7oXPIcGRvojOGHr7kDE09aksM4=; b=oBKVsI7CTXWFIPQXeDbU9htxr1x/HzrOZ9n2O041eDJY9vpkj0RKbGyxbq2X+hz0B7qKNm RYnWSo1H1sJGsHpjFUrghhQkuUSzvY8l4PJmOiBwKnCQwD3F5D21W8ngifVE/zxINZfJ4Y ccJ0tpSBp3l/xnHZahWvIs4c2SPXpsBaqT+jbsDs3OYARHn7ufHE0Rpphy+yr5zevlOx7e Jl2tbQgdpLKudjMreHQatuMfAysCUufLqSb4SURuFrTAndJdKJUhTZU6ufhiCDJ5S09Lyg STDw7FYbcZvdhY+w8S8goy+WnNiuqI44qcSY8erfTqd5cBJ3GLlJi55EEbuw1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1691605032; a=rsa-sha256; cv=none; b=CrrjMyGrmT1RUqxKHmUwQkRiCxSztjxXjGf3WeSTJmg5JauYP2Em5pV+xFD+Jb30Sayl1O 94ppvtgwbOQsx+rlqx8VkvFZkvNfrdYKa9f6DM4AjVU4ds3YACPrcWal2MVOJNrE7V07jm q0rGyHedr8y0HIlmBWMHCEAmvPQMUlr+r2MRs2y2bfB9WxHN2twqj870Am3ZSZvKw4TXwr hdvEUoVpIL2pJucduxrtpivQj+MZ5d7zzhpWwpNQUfozn0P4zGu8u/ZROR5oLIXNDmA4k9 bXq1G1s8XWQFNkL+LlFwTYoN9snQD6oHAnSPUncB2rcsK+5wCVjSJq45PxPgAg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RLdZ02nKWz9Z8; Wed, 9 Aug 2023 18:17:12 +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 379IHCqv010487; Wed, 9 Aug 2023 18:17:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 379IHCL9010484; Wed, 9 Aug 2023 18:17:12 GMT (envelope-from git) Date: Wed, 9 Aug 2023 18:17:12 GMT Message-Id: <202308091817.379IHCL9010484@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: cbf845052f1c - main - msi: report error for attempt to use APIC ID > 255 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cbf845052f1c2862a64e66dbaf38e887a7592474 Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cbf845052f1c2862a64e66dbaf38e887a7592474 commit cbf845052f1c2862a64e66dbaf38e887a7592474 Author: Ed Maste AuthorDate: 2023-08-08 23:42:09 +0000 Commit: Ed Maste CommitDate: 2023-08-09 17:52:43 +0000 msi: report error for attempt to use APIC ID > 255 The MSI/MSI-X address includes 8 bits to encode the Destination ID. Previously IDs over 255 overlapped with the fixed portion of the address, resulting in an invalid value (and a nonfunctional interrupt). Instead, print an error message and return EINVAL. The interrupt will still not work, but the user will have a clue as to why. PR: 273022 Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41395 --- sys/x86/x86/msi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/x86/x86/msi.c b/sys/x86/x86/msi.c index f85d4a5161e5..de8f42c0fa68 100644 --- a/sys/x86/x86/msi.c +++ b/sys/x86/x86/msi.c @@ -620,6 +620,11 @@ msi_map(int irq, uint64_t *addr, uint32_t *data) mtx_unlock(&msi_lock); error = EOPNOTSUPP; #endif + if (error == EOPNOTSUPP && msi->msi_cpu > 0xff) { + printf("%s: unsupported destination APIC ID %u\n", __func__, + msi->msi_cpu); + error = EINVAL; + } if (error == EOPNOTSUPP) { *addr = INTEL_ADDR(msi); *data = INTEL_DATA(msi);