From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,3410b34506f92360 X-Google-Attributes: gid1164f8,public X-Google-Thread: fee84,3410b34506f92360 X-Google-Attributes: gidfee84,public From: Fred Kleinsorge Subject: Re: PCI Sparse Address Space Date: 1996/09/19 Message-ID: <324117C5.18AADFA6@star.enet.dec.com> X-Deja-AN: 183978662 references: <51k83t$c70@mashie.cs.umd.edu> content-type: text/plain; charset=us-ascii organization: OpenVMS Engineering mime-version: 1.0 newsgroups: comp.unix.osf.osf1,comp.sys.dec x-mailer: Mozilla 2.02b1 (X11; I; DEC 3000 - M700 ) Dirk Grunwald wrote: > > Here's my experienced based on trying to port the driver for the > Myricom Myrinet PCi interface to the DEC Alpha. > > The system start up code (not certain if it's the SROM bootup or the > SRM firmware) puts a device into "sparse space" based on a number of > reasons. The importance of this varies from machine to machine. > > For example, the AlphaServer 2100 PCI interface (the "T3" chip, I > think) maps any device as "sparse" if it marks a memory region as "not > prefetchable". The myrinet has a 256KByte on-chip SRAM memory that was > marked "not prefetchable", and thus communication with that memory > requires the PIO functions. More recently, I've received EEPROM > upgrades that mark it as "prefetchable", and that should fix the > problem ( but I haven't had time to plug it into the 2100's). > > By comparison, a system using the 21070 or 21170 PCI interface chipset > doesn't appear to care diddly about the "prefetch" bit. On both EV4 > and EV5 based systems, the same Myrinet card can be mapped into a > "dense" address space. > > If you trace the code path for the code that reads/writes sparse > address space, you'll get down ( in .../src/kernel/arch/alpha/hal) to > a hardware abstraction layer that diddles the appropriate PCI bridge > in the proper manner. > > We couldn't afford the overhead of those function calls for the > Myrinet interface and asked Myricom to spin another FPGA with the > prefetch bit marked as prefetchable. > In a different thread, I started to explain this... The selection of a sparse versus dense space address is made by the console firmware as it configures the system. The selection criteria is see if the memory is prefetchable. If it is, then you get dence, if it isn't then you get sparse. The reason for the decision is simple: If a memory-like region can be read without side effects (prefetchable implies this) then the assumption is made that all I/O to it can be made using doubleword reads and writes - and using read-mod-write sequences for partial word I/O. If however the region is non-prefetchable, then the assumption is made that arbitrary reads can have side-effects, and doubleword read-mod-writes are probably not sufficient. So, the O/S gets this physical address from the PCI card, and the choice has been made... or has it? Now we get down to platform decisions (as opposed to Alpha chip decisions). Each platform is based on a collection of parts, including the PCI interface and bridge chips. And each lays out some scheme for address spaces. On the AlphaStations, and on a few of AlphaServers - sparse space and dense space physically overmap each other. That is, the address for any physical location in dense space is also available in sparse space. This means that given the physical address from the PCI card, the operating system can permute it into either sparse or dense space as requested. Now, on _most_ AlphaServer boxes (like the 2100), the address space available for dense and sparse regions was not the same, and so they could not be completely overmapped. So, the firmware makes them physically disjoint (one of the registers like the HAE). A physical address in dense space cannot be mapped in dense space, and vice versa. So now the physical address that you got from the PCI card will dictate how the card is accessable, and the decision is dictated by the prefetchable attribute. In general, the rule of thumb is: If the PCI card does not have the prefetchable bit set, then you should be prepared to only use sparse space. If the bit is set then you should be prepared to use dense space. If you want to use a mixture, or have a preference to use the other space, then you will need to check the status from your attempt to map the space and make sure that it succeeds. This is exactly what I did in writing frame buffer logic - I have a sparse-only implementation, and a mixed dense/sparse implementation - and I select which one to use based on the availability of dense space. Now. Having said this. The decision to make sparse and dense disjoint was done, I think, because the hardware group did not want to end up in the situation where some cards could be overmapped, and some cards could not - depending on the number, location, and requirements of the cards for PCI address space. It is purely a software decision made by the firmware... and could be changed if there was a compelling reason. Or perhaps it would be interesting to have a mechanism to alter the address assignment on a card-by-card basis (either in the O/S or in the firmware). Hope this clarifies things a little.