linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	linux-efi@vger.kernel.org, dwmw2@infradead.org,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: Use PCI ROMs from EFI boot services
Date: Thu, 6 Dec 2012 10:57:51 -0800	[thread overview]
Message-ID: <CAE9FiQWrfp4ptabLiGTv+tH2Nc9i+opX2O9Kk32MbwhF3vCOqg@mail.gmail.com> (raw)
In-Reply-To: <20121206185439.GA17381@srcf.ucam.org>

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

On Thu, Dec 6, 2012 at 10:54 AM, Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> On Thu, Dec 06, 2012 at 10:26:01AM -0800, H. Peter Anvin wrote:
>
>> NAK on this bit:
>>
>> +       if (boot_params.hdr.version < 0x0209)
>> +               return 0;
>>
>> This field is kernel->bootloader documentation.  If a nonmaching
>> value somehow leaks into the kernel, the kernel could either
>> panic("Bootloader written by moron") or it should clear some fields,
>> but littering the kernel with these kinds of tests is just plain
>> braindead.
>
> Dropping that should be fine. Bjorn, would you prefer a patch from me to
> do that?

the one : use pointer for setup_pci instead.

[-- Attachment #2: pa_data_setup_pci.patch --]
[-- Type: application/octet-stream, Size: 1784 bytes --]

Subject: [PATCH] x86, pci: move boot_params back to __initdata

Don't waste 4k for 8 bytes.

Also I don't see the reason why DTB could only have one entry
but SETUP_UP data have multiple.

diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index dba7805..54358f8 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -183,4 +183,6 @@ struct pci_setup_rom {
 	uint8_t romdata[0];
 };
 
+extern u64 pa_data_setup_pci;
+
 #endif /* _ASM_X86_PCI_H */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 2bd40fd..8062f25 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -143,7 +143,11 @@ int default_check_phys_apicid_present(int phys_apicid)
 }
 #endif
 
+#ifndef CONFIG_DEBUG_BOOT_PARAMS
+struct boot_params __initdata boot_params;
+#else
 struct boot_params boot_params;
+#endif
 
 /*
  * Machine setup..
@@ -414,6 +418,8 @@ static void __init reserve_initrd(void)
 }
 #endif /* CONFIG_BLK_DEV_INITRD */
 
+u64 pa_data_setup_pci;
+
 static void __init parse_setup_data(void)
 {
 	struct setup_data *data;
@@ -442,6 +448,10 @@ static void __init parse_setup_data(void)
 		case SETUP_DTB:
 			add_dtb(pa_data);
 			break;
+		case SETUP_PCI:
+			if (!setup_data_pci)
+				pa_data_setup_pci = pa_data;
+			break;
 		default:
 			break;
 		}
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 47584f4..4e16651 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -613,12 +613,8 @@ int pcibios_add_device(struct pci_dev *dev)
 {
 	struct setup_data *data;
 	struct pci_setup_rom *rom;
-	u64 pa_data;
+	u64 pa_data = pa_data_setup_pci;
 
-	if (boot_params.hdr.version < 0x0209)
-		return 0;
-
-	pa_data = boot_params.hdr.setup_data;
 	while (pa_data) {
 		data = phys_to_virt(pa_data);
 

  reply	other threads:[~2012-12-06 18:57 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 16:36 Use PCI ROMs from EFI boot services Matthew Garrett
2012-08-23 16:36 ` [PATCH V3 1/4] EFI: Stash ROMs if they're not in the PCI BAR Matthew Garrett
2012-08-23 23:44   ` Bjorn Helgaas
2012-08-24  4:09     ` Matthew Garrett
2012-09-04 13:45     ` Matthew Garrett
2012-09-06 13:59       ` Bjorn Helgaas
2012-09-06 17:36         ` [PATCH] x86: Fix build warning on 32-bit Matthew Garrett
2012-09-06 20:02           ` Bjorn Helgaas
2012-08-23 16:36 ` [PATCH V3 2/4] PCI: Add pcibios_add_device Matthew Garrett
2012-08-23 16:36 ` [PATCH V3 3/4] PCI: Add support for non-BAR ROMs Matthew Garrett
2012-09-05  2:18   ` Don Dutile
2012-09-05  2:29     ` Matthew Garrett
2012-09-05 12:46       ` Alan Cox
2012-09-05 13:20         ` Matthew Garrett
2012-09-05 13:30           ` Alan Cox
2012-09-05 13:44             ` Matthew Garrett
2012-08-23 16:36 ` [PATCH V3 4/4] X86: Use PCI setup data Matthew Garrett
2012-08-24  9:30 ` Use PCI ROMs from EFI boot services David Woodhouse
2012-08-24 12:53   ` Matthew Garrett
2012-10-25 17:35 ` Bjorn Helgaas
2012-12-03 20:02   ` Seth Forshee
2012-12-05 20:09     ` Bjorn Helgaas
2012-12-05 20:22       ` Matthew Garrett
2012-12-05 22:21         ` Bjorn Helgaas
2012-12-05 21:06       ` David Woodhouse
2012-12-06  0:15     ` Yinghai Lu
2012-12-06  0:18       ` Matthew Garrett
2012-12-06  0:21         ` H. Peter Anvin
2012-12-06  0:30           ` Yinghai Lu
2012-12-06  0:36             ` H. Peter Anvin
2012-12-06  0:57               ` Matthew Garrett
2012-12-06  1:04                 ` H. Peter Anvin
2012-12-06  1:13                   ` Matthew Garrett
2012-12-06  1:21                     ` H. Peter Anvin
2012-12-06  6:19                       ` Matthew Garrett
2012-12-06  1:00           ` Matthew Garrett
2012-12-06  0:22         ` Yinghai Lu
2012-12-06  0:23         ` Eric W. Biederman
2012-12-06  0:36       ` H. Peter Anvin
2012-12-06  0:51         ` Yinghai Lu
2012-12-06  0:52           ` Yinghai Lu
2012-12-06 18:19             ` Bjorn Helgaas
2012-12-06 18:26               ` H. Peter Anvin
2012-12-06 18:54                 ` Matthew Garrett
2012-12-06 18:57                   ` Yinghai Lu [this message]
2012-12-06 21:44                   ` Bjorn Helgaas
2012-12-06  0:56           ` H. Peter Anvin

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=CAE9FiQWrfp4ptabLiGTv+tH2Nc9i+opX2O9Kk32MbwhF3vCOqg@mail.gmail.com \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dwmw2@infradead.org \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mjg59@srcf.ucam.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).