diff options
author | Peter Xu <peterx@redhat.com> | 2018-09-29 11:36:14 +0800 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-11-05 13:24:02 -0500 |
commit | 06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55 (patch) | |
tree | fa9bfd6075fdc6df4e93df81dc291636af604eaa /hw | |
parent | 9bb192a4fca3e50194b6ac2e0eaaee20d996bba1 (diff) | |
download | qemu-06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55.zip qemu-06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55.tar.gz qemu-06aba4ca52fd2c8718b8ba486f22f0aa7c99ed55.tar.bz2 |
intel_iommu: introduce vtd_reset_caches()
Provide the function and use it in vtd_init(). Used to reset both
context entry cache and iotlb cache for the whole IOMMU unit.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/i386/intel_iommu.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 3dfada1..1137861 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -227,6 +227,14 @@ static void vtd_reset_iotlb(IntelIOMMUState *s) vtd_iommu_unlock(s); } +static void vtd_reset_caches(IntelIOMMUState *s) +{ + vtd_iommu_lock(s); + vtd_reset_iotlb_locked(s); + vtd_reset_context_cache_locked(s); + vtd_iommu_unlock(s); +} + static uint64_t vtd_get_iotlb_key(uint64_t gfn, uint16_t source_id, uint32_t level) { @@ -3160,10 +3168,7 @@ static void vtd_init(IntelIOMMUState *s) s->cap |= VTD_CAP_CM; } - vtd_iommu_lock(s); - vtd_reset_context_cache_locked(s); - vtd_reset_iotlb_locked(s); - vtd_iommu_unlock(s); + vtd_reset_caches(s); /* Define registers with default values and bit semantics */ vtd_define_long(s, DMAR_VER_REG, 0x10UL, 0, 0); |