From nobody Mon Feb 9 16:34:15 2026 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=1592819510; cv=none; d=zohomail.com; s=zohoarc; b=nM7ULLlpiDoEmYK7/5LabQowREID+zVd+aNPTDJ2Zu/jFJdqHPsI3VnkhkgJr3c44PInMgQUpJL2Vnj8gneB4+bLw2D/Uq5imr4c3so9Smf0J2j6a8QDgK/4QRiDfjxu50lbseUoPthjdJVFu/+3VHH21wkgviYA2YegZRYKhPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592819510; 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=BJFUTQwdKeAYezPL2T3uhjJOrjxgznocTtN32T4xqA0=; b=O5kG0Au+ye09+JeohkeNzocWNMkx3XZuwOAt0IvT2sDa0oPzXHys5Y0LP7oYJM6JLCpy/TMJtDf+T8rAo86I/9rzZQHP8ncTaa3oMaBUqkPSInjgvS7wSj8WxANHG7eMq017yvOZqObeJ9NCKJDbItN1s57PtEsG7e1xUwDLIs4= 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 1592819510104491.6134799939174; Mon, 22 Jun 2020 02:51:50 -0700 (PDT) Received: from localhost ([::1]:45176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnJ7E-0000fB-QL for importer@patchew.org; Mon, 22 Jun 2020 05:51:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnIyQ-0001i4-Mu for qemu-devel@nongnu.org; Mon, 22 Jun 2020 05:42:42 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:31778 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 1jnIyJ-0003vm-8g for qemu-devel@nongnu.org; Mon, 22 Jun 2020 05:42: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-43-JX1X9CmaMqqHYlF6aNiWRQ-1; Mon, 22 Jun 2020 05:42:32 -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 501968018AB; Mon, 22 Jun 2020 09:42: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 E412710013D2; Mon, 22 Jun 2020 09:42:30 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id D0B591138474; Mon, 22 Jun 2020 11:42:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592818954; 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=BJFUTQwdKeAYezPL2T3uhjJOrjxgznocTtN32T4xqA0=; b=SjhRUcwk2Skfg219f8HYCkX2/SJfjaix3OibVjXFZ0hDe2ksFyq8ZhEjES9RqjvXnwrbmm lR1vxLNVUoWMYCGIN7MaTYpZTV4/Yq1yBQWqFLWdxsaNVkfoiOXJRwPtEYWykk1G3xn+BM inwyRhoi6TXsgWJ6vhf+Vjvv4NqLI/k= X-MC-Unique: JX1X9CmaMqqHYlF6aNiWRQ-1 From: Markus Armbruster To: qemu-devel@nongnu.org Subject: [PATCH v2 06/16] fdc: Deprecate configuring floppies with -global isa-fdc Date: Mon, 22 Jun 2020 11:42:17 +0200 Message-Id: <20200622094227.1271650-7-armbru@redhat.com> In-Reply-To: <20200622094227.1271650-1-armbru@redhat.com> References: <20200622094227.1271650-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.120; envelope-from=armbru@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/22 02:57:26 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: kwolf@redhat.com, berrange@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com, pbonzini@redhat.com, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 --- 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