qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Thorpe <thorpej@me.com>
To: qemu-devel@nongnu.org
Subject: Guidance on emulating "sparse" address spaces
Date: Wed, 23 Jun 2021 17:27:48 -0700	[thread overview]
Message-ID: <B588EDAA-3A97-44A9-8CAF-B2858CBE0A93@me.com> (raw)

As a "learn the internals of Qemu a little better" exercise, I am planning to write models for some older Alpha systems, initially for one based on the LCA45.  One of the quirks of these old systems, though, is lack of byte/word load/store.  So, to support 8- and 16-bit accesses to I/O devices, the PCI interfaces on these systems implement "sparse" I/O and memory spaces (some also implement a "dense" space that can be used for e.g. frame buffers; more on that another time).

The way the sparse spaces work is that the address space is exploded out, and the CPU-visible address used to perform the access is computed using the desired bus address along with a field to specify the byte-enables.

Using the 21066's IOC as an example, PCI I/O addresses 0000.0000 - 00ff.ffff are mapped to 1.c000.0000 - 0x1.dfff.fff.  The offset into the I/O space is shifted left 5 bits, and the byte-enables code is shifted left 3 bits, and both are added to the base address of PCI I/O space in the system memory map (1.c000.0000) resulting in the system physical address to use in a 32-bit load/store.  Software then does e.g. a 32-bit read to that location, and extracts the value out the relevant field.

Further complicating things ... it's possible for the bus region that's mapped into the system address space to not begin at 0.  As a hypothetical example you might have a PCI sparse memory space that maps PCI memory addresses 1000.0000 - 1fff.ffff.  The 2117x chipsets used on EV5/EV56 is a concrete example of a PCI interface that implements multiple windows for each space type.

I'm trying to wrap my head around how to achieve this in Qemu.  I don't see an obvious way from my initial study of how the PCI code and memory regions work.  Some guidance would be appreciated!

Thx.

-- thorpej



             reply	other threads:[~2021-06-24  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24  0:27 Jason Thorpe [this message]
2021-06-24  0:42 ` Guidance on emulating "sparse" address spaces Philippe Mathieu-Daudé
2021-06-24  0:53   ` Jason Thorpe
2021-06-26  1:29     ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B588EDAA-3A97-44A9-8CAF-B2858CBE0A93@me.com \
    --to=thorpej@me.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).