From nobody Thu Dec 26 17:36:46 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=OhJYhVnORAj4FRrgrSngnQAJPLRKy8CtXoOIu3SRSkHodfO9GXDTU2aZG4BQATGqAniFvmdIHu5b3D0280ZO4hE2x2+U4vL0rd40qBm6E3Xm+pQUP+a+7t8B+RxS58vWQXx1YbZFAF9qOxJ7vZc77VQ/WggVmWAhubQ3xySjeKA= 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=BVQr91XZlcFHKTZl1uI+zUZ3+gisoPjkP7pJQrXj6Go=; b=WbJaStBiGKWOhD65UeTz9UTyF/8S1JdvlxYcA/nTHDd+HkLVdn7+EqiIOliI2Dzf9pcFmzV5W0yLd2whPaaMC9DYBe5CS6eEEr4bIdyaMn2hrDo5T46e2KRrRrIxwltSmoKOgim2FPLgZ9g6J+Ls5f5r3m24MmRYKRKQUtv/pfI= 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 1730130629434926.6360961189745; Mon, 28 Oct 2024 08:50:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.826692.1241109 (Exim 4.92) (envelope-from ) id 1t5S0S-0002GO-7b; Mon, 28 Oct 2024 15:50:12 +0000 Received: by outflank-mailman (output) from mailman id 826692.1241109; 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 1t5S0R-0002D9-Ju; Mon, 28 Oct 2024 15:50:11 +0000 Received: by outflank-mailman (input) for mailman id 826692; Mon, 28 Oct 2024 15:50:09 +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 1t5S0P-0008FV-QF for xen-devel@lists.xenproject.org; Mon, 28 Oct 2024 15:50:09 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4e98f673-9544-11ef-99a3-01e77a169b0f; Mon, 28 Oct 2024 16:50:08 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a86e9db75b9so669331866b.1 for ; Mon, 28 Oct 2024 08:50:08 -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.06 (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: 4e98f673-9544-11ef-99a3-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730130607; x=1730735407; 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=BVQr91XZlcFHKTZl1uI+zUZ3+gisoPjkP7pJQrXj6Go=; b=MfUNumKTljT6wgPlIt4UNi9ZUHNwx1vhLw7gMn085JDV8UNVsrwSrX0gj5+wstiwu/ mP/SE7tJQRYMxLonKrfqlnXiyN9EtudWe5Z847+ml74LkFUEUaYCa0utvUeHi6ZMvShy 6Jsya90FcYEkhBdMbRHaKLf74XfarQxRmk1hk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730130607; x=1730735407; 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=BVQr91XZlcFHKTZl1uI+zUZ3+gisoPjkP7pJQrXj6Go=; b=CTjod5ch/PrC5Uf1C7o6jOGRL/D07GYQjU0CIu9wtUe1oVDa/jhIp2qhbdoReRxD2f TDv7/bp+Aa6aKzev7B/alXJhV0ObnzYCCdiTVz7kOsHEtZTExdpGiZJdQvPXoHs51p7b a7mgKO8hC59S4i2YwPW7utTkqdlvLpkjh83rT96uxXIw05oczZ7BFEXtoHxyVTvpcZCH 1M3358w9sybvfp6Uwo2jVJhTWLuOFcv2OQINx/URp58mk97AGz8UeIzq5UpUjZS29vuO aRa+AonMHCRKv/Q4BYeDmR8QdK3Z0aNFtA4d7D9Ns/FDNGC+AB7Hto4aV/BmNClblNpw OG7Q== X-Gm-Message-State: AOJu0YycqrhH9E8bvTIi8y1ESat1PLdBlKXiectz8x2WUKeAoM4UwZzs 70Cn93Lip5afnjVnJ5iRcDT1DnkyHR3RQtxWm3N1g6UbJj/CZHvGzEv6MYCgCe4HF31lq+5nVfS q X-Google-Smtp-Source: AGHT+IE9C6AE9q4nMjRt1C+VfW2rH9XoLb9J6ZQJla+EMe54GmyWuVpV1KfcGJcfCKDpZX5aG3UOew== X-Received: by 2002:a17:907:1c9d:b0:a99:ed2e:3875 with SMTP id a640c23a62f3a-a9de615ece4mr713802766b.42.1730130607479; Mon, 28 Oct 2024 08:50:07 -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 09/14] x86/emulator: Refactor FXSAVE_AREA to use wrappers Date: Mon, 28 Oct 2024 15:49:27 +0000 Message-ID: <20241028154932.6797-10-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: 1730130631265116600 Content-Type: text/plain; charset="utf-8" Adds an UNMAP primitive to make use of vcpu_unmap_xsave_area() when linked into xen. unmap is a no-op during tests. Signed-off-by: Alejandro Vallejo --- xen/arch/x86/x86_emulate/blk.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/x86_emulate/blk.c b/xen/arch/x86/x86_emulate/blk.c index 08a05f8453f7..d5b59333823f 100644 --- a/xen/arch/x86/x86_emulate/blk.c +++ b/xen/arch/x86/x86_emulate/blk.c @@ -11,9 +11,11 @@ !defined(X86EMUL_NO_SIMD) # ifdef __XEN__ # include -# define FXSAVE_AREA ((void *)¤t->arch.xsave_area->fpu_sse) +# define FXSAVE_AREA ((void *)vcpu_map_xsave_area(current)) +# define UNMAP_FXSAVE_AREA(x) vcpu_unmap_xsave_area(currt ent, x) # else # define FXSAVE_AREA get_fpu_save_area() +# define UNMAP_FXSAVE_AREA(x) ((void)x) # endif #endif =20 @@ -292,6 +294,9 @@ int x86_emul_blk( } else asm volatile ( "fxrstor %0" :: "m" (*fxsr) ); + + UNMAP_FXSAVE_AREA(fxsr); + break; } =20 @@ -320,6 +325,9 @@ int x86_emul_blk( =20 if ( fxsr !=3D ptr ) /* i.e. s->op_bytes < sizeof(*fxsr) */ memcpy(ptr, fxsr, s->op_bytes); + + UNMAP_FXSAVE_AREA(fxsr); + break; } =20 --=20 2.47.0