Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp416892lqh; Fri, 31 May 2024 05:38:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWuDBCELGa5pgdJMx5hvq0DJso3FHvkrFhMT0vyUHDxh3oHvuTKu3LJD4ZW5opZ/S3UlgFjKON/FqVTi1Spl5iVdGfzuscCY4DFWSHvYw== X-Google-Smtp-Source: AGHT+IFffWa9vjtjcjKsrv+SZiFhuWk9smFKJgz8QLIsFfqaRJXKhQ3TFgMRa8wfyHy/astljogg X-Received: by 2002:a05:622a:134a:b0:43a:f441:75ab with SMTP id d75a77b69052e-43ff52702femr18725411cf.22.1717159100282; Fri, 31 May 2024 05:38:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717159100; cv=pass; d=google.com; s=arc-20160816; b=ubgu9a2X2O8JwicqKig70L/K24avux66n+wt2cY2SWWkWR1YgTLrzkGbuvQJcdxO56 56US2Fn3GjQOvKmFdRBoZB554KpmR8dltgR4JCcaRaYewiKTQ8OKTFD6UYl0wHTPgb4Z b+ua/Jew3AQOR2boz00jexif+UQPBLOceC6ygG7QIpfoCnYP6aBfMLU13CaqGuKkEQjs wkY4EKedL7FuHXpm9ViWknht+4BimpX0QCo/T8c9504QtsO4yyKznpru6/RwwfVlkD4D 3cT0ynpMP5EIbqHFUF39aaCnh/mPxh1UcdvjT3NrRzn6KBpR77+o/nOJoOfTMXmEJ9JG rW4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oYOKHbzb3UWt6bMuTN9QAjjm9Sjdw3wMjNjif6RUauA=; fh=b+GcvI4Pcayc3mqYGvUYD/O2AEP50jeeZwnwIXNAGVQ=; b=OlItTCa8orut5KmCvOKhkbZxGZ+uvjkD6TNrbHQxo9f43X6f90AEqPWfS3bl9dgJZr 5IIRV65YDD2W+H7VqOomEcLIlqNYCA0sXWqF7y3D9P3GyHsdMYamyCe8/HhKWuQrisIg ansp4ObhYdnGABS2IC70NxODDb6PB1Cl8ft8xYu8A7kLp3beFHMxTNG9Zx3hkUAHCqmS a8FLrVMhuURGwYtorAYvSYdRgej3JBQrh/sJunS3zF13397D4rjTgf4tOalWijmvIQvI Fa3aR88oBKPtfdFIVqIQvEvUVR9CT4idrhdkxHS3V6f4Zuqf1uErSXBOZJPgEoS7G+fy olnA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jY6J2Q65; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196796-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff23ac197si19651591cf.77.2024.05.31.05.38.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 05:38:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jY6J2Q65; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-196796-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196796-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 834EC1C24987 for ; Fri, 31 May 2024 12:37:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90FC117623E; Fri, 31 May 2024 12:35:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jY6J2Q65" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE5FE1761B8 for ; Fri, 31 May 2024 12:35:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717158928; cv=none; b=UpBd8kDm5iAjrmzJcgxAggIu6LJ2FqYzB2cLobn2rCEdxS1gyBLWj/MQpNe7TaKboeQ7HUJRoVcQhn2ojhjmz0TIkLo8TSiDDltCgFDla7DO54r1g70LJUL+bGwhQbf73lKnrMEJNLZSMsnWXNrkW7tGTPxItVhMr2YyGHsrwn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717158928; c=relaxed/simple; bh=RVWUpI+ztxW7eltxB+4LrpXND84Y22vsqge4eJbKxJY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t0qU/qsoVTpzRQFgqGu2u69vyeoK6sEhIDAfvaXPjjZn7EILo0ivJ/j9srIJ+wdnpNVwFRO3cHIKDG9wR7AToJ9di+e0CZeiIRwTVAu+VALwtXBSfCHt5gx9z2bD2774fB0dlR6oMSxE3UU92QOK7f17cOgjqjFEoq0dgRgGQ+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jY6J2Q65; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA65BC32781; Fri, 31 May 2024 12:35:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717158928; bh=RVWUpI+ztxW7eltxB+4LrpXND84Y22vsqge4eJbKxJY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jY6J2Q65F3fsacyYB4He5iDuCWRQZ+MMv00KcUN/h+x/JzPVLcJeMKfENjmIdb2Dj F9D1dH+wBzGH3ESctPFdLwcWi/1lxaJtKNqVjoxSJ5/e+J8cZ+XzgUPGY029buSfTw JLoRYNllgilzIP34f+qQ3Tueym7otnHmOBSnHmaxkBr3LqDCZsea86uPA8tMTYKMXY UkioHa5eCpM3WK6njjXOfGMbEyr+TqEVDdhmZ3/duGhn2VNmZj87FfPCP4vWvWklZH kCe/FK/3QPzywsUDYtXon3tke6n+g8KZXUDcCSJf2euJIZjwWVbcsjupHNH9Oxhi5H Q46fcMdIlCekw== From: Borislav Petkov To: X86 ML Cc: LKML , "Borislav Petkov (AMD)" Subject: [PATCH 10/14] x86/alternative: Convert ALTERNATIVE_3() Date: Fri, 31 May 2024 14:35:07 +0200 Message-ID: <20240531123512.21427-11-bp@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240531123512.21427-1-bp@kernel.org> References: <20240531123512.21427-1-bp@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Borislav Petkov (AMD)" Fixup label numbering too as the new macros have new label numbers. Signed-off-by: Borislav Petkov (AMD) --- arch/x86/include/asm/alternative.h | 24 ++++-------------------- arch/x86/kernel/fpu/xstate.h | 4 ++-- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h index 73ee18705ef1..0df99855e003 100644 --- a/arch/x86/include/asm/alternative.h +++ b/arch/x86/include/asm/alternative.h @@ -277,26 +277,10 @@ static inline int alternatives_text_reserved(void *start, void *end) N_ALTERNATIVE_2(oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \ newinstr_yes, ft_flags) -#define ALTERNATIVE_3(oldinsn, newinsn1, ft_flags1, newinsn2, ft_flags2, \ - newinsn3, ft_flags3) \ - OLDINSTR_3(oldinsn, 1, 2, 3) \ - ".pushsection .altinstructions,\"a\"\n" \ - ALTINSTR_ENTRY(ft_flags1, 1) \ - ALTINSTR_ENTRY(ft_flags2, 2) \ - ALTINSTR_ENTRY(ft_flags3, 3) \ - ".popsection\n" \ - ".pushsection .altinstr_replacement, \"ax\"\n" \ - ALTINSTR_REPLACEMENT(newinsn1, 1) \ - ALTINSTR_REPLACEMENT(newinsn2, 2) \ - ALTINSTR_REPLACEMENT(newinsn3, 3) \ - ".popsection\n" - - -#define N_ALTERNATIVE_3(oldinst, newinst1, flag1, newinst2, flag2, \ - newinst3, flag3) \ - N_ALTERNATIVE(N_ALTERNATIVE_2(oldinst, newinst1, flag1, newinst2, flag2), \ - newinst3, flag3) - +#define ALTERNATIVE_3(oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2, \ + newinstr3, ft_flags3) \ + N_ALTERNATIVE(N_ALTERNATIVE_2(oldinstr, newinstr1, ft_flags1, newinstr2, ft_flags2), \ + newinstr3, ft_flags3) /* * Alternative instructions for different CPU types or capabilities. * diff --git a/arch/x86/kernel/fpu/xstate.h b/arch/x86/kernel/fpu/xstate.h index 05df04f39628..4fe8501efc6c 100644 --- a/arch/x86/kernel/fpu/xstate.h +++ b/arch/x86/kernel/fpu/xstate.h @@ -108,7 +108,7 @@ static inline u64 xfeatures_mask_independent(void) * * We use XSAVE as a fallback. * - * The 661 label is defined in the ALTERNATIVE* macros as the address of the + * The 771 label is defined in the ALTERNATIVE* macros as the address of the * original instruction which gets replaced. We need to use it here as the * address of the instruction where we might get an exception at. */ @@ -120,7 +120,7 @@ static inline u64 xfeatures_mask_independent(void) "\n" \ "xor %[err], %[err]\n" \ "3:\n" \ - _ASM_EXTABLE_TYPE_REG(661b, 3b, EX_TYPE_EFAULT_REG, %[err]) \ + _ASM_EXTABLE_TYPE_REG(771b, 3b, EX_TYPE_EFAULT_REG, %[err]) \ : [err] "=r" (err) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "memory") -- 2.43.0