From nobody Sun Sep 20 21:49:26 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=1784044339; cv=none; d=zohomail.com; s=zohoarc; b=RSXIig32gV+Sa843k585Y2s6V8QkGtUxcf6zVqj3Q9E4sw0qlbdtuvAyVm2FZz8L6//2rJZvquLe5V3kYX111NHnNun9HzMDUBZXLBUW9E3fUWTndybFNgF7peDHvARr0hrC7UafnPgLUUwW2BFrUlu7eS/ZrXwWw+rJfvgIe/8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1784044339; 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=RvDTigIKJjsKosJ3emR2R076QugkRC4yRGucJVActXs=; b=fQaVwYIEUSQK3HlCuoBKLL0ypy1wm91Hx3h2jNk++Pnjgt6jUHUXm9odaUsaH0za1wLYfnGwSaZSsWMsi6AVakJHLTM0PLxykeCGq/HgnfEc/0EXPIn+L4QHQlI/DwkiDfJybZ8LxbJbu3LE8WaM/YwIyqbgBEKpqkqQCIyC104= 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 1784044339903349.19405517209066; Tue, 14 Jul 2026 08:52:19 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1wjfQ6-0000zO-GV; Tue, 14 Jul 2026 11:51: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 1wjfQ4-0000yu-K6 for qemu-devel@nongnu.org; Tue, 14 Jul 2026 11:51:40 -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 1wjfQ2-00014Z-LD for qemu-devel@nongnu.org; Tue, 14 Jul 2026 11:51:40 -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 66EEchAx824377 for ; Tue, 14 Jul 2026 15:51:37 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 4fdbr4b43m-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 14 Jul 2026 15:51:37 +0000 (GMT) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-c9d5a5b63c5so6642835a12.1 for ; Tue, 14 Jul 2026 08:51: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 a92af1059eb24-13b987fc629sm41343581c88.0.2026.07.14.08.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 08:51: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= RvDTigIKJjsKosJ3emR2R076QugkRC4yRGucJVActXs=; b=BW9UaLkdNnj7ZKEy XEKMmuMPNrwrz3TYkCGaXJuDyC4izHF4RFNLsr88gf9P9q46SesQxhbETFVo8Gnc 7zh4Nor67T5CD5Q1+UKjfi3rigoV5qkFEuF2BxjzOnO1AkKdP6PgQ4sV46ZxTBWv ry7tmHB3VqQp8fOxyVlzUT4MLLBLXdNznPtOysM3fGLP9kkVg0YEOCuYTLrAmw2r 5xLMnPYEBhQ6rx/rRHzSEMgW0HaMBCvTYO//wZ0Qm/FuJSVebum2ct5J99iY8wiV sMH7MN/xer5c9266goTZ1Xqh6Ne7yWz35b9vZgRtsgpnn88sTd1Df5uwsAGmG2qr V32VVg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784044297; x=1784649097; 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=RvDTigIKJjsKosJ3emR2R076QugkRC4yRGucJVActXs=; b=h4QphwVTx2DzmRzIDYQE6+XXdJRPlt9AaIyUsvJJJEd3Wq4g26KzrVN+QKRYCxs8xG f4ma8A4cBi4cz9heE0SobrgAY5sDmX8Cy7MdXW/Hhoka4tRpsT8NrmZjvkEzVPgt6wRY y4/xNlS79GO87OhrcJeZ0x5W201p3cnQgu0RZaUSpGikKrNzW+3k7xhYULhyUh9X9QEt ppTvbfqn9pTCZNtnEKsBniS0SSWRtrg3sf104AI9qTiX2IafmfHbzIw9/Eh1TVdx8MHW wYfmy8nzjhQK934T5ODPzQXli+ALwbvEtLmCY6GjMAkbO/FdyUPsETZQ4E1w6AUul2uD wiFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784044297; x=1784649097; 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=RvDTigIKJjsKosJ3emR2R076QugkRC4yRGucJVActXs=; b=Jjn5095evE/QMYbDE6py9U67s2MpbLNJ+pBbwSdd2MYIuwt4YjgJOs76rGislO7fus Po9LqvTNN3EqtbXkVhVhaGBIF5DgAR847qbMGWP7/URo9f3wiOfyruHyr/+hIXRvLGdQ VTEF3isugHGslgMp94fdI8q12ZLn3mtVko5Nu1gTdofb2TPOSuy/j4lll4Ypta6q26uR pPK6BrX+YRH5Kp6o3yVPDxKyX6ob9P+SOk/HKm3ByJg+p/oe2sRA4AYnf8R0rXF7Ri4D 5QcaGkDOE+yi645vAay8QbxKcLE8CWMFRV7U61Ke39GY5nTDnuEM7hrGOZzSeMm/+tVB lbmA== X-Gm-Message-State: AOJu0Yxpbfn71qLu3hQfSRrZ6cKoOmuNMTZbYMngje1b634mR7NsNJgH H77zGdPRmrT9c7H8DuPWrud5iTOaO6wBQFQMM1VWZbCsmhgZDM1Ikz8oL0bscvqXLHxce978bYC cZg5gx49CKklVSyZ4rF9B3iTuVYoUfXoTRkGRkhPqdkjd+u737xPfN4A8H59pDSkoOA== X-Gm-Gg: AfdE7cmo+gq2P+baYl3TkZg0OoEv4Swk93n7U18kwJ5Jq2Jvvm4G9XDgB0RrBSnXV6X gK7V7GhfVryLOae3Y21yTot3SyN3shOax9cv7pUHzaqrTIWY5dz9cxd9vVfG5z/E+oANCxDn9lI ZRHSbdnng28nlihSoSiD93Ri4JrcWTL5VT6/S3CjXRH+RL2Ou8Yazqinfp8051ksoOqCF7nZApr MWI8tNt2BjF+VIRmpQ1YPUx9J8Gf0TSf29Ylr8hDoLpEISYckHwpMnaVVtvBp001iamUFxX2DS2 pRg1SB0866vLrwGQ8arDw27ZQ+SkKJ2eP+Jg+s98dU7IWvnhO+4nWHw6NqJPMORr/hGuryM2bQA Hnu/PX7FnBLx4sS2UH4QGq6Wz/z8sao1ZZvUZJyHVXIrysIdoG/idukYziB8= X-Received: by 2002:a05:6a20:d818:b0:3b4:e4f0:94e1 with SMTP id adf61e73a8af0-3c3571d0443mr3857580637.39.1784044296495; Tue, 14 Jul 2026 08:51:36 -0700 (PDT) X-Received: by 2002:a05:6a20:d818:b0:3b4:e4f0:94e1 with SMTP id adf61e73a8af0-3c3571d0443mr3857551637.39.1784044296012; Tue, 14 Jul 2026 08:51:36 -0700 (PDT) From: Brian Cain To: qemu-devel@nongnu.org Cc: ltaylorsimpson@gmail.com, Laurent Vivier , Thomas Huth , Paolo Bonzini , matheus.bernardino@oss.qualcomm.com, Fabiano Rosas , Brian Cain , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , philmd@oss.qualcomm.com, pierrick.bouvier@oss.qualcomm.com, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 5/7] hw/hexagon: connect l2vic device Date: Tue, 14 Jul 2026 08:51:24 -0700 Message-Id: <20260714155126.3509544-6-brian.cain@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260714155126.3509544-1-brian.cain@oss.qualcomm.com> References: <20260714155126.3509544-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: LjbopdRuKRYxHZqFI2wDCd9QOYkWMPbv X-Proofpoint-ORIG-GUID: LjbopdRuKRYxHZqFI2wDCd9QOYkWMPbv X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE0MDE2NCBTYWx0ZWRfX0VXXt7v54x2d vd4uxF+f43Nh86/20qu2dh22myrSUnrSOq6XUiSWh5LCxjIF8HRZGMoVASMHV4Z0xsHc2tuqPZk 8sHtXrKzAGZ11cYGYaSc46EN06rvS8R6YbD+BG8G1Cv2rQMqrmjoDs9ibe4k3i5QocbIKEvxD1t iayxG5hHr26wN7nVScPH52DXdTRqOmgzQsY+qYDu9K81eQ09d5Ixp8hbz0Oi7XwkRqITkPcBRa5 d6y+892yuP/P1iDNSs7km5nizHNknk01GJMqKBLB1ruo3rL3l3xyAn8We/dp+2iTdqhqk+dBKRn u8LTKfvKBeh9NjIGu7rVyYXVb+QnVYo5JiTWhxqO9mOkFb8ab5HJXOnI/RM6TkcI0JjD06Ndefp 405E4gYzthCaDF1Bv2d7BvufT1JF84Hmbz1RZq96nQB1qCMBgLumaJwYW+yazlyG7tYStLUPqYM T4umEfPscYmVKxVB0iw== X-Authority-Analysis: v=2.4 cv=F5hnsKhN c=1 sm=1 tr=0 ts=6a565b09 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=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=ch7oxrfPrZXSMDqqmA0A:9 a=QEXdDO2ut3YA:10 a=x9snwWr2DeNwDh03kgHS:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE0MDE2NCBTYWx0ZWRfX1XCF3BWj2V8j FtxDd654BO7SVBjDa6lhMoUCpxkAQKJHroUuryuq4bd8gUvtGuhvS76HXxaBGw3ciPENYGZnIRW JnTzdET6VgQR3m4i7f7yIXt01YTrT5w= 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-14_03,2026-07-14_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 malwarescore=0 priorityscore=1501 suspectscore=0 clxscore=1015 adultscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607140164 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: 1784044341482158500 Instantiate the L2VIC device in both machine models, map its slow and MMIO regions, and link it to each CPU via the "l2vic" property. Signed-off-by: Brian Cain Reviewed-by: Pierrick Bouvier --- include/hw/hexagon/hexagon.h | 1 + include/hw/hexagon/hexagon_globalreg.h | 4 +++ hw/hexagon/hexagon_dsp.c | 20 +++++++++++++ hw/hexagon/hexagon_globalreg.c | 41 ++++++++++++++++++++++---- hw/hexagon/virt.c | 22 ++++++++++++++ 5 files changed, 83 insertions(+), 5 deletions(-) diff --git a/include/hw/hexagon/hexagon.h b/include/hw/hexagon/hexagon.h index 1034b09c2ac..6753ae32cde 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; + DeviceState *l2vic_dev; }; =20 #endif 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/hexagon_dsp.c b/hw/hexagon/hexagon_dsp.c index aa493993229..4cf88627c8f 100644 --- a/hw/hexagon/hexagon_dsp.c +++ b/hw/hexagon/hexagon_dsp.c @@ -16,6 +16,7 @@ #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" +#include "hw/intc/hex-l2vic.h" #include "hw/core/loader.h" #include "qapi/error.h" #include "qemu/error-report.h" @@ -111,6 +112,7 @@ static void hexagon_common_init(MachineState *machine, = Rev_t rev, MemoryRegion *address_space; DeviceState *glob_regs_dev; DeviceState *tlb_dev; + DeviceState *cpu0 =3D NULL; =20 memset(&hexagon_binfo, 0, sizeof(hexagon_binfo)); if (machine->kernel_filename) { @@ -131,11 +133,21 @@ static void hexagon_common_init(MachineState *machine= , Rev_t rev, machine->ram_size, &error_fatal); memory_region_add_subregion(address_space, 0x0, &hms->ram); =20 + hms->l2vic_dev =3D qdev_new(TYPE_HEX_L2VIC); + object_property_add_child(OBJECT(machine), "l2vic", + OBJECT(hms->l2vic_dev)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(hms->l2vic_dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(hms->l2vic_dev), 0, m_cfg->l2vic_base); + sysbus_mmio_map(SYS_BUS_DEVICE(hms->l2vic_dev), 1, + m_cfg->cfgtable.fastl2vic_base << 16); + 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); + object_property_set_link(OBJECT(glob_regs_dev), "l2vic", + OBJECT(hms->l2vic_dev), &error_fatal); sysbus_realize_and_unref(SYS_BUS_DEVICE(glob_regs_dev), &error_fatal); =20 tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); @@ -154,15 +166,23 @@ static void hexagon_common_init(MachineState *machine= , Rev_t rev, */ qdev_prop_set_bit(DEVICE(cpu), "start-powered-off", (i !=3D 0)); if (i =3D=3D 0) { + cpu0 =3D DEVICE(cpu); 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); + object_property_set_link(OBJECT(cpu), "l2vic", + OBJECT(hms->l2vic_dev), &error_fatal); qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); } =20 + for (int i =3D 0; i < 8; i++) { + sysbus_connect_irq(SYS_BUS_DEVICE(hms->l2vic_dev), i, + qdev_get_gpio_in(cpu0, i)); + } + 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_globalreg.c b/hw/hexagon/hexagon_globalreg.c index b5e5913507e..3d0d6f9516c 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,6 +136,32 @@ 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; +} + +/* + * HEX_SREG_VID/VID1 are backed by the L2VIC's VID group registers + * rather than the plain regs[] array, when an L2VIC is wired up. + */ +static uint32_t get_reg_value(HexagonGlobalRegState *s, uint32_t reg) +{ + if (is_vid_reg(reg) && s->l2vic) { + return l2vic_read_vid(s->l2vic, reg =3D=3D HEX_SREG_VID ? 0 : 1); + } + return s->regs[reg]; +} + +static void set_reg_value(HexagonGlobalRegState *s, uint32_t reg, + uint32_t value) +{ + s->regs[reg] =3D value; + if (is_vid_reg(reg) && s->l2vic) { + l2vic_update_vid(s->l2vic, reg =3D=3D HEX_SREG_VID ? 0 : 1, value); + } +} + uint32_t hexagon_globalreg_read(HexagonGlobalRegState *s, uint32_t reg, uint32_t htid) { @@ -146,7 +173,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 +187,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 +195,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 +203,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 +215,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) @@ -275,6 +304,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), diff --git a/hw/hexagon/virt.c b/hw/hexagon/virt.c index a3638998b87..2256d3d53a5 100644 --- a/hw/hexagon/virt.c +++ b/hw/hexagon/virt.c @@ -15,6 +15,7 @@ #include "hw/hexagon/hexagon.h" #include "hw/hexagon/hexagon_globalreg.h" #include "hw/hexagon/hexagon_tlb.h" +#include "hw/intc/hex-l2vic.h" #include "hw/core/loader.h" #include "hw/core/qdev-properties.h" #include "hw/core/qdev-clock.h" @@ -268,10 +269,22 @@ static void virt_init(MachineState *ms) &vms->parent_obj.cfgtable_rom); fdt_add_hvx(vms, m_cfg); =20 + vms->parent_obj.l2vic_dev =3D qdev_new(TYPE_HEX_L2VIC); + object_property_add_child(OBJECT(ms), "l2vic", + OBJECT(vms->parent_obj.l2vic_dev)); + sysbus_realize_and_unref(SYS_BUS_DEVICE(vms->parent_obj.l2vic_dev), + &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(vms->parent_obj.l2vic_dev), 0, + m_cfg->l2vic_base); + sysbus_mmio_map(SYS_BUS_DEVICE(vms->parent_obj.l2vic_dev), 1, + m_cfg->cfgtable.fastl2vic_base << 16); + 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); + object_property_set_link(OBJECT(gsregs_dev), "l2vic", + OBJECT(vms->parent_obj.l2vic_dev), &error_fat= al); sysbus_realize_and_unref(SYS_BUS_DEVICE(gsregs_dev), &error_fatal); =20 tlb_dev =3D qdev_new(TYPE_HEXAGON_TLB); @@ -301,9 +314,18 @@ static void virt_init(MachineState *ms) OBJECT(gsregs_dev), &error_fatal); object_property_set_link(OBJECT(cpu), "tlb", OBJECT(tlb_dev), &error_fatal); + object_property_set_link(OBJECT(cpu), "l2vic", + OBJECT(vms->parent_obj.l2vic_dev), + &error_fatal); =20 qdev_realize_and_unref(DEVICE(cpu), NULL, &error_fatal); } + + for (int i =3D 0; i < 8; i++) { + sysbus_connect_irq(SYS_BUS_DEVICE(vms->parent_obj.l2vic_dev), i, + qdev_get_gpio_in(cpu0, i)); + } + fdt_add_cpu_nodes(vms); clk_phandle =3D fdt_add_clocks(vms); fdt_add_uart(vms, VIRT_UART0, clk_phandle); --=20 2.34.1