From patchwork Wed Jul 17 12:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13735439 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B88CC3DA42 for ; Wed, 17 Jul 2024 12:41:09 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.759963.1169669 (Exim 4.92) (envelope-from ) id 1sU3xs-0001FC-Le; Wed, 17 Jul 2024 12:41:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 759963.1169669; Wed, 17 Jul 2024 12:41:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sU3xs-0001F5-Hy; Wed, 17 Jul 2024 12:41:00 +0000 Received: by outflank-mailman (input) for mailman id 759963; Wed, 17 Jul 2024 12:40:59 +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 1sU3xr-0001Ew-2n for xen-devel@lists.xenproject.org; Wed, 17 Jul 2024 12:40:59 +0000 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [2a00:1450:4864:20::22a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d055f3e2-4439-11ef-8776-851b0ebba9a2; Wed, 17 Jul 2024 14:40:57 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2eefc3d707dso8013711fa.0 for ; Wed, 17 Jul 2024 05:40:57 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fc0bc38a81sm74556835ad.220.2024.07.17.05.40.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Jul 2024 05:40:56 -0700 (PDT) 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: d055f3e2-4439-11ef-8776-851b0ebba9a2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1721220057; x=1721824857; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=N+J5galAPvN30KZAhGbbh4LLw0KDTaLZXX/dCHmJWxQ=; b=I0B8NxQ4MoTwq+EFush7gAZ7UOBxxz7nTqTq9yOuku4j5kx92uWCyL2IOak8YfP4IQ zy4Mm2APnqw3vVHEIRaif5WWvSlgHF/on8xDkQzfaUf8sQbM2xZXyqzhSvUAgCiyOztH yRbJ+CM43L12etZsy9nwsxJ/YZfDwvxqy9n10+U06YHnHHd22f+Qz0AD4ffjAEmN8fbp 5apG/BBfbE4O5af3ec+3BuVAEoAHxkuJa7yb0pgNJVaMCT+rzLoPBG78GjyhBW+xYDzm 0b4eo5JErENGSk1L5ogDo2EFg0FE1/HsZ06C3wtPfb1rq90pIrYxpZFcF2Kj4Me+MVeC 4JBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721220057; x=1721824857; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N+J5galAPvN30KZAhGbbh4LLw0KDTaLZXX/dCHmJWxQ=; b=T2IGMeUQE/QRkW8aNt2O4AKedPX7moouDIeACe8muhB5Rfm09zTpKOjC4WYAEeOZmp c05kNEzK5CWPKaw1LsrlrVpnK06krlmeLr72G1mn8lT04eHhxih05ee1k18MRAuv3H9c z7Gog7LtnbR1oo0eVVmMXrSxaMF423A/1kVq3DTgEIgEgxrcfgyrKDWYzDx0fIRPaKJc ocrbAlny3sjEA8ZQwqUFZEYr4kKED/RJAzpevu7W5uymR/cb5MuAkM+sK09s2PJSqcRN LL/W/93MkTusFmcwfbgqBHyCtrqc0G+/tZ+SIhfpQzv0TI67xv6C05gR0sBzkYS+cysK EstA== X-Gm-Message-State: AOJu0YxKpT8PiXZdaKfM2ahvX2uRe/Nxa5CI/bwOrgse44SVMMx+5zeK 0BFymxwqDpaGosCW0UFkJVwDPFGZ0FRWjOZ7EjqM2iN3KHr0DIps5Z/w+yvjOB6fcmWSrPc60qA = X-Google-Smtp-Source: AGHT+IF4B8EKrmpErbu/EmQHHbnV//awrvsTvS4QHLdCljIWoEQrEpYrDI7D7uSUEYHgKgOuc0kzQA== X-Received: by 2002:a05:651c:485:b0:2ee:6cda:637b with SMTP id 38308e7fff4ca-2eefd13e581mr10627711fa.35.1721220056596; Wed, 17 Jul 2024 05:40:56 -0700 (PDT) Message-ID: <16b45b39-aadd-4a53-bcb9-214ded193db9@suse.com> Date: Wed, 17 Jul 2024 14:40:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= From: Jan Beulich Subject: [PATCH] x86: drop REX64_PREFIX Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZ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sUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL While we didn't copy the full Linux commentary, Linux commit 7180d4fb8308 ("x86_64: Fix 64bit FXSAVE encoding") is quite explicit about gas 2.16 supporting FXSAVEQ / FXRSTORQ. As that's presently our minimal required version, we can drop the workaround that was needed for yet for older gas. Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- a/xen/arch/x86/i387.c +++ b/xen/arch/x86/i387.c @@ -64,13 +64,12 @@ static inline void fpu_fxrstor(struct vc { default: asm volatile ( - /* See below for why the operands/constraints are this way. */ - "1: " REX64_PREFIX "fxrstor (%2)\n" + "1: fxrstorq %0\n" ".section .fixup,\"ax\" \n" "2: push %%"__OP"ax \n" " push %%"__OP"cx \n" " push %%"__OP"di \n" - " mov %2,%%"__OP"di \n" + " lea %0,%%"__OP"di \n" " mov %1,%%ecx \n" " xor %%eax,%%eax \n" " rep ; stosl \n" @@ -81,7 +80,7 @@ static inline void fpu_fxrstor(struct vc ".previous \n" _ASM_EXTABLE(1b, 2b) : - : "m" (*fpu_ctxt), "i" (sizeof(*fpu_ctxt) / 4), "R" (fpu_ctxt) ); + : "m" (*fpu_ctxt), "i" (sizeof(*fpu_ctxt) / 4) ); break; case 4: case 2: asm volatile ( @@ -157,13 +156,7 @@ static inline void fpu_fxsave(struct vcp if ( fip_width != 4 ) { - /* - * The only way to force fxsaveq on a wide range of gas versions. - * On older versions the rex64 prefix works only if we force an - * addressing mode that doesn't require extended registers. - */ - asm volatile ( REX64_PREFIX "fxsave (%1)" - : "=m" (*fpu_ctxt) : "R" (fpu_ctxt) ); + asm volatile ( "fxsaveq %0" : "=m" (*fpu_ctxt) ); /* * Some CPUs don't save/restore FDP/FIP/FOP unless an exception is --- a/xen/arch/x86/include/asm/asm_defns.h +++ b/xen/arch/x86/include/asm/asm_defns.h @@ -331,14 +331,6 @@ static always_inline void stac(void) #define safe_swapgs \ "mfence; swapgs;" -#ifdef __sun__ -#define REX64_PREFIX "rex64\\" -#elif defined(__clang__) -#define REX64_PREFIX ".byte 0x48; " -#else -#define REX64_PREFIX "rex64/" -#endif - #define ELFNOTE(name, type, desc) \ .pushsection .note.name, "a", @note ; \ .p2align 2 ; \