From nobody Mon Feb 9 03:48:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623423001; cv=none; d=zohomail.com; s=zohoarc; b=iSJtTKVFbEM/PaWxwiLtN6+RRYebOXag6CJWnJ122khP2rkyItygfto/HbN0ZNyVt60cF6/x3Cmvb18u23d8vd+yuH12PCxpIMmMt4gljt5/yL5es0LdYQ9jnyudz0LPraYDs9if+tg/lKL6DtGLE0aClbybOJ9waurfm7XIMqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623423001; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AgYZXyNSm2bgKddyNYBFRmSFXwQlfEmxZFG/wziaCpA=; b=WvFdgJkahbf3ULJWgsFVRsDUHGxIyRL5xRH3NAwDyrNyTW7GytYRo6YwDXCUyNdUMAnT7zljiZl7jU11k3qjl0G7srkkjp8S8otdIxZQHjjuULwe0RTInfVO5Tbpw4kmG6IAfx2q2V2dbcmZoaaPLqUFpxXe5T9G9FragVgsVqE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1623423001072205.48230503842535; Fri, 11 Jun 2021 07:50:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-527-ZKUCDtgSML6wrcBVyg_Hwg-1; Fri, 11 Jun 2021 10:49:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F277C1926DBE; Fri, 11 Jun 2021 14:49:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C9D4E10246F1; Fri, 11 Jun 2021 14:49:49 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 86C2D1809CAD; Fri, 11 Jun 2021 14:49:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15BEnb98007789 for ; Fri, 11 Jun 2021 10:49:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id EFF1760FC2; Fri, 11 Jun 2021 14:49:37 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60F4860C05 for ; Fri, 11 Jun 2021 14:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623423000; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AgYZXyNSm2bgKddyNYBFRmSFXwQlfEmxZFG/wziaCpA=; b=X49oSP2WqzXNXBrnQfE15b5UQRWgWz0SjGEK8pBvcSNLg8MmhRq34yXxKWsMV6YfUa8BYB L5lo7ZhfzYkuSAvtrZCNeIeSyHJusC/ju5aaWyypykf08AghR5lgj1mFyv8opmXgV2XOM1 XifaLekVWh66zLUlEXap8T/ugmKHcik= X-MC-Unique: ZKUCDtgSML6wrcBVyg_Hwg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/22] qemuValidateDomainDeviceDefAddress: Add validation of CCW address Date: Fri, 11 Jun 2021 16:49:11 +0200 Message-Id: <9e59ca58ed4b49426d3fbace7e122441146ebfea.1623422565.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Base the check on the logic from qemuDomainCheckCCWS390AddressSupport, which will be removed later. Signed-off-by: Peter Krempa --- src/qemu/qemu_validate.c | 20 ++++++++++++++++++-- tests/qemuxml2argvtest.c | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 16f77611c8..b4f012253b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1276,6 +1276,7 @@ qemuValidateDomainDeviceDefZPCIAddress(virDomainDevic= eInfo *info, static int qemuValidateDomainDeviceDefAddress(const virDomainDeviceDef *dev, + const virDomainDef *def, virQEMUCaps *qemuCaps) { virDomainDeviceInfo *info; @@ -1314,11 +1315,26 @@ qemuValidateDomainDeviceDefAddress(const virDomainD= eviceDef *dev, _("'virtio-s390' addresses are no longer supported"= )); return -1; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: + if (!qemuDomainIsS390CCW(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("cannot use CCW address type for device '%s' = using machine type '%s'"), + NULLSTR(info->alias), def->os.machine); + return -1; + } + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CCW)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("CCW address type is not supported by this QE= MU")); + return -1; + } + + break; + case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB: - case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_ISA: case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM: @@ -5006,7 +5022,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, qemuCaps =3D qemuCapsLocal; } - if ((ret =3D qemuValidateDomainDeviceDefAddress(dev, qemuCaps)) < 0) + if ((ret =3D qemuValidateDomainDeviceDefAddress(dev, def, qemuCaps)) <= 0) return ret; switch ((virDomainDeviceType)dev->type) { diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 1345c42b72..7a6ddc632c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1893,7 +1893,7 @@ mymain(void) DO_TEST("balloon-device-deflate", QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); DO_TEST("balloon-ccw-deflate", - QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); + QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE, QEMU_CAPS_CCW); DO_TEST("balloon-mmio-deflate", QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE); --=20 2.31.1