From nobody Sat Apr 11 17:08:50 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775834748; cv=none; d=zohomail.com; s=zohoarc; b=DAxijoF/RU/u7D4Rr8EerKEztXgrBR92mIENuAJUAmwlbdQ76eWJkPXKsodVxPZRwRyMNmnbkNL6yYf2O1seqXYA1Kx2S/SIaNO+kSgB31uE1QoWOBXdPvTBvh5S3oFaGyCWTv+aUfIWXyNqqe7kZXo6njO7hTnaPe9w12ZYQfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775834748; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ufml1BFTV3h7PQpNssX0iYrDnD+YkVaxJC2tzBuM/8k=; b=mVDhPKbJayCb3hKCLrbmfVs2Ux99jm6W+OxM3Ah3p7v68yaPWMuS5ydznabOZLycLBRZ36rkVuFrTjRnARvbzuLK0TWlhKXsDuYL+Lu+0AQ1SNgUfRKWxW5b56xYrocsCWqve4PIJoftWnurpRE3FmiPIHhqmjGvZt8A86V9vsw= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775834748005584.8483885938426; Fri, 10 Apr 2026 08:25:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBDik-0001me-Ue; Fri, 10 Apr 2026 11:24:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBDiR-0001iX-1e for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:24:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBDiL-00089q-K3 for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:24:14 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-ahZQ4oONNRKpHtMZq08dCA-1; Fri, 10 Apr 2026 11:24:00 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48CFB1955E80; Fri, 10 Apr 2026 15:23:59 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.49.176]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C09EB19560AB; Fri, 10 Apr 2026 15:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775834644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ufml1BFTV3h7PQpNssX0iYrDnD+YkVaxJC2tzBuM/8k=; b=I8Jqmk7MG87JcOLHe6mdo7o1aT6YuIZyb3EyzTzuTzOx2ns4xV6FQeSu66FM7VqpJesTun OXk2OqZ2g5g7nyTJ3s7OYOmRBoicU1Lsew3kvL3IJP9gPpIlFSxp2ZFgqSdz3bk/Lietlv USIrRRcGp9iS55Tos4IT/5/72v4g8YY= X-MC-Unique: ahZQ4oONNRKpHtMZq08dCA-1 X-Mimecast-MFC-AGG-ID: ahZQ4oONNRKpHtMZq08dCA_1775834639 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, hreitz@redhat.com, ivy@FreeBSD.org, pbonzini@redhat.com, fam@euphon.net, qemu-devel@nongnu.org, qemu-stable@nongnu.org Subject: [PATCH 1/2] block: Create DEFAULT_BLOCK_CONF macro Date: Fri, 10 Apr 2026 17:23:13 +0200 Message-ID: <20260410152314.86412-2-kwolf@redhat.com> In-Reply-To: <20260410152314.86412-1-kwolf@redhat.com> References: <20260410152314.86412-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775834750783154100 Content-Type: text/plain; charset="utf-8" The property default values from include/hw/block/block.h were duplicated in scsi_bus_legacy_handle_cmdline(), allowing them to go out of sync easily. There doesn't seem a good way to avoid the duplication, but moving them next to each other in the header file should help to avoid this problem in the future. Signed-off-by: Kevin Wolf --- include/hw/block/block.h | 7 +++++++ hw/scsi/scsi-bus.c | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 7dc19d8a453..e0a427039ee 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -51,6 +51,13 @@ static inline unsigned int get_physical_block_exp(BlockC= onf *conf) return exp; } =20 +#define DEFAULT_BLOCK_CONF (BlockConf) { \ + .bootindex =3D -1, \ + .share_rw =3D false, \ + .rerror =3D BLOCKDEV_ON_ERROR_AUTO, \ + .werror =3D BLOCKDEV_ON_ERROR_AUTO, \ +} + #define DEFINE_BLOCK_PROPERTIES_BASE(_state, _conf) \ DEFINE_PROP_ON_OFF_AUTO("backend_defaults", _state, \ _conf.backend_defaults, ON_OFF_AUTO_AUTO), \ diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 1a6b181b9d6..dccb2f25b2a 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -485,12 +485,7 @@ void scsi_bus_legacy_handle_cmdline(SCSIBus *bus) Location loc; DriveInfo *dinfo; int unit; - BlockConf conf =3D { - .bootindex =3D -1, - .share_rw =3D false, - .rerror =3D BLOCKDEV_ON_ERROR_AUTO, - .werror =3D BLOCKDEV_ON_ERROR_AUTO, - }; + BlockConf conf =3D DEFAULT_BLOCK_CONF; =20 loc_push_none(&loc); for (unit =3D 0; unit <=3D bus->info->max_target; unit++) { --=20 2.53.0 From nobody Sat Apr 11 17:08:50 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1775834728; cv=none; d=zohomail.com; s=zohoarc; b=VrlKbE9AWzE76UdE07xHMRuhXeVwDdwSFCONhycwkHOhSIsMMP/cMw8d1BwvFe9z3Ude7rx6m7SlhYlbSsO+vVneko/PqNRWzbec3HgzCmtoQTndhq5feZblHdCTXsAFYZmZi+36fgHHqTVJARrDjRwKR2XfYqpCH/AxwingGkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775834728; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=FfjKtk+ZXOkZvUOghWl0pCv85bkiuG0/v4M2PtMHc3M=; b=f20nqmJEYP0GcFeavvcdXJplOUNUVgsWlBSBrGataDfaDoVOZHM4JzuUH+UGKEE58HBOpG4nVqlnRIrhHLibP7kfsar9NY6tkOgQWoPqmVGJJw7Le7qxe1X2CiJUoyQcaZDDe+qaL/GL7BuFvnsNeVxwS0ize8XbNlQWWtXN2oo= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775834728259704.6161215970614; Fri, 10 Apr 2026 08:25:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wBDii-0001kR-Cp; Fri, 10 Apr 2026 11:24:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBDiR-0001iW-1B for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:24:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wBDiM-0008AL-Fw for qemu-devel@nongnu.org; Fri, 10 Apr 2026 11:24:14 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-207-Bc91LWxQNnSrER55qBTrdQ-1; Fri, 10 Apr 2026 11:24:03 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 58F481800361; Fri, 10 Apr 2026 15:24:02 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.44.49.176]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id B426A195608E; Fri, 10 Apr 2026 15:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775834646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FfjKtk+ZXOkZvUOghWl0pCv85bkiuG0/v4M2PtMHc3M=; b=eNV6TnVuztLIdQqgNNnYU5DoEPh9G1nb5DfsadwxFFcyM7BZiAekIsxo1tzJx05cQqVqnl qpfyJujtHJgNry6r57iGDc/r0tSr9hfb6VV9Cdq5Dcwlnfv+poSS+Ii3YCQGdYWKd47gMW ars87/0f6nbHJMTGwQKTTYh8GyZgX4s= X-MC-Unique: Bc91LWxQNnSrER55qBTrdQ-1 X-Mimecast-MFC-AGG-ID: Bc91LWxQNnSrER55qBTrdQ_1775834642 From: Kevin Wolf To: qemu-block@nongnu.org Cc: kwolf@redhat.com, hreitz@redhat.com, ivy@FreeBSD.org, pbonzini@redhat.com, fam@euphon.net, qemu-devel@nongnu.org, qemu-stable@nongnu.org Subject: [PATCH 2/2] block: Add more defaults to DEFAULT_BLOCK_CONF Date: Fri, 10 Apr 2026 17:23:14 +0200 Message-ID: <20260410152314.86412-3-kwolf@redhat.com> In-Reply-To: <20260410152314.86412-1-kwolf@redhat.com> References: <20260410152314.86412-1-kwolf@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 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=170.10.129.124; envelope-from=kwolf@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1775834730250158500 Content-Type: text/plain; charset="utf-8" discard_granularity was missing from this, which means that SCSI disks created with -drive if=3Dscsi would default to 0 (i.e. disabling discards) instead of -1, which makes scsi-hd automatically pick a granularity and is the default of the corresponding qdev property for -device scsi-hd. This was broken in QEMU 9.0 with commit 3089637. Also set other fields whose default isn't an obvious 0. These are not actual bug fixes because ON_OFF_AUTO_AUTO in fact happens to be 0, but it's better not to rely on the order of enums. Cc: qemu-stable@nongnu.org Fixes: 308963746169 ('scsi: Don't ignore most usb-storage properties') Reported-by: Lexi Winter Signed-off-by: Kevin Wolf --- include/hw/block/block.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index e0a427039ee..df941df19f2 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -53,7 +53,12 @@ static inline unsigned int get_physical_block_exp(BlockC= onf *conf) =20 #define DEFAULT_BLOCK_CONF (BlockConf) { \ .bootindex =3D -1, \ + .backend_defaults =3D ON_OFF_AUTO_AUTO, \ + .discard_granularity =3D -1, \ + .wce =3D ON_OFF_AUTO_AUTO, \ .share_rw =3D false, \ + .account_invalid =3D ON_OFF_AUTO_AUTO, \ + .account_failed =3D ON_OFF_AUTO_AUTO, \ .rerror =3D BLOCKDEV_ON_ERROR_AUTO, \ .werror =3D BLOCKDEV_ON_ERROR_AUTO, \ } --=20 2.53.0