Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp739134pxj; Thu, 13 May 2021 16:03:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDW0XbtuYACMGLb4ssJJyHruQ+ejS7YDrqFm2wrw8hcsrpw0cmlol8X8TT+AjbeGH1xjnP X-Received: by 2002:a17:906:11d5:: with SMTP id o21mr42056487eja.176.1620947020498; Thu, 13 May 2021 16:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620947020; cv=none; d=google.com; s=arc-20160816; b=vEWQdringz3a4v6aIUuryt4NXBbybPfl222K1XmiIQx0PtF9nbl+oGUVLvHAF78Nnv 1NuhFlzu7mW3oYIQcUpxxxBlMeKIKpj0+mpU1MACn+2GYdDa8w6CJtCE3+Li0wIPgNCD piEPOPLnjy9KTMNl4jgmm6B/41N4V/4rLEyRGTW/ZgyitnjkEKxWpmzmsu26SInKLPgC wgvcd/X+M37fvQwD5ftuPibYxYiXCWrkxCX4CCbM1Nx+WzMOcyXifdAtew0/6ncpDFhE qjxwt0x8lYYhuiiz5SnR87OzkWS8XoglYQktoR+1auz5uqmovPxQVc7Nw8ZnjKPCC4Dl Gwqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=MgGEoWIZLABhwIfFnHUMMWwtxvIP1mZ4imYqxCSKTQU=; b=cozZUGMaIw066ES9geJFRdPsfF8n2Y6maDhWghATadIhz2R6AnisWWu6mgLDj+bH9M HkDbfys52Sv13NKIVmiIuKgxyCzqd1lFxXbj2KKKhJBGnLx7lrqAmxaHDy9d6H9ca+ju z7a151fcZHbCT8YY9QVvDqCE9tg6mILr/ZkMqjFlcDTOZHnSv20FS+RUIm+jPNTVpPfy 5WzAEUjUZQqy8LANPNOiJA71sJEFG04XZyrHMJuAkR8pEPg97CkwujzgRXD+DqTcpdPL LHKmgDdNyOpqR4OHx+XFJHEqQPlmaV4ZkVXvP0m4WUSuttDbK9L8X+UtoyMHteBOwV7c MOng== 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 j6si4237997edv.294.2021.05.13.16.03.16; Thu, 13 May 2021 16:03:40 -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 S229890AbhEMSTM (ORCPT + 99 others); Thu, 13 May 2021 14:19:12 -0400 Received: from mga14.intel.com ([192.55.52.115]:19164 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbhEMSTL (ORCPT ); Thu, 13 May 2021 14:19:11 -0400 IronPort-SDR: WMIzrQUxr1VnAkMgbpf1Guloj9XPrUmXnF0LP0jS23FJRRXkkLgEkDqim0b1RI+DUQ/v2X4f5C h+bMmkwqG28w== X-IronPort-AV: E=McAfee;i="6200,9189,9983"; a="199701172" X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="199701172" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 11:18:00 -0700 IronPort-SDR: q3CDgFd2QcdDrVZyCjCdru8HSbhQTpbpbXdSUqygF1xG40q+wogb06tfx1QJR7YGQWErxcqTRP JmutrwjL48FQ== X-IronPort-AV: E=Sophos;i="5.82,296,1613462400"; d="scan'208";a="437756347" Received: from dleves-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.146.134]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 May 2021 11:17:59 -0700 Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code To: Dave Hansen , Sean Christopherson Cc: "Kirill A. Shutemov" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Andi Kleen , 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: "Kuppuswamy, Sathyanarayanan" Message-ID: <25f39c78-276f-529e-a62a-5444f9a94d14@linux.intel.com> Date: Thu, 13 May 2021 11:17:55 -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: <943645b7-3974-bf05-073c-03ef4f889379@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/13/21 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? My assumption is, protected guest abstraction can be also used by non-x86 arch's in future. So I have tried to keep these definitions in common code. > > That gives us all the compile-time optimization (via > en/disabled-features.h) and static branches for "free". > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer