From nobody Fri Apr 19 05:16:42 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=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1605098760; cv=none; d=zohomail.com; s=zohoarc; b=mJ6ICabKLiB9o8fiTNDroK2S4jZBr+13u3gBCOk1himpzgk4mDKPPx72qU045d8i7Tbo7cVZyIX2t+m95njo57VyGRVDGC0tgtAqD7TnaVRWUzuGvRS32CGlJ1+3LSc0Mw5o1bRbN8tK6Dx1xkp0mEYZBYpWhBeePR+MQniRdMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605098760; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=HD5oLiXLM/5ccqLjZA7rB8ZWHiIDy4mhiy1jog/oCV4=; b=P3aF7p40phSIFCM78U3D3INSYhEXMeDwh8bp6Dp+5Y03ZNJzc52SJGbe5DRs2OuE7GY5dwaWsTw1adBBgPFR2Unz82O4Jz0iDjRCLlHsC6CyKBoK/HpcIMeAIdLJTu90rtUTf91F/WHfBMzTlnT8DaxwdCPpI36BqPGufIzchBA= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1605098760006399.63780539442087; Wed, 11 Nov 2020 04:46:00 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.24713.52080 (Exim 4.92) (envelope-from ) id 1kcpVG-0005sv-4H; Wed, 11 Nov 2020 12:45:34 +0000 Received: by outflank-mailman (output) from mailman id 24713.52080; Wed, 11 Nov 2020 12:45:34 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcpVG-0005so-1G; Wed, 11 Nov 2020 12:45:34 +0000 Received: by outflank-mailman (input) for mailman id 24713; Wed, 11 Nov 2020 12:45:32 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcpVE-0005sj-Ei for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 12:45:32 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1fac7159-7aec-46a3-80ae-c5c7bb35efa8; Wed, 11 Nov 2020 12:45:29 +0000 (UTC) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcpVE-0005sj-Ei for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 12:45:32 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1fac7159-7aec-46a3-80ae-c5c7bb35efa8; Wed, 11 Nov 2020 12:45:29 +0000 (UTC) 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: 1fac7159-7aec-46a3-80ae-c5c7bb35efa8 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1605098729; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wOOaUGGr8yuGb3kdKrSs9X8NrLohjLcCYBJmLWeB+Rc=; b=C7OHBe3m2xDAK4QHIoTDBEmVJrtq1ZDSG+7MwkJrXvV6iiR7luFbG0gg Mv+RUp9csSqo/wXgNBTsMTyCwx3MiYXwfqAc3qZ9eNWZ683ahfhJinMdm qpuZVIw26GSi7vCc1zRbyCXXA44Wd7LylLyvG8K6GI9anNDQjqAekcD50 8=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 7hJHVumaeqUa2QZfLZhaNCM5d21SmxemD0EJmWzkQyRsAM4wxfe6x5X+IJb2AqOMwyDA1906FM nL67wMsPi0GEUjm/a+aCkiEV4rku92rxYSNgMp11D0LAILztepA/S8Dj74OIAMtnEnkQXWwyE6 uYBp8WS/cKY7U4F6VZsTF9wjCANaRVq8IM3Mh5NnIEHBVdIg6d06hKEWsz8r+ndyhR8hyt6prp nXLlWOGtUS/EtYFG9RK0xfALhOH9kMfEZk2Ucal91VOAQR+y44U8yo1Ld321/Do4eeXdM7bGwc h4I= X-SBRS: None X-MesageID: 30970913 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.77,469,1596513600"; d="scan'208";a="30970913" From: Andrew Cooper To: Xen-devel CC: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu Subject: [PATCH] xen/x86: Work around Clang code generation bug with asm parameters Date: Wed, 11 Nov 2020 12:45:12 +0000 Message-ID: <20201111124512.2268-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) Clang 9 and later don't handle the clobber of %r10 correctly in _hypercall64_4(). See https://bugs.llvm.org/show_bug.cgi?id=3D48122 Rewrite the logic to use the "+r" form, rather than using separate input and output specifiers, which works around the issue. For consistency, adjust a= ll operand handling. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu --- xen/include/asm-x86/guest/xen-hcall.h | 35 ++++++++++++++++---------------= ---- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/xen/include/asm-x86/guest/xen-hcall.h b/xen/include/asm-x86/gu= est/xen-hcall.h index 03d5868a9e..3240d9807b 100644 --- a/xen/include/asm-x86/guest/xen-hcall.h +++ b/xen/include/asm-x86/guest/xen-hcall.h @@ -39,53 +39,50 @@ =20 #define _hypercall64_1(type, hcall, a1) \ ({ \ - long res, tmp__; \ + long res, _a1 =3D (long)(a1); \ asm volatile ( \ "call hypercall_page + %c[offset]" \ - : "=3Da" (res), "=3DD" (tmp__) ASM_CALL_CONSTRAINT = \ - : [offset] "i" (hcall * 32), \ - "1" ((long)(a1)) \ + : "=3Da" (res), "+D" (_a1) ASM_CALL_CONSTRAINT \ + : [offset] "i" (hcall * 32) \ : "memory" ); \ (type)res; \ }) =20 #define _hypercall64_2(type, hcall, a1, a2) \ ({ \ - long res, tmp__; \ + long res, _a1 =3D (long)(a1), _a2 =3D (long)(a2); = \ asm volatile ( \ "call hypercall_page + %c[offset]" \ - : "=3Da" (res), "=3DD" (tmp__), "=3DS" (tmp__) = \ + : "=3Da" (res), "+D" (_a1), "+S" (_a2) \ ASM_CALL_CONSTRAINT \ - : [offset] "i" (hcall * 32), \ - "1" ((long)(a1)), "2" ((long)(a2)) \ + : [offset] "i" (hcall * 32) \ : "memory" ); \ (type)res; \ }) =20 #define _hypercall64_3(type, hcall, a1, a2, a3) \ ({ \ - long res, tmp__; \ + long res, _a1 =3D (long)(a1), _a2 =3D (long)(a2), = \ + _a3 =3D (long)(a3); \ asm volatile ( \ "call hypercall_page + %c[offset]" \ - : "=3Da" (res), "=3DD" (tmp__), "=3DS" (tmp__), "=3Dd" (tmp__)= \ + : "=3Da" (res), "+D" (_a1), "+S" (_a2), "+d" (_a3) \ ASM_CALL_CONSTRAINT \ - : [offset] "i" (hcall * 32), \ - "1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)) \ + : [offset] "i" (hcall * 32) \ : "memory" ); \ (type)res; \ }) =20 #define _hypercall64_4(type, hcall, a1, a2, a3, a4) \ ({ \ - long res, tmp__; \ - register long _a4 asm ("r10") =3D ((long)(a4)); \ + long res, _a1 =3D (long)(a1), _a2 =3D (long)(a2), = \ + _a3 =3D (long)(a3); \ + register long _a4 asm ("r10") =3D (long)(a4); \ asm volatile ( \ "call hypercall_page + %c[offset]" \ - : "=3Da" (res), "=3DD" (tmp__), "=3DS" (tmp__), "=3Dd" (tmp__)= , \ - "=3D&r" (tmp__) ASM_CALL_CONSTRAINT \ - : [offset] "i" (hcall * 32), \ - "1" ((long)(a1)), "2" ((long)(a2)), "3" ((long)(a3)), \ - "4" (_a4) \ + : "=3Da" (res), "+D" (_a1), "+S" (_a2), "+d" (_a3) \ + "+r" (_a4) ASM_CALL_CONSTRAINT \ + : [offset] "i" (hcall * 32) \ : "memory" ); \ (type)res; \ }) --=20 2.11.0