Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1279429rdb; Tue, 30 Jan 2024 13:34:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHahY+yfKrOFGtgvWpJXKGtEAcOwUCVB1MGNsjZ2h6NbF+ErS4cmZf+AqIL8bt8C3DQtTE5 X-Received: by 2002:a05:620a:6016:b0:783:f8aa:7546 with SMTP id dw22-20020a05620a601600b00783f8aa7546mr7682397qkb.28.1706650446996; Tue, 30 Jan 2024 13:34:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706650446; cv=pass; d=google.com; s=arc-20160816; b=K5o+n2vseNWcVd8CH+x8GUmC84D7O2ZWoKUKrwUpkvxlHjK5dV2L7+c6f45wVTNcBZ 9T4W+uF/4yoZEh0xx4vAXYOeMNmpc7AHCH4Rom4cDBOIQJiRAe+fBMhhpSjf+Zmu/F8Q faqlcZAOtuzFWMki0lJ1i7XpaoH5/i9dW+J9Vn0C2IdwP3KQ/euiteBcePoO7g3vkUI6 kCXsWwWfMRwecCXXuSkq6clZzrnG1ZqlmWGTyqF4xot0BLnVNA1D5+5wJTmWuq8nU78v EmMbDdWCmp5Qm/hW5MyHRUQfJBuOIDwZhStJgrWc5NNVUr52g1Qs++UQu2x1QvkFjPTC 8zmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=bNWTXXo6dsYOEd4Hka6WAzAtUkzwLrlQBpZ1dE53cfQ=; fh=Ve3NzcvS4k05kWF2k1T+BsxfdAyIny2lCKsVPO61xBQ=; b=NzmXp3RJN3fuaJ+8mbjEcEg01SBBWAsmj7/Cptb3FIGAK+KGP66h8pgGqdn3PB4RXq 5NifdlKtMibV18SdJj/puio0WIMerCooXVKxza13eImItIVrd0KVsrkONNwOXWYN2hBK NuBDr07o+9Z4tyDohvIqh3AF6S2hwdS4udipQqSRneIf8+ZeNIoh1RY+g58lQ0fy7zBy kxlnHv44m5X8PJse2OPGesfBd2InKaJg/cQWth4gFq2bw97wCBYRt0nfZI4JenoyKd2C hwcNPPcpfQx4ih33xcAcEArM8IZ33/okjPOt6aZwDNyF6I0dLA8KXXwccTHNdOV6lt3c /qhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=O7087ZLH; arc=pass (i=1 spf=pass spfdomain=flex--jacobhxu.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dc8-20020a05620a520800b0078330fb7fa8si10978383qkb.375.2024.01.30.13.34.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 13:34:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45334-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=@google.com header.s=20230601 header.b=O7087ZLH; arc=pass (i=1 spf=pass spfdomain=flex--jacobhxu.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-45334-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45334-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 878F41C22118 for ; Tue, 30 Jan 2024 21:34:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 536B878B58; Tue, 30 Jan 2024 21:33:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O7087ZLH" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 281FE76C96 for ; Tue, 30 Jan 2024 21:33:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706650438; cv=none; b=cIRsDo+BKy3kjJxababIpeq+LpQcaNSAyf8FaisgFN7Q9xbfyqDQMqtXDvXdmZ+Ln+rPRlICiRx70mnHz/7jXS2vUabt6AmxkkLZ4nETTSRTe8hSLCHqbvqg8ABNuImkAdtCmK982VSF+Z2LkTjMWCIOyGLyEUanPNw1jOeyi8o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706650438; c=relaxed/simple; bh=bNWTXXo6dsYOEd4Hka6WAzAtUkzwLrlQBpZ1dE53cfQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Y0GhP+46Ns7ZhZpLWXRJeb0OdEoSf9qDBV3ZdSp56fnHBGJtLPiGEvTtfU+yicwymp6iLO3TYDaYvDEEOxVdGADRZRSTznCfaQVRmSXf9KORnUS+4pzL8Z4glKXKaKneyVZ5hAmFOns8e0Tp5yBCdrzFLQODiBm6HHA64a4LWSs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jacobhxu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=O7087ZLH; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jacobhxu.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc693399655so3463910276.1 for ; Tue, 30 Jan 2024 13:33:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706650436; x=1707255236; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bNWTXXo6dsYOEd4Hka6WAzAtUkzwLrlQBpZ1dE53cfQ=; b=O7087ZLH6aQG15h+eLZZdDiXTpYjfYV64ax4GoZ7D3DkcCjKaghOEYfCTEmfEjxJIz emUbdgzX6EXsa9ung10LQ2CBPcAjBJMufXsn8MeCBuc3HZr9qS45Q/jPKCPhERfm4L8b u9i3yoBblIckayRGbI62Dl84cRuZF3ESCPIQKFrFYhoQEFH5G+2joJkrd22Z9XVNHxY/ E6fUe3XNCLKxwMUW53w2svok3qXQHM837OjgOc+orkURt/92DPsULEAv5GucCh/+oSgU pq9yQZtfVxysJ+gq/iE6MTyw0yc5aSi+MNoCvCt5Ixl3KfrlJxNapSEPS/2SbKQF1FoC mm2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706650436; x=1707255236; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bNWTXXo6dsYOEd4Hka6WAzAtUkzwLrlQBpZ1dE53cfQ=; b=WVScZZRkWbXYgWuM0mGqCeqdelLbr8/k+gzxA4fhYbcEWqWoY4jE5dbILzg5tCQjJG FMEIMsgzXa+6WSTaC3sLR2nlJ3c0mO+rjChT+3xXIV/b9771Y5KZKE3yO0XAmmYyT8Q6 tlKrizEHEApuNyJ04iZGjBjsDokBDjBeipw28BxhFX2giLOdnQ9KMh2MZlngu4vHojTb dQ4JbwQnPFSKQpKM/j4O3bSx+ScgLPz/Qt/lrs41lams+jz2M4KQgL/uMW/PsYJR71sd GsQ9mmb3klRqXG4TlgvTh4NSZEGEYkfOAyNWaeRAzcosX99nle9n3TtH10xlA6xEDkcn ub1w== X-Gm-Message-State: AOJu0YwLx6u3YLobFYlzlwo9mr8T5kFq7Tb/k941gujxEJfNVuIowuo6 RCu5BCBhFjRkCzpCQiUJ8fN/FU2IUqTwiXlTQpyp54+uKKqO+291xZX/xTjQz5E0ymf80lMQ0Me JjC518nYGPA== X-Received: from mhmmm.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:2ad9]) (user=jacobhxu job=sendgmr) by 2002:a05:6902:160c:b0:dc6:5289:454 with SMTP id bw12-20020a056902160c00b00dc652890454mr3234445ybb.11.1706650436083; Tue, 30 Jan 2024 13:33:56 -0800 (PST) Date: Tue, 30 Jan 2024 21:33:54 +0000 In-Reply-To: <87jzribcvn.fsf@jcompost-mobl.amr.corp.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <87jzribcvn.fsf@jcompost-mobl.amr.corp.intel.com> X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240130213354.863963-1-jacobhxu@google.com> Subject: Re: Reserved bits and commit x86/sev-es: Set x86_virt_bits to the correct value straight away, instead of a two-phase approach From: Jacob Xu To: jeremy.compostella@intel.com Cc: acdunlap@google.com, Thomas.Lendacky@amd.com, michael.roth@amd.com, ashish.kalra@amd.com, bp@alien8.de, felix-coreboot@felixheld.de, kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, mingo@kernel.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" Adding some AMD folk to the thread here. For AMD CPUs, initialization of c->x86_phys_bits occurs in get_cpu_address_sizes() which is called from early_identify_cpu(). However, early_identify_cpu() will first call early_init_amd() which adjusts x86_phys_bits based on the PhysAddrReduction CPUID field. c->x86_phys_bits -= (cpuid_ebx(0x8000001f) >> 6) & 0x3f; Thus, this adjustment is ignored. Adding a new cpu_dev callback to calculate num reserved_cpu_bits makes sense to me, hopefully the AMD folk can chime in here though. Jacob