From patchwork Mon Aug 16 13:26:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438473 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2C5C43214 for ; Mon, 16 Aug 2021 13:30:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 160A8632A9 for ; Mon, 16 Aug 2021 13:30:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239386AbhHPNaf (ORCPT ); Mon, 16 Aug 2021 09:30:35 -0400 Received: from mail-dm6nam12on2053.outbound.protection.outlook.com ([40.107.243.53]:56800 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239895AbhHPN1a (ORCPT ); Mon, 16 Aug 2021 09:27:30 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X0iyhJklMGPyTu24xKbqOOOOalaeubNz3u7gm9wp1ein7HJi/S4cKCldlVq8cF7dzSihLUrqBctnpO7dmmW6XOP+dpDSKJaduzTlmjtUV62vuolRRxDkA229EPjFLpxAqhP+lyyKhc2N4wzm0NIAlrrEa5PP0pc4+av36d9rd0zVAsdlH1P4po3BwuQ+DTLUyBjiCV9VUycUEwApv04tlASfGxOmbOFoK2PlBbl3CtcphXq5mui4aSJO9Wp4N5oO9kIZ1xmL0UlGAEZrG9O+PTK7KURJxxXM7DLz+aAkco+iv20lW+MsDB3G88di/22MExo2wSPOc2m+Q6e9YmTVgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z2/vfiKGkBZh7xqG6K++PpK/aGCYKc5ObEunM5vU8Bc=; b=aJ0W7GFub4CT/n6eXlDP3gtYsSDhV5e+zhHi7OEbmTwuwOF4mSv7GI6ay2E4tHRhukKY+g6rSb+0/mVKxuIdK3u6v3isHm8DiDyTHVTD7ULn4PmHWfSco6TZXA8PwX13sf3Z/WBKvz//O/pm42WXA+8VFTFyYxgIO8iKkNlC1ivKMxeDGDst/pXIqNQ0zVnpAl4OLhHo2lSf1XqBpkK2eKA/hp6kfnXcQY6BjC6fpJR/W8i/Qo1buoqKq9WIWh97E4rf4+NfNzvphsQ5UgASkLVqBXN/Fe3J9C+dPAYG3rqVBfCTEFQpHCxNOEkq4djek1C+hs1o8kcmR2IlDDGsPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z2/vfiKGkBZh7xqG6K++PpK/aGCYKc5ObEunM5vU8Bc=; b=gYw+gsDhujUTRABntbCxjyFTvLC79fNs8oe6BYANjCZ/iNaVXIY3qyQfy6JDmsHxyM/2svJdEL2ytpbCES4bs03l61HGNMuI6HMnA+9sRGo6I0URKevSJGwiPeILTm7S09tL5HPEypZte4L7z3Ka5Hoto1RnokfsgJOeIqrpCMs= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB2829.namprd12.prod.outlook.com (2603:10b6:805:e8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:26:56 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:26:56 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 01/13] machine: Add mirrorvcpus=N suboption to -smp Date: Mon, 16 Aug 2021 13:26:45 +0000 Message-Id: <235c91b1b09f11c75bfc60597938c97d3ebb0861.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR16CA0052.namprd16.prod.outlook.com (2603:10b6:805:ca::29) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN6PR16CA0052.namprd16.prod.outlook.com (2603:10b6:805:ca::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.13 via Frontend Transport; Mon, 16 Aug 2021 13:26:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1b1c7611-0478-4c98-b57f-08d960b98494 X-MS-TrafficTypeDiagnostic: SN6PR12MB2829: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: keR5MjWXwpeRQK34KdYB94cgnGtwTKxehpzHynMxP0PmaKHZ8fHJYsCjSeGzNfE0QJqoMs7G/ImMrg/LkVhMlrRz2nhatEpu/9SsD+ulupPxs1HAMDjOVGauMXoI4+FWhCLSv4BEvUM1qfvlnpCno+52uyr5b/bn8MpcDMcmqfwGrVN2ML8m6ZdmrBnocIIaFG3zMWPfGnS2pR0z+QauPg+JJJ5228qZh1BZNJ6FkFokQ8OOZ6JILp1uZdFpaF4ujMYQmtavx02DeabD9BOc71XAjf/OQwYOcfvE/ZylxYqr/Ba9bmwgAv/BYk6bH6aVr6Uqdq33tnz5+GZ3bhCX5Mh0oI3x3m2a4bMWM/B2+8OTvP/DKRXdPYx/2AexVpfQ9UYXvtLkSlw8i6DXZCHCSg97oer+uIjc9+WaqGKyZfAf0OzYbeRHGCfoPutQ75wQXDUX1XQjsL5s2CLjFa+B3R2kBsJN+HVPLcbyxnubwUKWv+RbnkG5kfmgZNwW/gv64dYPYuHsoBoZhuCIsexLL8Qjep6r9ueIJDZuMfd+8a8EbJ2BWsDbOwukj36F8+qpCpZnDA2HIFqzuLFiN3/LTC09QpBBLLeVAacjQYP/qMCpoPS+SHOGQbHC9s5yvP3QVDB5jORf84JKc2sXlCOKvPdvDKR51FgpMqz97euWyNhY36wvkWNdzSldoUHM4JVPqe+vvnvY+64XnzPapNn5ww== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(52116002)(86362001)(7696005)(26005)(2906002)(508600001)(6916009)(956004)(5660300002)(6486002)(66556008)(66476007)(2616005)(66946007)(316002)(36756003)(6666004)(38100700002)(38350700002)(4326008)(186003)(7416002)(83380400001)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rrL6hSm4/JmB8fBVCfAfaCeTWzZm9qwWb7/gjAgBiAdaAFRpIkOO9dFsJs6bLFiiglAP33rwlrLcU4nPoCX2W2Si8uPa7lenbtsLCDj7pVs1WEW6j43qiyYk7HvAxK9+4Sceb6Jc7qviNadA51UuTd+NmQ1ptzaHB6CNZpKaoV5qPpSvp9FilELbQYk0+dOF8AmktcBKGeC4uBXVXOBfBvSCNW+WOgYAg8/GYB3LoA+GNTWoZ99jSyuMfKMXeTj3A9C/HvFZNlmvnIRum8tX+jJwgDQ9vbhF1HbtZMUf3ESh4RjAkpHAkHAL891ZpcF6Omb4SzSgDNvRkIRvq5mu+jxLrKUEsKTDIKwwykMptMIdiiXxdy6J+nTshxaj4QRQ6k1S5hQjUdGWpFDB7FjmnXeqdEpyjyfMfmJH/YW5f2AkdlLWxBV0QjDmwMrvash4Ai8dEEVJdCa+MnBizBgjp3HvlWlqR7m+xm0Ak83t5XbdG4ApmN16tzAeQ56tDNPthIDEL1esHtzegPRdNPAERCyUfNFgL3SkSiALfgzdl6xdU9dl6E72MaGLVH2WmO/k6tgm/2mdJ1EEQ+LGG5nR4UwFHJPydJBHF1K4ntgO271iTemQl5ZCxONHfj+KzSVfwQI62/9gJNSL06Z+IF5AWC3JO/g1Tw5Y2xjC33KBshmfnpTv2KzbMJnYOuEACOegZiQNrXRWJvZ6bSVeYSRFH03hSfro8vOz2yT4n5ThZU7/qdE5ZOWGzBjIVtz1A2qJHqKhHOLqQGR8jMVYdFoHYsk7mp5Asb32kv9CBYBu++8KTsMgYKeaNM6TfoYHM/MZ3mXQxg4ZckselGw6i7uezJzbUNQ0Z1n9NluKb7mP0ONliNj5/NG1E2yBunitDlR9yaYjXcND0ajNJnsz8Tzpx2y9QxydFCbJYnxnH4mfTqpCkM/TVQElGMKE75G9vq+nkcL3xKhYVWRhm4AomS5nLJonYTPsaPqYYgbQxRbGrVGOceLVQYBblQmnj8HVsEBoAocEvwe9c2RHi5QmqbBvCnGb2fBhH00RJyD7DWT2GG5CTdkYwQbttxTPpzOqlkmfNtzQrmnAKZ4nAwIgh/Rt9O0jRfRe1IN7wLTp0bNmS2v6mZDZS/fxfvW+zINRr9cB+4aBobQ2Q5ylgWqJaxbarR5b/uRgz/eXJ/gXxT2EAriyaUC+A262Ryrg5MfcHbzHXHkyvWwakkCM2bJ+7NMlJ1NIr2CKjMqRqFOUPX23FYqRxPYasu/m4NY9xEvkoq/pEs10sA5/mUswTX4H7kV2HQmbXCMQkyk9xwwXO/nREwxiwWeW1kMY0ixYrgUFglTJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1c7611-0478-4c98-b57f-08d960b98494 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:26:56.1349 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 50KMEQTtfwaAyZpPZrBZJobqckz8lIr9V4XDN1SWnBfE9G6LGv5dcngbmQwtJznit6ukmmBHc00SZ13jg4LnSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2829 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Dov Murik Add a notion of mirror vcpus to CpuTopology, which will allow to designate a few vcpus (normally 1) for running the guest migration handler (MH). Example usage for starting a 4-vcpu guest, of which 1 vcpu is marked as mirror vcpu. qemu-system-x86_64 -smp 4,mirrorvcpus=1 ... Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/core/machine.c | 7 +++++++ hw/i386/pc.c | 7 +++++++ include/hw/boards.h | 1 + qapi/machine.json | 5 ++++- softmmu/vl.c | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 943974d411..059262f914 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -749,6 +749,7 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp) unsigned sockets = config->has_sockets ? config->sockets : 0; unsigned cores = config->has_cores ? config->cores : 0; unsigned threads = config->has_threads ? config->threads : 0; + unsigned mirror_vcpus = config->has_mirrorvcpus ? config->mirrorvcpus : 0; if (config->has_dies && config->dies != 0 && config->dies != 1) { error_setg(errp, "dies not supported by this machine's CPU topology"); @@ -787,6 +788,11 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp) return; } + if (mirror_vcpus > ms->smp.max_cpus) { + error_setg(errp, "mirror vcpus must be less than max cpus"); + return; + } + if (sockets * cores * threads != ms->smp.max_cpus) { error_setg(errp, "Invalid CPU topology: " "sockets (%u) * cores (%u) * threads (%u) " @@ -800,6 +806,7 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp) ms->smp.cores = cores; ms->smp.threads = threads; ms->smp.sockets = sockets; + ms->smp.mirror_vcpus = mirror_vcpus; } static void machine_get_smp(Object *obj, Visitor *v, const char *name, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index c2b9d62a35..3856a47390 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -719,6 +719,7 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err unsigned dies = config->has_dies ? config->dies : 1; unsigned cores = config->has_cores ? config->cores : 0; unsigned threads = config->has_threads ? config->threads : 0; + unsigned mirror_vcpus = config->has_mirrorvcpus ? config->mirrorvcpus : 0; /* compute missing values, prefer sockets over cores over threads */ if (cpus == 0 || sockets == 0) { @@ -753,6 +754,11 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err return; } + if (mirror_vcpus > ms->smp.max_cpus) { + error_setg(errp, "mirror vcpus must be less than max cpus"); + return; + } + if (sockets * dies * cores * threads != ms->smp.max_cpus) { error_setg(errp, "Invalid CPU topology deprecated: " "sockets (%u) * dies (%u) * cores (%u) * threads (%u) " @@ -767,6 +773,7 @@ static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **err ms->smp.threads = threads; ms->smp.sockets = sockets; ms->smp.dies = dies; + ms->smp.mirror_vcpus = mirror_vcpus; } static diff --git a/include/hw/boards.h b/include/hw/boards.h index accd6eff35..b0e599096a 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -286,6 +286,7 @@ typedef struct CpuTopology { unsigned int threads; unsigned int sockets; unsigned int max_cpus; + unsigned int mirror_vcpus; } CpuTopology; /** diff --git a/qapi/machine.json b/qapi/machine.json index c3210ee1fb..7888601715 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1303,6 +1303,8 @@ # # @maxcpus: maximum number of hotpluggable virtual CPUs in the virtual machine # +# @mirrorvcpus: maximum number of mirror virtual CPUs in the virtual machine +# # Since: 6.1 ## { 'struct': 'SMPConfiguration', 'data': { @@ -1311,4 +1313,5 @@ '*dies': 'int', '*cores': 'int', '*threads': 'int', - '*maxcpus': 'int' } } + '*maxcpus': 'int', + '*mirrorvcpus': 'int' } } diff --git a/softmmu/vl.c b/softmmu/vl.c index 5ca11e7469..6261f1cfb1 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -710,6 +710,9 @@ static QemuOptsList qemu_smp_opts = { }, { .name = "maxcpus", .type = QEMU_OPT_NUMBER, + }, { + .name = "mirrorvcpus", + .type = QEMU_OPT_NUMBER, }, { /*End of list */ } }, From patchwork Mon Aug 16 13:27:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438475 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 259C9C4338F for ; Mon, 16 Aug 2021 13:30:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0906F63295 for ; Mon, 16 Aug 2021 13:30:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239653AbhHPNaj (ORCPT ); Mon, 16 Aug 2021 09:30:39 -0400 Received: from mail-bn7nam10on2052.outbound.protection.outlook.com ([40.107.92.52]:7937 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241405AbhHPN1s (ORCPT ); Mon, 16 Aug 2021 09:27:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hSDnXX2tVVVIY4PoLLdHwK8BH/HR/YDsmlLX1sBJEJZF9376HS+IAVByVhaDWbtPv/erlRli6BUbE/zYCG487Fyx8kcnJ0jHCOnhVunkHlL19dWbicX+m0QLSSs4e8Sk3AEGwlYqt9FJ1O2TKHOaWVsGCh7Q9DjjVKYU6mhGST8f1yJ46zDJwX1s+/ZphNTXRnZnq1Ba/Yi3E779zsajzFfBnh5ywkeZZbjjVo/ugbz2U+MhPst0Mu1Te1X94hU65QQm3Q8AGbEQid6N0d9wiDaSd70Yhc0ZshgxglAFaMdYi3O2NUtvHK/fhOyJcTFjPVRT7yPr8HNgALnlR0FGsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/VYm0aSpOM2l7u+TrZayoes453FcNcd0ansBvjhb9C4=; b=e42TKmOm/whtYyF0jN3GzptJg1ZPwUl2uWNjS5L1YMIFnfNshgpalzVObaf68ne9JQMBrc59hESrPWHpgOLaehZFaQQqxbd0eUK+SQOKI0Sb9WfljW7qQlpM+Op6h4XCP2PT6dWUlbNRnus8H4unBpOp523qYexMeZ2hubcF6SMHc8K66De+3bLS1FqDFzBP9IfrABmXdcglateySmL0o+FdUatjDsYIKkFQjKBPxZ79nmFHgxDXI6hKSQP/5DK4u9Gba2sVy96z3sCjy1Vdkxh+a3KMlpLfWeNrHD7Lg+peY85JI/fbF6vv0bYtpLmy+4aX2yzuZQSLYqvGEvIyUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/VYm0aSpOM2l7u+TrZayoes453FcNcd0ansBvjhb9C4=; b=FPR2P1bVk9kTZ8JFMJc1Yk/WCj3KE9wZJbC1bPN7cZc1WWMK2BQ3ioPOSef4vpeWuAXX+MzaOzAN6Xa3YCStvvroUVuJgVr1mVOXFupes0j5VHx4V4Q4BZm6W3TpvmCDlyoqkh+HHM5GNquHFXl6Z/s8WntbsTQB6hfAqeffZXU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Mon, 16 Aug 2021 13:27:15 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:27:14 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 02/13] hw/boards: Add mirror_vcpu flag to CPUArchId Date: Mon, 16 Aug 2021 13:27:03 +0000 Message-Id: <687f95793866eb1724c501fc67069b7c2422edb2.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0501CA0053.namprd05.prod.outlook.com (2603:10b6:803:41::30) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN4PR0501CA0053.namprd05.prod.outlook.com (2603:10b6:803:41::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Mon, 16 Aug 2021 13:27:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f76e3bf1-aec3-4252-081c-08d960b98f7d X-MS-TrafficTypeDiagnostic: SN6PR12MB2767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:449; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ej84nE+AJ9ci15aQZr4X2+PHfZN5Cq1ojm0Fxy1rrGj5yKOSZGAl0ty1ibXkQzNjRTtCQ70PA1j4TFve+IEwlDUGhG/gfxbpYdzdXOpPj+/bzJbXz0MJZcAo54v4hdhaH6zhCcnl2BYEwy6Yinlrv/3hnUH0rH4l3vo+In0xZ4Fhxv8Rq51LtL1UifdI+LHaVAJpZXn4db/bTaENh5cVo2cn49ByK/lwUVtd36JlER6Im+PkK4xX9Fia/6PVBHdl/iLIN2vOZxL20FL+WrNiK84XXlQzdiPHoJnu0U2ZxKLN2qSgSoEP7aNR8kzmS5IYjzVZ+uR+YnAUk87aNd0JbpEookNoG28fElprQiDhvPFUSEan1QhjsxZVlD+81gpqA5IV1/SV8Juv8adtCMPVD8XJLV2sd6T1Kla2bSowUYn9cVAS1LeufVvMq4zvs4OtPJMU/+fYUd+TaJOs8+j/t1youhKEC9JhXnH+tJkuaCk0UYU0JfZBj6cLcC++Ma2Hat8SjHX/HXbvyug5I4NA7gJQWOJufRkA3nF5ZAZZ4YqLgMJbcGvQwfSgVNJxRpaCOMZXv8xBKyj0kzJ1MCznu9h0+/fXa/Mk2Xjewk6IDQNVm/+bCtlow2N8VTaYrVRRaZva9Fo0AQTxky7jxgEoZj5dfA0ypiJwr2kdTr1S77kbf8Smh/h4zjxvnzkLQq2GScym91WoI0tj+XeI8ZEP1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(478600001)(2616005)(26005)(956004)(186003)(4326008)(7696005)(52116002)(36756003)(316002)(66946007)(7416002)(66556008)(66476007)(2906002)(5660300002)(38350700002)(4744005)(38100700002)(6666004)(8676002)(6916009)(86362001)(6486002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: safRTICyTr2nn7oU3+uoToPq35tYbIEmvKYOyRJlXvdZbiJ3dGmvqB79H+lw5hV104kf0aLzwmWkIA9kQBiBxQLr1hR2L3NHdpupiosx4W5HP+ibS+CRXtr/VgvMPNQHhazwbY8sr2xgL8g5YfnSBY/Qh4E9qHnnrxEe3AE5mA8gSy4r4Tw+7VHgmyfFq4dtIirPnvS4l9cT+Ibm5sKJS3AAy4LI9lZVlKYAWqclOifmx3JGHSGODX3uHrGVGW9M60KkzALCN7qv6jNT2ompE0aDyQiY5UUj4Hqe8LbLAu8femPFKLjEiowcarnem7tTOUdHadbYrACnUjfo3B1EVtl5ya4+Km0ca2kr3U/JodVI9fxG3m0wj9XvMbSHcHyM1+k5Od91WENZPsUYVDimfJJg4cE2fbjjNZoowJKUXnNW2prOZy42PvMJixFGkgVRFBsC5Pjv1homZkjhKo3G1sYJb1ng7pY8mYrlKxESoeF6htBT7SkTH9h1sVRXnQLdLEEHRjrgLauxJHGYyqkNG4fuA4hH4+IEdDedky2fld0KX+Qo/OH3X6la/fXq8BH/2zzuMEyyg13hZUlZCIn1ZnWmi0KHz2Io4VLGcTqEKczzo7gk89HZC8//qnKM7WApCJYGHJHtQcyvD1pp11s49H1l43WCwjAgJWinx3poP4CrtOqykVweJQtkAiqTTJDurfsUwcvmnKkU9J5qTPiXPneFd+goEKOWpOE5q4FYhdxhqYEN9NnbcEawIs/6QR3yFppndgjtkLCd+nVZeinaPzOAHe78psUa5r0aizUpC0ek4a/eRqZgO57cBJXeye2hLSKuIDTM6LifSILTPBroLdTbeHP1r086GqIKBhqRIrDuOV7LNduuQUAqO97fPWBkoaW79SuQ+2Ra34yc1kuEuSl7ej7culL/wXc5NZKTgR2LIM/wLawM8Rle++aa6sqqIEc2lglhx9hhGC/2Y6RtO7aMkLmMzavDH99A87k2wBGxBSosKYSqkUzZQVFhkq+Sk7dJX52spAVWo/4WgDadRAKdus+JkEhXC8uKYPserF2DDrTYwM6XKnVTW3QsaRDqMTB32FN6CJdfYqHgaM8rfJZuhUUnf8eiappWCe9uLtI4yGApFL5QT1WfFItLpmJ/BaUy4kC/zLQ9OyXq2h7OsLBuxWOBRgHk2whfOduUHIstqandmkrPw6aMM93L/xWSDqx1V3OF5fmdnJAw0tgxJOBXBrw7ZTlEUyW+RNEncx/xp4kXojFTtJiNk6vfU1Ohnj7INvsI+EVyEaxn0HWHNcUhJph2/jU0SwLEORdrDNhlYLWkpDhWYVZgk2HEvHJw X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f76e3bf1-aec3-4252-081c-08d960b98f7d X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:27:14.3417 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: voHGeVxY1h6O059gmeZR4ZQ8XDVVi1rDDuM3mFU2YId3TchhuCarJ0/ZGKgZwEMtxgjWrj64XTFDVKFqievu1Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2767 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Dov Murik The mirror_vcpu flag indicates whether a vcpu is a mirror. Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- include/hw/boards.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/hw/boards.h b/include/hw/boards.h index b0e599096a..f7f29a466c 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -89,6 +89,7 @@ MemoryRegion *machine_consume_memdev(MachineState *machine, * @type - QOM class name of possible @cpu object * @props - CPU object properties, initialized by board * #vcpus_count - number of threads provided by @cpu object + * @mirror_vcpu - is this a mirror VCPU */ typedef struct CPUArchId { uint64_t arch_id; @@ -96,6 +97,7 @@ typedef struct CPUArchId { CpuInstanceProperties props; Object *cpu; const char *type; + bool mirror_vcpu; } CPUArchId; /** From patchwork Mon Aug 16 13:27:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C56F2C432BE for ; Mon, 16 Aug 2021 13:30:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF76663292 for ; Mon, 16 Aug 2021 13:30:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239997AbhHPNam (ORCPT ); Mon, 16 Aug 2021 09:30:42 -0400 Received: from mail-bn7nam10on2061.outbound.protection.outlook.com ([40.107.92.61]:32336 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239012AbhHPN2l (ORCPT ); Mon, 16 Aug 2021 09:28:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C07LAkW8VqLrIp+cl1DwLKb96IOlwd706AHNkbpqL4gP25nK2To5FzCD3rMPMBjlQn567BqVdN4saUwRF+1kqXWakQitvHqF5WlMX05C5x8BoGjHiDyR4BMQeO5nKccb9jC3d3kDo4xqSWHsp280kke0oRmB+hyirRknqC2DyghCesdbul5Aq3kJBiwnV6qqPIcgNqZAMm6x+ouVXdz9SQ/JUEElSjTTejCH9L3JAnY5NBzMiJytvO4kQx6gVdIHoctQGRhCarGt0R4Ai/vJtIXUviykAVk3rZIde+HI1klPfGrxET24HeVvHHrAFSymlSJg6agKqbMjcHHd3G6GPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MYhZhADXR/irJqMLEzDn79l4rEECURMbInEwdh9OZgk=; b=Q85gPhQ+CkaU6svU8Wuw7I0AfWXx4iVdVlazPYT4oWneymseFbJBZQz1AYqtse/uzGx7PqPEmZqrqtpkOG6UZCzFaPbUeuljXKPqKE6f0u57w9RrlOwmhCL5zFb702J1+uqMsmapbHkCXO1nuWehzf0IyNcv36gq/LZ1nplOBurXXc+aiqPaXjBfhCeaU70Q8vnv8Ou8GSKNJDP41QVMhhvRw0Gq4gB2pzh/tC1YxLhDOqwxg8pa5kPkkXUnOXBuD7/40II5QCAPQTcMgoeysYC6BwPGIypune6K+6vOY+tKSbWlwiaOm+kI4psDs9AihSJn4lVhS1+vreyU6Z/7qw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MYhZhADXR/irJqMLEzDn79l4rEECURMbInEwdh9OZgk=; b=nWT02fTTnOKwq+fA0Gf0lK0+3g+H9HrEDzwal4+y4bkcRggh7f9jPPTzNlH9BxSiCkO+s6HH/JoNIeae2ken5QjHKKjv3D/FofCqYp1tx22B6+4PFiEQbutgy9zupG3kETiErTyPgTLFKRAg5+OmvY4lTd24MziEOohre7fs81o= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Mon, 16 Aug 2021 13:27:34 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:27:32 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 03/13] hw/i386: Mark mirror vcpus in possible_cpus Date: Mon, 16 Aug 2021 13:27:22 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR08CA0006.namprd08.prod.outlook.com (2603:10b6:805:66::19) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN6PR08CA0006.namprd08.prod.outlook.com (2603:10b6:805:66::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:27:31 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b949c9a-94fc-41ec-2dad-08d960b99a3c X-MS-TrafficTypeDiagnostic: SN6PR12MB2767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LgRSLS01BUQ7fcQqVDim6GFobvDCqXs4VYUHNQGsDqjhSqOH8hUC7bnzApZ4gpooR8zhIOEdzyzhNT53SKE1Lpk5yacLK3ezkSlOU3/GH9ODxPITmU97375ILg0uJukXQLmdtM8q5RmHWNwKNUkT+EnFBYy5bJIKCHTFjW4W7nNRj1z7XXrawGsOpEyhnvnd1yMlKaOqzM7GpAeTsqTl2RViIC+jRhoOpICtwIhSzDNPIwsX/Cr+MUpaERkf9d+gaZBKfA3PvFZ6Neo8p12sGTNwZnjRY7heOWfZOCElPr39yarxJC67lCJvcOOV0EcABFkgDJQ6KGg5E0LHoyj4ITANJ1i6ayrC5Ps0MVtfFrOvkGRoGYWbDH81cU46Z1mnRyQYbkbq4nYK81pWGhLCEcULNQkBGPwwI71Iksm82vq+kM+Ah1Me8cNa9q/fvLvnZzLZqC6dnc8wh++KqZPr7MCkzYi2i1dSe42TJjLDsNtWGSlffPfiMapxmMyYYxwSzt1DoiWTwlLpn7RPSWkOGridZEl50xELCXzzpQ53FSqU3H8uos3bmyn9dfOR0R9x7NJMEGyKBorH3TOYoC2iBIj9bTXSJKzS2N8Dl/XiXd4tf1QkcQu5YpB3s8fYvNuPsEjnbG3l1Lda/F/qiLmmAYypWvmsJSdhmzxqHXNJNtTy3mlOUuEnI9v5DJulOElcUS6DGJ9vbLQ48y2dl8lpZA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(478600001)(2616005)(26005)(956004)(186003)(4326008)(7696005)(52116002)(36756003)(316002)(66946007)(7416002)(66556008)(66476007)(2906002)(5660300002)(38350700002)(38100700002)(6666004)(8676002)(6916009)(86362001)(6486002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RI4agYfzllDqYwz6Ltirqhu6LIqcpNwH5zbGwfj0Kom4yTQ9SWiZieWcdqA4vRn//eWhpHm5ywVygW2de22iYcjk1YeUgqqQOe/NNQno8K96scBnd7I4RUrvXEHDUpwELh4wU0o1qQS9ODkMRd1D4IrkiAeDbieegiP/KSvd59eQzoyUSL/J0RAsoswm5JbOT0a55QPJfiw65rLWAKI/pnz2KVsw5xL5dTv9giLD1NyOyFT50fHWOrM7tohVWx6NzRj1raJW4eCm1Pv3FVREtFinr/JXDD7szsrQB/qZ/oLPNpY4aobPp/IYIAdtsjeWE8UQbe2m3VqTtlZX2DQ8sPbu1lgB3RR9LXekcGm6P9FEOp9GvkW8h22THy2MftjKcIR/HWU4XHJ9LXuEbVW6xVOEmSqUSa6hzM0UXFczNEiVkNe7/fjaZ02Y/TwrPffYjy9ya0iHIYArFCUmbUIVByTE6bvhAZlG//YGQTg7gHJJ/n5+v13Fs3QLoI6EPt6AFKnAyJnPbmafuPE7gXwhDxFMZSk6HbBxlLsZxq2NmhxETDj5ZI9RdrRB14Do9hAstm2oVJJE7Dc96VoTm8yRQlt2mR4BE+VStXj8+iqscxYQHR72U+uVBLOimALx9qw+eQxRZrP5vN+s1uLDMUFoavW4WTRSjr4g0tw8ms5XmUqnlWQJCt9ZGf0+rDhCCakEBQkxVa/fpYrOW2D8w+jmk5VB4vUm8CKwlF+oS5e992wLIfX+5KPegZk10MhtIKidaYkNHas5xx76EMX1FSHVIYvanVWVpW/euMBrDK5fbc1hsyktTUV5Ms7BqrKEE9b7dNkmJTArpJTkdedlGISg44NPHkKfBxNRi+U/4eMNgEShokmDhTkUTqT6Ob2KQ5A0i935xBb6w9rTV482KPhRYUg8+SAeOoMNfK0W1Ch2N0MlbgLTQFy4TK6jxYu5eodMre/AiHDswybpD377Qdymz7CfJMMWt/bHFjmJtt+LKWnptpzhROU4nuPlurf4SREPBP2J96XriWcRI4Qg1rPhRQWuH67+h8ppvLw0W0jEmbgingYUnJxKuftc+NXLb+9Jwc8D5HV+fJVRCFo5upo3s8yrqGlwY3HQPDnqwm9HVRmha33OccMX4Fptmy5v5Y0P9G+XXHqUeV/k/2nvYVrW75/qcvWWwnHR7r40SxSNwcaZqlRzykLhCtGjzi2zD+OWO42suwD+xQvqchoRh47onXTx6MKcgl67IsdS/tzih+2U7d2IiuHA2DEyotoA9wCvvTWjXnqxNAzHDpcsVj0FGysXIMMfNSyeT0NHZWYzRQcNTyhk6nSNP+RRm2zux6X3 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2b949c9a-94fc-41ec-2dad-08d960b99a3c X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:27:32.3856 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2gBk6BzZzON9oz3vzfY71G+KwizzYXFdHgh3mGH5SJ3Y7VaZrTVP3K5RQ6DPPHu2/vmo3aj00rcT8s67bBEaGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2767 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Dov Murik Mark the last mirror_vcpus vcpus in the machine state's possible_cpus as mirror. Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/i386/x86.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 00448ed55a..a0103cb0aa 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -448,6 +448,7 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms) { X86MachineState *x86ms = X86_MACHINE(ms); unsigned int max_cpus = ms->smp.max_cpus; + unsigned int mirror_vcpus_start_at = max_cpus - ms->smp.mirror_vcpus; X86CPUTopoInfo topo_info; int i; @@ -475,6 +476,7 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms) x86_cpu_apic_id_from_index(x86ms, i); x86_topo_ids_from_apicid(ms->possible_cpus->cpus[i].arch_id, &topo_info, &topo_ids); + ms->possible_cpus->cpus[i].mirror_vcpu = i >= mirror_vcpus_start_at; ms->possible_cpus->cpus[i].props.has_socket_id = true; ms->possible_cpus->cpus[i].props.socket_id = topo_ids.pkg_id; if (ms->smp.dies > 1) { From patchwork Mon Aug 16 13:27:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CA1AC4320A for ; Mon, 16 Aug 2021 13:30:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 76E7160F46 for ; Mon, 16 Aug 2021 13:30:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240681AbhHPNbO (ORCPT ); Mon, 16 Aug 2021 09:31:14 -0400 Received: from mail-bn7nam10on2079.outbound.protection.outlook.com ([40.107.92.79]:29025 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241005AbhHPN3M (ORCPT ); Mon, 16 Aug 2021 09:29:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G1cXMy/YoAkT/xdDG0QPdQUodrtMBNFVAQgycLxgI3ylk9c2pdVqGtdFuhaKt5SZPvJVL6iqrUDnx5pWQduD4bMAtx+AkFhXVfi8ecUtFEkumM130jrbORashj+Zf5mqCswgm89h9dd7NI2GhlxOe9gepvxxnZ+S4jJgUotUmTT1OPbfPtT71aLxEW5f1792PAKtuTpkHSx8FP3LPu9+B6qzQYJpqahWBu/Vd2vUhEQ7CmLJW7mtGvWg2NM7MislFOYA63N7nbVHdK0EPTsHOKyiAFe+28rg1DI4FtpoT6xVxa5ns8jb1gImcPkDK4xF8F3s36z5qJk4NPfs5LmwiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x+C1x96+bNrOUiO/cYfsnanaIcSqz5m0ElE3dtkxq3w=; b=L6Yc6WT67lkPfHIRAV57YD8D9+dotCwbtdEkuuH2jTY+Sejt0MdGopBwNafP1uaAibpH9iwbaGy7lGqLOPN3uWLbzEKC8yp2qe2l33SVTefgfPxa8j+kFLnY4LdsfJDTOtvDeuXK3tFTdVfAW/19lzoSuv+nNJMffXrD++K3AxLjgTuoDiTQfMoMlu5JNJY79vrqVdXcqi3HFOpuedUXlgpLwnrq2FZxbN3oXI5aQR7pqyYQNnB9bpmwCawp85BfQ8G4UPeknrVKhDa9M0r9AjTJfJ4ZjLFwm4WMNjwebXqgRycF3ZE47r421rAqPPJBul4YXcDEafbGN4ac36LZKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x+C1x96+bNrOUiO/cYfsnanaIcSqz5m0ElE3dtkxq3w=; b=zzGV8UADhmEjsm1ey5ImJxdOHAs14Mru6gvv2b9L2f3EPiTkuASct9v2OnpzbNTZQibeaQUtBYg5MUmD2nWADG67dn6rGM6AsjV8dgyWAWaHhHzcScdz0jRrNS6hZPvd+nCX6g9jvM4yIntJUgkftLqKtlzaX9HlMY2+1N/eIJc= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.21; Mon, 16 Aug 2021 13:27:56 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:27:56 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 04/13] hw/acpi: Don't include mirror vcpus in ACPI tables Date: Mon, 16 Aug 2021 13:27:40 +0000 Message-Id: <00e8dca71ff6da4efadbcc8db7a7a3e538b09638.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR01CA0013.prod.exchangelabs.com (2603:10b6:805:b6::26) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN6PR01CA0013.prod.exchangelabs.com (2603:10b6:805:b6::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.14 via Frontend Transport; Mon, 16 Aug 2021 13:27:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0b99e3a-c86e-4ea3-b1fc-08d960b9a891 X-MS-TrafficTypeDiagnostic: SN6PR12MB2767: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x6cgDSXiHf1eBGVEe6xtgS4TX4S2boFJKcPdvULNSE4D0Djc/2FA70AlAeEXIfzHzXoImvN+JZ7av/+grP1pTyRNQviuMl0cG5ma3c07XaY1zC0FgBwPvCz+tiFKMM/NiRQj36korhWfyMvrkwIJYMh7VQAICtO/R9FJUe3DeoSMoyB9K2E7Dcy/HBUUAf/FbEh3Me3rWQ9kexRpYsMSLIGx34x8fRf5N6h4fiORoqi2uj6OT9VYgWBdNGMn3goIEYNlweY49IHo41xDKs3DoLHDzfnrges+0hOxjz6QAWP50S03dK2GKZIBIv3NEsINqrT/+y4Mhd+jMZHj0317ZpIVBxEfeZ9csHG36gbf/fKjtCOCo9SCfim3ShV+uPaRygTYg7Y5BzaGTT9Iu3r7gf0BQqF15m/XWOQ8OD/Toq3QZQ03aJ9iJEEaAKaaMdVVgva6INYcRGr47/AoZHiUlBBp5GyxmG7ylS8bBJjegwfH00nnOiAYYNAQUiO3aeGyhx0xGhinWdRm/TepbAB0qPynJ2cnv0k1EPQO2t8J3N4rDhIMaOaPWwsUQHTSjqhQz4HvverJnUbuiCZPZZHhQWjwgG24qkN2ZfCdSJ09pBvqJoBP4JxIyT1zct+O8huDJQIISzvHkVejAodC8lDwQFLkKxQiB/vYhj1JRRuw86OcmliT6/Kp3vJIvI8Eh4HsWgZqRoH86/Xv/+b4viJ2wQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(478600001)(2616005)(26005)(956004)(186003)(4326008)(7696005)(52116002)(36756003)(316002)(66946007)(7416002)(66556008)(66476007)(2906002)(5660300002)(38350700002)(38100700002)(6666004)(8676002)(6916009)(86362001)(6486002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KTNbZPQLQwy8n1khFDD0bTEqhn2j3IJpG2xI6CRQcrfoPeh9kmktDgMtKr06tz4795FRnGVMVNA9pscbzjTBQgoZQly+dsh9kxT4A729FcAf2CRxAKivQeqLBrk16LM0bYKMKjbF6tln1INyHBNsWC8wvIMMNgqYUY1myLCkqwZ5MLw0RudAs9fuTA/iYJw2xvnXS3LugddgHpAQ5kiDV49ADok4F40XkPlI+BXz+yZJpBo0xn8/bcIGB1apEACiUuMvGcp0XoTadRyAHHMshyAtUcrPksVc7kkK55FrFcRkFVfrmse0ZscLqvI3CG45GVDvfPUogHmAVWyro9Bn3RSKjvDrwZYPn7KfTWSOEZmxNWwJ42D0P1+uV1lI+dN1jl0hLNPMlTaaHaBoUZe0E1pCJXJHWEeTvBd97VrqFbrt07qx73lNRu5Ak+cL0ydLuTQjeBSzA0GcKB1q5xkFqCFIvK+nFn5ltqzAGgbjyxy7HHf3zl1ky1n1XlsgBt0WTpkJHGvrdpSMulHD6m/CaSivxEvo4DiHm9rhxTdREq1P5Svtg7Pzr+151EIylG4Ule+kf9YWgCjZ9yHuYauGS9SeBwtekvXSt2tb0fV0RN52vQGN7ynDxy2niL6QCZgzkn+FUAl3bt1UFQ0k4dTSbD9GU4rSO9Q3a02nkHWdtXieRndcu+Gw6sS6mFOWBkBR02A7zqMmxX9Mx80xNiGR0Tti8ycpPiYi5mlm/EPkb7JZ1q2RPbdIO0OLSwyNszotWnQfJtwxyCG10/rvsd8JdFd+SGIiXJz25Jehso71uddwbhJFtGFgbLaBIL82a9Jys9dLqAmMKUpoKtl8F0roxn6sq/QrJlz7ZLkHH2SFk1PV3lkHZl6LVlOfOuKF+TSQlIT1G6daCrs/9uWk5Ir2J/aFvjnxvVF2ZzSmkwlAR5gY+nGDTKZcwvpspSbI15FC/seK5HFxfNUt661EciVZDEOVTeuZOI72jxiOn6KkQerwRu7P/T5k2foZSh8lH9xxu6hCHE+FrgUwnKzMA2MOEiwoWYgD736BzPWsJvXYG4tS7vP/v52p2QejEM+6eC5WRWUYDxa0vV5gfVHriYUaedGrUfYs1OvefCaQTR1A/os6NUU0Czp4gqV2759+TmH8k0ejgNb9WENFmvnkAmdXeDrX/Zvr3bgx53xLpqQ+ujmASHB3nKFreAWH1dWj6D8QHsCPjB8LW1j/oAkEFeqrqfoUD2oW4cLPZ+KbuAsvmaWY3NyhRVzvccRMeLE4n81I+apVY82xbgk0RM/3TG8Fswn/jTMiadvbYp2qaqz60n24k4cBJYZr620Z/F7diDv9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0b99e3a-c86e-4ea3-b1fc-08d960b9a891 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:27:56.5311 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nO3ib5Uw49hFzlkGqxflxScJgYqMx7B4G3G1Yxy1TbiAq8riIZMal8GGL4vGGJj30Fqt32NUDvpED4Lt6sGKkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2767 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Tobin Feldman-Fitzthum By excluding mirror vcpus from the ACPI tables, we hide them from the guest OS. Signed-off-by: Tobin Feldman-Fitzthum Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/acpi/cpu.c | 10 ++++++++++ hw/i386/acpi-build.c | 5 +++++ hw/i386/acpi-common.c | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index f82e9512fd..8ac2fd018e 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -435,6 +435,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, method = aml_method(CPU_NOTIFY_METHOD, 2, AML_NOTSERIALIZED); for (i = 0; i < arch_ids->len; i++) { + if (arch_ids->cpus[i].mirror_vcpu) { + /* don't build objects for mirror vCPUs */ + continue; + } + Aml *cpu = aml_name(CPU_NAME_FMT, i); Aml *uid = aml_arg(0); Aml *event = aml_arg(1); @@ -650,6 +655,11 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, /* build Processor object for each processor */ for (i = 0; i < arch_ids->len; i++) { + if (arch_ids->cpus[i].mirror_vcpu) { + /* don't build objects for mirror vCPUs */ + continue; + } + Aml *dev; Aml *uid = aml_int(i); GArray *madt_buf = g_array_new(0, 1, 1); diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a33ac8b91e..3c0a8b47ef 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1928,6 +1928,11 @@ build_srat(GArray *table_data, BIOSLinker *linker, MachineState *machine) srat->reserved1 = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { + if (apic_ids->cpus[i].mirror_vcpu) { + /* don't build objects for mirror vCPUs */ + continue; + } + int node_id = apic_ids->cpus[i].props.node_id; uint32_t apic_id = apic_ids->cpus[i].arch_id; diff --git a/hw/i386/acpi-common.c b/hw/i386/acpi-common.c index 1f5947fcf9..80aefbc920 100644 --- a/hw/i386/acpi-common.c +++ b/hw/i386/acpi-common.c @@ -91,6 +91,11 @@ void acpi_build_madt(GArray *table_data, BIOSLinker *linker, madt->flags = cpu_to_le32(1); for (i = 0; i < apic_ids->len; i++) { + if (apic_ids->cpus[i].mirror_vcpu) { + /* don't build objects for mirror vCPUs */ + continue; + } + adevc->madt_cpu(adev, i, apic_ids, table_data); if (apic_ids->cpus[i].arch_id > 254) { x2apic_mode = true; From patchwork Mon Aug 16 13:28:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438481 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3B48C4338F for ; Mon, 16 Aug 2021 13:30:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD28B60F46 for ; Mon, 16 Aug 2021 13:30:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240540AbhHPNa7 (ORCPT ); Mon, 16 Aug 2021 09:30:59 -0400 Received: from mail-dm6nam12on2052.outbound.protection.outlook.com ([40.107.243.52]:54272 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240863AbhHPN2z (ORCPT ); Mon, 16 Aug 2021 09:28:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OqxpuU98vEVwm/RuW80Wrq0F90Xf8OvwH/j8+Ezm/B82EZuJlnlHLC1PDXiFkASvaFcdmdT5mtjYLr0sfJdH20X9c6e+JvaNwiTsCrlDUZnNQbIYLXMwv3tcIYuuPt9LnCN6wnAT3Wx9e0aHC60m5SYTySeFfHNDxnXLxefk3V0A6A4gEHdfIbVSwZdy4lvU/x8/riMv+qj2uPypTr2lKn5C24Udt8uiUmv+Z638JnBTq1bpoQkvHJszCi7wbQjA1sp14Z90Xy1xO7S9xfZUGwd3UVd16n9Dp9pWG5MDUVLyuTg+RGbe00E4C+0Dw/dJTVr+Vffzi9z5S1m+nTSO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fa3o1BM3eiT1R/L3CWJkvhGyU1P4SYCHUKP/SZzLdGs=; b=ACD8XSDsAKy4XZfbdVbMwkuwAabGvc5nun1cY9XaWt7LKa8ufVWAFakf5azsQCHLrOExhBO71l5AAOyQJk+AuqEe+HosIKMKzNN587ncWKvfFmeVpKa+NTek5HkuE9H2hjNpaBRq8RAu9biM1t/Nceb92yT1K9LtncewcRiD29UDXvLGLVv2/CKSn/QeYy8jeI0wv3ha8JlukYScwv7qCG2Jo2Gq4CCc5fw95f3YkI9PS9qDa2+GyErHwNEXVzajCYIccVSAWGS6YHWdmgCG9QpB3o4TZbHs2GmBHIznc1QVtRCGQl7yVMdXI8585vPJYagAKkmdH3rqJXUUEtWyyw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fa3o1BM3eiT1R/L3CWJkvhGyU1P4SYCHUKP/SZzLdGs=; b=z2jmEOhqPGUwbD4MlhpPkX40rclGz7V2rQRX1wXoYZ4ySUR1HQklP24pbsA2g1F5Fd314GZkvIZZDzOYRdIKySlpqoT0agpX9gLowTfzfvzub7sD0Fpi82wuJMMmwWkLxFLJGCvKXgNn/20D6Ew0vty4m51joCebbIw/vRXEPyU= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN1PR12MB2366.namprd12.prod.outlook.com (2603:10b6:802:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Mon, 16 Aug 2021 13:28:21 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:28:21 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 05/13] cpu: Add boolean mirror_vcpu field to CPUState Date: Mon, 16 Aug 2021 13:28:10 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR13CA0152.namprd13.prod.outlook.com (2603:10b6:806:28::7) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SA9PR13CA0152.namprd13.prod.outlook.com (2603:10b6:806:28::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.12 via Frontend Transport; Mon, 16 Aug 2021 13:28:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9372f728-d3fa-40fe-6f48-08d960b9b79f X-MS-TrafficTypeDiagnostic: SN1PR12MB2366: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:118; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6QpERTbdahWFaRc7aCjzrznw/HPt+5FrK7Y/iKe/uSCp4ZJWqZcor6PVi1CTdwwVTSpGWp+nFkS2Zr8T5aXBrXU+TzRjiN84tTzcTWUjX2s4kbkAq1jVURRI7OqOsjUphmopftLsyu0XbKZA8XaHjRD31oOwIl8atoXDoTmvfCxKd1LezmPFhtY9My4/m5gxImDYdCxaR3UmKb2usig42OsKVb1PveJhq87NvxsRHECFno5oL3YeGVIb63EYgNiGIlx/4IGKeKDIne+qde5SrzW9/YhLDiuCLDQpIGgi6bAJnyx+82oK9Iu3L+5LNhezxxvmWfEP42kFnu9yuxQ0qFJ+njoVQZFCoqB8Bc3Ghmb57Mw4rbBWy9IiJwkl0RQ0Z1nWlFdCXH+19/X4a26qu/2Exe5ugqmwVynXjoUq2T567+gB1tXYpr0sIEM4il78eSwsCFRRlGti/fQGUv1/sVqfVs5a41MwWNoQWypI+Zif6v7n0vHDDNYQbixZ+jKyvjvsEqNAS6Ovz9xLI2ZciQ/dn6Z9XUTvTS7Y1JOrAozUB8LD94sqcPF417ySR3DGgd8x8Y4aNvd3G2abmkowPjZ955ojNmSOfOQ0BDxR4OYMsIzSS1aq8H6wvpkulBbeVFNsRBkzA3kPz0WoMhs0uk8ZpGDnYKb4Eyezq78NxtPxfuRtf1Sa2jsqdiALLmUUMqgL2y6H4RqPXjXWNhhXHg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(7416002)(7696005)(38350700002)(316002)(38100700002)(956004)(2616005)(6486002)(2906002)(6916009)(52116002)(26005)(5660300002)(508600001)(8936002)(36756003)(66476007)(4326008)(6666004)(66556008)(66946007)(186003)(86362001)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DD5Ll4dDxikEbGgrmiU7eT+qiIVog15iA8tnbk4P+BfUK6WjvorTWkk8/Z3MIB69/FMvjOmZA8nAXrBVdQp5aNVlX3yE6n6fpHgOQZjcB8jrQPPpiouVdPeDY2wre+aCW/aRnLxN2VxFXrZCOLiXNI0NrAi3ieelRbbuqAIbmIJGH8ESvtCvOB4O4Bzgo9ufXd59T8fR0I8jqa2z4sQBgNZ5dWiFkkUANfTJo/MaorjmQZCDtlKoYKO3wfIKgDW21Z1SeWNHZYNepVd6B2gUL6aNmJSDOuVogxhTi9QuCVZ/KRHXnMhR2smDu4IU4ZOdXiO8vnbe88BTlUQU8lp7Yek1SMAylzz3CxjuX4uvl+M3XH99i3ct7iAl4kH/uEYHHBDOMeCH1yv8Yta8224ukX/yJsjWQW8qZx+aUiUwTwgF2MEev3Fkc488F4gflzsohWnY0DlykzsHLF1rcLpNTybNCARAd062LW0L4Csv4aZF8QlkE3EwaYMV9bY8nQaOPbTxBGyAVgz9RNhoNnvfoVLNw9XC4Fb7ctpUBkZR8scdo+41t4vqjoC0JUVP+U36D0NtWFetNpVCpg16llvynvZd90kITYOH8uyUHuvBaGE0h+YN8fx2dyNyYRH7HTTt/6UZWfE6DkdtV2IBkhCRaL+7eJTGuhZ1PFYYwN3XDU34k6GJ5d9ucgF0sQ8hR5aLD6UctccGPgh+SYnrpbyvFQaJ8YGvZzkbn2edQn6YVLeX2l+WgDMGC9jvQrtn5RMIfrT3T02ErHfATPx//K35dnjl+HvSURRPlUraRuECzpauoSoYiDcLKNIDW82kzOtCRfQL9oag131n1oXx8OlFw7whaZHtdp5B6SB/ZQiudx36nwKfbTnzr4kmGXQZfzgUkDarB+6wSm3OLoCiW85Gnl72q0x9MLTyPdHCrz6t2+fByJ8YuTyoL1UFtdRph+EMVJKMA88KOW+DxSxWE9sdscIrZhb6kWJ2r42iLQ2xODBUY5bQLZPFwQHJd0sHQu7HDwJgkfNJvZyMYapeoe6OLEnss3MixmxIh8kzgbF/zalFo9TT4cF3a8BPOMoq1ALAleRrX0ZR5JmsPQSCdxgSpqHZuY1T9HKpA9c00EQ3NKwUsTPWaNAx1IdAicZxcZ26IeqqWd9B2uavCZ/7bl9uHHPc/84lPLLd8S8IePOmt/vRpd/zlNr5kLdhT+Kw2gubhGO8Ys8Qg7C5rGzoW35hCVQ4Qg356uSkfBqWKft4gD9isceLejjUJ1EoS8hYlUsocYXfjOJZFMJ0elqHTg7Am1j43BduYm+4ed6SFWoL2g26lZTNjW5k+eVtWLIPcQn7 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9372f728-d3fa-40fe-6f48-08d960b9b79f X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:28:21.7010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: W3Qk0cGk107Epz9QlSf3qzPeIFD3+IupYxhB4oQAEih+ZI9EjF4xLxspxYEmf7mcvd0ri+hBQbMymk3lj1IigA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2366 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Dov Murik The mirror field indicates mirror VCPUs. This will allow QEMU to act differently on mirror VCPUs. Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/core/cpu-common.c | 1 + include/hw/core/cpu.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index e2f5a64604..99298f3a79 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -269,6 +269,7 @@ static Property cpu_common_props[] = { MemoryRegion *), #endif DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false), + DEFINE_PROP_BOOL("mirror_vcpu", CPUState, mirror_vcpu, false), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index bc864564ce..a8f5f7862d 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -402,6 +402,9 @@ struct CPUState { /* shared by kvm, hax and hvf */ bool vcpu_dirty; + /* does this cpu belong to mirror VM */ + bool mirror_vcpu; + /* Used to keep track of an outstanding cpu throttle thread for migration * autoconverge */ From patchwork Mon Aug 16 13:28:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438497 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 108BDC4320A for ; Mon, 16 Aug 2021 13:31:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E878460E78 for ; Mon, 16 Aug 2021 13:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240932AbhHPNbq (ORCPT ); Mon, 16 Aug 2021 09:31:46 -0400 Received: from mail-dm6nam12on2042.outbound.protection.outlook.com ([40.107.243.42]:46656 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241528AbhHPN3r (ORCPT ); Mon, 16 Aug 2021 09:29:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D2nD/y7SC/mrCPewxBJ7ECSGYAc85Fbo0QgOol86RHfSSuldrWPxtyqHR/ToDIdxQZTmImkDWG2Domt8Pih5OWdGquBVokOODoNlsVnGmU0hiCIglnCqO7MuiUC1q4gfhLt7jA7vgE5y8qRXp/nR6yTBfGZbKWIv73Lez4KXdLQzbwdrgLRAO3bYUQR6no1RbzyPj7YUzyKlXRXeHYoCjPNiCrMOONgW/GSUhZZ8jN+hnCZl87pNV4SMGZMkZJOPXze7iBFRbrIRvJq8QXsAqHKmbKy9CX5Hbmyjc9MOYjgnwUgz8ROAcCttWHLDdgMpl4ISVQJLNryn3T/dHhP3og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zeF0PyPYyeyXcMJOf5tpXQiylrY13tMzVY/RYEekCwk=; b=UIKpwQGbcktylAMZ9QaQMMjJokl9LRrzfAhDhWazK8ey6vriciaZWrDqZOYkOEZ/HZ9rzfO4FaeFlqT7TAtMEhGMY0YyStujmTlc86uBQMJ03T/XLrBOEWa4+ZjbzBfBORG0Ya2sbyJ1LAF27ouyNqC9OJ7X+l8VdKbY8UcypWWZE21TLkyn4ChLsFI2DOyxhjPAIb3G8Xw+vB9/rraQqLr+ua4xqVcwvUaWuQ/4JpQX7XcRgyDjj3lccWPeKIFv3Zc3+/2ybF8XIvahFFsf9XDLMsX5dlWOoMVhFQS5Q587NfskIpUabr1VmBMyJ/+rfdYxxMIetgzw+lLHUuat1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zeF0PyPYyeyXcMJOf5tpXQiylrY13tMzVY/RYEekCwk=; b=pC4C4656h7cKv5XEzlDQTfGdbB51Xy/S/57J1U3FdntLmVmdDLDTHVuIBf1dhaDGM1VbwXufE5+WokLWs9yHxx9crR9cBXVfoUbco/FaEdwi7fEpw5FgWzX25fInNJhJBGsahkbqCS5dzB0S7Vg3eA1PI7t5PYmAy/7zb5GsdgM= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN1PR12MB2366.namprd12.prod.outlook.com (2603:10b6:802:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Mon, 16 Aug 2021 13:28:42 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:28:42 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 06/13] hw/i386: Set CPUState.mirror_vcpu=true for mirror vcpus Date: Mon, 16 Aug 2021 13:28:31 +0000 Message-Id: <8c04d77d3a5a60436aa2b77264b2b7d40b402497.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN2PR01CA0023.prod.exchangelabs.com (2603:10b6:804:2::33) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN2PR01CA0023.prod.exchangelabs.com (2603:10b6:804:2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:28:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: de6a6442-e4d7-4060-9588-08d960b9c3d5 X-MS-TrafficTypeDiagnostic: SN1PR12MB2366: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +uY/ZVSckIG3ytvbPs+Rce8L5ci8+L+cbcbrXpOY942zDboafjyigp9eC23OoIFMGqk0NhkHFMPuR5NWR+/cl1D74P/TpkEDWKdbanPJo2hynFA8UgTpNPQIv82JW1c1VKF1dYhDbHMnwqsWahUapd+Yyp/fxBGNTK8TPI72SzbnJ7WxNvo7ObFgn2lsyKxkEac5DC+3ue1pi0cIhx52rolleIKgagPAWL889NQeg0SFNaBW/LvNkuQhr+90ljaeB0dmp0MgwY5aFVeWCaOhdgvEwlDyUAJZbibrUNmefe1U783RgLZPcZ3lBSVbVpN0hu9l22pj9RJM8FrwRiRKpy5bj2j180SqkWSj0frei02oUwK4lBmqYaiwfKKRRM51O7iP7Wfl5hF/BYJmz46Dsj5ZMf/eIdqK4sWfnYzwZ8BalFlbil3kwJIYePhJP6OLTQrVa5e5E0xe/4eswbotLJn5U6iG9pExfP5/dbgkm86+HnBiDC1dWvPEp9SdfucSNdHQRKSB1E38h+A63j2M0H668ulfOXk4qdhMucWY7k53P06z/bicNiVRTPNA9MdODS/vvShnz01eJ4jSvWXpML2/ddQ+8ePUeBWw2XZa4Q1SapUF35kuEUtYDqCLL9d3IaMgiE5lEA0quDZbVRCFU2zSZl2Nv4Wd2uav55PSek9Ln3h/CF1rhv7V7WJmqvDiF686f1Cjw91vT6EvyLtZyQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(7416002)(7696005)(38350700002)(316002)(38100700002)(956004)(2616005)(6486002)(2906002)(6916009)(52116002)(26005)(5660300002)(508600001)(8936002)(36756003)(66476007)(4326008)(6666004)(66556008)(66946007)(186003)(86362001)(8676002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5IbKoteHIfvENzUsyi1usAvbshjOWEe/fEEPs+bd/rH0BNWU0gCeJ4CRYUtbOJfzjMvLpLhkJmrQKay6wMKOTP+rVvYfUySbIUM58QFysTCUq/V2qRp5Mwpfgbd1a2yFXIAahwhV+GPPnow6u/55s3+Vh7BejIQ7Nkuh/ulkMBLJh+K8AA4SoBc8gAdt4UTugg0lY3YtaAnBei/fyZ2TGg2H1wIHv3fECYiSFatIlIF0w/v5DB2SEg6IP/rGhwpFWaVY9N5EuISNOWFkfcnDhYpy0zdNohKQ0vkbXL3nu86kkJBjlt/shzkOFH1wIGfLgAXMs8GqH5H7lNuVpM0ZVMB9BKxg6j4W3Uwp7VLlHmxBPBjZLb5aol1sjyaKWGSq/nudwT60zR99e8LuZswrqvolBWbwAPzd1BUW6ubymLPmEH246/bqShuMRjhTwP2BAn4GwyThsPAZAscb2juQMzCsFKdU0cpYUHU1J6nvZ4o+gFvWQxszU8mDsS/bqqYD4WHK/vw265rlBurcfXiOgdOEtPnSNuMI4KYHuTpWFiSnzeyRIJc6OH/YpYyql4aqqsv6J26dPsxiHJFIpkzfQ+cbZN1SOG7KZj2JnKJG6XXdR9unYnGLtpPITLGe7NOu/zO2dI6+hQUJsZgvoeVlLwN4o6mkjBMVTWnpnBONOYwy+QbvZxF1T9UJpC2TQickjGxvqplNzR5F/kkzEoqw3ns7q5Rg0dazwIdjopZms77GM+aJBX8Wkt/bXuxYOHehk2Bz7/49nJLjsay3hyQ9jwzmG8QxUeak0hy94Vz698ZutovuDRsy7KvZuoO+nIcokeisOrhkEafXLp8lL1FUTYNTP6C/NFLof0PHW5JdNvyXLtZxp15gOs9YFsqeZ0Z79VaTJkEle8V8n0Q0iZNxdR4IoOV8Ay7UTOTtCdg1RVHNHDYIopiiKNAG9tYI66ILdp7XeyjuC9xKukBsCz0OHLhvnK7QnH9zZBVTDzEHxlzdPbKIpvr1Kk6omkrTRVyFM29V8MZX+FFk6XLUtCO4qnNxA6TUdowlMMToPj7BC3AvvAVZGbOog2Nqxtod6AFYqSjRmjTXiTYunTFUooPLqbdchPH/D/qKojvlA5p+AmlKo3qubUXqlgp3hA+OXuAoAHmRPnbAYZqKi9kgfEejEXqcA1i4TbBiQaZXvRYrt7Z3g98MgRUUGLCvIyLMAEloCBzQUHLxED/hTVYWoFVr/dQ+QARktVqa2HzZ9YD6hHRPTUeJ9ckBT0PbYMMhG6JgHxLxyksbZf2jWYE/h1KFRnAbl5FIlSvWZ6e5KiFzefiEa+a31vCZ8/bxtMEyaV7v X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: de6a6442-e4d7-4060-9588-08d960b9c3d5 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:28:42.2225 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZBu0UuKwRRWhTgkAJB1w9SgfqCjjaHU5pDlAoVLn9q1+bTUi7CcJVjA45Bo7SP+RkYo1nAT0IGcdME/aspbAFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2366 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Dov Murik On x86 machines, when initializing the CPUState structs, set the mirror_vcpu flag to true for mirror vcpus. Signed-off-by: Dov Murik Co-developed-by: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/i386/x86.c | 9 +++++++-- include/hw/i386/x86.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index a0103cb0aa..67e2b331fc 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -101,13 +101,17 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState *x86ms, } -void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp) +void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, bool mirror_vcpu, + Error **errp) { Object *cpu = object_new(MACHINE(x86ms)->cpu_type); if (!object_property_set_uint(cpu, "apic-id", apic_id, errp)) { goto out; } + if (!object_property_set_bool(cpu, "mirror_vcpu", mirror_vcpu, errp)) { + goto out; + } qdev_realize(DEVICE(cpu), NULL, errp); out: @@ -135,7 +139,8 @@ void x86_cpus_init(X86MachineState *x86ms, int default_cpu_version) ms->smp.max_cpus - 1) + 1; possible_cpus = mc->possible_cpu_arch_ids(ms); for (i = 0; i < ms->smp.cpus; i++) { - x86_cpu_new(x86ms, possible_cpus->cpus[i].arch_id, &error_fatal); + x86_cpu_new(x86ms, possible_cpus->cpus[i].arch_id, + possible_cpus->cpus[i].mirror_vcpu, &error_fatal); } } diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 6e9244a82c..9206826c36 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -96,7 +96,8 @@ void init_topo_info(X86CPUTopoInfo *topo_info, const X86MachineState *x86ms); uint32_t x86_cpu_apic_id_from_index(X86MachineState *pcms, unsigned int cpu_index); -void x86_cpu_new(X86MachineState *pcms, int64_t apic_id, Error **errp); +void x86_cpu_new(X86MachineState *pcms, int64_t apic_id, bool mirror_vcpu, + Error **errp); void x86_cpus_init(X86MachineState *pcms, int default_cpu_version); CpuInstanceProperties x86_cpu_index_to_props(MachineState *ms, unsigned cpu_index); From patchwork Mon Aug 16 13:29:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438499 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 026EDC4320A for ; Mon, 16 Aug 2021 13:31:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E09CB6056B for ; Mon, 16 Aug 2021 13:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241095AbhHPNcX (ORCPT ); Mon, 16 Aug 2021 09:32:23 -0400 Received: from mail-bn8nam12on2066.outbound.protection.outlook.com ([40.107.237.66]:59104 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239058AbhHPNa2 (ORCPT ); Mon, 16 Aug 2021 09:30:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iMT8P2M3vWG1UISIj7GoVld/an6nprOVvj2f4dO/5YBLmkuHSPIWElZ66aNl52XJxCLRFO7zQOubHhPgXywL/14YqUkAQVMgFLA7kgfElInlkDdzWIfKWO5CQkBZPr2wJeJcyd1VvU0lI5M5Y0Bq87JBh5Dt66GoGyVVR+NmuncEVny/XhLJ1iG2iKaEYtKDxkBjV8zk6D8QZGOnvlSb/Wu3qkC4qFl1pkzVkJGSMHx8dOlArra6EH2z6vRrg/d2bYdLHobsYuUt3/i3CUBi9c3NMsUwHlmARKyR+R+xViY0vBYaJOoZ2TacUO62F1SI0bEAxmqPetisxW8moWktag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kyr2iEPWOnduvOBFmnbYcRn7VS6C8JYB2gGFQQZT1X0=; b=BawsDCfR3PBfCMEOkeqjTtl75a8FKlRKtKqJU6chmhtJrV6ZrUbXbdCVdlWvFmnh4TUxggXxq5c3IyEoNfXHWaYNr3y9Az8ONTIocNhRcySywh9KOQyI8uiAQijIIX80m/eDC0M8dZ0ld5HqABmZt5f7rq5GLHMzGzPWRIBWv+rSHub+3l7Y9jFie3Z4TI/t1TUdNpHS1kXrevIMEiWKy5wngYEGtXj4m+Zh4ZgFw4LlwAJKO9hj6X2wyk+YGFKgnb17ZfcYk6aDadLfnAgicAVTZOfzEqNaZUguBSOE1qbfVWYGcrPZBTBnrNQ0chm9ZgJjLgkNzxN7pywkTNQNZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kyr2iEPWOnduvOBFmnbYcRn7VS6C8JYB2gGFQQZT1X0=; b=PLnoiqCkNflQX9iw2P13l1ThdQz0KEHRBMSt+K6Dsm0PS7siu0QBqz5F25qV3WIcGqBJUvMu7TkVnvVnCOD4ytIIbqTMuxydvEC2XJmkROua8BJoMvAq4MrEzfdqQ8nYqChoy3v6N8v8rpYIS6/9ZNP8K6UfAYiWLcVDHHLukMM= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN1PR12MB2366.namprd12.prod.outlook.com (2603:10b6:802:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.19; Mon, 16 Aug 2021 13:29:22 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:29:22 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 07/13] kvm: Add Mirror VM ioctl and enable cap interfaces. Date: Mon, 16 Aug 2021 13:29:11 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0070.namprd11.prod.outlook.com (2603:10b6:806:d2::15) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SA0PR11CA0070.namprd11.prod.outlook.com (2603:10b6:806:d2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:29:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3ad602e-145f-43ce-7314-08d960b9dba1 X-MS-TrafficTypeDiagnostic: SN1PR12MB2366: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:57; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: baLDtnTp68wDK2TOECgmBx1fm0lQHyre9D76e85XqgheOXD/GnicI1PVkNmPe9iZg2U9kLmYZ4JbYqPAUWq6Ysg8NWUt5bpEIZimJP7MUwBmFo0xivB4G/lgxICskHjdUBEZHkfIticxcvXbDPS6rf13L5Veq2pql3C7P9thqsFKSUQjETraJ83/WtYzrL46X1YftKVx1mNNASD1UVRTWCbz/Y0anuci7aJ9LCd/FHVB7L3bAEZH36+l5OMGL8Wh3z8zoi3dy7oEMLFxgSW4rHY1cEwdVRygbGC9XF+xhYCL5NdD/CN6O/cXsMRLHl50uvFQJX1C9XPyxpwb91H5bOZolL6+STuFSqUT6TGbKmBFaPhdjVLtMXqotZmr2/9bZLs2526/83+SH2nAbkUuHCL/IlUhDKBibfnjFrl/31ycVzw2nqS2quF+kD8mmEiAYsnOGJqUsnz/ui9NyBp/5v2G7ytPieSnfoh4FlYjQ1vg70ufmLmOeo1ZAbv4nm2Cfq+MExEISY9a3OJ1fTVGBkSJC84ABRhwVaYfproSJHz4JxZeTyRAnFzfVua026nKtBXod4JPe187LkWtH70ogO6vIFYgytKFMPsif+B7AJWPfubV7C6Q6ZPO/jmbxWodjFAAX1a1EARUfyKohJYnsOXSHTgbUQ5j0yBJhY4YeVboTIKYexEW1EV1jWG0jajFa2DWuoJNcX/27Z6ah6pnsA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(7416002)(7696005)(38350700002)(316002)(38100700002)(956004)(2616005)(6486002)(2906002)(6916009)(52116002)(26005)(5660300002)(508600001)(8936002)(36756003)(66476007)(4326008)(6666004)(66556008)(66946007)(186003)(86362001)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2y33Nk1uHocThnYwm6X+rs8jTIyuISppq8XcHf/XO1LC7IlzqJTdJQQoqGWDLAfK0r7RlpzGgD42ARPI+sKIFf8Y9WJ7qSMfR9vDff1x9u7JYWfiQClmgtoyi7s+QXyHSWowOr2CfToSd/PBaKQfMNAHBUiifLYLXNbdSRIrVwDHuSOONJVJkZZtqJqUkSws4GryY0GPganG3UddlA0uuEhpmNtdeg7eosBKmh69YRVhoYPd9WCFdF2TX0ip2wIB29zawx+FNTkoCIb/Lp4sicWSP1+LDkj3Zn0hmJVP6GXwwpvPbqBeusA/K5dmwAJ8pehz0HuGG8fCULjPh/1FjVPA9bt7sqTZ3pAjILZhdUmMXk1HkGj3OZ1pHldurYk6ZkZ5vsLlIOX+o6ZX/fWKqjAzUEgRRk/x5eeGc2HG5ACVrLKXXnkzgcf8SeZWCqY8IleTslBTIkBS3lXpJ8hYNlI7CWAtR665x4OTh8XyJpyl7mr7JMYSk/5wlXzGUzMkvl8HfJTtH3pO4nVN8YLKPxkDYc8bq7hZVDyeoh0epSkBsN0c3YAJYjXdcxPsbRajjwP0a79Pc+XLsBQuQCKIlnRMoFtBUOg8bZ8p9mt2tq04dkXI2CvN23zSBbNJb4rHqK0fQaXdxuKSmZY5cbCQPaFPyTsIGG4YjCHBXpUdht2GoDIMfW/nEzRIWg5hISzqMi1HGuiHa6uKreR+2sNlr7nuX69HQpGVXNlm/bA1KeJ1bFbmMbnZPfiTlTynDWAhAnCRHPFouafphf5coJI3Tk9MDooaH1PMMscLOtaMheYonjxS/6eaisFNYGT89tuVzap3GIzVzGoj5b7szpLm9BiCyNIRO+bmiVgnM3/ByOXCvxYcbDMqE9WPGL7EskOHYUFTELoiVJBoDbLk2LD13xpu3JaiEHwOtgEUbDnfddWIhe2QUZXnIGheBdiZfjOGTZcL8xOPD4EKoZn4gk+68/xb5fPkXLmHhZ1SyobdoH0aCUOSZG+N4/Yn63dNRpk4AS/y5diygycDlWpROd+rjZi9CqiMbJOVBsEdxd55r7p+s/6VZlUhNVOlt6urQDKqnq9LG7nUoo3gvSAkZg/yCym2Bpz0TrAXFaYhj81oojtcwmBUNwQW5gG0ML3H90Amf3jc013GFIbzqqXKDTQtHzTw7LEJhgv18ib3Co03Ole6JIJ0Ity3ev+p6/2eWQp3tY0+e0J1+9VDAVC2kqNGQKMRrPTMNOTT00aCn3Ws+EEqMp3tL4p4S3ka1aTelwDlFzMJJHR43PT+TjNKzpJfGAf6r45gpnUMdIQAtnqH7wHN/SdbnIa6tFloacr5l/4X X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3ad602e-145f-43ce-7314-08d960b9dba1 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:29:22.1222 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Wl8tNpTxPcKroUi7RPDs077bQNrzTJQIAWjpPCaeSKz+fzDk6hgnpVI3ZAoc9hiMRSWjIhi54/A4XnroPM8a5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2366 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Add VM ioctl and enable cap support for Mirror VM's and a new VM file descriptor for Mirror VM's in KVMState. The VCPU ioctl interface for Mirror VM works as it is, as it uses a CPUState and VCPU file descriptor allocated and setup for mirror vcpus. Signed-off-by: Ashish Kalra --- accel/kvm/kvm-all.c | 23 +++++++++++++++++++++++ include/sysemu/kvm.h | 14 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 0125c17edb..4bc5971881 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -149,6 +149,7 @@ struct KVMState uint64_t kvm_dirty_ring_bytes; /* Size of the per-vcpu dirty ring */ uint32_t kvm_dirty_ring_size; /* Number of dirty GFNs per ring */ struct KVMDirtyRingReaper reaper; + int mirror_vm_fd; }; KVMState *kvm_state; @@ -3003,6 +3004,28 @@ int kvm_vm_ioctl(KVMState *s, int type, ...) return ret; } +int kvm_mirror_vm_ioctl(KVMState *s, int type, ...) +{ + int ret; + void *arg; + va_list ap; + + if (!s->mirror_vm_fd) { + return 0; + } + + va_start(ap, type); + arg = va_arg(ap, void *); + va_end(ap); + + trace_kvm_vm_ioctl(type, arg); + ret = ioctl(s->mirror_vm_fd, type, arg); + if (ret == -1) { + ret = -errno; + } + return ret; +} + int kvm_vcpu_ioctl(CPUState *cpu, int type, ...) { int ret; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index a1ab1ee12d..6847ffcdfd 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -255,6 +255,8 @@ int kvm_ioctl(KVMState *s, int type, ...); int kvm_vm_ioctl(KVMState *s, int type, ...); +int kvm_mirror_vm_ioctl(KVMState *s, int type, ...); + int kvm_vcpu_ioctl(CPUState *cpu, int type, ...); /** @@ -434,6 +436,18 @@ int kvm_vm_check_extension(KVMState *s, unsigned int extension); kvm_vm_ioctl(s, KVM_ENABLE_CAP, &cap); \ }) +#define kvm_mirror_vm_enable_cap(s, capability, cap_flags, ...) \ + ({ \ + struct kvm_enable_cap cap = { \ + .cap = capability, \ + .flags = cap_flags, \ + }; \ + uint64_t args_tmp[] = { __VA_ARGS__ }; \ + size_t n = MIN(ARRAY_SIZE(args_tmp), ARRAY_SIZE(cap.args)); \ + memcpy(cap.args, args_tmp, n * sizeof(cap.args[0])); \ + kvm_mirror_vm_ioctl(s, KVM_ENABLE_CAP, &cap); \ + }) + #define kvm_vcpu_enable_cap(cpu, capability, cap_flags, ...) \ ({ \ struct kvm_enable_cap cap = { \ From patchwork Mon Aug 16 13:29:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438501 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE5C5C432BE for ; Mon, 16 Aug 2021 13:31:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A68806056B for ; Mon, 16 Aug 2021 13:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241188AbhHPNc2 (ORCPT ); Mon, 16 Aug 2021 09:32:28 -0400 Received: from mail-dm6nam10on2055.outbound.protection.outlook.com ([40.107.93.55]:16960 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238754AbhHPNa0 (ORCPT ); Mon, 16 Aug 2021 09:30:26 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lH6vE84/0/yY5wkfQiNvsNWxwtwLKLjnkVRyqAdSr/8goV8VwJI/4M5gzjcoGTuwsHpKKKswRf9fFBQJFl23m5/ojzqDa8mhXBH6iZCqbH9kFeIjP5QWSqhy+FM+W2ylCBluiXXoJOl/zR/WexpJ5zmJJJeNzp42If9i1+HA2qkjuKM6lL2mROk38igJkltuKTV4K2byEbWH0P/Bg/W3ia5U8TIGdLswGm8va1ywyD4yUE9iO5u+xaOadrJ43/ydwr4wwWLNlnszv8JroWZjm+9kpeJ8/mgeP6hGQ9XKyI1uG5roRlAzuPKRPn28z5KPWVK6R556kL6wSZq6fR24lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XxrAGwgzL30APAe5l6Xa57GYHJT278T/HEKzpyocTDM=; b=A7AXOntSf2NBvEQOiDl+SA3z/kHALkV/dlYZHAZR6unJaipQAkR1F+m8uB1xPhqV1ep0oAezzKdi5ia+EJbw1s2bOmVO5gRUvNJhAD38ueO8DdA+toqKIyGzZdLfPhVO+owIDlIQoe6wu6tDiN/khzKEy3kbuzRJ2IiJy+tzVhuFwihsQ8jxi3CKAqHjF/bC49u/Fky2iaJ1EBN2SxKUuUSjkjWjjaYW7oDP9n7Vt3QYeQok+ZB3Tyf743g7PIrcxb5oiNQqjehmazOXVckNbIprXcSi1+zI8B42n2ijPdRnopd38638ylJTXyFegYVNkwOb4bSijS7bs1a44pIA9g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XxrAGwgzL30APAe5l6Xa57GYHJT278T/HEKzpyocTDM=; b=PsykmZmLyV4HEmXzvJn94rs5qv5X04i4UdgPBBBmNdCctZBwWxHU3ha4+UquJByfOwBQhmDLTGSRsndHd4OAAMdMVjzf8z6VYx67mKvqLx5TkFsxsoW+esseoz/6fplpCX1mwIja74mTBGkserVI9krYGv52FkKvcM5ELQnHlz0= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SA0PR12MB4512.namprd12.prod.outlook.com (2603:10b6:806:71::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:29:52 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:29:52 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 08/13] kvm: Add Mirror VM support. Date: Mon, 16 Aug 2021 13:29:41 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0201CA0072.namprd02.prod.outlook.com (2603:10b6:803:20::34) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN4PR0201CA0072.namprd02.prod.outlook.com (2603:10b6:803:20::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:29:52 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2c163b72-0fe9-4bfd-0352-08d960b9edcc X-MS-TrafficTypeDiagnostic: SA0PR12MB4512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:194; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XSkEt+pky5KYHeQq6uBplKiLhVxAP8W2A7I5WS0Hgk9eCinKYA9D3237IZgGXQ9kmnyAJ5RwOMIfvd4NiDw4wZOOECtZ9iVyEVUh6whShq3ex/IDOyrkYIynwm01x3cE04MmHzoBPnyosoH2BqYQzVTbLZO/Uj8O4tSsbjQ9n18TtGeS3WanqZYfxde1x5pECypfonjy7FB4/wXT2gVBVD99DlWvfBZQZIoZJ6enIISvz7HA0eEQC2BetgRG/OB0akzSK5P+E8VxL3EZALhofbGnq4iEaFf4ICI9uzDIDQyuSYkM+C8j6EqnKTrBEYfXTpyi0vX3G38wnTFfbWPGZdisgmMZ53AkoDUiL2Ly+zkemPtuRRkx8eOWclPvmXYPyBdFtGkTOQOat0bX6f1e/PwMb5qjVzrzLmT4UYwGbNUSm+zSe0c2E+jYmIZNCEPkZ4IrIBAkKqK+pbAPoE1BfOH3W82NS3wTS9+2vKRP74MGoRUHnEySpkmdIh/UAnHAkPlNOIVDrpYV5r58IVDoOf0iGN+dNtziA2uN8UTjHQn2ZTd9v12LO9+uH3cKi02VcDZolKrH1LlbeFBXIj6Tmz5hOpRf+mDSwVgrYiv1Ih3Z12/i2zQH6ZrG68vVLDQd1sP73XxbdrrR6c9E83hJcxIuZ7y9QJFbkEynDViIORa6q4SnVjdiLCJdN8okn3KJMK8OCJMMeTbVbbyaV+FeSQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(6486002)(7696005)(478600001)(36756003)(52116002)(38350700002)(26005)(66946007)(66476007)(186003)(86362001)(316002)(38100700002)(66556008)(2616005)(83380400001)(7416002)(6666004)(8676002)(6916009)(4326008)(2906002)(5660300002)(8936002)(30864003)(956004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NjQM7iwBQyrkAkBDfbIbK0aR8j6UNxfXp2z/hc93UyGLA6epuQayGgcwLnCNnzMKfg1TWiiOJGxdRSiNmjgJeNKG5+y/ayUswy71xmk3IN3hUUoGw7lZIvXQNDX5hom5MeKA+7ov4MHfccEpOD8iVq29WVvXj6qTXOnhYI5o8Rsgebu5JJwjlJqXS9d9fzx35mMyw+VGjmw2bQ1gmgC7sSUSlvF1SEHfBHHbk4NSTzCdafMz/HiSxtm8qmWxpFgfGJRan7BQgLtlwZBV6gD0mJIjHm0soe7yymx1DIRBTurM7Zf8hH+e2cn4h/ERCzeHwiEuWuVzVMGnWug2ouLzzvuyhxbYnLP6EdK82wrtVJvltBa1xXT3jhBe96dhMXC9k49ztdvou1dwZvq92h1zCHzSJYuooiX1RSlLsa9Oun795/yeYfZEWdhrUZwKpi6GVXv1/etER/QIwAxfTNMiknP0dlSXQ95y8c5GEzxnMoK1LiWYUKPg9QsLhlruoLrgHMpFV8r/K53qaKeK+2a9uxD4zgTD10JOBj/AGCIE1yC64H9X7NxJSZkQMt3B+awVO5cac7GuUyxSnYukNvtZjO7tugwDXvro0KqXv3CLpUzEDa/B5tuFgik/TjNtUWmsnTBdYmsTJ8ST2vvoZmutrJyGtZFu+Bu4+SzbOxjvU9/bzSm0ReZvCX5NerpTVfZ+NkgRTsnwpMow9S86UcdtqqKx5cXQM4emKb4XRpPbC+J2YD9tgY8plbcec3pj9P/DJC13nyGrgVDVIbOgpX7ZzXdepdJJT1e8EXB1gmjTz3wYIGPOO04smWkDLKLaj5ZZEGEgUMrfiCAtUbbbiZ69RSbDQcVLlTuS32x0al7drenFP6CGNYB/wSvFoOS7YjTkPVeJ5V2G4oh9T5/oJNVQSu3WocX1pTjlzjNvK/81LMQdmk8BUiPXxZwDW7LbLA7gxIxbiu+vGpDKOeoo4ADzcX0VtUGRR6mEz5jPa42CExGpD4v9xhQ9vow1yWnWps0ADujZVEaTcZ7qVgsBl0JvrbnLBCug7kCkHqyE5e/znif2YpmcAFWMGSErn9i9FAq4D9KIakktatxnS6g5nym7gzifswHxAz2xypbbyuwqqI/kiLaRsaGTkwPuloxHpVV9L5h46u1ns7X+fnEmfkbVBHqqoZsBfPsu9vtmc1o7Oys1HzfuC3hSEqfkQUMNP40HKG6SmW8EM0yHE6QKLo+iue/TJVhtOQ3YFnzGj8ptrk08dNSHcRj4efT5yxTGh1qdYvMJgJ/5jrir0fhbB0Rs1RuqTZf2U8yGrif4vdinprqLLTlj4XKhQ+i2xJTF54Ik X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c163b72-0fe9-4bfd-0352-08d960b9edcc X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:29:52.6191 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rWEPV03NRAUiRUUvi9KJsYFtUPQUqI/V0KV4yGKQSAPqJlHyywxul63iprQt4kYk8ldDAaZfyeEVfQdYHBwGnQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4512 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Add a new kvm_mirror_vcpu_thread_fn() which is qemu's mirror vcpu thread and the corresponding kvm_init_mirror_vcpu() which creates the vcpu's for the mirror VM and a different KVM run loop kvm_mirror_cpu_exec() which differs from the main KVM run loop as it currently mainly handles IO and MMIO exits, does not handle any interrupt exits as the mirror VM does not have an interrupt controller. This mirror vcpu run loop can be further optimized. Also, we have a different kvm_arch_put_registers() for mirror vcpu's as we dont' save/restore MSRs currently for mirror vcpu's, kvm_put_msrs() fails for mirror vcpu's as mirror VM does not have any interrupt controller such as the in-kernel irqchip controller. Signed-off-by: Ashish Kalra --- accel/kvm/kvm-accel-ops.c | 45 ++++++++- accel/kvm/kvm-all.c | 191 +++++++++++++++++++++++++++++++++++++- accel/kvm/kvm-cpus.h | 2 + include/sysemu/kvm.h | 1 + target/i386/kvm/kvm.c | 42 +++++++++ 5 files changed, 277 insertions(+), 4 deletions(-) diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c index 7516c67a3f..e49a14e58c 100644 --- a/accel/kvm/kvm-accel-ops.c +++ b/accel/kvm/kvm-accel-ops.c @@ -61,6 +61,42 @@ static void *kvm_vcpu_thread_fn(void *arg) return NULL; } +static void *kvm_mirror_vcpu_thread_fn(void *arg) +{ + CPUState *cpu = arg; + int r; + + rcu_register_thread(); + + qemu_mutex_lock_iothread(); + qemu_thread_get_self(cpu->thread); + cpu->thread_id = qemu_get_thread_id(); + cpu->can_do_io = 1; + + r = kvm_init_mirror_vcpu(cpu, &error_fatal); + kvm_init_cpu_signals(cpu); + + /* signal CPU creation */ + cpu_thread_signal_created(cpu); + qemu_guest_random_seed_thread_part2(cpu->random_seed); + + do { + if (cpu_can_run(cpu)) { + r = kvm_mirror_cpu_exec(cpu); + if (r == EXCP_DEBUG) { + cpu_handle_guest_debug(cpu); + } + } + qemu_wait_io_event(cpu); + } while (!cpu->unplug || cpu_can_run(cpu)); + + kvm_destroy_vcpu(cpu); + qemu_mutex_unlock_iothread(); + cpu_thread_signal_destroyed(cpu); + rcu_unregister_thread(); + return NULL; +} + static void kvm_start_vcpu_thread(CPUState *cpu) { char thread_name[VCPU_THREAD_NAME_SIZE]; @@ -70,8 +106,13 @@ static void kvm_start_vcpu_thread(CPUState *cpu) qemu_cond_init(cpu->halt_cond); snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/KVM", cpu->cpu_index); - qemu_thread_create(cpu->thread, thread_name, kvm_vcpu_thread_fn, - cpu, QEMU_THREAD_JOINABLE); + if (!cpu->mirror_vcpu) { + qemu_thread_create(cpu->thread, thread_name, kvm_vcpu_thread_fn, + cpu, QEMU_THREAD_JOINABLE); + } else { + qemu_thread_create(cpu->thread, thread_name, kvm_mirror_vcpu_thread_fn, + cpu, QEMU_THREAD_JOINABLE); + } } static void kvm_accel_ops_class_init(ObjectClass *oc, void *data) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4bc5971881..f14b33dde1 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -2294,6 +2294,55 @@ bool kvm_vcpu_id_is_valid(int vcpu_id) return vcpu_id >= 0 && vcpu_id < kvm_max_vcpu_id(s); } +int kvm_init_mirror_vcpu(CPUState *cpu, Error **errp) +{ + KVMState *s = kvm_state; + long mmap_size; + int ret; + + ret = kvm_mirror_vm_ioctl(s, KVM_CREATE_VCPU, kvm_arch_vcpu_id(cpu)); + if (ret < 0) { + error_setg_errno(errp, -ret, + "kvm_init_mirror_vcpu: kvm_get_vcpu failed"); + goto err; + } + + cpu->kvm_fd = ret; + cpu->kvm_state = s; + cpu->vcpu_dirty = true; + + mmap_size = kvm_ioctl(s, KVM_GET_VCPU_MMAP_SIZE, 0); + if (mmap_size < 0) { + ret = mmap_size; + error_setg_errno(errp, -mmap_size, + "kvm_init_mirror_vcpu: KVM_GET_VCPU_MMAP_SIZE failed"); + goto err; + } + + cpu->kvm_run = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, + cpu->kvm_fd, 0); + if (cpu->kvm_run == MAP_FAILED) { + ret = -errno; + error_setg_errno(errp, ret, + "kvm_init_mirror_vcpu: mmap'ing vcpu state failed"); + } + + if (s->coalesced_mmio && !s->coalesced_mmio_ring) { + s->coalesced_mmio_ring = + (void *)cpu->kvm_run + s->coalesced_mmio * PAGE_SIZE; + } + + ret = kvm_arch_init_vcpu(cpu); + if (ret < 0) { + error_setg_errno(errp, -ret, + "kvm_init_vcpu: kvm_arch_init_vcpu failed (%lu)", + kvm_arch_vcpu_id(cpu)); + } + +err: + return ret; +} + static int kvm_init(MachineState *ms) { MachineClass *mc = MACHINE_GET_CLASS(ms); @@ -2717,7 +2766,11 @@ void kvm_cpu_synchronize_state(CPUState *cpu) static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg) { - kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); + if (!cpu->mirror_vcpu) { + kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE); + } else { + kvm_arch_mirror_put_registers(cpu, KVM_PUT_RESET_STATE); + } cpu->vcpu_dirty = false; } @@ -2728,7 +2781,11 @@ void kvm_cpu_synchronize_post_reset(CPUState *cpu) static void do_kvm_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) { - kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); + if (!cpu->mirror_vcpu) { + kvm_arch_put_registers(cpu, KVM_PUT_FULL_STATE); + } else { + kvm_arch_mirror_put_registers(cpu, KVM_PUT_FULL_STATE); + } cpu->vcpu_dirty = false; } @@ -2968,6 +3025,136 @@ int kvm_cpu_exec(CPUState *cpu) return ret; } +int kvm_mirror_cpu_exec(CPUState *cpu) +{ + struct kvm_run *run = cpu->kvm_run; + int ret, run_ret = 0; + + DPRINTF("kvm_mirror_cpu_exec()\n"); + assert(cpu->mirror_vcpu == TRUE); + + qemu_mutex_unlock_iothread(); + cpu_exec_start(cpu); + + do { + MemTxAttrs attrs; + + if (cpu->vcpu_dirty) { + kvm_arch_mirror_put_registers(cpu, KVM_PUT_RUNTIME_STATE); + cpu->vcpu_dirty = false; + } + + kvm_arch_pre_run(cpu, run); + if (qatomic_read(&cpu->exit_request)) { + DPRINTF("interrupt exit requested\n"); + /* + * KVM requires us to reenter the kernel after IO exits to complete + * instruction emulation. This self-signal will ensure that we + * leave ASAP again. + */ + kvm_cpu_kick_self(); + } + + /* + * Read cpu->exit_request before KVM_RUN reads run->immediate_exit. + * Matching barrier in kvm_eat_signals. + */ + smp_rmb(); + + run_ret = kvm_vcpu_ioctl(cpu, KVM_RUN, 0); + + attrs = kvm_arch_post_run(cpu, run); + + if (run_ret < 0) { + if (run_ret == -EINTR || run_ret == -EAGAIN) { + DPRINTF("io window exit\n"); + kvm_eat_signals(cpu); + ret = EXCP_INTERRUPT; + break; + } + fprintf(stderr, "error: kvm run failed %s\n", + strerror(-run_ret)); + ret = -1; + break; + } + + trace_kvm_run_exit(cpu->cpu_index, run->exit_reason); + switch (run->exit_reason) { + case KVM_EXIT_IO: + DPRINTF("handle_io\n"); + /* Called outside BQL */ + kvm_handle_io(run->io.port, attrs, + (uint8_t *)run + run->io.data_offset, + run->io.direction, + run->io.size, + run->io.count); + ret = 0; + break; + case KVM_EXIT_MMIO: + DPRINTF("handle_mmio\n"); + /* Called outside BQL */ + address_space_rw(&address_space_memory, + run->mmio.phys_addr, attrs, + run->mmio.data, + run->mmio.len, + run->mmio.is_write); + ret = 0; + break; + case KVM_EXIT_SHUTDOWN: + DPRINTF("shutdown\n"); + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + ret = EXCP_INTERRUPT; + break; + case KVM_EXIT_UNKNOWN: + fprintf(stderr, "KVM: unknown exit, hardware reason %" PRIx64 "\n", + (uint64_t)run->hw.hardware_exit_reason); + ret = -1; + break; + case KVM_EXIT_INTERNAL_ERROR: + ret = kvm_handle_internal_error(cpu, run); + break; + case KVM_EXIT_SYSTEM_EVENT: + switch (run->system_event.type) { + case KVM_SYSTEM_EVENT_SHUTDOWN: + qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); + ret = EXCP_INTERRUPT; + break; + case KVM_SYSTEM_EVENT_RESET: + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + ret = EXCP_INTERRUPT; + break; + case KVM_SYSTEM_EVENT_CRASH: + kvm_cpu_synchronize_state(cpu); + qemu_mutex_lock_iothread(); + qemu_system_guest_panicked(cpu_get_crash_info(cpu)); + qemu_mutex_unlock_iothread(); + ret = 0; + break; + default: + DPRINTF("kvm_arch_handle_exit\n"); + ret = kvm_arch_handle_exit(cpu, run); + break; + } + break; + default: + DPRINTF("kvm_arch_handle_exit\n"); + ret = kvm_arch_handle_exit(cpu, run); + break; + } + } while (ret == 0); + + cpu_exec_end(cpu); + qemu_mutex_lock_iothread(); + + if (ret < 0) { + cpu_dump_state(cpu, stderr, CPU_DUMP_CODE); + vm_stop(RUN_STATE_INTERNAL_ERROR); + } + + qatomic_set(&cpu->exit_request, 0); + return ret; +} + int kvm_ioctl(KVMState *s, int type, ...) { int ret; diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h index bf0bd1bee4..c8c7e52bcd 100644 --- a/accel/kvm/kvm-cpus.h +++ b/accel/kvm/kvm-cpus.h @@ -13,7 +13,9 @@ #include "sysemu/cpus.h" int kvm_init_vcpu(CPUState *cpu, Error **errp); +int kvm_init_mirror_vcpu(CPUState *cpu, Error **errp); int kvm_cpu_exec(CPUState *cpu); +int kvm_mirror_cpu_exec(CPUState *cpu); void kvm_destroy_vcpu(CPUState *cpu); void kvm_cpu_synchronize_post_reset(CPUState *cpu); void kvm_cpu_synchronize_post_init(CPUState *cpu); diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 6847ffcdfd..03e7b5afa0 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -352,6 +352,7 @@ int kvm_arch_get_registers(CPUState *cpu); #define KVM_PUT_FULL_STATE 3 int kvm_arch_put_registers(CPUState *cpu, int level); +int kvm_arch_mirror_put_registers(CPUState *cpu, int level); int kvm_arch_init(MachineState *ms, KVMState *s); diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index e69abe48e3..d6d52a06bc 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -4154,6 +4154,48 @@ int kvm_arch_put_registers(CPUState *cpu, int level) return 0; } +int kvm_arch_mirror_put_registers(CPUState *cpu, int level) +{ + X86CPU *x86_cpu = X86_CPU(cpu); + int ret; + + assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); + + /* must be before kvm_put_nested_state so that EFER.SVME is set */ + ret = kvm_put_sregs(x86_cpu); + if (ret < 0) { + return ret; + } + + if (level == KVM_PUT_FULL_STATE) { + /* + * We don't check for kvm_arch_set_tsc_khz() errors here, + * because TSC frequency mismatch shouldn't abort migration, + * unless the user explicitly asked for a more strict TSC + * setting (e.g. using an explicit "tsc-freq" option). + */ + kvm_arch_set_tsc_khz(cpu); + } + + ret = kvm_getput_regs(x86_cpu, 1); + if (ret < 0) { + return ret; + } + ret = kvm_put_xsave(x86_cpu); + if (ret < 0) { + return ret; + } + ret = kvm_put_xcrs(x86_cpu); + if (ret < 0) { + return ret; + } + ret = kvm_put_debugregs(x86_cpu); + if (ret < 0) { + return ret; + } + return 0; +} + int kvm_arch_get_registers(CPUState *cs) { X86CPU *cpu = X86_CPU(cs); From patchwork Mon Aug 16 13:29:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B19D9C4338F for ; Mon, 16 Aug 2021 13:32:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9264F6054F for ; Mon, 16 Aug 2021 13:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240372AbhHPNdT (ORCPT ); Mon, 16 Aug 2021 09:33:19 -0400 Received: from mail-dm6nam10on2067.outbound.protection.outlook.com ([40.107.93.67]:38848 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240692AbhHPNbP (ORCPT ); Mon, 16 Aug 2021 09:31:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KKZYJUjzjhB5Tm1CJvDOAlcDszBgKx43dhglBETbS7ScDpIBtUEP+5xhVxWOJdPcpJooswExyv1FstHDU5nsjDagq59hRbjVatrPrxpHjPb0tvlMROe5db37fn8o415c3+hkwO0YProd2pIYJh3fooP6tUZTf1CzosN/e2zxJoMROsBqGoqGPKjjcgPx240iNEbqrSs9nTejRcGMat+R4EoWKlqBy9YcnO04uuIl6ZyAAbB5JKfOiekZP6E96yfrKS7+noU/+setzY1Zbs3p0Oam+ev6nIpqplev/cYz+E85N3zbHlX6w+0wQ0zpxOY7qcswKOjMIhHkhk3RZqvmKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nMN02OwUC7b5/wEDyb6xoGxpcr39mOZrwuq92xQgBEo=; b=hEoHCxzx+dyrMVbYgjFAmtgAsJi6WTiwjGlgyaWdUsFUv3t1DOWxO9usNpzAZ8QLFfPgWVNRBDMZcaWHZ42jc3EhUSLZnzHWpf8IIwKBlsRN+f+7U8r3Q4dwJRoLMtibSIbuDud3HQVyUlyF5wg9VooZYP1aQGh54ePkElSHThisjbS460pFhJ5B54eavwe+o6+egWMtOAJGefcUuR/miMbHcKPV0n+XVBK6C/IXASBgIzF6AmqwDS27HDD6aGZoD2N9wyqErNeMlIrt0pxaDbcQbrcvEvvVBVUh5lvnVCwp1euZfM78CNYEWUcE+ZHZcnYFPwTuOjx0uYtZ4qw8lA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nMN02OwUC7b5/wEDyb6xoGxpcr39mOZrwuq92xQgBEo=; b=PqEp1IlgCZXkJd403YpHSNBt92X2CyOFryS3n+QwDvh5RPCo3DV27/K/az8iAnXeq/zbdss9qLrTgEvYrnmWzJ2AqU9eK24UrZXw67AdaEu3NxvLbzJelEqQAai7/oL24nWagtjChgXMEiGVDzq/UBWEENaFxWsitHPouaEwqQA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SA0PR12MB4512.namprd12.prod.outlook.com (2603:10b6:806:71::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:30:09 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:30:09 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 09/13] kvm: create Mirror VM and share primary VM's encryption context. Date: Mon, 16 Aug 2021 13:29:58 +0000 Message-Id: <0818aea436a5b1a0dd86535b15349137dad73308.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR05CA0011.namprd05.prod.outlook.com (2603:10b6:805:de::24) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN6PR05CA0011.namprd05.prod.outlook.com (2603:10b6:805:de::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Mon, 16 Aug 2021 13:30:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb371585-84af-49c7-b1e2-08d960b9f7dc X-MS-TrafficTypeDiagnostic: SA0PR12MB4512: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:126; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t0I5rQtk/HbbfkHuHJYrfq0xHQBd2LrVi7yDKND2uSdh//rS6scmgzK2d1cj5QHcYScijQ8KrTR522W6G9SmLwvZrNnigVbk+8xWVLZJeHyGfhqwmmdyiMJuq4n9Ke+UKktYrLD1fy3R16lKp7sBeYBHsTYpDw/1DVeT6oF7h6HDu4SzUQbPhgdRCZSIudhOsuIvqcmygOoQ+ZNBtJnxUmwsy4eQSG6vLTflbuQAnS5RvJEVxLqtHAfbCJuCK+0mQtAKoHRJxOqZLrHcqpiWpjC9BCqVZYb4W078bGlTV15JTtXlPn5tvow0GvPW6c+TFM0OeOwjnfKTdYhrIVUscNqmUsQNBB04UxzD5qI06pTsVHRJvUeDTM0TYmp89I+voukEMAcAFWtZRQeJhksAwuHkiRi0+2wttpB/+fbxgfSpUc3qw+RKVjUHKPCUMd+re/us2qRyfiqs7QEs2nEkwVgnY+enGnOHMzLHZ3ZFgc0G82nGMILsvRpRvr9yCGVEjmnyzZPc8CGx6yaXlov7QNht6mkLiEK+uiXZYII+Y10YRWwQZ9MghkJN37IUSx8iJFkZ2xRu/UpOvCACH2HQprvOqcLCv4/YiA1Bqx2cJ5U/9Hj/6d+p9pm+J5lKXi4Ry+9JdsyYgLMOnuMLbPyjBzlGyeKP4wSEQtRivOJcpZAEnOwy+Yx7gRVz24Z7q6RzQrIZH5h6IkuBAvzgpTlMRQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(396003)(39860400002)(376002)(366004)(136003)(6486002)(7696005)(478600001)(36756003)(52116002)(38350700002)(26005)(66946007)(66476007)(186003)(86362001)(316002)(38100700002)(66556008)(2616005)(7416002)(6666004)(8676002)(6916009)(4326008)(2906002)(5660300002)(8936002)(956004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fl9KVjsskxhXOPvNXBnoBnzvtkE7KOh3QvR9+NK/3jOEPklshAy3XAa3pZ90Bst+yi0auaRSyfdVS3TYsdUP9eMzryMIFHzIeCwKTgAJAOQ2Rr+ABnVlfY/4np6Ma49TY8sZFbb8SWERk6ZXyhmv1YTOmLdHf4mBvW95U4Us3raeSgd6qY3OcqVx8wdt0WOT6BAgsW13+XRC+zn2GNy3ZXwcPZ9kdIajvBwFGl5u09U/rP9Di2QsDRDzAiAGXIcn2fi7O4HulKm9Jb0GCJEPX6FbVun4IBc+mB+XC4yW+w0a/R/S9K2ykty+cXtSZcS9iV9uLDqZyTRx/z+Ap+Gw0hx3oOsO93B91o135pOC4cFOwS1gzEd78vH9k+w4mCLzzH7C7bFcxIlCKth6PaehkPrAZvu1kHUjBG5Gl9BbzJraix0MgXtL0I7chqj2xaK90hMxGEMJ0VaaNRcc7ym82cyxQUfsyPyxPTd7HSPXFCBoQobntYyJ09BPcI2Z+bK6jJqO+GKXRsM7Npx4ogTxX+5bS1yTbwLULf+p7xvY9sSOBZofEHaeuzwfwVUy2FmudDHhQsNnVICCE5vX5DRgVYq3sVe+ejt7e3iiZDbi4QIUCb5Br7mCHUMNHHzqOxONDTyXuxWqoRoAgg2JyBw4YoulY5xAQlz2IbtcQ6OL13KCZwX9VQtE4qg5tp471U8mR3M7k1azh7IyZ/sQu/i96qB99ufjWJhgxxV5BB5sx0Qcb2H8aZo8t5/2JZQ4CTwf1EEcJRUe76s+0b5UsrqbqB3JMqanWDkUcOED9JZ5zY/6pq9JjGorQMsgSdFEg5PuJYpO1f+eRI+FUcSMdDSZ3sCsay+Cn2PFStWFzWdf3/5se7SGW7b9EvoDQP3WCC2nAOAq5qD5CVySwr38y+LRG6K8NkCkjvY2LLxOQ3dAhu/yuIzewUtOZvDWScT5Vol7Ptu+F95YCwwI6QwzfyrPxHaFhmpboFcon7tlSsvzlAuPkqAMSqB3yo0kxq9OwmuspjtCTNyacYWFQE6Ix01CZosPo2dAyu9aFYTp9M8pDj3bEVFE60cZX69oQpIhKbLqHftbzxUUD0tKon+InYHT2gmx4J7rT1TdmTK6l8cke5+Eml6LBGlxU1UosCcstIVLUyj//rc+aDybrYPHo0IGwJIJAxsESFwNrXMHCY6rhObuq73Y3FGU9hrrNvm+/gOedCnypXdN4L5vCW3eXDjzSDdLuHKTTrAbkdtiSgmIf2VFhdKqt3mFVww7WoUGCmX7Z0SJzu9TYfRzZ4QZ+X4+NoMFc2m8ylZDl5sIzR6N0wQn1dhaj3ZerkZ8EIZkdqVI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb371585-84af-49c7-b1e2-08d960b9f7dc X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:30:09.4757 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 01vy6g1ffaICkNNVETAdf4yMmmzJ8gw7OTfnHgzRm9atF24c52AkOcizC/0YEZCe0B/p1MKfrhxa3uvcTrRkzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4512 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Create the Mirror VM and share the primary VM's encryption context with it using the KVM_CAP_VM_COPY_ENC_CONTEXT_FROM capability. Signed-off-by: Ashish Kalra --- accel/kvm/kvm-all.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index f14b33dde1..624d1f779e 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -369,9 +369,17 @@ static int kvm_set_user_memory_region(KVMMemoryListener *kml, KVMSlot *slot, boo if (ret < 0) { goto err; } + ret = kvm_mirror_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem); + if (ret < 0) { + goto err; + } } mem.memory_size = slot->memory_size; ret = kvm_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem); + if (ret < 0) { + goto err; + } + ret = kvm_mirror_vm_ioctl(s, KVM_SET_USER_MEMORY_REGION, &mem); slot->old_flags = mem.flags; err: trace_kvm_set_user_memory(mem.slot, mem.flags, mem.guest_phys_addr, @@ -2606,11 +2614,33 @@ static int kvm_init(MachineState *ms) kvm_state = s; + if (ms->smp.mirror_vcpus) { + do { + ret = kvm_ioctl(s, KVM_CREATE_VM, type); + } while (ret == -EINTR); + + if (ret < 0) { + fprintf(stderr, "ioctl(KVM_CREATE_VM mirror vm) failed: %d %s\n", + -ret, strerror(-ret)); + goto err; + } + s->mirror_vm_fd = ret; + } + ret = kvm_arch_init(ms, s); if (ret < 0) { goto err; } + if (s->mirror_vm_fd && + kvm_vm_check_extension(s, KVM_CAP_VM_COPY_ENC_CONTEXT_FROM)) { + ret = kvm_mirror_vm_enable_cap(s, KVM_CAP_VM_COPY_ENC_CONTEXT_FROM, + 0, s->vmfd); + if (ret < 0) { + goto err; + } + } + if (s->kernel_irqchip_split == ON_OFF_AUTO_AUTO) { s->kernel_irqchip_split = mc->default_kernel_irqchip_split ? ON_OFF_AUTO_ON : ON_OFF_AUTO_OFF; } From patchwork Mon Aug 16 13:30:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438505 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 987BFC4338F for ; Mon, 16 Aug 2021 13:32:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DA7C60E78 for ; Mon, 16 Aug 2021 13:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240897AbhHPNdX (ORCPT ); Mon, 16 Aug 2021 09:33:23 -0400 Received: from mail-sn1anam02on2088.outbound.protection.outlook.com ([40.107.96.88]:24423 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240814AbhHPNbV (ORCPT ); Mon, 16 Aug 2021 09:31:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bN0SKOCjHILsG+Jz8RS3t0DZ5KSDAu1C1sRPmnbglla9mxaDdPEVpfLnp8HF1t0IBxMXxL4Pxczmxl5AYqo4sPQzWMpOYA31GjXN7Ujhv5AF7FQiiCUeCVmkgKGxclHnSJ4p+WNEbNQBk/LX9elVlDdoK9bYDhGhRIhQ2pu+TThfvcPKt55w11Ev1u1cG0EALpSZMYFwCdKrt/tGyPnAXVvQtrrwC4BJgLCx04+ZRuqtWWp0fN0PfbnjGQtcat2Ghli3orJGLe4SnLXKybux8pLZa+tMhuCnBqPk6SvDAEQVZSv66Hm/luxQNiWPY0lB2ALB0xkqHDB3qnZ3DnNpig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6NJHWFPiiOTXqSt1X8LsG79mN4N7qjiz7VOq14pKaks=; b=F0yXCThnXO3bKz4Z0CJNI4e71bgkVujrlydRpC/unwbSywcTyT+7ck89s148edcMx1Z7MPA6Y6mP0f/xr/+6+gxl5qfQvDkTkmGFr4x1YEX5Dp+ZsolEpqaycsFqnF4Hoc4jQyZrdohAgiI/6BMbnHCvtLJS/0qdk8695gZyIRzJ19DqsfQ1p8ltpkw8p3UBoTBxAH5ZWKkmT8LWDvxNnrLuKOCYn7qTFUiahLFKNWzCVhyuC8UkRnUDnOBTHa+m37oUJokF1t2OQCcuED2n3qZX8EHTX2JBhTKcuWeJzCxiEgo7c3oeqFbg29AD/YgIAC4dFcEC/fPYpz4ebFKOTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6NJHWFPiiOTXqSt1X8LsG79mN4N7qjiz7VOq14pKaks=; b=ahcMhiB+bV3MJUjHMV49ADNZEY9hOf+6vyCHMqjXtqnlbAF4aJOjAptVMJEd+KzQzj8mz/gu8CB6S7BAkFelY2Ibxhj+k03SH4XRkw8ZN/SCkqLTR/XQWPEYBmGAkJWUdJ8pamXYgEkIbM6kidCs3Wx0FLQ5VxXxfrO4bCDm1pA= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:30:47 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:30:47 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 10/13] softmmu/cpu: Skip mirror vcpu's for pause, resume and synchronization. Date: Mon, 16 Aug 2021 13:30:36 +0000 Message-Id: <0b59d867e10238ff683c5724c71b471f4b683449.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA0PR11CA0070.namprd11.prod.outlook.com (2603:10b6:806:d2::15) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SA0PR11CA0070.namprd11.prod.outlook.com (2603:10b6:806:d2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:30:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 60703fe5-4bc5-4c12-adcf-08d960ba0e9d X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:962; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WKF+rM/8jY0GGReULcTQvcvcLcWEApH7S5Rud172VThM0/8kSqCe939gQ4FXWKxlrnp6D4tBaHNRQVCGnKE+TbSMDBzzRJe0t3NgAj0UCsTh6f8ri+zC+qhSrnZ1CibobGhrmLb1Z0mZsvYxyqd8qVLr+H/u4iUhn8msdkx+TaiadEgiQmux8SOynKechXNOLt6OtAeK5rZGHMI2FuIqhI4csfmtohd4WgDNzGa+CgeUEAk28XqRhe0+v5A/t+r+p0x3fWyP64zDF47hOIYVIzioNh7NPS55eBT4jLG1dskp5RrUdODuXnaUdL+M4oC9W5UoNsC++qyyaQDwoiIykbkGG9QuE82wpJ1stUe5r4PmB1+xPdE3S1u4OZPD246zsdZc2lZ8CrFs9EYzDYnpug4artcXoWwY1j78Tr+/xpZfYAEyW3TJ2Nf/sX3hONPIEizBkStAYxlT56/cCWV0wWIdBAiLLymb0cD20ZISqAmM3lHaXvTnsU98OVbSUm6veSxYVlQ7cVJLIhq1Wmf/Y4tQmler10G21cvnc2uiyzKyxTa8yYifxWl/mVA8b+fEiNCpVH+8+8XkzU+O+7+ZzFq12vfuy1yzuaS+8HW7a+LyhxU++7fCpQ6Gs4xUgJcLxybr8+EVUO0f9ogN+2BXYszwIYF8P4B8lLnNsAPw6S2kisJersmV32owcw7K9VjBSF/N0uK/B9eTVJmSqKV9/w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(366004)(136003)(38350700002)(38100700002)(6486002)(6916009)(478600001)(26005)(7416002)(36756003)(8936002)(8676002)(2906002)(5660300002)(86362001)(7696005)(52116002)(6666004)(66946007)(66476007)(316002)(4326008)(83380400001)(956004)(186003)(2616005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HcTwX3gv4zf5uqh/gp+5hTvimZSZ0z9KHHhnp1y5JYDpLqWWd5L7nzHPzHnCCjG3k2hkn6W19nhXJ97xG0Tvj8Zd2KiZBmsK0JGuMKJ5pO4Hs9B0JijHSlZeshjzH+a2k/+/P93OMayLoZJLQ+7isXzfZjyc1eb6I9xO3y3UfwDdnXUpeZTnwqp4jmMp6g0f8a5/Zd63FxOOD6gPM7pXB51wm4nxUT/ylfdjGF9JcoUzfH3uW/uDqdkg6OcpQCh+oYZxPWHmWrNlYFjoYwpot0xPLaOmXKcgGIh+PewrCVyN8pUMQ5/M/RlePUxeaWFIJokRxRPiNkEUvSJubliirBDKjlckMANogGyEUZtixbpnEu/gH4BZkeI9QWWBr27KItULRHnNuiAy7lVHXGHJ6HaZCqzTmutAZ1I6UKBRJ9SAfp2Vw1dvucBy62sHqToRBi7upceRFGjrwOr/2KbjrbUltDkNjEeariyyPJkeSfJBg+9PTO7Gua2uZWu5Z2RhSAFXWlfUQ51SH+CXJZ+vzUCmzThSMb2+wOswOCtGClGygB4D4Cg0hTd090IZnF4Z+OKKzjTMG8XOUUF73JPC5K8GUmDwVZHG4gNAWn4aHsGlHmUZcqj5Td6HGvooQC0dDeg/JiqgRCVUpRFtnXTNqlzbrNlChZKqZcjJ0oodTONXyIG3fNaBEZ0MHeQs0ypWbfumHq6eQVsbQUArDgCAGkZbEsPgOutIR5touZRKdn44ChyyeNCaZnIgjscztwTxKVz78g/K5djOVv5qGGi5bTZ7npJb8wLCb8GzdslNXoelBIWEPDfpNa277Yioje98v55IM5QRIYbFrIerFsj3ABAXXoAdQ8PBbLH4NDv1/eBFK3bRSYjI/frCC7OqvPo4OJKjvCaa8UiBFqPw0oLB/vPO6J/XFYY4bQcXwapM+iZij6VDmrjjg6MYZYpXhmr0f5EvgnenLduhIIwqJvOyjmvo1J9H/SsuUhJoGDMzPQzJdqEriACGjkmxaWBs7+R/HihdUIF/iNFJ8wmvYj42dAOfFmNwT2Vh+dxg6J1BDJcuFBZtUl8NY9Qs41Z67pyv1LPpeYnpEzIoCIztpmcC6n0sKxbPp3zo1PQIgPxgsbAv82t1/D7CEy00xYPkgsuTTNnFbsN+ecEChytAp0oej3nkmHk6xpkIMvpRbgeFy5+5C9rqCKcJuWLuA7kMYygyLf/IkfHB6hFneOTbOVNsCSl7Hz6xqe9CMnxO57rA+cWAEDjfKwFsNbPehBANgurzM6RfSRM/tHNqGQM/9BUCVExNYr2AwHkyLxg12jzKE1wfwcR9Um5qM2ZEsz/fHyF6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60703fe5-4bc5-4c12-adcf-08d960ba0e9d X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:30:47.6933 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MOHNv1tv0EQyVoc7JGFinVuJYWIKNumrRcen6xSrrrsky1I2YtACvwjSqaafaXuGVpHEUNoUpxKZG0NJFaBKdA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Skip mirror vcpus's for vcpu pause, resume and synchronization operations. Signed-off-by: Ashish Kalra --- softmmu/cpus.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/softmmu/cpus.c b/softmmu/cpus.c index 071085f840..caed382669 100644 --- a/softmmu/cpus.c +++ b/softmmu/cpus.c @@ -101,6 +101,9 @@ bool all_cpu_threads_idle(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } if (!cpu_thread_is_idle(cpu)) { return false; } @@ -136,6 +139,9 @@ void cpu_synchronize_all_states(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } cpu_synchronize_state(cpu); } } @@ -145,6 +151,9 @@ void cpu_synchronize_all_post_reset(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } cpu_synchronize_post_reset(cpu); } } @@ -154,6 +163,9 @@ void cpu_synchronize_all_post_init(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } cpu_synchronize_post_init(cpu); } } @@ -163,6 +175,9 @@ void cpu_synchronize_all_pre_loadvm(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } cpu_synchronize_pre_loadvm(cpu); } } @@ -531,6 +546,9 @@ static bool all_vcpus_paused(void) CPUState *cpu; CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } if (!cpu->stopped) { return false; } @@ -545,6 +563,9 @@ void pause_all_vcpus(void) qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } if (qemu_cpu_is_self(cpu)) { qemu_cpu_stop(cpu, true); } else { @@ -561,6 +582,9 @@ void pause_all_vcpus(void) while (!all_vcpus_paused()) { qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } qemu_cpu_kick(cpu); } } @@ -587,6 +611,9 @@ void resume_all_vcpus(void) qemu_clock_enable(QEMU_CLOCK_VIRTUAL, true); CPU_FOREACH(cpu) { + if (cpu->mirror_vcpu) { + continue; + } cpu_resume(cpu); } } From patchwork Mon Aug 16 13:30:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AE44C4338F for ; Mon, 16 Aug 2021 13:33:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72CFB6054F for ; Mon, 16 Aug 2021 13:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240511AbhHPNdg (ORCPT ); Mon, 16 Aug 2021 09:33:36 -0400 Received: from mail-mw2nam10on2064.outbound.protection.outlook.com ([40.107.94.64]:50304 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S240881AbhHPNbn (ORCPT ); Mon, 16 Aug 2021 09:31:43 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IXUPTjjzIP90U5ZTNpWGCJc8Dx/ySgWeU+G9hUj1rXt0bzjzX0r9Psol89nuI3w0Slw27GZh2B9VO3nUWzp8p849M4nek03I/kqbJfTZi1Z+DeIdyb1MjAaQ5LMfHGj2XyapDPBifbOZwpypD8w8ItqTluSAjQnmTDpbobUfVZSTZZnboSI4HZ880xTHMaq9SR3MOCShJoimsRtzsucQekfzX+cwVDbHs+h/H0+BqAygOVXBsepyv+Rfqqyme3s70ng55BFXnCpvRBCfBpz2fsAPddzvPKAFNeNO2vo4JHwk0TCY1XHB06a59T084ObdGZwBbia7F5eNTtm3QBkePA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e9Xy+DBwrDWhWTgV6TnjMJgWgZW5gHEWKrQEGWQ59a4=; b=F7HHDr/ROR3vXhsqoNYZ1Y2syQCKZjmzI4k9zmhDddceC+tax+fBQW3e2uWOqZc4KbV4oGXWitlBgUW1pw2ucqy26fyR9wmkACFlN/ZIxS2SorqWCpFwBYa4h7xI5uqfDRKChtPu5bmk69yRPRPM9gdOjNksqtDco+skRNSxIyZ+C6UEbYNxpyTOlE12x7Zqg+eeYD7ebiOkPQs1rD9swKLongHkn5SpfuJ1gnBZtMO6AvSsZb2KFPzh7DblnK712WGJCXyWwnyZT9/WQb8FgQ2G2x3Kk7SjSkywm12KHUQJCBiMlDeqRzslTPXvDOUmdooqgLRnl2x1jKlVbvrsQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=e9Xy+DBwrDWhWTgV6TnjMJgWgZW5gHEWKrQEGWQ59a4=; b=v4dV1m9Xlrzi3L9zeq7sE4U31ZmhAYzWdO93+47bEfml9wt9vhZJn9covqweEQUNclgwZXCRS9HnCLzwhvdCHRuEmjUzP22BNaUV/N2QmI4h41evVyjpUFVB9po9mNUGbdLn8KMI3vjlR+zWLmi91Nky98kUIjJ2b6Tc2xa0J/M= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SA0PR12MB4592.namprd12.prod.outlook.com (2603:10b6:806:9b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.18; Mon, 16 Aug 2021 13:31:06 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:31:06 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 11/13] kvm/apic: Disable in-kernel APIC support for mirror vcpu's. Date: Mon, 16 Aug 2021 13:30:54 +0000 Message-Id: <6bd4f9bd3612ad64459fb8bd0478fe02b70adbb2.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN4PR0501CA0151.namprd05.prod.outlook.com (2603:10b6:803:2c::29) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN4PR0501CA0151.namprd05.prod.outlook.com (2603:10b6:803:2c::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Mon, 16 Aug 2021 13:31:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cc2967f2-2697-4df4-13ab-08d960ba19a0 X-MS-TrafficTypeDiagnostic: SA0PR12MB4592: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:489; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: btpuqwg2xtjKbePRg2+rA6rHrnL8dd1WqW6OovjPdR3btY7lMiTHkBLj+x/8qultwBFByyfyDLqysmkh7fwUaYNI9CIWvf+w72vYF+PsK8s1pSaa5ksiw0OtqGf4idOn+6elA2fgriAIddzW7WsI5UphBC4b2hguV6UE6hPUnVPbYGsHp+b16lPWkFRc/TPwRwekXAymry93TK0wwUNi1ucPdsJdyZwUzj8A2pduhg6NYxcPfIiBW8UDR58Of/dszlSLk6Kd9y1pLwJirF6Eh/uzo2p9BjmdvFRQX7e75gfD8zqXleMC91PjPNUlxqP8wW7Rk2wDvObLvMUKn27fFJeXO+yzKRgMfdsnkhvJMACG7P2l0Obs2K8QDEuj6fI0qJ0AQKCaIJdv5bhY6z7ySQVrPcqBfmujcFjy7g+yR5hquqfoa2IZBEe73wpBcC9a5N/fK17eqQnO5iZGSrpw1qTD3cwEpzNTABymjIVp6FlozNWnFsZQEhuM+VSe/ahIX9oXyZYiVDSEBFq3eE0Rq1c52tO3TeUG3Uq4UqRgcc5ib2pQFwbmauC807Rxfq6gag0c+MfUH0k9sLgOiBL7/ImiyJ1bEGWwvJq+qQZ4CUxlartxRwCdb54lPLSeiXFoYhXQ+1aOvWK8hZDCiY42kImMLXtqLSzlEJ9LT0YSKcGDZ1B+Pmmhp+Z9BkdW3z9u3oG+hJzjR5wB7wLpUAWMHw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(396003)(136003)(346002)(376002)(38350700002)(38100700002)(8936002)(5660300002)(2906002)(66946007)(6486002)(52116002)(66556008)(6916009)(186003)(2616005)(478600001)(26005)(66476007)(86362001)(956004)(7416002)(8676002)(4326008)(36756003)(7696005)(6666004)(316002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ItTOAxgYL/4PKzjt0jNs4JlQcZZkjNlOCo6N6T4Kzw4r8a/PM9uJUEByfaNgVp0fln0/do049+S3gDIDNAqZEM8S5nBlGO7U6fXHMJCIcSIabakD7NTy01ySyGJ9rMwlrCBjoXsOFFp4lrkyQG1rwdq9K9iL5iWKx0b1ttlfeqgmcjZUwjtANnQUHgasF3oz2Ybx9Le711s9PyrY9c9FqzRoH3YqOopL4ISDzKdVgXb0ZeePY14iuA2QHvNPayKj/AnAEBgATMTiiwZRkPyo79iV4ZLQeBwDIoFo3PF3eFlHVuA7j5lHOt8YTRfTTgHU2L2rxKZdZkoA/88l468HC4zKlXT319pOdB3xX+ewP05XduAJ7dC04+0nY6UhdSdhEHQobNRwkptJm+s/A2Dqb99z3z2kjZJjYkUzsrBoZk8X6vTuEcTOapUV37AZSN1jZDoIp+WAg0iRnR76AGe9JX0fuKH0scm2+HFeW2sV5Jz7NOZHJ1uDZLiWMYoJE53KteypOdayMQjw1X4yLjKjwyB9Bwi+UWpPzgkUNsHwa9TlJt5joA2PeZkYq3Nw7AGNod3DHV7mkAwRvYhW1llRdgsjXv2znhwPVbQ5q6AYDYczFM5FNE23pdV9vn9dmpElC+twslaHbjRNnD8r7VeG63GO6ETS7SqjynmF5/JrXVvohnpjDnqQPKc//+VGMgQgkATxhB/4J5tYija6HOyl3GFy9Y5fTNI1uA2clf8RG+VkZg0q4OZmtRpDnOvPP3q+rXJYHAt1rVe00XzDZCR6Z+IAkHWp5ScSiHSEoth+dSRaaP+HVkoJ5+2pwxHz1PAOwQ5O0VpXz4yczEBLtiY5HuF4+AI8K8OMyRuwbBLBRlIeFV3y0zpDTgWWcEfy4mVrzjG63BkrEuU2p7umQznViRskp8BcMpTksx7KPl97/w63Fd1hv0s7D4MeT6FYwxr9MQuijAetTN+XuiHAceHcNtZ6gZJFUehXFGoUM0spGbqV/4ECI2Lf24pS8n6AWfzINnkms2eRMuLODkb6BEC/M1wl1vvCxeNXEpJ6RnsYTPjE+ANPGEXZrPAJJVH85vZwPlKigauxj0bwCAOzSajKVnH5128zxOU4Hggq8XZ7aoyEOhCrO7PvxntFHkjmLhJVZn2xlYpRx63qM+vnDuL6sfp2zvKJWbsREIkWriEUF5pE84LtHxyenQzzHpliU5vSL05bc5GlAUgqkbtKeXYIdxzi+vn9EJOpMpKAG/TE9fgG59+ujNq2NDvMp9N5rcyaHxV+yj126X7OgD0d61jM3chiyAXgbkwlos4IPlYzXIiqQI6Wui3oBbWJS7TDPRFP X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc2967f2-2697-4df4-13ab-08d960ba19a0 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:31:06.1599 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EYaXFTqKWXAVeyw44XYZbHYCjezOT5L6uiyXCTpVAIxC5KnErsID/VCtHXAU49RXYvwe48lTrKKlP2Qd9HK6mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4592 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Mirror VM does not support any interrupt controller and this requires disabling the in-kernel APIC support on mirror vcpu's. Signed-off-by: Ashish Kalra --- hw/i386/kvm/apic.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c index 1e89ca0899..902fe49fc7 100644 --- a/hw/i386/kvm/apic.c +++ b/hw/i386/kvm/apic.c @@ -125,6 +125,11 @@ static void kvm_apic_vapic_base_update(APICCommonState *s) .vapic_addr = s->vapic_paddr, }; int ret; + CPUState *cpu = CPU(s->cpu); + + if (cpu->mirror_vcpu) { + return; + } ret = kvm_vcpu_ioctl(CPU(s->cpu), KVM_SET_VAPIC_ADDR, &vapid_addr); if (ret < 0) { @@ -139,6 +144,11 @@ static void kvm_apic_put(CPUState *cs, run_on_cpu_data data) APICCommonState *s = data.host_ptr; struct kvm_lapic_state kapic; int ret; + CPUState *cpu = CPU(s->cpu); + + if (cpu->mirror_vcpu) { + return; + } kvm_put_apicbase(s->cpu, s->apicbase); kvm_put_apic_state(s, &kapic); @@ -227,6 +237,11 @@ static void kvm_apic_reset(APICCommonState *s) static void kvm_apic_realize(DeviceState *dev, Error **errp) { APICCommonState *s = APIC_COMMON(dev); + CPUState *cpu = CPU(s->cpu); + + if (cpu->mirror_vcpu) { + return; + } memory_region_init_io(&s->io_memory, OBJECT(s), &kvm_apic_io_ops, s, "kvm-apic-msi", APIC_SPACE_SIZE); From patchwork Mon Aug 16 13:31:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4F63C432BE for ; Mon, 16 Aug 2021 13:34:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B711C60F46 for ; Mon, 16 Aug 2021 13:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238358AbhHPNfF (ORCPT ); Mon, 16 Aug 2021 09:35:05 -0400 Received: from mail-sn1anam02on2052.outbound.protection.outlook.com ([40.107.96.52]:36975 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241244AbhHPNch (ORCPT ); Mon, 16 Aug 2021 09:32:37 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DKJAqkHUK9i2rN0jj8OFTlO7MH0seoUfmZ4+jSPKxSld533Melk5nxWyN0CZKh3fM06ZyE6iG4meGe1j6/YUC2+vTSr0nZoQUK64Vlm64UOG/TSEkRvTlrs+WYqDLG3TwbmwJjy964szl27C8aca/3GZyuBPvT7OPglX8B0qNLd1YYJfU/MXbNEYt2HybJwoIoGgr22c3w+t1HLJeEISaS6SVgGUszhNeKvmxOGDD3MmhAm733QE9D+QVwjZ9pjdemcZXbdmmUan3ZIKqLXNPBPYkhjD1YQxNxpjwxTO9B5RQI8sSbfhOVRt3Sw9Gf/PkruTB4+xFf04WedlkdTtqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+xFMMs7EhKJGclsHESr1BTV0iV+z2FpocNYFaFpdGdY=; b=MCBdld4QYMcJ5yDX+8TbCbdQHCSRl9WZIIVBS/xj0zgCO931rgeJVUCWPh/qD3JHxrkqDqY1Ax6Vj9F6bbM0uZxq9c4xt/QwBUAuFpPPNtx1IxJjto/C/DIT8gmlNm5FqqVWM8jvu1+d1QPMby6aRXalgsxOkL18AOsF0sPHsi2BHYIq9QtkNyuJyJMQnOyrI33bApt9ae1MWDlVHF2jNjAYoCUqt9r1ifDSXjknRzi+PmsRxgnBWxcDi0BP50ffEao2INfQ6F7sykgy8HKRUjGx6ZlNxw378va96QZJ8EUh8FIFxFKAbB8e0lHbAGgkRaGG4MRIOKxp8WH8lXUAJQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+xFMMs7EhKJGclsHESr1BTV0iV+z2FpocNYFaFpdGdY=; b=jllUpix2OIeYwerIG7Bx2ZIlxMBFiifDBha9QybzuCIFb4NFC7nxeLFJEZZrqC7ES602FT5iITwtNouPE6s5RQgb683GhVtbKsY6c/X4yC9rczRR3YPkaU9Zdzmb2EghpOyg2ny7eBTC3K5wvzYULODeaprWA8LstZxbqcy3OFw= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SA0PR12MB4495.namprd12.prod.outlook.com (2603:10b6:806:70::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:31:27 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:31:27 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 12/13] hw/acpi: disable modern CPU hotplug interface for mirror vcpu's Date: Mon, 16 Aug 2021 13:31:15 +0000 Message-Id: <0044c129b82676f619484c2ff65cf6f127bbc99a.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN2PR01CA0039.prod.exchangelabs.com (2603:10b6:804:2::49) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SN2PR01CA0039.prod.exchangelabs.com (2603:10b6:804:2::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.16 via Frontend Transport; Mon, 16 Aug 2021 13:31:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1bec4ac-9616-4aed-c3a3-08d960ba2661 X-MS-TrafficTypeDiagnostic: SA0PR12MB4495: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rDptCcn2dvD5yKPyc9fVXVWYM3JXUz7oYAP4PsGxD0xhia1x0xtZvDyETqWP46zn3plb3e4emWVGQ4s/2d1SkmvbGOKo58tD2GD29CIhHmPPp3CZQj5Lvv1fUZJgLlI4IGAL9ONv78a/cGc2z0xzzWAemInUREi5+NRwNJE04PF9XV6B+T83sHYvoWWCRRBC46VOkm3u+zUY0QEEBOJSIqd3fd9exGT8A/u5RfhjnFUJvaXbgiWm+1O2m/80LCltEAHgRCSsib6Wwgar8Wh91vce7BoDwMCYfuVmKO77Cr4kqzriVnjfqcihr0Xh7uYywLOcCrYEYFWH2xSaID3GOwIuh5psyCzkjRh9+/0ZDHRGLWcV5+f/RaebydDlcCDc4LTeL2A6tG6IBxOHd5b5WmtFAWICztOEWj8N845giIUpStj6PgY8OVnaTt36f+jvfbtHFV0obtKoMYocSWSabHMC2WmtbOyTcEVuwGD9tsrLimibQfjL2kPMNjOnaUeH+dzbAq8lR4Jdp8mh7opnOdJn2IumgzuCyidg6yzMfqrgL9p7+UXUeZeQSfg+rruzjk6taILEkeilXq0XxnUuotOKfolPlYhUjXikfYyn4ZcMBMxM7wsyXaDI8NBJjl/qzxI85oL4bCYtQ+uX3r7OS0+RV00WcimAvmQpiw70E1u5JzRuT/zlCYxLqMGuK21z X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(396003)(346002)(366004)(136003)(38350700002)(38100700002)(6486002)(6916009)(478600001)(26005)(7416002)(36756003)(8936002)(8676002)(2906002)(5660300002)(86362001)(7696005)(52116002)(6666004)(66946007)(66476007)(316002)(4326008)(83380400001)(956004)(186003)(2616005)(66556008);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zp0kskwOwzqybvAlhl4CQsTKc8N99JklU3cdB4lWThuYtQ61/2mdzpaZ3KMXkrS/Ua5SiiwFg1jYsU5vjqlmeYklO7RqWFinqp6wfM0KGKVbuNK51P7ITnHPWDVgrUSA18oXjX9Ac7pcitA1nyuY/Dl5bt2DEZ6cTMLZehZ3nrcr3Dp4FUpeVIapApgW7OdhYgMYSD2Q9Q7hllWU2RHVK6ypwAN8LGHcATygiEv2NXSevN3rr46Klu4hGlW9ZQgKkjdnIy9GoNuBqLqAQGfQzGKNuSvv/dWfWb5+CnZ/XZ6NYer8FsyA8E6fSlwCS6VA+Vch52qodBdUrrXlHboDLWe2JFF61jB4ZocK+ilnofF+DaJA/3andMKucOdnEWlOzmy3hzeHljOcP7HdpmUMeH4r05XBobhY8dI37zFuJEWhfCUvP+zIA0Gd4azyGj4XK0PP28YSo7KV9XNAgSrfOMAstxL7Z4Z4m+uCLIgMJNfru/cLSMkaybSlfTJmV6u1bld5xrX+ow69Aqn0Yn4nR9QwSIzEwdKdNzst4997DGUOtCNnxUNFXDS4Fw9tbRljzCEGLyV/rLcvMT8T/8l8SGT8JTz6svdmM15RUVDmOtRF0muUmdzfu0JdG4UKyHvkeVyr8fraNZ8aNVjAc75f7Efmcv6ir2Tt2ev8aawl97G674nex8nMDNCcHUaPRjVfRiqJVwFvhKx21Lh2fsKv0wX+rC518mars87U3k8hbnF8/7Tg2zDUmPVJnJaTvluZNkmcYyM57qkKVKgyghtTjkw61I7VR/098z3fNoC0mszWC0ePV9wVLn2b8cu6Em+TM+bXKBbUWSafbjfCpUqQWARgYbC/TjkEkknEY0euPrT9B6xfoPqukdBFX1LDfc1p0V63lDi93cGAEKdI9MMLRDGAFfwuyiBEZ8ADIUHZ3a5E9cb5tisXVYRTMiv27nMdok5P6/lP4saM5wY1Fh9gMgSuEIQa6BQggyj/l/l26jepxOVvsi33yXILiJZ6L6015sKmR54wrpDJRlOrHi20Oh8Webkw0Dt+QCG/y0tzl+0IkVOvsTaQVdjspqIBX1VFngQNiwA2GDrNM1KXZfm7s0u1TSzetlE8q9W1Rt9TvDL/Ksdjqzd1hIwxaA3gatJdw2HDsO2+2lIlE3DrFVyYgJ1rM4Lb4P01FQ1AjxTVZdtc7U/aLM48DEYL16m5xGxFYXrHW+0fy3y+rcQ+Yku9A9Immg3hJbNTxrYBnOpe9Lym2O0mCYDzwVlY1HYjG8YF8ZGL0A/9RmrZzq85GPxMp4MaDQ9c7htHRlz6bJ3rCSBbrZLe+8R8D8aqJ3ysQ1Um X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1bec4ac-9616-4aed-c3a3-08d960ba2661 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:31:27.5909 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T/ODy6XAzRHp95l64Cv+OS6kmfKwkRWKu3UjmmP0Jc1bRdqJIU1yuE3nrgY2tZZxn9the8ViKheQFtlVxmfLCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4495 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra OVMF expects both fw_cfg and the modern CPU hotplug interface to return the same boot CPU count. We reduce the fw_cfg boot cpu count with number of mirror vcpus's. This fails the OVMF sanity check as fw_cfg boot cpu count and modern CPU hotplug interface boot count don't match, hence disable the modern CPU hotplug interface. Signed-off-by: Ashish Kalra --- hw/acpi/cpu.c | 11 ++++++++++- include/hw/acpi/cpu.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 8ac2fd018e..6cfaf2b450 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -86,7 +86,12 @@ static uint64_t cpu_hotplug_rd(void *opaque, hwaddr addr, unsigned size) case ACPI_CPU_CMD_DATA2_OFFSET_R: switch (cpu_st->command) { case CPHP_GET_NEXT_CPU_WITH_EVENT_CMD: - val = 0; + /* Disabling modern CPUHP interface for mirror vCPU support */ + if (!cpu_st->mirror_vcpu_enabled) { + val = 0; + } else { + val = -1ULL; + } break; case CPHP_GET_CPU_ID_CMD: val = cdev->arch_id >> 32; @@ -226,6 +231,10 @@ void cpu_hotplug_hw_init(MemoryRegion *as, Object *owner, state->dev_count = id_list->len; state->devs = g_new0(typeof(*state->devs), state->dev_count); for (i = 0; i < id_list->len; i++) { + /* Disabling modern CPUHP interface for mirror vCPU support */ + if (id_list->cpus[i].mirror_vcpu) { + state->mirror_vcpu_enabled = TRUE; + } state->devs[i].cpu = CPU(id_list->cpus[i].cpu); state->devs[i].arch_id = id_list->cpus[i].arch_id; } diff --git a/include/hw/acpi/cpu.h b/include/hw/acpi/cpu.h index 999caaf510..e7949e86b8 100644 --- a/include/hw/acpi/cpu.h +++ b/include/hw/acpi/cpu.h @@ -33,6 +33,7 @@ typedef struct CPUHotplugState { uint8_t command; uint32_t dev_count; AcpiCpuStatus *devs; + bool mirror_vcpu_enabled; } CPUHotplugState; void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev, From patchwork Mon Aug 16 13:31:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalra, Ashish" X-Patchwork-Id: 12438509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1478CC4338F for ; Mon, 16 Aug 2021 13:34:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC3566054F for ; Mon, 16 Aug 2021 13:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237516AbhHPNfB (ORCPT ); Mon, 16 Aug 2021 09:35:01 -0400 Received: from mail-mw2nam10on2066.outbound.protection.outlook.com ([40.107.94.66]:3808 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241086AbhHPNcT (ORCPT ); Mon, 16 Aug 2021 09:32:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SuXH8od1pOgiymtiI3pjErtdIKG31cRiqvGJW2PrFPaTE1Bubt6buNJ30Ii/+vVAX9pzT3s549LISivxyF5NRxYVerZZNPkJ73gwFobehH0RoNKUhMX4v+gMwyF1OXlK3vBnhC6kkl1hczV4hVgYsL2raSazWYSWVEflQP7PbhFQK6KiCBLzmf4G6KbkOVrNzLMqOf2t6+37Jcco7xrI2ULKOXEmjufg5iPgd04iU1DHiQ4sv5s5pwIzXljhD8JBVUUMzeXZDlp5SsqFnoZ5c5lrJh3kIWtiRSsm3iG//OuBKh0DAKjejfGKMO4dqO3okC/LDB112Clx1Pus9+0J8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RK+qRyEn6iUurdQAGxrLOEHAJfm/8fA9IlCEhpWCoWY=; b=Vrb/XqDyiaKGWg7gTRS4Wash91QB41CGn2e3jBSdy0I7kQP1sYzTTomuxi85TypyffF3T+nt4U4URJ7mv/cjVHkHnVPnaHT6F/jhVSWymjJwZymbrof3Q3bmzrbBZSkZFqd5s+JOV3pkNEoI+AfM3StufTfXbd3UTzcklOZ4ZfhzBH4U1kaSR5DhOL8Oexxbfw/yRDqiK7CUEyOT2aybFaj0Pf6bD42K2gjO/K3p4dSw/0d8uyH1ux4HVyiCwwH0/E2RzpnOU5sQEiSQSFPlVv+L2VsiG8n2cAsJGZd9LP1xAoxXY7iP0PW86yB3ez1vZBSv6W4UpF2L217fnCUoIA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RK+qRyEn6iUurdQAGxrLOEHAJfm/8fA9IlCEhpWCoWY=; b=yW6hc7dq11sIIjF84Kpf+FuWkAaPIm7kRyWlrofhnZRCm+2DDV5mt0RjFay8H+17B3MftJSbJh2Y50MU6As8GS/jLddow0C/9TR4A7nXsWWn6rtQ6ntvufAkTgbBm85D08CRs+cv+PlaHKCuozonXtgtK6tomgxnXFgMdAkDcLs= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by SN6PR12MB4750.namprd12.prod.outlook.com (2603:10b6:805:e3::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.17; Mon, 16 Aug 2021 13:31:46 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::491e:2642:bae2:8b73%7]) with mapi id 15.20.4415.023; Mon, 16 Aug 2021 13:31:46 +0000 From: Ashish Kalra To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, thomas.lendacky@amd.com, brijesh.singh@amd.com, ehabkost@redhat.com, mst@redhat.com, richard.henderson@linaro.org, jejb@linux.ibm.com, tobin@ibm.com, dovmurik@linux.vnet.ibm.com, frankeh@us.ibm.com, dgilbert@redhat.com, kvm@vger.kernel.org Subject: [RFC PATCH 13/13] hw/i386/pc: reduce fw_cfg boot cpu count taking into account mirror vcpu's. Date: Mon, 16 Aug 2021 13:31:35 +0000 Message-Id: <1f48e6e54cac6b06b9c88d328e983fc0199ea109.1629118207.git.ashish.kalra@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SA9PR13CA0036.namprd13.prod.outlook.com (2603:10b6:806:22::11) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from ashkalra_ubuntu_server.amd.com (165.204.77.1) by SA9PR13CA0036.namprd13.prod.outlook.com (2603:10b6:806:22::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.9 via Frontend Transport; Mon, 16 Aug 2021 13:31:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 366700f9-2870-470d-945c-08d960ba317a X-MS-TrafficTypeDiagnostic: SN6PR12MB4750: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:296; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BgBjq+E0MsU9JmcXzXS0GjDs4gXIpR3aLizxOxlQnjKoMyIXykHeVQuelQ7lk7y7BJ8EN+Mn0BWmSINRBm3oi730aUgXTvdehKyM3wSBUk9nFbIaEJArqDc96Mv04HBVzb2z6ZPQ6oh+kvhAmJ7nWrjlclYUKEUwPY9ZW8AufeJlHs737SBwPPVzCpqK/bBUThGA9H8MOE3Lj6YQP4iDKfTFVBHqR5EyGdHSfNIAzEJgvKllYAY9C7viGzCA37XBPvM03luxRXrKVzKqs27kU+iakJrbJy5ps5CZTmQtt3ce+ui41gbF7NTTJITZKm2I063ixHe9Ix4D8m9EOD5s0rA2+H0+9s7kuTPqEbzJRwY2eA593GNrhFfgMEmqXggerIzkJs7m338rtxvpOT4KEdazF5R3U6OaQ7uqGK/AHp7dCEg+uzy53xcMmqP762lNAt4wKZ5xeDumnbz4n8a8mZY9yohn7p0xAqnEAt6Okxcy8Ni4G7M26w77I3lfoJPc7k6A/3e/dZnZ+L+ws2SsycAwbSInEqDAMHnguJOKYc1h5UCCXy/vqvLT/38hz9DWm3bmP9vOw5GCMON6Fd4ICrCPgdbYoe32fBOm9FrFo/aFESeMEE9PKWnys/Dr1yTTLoOsEF+DRjF+rBTtzxh6hnaHqzz0SkaDpnqiSDp0tUUTwBNuvkEpfIAzyveyUkKpC+osy1oMpj6zfXJeGz9KuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(376002)(366004)(39860400002)(136003)(396003)(346002)(8676002)(52116002)(7696005)(83380400001)(8936002)(4326008)(26005)(186003)(478600001)(956004)(2616005)(86362001)(6916009)(7416002)(6486002)(66556008)(66476007)(2906002)(4744005)(15650500001)(316002)(5660300002)(38100700002)(38350700002)(36756003)(6666004)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e89qR/2z9aZPW+Ctx65esh2NSIoYuHxLQDA55XtMkhCyNScaSSvOlgRQ2ylcau2lkknvL8HSxwP/XWG+YxxMgbnaSYkSIJ5EmRMHf9lvKnva60CdwKTxnk4E2kERyNHPUZdpAtEgLlGYklGNbdIzFRUhGqtQ69uKPP2hf2DFy70wAF+2/eAuWYTk9op18sM4pGCNbhXdE+Dw+HXdSuvtpS9EJtDN5WoJxrm3sD0LmZ2kLdY5FTSC13EyTW4t9wUlIjx38fP0K/EtC4IxnEvkBel991RT1MqCO9SjPGMjXcECAFPAiLHr53C8UZeTVPXHfoSk1+R91ttcqawV0GLTZf/biT435MSBoUaloh5dLJirZYehtvzca1iFYFu+no60tERik1EZwS0ObnaEFKTx2ndJy1ukybRGMLIYvRkvYoGnFJ/aGM9cRxXcit3WPwX4/N5vUF4bSBFbz564gcFHA+gepEsnImTLZTWe72TtXPNMiUmyt0m4qb4vGTZFP3KRMl6RImv5nlbvHFCzpzEZukOuUtlCbub5cE6/w9aZmm7gQqGEEwkbmI/Cj/+vmLIqCw9YlLr5s3KD1vbios8ZQGMFHojRzdNsRRDqqTKE6LchVAS81lNk56hOjPjNxbfX465/B47KEepUARBSKsA84MNzBYfJcFLdLoBeT/MZxgd3js7LjfbR7jqfk9z87B2wz8a/V/pvK5hallohcMOdMxJHNt24RiqYmwJTdq+GrXJ7LwXxsdKt6NOSQyNdA45LcC+iiJVOXfAvFz+Cb4NTvtdENYUFh9fjLg7C2kvpbUnCAT8vOKxdnS60ID3HNlbZxY9jZyooW30d3AUGTqEctyBLr2EykaQVwfINxr1VphNFv78v+UT95INt3cWgeZ9ifaUjX2TJUorVyetU01cuUvAa1Y5GejnUuwInfWf/tyVTYLybHBX5orF3MV11y0++KVxcKBs8/K1UcdchWfG3HzYUrRcN0B+w4ONxjAByZex/IrMeLiDpOR94U1RdhkvRyJqN+QKFuIfyvz4tU5YALgHWy6MD30064XvdgmOiNqVx0WbEDwQLNMJYg545AHzdbLZTiJsUqYNVApd5jefSwLx5Dl5B6+VCfVjbZ3/aKEgGIOUhM5qgyxx+i9LoPcaPSagCcsfM2W/BMBpAD7iJW0JI5owY7Yn93gzK//c3RJTHJKZG2HGTXI0/kCdjrgjWwWcz3Ahe2nUDRy8RsuFIpq9BsMseO3Koy3G6gQWgRk1XXln1D9bKWWt0eU6/a62iORk/uNfwQPWAaeTZ4QA8tyR47grWfg/vh73w1vXi8u+8WSLh+GbEgffzaF6OPUQJ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 366700f9-2870-470d-945c-08d960ba317a X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Aug 2021 13:31:46.1965 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3TdTHo0ohoV2DKV8mpXs2EHFCVM9qQXoI1o4Hiq0XNAbFboI6WDJcWfGZqy3Onlqo6GL2XPfQyUW6TgQoUHmIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4750 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Ashish Kalra Signed-off-by: Ashish Kalra --- hw/i386/pc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3856a47390..2c353becb7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -962,6 +962,9 @@ void pc_memory_init(PCMachineState *pcms, option_rom_mr, 1); + /* Reduce x86 boot cpu count taking into account mirror vcpus */ + x86ms->boot_cpus -= machine->smp.mirror_vcpus; + fw_cfg = fw_cfg_arch_create(machine, x86ms->boot_cpus, x86ms->apic_id_limit);