From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381106; b=ru83bl4Qek7zvzP19HMb6GiF68wWvnbGnRCzyFY7D5EaedaPI2+T/t9Ut95MYPRfOPib YsEjs+qZwbb6pCJjnDW1M32DWhyzd4vcTy6au81+9G0yOMdtc9TFR0iMXlnKsd0zdOHI5 AcydbfnONgB9ySrxo/+aKB1JkRCuC5h/ljUObF/RiCcoKOUUWdVXwTEVY7LEOPndcXo14 03151p9EEUo6X9BEZ3zZmjX7LVPZ3PZ+Qkg9xYXAIoITtWxCd58H6gYioQPl3JNMucu7F X5h3tjq/uXnieMC6KIDEXvCVCJ8Ff8/nbDfKL2sTsRlHxLKNS3Q10HoD2K86hF1nY7Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381106; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=zJTytAk4HOIjiOziYBdRDe/LdjO32Tq+TJSlwzhA0ks=; b=Sw7VbosrhICfj/U10AOtUTKIhJnCqkcLsGDJxE+TCX8Zdu9cMyqBWA/7hoeRdnSIUoYZ 9JOM79NeoaZKACnHxH7fOCCm4EnpyGFUYzW9ESjZMjvZ/JGBz/pxEQyiEY4EZRkeINcw/ ROW8I/y3TrQR8SYUMWpGx9DA0H5OVEGIdtAtj589nQN7kQWj7z09aL6xeHZEK/PIqYWez EXhUEkexQtnIs5xPK87CdatrKO8d7M+nT4N5yjyR6xKUM8DKbEFHds2XWeL7dvf7RKatr PIH9CtJ92o7O2AMKB81EdWanLuBnC7nA4L1DeFHLGTsqaxInncPk9BkKx9SMrOWV6aQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UgteabLR; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 686A6606A32F; Fri, 4 Dec 2026 10:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=UgteabLR Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7A41F00934; Fri, 4 Dec 2026 10:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381106; bh=zJTytAk4HOIjiOziYBdRDe/LdjO32Tq+TJSlwzhA0ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UgteabLRAhoMfFEsmvlI9ZgGcEcMN5Wflj8RvFf/NxLI5YDXWMqM4U7QsqnEin7Y2 lVSjhcsM7xe32/iNZbH2/Al0j+kRKcmxbrIDYh+c4YqwEz2BRYwS0+IN1zJ5Xyo2tX G+i6LVgZB8GllikVamDmkWtxAJ06u9Y4/1Y07oSQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Keith Lucas , Abhijit Gangurde , Leon Romanovsky Subject: [PATCH 7.3 560/742] RDMA/ionic: Use a linear QID space when udma_shift is zero Date: Fri, 4 Dec 2026 19:07:04 +0900 Message-ID: <20261204100650.025231362@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abhijit Gangurde commit 687a1e161457b267963f8334fd143896515cec25 upstream. Firmware reports udma_shift as the log2 of the number of queues in a queue group. A value of zero means the queues are not striped across two UDMAs, so the QID space is linear and the device has one UDMA. The interleaved bitid/qid transform treats bit 0 as the UDMA selector when the group shift is zero. QID 1 then becomes bitid 1 << half_qid_shift, and freeing that QID releases the wrong allocator index. Skip the transform and select one UDMA so QP and CQ allocation uses the QID directly. Fixes: e8521822c733 ("RDMA/ionic: Register device ops for control path") Reported-by: Keith Lucas Link: https://lore.kernel.org/r/20261021161651.4020222-1-haakon.bugge@oracle.com Cc: stable@vger.kernel.org # 6.18 Signed-off-by: Abhijit Gangurde Link: https://patch.msgid.link/20261030082402.841751-1-abhijit.gangurde@amd.com Signed-off-by: Leon Romanovsky Signed-off-by: Greg Kroah-Hartman --- drivers/infiniband/hw/ionic/ionic_lif_cfg.c | 2 +- drivers/infiniband/hw/ionic/ionic_res.h | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) --- a/drivers/infiniband/hw/ionic/ionic_lif_cfg.c +++ b/drivers/infiniband/hw/ionic/ionic_lif_cfg.c @@ -83,7 +83,7 @@ void ionic_fill_lif_cfg(struct ionic_lif cfg->cq_qtype = ident->rdma.cq_qtype.qtype; cfg->eq_qtype = ident->rdma.eq_qtype.qtype; cfg->udma_qgrp_shift = ident->rdma.udma_shift; - cfg->udma_count = 2; + cfg->udma_count = cfg->udma_qgrp_shift ? 2 : 1; cfg->max_stride = ident->rdma.max_stride; cfg->expdb_mask = ionic_get_expdb(lif); --- a/drivers/infiniband/hw/ionic/ionic_res.h +++ b/drivers/infiniband/hw/ionic/ionic_res.h @@ -125,10 +125,14 @@ static inline void ionic_resid_put(struc static inline u32 ionic_bitid_to_qid(u32 bitid, u8 qgrp_shift, u8 half_qid_shift) { - u32 udma_bit = - (bitid & BIT(half_qid_shift)) >> (half_qid_shift - qgrp_shift); - u32 grp_bits = (bitid & GENMASK(half_qid_shift - 1, qgrp_shift)) << 1; - u32 idx_bits = bitid & (BIT(qgrp_shift) - 1); + u32 udma_bit, grp_bits, idx_bits; + + if (!qgrp_shift) + return bitid; + + udma_bit = (bitid & BIT(half_qid_shift)) >> (half_qid_shift - qgrp_shift); + grp_bits = (bitid & GENMASK(half_qid_shift - 1, qgrp_shift)) << 1; + idx_bits = bitid & (BIT(qgrp_shift) - 1); return grp_bits | udma_bit | idx_bits; } @@ -145,9 +149,14 @@ static inline u32 ionic_bitid_to_qid(u32 */ static inline u32 ionic_qid_to_bitid(u32 qid, u8 qgrp_shift, u8 half_qid_shift) { - u32 udma_bit = (qid & BIT(qgrp_shift)) << (half_qid_shift - qgrp_shift); - u32 grp_bits = (qid & GENMASK(half_qid_shift, qgrp_shift + 1)) >> 1; - u32 idx_bits = qid & (BIT(qgrp_shift) - 1); + u32 udma_bit, grp_bits, idx_bits; + + if (!qgrp_shift) + return qid; + + udma_bit = (qid & BIT(qgrp_shift)) << (half_qid_shift - qgrp_shift); + grp_bits = (qid & GENMASK(half_qid_shift, qgrp_shift + 1)) >> 1; + idx_bits = qid & (BIT(qgrp_shift) - 1); return udma_bit | grp_bits | idx_bits; }