x86: Intel gen2 graphics stolen memory quirks
Subsystems (3)
cover x86: Intel gen2 graphics stolen memory quirks
From: Ville Syrjälä <[email protected]>
Ingo asked me to post the x86 bits as a standalone series. So here it is.
So the series adds the Intel gen2 graphics stolen memory reservation quirks to arch/x86. These are not unlike the quirks we have for later gens, except it's a bit more work to dig out the correct range to reserve on gen2.
This has been tested on 830, 845 and 855 chipsets. 865 still eludes me unfortunately.
Ville Syrjälä (3):
x86: Add vfunc for Intel graphics stolen memory base address
x86: Add Intel graphics stolen memory quirk for gen2 platforms
x86: Print the Intel graphcis stolen memory range
arch/x86/kernel/early-quirks.c | 211 +++++++++++++++++++++++++++++++++++------ include/drm/i915_drm.h | 20 ++++ 2 files changed, 202 insertions(+), 29 deletions(-)
Signature · 1 line
1.8.3.2
PATCH v3 2/3 x86: Add Intel graphics stolen memory quirk for gen2 platforms
From: Ville Syrjälä <[email protected]>
There isn't an explicit stolen memory base register on gen2. Some old comment in the i915 code suggests we should get it via max_low_pfn_mapped, but that's clearly a bad idea on my MGM.
The e820 map in said machine looks like this:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable [ 0.000000] BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000ce000-0x00000000000cffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved [ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001f6effff] usable [ 0.000000] BIOS-e820: [mem 0x000000001f6f0000-0x000000001f6f7fff] ACPI data [ 0.000000] BIOS-e820: [mem 0x000000001f6f8000-0x000000001f6fffff] ACPI NVS [ 0.000000] BIOS-e820: [mem 0x000000001f700000-0x000000001fffffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fec10000-0x00000000fec1ffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000ffb00000-0x00000000ffbfffff] reserved [ 0.000000] BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved
That makes max_low_pfn_mapped = 1f6f0000, so assuming our stolen memory would start there would place it on top of some ACPI memory regions. So not a good idea as already stated.
The 9MB region after the ACPI regions at 0x1f700000 however looks promising given that the macine reports the stolen memory size to be 8MB. Looking at the PGTBL_CTL register, the GTT entries are at offset 0x1fee00000, and given that the GTT entries occupy 128KB, it looks like the stolen memory could start at 0x1f700000 and the GTT entries would occupy the last 128KB of the stolen memory.
After some more digging through chipset documentation, I've determined the BIOS first allocates space for something called TSEG (something to do with SMM) from the top of memory, and then it allocates the graphics stolen memory below that. Accordind to the chipset documentation TSEG has a fixed size of 1MB on 855. So that explains the top 1MB in the e820 region. And it also confirms that the GTT entries are in fact at the end of the the stolen memory region.
Derive the stolen memory base address on gen2 the same as the BIOS does (TOM-TSEG_SIZE-stolen_size). There are a few differences between the registers on various gen2 chipsets, so a few different codepaths are required.
865G is again bit more special since it seems to support enough memory to hit 4GB address space issues. This means the PCI allocations will also affect the location of the stolen memory. Fortunately there appears to be the TOUD register which may give us the correct answer directly. But the chipset docs are a bit unclear, so I'm not 100% sure that the graphics stolen memory is always the last thing the BIOS steals. Someone would need to verify it on a real system.
I tested this on the my 830 and 855 machines, and so far everything looks peachy.
v2: Rewrite to use the TOM-TSEG_SIZE-stolen_size and TOUD methods
v3: Fix TSEG size for 830
--- arch/x86/kernel/early-quirks.c | 132 +++++++++++++++++++++++++++++++++++++++++ include/drm/i915_drm.h | 20 +++++++ 2 files changed, 152 insertions(+)
arch/x86/kernel/early-quirks.c +132 -0
@@ -247,6 +247,114 @@ static u32 __init intel_stolen_base(int num, int slot, int func, size_t stolen_s#define MB (x) (KB (KB (x)))#define GB (x) (MB (KB (x))) +static size_t __init i830_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I830_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +if (tmp &I830_TSEG_SIZE_1M ) +return MB (1 ); +else +return KB (512 ); +} + +static size_t __init i845_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I845_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +switch (tmp &I845_TSEG_SIZE_MASK ) { +case I845_TSEG_SIZE_512K : +return KB (512 ); +case I845_TSEG_SIZE_1M : +return MB (1 ); +default : +WARN_ON (1 ); +return 0 ; + } +} + +static size_t __init i85x_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I85X_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +return MB (1 ); +} + +static size_t __init i830_mem_size (void ) +{ +return read_pci_config_byte (0 ,0 ,0 ,I830_DRB3 ) *MB (32 ); +} + +static size_t __init i85x_mem_size (void ) +{ +return read_pci_config_byte (0 ,0 ,1 ,I85X_DRB3 ) *MB (32 ); +} + +/* +* On 830/845/85x the stolen memory base isn't available in any +* register. We need to calculate it as TOM-TSEG_SIZE-stolen_size. +*/ +static u32 __init i830_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i830_mem_size () -i830_tseg_size () - stolen_size; +} + +static u32 __init i845_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i830_mem_size () -i845_tseg_size () - stolen_size; +} + +static u32 __init i85x_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i85x_mem_size () -i85x_tseg_size () - stolen_size; +} + +static u32 __init i865_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +/* +* FIXME is the graphics stolen memory region +* always at TOUD? Ie. is it always the last +* one to be allocated by the BIOS? +*/ +return read_pci_config_16 (0 ,0 ,0 ,I865_TOUD ) <<16 ; +} + +static size_t __init i830_stolen_size (int num,int slot,int func) +{ +size_t stolen_size; +u16 gmch_ctrl; + + gmch_ctrl =read_pci_config_16 (0 ,0 ,0 ,I830_GMCH_CTRL ); + +switch (gmch_ctrl &I830_GMCH_GMS_MASK ) { +case I830_GMCH_GMS_STOLEN_512 : + stolen_size =KB (512 ); +break ; +case I830_GMCH_GMS_STOLEN_1024 : + stolen_size =MB (1 ); +break ; +case I830_GMCH_GMS_STOLEN_8192 : + stolen_size =MB (8 ); +break ; +case I830_GMCH_GMS_LOCAL : +/* local memory isn't part of the normal address space */ + stolen_size =0 ; +break ; +default : +return 0 ; + } + +return stolen_size; +} +static size_t __init gen3_stolen_size (int num,int slot,int func) {size_t stolen_size;
@@ -329,6 +437,26 @@ struct intel_stolen_funcs {u32 (*base)(int num,int slot,int func,size_t size); }; +static const struct intel_stolen_funcs i830_stolen_funcs = { + .base = i830_stolen_base, + .size = i830_stolen_size, +}; + +static const struct intel_stolen_funcs i845_stolen_funcs = { + .base = i845_stolen_base, + .size = i830_stolen_size, +}; + +static const struct intel_stolen_funcs i85x_stolen_funcs = { + .base = i85x_stolen_base, + .size = gen3_stolen_size, +}; + +static const struct intel_stolen_funcs i865_stolen_funcs = { + .base = i865_stolen_base, + .size = gen3_stolen_size, +}; +static const struct intel_stolen_funcs gen3_stolen_funcs = { .base = intel_stolen_base, .size = gen3_stolen_size,
@@ -345,6 +473,10 @@ static const struct intel_stolen_funcs gen8_stolen_funcs = { };static struct pci_device_id intel_stolen_ids[]__initdata = { +INTEL_I830_IDS (&i830_stolen_funcs), +INTEL_I845G_IDS (&i845_stolen_funcs), +INTEL_I85X_IDS (&i85x_stolen_funcs), +INTEL_I865G_IDS (&i865_stolen_funcs),INTEL_I915G_IDS (&gen3_stolen_funcs),INTEL_I915GM_IDS (&gen3_stolen_funcs),INTEL_I945G_IDS (&gen3_stolen_funcs),
include/drm/i915_drm.h +20 -0
@@ -56,6 +56,12 @@ extern bool i915_gpu_turbo_disable(void);#define I830_GMCH_CTRL 0x52 +#define I830_GMCH_GMS_MASK 0x70 +#define I830_GMCH_GMS_LOCAL 0x10 +#define I830_GMCH_GMS_STOLEN_512 0x20 +#define I830_GMCH_GMS_STOLEN_1024 0x30 +#define I830_GMCH_GMS_STOLEN_8192 0x40 +#define I855_GMCH_GMS_MASK 0xF0#define I855_GMCH_GMS_STOLEN_0M 0x0#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
@@ -72,4 +78,18 @@ extern bool i915_gpu_turbo_disable(void);#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) +#define I830_DRB3 0x63 +#define I85X_DRB3 0x43 +#define I865_TOUD 0xc4 + +#define I830_ESMRAMC 0x91 +#define I845_ESMRAMC 0x9e +#define I85X_ESMRAMC 0x61 +#define TSEG_ENABLE (1 << 0) +#define I830_TSEG_SIZE_512K (0 << 1) +#define I830_TSEG_SIZE_1M (1 << 1) +#define I845_TSEG_SIZE_MASK (3 << 1) +#define I845_TSEG_SIZE_512K (2 << 1) +#define I845_TSEG_SIZE_1M (3 << 1) +#endif /* _I915_DRM_H_ */
Signature · 1 line
1.8.3.2
tip-bot for Ville Syrjälä
merge bot[tip:x86/platform] x86/gpu: Add Intel graphics stolen memory quirk for gen2 platforms
x86/gpu: Add Intel graphics stolen memory quirk for gen2 platforms
Commit-ID: a4dff76924fe4f6d53a9f34196a67a32149e7270 Gitweb: http://git.kernel.org/tip/a4dff76924fe4f6d53a9f34196a67a32149e7270 Author: Ville Syrjälä <[email protected]> AuthorDate: Wed, 5 Feb 2014 21:28:59 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 9 Feb 2014 15:11:30 +0100
x86/gpu: Add Intel graphics stolen memory quirk for gen2 platforms
There isn't an explicit stolen memory base register on gen2. Some old comment in the i915 code suggests we should get it via max_low_pfn_mapped, but that's clearly a bad idea on my MGM.
The e820 map in said machine looks like this:
BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved BIOS-e820: [mem 0x00000000000ce000-0x00000000000cffff] reserved BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved BIOS-e820: [mem 0x0000000000100000-0x000000001f6effff] usable BIOS-e820: [mem 0x000000001f6f0000-0x000000001f6f7fff] ACPI data BIOS-e820: [mem 0x000000001f6f8000-0x000000001f6fffff] ACPI NVS BIOS-e820: [mem 0x000000001f700000-0x000000001fffffff] reserved BIOS-e820: [mem 0x00000000fec10000-0x00000000fec1ffff] reserved BIOS-e820: [mem 0x00000000ffb00000-0x00000000ffbfffff] reserved BIOS-e820: [mem 0x00000000fff00000-0x00000000ffffffff] reserved
That makes max_low_pfn_mapped = 1f6f0000, so assuming our stolen memory would start there would place it on top of some ACPI memory regions. So not a good idea as already stated.
The 9MB region after the ACPI regions at 0x1f700000 however looks promising given that the macine reports the stolen memory size to be 8MB. Looking at the PGTBL_CTL register, the GTT entries are at offset 0x1fee00000, and given that the GTT entries occupy 128KB, it looks like the stolen memory could start at 0x1f700000 and the GTT entries would occupy the last 128KB of the stolen memory.
After some more digging through chipset documentation, I've determined the BIOS first allocates space for something called TSEG (something to do with SMM) from the top of memory, and then it allocates the graphics stolen memory below that. Accordind to the chipset documentation TSEG has a fixed size of 1MB on 855. So that explains the top 1MB in the e820 region. And it also confirms that the GTT entries are in fact at the end of the the stolen memory region.
Derive the stolen memory base address on gen2 the same as the BIOS does (TOM-TSEG_SIZE-stolen_size). There are a few differences between the registers on various gen2 chipsets, so a few different codepaths are required.
865G is again bit more special since it seems to support enough memory to hit 4GB address space issues. This means the PCI allocations will also affect the location of the stolen memory. Fortunately there appears to be the TOUD register which may give us the correct answer directly. But the chipset docs are a bit unclear, so I'm not 100% sure that the graphics stolen memory is always the last thing the BIOS steals. Someone would need to verify it on a real system.
I tested this on the my 830 and 855 machines, and so far everything looks peachy.
--- arch/x86/kernel/early-quirks.c | 132 +++++++++++++++++++++++++++++++++++++++++ include/drm/i915_drm.h | 20 +++++++ 2 files changed, 152 insertions(+)
arch/x86/kernel/early-quirks.c +132 -0
@@ -247,6 +247,114 @@ static u32 __init intel_stolen_base(int num, int slot, int func, size_t stolen_s#define MB (x) (KB (KB (x)))#define GB (x) (MB (KB (x))) +static size_t __init i830_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I830_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +if (tmp &I830_TSEG_SIZE_1M ) +return MB (1 ); +else +return KB (512 ); +} + +static size_t __init i845_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I845_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +switch (tmp &I845_TSEG_SIZE_MASK ) { +case I845_TSEG_SIZE_512K : +return KB (512 ); +case I845_TSEG_SIZE_1M : +return MB (1 ); +default : +WARN_ON (1 ); +return 0 ; + } +} + +static size_t __init i85x_tseg_size (void ) +{ +u8 tmp =read_pci_config_byte (0 ,0 ,0 ,I85X_ESMRAMC ); + +if (!(tmp &TSEG_ENABLE )) +return 0 ; + +return MB (1 ); +} + +static size_t __init i830_mem_size (void ) +{ +return read_pci_config_byte (0 ,0 ,0 ,I830_DRB3 ) *MB (32 ); +} + +static size_t __init i85x_mem_size (void ) +{ +return read_pci_config_byte (0 ,0 ,1 ,I85X_DRB3 ) *MB (32 ); +} + +/* +* On 830/845/85x the stolen memory base isn't available in any +* register. We need to calculate it as TOM-TSEG_SIZE-stolen_size. +*/ +static u32 __init i830_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i830_mem_size () -i830_tseg_size () - stolen_size; +} + +static u32 __init i845_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i830_mem_size () -i845_tseg_size () - stolen_size; +} + +static u32 __init i85x_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +return i85x_mem_size () -i85x_tseg_size () - stolen_size; +} + +static u32 __init i865_stolen_base (int num,int slot,int func,size_t stolen_size) +{ +/* +* FIXME is the graphics stolen memory region +* always at TOUD? Ie. is it always the last +* one to be allocated by the BIOS? +*/ +return read_pci_config_16 (0 ,0 ,0 ,I865_TOUD ) <<16 ; +} + +static size_t __init i830_stolen_size (int num,int slot,int func) +{ +size_t stolen_size; +u16 gmch_ctrl; + + gmch_ctrl =read_pci_config_16 (0 ,0 ,0 ,I830_GMCH_CTRL ); + +switch (gmch_ctrl &I830_GMCH_GMS_MASK ) { +case I830_GMCH_GMS_STOLEN_512 : + stolen_size =KB (512 ); +break ; +case I830_GMCH_GMS_STOLEN_1024 : + stolen_size =MB (1 ); +break ; +case I830_GMCH_GMS_STOLEN_8192 : + stolen_size =MB (8 ); +break ; +case I830_GMCH_GMS_LOCAL : +/* local memory isn't part of the normal address space */ + stolen_size =0 ; +break ; +default : +return 0 ; + } + +return stolen_size; +} +static size_t __init gen3_stolen_size (int num,int slot,int func) {size_t stolen_size;
@@ -329,6 +437,26 @@ struct intel_stolen_funcs {u32 (*base)(int num,int slot,int func,size_t size); }; +static const struct intel_stolen_funcs i830_stolen_funcs = { + .base = i830_stolen_base, + .size = i830_stolen_size, +}; + +static const struct intel_stolen_funcs i845_stolen_funcs = { + .base = i845_stolen_base, + .size = i830_stolen_size, +}; + +static const struct intel_stolen_funcs i85x_stolen_funcs = { + .base = i85x_stolen_base, + .size = gen3_stolen_size, +}; + +static const struct intel_stolen_funcs i865_stolen_funcs = { + .base = i865_stolen_base, + .size = gen3_stolen_size, +}; +static const struct intel_stolen_funcs gen3_stolen_funcs = { .base = intel_stolen_base, .size = gen3_stolen_size,
@@ -345,6 +473,10 @@ static const struct intel_stolen_funcs gen8_stolen_funcs = { };static struct pci_device_id intel_stolen_ids[]__initdata = { +INTEL_I830_IDS (&i830_stolen_funcs), +INTEL_I845G_IDS (&i845_stolen_funcs), +INTEL_I85X_IDS (&i85x_stolen_funcs), +INTEL_I865G_IDS (&i865_stolen_funcs),INTEL_I915G_IDS (&gen3_stolen_funcs),INTEL_I915GM_IDS (&gen3_stolen_funcs),INTEL_I945G_IDS (&gen3_stolen_funcs),
include/drm/i915_drm.h +20 -0
@@ -56,6 +56,12 @@ extern bool i915_gpu_turbo_disable(void);#define I830_GMCH_CTRL 0x52 +#define I830_GMCH_GMS_MASK 0x70 +#define I830_GMCH_GMS_LOCAL 0x10 +#define I830_GMCH_GMS_STOLEN_512 0x20 +#define I830_GMCH_GMS_STOLEN_1024 0x30 +#define I830_GMCH_GMS_STOLEN_8192 0x40 +#define I855_GMCH_GMS_MASK 0xF0#define I855_GMCH_GMS_STOLEN_0M 0x0#define I855_GMCH_GMS_STOLEN_1M (0x1 << 4)
@@ -72,4 +78,18 @@ extern bool i915_gpu_turbo_disable(void);#define INTEL_GMCH_GMS_STOLEN_224M (0xc << 4)#define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) +#define I830_DRB3 0x63 +#define I85X_DRB3 0x43 +#define I865_TOUD 0xc4 + +#define I830_ESMRAMC 0x91 +#define I845_ESMRAMC 0x9e +#define I85X_ESMRAMC 0x61 +#define TSEG_ENABLE (1 << 0) +#define I830_TSEG_SIZE_512K (0 << 1) +#define I830_TSEG_SIZE_1M (1 << 1) +#define I845_TSEG_SIZE_MASK (3 << 1) +#define I845_TSEG_SIZE_512K (2 << 1) +#define I845_TSEG_SIZE_1M (3 << 1) +#endif /* _I915_DRM_H_ */
PATCH 1/3 x86: Add vfunc for Intel graphics stolen memory base address
In reply to [email protected]From: Ville Syrjälä <[email protected]>
For gen2 devices we're going to need another way to determine the stolen memory base address. Make that into a vfunc as well.
Also drop the bogus inline keyword from gen8_stolen_size().
--- arch/x86/kernel/early-quirks.c | 77 ++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 29 deletions(-)
arch/x86/kernel/early-quirks.c +48 -29
@@ -228,7 +228,7 @@ static void __init intel_remapping_check(int num, int slot, int func)* * And yes, so far on current devices the base addr is always under 4G. */ -static u32 __init intel_stolen_base (int num,int slot,int func) +static u32 __init intel_stolen_base (int num,int slot,int func,size_t stolen_size) {u32 base;
@@ -313,7 +313,7 @@ static size_t __init gen6_stolen_size(int num, int slot, int func)return gmch_ctrl <<25 ;/* 32 MB units */ } -static inline size_t gen8_stolen_size (int num,int slot,int func) +static size_t gen8_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;
@@ -323,31 +323,50 @@ static inline size_t gen8_stolen_size(int num, int slot, int func)return gmch_ctrl <<25 ;/* 32 MB units */ } -typedef size_t (*stolen_size_fn )(int num,int slot,int func); + +struct intel_stolen_funcs { +size_t (*size)(int num,int slot,int func); +u32 (*base)(int num,int slot,int func,size_t size); +}; + +static const struct intel_stolen_funcs gen3_stolen_funcs = { + .base = intel_stolen_base, + .size = gen3_stolen_size, +}; + +static const struct intel_stolen_funcs gen6_stolen_funcs = { + .base = intel_stolen_base, + .size = gen6_stolen_size, +}; + +static const struct intel_stolen_funcs gen8_stolen_funcs = { + .base = intel_stolen_base, + .size = gen8_stolen_size, +};static struct pci_device_id intel_stolen_ids[]__initdata = { -INTEL_I915G_IDS (gen3_stolen_size), -INTEL_I915GM_IDS (gen3_stolen_size), -INTEL_I945G_IDS (gen3_stolen_size), -INTEL_I945GM_IDS (gen3_stolen_size), -INTEL_VLV_M_IDS (gen6_stolen_size), -INTEL_VLV_D_IDS (gen6_stolen_size), -INTEL_PINEVIEW_IDS (gen3_stolen_size), -INTEL_I965G_IDS (gen3_stolen_size), -INTEL_G33_IDS (gen3_stolen_size), -INTEL_I965GM_IDS (gen3_stolen_size), -INTEL_GM45_IDS (gen3_stolen_size), -INTEL_G45_IDS (gen3_stolen_size), -INTEL_IRONLAKE_D_IDS (gen3_stolen_size), -INTEL_IRONLAKE_M_IDS (gen3_stolen_size), -INTEL_SNB_D_IDS (gen6_stolen_size), -INTEL_SNB_M_IDS (gen6_stolen_size), -INTEL_IVB_M_IDS (gen6_stolen_size), -INTEL_IVB_D_IDS (gen6_stolen_size), -INTEL_HSW_D_IDS (gen6_stolen_size), -INTEL_HSW_M_IDS (gen6_stolen_size), -INTEL_BDW_M_IDS (gen8_stolen_size), -INTEL_BDW_D_IDS (gen8_stolen_size) +INTEL_I915G_IDS (&gen3_stolen_funcs), +INTEL_I915GM_IDS (&gen3_stolen_funcs), +INTEL_I945G_IDS (&gen3_stolen_funcs), +INTEL_I945GM_IDS (&gen3_stolen_funcs), +INTEL_VLV_M_IDS (&gen6_stolen_funcs), +INTEL_VLV_D_IDS (&gen6_stolen_funcs), +INTEL_PINEVIEW_IDS (&gen3_stolen_funcs), +INTEL_I965G_IDS (&gen3_stolen_funcs), +INTEL_G33_IDS (&gen3_stolen_funcs), +INTEL_I965GM_IDS (&gen3_stolen_funcs), +INTEL_GM45_IDS (&gen3_stolen_funcs), +INTEL_G45_IDS (&gen3_stolen_funcs), +INTEL_IRONLAKE_D_IDS (&gen3_stolen_funcs), +INTEL_IRONLAKE_M_IDS (&gen3_stolen_funcs), +INTEL_SNB_D_IDS (&gen6_stolen_funcs), +INTEL_SNB_M_IDS (&gen6_stolen_funcs), +INTEL_IVB_M_IDS (&gen6_stolen_funcs), +INTEL_IVB_D_IDS (&gen6_stolen_funcs), +INTEL_HSW_D_IDS (&gen6_stolen_funcs), +INTEL_HSW_M_IDS (&gen6_stolen_funcs), +INTEL_BDW_M_IDS (&gen8_stolen_funcs), +INTEL_BDW_D_IDS (&gen8_stolen_funcs) };static void __init intel_graphics_stolen (int num,int slot,int func)
@@ -364,10 +383,10 @@ static void __init intel_graphics_stolen(int num, int slot, int func)for (i =0 ; i <ARRAY_SIZE (intel_stolen_ids); i++) {if (intel_stolen_ids[i].device == device) { -stolen_size_fn stolen_size = - (stolen_size_fn )intel_stolen_ids[i].driver_data; - size =stolen_size (num, slot, func); - start =intel_stolen_base (num, slot, func); +const struct intel_stolen_funcs *stolen_funcs = + (const struct intel_stolen_funcs *)intel_stolen_ids[i].driver_data; + size = stolen_funcs->size (num, slot, func); + start = stolen_funcs->base (num, slot, func, size);if (size && start) {/* Mark this space as reserved */ e820_add_region (start, size,E820_RESERVED );
Signature · 1 line
1.8.3.2
tip-bot for Ville Syrjälä
merge bot[tip:x86/platform] x86/gpu: Add vfunc for Intel graphics stolen memory base address
x86/gpu: Add vfunc for Intel graphics stolen memory base address
Commit-ID: 52ca70454ea5ff29bc39f7871d28f8e6f4713867 Gitweb: http://git.kernel.org/tip/52ca70454ea5ff29bc39f7871d28f8e6f4713867 Author: Ville Syrjälä <[email protected]> AuthorDate: Wed, 5 Feb 2014 21:28:58 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 9 Feb 2014 15:11:30 +0100
x86/gpu: Add vfunc for Intel graphics stolen memory base address
For gen2 devices we're going to need another way to determine the stolen memory base address. Make that into a vfunc as well.
Also drop the bogus inline keyword from gen8_stolen_size().
--- arch/x86/kernel/early-quirks.c | 77 ++++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 29 deletions(-)
arch/x86/kernel/early-quirks.c +48 -29
@@ -228,7 +228,7 @@ static void __init intel_remapping_check(int num, int slot, int func)* * And yes, so far on current devices the base addr is always under 4G. */ -static u32 __init intel_stolen_base (int num,int slot,int func) +static u32 __init intel_stolen_base (int num,int slot,int func,size_t stolen_size) {u32 base;
@@ -313,7 +313,7 @@ static size_t __init gen6_stolen_size(int num, int slot, int func)return gmch_ctrl <<25 ;/* 32 MB units */ } -static inline size_t gen8_stolen_size (int num,int slot,int func) +static size_t gen8_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;
@@ -323,31 +323,50 @@ static inline size_t gen8_stolen_size(int num, int slot, int func)return gmch_ctrl <<25 ;/* 32 MB units */ } -typedef size_t (*stolen_size_fn )(int num,int slot,int func); + +struct intel_stolen_funcs { +size_t (*size)(int num,int slot,int func); +u32 (*base)(int num,int slot,int func,size_t size); +}; + +static const struct intel_stolen_funcs gen3_stolen_funcs = { + .base = intel_stolen_base, + .size = gen3_stolen_size, +}; + +static const struct intel_stolen_funcs gen6_stolen_funcs = { + .base = intel_stolen_base, + .size = gen6_stolen_size, +}; + +static const struct intel_stolen_funcs gen8_stolen_funcs = { + .base = intel_stolen_base, + .size = gen8_stolen_size, +};static struct pci_device_id intel_stolen_ids[]__initdata = { -INTEL_I915G_IDS (gen3_stolen_size), -INTEL_I915GM_IDS (gen3_stolen_size), -INTEL_I945G_IDS (gen3_stolen_size), -INTEL_I945GM_IDS (gen3_stolen_size), -INTEL_VLV_M_IDS (gen6_stolen_size), -INTEL_VLV_D_IDS (gen6_stolen_size), -INTEL_PINEVIEW_IDS (gen3_stolen_size), -INTEL_I965G_IDS (gen3_stolen_size), -INTEL_G33_IDS (gen3_stolen_size), -INTEL_I965GM_IDS (gen3_stolen_size), -INTEL_GM45_IDS (gen3_stolen_size), -INTEL_G45_IDS (gen3_stolen_size), -INTEL_IRONLAKE_D_IDS (gen3_stolen_size), -INTEL_IRONLAKE_M_IDS (gen3_stolen_size), -INTEL_SNB_D_IDS (gen6_stolen_size), -INTEL_SNB_M_IDS (gen6_stolen_size), -INTEL_IVB_M_IDS (gen6_stolen_size), -INTEL_IVB_D_IDS (gen6_stolen_size), -INTEL_HSW_D_IDS (gen6_stolen_size), -INTEL_HSW_M_IDS (gen6_stolen_size), -INTEL_BDW_M_IDS (gen8_stolen_size), -INTEL_BDW_D_IDS (gen8_stolen_size) +INTEL_I915G_IDS (&gen3_stolen_funcs), +INTEL_I915GM_IDS (&gen3_stolen_funcs), +INTEL_I945G_IDS (&gen3_stolen_funcs), +INTEL_I945GM_IDS (&gen3_stolen_funcs), +INTEL_VLV_M_IDS (&gen6_stolen_funcs), +INTEL_VLV_D_IDS (&gen6_stolen_funcs), +INTEL_PINEVIEW_IDS (&gen3_stolen_funcs), +INTEL_I965G_IDS (&gen3_stolen_funcs), +INTEL_G33_IDS (&gen3_stolen_funcs), +INTEL_I965GM_IDS (&gen3_stolen_funcs), +INTEL_GM45_IDS (&gen3_stolen_funcs), +INTEL_G45_IDS (&gen3_stolen_funcs), +INTEL_IRONLAKE_D_IDS (&gen3_stolen_funcs), +INTEL_IRONLAKE_M_IDS (&gen3_stolen_funcs), +INTEL_SNB_D_IDS (&gen6_stolen_funcs), +INTEL_SNB_M_IDS (&gen6_stolen_funcs), +INTEL_IVB_M_IDS (&gen6_stolen_funcs), +INTEL_IVB_D_IDS (&gen6_stolen_funcs), +INTEL_HSW_D_IDS (&gen6_stolen_funcs), +INTEL_HSW_M_IDS (&gen6_stolen_funcs), +INTEL_BDW_M_IDS (&gen8_stolen_funcs), +INTEL_BDW_D_IDS (&gen8_stolen_funcs) };static void __init intel_graphics_stolen (int num,int slot,int func)
@@ -364,10 +383,10 @@ static void __init intel_graphics_stolen(int num, int slot, int func)for (i =0 ; i <ARRAY_SIZE (intel_stolen_ids); i++) {if (intel_stolen_ids[i].device == device) { -stolen_size_fn stolen_size = - (stolen_size_fn )intel_stolen_ids[i].driver_data; - size =stolen_size (num, slot, func); - start =intel_stolen_base (num, slot, func); +const struct intel_stolen_funcs *stolen_funcs = + (const struct intel_stolen_funcs *)intel_stolen_ids[i].driver_data; + size = stolen_funcs->size (num, slot, func); + start = stolen_funcs->base (num, slot, func, size);if (size && start) {/* Mark this space as reserved */ e820_add_region (start, size,E820_RESERVED );
PATCH 3/3 x86: Print the Intel graphics stolen memory range
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Print an informative message when reserving the graphics stolen memory region in the early quirk.
--- arch/x86/kernel/early-quirks.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/early-quirks.c +2 -0
@@ -520,6 +520,8 @@ static void __init intel_graphics_stolen(int num, int slot, int func) size = stolen_funcs->size (num, slot, func); start = stolen_funcs->base (num, slot, func, size);if (size && start) { +printk (KERN_INFO "Reserving Intel graphics stolen memory at 0x%x-0x%x\n" , + start, start + (u32 )size -1 );/* Mark this space as reserved */ e820_add_region (start, size,E820_RESERVED ); sanitize_e820_map(e820.map,
Signature · 1 line
1.8.3.2
tip-bot for Ville Syrjälä
merge bot[tip:x86/platform] x86/gpu: Print the Intel graphics stolen memory range
x86/gpu: Print the Intel graphics stolen memory range
Commit-ID: c71ef7b3c3be3337deaf1eb28dd26e0d5d4b4aa7 Gitweb: http://git.kernel.org/tip/c71ef7b3c3be3337deaf1eb28dd26e0d5d4b4aa7 Author: Ville Syrjälä <[email protected]> AuthorDate: Wed, 5 Feb 2014 21:29:00 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 9 Feb 2014 15:11:31 +0100
x86/gpu: Print the Intel graphics stolen memory range
Print an informative message when reserving the graphics stolen memory region in the early quirk.
--- arch/x86/kernel/early-quirks.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kernel/early-quirks.c +2 -0
@@ -520,6 +520,8 @@ static void __init intel_graphics_stolen(int num, int slot, int func) size = stolen_funcs->size (num, slot, func); start = stolen_funcs->base (num, slot, func, size);if (size && start) { +printk (KERN_INFO "Reserving Intel graphics stolen memory at 0x%x-0x%x\n" , + start, start + (u32 )size -1 );/* Mark this space as reserved */ e820_add_region (start, size,E820_RESERVED ); sanitize_e820_map(e820.map,