From nobody Sat Feb 7 05:32:58 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) client-ip=209.85.221.66; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f66.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602362622; cv=none; d=zohomail.com; s=zohoarc; b=KIBLy0tl7y3Q86r77VQjwIYihZ0CxoAubJ7DjOJ2EQGlH6fSn7OiFUgWdqgndHfZLKRmiOW93ORWzrvDmqDR9N7iZG+fFk8cRnoIaxy7xl6wEXPN128fT1IqeN/Hp1WpuursZOlQhQcEDxG3TDvDqijWigk3RkgVuGvVkGcIVVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602362622; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yAfqPnpV3TT1ZjFMpcjYdcDBoe16Hc9PmfHSSw7OU4Q=; b=RuGVdiBYiGAXR60a+Oj4RPpyo06Ti+vwFM7XKbkKRTVIWtJHKsazjUZpyUmNZJU7glAj0lF1HStcDop/Ae5GL6Y0JNEC7X7ka6IaRQa2UqAhkptOcP/B/4gp+um3d83QUecKcJGC1iw8FwLXoOa/X7JjiSDJQEZVHMNXP/yvyQM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.zohomail.com with SMTPS id 1602362622993521.2022644170697; Sat, 10 Oct 2020 13:43:42 -0700 (PDT) Received: by mail-wr1-f66.google.com with SMTP id e17so14138879wru.12 for ; Sat, 10 Oct 2020 13:43:42 -0700 (PDT) Return-Path: Return-Path: Received: from localhost.localdomain (106.red-83-59-162.dynamicip.rima-tde.net. [83.59.162.106]) by smtp.gmail.com with ESMTPSA id 205sm2705471wme.38.2020.10.10.13.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Oct 2020 13:43:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yAfqPnpV3TT1ZjFMpcjYdcDBoe16Hc9PmfHSSw7OU4Q=; b=XZnT9cyxuuui3lkootoFDJtjugZ2pCHj1OgA9aiHhyqWzdur7GC5v3bta9OO2dEwXd aZLYF0YJzEe0EiJ2/hMrVx4xyddqiFN3UKwKUpKRGVmkRWBrJDe3/QNRZvNBkVp9gkFE VPNuRup3BzQPTQ4fWoM74pzp9Wd3kz956krqzaw798S4Nmav9pvVigPj/g4ClqDFjKCN 44cFJxLDEQ3ntoAW1956xAFhnG+SPeOro8cfSDJKq5p2CV3rkLubefeNBI0Ayd93Ql8s J6IDlmQVivgwf3fXRjIdY/YtczTp8P3TcJwai2os/vx83gmM2ykD3nYeLKxHnTbGbYGx 25tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yAfqPnpV3TT1ZjFMpcjYdcDBoe16Hc9PmfHSSw7OU4Q=; b=mh0c5VGDDLJCAhUU+U3GH4JP0x58o5pYSprFfqgcpCxLRegEBlHU+ac4BhQQf5vmP8 xs3dVAjlML3SB4shwobP8Kmzpah5Rva7OPW3ouge9ibojBoF+PgJz+suWrG1x+yoSXxf PruVuNQtHPqXGY6L+UW07GPgDK4P9wGj0rzKlwo+vh5KE7SKSvrRuT2VLa02dRQRMnyY AwDoaaJKdCI7bosSxuTBa9GGzgEOpTfmG7IwfVctVFEzBv6qv5cAbgDw1uEXpbzAmB02 aslaBSQufYMKe/7d2UC1xUh99EcpaB8UqkIGoLtDUJS8wPkSPrYK/axFqzKYEVmiL2IY FSHQ== X-Gm-Message-State: AOAM531kws9LISCRY/qaozx1m4qvwE/p5Z+x3BMJchlvtAT/kbN3sUNc oYaUW+6y8HlIKvHLGBXkwLk= X-Google-Smtp-Source: ABdhPJwl1SZ4wjgk0tokL5AEiucFzDhv+Ks6xfq2wV/sgq3BO2IMeD1oQg3JvvBHbx4vLniw6XKUgw== X-Received: by 2002:adf:f4ca:: with SMTP id h10mr330854wrp.89.1602362621082; Sat, 10 Oct 2020 13:43:41 -0700 (PDT) Sender: =?UTF-8?Q?Philippe_Mathieu=2DDaud=C3=A9?= From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Huacai Chen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Damien Hedde , Paul Burton , Luc Michel , Aleksandar Rikalo , Huacai Chen , Richard Henderson , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Eduardo Habkost , =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Paolo Bonzini , Aurelien Jarno , Jiaxun Yang Subject: [PATCH v3 14/20] hw/mips/mipssim: Correct CPU frequency Date: Sat, 10 Oct 2020 22:43:13 +0200 Message-Id: <20201010204319.3119239-15-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201010204319.3119239-1-f4bug@amsat.org> References: <20201010204319.3119239-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) The MIPSsim machine CPU frequency is too fast running at 200 MHz, while it should be 12 MHz for the 24K and 6 MHz for the 5K core. Ref: Linux commit c78cbf49c4ed ("Support for MIPSsim, the cycle accurate MIPS simulator.") Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mipssim.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 5d4ad74828d..b4b3c2851da 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -40,6 +40,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/sysbus.h" +#include "hw/qdev-clock.h" #include "hw/qdev-properties.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" @@ -152,11 +153,20 @@ mips_mipssim_init(MachineState *machine) MemoryRegion *bios =3D g_new(MemoryRegion, 1); MIPSCPU *cpu; CPUMIPSState *env; + Clock *cpuclk; ResetData *reset_info; int bios_size; =20 /* Init CPUs. */ - cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); + cpu =3D MIPS_CPU(object_new(machine->cpu_type)); + cpuclk =3D clock_new(OBJECT(machine), "cpu-refclk"); +#ifdef TARGET_MIPS64 + clock_set_hz(cpuclk, 6000000); /* 6 MHz */ +#else + clock_set_hz(cpuclk, 12000000); /* 12 MHz */ +#endif + qdev_connect_clock_in(DEVICE(cpu), "clk-in", cpuclk); + qdev_realize(DEVICE(cpu), NULL, &error_abort); env =3D &cpu->env; =20 reset_info =3D g_malloc0(sizeof(ResetData)); --=20 2.26.2