From nobody Mon Nov 25 12:15:29 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=1715511065; cv=none; d=zohomail.com; s=zohoarc; b=LQeSioZdCBknWvzs7xgqUJxQ/Bx2fOy+3kyjbu7S+iq9EZG0m6bc88Vn5jSzHy2/MUbD7sQyRatUjkRL7DiayVKujk11Ox76Ud7fRkQY0vrFP77HKxK72Ctdz9BiUs1sJaI3L0DA9EUjOmfbn1FKQNQcX3ee45UqOKtuySYmKdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715511065; h=Content-Type: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=16FC5lp67uehiw7i+v0tZwBGhuHhyMS3WmvcfffWhrM=; b=i6+qR3rxiDiHG48/0QAO+M7jykHO7q3Z8/Az3TWeaMvsB5GFsVUnOd1WsqEzLkjVZhY5AasWKdpwp/afHBQob5c0q9q/D8tOcFcDKKVQSiCLiffO1WdCxGW38KYxJ18JcklQb8qSSYfCXpScktISQ3WBVwcNYgOmL38cCnqCLU4= 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 1715511065079464.04850823477955; Sun, 12 May 2024 03:51:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s66md-0003Gl-Ut; Sun, 12 May 2024 06:50:23 -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 1s66mY-0003F9-Qq for qemu-devel@nongnu.org; Sun, 12 May 2024 06:50:18 -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 1s66mW-0005u0-VB for qemu-devel@nongnu.org; Sun, 12 May 2024 06:50:18 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-451-qdpJ33xZPUyfyEvn7wJrDA-1; Sun, 12 May 2024 06:50:14 -0400 Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a59a0d2280cso269980266b.1 for ; Sun, 12 May 2024 03:50:14 -0700 (PDT) Received: from avogadro.local ([151.95.155.52]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b0195dsm441401966b.184.2024.05.12.03.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 03:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715511016; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=16FC5lp67uehiw7i+v0tZwBGhuHhyMS3WmvcfffWhrM=; b=bhRna411v0RgaY8KIblhINAbfq4xZpAJJvjnKHrGKtqYGWa0yEz/6aOsmjRxj4jjnGPwAd 0ac42de3ruuYgztGBTnzGQT7LdrBKLuOX4KUIj1dQn0fiFxGuw25WZxnE/SkbKwduR7qei lpedvJv4wZFQF3OnlmkVy+KSsSW2wWA= X-MC-Unique: qdpJ33xZPUyfyEvn7wJrDA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715511013; x=1716115813; 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=16FC5lp67uehiw7i+v0tZwBGhuHhyMS3WmvcfffWhrM=; b=bl6i1I7PExC0biRbSXtdmTYtzp/UaOi/wJea/QOA7ymrDcTNuTDwPkriqvt357q94l m1zT38cF/KBoJJuKzyjevlcGp99PfR7ft34BiuhiPBeWSf+ADGbRpmS3tpKXV+sXfZMV yGCuxAwKEMVyMo4zpSztyjoxPjo8T3zLrNQ3KA0FJ5ntKKIZGgqhr6VHcg3Qkh8qjLqb sGmiOrG9pjJUCFvEnTq1YpKwp1KAhnsRiRYbO06JYZVNsE8Ae2oFonsNKt60BrweF5MV cL2FySB3gtoqIx/OgbiEBKwX9gf6SnM0Cui/cbKc6igF2AisE6ym06Lyxcj4o+fkcYvB YVmw== X-Gm-Message-State: AOJu0YyvDjOH3mfywxUgDWhzVNos+2MBXRiei2y2Lh8oPzzhrYG0O3U3 3Kv9hky4y7OMKjj67LnMJjURe1LUyeSxAvGnpu7UZo3f727X4c6+W/zRRe9xmfoeGlhALbcMirK G4kxkBf7azdcqZH0ACAITJrOuhR+BA3ROcgeu1nXikcrZ/H3hOR/yu7plK7UZ1pHEmtY2wlVGmh C5EXLi16xos3QXzZRrzM7S1qiUBLZOrSUJBd7y X-Received: by 2002:a17:906:a28c:b0:a59:e5ca:db31 with SMTP id a640c23a62f3a-a5a2d54c743mr441517866b.16.1715511012849; Sun, 12 May 2024 03:50:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGbq7l9MYqBEUTYZaw//UmYJM1odEY1ZffePHiZBloA/aC+52xGNrjVy2GINHZIq5c0BYlRCA== X-Received: by 2002:a17:906:a28c:b0:a59:e5ca:db31 with SMTP id a640c23a62f3a-a5a2d54c743mr441516766b.16.1715511012486; Sun, 12 May 2024 03:50:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PULL 09/27] s390x: move s390_cpu_addr2state to target/s390x/sigp.c Date: Sun, 12 May 2024 12:49:27 +0200 Message-ID: <20240512104945.130198-10-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: 1715511065609100003 Content-Type: text/plain; charset="utf-8" This function has no dependency on the virtio-ccw machine type, though it assumes that the CPU address corresponds to the core_id and the index. If there is any need of something different or more fancy (unlikely) S390 can include a MachineClass subclass and implement it there. For now, move it to sigp.c for simplicity. Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-ID: <20240509170044.190795-2-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- hw/s390x/s390-virtio-ccw.c | 16 ---------------- target/s390x/sigp.c | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 2afaf45ce60..42628fc45d2 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -50,22 +50,6 @@ =20 static Error *pv_mig_blocker; =20 -S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) -{ - static MachineState *ms; - - if (!ms) { - ms =3D MACHINE(qdev_get_machine()); - g_assert(ms->possible_cpus); - } - - /* CPU address corresponds to the core_id and the index */ - if (cpu_addr >=3D ms->possible_cpus->len) { - return NULL; - } - return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu); -} - static S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp) { diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c index 9dd977349ab..ad0ad61177d 100644 --- a/target/s390x/sigp.c +++ b/target/s390x/sigp.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "s390x-internal.h" +#include "hw/boards.h" #include "sysemu/hw_accel.h" #include "sysemu/runstate.h" #include "exec/address-spaces.h" @@ -435,6 +436,22 @@ static int sigp_set_architecture(S390CPU *cpu, uint32_= t param, return SIGP_CC_STATUS_STORED; } =20 +S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) +{ + static MachineState *ms; + + if (!ms) { + ms =3D MACHINE(qdev_get_machine()); + g_assert(ms->possible_cpus); + } + + /* CPU address corresponds to the core_id and the index */ + if (cpu_addr >=3D ms->possible_cpus->len) { + return NULL; + } + return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu); +} + int handle_sigp(CPUS390XState *env, uint8_t order, uint64_t r1, uint64_t r= 3) { uint64_t *status_reg =3D &env->regs[r1]; --=20 2.45.0