From: Jiang Liu <jiang.liu@huawei.com>
To: Yinghai Lu <yinghai@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
Don Dutile <ddutile@redhat.com>,
Yijing Wang <wangyijing@huawei.com>,
Keping Chen <chenkeping@huawei.com>, <linux-pci@vger.kernel.org>,
Jiang Liu <liuj97@gmail.com>
Subject: Re: [PATCH v7 08/10] PCI, x86: add MMCFG information on demand
Date: Fri, 15 Jun 2012 16:13:14 +0800 [thread overview]
Message-ID: <4FDAEE9A.7060706@huawei.com> (raw)
In-Reply-To: <CAE9FiQVHBE7pvaC5aCk-7q_pU3mxSoo5JapQkjG80DcnW16ZxA@mail.gmail.com>
Hi Yinghai,
Thanks for your review and comments!
On 2012-6-15 15:15, Yinghai Lu wrote:
>> @@ -625,6 +636,13 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
>> }
>> }
>>
>> + i = entries * sizeof(*cfg_table);
>> + pci_acpi_mcfg_array = kmalloc(i, GFP_KERNEL);
>> + if (pci_acpi_mcfg_array) {
>> + memcpy(pci_acpi_mcfg_array, cfg_table, i);
>> + pci_acpi_mcfg_entries = entries;
>> + }
>> +
>
> here cache cfg too early. should do that after
>
> pci_mmcfg_reject_broken().
>
> otherwise will use mcfg even try to reject that before.
Good cache, how about the following patch to fix this?
I'm also preparing an V8 to fix build failure issues reported by Fengguang,
and also simplify the __pci_mmcfg_init() implementation.
---
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 77f0db2..bcd0928 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -623,11 +623,27 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
}
}
- i = entries * sizeof(*cfg_table);
- pci_acpi_mcfg_array = kmalloc(i, GFP_KERNEL);
- if (pci_acpi_mcfg_array) {
- memcpy(pci_acpi_mcfg_array, cfg_table, i);
- pci_acpi_mcfg_entries = entries;
+ return 0;
+}
+
+static int __init pci_cache_mcfg(struct acpi_table_header *header)
+{
+ unsigned long i;
+ struct acpi_table_mcfg *mcfg;
+ struct acpi_mcfg_allocation *cfg_table;
+
+ if (!header)
+ return -EINVAL;
+
+ i = (header->length - sizeof(struct acpi_table_mcfg));
+ if (i) {
+ pci_acpi_mcfg_array = kmalloc(i, GFP_KERNEL);
+ if (pci_acpi_mcfg_array) {
+ mcfg = (struct acpi_table_mcfg *)header;
+ cfg_table = (struct acpi_mcfg_allocation *) &mcfg[1];
+ memcpy(pci_acpi_mcfg_array, cfg_table, i);
+ pci_acpi_mcfg_entries = i / sizeof (*cfg_table);
+ }
}
return 0;
@@ -682,8 +698,11 @@ out:
* Free all MCFG entries if ACPI is enabled. MCFG information will
* be added back on demand by the pci_root driver later.
*/
- if (!early && !acpi_disabled && !known_bridge && pci_acpi_mcfg_array)
- free_all_mmcfg();
+ if (!early && !acpi_disabled && !known_bridge) {
+ acpi_table_parse(ACPI_SIG_MCFG, pci_cache_mcfg);
+ if (pci_acpi_mcfg_array)
+ free_all_mmcfg();
+ }
}
void __init pci_mmcfg_early_init(void)
>> @@ -675,6 +693,14 @@ static void __init __pci_mmcfg_init(int early)
>> pci_mmcfg_resources_inserted = 1;
>> pci_mmcfg_arch_init_failed = true;
>> }
>> +
>> +out:
>> + /*
>> + * Free all MCFG entries if ACPI is enabled. MCFG information will
>> + * be added back on demand by the pci_root driver later.
>> + */
>> + if (!early && !acpi_disabled && !known_bridge && pci_acpi_mcfg_array)
>> + free_all_mmcfg();
>
> that really change the logic.
>
> looks like it will break mrst/sfi path.
>
> the scan from pci_legacy_init() for mrst/sfi will not have ext_pci_ops
> set for bus 0.
>
> | int __init pci_subsys_init(void)
> | {
> | /*
> | * The init function returns an non zero value when
> | * pci_legacy_init should be invoked.
> | */
> | if (x86_init.pci.init())
> | pci_legacy_init();
> |
> | pcibios_fixup_peer_bridges();
On platform with SFI implementation such as Moorsetown, acpi_disabled will
be set to 1 because there's no ACPI root pointer and acpi initialize will fail.
And sfi_init() implementation confirms that if acpi is enabled, then sfi will
be disabled. So I will it won't break SFI/MRST.
void __init sfi_init(void)
{
if (!acpi_disabled)
disable_sfi();
if (sfi_disabled)
return;
}
thanks!
Gerry
next prev parent reply other threads:[~2012-06-15 8:25 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-26 9:53 [PATCH v7 00/10] PCI, x86: update MMCFG information when hot-plugging PCI host bridges Jiang Liu
2012-05-26 9:53 ` [PATCH v7 01/10] PCI, x86: split out pci_mmcfg_check_reserved() for code reuse Jiang Liu
2012-05-26 9:53 ` [PATCH v7 02/10] PCI, x86: split out pci_mmconfig_alloc() " Jiang Liu
2012-05-26 9:53 ` [PATCH v7 03/10] PCI, x86: use RCU list to protect mmconfig list Jiang Liu
2012-05-26 9:53 ` [PATCH v7 04/10] PCI, x86: introduce pci_mmcfg_arch_map()/pci_mmcfg_arch_unmap() Jiang Liu
2012-05-26 9:53 ` [PATCH v7 05/10] PCI, x86: introduce pci_mmconfig_insert()/delete() for PCI root bridge hotplug Jiang Liu
2012-05-26 9:53 ` [PATCH v7 06/10] PCI, ACPI: provide MCFG address for PCI host bridges Jiang Liu
2012-05-26 9:54 ` [PATCH v7 07/10] PCI, x86: update MMCFG information when hot-plugging " Jiang Liu
2012-05-26 9:54 ` [PATCH v7 08/10] PCI, x86: add MMCFG information on demand Jiang Liu
2012-06-15 7:15 ` Yinghai Lu
2012-06-15 8:13 ` Jiang Liu [this message]
2012-06-15 11:50 ` Jiang Liu
2012-06-15 16:51 ` Yinghai Lu
2012-06-16 9:23 ` Jiang Liu
2012-06-16 20:08 ` Yinghai Lu
2012-06-16 21:48 ` Bjorn Helgaas
2012-06-16 22:44 ` Yinghai Lu
2012-06-16 22:48 ` Yinghai Lu
2012-06-17 1:55 ` Bjorn Helgaas
2012-06-18 1:21 ` Jiang Liu
2012-06-18 18:24 ` Bjorn Helgaas
2012-06-15 15:46 ` Bjorn Helgaas
2012-06-15 16:34 ` Jiang Liu
2012-06-15 16:55 ` Yinghai Lu
2012-06-16 8:58 ` Jiang Liu
2012-05-26 9:54 ` [PATCH v7 09/10] PCI, x86: simplify pci_mmcfg_late_insert_resources() Jiang Liu
2012-05-26 9:54 ` [PATCH v7 10/10] PCI, x86: get rid of redundant log messages Jiang Liu
2012-06-05 2:59 ` [PATCH v7 00/10] PCI, x86: update MMCFG information when hot-plugging PCI host bridges Taku Izumi
2012-06-15 3:06 ` Bjorn Helgaas
2012-06-15 7:16 ` Yinghai Lu
2012-06-15 11:42 ` Jiang Liu
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=4FDAEE9A.7060706@huawei.com \
--to=jiang.liu@huawei.com \
--cc=bhelgaas@google.com \
--cc=chenkeping@huawei.com \
--cc=ddutile@redhat.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-pci@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=wangyijing@huawei.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).