From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B9B337DE97; Tue, 21 Jul 2026 18:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784657813; cv=none; b=A20AHUMXQpsWLkKSYZsQr8629beGjWUY3fjBN6I1fowJtAycoMjxxMczm2vGT3MHn/9N2DhD1chQFQwbajgRia/7gWIFz1UXch416uWqpMc/MQ5U+ICxpczAAknayRBjyei5qSiNjFqOyRwrZfWMk6SnI7vy/VXPbJreEByXE3I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784657813; c=relaxed/simple; bh=29d26ajeg8SBcm0nlAKoMRTqgSmAlFdKcGtRZArD084=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EUExOpKM+7c8nQiE3dKs+4bV/IYSnHGUCkkSjbc0OBbOeP5giGvDAq1dPXrxah01YCpReDCDn8nVnCZtvAW//dBaD+ETH10QQzBFlt6Bxq4sfhai+WyrXN9y8KI/GZpXeMCM9U9B1NZkVjYERdIQwzP2EhYkLHlge5wtzJbHDzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rRat2Nv/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rRat2Nv/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1396A1F000E9; Tue, 21 Jul 2026 18:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784657812; bh=W+60PIAOSiLOSmReZcvbTt60ojG7TvZfyL9h/i5FGXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rRat2Nv/1rMEeSfES5o12YZnLGKVPD859B1WNIHPy54/phsZGP02Rywu7j5Ne7cL7 N6cudJCynB6l3mPZmPN/3P1TwYGQ/j0WutGoW1ptlDVmwSWS2Oh0q6d6v/DIk8rAGL L2Udf7dN93f3v+cdhhBJw5NCgy0hX6PG+8Ury5Qk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Koichiro Den , Manivannan Sadhasivam , Bjorn Helgaas , Frank Li , Dave Jiang , Sasha Levin Subject: [PATCH 6.18 0907/1611] NTB: epf: Make db_valid_mask cover only real doorbell bits Date: Tue, 21 Jul 2026 17:17:03 +0200 Message-ID: <20260721152535.790099295@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Koichiro Den [ Upstream commit 6eb7e28f1f24a28234add38755687a7ed8bc2654 ] ndev->db_count includes an unused doorbell slot due to the legacy extra offset in the peer doorbell path. db_valid_mask must cover only the real doorbell bits and exclude the unused slot. Set db_valid_mask to BIT_ULL(db_count - 1) - 1. Fixes: 812ce2f8d14e ("NTB: Add support for EPF PCI Non-Transparent Bridge") Signed-off-by: Koichiro Den Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Helgaas Reviewed-by: Frank Li Reviewed-by: Dave Jiang Link: https://patch.msgid.link/20260513024923.451765-10-den@valinux.co.jp Signed-off-by: Sasha Levin --- drivers/ntb/hw/epf/ntb_hw_epf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/ntb/hw/epf/ntb_hw_epf.c b/drivers/ntb/hw/epf/ntb_hw_epf.c index 15d99d08f84f9a..051af2a45c6f98 100644 --- a/drivers/ntb/hw/epf/ntb_hw_epf.c +++ b/drivers/ntb/hw/epf/ntb_hw_epf.c @@ -560,7 +560,11 @@ static int ntb_epf_init_dev(struct ntb_epf_dev *ndev) return ret; } - ndev->db_valid_mask = BIT_ULL(ndev->db_count) - 1; + /* + * ndev->db_count includes an extra skipped slot due to the legacy + * doorbell layout, hence -1. + */ + ndev->db_valid_mask = BIT_ULL(ndev->db_count - 1) - 1; ndev->mw_count = readl(ndev->ctrl_reg + NTB_EPF_MW_COUNT); ndev->spad_count = readl(ndev->ctrl_reg + NTB_EPF_SPAD_COUNT); -- 2.53.0