Skip to contentSkip to conversation

xen-2015-12-22

GIT PULL Applied Stefano Stabellini 2 participants 6 messages Dec 22, 2015 – Dec 23, 2015

lore
Share & tools
lore
#0 lore raw

The following changes since commit c3626ca7df027dabf0568284360a23faf18f0884:

Update version for v2.5.0-rc3 release (2015-12-07 17:47:40 +0000)

are available in the git repository at:

git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/xen-2015-12-22

for you to fetch changes up to fc3e493bc8e96ef4bf7ae4f035f43cb39382c936:

xen_disk: treat "vhd" as "vpc" (2015-12-11 17:02:37 +0000)

----------------------------------------------------------------
Xen 2015/12/22

----------------------------------------------------------------
Jan Beulich (3):
xen/MSI-X: latch MSI-X table writes xen/MSI-X: really enforce alignment xen/pass-through: correctly deal with RW1C bits

Stefano Stabellini (1):
xen_disk: treat "vhd" as "vpc"

 hw/block/xen_disk.c         |    3 ++
 hw/xen/xen_pt.h             |    6 ++-
 hw/xen/xen_pt_config_init.c |   40 +++++++-------------
 hw/xen/xen_pt_msi.c         |   86 ++++++++++++++++++++-----------------------
 4 files changed, 60 insertions(+), 75 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/4] xen/MSI-X: latch MSI-X table writes

From: Jan Beulich <[email protected]>

The remaining log message in pci_msix_write() is wrong, as there guest behavior may only appear to be wrong: For one, the old logic didn't take the mask-all bit into account. And then this shouldn't depend on host device state (i.e. the host may have masked the entry without the guest having done so). Plus these writes shouldn't be dropped even when an entry gets unmasked. Instead, if they can't be made take effect right away, they should take effect on the next unmasking or enabling operation - the specification explicitly describes such caching behavior.

---
 hw/xen/xen_pt.h             |    4 +--
 hw/xen/xen_pt_config_init.c |    2 ++
 hw/xen/xen_pt_msi.c         |   74 ++++++++++++++++---------------------------
 3 files changed, 32 insertions(+), 48 deletions(-)
hw/xen/xen_pt.h +2 -2
index c545280..4f922f4 100644
@@ -187,13 +187,13 @@ typedef struct XenPTMSIXEntry {
     int pirq;
     uint64_t addr;
     uint32_t data;
-    uint32_t vector_ctrl;
+    uint32_t latch[4];
     bool updated; /* indicate whether MSI ADDR or DATA is updated */
-    bool warned;  /* avoid issuing (bogus) warning more than once */
 } XenPTMSIXEntry;
 typedef struct XenPTMSIX {
     uint32_t ctrl_offset;
     bool enabled;
+    bool maskall;
     int total_entries;
     int bar_index;
     uint64_t table_base;
hw/xen/xen_pt_config_init.c +2 -0
index 3d8686d..4fd7206 100644
@@ -1499,6 +1499,8 @@ static int xen_pt_msixctrl_reg_write(XenPCIPassthroughState *s,
         xen_pt_msix_disable(s);
     }
 
+    s->msix->maskall = *val & PCI_MSIX_FLAGS_MASKALL;
+
     debug_msix_enabled_old = s->msix->enabled;
     s->msix->enabled = !!(*val & PCI_MSIX_FLAGS_ENABLE);
     if (s->msix->enabled != debug_msix_enabled_old) {
hw/xen/xen_pt_msi.c +28 -46

128 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 2/4] xen/MSI-X: really enforce alignment

In reply to Stefano Stabellini

From: Jan Beulich <[email protected]>

The way the generic infrastructure works the intention of not allowing unaligned accesses can't be achieved by simply setting .unaligned to false. The benefit is that we can now replace the conditionals in {get,set}_entry_value() by assert()-s.

---
 hw/xen/xen_pt_msi.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)
hw/xen/xen_pt_msi.c +16 -6
index e10cd2a..302a310 100644
@@ -421,16 +421,14 @@ int xen_pt_msix_update_remap(XenPCIPassthroughState *s, int bar_index)
 
 static uint32_t get_entry_value(XenPTMSIXEntry *e, int offset)
 {
-    return !(offset % sizeof(*e->latch))
-           ? e->latch[offset / sizeof(*e->latch)] : 0;
+    assert(!(offset % sizeof(*e->latch)));
+    return e->latch[offset / sizeof(*e->latch)];
 }
 
 static void set_entry_value(XenPTMSIXEntry *e, int offset, uint32_t val)
 {
-    if (!(offset % sizeof(*e->latch)))
-    {
-        e->latch[offset / sizeof(*e->latch)] = val;
-    }
+    assert(!(offset % sizeof(*e->latch)));
+    e->latch[offset / sizeof(*e->latch)] = val;
 }
 
 static void pci_msix_write(void *opaque, hwaddr addr,
@@ -494,6 +492,12 @@ static uint64_t pci_msix_read(void *opaque, hwaddr addr,
     }
 }
 
