Message ID | 20180514164156.27034-6-babu.moger@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <kvm-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E67DB60536 for <patchwork-kvm@patchwork.kernel.org>; Mon, 14 May 2018 16:42:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7B3C28390 for <patchwork-kvm@patchwork.kernel.org>; Mon, 14 May 2018 16:42:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBDAD283AD; Mon, 14 May 2018 16:42:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63CD028390 for <patchwork-kvm@patchwork.kernel.org>; Mon, 14 May 2018 16:42:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932306AbeENQm2 (ORCPT <rfc822;patchwork-kvm@patchwork.kernel.org>); Mon, 14 May 2018 12:42:28 -0400 Received: from mail-cys01nam02on0080.outbound.protection.outlook.com ([104.47.37.80]:44837 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932261AbeENQmW (ORCPT <rfc822;kvm@vger.kernel.org>); Mon, 14 May 2018 12:42:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=BdvpuPC9TFp8bFY2HBsGRV0gd8yK8SxKJEh6W4P3Ymg=; b=hfgTSRBf0PeAJWNlak7eTRmxLcp+mu9C6jREP2skV7Pw4jU9P+ngQIFgcmYxJnFVaR/6Mek1I1NVVmEl0XondFq2GEwGfpPZABvIbAwAWsDn2HnkbYH5rgAsXtkYWwlNR65xByl/7ifEBzEBrPQJMz+YcQqgpKsZ1vMY44LFfDU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from bmoger-ubuntu.amd.com (165.204.78.1) by MW2PR12MB2476.namprd12.prod.outlook.com (2603:10b6:907:9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Mon, 14 May 2018 16:42:18 +0000 From: Babu Moger <babu.moger@amd.com> To: mst@redhat.com, marcel.apfelbaum@gmail.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, geoff@hostfission.com, kash@tripleback.net, babu.moger@amd.com Subject: [PATCH v9 5/7] i386: Add support for CPUID_8000_001E for AMD Date: Mon, 14 May 2018 11:41:54 -0500 Message-Id: <20180514164156.27034-6-babu.moger@amd.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180514164156.27034-1-babu.moger@amd.com> References: <20180514164156.27034-1-babu.moger@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: SN4PR0701CA0008.namprd07.prod.outlook.com (2603:10b6:803:28::18) To MW2PR12MB2476.namprd12.prod.outlook.com (2603:10b6:907:9::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:MW2PR12MB2476; X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2476; 3:w36JgSs1ClLonb4OVos+CHva6Av7PlwqtwapUEx8Zib6GKsuKRmvBhCthet2WjoxQzJhYfByjUOgj0Ppf4nE4EosU6AbOTpy3j2mI2+Z2GzCf7/jpNFg9X9Tt85iEz1eCU1dylBsnitJxjB8fLuI5b8UWHKO9B/ISyi/JPHALBaXpiozBAeXZbnUETuFhoycjOlzxZa9pf4QyoWWb9+UvHowZXAyZpQhKMBHDd2EziQhrGWUqyCqLR6MCH/rZ/cP; 25:oLSEhIuS68V65VfEroCQMcxEjOj49la9wbJdDGNmNNUQA6Z/Ax/YyD6qHlD5yAA+3NrCSq8jkgJ/+RYdJ1M6iFXG+cHeNVcy5FsstzLvkp7li7Jm/DUqvluFanLh8cEYlymXapVy8xkZCLgFbASJIuISlWvbKRY7GQe4tP7/I6zJYN9SGaH7chQ/IfEMSYACkNL0+n8a+gjKXtWCSJkVZS0+XueXfWFHEr4IMQDe5wKhQMoL1UtpXFn4J4bHiCwQ658du1Amf0c7RRs9PS++I2+nNHoiYSMXUVdE2+A6JoV2KWIqHojx+qhP63SH/zjaztF7SM7yAMrLIc6rmZmNww==; 31:OjtbIZNg442iydIiH/KP0RdKP/Tg6rCXl6/LLlXxATOVfZVeJhjcz1PKqU6Kmig7XimBWgx5IJTnWX7fltNTEx8cIhQbi/atRB7h8L0qrPnMePnOH2QXHuvv5TYafb4Umu+BIgvAz/aeowZYVmNtHsvzOa27a+p9qOeDhHsC71zR02it/tOq7VKX6UlF+SopNjTTURq7BV49qcclsevqYQbkU9dLDb76nGy/oBpFWNc= X-MS-TrafficTypeDiagnostic: MW2PR12MB2476: X-Microsoft-Exchange-Diagnostics: 1; MW2PR12MB2476; 20:SoZguBNHNZgRmsY/6J3uXNRTs0n44QX6XyNTaz3Zz054WHYvb4SwJWU5C6hAtegWIpY/21jJy6OvJ80TRUbVMIiRM48t++ydEn8MQHnrTcYjQjnxVYY+bBte1h/PyB2f0lsArDwTNNkT3Nazi5bxgHUluBxcKySfNvfUl6VBshS5QTr2IzSuxT9iJMh52uOEO4r0ekBKIR2NMYwzSHtZaTAZuGOPQnzOccwCn8EilVitAymnHV7WfeLVgD3VTXK4WXq1gO28TGXGkFU16BeDYSa7dgdHt0439RUCGcT2yFDQJsqPXC+TH7lHlHizlq8LDVPdqyQrP0gZQdToO7GHxLDAkZrJMefcCR7eJS5rDsODDZoTvW7MBtAjHmjMd8SCRtLtc3P9AG05D4t9KaZLqIJcP+BUXCcxW7BBjNaWF9GH226nCySFGvKdGjRP+YyTyuur9h1+uZZqE+4a4Jct77PJfpzdfS5025eaaXR2juCb3gyUtnZa3EySoFwC1upP; 4:SSPDlUVCtEMJAyNgRxyt3bN0f9QwosOCYvNsXSmZYBgL6ZaQOTAVHk/sF/lloMUGuO7j9l8VcA8srGWX/RCYCU+XFqi12MC0V+Hgfubh5TnUMMxnVRp69Evk3WashxfMgmHc4dchruO2x0ne6VWvY5wlTFLQFBgGPnCSX3v3EPEk+vD13hYeGoG33r9yShdncFR/msW1Xa2KhaCbJvRGrK4H4mvvZeMnF6axoyLsFv7rs/OtkaHT2HTvoViGdPd1WGoGaFMvhs3rlqUZN3v6qm6rRWHIk47zU725ZNiyGTLDSgP+EgR6+NHVEjNEmlJt X-Microsoft-Antispam-PRVS: <MW2PR12MB24765C27B62DF133AE7B8733959C0@MW2PR12MB2476.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:MW2PR12MB2476; BCL:0; PCL:0; RULEID:; SRVR:MW2PR12MB2476; X-Forefront-PRVS: 067270ECAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(39860400002)(396003)(346002)(376002)(366004)(199004)(189003)(50226002)(53936002)(50466002)(8936002)(8676002)(39060400002)(48376002)(2616005)(486006)(476003)(305945005)(25786009)(7736002)(6666003)(446003)(11346002)(956004)(5660300001)(76176011)(186003)(36756003)(86362001)(575784001)(16526019)(81166006)(26005)(4326008)(386003)(81156014)(7416002)(106356001)(53416004)(72206003)(97736004)(316002)(47776003)(478600001)(105586002)(51416003)(68736007)(6116002)(3846002)(16586007)(2906002)(6486002)(1076002)(44832011)(7696005)(66066001)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:MW2PR12MB2476; H:bmoger-ubuntu.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MW2PR12MB2476; 23:zPrIcrUmSoAGqbrKWTJlxKogPj4NTZ61SMchLvw6o?= =?us-ascii?Q?C24EZGotv4GmOifKlXCojLk7z7/5m5l1lvgQc2qxsxiIql9idz9x5v0h+vCa?= =?us-ascii?Q?5e33DCl/446psVtWYaAJo7U2XVTKPxoEMLraWbtzvJA7DLxuoIzBoVJFwdeO?= =?us-ascii?Q?HloiHaQAtYc8zUSITnNbntDvoI2ZlDtWBK9TpzPZ6X9RmVIE38MFU+IMswMy?= =?us-ascii?Q?qMfE0rZ43UVhwAg186hkrBpc/773qo8GSVHJs7lvWVmsP5WKBBmpxZivy8jA?= =?us-ascii?Q?c17C5L/FqKWlkviWhtSGWYMKJIwWGbRW2IIsckSWJ37prt0EjFm844kj++/Y?= =?us-ascii?Q?++n16yn32Y9jT1DFLvh67z7671V2z+fdDcv2anAuTUEtggqItR7LUOipeqa2?= =?us-ascii?Q?u4jJ+AXvlKI9dRIMb8d62fd+F9aXkvExP89/vkqeMtzeOeShNoHlA8VtjQuL?= =?us-ascii?Q?7PAz9vnd4psX/I3FC32VDla6t0K6F3WRARC6cU0zEQjkMfCOOMczOSZlq/y+?= =?us-ascii?Q?EGXv41JM311nOBPraq6vRv3sofMLJD5T/Zw0HBujPGGSHO1RCf8rU5HlXzKw?= =?us-ascii?Q?avxhjBayyV+JHVn5Y0p/JKTsw06bqYHeMb9wjfUpdbKGiQ30Oo3/CNpqqCjU?= =?us-ascii?Q?vck+Wx4TPZAZfM248nIjyT37RyOU7XaxZ7LG0XPsoypEGUOCbtdaMxL8gCvT?= =?us-ascii?Q?hktKgsQKJChVHmDbv1smLfmryASJTnZtYvXdRhdxSJ38iXRr9T43F1Ok81sl?= =?us-ascii?Q?DEuroQUjsFMIUzn6gtXZ0xby8KqVPXjRsylmf+uCHiYjNxat+JNUNtypXmx1?= =?us-ascii?Q?qmkwXk0ZEKJAwWead4CkkLiR6/epoTR1O7U5HCR+J3lbweBi8f2nPWBu3Cam?= =?us-ascii?Q?oY1h1HIIa/IEtsNQDHMv35hfa80ia9fBYD1cDmLL6iexxOoPlwVt5QMZJgW4?= =?us-ascii?Q?RzC6ziLpEfX+e92IQ18chiqvAT9YO3F33ixgIdkmD843wligCnL8Q8uLZ3at?= =?us-ascii?Q?K59y6AQHQ3tT51nWVhR68SIBws53wYlMjXxk1GfiSFGTmaWLnhQFMN06M3Va?= =?us-ascii?Q?TIXCfNO8HrpuTVYhQDuCvNG/8JJ1ZlfNBLMCLC0T2eRZWXRO3BHYL/nQeAeH?= =?us-ascii?Q?Wg8Q3LsUXoBnPPjq0CbKN+V4VobwB5Tv8NQPHen5JD8iLHzycMmYP7a350lq?= =?us-ascii?Q?z9+ZUqUgtHZaVHUFhj+vjbFnBoLAkU26cK1OF4YjnBpYkD1tyROxvlhCHjbT?= =?us-ascii?Q?58Hu8/lRGamsJfOx9iFhgOrybP/m/ELoComoMYyKZ7T1R/4O3Dhux/P0iIT3?= =?us-ascii?B?dz09?= X-Microsoft-Antispam-Message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:QFgCbGcPinZSH64rExZsitFOH+Ln4SP3k+dWCZVlTvm1YkEiarpfrzM7ympvXvUTWaspbHhdrV8QDtZ4kcJEzkYd1YOCx0kqBKsovvMp+0P8H7b9ZOFESwjaV+vUoCxCOTOeFNqUEMCK4hWbqQN+5gzsaGIzn0qahxcrd6lBI1G3+b79faS59gczajfA99+IoWmI6gIUj0NQQ7EDpZddIaTcAH3nNQaOWnMNKvzoKfrx3PEuiiooxPd4qihyxAVn; 20:kptx8zy31q6lhU7vCCFf1/swa2OcFzA/c/pOYNVOdvjDpuDNXFTiH90gQWTTnSd3ioPiDZkdJyGB9YpmLIpZJy32ngWgvWHfGWQW4dwyxwf7FoA+mauyQcd/nPPZraRW8bcAwRVWHZWN3gl1dMErRJDglw4IN0DsUVFYt0HHE8pvNRKucnyw271SC0Wii7qnm8V1K83ZRPCHFvw6g85NGGteWvPK8qo1nkYblF7VyYMePQ1FV66/lsbjyaDHzSvy X-MS-Office365-Filtering-Correlation-Id: b28a8c64-dae9-4bb5-5671-08d5b9b9a8e5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2018 16:42:18.7421 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b28a8c64-dae9-4bb5-5671-08d5b9b9a8e5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2476 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: <kvm.vger.kernel.org> X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/include/hw/i386/topology.h b/include/hw/i386/topology.h index 1ebaee0f76..4af746e50c 100644 --- a/include/hw/i386/topology.h +++ b/include/hw/i386/topology.h @@ -145,4 +145,10 @@ static inline apic_id_t x86_apicid_from_cpu_idx(unsigned nr_cores, return apicid_from_topo_ids(nr_cores, nr_threads, &topo); } +/* Definitions used on CPUID Leaf 0x8000001E */ +#define EXTENDED_APIC_ID(threads, socket_id, core_id, thread_id) \ + ((threads) ? \ + ((socket_id << 6) | (core_id << 1) | thread_id) : \ + ((socket_id << 6) | core_id)) + #endif /* HW_I386_TOPOLOGY_H */ diff --git a/target/i386/cpu.c b/target/i386/cpu.c index c06a9f5ebe..18a7872b7d 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4071,6 +4071,14 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count, break; } break; + case 0x8000001E: + assert(cpu->core_id <= 255); + *eax = EXTENDED_APIC_ID((cs->nr_threads - 1), + cpu->socket_id, cpu->core_id, cpu->thread_id); + *ebx = (cs->nr_threads - 1) << 8 | cpu->core_id; + *ecx = cpu->socket_id; + *edx = 0; + break; case 0xC0000000: *eax = env->cpuid_xlevel2; *ebx = 0;