public inbox for linux-coco@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v2 1/1] PCI/IDE: Fix using wrong VF ID for RID range calculation
@ 2026-01-14 11:14 Li Ming
  2026-01-19  2:21 ` Xu Yilun
  2026-01-23  1:35 ` dan.j.williams
  0 siblings, 2 replies; 3+ messages in thread
From: Li Ming @ 2026-01-14 11:14 UTC (permalink / raw)
  To: helgaas, dan.j.williams; +Cc: linux-pci, linux-coco, linux-kernel, Li Ming

When allocate a new IDE stream for a PCI device in SR-IOV case, the RID
range of the new IDE stream should cover all VFs of the device. VF ID
range of a PCI device is [0, num_VFs - 1], so should use (num_VFs - 1)
as the last VF's ID.

Fixes: 1e4d2ff3ae45 ("PCI/IDE: Add IDE establishment helpers")
Signed-off-by: Li Ming <ming.li@zohomail.com>
---
v2:
 * Make kernel-doc more detailed. (Yilun)
 * Fix typos in commit log. (Bjorn)
---
 drivers/pci/ide.c       | 4 ++--
 include/linux/pci-ide.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/ide.c b/drivers/pci/ide.c
index f0ef474e1a0d..799caa94ab94 100644
--- a/drivers/pci/ide.c
+++ b/drivers/pci/ide.c
@@ -283,8 +283,8 @@ struct pci_ide *pci_ide_stream_alloc(struct pci_dev *pdev)
 	/* for SR-IOV case, cover all VFs */
 	num_vf = pci_num_vf(pdev);
 	if (num_vf)
-		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf),
-				    pci_iov_virtfn_devfn(pdev, num_vf));
+		rid_end = PCI_DEVID(pci_iov_virtfn_bus(pdev, num_vf - 1),
+				    pci_iov_virtfn_devfn(pdev, num_vf - 1));
 	else
 		rid_end = pci_dev_id(pdev);
 
diff --git a/include/linux/pci-ide.h b/include/linux/pci-ide.h
index 37a1ad9501b0..381a1bf22a95 100644
--- a/include/linux/pci-ide.h
+++ b/include/linux/pci-ide.h
@@ -26,7 +26,7 @@ enum pci_ide_partner_select {
 /**
  * struct pci_ide_partner - Per port pair Selective IDE Stream settings
  * @rid_start: Partner Port Requester ID range start
- * @rid_end: Partner Port Requester ID range end
+ * @rid_end: Partner Port Requester ID range end (inclusive)
  * @stream_index: Selective IDE Stream Register Block selection
  * @mem_assoc: PCI bus memory address association for targeting peer partner
  * @pref_assoc: PCI bus prefetchable memory address association for
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-23  1:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14 11:14 [PATCH v2 1/1] PCI/IDE: Fix using wrong VF ID for RID range calculation Li Ming
2026-01-19  2:21 ` Xu Yilun
2026-01-23  1:35 ` dan.j.williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox