Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4483CD4F54 for ; Thu, 28 May 2026 22:33:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wSjHU-00007d-3r; Thu, 28 May 2026 18:32:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wSi1b-0008VZ-BO for qemu-arm@nongnu.org; Thu, 28 May 2026 17:12:19 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1wSi1X-00055A-OY for qemu-arm@nongnu.org; Thu, 28 May 2026 17:12:18 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4903d730b1fso65175555e9.2 for ; Thu, 28 May 2026 14:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780002734; x=1780607534; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pd+UEfP8Fkx65KGHNLigoqyWnVI7rHhjzFMv0CnIYaw=; b=BrIztlZdGcUnahBn/Ey2/Hx+kHGjqLcaWnfLQDnIBt05tchHoGgwvr0a7/ZB+9sXOM m4yjO3jSokEkEN71knbs1McyGAWzdt3C+E5DDBkURKBFNLMdChPPXiPbmfRFIGUbiGRu V4nNjnyF3yMoo8uQyIvl2+QAm+YKVk1NqSIFa4tk9Oi3tMgs/8dIpGp4ET1uHZrOgsWo VhvMos65scTmMQZvcIefUpv4+c5/OHFTv5VupNi1YVFBKg+/eB5FGCyzoMDn4pMVIgN0 Q9RiZOkWsrafIB2z9kTT/PNedW7XFr0MI/Xgj8pC33nCNcagk7n6RowMhFq8WpcW3uU6 p2rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780002734; x=1780607534; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Pd+UEfP8Fkx65KGHNLigoqyWnVI7rHhjzFMv0CnIYaw=; b=itLncrfqc4w4PNPKA4sU2EEd2s0UmbRVlwC0AnzI2PeoiHo7/Fk6uuW/N4T3y6X2ns tKX5SfRVdd8Y95wxDqrfWZptyZpeuCnFVZYD72mae9yOYGERHOWY7O5d6X2pokh13/VQ OscD30bd3BM1RcWcwuqwsVlA0zah7CQBrm0KaZDxn5hHzwHhBKbEGhglxCIRZX6FX4Ug 0Buxq4KO0HWe62fqY+Ck3FFuqedJKy36FwIrJMKcXhMjyLIug4encu4Z+QhG+1rxz8kw YnSPzlCJVxjXx0VI3ggSZpPcMTa0mgbm3v71k7UIOM9Bxf6yad11uNI1FUuhZEiaAgx6 87UQ== X-Forwarded-Encrypted: i=1; AFNElJ9SW65oR+BWmQzC4SEv5ANYz5Aj7ftmLo/LVEBdiGJQWl9u59PuGYpes9ccO48xFc13EgW2iTppoQ==@nongnu.org X-Gm-Message-State: AOJu0YzYNlGboqoG69ebSg4On7QvWYT+XtzkZAFbCxGeVgp0VN5swI/A 3nEiE42exsXui3lmvjd6clJONDHUhOikbR9/GgfblJClRduCc+n+L34J1PBGVGKw X-Gm-Gg: Acq92OFWiSTrAGtbNfBADvLAhcXiDfNoj6Tsyozj5GTzSACwZBFMAQGO6m7UiPuFp9c 5YogxhwpjT84Nq/SyYKFrHYAK4cXPWOkzU3mMSlhM1wKDFZl7mgnXUsFq4neU3EhkbP/tGmh0oF +FfsatueGoXxGoJkpj1uJUvFXSZxVEH1tN94+JSjA1jKUgP1fDkDn4E8eu5GjnNPI0DRv4C6SCT pDpfNEs9RCBmyRma+yZVwT4LPv2Keh4G8WAe6Vk5qPoePLmTnctrSjYYx2kcM09ME1tcRJkH3Y5 +JQRaZnWcxxmL7+NWWRNZ70y3txMNHptJKJemOxJYPo4ZiBx5aXXJUT4McKvVG1pwoSSvq9A06Z useC1I93Dsn22DSwBVD1x5asOzMvtLLxKc1/DjgZ22wCMnjnoCDWieshH06SWfRdEL27bMTHFoT 0dlp7YPHkpuCL1DvQ= X-Received: by 2002:a05:600c:3504:b0:488:d6eb:e63c with SMTP id 5b1f17b1804b1-4909c0b493bmr2242105e9.15.1780002733800; Thu, 28 May 2026 14:12:13 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4909c609787sm108365e9.6.2026.05.28.14.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 May 2026 14:12:13 -0700 (PDT) From: Wadim Mueller To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: Peter Maydell , Paolo Bonzini Subject: [RFC PATCH v0 2/2] hw/arm: Add AM64-virt machine Date: Thu, 28 May 2026 23:12:10 +0200 Message-ID: <20260528211210.74266-3-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260528211210.74266-1-wafgo01@gmail.com> References: <20260528211210.74266-1-wafgo01@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=wafgo01@gmail.com; helo=mail-wm1-x336.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 28 May 2026 18:32:47 -0400 X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Sender: qemu-arm-bounces+qemu-arm=archiver.kernel.org@nongnu.org Add an "am64-virt" machine that instantiates the TI AM64x SoC model and prepares it to boot a Linux kernel on the Cortex-A53 cluster. The machine wires up DDR at 0x80000000 and uses the standard ARM PSCI SMC conduit for SMP bring-up. It is intentionally minimal: - No built-in device tree; users supply one via -dtb. - No flash, no PCIe, no MCU/R5F cores. The intent is to provide a starting point on top of which the full AM64x platform (mailbox, secure proxy, DMSC/TISCI service, M4F core, R5F cores, dynamic DT generation, ...) can be added in subsequent patches. Signed-off-by: Wadim Mueller --- hw/arm/Kconfig | 7 ++++ hw/arm/am64-virt.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 3 files changed, 88 insertions(+) create mode 100644 hw/arm/am64-virt.c diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index 96cb0f5185..e0884a806e 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -631,6 +631,13 @@ config TI_AM64X select ARM_GIC select SERIAL_MM +config AM64_VIRT + bool + default y + depends on AARCH64 + depends on TCG + select TI_AM64X + config ARM_SMMUV3 bool diff --git a/hw/arm/am64-virt.c b/hw/arm/am64-virt.c new file mode 100644 index 0000000000..3018773045 --- /dev/null +++ b/hw/arm/am64-virt.c @@ -0,0 +1,80 @@ +/* + * TI K3 AM64-virt machine + * + * Copyright (c) 2026 CMBlu + * Written by Wadim Mueller + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qemu/units.h" +#include "hw/arm/boot.h" +#include "hw/arm/machines-qom.h" +#include "hw/arm/ti-am64x.h" +#include "hw/boards.h" +#include "qemu/error-report.h" +#include "system/address-spaces.h" + +#define AM64_VIRT_DRAM_BASE 0x80000000ULL + +typedef struct AM64VirtMachineState { + MachineState parent_obj; + TIAM64xState soc; + struct arm_boot_info bootinfo; +} AM64VirtMachineState; + +#define TYPE_AM64_VIRT_MACHINE MACHINE_TYPE_NAME("am64-virt") +OBJECT_DECLARE_SIMPLE_TYPE(AM64VirtMachineState, AM64_VIRT_MACHINE) + +static void am64_virt_init(MachineState *machine) +{ + AM64VirtMachineState *ams = AM64_VIRT_MACHINE(machine); + MemoryRegion *sysmem = get_system_memory(); + + if (machine->ram_size > 2 * GiB) { + error_report("am64-virt: maximum supported RAM size is 2 GiB"); + exit(1); + } + + object_initialize_child(OBJECT(machine), "soc", &ams->soc, TYPE_TI_AM64X); + sysbus_realize_and_unref(SYS_BUS_DEVICE(&ams->soc), &error_fatal); + + memory_region_add_subregion(sysmem, AM64_VIRT_DRAM_BASE, machine->ram); + + ams->bootinfo.ram_size = machine->ram_size; + ams->bootinfo.loader_start = AM64_VIRT_DRAM_BASE; + ams->bootinfo.psci_conduit = QEMU_PSCI_CONDUIT_SMC; + ams->bootinfo.board_id = -1; + arm_load_kernel(&ams->soc.a53[0], machine, &ams->bootinfo); +} + +static void am64_virt_machine_class_init(ObjectClass *oc, const void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + + mc->desc = "TI K3 AM64x virt machine"; + mc->init = am64_virt_init; + mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a53"); + mc->default_ram_id = "am64-virt.ram"; + mc->default_ram_size = 1 * GiB; + mc->default_cpus = TI_AM64X_NUM_A53_CPUS; + mc->max_cpus = TI_AM64X_NUM_A53_CPUS; + mc->min_cpus = 1; +} + +static const TypeInfo am64_virt_machine_info = { + .name = TYPE_AM64_VIRT_MACHINE, + .parent = TYPE_MACHINE, + .instance_size = sizeof(AM64VirtMachineState), + .class_init = am64_virt_machine_class_init, + .interfaces = arm_aarch64_machine_interfaces, +}; + +static void am64_virt_machine_register_types(void) +{ + type_register_static(&am64_virt_machine_info); +} + +type_init(am64_virt_machine_register_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 89fad790f5..faa00741c3 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -85,6 +85,7 @@ arm_common_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP', if_true: files('fsl-imx8mp.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP_EVK', if_true: files('imx8mp-evk.c')) arm_common_ss.add(when: 'CONFIG_TI_AM64X', if_true: files('ti-am64x.c')) +arm_common_ss.add(when: 'CONFIG_AM64_VIRT', if_true: files('am64-virt.c')) arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c')) arm_common_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c')) arm_common_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) -- 2.52.0