static int flush_context_qi( void *_iommu, u16 did, u16 sid, u8 fm, u64 type, int non_present_entry_flush) { int ret = 0; struct iommu *iommu = (struct iommu *)_iommu; struct qi_ctrl *qi_ctrl = iommu_qi_ctrl(iommu); /* * In the non-present entry flush case, if hardware doesn't cache * non-present entry we do nothing and if hardware cache non-present * entry, we flush entries of domain 0 (the domain id is used to cache * any non-present entries) */ if ( non_present_entry_flush ) { if ( !cap_caching_mode(iommu->cap) ) return 1; else did = 0; } if ( qi_ctrl->qinval_maddr != 0 ) { ret = queue_invalidate_context(iommu, did, sid, fm, type >> DMA_CCMD_INVL_GRANU_OFFSET); ret |= invalidate_sync(iommu); }
int __iommu_flush_iec(struct iommu *iommu, u8 granu, u8 im, u16 iidx) { int ret; ret = queue_invalidate_iec(iommu, granu, im, iidx); ret |= invalidate_sync(iommu); /* * reading vt-d architecture register will ensure * draining happens in implementation independent way. */ (void)dmar_readq(iommu->reg, DMAR_CAP_REG); return ret; }
int main(int argc, char **argv) { struct mrpc_conn_set *sset; struct mrpc_conn_set *cset; struct mrpc_connection *conn; char *port; int ret; sem_init(&accepted, 0, 0); sset=spawn_server(&port, proto_server, do_accept, NULL, 1); mrpc_set_disconnect_func(sset, disconnect_normal_no_unref); mrpc_conn_set_ref(sset); if (mrpc_conn_set_create(&cset, proto_client, NULL)) die("Couldn't allocate conn set"); mrpc_conn_set_ref(cset); mrpc_set_disconnect_func(cset, disconnect_user); start_monitored_dispatcher(cset); ret=mrpc_conn_create(&conn, cset, NULL); if (ret) die("%s", strerror(ret)); ret=mrpc_connect(conn, AF_UNSPEC, "localhost", port); if (ret) die("%s", strerror(ret)); mrpc_conn_ref(conn); mrpc_conn_set_unref(cset); mrpc_conn_set_unref(cset); mrpc_conn_set_unref(sset); mrpc_conn_set_unref(sset); sem_wait(&accepted); mrpc_listen_close(sset); mrpc_conn_unref(conn); mrpc_conn_unref(conn); sync_client_set_ops(conn); sync_client_run(conn); trigger_callback_sync(conn); invalidate_sync(conn); mrpc_conn_close(conn); expect_disconnects(1, 1, 0); sem_destroy(&accepted); free(port); return 0; }