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: 13380512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EBADCA0EC3 for ; Tue, 12 Sep 2023 02:17:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236827AbjILCRz (ORCPT ); Mon, 11 Sep 2023 22:17:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236033AbjILCRm (ORCPT ); Mon, 11 Sep 2023 22:17:42 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5395710ACF for ; Mon, 11 Sep 2023 14:27:08 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-52c88a03f99so5928476a12.2 for ; Mon, 11 Sep 2023 14:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694467523; x=1695072323; darn=vger.kernel.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=KxFAJZzmn/mYaRYJooHN2w2mx7TUloezXSuIwyeD7OR4rXzbtC1IFkZ6si3hBsphDQ l0Ie49dilIsdXfGTHI5hyaO2pEDwOAuHmEkai55Em99xjduA1iqCdcNIVCm/lnTVd4F6 L62L3PbxQyxxnwzyXnNtB5LIrsPioWIoGlsOO8+tJHGVNPlMA+bI7LS7FrAzLUMbHuje HlMib9GsFG6fz5Gp0oizoEBzND6T0cZDM1WfROvgJ6wdSECg1h/LPf4dSTQpht5lQykx 5D8E6jxD4cdhF7TSaPP9CGEvfqDOqcjn5FAh+YX1qLinkeJlytrj6utJ1deG8RRaNzaI 9+0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694467523; x=1695072323; 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=AsaQYuBY1fGcITwCRzZA5XKwkl8V58bGvP09mhHHWwOUQs+utENR1jYOgMO0YBJUE8 knB5oFOaB47FAzFNVclRbi8Qshw/YFiIFN1l14UIKhycdyIMm4YqajEn2fKy0FU48q6E ZSSHx8B7/VuOzRfBvfTKyb9Vs8lKzvsrCudM4H2eY+oJP8pKkpVZu4KETliV8WUIziLj ZFbzaOvhM+m/9uJ5o1oY3E+plcGq0e9Y5dfOoJVDZ4Py6/brvdm/I5381uVCECj2HOwR CHQsx/sgtJH3pU04IPDo/B+am0NMg2GiZWDEp+ZyOpyEyj4kTHLZYu5olgBP3jc8fIy/ Dw3w== X-Gm-Message-State: AOJu0YzECBXlmdh/cj34Kb+yZqPE70I+msqeSWhiZRrOQ02U39p7yrUB VSMJNWupi/+KGJWJqciGNGe69fWnyglOEkMMyYw= X-Google-Smtp-Source: AGHT+IFb5xqfZhu6crzjkbBsTvKTmhmHOZhghmVtnzEZLh0+fZEAmQHgX4ItZFeAc78+suXTk4fGFg== 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 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.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); - } } /*