From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93E89F557EF for ; Mon, 20 Apr 2026 10:13:51 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wElcu-0003Gv-Ur; Mon, 20 Apr 2026 06:13:13 -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 1wElcq-0003Gh-DR for qemu-devel@nongnu.org; Mon, 20 Apr 2026 06:13:08 -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 1wElco-0001pS-Nf for qemu-devel@nongnu.org; Mon, 20 Apr 2026 06:13:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776679985; 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: in-reply-to:in-reply-to:references:references; bh=OnLZiZhUM+LM1Nh8wZFUhOG5Bgf/qG6sBLoqI4+P83o=; b=exZAR/DY0yMVBPFsEd1ACTvVFRQRFm8hHeJyAqfgZImlfnOcCbB2AozEqRMUD9RtFB9FJd RDT8IEh3LbHRMDsc5V47Z6a1JI81yhF0nEHuKZV9Udx8KWJ7QexK8DyOS7//m2zCQgLvvl +LEXIONL0wggFTzhOvYil/fC8+vL/mo= Received: from mx-prod-mc-03.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-73-HZb6Hwl4ONGgEsV5aofKfA-1; Mon, 20 Apr 2026 06:13:03 -0400 X-MC-Unique: HZb6Hwl4ONGgEsV5aofKfA-1 X-Mimecast-MFC-AGG-ID: HZb6Hwl4ONGgEsV5aofKfA_1776679982 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A2B6019560AA; Mon, 20 Apr 2026 10:13:01 +0000 (UTC) Received: from localhost (dhcp-192-224.str.redhat.com [10.33.192.224]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CD01A180047F; Mon, 20 Apr 2026 10:13:00 +0000 (UTC) From: Cornelia Huck To: Jaehoon Kim , qemu-devel@nongnu.org, qemu-s390x@nongnu.org Cc: richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, pasic@linux.ibm.com, borntraeger@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, Jaehoon Kim Subject: Re: [PATCH RFC v1 1/1] hw/s390x/ccw: Disable legacy virtio-pci by default (v11.1+) In-Reply-To: <20260417154332.849664-2-jhkim@linux.ibm.com> Organization: "Red Hat GmbH, Sitz: Werner-von-Siemens-Ring 12, D-85630 Grasbrunn, Handelsregister: Amtsgericht =?utf-8?Q?M=C3=BCnchen=2C?= HRB 153243, =?utf-8?Q?Gesch=C3=A4ftsf=C3=BChrer=3A?= Ryan Barnhart, Charles Cachera, Avril Crosse O'Flaherty" References: <20260417154332.849664-1-jhkim@linux.ibm.com> <20260417154332.849664-2-jhkim@linux.ibm.com> User-Agent: Notmuch/0.39 (https://notmuchmail.org) Date: Mon, 20 Apr 2026 12:12:58 +0200 Message-ID: <877bq2szx1.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Received-SPF: pass client-ip=170.10.129.124; envelope-from=cohuck@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Fri, Apr 17 2026, Jaehoon Kim wrote: > On the s390 Linux kernel, IO_SPACE_LIMIT has been 0 since the initial > zPCI implementation (commit cd24834130ac "s390/pci: base support"), > making I/O BARs unusable. > > However, when virtio-pci devices operate in transitional mode, QEMU > unconditionally exposes the legacy interface via BAR0. This results in > firmware warnings during PCI enumeration, such as: > > pci 0005:00:00.0: [Firmware Bug]: BAR 0: invalid; can't size > > even though BAR0 is never usable on the s390 kernel. > > Close this gap by disabling legacy virtio-pci support starting from > machine version 11.1. This effectively makes virtio-pci devices > non-transitional and prevents the creation of the unusable legacy I/O > BAR. > > This introduces s390x-specific global compatibility properties that > set disable-legacy=on as the default for virtio-pci devices. Machine > versions v11.0 and earlier set disable-legacy=off to maintain their > original default behavior (legacy support enabled), ensuring VMs > created with those versions continue to work identically. > > Users can override the default on the command line if needed: > - On v11.1+: -global virtio-pci.disable-legacy=off (to enable legacy) > - On v11.0-: -global virtio-pci.disable-legacy=on (to disable legacy) Makes sense to disable legacy virtio-pci devices, if they cannot work anyway. I'm wondering if we want to have a generic "no legacy" switch as well. I remember a patch from some time ago, but that was concerned with endianness IIRC. Anyway, we cannot turn off pre-1.0 for virtio-ccw at the moment, because the bios still uses legacy virtio. Would be a bit of an effort to change that, but still sounds like a good idea to me. > > Signed-off-by: Jaehoon Kim > --- > hw/s390x/s390-virtio-ccw.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index cc768daeb0..6fbea1e289 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -788,6 +788,18 @@ static void machine_set_loadparm(Object *obj, Visitor *v, > g_free(val); > } > > +/* > + * S390x-specific global compatibility properties. > + * > + * Set disable-legacy=on as the default for virtio-pci devices starting > + * from v11.1. Machine versions v11.0 and earlier set disable-legacy=off > + * to maintain their original default behavior (legacy support enabled). > + */ Maybe add here in the comment that legacy virtio-pci does not work anyway? > +static GlobalProperty hw_compat_s390x[] = { > + { TYPE_VIRTIO_PCI, "disable-legacy", "on", .optional = true}, > +}; > +static const size_t hw_compat_s390x_len = G_N_ELEMENTS(hw_compat_s390x); > + > static void ccw_machine_class_init(ObjectClass *oc, const void *data) > { > MachineClass *mc = MACHINE_CLASS(oc); > @@ -878,6 +890,9 @@ static const TypeInfo ccw_machine_info = { > const void *data) \ > { \ > MachineClass *mc = MACHINE_CLASS(oc); \ > + /* Apply global s390x-wide default properties */ \ > + compat_props_add(mc->compat_props, hw_compat_s390x, \ > + hw_compat_s390x_len); \ > MACHINE_VER_SYM(class_options, ccw, __VA_ARGS__)(mc); \ > mc->desc = "Virtual s390x machine (version " MACHINE_VER_STR(__VA_ARGS__) ")"; \ > mc->init = MACHINE_VER_SYM(mach_init, ccw, __VA_ARGS__); \ > @@ -923,7 +938,15 @@ static void ccw_machine_11_0_instance_options(MachineState *machine) > > static void ccw_machine_11_0_class_options(MachineClass *mc) > { > + /* > + * Preserve v11.0 and older version behavior: > + * keep legacy virtio-pci enabled. > + */ > + static GlobalProperty compat[] = { > + { TYPE_VIRTIO_PCI, "disable-legacy", "off" }, > + }; > ccw_machine_11_1_class_options(mc); > + compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); > compat_props_add(mc->compat_props, hw_compat_11_0, hw_compat_11_0_len); > } > DEFINE_CCW_MACHINE(11, 0); > -- > 2.50.1