Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp755940pxj; Thu, 13 May 2021 16:33:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMGqX12wNShjurnu3naLFo+eU2qhpFpzZwPl2mMQWHJH5Vlze7A4ADmcCJxgYVLWsqosOH X-Received: by 2002:a05:6e02:118f:: with SMTP id y15mr12239443ili.52.1620948831018; Thu, 13 May 2021 16:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620948831; cv=none; d=google.com; s=arc-20160816; b=vKpy1VEJ14bnn7NhHU/7G/SR5/S6QISvua7jx5ZCM7f2g/+rE8IPhUNU5wGL1/0bsT 5IaixncuJm24eyKoVUYYd4lwHKnWGGFNMjhZ2Ce/H/CSG4JoXxSm/wDrA0/UShbgUYmv p5RBqbTpHeWaKj8JRj8VfgRviEMNxUiq12EQylQhTJAiCz0k4BV6+086mQFruHygAPcL rFDy+vhiOEwMeEiMPLml1d/o8k43uNqX5gbpo0EqCQf3i91E/BCv/FB/nEaYeSfkmRt2 Z74poJv8XrH+LSTigFRUJ+/xiodH76jrNT2Ey1Xfpa5l8DBlFcqcpYc03hZcvJAc4YDI gXbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=c0VMqdYJGH+86C3Q1xDJiVZNI+kcjoA2KlEt6afV7Ts=; b=oHtil509wXu5BFvatmx78gvkU+ZznOHyEiYDXPiHbZx6rF+1gtRFE1I8H8OEoKEjyu 4sYluv6pWOmnZN5bA6gSPg1+R9QiBLpIDPsIZ+xmO4+PA01Qi/ABtDUWHC1Xk1LiSGiH 7Gn7NE4BzJWmNJePIUqyE2xdO51G3KxrivEmgG/DUdHbpXekrd07mEqX6cgj/kt6Dj1H ssYaFqTKfM11ymfA19we1eCVBTjtG8wpZ03kyiqBuJx6tV2AtEtl6lG8irfx1VwQRDUq U6lXlpTQ4DaLWOgLdkAV95IGVOiXF5Y+oNIqEoR87WD4klBIZu77tEsudx+ZoGH2g6Ei ZrXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si6315544iom.3.2021.05.13.16.33.33; Thu, 13 May 2021 16:33:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231393AbhEMTkH (ORCPT + 99 others); Thu, 13 May 2021 15:40:07 -0400 Received: from mga03.intel.com ([134.134.136.65]:40976 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230154AbhEMTkG (ORCPT ); Thu, 13 May 2021 15:40:06 -0400 IronPort-SDR: nGqHIefn7TwLC+hIQFLlHS34anjZl+r+eG2S8mJkpkTJCOhrd+yfu6kG5WfsDtmb9y92CTJBb1 ku16g8dVzyfQ== X-IronPort-AV: E=McAfee;i="6200,9189,9983"; a="200089865" X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="200089865" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 12:38:53 -0700 IronPort-SDR: ph7v76FgdF6xYyJz+xLL4ZCtyCNyIIYeicHc2Chz30XzAZph75AVD2RXEplTmvdGftoPv/HOjb w04MUOmZLLzg== X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="401142998" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.209.17.244]) ([10.209.17.244]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 12:38:52 -0700 Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code To: Dave Hansen , "Kuppuswamy, Sathyanarayanan" , Sean Christopherson Cc: "Kirill A. Shutemov" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org References: <7c5adf75d69ea327b22b404b7c37b29712d73640.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <5536639a-918d-de8d-ff32-934a13902a03@intel.com> <20210512130821.7r2rtzcyjltecun7@box.shutemov.name> <943645b7-3974-bf05-073c-03ef4f889379@intel.com> From: Andi Kleen Message-ID: Date: Thu, 13 May 2021 12:38:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <943645b7-3974-bf05-073c-03ef4f889379@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/2021 10:49 AM, Dave Hansen wrote: > On 5/13/21 9:40 AM, Kuppuswamy, Sathyanarayanan wrote: >> +#define PROTECTED_GUEST_BITMAP_LEN    128 >> + >> +/* Protected Guest vendor types */ >> +#define GUEST_TYPE_TDX            (1) >> +#define GUEST_TYPE_SEV            (2) >> + >> +/* Protected Guest features */ >> +#define MEMORY_ENCRYPTION        (20) > I was assuming we'd reuse the X86_FEATURE infrastructure somehow. Is > there a good reason not to? This for generic code. Would be a gigantic lift and lots of refactoring to move that out. > > That gives us all the compile-time optimization (via > en/disabled-features.h) and static branches for "free". There's no user so far which is anywhere near performance critical, so that would be total overkil BTW right now I'm not even sure we need the bitmap for anything, but I guess it doesn't hurt. -Andi