x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
PATCH 1/1 x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
In preparation for upcoming SKUs, allow more freedom in placement of the Intel graphics stolen memory by BIOS to full 64bit range.
--- arch/x86/kernel/early-quirks.c | 75 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-)
arch/x86/kernel/early-quirks.c +38 -37
@@ -243,7 +243,7 @@ static void __init intel_remapping_check(int num, int slot, int func)#define KB (x) ((x) * 1024UL)#define MB (x) (KB (KB (x))) -static size_t __init i830_tseg_size (void ) +static resource_size_t __init i830_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I830_ESMRAMC );
@@ -256,7 +256,7 @@ static size_t __init i830_tseg_size(void)return KB (512 ); } -static size_t __init i845_tseg_size (void ) +static resource_size_t __init i845_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I845_ESMRAMC );u8 tseg_size = esmramc &I845_TSEG_SIZE_MASK ;
@@ -273,7 +273,7 @@ static size_t __init i845_tseg_size(void)return 0 ; } -static size_t __init i85x_tseg_size (void ) +static resource_size_t __init i85x_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I85X_ESMRAMC );
@@ -283,12 +283,12 @@ static size_t __init i85x_tseg_size(void)return MB (1 ); } -static size_t __init i830_mem_size (void ) +static resource_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 ) +static resource_size_t __init i85x_mem_size (void ) {return read_pci_config_byte (0 ,0 ,1 ,I85X_DRB3 ) *MB (32 ); }
@@ -297,36 +297,36 @@ static size_t __init i85x_mem_size(void)* 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 phys_addr_t __init i830_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i830_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i830_mem_size () -i830_tseg_size () - stolen_size; +return i830_mem_size () -i830_tseg_size () - stolen_size; } -static phys_addr_t __init i845_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i845_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i830_mem_size () -i845_tseg_size () - stolen_size; +return i830_mem_size () -i845_tseg_size () - stolen_size; } -static phys_addr_t __init i85x_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i85x_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i85x_mem_size () -i85x_tseg_size () - stolen_size; +return i85x_mem_size () -i85x_tseg_size () - stolen_size; } -static phys_addr_t __init i865_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i865_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) {u16 toud =0 ; toud =read_pci_config_16 (0 ,0 ,0 ,I865_TOUD ); -return (phys_addr_t)(toud <<16 ) +i845_tseg_size (); +return (toud <<16 ) +i845_tseg_size (); } -static phys_addr_t __init gen3_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init gen3_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) {u32 bsm;
@@ -337,10 +337,10 @@ static phys_addr_t __init gen3_stolen_base(int num, int slot, int func,*/ bsm =read_pci_config (num, slot, func,INTEL_BSM ); -return (phys_addr_t )bsm &INTEL_BSM_MASK ; +return bsm &INTEL_BSM_MASK ; } -static size_t __init i830_stolen_size (int num,int slot,int func) +static resource_size_t __init i830_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -361,7 +361,7 @@ static size_t __init i830_stolen_size(int num, int slot, int func)return 0 ; } -static size_t __init gen3_stolen_size (int num,int slot,int func) +static resource_size_t __init gen3_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -390,7 +390,7 @@ static size_t __init gen3_stolen_size(int num, int slot, int func)return 0 ; } -static size_t __init gen6_stolen_size (int num,int slot,int func) +static resource_size_t __init gen6_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -398,10 +398,10 @@ static size_t __init gen6_stolen_size(int num, int slot, int func) gmch_ctrl =read_pci_config_16 (num, slot, func,SNB_GMCH_CTRL ); gms = (gmch_ctrl >>SNB_GMCH_GMS_SHIFT ) &SNB_GMCH_GMS_MASK ; -return (size_t )gms *MB (32 ); +return gms *MB (32 ); } -static size_t __init gen8_stolen_size (int num,int slot,int func) +static resource_size_t __init gen8_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -409,10 +409,10 @@ static size_t __init gen8_stolen_size(int num, int slot, int func) gmch_ctrl =read_pci_config_16 (num, slot, func,SNB_GMCH_CTRL ); gms = (gmch_ctrl >>BDW_GMCH_GMS_SHIFT ) &BDW_GMCH_GMS_MASK ; -return (size_t )gms *MB (32 ); +return gms *MB (32 ); } -static size_t __init chv_stolen_size (int num,int slot,int func) +static resource_size_t __init chv_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -426,14 +426,14 @@ static size_t __init chv_stolen_size(int num, int slot, int func)* 0x17 to 0x1d: 4MB increments start at 36MB */ if (gms <0x11 ) -return (size_t )gms *MB (32 ); +return gms *MB (32 );else if (gms <0x17 ) -return (size_t )(gms -0x11 +2 ) *MB (4 ); +return (gms -0x11 +2 ) *MB (4 );else -return (size_t )(gms -0x17 +9 ) *MB (4 ); +return (gms -0x17 +9 ) *MB (4 ); } -static size_t __init gen9_stolen_size (int num,int slot,int func) +static resource_size_t __init gen9_stolen_size (int num,int slot,int func) {u16 gmch_ctrl;u16 gms;
@@ -444,14 +444,15 @@ static size_t __init gen9_stolen_size(int num, int slot, int func)/* 0x0 to 0xef: 32MB increments starting at 0MB */ /* 0xf0 to 0xfe: 4MB increments starting at 4MB */ if (gms <0xf0 ) -return (size_t )gms *MB (32 ); +return gms *MB (32 );else -return (size_t )(gms -0xf0 +1 ) *MB (4 ); +return (gms -0xf0 +1 ) *MB (4 ); }struct intel_early_ops { -size_t (*stolen_size)(int num,int slot,int func); -phys_addr_t (*stolen_base)(int num,int slot,int func,size_t size); +resource_size_t (*stolen_size)(int num,int slot,int func); +resource_size_t (*stolen_base)(int num,int slot,int func, +resource_size_t size); };static const struct intel_early_ops i830_early_ops__initconst = {
@@ -535,8 +536,8 @@ static void __init intel_graphics_stolen(int num, int slot, int func, const struct intel_early_ops *early_ops) { - phys_addr_t base, end; -size_t size; + resource_size_t base, size; +resource_size_t end; size = early_ops->stolen_size (num, slot, func); base = early_ops->stolen_base (num, slot, func, size);
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Joonas Lahtinen
In preparation for upcoming SKUs, allow more freedom in placement of the Intel graphics stolen memory by BIOS to full 64bit range.
Signed-off-by Joonas Lahtinen <[email protected]>Cc Matthew Auld <[email protected]>Cc Chris Wilson <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>
Quoted 3 lines
--- arch/x86/kernel/early-quirks.c | 75 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-)
So I'm wondering how this interacts with:
drm/i915: export the stolen region as a resource
?
Thanks,
Ingo
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Ingo Molnar
Quoted 10 lines · Joonas Lahtinen
In preparation for upcoming SKUs, allow more freedom in placement of the Intel graphics stolen memory by BIOS to full 64bit range.
Signed-off-by Joonas Lahtinen <[email protected]>Cc Matthew Auld <[email protected]>Cc Chris Wilson <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>Quoted 3 lines
--- arch/x86/kernel/early-quirks.c | 75 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-)
Quoted 3 lines
So I'm wondering how this interacts with:
drm/i915: export the stolen region as a resource
I replied in the other mail thread. My suggestion is to squash the early-quirks portion of that other patch here for a clean split, then we can iterate purely on the i915 as necessary.
Sorry for confusion :)
Regards, Joonas
Signature · 7 lines
Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
In reply to Joonas Lahtinen== Series Details ==
== Series Details ==
Series: x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
URL : https://patchwork.freedesktop.org/series/34342/
State : warning
== Summary ==
Series 34342v1 x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
https://patchwork.freedesktop.org/api/1.0/series/34342/revisions/1/mbox/
Test kms_force_connector_basic:
Subgroup prune-stale-modes:
pass -> SKIP (fi-snb-2600)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-c:
incomplete -> PASS (fi-cfl-s2) fdo#103878fdo#103878 https://bugs.freedesktop.org/show_bug.cgi?id=103878
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:449s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:463s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:382s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:548s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:278s fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:507s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:501s fi-byt-j1900 total:289 pass:254 dwarn:0 dfail:0 fail:0 skip:35 time:507s fi-byt-n2820 total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:491s fi-cfl-s2 total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:604s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:427s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:270s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:541s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:431s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:436s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:432s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:491s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:464s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:589s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:454s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:547s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:566s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:522s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:495s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:464s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:568s fi-snb-2600 total:289 pass:248 dwarn:0 dfail:0 fail:0 skip:41 time:432s Blacklisted hosts: fi-cnl-y total:245 pass:220 dwarn:0 dfail:0 fail:0 skip:24 fi-glk-dsi total:289 pass:258 dwarn:1 dfail:0 fail:0 skip:30 time:501s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:486s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:528s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:478s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:535s
b407e5f38397c0c22b5056a1664753287993b152 drm-tip: 2017y-11m-23d-16h-14m-59s UTC integration manifest c4c774243f36 x86/early-quirks: Extend Intel graphics stolen memory placement to 64bit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_7272/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Joonas Lahtinen (2017-11-24 07:30:17)
Quoted 92 lines
In preparation for upcoming SKUs, allow more freedom in placement of the Intel graphics stolen memory by BIOS to full 64bit range.
Signed-off-by Joonas Lahtinen <[email protected]>Cc Matthew Auld <[email protected]>Cc Chris Wilson <[email protected]>Cc Paulo Zanoni <[email protected]>Cc Ingo Molnar <[email protected]>Cc H. Peter Anvin <[email protected]>--- arch/x86/kernel/early-quirks.c | 75 +++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 37 deletions(-)arch/x86/kernel/early-quirks.c +14
-15@@ -243,7 +243,7 @@ static void __init intel_remapping_check(int num, int slot, int func)#define KB (x) ((x) * 1024UL)#define MB (x) (KB (KB (x))) -static size_t __init i830_tseg_size (void ) +static resource_size_t __init i830_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I830_ESMRAMC );@@ -256,7 +256,7 @@ static size_t __init i830_tseg_size(void)return KB (512 ); } -static size_t __init i845_tseg_size (void ) +static resource_size_t __init i845_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I845_ESMRAMC );u8 tseg_size = esmramc &I845_TSEG_SIZE_MASK ;@@ -273,7 +273,7 @@ static size_t __init i845_tseg_size(void)return 0 ; } -static size_t __init i85x_tseg_size (void ) +static resource_size_t __init i85x_tseg_size (void ) {u8 esmramc =read_pci_config_byte (0 ,0 ,0 ,I85X_ESMRAMC );@@ -283,12 +283,12 @@ static size_t __init i85x_tseg_size(void)return MB (1 ); } -static size_t __init i830_mem_size (void ) +static resource_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 ) +static resource_size_t __init i85x_mem_size (void ) {return read_pci_config_byte (0 ,0 ,1 ,I85X_DRB3 ) *MB (32 ); }@@ -297,36 +297,36 @@ static size_t __init i85x_mem_size(void)* 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 phys_addr_t __init i830_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i830_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i830_mem_size () -i830_tseg_size () - stolen_size; +return i830_mem_size () -i830_tseg_size () - stolen_size; } -static phys_addr_t __init i845_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i845_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i830_mem_size () -i845_tseg_size () - stolen_size; +return i830_mem_size () -i845_tseg_size () - stolen_size; } -static phys_addr_t __init i85x_stolen_base (int num,int slot,int func, -size_t stolen_size) +static resource_size_t __init i85x_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) { -return (phys_addr_t )i85x_mem_size () -i85x_tseg_size () - stolen_size; +return i85x_mem_size () -i85x_tseg_size () - stolen_size; } -static phys_addr_t __init i865_stolen_base(int num, int slot, int func,
arch/x86/kernel/early-quirks.c static size_t __init i85x_mem_size(void) · line 325
Quoted 10 lines
arch/x86/kernel/early-quirks.c +3
-2- size_t stolen_size) +static resource_size_t __init i865_stolen_base (int num,int slot,int func, +resource_size_t stolen_size) {u16 toud =0 ; toud =read_pci_config_16 (0 ,0 ,0 ,I865_TOUD ); -return (phys_addr_t)(toud <<16 ) +i845_tseg_size (); +return (toud <<16 ) +i845_tseg_size ();
Uh oh, this is a u16 << 16, that's not going to work. (We have the same bug in i915.ko, so you do get a told you so on the merits of bug duplication.)
All the other cases are u16 * UL, which should be promoted to UL prior to the calculation and so be safe.
Other than it looks fine,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
arch/x86/kernel/early-quirks.c static size_t __init chv_stolen_size(int num, int slot, int func) · line 433
Quoted 12 lines · Joonas Lahtinen
arch/x86/kernel/early-quirks.c +3
-3@@ -426,14 +426,14 @@ static size_t __init chv_stolen_size(int num, int slot, int func)* 0x17 to 0x1d: 4MB increments start at 36MB */ if (gms <0x11 ) -return (size_t )gms *MB (32 ); +return gms *MB (32 );else if (gms <0x17 ) -return (size_t )(gms -0x11 +2 ) *MB (4 ); +return (gms -0x11 +2 ) *MB (4 );else -return (size_t )(gms -0x17 +9 ) *MB (4 ); +return (gms -0x17 +9 ) *MB (4 );
Unrelated random idea: Maybe someone could replace the semi-magic looking +2,+9 etc. with just +MB(whatever)?
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx