From patchwork Mon Feb 13 09:50:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Liu X-Patchwork-Id: 1741548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BxKAVdwX; dkim-atps=neutral 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 4PFflF09Zwz23yT for ; Mon, 13 Feb 2023 20:52:25 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRVQG-0002zi-8Z; Mon, 13 Feb 2023 04:46:56 -0500 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 1pRVPa-0001b7-IN for qemu-devel@nongnu.org; Mon, 13 Feb 2023 04:46:20 -0500 Received: from mga12.intel.com ([192.55.52.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pRVPU-0002o2-MQ for qemu-devel@nongnu.org; Mon, 13 Feb 2023 04:46:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676281568; x=1707817568; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LbIBx9OtUQnbbe6kZCQOlJq8E9y1jdZtSG9kZ/TN2oM=; b=BxKAVdwXpeg64VmBwjN72KVFkuxcdBrrShOuY0LkD0rhBiML2c+eAR9L p6Bf94BTCjeJoGs5VAnINL2vGQhSMwFSzviEGIjfw/yYllpbEScio40Oz LHpjSEjPJMW4faPQ+U1kM8k3pgUSsmyX7wLJcsUFmTvClqXQyAigWAHxU 4du3svBgyjebYSUivPLRG4PWmkQgV4pwzX/GwNFMSh/j0YZ/drv2pHTMw N89kTvv2BD3aqlb8MVr4DXYn2xGlL1S8JZP2tBAM+WW1v69Cb9VhvJ+Fs 5xJ531QjruO4rKexmL0Hkn9j93hrFY3/VrIlYO7FmR7kd9ghtbZ5BptS/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="310487067" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="310487067" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Feb 2023 01:45:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10619"; a="670760633" X-IronPort-AV: E=Sophos;i="5.97,293,1669104000"; d="scan'208";a="670760633" Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.112]) by fmsmga007.fm.intel.com with ESMTP; 13 Feb 2023 01:45:30 -0800 From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Yanan Wang , "Michael S . Tsirkin" , Richard Henderson , Paolo Bonzini , Eric Blake , Markus Armbruster Cc: qemu-devel@nongnu.org, Zhenyu Wang , Dapeng Mi , Zhuocheng Ding , Robert Hoo , Sean Christopherson , Like Xu , Zhao Liu Subject: [RFC 38/52] i386: Introduce hybrid_core_type to CPUX86State Date: Mon, 13 Feb 2023 17:50:21 +0800 Message-Id: <20230213095035.158240-39-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230213095035.158240-1-zhao1.liu@linux.intel.com> References: <20230213095035.158240-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Received-SPF: none client-ip=192.55.52.136; envelope-from=zhao1.liu@linux.intel.com; helo=mga12.intel.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_NONE=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 From: Zhao Liu Currently, x86 only supports two hybrid core types: Intel Core and Intel Atom [1], so add the core type definations for Intel Core and Intel Atom, and add hybrid_core_type in CPUX86State. [1]: SDM, vol.2, ch.3, 3.3 Instructions (A-L), CPUID, CPUID.1AH:EAX[bits 31-24]. Co-Developed-by: Zhuocheng Ding Signed-off-by: Zhuocheng Ding Signed-off-by: Zhao Liu --- hw/i386/x86.c | 4 ++++ target/i386/cpu.c | 1 + target/i386/cpu.h | 8 ++++++++ 3 files changed, 13 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index a09df6d33fff..f381fdc43180 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -383,6 +383,7 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, CPUArchId *cpu_slot; X86CPUTopoIDs topo_ids; X86CPU *cpu = X86_CPU(dev); + CPUX86State *env = &cpu->env; MachineState *ms = MACHINE(hotplug_dev); X86MachineState *x86ms = X86_MACHINE(hotplug_dev); X86ApicidTopoInfo apicid_topo; @@ -564,6 +565,9 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, return; } + env->hybrid_core_type = + machine_topo_get_hybrid_core_type(ms, cpu->cluster_id, cpu->core_id); + cs = CPU(cpu); cs->cpu_index = idx; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 7d6722ab3292..266e981b79e2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -6845,6 +6845,7 @@ static void x86_cpu_initfn(Object *obj) X86CPUClass *xcc = X86_CPU_GET_CLASS(obj); CPUX86State *env = &cpu->env; + env->hybrid_core_type = INVALID_HYBRID_TYPE; cpu_set_cpustate_pointers(cpu); object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 30b2aa6ab10d..bb4e370f9768 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1543,6 +1543,12 @@ typedef struct CPUCaches { CPUCacheInfo *l3_cache; } CPUCaches; +typedef enum { + INVALID_HYBRID_TYPE = 0, + INTEL_ATOM_TYPE, + INTEL_CORE_TYPE, +} X86HybridCoreType; + typedef struct HVFX86LazyFlags { target_ulong result; target_ulong auxbits; @@ -1825,6 +1831,8 @@ typedef struct CPUArchState { uint32_t umwait; TPRAccess tpr_access_type; + + X86HybridCoreType hybrid_core_type; } CPUX86State; struct kvm_msrs;