Re: [PATCH v3 1/1] docs : add doc on cpu model and features

2025-09-02 Thread Jiri Denemark via Devel
On Wed, Aug 27, 2025 at 16:25:06 +0200, Hector Cao wrote:
> Add documentation on the way libvirt displays the Host CPU
> model and capabilities (features). There is an implicit
> expectation from users to get the CPU model name matching the
> CPU model they are running on, however, this does not happen
> most of the time. As a consequence, having a documentation
> is useful both for users to align their expectation and for
> us to point to a place where the situation is clearly explained.
> 
> Signed-off-by: Hector Cao 
> ---
>  docs/formatcaps.rst | 44 
>  1 file changed, 44 insertions(+)
> 
> diff --git a/docs/formatcaps.rst b/docs/formatcaps.rst
> index 7e525487e7..3cf83b7c6a 100644
> --- a/docs/formatcaps.rst
> +++ b/docs/formatcaps.rst
> @@ -97,6 +97,50 @@ The  element consists of the following child 
> elements:
> parse this element. In contrast with the former elements, this is repeated
> for each security model the libvirt daemon currently supports.
>  
> +Host CPU model and features
> +^^^
> +
> +As described previously in this section, libvirt exposes to
> +users the list of Host CPU features. Libvirt has a special way to
> +expose this list: Instead of providing the full (and thereby often
> +very long) set of features, libvirt specifies a CPU model as
> +baseline and additional features on top of it (as can be seen in
> +`Examples`_ where the baseline is ``Skylake-Client-noTSX-IBRS``).
> +
> +The ideal case would be that the baseline CPU model definition matches
> +exactly the CPU present in the system, and no additional feature is
> +needed to express the capabilities of the CPU. For example, if you are
> +running on a Server CPU you bought as ``Icelake`` type, the returned
> +CPU model name could be ``Icelake-Server``. However, this ideal
> +situation rarely happens, for two main reasons:
> +
> +- Manufacturers do not ship a single type of CPU under a given name,
> +  there are various different SKUs with different features under the
> +  same name. Yet it is not practical to have a database listing all of
> +  those variants.
> +
> +- Some features might be in the hardware but unavailable for various
> +  reasons (BIOS and kernel configuration, disabled for security,
> +  ...). One typical example where this situation happens is related to
> +  the `TSX mitigation 
> `__.
> +  As a mitigation to the TAA side channel attack, the Linux kernel disables
> +  by default TSX and its 2 features, ``rtm`` and ``hle``. Since many Linux
> +  distributions keep this safer default behavior, these 2 features appear
> +  as missing.
> +
> +Because for backward compatibility reasons, host capabilities cannot
> +list features that would need to be removed from the baseline model to
> +describe the host CPU, libvirt has to often use a rather old CPU
> +model, for example, ``Broadwell`` rather than ``Icelake``. Therefore,
> +users *shouldnot* expect the reported CPU model name to have any

s/shouldnot/should not/
...

Reviewed-by: Jiri Denemark 

And pushed, thanks.



Re: [PATCH 09/13] ch: add disk attach functionality

