From patchwork Mon May 4 12:32:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 186117 Delivered-To: patch@linaro.org Received: by 2002:a92:8d81:0:0:0:0:0 with SMTP id w1csp85490ill; Mon, 4 May 2020 05:45:26 -0700 (PDT) X-Google-Smtp-Source: APiQypJytcNEKQFl1FxmhlXrKnpxEKQTh4KyObtKVD0Rs5NcyJVv77biOdjFE0FZyJmjahLMxCwZ X-Received: by 2002:a05:620a:2226:: with SMTP id n6mr15282191qkh.486.1588596325908; Mon, 04 May 2020 05:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588596325; cv=none; d=google.com; s=arc-20160816; b=OMvzvqPNk+pZ538zqQAo6NF4XALIjv86kKQkjdFV3UYJnDAwLBcGjUHAE1OByvi+JW ivKK9bnxwdBfLa2zdVnxvNVGwo7jxtMSgKOIvFFHtJXfdkbYcK70XlU5jaGAuJfxl23/ Y4HOKpbx3h7jVXw1+j8oEoIrTruBXeuuVREBVTaW/B8XbOh5TY8WviIsVgf+IyC6ePCK 5KIuWX4dIbD5KAKLcVYUoCKn/RGbV0uNrhEh7vc85CarwoiKbI7DjTdqugwfM6aQNYuw GMMWhNRhYMH1CS6zhzrJGfavzUcKOjlpAzOWhO8sQaGwxB3drQdBtaN+5nX6q5fgAZqQ TPrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=jVf6r09P5aGx03on/1HNxy/oqWSgeNz/oU/1pXVCDMQ=; b=JGwRKsBpsSvHKMBwIMrd2zVDe/4dK7e3zsuUbtLjulFtT0Ef5yfoUNZ0DVbOrrmZIl 2p1skdRn9pxKrJd60r6e1g7+3w8Y1CF+dgfcFX4wD+dU4YVY11Nnv4f4++IGPQx9a5cs CR397+zmPbhdU3uPDYbsfN0K/o0VJkYhDoWTnp2lXYFFPbnhCw92garcCYToSHZwWcmw P5JE/HyYUjO8HHramnNvk9u6SjEVHlMszOXEaIbpEd130MNo6/fKqcCWxP3Iw0z4grqU xVV1Ka3JNe7UG5kWAXol6EzH6KYBZY9b2z9TFuZRM1weryT2x7FVXsYzBlKiXH6B6f+1 ZrOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xN5Y7hO4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:470:142::17]) by mx.google.com with ESMTPS id u15si6362056qvf.115.2020.05.04.05.45.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 May 2020 05:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) client-ip=2001:470:142::17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xN5Y7hO4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVaTN-0005DH-A9 for patch@linaro.org; Mon, 04 May 2020 08:45:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVaHs-0000Fe-53 for qemu-devel@nongnu.org; Mon, 04 May 2020 08:33:32 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVaHq-0000vI-9z for qemu-devel@nongnu.org; Mon, 04 May 2020 08:33:31 -0400 Received: by mail-wr1-x442.google.com with SMTP id k1so1831371wro.12 for ; Mon, 04 May 2020 05:33:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=jVf6r09P5aGx03on/1HNxy/oqWSgeNz/oU/1pXVCDMQ=; b=xN5Y7hO4ycQUqeuhQhPgegV1xgJ5dw+M9kxV6r6bI+JoPa2CJGT1mVLODhWXI1v4I+ jmmHUJFr64u9jE/lxdkUCuDDvuSZp7JbY/FDpT236iiyAM8qsP1AdBmW/RwCvnI3iweB p0+OasvUaKQmH3jDrCdMlpgeFN9mlJaTdmf9xSC+G11cRRuTNTsFGaIEI0w1Aw6GXOT4 msbwo2nkfXlti+m1aM7xgGk7XRKdsIbTsE4jkdMjzj1U6Jjv/ZfivWwpp7xKKiSC4sGC jl0XrRhCtwtvvQu2mwx5SRxreBzERhlGZ4+teQRqVtEx3w3hUgO6rF4p/puBbcWZ7BQF WGXw== 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=jVf6r09P5aGx03on/1HNxy/oqWSgeNz/oU/1pXVCDMQ=; b=qMdI2ZhTlHAhMxBKtS19+Lic/6dPlNHRJDK0wepFZiLETtVvI2WxcNBaK3kq4UatR7 LAp1fCIrv+8QptXYFDHpFHrkxfnVXh0t2qsK883dwkbQBrX0qu+2FSr10w4OJN+TCTez c16xe8pYbhlr9JFA6FMv3pZlyqBYMgIKdhGQm/VbHBYHQMbJMT9hWWOgBpB3LZReQrFp DWPbgZN+84M7hmc1MBRYmzXu/1dhFunXL79mgeRa1E4O8zBUNX19psfYJY7hoNT3Ki1J 8F7/NcnrkriSxVYvMDeN6pB4WuYS6ah4F+bEczUijFyyIDVZ5qQ/oh/gxa+nqHtfVJRX AlEw== X-Gm-Message-State: AGi0PuYjMM2YQMFUoLXqdu5tNxpcuYFlBmNaHpLPvK67QxYDdXWWSwaJ PtPb/BE7/4PG5eM0CsPJD+RwXGARQNArMg== X-Received: by 2002:adf:ea05:: with SMTP id q5mr4942004wrm.87.1588595608606; Mon, 04 May 2020 05:33:28 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id q4sm12253608wrx.9.2020.05.04.05.33.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 May 2020 05:33:28 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 15/39] hw/arm: versal: Embed the APUs into the SoC type Date: Mon, 4 May 2020 13:32:45 +0100 Message-Id: <20200504123309.3808-16-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200504123309.3808-1-peter.maydell@linaro.org> References: <20200504123309.3808-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Edgar E. Iglesias" Embed the APUs into the SoC type. Suggested-by: Peter Maydell Signed-off-by: Edgar E. Iglesias Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luc Michel Message-id: 20200427181649.26851-8-edgar.iglesias@gmail.com Signed-off-by: Peter Maydell --- include/hw/arm/xlnx-versal.h | 2 +- hw/arm/xlnx-versal-virt.c | 4 ++-- hw/arm/xlnx-versal.c | 19 +++++-------------- 3 files changed, 8 insertions(+), 17 deletions(-) -- 2.20.1 diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h index 94b7826fd49..426b66449de 100644 --- a/include/hw/arm/xlnx-versal.h +++ b/include/hw/arm/xlnx-versal.h @@ -36,7 +36,7 @@ typedef struct Versal { struct { struct { MemoryRegion mr; - ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS]; + ARMCPU cpu[XLNX_VERSAL_NR_ACPUS]; GICv3State gic; } apu; } fpd; diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 8a608074d15..d7be1ad4942 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine) s->binfo.get_dtb = versal_virt_get_dtb; s->binfo.modify_dtb = versal_virt_modify_dtb; if (machine->kernel_filename) { - arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo); + arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo); } else { - AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0], + AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0], &s->binfo); /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL). * Offset things by 4K. */ diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c index ebd2dc51beb..c8a296e2e05 100644 --- a/hw/arm/xlnx-versal.c +++ b/hw/arm/xlnx-versal.c @@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s) for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) { Object *obj; - char *name; - - obj = object_new(XLNX_VERSAL_ACPU_TYPE); - if (!obj) { - error_report("Unable to create apu.cpu[%d] of type %s", - i, XLNX_VERSAL_ACPU_TYPE); - exit(EXIT_FAILURE); - } - - name = g_strdup_printf("apu-cpu[%d]", i); - object_property_add_child(OBJECT(s), name, obj, &error_fatal); - g_free(name); + object_initialize_child(OBJECT(s), "apu-cpu[*]", + &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]), + XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL); + obj = OBJECT(&s->fpd.apu.cpu[i]); object_property_set_int(obj, s->cfg.psci_conduit, "psci-conduit", &error_abort); if (i) { @@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s) object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory", &error_abort); object_property_set_bool(obj, true, "realized", &error_fatal); - s->fpd.apu.cpu[i] = ARM_CPU(obj); } } @@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic) } for (i = 0; i < nr_apu_cpus; i++) { - DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]); + DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]); int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS; qemu_irq maint_irq; int ti;