From nobody Wed Oct 11 19:06:32 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 4S5Mgr4t67z4wYrx; Wed, 11 Oct 2023 19:06:32 +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 4S5Mgr47s9z4bpW; Wed, 11 Oct 2023 19:06:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697051192; 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=T01AkhAlRFh508yZ1F+HFqTkLZ/Lq5BJIWvxXxbSJsI=; b=TozNSNUuwSfr0+bLw2cuqClL4RABzOlvhvkmn06s/qvWIy6Hk+v6QMqBnCBQSjAH1IlxFk FQnVnR9/Pq6899M17B5gZ6FQeVs519B4ftELhCr+jPwRu/HZAtjvm/TqabCGgwGIU2U0wt XTdQPv1XlShwimOjlTJr8kItayHD8rspSOTz106WU6IL5JXBsh3QmWUIJX2mCdGO0TOj5J dELCIlGCJ4twPVJtA7FVutZVl1Cf9Z6bHDNCQXuVl1dtza+idy6+tCCjRcfDd4NBcLImGn Drd59lz8YcNik/sxqOecJj1ejFhTjGwOcgdFARgqlQmdmeaWLTnXV5qfLeXGXA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697051192; a=rsa-sha256; cv=none; b=ahea/rSbCbm2vchkthjTqPTwxbIgwmAnlxB4LB6tLFARvTl+HWjJnmAlwj31GqtjKbq21U kdJEIYtOG+YNXZEY3eCXBb6RWoJePaEAYlGBhE+PVEF3NLHBnCxWitHzfwPFGugW1En9RC J+EDk8lNKx4WN4BbWWvKmDSVVl3A7GU2JAna06G1DtOL2rWjnjbzOH0PNppNX2oRVJaaEN FV7PWqZs4p05dLEFushYeQiu8NcBHQdWBeXsmFvLHnF15Swdf8k0PEnpalhHUw63IE2LT6 1c0TB5tG2suG9k19RNWT+EQIS7ptkNdm4SfAUKU03kRedR2CVviWViPCJEixmA== 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=1697051192; 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=T01AkhAlRFh508yZ1F+HFqTkLZ/Lq5BJIWvxXxbSJsI=; b=j3aGuU3o7CbUANX8oA53UOaxlXfMmSv9Oq6hdJZQlKoAecitNQBc2AjysKiDOPfE5Awvpe b9qGfSkijv8MCGndbJp1+QzVFzjRWTZUbXOEQZjFo0W/PW8bumZd5S5yYrIvEfitPjRemb O7kXzUpSood4B5+LoQKCslPQJTXtJwfTF16bvVbc9NpDLY3SmpANmN6g4hhmjMYG68+4v9 AAMn01oAEnDwZiACK6S1b4rY5r709eMosu6+VhDzST2vNNGl4i/l58GrsD4LyJglx6Nu8R YJ7ejwtPTEZaxBqjNC0bkLxvP5XaFegImsJxVnEEqoW/wZOEdLFydfxlE4VBEg== 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 4S5Mgr3FBKzYlX; Wed, 11 Oct 2023 19:06:32 +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 39BJ6WIe058988; Wed, 11 Oct 2023 19:06:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39BJ6WVM058985; Wed, 11 Oct 2023 19:06:32 GMT (envelope-from git) Date: Wed, 11 Oct 2023 19:06:32 GMT Message-Id: <202310111906.39BJ6WVM058985@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 358db6d8825b - stable/13 - x86: Properly align interrupt vectors for MSI 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 358db6d8825b38296a205206ac3d25b2084aa5f4 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=358db6d8825b38296a205206ac3d25b2084aa5f4 commit 358db6d8825b38296a205206ac3d25b2084aa5f4 Author: John Hay AuthorDate: 2023-09-28 21:08:08 +0000 Commit: John Baldwin CommitDate: 2023-10-11 15:09:52 +0000 x86: Properly align interrupt vectors for MSI MSI (not MSI-X) interrupt vectors must be allocated in groups that are powers of 2, and the block of IDT vectors must be aligned to the size of the request. The code in native_apic_alloc_vectors() does an alignment check in the loop: if ((vector & (align - 1)) != 0) continue; first = vector; But it adds APIC_IO_INTS to the value it returns: return (first + APIC_IO_INTS); The problem is that APIC_IO_INTS is not a multiple of 32. It is 48: As a result, a request for 32 vectors (the max supported by MSI), was not always aligned. To fix, check the alignment of 'vector + APIC_IO_INTS' in the loop. PR: 274074 Reviewed by: jhb (cherry picked from commit d33a4ae8ba5343f555842e6e32321f9cd64dfd09) --- sys/x86/x86/local_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 64358a53afcf..68468110e522 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -1655,7 +1655,7 @@ native_apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, u_int align) /* Start a new run if run == 0 and vector is aligned. */ if (run == 0) { - if ((vector & (align - 1)) != 0) + if (((vector + APIC_IO_INTS) & (align - 1)) != 0) continue; first = vector; }