public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Robert Hancock <hancockr@shaw.ca>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@suse.de>, Chuck Ebbert <cebbert@redhat.com>,
	Len Brown <lenb@kernel.org>
Subject: Re: [RFC PATCH] PCI MMCONFIG: add validation against ACPI motherboard resources
Date: Wed, 23 May 2007 17:02:30 -0700	[thread overview]
Message-ID: <200705231702.30679.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <4635510D.4060103@shaw.ca>

On Sunday, April 29, 2007 7:14 pm Robert Hancock wrote:
> This path adds validation of the MMCONFIG table against the ACPI
> reserved motherboard resources. If the MMCONFIG table is found to be
> reserved in ACPI, we don't bother checking the E820 table. The PCI
> Express firmware spec apparently tells BIOS developers that
> reservation in ACPI is required and E820 reservation is optional, so
> checking against ACPI first makes sense. Many BIOSes don't reserve
> the MMCONFIG region in E820 even though it is perfectly functional,
> the existing check needlessly disables MMCONFIG in these cases.
>
> In order to do this, MMCONFIG setup has been split into two phases.
> If PCI configuration type 1 is not available (like on EFI Macs) then
> MMCONFIG is enabled early as before. Otherwise, it is enabled later
> after the ACPI interpreter is enabled, since we need to be able to
> execute control methods in order to check the ACPI reserved
> resources. Presently this is just triggered off the end of ACPI
> interpreter initialization.
>
> There are a few other behavioral changes here:
>
> -Validate all MMCONFIG configurations provided, not just the first
> one.
>
> -Validate the entire required length of each configuration according
> to the provided ending bus number is reserved, not just the minimum
> required allocation.
>
> -Validate that the area is reserved even if we read it from the
> chipset directly and not from the MCFG table. This catches the case
> where the BIOS didn't set the location properly in the chipset and
> has mapped it over other things it shouldn't have. This might be
> overly pessimistic - we might be able to instead verify that no other
> reserved resources (like chipset registers) are inside this memory
> range.
>
> Some testing is needed to see if this rejects MMCONFIG on all systems
> where it is problematic. There were some patches floating around to
> read the table location out of the chipset for Intel 915 and 965, I
> think the author found the latter to be problematic since the chipset
> had the table mapped over top of motherboard resources. The extra
> checking here may catch that case if we add that chipset-specific
> support.
>
> Applies to 2.6.21.1.
>
> Signed-off-by: Robert Hancock <hancockr@shaw.ca>

Acked-by:  Jesse Barnes <jesse.barnes@intel.com>

As long as we get a fix for the mmconfig based probing issues in the 
other thread, I think this patch should go in.  Robert, maybe you could 
submit it along with this one (and an i386 equivalent)?  Type 1 config 
access is already a fallback for mmconfig for x86_64 at least, so it 
should be safe for non-extended access too, and it avoids problems with 
our lack of decode disable in the generic PCI probing code.

Signed-off-by:  Jesse Barnes <jesse.barnes@intel.com>

diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index 65d8273..5052f80 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -61,7 +61,7 @@ static int pci_mmcfg_read(unsigned int seg, unsigned 
int bus,
 	}
 
 	addr = pci_dev_base(seg, bus, devfn);
