xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@novell.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 3/5] x86: x2apic pre-enabled but intr-remapping is not enabled
Date: Wed, 15 Dec 2010 11:18:35 +0000	[thread overview]
Message-ID: <4D08B21B020000780002818D@vpn.id2.novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2328 bytes --]

Make it aligned with Linux kernel.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Removed unnecessary bits from the original patch, and removed
intremap_enabled() with its only caller gone.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- 2010-11-09.orig/xen/arch/x86/apic.c
+++ 2010-11-09/xen/arch/x86/apic.c
@@ -972,15 +972,6 @@ void x2apic_setup(void)
     rdmsrl(MSR_IA32_APICBASE, msr_content);
     if ( msr_content & MSR_IA32_APICBASE_EXTD )
     {
-        /*
-         * Interrupt remapping should be also enabled by BIOS when
-         * x2APIC is already enabled by BIOS, otherwise it's a BIOS
-         * bug
-         */
-        if ( !intremap_enabled() )
-            panic("Interrupt remapping is not enabled by BIOS while "
-                  "x2APIC is already enabled by BIOS!\n");
-
         printk("x2APIC mode is already enabled by BIOS.\n");
         x2apic_enabled = 1;
     }
@@ -1023,6 +1014,10 @@ void x2apic_setup(void)
 
     if ( iommu_enable_IR() )
     {
+        if ( x2apic_enabled )
+            panic("Interrupt remapping could not be enabled while "
+                  "x2APIC is already enabled by BIOS!\n");
+
         printk("Would not enable x2APIC due to interrupt remapping "
                "cannot be enabled.\n");
         goto restore_out;
--- 2010-11-09.orig/xen/drivers/passthrough/vtd/intremap.c
+++ 2010-11-09/xen/drivers/passthrough/vtd/intremap.c
@@ -894,23 +894,3 @@ void iommu_disable_IR(void)
     for_each_drhd_unit ( drhd )
         disable_qinval(drhd->iommu);
 }
-
-/*
- * Check if interrupt remapping is enabled or not
- * return 1: enabled
- * return 0: not enabled
- */
-int intremap_enabled(void)
-{
-    struct acpi_drhd_unit *drhd;
-    u32 sts;
-
-    for_each_drhd_unit ( drhd )
-    {
-        sts = dmar_readl(drhd->iommu->reg, DMAR_GSTS_REG);
-        if ( !(sts & DMA_GSTS_IRES) )
-            return 0;
-    }
-
-    return 1;
-}
--- 2010-11-09.orig/xen/include/xen/iommu.h
+++ 2010-11-09/xen/include/xen/iommu.h
@@ -62,7 +62,6 @@ int iommu_setup(void);
 int iommu_supports_eim(void);
 int iommu_enable_IR(void);
 void iommu_disable_IR(void);
-int intremap_enabled(void);
 
 int iommu_add_device(struct pci_dev *pdev);
 int iommu_remove_device(struct pci_dev *pdev);




[-- Attachment #2: x86-x2apic-preenabled.patch --]
[-- Type: text/plain, Size: 2383 bytes --]

x86: x2apic pre-enabled but intr-remapping is not enabled

Make it aligned with Linux kernel.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

Removed unnecessary bits from the original patch, and removed
intremap_enabled() with its only caller gone.

Signed-off-by: Jan Beulich <jbeulich@novell.com>

--- 2010-11-09.orig/xen/arch/x86/apic.c
+++ 2010-11-09/xen/arch/x86/apic.c
@@ -972,15 +972,6 @@ void x2apic_setup(void)
     rdmsrl(MSR_IA32_APICBASE, msr_content);
     if ( msr_content & MSR_IA32_APICBASE_EXTD )
     {
-        /*
-         * Interrupt remapping should be also enabled by BIOS when
-         * x2APIC is already enabled by BIOS, otherwise it's a BIOS
-         * bug
-         */
-        if ( !intremap_enabled() )
-            panic("Interrupt remapping is not enabled by BIOS while "
-                  "x2APIC is already enabled by BIOS!\n");
-
         printk("x2APIC mode is already enabled by BIOS.\n");
         x2apic_enabled = 1;
     }
@@ -1023,6 +1014,10 @@ void x2apic_setup(void)
 
     if ( iommu_enable_IR() )
     {
+        if ( x2apic_enabled )
+            panic("Interrupt remapping could not be enabled while "
+                  "x2APIC is already enabled by BIOS!\n");
+
         printk("Would not enable x2APIC due to interrupt remapping "
                "cannot be enabled.\n");
         goto restore_out;
--- 2010-11-09.orig/xen/drivers/passthrough/vtd/intremap.c
+++ 2010-11-09/xen/drivers/passthrough/vtd/intremap.c
@@ -894,23 +894,3 @@ void iommu_disable_IR(void)
     for_each_drhd_unit ( drhd )
         disable_qinval(drhd->iommu);
 }
-
-/*
- * Check if interrupt remapping is enabled or not
- * return 1: enabled
- * return 0: not enabled
- */
-int intremap_enabled(void)
-{
-    struct acpi_drhd_unit *drhd;
-    u32 sts;
-
-    for_each_drhd_unit ( drhd )
-    {
-        sts = dmar_readl(drhd->iommu->reg, DMAR_GSTS_REG);
-        if ( !(sts & DMA_GSTS_IRES) )
-            return 0;
-    }
-
-    return 1;
-}
--- 2010-11-09.orig/xen/include/xen/iommu.h
+++ 2010-11-09/xen/include/xen/iommu.h
@@ -62,7 +62,6 @@ int iommu_setup(void);
 int iommu_supports_eim(void);
 int iommu_enable_IR(void);
 void iommu_disable_IR(void);
-int intremap_enabled(void);
 
 int iommu_add_device(struct pci_dev *pdev);
 int iommu_remove_device(struct pci_dev *pdev);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2010-12-15 11:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4D08B21B020000780002818D@vpn.id2.novell.com \
    --to=jbeulich@novell.com \
    --cc=xen-devel@lists.xensource.com \
    --cc=yinghai@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).