From nobody Thu Aug 10 05:20:55 2023 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 4RLwJ02dNZz4q6LT; Thu, 10 Aug 2023 05:21:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4RLwHz66P9z3bG3; Thu, 10 Aug 2023 05:21:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.17.1/8.17.1) with ESMTPS id 37A5KtQq086656 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 10 Aug 2023 08:20:59 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 37A5KtQq086656 Received: (from kostik@localhost) by tom.home (8.17.1/8.17.1/Submit) id 37A5KtOP086655; Thu, 10 Aug 2023 08:20:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 10 Aug 2023 08:20:55 +0300 From: Konstantin Belousov To: Ed Maste Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: cbf845052f1c - main - msi: report error for attempt to use APIC ID > 255 Message-ID: References: <202308091817.379IHCL9010484@gitrepo.freebsd.org> 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202308091817.379IHCL9010484@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.0 X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on tom.home X-Rspamd-Queue-Id: 4RLwHz66P9z3bG3 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] On Wed, Aug 09, 2023 at 06:17:12PM +0000, Ed Maste wrote: > 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) { I suspect 0xff is also invalid destination apic id. For the Pentium 4 and Intel Xeon processors, the xAPIC specification extends the local APIC ID field to 8 bits. These can be used to identify up to 255 processors in the system. > + 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);