x86/pci: intel ioh bus num reg accessing fix
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/7 x86/pci: intel ioh bus num reg accessing fix
it is above 0x100, so if mmconf is not enable, need to skip it
--- arch/x86/pci/intel_bus.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/x86/pci/intel_bus.c +4 -0
@@ -49,6 +49,10 @@ static void __devinit pci_root_bus_res(su64 mmioh_base, mmioh_end;int bus_base, bus_end; +/* some sys doesn't get mmconf enabled */ +if (dev->cfg_size <0x200 ) +return ; +if (pci_root_num >=PCI_ROOT_NR ) {printk (KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n" );return ;
PATCH 2/7 x86/pci: use resource_size_t in update_res -v2
In reply to a message not in the archiveprepare to enable 32bit intel and amd bus
v2: change __init to __devinit
--- arch/x86/pci/bus_numa.c | 16 ++++++++-------- arch/x86/pci/bus_numa.h | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-)
arch/x86/pci/bus_numa.c +8 -8
@@ -51,8 +51,8 @@ void x86_pci_root_bus_res_quirks(struct } } -void __devinit update_res (struct pci_root_info *info,size_t start, -size_t end,unsigned long flags,int merge) +void __devinit update_res (struct pci_root_info *info,resource_size_t start, +resource_size_t end,unsigned long flags,int merge) {int i;struct resource *res;
@@ -65,20 +65,20 @@ void __devinit update_res(struct pci_roo/* try to merge it with old one */ for (i =0 ; i < info->res_num; i++) { -size_t final_start, final_end; -size_t common_start, common_end; +resource_size_t final_start, final_end; +resource_size_t common_start, common_end; res = &info->res[i];if (res->flags != flags)continue ; - common_start =max ((size_t )res->start, start); - common_end =min ((size_t )res->end, end); + common_start =max (res->start, start); + common_end =min (res->end, end);if (common_start > common_end +1 )continue ; - final_start =min ((size_t )res->start, start); - final_end =max ((size_t )res->end, end); + final_start =min (res->start, start); + final_end =max (res->end, end); res->start = final_start; res->end = final_end;
arch/x86/pci/bus_numa.h +2 -2
@@ -22,6 +22,6 @@ extern int pci_root_num;extern struct pci_root_info pci_root_info[PCI_ROOT_NR ];extern int found_all_numa_early; -extern void update_res (struct pci_root_info *info,size_t start, -size_t end,unsigned long flags,int merge); +extern void update_res (struct pci_root_info *info,resource_size_t start, +resource_size_t end,unsigned long flags,int merge);#endif
Re: [PATCH 2/7] x86/pci: use resource_size_t in update_res -v2
Quoted 8 lines · On Fri, 18 Dec 2009 12:09:37 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable 32bit intel and amd bus
v2: change
__initto__devinitSigned-off-by Yinghai Lu <[email protected]>---
Applied 2-3 to my linux-next branch, thanks. (1 was already applied to fix Jens' problem over the holidays, thanks hpa).
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 2/7] x86/pci: use resource_size_t in update_res -v2
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Fri, 18 Dec 2009 12:09:37 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable 32bit intel and amd bus
Quoted 8 lines
Quoted 4 lines
v2: change
__initto__devinitSigned-off-by Yinghai Lu <[email protected]>---
Applied 2-3 to my linux-next branch, thanks. (1 was already applied to fix Jens' problem over the holidays, thanks hpa).
will find out good apply sequence....
YH
Re: [PATCH 2/7] x86/pci: use resource_size_t in update_res -v2
Quoted 10 lines · On Fri, 15 Jan 2010 13:20:53 -0800 Yinghai Lu <[email protected]> wrote:
Quoted 9 lines · Jesse Barnes
Quoted 6 lines · On Fri, 18 Dec 2009 12:09:37 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable 32bit intel and amd bus
v2: change
__initto__devinit
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Signed-off-by Yinghai Lu <[email protected]>---
Applied 2-3 to my linux-next branch, thanks. (1 was already applied to fix Jens' problem over the holidays, thanks hpa).
will find out good apply sequence....
Pushing the ones for 32 bit bus driver support through -tip is fine with me, you can add my Acked-by.
Thanks,
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 2/7] x86/pci: use resource_size_t in update_res -v2
Quoted 16 lines · Jesse Barnes
Quoted 13 lines · On Fri, 15 Jan 2010 13:20:53 -0800 Yinghai Lu <[email protected]> wrote:
Quoted 12 lines · Jesse Barnes
Quoted 8 lines · On Fri, 18 Dec 2009 12:09:37 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable 32bit intel and amd bus
v2: change
__initto__devinitSigned-off-by Yinghai Lu <[email protected]>---
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Applied 2-3 to my linux-next branch, thanks. (1 was already applied to fix Jens' problem over the holidays, thanks hpa).
will find out good apply sequence....
Pushing the ones for 32 bit bus driver support through -tip is fine with me, you can add my Acked-by.
please drop 2 and 3 from pci/linux-next tree. we need to make them go through tip/x86 tree with range related seperating code.
http://git.kernel.org/?p=linux/kernel/git/jbarnes/pci-2.6.git;a=commitdiff;h=f84fe8aef6e4b23ab58175a15dd12c197c993f81
http://git.kernel.org/?p=linux/kernel/git/jbarnes/pci-2.6.git;a=commitdiff;h=693f084f82a38fc1b01e3b05664a6fe014a3488a
Thanks
Yinghai
Re: [PATCH 2/7] x86/pci: use resource_size_t in update_res -v2
Quoted 23 lines · On Thu, 21 Jan 2010 17:55:38 -0800 Yinghai Lu <[email protected]> wrote:
Quoted 22 lines · Jesse Barnes
Quoted 18 lines · On Fri, 15 Jan 2010 13:20:53 -0800 Yinghai Lu <[email protected]> wrote:
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Fri, 18 Dec 2009 12:09:37 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable 32bit intel and amd bus
Quoted 8 lines
Quoted 4 lines
v2: change
__initto__devinitSigned-off-by Yinghai Lu <[email protected]>---
Applied 2-3 to my linux-next branch, thanks. (1 was already applied to fix Jens' problem over the holidays, thanks hpa).
will find out good apply sequence....
Quoted 8 lines
Quoted 2 lines
Pushing the ones for 32 bit bus driver support through -tip is fine with me, you can add my Acked-by.
please drop 2 and 3 from pci/linux-next tree. we need to make them go through tip/x86 tree with range related seperating code.
http://git.kernel.org/?p=linux/kernel/git/jbarnes/pci-2.6.git;a=commitdiff;h=f84fe8aef6e4b23ab58175a15dd12c197c993f81
http://git.kernel.org/?p=linux/kernel/git/jbarnes/pci-2.6.git;a=commitdiff;h=693f084f82a38fc1b01e3b05664a6fe014a3488a
Ok, dropped.
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
PATCH 3/7 x86/pci: amd one chain system to use pci read out res
In reply to a message not in the archivefound MSI amd k8 based laptops is hiding [0x70000000, 0x80000000) RAM from e820.
enable amd one chain even for all.
--- arch/x86/pci/amd_bus.c | 7 ++++--- arch/x86/pci/bus_numa.c | 5 ----- arch/x86/pci/bus_numa.h | 1 - 3 files changed, 4 insertions(+), 9 deletions(-)
arch/x86/pci/amd_bus.c +4 -3
@@ -87,11 +87,12 @@ static int __init early_fill_mp_bus_infostruct range range[RANGE_NUM ];u64 val;u32 address; +int found;if (!early_pci_allowed ())return -1 ; - found_all_numa_early =0 ; + found =0 ;for (i =0 ; i <ARRAY_SIZE (pci_probes); i++) {u32 id;u16 device;
@@ -105,12 +106,12 @@ static int __init early_fill_mp_bus_info device = (id>>16 ) &0xffff ;if (pci_probes[i].vendor == vendor && pci_probes[i].device == device) { - found_all_numa_early =1 ; + found =1 ;break ; } } -if (!found_all_numa_early) +if (!found)return 0 ; pci_root_num =0 ;
arch/x86/pci/bus_numa.c +0 -5
@@ -5,7 +5,6 @@int pci_root_num;struct pci_root_info pci_root_info[PCI_ROOT_NR ]; -int found_all_numa_early;void x86_pci_root_bus_res_quirks (struct pci_bus *b) {
@@ -21,10 +20,6 @@ void x86_pci_root_bus_res_quirks(structif (!pci_root_num)return ; -/* for amd, if only one root bus, don't need to do anything */ -if (pci_root_num <2 && found_all_numa_early) -return ; -for (i =0 ; i < pci_root_num; i++) {if (pci_root_info[i].bus_min == b->number)break ;
arch/x86/pci/bus_numa.h +0 -1
@@ -20,7 +20,6 @@ struct pci_root_info {#define PCI_ROOT_NR 4extern int pci_root_num;extern struct pci_root_info pci_root_info[PCI_ROOT_NR ]; -extern int found_all_numa_early;extern void update_res (struct pci_root_info *info,resource_size_t start,resource_size_t end,unsigned long flags,int merge);
PATCH 4/7 x86/pci: use u64 instead of size_t in amd_bus.c -v2
In reply to a message not in the archiveprepare to enable it for 32bit
-v2: remove not needed cast
--- arch/x86/pci/amd_bus.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
arch/x86/pci/amd_bus.c +8 -8
@@ -82,8 +82,8 @@ static int __init early_fill_mp_bus_infostruct pci_root_info *info;u32 reg;struct resource *res; -size_t start; -size_t end; +u64 start; +u64 end;struct range range[RANGE_NUM ];u64 val;u32 address;
@@ -173,7 +173,7 @@ static int __init early_fill_mp_bus_info info = &pci_root_info[j];printk (KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n" , - node, link, (u64 )start, (u64 )end); + node, link, start, end);/* kernel only handle 16 bit only */ if (end >0xffff )
@@ -207,7 +207,7 @@ static int __init early_fill_mp_bus_info address =MSR_K8_TOP_MEM1 ;rdmsrl (address, val); end = (val &0xffffff800000ULL ); -printk (KERN_INFO "TOM: %016lx aka %ldM\n" , end, end>>20 ); +printk (KERN_INFO "TOM: %016llx aka %lldM\n" , end, end>>20 );if (end < (1ULL <<32 ))subtract_range (range,RANGE_NUM ,0 , end -1 );
@@ -246,7 +246,7 @@ static int __init early_fill_mp_bus_info info = &pci_root_info[j];printk (KERN_DEBUG "node %d link %d: mmio [%llx, %llx]" , - node, link, (u64 )start, (u64 )end); + node, link, start, end);/* * some sick allocation would have range overlap with fam10h * mmconf range, so need to update start and end.
@@ -272,13 +272,13 @@ static int __init early_fill_mp_bus_info endx = fam10h_mmconf_start -1 ;update_res (info, start, endx,IORESOURCE_MEM ,0 );subtract_range (range,RANGE_NUM , start, endx); -printk (KERN_CONT " ==> [%llx, %llx]" , (u64 )start, endx); +printk (KERN_CONT " ==> [%llx, %llx]" , start, endx); start = fam10h_mmconf_end +1 ; changed =1 ; }if (changed) {if (start <= end) { -printk (KERN_CONT " %s [%llx, %llx]" , endx?"and" :"==>" , (u64 )start, (u64 )end); +printk (KERN_CONT " %s [%llx, %llx]" , endx?"and" :"==>" , start, end); }else {printk (KERN_CONT "%s\n" , endx?"" :" ==> none" );continue ;
@@ -301,7 +301,7 @@ static int __init early_fill_mp_bus_info address =MSR_K8_TOP_MEM2 ;rdmsrl (address, val); end = (val &0xffffff800000ULL ); -printk (KERN_INFO "TOM2: %016lx aka %ldM\n" , end, end>>20 ); +printk (KERN_INFO "TOM2: %016llx aka %lldM\n" , end, end>>20 );subtract_range (range,RANGE_NUM ,1ULL <<32 , end -1 ); }
Re: [PATCH 4/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2
Quoted 7 lines · On Fri, 18 Dec 2009 12:09:45 -0800 Yinghai Lu <[email protected]> wrote:
prepare to enable it for 32bit
-v2: remove not needed cast
Signed-off-by Yinghai Lu <[email protected]>
4-6 have conflicts against my linux-next branch, can you refresh them?
Thanks,
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 4/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2
Quoted 4 lines · Jesse Barnes
Quoted 1 line · On Fri, 18 Dec 2009 12:09:45 -0800 Yinghai Lu <[email protected]> wrote:
Quoted 8 lines
Quoted 6 lines
prepare to enable it for 32bit
-v2: remove not needed cast
Signed-off-by Yinghai Lu <[email protected]>4-6 have conflicts against my linux-next branch, can you refresh them?
because it will rely on range.c related cleanup. can we make it go through tip and add acked-by from you?
Thanks
Yinghai
PATCH 5/7 x86/pci: add cap_resource -v2
In reply to a message not in the archiveprepare for 32bit pci root bus
-v2: hpa said we should compare with (resource_size_t)~0
--- arch/x86/pci/amd_bus.c | 8 +++++--- arch/x86/pci/bus_numa.c | 3 +++ arch/x86/pci/intel_bus.c | 5 ++++- include/linux/range.h | 8 ++++++++ 4 files changed, 20 insertions(+), 4 deletions(-)
arch/x86/pci/amd_bus.c +5 -3
@@ -201,7 +201,7 @@ static int __init early_fill_mp_bus_infomemset (range,0 ,sizeof (range));/* 0xfd00000000-0xffffffffff for HT */ - range[0 ].end = (0xfdULL <<32 ) -1 ; + range[0 ].end =cap_resource ((0xfdULL <<32 ) -1 );/* need to take out [0, TOM) for RAM*/ address =MSR_K8_TOP_MEM1 ;
@@ -286,7 +286,8 @@ static int __init early_fill_mp_bus_info } } -update_res (info, start, end,IORESOURCE_MEM ,1 ); +update_res (info,cap_resource (start),cap_resource (end), +IORESOURCE_MEM ,1 );subtract_range (range,RANGE_NUM , start, end);printk (KERN_CONT "\n" ); }
@@ -321,7 +322,8 @@ static int __init early_fill_mp_bus_infoif (!range[i].end)continue ; -update_res (info, range[i].start, range[i].end, +update_res (info,cap_resource (range[i].start), +cap_resource (range[i].end),IORESOURCE_MEM ,1 ); } }
arch/x86/pci/bus_numa.c +3 -0
@@ -55,6 +55,9 @@ void __init update_res(struct pci_root_iif (start > end)return ; +if (start == (resource_size_t )~0 ) +return ; +if (!merge) goto addit;
arch/x86/pci/intel_bus.c +4 -1
@@ -6,6 +6,8 @@#include <linux/dmi.h> #include <linux/pci.h> #include <linux/init.h> +#include <linux/range.h> +#include <asm/pci_x86.h> #include "bus_numa.h"
@@ -85,7 +87,8 @@ static void __devinit pci_root_bus_res(s mmioh_base |= ((u64)(dword &0x7ffff )) <<32 ;pci_read_config_dword (dev,IOH_LMMIOH_LIMITU , &dword); mmioh_end |= ((u64)(dword &0x7ffff )) <<32 ; -update_res (info, mmioh_base, mmioh_end,IORESOURCE_MEM ,0 ); +update_res (info,cap_resource (mmioh_base),cap_resource (mmioh_end), +IORESOURCE_MEM ,0 );print_ioh_resources (info); }
include/linux/range.h +8 -0
@@ -19,4 +19,12 @@ int clean_sort_range(struct range *rangevoid sort_range (struct range *range,int nr_range); + +static inline resource_size_t cap_resource (u64 val) +{ +if (val > (resource_size_t )~0 ) +return (resource_size_t )~0 ; +else +return val; +}#endif
PATCH 6/7 x86/pci: enable pci root res read out for 32bit too -v3
In reply to a message not in the archiveshould be good for 32bit too.
-v3: cast res->start
--- arch/x86/pci/Makefile | 3 +-- arch/x86/pci/amd_bus.c | 14 +------------- arch/x86/pci/bus_numa.h | 4 ++-- arch/x86/pci/i386.c | 4 ---- arch/x86/pci/intel_bus.c | 2 +- 5 files changed, 5 insertions(+), 22 deletions(-)
arch/x86/pci/Makefile +1 -2
@@ -14,8 +14,7 @@ obj-$(CONFIG_X86_VISWS) += visws.o obj-$(CONFIG_X86_NUMAQ) += numaq_32.o obj-y += common.o early.o -obj-y += amd_bus.o -obj-$(CONFIG_X86_64) += bus_numa.o intel_bus.o +obj-y += amd_bus.o bus_numa.o intel_bus.o ifeq ($(CONFIG_PCI_DEBUG),y) EXTRA_CFLAGS += -DDEBUG
arch/x86/pci/amd_bus.c +1 -13
@@ -6,9 +6,7 @@#include <asm/pci_x86.h> -#ifdef CONFIG_X86_64 #include <asm/pci-direct.h> -#endif #include "bus_numa.h"
@@ -17,8 +15,6 @@* also get peer root bus resource for io,mmio */ -#ifdef CONFIG_X86_64 -struct pci_hostbridge_probe {u32 bus;u32 slot;
@@ -342,21 +338,13 @@ static int __init early_fill_mp_bus_infoprintk (KERN_DEBUG "bus: %02x index %x %s: [%llx, %llx]\n" , busnum, j, (res->flags &IORESOURCE_IO )?"io port" :"mmio" , - res->start, res->end); + (u64 )res->start, (u64 )res->end); } }return 0 ; } -#else /* !CONFIG_X86_64 */ - -static int __init early_fill_mp_bus_info (void ) {return 0 ; } - -#endif /* !CONFIG_X86_64 */ - -/* common 32/64 bit code */ -#define ENABLE_CF8_EXT_CFG (1ULL << 46)static void enable_pci_io_ecs (void *unused)
arch/x86/pci/i386.c +0 -4
@@ -257,10 +257,6 @@ void __init pcibios_resource_survey(void*/ fs_initcall (pcibios_assign_resources); -void __weak x86_pci_root_bus_res_quirks (struct pci_bus *b) -{ -} -/* * If we set up a device for bus mastering, we need to check the latency * timer as certain crappy BIOSes forget to set it properly.
arch/x86/pci/bus_numa.h +2 -2
@@ -1,5 +1,5 @@ -#ifdef CONFIG_X86_64 - +#ifndef __BUS_NUMA_H +#define __BUS_NUMA_H/* * sub bus (transparent) will use entres from 3 to store extra from * root, so need to make sure we have enough slot there, Should we
arch/x86/pci/intel_bus.c +1 -1
@@ -30,7 +30,7 @@ static inline void print_ioh_resources(s busnum, i, (res->flags &IORESOURCE_IO ) ?"io port" :"mmio" , - res->start, res->end); + (u64)res->start, (u64)res->end); } }
PATCH 7/7 x86/pci: don't check mmconf again if it is from MSR with amd faml0h
In reply to a message not in the archivefor AMD Fam10h, it we read mmconf from MSR early, we should just trust it because we check it and correct it already.
so skip the reject check there.
--- arch/x86/pci/mmconfig-shared.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/x86/pci/mmconfig-shared.c +9 -1
@@ -168,6 +168,7 @@ static const char __init *pci_mmcfg_intereturn "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub" ; } +static int __initdata amd_fam10h_mmconf_found_via_hostbridge;static const char __init *pci_mmcfg_amd_fam10h (void ) {u32 low, high, address;
@@ -215,6 +216,8 @@ static const char __init *pci_mmcfg_amd_return NULL ; } + amd_fam10h_mmconf_found_via_hostbridge =1 ; +return "AMD Family 10h NB" ; }
@@ -606,7 +609,12 @@ static void __init __pci_mmcfg_init(intif (!known_bridge)acpi_sfi_table_parse (ACPI_SIG_MCFG , pci_parse_mcfg); -pci_mmcfg_reject_broken (early); +/* +* if it is amd fam10h, and that is read from msr, +* we don't need check them again. +*/ +if (!amd_fam10h_mmconf_found_via_hostbridge) +pci_mmcfg_reject_broken (early);if (list_empty (&pci_mmcfg_list))return ;
Re: [PATCH 7/7] x86/pci: don't check mmconf again if it is from MSR with amd faml0h
Quoted 7 lines · On Fri, 18 Dec 2009 12:09:58 -0800 Yinghai Lu <[email protected]> wrote:
for AMD Fam10h, it we read mmconf from MSR early, we should just trust it because we check it and correct it already.
so skip the reject check there.
Signed-off-by Yinghai Lu <[email protected]>
My previous question wasn't answered. Either reject_broken should be a no-op on this platform, or it's getting things wrong and should be fixed. Adding a whitelist here seems like the wrong thing to do...
Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
Re: [PATCH 7/7] x86/pci: don't check mmconf again if it is from MSR with amd faml0h
Quoted 7 lines · Jesse Barnes
Quoted 4 lines · On Fri, 18 Dec 2009 12:09:58 -0800 Yinghai Lu <[email protected]> wrote:
for AMD Fam10h, it we read mmconf from MSR early, we should just trust it because we check it and correct it already.
Quoted 8 lines
Quoted 3 lines
so skip the reject check there.
Signed-off-by Yinghai Lu <[email protected]>My previous question wasn't answered. Either
reject_brokenshould be a no-op on this platform, or it's getting things wrong and should be fixed. Adding a whitelist here seems like the wrong thing to do...
let me find other way, may update e820 directly.
YH