From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Subject: Re: [Intel-gfx] [PATCH] drm/i915: Quietly reject attempts to create non-pagealigned stolen objects Date: Fri, 19 Dec 2014 16:18:56 +0200 Message-ID: <20141219141856.GR10649@intel.com> References: <1418199431-5293-1-git-send-email-chris@chris-wilson.co.uk> <20141210102344.GM27182@phenom.ffwll.local> <20141210111328.GG14956@nuc-i3427.alporthouse.com> <20141210135301.GY27182@phenom.ffwll.local> <20141210145356.GC10649@intel.com> <5494157C.1080005@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Content-Disposition: inline In-Reply-To: <5494157C.1080005@gmail.com> Sender: stable-owner@vger.kernel.org To: Ander Conselvan de Oliveira Cc: Daniel Vetter , intel-gfx@lists.freedesktop.org, stable@vger.kernel.org List-Id: intel-gfx@lists.freedesktop.org On Fri, Dec 19, 2014 at 02:09:32PM +0200, Ander Conselvan de Oliveira w= rote: > On 12/10/2014 04:53 PM, Ville Syrj=E4l=E4 wrote: > > On Wed, Dec 10, 2014 at 02:53:01PM +0100, Daniel Vetter wrote: > >> On Wed, Dec 10, 2014 at 11:13:28AM +0000, Chris Wilson wrote: > >>> On Wed, Dec 10, 2014 at 11:23:44AM +0100, Daniel Vetter wrote: > >>>> On Wed, Dec 10, 2014 at 08:17:11AM +0000, Chris Wilson wrote: > >>>>> This added as a BUG_ON as it considered that no one would ever = request > >>>>> an unaligned object. However, it turns out that some BIOSes wil= l > >>>>> allocate a scanout that is offset from 0 and not aligned to a p= age > >>>>> boundary, and we were passing this through and hitting the BUG_= ON during > >>>>> boot. > >>>>> > >>>>> Quietly reject such a request to reserve the unaligned stolen o= bject and > >>>>> let the boot continue, restoring previous behaviour (i.e. no BI= OS > >>>>> framebuffer preservation). > >>>>> > >>>>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=3D86883 > >>>>> Signed-off-by: Chris Wilson > >>>>> Cc: stable@vger.kernel.org > >>>>> --- > >>>>> drivers/gpu/drm/i915/i915_gem_stolen.c | 10 ++++++---- > >>>>> 1 file changed, 6 insertions(+), 4 deletions(-) > >>>>> > >>>>> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/g= pu/drm/i915/i915_gem_stolen.c > >>>>> index 5c616ec2c5c8..a3bc0fa07c6c 100644 > >>>>> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > >>>>> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > >>>>> @@ -646,13 +646,15 @@ i915_gem_object_create_stolen_for_preallo= cated(struct drm_device *dev, > >>>>> DRM_DEBUG_KMS("creating preallocated stolen object: stolen_o= ffset=3D%x, gtt_offset=3D%x, size=3D%x\n", > >>>>> stolen_offset, gtt_offset, size); > >>>>> > >>>>> - /* KISS and expect everything to be page-aligned */ > >>>>> - BUG_ON(stolen_offset & 4095); > >>>>> - BUG_ON(size & 4095); > >>>>> - > >>>>> if (WARN_ON(size =3D=3D 0)) > >>>>> return NULL; > >>>>> > >>>>> + /* KISS and expect everything to be GTT page-aligned */ > >>>>> + if ((stolen_offset | size) & 4095) { > >>>> > >>>> Imo we should stil WARN_ON and fixup up the takeover code to ali= gn things > >>>> properly ... > >>> > >>> You shot down my idea for storing deltas into objects in the past= =2E.. > >>> > >>> The BIOS scanout is properly aligned to the rules of the display = engine, > >>> just not according to our mm restrictions. The bigger question is > >>> whether our 1:1 offset-to-stolen mapping is correct. It could wel= l be > >>> that that the framebuffer is at stolen address 0, but just has a = GTT > >>> offset. > >>> > >>> So the only question is whether we reject the object reservation = at the > >>> stolen layer or at the plane config layer. I decided that stolen = was > >>> better, because it is failing to meet our mm restrictions not > >>> hardware restrictions. > >> > >> The framebuffer layer can very much cope with offsets, so no need = to > >> reject it. We just need to patch up the framebuffer we create a bi= t. > >> Offsets are in pixels but that should align well. > > > > Or someone can dig out my old fb->offsets[] handling patch (and dou= ble check > > that it's sane, fixing if not). >=20 > http://lists.freedesktop.org/archives/intel-gfx/2012-May/017584.html >=20 > Is it that one? Looks like it. --=20 Ville Syrj=E4l=E4 Intel OTC