virtio, pci: fixes

More fixes for 2.9.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJY2vNVAAoJECgfDbjSjVRpJR0H/3d3GNakYN/eDUJCm+PLPZws
 ucYupNmzuTkwektOwg/qnYcq14VDc57M/9eq2ihRucgxI7PH4r8o/eqRGj+LxpJs
 rqeCcTYkQc5kSDItW+9KcJMMoIfhvhHILIKufYXd9zSRWmsXUqOu7bsvnWCg5X1d
 1ukWkGNLtwemmVjThnksGR6Viwx9Uz0JMah3keaJMrQH/7+q87r0odlrA1mx1GH1
 RpvFkbsTbllraB+78zF4hgnXWVl75VP4URiGJaKa/hWPxR6QYz0PSMwNohVRsO1F
 S2GdUf6DJGQQDd9kpfdkQi/N0iEFd54QiAqjLfiOU917QBPtIiths5EvjSMtHhM=
 =gjZ5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio, pci: fixes

More fixes for 2.9.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Wed 29 Mar 2017 00:35:49 BST
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  virtio: fix vring_align() on 64-bit windows
  pci: Add missing drop of bus master AS reference
  event_notifier: prevent accidental use after close

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2017-03-30 13:55:40 +01:00
commit e68dd68496
4 changed files with 6 additions and 1 deletions

View File

@ -869,6 +869,8 @@ static void do_pci_unregister_device(PCIDevice *pci_dev)
pci_dev->bus->devices[pci_dev->devfn] = NULL;
pci_config_free(pci_dev);
memory_region_del_subregion(&pci_dev->bus_master_container_region,
&pci_dev->bus_master_enable_region);
address_space_destroy(&pci_dev->bus_master_as);
}

View File

@ -34,7 +34,7 @@ struct VirtQueue;
static inline hwaddr vring_align(hwaddr addr,
unsigned long align)
{
return (addr + align - 1) & ~(align - 1);
return QEMU_ALIGN_UP(addr, align);
}
typedef struct VirtQueue VirtQueue;

View File

@ -81,8 +81,10 @@ void event_notifier_cleanup(EventNotifier *e)
{
if (e->rfd != e->wfd) {
close(e->rfd);
e->rfd = -1;
}
close(e->wfd);
e->wfd = -1;
}
int event_notifier_get_fd(const EventNotifier *e)

View File

@ -25,6 +25,7 @@ int event_notifier_init(EventNotifier *e, int active)
void event_notifier_cleanup(EventNotifier *e)
{
CloseHandle(e->event);
e->event = NULL;
}
HANDLE event_notifier_get_handle(EventNotifier *e)