All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support
@ 2018-05-03  0:23 Paulo Zanoni
  2018-05-03  0:52 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 25+ messages in thread
From: Paulo Zanoni @ 2018-05-03  0:23 UTC (permalink / raw)
  To: intel-gfx; +Cc: x86, H . Peter Anvin, Paulo Zanoni, Ingo Molnar

ICL changes the registers and addresses to 64 bits.

I also briefly looked at implementing an u64 version of the PCI config
read functions, but I concluded this wouldn't be trivial, so it's not
worth doing it for a single user that can't have any racing problems
while reading the register in two separate operations.

v2:
  - Adjust the patch after the i915_stolen_to_dma() changes.
  - Remove unused variable (Daniele).
  - Update commit message.
v3:
  - Fix a missing phys_addr_t->dma_addr_t forgotten in v2 (kbuild bot)
v4:
  - Rebase.
v5:
  - Fix warnings in arch/x86/kernel/early-quirks.c after rebase.
v6:
 - No more TODO list.
 - Stay under 80 columns.
 - Add debug message to match the other functions.

Issue: VIZ-9250
Cc: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> # Early review, needs re-check before merging
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 arch/x86/kernel/early-quirks.c         | 18 ++++++++++++++++
 drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h        |  1 +
 include/drm/i915_drm.h                 |  4 +++-
 4 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bae0d32e327b..96228bac1c8c 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
 	return bsm & INTEL_BSM_MASK;
 }
 
+static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
+						 resource_size_t stolen_size)
+{
+	u64 bsm;
+
+	bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0);
+	bsm &= INTEL_BSM_MASK;
+	bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32;
+
+	return (resource_size_t)bsm;
+}
+
 static resource_size_t __init i830_stolen_size(int num, int slot, int func)
 {
 	u16 gmch_ctrl;
@@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = {
 	.stolen_size = chv_stolen_size,
 };
 
+static const struct intel_early_ops gen11_early_ops __initconst = {
+	.stolen_base = gen11_stolen_base,
+	.stolen_size = gen9_stolen_size,
+};
+
 static const struct pci_device_id intel_early_ids[] __initconst = {
 	INTEL_I830_IDS(&i830_early_ops),
 	INTEL_I845G_IDS(&i845_early_ops),
@@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
 	INTEL_CFL_IDS(&gen9_early_ops),
 	INTEL_GLK_IDS(&gen9_early_ops),
 	INTEL_CNL_IDS(&gen9_early_ops),
+	INTEL_ICL_11_IDS(&gen11_early_ops),
 };
 
 struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0);
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index ad949cc30928..ede432f6891c 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
 	*size = stolen_top - *base;
 }
 
+static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv,
+				    resource_size_t *base,
+				    resource_size_t *size)
+{
+	uint64_t reg_val = I915_READ64(GEN6_STOLEN_RESERVED);
+
+	DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val);
+
+	*base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK;
+
+	switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
+	case GEN8_STOLEN_RESERVED_1M:
+		*size = 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_2M:
+		*size = 2 * 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_4M:
+		*size = 4 * 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_8M:
+		*size = 8 * 1024 * 1024;
+		break;
+	default:
+		*size = 8 * 1024 * 1024;
+		MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
+	}
+}
+
 int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 {
 	resource_size_t reserved_base, stolen_top;
@@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 			gen7_get_stolen_reserved(dev_priv,
 						 &reserved_base, &reserved_size);
 		break;
-	default:
+	case 8:
+	case 9:
+	case 10:
 		if (IS_LP(dev_priv))
 			chv_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
@@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 			bdw_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
 		break;
+	case 11:
+	default:
+		icl_get_stolen_reserved(dev_priv, &reserved_base,
+					&reserved_size);
+		break;
 	}
 
 	/*
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 085928c9005e..859d8c697123 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -395,6 +395,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define GEN8_STOLEN_RESERVED_4M		(2 << 7)
 #define GEN8_STOLEN_RESERVED_8M		(3 << 7)
 #define GEN6_STOLEN_RESERVED_ENABLE	(1 << 0)
+#define GEN11_STOLEN_RESERVED_ADDR_MASK	(0xFFFFFFFFFFFULL << 20)
 
 /* VGA stuff */
 
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index c9e5a6621b95..c44703f471b3 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
 #define    I845_TSEG_SIZE_512K	(2 << 1)
 #define    I845_TSEG_SIZE_1M	(3 << 1)
 
-#define INTEL_BSM 0x5c
+#define INTEL_BSM		0x5c
+#define INTEL_GEN11_BSM_DW0	0xc0
+#define INTEL_GEN11_BSM_DW1	0xc4
 #define   INTEL_BSM_MASK	(-(1u << 20))
 
 #endif				/* _I915_DRM_H_ */
-- 
2.14.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
@ 2018-05-03  0:52 ` Patchwork
  2018-05-03  1:06 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2018-05-03  0:52 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/icl, x86/gpu: implement ICL stolen memory support
URL   : https://patchwork.freedesktop.org/series/42607/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6b63a3791d11 drm/i915/icl, x86/gpu: implement ICL stolen memory support
-:33: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#33: 
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> # Early review, needs re-check before merging

-:45: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis
#45: FILE: arch/x86/kernel/early-quirks.c:344:
+static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
+						 resource_size_t stolen_size)

total: 0 errors, 1 warnings, 1 checks, 109 lines checked

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
  2018-05-03  0:52 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
@ 2018-05-03  1:06 ` Patchwork
  2018-05-03  9:59 ` [PATCH] " Joonas Lahtinen
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2018-05-03  1:06 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/icl, x86/gpu: implement ICL stolen memory support
URL   : https://patchwork.freedesktop.org/series/42607/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4126 -> Patchwork_8891 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42607/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8891 that come from known issues:

  === IGT changes ===

    ==== Possible fixes ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-peppy:       DMESG-FAIL -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-ivb-3520m:       DMESG-WARN (fdo#106084) -> PASS

    
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084


== Participating hosts (40 -> 37) ==

  Missing    (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq 


== Build changes ==

    * Linux: CI_DRM_4126 -> Patchwork_8891

  CI_DRM_4126: c49cbe0d1eb8d4c0ad477b8c7fdc5fbd82617674 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4457: 43761534c6482dc67b9c3d8eeecd425ef40b3c4c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8891: 6b63a3791d11630a9de53aac5bd2da623c87d4ac @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4457: 69a0d9192f52570211df74a12265c5d2b0721542 @ git://anongit.freedesktop.org/piglit


== Linux commits ==

6b63a3791d11 drm/i915/icl, x86/gpu: implement ICL stolen memory support

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8891/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
  2018-05-03  0:52 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
  2018-05-03  1:06 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-05-03  9:59 ` Joonas Lahtinen
  2018-05-03 15:24   ` Paulo Zanoni
  2018-05-03 10:18 ` ✓ Fi.CI.IGT: success for " Patchwork
  2018-05-04 20:32 ` [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory Paulo Zanoni
  4 siblings, 1 reply; 25+ messages in thread
From: Joonas Lahtinen @ 2018-05-03  9:59 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ingo Molnar, x86, Paulo Zanoni, H . Peter Anvin

Quoting Paulo Zanoni (2018-05-03 03:23:52)
> ICL changes the registers and addresses to 64 bits.
> 
> I also briefly looked at implementing an u64 version of the PCI config
> read functions, but I concluded this wouldn't be trivial, so it's not
> worth doing it for a single user that can't have any racing problems
> while reading the register in two separate operations.
> 
> v2:
>   - Adjust the patch after the i915_stolen_to_dma() changes.
>   - Remove unused variable (Daniele).
>   - Update commit message.
> v3:
>   - Fix a missing phys_addr_t->dma_addr_t forgotten in v2 (kbuild bot)
> v4:
>   - Rebase.
> v5:
>   - Fix warnings in arch/x86/kernel/early-quirks.c after rebase.
> v6:
>  - No more TODO list.
>  - Stay under 80 columns.
>  - Add debug message to match the other functions.

This will only confuse most readers, so please do scrub the internal
changelog when sending the first revision on a mailing list.

> Issue: VIZ-9250
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> # Early review, needs re-check before merging
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  arch/x86/kernel/early-quirks.c         | 18 ++++++++++++++++
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h        |  1 +
>  include/drm/i915_drm.h                 |  4 +++-
>  4 files changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index bae0d32e327b..96228bac1c8c 100644
> --- a/arch/x86/kernel/early-quirks.c
> +++ b/arch/x86/kernel/early-quirks.c
> @@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
>         return bsm & INTEL_BSM_MASK;
>  }
>  
> +static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
> +                                                resource_size_t stolen_size)
> +{
> +       u64 bsm;
> +
> +       bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0);
> +       bsm &= INTEL_BSM_MASK;
> +       bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32;
> +
> +       return (resource_size_t)bsm;

return bsm; will suffice.

> +}
> +
>  static resource_size_t __init i830_stolen_size(int num, int slot, int func)
>  {
>         u16 gmch_ctrl;
> @@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = {
>         .stolen_size = chv_stolen_size,
>  };
>  
> +static const struct intel_early_ops gen11_early_ops __initconst = {
> +       .stolen_base = gen11_stolen_base,
> +       .stolen_size = gen9_stolen_size,
> +};
> +
>  static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_I830_IDS(&i830_early_ops),
>         INTEL_I845G_IDS(&i845_early_ops),
> @@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_CFL_IDS(&gen9_early_ops),
>         INTEL_GLK_IDS(&gen9_early_ops),
>         INTEL_CNL_IDS(&gen9_early_ops),
> +       INTEL_ICL_11_IDS(&gen11_early_ops),
>  };

Please split the patch here and add a respective Fixes: tag to when
base Icelake support was introduced. Lacking this portion when running ICL will
cause random memory corruption so it's important to have this landed
early.

Regards, Joonas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* ✓ Fi.CI.IGT: success for drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
                   ` (2 preceding siblings ...)
  2018-05-03  9:59 ` [PATCH] " Joonas Lahtinen
@ 2018-05-03 10:18 ` Patchwork
  2018-05-04 20:32 ` [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory Paulo Zanoni
  4 siblings, 0 replies; 25+ messages in thread
From: Patchwork @ 2018-05-03 10:18 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/icl, x86/gpu: implement ICL stolen memory support
URL   : https://patchwork.freedesktop.org/series/42607/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4126_full -> Patchwork_8891_full =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42607/revisions/1/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8891_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-pwrite:
      shard-apl:          PASS -> FAIL (fdo#103167)

    
    ==== Possible fixes ====

    igt@kms_flip@flip-vs-absolute-wf_vblank:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_flip@flip-vs-absolute-wf_vblank-interruptible:
      shard-hsw:          FAIL (fdo#103928) -> PASS

    igt@kms_flip@modeset-vs-vblank-race:
      shard-hsw:          FAIL (fdo#103060) -> PASS

    igt@kms_rotation_crc@sprite-rotation-270:
      shard-apl:          FAIL (fdo#103925) -> PASS +1

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928


== Participating hosts (8 -> 7) ==

  Missing    (1): shard-kbl 


== Build changes ==

    * Linux: CI_DRM_4126 -> Patchwork_8891

  CI_DRM_4126: c49cbe0d1eb8d4c0ad477b8c7fdc5fbd82617674 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4457: 43761534c6482dc67b9c3d8eeecd425ef40b3c4c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8891: 6b63a3791d11630a9de53aac5bd2da623c87d4ac @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4457: 69a0d9192f52570211df74a12265c5d2b0721542 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8891/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03  9:59 ` [PATCH] " Joonas Lahtinen
@ 2018-05-03 15:24   ` Paulo Zanoni
  2018-05-03 15:35     ` Chris Wilson
  0 siblings, 1 reply; 25+ messages in thread
From: Paulo Zanoni @ 2018-05-03 15:24 UTC (permalink / raw)
  To: Joonas Lahtinen, intel-gfx; +Cc: x86, Ingo Molnar, H . Peter Anvin

Em Qui, 2018-05-03 às 12:59 +0300, Joonas Lahtinen escreveu:
> Quoting Paulo Zanoni (2018-05-03 03:23:52)
> > ICL changes the registers and addresses to 64 bits.
> > 
> > I also briefly looked at implementing an u64 version of the PCI
> > config
> > read functions, but I concluded this wouldn't be trivial, so it's
> > not
> > worth doing it for a single user that can't have any racing
> > problems
> > while reading the register in two separate operations.
> > 
> > v2:
> >   - Adjust the patch after the i915_stolen_to_dma() changes.
> >   - Remove unused variable (Daniele).
> >   - Update commit message.
> > v3:
> >   - Fix a missing phys_addr_t->dma_addr_t forgotten in v2 (kbuild
> > bot)
> > v4:
> >   - Rebase.
> > v5:
> >   - Fix warnings in arch/x86/kernel/early-quirks.c after rebase.
> > v6:
> >  - No more TODO list.
> >  - Stay under 80 columns.
> >  - Add debug message to match the other functions.
> 
> This will only confuse most readers, so please do scrub the internal
> changelog when sending the first revision on a mailing list.

We've been doing this for years, why did our opinion change today?


> 
> > Issue: VIZ-9250
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Cc: x86@kernel.org
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.co
> > m> # Early review, needs re-check before merging
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  arch/x86/kernel/early-quirks.c         | 18 ++++++++++++++++
> >  drivers/gpu/drm/i915/i915_gem_stolen.c | 38
> > +++++++++++++++++++++++++++++++++-
> >  drivers/gpu/drm/i915/i915_reg.h        |  1 +
> >  include/drm/i915_drm.h                 |  4 +++-
> >  4 files changed, 59 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/early-quirks.c
> > b/arch/x86/kernel/early-quirks.c
> > index bae0d32e327b..96228bac1c8c 100644
> > --- a/arch/x86/kernel/early-quirks.c
> > +++ b/arch/x86/kernel/early-quirks.c
> > @@ -340,6 +340,18 @@ static resource_size_t __init
> > gen3_stolen_base(int num, int slot, int func,
> >         return bsm & INTEL_BSM_MASK;
> >  }
> >  
> > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > int func,
> > +                                                resource_size_t
> > stolen_size)
> > +{
> > +       u64 bsm;
> > +
> > +       bsm = read_pci_config(num, slot, func,
> > INTEL_GEN11_BSM_DW0);
> > +       bsm &= INTEL_BSM_MASK;
> > +       bsm |= (u64)read_pci_config(num, slot, func,
> > INTEL_GEN11_BSM_DW1) << 32;
> > +
> > +       return (resource_size_t)bsm;
> 
> return bsm; will suffice.
> 
> > +}
> > +
> >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > int func)
> >  {
> >         u16 gmch_ctrl;
> > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > chv_early_ops __initconst = {
> >         .stolen_size = chv_stolen_size,
> >  };
> >  
> > +static const struct intel_early_ops gen11_early_ops __initconst =
> > {
> > +       .stolen_base = gen11_stolen_base,
> > +       .stolen_size = gen9_stolen_size,
> > +};
> > +
> >  static const struct pci_device_id intel_early_ids[] __initconst =
> > {
> >         INTEL_I830_IDS(&i830_early_ops),
> >         INTEL_I845G_IDS(&i845_early_ops),
> > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > intel_early_ids[] __initconst = {
> >         INTEL_CFL_IDS(&gen9_early_ops),
> >         INTEL_GLK_IDS(&gen9_early_ops),
> >         INTEL_CNL_IDS(&gen9_early_ops),
> > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> >  };
> 
> Please split the patch here and add a respective Fixes: tag to when
> base Icelake support was introduced. Lacking this portion when
> running ICL will
> cause random memory corruption so it's important to have this landed
> early.

Icelake is still hidden behind the alpha_support flag, so no point in
backporting for i915.ko specifically. If we're talking about
backporting just because of the memory reservation without graphics,
how far back should we go?

> 
> Regards, Joonas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03 15:24   ` Paulo Zanoni
@ 2018-05-03 15:35     ` Chris Wilson
  2018-05-03 16:28       ` Joonas Lahtinen
  0 siblings, 1 reply; 25+ messages in thread
From: Chris Wilson @ 2018-05-03 15:35 UTC (permalink / raw)
  To: Paulo Zanoni, Joonas Lahtinen, intel-gfx
  Cc: x86, Ingo Molnar, H . Peter Anvin

Quoting Paulo Zanoni (2018-05-03 16:24:47)
> Em Qui, 2018-05-03 às 12:59 +0300, Joonas Lahtinen escreveu:
> > Please split the patch here and add a respective Fixes: tag to when
> > base Icelake support was introduced. Lacking this portion when
> > running ICL will
> > cause random memory corruption so it's important to have this landed
> > early.
> 
> Icelake is still hidden behind the alpha_support flag, so no point in
> backporting for i915.ko specifically. If we're talking about
> backporting just because of the memory reservation without graphics,
> how far back should we go?

The danger for the reserved portion is that it is used by the bios/uefi
scanout and vgacon. So if the gfx reserved portion is absent from the
820 memmap (buggy bios or whatever), then it may be reused by the system
even though it's been written to by the console (and unrelated to
i915.ko). That's where the danger comes from, it's happened before so we
fear it may happen again.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support
  2018-05-03 15:35     ` Chris Wilson
@ 2018-05-03 16:28       ` Joonas Lahtinen
  0 siblings, 0 replies; 25+ messages in thread
From: Joonas Lahtinen @ 2018-05-03 16:28 UTC (permalink / raw)
  To: Chris Wilson, Paulo Zanoni, intel-gfx; +Cc: x86, Ingo Molnar, H . Peter Anvin

Quoting Chris Wilson (2018-05-03 18:35:48)
> Quoting Paulo Zanoni (2018-05-03 16:24:47)
> > Em Qui, 2018-05-03 às 12:59 +0300, Joonas Lahtinen escreveu:
> > > Please split the patch here and add a respective Fixes: tag to when
> > > base Icelake support was introduced. Lacking this portion when
> > > running ICL will
> > > cause random memory corruption so it's important to have this landed
> > > early.
> > 
> > Icelake is still hidden behind the alpha_support flag, so no point in
> > backporting for i915.ko specifically. If we're talking about
> > backporting just because of the memory reservation without graphics,
> > how far back should we go?
> 
> The danger for the reserved portion is that it is used by the bios/uefi
> scanout and vgacon. So if the gfx reserved portion is absent from the
> 820 memmap (buggy bios or whatever), then it may be reused by the system
> even though it's been written to by the console (and unrelated to
> i915.ko). That's where the danger comes from, it's happened before so we
> fear it may happen again.

Yep,

This same discussion was had for Cannonlake; alpha_support protection
is not enough to justify system level memory corruption which has
nothing to do with i915 module but all to do with enforcing e820 memory
maps not to include with the BIOS framebuffer as regular memory.

So this step really should be a separate patch, and should be one of
the first patches to upstream.

Regards, Joonas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
                   ` (3 preceding siblings ...)
  2018-05-03 10:18 ` ✓ Fi.CI.IGT: success for " Patchwork
@ 2018-05-04 20:32 ` Paulo Zanoni
  2018-05-04 20:32   ` [PATCH 2/2] drm/i915: use the ICL " Paulo Zanoni
  2018-05-07  8:46     ` Joonas Lahtinen
  4 siblings, 2 replies; 25+ messages in thread
From: Paulo Zanoni @ 2018-05-04 20:32 UTC (permalink / raw)
  To: intel-gfx
  Cc: Paulo Zanoni, stable, Ingo Molnar, H . Peter Anvin, x86,
	Daniele Ceraolo Spurio, Joonas Lahtinen

ICL changes the registers and addresses to 64 bits.

I also briefly looked at implementing an u64 version of the PCI config
read functions, but I concluded this wouldn't be trivial, so it's not
worth doing it for a single user that can't have any racing problems
while reading the register in two separate operations.

v2:
 - Scrub the development (non-public) changelog (Joonas).
 - Remove the i915.ko bits so this can be easily backported in order
   to properly avoid stolen memory even on machines without i915.ko
   (Joonas).
 - CC stable for the reasons above.

Issue: VIZ-9250
CC: stable@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
 include/drm/i915_drm.h         |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bae0d32e327b..72c2cf961d44 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
 	return bsm & INTEL_BSM_MASK;
 }
 
+static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
+						resource_size_t stolen_size)
+{
+	u64 bsm;
+
+	bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0);
+	bsm &= INTEL_BSM_MASK;
+	bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32;
+
+	return bsm;
+}
+
 static resource_size_t __init i830_stolen_size(int num, int slot, int func)
 {
 	u16 gmch_ctrl;
@@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = {
 	.stolen_size = chv_stolen_size,
 };
 
+static const struct intel_early_ops gen11_early_ops __initconst = {
+	.stolen_base = gen11_stolen_base,
+	.stolen_size = gen9_stolen_size,
+};
+
 static const struct pci_device_id intel_early_ids[] __initconst = {
 	INTEL_I830_IDS(&i830_early_ops),
 	INTEL_I845G_IDS(&i845_early_ops),
@@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
 	INTEL_CFL_IDS(&gen9_early_ops),
 	INTEL_GLK_IDS(&gen9_early_ops),
 	INTEL_CNL_IDS(&gen9_early_ops),
+	INTEL_ICL_11_IDS(&gen11_early_ops),
 };
 
 struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0);
diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
index c9e5a6621b95..c44703f471b3 100644
--- a/include/drm/i915_drm.h
+++ b/include/drm/i915_drm.h
@@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
 #define    I845_TSEG_SIZE_512K	(2 << 1)
 #define    I845_TSEG_SIZE_1M	(3 << 1)
 
-#define INTEL_BSM 0x5c
+#define INTEL_BSM		0x5c
+#define INTEL_GEN11_BSM_DW0	0xc0
+#define INTEL_GEN11_BSM_DW1	0xc4
 #define   INTEL_BSM_MASK	(-(1u << 20))
 
 #endif				/* _I915_DRM_H_ */
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] drm/i915: use the ICL stolen memory
  2018-05-04 20:32 ` [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory Paulo Zanoni
@ 2018-05-04 20:32   ` Paulo Zanoni
  2018-07-07  2:09     ` Lucas De Marchi
  2018-05-07  8:46     ` Joonas Lahtinen
  1 sibling, 1 reply; 25+ messages in thread
From: Paulo Zanoni @ 2018-05-04 20:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: x86, Paulo Zanoni

Now that our stolen memory is already reserved by the x86 subsystem
(since commit "x86/gpu: reserve ICL's graphics stolen memory"), make
use of it.

Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: x86@kernel.org
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h        |  1 +
 2 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index ad949cc30928..99556f0dbedc 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
 	*size = stolen_top - *base;
 }
 
+static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv,
+				    resource_size_t *base,
+				    resource_size_t *size)
+{
+	u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED);
+
+	DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val);
+
+	*base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK;
+
+	switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
+	case GEN8_STOLEN_RESERVED_1M:
+		*size = 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_2M:
+		*size = 2 * 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_4M:
+		*size = 4 * 1024 * 1024;
+		break;
+	case GEN8_STOLEN_RESERVED_8M:
+		*size = 8 * 1024 * 1024;
+		break;
+	default:
+		*size = 8 * 1024 * 1024;
+		MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
+	}
+}
+
 int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 {
 	resource_size_t reserved_base, stolen_top;
@@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 			gen7_get_stolen_reserved(dev_priv,
 						 &reserved_base, &reserved_size);
 		break;
-	default:
+	case 8:
+	case 9:
+	case 10:
 		if (IS_LP(dev_priv))
 			chv_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
@@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 			bdw_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
 		break;
+	case 11:
+	default:
+		icl_get_stolen_reserved(dev_priv, &reserved_base,
+					&reserved_size);
+		break;
 	}
 
 	/*
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 15daf3553d40..c5bc7c808e31 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -398,6 +398,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
 #define GEN8_STOLEN_RESERVED_4M		(2 << 7)
 #define GEN8_STOLEN_RESERVED_8M		(3 << 7)
 #define GEN6_STOLEN_RESERVED_ENABLE	(1 << 0)
+#define GEN11_STOLEN_RESERVED_ADDR_MASK	(0xFFFFFFFFFFFULL << 20)
 
 /* VGA stuff */
 
-- 
2.14.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-05-04 20:32 ` [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory Paulo Zanoni
@ 2018-05-07  8:46     ` Joonas Lahtinen
  2018-05-07  8:46     ` Joonas Lahtinen
  1 sibling, 0 replies; 25+ messages in thread
From: Joonas Lahtinen @ 2018-05-07  8:46 UTC (permalink / raw)
  To: Paulo Zanoni, intel-gfx
  Cc: Paulo Zanoni, stable, Ingo Molnar, H . Peter Anvin, x86,
	Daniele Ceraolo Spurio

Ingo, do you prefer to merge through our tree with your ack?

Quoting Paulo Zanoni (2018-05-04 23:32:51)
> ICL changes the registers and addresses to 64 bits.
> 
> I also briefly looked at implementing an u64 version of the PCI config
> read functions, but I concluded this wouldn't be trivial, so it's not
> worth doing it for a single user that can't have any racing problems
> while reading the register in two separate operations.
> 
> v2:
>  - Scrub the development (non-public) changelog (Joonas).
>  - Remove the i915.ko bits so this can be easily backported in order
>    to properly avoid stolen memory even on machines without i915.ko
>    (Joonas).
>  - CC stable for the reasons above.
> 
> Issue: VIZ-9250

Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake definitions.")

> CC: stable@vger.kernel.org

This should not be needed, it was introduced in v4.17-rc1 only.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas

> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
>  include/drm/i915_drm.h         |  4 +++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index bae0d32e327b..72c2cf961d44 100644
> --- a/arch/x86/kernel/early-quirks.c
> +++ b/arch/x86/kernel/early-quirks.c
> @@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
>         return bsm & INTEL_BSM_MASK;
>  }
>  
> +static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
> +                                               resource_size_t stolen_size)
> +{
> +       u64 bsm;
> +
> +       bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0);
> +       bsm &= INTEL_BSM_MASK;
> +       bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32;
> +
> +       return bsm;
> +}
> +
>  static resource_size_t __init i830_stolen_size(int num, int slot, int func)
>  {
>         u16 gmch_ctrl;
> @@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = {
>         .stolen_size = chv_stolen_size,
>  };
>  
> +static const struct intel_early_ops gen11_early_ops __initconst = {
> +       .stolen_base = gen11_stolen_base,
> +       .stolen_size = gen9_stolen_size,
> +};
> +
>  static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_I830_IDS(&i830_early_ops),
>         INTEL_I845G_IDS(&i845_early_ops),
> @@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_CFL_IDS(&gen9_early_ops),
>         INTEL_GLK_IDS(&gen9_early_ops),
>         INTEL_CNL_IDS(&gen9_early_ops),
> +       INTEL_ICL_11_IDS(&gen11_early_ops),
>  };
>  
>  struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0);
> diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> index c9e5a6621b95..c44703f471b3 100644
> --- a/include/drm/i915_drm.h
> +++ b/include/drm/i915_drm.h
> @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
>  #define    I845_TSEG_SIZE_512K (2 << 1)
>  #define    I845_TSEG_SIZE_1M   (3 << 1)
>  
> -#define INTEL_BSM 0x5c
> +#define INTEL_BSM              0x5c
> +#define INTEL_GEN11_BSM_DW0    0xc0
> +#define INTEL_GEN11_BSM_DW1    0xc4
>  #define   INTEL_BSM_MASK       (-(1u << 20))
>  
>  #endif                         /* _I915_DRM_H_ */
> -- 
> 2.14.3
> 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
@ 2018-05-07  8:46     ` Joonas Lahtinen
  0 siblings, 0 replies; 25+ messages in thread
From: Joonas Lahtinen @ 2018-05-07  8:46 UTC (permalink / raw)
  To: intel-gfx; +Cc: Paulo Zanoni, x86, stable, H . Peter Anvin, Ingo Molnar

Ingo, do you prefer to merge through our tree with your ack?

