From patchwork Mon Sep 18 16:02:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 724158 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1773314wro; Mon, 18 Sep 2023 09:05:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGpW664kctEnpN1EeqdmZG/8yIPbRRlOKXD1OwetBIt83RkjmGEkHGdore9P+NNEvcpyKRz X-Received: by 2002:a0c:f246:0:b0:656:396f:b294 with SMTP id z6-20020a0cf246000000b00656396fb294mr7867604qvl.21.1695053107846; Mon, 18 Sep 2023 09:05:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695053107; cv=none; d=google.com; s=arc-20160816; b=bhacP8Aq9V58ywPa9Js1mvg8hFkprPYjbNHRtxn7zp6r9xnC7JegSRyLkmXQmZDkOZ Re9wyw4DJAPN7+MbdLVM32iO87CPU9ywMGcxibtczSErpPlFd5m31gdxqE8AmMbaYlzi FqThGzSVqYrs/K00psa9lHnt+SGwTG7qDh+JD4QWEXW2huQvMHhw1bvk/N+7Ovwk4kEQ dnOvru9iv+sOSe076Zr84jl/0meTmNqPLNi0skJMyE/FFioJNcTL4P1kbBDRULPMl91P 1XDnaDNcBWJW+jCD+8AC6Js/tT5u0AVgNpMSS0dXXuOa3mDyGNRbSLxUOivuMtP40c1f s3qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CLYCBr4NSqb4Srk/T+P7jn9AmbCAT10Txre246ezJ94=; fh=AIYNAcrfQPdTp+tiOBYg2bCy2NfWRbXD73JV9SLWbpM=; b=uCBwpSRGZR3gco22USDXePFPV4WXG2UdAz9nvkrsRvhsBx/wo+XimO2ywtDIX0WS9r 6qa/jmZT5XlPlmoh/SmoEuhSPd8KL6GQf9xceOhNNSRe6frAxvmJZebXy6aI89AW/urv uppr5Oi7SpiQNOB/RYZKKJv8tisuDCZY0U7JuRAr8gszk9YzbKQVkYR0LH1ZKFRUZzIg TJdQGVLVEQ4KnxdllUpIm2uZVREXG3NR0nqXBmFwsjUzVijwk+ZVrGigQWkOuRwkfr1g bKpK+F3h3jnRxfKn8fFcc5HL72+jVMKi+G8e5s/EIsIAta1/kpx9v6qxES1bz9+VNEwN JiMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zi3uk1jy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j11-20020a05620a288b00b0076da78c6888si6373669qkp.750.2023.09.18.09.05.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 09:05:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zi3uk1jy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiGjq-0001FY-8U; Mon, 18 Sep 2023 12:04:42 -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 1qiGjo-00019u-Ma for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:40 -0400 Received: from mail-lj1-x22d.google.com ([2a00:1450:4864:20::22d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiGjl-0004PE-CV for qemu-devel@nongnu.org; Mon, 18 Sep 2023 12:04:40 -0400 Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2c00c0f11b2so18547491fa.1 for ; Mon, 18 Sep 2023 09:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695053075; x=1695657875; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CLYCBr4NSqb4Srk/T+P7jn9AmbCAT10Txre246ezJ94=; b=Zi3uk1jy2ZOjCgSultSkYdqb7MNl0gMoYfhwy85tmx2zrC3C8ZljeIe765Cwx+rghY 06Q21koXYPZ1G3tQDE3J/H5ZFsgZy0y3XIwJYXCbucujHzbaRGD9daOlqr8UwUXTFPGt 134R5+eqKwJ7/oSYRpxG1FUtCOsYaFiKvuy3SBvhrf0jYni2CxWbdbw+DVmbjMebQ2jI 2+uARZAtQ/eB74WmQrx3ygpeXvd9YmzQMeOG+BQ0lZECtnNb0r8SXNX+/kYC8op7Um7T akV1rrlI4jyqRVOQ1lXEi63S5MJUXmxd2na2p4tx9ScJrcMCLM8Nw1U0jY8ViKDtD2k6 k1+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695053075; x=1695657875; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CLYCBr4NSqb4Srk/T+P7jn9AmbCAT10Txre246ezJ94=; b=aPGgGmiUkD2uHEaKsVYmHa2lRKTDN+SBQpgCKA0i9CAXiL6iApZbYoDun4xYb9j9km brROdjyjh/0QtA/VwzdkeDQParyZR8JIOmu2i8EVS7jre8QgcZPu+UzlrfuhAvep2Rsz gR5MIHJ/+SMyZO5xsqgEUGkw6pjdtIDTcy0dGjRJbIEEsBnZM1xfNEbIEm+5cVlpc35K ocpsg3KcZc1PDbzJIrRZC1Tdhw2seMRWTt9xPeNPyKPqRxY/evcjarlZCTZHHs+OVdqs JnJhVLRnmhEeOw608YPVmNLsLpYSTJtNkoUkvtJsLAGBXu+4jQuCZeMd7t24w1HqNiN0 q7sQ== X-Gm-Message-State: AOJu0Yy6S0cH9HuOoTCL6XDqtzelL83RUmW9WtkIVGqx9CoH7234oME0 yoKM7ir//4i+RPGQuaJuKKJNm7WLZnNXXVEdl4WtLvfP X-Received: by 2002:a2e:8046:0:b0:2bc:b821:84ad with SMTP id p6-20020a2e8046000000b002bcb82184admr8047755ljg.16.1695053075234; Mon, 18 Sep 2023 09:04:35 -0700 (PDT) Received: from localhost.localdomain (static-212-193-78-212.thenetworkfactory.nl. [212.78.193.212]) by smtp.gmail.com with ESMTPSA id f10-20020a170906560a00b0099d0c0bb92bsm6569110ejq.80.2023.09.18.09.04.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 09:04:34 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Laurent Vivier , Paolo Bonzini , Max Filippov , David Hildenbrand , Peter Xu , Anton Johansson , Peter Maydell , kvm@vger.kernel.org, Marek Vasut , David Gibson , Brian Cain , Yoshinori Sato , "Edgar E . Iglesias" , Claudio Fontana , Daniel Henrique Barboza , Artyom Tarasenko , Marcelo Tosatti , qemu-ppc@nongnu.org, Liu Zhiwei , Aurelien Jarno , Ilya Leoshkevich , Daniel Henrique Barboza , Bastian Koppelmann , =?utf-8?q?C=C3=A9dric_?= =?utf-8?q?Le_Goater?= , Alistair Francis , Alessandro Di Federico , Song Gao , Marcel Apfelbaum , Chris Wulff , "Michael S. Tsirkin" , Alistair Francis , Fabiano Rosas , qemu-s390x@nongnu.org, Yanan Wang , Luc Michel , Weiwei Li , Bin Meng , Stafford Horne , Xiaojuan Yang , "Daniel P . Berrange" , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Jiaxun Yang , Richard Henderson , Aleksandar Rikalo , Bernhard Beschow , Mark Cave-Ayland , qemu-riscv@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , Nicholas Piggin , Greg Kurz , Michael Rolnik , Eduardo Habkost , Markus Armbruster , Palmer Dabbelt Subject: [PATCH 18/22] target/s390x: Call s390_cpu_realize_sysemu from s390_realize_cpu_model Date: Mon, 18 Sep 2023 18:02:51 +0200 Message-ID: <20230918160257.30127-19-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918160257.30127-1-philmd@linaro.org> References: <20230918160257.30127-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=philmd@linaro.org; helo=mail-lj1-x22d.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=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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org s390_cpu_realize_sysemu() runs some checks for the TCG accelerator, previous to creating the vCPU. s390_realize_cpu_model() also does run some checks for KVM. Move the sysemu call to s390_realize_cpu_model(). Having a single call before cpu_exec_realizefn() will allow us to factor a verify_accel_features() handler out in a pair of commits. Directly pass a S390CPU* to s390_cpu_realize_sysemu() to simplify. Signed-off-by: Philippe Mathieu-Daudé --- target/s390x/s390x-internal.h | 2 +- target/s390x/cpu-sysemu.c | 3 +-- target/s390x/cpu.c | 6 ------ target/s390x/cpu_models.c | 4 ++++ 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/target/s390x/s390x-internal.h b/target/s390x/s390x-internal.h index 825252d728..781ac08458 100644 --- a/target/s390x/s390x-internal.h +++ b/target/s390x/s390x-internal.h @@ -241,7 +241,7 @@ uint32_t calc_cc(CPUS390XState *env, uint32_t cc_op, uint64_t src, uint64_t dst, unsigned int s390_cpu_halt(S390CPU *cpu); void s390_cpu_unhalt(S390CPU *cpu); void s390_cpu_init_sysemu(Object *obj); -bool s390_cpu_realize_sysemu(DeviceState *dev, Error **errp); +bool s390_cpu_realize_sysemu(S390CPU *cpu, Error **errp); void s390_cpu_finalize(Object *obj); void s390_cpu_class_init_sysemu(CPUClass *cc); void s390_cpu_machine_reset_cb(void *opaque); diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c index 8112561e5e..5178736c46 100644 --- a/target/s390x/cpu-sysemu.c +++ b/target/s390x/cpu-sysemu.c @@ -122,9 +122,8 @@ void s390_cpu_init_sysemu(Object *obj) s390_cpu_set_state(S390_CPU_STATE_STOPPED, cpu); } -bool s390_cpu_realize_sysemu(DeviceState *dev, Error **errp) +bool s390_cpu_realize_sysemu(S390CPU *cpu, Error **errp) { - S390CPU *cpu = S390_CPU(dev); MachineState *ms = MACHINE(qdev_get_machine()); unsigned int max_cpus = ms->smp.max_cpus; diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c index 416ac6c4e0..7257d4bc19 100644 --- a/target/s390x/cpu.c +++ b/target/s390x/cpu.c @@ -237,12 +237,6 @@ static void s390_cpu_realizefn(DeviceState *dev, Error **errp) goto out; } -#if !defined(CONFIG_USER_ONLY) - if (!s390_cpu_realize_sysemu(dev, &err)) { - goto out; - } -#endif - cpu_exec_realizefn(cs, &err); if (err != NULL) { goto out; diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 98f14c09c2..f030be0d55 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -612,6 +612,10 @@ void s390_realize_cpu_model(CPUState *cs, Error **errp) cpu->env.cpuid = deposit64(cpu->env.cpuid, CPU_PHYS_ADDR_SHIFT, CPU_PHYS_ADDR_BITS, cpu->env.core_id); } + + if (!s390_cpu_realize_sysemu(cpu, &err)) { + return; + } #endif }