From nobody Fri Dec 19 19:01:26 2025 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=1745370188; cv=none; d=zohomail.com; s=zohoarc; b=kl4Dwe5zbPRMZ0D6peUwyK4j9cFSlbaO2xw06SzIUuSaOqpWYahMSZeDl6OkMOHYc3hz800Y82sdKfD0m7M/IQodfeICXIEGY13zr9ltX270Gj4f9LmSVslss6sXxiRu2HhOVbDsh4t7/KcfBE8k9681hcJSfrfNJkZiW4FT3Bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745370188; h=Content-Type: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=QBk2Bkks19S53TDx+/MMHfe9z/s9WQXhsbPDXWcJ6Gk=; b=cid8LxYOdEb9JDWsm8gGtEyH0a5r4viOhgMdHGffEThF6XLTBwruhPxD9DkmALyNNZO8DEY3rug7bL7utvckwSTQ4PrhdL0nU+0QWr69ZlUta5PGb+2AmQ4d14JEUmLaDruLmL3/whikjbI0gQ07reUNKfSpCjZyTNP0Jy4CWaw= 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 1745370188308500.86113046642606; Tue, 22 Apr 2025 18:03:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.963777.1354713 (Exim 4.92) (envelope-from ) id 1u7OVl-000129-CD; Wed, 23 Apr 2025 01:02:49 +0000 Received: by outflank-mailman (output) from mailman id 963777.1354713; Wed, 23 Apr 2025 01:02:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u7OVl-000122-9Z; Wed, 23 Apr 2025 01:02:49 +0000 Received: by outflank-mailman (input) for mailman id 963777; Wed, 23 Apr 2025 01:02:48 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u7OVk-0000oH-Dg for xen-devel@lists.xenproject.org; Wed, 23 Apr 2025 01:02:48 +0000 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [2a00:1450:4864:20::336]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id abab4d9f-1fde-11f0-9eb0-5ba50f476ded; Wed, 23 Apr 2025 03:02:47 +0200 (CEST) Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43edecbfb94so60201785e9.1 for ; Tue, 22 Apr 2025 18:02:47 -0700 (PDT) Received: from localhost.localdomain ([83.104.178.215]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-44092d2326dsm6707635e9.15.2025.04.22.18.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Apr 2025 18:02:45 -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: abab4d9f-1fde-11f0-9eb0-5ba50f476ded DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1745370166; x=1745974966; 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=QBk2Bkks19S53TDx+/MMHfe9z/s9WQXhsbPDXWcJ6Gk=; b=UMwEaKw68htl2NZxRZCqHqyz5XU1JLqQmCWbhQGsW/fDSibnA9Gp/cIls2vDMLEz2c 72s+8aewG3PmAHdZCffpfkE110N7d6vOfyY77Kys5mXMlRKD4v85oXPg6SzutPfr5SBG IcJM1G8woGvnuRzPNEi0LgE9SblLHWV+u4/gI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745370166; x=1745974966; 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=QBk2Bkks19S53TDx+/MMHfe9z/s9WQXhsbPDXWcJ6Gk=; b=iqoUWaOPgdLUNlDLyNAs+QGv5xmQqtTgaCux70X902Jt3mYsIIhskuG423nE6dNYvR kggoNBNIrotSnv4b2VObVlxZvRGYT0S3RY90ujYXIHu0UmauWug6J8I6vGLW8KrxKNoZ +hzZ+qGu2fBYna+TgKwakyJj366iwM1DTJKIHVLJITpK7wrGdNwu9rMqoey/WqaDUqEq +wNhMIZvdjBLmYHY3fGOpU9IMxwa8GEzBu1fPW6yfY43PSi+n+UiwTlBNjFaXcOqjCfE NvDbeFocVYvjvX6WKxUrkW4ZHzmGDjZQttoUc46+p+UzSX7dYRIrLHK28MiJqr24T/TQ OQCw== X-Gm-Message-State: AOJu0YyTjmQcR7nSjtLso+uDnrcshs6LzahY700bwoBCqchWTWf1LtSz xE4Qq699G+4Gdy880vaTiREUOa1G/2KRjmmQ/kTuzQR6BjOM21kXPfpqcvR6mwTLVzQ218NZdYc 1 X-Gm-Gg: ASbGncsvj/q3Pe1mPpgSGqHC0ky9jarxXiWmQRzcaXtCyG+NGzQ+XOp4pbXuWPgpgF5 b3g2uR5xsAb6jZ9QvQsbZn2zeNljmjWjUGdwKulENoWOwXrioJoqt7/qykqTFlNiHtGWRdqaJyi 6SUb1FcGmRM0Nz0d2xo57D+xiFOvp4i50HvkDdC7fWrPjjJflpW39DY8e/PuxHJxBPRWNE8xbcj c7PfgYRzgp9wzSbMuj8h7+Oi13WYTb5mVt9nJ5N9GujdzcG4c/Zl86Ch7Nk2QnH55FfnzhusvOR 2TN5JTCRNh4wyEHiEa0Jh2ZRJLQ6AqFWYSATlBgKHmTiNzpmdloCMBf9DiTmoA== X-Google-Smtp-Source: AGHT+IECRcenPSj7qe5KMmpxDDkvujUjR3cZAXi+zIeQHDXnn5RCoe4eX1JvNdayYhnQ/L4lk0wKIQ== X-Received: by 2002:a05:600c:cc4:b0:43b:ce3c:19d0 with SMTP id 5b1f17b1804b1-4406ac176ecmr146769205e9.29.1745370166523; Tue, 22 Apr 2025 18:02:46 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 2/8] x86/altcall: Rename alternative_branches() to boot_apply_alt_calls() Date: Wed, 23 Apr 2025 02:02:31 +0100 Message-Id: <20250423010237.1528582-3-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250423010237.1528582-1-andrew.cooper3@citrix.com> References: <20250423010237.1528582-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1745370191746019100 The alternatives APIs are not great; rename alternative_branches() to be mo= re precise. Centralise the declaration in xen/alternative-call.h, in the expectation that x86 won't be the only user in the long term. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 --- xen/arch/x86/alternative.c | 2 +- xen/arch/x86/include/asm/alternative.h | 1 - xen/arch/x86/setup.c | 3 ++- xen/include/xen/alternative-call.h | 10 +++++++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c index 1ba35cb9ede9..d1a3b7ea7ca6 100644 --- a/xen/arch/x86/alternative.c +++ b/xen/arch/x86/alternative.c @@ -493,7 +493,7 @@ void __init alternative_instructions(void) _alternative_instructions(false); } =20 -void __init alternative_branches(void) +void __init boot_apply_alt_calls(void) { local_irq_disable(); _alternative_instructions(true); diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/= asm/alternative.h index 2d2ace97f794..29c3d724b07f 100644 --- a/xen/arch/x86/include/asm/alternative.h +++ b/xen/arch/x86/include/asm/alternative.h @@ -29,7 +29,6 @@ extern void add_nops(void *insns, unsigned int len); /* Similar to alternative_instructions except it can be run with IRQs enab= led. */ extern int apply_alternatives(struct alt_instr *start, struct alt_instr *e= nd); extern void alternative_instructions(void); -extern void alternative_branches(void); =20 #define alt_orig_len "(.LXEN%=3D_orig_e - .LXEN%=3D_orig_s)" #define alt_pad_len "(.LXEN%=3D_orig_p - .LXEN%=3D_orig_e)" diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index cf1ea040dd90..25189541244d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -2082,7 +2083,7 @@ void asmlinkage __init noreturn __start_xen(void) =20 do_presmp_initcalls(); =20 - alternative_branches(); + boot_apply_alt_calls(); =20 /* * NB: when running as a PV shim VCPUOP_up/down is wired to the shim diff --git a/xen/include/xen/alternative-call.h b/xen/include/xen/alternati= ve-call.h index 39339c3f0f76..3c855bfa44f5 100644 --- a/xen/include/xen/alternative-call.h +++ b/xen/include/xen/alternative-call.h @@ -17,6 +17,8 @@ * generation requirements are to emit a function pointer call at build * time, and stash enough metadata to simplify the call at boot once the * implementation has been resolved. + * - Implement boot_apply_alt_calls() to convert the function pointer calls + * into direct calls on boot. * - Select ALTERNATIVE_CALL in Kconfig. * * To use: @@ -57,7 +59,13 @@ # define __alt_call_maybe_initdata __initdata #endif =20 -#else +/* + * Devirtualise the alternative_{,v}call()'s on boot. Convert still-NULL + * function pointers into traps. + */ +void boot_apply_alt_calls(void); + +#else /* CONFIG_ALTERNATIVE_CALL */ =20 #define alternative_call(func, args...) (func)(args) #define alternative_vcall(func, args...) (func)(args) --=20 2.39.5