Quoting Paulo Zanoni (2018-05-04 23:32:51)
> ICL changes the registers and addresses to 64 bits.
> 
> I also briefly looked at implementing an u64 version of the PCI config
> read functions, but I concluded this wouldn't be trivial, so it's not
> worth doing it for a single user that can't have any racing problems
> while reading the register in two separate operations.
> 
> v2:
>  - Scrub the development (non-public) changelog (Joonas).
>  - Remove the i915.ko bits so this can be easily backported in order
>    to properly avoid stolen memory even on machines without i915.ko
>    (Joonas).
>  - CC stable for the reasons above.
> 
> Issue: VIZ-9250

Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake definitions.")

> CC: stable@vger.kernel.org

This should not be needed, it was introduced in v4.17-rc1 only.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas

> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
>  include/drm/i915_drm.h         |  4 +++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
> index bae0d32e327b..72c2cf961d44 100644
> --- a/arch/x86/kernel/early-quirks.c
> +++ b/arch/x86/kernel/early-quirks.c
> @@ -340,6 +340,18 @@ static resource_size_t __init gen3_stolen_base(int num, int slot, int func,
>         return bsm & INTEL_BSM_MASK;
>  }
>  
> +static resource_size_t __init gen11_stolen_base(int num, int slot, int func,
> +                                               resource_size_t stolen_size)
> +{
> +       u64 bsm;
> +
> +       bsm = read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW0);
> +       bsm &= INTEL_BSM_MASK;
> +       bsm |= (u64)read_pci_config(num, slot, func, INTEL_GEN11_BSM_DW1) << 32;
> +
> +       return bsm;
> +}
> +
>  static resource_size_t __init i830_stolen_size(int num, int slot, int func)
>  {
>         u16 gmch_ctrl;
> @@ -500,6 +512,11 @@ static const struct intel_early_ops chv_early_ops __initconst = {
>         .stolen_size = chv_stolen_size,
>  };
>  
> +static const struct intel_early_ops gen11_early_ops __initconst = {
> +       .stolen_base = gen11_stolen_base,
> +       .stolen_size = gen9_stolen_size,
> +};
> +
>  static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_I830_IDS(&i830_early_ops),
>         INTEL_I845G_IDS(&i845_early_ops),
> @@ -531,6 +548,7 @@ static const struct pci_device_id intel_early_ids[] __initconst = {
>         INTEL_CFL_IDS(&gen9_early_ops),
>         INTEL_GLK_IDS(&gen9_early_ops),
>         INTEL_CNL_IDS(&gen9_early_ops),
> +       INTEL_ICL_11_IDS(&gen11_early_ops),
>  };
>  
>  struct resource intel_graphics_stolen_res __ro_after_init = DEFINE_RES_MEM(0, 0);
> diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> index c9e5a6621b95..c44703f471b3 100644
> --- a/include/drm/i915_drm.h
> +++ b/include/drm/i915_drm.h
> @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
>  #define    I845_TSEG_SIZE_512K (2 << 1)
>  #define    I845_TSEG_SIZE_1M   (3 << 1)
>  
> -#define INTEL_BSM 0x5c
> +#define INTEL_BSM              0x5c
> +#define INTEL_GEN11_BSM_DW0    0xc0
> +#define INTEL_GEN11_BSM_DW1    0xc4
>  #define   INTEL_BSM_MASK       (-(1u << 20))
>  
>  #endif                         /* _I915_DRM_H_ */
> -- 
> 2.14.3
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-05-07  8:46     ` Joonas Lahtinen
  (?)
@ 2018-06-01 21:44     ` Paulo Zanoni
  2018-06-18 17:47         ` Rodrigo Vivi
  -1 siblings, 1 reply; 25+ messages in thread
From: Paulo Zanoni @ 2018-06-01 21:44 UTC (permalink / raw)
  To: Joonas Lahtinen, intel-gfx
  Cc: stable, Ingo Molnar, H . Peter Anvin, x86, Daniele Ceraolo Spurio

Em Seg, 2018-05-07 às 11:46 +0300, Joonas Lahtinen escreveu:
> Ingo, do you prefer to merge through our tree with your ack?

Ping?

> 
> Quoting Paulo Zanoni (2018-05-04 23:32:51)
> > ICL changes the registers and addresses to 64 bits.
> > 
> > I also briefly looked at implementing an u64 version of the PCI
> > config
> > read functions, but I concluded this wouldn't be trivial, so it's
> > not
> > worth doing it for a single user that can't have any racing
> > problems
> > while reading the register in two separate operations.
> > 
> > v2:
> >  - Scrub the development (non-public) changelog (Joonas).
> >  - Remove the i915.ko bits so this can be easily backported in
> > order
> >    to properly avoid stolen memory even on machines without i915.ko
> >    (Joonas).
> >  - CC stable for the reasons above.
> > 
> > Issue: VIZ-9250
> 
> Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake
> definitions.")
> 
> > CC: stable@vger.kernel.org
> 
> This should not be needed, it was introduced in v4.17-rc1 only.
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> Regards, Joonas
> 
> > Cc: Ingo Molnar <mingo@kernel.org>
> > Cc: H. Peter Anvin <hpa@zytor.com>
> > Cc: x86@kernel.org
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
> >  include/drm/i915_drm.h         |  4 +++-
> >  2 files changed, 21 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kernel/early-quirks.c
> > b/arch/x86/kernel/early-quirks.c
> > index bae0d32e327b..72c2cf961d44 100644
> > --- a/arch/x86/kernel/early-quirks.c
> > +++ b/arch/x86/kernel/early-quirks.c
> > @@ -340,6 +340,18 @@ static resource_size_t __init
> > gen3_stolen_base(int num, int slot, int func,
> >         return bsm & INTEL_BSM_MASK;
> >  }
> >  
> > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > int func,
> > +                                               resource_size_t
> > stolen_size)
> > +{
> > +       u64 bsm;
> > +
> > +       bsm = read_pci_config(num, slot, func,
> > INTEL_GEN11_BSM_DW0);
> > +       bsm &= INTEL_BSM_MASK;
> > +       bsm |= (u64)read_pci_config(num, slot, func,
> > INTEL_GEN11_BSM_DW1) << 32;
> > +
> > +       return bsm;
> > +}
> > +
> >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > int func)
> >  {
> >         u16 gmch_ctrl;
> > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > chv_early_ops __initconst = {
> >         .stolen_size = chv_stolen_size,
> >  };
> >  
> > +static const struct intel_early_ops gen11_early_ops __initconst =
> > {
> > +       .stolen_base = gen11_stolen_base,
> > +       .stolen_size = gen9_stolen_size,
> > +};
> > +
> >  static const struct pci_device_id intel_early_ids[] __initconst =
> > {
> >         INTEL_I830_IDS(&i830_early_ops),
> >         INTEL_I845G_IDS(&i845_early_ops),
> > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > intel_early_ids[] __initconst = {
> >         INTEL_CFL_IDS(&gen9_early_ops),
> >         INTEL_GLK_IDS(&gen9_early_ops),
> >         INTEL_CNL_IDS(&gen9_early_ops),
> > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> >  };
> >  
> >  struct resource intel_graphics_stolen_res __ro_after_init =
> > DEFINE_RES_MEM(0, 0);
> > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> > index c9e5a6621b95..c44703f471b3 100644
> > --- a/include/drm/i915_drm.h
> > +++ b/include/drm/i915_drm.h
> > @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
> >  #define    I845_TSEG_SIZE_512K (2 << 1)
> >  #define    I845_TSEG_SIZE_1M   (3 << 1)
> >  
> > -#define INTEL_BSM 0x5c
> > +#define INTEL_BSM              0x5c
> > +#define INTEL_GEN11_BSM_DW0    0xc0
> > +#define INTEL_GEN11_BSM_DW1    0xc4
> >  #define   INTEL_BSM_MASK       (-(1u << 20))
> >  
> >  #endif                         /* _I915_DRM_H_ */
> > -- 
> > 2.14.3
> > 

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-06-01 21:44     ` Paulo Zanoni
@ 2018-06-18 17:47         ` Rodrigo Vivi
  0 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-06-18 17:47 UTC (permalink / raw)
  To: Paulo Zanoni, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Joonas Lahtinen, intel-gfx, x86, Ingo Molnar, stable, H . Peter Anvin

On Fri, Jun 01, 2018 at 02:44:51PM -0700, Paulo Zanoni wrote:
> Em Seg, 2018-05-07 �s 11:46 +0300, Joonas Lahtinen escreveu:
> > Ingo, do you prefer to merge through our tree with your ack?
> 
> Ping?
> 
> > 
> > Quoting Paulo Zanoni (2018-05-04 23:32:51)
> > > ICL changes the registers and addresses to 64 bits.
> > > 
> > > I also briefly looked at implementing an u64 version of the PCI
> > > config
> > > read functions, but I concluded this wouldn't be trivial, so it's
> > > not
> > > worth doing it for a single user that can't have any racing
> > > problems
> > > while reading the register in two separate operations.
> > > 
> > > v2:
> > >  - Scrub the development (non-public) changelog (Joonas).
> > >  - Remove the i915.ko bits so this can be easily backported in
> > > order
> > >    to properly avoid stolen memory even on machines without i915.ko
> > >    (Joonas).
> > >  - CC stable for the reasons above.
> > > 
> > > Issue: VIZ-9250
> > 
> > Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake
> > definitions.")
> > 
> > > CC: stable@vger.kernel.org
> > 
> > This should not be needed, it was introduced in v4.17-rc1 only.
> > 
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > 
> > Regards, Joonas
> >

Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: Ingo Molnar <mingo@kernel.org>
> > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > Cc: x86@kernel.org

guys, could we push this through drm-intel? ack?
nack? comments?

> > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > ---
> > >  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
> > >  include/drm/i915_drm.h         |  4 +++-
> > >  2 files changed, 21 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/x86/kernel/early-quirks.c
> > > b/arch/x86/kernel/early-quirks.c
> > > index bae0d32e327b..72c2cf961d44 100644
> > > --- a/arch/x86/kernel/early-quirks.c
> > > +++ b/arch/x86/kernel/early-quirks.c
> > > @@ -340,6 +340,18 @@ static resource_size_t __init
> > > gen3_stolen_base(int num, int slot, int func,
> > >         return bsm & INTEL_BSM_MASK;
> > >  }
> > >  
> > > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > > int func,
> > > +                                               resource_size_t
> > > stolen_size)
> > > +{
> > > +       u64 bsm;
> > > +
> > > +       bsm = read_pci_config(num, slot, func,
> > > INTEL_GEN11_BSM_DW0);
> > > +       bsm &= INTEL_BSM_MASK;
> > > +       bsm |= (u64)read_pci_config(num, slot, func,
> > > INTEL_GEN11_BSM_DW1) << 32;
> > > +
> > > +       return bsm;
> > > +}
> > > +
> > >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > > int func)
> > >  {
> > >         u16 gmch_ctrl;
> > > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > > chv_early_ops __initconst = {
> > >         .stolen_size = chv_stolen_size,
> > >  };
> > >  
> > > +static const struct intel_early_ops gen11_early_ops __initconst =
> > > {
> > > +       .stolen_base = gen11_stolen_base,
> > > +       .stolen_size = gen9_stolen_size,
> > > +};
> > > +
> > >  static const struct pci_device_id intel_early_ids[] __initconst =
> > > {
> > >         INTEL_I830_IDS(&i830_early_ops),
> > >         INTEL_I845G_IDS(&i845_early_ops),
> > > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > > intel_early_ids[] __initconst = {
> > >         INTEL_CFL_IDS(&gen9_early_ops),
> > >         INTEL_GLK_IDS(&gen9_early_ops),
> > >         INTEL_CNL_IDS(&gen9_early_ops),
> > > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> > >  };
> > >  
> > >  struct resource intel_graphics_stolen_res __ro_after_init =
> > > DEFINE_RES_MEM(0, 0);
> > > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> > > index c9e5a6621b95..c44703f471b3 100644
> > > --- a/include/drm/i915_drm.h
> > > +++ b/include/drm/i915_drm.h
> > > @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
> > >  #define    I845_TSEG_SIZE_512K (2 << 1)
> > >  #define    I845_TSEG_SIZE_1M   (3 << 1)
> > >  
> > > -#define INTEL_BSM 0x5c
> > > +#define INTEL_BSM              0x5c
> > > +#define INTEL_GEN11_BSM_DW0    0xc0
> > > +#define INTEL_GEN11_BSM_DW1    0xc4
> > >  #define   INTEL_BSM_MASK       (-(1u << 20))
> > >  
> > >  #endif                         /* _I915_DRM_H_ */
> > > -- 
> > > 2.14.3
> > > 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
@ 2018-06-18 17:47         ` Rodrigo Vivi
  0 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-06-18 17:47 UTC (permalink / raw)
  To: Paulo Zanoni, Thomas Gleixner, Ingo Molnar
  Cc: x86, intel-gfx, stable, H . Peter Anvin, Ingo Molnar

On Fri, Jun 01, 2018 at 02:44:51PM -0700, Paulo Zanoni wrote:
> Em Seg, 2018-05-07 às 11:46 +0300, Joonas Lahtinen escreveu:
> > Ingo, do you prefer to merge through our tree with your ack?
> 
> Ping?
> 
> > 
> > Quoting Paulo Zanoni (2018-05-04 23:32:51)
> > > ICL changes the registers and addresses to 64 bits.
> > > 
> > > I also briefly looked at implementing an u64 version of the PCI
> > > config
> > > read functions, but I concluded this wouldn't be trivial, so it's
> > > not
> > > worth doing it for a single user that can't have any racing
> > > problems
> > > while reading the register in two separate operations.
> > > 
> > > v2:
> > >  - Scrub the development (non-public) changelog (Joonas).
> > >  - Remove the i915.ko bits so this can be easily backported in
> > > order
> > >    to properly avoid stolen memory even on machines without i915.ko
> > >    (Joonas).
> > >  - CC stable for the reasons above.
> > > 
> > > Issue: VIZ-9250
> > 
> > Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake
> > definitions.")
> > 
> > > CC: stable@vger.kernel.org
> > 
> > This should not be needed, it was introduced in v4.17-rc1 only.
> > 
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > 
> > Regards, Joonas
> >

Cc: Thomas Gleixner <tglx@linutronix.de>
> > > Cc: Ingo Molnar <mingo@kernel.org>
> > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > Cc: x86@kernel.org

guys, could we push this through drm-intel? ack?
nack? comments?

> > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > ---
> > >  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
> > >  include/drm/i915_drm.h         |  4 +++-
> > >  2 files changed, 21 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/x86/kernel/early-quirks.c
> > > b/arch/x86/kernel/early-quirks.c
> > > index bae0d32e327b..72c2cf961d44 100644
> > > --- a/arch/x86/kernel/early-quirks.c
> > > +++ b/arch/x86/kernel/early-quirks.c
> > > @@ -340,6 +340,18 @@ static resource_size_t __init
> > > gen3_stolen_base(int num, int slot, int func,
> > >         return bsm & INTEL_BSM_MASK;
> > >  }
> > >  
> > > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > > int func,
> > > +                                               resource_size_t
> > > stolen_size)
> > > +{
> > > +       u64 bsm;
> > > +
> > > +       bsm = read_pci_config(num, slot, func,
> > > INTEL_GEN11_BSM_DW0);
> > > +       bsm &= INTEL_BSM_MASK;
> > > +       bsm |= (u64)read_pci_config(num, slot, func,
> > > INTEL_GEN11_BSM_DW1) << 32;
> > > +
> > > +       return bsm;
> > > +}
> > > +
> > >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > > int func)
> > >  {
> > >         u16 gmch_ctrl;
> > > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > > chv_early_ops __initconst = {
> > >         .stolen_size = chv_stolen_size,
> > >  };
> > >  
> > > +static const struct intel_early_ops gen11_early_ops __initconst =
> > > {
> > > +       .stolen_base = gen11_stolen_base,
> > > +       .stolen_size = gen9_stolen_size,
> > > +};
> > > +
> > >  static const struct pci_device_id intel_early_ids[] __initconst =
> > > {
> > >         INTEL_I830_IDS(&i830_early_ops),
> > >         INTEL_I845G_IDS(&i845_early_ops),
> > > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > > intel_early_ids[] __initconst = {
> > >         INTEL_CFL_IDS(&gen9_early_ops),
> > >         INTEL_GLK_IDS(&gen9_early_ops),
> > >         INTEL_CNL_IDS(&gen9_early_ops),
> > > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> > >  };
> > >  
> > >  struct resource intel_graphics_stolen_res __ro_after_init =
> > > DEFINE_RES_MEM(0, 0);
> > > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> > > index c9e5a6621b95..c44703f471b3 100644
> > > --- a/include/drm/i915_drm.h
> > > +++ b/include/drm/i915_drm.h
> > > @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
> > >  #define    I845_TSEG_SIZE_512K (2 << 1)
> > >  #define    I845_TSEG_SIZE_1M   (3 << 1)
> > >  
> > > -#define INTEL_BSM 0x5c
> > > +#define INTEL_BSM              0x5c
> > > +#define INTEL_GEN11_BSM_DW0    0xc0
> > > +#define INTEL_GEN11_BSM_DW1    0xc4
> > >  #define   INTEL_BSM_MASK       (-(1u << 20))
> > >  
> > >  #endif                         /* _I915_DRM_H_ */
> > > -- 
> > > 2.14.3
> > > 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-06-18 17:47         ` Rodrigo Vivi
@ 2018-07-03 19:11           ` Rodrigo Vivi
  -1 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-03 19:11 UTC (permalink / raw)
  To: Paulo Zanoni, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Joonas Lahtinen, intel-gfx, x86, Ingo Molnar, stable

On Mon, Jun 18, 2018 at 10:47:21AM -0700, Rodrigo Vivi wrote:
> On Fri, Jun 01, 2018 at 02:44:51PM -0700, Paulo Zanoni wrote:
> > Em Seg, 2018-05-07 �s 11:46 +0300, Joonas Lahtinen escreveu:
> > > Ingo, do you prefer to merge through our tree with your ack?
> > 
> > Ping?
> > 
> > > 
> > > Quoting Paulo Zanoni (2018-05-04 23:32:51)
> > > > ICL changes the registers and addresses to 64 bits.
> > > > 
> > > > I also briefly looked at implementing an u64 version of the PCI
> > > > config
> > > > read functions, but I concluded this wouldn't be trivial, so it's
> > > > not
> > > > worth doing it for a single user that can't have any racing
> > > > problems
> > > > while reading the register in two separate operations.
> > > > 
> > > > v2:
> > > >  - Scrub the development (non-public) changelog (Joonas).
> > > >  - Remove the i915.ko bits so this can be easily backported in
> > > > order
> > > >    to properly avoid stolen memory even on machines without i915.ko
> > > >    (Joonas).
> > > >  - CC stable for the reasons above.
> > > > 
> > > > Issue: VIZ-9250
> > > 
> > > Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake
> > > definitions.")
> > > 
> > > > CC: stable@vger.kernel.org
> > > 
> > > This should not be needed, it was introduced in v4.17-rc1 only.
> > > 
> > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > 
> > > Regards, Joonas
> > >
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > Cc: x86@kernel.org
> 
> guys, could we push this through drm-intel? ack?
> nack? comments?

Is there any concern with this patch?
any ack for push this through drm-intel?
or any nack with explanations please?

I'd like to push this for 4.19 because this is
one of the patches that blocks us on using drm-tip
on ICL.

Thanks in advance,
Rodrigo.

> 
> > > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > > ---
> > > >  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
> > > >  include/drm/i915_drm.h         |  4 +++-
> > > >  2 files changed, 21 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/x86/kernel/early-quirks.c
> > > > b/arch/x86/kernel/early-quirks.c
> > > > index bae0d32e327b..72c2cf961d44 100644
> > > > --- a/arch/x86/kernel/early-quirks.c
> > > > +++ b/arch/x86/kernel/early-quirks.c
> > > > @@ -340,6 +340,18 @@ static resource_size_t __init
> > > > gen3_stolen_base(int num, int slot, int func,
> > > >         return bsm & INTEL_BSM_MASK;
> > > >  }
> > > >  
> > > > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > > > int func,
> > > > +                                               resource_size_t
> > > > stolen_size)
> > > > +{
> > > > +       u64 bsm;
> > > > +
> > > > +       bsm = read_pci_config(num, slot, func,
> > > > INTEL_GEN11_BSM_DW0);
> > > > +       bsm &= INTEL_BSM_MASK;
> > > > +       bsm |= (u64)read_pci_config(num, slot, func,
> > > > INTEL_GEN11_BSM_DW1) << 32;
> > > > +
> > > > +       return bsm;
> > > > +}
> > > > +
> > > >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > > > int func)
> > > >  {
> > > >         u16 gmch_ctrl;
> > > > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > > > chv_early_ops __initconst = {
> > > >         .stolen_size = chv_stolen_size,
> > > >  };
> > > >  
> > > > +static const struct intel_early_ops gen11_early_ops __initconst =
> > > > {
> > > > +       .stolen_base = gen11_stolen_base,
> > > > +       .stolen_size = gen9_stolen_size,
> > > > +};
> > > > +
> > > >  static const struct pci_device_id intel_early_ids[] __initconst =
> > > > {
> > > >         INTEL_I830_IDS(&i830_early_ops),
> > > >         INTEL_I845G_IDS(&i845_early_ops),
> > > > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > > > intel_early_ids[] __initconst = {
> > > >         INTEL_CFL_IDS(&gen9_early_ops),
> > > >         INTEL_GLK_IDS(&gen9_early_ops),
> > > >         INTEL_CNL_IDS(&gen9_early_ops),
> > > > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> > > >  };
> > > >  
> > > >  struct resource intel_graphics_stolen_res __ro_after_init =
> > > > DEFINE_RES_MEM(0, 0);
> > > > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> > > > index c9e5a6621b95..c44703f471b3 100644
> > > > --- a/include/drm/i915_drm.h
> > > > +++ b/include/drm/i915_drm.h
> > > > @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
> > > >  #define    I845_TSEG_SIZE_512K (2 << 1)
> > > >  #define    I845_TSEG_SIZE_1M   (3 << 1)
> > > >  
> > > > -#define INTEL_BSM 0x5c
> > > > +#define INTEL_BSM              0x5c
> > > > +#define INTEL_GEN11_BSM_DW0    0xc0
> > > > +#define INTEL_GEN11_BSM_DW1    0xc4
> > > >  #define   INTEL_BSM_MASK       (-(1u << 20))
> > > >  
> > > >  #endif                         /* _I915_DRM_H_ */
> > > > -- 
> > > > 2.14.3
> > > > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
@ 2018-07-03 19:11           ` Rodrigo Vivi
  0 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-03 19:11 UTC (permalink / raw)
  To: Paulo Zanoni, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: intel-gfx, x86, stable, Ingo Molnar

On Mon, Jun 18, 2018 at 10:47:21AM -0700, Rodrigo Vivi wrote:
> On Fri, Jun 01, 2018 at 02:44:51PM -0700, Paulo Zanoni wrote:
> > Em Seg, 2018-05-07 às 11:46 +0300, Joonas Lahtinen escreveu:
> > > Ingo, do you prefer to merge through our tree with your ack?
> > 
> > Ping?
> > 
> > > 
> > > Quoting Paulo Zanoni (2018-05-04 23:32:51)
> > > > ICL changes the registers and addresses to 64 bits.
> > > > 
> > > > I also briefly looked at implementing an u64 version of the PCI
> > > > config
> > > > read functions, but I concluded this wouldn't be trivial, so it's
> > > > not
> > > > worth doing it for a single user that can't have any racing
> > > > problems
> > > > while reading the register in two separate operations.
> > > > 
> > > > v2:
> > > >  - Scrub the development (non-public) changelog (Joonas).
> > > >  - Remove the i915.ko bits so this can be easily backported in
> > > > order
> > > >    to properly avoid stolen memory even on machines without i915.ko
> > > >    (Joonas).
> > > >  - CC stable for the reasons above.
> > > > 
> > > > Issue: VIZ-9250
> > > 
> > > Fixes: 412310019a20 ("drm/i915/icl: Add initial Icelake
> > > definitions.")
> > > 
> > > > CC: stable@vger.kernel.org
> > > 
> > > This should not be needed, it was introduced in v4.17-rc1 only.
> > > 
> > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > 
> > > Regards, Joonas
> > >
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > Cc: x86@kernel.org
> 
> guys, could we push this through drm-intel? ack?
> nack? comments?

Is there any concern with this patch?
any ack for push this through drm-intel?
or any nack with explanations please?

I'd like to push this for 4.19 because this is
one of the patches that blocks us on using drm-tip
on ICL.

Thanks in advance,
Rodrigo.

> 
> > > > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > > > ---
> > > >  arch/x86/kernel/early-quirks.c | 18 ++++++++++++++++++
> > > >  include/drm/i915_drm.h         |  4 +++-
> > > >  2 files changed, 21 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/arch/x86/kernel/early-quirks.c
> > > > b/arch/x86/kernel/early-quirks.c
> > > > index bae0d32e327b..72c2cf961d44 100644
> > > > --- a/arch/x86/kernel/early-quirks.c
> > > > +++ b/arch/x86/kernel/early-quirks.c
> > > > @@ -340,6 +340,18 @@ static resource_size_t __init
> > > > gen3_stolen_base(int num, int slot, int func,
> > > >         return bsm & INTEL_BSM_MASK;
> > > >  }
> > > >  
> > > > +static resource_size_t __init gen11_stolen_base(int num, int slot,
> > > > int func,
> > > > +                                               resource_size_t
> > > > stolen_size)
> > > > +{
> > > > +       u64 bsm;
> > > > +
> > > > +       bsm = read_pci_config(num, slot, func,
> > > > INTEL_GEN11_BSM_DW0);
> > > > +       bsm &= INTEL_BSM_MASK;
> > > > +       bsm |= (u64)read_pci_config(num, slot, func,
> > > > INTEL_GEN11_BSM_DW1) << 32;
> > > > +
> > > > +       return bsm;
> > > > +}
> > > > +
> > > >  static resource_size_t __init i830_stolen_size(int num, int slot,
> > > > int func)
> > > >  {
> > > >         u16 gmch_ctrl;
> > > > @@ -500,6 +512,11 @@ static const struct intel_early_ops
> > > > chv_early_ops __initconst = {
> > > >         .stolen_size = chv_stolen_size,
> > > >  };
> > > >  
> > > > +static const struct intel_early_ops gen11_early_ops __initconst =
> > > > {
> > > > +       .stolen_base = gen11_stolen_base,
> > > > +       .stolen_size = gen9_stolen_size,
> > > > +};
> > > > +
> > > >  static const struct pci_device_id intel_early_ids[] __initconst =
> > > > {
> > > >         INTEL_I830_IDS(&i830_early_ops),
> > > >         INTEL_I845G_IDS(&i845_early_ops),
> > > > @@ -531,6 +548,7 @@ static const struct pci_device_id
> > > > intel_early_ids[] __initconst = {
> > > >         INTEL_CFL_IDS(&gen9_early_ops),
> > > >         INTEL_GLK_IDS(&gen9_early_ops),
> > > >         INTEL_CNL_IDS(&gen9_early_ops),
> > > > +       INTEL_ICL_11_IDS(&gen11_early_ops),
> > > >  };
> > > >  
> > > >  struct resource intel_graphics_stolen_res __ro_after_init =
> > > > DEFINE_RES_MEM(0, 0);
> > > > diff --git a/include/drm/i915_drm.h b/include/drm/i915_drm.h
> > > > index c9e5a6621b95..c44703f471b3 100644
> > > > --- a/include/drm/i915_drm.h
> > > > +++ b/include/drm/i915_drm.h
> > > > @@ -95,7 +95,9 @@ extern struct resource intel_graphics_stolen_res;
> > > >  #define    I845_TSEG_SIZE_512K (2 << 1)
> > > >  #define    I845_TSEG_SIZE_1M   (3 << 1)
> > > >  
> > > > -#define INTEL_BSM 0x5c
> > > > +#define INTEL_BSM              0x5c
> > > > +#define INTEL_GEN11_BSM_DW0    0xc0
> > > > +#define INTEL_GEN11_BSM_DW1    0xc4
> > > >  #define   INTEL_BSM_MASK       (-(1u << 20))
> > > >  
> > > >  #endif                         /* _I915_DRM_H_ */
> > > > -- 
> > > > 2.14.3
> > > > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-07-03 19:11           ` Rodrigo Vivi
@ 2018-07-04  5:50             ` Ingo Molnar
  -1 siblings, 0 replies; 25+ messages in thread
From: Ingo Molnar @ 2018-07-04  5:50 UTC (permalink / raw)
  To: Rodrigo Vivi
  Cc: Paulo Zanoni, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Joonas Lahtinen, intel-gfx, x86, stable


* Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:

> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > Cc: x86@kernel.org
> > 
> > guys, could we push this through drm-intel? ack?
> > nack? comments?
> 
> Is there any concern with this patch?
> any ack for push this through drm-intel?
> or any nack with explanations please?
> 
> I'd like to push this for 4.19 because this is
> one of the patches that blocks us on using drm-tip
> on ICL.

Sorry - no objections, and I suppose it will be all tested properly before going 
upstream:

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
@ 2018-07-04  5:50             ` Ingo Molnar
  0 siblings, 0 replies; 25+ messages in thread
From: Ingo Molnar @ 2018-07-04  5:50 UTC (permalink / raw)
  To: Rodrigo Vivi
  Cc: x86, Paulo Zanoni, intel-gfx, stable, Ingo Molnar,
	H. Peter Anvin, Thomas Gleixner


* Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:

> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > Cc: x86@kernel.org
> > 
> > guys, could we push this through drm-intel? ack?
> > nack? comments?
> 
> Is there any concern with this patch?
> any ack for push this through drm-intel?
> or any nack with explanations please?
> 
> I'd like to push this for 4.19 because this is
> one of the patches that blocks us on using drm-tip
> on ICL.

Sorry - no objections, and I suppose it will be all tested properly before going 
upstream:

Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,

	Ingo
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-07-04  5:50             ` Ingo Molnar
@ 2018-07-05 14:52               ` Rodrigo Vivi
  -1 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-05 14:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Paulo Zanoni, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Joonas Lahtinen, intel-gfx, x86, stable

On Wed, Jul 04, 2018 at 07:50:42AM +0200, Ingo Molnar wrote:
> 
> * Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> 
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > > Cc: x86@kernel.org
> > > 
> > > guys, could we push this through drm-intel? ack?
> > > nack? comments?
> > 
> > Is there any concern with this patch?
> > any ack for push this through drm-intel?
> > or any nack with explanations please?
> > 
> > I'd like to push this for 4.19 because this is
> > one of the patches that blocks us on using drm-tip
> > on ICL.
> 
> Sorry - no objections, and I suppose it will be all tested properly before going 
> upstream:

np. yeap, we have that running on ICLs here with internal branch for a while already.

> 
> Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,
Rodrigo.

> 
> Thanks,
> 
> 	Ingo

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
@ 2018-07-05 14:52               ` Rodrigo Vivi
  0 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-05 14:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: x86, Paulo Zanoni, intel-gfx, stable, Ingo Molnar,
	H. Peter Anvin, Thomas Gleixner

On Wed, Jul 04, 2018 at 07:50:42AM +0200, Ingo Molnar wrote:
> 
> * Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> 
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > > Cc: x86@kernel.org
> > > 
> > > guys, could we push this through drm-intel? ack?
> > > nack? comments?
> > 
> > Is there any concern with this patch?
> > any ack for push this through drm-intel?
> > or any nack with explanations please?
> > 
> > I'd like to push this for 4.19 because this is
> > one of the patches that blocks us on using drm-tip
> > on ICL.
> 
> Sorry - no objections, and I suppose it will be all tested properly before going 
> upstream:

np. yeap, we have that running on ICLs here with internal branch for a while already.

> 
> Acked-by: Ingo Molnar <mingo@kernel.org>

Thanks,
Rodrigo.

> 
> Thanks,
> 
> 	Ingo
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] drm/i915: use the ICL stolen memory
  2018-05-04 20:32   ` [PATCH 2/2] drm/i915: use the ICL " Paulo Zanoni
@ 2018-07-07  2:09     ` Lucas De Marchi
  2018-07-09 19:13       ` Rodrigo Vivi
  2018-07-09 23:44       ` Paulo Zanoni
  0 siblings, 2 replies; 25+ messages in thread
From: Lucas De Marchi @ 2018-07-07  2:09 UTC (permalink / raw)
  To: Paulo Zanoni; +Cc: intel-gfx, x86

On Fri, May 4, 2018 at 1:33 PM Paulo Zanoni <paulo.r.zanoni@intel.com> wrote:
>
> Now that our stolen memory is already reserved by the x86 subsystem
> (since commit "x86/gpu: reserve ICL's graphics stolen memory"), make
> use of it.
>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> Cc: x86@kernel.org
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h        |  1 +
>  2 files changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index ad949cc30928..99556f0dbedc 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
>         *size = stolen_top - *base;
>  }
>
> +static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv,
> +                                   resource_size_t *base,
> +                                   resource_size_t *size)
> +{
> +       u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED);

are you sure it's still the same address? Either I'm looking to the
wrong place or this needs to be changed.

Lucas De Marchi

> +
> +       DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val);
> +
> +       *base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK;
> +
> +       switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
> +       case GEN8_STOLEN_RESERVED_1M:
> +               *size = 1024 * 1024;
> +               break;
> +       case GEN8_STOLEN_RESERVED_2M:
> +               *size = 2 * 1024 * 1024;
> +               break;
> +       case GEN8_STOLEN_RESERVED_4M:
> +               *size = 4 * 1024 * 1024;
> +               break;
> +       case GEN8_STOLEN_RESERVED_8M:
> +               *size = 8 * 1024 * 1024;
> +               break;
> +       default:
> +               *size = 8 * 1024 * 1024;
> +               MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> +       }
> +}
> +
>  int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
>  {
>         resource_size_t reserved_base, stolen_top;
> @@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
>                         gen7_get_stolen_reserved(dev_priv,
>                                                  &reserved_base, &reserved_size);
>                 break;
> -       default:
> +       case 8:
> +       case 9:
> +       case 10:
>                 if (IS_LP(dev_priv))
>                         chv_get_stolen_reserved(dev_priv,
>                                                 &reserved_base, &reserved_size);
> @@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
>                         bdw_get_stolen_reserved(dev_priv,
>                                                 &reserved_base, &reserved_size);
>                 break;
> +       case 11:
> +       default:
> +               icl_get_stolen_reserved(dev_priv, &reserved_base,
> +                                       &reserved_size);
> +               break;
>         }
>
>         /*
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 15daf3553d40..c5bc7c808e31 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -398,6 +398,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
>  #define GEN8_STOLEN_RESERVED_4M                (2 << 7)
>  #define GEN8_STOLEN_RESERVED_8M                (3 << 7)
>  #define GEN6_STOLEN_RESERVED_ENABLE    (1 << 0)
> +#define GEN11_STOLEN_RESERVED_ADDR_MASK        (0xFFFFFFFFFFFULL << 20)
>
>  /* VGA stuff */
>
> --
> 2.14.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Lucas De Marchi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] drm/i915: use the ICL stolen memory
  2018-07-07  2:09     ` Lucas De Marchi
@ 2018-07-09 19:13       ` Rodrigo Vivi
  2018-07-09 23:44       ` Paulo Zanoni
  1 sibling, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-09 19:13 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx, x86, Paulo Zanoni

On Fri, Jul 06, 2018 at 07:09:15PM -0700, Lucas De Marchi wrote:
> On Fri, May 4, 2018 at 1:33 PM Paulo Zanoni <paulo.r.zanoni@intel.com> wrote:
> >
> > Now that our stolen memory is already reserved by the x86 subsystem
> > (since commit "x86/gpu: reserve ICL's graphics stolen memory"), make
> > use of it.
> >
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Cc: x86@kernel.org
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_stolen.c | 38 +++++++++++++++++++++++++++++++++-
> >  drivers/gpu/drm/i915/i915_reg.h        |  1 +
> >  2 files changed, 38 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > index ad949cc30928..99556f0dbedc 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > @@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
> >         *size = stolen_top - *base;
> >  }
> >
> > +static void icl_get_stolen_reserved(struct drm_i915_private *dev_priv,
> > +                                   resource_size_t *base,
> > +                                   resource_size_t *size)
> > +{
> > +       u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED);
> 
> are you sure it's still the same address? Either I'm looking to the
> wrong place or this needs to be changed.

The only thing that changed was the size s/32/64
and the reg name s/MPAVPC/PAVPC_REG

BSpec: 19481

So, since this question made me look to the spec:

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


> 
> Lucas De Marchi
> 
> > +
> > +       DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n", reg_val);
> > +
> > +       *base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK;
> > +
> > +       switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
> > +       case GEN8_STOLEN_RESERVED_1M:
> > +               *size = 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_2M:
> > +               *size = 2 * 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_4M:
> > +               *size = 4 * 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_8M:
> > +               *size = 8 * 1024 * 1024;
> > +               break;
> > +       default:
> > +               *size = 8 * 1024 * 1024;
> > +               MISSING_CASE(reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK);
> > +       }
> > +}
> > +
> >  int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
> >  {
> >         resource_size_t reserved_base, stolen_top;
> > @@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
> >                         gen7_get_stolen_reserved(dev_priv,
> >                                                  &reserved_base, &reserved_size);
> >                 break;
> > -       default:
> > +       case 8:
> > +       case 9:
> > +       case 10:
> >                 if (IS_LP(dev_priv))
> >                         chv_get_stolen_reserved(dev_priv,
> >                                                 &reserved_base, &reserved_size);
> > @@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
> >                         bdw_get_stolen_reserved(dev_priv,
> >                                                 &reserved_base, &reserved_size);
> >                 break;
> > +       case 11:
> > +       default:
> > +               icl_get_stolen_reserved(dev_priv, &reserved_base,
> > +                                       &reserved_size);
> > +               break;
> >         }
> >
> >         /*
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index 15daf3553d40..c5bc7c808e31 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -398,6 +398,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
> >  #define GEN8_STOLEN_RESERVED_4M                (2 << 7)
> >  #define GEN8_STOLEN_RESERVED_8M                (3 << 7)
> >  #define GEN6_STOLEN_RESERVED_ENABLE    (1 << 0)
> > +#define GEN11_STOLEN_RESERVED_ADDR_MASK        (0xFFFFFFFFFFFULL << 20)
> >
> >  /* VGA stuff */
> >
> > --
> > 2.14.3
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
> -- 
> Lucas De Marchi
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] drm/i915: use the ICL stolen memory
  2018-07-07  2:09     ` Lucas De Marchi
  2018-07-09 19:13       ` Rodrigo Vivi
