@@ -123,53 +123,16 @@ static void __flush_svm_range_dev(struct intel_svm *svm,
123
123
unsigned long address ,
124
124
unsigned long pages , int ih )
125
125
{
126
- struct qi_desc desc ;
126
+ struct device_domain_info * info = get_domain_info ( sdev -> dev ) ;
127
127
128
- if (pages == -1 ) {
129
- desc .qw0 = QI_EIOTLB_PASID (svm -> pasid ) |
130
- QI_EIOTLB_DID (sdev -> did ) |
131
- QI_EIOTLB_GRAN (QI_GRAN_NONG_PASID ) |
132
- QI_EIOTLB_TYPE ;
133
- desc .qw1 = 0 ;
134
- } else {
135
- int mask = ilog2 (__roundup_pow_of_two (pages ));
136
-
137
- desc .qw0 = QI_EIOTLB_PASID (svm -> pasid ) |
138
- QI_EIOTLB_DID (sdev -> did ) |
139
- QI_EIOTLB_GRAN (QI_GRAN_PSI_PASID ) |
140
- QI_EIOTLB_TYPE ;
141
- desc .qw1 = QI_EIOTLB_ADDR (address ) |
142
- QI_EIOTLB_IH (ih ) |
143
- QI_EIOTLB_AM (mask );
144
- }
145
- desc .qw2 = 0 ;
146
- desc .qw3 = 0 ;
147
- qi_submit_sync (sdev -> iommu , & desc , 1 , 0 );
148
-
149
- if (sdev -> dev_iotlb ) {
150
- desc .qw0 = QI_DEV_EIOTLB_PASID (svm -> pasid ) |
151
- QI_DEV_EIOTLB_SID (sdev -> sid ) |
152
- QI_DEV_EIOTLB_QDEP (sdev -> qdep ) |
153
- QI_DEIOTLB_TYPE ;
154
- if (pages == -1 ) {
155
- desc .qw1 = QI_DEV_EIOTLB_ADDR (-1ULL >> 1 ) |
156
- QI_DEV_EIOTLB_SIZE ;
157
- } else if (pages > 1 ) {
158
- /* The least significant zero bit indicates the size. So,
159
- * for example, an "address" value of 0x12345f000 will
160
- * flush from 0x123440000 to 0x12347ffff (256KiB). */
161
- unsigned long last = address + ((unsigned long )(pages - 1 ) << VTD_PAGE_SHIFT );
162
- unsigned long mask = __rounddown_pow_of_two (address ^ last );
163
-
164
- desc .qw1 = QI_DEV_EIOTLB_ADDR ((address & ~mask ) |
165
- (mask - 1 )) | QI_DEV_EIOTLB_SIZE ;
166
- } else {
167
- desc .qw1 = QI_DEV_EIOTLB_ADDR (address );
168
- }
169
- desc .qw2 = 0 ;
170
- desc .qw3 = 0 ;
171
- qi_submit_sync (sdev -> iommu , & desc , 1 , 0 );
172
- }
128
+ if (WARN_ON (!pages ))
129
+ return ;
130
+
131
+ qi_flush_piotlb (sdev -> iommu , sdev -> did , svm -> pasid , address , pages , ih );
132
+ if (info -> ats_enabled )
133
+ qi_flush_dev_iotlb_pasid (sdev -> iommu , sdev -> sid , info -> pfsid ,
134
+ svm -> pasid , sdev -> qdep , address ,
135
+ order_base_2 (pages ));
173
136
}
174
137
175
138
static void intel_flush_svm_range_dev (struct intel_svm * svm ,
0 commit comments