From nobody Thu Oct 30 23:06:14 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1760351242; cv=pass; d=zohomail.com; s=zohoarc; b=O+eUXu6fpwtHeBgdlqF/z2MT2hEqeNdnImfnHPl7IGChBEZiDHDARJ4Bb1Nd5jbXQIpLZG3pDCa6bzfUqqRsEKc2QHc7SQ8IJNu8+aWNBqx84krWTae8ggs3jCLYjDRGDWhfUoCb7EqeAuHFvIAbETekpFs7rnk0o7ydTgNBxL4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760351242; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9e+sPcq234P3COkqJfCRUTWhHt5xA+0WRfwnjxSR66M=; b=iCTcd0+jdWrJ3i4vQIvVbkv0O8RUvOmVO3Xj2HCaz450RwrOJ9LK92V+HN3tDoTc6TyjtOo9pVoxC8mclgvMTQnPhJhbA1cRoIzt0Ld/pPxc3fvYfLVdlgrB21/41tiCnBXrt0HsI9yMwNV/GRgMQD8Hz6bJ8/0TQHLdjzL6b/8= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1760351242925524.5025734971858; Mon, 13 Oct 2025 03:27:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1142049.1476313 (Exim 4.92) (envelope-from ) id 1v8Fll-0007n6-5U; Mon, 13 Oct 2025 10:27:09 +0000 Received: by outflank-mailman (output) from mailman id 1142049.1476313; Mon, 13 Oct 2025 10:27:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v8Flk-0007mE-Uq; Mon, 13 Oct 2025 10:27:08 +0000 Received: by outflank-mailman (input) for mailman id 1142049; Mon, 13 Oct 2025 10:27:08 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1v8Fcg-0004Rd-1Q for xen-devel@lists.xenproject.org; Mon, 13 Oct 2025 10:17:46 +0000 Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazlp170120001.outbound.protection.outlook.com [2a01:111:f403:c10d::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id db207036-a81d-11f0-980a-7dc792cee155; Mon, 13 Oct 2025 12:17:44 +0200 (CEST) Received: from BLAPR05CA0044.namprd05.prod.outlook.com (2603:10b6:208:335::27) by SJ1PR12MB6265.namprd12.prod.outlook.com (2603:10b6:a03:458::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9203.12; Mon, 13 Oct 2025 10:17:39 +0000 Received: from BN2PEPF000055DC.namprd21.prod.outlook.com (2603:10b6:208:335:cafe::b) by BLAPR05CA0044.outlook.office365.com (2603:10b6:208:335::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9228.9 via Frontend Transport; Mon, 13 Oct 2025 10:17:39 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by BN2PEPF000055DC.mail.protection.outlook.com (10.167.245.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9253.0 via Frontend Transport; Mon, 13 Oct 2025 10:17:39 +0000 Received: from penny-System-Product-Name.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Mon, 13 Oct 2025 03:17:36 -0700 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: db207036-a81d-11f0-980a-7dc792cee155 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p1Z6kGRAtrwLzuDfy/5mih1goNEAYHVMTGmf/WkUK7j3alDgoqSp8SlrrNxfvpwmsZP2LHIDs8JMRgiZTPxvL6IZKuHdj7MLKhgc6hwYMkwZi27/TNzvcYs2679zXB37KFjmE1pjFAHPFhyOSXyDEQ2QQrb7CrioFksu6Z05FWO/dsloyhLhLMYafk0TbgP2PPAkDofAqVGMqZIZUa1Os4T3zCkAj7yHQHJZvUbhqJB5hC9lon5yYBWwczLzTIUjY/024fuEOtuFZmyTO3bpAek0xce8PAlDaSS0z6Z7bu9tTqjE5kqg4ivdRnvT8fHnJ8KMNuFTX1afAaRyDGRTGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9e+sPcq234P3COkqJfCRUTWhHt5xA+0WRfwnjxSR66M=; b=RiPxDQktdhCdSTFAqtLPSy3oJZ0FzdYGIVLTgfOsD63cI6pEtkLluXzkD1YMAsHTq1YGZRAGrWZWQRbCi6WNVqAJ1Sx7/zBKY6keXOMtOkbjE/mOSK+/FRTPT7A4VzQM7d/W9COpKd4qHBGLywbBSEC0wnnA5RpdASc48WVIeFdJ5sbG9U2okqbzNV3uymnk6hmO5ToyAb7105H9au5orlHdnk+R+qCoG5zaR503i1qU/XO84b0DB2EXxRF9Mq8CPT/NnyGPed95AP5HZX8Sw0UlsnqLiFeUFQzVcg7dX8bJNsqMlSpegMjc9+F3KIH25IrU7bkCbauSXelAhy3Elw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=9e+sPcq234P3COkqJfCRUTWhHt5xA+0WRfwnjxSR66M=; b=HLY9DG56ZE5L5UYr6Wr84J2R2HI5i+kEEfRQAFyh1tH850B39Xqh0gGXyb7P39CmmW7Wqu0cLPVztKlabj2+Phjgnr6+KrGNxp1n/b8uVE7yEE/bs09d5eLxY42zM5S+nPLVQSKHp5eqYUyn224dAiv+10ZjBUvUyFIw1XqREFc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C From: Penny Zheng To: CC: , , Penny Zheng , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v3 25/28] xen/domctl: avoid unreachable codes when both MGMT_HYPERCALLS and MEM_SHARING unset Date: Mon, 13 Oct 2025 18:15:37 +0800 Message-ID: <20251013101540.3502842-26-Penny.Zheng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251013101540.3502842-1-Penny.Zheng@amd.com> References: <20251013101540.3502842-1-Penny.Zheng@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000055DC:EE_|SJ1PR12MB6265:EE_ X-MS-Office365-Filtering-Correlation-Id: b5603d38-9ff9-435b-a0d7-08de0a41bcd5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?pejuA80FjutagzWwrxZnYSVEnQcBHVUnffS2Y0EgHwzPRKKKnJDKljpO9zHy?= =?us-ascii?Q?p/AvIyFgH3ipm0LkhuVm05ka6ZqTUeqaMyyAvbH5GOcau7dTI6Hwp77DJ68I?= =?us-ascii?Q?J1pD8/9gDha27YdTihbHuGUgBwQ9JuZ03ygoJztGbJ8v1L8ozKDsMqknIySc?= =?us-ascii?Q?KJDfycdF6Y6fubxMizLgjxL28CSRE6vwFSePTkFQAeau01vm+85bQdAgna/8?= =?us-ascii?Q?w3ZDxQLiecguO2nIOJfCtijZRjpc5zPFYrGcSkUQTCgQ2KLNDAS19A8GCdYq?= =?us-ascii?Q?ZZlUy9ODWeu/l6F8uriWWX/U9338DscNbzA/oeqrSJDo2BKqZNkEfs/RjAvG?= =?us-ascii?Q?+JCWb10qtuP4IR90nnYiuJzQ6GHyzIbhW3JdzXziu8ewiP/roaatXYncGSsZ?= =?us-ascii?Q?EHVdutX+MaFnKaAgAqwMeT7irlvdeAKT8x8x/Ce4z6961Vx3O9zfB8o36KJD?= =?us-ascii?Q?mPxhaddM2vpvInoiw7HpLK1CvPzf5rToiwZlXKWaiWz2DzXJ1xEW/0cMPVEG?= =?us-ascii?Q?/OwOLPVwdee5T1v6wgI/IzV2Qm2BH1sQ+zpymLQTVM19ZbjojOWEUvj9BeW6?= =?us-ascii?Q?Yqg8KRwws37f4emrVeuGB9R3CysokqIq6iBxJ744Zlyp3lOaw37x25v+1lbN?= =?us-ascii?Q?4/ZjYdiD9qxWVCPB1RQpMMBTiA0ePRWdP9zksoIMf3yjTI7yCUyWKk9XQt+d?= =?us-ascii?Q?z7wzMY/UkbSJt+Ryth2dHJceRrADc6fLrcslrdnnPIsGcK5T4B6U2QHTkhyT?= =?us-ascii?Q?WzmQ4y1WdErcIXhKtePK0d90UiDz6YOKGcmNbECHIwe0sePJo2tQNm+eLEGe?= =?us-ascii?Q?4rt9SCbJwk1n5m+mJj2CZjqfmBvR3FCNTBMH2eSYagi/zMzJnlRYkySHzItd?= =?us-ascii?Q?Bo9f3Hvw/gKa9WnKXjJ31ymJGb1PO/GfMsaagDnKyVlunfhiABe3rNaGvamS?= =?us-ascii?Q?pDdfdICEZkaDjchrA4qZTUeAZ/iXbXAWC0LX/050yqkB1+IN1z01pc14OvZX?= =?us-ascii?Q?Eht6Se17lgZdkC7iQ3+L58O7HbaFA7ZYkhHqv8SboOUzc/UlFzCV47qi3LJ6?= =?us-ascii?Q?pFK4ecjD/k6LQsnHV2ZWtn088ErX4ORNFhPyupHBauOQsuo3N3xSgN+rOMO8?= =?us-ascii?Q?aZ4DaqXSRn+NCdXzwb7XgFHsMa5pFqAOqg0RlRYtICraQZmp1OsYQ0ZK7bLg?= =?us-ascii?Q?Rr5rPUyCnKcTazdLUdNgwWuZp0CBvJqF2n0iHtB4SG9/fnrri3U6Ed8yqyUw?= =?us-ascii?Q?11derbwCNW01YnLdLv1Sp/Qg5WqH7T1i9YWoWIK+H2zcRG4O9b4iwpON8VB+?= =?us-ascii?Q?0e9TrXTJ28if0VkvZr9BaYUjxIxir1dVr3/nokBH6zNqa3U7lZBMn3d7pFB4?= =?us-ascii?Q?hcomH76I6scy9rlxwiUshSyo8pLK5HRnCpB0cPjYkduH6D+0oW6k1bs3WyKV?= =?us-ascii?Q?jI55QurZtnCQee5GK3Fth3dBFtTocSK2BkmRj8/AT+s3UzNPc8siA19RDnvq?= =?us-ascii?Q?OKZaGbMLwxjDH1kSa6lqPKY+O3GYciV2wWLvYCY/fx231U3Erg5jq6eO4Fvl?= =?us-ascii?Q?qFs118riejKMPML9250=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2025 10:17:39.0020 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5603d38-9ff9-435b-a0d7-08de0a41bcd5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000055DC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6265 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1760351244636158500 Content-Type: text/plain; charset="utf-8" The following functions have been referenced in places which is either guar= ded with CONFIG_MGMT_HYPERCALLS or CONFIG_MEM_SHARING: - arch_hvm_save - arch_hvm_check - arch_hvm_load - hvm_save_size - hvm_save - hvm_load - hvm_vmtrace_reset So they shall be wrapped under OR relationship, otherwise they will become unreachable codes when MGMT_HYPERCALLS=3Dn && MEM_SHARING=3Dn, and hence vi= olating Misra rule 2.1. We move arch_hvm_save(), arch_hvm_check(), arch_hvm_load() and hvm_save_siz= e() nearer to the left functions, to avoid scattered #ifdef-wrapping. Signed-off-by: Penny Zheng --- v2 -> v3 - new commit --- xen/arch/x86/hvm/save.c | 154 +++++++++++++++-------------- xen/arch/x86/hvm/vmx/vmx.c | 4 + xen/arch/x86/include/asm/hvm/hvm.h | 4 + 3 files changed, 86 insertions(+), 76 deletions(-) diff --git a/xen/arch/x86/hvm/save.c b/xen/arch/x86/hvm/save.c index 8ab6405706..47050e13b6 100644 --- a/xen/arch/x86/hvm/save.c +++ b/xen/arch/x86/hvm/save.c @@ -15,62 +15,6 @@ =20 #include =20 -static void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr) -{ - uint32_t eax, ebx, ecx, edx; - - /* Save some CPUID bits */ - cpuid(1, &eax, &ebx, &ecx, &edx); - hdr->cpuid =3D eax; - - /* Save guest's preferred TSC. */ - hdr->gtsc_khz =3D d->arch.tsc_khz; - - /* Time when saving started */ - d->arch.hvm.sync_tsc =3D rdtsc(); -} - -static int arch_hvm_check(const struct domain *d, - const struct hvm_save_header *hdr) -{ - uint32_t eax, ebx, ecx, edx; - - if ( hdr->magic !=3D HVM_FILE_MAGIC ) - { - printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n", - d->domain_id, hdr->magic); - return -EINVAL; - } - - if ( hdr->version !=3D HVM_FILE_VERSION ) - { - printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n", - d->domain_id, hdr->version); - return -EINVAL; - } - - cpuid(1, &eax, &ebx, &ecx, &edx); - /* CPUs ought to match but with feature-masking they might not */ - if ( (hdr->cpuid & ~0x0fUL) !=3D (eax & ~0x0fUL) ) - printk(XENLOG_G_INFO "HVM%d restore: VM saved on one CPU " - "(%#"PRIx32") and restored on another (%#"PRIx32").\n", - d->domain_id, hdr->cpuid, eax); - - return 0; -} - -static void arch_hvm_load(struct domain *d, const struct hvm_save_header *= hdr) -{ - /* Restore guest's preferred TSC frequency. */ - if ( hdr->gtsc_khz ) - d->arch.tsc_khz =3D hdr->gtsc_khz; - if ( d->arch.vtsc ) - hvm_set_rdtsc_exiting(d, 1); - - /* Time when restore started */ - d->arch.hvm.sync_tsc =3D rdtsc(); -} - /* List of handlers for various HVM save and restore types */ static struct { hvm_save_handler save; @@ -101,26 +45,6 @@ void __init hvm_register_savevm(uint16_t typecode, hvm_sr_handlers[typecode].kind =3D kind; } =20 -size_t hvm_save_size(struct domain *d) -{ - struct vcpu *v; - size_t sz; - int i; - - /* Basic overhead for header and footer */ - sz =3D (2 * sizeof (struct hvm_save_descriptor)) + HVM_SAVE_LENGTH(HEA= DER); - - /* Plus space for each thing we will be saving */ - for ( i =3D 0; i <=3D HVM_SAVE_CODE_MAX; i++ ) - if ( hvm_sr_handlers[i].kind =3D=3D HVMSR_PER_VCPU ) - for_each_vcpu(d, v) - sz +=3D hvm_sr_handlers[i].size; - else - sz +=3D hvm_sr_handlers[i].size; - - return sz; -} - /* * Extract a single instance of a save record, by marshalling all records = of * that type and copying out the one we need. @@ -196,6 +120,83 @@ int hvm_save_one(struct domain *d, unsigned int typeco= de, unsigned int instance, return rv; } =20 +#if defined(CONFIG_MGMT_HYPERCALLS) || defined(CONFIG_MEM_SHARING) +static void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr) +{ + uint32_t eax, ebx, ecx, edx; + + /* Save some CPUID bits */ + cpuid(1, &eax, &ebx, &ecx, &edx); + hdr->cpuid =3D eax; + + /* Save guest's preferred TSC. */ + hdr->gtsc_khz =3D d->arch.tsc_khz; + + /* Time when saving started */ + d->arch.hvm.sync_tsc =3D rdtsc(); +} + +static int arch_hvm_check(const struct domain *d, + const struct hvm_save_header *hdr) +{ + uint32_t eax, ebx, ecx, edx; + + if ( hdr->magic !=3D HVM_FILE_MAGIC ) + { + printk(XENLOG_G_ERR "HVM%d restore: bad magic number %#"PRIx32"\n", + d->domain_id, hdr->magic); + return -EINVAL; + } + + if ( hdr->version !=3D HVM_FILE_VERSION ) + { + printk(XENLOG_G_ERR "HVM%d restore: unsupported version %u\n", + d->domain_id, hdr->version); + return -EINVAL; + } + + cpuid(1, &eax, &ebx, &ecx, &edx); + /* CPUs ought to match but with feature-masking they might not */ + if ( (hdr->cpuid & ~0x0fUL) !=3D (eax & ~0x0fUL) ) + printk(XENLOG_G_INFO "HVM%d restore: VM saved on one CPU " + "(%#"PRIx32") and restored on another (%#"PRIx32").\n", + d->domain_id, hdr->cpuid, eax); + + return 0; +} + +static void arch_hvm_load(struct domain *d, const struct hvm_save_header *= hdr) +{ + /* Restore guest's preferred TSC frequency. */ + if ( hdr->gtsc_khz ) + d->arch.tsc_khz =3D hdr->gtsc_khz; + if ( d->arch.vtsc ) + hvm_set_rdtsc_exiting(d, 1); + + /* Time when restore started */ + d->arch.hvm.sync_tsc =3D rdtsc(); +} + +size_t hvm_save_size(struct domain *d) +{ + struct vcpu *v; + size_t sz; + unsigned int i; + + /* Basic overhead for header and footer */ + sz =3D (2 * sizeof (struct hvm_save_descriptor)) + HVM_SAVE_LENGTH(HEA= DER); + + /* Plus space for each thing we will be saving */ + for ( i =3D 0; i <=3D HVM_SAVE_CODE_MAX; i++ ) + if ( hvm_sr_handlers[i].kind =3D=3D HVMSR_PER_VCPU ) + for_each_vcpu(d, v) + sz +=3D hvm_sr_handlers[i].size; + else + sz +=3D hvm_sr_handlers[i].size; + + return sz; +} + int hvm_save(struct domain *d, hvm_domain_context_t *h) { char *c; @@ -390,6 +391,7 @@ int hvm_load(struct domain *d, bool real, hvm_domain_co= ntext_t *h) =20 /* Not reached */ } +#endif /* CONFIG_MGMT_HYPERCALLS || CONFIG_MEM_SHARING */ =20 int _hvm_init_entry(struct hvm_domain_context *h, uint16_t tc, uint16_t in= st, uint32_t len) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 1996e139a0..4394990131 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2701,6 +2701,7 @@ static int cf_check vmtrace_output_position(struct vc= pu *v, uint64_t *pos) return v->arch.hvm.vmx.ipt_active; } =20 +#if defined(CONFIG_MGMT_HYPERCALLS) || defined(CONFIG_MEM_SHARING) static int cf_check vmtrace_reset(struct vcpu *v) { if ( !v->arch.hvm.vmx.ipt_active ) @@ -2710,6 +2711,7 @@ static int cf_check vmtrace_reset(struct vcpu *v) v->arch.msrs->rtit.status =3D 0; return 0; } +#endif /* CONFIG_MGMT_HYPERCALLS || CONFIG_MEM_SHARING */ =20 static uint64_t cf_check vmx_get_reg(struct vcpu *v, unsigned int reg) { @@ -2888,7 +2890,9 @@ static struct hvm_function_table __initdata_cf_clobbe= r vmx_function_table =3D { .vmtrace_output_position =3D vmtrace_output_position, .vmtrace_set_option =3D vmtrace_set_option, .vmtrace_get_option =3D vmtrace_get_option, +#if defined(CONFIG_MGMT_HYPERCALLS) || defined(CONFIG_MEM_SHARING) .vmtrace_reset =3D vmtrace_reset, +#endif =20 .get_reg =3D vmx_get_reg, .set_reg =3D vmx_set_reg, diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/= hvm/hvm.h index 473cf24b83..9d6cb42d48 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -240,7 +240,9 @@ struct hvm_function_table { int (*vmtrace_output_position)(struct vcpu *v, uint64_t *pos); int (*vmtrace_set_option)(struct vcpu *v, uint64_t key, uint64_t value= ); int (*vmtrace_get_option)(struct vcpu *v, uint64_t key, uint64_t *valu= e); +#if defined(CONFIG_MGMT_HYPERCALLS) || defined(CONFIG_MEM_SHARING) int (*vmtrace_reset)(struct vcpu *v); +#endif =20 uint64_t (*get_reg)(struct vcpu *v, unsigned int reg); void (*set_reg)(struct vcpu *v, unsigned int reg, uint64_t val); @@ -775,6 +777,7 @@ static inline int hvm_vmtrace_get_option( return -EOPNOTSUPP; } =20 +#if defined(CONFIG_MGMT_HYPERCALLS) || defined(CONFIG_MEM_SHARING) static inline int hvm_vmtrace_reset(struct vcpu *v) { if ( hvm_funcs.vmtrace_reset ) @@ -782,6 +785,7 @@ static inline int hvm_vmtrace_reset(struct vcpu *v) =20 return -EOPNOTSUPP; } +#endif /* CONFIG_MGMT_HYPERCALLS || CONFIG_MEM_SHARING */ =20 /* * Accessors for registers which have per-guest-type or per-vendor locatio= ns --=20 2.34.1