@ 2018-07-09 23:44       ` Paulo Zanoni
  1 sibling, 0 replies; 25+ messages in thread
From: Paulo Zanoni @ 2018-07-09 23:44 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: intel-gfx, x86

Em Sex, 2018-07-06 às 19:09 -0700, Lucas De Marchi escreveu:
> On Fri, May 4, 2018 at 1:33 PM Paulo Zanoni <paulo.r.zanoni@intel.com
> > wrote:
> > 
> > Now that our stolen memory is already reserved by the x86 subsystem
> > (since commit "x86/gpu: reserve ICL's graphics stolen memory"),
> > make
> > use of it.
> > 
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
> > Cc: x86@kernel.org
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_stolen.c | 38
> > +++++++++++++++++++++++++++++++++-
> >  drivers/gpu/drm/i915/i915_reg.h        |  1 +
> >  2 files changed, 38 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c
> > b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > index ad949cc30928..99556f0dbedc 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> > @@ -343,6 +343,35 @@ static void bdw_get_stolen_reserved(struct
> > drm_i915_private *dev_priv,
> >         *size = stolen_top - *base;
> >  }
> > 
> > +static void icl_get_stolen_reserved(struct drm_i915_private
> > *dev_priv,
> > +                                   resource_size_t *base,
> > +                                   resource_size_t *size)
> > +{
> > +       u64 reg_val = I915_READ64(GEN6_STOLEN_RESERVED);
> 
> are you sure it's still the same address? Either I'm looking to the
> wrong place or this needs to be changed.

Spec page 19481 tells me me I'm correct, but notice that this is now 64
bits.

> 
> Lucas De Marchi
> 
> > +
> > +       DRM_DEBUG_DRIVER("GEN6_STOLEN_RESERVED = 0x%016llx\n",
> > reg_val);
> > +
> > +       *base = reg_val & GEN11_STOLEN_RESERVED_ADDR_MASK;
> > +
> > +       switch (reg_val & GEN8_STOLEN_RESERVED_SIZE_MASK) {
> > +       case GEN8_STOLEN_RESERVED_1M:
> > +               *size = 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_2M:
> > +               *size = 2 * 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_4M:
> > +               *size = 4 * 1024 * 1024;
> > +               break;
> > +       case GEN8_STOLEN_RESERVED_8M:
> > +               *size = 8 * 1024 * 1024;
> > +               break;
> > +       default:
> > +               *size = 8 * 1024 * 1024;
> > +               MISSING_CASE(reg_val &
> > GEN8_STOLEN_RESERVED_SIZE_MASK);
> > +       }
> > +}
> > +
> >  int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
> >  {
> >         resource_size_t reserved_base, stolen_top;
> > @@ -399,7 +428,9 @@ int i915_gem_init_stolen(struct
> > drm_i915_private *dev_priv)
> >                         gen7_get_stolen_reserved(dev_priv,
> >                                                  &reserved_base,
> > &reserved_size);
> >                 break;
> > -       default:
> > +       case 8:
> > +       case 9:
> > +       case 10:
> >                 if (IS_LP(dev_priv))
> >                         chv_get_stolen_reserved(dev_priv,
> >                                                 &reserved_base,
> > &reserved_size);
> > @@ -407,6 +438,11 @@ int i915_gem_init_stolen(struct
> > drm_i915_private *dev_priv)
> >                         bdw_get_stolen_reserved(dev_priv,
> >                                                 &reserved_base,
> > &reserved_size);
> >                 break;
> > +       case 11:
> > +       default:
> > +               icl_get_stolen_reserved(dev_priv, &reserved_base,
> > +                                       &reserved_size);
> > +               break;
> >         }
> > 
> >         /*
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h
> > b/drivers/gpu/drm/i915/i915_reg.h
> > index 15daf3553d40..c5bc7c808e31 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -398,6 +398,7 @@ static inline bool
> > i915_mmio_reg_valid(i915_reg_t reg)
> >  #define GEN8_STOLEN_RESERVED_4M                (2 << 7)
> >  #define GEN8_STOLEN_RESERVED_8M                (3 << 7)
> >  #define GEN6_STOLEN_RESERVED_ENABLE    (1 << 0)
> > +#define GEN11_STOLEN_RESERVED_ADDR_MASK        (0xFFFFFFFFFFFULL
> > << 20)
> > 
> >  /* VGA stuff */
> > 
> > --
> > 2.14.3
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> 
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [Intel-gfx] [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory
  2018-07-04  5:50             ` Ingo Molnar
  (?)
  (?)
@ 2018-07-10 23:40             ` Rodrigo Vivi
  -1 siblings, 0 replies; 25+ messages in thread
From: Rodrigo Vivi @ 2018-07-10 23:40 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: x86, Paulo Zanoni, intel-gfx, stable, Ingo Molnar,
	H. Peter Anvin, Thomas Gleixner

On Wed, Jul 04, 2018 at 07:50:42AM +0200, Ingo Molnar wrote:
> 
> * Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> 
> > > Cc: Thomas Gleixner <tglx@linutronix.de>
> > > > > > Cc: Ingo Molnar <mingo@kernel.org>
> > > > > > Cc: H. Peter Anvin <hpa@zytor.com>
> > > > > > Cc: x86@kernel.org
> > > 
> > > guys, could we push this through drm-intel? ack?
> > > nack? comments?
> > 
> > Is there any concern with this patch?
> > any ack for push this through drm-intel?
> > or any nack with explanations please?
> > 
> > I'd like to push this for 4.19 because this is
> > one of the patches that blocks us on using drm-tip
> > on ICL.
> 
> Sorry - no objections, and I suppose it will be all tested properly before going 
> upstream:
> 
> Acked-by: Ingo Molnar <mingo@kernel.org>

series pushed to drm-intel-next-queued...
Probably landing on 4.19 still

Thanks for patches, reviews and acks, specially x86 one.

> 
> Thanks,
> 
> 	Ingo
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2018-07-10 23:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03  0:23 [PATCH] drm/i915/icl, x86/gpu: implement ICL stolen memory support Paulo Zanoni
2018-05-03  0:52 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2018-05-03  1:06 ` ✓ Fi.CI.BAT: success " Patchwork
2018-05-03  9:59 ` [PATCH] " Joonas Lahtinen
2018-05-03 15:24   ` Paulo Zanoni
2018-05-03 15:35     ` Chris Wilson
2018-05-03 16:28       ` Joonas Lahtinen
2018-05-03 10:18 ` ✓ Fi.CI.IGT: success for " Patchwork
2018-05-04 20:32 ` [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory Paulo Zanoni
2018-05-04 20:32   ` [PATCH 2/2] drm/i915: use the ICL " Paulo Zanoni
2018-07-07  2:09     ` Lucas De Marchi
2018-07-09 19:13       ` Rodrigo Vivi
2018-07-09 23:44       ` Paulo Zanoni
2018-05-07  8:46   ` [PATCH 1/2] x86/gpu: reserve ICL's graphics " Joonas Lahtinen
2018-05-07  8:46     ` Joonas Lahtinen
2018-06-01 21:44     ` Paulo Zanoni
2018-06-18 17:47       ` [Intel-gfx] " Rodrigo Vivi
2018-06-18 17:47         ` Rodrigo Vivi
2018-07-03 19:11         ` [Intel-gfx] " Rodrigo Vivi
2018-07-03 19:11           ` Rodrigo Vivi
2018-07-04  5:50           ` [Intel-gfx] " Ingo Molnar
2018-07-04  5:50             ` Ingo Molnar
2018-07-05 14:52             ` [Intel-gfx] " Rodrigo Vivi
2018-07-05 14:52               ` Rodrigo Vivi
2018-07-10 23:40             ` [Intel-gfx] " Rodrigo Vivi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.