From nobody Tue Jul 7 11:30:04 2026 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 4gvfCc4YKsz6dRPX for ; Tue, 07 Jul 2026 11:30:04 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gvfCc1Rvvz3M1W for ; Tue, 07 Jul 2026 11:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783423804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KC+LQMsKD5JMD2HbzUWXhIaAvPGMMJBG/wcVje8zDeo=; b=ErdLK1olAxwOR5NeYZ8/jcYdWJy3M19B3pjkSdgeDpf4M35WvW3a7k8hJ+RiKzInHRG1UP FAGHT4LNkEfbjc/YinmjBJ6+kn06rWimeN28oIZQnYfXYSF4vNakWesc3lzepe23hePtW+ vfF7vyYDOUbIMG/i8ygosEe8OI7pZJ5q9QiuoStp16kIVOYv8PMXm4EjwsqXFOnmSK6Ymu DOromQdAkMYemb03zv76C3zbx03/8xt5Ks9Qli2ZKlG6pV7cSNYub+/CvImgFgYWeCfHCc pM8z1QXBFPB0RTB57ErRMQce5H1NEsvXuS/NWdPzb9s4bzj+ghEeRS/DmnTD9g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783423804; a=rsa-sha256; cv=none; b=vNb9LEcAofOiiFZI9O24pOCflUjXiHWZXQTJH8kx68YFhCc0IIQebRy/XP6FkZn/g722kW 8tOvmvUrvoZIQzlFSwP2Su3kiIb1lLsRPu6HB+ULNthzsPVcZR8u+aPX/iI86TTLcZpMmB F4KsIoiEEoLCzsQzcqxwPsI7K+Bl4Iba9yWpNsU3DLxsRJbdkFtgcs2gQ3a1te5SkaJTFI 4UoFJqStklfnJXSjU/gvJ6ASi7NgQuAA0Errejtkbivx/i16K1SwSpt36Cam1VyKVl/q0M eeKW6TLZgB8Pr7Cfg+gcqtXc22SFwCfkXxMNPlUdhMoQuJOijD73XWyIYZkrHA== 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=1783423804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KC+LQMsKD5JMD2HbzUWXhIaAvPGMMJBG/wcVje8zDeo=; b=rvUGSj3Qd/bV0RN+vyBxxC/3tZSAFvs9bQ0KBonEcKaYmUg7LZX/9zw982ysBiqS/2JunW LKynVvXB9uVUZHEjQhxMj+IEMvQe/GIDf5fqeqG1rvakLF0YlZK5Y/UgmY8f9D9zQqO78m KnuQFO1MfB8QcS4cbnN0OEqdlZj/lnMkWITMZhbwJeneCcddNa7KHeBaHTGEJ/LmCvZSo9 /doZNu54q+0aL0PorHoMZObq7qzQvA32Lt0zkq2sZ6U0+qhzZlvjPqGbQtkIkr/2LqgouE RAimAcKSDTyik5z2YkqdmlT5IiQQ+nV7LN5eS/wmsOz+EqRIE0BHmS89nxIMGg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gvfCc0BX8zZLn for ; Tue, 07 Jul 2026 11:30:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3605e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 07 Jul 2026 11:30:04 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Ariel Ehrenberg From: Konstantin Belousov Subject: git: bfe14bfeb8dc - main - mlx5: mark completion EQs as a shared resource for DEVX uids 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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: bfe14bfeb8dcefc606bdf76c40987467bbd36d92 Auto-Submitted: auto-generated Date: Tue, 07 Jul 2026 11:30:04 +0000 Message-Id: <6a4ce33c.3605e.66d03ba9@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=bfe14bfeb8dcefc606bdf76c40987467bbd36d92 commit bfe14bfeb8dcefc606bdf76c40987467bbd36d92 Author: Ariel Ehrenberg AuthorDate: 2026-06-04 15:46:17 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-07 11:24:48 +0000 mlx5: mark completion EQs as a shared resource for DEVX uids A firmware object owned by a DEVX uid may only reference resources owned by the same uid or ones explicitly marked as shared. Completion EQs were created with uid 0, so a CQ owned by a DEVX uid could not attach to its EQ and CREATE_CQ failed with "bad resource". Create completion EQs with MLX5_SHARED_RESOURCE_UID on devices that support user contexts, so uid-owned CQs can use them. The code follows the Linux commit d2c8a1554c10d5e0443b1f97f480d7dacd55cf55 ("IB/mlx5: Enable UAR to have DevX UID"). Reviewed by: kib Tested by: Wafa Hamzah Sponsored by: Nvidia networking MFC after: 1 month --- sys/dev/mlx5/mlx5_core/mlx5_eq.c | 8 ++++++++ sys/dev/mlx5/mlx5_ifc.h | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sys/dev/mlx5/mlx5_core/mlx5_eq.c b/sys/dev/mlx5/mlx5_core/mlx5_eq.c index f564b88c48b4..5279d71e3e86 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_eq.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_eq.c @@ -487,6 +487,14 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, mlx5_fill_page_array(&eq->buf, pas); MLX5_SET(create_eq_in, in, opcode, MLX5_CMD_OP_CREATE_EQ); + /* + * Completion EQs (no event mask) must be marked as a shared resource + * when the device supports user contexts; otherwise CQs owned by a + * DEVX uid cannot attach to them and CREATE_CQ fails with a firmware + * "bad resource" error. + */ + if (mask == 0 && MLX5_CAP_GEN(dev, log_max_uctx)) + MLX5_SET(create_eq_in, in, uid, MLX5_SHARED_RESOURCE_UID); MLX5_SET64(create_eq_in, in, event_bitmask, mask); eqc = MLX5_ADDR_OF(create_eq_in, in, eq_context_entry); diff --git a/sys/dev/mlx5/mlx5_ifc.h b/sys/dev/mlx5/mlx5_ifc.h index 0a3bb9b38568..952f51d3c3f7 100644 --- a/sys/dev/mlx5/mlx5_ifc.h +++ b/sys/dev/mlx5/mlx5_ifc.h @@ -26,6 +26,12 @@ #ifndef MLX5_IFC_H #define MLX5_IFC_H +/* + * Special UID that marks a resource (e.g. an EQ) as shared, so that + * objects owned by a user context (DEVX uid) may reference it. + */ +#define MLX5_SHARED_RESOURCE_UID 0xffff + #include enum { @@ -8317,7 +8323,7 @@ struct mlx5_ifc_create_eq_out_bits { struct mlx5_ifc_create_eq_in_bits { u8 opcode[0x10]; - u8 reserved_0[0x10]; + u8 uid[0x10]; u8 reserved_1[0x10]; u8 op_mod[0x10];