From nobody Tue Nov 26 11:46:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1708531077; cv=none; d=zohomail.com; s=zohoarc; b=hCTn/MOtJEUQVXLhOB3hSB4RB7+MrGxJHv2DKPG3EqrIvu8CtlBwt15ujJTdd56MifvkJP5SX9veNN/795iSKtgrdXaA7dgSAlzrWN13mlz52CFbVVx2tbe0BNTX0ezt3GNzmXXMAyQ4dOpvcJ2OFWiFFXNY8gVx74z00+KTfQE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708531077; 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:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=6Yum+q/IRqPNdwxv/xPpV6q0TLFk5Elh/NZohT0ncDQ=; b=MOX6D6xlzhkfoTus3cXASMDgnmayNeXsQMrNMGHRFOTAYZQ5FTAZaj5XDYVDZOLzwLga/QzkIBaDwHvROaM9R/pp6I8rdXj9/HnlCZMhVlMXKjjeyZRsBSPIWugzEZzvZXmzjyrMKa8wKlFQ3EBDiCPVxW2OPoJilRXQxVJHNHY= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 1708531077124266.2809540136923; Wed, 21 Feb 2024 07:57:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rcoNu-0000XC-3N; Wed, 21 Feb 2024 10:19:46 -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 1rcoJv-0000sX-2c; Wed, 21 Feb 2024 10:15:44 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rcmLz-0004p2-KD; Wed, 21 Feb 2024 08:09:42 -0500 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TfxQp0br0z1xnml; Wed, 21 Feb 2024 21:08:02 +0800 (CST) Received: from kwepemi500008.china.huawei.com (unknown [7.221.188.139]) by mail.maildlp.com (Postfix) with ESMTPS id C4CF31A0172; Wed, 21 Feb 2024 21:09:24 +0800 (CST) Received: from huawei.com (10.67.174.55) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 21 Feb 2024 21:09:24 +0800 To: , , , , , , CC: Subject: [RFC PATCH v2 03/22] target/arm: Add PSTATE.ALLINT Date: Wed, 21 Feb 2024 13:08:04 +0000 Message-ID: <20240221130823.677762-4-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240221130823.677762-1-ruanjinjie@huawei.com> References: <20240221130823.677762-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.174.55] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500008.china.huawei.com (7.221.188.139) 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: pass client-ip=45.249.212.190; envelope-from=ruanjinjie@huawei.com; helo=szxga04-in.huawei.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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: , Reply-to: Jinjie Ruan From: Jinjie Ruan via Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1708531077536100004 Content-Type: text/plain; charset="utf-8" The ALLINT bit in PSTATE is used to mask all IRQ or FIQ interrupts. Place this in its own field within ENV, as that will make it easier to reset from within TCG generated code. With the change to pstate_read/write, exception entry and return are automatically handled. Signed-off-by: Jinjie Ruan --- target/arm/cpu.c | 3 +++ target/arm/cpu.h | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 5fa86bc8d5..5e5978c302 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1104,6 +1104,9 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE= *f, int flags) if (cpu_isar_feature(aa64_bti, cpu)) { qemu_fprintf(f, " BTYPE=3D%d", (psr & PSTATE_BTYPE) >> 10); } + if (cpu_isar_feature(aa64_nmi, cpu)) { + qemu_fprintf(f, " ALLINT=3D%d", (psr & PSTATE_ALLINT) >> 13); + } qemu_fprintf(f, "%s%s%s", (hcr & HCR_NV) ? " NV" : "", (hcr & HCR_NV1) ? " NV1" : "", diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 63f31e0d98..f9646dbbfb 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -224,6 +224,7 @@ typedef struct CPUArchState { * semantics as for AArch32, as described in the comments on each f= ield) * nRW (also known as M[4]) is kept, inverted, in env->aarch64 * DAIF (exception masks) are kept in env->daif + * ALLINT (all IRQ or FIQ interrupts masks) are kept in env->allint * BTYPE is kept in env->btype * SM and ZA are kept in env->svcr * all other bits are stored in their correct places in env->pstate @@ -261,6 +262,7 @@ typedef struct CPUArchState { uint32_t btype; /* BTI branch type. spsr[11:10]. */ uint64_t daif; /* exception masks, in the bits they are in PSTATE */ uint64_t svcr; /* PSTATE.{SM,ZA} in the bits they are in SVCR */ + uint64_t allint; /* All IRQ or FIQ interrupt mask, in the bit in PSTAT= E */ =20 uint64_t elr_el[4]; /* AArch64 exception link regs */ uint64_t sp_el[4]; /* AArch64 banked stack pointers */ @@ -1543,6 +1545,7 @@ FIELD(VTCR, SL2, 33, 1) #define PSTATE_D (1U << 9) #define PSTATE_BTYPE (3U << 10) #define PSTATE_SSBS (1U << 12) +#define PSTATE_ALLINT (1U << 13) #define PSTATE_IL (1U << 20) #define PSTATE_SS (1U << 21) #define PSTATE_PAN (1U << 22) @@ -1555,7 +1558,8 @@ FIELD(VTCR, SL2, 33, 1) #define PSTATE_N (1U << 31) #define PSTATE_NZCV (PSTATE_N | PSTATE_Z | PSTATE_C | PSTATE_V) #define PSTATE_DAIF (PSTATE_D | PSTATE_A | PSTATE_I | PSTATE_F) -#define CACHED_PSTATE_BITS (PSTATE_NZCV | PSTATE_DAIF | PSTATE_BTYPE) +#define CACHED_PSTATE_BITS (PSTATE_NZCV | PSTATE_DAIF | PSTATE_BTYPE | \ + PSTATE_ALLINT) /* Mode values for AArch64 */ #define PSTATE_MODE_EL3h 13 #define PSTATE_MODE_EL3t 12 @@ -1595,7 +1599,7 @@ static inline uint32_t pstate_read(CPUARMState *env) ZF =3D (env->ZF =3D=3D 0); return (env->NF & 0x80000000) | (ZF << 30) | (env->CF << 29) | ((env->VF & 0x80000000) >> 3) - | env->pstate | env->daif | (env->btype << 10); + | env->pstate | env->allint | env->daif | (env->btype << 10); } =20 static inline void pstate_write(CPUARMState *env, uint32_t val) @@ -1604,6 +1608,7 @@ static inline void pstate_write(CPUARMState *env, uin= t32_t val) env->NF =3D val; env->CF =3D (val >> 29) & 1; env->VF =3D (val << 3) & 0x80000000; + env->allint =3D val & PSTATE_ALLINT; env->daif =3D val & PSTATE_DAIF; env->btype =3D (val >> 10) & 3; env->pstate =3D val & ~CACHED_PSTATE_BITS; --=20 2.34.1