Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2381303pxb; Thu, 3 Feb 2022 05:32:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyEnzS7c9kqyam93SUuLrSwOzQXaHyeG4wi9cQ6O67vrsWS+/RX0GZz6emkpvcF9wghybg8 X-Received: by 2002:a17:907:2d8e:: with SMTP id gt14mr29837586ejc.60.1643895166800; Thu, 03 Feb 2022 05:32:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643895166; cv=none; d=google.com; s=arc-20160816; b=rY575g/0CITen+ELm3yq///BVi7nmptaukQKuq2mIrb4WKEk8Q7CIzEA/c6oO4edd/ EjdjevbWjCrU1wI823PLnkxogGs0Pf7/Kim1Ml2HSSieZtavp3S1ty9HjH1ue0ObiNFQ b6QaHtYPGB/XPNTCeNH5RlarNo5FWfJJ92Wfn66uFBq7PJBxubQpswumaw/rBCb97AO6 keVKMGTM75ct53sFB24q+ZW6HTSfQb/Y19R83MXtECbGFFewU6uU5RSr/c83xhrVE+ls 8Bg8OSsC40v9p3uBm/tyaBylY+alU+2vet5OujxaXlYwDQN49v9AcK6gdigDb+HlS3In jkkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=rLeMv/6RS1ogEasjh9A5UMG6k0Sx2F9mFXDj2XcIXBw=; b=mf4BJ9+wao+keAFy7utR6LadOzLNT5BsEoYd56Np+dsvvegCHuAK3fcJ26pq/FH1Yc 4+oJlSD9rIt0zDqjTVyrR+15msicb8gqLui75LRlx5FEQRAMl4o2yksKlYJB1AHpKJCW tUDJvjcs1dvp6ShllkksLlZKIoHlpyra/5XwmRDUcbfx6lxkd2yqCh0MD74Ck7ikYVzM 8ZV+0BbvticR8U+cw3hJ/ZvHm+jK+CF58aczg5AgQQeR/rOhB1fJhmpxy7EXN0kdRDyK TdkVhJqlLkJ9EjJvkE958MO58Spz58xqlZ4d41huHKVqlBBy0dokHWxuHhL2R88FfqTC 6JRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0mMOatM2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw37si15584028ejc.789.2022.02.03.05.32.19; Thu, 03 Feb 2022 05:32:46 -0800 (PST) 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=@linutronix.de header.s=2020 header.b=0mMOatM2; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243282AbiBBASp (ORCPT + 99 others); Tue, 1 Feb 2022 19:18:45 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:43172 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243271AbiBBASm (ORCPT ); Tue, 1 Feb 2022 19:18:42 -0500 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643761120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rLeMv/6RS1ogEasjh9A5UMG6k0Sx2F9mFXDj2XcIXBw=; b=0mMOatM2Wvl0WOsQZITl8s0objldVvOXxRC3Ox2mRIUqFByfCxR8r2GOhmU4RtkXkSoh3o y1yPgpOZ3ATBmWppZDm8QbIsIE2Bhb3NNH1BHD0CR5fnS2xAYvj0hqtFNjx3BHrRmvuqyz 54MAKuYtc+eAmsf9rsoy35oN3p4ihr7pKnU3VXYqvsBpXu0Y82b+HStYMuAFKpNgDAcunA k8l11H1Y+1w2wa62S6X+F/fUnAZ4x24MI6vDTxSYjK/IW5R5nOJ1vkoLvgjVh/B+kOfloT b+6dbn6WLO533IuLodJoYV4rXN1o/ZfcEjj91TT9iLwKLOoAMuMVs1fuM0+V9w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643761120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rLeMv/6RS1ogEasjh9A5UMG6k0Sx2F9mFXDj2XcIXBw=; b=MnhYGecwZI372SPHnzkYGxMXuGTriiBgN12nFF3QkqYw5gwclVjTVJJ2SVrjkt621AwdDh w9kOTUG+oMllBHAw== To: "Kirill A. Shutemov" , mingo@redhat.com, bp@alien8.de, dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org Cc: sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: Re: [PATCHv2 21/29] x86/tdx: Exclude shared bit from __PHYSICAL_MASK In-Reply-To: <20220124150215.36893-22-kirill.shutemov@linux.intel.com> References: <20220124150215.36893-1-kirill.shutemov@linux.intel.com> <20220124150215.36893-22-kirill.shutemov@linux.intel.com> Date: Wed, 02 Feb 2022 01:18:40 +0100 Message-ID: <87ee4mw273.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24 2022 at 18:02, Kirill A. Shutemov wrote: > In TDX guests, by default memory is protected from host access. If a > guest needs to communicate with the VMM (like the I/O use case), it uses > a single bit in the physical address to communicate the protected/shared > attribute of the given page. > > In the x86 ARCH code, __PHYSICAL_MASK macro represents the width of the > physical address in the given architecture. It is used in creating > physical PAGE_MASK for address bits in the kernel. Since in TDX guest, > a single bit is used as metadata, it needs to be excluded from valid > physical address bits to avoid using incorrect addresses bits in the > kernel. > > Enable DYNAMIC_PHYSICAL_MASK to support updating the __PHYSICAL_MASK. > > Co-developed-by: Kuppuswamy Sathyanarayanan > Signed-off-by: Kuppuswamy Sathyanarayanan > Reviewed-by: Andi Kleen > Reviewed-by: Tony Luck > Signed-off-by: Kirill A. Shutemov Impressive.... > --- > arch/x86/Kconfig | 1 + > arch/x86/kernel/tdx.c | 8 ++++++++ > 2 files changed, 9 insertions(+) Reviewed-by: Thomas Gleixner