Re: [PATCH 08/11] PCI/IDE: Add IDE establishment helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 10, 2024 at 08:49:40AM +0530, Aneesh Kumar K.V wrote:
> 
> Hi Dan,
> 
> Dan Williams <dan.j.williams@xxxxxxxxx> writes:
> > +int pci_ide_stream_setup(struct pci_dev *pdev, struct pci_ide *ide,
> > +			 enum pci_ide_flags flags)
> > +{
> > +	struct pci_host_bridge *hb = pci_find_host_bridge(pdev->bus);
> > +	struct pci_dev *rp = pcie_find_root_port(pdev);
> > +	int mem = 0, rc;
> > +
> > +	if (ide->stream_id < 0 || ide->stream_id > U8_MAX) {
> > +		pci_err(pdev, "Setup fail: Invalid stream id: %d\n", ide->stream_id);
> > +		return -ENXIO;
> > +	}
> > +
> > +	if (test_and_set_bit_lock(ide->stream_id, hb->ide_stream_ids)) {
> > +		pci_err(pdev, "Setup fail: Busy stream id: %d\n",
> > +			ide->stream_id);
> > +		return -EBUSY;
> > +	}
> > +
> 
> Considering we are using the hostbridge ide_stream_ids bitmap, why is
> the stream_id allocation not generic? ie, any reason why a stream id alloc
> like below will not work?

Should be illustrating in commit log.

"The other design detail for TSM-coordinated IDE establishment is that
the TSM manages allocation of stream-ids, this is why the stream_id is
passed in to pci_ide_stream_setup()."

This is true for Intel TDX.

Thanks,
Yilun

> 
> static int pcie_ide_sel_streamid_alloc(struct pci_dev *pdev)
> {
> 	int stream_id;
> 	struct pci_host_bridge *hb;
> 
> 	hb = pci_find_host_bridge(pdev->bus);
> 
> 	stream_id = find_first_zero_bit(hb->ide_stream_ids, hb->nr_ide_streams);
> 	if (stream_id >= hb->nr_ide_streams)
> 		return -EBUSY;
> 
> 	return stream_id;
> }



> 
> -aneesh
> 




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux