[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [PATCH for-4.15] vtd: make sure QI/IR are disabled before initialisation


  • To: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Tian, Kevin" <kevin.tian@xxxxxxxxx>
  • Date: Thu, 11 Mar 2021 02:40:52 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J4iXIGfX03N97NoGYLbSJLmjOCG1peSV2LSXtX6XFfw=; b=fU8YW6eSzFjjAILJLWDgBQHy2uNYNZ/GQZmVf+XJAUlehmgLG+9yIFFsMJ8qwLlZRQ+Eu4MnCGUi5BoRDC5WxOwgkw+148RI1/qbtLk2jZBR7W1w1Wv3yPgION5UG2FwNn541vWdAsGQED8lgQ6iOL4SpykPKLWRlDJ9bExgfL8gPNdskEnIjHr0m6tOCX3/7PxE5pnF+DRv6wNLwC4zVZWlDlq4UPh9a6nIAWbTw5OYCDKbqAjswqt8b7A4n1a73PptCCKtCgPQqAVWdxS48cUCqbYfyMrZsV1R5w0BJXxkIAuEui6iKLnP2I0LOCqM4sSsz3R7M60blzMiVtzsUw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5+QAv48N3ynlHXLoSuVrWcm+lAQYkk/ASHoLWmL/nusAyVgiZdmKrFyI2nNhtq7ZTDM6IGfAu++xaIyMYPDj2wInomxVaIzoYirLfRAn7SBbpU/F8cgPbuiHcUA/nFhCAfC+70bxiLXYS+L5O8e6sHmSRQFLOKyPtsNMR2mZb1xGHLV1PW/1xeWPnl9lfN/diW8men/2Rom5Ris6N6nqxU5lW2X0C1UJ4aYLJYkyA7EdVx+PG+CwQzYL6dE59PaArGztcoJFPnW9OWULyjQnftro2chyBf8/nrqW/BitIMudZkSa+ZyTrgpkeDzMyWDpp3Y8KChkKywuLUmEgKlrQ==
  • Authentication-results: citrix.com; dkim=none (message not signed) header.d=none;citrix.com; dmarc=none action=none header.from=intel.com;
  • Cc: "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "Cooper, Andrew" <andrew.cooper3@xxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>
  • Delivery-date: Thu, 11 Mar 2021 02:41:17 +0000
  • Dlp-product: dlpe-windows
  • Dlp-reaction: no-action
  • Dlp-version: 11.5.1.3
  • Ironport-sdr: vw1POjGvmW8LpC93zxO67us6CGhtSdnfoSgyTDj6TjBS089gEDTCNhYv8yN9Hos0DE4fmJ1I87 92QWkQaLG4/g==
  • Ironport-sdr: ylBhABGwZSI6FBfpgwEN5zrGchEdqpV07EAR+ZZqTA2w//ojiQq5l0pM2pI2pKIh6LU4NQ/vXJ +RJRyViz1sWQ==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHXE+l+DcjZa4vV7kWyWy/YUMLF56p+F/Gw
  • Thread-topic: [PATCH for-4.15] vtd: make sure QI/IR are disabled before initialisation

> From: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
> Sent: Monday, March 8, 2021 3:00 PM
> 
> BIOS might pass control to Xen leaving QI and/or IR in enabled and/or
> partially configured state. In case of x2APIC code path where EIM is
> enabled early in boot - those are correctly disabled by Xen before any
> attempt to configure. But for xAPIC that step is missing which was
> proven to cause QI initialization failures on some ICX based platforms
> where QI is left pre-enabled and partially configured by BIOS.
> 
> Unify the behaviour between x2APIC and xAPIC code paths keeping that in
> line with what Linux does.
> 
> Signed-off-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>

Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>

> ---
>  xen/arch/x86/apic.c                 |  2 +-
>  xen/drivers/passthrough/vtd/iommu.c | 12 +++++++++++-
>  xen/include/asm-x86/apic.h          |  1 +
>  3 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
> index 7497ddb..8ab8214 100644
> --- a/xen/arch/x86/apic.c
> +++ b/xen/arch/x86/apic.c
> @@ -47,7 +47,7 @@ static bool __read_mostly tdt_enabled;
>  static bool __initdata tdt_enable = true;
>  boolean_param("tdt", tdt_enable);
> 
> -static bool __read_mostly iommu_x2apic_enabled;
> +bool __read_mostly iommu_x2apic_enabled;
> 
>  static struct {
>      int active;
> diff --git a/xen/drivers/passthrough/vtd/iommu.c
> b/xen/drivers/passthrough/vtd/iommu.c
> index d136fe3..4aa7a31 100644
> --- a/xen/drivers/passthrough/vtd/iommu.c
> +++ b/xen/drivers/passthrough/vtd/iommu.c
> @@ -2080,7 +2080,7 @@ static int __must_check init_vtd_hw(void)
>      u32 sts;
> 
>      /*
> -     * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults.
> +     * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults, etc.
>       */
>      for_each_drhd_unit ( drhd )
>      {
> @@ -2090,6 +2090,16 @@ static int __must_check init_vtd_hw(void)
> 
>          clear_fault_bits(iommu);
> 
> +        /*
> +         * Disable interrupt remapping and queued invalidation if
> +         * already enabled by BIOS in case we've not initialized it yet.
> +         */
> +        if ( !iommu_x2apic_enabled )
> +        {
> +            disable_intremap(iommu);
> +            disable_qinval(iommu);
> +        }
> +
>          spin_lock_irqsave(&iommu->register_lock, flags);
>          sts = dmar_readl(iommu->reg, DMAR_FECTL_REG);
>          sts &= ~DMA_FECTL_IM;
> diff --git a/xen/include/asm-x86/apic.h b/xen/include/asm-x86/apic.h
> index 8ddb896..2fe54bb 100644
> --- a/xen/include/asm-x86/apic.h
> +++ b/xen/include/asm-x86/apic.h
> @@ -24,6 +24,7 @@ enum apic_mode {
>      APIC_MODE_X2APIC    /* x2APIC mode - common for large MP machines
> */
>  };
> 
> +extern bool iommu_x2apic_enabled;
>  extern u8 apic_verbosity;
>  extern bool directed_eoi_enabled;
> 
> --
> 2.7.4




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.