qemu-arm
[Top][All Lists]
Advanced

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

Re: [Qemu-arm] [PATCH 14/27] iommu: Add IOMMU index concept to IOMMU API


From: Peter Maydell
Subject: Re: [Qemu-arm] [PATCH 14/27] iommu: Add IOMMU index concept to IOMMU API
Date: Tue, 22 May 2018 18:51:07 +0100

On 22 May 2018 at 18:42, Richard Henderson <address@hidden> wrote:
> On 05/21/2018 07:03 AM, Peter Maydell wrote:
>> +    /* Return the IOMMU index to use for a given set of transaction 
>> attributes.
>> +     *
>> +     * Optional method: if an IOMMU only supports a single IOMMU index then
>> +     * the default implementation of memory_region_iommu_attrs_to_index()
>> +     * will return 0.
>> +     *
>> +     * The indexes supported by an IOMMU must be contiguous, starting at 0.
>> +     *
>> +     * @iommu: the IOMMUMemoryRegion
>> +     * @attrs: memory transaction attributes
>> +     */
>> +    int (*attrs_to_index)(IOMMUMemoryRegion *iommu, MemTxAttrs attrs);
>> +
>> +    /* Return the number of IOMMU indexes this IOMMU supports.
>> +     *
>> +     * Optional method: if this method is not provided, then
>> +     * memory_region_iommu_num_indexes() will return 1, indicating that
>> +     * only a single IOMMU index is supported.
>> +     */
>
> The mispatched callback has been discussed, but would it be equally useful to
> simply have a variable here instead of a callback?  Perhaps max_index instead
> of num_indexes so that zero-initialization of the structure does the right
> thing for existing iommu's.

That wouldn't allow for multiple instances of the same class where the
answer is different (eg "my_iommu->has_trustzone_support ? 2 : 1" where
the answer depends on how the instance is configured via QOM properties).

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]