Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2027831pxb; Wed, 2 Feb 2022 19:19:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGDaEKs4qojxvL8l/Hx2qQFifta1rZisSXFSn7FPXMnCPSQ5heinFsxicKZdy9zfWoOBAP X-Received: by 2002:a17:903:92:: with SMTP id o18mr33318938pld.62.1643858341165; Wed, 02 Feb 2022 19:19:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643858341; cv=none; d=google.com; s=arc-20160816; b=hH9Q+KSprvpYL/SXp+f63YwqgZmKKPtVnbuKOGXUTElcHIEDjJQzGJtQ5l+m/1SrcV YcxuQ62kcM2pU2CouuBUa+PD2zJQJhn2hS9LFp8zVMoRJXcRK+DEWi9I1I2dtM9wyuT/ Ua/MCSwOkwxhPHvy+Vwh+kjooGVXKJri9eBdjG2mUuC8xknVC45JF2zKuLvCNDzo8gPq 49eaVdGlt2PREhUB8EW+ZMG8zhj0iOw0MxBcO1dcf/gL7qALkdabCc0rIUxHjUM3eJa+ 5KWq5ISrNZZ3vy6gBDjTwPZyFMUrObwFbcKRunbMR5qaReyUyAwhJt5GUm55GAjbBdZ+ yIKQ== 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=w74ZJOaVt6Kmg8KSjRCPSyIsO9g1OFfRIBkrQ0IgAA8=; b=G9CLFRB/xT7SoBzL2RFAf7AJgAPn9o9Sj5G7eYAKELyAUKh4wuk6qq3xJp/lnUtNGU bsgY9XwgFXG1zAIQztMgyuVAe8TmX0EhYfOWw+/iDWVGWy+EPU9bI5o+w6jSpI1Fufg7 gCcNJUwQSan0ag2YQJ9bHjqRdD7j6kuj9kOi9L2miFmOmzVilDAhmY3b57BDIKXHuIKl 7zxtoGNcY75cBSjgZpYLtUZytPgTmJd2/Ikd91MDAgMowvM4QsYaYaG5gRYOjsWiGfyU 0V8d0mFYX/BMQ2dBB92yglJ9Ysw/AS+8bSpEjo8FL0ZMmmqiDnjIYSjSi9+nJzmC1QUp dVlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=41y4R91C; dkim=neutral (no key) header.i=@linutronix.de; 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 k20si2655739pjq.146.2022.02.02.19.18.49; Wed, 02 Feb 2022 19:19:01 -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=41y4R91C; dkim=neutral (no key) header.i=@linutronix.de; 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 S243318AbiBBAZd (ORCPT + 99 others); Tue, 1 Feb 2022 19:25:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230330AbiBBAZc (ORCPT ); Tue, 1 Feb 2022 19:25:32 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07B1C061714 for ; Tue, 1 Feb 2022 16:25:31 -0800 (PST) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643761529; 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=w74ZJOaVt6Kmg8KSjRCPSyIsO9g1OFfRIBkrQ0IgAA8=; b=41y4R91CcSHQGOlDT3iuOWqB+NNVwY0JKiz89+Kn833qdRCKCeeldfT+iSq95IOiFHoaIx 0u88tQ8mfiku13myi5DprMYZZnznOdzR74FtZ2LbdNWkmUzE5N0dM4NmNt1NgVn09lH2cc r5+Hq/6rW1m16ETgNR8cboEKKkq1FYPDyuPp8gb1yAtZUOfrl5zw7LCDhPmDzGMTIxSal0 Tiow3R1nnFBhghTDxDJBtL2xZH+DertGwAID/8uYbvYdSCn7mdxyeh5HJ1t1HJHNV9UoEA cp2MSPmR888g4snsuya97LGnyigDKjwh40rd6TatzI2VIRPNNYmbMxJ0Rcj5lw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643761529; 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=w74ZJOaVt6Kmg8KSjRCPSyIsO9g1OFfRIBkrQ0IgAA8=; b=prX4tNmrK84+dA89yFUx0nz+y9YBx+7Pn+2k+86c8GwYaX+d0n4bIkV0qpFRLw0DuIVvyx /5HGp9mUSZgyyfDQ== 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 22/29] x86/tdx: Make pages shared in ioremap() In-Reply-To: <20220124150215.36893-23-kirill.shutemov@linux.intel.com> References: <20220124150215.36893-1-kirill.shutemov@linux.intel.com> <20220124150215.36893-23-kirill.shutemov@linux.intel.com> Date: Wed, 02 Feb 2022 01:25:28 +0100 Message-ID: <87bkzqw1vr.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, guest memory is protected from host access. If a guest > performs I/O, it needs to explicitly share the I/O memory with the host. > > Make all ioremap()ed pages that are not backed by normal memory > (IORES_DESC_NONE or IORES_DESC_RESERVED) mapped as shared. > > Since TDX memory encryption support is similar to AMD SEV architecture, > reuse the infrastructure from AMD SEV code. > > Add tdx_shared_mask() interface to get the TDX guest shared bitmask. > > pgprot_decrypted() is used by drivers (i915, virtio_gpu, vfio). Export > both pgprot_encrypted() and pgprot_decrypted(). How so? # git grep pgprot_encrypted arch/x86/include/asm/pgtable.h:#define pgprot_encrypted(prot) __pgprot(__sme_set(pgprot_val(prot))) arch/x86/mm/ioremap.c: prot = pgprot_encrypted(prot); arch/x86/mm/ioremap.c: return encrypted_prot ? pgprot_encrypted(prot) arch/x86/mm/mem_encrypt_amd.c: protection_map[i] = pgprot_encrypted(protection_map[i]); arch/x86/mm/pat/set_memory.c: cpa.mask_clr = pgprot_encrypted(cpa.mask_clr); arch/x86/platform/efi/quirks.c: pgprot_val(pgprot_encrypted(FIXMAP_PAGE_NORMAL))); fs/proc/vmcore.c: prot = pgprot_encrypted(prot); include/linux/pgtable.h:#ifndef pgprot_encrypted include/linux/pgtable.h:#define pgprot_encrypted(prot) (prot) I cannot find any of the above mentioned subsystems in this grep output. Neither does this patch add any users which require those exports. Thanks, tglx