All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Yang Z" <yang.z.zhang@intel.com>
To: "Chen, Tiejun" <tiejun.chen@intel.com>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	"jbeulich@suse.com" <jbeulich@suse.com>,
	"jinsong.liu@alibaba-inc.com" <jinsong.liu@alibaba-inc.com>,
	"keir@xen.org" <keir@xen.org>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>
Cc: "xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/3] xen/vt-d: mask interrupt message generation
Date: Mon, 4 May 2015 04:07:15 +0000	[thread overview]
Message-ID: <A9667DDFB95DB7438FA9D7D576C3D87E0ACC0709@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1430705771-6744-2-git-send-email-tiejun.chen@intel.com>

Chen, Tiejun wrote on 2015-05-04:
> While initializing VT-D we should mask interrupt message generation
> to avoid receiving any interrupt as pending before enable DMA
> translation, and also mask that before disable DMA engine.
> 
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
>  xen/drivers/passthrough/vtd/iommu.c | 31 +++++++++++++++++++++++--------
>  1 file changed, 23 insertions(+), 8 deletions(-)
> diff --git a/xen/drivers/passthrough/vtd/iommu.c
> b/xen/drivers/passthrough/vtd/iommu.c index c7bda73..72cd854 100644 ---
> a/xen/drivers/passthrough/vtd/iommu.c +++
> b/xen/drivers/passthrough/vtd/iommu.c @@ -1000,15 +1000,21 @@ static
> void dma_msi_unmask(struct irq_desc *desc)
>      iommu->msi.msi_attrib.masked = 0;
>  }
> -static void dma_msi_mask(struct irq_desc *desc)
> +static void mask_dma_interrupt(struct iommu *iommu)
>  {
>      unsigned long flags;
> -    struct iommu *iommu = desc->action->dev_id;
> 
> -    /* mask it */
>      spin_lock_irqsave(&iommu->register_lock, flags);
>      dmar_writel(iommu->reg, DMAR_FECTL_REG, DMA_FECTL_IM);
>      spin_unlock_irqrestore(&iommu->register_lock, flags);
> +}
> +
> +static void dma_msi_mask(struct irq_desc *desc)
> +{
> +    struct iommu *iommu = desc->action->dev_id;
> +
> +    /* mask it */
> +    mask_dma_interrupt(iommu);
>      iommu->msi.msi_attrib.masked = 1;
>  }
> @@ -1997,7 +2003,6 @@ static int init_vtd_hw(void)
>      struct iommu *iommu;
>      struct iommu_flush *flush = NULL;
>      int ret;
> -    unsigned long flags;
> 
>      /*
>       * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults.
> @@ -2008,11 +2013,16 @@ static int init_vtd_hw(void)
> 
>          iommu = drhd->iommu;
> -        clear_fault_bits(iommu);
> +        /*
> +         * We shouldn't receive any VT-d interrupt while initializing
> +         * VT-d so just mask interrupt message generation.
> +         */
> +        mask_dma_interrupt(iommu);
> 
> -        spin_lock_irqsave(&iommu->register_lock, flags);
> -        dmar_writel(iommu->reg, DMAR_FECTL_REG, 0);
> -        spin_unlock_irqrestore(&iommu->register_lock, flags);
> +        /*
> +         * And then clear all previous faults.
> +         */
> +        clear_fault_bits(iommu);
>      }
>      
>      /*
> @@ -2350,6 +2360,11 @@ static void vtd_suspend(void)
>          if ( force_iommu )
>              continue;
> +        /*
> +         * Mask interrupt message generation.
> +         */
> +        mask_dma_interrupt(iommu);
> +
>          iommu_disable_translation(iommu);
>          
>          /* If interrupt remapping is enabled, queued invalidation

Just curious that do you observe a real issue or just catch it through reading code?

Best regards,
Yang

  reply	other threads:[~2015-05-04  4:07 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  2:16 [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH Tiejun Chen
2015-05-04  2:16 ` [PATCH 2/3] xen/vt-d: mask interrupt message generation Tiejun Chen
2015-05-04  4:07   ` Zhang, Yang Z [this message]
2015-05-04  5:08     ` Chen, Tiejun
2015-05-04  6:41       ` Zhang, Yang Z
2015-05-04  8:57       ` Jan Beulich
2015-05-04 11:21         ` Chen, Tiejun
2015-05-04  2:16 ` [PATCH 3/3] xen/iommu: disable IOMMU engine completely before enter S5 Tiejun Chen
2015-05-04  9:00   ` Jan Beulich
2015-05-04  4:07 ` [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH Zhang, Yang Z
2015-05-04  8:52 ` Jan Beulich
2015-05-04  9:14   ` Andrew Cooper
2015-05-04  9:24     ` Jan Beulich
2015-05-05  1:13       ` Zhang, Yang Z
2015-05-05 15:46     ` Boris Ostrovsky
2015-05-05 15:58       ` Jan Beulich
2015-05-05 16:11         ` Boris Ostrovsky
2015-05-06  7:12           ` Jan Beulich
2015-05-06  7:26             ` Chen, Tiejun
2015-05-06  7:33               ` Jan Beulich
2015-05-06 15:11             ` Boris Ostrovsky
2015-05-06  7:09       ` Chen, Tiejun
2015-05-04 10:39   ` Chen, Tiejun
2015-05-04 10:43     ` Jan Beulich
2015-05-04 10:52       ` Tian, Kevin
2015-05-04 11:26         ` Chen, Tiejun
2015-05-05  1:13           ` Tian, Kevin
2015-05-05  2:45       ` Chen, Tiejun
2015-05-05  9:24         ` Jan Beulich
2015-05-06  6:47           ` Chen, Tiejun
2015-05-06  7:14             ` Jan Beulich
2015-05-04 15:22     ` Konrad Rzeszutek Wilk
2015-05-04 15:33       ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A9667DDFB95DB7438FA9D7D576C3D87E0ACC0709@SHSMSX104.ccr.corp.intel.com \
    --to=yang.z.zhang@intel.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jinsong.liu@alibaba-inc.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=tiejun.chen@intel.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.