From patchwork Mon Feb 21 09:27:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 544410 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp3100672imn; Mon, 21 Feb 2022 01:37:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaqHP8dUClG+dRNxkrx7GapUR53sGzuFpu1tXiWyxEfaLoIbWJ8R1bvKJcSEPpN5j2nxnp X-Received: by 2002:a37:6c46:0:b0:60d:d526:7e48 with SMTP id h67-20020a376c46000000b0060dd5267e48mr11353658qkc.451.1645436229201; Mon, 21 Feb 2022 01:37:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645436229; cv=none; d=google.com; s=arc-20160816; b=xOjFsZjYZlElM2YN7s9v8XIcM4BXbQtMHnXNRvXMn4dfDXjSl22LuIHZoNiaa+KM4U 5VBKpy1U630m3VzautmQY2Ba7rc1Ix6zs6jLUFwxfxWOKmFX4DkD3x426yFlS7+tUiTq hevV/sZFEFqMbIrBB5PRldXo+r1reH0EC0S8eT89or7uaX4l2OQbAME5GkVY2FVsJjTM 4oJYFRBFv4jhfGe8rEW2waMEA8zJmIbPDHfGLB5QEvpaZdmSFXfk546Geugz9Vx3lIsC nQ9Clu2mU97jrNzWq9+Oyd8VCBNZ6sfFJIMaPpiupSk2xXfdHfKtL1TPsKMUuBH6Eor/ yRYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=u4Q+Hke1BccBlcaqJg+5JH0IMmPFZMSy7PZO5x6wtSc=; b=Cvt1G6/MtM++yVcSLvHIWuPHvj6HtoZlUTAFLd7mXTjG8SqhHJcVAYJ+fGgXlTjJi3 HmqM45QvkGLz1kzQtH5ICetMDeU+5DRtLKBzDRuweGI+zbbWbPYfYd/o2AU6chWmpnJo 9pJGfRZPA3sU7slRj4iLy0NqcUCJZEHchre8qubsmCvETdnFeD2EFQ52XUO3JVI1aXYW DUkRrWUrPob3JxTDkUnOUNzl9/H+CrbPlmpP3a9Df47ygByI/w+GTA6cDspKkx4tKpAu nXa514qBcd8vukpLYtaJgh1SE/SnlXvpQVHVcBagzwmt7EJUeXjcn8o/5MDrNkBqfjCC SAFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NFfBpe6C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n17si15315125qtk.126.2022.02.21.01.37.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Feb 2022 01:37:09 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NFfBpe6C; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:47686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nM580-0005V7-NH for patch@linaro.org; Mon, 21 Feb 2022 04:37:08 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43876) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nM4zO-00085H-Aj for qemu-devel@nongnu.org; Mon, 21 Feb 2022 04:28:14 -0500 Received: from [2a00:1450:4864:20::433] (port=43540 helo=mail-wr1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nM4zM-000112-S9 for qemu-devel@nongnu.org; Mon, 21 Feb 2022 04:28:14 -0500 Received: by mail-wr1-x433.google.com with SMTP id i14so25874413wrc.10 for ; Mon, 21 Feb 2022 01:28:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=u4Q+Hke1BccBlcaqJg+5JH0IMmPFZMSy7PZO5x6wtSc=; b=NFfBpe6CFa1e6lvwaau30cagWbybPB72TYcBmgAyLJYb5ZYHC5wzghws3aKRp+4HDU AmaHQTrOUjy/ZojGbaYc8JtgMDaPkyvwihK70OQPYeDZPeP2pMeCl9NRUeMaTq1CfU9C msNNUMJsU8PSMRiM6kxsKzNNd15oUXirQ1XoYbcf4UJaOpcy8pbhGv4Ik6iLV2psYuLc 7Fv+xm+4DnR/0zbDDvXDDlda3qRMfLoNatAuQwXIPEqfKVWQlaP3p3FA6zvbznal0mY/ Yg8uZ19BZ/jG98T0QWYiB3EtYF4YorruT8Fw9pGPy/WPJlKzUDOWWQbnDXjJzNeULF4N Wo6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u4Q+Hke1BccBlcaqJg+5JH0IMmPFZMSy7PZO5x6wtSc=; b=MKedZOoE14WRLfj2tifKnOK1p5dawgNJ+pbzma6QBALIQlPf3rc98+CjZ6xJXxZ/He INlxk81tejMnfoN4wapkBlEYak/vdQw2KBk8QkZxv+Ojk51UsC7c92SGckGPjzl3/um3 PS18jPBYiR092OIfqwJoxBj/UZy/RZ5bOtGsSHHhiXQReFoAo34vsZqn/uMsZd5wTmU1 hWZyv4U4OTn4b8WlrI1NvH4nMmzR7Fv94lxsGItN+yQoP1e93L/77H7MukLXK96g4Fmf jKG4z/54fg7etx1bzJWqSuN9HQpiTBjEM0f/7PbnN71fSWiuaAbeJ23N/F0+ww4vX/bU 8+FQ== X-Gm-Message-State: AOAM5319gFa0R96ifGb3Lk2Xk5o2Gc0uFK5DDqfNTa887HcjAS6qSTU9 Q8DMODutugIo/IWp73PEKMHdNUTnTFwjIQ== X-Received: by 2002:adf:f5c3:0:b0:1e3:3f71:7974 with SMTP id k3-20020adff5c3000000b001e33f717974mr14705649wrp.587.1645435691555; Mon, 21 Feb 2022 01:28:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q76sm7555778wme.1.2022.02.21.01.28.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 01:28:11 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 11/26] target/arm: Fix '-cpu max' for HVF Date: Mon, 21 Feb 2022 09:27:45 +0000 Message-Id: <20220221092800.404870-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220221092800.404870-1-peter.maydell@linaro.org> References: <20220221092800.404870-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::433 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 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, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently when using hvf we mishandle '-cpu max': we fall through to the TCG version of its initfn, which then sets a lot of feature bits that the real host CPU doesn't have. The hvf accelerator code then exposes these bogus ID register values to the guest because it doesn't check that the host really has the features. Make '-cpu host' be like '-cpu max' for hvf, as we do with kvm. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Andrew Jones Reviewed-by: Alexander Graf Reviewed-by: Richard Henderson Message-id: 20220204165506.2846058-6-peter.maydell@linaro.org --- target/arm/cpu64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 2280e476fd7..19330d9ee94 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -29,6 +29,7 @@ #include "hw/loader.h" #endif #include "sysemu/kvm.h" +#include "sysemu/hvf.h" #include "kvm_arm.h" #include "hvf_arm.h" #include "qapi/visitor.h" @@ -710,8 +711,8 @@ static void aarch64_max_initfn(Object *obj) uint64_t t; uint32_t u; - if (kvm_enabled()) { - /* With KVM, '-cpu max' is identical to '-cpu host' */ + if (kvm_enabled() || hvf_enabled()) { + /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ aarch64_host_initfn(obj); return; }