From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375075; cv=none; d=zohomail.com; s=zohoarc; b=MfKtaFh6XNlvbJ366uQf6aoyCrqhmteFw4JdeKMvU+0mPCs/L2IElsJrsPegLgyBXtBI7ils7jtHBtzGzfaZ0EaTLI5UvTq3mS1mtPUFDgL0My9RCzu1AzMcMFXBlD4Bkaq9AbrzBqIpGJuGZDnF8s6/YYJhTzBaG3vGx9rrvkk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375075; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=z3tutFyBixuh8Wn/LaCdEZoodGAwEcP8Gs5QAPSskAE=; b=SkNeNEhbUbuUA4aiXkGoX+PLC3n338kQQYWUPRmTqlFCEM5a8YF0GuQgJAR1tHDgq0tyBkYiU66kgp+QYkLyUS+Qq4fAS+YINDEsQBjAEVcNmJ6ltSdSJpEIDtHw6hY+WZce804gNp8uvavT+P1WPmfBfWP+8jky7OMQ/Hdf9Xc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375075986710.3645038518357; Wed, 29 Jul 2026 18:31:15 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZd-0005fM-ML; Wed, 29 Jul 2026 21:28:37 -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 1wpFZa-0005dV-D5 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:34 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZX-0005Z6-3Q for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:34 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U18H8E3017560 for ; Thu, 30 Jul 2026 01:28:28 GMT Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvp7r1vh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:28 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c96b4f58ddcso1229703a12.3 for ; Wed, 29 Jul 2026 18:28:28 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= z3tutFyBixuh8Wn/LaCdEZoodGAwEcP8Gs5QAPSskAE=; b=iOjDYUB4BFkPdR2J Pgd3YQG2C500qCVQTOPoGCKMgwatX8sRxBcBJ8E4D4X4U6evZ3ECdElGe9qzZ5W/ KGDzgHvGecDdtCb9YFOdCzZTAr0Hlr9L2MwTJ2NmMoC2cEuz6RIeNpJDZTi/K0Sn ehTCekUCmC4ZwhlnYsPd6+eV0vi4XIohLnHZCVwOmwCerm/6sW3sWb4IPpJy1cj8 /k/2sN3n8YLZmnGsRtfa9Fy6gIjcAMrEqmHQqA/Jry3rJCFR/QDk1y97FQOm4pqP 9++h0mMfnJ9r5rSsOzTsKCDyqFl5l5+djdDj1SWHHPEMHSgj8erHz9RofQZPou0C F+qDRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374907; x=1785979707; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=z3tutFyBixuh8Wn/LaCdEZoodGAwEcP8Gs5QAPSskAE=; b=Nd+j0QwRlbuFKr9AK0VDVj0hwxiZD1r/Qn1bPcD02y2b36CAkiHtlNGoq2YgqMTOLW xPKX/WvVHHYFV4ZXN/Pzw2s0N7Qr83TOljx7jSnwDryid/Yd0M5QW4bQ6RM5f0lbD0Ac I3Ley/id2pMmIdYsYc3ozjA87hPcMjddxdmYn7K28CAsxPcCAbU4IwR124xoCySiLV7h bWZvNEgNQNudUSs2t041fLXvx5+sU33uAZMkvfWFSXHjvI4sCLW7TUBK1Mnc6zli8TTa 9cjWaUHyNc0QfQILhYvcJDLwBCiY29L4G/Q0eRj9ItLDeFw2GiJWCrn1EQ/0k7doo1Jl 9NrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374907; x=1785979707; h=content-transfer-encoding:content-type: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 :content-type; bh=z3tutFyBixuh8Wn/LaCdEZoodGAwEcP8Gs5QAPSskAE=; b=MMir8Jwn6J39J6/7VLCrB398CrK2wghGeHbdaCGFepjwvqnFcmJAN1Fp7vsbmZmZkc IDhPNMeCtwyT7/rnl9A1Bn3+xqYgFe/U8wMNwQTaEOr7v2Us0TTmZhgjIz9+94y6Aq7+ M150QWRcSJ6Y1Rl6nrLtbVqHs/dIvFrFmxDzydCqq5KhLy/5O38eoALU0HM4tUsfFQ+1 fkWjuP2E36+FZU7mznEVqoPcoWKkX1LCkaR3HiFN1zhceIoyTcPYQyZfqVGUerK1/n3K yf7MBtdZwP7baQIUnlHsIKbGfNnGycGg6QRuJ5reqOYj9HUWaNt1smVIOI6Ig90CYH/9 +UMA== X-Gm-Message-State: AOJu0YxDaB5WXzbC9Z1mOYkqoKf7+2iicNJubiorq4er/7YeYUIMjRwp IO60D8f0JGzEGF5ck7Ho7xyMPMVBnyvuXDVN/BotZQkFenq1FTOAxrnExikL3TgaCbZDuywpEEQ FTpC4gn8wy6z1V4iLCggjXaSarVHEMbFdttv4VvLBgITMOIW+jCM1qH2gifOTlb9KdA== X-Gm-Gg: AR+sD11U0YYmLGnzX4pPR/uzIgtfJ7VMmJEUR8WkAmAoerlvfwT7SkoR2FYs/6WAshY duV6euo5OLvZKCOc6bHw8ijdInehSUz1Vc6Rju+1qd03bD2Rmte/yqb1N4oTxzMYLGUooJGMk5N O31TzDnhiwHV7etpYkSiwzomiZZ72BFZSxx6RcRa7G5KhYp/9KnID19DoWUia1icuxbu2zrjz2O cPEGYdP32SOlf+xvZ+NdumbTkmQQJ847/5BhNfDZ6RPG2tvF/3+yJBrNP6BlHDdxA9cdnpYqXuo FCsfEeoJ1AP4eERxvxZeQ8vFGHFUUf/NSoh8f7xcuUH1prw56RnKSVJvxZyF7/t6ia9Ry3A9ufc Px8/7GjSKGKrsTipaHh0OLCPnK0HONeiNBfmHD9lQvj3F7HXr X-Received: by 2002:a05:6a20:7f9a:b0:3c3:8fc3:5373 with SMTP id adf61e73a8af0-3c90085c8b8mr427392637.35.1785374907348; Wed, 29 Jul 2026 18:28:27 -0700 (PDT) X-Received: by 2002:a05:6a20:7f9a:b0:3c3:8fc3:5373 with SMTP id adf61e73a8af0-3c90085c8b8mr427363637.35.1785374906844; Wed, 29 Jul 2026 18:28:26 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 01/18] hw/hexagon: add hex-subsys Date: Wed, 29 Jul 2026 18:28:06 -0700 Message-Id: <20260730012824.1135905-2-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: B4P0FYIeb_6cP3PwrbhIuUYdMqcBA9XU X-Proofpoint-ORIG-GUID: B4P0FYIeb_6cP3PwrbhIuUYdMqcBA9XU X-Authority-Analysis: v=2.4 cv=cMvQdFeN c=1 sm=1 tr=0 ts=6a6aa8bc cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=8oo-Xqheu1KagxFlSIAA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX90NzFV/anQ1H oBJkkT6dogI41rzrhijS2TInz0SiHRUR4iC3Xd0wt+DX4YTmC/pecKNqiCgZXURzmviivMQyd9Z qCAXbedEozrz2KR5uGfn46E91ERTXeA= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX9CZVQlKauDjo nNlG7anmrMJvCWieaq+3nDXqQklfQqWqZEVti5xC/7EGpYuNbh083AmLgL4lAJRLG2qzJ9e6PYA w/CTY5OQbz9dGJogTPpO8hXVYbJZRSVQUadCce1lU6Q3IDcx2RrpMJKy3GWGYhvsR6oN9GjquNq eKPlYq56RgpC/GsWdpvg6zvfqiujPPK+NMhN9D3143It13GK2C1ifuRiKcV6WblgVbVhM/MHNms Sd29kp/zls5SaOZj8mm3bQIqE8st1nesGaMD8m2CiFs+tbwLYbmjLooAel/EVQlVCLq/z+pv5y7 Z6XbUIGJxByRQ5mf2M2OXJXo08NTgGtnQHQbsHQ8Dv7iHbulA1wnRBOItWl/cQRwU2WGwn8vocw AG/zEHajOZtGvyxvnicxSF9NnxevCYlPqTKEqMcih4GvI9LOid3dHXVfi+Jv/CDfDovJ9i+i8J4 MGd/00eFSK1VQ+aJduw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375077011158500 The virt and DSP machine models build the same core subsystem, let's abstract out that part. Start with the DDR and config table ROM setup. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hex-subsys.h | 17 +++++++++++++++++ hw/hexagon/hex-subsys.c | 32 ++++++++++++++++++++++++++++++++ hw/hexagon/hexagon_dsp.c | 17 ++--------------- hw/hexagon/virt.c | 14 ++------------ hw/hexagon/meson.build | 1 + 5 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 include/hw/hexagon/hex-subsys.h create mode 100644 hw/hexagon/hex-subsys.c diff --git a/include/hw/hexagon/hex-subsys.h b/include/hw/hexagon/hex-subsy= s.h new file mode 100644 index 00000000000..6bcde303f2e --- /dev/null +++ b/include/hw/hexagon/hex-subsys.h @@ -0,0 +1,17 @@ +/* + * Hexagon subsystem helpers shared between the machine models. + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_HEXAGON_HEX_SUBSYS_H +#define HW_HEXAGON_HEX_SUBSYS_H + +#include "hw/hexagon/hexagon.h" + +/* Create the subsystem shared by every Hexagon machine. */ +void hex_subsys_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *m_cfg); + +#endif /* HW_HEXAGON_HEX_SUBSYS_H */ diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c new file mode 100644 index 00000000000..d146ee0c075 --- /dev/null +++ b/hw/hexagon/hex-subsys.c @@ -0,0 +1,32 @@ +/* + * Hexagon subsystem helpers shared between the machine models. + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/hexagon/hex-subsys.h" +#include "hw/core/loader.h" +#include "system/address-spaces.h" + +void hex_subsys_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *m_cfg) +{ + MachineState *machine =3D MACHINE(hms); + MemoryRegion *sysmem =3D get_system_memory(); + + /* Main DDR at the reset vector. */ + memory_region_init_ram(&hms->ram, NULL, "ddr.ram", machine->ram_size, + &error_fatal); + memory_region_add_subregion(sysmem, 0x0, &hms->ram); + + /* Config-table ROM and the blob that backs it. */ + memory_region_init_rom(&hms->cfgtable_rom, NULL, "config_table.rom", + sizeof(m_cfg->cfgtable), &error_fatal); + memory_region_add_subregion(sysmem, m_cfg->cfgbase, &hms->cfgtable_rom= ); + rom_add_blob_fixed_as("config_table.rom", &m_cfg->cfgtable, + sizeof(m_cfg->cfgtable), m_cfg->cfgbase, + &address_space_memory); +} diff --git a/hw/hexagon/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index aa493993229..f94f7fd4e11 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -14,6 +14,7 @@ #include "hw/core/boards.h" #include "hw/core/qdev-properties.h" #include "hw/hexagon/hexagon.h" +#include "hw/hexagon/hex-subsys.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" @@ -108,7 +109,6 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, { HexagonCommonMachineState *hms =3D HEXAGON_COMMON_MACHINE(machine); HexagonDspMachineState *dms =3D HEXAGON_DSP_MACHINE(machine); - MemoryRegion *address_space; DeviceState *glob_regs_dev; DeviceState *tlb_dev; =20 @@ -120,16 +120,7 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, =20 machine->enable_graphics =3D 0; =20 - address_space =3D get_system_memory(); - - memory_region_init_rom(&hms->cfgtable_rom, NULL, "config_table.rom", - sizeof(m_cfg->cfgtable), &error_fatal); - memory_region_add_subregion(address_space, m_cfg->cfgbase, - &hms->cfgtable_rom); - - memory_region_init_ram(&hms->ram, NULL, "ddr.ram", - machine->ram_size, &error_fatal); - memory_region_add_subregion(address_space, 0x0, &hms->ram); + hex_subsys_create(hms, m_cfg); =20 glob_regs_dev =3D qdev_new(TYPE_HEXAGON_GLOBALREG); object_property_add_child(OBJECT(machine), "global-regs", @@ -162,10 +153,6 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, OBJECT(tlb_dev), &error_fatal); qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); } - - rom_add_blob_fixed_as("config_table.rom", &m_cfg->cfgtable, - sizeof(m_cfg->cfgtable), m_cfg->cfgbase, - &address_space_memory); } =20 static void init_mc(MachineClass *mc) diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index b7504725026..ad0bc4f1329 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -13,6 +13,7 @@ #include "hw/core/clock.h" #include "hw/core/sysbus-fdt.h" #include "hw/hexagon/hexagon.h" +#include "hw/hexagon/hex-subsys.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" @@ -244,9 +245,7 @@ static void virt_init(MachineState *ms) vms->apb_clk =3D clock_new(OBJECT(ms), "apb-pclk"); clock_set_hz(vms->apb_clk, 24000000); =20 - memory_region_init_ram(&vms->parent_obj.ram, NULL, "ddr.ram", - ms->ram_size, &error_fatal); - memory_region_add_subregion(vms->sys, 0x0, &vms->parent_obj.ram); + hex_subsys_create(&vms->parent_obj, m_cfg); =20 if (m_cfg->l2tcm_size) { memory_region_init_ram(&vms->tcm, NULL, "tcm.ram", m_cfg->l2tcm_si= ze, @@ -255,11 +254,6 @@ static void virt_init(MachineState *ms) &vms->tcm); } =20 - memory_region_init_rom(&vms->parent_obj.cfgtable_rom, NULL, - "config_table.rom", sizeof(m_cfg->cfgtable), - &error_fatal); - memory_region_add_subregion(vms->sys, m_cfg->cfgbase, - &vms->parent_obj.cfgtable_rom); fdt_add_hvx(vms, m_cfg); =20 gsregs_dev =3D qdev_new(TYPE_HEXAGON_GLOBALREG); @@ -302,10 +296,6 @@ static void virt_init(MachineState *ms) clk_phandle =3D fdt_add_clocks(vms); fdt_add_uart(vms, VIRT_UART0, clk_phandle); =20 - rom_add_blob_fixed_as("config_table.rom", &m_cfg->cfgtable, - sizeof(m_cfg->cfgtable), m_cfg->cfgbase, - &address_space_memory); - hexagon_load_fdt(vms); } =20 diff --git a/hw/hexagon/meson.build b/hw/hexagon/meson.build index bade3a32921..720a5d54dcc 100644 --- a/hw/hexagon/meson.build +++ b/hw/hexagon/meson.build @@ -1,6 +1,7 @@ hexagon_ss =3D ss.source_set() hexagon_ss.add(files('hexagon_tlb.c')) hexagon_ss.add(files('hexagon_globalreg.c')) +hexagon_ss.add(when: 'CONFIG_HEX_DSP', if_true: files('hex-subsys.c')) hexagon_ss.add(when: 'CONFIG_HEX_DSP', if_true: files('hexagon_dsp.c')) hexagon_ss.add(when: 'CONFIG_HEX_VIRT', if_true: files('virt.c')) =20 --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374951; cv=none; d=zohomail.com; s=zohoarc; b=VZRc1a0sS9XnkKGthVHwkN0d9M3J6FI0WHDreJkAOwPE5hhyRn55gdieAYFKawfzknx2jUcfhbIpTxCt6qbSswG9/lE/3o09/o+8AFbe4O8cCsO/aerIKteDlZJsC12avcdYIfj/+nY3AiZOjwBVyKOMXsV+sxFAOqGSdnVwaqs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374951; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lc0r0m3XKd4bkmC/58YlEfIB78yxw3GCW1HMX54fUKc=; b=iR89GotuTsJ0qye0iNBPnr9XEhz8ZLqppMTMZ67p3iRNKJgBSytMm7AgkivGLdloGXKcDmOmiuTt41/dgQTNcjtIaP2ek7VYX7Q3xs3KKw4lx+SMhCuVE4BTskPtHXV08ew/TYuMyf8w2avDWua7Gw7VOGHLaDyo4CfyqxXzkJE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374951469632.3877065546941; Wed, 29 Jul 2026 18:29:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZZ-0005dF-Pz; Wed, 29 Jul 2026 21:28:33 -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 1wpFZY-0005cv-PP for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:32 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZX-0005ZC-1T for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:32 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1JAEw3662648 for ; Thu, 30 Jul 2026 01:28:30 GMT Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvujr0ra-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:29 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2cc5faecf01so33044705ad.1 for ; Wed, 29 Jul 2026 18:28:29 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Lc0r0m3XKd4bkmC/58YlEfIB78yxw3GCW1HMX54fUKc=; b=Stfae7UCpowUm+ps oyDM1TT7zGmUFSiIWJHtwhC2EoCH3eNeqh9+IjsZYjNQ59oh5Hhvd4Ob1mCc1Y3C +qfRL56iHSV0u4+Jm1/xASASsZ91rm/305V5Nv2HIgP4ImJWCwLoQPz9LTUxwMep stYP2yKqsPswjepA1FaXSLNQYuwPZ1GnWihfHJDivP3SzBNgbV+f+WFZBHL25UW/ afoKJ8EyYccH94QKv8Ql7f5s0Cgu1JGfAS/0xUELlJzjx+ItRcGGbAhv6cbYR++i tP4ILAU8D9K/aR/OnCCSXa+qIomD+bBwhrcrGdEzJNY3GLL/Vb0+njULU94hVgPZ kOAp3A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374909; x=1785979709; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=Lc0r0m3XKd4bkmC/58YlEfIB78yxw3GCW1HMX54fUKc=; b=JliLsngEZDjkglVV1HrfXOK2zL6aZoaktRHFucWTYWs9xkfxdrPcp1kVR74vXfNjmx jt8XUt+v5HOPWNi/wXLGeGwrSARX2sAe5m3BfnIYY60X3a9dPa0Pd+s6d28S7KKsVFx8 Jgg8UXfxctim/mjKhd8t4n6vH7JINqcvmJNYEKlh1u53RBhSORSC2jhE46CJoblJnMNR QxmE4ROqx0pOkywDvEJP03dUc2EaJ7tP54s1tGczF+If3hWBXrRn2t94mXvxl3w+0GhC x7fdjcXKscEIShV+TRZ0xN/30MwZggZNijGVbmrwR9vHoJtwI//N8DiLfWI6QkLY1pUh qgsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374909; x=1785979709; h=content-transfer-encoding:content-type: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 :content-type; bh=Lc0r0m3XKd4bkmC/58YlEfIB78yxw3GCW1HMX54fUKc=; b=g2c76WnAeoj0dvQdWQFkKReYZ1StbkfyBrfMU4REw0jeUV3li2Lv7sijzuW4CvLmU/ T6PYyR5xiIdos1LSIohkAleCnCNynQGB1OQAHi+i5BdVd1jwOBdCrE7IAr4QB2Af74No uWSt46qtWt0pkcbKWk+ZhaOmpEeZrjFCEBeNVwiF0Ebw+fGasd2JBWs9Cxb+u/7eBjKl YvZl3Hu/fIZElUs0na4nokMEoegc8B9VSr68EPJXr08WaYUTb4M412gP/5ykdgc7LHcF ewHWx+S0KAkn7mHC8tzNlMBYDb69VkdZWIz8aWYsIhbekvbe3ksaw/JHYKPhzwbS621e TECg== X-Gm-Message-State: AOJu0Yxqc0RndhB+R7/bGF0cTNrM49xVxrzCmmY1gCeDhW9BV+W74i5K VQm2+ZHQc49JuDd4WK1d1pFwqWpqUyD4ZuqSv+T8ck88Zd4jMnEljdbZfq0kXJIbFz0LTkcIymc ni+yjbaXQXamiGMP5HLKXtPIhXdFoN+rwy56x+qSZgEalrgticS1sJLAzFOcT7RmK2A== X-Gm-Gg: AR+sD10SXW1S+ccQVU6myb6Ynr3zw8oF+OOwhoq6EQHwTXvRhJHuLJx7n6rARDBEWoJ EMhSDk+gODFKmD67aSrOrgBqzHfhCXZrzLzEJm6EbcxQ89LrwoxYBjk2bpRL6JfsT0cD3Ke8oIL WOOEpBZhsWeRYNVE9CZo9JzlwzciiJvN64s9hvE/n3AfY7+mVM9pczjjxknSJbXML92WHTbXY59 QfZoF0ElN3aGekn9+QIdtmIiAPMAfmsjWBo6W4XIJd1a7DwP2XFTrJgjxjNOM1a4qTTsnFPbOtA bKKyOGX6fWO8Q6elvZDegIeWUBi6sXRGa2+ohJttUg510cJ58av+KqpUXJyhDaitiylksNAat39 tapL/76JaIP7YrXucJ/GF4QTdy0+0FNpDVPe4ca3JGcbsESWm X-Received: by 2002:a17:903:2ac4:b0:2cc:9e99:55c9 with SMTP id d9443c01a7336-2d035ca8fc0mr7835565ad.26.1785374908928; Wed, 29 Jul 2026 18:28:28 -0700 (PDT) X-Received: by 2002:a17:903:2ac4:b0:2cc:9e99:55c9 with SMTP id d9443c01a7336-2d035ca8fc0mr7835285ad.26.1785374908445; Wed, 29 Jul 2026 18:28:28 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 02/18] hw/hexagon: move VTCM to the common machine state Date: Wed, 29 Jul 2026 18:28:07 -0700 Message-Id: <20260730012824.1135905-3-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX65p4Ixf7Tj4w iy+d5TqehbOrzQtCWqrcJlSqad+LgyBA+TktxWgaL1fBwzma7NY15seKLi9QhgLrpPXVDsSoxgE wcGT0KJgQ7U7lYAe1JQW08MWfgzUDYc= X-Proofpoint-ORIG-GUID: a_x3Z96159eqdPOypCdT0lXZgenWNewo X-Authority-Analysis: v=2.4 cv=KpR9H2WN c=1 sm=1 tr=0 ts=6a6aa8bd cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=31cAqr7vU2O6cbMaemAA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: a_x3Z96159eqdPOypCdT0lXZgenWNewo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXwVm/TEv4dDkg 05fieStqvtObzFpGTrjr/BmNQVU1p9Kn0osFxxM/81pqW8TfmDnS9MCHikRP7oe1zOX0xomwDcO w6sY2Birhy9I12Jlgvyme4dVr1N6athqOdqV3Q3FXc66ScCJeQE16jgvK5BlOJq70fGPzrJ+Ytx Vdx2UgJRJIcd/g/ozLkzgNeiSXkc6r0M4OULoHSlOmpVZXBxG+osk1iOhQx+0nfAaca+SHaOfxR /q+7z/zrJhzmaXyHx0loMtWHjbIGIU8IZInIcD24pYa3ikrPU0/fEPqpUyKdaR981MFIhN4w7vO 3dTvO0LPAAKjmoM7dvDUDdjej/8BIBTFftjr3pjJ9AF9VzS/NA6gSNZfDHVVRAufF90NTlImmGH PCwHbTMgW+0yzSSHhciprPpe4mH8Ad7OJPFx2FAd+S6TqgXgBf+22KfIgP+N27I06xESZvN8SbY 9F7yU6MhLCBGSZlZs4A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374953206158500 The VTCM is described by the config table, so every machine can set it up the same way. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hexagon.h | 1 + include/hw/hexagon/virt.h | 1 - hw/hexagon/hex-subsys.c | 8 ++++++++ hw/hexagon/virt.c | 5 ----- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 1034b09c2ac..9c73cadb16d 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -156,6 +156,7 @@ struct HexagonCommonMachineState { =20 MemoryRegion ram; MemoryRegion cfgtable_rom; + MemoryRegion vtcm; }; =20 #endif diff --git a/include/hw/hexagon/virt.h b/include/hw/hexagon/virt.h index fcb47762194..cf0cd2f8f22 100644 --- a/include/hw/hexagon/virt.h +++ b/include/hw/hexagon/virt.h @@ -17,7 +17,6 @@ struct HexagonVirtMachineState { int fdt_size; MemoryRegion *sys; MemoryRegion tcm; - MemoryRegion vtcm; MemoryRegion bios; Clock *apb_clk; }; diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index d146ee0c075..0c20cf02e7d 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -29,4 +29,12 @@ void hex_subsys_create(HexagonCommonMachineState *hms, rom_add_blob_fixed_as("config_table.rom", &m_cfg->cfgtable, sizeof(m_cfg->cfgtable), m_cfg->cfgbase, &address_space_memory); + + if (m_cfg->cfgtable.vtcm_size_kb > 0) { + memory_region_init_ram(&hms->vtcm, NULL, "vtcm.ram", + m_cfg->cfgtable.vtcm_size_kb * 1024, + &error_fatal); + memory_region_add_subregion(sysmem, m_cfg->cfgtable.vtcm_base << 1= 6, + &hms->vtcm); + } } diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index ad0bc4f1329..53eaafaf85a 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -75,11 +75,6 @@ static void fdt_add_hvx(HexagonVirtMachineState *vms, const MachineState *ms =3D MACHINE(vms); uint32_t vtcm_size_bytes =3D m_cfg->cfgtable.vtcm_size_kb * 1024; if (vtcm_size_bytes > 0) { - memory_region_init_ram(&vms->vtcm, NULL, "vtcm.ram", vtcm_size_byt= es, - &error_fatal); - memory_region_add_subregion(vms->sys, m_cfg->cfgtable.vtcm_base <<= 16, - &vms->vtcm); - qemu_fdt_add_subnode(ms->fdt, "/soc/vtcm"); qemu_fdt_setprop_string(ms->fdt, "/soc/vtcm", "compatible", "qcom,hexagon_vtcm"); --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375068; cv=none; d=zohomail.com; s=zohoarc; b=arPsxknb4k5/hOE92WLU5IwW6+gL3hV3vI3VMPjVhdR/nP34aPEhA04Ea4tNUEVB7ywlTcfN/BLIGauRYsz/iE7DbPEo00QRLaRumG3XL+9CGTfzOfUiedqDLZcJodbcZCrSLuSpXA2FOKX4CT43YDE/0FwIbuT/rtjidq+ZHvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375068; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9CmUXpVUad/tuMANPghjoDoVpvF6R7XTpuf/ynjwUIE=; b=OEzfQ9XiWkiZ00+KotN9wC0L0xvTPZjckMDhZSUeV1yT+psKQGKTa4pvlHA2sX0vuklqLbRu0sAeNQ1wwgarNo5RzOr+80TbGUzisgd5OQge/OqM7QW10rYhfJ21sLSQp+Cjvc7MhMlgolDGM/9dJK2r52IF9iKaFID2ohvZeOo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375068564547.6847224691855; Wed, 29 Jul 2026 18:31:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZe-0005fY-4w; Wed, 29 Jul 2026 21:28:38 -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 1wpFZa-0005de-Qb for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:34 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZY-0005ZI-LB for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:34 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1GjeN3699548 for ; Thu, 30 Jul 2026 01:28:31 GMT Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvte8164-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:31 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cb6dd278512so1098201a12.3 for ; Wed, 29 Jul 2026 18:28:30 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 9CmUXpVUad/tuMANPghjoDoVpvF6R7XTpuf/ynjwUIE=; b=NpWUT3b6undUl0E5 45lGHP7TbIXJsINGVXS31iOxza4iqZRKt6r0PwtMqTUpq1xL4Eqyco71oeuiF8M0 KPD9eHtwQWVaZ2gYlgff7AQnMSnYTar/iDfq4KukQ+5qHoivqqzdNBjfKrNOz1B+ 0tsSVwcaJqln7h6eZYbz98PL3mrWG9gotwBoSPz+1BbtLUaNwNtmEONvr2t0hyj5 mANL2CQZVEYO0tqlzsCT4ppKXsYx/mLI8NzwJ4BJVwvnXTRRVFtnstWVYTyfQm4k dZhxjpf3Yk0ChTCqYWYWRe4aeD0Ht3DNv+PAbn3FVMub23il1y9kQJ918jam2qz6 6bWP2A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374910; x=1785979710; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=9CmUXpVUad/tuMANPghjoDoVpvF6R7XTpuf/ynjwUIE=; b=RznHRbncv+Qv6dDNJtPlt2jnDJeqw8WWJpNse+GkTPtXzD3p/wZF7k+w7IZ92mmSoY mtRjDrvsMMRN0Arp/zzGo0vItHwwLzmN1msIg1Ggr1zKUdqPURXpoQsPRHbY0Bpbe8+B DqtyNlgHZ4lDpALdaU6NEu6eAfPrOpDTJqvZILNeKlwYQVciz5rRg5sRkdqZLVD9d0SX jW2f6oR3NWDyUR7xJM+Ekp1RZcnEmOWa0z+KHWKrZBhucVN5Iow2vmXRl4iEdjTHa9Ln 3vzbEy8RRMPZIwvkHuZP/SlOdolD7TYYC4MQ+4Q/Y4/MJ0dUw6RXCXlvldJDKFW4if+U +xFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374910; x=1785979710; h=content-transfer-encoding:content-type: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 :content-type; bh=9CmUXpVUad/tuMANPghjoDoVpvF6R7XTpuf/ynjwUIE=; b=YJTS5IonyXDXflCqwubFGqPrezh0RXGXD2RnLmItiPRd04V2dPyI6HGTEaEVuBU6j+ Q1cRYbBFLNGbjKS9TwB9JNeH+vDhQUdXNmClJIWP+bFBFM8uxDYaxBS+olv2sNJBYtDX QOGDX3zgo0i4zrJaLlzGuVGSOX2Q1WR0PE7wCiO7n7fdkZi4iSDfYXRoPi3xLOPKbsSY kUEFAEjeKdxPC3nlY1+nAJxBYgG00nyhfLBiXZSWUrlYDcPWr3rvN0cdXO0JNHp05cXU vOhwma9iSi3ZFNiLVMMs/y2cfZtQBXqOIi3n7a/HdQIPz7d6vFS6SAT6xt9QM4SDnD94 d6iQ== X-Gm-Message-State: AOJu0Yz7scx+1XcGjO1LHOZkv7YhegkSHVtQtJOe6ZXcki9qW7dMUWe6 WHBMpcuZOQiKcO8ZgvdtCBWkyscDlHm6PInNDppGtoDzEwhr/Ya5buQUpb7uKv8h0GH2XfSvFzo 7597dvG13cM3ViDnDdRPE+IGE+/oEYX0qCBNlopum3PgOpSLoqbY0V7wZP4vRLI8LSw== X-Gm-Gg: AR+sD13kUYRD7Rdon+C30giZz2zjMMbKkDawVa05qV1oOk7xs+ur+vPWy6v9aGc0qzJ 1NqWyfQyCx0pjo7V+5J10pjlB3G08zYpji5DrLBbBIbUYv9pt54Y4MzGI9F6shmKeEDDFCm/V10 9y6e9F6G2KYRwlM81Qy2VktZlfoRfnqr4FE3IZSfHkX5p4LOMjgrCCIUz+mOeqGLRxp0to2wRhb xWRZ96JTCw8kulKg4dnaGiveZ5iqinGiT6gIU+JwN7y1RDF4+YOiZBfjOMFfPHUDe/tamAzjuMX IuneqxZLcEeDX3+BVwwzYmAip3grLlxWQCtBAMNBPIF/GhEpEjDnuhriZy9Ng0lRYeh/zvhIDRu 38mNk8cTUbnGZq+R+Ky/0iKo0Cwe43dp6YFd8qroFeKXoOHkV X-Received: by 2002:a05:6a20:4326:b0:3bf:6237:4d4a with SMTP id adf61e73a8af0-3c900518dbemr504778637.24.1785374910076; Wed, 29 Jul 2026 18:28:30 -0700 (PDT) X-Received: by 2002:a05:6a20:4326:b0:3bf:6237:4d4a with SMTP id adf61e73a8af0-3c900518dbemr504751637.24.1785374909625; Wed, 29 Jul 2026 18:28:29 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 03/18] hw/hexagon: move global registers to hex-subsys Date: Wed, 29 Jul 2026 18:28:08 -0700 Message-Id: <20260730012824.1135905-4-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: vT_szRmY_Pr3ZGWSojvwQ4ufEmwz4uyO X-Proofpoint-ORIG-GUID: vT_szRmY_Pr3ZGWSojvwQ4ufEmwz4uyO X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX/PVvl41hcndz ghzYjOzQiXELvW9x2iEJJbxcLd+bUV1x7g2OR/TUNqlNLkNBgvhDW5qtVhIJeOeg2eqzSGYJgGY l7mf1uEVkB8Dx+EKxhUqAP5CFu5YR8o= X-Authority-Analysis: v=2.4 cv=Tr3WQjXh c=1 sm=1 tr=0 ts=6a6aa8bf cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=T2wWRslM62IwIIzloqEA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXylGq/DAu07/l Kt8YLVPMHE7gZs+btZCw//ByRrPeacL+mpNsqzeQ3WjxgKtQ8ZpoM594qA2u2w+v4V19uru+igt OmvS/4aLxva8hmENaRe8lQNU2t6PJSN6N+qULZ/hyIgXMD7ggYb+ZDfWNFjMa+QpvrbJCGyZtzC CMOCBIQ02nf/znR+9YD1j2wk/kk4eRkD0C+iARsU2FT+dNiDZ4s3xupcvs74w74N6vmViQlgBXO sScRXkcCzr01YEhXbBn7QmTsLgVwhqhdQFD4aJW6K8kt1ZWTALaiRhrDuFY7Szj8r1O567f/g9j aMGtrD4MNnDttcUXsQWe2yGYobwlRbJKUrMEdj1IekT+rJOsfoiztvQiOO1PhD4Nn4OLeaawHat Y/ZGocEtJk3Uz43Ig0NriCLm2Y7Y9i+J1CM//UfLUQYavToIvFdswP8eZ8IPCneRpJumfWGTr4l svM0jphF0jQFF2kiqCg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375069021158500 Both machines create the global register device the same way, so let hex-subsys own it and link it to each CPU as it is realized. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hex-subsys.h | 6 +++++- include/hw/hexagon/hexagon.h | 1 + hw/hexagon/hex-subsys.c | 29 ++++++++++++++++++++++++++++- hw/hexagon/hexagon_dsp.c | 15 ++------------- hw/hexagon/virt.c | 23 +++++------------------ 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/include/hw/hexagon/hex-subsys.h b/include/hw/hexagon/hex-subsy= s.h index 6bcde303f2e..087c105cfa4 100644 --- a/include/hw/hexagon/hex-subsys.h +++ b/include/hw/hexagon/hex-subsys.h @@ -9,9 +9,13 @@ #define HW_HEXAGON_HEX_SUBSYS_H =20 #include "hw/hexagon/hexagon.h" +#include "hw/core/qdev.h" =20 /* Create the subsystem shared by every Hexagon machine. */ void hex_subsys_create(HexagonCommonMachineState *hms, - const struct hexagon_machine_config *m_cfg); + const struct hexagon_machine_config *m_cfg, Rev_t r= ev); + +/* Realize a CPU into the subsystem. */ +void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu); =20 #endif /* HW_HEXAGON_HEX_SUBSYS_H */ diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 9c73cadb16d..ef5700082cc 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -157,6 +157,7 @@ struct HexagonCommonMachineState { MemoryRegion ram; MemoryRegion cfgtable_rom; MemoryRegion vtcm; + DeviceState *glob_regs; }; =20 #endif diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 0c20cf02e7d..6789b6bb23d 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -8,11 +8,29 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/hexagon/hex-subsys.h" +#include "hw/hexagon/hexagon_globalreg.h" #include "hw/core/loader.h" +#include "hw/core/qdev-properties.h" +#include "hw/core/qdev.h" +#include "hw/core/sysbus.h" #include "system/address-spaces.h" =20 +static DeviceState *globalreg_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *= m_cfg, + Rev_t rev) +{ + DeviceState *glob_regs =3D qdev_new(TYPE_HEXAGON_GLOBALREG); + + object_property_add_child(OBJECT(hms), "global-regs", OBJECT(glob_regs= )); + qdev_prop_set_uint64(glob_regs, "config-table-addr", m_cfg->cfgbase); + qdev_prop_set_uint32(glob_regs, "dsp-rev", rev); + sysbus_realize_and_unref(SYS_BUS_DEVICE(glob_regs), &error_fatal); + + return glob_regs; +} + void hex_subsys_create(HexagonCommonMachineState *hms, - const struct hexagon_machine_config *m_cfg) + const struct hexagon_machine_config *m_cfg, Rev_t r= ev) { MachineState *machine =3D MACHINE(hms); MemoryRegion *sysmem =3D get_system_memory(); @@ -37,4 +55,13 @@ void hex_subsys_create(HexagonCommonMachineState *hms, memory_region_add_subregion(sysmem, m_cfg->cfgtable.vtcm_base << 1= 6, &hms->vtcm); } + + hms->glob_regs =3D globalreg_create(hms, m_cfg, rev); +} + +void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu) +{ + object_property_set_link(OBJECT(cpu), "global-regs", + OBJECT(hms->glob_regs), &error_fatal); + qdev_realize_and_unref(cpu, NULL, &error_fatal); } diff --git a/hw/hexagon/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index f94f7fd4e11..8599f5883bf 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -15,7 +15,6 @@ #include "hw/core/qdev-properties.h" #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hex-subsys.h" -#include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" #include "qapi/error.h" @@ -109,7 +108,6 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, { HexagonCommonMachineState *hms =3D HEXAGON_COMMON_MACHINE(machine); HexagonDspMachineState *dms =3D HEXAGON_DSP_MACHINE(machine); - DeviceState *glob_regs_dev; DeviceState *tlb_dev; =20 memset(&hexagon_binfo, 0, sizeof(hexagon_binfo)); @@ -120,14 +118,7 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, =20 machine->enable_graphics =3D 0; =20 - hex_subsys_create(hms, m_cfg); - - glob_regs_dev =3D qdev_new(TYPE_HEXAGON_GLOBALREG); - object_property_add_child(OBJECT(machine), "global-regs", - OBJECT(glob_regs_dev)); - qdev_prop_set_uint64(glob_regs_dev, "config-table-addr", m_cfg->cfgbas= e); - qdev_prop_set_uint32(glob_regs_dev, "dsp-rev", rev); - sysbus_realize_and_unref(SYS_BUS_DEVICE(glob_regs_dev), &error_fatal); + hex_subsys_create(hms, m_cfg, rev); =20 tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); object_property_add_child(OBJECT(machine), "tlb", OBJECT(tlb_dev)); @@ -147,11 +138,9 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, if (i =3D=3D 0) { hexagon_init_bootstrap(dms, cpu); } - object_property_set_link(OBJECT(cpu), "global-regs", - OBJECT(glob_regs_dev), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(tlb_dev), &error_fatal); - qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); + hex_subsys_realize_cpu(hms, DEVICE(cpu)); } } =20 diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index 53eaafaf85a..290783d511f 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -14,7 +14,6 @@ #include "hw/core/sysbus-fdt.h" #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hex-subsys.h" -#include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" @@ -226,9 +225,7 @@ static void virt_init(MachineState *ms) { HexagonVirtMachineState *vms =3D HEXAGON_VIRT_MACHINE(ms); const struct hexagon_machine_config *m_cfg =3D &v68n_1024; - DeviceState *gsregs_dev; DeviceState *tlb_dev; - DeviceState *cpu0; int32_t clk_phandle; =20 create_fdt(vms); @@ -240,7 +237,7 @@ static void virt_init(MachineState *ms) vms->apb_clk =3D clock_new(OBJECT(ms), "apb-pclk"); clock_set_hz(vms->apb_clk, 24000000); =20 - hex_subsys_create(&vms->parent_obj, m_cfg); + hex_subsys_create(&vms->parent_obj, m_cfg, v68_rev); =20 if (m_cfg->l2tcm_size) { memory_region_init_ram(&vms->tcm, NULL, "tcm.ram", m_cfg->l2tcm_si= ze, @@ -251,42 +248,32 @@ static void virt_init(MachineState *ms) =20 fdt_add_hvx(vms, m_cfg); =20 - gsregs_dev =3D qdev_new(TYPE_HEXAGON_GLOBALREG); - object_property_add_child(OBJECT(ms), "global-regs", OBJECT(gsregs_dev= )); - qdev_prop_set_uint64(gsregs_dev, "config-table-addr", m_cfg->cfgbase); - qdev_prop_set_uint32(gsregs_dev, "dsp-rev", v68_rev); - sysbus_realize_and_unref(SYS_BUS_DEVICE(gsregs_dev), &error_fatal); - tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); object_property_add_child(OBJECT(ms), "tlb", OBJECT(tlb_dev)); qdev_prop_set_uint32(tlb_dev, "num-entries", m_cfg->cfgtable.jtlb_size_entries); sysbus_realize_and_unref(SYS_BUS_DEVICE(tlb_dev), &error_fatal); =20 - cpu0 =3D NULL; for (int i =3D 0; i < ms->smp.cpus; i++) { HexagonCPU *cpu =3D HEXAGON_CPU(object_new(ms->cpu_type)); qemu_register_reset(do_cpu_reset, cpu); =20 if (i =3D=3D 0) { - cpu0 =3D DEVICE(cpu); if (ms->kernel_filename) { uint64_t entry =3D load_kernel(vms); - qdev_prop_set_uint32(cpu0, "exec-start-addr", entry); + qdev_prop_set_uint32(DEVICE(cpu), "exec-start-addr", entry= ); } else if (ms->firmware) { uint64_t entry =3D load_bios(vms); - qdev_prop_set_uint32(cpu0, "exec-start-addr", entry); + qdev_prop_set_uint32(DEVICE(cpu), "exec-start-addr", entry= ); } } qdev_prop_set_uint32(DEVICE(cpu), "htid", i); qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", (i !=3D 0)); - object_property_set_link(OBJECT(cpu), "global-regs", - OBJECT(gsregs_dev), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(tlb_dev), &error_fatal); - - qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); + hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpu)); } + fdt_add_cpu_nodes(vms); clk_phandle =3D fdt_add_clocks(vms); fdt_add_uart(vms, VIRT_UART0, clk_phandle); --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375042; cv=none; d=zohomail.com; s=zohoarc; b=ABbb5ueJcWTCogbiktvmPWyqhBNTemT10eJ5zskh5rT9zEWgOyy3W4bD3PTeV6Yg90lperIyyfaEngeM/fsPf6zmmrZzMC+gRlTH8iigzfBzJkLDfzqwS0QbRcRULATXpuhmItiSGpW1uMNtGaGcwQOr9LCNNWI3DuorPBxdatU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375042; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=voZe0rvcTWu/Ku3hUtr2oUYQyHSA5bpwIbj31wP9mSo=; b=T4m73hwdaT9Sfb7HOvV75rDzkBk7KXJ51ShmYy5c8zYJLe81VvND/Jq3lOu1CF4XqoS7YET3YzbGAKlfplbHdPLZEATwyOs29ZtF/SDN+pBqZ6VYrtP6hjR8QQjHiPNRFBUuLHWBP5/HeqMU+NLZckr6Pa7BrMUr1q3pXPWTV1U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375042826923.956658738056; Wed, 29 Jul 2026 18:30:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZc-0005eO-4a; Wed, 29 Jul 2026 21:28:36 -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 1wpFZb-0005dz-2S for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:35 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZZ-0005ZW-Dt for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:34 -0400 Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1JCZn3662808 for ; Thu, 30 Jul 2026 01:28:32 GMT Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvujr0rd-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:32 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8484ba00601so1799151b3a.1 for ; Wed, 29 Jul 2026 18:28:32 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= voZe0rvcTWu/Ku3hUtr2oUYQyHSA5bpwIbj31wP9mSo=; b=KlaFR/MBr+gwn9GN IqXFTzlm6vBB3m2hxXW1lxykb5HyOU5s9P2WDRuhdDQOPe8SJI3akE3y+SGT54bq 77526pf0wQPmwrXuxc00zYPSx9cmo6/O2J0Oah2XedGlMc3P0nygH1DEW5ntdrMc IgWoV/+WXhJFvVvbiNTcJ9m1j3gowGv5eozziYKxRZbN6X6470sQe+UAms7Z66zL VF0PxyKyqgsHLqHR/HLXvLrxTnwyiF01qLG15JGhK4w6eajwMDt2ivil9lM2uLfF Qv0V6JbwhJzPUtLTXMJIsWbSoSISVw+76yyy84ZYGnWzeqLKePkFQowme1uTYm+F 8VEzjA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374911; x=1785979711; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=voZe0rvcTWu/Ku3hUtr2oUYQyHSA5bpwIbj31wP9mSo=; b=L0SgOROK+eXqx2p0fOM+AQ598AQVPbXDmc7J4FVwB5+qI6PysSvy0Ex20mKjtsbqe0 dZD8zXu/s6bP+PozvpRuTm/dvGAE93mkONI8K1sU4nk7qYz8hmCtoZUEScOumHQh3Z72 3JG2aOgsZ6Qi2zWhkur7MwCWPi2nbb0YpIRlIlG2PoC5lGAN0c1FJZu+2r8h0CtgJQbt s9Zxfo1D7fzelhCTJj3dnCmTQzkWwI2g4BYnaLevotMpMx+wd47TC0BuCLfJBbNqmRMa GlkQvW44dSa6XljHO8oBb88+ncMA/Xvg3/l0Go3Gfw7f89K4RsMkbJsUe0l3EEogrqcr r4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374911; x=1785979711; h=content-transfer-encoding:content-type: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 :content-type; bh=voZe0rvcTWu/Ku3hUtr2oUYQyHSA5bpwIbj31wP9mSo=; b=ZoRBTJOw+bz6nSDKt2k82cmnrua4/K7N0AFEXXuVYiWxTb2Ud+glC/VrnAmLTYUwoA MaHoyN4TSQYWO9rhZWqSOhGcQjx9jzhCWYvYm1OUxguzjiDXx+RnTcYyAig7Ltwa4xnL BM5dCwAqclln2QFmelovonZdidTyXGSLVDnwrxmxOi+v/U0m4hierrPVC5mTwz5Vtc5P Wwr7Fh5b0B7Yt1VyuVHJueUTfyxhheDJ88eiPbT9YQZvw9qPV5yUxAVhpD8Ih9y5jYe8 x4ORDto5DKh+olN75C7LjhPBPwZOkcaDggpPmqayXJKOf5dCXcrq5qC7W4C4cWIMwv0R 8PEA== X-Gm-Message-State: AOJu0Yw4atfuGnHpV/O5wqY48AQuSb+Eh/32ejecW+aIdVL2c7m/0u/F 1K3y+UkA+u0ILRviwFsVgTPM1PAeabselrFRuRIxEPbpHQjl7T2E65VApFzs5PaWhxS+HhbLaFG tIWN3FdtkPvyRWVxC8LQjfJWP6yL0DOHz4VClVdQ6fOD8k4g2J8MP+pyTVeNMR54goA== X-Gm-Gg: AR+sD124niHLzuFLNYkaee3FN+U0jFEn9LPupuDoGWw2VMsQP4WIrScOEyZ6xM+1V9D DNTRbdW2rOmAwbgm5efxQOIK/S99w0EVwJOsF38+l13qaaRBgQ85F//Zd3pPFChzOHrYvP0Ulsp 0nJHh+4EF5xvOkvi5kiZocg1yomQEq2kJsdQ0ek8iHoRlsmRGQ1IAfO+6hZnafULrNy4WOvB0sv 3kxofctLsqLEN6QwUk2osLMRcAoOzrXlL6TH6RaVHxsyeLsUob/YlTfGFRMjIF6qUkUKI4X2xDO HHhLpghb6Rwx2OPkTg9JIj4wb4TnoKSYiIecldbnQr+iCB/aRu7l0XwRcTFIlt4PZ1apkMIJGTo B/xxNGzXzmGU4YzTvx0KJ0/l8yZT9wMRwBD1iokZLTTJrfuCi X-Received: by 2002:a05:6a21:134b:b0:3c0:4269:47bb with SMTP id adf61e73a8af0-3c9008ac5f3mr431596637.52.1785374911459; Wed, 29 Jul 2026 18:28:31 -0700 (PDT) X-Received: by 2002:a05:6a21:134b:b0:3c0:4269:47bb with SMTP id adf61e73a8af0-3c9008ac5f3mr431570637.52.1785374911033; Wed, 29 Jul 2026 18:28:31 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 04/18] hw/hexagon: move the TLB to hex-subsys Date: Wed, 29 Jul 2026 18:28:09 -0700 Message-Id: <20260730012824.1135905-5-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXwhey6+V0JVCV nMTUjUSdnJm9WZ5KXwaOX82S79X8e9BdeOEHyoF0RooC7Ul/ZUM1zmFvrdL9wwSP03oP6qkmCsA B90USx8RwPc6aGPQhJRe9tQtWnKz4OE= X-Proofpoint-ORIG-GUID: IxBAYDJ2VDcvk-qYKJMGD63owIcYo3eN X-Authority-Analysis: v=2.4 cv=KpR9H2WN c=1 sm=1 tr=0 ts=6a6aa8c0 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=qVS_p__ePFo4ISZweN8A:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-GUID: IxBAYDJ2VDcvk-qYKJMGD63owIcYo3eN X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXz+RSdgnwnWud ENtXmezPazX5GRdXe0FOkvbJqJnYaBL7ybba4M3JVTF45PNc20mVmfqpAlkXHKsYV6OMOv5p2CO Qb+9Gv4eb2YdhMfHQJ8UtS6kC0iiudkE2Kg6w/iC601ZGsj140VLNoXHcqXOywIgKAdPl+ac/TG gBeKEqPjcxFP93vEZemHcrg0yZoHuLxrQaKr6FbomaAWkABTceysHxIVskHiZPJJeROv1qXwgje xVzYFSSzuPThPuejLSfqt4qD17VaZfWlFThMQZ60veirLqDrGT773vcag+R4mQ8i5bBL+TYXUpi 6Bst0e/xE70Bp1OsZgfbRhSW+GpBCY9zyFMBtozX0jw29N4Tb7YyUymNpYTdgbY3S9WfmlVwlvD STLTKvXh3zKjdhoP5I5yToSoXB+EvYr+1V1+2mVl+ssBTJmIBibvpnlw2/ZQRz2yfccQeR3aNqT 5c0K+ouDrthbrZc2NYA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 adultscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375044879158500 The TLB device is sized from the config table, so both machines create it identically. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hexagon.h | 1 + hw/hexagon/hex-subsys.c | 16 ++++++++++++++++ hw/hexagon/hexagon_dsp.c | 10 ---------- hw/hexagon/virt.c | 10 ---------- 4 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index ef5700082cc..6edd93f478a 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -158,6 +158,7 @@ struct HexagonCommonMachineState { MemoryRegion cfgtable_rom; MemoryRegion vtcm; DeviceState *glob_regs; + DeviceState *tlb; }; =20 #endif diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 6789b6bb23d..ac7e29604eb 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -9,6 +9,7 @@ #include "qapi/error.h" #include "hw/hexagon/hex-subsys.h" #include "hw/hexagon/hexagon_globalreg.h" +#include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev.h" @@ -29,6 +30,18 @@ static DeviceState *globalreg_create(HexagonCommonMachin= eState *hms, return glob_regs; } =20 +static DeviceState *tlb_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *m_cfg) +{ + DeviceState *tlb =3D qdev_new(TYPE_HEXAGON_TLB); + + object_property_add_child(OBJECT(hms), "tlb", OBJECT(tlb)); + qdev_prop_set_uint32(tlb, "num-entries", m_cfg->cfgtable.jtlb_size_ent= ries); + sysbus_realize_and_unref(SYS_BUS_DEVICE(tlb), &error_fatal); + + return tlb; +} + void hex_subsys_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *m_cfg, Rev_t r= ev) { @@ -57,11 +70,14 @@ void hex_subsys_create(HexagonCommonMachineState *hms, } =20 hms->glob_regs =3D globalreg_create(hms, m_cfg, rev); + hms->tlb =3D tlb_create(hms, m_cfg); } =20 void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu) { object_property_set_link(OBJECT(cpu), "global-regs", OBJECT(hms->glob_regs), &error_fatal); + object_property_set_link(OBJECT(cpu), "tlb", OBJECT(hms->tlb), + &error_fatal); qdev_realize_and_unref(cpu, NULL, &error_fatal); } diff --git a/hw/hexagon/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index 8599f5883bf..25e8550fba2 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -15,7 +15,6 @@ #include "hw/core/qdev-properties.h" #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hex-subsys.h" -#include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -108,7 +107,6 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, { HexagonCommonMachineState *hms =3D HEXAGON_COMMON_MACHINE(machine); HexagonDspMachineState *dms =3D HEXAGON_DSP_MACHINE(machine); - DeviceState *tlb_dev; =20 memset(&hexagon_binfo, 0, sizeof(hexagon_binfo)); if (machine->kernel_filename) { @@ -120,12 +118,6 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, =20 hex_subsys_create(hms, m_cfg, rev); =20 - tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); - object_property_add_child(OBJECT(machine), "tlb", OBJECT(tlb_dev)); - qdev_prop_set_uint32(tlb_dev, "num-entries", - m_cfg->cfgtable.jtlb_size_entries); - sysbus_realize_and_unref(SYS_BUS_DEVICE(tlb_dev), &error_fatal); - for (int i =3D 0; i < machine->smp.cpus; i++) { HexagonCPU *cpu =3D HEXAGON_CPU(object_new(machine->cpu_type)); qemu_register_reset(do_cpu_reset, cpu); @@ -138,8 +130,6 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, if (i =3D=3D 0) { hexagon_init_bootstrap(dms, cpu); } - object_property_set_link(OBJECT(cpu), "tlb", - OBJECT(tlb_dev), &error_fatal); hex_subsys_realize_cpu(hms, DEVICE(cpu)); } } diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index 290783d511f..b9e0bbb704c 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -14,7 +14,6 @@ #include "hw/core/sysbus-fdt.h" #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hex-subsys.h" -#include "hw/hexagon/hexagon_tlb.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev-clock.h" @@ -225,7 +224,6 @@ static void virt_init(MachineState *ms) { HexagonVirtMachineState *vms =3D HEXAGON_VIRT_MACHINE(ms); const struct hexagon_machine_config *m_cfg =3D &v68n_1024; - DeviceState *tlb_dev; int32_t clk_phandle; =20 create_fdt(vms); @@ -248,12 +246,6 @@ static void virt_init(MachineState *ms) =20 fdt_add_hvx(vms, m_cfg); =20 - tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); - object_property_add_child(OBJECT(ms), "tlb", OBJECT(tlb_dev)); - qdev_prop_set_uint32(tlb_dev, "num-entries", - m_cfg->cfgtable.jtlb_size_entries); - sysbus_realize_and_unref(SYS_BUS_DEVICE(tlb_dev), &error_fatal); - for (int i =3D 0; i < ms->smp.cpus; i++) { HexagonCPU *cpu =3D HEXAGON_CPU(object_new(ms->cpu_type)); qemu_register_reset(do_cpu_reset, cpu); @@ -269,8 +261,6 @@ static void virt_init(MachineState *ms) } qdev_prop_set_uint32(DEVICE(cpu), "htid", i); qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", (i !=3D 0)); - object_property_set_link(OBJECT(cpu), "tlb", - OBJECT(tlb_dev), &error_fatal); hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpu)); } =20 --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374993; cv=none; d=zohomail.com; s=zohoarc; b=buwYUG5Fute9MQSqubFLYMDyWUYNxUVIX1OGpAJH2CaQlaX5Zh1Q94ADoiuogU0EoHBTdz281Zv7/SkX4aK+tCEl5z/3t21om2U024r0pNWlX8OWLBLUQiiA4/OuRDiVENLC7IB0sxQTR7WJx1j/2vSf+mb5Jpma6WP8ky7NM6o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374993; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BYgIVE8I2k2mvQigMqdBIV4TfVh202P6hby3PybzjKQ=; b=jtScGvZq75LxatLrufHJhzkJlmxItiwLyiStxIy6Rq2hZlQoayBRMs+1khyffElDAfweAZPDJBXxMmjUr+zkEedbWMD1tGgK90cckkngV5YL0dzNvf47xRWfzvk5fInaXU6mb+r2JDhZFV+dwaS1qW20+HcNmPSAcw5gtFb2X0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 178537499344117.801866425910816; Wed, 29 Jul 2026 18:29:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZf-0005fg-32; Wed, 29 Jul 2026 21:28:39 -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 1wpFZd-0005eo-6C for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:37 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZb-0005Zl-8V for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:36 -0400 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U18H8F3017560 for ; Thu, 30 Jul 2026 01:28:34 GMT Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvp7r1vq-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:33 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2cc6dd43737so35358145ad.2 for ; Wed, 29 Jul 2026 18:28:33 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= BYgIVE8I2k2mvQigMqdBIV4TfVh202P6hby3PybzjKQ=; b=fy01DQz2wLgNAO+D VJ1RzyYPSauj+bo9sd9u2XZmOsTtGE2Gbe8A4PfE+9iMY7qB5ODsKKVigz0WciOc 5Y+1DZyktxefLfiJ4nrbwe62M061bKVw2Fuw0KWwg4KWXe+qzjsXllxaFipZEIsQ ch+FftP/1xwD5xwtCbhWD9kdu75E0Q71MzL0ihlLF/OeoEnXN7AcFdVD79lCu4oM 5xCWAr5nsnfi14Fc0ZhNsQy1mDJERuRIN13+srmH9NaVrQojG6rDt+a88moKGFSd wXeoHrV/0GrDOMiP4aRGKqLuDb0HdB4TPUzsPjkKAzre6QUnK9Sf2rUHTMExAOnh zQM+GA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374913; x=1785979713; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=BYgIVE8I2k2mvQigMqdBIV4TfVh202P6hby3PybzjKQ=; b=kpIKaQIn+mnfU/0NQA1I1gLqRCNMWKNwlJ30iZ4GNu9P+GFZqv9jiMyOexRzfk3mcA qjeAAXTcU4fndBnT8GNi4suk+WT5XhyaMncDdz1IuP544VxE+FAAAlQvFGVE8oWJ248S GSCsgiVw0AkH1lA9Kpb1q0Ts9ZYUM/q2nemUYElYIM2X9c5B4wdNtok78tbjV9w+ELxo RhlncU+B1eIkuS0bRnY80uSsrW3Rwinhp6+jw5XlTqlxuwrL9dMHjcRABNTgJeBHbPQq uybT2xygzNk9a4RmVVqCnxBOlIWtTsw33X3xIxo24isdPVrBzunhQhx4byiDn29Bwim8 CT8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374913; x=1785979713; h=content-transfer-encoding:content-type: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 :content-type; bh=BYgIVE8I2k2mvQigMqdBIV4TfVh202P6hby3PybzjKQ=; b=RP+2O2I0C4eiHL8he/5zxewXjWxHIPeLgg1jPGQeQCf8yM6rCrNibldWsGXzNop2SX 2gnHjCgPDv3N0eQ6K2kYIVwF6G5O7MXKTEsnZ9xZqRDz304SZYjliXMoet98nW3RYDDS Mk25lCJRnobAAGP2v73jmkh+J6R5pb65PPzfVNAXNKVXt3shj72IgKK20hhLXJVtiIYI hbufSZdA7Fto0gfzyL3m7O78Wy4UWZtgVaoS1J9RDDrPQPLB0++UZJ5Yek87dG42jPmQ p6l3PyA1HVlJoM3WWdzZEoNcXLDSIHY1JJ/J/GMs3f/35Kq3Qa7m+JHSPW+n22OVDTge wDxA== X-Gm-Message-State: AOJu0YzBHpH/ZdpT8kKop9DgWX+A/SPIvj91sWOiDV3E/T+reFECOJhe icb8ewLmJTQFj3eXq5VYD+a7RcBdSSR5n7HHTMnTFc4JKOL2X54xQv9d1/S/nk9IZOj0aecdQO/ t8ZOdh8/5+4zp2qsTLYrIn9Ow5ZPo7o/3GRYMsCMzdTCg23lDKA1lib/qS7MFGjzY5w== X-Gm-Gg: AR+sD10vQlYswKtpaa87z8Z901+UtgEkT3/hQ/xW1/8LoppwIbsssYXhWzOglnvnSLx 766JsWV8VJ8EA0Z/1Wol9mrd2BM4scu6P67+MyP+93U94FKxrdlGL+v5AtCqGnQGS62MOJrozFv HUC7ier9FKnALcd4FGa0t3KwtexGI0MsrIytZI4JahAENAwGsvAljM5k6z1xKj9w/pRNYR/qOgg y8VFP6nd87S/FnwbctROslPBIXLafkjYTsvDyL65FMT9vJcMzfTd5UWI+rdfsKZPmGfwHXV4jap z3VJ9L3NwIZZ0RsrQnR+cDaSNGyzMI00RSeQoIq9FbjpyCeXfFO4SzMc4RfZgHU/f5qqHrnc2MI WavXEDIZaCey4eEqvI1RvUIa3FqqbFWTCsFW+gj4n5p7+RKu3 X-Received: by 2002:a17:903:3d0d:b0:2cf:8131:75f4 with SMTP id d9443c01a7336-2d035bb5dd5mr7123835ad.11.1785374913011; Wed, 29 Jul 2026 18:28:33 -0700 (PDT) X-Received: by 2002:a17:903:3d0d:b0:2cf:8131:75f4 with SMTP id d9443c01a7336-2d035bb5dd5mr7123665ad.11.1785374912538; Wed, 29 Jul 2026 18:28:32 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 05/18] hw/hexagon: group the CPUs in a cluster Date: Wed, 29 Jul 2026 18:28:10 -0700 Message-Id: <20260730012824.1135905-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: 38vFBus7S5A8RfK2-AMTTSVkbGd4Ga2W X-Proofpoint-ORIG-GUID: 38vFBus7S5A8RfK2-AMTTSVkbGd4Ga2W X-Authority-Analysis: v=2.4 cv=cMvQdFeN c=1 sm=1 tr=0 ts=6a6aa8c1 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=mAn_JYengK_D836fKFgA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX741Nyz2YXU8I jgqaQ0JAIedKFt6HB2kiodlkrsonweGSPKaBl/szw3iog0kxU1Sy8MUDUTrG3HVQ45xo+qINydf Ly0nCYK+QCzze17SAfunbd+FpcyAHHM= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX1Mm2dO+ynqtH +Wch9W/dD/nQzmNF4a/MJtMPQ0q90gHgAipMv8cEZV2BPvl32G4oDtIVWI0Vf8EyCYJSBDEhF91 L2iwhCPWLhkznlvX7RHA3GnDBYKIP4LnNWHiR80tlOv04fIN2SWM4SXiq/jC7nqLeWKvTS2afyD 3U5vtKX+Sm77EfJEBOCNhV5XHZ87H3+Ijjn96SyS8qACPhJ10O9moIHcSUpjckFxdJlJvPTEjaM fH5XcVWeZ//bDjzqdHraMzrwMXoCfmNtDSbNZjEH/ilGWI9MDjIy1EaU3LyS/6Z+E84x4Ga47KO wA1BY0mBdJAnyyFvfQ5p/bXBBVf2DakJn+9aqqGW0N4ad6HW1+HpaZPEJKbr2pPTaOPDcv3YwmD 80bfOvk1wTvf7dPQaW1Z2uZU3RizSNJvK/tVaijKFm6f5Nyp0MZ34Xl17wi8eq+9RaR7F5dTyqP o8mcckkoY0KdRnEsrMg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 malwarescore=0 suspectscore=0 adultscore=0 phishscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374994634158501 The CPUs are now grouped in a TYPE_CPU_CLUSTER. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hex-subsys.h | 12 +++++++++++- include/hw/hexagon/hexagon.h | 1 + hw/hexagon/hex-subsys.c | 30 +++++++++++++++++++++++++++++- hw/hexagon/hexagon_dsp.c | 11 ++++++++++- hw/hexagon/virt.c | 11 ++++++++++- hw/hexagon/Kconfig | 1 + 6 files changed, 62 insertions(+), 4 deletions(-) diff --git a/include/hw/hexagon/hex-subsys.h b/include/hw/hexagon/hex-subsy= s.h index 087c105cfa4..6d0d5e1da86 100644 --- a/include/hw/hexagon/hex-subsys.h +++ b/include/hw/hexagon/hex-subsys.h @@ -15,7 +15,17 @@ void hex_subsys_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *m_cfg, Rev_t r= ev); =20 -/* Realize a CPU into the subsystem. */ +/* + * Parent a CPU into the subsystem's cluster and wire its links. Call for + * every CPU before hex_subsys_realize_cluster(), then realize each CPU wi= th + * hex_subsys_realize_cpu(). + */ +void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu); + +/* Realize the CPU cluster, once all CPUs have been parented into it. */ +void hex_subsys_realize_cluster(HexagonCommonMachineState *hms); + +/* Realize a CPU previously parented via hex_subsys_add_cpu(). */ void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu); =20 #endif /* HW_HEXAGON_HEX_SUBSYS_H */ diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 6edd93f478a..31669a829f8 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -157,6 +157,7 @@ struct HexagonCommonMachineState { MemoryRegion ram; MemoryRegion cfgtable_rom; MemoryRegion vtcm; + DeviceState *cluster; DeviceState *glob_regs; DeviceState *tlb; }; diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index ac7e29604eb..6fad6fe0a4d 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -10,6 +10,7 @@ #include "hw/hexagon/hex-subsys.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" +#include "hw/cpu/cluster.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev.h" @@ -42,6 +43,16 @@ static DeviceState *tlb_create(HexagonCommonMachineState= *hms, return tlb; } =20 +static DeviceState *cluster_create(HexagonCommonMachineState *hms) +{ + DeviceState *cluster =3D qdev_new(TYPE_CPU_CLUSTER); + + object_property_add_child(OBJECT(hms), "cluster", OBJECT(cluster)); + qdev_prop_set_uint32(cluster, "cluster-id", 0); + + return cluster; +} + void hex_subsys_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *m_cfg, Rev_t r= ev) { @@ -69,15 +80,32 @@ void hex_subsys_create(HexagonCommonMachineState *hms, &hms->vtcm); } =20 + hms->cluster =3D cluster_create(hms); hms->glob_regs =3D globalreg_create(hms, m_cfg, rev); hms->tlb =3D tlb_create(hms, m_cfg); } =20 -void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu) +void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu) { + object_property_add_child(OBJECT(hms->cluster), "cpu[*]", OBJECT(cpu)); object_property_set_link(OBJECT(cpu), "global-regs", OBJECT(hms->glob_regs), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(hms->tlb), &error_fatal); +} + +void hex_subsys_realize_cluster(HexagonCommonMachineState *hms) +{ + /* + * The cluster must be realized after its CPUs have been parented into= it + * (see hex_subsys_add_cpu()) but before any CPU is itself realized, s= ince + * qdev_realize_and_unref() on a CPU latches cluster_index into the TCG + * cflags at that point. + */ + qdev_realize_and_unref(hms->cluster, NULL, &error_fatal); +} + +void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu) +{ qdev_realize_and_unref(cpu, NULL, &error_fatal); } diff --git a/hw/hexagon/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index 25e8550fba2..1db5d681665 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -118,6 +118,8 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, =20 hex_subsys_create(hms, m_cfg, rev); =20 + g_autofree HexagonCPU **cpus =3D g_new(HexagonCPU *, machine->smp.cpus= ); + for (int i =3D 0; i < machine->smp.cpus; i++) { HexagonCPU *cpu =3D HEXAGON_CPU(object_new(machine->cpu_type)); qemu_register_reset(do_cpu_reset, cpu); @@ -130,7 +132,14 @@ static void hexagon_common_init(MachineState *machine,= Rev_t rev, if (i =3D=3D 0) { hexagon_init_bootstrap(dms, cpu); } - hex_subsys_realize_cpu(hms, DEVICE(cpu)); + hex_subsys_add_cpu(hms, DEVICE(cpu)); + cpus[i] =3D cpu; + } + + hex_subsys_realize_cluster(hms); + + for (int i =3D 0; i < machine->smp.cpus; i++) { + hex_subsys_realize_cpu(hms, DEVICE(cpus[i])); } } =20 diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index b9e0bbb704c..dc1d5b6aa24 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -246,6 +246,8 @@ static void virt_init(MachineState *ms) =20 fdt_add_hvx(vms, m_cfg); =20 + g_autofree HexagonCPU **cpus =3D g_new(HexagonCPU *, ms->smp.cpus); + for (int i =3D 0; i < ms->smp.cpus; i++) { HexagonCPU *cpu =3D HEXAGON_CPU(object_new(ms->cpu_type)); qemu_register_reset(do_cpu_reset, cpu); @@ -261,7 +263,14 @@ static void virt_init(MachineState *ms) } qdev_prop_set_uint32(DEVICE(cpu), "htid", i); qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", (i !=3D 0)); - hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpu)); + hex_subsys_add_cpu(&vms->parent_obj, DEVICE(cpu)); + cpus[i] =3D cpu; + } + + hex_subsys_realize_cluster(&vms->parent_obj); + + for (int i =3D 0; i < ms->smp.cpus; i++) { + hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpus[i])); } =20 fdt_add_cpu_nodes(vms); diff --git a/hw/hexagon/Kconfig b/hw/hexagon/Kconfig index 52065ab3b22..121c548bbb9 100644 --- a/hw/hexagon/Kconfig +++ b/hw/hexagon/Kconfig @@ -2,6 +2,7 @@ config HEX_DSP bool default y depends on HEXAGON + select CPU_CLUSTER =20 config HEX_VIRT bool --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374979; cv=none; d=zohomail.com; s=zohoarc; b=VOeQd3r7mJAbBpyo7WIdUuvW/6VUC697zDUxjF7tiSDbAx9mJUaVHCgxZGJdGBk7D2PVFjJVoIpxDnzaSgSJh0MuWL71Vr9gnxNy9ApxkrndAsoKdZuiDO1SBxehlhP2+TF14LGTK5RdbW/L7Awal15hQwTa0saOPocOa+MDWFA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374979; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=vivGOooEOVtBJmxvbSxjoSTPRhQMYKZC+TeOUjGdkH0=; b=iy+2Nw4ZEGnVHw+RnRClOUwPx6iI+OeNIy2mUmXRySDZdaZEn7w5O2WFqGpzmjMvJBPOHnU8jstPkgYknKNnXyxTrRI13FnApfmTOfoB0Tp4ZkmKW8og2kjuDbxk98oGDyTHBSw3Eq8J4RQiPaza2QjfQBpo7mC8Mxbm5xxEulQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374979337853.4416474487681; Wed, 29 Jul 2026 18:29:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZh-0005g8-0n; Wed, 29 Jul 2026 21:28:41 -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 1wpFZd-0005fO-MO for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:37 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZc-0005a4-49 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:37 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1Gkwb3699598 for ; Thu, 30 Jul 2026 01:28:35 GMT Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvte8169-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:34 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c96b4f58ddcso1229755a12.3 for ; Wed, 29 Jul 2026 18:28:34 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= vivGOooEOVtBJmxvbSxjoSTPRhQMYKZC+TeOUjGdkH0=; b=iCuTaZGsPFleOTdj UjtHL8kS8yFX0gYYKRGyw2UKmKqtIPjxcWpmouSHkJWlAoKLbF12DYolzBOlf6fA H5AaJhgGUAP0oFb89OL6XeWUQSbusNrOboDVD+Pi3lIwit0vIr7QG8IgJg8lJVCu G1waYFUN5itIy6a4QrNTcJusXBi4sksDXY9zwa+H6zTYRw3qa9EhxgGWJ1fKNZXe 9QgMzoKbKt8DGMATeHtUqJ5bBkE+Jy9bpap5azMZXTUhi1NsRpiRsPikh3Fh2ucW Jd5wOc3HI/6ujMMFe0ZUFxagT17ytpQyHW9z6iUNpK9FV+3nBx/uXNfDLViUiwbx pe2Z6w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374914; x=1785979714; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=vivGOooEOVtBJmxvbSxjoSTPRhQMYKZC+TeOUjGdkH0=; b=DXSVy+gOLzQCNowLSRwwCH+thMvgLAFhwDuZ9PbQwrE43qDS1cixmU1s2DTXabot/g o/FVNlhLu0NkuNV5fFr+qNcIfEE+lKSYVeh661LEOqE0m5wdjQgWtG2pli+ldFkB4PHg 3uZcTPdLItDZ/SMtWSTyiy7v9OBupSBSVyhyMGuk61m7qyKojsvKqNJsU32bxnaGvRvF 1vs92wHFfQiStKc86o/n5rTS+KXxfubHNtm5ja9/CyPDhiZPvEBwJ/pCzSLOtL8JT1up fGw51BZtQW3NJrGi87tDbzbCcf2XoV1Udic2qzEPLOhcNXQAm9LtfxXsPONztBFWVBDr uWgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374914; x=1785979714; h=content-transfer-encoding:content-type: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 :content-type; bh=vivGOooEOVtBJmxvbSxjoSTPRhQMYKZC+TeOUjGdkH0=; b=m9kKTFj+fUhizUCkpOeWHF8j1sKo0EjSvAqZXya/E9i/hBvZsNUVN8fwmkkXSJSHzh 9u6/1ac5ZcpDQ33MavmDhjDuSkMVjWU3TiOv3oMGSIiXT1pNeyFv/4r8Pi171HM0TfvT 5qpjIKg+sjHQ6pTNB68BFh9nGQr/GYC7xcx8JnH0pgelUZNCGDBkNRjppUZzvyIPP6XY Py4G4Y87TB35HBtIz1BdaK4F6TkKLZcxUREPV92ChHA0dQFy4od0YfVrgcKUtBxh0BdW u0sjPnvEe+uSlvnjjJxto4hrZ0iWYrt6DJa5TKkVpmCIrbheQoRj6yx+VW61t9ca2485 /kpA== X-Gm-Message-State: AOJu0YxOY8Wy78zsIaTnT940zgtXXxfYe2eDQ5jfMPHLSwLAu6yMawT9 CoweNxNQvwg4pWsT50ksyExkWGiHZsjrBwvUE7lIx8kTiI8Od1h1aAAsB7NyLApNhxl/kKSELHS SLk5DIXnX6/TRRRj6K5iCRTNnREEghmzHl4COKnmsFR2sKvYUEjQQ0FGPH8lR1Qrb9Q== X-Gm-Gg: AR+sD13RZiIGqtURMLafuwOSlYCx14QkwepWmCL0sOTlSft8bK7g8nq0JlKm0Gg1DPe ZIxH3x2BO0Hf2LzrkAd4BI9n1AFNZ0MYJE7HOSn4pOwMJFWvHoGJHucpjtBo76+Q5C7QOzqN1/U 0vfHcMVO4Cc5yqilxlLeUQtNb4hF0UQ2xYWdhic7rvc2YJiTTx6Z0NDOo00naTK9kx5JyERnR0m zvjsCbck8WIcsN++EzlByqzoFBPNDpoSWyYVVmRgk493jWFVoyqtIDIhUmsnRgSWvif4CCOc/A/ VgfpskWDPtg/NEcJ858EFXMZDeHRR36FyS3aHUDw1Tbo46f02J2bvdnS13vm1gZoolUs7ZPXU6t yq5iwf2fz5uFbnz8YyKKJlcsIovirMV9Ba5y+9X93LzmfuphG X-Received: by 2002:a05:6a21:608a:b0:3c3:a168:edc3 with SMTP id adf61e73a8af0-3c90085d261mr400141637.38.1785374914191; Wed, 29 Jul 2026 18:28:34 -0700 (PDT) X-Received: by 2002:a05:6a21:608a:b0:3c3:a168:edc3 with SMTP id adf61e73a8af0-3c90085d261mr400119637.38.1785374913742; Wed, 29 Jul 2026 18:28:33 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 06/18] bitops.h: Add find_first_bit32() Date: Wed, 29 Jul 2026 18:28:11 -0700 Message-Id: <20260730012824.1135905-7-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: oQ22e5X9_biF3aIyctIvhdN1_xIytuxX X-Proofpoint-ORIG-GUID: oQ22e5X9_biF3aIyctIvhdN1_xIytuxX X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX8WCVKDNfojWy cCQV7dsCDciGvPR5G9B1+3pVkmlMNUW36zwnv9/Ro0qkoOoTMx5T4HFNtLWZlG1UhjGlvb9x6SD xMUd3jTv5yfiGzaklJlAI7naRclh4Mo= X-Authority-Analysis: v=2.4 cv=Tr3WQjXh c=1 sm=1 tr=0 ts=6a6aa8c2 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=w2bVgGKsJa40EddZz84A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX7c2qK9xQwqXl vEDjtPbEemXr5uNczPmjr7NP33zXsXoHa6IqZO/1xceuGg7g3ipyj4YPwVrI8Zz97iIfnlWJ36Q THSMoKAivZVAs/8o/9Gsdw0JAgefMD3qdg7a0jMQKSqzpbOWpJfH7FQ+F3NO4woTF46JJ9MaTrN rsspMZiWTE+9V/MF4nfc0FmbncQBeN2csivJVFUQhd/cb7l5tJt8mbPGdWnGVgkm9AXjs/4I05A RKueGvfljwEoadSptF4Gb3IyQ2Lxttv7cKbFcPmAdQ4lOkOnXsS9pz4v9DVES4YfQGB8IgVQNOm gVBfo5QoJJNQunjiej2nchlZaXolieuXyDpzsuR7/bk8zWJu56K6Z/JvhkEO1KQIPJIr2qpANIa e8cT2gInYbFmceyBPtYC8yEsDP93Pi4MVNix/t+gFsrEyMrSSTBWrLo7kXhXOHLO7S/UXc1UEGu 6kYz5UVMq/RtDnxQHyg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374980559158500 set_bit32()/test_bit32()/etc already let devices operate on guest-visible uint32_t register arrays without depending on the host's 'unsigned long' size. Add find_first_bit32() so callers need not cast a uint32_t array to 'unsigned long *'. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- include/qemu/bitops.h | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index c7b838a6283..f7363a5479f 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -43,10 +43,9 @@ * be some guest-visible register view of the bit array. * * We do not currently implement uint32_t versions of find_last_bit(), - * find_next_bit(), find_next_zero_bit(), find_first_bit() or - * find_first_zero_bit(), because we haven't yet needed them. If you - * need them you should implement them similarly to the 'unsigned long' - * versions. + * find_next_bit(), find_next_zero_bit() or find_first_zero_bit(), + * because we haven't yet needed them. If you need them you should + * implement them similarly to the 'unsigned long' versions. * * You can declare a bitmap to be used with these functions via the * DECLARE_BITMAP and DECLARE_BITMAP32 macros in bitmap.h. @@ -382,6 +381,29 @@ static inline int test_bit32(long nr, const uint32_t *= addr) return 1U & (addr[BIT32_WORD(nr)] >> (nr & 31)); } =20 +/** + * find_first_bit32 - find the first set bit in a memory region + * @addr: The address to start the search at + * @size: The maximum size to search + * + * Returns the bit number of the first set bit, + * or @size if there is no set bit in the bitmap. + */ +static inline uint32_t find_first_bit32(const uint32_t *addr, uint32_t siz= e) +{ + uint32_t result; + + for (result =3D 0; result < size; result +=3D 32) { + uint32_t tmp =3D *addr++; + if (tmp) { + result +=3D ctz32(tmp); + return result < size ? result : size; + } + } + /* Not found */ + return size; +} + /** * DOC: Miscellaneous bit operations on single values * --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374996; cv=none; d=zohomail.com; s=zohoarc; b=nMxvFwdHGM0scPORFSTtuR1OFMz+ct4eCLjzpTT1/4Gnb0e3aMz1xtF96cpsEpNO7AGjqLDqRYEN/ZDg0uC3Yyd5GFeJD3CuEb/ZZAdqWyk8FKbpkqEEPDGqe5DEiA9Gyhb0sgGtC3lznwaOia6QIlBtaoDBrqKkKjdADOgbH74= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374996; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+MHMO705Sis9MZ8MqnUuVJfpLrRubs2uDqL5Z67YTnw=; b=Sn5pIBmjgpKDKcLImx2J5OXJ1TDYrE8ncn1CbkS0E/3d/HZOIwSGVjNDlSdNzRnlHZh8bBxD92ng7JSEe5KwUsXCThNmq5e6j2LRjawiZRED5wGmhudJGu8tdkR9h2S6/9ErtIcqUjbuE9cD+SBsxQG98xiVzhwOyM8PrcF/gz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374996976326.6926452294747; Wed, 29 Jul 2026 18:29:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZk-0005hX-Hy; Wed, 29 Jul 2026 21:28:44 -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 1wpFZi-0005gZ-BI for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:42 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZe-0005aR-HN for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:42 -0400 Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1EQBm3947154 for ; Thu, 30 Jul 2026 01:28:37 GMT Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvsb81bu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:37 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c96b4f58ddcso1229772a12.3 for ; Wed, 29 Jul 2026 18:28:37 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= +MHMO705Sis9MZ8MqnUuVJfpLrRubs2uDqL5Z67YTnw=; b=F3Mc/U3Yj5R1cFTs xkd+oYX4fqxFooqnDj0NYDH7W03hEEPshOyr4TvKOrkJG5ttrSPMzglAf/8Y2N1x xnEcaocVKqbnLtJZn+XTpkV9KQ0w40F35olHXH/JR433KApY45syk3oIaLDNgado wf/HpGGf5WEOjwbw1sjJTZsZFUJKd+ok6opiZxAPJxbSqYnUE2WVe2z+YNV/c2mo RjEC6bgQg+MSbMu6ucXr5tGjbxNWQ8lRJ3mBCosiFeYD6npL3JtqKU7DoyXUURcD cVqaTl6Khp2oSRKWdsdUdy7AivZUH6BOTYlFpMgDQGsvDvCH+5Qhc5prWiNCjRdh 3doitA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374916; x=1785979716; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+MHMO705Sis9MZ8MqnUuVJfpLrRubs2uDqL5Z67YTnw=; b=OzNzEGMb8IqN1FLg+o0rQVOxaK+ViGf78srD+WihNPLmaB0Bst7WspsH70LAfpAKZX je1J/yDEqyyKDqZnrc7kZsOLQqVaVEs6tOSiqjQE9f+OHVgrd63Bq8N+hTRKe2Ik9/8J uTBvSrxmAGoYiojCa79cdVfKB9Y+v2DHZyQ0iPUrSO05KSFjXXzF8PWnpY72IbuxGpGQ OeXVfqBdy8vHvDCJARho4VjlxTnkVq+FP7cbNQ945Jt3yGqXJyh5kIdgoRiH/9E9LJsA +aWeeWG6HHTFLahpu44no/2PjoKz/W9kwMkjl/updJ2BE2t+HaPFN6Q7eYlXL9e8a0ou 8drQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374916; x=1785979716; h=content-transfer-encoding:content-type: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 :content-type; bh=+MHMO705Sis9MZ8MqnUuVJfpLrRubs2uDqL5Z67YTnw=; b=tCpSzMiUSU8fbLXLIuwYm+/0CgDB1Qb2xOwDfpjs112sDe4I60wSayR8Z2nfetcWp8 57nRpXE9iaOvDZ+6rH/9rUvd5seV/Za1ogzZbmqjA573R54CcWCCuX5JUxpaCldawXf8 4xkJW4zmT1jBOBYEB/7mMj9h9Fs00k3Va7FKWr8Xnu92LM9LT8frLDZlhB13HcCMm/IH 4fYyD6/1VVRcln3jJsxPVIBPjL4BeK8lsxRJ/IaS28icTB5neOt2qZIkyQcVeEgk2EbI tX0XZBIUu+i1jZ8SE6N/Z8kqwgzHh9iZ8uSB+Cw+u5zsgbtHIGRrNOk5ftOVgSs5MMXv xYiA== X-Gm-Message-State: AOJu0Yy7PInDEcZBKyMuovWPBi9i1eqZ8QrDSFRCXFy0nEeyf8Tg1Hc7 b1Uq7ETHfYm9/J8N0azLIU9100Pomt9z3Vu21+v0LC5wqudLmbo0oqJ5ctG6mo3nX2+lX0naKNJ 7Y6HiGPEYKxDPf7mlqGiCZLFgZ5stCMoSolb4hpcNdtfMICr8VFq7lTddrQMbcmhRjQ== X-Gm-Gg: AR+sD10SnfWTp/b7cs7ZguRaPcnhczteolIwas3I7AtFQdp7DNVMKxN3aTCdPXu6T+C 5qbp1W+jN4fFm29TkHTBynrnZ25aXyWSLNhwWk+HdCJVC+SrF7JuWxXGZLc9TXMJEeCCr5D+/f9 dPpvoyutQvOmX/Gyu3PjWG6gPZE5hgSq/tHeQ65YjAuPwgO1Wz87MfrEZb1DNmUUyVDV14LGZdy 5LRaO1+R1+TnGVRsKmu5oJiAsiVr/2e3OIiyVzaOY7s2IeP8iuMoPF9cWQ5Jz1tk6kTaowmV95C ic21Gwn6iy3dOE2FiVpkAj2UsdGdNVfLkwqlINhZTLIOzXypJN3Q/UggKuJ/M9hX4IT8b5+eshm oIzvggC1r4ejKEkQb4canxCDvXX+dEMJptQ3SnkLgc/1vkluB X-Received: by 2002:a05:6a20:258f:b0:3bf:b84c:2984 with SMTP id adf61e73a8af0-3c900671e4emr422040637.11.1785374916131; Wed, 29 Jul 2026 18:28:36 -0700 (PDT) X-Received: by 2002:a05:6a20:258f:b0:3bf:b84c:2984 with SMTP id adf61e73a8af0-3c900671e4emr421996637.11.1785374915386; Wed, 29 Jul 2026 18:28:35 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com, Sid Manning , Matheus Tavares Bernardino , Damien Hedde Subject: [PATCH v4 07/18] hw/intc: Add l2vic interrupt controller Date: Wed, 29 Jul 2026 18:28:12 -0700 Message-Id: <20260730012824.1135905-8-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXzhvBPstRROBV QQUdXCWUElzgEXypCw6yAYHuUrod3ordgoYIthI55f0+A5I+WoQPXyLomIwByrOl0FTScwgySQE 7d2X5rAaWvRZ8JYbBmTOUDmk/8HL3D9jKe1+UvsOKisBkhbrYC8AoQOfD2udAECN0hX/fZPoIJs xdEe55x9fHF+5ISI4xzNXBa2Pv1gy96vHEP41g7dC3uhcDFElvWNozf0ZWIBrCjb1AWWsAqWO0q avJyQa78d4mOFNYUw5ngBE35n2hhyfrFAUxyQ7SpNfS+jQxzbD9Ce8tf+j8Ad5ghgNgB5JZzg2q obEAGwSQsPKjMhb+FYqeP1VfiB3jKz2nbtfiTo4YiFCU3a2yjRAxesICeVa2jpiBqwktGrcJkOa v6DswS8/+mXaVp3Ctr0WV2rXrYCWWgAlhsie0a+/TVg+u//OWPlh8juN43wos8mTKUVQhSaF21o hs9P8PBZXzSqMlA5S6g== X-Proofpoint-ORIG-GUID: Bv21TrhEZX8hqkugIMTCxo6hjddayOVP X-Authority-Analysis: v=2.4 cv=Fsg1OWrq c=1 sm=1 tr=0 ts=6a6aa8c5 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=NEAV23lmAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=VjGsYNusyyFeigA112kA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: Bv21TrhEZX8hqkugIMTCxo6hjddayOVP X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX5SHblNOzYgoS 3+QVurW8d8E8zuCb1BlJgH4fF6zYILwZOTaWGyJxvC4I2Wjwv8Cs8ySr0vukDdmFXjKW2yJglb5 eFU9lCEiZbJWOKV9b1mfglq58e04lOw= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 phishscore=0 malwarescore=0 suspectscore=0 clxscore=1015 spamscore=0 impostorscore=0 bulkscore=0 priorityscore=1501 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374998706158500 From: Sid Manning The Hexagon DSP requires an L2VIC to route up to 1024 external interrupt sources through 4 VID output groups into the core's 8 interrupt inputs. Add a device model for it. Co-authored-by: Matheus Tavares Bernardino Co-authored-by: Damien Hedde Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- MAINTAINERS | 3 + docs/devel/hexagon-l2vic.rst | 55 ++++ docs/devel/index-internals.rst | 1 + include/hw/intc/hex-l2vic.h | 61 ++++ target/hexagon/cpu.h | 2 + hw/intc/hex-l2vic.c | 556 +++++++++++++++++++++++++++++++++ target/hexagon/cpu.c | 2 + target/hexagon/op_helper.c | 16 +- hw/hexagon/Kconfig | 1 + hw/intc/Kconfig | 3 + hw/intc/meson.build | 2 + hw/intc/trace-events | 4 + 12 files changed, 705 insertions(+), 1 deletion(-) create mode 100644 docs/devel/hexagon-l2vic.rst create mode 100644 include/hw/intc/hex-l2vic.h create mode 100644 hw/intc/hex-l2vic.c diff --git a/MAINTAINERS b/MAINTAINERS index a28935c8986..a76366d6da5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -250,6 +250,8 @@ M: Brian Cain R: Pierrick Bouvier S: Supported F: target/hexagon/ +F: hw/intc/hex-l2vic.c +F: include/hw/intc/hex-l2vic.h X: target/hexagon/idef-parser/ X: target/hexagon/gen_idef_parser_funcs.py F: linux-user/hexagon/ @@ -262,6 +264,7 @@ F: gdbstub/gdb-xml/hexagon*.xml F: docs/system/target-hexagon.rst F: docs/system/hexagon/ F: docs/devel/hexagon-sys.rst +F: docs/devel/hexagon-l2vic.rst T: git https://github.com/qualcomm/qemu.git hex-next =20 Hexagon idef-parser diff --git a/docs/devel/hexagon-l2vic.rst b/docs/devel/hexagon-l2vic.rst new file mode 100644 index 00000000000..9cb2a86871e --- /dev/null +++ b/docs/devel/hexagon-l2vic.rst @@ -0,0 +1,55 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +Hexagon L2 Vectored Interrupt Controller +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + +.. code-block:: none + + +-------------+ +----------------------+ + | l2vic | | hexagon core | + | | | | + IRQ in ---->| | | | + IRQ in ---->| VID0 -|----------------->| irq2 | + ... ---->| | | | | + IRQ in ---->| | | v | + | ... | | | + | | | / | | \ | + IRQ in ---->| | | t0 t1 t2 t3 ...| + IRQ in ---->| VIDN -| | | + ... ---->| | | | + IRQ in ---->| | | Global SREG File | + | | | | + | State | | | + | [ ] <--|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D|=3D=3D> [ VID ] | + | [ ] <--|=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D|=3D=3D> [ VID1 ] | + | | | | + +-------------+ +----------------------+ + +L2VIC/Core Integration +---------------------- + +* hexagon core supports 8 external interrupt sources +* l2vic supports 1024 input interrupts mapped among 4 output interrupts +* l2vic has four output signals: { VID0, VID1, VID2, VID3 } +* l2vic device has a bank of registers per-VID that can be used to query + the status or assert new interrupts. +* Interrupts are 'steered' to threads based on { thread priority, 'EX' sta= te, + thread interrupt mask, thread interrupt enable, global interrupt enable, + etc. }. +* Any hardware thread could conceivably handle any input interrupt, depend= ent + on state. +* The system register transfer instruction can read the VID0-VID3 values f= rom + the l2vic when reading from hexagon core system registers "VID" and "VID= 1". +* When l2vic VID0 has multiple active interrupts, it pulses the VID0 output + IRQ and stores the IRQ number for the VID0 register field. Only after t= his + interrupt is cleared can the l2vic pulse the VID0 output IRQ again and p= rovide + the next interrupt number on the VID0 register. +* The ``ciad`` instruction clears the l2vic input interrupt and un-disable= s the + core interrupt. If some/an l2vic VID0 interrupt is pending when this oc= curs, + the next interrupt should fire and any subsequent reads of the VID regis= ter + should reflect the newly raised interrupt. +* In QEMU, on an external interrupt or an unmasked-pending interrupt, + all vCPUs are triggered (has_work=3D=3Dtrue) and each will grab the IO l= ock + while considering the steering logic to determine whether they're the th= read + that must handle the interrupt. diff --git a/docs/devel/index-internals.rst b/docs/devel/index-internals.rst index a8f5e310df3..763cda1e76f 100644 --- a/docs/devel/index-internals.rst +++ b/docs/devel/index-internals.rst @@ -15,6 +15,7 @@ Details about QEMU's various subsystems including how to = add features to them. clocks ebpf_rss hexagon-sys + hexagon-l2vic migration/index multi-process reset diff --git a/include/hw/intc/hex-l2vic.h b/include/hw/intc/hex-l2vic.h new file mode 100644 index 00000000000..edc278266cb --- /dev/null +++ b/include/hw/intc/hex-l2vic.h @@ -0,0 +1,61 @@ +/* + * QEMU L2VIC Interrupt Controller + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_INTC_HEX_L2VIC_H +#define HW_INTC_HEX_L2VIC_H + +#include "qom/object.h" + +#define TYPE_HEX_L2VIC "hex-l2vic" +/* + * L2VIC Interface for CPU/GlobalReg interaction + */ +#define TYPE_HEX_L2VIC_INTERFACE "hex-l2vic-if" + +typedef struct HexL2VicInterface HexL2VicInterface; + +typedef struct HexL2VicInterfaceClass { + InterfaceClass parent_class; + + uint32_t (*read_vid)(HexL2VicInterface *l2vic, uint32_t group); + + /* + * Write the VID: unpack the fields into per-group VIDs. This does + * not deliver or clear any interrupt; a pending interrupt stays + * gated until ciad. + */ + void (*update_vid)(HexL2VicInterface *l2vic, uint32_t group, + uint32_t value); + + /* Clear interrupt using CIAD instruction */ + void (*clear_interrupt)(HexL2VicInterface *l2vic); +} HexL2VicInterfaceClass; + +DECLARE_OBJ_CHECKERS(HexL2VicInterface, HexL2VicInterfaceClass, + HEX_L2VIC_INTERFACE, TYPE_HEX_L2VIC_INTERFACE); + +static inline uint32_t l2vic_read_vid(HexL2VicInterface *l2vic, + uint32_t group) +{ + HexL2VicInterfaceClass *k =3D HEX_L2VIC_INTERFACE_GET_CLASS(l2vic); + return k->read_vid(l2vic, group); +} + +static inline void l2vic_update_vid(HexL2VicInterface *l2vic, uint32_t gro= up, + uint32_t value) +{ + HexL2VicInterfaceClass *k =3D HEX_L2VIC_INTERFACE_GET_CLASS(l2vic); + k->update_vid(l2vic, group, value); +} + +static inline void l2vic_clear_interrupt(HexL2VicInterface *l2vic) +{ + HexL2VicInterfaceClass *k =3D HEX_L2VIC_INTERFACE_GET_CLASS(l2vic); + k->clear_interrupt(l2vic); +} + +#endif /* HW_INTC_HEX_L2VIC_H */ diff --git a/target/hexagon/cpu.h b/target/hexagon/cpu.h index 7694fd91fa8..f6c3c639325 100644 --- a/target/hexagon/cpu.h +++ b/target/hexagon/cpu.h @@ -39,6 +39,7 @@ typedef struct HexagonGlobalRegState HexagonGlobalRegStat= e; #include "qemu/bitmap.h" =20 #include "target/hexagon/reg_fields.h" +#include "hw/intc/hex-l2vic.h" =20 #define NUM_PREGS 4 #define TOTAL_PER_THREAD_REGS 64 @@ -198,6 +199,7 @@ struct ArchCPU { uint32_t boot_addr; HexagonGlobalRegState *globalregs; uint32_t htid; + HexL2VicInterface *l2vic; #endif }; =20 diff --git a/hw/intc/hex-l2vic.c b/hw/intc/hex-l2vic.c new file mode 100644 index 00000000000..f07ec850d49 --- /dev/null +++ b/hw/intc/hex-l2vic.c @@ -0,0 +1,556 @@ +/* + * QEMU L2VIC Interrupt Controller + * + * Arm PrimeCell PL190 Vector Interrupt Controller was used as a reference. + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/core/irq.h" +#include "hw/core/sysbus.h" +#include "migration/vmstate.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/bitmap.h" +#include "qemu/bitops.h" +#include "hw/intc/hex-l2vic.h" +#include "trace.h" + +#define L2VIC_VID_GRP_0 0x0 /* Read */ +#define L2VIC_VID_GRP_1 0x4 /* Read */ +#define L2VIC_VID_GRP_2 0x8 /* Read */ +#define L2VIC_VID_GRP_3 0xC /* Read */ +#define L2VIC_INT_ENABLEn 0x100 /* Read/Write */ +#define L2VIC_INT_ENABLE_CLEARn 0x180 /* Write */ +#define L2VIC_INT_ENABLE_SETn 0x200 /* Write */ +#define L2VIC_INT_TYPEn 0x280 /* Read/Write */ +#define L2VIC_INT_STATUSn 0x380 /* Read */ +#define L2VIC_INT_CLEARn 0x400 /* Write */ +#define L2VIC_SOFT_INTn 0x480 /* Write */ +#define L2VIC_INT_PENDINGn 0x500 /* Read */ +#define L2VIC_INT_GRPn_0 0x600 /* Read/Write */ +#define L2VIC_INT_GRPn_1 0x680 /* Read/Write */ +#define L2VIC_INT_GRPn_2 0x700 /* Read/Write */ +#define L2VIC_INT_GRPn_3 0x780 /* Read/Write */ + +#define L2VIC_INTERRUPT_MAX 1024 +/* + * Note about l2vic groups: + * Each interrupt to L2VIC can be configured to associate with one of + * four groups. + * Group 0 interrupts go to IRQ2 via VID 0 (SSR: 0xC2, the default) + * Group 1 interrupts go to IRQ3 via VID 1 (SSR: 0xC3) + * Group 2 interrupts go to IRQ4 via VID 2 (SSR: 0xC4) + * Group 3 interrupts go to IRQ5 via VID 3 (SSR: 0xC5) + */ + +static void bitmap32_write_word(uint32_t *bitmap, int word_offset, uint32_= t val) +{ + bitmap[word_offset] =3D val; +} + +static void bitmap32_clear_word(uint32_t *bitmap, int word_offset, + uint32_t mask) +{ + bitmap[word_offset] &=3D ~mask; +} + +static void bitmap32_set_word(uint32_t *bitmap, int word_offset, uint32_t = mask) +{ + bitmap[word_offset] |=3D mask; +} + +static uint32_t bitmap32_read_word(uint32_t *bitmap, int word_offset) +{ + return bitmap[word_offset]; +} + +OBJECT_DECLARE_SIMPLE_TYPE(HexL2VICState, HEX_L2VIC) + +#define SLICE_MAX (L2VIC_INTERRUPT_MAX / 32) +#define L2VIC_REG_RANGE_SIZE 0x80 + +typedef struct HexL2VICState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + MemoryRegion fast_iomem; + /* + * vid_group[i] is readable at L2VIC_VID_GRP_i (offset i*4): the irq + * last delivered through VID group i, 0-1023 so only 10 bits are used. + */ + uint32_t vid_group[4]; + /* + * Last irq delivered on any VID group; not specific to group 0. + * Used by the ciad path to clear the most-recently-delivered + * interrupt from int_status. + */ + uint32_t vid; + DECLARE_BITMAP32(int_enable, L2VIC_INTERRUPT_MAX); + /* Asserted interrupts awaiting delivery once no VID is active */ + DECLARE_BITMAP32(int_pending, L2VIC_INTERRUPT_MAX); + /* Which enabled interrupt is active */ + DECLARE_BITMAP32(int_status, L2VIC_INTERRUPT_MAX); + /* Edge or Level interrupt */ + DECLARE_BITMAP32(int_type, L2VIC_INTERRUPT_MAX); + DECLARE_BITMAP32(int_group_n[4], L2VIC_INTERRUPT_MAX); + qemu_irq irq[8]; +} HexL2VICState; + +typedef enum { + L2VIC_OP_WRITE, + L2VIC_OP_CLEAR, + L2VIC_OP_SET, + L2VIC_OP_NONE, +} L2VicWriteOp; + +typedef struct { + hwaddr base; + size_t state_offset; + L2VicWriteOp write_op; + bool write_only; +} L2VicRegRange; + +static const L2VicRegRange l2vic_reg_ranges[] =3D { + { L2VIC_INT_ENABLEn, offsetof(HexL2VICState, int_enable), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_ENABLE_CLEARn, offsetof(HexL2VICState, int_enable), + L2VIC_OP_CLEAR, true }, + { L2VIC_INT_ENABLE_SETn, offsetof(HexL2VICState, int_enable), + L2VIC_OP_SET, true }, + { L2VIC_INT_TYPEn, offsetof(HexL2VICState, int_type), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_STATUSn, offsetof(HexL2VICState, int_status), + L2VIC_OP_NONE, false }, + { L2VIC_INT_CLEARn, offsetof(HexL2VICState, int_status), + L2VIC_OP_CLEAR, true }, + { L2VIC_SOFT_INTn, offsetof(HexL2VICState, int_pending), + L2VIC_OP_NONE, true }, + { L2VIC_INT_PENDINGn, offsetof(HexL2VICState, int_pending), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_GRPn_0, offsetof(HexL2VICState, int_group_n[0]), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_GRPn_1, offsetof(HexL2VICState, int_group_n[1]), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_GRPn_2, offsetof(HexL2VICState, int_group_n[2]), + L2VIC_OP_WRITE, false }, + { L2VIC_INT_GRPn_3, offsetof(HexL2VICState, int_group_n[3]), + L2VIC_OP_WRITE, false }, +}; + +static uint32_t *l2vic_state_bitmap(HexL2VICState *s, size_t state_offset) +{ + return (uint32_t *)((char *)s + state_offset); +} + +static bool l2vic_reg_read_range(HexL2VICState *s, hwaddr offset, + uint64_t *value) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(l2vic_reg_ranges); i++) { + const L2VicRegRange *r =3D &l2vic_reg_ranges[i]; + + if (offset >=3D r->base && + offset < r->base + L2VIC_REG_RANGE_SIZE) { + if (r->write_only) { + *value =3D 0; + } else { + uint32_t *bitmap =3D l2vic_state_bitmap(s, r->state_offset= ); + *value =3D bitmap32_read_word(bitmap, + (offset - r->base) >> 2); + } + return true; + } + } + return false; +} + +static bool l2vic_reg_write_range(HexL2VICState *s, hwaddr offset, + uint32_t val) +{ + int i; + + for (i =3D 0; i < ARRAY_SIZE(l2vic_reg_ranges); i++) { + const L2VicRegRange *r =3D &l2vic_reg_ranges[i]; + + if (offset >=3D r->base && + offset < r->base + L2VIC_REG_RANGE_SIZE) { + uint32_t *bitmap =3D l2vic_state_bitmap(s, r->state_offset); + int word =3D (offset - r->base) >> 2; + + switch (r->write_op) { + case L2VIC_OP_WRITE: + bitmap32_write_word(bitmap, word, val); + break; + case L2VIC_OP_CLEAR: + bitmap32_clear_word(bitmap, word, val); + break; + case L2VIC_OP_SET: + bitmap32_set_word(bitmap, word, val); + break; + case L2VIC_OP_NONE: + /* Read-only or handled elsewhere; ignore the write. */ + break; + default: + g_assert_not_reached(); + } + return true; + } + } + return false; +} + +/* + * The four INT_GRPn_* register arrays are interleaved across irqs in + * blocks of 8: irq 0-7 live in group_n[0], irq 8-15 in group_n[1], irq + * 16-23 in group_n[2], irq 24-31 in group_n[3], irq 32-39 back in + * group_n[0], and so on. + */ +static uint32_t *get_int_group(HexL2VICState *s, int irq) +{ + return s->int_group_n[extract32(irq, 3, 2)]; +} + +static int find_slice(int irq) +{ + return irq / 32; +} + +static int get_vid(HexL2VICState *s, int irq) +{ + uint32_t *group =3D get_int_group(s, irq); + uint32_t slice =3D group[find_slice(irq)]; + uint32_t vid; + /* + * Each irq occupies a 4-bit field: bit 3 is the group-enable bit, + * bits 0-2 select the VID group. Shift down to this irq's field. + */ + uint32_t val =3D slice >> ((irq & 0x7) * 4); + + if (!(val & 0x8)) { + return 0; + } + vid =3D val & 0x7; + if (vid >=3D ARRAY_SIZE(s->vid_group)) { + qemu_log_mask(LOG_GUEST_ERROR, + "L2VIC: irq %d requests invalid vid group %u\n", + irq, vid); + return 0; + } + return vid; +} + +static inline bool vid_active(HexL2VICState *s) +{ + const uint32_t size =3D L2VIC_INTERRUPT_MAX; + const uint32_t active_irq =3D find_first_bit32(s->int_status, size); + return active_irq !=3D size; +} + +static bool l2vic_update(HexL2VICState *s, int irq) +{ + bool pending; + bool enable; + + if (vid_active(s)) { + return true; + } + + pending =3D test_bit32(irq, s->int_pending); + enable =3D test_bit32(irq, s->int_enable); + if (pending && enable) { + int vid =3D get_vid(s, irq); + set_bit32(irq, s->int_status); + clear_bit32(irq, s->int_pending); + /* + * Only auto-disable for edge-triggered interrupts (type=3D1). + * Level-triggered interrupts (type=3D0, the default) keep their + * enable bit set across deliveries -- the firmware enables once + * and expects the interrupt to remain enabled. + */ + if (test_bit32(irq, s->int_type)) { + clear_bit32(irq, s->int_enable); + } + s->vid =3D irq; + s->vid_group[vid] =3D irq; + + qemu_irq_pulse(s->irq[vid + 2]); + trace_hex_l2vic_delivered(irq, vid); + return true; + } + return false; +} + +static void l2vic_update_all(HexL2VICState *s) +{ + for (int i =3D 0; i < L2VIC_INTERRUPT_MAX; i++) { + if (l2vic_update(s, i)) { + /* once vid is active, no-one else can set it until ciad */ + return; + } + } +} + +static void l2vic_set_irq(void *opaque, int irq, int level) +{ + HexL2VICState *s =3D (HexL2VICState *)opaque; + + if (level) { + set_bit32(irq, s->int_pending); + } + l2vic_update(s, irq); +} + +static void l2vic_write(void *opaque, hwaddr offset, uint64_t val, + unsigned size) +{ + HexL2VICState *s =3D (HexL2VICState *)opaque; + + trace_hex_l2vic_reg_write((unsigned)offset, (uint32_t)val); + + if (!l2vic_reg_write_range(s, offset, val)) { + qemu_log_mask(LOG_UNIMP, + "%s: offset 0x%" HWADDR_PRIx " unimplemented\n", + __func__, offset); + } + + /* SOFT_INT also sets pending for edge-triggered interrupts */ + if (offset >=3D L2VIC_SOFT_INTn && + offset < L2VIC_SOFT_INTn + L2VIC_REG_RANGE_SIZE && val) { + int base_irq =3D ((offset - L2VIC_SOFT_INTn) >> 2) * 32; + uint32_t bits =3D val; + int bit; + + while ((bit =3D ctz32(bits)) < 32) { + int irq =3D base_irq + bit; + + if (test_bit32(irq, s->int_type)) { + set_bit32(irq, s->int_pending); + } + bits &=3D ~(1u << bit); + } + } + + l2vic_update_all(s); +} + +static uint64_t l2vic_read(void *opaque, hwaddr offset, unsigned size) +{ + uint64_t value; + HexL2VICState *s =3D (HexL2VICState *)opaque; + + if (offset <=3D L2VIC_VID_GRP_3) { + value =3D s->vid_group[offset >> 2]; + } else if (!l2vic_reg_read_range(s, offset, &value)) { + value =3D 0; + qemu_log_mask(LOG_GUEST_ERROR, + "L2VIC: %s: offset 0x%" HWADDR_PRIx "\n", __func__, + offset); + } + + trace_hex_l2vic_reg_read((unsigned)offset, (uint32_t)value); + return value; +} + +static const MemoryRegionOps l2vic_ops =3D { + .read =3D l2vic_read, + .write =3D l2vic_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid.min_access_size =3D 4, + .valid.max_access_size =3D 4, + .valid.unaligned =3D false, +}; + +#define FASTL2VIC_ENABLE 0x0 +#define FASTL2VIC_DISABLE 0x1 +#define FASTL2VIC_INT 0x2 + +static void fastl2vic_write(void *opaque, hwaddr offset, uint64_t val, + unsigned size) +{ + if (offset =3D=3D 0) { + uint32_t cmd =3D (val >> 16) & 0x3; + uint32_t irq =3D val & 0x3ff; + uint32_t slice =3D (irq / 32) * 4; + val =3D 1 << (irq % 32); + + if (cmd =3D=3D FASTL2VIC_ENABLE) { + l2vic_write(opaque, L2VIC_INT_ENABLE_SETn + slice, val, size); + } else if (cmd =3D=3D FASTL2VIC_DISABLE) { + l2vic_write(opaque, L2VIC_INT_ENABLE_CLEARn + slice, val, size= ); + } else if (cmd =3D=3D FASTL2VIC_INT) { + l2vic_write(opaque, L2VIC_SOFT_INTn + slice, val, size); + } else { + qemu_log_mask(LOG_GUEST_ERROR, + "%s: invalid write cmd %" PRId32 "\n", + __func__, cmd); + } + return; + } + qemu_log_mask(LOG_GUEST_ERROR, "%s: invalid write offset 0x%08" HWADDR= _PRIx + "\n", __func__, offset); +} + +static uint64_t fastl2vic_read(void *opaque, hwaddr offset, unsigned size) +{ + return 0; +} + +static const MemoryRegionOps fastl2vic_ops =3D { + .read =3D fastl2vic_read, + .write =3D fastl2vic_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid.min_access_size =3D 4, + .valid.max_access_size =3D 4, + .valid.unaligned =3D false, +}; + +static uint32_t l2vic_interface_read_vid_impl(HexL2VicInterface *iface, + uint32_t group) +{ + HexL2VICState *s =3D HEX_L2VIC(iface); + uint32_t result =3D 0; + + if (group =3D=3D 0) { + /* VID register combines vid_group[0] (VID0) and vid_group[1] (VID= 1) */ + result =3D deposit32(result, 0, 16, s->vid_group[0]); + result =3D deposit32(result, 16, 16, s->vid_group[1]); + } else if (group =3D=3D 1) { + /* VID1 register combines vid_group[2] (VID2) and vid_group[3] (VI= D3) */ + result =3D deposit32(result, 0, 16, s->vid_group[2]); + result =3D deposit32(result, 16, 16, s->vid_group[3]); + } + return result; +} + +static void l2vic_interface_update_vid_impl(HexL2VicInterface *iface, + uint32_t group, uint32_t value) +{ + HexL2VICState *s =3D HEX_L2VIC(iface); + + if (group =3D=3D 0) { + s->vid_group[0] =3D extract32(value, 0, 16); + s->vid_group[1] =3D extract32(value, 16, 16); + } else if (group =3D=3D 1) { + s->vid_group[2] =3D extract32(value, 0, 16); + s->vid_group[3] =3D extract32(value, 16, 16); + } + + l2vic_update_all(s); +} + +static void l2vic_interface_clear_interrupt_impl(HexL2VicInterface *iface) +{ + HexL2VICState *s =3D HEX_L2VIC(iface); + + if (s->vid < L2VIC_INTERRUPT_MAX) { + clear_bit32(s->vid, s->int_status); + } + l2vic_update_all(s); +} + +static void l2vic_reset_hold(Object *obj, ResetType type G_GNUC_UNUSED) +{ + HexL2VICState *s =3D HEX_L2VIC(obj); + + memset(s->int_enable, 0, sizeof(s->int_enable)); + memset(s->int_pending, 0, sizeof(s->int_pending)); + memset(s->int_status, 0, sizeof(s->int_status)); + memset(s->int_type, 0, sizeof(s->int_type)); + memset(s->int_group_n, 0, sizeof(s->int_group_n)); + memset(s->vid_group, 0, sizeof(s->vid_group)); + s->vid =3D 0; + + l2vic_update_all(s); +} + +static void reset_irq_handler(void *opaque, int irq, int level) +{ + Object *obj =3D OBJECT(opaque); + + if (level) { + l2vic_reset_hold(obj, RESET_TYPE_COLD); + } +} + +static void l2vic_init(Object *obj) +{ + DeviceState *dev =3D DEVICE(obj); + HexL2VICState *s =3D HEX_L2VIC(obj); + SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + int i; + + memory_region_init_io(&s->iomem, obj, &l2vic_ops, s, "l2vic", 0x1000); + sysbus_init_mmio(sbd, &s->iomem); + memory_region_init_io(&s->fast_iomem, obj, &fastl2vic_ops, s, "fast", + 0x10000); + sysbus_init_mmio(sbd, &s->fast_iomem); + + qdev_init_gpio_in(dev, l2vic_set_irq, L2VIC_INTERRUPT_MAX); + qdev_init_gpio_in_named(dev, reset_irq_handler, "reset", 1); + for (i =3D 0; i < 8; i++) { + sysbus_init_irq(sbd, &s->irq[i]); + } +} + +static const VMStateDescription vmstate_l2vic =3D { + .name =3D "l2vic", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D + (VMStateField[]){ + VMSTATE_UINT32_ARRAY(vid_group, HexL2VICState, 4), + VMSTATE_UINT32(vid, HexL2VICState), + VMSTATE_UINT32_ARRAY(int_enable, HexL2VICState, SLICE_MAX), + VMSTATE_UINT32_ARRAY(int_type, HexL2VICState, SLICE_MAX), + VMSTATE_UINT32_ARRAY(int_status, HexL2VICState, SLICE_MAX), + VMSTATE_UINT32_ARRAY(int_pending, HexL2VICState, SLICE_MAX), + VMSTATE_UINT32_2DARRAY(int_group_n, HexL2VICState, 4, SLICE_MA= X), + VMSTATE_END_OF_LIST() } +}; + +static void l2vic_interface_class_init(ObjectClass *klass, const void *dat= a) +{ + HexL2VicInterfaceClass *k =3D HEX_L2VIC_INTERFACE_CLASS(klass); + + k->read_vid =3D l2vic_interface_read_vid_impl; + k->update_vid =3D l2vic_interface_update_vid_impl; + k->clear_interrupt =3D l2vic_interface_clear_interrupt_impl; +} + +static void l2vic_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); + + dc->vmsd =3D &vmstate_l2vic; + rc->phases.hold =3D l2vic_reset_hold; +} + +static const TypeInfo l2vic_interface_info =3D { + .name =3D TYPE_HEX_L2VIC_INTERFACE, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(HexL2VicInterfaceClass), + .class_init =3D l2vic_interface_class_init, +}; + +static const TypeInfo l2vic_info =3D { + .name =3D TYPE_HEX_L2VIC, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(HexL2VICState), + .instance_init =3D l2vic_init, + .class_init =3D l2vic_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_HEX_L2VIC_INTERFACE }, + { } + }, +}; + +static const TypeInfo l2vic_types[] =3D { + l2vic_interface_info, + l2vic_info, +}; + +DEFINE_TYPES(l2vic_types) diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c index 12d27ce1381..75cae450299 100644 --- a/target/hexagon/cpu.c +++ b/target/hexagon/cpu.c @@ -65,6 +65,8 @@ static const Property hexagon_cpu_properties[] =3D { DEFINE_PROP_LINK("tlb", HexagonCPU, tlb, TYPE_HEXAGON_TLB, HexagonTLBState *), DEFINE_PROP_UINT32("exec-start-addr", HexagonCPU, boot_addr, 0xfffffff= f), + DEFINE_PROP_LINK("l2vic", HexagonCPU, l2vic, + TYPE_HEX_L2VIC_INTERFACE, HexL2VicInterface *), DEFINE_PROP_LINK("global-regs", HexagonCPU, globalregs, TYPE_HEXAGON_GLOBALREG, HexagonGlobalRegState *), DEFINE_PROP_UINT32("htid", HexagonCPU, htid, 0), diff --git a/target/hexagon/op_helper.c b/target/hexagon/op_helper.c index 3ce223caba3..8fb3d43c33b 100644 --- a/target/hexagon/op_helper.c +++ b/target/hexagon/op_helper.c @@ -40,6 +40,7 @@ #include "hw/hexagon/hexagon_globalreg.h" #include "hex_mmu.h" #include "hw/hexagon/hexagon_tlb.h" +#include "hw/intc/hex-l2vic.h" #include "hex_interrupts.h" #include "hexswi.h" #endif @@ -1564,7 +1565,20 @@ void HELPER(raise_stack_overflow)(CPUHexagonState *e= nv, uint32_t slot, =20 void HELPER(ciad)(CPUHexagonState *env, uint32_t mask) { - g_assert_not_reached(); + uint32_t ipendad; + uint32_t iad; + HexagonCPU *cpu; + + BQL_LOCK_GUARD(); + cpu =3D env_archcpu(env); + ipendad =3D hexagon_globalreg_read(cpu->globalregs, HEX_SREG_IPENDAD, + env->threadId); + iad =3D fGET_FIELD(ipendad, IPENDAD_IAD); + fSET_FIELD(ipendad, IPENDAD_IAD, iad & ~(mask)); + hexagon_globalreg_write(cpu->globalregs, HEX_SREG_IPENDAD, + ipendad, env->threadId); + l2vic_clear_interrupt(cpu->l2vic); + hex_interrupt_update(env); } =20 void HELPER(siad)(CPUHexagonState *env, uint32_t mask) diff --git a/hw/hexagon/Kconfig b/hw/hexagon/Kconfig index 121c548bbb9..c75090c44a1 100644 --- a/hw/hexagon/Kconfig +++ b/hw/hexagon/Kconfig @@ -3,6 +3,7 @@ config HEX_DSP default y depends on HEXAGON select CPU_CLUSTER + select HEX_L2VIC =20 config HEX_VIRT bool diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 636d00b7e88..097de4efc5d 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -8,6 +8,9 @@ config I8259 config PL190 bool =20 +config HEX_L2VIC + bool + config IOAPIC bool select I8259 diff --git a/hw/intc/meson.build b/hw/intc/meson.build index fac2d228f9b..9077a3f3297 100644 --- a/hw/intc/meson.build +++ b/hw/intc/meson.build @@ -74,6 +74,8 @@ specific_ss.add(when: 'CONFIG_PSERIES', if_true: files('x= ics_spapr.c', 'spapr_xi specific_ss.add(when: 'CONFIG_XIVE', if_true: files('xive.c')) specific_ss.add(when: ['CONFIG_KVM', 'CONFIG_XIVE'], if_true: files('spapr_xive_kvm.c')) + +specific_ss.add(when: 'CONFIG_HEX_L2VIC', if_true: files('hex-l2vic.c')) specific_ss.add(when: 'CONFIG_M68K_IRQC', if_true: files('m68k_irqc.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI_COMMON', if_true: files('loongs= on_ipi_common.c')) specific_ss.add(when: 'CONFIG_LOONGSON_IPI', if_true: files('loongson_ipi.= c')) diff --git a/hw/intc/trace-events b/hw/intc/trace-events index e7d6c304487..7512c6e6004 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -337,6 +337,10 @@ sh_intc_register(const char *s, int id, unsigned short= v, int c, int m) "%s %u - sh_intc_read(unsigned size, uint64_t offset, unsigned long val) "size %u 0= x%" PRIx64 " -> 0x%lx" sh_intc_write(unsigned size, uint64_t offset, unsigned long val) "size %u = 0x%" PRIx64 " <- 0x%lx" sh_intc_set(int id, int enable) "setting interrupt group %d to %d" +# hex-l2vic.c +hex_l2vic_reg_write(unsigned int addr, uint32_t value) "addr: 0x%03x value= : 0x%08"PRIx32 +hex_l2vic_reg_read(unsigned int addr, uint32_t value) "addr: 0x%03x value:= 0x%08"PRIx32 +hex_l2vic_delivered(int irq, int vid) "l2vic: delivered %d (vid %d)" =20 # loongson_ipi.c loongson_ipi_read(unsigned size, uint64_t addr, uint64_t val) "size: %u ad= dr: 0x%"PRIx64 "val: 0x%"PRIx64 --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375010; cv=none; d=zohomail.com; s=zohoarc; b=a3BpO4y4PRoMHluDCmBmaZOG1cUS4BBCb2WA2f/3I5opbwjIPeZf3bZoALNCMvWSxiZ0bX+r4TFz+A+Dwc3jNRduUgf8xBM+YkXziVpE5dJHhMkIjK8adjzGm7FW9Pu+y1tgEEZ2oVUINKB26HzDgILNiV6qOmPNnW8k6RnNCqA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375010; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=12psgMGaE/AFAca7um5d5BHgu9y7A7ATuwy2bTUnMOM=; b=RgPllu6q+DoWURox/6Dof9myBi8j+66dP8G20VcEeoi3oHZFSWbx9+cH4DEu1PSV8f7seUMO8rnIg5B5oHt9lB4/WgWQLmr7B5PzgOVm/tcRzM9KSC3Jn8CH+wP3N6CnCsqSeD8HIH6jkBEI/kHS1VMU/spt4Lc+neSOXl+PEx4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375010410206.6301789771925; Wed, 29 Jul 2026 18:30:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZi-0005gk-Pd; Wed, 29 Jul 2026 21:28:42 -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 1wpFZg-0005fw-GL for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:40 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZe-0005aV-T2 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:40 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1MGIW497083 for ; Thu, 30 Jul 2026 01:28:37 GMT Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvvy80nc-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:37 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2cc86a9ef97so32214255ad.3 for ; Wed, 29 Jul 2026 18:28:37 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= qcppdkim1; bh=12psgMGaE/AFAca7um5d5BHgu9y7A7ATuwy2bTUnMOM=; b=LY wwH5T9REZv6aS0JjUcClfKDpiLbRJIUNaFIQeevIE82wi81yb+LM+nJf7pMCyWQh QI6Yf6aPGVPSfKC7DIdc7UMXq1GbI/JjGV3FmQOL1d3tDMb5JjWpkegF/m6hIKEZ LApZdS8cnCROHW1pAde0jg3a/oq389R+nPxskZoCK40FcT0HEeX4kaY+UiIvKQvC VfXnr7zOVN45JjKRIrOg7IEh14PB4KZbFRXxVGAnmGNNeOC8PotGm1o02JRt7M1N TlP2NVsccoTQUJ4Dhg4YNQmUlEX+M/AxKqkQVC5yVlZCZxP2PiELiKFxZRk8HweP 9NY2c8Lg18I8W3P2wqpg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374917; x=1785979717; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=12psgMGaE/AFAca7um5d5BHgu9y7A7ATuwy2bTUnMOM=; b=U0T6sJmGNAxjgIlkXqHF1QrdFQuVXHNQLUBxYo43A2DTfX5lIL2xM54PUtZXtPkFGf GOZqpPgeetloKMVZc3WNe9tfK9+zYAyH1PD5pUbRq6NLIKCpijwQ05akSGBLFZEVzzZi Dxzl+J2Zb8SNoyvQN75WVVLR1Tc2kqb0FUHENi9S6I4MSiHMHJf3ueCsj5Vlyrgxfwrf auMiHnmCDZzAZydkC2u3Eh5PD5Nry+kF+4xFfkwdn6Ya8ZapJEunh8SoP5N9mRO5z24v FPogtLP5TetS60oSCUtRvA17bvDnWtFLiAoTKSt6PaqKXxyGHn5tHDcFSko5ieEut8Vy eILA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374917; x=1785979717; h=content-transfer-encoding:content-type:content-type: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 :content-type; bh=12psgMGaE/AFAca7um5d5BHgu9y7A7ATuwy2bTUnMOM=; b=msG64BONuSSX+PSQqHZOQ8UG1e8J5JVGCRhd3hmG301UCVlFtz3gMKktUdwcmfTaeR udYNCXXCOBsiyUznYyn97L7F5Bc8qBT6koFNZmKotK4NQWXRZViXmGU8MnJlhOQ+uDU8 QOpcwBUhoZxYAz7OCOyxGZ7io0KpbY8tVVQzYFs9yndQ0qk/tbPfGTPnMs+QtlBMNzLb oI14F1wqdg5DyQFvyQneX2uOYZ1pSxfk10EjvxfcVmT/3zDyLgAl4BKeFDRbTxAy9TUV umTB/60+bkJrcFjQ1VjF+jKdgOK/p4Y/z9n4vdOBIuFll/JLC7FcVOchabQ/TsO7mZ0i N/MQ== X-Gm-Message-State: AOJu0YwYVoIPu1mvOyfA20gAOSkU8+JVLcgSn0E7rRLnfnli1/6GxXuU nJMhQrHBokga1sgdWDxvotKsI9agso9hPLLKJZ/sMbhOx348TWdVlDVR3uG6FO0MNSovoA0RQBE IOic81xfKU8kXGHaazwitt8295wE60qXJ8OiqjOCJhPu9n0snDvP4o7QBMjd6/9BkYA== X-Gm-Gg: AR+sD11er7sVx/NluEePWlPrm/Mc4s0uJ+fnYjQCkJkd74blAe4n89FYeJBD8GtE00q Bu8YQ/uQ6ZK/W+nZRqefY94ejKoiDxGLgoX4/uyGbOncRJ/te8nGDcxtLCN2m2ILz7EIp7jSTYa RbIyjYUbajA/druBHvxuczZbTprDRp0dn6tC61TNzBVq/nAb+622cFSq74Yfp8ehV+7ua2bev8D 3+utENLI+7Y+z/U8OI0X+Exq53RRGoBXatmLLM4IJb1qiW9ZkRdCNYdBEfXtkHCOYKYK1k8ONfD v0YzuI8Hpg1BtztKT749mQaMWJU9MoxOuF8C8/sBGYq4wQOZDOjmcatCw9oo66jze5v3A3Xv4Nb hyDUHx4qrjseqmjlFT7DwBbgPd9eaDazYb4Z6B+6t03byIIiX X-Received: by 2002:a17:902:d2c7:b0:2ca:bb5b:3c92 with SMTP id d9443c01a7336-2d035cd9591mr6523855ad.35.1785374916779; Wed, 29 Jul 2026 18:28:36 -0700 (PDT) X-Received: by 2002:a17:902:d2c7:b0:2ca:bb5b:3c92 with SMTP id d9443c01a7336-2d035cd9591mr6523765ad.35.1785374916382; Wed, 29 Jul 2026 18:28:36 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 08/18] hw/hexagon: extract get_reg_value/set_reg_value stubs in globalreg Date: Wed, 29 Jul 2026 18:28:13 -0700 Message-Id: <20260730012824.1135905-9-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX53mPz+nfeOib fuuuPOIIOvVCLvNMgZde7II4kcXkfO/1kG/WcO4HhyiukM3t5ganeWJy1XnLRDrFFKZy0KR3kUd z/Y9UhJfegF14KMS1OoJ3ZgaGYAqwCqNBW2JQIA+FnJsssXsgcL4e2Oa28iyjb8qqBFcbpz4uWu KBkjO+a8Bd3wl6EOd9j3ts/0WHRFg2wZifMCZj3PvwfVLPkNoFY2ZYacEEpujpVAKB0Itm+82xa FIu0NatLxz9pgl4ztER22CKuiAbU0MLq/55x42zVhnSKFfTEtxpQm3VbDITAgdy8WDiaqtdNBGE 2hqwHmc/xaKSil7h3CW+hBIkJmI4P9Y+7JVz7Y8rJOP9YqYW375daAiwY7eFQDqQrotHMo/GxqM DVrOg8QQwoxX7FPA6gFyWxiTqgBmyscvYMSmc1c/ciDGF4Y9wluYr+tu7bsOZtX54jOBoYMj+3+ QfDiZXjfbRspnj9cvTg== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX2Ovk1cBXSmpJ FyLEURklVgaHhBjpdc6JQr8PRBwoxmuZtjTPrB5Bu0QIrV7Ghy3B19MV7LTSUk2UgmWBTXUBFBm sVFoDqxr8nqJHWYq0x3RCYmvyPmnc+I= X-Authority-Analysis: v=2.4 cv=U8+iy+ru c=1 sm=1 tr=0 ts=6a6aa8c5 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=Z4HElfRGeH4uGo3IGfcA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: uDx32dEfv311ZIwQLeCjSAxpbF1u66h1 X-Proofpoint-ORIG-GUID: uDx32dEfv311ZIwQLeCjSAxpbF1u66h1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375010641158500 Content-Type: text/plain; charset="utf-8" Route the globalreg read/write accessors through new get_reg_value()/set_reg_value() helpers instead of touching s->regs[reg] directly. This will be exploited by a subsequent patch that redirects VID/VID1 accesses to the L2VIC. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Brian Cain --- hw/hexagon/hexagon_globalreg.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/hexagon/hexagon_globalreg.c b/hw/hexagon/hexagon_globalreg.c index b5e5913507e..105475219ab 100644 --- a/hw/hexagon/hexagon_globalreg.c +++ b/hw/hexagon/hexagon_globalreg.c @@ -135,6 +135,17 @@ static inline uint32_t apply_write_mask(uint32_t new_v= al, uint32_t cur_val, return new_val; } =20 +static uint32_t get_reg_value(HexagonGlobalRegState *s, uint32_t reg) +{ + return s->regs[reg]; +} + +static void set_reg_value(HexagonGlobalRegState *s, uint32_t reg, + uint32_t value) +{ + s->regs[reg] =3D value; +} + uint32_t hexagon_globalreg_read(HexagonGlobalRegState *s, uint32_t reg, uint32_t htid) { @@ -146,7 +157,7 @@ uint32_t hexagon_globalreg_read(HexagonGlobalRegState *= s, uint32_t reg, g_assert(reg < NUM_SREGS); g_assert(reg >=3D HEX_SREG_GLB_START); =20 - value =3D s->regs[reg]; + value =3D get_reg_value(s, reg); =20 trace_hexagon_globalreg_read(htid, get_sreg_name(reg), value); return value; @@ -160,7 +171,7 @@ void hexagon_globalreg_write(HexagonGlobalRegState *s, = uint32_t reg, } g_assert(reg < NUM_SREGS); g_assert(reg >=3D HEX_SREG_GLB_START); - s->regs[reg] =3D value; + set_reg_value(s, reg, value); trace_hexagon_globalreg_write(htid, get_sreg_name(reg), value); } =20 @@ -168,6 +179,7 @@ uint32_t hexagon_globalreg_masked_value(HexagonGlobalRe= gState *s, uint32_t reg, uint32_t value) { uint32_t reg_mask; + uint32_t cur_val; =20 if (!s) { return value; @@ -175,9 +187,10 @@ uint32_t hexagon_globalreg_masked_value(HexagonGlobalR= egState *s, uint32_t reg, g_assert(reg < NUM_SREGS); g_assert(reg >=3D HEX_SREG_GLB_START); reg_mask =3D global_sreg_immut_masks[reg]; + cur_val =3D get_reg_value(s, reg); return reg_mask =3D=3D IMMUTABLE ? - s->regs[reg] : - apply_write_mask(value, s->regs[reg], reg_mask); + cur_val : + apply_write_mask(value, cur_val, reg_mask); } =20 void hexagon_globalreg_write_masked(HexagonGlobalRegState *s, uint32_t reg, @@ -186,7 +199,7 @@ void hexagon_globalreg_write_masked(HexagonGlobalRegSta= te *s, uint32_t reg, if (!s) { return; } - s->regs[reg] =3D hexagon_globalreg_masked_value(s, reg, value); + set_reg_value(s, reg, hexagon_globalreg_masked_value(s, reg, value)); } =20 uint64_t hexagon_globalreg_get_pcycle_base(HexagonGlobalRegState *s) --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375061; cv=none; d=zohomail.com; s=zohoarc; b=l6v/p79g+WkcqVC3WHTtyt/JrdfykIQ3GLu3pN6aTv0X87865BFY15ioOkI5gmb7b//t0eL8b0+6eos1w637iUDJP4QnPjtY6Dc/Woi+bC+S2XemIBHWvg9qUwgg2sEZ0npTXKYCt3c67YJs9lUN8c6rtdZV3SJM/LnPAudurlI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375061; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BLHh55VB7GYnCYqKGWP3S3Dj4gAYp4cImisMK87+K9s=; b=oKFdBe1fOZa/grSv3yfZSVHZdTNUuwOrnMfhJxALy6jAljrjtOSIi+QdQDik3CIcE2w08ROcOAkDB2d2en+5B5hxB8FNJl0O2QkYTVdKGSJxxghlG8ZShPhdkzgp4G5B0iP5iCPJ1Fi5a8JaJQxlG+3YPrJxFy2mO+5f3/CQj4A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375061539952.9382043710862; Wed, 29 Jul 2026 18:31:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZj-0005gx-Bm; Wed, 29 Jul 2026 21:28:43 -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 1wpFZi-0005gY-82 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:42 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZf-0005ab-Sh for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:42 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1Gp0p3699695 for ; Thu, 30 Jul 2026 01:28:38 GMT Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvte816h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:38 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-c860544c077so3377712a12.3 for ; Wed, 29 Jul 2026 18:28:38 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= qcppdkim1; bh=BLHh55VB7GYnCYqKGWP3S3Dj4gAYp4cImisMK87+K9s=; b=NM sNTTp3esdGaiZYndtgt45uf0GPaGMdARKutQ7MxbJALkn8caEefj6lM+pN2YF3fY Qp3rZA9MAufh/3Jrx+BQnLKF9AYaB+fW6RegS5M62OI+pyu0lZQ9ucqMS5PkoPHM hQAo5ZpIKv/F8iQvLcO7F/ZcoEMimE40k2pFNT9HCizWNT3bClqQa3tHXz3it1eH BxYvu03EHGUBpUnCuO49ALBlIGgQgfObYRs4Yjms/Iqx6ElnQFKedi4PlWbfuYd4 +3lf8KkMbgAz/7Gweb3HohvYtWIUtAYeoLLDDT6CCsGXocvzAYI+awoq12J5+/sS o81dfX/SKb6V4iyf8bSw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374918; x=1785979718; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=BLHh55VB7GYnCYqKGWP3S3Dj4gAYp4cImisMK87+K9s=; b=UVygn05jMfzjkmIZ9Aa52++gz3buyr6oCihjmIcFbw3umLlwbeah8Y3vzxgmQ0p2Cp m1C98xQvV0+YgnZf4f7nq/THUoCowtT7booK2fpxBuyL0bnY3R+YCGVfgtCkGfxUiRYn K9iOB9W07v5PxzUQ7PWDq4d6uAvLqPyHoswaXHWZhfeQGbU9kOk/7EB8NvfTGyiWh9be a4aEIhNasrvHC3K2E3VjpFwQi3KpV2YgOUAI1Qe4o07nKs3NWTbWBfWtvW/uX0kKnfs/ 2kNfZVlbJ5wqzeQuQWutzffJLZpL+PreDQ2t2f3RFfYMGsC6JGehEnuE4wou2+DPFckI M7Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374918; x=1785979718; h=content-transfer-encoding:content-type:content-type: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 :content-type; bh=BLHh55VB7GYnCYqKGWP3S3Dj4gAYp4cImisMK87+K9s=; b=d7+7zJYsYMjb6VjXivLhSsh0DIYXlZ9fNPvrazlvUWYX+PbOot2FIaTa/ShiAP7mgO Er3EJPHFkW9RwEL7wtZoKFEx8xPOqCoZ2zGps6wInGwLU+mVuUl1EQwqPAa5MO/iSJxc rnUgm9eox3mfJNeY+TAQ2l8t3FaFbqGoY32u2v6AyWPb2fSExtbGSCeqTkRsY5cEAo2o g9FLwkptoInTaH/5k0GkYnTiJ0bkHMzwWilFs/3Je7QAOAHxkUpMtiB0bQSAhP21BOV+ kzrOhyarpLBgLTYM5c9upZCt2IH9XForu+sixh0mPGqa5eSpman3y6w9exphXhjXTmra yTxw== X-Gm-Message-State: AOJu0YzAUeIDhLDSgAb422uoqov+0Z6lN4PFExzSyQxTvd2bpRaWsqtX sBT58ZfXicn4Jhm+alS9Dv/GGSAIbXVLIn5mdhBGDgIJupfnPr7SnycvGcPHqEocSMnpvpC2GLx HbpeNUZeJYcLnl3/tfuhKrBF1Cn7CGxBNCgg5X692RyniEdJTs5p8GWqv3lFg09M/5w== X-Gm-Gg: AR+sD12OxGD0hEbTNkcY3zT6Exr6B0iEh4UaG1MYYmM3iUVGwJatfgaUyzWN7EHCipO rpCRIzJqGKyYIsq7EkizRO1ClO6xQDuCz/YQUW0gj1ebim44J8m+bHwwTx6sq8b/eYuzua3Rdtb bhm0/+Yj0UIq3/ClHqHLcjfNGCEzAd02m7ZnSIknmI+9g6NkP/xEiS9ZeJUabs2ftCE0aOPLqXX jXYoUd78M9Xz2XBGgfwFFVsbpmaU0f3gX4c7tYBkgvAJ3krx0Is91IXz9NQn6r1uMLbYSJG7ewA CH+xM4rPTGo7sf8D1MUP7RAmQuiKBXqK5M3ciC9bPNZcQpT8DnGaMYA0zBxMrrQBC++8wz/YhfA vJ7OeYAYJMg9d8fLE9VIannJyNirTq06aKIWYDYs0dZdyGTLx X-Received: by 2002:a05:6a20:be8f:b0:3c3:8129:a492 with SMTP id adf61e73a8af0-3c90066d9bbmr503005637.38.1785374917895; Wed, 29 Jul 2026 18:28:37 -0700 (PDT) X-Received: by 2002:a05:6a20:be8f:b0:3c3:8129:a492 with SMTP id adf61e73a8af0-3c90066d9bbmr502973637.38.1785374917426; Wed, 29 Jul 2026 18:28:37 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 09/18] hw/hexagon: connect l2vic device Date: Wed, 29 Jul 2026 18:28:14 -0700 Message-Id: <20260730012824.1135905-10-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: j8y3b-KTow_GcZPFP2r-Pb8obYtq14PF X-Proofpoint-ORIG-GUID: j8y3b-KTow_GcZPFP2r-Pb8obYtq14PF X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXylD2DOPt0fDj qAhxUqRothcHTy/WFoxxlLTJxfpRL4KOdp/U1POpx3pQP1w80F3yqbtT/dzElE5lSv9T8JkYYvO kngL+v1ZBYto1hSZGuJ14S31HW15c7Y= X-Authority-Analysis: v=2.4 cv=Tr3WQjXh c=1 sm=1 tr=0 ts=6a6aa8c6 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=dwkSCBXVzhE_Z7DFN7MA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX6pda9sVU/lHV 9keIHucVsNXinNRgS3ZpLDISmf2fXNeF28wcX45UXPjh7LYbYfiEdDkmSWCZbZDiLGtQh2jgtWA /hBQCy5YyFvog9XsNp4M/SzHdqY0jhV0BLT8j66C1A5pi7YtRD3kAZnNEe2y7fQNkDlGNhDwFAk XLm1Otragwxf/cPH5mzlkXtFYoX1DJpjX1oheQJ92iTjzcdVJ7U9d7P4eELT0xSwZxFqV26XrSy UtgCQPMoUUX3BrhhpAWBYFZ94thGiD+QT0whEO5rMpEFoC1GfSE5EVbXtDJ3r+FP8vff9BbExOs m/JT/sQaG2jTa7n0C1qNPViFyTRN7TFsJlGAmJ5EutAM+x1xvwsEyjEXNV7wEXQNinagzgEUtD4 ueOV8sFWLTqD+8ptSvV0RyFtbxu/Eck8WRt/CXD3IPOgy33RVxiW5FhXaO8v4Q82+CjTC2HMZht /UlCjNWRb8+yGlKcNfQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375062993158500 Content-Type: text/plain; charset="utf-8" Add the l2vic to the shared hex-subsys so both machine models pick it up. Map its register banks, wire the interrupt lines to CPU[0] and link each vCPU, globalregs. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- include/hw/hexagon/hex-subsys.h | 5 ++-- include/hw/hexagon/hexagon.h | 1 + include/hw/hexagon/hexagon_globalreg.h | 4 +++ hw/hexagon/hex-subsys.c | 38 +++++++++++++++++++++++++- hw/hexagon/hexagon_dsp.c | 2 +- hw/hexagon/hexagon_globalreg.c | 25 +++++++++++++++++ hw/hexagon/virt.c | 2 +- 7 files changed, 72 insertions(+), 5 deletions(-) diff --git a/include/hw/hexagon/hex-subsys.h b/include/hw/hexagon/hex-subsy= s.h index 6d0d5e1da86..5792f7b5af3 100644 --- a/include/hw/hexagon/hex-subsys.h +++ b/include/hw/hexagon/hex-subsys.h @@ -18,7 +18,7 @@ void hex_subsys_create(HexagonCommonMachineState *hms, /* * Parent a CPU into the subsystem's cluster and wire its links. Call for * every CPU before hex_subsys_realize_cluster(), then realize each CPU wi= th - * hex_subsys_realize_cpu(). + * hex_subsys_realize_cpu(). CPU[0] receives the L2VIC outputs. */ void hex_subsys_add_cpu(HexagonCommonMachineState *hms, DeviceState *cpu); =20 @@ -26,6 +26,7 @@ void hex_subsys_add_cpu(HexagonCommonMachineState *hms, D= eviceState *cpu); void hex_subsys_realize_cluster(HexagonCommonMachineState *hms); =20 /* Realize a CPU previously parented via hex_subsys_add_cpu(). */ -void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu); +void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu, + bool boot_cpu); =20 #endif /* HW_HEXAGON_HEX_SUBSYS_H */ diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 31669a829f8..ec1578807d8 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -158,6 +158,7 @@ struct HexagonCommonMachineState { MemoryRegion cfgtable_rom; MemoryRegion vtcm; DeviceState *cluster; + DeviceState *l2vic; DeviceState *glob_regs; DeviceState *tlb; }; diff --git a/include/hw/hexagon/hexagon_globalreg.h b/include/hw/hexagon/he= xagon_globalreg.h index 950099808fd..397dc6854c9 100644 --- a/include/hw/hexagon/hexagon_globalreg.h +++ b/include/hw/hexagon/hexagon_globalreg.h @@ -10,6 +10,7 @@ =20 #include "hw/core/qdev.h" #include "hw/core/sysbus.h" +#include "hw/intc/hex-l2vic.h" #include "qom/object.h" #include "target/hexagon/cpu.h" =20 @@ -22,6 +23,9 @@ struct HexagonGlobalRegState { /* Array of system registers */ uint32_t regs[NUM_SREGS]; =20 + /* L2VIC interface used to back the VID/VID1 registers */ + HexL2VicInterface *l2vic; + /* Global performance cycle counter base */ uint64_t g_pcycle_base; =20 diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 6fad6fe0a4d..25c028f6579 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -10,6 +10,7 @@ #include "hw/hexagon/hex-subsys.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" +#include "hw/intc/hex-l2vic.h" #include "hw/cpu/cluster.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" @@ -17,6 +18,31 @@ #include "hw/core/sysbus.h" #include "system/address-spaces.h" =20 +#define HEX_L2VIC_CPU_IRQS 8 + +static DeviceState *l2vic_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *m_cf= g) +{ + DeviceState *l2vic =3D qdev_new(TYPE_HEX_L2VIC); + + object_property_add_child(OBJECT(hms), "l2vic", OBJECT(l2vic)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(l2vic), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(l2vic), 0, m_cfg->l2vic_base); + sysbus_mmio_map(SYS_BUS_DEVICE(l2vic), 1, + m_cfg->cfgtable.fastl2vic_base << 16); + + return l2vic; +} + +static void l2vic_connect_cpu(DeviceState *l2vic, DeviceState *cpu) +{ + int i; + + for (i =3D 0; i < HEX_L2VIC_CPU_IRQS; i++) { + sysbus_connect_irq(SYS_BUS_DEVICE(l2vic), i, qdev_get_gpio_in(cpu,= i)); + } +} + static DeviceState *globalreg_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *= m_cfg, Rev_t rev) @@ -26,6 +52,8 @@ static DeviceState *globalreg_create(HexagonCommonMachine= State *hms, object_property_add_child(OBJECT(hms), "global-regs", OBJECT(glob_regs= )); qdev_prop_set_uint64(glob_regs, "config-table-addr", m_cfg->cfgbase); qdev_prop_set_uint32(glob_regs, "dsp-rev", rev); + object_property_set_link(OBJECT(glob_regs), "l2vic", OBJECT(hms->l2vic= ), + &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(glob_regs), &error_fatal); =20 return glob_regs; @@ -81,6 +109,7 @@ void hex_subsys_create(HexagonCommonMachineState *hms, } =20 hms->cluster =3D cluster_create(hms); + hms->l2vic =3D l2vic_create(hms, m_cfg); hms->glob_regs =3D globalreg_create(hms, m_cfg, rev); hms->tlb =3D tlb_create(hms, m_cfg); } @@ -92,6 +121,8 @@ void hex_subsys_add_cpu(HexagonCommonMachineState *hms, = DeviceState *cpu) OBJECT(hms->glob_regs), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(hms->tlb), &error_fatal); + object_property_set_link(OBJECT(cpu), "l2vic", OBJECT(hms->l2vic), + &error_fatal); } =20 void hex_subsys_realize_cluster(HexagonCommonMachineState *hms) @@ -105,7 +136,12 @@ void hex_subsys_realize_cluster(HexagonCommonMachineSt= ate *hms) qdev_realize_and_unref(hms->cluster, NULL, &error_fatal); } =20 -void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu) +void hex_subsys_realize_cpu(HexagonCommonMachineState *hms, DeviceState *c= pu, + bool boot_cpu) { qdev_realize_and_unref(cpu, NULL, &error_fatal); + + if (boot_cpu) { + l2vic_connect_cpu(hms->l2vic, cpu); + } } diff --git a/hw/hexagon/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index 1db5d681665..20306c28e72 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -139,7 +139,7 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, hex_subsys_realize_cluster(hms); =20 for (int i =3D 0; i < machine->smp.cpus; i++) { - hex_subsys_realize_cpu(hms, DEVICE(cpus[i])); + hex_subsys_realize_cpu(hms, DEVICE(cpus[i]), (i =3D=3D 0)); } } =20 diff --git a/hw/hexagon/hexagon_globalreg.c b/hw/hexagon/hexagon_globalreg.c index 105475219ab..285cb48c44b 100644 --- a/hw/hexagon/hexagon_globalreg.c +++ b/hw/hexagon/hexagon_globalreg.c @@ -11,6 +11,7 @@ #include "hw/core/qdev-properties.h" #include "hw/core/sysbus.h" #include "hw/core/resettable.h" +#include "hw/intc/hex-l2vic.h" #include "migration/vmstate.h" #include "qom/object.h" #include "target/hexagon/cpu.h" @@ -135,8 +136,16 @@ static inline uint32_t apply_write_mask(uint32_t new_v= al, uint32_t cur_val, return new_val; } =20 +static inline bool is_vid_reg(uint32_t reg) +{ + return reg =3D=3D HEX_SREG_VID || reg =3D=3D HEX_SREG_VID1; +} + static uint32_t get_reg_value(HexagonGlobalRegState *s, uint32_t reg) { + if (is_vid_reg(reg)) { + return l2vic_read_vid(s->l2vic, reg =3D=3D HEX_SREG_VID ? 0 : 1); + } return s->regs[reg]; } =20 @@ -144,6 +153,9 @@ static void set_reg_value(HexagonGlobalRegState *s, uin= t32_t reg, uint32_t value) { s->regs[reg] =3D value; + if (is_vid_reg(reg)) { + l2vic_update_vid(s->l2vic, reg =3D=3D HEX_SREG_VID ? 0 : 1, value); + } } =20 uint32_t hexagon_globalreg_read(HexagonGlobalRegState *s, uint32_t reg, @@ -269,6 +281,16 @@ static void hexagon_globalreg_reset_hold(Object *obj, = ResetType type) do_hexagon_globalreg_reset(s); } =20 +static void hexagon_globalreg_realize(DeviceState *dev, Error **errp) +{ + HexagonGlobalRegState *s =3D HEXAGON_GLOBALREG(dev); + + if (!s->l2vic) { + error_setg(errp, "hexagon_globalreg: 'l2vic' link property not set= "); + return; + } +} + static const VMStateDescription vmstate_hexagon_globalreg =3D { .name =3D "hexagon_globalreg", .version_id =3D 1, @@ -288,6 +310,8 @@ static const VMStateDescription vmstate_hexagon_globalr= eg =3D { }; =20 static const Property hexagon_globalreg_properties[] =3D { + DEFINE_PROP_LINK("l2vic", HexagonGlobalRegState, l2vic, + TYPE_HEX_L2VIC_INTERFACE, HexL2VicInterface *), DEFINE_PROP_UINT32("boot-evb", HexagonGlobalRegState, boot_evb, 0x0), DEFINE_PROP_UINT64("config-table-addr", HexagonGlobalRegState, config_table_addr, 0xffffffffULL), @@ -308,6 +332,7 @@ static void hexagon_globalreg_class_init(ObjectClass *k= lass, const void *data) ResettableClass *rc =3D RESETTABLE_CLASS(klass); =20 rc->phases.hold =3D hexagon_globalreg_reset_hold; + dc->realize =3D hexagon_globalreg_realize; dc->vmsd =3D &vmstate_hexagon_globalreg; dc->user_creatable =3D false; device_class_set_props(dc, hexagon_globalreg_properties); diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index dc1d5b6aa24..9a680852c3c 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -270,7 +270,7 @@ static void virt_init(MachineState *ms) hex_subsys_realize_cluster(&vms->parent_obj); =20 for (int i =3D 0; i < ms->smp.cpus; i++) { - hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpus[i])); + hex_subsys_realize_cpu(&vms->parent_obj, DEVICE(cpus[i]), (i =3D= =3D 0)); } =20 fdt_add_cpu_nodes(vms); --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375047; cv=none; d=zohomail.com; s=zohoarc; b=OXorU1np2U/fdLM/HgD4f9CkVByi8ZsCSt+Pzvvy5HJAik7HgM/XTcgTs6HEWMgARtI5XhJ7xKtZDp5wov3mcBiVEpdCeN22bRaevjXyYSahRj9eVRxWsqhmf0ezBE6ELVEBlXejBX70yulxphodkvuOLu3krZ3rO9Q+Tdhav4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375047; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=x33rKD5AJt14CHYPvmx76d8qJqPC6RXtU8ksUlr6PXc=; b=JwLLMl4VhOe7Wo/8eqTr9zeoUncT6XvMJnhthuBCIa17+t8WOA/h0I0oVCPCLbhLTJAtemcPzdQaCPMxKCCg8OjyDJhSQ5hYRA61vVONp9dm0wZwkWOx0KpGo976n2bPakuMeo90GNJG0PZcL/HJjrKStDhoSCfnywQ29KlX6gA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375047746872.7490323801067; Wed, 29 Jul 2026 18:30:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZm-0005hn-F3; Wed, 29 Jul 2026 21:28:46 -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 1wpFZk-0005hB-8p for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:44 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZi-0005aq-MS for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:44 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1Njoe3460315 for ; Thu, 30 Jul 2026 01:28:41 GMT Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvwpg0f7-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:40 +0000 (GMT) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-848860def2cso1828471b3a.2 for ; Wed, 29 Jul 2026 18:28:40 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= qcppdkim1; bh=x33rKD5AJt14CHYPvmx76d8qJqPC6RXtU8ksUlr6PXc=; b=mn OtqlsxyoptgwqERvcCnXXTtO8NlmzZes0QzBrXAqRNeIfxwY1T7R2O52grK6JyNz dyoQpeW5aZZqVqrzsxhyKA/XNYWHYAkSIWddQNtk/YYB+dLGBzFPlYcrsSutTIrT Vz2n02OZp75B/GxA8twk2lncvVN6qDF1L7B8/iw1IzSnBpTskR3xpJSni3nGWCbb S8+SP571oVf1tBvePW4xRpz/h+wH12EBdItP5sEnW/n/T7KQpme61SFAP/Jsr7bz p3nZFlc4YQlzQ3vMs6vAFKDUwItQ/XDi7so8QernH+EpBvVV/+WrPNbZNQG3gY+U kYo2tUBGnTzRwe5mO7lA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374920; x=1785979720; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=x33rKD5AJt14CHYPvmx76d8qJqPC6RXtU8ksUlr6PXc=; b=aKke9LhxG82i28+eefKmR7qrOtSoXvr4SBh5W1bW/68sMgJI6z6+xctn/2Zg9rxcT/ MRYQcSl2ui1o9MPS8ECenO1pJhg+SFAJmp4zNGg8Ena06dvUPSwnRziJJvF+4yMij3d6 sDOeWdnqygKyDPJJ5untayyonAt5aSkVPNoHI4MuP414yKOzOLFONn+kBJDHrWRPHvpO fmkXOcR/scYsbfO7WQf46tlaNGGrVxLa/0I6NJNXbpYrLTh3VKelx+OUfSSDC/uP14KC zZ1nr2nVnk9o3jmPGxCFotXoPMUnMO2G2hsfdv29PxPjsoIpCItrrHlvLXjn1aClAOid XIGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374920; x=1785979720; h=content-transfer-encoding:content-type:content-type: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 :content-type; bh=x33rKD5AJt14CHYPvmx76d8qJqPC6RXtU8ksUlr6PXc=; b=s6QVQUH94LM2qKaLAIGzJ18uVtUttXFH0pbbFf55+H2AVQg4Y1C3Sxxa1L6vvaAhT1 t77k8synAAfOh9FKUFkbUz2jop3pQfwDZGgh6ASk1aFClz+W0Pv9OvMzt3GRicv0fnPy AtxeAH8LR4Nlse4ccvtyjsK23ZwOPyI5SOvkLAbRfRCu3tYbd+fQRBjsdmgrjBi65S2k 7IyQ/mBc/apC8X9zIYHxCBYevoEgJwEz0kh3hyOFKb+MxSuwk0Ped+JFlZkF7sBP4NQB Sed9TLLLrjtXXVhBDtzNid/9wbZSnEXpI/guQ6uKTOXWWlpis/2ugERO6ZCWJsYz5EMt 31Gg== X-Gm-Message-State: AOJu0Yxb6ECrnlwIzSXKQeUr/SyMJmQlHs8fMann7W4phBhIeN/oMrIq JLU3uvUzTQRxUeygW8lIITGVkir2eYj4K1cU1d2uxqtqKbj9YrzIVmBOIYGZBEdNDYgpCcMjb6G PueDPfvFkdMbZAGRuKgNmL29VWA+f+QaEUilMSCuOFlLDMvNofj60pw2Gk6PYTC6p2g== X-Gm-Gg: AR+sD101fVjXOxJEvYY7cbTIskZYDz6nzWxbZ8L18v6wHRuRyrmZDrCE2c/MSb75js6 YS3uUi29+/2+Kq0t/SuHapyoI2bEUxkPTec6NwQ2DzExjFMHW4yJnsXECZ3kug5pDqOlXhIGG0n VNRcVuHnIVyqVo5GPi9kSBvQ3JDCX63KEDrSaMUNxOlO1yxVeTlgSU4noUbwW1O+bMrqQrjcnlO mhiOICIohh+kB2qnH/kqEucQrSaosnm58BJ0XXAgQJPa8pBGVU9PBd/4HkrC679SAwvODM6EhOE VIlHPulv12Aaei7U1tyM0+WhEaLNHhA48BS6fjMSOfs8YyhIqcakq/K/WYoERnf2iDGirVgY1NQ xrKAtdkeMnnTIrK86PU408PxBoBouhAtcu231q8RBjwVENWXm X-Received: by 2002:a05:6a21:6b10:b0:3bf:836e:876e with SMTP id adf61e73a8af0-3c9008adf74mr467322637.44.1785374920248; Wed, 29 Jul 2026 18:28:40 -0700 (PDT) X-Received: by 2002:a05:6a21:6b10:b0:3bf:836e:876e with SMTP id adf61e73a8af0-3c9008adf74mr467290637.44.1785374919827; Wed, 29 Jul 2026 18:28:39 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 10/18] hw/hexagon/virt: instantiate virtio-mmio transports Date: Wed, 29 Jul 2026 18:28:15 -0700 Message-Id: <20260730012824.1135905-11-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: b86mPo57uFJb8yN2pduHToPZ4XK_Jo_t X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX4si27H2YAx8A uTdB9DCIwmTWXDDqByx+7jcRn317HZZmNSZPDe2k6fgUNIwnWXJaY24iYCBWAovVUb7+/edPxg4 cIjCXKfENPJsgDkZdwx8w5S8CoHbyMo= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX8nZqMH2IGRk5 zxFbk6+MMJUVoRwm+MIg8j5NzQNQa1m3ytKrfAU0XKbiGCJXLvmBtVSxfyPSXXIeBjEuYvZvLOs ldGmwHoSwTRlVnFdcmLvBtLKrcFEd5kBEkOn1q4B/55NModFSZrREmJul1VZMT3DgRlOW2+TfaP 1H/pkjgC3Qlgftn0tiBUpQFS76TmgGpOW5j798Hs7YEKvjTq8poMaung1PIeGOx8SCJCXRETT/B 4Yq1rkXgO/KoYT65KQ3TIdUM0OJ+2nVm94P3RNZI2OagIg7NVnF6/0E85lCCFLJYJ1Mt+YSmyuS 1OymaFEphkLzKNsqkUtyP9kA63TY7oeBVZd4p267l90/XGkgP0GjDui8BuJRGxfPbieW9pCgwNq xYT+jc80bQOx3mA/YByLRzAdAxK0RGvutwI3LgQNREUcmdpuonHD+xyUUofxGhuAW7iowDbLFbD R6QCuhMwNRTbFF/oQ4A== X-Proofpoint-ORIG-GUID: b86mPo57uFJb8yN2pduHToPZ4XK_Jo_t X-Authority-Analysis: v=2.4 cv=WqAb99fv c=1 sm=1 tr=0 ts=6a6aa8c9 cx=c_pps a=rEQLjTOiSrHUhVqRoksmgQ==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=qfYuoNLC281KTBfHwCsA:9 a=QEXdDO2ut3YA:10 a=2VI0MkxyNR6bbpdq8BZq:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375048839158500 Content-Type: text/plain; charset="utf-8" Add a VIRT_MMIO region and virtio-mmio transports, wired into l2vic. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Brian Cain --- include/hw/hexagon/virt.h | 3 +++ hw/hexagon/virt.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/hw/hexagon/virt.h b/include/hw/hexagon/virt.h index cf0cd2f8f22..4ca2f1ef859 100644 --- a/include/hw/hexagon/virt.h +++ b/include/hw/hexagon/virt.h @@ -11,6 +11,8 @@ #include "hw/hexagon/hexagon.h" #include "target/hexagon/cpu.h" =20 +#define VIRTIO_DEV_COUNT 8 + struct HexagonVirtMachineState { HexagonCommonMachineState parent_obj; =20 @@ -19,6 +21,7 @@ struct HexagonVirtMachineState { MemoryRegion tcm; MemoryRegion bios; Clock *apb_clk; + DeviceState *virtio_mmio[VIRTIO_DEV_COUNT]; }; =20 void hexagon_load_fdt(const struct HexagonVirtMachineState *vms); diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index 9a680852c3c..ff0770cfc46 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -30,11 +30,19 @@ =20 enum { VIRT_UART0, + VIRT_MMIO, VIRT_FDT, }; =20 +/* + * Virtio IRQs run from VIRTIO_IRQ_BASE to + * VIRTIO_IRQ_BASE + VIRTIO_DEV_COUNT - 1 + */ +static const int VIRTIO_IRQ_BASE =3D 16; + static const MemMapEntry base_memmap[] =3D { [VIRT_UART0] =3D { 0x10000000, 0x00000200 }, + [VIRT_MMIO] =3D { 0x11000000, 0x00001000 }, [VIRT_FDT] =3D { 0x99800000, 0x00400000 }, }; =20 @@ -167,7 +175,25 @@ static void fdt_add_cpu_nodes(const HexagonVirtMachine= State *vms) } } =20 +static void create_virtio_devices(HexagonVirtMachineState *vms) +{ + hwaddr size =3D base_memmap[VIRT_MMIO].size; =20 + for (int i =3D 0; i < VIRTIO_DEV_COUNT; i++) { + int irq =3D VIRTIO_IRQ_BASE + i; + hwaddr base =3D base_memmap[VIRT_MMIO].base + i * size; + DeviceState *dev =3D qdev_new("virtio-mmio"); + SysBusDevice *s =3D SYS_BUS_DEVICE(dev); + + object_property_add_child(OBJECT(MACHINE(vms)), "virtio-mmio[*]", + OBJECT(dev)); + sysbus_realize_and_unref(s, &error_fatal); + sysbus_mmio_map(s, 0, base); + sysbus_connect_irq(s, 0, + qdev_get_gpio_in(vms->parent_obj.l2vic, irq)); + vms->virtio_mmio[i] =3D dev; + } +} =20 void hexagon_load_fdt(const HexagonVirtMachineState *vms) { @@ -246,6 +272,8 @@ static void virt_init(MachineState *ms) =20 fdt_add_hvx(vms, m_cfg); =20 + create_virtio_devices(vms); + g_autofree HexagonCPU **cpus =3D g_new(HexagonCPU *, ms->smp.cpus); =20 for (int i =3D 0; i < ms->smp.cpus; i++) { --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375065; cv=none; d=zohomail.com; s=zohoarc; b=a7VG5xWpLM/kX9sSgAwawpOkomRN5YVR6olUFtCju+/cTgJwohf1U2A9+t6N/grdNX2gOuBf615pA+/k1aB9X08Ea+kyVNy+omss4dvaC5kIlw6D0Bd2z83tRp6z+55MpN2IHYi6l8zzMeakFUa2G//IY4Lj+02coFrJM7ijZJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375065; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=npg4+DCIh4VnJXD0MHu/y/UcQjF1MhMogiRWdPyQzlM=; b=Qy6MSq0vnMlGjIcew7STz1B5aVR/5PPcrFp0U/K+uWdXXthkJWnddpLt64GqwEhQYYHPP5dQ9x5VL8YpAc9032C2/BMJYnPF1mEExWMgmHJCVzUm4RO71DAh+CO56Nvqmbo3H0T2lOVECkFJuOp3+qhNtKfuoUQNCoE5FN4EOfU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17853750650529.252439016221956; Wed, 29 Jul 2026 18:31:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZn-0005i8-0O; Wed, 29 Jul 2026 21:28:47 -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 1wpFZl-0005ha-3n for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:45 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZj-0005b6-ES for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:44 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1NiHS3460224 for ; Thu, 30 Jul 2026 01:28:42 GMT Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvwpg0f8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:41 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2cfbf3e4a63so43584785ad.0 for ; Wed, 29 Jul 2026 18:28:41 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= npg4+DCIh4VnJXD0MHu/y/UcQjF1MhMogiRWdPyQzlM=; b=InMEhlacDhZ41RC+ e+1PhWPvdaxqHCR+biV7L5ye8P7z2JszcGY6hLY7uZBezLembAfAQxXzi/ZUtfn1 0WO9edPafsTpSwjCpDyCwtv0+OsE6Baw55uhVrxlMEeIOrEbjFTwvjzU/y2J2kHA 6b30biZsZWW4QB5pMPJGCGJSzf24k+iAgnmhv47W/ioD+0T0xyNo4ydOn/idp17d T7AOOITglzQb6u/ydJZwBoQFH2jjGknjBsL0WuS0xZFrnmgQ+JOx7VZ4DVauas3h NorPqD8ZLS24WDnqT0KE7EVOXb+j1flAnNKiw8TUPuZrgzZ2TXsW0LmO67a9tpA4 xY+Nfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374921; x=1785979721; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=npg4+DCIh4VnJXD0MHu/y/UcQjF1MhMogiRWdPyQzlM=; b=aH6mXzTzBU44L9FXv+Ee+J5txkIAdLQjI3rP87PVTIl7cSJpx50c/ZePXT4lObknoX tbf7a6azdDRfHUIqt1Uk7h1xCPgtIVn60ASPSKJOSbbvUwIoCUwf89EDRRB6qEp3Oyol hWacPA53gqLgJY9U28EfVSFFQWIOsBGTino97HemmxcGC+HwK0Wuzh2n8HsT9j8nckuz Uot7VTuRKb+a8sJnXUA6s2Hr7vNXPqc2BHfkIrh/2CeSWLDA/OHvbBLS+WFCSrJC3wtQ FKDcvy/bYHNoo6suqVbvXmRAibQzo5agP/DOoNMVi0fOgu9Aw5kpjj3Xtfa2K6qNaI+d 3JZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374921; x=1785979721; h=content-transfer-encoding:content-type: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 :content-type; bh=npg4+DCIh4VnJXD0MHu/y/UcQjF1MhMogiRWdPyQzlM=; b=b6y2GxXCZOdkhKgGkzj5NANGs1ZUOZwOSfh2uSqFuXQP1ja266bSY1CyO+EnUcnFLp IvSLbgS5jlErkeu0/C6cDHQ7v+8hcEoexpxvd/rVYHMvT+vcGHhigTz6Apv+vdf5zpEA hb1OSFswv217bLY4t+iDG/8P3j3C1yxNjpqibs3i3BI6WIzKK4MtvGuNrhoSS/j3QtZa BiixpIZrF8nvOp8+W+9EpMZHAxKuM6kN6sbPFknXSiO5ZvDCf+fR5A2EAlao119mSnZ/ 2Xv4tqN8FdYVFFEx27nW2jthLOERfFR96XTkWLX+JRQwdGSieRY2zENV+x822RHkxSlw a3Rg== X-Gm-Message-State: AOJu0YwHwxibNngO//lca3ftbxpI1GHOQdtKcC19/FXh8dskLvFeKqsF RoOL3sKxW9wMM+x5u/DeNU3RYEIgIV4XVkgG0EEvsbUL+BZuV0UPXUalvhWWdPT+BJ+jjuSM7W8 rGPUUbuRMmCJJIYHH/glg5RJTIXx1yqJHHJ7lyZWBBrBm/1YbpP2+L5GazrYsYvyWgw== X-Gm-Gg: AR+sD12Cq25RUf07ZTAXfw+7F+d6qTyQb7S93pQ7d2eVNkKaqMb0V/p4mv5sh9NoWaI G6irsiVRDCYFnj5pdTP1Dm8xGP6/fyUYYWCszfd2Qf+y6r9UkRfUS2m3c5egApUK50Ih8Knds+p wKjmWMjjZMgT9mekL+Au+zxxQSyNjCMUrydVj3XvBZmzsUMkyCCvEjXEAezUdKKu1DVTW1vb7Mj kH3k6a/GKwRVd8IvC0OWFv93g/Juqp850deRl8YFO2IGmsdSuk8k7TJZbefY8hT4aHzjazuYtTl 6ye1xGGqsxHajRyifO9qhc/OwTJM+03bKNTlDXCHDXcEi+ILS4pv4Ndwrv8/C3Mz4vMcYvOPW3m 2gCkXVeN97Bb/OZqMmP/qc6BCC3QIaXnURrIvjiDQUIQ/Nx+C X-Received: by 2002:a05:6a21:3392:b0:3c3:64cb:9b99 with SMTP id adf61e73a8af0-3c9004a080amr592346637.6.1785374921470; Wed, 29 Jul 2026 18:28:41 -0700 (PDT) X-Received: by 2002:a05:6a21:3392:b0:3c3:64cb:9b99 with SMTP id adf61e73a8af0-3c9004a080amr592328637.6.1785374921102; Wed, 29 Jul 2026 18:28:41 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 11/18] hw/hexagon/virt: add l2vic interrupt-controller and virtio-mmio FDT nodes Date: Wed, 29 Jul 2026 18:28:16 -0700 Message-Id: <20260730012824.1135905-12-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: w7pG87j8ljFXWGb23KCGScnY7rpAMiUd X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX4m82TgmkGrnS 7Zua4VLoMWolEiOIB+gl9/xfKmedCE9fXaXEjXPPwZtBJiZfPHT3B45LRb8PoS7pasG7PabfeGA QAosjJxhg1V3zgqeAhym7PxH4ZNY9NY= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfXxlIgznMjQIOL jOSKYN4cvQyuy/gXmIpBVNQSFwpX0MDkkLpytzCxht/sZRCGGhc7s3RcCNpeP2G4m4GYyvZrMkI CRUGCYY5kQ8/4lohaEf8KW+KxTQx8XVNH2lp0RZ64Ng2S2H6E5tq7DbEUyz3uET2b3Qk1so1ELV gpl2JEo8421qyjjsQMCTtccLqLtjMVT9qSURdlTZEjJmsaPU3nmlwASYhL1baf0PNrlV96yzv9E VYfrS4Hhr/wXMnssqcqH2JoXzs9rP79zRd5O2p1LO8wiQ+aaRfF7sbLEY30YZK6d4SW0XYsHJAA 6uCXOcPtwZqrVlzX/DxL05/oIFaK4nwBYXvEBb1uXWwrbLnItjAPDHYiIDutkesOFhLPreA2guT Ts+2GOUWzUi/JGi7oTNj+DLPtYJs+jSZyAFx9o9IEVigN0+S9zv2FkY841WnN30w9vPF7RfUb3d oKFX7ELISM7yEX7Jcog== X-Proofpoint-ORIG-GUID: w7pG87j8ljFXWGb23KCGScnY7rpAMiUd X-Authority-Analysis: v=2.4 cv=WqAb99fv c=1 sm=1 tr=0 ts=6a6aa8ca cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=a15GVhKgg4D0RywPxTcA:9 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375066960158500 Expose l2vic as a device-tree interrupt-controller node and reference it via interrupt-parent, so guest kernels can discover the virtio-mmio transports. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- hw/hexagon/virt.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index ff0770cfc46..ea20ea3c50a 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -75,6 +75,30 @@ static void create_fdt(HexagonVirtMachineState *vms) qemu_fdt_setprop(fdt, "/chosen", "rng-seed", rng_seed, sizeof(rng_seed= )); } =20 +static int32_t fdt_add_l2vic(HexagonVirtMachineState *vms, + const struct hexagon_machine_config *m_cfg) +{ + MachineState *ms =3D MACHINE(vms); + int32_t l2vic_phandle =3D qemu_fdt_alloc_phandle(ms->fdt); + char *nodename =3D g_strdup_printf("/soc/interrupt-controller@%x", + m_cfg->l2vic_base); + const char compat[] =3D "qcom,h2-pic\0hvm-pic"; + + qemu_fdt_setprop_cell(ms->fdt, "/soc", "interrupt-parent", l2vic_phand= le); + + qemu_fdt_add_subnode(ms->fdt, nodename); + qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 0x0); + qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 0x1); + qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compa= t)); + qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, + m_cfg->l2vic_base, m_cfg->l2vic_size); + qemu_fdt_setprop(ms->fdt, nodename, "interrupt-controller", NULL, 0); + qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", l2vic_phandle); + + g_free(nodename); + return l2vic_phandle; +} + static void fdt_add_hvx(HexagonVirtMachineState *vms, const struct hexagon_machine_config *m_cfg) { @@ -175,13 +199,16 @@ static void fdt_add_cpu_nodes(const HexagonVirtMachin= eState *vms) } } =20 -static void create_virtio_devices(HexagonVirtMachineState *vms) +static void create_virtio_devices(HexagonVirtMachineState *vms, + int32_t l2vic_phandle) { + MachineState *ms =3D MACHINE(vms); hwaddr size =3D base_memmap[VIRT_MMIO].size; =20 for (int i =3D 0; i < VIRTIO_DEV_COUNT; i++) { int irq =3D VIRTIO_IRQ_BASE + i; hwaddr base =3D base_memmap[VIRT_MMIO].base + i * size; + char *nodename =3D g_strdup_printf("/soc/virtio_mmio@%" PRIx64, ba= se); DeviceState *dev =3D qdev_new("virtio-mmio"); SysBusDevice *s =3D SYS_BUS_DEVICE(dev); =20 @@ -192,6 +219,16 @@ static void create_virtio_devices(HexagonVirtMachineSt= ate *vms) sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->parent_obj.l2vic, irq)); vms->virtio_mmio[i] =3D dev; + + qemu_fdt_add_subnode(ms->fdt, nodename); + qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", + "virtio,mmio"); + qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, base, size); + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupts", irq); + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent", + l2vic_phandle); + + g_free(nodename); } } =20 @@ -251,6 +288,7 @@ static void virt_init(MachineState *ms) HexagonVirtMachineState *vms =3D HEXAGON_VIRT_MACHINE(ms); const struct hexagon_machine_config *m_cfg =3D &v68n_1024; int32_t clk_phandle; + int32_t l2vic_phandle; =20 create_fdt(vms); qemu_fdt_setprop_string(ms->fdt, "/chosen", "bootargs", ms->kernel_cmd= line); @@ -272,7 +310,8 @@ static void virt_init(MachineState *ms) =20 fdt_add_hvx(vms, m_cfg); =20 - create_virtio_devices(vms); + l2vic_phandle =3D fdt_add_l2vic(vms, m_cfg); + create_virtio_devices(vms, l2vic_phandle); =20 g_autofree HexagonCPU **cpus =3D g_new(HexagonCPU *, ms->smp.cpus); =20 --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375006; cv=none; d=zohomail.com; s=zohoarc; b=fxpAFJlg5gpE9yyHkx2ZNSmDDtss6HGYSl5OrH5y4R+DspGK4TyYkZkCI008zqZ1emn/BF2MdmGGJnnty6XvJByCkVLwalZZyJncvh0+nK4jkaKcImw8dWiWcBIbBdJvegmOlFGoVx1Djkzc5XopTuknotWHGq2mUYltoIGdOSo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375006; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=z+6qeAlJOKKWo1FncvQKP0fGn79PFWfQcGh4oQBRHxU=; b=AoJt08fyHTkTgwIZmi6+16kzzdXq8hg/AogZ7ZOynbq5Rz2IjT4IJQLUTciv+U+Q68dbeYcS8+1mvL55UVpVf4EwwpLVuvJXYAK/tA85ZOqFxqN/FPBYC6+Dx+hFUozVFfjk3t2KAL7RgBMuv5kTBSxlga9yr1LF+XojOtpeTwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375006089424.454805979719; Wed, 29 Jul 2026 18:30:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZn-0005iW-VJ; Wed, 29 Jul 2026 21:28:47 -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 1wpFZm-0005i4-QZ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:46 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZl-0005bI-9C for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:46 -0400 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1GhUU3699494 for ; Thu, 30 Jul 2026 01:28:44 GMT Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvte816s-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:43 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cbb467e56aaso2048499a12.1 for ; Wed, 29 Jul 2026 18:28:43 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= qcppdkim1; bh=z+6qeAlJOKKWo1FncvQKP0fGn79PFWfQcGh4oQBRHxU=; b=Vq qVqAeyzAuuB8CgWG/eYlLsRgWg0k/1SOAfGL8uG0AFMXA7+lQGuBq1OUwqVU2yMV hMRw2HxW2OXUa0r751HOFk1EypfbvOim37uv12pI+QbIs6m8p59g9RxqM9K75rdo johcmKPHkiCOWTaP36jf34xtoDR3Yi/aDmSELjwCHKTcHnhCi1A0flqM33+1jTKh YxTWvNDH7HDKbYfZhQ2NUDnaWB14oiE3HkwIYC2/iIM5ZydTEsYE15/SaVemjluP YBKzF4RQ2XGnXabiZfmgk9xZJ2rNTYs5tp0rxr933mrLiYHj625LIaukbRtZ+CHf n7f2k8g5FvTkWEGf32GQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374923; x=1785979723; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=z+6qeAlJOKKWo1FncvQKP0fGn79PFWfQcGh4oQBRHxU=; b=XRJswpR/xrZlSel6W2b+H2HIZLJp9l05AtanGuR0wSp+GI3ry506uD143nEUwAvOcs Ey8V9F9k3h8uhZ1mLe6ugNGRC/aeR+AnBXECuJIUtAJHbBxs9aBsw4ts3461HYpjpT1L Mc0IWDfGfTqt8VwP6pZnAqXeAXdnJ0cgOqZ/HzkBwaZK+mMrt+N/gH7308CFwaMeP1JX 2/zQNyZqByViLW6SPekwYJX4GaFtbxQaGpxZaNwJr1dCyB09VjUtRhxLJysGJwnVPxvO Q3SIILq70cHMv9MBKHKRjPZDBrfQ9rgSYUZ+MXx89rGzzZzCXFDVR8sedu3C64anKayC 5Trg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374923; x=1785979723; h=content-transfer-encoding:content-type:content-type: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 :content-type; bh=z+6qeAlJOKKWo1FncvQKP0fGn79PFWfQcGh4oQBRHxU=; b=BE31DLRjGHDOVh+Ue3FlWQR+ViCouzpYTqKY2CrAoy79r9315D0jO2Hnqxup0+yTEi opkGort6kbQ2JGpzC7CTZRU2HEP1QDk+fdH7wq0fbubJ3nf5are5R9q9xd6NKEHmxDfo wHCX13b3fNOmjR9y94INyELtTbOQmEbUT6Hk4ElPbJXfCVZOTRYdqwO9aYyhRalkXPPY LVzcK6gtiZJiOPlpazaSwyoBuO0C3HtVFYSV2rzfv4vSbfdwbYwOqup/koJcsnsB3Ti8 bkB5md3iirxpCzi9g5YAuFOiRaus5nQS15hMs+X5DWeFYESAYK7kGOh9iy5jxFsn8FL5 oNaQ== X-Gm-Message-State: AOJu0YxGBRcO0Wg2+BQiequhtPJ0eKR5S1DHbLDtkfkcgUZBHk25+sjI 5k8maLBZc0YB0OCSOZnSKvaT78BeWrrEC1YvFWgYj/nvqyVI38sut3TBlWBmA2VOfEdudg9Dg5Z +utecSCGca1MCDOPRxH1LXwrrdhvz84ET1DMsSpfXzyUGFYzyRAve3pBI0xFFaQ584A== X-Gm-Gg: AR+sD10wqfV1PFB0FTZ3fPr3xe75ORJ2YhAdHaIL0NXKc9FFZMs5TO5cLPhE6+RFnZA grr5d2c8/y3VrvFnTOrwD1JEs9SbNiW/6uB19+9HVHDwhipPpiO6/Q5jMErsZTfJLY5fg6Q/fpL 87ZMYId2P+tDUDchWLqNZ0A88/UPstLqltv87H3Hqwc2VexEUoU68tQgWSnDjBENwh/++iGxchf xtyG7Z5P2KAFxBKLaGGsg8P0K0XQ+6DR3Iirdtnqey4YESfQucNeVbiRmDtQLtXRl2RtkxXbZbD /UUwxPFFHjHwAVG2oX2gwC32kGOj2ELx9KgcxvMhMQAEgwTH3j6tcJOvQbiRLsEQUe6zesOw+LG JRyzz1mzsU2ylKIUWMT8d12/eXeSNMry+dcXRHM6R5cnTurWC X-Received: by 2002:a05:6a20:7fa3:b0:3bf:6011:53b with SMTP id adf61e73a8af0-3c9007ef3famr435940637.38.1785374923256; Wed, 29 Jul 2026 18:28:43 -0700 (PDT) X-Received: by 2002:a05:6a20:7fa3:b0:3bf:6011:53b with SMTP id adf61e73a8af0-3c9007ef3famr435914637.38.1785374922804; Wed, 29 Jul 2026 18:28:42 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 12/18] hw/hexagon/virt: connect pl011 UART interrupt Date: Wed, 29 Jul 2026 18:28:17 -0700 Message-Id: <20260730012824.1135905-13-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: OqyAhKzBGumNqu43VmVPRpINcfuFfqFp X-Proofpoint-ORIG-GUID: OqyAhKzBGumNqu43VmVPRpINcfuFfqFp X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX4EXYQp9e+TO1 FAhlnmpYg2oi001hggDfQcenfBZW4JIUg60VfqGhRyH1BZYzb/JlgewowfTf5ehZ8S+PRk56pMD ql+NYZHbhwItfBeHEI1kb1KcXhm5ZRc= X-Authority-Analysis: v=2.4 cv=Tr3WQjXh c=1 sm=1 tr=0 ts=6a6aa8cb cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=EUspDBNiAAAA:8 a=Z4HElfRGeH4uGo3IGfcA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX4Xgy10zOOviV bcDdSID2hh8HYJRAxgQ/TC81ayGnX8/FHbcN+rLuYdXaQufdz/S1AFyAOBMTy835YiQN1iVhbpZ +4dyQSWkol8D3Poilloy4Gw5gjtn8fqKjvBqD8ZeSjgeKf0og/452vD8nGem3XiRtxMJhDOM1fj SIr7ah5g9HaUl+D1BpXuR7NSYH80cxaCjP5oW+g3DdDEg+LPVbO+0XZ8YoqZaIY3DlrAwDDa03C nefEC/D7cSFfNZj9TeIDwlI4M8ryZQl4KXhJU4R3qxNTF4eEpZ8RIYmddamIPobhtM6/vadSDDV WMI1/nrsXY76UK/JV6o10SDJDicxVWWaCR81BoVDcuqiILJSTrPNSjWUj37lgif28P+WpD+E2vo u3b8qp2kPzaEvz6J0yGt/ctamTv7WG5U4Xh23i07RCBVYt1JxiY79y84pRWZIAAee5kBPLxxmSY st2QlwWj7wMf4enikSA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375006713158500 Content-Type: text/plain; charset="utf-8" Wire pl011's sysbus IRQ into l2vic at IRQ 15. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Brian Cain --- hw/hexagon/virt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index ea20ea3c50a..64d8366d27d 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -39,6 +39,7 @@ enum { * VIRTIO_IRQ_BASE + VIRTIO_DEV_COUNT - 1 */ static const int VIRTIO_IRQ_BASE =3D 16; +static const int VIRT_UART0_IRQ =3D 15; =20 static const MemMapEntry base_memmap[] =3D { [VIRT_UART0] =3D { 0x10000000, 0x00000200 }, @@ -143,7 +144,7 @@ static int32_t fdt_add_clocks(const HexagonVirtMachineS= tate *vms) } =20 static void fdt_add_uart(const HexagonVirtMachineState *vms, int uart, - int32_t clk_phandle) + int32_t clk_phandle, int32_t l2vic_phandle) { char *nodename; hwaddr base =3D base_memmap[uart].base; @@ -161,6 +162,8 @@ static void fdt_add_uart(const HexagonVirtMachineState = *vms, int uart, qdev_connect_clock_in(dev, "clk", vms->apb_clk); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, base); + sysbus_connect_irq(s, 0, + qdev_get_gpio_in(vms->parent_obj.l2vic, VIRT_UART0_= IRQ)); =20 nodename =3D g_strdup_printf("/pl011@%" PRIx64, base); qemu_fdt_add_subnode(ms->fdt, nodename); @@ -168,6 +171,9 @@ static void fdt_add_uart(const HexagonVirtMachineState = *vms, int uart, /* Note that we can't use setprop_string because of the embedded NUL */ qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compa= t)); qemu_fdt_setprop_cells(ms->fdt, nodename, "reg", 0, base, size); + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupts", VIRT_UART0_IRQ); + qemu_fdt_setprop_cell(ms->fdt, nodename, "interrupt-parent", + l2vic_phandle); qemu_fdt_setprop_cells(ms->fdt, nodename, "clocks", clk_phandle, clk_phandle); qemu_fdt_setprop(ms->fdt, nodename, "clock-names", clocknames, @@ -342,7 +348,7 @@ static void virt_init(MachineState *ms) =20 fdt_add_cpu_nodes(vms); clk_phandle =3D fdt_add_clocks(vms); - fdt_add_uart(vms, VIRT_UART0, clk_phandle); + fdt_add_uart(vms, VIRT_UART0, clk_phandle, l2vic_phandle); =20 hexagon_load_fdt(vms); } --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374958; cv=none; d=zohomail.com; s=zohoarc; b=jJGqPRyPba1ovk8TF/WxeCiarUtNOsmwvOyfq+op8sVHgxuhGGP7eBssfUo+TemvX6mVopLuU5cxMIT80HLtIKRRzHt8KIqJjqNm5wjeGgc/BpYWtZrfROJiPpyqO/n6LrVpCS8Gl2X51IZJFaFydmsKLRHn0GEthmzYryjZsp0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374958; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fJTK2evOo2iQUTCSiuthegrtxdiKOId8fEUoWYmziQY=; b=EcdeY8TjL87Nmr1sCVpownEd38US/ZL2+UWjvaITW2KyH0CPVojFcrWQ5nTLj5CfC9YaurWPwsnbaCP8yD9HHETJYD9BAv46rM7BwBaX6pvYAB8EsB7lqfSBrgbdEEWla9/bUizAc5WCvYdAPxJUJEJwy/vOZLvNW0jfwFqG9NE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374958026623.7616079868275; Wed, 29 Jul 2026 18:29:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZq-0005jT-PZ; Wed, 29 Jul 2026 21:28:50 -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 1wpFZp-0005j4-4x for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:49 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZm-0005bW-V3 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:48 -0400 Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1Nj7i3460326 for ; Thu, 30 Jul 2026 01:28:45 GMT Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvwpg0fe-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:45 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c860544c077so3377836a12.3 for ; Wed, 29 Jul 2026 18:28:45 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= fJTK2evOo2iQUTCSiuthegrtxdiKOId8fEUoWYmziQY=; b=ZUb/jvGDIzJiABNl 8Tg4HoxBWEOuwuoYonawkd0fxQ71x+cORyEnKhw5/0uOAW1CimgpGXzRIIsNoXEb eNKBJSbdtJr2mh0LOiUR0PSAJAHZF/6TVMAvnzBV9+ZnQnW7wbED29O1pjAHVgE7 igkE4TYntxqXoPd8d28q6jAYu61hH9GsU66Qa8pehVuW4+bX2GYm+KoxDimJVznn 7KgvQlT5PCrSbJ1CduZZeLauVDh7hExiLLRuIzvWw975mI4OD+JTg/FjnAg+WmsX gpgqN0iEQOAA9QxDp4o3OWcJg2nQy0oHXUx9vnRuBzTFUJlw2av3eAY18uwwNkp7 KKsE6A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374924; x=1785979724; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=fJTK2evOo2iQUTCSiuthegrtxdiKOId8fEUoWYmziQY=; b=fdBTM3V7dw+qOlDXg2FDKRsa/6Ac/1BfVJPuqLDUqy29Y0CQE3e9/qCgLGIf6gEHQE Cv5IsRlHvRGEXG6UzaDE/y93D1Pvu20SAV7F01qPfoGk8/5W9+HaC8Th1ICnAO12ZUDu jjpp+vMWo1qPriuErUoD9u3bGKyBwIEfdOxi7h5JkE90hyZvK1O6n1uHDahgYKtJ16/T UNd+I30FNh1hDpbtyzoYwtgGrXVnQAQiynXRB7fJNYO2JW4pqOCu6YCpVgzPW3dnIsX0 0swvEWA6TDW5mMNGXCuX9fiO/3pvtL76BLanM+ev4TSsN18ITjzugvAe9QzV5tl2fQwL C/0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374924; x=1785979724; h=content-transfer-encoding:content-type: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 :content-type; bh=fJTK2evOo2iQUTCSiuthegrtxdiKOId8fEUoWYmziQY=; b=U3WYKKbKwNZS7qbsUV01soZuDspVq64oTrQHGLy1Xu5hTw0FqEdlVkHj5Z3fHoOKpm PA5xW6MySLpMOP0d6210ZtneosKFuengtMtyplXNEwkglRQUqXwQspKrAKTxAY91UmMq Num48TYzEyaPhOKmboXsjWSwkdUynMe1V9QyzIK4MNfOa7YoIvbdNKQFGjOUN1cbFTfs bci3BWU7xEFzTfo7TSoEO8br4Nh937D9RkUx/75ABRrhWLbpahSUdbVqK7HLFQ2b+Nzz Jn5bBeeHnbnEeCahtx/cND/2bzmgzKBOs9Ov3lrU3E+/pttgmWY77hXeeMrGAVXL2RF9 Ej5w== X-Gm-Message-State: AOJu0YwGN4ss7q0dJtA7x4UVeLe2h5Ygd6+J3N//IrOO4SfeSnHvEb+V Mtq03vfivf+vTOVeIcIpBp8AlutfhVz0oQFC6L4gTyoBkPOhXaSLkQYzdqwiOfz3DM6p4+LreFD 660tOqIW3H5VSog3m6kF/Mhbim4hm29pYyOmStgJtf1FPdf9N1jw0kfOpFzTfr5TlgQ== X-Gm-Gg: AR+sD12foLbuUR/DyrfhwSYbKhoyDfX2J0njceiFKRHftGLszvaYW1fYo4vH/oGyVXk EJHzFxFBLEk+V1TrzlAxD3OhQmayQi9IOyFtdqvMbpdi/9kyx3KfcxtpSFduErXomJzjQ3MC3q0 DP72+p0W7WpIY3gMNQ0uqU3TegBDaDVpLqxa63j4yq0a920TkVaZXanih2ddFszbcursintp9cd 28gIdRSnJxqjSR8f/zyMf4kioOi4bX1QyM3QwWP7ZKGnLSPkB/tMdiwPQp/r5F4Za3LMhrIBIth 3lIttu5iq4L7PffYUBAY0k1e3h5EKX0eHxpRj7/GvSIsHyjT2isZrZkUc6LgR0I6qdiZ3s4pQQ+ OFxqshF7Mqc0mkjbMrRLDek73vkWl8YWlfYrw8sKKR20djmEg X-Received: by 2002:a05:6a20:430c:b0:3c6:55f5:2bc9 with SMTP id adf61e73a8af0-3c90066d554mr387075637.49.1785374924419; Wed, 29 Jul 2026 18:28:44 -0700 (PDT) X-Received: by 2002:a05:6a20:430c:b0:3c6:55f5:2bc9 with SMTP id adf61e73a8af0-3c90066d554mr387055637.49.1785374923942; Wed, 29 Jul 2026 18:28:43 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 13/18] tests/qtest: add L2VIC qtest Date: Wed, 29 Jul 2026 18:28:18 -0700 Message-Id: <20260730012824.1135905-14-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: gfBwafwKIES3lCB8pFYK0AJS5aVlqxr- X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX3u7W7k07/uAS xD/btXy4/mqXuiYRk+GTXd7ZOgjLqUJ/uR4078BymIERNjQ7jIJslGa31uks8IP5dUl2hFF+f6Z ke2TrPS6lt0D+Rk0hHj0R66/+JHKPIg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX8aFosxLZghgY pvvcDSXcemLWARftVv8Sdcpo6z0eJHM6DwQVsn8iz0BhmTgYTqgW7w/u3kg5rT4Pfz/gYJcTUTz fvqVgs4oE7vMJEKtfMIWH5EPoB5YIpxknCtn5gHhwo3Xl2encyknd08VPZer2mP9ezszsPF0qTR T1Dvyr5yepTq5rBR+Vc3IdvB+g9BjB6hevCJxjxTvNWrCFOCKnmJm5LVQDbAcVlCTXMgAmAPrDF DuSZjgfNTul7uxY3udzDtzkR4afRlEVuljkkAbS/SWpyvbN5tCJH4ppLtEb/lInOUOzHgRV2m92 lERsT+T9XCm4bpDPrECXLM729b2ZUrfEaCngEdERj6kZT+/nr2y9tC1falHYMlBt28EK0y8KlQ1 OW/sKu+dLhKFd8ymVFVeCIzSMfYYzJC5N2nqE9HnmMsSY9VpXUayFfO04x5TdIFBo8zcPckJ+yq uV9+j3sCIMNJoxobAGA== X-Proofpoint-ORIG-GUID: gfBwafwKIES3lCB8pFYK0AJS5aVlqxr- X-Authority-Analysis: v=2.4 cv=WqAb99fv c=1 sm=1 tr=0 ts=6a6aa8cd cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=EUspDBNiAAAA:8 a=7KM7d0xASNUEeJCx_1UA:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 bulkscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374958637158500 Add a qtest exercising L2VIC register access and interrupt enable/disable. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- MAINTAINERS | 1 + tests/qtest/l2vic-test.c | 249 +++++++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 +- 3 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/l2vic-test.c diff --git a/MAINTAINERS b/MAINTAINERS index a76366d6da5..114bbec45ad 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -252,6 +252,7 @@ S: Supported F: target/hexagon/ F: hw/intc/hex-l2vic.c F: include/hw/intc/hex-l2vic.h +F: tests/qtest/l2vic-test.c X: target/hexagon/idef-parser/ X: target/hexagon/gen_idef_parser_funcs.py F: linux-user/hexagon/ diff --git a/tests/qtest/l2vic-test.c b/tests/qtest/l2vic-test.c new file mode 100644 index 00000000000..adb4dc7281e --- /dev/null +++ b/tests/qtest/l2vic-test.c @@ -0,0 +1,249 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + * + * QTest testcase for the L2VIC Interrupt Controller + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" +#include "hw/hexagon/hexagon.h" + +#include "hw/hexagon/machine_cfg_v66g_1024.h.inc" +#include "hw/hexagon/machine_cfg_v68n_1024.h.inc" + +/* L2VIC register offsets exercised by this test */ +#define L2VIC_INT_ENABLEn 0x100 /* Read/Write */ +#define L2VIC_INT_ENABLE_CLEARn 0x180 /* Write */ +#define L2VIC_INT_ENABLE_SETn 0x200 /* Write */ +#define L2VIC_INT_TYPEn 0x280 /* Read/Write */ +#define L2VIC_INT_STATUSn 0x380 /* Read */ +#define L2VIC_INT_CLEARn 0x400 /* Write */ +#define L2VIC_SOFT_INTn 0x480 /* Write */ +#define L2VIC_INT_PENDINGn 0x500 /* Read */ +#define L2VIC_INT_GRPn_0 0x600 /* Read/Write */ +#define L2VIC_INT_GRPn_1 0x680 /* Read/Write */ +#define L2VIC_INT_GRPn_2 0x700 /* Read/Write */ +#define L2VIC_INT_GRPn_3 0x780 /* Read/Write */ + +/* + * VID group readback: records which irq last fired through each VID + * group. Outputs themselves are momentary pulses (see l2vic_update()), + * so these registers -- not the qtest IRQ level snapshot -- are how the + * test observes VID steering. + */ +#define L2VIC_VID_GRP_0 0x0 +#define L2VIC_VID_GRP_1 0x4 +#define L2VIC_VID_GRP_2 0x8 +#define L2VIC_VID_GRP_3 0xC + +typedef struct { + const char *machine; + const struct hexagon_machine_config *cfg; +} L2VICMachineCfg; + +static const L2VICMachineCfg l2vic_machines[] =3D { + { "virt", &v68n_1024 }, + { "V66G_1024", &v66g_1024 }, +}; + +static uint32_t l2vic_read32(uint64_t base, uint32_t offset) +{ + return readl(base + offset); +} + +static void l2vic_write32(uint64_t base, uint32_t offset, uint32_t value) +{ + writel(base + offset, value); +} + +static void test_l2vic_register_access(uint64_t base) +{ + uint32_t val; + + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x1); + val =3D l2vic_read32(base, L2VIC_INT_ENABLEn); + g_assert_cmpuint(val & 0x1, =3D=3D, 0x1); + + l2vic_write32(base, L2VIC_INT_ENABLE_CLEARn, 0x1); + val =3D l2vic_read32(base, L2VIC_INT_ENABLEn); + g_assert_cmpuint(val & 0x1, =3D=3D, 0x0); +} + +static void test_l2vic_interrupt_enable(uint64_t base) +{ + uint32_t val; + + val =3D l2vic_read32(base, L2VIC_INT_ENABLEn); + g_assert_cmpuint(val, =3D=3D, 0); + + /* Enable IRQ 0 and 2 */ + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x5); + val =3D l2vic_read32(base, L2VIC_INT_ENABLEn); + g_assert_cmpuint(val & 0x5, =3D=3D, 0x5); + + /* Disable IRQ 0, leaving IRQ 2 enabled */ + l2vic_write32(base, L2VIC_INT_ENABLE_CLEARn, 0x1); + val =3D l2vic_read32(base, L2VIC_INT_ENABLEn); + g_assert_cmpuint(val & 0x1, =3D=3D, 0x0); + g_assert_cmpuint(val & 0x4, =3D=3D, 0x4); +} + +static void test_l2vic_basic_functionality(uint64_t base) +{ + l2vic_read32(base, L2VIC_INT_ENABLEn); + l2vic_read32(base, L2VIC_INT_PENDINGn); + l2vic_read32(base, L2VIC_INT_STATUSn); + l2vic_read32(base, L2VIC_INT_TYPEn); + + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0); + l2vic_write32(base, L2VIC_INT_ENABLE_CLEARn, 0); +} + +/* + * IRQs 0-7 pack their group-enable/VID-select nibbles into + * L2VIC_INT_GRPn_0 (int_group_n[0]), 4 bits per irq: bit 3 enables + * VID steering, bits 0-2 select the VID group (0-3), which pulses + * output line vid+2. + */ +static void l2vic_set_vid_group(uint64_t base, int irq, int vid) +{ + uint32_t val =3D l2vic_read32(base, L2VIC_INT_GRPn_0); + uint32_t nibble =3D 0x8 | (vid & 0x7); + + val &=3D ~(0xFu << (irq * 4)); + val |=3D nibble << (irq * 4); + l2vic_write32(base, L2VIC_INT_GRPn_0, val); +} + +static void test_l2vic_irq_outputs(uint64_t base) +{ + uint32_t val; + + l2vic_write32(base, L2VIC_INT_ENABLE_CLEARn, 0xFFFFFFFF); + l2vic_write32(base, L2VIC_INT_CLEARn, 0xFFFFFFFF); + l2vic_write32(base, L2VIC_INT_TYPEn, 0); + l2vic_write32(base, L2VIC_INT_GRPn_0, 0); + + /* Group 0 / IRQ2: soft interrupts require edge-triggered config */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x1); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x1); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x1); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x1, =3D=3D, 0x1); + /* Default VID group (0) records the delivering irq, output line 2 */ + g_assert_cmpuint(l2vic_read32(base, L2VIC_VID_GRP_0), =3D=3D, 0); + + l2vic_write32(base, L2VIC_INT_CLEARn, 0x1); + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x1, =3D=3D, 0x0); + + /* IRQ1 steered to VID group 1 -> output line 3 */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x2); + l2vic_set_vid_group(base, 1, 1); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x2); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x2); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x2, =3D=3D, 0x2); + g_assert_cmpuint(l2vic_read32(base, L2VIC_VID_GRP_1), =3D=3D, 1); + + l2vic_write32(base, L2VIC_INT_CLEARn, 0x2); + + /* IRQ4 steered to VID group 2 -> output line 4 */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x10); + l2vic_set_vid_group(base, 4, 2); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x10); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x10); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x10, =3D=3D, 0x10); + g_assert_cmpuint(l2vic_read32(base, L2VIC_VID_GRP_2), =3D=3D, 4); + + l2vic_write32(base, L2VIC_INT_CLEARn, 0x10); + + /* IRQ5 steered to VID group 3 -> output line 5 */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x20); + l2vic_set_vid_group(base, 5, 3); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x20); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x20); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x20, =3D=3D, 0x20); + g_assert_cmpuint(l2vic_read32(base, L2VIC_VID_GRP_3), =3D=3D, 5); + + l2vic_write32(base, L2VIC_INT_CLEARn, 0x20); + + /* Restore defaults; the block below reuses IRQ 3-5 without VID steeri= ng */ + l2vic_write32(base, L2VIC_INT_GRPn_0, 0); + l2vic_write32(base, L2VIC_INT_TYPEn, 0); + + /* Multiple pending: at most one active at a time */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0xF); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0xF); + l2vic_write32(base, L2VIC_SOFT_INTn, 0xF); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0xF, !=3D, 0x0); + + /* + * Only one irq becomes active per delivery; each clear unblocks the + * next pending one, so drain until all four have been delivered. + */ + while ((val =3D l2vic_read32(base, L2VIC_INT_STATUSn)) & 0xF) { + l2vic_write32(base, L2VIC_INT_CLEARn, val & 0xF); + } + + /* Level-triggered sources ignore soft interrupts */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x0); + l2vic_write32(base, L2VIC_INT_ENABLE_SETn, 0x20); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x20); + + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x20, =3D=3D, 0x0); + + /* Same source, now edge-triggered, does fire */ + l2vic_write32(base, L2VIC_INT_TYPEn, 0x20); + l2vic_write32(base, L2VIC_SOFT_INTn, 0x20); + val =3D l2vic_read32(base, L2VIC_INT_STATUSn); + g_assert_cmpuint(val & 0x20, =3D=3D, 0x20); + + l2vic_write32(base, L2VIC_INT_ENABLE_CLEARn, 0xFFFFFFFF); + l2vic_write32(base, L2VIC_INT_CLEARn, 0xFFFFFFFF); + l2vic_write32(base, L2VIC_INT_GRPn_0, 0); + l2vic_write32(base, L2VIC_INT_GRPn_1, 0); + l2vic_write32(base, L2VIC_INT_GRPn_2, 0); + l2vic_write32(base, L2VIC_INT_GRPn_3, 0); +} + +static void test_l2vic_on_machine(gconstpointer data) +{ + const L2VICMachineCfg *mc =3D data; + g_autofree char *args =3D g_strdup_printf("-machine %s", mc->machine); + uint64_t base =3D mc->cfg->l2vic_base; + + qtest_start(args); + + test_l2vic_register_access(base); + test_l2vic_interrupt_enable(base); + test_l2vic_basic_functionality(base); + test_l2vic_irq_outputs(base); + + qtest_end(); +} + +int main(int argc, char **argv) +{ + size_t i; + + g_test_init(&argc, &argv, NULL); + + for (i =3D 0; i < ARRAY_SIZE(l2vic_machines); i++) { + g_autofree char *path =3D g_strdup_printf("/l2vic/%s/all-tests", + l2vic_machines[i].machine); + qtest_add_data_func(path, &l2vic_machines[i], test_l2vic_on_machin= e); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 56ff860e216..a76863c7dd6 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -299,7 +299,7 @@ qtests_riscv64 =3D ['riscv-csr-test'] + \ ['iommu-riscv-test'] : []) + \ (config_all_devices.has_key('CONFIG_K230') ? ['k230-wdt-test'] : []) =20 -qtests_hexagon =3D ['boot-serial-test'] +qtests_hexagon =3D ['boot-serial-test', 'l2vic-test'] =20 qos_test_ss =3D ss.source_set() qos_test_ss.add( --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375069; cv=none; d=zohomail.com; s=zohoarc; b=MbOnSgY7tXJPTAFS0y0fYEZhW/CDSQ0KyoNrd2aX/x+HJu4bd2qtL6Ivl+fKToFd5xRSAA9aLnhs01xoJggmxbRxlD/jxWvlncdcZhzCX7gkUDDKcm1pj2ldaQP7nR4OU/IQ6X+ZXtPdYwaO8WGcNPLrddlm/wo5PIbT/TlTvM0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375069; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=WlYwLmXhxTTRa9JsiNHuhC5FeaNc/fhNT3n5nZwsxj8=; b=bqx4JRIWTO6Sf9ZGvjIYQUFuPizdOC0ZIv54ZxilqKHC0h+PbS3N16W0b6SFSr7BxVFUU7Sns0rvCcidOcin0FfY4N/GE6ZvI3VWjRArhCoc0UIdBhoK9TStIHduXBPvMyQZUKDqsb9rchG7Ksm4ZUFc5m8TiAp6CZ2a8c+3NLs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375069816246.41138631032834; Wed, 29 Jul 2026 18:31:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZp-0005j8-CF; Wed, 29 Jul 2026 21:28:49 -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 1wpFZo-0005iu-PN for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:48 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZn-0005bj-DC for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:48 -0400 Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1FdfK3396436 for ; Thu, 30 Jul 2026 01:28:46 GMT Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvsrg14d-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:46 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cb11535e6a1so1275079a12.0 for ; Wed, 29 Jul 2026 18:28:46 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= WlYwLmXhxTTRa9JsiNHuhC5FeaNc/fhNT3n5nZwsxj8=; b=TbXyiHiuUXcT/0aZ BiPfjQ7asPjpPDWjIv15ILqrXkrwvso5N9fX1jILeApKEXM/8acmsMeDPQ3mBplI jlGQx+kc/1WtY61RYLKp/jlyHIg7CJa5UJA3aurXeTwqRXWEJ9u/P7mTXnLXiIMv Amiv37/17w3LrvW7bwsIkj8bEryBL4/xyBMdgYEXhVtQGAsjv61oghPjGuMUYYKz FI1pxrvb6/35lLWH/g4ouLnKTaIgXkuEMAp48UHRdrutoFa5IunF4KMe9qMLVQl4 QL7L9fc/4BhCYuQEI+VUQ6pmyi1xzxdEhi7rlNu+tSDmZT/CMA2aUF6rwcuAhKAd YhQpbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374925; x=1785979725; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WlYwLmXhxTTRa9JsiNHuhC5FeaNc/fhNT3n5nZwsxj8=; b=VLgXd0PJ8bJQ3zhkcHtZqPlWVbP+p6U7hj0e29nq532RlK62WtjyNL1jo14D3L7Yq+ CulcRS4Cw+kj8320q4y7KgKx80cIPjTjZLC8UiIeOdafhY3cb63V7Fthq/M1OZRkK196 OMXxUL3vUuHfhltYWI+ShaJa4m7UzxhTnSHEEb3erbZo/zZDIpxKvWQRvcdkZAiXi3fe 1+gfMLp9zAoejzfRCCD52nZjrF3MyvHn+LMMvBCeH+PYE9+L0v18JhVZsUt3DokmNR3c y+V+7F69zp6vjaQZo3uylDmisNMu2lpcgm5DtpOefZJL5+5ZIVVBkAcNZkVCBvMbjmzo FyMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374925; x=1785979725; h=content-transfer-encoding:content-type: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 :content-type; bh=WlYwLmXhxTTRa9JsiNHuhC5FeaNc/fhNT3n5nZwsxj8=; b=dlUldRJ+fsMTzBrnWSuNOK7k6o7zhHyOQuMdD7FoEVAJvmOoGaGpXP1WonHd4NvDRn 0AQmsW4dgcIK+1BGOIuGO2/pYnkXp0bJjJKpZu3Q2TSKkymUEDjyv6eSFiEy7ISg+s+2 dU9uywe7OI3aOQJihQiw1yXNpe5zNg35tJYfqPzST7+yaCjH8bnU8rnCtPIA1LlrUS2l VsV0WV4FnbR1cBEDXbjdWaGOgvHNiPYuF63RQgfyqNmEaKl77cAgp+BsWSehmBOG/q1A sAo1X4RNEjq7GbKqIUd6Kz1IXcNE9074HHI6KL9LY08LBybXNY43VtWxvYivqy4fPkNO 5yoQ== X-Gm-Message-State: AOJu0Yxqneg8K079Yo9fABQvxq1w+76GRErecd91JRG+5o9+6ML8DB1H LnFtxsEOJrvQbFtoXJrhGk8vZ2UOLygX20s0KiBfEw1bU3BQfY5piUPHjZpgYwm23YCgSAgF7QJ m6Uhm1wSfQCvQ7gIWkX/VWKRqWNGWi7KLyokW2xc9M8142HJaoE5FpqtJDCVtN+WCjA== X-Gm-Gg: AR+sD106aWFvHhtb/PH2fsxZrfWtVEDViZKXB7lJW4qbpITvE1JQpaM2oPHmDOYFEUS mEJs/8d8+CQDtkdPbp4VG0sxG8vB9jTCfcjJ2p2Ef9vMn3d9xUGf5x1MdtovtZi8PUxIV0GjYua itGBsWUQh0MzIGhIAP+ubi4iqJg6MVpw0IcWrhL0NPX4YYpyAlka2VMbRBF3MsrhLEmGqVEorJy VfMCYAMDwm85FyJY7a23Jp+Y6D5R222Mh4xPo0+kLVtjQUDYoeXN76aONfFpHzcJEqTi8nd0CTt z6TxaCf0msRK225r/cy7U+6MjGUzSfbCD8yg6NXFAy5f4cNKJk6zXLZKylJfSQPsBNldS9+aBsX sr0BkFAKykmLiGOT1o11uJuEF/vv05pFdg6EkSNfW18R8sqnk X-Received: by 2002:a05:6a20:7285:b0:3bf:6c04:a813 with SMTP id adf61e73a8af0-3c90093bf7cmr438847637.52.1785374925523; Wed, 29 Jul 2026 18:28:45 -0700 (PDT) X-Received: by 2002:a05:6a20:7285:b0:3bf:6c04:a813 with SMTP id adf61e73a8af0-3c90093bf7cmr438819637.52.1785374925140; Wed, 29 Jul 2026 18:28:45 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 14/18] tests/functional/hexagon: add arch_tests functional test Date: Wed, 29 Jul 2026 18:28:19 -0700 Message-Id: <20260730012824.1135905-15-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX9i8pRhvjijAm 0PctDqF3tYwJ3mnGQ9Mo2uQB9lMt3LjQ60HH6YXHjt3KAi0Sd2BX1GFM2uH+aIokalV3Nh16s0P uECAgxLWvRT/gQ7eGodRA2rUVyRvThE3d6vVCaiw3Ud9EDPJ/jwU4/w53R9XnD5xdyaBcm4Pk80 eFGlHgBptZH31DC6P2D4r/K6r2gZjZJUUY2zHbWqpyATTBOowFXI5YDBpyXN1y2MmNYxuumJGab XUt+vyRVeDamEOP5CsOhFKp3wDYY6a2nG1icmOsZ6n8cGoNOLOa5HR8L5a4CjPqtgR3YBKJ2m5L 9jKqigh2+bvVQlAZbdlE/QEqyxVGdGjvEeCaMWFRxkkoEbzHa80sJoQEllUwzyK9JYkkKYp/jPs uw2xfNmQO9cnaDVf+DgHOFUgz0FNyblr4JqgBMNJ9PKqqcqIrzm+qfkVzbVTTh3goRpE8IbkmxQ QJIts5hD19CiKOtxZeQ== X-Proofpoint-GUID: zeyu4KK1R4oBLMLSXQVM3y_m1Os7mYrv X-Authority-Analysis: v=2.4 cv=AKfAPqRj c=1 sm=1 tr=0 ts=6a6aa8ce cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=X9gmHREV3qooIQp-wBoA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfXxBJbsRRU/07x iaN9s/i4xhrRtMHMNLJ96Uj9DUBOqpWqEd8iM6D+K1DLUNSSevkIBYFrq1Tf/XD0ctVOrIUqzTV vTB8K5/7xawBJmA0LvCOa00t1OoPDC4= X-Proofpoint-ORIG-GUID: zeyu4KK1R4oBLMLSXQVM3y_m1Os7mYrv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 phishscore=0 suspectscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375070902158500 Add the test_int_steering case from hexagon-arch-tests. Reviewed-by: Pierrick Bouvier Signed-off-by: Brian Cain --- tests/functional/hexagon/test_arch_tests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional= /hexagon/test_arch_tests.py index 54a1412c597..2bb34f9b8dc 100755 --- a/tests/functional/hexagon/test_arch_tests.py +++ b/tests/functional/hexagon/test_arch_tests.py @@ -52,6 +52,12 @@ def test_guest_mode(self) -> None: """ self.run_uart_test("test_guest_mode") =20 + def test_int_steering(self) -> None: + """Tests interrupt steering via priority-based routing to + specific threads using STID priority and iassignw. + """ + self.run_uart_test("test_int_steering") + =20 if __name__ =3D=3D "__main__": QemuSystemTest.main() --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375007; cv=none; d=zohomail.com; s=zohoarc; b=bdcUR37QVSgBpRt4Me62Z4dxAE5MzHyCkBZfwhvFAN1FYbmPA8mxpFfD26Z/mwbg+viwEr4KJEfYSfOsRv0NajPIUMaPez9g99Y9gZnkKGI5Fbib+2dktoggsgPjuAwgsJsHlVcpbT+MOUDmjJWvgQ3LHeZcaLxlv1p240iEfh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375007; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H3acHiVFD+RI7KdTS/yR9oLvL0LTMayWD2GoRiupoi4=; b=P/3GfXWD63I6ZJ93u8HuzGV/PYoHzFPmT+rdoOvc2fZZNn2vOsF12vcHOz4orTLImSWA+kV/dtilJ+tOGPYpO1wsQb/6ENoRMZLan1gwTKk1IIakenWRvxPxyVwFpGkOwncEwjCvRq/mQkpSEkRIZ3o6vjNIlTCZaNAFwbsSVHc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375007458633.4781308777092; Wed, 29 Jul 2026 18:30:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZu-0005kB-6s; Wed, 29 Jul 2026 21:28:54 -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 1wpFZs-0005jt-Np for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:52 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZp-0005di-L0 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:52 -0400 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1NElk3533147 for ; Thu, 30 Jul 2026 01:28:48 GMT Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvwe00hu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:48 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-c96b4f58ddcso1229882a12.3 for ; Wed, 29 Jul 2026 18:28:48 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to; s= qcppdkim1; bh=H3acHiVFD+RI7KdTS/yR9oLvL0LTMayWD2GoRiupoi4=; b=a0 TkD7JbIhXr2VYbp1S6Lhhaq0jCT+I6euMIH2wv7IOIYqtRYVysBe/13Fq4arLRT3 lMiR+6lTWSQdsaVgU4l4P/RTWHDZtk161TOOTA+FAlPEHXColb385x3gOKBGyoiy RzO6ydGH+eyWkpQQzEgj9m2jV8brHHwxgIg5Y6l6F2mF3X1oIJLmr+ODzWvbiY6r 6yN+gZJdx9/M3fwcveb+3Mp52g3TH6mB83ZBrlhmmCNFNTSTxi2k2b22jlHkbQr7 s1uWb6Ao8OlAwL8FnWDujtF2B9r4uHHruiVRzMb7dG5TUPoZfj0vzQy2Z+aMvvNn 6JeXk6JuvCV4p+KR3hHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374927; x=1785979727; darn=nongnu.org; h=content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to:content-type; bh=H3acHiVFD+RI7KdTS/yR9oLvL0LTMayWD2GoRiupoi4=; b=ilTHpP7Q7BT0HHMEqHHoiXPn4t/qb+PAEKBpUYD73LZo5lYR3GulhQVscUUKmn7ill HwlbsPt+vxfg/Gxu9zq07JHhFlHFHz8n7LFXVvO3n4VUcpO2QcCgRKeth0JtXXbWHcvW lejmY19F+z2GA+AkufaubIfpQYEkUlmcCALUSJUAL4MISBLinUE4yQ4skFRMY0LI3iXr TLenNhoeERazepjCcfljD2zTza90ncR0nn/pwXwgoy0awFOs7SGC3e89hGgtXWWlxnoY JuezX8RVhjbrbpCbOXVpGraUbpuboYLPUm3foxCqnR7SRr1UX9lwQSLEHsPyxjq4MgFJ I4MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374927; x=1785979727; h=content-transfer-encoding:content-type:content-type: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 :content-type; bh=H3acHiVFD+RI7KdTS/yR9oLvL0LTMayWD2GoRiupoi4=; b=qzvREspiOqWsOxjhSAfPjAvoSwjJNDbhvfrd5NnBtzS6gkXHFqAgyftV8jEfjTxdXy lpdixWjarvfEg6oqJ5D5+SeqTry+2ewcTuQnQgBnRRBVUWtewRd+QzRaapnlUXtBQuJ8 k7lTF7+tfc+nyYxowX+KIiyXFaqrjY+ExaG2Sc8rbJzEmUYWmr6dFd7qaqJzgy8adt5z cU43yTVwlMf6XPB6mRce569jmYmqYKLF9u82yZD9iO9Ufi3Oq13jA2PKAhLoSZzn7f/X QLUcZiuACyehlK2A3JIDtxToTk8m1Aj8PSmM/ORfQnib7z3HSHKe5U05P/NYcOUl4cTC G1/w== X-Gm-Message-State: AOJu0YxcAp/HixFtEu8rqvemrD5jxbVjf3NdinLKGFVV5sg5kc8KrMjY M5yDdWmeNJRj86LyKitmcXuZtLVkTlIzjrmW8fTRA9i0CjgUDlCm4JzqtsjJsnyg2+gaMi8tTmp Y4qoHWLyn1L4c2/ZzxvIHsq5m+6RGn/r0cDKQaqjdlBsi3fr04je9TT8mTiU86LkswA== X-Gm-Gg: AR+sD12I1fYE61spt8pdg65F9lVzGmEka3WkIbwtKt0PPmCLLpB8O8xDz9V4RvXKbZv p06ppPVqWMCy8V+wMhFdwKnw2st7RL2YVpal29vCw8fDXAVrfQfAIGfZEym3YI1B/gJcKNvQVFG m9OVA/+B2B+xo5tTkamEABnUjp7eL9kU15ogYk2Xl7E+EvMjQd2hUS5mzIL4VMkv8c6P3mc/fcD LgUKfe+aMUQaI3XsZIfwDNgd/QP98BEmAlUNbej+W0hdRpim6r0+shOzhgvDWFYmn41UBJJGBsU bMVmxETR8PGRSVwhRbomBHNtpQjg+9rDLOEMCMuqDTEpL+8b8lBTk44P0BEr/IpI59AEoaRJMIp EcvC64l51z8n1vkpaFJWFRMNMwx4lqBzAW4vMGNoGyofpU78p X-Received: by 2002:a05:6a21:697:b0:3c3:6928:8b25 with SMTP id adf61e73a8af0-3c9006b6b41mr467021637.17.1785374927174; Wed, 29 Jul 2026 18:28:47 -0700 (PDT) X-Received: by 2002:a05:6a21:697:b0:3c3:6928:8b25 with SMTP id adf61e73a8af0-3c9006b6b41mr466978637.17.1785374926490; Wed, 29 Jul 2026 18:28:46 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com, Damien Hedde , =?UTF-8?q?Tobias=20R=C3=B6hmel?= , Sid Manning , Thomas Marceron , Mahmoud Kamel Subject: [PATCH v4 15/18] hw/timer: Add QCT QTimer device model Date: Wed, 29 Jul 2026 18:28:20 -0700 Message-Id: <20260730012824.1135905-16-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX9nYSks14woLa CH5kYXYtjS6nT34VsNmfWg+in/m83U55jPoEC8vzSnJmVrWLoXExjXsOEEhxuiWnPpwVhUjLT0w gC2TRttaj8uBYv4btjerjNnCphgPlcEISOKhv3G5uY/GIGAe46kCShk6qpa3FlNATBGkmtnZRjZ XhgrkmjSnT/uSO1mIy3PVPbj+0NpqlTKqSHqMvcVG8rsXoLaKyXyNC2IiYd/8lvcx0CILu9t205 0+CJKRTBZzuO8wMi3vmwzNdK5hD+RJToClUwD1Z0bVG8Lf51GOdOnM8r5bT4EnVzKsO9e1nHGE4 gQhQypbmW+kLvwgIu4/J+VOCXMIxGAZxm5RVd2yMxBn8M9qqK7BkC5ZHGiOMJWiP3kxZeXKweLT k0pZbZLCwZiy/V03dhhvUp4jSDUy8FubAp8WMZMRsCD3QtV3zNEYomBwYCETQSCqXTIw24ycCH3 yEi+DR1N2p0gIMAc6yw== X-Authority-Analysis: v=2.4 cv=AcmB2XXG c=1 sm=1 tr=0 ts=6a6aa8d0 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=1cGLs3X8AAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=MyVnZ0MkVRpyhQKP3eIA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=d8ghUycwObenwynNfMyN:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: banejYQnBaZ6C4UlHCSD0SFUYDC3m31S X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX2h4W5iIG1Cm0 6nIQedcXPLC/i9VC/O7LUv+soidD6tC+ZVwHDw0J2wF0737hxygs8TsN3o4CMHMGmQsK4Dok5+O 8QlyXB2RIm8NT3gq6QxqNIKv7LUVjwk= X-Proofpoint-GUID: banejYQnBaZ6C4UlHCSD0SFUYDC3m31S X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 priorityscore=1501 clxscore=1015 malwarescore=0 adultscore=0 suspectscore=0 bulkscore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375008782158500 Content-Type: text/plain; charset="utf-8" Implement the QCT QTimer generic timer device used by Hexagon DSP systems. Co-authored-by: Damien Hedde Co-authored-by: Tobias R=C3=B6hmel Co-authored-by: Sid Manning Co-authored-by: Thomas Marceron Co-authored-by: Mahmoud Kamel Signed-off-by: Brian Cain --- MAINTAINERS | 2 + include/hw/timer/qct-qtimer.h | 43 +++ hw/timer/qct-qtimer.c | 681 ++++++++++++++++++++++++++++++++++ hw/timer/Kconfig | 3 + hw/timer/meson.build | 2 + hw/timer/trace-events | 5 + 6 files changed, 736 insertions(+) create mode 100644 include/hw/timer/qct-qtimer.h create mode 100644 hw/timer/qct-qtimer.c diff --git a/MAINTAINERS b/MAINTAINERS index 114bbec45ad..de106416b64 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -253,6 +253,8 @@ F: target/hexagon/ F: hw/intc/hex-l2vic.c F: include/hw/intc/hex-l2vic.h F: tests/qtest/l2vic-test.c +F: hw/timer/qct-qtimer.c +F: include/hw/timer/qct-qtimer.h X: target/hexagon/idef-parser/ X: target/hexagon/gen_idef_parser_funcs.py F: linux-user/hexagon/ diff --git a/include/hw/timer/qct-qtimer.h b/include/hw/timer/qct-qtimer.h new file mode 100644 index 00000000000..53d8291472d --- /dev/null +++ b/include/hw/timer/qct-qtimer.h @@ -0,0 +1,43 @@ +/* + * Qualcomm QCT QTimer + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef HW_TIMER_QCT_QTIMER_H +#define HW_TIMER_QCT_QTIMER_H + +#include "qom/object.h" + +#define TYPE_QCT_QTIMER "qct-qtimer" + +/* QTimer interface for external access from hexagon_globalreg */ +#define TYPE_QCT_QTIMER_INTERFACE "qct-qtimer-if" + +typedef struct QctQtimerInterface QctQtimerInterface; + +typedef struct QctQtimerInterfaceClass { + InterfaceClass parent_class; + + /* Read the live physical counter, backing HEX_SREG_TIMERLO/TIMERHI */ + uint32_t (*get_timer_lo)(const QctQtimerInterface *qtimer); + uint32_t (*get_timer_hi)(const QctQtimerInterface *qtimer); +} QctQtimerInterfaceClass; + +DECLARE_OBJ_CHECKERS(QctQtimerInterface, QctQtimerInterfaceClass, + QCT_QTIMER_INTERFACE, TYPE_QCT_QTIMER_INTERFACE); + +static inline uint32_t qct_qtimer_get_timer_lo(const QctQtimerInterface *q= timer) +{ + QctQtimerInterfaceClass *k =3D QCT_QTIMER_INTERFACE_GET_CLASS(qtimer); + return k->get_timer_lo(qtimer); +} + +static inline uint32_t qct_qtimer_get_timer_hi(const QctQtimerInterface *q= timer) +{ + QctQtimerInterfaceClass *k =3D QCT_QTIMER_INTERFACE_GET_CLASS(qtimer); + return k->get_timer_hi(qtimer); +} + +#endif /* HW_TIMER_QCT_QTIMER_H */ diff --git a/hw/timer/qct-qtimer.c b/hw/timer/qct-qtimer.c new file mode 100644 index 00000000000..82c711000eb --- /dev/null +++ b/hw/timer/qct-qtimer.c @@ -0,0 +1,681 @@ +/* + * Qualcomm QCT QTimer + * + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/core/irq.h" +#include "hw/core/qdev-properties.h" +#include "hw/core/sysbus.h" +#include "hw/timer/qct-qtimer.h" +#include "migration/vmstate.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qemu/module.h" +#include "qemu/timer.h" +#include "qapi/error.h" +#include "trace.h" + +#define QTIMER_MEM_SIZE_BYTES 0x1000 +#define QTIMER_DEFAULT_FREQ_HZ 19200000ULL + +#define QCT_QTIMER_TIMER_FRAME_ELTS (16) +#define QCT_QTIMER_TIMER_VIEW_ELTS (2) + +#define QCT_QTIMER_AC_CNTFRQ (0x000) +#define QCT_QTIMER_AC_CNTSR (0x004) +#define QCT_QTIMER_AC_CNTTID_0 (0x08) +#define QCT_QTIMER_AC_CNTACR_START (0x40) +#define QCT_QTIMER_AC_CNTACR_END (0x5c) +#define QCT_QTIMER_AC_CNTTID_1 (0x108) +#define QCT_QTIMER_AC_CNTACR_RWPT (1 << 5) /* R/W of CNTP_* regs */ +#define QCT_QTIMER_AC_CNTACR_RWVT (1 << 4) /* R/W of CNTV_* regs */ +#define QCT_QTIMER_AC_CNTACR_RVOFF (1 << 3) /* R/W of CNTVOFF register */ +#define QCT_QTIMER_AC_CNTACR_RFRQ (1 << 2) /* R/W of CNTFRQ register */ +#define QCT_QTIMER_AC_CNTACR_RPVCT (1 << 1) /* R/W of CNTVCT register */ +#define QCT_QTIMER_AC_CNTACR_RPCT (1 << 0) /* R/W of CNTPCT register */ +#define QCT_QTIMER_VERSION (0x0fd0) + +#define QCT_QTIMER_CNTPCT_LO (0x000) +#define QCT_QTIMER_CNTPCT_HI (0x004) +#define QCT_QTIMER_CNT_FREQ (0x010) +#define QCT_QTIMER_CNTPL0ACR (0x014) +#define QCT_QTIMER_CNTPL0ACR_PL0CTEN (1 << 9) +#define QCT_QTIMER_CNTPL0ACR_PL0TVEN (1 << 8) +#define QCT_QTIMER_CNTPL0ACR_PL0VCTEN (1 << 1) +#define QCT_QTIMER_CNTPL0ACR_PL0PCTEN (1 << 0) +#define QCT_QTIMER_CNTP_CVAL_LO (0x020) +#define QCT_QTIMER_CNTP_CVAL_HI (0x024) +#define QCT_QTIMER_CNT_MASK 0x00ffffffffffffffULL +#define QCT_QTIMER_CNT_HI_BITS 24 +#define QCT_QTIMER_CNTP_TVAL (0x028) +#define QCT_QTIMER_CNTP_CTL (0x02c) +#define QCT_QTIMER_CNTP_CTL_ENABLE (1 << 0) +#define QCT_QTIMER_CNTP_CTL_INTEN (1 << 1) +#define QCT_QTIMER_CNTP_CTL_ISTAT (1 << 2) + +OBJECT_DECLARE_SIMPLE_TYPE(QCTQtimerState, QCT_QTIMER) + +typedef struct QCTHextimerState { + QCTQtimerState *qtimer; + QEMUTimer *timer; /* one-shot deadline timer */ + int64_t offset_ns; /* QEMU_CLOCK_VIRTUAL ns at which cntpct =3D= =3D 0 */ + uint64_t cntval; /* 64-bit physical timer compare value */ + uint32_t control; + uint32_t cnt_ctrl; + uint32_t cntpl0acr; + uint32_t int_level; + qemu_irq irq; +} QCTHextimerState; + +struct QCTQtimerState { + SysBusDevice parent_obj; + + MemoryRegion iomem; + MemoryRegion view_iomem; + uint32_t secure; + QCTHextimerState timer[QCT_QTIMER_TIMER_FRAME_ELTS]; + uint32_t freq_hz; + uint32_t nr_frames; + uint32_t nr_views; + uint32_t frame_stride; + uint32_t cnttid_0; + uint32_t cnttid_1; + uint32_t freq_scale; +}; + +/* + * QTimer version register: + * + * 3 2 1 + * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Major | Minor | Step | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ +#define QCT_QTIMER_VERSION_VALUE 0x20020000 + +/* Counter value derived on-demand from QEMU_CLOCK_VIRTUAL. */ +static uint64_t hex_timer_now(QCTHextimerState *s) +{ + int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + uint32_t scale; + uint64_t scaled_elapsed; + + if (now <=3D s->offset_ns) { + return 0; + } + scale =3D MAX(s->qtimer->freq_scale, 1u); + scaled_elapsed =3D (uint64_t)(now - s->offset_ns) / scale; + return muldiv64(scaled_elapsed, s->qtimer->freq_hz, + NANOSECONDS_PER_SECOND) & + QCT_QTIMER_CNT_MASK; +} + +/* Arm (or disarm) the one-shot deadline timer. */ +static void hex_timer_rearm(QCTHextimerState *s) +{ + uint32_t scale; + uint64_t base_ns; + int64_t deadline_ns; + + if (!(s->control & QCT_QTIMER_CNTP_CTL_ENABLE)) { + timer_del(s->timer); + return; + } + + scale =3D MAX(s->qtimer->freq_scale, 1u); + /* + * Round the ticks-to-ns conversion up so that hex_timer_now(), which + * truncates when it divides elapsed ns by scale, is guaranteed to + * report >=3D cntval once this deadline fires. A truncating conversion + * here could re-arm at the same deadline forever when scale > 1. + */ + base_ns =3D muldiv64_round_up(s->cntval, NANOSECONDS_PER_SECOND, + s->qtimer->freq_hz); + if (base_ns > + ((uint64_t)INT64_MAX - (uint64_t)s->offset_ns) / scale) { + timer_del(s->timer); + return; + } + deadline_ns =3D s->offset_ns + (int64_t)(base_ns * scale); + timer_mod(s->timer, deadline_ns); +} + +static void hex_timer_update(QCTHextimerState *s) +{ + int level =3D s->int_level && + (s->control & QCT_QTIMER_CNTP_CTL_ENABLE) && + !(s->control & QCT_QTIMER_CNTP_CTL_INTEN); + + trace_qtimer_interrupt(); + qemu_set_irq(s->irq, level); +} + +/* + * Access-control (AC) region: offsets below 0x1000, gates CNTFRQ/CNTSR/ + * CNTTID/CNTACR per frame plus the shared VERSION register. + */ +static uint64_t qct_qtimer_ac_read(void *opaque, hwaddr offset, unsigned s= ize) +{ + QCTQtimerState *s =3D opaque; + uint32_t frame; + + switch (offset) { + case QCT_QTIMER_AC_CNTFRQ: + return s->freq_hz; + case QCT_QTIMER_AC_CNTSR: + return s->secure; + case QCT_QTIMER_AC_CNTTID_0: + return s->cnttid_0; + case QCT_QTIMER_AC_CNTTID_1: + return s->cnttid_1; + case QCT_QTIMER_AC_CNTACR_START ... QCT_QTIMER_AC_CNTACR_END: + frame =3D (offset - QCT_QTIMER_AC_CNTACR_START) / 4; + if (frame >=3D s->nr_frames) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad CNTACR offset 0x%x\n", + __func__, (int)offset); + return 0; + } + return s->timer[frame].cnt_ctrl; + case QCT_QTIMER_VERSION: + return QCT_QTIMER_VERSION_VALUE; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad offset 0x%x\n", __func__, + (int)offset); + return 0; + } +} + +static void qct_qtimer_ac_write(void *opaque, hwaddr offset, uint64_t valu= e, + unsigned size) +{ + QCTQtimerState *s =3D opaque; + uint32_t frame; + + switch (offset) { + case QCT_QTIMER_AC_CNTFRQ: + if (value =3D=3D 0) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad CNTFRQ value 0\n", + __func__); + return; + } + s->freq_hz =3D value; + return; + case QCT_QTIMER_AC_CNTSR: + if (value > 0xff) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad CNTSR value 0x%x\n", + __func__, (int)value); + return; + } + s->secure =3D value; + return; + case QCT_QTIMER_AC_CNTACR_START ... QCT_QTIMER_AC_CNTACR_END: + frame =3D (offset - QCT_QTIMER_AC_CNTACR_START) / 4; + if (frame >=3D s->nr_frames) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad CNTACR offset 0x%x\n", + __func__, (int)offset); + return; + } + s->timer[frame].cnt_ctrl =3D value; + return; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad offset 0x%x\n", __func__, + (int)offset); + return; + } +} + +static const MemoryRegionOps qct_qtimer_ac_ops =3D { + .read =3D qct_qtimer_ac_read, + .write =3D qct_qtimer_ac_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + .unaligned =3D false, + }, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, +}; + +/* + * View region: a flat array of (frame, view) slots, each frame_stride + * bytes wide, holding the per-frame CNTPCT/CNTP_CVAL/CNTP_TVAL/CNTP_CTL + * register set. + */ +static QCTHextimerState *qct_qtimer_demux(QCTQtimerState *s, hwaddr offset, + uint32_t *reg_offset, + uint32_t *view) +{ + uint32_t stride =3D s->frame_stride; + uint32_t stride_shift =3D ctz32(stride); + uint32_t slot_nr =3D offset >> stride_shift; + uint32_t frame =3D slot_nr / s->nr_views; + + *reg_offset =3D offset & (stride - 1); + *view =3D slot_nr % s->nr_views; + if (frame >=3D s->nr_frames) { + return NULL; + } + return &s->timer[frame]; +} + +/* Frames 8+ share cnttid_1; each frame's second view is gated by a bit. */ +static bool qct_qtimer_view_visible(QCTQtimerState *s, uint32_t frame, + uint32_t view) +{ + uint32_t cnttid =3D frame < 8 ? s->cnttid_0 : s->cnttid_1; + uint32_t frame_idx =3D frame < 8 ? frame : frame - 8; + + return !view || (cnttid & (0x4 << (frame_idx * 4))); +} + +static MemTxResult hex_timer_read(void *opaque, hwaddr offset, uint64_t *d= ata, + unsigned size, MemTxAttrs attrs) +{ + QCTQtimerState *qs =3D opaque; + uint32_t reg_offset; + uint32_t view; + QCTHextimerState *s =3D qct_qtimer_demux(qs, offset, ®_offset, &vie= w); + uint32_t frame; + + if (!s) { + *data =3D 0; + return MEMTX_ACCESS_ERROR; + } + frame =3D s - qs->timer; + + trace_qtimer_read(offset); + + if (!qct_qtimer_view_visible(qs, frame, view)) { + *data =3D 0; + return MEMTX_OK; + } + + switch (reg_offset) { + case QCT_QTIMER_CNT_FREQ: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RFRQ)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & (QCT_QTIMER_CNTPL0ACR_PL0PCTEN | + QCT_QTIMER_CNTPL0ACR_PL0VCTEN))) { + return MEMTX_ACCESS_ERROR; + } + *data =3D s->qtimer->freq_hz; + return MEMTX_OK; + case QCT_QTIMER_CNTP_CVAL_LO: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + *data =3D extract64(s->cntval, 0, 32); + return MEMTX_OK; + case QCT_QTIMER_CNTP_CVAL_HI: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + /* HI half is 24-bit per TRM; bits [31:24] are reserved. */ + *data =3D extract64(s->cntval, 32, QCT_QTIMER_CNT_HI_BITS); + return MEMTX_OK; + case QCT_QTIMER_CNTPCT_LO: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RPCT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0PCTEN)) { + return MEMTX_ACCESS_ERROR; + } + *data =3D extract64(hex_timer_now(s), 0, 32); + return MEMTX_OK; + case QCT_QTIMER_CNTPCT_HI: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RPCT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0PCTEN)) { + return MEMTX_ACCESS_ERROR; + } + *data =3D extract64(hex_timer_now(s), 32, QCT_QTIMER_CNT_HI_BITS); + return MEMTX_OK; + case QCT_QTIMER_CNTP_TVAL: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + *data =3D (uint32_t)(int32_t)(int64_t)(s->cntval - hex_timer_now(s= )); + return MEMTX_OK; + case QCT_QTIMER_CNTP_CTL: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + /* + * CNTP_CTL: bit 0 EN, bit 1 IMASK, bit 2 ISTAT (interrupt + * pending). ISTAT tracks int_level and is read-only. + */ + *data =3D s->control | ((s->int_level & 0x1) << 2); + return MEMTX_OK; + case QCT_QTIMER_CNTPL0ACR: + *data =3D view ? 0 : s->cntpl0acr; + return MEMTX_OK; + case QCT_QTIMER_VERSION: + *data =3D QCT_QTIMER_VERSION_VALUE; + return MEMTX_OK; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad offset 0x%x\n", __func__, + (int)offset); + *data =3D 0; + return MEMTX_ACCESS_ERROR; + } +} + +static MemTxResult hex_timer_write(void *opaque, hwaddr offset, + uint64_t value, unsigned size, + MemTxAttrs attrs) +{ + QCTQtimerState *qs =3D opaque; + uint32_t reg_offset; + uint32_t view; + QCTHextimerState *s =3D qct_qtimer_demux(qs, offset, ®_offset, &vie= w); + uint32_t frame; + + if (!s) { + return MEMTX_ACCESS_ERROR; + } + frame =3D s - qs->timer; + + trace_qtimer_write(offset, value); + + if (!qct_qtimer_view_visible(qs, frame, view)) { + return MEMTX_OK; + } + + switch (reg_offset) { + case QCT_QTIMER_CNTP_CVAL_LO: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + s->int_level =3D 0; + s->cntval =3D deposit64(s->cntval, 0, 32, value); + hex_timer_rearm(s); + break; + case QCT_QTIMER_CNTP_CVAL_HI: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + s->int_level =3D 0; + /* HI half is 24-bit per TRM; bits [31:24] are reserved. */ + s->cntval =3D deposit64(s->cntval, 32, QCT_QTIMER_CNT_HI_BITS, val= ue) & + QCT_QTIMER_CNT_MASK; + hex_timer_rearm(s); + break; + case QCT_QTIMER_CNTP_CTL: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + /* ISTAT (bit 2) is read-only; keep SW writes from polluting it. */ + s->control =3D value & ~QCT_QTIMER_CNTP_CTL_ISTAT; + hex_timer_rearm(s); + break; + case QCT_QTIMER_CNTP_TVAL: + if (!(s->cnt_ctrl & QCT_QTIMER_AC_CNTACR_RWPT)) { + return MEMTX_ACCESS_ERROR; + } + if (view && !(s->cntpl0acr & QCT_QTIMER_CNTPL0ACR_PL0CTEN)) { + return MEMTX_ACCESS_ERROR; + } + /* TVAL write: CVAL =3D CNTPCT + TVAL (TVAL is signed 32-bit). */ + s->int_level =3D 0; + s->cntval =3D (hex_timer_now(s) + (int64_t)(int32_t)value) & + QCT_QTIMER_CNT_MASK; + hex_timer_rearm(s); + break; + case QCT_QTIMER_CNTPL0ACR: + if (!view) { + s->cntpl0acr =3D value; + } + break; + default: + qemu_log_mask(LOG_GUEST_ERROR, "%s: bad offset 0x%x\n", __func__, + (int)offset); + return MEMTX_ACCESS_ERROR; + } + hex_timer_update(s); + return MEMTX_OK; +} + +static void hex_timer_tick(void *opaque) +{ + QCTHextimerState *s =3D opaque; + uint64_t now =3D hex_timer_now(s); + uint64_t diff56 =3D (now - s->cntval) & QCT_QTIMER_CNT_MASK; + int64_t signed_diff =3D (int64_t)(diff56 << 8) >> 8; + + if (signed_diff >=3D 0) { + s->int_level =3D 1; + hex_timer_update(s); + } else { + hex_timer_rearm(s); + } +} + +static const MemoryRegionOps hex_timer_ops =3D { + .read_with_attrs =3D hex_timer_read, + .write_with_attrs =3D hex_timer_write, + .endianness =3D DEVICE_LITTLE_ENDIAN, + .valid =3D { + .min_access_size =3D 4, + .max_access_size =3D 8, + .unaligned =3D false, + }, + .impl =3D { + .min_access_size =3D 4, + .max_access_size =3D 4, + }, +}; + +static const VMStateDescription vmstate_qct_hextimer =3D { + .name =3D "qct-hextimer", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT32(control, QCTHextimerState), + VMSTATE_UINT32(cnt_ctrl, QCTHextimerState), + VMSTATE_INT64(offset_ns, QCTHextimerState), + VMSTATE_UINT64(cntval, QCTHextimerState), + VMSTATE_UINT32(cntpl0acr, QCTHextimerState), + VMSTATE_UINT32(int_level, QCTHextimerState), + VMSTATE_TIMER_PTR(timer, QCTHextimerState), + VMSTATE_END_OF_LIST() + } +}; + +static const VMStateDescription vmstate_qct_qtimer =3D { + .name =3D "qct-qtimer", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (const VMStateField[]) { + VMSTATE_UINT32(freq_hz, QCTQtimerState), + VMSTATE_UINT32(secure, QCTQtimerState), + VMSTATE_STRUCT_VARRAY_UINT32(timer, QCTQtimerState, nr_frames, + 1, vmstate_qct_hextimer, QCTHextimerSt= ate), + VMSTATE_END_OF_LIST() + } +}; + +static void qct_qtimer_realize(DeviceState *dev, Error **errp) +{ + SysBusDevice *sbd =3D SYS_BUS_DEVICE(dev); + QCTQtimerState *s =3D QCT_QTIMER(dev); + unsigned int i; + + if (s->nr_frames > QCT_QTIMER_TIMER_FRAME_ELTS) { + error_setg(errp, "nr_frames too high"); + return; + } + if (s->nr_views > QCT_QTIMER_TIMER_VIEW_ELTS) { + error_setg(errp, "nr_views too high"); + return; + } + if (s->freq_hz =3D=3D 0) { + error_setg(errp, "freq-hz must be nonzero"); + return; + } + if (s->frame_stride =3D=3D 0 || !is_power_of_2(s->frame_stride)) { + error_setg(errp, "frame_stride must be a nonzero power of two"); + return; + } + + memory_region_init_io(&s->iomem, OBJECT(s), &qct_qtimer_ac_ops, s, + "qct-qtimer-ac", QTIMER_MEM_SIZE_BYTES); + sysbus_init_mmio(sbd, &s->iomem); + + memory_region_init_io(&s->view_iomem, OBJECT(s), &hex_timer_ops, s, + "qct-qtimer-view", + (uint64_t)s->frame_stride * s->nr_frames * + s->nr_views); + sysbus_init_mmio(sbd, &s->view_iomem); + + for (i =3D 0; i < s->nr_frames; i++) { + QCTHextimerState *t =3D &s->timer[i]; + + t->qtimer =3D s; + s->secure |=3D (1 << i); + + sysbus_init_irq(sbd, &t->irq); + t->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, hex_timer_tick, t); + } +} + +static void qct_qtimer_unrealize(DeviceState *dev) +{ + QCTQtimerState *s =3D QCT_QTIMER(dev); + unsigned int i; + + for (i =3D 0; i < s->nr_frames; i++) { + QCTHextimerState *t =3D &s->timer[i]; + + if (t->timer) { + timer_free(t->timer); + t->timer =3D NULL; + } + } +} + +static void qct_qtimer_reset_hold(Object *obj, ResetType type) +{ + QCTQtimerState *s =3D QCT_QTIMER(obj); + unsigned int i; + + for (i =3D 0; i < s->nr_frames; i++) { + QCTHextimerState *t =3D &s->timer[i]; + + /* + * Per TRM: CTL =3D 0 (EN=3D0, IMASK=3D0, ISTAT=3D0), CVAL =3D 0 s= o that + * TVAL (=3D CVAL - CNTPCT) also reads 0 at reset. The QEMUTimer is + * only armed when SW sets CTL.EN=3D1, so cntval=3D0 does not caus= e a + * spurious fire before SW programs the compare value. + */ + t->control =3D 0; + t->cnt_ctrl =3D QCT_QTIMER_AC_CNTACR_RWPT | QCT_QTIMER_AC_CNTACR_R= WVT | + QCT_QTIMER_AC_CNTACR_RVOFF | QCT_QTIMER_AC_CNTACR_RF= RQ | + QCT_QTIMER_AC_CNTACR_RPVCT | QCT_QTIMER_AC_CNTACR_RP= CT; + t->cntval =3D 0; + t->cntpl0acr =3D 0; + t->int_level =3D 0; + t->offset_ns =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + timer_del(t->timer); + qemu_set_irq(t->irq, 0); + } +} + +static const Property qct_qtimer_properties[] =3D { + DEFINE_PROP_UINT32("freq-hz", QCTQtimerState, freq_hz, + QTIMER_DEFAULT_FREQ_HZ), + DEFINE_PROP_UINT32("freq-scale", QCTQtimerState, freq_scale, 1), + DEFINE_PROP_UINT32("nr_frames", QCTQtimerState, nr_frames, 2), + DEFINE_PROP_UINT32("nr_views", QCTQtimerState, nr_views, 1), + DEFINE_PROP_UINT32("frame_stride", QCTQtimerState, frame_stride, 0x100= 0), + DEFINE_PROP_UINT32("cnttid_0", QCTQtimerState, cnttid_0, 0x11), + DEFINE_PROP_UINT32("cnttid_1", QCTQtimerState, cnttid_1, 0x0), +}; + +static void qct_qtimer_class_init(ObjectClass *klass, const void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + ResettableClass *rc =3D RESETTABLE_CLASS(klass); + + device_class_set_props(dc, qct_qtimer_properties); + dc->realize =3D qct_qtimer_realize; + dc->unrealize =3D qct_qtimer_unrealize; + dc->vmsd =3D &vmstate_qct_qtimer; + rc->phases.hold =3D qct_qtimer_reset_hold; +} + +/* QTimer interface implementation, backing HEX_SREG_TIMERLO/TIMERHI */ +static uint32_t qct_qtimer_get_timer_lo_impl(const QctQtimerInterface *obj) +{ + QCTQtimerState *s =3D QCT_QTIMER((QctQtimerInterface *)obj); + + return s->nr_frames > 0 ? extract64(hex_timer_now(&s->timer[0]), 0, 32) + : 0; +} + +static uint32_t qct_qtimer_get_timer_hi_impl(const QctQtimerInterface *obj) +{ + QCTQtimerState *s =3D QCT_QTIMER((QctQtimerInterface *)obj); + + return s->nr_frames > 0 ? extract64(hex_timer_now(&s->timer[0]), 32, 3= 2) + : 0; +} + +static void qct_qtimer_interface_class_init(ObjectClass *klass, + const void *data) +{ + QctQtimerInterfaceClass *k =3D QCT_QTIMER_INTERFACE_CLASS(klass); + + k->get_timer_lo =3D qct_qtimer_get_timer_lo_impl; + k->get_timer_hi =3D qct_qtimer_get_timer_hi_impl; +} + +static const TypeInfo qct_qtimer_types[] =3D { + { + .name =3D TYPE_QCT_QTIMER_INTERFACE, + .parent =3D TYPE_INTERFACE, + .class_size =3D sizeof(QctQtimerInterfaceClass), + .class_init =3D qct_qtimer_interface_class_init, + }, + { + .name =3D TYPE_QCT_QTIMER, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(QCTQtimerState), + .class_init =3D qct_qtimer_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_QCT_QTIMER_INTERFACE }, + { } + }, + }, +}; + +DEFINE_TYPES(qct_qtimer_types) diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig index b3d823ce2c3..e1b751a54a7 100644 --- a/hw/timer/Kconfig +++ b/hw/timer/Kconfig @@ -65,3 +65,6 @@ config STELLARIS_GPTM =20 config AVR_TIMER16 bool + +config HEX_QTIMER + bool diff --git a/hw/timer/meson.build b/hw/timer/meson.build index 201b5d8316d..0e8326b0492 100644 --- a/hw/timer/meson.build +++ b/hw/timer/meson.build @@ -34,3 +34,5 @@ specific_ss.add(when: 'CONFIG_IBEX', if_true: files('ibex= _timer.c')) system_ss.add(when: 'CONFIG_SIFIVE_PWM', if_true: files('sifive_pwm.c')) =20 system_ss.add(when: 'CONFIG_AVR_TIMER16', if_true: files('avr_timer16.c')) + +specific_ss.add(when: 'CONFIG_HEX_QTIMER', if_true: files('qct-qtimer.c')) diff --git a/hw/timer/trace-events b/hw/timer/trace-events index 634ba1da27a..636310f8caa 100644 --- a/hw/timer/trace-events +++ b/hw/timer/trace-events @@ -128,3 +128,8 @@ imx_epit_get_freq(uint32_t freq) "ptimer frequency is %= u" imx_epit_read(const char *name, uint32_t value) "(%s) =3D 0x%08x" imx_epit_write(const char *name, uint64_t value) "(%s, value =3D 0x%08" PR= Ix64 ")" imx_epit_cmp(uint32_t sr) "sr was %d" + +# qct-qtimer.c +qtimer_interrupt(void) "qtimer interrupt line updated" +qtimer_read(uint64_t offset) "offset 0x%" PRIx64 +qtimer_write(uint64_t offset, uint64_t value) "offset 0x%" PRIx64 " value = 0x%" PRIx64 --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374991; cv=none; d=zohomail.com; s=zohoarc; b=Bbx7ForY4DepK0+2xXL6KGeQhmTbp4qjBECSWW/aZf9peDMsIIkt8Bn8FuvkYlttMsRAxTWah1OPcFEOB0XW1jL46yHnV/apCt6Um2r+CEGmvkJPlQmaBAXFJuEOFMYE07C4Qgsr1vZJ86xYImAdfC49TcxIi4iOHB6Fm424qMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374991; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sd8xh1ZA6dwbMhTTAqEQT9GxjDv9o4Umg4WaHGpYus8=; b=DmYLytxUXspAPhoniaThSMHFN2IkU/VJrX6I/B882SDazBCWx2D5Ix66u9QCiipTyAgnTUTaLpEKIL9olsokw5vt8L19qSO89Kr462XXwkj+DoRajryNXuwK1+Y/gsRZeWUbAq/g0oKV6gaHQiHifVB/1g5mLMoDjuQPDpf5lxk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374991381698.9388766573493; Wed, 29 Jul 2026 18:29:51 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZu-0005kE-6T; Wed, 29 Jul 2026 21:28:54 -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 1wpFZs-0005jk-7D for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:52 -0400 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZq-0005dp-HQ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:51 -0400 Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U0v3Ig3709823 for ; Thu, 30 Jul 2026 01:28:49 GMT Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvh382xh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:49 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-cb6dd278512so1098355a12.3 for ; Wed, 29 Jul 2026 18:28:49 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= sd8xh1ZA6dwbMhTTAqEQT9GxjDv9o4Umg4WaHGpYus8=; b=kMSwOknfb6Tg2CBt BsyuBL9yfIdUixPcx2jGxgAUDiZNIya8V5YZy0XeWrBOC03A1MJnexDhhWaSUjAk UdrNLdSmdgSZeRgBAqGipN83QSHhM5IPGNhbVmu7OqS7teeM4BsDmUycNfNb4a+u 4Tqx8LizeurMIekACJdt1lyvE9g5cw3xCOUbdnSlhxFzYvDUrBYEdmN3XFuvMNiL Wy11eQLvSHPdSVM4+4bs1PZ86w/g04V8ICGJhUt6Jm4/dQF6084Ck2wdhQzZBnku Fabq1wGbVuua8ObXilVhYFUBL3wh2RMIGMFrs4/AO6QqTap5Tsz138GLkrysQW44 BOY1qQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374928; x=1785979728; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=sd8xh1ZA6dwbMhTTAqEQT9GxjDv9o4Umg4WaHGpYus8=; b=LSq23RYfJixIuOl+vPxaW20RuPwi5ybFjCmW1O7LfBzUJKfS23S1Sc4JscISkvd3vp e+TS3XJkN9AlYGXU2vT9AphAwzAqJ1K62+JSp12stoU02YPA4zsbLZL0AYC+PM/v0ngT el70Ivl8QYjd/mgYeC5fwe/630BhuKuzlEB/ABTWC9TQmA7lamOhfe39yaKET7wo5JOt llMH1EXsDo96usERtoH1zQ/pH5kLAVVfir/2bKEWiKWrstTmbVVofcwACtWmCufA+UXr b3izBLvv4iTUbpjJ2wUIDxQVTKOErRn3XCkF/SGWTOA6LL48pWJkSzl+sq9R8I+rFjsM g1/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374928; x=1785979728; h=content-transfer-encoding:content-type: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 :content-type; bh=sd8xh1ZA6dwbMhTTAqEQT9GxjDv9o4Umg4WaHGpYus8=; b=s12phI0nTlo43EHueaoYlDrbTtV1FSOZFc82esgLZ9zDUNeavVdqxV7hNjywOw4vC2 eCQG2uVDMyQ+4jL750cqNnI+Eu7zndkad08fDC/eIUepe+SotFv0zDcaLC0oOkwoRhDu JtVFJxsHYbVoPP/y7tWLJgYsJx5l7KclQKjO9fEazWCItvO2f8kaFAGTGR/tXR/KsQES +nhRH+5w/+AZCVH8osBcEIHe+Cn19LBlvv8rl1x4ExwT2rgYH9KGt5HE2WpwYreVDt1v ywoOt+crs8liNLcD78HHVZ0snewVoDWlK+M2CmVyDxuPBVZhZerEcL2PItGEnT6wO9Uj aVEg== X-Gm-Message-State: AOJu0YzPUkkQn0TZO0lyL+ZCMVC0anQlHU6+Btgw5YHlnYpCDxqlsgv2 AiqapmUhot8wcmpSxPgofgwcXDi263p577sp8E9d9VGRDlFY4VcYjJWXkPANaN+sWi3BFbn6V1m TmAWB5rjjg9OvP8pFsla6eTDcaznNHMJSTsVwyKawqJiXMZbAIdw+EXUO7QbdJVsZKQ== X-Gm-Gg: AR+sD12yKyq5me/XhgfDzlPulyUSI70QNkpta7Gkv2F/RzUtI3kFAtQ7VFZZtljLDrs di36JZkc7XuPnuiX9X1ODbXnwyFG3TpmBVnEjMr3gglG0j7I3n2zTZujntyUYJ7GDOH6McdV5hP prjQxjvzXWJp5H+sDEjnEPj73LjnjbWgBmLODLmOX3ioohfDCAP78k7/PQ9sZ/AVKx0OOetJPJX vS4JSVbAIuJcEP3NjWzlIrmMpmxF9yCWFjX8sA/zvZ6lr+tM2U1izrPDauH5gkHC/mxeIwjzKtp bBt8+sjI3dZOxDIQOQUEIhZhGdKVYgJg+QGfM2JllHsSGtPNcVkgaHd2cdhyANasHQM50zmI46g SeamHTa8/9k/xW04BLI7UsIS058IdD142y1feC8dAST2Vz1Wo X-Received: by 2002:a05:6a21:3301:b0:3c3:7fff:ba72 with SMTP id adf61e73a8af0-3c90076eb05mr436684637.70.1785374928496; Wed, 29 Jul 2026 18:28:48 -0700 (PDT) X-Received: by 2002:a05:6a21:3301:b0:3c3:7fff:ba72 with SMTP id adf61e73a8af0-3c90076eb05mr436656637.70.1785374928004; Wed, 29 Jul 2026 18:28:48 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 16/18] hw/hexagon: connect qtimer device Date: Wed, 29 Jul 2026 18:28:21 -0700 Message-Id: <20260730012824.1135905-17-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX9vodSm+LWYh1 418E753SOlOG2YR270LiK1aiWy6OYYrDln0A0Nf7f4at5bLynotfwLwyqJ9BTu25B3purfW5O0M MIsmub36ELk730PAJTUxNEhz6YY1dbc= X-Proofpoint-ORIG-GUID: EIaSV5aoSnhWsanM4OOc84Ztov72bYAH X-Proofpoint-GUID: EIaSV5aoSnhWsanM4OOc84Ztov72bYAH X-Authority-Analysis: v=2.4 cv=batbluPB c=1 sm=1 tr=0 ts=6a6aa8d1 cx=c_pps a=Qgeoaf8Lrialg5Z894R3/Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=El6rGuWiIpdnsNYezL0A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNyBTYWx0ZWRfX37d20ty3JLcb UWrhEakgDJU/Y2u4XRHG0ZufXKdA4Zx0nVa9zXWoINU2+guPDcTrzfMCMnb2EuZwNP2n9j2kn3W HceTeMOApo6kMJvEJcrDKLCaZzbgzchQ5wUZsfDTfYiB+6cKWqa04+vCJO8Jise6j22DWi3z3yG qeXQyUIaVk9UYI3RwKzFxbdw2AnK3jKWqHN7XrcfaoA4AknbbjU5CZeFdbMCDcXQov9P49xD9sh ZkBk/Ow+IyZDp3PFI7K+rorzXqBWOV4ca4ly6ZCi+74rmnh33JfRXgUybwydAixaVAzlH5P2cSY 0+b/8pHH46emiXn8f9djrRrVJVUU4FcVLqKUkUoKP2+ENLeGY8r3Df5kycuVUAb6OaGGzV1bKi5 8fvFLUcJv6Ex2cQHWwmhz9DqZy78tFRzm+eYKRa6JmW4HAmIx3+DVbnOmjNlpmFNbqZxadWxBOU MbBI2gfWo5BQUrSH17Q== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 phishscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300007 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.180.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0b-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374992924158500 Add the QTimer to the shared hex-subsys so both machine models pick it up. Map its view region, wire its interrupt lines into l2vic, and link it to the globalreg device backing HEX_SREG_TIMERLO/TIMERHI. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hexagon.h | 1 + include/hw/hexagon/hexagon_globalreg.h | 4 ++++ hw/hexagon/hex-subsys.c | 29 ++++++++++++++++++++++++++ hw/hexagon/hexagon_globalreg.c | 17 +++++++++++++++ hw/hexagon/Kconfig | 1 + 5 files changed, 52 insertions(+) diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index ec1578807d8..3d7b3cb12dc 100644 --- a/include/hw/hexagon/hexagon.h +++ b/include/hw/hexagon/hexagon.h @@ -159,6 +159,7 @@ struct HexagonCommonMachineState { MemoryRegion vtcm; DeviceState *cluster; DeviceState *l2vic; + DeviceState *qtimer; DeviceState *glob_regs; DeviceState *tlb; }; diff --git a/include/hw/hexagon/hexagon_globalreg.h b/include/hw/hexagon/he= xagon_globalreg.h index 397dc6854c9..07437dfabb1 100644 --- a/include/hw/hexagon/hexagon_globalreg.h +++ b/include/hw/hexagon/hexagon_globalreg.h @@ -11,6 +11,7 @@ #include "hw/core/qdev.h" #include "hw/core/sysbus.h" #include "hw/intc/hex-l2vic.h" +#include "hw/timer/qct-qtimer.h" #include "qom/object.h" #include "target/hexagon/cpu.h" =20 @@ -26,6 +27,9 @@ struct HexagonGlobalRegState { /* L2VIC interface used to back the VID/VID1 registers */ HexL2VicInterface *l2vic; =20 + /* QTimer interface used to back the TIMERLO/TIMERHI registers */ + QctQtimerInterface *qtimer; + /* Global performance cycle counter base */ uint64_t g_pcycle_base; =20 diff --git a/hw/hexagon/hex-subsys.c b/hw/hexagon/hex-subsys.c index 25c028f6579..12d4ec72d38 100644 --- a/hw/hexagon/hex-subsys.c +++ b/hw/hexagon/hex-subsys.c @@ -11,6 +11,7 @@ #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" #include "hw/intc/hex-l2vic.h" +#include "hw/timer/qct-qtimer.h" #include "hw/cpu/cluster.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" @@ -20,6 +21,13 @@ =20 #define HEX_L2VIC_CPU_IRQS 8 =20 +/* L2VIC input lines the QTimer's two frames are wired to. */ +#define HEX_QTIMER_L2VIC_IRQ0 3 +#define HEX_QTIMER_L2VIC_IRQ1 4 + +/* Number of QTimer frames instantiated for every Hexagon machine. */ +#define HEX_QTIMER_NR_FRAMES 3 + static DeviceState *l2vic_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *m_cf= g) { @@ -43,6 +51,24 @@ static void l2vic_connect_cpu(DeviceState *l2vic, Device= State *cpu) } } =20 +static DeviceState *qtimer_create(HexagonCommonMachineState *hms, + const struct hexagon_machine_config *m_c= fg) +{ + DeviceState *qtimer =3D qdev_new(TYPE_QCT_QTIMER); + + object_property_add_child(OBJECT(hms), "qtimer", OBJECT(qtimer)); + qdev_prop_set_uint32(qtimer, "nr_frames", HEX_QTIMER_NR_FRAMES); + sysbus_realize_and_unref(SYS_BUS_DEVICE(qtimer), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(qtimer), 0, m_cfg->csr_base); + sysbus_mmio_map(SYS_BUS_DEVICE(qtimer), 1, m_cfg->qtmr_region); + sysbus_connect_irq(SYS_BUS_DEVICE(qtimer), 0, + qdev_get_gpio_in(hms->l2vic, HEX_QTIMER_L2VIC_IRQ0)= ); + sysbus_connect_irq(SYS_BUS_DEVICE(qtimer), 1, + qdev_get_gpio_in(hms->l2vic, HEX_QTIMER_L2VIC_IRQ1)= ); + + return qtimer; +} + static DeviceState *globalreg_create(HexagonCommonMachineState *hms, const struct hexagon_machine_config *= m_cfg, Rev_t rev) @@ -54,6 +80,8 @@ static DeviceState *globalreg_create(HexagonCommonMachine= State *hms, qdev_prop_set_uint32(glob_regs, "dsp-rev", rev); object_property_set_link(OBJECT(glob_regs), "l2vic", OBJECT(hms->l2vic= ), &error_fatal); + object_property_set_link(OBJECT(glob_regs), "qtimer", OBJECT(hms->qtim= er), + &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(glob_regs), &error_fatal); =20 return glob_regs; @@ -110,6 +138,7 @@ void hex_subsys_create(HexagonCommonMachineState *hms, =20 hms->cluster =3D cluster_create(hms); hms->l2vic =3D l2vic_create(hms, m_cfg); + hms->qtimer =3D qtimer_create(hms, m_cfg); hms->glob_regs =3D globalreg_create(hms, m_cfg, rev); hms->tlb =3D tlb_create(hms, m_cfg); } diff --git a/hw/hexagon/hexagon_globalreg.c b/hw/hexagon/hexagon_globalreg.c index 285cb48c44b..61621cf2b8f 100644 --- a/hw/hexagon/hexagon_globalreg.c +++ b/hw/hexagon/hexagon_globalreg.c @@ -12,6 +12,7 @@ #include "hw/core/sysbus.h" #include "hw/core/resettable.h" #include "hw/intc/hex-l2vic.h" +#include "hw/timer/qct-qtimer.h" #include "migration/vmstate.h" #include "qom/object.h" #include "target/hexagon/cpu.h" @@ -141,11 +142,21 @@ static inline bool is_vid_reg(uint32_t reg) return reg =3D=3D HEX_SREG_VID || reg =3D=3D HEX_SREG_VID1; } =20 +static inline bool is_timer_reg(uint32_t reg) +{ + return reg =3D=3D HEX_SREG_TIMERLO || reg =3D=3D HEX_SREG_TIMERHI; +} + static uint32_t get_reg_value(HexagonGlobalRegState *s, uint32_t reg) { if (is_vid_reg(reg)) { return l2vic_read_vid(s->l2vic, reg =3D=3D HEX_SREG_VID ? 0 : 1); } + if (is_timer_reg(reg)) { + return reg =3D=3D HEX_SREG_TIMERLO ? + qct_qtimer_get_timer_lo(s->qtimer) : + qct_qtimer_get_timer_hi(s->qtimer); + } return s->regs[reg]; } =20 @@ -289,6 +300,10 @@ static void hexagon_globalreg_realize(DeviceState *dev= , Error **errp) error_setg(errp, "hexagon_globalreg: 'l2vic' link property not set= "); return; } + if (!s->qtimer) { + error_setg(errp, "hexagon_globalreg: 'qtimer' link property not se= t"); + return; + } } =20 static const VMStateDescription vmstate_hexagon_globalreg =3D { @@ -312,6 +327,8 @@ static const VMStateDescription vmstate_hexagon_globalr= eg =3D { static const Property hexagon_globalreg_properties[] =3D { DEFINE_PROP_LINK("l2vic", HexagonGlobalRegState, l2vic, TYPE_HEX_L2VIC_INTERFACE, HexL2VicInterface *), + DEFINE_PROP_LINK("qtimer", HexagonGlobalRegState, qtimer, + TYPE_QCT_QTIMER_INTERFACE, QctQtimerInterface *), DEFINE_PROP_UINT32("boot-evb", HexagonGlobalRegState, boot_evb, 0x0), DEFINE_PROP_UINT64("config-table-addr", HexagonGlobalRegState, config_table_addr, 0xffffffffULL), diff --git a/hw/hexagon/Kconfig b/hw/hexagon/Kconfig index c75090c44a1..83b2763d1e3 100644 --- a/hw/hexagon/Kconfig +++ b/hw/hexagon/Kconfig @@ -4,6 +4,7 @@ config HEX_DSP depends on HEXAGON select CPU_CLUSTER select HEX_L2VIC + select HEX_QTIMER =20 config HEX_VIRT bool --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785374951; cv=none; d=zohomail.com; s=zohoarc; b=KTDgUlvuBnU2qspSDh+0fDHu5M9e7KPzAcmlUtjw0cTH+u1N0RF7YchjRX/vJI0EqfiM/EZ6lB1JQyy8gAR3PINqevBjiO+TDHCWgML+4lMSCB2+bSOImKZrOWZpNOvRAr4dq9H40Vr9yXRoz39qh9gih8Dpk32fgb5S+sxjBPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785374951; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KBaJr3XWtRjBevD3bWEcda51JePQ2BTQOQh5d5bdXn0=; b=YcxCRQ3NyMV8ju3uG5JE0BcaUF0/eow13ef7QYpxTO3d2Whksa3BbFOJrK80bjHuYzMyShMCroeHOiLaz7ed52eWoO5ZqmoXHWdEvEYzXKf0VHOW0zwhUfmWm0C/ZDresV8mc/Fsia//oXn75s/AreKHlJd5rFOnVg8sRC+mk5g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785374951405889.322102888915; Wed, 29 Jul 2026 18:29:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFZv-0005ko-Ji; Wed, 29 Jul 2026 21:28:55 -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 1wpFZt-0005k6-VQ for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:53 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFZr-0005dt-Pc for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:28:53 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1Mvj1498155 for ; Thu, 30 Jul 2026 01:28:50 GMT Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvvy80p2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:50 +0000 (GMT) Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-c9c26587e67so256247a12.0 for ; Wed, 29 Jul 2026 18:28:50 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= KBaJr3XWtRjBevD3bWEcda51JePQ2BTQOQh5d5bdXn0=; b=pzPP1L8NKEPH9M5F KlT5wHny4IXxC5Mb3+dEerKqtqVPTfdzoL/XWXvpLBYMauoGRqGY3eJJCVRUWfHc KXxAWyFrSAcM3MdpZ6HLZv/rdQOHnNnbLinjAMuAf3SFw+hPINXgolFxxLF1dLLZ m+Z3Rn0/Pa7s/b78YurrHz/vDytono0nS4yGMwFR03EdvLA+5eYZqLscfBLSYwis m3jAhZn4MhmXHbwoTx7SuIfj6jlj/amYmmqPpHVZiIqt7KV54BldtXNdzKVeCBY2 Q0K55Boa7+Nhjng7telR+ktuYfXoBSoaLNOKqcJKmK4o0Z1bm73lT5ozdFuiufAZ KufYzA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374930; x=1785979730; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=KBaJr3XWtRjBevD3bWEcda51JePQ2BTQOQh5d5bdXn0=; b=ECsqr00RGoj2+SXLrzHbvdEgrs4ocd8OLE8/wno4PhpAXtn+2UpweoGs1CAtz85i4D jZoYl1K3s1gFknthg4c+Toculsog8nPn8o5zcv8PzCFzqgE7wjk09hgbvWR+fEnLMbHV qNxlfKOdIOkpoujfEgL4nOlNB7Sdit2bMXJmRsnw6J9qk9LJBPg9V/E2DNJG8A/n2LT3 +lgCRaMEUYrBcyv+PIy5e3+yuPuao47x+J+uJx6bc915Az7UnICPMZiVEnF1uTfzO0Mm iFXY1Pi/Ys7WOp49/sKzAb57mXkhGoRQ/E5S4EMON31nMo3drGOVtugaKZhDUXxJtsPr oewQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374930; x=1785979730; h=content-transfer-encoding:content-type: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 :content-type; bh=KBaJr3XWtRjBevD3bWEcda51JePQ2BTQOQh5d5bdXn0=; b=Uc6dC0ok51ISTqi7fE6yQMIDnT13A7qlhM4hWuKdw6r4J0THjyBQ031iBU2pagcO3L aZdATqfX4S+jIOGme720aAsNFzMnIMJxHd8WKbV5UBrphOD5x4AYb8nEHB62ZgOl8/J1 hljMq7YPThL9JJ5wgZWkXBnqStqfizM4SQPIgRJ93bPlJPrRhsiKVnHkeyyHl7M3v6sB LBGckvetQEY03xgO7DOMABmz4LgkcKVadl9VFclhi8Co+5aLodTZdi75E02ZdSi7OZkX FswLNqOZ1+Hfg7682vB3TH3aomtd01WiWmxHjfmiUXyI36FUKhlqERVk4yS53BXLrUxP mEKA== X-Gm-Message-State: AOJu0Yzfi1UI6EqCZgK23TWIVelwz8CvEba00QCQt633ZasZcAwzDvde cNlgX4Mf5FmsDeLZ+UVfMcHmoQYvPZDVJy8IhnBhymxO8pbma11LEPVWmmLmts9N0NTbbAarrvq acpX9lvu+REmdApasBIMs/3nYQiCk0fIW5YYwNaz/btEcLDArt6hI6mDMD9/5+4V3SA== X-Gm-Gg: AR+sD10Mm0bPiLPJxbp1ZnSnzpP8Tfkx1crk/8j+X39wTYPcXs9EJ2KodoYtLIYR+6Q lgv5c5yjpFZWjnYqS9/vjHc0OyU3OquTXtX7/XO5SNqmDFkkUp+ljYNziQNJZNcs9M4cd76ucVG BurBZRz0uY0haCxLdL4yFVL6hmMsy8D3TgG4JmeSVkPimYFa2qkddF8b3dA2v56eBIFlBCXSC/i VSO1pcvYe74dyuxP0LE0qbwIw+Uv1st3NE1iBh6vOVbFRRSZFZ56pxn8IEHnjsB8ZELN0O7pI3W NVM6PGMAuXJLvBnycsHxWYtmX3m0UUO/JeLGoLGj6vcKQq6xAvmJg7x9BSpOMLouswJNXMB8X7p 8btPX8UVCmQY4ZslA8ZaVaztZOAKNY/80VpEUpYCKuMyeNOaG X-Received: by 2002:a05:6a21:6915:b0:3ba:d7b0:fcac with SMTP id adf61e73a8af0-3c9013d9545mr310347637.5.1785374929699; Wed, 29 Jul 2026 18:28:49 -0700 (PDT) X-Received: by 2002:a05:6a21:6915:b0:3ba:d7b0:fcac with SMTP id adf61e73a8af0-3c9013d9545mr310322637.5.1785374929212; Wed, 29 Jul 2026 18:28:49 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 17/18] tests/qtest: add qct-qtimer qtest Date: Wed, 29 Jul 2026 18:28:22 -0700 Message-Id: <20260730012824.1135905-18-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX9377TpYX4Nw4 9TUCyOxB/lgh0Ii/aUe+gPYc0JKkDUjB7lUa+2LPj8AM0u2YG6mpFWsmKeQplXUaspR/DCvEfIg PiCxS1d9qMWTR2K1sezN2XojbajWMl31yZBjW/XDkWN7Ml+5BzGV2skcOQgMhvXpcW6IxHGGB7k iEr+wpFVDSawDR3ujUDSFA5Ddv0ksNYho6rZNJWsyZfWyFq2ERW0hUMqMrkmZn+wU+gEq5PxPEv 6G8Ybo6+tmy3cgIwIPzjczi5H3kTMCPJJVgsK9hzQsXySWMMuxEEdSn7qDhhxarA91HpnBNuTOn fA0mlH6VWnWeeo02BFmcqmaBVd+qSbIHOCij23mmkSwLYH23B+9TBSLDMSnRTVkp6ZTtELchXVp 4SUYoX6y6HlGkKaC1GqDC3bj5BlK2U4pn7n1MvlHpi+55lhYhuPKcITbM9/eH2jb0UClUWDEf7E dBhXxrP+D7CAILCohpw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX0lWfWB0yKDXZ YQ4/wg4O3jmk7chyVqAmvwnxtISi9RHrRA+jh36eZwgUQIcKN5C0vxZ5QAjFTsHyv75geRoIKlE e7Hx0p/BE38IjN2Vs4s8xVotmj0Isjo= X-Authority-Analysis: v=2.4 cv=U8+iy+ru c=1 sm=1 tr=0 ts=6a6aa8d2 cx=c_pps a=oF/VQ+ItUULfLr/lQ2/icg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=6hjWF1eGZ68i2kMWmpgA:9 a=QEXdDO2ut3YA:10 a=3WC7DwWrALyhR5TkjVHa:22 X-Proofpoint-GUID: iNx2qKU-MuRXPSmkeZmUP4JSuAWozM-p X-Proofpoint-ORIG-GUID: iNx2qKU-MuRXPSmkeZmUP4JSuAWozM-p X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785374953298158500 Add a qtest exercising the QCT QTimer's register access, view-region frame addressing, and one-shot timer firing behavior. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- MAINTAINERS | 1 + tests/qtest/qct-qtimer-test.c | 269 ++++++++++++++++++++++++++++++++++ tests/qtest/meson.build | 2 +- 3 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/qct-qtimer-test.c diff --git a/MAINTAINERS b/MAINTAINERS index de106416b64..0e0b99084df 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -255,6 +255,7 @@ F: include/hw/intc/hex-l2vic.h F: tests/qtest/l2vic-test.c F: hw/timer/qct-qtimer.c F: include/hw/timer/qct-qtimer.h +F: tests/qtest/qct-qtimer-test.c X: target/hexagon/idef-parser/ X: target/hexagon/gen_idef_parser_funcs.py F: linux-user/hexagon/ diff --git a/tests/qtest/qct-qtimer-test.c b/tests/qtest/qct-qtimer-test.c new file mode 100644 index 00000000000..3ac0c96bb70 --- /dev/null +++ b/tests/qtest/qct-qtimer-test.c @@ -0,0 +1,269 @@ +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + * SPDX-License-Identifier: GPL-2.0-or-later + * + * QTest testcase for the QCT QTimer + */ + +#include "qemu/osdep.h" +#include "libqtest-single.h" +#include "hw/hexagon/hexagon.h" +#include "qemu/bitops.h" + +#include "hw/hexagon/machine_cfg_v68n_1024.h.inc" +#include "hw/hexagon/machine_cfg_v66g_1024.h.inc" + +#define QTIMER_DEFAULT_FREQ_HZ 19200000ULL + +#define QCT_QTIMER_CNTPCT_LO (0x000) +#define QCT_QTIMER_CNT_FREQ (0x010) +#define QCT_QTIMER_CNTP_CVAL_LO (0x020) +#define QCT_QTIMER_CNTP_TVAL (0x028) +#define QCT_QTIMER_CNTP_CTL (0x02c) + +#define QCT_QTIMER_AC_CNTFRQ (0x000) +#define QCT_QTIMER_AC_CNTSR (0x004) +#define QCT_QTIMER_AC_CNTTID_0 (0x08) +#define QCT_QTIMER_AC_CNTACR_START (0x40) + +static uint64_t qtimer_view_base; +static uint64_t qtimer_ac_base; + +#define TIMER_TEST_OFFSET 1000 +/* TIMER_TEST_OFFSET ticks expressed in nanoseconds of QEMU_CLOCK_VIRTUAL = */ +#define TIMER_TEST_NS \ + ((TIMER_TEST_OFFSET * 1000000000ULL) / QTIMER_DEFAULT_FREQ_HZ) + +static uint32_t qtimer_read32(uint64_t base, uint32_t offset) +{ + return readl(base + offset); +} + +static void qtimer_write32(uint64_t base, uint32_t offset, uint32_t value) +{ + writel(base + offset, value); +} + +static uint64_t qtimer_read64(uint64_t base, uint32_t offset) +{ + uint32_t lo =3D qtimer_read32(base, offset); + uint32_t hi =3D qtimer_read32(base, offset + 4); + + return ((uint64_t)hi << 32) | lo; +} + +static void qtimer_write64(uint64_t base, uint32_t offset, uint64_t value) +{ + qtimer_write32(base, offset, extract64(value, 0, 32)); + qtimer_write32(base, offset + 4, extract64(value, 32, 32)); +} + +static void test_qtimer_basic_access(void) +{ + uint32_t val; + + val =3D qtimer_read32(qtimer_view_base, QCT_QTIMER_CNT_FREQ); + g_assert_cmpuint(val, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); +} + +static void test_qtimer_multiple_frames(void) +{ + uint32_t val; + uint64_t frame0_base =3D qtimer_view_base; + uint64_t frame1_base =3D qtimer_view_base + 0x1000; + + val =3D qtimer_read32(frame0_base, QCT_QTIMER_CNT_FREQ); + g_assert_cmpuint(val, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); + + val =3D qtimer_read32(frame1_base, QCT_QTIMER_CNT_FREQ); + g_assert_cmpuint(val, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); +} + +static void test_qtimer_register_reads(void) +{ + qtimer_read32(qtimer_view_base, QCT_QTIMER_CNT_FREQ); + qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO); + qtimer_read32(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + qtimer_read32(qtimer_view_base, QCT_QTIMER_CNTP_TVAL); +} + +static void test_qtimer_control_registers(void) +{ + uint32_t ctl_val; + uint64_t cval_before, cval_after; + + cval_before =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + + qtimer_write32(qtimer_view_base, QCT_QTIMER_CNTP_TVAL, 1000); + + qtimer_write32(qtimer_view_base, QCT_QTIMER_CNTP_CTL, 1); + ctl_val =3D qtimer_read32(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + g_assert_cmpuint(ctl_val & 1, =3D=3D, 1); + + /* CVAL should be greater than before since we set TVAL */ + cval_after =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO= ); + g_assert_cmpuint(cval_after, >, cval_before); + + qtimer_write32(qtimer_view_base, QCT_QTIMER_CNTP_CTL, 0); + ctl_val =3D qtimer_read32(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + g_assert_cmpuint(ctl_val & 1, =3D=3D, 0); +} + +static void test_qtimer_cval_access(void) +{ + uint64_t current_time, test_cval, read_cval; + + current_time =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + test_cval =3D current_time + 10000; + + qtimer_write64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO, test_cval); + read_cval =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO); + g_assert_cmpuint(read_cval, =3D=3D, test_cval); +} + +static void test_qtimer_counter_progression(void) +{ + uint32_t freq; + uint64_t count1, count2; + + /* + * In qtest mode the virtual clock does not advance on its own, so + * reading the counter twice must give the same value. + */ + count1 =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + count2 =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + g_assert_cmpuint(count2, =3D=3D, count1); + + freq =3D qtimer_read32(qtimer_view_base, QCT_QTIMER_CNT_FREQ); + g_assert_cmpuint(freq, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); +} + +static void test_qtimer_timer_behavior(void) +{ + uint64_t current_count, target_count, read_cval, new_count; + uint64_t ctl_val, count_after_disable; + + current_count =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO= ); + + target_count =3D current_count + TIMER_TEST_OFFSET; + qtimer_write64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO, target_count= ); + + read_cval =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CVAL_LO); + g_assert_cmpuint(read_cval, =3D=3D, target_count); + + qtimer_write32(qtimer_view_base, QCT_QTIMER_CNTP_CTL, 1); + + ctl_val =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + /* EN set, IMASK clear, ISTAT not yet pending */ + g_assert_cmpuint(ctl_val, =3D=3D, 0x1); + + /* Step forward but not past the target */ + qtest_clock_step(global_qtest, TIMER_TEST_NS / 2); + new_count =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + g_assert_cmpuint(new_count, >=3D, current_count); + + /* Step past the target */ + qtest_clock_step(global_qtest, TIMER_TEST_NS); + new_count =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTPCT_LO); + g_assert_cmpuint(new_count, >=3D, target_count); + + qtimer_write32(qtimer_view_base, QCT_QTIMER_CNTP_CTL, 0); + + ctl_val =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + /* EN cleared, ISTAT set since new_count >=3D target_count */ + g_assert_cmpuint(ctl_val, =3D=3D, 0x4); + + /* + * CNTPCT runs independently of CNTP_CTL.EN: only the compare/IRQ + * logic is gated by EN, so the counter must keep advancing. + */ + qtest_clock_step(global_qtest, TIMER_TEST_NS / 2); + count_after_disable =3D qtimer_read64(qtimer_view_base, + QCT_QTIMER_CNTPCT_LO); + g_assert_cmpuint(count_after_disable, >, new_count); + + /* ISTAT remains set while CNTPCT >=3D CVAL, even with EN=3D0 */ + ctl_val =3D qtimer_read64(qtimer_view_base, QCT_QTIMER_CNTP_CTL); + g_assert_cmpuint(ctl_val, =3D=3D, 0x4); +} + +/* Test the access-control region: CNTFRQ, CNTSR, CNTTID_0, CNTACR frame 0= */ +static void test_qtimer_ac_region(void) +{ + uint32_t freq, sr, tid0, acr0; + + freq =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTFRQ); + g_assert_cmpuint(freq, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); + + /* A write of 0 to CNTFRQ must be ignored (freq-hz must stay nonzero).= */ + qtimer_write32(qtimer_ac_base, QCT_QTIMER_AC_CNTFRQ, 0); + freq =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTFRQ); + g_assert_cmpuint(freq, =3D=3D, QTIMER_DEFAULT_FREQ_HZ); + + qtimer_write32(qtimer_ac_base, QCT_QTIMER_AC_CNTSR, 0x3); + sr =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTSR); + g_assert_cmpuint(sr, =3D=3D, 0x3); + + tid0 =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTTID_0); + g_assert_cmpuint(tid0, =3D=3D, 0x11); + + /* CNTACR for frame 0 defaults to full read/write permissions. */ + acr0 =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTACR_START); + g_assert_cmpuint(acr0, !=3D, 0); + + qtimer_write32(qtimer_ac_base, QCT_QTIMER_AC_CNTACR_START, 0); + acr0 =3D qtimer_read32(qtimer_ac_base, QCT_QTIMER_AC_CNTACR_START); + g_assert_cmpuint(acr0, =3D=3D, 0); + + /* Restore full permissions so later view-region tests keep working. */ + qtimer_write32(qtimer_ac_base, QCT_QTIMER_AC_CNTACR_START, 0x3f); +} + +typedef struct { + const char *machine; + const struct hexagon_machine_config *cfg; +} QtimerMachineCfg; + +static const QtimerMachineCfg qtimer_machines[] =3D { + { "virt", &v68n_1024 }, + { "V66G_1024", &v66g_1024 }, +}; + +static void test_qtimer_on_machine(gconstpointer data) +{ + const QtimerMachineCfg *mc =3D data; + g_autofree char *args =3D g_strdup_printf( + "-machine %s -global qct-qtimer.freq-scale=3D1", mc->machine); + + qtimer_view_base =3D mc->cfg->qtmr_region; + qtimer_ac_base =3D mc->cfg->csr_base; + + qtest_start(args); + + test_qtimer_basic_access(); + test_qtimer_multiple_frames(); + test_qtimer_register_reads(); + test_qtimer_control_registers(); + test_qtimer_cval_access(); + test_qtimer_counter_progression(); + test_qtimer_timer_behavior(); + test_qtimer_ac_region(); + + qtest_end(); +} + +int main(int argc, char **argv) +{ + size_t i; + + g_test_init(&argc, &argv, NULL); + + for (i =3D 0; i < ARRAY_SIZE(qtimer_machines); i++) { + g_autofree char *path =3D g_strdup_printf("/qct-qtimer/%s/all-test= s", + qtimer_machines[i].machine= ); + qtest_add_data_func(path, &qtimer_machines[i], test_qtimer_on_mach= ine); + } + + return g_test_run(); +} diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index a76863c7dd6..651246b2ebb 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -299,7 +299,7 @@ qtests_riscv64 =3D ['riscv-csr-test'] + \ ['iommu-riscv-test'] : []) + \ (config_all_devices.has_key('CONFIG_K230') ? ['k230-wdt-test'] : []) =20 -qtests_hexagon =3D ['boot-serial-test', 'l2vic-test'] +qtests_hexagon =3D ['boot-serial-test', 'l2vic-test', 'qct-qtimer-test'] =20 qos_test_ss =3D ss.source_set() qos_test_ss.add( --=20 2.34.1 From nobody Mon Sep 28 02:07:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=oss.qualcomm.com ARC-Seal: i=1; a=rsa-sha256; t=1785375016; cv=none; d=zohomail.com; s=zohoarc; b=U9Xr8MpeP/CSVwRVKeoTV0TiAmpK8kAySN3RTpNwAPfiMUXoWcfpKlQCONyc/ulxyNj9zi+GQDkKiwAmxvbnLXPRusRpqasUZ0F03A2yXW9sG+XZHY91CjZbcOxQslbl0UzhMCS1sxNHbAb7YwFQR57m2kIM92gcJr+lhY4+4Yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785375016; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GhQnLWWiUGO5P3NDVBX5O4g6byktQ5bXhd4epAk9mqk=; b=oFErx70+ZxZKGj12HEzMpt1kBYPzAYkezIccJFjMsXOu5rDjzFUUOnsGSerQ+Jnsy9Kns80QREzCMNS85xBK8PE1b0yjwJqvvUVYZwX0fcZNISBGF/WGvh5HM1aBserv/XvEYoG7DJdHkzA9ZqVz/vcTjo4PAQ7BtM+QqDMEluM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1785375016501308.5426496810903; Wed, 29 Jul 2026 18:30:16 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wpFa7-0005ll-Ao; Wed, 29 Jul 2026 21:29:07 -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 1wpFa5-0005lc-R3 for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:29:05 -0400 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1wpFa4-0005eI-Ba for qemu-devel@nongnu.org; Wed, 29 Jul 2026 21:29:05 -0400 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66U1M9K0496719 for ; Thu, 30 Jul 2026 01:28:53 GMT Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fqvvy80p6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 30 Jul 2026 01:28:52 +0000 (GMT) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2cec4226c70so27817185ad.1 for ; Wed, 29 Jul 2026 18:28:52 -0700 (PDT) Received: from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31504dab0f3sm13242162eec.27.2026.07.29.18.28.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 18:28:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= GhQnLWWiUGO5P3NDVBX5O4g6byktQ5bXhd4epAk9mqk=; b=LLgjyEcpr0MXUAau hDKIRpWtFMFINrtw8WoMdwuBpXE+dyodT7m3XWK+I3x4ijWQr62qlGtsTZT+eOu4 AZHYZeWQZp8y9V2O7AZ0SLLS98bLS+iXEnv8i0IwGXVqUQG4zUZHq0+aRolAa3iQ kxGiik+hSSzwQsbiOEL79o3BQbYKDSN2nIV40LrLgyovsG2wS34OXuVJtc8tUubB ytQvVAzIFkQezQWVdzfXzsV1OysF2WpCQzbQi1Ux4puE1yYW2SQ9uweG5pb0Mn17 qPqD6gxg9kO0Kpb/tEhGIcAu1547gmF7jOuerRhb6mKp1jw8VCNIHbdFbWgcQI6t otJDRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785374932; x=1785979732; darn=nongnu.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=GhQnLWWiUGO5P3NDVBX5O4g6byktQ5bXhd4epAk9mqk=; b=DKEPfXy7ylX7th1xupuCdypATymWnht6mvCnVluxNPaVvkNASRHCKDBHZZcVMVI+ma s9hIf2ANTkotaAVXiHQcCq+esxCiPmzLHruwHlPtDvNgPT39sMwu6obPgVZDzbrdvH7O pU423twOsr+08SlKmP5xlr6JM6y5IxKfPErlrCGxSmi7XE3mmOzOM1Zhp0Ylo7vSeOAh QWsXU81IWD59IeA6iYuf7s6Lcdd+MstmNGWNHuuz6AwWzCDaAcpTSQaXK4DrhtiuL15Q l9CsMqdUxe2cLkLyPC9UAfaRQAz5H1NhYNvf/D4m3c/zREcjTTD+3LvsrxEMcBiMITUD ejtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785374932; x=1785979732; h=content-transfer-encoding:content-type: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 :content-type; bh=GhQnLWWiUGO5P3NDVBX5O4g6byktQ5bXhd4epAk9mqk=; b=X2WsCDeyE75jaQldLoO0ej2ZbScvRYjS4FX9IAeEC49kPTnyX2pAmuS+Oj1pHmIlOx t6bGQAW3MxbvmAHRF/oOB1gMdYr2wEHkofYlgVjhOHkCaq5qybSIceiWHOnjxiucaJ+g eAhAkFOxaIObtGdNOg+/SlXvy202/M8TttokCL7pyMnstLqliDpbF726E9t/eQEQotr+ biCDSpBweA9MYlMcuI8wDhKeVuIoIv95VON15SkL7eWhZIDjWbX4r6BPzy57ngH+dIb1 7jUEfB4oAufDQtM2jU6M1XlsAT09Aq55AUovpHTDXXhU2z2i8iRMjxNDqOAyk9Hnm16T DC6Q== X-Gm-Message-State: AOJu0YyY/JmKSJinZegDDUqZIy1DlSNF9fphXLdkEEvQ1scKQVaLayMG RI28Oe8oRTYOkn45RoxzzoogcCE+z9FslmcSVHj5EhOmDjOfTmNqlJsTi+Z2HzQwkj0qNDdUcpp SdwDIVp/LpqCqkerdkSqW3NEyNy2dbaOIV1hfrlAwzBJN2cHaiLCoQ3hKxHe4dztbNA== X-Gm-Gg: AR+sD11FvkYGsGVo6HFibumLjGonVWOdvqcGXMeJv+3h09olRJCi93mnX7/qW8BPLwN SA0ByHmQoATuHj/OgEfBzVahoZjrkUF0VXQUmaaESlcIxo/rQTG6a+5O8tAuyTYqFQ9tWdIdUj/ RBYECQCuOhqbxCiubhta2JqYgH9gMRXKac7fjDbqTdwwFu7K8mqgTqM+/IwOjse8V8v4QWJofmw 08PNFKDFGvpyZuC+eP6ceTXhMajjj+YmXYSLZuY12kmpvoaNiNudR0yEwNGgDgP7A0T7PTMi0Qk w7mNk1HVxQMdQ/uaJ5MRCTG/1aoh08cSHUjg5cIRMKAGJxw4P7/YdFxxWwgFTyayRMdQAvP3UmI fDkk1uPkBlq7LCa/o4Co82R6REScOBfwvHgp/DCVtK/d7D+Ay X-Received: by 2002:a17:90b:1649:b0:37f:9ce1:7364 with SMTP id 98e67ed59e1d1-38f9bed3bccmr614941a91.26.1785374931327; Wed, 29 Jul 2026 18:28:51 -0700 (PDT) X-Received: by 2002:a17:90b:1649:b0:37f:9ce1:7364 with SMTP id 98e67ed59e1d1-38f9bed3bccmr614912a91.26.1785374930846; Wed, 29 Jul 2026 18:28:50 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: philmd@oss.qualcomm.com, Pierrick Bouvier , Fabiano Rosas , Laurent Vivier , Paolo Bonzini , Brian Cain , matheus.bernardino@oss.qualcomm.com Subject: [PATCH v4 18/18] tests/functional/hexagon: enable more arch_tests cases Date: Wed, 29 Jul 2026 18:28:23 -0700 Message-Id: <20260730012824.1135905-19-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> References: <20260730012824.1135905-1-brian.cain@oss.qualcomm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX6KpfO+NYLgCW cC/UgXf7V73BewF6EAht1BeYnZ2CvDnF1plYiHLVT8y2mtpb2Ubk2g6ZUPbWX5ygk8Ev8v7hHP8 HDH/ieQ37lbUqihoCH/9te8A9rtIeHnJzQ7xBfrB7FpST4icFXXHYwN5U5lZ4wVdOu9ZvHIBaVV GeWysdk2fa5u5qM8jRP4YXiNCqDG+Oq4r3uDX3iidxPzB12Lq9d3ntWMPQ4doW3IYr5wrt+dzG+ gw3HGDb3ocvZ4gulGkw5TG7FUP9dAhwUoeVuvBb7brQC6+T4jpk0kbOYWhf0yok3279kioGmA6+ gjLqCluTE03nEVSKDQBBws4ZpfAeL8znJY5pp5ZaTjVBbF6pKWcnJ2vZup1t3hZ74moeNxVYYV8 Mf4UokTYq2ySQcebkVx/um7mc2Gq6KZRQXL2YntRKRxHWLZPE11W0K0O96Mdwa2PmF66ETeZv/K ft6Wz6KbF0e3tyTFIQw== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzMwMDAwNiBTYWx0ZWRfX9Fa50HEDUIpy N2vYLNLdYgMZhEiPRz8FBdLtOl4mCkObgckFRuP83BzCqdWSRW+/T87WRY5w3/C21HAy5R/BkyJ nPz+n1LGD7u7nQ+XtWHDwTQ+kG837ko= X-Authority-Analysis: v=2.4 cv=U8+iy+ru c=1 sm=1 tr=0 ts=6a6aa8d4 cx=c_pps a=JL+w9abYAAE89/QcEU+0QA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=6_sklNI9eh_OQcpcNH0A:9 a=QEXdDO2ut3YA:10 a=324X-CrmTo6CU4MGRt3R:22 X-Proofpoint-GUID: XVAlyXXhdfP3JO1dnTRbHilC4wjGdJrM X-Proofpoint-ORIG-GUID: XVAlyXXhdfP3JO1dnTRbHilC4wjGdJrM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-29_09,2026-07-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 adultscore=0 priorityscore=1501 phishscore=0 clxscore=1015 suspectscore=0 bulkscore=0 spamscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607300006 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=205.220.168.131; envelope-from=brian.cain@oss.qualcomm.com; helo=mx0a-0031df01.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @qualcomm.com) X-ZM-MESSAGEID: 1785375016789158500 Add more tests from hexagon-arch-tests, enabled by QTimer device. These exercise cache maintenance ops, l2vic, thread start/stop, tlb/mmu operations, and user-mode transitions. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- tests/functional/hexagon/test_arch_tests.py | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/functional/hexagon/test_arch_tests.py b/tests/functional= /hexagon/test_arch_tests.py index 2bb34f9b8dc..0834398c3b1 100755 --- a/tests/functional/hexagon/test_arch_tests.py +++ b/tests/functional/hexagon/test_arch_tests.py @@ -58,6 +58,38 @@ def test_int_steering(self) -> None: """ self.run_uart_test("test_int_steering") =20 + def test_cache(self) -> None: + """Tests cache operations: dckill/ickill, l2kill, dczeroa, + dccleaninva, cache disable/enable, barriers, and dcinva/dccleana. + """ + self.run_uart_test("test_cache") + + def test_l2vic(self) -> None: + """Tests the L2VIC interrupt controller: enable readback, + interrupt type readback, VID capture, and the fast interface. + """ + self.run_uart_test("test_l2vic") + + def test_threads(self) -> None: + """Tests hardware thread management: start/stop, MODECTL state, + per-thread HTID, shared memory, wait/resume, STID priority, and + SCHEDCFG/BESTWAIT readback. + """ + self.run_uart_test("test_threads") + + def test_tlb_mmu(self) -> None: + """Tests TLB/MMU operations: write/read/probe/invalidate, + global entries, multiple entries, overwrite, ASID matching, + and permission checks. + """ + self.run_uart_test("test_tlb_mmu") + + def test_user_mode(self) -> None: + """Tests user mode / privilege transitions: supervisor mode, + SSR UM/IE/XE/CE/PE bits, and the trap0 user-mode exit handler. + """ + self.run_uart_test("test_user_mode") + =20 if __name__ =3D=3D "__main__": QemuSystemTest.main() --=20 2.34.1