From nobody Tue Oct 28 01:57:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1522969458574192.1419716932154; Thu, 5 Apr 2018 16:04:18 -0700 (PDT) Received: from localhost ([::1]:33246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4DvU-0006Fn-Pf for importer@patchew.org; Thu, 05 Apr 2018 19:04:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4DuQ-0005fa-5D for qemu-devel@nongnu.org; Thu, 05 Apr 2018 19:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4DuN-0006Az-2J for qemu-devel@nongnu.org; Thu, 05 Apr 2018 19:03:10 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:24940) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f4DuM-00064A-Qd; Thu, 05 Apr 2018 19:03:06 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 82E3F7456D7; Fri, 6 Apr 2018 01:02:58 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 680CB7456D6; Fri, 6 Apr 2018 01:02:58 +0200 (CEST) From: BALATON Zoltan Date: Fri, 6 Apr 2018 00:42:48 +0200 To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Message-Id: <20180405230258.680CB7456D6@zero.eik.bme.hu> X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 Subject: [Qemu-devel] [PATCH for-2.12] sam460ex: Fix timer frequency and clock multipliers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Graf , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We only emulate timer running at CPU frequency which is what most guests expect so set the frequency to match real hardware. This also allows setting clock multipliers which caused slowdown previously due to wrong timer frequency. Signed-off-by: BALATON Zoltan --- hw/ppc/ppc440_uc.c | 3 +-- hw/ppc/sam460ex.c | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c index 976ab2b..e312fdb 100644 --- a/hw/ppc/ppc440_uc.c +++ b/hw/ppc/ppc440_uc.c @@ -392,8 +392,7 @@ static uint32_t dcr_read_sdr(void *opaque, int dcrn) case SDR0_CFGDATA: switch (sdr->addr) { case SDR0_STRP0: - /* FIXME: Is this correct? This breaks timing in U-Boot */ - ret =3D 0; /*(0xb5 << 8) | (1 << 4) | 9 */ + ret =3D (0xb5 << 8) | (1 << 4) | 9; break; case SDR0_STRP1: ret =3D (5 << 29) | (2 << 26) | (1 << 24); diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 70b8e76..dfff262 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -67,6 +67,7 @@ IRQ12 =3D SM502_INT */ =20 +#define CPU_FREQ 1150000000 #define SDRAM_NR_BANKS 4 =20 /* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */ @@ -253,8 +254,8 @@ static int sam460ex_load_device_tree(hwaddr addr, char *filename; int fdt_size; void *fdt; - uint32_t tb_freq =3D 50000000; - uint32_t clock_freq =3D 50000000; + uint32_t tb_freq =3D CPU_FREQ; + uint32_t clock_freq =3D CPU_FREQ; =20 filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FI= LE); if (!filename) { @@ -416,7 +417,7 @@ static void sam460ex_init(MachineState *machine) boot_info =3D g_malloc0(sizeof(*boot_info)); env->load_info =3D boot_info; =20 - ppc_booke_timers_init(cpu, 50000000, 0); + ppc_booke_timers_init(cpu, CPU_FREQ, 0); ppc_dcr_init(env, NULL, NULL); =20 /* PLB arbitrer */ --=20 2.7.6