mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@linux.intel.com>
To: linux-kernel@vger.kernel.org, ak@suse.de
Subject: [patch 3 of 4] MCFG sanity check
Date: Sat, 25 Mar 2006 17:24:58 +0100	[thread overview]
Message-ID: <1143303898.2898.9.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1143303796.2898.6.camel@laptopd505.fenrus.org>

This patch introduces a user for the e820_all_mapped function:

There have been several machines that don't have a working MMCONFIG, often
because of a buggy MCFG table in the ACPI bios. This patch adds a simple
sanity check that detects a whole bunch of these cases, and when it detects
it, linux now boots rather than crash-and-burns. The accuracy of this
detection can in principle be improved if there was a "is this entire range
in e820 with THIS attribute", but no such function exist and the complexity
needed for this is not really worth it; this simple check already catches
most cases anyway.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
---
 arch/x86_64/pci/mmconfig.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Index: linux-2.6.16-mmconfig/arch/x86_64/pci/mmconfig.c
===================================================================
--- linux-2.6.16-mmconfig.orig/arch/x86_64/pci/mmconfig.c
+++ linux-2.6.16-mmconfig/arch/x86_64/pci/mmconfig.c
@@ -9,6 +9,8 @@
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/bitmap.h>
+#include <asm/e820.h>
+
 #include "pci.h"
 
 #define MMCONFIG_APER_SIZE (256*1024*1024)
@@ -161,6 +163,14 @@ void __init pci_mmcfg_init(void)
 	    (pci_mmcfg_config[0].base_address == 0))
 		return;
 
+	if (!e820_all_mapped(pci_mmcfg_config[0].base_address,
+			pci_mmcfg_config[0].base_address + MMCONFIG_APER_SIZE,
+			E820_RESERVED)) {
+		printk(KERN_INFO "PCI: BIOS Bug: MCFG area is not E820-reserved\n");
+		printk(KERN_INFO "PCI: Not using MMCONFIG.\n");
+		return;
+	}
+
 	/* RED-PEN i386 doesn't do _nocache right now */
 	pci_mmcfg_virt = kmalloc(sizeof(*pci_mmcfg_virt) * pci_mmcfg_config_num, GFP_KERNEL);
 	if (pci_mmcfg_virt == NULL) {


  parent reply	other threads:[~2006-03-25 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-25 16:23 [patch 1 of 4] Rename e820_map to e820_any_map to reflect its behavior better Arjan van de Ven
2006-03-25 16:24 ` [patch 2 of 4] Introduce e820_all_mapped Arjan van de Ven
2006-03-25 16:24 ` Arjan van de Ven [this message]
2006-03-25 16:25 ` [patch 4 of 4] i386 version of the changes Arjan van de Ven
2006-03-25 16:50 ` [patch 1 of 4] Rename e820_map to e820_any_map to reflect its behavior better Andi Kleen

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=1143303898.2898.9.camel@laptopd505.fenrus.org \
    --to=arjan@linux.intel.com \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®