Hi Yinghan,

On Thu, Nov 05, 2020 at 10:05:28PM +0000, Yinghan Yang wrote:
> Thank you for the clarifications. In cases where a large range of  PCI 
> segments may be assigned to guest, would it make sense to describe this 
> configuration as base + count. Currently, one would have to describe them 
> individually. 

Yes, I've been wondering whether that would be useful. It would also allow
hotplugging new segments, if that's ever needed. It requires changing the
enumeration rule that derives an endpoint ID from segment + BDF number.

First, when describing a range of segments, are BFD start and end still
valid?  Do they only apply to first and last segment respectively?  To
keep things simple I think BDF start/end should keep the same meaning:
valid regardless of segment range, and apply to all segments in the range.

So the new PCI Range node could be:

Field                   Length  Offset  Description
-------------------------------------------------------------------------------
Type                    1       0       1 – PCI range
Reserved                1       1       0.
Length                  2       2       Length of the node in bytes.
Endpoint start          4       4       First endpoint ID.
PCI Segment start       2       8       First PCI Segment number in the range.
PCI Segment end         2       10      Last PCI Segment number in the range.
PCI BDF start           2       12      First Bus-Device-Function number in the 
range.
PCI BDF end             2       14      Last Bus-Device-Function number in the 
range.
Output node             2       16      Offset from the start of the table to 
the next translation element.
Reserved                6       18      0.

A PCI device is affected by the node if its segment is in [Segment start,
Segment end], and if its BDF is in [BPF start, BDF end]. Its endpoint ID
will be:

    ((Segment - Segment start) << 16) + BDF - BDF start + Endpoint start

Does that sound OK?

Thanks,
Jean

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to