From patchwork Wed Sep 13 09:30:06 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: 1833440 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=StI41PZp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RlwFR1LGyz1yh6 for ; Wed, 13 Sep 2023 19:31:39 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qgMCr-0001FB-Nx; Wed, 13 Sep 2023 05:30:45 -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 1qgMCq-0001Di-8U for qemu-devel@nongnu.org; Wed, 13 Sep 2023 05:30:44 -0400 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgMCm-0002JY-DE for qemu-devel@nongnu.org; Wed, 13 Sep 2023 05:30:43 -0400 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-402cc6b8bedso74613855e9.1 for ; Wed, 13 Sep 2023 02:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694597437; x=1695202237; 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=4Qlz4UlYziPNq8F2NThvhMEsqE2XcvVN84mcny9xQ0s=; b=StI41PZpsGof1u6ic0imNlFMajuNiHlWROgMEep7VDj4TXwcRMamR5f4CGDKsJlTnw K5QKBYzQOuPl9Vja6/MeTf7CB1UhaiZZpeuqlFdlJzGAszxgvttC7Y+CaidTXECM5ePf Tceqrk7fK/Zh+Ts7jgT/cBgeGMxu689TpnWVwRrDHgzX7cljCH748yX9Qj1FAUuCc+4D 84iMOtoC/V19K9k7PfBegkgSlM8NgZ+2hjFi6FKkdwx4JyKd5QztGPTOOiWYFy1/upv5 un9BQ8Rt/58Fz9wOkSxGb6sDb6cTRAbBqjirdvAJNgwpC36baGeruxMT5DUAQUqytdjI xd5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694597437; x=1695202237; 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=4Qlz4UlYziPNq8F2NThvhMEsqE2XcvVN84mcny9xQ0s=; b=YhOvbRKvfFq0EoPyKObcwKisaehwst5TjcCD8UsSrkQ2kugXF2xlNFdEfhZGsk/Sbj 2p/yfQdUmavsHYSki6xUMVP+3kHg1X8HuAOKk1+jhzzCFtqg3V09O5ChJZtKUa5Mbak6 TIhbx3XQZCP5QCbAqdJWLfLB7sevDLLMFdxJPAwjNM9C7xzI07VZfKYoF5dSciTIQ2QG 0vLiD3uUtDprHbHIrVl/0La0RK8siSty5Xn8Ogpk8pE7rLpDOW2wrCDasYDQ+D3RjtTi JyYWrM/hA3wrKBgaaUgLnsu6r5HHiFfUABgCuaiU5pr2YRZLy/Em9MCXxrgS3WMD9265 FWUQ== X-Gm-Message-State: AOJu0Yzh7+TFFWXJp6zHlmlc7Zf0kB9qQxkRPrU4Tkh3ZUGEtFo5ir5d dRuKtDvToGjMN4nsIGfVgTYG3KBKBJHL8CwmAJg= X-Google-Smtp-Source: AGHT+IEWpdoM+WDhrPjgODkxBAhlOnSq5m//vf86ss/9hM1maxstZ2t2i4/KaLoJUfi0o2DpthLKLQ== X-Received: by 2002:a05:600c:1c89:b0:402:cf9f:c02d with SMTP id k9-20020a05600c1c8900b00402cf9fc02dmr1480014wms.8.1694597437459; Wed, 13 Sep 2023 02:30:37 -0700 (PDT) Received: from m1x-phil.lan (176-131-211-241.abo.bbox.fr. [176.131.211.241]) by smtp.gmail.com with ESMTPSA id x20-20020a05600c2a5400b003fe601a7d46sm1452383wme.45.2023.09.13.02.30.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 13 Sep 2023 02:30:37 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , kvm@vger.kernel.org, Paolo Bonzini , Stefan Hajnoczi , Michael Tokarev , Kevin Wolf , Richard Henderson , Daniel Henrique Barboza , Marcelo Tosatti , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v5 4/6] target/i386: Move x86_cpu_get_migratable_flags() around Date: Wed, 13 Sep 2023 11:30:06 +0200 Message-ID: <20230913093009.83520-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230913093009.83520-1-philmd@linaro.org> References: <20230913093009.83520-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32b; envelope-from=philmd@linaro.org; helo=mail-wm1-x32b.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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org x86_cpu_get_migratable_flags() is only used once in x86_cpu_get_supported_feature_word(). Move it the code just before its caller, to reduce #ifdef'ry in the next commit, when we restrict both functions to system emulation. Signed-off-by: Philippe Mathieu-Daudé --- target/i386/cpu.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b2a20365e1..3df85a6347 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1664,29 +1664,6 @@ static inline uint64_t x86_cpu_xsave_xss_components(X86CPU *cpu) cpu->env.features[FEAT_XSAVE_XSS_LO]; } -/* - * Returns the set of feature flags that are supported and migratable by - * QEMU, for a given FeatureWord. - */ -static uint64_t x86_cpu_get_migratable_flags(FeatureWord w) -{ - FeatureWordInfo *wi = &feature_word_info[w]; - uint64_t r = 0; - int i; - - for (i = 0; i < 64; i++) { - uint64_t f = 1ULL << i; - - /* If the feature name is known, it is implicitly considered migratable, - * unless it is explicitly set in unmigratable_flags */ - if ((wi->migratable_flags & f) || - (wi->feat_names[i] && !(wi->unmigratable_flags & f))) { - r |= f; - } - } - return r; -} - void host_cpuid(uint32_t function, uint32_t count, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { @@ -5679,6 +5656,29 @@ CpuDefinitionInfoList *qmp_query_cpu_definitions(Error **errp) #endif /* !CONFIG_USER_ONLY */ +/* + * Returns the set of feature flags that are supported and migratable by + * QEMU, for a given FeatureWord. + */ +static uint64_t x86_cpu_get_migratable_flags(FeatureWord w) +{ + FeatureWordInfo *wi = &feature_word_info[w]; + uint64_t r = 0; + int i; + + for (i = 0; i < 64; i++) { + uint64_t f = 1ULL << i; + + /* If the feature name is known, it is implicitly considered migratable, + * unless it is explicitly set in unmigratable_flags */ + if ((wi->migratable_flags & f) || + (wi->feat_names[i] && !(wi->unmigratable_flags & f))) { + r |= f; + } + } + return r; +} + uint64_t x86_cpu_get_supported_feature_word(FeatureWord w, bool migratable_only) {