Mark McLoughlin wrote:
> On Tue, 2008-12-02 at 22:22 +0800, Han, Weidong wrote:
>> agaw may be different across iommus.
>> 
>> Signed-off-by: Weidong Han <[EMAIL PROTECTED]>
>> ---
>>  drivers/pci/dmar.c            |   14 ++++++++++++++
>>  include/linux/dma_remapping.h |    2 ++
>>  include/linux/intel-iommu.h   |    1 +
>>  3 files changed, 17 insertions(+), 0 deletions(-)
>> 
>> diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
>> index 691b3ad..ebcc7c2 100644
>> --- a/drivers/pci/dmar.c
>> +++ b/drivers/pci/dmar.c
>> @@ -491,6 +491,8 @@ int alloc_iommu(struct dmar_drhd_unit *drhd) 
>>      int map_size; u32 ver;
>>      static int iommu_allocated = 0;
>> +    unsigned long sagaw;
>> +    int agaw;
>> 
>>      iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
>>      if (!iommu)
>> @@ -506,6 +508,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
>>      iommu->cap = dmar_readq(iommu->reg + DMAR_CAP_REG);
>>      iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
>> 
>> +    /* set agaw, "SAGAW" may be different across iommus */
>> +    sagaw = cap_sagaw(iommu->cap);
>> +    for (agaw = width_to_agaw(DEFAULT_DOMAIN_ADDRESS_WIDTH); +          
>> agaw >= 0; agaw--) +         if (test_bit(agaw, &sagaw))
>> +                    break;
>> +    if (agaw < 0) {
>> +            printk(KERN_ERR "IOMMU: unsupported sagaw %lx\n", sagaw); +     
>>         goto
>> error; +     }
>> +    iommu->agaw = agaw;
> 
> Could we add something like intel_iommu_calculate_agaw() and keep the
> agaw code internal to intel-iommu.c?

Okay.

> 
> Also, "unsupported sagaw" expands to "unsupported supported adjusted
> guest address width" which doesn't make much sense :-)
> 
> "unsupported address width" would be sufficient, I think.

Agree.

Regards,
Weidong

> 
> Cheers,
> Mark.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to