qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [RFC v2 00/20] Memory API
Date: Mon, 27 Jun 2011 18:54:05 +0300	[thread overview]
Message-ID: <4E08A79D.7010606@redhat.com> (raw)
In-Reply-To: <20110627155216.GA5614@redhat.com>

On 06/27/2011 06:52 PM, Michael S. Tsirkin wrote:
> On Mon, Jun 27, 2011 at 06:13:03PM +0300, Avi Kivity wrote:
> >  On 06/27/2011 04:21 PM, Avi Kivity wrote:
> >  >As expected, this is taking longer than expected, so I'm releasing something
> >  >less complete than I'd have liked.  Not even all of the PC machine is
> >  >converted, but the difficult parts are (cirrus).  It appears to work well.
> >  >
> >  >The major change compared to v1 is the introduction of
> >  >memory_region_init_alias(), which defines a memory region in terms of another.
> >  >With the current API, the ability to alias is provided by address arithmetic
> >  >on ram_addr_t:
> >  >
> >  >    ram_addr = qemu_ram_alloc(...);
> >  >    cpu_register_physical_memory(..., ram_addr, size, ...);
> >  >    /* alias: */
> >  >    cpu_register_physical_memory(..., ram_addr + offset, another_size, ...);
> >  >
> >  >With the new API, you have to create an alias:
> >  >
> >  >    memory_region_init_ram(&mem, ...);
> >  >    memory_region_register_subregion(...,&mem);
> >  >    /* alias: */
> >  >    memory_region_init_alias(&alias, ...,&mem, offset, another_size);
> >  >    memory_region_register_subregion(...,&alias);
> >  >
> >  >The patchset is somewhat churny.  One of the reasons is that we move from a
> >  >handle/pointer scheme in ram_addr_t to an object constructor/destructor scheme.
> >  >Another is that region size becomes a property of a region instead of being
> >  >maintained externally.  Also, container memory regions must be passed around,
> >  >though we don't do that as well as we should.
> >  >
> >  >Todo:
> >  >    - eliminate calls to get_system_memory() (where we ignore the bus hierarchy)
> >  >    - add PCI APIs for the VGA window
> >  >    - support the PIO address space using the memory API (allowing simplified
> >  >      PCI BAR registration)
> >  >    - convert 440FX
> >  >    - convert everything else
> >
> >  Michael, I'm looking at the pci bridge code, and it basically does
> >  the same thing - clip each BAR to the intersection of the decode
> >  window of all bridges it hides behind.
> >
> >  How does a PCI bridge behave wrt VGA?  is it a separate control?  If
> >  so I probably need to implement generalized clipping (i.e. decode
> >  between 0xa0000-0xc0000 or between 0xc0000000-0xf0000000).
>
> Per spec, VGA is special:
> - bridges have VGA enable bit
>
> The VGA Enable bit in the Bridge Control register (see Section 3.2.5.18)
> is used to control response by the bridge to both the VGA frame buffer
> addresses and to the VGA register addresses. When a VGA compatible
> device is located downstream of a PCI-to-PCI bridge, the VGA Enable bit
> must be set. When set, the bridge will positively decode and forward
> memory accesses to VGA frame buffer addresses and I/O accesses to VGA
> registers from the primary to secondary interface and block forwarding
> of these same accesses from the secondary to primary interface (see
> Section 4.5.1).
> VGA memory addresses:
> 0A 0000h through 0B FFFFh
> VGA I/O addresses (including ISA aliases address - AD[15::10] are not
> decoded):
> AD[9::0] = 3B0h through 3BBh and 3C0h through 3DFh
> The bridge does not decode or forward VGA BIOS memory addresses when the
> VGA Enable bit is set. ROM code provided by PCI compatible devices may
> be mapped to any address in PCI memory address space via the Expansion
> ROM Base Address register in the device's configuration header and must
> be copied to system memory before execution.
>

Okay, looks like generalized clipping is needed.  It's nice anyway and 
guarantees me a job for life as maintainer of memory.c.


> - bridges might also enable subtractive decoding
>    (required for isa behind the bridge)

What does that mean?

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-06-27 15:54 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-27 13:21 [Qemu-devel] [RFC v2 00/20] Memory API Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 01/20] Hierarchical memory region API Avi Kivity
2011-06-28 10:03   ` Michael S. Tsirkin
2011-06-28 10:28     ` Jan Kiszka
2011-06-28 11:53       ` Avi Kivity
2011-06-28 12:07         ` Jan Kiszka
2011-06-28 12:09           ` Avi Kivity
2011-06-28 12:46             ` Jan Kiszka
2011-06-28 12:53               ` Avi Kivity
2011-06-28 13:25             ` Peter Maydell
2011-06-28 13:36               ` Avi Kivity
2011-06-28 16:27             ` Olivier Galibert
2011-06-28 11:51     ` Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 02/20] memory: implement dirty tracking Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 03/20] memory: merge adjacent segments of a single memory region Avi Kivity
2011-06-27 13:56   ` Jan Kiszka
2011-06-27 14:11     ` Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 04/20] Internal interfaces for memory API Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 05/20] exec.c: initialize memory map Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 06/20] pc: grab system_memory Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 07/20] pc: convert pc_memory_init() to memory API Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 08/20] pc: move global memory map out of pc_init1() and into its callers Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 09/20] pci: pass address space to pci bus when created Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 10/20] pci: add MemoryRegion based BAR management API Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 11/20] sysbus: add MemoryRegion based memory " Avi Kivity
2011-06-27 13:21 ` [Qemu-devel] [RFC v2 12/20] usb-ohci: convert to MemoryRegion Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 13/20] pci: add API to get a BAR's mapped address Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 14/20] vmsvga: don't remember pci BAR address in callback any more Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 15/20] vga: convert vga and its derivatives to the memory API Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 16/20] cirrus: simplify mmio BAR access functions Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 17/20] cirrus: simplify bitblt " Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 18/20] cirrus: simplify vga window mmio " Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 19/20] vga: " Avi Kivity
2011-06-27 13:22 ` [Qemu-devel] [RFC v2 20/20] cirrus: simplify linear framebuffer " Avi Kivity
2011-06-27 15:13 ` [Qemu-devel] [RFC v2 00/20] Memory API Avi Kivity
2011-06-27 15:52   ` Michael S. Tsirkin
2011-06-27 15:54     ` Avi Kivity [this message]
2011-06-27 15:59       ` Michael S. Tsirkin
2011-06-27 16:10         ` Avi Kivity
2011-06-27 20:28         ` Anthony Liguori
2011-06-27 15:37 ` Anthony Liguori
2011-06-27 15:44   ` Avi Kivity

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=4E08A79D.7010606@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.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).