| Submitter | Jiang Liu |
|---|---|
| Date | June 19, 2012, 1:15 p.m. |
| Message ID | <1340111732-6276-11-git-send-email-jiang.liu@huawei.com> |
| Download | mbox | patch |
| Permalink | /patch/165715/ |
| State | Superseded |
| Headers | show |
Comments
On Tue, Jun 19, 2012 at 6:15 AM, Jiang Liu <jiang.liu@huawei.com> wrote: > Refine __pci_mmcfg_init() for better code readability. > > Signed-off-by: Jiang Liu <liuj97@gmail.com> > --- > arch/x86/pci/mmconfig-shared.c | 51 ++++++++++++++++++--------------------- > 1 files changed, 24 insertions(+), 27 deletions(-) > > diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c > index 870ed3f..f8c967c 100644 > --- a/arch/x86/pci/mmconfig-shared.c > +++ b/arch/x86/pci/mmconfig-shared.c > @@ -545,8 +545,6 @@ static void __init pci_mmcfg_reject_broken(int early) > } > } > > -static int __initdata known_bridge; > - > static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg, > struct acpi_mcfg_allocation *cfg) > { > @@ -618,28 +616,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header) > > static void __init __pci_mmcfg_init(int early) > { > - /* MMCONFIG disabled */ > - if ((pci_probe & PCI_PROBE_MMCONF) == 0) > - return; > - > - /* MMCONFIG already enabled */ > - if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) > - return; > - > - /* for late to exit */ > - if (known_bridge) > - return; > - > - if (early) { > - if (pci_mmcfg_check_hostbridge()) > - known_bridge = 1; > - } > - > - if (!known_bridge) > - acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); > - > pci_mmcfg_reject_broken(early); > - > if (list_empty(&pci_mmcfg_list)) > return; > > @@ -659,19 +636,39 @@ static void __init __pci_mmcfg_init(int early) > free_all_mmcfg(); > pci_mmcfg_arch_init_failed = true; > } > - > - if (!early && !known_bridge) > - acpi_pci_cache_mcfg(); > } > > +static int __initdata known_bridge; > + > void __init pci_mmcfg_early_init(void) > { > - __pci_mmcfg_init(1); > + if (pci_probe & PCI_PROBE_MMCONF) { > + if (pci_mmcfg_check_hostbridge()) > + known_bridge = 1; > + else > + acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); > + __pci_mmcfg_init(1); > + } > } > > void __init pci_mmcfg_late_init(void) > { > + /* MMCONFIG disabled */ > + if ((pci_probe & PCI_PROBE_MMCONF) == 0) > + return; > + > + /* MMCONFIG already enabled */ > + if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) > + return; > + > + if (known_bridge) > + return; > + > + acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); > __pci_mmcfg_init(0); > + > + if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) > + acpi_pci_cache_mcfg(); > } > > static int __init pci_mmcfg_late_insert_resources(void) looks like MCFG is not cached when the entries is reserved through e820. but it is cached when entries is reserved through ACPI ... Please check if it is possible just not cache MCFG. Thanks Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 2012-6-20 2:31, Yinghai Lu wrote: > > looks like MCFG is not cached when the entries is reserved through e820. > but it is cached when entries is reserved through ACPI ... > > Please check if it is possible just not cache MCFG. OOPS, my bad. The right logic should be void __init pci_mmcfg_late_init(void) { /* MMCONFIG disabled */ if ((pci_probe & PCI_PROBE_MMCONF) == 0) return; if (known_bridge) return; /* MMCONFIG hasn't been enabled yet */ if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) { acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); __pci_mmcfg_init(0); } if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) acpi_pci_cache_mcfg(); } Will send out a patch once we decide whether we should keep the MCFG cache. Thanks! Gerry -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 870ed3f..f8c967c 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c @@ -545,8 +545,6 @@ static void __init pci_mmcfg_reject_broken(int early) } } -static int __initdata known_bridge; - static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg, struct acpi_mcfg_allocation *cfg) { @@ -618,28 +616,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header) static void __init __pci_mmcfg_init(int early) { - /* MMCONFIG disabled */ - if ((pci_probe & PCI_PROBE_MMCONF) == 0) - return; - - /* MMCONFIG already enabled */ - if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) - return; - - /* for late to exit */ - if (known_bridge) - return; - - if (early) { - if (pci_mmcfg_check_hostbridge()) - known_bridge = 1; - } - - if (!known_bridge) - acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); - pci_mmcfg_reject_broken(early); - if (list_empty(&pci_mmcfg_list)) return; @@ -659,19 +636,39 @@ static void __init __pci_mmcfg_init(int early) free_all_mmcfg(); pci_mmcfg_arch_init_failed = true; } - - if (!early && !known_bridge) - acpi_pci_cache_mcfg(); } +static int __initdata known_bridge; + void __init pci_mmcfg_early_init(void) { - __pci_mmcfg_init(1); + if (pci_probe & PCI_PROBE_MMCONF) { + if (pci_mmcfg_check_hostbridge()) + known_bridge = 1; + else + acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); + __pci_mmcfg_init(1); + } } void __init pci_mmcfg_late_init(void) { + /* MMCONFIG disabled */ + if ((pci_probe & PCI_PROBE_MMCONF) == 0) + return; + + /* MMCONFIG already enabled */ + if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) + return; + + if (known_bridge) + return; + + acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg); __pci_mmcfg_init(0); + + if (!(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)) + acpi_pci_cache_mcfg(); } static int __init pci_mmcfg_late_insert_resources(void)
Refine __pci_mmcfg_init() for better code readability. Signed-off-by: Jiang Liu <liuj97@gmail.com> --- arch/x86/pci/mmconfig-shared.c | 51 ++++++++++++++++++--------------------- 1 files changed, 24 insertions(+), 27 deletions(-)