Re: [libvirt] [PATCH v4 11/25] [ACKED] qemu: replace calls to virDomainPCIAddressReserveNext*() with static function

2016-10-19 Thread Andrea Bolognani
On Fri, 2016-10-14 at 15:54 -0400, Laine Stump wrote:
> An upcoming commit will remove the "flag" argument from all the calls
> to reserve the next available address|slot, but I don't want to change
> the arguments in the hypervisor-agnostic
> virDomainPCIAddressReserveNext*() functions, so this patch places a
> simple qemu-specific wrapper around those functions - the new
> functions don't take a flags arg, but grab it from the device's
> info->pciConnectFlags.
> ---
> Change: realigned/reformatted
> 
>  src/qemu/qemu_domain_address.c | 96 
>++
>  1 file changed, 59 insertions(+), 37 deletions(-)

[...]
> @@ -691,7 +712,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
>  
>  if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
>  if (qemuDeviceVideoUsable) {
> -if (virDomainPCIAddressReserveNextSlot(addrs,
> +if (qemuDomainPCIAddressReserveNextSlot(addrs,
> 
>&primaryVideo->info,
> flags) < 0)

Alignment's still off here.

ACK with that fixed.

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v4 11/25] [ACKED] qemu: replace calls to virDomainPCIAddressReserveNext*() with static function

2016-10-14 Thread Laine Stump
An upcoming commit will remove the "flag" argument from all the calls
to reserve the next available address|slot, but I don't want to change
the arguments in the hypervisor-agnostic
virDomainPCIAddressReserveNext*() functions, so this patch places a
simple qemu-specific wrapper around those functions - the new
functions don't take a flags arg, but grab it from the device's
info->pciConnectFlags.
---
Change: realigned/reformatted

 src/qemu/qemu_domain_address.c | 96 ++
 1 file changed, 59 insertions(+), 37 deletions(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index fa52383..b4ea906 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -406,6 +406,27 @@ qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
 
 
 static int
+qemuDomainPCIAddressReserveNextAddr(virDomainPCIAddressSetPtr addrs,
+virDomainDeviceInfoPtr dev,
+virDomainPCIConnectFlags flags,
+unsigned int function,
+bool reserveEntireSlot)
+{
+return virDomainPCIAddressReserveNextAddr(addrs, dev, flags,
+  function, reserveEntireSlot);
+}
+
+
+static int
+qemuDomainPCIAddressReserveNextSlot(virDomainPCIAddressSetPtr addrs,
+virDomainDeviceInfoPtr dev,
+virDomainPCIConnectFlags flags)
+{
+return qemuDomainPCIAddressReserveNextAddr(addrs, dev, flags, 0, true);
+}
+
+
+static int
 qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED,
 virDomainDeviceDefPtr device,
 virDomainDeviceInfoPtr info,
@@ -691,7 +712,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
 
 if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
 if (qemuDeviceVideoUsable) {
-if (virDomainPCIAddressReserveNextSlot(addrs,
+if (qemuDomainPCIAddressReserveNextSlot(addrs,
&primaryVideo->info,
flags) < 0)
 goto cleanup;
@@ -882,7 +903,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
 
 if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
 if (qemuDeviceVideoUsable) {
-if (virDomainPCIAddressReserveNextSlot(addrs,
+if (qemuDomainPCIAddressReserveNextSlot(addrs,
&primaryVideo->info,
flags) < 0)
 goto cleanup;
@@ -919,7 +940,8 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
   " device will not be possible without manual"
   " intervention");
 virResetLastError();
-} else if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 
0) {
+} else if (virDomainPCIAddressReserveSlot(addrs,
+  &tmp_addr, flags) < 0) {
 goto cleanup;
 }
 }
@@ -1023,8 +1045,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
  * controller/bus to connect it to on the upstream side.
  */
 flags = virDomainPCIControllerModelToConnectType(model);
-if (virDomainPCIAddressReserveNextSlot(addrs,
-   &cont->info, flags) < 0) {
+if (qemuDomainPCIAddressReserveNextSlot(addrs,
+&cont->info, flags) < 0) {
 goto error;
 }
 }
@@ -1043,8 +1065,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 
 /* Only support VirtIO-9p-pci so far. If that changes,
  * we might need to skip devices here */
-if (virDomainPCIAddressReserveNextSlot(addrs, &def->fss[i]->info,
-   flags) < 0)
+if (qemuDomainPCIAddressReserveNextSlot(addrs, &def->fss[i]->info,
+flags) < 0)
 goto error;
 }
 
@@ -1060,7 +1082,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 !virDeviceInfoPCIAddressWanted(&net->info)) {
 continue;
 }
-if (virDomainPCIAddressReserveNextSlot(addrs, &net->info, flags) < 0)
+if (qemuDomainPCIAddressReserveNextSlot(addrs, &net->info, flags) < 0)
 goto error;
 }
 
@@ -1076,7 +1098,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
 sound->model == VIR_DOMAIN_SOUND_MODEL_USB)
 continue;
 
-if (virDomainPCIAddressReserveNextSlot(addrs, &sound->info, flags) <