From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 181C4C47082 for ; Mon, 31 May 2021 17:56:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E5ECA61005 for ; Mon, 31 May 2021 17:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbhEaR6K (ORCPT ); Mon, 31 May 2021 13:58:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbhEaR6A (ORCPT ); Mon, 31 May 2021 13:58:00 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA385C061574 for ; Mon, 31 May 2021 10:55:30 -0700 (PDT) Received: from zn.tnic (p200300ec2f080f00c524a4d22cb87212.dip0.t-ipconnect.de [IPv6:2003:ec:2f08:f00:c524:a4d2:2cb8:7212]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 8064F1EC052C; Mon, 31 May 2021 19:55:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1622483728; 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: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=Q9BzzXtfPxNugxRAv21AN0P5i1cLxaiZOApwtnz102U=; b=jeCI17jlnnzHH5VHS+uRV0nFcSOlx4KEXEQ62YnMMu93N6BgYzkUWOTyt1oqTYurPyjKws 5QYmiyzHIjS//kV/LdMlIu7cEt2UXel4360U6JGM4nF2ef1SZVYPYicLLz12exaCE+WTgN 0sDWlrQSpDykb5aOFjk439VAohz+Feo= Date: Mon, 31 May 2021 19:55:22 +0200 From: Borislav Petkov To: "Kuppuswamy, Sathyanarayanan" Cc: Tom Lendacky , Sean Christopherson , Dave Hansen , Andi Kleen , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org, Brijesh Singh Subject: Re: [RFC v2 28/32] x86/tdx: Make pages shared in ioremap() Message-ID: References: <0e233779-9c10-11df-b527-ef61e003ea35@linux.intel.com> <86b4d995-9619-81fa-5ef4-86f48ab01e96@amd.com> <96a63ddf-98f9-7095-f7bb-100bf56a4d10@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <96a63ddf-98f9-7095-f7bb-100bf56a4d10@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 31, 2021 at 10:32:44AM -0700, Kuppuswamy, Sathyanarayanan wrote: > I think above requirement is satisfied in following implementation. Well, I suggested a single protected_guest_has() function which does: if (AMD) amd_protected_guest_has(...) else if (Intel) intel_protected_guest_has(...) else WARN() where amd_protected_guest_has() is implemented in arch/x86/kernel/sev.c and intel_protected_guest_has() is implemented in, as far as I can follow your paths in the diff, in arch/x86/kernel/tdx.c. No is_protected_guest() and no ARCH_HAS_PROTECTED_GUEST. Just the above controlled by CONFIG_INTEL_TDX_GUEST or whatever the TDX config item is gonna end up being and on the AMD side by CONFIG_AMD_MEM_ENCRYPT. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette