From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922451; cv=none; d=zohomail.com; s=zohoarc; b=Mj7f41Kwfg19G50kGuwwcV7I5cH0rfxWACKAoDDoxFQe/ax0aBQVrV5D/kuNPzdvSPCn/hJGuN3EIq8JKnp7LKoM5cNzqwS4QqQrenPvMq6KvUDWbhFmLcjAzalgfImcU92FPpzLV3YoWN/NSgutKi6tkmns8+svgVmFkxRu4UE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922451; 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=W3k/DcO/NU8cIo+4kXWmNtWSuFeicyw114htrY7EHsM=; b=GtHI/yIgfKDRbx54H0ot/1nmJy6L/J7KRZNW/Wy2DF+wf5hywdlaRmMSfVqOGDze2VdIoi1qJ5Izy7HMs0DPOBreCciwXRuUxfyq4fBe8BzzjBwg8iwQTkM9zr3hGdOtaIrUbHn9OMA4PIfvBioOCVreI8R9NWWfB8BsoJ2EMFg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922451326733.3610416120383; Tue, 23 Jun 2020 07:27:31 -0700 (PDT) Received: from localhost ([::1]:35734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjtZ-0006lZ-QM for importer@patchew.org; Tue, 23 Jun 2020 10:27:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpo-0001ds-0y for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:36 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:43461 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpk-0007gr-LK for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:35 -0400 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-71-2OCeO0VGPsqSx2UhbEk9mw-1; Tue, 23 Jun 2020 10:23:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56FF0107ACCD for ; Tue, 23 Jun 2020 14:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6D0460C87 for ; Tue, 23 Jun 2020 14:23:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 35105113846F; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922211; h=from:from: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; bh=W3k/DcO/NU8cIo+4kXWmNtWSuFeicyw114htrY7EHsM=; b=QbjPJ63LBvghcBqoAt1Hq5Tb/asswzCn11YjPT3bqD53xl0pfnLAEvVZCQEYjwGsLyJUQJ kJEVOoa6jXTdgfHa0EBK77vUBwvt98wMPaY0B7SCBGROuSTJy7MSYu478ShUyEVrjdotL6 p/SnFhncrnvR34sOChHwIONfqGKPwfo= X-MC-Unique: 2OCeO0VGPsqSx2UhbEk9mw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 01/16] iotests/172: Include "info block" in test output Date: Tue, 23 Jun 2020 16:23:11 +0200 Message-Id: <20200623142326.2349416-2-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:54:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The additional output demonstrates we screw up when -global isa-fdc clashes with -drive if=3Dfloppy or its sugared forms: according to "info qtree", only the latter backend is attached, but according to "info block", both are. For instance: Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2= .2 -global isa-fdc.driveA=3Dnone0 dev: isa-fdc, id "" [...] driveA =3D "" driveB =3D "" [...] bus: floppy-bus.0 type floppy-bus dev: floppy, id "" unit =3D 0 (0x0) ---> drive =3D "floppy0" [...] floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) ---> Attached to: /machine/unattached/device[15] Removable device: not locked, tray closed Cache mode: writeback none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) ---> Attached to: /machine/unattached/device[14] Cache mode: writeback /machine/unattached/device[15] is floppy, and /machine/unattached/device[14] is isa-fdc. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-2-armbru@redhat.com> --- tests/qemu-iotests/172 | 5 +- tests/qemu-iotests/172.out | 486 +++++++++++++++++++++++++++++++++++++ 2 files changed, 489 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 7195fb895a..19c2516cf8 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -69,9 +69,10 @@ check_floppy_qtree() # # Apply the sed filter to stdout only, but keep the stderr output and # filter the qemu program name in it. - echo "info qtree" | + printf "info qtree\ninfo block\n" | (QEMU_OPTIONS=3D"" do_run_qemu "$@" | - sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p}' ) 2>&1 | + _filter_testdir |_filter_generated_node_ids | _filter_hmp | + sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p};/^[a-z][= ^ ]* (NODE_NAME):* /,/^(qemu)$/{p}') 2>&1 | _filter_win32 | _filter_qemu } =20 diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index e782c5957e..a315866e17 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -62,6 +62,19 @@ Testing: -fda TEST_DIR/t.qcow2 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fdb TEST_DIR/t.qcow2 =20 @@ -100,6 +113,23 @@ Testing: -fdb TEST_DIR/t.qcow2 write-cache =3D "auto" share-rw =3D false drive-type =3D "288" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +floppy0: [not inserted] + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 =20 @@ -138,6 +168,24 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Using -drive options =3D=3D=3D @@ -168,6 +216,19 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,index=3D1 =20 @@ -206,6 +267,23 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2,in= dex=3D1 write-cache =3D "auto" share-rw =3D false drive-type =3D "288" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +floppy0: [not inserted] + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -drive if=3Dfloppy,fil= e=3DTEST_DIR/t.qcow2.2,index=3D1 =20 @@ -244,6 +322,24 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -d= rive if=3Dfloppy,file=3DTEST_DIR/t write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Using -drive if=3Dnone and -global =3D=3D=3D @@ -274,6 +370,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -glo= bal isa-fdc.driveA=3Dnone0 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -global isa-fdc.driveB= =3Dnone0 =20 @@ -301,6 +410,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -glo= bal isa-fdc.driveB=3Dnone0 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -global isa-fdc.driveB=3D= none1 =20 @@ -339,6 +461,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dri= ve if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Using -drive if=3Dnone and -device =3D=3D=3D @@ -369,6 +509,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dev= ice floppy,drive=3Dnone0 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,unit=3D1 =20 @@ -396,6 +549,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dev= ice floppy,drive=3Dnone0,unit=3D1 write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -device floppy,drive=3Dnone0 -device floppy,drive=3Dnone= 1,unit=3D1 =20 @@ -434,6 +600,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dri= ve if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[1] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Mixing -fdX and -global =3D=3D=3D @@ -475,6 +659,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveA=3Dnone0 =20 @@ -513,6 +715,24 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[16] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[23] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveA=3Dnone0 =20 @@ -540,6 +760,23 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[14] + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveB=3Dnone0 =20 @@ -567,6 +804,23 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[14] + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Mixing -fdX and -device =3D=3D=3D @@ -608,6 +862,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -device floppy,drive=3Dnone0,unit=3D1 =20 @@ -646,6 +918,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -device floppy,drive=3Dnone0 =20 @@ -684,6 +974,24 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -device floppy,drive=3Dnone0,unit=3D0 =20 @@ -722,6 +1030,24 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device fl write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -device floppy,drive=3Dnone0,unit=3D0 QEMU_PROG: -device floppy,drive=3Dnone0,unit=3D0: Floppy unit 0 is in use @@ -769,6 +1095,24 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device floppy,drive=3Dnone0,unit=3D1 =20 @@ -807,6 +1151,24 @@ Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.q write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -device floppy,drive=3Dnone0,unit=3D0 QEMU_PROG: -device floppy,drive=3Dnone0,unit=3D0: Floppy unit 0 is in use @@ -851,6 +1213,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D1 =20 @@ -889,6 +1269,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1 =20 @@ -927,6 +1325,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D0 =20 @@ -965,6 +1381,24 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -dr= ive if=3Dnone,file=3DTEST_DIR/t.qco write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D0 QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D0: Floppy unit 0 is in use @@ -1118,6 +1552,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -d= evice floppy,drive=3Dnone0,drive-t write-cache =3D "auto" share-rw =3D false drive-type =3D "120" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,drive-type=3D288 =20 @@ -1145,6 +1592,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -d= evice floppy,drive=3Dnone0,drive-t write-cache =3D "auto" share-rw =3D false drive-type =3D "288" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 =20 =3D=3D=3D Try passing different block sizes =3D=3D=3D @@ -1175,6 +1635,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -d= evice floppy,drive=3Dnone0,logical write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,physical_block_size=3D512 =20 @@ -1202,6 +1675,19 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -d= evice floppy,drive=3Dnone0,physica write-cache =3D "auto" share-rw =3D false drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -device floppy,drive=3Dn= one0,logical_block_size=3D4096 QEMU_PROG: -device floppy,drive=3Dnone0,logical_block_size=3D4096: logical= _block_size > physical_block_size not supported --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922867; cv=none; d=zohomail.com; s=zohoarc; b=Q3PMrOba572dQxw5DDush+r1zoVANXli3rYkzKLCwxlOVbrUNEJhGsQHecOpSn1vprhOUmJnBEcjheUcnXVsmJ+bM618ToscaIukXgtMAeFhUtu45/11cwrYr4iH5WDsM+n/WXp6kwTIRY/lZCoTltrlThwf113MWL6nURNjga0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922867; 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=rRYO5Kp2/Cqw5IF/GTlj3GcMJBhYHOwBjK3oiYKcEs8=; b=VkqVcYgojsD/9LJZ4mQXmb8NGHxw40khym5w38GIrHffYvTNEpXQ62bFFPZMonN/EkHP/r1nI3Ntl6vpvuC+BbZi0n8htX8I4mEzh8adUr0aDPng/CtJX+8x81AoKFr4JfetjqRJ8dZFyEVrckyV1Pe6Ew0LXye3NMWdoHv8pwo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922866966177.82266368034902; Tue, 23 Jun 2020 07:34:26 -0700 (PDT) Received: from localhost ([::1]:59532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnk0H-0000Ad-Cn for importer@patchew.org; Tue, 23 Jun 2020 10:34:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjps-0001lR-FI for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:54280 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007jO-KK for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 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-120-iG3rxjJFPBiXyGW4ANaZSA-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0882464AD2 for ; Tue, 23 Jun 2020 14:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE72E5D9DA for ; Tue, 23 Jun 2020 14:23:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 39CA31138470; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from: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; bh=rRYO5Kp2/Cqw5IF/GTlj3GcMJBhYHOwBjK3oiYKcEs8=; b=YjfdTcna9anQDpBij6zBR8xczbz/RTVJZqjKxjWzuHzj5rrUCGLVddsTvJVCB8BpQftXzb Vwl+gyKm0RSeOGc49vZeFiXeS9yVDTXCBwFDWz3AWe36FvF6oM90FM4S7Mu+hCUgJhwufn s2E9GLk9gxZh0m7Ns7EfCSyyAYIUnUE= X-MC-Unique: iG3rxjJFPBiXyGW4ANaZSA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 02/16] iotests/172: Cover empty filename and multiple use of drives Date: Tue, 23 Jun 2020 16:23:12 +0200 Message-Id: <20200623142326.2349416-3-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-3-armbru@redhat.com> --- tests/qemu-iotests/172 | 12 +++++++++ tests/qemu-iotests/172.out | 50 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 19c2516cf8..714c7527b4 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -111,6 +111,7 @@ echo =3D=3D=3D Using -fda/-fdb options =3D=3D=3D check_floppy_qtree -fda "$TEST_IMG" check_floppy_qtree -fdb "$TEST_IMG" check_floppy_qtree -fda "$TEST_IMG" -fdb "$TEST_IMG.2" +check_floppy_qtree -fdb "" =20 =20 echo @@ -198,6 +199,17 @@ check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG"= -drive if=3Dnone,file=3D"$TEST_IM check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" \ -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dn= one1,unit=3D1 =20 +echo +echo +echo =3D=3D=3D Attempt to use drive twice =3D=3D=3D + +# if=3Dnone +check_floppy_qtree -drive if=3Dnone -device floppy,drive=3Dnone0 -device f= loppy -device floppy,drive=3Dnone0 +# if=3Dfloppy +check_floppy_qtree -fda "" -device floppy,drive=3Dfloppy0 +# default if=3Dfloppy (not found, because it's created later) +check_floppy_qtree -device floppy,drive=3Dfloppy0 + echo echo echo =3D=3D=3D Too many floppy drives =3D=3D=3D diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index a315866e17..0665cdcb51 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -187,6 +187,44 @@ sd0: [not inserted] (qemu) quit =20 =20 +Testing: -fdb=20 + + dev: isa-fdc, id "" + iobase =3D 1008 (0x3f0) + irq =3D 6 (0x6) + dma =3D 2 (0x2) + driveA =3D "" + driveB =3D "" + check_media_rate =3D true + fdtypeA =3D "auto" + fdtypeB =3D "auto" + fallback =3D "288" + isa irq 6 + bus: floppy-bus.0 + type floppy-bus + dev: floppy, id "" + unit =3D 1 (0x1) + drive =3D "floppy1" + logical_block_size =3D 512 (0x200) + physical_block_size =3D 512 (0x200) + min_io_size =3D 0 (0x0) + opt_io_size =3D 0 (0x0) + discard_granularity =3D 4294967295 (0xffffffff) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "288" + dev: floppy, id "" + unit =3D 0 (0x0) + drive =3D "floppy0" + logical_block_size =3D 512 (0x200) + physical_block_size =3D 512 (0x200) + min_io_size =3D 0 (0x0) + opt_io_size =3D 0 (0x0) + discard_granularity =3D 4294967295 (0xffffffff) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "288" + =20 =3D=3D=3D Using -drive options =3D=3D=3D =20 @@ -1407,6 +1445,18 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -d= rive if=3Dnone,file=3DTEST_DIR/t.qco QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D1: Floppy unit 1 is in use =20 =20 +=3D=3D=3D Attempt to use drive twice =3D=3D=3D + +Testing: -drive if=3Dnone -device floppy,drive=3Dnone0 -device floppy -dev= ice floppy,drive=3Dnone0 +QEMU_PROG: -device floppy,drive=3Dnone0: Drive 'none0' is already in use b= y another device + +Testing: -fda -device floppy,drive=3Dfloppy0 +QEMU_PROG: -device floppy,drive=3Dfloppy0: Drive 'floppy0' is already in u= se because it has been automatically connected to another device (did you n= eed 'if=3Dnone' in the drive options?) + +Testing: -device floppy,drive=3Dfloppy0 +QEMU_PROG: -device floppy,drive=3Dfloppy0: Property 'floppy.drive' can't f= ind value 'floppy0' + + =3D=3D=3D Too many floppy drives =3D=3D=3D =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.3 -global is= a-fdc.driveB=3Dnone0 -device floppy,drive=3Dnone1 --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922696; cv=none; d=zohomail.com; s=zohoarc; b=CVzATTN2CVprDeo/oi6iLVN0KG3Jk+Fvu7lCaBT2aTs9VqPDp00VBm1mpM1i+QoYgpUV5SzFoo9onKY+klGOaYjxZpVbHJwZ3MOoBgR5Bbms6ChRX5Lu73pxPFphxnA9zd2NL268zQjAJHM3xEMGQA7UbC4FGKNzp4GzlAtnW08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922696; 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=tbGgaGbdyMpubECOCuSha0DKU/iPXl7DhSMfTT9fjVs=; b=E43zmEpVP8rBCi1YKI2AcO8qPGHWxi5f+YMyYhg0l4/dTaK+oUtxyFGA/CxnK/LrxGgxKlk3s2Z2z2qqk0j8WVJgXpBrm5WCn8dqcXZ9UtY/TMGfv31KbLyCHxEAi5Psqfe0G2SxtQc31EZlIyX3pud3+y3Y8CVu/4dECrkkVB8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922696683650.7005062560409; Tue, 23 Jun 2020 07:31:36 -0700 (PDT) Received: from localhost ([::1]:51272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjxX-0004s2-4g for importer@patchew.org; Tue, 23 Jun 2020 10:31:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjps-0001kx-6n for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:26467 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007jC-Bp for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:39 -0400 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-378-Xx10HPaUPlih8hm4GZ9dRA-1; Tue, 23 Jun 2020 10:23:29 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 86CD8188360A for ; Tue, 23 Jun 2020 14:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6BB919932 for ; Tue, 23 Jun 2020 14:23:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 3D9B61138471; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from: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; bh=tbGgaGbdyMpubECOCuSha0DKU/iPXl7DhSMfTT9fjVs=; b=Jx854BCVZilgjzVCK/LCZApT9JkEXh0dLGU3R1pefIlrHPda2ykSSCXSC3kPtmEaaUdS/c IMjQBthRRQ1m9RP/me9RxTse0zKjAqd+6tAxvQyseO/oinOYBsDeVU5odx4K/YhRIpm+eR iFfAYPOyaIeEAoWfU05ip1kGRHjEOcU= X-MC-Unique: Xx10HPaUPlih8hm4GZ9dRA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 03/16] iotests/172: Cover -global floppy.drive=... Date: Tue, 23 Jun 2020 16:23:13 +0200 Message-Id: <20200623142326.2349416-4-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use of -global to set a default backend for non-singleton devices is a bad idea. But as long as we permit it, we better test it. Test output demonstrates we screw up when -global floppy clashes with -fda or with -device floppy: according to "info qtree", only the latter backend is attached, but according to "info block", both are. Here's the clash with -device: Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global floppy.drive=3Dnone0 -device floppy,drive=3Dn= one1,unit=3D0 dev: isa-fdc, id "" [...] driveA =3D "" driveB =3D "" [...] bus: floppy-bus.0 type floppy-bus dev: floppy, id "" unit =3D 0 (0x0) ---> drive =3D "none1" [...] none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) ---> Attached to: /machine/peripheral-anon/device[0] Cache mode: writeback none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) ---> Attached to: /machine/peripheral-anon/device[0] Removable device: not locked, tray closed Cache mode: writeback /machine/peripheral-anon/device[0] is the floppy created with -device. Test output further demonstrates the "Drive 'FOO' is already in use because it has been automatically connected to another device" error message can be misleading. With '-fda "" -global floppy.drive=3Dfloppy0', it's in use because -global reuses -fda's backend. There is no other device involved. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-4-armbru@redhat.com> --- tests/qemu-iotests/172 | 7 ++ tests/qemu-iotests/172.out | 134 +++++++++++++++++++++++++++++++++++++ 2 files changed, 141 insertions(+) diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 714c7527b4..18056bcef7 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -151,6 +151,7 @@ check_floppy_qtree -fdb "$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" -global is # Conflicting (-fdX wins) check_floppy_qtree -fda "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveA=3Dnone0 check_floppy_qtree -fdb "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveB=3Dnone0 +check_floppy_qtree -fda "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global floppy.drive=3Dnone0 =20 echo echo @@ -192,12 +193,16 @@ check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG= " -drive if=3Dnone,file=3D"$TEST_IM -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dn= one1 check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" \ -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dn= one1,unit=3D0 +check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" \ + -global floppy.drive=3Dnone0 -device floppy,unit=3D0 =20 # Conflicting check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" \ -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dn= one1,unit=3D0 check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" \ -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dn= one1,unit=3D1 +check_floppy_qtree -drive if=3Dnone,file=3D"$TEST_IMG" -drive if=3Dnone,fi= le=3D"$TEST_IMG.2" \ + -global floppy.drive=3Dnone0 -device floppy,drive=3Dnon= e1,unit=3D0 =20 echo echo @@ -205,8 +210,10 @@ echo =3D=3D=3D Attempt to use drive twice =3D=3D=3D =20 # if=3Dnone check_floppy_qtree -drive if=3Dnone -device floppy,drive=3Dnone0 -device f= loppy -device floppy,drive=3Dnone0 +check_floppy_qtree -drive if=3Dnone -global floppy.drive=3Dnone0 -device f= loppy -device floppy # if=3Dfloppy check_floppy_qtree -fda "" -device floppy,drive=3Dfloppy0 +check_floppy_qtree -fda "" -global floppy.drive=3Dfloppy0 # default if=3Dfloppy (not found, because it's created later) check_floppy_qtree -device floppy,drive=3Dfloppy0 =20 diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 0665cdcb51..68e7a5ea5f 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -860,6 +860,50 @@ sd0: [not inserted] (qemu) quit =20 =20 +Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global floppy.drive=3Dnone0 + + dev: isa-fdc, id "" + iobase =3D 1008 (0x3f0) + irq =3D 6 (0x6) + dma =3D 2 (0x2) + driveA =3D "" + driveB =3D "" + check_media_rate =3D true + fdtypeA =3D "auto" + fdtypeB =3D "auto" + fallback =3D "288" + isa irq 6 + bus: floppy-bus.0 + type floppy-bus + dev: floppy, id "" + unit =3D 0 (0x0) + drive =3D "floppy0" + logical_block_size =3D 512 (0x200) + physical_block_size =3D 512 (0x200) + min_io_size =3D 0 (0x0) + opt_io_size =3D 0 (0x0) + discard_granularity =3D 4294967295 (0xffffffff) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "144" +floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/unattached/device[15] + Removable device: not locked, tray closed + Cache mode: writeback + +none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/unattached/device[15] + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[22] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + + =20 =3D=3D=3D Mixing -fdX and -device =3D=3D=3D =20 @@ -1438,21 +1482,111 @@ sd0: [not inserted] (qemu) quit =20 =20 +Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -global floppy.drive=3Dn= one0 -device floppy,unit=3D0 + + dev: isa-fdc, id "" + iobase =3D 1008 (0x3f0) + irq =3D 6 (0x6) + dma =3D 2 (0x2) + driveA =3D "" + driveB =3D "" + check_media_rate =3D true + fdtypeA =3D "auto" + fdtypeB =3D "auto" + fallback =3D "288" + isa irq 6 + bus: floppy-bus.0 + type floppy-bus + dev: floppy, id "" + unit =3D 0 (0x0) + drive =3D "none0" + logical_block_size =3D 512 (0x200) + physical_block_size =3D 512 (0x200) + min_io_size =3D 0 (0x0) + opt_io_size =3D 0 (0x0) + discard_granularity =3D 4294967295 (0xffffffff) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + + Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D0 QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D0: Floppy unit 0 is in use =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D1 QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D1: Floppy unit 1 is in use =20 +Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global floppy.drive=3Dnone0 -device floppy,drive=3Dnone= 1,unit=3D0 + + dev: isa-fdc, id "" + iobase =3D 1008 (0x3f0) + irq =3D 6 (0x6) + dma =3D 2 (0x2) + driveA =3D "" + driveB =3D "" + check_media_rate =3D true + fdtypeA =3D "auto" + fdtypeB =3D "auto" + fallback =3D "288" + isa irq 6 + bus: floppy-bus.0 + type floppy-bus + dev: floppy, id "" + unit =3D 0 (0x0) + drive =3D "none1" + logical_block_size =3D 512 (0x200) + physical_block_size =3D 512 (0x200) + min_io_size =3D 0 (0x0) + opt_io_size =3D 0 (0x0) + discard_granularity =3D 4294967295 (0xffffffff) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "144" +none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Cache mode: writeback + +none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) + Attached to: /machine/peripheral-anon/device[0] + Removable device: not locked, tray closed + Cache mode: writeback + +ide1-cd0: [not inserted] + Attached to: /machine/unattached/device[21] + Removable device: not locked, tray closed + +sd0: [not inserted] + Removable device: not locked, tray closed +(qemu) quit + + =20 =3D=3D=3D Attempt to use drive twice =3D=3D=3D =20 Testing: -drive if=3Dnone -device floppy,drive=3Dnone0 -device floppy -dev= ice floppy,drive=3Dnone0 QEMU_PROG: -device floppy,drive=3Dnone0: Drive 'none0' is already in use b= y another device =20 +Testing: -drive if=3Dnone -global floppy.drive=3Dnone0 -device floppy -dev= ice floppy +QEMU_PROG: -device floppy: can't apply global floppy.drive=3Dnone0: Drive = 'none0' is already in use by another device + Testing: -fda -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Drive 'floppy0' is already in u= se because it has been automatically connected to another device (did you n= eed 'if=3Dnone' in the drive options?) =20 +Testing: -fda -global floppy.drive=3Dfloppy0 +QEMU_PROG: can't apply global floppy.drive=3Dfloppy0: Drive 'floppy0' is a= lready in use because it has been automatically connected to another device= (did you need 'if=3Dnone' in the drive options?) + Testing: -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Property 'floppy.drive' can't f= ind value 'floppy0' =20 --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922568; cv=none; d=zohomail.com; s=zohoarc; b=iIYoRG04JRO8tdHngpu+zgeFlbEjvZHhu6tVdUM+kyL+29YvK8Zf4nfd19/oW8JZCAMAxG18E/AI5sKUZBmAvQb5l+kHwoG7mPBc0/r6pguGF6P87VsHbjwagUYf13IvnCZA6TKAQTgpXlzgmNdFRNhyb7YShgmoXZQyMM0H8uk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922568; 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=S0ukBk+vFB/2xy408CQsPZXSLpUEV8XGE6+TsdkpUHo=; b=N+ob9APfQQWDPqQ4nHYZqNh91hbYw5/QTd04YYT8hP2IH7sYcEL6/LDuP5P0hEvpcnvj2DZ3AIyWG4Os3npYsaVjWCyEuzecdajqwdqieU2AO5qmSvbLvuRajtJRq/fI68PipkSTacbLJeIBa7/X9R3MATx5oY4v2a5sX2p8wvo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922568000950.2716878769274; Tue, 23 Jun 2020 07:29:28 -0700 (PDT) Received: from localhost ([::1]:44346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjvS-0001pM-Km for importer@patchew.org; Tue, 23 Jun 2020 10:29:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51554) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpr-0001jA-6U for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:39 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:22500 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007iq-3w for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:38 -0400 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-393-FIp5vtHJO4aFHmLB8gzEkA-1; Tue, 23 Jun 2020 10:23:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5A780800597 for ; Tue, 23 Jun 2020 14:23:28 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE74A5C541 for ; Tue, 23 Jun 2020 14:23:27 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 42BF21138472; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from: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; bh=S0ukBk+vFB/2xy408CQsPZXSLpUEV8XGE6+TsdkpUHo=; b=VvgKGs6wMheW3ew9eFPlrUa6GY8cqQJFxELQMo9D770DS60GOn/BSis+lwpFzH6F+ez2tN 2YSC7ucervjbNhPknBXjIEqJpj3IQM7BAUZlzEpaIjWyoOxQflwEhTDEZ57eBCLZkj71gY oZpJy23N2+SZ+4Gm7muTZcaueQkJZdA= X-MC-Unique: FIp5vtHJO4aFHmLB8gzEkA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 04/16] fdc: Reject clash between -drive if=floppy and -global isa-fdc Date: Tue, 23 Jun 2020 16:23:14 +0200 Message-Id: <20200623142326.2349416-5-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:55:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The floppy controller devices desugar their drive properties into floppy devices (since commit a92bd191a4 "fdc: Move qdev properties to FloppyDrive", v2.8.0). This involves some bad magic in fdctrl_connect_drives(), and exists for backward compatibility. The functions for boards to create floppy controller devices fdctrl_init_isa(), fdctrl_init_sysbus(), and sun4m_fdctrl_init() desugar -drive if=3Dfloppy to these floppy controller drive properties. If you use both -drive if=3Dfloppy (or its -fda / -fdb sugar) and -global isa-fdc for the same floppy device, -global silently loses the conflict, and both backends involved end up with the floppy device frontend attached, as demonstrated by iotest 172 (see commit before previous). This is wrong. Desugar -drive if=3Dfloppy straight to floppy devices instead, with helper fdctrl_init_drives(). The conflict now gets rejected cleanly: first, fdctrl_connect_drives() creates the floppy for the controller's property, then fdctrl_init_drives() attempts to create the floppy for -drive if=3Dfloppy, but fails because the unit is already in use. Output of iotest 172 changes in three ways: 1. The clash gets rejected. 2. In one test case, "info qtree" has the floppy devices swapped, and "info block" has their QOM paths swapped. This is because the floppy device for -fda now gets created after the one for -global isa-fdc.driveB. 3. The error message for -global floppy.drive=3Dfloppy0 changes. Before the patch, we set isa-fdc.driveA to -fda's block backend, then create the floppy device for it, then move the backend from isa-fdc.driveA to floppy.drive. Floppy creation fails when applying -global floppy.drive=3Dfloppy0, because floppy0 is still attached to isa-fdc. After the patch, we create the floppy for -fda, then set its drive property to floppy0. Now floppy creation succeeds, but setting the drive property fails, because -global already set it. Yes, this is exasperatingly complicated. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-5-armbru@redhat.com> --- include/hw/block/fdc.h | 1 + hw/block/fdc.c | 51 ++++++------ hw/isa/isa-superio.c | 18 ++-- hw/sparc64/sun4u.c | 9 +- tests/qemu-iotests/172 | 3 +- tests/qemu-iotests/172.out | 164 ++++++++++--------------------------- 6 files changed, 79 insertions(+), 167 deletions(-) diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h index c15ff4c623..8855d3476c 100644 --- a/include/hw/block/fdc.h +++ b/include/hw/block/fdc.h @@ -9,6 +9,7 @@ =20 #define TYPE_ISA_FDC "isa-fdc" =20 +void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds); ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds); void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, hwaddr mmio_base, DriveInfo **fds); diff --git a/hw/block/fdc.c b/hw/block/fdc.c index be0674e4aa..2650dcb0df 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2497,6 +2497,29 @@ static void fdctrl_result_timer(void *opaque) } =20 /* Init functions */ + +static void fdctrl_init_drives(FloppyBus *bus, DriveInfo **fds) +{ + DeviceState *dev; + int i; + + for (i =3D 0; i < MAX_FD; i++) { + if (fds[i]) { + dev =3D qdev_new("floppy"); + qdev_prop_set_uint32(dev, "unit", i); + qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(fds[i]), + &error_fatal); + qdev_realize_and_unref(dev, &bus->bus, &error_fatal); + } + } +} + +void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds) +{ + fdctrl_init_drives(&ISA_FDC(fdc)->state.bus, fds); +} + static void fdctrl_connect_drives(FDCtrl *fdctrl, DeviceState *fdc_dev, Error **errp) { @@ -2544,25 +2567,15 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, D= eviceState *fdc_dev, =20 ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds) { - DeviceState *dev; ISADevice *isadev; =20 isadev =3D isa_try_new(TYPE_ISA_FDC); if (!isadev) { return NULL; } - dev =3D DEVICE(isadev); - - if (fds[0]) { - qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fds[0]), - &error_fatal); - } - if (fds[1]) { - qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fds[1]), - &error_fatal); - } isa_realize_and_unref(isadev, bus, &error_fatal); =20 + isa_fdc_init_drives(isadev, fds); return isadev; } =20 @@ -2578,18 +2591,12 @@ void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, sys =3D SYSBUS_FDC(dev); fdctrl =3D &sys->state; fdctrl->dma_chann =3D dma_chann; /* FIXME */ - if (fds[0]) { - qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fds[0]), - &error_fatal); - } - if (fds[1]) { - qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fds[1]), - &error_fatal); - } sbd =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sbd, &error_fatal); sysbus_connect_irq(sbd, 0, irq); sysbus_mmio_map(sbd, 0, mmio_base); + + fdctrl_init_drives(&sys->state.bus, fds); } =20 void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, @@ -2599,15 +2606,13 @@ void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, FDCtrlSysBus *sys; =20 dev =3D qdev_new("SUNW,fdtwo"); - if (fds[0]) { - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(fds[0]), - &error_fatal); - } sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sys =3D SYSBUS_FDC(dev); sysbus_connect_irq(SYS_BUS_DEVICE(sys), 0, irq); sysbus_mmio_map(SYS_BUS_DEVICE(sys), 0, io_base); *fdc_tc =3D qdev_get_gpio_in(dev, 0); + + fdctrl_init_drives(&sys->state.bus, fds); } =20 static void fdctrl_realize_common(DeviceState *dev, FDCtrl *fdctrl, diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index d3d58f9f16..e2e47d8fd9 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -17,6 +17,7 @@ #include "sysemu/sysemu.h" #include "sysemu/blockdev.h" #include "chardev/char.h" +#include "hw/block/fdc.h" #include "hw/isa/superio.h" #include "hw/qdev-properties.h" #include "hw/input/i8042.h" @@ -31,7 +32,7 @@ static void isa_superio_realize(DeviceState *dev, Error *= *errp) ISADevice *isa; DeviceState *d; Chardev *chr; - DriveInfo *drive; + DriveInfo *fd[MAX_FD]; char *name; int i; =20 @@ -115,7 +116,7 @@ static void isa_superio_realize(DeviceState *dev, Error= **errp) =20 /* Floppy disc */ if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) { - isa =3D isa_new("isa-fdc"); + isa =3D isa_new(TYPE_ISA_FDC); d =3D DEVICE(isa); if (k->floppy.get_iobase) { qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0)= ); @@ -124,19 +125,12 @@ static void isa_superio_realize(DeviceState *dev, Err= or **errp) qdev_prop_set_uint32(d, "irq", k->floppy.get_irq(sio, 0)); } /* FIXME use a qdev drive property instead of drive_get() */ - drive =3D drive_get(IF_FLOPPY, 0, 0); - if (drive !=3D NULL) { - qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive), - &error_fatal); - } - /* FIXME use a qdev drive property instead of drive_get() */ - drive =3D drive_get(IF_FLOPPY, 0, 1); - if (drive !=3D NULL) { - qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive), - &error_fatal); + for (i =3D 0; i < MAX_FD; i++) { + fd[i] =3D drive_get(IF_FLOPPY, 0, i); } object_property_add_child(OBJECT(sio), "isa-fdc", OBJECT(isa)); isa_realize_and_unref(isa, bus, &error_fatal); + isa_fdc_init_drives(isa, fd); sio->floppy =3D isa; trace_superio_create_floppy(0, k->floppy.get_iobase ? diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 97e6d3a025..9c8655cffc 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -341,16 +341,9 @@ static void ebus_realize(PCIDevice *pci_dev, Error **e= rrp) } isa_dev =3D isa_new(TYPE_ISA_FDC); dev =3D DEVICE(isa_dev); - if (fd[0]) { - qdev_prop_set_drive(dev, "driveA", blk_by_legacy_dinfo(fd[0]), - &error_abort); - } - if (fd[1]) { - qdev_prop_set_drive(dev, "driveB", blk_by_legacy_dinfo(fd[1]), - &error_abort); - } qdev_prop_set_uint32(dev, "dma", -1); isa_realize_and_unref(isa_dev, s->isa_bus, &error_fatal); + isa_fdc_init_drives(isa_dev, fd); =20 /* Power */ dev =3D qdev_new(TYPE_SUN4U_POWER); diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172 index 18056bcef7..3abfa72948 100755 --- a/tests/qemu-iotests/172 +++ b/tests/qemu-iotests/172 @@ -148,9 +148,10 @@ echo =3D=3D=3D Mixing -fdX and -global =3D=3D=3D check_floppy_qtree -fda "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveB=3Dnone0 check_floppy_qtree -fdb "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveA=3Dnone0 =20 -# Conflicting (-fdX wins) +# Conflicting check_floppy_qtree -fda "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveA=3Dnone0 check_floppy_qtree -fdb "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global isa-fdc.driveB=3Dnone0 +# Conflicting, -fdX wins check_floppy_qtree -fda "$TEST_IMG" -drive if=3Dnone,file=3D"$TEST_IMG.2" = -global floppy.drive=3Dnone0 =20 echo diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 68e7a5ea5f..340dbd39cb 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -205,22 +205,22 @@ Testing: -fdb dev: floppy, id "" unit =3D 1 (0x1) drive =3D "floppy1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "288" @@ -675,17 +675,6 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is isa irq 6 bus: floppy-bus.0 type floppy-bus - dev: floppy, id "" - unit =3D 1 (0x1) - drive =3D "none0" - logical_block_size =3D 512 (512 B) - physical_block_size =3D 512 (512 B) - min_io_size =3D 0 (0 B) - opt_io_size =3D 0 (0 B) - discard_granularity =3D 4294967295 (4 GiB) - write-cache =3D "auto" - share-rw =3D false - drive-type =3D "144" dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" @@ -697,13 +686,24 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global is write-cache =3D "auto" share-rw =3D false drive-type =3D "144" + dev: floppy, id "" + unit =3D 1 (0x1) + drive =3D "none0" + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) + write-cache =3D "auto" + share-rw =3D false + drive-type =3D "144" floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/unattached/device[15] + Attached to: /machine/unattached/device[16] Removable device: not locked, tray closed Cache mode: writeback =20 none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[16] + Attached to: /machine/unattached/device[15] Removable device: not locked, tray closed Cache mode: writeback =20 @@ -773,92 +773,10 @@ sd0: [not inserted] =20 =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveA=3Dnone0 - - dev: isa-fdc, id "" - iobase =3D 1008 (0x3f0) - irq =3D 6 (0x6) - dma =3D 2 (0x2) - driveA =3D "" - driveB =3D "" - check_media_rate =3D true - fdtypeA =3D "auto" - fdtypeB =3D "auto" - fallback =3D "288" - isa irq 6 - bus: floppy-bus.0 - type floppy-bus - dev: floppy, id "" - unit =3D 0 (0x0) - drive =3D "floppy0" - logical_block_size =3D 512 (512 B) - physical_block_size =3D 512 (512 B) - min_io_size =3D 0 (0 B) - opt_io_size =3D 0 (0 B) - discard_granularity =3D 4294967295 (4 GiB) - write-cache =3D "auto" - share-rw =3D false - drive-type =3D "144" -floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/unattached/device[15] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[14] - Cache mode: writeback - -ide1-cd0: [not inserted] - Attached to: /machine/unattached/device[22] - Removable device: not locked, tray closed - -sd0: [not inserted] - Removable device: not locked, tray closed -(qemu) quit - +QEMU_PROG: Floppy unit 0 is in use =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveB=3Dnone0 - - dev: isa-fdc, id "" - iobase =3D 1008 (0x3f0) - irq =3D 6 (0x6) - dma =3D 2 (0x2) - driveA =3D "" - driveB =3D "" - check_media_rate =3D true - fdtypeA =3D "auto" - fdtypeB =3D "auto" - fallback =3D "288" - isa irq 6 - bus: floppy-bus.0 - type floppy-bus - dev: floppy, id "" - unit =3D 1 (0x1) - drive =3D "floppy1" - logical_block_size =3D 512 (512 B) - physical_block_size =3D 512 (512 B) - min_io_size =3D 0 (0 B) - opt_io_size =3D 0 (0 B) - discard_granularity =3D 4294967295 (4 GiB) - write-cache =3D "auto" - share-rw =3D false - drive-type =3D "144" -floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/unattached/device[15] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[14] - Cache mode: writeback - -ide1-cd0: [not inserted] - Attached to: /machine/unattached/device[22] - Removable device: not locked, tray closed - -sd0: [not inserted] - Removable device: not locked, tray closed -(qemu) quit - +QEMU_PROG: Floppy unit 1 is in use =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global floppy.drive=3Dnone0 =20 @@ -878,11 +796,11 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -global fl dev: floppy, id "" unit =3D 0 (0x0) drive =3D "floppy0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1500,11 +1418,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= global floppy.drive=3Dnone0 -device dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none0" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1546,11 +1464,11 @@ Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -= drive if=3Dnone,file=3DTEST_DIR/t.qco dev: floppy, id "" unit =3D 0 (0x0) drive =3D "none1" - logical_block_size =3D 512 (0x200) - physical_block_size =3D 512 (0x200) - min_io_size =3D 0 (0x0) - opt_io_size =3D 0 (0x0) - discard_granularity =3D 4294967295 (0xffffffff) + logical_block_size =3D 512 (512 B) + physical_block_size =3D 512 (512 B) + min_io_size =3D 0 (0 B) + opt_io_size =3D 0 (0 B) + discard_granularity =3D 4294967295 (4 GiB) write-cache =3D "auto" share-rw =3D false drive-type =3D "144" @@ -1585,7 +1503,7 @@ Testing: -fda -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Drive 'floppy0' is already in u= se because it has been automatically connected to another device (did you n= eed 'if=3Dnone' in the drive options?) =20 Testing: -fda -global floppy.drive=3Dfloppy0 -QEMU_PROG: can't apply global floppy.drive=3Dfloppy0: Drive 'floppy0' is a= lready in use because it has been automatically connected to another device= (did you need 'if=3Dnone' in the drive options?) +QEMU_PROG: Drive 'floppy0' is already in use because it has been automatic= ally connected to another device (did you need 'if=3Dnone' in the drive opt= ions?) =20 Testing: -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Property 'floppy.drive' can't f= ind value 'floppy0' --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922549; cv=none; d=zohomail.com; s=zohoarc; b=HZBvgzRASwQciQY9M4F95Tzjtke4Lxsyw2o4b8SbkADwqoNFwzIm0Yyab0A8tp31cF0mHDGDfBQCLAm88IlzggqYOMO0CnxXTkOCLFjNs8V6dcKJX7doohgLKPQ5QTmGizIdMHHVCug2KoonrCE6rbi+5R6wvwNTG8GZSjhx7+4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922549; h=Content-Type:Content-Transfer-Encoding:Cc: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=S6+SXKHm2YJJ94V216e5x2QAVQmPP4XEKgLli7B7ET0=; b=L/C/zzdwQggR8Esn20GKHbOtaYu+cKmjjzhqSmAyJUxRzOo8gmZ1TFDigUE7H76VNTkDSzE5OBsYfLJ5pIvY6GO6Y5IimabBewRC6z9Lw1Dz5FPIJeUHpSHMO98kWybszSHyw9WNZ9uS7cNvBgaq2g8BH0twJrJ8FvJ5H/X1whQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 159292254995310.050115824656018; Tue, 23 Jun 2020 07:29:09 -0700 (PDT) Received: from localhost ([::1]:42780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjvA-0001CJ-Kt for importer@patchew.org; Tue, 23 Jun 2020 10:29:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpp-0001fu-AG for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:37 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:52811 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpl-0007hw-4n for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:36 -0400 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-375-6Q5DdsPTN1KsTWlTXXv30A-1; Tue, 23 Jun 2020 10:23:30 -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 8E4E0107BEF8 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 580871002393; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 480511138473; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S6+SXKHm2YJJ94V216e5x2QAVQmPP4XEKgLli7B7ET0=; b=Z7M8REckMkKRVOk5a+RZ+ByiY3EQoxV7AGzeRcEFfiohX6nurYwbpnoGuM+PCZKLMGVF4j AJKy9ZrOsU80iWtlC+xd6wXq7z3AQWm2btPC/hKDTVM1+l8ky0z7iBN8uUDKSdHayUvQ6i 1EKvx4fdgZsPc4hNT1L1Dgr7/xXUswc= X-MC-Unique: 6Q5DdsPTN1KsTWlTXXv30A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 05/16] fdc: Open-code fdctrl_init_isa() Date: Tue, 23 Jun 2020 16:23:15 +0200 Message-Id: <20200623142326.2349416-6-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:54:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Helper function fdctrl_init_isa() is less than helpful: one of three places creating "isa-fdc" devices use it. Open-code it there, and drop the function. Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200622094227.1271650-6-armbru@redhat.com> --- include/hw/block/fdc.h | 1 - hw/block/fdc.c | 14 -------------- hw/i386/pc.c | 8 ++++++-- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h index 8855d3476c..d232d3fa1e 100644 --- a/include/hw/block/fdc.h +++ b/include/hw/block/fdc.h @@ -10,7 +10,6 @@ #define TYPE_ISA_FDC "isa-fdc" =20 void isa_fdc_init_drives(ISADevice *fdc, DriveInfo **fds); -ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds); void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, hwaddr mmio_base, DriveInfo **fds); void sun4m_fdctrl_init(qemu_irq irq, hwaddr io_base, diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 2650dcb0df..d1f7722cff 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2565,20 +2565,6 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, De= viceState *fdc_dev, } } =20 -ISADevice *fdctrl_init_isa(ISABus *bus, DriveInfo **fds) -{ - ISADevice *isadev; - - isadev =3D isa_try_new(TYPE_ISA_FDC); - if (!isadev) { - return NULL; - } - isa_realize_and_unref(isadev, bus, &error_fatal); - - isa_fdc_init_drives(isadev, fds); - return isadev; -} - void fdctrl_init_sysbus(qemu_irq irq, int dma_chann, hwaddr mmio_base, DriveInfo **fds) { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d103b8c0ab..f670bcd6e6 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1142,7 +1142,7 @@ static void pc_superio_init(ISABus *isa_bus, bool cre= ate_fdctrl, bool no_vmport) int i; DriveInfo *fd[MAX_FD]; qemu_irq *a20_line; - ISADevice *i8042, *port92, *vmmouse; + ISADevice *fdc, *i8042, *port92, *vmmouse; =20 serial_hds_isa_init(isa_bus, 0, MAX_ISA_SERIAL_PORTS); parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); @@ -1152,7 +1152,11 @@ static void pc_superio_init(ISABus *isa_bus, bool cr= eate_fdctrl, bool no_vmport) create_fdctrl |=3D !!fd[i]; } if (create_fdctrl) { - fdctrl_init_isa(isa_bus, fd); + fdc =3D isa_new(TYPE_ISA_FDC); + if (fdc) { + isa_realize_and_unref(fdc, isa_bus, &error_fatal); + isa_fdc_init_drives(fdc, fd); + } } =20 i8042 =3D isa_create_simple(isa_bus, "i8042"); --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922742; cv=none; d=zohomail.com; s=zohoarc; b=BgK9Z+xKQxFZVUqQ+fOleOvdPn3lvjqTW71A0Cbzm0H5B3FnzxmgL3scx60GgK9KGyiActSNqOVJ127g/qoxLNyeihhN8C5NMzq6Bd29r3c+02FwtHkcE/0HJL3WpHR2XujC5HHNogaIFuQKq4dBfrBjxJkbj+91PhaBHtg3pH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922742; h=Content-Type:Content-Transfer-Encoding:Cc: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=IpQdIDYRI9rDAfEJnDjAPnlyvVTzWRcK7FLnYnoivYU=; b=IzXI+yaGw1OZHUiZXcUSOx0lwg8ptaxqYEAW+RIPH0lc4pBbnQhV59VzrBB2qoY3z7kuQc5t3DsObyUGxMJzPyNB8AQ2vPTeXeDD0WqAH7sHlNytoe4B9+CMfWLbdoGsHEazU3uoVX7zZUj1U6P3QR8xuXXxig1jUk0xk0MKWY8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922742208556.2867484096856; Tue, 23 Jun 2020 07:32:22 -0700 (PDT) Received: from localhost ([::1]:53060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjyG-0005dl-TC for importer@patchew.org; Tue, 23 Jun 2020 10:32:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjps-0001kR-0A for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:56521 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007j7-7P for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:39 -0400 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-294-9fVrayLmM5GLJC10HRe3Sg-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1BD664AD0 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57C327CCC0; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4D6BC1138474; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IpQdIDYRI9rDAfEJnDjAPnlyvVTzWRcK7FLnYnoivYU=; b=hij5AyNFngJdGBhHhP55BSzdLCMwMU5Rc4valObUq2p1mUWrYSbpQNfH8bc84STWBPF6d7 bMYY0unCP7+LZHpBrjB7jTC495h3c6R/BYCikXyFIx3noQv3/FKLv0VJMSmHTohflNQOWr 9hLUpknuIlB92q88zMSUF8BOcqKse9M= X-MC-Unique: 9fVrayLmM5GLJC10HRe3Sg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 06/16] fdc: Deprecate configuring floppies with -global isa-fdc Date: Tue, 23 Jun 2020 16:23:16 +0200 Message-Id: <20200623142326.2349416-7-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Deprecate -global isa-fdc.driveA=3D... -global isa-fdc.driveB=3D... in favour of -device floppy,unit=3D0,drive=3D... -device floppy,unit=3D1,drive=3D... Same for the other floppy controller devices. Signed-off-by: Markus Armbruster Acked-by: John Snow Message-Id: <20200622094227.1271650-7-armbru@redhat.com> --- docs/qdev-device-use.txt | 13 ++++--------- docs/system/deprecated.rst | 26 ++++++++++++++++++++++++++ hw/block/fdc.c | 17 +++++++++++++++++ tests/qemu-iotests/172.out | 30 ++++++++++++++++++++++++++++++ 4 files changed, 77 insertions(+), 9 deletions(-) diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index cc53e97dcd..3d781be547 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -104,15 +104,10 @@ The -device argument differs in detail for each type = of drive: =20 * if=3Dfloppy =20 - -global isa-fdc.driveA=3DDRIVE-ID - -global isa-fdc.driveB=3DDRIVE-ID + -device floppy,unit=3DUNIT,drive=3DDRIVE-ID =20 - This is -global instead of -device, because the floppy controller is - created automatically, and we want to configure that one, not create - a second one (which isn't possible anyway). - - Without any -global isa-fdc,... you get an empty driveA and no - driveB. You can use -nodefaults to suppress the default driveA, see + Without any -device floppy,... you get an empty unit 0 and no unit + 1. You can use -nodefaults to suppress the default unit 0, see "Default Devices". =20 * if=3Dvirtio @@ -385,7 +380,7 @@ some DEVNAMEs: =20 default device suppressing DEVNAMEs CD-ROM ide-cd, ide-drive, ide-hd, scsi-cd, scsi-hd - isa-fdc's driveA floppy, isa-fdc + floppy floppy, isa-fdc parallel isa-parallel serial isa-serial VGA VGA, cirrus-vga, isa-vga, isa-cirrus-vga, diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 3a255591c3..6f8bf19d37 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -164,6 +164,32 @@ previously available ``-tb-size`` option. Use ``-display sdl,show-cursor=3Don`` or ``-display gtk,show-cursor=3Don`` instead. =20 +``Configuring floppies with ``-global`` +''''''''''''''''''''''''''''''''''''''' + +Use ``-device floppy,...`` instead: +:: + + -global isa-fdc.driveA=3D... + -global sysbus-fdc.driveA=3D... + -global SUNW,fdtwo.drive=3D... + +become +:: + + -device floppy,unit=3D0,drive=3D... + +and +:: + + -global isa-fdc.driveB=3D... + -global sysbus-fdc.driveB=3D... + +become +:: + + -device floppy,unit=3D1,drive=3D... + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 diff --git a/hw/block/fdc.c b/hw/block/fdc.c index d1f7722cff..7e143cbab0 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2528,6 +2528,7 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, Dev= iceState *fdc_dev, DeviceState *dev; BlockBackend *blk; Error *local_err =3D NULL; + const char *fdc_name, *drive_suffix; =20 for (i =3D 0; i < MAX_FD; i++) { drive =3D &fdctrl->drives[i]; @@ -2542,10 +2543,26 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, D= eviceState *fdc_dev, continue; } =20 + fdc_name =3D object_get_typename(OBJECT(fdc_dev)); + drive_suffix =3D !strcmp(fdc_name, "SUNW,fdtwo") ? "" : i ? "B" : = "A"; + warn_report("warning: property %s.drive%s is deprecated", + fdc_name, drive_suffix); + error_printf("Use -device floppy,unit=3D%d,drive=3D... instead.\n"= , i); + dev =3D qdev_new("floppy"); qdev_prop_set_uint32(dev, "unit", i); qdev_prop_set_enum(dev, "drive-type", fdctrl->qdev_for_drives[i].t= ype); =20 + /* + * Hack alert: we move the backend from the floppy controller + * device to the floppy device. We first need to detach the + * controller, or else floppy_create()'s qdev_prop_set_drive() + * will die when it attaches floppy device. We also need to + * take another reference so that blk_detach_dev() doesn't + * free blk while we still need it. + * + * The hack is probably a bad idea. + */ blk_ref(blk); blk_detach_dev(blk, fdc_dev); fdctrl->qdev_for_drives[i].blk =3D NULL; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 340dbd39cb..778406e4bf 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -383,6 +383,8 @@ sd0: [not inserted] =3D=3D=3D Using -drive if=3Dnone and -global =3D=3D=3D =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -global isa-fdc.driveA= =3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -423,6 +425,8 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -global isa-fdc.driveB= =3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -463,6 +467,10 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -global isa-fdc.driveB=3D= none1 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -661,6 +669,8 @@ sd0: [not inserted] =3D=3D=3D Mixing -fdX and -global =3D=3D=3D =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveB=3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -717,6 +727,8 @@ sd0: [not inserted] =20 =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveA=3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -773,9 +785,13 @@ sd0: [not inserted] =20 =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveA=3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. QEMU_PROG: Floppy unit 0 is in use =20 Testing: -fdb TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global isa-fdc.driveB=3Dnone0 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. QEMU_PROG: Floppy unit 1 is in use =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global floppy.drive=3Dnone0 @@ -1177,6 +1193,8 @@ QEMU_PROG: -device floppy,drive=3Dnone0,unit=3D0: Flo= ppy unit 0 is in use =3D=3D=3D Mixing -global and -device =3D=3D=3D =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -1233,6 +1251,8 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D1 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -1289,6 +1309,8 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -1345,6 +1367,8 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D0 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. =20 dev: isa-fdc, id "" iobase =3D 1008 (0x3f0) @@ -1441,9 +1465,13 @@ sd0: [not inserted] =20 =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveA=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D0 +QEMU_PROG: warning: warning: property isa-fdc.driveA is deprecated +Use -device floppy,unit=3D0,drive=3D... instead. QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D0: Floppy unit 0 is in use =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global isa-fdc.driveB=3Dnone0 -device floppy,drive=3Dno= ne1,unit=3D1 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D1: Floppy unit 1 is in use =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global floppy.drive=3Dnone0 -device floppy,drive=3Dnone= 1,unit=3D0 @@ -1512,6 +1540,8 @@ QEMU_PROG: -device floppy,drive=3Dfloppy0: Property '= floppy.drive' can't find valu =3D=3D=3D Too many floppy drives =3D=3D=3D =20 Testing: -drive if=3Dfloppy,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file= =3DTEST_DIR/t.qcow2.2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.3 -global is= a-fdc.driveB=3Dnone0 -device floppy,drive=3Dnone1 +QEMU_PROG: warning: warning: property isa-fdc.driveB is deprecated +Use -device floppy,unit=3D1,drive=3D... instead. QEMU_PROG: -device floppy,drive=3Dnone1: Can't create floppy unit 2, bus s= upports only 2 units =20 =20 --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922434; cv=none; d=zohomail.com; s=zohoarc; b=Q4aYSBLdtBEG1WomTEJh0siZdbaE1RnPXCUW1+SM+waBXS7T038uYQGMEhVt9WyPbXq2T6YUcu94lVIXIcHQ69CPzM5vK+jFSZNnK8tw1M7pARywKEcf1pqXICpId3HbJO79DfkHUQwVb2ayKttRXLPVFNnEsG1enc9rhk/SLO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922434; 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=a1I3WqrrfPmxBDbZXhSPi23ZNKJws33Wu6BUpoSalVA=; b=aGJUTzf7KKWQWHm+UUc923pbJA4iLcmMcr4KUB6vyofX5ACOsH7JftJPkjfoEZJ/NZBeWmwd0Pg+PcLbXC6dqWD9A8sG/QfDHx+q08m1gNYAK5V74Hh4NwWakqy4NfDEeFtIBI32BkgabfU0ShfqKIdv87zOEHtM36qPRQlP+WI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922434893172.40384364764304; Tue, 23 Jun 2020 07:27:14 -0700 (PDT) Received: from localhost ([::1]:34428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjtJ-0006FP-Jk for importer@patchew.org; Tue, 23 Jun 2020 10:27:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51492) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpp-0001fR-0Y for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:37 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:57860 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpl-0007hr-6t for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:36 -0400 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-394-i4XNS73xMBOlRtbtbj-q4Q-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D5C0107BEF7 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E19E71688 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 50FC11138475; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922212; h=from:from: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; bh=a1I3WqrrfPmxBDbZXhSPi23ZNKJws33Wu6BUpoSalVA=; b=UNCJwEjUYXQ5pi8n7XaUxymE2heg8eGaYB44XpOfjx1Ft92GDYtVsXiYsrITup8UTxI2O+ +H0kmPCDrnwbm/Te4zeFKUBXcv7PVY/4VI4JTBT/8tn6XgYmRXqWc+o9RKso01nzD7/KCM 6mA8SYlM3ybC/dUuDj/TseJsYDENWNE= X-MC-Unique: i4XNS73xMBOlRtbtbj-q4Q-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 07/16] docs/qdev-device-use.txt: Update section "Default Devices" Date: Tue, 23 Jun 2020 16:23:17 +0200 Message-Id: <20200623142326.2349416-8-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Resynchronize the table of default device suppressions with vl.c's default_list[]. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-8-armbru@redhat.com> --- docs/qdev-device-use.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/qdev-device-use.txt b/docs/qdev-device-use.txt index 3d781be547..4bbbcf561f 100644 --- a/docs/qdev-device-use.txt +++ b/docs/qdev-device-use.txt @@ -384,8 +384,8 @@ some DEVNAMEs: parallel isa-parallel serial isa-serial VGA VGA, cirrus-vga, isa-vga, isa-cirrus-vga, - vmware-svga, qxl-vga, virtio-vga - virtioconsole virtio-serial-pci, virtio-serial + vmware-svga, qxl-vga, virtio-vga, ati-vga, + vhost-user-vga =20 The default NIC is connected to a default part created along with it. It is *not* suppressed by configuring a NIC with -device (you may call --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922307; cv=none; d=zohomail.com; s=zohoarc; b=N5jgG4ZZO40i1I4lKC1FgEy5JwXXHPQk5ihQJEoFhfm6k1vHqpzQZ6jILtaXBeYAh6tJunfdPFaSUhkWI+1sdbCXV2q5DF/p6kLZgQA9QhJaWSWlQ8QD/7ogbenmaA19KixveSQ93Kfez0T08w7IZQljlQ39zSv03eQfg48QHpY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922307; 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=wJ29/cEzZpUr8T2CJpMq730T4VO7PgjI2GCUp+hV9Co=; b=PByLLHYwB27Inpxk78OUk+HHSq1tN0ypp4HuKmCqn3MBlUITs6s6yHDqh/8bWaBk1CS6oMR/blGBESG/t+R9uzEdJIFOGcOHaNTXrFuhWHXis++ozrCuTkSO00Fwxz693IqL+bckofwQT0iDXW4k6Do90m53dW8wvDa4oNKKc48= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922307973186.74860532858133; Tue, 23 Jun 2020 07:25:07 -0700 (PDT) Received: from localhost ([::1]:55924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjrG-0003Ri-Ki for importer@patchew.org; Tue, 23 Jun 2020 10:25:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpq-0001im-UD for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:38 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:34621 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007ix-4Y for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:38 -0400 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-79-jLAJmj98PcuJ0b2p30g5FA-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB87C107ACCA for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64B477168E for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 549191138476; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from: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; bh=wJ29/cEzZpUr8T2CJpMq730T4VO7PgjI2GCUp+hV9Co=; b=DSHG5Jgou5zA4mj0p70KqpF5iXnpHKF2Xe/0d1jhwJPS770YFor0Y4ed9FXN2V94YEcsGs TN2T022BccCOHss09bt+/GvWgkktr7S1tHEDahsGsIuK7UDESeOyUITlc3WDC2C8Tx1ygD 8QO3HdSz/SZY9/1i2ocYbNOcuKINaRE= X-MC-Unique: jLAJmj98PcuJ0b2p30g5FA-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 08/16] blockdev: Deprecate -drive with bogus interface type Date: Tue, 23 Jun 2020 16:23:18 +0200 Message-Id: <20200623142326.2349416-9-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:54:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Drives with interface types other than if=3Dnone are for onboard devices. Unfortunately, any such drives the board doesn't pick up can still be used with -device, like this: $ qemu-system-x86_64 -nodefaults -display none -S -drive if=3Dfloppy,id= =3Dbogus,unit=3D7 -device ide-cd,drive=3Dbogus -monitor stdio QEMU 5.0.50 monitor - type 'help' for more information (qemu) info block bogus: [not inserted] Attached to: /machine/peripheral-anon/device[0] Removable device: not locked, tray closed (qemu) info qtree bus: main-system-bus type System [...] bus: ide.1 type IDE dev: ide-cd, id "" ---> drive =3D "bogus" [...] unit =3D 0 (0x0) [...] This kind of abuse has always worked. Deprecate it: qemu-system-x86_64: -drive if=3Dfloppy,id=3Dbogus,unit=3D7: warning: bo= gus if=3Dfloppy is deprecated, use if=3Dnone Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-9-armbru@redhat.com> --- docs/system/deprecated.rst | 8 ++++++++ include/sysemu/blockdev.h | 2 ++ blockdev.c | 27 +++++++++++++++++++++++++-- softmmu/vl.c | 8 ++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst index 6f8bf19d37..728233a8ff 100644 --- a/docs/system/deprecated.rst +++ b/docs/system/deprecated.rst @@ -190,6 +190,14 @@ become =20 -device floppy,unit=3D1,drive=3D... =20 +``-drive`` with bogus interface type +'''''''''''''''''''''''''''''''''''' + +Drives with interface types other than ``if=3Dnone`` are for onboard +devices. It is possible to use drives the board doesn't pick up with +-device. This usage is now deprecated. Use ``if=3Dnone`` instead. + + QEMU Machine Protocol (QMP) commands ------------------------------------ =20 diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index a86d99b3d8..3b5fcda08d 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -35,6 +35,7 @@ struct DriveInfo { bool is_default; /* Added by default_drive() ? */ int media_cd; QemuOpts *opts; + bool claimed_by_board; QTAILQ_ENTRY(DriveInfo) next; }; =20 @@ -45,6 +46,7 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo); void override_max_devs(BlockInterfaceType type, int max_devs); =20 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); +void drive_mark_claimed_by_board(void); void drive_check_orphaned(void); DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); int drive_get_max_bus(BlockInterfaceType type); diff --git a/blockdev.c b/blockdev.c index 72df193ca7..31d5eaf6bf 100644 --- a/blockdev.c +++ b/blockdev.c @@ -239,6 +239,19 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus,= int unit) return NULL; } =20 +void drive_mark_claimed_by_board(void) +{ + BlockBackend *blk; + DriveInfo *dinfo; + + for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { + dinfo =3D blk_legacy_dinfo(blk); + if (dinfo && blk_get_attached_dev(blk)) { + dinfo->claimed_by_board =3D true; + } + } +} + void drive_check_orphaned(void) { BlockBackend *blk; @@ -248,8 +261,10 @@ void drive_check_orphaned(void) =20 for (blk =3D blk_next(NULL); blk; blk =3D blk_next(blk)) { dinfo =3D blk_legacy_dinfo(blk); - if (!blk_get_attached_dev(blk) && !dinfo->is_default && - dinfo->type !=3D IF_NONE) { + if (dinfo->is_default || dinfo->type =3D=3D IF_NONE) { + continue; + } + if (!blk_get_attached_dev(blk)) { loc_push_none(&loc); qemu_opts_loc_restore(dinfo->opts); error_report("machine type does not support" @@ -257,6 +272,14 @@ void drive_check_orphaned(void) if_name[dinfo->type], dinfo->bus, dinfo->unit); loc_pop(&loc); orphans =3D true; + continue; + } + if (!dinfo->claimed_by_board && dinfo->type !=3D IF_VIRTIO) { + loc_push_none(&loc); + qemu_opts_loc_restore(dinfo->opts); + warn_report("bogus if=3D%s is deprecated, use if=3Dnone", + if_name[dinfo->type]); + loc_pop(&loc); } } =20 diff --git a/softmmu/vl.c b/softmmu/vl.c index f669c06ede..3e15ee2435 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -4347,6 +4347,14 @@ void qemu_init(int argc, char **argv, char **envp) /* from here on runstate is RUN_STATE_PRELAUNCH */ machine_run_board_init(current_machine); =20 + /* + * TODO To drop support for deprecated bogus if=3D..., move + * drive_check_orphaned() here, replacing this call. Also drop + * its deprecation warning, along with DriveInfo member + * @claimed_by_board. + */ + drive_mark_claimed_by_board(); + realtime_init(); =20 soundhw_init(); --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922305; cv=none; d=zohomail.com; s=zohoarc; b=hasDvvITC5aZm8IiVR7IS8/EKyiuXKqrz70W+XN+jTxWYDaut3Rg8HJVPKfu1wjWf6ZHzvFSRGFWMCjwmCtH2u/hNhe/kBIQVrAHnTI5puhwlp9L/Oc7CLKdmJP5iDiUGoK/3EvYkKL9nGfku9g4KCZed5EHDN1ZaZ4R/LwSFe4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922305; 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=93r6nGHMD5ISEA8tB0ai9TdRd7SKuzIGhlrhL8D2N+o=; b=WfJ/8E8qneK5NLygn8Du3GSX1RQF1OmNW8JeiB/njMMhWZHz19LMQh4kUngnC7FZHdtkZkQkDwcryXdVzCDkcoeNTJoGhir+re1fXg4eVAw5JBvORiFLog/VapeVj887MQhRyJLZ5y+qO8mlMr+ShTvLYsnkSLS14HNFxO8PVyU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922305291394.0848906687378; Tue, 23 Jun 2020 07:25:05 -0700 (PDT) Received: from localhost ([::1]:55768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjrD-0003Nx-Nq for importer@patchew.org; Tue, 23 Jun 2020 10:25:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51488) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpo-0001fG-SY for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:49992 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpl-0007hv-EP for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:36 -0400 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-455-j7hD1WEGNbuHEomT91aRUw-1; Tue, 23 Jun 2020 10:23:30 -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 ED83464AD4 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 75B8610016E8 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5813A1138477; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922212; h=from:from: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; bh=93r6nGHMD5ISEA8tB0ai9TdRd7SKuzIGhlrhL8D2N+o=; b=XXBskfzQqI3I11d5ll2/OgB0WYdSVmuFpyrY0QpBuxnNsiIAh5HxxiO/IGeXq3+IsOGhyk sx1lMnmha/Khf4CSuY36abpbXpSZ53mMOLw/lFu5Uc4lE8W4DmOtw4QuI6zKPzxcklgljj Ak3lhjqRvZ8i+d3NaW0bikIwoaZqEUc= X-MC-Unique: j7hD1WEGNbuHEomT91aRUw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 09/16] qdev: Eliminate get_pointer(), set_pointer() Date: Tue, 23 Jun 2020 16:23:19 +0200 Message-Id: <20200623142326.2349416-10-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:55:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We stopped using get_pointer() and set_pointer() for netdev in commit 23120b13c6 "net: don't use set/get_pointer() in set/get_netdev()" (v2.3.0), and for chardev in commit becdfa00cf "char: replace PROP_CHR with CharBackend" (v2.8.0). With only the drive user left, they're not helpful anymore. Eliminate. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-10-armbru@redhat.com> --- hw/core/qdev-properties-system.c | 95 ++++++++++++-------------------- 1 file changed, 35 insertions(+), 60 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 70bfd4809b..9aa80495ee 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -25,29 +25,45 @@ #include "sysemu/iothread.h" #include "sysemu/tpm_backend.h" =20 -static void get_pointer(Object *obj, Visitor *v, Property *prop, - char *(*print)(void *ptr), - const char *name, Error **errp) +/* --- drive --- */ + +static void get_drive(Object *obj, Visitor *v, const char *name, void *opa= que, + Error **errp) { DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; void **ptr =3D qdev_get_prop_ptr(dev, prop); + const char *value; char *p; =20 - p =3D *ptr ? print(*ptr) : g_strdup(""); + if (*ptr) { + value =3D blk_name(*ptr); + if (!*value) { + BlockDriverState *bs =3D blk_bs(*ptr); + if (bs) { + value =3D bdrv_get_node_name(bs); + } + } + } else { + value =3D ""; + } + + p =3D g_strdup(value); visit_type_str(v, name, &p, errp); g_free(p); } =20 -static void set_pointer(Object *obj, Visitor *v, Property *prop, - void (*parse)(DeviceState *dev, const char *str, - void **ptr, const char *propname, - Error **errp), - const char *name, Error **errp) +static void set_drive_helper(Object *obj, Visitor *v, const char *name, + void *opaque, bool iothread, Error **errp) { DeviceState *dev =3D DEVICE(obj); + Property *prop =3D opaque; Error *local_err =3D NULL; void **ptr =3D qdev_get_prop_ptr(dev, prop); char *str; + BlockBackend *blk; + bool blk_created =3D false; + int ret; =20 if (dev->realized) { qdev_prop_set_after_realize(dev, name, errp); @@ -59,23 +75,12 @@ static void set_pointer(Object *obj, Visitor *v, Proper= ty *prop, error_propagate(errp, local_err); return; } + if (!*str) { g_free(str); *ptr =3D NULL; return; } - parse(dev, str, ptr, prop->name, errp); - g_free(str); -} - -/* --- drive --- */ - -static void do_parse_drive(DeviceState *dev, const char *str, void **ptr, - const char *propname, bool iothread, Error **er= rp) -{ - BlockBackend *blk; - bool blk_created =3D false; - int ret; =20 blk =3D blk_by_name(str); if (!blk) { @@ -101,7 +106,7 @@ static void do_parse_drive(DeviceState *dev, const char= *str, void **ptr, } if (!blk) { error_setg(errp, "Property '%s.%s' can't find value '%s'", - object_get_typename(OBJECT(dev)), propname, str); + object_get_typename(OBJECT(dev)), prop->name, str); goto fail; } if (blk_attach_dev(blk, dev) < 0) { @@ -126,18 +131,20 @@ fail: /* If we need to keep a reference, blk_attach_dev() took it */ blk_unref(blk); } + + g_free(str); } =20 -static void parse_drive(DeviceState *dev, const char *str, void **ptr, - const char *propname, Error **errp) +static void set_drive(Object *obj, Visitor *v, const char *name, void *opa= que, + Error **errp) { - do_parse_drive(dev, str, ptr, propname, false, errp); + set_drive_helper(obj, v, name, opaque, false, errp); } =20 -static void parse_drive_iothread(DeviceState *dev, const char *str, void *= *ptr, - const char *propname, Error **errp) +static void set_drive_iothread(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) { - do_parse_drive(dev, str, ptr, propname, true, errp); + set_drive_helper(obj, v, name, opaque, true, errp); } =20 static void release_drive(Object *obj, const char *name, void *opaque) @@ -156,38 +163,6 @@ static void release_drive(Object *obj, const char *nam= e, void *opaque) } } =20 -static char *print_drive(void *ptr) -{ - const char *name; - - name =3D blk_name(ptr); - if (!*name) { - BlockDriverState *bs =3D blk_bs(ptr); - if (bs) { - name =3D bdrv_get_node_name(bs); - } - } - return g_strdup(name); -} - -static void get_drive(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) -{ - get_pointer(obj, v, opaque, print_drive, name, errp); -} - -static void set_drive(Object *obj, Visitor *v, const char *name, void *opa= que, - Error **errp) -{ - set_pointer(obj, v, opaque, parse_drive, name, errp); -} - -static void set_drive_iothread(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - set_pointer(obj, v, opaque, parse_drive_iothread, name, errp); -} - const PropertyInfo qdev_prop_drive =3D { .name =3D "str", .description =3D "Node name or ID of a block device to use as a backen= d", --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922568; cv=none; d=zohomail.com; s=zohoarc; b=lXVxjL95VpdSeSkS+KNxnylohSwX1/tDqhfSoGCzsvy33d6NpmLt/BEuiMU35RXbba7z3QepNDO4i89ZyGOyGdvdI2ay0Vj2FTAz2FEvtIkKpMOzAkyl3x/p7Hj+Q4xFkWecAobwbJFBJzzTSHvMMAzJ7HgNTipXKQDYpws/WvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922568; h=Content-Type:Content-Transfer-Encoding:Cc: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=QCas/cPFj20mirC8rsFTvRt+w4e+CPPFkllbWrQ2yHk=; b=Vp8PyilfEojfEB+k0NKbuRA9q4ahWGN6+N0I14OW8MrA8Yraae0vvy2SJ6E3mk2HCmAOWYWssAiG7imTkEdRmVmTI5yNwiuo7LfqYUNqkOF28otaamMnwlZHVrylxkhDpMi9hyYFaFdjyU9N0iNH08D+vAv2tYJC8sFgNFDKXdA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922568978232.5809314680447; Tue, 23 Jun 2020 07:29:28 -0700 (PDT) Received: from localhost ([::1]:44398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjvT-0001qa-MA for importer@patchew.org; Tue, 23 Jun 2020 10:29:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpp-0001h0-V8 for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:37 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:41594 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpl-0007hy-Hi for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:37 -0400 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-44-c7rgV0MLO06-B5RgTtTlrw-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D629E805EE4 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7BE6A4985; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5BC1C1138478; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QCas/cPFj20mirC8rsFTvRt+w4e+CPPFkllbWrQ2yHk=; b=Q1u3B5CI+dTRfX8xbFOJLmb70rCO3lwO8BVS8JZcU9ftgRNujcVe2wVD3UVvl/dC6XK7Hc BNW+YkgoLVDzaCVeQWSDLz+xaDfW/WHvt2piA4GpJLx0OmALAgG3aN893bwIhp7cFM77xy nL5+UmVk1Dgv/8CioEqBaa7KnNRVdxQ= X-MC-Unique: c7rgV0MLO06-B5RgTtTlrw-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 10/16] qdev: Improve netdev property override error a bit Date: Tue, 23 Jun 2020 16:23:20 +0200 Message-Id: <20200623142326.2349416-11-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qdev_prop_set_netdev() fails when the property already has a non-null value. Seems to go back to commit 30c367ed44 "qdev-properties-system.c: Allow vlan or netdev for -device, not both", v1.7.0. Board code doesn't expect failure, and crashes: $ qemu-system-x86_64 --nodefaults -nic user -netdev user,id=3Dnic0 -glo= bal e1000.netdev=3Dnic0 Unexpected error in error_set_from_qdev_prop_error() at /work/armbru/qe= mu/hw/core/qdev-properties.c:1101: qemu-system-x86_64: Property 'e1000.netdev' doesn't take value '__org.q= emu.nic0 ' Aborted (core dumped) -device and device_add handle the failure: $ qemu-system-x86_64 -nodefaults -netdev user,id=3Dnet0 -netdev user,id= =3Dnet1 -device e1000,netdev=3Dnet0,netdev=3Dnet1 qemu-system-x86_64: -device e1000,netdev=3Dnet0,netdev=3Dnet1: Property= 'e1000.netdev' doesn't take value 'net1' $ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -netde= v user,id=3Dnet0 -netdev user,id=3Dnet1 -global e1000.netdev=3Dnet0 QEMU 5.0.50 monitor - type 'help' for more information (qemu) qemu-system-x86_64: warning: netdev net0 has no peer qemu-system-x86_64: warning: netdev net1 has no peer device_add e1000,netdev=3Dnet1 Error: Property 'e1000.netdev' doesn't take value 'net1' Perhaps netdev property override could be made to work. Perhaps it should. I'm not the right guy to figure this out. What I can do is improve the error message a bit: (qemu) device_add e1000,netdev=3Dnet1 Error: -global e1000.netdev=3D... conflicts with netdev=3Dnet1 Cc: Jason Wang Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-11-armbru@redhat.com> --- include/hw/qdev-properties.h | 2 ++ hw/core/qdev-properties-system.c | 30 +++++++++++++++++++++++++++--- hw/core/qdev-properties.c | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 5252bb6b1a..fc0b2f6b45 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -251,6 +251,8 @@ void qdev_prop_set_macaddr(DeviceState *dev, const char= *name, void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); =20 void qdev_prop_register_global(GlobalProperty *prop); +const GlobalProperty *qdev_find_global_prop(DeviceState *dev, + const char *name); int qdev_prop_check_globals(void); void qdev_prop_set_globals(DeviceState *dev); void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *de= v, diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 9aa80495ee..3f84309b7e 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -25,6 +25,28 @@ #include "sysemu/iothread.h" #include "sysemu/tpm_backend.h" =20 +static bool check_prop_still_unset(DeviceState *dev, const char *name, + const void *old_val, const char *new_va= l, + Error **errp) +{ + const GlobalProperty *prop =3D qdev_find_global_prop(dev, name); + + if (!old_val) { + return true; + } + + if (prop) { + error_setg(errp, "-global %s.%s=3D... conflicts with %s=3D%s", + prop->driver, prop->property, name, new_val); + } else { + /* Error message is vague, but a better one would be hard */ + error_setg(errp, "%s=3D%s conflicts, and override is not implement= ed", + name, new_val); + } + return false; +} + + /* --- drive --- */ =20 static void get_drive(Object *obj, Visitor *v, const char *name, void *opa= que, @@ -299,14 +321,16 @@ static void set_netdev(Object *obj, Visitor *v, const= char *name, } =20 for (i =3D 0; i < queues; i++) { - if (peers[i]->peer) { err =3D -EEXIST; goto out; } =20 - if (ncs[i]) { - err =3D -EINVAL; + /* + * TODO Should this really be an error? If no, the old value + * needs to be released before we store the new one. + */ + if (!check_prop_still_unset(dev, name, ncs[i], str, errp)) { goto out; } =20 diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c index ead35d7ffd..71f8aca7c6 100644 --- a/hw/core/qdev-properties.c +++ b/hw/core/qdev-properties.c @@ -1246,6 +1246,23 @@ void qdev_prop_register_global(GlobalProperty *prop) g_ptr_array_add(global_props(), prop); } =20 +const GlobalProperty *qdev_find_global_prop(DeviceState *dev, + const char *name) +{ + GPtrArray *props =3D global_props(); + const GlobalProperty *p; + int i; + + for (i =3D 0; i < props->len; i++) { + p =3D g_ptr_array_index(props, i); + if (object_dynamic_cast(OBJECT(dev), p->driver) + && !strcmp(p->property, name)) { + return p; + } + } + return NULL; +} + int qdev_prop_check_globals(void) { int i, ret =3D 0; --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922738; cv=none; d=zohomail.com; s=zohoarc; b=Lf+vQXi4WZiXog0YYDc/kjfAtA+Y4X7PAFZdwsIRRBzNVTmTweHqAXE0y1zkOKzZMRQ+D6fxJ9X+2Lg5SasoYK+1HTXwf+NnA+4LzcIDXPnd7w7iQ8RKu9prN5faBK6yMuG+hfGZZdCQE0Xp8ci6wStJBNhGrH1F/TZUrAvU43w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922738; 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=A3aFjczSd4UQHmwMhP4bWOv0H8CbS8VcUcE30hg5tR8=; b=CGcV4uDHcoUhELpi9Z6Z5aGgOK8nBjsuy0+h8Q7k7FKKHeOR0TUaeekCuoWKsQ7QEXTW++YeKFXuA6iTPpVFLtoQImnroAwsJMH8W+ZN0DEl9N/AyC+kJCxAfpVM9hO+gkjnwESXTIo4UvHr2laKWD8sGUY0+HauiK5G4Kn5OYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922738681766.463267520608; Tue, 23 Jun 2020 07:32:18 -0700 (PDT) Received: from localhost ([::1]:52952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjyB-0005Zp-VP for importer@patchew.org; Tue, 23 Jun 2020 10:32:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjps-0001lr-N3 for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:56069 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007jM-MO for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 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-326-X4uxK2iIMna0QjLAKwoMuQ-1; Tue, 23 Jun 2020 10:23:30 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F22808035A1 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DCCA5C298 for ; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 5F4E31138479; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from: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; bh=A3aFjczSd4UQHmwMhP4bWOv0H8CbS8VcUcE30hg5tR8=; b=Oecggn6SNBWtv6zaP01snRlkgUht0ENhO1aSb73iEKxat+tWTe+YzoioD94KsWZ93hhGg3 I3aJz2LoIju40EqXtHSLbAVA3f1i7dHtJBqS9GH9/0a7xux3ewqx8DJH6NPIzZZ6xEw8qp 65/Ez8+KB53sBuNhCHLFpoRR3MCDmys= X-MC-Unique: X4uxK2iIMna0QjLAKwoMuQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 11/16] qdev: Reject drive property override Date: Tue, 23 Jun 2020 16:23:21 +0200 Message-Id: <20200623142326.2349416-12-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:53:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" qdev_prop_set_drive() screws up when the property already has a non-null value: it neglects to release the old value. Both the old and the new backend become attached to the same device. Example (taken from iotest 172): -fda ... -drive if=3Dnone,... -global floppy.drive=3Dnone0. Special case: attempting to use the same backend both times fails. Example (also from iotest 172): -fda ... -global floppy.drive=3Dfloppy0. Yet another example: -device with multiple drive=3D... (but not device_add, which silently drops all but the last duplicate property). Perhaps drive property override could be made to work. Perhaps it should. I can't afford the time to figure this out now. What I can do is reject usage that leaves backends in unhealthy states. For what it's worth, we've long done the same for netdev properties. Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-12-armbru@redhat.com> --- hw/core/qdev-properties-system.c | 8 +++ tests/qemu-iotests/172.out | 88 ++------------------------------ 2 files changed, 11 insertions(+), 85 deletions(-) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 3f84309b7e..6b5fc59901 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -98,6 +98,14 @@ static void set_drive_helper(Object *obj, Visitor *v, co= nst char *name, return; } =20 + /* + * TODO Should this really be an error? If no, the old value + * needs to be released before we store the new one. + */ + if (!check_prop_still_unset(dev, name, *ptr, str, errp)) { + return; + } + if (!*str) { g_free(str); *ptr =3D NULL; diff --git a/tests/qemu-iotests/172.out b/tests/qemu-iotests/172.out index 778406e4bf..cca2894af0 100644 --- a/tests/qemu-iotests/172.out +++ b/tests/qemu-iotests/172.out @@ -795,48 +795,7 @@ Use -device floppy,unit=3D1,drive=3D... instead. QEMU_PROG: Floppy unit 1 is in use =20 Testing: -fda TEST_DIR/t.qcow2 -drive if=3Dnone,file=3DTEST_DIR/t.qcow2.2 = -global floppy.drive=3Dnone0 - - dev: isa-fdc, id "" - iobase =3D 1008 (0x3f0) - irq =3D 6 (0x6) - dma =3D 2 (0x2) - driveA =3D "" - driveB =3D "" - check_media_rate =3D true - fdtypeA =3D "auto" - fdtypeB =3D "auto" - fallback =3D "288" - isa irq 6 - bus: floppy-bus.0 - type floppy-bus - dev: floppy, id "" - unit =3D 0 (0x0) - drive =3D "floppy0" - logical_block_size =3D 512 (512 B) - physical_block_size =3D 512 (512 B) - min_io_size =3D 0 (0 B) - opt_io_size =3D 0 (0 B) - discard_granularity =3D 4294967295 (4 GiB) - write-cache =3D "auto" - share-rw =3D false - drive-type =3D "144" -floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/unattached/device[15] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[15] - Cache mode: writeback - -ide1-cd0: [not inserted] - Attached to: /machine/unattached/device[22] - Removable device: not locked, tray closed - -sd0: [not inserted] - Removable device: not locked, tray closed -(qemu) quit - +QEMU_PROG: -global floppy.drive=3D... conflicts with drive=3Dfloppy0 =20 =20 =3D=3D=3D Mixing -fdX and -device =3D=3D=3D @@ -1475,48 +1434,7 @@ Use -device floppy,unit=3D1,drive=3D... instead. QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D1: Floppy unit 1 is in use =20 Testing: -drive if=3Dnone,file=3DTEST_DIR/t.qcow2 -drive if=3Dnone,file=3D= TEST_DIR/t.qcow2.2 -global floppy.drive=3Dnone0 -device floppy,drive=3Dnone= 1,unit=3D0 - - dev: isa-fdc, id "" - iobase =3D 1008 (0x3f0) - irq =3D 6 (0x6) - dma =3D 2 (0x2) - driveA =3D "" - driveB =3D "" - check_media_rate =3D true - fdtypeA =3D "auto" - fdtypeB =3D "auto" - fallback =3D "288" - isa irq 6 - bus: floppy-bus.0 - type floppy-bus - dev: floppy, id "" - unit =3D 0 (0x0) - drive =3D "none1" - logical_block_size =3D 512 (512 B) - physical_block_size =3D 512 (512 B) - min_io_size =3D 0 (0 B) - opt_io_size =3D 0 (0 B) - discard_granularity =3D 4294967295 (4 GiB) - write-cache =3D "auto" - share-rw =3D false - drive-type =3D "144" -none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/peripheral-anon/device[0] - Cache mode: writeback - -none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[0] - Removable device: not locked, tray closed - Cache mode: writeback - -ide1-cd0: [not inserted] - Attached to: /machine/unattached/device[21] - Removable device: not locked, tray closed - -sd0: [not inserted] - Removable device: not locked, tray closed -(qemu) quit - +QEMU_PROG: -device floppy,drive=3Dnone1,unit=3D0: -global floppy.drive=3D.= .. conflicts with drive=3Dnone1 =20 =20 =3D=3D=3D Attempt to use drive twice =3D=3D=3D @@ -1531,7 +1449,7 @@ Testing: -fda -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Drive 'floppy0' is already in u= se because it has been automatically connected to another device (did you n= eed 'if=3Dnone' in the drive options?) =20 Testing: -fda -global floppy.drive=3Dfloppy0 -QEMU_PROG: Drive 'floppy0' is already in use because it has been automatic= ally connected to another device (did you need 'if=3Dnone' in the drive opt= ions?) +QEMU_PROG: -global floppy.drive=3D... conflicts with drive=3Dfloppy0 =20 Testing: -device floppy,drive=3Dfloppy0 QEMU_PROG: -device floppy,drive=3Dfloppy0: Property 'floppy.drive' can't f= ind value 'floppy0' --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922914; cv=none; d=zohomail.com; s=zohoarc; b=lf+jslvexXDzHczLxduB/HJJxIMjj8YUWPVlHChaB0vebolBczDd3psLV18f10tNxFypp2o5uke9Jz+7JDNsjiWd7649nu9X26/pNsq1n3VuAFx4FfiBc2GAYPTyWAhL8iGoG76zFCbBNzBSnBY9wIr4TJrb7H+h84m6BZe21IE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922914; h=Content-Type:Content-Transfer-Encoding:Cc: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=IZqEmarPbPYfANjzzcHiIfwjcJ7vKFRLU1Fd3Ia4Vfw=; b=E15OqoDVOOQylswJ5YbLskQmDEbO5HGHmCQ9/3oWfFd8TN5IcPWAUHKh9tp4WI/8T+AtQnZfe7VGwZUXBdCTw5gRPuhk3bRHRcPpNf2U2t2JIX16c9IBkNWH2Uhdsut0rET46fpLsT//zwVGrbwGRck5QFCEGr510KgdWT3SQSc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922914248704.1684963016655; Tue, 23 Jun 2020 07:35:14 -0700 (PDT) Received: from localhost ([::1]:32968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnk12-00014u-M5 for importer@patchew.org; Tue, 23 Jun 2020 10:35:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpu-0001pS-OA for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:42 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:53968 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpo-0007lm-3F for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:42 -0400 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-309-ynL-CZwlOcOGeTmLPbBkVg-1; Tue, 23 Jun 2020 10:23:33 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB69B805EE4 for ; Tue, 23 Jun 2020 14:23:32 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F7AD5D9E7; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 62D80113847A; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IZqEmarPbPYfANjzzcHiIfwjcJ7vKFRLU1Fd3Ia4Vfw=; b=GRZ7PqcY3BlIQ7Nf/bMq0JmAhsYdfJBnPYm4KTl/qXcGKx1l0bxR6gnhl2H04O7MoMqq1Y 88L7x0U3sZ7Ez7aD02skieEXTpZh5vUcHbUb9e6NJ5E5m5pqU3Ia86Lp6kqrBYUgMEwCpj 9scBVvd/P2HFGTXRmdnLlZUBTLcNWIE= X-MC-Unique: ynL-CZwlOcOGeTmLPbBkVg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 12/16] qdev: Reject chardev property override Date: Tue, 23 Jun 2020 16:23:22 +0200 Message-Id: <20200623142326.2349416-13-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:54:39 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) qdev_prop_set_chr() screws up when the property already has a non-null value: it neglects to release the old value. Both the old and the new backend become attached to the same device. Unlike for block devices (see previous commit), this can't be observed from the monitor (I think). Example: -serial null -chardev null,id=3Dchr0 -global isa-serial.chardev=3D= chr0 Special case: attempting to use the same backend both times crashes: $ qemu-system-x86_64 --nodefaults -serial null -global isa-serial.chard= ev=3Dserial0 Unexpected error in qemu_chr_fe_init() at /work/armbru/qemu/chardev/cha= r-fe.c:220: qemu-system-x86_64: Device 'serial0' is in use Aborted (core dumped) Yet another example: -device with multiple chardev=3D... (but not device_add, which silently drops all but the last duplicate property). Perhaps chardev property override could be made to work. Perhaps it should. I can't afford the time to figure this out now. What I can do reject usage that leaves backends in unhealthy states. For what it's worth, we've long done the same for netdev properties. Cc: Marc-Andr=C3=A9 Lureau Cc: Paolo Bonzini Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-13-armbru@redhat.com> --- hw/core/qdev-properties-system.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 6b5fc59901..2561fa09a8 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -244,6 +244,14 @@ static void set_chr(Object *obj, Visitor *v, const cha= r *name, void *opaque, return; } =20 + /* + * TODO Should this really be an error? If no, the old value + * needs to be released before we store the new one. + */ + if (!check_prop_still_unset(dev, name, be->chr, str, errp)) { + return; + } + if (!*str) { g_free(str); be->chr =3D NULL; --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922916; cv=none; d=zohomail.com; s=zohoarc; b=TvE0tdh5QawV28HHlutSG4T7f6r14ShUBYl/NYruPKghcekG8sdIaufvuPoevHcL/XXr2Us/v0eej/76bzq2Gdse2F4LV+5BXfnDeu7PReNJrgBMFyj9qJIODNT9pmZrynL0zNkPapirFECdzlVpiq5IHE8CEt9jJBSWvvYp+A4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922916; h=Content-Type:Content-Transfer-Encoding:Cc: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=njx+/4T03rHeDhHNOsXspEBEwY7XDl2OT4MZUeFyvHQ=; b=Hbq7XsY7aPvHENBYc4y4RoFe8TtrkFCM0n+LlI8f2IpvcztgtWokuTbfKnCtRr/VbB47dRiNeWRQkp9qphZJovbzFYoXdDPly0cnaexsxAhNL0l4Nmw7NOo0ayY2Ng+xomE6qz7m4njDrlpqlLU1PZZH2s/zwYUH4YCiD5cCNSo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922916334232.14041141631094; Tue, 23 Jun 2020 07:35:16 -0700 (PDT) Received: from localhost ([::1]:33050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnk14-00018X-J6 for importer@patchew.org; Tue, 23 Jun 2020 10:35:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpt-0001n1-9e for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:41 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:52184 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpl-0007iG-RD for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:40 -0400 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-299-CHElVM0hM1iWqAHFpS5POg-1; Tue, 23 Jun 2020 10:23:31 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35E7E1883604 for ; Tue, 23 Jun 2020 14:23:30 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A965A5C541; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6799B113847B; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=njx+/4T03rHeDhHNOsXspEBEwY7XDl2OT4MZUeFyvHQ=; b=Govqt6pFhI9MSTOrFhWX0E8oNGHuLNfSGVH+obXuqHk8W7FPufq/SbfFLg3K2IpXK3guOv ZkkpsZh5aGdaZGkS6FmPBnMxM41sjy7KTKglOTd4zB47VlVwcjzQhKGG6nwQNHtgWSqcX4 i1xnoe9mmga5C5JXMwRAEQcpS8CjsiM= X-MC-Unique: CHElVM0hM1iWqAHFpS5POg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 13/16] qdev: Make qdev_prop_set_drive() match the other helpers Date: Tue, 23 Jun 2020 16:23:23 +0200 Message-Id: <20200623142326.2349416-14-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:55:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO() can; they abort on error. To clean up this inconsistency, rename qdev_prop_set_drive() to qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that aborts on error. Coccinelle script to update callers: @ depends on !(file in "hw/core/qdev-properties-system.c")@ expression dev, name, value; symbol error_abort; @@ - qdev_prop_set_drive(dev, name, value, &error_abort); + qdev_prop_set_drive(dev, name, value); @@ expression dev, name, value, errp; @@ - qdev_prop_set_drive(dev, name, value, errp); + qdev_prop_set_drive_err(dev, name, value, errp); Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200622094227.1271650-14-armbru@redhat.com> --- include/hw/qdev-properties.h | 16 +++++++++++++--- hw/arm/aspeed.c | 8 ++++---- hw/arm/cubieboard.c | 2 +- hw/arm/exynos4210.c | 2 +- hw/arm/imx25_pdk.c | 2 +- hw/arm/mcimx6ul-evk.c | 2 +- hw/arm/mcimx7d-sabre.c | 2 +- hw/arm/msf2-som.c | 4 ++-- hw/arm/nseries.c | 4 ++-- hw/arm/orangepi.c | 2 +- hw/arm/raspi.c | 2 +- hw/arm/sabrelite.c | 6 +++--- hw/arm/vexpress.c | 3 +-- hw/arm/xilinx_zynq.c | 7 ++++--- hw/arm/xlnx-versal-virt.c | 2 +- hw/arm/xlnx-zcu102.c | 10 +++++----- hw/block/fdc.c | 6 +++--- hw/block/nand.c | 2 +- hw/block/pflash_cfi01.c | 6 +++--- hw/block/pflash_cfi02.c | 2 +- hw/core/qdev-properties-system.c | 10 ++++++++-- hw/ide/qdev.c | 4 ++-- hw/m68k/q800.c | 3 +-- hw/microblaze/petalogix_ml605_mmu.c | 5 +++-- hw/ppc/pnv.c | 3 +-- hw/ppc/spapr.c | 4 ++-- hw/scsi/scsi-bus.c | 2 +- hw/sd/milkymist-memcard.c | 2 +- hw/sd/pxa2xx_mmci.c | 2 +- hw/sd/sd.c | 2 +- hw/sd/ssi-sd.c | 3 ++- hw/xtensa/xtfpga.c | 3 +-- 32 files changed, 74 insertions(+), 59 deletions(-) diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index fc0b2f6b45..49c6cd2460 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -233,8 +233,16 @@ extern const PropertyInfo qdev_prop_pcie_link_width; #define DEFINE_PROP_END_OF_LIST() \ {} =20 -/* Set properties between creation and init. */ -void *qdev_get_prop_ptr(DeviceState *dev, Property *prop); +/* + * Set properties between creation and realization. + */ +void qdev_prop_set_drive_err(DeviceState *dev, const char *name, + BlockBackend *value, Error **errp); + +/* + * Set properties between creation and realization. + * @value must be valid. Each property may be set at most once. + */ void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value); void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value= ); void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t val= ue); @@ -245,11 +253,13 @@ void qdev_prop_set_string(DeviceState *dev, const cha= r *name, const char *value) void qdev_prop_set_chr(DeviceState *dev, const char *name, Chardev *value); void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientSta= te *value); void qdev_prop_set_drive(DeviceState *dev, const char *name, - BlockBackend *value, Error **errp); + BlockBackend *value); void qdev_prop_set_macaddr(DeviceState *dev, const char *name, const uint8_t *value); void qdev_prop_set_enum(DeviceState *dev, const char *name, int value); =20 +void *qdev_get_prop_ptr(DeviceState *dev, Property *prop); + void qdev_prop_register_global(GlobalProperty *prop); const GlobalProperty *qdev_find_global_prop(DeviceState *dev, const char *name); diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 0ad08a2b4c..42d818b81c 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -227,8 +227,8 @@ static void aspeed_board_init_flashes(AspeedSMCState *s= , const char *flashtype, =20 fl->flash =3D qdev_new(flashtype); if (dinfo) { - qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(di= nfo), - errp); + qdev_prop_set_drive_err(fl->flash, "drive", + blk_by_legacy_dinfo(dinfo), errp); } qdev_realize_and_unref(fl->flash, BUS(s->spi), &error_fatal); =20 @@ -243,8 +243,8 @@ static void sdhci_attach_drive(SDHCIState *sdhci, Drive= Info *dinfo) =20 card =3D qdev_new(TYPE_SD_CARD); if (dinfo) { - qdev_prop_set_drive(card, "drive", blk_by_legacy_dinfo(dinfo), - &error_fatal); + qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(din= fo), + &error_fatal); } qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sdhci), "sd-bus"), diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index a96c860575..5cbd115c53 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -93,7 +93,7 @@ static void cubieboard_init(MachineState *machine) =20 /* Plug in SD card */ carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); =20 memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE, diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index b888a5c9ab..fa639806ec 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -434,7 +434,7 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) di =3D drive_get(IF_SD, 0, n); blk =3D di ? blk_by_legacy_dinfo(di) : NULL; carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_abort); + qdev_prop_set_drive(carddev, "drive", blk); qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), &error_fatal); } diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c index af8f7f969c..1c201d0d8e 100644 --- a/hw/arm/imx25_pdk.c +++ b/hw/arm/imx25_pdk.c @@ -130,7 +130,7 @@ static void imx25_pdk_init(MachineState *machine) blk =3D di ? blk_by_legacy_dinfo(di) : NULL; bus =3D qdev_get_child_bus(DEVICE(&s->soc.esdhc[i]), "sd-bus"); carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); } =20 diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c index 3d1d2e3c04..2f845cedfc 100644 --- a/hw/arm/mcimx6ul-evk.c +++ b/hw/arm/mcimx6ul-evk.c @@ -55,7 +55,7 @@ static void mcimx6ul_evk_init(MachineState *machine) blk =3D di ? blk_by_legacy_dinfo(di) : NULL; bus =3D qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus"); carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); } =20 diff --git a/hw/arm/mcimx7d-sabre.c b/hw/arm/mcimx7d-sabre.c index 365f8183bc..e57d52b344 100644 --- a/hw/arm/mcimx7d-sabre.c +++ b/hw/arm/mcimx7d-sabre.c @@ -57,7 +57,7 @@ static void mcimx7d_sabre_init(MachineState *machine) blk =3D di ? blk_by_legacy_dinfo(di) : NULL; bus =3D qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus"); carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); } =20 diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c index 355966c073..f9b61c36dd 100644 --- a/hw/arm/msf2-som.c +++ b/hw/arm/msf2-som.c @@ -86,8 +86,8 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) spi_flash =3D qdev_new("s25sl12801"); qdev_prop_set_uint8(spi_flash, "spansion-cr2nv", 1); if (dinfo) { - qdev_prop_set_drive(spi_flash, "drive", blk_by_legacy_dinfo(dinfo), - &error_fatal); + qdev_prop_set_drive_err(spi_flash, "drive", + blk_by_legacy_dinfo(dinfo), &error_fatal); } qdev_realize_and_unref(spi_flash, spi_bus, &error_fatal); cs_line =3D qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0); diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 02678dda2d..428a2a2c5a 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -182,8 +182,8 @@ static void n8x0_nand_setup(struct n800_s *s) qdev_prop_set_int32(s->nand, "shift", 1); dinfo =3D drive_get(IF_MTD, 0, 0); if (dinfo) { - qdev_prop_set_drive(s->nand, "drive", blk_by_legacy_dinfo(dinfo), - &error_fatal); + qdev_prop_set_drive_err(s->nand, "drive", blk_by_legacy_dinfo(dinf= o), + &error_fatal); } sysbus_realize_and_unref(SYS_BUS_DEVICE(s->nand), &error_fatal); sysbus_connect_irq(SYS_BUS_DEVICE(s->nand), 0, diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c index 678c93033e..843dcbbd62 100644 --- a/hw/arm/orangepi.c +++ b/hw/arm/orangepi.c @@ -95,7 +95,7 @@ static void orangepi_init(MachineState *machine) =20 /* Plug in SD card */ carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); =20 /* SDRAM */ diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 380978fc27..09bf02ec9c 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -298,7 +298,7 @@ static void raspi_machine_init(MachineState *machine) exit(1); } carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); =20 vcram_size =3D object_property_get_uint(OBJECT(&s->soc), "vcram-size", diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c index a27e5baf60..91d8c43a7e 100644 --- a/hw/arm/sabrelite.c +++ b/hw/arm/sabrelite.c @@ -77,9 +77,9 @@ static void sabrelite_init(MachineState *machine) =20 flash_dev =3D qdev_new("sst25vf016b"); if (dinfo) { - qdev_prop_set_drive(flash_dev, "drive", - blk_by_legacy_dinfo(dinfo), - &error_fatal); + qdev_prop_set_drive_err(flash_dev, "drive", + blk_by_legacy_dinfo(dinfo), + &error_fatal); } qdev_realize_and_unref(flash_dev, BUS(spi_bus), &error_fat= al); =20 diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 7ca5d523a4..725d024c91 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -517,8 +517,7 @@ static PFlashCFI01 *ve_pflash_cfi01_register(hwaddr bas= e, const char *name, DeviceState *dev =3D qdev_new(TYPE_PFLASH_CFI01); =20 if (di) { - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di), - &error_abort); + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(di)); } =20 qdev_prop_set_uint32(dev, "num-blocks", diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c index 4247c4dbd8..ed970273f3 100644 --- a/hw/arm/xilinx_zynq.c +++ b/hw/arm/xilinx_zynq.c @@ -159,8 +159,9 @@ static inline void zynq_init_spi_flashes(uint32_t base_= addr, qemu_irq irq, DriveInfo *dinfo =3D drive_get_next(IF_MTD); flash_dev =3D qdev_new("n25q128"); if (dinfo) { - qdev_prop_set_drive(flash_dev, "drive", - blk_by_legacy_dinfo(dinfo), &error_fat= al); + qdev_prop_set_drive_err(flash_dev, "drive", + blk_by_legacy_dinfo(dinfo), + &error_fatal); } qdev_realize_and_unref(flash_dev, BUS(spi), &error_fatal); =20 @@ -290,7 +291,7 @@ static void zynq_init(MachineState *machine) di =3D drive_get_next(IF_SD); blk =3D di ? blk_by_legacy_dinfo(di) : NULL; carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), &error_fatal); } diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 5bcca7f95b..a3b1ce9c7c 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -465,7 +465,7 @@ static void sd_plugin_card(SDHCIState *sd, DriveInfo *d= i) =20 card =3D qdev_new(TYPE_SD_CARD); object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card)); - qdev_prop_set_drive(card, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(card, "drive", blk, &error_fatal); qdev_realize_and_unref(card, qdev_get_child_bus(DEVICE(sd), "sd-bus"), &error_fatal); } diff --git a/hw/arm/xlnx-zcu102.c b/hw/arm/xlnx-zcu102.c index b920bcee94..77449759c6 100644 --- a/hw/arm/xlnx-zcu102.c +++ b/hw/arm/xlnx-zcu102.c @@ -143,7 +143,7 @@ static void xlnx_zcu102_init(MachineState *machine) exit(1); } carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); qdev_realize_and_unref(carddev, bus, &error_fatal); } =20 @@ -159,8 +159,8 @@ static void xlnx_zcu102_init(MachineState *machine) =20 flash_dev =3D qdev_new("sst25wf080"); if (dinfo) { - qdev_prop_set_drive(flash_dev, "drive", blk_by_legacy_dinfo(di= nfo), - &error_fatal); + qdev_prop_set_drive_err(flash_dev, "drive", + blk_by_legacy_dinfo(dinfo), &error_fat= al); } qdev_realize_and_unref(flash_dev, spi_bus, &error_fatal); =20 @@ -182,8 +182,8 @@ static void xlnx_zcu102_init(MachineState *machine) =20 flash_dev =3D qdev_new("n25q512a11"); if (dinfo) { - qdev_prop_set_drive(flash_dev, "drive", blk_by_legacy_dinfo(di= nfo), - &error_fatal); + qdev_prop_set_drive_err(flash_dev, "drive", + blk_by_legacy_dinfo(dinfo), &error_fat= al); } qdev_realize_and_unref(flash_dev, spi_bus, &error_fatal); =20 diff --git a/hw/block/fdc.c b/hw/block/fdc.c index 7e143cbab0..f4493d6afa 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -2508,8 +2508,8 @@ static void fdctrl_init_drives(FloppyBus *bus, DriveI= nfo **fds) dev =3D qdev_new("floppy"); qdev_prop_set_uint32(dev, "unit", i); qdev_prop_set_enum(dev, "drive-type", FLOPPY_DRIVE_TYPE_AUTO); - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(fds[i]), - &error_fatal); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(fds[= i]), + &error_fatal); qdev_realize_and_unref(dev, &bus->bus, &error_fatal); } } @@ -2566,7 +2566,7 @@ static void fdctrl_connect_drives(FDCtrl *fdctrl, Dev= iceState *fdc_dev, blk_ref(blk); blk_detach_dev(blk, fdc_dev); fdctrl->qdev_for_drives[i].blk =3D NULL; - qdev_prop_set_drive(dev, "drive", blk, &local_err); + qdev_prop_set_drive_err(dev, "drive", blk, &local_err); blk_unref(blk); =20 if (local_err) { diff --git a/hw/block/nand.c b/hw/block/nand.c index 7e25681d59..654e0cb5d1 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -648,7 +648,7 @@ DeviceState *nand_init(BlockBackend *blk, int manf_id, = int chip_id) qdev_prop_set_uint8(dev, "manufacturer_id", manf_id); qdev_prop_set_uint8(dev, "chip_id", chip_id); if (blk) { - qdev_prop_set_drive(dev, "drive", blk, &error_fatal); + qdev_prop_set_drive_err(dev, "drive", blk, &error_fatal); } =20 qdev_realize(dev, NULL, &error_fatal); diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c index 9f0c1d61ca..cddc3a5a0c 100644 --- a/hw/block/pflash_cfi01.c +++ b/hw/block/pflash_cfi01.c @@ -962,7 +962,7 @@ PFlashCFI01 *pflash_cfi01_register(hwaddr base, DeviceState *dev =3D qdev_new(TYPE_PFLASH_CFI01); =20 if (blk) { - qdev_prop_set_drive(dev, "drive", blk, &error_abort); + qdev_prop_set_drive(dev, "drive", blk); } assert(QEMU_IS_ALIGNED(size, sector_len)); qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); @@ -1010,8 +1010,8 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, Drive= Info *dinfo) error_report("clashes with -machine"); exit(1); } - qdev_prop_set_drive(DEVICE(fl), "drive", - blk_by_legacy_dinfo(dinfo), &error_fatal); + qdev_prop_set_drive_err(DEVICE(fl), "drive", blk_by_legacy_dinfo(dinfo= ), + &error_fatal); loc_pop(&loc); } =20 diff --git a/hw/block/pflash_cfi02.c b/hw/block/pflash_cfi02.c index 6eb66e7bb0..b40ce2335a 100644 --- a/hw/block/pflash_cfi02.c +++ b/hw/block/pflash_cfi02.c @@ -1001,7 +1001,7 @@ PFlashCFI02 *pflash_cfi02_register(hwaddr base, DeviceState *dev =3D qdev_new(TYPE_PFLASH_CFI02); =20 if (blk) { - qdev_prop_set_drive(dev, "drive", blk, &error_abort); + qdev_prop_set_drive(dev, "drive", blk); } assert(QEMU_IS_ALIGNED(size, sector_len)); qdev_prop_set_uint32(dev, "num-blocks", size / sector_len); diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-sys= tem.c index 2561fa09a8..38b0c9f09b 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -425,8 +425,8 @@ const PropertyInfo qdev_prop_audiodev =3D { .set =3D set_audiodev, }; =20 -void qdev_prop_set_drive(DeviceState *dev, const char *name, - BlockBackend *value, Error **errp) +void qdev_prop_set_drive_err(DeviceState *dev, const char *name, + BlockBackend *value, Error **errp) { const char *ref =3D ""; =20 @@ -443,6 +443,12 @@ void qdev_prop_set_drive(DeviceState *dev, const char = *name, object_property_set_str(OBJECT(dev), ref, name, errp); } =20 +void qdev_prop_set_drive(DeviceState *dev, const char *name, + BlockBackend *value) +{ + qdev_prop_set_drive_err(dev, name, value, &error_abort); +} + void qdev_prop_set_chr(DeviceState *dev, const char *name, Chardev *value) { diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 3ccb5e2529..f68fbee93d 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -129,8 +129,8 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, Driv= eInfo *drive) =20 dev =3D qdev_new(drive->media_cd ? "ide-cd" : "ide-hd"); qdev_prop_set_uint32(dev, "unit", unit); - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(drive), - &error_fatal); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(drive), + &error_fatal); qdev_realize_and_unref(dev, &bus->qbus, &error_fatal); return DO_UPCAST(IDEDevice, qdev, dev); } diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 503ec54f5d..459d326af0 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -221,8 +221,7 @@ static void q800_init(MachineState *machine) via_dev =3D qdev_new(TYPE_MAC_VIA); dinfo =3D drive_get(IF_MTD, 0, 0); if (dinfo) { - qdev_prop_set_drive(via_dev, "drive", blk_by_legacy_dinfo(dinfo), - &error_abort); + qdev_prop_set_drive(via_dev, "drive", blk_by_legacy_dinfo(dinfo)); } sysbus =3D SYS_BUS_DEVICE(via_dev); sysbus_realize_and_unref(sysbus, &error_fatal); diff --git a/hw/microblaze/petalogix_ml605_mmu.c b/hw/microblaze/petalogix_= ml605_mmu.c index 23420028f5..fff2c578ef 100644 --- a/hw/microblaze/petalogix_ml605_mmu.c +++ b/hw/microblaze/petalogix_ml605_mmu.c @@ -188,8 +188,9 @@ petalogix_ml605_init(MachineState *machine) =20 dev =3D qdev_new("n25q128"); if (dinfo) { - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinf= o), - &error_fatal); + qdev_prop_set_drive_err(dev, "drive", + blk_by_legacy_dinfo(dinfo), + &error_fatal); } qdev_realize_and_unref(dev, BUS(spi), &error_fatal); =20 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 80b4afd211..8bd03f3b10 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -730,8 +730,7 @@ static void pnv_init(MachineState *machine) */ dev =3D qdev_new(TYPE_PNV_PNOR); if (pnor) { - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(pnor), - &error_abort); + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(pnor)); } sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); pnv->pnor =3D PNV_PNOR(dev); diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 8d630baa5d..bd9345cdac 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1716,8 +1716,8 @@ static void spapr_create_nvram(SpaprMachineState *spa= pr) DriveInfo *dinfo =3D drive_get(IF_PFLASH, 0, 0); =20 if (dinfo) { - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo), - &error_fatal); + qdev_prop_set_drive_err(dev, "drive", blk_by_legacy_dinfo(dinfo), + &error_fatal); } =20 qdev_realize_and_unref(dev, &spapr->vio_bus->bus, &error_fatal); diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 1a7320c0af..27843bb04b 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -277,7 +277,7 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, Blo= ckBackend *blk, if (serial && object_property_find(OBJECT(dev), "serial", NULL)) { qdev_prop_set_string(dev, "serial", serial); } - qdev_prop_set_drive(dev, "drive", blk, &err); + qdev_prop_set_drive_err(dev, "drive", blk, &err); if (err) { error_propagate(errp, err); object_unparent(OBJECT(dev)); diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 4cfdf7b64c..1c23310715 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -279,7 +279,7 @@ static void milkymist_memcard_realize(DeviceState *dev,= Error **errp) dinfo =3D drive_get_next(IF_SD); blk =3D dinfo ? blk_by_legacy_dinfo(dinfo) : NULL; carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &err); + qdev_prop_set_drive_err(carddev, "drive", blk, &err); qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err); if (err) { error_setg(errp, "failed to init SD card: %s", error_get_pretty(er= r)); diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 623be70b26..3407617afc 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -496,7 +496,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, =20 /* Create and plug in the sd card */ carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive(carddev, "drive", blk, &err); + qdev_prop_set_drive_err(carddev, "drive", blk, &err); if (err) { error_reportf_err(err, "failed to init SD card: "); return NULL; diff --git a/hw/sd/sd.c b/hw/sd/sd.c index 7070a116ea..97a9d32964 100644 --- a/hw/sd/sd.c +++ b/hw/sd/sd.c @@ -706,7 +706,7 @@ SDState *sd_init(BlockBackend *blk, bool is_spi) =20 obj =3D object_new(TYPE_SD_CARD); dev =3D DEVICE(obj); - qdev_prop_set_drive(dev, "drive", blk, &err); + qdev_prop_set_drive_err(dev, "drive", blk, &err); if (err) { error_reportf_err(err, "sd_init failed: "); return NULL; diff --git a/hw/sd/ssi-sd.c b/hw/sd/ssi-sd.c index f98a6f3ae1..25cec2ddea 100644 --- a/hw/sd/ssi-sd.c +++ b/hw/sd/ssi-sd.c @@ -254,7 +254,8 @@ static void ssi_sd_realize(SSISlave *d, Error **errp) dinfo =3D drive_get_next(IF_SD); carddev =3D qdev_new(TYPE_SD_CARD); if (dinfo) { - qdev_prop_set_drive(carddev, "drive", blk_by_legacy_dinfo(dinfo), = &err); + qdev_prop_set_drive_err(carddev, "drive", blk_by_legacy_dinfo(dinf= o), + &err); if (err) { goto fail; } diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 5d0834c1d9..10de15855a 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -173,8 +173,7 @@ static PFlashCFI01 *xtfpga_flash_init(MemoryRegion *add= ress_space, SysBusDevice *s; DeviceState *dev =3D qdev_new(TYPE_PFLASH_CFI01); =20 - qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo), - &error_abort); + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo)); qdev_prop_set_uint32(dev, "num-blocks", board->flash->size / board->flash->sector_size); qdev_prop_set_uint64(dev, "sector-length", board->flash->sector_size); --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922452; cv=none; d=zohomail.com; s=zohoarc; b=irEQOv+jq3sjxndUvdY111ZKTzy7OdMjp4/85xV42pQfTWdtdNgX6REzcVNPNnzj2qRbSYx+CqnKsJxXtMI9NVUG9H8a8X+FXEWuxCvVaZvXYi3BL0v7lIYkZkVZWY1uSA2tFH9gkhFh4kfeR5mEM2ihQQ34eq4sdpQptsuZg3Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922452; h=Content-Type:Content-Transfer-Encoding:Cc: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=IEcIsXzOthQgeNTiPu22drNv3v4DqfLOdNPXqchnCVM=; b=nCznIwWRLR/qBAdSn2OET3CS40r7mzxDbJ0gVRg8VCpOD7u7yQAxPEVaz6U2twU7bzlwpQFBK0mZa/MunA5FzTzhevN6Cf+wIcwq4X+IN1KKTF0WNbW1UDAl6saquHl2xbX0vRYQCFKOz9QdPGAYpJPd5l9W9pYX/ny2iNp//xs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922452676325.9850387456837; Tue, 23 Jun 2020 07:27:32 -0700 (PDT) Received: from localhost ([::1]:35942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjtb-0006qV-AG for importer@patchew.org; Tue, 23 Jun 2020 10:27:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpq-0001hd-AC for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:38 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:34967 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpm-0007ie-0h for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:37 -0400 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-44-GmakxzJgOzSzIm_-4QN42A-1; Tue, 23 Jun 2020 10:23:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E1713107ACF2; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD97E78F0A; Tue, 23 Jun 2020 14:23:29 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6B470113847C; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922213; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IEcIsXzOthQgeNTiPu22drNv3v4DqfLOdNPXqchnCVM=; b=T7k0SOJbC5s2qblskl1TYwYVtBTri/nvLmUH9ifBFD0KtOacJlW6+pUuT5YCsVbY96WBJQ 1lCuG3Eso+YxNTFG7mhKZCabgkvCc63PcmoUtScacNzXWxquTKdmoQVI/TtGGKuEKRwiYb PdjQXvlHGyIeGbwfZ9w2uW+CjKdtS9g= X-MC-Unique: GmakxzJgOzSzIm_-4QN42A-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 14/16] arm/aspeed: Drop aspeed_board_init_flashes() parameter @errp Date: Tue, 23 Jun 2020 16:23:24 +0200 Message-Id: <20200623142326.2349416-15-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrew Jeffery , qemu-arm@nongnu.org, =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Joel Stanley Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We always pass &error_abort. Drop the parameter, use &error_abort directly. Cc: C=C3=A9dric Le Goater Cc: Peter Maydell Cc: Andrew Jeffery Cc: Joel Stanley Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: C=C3=A9dric Le Goater Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200622094227.1271650-15-armbru@redhat.com> --- hw/arm/aspeed.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 42d818b81c..863757e1f0 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -215,8 +215,8 @@ static void write_boot_rom(DriveInfo *dinfo, hwaddr add= r, size_t rom_size, g_free(storage); } =20 -static void aspeed_board_init_flashes(AspeedSMCState *s, const char *flash= type, - Error **errp) +static void aspeed_board_init_flashes(AspeedSMCState *s, + const char *flashtype) { int i ; =20 @@ -227,8 +227,8 @@ static void aspeed_board_init_flashes(AspeedSMCState *s= , const char *flashtype, =20 fl->flash =3D qdev_new(flashtype); if (dinfo) { - qdev_prop_set_drive_err(fl->flash, "drive", - blk_by_legacy_dinfo(dinfo), errp); + qdev_prop_set_drive(fl->flash, "drive", + blk_by_legacy_dinfo(dinfo)); } qdev_realize_and_unref(fl->flash, BUS(s->spi), &error_fatal); =20 @@ -314,8 +314,8 @@ static void aspeed_machine_init(MachineState *machine) "max_ram", max_ram_size - ram_size); memory_region_add_subregion(&bmc->ram_container, ram_size, &bmc->max_r= am); =20 - aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model, &error_abort); - aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model, &error_abo= rt); + aspeed_board_init_flashes(&bmc->soc.fmc, amc->fmc_model); + aspeed_board_init_flashes(&bmc->soc.spi[0], amc->spi_model); =20 /* Install first FMC flash content as a boot rom. */ if (drive0) { --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922499; cv=none; d=zohomail.com; s=zohoarc; b=IlssMe6Nnl7XOhOZE5ghbO4++5MLyRfqwtZ7t/+9uUxznZyHIS08HczTed2uVpvqzQmewgDh828PVkRgZ/7aix6hepR+wpeiHrsVMA5UrrGgZAp6lhRM41kjGGZH+lU0KiScU8B8hOJWMyj4qW+bBgLECHJdhsiNuslvj5oQCeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922499; h=Content-Type:Content-Transfer-Encoding:Cc: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=kzGTCuv62dGXjoqG/dxgPQGfQJ3gb0Hc/Prq5bnFGaY=; b=f1BLDg58oZnWXrqlvW6czyHxXcqnXXfPitdfRhvZEGhWdKt6R7bYMZ1RF47qSSnbXdvIf4tURr9sw1yvMNQvBvanbqxf4xZIHbmvV2udF6U5D0Hkl2FRRHt2qSyQoytUgu2EondS6TMxy42MSH7ztNn9cqd3dxB8KgJvzhq1Mko= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922499034102.39281232973622; Tue, 23 Jun 2020 07:28:19 -0700 (PDT) Received: from localhost ([::1]:39114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjuL-00087s-MY for importer@patchew.org; Tue, 23 Jun 2020 10:28:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpu-0001o4-2M for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:42 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:56096 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpn-0007jt-3W for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:41 -0400 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-368-eE8ZgLcuO2GYUuWvb0NoHQ-1; Tue, 23 Jun 2020 10:23:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0DBB01005513; Tue, 23 Jun 2020 14:23:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D2D295DA27; Tue, 23 Jun 2020 14:23:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 6EDE9113847D; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kzGTCuv62dGXjoqG/dxgPQGfQJ3gb0Hc/Prq5bnFGaY=; b=Y8eW1UObNq8JhZyw9B/BxNlzBznRcvC5Eg64mbvCD7InrYSgihm9LiTHFHHY8n8XjSHH26 Dk6wGIDbZRQm470j6B6eTdgWWG8I+ThWD4fllLBi/ua8DDm6eE3FN2kvijKeYfBd/XQfZW 042VaUse07IuKnlh/OteAKZt9yhAvhw= X-MC-Unique: eE8ZgLcuO2GYUuWvb0NoHQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 15/16] sd/pxa2xx_mmci: Don't crash on pxa2xx_mmci_init() error Date: Tue, 23 Jun 2020 16:23:25 +0200 Message-Id: <20200623142326.2349416-16-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 01:55:08 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) On error, pxa2xx_mmci_init() reports to stderr and returns NULL. Callers don't check for errors. Machines akita, borzoi, mainstone, spitz, terrier, tosa, and z2 crash shortly after, like this: $ qemu-system-aarch64 -M akita -drive if=3Dsd,readonly=3Don qemu-system-aarch64: failed to init SD card: Cannot use read-only drive= as SD card Segmentation fault (core dumped) Machines connex and verdex reach the check for orphaned drives first: $ aarch64-softmmu/qemu-system-aarch64 -M connex -drive if=3Dsd,readonly= =3Don -accel qtest qemu-system-aarch64: failed to init SD card: Cannot use read-only drive= as SD card qemu-system-aarch64: -drive if=3Dsd,readonly=3Don: machine type does no= t support if=3Dsd,bus=3D0,unit=3D0 Make pxa2xx_mmci_init() fail cleanly right away. Cc: Andrzej Zaborowski Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Markus Armbruster Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200622094227.1271650-16-armbru@redhat.com> --- hw/sd/pxa2xx_mmci.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/hw/sd/pxa2xx_mmci.c b/hw/sd/pxa2xx_mmci.c index 3407617afc..68bed24480 100644 --- a/hw/sd/pxa2xx_mmci.c +++ b/hw/sd/pxa2xx_mmci.c @@ -18,7 +18,6 @@ #include "hw/arm/pxa.h" #include "hw/sd/sd.h" #include "hw/qdev-properties.h" -#include "qemu/error-report.h" #include "qemu/log.h" #include "qemu/module.h" #include "trace.h" @@ -483,7 +482,6 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, DeviceState *dev, *carddev; SysBusDevice *sbd; PXA2xxMMCIState *s; - Error *err =3D NULL; =20 dev =3D qdev_new(TYPE_PXA2XX_MMCI); s =3D PXA2XX_MMCI(dev); @@ -496,16 +494,9 @@ PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem, =20 /* Create and plug in the sd card */ carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive_err(carddev, "drive", blk, &err); - if (err) { - error_reportf_err(err, "failed to init SD card: "); - return NULL; - } - qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), &er= r); - if (err) { - error_reportf_err(err, "failed to init SD card: "); - return NULL; - } + qdev_prop_set_drive_err(carddev, "drive", blk, &error_fatal); + qdev_realize_and_unref(carddev, qdev_get_child_bus(dev, "sd-bus"), + &error_fatal); =20 return s; } --=20 2.26.2 From nobody Mon Apr 29 04:41:54 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1592922611; cv=none; d=zohomail.com; s=zohoarc; b=W5xZZc9b3Q+DONwtNMjXAFjoYD7JiFuD2eEsZ6SZIUiPD6e2jMx9cl5BOYqQv4Gcy+xQmDME3xImhrwJ6ETDH55xr6nJWHoiW17Xie9ZOkAfLEw42dIFodHB9PBgF91e/5wxpAODIBamDq0oiG0gzH/dxRmmLHUG74y9183/OQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592922611; h=Content-Type:Content-Transfer-Encoding:Cc: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=JW+K+F+cBl7Afy5FOM0LYsgEpF08Y8jYZE0qPWSBVWg=; b=fr0K8U0xaF9nglVIY1aM4l2Xn/9LkD7u1ecejrNf46knghn+E1afgeKwKf/VrSlZq4v8ej05tfdWSBTQYO6NtuWIc0A1N6xR+3fgzwUurdO0jGNoMCb05SSd7+N9UymfQBmcmxi1YEyK2CLLLszUE9QjumSZAFYLyF+JP4kWRig= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1592922611927714.1706357244111; Tue, 23 Jun 2020 07:30:11 -0700 (PDT) Received: from localhost ([::1]:47560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnjw8-000390-WA for importer@patchew.org; Tue, 23 Jun 2020 10:30:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnjpv-0001qz-Dy for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:43 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:50383 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jnjpn-0007kg-9u for qemu-devel@nongnu.org; Tue, 23 Jun 2020 10:23:43 -0400 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-471-Bq8BZVm2N-KUuXh2eHlgZg-1; Tue, 23 Jun 2020 10:23:32 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 369DC805EE2; Tue, 23 Jun 2020 14:23:31 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-121.ams2.redhat.com [10.36.112.121]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3F9971688; Tue, 23 Jun 2020 14:23:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 7271E113847E; Tue, 23 Jun 2020 16:23:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592922214; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JW+K+F+cBl7Afy5FOM0LYsgEpF08Y8jYZE0qPWSBVWg=; b=gOjZGnRoVNyvNOu1wEWkqMDAcUn9lRfw3PVBWEaivQ1zHwhruL1NXYlILL42a8anIIaxKz tOv479RSSR5VJzNvBIIS52Phu8bNvRPTCk0Y8fSFrhglVYZ85zi6HS6B7PiZkn6AZCUCTw kizwUuv93bDgKJzZBBVF9hwJ09+rCrE= X-MC-Unique: Bq8BZVm2N-KUuXh2eHlgZg-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PULL 16/16] sd/milkymist-memcard: Fix error API violation Date: Tue, 23 Jun 2020 16:23:26 +0200 Message-Id: <20200623142326.2349416-17-armbru@redhat.com> In-Reply-To: <20200623142326.2349416-1-armbru@redhat.com> References: <20200623142326.2349416-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/23 02:55:19 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Walle , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) The Error ** argument must be NULL, &error_abort, &error_fatal, or a pointer to a variable containing NULL. Passing an argument of the latter kind twice without clearing it in between is wrong: if the first call sets an error, it no longer points to NULL for the second call. milkymist_memcard_realize() is wrong that way: it passes &err to qdev_prop_set_drive_err() and qdev_realize_and_unref(). Currently harmless, because the latter uses it only as first argument of error_propagate(). Making qdev_prop_set_drive_err() fail involves abuse of -global. Leave handling that to qdev_prop_set_drive(), like we do elsewhere. Cc: Michael Walle Signed-off-by: Markus Armbruster Message-Id: <20200622094227.1271650-17-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/sd/milkymist-memcard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c index 1c23310715..482e97191e 100644 --- a/hw/sd/milkymist-memcard.c +++ b/hw/sd/milkymist-memcard.c @@ -279,7 +279,7 @@ static void milkymist_memcard_realize(DeviceState *dev,= Error **errp) dinfo =3D drive_get_next(IF_SD); blk =3D dinfo ? blk_by_legacy_dinfo(dinfo) : NULL; carddev =3D qdev_new(TYPE_SD_CARD); - qdev_prop_set_drive_err(carddev, "drive", blk, &err); + qdev_prop_set_drive(carddev, "drive", blk); qdev_realize_and_unref(carddev, BUS(&s->sdbus), &err); if (err) { error_setg(errp, "failed to init SD card: %s", error_get_pretty(er= r)); --=20 2.26.2