From nobody Wed Oct 11 15:44:31 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 4S5HBm2ZrGz4wKKS; Wed, 11 Oct 2023 15:44: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 4S5HBm1Dn2z3dZv; Wed, 11 Oct 2023 15:44:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697039072; 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=0Dl1NGP/TmKtOe62Fqj586mvhm8rs5hKXZpoclUCw/k=; b=Pj4qoApWPkTVH7IM3CeUgzx/kxaaNhCiZeUjqKQuQem/fIizbr3GsGPc/fofIWGXip++1C FKSYzVp5ebXOhGiL+3CDMJqk92ubH/vHa96yWwzoq5QNJPxhehwA6HmvqBO5MTDYBEwMz9 RvaVWm2g6yYbP+s4CIwm1CesWE5AowTFPU7GVR/z6xmpzQ3wQE1TnjZyyq9sJX6/VIhch6 OjiVx2dkGlx90GPz3DhuPZCZcAOduTFInwaMyaJ3djRxYK4QV+VJG6RZAUK5neKOZ9SQ1B lgojTfhurADbSBaaWQFIRmqwuw9YxgAIaB6aRnm8xZq8KBxqCK55SUoEqqqwbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697039072; a=rsa-sha256; cv=none; b=EEgrHC+xG66Ils3cJE70nz1/J/kQona42U5lDZh4IWKYtB64tDUB7Rcf+8c4oKQ4c5Ghcp IAORE3uY13eshxpg9oYsQsvPuAWwU1jng6C2HjlB0oYG3ZDU39WdrogGS+qiBLKW+0OkJY 0r61htxRHTLEhLRL+JuBBqlo01cr1ugVpar54/qHoKAdmpi76Dwvw0KuM81/0UFv46J2I/ Zn4GH9ytDHJ5hNpqfY2YYtvJTVE/UIKjxYtdY+LDB0ccMzA5hKw3o/M27VVEWNni1If6om FifEuX2co8KeAIIL74ho8aaEwwV2svYG+Bbm/JWHmm+6G4qjR0yPHs4u4rlgUQ== 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=1697039072; 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=0Dl1NGP/TmKtOe62Fqj586mvhm8rs5hKXZpoclUCw/k=; b=gh34/FDZklrXMkCn86oGemWXdVGe+0N7FXm3eJTWA1EuX0izC8+QTi0VdH316tJN4i5NSG o10Q8ZIZ2FV+IRg1N6olIuGhZG5oAoGl4f76qHfQ60x1JDgIg7fWix+nb4GDvNI+mFvu1M 8UGH3MZ0T8OCiqTL5Qnvk2KbMNEFpZP5wr2zePnhhexaumoS2Z2xvvhdjcHVDfc+/P4rFx UIwdngb68eZ3PUZprGD8LXn5EKRKZHyL9aRzQLOPpqHP6Y4onHfJZKT5XlaymZcS+4+/Pq fzpt2qTmOb7vlGOk/KUmQAIeZV5PzzTR8c6ZNXlm0TZY6TC7B/Upc4m09UHnxQ== 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 4S5HBm07L0zBhM; Wed, 11 Oct 2023 15:44: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 39BFiVhG024183; Wed, 11 Oct 2023 15:44:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39BFiVR9024181; Wed, 11 Oct 2023 15:44:31 GMT (envelope-from git) Date: Wed, 11 Oct 2023 15:44:31 GMT Message-Id: <202310111544.39BFiVR9024181@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: d73b4f06403a - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: d73b4f06403af6c1a384c8c59ba9eb138c861ee1 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=d73b4f06403af6c1a384c8c59ba9eb138c861ee1 commit d73b4f06403af6c1a384c8c59ba9eb138c861ee1 Author: John Hay AuthorDate: 2023-09-28 21:08:08 +0000 Commit: John Baldwin CommitDate: 2023-10-11 15:10:32 +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 17b0223f834b..b382368cc626 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c @@ -1582,7 +1582,7 @@ 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; }