-	if (!addr)
+	if (!addr || reg < 256) /* Use type 1 for non-extended access */
 		return pci_conf1_read(seg,bus,devfn,reg,len,value);
 
 	switch (len) {
@@ -89,7 +89,7 @@ static int pci_mmcfg_write(unsigned int seg, unsigned 
int bus,
 		return -EINVAL;
 
 	addr = pci_dev_base(seg, bus, devfn);
-	if (!addr)
+	if (!addr || reg < 256) /* Use type 1 for non-extended access */
 		return pci_conf1_write(seg,bus,devfn,reg,len,value);
 
 	switch (len) {

      parent reply	other threads:[~2007-05-24  0:05 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30  2:14 [RFC PATCH] PCI MMCONFIG: add validation against ACPI motherboard resources Robert Hancock
2007-04-30  2:59 ` Randy Dunlap
2007-04-30 22:59 ` Olivier Galibert
2007-04-30 23:26   ` Robert Hancock
2007-05-01 16:48   ` Jesse Barnes
2007-05-02  2:41   ` Jesse Barnes
2007-05-02  2:56     ` Jesse Barnes
2007-05-02  5:27       ` Jesse Barnes
2007-05-02 14:34         ` Robert Hancock
2007-05-02 17:57           ` Jesse Barnes
2007-05-02 23:45             ` Robert Hancock
2007-05-02 23:54               ` Jesse Barnes
2007-05-04 21:06                 ` Jesse Barnes
2007-05-05  0:22                   ` Robert Hancock
2007-05-21 19:10                   ` Jesse Barnes
2007-05-21 19:26                     ` Robert Hancock
2007-05-21 20:07                       ` Jesse Barnes
2007-05-21 20:22                         ` Jesse Barnes
2007-05-23  0:31                           ` Robert Hancock
2007-05-23  0:38                             ` Jesse Barnes
2007-05-23  0:53                               ` Robert Hancock
2007-05-23  0:56                                 ` Jesse Barnes
2007-05-23  1:06                               ` Robert Hancock
2007-05-23 18:52                                 ` Jesse Barnes
2007-05-23 20:20                                   ` Linus Torvalds
2007-05-23 20:38                                     ` Alan Cox
2007-05-23 20:45                                       ` Linus Torvalds
2007-05-23 20:49                                     ` Jesse Barnes
2007-05-23 20:56                                       ` Linus Torvalds
2007-05-23 21:03                                         ` Jesse Barnes
2007-05-23 21:09                                           ` Jeff Garzik
2007-05-23 21:35                                             ` Alan Cox
2007-05-23 21:35                                               ` Jeff Garzik
2007-05-23 21:37                                               ` Jesse Barnes
2007-05-23 21:42                                                 ` Jeff Garzik
2007-05-23 23:07                                             ` Stephen Hemminger
2007-05-23 21:54                                           ` Linus Torvalds
2007-05-23 22:06                                             ` Jesse Barnes
2007-05-23 22:16                                               ` Linus Torvalds
2007-05-23 22:28                                                 ` Jesse Barnes
2007-05-23 23:04                                                 ` David Miller
2007-05-23 23:11                                                   ` Jesse Barnes
2007-05-23 23:15                                                     ` Robert Hancock
2007-05-23 23:21                                                       ` Jesse Barnes
2007-05-23 21:20                                         ` Jesse Barnes
2007-05-23 22:24                                           ` Olivier Galibert
2007-05-23 22:31                                             ` Jesse Barnes
2007-05-23 22:48                                             ` Linus Torvalds
2007-05-23 22:55                                               ` Jesse Barnes
2007-05-24  0:21                                                 ` Linus Torvalds
2007-05-24  2:59                                                   ` Jesse Barnes
2007-05-24  3:18                                                     ` Linus Torvalds
2007-05-24  3:20                                                       ` Linus Torvalds
2007-05-24  3:40                                                         ` Jesse Barnes
2007-05-24  5:19                                                           ` Robert Hancock
2007-05-24  6:18                                                   ` Jeff Garzik
2007-05-24 15:42                                                     ` Linus Torvalds
2007-05-23 23:04                                     ` Robert Hancock
2007-05-23 23:04                                   ` Robert Hancock
2007-05-23 23:06                                     ` Jesse Barnes
2007-05-24  0:02 ` Jesse Barnes [this message]

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=200705231702.30679.jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=ak@suse.de \
    --cc=cebbert@redhat.com \
    --cc=hancockr@shaw.ca \
    --cc=lenb@kernel.org \
    --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