@@ -299,21 +299,6 @@ void idxd_wqs_unmap_portal(struct idxd_device *idxd)
299299 }
300300}
301301
302- static void __idxd_wq_set_priv_locked (struct idxd_wq * wq , int priv )
303- {
304- struct idxd_device * idxd = wq -> idxd ;
305- union wqcfg wqcfg ;
306- unsigned int offset ;
307-
308- offset = WQCFG_OFFSET (idxd , wq -> id , WQCFG_PRIVL_IDX );
309- spin_lock (& idxd -> dev_lock );
310- wqcfg .bits [WQCFG_PRIVL_IDX ] = ioread32 (idxd -> reg_base + offset );
311- wqcfg .priv = priv ;
312- wq -> wqcfg -> bits [WQCFG_PRIVL_IDX ] = wqcfg .bits [WQCFG_PRIVL_IDX ];
313- iowrite32 (wqcfg .bits [WQCFG_PRIVL_IDX ], idxd -> reg_base + offset );
314- spin_unlock (& idxd -> dev_lock );
315- }
316-
317302static void __idxd_wq_set_pasid_locked (struct idxd_wq * wq , int pasid )
318303{
319304 struct idxd_device * idxd = wq -> idxd ;
@@ -1421,26 +1406,21 @@ int drv_enable_wq(struct idxd_wq *wq)
14211406 }
14221407
14231408 /*
1424- * In the event that the WQ is configurable for pasid and priv bits.
1425- * For kernel wq, the driver should setup the pasid, pasid_en, and priv bit.
1426- * However, for non-kernel wq, the driver should only set the pasid_en bit for
1427- * shared wq. A dedicated wq that is not 'kernel' type will configure pasid and
1409+ * In the event that the WQ is configurable for pasid, the driver
1410+ * should setup the pasid, pasid_en bit. This is true for both kernel
1411+ * and user shared workqueues. There is no need to setup priv bit in
1412+ * that in-kernel DMA will also do user privileged requests.
1413+ * A dedicated wq that is not 'kernel' type will configure pasid and
14281414 * pasid_en later on so there is no need to setup.
14291415 */
14301416 if (test_bit (IDXD_FLAG_CONFIGURABLE , & idxd -> flags )) {
1431- int priv = 0 ;
1432-
14331417 if (wq_pasid_enabled (wq )) {
14341418 if (is_idxd_wq_kernel (wq ) || wq_shared (wq )) {
14351419 u32 pasid = wq_dedicated (wq ) ? idxd -> pasid : 0 ;
14361420
14371421 __idxd_wq_set_pasid_locked (wq , pasid );
14381422 }
14391423 }
1440-
1441- if (is_idxd_wq_kernel (wq ))
1442- priv = 1 ;
1443- __idxd_wq_set_priv_locked (wq , priv );
14441424 }
14451425
14461426 rc = 0 ;
@@ -1548,6 +1528,15 @@ int idxd_device_drv_probe(struct idxd_dev *idxd_dev)
15481528 if (rc < 0 )
15491529 return - ENXIO ;
15501530
1531+ /*
1532+ * System PASID is preserved across device disable/enable cycle, but
1533+ * genconfig register content gets cleared during device reset. We
1534+ * need to re-enable user interrupts for kernel work queue completion
1535+ * IRQ to function.
1536+ */
1537+ if (idxd -> pasid != IOMMU_PASID_INVALID )
1538+ idxd_set_user_intr (idxd , 1 );
1539+
15511540 rc = idxd_device_evl_setup (idxd );
15521541 if (rc < 0 ) {
15531542 idxd -> cmd_status = IDXD_SCMD_DEV_EVL_ERR ;
0 commit comments