From nobody Fri Nov 7 11:21:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 154819627582653.56819612714071; Tue, 22 Jan 2019 14:31:15 -0800 (PST) Received: from localhost ([127.0.0.1]:51587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm4Ze-00063e-Sw for importer@patchew.org; Tue, 22 Jan 2019 17:31:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm4W7-000313-D2 for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:27:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm4II-0006iT-1T for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:13:18 -0500 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:41791) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gm4IH-0006hs-Qw for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:13:17 -0500 Received: by mail-lf1-x141.google.com with SMTP id c16so85836lfj.8 for ; Tue, 22 Jan 2019 14:13:17 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id i13-v6sm184404ljg.82.2019.01.22.14.13.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 14:13:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wL56fAox7icrdi83CNQLZNN8qExDm9YrJmEUoAEyltY=; b=KsRfzCj5smGwaQ/Pni9Nro9p5lTNd8fmyEbWL4wGzqnL2dIo+40y7A+cqu2AgZNJbh Z/gQNyRNCe9vN14FZXqzT825gqsSgAU/1HOiq5sS+Cs3TudEfVI99Q/va95fHYL3IolL 0hhWni22/N7doPFy8OZG1a3MUzhxpQJtp1gEKHrC2nx+4aEbCMa2Im86unoJgTaO9qq2 3kpaJqmH1CPpWucsAhw1V60UDtupP7pv1jtUqX+I2pUnj4FJu6mcts0AsiqBB3JM/uaA 8n9A6KGEaaCDd0+DJYcPsh2QNmSQ1fClndlDr5Ij3uy+CJMeKNSE9MTg1OiEVYrKxnjt Hndg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wL56fAox7icrdi83CNQLZNN8qExDm9YrJmEUoAEyltY=; b=nPoiIhvYjpA4vhnicvCYSZ5sI+GyufwFMizvj8Yp+mlgwYPPSBD9OPSb0Co0WMzOSg Vnlg+/EgAG1O/PQLmPA7FnKSMvFdLF91eeoUUAbvKeBv0JUgJGXnE1oWW+L9Ym71vzHw 71EI9YwqikjzGG3NUPLWU4dSp+VMO1ovuvLlQLVB8pgcFYebtqusSPxgs7na6+rdIJvq HtbGJFb59dq0eXUaZDCeFWziQVZ8XeL0V5789QQbg/BNF6+PIoWEPQ/cnUb4I3tL+/bM hl7VKNiHTXspBMWOjKshrg+1DVU0WPAd13AgbaU7e1OpWSoz7j4XkxEzuZYNg1hMlQB3 JOKg== X-Gm-Message-State: AJcUukcVZ2kEJDxi+kbCM91QEfC4zgZep5nvTpGBHe26VNWsrnUL44KZ Sk9UqWvLQL21vmrTVaFmnsJBVFoBRFM= X-Google-Smtp-Source: ALg8bN5tmLZNlSqdtHMZJWI9QBJ10Itp2nxJXMGiav7h/YrKf2mXSb4bBZfFV0qQXb8Jw6/pE/IHIA== X-Received: by 2002:a19:a86:: with SMTP id 128mr21303775lfk.139.1548195195950; Tue, 22 Jan 2019 14:13:15 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2019 14:12:55 -0800 Message-Id: <20190122221256.20883-2-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190122221256.20883-1-jcmvbkbc@gmail.com> References: <20190122221256.20883-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::141 Subject: [Qemu-devel] [PATCH 1/2] hw/xtensa: xtfpga: fix bootloader placement in SMP 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: Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use BSP reset PC as a place for the mini-bootloader because in SMP configurations APs and BSP may have different boot addresses. This fixes SMP linux uImage boot on xtfpga boards. Signed-off-by: Max Filippov --- hw/xtensa/xtfpga.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 21094319a659..d3afdfc247a7 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -234,10 +234,15 @@ static void xtfpga_init(const XtfpgaBoardDesc *board,= MachineState *machine) int n; =20 for (n =3D 0; n < smp_cpus; n++) { + CPUXtensaState *cenv =3D NULL; + cpu =3D XTENSA_CPU(cpu_create(machine->cpu_type)); - env =3D &cpu->env; + cenv =3D &cpu->env; + if (!env) { + env =3D cenv; + } =20 - env->sregs[PRID] =3D n; + cenv->sregs[PRID] =3D n; qemu_register_reset(xtfpga_reset, cpu); /* Need MMU initialized prior to ELF loading, * so that ELF gets loaded into virtual addresses --=20 2.11.0 From nobody Fri Nov 7 11:21:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548196173543472.5553337045277; Tue, 22 Jan 2019 14:29:33 -0800 (PST) Received: from localhost ([127.0.0.1]:51516 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm4Y0-0004jm-IH for importer@patchew.org; Tue, 22 Jan 2019 17:29:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46814) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gm4W5-0003Cu-Du for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:27:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gm4IK-0006jk-GM for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:13:21 -0500 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:42114) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gm4IK-0006j0-8u for qemu-devel@nongnu.org; Tue, 22 Jan 2019 17:13:20 -0500 Received: by mail-lj1-x244.google.com with SMTP id l15-v6so99574lja.9 for ; Tue, 22 Jan 2019 14:13:20 -0800 (PST) Received: from octofox.cadence.com (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id i13-v6sm184404ljg.82.2019.01.22.14.13.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Jan 2019 14:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fKGAMLiGYpzYbr0rT9/NDrMmuQDLMVW75r0dxP9+VxQ=; b=TrCiZkYklJ9UeQlndWaOyI6xlcPQuVaro0NACxndA5iTrKSEfiszN2e6c42gFdcXrN /Te77pM/xQlO0uEjzKllMmmZRbJ8P5Ep7cN46P7FbftMqfyw+fLaoXakY1X30iODvqvB fwtOBDQZcc8scmmQtwDC8zd8wA4LbPaKowXIziZEqAieY/29okXwzqvNyBUZKRAuh48w f1D5c8AUqkdloit2FkGHgE3xNT39jtWOzlJx6iMcLneBREtRMOlWYRapNEMVuPn5o8FF z7c7CjmYbi6POxUiXvgGGsXV26ch3NWAbDFFGhykU4Q7x2QIj7glm6bQf7vBcnbyZkMW 0MbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fKGAMLiGYpzYbr0rT9/NDrMmuQDLMVW75r0dxP9+VxQ=; b=cKgCDMh/r4sJuY3PNibzRCBGPGhrfPW0eo9fO2AW7XhF3pFc2gSHdWWiKtSfX9G9f0 T8byAU98l4jb0iVm2S+/Y+26cBXMCm4nhqgh5yzbKtNoT3k8Si6akKSRbmgyuKE8WzMI AFpsktCKAPgW/FjObxHRXeqnpnLjfeJxH77+SwxdLm0VUbLguapSN+ADnqW6FfXrF2Ub 8CCBPUpmOLNfM4NjUW0MD8fKpmqCEY8s/RdfDiO9hduAHI55HxCN5vWLNkw19PocrAsb DrtZYbmABD/tJl9B8GAPvc0rq5XQTVUdMR0sJk0cHcHcJ699BzGbRxUL6kI/qKvrYXnu f7wg== X-Gm-Message-State: AJcUukcfFQL91H9Egnswc4geiloToRWTPzabRbpKxR4qXq/xmvhuXrfw p6ZnmPoUV6zx2tKetYWP01gnNP7opqo= X-Google-Smtp-Source: ALg8bN6vWJ3+b3WtUKj5ZewlGPLRKeqLYNUPlc6Z8MDQLYSdZymn+rqebSTCXibPQSiGfVzI5xBpcg== X-Received: by 2002:a2e:b04f:: with SMTP id d15-v6mr23525710ljl.3.1548195198362; Tue, 22 Jan 2019 14:13:18 -0800 (PST) From: Max Filippov To: qemu-devel@nongnu.org Date: Tue, 22 Jan 2019 14:12:56 -0800 Message-Id: <20190122221256.20883-3-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190122221256.20883-1-jcmvbkbc@gmail.com> References: <20190122221256.20883-1-jcmvbkbc@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::244 Subject: [Qemu-devel] [PATCH 2/2] hw/xtensa: xtfpga: use core frequency 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: Max Filippov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" XTFPGA board FPGA peripheral exposes hard-coded 10MHz frequency regardless of the actual used core frequency. Expose actual core frequency instead. Signed-off-by: Max Filippov --- hw/xtensa/xtfpga.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index d3afdfc247a7..7379b3fff427 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -61,6 +61,7 @@ typedef struct XtfpgaBoardDesc { =20 typedef struct XtfpgaFpgaState { MemoryRegion iomem; + uint32_t freq; uint32_t leds; uint32_t switches; } XtfpgaFpgaState; @@ -83,7 +84,7 @@ static uint64_t xtfpga_fpga_read(void *opaque, hwaddr add= r, return 0x09272011; =20 case 0x4: /*processor clock frequency, Hz*/ - return 10000000; + return s->freq; =20 case 0x8: /*LEDs (off =3D 0, on =3D 1)*/ return s->leds; @@ -119,13 +120,14 @@ static const MemoryRegionOps xtfpga_fpga_ops =3D { }; =20 static XtfpgaFpgaState *xtfpga_fpga_init(MemoryRegion *address_space, - hwaddr base) + hwaddr base, uint32_t freq) { XtfpgaFpgaState *s =3D g_malloc(sizeof(XtfpgaFpgaState)); =20 memory_region_init_io(&s->iomem, NULL, &xtfpga_fpga_ops, s, - "xtfpga.fpga", 0x10000); + "xtfpga.fpga", 0x10000); memory_region_add_subregion(address_space, base, &s->iomem); + s->freq =3D freq; xtfpga_fpga_reset(s); qemu_register_reset(xtfpga_fpga_reset, s); return s; @@ -231,6 +233,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, M= achineState *machine) const char *dtb_filename =3D qemu_opt_get(machine_opts, "dtb"); const char *initrd_filename =3D qemu_opt_get(machine_opts, "initrd"); const unsigned system_io_size =3D 224 * MiB; + uint32_t freq =3D 10000000; int n; =20 for (n =3D 0; n < smp_cpus; n++) { @@ -240,6 +243,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, M= achineState *machine) cenv =3D &cpu->env; if (!env) { env =3D cenv; + freq =3D env->config->clock_freq_khz * 1000; } =20 cenv->sregs[PRID] =3D n; @@ -277,7 +281,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, M= achineState *machine) system_io, 0, system_io_size); memory_region_add_subregion(system_memory, board->io[1], io); } - xtfpga_fpga_init(system_io, 0x0d020000); + xtfpga_fpga_init(system_io, 0x0d020000, freq); if (nd_table[0].used) { xtfpga_net_init(system_io, 0x0d030000, 0x0d030400, 0x0d800000, xtensa_get_extint(env, 1), nd_table); --=20 2.11.0