A couple trivial fixes for QEMU 2.0:

- Coding correction that allowed attempts to read the device
    ROM after we'd already marked it failed (Bandan)
  - Cosmetic error reporting fixes to remove unnecessary new lines
    and fix a cut-n-paste wording error (Alex)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJTMciRAAoJECObm247sIsidgwP/1Rlu5cLwLlSeqWHgsS8N+Qk
 vnzASjxw2ejRistOBvHQn0zIEuUOjiCcTdqCRfQiOpCj1lxbuBBOEMSN2pkM9xM0
 doqNfN9lKyxtm0BtfE20fAb77Bfi0eVu5ghP5bSFalNfenPIs37UVd+XSjB3Jpq8
 7rMBDN2xGQEfRQ7EEUdrYMUMR4S5np24B1llVcRzVpkrUeJkj/Z3bd1l0SlaCoQf
 qte3cIr1iGUjOE58Inx1oDEDZSvzsRJah7ZSPDVkralIeil7qvHKK4bfLDT2yJBN
 1MQybZJ2YzQEUnGQLSurV2io5e6GgRuyZPymlG73UoAIiAq7uKqcug+Mz/8TYxJI
 ZyqD/+N/WFLc3EWrFaTJ1y2cVPfpZMxquDic+rSg8t7RoxXJ5xDhwRpOS+ms739h
 evPOF9xYuUbDEARfxdBbasClsU+w9o3R73N662jEkxVC+TERt3ap/DUe4vyogXdo
 jm5nGe5k67RsXM0BA8y1f6wcVsl52oTOPnphqTo4EfsUSfQp1ABWuIzUDmoYw6b8
 dbynZTya2qE/fy/DKhAw8maR54umtme7agtBHIMXBbiDzcymNB/3tdqAJ7n77QEr
 TtkWExtLosm3G5epRaOHMDNNBR2JmzkrmnpxWNBx2Zr969H635B2ErjVgYAFg/8H
 0EHJMWH+KTrvOlszZmYC
 =oBrF
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/awilliam/tags/vfio-pci-for-qemu-20140325.0' into staging

A couple trivial fixes for QEMU 2.0:
 - Coding correction that allowed attempts to read the device
   ROM after we'd already marked it failed (Bandan)
 - Cosmetic error reporting fixes to remove unnecessary new lines
   and fix a cut-n-paste wording error (Alex)

# gpg: Signature made Tue 25 Mar 2014 18:18:57 GMT using RSA key ID 3BB08B22
# gpg: Can't check signature: public key not found

* remotes/awilliam/tags/vfio-pci-for-qemu-20140325.0:
  vfio: Cosmetic error reporting fixes
  vfio: Correction in vfio_rom_read when attempting rom loading

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-03-25 18:30:52 +00:00
commit b9bf8a1abb

View File

