From patchwork Fri Aug 23 05:10:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39D071398 for ; Fri, 23 Aug 2019 05:13:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B1E72070B for ; Fri, 23 Aug 2019 05:13:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cIIFNtmx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B1E72070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11t2-0005lQ-SH for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:13:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44630) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11r5-0003s7-OS for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r4-0002Pl-KJ for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:19 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:46844) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r4-0002PB-Ed; Fri, 23 Aug 2019 01:11:18 -0400 Received: by mail-pl1-x642.google.com with SMTP id c2so4867319plz.13; Thu, 22 Aug 2019 22:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=ScosbL6WOgM2JqzuxNcyXxC+2qJVUV9pi7WY9VT5Dko=; b=cIIFNtmxpm+m5VMtNyCV3/15qVjeMZPi+A/aE2zMq2GFCRibPogiEN/o9bNwmYmj2k SecpNawvh9Idsuva9MLW2WHteXWXz5F2ITMnkvKJFhPveYNfj9qrT4vwn5TffAD/5N7F OwMuYSW3pQ4fakKcZ2uSLdA3PHjLQjdSPUrzCMWdNp37JPykmaYnAcvpMF28dMRtNWd4 UTdbBViZRXPPCV7UUZOXRjKYkMmMri4DhimYhTuF8E/fjllES7pUiIgfSkza9H9NCeZk UfZaw/GVlKAGNhrlNIBGFnqBcbE3HVcxpU2EKI4E0BLCckOybUS3vFm1kyzxYXXkQ4fr 0XDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ScosbL6WOgM2JqzuxNcyXxC+2qJVUV9pi7WY9VT5Dko=; b=SBWD7+ZUEI18ZaC7vT6UAWiAFT9V+uWJYKWDSIuYOCeqJO9vTHmylJyWtruLqqyLko YFErG/mrORVsnecStlAcES36uCYGOcZvQ2z1Vc+8DC3hWNTLJcvn5+LMD66bC6cplrrd 0Tf1biNxCa6NrHaH0l9ilE/6srx8GgIZxzmcgkI6FvVOFA/T1GRlouPk7lm7KLrvWgCb QZbJHPFRDH3CsvSf6OyL+KCxkKpoLx1lvSPl86ww7DtWOCljF0zPK+aFggSrASt9I+hG 34Wvvpw5xFZVkEa/g/JWFdyYkFiN+Ut37bfbSZ36igIy/4qjXReGRdM/H0Wau5IGGoCX ZshA== X-Gm-Message-State: APjAAAV7xxYzmDpshxli8Lwx7EymQ92MCsJSdsAoxrPdSFlvFPYzk6LM NaxkXLfi8OM11G2F4J3xBrM= X-Google-Smtp-Source: APXvYqxuscubmoASFlR8YOAZzKyWjBrSYEu/+1VF/6UfANg8DnpRWBCPgtxRn/unbCwJHVxJb2pJow== X-Received: by 2002:a17:902:449:: with SMTP id 67mr2698142ple.105.1566537077302; Thu, 22 Aug 2019 22:11:17 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.16 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:16 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:40 -0700 Message-Id: <1566537069-22741-2-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v5 01/30] riscv: hw: Remove superfluous "linux, phandle" property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" "linux,phandle" property is optional. Remove all instances in the sifive_u, virt and spike machine device trees. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - remove 2 more "linux,phandle" instances in sifive_u.c and spike.c after rebasing on Palmer's QEMU RISC-V tree Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 4 ---- hw/riscv/spike.c | 1 - hw/riscv/virt.c | 3 --- 3 files changed, 8 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 64e233d..afe304f 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -126,7 +126,6 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, nodename, "device_type", "cpu"); qemu_fdt_add_subnode(fdt, intc); qemu_fdt_setprop_cell(fdt, intc, "phandle", cpu_phandle); - qemu_fdt_setprop_cell(fdt, intc, "linux,phandle", cpu_phandle); qemu_fdt_setprop_string(fdt, intc, "compatible", "riscv,cpu-intc"); qemu_fdt_setprop(fdt, intc, "interrupt-controller", NULL, 0); qemu_fdt_setprop_cell(fdt, intc, "#interrupt-cells", 1); @@ -185,7 +184,6 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", 0x35); qemu_fdt_setprop_cells(fdt, nodename, "phandle", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "linux,phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(cells); g_free(nodename); @@ -198,7 +196,6 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", SIFIVE_U_GEM_CLOCK_FREQ); qemu_fdt_setprop_cell(fdt, nodename, "phandle", ethclk_phandle); - qemu_fdt_setprop_cell(fdt, nodename, "linux,phandle", ethclk_phandle); ethclk_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(nodename); @@ -234,7 +231,6 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", 3686400); qemu_fdt_setprop_cell(fdt, nodename, "phandle", uartclk_phandle); - qemu_fdt_setprop_cell(fdt, nodename, "linux,phandle", uartclk_phandle); uartclk_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(nodename); diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 2991b34..14acaef 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -112,7 +112,6 @@ static void create_fdt(SpikeState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, nodename, "device_type", "cpu"); qemu_fdt_add_subnode(fdt, intc); qemu_fdt_setprop_cell(fdt, intc, "phandle", 1); - qemu_fdt_setprop_cell(fdt, intc, "linux,phandle", 1); qemu_fdt_setprop_string(fdt, intc, "compatible", "riscv,cpu-intc"); qemu_fdt_setprop(fdt, intc, "interrupt-controller", NULL, 0); qemu_fdt_setprop_cell(fdt, intc, "#interrupt-cells", 1); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 25faf3b..00be05a 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -170,11 +170,9 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "reg", cpu); qemu_fdt_setprop_string(fdt, nodename, "device_type", "cpu"); qemu_fdt_setprop_cell(fdt, nodename, "phandle", cpu_phandle); - qemu_fdt_setprop_cell(fdt, nodename, "linux,phandle", cpu_phandle); intc_phandle = phandle++; qemu_fdt_add_subnode(fdt, intc); qemu_fdt_setprop_cell(fdt, intc, "phandle", intc_phandle); - qemu_fdt_setprop_cell(fdt, intc, "linux,phandle", intc_phandle); qemu_fdt_setprop_string(fdt, intc, "compatible", "riscv,cpu-intc"); qemu_fdt_setprop(fdt, intc, "interrupt-controller", NULL, 0); qemu_fdt_setprop_cell(fdt, intc, "#interrupt-cells", 1); @@ -250,7 +248,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", VIRTIO_NDEV); qemu_fdt_setprop_cells(fdt, nodename, "phandle", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "linux,phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(cells); g_free(nodename); From patchwork Fri Aug 23 05:10:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 562FE1709 for ; Fri, 23 Aug 2019 05:13:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DF7A2070B for ; Fri, 23 Aug 2019 05:13:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="n3m0mkzX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DF7A2070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11t9-0005uI-MP for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:13:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44649) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11r6-0003s9-TP for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r5-0002QI-Gj for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:20 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:35558) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r5-0002Pv-Ae; Fri, 23 Aug 2019 01:11:19 -0400 Received: by mail-pl1-x642.google.com with SMTP id gn20so4880529plb.2; Thu, 22 Aug 2019 22:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Z+uJNvaih5YZepF19mpSiOvklfknBUC6Oj0NXwvSonU=; b=n3m0mkzXwzAqgqBJmKcPJf+FYzjpSoqH6xPXtlIEK2rqnVnLa12NtN+6VjDvND5Fxg m/e1PH0YEQlZM+g0Qsp3xVJBysVN8lJqEPFy6aSBgj+JERryrbGZ9yDOuda3rhN+ybhj 8yNpex4aKYHNjyD2CB4L8cPwHj0myV/ydPP5fM4OCaDqcXTTtl+2MtMx7qa0ey3ClFWy FUy5yYgFBYAsKgWDj4TeByrN1SbRXXCyQ4n51K+PCCl4293B2h3+Yi9e4xSQfSmtXP6+ lthWoUxMH+T4tjnj18ajmfuqJxG06EdvYPwsLFW6rQXU33S7/zBGpRfZ2mGhFPD0qb5K /IJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Z+uJNvaih5YZepF19mpSiOvklfknBUC6Oj0NXwvSonU=; b=eKzKw2wWMJlaUli5fAGfjpGe3OjXC7Qx+TM87p4ZOwlWaJEivtzuv+pdVks2TftOo0 wLhshRbbfuqhPjrDOdN4EkDVR7qXrZH0WnvACDqQ1pmJXaB4eGQj36V2Gmkq8iGNdKpG vlWvNvoqXnis+nIKBe5jpfUreyWIAYg6SXXYdX3L01Fmiq3BtkUnpdT78FdL40qeJhj6 5qhg6IfMu1Obm8yqysraBW5txwWI3VZda93npG+QK6fnHGUL9FXdbPkUJdLumKcRHy90 Vwt/xmYGbyhLFP2+mazSsVrvw4VFlhkPkTnJIDRkF0JLDgjWhNCFD1XQ1N4h/cByg2n3 YNLA== X-Gm-Message-State: APjAAAUFOYb9tIoWU2pZo4tNDLbgZ+m4hMNvkUkxT1Dkh3aZpBktpBxI emaqB69AbZQJMsfGZju2lW8= X-Google-Smtp-Source: APXvYqyFcYkpvwZPrsx3TAx/oq5DbnY7O/a2JWxDVbCpiaijD7D861hkJP65OB/JOLbuRAg3akxLpg== X-Received: by 2002:a17:902:ea:: with SMTP id a97mr2633484pla.182.1566537078564; Thu, 22 Aug 2019 22:11:18 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.17 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:17 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:41 -0700 Message-Id: <1566537069-22741-3-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v5 02/30] riscv: hw: Use qemu_fdt_setprop_cell() for property with only 1 cell X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Some of the properties only have 1 cell so we should use qemu_fdt_setprop_cell() instead of qemu_fdt_setprop_cells(). Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 18 +++++++++--------- hw/riscv/virt.c | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index afe304f..3f9284e 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -183,7 +183,7 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", 0x35); - qemu_fdt_setprop_cells(fdt, nodename, "phandle", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(cells); g_free(nodename); @@ -208,20 +208,20 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, 0x0, memmap[SIFIVE_U_GEM].size); qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); qemu_fdt_setprop_string(fdt, nodename, "phy-mode", "gmii"); - qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "interrupts", SIFIVE_U_GEM_IRQ); + qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_GEM_IRQ); qemu_fdt_setprop_cells(fdt, nodename, "clocks", ethclk_phandle, ethclk_phandle, ethclk_phandle); qemu_fdt_setprop(fdt, nodename, "clock-names", ethclk_names, sizeof(ethclk_names)); - qemu_fdt_setprop_cells(fdt, nodename, "#address-cells", 1); - qemu_fdt_setprop_cells(fdt, nodename, "#size-cells", 0); + qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", 1); + qemu_fdt_setprop_cell(fdt, nodename, "#size-cells", 0); g_free(nodename); nodename = g_strdup_printf("/soc/ethernet@%lx/ethernet-phy@0", (long)memmap[SIFIVE_U_GEM].base); qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0); + qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0); g_free(nodename); uartclk_phandle = phandle++; @@ -241,9 +241,9 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_UART0].base, 0x0, memmap[SIFIVE_U_UART0].size); - qemu_fdt_setprop_cells(fdt, nodename, "clocks", uartclk_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "interrupts", SIFIVE_U_UART0_IRQ); + qemu_fdt_setprop_cell(fdt, nodename, "clocks", uartclk_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_UART0_IRQ); qemu_fdt_add_subnode(fdt, "/chosen"); qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", nodename); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 00be05a..127f005 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -233,8 +233,8 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, nodename = g_strdup_printf("/soc/interrupt-controller@%lx", (long)memmap[VIRT_PLIC].base); qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_cells(fdt, nodename, "#address-cells", - FDT_PLIC_ADDR_CELLS); + qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", + FDT_PLIC_ADDR_CELLS); qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells", FDT_PLIC_INT_CELLS); qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,plic0"); @@ -247,7 +247,7 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", VIRTIO_NDEV); - qemu_fdt_setprop_cells(fdt, nodename, "phandle", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(cells); g_free(nodename); @@ -260,19 +260,19 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[VIRT_VIRTIO].base + i * memmap[VIRT_VIRTIO].size, 0x0, memmap[VIRT_VIRTIO].size); - qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "interrupts", VIRTIO_IRQ + i); + qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "interrupts", VIRTIO_IRQ + i); g_free(nodename); } nodename = g_strdup_printf("/soc/pci@%lx", (long) memmap[VIRT_PCIE_ECAM].base); qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_cells(fdt, nodename, "#address-cells", - FDT_PCI_ADDR_CELLS); - qemu_fdt_setprop_cells(fdt, nodename, "#interrupt-cells", - FDT_PCI_INT_CELLS); - qemu_fdt_setprop_cells(fdt, nodename, "#size-cells", 0x2); + qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", + FDT_PCI_ADDR_CELLS); + qemu_fdt_setprop_cell(fdt, nodename, "#interrupt-cells", + FDT_PCI_INT_CELLS); + qemu_fdt_setprop_cell(fdt, nodename, "#size-cells", 0x2); qemu_fdt_setprop_string(fdt, nodename, "compatible", "pci-host-ecam-generic"); qemu_fdt_setprop_string(fdt, nodename, "device_type", "pci"); @@ -309,8 +309,8 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, 0x0, memmap[VIRT_UART0].base, 0x0, memmap[VIRT_UART0].size); qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", 3686400); - qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", plic_phandle); - qemu_fdt_setprop_cells(fdt, nodename, "interrupts", UART0_IRQ); + qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "interrupts", UART0_IRQ); qemu_fdt_add_subnode(fdt, "/chosen"); qemu_fdt_setprop_string(fdt, "/chosen", "stdout-path", nodename); From patchwork Fri Aug 23 05:10:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B16A01398 for ; Fri, 23 Aug 2019 05:13:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 88B782070B for ; Fri, 23 Aug 2019 05:13:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GyvTURXa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 88B782070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11t7-0005rQ-MG for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:13:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44660) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11r7-0003sL-N2 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r6-0002R3-GR for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:21 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41446) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r6-0002QX-BT; Fri, 23 Aug 2019 01:11:20 -0400 Received: by mail-pl1-x641.google.com with SMTP id m9so4865514pls.8; Thu, 22 Aug 2019 22:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=D4R62s35/N61PuinDIXSNWQiXuObEmra2vxp3pv/2AE=; b=GyvTURXas2xwWnb7v90OKiA1w4rgPCN7vgI32s4+AQK2UXWUjSHj7BiO7EPJl0yFWI a4NghReG9PeS0e6b09CELK5UaolTK/derJAlyjxyOhsIOd72EvUti5YIrVC7+mOIca03 fGkHDapvOk8ZVtGk1HfdYLOYVxxj7DuRWLhmnq7jo+fwBXATbQNgheloG5G8ByJx3f+f HfSK2L5BjyP/Ehopz+7fQGAqR+9NIbY54pBdR74B8rn58CSQ4Kh2oa6yrk85COtWpXWI dIv5UEmeisBMhRMnN+7GKR5ga6ot3S/KEuysJCJywhjLK1wJ3Wr+4KHdrv1dxbo5w6/j ERQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=D4R62s35/N61PuinDIXSNWQiXuObEmra2vxp3pv/2AE=; b=BINQvmCGFEmFYZ3coJdKSifz38M2nGnzVCXEw+CUO9cGiQAsY/3BUNMS73yVbACv7/ nSFITD+sm8tc5AHB8B+bqHMkfykIdA30i+B0Cg3jHcz0O6InGKGeYY+agjmR7UeIg7Zf gdipeojEaP3e9CrT6Pe7W6k5848Pz3AmKbRnfw91mtEL/8v5I27GF2xpe5oEEbE3yQ6n DG1tNjw0sCCEp4niL2AwyiYGJ2i+DBu7E85JdcVW9XvaTSPKq7PLcJrtQ9xSQNsJyuoJ vFbKyppwOjEIkEt9EYv58atgXp77vVqnW9fbxJxszM4esIgrSTvcuc3kBzSzIvKWM/SW ORWQ== X-Gm-Message-State: APjAAAWxTQKR3NrC7P3Lx4lS+0K5YQvN4+qUHbuxRnNvMc7UY8AdzwZg Hy/nNNJ4L22O/xua3JJW+D8= X-Google-Smtp-Source: APXvYqxMdn483gUBdvSYXUHdPsrPumXeVfiNVGhANdWtUdd6pdNcLAYjOCH/4hkoQuOvslfuoCJxuQ== X-Received: by 2002:a17:902:f30f:: with SMTP id gb15mr2646104plb.233.1566537079599; Thu, 22 Aug 2019 22:11:19 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.18 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:19 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:42 -0700 Message-Id: <1566537069-22741-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 03/30] riscv: hw: Remove not needed PLIC properties in device tree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This removes "reg-names" and "riscv,max-priority" properties of the PLIC node from device tree. Signed-off-by: Bin Meng Reviewed-by: Jonathan Behrens Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - keep the PLIC compatible string unchanged as OpenSBI uses that for DT fix up hw/riscv/sifive_u.c | 2 -- hw/riscv/virt.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 3f9284e..5fe0033 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -180,8 +180,6 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_PLIC].base, 0x0, memmap[SIFIVE_U_PLIC].size); - qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); - qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", 0x35); qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 127f005..2f75195 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -244,8 +244,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[VIRT_PLIC].base, 0x0, memmap[VIRT_PLIC].size); - qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); - qemu_fdt_setprop_cell(fdt, nodename, "riscv,max-priority", 7); qemu_fdt_setprop_cell(fdt, nodename, "riscv,ndev", VIRTIO_NDEV); qemu_fdt_setprop_cell(fdt, nodename, "phandle", plic_phandle); plic_phandle = qemu_fdt_get_phandle(fdt, nodename); From patchwork Fri Aug 23 05:10:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110571 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 336DA14DB for ; Fri, 23 Aug 2019 05:18:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A056206BA for ; Fri, 23 Aug 2019 05:18:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="sJWRh/qL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A056206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11xt-00036i-0x for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:18:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44687) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11r9-0003tD-2n for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r7-0002S5-QE for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:22 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:38646) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r7-0002RX-Ke; Fri, 23 Aug 2019 01:11:21 -0400 Received: by mail-pf1-x443.google.com with SMTP id o70so5655002pfg.5; Thu, 22 Aug 2019 22:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=B1KQDewiIqWoczh5/bBYafCJNsskXVqW6qCHzgZ2uY4=; b=sJWRh/qLj+jGjoUMTLj0dLI86/YMMrG9qceJQxeb8wzS8CfZLXCMbms/fscK+fktar gZHLluZ1/07jZp69GF84HBbj4ID+VTjICirpfF3JqWrBhQijSQNpRuUQpVVLbfBDYP5S 6NtmxgdcRKx3RvREJllOSob2geRX1M4ylnLmgZJwhvrtEyeVWjXk4y7RB3nV1EGD1Wd3 o78a3xw6+djLMjWJwOboLzikyFVqdLEn+x7SDx8pCt86EhNSF7zlPn40OPKwo9NuUAgA sVz03VITBcphzY74cX5xe/EOoSBWa0fe/5XjrmfSH6wxMzzBeW4ljenMKSQee+vg159u J7nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=B1KQDewiIqWoczh5/bBYafCJNsskXVqW6qCHzgZ2uY4=; b=c9BegO7WBlBWScygFcLbNyzOzO+Tp1L3vcpq91p1inM+unxb0AALIZNyJheYIzFdGE U0jSkl9uwnrRha/Z8yBaaGvmZ4lD+ncK5FY7nV8K9yV++IUTP223+qg8cNfsmNww1vXV LInZqRm2qRYr5lVHhVt3QYQ3hZ98gcNX7C6iNwXWDwh2qiyxxUusPSU7xyDtBbxe4SaJ t4H0EWGcpZ3z4M/buga6Jh5NySm6GZrKGd3/7ZqC5RVEjisDbe3ohDCwFxZqohTXPAnP Ir14dcaiesZkXiGga9yK2M1MqDwjf6vWMdkBVxz9K/nWLj/81RmXfE60VXmgREsz1UYE 2raw== X-Gm-Message-State: APjAAAWpe9QmX+B35Nb5QmSwqJV3+VCaYpIimygitVwhRdiz0zJJtPtA r4K9xgtEgoSZJYrUIJnhcSo= X-Google-Smtp-Source: APXvYqzHrTR+ERKwRSpZWpV0pmdvSqAzJVzXmZfyWXP0EZH296uZTkPFdNJ86b2+3Yw0EWu6wQUVqQ== X-Received: by 2002:a65:5144:: with SMTP id g4mr2360809pgq.202.1566537080740; Thu, 22 Aug 2019 22:11:20 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.19 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:20 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:43 -0700 Message-Id: <1566537069-22741-5-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v5 04/30] riscv: hw: Change create_fdt() to return void X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" There is no need to return fdt at the end of create_fdt() because it's already saved in s->fdt. Signed-off-by: Bin Meng Reviewed-by: Chih-Min Chao Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - change create_fdt() to return void in sifive_u.c too, after rebasing on Palmer's QEMU RISC-V tree Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 11 ++++------- hw/riscv/virt.c | 11 ++++------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 5fe0033..e22803b 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -67,7 +67,7 @@ static const struct MemmapEntry { #define GEM_REVISION 0x10070109 -static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, +static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint64_t mem_size, const char *cmdline) { void *fdt; @@ -253,14 +253,11 @@ static void *create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/aliases", "serial0", nodename); g_free(nodename); - - return fdt; } static void riscv_sifive_u_init(MachineState *machine) { const struct MemmapEntry *memmap = sifive_u_memmap; - void *fdt; SiFiveUState *s = g_new0(SiFiveUState, 1); MemoryRegion *system_memory = get_system_memory(); @@ -281,7 +278,7 @@ static void riscv_sifive_u_init(MachineState *machine) main_mem); /* create device tree */ - fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); + create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); riscv_find_and_load_firmware(machine, BIOS_FILENAME, memmap[SIFIVE_U_DRAM].base); @@ -294,9 +291,9 @@ static void riscv_sifive_u_init(MachineState *machine) hwaddr end = riscv_load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(fdt, "/chosen", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-start", start); - qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", end); } } diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index 2f75195..6bfa721 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -112,7 +112,7 @@ static void create_pcie_irq_map(void *fdt, char *nodename, 0x1800, 0, 0, 0x7); } -static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, +static void create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, uint64_t mem_size, const char *cmdline) { void *fdt; @@ -316,8 +316,6 @@ static void *create_fdt(RISCVVirtState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", cmdline); } g_free(nodename); - - return fdt; } @@ -373,7 +371,6 @@ static void riscv_virt_board_init(MachineState *machine) size_t plic_hart_config_len; int i; unsigned int smp_cpus = machine->smp.cpus; - void *fdt; /* Initialize SOC */ object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc), @@ -392,7 +389,7 @@ static void riscv_virt_board_init(MachineState *machine) main_mem); /* create device tree */ - fdt = create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); + create_fdt(s, memmap, machine->ram_size, machine->kernel_cmdline); /* boot rom */ memory_region_init_rom(mask_rom, NULL, "riscv_virt_board.mrom", @@ -411,9 +408,9 @@ static void riscv_virt_board_init(MachineState *machine) hwaddr end = riscv_load_initrd(machine->initrd_filename, machine->ram_size, kernel_entry, &start); - qemu_fdt_setprop_cell(fdt, "/chosen", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-start", start); - qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", + qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end", end); } } From patchwork Fri Aug 23 05:10:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110573 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3B37114DB for ; Fri, 23 Aug 2019 05:22:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 124CA22CEC for ; Fri, 23 Aug 2019 05:22:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kx+BhJyp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 124CA22CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i122I-0007Sl-1p for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:22:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44715) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rA-0003uT-3D for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11r8-0002Sx-RH for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:23 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:40562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r8-0002SO-Lu; Fri, 23 Aug 2019 01:11:22 -0400 Received: by mail-pf1-x443.google.com with SMTP id w16so5647341pfn.7; Thu, 22 Aug 2019 22:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=+zzCHFZurXByfcVb0kzc2teMVzNfQuoZt/YP0jsSzy0=; b=Kx+BhJyp9dHE67BtPkaj1yMFQm2QNhsJg9tc1ORiTuCD50c4YAWyjecojOTGqp8BPm /jQ1UceGMRE6snV+rylAnlRebO1XKCy1uAfOk21W/0uhdBWlnsgjMuMlm0DMrTmk7UfS 8Ak7VLTrk2tBIZgjFYotznM60yertKpoMNZvUvULgoUDFiab/xvsPxE04xYnd5Jtnnl6 bh7InmYFVfg1vWlDFO4KPQuWxY05SZudH0PMDTTT8sU26NNb5NMHrh+1MmpoFgaS8Z+7 f50ZJ6HvcjJN+L+PrjFJICYGiYvJ+xW3k7PEsPRlNfsfEFCwTE5zcP5qqY/dJ5VsSvJu VKxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+zzCHFZurXByfcVb0kzc2teMVzNfQuoZt/YP0jsSzy0=; b=gwF5+aTbHDjHzEQA/DHoaygXmVbtfNmRmEd0ql+1zBXQu0BpMLoUXlxv9BlesFhLSx N/2yGRmda7Lsj0vRF76SsHmHYD5y8azDrxNIcLjO+TtDB8xaBao+CjatPU35CYA2Ceq4 99nkBhL5fYWq2SfHXiYALX6AaTRrlhp/FtHBBb/eXPUnCdhr9iFVb6otKCEDG4SpCnu1 M5e9Ns5kwG2fq7UG9qE4I7Fu0aMWLP8CkojUvFlgcUKHO7Kls9Ktfx6zsDF+qkmmq1e/ xVHMqqsPdc9/5KVyTmN/P78JPLjt4NC2yQaMysNl4wmR1eFY4hKDKio+dpTHINoUAXJ+ d/SA== X-Gm-Message-State: APjAAAV3/0/ejMZgJ4TcI9+pjz9eEnJ/Sq8acss3hCMzmKGY4AZ/gk3Z QRirnPgbXM7JqPwoDxj6SXE= X-Google-Smtp-Source: APXvYqwGA4rFUgzydq6BYm2YvpxbDQLyt/PulgO9b6WyiN/OdxS0JXOAYxfD/rhWi5nZrM/HrTUDbg== X-Received: by 2002:a17:90a:9f46:: with SMTP id q6mr3223822pjv.110.1566537081918; Thu, 22 Aug 2019 22:11:21 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.20 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:21 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:44 -0700 Message-Id: <1566537069-22741-6-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v5 05/30] riscv: hw: Change to use qemu_log_mask(LOG_GUEST_ERROR, ...) instead X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Replace the call to hw_error() with qemu_log_mask(LOG_GUEST_ERROR,...) in various sifive models. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: - new patch to change to use qemu_log_mask(LOG_GUEST_ERROR,...) instead in various sifive models Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_prci.c | 8 +++++--- hw/riscv/sifive_test.c | 5 +++-- hw/riscv/sifive_uart.c | 9 +++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/riscv/sifive_prci.c b/hw/riscv/sifive_prci.c index f406682..1ab98d4 100644 --- a/hw/riscv/sifive_prci.c +++ b/hw/riscv/sifive_prci.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" +#include "qemu/log.h" #include "qemu/module.h" #include "target/riscv/cpu.h" #include "hw/riscv/sifive_prci.h" @@ -37,7 +38,8 @@ static uint64_t sifive_prci_read(void *opaque, hwaddr addr, unsigned int size) case SIFIVE_PRCI_PLLOUTDIV: return s->plloutdiv; } - hw_error("%s: read: addr=0x%x\n", __func__, (int)addr); + qemu_log_mask(LOG_GUEST_ERROR, "%s: read: addr=0x%x\n", + __func__, (int)addr); return 0; } @@ -65,8 +67,8 @@ static void sifive_prci_write(void *opaque, hwaddr addr, s->plloutdiv = (uint32_t) val64; break; default: - hw_error("%s: bad write: addr=0x%x v=0x%x\n", - __func__, (int)addr, (int)val64); + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad write: addr=0x%x v=0x%x\n", + __func__, (int)addr, (int)val64); } } diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c index cd86831..655a3d7 100644 --- a/hw/riscv/sifive_test.c +++ b/hw/riscv/sifive_test.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "hw/sysbus.h" +#include "qemu/log.h" #include "qemu/module.h" #include "sysemu/sysemu.h" #include "target/riscv/cpu.h" @@ -48,8 +49,8 @@ static void sifive_test_write(void *opaque, hwaddr addr, break; } } - hw_error("%s: write: addr=0x%x val=0x%016" PRIx64 "\n", - __func__, (int)addr, val64); + qemu_log_mask(LOG_GUEST_ERROR, "%s: write: addr=0x%x val=0x%016" PRIx64 "\n", + __func__, (int)addr, val64); } static const MemoryRegionOps sifive_test_ops = { diff --git a/hw/riscv/sifive_uart.c b/hw/riscv/sifive_uart.c index 3b3f94f..cd74043 100644 --- a/hw/riscv/sifive_uart.c +++ b/hw/riscv/sifive_uart.c @@ -18,6 +18,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/log.h" #include "hw/sysbus.h" #include "chardev/char.h" #include "chardev/char-fe.h" @@ -93,8 +94,8 @@ uart_read(void *opaque, hwaddr addr, unsigned int size) return s->div; } - hw_error("%s: bad read: addr=0x%x\n", - __func__, (int)addr); + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad read: addr=0x%x\n", + __func__, (int)addr); return 0; } @@ -125,8 +126,8 @@ uart_write(void *opaque, hwaddr addr, s->div = val64; return; } - hw_error("%s: bad write: addr=0x%x v=0x%x\n", - __func__, (int)addr, (int)value); + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad write: addr=0x%x v=0x%x\n", + __func__, (int)addr, (int)value); } static const MemoryRegionOps uart_ops = { From patchwork Fri Aug 23 05:10:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110579 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D66EA14DB for ; Fri, 23 Aug 2019 05:23:17 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACD2121726 for ; Fri, 23 Aug 2019 05:23:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AWZcOUTH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ACD2121726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i122e-0007zb-A5 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:23:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44742) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rB-0003wA-4s for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rA-0002U1-1x for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:25 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:43064) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11r9-0002TQ-Ri; Fri, 23 Aug 2019 01:11:23 -0400 Received: by mail-pg1-x541.google.com with SMTP id k3so5072635pgb.10; Thu, 22 Aug 2019 22:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=opzuml6fqRIWQBbdwqjXZPFwmr327XnVlwROZQz1Lm4=; b=AWZcOUTHtJ2cTxAeRhKKURE8J8lBx/WrBOsx54KuRZljj8I4cJidljOncRQV/DCMa1 zvNc1ez7v7qWnmr/ojK6L0iEMHjsN/lyYH0GL4QzdFOAi/xmxRuKb/MtVomCIoQ/R3ev ActCjmVTvcpXbzjQ722sBF5gn5Tdxqik8TbiDjK+gD/A1dgCh9Fza/GEqsLeoyiIps1X Tl5dr4RuIDT6TE2eolSHw24KPpH+V8zklZELNOCMidV7T/qHJ6Lt/58otBEk5TLgyEV4 FNjdrf8ofjdVsVbEEi3gPh8VXtFIAUsAMZHvi2FMgvS++3ImHE7u3J+RfOCj6Xa/yipq 006w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=opzuml6fqRIWQBbdwqjXZPFwmr327XnVlwROZQz1Lm4=; b=Rdle18r8eB194Ty4bdFPHrs4SAzxuIcy0xaC69EEd2EAiWHceABCDaf39ZuTOWvud4 4ZbuuxMidbdujMcP4NoyDxgnKVJWjFhsjrFXnVYnGCQ0QZr5S9LmVzuQBJeGHqD/+bsc WDY+AbSmqJoRE9q9Z9UHOYL8GNSrsMa/BMqPWatGrQzXo2DhhliQ4uQrymfCg8ql63b6 MLU04o1oKKVPN8UZ8v1xp2TiritzNXCOvT7NitjSX9dg1hsBfU5FJRqsQXTHgd+9Tc75 ejebm/4m2qthGxksV5MjuJ4VFneZbKV3xzzEt12r3xXZS3yKi+U994sLI1Mw3GBki2YI WY6Q== X-Gm-Message-State: APjAAAVjux23CAHFnHzHn4hMQP6UooLj+swM5RrhAwS+CHKGLuz8BEzg lDCbA7sXTVxd06kZNsgBDYQ= X-Google-Smtp-Source: APXvYqx3WH6SrbM+zOtPPaNWEVG8pLrVZ2HnCuAo9knL5yL+3Kv3d9zh6u7qmmBvrsUnqIf60GKQvQ== X-Received: by 2002:aa7:8d98:: with SMTP id i24mr3097113pfr.199.1566537083061; Thu, 22 Aug 2019 22:11:23 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.21 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:22 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:45 -0700 Message-Id: <1566537069-22741-7-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH v5 06/30] riscv: hw: Remove the unnecessary include of target/riscv/cpu.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The inclusion of "target/riscv/cpu.h" is unnecessary in various sifive model drivers. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: - new patch to remove the unnecessary include of target/riscv/cpu.h Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_prci.c | 1 - hw/riscv/sifive_test.c | 1 - hw/riscv/sifive_uart.c | 1 - 3 files changed, 3 deletions(-) diff --git a/hw/riscv/sifive_prci.c b/hw/riscv/sifive_prci.c index 1ab98d4..1957dcd 100644 --- a/hw/riscv/sifive_prci.c +++ b/hw/riscv/sifive_prci.c @@ -22,7 +22,6 @@ #include "hw/sysbus.h" #include "qemu/log.h" #include "qemu/module.h" -#include "target/riscv/cpu.h" #include "hw/riscv/sifive_prci.h" static uint64_t sifive_prci_read(void *opaque, hwaddr addr, unsigned int size) diff --git a/hw/riscv/sifive_test.c b/hw/riscv/sifive_test.c index 655a3d7..31cad9f 100644 --- a/hw/riscv/sifive_test.c +++ b/hw/riscv/sifive_test.c @@ -23,7 +23,6 @@ #include "qemu/log.h" #include "qemu/module.h" #include "sysemu/sysemu.h" -#include "target/riscv/cpu.h" #include "hw/riscv/sifive_test.h" static uint64_t sifive_test_read(void *opaque, hwaddr addr, unsigned int size) diff --git a/hw/riscv/sifive_uart.c b/hw/riscv/sifive_uart.c index cd74043..1601bd9 100644 --- a/hw/riscv/sifive_uart.c +++ b/hw/riscv/sifive_uart.c @@ -22,7 +22,6 @@ #include "hw/sysbus.h" #include "chardev/char.h" #include "chardev/char-fe.h" -#include "target/riscv/cpu.h" #include "hw/riscv/sifive_uart.h" /* From patchwork Fri Aug 23 05:10:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110563 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F8731709 for ; Fri, 23 Aug 2019 05:13:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 666772070B for ; Fri, 23 Aug 2019 05:13:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hkYewr6J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 666772070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11tK-00064s-13 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44760) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rC-0003xO-1V for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rA-0002Uv-Us for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:25 -0400 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:40291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rA-0002UU-Ps; Fri, 23 Aug 2019 01:11:24 -0400 Received: by mail-pg1-x544.google.com with SMTP id w10so5085563pgj.7; Thu, 22 Aug 2019 22:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=rNLm6cRmQnR+aWSvvg8z9lVz1WacHHyN0XGP8sjZ7OY=; b=hkYewr6JoRLWNAHvOgf6VZ2ltgsyBtYvc74WEfrdymhJ3z/Jk3PALy7IL/ornu2xSg jnG/JKpl3Ke9QslA7XMRYW9Q4x/RqaS/5DoWZ7sUk5Nmo5xcHNSJQdJIBV9m63POxOOs Sf5KeB7/HJoCrPZf232oF1TekcOiKIgYuV/2ahRSGbh1dRGysvwKJc3XtHtuSQQAzBds 6SortFKRwdlKVBQrbQ2dYqTAYDiEV11AgEuc/6ynKewLczCR88C2dYjXu+qdED0Tp+q1 /K436vJSFL/e0NYc919mZ/kcys+SKNob4jsp3OBGSjE+eqLlJLRMiaoUwQOxy0A+7dJr 3wDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rNLm6cRmQnR+aWSvvg8z9lVz1WacHHyN0XGP8sjZ7OY=; b=XdaKOXCl9XWV9wTq4fsA81cvmpNmnHTx6lDgQzWKNWMTOFPcWNtPfqFG7twHIO2qX1 xMkVZRxH05C3w/1WWLwqTWOuP5RShgQfyGNv3m4B162myGp1b1foDl8nlE55zzNxtOHS nJI4gI9Rn7fUSM0FhiM2r9BuAir9RSLmUakecJTw72g5t8G63xdX/CD20Dz4qtLqQcdJ OlO4wEzfXmxKL1aYhttgSyoJ0ffqqczDWvL+T5Ov+5vFcZBMkyk/0bKznJkEePLNYIMG nx5qLQHL35HJZKyxUykvLH8HkMq6X10WwjUgDOlxJvRpdJ7/tc/buG9O8GpQ6a3+n3hP ED/g== X-Gm-Message-State: APjAAAXmVnPVIjJQUICKYpszTePsIhVTJP8DA491i0XGyH+BoDaKqJLu iQmTn+U+MfgK1YYwAG+B8Dg= X-Google-Smtp-Source: APXvYqwTQDapXk8O+Wk5E11nS2a5X+jE3mW+4LI+wM427YSF+FFQCHqx7bgPUoGqEwUx+oVmAnfpBQ== X-Received: by 2002:a17:90a:1916:: with SMTP id 22mr3382486pjg.62.1566537084102; Thu, 22 Aug 2019 22:11:24 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.23 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:23 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:46 -0700 Message-Id: <1566537069-22741-8-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 Subject: [Qemu-devel] [PATCH v5 07/30] riscv: roms: Remove executable attribute of opensbi images X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Like other binary files, the executable attribute of opensbi images should not be set. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - new patch to remove executable attribute of opensbi images Changes in v3: None Changes in v2: None pc-bios/opensbi-riscv32-virt-fw_jump.bin | Bin pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin | Bin pc-bios/opensbi-riscv64-virt-fw_jump.bin | Bin 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 pc-bios/opensbi-riscv32-virt-fw_jump.bin mode change 100755 => 100644 pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin mode change 100755 => 100644 pc-bios/opensbi-riscv64-virt-fw_jump.bin diff --git a/pc-bios/opensbi-riscv32-virt-fw_jump.bin b/pc-bios/opensbi-riscv32-virt-fw_jump.bin old mode 100755 new mode 100644 diff --git a/pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin b/pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin old mode 100755 new mode 100644 diff --git a/pc-bios/opensbi-riscv64-virt-fw_jump.bin b/pc-bios/opensbi-riscv64-virt-fw_jump.bin old mode 100755 new mode 100644 From patchwork Fri Aug 23 05:10:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110567 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8B3B214DE for ; Fri, 23 Aug 2019 05:18:13 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 627BB206BA for ; Fri, 23 Aug 2019 05:18:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U6uWz8Lf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 627BB206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11xj-0002uj-N0 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:18:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44789) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rD-0003zE-4E for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rC-0002Vw-5B for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:27 -0400 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:40289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rB-0002VL-W2; Fri, 23 Aug 2019 01:11:26 -0400 Received: by mail-pg1-x541.google.com with SMTP id w10so5085594pgj.7; Thu, 22 Aug 2019 22:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=hrQC5pexYbXUG1YTE6t9xU7Lp0SfEiWHb4ZiElloTac=; b=U6uWz8LfuhsDG3mCDKEXNkglzjeDVsHNu5/XT0B+Xgcs2bEvsRa1aqy0SVyd04fGDC G/t8eWOIfeJI4NB4Psz1X+Ap4UvDHdTBwc4RnY44SyQdytmNKDELUfvZL600EBRIBnHl AG3TCJVpY6gNVDkmP8Oix3y7xwAu6sINp05gWcTqyDx3SAq4Pjc3/tIljahpEDBjlrfu cFLsaPCdItRr5GhbKEm4GL3HQCzAlu0HoAaF8fUMYBdTzC4RrdW4nshVTLoMQ3Il6XG7 VSRVcUp31Tp+hM52Ar9C8ixl4nr1LAvFL/h4suu0x9G70y5+stchSG2VWBjhPIwG7OUC w7TA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=hrQC5pexYbXUG1YTE6t9xU7Lp0SfEiWHb4ZiElloTac=; b=az5viJwryGJLzR5hNFEzzIdTb9vDNulkl6Ta75aLO9OyR3hqvYwIx2JSXJjFDxRmvr 1bl5M3aQQKBWIOC0B7ZgCirFRvuepyJWUq6+bBpbqPRue3kfpGzY9Dj1BKlHpufbaelX RIYNbNlknkGEWdRS1RMa8vMrj94rIlzgOzP+hn6tUp6gRERCFfGgU+tfeefo1XpFGHpX Uu+LTAC8amgLL5uBqZd6mcQuBokhzqT3yOpkLCqoqkpRfJh0DTiRIXiB7Mxz2TbbkF5L ekCCGy9k+gjtF3h/H3jQ162AkxxMERR0MWy5odCs6J6V3gODyBsNw92byIsTpTnMDCNu tF8g== X-Gm-Message-State: APjAAAU9rsezM7Clq0Ag5AjYYddzIPv9TgicyTHJmCPdik1jbu3UoPIi UrVcEWapNFRVEoDeEkks6vs= X-Google-Smtp-Source: APXvYqwCIEJx6/sXuJKiqRPSKgaE8XJ/g4eE975ZF7J2Ib4u86D9urp6R5oP5FnERNqlipANVMPwEA== X-Received: by 2002:a17:90a:5887:: with SMTP id j7mr3299275pji.136.1566537085272; Thu, 22 Aug 2019 22:11:25 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.24 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:24 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:47 -0700 Message-Id: <1566537069-22741-9-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::541 Subject: [Qemu-devel] [PATCH v5 08/30] riscv: sifive_u: Remove the unnecessary include of prci header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" sifive_u machine does not use PRCI as of today. Remove the prci header inclusion. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index e22803b..3f58f61 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -39,7 +39,6 @@ #include "hw/riscv/sifive_plic.h" #include "hw/riscv/sifive_clint.h" #include "hw/riscv/sifive_uart.h" -#include "hw/riscv/sifive_prci.h" #include "hw/riscv/sifive_u.h" #include "hw/riscv/boot.h" #include "chardev/char.h" From patchwork Fri Aug 23 05:10:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B69001813 for ; Fri, 23 Aug 2019 05:22:55 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E01022CEC for ; Fri, 23 Aug 2019 05:22:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bDQqHOVO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E01022CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i122I-0007ZJ-D4 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:22:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44840) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rF-000436-PY for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rD-0002XG-KF for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:29 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:35015) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rD-0002WN-CO; Fri, 23 Aug 2019 01:11:27 -0400 Received: by mail-pf1-x444.google.com with SMTP id d85so5663380pfd.2; Thu, 22 Aug 2019 22:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=1iCCjSytNkloKR4mkSLeDSDXd2IusD1LRacOOURmY9A=; b=bDQqHOVOAN6SUbPS1hnELyg0fuMyyAOpJ2iQmE4MLjEoXeJIqELBAgv1UE+JQ2B96j 8uh6/qQYg2Vg1rDLF6mjGQaPmRhD/9dzRCc1FRcMj2rh5Ci/inVRzEpMZYlP25IiU3NN HR9O5rbKTqvhnMYSc/11jQCjTrFVg4TzJZlFzIMEx4+HDeBC0jBoiKG8mUbB6FJwDQCw ixfDWZgXZ/gwfeEFQrD8Oq0rGhlAoYjXM2vmxpOB9BBIEOLIJIoJLjPpzH+E5ET+Y9T2 fccuRaSTV8GuVQFTDE1GuIPIqX98ns7nNXfadHotTVpvT/P7wfpJ9+osFtit4kCoHK1i uDDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1iCCjSytNkloKR4mkSLeDSDXd2IusD1LRacOOURmY9A=; b=eFQ2WEo2C6cwqUM0s/4XF2LpjsiXIt0csuoK0LfZfREHD19CsvAA8WdF1YelcTVlxH KvBttD5M6fiuNvSU9UkmEOBctevQaRSKOPvUwS04fQdbfLI/lPuBpiN6rQ9UIKb9efyx sALUEnozG1KwwgCZopX0OgoEmx7MJQ8GbDB81csmAWGYxMIRdfDKNbPi2s5UutDaL6H0 MECJkCbiZzqu8b/X6nQ+TJ9fIbFYnaiy1MgEAUR+lR2Ne2olgYEGKG+7Sz56ACXSpWVm jreQX0rCt9AGU/eV/WL4rcr6PJPIxYD/D4bYnIn9Bq4ZO4GKD7/kVm4ZW7UzCzKCB0g+ Ta6w== X-Gm-Message-State: APjAAAWenz+XAKefZ6nTcVyfDxl9Z2wmy/GK4DkUUmRon30bXT1xt2vL nZO7cqSmCPvINHmeNqhHwDM= X-Google-Smtp-Source: APXvYqzFznN4ApmwOU7fC1JofzEKH+Nz06KozqctEmcB9hjX8e/RyT4XwlX1CSaAjTydQwa+eqXejw== X-Received: by 2002:aa7:9293:: with SMTP id j19mr3237349pfa.90.1566537086409; Thu, 22 Aug 2019 22:11:26 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.25 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:25 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:48 -0700 Message-Id: <1566537069-22741-10-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v5 09/30] riscv: sifive: Rename sifive_prci.{c, h} to sifive_e_prci.{c, h} X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Current SiFive PRCI model only works with sifive_e machine, as it only emulates registers or PRCI block in the FE310 SoC. Rename the file name to make it clear that it is for sifive_e. This also prefix "sifive_e"/"SIFIVE_E" for all macros, variables and functions. Signed-off-by: Bin Meng Reviewed-by: Chih-Min Chao Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - prefix all macros/variables/functions with SIFIVE_E/sifive_e in the sifive_e_prci driver Changes in v3: None Changes in v2: None hw/riscv/Makefile.objs | 2 +- hw/riscv/sifive_e.c | 4 +- hw/riscv/{sifive_prci.c => sifive_e_prci.c} | 79 ++++++++++++++--------------- include/hw/riscv/sifive_e_prci.h | 69 +++++++++++++++++++++++++ include/hw/riscv/sifive_prci.h | 69 ------------------------- 5 files changed, 111 insertions(+), 112 deletions(-) rename hw/riscv/{sifive_prci.c => sifive_e_prci.c} (51%) create mode 100644 include/hw/riscv/sifive_e_prci.h delete mode 100644 include/hw/riscv/sifive_prci.h diff --git a/hw/riscv/Makefile.objs b/hw/riscv/Makefile.objs index eb9d4f9..c859697 100644 --- a/hw/riscv/Makefile.objs +++ b/hw/riscv/Makefile.objs @@ -2,9 +2,9 @@ obj-y += boot.o obj-$(CONFIG_SPIKE) += riscv_htif.o obj-$(CONFIG_HART) += riscv_hart.o obj-$(CONFIG_SIFIVE_E) += sifive_e.o +obj-$(CONFIG_SIFIVE_E) += sifive_e_prci.o obj-$(CONFIG_SIFIVE) += sifive_clint.o obj-$(CONFIG_SIFIVE) += sifive_gpio.o -obj-$(CONFIG_SIFIVE) += sifive_prci.o obj-$(CONFIG_SIFIVE) += sifive_plic.o obj-$(CONFIG_SIFIVE) += sifive_test.o obj-$(CONFIG_SIFIVE_U) += sifive_u.o diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index 2a499d8..2d67670 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -41,9 +41,9 @@ #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_plic.h" #include "hw/riscv/sifive_clint.h" -#include "hw/riscv/sifive_prci.h" #include "hw/riscv/sifive_uart.h" #include "hw/riscv/sifive_e.h" +#include "hw/riscv/sifive_e_prci.h" #include "hw/riscv/boot.h" #include "chardev/char.h" #include "sysemu/arch_init.h" @@ -174,7 +174,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp) SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE); sifive_mmio_emulate(sys_mem, "riscv.sifive.e.aon", memmap[SIFIVE_E_AON].base, memmap[SIFIVE_E_AON].size); - sifive_prci_create(memmap[SIFIVE_E_PRCI].base); + sifive_e_prci_create(memmap[SIFIVE_E_PRCI].base); /* GPIO */ diff --git a/hw/riscv/sifive_prci.c b/hw/riscv/sifive_e_prci.c similarity index 51% rename from hw/riscv/sifive_prci.c rename to hw/riscv/sifive_e_prci.c index 1957dcd..c514032 100644 --- a/hw/riscv/sifive_prci.c +++ b/hw/riscv/sifive_e_prci.c @@ -1,5 +1,5 @@ /* - * QEMU SiFive PRCI (Power, Reset, Clock, Interrupt) + * QEMU SiFive E PRCI (Power, Reset, Clock, Interrupt) * * Copyright (c) 2017 SiFive, Inc. * @@ -22,19 +22,19 @@ #include "hw/sysbus.h" #include "qemu/log.h" #include "qemu/module.h" -#include "hw/riscv/sifive_prci.h" +#include "hw/riscv/sifive_e_prci.h" -static uint64_t sifive_prci_read(void *opaque, hwaddr addr, unsigned int size) +static uint64_t sifive_e_prci_read(void *opaque, hwaddr addr, unsigned int size) { - SiFivePRCIState *s = opaque; + SiFiveEPRCIState *s = opaque; switch (addr) { - case SIFIVE_PRCI_HFROSCCFG: + case SIFIVE_E_PRCI_HFROSCCFG: return s->hfrosccfg; - case SIFIVE_PRCI_HFXOSCCFG: + case SIFIVE_E_PRCI_HFXOSCCFG: return s->hfxosccfg; - case SIFIVE_PRCI_PLLCFG: + case SIFIVE_E_PRCI_PLLCFG: return s->pllcfg; - case SIFIVE_PRCI_PLLOUTDIV: + case SIFIVE_E_PRCI_PLLOUTDIV: return s->plloutdiv; } qemu_log_mask(LOG_GUEST_ERROR, "%s: read: addr=0x%x\n", @@ -42,27 +42,27 @@ static uint64_t sifive_prci_read(void *opaque, hwaddr addr, unsigned int size) return 0; } -static void sifive_prci_write(void *opaque, hwaddr addr, - uint64_t val64, unsigned int size) +static void sifive_e_prci_write(void *opaque, hwaddr addr, + uint64_t val64, unsigned int size) { - SiFivePRCIState *s = opaque; + SiFiveEPRCIState *s = opaque; switch (addr) { - case SIFIVE_PRCI_HFROSCCFG: + case SIFIVE_E_PRCI_HFROSCCFG: s->hfrosccfg = (uint32_t) val64; /* OSC stays ready */ - s->hfrosccfg |= SIFIVE_PRCI_HFROSCCFG_RDY; + s->hfrosccfg |= SIFIVE_E_PRCI_HFROSCCFG_RDY; break; - case SIFIVE_PRCI_HFXOSCCFG: + case SIFIVE_E_PRCI_HFXOSCCFG: s->hfxosccfg = (uint32_t) val64; /* OSC stays ready */ - s->hfxosccfg |= SIFIVE_PRCI_HFXOSCCFG_RDY; + s->hfxosccfg |= SIFIVE_E_PRCI_HFXOSCCFG_RDY; break; - case SIFIVE_PRCI_PLLCFG: + case SIFIVE_E_PRCI_PLLCFG: s->pllcfg = (uint32_t) val64; /* PLL stays locked */ - s->pllcfg |= SIFIVE_PRCI_PLLCFG_LOCK; + s->pllcfg |= SIFIVE_E_PRCI_PLLCFG_LOCK; break; - case SIFIVE_PRCI_PLLOUTDIV: + case SIFIVE_E_PRCI_PLLOUTDIV: s->plloutdiv = (uint32_t) val64; break; default: @@ -71,9 +71,9 @@ static void sifive_prci_write(void *opaque, hwaddr addr, } } -static const MemoryRegionOps sifive_prci_ops = { - .read = sifive_prci_read, - .write = sifive_prci_write, +static const MemoryRegionOps sifive_e_prci_ops = { + .read = sifive_e_prci_read, + .write = sifive_e_prci_write, .endianness = DEVICE_NATIVE_ENDIAN, .valid = { .min_access_size = 4, @@ -81,43 +81,42 @@ static const MemoryRegionOps sifive_prci_ops = { } }; -static void sifive_prci_init(Object *obj) +static void sifive_e_prci_init(Object *obj) { - SiFivePRCIState *s = SIFIVE_PRCI(obj); + SiFiveEPRCIState *s = SIFIVE_E_PRCI(obj); - memory_region_init_io(&s->mmio, obj, &sifive_prci_ops, s, - TYPE_SIFIVE_PRCI, 0x8000); + memory_region_init_io(&s->mmio, obj, &sifive_e_prci_ops, s, + TYPE_SIFIVE_E_PRCI, 0x8000); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); - s->hfrosccfg = (SIFIVE_PRCI_HFROSCCFG_RDY | SIFIVE_PRCI_HFROSCCFG_EN); - s->hfxosccfg = (SIFIVE_PRCI_HFROSCCFG_RDY | SIFIVE_PRCI_HFROSCCFG_EN); - s->pllcfg = (SIFIVE_PRCI_PLLCFG_REFSEL | SIFIVE_PRCI_PLLCFG_BYPASS | - SIFIVE_PRCI_PLLCFG_LOCK); - s->plloutdiv = SIFIVE_PRCI_PLLOUTDIV_DIV1; - + s->hfrosccfg = (SIFIVE_E_PRCI_HFROSCCFG_RDY | SIFIVE_E_PRCI_HFROSCCFG_EN); + s->hfxosccfg = (SIFIVE_E_PRCI_HFROSCCFG_RDY | SIFIVE_E_PRCI_HFROSCCFG_EN); + s->pllcfg = (SIFIVE_E_PRCI_PLLCFG_REFSEL | SIFIVE_E_PRCI_PLLCFG_BYPASS | + SIFIVE_E_PRCI_PLLCFG_LOCK); + s->plloutdiv = SIFIVE_E_PRCI_PLLOUTDIV_DIV1; } -static const TypeInfo sifive_prci_info = { - .name = TYPE_SIFIVE_PRCI, +static const TypeInfo sifive_e_prci_info = { + .name = TYPE_SIFIVE_E_PRCI, .parent = TYPE_SYS_BUS_DEVICE, - .instance_size = sizeof(SiFivePRCIState), - .instance_init = sifive_prci_init, + .instance_size = sizeof(SiFiveEPRCIState), + .instance_init = sifive_e_prci_init, }; -static void sifive_prci_register_types(void) +static void sifive_e_prci_register_types(void) { - type_register_static(&sifive_prci_info); + type_register_static(&sifive_e_prci_info); } -type_init(sifive_prci_register_types) +type_init(sifive_e_prci_register_types) /* * Create PRCI device. */ -DeviceState *sifive_prci_create(hwaddr addr) +DeviceState *sifive_e_prci_create(hwaddr addr) { - DeviceState *dev = qdev_create(NULL, TYPE_SIFIVE_PRCI); + DeviceState *dev = qdev_create(NULL, TYPE_SIFIVE_E_PRCI); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, addr); return dev; diff --git a/include/hw/riscv/sifive_e_prci.h b/include/hw/riscv/sifive_e_prci.h new file mode 100644 index 0000000..c4b76aa --- /dev/null +++ b/include/hw/riscv/sifive_e_prci.h @@ -0,0 +1,69 @@ +/* + * QEMU SiFive E PRCI (Power, Reset, Clock, Interrupt) interface + * + * Copyright (c) 2017 SiFive, Inc. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef HW_SIFIVE_E_PRCI_H +#define HW_SIFIVE_E_PRCI_H + +enum { + SIFIVE_E_PRCI_HFROSCCFG = 0x0, + SIFIVE_E_PRCI_HFXOSCCFG = 0x4, + SIFIVE_E_PRCI_PLLCFG = 0x8, + SIFIVE_E_PRCI_PLLOUTDIV = 0xC +}; + +enum { + SIFIVE_E_PRCI_HFROSCCFG_RDY = (1 << 31), + SIFIVE_E_PRCI_HFROSCCFG_EN = (1 << 30) +}; + +enum { + SIFIVE_E_PRCI_HFXOSCCFG_RDY = (1 << 31), + SIFIVE_E_PRCI_HFXOSCCFG_EN = (1 << 30) +}; + +enum { + SIFIVE_E_PRCI_PLLCFG_PLLSEL = (1 << 16), + SIFIVE_E_PRCI_PLLCFG_REFSEL = (1 << 17), + SIFIVE_E_PRCI_PLLCFG_BYPASS = (1 << 18), + SIFIVE_E_PRCI_PLLCFG_LOCK = (1 << 31) +}; + +enum { + SIFIVE_E_PRCI_PLLOUTDIV_DIV1 = (1 << 8) +}; + +#define TYPE_SIFIVE_E_PRCI "riscv.sifive.e.prci" + +#define SIFIVE_E_PRCI(obj) \ + OBJECT_CHECK(SiFiveEPRCIState, (obj), TYPE_SIFIVE_E_PRCI) + +typedef struct SiFiveEPRCIState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + MemoryRegion mmio; + uint32_t hfrosccfg; + uint32_t hfxosccfg; + uint32_t pllcfg; + uint32_t plloutdiv; +} SiFiveEPRCIState; + +DeviceState *sifive_e_prci_create(hwaddr addr); + +#endif diff --git a/include/hw/riscv/sifive_prci.h b/include/hw/riscv/sifive_prci.h deleted file mode 100644 index bd51c4a..0000000 --- a/include/hw/riscv/sifive_prci.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * QEMU SiFive PRCI (Power, Reset, Clock, Interrupt) interface - * - * Copyright (c) 2017 SiFive, Inc. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2 or later, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -#ifndef HW_SIFIVE_PRCI_H -#define HW_SIFIVE_PRCI_H - -enum { - SIFIVE_PRCI_HFROSCCFG = 0x0, - SIFIVE_PRCI_HFXOSCCFG = 0x4, - SIFIVE_PRCI_PLLCFG = 0x8, - SIFIVE_PRCI_PLLOUTDIV = 0xC -}; - -enum { - SIFIVE_PRCI_HFROSCCFG_RDY = (1 << 31), - SIFIVE_PRCI_HFROSCCFG_EN = (1 << 30) -}; - -enum { - SIFIVE_PRCI_HFXOSCCFG_RDY = (1 << 31), - SIFIVE_PRCI_HFXOSCCFG_EN = (1 << 30) -}; - -enum { - SIFIVE_PRCI_PLLCFG_PLLSEL = (1 << 16), - SIFIVE_PRCI_PLLCFG_REFSEL = (1 << 17), - SIFIVE_PRCI_PLLCFG_BYPASS = (1 << 18), - SIFIVE_PRCI_PLLCFG_LOCK = (1 << 31) -}; - -enum { - SIFIVE_PRCI_PLLOUTDIV_DIV1 = (1 << 8) -}; - -#define TYPE_SIFIVE_PRCI "riscv.sifive.prci" - -#define SIFIVE_PRCI(obj) \ - OBJECT_CHECK(SiFivePRCIState, (obj), TYPE_SIFIVE_PRCI) - -typedef struct SiFivePRCIState { - /*< private >*/ - SysBusDevice parent_obj; - - /*< public >*/ - MemoryRegion mmio; - uint32_t hfrosccfg; - uint32_t hfxosccfg; - uint32_t pllcfg; - uint32_t plloutdiv; -} SiFivePRCIState; - -DeviceState *sifive_prci_create(hwaddr addr); - -#endif From patchwork Fri Aug 23 05:10:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22D3A14DE for ; Fri, 23 Aug 2019 05:27:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E117A22CEC for ; Fri, 23 Aug 2019 05:27:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a35FTrJU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E117A22CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i126S-0003rS-HZ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:27:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44836) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rF-00042k-KJ for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rE-0002Y8-Jt for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:29 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:38646) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rE-0002XS-Cn; Fri, 23 Aug 2019 01:11:28 -0400 Received: by mail-pf1-x442.google.com with SMTP id o70so5655174pfg.5; Thu, 22 Aug 2019 22:11:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=abfIhjs94ppdRZa0sqZhx+9vkYxwlbvhyOHMnX1hFyI=; b=a35FTrJU/yetHol+fB12TFhQFvvUG6ZO/ku5TYsKcZ7Pcn4dZzab3MLUJiTlQe5CJb nf8nL9Q99m+5nuPXwMc3xVGMeFoAm5hZJRYm11M0obbVrdWKw7t21Yst5hhAlRswFUDR yAhD1ZNfK9jhLSs1EgGtc2Aqx+iLX91X6L20D7yqslAgjzeiGP9LUOSMBB6RLIDsMUaF qbqSnYmgmeeKDTBvJz7Oy8eJO299RvBpuA6Mrsn0kTDzMddeWQvR1f37GAiyqMHcwUCg 4rY5TQPeJGajfNaKHmRaRc0pb8tm+QmCsVGEtiObjL1aXsGPK+BJS4jBW/adu9kk5PyS Ko/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=abfIhjs94ppdRZa0sqZhx+9vkYxwlbvhyOHMnX1hFyI=; b=QcgANakQHhdrsBapOzmCsD5HL3haru99uB38b/fAfpWMOt2XYfrkenAihzrXhJQHx1 xkny32ASN3U2Q7vQ3Uy0F04Y4uDdXvM93knhKupZ9ZkUO6GNnI6H/h8sbP7FJVz1SvmD 4qTgxvzUUyU2UzDasbi2oM36rvZ40qMrLjFgDy/fvPEZI+SuYgMhoeZ+8M8P4VRhg+U6 +Zb6NhBrYmm0RjVGeKG/A3WZrxFXStWZbosCrZn99+ds15n/AVJMpTgAre6f3wNrPiAz LIkll0rB/DGfMagN75BMRfs1adPLApgNmWb5ORWcgVkrRl3TN+/sbTbTaed4/uVWy5m2 RIzA== X-Gm-Message-State: APjAAAWQTENo1R7JxDSYNqOFF4mtLzGm9knuFsE8I9P22+GBEWkBKFwk norHmxv0p/jQtiF/o4ThcFc= X-Google-Smtp-Source: APXvYqx4Yh81ILslZzR6mXpYVRFhGdQbJUfMnpNtHSe2KZa1GiS+xn6YlJb95x9zTxU32TPqoMcB+Q== X-Received: by 2002:a17:90a:b290:: with SMTP id c16mr3301911pjr.34.1566537087608; Thu, 22 Aug 2019 22:11:27 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.26 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:26 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:49 -0700 Message-Id: <1566537069-22741-11-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v5 10/30] riscv: sifive_e: prci: Fix a typo of hfxosccfg register programming X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" For hfxosccfg register programming, SIFIVE_E_PRCI_HFXOSCCFG_RDY and SIFIVE_E_PRCI_HFXOSCCFG_EN should be used. Signed-off-by: Bin Meng Acked-by: Alistair Francis Reviewed-by: Chih-Min Chao Reviewed-by: Philippe Mathieu-Daudé --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_e_prci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/sifive_e_prci.c b/hw/riscv/sifive_e_prci.c index c514032..71de089 100644 --- a/hw/riscv/sifive_e_prci.c +++ b/hw/riscv/sifive_e_prci.c @@ -90,7 +90,7 @@ static void sifive_e_prci_init(Object *obj) sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); s->hfrosccfg = (SIFIVE_E_PRCI_HFROSCCFG_RDY | SIFIVE_E_PRCI_HFROSCCFG_EN); - s->hfxosccfg = (SIFIVE_E_PRCI_HFROSCCFG_RDY | SIFIVE_E_PRCI_HFROSCCFG_EN); + s->hfxosccfg = (SIFIVE_E_PRCI_HFXOSCCFG_RDY | SIFIVE_E_PRCI_HFXOSCCFG_EN); s->pllcfg = (SIFIVE_E_PRCI_PLLCFG_REFSEL | SIFIVE_E_PRCI_PLLCFG_BYPASS | SIFIVE_E_PRCI_PLLCFG_LOCK); s->plloutdiv = SIFIVE_E_PRCI_PLLOUTDIV_DIV1; From patchwork Fri Aug 23 05:10:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6CAA14DB for ; Fri, 23 Aug 2019 05:27:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7E63722CEC for ; Fri, 23 Aug 2019 05:27:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JlQJ7jB4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E63722CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1271-0004XQ-AK for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:27:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44865) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rH-00045C-M7 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rF-0002Yv-Kd for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:30 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:43066) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rF-0002YK-F7; Fri, 23 Aug 2019 01:11:29 -0400 Received: by mail-pg1-x542.google.com with SMTP id k3so5072743pgb.10; Thu, 22 Aug 2019 22:11:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=1QsGGydW2bZUHoxiW5W0EtCouM+ZnvHGwY2Nm3XyYGs=; b=JlQJ7jB45CUalt8PgtbfqRxTWPg0JwYhadqb8ib3ZFmLTYaVE4ihFS3CTtCpt59UCn TiZXJyWAg8upRYFZ9W7a3svDtHxVCwYt+WKgGrnHZ51i6rH2n/AnpgR89bU+2UNzDYAf bD7r6CFf3Asej//INAGmoUtvZ7C64/aSoUwPMAtlx2T1MwzVYeEAbsRoVq+i9ktxcNGC xI/goLTftH5w1nze6BjhsIEvRlflj8U/eVLV1aiP+1qLPmFIxO5hwMLj3FyYZiyAYdta brvSEIckCdKUzzwZszu3BHYGTtb2rikrlrVta45FsST6tkfa2wV4gxtV8rLRHx7VWLv3 FiKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1QsGGydW2bZUHoxiW5W0EtCouM+ZnvHGwY2Nm3XyYGs=; b=J4JeHlB+cWLUAnlnKFE86xXtyizGmsM1banbn8yLzCERb4K2piwDaPN8rPH+Oplkx5 pn5FaoFVt+pFeEzYRFDm6uHm8OFWN5HxoiEwi2DlQ0R7kec9hEsE5bsAqowK6nJAmtvZ +TJczV0jIwFd0EQuUehGToNhe8f7LlBwHNdk9xPXCNpaFsH3UNwyR9pJuRyYZzp5qHxj H4hWTamiVj4+RbmnAvmsSYiVLq8pcTBZ1EyA+pQHj9lHNwqkV4XwdRrR3PVzPXMLa06H AeV55NEKbbk6i8X1/e9N48P7ErZUUfZMeVp5ud7iKSWb9hYMXjMU9dsf3Ou+mTXoHx67 p11w== X-Gm-Message-State: APjAAAUmxW7d8KN9vw3KX8+rHEy/UndDV3ki9Orgfr7xj1hwdQU3Ca9r 9oKckZ53VehINYN0hl/inEQ= X-Google-Smtp-Source: APXvYqwfn65qOpB3D9nHMQ4Kqh8gsR+wkZl9u6Tw5StB4SMoUtP27TzSPbBciZugmsn0kcRxQC9iRQ== X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr3257602pjr.92.1566537088671; Thu, 22 Aug 2019 22:11:28 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.27 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:28 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:50 -0700 Message-Id: <1566537069-22741-12-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v5 11/30] riscv: sifive_e: prci: Update the PRCI register block size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Currently the PRCI register block size is set to 0x8000, but in fact 0x1000 is enough, which is also what the manual says. Signed-off-by: Bin Meng Reviewed-by: Chih-Min Chao Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_e_prci.c | 2 +- include/hw/riscv/sifive_e_prci.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/riscv/sifive_e_prci.c b/hw/riscv/sifive_e_prci.c index 71de089..ad6c624 100644 --- a/hw/riscv/sifive_e_prci.c +++ b/hw/riscv/sifive_e_prci.c @@ -86,7 +86,7 @@ static void sifive_e_prci_init(Object *obj) SiFiveEPRCIState *s = SIFIVE_E_PRCI(obj); memory_region_init_io(&s->mmio, obj, &sifive_e_prci_ops, s, - TYPE_SIFIVE_E_PRCI, 0x8000); + TYPE_SIFIVE_E_PRCI, SIFIVE_E_PRCI_REG_SIZE); sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); s->hfrosccfg = (SIFIVE_E_PRCI_HFROSCCFG_RDY | SIFIVE_E_PRCI_HFROSCCFG_EN); diff --git a/include/hw/riscv/sifive_e_prci.h b/include/hw/riscv/sifive_e_prci.h index c4b76aa..698b0b4 100644 --- a/include/hw/riscv/sifive_e_prci.h +++ b/include/hw/riscv/sifive_e_prci.h @@ -47,6 +47,8 @@ enum { SIFIVE_E_PRCI_PLLOUTDIV_DIV1 = (1 << 8) }; +#define SIFIVE_E_PRCI_REG_SIZE 0x1000 + #define TYPE_SIFIVE_E_PRCI "riscv.sifive.e.prci" #define SIFIVE_E_PRCI(obj) \ From patchwork Fri Aug 23 05:10:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110597 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F30E8174A for ; Fri, 23 Aug 2019 05:32:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CA0482166E for ; Fri, 23 Aug 2019 05:32:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WkvoQeyE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA0482166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12Bp-0000jX-8k for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:32:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44897) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rJ-00047u-7h for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rH-0002ad-QD for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:33 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:43398) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rH-0002Zz-Jy; Fri, 23 Aug 2019 01:11:31 -0400 Received: by mail-pf1-x442.google.com with SMTP id v12so5644684pfn.10; Thu, 22 Aug 2019 22:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CF5LAXvqy27pBaxWSa0qEfSbtTDWiQsPKTDnUOQ/efE=; b=WkvoQeyEKkUMD/O4pglKlwnzCF/ehhZjMV4qiGmuALexWQaqfyiTxT4CsJyv1Navsi bPj9aNC6l0n1DNcdcmoU5pbzb5RzT0J6t6THLOUQNXR7kbchj7mwhF0mHz7Asu6w5kWr uSRdbNKDXhYEieslGAKaPROzOUtuhuv8mjhkTceOQr2A88tCPrc3udgNuRdB5pGErc94 JC/kd3RwIa7TDsuZ8gwKLkzeOupUC87QxsR6froKQ6mkI13F/bAy+G6Tp5BpI2S45uRx Y3w+FTR/yNy/wecrsgV7wpfM+cu4q87a4o+mn1ZIbcdW3Cdenx1GD0nK41iMLfsyCpG+ LCrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CF5LAXvqy27pBaxWSa0qEfSbtTDWiQsPKTDnUOQ/efE=; b=sd7Jw3JQztiuplYRtXzc7tLawz3awyR9U2boPNarRzpKqZV9+5cPyjoOUtVbFMo5nB +5Pxzm4EPeBn6pHI23GoljtQjH3n6RJdce6JQpLqP5qn3wQ5h92eLzDXl+pPT5rdMkEX 5Wsiox4cnd9uImLGslDL0sJNFkmsw3tlR3FOv97yVtS8jC6EbWnnmVavU/4Dt68iRIAU nrkvNGG/bl05Spp5HV2lzkschgHT+ZQeENC0ln4vlwZNsTAyuSWsaC2x9mIAY3IKHLCQ eiUx+40hAdz/r5sYw26axDJ0i+eTIQDgoIB4H4qdumDm3OOM/gveug1eGMw9u1YsKCME zdKg== X-Gm-Message-State: APjAAAWapkJp/Bdws5xrnpqweZjFQBMAy7UIYVrP79377+Fe/b2DaSKy z/8mGe7eOxgV9CPMuvZs0Lo= X-Google-Smtp-Source: APXvYqxAeLxr7ViLPCN3OlJR1toD7w77B5rUyY1crgWABRd0pyXh2PYj42CqKVNzCTk3q4qMHXaFWg== X-Received: by 2002:a17:90a:bd0b:: with SMTP id y11mr3120737pjr.141.1566537090846; Thu, 22 Aug 2019 22:11:30 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.29 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:30 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:52 -0700 Message-Id: <1566537069-22741-14-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v5 13/30] riscv: Add a sifive_cpu.h to include both E and U cpu type defines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Group SiFive E and U cpu type defines into one header file. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None include/hw/riscv/sifive_cpu.h | 31 +++++++++++++++++++++++++++++++ include/hw/riscv/sifive_e.h | 7 +------ include/hw/riscv/sifive_u.h | 7 +------ 3 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 include/hw/riscv/sifive_cpu.h diff --git a/include/hw/riscv/sifive_cpu.h b/include/hw/riscv/sifive_cpu.h new file mode 100644 index 0000000..1367996 --- /dev/null +++ b/include/hw/riscv/sifive_cpu.h @@ -0,0 +1,31 @@ +/* + * SiFive CPU types + * + * Copyright (c) 2017 SiFive, Inc. + * Copyright (c) 2019 Bin Meng + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef HW_SIFIVE_CPU_H +#define HW_SIFIVE_CPU_H + +#if defined(TARGET_RISCV32) +#define SIFIVE_E_CPU TYPE_RISCV_CPU_SIFIVE_E31 +#define SIFIVE_U_CPU TYPE_RISCV_CPU_SIFIVE_U34 +#elif defined(TARGET_RISCV64) +#define SIFIVE_E_CPU TYPE_RISCV_CPU_SIFIVE_E51 +#define SIFIVE_U_CPU TYPE_RISCV_CPU_SIFIVE_U54 +#endif + +#endif /* HW_SIFIVE_CPU_H */ diff --git a/include/hw/riscv/sifive_e.h b/include/hw/riscv/sifive_e.h index d175b24..e17cdfd 100644 --- a/include/hw/riscv/sifive_e.h +++ b/include/hw/riscv/sifive_e.h @@ -19,6 +19,7 @@ #ifndef HW_SIFIVE_E_H #define HW_SIFIVE_E_H +#include "hw/riscv/sifive_cpu.h" #include "hw/riscv/sifive_gpio.h" #define TYPE_RISCV_E_SOC "riscv.sifive.e.soc" @@ -83,10 +84,4 @@ enum { #define SIFIVE_E_PLIC_CONTEXT_BASE 0x200000 #define SIFIVE_E_PLIC_CONTEXT_STRIDE 0x1000 -#if defined(TARGET_RISCV32) -#define SIFIVE_E_CPU TYPE_RISCV_CPU_SIFIVE_E31 -#elif defined(TARGET_RISCV64) -#define SIFIVE_E_CPU TYPE_RISCV_CPU_SIFIVE_E51 -#endif - #endif diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 892f0ee..4abc621 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -20,6 +20,7 @@ #define HW_SIFIVE_U_H #include "hw/net/cadence_gem.h" +#include "hw/riscv/sifive_cpu.h" #define TYPE_RISCV_U_SOC "riscv.sifive.u.soc" #define RISCV_U_SOC(obj) \ @@ -77,10 +78,4 @@ enum { #define SIFIVE_U_PLIC_CONTEXT_BASE 0x200000 #define SIFIVE_U_PLIC_CONTEXT_STRIDE 0x1000 -#if defined(TARGET_RISCV32) -#define SIFIVE_U_CPU TYPE_RISCV_CPU_SIFIVE_U34 -#elif defined(TARGET_RISCV64) -#define SIFIVE_U_CPU TYPE_RISCV_CPU_SIFIVE_U54 -#endif - #endif From patchwork Fri Aug 23 05:10:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12DDE1709 for ; Fri, 23 Aug 2019 05:37:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD74C22CF7 for ; Fri, 23 Aug 2019 05:37:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kGvEpElU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD74C22CF7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12GQ-0005xN-8e for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:37:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44925) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rK-00049O-37 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rI-0002bR-Oe for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:33 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:46935) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rI-0002at-IS; Fri, 23 Aug 2019 01:11:32 -0400 Received: by mail-pg1-x542.google.com with SMTP id m3so5064333pgv.13; Thu, 22 Aug 2019 22:11:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=MbR9FGmtjHfjmzRf/lgM9bln6VL0g2SBm+zUiqsHiEY=; b=kGvEpElUX+2zhMLMw3BjJ/1d9W+4azjO24ZpV3T+7X0Hit11y78qdjzVmuBYb8PA+4 WfrQILNgb7TVk5FX3swmKiHlSQi1kaV94VCJVlK1ySuOjV++ImPIeU5iIP+Q1cXDPMID E5UQ7CRdT7cMbJ2w32g7efcg0gpxVJgN/88XUWrYsOxLhTp2Vhjrv3q0TmRWikJz2nBc xvzGFbZLSCo5sGRq27W5dE1fnl1C6nZ0aijYzS7gyP5xjjC8ZqSvOufoB+1EPS39dJJL SJxVtLCSeQDz185saRjnh2tl3pmRlvMzEGj6mtBYMDHBgnDepKLwGlPRauV8LDby0rMg lSDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=MbR9FGmtjHfjmzRf/lgM9bln6VL0g2SBm+zUiqsHiEY=; b=LEVz+o4vrOG4+ZHxwMoCtmKBks61DSvT+jeeFYM/sFjDSzjfgrmjchNSRA7XtEuGBD yFabPnKjc5QDIK62i+RnWxdTbp9JiSjwsSbaxSyDHkl59KvLRqJGeFtMHxhU4rrPWE8j fFbGESkqIrXAq/tBttrjhGWD16R2ul/FScC2HImtMy746MDmK1Y2fkRh+1SX577wI7Xi Pc1rTYmywJVJ6NAznDt7AkA3iyPnnlMhlIhR6HQBTwFE5WP/EELtc3LzVjBWJ5bQcQRY unNSOgUv+S1DoJ5UatQZ/yhUpDKsipc16q2WiEcSZgy9TZ+ZvAs9kC3itvsBQQzswbvf U6mA== X-Gm-Message-State: APjAAAVxwHaMSQ73fq6r3AQFcoAMDtzFuGyB20DCDJLcwENxDFXe7/Wl kcGsqczoIAI58ISvvYL2i9eYduDv X-Google-Smtp-Source: APXvYqy6ler01oD7WHuceQ6f1JkU9UwQBsXViY3P5RKYaP6YdzuVWClrlI91BqRgLXl+tw/C6Igyag== X-Received: by 2002:a17:90a:a486:: with SMTP id z6mr3202153pjp.13.1566537091815; Thu, 22 Aug 2019 22:11:31 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.30 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:31 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:53 -0700 Message-Id: <1566537069-22741-15-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v5 14/30] riscv: hart: Extract hart realize to a separate routine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Currently riscv_harts_realize() creates all harts based on the same cpu type given in the hart array property. With current implementation it can only create homogeneous harts. Exact the hart realize to a separate routine in preparation for supporting multiple hart arrays. Note the file header says the RISC-V hart array holds the state of a heterogeneous array of RISC-V harts, which is not true. Update the comment to mention homogeneous array of RISC-V harts. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/riscv_hart.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index ca69a1b..9deef869 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -3,7 +3,7 @@ * * Copyright (c) 2017 SiFive, Inc. * - * Holds the state of a heterogenous array of RISC-V harts + * Holds the state of a homogeneous array of RISC-V harts * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -37,26 +37,33 @@ static void riscv_harts_cpu_reset(void *opaque) cpu_reset(CPU(cpu)); } +static void riscv_hart_realize(RISCVHartArrayState *s, int idx, + char *cpu_type, Error **errp) +{ + Error *err = NULL; + + object_initialize_child(OBJECT(s), "harts[*]", &s->harts[idx], + sizeof(RISCVCPU), cpu_type, + &error_abort, NULL); + s->harts[idx].env.mhartid = idx; + qemu_register_reset(riscv_harts_cpu_reset, &s->harts[idx]); + object_property_set_bool(OBJECT(&s->harts[idx]), true, + "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } +} + static void riscv_harts_realize(DeviceState *dev, Error **errp) { RISCVHartArrayState *s = RISCV_HART_ARRAY(dev); - Error *err = NULL; int n; s->harts = g_new0(RISCVCPU, s->num_harts); for (n = 0; n < s->num_harts; n++) { - object_initialize_child(OBJECT(s), "harts[*]", &s->harts[n], - sizeof(RISCVCPU), s->cpu_type, - &error_abort, NULL); - s->harts[n].env.mhartid = n; - qemu_register_reset(riscv_harts_cpu_reset, &s->harts[n]); - object_property_set_bool(OBJECT(&s->harts[n]), true, - "realized", &err); - if (err) { - error_propagate(errp, err); - return; - } + riscv_hart_realize(s, n, s->cpu_type, errp); } } From patchwork Fri Aug 23 05:10:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9486E14DE for ; Fri, 23 Aug 2019 05:31:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 66FF22166E for ; Fri, 23 Aug 2019 05:31:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q6T3h/o6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66FF22166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12AF-0008Rk-ID for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:31:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44957) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rL-0004BK-Fn for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rK-0002cs-3l for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:35 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:34258) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rJ-0002cE-SD; Fri, 23 Aug 2019 01:11:34 -0400 Received: by mail-pf1-x443.google.com with SMTP id b24so5670181pfp.1; Thu, 22 Aug 2019 22:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=rK6bQ2zniUIO/z/SkibqxB2eBEsSw1r14Ty3qHlu68A=; b=Q6T3h/o6JqqholhBicwIdytBs4/icEqyy8+OADGdIwcI70RVmfHFcthWBxY7wsC5MB WnPNBVpzUXNcXdXWIcb9rqVXgpjYrCFtGVni1HTEo363J/IUYcOq7gHwSmZ7krddBL9K GryIR2co9afZUO8AgXMsm4MEQdmTpEoNh6o5pD0LKHrG2Rs/bPhOwFNTTTxKZD5ifglU nWZRVJNf9uQlsLdcWMtc5F43u6YhN9nvuCXXqiDxWFwiKrLvwhVBd6NdUszX15NV/aVw pJxbvIoLioahth1uH5uQ5iRosx3zhcV9dBZ/73Oq0h6cyfxSVPBr2fY5yp6fzptqiDYD mZ6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=rK6bQ2zniUIO/z/SkibqxB2eBEsSw1r14Ty3qHlu68A=; b=G3zVn8IJ8iWuyCWDhxaUj70ir9x/dCCAmEkX6KDE7QoV2B/zkMi0xyzHEp+mFbTq2L ekCnya4BXMR/ZSqrb8vR79i3JLvl24S+9cJ7s7p00uNtQ2jDRaPKCBbYdVQlp+GQTStx DJf2nPeYOgayuedm7pru1qfcOlt2WJlpmL5IXafEc0BtoB7hbkZwlZUU6cbG9wwwOmaD F+dQQG4TIWicL7pibMOVEQMfHXNGzGXvgF6NRfGsMsjFf6PNw6EETVfg8IQcPr81LyQ3 37/RV2ckLhY5adAUGiJMndSof0+c1nGAunaudEva0ydxD5z0ZtXGqKmyAAlGgjm7BmV2 Ac+A== X-Gm-Message-State: APjAAAXEMzLEixrrA1M5TP541gzipqjfIav0XuOBXD3N/gqp/B7CPCHY 0IXNCTULATXN3OBpbKIt6XQ= X-Google-Smtp-Source: APXvYqzDnqEYakEQNaRge7K9WVN3k6nOYPB08t/A0GpuKdXsxApDdCsf52iTDd31Y//2o1+rdoygeg== X-Received: by 2002:a63:9249:: with SMTP id s9mr2280498pgn.356.1566537092974; Thu, 22 Aug 2019 22:11:32 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.31 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:32 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:54 -0700 Message-Id: <1566537069-22741-16-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::443 Subject: [Qemu-devel] [PATCH v5 15/30] riscv: hart: Add a "hartid-base" property to RISC-V hart array X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" At present each hart's hartid in a RISC-V hart array is assigned the same value of its index in the hart array. But for a system that has multiple hart arrays, this is not the case any more. Add a new "hartid-base" property so that hartid number can be assigned based on the property value. Signed-off-by: Bin Meng --- Changes in v5: None Changes in v4: - new patch to add a "hartid-base" property to RISC-V hart array Changes in v3: None Changes in v2: None hw/riscv/riscv_hart.c | 8 +++++--- include/hw/riscv/riscv_hart.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index 9deef869..52ab86a 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -27,6 +27,7 @@ static Property riscv_harts_props[] = { DEFINE_PROP_UINT32("num-harts", RISCVHartArrayState, num_harts, 1), + DEFINE_PROP_UINT32("hartid-base", RISCVHartArrayState, hartid_base, 0), DEFINE_PROP_STRING("cpu-type", RISCVHartArrayState, cpu_type), DEFINE_PROP_END_OF_LIST(), }; @@ -37,7 +38,7 @@ static void riscv_harts_cpu_reset(void *opaque) cpu_reset(CPU(cpu)); } -static void riscv_hart_realize(RISCVHartArrayState *s, int idx, +static void riscv_hart_realize(RISCVHartArrayState *s, int idx, uint32_t hartid, char *cpu_type, Error **errp) { Error *err = NULL; @@ -45,7 +46,7 @@ static void riscv_hart_realize(RISCVHartArrayState *s, int idx, object_initialize_child(OBJECT(s), "harts[*]", &s->harts[idx], sizeof(RISCVCPU), cpu_type, &error_abort, NULL); - s->harts[idx].env.mhartid = idx; + s->harts[idx].env.mhartid = hartid; qemu_register_reset(riscv_harts_cpu_reset, &s->harts[idx]); object_property_set_bool(OBJECT(&s->harts[idx]), true, "realized", &err); @@ -58,12 +59,13 @@ static void riscv_hart_realize(RISCVHartArrayState *s, int idx, static void riscv_harts_realize(DeviceState *dev, Error **errp) { RISCVHartArrayState *s = RISCV_HART_ARRAY(dev); + uint32_t hartid = s->hartid_base; int n; s->harts = g_new0(RISCVCPU, s->num_harts); for (n = 0; n < s->num_harts; n++) { - riscv_hart_realize(s, n, s->cpu_type, errp); + riscv_hart_realize(s, n, hartid + n, s->cpu_type, errp); } } diff --git a/include/hw/riscv/riscv_hart.h b/include/hw/riscv/riscv_hart.h index 0671d88..1984e30 100644 --- a/include/hw/riscv/riscv_hart.h +++ b/include/hw/riscv/riscv_hart.h @@ -32,6 +32,7 @@ typedef struct RISCVHartArrayState { /*< public >*/ uint32_t num_harts; + uint32_t hartid_base; char *cpu_type; RISCVCPU *harts; } RISCVHartArrayState; From patchwork Fri Aug 23 05:10:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110593 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8FE8914DE for ; Fri, 23 Aug 2019 05:31:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 568372166E for ; Fri, 23 Aug 2019 05:31:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GXhv4NUk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 568372166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12AM-00005Y-Rr for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:31:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45020) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rN-0004EO-JW for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rL-0002e7-F4 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:37 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:44967) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rL-0002dT-64; Fri, 23 Aug 2019 01:11:35 -0400 Received: by mail-pl1-x641.google.com with SMTP id t14so4863400plr.11; Thu, 22 Aug 2019 22:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=2N3MMQbYegU5OKFwZyOm9rmR6mP/9YQI4z2n6x0ztbw=; b=GXhv4NUkT9988N2SCjg0ajJ4pfkM+Wub5HT4vaZWt1SXvtams/pQfzpNMGUJQJ2pAz n79al6oBLFzLEDOsq7h9rrJbRvHq7aSpCUlo7uxW7nI3WCu+36OLHdzMNGjFzmqq0x37 Asafu1YKJJQL7hTSJf1xoMSMYxSu0IFep6tzy5tKz77232RbUiqRnBBVIP9c+q+hiFMb xDRxA4ettpWeeWlv5lZgh9XA06ndmIkWZiS2aGpyTgyoC/UJmF6Ir1l38axmxfaHHg3v /lDpM1Wz1Y3C8oi+rU1sdwzsj7b03hKdOyfkvf+B7+CmjlNyeol4JcCZ98EdS60Bxwl4 BFCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=2N3MMQbYegU5OKFwZyOm9rmR6mP/9YQI4z2n6x0ztbw=; b=ekHQd+BOrEmxn4DazuE/DHIbFKdCXEFAyEBuaxKhxGtnYMhszJ5/gAtduydZAL4/1B VyBRQ0j2RoP/HCWkdshJb0UAFPFLbS/RgxFloh+AjEe76+zUwKUz4KMUcJSfZBCoULyD KXExYKbg1fSq/g6xOeDRzGvRY1rPPFdFVwgX381MqtOGaJpLRjTouYs1NqcDgYVzlE4H tK2SNdGdtzlzyUiMbsywGC6MMzrvFCXfGRk+cQflKDf7qA2rxkl7zCfU6jRfnyGz7pIm 6P38Ht7qA7GDKv4CjFeDgqWNUqLZQK6hBQKW96/mgcajkY6T7aMuJ8eYLXhaPP4/ZNbJ feXA== X-Gm-Message-State: APjAAAVAxWmcCu+nA9tl8uIIq3PaXVmEQZYJlRaLsHbhTmNb4Vyu+AvA y+TT+5UraTE7dG9mVIqeaGk= X-Google-Smtp-Source: APXvYqx1F/a9gV1y7WDV8D/9BkJXR4GtPmbJbuwyAHSJC17FtrAw2Ty6fLo0FsKEWQH6gpXPyp6CSg== X-Received: by 2002:a17:902:b68f:: with SMTP id c15mr2686187pls.104.1566537094370; Thu, 22 Aug 2019 22:11:34 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.33 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:33 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:55 -0700 Message-Id: <1566537069-22741-17-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 16/30] riscv: sifive_u: Update hart configuration to reflect the real FU540 SoC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" The FU540-C000 includes a 64-bit E51 RISC-V core and four 64-bit U54 RISC-V cores. Currently the sifive_u machine only populates 4 U54 cores. Update the max cpu number to 5 to reflect the real hardware, by creating 2 CPU clusters as containers for RISC-V hart arrays to populate heterogeneous harts. The cpu nodes in the generated DTS have been updated as well. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - changed to create clusters for each cpu type Changes in v3: - changed to use macros for management and compute cpu count Changes in v2: - fixed the "interrupts-extended" property size hw/riscv/sifive_u.c | 102 +++++++++++++++++++++++++++++++++----------- include/hw/riscv/sifive_u.h | 8 +++- 2 files changed, 84 insertions(+), 26 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 3f58f61..0e5bbe7 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -10,7 +10,8 @@ * 1) CLINT (Core Level Interruptor) * 2) PLIC (Platform Level Interrupt Controller) * - * This board currently uses a hardcoded devicetree that indicates one hart. + * This board currently generates devicetree dynamically that indicates at most + * five harts. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -26,6 +27,7 @@ */ #include "qemu/osdep.h" +#include "qemu/cutils.h" #include "qemu/log.h" #include "qemu/error-report.h" #include "qapi/error.h" @@ -34,6 +36,7 @@ #include "hw/loader.h" #include "hw/sysbus.h" #include "hw/char/serial.h" +#include "hw/cpu/cluster.h" #include "target/riscv/cpu.h" #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_plic.h" @@ -69,6 +72,7 @@ static const struct MemmapEntry { static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint64_t mem_size, const char *cmdline) { + MachineState *ms = MACHINE(qdev_get_machine()); void *fdt; int cpu; uint32_t *cells; @@ -109,15 +113,21 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, "/cpus", "#size-cells", 0x0); qemu_fdt_setprop_cell(fdt, "/cpus", "#address-cells", 0x1); - for (cpu = s->soc.cpus.num_harts - 1; cpu >= 0; cpu--) { + for (cpu = ms->smp.cpus - 1; cpu >= 0; cpu--) { int cpu_phandle = phandle++; nodename = g_strdup_printf("/cpus/cpu@%d", cpu); char *intc = g_strdup_printf("/cpus/cpu@%d/interrupt-controller", cpu); - char *isa = riscv_isa_string(&s->soc.cpus.harts[cpu]); + char *isa; qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", SIFIVE_U_CLOCK_FREQ); - qemu_fdt_setprop_string(fdt, nodename, "mmu-type", "riscv,sv48"); + /* cpu 0 is the management hart that does not have mmu */ + if (cpu != 0) { + qemu_fdt_setprop_string(fdt, nodename, "mmu-type", "riscv,sv48"); + isa = riscv_isa_string(&s->soc.u_cpus.harts[cpu - 1]); + } else { + isa = riscv_isa_string(&s->soc.e_cpus.harts[0]); + } qemu_fdt_setprop_string(fdt, nodename, "riscv,isa", isa); qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv"); qemu_fdt_setprop_string(fdt, nodename, "status", "okay"); @@ -133,8 +143,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(nodename); } - cells = g_new0(uint32_t, s->soc.cpus.num_harts * 4); - for (cpu = 0; cpu < s->soc.cpus.num_harts; cpu++) { + cells = g_new0(uint32_t, ms->smp.cpus * 4); + for (cpu = 0; cpu < ms->smp.cpus; cpu++) { nodename = g_strdup_printf("/cpus/cpu@%d/interrupt-controller", cpu); uint32_t intc_phandle = qemu_fdt_get_phandle(fdt, nodename); @@ -152,20 +162,26 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, 0x0, memmap[SIFIVE_U_CLINT].base, 0x0, memmap[SIFIVE_U_CLINT].size); qemu_fdt_setprop(fdt, nodename, "interrupts-extended", - cells, s->soc.cpus.num_harts * sizeof(uint32_t) * 4); + cells, ms->smp.cpus * sizeof(uint32_t) * 4); g_free(cells); g_free(nodename); plic_phandle = phandle++; - cells = g_new0(uint32_t, s->soc.cpus.num_harts * 4); - for (cpu = 0; cpu < s->soc.cpus.num_harts; cpu++) { + cells = g_new0(uint32_t, ms->smp.cpus * 4 - 2); + for (cpu = 0; cpu < ms->smp.cpus; cpu++) { nodename = g_strdup_printf("/cpus/cpu@%d/interrupt-controller", cpu); uint32_t intc_phandle = qemu_fdt_get_phandle(fdt, nodename); - cells[cpu * 4 + 0] = cpu_to_be32(intc_phandle); - cells[cpu * 4 + 1] = cpu_to_be32(IRQ_M_EXT); - cells[cpu * 4 + 2] = cpu_to_be32(intc_phandle); - cells[cpu * 4 + 3] = cpu_to_be32(IRQ_S_EXT); + /* cpu 0 is the management hart that does not have S-mode */ + if (cpu == 0) { + cells[0] = cpu_to_be32(intc_phandle); + cells[1] = cpu_to_be32(IRQ_M_EXT); + } else { + cells[cpu * 4 - 2] = cpu_to_be32(intc_phandle); + cells[cpu * 4 - 1] = cpu_to_be32(IRQ_M_EXT); + cells[cpu * 4 + 0] = cpu_to_be32(intc_phandle); + cells[cpu * 4 + 1] = cpu_to_be32(IRQ_S_EXT); + } g_free(nodename); } nodename = g_strdup_printf("/soc/interrupt-controller@%lx", @@ -175,7 +191,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_string(fdt, nodename, "compatible", "riscv,plic0"); qemu_fdt_setprop(fdt, nodename, "interrupt-controller", NULL, 0); qemu_fdt_setprop(fdt, nodename, "interrupts-extended", - cells, s->soc.cpus.num_harts * sizeof(uint32_t) * 4); + cells, (ms->smp.cpus * 4 - 2) * sizeof(uint32_t)); qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_PLIC].base, 0x0, memmap[SIFIVE_U_PLIC].size); @@ -338,12 +354,39 @@ static void riscv_sifive_u_soc_init(Object *obj) MachineState *ms = MACHINE(qdev_get_machine()); SiFiveUSoCState *s = RISCV_U_SOC(obj); - object_initialize_child(obj, "cpus", &s->cpus, sizeof(s->cpus), - TYPE_RISCV_HART_ARRAY, &error_abort, NULL); - object_property_set_str(OBJECT(&s->cpus), SIFIVE_U_CPU, "cpu-type", - &error_abort); - object_property_set_int(OBJECT(&s->cpus), ms->smp.cpus, "num-harts", - &error_abort); + object_initialize_child(obj, "e-cluster", &s->e_cluster, + sizeof(s->e_cluster), TYPE_CPU_CLUSTER, + &error_abort, NULL); + qdev_prop_set_uint32(DEVICE(&s->e_cluster), "cluster-id", 0); + + object_initialize_child(OBJECT(&s->e_cluster), "e-cpus", + &s->e_cpus, sizeof(s->e_cpus), + TYPE_RISCV_HART_ARRAY, &error_abort, + NULL); + object_property_set_uint(OBJECT(&s->e_cpus), 1, + "num-harts", &error_abort); + object_property_set_uint(OBJECT(&s->e_cpus), 0, + "hartid-base", &error_abort); + object_property_set_str(OBJECT(&s->e_cpus), SIFIVE_E_CPU, + "cpu-type", &error_abort); + + if (ms->smp.cpus > 1) { + object_initialize_child(obj, "u-cluster", &s->u_cluster, + sizeof(s->u_cluster), TYPE_CPU_CLUSTER, + &error_abort, NULL); + qdev_prop_set_uint32(DEVICE(&s->u_cluster), "cluster-id", 1); + + object_initialize_child(OBJECT(&s->u_cluster), "u-cpus", + &s->u_cpus, sizeof(s->u_cpus), + TYPE_RISCV_HART_ARRAY, &error_abort, + NULL); + object_property_set_uint(OBJECT(&s->u_cpus), ms->smp.cpus - 1, + "num-harts", &error_abort); + object_property_set_uint(OBJECT(&s->u_cpus), 1, + "hartid-base", &error_abort); + object_property_set_str(OBJECT(&s->u_cpus), SIFIVE_U_CPU, + "cpu-type", &error_abort); + } sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem), TYPE_CADENCE_GEM); @@ -363,7 +406,19 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) Error *err = NULL; NICInfo *nd = &nd_table[0]; - object_property_set_bool(OBJECT(&s->cpus), true, "realized", + object_property_set_bool(OBJECT(&s->e_cpus), true, "realized", + &error_abort); + object_property_set_bool(OBJECT(&s->u_cpus), true, "realized", + &error_abort); + /* + * The cluster must be realized after the RISC-V hart array container, + * as the container's CPU object is only created on realize, and the + * CPU must exist and have been parented into the cluster before the + * cluster is realized. + */ + object_property_set_bool(OBJECT(&s->e_cluster), true, "realized", + &error_abort); + object_property_set_bool(OBJECT(&s->u_cluster), true, "realized", &error_abort); /* boot rom */ @@ -429,10 +484,7 @@ static void riscv_sifive_u_machine_init(MachineClass *mc) { mc->desc = "RISC-V Board compatible with SiFive U SDK"; mc->init = riscv_sifive_u_init; - /* The real hardware has 5 CPUs, but one of them is a small embedded power - * management CPU. - */ - mc->max_cpus = 4; + mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT; } DEFINE_MACHINE("sifive_u", riscv_sifive_u_machine_init) diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 4abc621..7a1a4f3 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -31,7 +31,10 @@ typedef struct SiFiveUSoCState { SysBusDevice parent_obj; /*< public >*/ - RISCVHartArrayState cpus; + CPUClusterState e_cluster; + CPUClusterState u_cluster; + RISCVHartArrayState e_cpus; + RISCVHartArrayState u_cpus; DeviceState *plic; CadenceGEMState gem; } SiFiveUSoCState; @@ -68,6 +71,9 @@ enum { SIFIVE_U_GEM_CLOCK_FREQ = 125000000 }; +#define SIFIVE_U_MANAGEMENT_CPU_COUNT 1 +#define SIFIVE_U_COMPUTE_CPU_COUNT 4 + #define SIFIVE_U_PLIC_HART_CONFIG "MS" #define SIFIVE_U_PLIC_NUM_SOURCES 54 #define SIFIVE_U_PLIC_NUM_PRIORITIES 7 From patchwork Fri Aug 23 05:10:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110569 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AEDED14DE for ; Fri, 23 Aug 2019 05:18:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 85F7D206BA for ; Fri, 23 Aug 2019 05:18:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kFX1hSq5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85F7D206BA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11xq-000371-RQ for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:18:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45022) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rN-0004EY-Hq for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rM-0002ep-9N for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:37 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:34322) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rM-0002eI-3e; Fri, 23 Aug 2019 01:11:36 -0400 Received: by mail-pg1-x542.google.com with SMTP id n9so5100817pgc.1; Thu, 22 Aug 2019 22:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=w3+CZBUY4GZi4/tMEq4QSlu25Shg1y3L2OpYpI0AQag=; b=kFX1hSq59UN7lx+v0cz6IRqC995/M/TlwDljLecVXVU479focWWtCEhNxgs72/o9a0 z3Hpglu/KOCHqW9PyzCZrOBVOarGM0eJ1Fz3DKTSGgQJdZIlb3BVAu0O8ZcpPFXZHmOn EZrvHC0TAUnAcq2U4u6AdFBvNvvoaz11fvn71nW4yi73ir7i9JIG1YmDN072xuTeSNEk 0Yu02xx8NXzWVdrjAX8XR5Y3UJOx5oQuuWuPdbxXmBb3lVHkYPDCfWFBAmdywm2+BInB WIz3Fz8PuJUg/gkEO0YPgTPpX5fkWUohSMOE/VeZrtLivzrw6ayyxYDkc+7wbv9Ic0+o tqdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=w3+CZBUY4GZi4/tMEq4QSlu25Shg1y3L2OpYpI0AQag=; b=Bvm/tpoUR5wa2fBYtgU8Zl9ebblJwm5Zb/dBk6vvX1qWVX4yAhxNN6c1DeIdGCjiw7 R9g7mIfMLVWrixcOEIpJwhXz2RG0NonkxDymOg3YVGZ/8J2ErpyltK7ZwKih1HdC7m7U mhyPj/jnJkaRof1Bo81rQjQxv1wSRsckyOL91hmxRiEBlUJtxrbQ1HVHNaev069dHpKm fRC0zS6uljfVFKAzrFMoQMhwZFWVtKjJuZHcSPbq95puQuB6YK4AFcx/KwWOHkzSf+/t ZgT4u257wcjOTlj+rKg50xUg7N6lIsquu+8BJ9cIA7dhEuld71IwAUyf5BJNWi743I9W 4mPg== X-Gm-Message-State: APjAAAWxttn+QiPi28lFFi4HQGt8phdGPHRelNk2Ybr2tt3l6IeXJkzq cmh/zEdwuLweANXGXYO5DtA= X-Google-Smtp-Source: APXvYqyhhEseIuN1ApAxR1RNODlzhF1gc6vMKnKZnYRtDQk7SGcCfx9mwmfjpVQztNQbk9kPViusCQ== X-Received: by 2002:a17:90a:dc82:: with SMTP id j2mr3370273pjv.89.1566537095317; Thu, 22 Aug 2019 22:11:35 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.34 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:34 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:56 -0700 Message-Id: <1566537069-22741-18-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v5 17/30] riscv: sifive_u: Set the minimum number of cpus to 2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" It is not useful if we only have one management CPU. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: - use management cpu count + 1 for the min_cpus Changes in v2: - update the file header to indicate at least 2 harts are created hw/riscv/sifive_u.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 0e5bbe7..a36cd77 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -10,8 +10,8 @@ * 1) CLINT (Core Level Interruptor) * 2) PLIC (Platform Level Interrupt Controller) * - * This board currently generates devicetree dynamically that indicates at most - * five harts. + * This board currently generates devicetree dynamically that indicates at least + * two harts and up to five harts. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -485,6 +485,7 @@ static void riscv_sifive_u_machine_init(MachineClass *mc) mc->desc = "RISC-V Board compatible with SiFive U SDK"; mc->init = riscv_sifive_u_init; mc->max_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + SIFIVE_U_COMPUTE_CPU_COUNT; + mc->min_cpus = SIFIVE_U_MANAGEMENT_CPU_COUNT + 1; } DEFINE_MACHINE("sifive_u", riscv_sifive_u_machine_init) From patchwork Fri Aug 23 05:10:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110585 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3F3B114DE for ; Fri, 23 Aug 2019 05:27:19 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 151D722CEC for ; Fri, 23 Aug 2019 05:27:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e0erAWMb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 151D722CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i126X-00040T-O5 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:27:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45041) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rO-0004Fl-KT for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rN-0002g1-Co for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:38 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:41449) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rN-0002fK-7g; Fri, 23 Aug 2019 01:11:37 -0400 Received: by mail-pl1-x643.google.com with SMTP id m9so4865882pls.8; Thu, 22 Aug 2019 22:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=vFL9pFsIs9sJrXtRvVXkU9BHVYq9aXFolVuGiEq9k4M=; b=e0erAWMbHCznFH3czaDm0aAmVivyMu8XfPXOx6h78szbcXhX25qzS8wH88CuaAGjGQ aTDMx1nZKA571ZDWyQnOW/pxmAghpmV5qTIzwUHIBZnHFpxx2cuNrTUG3cYzbw6oczqH Lf1PkKm7v5JsqHGRzRtMm5GNr1KOIIuiazW2y2t6mgEUE+nNsRpGn9JKYeKhpTJTAu+H vRJDreUb+H80DQSchmQG89Cw7UBjtA4zjgXPOj8Ham5EYUg134jL2M+9vUUHKBQV3oBP Qs63HHjLYFropwHOCC+MhzpgbmF22hOg0p3Y3QzNVBPCRFnITNX4hAdtmc61hgp2IBX0 +/KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=vFL9pFsIs9sJrXtRvVXkU9BHVYq9aXFolVuGiEq9k4M=; b=SEgHxAfc9x5E6P//7ghZlihUdyo0jeOr8tm5q9hv5Ya8qfWKwNkO3fqm3eAYlo1d1E /XC5xRtMn54mEdsEsNGOPnA/SsEN6sYBR0pZFu+WDTJ4I7uCxBtUaI+LIfb28iE+fm41 rzLsjPWlErhEDfYthmfO8o8KBTeN7YyI55Io5ESry0WsLtLeHeJwoJuSzBh421nmDDEQ L/FtUq3fT+4kai/PuXS3pASP6ZExHlQMotAcU8Hjn+TfyHzrR+aSNLG2Be6d+iX3IsZJ vHm/NIp5XKaek3kJYTqK4EkCyb9ysgV/tx3DirQB2k9GuWHhjyWGKLlkc99SE2tqfZCR vPoQ== X-Gm-Message-State: APjAAAXuDgCB291viRjRX5OYBOaDmM2wOGtv8O3Wahr1qldqdpOf4o2Q t/J241ROhTUgfckqO8ckX0I= X-Google-Smtp-Source: APXvYqzC3D4xt5WQnMwAOOiiKT1Qgh44vUyHv+6dphJVRJjG6AOMFNSM0fnxt0HZfOMiN1ecypAP0A== X-Received: by 2002:a17:902:7083:: with SMTP id z3mr2624347plk.87.1566537096455; Thu, 22 Aug 2019 22:11:36 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:35 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:57 -0700 Message-Id: <1566537069-22741-19-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v5 18/30] riscv: sifive_u: Update PLIC hart topology configuration string X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" With heterogeneous harts config, the PLIC hart topology configuration string are "M,MS,.." because of the monitor hart #0. Suggested-by: Fabien Chouteau Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index a36cd77..284f7a5 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -433,10 +433,11 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) plic_hart_config = g_malloc0(plic_hart_config_len); for (i = 0; i < ms->smp.cpus; i++) { if (i != 0) { - strncat(plic_hart_config, ",", plic_hart_config_len); + strncat(plic_hart_config, "," SIFIVE_U_PLIC_HART_CONFIG, + plic_hart_config_len); + } else { + strncat(plic_hart_config, "M", plic_hart_config_len); } - strncat(plic_hart_config, SIFIVE_U_PLIC_HART_CONFIG, - plic_hart_config_len); plic_hart_config_len -= (strlen(SIFIVE_U_PLIC_HART_CONFIG) + 1); } From patchwork Fri Aug 23 05:10:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FB6414DE for ; Fri, 23 Aug 2019 05:23:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 158E421726 for ; Fri, 23 Aug 2019 05:23:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rKRV77YW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 158E421726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i122V-0007ke-QN for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:23:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45071) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rQ-0004II-JJ for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rO-0002hJ-PT for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:40 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:35560) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rO-0002gf-Hp; Fri, 23 Aug 2019 01:11:38 -0400 Received: by mail-pl1-x642.google.com with SMTP id gn20so4880981plb.2; Thu, 22 Aug 2019 22:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Ke0xqnJjQMt1L8CU4syHNtlZ7ggiewVILw7wVBhhngQ=; b=rKRV77YWh3d+1WjwuH3x7ulUsui9T8OBQJQGqXaNLOzndAgs5jPka3zOpaZ4sqRhlW dnmIGBfG+J/eOefrin+7sBfwaXTVtN9KtHILblVwmiU3PkZMuzQQWwWWnnWM76fQCSWu flMhP8fFq/F5k676qW0BtioztIbajVyKjmsnVlpOB3l0eLaIFE8yYprwAgaWC2gbsdlS YWNMol5It3DMVvHk1CM2E6H2/3r5rsK1xizXgeHEAQcBtohPk1XHPhtA1bnU6GhUbbBi MFcOrD+1IDzRaJq+0NtuWGmHC3DWE7Ku6cfaCPgpUE8mmCEb0ypF3yswxTCgZ/qVGxnP IVoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Ke0xqnJjQMt1L8CU4syHNtlZ7ggiewVILw7wVBhhngQ=; b=jsl66YV8/SER1F0gogIMpt+xioxPU62qrCYdt7LG4kPTpKDIKls5h217rGRjBLQZYk zNalcgTNOrM+9y93CrwtTb0U24FHTMipXRT2WUSUljV22PdD5J7hGN1mP2NYvTNuljHH 7ROzZovXEgj3mKTjmUK6EX33kK2FNTarpjEYlMB2DIW0OsS8uqyz+f87JukD1cjpcLTO lPZh3BgXroE1Hl6yIiFiF0PgvLrC1ejYS3y/amwcS14kzOBToPFlA6rnJRqCUu5nd6bB s2E3kiCY+hEsviFV42rEak7V8Pf0ho1pe374vedajqP6QKydPW64M2w+dw2rGVauUnmL lW5g== X-Gm-Message-State: APjAAAXyiPfvM1uLsrE1SkGay7XIOJlZmMlQyWSFalaxFt7nEeaaE+P1 aPvSZwrgw+ZuRa7UdQk517c= X-Google-Smtp-Source: APXvYqyWADp9yfLH/rTGhRDEGnGf6Q6VUqyjQEiabZFAz42WUWBbzDC/iuk40OSEivOBa/MSUT6V9w== X-Received: by 2002:a17:902:9348:: with SMTP id g8mr2721092plp.18.1566537097727; Thu, 22 Aug 2019 22:11:37 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:36 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:58 -0700 Message-Id: <1566537069-22741-20-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v5 19/30] riscv: sifive: Implement PRCI model for FU540 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This adds a simple PRCI model for FU540 (sifive_u). It has different register layout from the existing PRCI model for FE310 (sifive_e). Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: - change to use defines instead of enums - change to use qemu_log_mask(LOG_GUEST_ERROR,...) in sifive_u_prci - creating a 32-bit val variable and using that instead of casting everywhere in sifive_u_prci_write() - move all register initialization to sifive_u_prci_reset() function - drop sifive_u_prci_create() - s/codes that worked/code that works/g Changes in v4: - prefix all macros/variables/functions with SIFIVE_U/sifive_u in the sifive_u_prci driver Changes in v3: None Changes in v2: None hw/riscv/Makefile.objs | 1 + hw/riscv/sifive_u_prci.c | 171 +++++++++++++++++++++++++++++++++++++++ include/hw/riscv/sifive_u_prci.h | 81 +++++++++++++++++++ 3 files changed, 253 insertions(+) create mode 100644 hw/riscv/sifive_u_prci.c create mode 100644 include/hw/riscv/sifive_u_prci.h diff --git a/hw/riscv/Makefile.objs b/hw/riscv/Makefile.objs index c859697..b95bbd5 100644 --- a/hw/riscv/Makefile.objs +++ b/hw/riscv/Makefile.objs @@ -8,6 +8,7 @@ obj-$(CONFIG_SIFIVE) += sifive_gpio.o obj-$(CONFIG_SIFIVE) += sifive_plic.o obj-$(CONFIG_SIFIVE) += sifive_test.o obj-$(CONFIG_SIFIVE_U) += sifive_u.o +obj-$(CONFIG_SIFIVE_U) += sifive_u_prci.o obj-$(CONFIG_SIFIVE) += sifive_uart.o obj-$(CONFIG_SPIKE) += spike.o obj-$(CONFIG_RISCV_VIRT) += virt.o diff --git a/hw/riscv/sifive_u_prci.c b/hw/riscv/sifive_u_prci.c new file mode 100644 index 0000000..c6438fb --- /dev/null +++ b/hw/riscv/sifive_u_prci.c @@ -0,0 +1,171 @@ +/* + * QEMU SiFive U PRCI (Power, Reset, Clock, Interrupt) + * + * Copyright (c) 2019 Bin Meng + * + * Simple model of the PRCI to emulate register reads made by the SDK BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "hw/riscv/sifive_u_prci.h" + +static uint64_t sifive_u_prci_read(void *opaque, hwaddr addr, unsigned int size) +{ + SiFiveUPRCIState *s = opaque; + + switch (addr) { + case SIFIVE_U_PRCI_HFXOSCCFG: + return s->hfxosccfg; + case SIFIVE_U_PRCI_COREPLLCFG0: + return s->corepllcfg0; + case SIFIVE_U_PRCI_DDRPLLCFG0: + return s->ddrpllcfg0; + case SIFIVE_U_PRCI_DDRPLLCFG1: + return s->ddrpllcfg1; + case SIFIVE_U_PRCI_GEMGXLPLLCFG0: + return s->gemgxlpllcfg0; + case SIFIVE_U_PRCI_GEMGXLPLLCFG1: + return s->gemgxlpllcfg1; + case SIFIVE_U_PRCI_CORECLKSEL: + return s->coreclksel; + case SIFIVE_U_PRCI_DEVICESRESET: + return s->devicesreset; + case SIFIVE_U_PRCI_CLKMUXSTATUS: + return s->clkmuxstatus; + } + + qemu_log_mask(LOG_GUEST_ERROR, "%s: read: addr=0x%x\n", + __func__, (int)addr); + + return 0; +} + +static void sifive_u_prci_write(void *opaque, hwaddr addr, + uint64_t val64, unsigned int size) +{ + SiFiveUPRCIState *s = opaque; + uint32_t val32 = (uint32_t)val64; + + switch (addr) { + case SIFIVE_U_PRCI_HFXOSCCFG: + s->hfxosccfg = val32; + /* OSC stays ready */ + s->hfxosccfg |= SIFIVE_U_PRCI_HFXOSCCFG_RDY; + break; + case SIFIVE_U_PRCI_COREPLLCFG0: + s->corepllcfg0 = val32; + /* internal feedback */ + s->corepllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_FSE; + /* PLL stays locked */ + s->corepllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_LOCK; + break; + case SIFIVE_U_PRCI_DDRPLLCFG0: + s->ddrpllcfg0 = val32; + /* internal feedback */ + s->ddrpllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_FSE; + /* PLL stays locked */ + s->ddrpllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_LOCK; + break; + case SIFIVE_U_PRCI_DDRPLLCFG1: + s->ddrpllcfg1 = val32; + break; + case SIFIVE_U_PRCI_GEMGXLPLLCFG0: + s->gemgxlpllcfg0 = val32; + /* internal feedback */ + s->gemgxlpllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_FSE; + /* PLL stays locked */ + s->gemgxlpllcfg0 |= SIFIVE_U_PRCI_PLLCFG0_LOCK; + break; + case SIFIVE_U_PRCI_GEMGXLPLLCFG1: + s->gemgxlpllcfg1 = val32; + break; + case SIFIVE_U_PRCI_CORECLKSEL: + s->coreclksel = val32; + break; + case SIFIVE_U_PRCI_DEVICESRESET: + s->devicesreset = val32; + break; + case SIFIVE_U_PRCI_CLKMUXSTATUS: + s->clkmuxstatus = val32; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad write: addr=0x%x v=0x%x\n", + __func__, (int)addr, (int)val64); + } +} + +static const MemoryRegionOps sifive_u_prci_ops = { + .read = sifive_u_prci_read, + .write = sifive_u_prci_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4 + } +}; + +static void sifive_u_prci_realize(DeviceState *dev, Error **errp) +{ + SiFiveUPRCIState *s = SIFIVE_U_PRCI(dev); + + memory_region_init_io(&s->mmio, OBJECT(dev), &sifive_u_prci_ops, s, + TYPE_SIFIVE_U_PRCI, SIFIVE_U_PRCI_REG_SIZE); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); +} + +static void sifive_u_prci_reset(DeviceState *dev) +{ + SiFiveUPRCIState *s = SIFIVE_U_PRCI(dev); + + /* Initialize register to power-on-reset values */ + s->hfxosccfg = (SIFIVE_U_PRCI_HFXOSCCFG_RDY | SIFIVE_U_PRCI_HFXOSCCFG_EN); + s->corepllcfg0 = (SIFIVE_U_PRCI_PLLCFG0_DIVR | SIFIVE_U_PRCI_PLLCFG0_DIVF | + SIFIVE_U_PRCI_PLLCFG0_DIVQ | SIFIVE_U_PRCI_PLLCFG0_FSE | + SIFIVE_U_PRCI_PLLCFG0_LOCK); + s->ddrpllcfg0 = (SIFIVE_U_PRCI_PLLCFG0_DIVR | SIFIVE_U_PRCI_PLLCFG0_DIVF | + SIFIVE_U_PRCI_PLLCFG0_DIVQ | SIFIVE_U_PRCI_PLLCFG0_FSE | + SIFIVE_U_PRCI_PLLCFG0_LOCK); + s->gemgxlpllcfg0 = (SIFIVE_U_PRCI_PLLCFG0_DIVR | + SIFIVE_U_PRCI_PLLCFG0_DIVF | + SIFIVE_U_PRCI_PLLCFG0_DIVQ | + SIFIVE_U_PRCI_PLLCFG0_FSE | + SIFIVE_U_PRCI_PLLCFG0_LOCK); + s->coreclksel = SIFIVE_U_PRCI_CORECLKSEL_HFCLK; +} + +static void sifive_u_prci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = sifive_u_prci_realize; + dc->reset = sifive_u_prci_reset; +} + +static const TypeInfo sifive_u_prci_info = { + .name = TYPE_SIFIVE_U_PRCI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SiFiveUPRCIState), + .class_init = sifive_u_prci_class_init, +}; + +static void sifive_u_prci_register_types(void) +{ + type_register_static(&sifive_u_prci_info); +} + +type_init(sifive_u_prci_register_types) diff --git a/include/hw/riscv/sifive_u_prci.h b/include/hw/riscv/sifive_u_prci.h new file mode 100644 index 0000000..60a2eab --- /dev/null +++ b/include/hw/riscv/sifive_u_prci.h @@ -0,0 +1,81 @@ +/* + * QEMU SiFive U PRCI (Power, Reset, Clock, Interrupt) interface + * + * Copyright (c) 2019 Bin Meng + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef HW_SIFIVE_U_PRCI_H +#define HW_SIFIVE_U_PRCI_H + +#define SIFIVE_U_PRCI_HFXOSCCFG 0x00 +#define SIFIVE_U_PRCI_COREPLLCFG0 0x04 +#define SIFIVE_U_PRCI_DDRPLLCFG0 0x0C +#define SIFIVE_U_PRCI_DDRPLLCFG1 0x10 +#define SIFIVE_U_PRCI_GEMGXLPLLCFG0 0x1C +#define SIFIVE_U_PRCI_GEMGXLPLLCFG1 0x20 +#define SIFIVE_U_PRCI_CORECLKSEL 0x24 +#define SIFIVE_U_PRCI_DEVICESRESET 0x28 +#define SIFIVE_U_PRCI_CLKMUXSTATUS 0x2C + +/* + * Current FU540-C000 manual says ready bit is at bit 29, but + * freedom-u540-c000-bootloader codes (ux00prci.h) says it is at bit 31. + * We have to trust the actual code that works. + * + * see https://github.com/sifive/freedom-u540-c000-bootloader + */ + +#define SIFIVE_U_PRCI_HFXOSCCFG_EN (1 << 30) +#define SIFIVE_U_PRCI_HFXOSCCFG_RDY (1 << 31) + +/* xxxPLLCFG0 register bits */ +#define SIFIVE_U_PRCI_PLLCFG0_DIVR (1 << 0) +#define SIFIVE_U_PRCI_PLLCFG0_DIVF (31 << 6) +#define SIFIVE_U_PRCI_PLLCFG0_DIVQ (3 << 15) +#define SIFIVE_U_PRCI_PLLCFG0_FSE (1 << 25) +#define SIFIVE_U_PRCI_PLLCFG0_LOCK (1 << 31) + +/* xxxPLLCFG1 register bits */ +#define SIFIVE_U_PRCI_PLLCFG1_CKE (1 << 24) + +/* coreclksel register bits */ +#define SIFIVE_U_PRCI_CORECLKSEL_HFCLK (1 << 0) + + +#define SIFIVE_U_PRCI_REG_SIZE 0x1000 + +#define TYPE_SIFIVE_U_PRCI "riscv.sifive.u.prci" + +#define SIFIVE_U_PRCI(obj) \ + OBJECT_CHECK(SiFiveUPRCIState, (obj), TYPE_SIFIVE_U_PRCI) + +typedef struct SiFiveUPRCIState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + MemoryRegion mmio; + uint32_t hfxosccfg; + uint32_t corepllcfg0; + uint32_t ddrpllcfg0; + uint32_t ddrpllcfg1; + uint32_t gemgxlpllcfg0; + uint32_t gemgxlpllcfg1; + uint32_t coreclksel; + uint32_t devicesreset; + uint32_t clkmuxstatus; +} SiFiveUPRCIState; + +#endif /* HW_SIFIVE_U_PRCI_H */ From patchwork Fri Aug 23 05:10:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 69B6C1709 for ; Fri, 23 Aug 2019 05:42:47 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F067821019 for ; Fri, 23 Aug 2019 05:42:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Qr6AQSdr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F067821019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12LV-0003um-36 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:42:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45078) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rR-0004J9-2g for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rP-0002hc-OG for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:40 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:45677) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rP-0002hR-JI; Fri, 23 Aug 2019 01:11:39 -0400 Received: by mail-pl1-x641.google.com with SMTP id y8so4875553plr.12; Thu, 22 Aug 2019 22:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=atN1ZHYpk1IEAb15ukm54tI9j5l+MwwYtqox8t/Xbv0=; b=Qr6AQSdr454nSkkVcu6dh8LxCcH/vw3uf/SzIaknM7LJNRKJttnwzteGJgr+2axdiA 25TYGr853aY+H1z1HlS0CTXrb7OSF5joXO/rkx8c3R6QC5LhJdTO7dpPGCmhNWE9/FSa i0p9xWScfTGa2x2Aqb7kFqjK5I1I5IDigwvR/x07iIunNrftKKSDhh7l3yg8A1lrEIEH 46UbJcL5cqoySusPnLMpT3Xfvrj3P3c7P6FIhxowjFBbrhKYgBnaisngOLn5sXtQKArA pligtCkywFyEYoigr4tj6AGU1Wdj4ko9gBnYdw9VslhgaXP0j4Xa8QVv1EKGdyGy86mE YBLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=atN1ZHYpk1IEAb15ukm54tI9j5l+MwwYtqox8t/Xbv0=; b=fE+P+vur89Ind4QBMIL2U+K6nbJhTE1NGuOd52MD1JjOcU5atUgutN4KkMRzO+SBMw ITAVe3uVxVN9ta5J1Y/u3CAuF2sVcS6A7VfT43b/mKWZJVamG2L0BOq0ObfikzVAI0+2 sW71pNFc9WZV2ARYpjYUE/yFOxI2u63fGJSEMW04bVSPFbsgAr14o9b5/F450IuysnLX COT9O69O4lniJvOJuPHdp4gqbfB3/ovCACjGaJswPxcKp+ET6ZXh+Tp4ucoOB81dwhUv Hmazp5i1Bc0aTNoT3MbhORGZSugqJgeoPLwRnwSfRPEBfYF2NrsLkiT/sFnLHed09EO8 oRnA== X-Gm-Message-State: APjAAAWoKRHpxFpvBClzR6eQ4n4IE6Gng91BqyiKfxsETaCpbAhxI68Z ydY6Padr+CeRoVfGK36opWY= X-Google-Smtp-Source: APXvYqxUxjlJqwwDh/7Aa1QIEW+zx9WUl/BZNUIat6x1G2pr1koBiEP3UGtYBAdpjpQrBKu+fGfVFA== X-Received: by 2002:a17:902:bb95:: with SMTP id m21mr2623998pls.26.1566537098914; Thu, 22 Aug 2019 22:11:38 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:38 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:10:59 -0700 Message-Id: <1566537069-22741-21-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 20/30] riscv: sifive_u: Generate hfclk and rtcclk nodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" To keep in sync with Linux kernel device tree, generate hfclk and rtcclk nodes in the device tree, to be referenced by PRCI node. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 23 +++++++++++++++++++++++ include/hw/riscv/sifive_u.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 284f7a5..08db741 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -80,6 +80,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, char ethclk_names[] = "pclk\0hclk\0tx_clk"; uint32_t plic_phandle, ethclk_phandle, phandle = 1; uint32_t uartclk_phandle; + uint32_t hfclk_phandle, rtcclk_phandle; fdt = s->fdt = create_device_tree(&s->fdt_size); if (!fdt) { @@ -98,6 +99,28 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, "/soc", "#size-cells", 0x2); qemu_fdt_setprop_cell(fdt, "/soc", "#address-cells", 0x2); + hfclk_phandle = phandle++; + nodename = g_strdup_printf("/hfclk"); + qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", hfclk_phandle); + qemu_fdt_setprop_string(fdt, nodename, "clock-output-names", "hfclk"); + qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", + SIFIVE_U_HFCLK_FREQ); + qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); + qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); + g_free(nodename); + + rtcclk_phandle = phandle++; + nodename = g_strdup_printf("/rtcclk"); + qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", rtcclk_phandle); + qemu_fdt_setprop_string(fdt, nodename, "clock-output-names", "rtcclk"); + qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", + SIFIVE_U_RTCCLK_FREQ); + qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); + qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); + g_free(nodename); + nodename = g_strdup_printf("/memory@%lx", (long)memmap[SIFIVE_U_DRAM].base); qemu_fdt_add_subnode(fdt, nodename); diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 7a1a4f3..debbf28 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -68,6 +68,8 @@ enum { enum { SIFIVE_U_CLOCK_FREQ = 1000000000, + SIFIVE_U_HFCLK_FREQ = 33333333, + SIFIVE_U_RTCCLK_FREQ = 1000000, SIFIVE_U_GEM_CLOCK_FREQ = 125000000 }; From patchwork Fri Aug 23 05:11:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7E325174A for ; Fri, 23 Aug 2019 05:36:49 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A85A21848 for ; Fri, 23 Aug 2019 05:36:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iTxX3ISr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4A85A21848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12Fk-000510-DH for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:36:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45116) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rS-0004LC-Df for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rR-0002iX-0K for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:42 -0400 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:40291) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rQ-0002hu-Oy; Fri, 23 Aug 2019 01:11:40 -0400 Received: by mail-pg1-x542.google.com with SMTP id w10so5085891pgj.7; Thu, 22 Aug 2019 22:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=gzKK8rRBlaOT9StgChRk3Wx3n8XaQ040/gAsONq7Icg=; b=iTxX3ISrd3wPcwCGvHCzKa47EmS053LtTVUpfoKut+E9cZjza+Xy+N1/ioSDyFXIBr YhBsm1vueO6mN9ZZK6Wplz3IhQpHLYoXVPVHZED599OcXKyg6BghGL/tQa+es7ZfI271 2NKm4rWJH1tfbQ3AtQxoZNd9G+LEr/bHfwfM3MUUEwHRBRNvX4IGlspFM3fjH731XD7O rL/cfXFLr09gI1XWE/y15O3zQ9sZmzxSVcSntpSI+REWmKExJlNk97iE2KYEhTMjzZru mV7piE2dCZ23pNuF35i8DOK36UbUq/1Sc7J8dh3sIJ1gwcltcqrZnb2u7FyKrwYAZIGt CGrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gzKK8rRBlaOT9StgChRk3Wx3n8XaQ040/gAsONq7Icg=; b=M6qo0nmo3mrhDkbIhhfMm2ZbhNXSdHASwBr/6WLNWwbqj3FDN1nQxTCOC6BJGTLld7 6Ne0tl/bWLwxND8HqAlmLphAT6oV3K6WqVibNlx7yZMoOVyQXIu0htyLDsYI1jtJhHSe Stc2VAH37pYAbrWkvkqnpvRL1VNXGqtg4/lU9rS/Yqq/4vQS2WKEMk3pXxbYGN+PqPb6 BTlWkrxGNaIXc1jSgVMM8MgqMq5Uvxk6ZKIQF+iMYYx7FBBlQ6TIYbmQUEjskrhAlkFx hzPo194bmHGxmE+tiuz38zYI0eGcymHgUkyofpivo0hXUxQFYTL8QZhUxoS5xirLkGpE 2Y6w== X-Gm-Message-State: APjAAAVW3bApIcwIFKBm3olSEmagHDSCOQqglh6AVQzke0HaLVmzVdMY kptMbowvZnprCPCIJiQ6Ceg= X-Google-Smtp-Source: APXvYqzUkVROAwuqf0dhbGzV9R1bAmeOou24STKXk5npeJTLCo6jk1YXz3mHbFda/Xm6PY8H0vFOBA== X-Received: by 2002:a63:cc14:: with SMTP id x20mr2407421pgf.142.1566537099941; Thu, 22 Aug 2019 22:11:39 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.38 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:39 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:00 -0700 Message-Id: <1566537069-22741-22-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 Subject: [Qemu-devel] [PATCH v5 21/30] riscv: sifive_u: Add PRCI block to the SoC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Add PRCI mmio base address and size mappings to sifive_u machine, and generate the corresponding device tree node. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: - create sifive_u_prci block directly in the machine codes, instead of calling sifive_u_prci_create() Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 24 +++++++++++++++++++++++- include/hw/riscv/sifive_u.h | 3 +++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 08db741..c777d41 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -9,6 +9,7 @@ * 0) UART * 1) CLINT (Core Level Interruptor) * 2) PLIC (Platform Level Interrupt Controller) + * 3) PRCI (Power, Reset, Clock, Interrupt) * * This board currently generates devicetree dynamically that indicates at least * two harts and up to five harts. @@ -61,6 +62,7 @@ static const struct MemmapEntry { [SIFIVE_U_MROM] = { 0x1000, 0x11000 }, [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 }, [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 }, + [SIFIVE_U_PRCI] = { 0x10000000, 0x1000 }, [SIFIVE_U_UART0] = { 0x10013000, 0x1000 }, [SIFIVE_U_UART1] = { 0x10023000, 0x1000 }, [SIFIVE_U_DRAM] = { 0x80000000, 0x0 }, @@ -78,7 +80,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint32_t *cells; char *nodename; char ethclk_names[] = "pclk\0hclk\0tx_clk"; - uint32_t plic_phandle, ethclk_phandle, phandle = 1; + uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; uint32_t uartclk_phandle; uint32_t hfclk_phandle, rtcclk_phandle; @@ -189,6 +191,21 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(cells); g_free(nodename); + prci_phandle = phandle++; + nodename = g_strdup_printf("/soc/clock-controller@%lx", + (long)memmap[SIFIVE_U_PRCI].base); + qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", prci_phandle); + qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x1); + qemu_fdt_setprop_cells(fdt, nodename, "clocks", + hfclk_phandle, rtcclk_phandle); + qemu_fdt_setprop_cells(fdt, nodename, "reg", + 0x0, memmap[SIFIVE_U_PRCI].base, + 0x0, memmap[SIFIVE_U_PRCI].size); + qemu_fdt_setprop_string(fdt, nodename, "compatible", + "sifive,fu540-c000-prci"); + g_free(nodename); + plic_phandle = phandle++; cells = g_new0(uint32_t, ms->smp.cpus * 4 - 2); for (cpu = 0; cpu < ms->smp.cpus; cpu++) { @@ -411,6 +428,8 @@ static void riscv_sifive_u_soc_init(Object *obj) "cpu-type", &error_abort); } + sysbus_init_child_obj(obj, "prci", &s->prci, sizeof(s->prci), + TYPE_SIFIVE_U_PRCI); sysbus_init_child_obj(obj, "gem", &s->gem, sizeof(s->gem), TYPE_CADENCE_GEM); } @@ -484,6 +503,9 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) memmap[SIFIVE_U_CLINT].size, ms->smp.cpus, SIFIVE_SIP_BASE, SIFIVE_TIMECMP_BASE, SIFIVE_TIME_BASE); + object_property_set_bool(OBJECT(&s->prci), true, "realized", &err); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->prci), 0, memmap[SIFIVE_U_PRCI].base); + for (i = 0; i < SIFIVE_U_PLIC_NUM_SOURCES; i++) { plic_gpios[i] = qdev_get_gpio_in(DEVICE(s->plic), i); } diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index debbf28..2a023be 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -21,6 +21,7 @@ #include "hw/net/cadence_gem.h" #include "hw/riscv/sifive_cpu.h" +#include "hw/riscv/sifive_u_prci.h" #define TYPE_RISCV_U_SOC "riscv.sifive.u.soc" #define RISCV_U_SOC(obj) \ @@ -36,6 +37,7 @@ typedef struct SiFiveUSoCState { RISCVHartArrayState e_cpus; RISCVHartArrayState u_cpus; DeviceState *plic; + SiFiveUPRCIState prci; CadenceGEMState gem; } SiFiveUSoCState; @@ -54,6 +56,7 @@ enum { SIFIVE_U_MROM, SIFIVE_U_CLINT, SIFIVE_U_PLIC, + SIFIVE_U_PRCI, SIFIVE_U_UART0, SIFIVE_U_UART1, SIFIVE_U_DRAM, From patchwork Fri Aug 23 05:11:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2CCC61709 for ; Fri, 23 Aug 2019 05:40:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECDAF21019 for ; Fri, 23 Aug 2019 05:40:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OYJt1okr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECDAF21019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12JW-0001Eo-Ut for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:40:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45157) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rU-0004N0-7w for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rS-0002jP-12 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:44 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:41450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rR-0002iq-PZ; Fri, 23 Aug 2019 01:11:41 -0400 Received: by mail-pl1-x644.google.com with SMTP id m9so4865966pls.8; Thu, 22 Aug 2019 22:11:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=uZnhRt/a8KcGf4XYGxFRz+b4gB42wHE04B0Zoew5Wcg=; b=OYJt1okrdy2befdEd8v9tFPRDHeIhLeU45EYU7i0Lb/e6l93srTkBsAJsubogrUePT /UModCRhY3M483ohKGOfJf4jo3L5dZr0vxmyr4d/z/niRTMB2/A4JhLZhaYSFy8v94V5 5WmgLWz5HcXqEJ989YmRjQ7VCzanvt73fh/W5DVFG0ovQcvALbgWzjRuy2xJFLrVteDq W4oB4pTlxwv+YuJw+CjnXXNYfLf/4w8uE7PIeEovQJNHCaCeHcXsA3O2VHDEMGrxsbPJ Sv950ddQ2Enm7CFcZrJBMhWOjN/kKuyw0PG8xDwoqTHrsc5sIZ8zcKqol+hFe4KijhPu TfVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=uZnhRt/a8KcGf4XYGxFRz+b4gB42wHE04B0Zoew5Wcg=; b=nsMz/vcoMtPMe1eT4fQiBdI2/87dph16rLnQDU5n2dl0sr3B/bIrY3y04EhzRNnbrE bZA1pYpDeMR/zIdEf0ojhWf/ZhhErEnflNeHjnkOjBz0QxzfcoEui2BXmiCrXVOXQX07 GzusWgNBOQMzBPpuNTdzDw3cKij59lJt+V76KQevu4vqQuCD8leCRij3KlQAXkZmQbvk iZ/gB/Zfn/NlZFS29DV5JAIuXSKqQ0IZDcC8CoCP/XyXiQ+9JILdnErzN4qNUBxAlpFx QMUWZCkz0GwEveO0AkZ6DdUQ+abTz9KxryXEqNF9iiZhEQoVj/WUzGZUMAdSKUafxDhT Xw0w== X-Gm-Message-State: APjAAAUitJXkdbKh+LYN6UZRorZhw+smz1knL+ud2qvEHXUBu6mciXVS 2ZtIShOpPMbpyt+wWj+2z9Q= X-Google-Smtp-Source: APXvYqw9ugUqlzjZdkKKm+BBaDalO+kZ9+bNr5tgpT+0RzVxqWUsC6m59D+4ThZYQAgHS7tJikv4FQ== X-Received: by 2002:a17:902:d70a:: with SMTP id w10mr2476273ply.251.1566537101007; Thu, 22 Aug 2019 22:11:41 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.40 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:40 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:01 -0700 Message-Id: <1566537069-22741-23-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH v5 22/30] riscv: sifive_u: Reference PRCI clocks in UART and ethernet nodes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Now that we have added a PRCI node, update existing UART and ethernet nodes to reference PRCI as their clock sources, to keep in sync with the Linux kernel device tree. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 7 ++++--- include/hw/riscv/sifive_u_prci.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index c777d41..e0842ad 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -79,7 +79,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, int cpu; uint32_t *cells; char *nodename; - char ethclk_names[] = "pclk\0hclk\0tx_clk"; + char ethclk_names[] = "pclk\0hclk"; uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; uint32_t uartclk_phandle; uint32_t hfclk_phandle, rtcclk_phandle; @@ -264,7 +264,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_GEM_IRQ); qemu_fdt_setprop_cells(fdt, nodename, "clocks", - ethclk_phandle, ethclk_phandle, ethclk_phandle); + prci_phandle, PRCI_CLK_GEMGXLPLL, prci_phandle, PRCI_CLK_GEMGXLPLL); qemu_fdt_setprop(fdt, nodename, "clock-names", ethclk_names, sizeof(ethclk_names)); qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", 1); @@ -294,7 +294,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_UART0].base, 0x0, memmap[SIFIVE_U_UART0].size); - qemu_fdt_setprop_cell(fdt, nodename, "clocks", uartclk_phandle); + qemu_fdt_setprop_cells(fdt, nodename, "clocks", + prci_phandle, PRCI_CLK_TLCLK); qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_UART0_IRQ); diff --git a/include/hw/riscv/sifive_u_prci.h b/include/hw/riscv/sifive_u_prci.h index 60a2eab..0a531fd 100644 --- a/include/hw/riscv/sifive_u_prci.h +++ b/include/hw/riscv/sifive_u_prci.h @@ -78,4 +78,14 @@ typedef struct SiFiveUPRCIState { uint32_t clkmuxstatus; } SiFiveUPRCIState; +/* + * Clock indexes for use by Device Tree data and the PRCI driver. + * + * These values are from sifive-fu540-prci.h in the Linux kernel. + */ +#define PRCI_CLK_COREPLL 0 +#define PRCI_CLK_DDRPLL 1 +#define PRCI_CLK_GEMGXLPLL 2 +#define PRCI_CLK_TLCLK 3 + #endif /* HW_SIFIVE_U_PRCI_H */ From patchwork Fri Aug 23 05:11:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2BCF514DB for ; Fri, 23 Aug 2019 05:27:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 034CF22CEC for ; Fri, 23 Aug 2019 05:27:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UUotAyYz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 034CF22CEC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i126f-00049O-Kp for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:27:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45150) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rU-0004Mi-0i for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rS-0002kF-TK for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:43 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:36614) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rS-0002jg-OJ; Fri, 23 Aug 2019 01:11:42 -0400 Received: by mail-pl1-x643.google.com with SMTP id f19so4880196plr.3; Thu, 22 Aug 2019 22:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=1J7jjy8jLUWT7jcpLwJ9zh0xz5EaKI6AQkwtbjaCVzY=; b=UUotAyYzuoqtrjRbgDlMvH8CZ5zveh5MIm9NgtUgdk714iYGHtK/wBp2krheXwh3ex mqNnj7P4pcbulfkQriwjD6Cr0jkBSNyRW3HWj5os6Z7YEojvagO1KDzB67H9y2gO2wOJ kmzT3oI67QPtrs2X1Ri7W2IZSAMdLqAckGnl318QY3diVogixSRPTdYav8w8b+cR28dk P0HowbAv6DtETVdPBg3vsG2frUv/NIYQXtfL/paKqLt2IWH7ucChXoNLJuzhMBsSlcH0 Z67W2OgvoEobB9JhAH+7iYWbyWwdyV0uQECki8pVxP+/JqV2ccnyYL0IKTpAWYiGXehB UabQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=1J7jjy8jLUWT7jcpLwJ9zh0xz5EaKI6AQkwtbjaCVzY=; b=dviA88FzMoiNUlxb7B9duwW1nHPXj+dpSvwRhCe+6IWVtwapeKNC1E5MfKZEefcvAx 3EHLBAH3atU4nZGi3orhje/1skwE3ql/yLkrwAZIQEY6yxrIy9otkXayzNFIUhTD1BCY J9DSE6n/6qADI7WrHhJ0tV5VZOlGqPSwpspAa76A+M/2QcrLlux9x6JowgXI+zxAkkm3 o39qPh+t/RVs4VIKrAfpffgFuA2ZHXln2Zw2+RoRsGJkVx9AA/xtK1wL3zute7q0RePT aIMjvj4OQLtceHrWrkOUYAujwNcY3vMNJ9ZNmeZnB7H5OmsbYlreRm2ywjFrMDrdHtUk ntYA== X-Gm-Message-State: APjAAAU1K5I5qgC7J9Owtb6J6LnG7TpJVK+/V94aDa0Dx5L+Gtsc1rCd Onh5aYzdXqsCil9HIYhlx3A2AbCJ X-Google-Smtp-Source: APXvYqyaoTommV+D5Yg9Fzuutufy7IGgs16L2JxNUgw6uki3cp5e4BjjjGMPW2sYAp2J+sj6EdSiZA== X-Received: by 2002:a17:902:6b06:: with SMTP id o6mr2597405plk.33.1566537102085; Thu, 22 Aug 2019 22:11:42 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.41 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:41 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:02 -0700 Message-Id: <1566537069-22741-24-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v5 23/30] riscv: sifive_u: Update UART base addresses and IRQs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This updates the UART base address and IRQs to match the hardware. Signed-off-by: Bin Meng Reviewed-by: Jonathan Behrens Acked-by: Alistair Francis Reviewed-by: Chih-Min Chao --- Changes in v5: None Changes in v4: None Changes in v3: - update IRQ numbers of both UARTs to match hardware as well Changes in v2: None hw/riscv/sifive_u.c | 4 ++-- include/hw/riscv/sifive_u.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index e0842ad..1a178dc 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -63,8 +63,8 @@ static const struct MemmapEntry { [SIFIVE_U_CLINT] = { 0x2000000, 0x10000 }, [SIFIVE_U_PLIC] = { 0xc000000, 0x4000000 }, [SIFIVE_U_PRCI] = { 0x10000000, 0x1000 }, - [SIFIVE_U_UART0] = { 0x10013000, 0x1000 }, - [SIFIVE_U_UART1] = { 0x10023000, 0x1000 }, + [SIFIVE_U_UART0] = { 0x10010000, 0x1000 }, + [SIFIVE_U_UART1] = { 0x10011000, 0x1000 }, [SIFIVE_U_DRAM] = { 0x80000000, 0x0 }, [SIFIVE_U_GEM] = { 0x100900FC, 0x2000 }, }; diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 2a023be..b41e730 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -64,8 +64,8 @@ enum { }; enum { - SIFIVE_U_UART0_IRQ = 3, - SIFIVE_U_UART1_IRQ = 4, + SIFIVE_U_UART0_IRQ = 4, + SIFIVE_U_UART1_IRQ = 5, SIFIVE_U_GEM_IRQ = 0x35 }; From patchwork Fri Aug 23 05:11:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0D9041709 for ; Fri, 23 Aug 2019 05:37:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D6F3321848 for ; Fri, 23 Aug 2019 05:36:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QmglgkV9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D6F3321848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12Fu-0005A2-Lt for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:36:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45183) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rV-0004OT-5y for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rT-0002kw-VF for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:44 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:35561) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rT-0002kN-PV; Fri, 23 Aug 2019 01:11:43 -0400 Received: by mail-pl1-x643.google.com with SMTP id gn20so4881109plb.2; Thu, 22 Aug 2019 22:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=gZltYDF3iwdJcGYLhKT3YuPe5k+kq1mwUmYAQAVkYAc=; b=QmglgkV9i9dSU/JgxxDAna2XKFFs0e0OOy3tqwl5ihpZbqZwpD8kpNbt87bVQsze9S TdliBx1wCcgqSXvzSolXweF1i106fqDN+ILUtdiLJsyKI/LQfLDeT5BGfaQtx/XZIIqE r22o2QGJm41gJY1eVU4NXg2xRqO4bsvg8G2JxsquCKK7Waak6Iebn8T1wgXyKMLccwRT LNYaUOMOeixMkgL8LzHFbJevklaUOO5Y80ezCPHC555XLYawHu0abnySbxa/VGWsT6jn Of1eeH52be/XIjtiN0/jLF4QA4iYfzbvpIoGlLvwUoS7sGYqAonqhCwKhNcVqxnon9tb fSFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=gZltYDF3iwdJcGYLhKT3YuPe5k+kq1mwUmYAQAVkYAc=; b=Z3XmnaNkp2mtl74VtblSwfoHlzRg+tOxA5OxxcOlwIx0ASpGz4cYdfZSkRFoTUaxQf iTLBuzMpWRO94oIUsMWeBHDXZAcy2YJI/DqUrLi8uo8IIhtOjLh6I2/AhqN7bfidC/9x hasrPFoWsSlcrobk0OIxY4fp+HC31xC8X1+4NIU3yTIwGyJl5WlmtL202urSa2gkezfL ku7Tlbm4Gs/1Q+FivKB6hOulUxdYfDOmRr6lfXrepHVxzS0RpMBW1jnIioY421/KEipE uKV0+2VGLTvYWU2wIkWpnVvp3986LP8GMyrTKIKFwzXdZwDfIRrZOdOEuksbMQpT/xLd pCkg== X-Gm-Message-State: APjAAAXpFnti5wxjpWG7acCfreTeil0NoPZq8C7qVJKCLm2NO57ai6O2 1UgeiHqYybvTRqpjErUorXE= X-Google-Smtp-Source: APXvYqyPP9Dqypdi929g5eyAkxQt0ZanfCzYwVd4WtAhF+plGFMHvsui8ueHNYIWZj2isTKb3vJHEg== X-Received: by 2002:a17:902:542:: with SMTP id 60mr2557669plf.272.1566537103122; Thu, 22 Aug 2019 22:11:43 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.42 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:42 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:03 -0700 Message-Id: <1566537069-22741-25-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v5 24/30] riscv: sifive_u: Change UART node name in device tree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" OpenSBI for fu540 does DT fix up (see fu540_modify_dt()) by updating chosen "stdout-path" to point to "/soc/serial@...", and U-Boot will use this information to locate the serial node and probe its driver. However currently we generate the UART node name as "/soc/uart@...", causing U-Boot fail to find the serial node in DT. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 1a178dc..6cf669c 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -287,7 +287,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uartclk_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(nodename); - nodename = g_strdup_printf("/soc/uart@%lx", + nodename = g_strdup_printf("/soc/serial@%lx", (long)memmap[SIFIVE_U_UART0].base); qemu_fdt_add_subnode(fdt, nodename); qemu_fdt_setprop_string(fdt, nodename, "compatible", "sifive,uart0"); From patchwork Fri Aug 23 05:11:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D33EC174A for ; Fri, 23 Aug 2019 05:37:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A64B21848 for ; Fri, 23 Aug 2019 05:37:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mqWpQsT/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A64B21848 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51642 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12G5-0005Mq-6C for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:37:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45250) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rY-0004TJ-FX for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rV-0002mN-Mr for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:48 -0400 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:42886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rV-0002lf-ET; Fri, 23 Aug 2019 01:11:45 -0400 Received: by mail-pl1-x643.google.com with SMTP id y1so4859901plp.9; Thu, 22 Aug 2019 22:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=d2k4sG3o01ofbQjFWFy8/fD3Vi2ymyg0Zl94sy4Ni5g=; b=mqWpQsT/pNu+aiwb2PaaKei5+GP75YwQEULPeEAJ5nFkbYijrQkouXXLyqQB/uMJdr iNamHSHi17pV4ziU2RmLwR6V1moFzIpEhxRifCLJDyWAJGrE4VkNnZI+dT2YVRqlMql2 7ESupTMleBuVRJEvm3EM29mw5iG2C8HehB4buiJaR7pzhYJs0SfwE6rLpybESdF0jNNV tPoTUSCOfGkv/UrWSiCLSQ/ra4n9PG82JQxXTf1e8Hm1limGq8f9WMeP4LGaoC8+2ioV e/l1zNY3M2/eEDrYpomvQw7bWRI7rlGDU7SGEmophRR/NlbFZjKWzlToRcZg1LJJGuKo x+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=d2k4sG3o01ofbQjFWFy8/fD3Vi2ymyg0Zl94sy4Ni5g=; b=iUK6Bg6iS6BdBQLE3tr4mmD1MaY7JJPUbJJpRP45HkQOL2oAMzz1HEpJWz8KTX4xfi 5i5gJgO7HuZwzFChof56bcF45mKUkoISyXyqeqJgvILTHdnJZeDqS7prbovkeOXFPwtf sIEhr/zjnf2VIQmJLmd+enVoQYH6edxiGQ/pMSukd/BQHPcAVZRdQLTzG51duLrJ3mg+ 0WOdzj5OrM9kuRzN8icu5lq3hEyVHpeMWV9zW8L7LtkmZ8XVGRDWfA7yL6cYCecTk/xs iHTczOao1WkK/sAiECzYhO/1oZe1IjIwmzbZLb3d3ORmgfz4nYg/1DILoqGn73yIKqWw Cfgg== X-Gm-Message-State: APjAAAVndc5hHdwlpA33yXCO9sikYdG5jd0iK58ygn2Mv5dLAd0tXeXL mzwelGSBFp/a3wNM6IQ9QgA= X-Google-Smtp-Source: APXvYqwrj6YudHMrTkleO0h6whPbE8ffnOe7/wBS5+taPElE0rS7KRM9yDLw/vJ7hUcQaIMHSZb/dg== X-Received: by 2002:a17:902:e30f:: with SMTP id cg15mr2707388plb.46.1566537104259; Thu, 22 Aug 2019 22:11:44 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.43 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:43 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:04 -0700 Message-Id: <1566537069-22741-26-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v5 25/30] riscv: roms: Update default bios for sifive_u machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" With the support of heterogeneous harts and PRCI model, it's now possible to use the OpenSBI image (PLATFORM=sifive/fu540) built for the real hardware. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin | Bin 40968 -> 45064 bytes roms/Makefile | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin b/pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin index 5d7a1ef6818994bac4a36818ad36043b592ce309..eb22aefdfb468cfe2804cb4b0bc422d8ebcae93b 100644 GIT binary patch delta 10830 zcmcI~eOOf0_WwTTaAp|5zy=s$G)G2;B$Y8xQwsqZMktj?Fen8a(7-p07sHnZ7-n!l zMBCydW6I@gkn_7&ttq)_3KlO(VPJ-_F<-9NtbxZHEj z{_M5aUTf{O*51R;dU|IYeF9VCYY-ChyTdf=_$;$t$%-!FBh)PF2YiLnP&GJ#RtlO4 zf`7%(Y&Ovh1uu^=BI*)uVqWvTi1HA8ri}M#lXXVj799nsK;XrsM6yhpfDIJrX~XyC z2!|6CowN*ZcY7WO@m?9<2q^Y_gGC}=pjE1PeV*?)24lA+F1Veyny!q&5qy)IT&z** z9rPutBL0(>5I47X9AAARDRjwiGOa}(Juz}vMdK*G692<-3vK0Nnc&)lwu}o}=nauO zcZ?TY@G#q+qP_71r*$d=x5^cU{Rm;*npek1)(iPIr(~VJW~mN-36_!SG&$4uS~~N zonLU~df7CKT(SnQcb*l>JuB8)tVcB(J|0hh;{4>3FrF7NUbBFQV#_`kT`g;OzrM@A#ALL{ zFTU_?J&qa|jALA1rVijEu5Z$42A<$HLllzdOpW)s4KC2e>p^Za^`^qUJBC{Py4!EA zutuzHbf2QIpb(0@8y_(H6QcRl+ZIXQ6a)AlE~>f3d6UUogxm| z*kzH_OU(7-Ptx?B#rQ4vb~<{#`E`#i4&aR6drkM2ziH&Nh*hXk`_T9gC`6$aZcQh) zV{dOMfP%ff7aUy+I6J_`D7soZ)`!j_sahQuzb>@g*xD?yR~LRZ00n1kc|r)?_U(B6Tyr^792v7v?!|R zf-X*H>-Ak>>vO=8IlS+h~Y>Fke_l-#wN!wf;{Zxr>5mD#b1Oqq6nuJjfiZDAe z9+1=DnQRAk$Jl_kV#a`T?ZBk~oPtk`As5?`i^q`D?Z`!d^u$S$QJ%qeWbhbriXHhJ zAf2(>lu=}m9T_x+^t2;q021N)F{Hm8=|6^awj+HkZq{s^;WNrpVn<5GkjRb{0Wuv+ zq@zerJJNFu*=I+(05TC@97DR;kuGD%yLKc6$mKY1>L^dzj-IBGR@o5jR~9$w0|D(-07zoZw)HjrO(kIKH(9^=JO?UhKu_4FYHvMB-U9Ol5;Tb}yi`Px~pI?{-$hQJQaxrTZ@pusP*TeGUMh6zDgaSIhCttB64&r3AWZUC0 zLcHG{g7y88>$M&cn2ly&X0?kY`UHRT@UV5Dc67>GK61lF&Gf-Vu1MmjFVS|?rnXMP zS~hy~8X=D-nafgcAga@-Ahnk(7C>)hYpvH!N>PxPz1im`ud8~frT;?jCF_-*Yqx*y zY;RjLl-|Fw7YY9Dhk}?!5ydp~DNUo=k7AnUQko_u<-=+kR#5S!pR-K!TIzi1Y97f zbiRV)XkFOKPU~<>8)TZo5!1XJX_~T-ra1+PJ#~~=#HZqSt7CT?4Mk|>ZZVJNR!#Ci zv_z~@uslOHNT_8Khyd34{(2ES3t4SEOns6}*`hUY{yKdr&ke3CJ1*CHy{B-^+yxVgj4h;RA zzZQn^o5RdQp^GV6jd8@HIQn=cKD1~TeWMId4}ZyFVcu__;F;mU_*A$Hy=)MF8Gesm z)`S14*h)`s#nrKMaC(F%?Rpv)L`(ex{FqhxaI3XiF1*eQ_LJ_67cU@tgFr z&+yZc-2rK^X8qAGM9>NaM|XljU<~BJfrF~O%|0o?<&McD0{Em*3VS4gI6(N~BEJVXXIY&uXEeoK zOWUTyB6tr4?;UrQR%tdE(B(3lr=;G-3DJ|L+01*((zeWKLw0wLB60JBkv=<`?ZlPQ zVljvAx@l>1HQ45>X|r*AzYSlBe(+*0$e@q>#*hVVVfZ)Tac#@Anpy#pY0ce!6q!Lf z|H0Rmwr{kVDBA7c{vkmG?=N`1+2{9kKa{L7KBG`>WXXiTek1?JU9ngub zuN)A{qbI8-v2J)E7l~GoH7X_e;PTf%XEX7`<-K%31GdIy^PvlzmBs7h-k`tv#C#>L zfTqhzaYFngkGTj18@lPWlD*J3eaQ zjKSXH*Nxp@*96+1);^NTk37_W5+B=l2BIV}2e>FMDv}*sqbZh3v0 zhwZx$^bQR;7*dG33MJTarAo#1bbJ4KT=Rs3D%vAAKe#+!Iq{s&A5ws&E%A(vd$;Gi zs!3mofQOJ@<2hjwDI_U{>QOf*f$hDYJHD`TN<3hsAJ#lc#z{Y|apT&5)Vlq_rEIc{ z+o^I){_~9LkI4vJ#2xTIu0aB_s7PV^*1P^9tvre%YcXr3 z!JX?}AK;LT8H{Alvp6HegOMX=yfb4KQ|~&AKg$SU>c1Jr_cHvL`m&$!gw4|c_ZAM{ zEQK}~r*D3bsSmh~o!-2|)E_@X%g-;b0}?Hw=p) zga~=n?c5o`s%{_O$oMr3?^UYk2M!``MCwhzzxPMHtPM}h-oZ#N&cg?@0~txi9DFHz z79a3ftGI-na$*@t(kpm%&O8ve3LnY|1#u7I_MF9Z;vk;BWjd|y#|c|rU?gn|amAKb zKzMg--4a8qhjI8@DtJ8;o8DT$NZeR_`>h-BJQ26#PMIR9%rX_KUSrXnx@s*IK@M_x znWn;y2zF?x)^Z}T6}xQpp>K3y`PM0nB*Yyr-wM*TrQ_nQbAm?B83k~fEcQaGi$M(g z0gOJ8cq35Y8#)|xx^QZ!SF2FqfmB}yQBa-fAPb*3d=>X@okJ&{#?!YwOW!z!leWb? zb>kzuE(T?gmVt?NS>KHFrb0;9CnkT0FK+XZ9R84`Q0dIhhvuSAq}nt@w9Rsm^tR2NC}O@*eSju7_Ij)Ym2P$bU7RXY@n+lh7f?v9nh zd0-yBAWFy!AH2pL36q34;q5on{zV$42gN8@idhV`QiLBR_RvyB1D`ryX71)w#{D{o z`}uxCHiK5}=%Y0eMTl8!K$^w1h*8ua=%>UJ94YfH9vO+uw>+uyyYppd-h)%nYXbWPLYZ0I+ak(QAlH;+>EZQc13jNSmr(f0^WnJ16b33jx5A2~)!ZuUDcKb32&L~r1!`PH= z+iFA$SIds+ak-jL=kKj97i#si*hxp9EVi6*{RxgvPfI@-026{an~6EWjLk>Dn_!p1 zHo97Rxzx6O3Ow@n#_6id1GSNq<;12RjYUpKc%=v|Rg7Zv;>+NDuNG5cVr|c2idc!* z=A1^D;Kc1?*p)05Stj=6QNpbcUGakluC2RYE)#nflO2Zw??zBp%cMslDQVRJt!ZpP z4DqTa2QZPl%{1Ututr+bJeB6w2;v#{^Wfk`PA9RPy+?QZ)zZK5AA`0IpD}T9+;0XWNGC-@r4${g2x;-N-t164m zZBGkJuS%Z+R*m0WWv%YH(0QpXZfLbt*V}SCp?_8Hnx6FA8$0tRm>H|za(4M^zL7tzz1*mqhpNke ztB{^Jg+7!~Bxw zVhOhmx?U|4i%U@8FKa2`4|-US9@MI*q(|0pczjjx7#tgPuMk3r}-MxLR<@6P16Lf2ChYH%QW^v zpyPqfJCX6=F3Q~VHRL0(H)ze=viW;V`!4O%Mu38~z9j>~AN3H3^ho%f zp24r`8KD8_ih#l*c#acrsY6X-63Mq=6G(>r+=Ij?vQtT}_3;#cr>BHJ3h36dDo^99 zdJ4x1=$FebmkF=vX&k4gX(7o!1rtWOtajwaUllNfTRTfQ!ERy*w=f=Y%GR>adBWTQ z*O$wx1eeQv)B2zCk_vt5*oi`-wCDA>hEf4wYkLfkx zETxHp2p{E3F)z-hAOqj@I{(KwLa!r{1kBTRyhnBQC~WdV%2)xRw<{JXl@fcai;=lY zK^1tsBgo%-0S+K+L`ylb=Sbelx*f4g>Q-*9YLg8`^)Ky>vFbYGdh#6o^)rj1e6-%U zW-9bLU!BB*+nTW4_N=O0dTV=nGE8_$E95l{l4%2a{EH`@hoZT%?j|E^7&P(}=(mdT zvdtBy;(Qq;yQJny+mRwup<-C9^F|kl^(qhlYeTJOYQtb`?WE0Bx2rps4#o7x^(I(X z_2_z9+Vb2?`eVh!jB#Lp zs35?G5ZAdt1h#`fSd*DuI1~j(0!w9L+n@U$H&$Fv!fjnAF&EL*oZ?f&WOb%Os`YV`;cK~0YEaT3 zk&;;KhEDqYk%zMzK}mx|D^c17f;kjXl}%GbOBU<#9#f&1FF=Zc-$Rq03e^Y)?z=+3 z_JYj?S|hh9woJ&(EgS^B3@+8Z{sri4@RIgJesH;^^2T>(YK3Zk;ot>MO~mmQ?ll!o z8-`T^_>y)O3*PYUQKBllrg%f7zTr+V*25oBk9j=N4(2rsErok;a$ytj&;xAUFl5r^ zM~nlPlWAvx=&m<^-y@tpebo&^e|$Bn#u#f{kFIlRZ^G?7M{dgEIpA=K|Ig<2?O9>D zHlGh$mrT4Kemk;H+@gwOoxskM`i96(;NH6BJ+F;qrZo(bH!^JtX_Wvad zYI5itJ#g0D!(Rt^Lxl`ydF$Z=UX71OblaMew!oqI(O;_tTFMvjd_zh8%a4H5Y}4c1 zyf#<$SNFD9FZ5ixtsA=1d97{L(CYp*z3JAC${s`!5uPp9yr@8$s940jn2MN}vXKSt zNj2%mox7D0k+oD?oyE(&l@^g+oz7d=zAbEf)pmME`vw6RhWNs!3Oqg2N6q?*Cn-?A zU#Rl#F4gu2?wZzcsD741j?aRUGKDt2SIV78&A$#K^RK^>GbgmyQT`06?Bjury1PVy z)^B#JSk@gbin$VMw1Oh1SrQ@QOJlhjU}dS8)zYV3%Bj=4KBH913NN#oe}Gcm?{ys;qcdb5R8q$d9B{>mIn@)1}*NXAL;J#eGwZMN@%aT%d<^VcyMk;gY&sV&^#H&){+t3gG-Va)H%X6gE zz8w=j8PUvW=&{^SHN1c`&_xh1g!V^Zc^2g+Mk3Ra^%BX9>OUilB@l>f~M@{GN>=1C{bTU zQlC4t)Mo%KIo%h(!%WJf(Vx)CA@=wke|>BhNPF={pQb4s> z{pf6tWlSL%CaBu}32^ zD9Qce+C$_%b}nCnsJ-*cgUfM$BHTceo^B(4GHI@;ZQ++DEyT=Wk&N5`t&x$vQuZlM zO4=;saQr>Y2YfrXqB7i>Bqi5xLe_T|ej?eR;JzygI#%)S_tox*{gwRsM(&kitn}~A zd0bmvn@8@WrDtp2E>y`LE`QD~ z*|7umnu=6ZBuVEv>N=zP=ahgM2K|eV6@OHCO0BnCTvp1ql60Y(IFA9V?6G`EVsq5a zYeke&1~GuEa{EXw|8pW@d>aP4YO`Z6*An+8e;op>A6e=T|LSoLM1S<5A6y~5)raQt zk;8;@lXbXWH;T>s7pB!33MnHo@M$lVp27Yj2;j<1X0yeOB4} zm)qN)?Csy}{e_9P{_pMWL3>+l@851~)yVz@1*kHzGs%A;z9~f54I8p&WaVb0lJDfR zAvtqhD)eM#C1+)4BJ^fjrYdK8W=~3Bw3}}uqh%XIV)ANF?EY%A-$ z51A#G!#}xv{;XNEpOwqG88Wj{Hf3kc$Vkq51L4p1PxP7p-pEMB;gOLeK)gdEBToRm z4rBtlZ5$bKsl*TW$Elw0Nlnjup@0jCbAD?Keh7ege7zbP?$Ge@QKXZvZ+A z^iQCVfc_3t4O9tK0kjWjH_%R?0-)_cIY8@gjHpLk+Q8&M2IM8gAR_pm p7xSNl+kXQW97vc>d@}tPa3P>uKpX8XdG|PxJ_u|-I=oZq_`f`aDVP8N delta 5317 zcmcJTeOOcH`NyAgPEJCUN-#hKK?4yHL6-G((~D9Y#f+hl|Y8&^A&{@F&5l46MCEdSCVw8wl*rl1@_O2Q!ImJg zQnY;>m~IK29sJ8sD~GZ2>m%~At{5>M z*IaqaTYkmYCe*rU7%^m(!Q@M_GCHTUL_<6XrzK0pdKRaR%Qi@c z3aTTXkr@@$^ zvxYjOYze1rPKMH<(KDTOT@k0XCt-`+h;5vg92U_~GebuBwAt9DRFaWXs}pT!Ju|2g_Hau*r?pNQ z>B*8eKTN8-#wSbN{2D|K>ll3m+e;I?Yi3GG`p)yJ&v$nF{B?UogQbbnrjGr%4U%4n zg+*Qqsd_l%wT7A+}|{8zi_LKk<(Yux2;OSi0Fbx00IIu2*n2YGipT% zWCz62{rRvz!1RK1+`g3khBKE{X3&ldi0_|F>ALgc^AG0JCG3hV)#i2l)Nij{q2v0? z?9M5@*ODae@|Ry|7vq&mmUwXeDL2e!+xC%LsX#?S(-4+ahO1*L$7^E@adP^MzO(+; z?XVp4de8>VoxPsldcB3K(<{TZF+wkFR)i^|PK6^XS=>Q&o+tq_EUL>=S^xZvL1p5{VVDBO~ zI86kT5gY7siEc7dBcaNBqtzQ z0&Q+GLL?*HGH+K~)| zU1ME+_K0MUn>;I$pCaiEabYgCqIn&st}eb-H@2?Rm|^4;U2=Q~hJ}xaQ7jZXmj2oxW6ziM@4Uc6 zjXH$X<+(!a;;#*IwymuH>iI?JwddNh!%Y;c)>fF;+j=AJQC@}olT=r>I=!qvYMZ&x zW{-TAu4>dx!$X-G1;KJ6rhVuWC()}={zlD()rd>rbmt<5;dlK7@3?m%msuD2VI*RYvf9%$>I-ABos%?>|>8*?TI<$^&N9=}kICz59J zqlX=rp?UgjI2M0imWj<|`efVMxrr3*u)x`$WYAH+2S43*dU*>R(#@BgGk}KAD$6dwl_sNo(k^KN%}deWaI8y(Ryp+8 zRdY7hw^^>hsh6V|#jYT@^Kz4KI{J(SAK*pSR(9K5gsZZ)EVk{NA4n zV=(G%c-MToQ{{}_b_Cwy>?sF?EyiC2J$*AFJ~!M~D8Go&r-KsnVm@7x=}?_(@OMUvCjGdbUJFliM~@ex6ZaW{ zE~~Jtl!Z+kF_-^JL+K3P_c_NA{4L`lVR>*CGMY0jPCq?^q>p0sTAVOUh0&UAf`H?W^YG>?cu9$ulJY62FamMsP&e(UemvayDrn9N<&Op& z+Xw!b7tN2QnbD#+yJvHPp|_pbK5eI)>INJ?WZmQi>J?LCM*6mk3+NlV-$46Llc@>S zIAc%j9v=04-@SbI2UsMBuj;0$6pDowBS70n^8FN(T zO3pKQ&!myzDS&S;gV1X->zw6w?pCh!+kw_i>0h`0kb2G0OAnljJ=iMP(=GSk=rHP4 zm=L@YzBVS9o#)BzdvJd1EZH>kT$*eS=gvg&(efHKWC^q7>KV^#GE0 zwKL7LZQ$3qijRZQ$f=y1v7hTY@j3jWF%7a-Y-JP*IrOa9!zl8KVdKgIv?0*5@;c4E z32lZiu`0D4%3naSq`boSeVCXZ;^BM~P}t{yx-e5|J$F^p{5F}_3T!`(nX#Vx0=5-S z7)cZbFMh3wlssXR44o3m5u;LC`yHOoit1T#tuUIgp8FD{MNy2ksvD*kg)!FI@59QX zaD1}I!;T^i+DLe}=$DN3<{x2k@m? zVhAjamLZSXoCAwX)6vJm@zNJ@x+b_&ItQm)1Cgr}Y3?ShUmZz%{S^+ap2d*7HPEv< zjUfs>%y@MX?bQuCUNxY51w4FpCPQ{jgGpsKWh5`fQcHcbd!HXnESCinZJ4Fju#_ct z&mA#R3790J7;CA$mB2nt#)NXeg^cnLx~vmkFAru&TLS#594A>G1fP^o_1k%*NsjM- z+x&^4D~4f@Vrwh+0jMhi>8P_1TQQa94#4_~Np#r(uv9Ff%gpe7MF4$b4+N|Up`-Rf z?3zG2QNB0Hb)tbsjM&ggHrmF@2>OjT*R(}Lu-p| zJ&lDDy05}EfA4EF)12}cKHL|?G>>kCJNq{HH&@jjET`8d8N2i2OAeOMujuezTbDJ^ zYKuO0Rbq=f)+T|}rjdTp(KDt@#$W!w4E#^hx>B`zlFhGqCOv19!*K`o0M&;2y=eLJ zKdZa^F8gp3>^?Yq);@=03~K&f!4{*fMR}l)w|q>CmKR^<qaF#G@BH^uCtf0~ECDjP{R87|k|3R4_CD?4y1}qoq z38Eb?a#zH-WtkBFi)iz6g!*wY?wKppmx*?aXt#;+je=zfUx1A*fgxLtI~?8bI2`v; z$-i+pGEj$5|A*2Zb2t{CfYU7*RT*a;j=VDt$0@YeP<%ZX>le@-LhViy2L3PED)L|I z`2X4OC_*0pixtB5w?|Y(bmBHajY5q;Y5zkFN8S@9MG@4K4u|6*>H+EwsvGqe)MuzJ zR43{J>MZKr4o8(^F*Zs@C8FX{e1rc)FJYUhD1PEUUd+Fn+>H)6XvvPe(t~qC?L%2m uze4f8=XDV4{38KN-kv_r<1Q}r4nA9GJyE>neb0;cInM_?8aj4cJ^l{rCK>_& diff --git a/roms/Makefile b/roms/Makefile index 775c963..6cf07d3 100644 --- a/roms/Makefile +++ b/roms/Makefile @@ -182,8 +182,8 @@ opensbi64-virt: opensbi64-sifive_u: $(MAKE) -C opensbi \ CROSS_COMPILE=$(riscv64_cross_prefix) \ - PLATFORM="qemu/sifive_u" - cp opensbi/build/platform/qemu/sifive_u/firmware/fw_jump.bin ../pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin + PLATFORM="sifive/fu540" + cp opensbi/build/platform/sifive/fu540/firmware/fw_jump.bin ../pc-bios/opensbi-riscv64-sifive_u-fw_jump.bin clean: rm -rf seabios/.config seabios/out seabios/builds From patchwork Fri Aug 23 05:11:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F9281709 for ; Fri, 23 Aug 2019 05:44:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E02E621019 for ; Fri, 23 Aug 2019 05:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SgIhKKCp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E02E621019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12NY-0005b8-4t for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:44:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45245) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rY-0004Sw-8d for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rW-0002mq-BZ for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:48 -0400 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]:43096) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rW-0002mJ-3F; Fri, 23 Aug 2019 01:11:46 -0400 Received: by mail-pl1-x644.google.com with SMTP id 4so4863934pld.10; Thu, 22 Aug 2019 22:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=OZVOOh0SxX0IlUeweFB/zoT4qJOUme1j3/PcnjdOxM8=; b=SgIhKKCpWI/ndMySZ3y+c6jWKlfCBALgKq89jrH8F9pfeUhdxkEx6bJSJJX3Ec5vEx h7m15fbRjWPtOMCzpO6sk/BjLpXDwRcb0sqrNCPcpZwPk2p63ncwCthymIMp3DSgL+Hn VGM7ZD5uHZmz9Sw26DlTXaJu9cDKBrdRRvLC/3Ra7hV4qkDQZm+wAu1xmjaVpy465jqq 1iQYWCyTo2kRHPEgAR008milg7ST8glkKGvFA6/TDXg0EDbZDP7uklj9x+/Zjfnp+2ik MCu0tDFTCz+5y32cLJ29pWCPvQPbMcxr40OpdFN/RQqOCRPDsXBkyxqyuwQE6P38IPog Wvmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=OZVOOh0SxX0IlUeweFB/zoT4qJOUme1j3/PcnjdOxM8=; b=rSuh9AXEw3eM3fcOpihZfKUIeWbzIEuCJiM0Xl7ZnN7QjwHghM9okVmspeJm/m/3vL 0YHKq/plOzjTmNVXnywGYVMBv+X9MEr+/mnX+Tj6RBMjD+7EtHSKeY+Detou2AdJ4AfW ZOPNMt7UGlo0zi6Lr2uj4XdQu3j9QSdkSbyDuYqU6BefjRlkRx6u3qfOUh7QyX8Mjbil DfkwdoCuBczkGHOHABAEZ/n/3zZPnme05w2LZtIsXV2WUw17777QV5N4NzO5oR1bYxMX 06QTOX2F6qOnr+2IizdLJNrXhlrLy2XHBP9mZZOcGm9ZQbBR12koFq4wiMiyewV/GjoW liYQ== X-Gm-Message-State: APjAAAXJc7flCyQ0YFRQIfSwFYOPttm0XT5FwkKWTJxRIYtpdo8Gom4N LXDAMHKDvEsTnQ0rIO8nEa0= X-Google-Smtp-Source: APXvYqw3yUbRbjGggUKiBo7IUqA+IzVthcnfPWHeDn/9fTwxgvF/LmXD/vGLCMBBA9q+G8m93KhHLQ== X-Received: by 2002:a17:902:6843:: with SMTP id f3mr2529394pln.97.1566537105258; Thu, 22 Aug 2019 22:11:45 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.44 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:44 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:05 -0700 Message-Id: <1566537069-22741-27-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::644 Subject: [Qemu-devel] [PATCH v5 26/30] riscv: sifive: Implement a model for SiFive FU540 OTP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This implements a simple model for SiFive FU540 OTP (One-Time Programmable) Memory interface, primarily for reading out the stored serial number from the first 1 KiB of the 16 KiB OTP memory reserved by SiFive for internal use. Signed-off-by: Bin Meng --- Changes in v5: - change to use defines instead of enums - change to use qemu_log_mask(LOG_GUEST_ERROR,...) in sifive_u_otp - creating a 32-bit val variable and using that instead of casting everywhere in sifive_u_otp_write() - move all register initialization to sifive_u_otp_reset() function - drop sifive_u_otp_create() Changes in v4: - prefix all macros/variables/functions with SIFIVE_U/sifive_u in the sifive_u_otp driver Changes in v3: None Changes in v2: None hw/riscv/Makefile.objs | 1 + hw/riscv/sifive_u_otp.c | 190 ++++++++++++++++++++++++++++++++++++++++ include/hw/riscv/sifive_u_otp.h | 80 +++++++++++++++++ 3 files changed, 271 insertions(+) create mode 100644 hw/riscv/sifive_u_otp.c create mode 100644 include/hw/riscv/sifive_u_otp.h diff --git a/hw/riscv/Makefile.objs b/hw/riscv/Makefile.objs index b95bbd5..fc3c6dd 100644 --- a/hw/riscv/Makefile.objs +++ b/hw/riscv/Makefile.objs @@ -8,6 +8,7 @@ obj-$(CONFIG_SIFIVE) += sifive_gpio.o obj-$(CONFIG_SIFIVE) += sifive_plic.o obj-$(CONFIG_SIFIVE) += sifive_test.o obj-$(CONFIG_SIFIVE_U) += sifive_u.o +obj-$(CONFIG_SIFIVE_U) += sifive_u_otp.o obj-$(CONFIG_SIFIVE_U) += sifive_u_prci.o obj-$(CONFIG_SIFIVE) += sifive_uart.o obj-$(CONFIG_SPIKE) += spike.o diff --git a/hw/riscv/sifive_u_otp.c b/hw/riscv/sifive_u_otp.c new file mode 100644 index 0000000..7d65a85 --- /dev/null +++ b/hw/riscv/sifive_u_otp.c @@ -0,0 +1,190 @@ +/* + * QEMU SiFive U OTP (One-Time Programmable) Memory interface + * + * Copyright (c) 2019 Bin Meng + * + * Simple model of the OTP to emulate register reads made by the SDK BSP + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "qemu/osdep.h" +#include "hw/sysbus.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "hw/riscv/sifive_u_otp.h" + +static uint64_t sifive_u_otp_read(void *opaque, hwaddr addr, unsigned int size) +{ + SiFiveUOTPState *s = opaque; + + switch (addr) { + case SIFIVE_U_OTP_PA: + return s->pa; + case SIFIVE_U_OTP_PAIO: + return s->paio; + case SIFIVE_U_OTP_PAS: + return s->pas; + case SIFIVE_U_OTP_PCE: + return s->pce; + case SIFIVE_U_OTP_PCLK: + return s->pclk; + case SIFIVE_U_OTP_PDIN: + return s->pdin; + case SIFIVE_U_OTP_PDOUT: + if ((s->pce & SIFIVE_U_OTP_PCE_EN) && + (s->pdstb & SIFIVE_U_OTP_PDSTB_EN) && + (s->ptrim & SIFIVE_U_OTP_PTRIM_EN)) { + return s->fuse[s->pa & SIFIVE_U_OTP_PA_MASK]; + } else { + return 0xff; + } + case SIFIVE_U_OTP_PDSTB: + return s->pdstb; + case SIFIVE_U_OTP_PPROG: + return s->pprog; + case SIFIVE_U_OTP_PTC: + return s->ptc; + case SIFIVE_U_OTP_PTM: + return s->ptm; + case SIFIVE_U_OTP_PTM_REP: + return s->ptm_rep; + case SIFIVE_U_OTP_PTR: + return s->ptr; + case SIFIVE_U_OTP_PTRIM: + return s->ptrim; + case SIFIVE_U_OTP_PWE: + return s->pwe; + } + + qemu_log_mask(LOG_GUEST_ERROR, "%s: read: addr=0x%x\n", + __func__, (int)addr); + return 0; +} + +static void sifive_u_otp_write(void *opaque, hwaddr addr, + uint64_t val64, unsigned int size) +{ + SiFiveUOTPState *s = opaque; + uint32_t val32 = (uint32_t)val64; + + switch (addr) { + case SIFIVE_U_OTP_PA: + s->pa = val32 & SIFIVE_U_OTP_PA_MASK; + break; + case SIFIVE_U_OTP_PAIO: + s->paio = val32; + break; + case SIFIVE_U_OTP_PAS: + s->pas = val32; + break; + case SIFIVE_U_OTP_PCE: + s->pce = val32; + break; + case SIFIVE_U_OTP_PCLK: + s->pclk = val32; + break; + case SIFIVE_U_OTP_PDIN: + s->pdin = val32; + break; + case SIFIVE_U_OTP_PDOUT: + /* read-only */ + break; + case SIFIVE_U_OTP_PDSTB: + s->pdstb = val32; + break; + case SIFIVE_U_OTP_PPROG: + s->pprog = val32; + break; + case SIFIVE_U_OTP_PTC: + s->ptc = val32; + break; + case SIFIVE_U_OTP_PTM: + s->ptm = val32; + break; + case SIFIVE_U_OTP_PTM_REP: + s->ptm_rep = val32; + break; + case SIFIVE_U_OTP_PTR: + s->ptr = val32; + break; + case SIFIVE_U_OTP_PTRIM: + s->ptrim = val32; + break; + case SIFIVE_U_OTP_PWE: + s->pwe = val32; + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad write: addr=0x%x v=0x%x\n", + __func__, (int)addr, (int)val64); + } +} + +static const MemoryRegionOps sifive_u_otp_ops = { + .read = sifive_u_otp_read, + .write = sifive_u_otp_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4 + } +}; + +static Property sifive_u_otp_properties[] = { + DEFINE_PROP_UINT32("serial", SiFiveUOTPState, serial, 0), + DEFINE_PROP_END_OF_LIST(), +}; + +static void sifive_u_otp_realize(DeviceState *dev, Error **errp) +{ + SiFiveUOTPState *s = SIFIVE_U_OTP(dev); + + memory_region_init_io(&s->mmio, OBJECT(dev), &sifive_u_otp_ops, s, + TYPE_SIFIVE_U_OTP, SIFIVE_U_OTP_REG_SIZE); + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->mmio); +} + +static void sifive_u_otp_reset(DeviceState *dev) +{ + SiFiveUOTPState *s = SIFIVE_U_OTP(dev); + + /* Initialize all fuses' initial value to 0xFFs */ + memset(s->fuse, 0xff, sizeof(s->fuse)); + + /* Make a valid content of serial number */ + s->fuse[SIFIVE_U_OTP_SERIAL_ADDR] = s->serial; + s->fuse[SIFIVE_U_OTP_SERIAL_ADDR + 1] = ~(s->serial); +} + +static void sifive_u_otp_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->props = sifive_u_otp_properties; + dc->realize = sifive_u_otp_realize; + dc->reset = sifive_u_otp_reset; +} + +static const TypeInfo sifive_u_otp_info = { + .name = TYPE_SIFIVE_U_OTP, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(SiFiveUOTPState), + .class_init = sifive_u_otp_class_init, +}; + +static void sifive_u_otp_register_types(void) +{ + type_register_static(&sifive_u_otp_info); +} + +type_init(sifive_u_otp_register_types) diff --git a/include/hw/riscv/sifive_u_otp.h b/include/hw/riscv/sifive_u_otp.h new file mode 100644 index 0000000..6392975 --- /dev/null +++ b/include/hw/riscv/sifive_u_otp.h @@ -0,0 +1,80 @@ +/* + * QEMU SiFive U OTP (One-Time Programmable) Memory interface + * + * Copyright (c) 2019 Bin Meng + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#ifndef HW_SIFIVE_U_OTP_H +#define HW_SIFIVE_U_OTP_H + +#define SIFIVE_U_OTP_PA 0x00 +#define SIFIVE_U_OTP_PAIO 0x04 +#define SIFIVE_U_OTP_PAS 0x08 +#define SIFIVE_U_OTP_PCE 0x0C +#define SIFIVE_U_OTP_PCLK 0x10 +#define SIFIVE_U_OTP_PDIN 0x14 +#define SIFIVE_U_OTP_PDOUT 0x18 +#define SIFIVE_U_OTP_PDSTB 0x1C +#define SIFIVE_U_OTP_PPROG 0x20 +#define SIFIVE_U_OTP_PTC 0x24 +#define SIFIVE_U_OTP_PTM 0x28 +#define SIFIVE_U_OTP_PTM_REP 0x2C +#define SIFIVE_U_OTP_PTR 0x30 +#define SIFIVE_U_OTP_PTRIM 0x34 +#define SIFIVE_U_OTP_PWE 0x38 + +#define SIFIVE_U_OTP_PCE_EN (1 << 0) + +#define SIFIVE_U_OTP_PDSTB_EN (1 << 0) + +#define SIFIVE_U_OTP_PTRIM_EN (1 << 0) + +#define SIFIVE_U_OTP_PA_MASK 0xfff +#define SIFIVE_U_OTP_NUM_FUSES 0x1000 +#define SIFIVE_U_OTP_SERIAL_ADDR 0xfc + +#define SIFIVE_U_OTP_REG_SIZE 0x1000 + +#define TYPE_SIFIVE_U_OTP "riscv.sifive.u.otp" + +#define SIFIVE_U_OTP(obj) \ + OBJECT_CHECK(SiFiveUOTPState, (obj), TYPE_SIFIVE_U_OTP) + +typedef struct SiFiveUOTPState { + /*< private >*/ + SysBusDevice parent_obj; + + /*< public >*/ + MemoryRegion mmio; + uint32_t pa; + uint32_t paio; + uint32_t pas; + uint32_t pce; + uint32_t pclk; + uint32_t pdin; + uint32_t pdstb; + uint32_t pprog; + uint32_t ptc; + uint32_t ptm; + uint32_t ptm_rep; + uint32_t ptr; + uint32_t ptrim; + uint32_t pwe; + uint32_t fuse[SIFIVE_U_OTP_NUM_FUSES]; + /* config */ + uint32_t serial; +} SiFiveUOTPState; + +#endif /* HW_SIFIVE_U_OTP_H */ From patchwork Fri Aug 23 05:11:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BFE41174A for ; Fri, 23 Aug 2019 05:32:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5151C2166E for ; Fri, 23 Aug 2019 05:32:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eBv/slLO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5151C2166E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12BQ-0000Yf-9h for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:32:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45270) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rZ-0004VU-Ty for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rY-0002p4-Bt for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:49 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:41448) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rY-0002nq-4R; Fri, 23 Aug 2019 01:11:48 -0400 Received: by mail-pl1-x641.google.com with SMTP id m9so4866083pls.8; Thu, 22 Aug 2019 22:11:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=G9AxHOmjuHSqpfQgQoCEfLM+dV2X18or249NQyOXoeQ=; b=eBv/slLO677zIxqRJ9dn2NGXsFHNfvf9LzY3xAlItGgzc27on2EsNALaZ4bw4qaq9D zXVo7BVVw9gyiS0UKiUUW4JxGPN3m7ORdqq2fY0kdwX7lY5CP3kRGUnUY/1d+k2QyJ80 YJfjSbI8JwAnlUPBbnCQQRWrAoYZnVpq5taNzEhdqpq16xZYlMHALdBqTB+AdJlWUgt7 B7xvScyxCcEj/FPCnGmi2sKg7AdxOsVWm+JJCUfdNNjFTEwC4OwpF3qis3wfaWMl/BPx qAty4RxSwgRwucyy7VYlD/iqohc0ycplB0Nf1K3+FHOhsluSQ3RhIs7oNNbwn0DImXk1 LyMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=G9AxHOmjuHSqpfQgQoCEfLM+dV2X18or249NQyOXoeQ=; b=jG8T3d1drtyg9/rs0xRk7NbKdmxXxA6GgVSbxYaIxe6I2qnJLBBeRwPKlGdimZEXzW B/Km9GnTfKuFQFNZezbbebvpTLcBvhaHMXnXDm5vvAXBwotSHuP2HTOyCzxCxnlLzIX7 LRJiZ4vv0RukdOSfxtmwyIi7liok8I8x3wV5teSnVL0cWtL5kB9xKn4USLPGafkSUP3t J+TE6UDK+FtugAi1MtMq7GDtEG9HCsebKiygJWjeqVyvAy6XPXJKm/l6fDlohciDi3mt n4af35uNCfd7Qn/98jZZpIJEkLQlrJb644d1xoL0asf9XOn+yTMeFu0vyO7G7vyStnJE U4Nw== X-Gm-Message-State: APjAAAVMIuYY6yUjdnR7Yr2ch8MBder3DmPGw7LhaHj9eff1qNM5rG2A 7h9oMK4RNcq4TbqO50JPFnc= X-Google-Smtp-Source: APXvYqwcCXHFw7jBu0+FSdroqEEzq3fK8FmeX+3hurYLFbyhINRAyLWxXa4lvzXORBc+BOmR9P/STA== X-Received: by 2002:a17:902:b094:: with SMTP id p20mr2700694plr.320.1566537107318; Thu, 22 Aug 2019 22:11:47 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.46 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:46 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:07 -0700 Message-Id: <1566537069-22741-29-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v5 28/30] riscv: sifive_u: Fix broken GEM support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" At present the GEM support in sifive_u machine is seriously broken. The GEM block register base was set to a weird number (0x100900FC), which for no way could work with the cadence_gem model in QEMU. Not like other GEM variants, the FU540-specific GEM has a management block to control 10/100/1000Mbps link speed changes, that is mapped to 0x100a0000. We can simply map it into MMIO space without special handling using create_unimplemented_device(). Update the GEM node compatible string to use the official name used by the upstream Linux kernel, and add the management block reg base & size to the property encoding. Tested with upstream U-Boot and Linux kernel MACB drivers. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: - add the missing "local-mac-address" property in the ethernet node Changes in v4: None Changes in v3: None Changes in v2: - use create_unimplemented_device() to create the GEM management block instead of sifive_mmio_emulate() - add "phy-handle" property to the ethernet node hw/riscv/sifive_u.c | 24 ++++++++++++++++++++---- include/hw/riscv/sifive_u.h | 3 ++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index b6ddf5d..503db4b 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -3,6 +3,7 @@ * * Copyright (c) 2016-2017 Sagar Karandikar, sagark@eecs.berkeley.edu * Copyright (c) 2017 SiFive, Inc. + * Copyright (c) 2019 Bin Meng * * Provides a board compatible with the SiFive Freedom U SDK: * @@ -11,6 +12,7 @@ * 2) PLIC (Platform Level Interrupt Controller) * 3) PRCI (Power, Reset, Clock, Interrupt) * 4) OTP (One-Time Programmable) memory with stored serial number + * 5) GEM (Gigabit Ethernet Controller) and management block * * This board currently generates devicetree dynamically that indicates at least * two harts and up to five harts. @@ -39,6 +41,7 @@ #include "hw/sysbus.h" #include "hw/char/serial.h" #include "hw/cpu/cluster.h" +#include "hw/misc/unimp.h" #include "target/riscv/cpu.h" #include "hw/riscv/riscv_hart.h" #include "hw/riscv/sifive_plic.h" @@ -47,6 +50,7 @@ #include "hw/riscv/sifive_u.h" #include "hw/riscv/boot.h" #include "chardev/char.h" +#include "net/eth.h" #include "sysemu/arch_init.h" #include "sysemu/device_tree.h" #include "exec/address-spaces.h" @@ -68,7 +72,8 @@ static const struct MemmapEntry { [SIFIVE_U_UART1] = { 0x10011000, 0x1000 }, [SIFIVE_U_OTP] = { 0x10070000, 0x1000 }, [SIFIVE_U_DRAM] = { 0x80000000, 0x0 }, - [SIFIVE_U_GEM] = { 0x100900FC, 0x2000 }, + [SIFIVE_U_GEM] = { 0x10090000, 0x2000 }, + [SIFIVE_U_GEM_MGMT] = { 0x100a0000, 0x1000 }, }; #define OTP_SERIAL 1 @@ -85,7 +90,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, char ethclk_names[] = "pclk\0hclk"; uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; uint32_t uartclk_phandle; - uint32_t hfclk_phandle, rtcclk_phandle; + uint32_t hfclk_phandle, rtcclk_phandle, phy_phandle; fdt = s->fdt = create_device_tree(&s->fdt_size); if (!fdt) { @@ -255,21 +260,28 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, ethclk_phandle = qemu_fdt_get_phandle(fdt, nodename); g_free(nodename); + phy_phandle = phandle++; nodename = g_strdup_printf("/soc/ethernet@%lx", (long)memmap[SIFIVE_U_GEM].base); qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_string(fdt, nodename, "compatible", "cdns,macb"); + qemu_fdt_setprop_string(fdt, nodename, "compatible", + "sifive,fu540-c000-gem"); qemu_fdt_setprop_cells(fdt, nodename, "reg", 0x0, memmap[SIFIVE_U_GEM].base, - 0x0, memmap[SIFIVE_U_GEM].size); + 0x0, memmap[SIFIVE_U_GEM].size, + 0x0, memmap[SIFIVE_U_GEM_MGMT].base, + 0x0, memmap[SIFIVE_U_GEM_MGMT].size); qemu_fdt_setprop_string(fdt, nodename, "reg-names", "control"); qemu_fdt_setprop_string(fdt, nodename, "phy-mode", "gmii"); + qemu_fdt_setprop_cell(fdt, nodename, "phy-handle", phy_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupt-parent", plic_phandle); qemu_fdt_setprop_cell(fdt, nodename, "interrupts", SIFIVE_U_GEM_IRQ); qemu_fdt_setprop_cells(fdt, nodename, "clocks", prci_phandle, PRCI_CLK_GEMGXLPLL, prci_phandle, PRCI_CLK_GEMGXLPLL); qemu_fdt_setprop(fdt, nodename, "clock-names", ethclk_names, sizeof(ethclk_names)); + qemu_fdt_setprop(fdt, nodename, "local-mac-address", + s->soc.gem.conf.macaddr.a, ETH_ALEN); qemu_fdt_setprop_cell(fdt, nodename, "#address-cells", 1); qemu_fdt_setprop_cell(fdt, nodename, "#size-cells", 0); g_free(nodename); @@ -277,6 +289,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, nodename = g_strdup_printf("/soc/ethernet@%lx/ethernet-phy@0", (long)memmap[SIFIVE_U_GEM].base); qemu_fdt_add_subnode(fdt, nodename); + qemu_fdt_setprop_cell(fdt, nodename, "phandle", phy_phandle); qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0); g_free(nodename); @@ -534,6 +547,9 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev, Error **errp) sysbus_mmio_map(SYS_BUS_DEVICE(&s->gem), 0, memmap[SIFIVE_U_GEM].base); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gem), 0, plic_gpios[SIFIVE_U_GEM_IRQ]); + + create_unimplemented_device("riscv.sifive.u.gem-mgmt", + memmap[SIFIVE_U_GEM_MGMT].base, memmap[SIFIVE_U_GEM_MGMT].size); } static void riscv_sifive_u_machine_init(MachineClass *mc) diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index 7d9d901..d2b9d99 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -63,7 +63,8 @@ enum { SIFIVE_U_UART1, SIFIVE_U_OTP, SIFIVE_U_DRAM, - SIFIVE_U_GEM + SIFIVE_U_GEM, + SIFIVE_U_GEM_MGMT }; enum { From patchwork Fri Aug 23 05:11:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B56A1709 for ; Fri, 23 Aug 2019 05:41:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D627821019 for ; Fri, 23 Aug 2019 05:41:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X03nJwsu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D627821019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12Jt-0001Ty-1L for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:41:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45282) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11ra-0004Wp-Q7 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11rZ-0002pa-7o for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:50 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:34843) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11rZ-0002pK-2B; Fri, 23 Aug 2019 01:11:49 -0400 Received: by mail-pg1-x543.google.com with SMTP id n4so5102322pgv.2; Thu, 22 Aug 2019 22:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=mZL9h/bKRMuQuWVv7NByPM2xYVHQluXKxIATUm/Qd2A=; b=X03nJwsuGqdj94XZ6o0+9gsl8S7rzLgTFxRowykpQUWnGAcs5yaURRYTcA1GkopHYm 51DbPFFPuN29xJK6gMarvYkH7caBpIEzaxG+Pgj6sVRakDCzqp1rNBaujamtWBjZMBVE Wd2vrx3Erq5TBjTCXmuOXd5jZeREdMko52czADDJOEhjXuJpaBEymUz6VGijXtF/hNMn s7j5vpE0+FvoRaN3VWmcOIz02RPqDa6OJU7KIYUA/cOOF9V32kDFZhmk9ybuC+xwzwmY 7dIftJOyaif9RXdkc/0rLS7By/aXlU7+f/6Fixs0Ohg6jdDM9xNs005ulihDov0X+cf+ GADg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=mZL9h/bKRMuQuWVv7NByPM2xYVHQluXKxIATUm/Qd2A=; b=KKD7en127XMXOMV94PeTH691xgYfZ0xuFnS+dpS52FtCKQgCiGHw48CGZCngAJ9YwI /JV2hXP3jd7eirytU+gIgG6ptLWlSSM0kp9ToiT0CTrCPAQHwQQNLDh/SqwgMj8lH5Cq byuVvt9wf7FZlDGVvI1Uuz/cknpOvpdjOaljprJlSfpxXZElqjcNSxWuemTYaR4RXFll TR0/pT2ZDnl5cpnjdWZ47Fv98bSPQtlsqrW3O4FjFkvPOEfhoiUTr+nV3/UWAsg3NKcG okEP23B/S5RLXpmmUXNFFy1RfA9vE2rLHDeSgag2w1FSse+HgBEZfyEb7BMbODGtCP3X dELQ== X-Gm-Message-State: APjAAAW7h+RjptXAB0PO+FWjGlN/s2yckaUmzJYqftWCgG+bpqMUS7TK nLI1VFm/2pvXtlaPca6jB70= X-Google-Smtp-Source: APXvYqwWyIdaJD1wdH3bRPE8sGvUug+vUiKjbvj43QAL6B03SujZ8CMbwkFywYtquPWictlIAzmd/A== X-Received: by 2002:a63:e602:: with SMTP id g2mr2350219pgh.224.1566537108292; Thu, 22 Aug 2019 22:11:48 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:47 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:08 -0700 Message-Id: <1566537069-22741-30-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 Subject: [Qemu-devel] [PATCH v5 29/30] riscv: sifive_u: Remove handcrafted clock nodes for UART and ethernet X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" In the past we did not have a model for PRCI, hence two handcrafted clock nodes ("/soc/ethclk" and "/soc/uartclk") were created for the purpose of supplying hard-coded clock frequencies. But now since we have added the PRCI support in QEMU, we don't need them any more. Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: - new patch to remove handcrafted clock nodes for UART and ethernet Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 24 +----------------------- include/hw/riscv/sifive_u.h | 3 +-- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 503db4b..1140c38 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -88,8 +88,7 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, uint32_t *cells; char *nodename; char ethclk_names[] = "pclk\0hclk"; - uint32_t plic_phandle, prci_phandle, ethclk_phandle, phandle = 1; - uint32_t uartclk_phandle; + uint32_t plic_phandle, prci_phandle, phandle = 1; uint32_t hfclk_phandle, rtcclk_phandle, phy_phandle; fdt = s->fdt = create_device_tree(&s->fdt_size); @@ -249,17 +248,6 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, g_free(cells); g_free(nodename); - ethclk_phandle = phandle++; - nodename = g_strdup_printf("/soc/ethclk"); - qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); - qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); - qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", - SIFIVE_U_GEM_CLOCK_FREQ); - qemu_fdt_setprop_cell(fdt, nodename, "phandle", ethclk_phandle); - ethclk_phandle = qemu_fdt_get_phandle(fdt, nodename); - g_free(nodename); - phy_phandle = phandle++; nodename = g_strdup_printf("/soc/ethernet@%lx", (long)memmap[SIFIVE_U_GEM].base); @@ -293,16 +281,6 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, qemu_fdt_setprop_cell(fdt, nodename, "reg", 0x0); g_free(nodename); - uartclk_phandle = phandle++; - nodename = g_strdup_printf("/soc/uartclk"); - qemu_fdt_add_subnode(fdt, nodename); - qemu_fdt_setprop_string(fdt, nodename, "compatible", "fixed-clock"); - qemu_fdt_setprop_cell(fdt, nodename, "#clock-cells", 0x0); - qemu_fdt_setprop_cell(fdt, nodename, "clock-frequency", 3686400); - qemu_fdt_setprop_cell(fdt, nodename, "phandle", uartclk_phandle); - uartclk_phandle = qemu_fdt_get_phandle(fdt, nodename); - g_free(nodename); - nodename = g_strdup_printf("/soc/serial@%lx", (long)memmap[SIFIVE_U_UART0].base); qemu_fdt_add_subnode(fdt, nodename); diff --git a/include/hw/riscv/sifive_u.h b/include/hw/riscv/sifive_u.h index d2b9d99..3bb87cb 100644 --- a/include/hw/riscv/sifive_u.h +++ b/include/hw/riscv/sifive_u.h @@ -76,8 +76,7 @@ enum { enum { SIFIVE_U_CLOCK_FREQ = 1000000000, SIFIVE_U_HFCLK_FREQ = 33333333, - SIFIVE_U_RTCCLK_FREQ = 1000000, - SIFIVE_U_GEM_CLOCK_FREQ = 125000000 + SIFIVE_U_RTCCLK_FREQ = 1000000 }; #define SIFIVE_U_MANAGEMENT_CPU_COUNT 1 From patchwork Fri Aug 23 05:11:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 11110615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D24421813 for ; Fri, 23 Aug 2019 05:46:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9FD5C21019 for ; Fri, 23 Aug 2019 05:46:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UFckUj9b" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FD5C21019 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i12PP-0007zo-Tr for patchwork-qemu-devel@patchwork.kernel.org; Fri, 23 Aug 2019 01:46:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45306) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i11rb-0004Xk-U6 for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i11ra-0002qY-Cw for qemu-devel@nongnu.org; Fri, 23 Aug 2019 01:11:51 -0400 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]:45734) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i11ra-0002q0-6j; Fri, 23 Aug 2019 01:11:50 -0400 Received: by mail-pf1-x442.google.com with SMTP id w26so5629154pfq.12; Thu, 22 Aug 2019 22:11:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=4/fBrUSZM2vbDjvLLKFAmPyvCRfr5pCZu6f1f6oCKKg=; b=UFckUj9btkM0rqXR2PcUt44WVYMZGbnICfNBAtu5ZYKXuKngL/PAo7la3IIK5n0COc lfmD/G1bQtpOPqg1RhAhLU9nJSuv8v5OaKZKx/ftLgbGQiZRiU/RB00DXSbeAcjsTSpW Xf69DGv7+RvFoawZ4prfx62xBML66LBzkdBhWW8V0WUBVUCrkxndlQ3LJwSh44tfD4hQ V61aW0D4GaWOyNfMWwwxNXS+CS+YW8200YLC2W7MsEhn2DMcWK1rZCiOUAevjzexLVyG z1KWL//hej2MsOQPs+AoowsJ/vGBS+O/d/PmFtJqCmrnzyrC56WD0dMVfbfMX97B16S2 aRUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=4/fBrUSZM2vbDjvLLKFAmPyvCRfr5pCZu6f1f6oCKKg=; b=GR5Kcj/fG11v39LvxfOzofHgUIbvRaNSEtNlvxRMO6spCWufpINc2xTvueUBCja6t3 Rk4163y20jNAv5XvuHf8tan/pdSgzdILS6k0hirqoJ8faPb1ZG59GyR83ksPNsfRi1z7 vri+ai8XWhohzwQ254IWyeras9Jr6iqWxuM41FJ9hNKhxWE4fogscYcD9vX8WaaL3NkM uODdy648ibN5DOSyZldfKFGbF0wjZGNU+C43o/2KHi1mz0PfgacR8ZXZphhEPHGaz9/z TfQ/0Fbx9uIK6VuDTJT0VoOqgWdIKkRMN6n3pilLQWdFCKWHc9zm7fXcjWSdtZUh1xyl hrEg== X-Gm-Message-State: APjAAAU/c2JqStvgLkR8XGrMGiFq7ylUxLqDlRviEkriD9SSkabrzwK/ YGfU3oLKjYorj6k6cpyXV64= X-Google-Smtp-Source: APXvYqxHmuXhoMyIKBVTADJoFNU93+MVlgM0m8WfqFtMqrhiyKMYbZl0DbGOFOHGMZHOdozHrKJiGQ== X-Received: by 2002:a65:50c5:: with SMTP id s5mr2361462pgp.368.1566537109438; Thu, 22 Aug 2019 22:11:49 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id v189sm1122527pfv.176.2019.08.22.22.11.48 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 22 Aug 2019 22:11:48 -0700 (PDT) From: Bin Meng To: Alistair Francis , Palmer Dabbelt , qemu-devel@nongnu.org, qemu-riscv@nongnu.org Date: Thu, 22 Aug 2019 22:11:09 -0700 Message-Id: <1566537069-22741-31-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> References: <1566537069-22741-1-git-send-email-bmeng.cn@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::442 Subject: [Qemu-devel] [PATCH v5 30/30] riscv: sifive_u: Update model and compatible strings in device tree X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This updates model and compatible strings to use the same strings as used in the Linux kernel device tree (hifive-unleashed-a00.dts). Signed-off-by: Bin Meng Reviewed-by: Alistair Francis --- Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None hw/riscv/sifive_u.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 1140c38..fae19fe 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -97,8 +97,9 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, exit(1); } - qemu_fdt_setprop_string(fdt, "/", "model", "ucbbar,spike-bare,qemu"); - qemu_fdt_setprop_string(fdt, "/", "compatible", "ucbbar,spike-bare-dev"); + qemu_fdt_setprop_string(fdt, "/", "model", "SiFive HiFive Unleashed A00"); + qemu_fdt_setprop_string(fdt, "/", "compatible", + "sifive,hifive-unleashed-a00"); qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2); qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);