Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
* FIX: Permedia 2 driver XFree-4.0
@ 2000-03-16 11:51 Peter Petrakis
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Petrakis @ 2000-03-16 11:51 UTC (permalink / raw)
  To: axp-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN, Size: 2009 bytes --]

The patch below fixes my problem with the permedia 2 driver.
A big thank you to Dr.Glibert and Michel Danzer who helped me 
out alot with this.

Peter

--
www.alphalinux.org
Peter Petrakis         Warrior/Engineer        ppetrakis@alphalinux.org
"Oh my God! They killed Xena! You bastards!!"
"<BLAM!!> Who the hell are you!? Name's Ash <click clock> Housewares..."

---------- Forwarded message ----------
Date: Thu, 16 Mar 2000 07:12:45 -0800 (PST)
From: Michel Dänzer <mdaenzer@yahoo.com>
Reply-To: michdaen@iiic.ethz.ch
To: Peter Petrakis <ppetrakis@firestorm.tzo.org>
Subject: Re: Fwd: Re: ev56 mga issues



--- Peter Petrakis <ppetrakis@firestorm.tzo.org> wrote:
> > That's possible (seems like it's at least in the latest 2.2.15-pre .
> > 
> > Anyway, unfortunately it doesn't seem to help according to others...
> > 
> > I'm sorry but I really can't help you more ATM.
> 
> I'll grab the latest 2.2.x kernel and try again with fb support. More
> people are starting to have this problems. Hopefully with enough eyes the
> bug will be found :-). Thanks.

That's alwaysa good method :)


In case you'd like to try more, maybe this patch for the X server can help?

--- Xserver/hw/xfree86/os-support/linux/lnx_video.c.orig        Sat Feb 26
05:43:53 2000
+++ Xserver/hw/xfree86/os-support/linux/lnx_video.c     Thu Mar 16 00:37:34
2000
@@ -66,9 +66,9 @@
 #  define isJensen (!_bus_base())
 # endif
 
-# define needSparse (_bus_base_sparse() != 0)
+# define needSparse (0)
 
-# define BUS_BASE _bus_base()
+# define BUS_BASE (_bus_base() + 0x200000000)
 
 #else


It apparently solves the problem for Hannes Reinecke.


Michel


=====
"Software is like sex; it's better when it's free"
 -- Linus Torvalds

"If you continue running Windows, your system may become unstable."
 -- Windows 95 BSOD

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


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

* Re: FIX: Permedia 2 driver XFree-4.0
@ 2000-03-17  0:47 Richard Henderson
  2000-03-17  2:15 ` Jay Estabrook
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2000-03-17  0:47 UTC (permalink / raw)
  To: axp-list

On Thu, Mar 16, 2000 at 06:51:54AM -0500, Peter Petrakis wrote:
> The patch below fixes my problem with the permedia 2 driver.

> -# define BUS_BASE _bus_base()
> +# define BUS_BASE (_bus_base() + 0x200000000)

Um, that means you've got your video card in hose 1, not hose 0.
And now you can't run the same binary on a different machine.

There is currently no libc interface for getting at multiple hoses.
Jay and I talked about adding one last week, but not done it yet.


r~


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17  0:47 Richard Henderson
@ 2000-03-17  2:15 ` Jay Estabrook
  0 siblings, 0 replies; 10+ messages in thread
From: Jay Estabrook @ 2000-03-17  2:15 UTC (permalink / raw)
  To: axp-list

On Thu, Mar 16, 2000 at 04:47:08PM -0800, Richard Henderson wrote:
> On Thu, Mar 16, 2000 at 06:51:54AM -0500, Peter Petrakis wrote:
> > The patch below fixes my problem with the permedia 2 driver.
> 
> > -# define BUS_BASE _bus_base()
> > +# define BUS_BASE (_bus_base() + 0x200000000)
> 
> Um, that means you've got your video card in hose 1, not hose 0.

Actually, this change appeared together with some others, and the
total of them is quite subtle.

First off, IIRC, he's running on an EV56 machine and prolly an
LX/SX with PYXIS.

Thus, the changes effectively do:

1. make the server treat *all* machines as ones with NO "sparse" space,
   and therefore use byte/word instructions where needed to access bus
   I/O and memory space
2. make BUS_BASE on a PYXIS machine address the byte/word "dense" area,
   thus making the byte/word instructions from (1) do what they should.

Pretty slick... :-)

> And now you can't run the same binary on a different machine.

This it VERY true..

The REAL problem that was initially encountered is caused by not
mapping enough of the SPARSE bus space; you only need to change the
size of the area mapped to SPARSE space in:

	xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c

ie use the code:

      lnxSBase = mmap((caddr_t)0, 0x400000000, /* yes, 16GB!!! */
                      PROT_READ | PROT_WRITE,
                      MAP_SHARED, fd,
                      (off_t) _bus_base_sparse());

Then it should oughta just work, AND be portable, though it will use
an inordinate amount of pagetable space (ie it is mapping 20GB of the
user's virtual address space to the PCI bus SPARSE and DENSE areas).

--Jay++

-----------------------------------------------------------------------------
Jay A Estabrook                            Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K20         (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------


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

* Re: FIX: Permedia 2 driver XFree-4.0
       [not found] <38D2429C.3CA5F950@hw.ac.uk>
@ 2000-03-17 14:44 ` Hannes Reinecke
  2000-03-17 16:40   ` Jay Estabrook
  2000-03-17 21:53   ` Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: Hannes Reinecke @ 2000-03-17 14:44 UTC (permalink / raw)
  To: AXP Developers list

Jay Estabrook wrote:
[..]
> 
> Actually, this change appeared together with some others, and the 
> total of them is quite subtle. 
> 
> First off, IIRC, he's running on an EV56 machine and prolly an 
> LX/SX with PYXIS. 
> 
Indeed. Michel forgot to forward my entire mail, where it explicitely
states that this is a gross hack and _NOT_ to be used as a real patch.

> Thus, the changes effectively do: 
> 
> 1. make the server treat *all* machines as ones with NO "sparse" space, 
>    and therefore use byte/word instructions where needed to access bus 
>    I/O and memory space 
> 2. make BUS_BASE on a PYXIS machine address the byte/word "dense" area, 
>    thus making the byte/word instructions from (1) do what they should. 
> 
> Pretty slick... :-) 

(Whee, I did it correctly !)

> 
> > And now you can't run the same binary on a different machine. 
> 
> This it VERY true.. 
> 
Indeed. But then again, this was not meant to.

> The REAL problem that was initially encountered is caused by not 
> mapping enough of the SPARSE bus space; you only need to change the 
> size of the area mapped to SPARSE space in: 
> 
>         xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c 
> 
> ie use the code: 
> 
>       lnxSBase = mmap((caddr_t)0, 0x400000000, /* yes, 16GB!!! */ 
>                       PROT_READ | PROT_WRITE, 
>                       MAP_SHARED, fd, 
>                       (off_t) _bus_base_sparse()); 
> 
> Then it should oughta just work, AND be portable, though it will use 
> an inordinate amount of pagetable space (ie it is mapping 20GB of the 
> user's virtual address space to the PCI bus SPARSE and DENSE areas). 
> 
Well, but this was not my intention. The main intention was that we
should be using Byte/Word access on machines which support it.
Unfortunately the information given by libc via _bus_base is misleading,
since on a PYXIS _bus_base points to the dense memory area (which is
completely useless) and not to the beginning of the byte/word I/O area,
as it should be.

Hmm, the above fix: does it work on all older machines ?
Ie can they all mmap() this area ? If so, we can just go ahead and use
your patch, if not, well, than I fear we have to hardcode the memory
regions for every single machine.

Cheers,

Hannes
-- 
Hannes Reinecke                                 <civhr@civ.hw.ac.uk>
Fluid Loading and Instrumentation Center  Tel: (+44) 131 449 5111 x4430
Dept. of Civil & Offshore Engineering           Fax: (+44) 131 451 3154
Heriot Watt University, Edinburgh EH14 4AS


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 14:44 ` FIX: Permedia 2 driver XFree-4.0 Hannes Reinecke
@ 2000-03-17 16:40   ` Jay Estabrook
  2000-03-17 17:06     ` Hannes Reinecke
  2000-03-17 21:53   ` Richard Henderson
  1 sibling, 1 reply; 10+ messages in thread
From: Jay Estabrook @ 2000-03-17 16:40 UTC (permalink / raw)
  To: axp-list

On Fri, Mar 17, 2000 at 02:44:26PM +0000, Hannes Reinecke wrote:
>
> Well, but this was not my intention. The main intention was that we
> should be using Byte/Word access on machines which support it.

At the time that PYXIS-based machines were first supported, there was no
need to force byte/word use; in fact, it was difficult, as the assembler
didn't even support the byte/word instructions, IIRC. So it was easiest
to just continue using SPARSE. It wasn't until the appearance of the EV6
machines that it became necessary to support the byte/word stuff, and I
guess we never got around to considering changing the PYXIS support to
use them.

> Unfortunately the information given by libc via _bus_base is misleading,
> since on a PYXIS _bus_base points to the dense memory area (which is
> completely useless) and not to the beginning of the byte/word I/O area,
> as it should be.

Completely useless for byte/word access, yes, but the primary use of
the _bus_base area is as *memory*, not registers (whose size often
require byte/word access for correct operation). And the code to
access framebuffer memory is strictly controlled to perform (as much
as possible :-) aligned 32- or 64-bit access to that area

Only with the more modern cards have memory-mapped registers (and thus
SPARSE access) become a requirement - all earlier cards used
inb/outb/etc to access the legacy VGA register addresses. IIRC, Matrox
Millennium I was the reason the SPARSE stuff had to go in, and even
more, it required PCI Config Space access as well, which necessitated
the addition of those syscalls on Alpha.

But yes, in the next incarnation of _bus_base support code, we will
make PYXIS utilize the BWIO space.

> Hmm, the above fix: does it work on all older machines ?
> Ie can they all mmap() this area ? If so, we can just go ahead and use
> your patch,

It should, though (as I mentioned before) it is quite wasteful of system
resources, and it may be overkill for the older boxes (EV4 and EV45).

> if not, well, than I fear we have to hardcode the memory
> regions for every single machine.

Not a very atttractive option.

--Jay++

-----------------------------------------------------------------------------
Jay A Estabrook                            Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K20         (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 16:40   ` Jay Estabrook
@ 2000-03-17 17:06     ` Hannes Reinecke
  2000-03-17 20:23       ` Jay Estabrook
  0 siblings, 1 reply; 10+ messages in thread
From: Hannes Reinecke @ 2000-03-17 17:06 UTC (permalink / raw)
  To: axp-list

Jay Estabrook wrote:
> 
[..]
> Only with the more modern cards have memory-mapped registers (and thus
> SPARSE access) become a requirement - all earlier cards used
> inb/outb/etc to access the legacy VGA register addresses. IIRC, Matrox
> Millennium I was the reason the SPARSE stuff had to go in, and even
> more, it required PCI Config Space access as well, which necessitated
> the addition of those syscalls on Alpha.
> 
Well, the reason this whole mess cropped up was that the
framebuffer-code was being reworked for 4.0 and keithp thought it'd be
easier if one could use Memory-mapped I/O. 
BTW, is the sparse mapping somewhat related to the actual PCI-id on the
bus ? 'cause if it were we wouldn't need to map the whole 16G but rather
that portion corresponding to the card. The PCI information is obtained
anyway, so that won't be a problem.

> But yes, in the next incarnation of _bus_base support code, we will
> make PYXIS utilize the BWIO space.
> 
But that means another release of GLibc, and the distribution of that
can take _ages_. Nice as it were, though.

Cheers,

Hannes
-- 
Hannes Reinecke                                 <civhr@civ.hw.ac.uk>
Fluid Loading and Instrumentation Center  Tel: (+44) 131 449 5111 x4430
Dept. of Civil & Offshore Engineering           Fax: (+44) 131 451 3154
Heriot Watt University, Edinburgh EH14 4AS


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 17:06     ` Hannes Reinecke
@ 2000-03-17 20:23       ` Jay Estabrook
  2000-03-17 20:31         ` Brian Pomerantz
  2000-03-17 22:12         ` Richard Henderson
  0 siblings, 2 replies; 10+ messages in thread
From: Jay Estabrook @ 2000-03-17 20:23 UTC (permalink / raw)
  To: axp-list

On Fri, Mar 17, 2000 at 05:06:59PM +0000, Hannes Reinecke wrote:
> 
> Well, the reason this whole mess cropped up was that the
> framebuffer-code was being reworked for 4.0 and keithp thought it'd be
> easier if one could use Memory-mapped I/O. 

Um, do you mean memory-mapped registers? It already did in cases where
it had to (Millennium for one).

If you mean framebuffer references, just remember that (almost) all
machines before PYXIS can ONLY use DENSE, and it MUST be aligned,
which would preclude the use of byte/short, or make it more
complicated to tell when you *could* use it.

> BTW, is the sparse mapping somewhat related to the actual PCI-id on the
> bus ? 'cause if it were we wouldn't need to map the whole 16G but rather
> that portion corresponding to the card. The PCI information is obtained
> anyway, so that won't be a problem.

Egbert changed that area (lnx_video.c memory mapping), I think for some
reasons associated with multi-head, to map the *entire* PCI DENSE and
(not quite all of) SPARSE, from the earlier, only-what-is-needed method.

> But that means another release of GLibc, and the distribution of that
> can take _ages_. Nice as it were, though.

No; the idea is to make new kernel system calls, that GLIBC and user
apps can then make to get the same (and more) info that GLIBC gets
indirectly (/proc/cpuinfo) and manages itself now. It could be done
without GLIBC involvement initially, ie just a package in
os-support/linux that recognizes enhanced kernels and uses info from
there directly.

--Jay++

-----------------------------------------------------------------------------
Jay A Estabrook                            Alpha Engineering - LINUX Project
Compaq Computer Corp. - MRO1-2/K20         (508) 467-2080
200 Forest Street, Marlboro MA 01752       Jay.Estabrook@compaq.com
-----------------------------------------------------------------------------


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 20:23       ` Jay Estabrook
@ 2000-03-17 20:31         ` Brian Pomerantz
  2000-03-17 22:12         ` Richard Henderson
  1 sibling, 0 replies; 10+ messages in thread
From: Brian Pomerantz @ 2000-03-17 20:31 UTC (permalink / raw)
  To: axp-list

On Fri, Mar 17, 2000 at 03:23:55PM -0500, Jay Estabrook wrote:
> 
> > But that means another release of GLibc, and the distribution of that
> > can take _ages_. Nice as it were, though.
> 
> No; the idea is to make new kernel system calls, that GLIBC and user
> apps can then make to get the same (and more) info that GLIBC gets
> indirectly (/proc/cpuinfo) and manages itself now. It could be done
> without GLIBC involvement initially, ie just a package in
> os-support/linux that recognizes enhanced kernels and uses info from
> there directly.
> 

This is most definitely the best way.  I'm itching to get XFree86 4.0
going on my Miata, the speedup over 3.3.6 on my Athlon at home was
well worth my time to get it working on my desktop at work.


BAPper


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 14:44 ` FIX: Permedia 2 driver XFree-4.0 Hannes Reinecke
  2000-03-17 16:40   ` Jay Estabrook
@ 2000-03-17 21:53   ` Richard Henderson
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2000-03-17 21:53 UTC (permalink / raw)
  To: Hannes Reinecke; +Cc: AXP Developers list

On Fri, Mar 17, 2000 at 02:44:26PM +0000, Hannes Reinecke wrote:
> > ie use the code: 
> > 
> >       lnxSBase = mmap((caddr_t)0, 0x400000000, /* yes, 16GB!!! */ 
> >                       PROT_READ | PROT_WRITE, 
> >                       MAP_SHARED, fd, 
> >                       (off_t) _bus_base_sparse()); 
> > 
> > Then it should oughta just work, AND be portable...
> 
> Hmm, the above fix: does it work on all older machines ?

No.  That's what the HAE register is all about.

EV4 has a 34-bit address bus.  APECS and LCA have 4G of sparse
space mapping 128M.  It appears as if T2 has its 4G sparse space
broken up into multiple hunks, the largest of which is 2G mapping
only 64M.  But that's from reading code not docs.

EV5 has a 40-bit address bus.  CIA and MCPCIA have 22G of sparse
space in three hunks.  The only one we use is 16G and maps 512M.



r~


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

* Re: FIX: Permedia 2 driver XFree-4.0
  2000-03-17 20:23       ` Jay Estabrook
  2000-03-17 20:31         ` Brian Pomerantz
@ 2000-03-17 22:12         ` Richard Henderson
  1 sibling, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2000-03-17 22:12 UTC (permalink / raw)
  To: axp-list

On Fri, Mar 17, 2000 at 03:23:55PM -0500, Jay Estabrook wrote:
> > BTW, is the sparse mapping somewhat related to the actual PCI-id on the
> > bus ? 'cause if it were we wouldn't need to map the whole 16G but rather
> > that portion corresponding to the card. The PCI information is obtained
> > anyway, so that won't be a problem.
> 
> Egbert changed that area (lnx_video.c memory mapping), I think for some
> reasons associated with multi-head, to map the *entire* PCI DENSE and
> (not quite all of) SPARSE, from the earlier, only-what-is-needed method.

Please don't do this.  Yes, I can understand wanting to not have
to associate re-mapped regions with particular cards or whatever,
but there is a better way. 

Alpha userland has a 44-bit virtual address space to play with.
Let's use it.  Choose some otherwise unused area of the vm space.
I suggest beginning at 0x300_0000_0000.  Reserve the first 16G
beginning there for sparse mappings on hose 0, reserve the next
4G for dense mappings on hose 0.  Begin the mappings for hose 1
at offset 32G, and so on.

I say "reserve", but that's something that only happens in your
mind.  There is, unfortunately, no unix syscall to actually do
any reservation.  However, you can safely know that most memory
will be mapped about 0x200_0000_0000, and that someone would 
have to go out of their way to map something at 0x300_0000_0000.
Given that the X server is in control of itself and is not a
library, we can easily make the assumption that our "reserved"
region will not be fiddled with.

That said, it's easy enough to use MAP_FIXED to mmap the portions
of the I/O region that are actually needed, and to position the
portions _as if_ the entire region were mapped.


r~


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

end of thread, other threads:[~2000-03-17 22:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <38D2429C.3CA5F950@hw.ac.uk>
2000-03-17 14:44 ` FIX: Permedia 2 driver XFree-4.0 Hannes Reinecke
2000-03-17 16:40   ` Jay Estabrook
2000-03-17 17:06     ` Hannes Reinecke
2000-03-17 20:23       ` Jay Estabrook
2000-03-17 20:31         ` Brian Pomerantz
2000-03-17 22:12         ` Richard Henderson
2000-03-17 21:53   ` Richard Henderson
2000-03-17  0:47 Richard Henderson
2000-03-17  2:15 ` Jay Estabrook
  -- strict thread matches above, loose matches on Subject: below --
2000-03-16 11:51 Peter Petrakis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox