From: Anthony Liguori <anthony@codemonkey.ws>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 20/39] virtio-pci: convert to memory API
Date: Mon, 01 Aug 2011 15:23:00 -0500 [thread overview]
Message-ID: <4E370B24.6090700@codemonkey.ws> (raw)
In-Reply-To: <20110801082600.GD5439@redhat.com>
On 08/01/2011 03:26 AM, Michael S. Tsirkin wrote:
> On Sun, Jul 31, 2011 at 08:57:43PM +0300, Avi Kivity wrote:
>> @@ -491,30 +473,26 @@ static void virtio_pci_config_writel(void *opaque, uint32_t addr, uint32_t val)
>> virtio_config_writel(proxy->vdev, addr, val);
>> }
>>
>> -static void virtio_map(PCIDevice *pci_dev, int region_num,
>> - pcibus_t addr, pcibus_t size, int type)
>> -{
>> - VirtIOPCIProxy *proxy = container_of(pci_dev, VirtIOPCIProxy, pci_dev);
>> - VirtIODevice *vdev = proxy->vdev;
>> - unsigned config_len = VIRTIO_PCI_REGION_SIZE(pci_dev) + vdev->config_len;
>> -
>> - proxy->addr = addr;
>> -
>> - register_ioport_write(addr, config_len, 1, virtio_pci_config_writeb, proxy);
>> - register_ioport_write(addr, config_len, 2, virtio_pci_config_writew, proxy);
>> - register_ioport_write(addr, config_len, 4, virtio_pci_config_writel, proxy);
>> - register_ioport_read(addr, config_len, 1, virtio_pci_config_readb, proxy);
>> - register_ioport_read(addr, config_len, 2, virtio_pci_config_readw, proxy);
>> - register_ioport_read(addr, config_len, 4, virtio_pci_config_readl, proxy);
>> +const MemoryRegionPortio virtio_portio[] = {
>> + { 0, 0x10000, 1, .write = virtio_pci_config_writeb, },
>> + { 0, 0x10000, 2, .write = virtio_pci_config_writew, },
>> + { 0, 0x10000, 4, .write = virtio_pci_config_writel, },
>> + { 0, 0x10000, 1, .read = virtio_pci_config_readb, },
>> + { 0, 0x10000, 2, .read = virtio_pci_config_readw, },
>> + { 0, 0x10000, 4, .read = virtio_pci_config_readl, },
>> + PORTIO_END
>> +};
>>
>> - if (vdev->config_len)
>> - vdev->get_config(vdev, vdev->config);
>> -}
>> +static const MemoryRegionOps virtio_pci_config_ops = {
>> + .old_portio = virtio_portio,
>> + .endianness = DEVICE_LITTLE_ENDIAN,
>> +};
>>
>> static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
>> uint32_t val, int len)
>> {
>> VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
>> + VirtIODevice *vdev = proxy->vdev;
>>
>> if (PCI_COMMAND == address) {
>> if (!(val& PCI_COMMAND_MASTER)) {
>> @@ -525,6 +503,9 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
>> }
>> }
>> }
>> + if (address == PCI_BASE_ADDRESS_0&& vdev->config_len) {
>> + vdev->get_config(vdev, vdev->config);
>> + }
>>
>> pci_default_write_config(pci_dev, address, val, len);
>> msix_write_config(pci_dev, address, val, len);
>
> I'm not really sure why did we get the config on map,
> specifically - Anthony, do you know?
It's just a mechanism to lazily load the config. We could just as
easily read the config whenever the (virtio) config space was accessed.
Regards,
Anthony Liguori
> But if we want to do that, memory space enable might
> be a better place. Or maybe we just want a callback on
> map.
>
next prev parent reply other threads:[~2011-08-01 20:23 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-31 17:57 [Qemu-devel] [PATCH 00/39] Memory API, batch 2: PCI devices Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 01/39] pci: add API to get a BAR's mapped address Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 02/39] vmsvga: don't remember pci BAR address in callback any more Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 03/39] vga: convert vga and its derivatives to the memory API Avi Kivity
2011-07-31 18:42 ` Jan Kiszka
2011-07-31 18:46 ` Avi Kivity
2011-07-31 18:48 ` Jan Kiszka
2011-07-31 19:06 ` Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 04/39] cirrus: simplify mmio BAR access functions Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 05/39] cirrus: simplify bitblt " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 06/39] cirrus: simplify vga window mmio " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 07/39] vga: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 08/39] cirrus: simplify linear framebuffer " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 09/39] Integrate I/O memory regions into qemu Avi Kivity
2011-08-01 0:19 ` Richard Henderson
2011-08-01 6:05 ` Avi Kivity
2011-08-01 7:42 ` [Qemu-devel] [PATCH v2 " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 10/39] exec.c: fix initialization of system I/O memory region Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 11/39] pci: pass I/O address space to new PCI bus Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 12/39] pci: allow I/O BARs to be registered with pci_register_bar_region() Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 13/39] rtl8139: convert to memory API Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 14/39] ac97: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 15/39] e1000: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 16/39] eepro100: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 17/39] es1370: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 18/39] ide: " Avi Kivity
2011-08-01 19:22 ` Richard Henderson
2011-08-02 12:48 ` Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 19/39] ivshmem: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 20/39] virtio-pci: " Avi Kivity
2011-08-01 8:26 ` Michael S. Tsirkin
2011-08-01 9:35 ` Avi Kivity
2011-08-01 10:23 ` Michael S. Tsirkin
2011-08-01 20:24 ` Anthony Liguori
2011-08-03 15:16 ` Michael S. Tsirkin
2011-08-03 15:23 ` Avi Kivity
2011-08-03 15:38 ` Michael S. Tsirkin
2011-08-01 19:53 ` Michael S. Tsirkin
2011-08-02 9:17 ` Avi Kivity
2011-08-02 9:34 ` Michael S. Tsirkin
2011-08-02 12:39 ` Avi Kivity
2011-08-02 16:28 ` Gerd Hoffmann
2011-08-01 20:23 ` Anthony Liguori [this message]
2011-07-31 17:57 ` [Qemu-devel] [PATCH 21/39] ahci: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 22/39] intel-hda: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 23/39] lsi53c895a: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 24/39] ppc: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 25/39] ne2000: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 26/39] pcnet: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 27/39] i6300esb: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 28/39] isa-mmio: concert " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 29/39] sun4u: convert " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 30/39] ehci: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 31/39] uhci: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 32/39] xen-platform: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 33/39] msix: " Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 34/39] pci: remove pci_register_bar_simple() Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 35/39] pci: convert pci rom to memory API Avi Kivity
2011-07-31 17:57 ` [Qemu-devel] [PATCH 36/39] pci: remove pci_register_bar() Avi Kivity
2011-07-31 17:58 ` [Qemu-devel] [PATCH 37/39] pci: fold BAR mapping function into its caller Avi Kivity
2011-07-31 17:58 ` [Qemu-devel] [PATCH 38/39] pci: rename pci_register_bar_region() to pci_register_bar() Avi Kivity
2011-07-31 17:58 ` [Qemu-devel] [PATCH 39/39] pci: remove support for pre memory API BARs Avi Kivity
2011-07-31 18:02 ` [Qemu-devel] [PATCH 00/39] Memory API, batch 2: PCI devices Avi Kivity
2011-07-31 21:03 ` Anthony Liguori
2011-08-01 17:32 ` Richard Henderson
2011-08-01 21:23 ` [Qemu-devel] [RFC] Alpha system patchset updated for " Richard Henderson
2011-08-02 9:23 ` Avi Kivity
2011-08-02 15:42 ` 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=4E370B24.6090700@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=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).