Skip to contentSkip to conversation

qemu: target library, use it in msix

PATCH Superseded Michael S. Tsirkin 2 participants 3 messages Sep 23, 2009 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: target library, use it in msix

This creates target.c, which builds per-target, and makes it possible for devices to become target-independent. Use it in msix, reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no longer have to pass target page around.

---
 Makefile.target |    3 +++
 hw/msix.c       |   51 ++++++++++++++++++++++++++-------------------------
 hw/msix.h       |    5 ++---
 hw/pci.h        |    6 ------
 hw/virtio-pci.c |    3 +--
 5 files changed, 32 insertions(+), 36 deletions(-)
Makefile.target +3 -0
index 0ebef17..c0f143a 100644
@@ -55,6 +55,9 @@ libobj-$(CONFIG_S390_DIS) += s390-dis.o
 libobj-$(CONFIG_SH4_DIS) += sh4-dis.o
 libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o
 
+# Target library: makes devices target-independent
+libobj-y += target.o
+
 # libqemu
 
 libqemu.a: $(libobj-y)
hw/msix.c +26 -25

135 lines not on this page · raw message

hw/msix.h +2 -3
index 9367ba3..3427778 100644
@@ -3,9 +3,8 @@
 
 #include "qemu-common.h"
 
-int msix_init(struct PCIDevice *dev, unsigned short nentries,
-              unsigned bar_nr, unsigned bar_size,
-              target_phys_addr_t page_size);
+int msix_init(PCIDevice *pdev, unsigned short nentries,
+              unsigned bar_nr, unsigned bar_size);
 
 void msix_write_config(PCIDevice *pci_dev, uint32_t address,
                        uint32_t val, int len);
hw/pci.h +0 -6
index dddd599..8cfc38d 100644
@@ -214,12 +214,6 @@ struct PCIDevice {
     uint32_t msix_bar_size;
     /* Version id needed for VMState */
     int32_t version_id;
-    /* How much space does an MSIX table need. */
-    /* The spec requires giving the table structure
-     * a 4K aligned region all by itself. Align it to
-     * target pages so that drivers can do passthrough
-     * on the rest of the region. */
-    target_phys_addr_t msix_page_size;
 };
 
 PCIDevice *pci_register_device(PCIBus *bus, const char *name,
hw/virtio-pci.c +1 -2
index 1f14c5e..3a0231e 100644
@@ -410,8 +410,7 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
 
     config[0x3d] = 1;
 
-    if (vdev->nvectors && !msix_init(&proxy->pci_dev, vdev->nvectors, 1, 0,
-                                     TARGET_PAGE_SIZE)) {
+    if (vdev->nvectors && !msix_init(&proxy->pci_dev, vdev->nvectors, 1, 0)) {
         pci_register_bar(&proxy->pci_dev, 1,
                          msix_bar_size(&proxy->pci_dev),
                          PCI_ADDRESS_SPACE_MEM,
Signature · 1 line
1.6.5.rc2
#1 lore raw
Quoted 5 lines · Michael S. Tsirkin

This creates target.c, which builds per-target, and makes it possible for devices to become target-independent.  Use it in msix, reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no longer have to pass target page around.

Quoted 8 lines

---
 Makefile.target |    3 +++
 hw/msix.c       |   51 ++++++++++++++++++++++++++------------------------- hw/msix.h       |    5 ++---
 hw/pci.h        |    6 ------
 hw/virtio-pci.c |    3 +--

 5 files changed, 32 insertions(+), 36 deletions(-)

Forgot to add target.[ch]?

#2 lore raw
Quoted 15 lines · Blue Swirl
Quoted 5 lines · Michael S. Tsirkin

This creates target.c, which builds per-target, and makes it possible for devices to become target-independent.  Use it in msix, reverting part of 5e520a7d500ec2569d22d80f9ef4272a34cb3c80, as we no longer have to pass target page around.

Quoted 8 lines

---
 Makefile.target |    3 +++
 hw/msix.c       |   51 ++++++++++++++++++++++++++------------------------- hw/msix.h       |    5 ++---
 hw/pci.h        |    6 ------
 hw/virtio-pci.c |    3 +--

 5 files changed, 32 insertions(+), 36 deletions(-)
Quoted 1 line

Forgot to add target.[ch]?

Yep. fixed and reposted.