On Sun, Mar 22, 2020 at 05:36:13AM -0700, Liu Yi L wrote:
> This patch replays guest pasid bindings after context cache
> invalidation. This is a behavior to ensure safety. Actually,
> programmer should issue pasid cache invalidation with proper
> granularity after issuing a context cache invalidation.
> 
> Cc: Kevin Tian <kevin.t...@intel.com>
> Cc: Jacob Pan <jacob.jun....@linux.intel.com>
> Cc: Peter Xu <pet...@redhat.com>
> Cc: Yi Sun <yi.y....@linux.intel.com>
> Cc: Paolo Bonzini <pbonz...@redhat.com>
> Cc: Richard Henderson <r...@twiddle.net>
> Cc: Eduardo Habkost <ehabk...@redhat.com>
> Signed-off-by: Liu Yi L <yi.l....@intel.com>
> ---
>  hw/i386/intel_iommu.c          | 68 
> ++++++++++++++++++++++++++++++++++++++++++
>  hw/i386/intel_iommu_internal.h |  6 +++-
>  hw/i386/trace-events           |  1 +
>  3 files changed, 74 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 8ec638f..1e0ccde 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -68,6 +68,10 @@ static void vtd_address_space_refresh_all(IntelIOMMUState 
> *s);
>  static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n);
>  
>  static void vtd_pasid_cache_reset(IntelIOMMUState *s);
> +static void vtd_replay_guest_pasid_bindings(IntelIOMMUState *s,
> +                                           uint16_t *did, bool is_dsi);
> +static void vtd_pasid_cache_devsi(IntelIOMMUState *s,
> +                                  VTDBus *vtd_bus, uint16_t devfn);
>  
>  static void vtd_panic_require_caching_mode(void)
>  {
> @@ -1865,6 +1869,8 @@ static void 
> vtd_context_global_invalidate(IntelIOMMUState *s)
>       * VT-d emulation codes.
>       */
>      vtd_iommu_replay_all(s);
> +
> +    vtd_replay_guest_pasid_bindings(s, NULL, false);

I think the only uncertain thing is whether you still want to rework
the vtd_replay_guest_pasid_bindings() interface.  It'll depend on the
future discussion of previous patches.  Besides that this patch looks
good to me.

-- 
Peter Xu


Reply via email to