+static bool pci_msix_accepts(void *opaque, hwaddr addr,
+                             unsigned size, bool is_write)
+{
+    return !(addr & (size - 1));
+}
+
 static const MemoryRegionOps pci_msix_ops = {
     .read = pci_msix_read,
     .write = pci_msix_write,
@@ -502,7 +506,13 @@ static const MemoryRegionOps pci_msix_ops = {
         .min_access_size = 4,
         .max_access_size = 4,
         .unaligned = false,
+        .accepts = pci_msix_accepts
     },
+    .impl = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+        .unaligned = false
+    }
 };
 
 int xen_pt_msix_init(XenPCIPassthroughState *s, uint32_t base)
Signature · 1 line
1.7.10.4
#3 lore raw

[Qemu-devel] [PULL 3/4] xen/pass-through: correctly deal with RW1C bits

In reply to Stefano Stabellini

From: Jan Beulich <[email protected]>

Introduce yet another mask for them, so that the generic routine can handle them, at once rendering xen_pt_pmcsr_reg_write() superfluous.

---
 hw/xen/xen_pt.h             |    2 ++
 hw/xen/xen_pt_config_init.c |   38 ++++++++++++--------------------------
 2 files changed, 14 insertions(+), 26 deletions(-)
hw/xen/xen_pt.h +2 -0
index 4f922f4..3749711 100644
@@ -113,6 +113,8 @@ struct XenPTRegInfo {
     uint32_t res_mask;
     /* reg read only field mask (ON:RO/ROS, OFF:other) */
     uint32_t ro_mask;
+    /* reg read/write-1-clear field mask (ON:RW1C/RW1CS, OFF:other) */
+    uint32_t rw1c_mask;
     /* reg emulate field mask (ON:emu, OFF:passthrough) */
     uint32_t emu_mask;
     xen_pt_conf_reg_init init;
hw/xen/xen_pt_config_init.c +12 -26
index 4fd7206..185a698 100644
@@ -179,7 +179,8 @@ static int xen_pt_byte_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,
     *data = XEN_PT_MERGE_VALUE(*val, *data, writable_mask);
 
     /* create value for writing to I/O device register */
-    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);
+    *val = XEN_PT_MERGE_VALUE(*val, dev_value & ~reg->rw1c_mask,
+                              throughable_mask);
 
     return 0;
 }
@@ -197,7 +198,8 @@ static int xen_pt_word_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,
     *data = XEN_PT_MERGE_VALUE(*val, *data, writable_mask);
 
     /* create value for writing to I/O device register */
-    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);
+    *val = XEN_PT_MERGE_VALUE(*val, dev_value & ~reg->rw1c_mask,
+                              throughable_mask);
 
     return 0;
 }
@@ -215,7 +217,8 @@ static int xen_pt_long_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry,
     *data = XEN_PT_MERGE_VALUE(*val, *data, writable_mask);
 
     /* create value for writing to I/O device register */
-    *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask);
+    *val = XEN_PT_MERGE_VALUE(*val, dev_value & ~reg->rw1c_mask,
+                              throughable_mask);
 
     return 0;
 }
