Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2224111/?format=api
{ "id": 2224111, "url": "http://patchwork.ozlabs.org/api/patches/2224111/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260416210305.2255579-2-brian.cain@oss.qualcomm.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260416210305.2255579-2-brian.cain@oss.qualcomm.com>", "list_archive_url": null, "date": "2026-04-16T21:02:57", "name": "[v5,1/9] hw/hexagon: Add globalreg model", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "e02c1907b2625f0bea6532c1bd569de30574122a", "submitter": { "id": 89839, "url": "http://patchwork.ozlabs.org/api/people/89839/?format=api", "name": "Brian Cain", "email": "brian.cain@oss.qualcomm.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260416210305.2255579-2-brian.cain@oss.qualcomm.com/mbox/", "series": [ { "id": 500204, "url": "http://patchwork.ozlabs.org/api/series/500204/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=500204", "date": "2026-04-16T21:03:01", "name": "Hexagon system emulation - Part 3/3", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/500204/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2224111/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2224111/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256\n header.s=qcppdkim1 header.b=dmibAvkg;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com\n header.a=rsa-sha256 header.s=google header.b=gO0c0pMk;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxVr54FjRz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 07:04:20 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wDTs8-00006V-Oo; Thu, 16 Apr 2026 17:03:36 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brian.cain@oss.qualcomm.com>)\n id 1wDTrz-0008UU-GK\n for qemu-devel@nongnu.org; Thu, 16 Apr 2026 17:03:28 -0400", "from mx0a-0031df01.pphosted.com ([205.220.168.131])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brian.cain@oss.qualcomm.com>)\n id 1wDTrw-0000zH-QD\n for qemu-devel@nongnu.org; Thu, 16 Apr 2026 17:03:27 -0400", "from pps.filterd (m0279862.ppops.net [127.0.0.1])\n by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id\n 63GIRQRP1183760\n for <qemu-devel@nongnu.org>; Thu, 16 Apr 2026 21:03:22 GMT", "from mail-dy1-f198.google.com (mail-dy1-f198.google.com\n [74.125.82.198])\n by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dk52jgfe2-1\n (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)\n for <qemu-devel@nongnu.org>; Thu, 16 Apr 2026 21:03:21 +0000 (GMT)", "by mail-dy1-f198.google.com with SMTP id\n 5a478bee46e88-2d3a617ad90so29782028eec.0\n for <qemu-devel@nongnu.org>; Thu, 16 Apr 2026 14:03:21 -0700 (PDT)", "from hu-bcain-lv.qualcomm.com (Global_NAT1.qualcomm.com.\n [129.46.96.20]) by smtp.gmail.com with ESMTPSA id\n 5a478bee46e88-2de8c90cd7esm11176277eec.13.2026.04.16.14.03.19\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 16 Apr 2026 14:03:19 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h=\n cc:content-transfer-encoding:content-type:date:from:in-reply-to\n :message-id:mime-version:references:subject:to; s=qcppdkim1; bh=\n FXm2NP147CeyKIOpThO7M80tl+dObaGsiQJnYF8P9/0=; b=dmibAvkgYcidrvPc\n nKCTzYOJtWfwTL/ISjAkQ5KFYXcB8oVEU63mxgOugfaVUXJLQjKDuawGalw49/Xt\n c13sKW2B4cslFGfA9He+btAALkK1KZLOcEMov/2utymtL1taIna3+/GNFk0X+2jj\n pCuSk3z2QRI568yT+qaGl3NbYM/akOqiYTwvwKXpVXX3kweH3DzQgRd97Mfcy0bW\n zP5k0NOu+JLrm17+rlWpN8PpZ/ZkBQ+/h2MrHMi39U257PM/lPAx/B55zpphp7hn\n noxgj956hCJogMo8Sf6XzPohKw+MSuQ1xgoYcQzF09nG/4Kz6k7TEgcs2FEPWpaL\n UNIqpA==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=oss.qualcomm.com; s=google; t=1776373401; x=1776978201; darn=nongnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=FXm2NP147CeyKIOpThO7M80tl+dObaGsiQJnYF8P9/0=;\n b=gO0c0pMknpp1Uh4376M/8kkNzppXU7avtKJaiYK8xjdA2jYmdeCGiuOJ432d5Gp0to\n hHU0ax7Z+tOf3LKsCiXEXb+rf9UFsj2eznYcjiy44l/W5mnU76ULB9Kmizdt3oVwNhbJ\n feHxSZDS4a2Z3j/n32uY/CqSAfq1mrqbeSIpUTryG3FFUHdUAGbdJJtzD62rz7Phwawx\n VHoeYcx4wsot0m5YPy/iLbIPFPu2skLlBXovZceg1cVX6sLWDWeVtc75t0PA+7nsIuFh\n o68oaim+7fbUiRC55XcjSHPIXeobzMU0i4POuVG4deqH4lo9sftHd5YSd3UgKVnakxV5\n py0w==" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776373401; x=1776978201;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=FXm2NP147CeyKIOpThO7M80tl+dObaGsiQJnYF8P9/0=;\n b=PDXdAmJGlfO08DbsMgcNsA1qGiQiElqAdm8f3zI8/Ap0inG+zp6JQws0KBvd80meSr\n 18W/eq8JjD6+reCXJ0Nh0aRc/bezD9cpKzeYdsA2aWwRkjO2nw+WRzMXMiWiGLBehdxG\n 8Z6GhMntVlYjQZZdXgtIuDK6Gqxi1Zwd4NyX29q817wPJBeyEU1y7uu2G96v0Mscr0HV\n AOkSBKJcDyKrxACwXVcuDjvDks77wSpwKeWID4UNN9lFLg5jS/wIvlIczddwcev4Gfxv\n T6Y2rI8Ftfl1W+t3FrUcSdKVid6q5TFsyHFBfQBNZb46YZt5sBkx5QUvGWC+RaIanrPb\n JS5g==", "X-Gm-Message-State": "AOJu0Ywq7EUjdW29jubO8exAexNuFYibFAtDWmVfotezt47oxnABwyqA\n IYvhVYfA/B9zBBZFpZNG1OXxOwN68uZ27b7n5d7k8QyAdFgyAULZxJpWwwBrQnFbksvdTx+bmNF\n 8ldDJTKnt65UTNmagGaTZ/ZnV6PVzNvQdQ7N7iUAhUeMdNGfgZGcrZEU9/UlO3kkVIA==", "X-Gm-Gg": "AeBDies2uZ5rHW+4RaIRNkyHxEcW36wKfvJ0YWNJfEl5siYhit1EY9fma2BWaeiBQ0z\n UG2Ae0ag6cVZK4FRM1KYijwVXoPFmbP/MkUWO+GBxSAPhMS3BjukzyCB+mu6lOmUA7L6rQTgCT7\n 6fWNSOb0OsSjFqlJz4A0gIcs2wHR35+6XBzNqHtUo0em57FOYB5Zt2Tt3Nj3AwjqDoI8bng0GKi\n WmtkZx4bxw1eqBIGhR4DpaEEkNPGhgQvt52vtAzf7cGpg0hT+TScXAnajbtOnbdeiZ1FY2We36K\n ckODknC2cTxfwpPfZ8xMzsLWGqj1s2AkNdjO4mSgW65QETWMkDCl8ZXSz1mYR56rCG99jykdLP4\n qMPZS1hD1gr8ritxmcoVShoLiRaD8mm6HRm0AvUJNP47Q6XaOj5pKFaz8XlqKL31G60NX7OFILi\n 1ClZrJ", "X-Received": [ "by 2002:a05:7300:bc11:b0:2d9:6373:ad22 with SMTP id\n 5a478bee46e88-2e2e425a9bemr575368eec.12.1776373400458;\n Thu, 16 Apr 2026 14:03:20 -0700 (PDT)", "by 2002:a05:7300:bc11:b0:2d9:6373:ad22 with SMTP id\n 5a478bee46e88-2e2e425a9bemr575333eec.12.1776373399762;\n Thu, 16 Apr 2026 14:03:19 -0700 (PDT)" ], "From": "Brian Cain <brian.cain@oss.qualcomm.com>", "To": "qemu-devel@nongnu.org", "Cc": "brian.cain@oss.qualcomm.com, philmd@linaro.org, ltaylorsimpson@gmail.com,\n matheus.bernardino@oss.qualcomm.com, marco.liebel@oss.qualcomm.com,\n quic_mburton@quicinc.com, sid.manning@oss.qualcomm.com, ale@rev.ng,\n anjo@rev.ng, pierrick.bouvier@oss.qualcomm.com", "Subject": "[PATCH v5 1/9] hw/hexagon: Add globalreg model", "Date": "Thu, 16 Apr 2026 14:02:57 -0700", "Message-Id": "<20260416210305.2255579-2-brian.cain@oss.qualcomm.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20260416210305.2255579-1-brian.cain@oss.qualcomm.com>", "References": "<20260416210305.2255579-1-brian.cain@oss.qualcomm.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "X-Authority-Analysis": "v=2.4 cv=buR8wkai c=1 sm=1 tr=0 ts=69e14e99 cx=c_pps\n a=wEP8DlPgTf/vqF+yE6f9lg==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17\n a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10\n a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22\n a=EUspDBNiAAAA:8 a=6TRVr8HvG4iwRA_5R7QA:9 a=QEXdDO2ut3YA:10\n a=bBxd6f-gb0O0v-kibOvt:22", "X-Proofpoint-GUID": "GjWORE23Gu2h2O0Wwk1F5t5a5e9MSUiW", "X-Proofpoint-ORIG-GUID": "GjWORE23Gu2h2O0Wwk1F5t5a5e9MSUiW", "X-Proofpoint-Spam-Details-Enc": "AW1haW4tMjYwNDE2MDE5OSBTYWx0ZWRfX9VYP4Dfrq9Bc\n E9y5GjuwEt3jK64DRkWtyZCt/ygJZUCf3qwddvKl4H8dEevVAQ1NZoqbzr6ijgPwnOMEzl1SEsO\n p3NWK9CcTeNzsiOBDBsJmeBtsFFIatSHzehoLis5iAGjRzI2tcsY51T7ygJoTErrpZvzH0O44dR\n FNvoCf6yaXJxUpBjwqanMpgZjolzD5hQlxG+EDy/mD0SgT2c0fYxf3yj6AKFFNDlywrPe3RDhDJ\n o7RGjxtJ/1D/5Qc++T9TvGGYHed4zZDRmbG/YI+gtr7Nxf8bJaVolPi+7TWM7Qs6EmJ8PJfHig/\n 4qOj4Wg0B8JL/z6fnQeoadOzsUxNXNIcezQzIfL+Z58XDy1ScooLTao9mxwuKpP8mXjik5roUyf\n GyUq9zyu8BGe8ZqVyttusyZwvedDI8Xx5fB/hHeW0IPRQk9NcX4iZB9xDR15ISF2Cfs3+u+Gq4B\n hwuFl/rWLjr2FeKxYGA==", "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49\n definitions=2026-04-16_03,2026-04-16_03,2025-10-01_01", "X-Proofpoint-Spam-Details": "rule=outbound_notspam policy=outbound score=0\n impostorscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0\n priorityscore=1501 spamscore=0 malwarescore=0 phishscore=0 clxscore=1015\n classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0\n reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604160199", "Received-SPF": "pass client-ip=205.220.168.131;\n 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,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001,\n 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 <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Some of the system registers are shared among all threads\nin the core. This object contains the representation and\ninterface to the system registers.\n\nSigned-off-by: Brian Cain <brian.cain@oss.qualcomm.com>\nReviewed-by: Sid Manning <sid.manning@oss.qualcomm.com>\n---\n include/hw/hexagon/hexagon_globalreg.h | 56 ++++++\n hw/hexagon/hexagon_globalreg.c | 240 +++++++++++++++++++++++++\n 2 files changed, 296 insertions(+)\n create mode 100644 include/hw/hexagon/hexagon_globalreg.h\n create mode 100644 hw/hexagon/hexagon_globalreg.c", "diff": "diff --git a/include/hw/hexagon/hexagon_globalreg.h b/include/hw/hexagon/hexagon_globalreg.h\nnew file mode 100644\nindex 00000000000..c9e72f30b0a\n--- /dev/null\n+++ b/include/hw/hexagon/hexagon_globalreg.h\n@@ -0,0 +1,56 @@\n+/*\n+ * Hexagon Global Registers QOM Object\n+ *\n+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#ifndef HEXAGON_GLOBALREG_H\n+#define HEXAGON_GLOBALREG_H\n+\n+#include \"hw/core/qdev.h\"\n+#include \"hw/core/sysbus.h\"\n+#include \"qom/object.h\"\n+#include \"target/hexagon/cpu.h\"\n+\n+#define TYPE_HEXAGON_GLOBALREG \"hexagon-globalreg\"\n+OBJECT_DECLARE_SIMPLE_TYPE(HexagonGlobalRegState, HEXAGON_GLOBALREG)\n+\n+struct HexagonGlobalRegState {\n+ SysBusDevice parent_obj;\n+\n+ /* Array of system registers */\n+ uint32_t regs[NUM_SREGS];\n+\n+ /* Global performance cycle counter base */\n+ uint64_t g_pcycle_base;\n+\n+ /* Properties for global register reset values */\n+ uint32_t boot_evb; /* Boot Exception Vector Base (HEX_SREG_EVB) */\n+ uint64_t config_table_addr; /* Configuration table base */\n+ uint32_t dsp_rev; /* DSP revision register (HEX_SREG_REV) */\n+\n+ /* ISDB properties */\n+ bool isdben_etm_enable; /* ISDB ETM enable bit */\n+ bool isdben_dfd_enable; /* ISDB DFD enable bit */\n+ bool isdben_trusted; /* ISDB trusted mode bit */\n+ bool isdben_secure; /* ISDB secure mode bit */\n+};\n+\n+/* Public interface functions */\n+uint32_t hexagon_globalreg_read(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t htid);\n+void hexagon_globalreg_write(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value, uint32_t htid);\n+uint32_t hexagon_globalreg_masked_value(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value);\n+void hexagon_globalreg_write_masked(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value);\n+void hexagon_globalreg_reset(HexagonGlobalRegState *s);\n+\n+/* Global performance cycle counter access */\n+uint64_t hexagon_globalreg_get_pcycle_base(HexagonGlobalRegState *s);\n+void hexagon_globalreg_set_pcycle_base(HexagonGlobalRegState *s,\n+ uint64_t value);\n+\n+#endif /* HEXAGON_GLOBALREG_H */\ndiff --git a/hw/hexagon/hexagon_globalreg.c b/hw/hexagon/hexagon_globalreg.c\nnew file mode 100644\nindex 00000000000..97e75a2f1ea\n--- /dev/null\n+++ b/hw/hexagon/hexagon_globalreg.c\n@@ -0,0 +1,240 @@\n+/*\n+ * Hexagon Global Registers\n+ *\n+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n+ * SPDX-License-Identifier: GPL-2.0-or-later\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"hw/hexagon/hexagon.h\"\n+#include \"hw/hexagon/hexagon_globalreg.h\"\n+#include \"hw/core/qdev-properties.h\"\n+#include \"hw/core/sysbus.h\"\n+#include \"hw/core/resettable.h\"\n+#include \"migration/vmstate.h\"\n+#include \"qom/object.h\"\n+#include \"target/hexagon/cpu.h\"\n+#include \"target/hexagon/hex_regs.h\"\n+#include \"qemu/log.h\"\n+#include \"qapi/error.h\"\n+\n+#define IMMUTABLE (~0)\n+#define INVALID_REG_VAL 0xdeadbeef\n+\n+/* Global system register mutability masks */\n+static const uint32_t global_sreg_immut_masks[NUM_SREGS] = {\n+ [HEX_SREG_EVB] = 0x000000ff,\n+ [HEX_SREG_MODECTL] = IMMUTABLE,\n+ [HEX_SREG_SYSCFG] = 0x80001c00,\n+ [HEX_SREG_IPENDAD] = IMMUTABLE,\n+ [HEX_SREG_VID] = 0xfc00fc00,\n+ [HEX_SREG_VID1] = 0xfc00fc00,\n+ [HEX_SREG_BESTWAIT] = 0xfffffe00,\n+ [HEX_SREG_IAHL] = 0x00000000,\n+ [HEX_SREG_SCHEDCFG] = 0xfffffee0,\n+ [HEX_SREG_CFGBASE] = IMMUTABLE,\n+ [HEX_SREG_DIAG] = 0x00000000,\n+ [HEX_SREG_REV] = IMMUTABLE,\n+ [HEX_SREG_ISDBST] = IMMUTABLE,\n+ [HEX_SREG_ISDBCFG0] = 0xe0000000,\n+ [HEX_SREG_BRKPTPC0] = 0x00000003,\n+ [HEX_SREG_BRKPTCFG0] = 0xfc007000,\n+ [HEX_SREG_BRKPTPC1] = 0x00000003,\n+ [HEX_SREG_BRKPTCFG1] = 0xfc007000,\n+ [HEX_SREG_ISDBMBXIN] = IMMUTABLE,\n+ [HEX_SREG_ISDBMBXOUT] = 0x00000000,\n+ [HEX_SREG_ISDBEN] = 0xfffffffe,\n+ [HEX_SREG_TIMERLO] = IMMUTABLE,\n+ [HEX_SREG_TIMERHI] = IMMUTABLE,\n+};\n+\n+static void hexagon_globalreg_init(Object *obj)\n+{\n+ HexagonGlobalRegState *s = HEXAGON_GLOBALREG(obj);\n+\n+ memset(s->regs, 0, sizeof(uint32_t) * NUM_SREGS);\n+}\n+\n+static inline uint32_t apply_write_mask(uint32_t new_val, uint32_t cur_val,\n+ uint32_t reg_mask)\n+{\n+ if (reg_mask) {\n+ return (new_val & ~reg_mask) | (cur_val & reg_mask);\n+ }\n+ return new_val;\n+}\n+\n+uint32_t hexagon_globalreg_read(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t htid)\n+{\n+ uint32_t value;\n+\n+ g_assert(reg < NUM_SREGS);\n+ g_assert(reg >= HEX_SREG_GLB_START);\n+ g_assert(s);\n+\n+ value = s->regs[reg];\n+\n+ return value;\n+}\n+\n+void hexagon_globalreg_write(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value, uint32_t htid)\n+{\n+ g_assert(s);\n+ g_assert(reg < NUM_SREGS);\n+ g_assert(reg >= HEX_SREG_GLB_START);\n+ s->regs[reg] = value;\n+}\n+\n+uint32_t hexagon_globalreg_masked_value(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value)\n+{\n+ uint32_t reg_mask;\n+\n+ g_assert(s);\n+ g_assert(reg < NUM_SREGS);\n+ g_assert(reg >= HEX_SREG_GLB_START);\n+ reg_mask = global_sreg_immut_masks[reg];\n+ return reg_mask == IMMUTABLE ?\n+ s->regs[reg] :\n+ apply_write_mask(value, s->regs[reg], reg_mask);\n+}\n+\n+void hexagon_globalreg_write_masked(HexagonGlobalRegState *s, uint32_t reg,\n+ uint32_t value)\n+{\n+ g_assert(s);\n+ s->regs[reg] = hexagon_globalreg_masked_value(s, reg, value);\n+}\n+\n+uint64_t hexagon_globalreg_get_pcycle_base(HexagonGlobalRegState *s)\n+{\n+ g_assert(s);\n+ return s->g_pcycle_base;\n+}\n+\n+void hexagon_globalreg_set_pcycle_base(HexagonGlobalRegState *s,\n+ uint64_t value)\n+{\n+ g_assert(s);\n+ s->g_pcycle_base = value;\n+}\n+\n+static void do_hexagon_globalreg_reset(HexagonGlobalRegState *s)\n+{\n+ uint32_t isdben_val = 0;\n+\n+ g_assert(s);\n+ memset(s->regs, 0, sizeof(uint32_t) * NUM_SREGS);\n+\n+ s->g_pcycle_base = 0;\n+\n+ s->regs[HEX_SREG_EVB] = s->boot_evb;\n+ s->regs[HEX_SREG_CFGBASE] = HEXAGON_CFG_ADDR_BASE(s->config_table_addr);\n+ s->regs[HEX_SREG_REV] = s->dsp_rev;\n+\n+ if (s->isdben_etm_enable) {\n+ isdben_val |= (1 << 0); /* ETM enable bit */\n+ }\n+ if (s->isdben_dfd_enable) {\n+ isdben_val |= (1 << 1); /* DFD enable bit */\n+ }\n+ if (s->isdben_trusted) {\n+ isdben_val |= (1 << 2); /* Trusted bit */\n+ }\n+ if (s->isdben_secure) {\n+ isdben_val |= (1 << 3); /* Secure bit */\n+ }\n+ s->regs[HEX_SREG_ISDBEN] = isdben_val;\n+ s->regs[HEX_SREG_MODECTL] = 0x1;\n+\n+ /*\n+ * These register indices are placeholders in these arrays\n+ * and their actual values are synthesized from state elsewhere.\n+ * We can initialize these with invalid values so that if we\n+ * mistakenly generate reads, they will look obviously wrong.\n+ */\n+ s->regs[HEX_SREG_PCYCLELO] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PCYCLEHI] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_TIMERLO] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_TIMERHI] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT0] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT1] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT2] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT3] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT4] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT5] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT6] = INVALID_REG_VAL;\n+ s->regs[HEX_SREG_PMUCNT7] = INVALID_REG_VAL;\n+}\n+\n+void hexagon_globalreg_reset(HexagonGlobalRegState *s)\n+{\n+ do_hexagon_globalreg_reset(s);\n+}\n+\n+static void hexagon_globalreg_reset_hold(Object *obj, ResetType type)\n+{\n+ HexagonGlobalRegState *s = HEXAGON_GLOBALREG(obj);\n+ do_hexagon_globalreg_reset(s);\n+}\n+\n+static const VMStateDescription vmstate_hexagon_globalreg = {\n+ .name = \"hexagon_globalreg\",\n+ .version_id = 1,\n+ .minimum_version_id = 1,\n+ .fields = (const VMStateField[]){\n+ VMSTATE_UINT32_ARRAY(regs, HexagonGlobalRegState, NUM_SREGS),\n+ VMSTATE_UINT64(g_pcycle_base, HexagonGlobalRegState),\n+ VMSTATE_UINT32(boot_evb, HexagonGlobalRegState),\n+ VMSTATE_UINT64(config_table_addr, HexagonGlobalRegState),\n+ VMSTATE_UINT32(dsp_rev, HexagonGlobalRegState),\n+ VMSTATE_BOOL(isdben_etm_enable, HexagonGlobalRegState),\n+ VMSTATE_BOOL(isdben_dfd_enable, HexagonGlobalRegState),\n+ VMSTATE_BOOL(isdben_trusted, HexagonGlobalRegState),\n+ VMSTATE_BOOL(isdben_secure, HexagonGlobalRegState),\n+ VMSTATE_END_OF_LIST()\n+ }\n+};\n+\n+static const Property hexagon_globalreg_properties[] = {\n+ DEFINE_PROP_UINT32(\"boot-evb\", HexagonGlobalRegState, boot_evb, 0x0),\n+ DEFINE_PROP_UINT64(\"config-table-addr\", HexagonGlobalRegState,\n+ config_table_addr, 0xffffffffULL),\n+ DEFINE_PROP_UINT32(\"dsp-rev\", HexagonGlobalRegState, dsp_rev, 0),\n+ DEFINE_PROP_BOOL(\"isdben-etm-enable\", HexagonGlobalRegState,\n+ isdben_etm_enable, false),\n+ DEFINE_PROP_BOOL(\"isdben-dfd-enable\", HexagonGlobalRegState,\n+ isdben_dfd_enable, false),\n+ DEFINE_PROP_BOOL(\"isdben-trusted\", HexagonGlobalRegState,\n+ isdben_trusted, false),\n+ DEFINE_PROP_BOOL(\"isdben-secure\", HexagonGlobalRegState,\n+ isdben_secure, false),\n+};\n+\n+static void hexagon_globalreg_class_init(ObjectClass *klass, const void *data)\n+{\n+ DeviceClass *dc = DEVICE_CLASS(klass);\n+ ResettableClass *rc = RESETTABLE_CLASS(klass);\n+\n+ rc->phases.hold = hexagon_globalreg_reset_hold;\n+ dc->vmsd = &vmstate_hexagon_globalreg;\n+ dc->user_creatable = false;\n+ device_class_set_props(dc, hexagon_globalreg_properties);\n+}\n+\n+static const TypeInfo hexagon_globalreg_info = {\n+ .name = TYPE_HEXAGON_GLOBALREG,\n+ .parent = TYPE_SYS_BUS_DEVICE,\n+ .instance_size = sizeof(HexagonGlobalRegState),\n+ .instance_init = hexagon_globalreg_init,\n+ .class_init = hexagon_globalreg_class_init,\n+};\n+\n+static void hexagon_globalreg_register_types(void)\n+{\n+ type_register_static(&hexagon_globalreg_info);\n+}\n+\n+type_init(hexagon_globalreg_register_types)\n", "prefixes": [ "v5", "1/9" ] }