From nobody Mon Nov 25 07:35:57 2024 Delivered-To: importer@patchew.org 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; 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; dmarc=fail(p=quarantine dis=quarantine) header.from=epam.com ARC-Seal: i=1; a=rsa-sha256; t=1722335355; cv=none; d=zohomail.com; s=zohoarc; b=T+1YjdwemovqK7+hWlySO3Hr6IwlRgYJGlCSpKCqTGHgp97WAb0nWXaYDYGasehEfRrVUvvg1tH42mZ6JEOMpSfl8d6La1w+F+kThQRvPFtTpRK9yX7I73P7GxujVDQdcG7S7k0mlFrQHJUgpZTAXittMAVidO+aiPyGJmMXfe4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1722335355; h=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=Os4qsP2xhhUYSbZoNVkXglGFlh7efBSAd/qy2M2bm8w=; b=DEy5Semjg8ssuNitTk3oL7cxh7PhrybwI362Z7QIyDzBEtd+M29YucpK4ufD7pbGABeyUnj90f0sg0ZfrzdyljuWkHNcnhXOQocDfy4zi7GEzMcjtxRzaEO19crUT4NqrjeIrAF4oMfBXeAfR5MRr/nMRXnqTtw5MYv7TdN+OWo= ARC-Authentication-Results: i=1; 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; dmarc=fail header.from= (p=quarantine dis=quarantine) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1722335355619446.3289314554344; Tue, 30 Jul 2024 03:29:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.767503.1178161 (Exim 4.92) (envelope-from ) id 1sYk6J-0005wK-6s; Tue, 30 Jul 2024 10:29:03 +0000 Received: by outflank-mailman (output) from mailman id 767503.1178161; Tue, 30 Jul 2024 10:29:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sYk6J-0005wD-3g; Tue, 30 Jul 2024 10:29:03 +0000 Received: by outflank-mailman (input) for mailman id 767503; Tue, 30 Jul 2024 10:29:01 +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 1sYk6H-0005w7-Jf for xen-devel@lists.xenproject.org; Tue, 30 Jul 2024 10:29:01 +0000 Received: from pb-smtp21.pobox.com (pb-smtp21.pobox.com [173.228.157.53]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 87db5eef-4e5e-11ef-8776-851b0ebba9a2; Tue, 30 Jul 2024 12:28:59 +0200 (CEST) Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 97C073EDC1; Tue, 30 Jul 2024 06:28:57 -0400 (EDT) (envelope-from sakib@darkstar.site) Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 911E63EDC0; Tue, 30 Jul 2024 06:28:57 -0400 (EDT) (envelope-from sakib@darkstar.site) Received: from localhost (unknown [185.130.54.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id CE8A63EDBF; Tue, 30 Jul 2024 06:28:53 -0400 (EDT) (envelope-from sakib@darkstar.site) 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: 87db5eef-4e5e-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to:cc :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=HOwAYjPRmMki8TMFevxWhhW05 eW/GeGVd0EhWHsG0rw=; b=TZ/W6ZrSSIDeEc39jO8+SJMPDFyU/aXe2WlyJlSdQ wL8GHA0A/Go8CXcEeJTZEOw8N777X7vnsXhbYauHTEUTNcZI51eOJWWzyiunmwW6 AyeAYbDSdk0M45hPfaDyiKlesmpFxr/nAH2ouzH1RE7fKgqFeofa/SiJjhiDYiOm Xg= From: Sergiy Kibrik To: xen-devel@lists.xenproject.org Cc: Xenia Ragiadakou , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Xenia Ragiadakou , Sergiy Kibrik Subject: [XEN PATCH v5 07/13] x86/PV: guard svm specific functions with usinc_svm() check Date: Tue, 30 Jul 2024 13:28:50 +0300 Message-Id: <01c571eec29f7842d4f701bf0afd1cd072bb8289.1722333634.git.Sergiy_Kibrik@epam.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Pobox-Relay-ID: 851835C6-4E5E-11EF-A835-9625FCCAB05B-90055647!pb-smtp21.pobox.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @pobox.com) X-ZM-MESSAGEID: 1722335356327116600 Content-Type: text/plain; charset="utf-8" From: Xenia Ragiadakou Replace cpu_has_svm check with using_svm(), so that not only SVM support in= CPU is being checked at runtime, but also at build time we ensure the availabil= ity of functions svm_load_segs() and svm_load_segs_prefetch(). Since SVM depends on HVM, it can be used alone. Signed-off-by: Xenia Ragiadakou Signed-off-by: Sergiy Kibrik Acked-by: Jan Beulich --- changes in v4: - changed patch subject line - adjusted call to using_svm(), as it has become an inline function - use #ifdef CONFIG_PV - description changed a bit for more clarity - added tag changes in v3: - using_svm instead of IS_ENABLED(CONFIG_SVM) - updated description --- xen/arch/x86/domain.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index ccadfe0c9e..05cb9f7a4c 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -1732,11 +1732,9 @@ static void load_segments(struct vcpu *n) if ( !(n->arch.flags & TF_kernel_mode) ) SWAP(gsb, gss); =20 -#ifdef CONFIG_HVM - if ( cpu_has_svm && (uregs->fs | uregs->gs) <=3D 3 ) + if ( using_svm() && (uregs->fs | uregs->gs) <=3D 3 ) fs_gs_done =3D svm_load_segs(n->arch.pv.ldt_ents, LDT_VIRT_STA= RT(n), n->arch.pv.fs_base, gsb, gss); -#endif } =20 if ( !fs_gs_done ) @@ -2049,9 +2047,9 @@ static void __context_switch(void) =20 write_ptbase(n); =20 -#if defined(CONFIG_PV) && defined(CONFIG_HVM) +#ifdef CONFIG_PV /* Prefetch the VMCB if we expect to use it later in the context switc= h */ - if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) ) + if ( using_svm() && is_pv_64bit_domain(nd) && !is_idle_domain(nd) ) svm_load_segs_prefetch(); #endif =20 --=20 2.25.1