From nobody Tue Apr 15 10:55:53 2025 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1622074617; cv=none; d=zohomail.com; s=zohoarc; b=Ja9vHLfl8Td3MaEKihMuZyBr6E/BartHYrtZi41Qo4k2dit6y/2SRWEdX4ixaIFyEY36V/m7/oJ+B32oO4y+arNeKG0/cOg1csAFp7OpJWWNLOJuL1nBqXtRQz/8cFh/vGvyifMT16L1Cd5RTEqNe7fIqVkhx7p27BNTanDCQbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622074617; 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=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=E8E9oEcxaqWOlt6qqv010EAh1q3iMFTf0gf9Z9fLB8WW8dpXt+034814hPo4toY5OwLqOU7ZMGw8JZTS6PyDk0hncjqvSGdkvc844dZA4a8NOZT9NBM7YKfTxs9MW2YLQe7zlpLsRHe/WEGrFSq/DKHeDQAzVTXiQ22Df7GghvA= 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 1622074617342837.2770923921479; Wed, 26 May 2021 17:16:57 -0700 (PDT) Received: from localhost ([::1]:59932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lm3hn-0005Sd-9K for importer@patchew.org; Wed, 26 May 2021 20:16:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lm3FO-0005kq-KO for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:38899) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lm3FI-0004Vz-Kd for qemu-devel@nongnu.org; Wed, 26 May 2021 19:47:34 -0400 Received: by mail-pl1-x62b.google.com with SMTP id 69so1422329plc.5 for ; Wed, 26 May 2021 16:47:28 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id g13sm285355pfi.18.2021.05.26.16.47.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 May 2021 16:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=s0ePgidFtxmL/mVzo3BVldMMiwsrS76yEBmP2pYhvhZ5B6b1RbTeN3cx2Xyhu7c3Je MGzid/cWrutbXFCDzXDfu0xhnp6vBioRA0t9CHVMkywaBEAPlujNKNUdMIGgydN2ZOxm yRjdsMPCp+mEf5YFLdoJuev0bQvZDN7YrslHKATtCtJMoFIE2dFBN4lUT5LPkXl4WgwA /vyfF8IEnroT2IXi4vjEqo3eLQibcq8cXINQNErmzTIdKEQeZn5RvSIPB9SNmCDI86Ei 7b3mYh97+/UnPgFdvXHqWdb0CfQAvKpPw4BWPGF0s34sD+wigFxyG9CQB/OYeTfdwprs TUHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=e6BEiCbeKFz5loqZtzxI2JeaF9i9lMWYWU5RWY4z+jo=; b=giKPYGV61S/qcJWburHxYD0FsU0YjgyQk5LEFTTiADc6CDMLk4flw5jJOIYtXLBqUh hxhMvcMu/YQqQzwhi2rT0kLNGaHewghAPfXN3KhVLdNm22CFsoiC69oD4BXGmaybvZr0 /AFHYje4L9h98+r9AACwo3Yjgfbe+5hord4rbwC5KiEHEYUkaRmH9SP20nomZlMFda/c 8HcIPYRkubZqZqgHl3/ZdYUlzqEkTp1TuLxxaww+NrzdpNprCiEP0o+dKQ8ITj97lBCj a82AeYDPyeTKXXX1DeEUZuK4sF6840/pEUuVfttZPrfwNs3qRXNRSWMk9aSOxtVcBHqD e1VQ== X-Gm-Message-State: AOAM531xigTNOI08S7Eq6dsnR6fYSTThcS6rMXDH2jEeAL9Jj0/DCFkz BYKtwjSUYBpklxfOFWFwPVIOaWBxOtks4A== X-Google-Smtp-Source: ABdhPJz1HCylq/hbxU+63TjDhzK+E54IWm+/QxmRPQXn6nrzPsVxgRZ8n9qF7HkeXIRuBPf6whIEFQ== X-Received: by 2002:a17:90a:fa6:: with SMTP id 35mr685681pjz.186.1622072847280; Wed, 26 May 2021 16:47:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 18/31] cpu: Assert DeviceClass::vmsd is NULL on user emulation Date: Wed, 26 May 2021 16:46:57 -0700 Message-Id: <20210526234710.125396-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210526234710.125396-1-richard.henderson@linaro.org> References: <20210526234710.125396-1-richard.henderson@linaro.org> MIME-Version: 1.0 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=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.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: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 Migration is specific to system emulation. Restrict current DeviceClass::vmsd to sysemu using #ifdef'ry, and assert in cpu_exec_realizefn() that dc->vmsd not set under user emulation. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Message-Id: <20210517105140.1062037-12-f4bug@amsat.org> Signed-off-by: Richard Henderson --- cpu.c | 2 ++ target/sh4/cpu.c | 5 +++-- target/xtensa/cpu.c | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cpu.c b/cpu.c index 34a0484bf4..6fe4af2797 100644 --- a/cpu.c +++ b/cpu.c @@ -141,6 +141,8 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) #endif /* CONFIG_TCG */ =20 #ifdef CONFIG_USER_ONLY + assert(qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL || + qdev_get_vmsd(DEVICE(cpu))->unmigratable); assert(cc->vmsd =3D=3D NULL); #else if (qdev_get_vmsd(DEVICE(cpu)) =3D=3D NULL) { diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index ac65c88f1f..35d4251aaf 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -218,10 +218,12 @@ static void superh_cpu_initfn(Object *obj) env->movcal_backup_tail =3D &(env->movcal_backup); } =20 +#ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_sh_cpu =3D { .name =3D "cpu", .unmigratable =3D 1, }; +#endif =20 #include "hw/core/tcg-cpu-ops.h" =20 @@ -257,12 +259,11 @@ static void superh_cpu_class_init(ObjectClass *oc, vo= id *data) cc->gdb_write_register =3D superh_cpu_gdb_write_register; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug =3D superh_cpu_get_phys_page_debug; + dc->vmsd =3D &vmstate_sh_cpu; #endif cc->disas_set_info =3D superh_cpu_disas_set_info; =20 cc->gdb_num_core_regs =3D 59; - - dc->vmsd =3D &vmstate_sh_cpu; cc->tcg_ops =3D &superh_tcg_ops; } =20 diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c index 210ef80092..0267571fbd 100644 --- a/target/xtensa/cpu.c +++ b/target/xtensa/cpu.c @@ -175,10 +175,12 @@ static void xtensa_cpu_initfn(Object *obj) #endif } =20 +#ifndef CONFIG_USER_ONLY static const VMStateDescription vmstate_xtensa_cpu =3D { .name =3D "cpu", .unmigratable =3D 1, }; +#endif =20 #include "hw/core/tcg-cpu-ops.h" =20 @@ -215,9 +217,9 @@ static void xtensa_cpu_class_init(ObjectClass *oc, void= *data) cc->gdb_stop_before_watchpoint =3D true; #ifndef CONFIG_USER_ONLY cc->get_phys_page_debug =3D xtensa_cpu_get_phys_page_debug; + dc->vmsd =3D &vmstate_xtensa_cpu; #endif cc->disas_set_info =3D xtensa_cpu_disas_set_info; - dc->vmsd =3D &vmstate_xtensa_cpu; cc->tcg_ops =3D &xtensa_tcg_ops; } =20 --=20 2.25.1