From patchwork Fri Feb 18 14:34:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 12751454 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 26D1BC433F5 for ; Fri, 18 Feb 2022 14:35:03 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.275510.471425 (Exim 4.92) (envelope-from ) id 1nL4LC-0000Ho-NC; Fri, 18 Feb 2022 14:34:34 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 275510.471425; Fri, 18 Feb 2022 14:34: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 1nL4LC-0000Hh-Jv; Fri, 18 Feb 2022 14:34:34 +0000 Received: by outflank-mailman (input) for mailman id 275510; Fri, 18 Feb 2022 14:34:33 +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 1nL4LB-0008Sp-9I for xen-devel@lists.xenproject.org; Fri, 18 Feb 2022 14:34:33 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e21f6463-90c7-11ec-8723-dd0c611c5f35; Fri, 18 Feb 2022 15:34:32 +0100 (CET) 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: e21f6463-90c7-11ec-8723-dd0c611c5f35 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1645194872; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=OBvd7Te7RVC9tLWUnRCr7dexqEAV0RltpksYs1SPDnw=; b=R3aKWenWhiUGNwfuWyF4iX3s5Ek/OpvQFD9sd4CbtEfwC9SNZlHQpyt7 usjz4oB3QZKxy0g0duz8yRZcEQ7Dh/6HuEZOUeqtZtmw3BP/sHDBDd6P9 9YA4aR0dzSiZW9Nn2Xi4Gm7FPKArv4mzUjNSPBEE9F81Ds5C6UNuBRiZm A=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com X-SBRS: 5.1 X-MesageID: 63960496 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:yaHGUKnBiORX9doYGzCHIh7o5gyWJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIXCmzXOv+CMWX9KNt1Ooq/9khTsZSEzIUxHQtrrX82EiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2UILd9IR2NYy24DjWlPV4 7senuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYRxsUI4nDx/0kUD5pHj5UI6tnv5rLPi3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3oHZvwCufFf87aZvCX7/L9ZlT2zJYasVmQ62PO ZJFOGQHgBLobx9RNH0qKJIFhe6tmHrnXxgGq0+Euv9ii4TU5FMoi+W8WDbPQfSVQe1Fk0Deo XjJl0z7CBwHMN2UyRKe72mhwOTImEvTSI8UUbG16PNuqFmS3XAITg0bU0Ohpvu0gVL4XMhQQ 3H44QJ38/J0rhbyCICgAVvo+xZooyLwRfJeD9AnzA7S05PXxDeUGUIaSB8GTdA54ZpeqSMR6 neFmNbgBDpKubKTSG6A+rr8kQ5eKRT5PkdZO3ZaEFJtD83L5dhq00mRFooL/Lud04WtcQwc1 Qxmu8TXa187qccQn5u28lnc695HjsiYF1Vljuk7s4/M0++YWGJHT9D5gbQ4xawZRGp8crVnl CFV8yR5xLpTZaxhbATXHI0w8EiBvp5pygH0j191BIUG/D+w4XOldo04yGggeBowaJpcKGO3O RW7VeZtCHl7ZSrCgUhfOd/ZNijX5fK4SYSNug78NbKinaSdhCfYpXozNCZ8LkjmkVQ2kLFXB HtoWZ3EMJruMow+lGDeb75EidcDn3lirUuOFcGT50n2itK2OS/KIYrpxXPTN4jVGovf+16Lm zueXuPXoyhivBrWOHePqtdLdQhQRZX5bLivw/Fqmie4ClMOMEkqCuPLwKNnfIpgnq9PkfzP8 G37UUhdoGcTT1WdQelWQhiPsI/SYKs= IronPort-HdrOrdr: A9a23:DCiLMq1pvVo0VBtwcJTw4wqjBLYkLtp133Aq2lEZdPUzSL3+qy nOpoV+6faQsl0ssR4b9exoVJPufZq+z/5ICOsqU4tKNTOO0AHEEGgI1+rf6gylNyri9vNMkY dMGpIObeEY1GIK7voSNjPIceod/A== X-IronPort-AV: E=Sophos;i="5.88,379,1635220800"; d="scan'208";a="63960496" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a6Ixpo+AY8qOybEFDFwVrdOw0xtCGDyypGF3c9qnd6BdCokqebGcxViWDiO/AZpIvaJxzsxjVv7F4OFEApxNWlsoFfqckp0wiKFxhXNHDfRaLOheyhM+u390rnLvahl7cl32cElkC/JTA57H+WUEDQC+8WLhPCRD7PHUBjqEsjvbH75zlPPxmSqwLbrL/90nj7Qt1Z/65iHtTAg0ZQKis4VzE2jBMhUeZyuYhxcAlMDjRxRx5L+B5MuKcZTxHGXOVaTLYouw3QnOuLY+766setZxV1/ezMUCU2gbPyGgYXUDgcnJ03gdbF6URC2UQtBAP5wUY3gZHhXxJSB4PhR68A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q5KrC8FlxtiywlEQxR4J2fdDfBJ+V23D+gnQTYifv1I=; b=SvzvLa3xJlK2Ze10l26a9mBsji+99lxl0KXdAA1A54PNadroUZtoFQQdnCKkIK6exy79VMU1ArJCKAUv/x40AyKWYFy/TE0Sf4uLln1IEGwCububjOhEUTnV/wSGOTcZLyeQvVwnE7lrSOn0AOmCgt7dSPmdIZ/yCg/YhbSv3OadT/DGrZ9qr/CnaeU+24GEWoRQa8WQTzojF3k7Q7X7iEm4icVINdx7yn0d3rIr+M5iI7iRomYmb1P5gP4rfmddLF65Bw/i5f3wWAQu4GbWbZ0U426P37ur17bGQUiUaE2ne/SplGgY+SugMTQ9rS53m8b8iqeCcMSAMw4A369zGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q5KrC8FlxtiywlEQxR4J2fdDfBJ+V23D+gnQTYifv1I=; b=pFBYwqcI67c6kf8R2NxFy978xltcIrZMpZZSzQ711f6YTPjPr0gBESzYSN4Ae4sNj/pBtA9K7F+kvDuKT/UFoYgjzf191mBkfoE/InEjPVD/EArrrODzhxDvVB8C0uYrhP74uZASU7Qc9X4YPaXPJLgTHe9rE+Kwrl7IvzjrGOY= From: Roger Pau Monne To: CC: Roger Pau Monne , Jan Beulich , Andrew Cooper , Wei Liu Subject: [PATCH v3 1/3] x86/retpoline: split retpoline compiler support into separate option Date: Fri, 18 Feb 2022 15:34:14 +0100 Message-ID: <20220218143416.34475-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220218143416.34475-1-roger.pau@citrix.com> References: <20220218143416.34475-1-roger.pau@citrix.com> X-ClientProxiedBy: LO4P123CA0223.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a6::12) To DS7PR03MB5608.namprd03.prod.outlook.com (2603:10b6:5:2c9::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 658147a6-596c-4729-b009-08d9f2ebc3ea X-MS-TrafficTypeDiagnostic: DS7PR03MB5543:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aafhI/N//VXt5Qo4d/Rv2WkKL3iGB6LsF5mGo/OE083fZv1nxot1DZf5BFZ1pwjxOQXY8e7ap5K6vBOhShqLwva0BlS7FgkDBrufMq4QWzI/HfvafnRlKQRzT+c+dxtE1Mhur6SGlBakTSnQRblbK0X9b4JKCjR+mTgsW+wKBw88yyYvq5YLqa0x6AFggPdxcnjHDWaSKY1shgPZMWJxZbF3W/RyZDMOYiwh4P9mIwlT6XLuUlokKMFjeN1VlGkkN2zSBWOFjFvu6Uh6N1jkUFr9t18tvJ0g65kr+7Xa/tD5dKZBEwKp6OUuXK++8a+o1wzCNd6OnG0qkH4jf8XtGFVEDKDuN8kf8YcRagbfvzqGaW0NZ2CJvnyNA6mjmlEgdzdyMobLVJK/hCTF6PO1BEh0qQfuVf0xXpeNqJdWsTzwBxMANagZaSKdBTawLmMIoBsjNmZTuutJ9kYLp4xiFOccoyHPqGTnwbql0NX7CNEn93nMGuvfO9GPwDM5+4YULuTuNCxP+K/lv0r2Y+bDUIDAGuIzyGP7kkjJmoVb3AcFCWOd5z4Yo2QSvbF/XWQz0JhxuxTUBLcJMXVRReRtP+1FTvk1KaANgkH42I2T8ZL4ObZhXZ3n20Pt0RNVY46xnJ/l22brrjg4uYS9F7Gukw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR03MB5608.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(86362001)(6512007)(36756003)(82960400001)(8936002)(26005)(1076003)(6486002)(8676002)(6666004)(6916009)(2616005)(66946007)(5660300002)(2906002)(54906003)(66476007)(316002)(66556008)(83380400001)(4326008)(508600001)(6506007)(186003)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WIHUJbTvfomEGu7r0swFBn/CA+Ol?= =?utf-8?q?3egKUIhsDPBP9btI3Ua4m8ZRoQy6Vt2JnidihPHaDZG4OunNpuqv7y0bECg6Bejl4?= =?utf-8?q?RF6iD9TKN+R8i1psIqd48GIlYrXMPa5CXsQzR3eg4mZUSRV7TQtJOe5v6yCcgMcmo?= =?utf-8?q?u89xt9MwohUdIxkPAPcku/UZAw2BSjUC+EL254TjZxtndNNagLgt8akNqYXqtbUKK?= =?utf-8?q?3a89m2icB7Rh76ml+j7OINDPoG8BfAHB/CSmve0hfzNbTH+SSeIjfT0dHa31c8F7x?= =?utf-8?q?5yr6LOqd9bnEeZVh1Lfsgr6vwhihSXdcxfFY2B2WVWMHzcHeIVXDKOaFUn8qYJ1ii?= =?utf-8?q?spjZmNbU1WWSdnguk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0ow+2FGvD2z3jAwVZ3VBPGio3Sqw3TOUNeRC?= =?utf-8?q?TvOQI7+S3GB//gn5NH8mVxc1/6qdpZgiJxHUjNB4iDyCu9QxDV2nyvWDR5QXFANTM?= =?utf-8?q?SYwy03kdO7TVu89OYCUBN48JNSmDcBP+NO6IEZm23TLSai+pBaDP44kzv57DQZqvo?= =?utf-8?q?yedHU2epi/39K8us1TIgL7voSwNgT7ozq9R6RDIdlu7USlkM8APOWOyeplCPdiLR1?= =?utf-8?q?sVXzh54fyL3QUhFkAJuv0GyngrKZ6fzX4Pp1F2k8vfSKnQ4DPXfDoq244vnzH0HwT?= =?utf-8?q?wbv3ozGLKjBDZVkHk9IN3gfT5VQXGeXcNTacOkrg/5ejpy3hWky5yjI=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 658147a6-596c-4729-b009-08d9f2ebc3ea X-MS-Exchange-CrossTenant-AuthSource: DS7PR03MB5608.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2022 14:34:27.0322 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rgqKvh1TK6+p4i07OBiG71NfQaU2dSjc4dHThmA4mq+B0v+x2g79x5FZnixLS5i99cxMJIzMxvSGTWgJtLpYAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR03MB5543 X-OriginatorOrg: citrix.com Keep the previous option as a way to signal generic retpoline support regardless of the underlying compiler, while introducing a new CC_INDIRECT_THUNK that signals whether the underlying compiler supports retpoline. No functional change intended. Signed-off-by: Roger Pau Monné --- Changes since v2: - Make the compiler option check generic instead of GCC only. Changes since v1: - Put def_bool before depend on. --- xen/arch/x86/Kconfig | 6 +++++- xen/arch/x86/arch.mk | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index b4abfca46f..a1a90da4fc 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -32,9 +32,13 @@ config ARCH_DEFCONFIG string default "arch/x86/configs/x86_64_defconfig" -config INDIRECT_THUNK +config CC_INDIRECT_THUNK def_bool $(cc-option,-mindirect-branch-register) +config INDIRECT_THUNK + def_bool y + depends on CC_INDIRECT_THUNK + config HAS_AS_CET_SS # binutils >= 2.29 or LLVM >= 6 def_bool $(as-instr,wrssq %rax$(comma)0;setssbsy) diff --git a/xen/arch/x86/arch.mk b/xen/arch/x86/arch.mk index fa7cf38443..6388b1d93f 100644 --- a/xen/arch/x86/arch.mk +++ b/xen/arch/x86/arch.mk @@ -42,10 +42,12 @@ CFLAGS += -mno-red-zone -fpic # SSE setup for variadic function calls. CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) -# Compile with thunk-extern, indirect-branch-register if avaiable. -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch=thunk-extern -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch-register -CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables +ifeq ($(CONFIG_INDIRECT_THUNK),y) +# Compile with gcc thunk-extern, indirect-branch-register if available. +CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch=thunk-extern +CFLAGS-$(CONFIG_CC_IS_GCC) += -mindirect-branch-register +CFLAGS-$(CONFIG_CC_IS_GCC) += -fno-jump-tables +endif # If supported by the compiler, reduce stack alignment to 8 bytes. But allow # this to be overridden elsewhere.