From patchwork Mon Sep 11 21:13:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 721471 Delivered-To: patch@linaro.org Received: by 2002:adf:f64d:0:b0:31d:da82:a3b4 with SMTP id x13csp1314188wrp; Mon, 11 Sep 2023 14:14:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHifVx10W4PNBxqFJL4OSPxeM++ffYqPBnV70N/+Arxd4s/TPQl+6ijOX7yZBM4d/th3BTe X-Received: by 2002:a05:620a:4545:b0:76f:a86:65b6 with SMTP id u5-20020a05620a454500b0076f0a8665b6mr12890109qkp.63.1694466880080; Mon, 11 Sep 2023 14:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694466880; cv=none; d=google.com; s=arc-20160816; b=sCuw2exf9HjNFvnIiu97PJ29OeeYGWKhMOKIuOo500y+mQiST8ueAIfdaJ3Kz8Ila/ suBZZF0d5w470hi5SoXOxLOE+aN6nwrDHECqwHv3YslMuTz4UDn0VBfCol30AFQYpORu qSPpSypeS4Azs0P1q//dFEdeu4NpCXInuQYuhEsP96sPei8JWDWbE++AXuNyKNPKcQpm dLiAddJzPzbzaG+1UVZKZm0OO36aVZt4L3YM99DjWYH+E0JvBS1htj2cLtnWLpnj91S9 ro7QmDbXNl93cnI/Uu3DQVQMMDBxrYyxlMUBjTAocuSySz0hjB5q2PVz0riwXSxKSbFL OzbQ== 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:cc:to :from:dkim-signature; bh=krYgPPa35VQ/Pn0yOr01dbPDQetUwcBiBN86SxBA8xI=; fh=L5lG5N3YOEji5IZHrCtpjOPIXLZd9oK5uWbK9avwmpY=; b=I2Q5VAklFKRwkq5RJEt8gUsHkrd0er48d14PTktFv1ye5Miwu848lqig45ePVr8Sk0 C50iQ1w+9NdfkIZ4nG+2qVPRqJifkTL8HsybG4KtAqioNqz8y2Z9Ky/5H7NIGxbuS911 vr/Do3kXOBqa6vrLWRCZrp4VrOpvfk6vOIGf1tGHO3ul9Kwo2Nq/E00cWdN66YQUXCTw HwCkBARFxdW/Tt+X2bW7UMuv8/mhteGrygkuzYBB/Shw2PJDL0D8DKWwvh3OkSzTHHTA 6aoqGnr+HnSvWAD77MhCLPBE80r9nw3MTj2uYL7Ypp/SXieJ5zPu+2y+JoAHnJ2jyWCf JmJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DMmtUxDc; 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 v24-20020a05620a0a9800b0076cd8dab5cfsi5187419qkg.190.2023.09.11.14.14.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Sep 2023 14:14:40 -0700 (PDT) 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=DMmtUxDc; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfoDs-0003dL-1O; Mon, 11 Sep 2023 17:13:32 -0400 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 1qfoDr-0003dB-77 for qemu-devel@nongnu.org; Mon, 11 Sep 2023 17:13:31 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfoDp-0005Bv-01 for qemu-devel@nongnu.org; Mon, 11 Sep 2023 17:13:30 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-991c786369cso653480066b.1 for ; Mon, 11 Sep 2023 14:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694466807; x=1695071607; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=krYgPPa35VQ/Pn0yOr01dbPDQetUwcBiBN86SxBA8xI=; b=DMmtUxDc4vdYzacIveds67u34/IpRIDo/8oqLJ4rntX5q3yUoDQdtUVmWmVbdQF4gJ 11AbQPvobLU1+RwugK5iU3rTx9cR0oBcLposNprkuGqnBPwkRsbKJyC8DJSu7HNqYXLL 4mInct+0A3iswXezTIkTAO1MQmjabcIgdhIH2w0iZAZggqQ4toSFO7J5E8H+yD8maMtO RBYE7iAybRjIcDXOZkAP1NEn58vuEJ4FYZRhweklYu3SIN7e5x+1mBXBjURE89lKF2eD r7A0b3QM/Sl/d2RwKTPr4KBlMBmx7350ZQSaq2t/Cf6BRBJJOCQLeVa5O0z0ZTcBoBIq syOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694466807; x=1695071607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=krYgPPa35VQ/Pn0yOr01dbPDQetUwcBiBN86SxBA8xI=; b=ZGpQn0Q60p/araBM9xR181vtpbUSOgc2UKItS6Sq5J4elI10q+T5Gopdy4v+zksQTY 6j8t27MRzwyeSW0MVSb15aB7OgH2HDikvDR3dcvu9eHl/DNFoK706I9CyXf7rFMNZPM+ +HlHbz+6xallfpFNC/Pg7dZ2h5AW2G762NN5X/4O1k+52xQQ5IkeTrPL6N7dz9DUEIlT y3eJqeIkHMJpNGy5WNYSkP9Ud58CJEC3IxqQdEoXM3nhpUudbM6bxdb0UWaU/zIlf8gb 6yQSToeRcjXz8svD3nuEpNOVSu8MAIsU5hs5f5Z0QmEgnwDG69t3Hmvg0OzTZKOZsoHK XjUQ== X-Gm-Message-State: AOJu0YyzNXSfv2ia0Gh/H5RSFfRmyM5TBDZwUXbz6LebfGZgsCX6pTJv 22VsG2sv+yU6i6gufHDJ+0csUpIrKFHRq/NUA04= X-Received: by 2002:a17:906:749b:b0:9a5:852f:10bd with SMTP id e27-20020a170906749b00b009a5852f10bdmr8629126ejl.62.1694466807044; Mon, 11 Sep 2023 14:13:27 -0700 (PDT) Received: from m1x-phil.lan (tfy62-h01-176-171-221-76.dsl.sta.abo.bbox.fr. [176.171.221.76]) by smtp.gmail.com with ESMTPSA id gt34-20020a1709072da200b009ad8796a6aesm33004ejc.56.2023.09.11.14.13.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 11 Sep 2023 14:13:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, Daniel Henrique Barboza , Paolo Bonzini , Stefan Hajnoczi , Michael Tokarev , Richard Henderson , Marcelo Tosatti , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , =?utf-8?q?Phi?= =?utf-8?q?lippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/3] target/i386: Check kvm_hyperv_expand_features() return value Date: Mon, 11 Sep 2023 23:13:15 +0200 Message-ID: <20230911211317.28773-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230911211317.28773-1-philmd@linaro.org> References: <20230911211317.28773-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move kvm_hyperv_expand_features() call earlier (this will simplify reviewing the next commit) and check its return value, since it can fail. Signed-off-by: Philippe Mathieu-Daudé --- target/i386/cpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 24ee67b42d..760428d4dc 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -7107,6 +7107,10 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) } } + if (kvm_enabled() && !kvm_hyperv_expand_features(cpu, errp)) { + return; + } + /* Set cpuid_*level* based on cpuid_min_*level, if not explicitly set */ if (env->cpuid_level_func7 == UINT32_MAX) { env->cpuid_level_func7 = env->cpuid_min_level_func7; @@ -7120,10 +7124,6 @@ void x86_cpu_expand_features(X86CPU *cpu, Error **errp) if (env->cpuid_xlevel2 == UINT32_MAX) { env->cpuid_xlevel2 = env->cpuid_min_xlevel2; } - - if (kvm_enabled()) { - kvm_hyperv_expand_features(cpu, errp); - } } /*