> From: Peter Xu [mailto:pet...@redhat.com] > Sent: Thursday, January 05, 2017 11:53 AM > > > > /* Handle Translation Enable/Disable */ > > > static void vtd_handle_gcmd_te(IntelIOMMUState *s, bool en) > > > { > > > + if (s->dmar_enabled == en) { > > > + return; > > > + } > > > + > > > VTD_DPRINTF(CSR, "Translation Enable %s", (en ? "on" : "off")); > > > > > > if (en) { > > > @@ -1196,6 +1237,8 @@ static void vtd_handle_gcmd_te(IntelIOMMUState *s, > > > bool > en) > > > /* Ok - report back to driver */ > > > vtd_set_clear_mask_long(s, DMAR_GSTS_REG, VTD_GSTS_TES, 0); > > > } > > > + > > > + vtd_switch_address_space_all(s, en); > > > } > > > > A context entry can be configured as pass-through, meaning no addr > > translation for DMAs from this device when IOMMU is globally enabled. > > There is no translation structure per se, so 'sys_alias" is also required > > in such configuration. > > Right. But current vt-d emulation still doesn't support per-device > pass-through. See vtd_dev_to_context_entry(): > > ... > } else if (ce->lo & VTD_CONTEXT_ENTRY_TT) { > VTD_DPRINTF(GENERAL, "error: unsupported Translation Type in " > "context-entry hi 0x%"PRIx64 " lo 0x%"PRIx64, > ce->hi, ce->lo); > return -VTD_FR_CONTEXT_ENTRY_INV; > } > ... > > And: > > #define VTD_CONTEXT_ENTRY_TT (3ULL << 2) /* Translation Type */ > #define VTD_CONTEXT_TT_PASS_THROUGH 2 > > IMO we can add it when we support device passthrough. >
Then fine with me. :-) Thanks Kevin