@ -1043,7 +1043,7 @@ static void vfio_bar_write(void *opaque, hwaddr addr,
buf.dword = cpu_to_le32(data);
break;
default:
hw_error("vfio: unsupported write size, %d bytes\n", size);
hw_error("vfio: unsupported write size, %d bytes", size);
break;
}
@ -1103,7 +1103,7 @@ static uint64_t vfio_bar_read(void *opaque,
data = le32_to_cpu(buf.dword);
break;
default:
hw_error("vfio: unsupported read size, %d bytes\n", size);
hw_error("vfio: unsupported read size, %d bytes", size);
break;
}
@ -1157,7 +1157,7 @@ static void vfio_pci_load_rom(VFIODevice *vdev)
if (!vdev->rom_size) {
vdev->rom_read_failed = true;
error_report("vfio-pci: Cannot read device rom at "
"%04x:%02x:%02x.%x\n",
"%04x:%02x:%02x.%x",
vdev->host.domain, vdev->host.bus, vdev->host.slot,
vdev->host.function);
error_printf("Device option ROM contents are probably invalid "
@ -1192,11 +1192,8 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size)
uint64_t val = ((uint64_t)1 << (size * 8)) - 1;
/* Load the ROM lazily when the guest tries to read it */
if (unlikely(!vdev->rom)) {
if (unlikely(!vdev->rom && !vdev->rom_read_failed)) {
vfio_pci_load_rom(vdev);
if (unlikely(!vdev->rom && !vdev->rom_read_failed)) {
vfio_pci_load_rom(vdev);
}
}
memcpy(&val, vdev->rom + addr,
@ -1341,7 +1338,7 @@ static void vfio_vga_write(void *opaque, hwaddr addr,
buf.dword = cpu_to_le32(data);
break;
default:
hw_error("vfio: unsupported write size, %d bytes\n", size);
hw_error("vfio: unsupported write size, %d bytes", size);
break;
}
@ -1384,7 +1381,7 @@ static uint64_t vfio_vga_read(void *opaque, hwaddr addr, unsigned size)
data = le32_to_cpu(buf.dword);
break;
default:
hw_error("vfio: unsupported read size, %d bytes\n", size);
hw_error("vfio: unsupported read size, %d bytes", size);
break;
}
@ -1429,7 +1426,7 @@ static uint64_t vfio_generic_window_quirk_read(void *opaque,
if (!vfio_range_contained(addr, size, quirk->data.data_offset,
quirk->data.data_size)) {
hw_error("%s: window data read not fully contained: %s\n",
hw_error("%s: window data read not fully contained: %s",
__func__, memory_region_name(&quirk->mem));
}
@ -1458,7 +1455,7 @@ static void vfio_generic_window_quirk_write(void *opaque, hwaddr addr,
quirk->data.address_offset, quirk->data.address_size)) {
if (addr != quirk->data.address_offset) {
hw_error("%s: offset write into address window: %s\n",
hw_error("%s: offset write into address window: %s",
__func__, memory_region_name(&quirk->mem));
}
@ -1479,7 +1476,7 @@ static void vfio_generic_window_quirk_write(void *opaque, hwaddr addr,
if (!vfio_range_contained(addr, size, quirk->data.data_offset,
quirk->data.data_size)) {
hw_error("%s: window data write not fully contained: %s\n",
hw_error("%s: window data write not fully contained: %s",
__func__, memory_region_name(&quirk->mem));
}
@ -1515,7 +1512,7 @@ static uint64_t vfio_generic_quirk_read(void *opaque,
ranges_overlap(addr, size, offset, quirk->data.address_mask + 1)) {
if (!vfio_range_contained(addr, size, offset,
quirk->data.address_mask + 1)) {
hw_error("%s: read not fully contained: %s\n",
hw_error("%s: read not fully contained: %s",
__func__, memory_region_name(&quirk->mem));
}
@ -1544,7 +1541,7 @@ static void vfio_generic_quirk_write(void *opaque, hwaddr addr,
ranges_overlap(addr, size, offset, quirk->data.address_mask + 1)) {
if (!vfio_range_contained(addr, size, offset,
quirk->data.address_mask + 1)) {
hw_error("%s: write not fully contained: %s\n",
hw_error("%s: write not fully contained: %s",
__func__, memory_region_name(&quirk->mem));
}
@ -2302,7 +2299,7 @@ static void vfio_listener_region_add(MemoryListener *listener,
container->iommu_data.type1.error = ret;
}
} else {
hw_error("vfio: DMA mapping failed, unable to continue\n");
hw_error("vfio: DMA mapping failed, unable to continue");
}
}
}
@ -2972,7 +2969,7 @@ static void vfio_pci_pre_reset(VFIODevice *vdev)
pmcsr = vfio_pci_read_config(pdev, vdev->pm_cap + PCI_PM_CTRL, 2);
state = pmcsr & PCI_PM_CTRL_STATE_MASK;
if (state) {
error_report("vfio: Unable to power on device, stuck in D%d\n",
error_report("vfio: Unable to power on device, stuck in D%d",
state);
}
}
@ -3271,7 +3268,7 @@ static void vfio_kvm_device_del_group(VFIOGroup *group)
}
if (ioctl(vfio_kvm_device_fd, KVM_SET_DEVICE_ATTR, &attr)) {
error_report("Failed to remove group %d to KVM VFIO device: %m",
error_report("Failed to remove group %d from KVM VFIO device: %m",
group->groupid);
}
#endif
@ -3339,7 +3336,7 @@ static int vfio_connect_container(VFIOGroup *group)
vfio_listener_release(container);
g_free(container);
close(fd);
error_report("vfio: memory listener initialization failed for container\n");
error_report("vfio: memory listener initialization failed for container");
return ret;
}