@@ -633,6 +636,7 @@ static XenPTRegInfo xen_pt_emu_reg_header0[] = {
         .init_val   = 0x0000,
         .res_mask   = 0x0007,
         .ro_mask    = 0x06F8,
+        .rw1c_mask  = 0xF900,
         .emu_mask   = 0x0010,
         .init       = xen_pt_status_reg_init,
         .u.w.read   = xen_pt_word_reg_read,
@@ -944,6 +948,7 @@ static XenPTRegInfo xen_pt_emu_reg_pcie[] = {
         .size       = 2,
         .res_mask   = 0xFFC0,
         .ro_mask    = 0x0030,
+        .rw1c_mask  = 0x000F,
         .init       = xen_pt_common_reg_init,
         .u.w.read   = xen_pt_word_reg_read,
         .u.w.write  = xen_pt_word_reg_write,
@@ -964,6 +969,7 @@ static XenPTRegInfo xen_pt_emu_reg_pcie[] = {
         .offset     = PCI_EXP_LNKSTA,
         .size       = 2,
         .ro_mask    = 0x3FFF,
+        .rw1c_mask  = 0xC000,
         .init       = xen_pt_common_reg_init,
         .u.w.read   = xen_pt_word_reg_read,
         .u.w.write  = xen_pt_word_reg_write,
@@ -1000,27 +1006,6 @@ static XenPTRegInfo xen_pt_emu_reg_pcie[] = {
  * Power Management Capability
  */
 
-/* write Power Management Control/Status register */
-static int xen_pt_pmcsr_reg_write(XenPCIPassthroughState *s,
-                                  XenPTReg *cfg_entry, uint16_t *val,
-                                  uint16_t dev_value, uint16_t valid_mask)
-{
-    XenPTRegInfo *reg = cfg_entry->reg;
-    uint16_t writable_mask = 0;
-    uint16_t throughable_mask = get_throughable_mask(s, reg, valid_mask);
-    uint16_t *data = cfg_entry->ptr.half_word;
-
-    /* modify emulate register */
-    writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask;
-    *data = XEN_PT_MERGE_VALUE(*val, *data, writable_mask);
-
-    /* create value for writing to I/O device register */
-    *val = XEN_PT_MERGE_VALUE(*val, dev_value & ~PCI_PM_CTRL_PME_STATUS,
-                              throughable_mask);
-
-    return 0;
-}
-
 /* Power Management Capability reg static information table */
 static XenPTRegInfo xen_pt_emu_reg_pm[] = {
     /* Next Pointer reg */
@@ -1051,11 +1036,12 @@ static XenPTRegInfo xen_pt_emu_reg_pm[] = {
         .size       = 2,
         .init_val   = 0x0008,
         .res_mask   = 0x00F0,
-        .ro_mask    = 0xE10C,
+        .ro_mask    = 0x610C,
+        .rw1c_mask  = 0x8000,
         .emu_mask   = 0x810B,
         .init       = xen_pt_common_reg_init,
         .u.w.read   = xen_pt_word_reg_read,
-        .u.w.write  = xen_pt_pmcsr_reg_write,
+        .u.w.write  = xen_pt_word_reg_write,
     },
     {
         .size = 0,
Signature · 1 line
1.7.10.4
#4 lore raw

[Qemu-devel] [PULL 4/4] xen_disk: treat "vhd" as "vpc"

In reply to Stefano Stabellini

The Xen toolstack uses "vhd" to specify a disk in VHD format, however the name of the driver in QEMU is "vpc". Replace "vhd" with "vpc", so that QEMU can find the right driver to use for it.

---
 hw/block/xen_disk.c |    3 +++
 1 file changed, 3 insertions(+)
hw/block/xen_disk.c +3 -0
index 8146650..a48e726 100644
@@ -825,6 +825,9 @@ static int blk_init(struct XenDevice *xendev)
     if (!strcmp("aio", blkdev->fileproto)) {
         blkdev->fileproto = "raw";
     }
+    if (!strcmp("vhd", blkdev->fileproto)) {
+        blkdev->fileproto = "vpc";
+    }
     if (blkdev->mode == NULL) {
         blkdev->mode = xenstore_read_be_str(&blkdev->xendev, "mode");
     }
Signature · 1 line
1.7.10.4
#5 lore raw
In reply to Stefano Stabellini
Quoted 15 lines · Stefano Stabellini

The following changes since commit c3626ca7df027dabf0568284360a23faf18f0884:

Update version for v2.5.0-rc3 release (2015-12-07 17:47:40 +0000)

are available in the git repository at:

git://xenbits.xen.org/people/sstabellini/qemu-dm.git tags/xen-2015-12-22

for you to fetch changes up to fc3e493bc8e96ef4bf7ae4f035f43cb39382c936:

xen_disk: treat "vhd" as "vpc" (2015-12-11 17:02:37 +0000)

----------------------------------------------------------------
Xen 2015/12/22

Quoted 8 lines

----------------------------------------------------------------
Jan Beulich (3):
xen/MSI-X: latch MSI-X table writes xen/MSI-X: really enforce alignment xen/pass-through: correctly deal with RW1C bits

Stefano Stabellini (1):
xen_disk: treat "vhd" as "vpc"

Applied, thanks.

-- PMM