From nobody Fri Nov 7 09:09:03 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1537028577696500.65443563949975; Sat, 15 Sep 2018 09:22:57 -0700 (PDT) Received: from localhost ([::1]:56115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1DLU-0000Gv-AN for importer@patchew.org; Sat, 15 Sep 2018 12:22:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g1DGZ-0004Vm-Ml for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g1DGY-0003xY-KM for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:51 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:43668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g1DGY-0003wb-Dy for qemu-devel@nongnu.org; Sat, 15 Sep 2018 12:17:50 -0400 Received: by mail-pl1-x62b.google.com with SMTP id f66-v6so5523177plb.10 for ; Sat, 15 Sep 2018 09:17:50 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id k26-v6sm18648793pfb.167.2018.09.15.09.17.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 15 Sep 2018 09:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VMUIk1o86kq7ilsu3dulB0Zcq4Bgif0IEpo1hy0Ljxs=; b=EkbN+nuEjzXp3iIpw5ZtRx/kO3v9HMKRJkmLP9Swf/ABwO6Pmnt46aR+5/5cOVCbiG B2k4IlORLBGQaDdr55vPBsxhDB/Xb/cRSdRV23FluJN2JJ3ffowm36kIUJUCPH5UbFed 1HoYDBwbfcc7s1JTGnDPEYJ5rl+kjx7iQrzvc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VMUIk1o86kq7ilsu3dulB0Zcq4Bgif0IEpo1hy0Ljxs=; b=mWvMrV3u+tzOxRWmgg3t4Fr0/TrnPJYf5clNvN9ckk3yflGkqN3Ajdlu7FDogzP70w RexmX0oYOdkFeFHNzvMxqykDBxP1qH80GXFMYwHp3tgaeMuToAJ/X5JZ2hZRoUCHaclC BJb5Wx+hXvYIXNP0LkJoM3E/qefYn8wy6ieznt/GhBP2lUs8E821Byx90HYSKf5KvDuk 7D1IEtjLpaY1RGw4HAo145KRyrO1Z2GMvq6C/insWXL6spw3Xf+yRRGhk00FvVIL6CJi biM/SToKaqwoXnTdGeKr81FTeJRopLMXfIclILV4PKqx83TsHbI2PT8jUhOKsneEbQ1t eOAA== X-Gm-Message-State: APzg51ApoTCXAh/KRH73ggwwesViPeG6AaoTwHAsaXu8qVXbniWDzmUy 2dxXTAMhwGpbpxs0e/Zr7BJ35g31Rzg= X-Google-Smtp-Source: ANB0Vdb8MPufUfIDHXLerT70zs+8ma+OS5d/q6LxbHjFMydzgNL6/jmfCwM+sU+PhTPRamwTxeLKOg== X-Received: by 2002:a17:902:e109:: with SMTP id cc9-v6mr17254683plb.96.1537028269258; Sat, 15 Sep 2018 09:17:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 15 Sep 2018 09:17:31 -0700 Message-Id: <20180915161738.25257-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180915161738.25257-1-richard.henderson@linaro.org> References: <20180915161738.25257-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::62b Subject: [Qemu-devel] [PATCH 06/13] target/arm: Derive id_isar4 from features X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" ??? The assertion does fire for the old cpus; they may be existing bugs. ??? Willfully provide a value for SWP_frac that matches our implementation. Signed-off-by: Richard Henderson --- target/arm/cpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 2b199845fc..3c6ddd6532 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -887,6 +887,45 @@ static uint32_t resolve_id_isar3(CPUARMState *env) return ret; } =20 +static uint32_t resolve_id_isar4(CPUARMState *env) +{ + uint32_t ret =3D 0; + + /* Unpriv -- note we don't support pre-armv4t. */ + ret =3D deposit32(ret, 0, 4, arm_feature(env, ARM_FEATURE_THUMB2) ? 2 = : 1); + /* WithShifts */ + if (!arm_feature(env, ARM_FEATURE_M)) { + ret =3D deposit32(ret, 4, 4, 4); + } else if (arm_feature(env, ARM_FEATURE_V8)) { + ret =3D deposit32(ret, 4, 4, 3); + } + ret =3D deposit32(ret, 8, 4, 1); /* Writeback */ + if (arm_feature(env, ARM_FEATURE_EL3)) { + /* Note that EL3 indicates Security Extensions. */ + /* ??? In translate.c we check V6K instead. */ + ret =3D deposit32(ret, 12, 4, 1); /* SMC */ + } + if (arm_feature(env, ARM_FEATURE_V7)) { + ret =3D deposit32(ret, 16, 4, 1); /* Barrier */ + } + if (!arm_feature(env, ARM_FEATURE_V6K) && + arm_feature(env, ARM_FEATURE_V6)) { + ret =3D deposit32(ret, 20, 4, 3); /* SyncPrim_frac */ + } + if (arm_feature(env, ARM_FEATURE_M)) { + ret =3D deposit32(ret, 24, 4, 1); /* PSR_M */ + } + /* + * SWP_frac -- Value 1 indicates that SWP and SWPB only work in a + * uniprocessor context. Looking at ARM_FEATURE_SWP, we will have + * already set ID_ISAR0.Swap to 1, which means that SWP_frac must + * be ignored. While leaving this field 0 may not match certain + * real cpus, it is correct with respect to our implementation. + */ + + return ret; +} + static void resolve_id_regs(ARMCPU *cpu) { CPUARMState *env =3D &cpu->env; @@ -907,6 +946,11 @@ static void resolve_id_regs(ARMCPU *cpu) orig =3D cpu->id_isar3; cpu->id_isar3 =3D resolve_id_isar3(env); g_assert_cmphex(cpu->id_isar3, =3D=3D, orig); + + orig =3D cpu->id_isar4; + cpu->id_isar4 =3D resolve_id_isar4(env); + /* Willfully ignore the SWP_frac field. */ + g_assert_cmphex(cpu->id_isar4 & 0x0fffffff, =3D=3D, orig & 0x0fffffff); } =20 static void arm_cpu_realizefn(DeviceState *dev, Error **errp) --=20 2.17.1