>> +    /* We found some strange devices in HP c7000 and other platforms, they
>> +     * can not be enumerated by OS, and they did DMA read/write without
>> +     * driver management. if we open iommu in these platforms, the DMA
>> read/write
>> +     * will be blocked by IOMMU hardware. Currently, we only create identity
>> mapping
>> +     * for the devices in OS. To fix this, add iommu=pt_force=segment:busnum
>> to
>> +     * force to do identity mapping for the specific bus.
>> +     */
>> +    if (iommu_pt_force_bus >= 0 && iommu_pt_force_bus >= 0) {
> 
> iommu_pt_force_bus twice?

Sharp eyes! Sorry, it should be if (iommu_pt_force_domain >= 0 && 
iommu_pt_force_bus >= 0).

Thanks for your good catch!

Thanks!
Yijing.

> 
> Thanks
> -Bharat
> 
>> +            int found = 0;
>> +
>> +            iommu = NULL;
>> +            for_each_active_iommu(iommu, drhd) {
>> +                    if (iommu_pt_force_domain != drhd->segment)
>> +                            continue;
>> +
>> +                    for_each_active_dev_scope(drhd->devices, 
>> drhd->devices_cnt,
>> i, dev) {
>> +                            if (!dev_is_pci(dev))
>> +                                    continue;
>> +
>> +                            pdev = to_pci_dev(dev);
>> +                            if (pdev->bus->number == iommu_pt_force_bus ||
>> +                                            (pdev->subordinate
>> +                                             && pdev->subordinate->number <=
>> iommu_pt_force_bus
>> +                                             && 
>> pdev->subordinate->busn_res.end >=
>> iommu_pt_force_bus)) {
>> +                                    found = 1;
>> +                                    break;
>> +                            }
>> +                    }
>> +
>> +                    if (drhd->include_all) {
>> +                            found = 1;
>> +                            break;
>> +                    }
>> +            }
>> +
>> +            if (found && iommu)
>> +                    for (i = 0; i < 256; i++)
>> +                            domain_context_mapping_one(si_domain, iommu,
>> iommu_pt_force_bus,
>> +                                            i,  hw ? 
>> CONTEXT_TT_PASS_THROUGH :
>> +                                            CONTEXT_TT_MULTI_LEVEL);
>> +    }
>> +
>>      return 0;
>>  }
>>
>> --
>> 1.7.1
>>
>> _______________________________________________
>> iommu mailing list
>> iommu@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/iommu
> 
> .
> 


-- 
Thanks!
Yijing

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

Reply via email to