@@ -1722,9 +1722,6 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
17221722 if (ecap_prs (iommu -> ecap ))
17231723 intel_svm_finish_prq (iommu );
17241724 }
1725- if (vccap_pasid (iommu -> vccap ))
1726- ioasid_unregister_allocator (& iommu -> pasid_allocator );
1727-
17281725#endif
17291726}
17301727
@@ -2797,85 +2794,6 @@ static int copy_translation_tables(struct intel_iommu *iommu)
27972794 return ret ;
27982795}
27992796
2800- #ifdef CONFIG_INTEL_IOMMU_SVM
2801- static ioasid_t intel_vcmd_ioasid_alloc (ioasid_t min , ioasid_t max , void * data )
2802- {
2803- struct intel_iommu * iommu = data ;
2804- ioasid_t ioasid ;
2805-
2806- if (!iommu )
2807- return INVALID_IOASID ;
2808- /*
2809- * VT-d virtual command interface always uses the full 20 bit
2810- * PASID range. Host can partition guest PASID range based on
2811- * policies but it is out of guest's control.
2812- */
2813- if (min < PASID_MIN || max > intel_pasid_max_id )
2814- return INVALID_IOASID ;
2815-
2816- if (vcmd_alloc_pasid (iommu , & ioasid ))
2817- return INVALID_IOASID ;
2818-
2819- return ioasid ;
2820- }
2821-
2822- static void intel_vcmd_ioasid_free (ioasid_t ioasid , void * data )
2823- {
2824- struct intel_iommu * iommu = data ;
2825-
2826- if (!iommu )
2827- return ;
2828- /*
2829- * Sanity check the ioasid owner is done at upper layer, e.g. VFIO
2830- * We can only free the PASID when all the devices are unbound.
2831- */
2832- if (ioasid_find (NULL , ioasid , NULL )) {
2833- pr_alert ("Cannot free active IOASID %d\n" , ioasid );
2834- return ;
2835- }
2836- vcmd_free_pasid (iommu , ioasid );
2837- }
2838-
2839- static void register_pasid_allocator (struct intel_iommu * iommu )
2840- {
2841- /*
2842- * If we are running in the host, no need for custom allocator
2843- * in that PASIDs are allocated from the host system-wide.
2844- */
2845- if (!cap_caching_mode (iommu -> cap ))
2846- return ;
2847-
2848- if (!sm_supported (iommu )) {
2849- pr_warn ("VT-d Scalable Mode not enabled, no PASID allocation\n" );
2850- return ;
2851- }
2852-
2853- /*
2854- * Register a custom PASID allocator if we are running in a guest,
2855- * guest PASID must be obtained via virtual command interface.
2856- * There can be multiple vIOMMUs in each guest but only one allocator
2857- * is active. All vIOMMU allocators will eventually be calling the same
2858- * host allocator.
2859- */
2860- if (!vccap_pasid (iommu -> vccap ))
2861- return ;
2862-
2863- pr_info ("Register custom PASID allocator\n" );
2864- iommu -> pasid_allocator .alloc = intel_vcmd_ioasid_alloc ;
2865- iommu -> pasid_allocator .free = intel_vcmd_ioasid_free ;
2866- iommu -> pasid_allocator .pdata = (void * )iommu ;
2867- if (ioasid_register_allocator (& iommu -> pasid_allocator )) {
2868- pr_warn ("Custom PASID allocator failed, scalable mode disabled\n" );
2869- /*
2870- * Disable scalable mode on this IOMMU if there
2871- * is no custom allocator. Mixing SM capable vIOMMU
2872- * and non-SM vIOMMU are not supported.
2873- */
2874- intel_iommu_sm = 0 ;
2875- }
2876- }
2877- #endif
2878-
28792797static int __init init_dmars (void )
28802798{
28812799 struct dmar_drhd_unit * drhd ;
@@ -2964,9 +2882,6 @@ static int __init init_dmars(void)
29642882 */
29652883 for_each_active_iommu (iommu , drhd ) {
29662884 iommu_flush_write_buffer (iommu );
2967- #ifdef CONFIG_INTEL_IOMMU_SVM
2968- register_pasid_allocator (iommu );
2969- #endif
29702885 iommu_set_root_entry (iommu );
29712886 }
29722887
0 commit comments