From nobody Tue Feb 10 11:56:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) client-ip=209.85.221.65; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-f65.google.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1602496764; cv=none; d=zohomail.com; s=zohoarc; b=HsQ7xvcZOvFgn5o5MiGXl3+Az6ZL1yZawOlSWqSI4K1QqnWCV9wRjWjvf6DO+vLHy68123Hi69Aj4eNCgfriD1fihy41ajp+8LyZzD9N+GUiErTd+zHVNiTaW1a3/6HRUFBqPz9Z52Otj+HJAljIVmD+pkrUtTzDrC1JJUoHOiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602496764; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MXkPVd2aO8qnDLNyGp6W47ZEx+VHl+jUfpvG7Jg6mWc=; b=jS7K/15quj6JYBhAHnTUiZHMrUwvgpeHSXLVUB8lTh4Rq5a48VgG4oPzcsmkHj6sP9Jo1QcoDyYPFXJQoDnV+l1jc/2TS6iMMri3OIZ3MZpjejaZHsMnjTcMiFlrNxrF/2uVGT5ZZNGOaiAe5/7WCJEJSX9w04SaAq65k5iejos= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of _spf.google.com designates 209.85.221.65 as permitted sender) smtp.mailfrom=philippe.mathieu.daude@gmail.com Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.zohomail.com with SMTPS id 1602496764055535.9278450401382; Mon, 12 Oct 2020 02:59:24 -0700 (PDT) Received: by mail-wr1-f65.google.com with SMTP id e17so18420470wru.12 for ; Mon, 12 Oct 2020 02:59:23 -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 d9sm21817241wmb.30.2020.10.12.02.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Oct 2020 02:59:21 -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=MXkPVd2aO8qnDLNyGp6W47ZEx+VHl+jUfpvG7Jg6mWc=; b=kWG8uj5CVJq0UUdFxBkQSCdGju9p13Sxx19mrHzoOQJNS/GooO239Br20eNNf1CPPW ERlFPx/nW0p4HnfvpGOLybQyxVF6K7+K6t75rH+MbB/50a7BoxZxt8YTbSKuhLli+fFz DTl8/hTb3NfcXb3mr/pTncOZ+sX5t3rvuj+RunfEFRm3AU7Jam7y9Kb0klhx7VTrXcVn bGMi3ghQYaLpewUr1+e8AXJJvq559xJ+b0hNSQMmLYU362pqsAYPJcouWkoJ2J03R8kO Wu7zyXvKVK5vnU09YSoT253TERCuJlwpFX6Jn3umDWB5W5QBl4dWkwjWpLGjlthzT+X/ xgfg== 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=MXkPVd2aO8qnDLNyGp6W47ZEx+VHl+jUfpvG7Jg6mWc=; b=bkLzEqY4YJ+c/ITHarn8vY5AjJd9M9LkAirgBLT8vjJ6jNN1avyRVojw62T9j0LWr7 mkPmnrVr4eo5Qkdqw2U8v1wUGMXJPG4JdhXw+GSQZzJ9jexMZ/G+ZDQKxK1CgrK3lgG1 9MK054UAVczAwfwAicwIEhPQYgQtpeTCbozYUVqoTE9M4A5ynqfUPKkJFBYlPfpwpfuO xSQCaj0gmszGIfxo2On00eptkbohOPmI+FC5W/0bUHBsYZOeMCAdEVxLQJVHih0+iAva LS4b6EDEb2vwxz6+hBSVwoSIMu07OIjLje6KReojS45WG4O/ARZxl/HfwGcGCkt47jRI ZAfQ== X-Gm-Message-State: AOAM5319xmnYSiT93Prdl79hL4TozLYwl9TUy3tPdayaYxO3ttS7ibT+ OkUpKud6TbWbAWdI7n4gjSk= X-Google-Smtp-Source: ABdhPJzXbfmfiiXt1SFn+K4dFVRj8kz2coFcKsyvelzPQV1ftK+7oHw9TdfMlEUAFZgr1CPcoRgBrg== X-Received: by 2002:a05:6000:104c:: with SMTP id c12mr27933386wrx.133.1602496761825; Mon, 12 Oct 2020 02:59:21 -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?= , Paolo Bonzini , Luc Michel , Eduardo Habkost , Aleksandar Rikalo , Huacai Chen , Paul Burton , Huacai Chen , Aurelien Jarno , Damien Hedde , Richard Henderson , Jiaxun Yang , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Subject: [PATCH v4 15/21] hw/mips/mipssim: Correct CPU frequency Date: Mon, 12 Oct 2020 11:57:58 +0200 Message-Id: <20201012095804.3335117-16-f4bug@amsat.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201012095804.3335117-1-f4bug@amsat.org> References: <20201012095804.3335117-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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index 5d4ad74828d..f0042f7f436 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -29,6 +29,7 @@ #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" +#include "hw/clock.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/char/serial.h" @@ -150,13 +151,21 @@ mips_mipssim_init(MachineState *machine) MemoryRegion *address_space_mem =3D get_system_memory(); MemoryRegion *isa =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); + Clock *cpuclk; MIPSCPU *cpu; CPUMIPSState *env; ResetData *reset_info; int bios_size; =20 + 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 + /* Init CPUs. */ - cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); + cpu =3D mips_cpu_create_with_clock(machine->cpu_type, cpuclk); env =3D &cpu->env; =20 reset_info =3D g_malloc0(sizeof(ResetData)); --=20 2.26.2