2025-09-02 Thread Michal Prívozník via Devel
On 8/28/25 14:54, Stefan Kober wrote:
> On-behalf-of: SAP stefan.ko...@sap.com
> Signed-off-by: Stefan Kober 
> ---
>  src/ch/ch_driver.c  |   2 +-
>  src/ch/ch_hotplug.c | 131 ++--
>  src/ch/ch_monitor.c |  17 ++
>  src/ch/ch_monitor.h |   4 ++
>  4 files changed, 149 insertions(+), 5 deletions(-)
> 
> diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
> index 39f9d934c0..0484201c88 100644
> --- a/src/ch/ch_driver.c
> +++ b/src/ch/ch_driver.c
> @@ -2366,7 +2366,7 @@ chDomainAttachDeviceFlags(virDomainPtr dom,
>  if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
>  goto endjob;
>  
> -if (chDomainAttachDeviceLiveAndConfig(vm, driver, xml, flags) < 0) {
> +if (chDomainAttachDeviceLiveAndUpdateConfig(vm, driver, xml, flags) < 0) 
> {


This should have been squashed to one of previous patches that
introduced the incorrect function call.

>  goto endjob;
>  }
>  
> diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c
> index c46628e7e9..524355b93c 100644
> --- a/src/ch/ch_hotplug.c
> +++ b/src/ch/ch_hotplug.c
> @@ -18,18 +18,141 @@
>  
>  #include 
>  
> +#include "ch_alias.h"
> +#include "ch_domain.h"
>  #include "ch_hotplug.h"
>  
> +#include "domain_event.h"
> +#include "domain_validate.h"
> +#include "virlog.h"
> +
>  #define VIR_FROM_THIS VIR_FROM_CH
>  
> +VIR_LOG_INIT("ch.ch_hotplug");
> +
> +static int
> +chDomainAddDisk(virCHMonitor *mon, virDomainObj *vm, virDomainDiskDef *disk)
> +{
> +if (chAssignDeviceDiskAlias(disk) < 0) {
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +_("Assigning disk alias failed"));
> +return -1;
> +}
> +
> +if (virCHMonitorAddDisk(mon, disk) < 0) {
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +_("Adding disk to domain failed"));
> +return -1;
> +}
> +
> +virDomainDiskInsert(vm->def, disk);
> +
> +return 0;
> +}
> +
> +static int
> +chDomainAttachDeviceLive(virDomainObj *vm,
> + virDomainDeviceDef *dev)
> +{
> +int ret = -1;
> +virCHDomainObjPrivate *priv = vm->privateData;
> +virCHMonitor *mon = priv->monitor;
> +
> +switch (dev->type) {
> +case VIR_DOMAIN_DEVICE_DISK: {
> +if (chDomainAddDisk(mon, vm, dev->data.disk) < 0) {
> +break;
> +}
> +
> +dev->data.disk = NULL;
> +ret = 0;
> +break;
> +}
> +case VIR_DOMAIN_DEVICE_NET:
> +case VIR_DOMAIN_DEVICE_LEASE:
> +case VIR_DOMAIN_DEVICE_FS:
> +case VIR_DOMAIN_DEVICE_INPUT:
> +case VIR_DOMAIN_DEVICE_HOSTDEV:
> +case VIR_DOMAIN_DEVICE_WATCHDOG:
> +case VIR_DOMAIN_DEVICE_CONTROLLER:
> +case VIR_DOMAIN_DEVICE_REDIRDEV:
> +case VIR_DOMAIN_DEVICE_CHR:
> +case VIR_DOMAIN_DEVICE_RNG:
> +case VIR_DOMAIN_DEVICE_SHMEM:
> +case VIR_DOMAIN_DEVICE_MEMORY:
> +case VIR_DOMAIN_DEVICE_VSOCK:
> +case VIR_DOMAIN_DEVICE_NONE:
> +case VIR_DOMAIN_DEVICE_SOUND:
> +case VIR_DOMAIN_DEVICE_VIDEO:
> +case VIR_DOMAIN_DEVICE_GRAPHICS:
> +case VIR_DOMAIN_DEVICE_HUB:
> +case VIR_DOMAIN_DEVICE_SMARTCARD:
> +case VIR_DOMAIN_DEVICE_MEMBALLOON:
> +case VIR_DOMAIN_DEVICE_NVRAM:
> +case VIR_DOMAIN_DEVICE_TPM:
> +case VIR_DOMAIN_DEVICE_PANIC:
> +case VIR_DOMAIN_DEVICE_IOMMU:
> +case VIR_DOMAIN_DEVICE_AUDIO:
> +case VIR_DOMAIN_DEVICE_CRYPTO:
> +case VIR_DOMAIN_DEVICE_PSTORE:
> +case VIR_DOMAIN_DEVICE_LAST:
> +default:
> +virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
> +   _("live attach of device '%1$s' is not supported"),
> +   virDomainDeviceTypeToString(dev->type));
> +break;
> +}
> +
> +return ret;
> +}
> +
>  int
> -chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm G_GNUC_UNUSED,
> -virCHDriver *driver G_GNUC_UNUSED,
> -const char *xml G_GNUC_UNUSED,
> +chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm,
> +virCHDriver *driver,
> +const char *xml,
>  unsigned int flags)
>  {
> +unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
> +   VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
> +g_autoptr(virDomainDeviceDef) devLive = NULL;
> +g_autoptr(virDomainDef) vmdef = NULL;
> +g_autoptr(virCHDriverConfig) cfg = NULL;
> +g_autoptr(virDomainDeviceDef) devConf = NULL;
> +
>  virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
>VIR_DOMAIN_AFFECT_CONFIG, -1);
>  
> -return -1;
> +cfg = virCHDriverGetConfig(driver);
> +
> +if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
> +virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
> +   _("Persistent domain state changes are not 
> supported"));
> +return -1;
> +   

[PATCH v2 03/13] ch: add ch_hotplug.{h,c} files to CH build

2025-09-02 Thread Stefan Kober
The files are meant to contain all device hotplug related code. The
first implementation will be live storage attach and detach.

On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_hotplug.c | 35 +++
 src/ch/ch_hotplug.h | 27 +++
 src/ch/meson.build  |  2 ++
 3 files changed, 64 insertions(+)
 create mode 100644 src/ch/ch_hotplug.c
 create mode 100644 src/ch/ch_hotplug.h

diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c
new file mode 100644
index 00..c46628e7e9
--- /dev/null
+++ b/src/ch/ch_hotplug.c
@@ -0,0 +1,35 @@
+/*
+ * ch_hotplug.c: CH device hotplug handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * .
+ */
+
+#include 
+
+#include "ch_hotplug.h"
+
+#define VIR_FROM_THIS VIR_FROM_CH
+
+int
+chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm G_GNUC_UNUSED,
+virCHDriver *driver G_GNUC_UNUSED,
+const char *xml G_GNUC_UNUSED,
+unsigned int flags)
+{
+virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+  VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+return -1;
+}
diff --git a/src/ch/ch_hotplug.h b/src/ch/ch_hotplug.h
new file mode 100644
index 00..04915ba5de
--- /dev/null
+++ b/src/ch/ch_hotplug.h
@@ -0,0 +1,27 @@
+/*
+ * ch_hotplug.h: CH device hotplug handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * .
+ */
+
+#pragma once
+
+#include "ch_conf.h"
+
+int
+chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm,
+virCHDriver *driver,
+const char *xml,
+unsigned int flags);
diff --git a/src/ch/meson.build b/src/ch/meson.build
index cd20c3d065..bba7ee90ee 100644
--- a/src/ch/meson.build
+++ b/src/ch/meson.build
@@ -17,6 +17,8 @@ ch_driver_sources = [
   'ch_process.h',
   'ch_hostdev.c',
   'ch_hostdev.h',
+  'ch_hotplug.c',
+  'ch_hotplug.h',
 ]
 
 driver_source_files += files(ch_driver_sources)
-- 
2.50.1



Re: [SPAM] [PATCH v1 1/4] hw/arm: Remove ast2700a0-evb machine

