Matthew Jacob wrote:
> On 09/07/08 19:48, Garrett D'Amore wrote:
>>
>> Knowing that the IOMMU is in play might allow you to assume that only 
>> one cookie will be needed.  But it would be poor form to rely on that 
>> behavior.  
> You've missed my point.
>
> The point is that knowing the attributes of the underlying mapping 
> algorithm (via properties, e.g., at load time, per instance), the 
> driver can make allocation policy choices that make sense for that 
> current load time, instance, etc.
>
> There is no 'relying' here.
>
But, those choices (the decision to allocate just a single descriptor 
entry for example) or not really need to be done carefully.  If the 
decision is is made at attach(9e) time, then the resources allocated 
should match the number of cookies that are claimed to be supported by 
the ddi_dma_attr's sgllen field.

Now, if you know that an IOMMU is in play, you could restrict that entry 
to 1, and only allocate a single descriptor.  But you'd have to be 100% 
certain.  When an IOMMU is *not* in play, you should avoid making too 
many assumptions.  (You could probably assume that the # cookies or 
descriptors to be allocated will not exceed the (total alloc size / page 
size + 1) calculation, I suppose.)

    -- Garrett

Reply via email to