From nobody Mon Feb 9 08:06:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1563794382; cv=none; d=zoho.com; s=zohoarc; b=UDna84A9zBEDbPiT4uEMtQFPcI1UROGUFKfIiVpyGEExyaaya4d3eBDuVpHByqgtgRhxYya7Sy0VHhF3Izntw94qBNb5v8pIjI/T1IrgoFty12E+LL9lApuvGRtnNB6Gyx9xGYY/tT8qD+XGKumJ4HkigbIK64fIDK++fd0fXHM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563794382; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=ldvnOqlot+qdpEWUg3Q+YzBAvRrhAotsXklrj4ILSb4=; b=Z0MAabwwFHRCktKe4MyBzA/JlJA+j8zPcnZHKiEqR+s0IyZEsrPb9fjrZv2VMep4bPdv0smqqaaygswU9pUPWOZDTVkEixjyTE5aEVDVsEu3Sc/jcOflE5M+3h/DFYsZHUIeV9r4cq8LpzhMHDZqJGGZ3mSP4/R3Go8F/fp4aQw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1563794382483807.1587812826465; Mon, 22 Jul 2019 04:19:42 -0700 (PDT) Received: from localhost ([::1]:60556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpWLu-0004Qt-0K for importer@patchew.org; Mon, 22 Jul 2019 07:19:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46615) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hpWLh-0003wz-UZ for qemu-devel@nongnu.org; Mon, 22 Jul 2019 07:19:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hpWLg-0005Ua-Q5 for qemu-devel@nongnu.org; Mon, 22 Jul 2019 07:19:21 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:35741) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hpWLg-0005TY-GR for qemu-devel@nongnu.org; Mon, 22 Jul 2019 07:19:20 -0400 Received: by mail-wr1-x443.google.com with SMTP id y4so39021299wrm.2 for ; Mon, 22 Jul 2019 04:19:20 -0700 (PDT) Received: from zen.linaroharston ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y18sm38214088wmi.23.2019.07.22.04.19.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 04:19:18 -0700 (PDT) Received: from zen.linaroharston. (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 323001FF87; Mon, 22 Jul 2019 12:19:18 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ldvnOqlot+qdpEWUg3Q+YzBAvRrhAotsXklrj4ILSb4=; b=y2qGZhKBPAugpPF2oKkNPRH6ut8JLduHFB7e9PiJSklFjug8Iro8CZPKwjx6b/c/Ww TSLPZYeaiBukt8FOzQcUvYqxfIkwSzuYwgFaA6PBFI+4VoZjw5CcZ2cvm5iGnNJ+iASE BuMGkPAsXKKMUUb2w/u/0JR1YCdGYaFQj85KeRIFz0iHpWHdx20/ivIdDuPEpFzk8UzN /5GY2aps9QGLuuxmPF94akAZwV1CFlzFH3DpPECNmnWPXOYmf/mVdb2eatgvAjtayQ7W acoBD2HcbBJIgRZbz+BF5HS4c8yKi/izCRgIYTtxze6f+WT2nZi5g32lMl+XEMsWmpIg kuwg== 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:mime-version :content-transfer-encoding; bh=ldvnOqlot+qdpEWUg3Q+YzBAvRrhAotsXklrj4ILSb4=; b=MbTib31Ie1a7ESKDRh3BB5qblrKJeAin8N8x2IiZF1DqjnxxHm8NrM1LtirnXtG6nL uv0t75vxLgny95ETS8oucySgs5w3yhChU85xIIYZMTJifrAKDIFv1dR7+MtIeZ1L05E/ 3IKyC7w2IDZf4i1WUEeky3Yky7qfz6u10YcjSo6glKifBhjptGDhTwaKOjivwH/Pd/qz uTLtO9XbEA7Uw5EHNQ0ajxGJsQtR7pPa3uhPwMCopUuECMRXK/Du9knh42QmhzeadYiW dVKPeY1087yFcvKzGrPXZUlFWvi1E/R/L8yVUpXzaIVoUtKnsjkCaKc0mn1EzRkE6vFq 7Eig== X-Gm-Message-State: APjAAAVe3Bi7raIGPF3FXQ2E6JiNPmXJBdO1AGDaEKb/aS+AUnO058yl MR+8QNQHmwQHPlePLGb4uSIa3w== X-Google-Smtp-Source: APXvYqxoLap1P3JnKB9gKIrxfWU8lD7jwyhh4FiMekXV2U1OIDKpZ8KuSBQ1ge89sjkKqfRmXeFlWw== X-Received: by 2002:adf:8364:: with SMTP id 91mr74101423wrd.13.1563794359135; Mon, 22 Jul 2019 04:19:19 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Date: Mon, 22 Jul 2019 12:19:14 +0100 Message-Id: <20190722111914.28574-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [RFC PATCH for 4.2] target/arm: generate a custom MIDR for -cpu max X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) While most features are now detected by probing the ID_* registers kernels can (and do) use MIDR_EL1 for working out of they have to apply errata. This can trip up warnings in the kernel as it tries to work out if it should apply workarounds to features that don't actually exist in the reported CPU type. Avoid this problem by synthesising our own MIDR value using the reserved value of 0 for the implementer and encoding the moving feast that is the QEMU version string into the other fields. Signed-off-by: Alex Benn=C3=A9e --- target/arm/cpu.h | 6 ++++++ target/arm/cpu64.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 7efbb488d9d..61eaef924e4 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -1605,6 +1605,12 @@ FIELD(V7M_FPCCR, ASPEN, 31, 1) /* * System register ID fields. */ +FIELD(MIDR_EL1, REVISION, 0, 4) +FIELD(MIDR_EL1, PARTNUM, 4, 12) +FIELD(MIDR_EL1, ARCHITECTURE, 16, 4) +FIELD(MIDR_EL1, VARIENT, 20, 4) +FIELD(MIDR_EL1, IMPLEMENTER, 24, 8) + FIELD(ID_ISAR0, SWAP, 0, 4) FIELD(ID_ISAR0, BITCOUNT, 4, 4) FIELD(ID_ISAR0, BITFIELD, 8, 4) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index b1bb394c6dd..c121d0b37e0 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -296,6 +296,16 @@ static void aarch64_max_initfn(Object *obj) uint32_t u; aarch64_a57_initfn(obj); =20 + /* reset MIDR so our franken-max-cpu type isn't mistaken for a rea= l one */ + t =3D 0; + t =3D FIELD_DP64(t, MIDR_EL1, IMPLEMENTER, 0); /* Reserved for SW = */ + t =3D FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); /* See ID_* for = details */ + /* Encode QEMU version details */ + t =3D FIELD_DP64(t, MIDR_EL1, VARIENT, QEMU_VERSION_MAJOR); + t =3D FIELD_DP64(t, MIDR_EL1, REVISION, QEMU_VERSION_MINOR); + t =3D FIELD_DP64(t, MIDR_EL1, PARTNUM, QEMU_VERSION_MICRO); + cpu->midr =3D t; + t =3D cpu->isar.id_aa64isar0; t =3D FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ t =3D FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); --=20 2.20.1