Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1262373rbb; Mon, 26 Feb 2024 04:13:40 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUzJ19Yvt+ie+7L/X3LctZtBnv1WfEAMnFVoGy9lgV7jli0sqgT5rH+luLkMPkxkEF/KTF8PBJqbDiwd5JG5kLcNunVZLZgdw1T9zJHGw== X-Google-Smtp-Source: AGHT+IF38Mu8NuTTHj3z/w6zq1AwmeWzsbDgm2ELg56tFKDNSUf6wU+USVXmqxYnNa/dhLJmxIcI X-Received: by 2002:a05:6808:120a:b0:3c1:9315:85ef with SMTP id a10-20020a056808120a00b003c1931585efmr5893810oil.29.1708949620116; Mon, 26 Feb 2024 04:13:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708949620; cv=pass; d=google.com; s=arc-20160816; b=y9wbUNWhvejIJrW+XYkND7saBbNqGHGHyf44aHWylq6nNCR9WlWkuL7ncY69cI0nWD akqKdpT3Rlael50BfRHNs77hQaEx9HRUvUL8A2lproNBIZPK6rPCEcxeo5u0SvFmxCo2 HyKr9kAJ2CSV5os9uz4AeOzR+BLghldbLZOa/+s+yMumVUcLEjCl3d2mO7xOk3COrw8h PYT2S/5ArT7z8wVY5pf9HhAYVyu3lTkhNPrHBkcVN8v6EU1Bi57XadQyUdJezVfAegG8 k43xTGgA5yi8wJoR3uRGp4hSl/TG/Ca5YFGm11M2CH5H1BxrT2b5QZQMy13bZzlU3e/H HLdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=06BzHTpbA/22NpYtuS1jT3qMyjxhGzvHErj1VnfhLOc=; fh=mh/EFXDyWz6SYA4qEbcbMgOZ07AT4DlRJonTEXgTb50=; b=Yfuv6QSLfYnkOdoEbs5L6SvqDlo7C7uehMh+dhAXVfTcYHBTS1bbPNYCKzWel3veJB IWk6ZzfxaWa9siGdDiQlsycBQIasw712kwAsbK4QhZEwLnFGjjZSBvW86y2QoaIRBgbk 2E1UqJNHzkgsmgKhORFR7Med1j9vi+ibJoC5aBz4UbmzdLmaK0U9gN8GiXjOM+HtNatP a8V0r5SaXMqJFouWA+cEIDG8NGtP72H4PRnpY29gRV/KCZrkjxUGxl5EFDmn4OqMefXC c1IM3kfrHw+YgPsi1hi1LyFMbhEQccIJSpuhTG1C2Oub86ZRCrKR8yWtddirR91x8qQE XdrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="j3W/T6T3"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-81344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w10-20020ac8718a000000b0042e7f2d4bf8si2659895qto.163.2024.02.26.04.13.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 04:13:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="j3W/T6T3"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-81344-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81344-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 C8E881C284CC for ; Mon, 26 Feb 2024 12:13:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8413C6087F; Mon, 26 Feb 2024 12:12:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="j3W/T6T3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="CPPddy4G" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 2EFBA605A4; Mon, 26 Feb 2024 12:12:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708949571; cv=none; b=ooR20DtiywrCDpcgPsVrBFm8XG9OdTbYa46+nOJNb3yz6T7VXx5VXsXvYP2j6xHrdastIK82//mEyoFSnjFOmMGhzlf5YTFajbIH1Leb3rWMsevkfZjCq+0uR288Fd+q7S7Q7XHMUdPDdT6Cq5G/htCJs3N+oAG2JgasPGVJn3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708949571; c=relaxed/simple; bh=M3zALqseM1xjDZx+ABhJazwOHjpUTiVSF2sLLX/zrZc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=MqFaEYkRf2gCQyulIx1N0eHlYR7IY4CIlCwr0YdgUNwCwcmpdjl1RPqQcGnv5pj1GqeZNIqN1D8i/exfgajPVSkEqHVfzX/PTriDcLvtH9pdWqqXlTmEd4VG46pAi1elhA24oxondOa+lNvLp6ysBO9Y2cBj+MYSPvBuOm5vTuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=j3W/T6T3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=CPPddy4G; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 26 Feb 2024 12:12:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708949567; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06BzHTpbA/22NpYtuS1jT3qMyjxhGzvHErj1VnfhLOc=; b=j3W/T6T3qmgcT6NuBU/TMyN/59caj/kDoI+vd2ItnyO9+sNnnYUuKo6xwktZfWx+NeraW4 DHpocK4tuZUJeWJ/hIBfVIfsrvCzy90jBGMCFacuO9Ixr3PblDGIcvxsh6QOiMaLpF9HE+ AM7Rr5pIjllijwTp6dqn1JAl/XgItvj/fa6anvSuzn3R90UaAzCVY2wqbKFRZyxKjbb2hZ bUyTnt00HLKvQKh07wR1WZZX3EdyuHkbKP6RDazav2ayurc+/A0gDw46Dst3k9dlOe+m36 oRoJ+u9Rej/djZwu8APS4qyuAaSIrjq1+Wx724NBkQoEzfCLCShuS2igF4sDnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708949567; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=06BzHTpbA/22NpYtuS1jT3qMyjxhGzvHErj1VnfhLOc=; b=CPPddy4GBvmkuchGpQ3XAcetsXnaeApV7DnX2yAZtvy3HKHmAHK7i1hAwCVZkfUMXmV59n Z+7ZasEvnS0OW5AQ== From: "tip-bot2 for Ard Biesheuvel" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot/64: Use RIP_REL_REF() to assign 'phys_base' Cc: Ard Biesheuvel , Ingo Molnar , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240221113506.2565718-20-ardb+git@google.com> References: <20240221113506.2565718-20-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170894956714.398.18401706511421124908.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/boot branch of tip: Commit-ID: d9ec1158056bedb6da8f4e02de30d300914b31f8 Gitweb: https://git.kernel.org/tip/d9ec1158056bedb6da8f4e02de30d300914b31f8 Author: Ard Biesheuvel AuthorDate: Wed, 21 Feb 2024 12:35:09 +01:00 Committer: Ingo Molnar CommitterDate: Mon, 26 Feb 2024 12:58:35 +01:00 x86/boot/64: Use RIP_REL_REF() to assign 'phys_base' 'phys_base' is assigned from code that executes from a 1:1 mapping so it cannot use a plain access from C. Replace the use of fixup_pointer() with RIP_REL_REF(), which is better and simpler. While at it, move the assignment to before the addition of the SME mask so there is no need to subtract it again, and drop the unnecessary addition ('phys_base' is statically initialized to 0x0) Signed-off-by: Ard Biesheuvel Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20240221113506.2565718-20-ardb+git@google.com --- arch/x86/kernel/head64.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 1d6865e..f98f5b6 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -192,6 +192,7 @@ unsigned long __head __startup_64(unsigned long physaddr, * and the address I am actually running at. */ load_delta = physaddr - (unsigned long)(_text - __START_KERNEL_map); + RIP_REL_REF(phys_base) = load_delta; /* Is the address not 2M aligned? */ if (load_delta & ~PMD_MASK) @@ -301,12 +302,6 @@ unsigned long __head __startup_64(unsigned long physaddr, for (; i < PTRS_PER_PMD; i++) pmd[i] &= ~_PAGE_PRESENT; - /* - * Fixup phys_base - remove the memory encryption mask to obtain - * the true physical address. - */ - *fixup_long(&phys_base, physaddr) += load_delta - sme_get_me_mask(); - return sme_postprocess_startup(bp, pmd); }