From nobody Mon Nov 25 12:24:50 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=1715511211; cv=none; d=zohomail.com; s=zohoarc; b=EcAZ/rF7x1vaxmNmD3k0XyMZ4zu55Qd+t4xOG5zjqq0qyBDodbFqLCUWE3eQpXFU37Br/gffhvVK5sEoyqLczaJHuPPb6suG0lKRUGifXVyGuttZO5sq6llClO2vzgfvSmxUcLhvMKlg5E36jSMZa3CZo2Q4XTwbmDxUO25Dlqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715511211; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=gfN5pIMWePirJMYr8BLI6kCZBJjEIGwqQo+31f8yoso=; b=HOVHmTzINefHwYJwAP3kmrAoG34bGtNuiCUbGxTZIBhRoM33NQdCVEDTsErOEQWe92Kix51Zzz3kDE4t+Jcog75OXWE7b8CTP0XgjfBEPraQywY/J4QW7EjZL8OOfLw5oICeFOpi0vn4eZN2wioWRu9Twst7waOo/U8DVezKLsQ= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715511211683596.9245915088588; Sun, 12 May 2024 03:53:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s66mn-0003K0-38; Sun, 12 May 2024 06:50:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s66mh-0003I8-PS for qemu-devel@nongnu.org; Sun, 12 May 2024 06:50:28 -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 1s66mc-0005yp-6B for qemu-devel@nongnu.org; Sun, 12 May 2024 06:50:27 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-453-FwzJYihPN_mw7YOdGf24FQ-1; Sun, 12 May 2024 06:50:18 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a59a5b06802so183941066b.1 for ; Sun, 12 May 2024 03:50:18 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a534bfb05sm182150566b.36.2024.05.12.03.50.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 03:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715511020; 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=gfN5pIMWePirJMYr8BLI6kCZBJjEIGwqQo+31f8yoso=; b=NZLPMaqgDrxSOsBqY5GnjUsN/z4lU5yLhTrDaHCeVPT94nHaryyPOos10gwkcegKwOo3q4 3RokoXaUlhGK4/tZ3FA53R1oLDLfa14BZxUxSB57V2yQUbyGgrLJTa61aGC8Dv+cGIr35/ hI4aS+GacAC+pLyPN1Z3Ucckyt9nC8g= X-MC-Unique: FwzJYihPN_mw7YOdGf24FQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715511017; x=1716115817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gfN5pIMWePirJMYr8BLI6kCZBJjEIGwqQo+31f8yoso=; b=gDPTNO7Nyr5o3PE45HuDkrH4BzT912aA+rOAfMYPVRoQyTZsTaU7+Zwq6l3nTMEq4G xrXZVUKsCj9zIL3CvzI4/BLT5UFLn0Oc/j8lNgog5JfnnGPoVST+tslBtM1dEJcAs1FD udHUqsrco3Ii7Eot8X8XddX8bOHlT8VbOBewPhWo3JNShyHmpc+hrHsu8ECBPLt7kzFP eAwtASBoH91kdZNsBhaz0+d56ID67jRYnoAlYIHeDvgVQy/eExJVDruJeT1QUcnRX10g vHPP/n1sgNYqTec8H7z0b2ZFunBh/BMaP0ShXbCUMcrxLqZy1qZvo2vn9crIc/kWsg1a kJVw== X-Gm-Message-State: AOJu0Yw9ZM4TOECn6pgqwxq2SaEzTQq15DZwDAeiBVtsd07CYHLadwm7 uXFMHGs5zDkmERJdbOhx+XejemkkQK08O23wukqN8Ih981wLPCF77EOOKNQNyhzQytPUMA0amqX QNB3Lzml+YeZRDEVjfXOnx1JAlD6zv21mFgieLA9RqX789KW+KARK+iC000tYkqFE9ThhXtdVdi YCpkM3T8YcC34x72pT+NC/efyZ5qNXrO/MvZwJ X-Received: by 2002:a17:906:13c8:b0:a59:cbb5:e09e with SMTP id a640c23a62f3a-a5a2d6669b6mr458407766b.58.1715511016928; Sun, 12 May 2024 03:50:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGTBdq/PtFKE3Kd5gsBGvxpmDaY7rjCnTkAsGbZEyLx7yRKhUaLxtf+NaWp/QmaT9JlCcFHAQ== X-Received: by 2002:a17:906:13c8:b0:a59:cbb5:e09e with SMTP id a640c23a62f3a-a5a2d6669b6mr458407266b.58.1715511016463; Sun, 12 May 2024 03:50:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/27] s390: move css_migration_enabled from machine to css.c Date: Sun, 12 May 2024 12:49:29 +0200 Message-ID: <20240512104945.130198-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240512104945.130198-1-pbonzini@redhat.com> References: <20240512104945.130198-1-pbonzini@redhat.com> MIME-Version: 1.0 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=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.587, 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, SPF_HELO_NONE=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: 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: 1715511212228100003 Content-Type: text/plain; charset="utf-8" The CSS subsystem uses global variables, just face the truth and use a variable also for whether the CSS vmstate is in use; remove the indirection of fetching it from the machine type, which makes the TCG code depend unnecessarily on the virtio-ccw machine. Signed-off-by: Paolo Bonzini Message-ID: <20240509170044.190795-4-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- include/hw/s390x/css.h | 6 ++++++ include/hw/s390x/s390-virtio-ccw.h | 7 ------- hw/s390x/css.c | 10 +++++++--- hw/s390x/s390-virtio-ccw.c | 15 +++------------ 4 files changed, 16 insertions(+), 22 deletions(-) diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index ba72ee3dd20..8289e458370 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -333,4 +333,10 @@ static inline int ccw_dstream_read_buf(CcwDataStream *= cds, void *buff, int len) #define ccw_dstream_read(cds, v) ccw_dstream_read_buf((cds), &(v), sizeof(= v)) #define ccw_dstream_write(cds, v) ccw_dstream_write_buf((cds), &(v), sizeo= f(v)) =20 +/** + * true if (vmstate based) migration of the channel subsystem + * is enabled, false if it is disabled. + */ +extern bool css_migration_enabled; + #endif diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index 7605d06bff1..996864a34e2 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -46,7 +46,6 @@ struct S390CcwMachineClass { /*< public >*/ bool ri_allowed; bool cpu_model_allowed; - bool css_migration_enabled; bool hpage_1m_allowed; int max_threads; }; @@ -58,10 +57,4 @@ bool cpu_model_allowed(void); /* 1M huge page mappings allowed by the machine */ bool hpage_1m_allowed(void); =20 -/** - * Returns true if (vmstate based) migration of the channel subsystem - * is enabled, false if it is disabled. - */ -bool css_migration_enabled(void); - #endif diff --git a/hw/s390x/css.c b/hw/s390x/css.c index 295530963a6..b2d5327dbf4 100644 --- a/hw/s390x/css.c +++ b/hw/s390x/css.c @@ -23,6 +23,8 @@ #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/s390-ccw.h" =20 +bool css_migration_enabled =3D true; + typedef struct CrwContainer { CRW crw; QTAILQ_ENTRY(CrwContainer) sibling; @@ -180,7 +182,7 @@ static const VMStateDescription vmstate_orb =3D { =20 static bool vmstate_schdev_orb_needed(void *opaque) { - return css_migration_enabled(); + return css_migration_enabled; } =20 static const VMStateDescription vmstate_schdev_orb =3D { @@ -388,7 +390,7 @@ static int subch_dev_post_load(void *opaque, int versio= n_id) css_subch_assign(s->cssid, s->ssid, s->schid, s->devno, s); } =20 - if (css_migration_enabled()) { + if (css_migration_enabled) { /* No compat voodoo to do ;) */ return 0; } @@ -412,7 +414,9 @@ static int subch_dev_post_load(void *opaque, int versio= n_id) =20 void css_register_vmstate(void) { - vmstate_register(NULL, 0, &vmstate_css, &channel_subsys); + if (css_migration_enabled) { + vmstate_register(NULL, 0, &vmstate_css, &channel_subsys); + } } =20 IndAddr *get_indicator(hwaddr ind_addr, int len) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 756b4f40aed..3d0bc3e7f2e 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -283,11 +283,9 @@ static void ccw_init(MachineState *machine) s390_enable_css_support(s390_cpu_addr2state(0)); =20 ret =3D css_create_css_image(VIRTUAL_CSSID, true); - assert(ret =3D=3D 0); - if (css_migration_enabled()) { - css_register_vmstate(); - } + + css_register_vmstate(); =20 /* Create VirtIO network adapters */ s390_create_virtio_net(BUS(css_bus), mc->default_nic); @@ -749,7 +747,6 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) =20 s390mc->ri_allowed =3D true; s390mc->cpu_model_allowed =3D true; - s390mc->css_migration_enabled =3D true; s390mc->hpage_1m_allowed =3D true; s390mc->max_threads =3D 1; mc->init =3D ccw_init; @@ -819,11 +816,6 @@ static const TypeInfo ccw_machine_info =3D { }, }; =20 -bool css_migration_enabled(void) -{ - return get_machine_class()->css_migration_enabled; -} - #define DEFINE_CCW_MACHINE(suffix, verstr, latest) = \ static void ccw_machine_##suffix##_class_init(ObjectClass *oc, = \ void *data) = \ @@ -1179,7 +1171,6 @@ static void ccw_machine_2_9_instance_options(MachineS= tate *machine) =20 static void ccw_machine_2_9_class_options(MachineClass *mc) { - S390CcwMachineClass *s390mc =3D S390_CCW_MACHINE_CLASS(mc); static GlobalProperty compat[] =3D { { TYPE_S390_STATTRIB, "migration-enabled", "off", }, { TYPE_S390_FLIC_COMMON, "migration-enabled", "off", }, @@ -1188,7 +1179,7 @@ static void ccw_machine_2_9_class_options(MachineClas= s *mc) ccw_machine_2_10_class_options(mc); compat_props_add(mc->compat_props, hw_compat_2_9, hw_compat_2_9_len); compat_props_add(mc->compat_props, compat, G_N_ELEMENTS(compat)); - s390mc->css_migration_enabled =3D false; + css_migration_enabled =3D false; } DEFINE_CCW_MACHINE(2_9, "2.9", false); =20 --=20 2.45.0