From patchwork Fri Feb 4 16:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 539870 Delivered-To: patch@linaro.org Received: by 2002:ac0:f7d2:0:0:0:0:0 with SMTP id i18csp3413547imr; Fri, 4 Feb 2022 09:04:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdUFaaZV2VqsqewoqAEejYf4SNtyNHbtFUiyEhPjNOzsRKSgVqhdz0tJ3JKLasfKnc8qdR X-Received: by 2002:a0d:f601:: with SMTP id g1mr3699083ywf.441.1643994288536; Fri, 04 Feb 2022 09:04:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643994288; cv=none; d=google.com; s=arc-20160816; b=ot3JkhGZImJRSmn/SrfejT4znSM63KWnOn+0JutNhGfSkOYG2SfU95jurIL1pFLNPc ShASe4lFqRkHOWGpIc3xzBjRsm+57XahRfLk7SSd/o5N+hDP1AiYUB7h43cLDyvH5mby p6A1K7M2YVg5SWG2jtxPwvgEU/T6ZrK6ll+ei+7Ete3xBv3Efoqca3nC0V/yXaig1Oui kzdtnHSf8c4r517ztXJfe9Jb3eOobzPDEFi2w2W9y1tAmi4jK/1kDYbf2Yp7r2Zh55qb TxvIKOeJjWx9TXuyxlw0Y930Xt2npceQ7A4apQY6tG6K5uMn+QNarV16lrF7c8KzJiWW 5hgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc: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=GEq+WVisRup7DDWYvHMkPo67hjMY0sbprx528SyyNTQ=; b=Tb1vSjx4nRt59jAPrNXbNFujJ8ZqBlUHxr//YFpTqBCR1t+kg/w+SuXLgkKehvznTc 5r+Id9x6mSHaSRzMheofL692jpK+iuoEcW6Pi7//poeQrytvxzXj8WTD0+4pGfXVhumJ A9lL8w824e2BYxQP0v6GOAFr4BRbd9fQdEMRwhTahEBwAPh3V4wcBSOQufhOKUL+Fg/D C7CWLty3Ok6LcZWr22syETNzneRgP6SraLabVC0b+pScUEnEP2A+9M7ZmRaBjY1rNcsm 0r4ypPF+eOdEt6g79LZgmDkuNaudhpzOvW+/b0AnCkwAjTALuL9JE6gLH+XgagmdeM2I L2lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=PQW6Y+Kh; 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=fail (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 u192si1721543ywu.342.2022.02.04.09.04.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 04 Feb 2022 09:04:48 -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=fail header.i=@linaro.org header.s=google header.b=PQW6Y+Kh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nG20t-0001KA-T2 for patch@linaro.org; Fri, 04 Feb 2022 12:04:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nG1sH-0002xR-FS for qemu-devel@nongnu.org; Fri, 04 Feb 2022 11:55:53 -0500 Received: from [2a00:1450:4864:20::32d] (port=50887 helo=mail-wm1-x32d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nG1rt-0003D9-Gy for qemu-devel@nongnu.org; Fri, 04 Feb 2022 11:55:40 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m26so4997078wms.0 for ; Fri, 04 Feb 2022 08:55:13 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=GEq+WVisRup7DDWYvHMkPo67hjMY0sbprx528SyyNTQ=; b=PQW6Y+Khj/Qrk/sc1YwfoCROKa8j6BW6/7xmrhbN8wqRmSbSkVsTSnrD5ufGRVtcfa ZfVORtiCLtcxI1/yTmDSQ/ZKSOZoyPkXHnI/9+TqSj2vSqMyzNGpeIWa9K5huorHG0PZ rt8ET0hlnowomjeeY545wWe4f/1QtW0axvsSio2RdayhkzLMEYxp+CQjv/zbQqq2Xcpo kixIi1HEQyEiRp3bVI3INtT7pnmBICcReryzz+X0FmVO86appphrGR2lqvRHD5iY9KCg BELIJg/GUM0Kyz1V1xOFkWLvs2yVcK9lerlDcx1EOWi/tQ66iREdivNdbDQgUHMQbq7Z VNQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GEq+WVisRup7DDWYvHMkPo67hjMY0sbprx528SyyNTQ=; b=OT8sxgAoClCenuLEsxBGfOO48lzf90PIlKbwhzj2ulZ9PC7ebDE+Ryybarcjcw2sCI qP9yX/MYWHqOJgq9kXvwsMc6AFXkk4X/N1ZsIDrXOUSAzLKXSHTSQp5mpimrNlMk9CS7 xC0dlqbTDpSaHNMqIjv+hBP7xGvzmtNP/8XWPY83yEcRr5Y6E58eCveyaNbW2Ma/jNKa whdndQ7SNcfmVjOCAqpVJ4H7fa8tWLYgsnGGCdoq4HhvpNr5L8i+9dXeD6V0COvLCf0s j0cEzTVQwxnPfQ5QdzY6V9zoxnB2opreqzBLtI1Khq46qyUXLlz8flRMXmeNwNeR1F5i lBDw== X-Gm-Message-State: AOAM533W47jJ4PBMqPX6F8iJsAFKYzbxrpXmQ5aR+W+ZHBX2KOCYpWxS UruYruYR28irFEW4BgzvipBlaQ== X-Received: by 2002:a05:600c:3ac5:: with SMTP id d5mr2997821wms.101.1643993712352; Fri, 04 Feb 2022 08:55:12 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f12sm2486254wrs.1.2022.02.04.08.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 08:55:12 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 5/6] target/arm: Fix '-cpu max' for HVF Date: Fri, 4 Feb 2022 16:55:05 +0000 Message-Id: <20220204165506.2846058-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204165506.2846058-1-peter.maydell@linaro.org> References: <20220204165506.2846058-1-peter.maydell@linaro.org> MIME-Version: 1.0 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::32d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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.001, 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: , Cc: Andrew Jones , Alexander Graf 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: Richard Henderson --- 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 bc25a2567bf..fd611c97116 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; }