From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753522AbbC0V5O (ORCPT ); Fri, 27 Mar 2015 17:57:14 -0400 Received: from filtteri2.pp.htv.fi ([213.243.153.185]:48642 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752908AbbC0V5K (ORCPT ); Fri, 27 Mar 2015 17:57:10 -0400 Date: Fri, 27 Mar 2015 23:56:55 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: "Luis R. Rodriguez" Cc: Andy Lutomirski , Bjorn Helgaas , "Luis R. Rodriguez" , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Juergen Gross , Jan Beulich , Borislav Petkov , Suresh Siddha , venkatesh.pallipadi@intel.com, Dave Airlie , "linux-kernel@vger.kernel.org" , Linux Fbdev development list , X86 ML , "xen-devel@lists.xenproject.org" , Ingo Molnar , Linus Torvalds , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen Subject: Re: [PATCH v1 09/47] vidoe: fbdev: atyfb: remove and fix MTRR MMIO "hole" work around Message-ID: <20150327215655.GA29933@sci.fi> Mail-Followup-To: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , "Luis R. Rodriguez" , Andy Lutomirski , Bjorn Helgaas , "Luis R. Rodriguez" , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Juergen Gross , Jan Beulich , Borislav Petkov , Suresh Siddha , venkatesh.pallipadi@intel.com, Dave Airlie , "linux-kernel@vger.kernel.org" , Linux Fbdev development list , X86 ML , "xen-devel@lists.xenproject.org" , Ingo Molnar , Linus Torvalds , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> <1426893517-2511-10-git-send-email-mcgrof@do-not-panic.com> <20150321091514.GA22926@sci.fi> <20150327193813.GH5622@wotan.suse.de> <20150327195759.GK5622@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150327195759.GK5622@wotan.suse.de> User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2015 at 08:57:59PM +0100, Luis R. Rodriguez wrote: > On Fri, Mar 27, 2015 at 12:43:55PM -0700, Andy Lutomirski wrote: > > On Fri, Mar 27, 2015 at 12:38 PM, Luis R. Rodriguez wrote: > > > On Sat, Mar 21, 2015 at 11:15:14AM +0200, Ville Syrjälä wrote: > > >> On Fri, Mar 20, 2015 at 04:17:59PM -0700, Luis R. Rodriguez wrote: > > >> > diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c > > >> > index 8025624..8875e56 100644 > > >> > --- a/drivers/video/fbdev/aty/atyfb_base.c > > >> > +++ b/drivers/video/fbdev/aty/atyfb_base.c > > >> > @@ -2630,21 +2630,10 @@ static int aty_init(struct fb_info *info) > > >> > > > >> > #ifdef CONFIG_MTRR > > >> > par->mtrr_aper = -1; > > >> > - par->mtrr_reg = -1; > > >> > if (!nomtrr) { > > >> > - /* Cover the whole resource. */ > > >> > - par->mtrr_aper = mtrr_add(par->res_start, par->res_size, > > >> > + par->mtrr_aper = mtrr_add(info->fix.smem_start, > > >> > + info->fix.smem_len, > > >> > MTRR_TYPE_WRCOMB, 1); > > >> > > >> MTRRs need power of two size, so how is this supposed to work? > > > > > > As per mtrr_add_page() [0] the base and size are just supposed to be in units > > > of 4 KiB, although the practice is to use powers of 2 in *some* drivers this > > > is not standardized and by no means recorded as a requirement. Obviously > > > powers of 2 will work too and you'd end up neatly aligned as well. mtrr_add() > > > will use mtrr_check() to verify the the same requirement. Furthermore, > > > as per my commit log message: > > > > Whatever the code may or may not do, the x86 architecture uses > > power-of-two MTRR sizes. So I'm confused. > > There should be no confusion, I simply did not know that *was* the > requirement for x86, if that is the case we should add a check for that > and perhaps generalize a helper that does the power of two helper changes, > the cleanest I found was the vesafb driver solution. > > Thoughts? The vesafb solution is bad since you'll only end up covering only the first 4MB of the framebuffer instead of the almost 8MB you want. Which in practice will mean throwing away half the VRAM since you really don't want the massive performance hit from accessing it as UC. And that would mean giving up decent display resolutions as well :( And the other option of trying to cover the remainder with multiple ever smaller MTRRs doesn't work either since you'll run out of MTRRs very quickly. This is precisely why I used the hole method in atyfb in the first place. I don't really like the idea of any new mtrr code not supporting that use case, especially as these things tend to be present in older machines where PAT isn't an option. -- Ville Syrjälä syrjala@sci.fi http://www.sci.fi/~syrjala/ From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= Date: Fri, 27 Mar 2015 21:56:55 +0000 Subject: Re: [PATCH v1 09/47] vidoe: fbdev: atyfb: remove and fix MTRR MMIO "hole" work around Message-Id: <20150327215655.GA29933@sci.fi> List-Id: References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> <1426893517-2511-10-git-send-email-mcgrof@do-not-panic.com> <20150321091514.GA22926@sci.fi> <20150327193813.GH5622@wotan.suse.de> <20150327195759.GK5622@wotan.suse.de> In-Reply-To: <20150327195759.GK5622@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: "Luis R. Rodriguez" Cc: Andy Lutomirski , Bjorn Helgaas , "Luis R. Rodriguez" , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Juergen Gross , Jan Beulich , Borislav Petkov , Suresh Siddha , venkatesh.pallipadi@intel.com, Dave Airlie , "linux-kernel@vger.kernel.org" , Linux Fbdev development list , X86 ML , "xen-devel@lists.xenproject.org" , Ingo Molnar , Linus Torvalds , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen On Fri, Mar 27, 2015 at 08:57:59PM +0100, Luis R. Rodriguez wrote: > On Fri, Mar 27, 2015 at 12:43:55PM -0700, Andy Lutomirski wrote: > > On Fri, Mar 27, 2015 at 12:38 PM, Luis R. Rodriguez w= rote: > > > On Sat, Mar 21, 2015 at 11:15:14AM +0200, Ville Syrj=E4l=E4 wrote: > > >> On Fri, Mar 20, 2015 at 04:17:59PM -0700, Luis R. Rodriguez wrote: > > >> > diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/= fbdev/aty/atyfb_base.c > > >> > index 8025624..8875e56 100644 > > >> > --- a/drivers/video/fbdev/aty/atyfb_base.c > > >> > +++ b/drivers/video/fbdev/aty/atyfb_base.c > > >> > @@ -2630,21 +2630,10 @@ static int aty_init(struct fb_info *info) > > >> > > > >> > #ifdef CONFIG_MTRR > > >> > par->mtrr_aper =3D -1; > > >> > - par->mtrr_reg =3D -1; > > >> > if (!nomtrr) { > > >> > - /* Cover the whole resource. */ > > >> > - par->mtrr_aper =3D mtrr_add(par->res_start, par->res_s= ize, > > >> > + par->mtrr_aper =3D mtrr_add(info->fix.smem_start, > > >> > + info->fix.smem_len, > > >> > MTRR_TYPE_WRCOMB, 1); > > >> > > >> MTRRs need power of two size, so how is this supposed to work? > > > > > > As per mtrr_add_page() [0] the base and size are just supposed to be = in units > > > of 4 KiB, although the practice is to use powers of 2 in *some* drive= rs this > > > is not standardized and by no means recorded as a requirement. Obviou= sly > > > powers of 2 will work too and you'd end up neatly aligned as well. mt= rr_add() > > > will use mtrr_check() to verify the the same requirement. Furthermore, > > > as per my commit log message: > >=20 > > Whatever the code may or may not do, the x86 architecture uses > > power-of-two MTRR sizes. So I'm confused. >=20 > There should be no confusion, I simply did not know that *was* the > requirement for x86, if that is the case we should add a check for that > and perhaps generalize a helper that does the power of two helper changes, > the cleanest I found was the vesafb driver solution. >=20 > Thoughts? The vesafb solution is bad since you'll only end up covering only the first 4MB of the framebuffer instead of the almost 8MB you want. Which in practice will mean throwing away half the VRAM since you really don't want the massive performance hit from accessing it as UC. And that would mean giving up decent display resolutions as well :( And the other option of trying to cover the remainder with multiple ever smaller MTRRs doesn't work either since you'll run out of MTRRs very quickly. This is precisely why I used the hole method in atyfb in the first place. I don't really like the idea of any new mtrr code not supporting that use case, especially as these things tend to be present in older machines where PAT isn't an option. --=20 Ville Syrj=E4l=E4 syrjala@sci.fi http://www.sci.fi/~syrjala/