Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1376192rwl; Wed, 12 Apr 2023 11:50:28 -0700 (PDT) X-Google-Smtp-Source: AKy350aMiSCOfYh3Z/hoId2Bwc7OGyz1fQrNd+jQ4SRj7wPAsTNp/+mi4xXCT5pU+Ah8a7qysqI2 X-Received: by 2002:a17:903:2346:b0:1a1:aa28:e67a with SMTP id c6-20020a170903234600b001a1aa28e67amr10482476plh.48.1681325427851; Wed, 12 Apr 2023 11:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681325427; cv=none; d=google.com; s=arc-20160816; b=xFLRLYQFzOv9FyN9AXyJI1fQTso3FJOsXsXgjuwHjnpuo01tbUIm4IdplfrTLM9vmh 5jner6HihvQ7O8n507oQPHV+cUaxGprufCs8FhPMyo1wNOMk0AkxnMcuwEoajPM2GiIY WvsfQrTfY4/S5KNQDtVU73oj6dqcpqC2jcCV+Q/m1Ady9O5oAdJRSEz17P6m6Gt7E5in +f4cqhytAf7ZO/Zyt87nUgEmNhznOo1aZYwgrTheOk6ayA+VO+8qaCKlQCCM+wGth7cg bf/IBVoYT35bWeYveaTCca9xu9ZA/ysiMyzsMJMYxONM/HnDb2AH2kFq+jkS4ngSmxbN Z+vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+yYB+UjJ5L6aV3imoGiJTko2w0CvVVRSooT6AuiAzyA=; b=KN/+POgsjGR5YrvRC7TTppZO5WpH2qpJoMNRjp8uo0ezktP4ay8SYp8gYaCZkdd/jM G2+7B/9Atwv6qpQTigmeUPI1wz/ENVDvG8TE6xzp0prNMfRhRFtDT7TPAwS26kkA3PmK Q37hUJ94IlK4Akqfs+VWVmA8XRqdSQBluD0/a5p+S9H4+CXEbqj0ug+riggogKz5rYGX YUbSF+zTwPlFOQsK1NGa41EwrYfiakSJ1pOCTXDKnMyIj2BBWBjti42GQLVGlBRA6xTt /EOarW3AMPwt1JFONeQ/hddC4gqdu+sOdSCphnNQxXCXxc0qzqobhOVaP39gRAWKN3tq s4WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UPBfEiuB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a63e843000000b0051372ec9316si12492738pgk.166.2023.04.12.11.50.15; Wed, 12 Apr 2023 11:50:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=UPBfEiuB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbjDLSpR (ORCPT + 99 others); Wed, 12 Apr 2023 14:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbjDLSpL (ORCPT ); Wed, 12 Apr 2023 14:45:11 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADF4B61B3 for ; Wed, 12 Apr 2023 11:45:10 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-1842eb46746so14785314fac.4 for ; Wed, 12 Apr 2023 11:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681325109; x=1683917109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+yYB+UjJ5L6aV3imoGiJTko2w0CvVVRSooT6AuiAzyA=; b=UPBfEiuB141JD/GXIrwt1YK0IqNU31AQsFYZPMxST7mtTUkUIBz3ZeAm4bS3Pk5j0f n+A0ASxR98pgRMV0FPqJo/FUBmSaCGvGOhEnmb2MSDDUxCfFPb2W4xW2HwZQeor+EC4o pVmfVfIu4DJC8gOR0L/mRn60h9QGKrwqsQB6Z6Z6KsFCxHGz+F+9gBTTm6m0lrfavKQF R9Cr8FFG+UzTfnQr0drhQYNUVWUshzRjPE+rSLpFSUDmRbJuoa/ZWeEEn1Jb3SiC8rO+ FHhEewf4EdlsrOsogtmESpZOLk68uoU9tO2oLLQymnmJP20+WAiQkZqg8ukHFFxIAfAs ATkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681325109; x=1683917109; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+yYB+UjJ5L6aV3imoGiJTko2w0CvVVRSooT6AuiAzyA=; b=H7UmIf2/m7y0qtMa2BwadG0QYCdlDNQLp2VN247Ola9C+BmapnqBIY9aFQOmjuCP3S Z6vTs6XLha+vHWTWdNdU2KV2BJjiHJjduX8kndaBTHpxj7KZ1DoUzzTzo05ah0p/RgD4 Ag9vzEWuev4fDyAK3GsNHI+Ul4kDekrE+J9IDjlljd5PFc8MeVCzthg23NbAE0vwEU14 KCpquOdPVBoAWTYNyeJ8ssYJIDbNgBQKm7r+QhPRbHa5h1FbDrrsWTAeg84vlpiT9KEL wXmLLcsKgURJLSiWsHEYGDQGfQs3xQfoda2Nh7d9gmn9+lrOXZFjNOuEhwy+6aqa9XKu CBbA== X-Gm-Message-State: AAQBX9e+9r/9HvqPIHkR1H1R6pyE0JJhaqdLOoouJkwXyJfO+NOcBDqH 9heOqfFrWoeIRK1rKJWuqXobm5dylA== X-Received: by 2002:a05:6870:969e:b0:180:13a4:425e with SMTP id o30-20020a056870969e00b0018013a4425emr4222567oaq.30.1681325109407; Wed, 12 Apr 2023 11:45:09 -0700 (PDT) Received: from citadel.. (075-129-116-198.res.spectrum.com. [75.129.116.198]) by smtp.gmail.com with ESMTPSA id w24-20020a9d77d8000000b00690e990e61asm6706020otl.14.2023.04.12.11.45.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 11:45:08 -0700 (PDT) From: Brian Gerst To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Borislav Petkov , "H . Peter Anvin" , Peter Zijlstra , Ingo Molnar , Brian Gerst Subject: [PATCH v2 0/6] x86/boot: Clean up handling of boot_params pointer Date: Wed, 12 Apr 2023 14:44:56 -0400 Message-Id: <20230412184502.145289-1-brgerst@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On entry from the bootloader, RSI contains the pointer to the boot_params data structure. The pointer is passed to x86_64_start_kernel(), which requires preserving RSI all the way though the early boot asm code. Change it to copy the boot_params data as soon as possible, which also has the benefit of not needing to remap the real mode data pages if memory encryption is enabled. Note: The memory encryption changes are untested due to lack of hardware. Brian Gerst (6): x86/boot: Move sanitize_boot_params() x86/boot: Remove extra call to copy_bootdata() x86/boot: Clean up get_cmd_line_ptr() x86/boot: Move copy_bootdata() to very early boot. x86/boot: Use copied boot data in __startup_64() x86/boot: Use copied boot data in sme_enable() arch/x86/include/asm/mem_encrypt.h | 4 +- arch/x86/include/asm/setup.h | 9 +++-- arch/x86/kernel/head64.c | 59 ++++++++++------------------- arch/x86/kernel/head_64.S | 26 +++---------- arch/x86/kernel/setup.c | 2 +- arch/x86/mm/mem_encrypt_amd.c | 61 ------------------------------ arch/x86/mm/mem_encrypt_identity.c | 42 ++++++++++---------- arch/x86/xen/enlighten_pv.c | 2 +- 8 files changed, 58 insertions(+), 147 deletions(-) -- 2.39.2