From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com ([192.55.52.120]:58490 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbeFAVpF (ORCPT ); Fri, 1 Jun 2018 17:45:05 -0400 Message-ID: <1527889491.2503.9.camel@intel.com> Subject: Re: [PATCH 1/2] x86/gpu: reserve ICL's graphics stolen memory From: Paulo Zanoni To: Joonas Lahtinen , intel-gfx@lists.freedesktop.org Cc: stable@vger.kernel.org, Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Daniele Ceraolo Spurio Date: Fri, 01 Jun 2018 14:44:51 -0700 In-Reply-To: <152568281673.4929.8527287724144901266@moflaher-mobl.ger.corp.intel.com> References: <20180503002352.11951-1-paulo.r.zanoni@intel.com> <20180504203252.28048-1-paulo.r.zanoni@intel.com> <152568281673.4929.8527287724144901266@moflaher-mobl.ger.corp.intel.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: 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 > > Regards, Joonas > > > Cc: Ingo Molnar > > Cc: H. Peter Anvin > > Cc: x86@kernel.org > > Cc: Daniele Ceraolo Spurio > > Cc: Joonas Lahtinen > > Signed-off-by: Paulo Zanoni > > --- > > 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 > >