From patchwork Fri Oct 20 16:36:33 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: 736274 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp401919wrl; Fri, 20 Oct 2023 09:42:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGH0ZrvUNZEgrRnRlSPz04hieUjg4O/m6oQVN7z+Q5H+C3KD3d7zEGpKwOPp5IGjeDI7GmZ X-Received: by 2002:a81:bb54:0:b0:5a8:3f2:b538 with SMTP id a20-20020a81bb54000000b005a803f2b538mr2347990ywl.37.1697820150754; Fri, 20 Oct 2023 09:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697820150; cv=none; d=google.com; s=arc-20160816; b=v6AbneddbkklE1ZTSAkCNxw6/Fx8YnutSv+caOOv88LMQt9rqvbHUteA/CDKMWgCoU j5jyB7mDYyeIM49jJeNambvD4B2UUugeuBXbjuc67flh3wRJzUKtl4uZ+6L/T9uOfeDz OgpsDvdDf4ysCJ0W4NwOG7HYa+3FdTHH22ivpbrZSXUKgL+UU2ZFZg8ETk8t6nf71EMx 8mvV32K+ql8k9YAkV4W/RzqqxHHyfDp3b2TbHWFavNdgwAYYlv62e5c7pdFH3ajg5liQ g7lz2XeorFtJwy8lqugrWy0m9Rr3jprguE3YhsBoYjsCyPuVoByZlHiXddriDTg7Nzn2 RwQA== 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=sWVSb4kJOx4Py9xCdpLQSCowqDiVUo6mKEdRlRPdC3M=; fh=DKFqlS81ToskO1Fhddh+qidiVb6DHRO0FpOqZOCvJlw=; b=cG8Nd/o9A8YMmT9mPakXGo4C0ydRD66W0I1XcF+arGutdNjzhoufsOGsD1uUPfy5jj GTMpYSR5PrEx88wbXmPRDa+Zf+Ds0Q4ZT37tcealWi84k41A8Fwzopb8kXkslrXma5sv MlmFCxtn/hMc5PPrycQqrvP/39WL2H0vTEVl3Dc2GtXdNfZGrZF1nM82IC/aKKBDjqfp c6P42Ejl8O+3+3Lf1iHOTISoxEyFwJSCjfgUzajxj3MuSABXheCE/SFhy03wduOB3B5n mhPbapsn5iNEo5Ad2EeKmUgdpRWNjt1J2FN/7S55BMA/ovXEZL6+O2yMI1a01Vt9897L bqdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QoIN9rxY; 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 o10-20020ac85a4a000000b00417fa5bd43dsi1530191qta.314.2023.10.20.09.42.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 09:42:30 -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=QoIN9rxY; 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 1qtsVv-0004e4-2D; Fri, 20 Oct 2023 12:38:19 -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 1qtsVt-0004TR-3l for qemu-devel@nongnu.org; Fri, 20 Oct 2023 12:38:17 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtsVq-0002eC-R4 for qemu-devel@nongnu.org; Fri, 20 Oct 2023 12:38:16 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-533d31a8523so1502118a12.1 for ; Fri, 20 Oct 2023 09:38:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697819893; x=1698424693; 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=sWVSb4kJOx4Py9xCdpLQSCowqDiVUo6mKEdRlRPdC3M=; b=QoIN9rxYdoTVZr/OPJ98bL3VmrRNN2M+XkPFoo7H0pBFnWRoj7iYpM04asbzZHJPgA u1KDev6JxV1nc/k5X1mKWV90mhAsWRaorlE1rNDx89zvqiMuOD3UkcxKzc+NfLMxNcHS kVq3FK/1+no9GPWZO2z53R9VvyD5E7jQOjKuBMjyiCV6ohqcGb7CCxCgYWDnQi1Jnm6K vYhr5iTHmMQ9QKkARE/m04g4OP4LArm2CA3K/sy9WA+ROijNafMa3DNvXuG5iE5lD9Px UvzkRss/oxr52nUmDxL1DItkq+iKWSVAinRSpEigcK2X+rlqn56tkeJryMv83gmqASbd Do/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697819893; x=1698424693; 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=sWVSb4kJOx4Py9xCdpLQSCowqDiVUo6mKEdRlRPdC3M=; b=ard4nuKZfPiRAJGDcYQCPl1mPrN6ZUheHTej4Vhva4ePdgJXoxzyX5xdA9UlQAxAWO 322oq4j5STlhQP3yydxVw798sHFh8Yc6OpcYiNxErHNMX5+W95ni0U4xTX+Easb8Nko9 PPa7k5h7gnm1CLKWsEFdk9y9Xya2sbYaBWVwXGdJMCSpt1mX68/22mEETkDq9sPGo8XF 8UjJ1aly9kOafA5MxRZISOySqxfpO0zF102L3Qbctb3P9pGKx6YNAhxb9JSJAN8Ki0Vl 4cCGyhN3xhVxGZgbgcbWBkVXGTWMQJTWhbNcOMOZsKnAPBq4DPydUkY4Xirb1dapG1Rw ziXg== X-Gm-Message-State: AOJu0YywVUzJFWvm8eKI07y1LGbBZSbLdZUtwgTo5e79yBRlkmM6OHe6 O+5J0vEBR8BGkhUqmzmoK9otQr6B2Gn7VlXUIuc= X-Received: by 2002:a17:907:948e:b0:9bf:9c58:e91e with SMTP id dm14-20020a170907948e00b009bf9c58e91emr1600709ejc.56.1697819892970; Fri, 20 Oct 2023 09:38:12 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id w21-20020a170907271500b009ad81554c1bsm1780965ejk.55.2023.10.20.09.38.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 09:38:12 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Paolo Bonzini , Alistair Francis , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , qemu-s390x@nongnu.org, Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Nicholas Piggin , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= , =?utf-8?q?Herv=C3=A9_Poussineau?= , David Gibson , Harsh Prateek Bora , Alexey Kardashevskiy Subject: [PATCH 11/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_POWERPC_CPU) Date: Fri, 20 Oct 2023 18:36:33 +0200 Message-ID: <20231020163643.86105-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020163643.86105-1-philmd@linaro.org> References: <20231020163643.86105-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.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 Mechanical change using the following coccinelle script: @@ @@ - first_cpu + qemu_get_cpu(0, TYPE_POWERPC_CPU) Signed-off-by: Philippe Mathieu-Daudé --- hw/ppc/e500.c | 2 +- hw/ppc/ppc.c | 4 ++-- hw/ppc/prep_systemio.c | 2 +- hw/ppc/spapr.c | 11 ++++++----- hw/ppc/spapr_caps.c | 10 +++++----- hw/ppc/spapr_rtas.c | 2 +- hw/ppc/spapr_vof.c | 2 +- hw/ppc/vof.c | 3 ++- target/ppc/arch_dump.c | 4 ++-- 9 files changed, 21 insertions(+), 19 deletions(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index c4bf3fef32..02d14404d9 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -373,7 +373,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms, MachineState *machine = MACHINE(pms); unsigned int smp_cpus = machine->smp.cpus; const PPCE500MachineClass *pmc = PPCE500_MACHINE_GET_CLASS(pms); - CPUPPCState *env = cpu_env(first_cpu); + CPUPPCState *env = cpu_env(qemu_get_cpu(0, TYPE_POWERPC_CPU)); int ret = -1; uint64_t mem_reg_property[] = { 0, cpu_to_be64(machine->ram_size) }; int fdt_size; diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index be167710a3..be0b1536f5 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -970,7 +970,7 @@ void cpu_ppc_store_purr(CPUPPCState *env, uint64_t value) static void timebase_save(PPCTimebase *tb) { uint64_t ticks = cpu_get_host_ticks(); - PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *first_ppc_cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); if (!first_ppc_cpu->env.tb_env) { error_report("No timebase object"); @@ -998,7 +998,7 @@ static void timebase_save(PPCTimebase *tb) static void timebase_load(PPCTimebase *tb) { CPUState *cpu; - PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *first_ppc_cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); int64_t tb_off_adj, tb_off; unsigned long freq; diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c index c96cefb13d..0431cde91c 100644 --- a/hw/ppc/prep_systemio.c +++ b/hw/ppc/prep_systemio.c @@ -261,7 +261,7 @@ static void prep_systemio_realize(DeviceState *dev, Error **errp) s->iomap_type = PORT0850_IOMAP_NONCONTIGUOUS; qemu_set_irq(s->non_contiguous_io_map_irq, s->iomap_type & PORT0850_IOMAP_NONCONTIGUOUS); - cpu = POWERPC_CPU(first_cpu); + cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); s->softreset_irq = qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET); isa_register_portio_list(isa, &s->portio, 0x0, ppc_io800_port_list, s, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index cb840676d3..a5006eaa5e 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -981,7 +981,7 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt) static void spapr_dt_ov5_platform_support(SpaprMachineState *spapr, void *fdt, int chosen) { - PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *first_ppc_cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); char val[2 * 4] = { 23, 0x00, /* XICS / XIVE mode */ @@ -1125,7 +1125,7 @@ static void spapr_dt_hypervisor(SpaprMachineState *spapr, void *fdt) * Older KVM versions with older guest kernels were broken * with the magic page, don't allow the guest to map it. */ - if (!kvmppc_get_hypercall(cpu_env(first_cpu), hypercall, + if (!kvmppc_get_hypercall(cpu_env(qemu_get_cpu(0, TYPE_POWERPC_CPU)), hypercall, sizeof(hypercall))) { _FDT(fdt_setprop(fdt, hypervisor, "hcall-instructions", hypercall, sizeof(hypercall))); @@ -1669,7 +1669,7 @@ static void spapr_machine_reset(MachineState *machine, ShutdownCause reason) pef_kvm_reset(machine->cgs, &error_fatal); spapr_caps_apply(spapr); - first_ppc_cpu = POWERPC_CPU(first_cpu); + first_ppc_cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); if (kvm_enabled() && kvmppc_has_cap_mmu_radix() && ppc_type_check_compat(machine->cpu_type, CPU_POWERPC_LOGICAL_3_00, 0, spapr->max_compat_pvr)) { @@ -1845,7 +1845,7 @@ static int spapr_post_load(void *opaque, int version_id) } if (kvm_enabled() && spapr->patb_entry) { - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); bool radix = !!(spapr->patb_entry & PATE1_GR); bool gtse = !!(cpu->env.spr[SPR_LPCR] & LPCR_GTSE); @@ -4014,7 +4014,8 @@ static void spapr_core_plug(HotplugHandler *hotplug_dev, DeviceState *dev) */ if (hotplugged) { for (i = 0; i < cc->nr_threads; i++) { - ppc_set_compat(core->threads[i], POWERPC_CPU(first_cpu)->compat_pvr, + ppc_set_compat(core->threads[i], + POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU))->compat_pvr, &error_abort); } } diff --git a/hw/ppc/spapr_caps.c b/hw/ppc/spapr_caps.c index 5a0755d34f..0c1f00d869 100644 --- a/hw/ppc/spapr_caps.c +++ b/hw/ppc/spapr_caps.c @@ -194,7 +194,7 @@ static void cap_htm_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { ERRP_GUARD(); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); CPUPPCState *env = &cpu->env; if (!val) { @@ -213,7 +213,7 @@ static void cap_vsx_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) static void cap_dfp_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { ERRP_GUARD(); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); CPUPPCState *env = &cpu->env; if (!val) { @@ -440,7 +440,7 @@ static void cap_nested_kvm_hv_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { ERRP_GUARD(); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); CPUPPCState *env = &cpu->env; if (!val) { @@ -494,7 +494,7 @@ static void cap_large_decr_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { ERRP_GUARD(); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); if (!val) { @@ -632,7 +632,7 @@ static void cap_ail_mode_3_apply(SpaprMachineState *spapr, uint8_t val, Error **errp) { ERRP_GUARD(); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(cpu); if (!val) { diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index 7df21581c2..3d4e93a188 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -539,7 +539,7 @@ uint64_t qtest_rtas_call(char *cmd, uint32_t nargs, uint64_t args, for (token = 0; token < RTAS_TOKEN_MAX - RTAS_TOKEN_BASE; token++) { if (strcmp(cmd, rtas_table[token].name) == 0) { SpaprMachineState *spapr = SPAPR_MACHINE(qdev_get_machine()); - PowerPCCPU *cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); rtas_table[token].fn(cpu, spapr, token + RTAS_TOKEN_BASE, nargs, args, nret, rets); diff --git a/hw/ppc/spapr_vof.c b/hw/ppc/spapr_vof.c index 09f29be0b9..301b3cd433 100644 --- a/hw/ppc/spapr_vof.c +++ b/hw/ppc/spapr_vof.c @@ -58,7 +58,7 @@ void spapr_vof_reset(SpaprMachineState *spapr, void *fdt, Error **errp) { target_ulong stack_ptr; Vof *vof = spapr->vof; - PowerPCCPU *first_ppc_cpu = POWERPC_CPU(first_cpu); + PowerPCCPU *first_ppc_cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); vof_init(vof, spapr->rma_size, errp); diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c index e3b430a81f..9fa1cd9e19 100644 --- a/hw/ppc/vof.c +++ b/hw/ppc/vof.c @@ -797,7 +797,8 @@ static uint32_t vof_call_method(MachineState *ms, Vof *vof, uint32_t methodaddr, VofMachineIfClass *vmc = VOF_MACHINE_GET_CLASS(vmo); g_assert(vmc->client_architecture_support); - ret = (uint32_t)vmc->client_architecture_support(ms, first_cpu, + ret = (uint32_t)vmc->client_architecture_support(ms, + qemu_get_cpu(0, TYPE_POWERPC_CPU), param1); } diff --git a/target/ppc/arch_dump.c b/target/ppc/arch_dump.c index a8315659d9..be2a78d01f 100644 --- a/target/ppc/arch_dump.c +++ b/target/ppc/arch_dump.c @@ -228,11 +228,11 @@ int cpu_get_dump_info(ArchDumpInfo *info, { PowerPCCPU *cpu; - if (first_cpu == NULL) { + if (qemu_get_cpu(0, TYPE_POWERPC_CPU) == NULL) { return -1; } - cpu = POWERPC_CPU(first_cpu); + cpu = POWERPC_CPU(qemu_get_cpu(0, TYPE_POWERPC_CPU)); info->d_machine = PPC_ELF_MACHINE; info->d_class = ELFCLASS;