From patchwork Thu May 19 22:48:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9128401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E355C60467 for ; Thu, 19 May 2016 22:56:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6DA51FEDE for ; Thu, 19 May 2016 22:56:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB6A020265; Thu, 19 May 2016 22:56:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 47BCE1FEDE for ; Thu, 19 May 2016 22:56:26 +0000 (UTC) Received: from localhost ([::1]:52431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Wrh-0001OE-Ge for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 May 2016 18:56:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Wkb-0003mf-Rl for qemu-devel@nongnu.org; Thu, 19 May 2016 18:49:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3WkU-0006QH-Sy for qemu-devel@nongnu.org; Thu, 19 May 2016 18:49:04 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34202) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3WkU-0006QD-Lx; Thu, 19 May 2016 18:48:58 -0400 Received: by mail-wm0-x242.google.com with SMTP id n129so24837673wmn.1; Thu, 19 May 2016 15:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3a0GDCxOVF9E4rTvdUj+XonEggFOAlauUOBOCtNWntM=; b=bUvPNz44jkEEyyFqzN1DFrcyx0C/prakW49S+3u53LQyPdSUAeGRCEutW3JhP4bV+8 VSGJNiFU336Yn5ecbyThgZpzuxVegJXrPgGTn+im4Yi4whuxL5dmYwD/9qji1Eer+CEB +tJ5t4M+gEQ4wk3fzCLIdmc65UyPHORDqZqm+S2HTCgOit01bnqWrnWY6m1u3di2ExIZ po3nN5PC/JSV3vLVCU4NgKK1GtL09cSbS86ef3kLuTZlV3F9wAHs39CgYOcTfIgGEUSj NE3Xf0FLpTff9tEbzlkgmUsp6mSPojLKqBUImxZBb4QZGANS97Zklpk8yvwjB9lSGnGN DD4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3a0GDCxOVF9E4rTvdUj+XonEggFOAlauUOBOCtNWntM=; b=GKDUv405f9YOZumqw45/prslPF15kOijfJ3Z5QOLwdK6xRD5EmI/K8tE+0bHvSbpm0 CGDKqpbkiEfw/+vz9lYHzpV/0a93BZ0vGJLhlEv8sFviS4AWSUzgsHZktuaGiVYzF8Qy lyf4xtBx5THMu5h5uAi9O5r/FNEeUuvK5U2fwo7zVQFU4+kE8n9iRkVD8esRX6Serr/V 9Avap1M2IotxkVBqDa3d0BMMAukV7SewGzXelqyYffJovp7cBAz7VvDu2mpbBON6Vik5 g73PUeSswYWrueEucdkIXnacFar0Hl8Xrl4hFgxFMUanDQhpXn06GUpuS76muUzHypT5 ThqQ== X-Gm-Message-State: AOPr4FU1TEgYQKy6LQKj9RTZrduewIuLQ16td/oJVgU6rL6o61orsBUMSXhkqs82ydMRvA== X-Received: by 10.194.192.106 with SMTP id hf10mr16081873wjc.52.1463698138000; Thu, 19 May 2016 15:48:58 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id n66sm1521130wmf.6.2016.05.19.15.48.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 May 2016 15:48:57 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org Date: Fri, 20 May 2016 00:48:50 +0200 Message-Id: <1463698133-30880-3-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1463698133-30880-1-git-send-email-edgar.iglesias@gmail.com> References: <1463698133-30880-1-git-send-email-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH v1 2/5] xlnx-zynqmp: Break out RPU setup into a separate function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, crosthwaite.peter@gmail.com, edgar.iglesiasl@xilinx.com, qemu-arm@nongnu.org, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Break out RPU setup into a separate function. This is in preparation for making the RPU optional. No functional change. Signed-off-by: Edgar E. Iglesias --- hw/arm/xlnx-zynqmp.c | 53 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index 965a250..250ecc4 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -83,6 +83,36 @@ static inline int arm_gic_ppi_index(int cpu_nr, int ppi_index) return GIC_NUM_SPI_INTR + cpu_nr * GIC_INTERNAL + ppi_index; } +static void xlnx_zynqmp_setup_rpu(XlnxZynqMPState *s, const char *boot_cpu, + Error **errp) +{ + Error *err = NULL; + int i; + + for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) { + char *name; + + name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i])); + if (strcmp(name, boot_cpu)) { + /* Secondary CPUs start in PSCI powered-down state */ + object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, + "start-powered-off", &error_abort); + } else { + s->boot_cpu_ptr = &s->rpu_cpu[i]; + } + g_free(name); + + object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "reset-hivecs", + &error_abort); + object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "realized", + &err); + if (err) { + error_propagate(errp, err); + return; + } + } +} + static void xlnx_zynqmp_init(Object *obj) { XlnxZynqMPState *s = XLNX_ZYNQMP(obj); @@ -260,28 +290,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) qdev_connect_gpio_out(DEVICE(&s->apu_cpu[i]), 1, irq); } - for (i = 0; i < XLNX_ZYNQMP_NUM_RPU_CPUS; i++) { - char *name; - - name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i])); - if (strcmp(name, boot_cpu)) { - /* Secondary CPUs start in PSCI powered-down state */ - object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, - "start-powered-off", &error_abort); - } else { - s->boot_cpu_ptr = &s->rpu_cpu[i]; - } - g_free(name); - - object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "reset-hivecs", - &error_abort); - object_property_set_bool(OBJECT(&s->rpu_cpu[i]), true, "realized", - &err); - if (err) { - error_propagate(errp, err); - return; - } - } + xlnx_zynqmp_setup_rpu(s, boot_cpu, errp); if (!s->boot_cpu_ptr) { error_setg(errp, "ZynqMP Boot cpu %s not found", boot_cpu);