From nobody Tue Nov 26 14:23:06 2024 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=none dis=none) header.from=syntacore.com ARC-Seal: i=1; a=rsa-sha256; t=1706704640; cv=none; d=zohomail.com; s=zohoarc; b=Qqa7gUq+mcPSp1GdFbR/4qzUvZR1zq/b9DIZEwBNU4xOhPbhKXwNZSjX13WVO2eNpY/nOUbwXi6RjFjvVMvq8R231hXGItfPfQrXV0zGya+cv5wddU4uVFuZLJKiWAS2ozW3QmQdMShL4GEl5h7Ge0dRCmUmmOkZCaxyU1KO6jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706704640; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=AnibXTM83Q28VXGUORADIgdP5mhFv2lZXX+3O/aon/A=; b=VbxaH4oYd4GNAocFzhpSj8Ox1SoNeA1LtnjTcqbIqPEGL+0JXP1ySov/lphovksv7kLO2QzpOkU1ArznaXiY5cNrMXYLd+eiJft1HfHUAMufyUYG707iO7b8ytQNbKIC1pquRbq/SNy60/doxYBOs6fAywSxnTfkCYsQcxW2Nzo= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1706704640890826.7360990958155; Wed, 31 Jan 2024 04:37:20 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rV9q2-0003gG-W7; Wed, 31 Jan 2024 07:37:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rV9q1-0003fo-AM; Wed, 31 Jan 2024 07:37:09 -0500 Received: from mta-04.yadro.com ([89.207.88.248]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rV9py-00043v-TM; Wed, 31 Jan 2024 07:37:08 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mta-04.yadro.com 9A368C0007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syntacore.com; s=mta-04; t=1706704617; bh=AnibXTM83Q28VXGUORADIgdP5mhFv2lZXX+3O/aon/A=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=rurexa5c2mcklBOkqnLNfui0NSLmKIW9IP+rpYY0yQCnRGhdX9CJ79j+jye9sUdWs pXqNr7tUyapI0syj9JkdbjhI5x3XEvLJeee6nQF4on6P6UKbtRaS9ili82rNjn0iWJ DmQ+4t4cJlhBNB29RnWXLhJwwWlSLgIGGasShmaAcNT22bC+Y32KaTdVjYfOI+s1yj A3sGcae21dA4DzF4OdHCIGEiV+CWqN7d+id9if2ijYwA/m2xd0pDwOAWQnqFsq6JQx HScyevL02QS3eg8kVUQov95QemP4OlEwyE3ky9uJPzn1USrvnhWOZLe1iNdS3/NoVC N2h3QTqz2qP0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syntacore.com; s=mta-03; t=1706704617; bh=AnibXTM83Q28VXGUORADIgdP5mhFv2lZXX+3O/aon/A=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=wQ7Gur40QWeksvTIuWmbG0svE7U4LIUP2o5yb5sFEsjRVidD0b32uJPkq7Pf/uQZp oTUcn81LVx+XXKs75QD+ssb6dDNjLnY+ja+Illay6UZq9wWTdd+3+SKXjT7ylxGPh3 qx3Hxa6V0wINX2fCZY3fmRBkgWrqAiBRN8Dq9zhZcW6lFOLKpYYJvwQnO0rOZvqVWz rEue62kxuL8zadRUTGHtT1hCp7Gaqi/q7jNX1VlPS3IVKW9Q9/iuEYiWZF6Q3N5UZx FJu+MEbf6yu/XMmm5/6KCNTg8mtgNt2bFz5xOrxwU5gA4J5HJoGEXzNtEQwTl0v6R+ 5h/a27cEpUnqQ== From: Vadim Shakirov To: CC: Vadim Shakirov , Palmer Dabbelt , Alistair Francis , Bin Meng , Weiwei Li , "Daniel Henrique Barboza" , Liu Zhiwei , Subject: [PATCH v3] target/riscv: mcountinhibit, mcounteren, scounteren, hcounteren is 32-bit Date: Wed, 31 Jan 2024 15:36:24 +0300 Message-ID: <20240131123624.230982-1-vadim.shakirov@syntacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: T-EXCH-07.corp.yadro.com (172.17.11.57) To S-Exch-01.corp.yadro.com (10.78.5.241) 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=lists.gnu.org; Received-SPF: permerror client-ip=89.207.88.248; envelope-from=vadim.shakirov@syntacore.com; helo=mta-04.yadro.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_PERMERROR=0.01 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: 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 @syntacore.com) (identity @syntacore.com) X-ZM-MESSAGEID: 1706704644395100003 Content-Type: text/plain; charset="utf-8" mcountinhibit, mcounteren, scounteren and hcounteren must always be 32-bit by privileged spec Signed-off-by: Vadim Shakirov Reviewed-by: Alistair Francis Reviewed-by: Andrew Jones --- target/riscv/cpu.h | 8 ++++---- target/riscv/machine.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h index 5b0824ef8f..88efd8a6f9 100644 --- a/target/riscv/cpu.h +++ b/target/riscv/cpu.h @@ -254,7 +254,7 @@ struct CPUArchState { target_ulong hstatus; target_ulong hedeleg; uint64_t hideleg; - target_ulong hcounteren; + uint32_t hcounteren; target_ulong htval; target_ulong htinst; target_ulong hgatp; @@ -317,10 +317,10 @@ struct CPUArchState { */ bool two_stage_indirect_lookup; =20 - target_ulong scounteren; - target_ulong mcounteren; + uint32_t scounteren; + uint32_t mcounteren; =20 - target_ulong mcountinhibit; + uint32_t mcountinhibit; =20 /* PMU counter state */ PMUCTRState pmu_ctrs[RV_MAX_MHPMCOUNTERS]; diff --git a/target/riscv/machine.c b/target/riscv/machine.c index fdde243e04..f129032b0d 100644 --- a/target/riscv/machine.c +++ b/target/riscv/machine.c @@ -79,14 +79,14 @@ static bool hyper_needed(void *opaque) =20 static const VMStateDescription vmstate_hyper =3D { .name =3D "cpu/hyper", - .version_id =3D 3, - .minimum_version_id =3D 3, + .version_id =3D 4, + .minimum_version_id =3D 4, .needed =3D hyper_needed, .fields =3D (VMStateField[]) { VMSTATE_UINTTL(env.hstatus, RISCVCPU), VMSTATE_UINTTL(env.hedeleg, RISCVCPU), VMSTATE_UINT64(env.hideleg, RISCVCPU), - VMSTATE_UINTTL(env.hcounteren, RISCVCPU), + VMSTATE_UINT32(env.hcounteren, RISCVCPU), VMSTATE_UINTTL(env.htval, RISCVCPU), VMSTATE_UINTTL(env.htinst, RISCVCPU), VMSTATE_UINTTL(env.hgatp, RISCVCPU), @@ -354,8 +354,8 @@ static const VMStateDescription vmstate_jvt =3D { =20 const VMStateDescription vmstate_riscv_cpu =3D { .name =3D "cpu", - .version_id =3D 9, - .minimum_version_id =3D 9, + .version_id =3D 10, + .minimum_version_id =3D 10, .post_load =3D riscv_cpu_post_load, .fields =3D (VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gpr, RISCVCPU, 32), @@ -398,9 +398,9 @@ const VMStateDescription vmstate_riscv_cpu =3D { VMSTATE_UINTTL(env.mtval, RISCVCPU), VMSTATE_UINTTL(env.miselect, RISCVCPU), VMSTATE_UINTTL(env.siselect, RISCVCPU), - VMSTATE_UINTTL(env.scounteren, RISCVCPU), - VMSTATE_UINTTL(env.mcounteren, RISCVCPU), - VMSTATE_UINTTL(env.mcountinhibit, RISCVCPU), + VMSTATE_UINT32(env.scounteren, RISCVCPU), + VMSTATE_UINT32(env.mcounteren, RISCVCPU), + VMSTATE_UINT32(env.mcountinhibit, RISCVCPU), VMSTATE_STRUCT_ARRAY(env.pmu_ctrs, RISCVCPU, RV_MAX_MHPMCOUNTERS, = 0, vmstate_pmu_ctr_state, PMUCTRState), VMSTATE_UINTTL_ARRAY(env.mhpmevent_val, RISCVCPU, RV_MAX_MHPMEVENT= S), --=20 2.34.1