Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp872709pxj; Tue, 18 May 2021 16:29:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPovNBcxbuPxCkIUWY355i8fYEf3AL6F9Vh00PsgCMzrqZsoZjOAADZvNVCqlphydlzu/i X-Received: by 2002:a92:2a0a:: with SMTP id r10mr7001479ile.274.1621380557631; Tue, 18 May 2021 16:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621380557; cv=none; d=google.com; s=arc-20160816; b=tuuSVKaFIHOj6wHYlzkRi5hw6FwoarXc0qe1puLrhigy7yfAhF08EoMqP2VCn8pitC 8bDdlNpsGJbP5W+5v++MhyXN5RLKwExE2O37Zc9gRQwYGQLkV/peDCRWHJhdQoda3Pxb fdBqdXlJFzAM7hI7+2ntgc5fYt3HzYv+d5ZLBuHYhOclWtMGH2q5xMgtH5ZslEgoWUBI 21aTCZNJQ0UDLSwbkkRvNixi0EOmIRNAH7pJuLm1dGdb0LZfTWx+noaFEtNzk8inTQqQ vBxAYBMa1I+k61WFcoB6/RdM6YvCnty3u7+ZXZiN8baE3NxtjNZKuVN9byBxu6/Marsb QsMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PMdMoCS0N0C9gK98GW5JwRMFtjaGqy0FDiHN3YGTdug=; b=Gh1/PNJfsw790UyxgxYr4Q6qYu6E77FUEVZYqXfr8fBxtzBfCD4lrfoKbfc10Qhq62 xB9u70C0rSLDLBbN/A4/99EBCMENqE2Yft9s0EfQBdHfzBBx06pYoAUbgR+eUPf4uiqu uZ701DBSWb77q+0pitAS6rM8yA1195UKbr1GtEGiL6a82CJeqa/2z7tmcy9QHzgrY1U4 wHZfCdDEX9xwZ99jxb6gT6VNwaCZuVMDN3/tPuItMNB8+u0y6qFeIbrfhjMrahgVtSDG N5apTFsdSXmVH6KC5PN1xhhWHAjeGoKWC2gUKEmQuW3H/cA6kCtmKrQDRt2tmQrN3bD1 1C8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lWpGJosd; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g2si21684207ilk.84.2021.05.18.16.28.36; Tue, 18 May 2021 16:29:17 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=lWpGJosd; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244216AbhEQSSP (ORCPT + 99 others); Mon, 17 May 2021 14:18:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbhEQSSC (ORCPT ); Mon, 17 May 2021 14:18:02 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D26CC061760 for ; Mon, 17 May 2021 11:16:45 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id t30so5205313pgl.8 for ; Mon, 17 May 2021 11:16:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=PMdMoCS0N0C9gK98GW5JwRMFtjaGqy0FDiHN3YGTdug=; b=lWpGJosdFYl1Hv0EqU4KUfoJsiTFP0GiorlKdZXB8l7KUlAWY3zfxdnuMF10X8Ijzl MfEhQ7b6s5mzjIx12de6svpP7s+eMJO9PRmA4I2uXX2Ed2gBa3UeD9hmuPEfo4EwwN+I eHsdu8ac2hJFoIOz8qhesW4uGGgO8nEDIsdXbVoyMUNKIqYLH9Rn4J2Jdf2u0vqIXBHx 3cwdyHOA9EWTDelxxnRkC0Gk1WaYmRUhXRnTRnRqzWp2uzcXr2qy4BB/33w7P6L7K9By /iIzLGMpWh8bXGexSTWY7L4pbwQD/via8n+f+b9MKyC7aI2vB2ARJJs5S7yCbSeKimsf 5Vmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=PMdMoCS0N0C9gK98GW5JwRMFtjaGqy0FDiHN3YGTdug=; b=DoAXWOLUloTPj/FPWxBaFgYEGp8KuGxnnYM3A0yr5F1TFK/DwKTZDv3T+fB17zCSuo ex1MBqUY6va0Zq+WqN2JECu1rpdOAbV/U9CncReSk+KxvUZtDdIxnXvh2pX85d0vLV1T oyejrSuysprDaKKisAihAxE7Fie2NIu/AJw9dXIwFddKFn/paq9mMfoGk8m7EsvcHGFs aUayl3ma+1SLRowjHvjBUMZx0tRnREJWqSvmPPigGUPRJLw2cJOieWZeXKFwP09QMA+p LdjCsUWTMjMUUefXy7LDNA7DBlLtOBoQnv3jJayQlEatOTr57pCi6vUdV9qSdFadgBgr QuUA== X-Gm-Message-State: AOAM53066SyxogO1HTKWvti02KZkNEMlJjPhgKaHuyLXgd+G40XSdQYz isliR3lDeMqmWibZ73ih4JzzwQ== X-Received: by 2002:a63:5a64:: with SMTP id k36mr779497pgm.365.1621275404608; Mon, 17 May 2021 11:16:44 -0700 (PDT) Received: from google.com (240.111.247.35.bc.googleusercontent.com. [35.247.111.240]) by smtp.gmail.com with ESMTPSA id a27sm1939108pfk.91.2021.05.17.11.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 11:16:43 -0700 (PDT) Date: Mon, 17 May 2021 18:16:40 +0000 From: Sean Christopherson To: Andi Kleen Cc: Dave Hansen , "Kuppuswamy, Sathyanarayanan" , "Kirill A. Shutemov" , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org Subject: Re: [RFC v2 26/32] x86/mm: Move force_dma_unencrypted() to common code Message-ID: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 13, 2021, Andi Kleen wrote: > > 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. What generic code needs access to SEV vs. TDX? force_dma_unencrypted() is called from generic code, but its implementation is x86 specific. > > 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 SEV already has the sev_enable_key static key that it uses for unrolling string I/O, so there's at least one (debatable) case that wants to use static branches. For SEV-ES and TDX, there's a better argument as using X86_FEATURE_* would unlock alternatives. > BTW right now I'm not even sure we need the bitmap for anything, but I guess > it doesn't hurt. > > -Andi > >