2025-09-02 Thread Cédric Le Goater

Hello Jamin,

On 9/1/25 06:08, Jamin Lin wrote:

The ast2700a0-evb machine represents the first revision of the AST2700 and
serves as the initial engineering sample rather than a production version.
A newer revision, A1, is now supported, and the ast2700a1-evb should replace
the older A0 version.

Signed-off-by: Jamin Lin 
---
  docs/about/deprecated.rst |  8 --
  hw/arm/aspeed.c   | 28 +--
  .../functional/aarch64/test_aspeed_ast2700.py | 12 
  3 files changed, 1 insertion(+), 47 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 5d1579dcf8..8a273e019a 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -305,14 +305,6 @@ deprecated; use the new name ``dtb-randomness`` instead. 
The new name
  better reflects the way this property affects all random data within
  the device tree blob, not just the ``kaslr-seed`` node.
  
-Arm ``ast2700a0-evb`` machine (since 10.1)

-''


We need to wait *two* releases after deprecation before removing a
machine or any other feature. So removal of the ast2700a0-evb machine
will be possible for QEMU 11.0 (next after QEMU 10.2).


-
-The ``ast2700a0-evb`` machine represents the first revision of the AST2700
-and serves as the initial engineering sample rather than a production version.
-A newer revision, A1, is now supported, and the ``ast2700a1-evb`` should
-replace the older A0 version.
-


File docs/about/removed-features.rst should be updated too.


  Mips ``mipssim`` machine (since 10.0)
  '
  
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c

index c31bbe7701..e729edfe13 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1989,35 +1989,13 @@ static void ast2700_evb_i2c_init(AspeedMachineState 
*bmc)
  TYPE_TMP105, 0x4d);
  }
  
-static void aspeed_machine_ast2700a0_evb_class_init(ObjectClass *oc,

-const void *data)
-{
-MachineClass *mc = MACHINE_CLASS(oc);
-AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
-
-mc->alias = "ast2700-evb";


The "ast2700-evb" alias should be moved first to the ast2700a1_evb machine.
This can be done in this QEMU cycle


Thanks,

C.





-mc->desc = "Aspeed AST2700 A0 EVB (Cortex-A35)";
-amc->soc_name  = "ast2700-a0";
-amc->hw_strap1 = AST2700_EVB_HW_STRAP1;
-amc->hw_strap2 = AST2700_EVB_HW_STRAP2;
-amc->fmc_model = "w25q01jvq";
-amc->spi_model = "w25q512jv";
-amc->num_cs= 2;
-amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON;
-amc->uart_default = ASPEED_DEV_UART12;
-amc->i2c_init  = ast2700_evb_i2c_init;
-amc->vbootrom = true;
-mc->auto_create_sdcard = true;
-mc->default_ram_size = 1 * GiB;
-aspeed_machine_class_init_cpus_defaults(mc);
-}
-
  static void aspeed_machine_ast2700a1_evb_class_init(ObjectClass *oc,
  const void *data)
  {
  MachineClass *mc = MACHINE_CLASS(oc);
  AspeedMachineClass *amc = ASPEED_MACHINE_CLASS(oc);
  
+mc->alias = "ast2700-evb";

  mc->desc = "Aspeed AST2700 A1 EVB (Cortex-A35)";
  amc->soc_name  = "ast2700-a1";
  amc->hw_strap1 = AST2700_EVB_HW_STRAP1;
@@ -2166,10 +2144,6 @@ static const TypeInfo aspeed_machine_types[] = {
  .class_init = aspeed_minibmc_machine_ast1030_evb_class_init,
  #ifdef TARGET_AARCH64
  }, {
-.name  = MACHINE_TYPE_NAME("ast2700a0-evb"),
-.parent= TYPE_ASPEED_MACHINE,
-.class_init= aspeed_machine_ast2700a0_evb_class_init,
-}, {
  .name  = MACHINE_TYPE_NAME("ast2700a1-evb"),
  .parent= TYPE_ASPEED_MACHINE,
  .class_init= aspeed_machine_ast2700a1_evb_class_init,
diff --git a/tests/functional/aarch64/test_aspeed_ast2700.py 
b/tests/functional/aarch64/test_aspeed_ast2700.py
index d02dc7991c..063d9e572c 100755
--- a/tests/functional/aarch64/test_aspeed_ast2700.py
+++ b/tests/functional/aarch64/test_aspeed_ast2700.py
@@ -46,10 +46,6 @@ def verify_openbmc_boot_and_login(self, name):
  exec_command_and_wait_for_pattern(self, 'root', 'Password:')
  exec_command_and_wait_for_pattern(self, '0penBmc', f'root@{name}:~#')
  
-ASSET_SDK_V906_AST2700 = Asset(

-
'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-a0-default-obmc.tar.gz',
-'7247b6f19dbfb700686f8d9f723ac23f3eb229226c0589cb9b06b80d1b61f3cb')
-
  ASSET_SDK_V906_AST2700A1 = Asset(
  
'https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.06/ast2700-default-obmc.tar.gz',
  
'f1d53e0be8a404ecce3e105f72bc50fa4e090ad13160ffa91b10a6e0233a9dc6')
@@ -111,14 +107,6 @@ def start_ast2700_test_vbootrom(self, name):
  self.do_test_aarch64_aspeed_sdk_start(
  self.scra

[PATCH v2 01/13] ch: add DomainAttachDevice skeletons

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_driver.c | 37 +
 1 file changed, 37 insertions(+)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index cf6874f22e..7e8f73564e 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -2344,6 +2344,40 @@ chDomainInterfaceAddresses(virDomain *dom,
 return ret;
 }
 
+static int
+chDomainAttachDeviceFlags(virDomainPtr dom,
+  const char *xml G_GNUC_UNUSED,
+  unsigned int flags)
+{
+virDomainObj *vm = NULL;
+int ret = -1;
+
+if (!(vm = virCHDomainObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainAttachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
+goto cleanup;
+
+if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
+goto endjob;
+
+ endjob:
+virDomainObjEndJob(vm);
+
+ cleanup:
+virDomainObjEndAPI(&vm);
+return ret;
+}
+
+static int
+chDomainAttachDevice(virDomainPtr dom,
+ const char *xml)
+{
+return chDomainAttachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE);
+}
 
 /* Function Tables */
 static virHypervisorDriver chHypervisorDriver = {
@@ -2406,6 +2440,9 @@ static virHypervisorDriver chHypervisorDriver = {
 .connectDomainEventRegisterAny = chConnectDomainEventRegisterAny,   /* 
10.10.0 */
 .connectDomainEventDeregisterAny = chConnectDomainEventDeregisterAny,   /* 
10.10.0 */
 .domainInterfaceAddresses = chDomainInterfaceAddresses, /* 11.0.0 */
+.domainAttachDevice = chDomainAttachDevice, /* 11.8.0 */
+.domainAttachDeviceFlags = chDomainAttachDeviceFlags, /* 11.8.0 */
+
 };
 
 static virConnectDriver chConnectDriver = {
-- 
2.50.1



[PATCH v2 05/13] ch: pass disk alias to CHV

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_monitor.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 6bf877fef3..d369236183 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -249,6 +249,11 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, 
virDomainDiskDef *diskdef)
_("Missing disk file path in domain"));
 return -1;
 }
+if (!diskdef->info.alias) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+   _("Missing disk alias"));
+return -1;
+}
 if (diskdef->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
 virReportError(VIR_ERR_INVALID_ARG,
_("Only virtio bus types are supported for '%1$s'"),
@@ -261,6 +266,9 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, 
virDomainDiskDef *diskdef)
 if (virJSONValueObjectAppendBoolean(disk, "readonly", true) < 0)
 return -1;
 }
+if (virJSONValueObjectAppendString(disk, "id", diskdef->info.alias) < 
0) {
+return -1;
+}
 if (virJSONValueArrayAppend(disks, &disk) < 0)
 return -1;
 
-- 
2.50.1



[PATCH v2 11/13] ch: Add virCHMonitorRemoveDevice function

2025-09-02 Thread Stefan Kober
The function calls the respective CH API to remove a device of any type
from a VM.

On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_monitor.c | 13 +
 src/ch/ch_monitor.h |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 8968d84a71..ee629f61fb 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -596,6 +596,19 @@ virCHMonitorBuildKeyValueStringJson(char **jsonstr,
 return 0;
 }
 
+int virCHMonitorRemoveDevice(virCHMonitor *mon,
+ const char* device_id)
+{
+g_autofree char *payload = NULL;
+
+if (virCHMonitorBuildKeyValueStringJson(&payload, "id", device_id) != 0)
+return -1;
+
+VIR_DEBUG("Remove device %s", device_id);
+
+return virCHMonitorPut(mon, URL_VM_REMOVE_DEVICE, payload, NULL, NULL);
+}
+
 static int
 chMonitorCreateSocket(const char *socket_path)
 {
diff --git a/src/ch/ch_monitor.h b/src/ch/ch_monitor.h
index 8338059c7c..e8fa393e54 100644
--- a/src/ch/ch_monitor.h
+++ b/src/ch/ch_monitor.h
@@ -41,6 +41,7 @@
 #define URL_VM_SAVE "vm.snapshot"
 #define URL_VM_RESTORE "vm.restore"
 #define URL_VM_ADD_DISK "vm.add-disk"
+#define URL_VM_REMOVE_DEVICE "vm.remove-device"
 
 #define VIRCH_THREAD_NAME_LEN   16
 
@@ -141,6 +142,8 @@ virCHMonitorBuildNetJson(virDomainNetDef *netdef,
  char **jsonstr);
 int
 virCHMonitorAddDisk(virCHMonitor* mon, virDomainDiskDef *diskdef);
+int virCHMonitorRemoveDevice(virCHMonitor *mon,
+ const char* device_id);
 
 int virCHMonitorBuildRestoreJson(virDomainDef *vmdef,
  const char *from,
-- 
2.50.1



[PATCH v2 08/13] ch: use MonitorPut in MonitorPutNoContent

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_monitor.c | 40 +---
 1 file changed, 1 insertion(+), 39 deletions(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 63c8425b4b..5f3e2adbee 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -931,45 +931,7 @@ int
 virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint,
  domainLogContext *logCtxt)
 {
-VIR_LOCK_GUARD lock = virObjectLockGuard(mon);
-g_autofree char *url = NULL;
-int responseCode = 0;
-int ret = -1;
-struct curl_data data = {0};
-struct curl_slist *headers = NULL;
-
-url = g_strdup_printf("%s/%s", URL_ROOT, endpoint);
-
-/* reset all options of a libcurl session handle at first */
-curl_easy_reset(mon->handle);
-
-curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpath);
-curl_easy_setopt(mon->handle, CURLOPT_URL, url);
-curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
-curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
-curl_easy_setopt(mon->handle, CURLOPT_INFILESIZE, 0L);
-
-headers = curl_slist_append(headers, "Accept: application/json");
-curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, headers);
-curl_easy_setopt(mon->handle, CURLOPT_WRITEFUNCTION, curl_callback);
-curl_easy_setopt(mon->handle, CURLOPT_WRITEDATA, (void *)&data);
-
-responseCode = virCHMonitorCurlPerform(mon->handle);
-
-if (logCtxt && data.size) {
-/* Do this to append a NULL char at the end of data */
-data.content = g_realloc(data.content, data.size + 1);
-data.content[data.size] = 0;
-domainLogContextWrite(logCtxt, "HTTP response code from CH: %d\n", 
responseCode);
-domainLogContextWrite(logCtxt, "Response = %s\n", data.content);
-}
-
-if (responseCode == 200 || responseCode == 204)
-ret = 0;
-
-curl_slist_free_all(headers);
-
-return ret;
+return virCHMonitorPut(mon, endpoint, NULL, logCtxt, NULL);
 }
 
 static int
-- 
2.50.1



[PATCH v2 10/13] ch: assign aliases in ProcessPrepareDomain

2025-09-02 Thread Stefan Kober
This is required to have unique device aliases for devices throughout
the domain lifecycle.

On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_process.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/ch/ch_process.c b/src/ch/ch_process.c
index cd2e88af1e..550bfefae1 100644
--- a/src/ch/ch_process.c
+++ b/src/ch/ch_process.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 
+#include "ch_alias.h"
 #include "ch_domain.h"
 #include "ch_monitor.h"
 #include "ch_process.h"
@@ -889,6 +890,9 @@ virCHProcessPrepareDomain(virDomainObj *vm)
 if (virCHProcessPrepareDomainHostdevs(vm) < 0)
 return -1;
 
+if (chAssignDeviceAliases(vm->def) < 0)
+return -1;
+
 return 0;
 }
 
-- 
2.50.1



[PATCH v2 02/13] ch: add DomainDetachDevice skeletons

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_driver.c | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 7e8f73564e..e5e1bfd7d1 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -2379,6 +2379,40 @@ chDomainAttachDevice(virDomainPtr dom,
 return chDomainAttachDeviceFlags(dom, xml, VIR_DOMAIN_AFFECT_LIVE);
 }
 
+static int
+chDomainDetachDeviceFlags(virDomainPtr dom,
+  const char *xml G_GNUC_UNUSED,
+  unsigned int flags)
+{
+virDomainObj *vm = NULL;
+int ret = -1;
+
+if (!(vm = virCHDomainObjFromDomain(dom)))
+goto cleanup;
+
+if (virDomainDetachDeviceFlagsEnsureACL(dom->conn, vm->def, flags) < 0)
+goto cleanup;
+
+if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
+goto cleanup;
+
+if (virDomainObjUpdateModificationImpact(vm, &flags) < 0)
+goto endjob;
+
+ endjob:
+virDomainObjEndJob(vm);
+
+ cleanup:
+virDomainObjEndAPI(&vm);
+return ret;
+}
+
+static int chDomainDetachDevice(virDomainPtr dom, const char *xml)
+{
+return chDomainDetachDeviceFlags(dom, xml,
+ VIR_DOMAIN_AFFECT_LIVE);
+}
+
 /* Function Tables */
 static virHypervisorDriver chHypervisorDriver = {
 .name = "CH",
@@ -2442,7 +2476,8 @@ static virHypervisorDriver chHypervisorDriver = {
 .domainInterfaceAddresses = chDomainInterfaceAddresses, /* 11.0.0 */
 .domainAttachDevice = chDomainAttachDevice, /* 11.8.0 */
 .domainAttachDeviceFlags = chDomainAttachDeviceFlags, /* 11.8.0 */
-
+.domainDetachDevice = chDomainDetachDevice, /* 11.8.0 */
+.domainDetachDeviceFlags = chDomainDetachDeviceFlags, /* 11.8.0 */
 };
 
 static virConnectDriver chConnectDriver = {
-- 
2.50.1



[PATCH v2 07/13] ch: add virCHMonitorPut function

2025-09-02 Thread Stefan Kober
This allows users to call API endpoints that require passing data in a
generic way. Previously, only virCHMonitorPutNoContent was offered.

On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_monitor.c | 61 +
 1 file changed, 61 insertions(+)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index d369236183..63c8425b4b 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -62,6 +62,10 @@ VIR_ONCE_GLOBAL_INIT(virCHMonitor);
 int virCHMonitorShutdownVMM(virCHMonitor *mon);
 int virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint,
  domainLogContext *logCtxt);
+int
+virCHMonitorPut(virCHMonitor *mon, const char *endpoint,
+const char *payload, domainLogContext *logCtxt,
+virJSONValue** answer);
 
 static int
 virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef)
@@ -866,6 +870,63 @@ curl_callback(void *contents, size_t size, size_t nmemb, 
void *userp)
 return content_size;
 }
 
+int
+virCHMonitorPut(virCHMonitor *mon, const char *endpoint,
+const char *payload, domainLogContext *logCtxt,
+virJSONValue** answer)
+{
+VIR_LOCK_GUARD lock = virObjectLockGuard(mon);
+g_autofree char *url = NULL;
+int responseCode = 0;
+struct curl_data data = {0};
+struct curl_slist *headers = NULL;
+
+url = g_strdup_printf("%s/%s", URL_ROOT, endpoint);
+
+/* reset all options of a libcurl session handle at first */
+curl_easy_reset(mon->handle);
+
+curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpath);
+curl_easy_setopt(mon->handle, CURLOPT_URL, url);
+curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
+curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
+curl_easy_setopt(mon->handle, CURLOPT_INFILESIZE, 0L);
+
+headers = curl_slist_append(headers, "Content-Type: application/json");
+
+curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, headers);
+curl_easy_setopt(mon->handle, CURLOPT_WRITEFUNCTION, curl_callback);
+curl_easy_setopt(mon->handle, CURLOPT_WRITEDATA, (void *)&data);
+
+if (payload) {
+curl_easy_setopt(mon->handle, CURLOPT_POSTFIELDS, payload);
+curl_easy_setopt(mon->handle, CURLOPT_CUSTOMREQUEST, "PUT");
+headers = curl_slist_append(headers, "Accept: application/json");
+}
+
+responseCode = virCHMonitorCurlPerform(mon->handle);
+
+data.content = g_realloc(data.content, data.size + 1);
+data.content[data.size] = 0;
+
+if (logCtxt && data.size) {
+/* Do this to append a NULL char at the end of data */
+domainLogContextWrite(logCtxt, "HTTP response code from CH: %d\n", 
responseCode);
+domainLogContextWrite(logCtxt, "Response = %s\n", data.content);
+}
+
+curl_slist_free_all(headers);
+
+if (responseCode != 200 && responseCode != 204) {
+return -1;
+}
+
+if (answer)
+*answer = virJSONValueFromString(data.content);
+
+return 0;
+}
+
 int
 virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint,
  domainLogContext *logCtxt)
-- 
2.50.1



[PATCH v2 09/13] ch: add disk attach functionality

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 po/POTFILES |   1 +
 src/ch/ch_hotplug.c | 131 ++--
 src/ch/ch_monitor.c |  17 ++
 src/ch/ch_monitor.h |   4 ++
 4 files changed, 149 insertions(+), 4 deletions(-)

diff --git a/po/POTFILES b/po/POTFILES
index dc7293d0cd..50a055fb73 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -24,6 +24,7 @@ src/ch/ch_domain.c
 src/ch/ch_driver.c
 src/ch/ch_events.c
 src/ch/ch_hostdev.c
+src/ch/ch_hotplug.c
 src/ch/ch_interface.c
 src/ch/ch_monitor.c
 src/ch/ch_process.c
diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c
index c46628e7e9..524355b93c 100644
--- a/src/ch/ch_hotplug.c
+++ b/src/ch/ch_hotplug.c
@@ -18,18 +18,141 @@
 
 #include 
 
+#include "ch_alias.h"
+#include "ch_domain.h"
 #include "ch_hotplug.h"
 
+#include "domain_event.h"
+#include "domain_validate.h"
+#include "virlog.h"
+
 #define VIR_FROM_THIS VIR_FROM_CH
 
+VIR_LOG_INIT("ch.ch_hotplug");
+
+static int
+chDomainAddDisk(virCHMonitor *mon, virDomainObj *vm, virDomainDiskDef *disk)
+{
+if (chAssignDeviceDiskAlias(disk) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+_("Assigning disk alias failed"));
+return -1;
+}
+
+if (virCHMonitorAddDisk(mon, disk) < 0) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+_("Adding disk to domain failed"));
+return -1;
+}
+
+virDomainDiskInsert(vm->def, disk);
+
+return 0;
+}
+
+static int
+chDomainAttachDeviceLive(virDomainObj *vm,
+ virDomainDeviceDef *dev)
+{
+int ret = -1;
+virCHDomainObjPrivate *priv = vm->privateData;
+virCHMonitor *mon = priv->monitor;
+
+switch (dev->type) {
+case VIR_DOMAIN_DEVICE_DISK: {
+if (chDomainAddDisk(mon, vm, dev->data.disk) < 0) {
+break;
+}
+
+dev->data.disk = NULL;
+ret = 0;
+break;
+}
+case VIR_DOMAIN_DEVICE_NET:
+case VIR_DOMAIN_DEVICE_LEASE:
+case VIR_DOMAIN_DEVICE_FS:
+case VIR_DOMAIN_DEVICE_INPUT:
+case VIR_DOMAIN_DEVICE_HOSTDEV:
+case VIR_DOMAIN_DEVICE_WATCHDOG:
+case VIR_DOMAIN_DEVICE_CONTROLLER:
+case VIR_DOMAIN_DEVICE_REDIRDEV:
+case VIR_DOMAIN_DEVICE_CHR:
+case VIR_DOMAIN_DEVICE_RNG:
+case VIR_DOMAIN_DEVICE_SHMEM:
+case VIR_DOMAIN_DEVICE_MEMORY:
+case VIR_DOMAIN_DEVICE_VSOCK:
+case VIR_DOMAIN_DEVICE_NONE:
+case VIR_DOMAIN_DEVICE_SOUND:
+case VIR_DOMAIN_DEVICE_VIDEO:
+case VIR_DOMAIN_DEVICE_GRAPHICS:
+case VIR_DOMAIN_DEVICE_HUB:
+case VIR_DOMAIN_DEVICE_SMARTCARD:
+case VIR_DOMAIN_DEVICE_MEMBALLOON:
+case VIR_DOMAIN_DEVICE_NVRAM:
+case VIR_DOMAIN_DEVICE_TPM:
+case VIR_DOMAIN_DEVICE_PANIC:
+case VIR_DOMAIN_DEVICE_IOMMU:
+case VIR_DOMAIN_DEVICE_AUDIO:
+case VIR_DOMAIN_DEVICE_CRYPTO:
+case VIR_DOMAIN_DEVICE_PSTORE:
+case VIR_DOMAIN_DEVICE_LAST:
+default:
+virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+   _("live attach of device '%1$s' is not supported"),
+   virDomainDeviceTypeToString(dev->type));
+break;
+}
+
+return ret;
+}
+
 int
-chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm G_GNUC_UNUSED,
-virCHDriver *driver G_GNUC_UNUSED,
-const char *xml G_GNUC_UNUSED,
+chDomainAttachDeviceLiveAndUpdateConfig(virDomainObj *vm,
+virCHDriver *driver,
+const char *xml,
 unsigned int flags)
 {
+unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
+   VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
+g_autoptr(virDomainDeviceDef) devLive = NULL;
+g_autoptr(virDomainDef) vmdef = NULL;
+g_autoptr(virCHDriverConfig) cfg = NULL;
+g_autoptr(virDomainDeviceDef) devConf = NULL;
+
 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
   VIR_DOMAIN_AFFECT_CONFIG, -1);
 
-return -1;
+cfg = virCHDriverGetConfig(driver);
+
+if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+   _("Persistent domain state changes are not supported"));
+return -1;
+}
+
+if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+if (!(devLive = virDomainDeviceDefParse(xml, vm->def,
+driver->xmlopt, NULL,
+parse_flags))) {
+return -1;
+}
+
+if (virDomainDeviceValidateAliasForHotplug(vm, devLive,
+   VIR_DOMAIN_AFFECT_LIVE) < 0)
+return -1;
+
+if (virDomainDefCompatibleDevice(vm->def, devLive, NULL,
+VIR_DOMAIN_DEVICE_ACTION_ATTACH,
+ 

[PATCH v2 06/13] ch: add ch_alias.{c,h} for device alias handling

2025-09-02 Thread Stefan Kober
On-behalf-of: SAP stefan.ko...@sap.com
Signed-off-by: Stefan Kober 
---
 src/ch/ch_alias.c  | 59 ++
 src/ch/ch_alias.h  | 27 +
 src/ch/meson.build |  2 ++
 3 files changed, 88 insertions(+)
 create mode 100644 src/ch/ch_alias.c
 create mode 100644 src/ch/ch_alias.h

diff --git a/src/ch/ch_alias.c b/src/ch/ch_alias.c
new file mode 100644
index 00..63bcd9f212
--- /dev/null
+++ b/src/ch/ch_alias.c
@@ -0,0 +1,59 @@
+/*
+ * ch_alias.c: CH device alias handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * .
+ */
+
+#include 
+
+#include "virutil.h"
+
+#include "ch_alias.h"
+
+#define VIR_FROM_THIS VIR_FROM_CH
+
+int chAssignDeviceDiskAlias(virDomainDiskDef *disk)
+{
+const char *prefix = virDomainDiskBusTypeToString(disk->bus);
+int idx = -1;
+
+if (disk->info.alias) {
+return 0;
+}
+
+idx = virDiskNameToIndex(disk->dst);
+
+if (idx < 0) {
+return -1;
+}
+
+disk->info.alias = g_strdup_printf("%s-disk%d", prefix, idx);
+
+return 0;
+}
+
+int chAssignDeviceAliases(virDomainDef *def)
+{
+size_t i;
+
+for (i = 0; i < def->ndisks; i++) {
+if (chAssignDeviceDiskAlias(def->disks[i]) < 0)
+return -1;
+}
+
+/* TODO: handle other devices */
+
+return 0;
+}
diff --git a/src/ch/ch_alias.h b/src/ch/ch_alias.h
new file mode 100644
index 00..81e20c27c7
--- /dev/null
+++ b/src/ch/ch_alias.h
@@ -0,0 +1,27 @@
+/*
+ * ch_alias.h: CH device alias handling
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library.  If not, see
+ * .
+ */
+
+#pragma once
+
+#include "domain_conf.h"
+
+int
+chAssignDeviceDiskAlias(virDomainDiskDef *disk);
+
+int
+chAssignDeviceAliases(virDomainDef *def);
diff --git a/src/ch/meson.build b/src/ch/meson.build
index bba7ee90ee..b3e9c03832 100644
--- a/src/ch/meson.build
+++ b/src/ch/meson.build
@@ -19,6 +19,8 @@ ch_driver_sources = [
   'ch_hostdev.h',
   'ch_hotplug.c',
   'ch_hotplug.h',
+  'ch_alias.c',
+  'ch_alias.h',
 ]
 
 driver_source_files += files(ch_driver_sources)
-- 
2.50.1



Re: [PATCH v2 00/13] CH: Add disk hotplug support to Cloud Hypervisor domains

2025-09-02 Thread stefan . kober
I think I missed most of Michal's comments on the v1 patchset. I will 
incorporate those.


Re: [PATCH-for-10.0 3/3] hw/sd/sdcard: Remove support for spec v1.10

2025-09-02 Thread Philippe Mathieu-Daudé

On 1/9/25 09:41, Philippe Mathieu-Daudé wrote:

On 1/9/25 09:29, Philippe Mathieu-Daudé wrote:

Kind ping :)

On 27/6/24 09:10, Philippe Mathieu-Daudé wrote:

Support for spec v1.10 was deprecated in QEMU v9.1.

Signed-off-by: Philippe Mathieu-Daudé 
---
  docs/about/deprecated.rst   |  6 --
  docs/about/removed-features.rst |  5 +
  include/hw/sd/sd.h  |  1 -
  hw/sd/sd.c  | 12 ++--
  4 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 02cdef14aa..ff3da68208 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -362,12 +362,6 @@ recommending to switch to their stable 
counterparts:

  - "Zve64f" should be replaced with "zve64f"
  - "Zve64d" should be replaced with "zve64d"
-``-device sd-card,spec_version=1`` (since 9.1)
-^^
-
-SD physical layer specification v2.00 supersedes the v1.10 one.
-v2.00 is the default since QEMU 3.0.0.
-
  Block device options
  
diff --git a/docs/about/removed-features.rst b/docs/about/removed- 
features.rst

index fc7b28e637..dfe04b0555 100644
--- a/docs/about/removed-features.rst
+++ b/docs/about/removed-features.rst
@@ -1056,6 +1056,11 @@ by using ``-machine graphics=off``.
  The 'pvrdma' device and the whole RDMA subsystem have been removed.
+``-device sd-card,spec_version=1`` (since 10.0)


Updated to "10.2".


As discussed with Pierrick during online review:

Reviewed-by: Pierrick Bouvier 


Re: [PATCH 0/3] hw/sd/sdcard: Deprecate support for spec v1.10

2025-09-02 Thread Philippe Mathieu-Daudé

On 27/6/24 09:10, Philippe Mathieu-Daudé wrote:

Deprecate SD spec v1.10, use v3.01 as new default.

Philippe Mathieu-Daudé (3):
   hw/sd/sdcard: Deprecate support for spec v1.10
   hw/sd/sdcard: Use spec v3.01 by default


The first 2 patches are already merged,


   hw/sd/sdcard: Remove support for spec v1.10

queuing the last one.


[libvirt PATCH] esx: pass 'long' to curl_easy_setopt when needed

2025-09-02 Thread Ján Tomko via Devel
From: Ján Tomko 

The include header got its type checks fixed in curl 8.14:
https://github.com/curl/curl/commit/79b4e56b3f30dc1ac28a81128a07d27338e5219e
https://github.com/curl/curl/pull/17143

This causes a warning on rawhide with clang:
../src/esx/esx_vi.c:318:5: error: call to '_curl_easy_setopt_err_long'
declared with 'warning' attribute: curl_easy_setopt expects a long
argument [-Werror,-Wattribute-warning]
  318 | curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
  | ^

Signed-off-by: Ján Tomko 
---
 src/esx/esx_stream.c |  6 +++---
 src/esx/esx_vi.c | 24 
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c
index 1439940330..143b2405ed 100644
--- a/src/esx/esx_stream.c
+++ b/src/esx/esx_stream.c
@@ -405,13 +405,13 @@ esxStreamOpen(virStreamPtr stream, esxPrivate *priv, 
const char *url,
 goto cleanup;
 
 if (mode == ESX_STREAM_MODE_UPLOAD) {
-curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 1);
+curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 1L);
 curl_easy_setopt(streamPriv->curl->handle, CURLOPT_READFUNCTION,
  esxVI_CURL_ReadStream);
 curl_easy_setopt(streamPriv->curl->handle, CURLOPT_READDATA, 
streamPriv);
 } else {
-curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 0);
-curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1);
+curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 0L);
+curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1L);
 curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEFUNCTION,
  esxVI_CURL_WriteStream);
 curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEDATA, 
streamPriv);
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index d25f819bc5..3264afc13a 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -315,13 +315,13 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri 
*parsedUri)
 }
 
 curl_easy_setopt(curl->handle, CURLOPT_USERAGENT, "libvirt-esx");
-curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
-curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0);
-curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0);
+curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1L);
+curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0L);
+curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0L);
 curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYPEER,
- parsedUri->noVerify ? 0 : 1);
+ parsedUri->noVerify ? 0L : 1L);
 curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYHOST,
- parsedUri->noVerify ? 0 : 2);
+ parsedUri->noVerify ? 0L : 2L);
 curl_easy_setopt(curl->handle, CURLOPT_COOKIEFILE, "");
 curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->headers);
 curl_easy_setopt(curl->handle, CURLOPT_READFUNCTION,
@@ -331,16 +331,16 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri 
*parsedUri)
 curl_easy_setopt(curl->handle, CURLOPT_ERRORBUFFER, curl->error);
 #if ESX_VI__CURL__ENABLE_DEBUG_OUTPUT
 curl_easy_setopt(curl->handle, CURLOPT_DEBUGFUNCTION, esxVI_CURL_Debug);
-curl_easy_setopt(curl->handle, CURLOPT_VERBOSE, 1);
+curl_easy_setopt(curl->handle, CURLOPT_VERBOSE, 1L);
 #endif
 
 if (parsedUri->proxy) {
 curl_easy_setopt(curl->handle, CURLOPT_PROXY,
  parsedUri->proxy_hostname);
 curl_easy_setopt(curl->handle, CURLOPT_PROXYTYPE,
- parsedUri->proxy_type);
+ (long) parsedUri->proxy_type);
 curl_easy_setopt(curl->handle, CURLOPT_PROXYPORT,
- parsedUri->proxy_port);
+ (long) parsedUri->proxy_port);
 }
 
 if (parsedUri->cacert)
@@ -386,8 +386,8 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char 
**content,
 curl_easy_setopt(curl->handle, CURLOPT_URL, url);
 curl_easy_setopt(curl->handle, CURLOPT_RANGE, range);
 curl_easy_setopt(curl->handle, CURLOPT_WRITEDATA, &buffer);
-curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0);
-curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1);
+curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0L);
+curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1L);
 
 responseCode = esxVI_CURL_Perform(curl, url);
 }
@@ -426,7 +426,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const 
char *content)
 curl_easy_setopt(curl->handle, CURLOPT_URL, url);
 curl_easy_setopt(curl->handle, CURLOPT_RANGE, NULL);
 curl_easy_setopt(curl->handle, CURLOPT_READDATA, &content);
-curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1);
+curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1L);
 curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, strle