From nobody Sun Nov 24 03:10:37 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=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730130629; cv=none; d=zohomail.com; s=zohoarc; b=ilH72V3PPSjX8fT+U1srcVgPYfHDHiUoryYmluOkvjqqS6ymZ8qy2tOt+JiJH6xWTHHL0YiEZ1YxZj8oAYhQDXecksGH/srdey3zEUK0X7PAgv66PfvmI7G7SzX8FP0xnab6ogZHMrgWl4TkXYhEZvOR66SKueSY9txgW3FRAj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730130629; 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=Avz5HmUUjPMBeZFfQQx+SO7GKCNtStFnZFq73+xyyr8=; b=oHNw8ORZlH4DSfnIcK/s9cfXqXDPXAhKyCXkcE8GFwwwk6Eu00bbYE9BP3UV221KkdQkhX9MpmRhLwZcnwY7DyAQ29U7lbJKhsThNFD+KLfMJTV/9hUxfSM/XRbrPOjARfDfh8FcvC42CwyAPSjzrvrU24zsOguAaGjMUjMVlSY= 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17301306299151023.7394655159686; Mon, 28 Oct 2024 08:50:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.826693.1241115 (Exim 4.92) (envelope-from ) id 1t5S0S-0002Pa-NN; Mon, 28 Oct 2024 15:50:12 +0000 Received: by outflank-mailman (output) from mailman id 826693.1241115; Mon, 28 Oct 2024 15:50:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5S0S-0002Lh-F0; Mon, 28 Oct 2024 15:50:12 +0000 Received: by outflank-mailman (input) for mailman id 826693; Mon, 28 Oct 2024 15:50:11 +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 1t5S0Q-0008FV-TX for xen-devel@lists.xenproject.org; Mon, 28 Oct 2024 15:50:10 +0000 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [2a00:1450:4864:20::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4f3340e9-9544-11ef-99a3-01e77a169b0f; Mon, 28 Oct 2024 16:50:09 +0100 (CET) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a9a156513a1so696754166b.0 for ; Mon, 28 Oct 2024 08:50:09 -0700 (PDT) Received: from localhost.localdomain ([217.156.233.154]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b3a0834a6sm387674066b.191.2024.10.28.08.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 08:50:07 -0700 (PDT) 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: 4f3340e9-9544-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730130608; x=1730735408; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Avz5HmUUjPMBeZFfQQx+SO7GKCNtStFnZFq73+xyyr8=; b=fGBlgYXj4aQ4LFrwVgbw+qOOp7iTsL3BI/zt8K1okiw4iXpEd8PN2i5JVyRPXy1Pdd dKtik0MWxssAdblNUvu+RGlKMDFLr6kcnYrPou2m6NQSa9bprIwfy0mJjgVXmFXvyekA TvQKrRuwXoJDKTZ6tos1qFRgJesa0/6R78JoM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730130608; x=1730735408; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Avz5HmUUjPMBeZFfQQx+SO7GKCNtStFnZFq73+xyyr8=; b=XlNoRR0On38H49KC0KvBpWVLZ2hnjqw9a+4h4gFRwFmuxVkOdS1Gzhu1gTKIM4relk G6l6JOqtWc3DRwuHlj36zR8B77ynoxnVKrOqXDgq26Yh5ZqnA78ShmZtEzHF2q3hnPuU VeLqwlbdu+0De3wTG/9vu0Y2JxIZNM64urz7co3h/wKhpldhi4AUG9AHnOLp5H7vdtzg xjT9aIub4xoKSNvDNNo5s17rDKkNFwnMKe/w3+4rzIBlJ9xwTkR1R9CLMjs/2LBm4TVL 7paTVs+9n9YDfEIhFMI8nR66F+fmx2RtvbMGKGDDLQyxENVFBs2obleA4ZzzsR/Pn9Qi Zu2g== X-Gm-Message-State: AOJu0YxLU+bt6FxNKQ9D543WUE6uPYhYIsOV9j0vcsqBeG/7VIriL0eA 5dt8qyB6fapeifQ9K9egEJdmji0BbgPUp8+SJZ8xeUTkaUFJ7XFzcp+gx/FsDlNZcimtTrEITCF H X-Google-Smtp-Source: AGHT+IFYkudP6zAU62spG2PVUAK8m0Vhgf6c+oKiNEtCmUOgIOvJL7/w8NXyEKEp5JICHhs/Va6zEg== X-Received: by 2002:a17:907:9281:b0:a99:d3f4:ff3b with SMTP id a640c23a62f3a-a9de5f65689mr830166466b.27.1730130608439; Mon, 28 Oct 2024 08:50:08 -0700 (PDT) From: Alejandro Vallejo To: xen-devel@lists.xenproject.org Cc: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 10/14] x86/mpx: Map/unmap xsave area in in read_bndcfgu() Date: Mon, 28 Oct 2024 15:49:28 +0000 Message-ID: <20241028154932.6797-11-alejandro.vallejo@cloud.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241028154932.6797-1-alejandro.vallejo@cloud.com> References: <20241028154932.6797-1-alejandro.vallejo@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730130631260116600 Content-Type: text/plain; charset="utf-8" No functional change. Signed-off-by: Alejandro Vallejo --- xen/arch/x86/xstate.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c index 4019ca4aae83..2a54da2823cf 100644 --- a/xen/arch/x86/xstate.c +++ b/xen/arch/x86/xstate.c @@ -1021,9 +1021,10 @@ int handle_xsetbv(u32 index, u64 new_bv) =20 uint64_t read_bndcfgu(void) { + uint64_t ret =3D 0; unsigned long cr0 =3D read_cr0(); - struct xsave_struct *xstate - =3D idle_vcpu[smp_processor_id()]->arch.xsave_area; + struct vcpu *v =3D idle_vcpu[smp_processor_id()]; + struct xsave_struct *xstate =3D vcpu_map_xsave_area(v); const struct xstate_bndcsr *bndcsr; =20 ASSERT(cpu_has_mpx); @@ -1049,7 +1050,12 @@ uint64_t read_bndcfgu(void) if ( cr0 & X86_CR0_TS ) write_cr0(cr0); =20 - return xstate->xsave_hdr.xstate_bv & X86_XCR0_BNDCSR ? bndcsr->bndcfgu= : 0; + if ( xstate->xsave_hdr.xstate_bv & X86_XCR0_BNDCSR ) + ret =3D bndcsr->bndcfgu; + + vcpu_unmap_xsave_area(v, xstate); + + return ret; } =20 void xstate_set_init(uint64_t mask) --=20 2.47.0