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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 399E1C433ED for ; Mon, 17 May 2021 22:32:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C38D611ED for ; Mon, 17 May 2021 22:32:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343818AbhEQWdZ (ORCPT ); Mon, 17 May 2021 18:33:25 -0400 Received: from mga03.intel.com ([134.134.136.65]:47293 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238052AbhEQWdX (ORCPT ); Mon, 17 May 2021 18:33:23 -0400 IronPort-SDR: cPW1V6n0WLiAYaMWDlzYxMiEzGsDHVD6QYUFI0e0qudyHYh2sulyPPHebYKgakoF0egFH2RqgK Ek5kKd+FtcMQ== X-IronPort-AV: E=McAfee;i="6200,9189,9987"; a="200632718" X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="200632718" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 15:32:06 -0700 IronPort-SDR: 3pPbgw7KR3+4EfEe+dtQOrQE887y10H1DxmYzQT8KwAHjrBK4I3/Ziojxgrakddz7GKwb9ft9X rR8+Eh0+RHCQ== X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="543866390" Received: from daltonda-mobl.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.182.28]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 15:32:05 -0700 Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code To: Sean Christopherson , Dave Hansen Cc: Andi Kleen , "Kirill A. Shutemov" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org References: <20210512130821.7r2rtzcyjltecun7@box.shutemov.name> <943645b7-3974-bf05-073c-03ef4f889379@intel.com> <5cc06488-09fe-17b5-077b-02c4ba9ca198@intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <37da11b3-0313-982d-5a2b-af592db6f9e8@linux.intel.com> Date: Mon, 17 May 2021 15:32:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/21 11:37 AM, Sean Christopherson wrote: >> Just remember, a "common framework" doesn't mean that it can't be backed >> by extremely arch-specific mechanisms. >> >> For instance, there's a lot of pkey-specific code in mm/mprotect.c. It >> still gets optimized away on x86 with all the goodness of X86_FEATUREs. > Ya, exactly. Ideally, generic code shouldn't have to differentiate between SEV, > SEV-ES, SEV-SNP, TDX, etc..., a vanilla "bool is_protected_guest(void)" should > suffice. Under the hood, x86's implementation for is_protected_guest() can be > boot_cpu_has() checks (if we want). What about the use case of protected_guest_has(flag)? Do you want to call it with with X86_FEATURE_* flags outside arch/x86 code ? -- Sathyanarayanan Kuppuswamy Linux Kernel Developer