@@ -2747,106 +2747,6 @@ const struct iommu_ops amd_iommu_ops = {
2747
2747
}
2748
2748
};
2749
2749
2750
- static int __flush_pasid (struct protection_domain * domain , u32 pasid ,
2751
- u64 address , size_t size )
2752
- {
2753
- struct iommu_dev_data * dev_data ;
2754
- struct iommu_cmd cmd ;
2755
- int i , ret ;
2756
-
2757
- if (!(domain -> flags & PD_IOMMUV2_MASK ))
2758
- return - EINVAL ;
2759
-
2760
- build_inv_iommu_pages (& cmd , address , size , domain -> id , pasid , true);
2761
-
2762
- /*
2763
- * IOMMU TLB needs to be flushed before Device TLB to
2764
- * prevent device TLB refill from IOMMU TLB
2765
- */
2766
- for (i = 0 ; i < amd_iommu_get_num_iommus (); ++ i ) {
2767
- if (domain -> dev_iommu [i ] == 0 )
2768
- continue ;
2769
-
2770
- ret = iommu_queue_command (amd_iommus [i ], & cmd );
2771
- if (ret != 0 )
2772
- goto out ;
2773
- }
2774
-
2775
- /* Wait until IOMMU TLB flushes are complete */
2776
- amd_iommu_domain_flush_complete (domain );
2777
-
2778
- /* Now flush device TLBs */
2779
- list_for_each_entry (dev_data , & domain -> dev_list , list ) {
2780
- struct amd_iommu * iommu ;
2781
- int qdep ;
2782
-
2783
- /*
2784
- There might be non-IOMMUv2 capable devices in an IOMMUv2
2785
- * domain.
2786
- */
2787
- if (!dev_data -> ats_enabled )
2788
- continue ;
2789
-
2790
- qdep = dev_data -> ats_qdep ;
2791
- iommu = rlookup_amd_iommu (dev_data -> dev );
2792
- if (!iommu )
2793
- continue ;
2794
- build_inv_iotlb_pages (& cmd , dev_data -> devid , qdep ,
2795
- address , size , pasid , true);
2796
-
2797
- ret = iommu_queue_command (iommu , & cmd );
2798
- if (ret != 0 )
2799
- goto out ;
2800
- }
2801
-
2802
- /* Wait until all device TLBs are flushed */
2803
- amd_iommu_domain_flush_complete (domain );
2804
-
2805
- ret = 0 ;
2806
-
2807
- out :
2808
-
2809
- return ret ;
2810
- }
2811
-
2812
- static int __amd_iommu_flush_page (struct protection_domain * domain , u32 pasid ,
2813
- u64 address )
2814
- {
2815
- return __flush_pasid (domain , pasid , address , PAGE_SIZE );
2816
- }
2817
-
2818
- int amd_iommu_flush_page (struct iommu_domain * dom , u32 pasid ,
2819
- u64 address )
2820
- {
2821
- struct protection_domain * domain = to_pdomain (dom );
2822
- unsigned long flags ;
2823
- int ret ;
2824
-
2825
- spin_lock_irqsave (& domain -> lock , flags );
2826
- ret = __amd_iommu_flush_page (domain , pasid , address );
2827
- spin_unlock_irqrestore (& domain -> lock , flags );
2828
-
2829
- return ret ;
2830
- }
2831
-
2832
- static int __amd_iommu_flush_tlb (struct protection_domain * domain , u32 pasid )
2833
- {
2834
- return __flush_pasid (domain , pasid , 0 , CMD_INV_IOMMU_ALL_PAGES_ADDRESS );
2835
- }
2836
-
2837
- int amd_iommu_flush_tlb (struct iommu_domain * dom , u32 pasid )
2838
- {
2839
- struct protection_domain * domain = to_pdomain (dom );
2840
- unsigned long flags ;
2841
- int ret ;
2842
-
2843
- spin_lock_irqsave (& domain -> lock , flags );
2844
- ret = __amd_iommu_flush_tlb (domain , pasid );
2845
- spin_unlock_irqrestore (& domain -> lock , flags );
2846
-
2847
- return ret ;
2848
- }
2849
-
2850
2750
int amd_iommu_complete_ppr (struct pci_dev * pdev , u32 pasid ,
2851
2751
int status , int tag )
2852
2752
{
0 commit comments