From nobody Mon Feb 9 14:33:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1614206814; cv=none; d=zohomail.com; s=zohoarc; b=ePm6JZKkdDzaTmqay9Cy1BvPa7hMBeiX2anPq8emgGfp923N6391jgU1wGYhuBEdOkahdb1CC0FqKIdrdVdcP1jlA6BV2s07v+X8Nwozl+loNGkQfu+6tv4Z7rlagCmF8A01BS76vnr5BykbY3PddH5Eq5oy4dO8NsBGFeoNSbQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614206814; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=jgWdWHFwH3GPEoRT+YI88TAr98KJDCoswSi3P2gfRf0Usqrd98Awb9p3jtt51ylEOscvsdegfiFFMg1fU6xYfvVMojkhRlNZF7xuTGSC0rsj57kp9UjAx5Lddsb+xfpvgH5fHW3PkZ1cRvptzBXb081u7IiIS8asziURkQ90PFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1614206814185168.40947633030976; Wed, 24 Feb 2021 14:46:54 -0800 (PST) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-Myoji-XJNcO5wWOnpis40w-1; Wed, 24 Feb 2021 17:46:51 -0500 Received: by mail-wm1-f70.google.com with SMTP id z67so1140687wme.3 for ; Wed, 24 Feb 2021 14:46:50 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (68.red-83-57-175.dynamicip.rima-tde.net. [83.57.175.68]) by smtp.gmail.com with ESMTPSA id q25sm4758201wmq.15.2021.02.24.14.46.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 14:46:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614206813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=KshQCUPQussEcAAXYLu727fzSayvbYnG85geCUrHlz8uOeLRkAmiqvmmBhdrSRyRK/8Dnm mDacX0axItYLCkdo7sf32l7MD30H8cpEJdTVutCTS34sExCMtPegh9gayLFCZl/uaa8Un9 Pie6gz4s70xirJtjWN04bpy3VcUwwFk= X-MC-Unique: Myoji-XJNcO5wWOnpis40w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t3qKRL/5hKgwJjLrl6DX6z760KxMHjG0maONNBBWZOo=; b=IeRZqnBHXR3T/hGx+O3hwFkzNMvFvUxzRxGxD7bwF3Vhv92eyt08foFlit9bDg1QDG IFHnaor38f3Cj+XoMDxee8mpWonJC8CyvVkZgdIQZpH8McM0PJLJJZHybEYSdr/DUPSj vK8t8Syfe54sCrj5EC/zZN1Rd/1QGGPP4lNnm9F+KVj4V0IStZeljWLfbWdGibM9m6qn FvwMp2Spn8bq8XZLc4v5pr7QfAmZ2762kwyk0Fo6+ONLbZG7ot1ES1rezJ/kUwR8ZKi6 D/SrYvdsLv4livANwMX/E2LZ/GsZKzROvPnYqwP5dSw+PCFIgL/N7hBaynr4DHrtoq9i ncVw== X-Gm-Message-State: AOAM531xl2KHPjeEgzNjMWGsPcuSA7XA7jXmAog1FakG7GtgCioH/6HC lGf0hR+aG8vWvfZLcIe2rds8B8V86PSpG/yBxJMT689gYQ1GNR44UAOEBiEBpNKTaojaonX+bhT r7GZi9kHzhJVRmw== X-Received: by 2002:a1c:f019:: with SMTP id a25mr246698wmb.125.1614206809982; Wed, 24 Feb 2021 14:46:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQ+LuWPaYSFLObDEA74/DDMFN9RFH/Udtvzcf51ajVQ+91j2B9aI4fPRfdXCuPOpXN8X7TwA== X-Received: by 2002:a1c:f019:: with SMTP id a25mr246680wmb.125.1614206809872; Wed, 24 Feb 2021 14:46:49 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Markus Armbruster , Laurent Vivier , Eric Blake , Marcel Apfelbaum , Claudio Fontana , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v5 1/4] target/i386/cpu: Introduce get_register_enum_32() helper Date: Wed, 24 Feb 2021 23:46:40 +0100 Message-Id: <20210224224643.3369940-2-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210224224643.3369940-1-philmd@redhat.com> References: <20210224224643.3369940-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Introduce get_register_enum_32(), similar to get_register_name_32(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu-internal.h | 4 ++++ target/i386/cpu.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/target/i386/cpu-internal.h b/target/i386/cpu-internal.h index be688cb393e..9df24c482ea 100644 --- a/target/i386/cpu-internal.h +++ b/target/i386/cpu-internal.h @@ -20,6 +20,8 @@ #ifndef I386_CPU_INTERNAL_H #define I386_CPU_INTERNAL_H =20 +#include "qapi/qapi-types-machine.h" + typedef enum FeatureWordType { CPUID_FEATURE_WORD, MSR_FEATURE_WORD, @@ -55,6 +57,8 @@ typedef struct FeatureWordInfo { =20 extern FeatureWordInfo feature_word_info[]; =20 +X86CPURegister32 get_register_enum_32(FeatureWord w); + void x86_cpu_expand_features(X86CPU *cpu, Error **errp); =20 #ifndef CONFIG_USER_ONLY diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 219d7652524..ffa342171ba 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1476,6 +1476,11 @@ static const char *get_register_name_32(unsigned int= reg) return x86_reg_info_32[reg].name; } =20 +X86CPURegister32 get_register_enum_32(FeatureWord w) +{ + return x86_reg_info_32[feature_word_info[w].cpuid.reg].qapi_enum; +} + /* * Returns the set of feature flags that are supported and migratable by * QEMU, for a given FeatureWord. @@ -4548,7 +4553,7 @@ static void x86_cpu_get_feature_words(Object *obj, Vi= sitor *v, qwi->cpuid_input_eax =3D wi->cpuid.eax; qwi->has_cpuid_input_ecx =3D wi->cpuid.needs_ecx; qwi->cpuid_input_ecx =3D wi->cpuid.ecx; - qwi->cpuid_register =3D x86_reg_info_32[wi->cpuid.reg].qapi_enum; + qwi->cpuid_register =3D get_register_enum_32(w); qwi->features =3D array[w]; =20 /* List will be in reverse order, but order shouldn't matter */ --=20 2.26.2