Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp558986rdb; Thu, 22 Feb 2024 11:55:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWoqM0mPzG/CIW7p68n/Q8W/JBygYKbg2/P0YwR4j6/R8goAn3RAupGfnuSIJaCmzdhH3b+j4zSdcwQ1Bs+8zMNVK1xBe/TjI37oD+Big== X-Google-Smtp-Source: AGHT+IF9cwOrhZNkycS0IWFbcMaae210arZDaLIk0SyrB5Gx2mU4ezmTeq4cFYS64ctDuFn+FdPu X-Received: by 2002:a17:902:d48e:b0:1dc:1e7c:6dd4 with SMTP id c14-20020a170902d48e00b001dc1e7c6dd4mr10470382plg.68.1708631758222; Thu, 22 Feb 2024 11:55:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708631758; cv=pass; d=google.com; s=arc-20160816; b=qrj/5Qn0BSGEzXWj/yzGAmQj1T90F/RX/RsD1dUuUjpxRD94N2wO9i/A3lWD4dsWv3 GXkY+Tahzh0uWIIYe79k9aXzTlljWDHM3NkQET/wWq/yCpmuel/+M/p8U3YNLw/kZ1ok oKdm2TlJYP0WJ7PUeurQ327tJa4uPlLcivP++DEDLsYrQtWPyvVe8k/tmq5d926Vr4Ir 3S04K/hIwlv54YhF92IHSxKVewcv2Xp68S0aHTW7pfRdAHYMMPFmyuC04O2RnaSCA9Bb f5Kr5ZkQm40GKOCgsxsL8upz+JS9MDe4nguw3AKScyRVoOF0o3Z+/qKtJ9fdp+wYStyo MmHA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id :in-reply-to:references:date:from:cc:to:subject:dkim-signature; bh=obDj8eqK/ZYdMdzQOof2KYJRL+yChq1JoyHapq3K/N0=; fh=HUgOPOMLUPcroonsK10/uEWpbBCP57e0QFUoVmMwghQ=; b=mx9cMXky3FAnsVQtYQJPjyXZcb0QaetFFN2MlJJYPe7aY0erv9ddFAu9gvxKB923MU 0r86GMyDK+VWDjEveaxAFjFDxfZEHWMOVRVZNARqtISnTM19luTzcosu6ItPxxNKjJVF H+sGbKzqIGou/MWIKrnpC8sGNkX2P3wmn9uOSxhBgl6/673QCdjDo6aha82f/POoXUha L4lU7j1HKSMwmLLo++tlFsH9QD519l6ZnS2ZHEjqBloeLy2Bl3B+KlyxJBQNKK9BJ5Ia CnJ+F0tdkAV4S9p8ZydY2U8Z1obg/SXjoPJ5k0wqxhcBmTiCvLuKio9hOBCI1ZslR59T 4nmQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TK4MxH1A; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77164-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id mc13-20020a1709032b0d00b001dc6233ddc1si652271plb.557.2024.02.22.11.55.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 11:55:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TK4MxH1A; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77164-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77164-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C9008285906 for ; Thu, 22 Feb 2024 18:45:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 31ADC73F3A; Thu, 22 Feb 2024 18:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="TK4MxH1A" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (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 7F66373F00 for ; Thu, 22 Feb 2024 18:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627182; cv=none; b=Hn7MzfpHvTmPpWOdcabnRACtTpoXMWAtYhdIn1h+WmKGGRJyVeMozIGLDuyvQEXyZSnz6ozg7P7fSn7iU+xjzB2t7wI65bNMt5u/x8mXa+YHi1cXLW+SdTfZPdUd9sI/LVzlf8DPgGAx03HizRail7cmHgpcwktnNajs3TF7pSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627182; c=relaxed/simple; bh=QA4nL+IB5LTiCN1WiRhJJReXahalUQ3SRSOkHWOGUt8=; h=Subject:To:Cc:From:Date:References:In-Reply-To:Message-Id; b=Dcp1cUC5P4IARULEctqMd1bJVXFug561eo/5XuFBjw3eRgiaHdxEqql785mym/fZq4DQTVfSUZKwNoZmtteM9sh4mNLFZEEsK3lI0NZQWKRvJAVigGHEim+KRMhItepwHUqyHosY9j2AJwZkG59zAplJ0Ty3q3F/U+ScOwXGY74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=TK4MxH1A; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708627181; x=1740163181; h=subject:to:cc:from:date:references:in-reply-to: message-id; bh=QA4nL+IB5LTiCN1WiRhJJReXahalUQ3SRSOkHWOGUt8=; b=TK4MxH1ACISlPqEmR1W6iiTwv/3nrkrtpcK3fiNCXXm/khZ3+SXn2Egz FdUl4jhieZv1V7FiyjSgUjxu7Xz0bWp//AlhZTeH0tnVhV/pLoPCpZlVo 5IS3XMzPR2VfyCQ9qalSMlxFmQNDz7q5T6G8Xq0MGY11K1qvjOqONzzIy NciDktEfrGVQeWHSrVbAAdBPveG/uxMQ+tQT+SE58wCVqNuAN11FNiOcI ikklbMILa6+DFrefswLiRO6S2Kq4xxRSI/nC+IVdPQKvHprL/A5Cl20J9 IJdvi0+VhlH+Aopo9gOnbrCrv1RX0vaBAx6ZLgeto2jPr/eRFdicMKy6m g==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="3031759" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="3031759" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 10:39:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="5975474" Received: from davehans-spike.ostc.intel.com (HELO localhost.localdomain) ([10.165.164.11]) by orviesa008.jf.intel.com with ESMTP; 22 Feb 2024 10:39:41 -0800 Subject: [RFC][PATCH 10/34] x86/cpu/amd: Use new "address configuration" infrastructure To: linux-kernel@vger.kernel.org Cc: kirill.shutemov@linux.intel.com,pbonzini@redhat.com,tglx@linutronix.de,x86@kernel.org,bp@alien8.de,Dave Hansen From: Dave Hansen Date: Thu, 22 Feb 2024 10:39:40 -0800 References: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> In-Reply-To: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> Message-Id: <20240222183940.4F44A1FF@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Dave Hansen The AMD memory encryption code is currently one of the 'boot_cpu_data' field twiddlers. This has led to all kinds of interesting ordering bugs at boot. Move it away from random fiddling and over to 'bsp_addr_config'. Signed-off-by: Dave Hansen --- b/arch/x86/kernel/cpu/amd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff -puN arch/x86/kernel/cpu/amd.c~amd-phys_addr_reduction_bits arch/x86/kernel/cpu/amd.c --- a/arch/x86/kernel/cpu/amd.c~amd-phys_addr_reduction_bits 2024-02-22 10:08:53.340644930 -0800 +++ b/arch/x86/kernel/cpu/amd.c 2024-02-22 10:08:53.344645087 -0800 @@ -622,7 +622,8 @@ static void early_detect_mem_encrypt(str * will be a value above 32-bits this is still done for * CONFIG_X86_32 so that accurate values are reported. */ - c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f; + bsp_addr_config.phys_addr_reduction_bits = + (cpuid_ebx(0x8000001f) >> 6) & 0x3f; if (IS_ENABLED(CONFIG_X86_32)) goto clear_all; _