From patchwork Fri Dec 7 09:01:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luc Michel X-Patchwork-Id: 10717697 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B49BB109C for ; Fri, 7 Dec 2018 09:08:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0EA22E699 for ; Fri, 7 Dec 2018 09:08:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 953992E764; Fri, 7 Dec 2018 09:08:12 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 0EB962E699 for ; Fri, 7 Dec 2018 09:08:12 +0000 (UTC) Received: from localhost ([::1]:44869 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVC7H-0005wt-6G for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Dec 2018 04:08:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVC1b-0008Bd-GS for qemu-devel@nongnu.org; Fri, 07 Dec 2018 04:02:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gVC1a-0005gi-J4 for qemu-devel@nongnu.org; Fri, 07 Dec 2018 04:02:19 -0500 Received: from greensocs.com ([193.104.36.180]:52241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gVC1X-0005Rk-SR; Fri, 07 Dec 2018 04:02:16 -0500 Received: from localhost (localhost [127.0.0.1]) by greensocs.com (Postfix) with ESMTP id D1507480024; Fri, 7 Dec 2018 10:01:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1544173314; bh=qT1myRY8+72bGIoRFHUkl0awqFWddD9vzwxt3H9ioig=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XV3yCyGGd0WS0n1cMj5WbEVVR6kLqWlHB28ZE8eIyX07DhHC/Jhv5Zi4+nU40p5ui 8JkYoZpF6QbIABL8P5xBHqnDSU0HRlF7QuJNVerKsvkgly6Fe6cL3a8IyCbTSwRLRo koeegQLyZ4zovW3vOER6UrLsx447md3lxcJWbeUc= X-Virus-Scanned: amavisd-new at greensocs.com Authentication-Results: gs-01.greensocs.com (amavisd-new); dkim=pass (1024-bit key) header.d=greensocs.com header.b=Ajz1vfMD; dkim=pass (1024-bit key) header.d=greensocs.com header.b=z1+UaR0E Received: from greensocs.com ([127.0.0.1]) by localhost (gs-01.greensocs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ujpnGvA8f5ez; Fri, 7 Dec 2018 10:01:54 +0100 (CET) Received: by greensocs.com (Postfix, from userid 998) id 1392B48001C; Fri, 7 Dec 2018 10:01:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1544173308; bh=qT1myRY8+72bGIoRFHUkl0awqFWddD9vzwxt3H9ioig=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ajz1vfMD1cGgZcb1RCzF36aXePccBemPugnW32OXkolXLuLddBkzYYN2Qxm3h4Cgb SMksIasQIMWSLOcbUPyizfbHQFKkYwcSdibZrpzujOXqGOjWZO7Arxhl3oRcR2ptSn OyUldMBSf0ySIXJsfsdKjji+j6nvRfwM3r6XQMkk= Received: from michell-laptop.home.lmichel.fr (lfbn-1-8165-82.w90-112.abo.wanadoo.fr [90.112.74.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: luc.michel@greensocs.com) by greensocs.com (Postfix) with ESMTPSA id 951C148002B; Fri, 7 Dec 2018 10:01:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=greensocs.com; s=mail; t=1544173307; bh=qT1myRY8+72bGIoRFHUkl0awqFWddD9vzwxt3H9ioig=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=z1+UaR0Eprn37p6DyL9pDiL4dR2JSVrLyMmzZpvRNCBpfgmtOThg1LP87zhlvdEf7 CKRZzpx1SNH6wMe2W1ic/h63eAkmO8Ut1RjSBw6S3I2wuKi2Y0mg1e234XVHX3m6cD DuP0Q9ECdX78xBNf5W5xI3NqDDItgZVrxifz+VNg= From: Luc Michel To: qemu-devel@nongnu.org Date: Fri, 7 Dec 2018 10:01:34 +0100 Message-Id: <20181207090135.7651-17-luc.michel@greensocs.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181207090135.7651-1-luc.michel@greensocs.com> References: <20181207090135.7651-1-luc.michel@greensocs.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 193.104.36.180 Subject: [Qemu-devel] [PATCH v8 16/16] arm/xlnx-zynqmp: put APUs and RPUs in separate CPU clusters 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 , Eduardo Habkost , alistair@alistair23.me, mark.burton@greensocs.com, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , saipava@xilinx.com, edgari@xilinx.com, qemu-arm@nongnu.org, Luc Michel Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Create two separate CPU clusters for APUs and RPUs. Signed-off-by: Luc Michel Reviewed-by: Edgar E. Iglesias Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- include/hw/arm/xlnx-zynqmp.h | 3 +++ hw/arm/xlnx-zynqmp.c | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h index 98f925ab84..591515c760 100644 --- a/include/hw/arm/xlnx-zynqmp.h +++ b/include/hw/arm/xlnx-zynqmp.h @@ -29,10 +29,11 @@ #include "hw/dma/xlnx_dpdma.h" #include "hw/dma/xlnx-zdma.h" #include "hw/display/xlnx_dp.h" #include "hw/intc/xlnx-zynqmp-ipi.h" #include "hw/timer/xlnx-zynqmp-rtc.h" +#include "hw/cpu/cluster.h" #define TYPE_XLNX_ZYNQMP "xlnx,zynqmp" #define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \ TYPE_XLNX_ZYNQMP) @@ -75,10 +76,12 @@ typedef struct XlnxZynqMPState { /*< private >*/ DeviceState parent_obj; /*< public >*/ + CPUClusterState apu_cluster; + CPUClusterState rpu_cluster; ARMCPU apu_cpu[XLNX_ZYNQMP_NUM_APU_CPUS]; ARMCPU rpu_cpu[XLNX_ZYNQMP_NUM_RPU_CPUS]; GICState gic; MemoryRegion gic_mr[XLNX_ZYNQMP_GIC_REGIONS][XLNX_ZYNQMP_GIC_ALIASES]; diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index c195040350..c67ac2e64a 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -176,16 +176,23 @@ static void xlnx_zynqmp_create_rpu(XlnxZynqMPState *s, const char *boot_cpu, { Error *err = NULL; int i; int num_rpus = MIN(smp_cpus - XLNX_ZYNQMP_NUM_APU_CPUS, XLNX_ZYNQMP_NUM_RPU_CPUS); + object_initialize_child(OBJECT(s), "rpu-cluster", &s->rpu_cluster, + sizeof(s->rpu_cluster), TYPE_CPU_CLUSTER, + &error_abort, NULL); + qdev_prop_set_uint32(DEVICE(&s->rpu_cluster), "cluster-id", 1); + + qdev_init_nofail(DEVICE(&s->rpu_cluster)); + for (i = 0; i < num_rpus; i++) { char *name; object_initialize(&s->rpu_cpu[i], sizeof(s->rpu_cpu[i]), "cortex-r5f-" TYPE_ARM_CPU); - object_property_add_child(OBJECT(s), "rpu-cpu[*]", + object_property_add_child(OBJECT(&s->rpu_cluster), "rpu-cpu[*]", OBJECT(&s->rpu_cpu[i]), &error_abort); name = object_get_canonical_path_component(OBJECT(&s->rpu_cpu[i])); if (strcmp(name, boot_cpu)) { /* Secondary CPUs start in PSCI powered-down state */ @@ -211,14 +218,20 @@ static void xlnx_zynqmp_init(Object *obj) { XlnxZynqMPState *s = XLNX_ZYNQMP(obj); int i; int num_apus = MIN(smp_cpus, XLNX_ZYNQMP_NUM_APU_CPUS); + object_initialize_child(obj, "apu-cluster", &s->apu_cluster, + sizeof(s->apu_cluster), TYPE_CPU_CLUSTER, + &error_abort, NULL); + qdev_prop_set_uint32(DEVICE(&s->apu_cluster), "cluster-id", 0); + for (i = 0; i < num_apus; i++) { - object_initialize_child(obj, "apu-cpu[*]", &s->apu_cpu[i], - sizeof(s->apu_cpu[i]), - "cortex-a53-" TYPE_ARM_CPU, &error_abort, NULL); + object_initialize_child(OBJECT(&s->apu_cluster), "apu-cpu[*]", + &s->apu_cpu[i], sizeof(s->apu_cpu[i]), + "cortex-a53-" TYPE_ARM_CPU, &error_abort, + NULL); } sysbus_init_child_obj(obj, "gic", &s->gic, sizeof(s->gic), gic_class_name()); @@ -331,10 +344,12 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) qdev_prop_set_uint32(DEVICE(&s->gic), "num-cpu", num_apus); qdev_prop_set_bit(DEVICE(&s->gic), "has-security-extensions", s->secure); qdev_prop_set_bit(DEVICE(&s->gic), "has-virtualization-extensions", s->virt); + qdev_init_nofail(DEVICE(&s->apu_cluster)); + /* Realize APUs before realizing the GIC. KVM requires this. */ for (i = 0; i < num_apus; i++) { char *name; object_property_set_int(OBJECT(&s->apu_cpu[i]), QEMU_PSCI_CONDUIT_SMC,