Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4403472ioa; Wed, 27 Apr 2022 03:07:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjluQm9lwBhu0lVtjvEVoW+F1ywCY1UEzhJzm8V0HnhD4UZy6vicSE5VMcjQm0f54WmduA X-Received: by 2002:a17:90b:1c10:b0:1d2:a7c4:3cf with SMTP id oc16-20020a17090b1c1000b001d2a7c403cfmr32292415pjb.100.1651054075645; Wed, 27 Apr 2022 03:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651054075; cv=none; d=google.com; s=arc-20160816; b=ouukRxDNAEUYR6keMjTc0kj5kATXxPP8Dl7Dp9m5BsA3UTRTr4194RCDZ2ssLOrtFd rTrp9XKvsCge8/lJZrajMxqbWEn7ow/4zGLoo1mQSEWLjspHcbZlyA5Tpa6T4srB+LzI RxVBU21dSzoQVpi5Yuzm2WxmzCZ+hLpYlk1cPfryoM84VAwJTsrZmj9JTKEEA54O+vrz EVwdZxSFc7a4QiH06zzzta2ZMvcSepp1VQ2zBdSRPJw1I2iVh8NPxycWI/OSwWl65BuS cgeUbGDy07QHEpDeKLg29d6svnnYp9kunl6WISS2Eyprk6QWSd8Vx/T1ra/o8jWGwGKk 2f/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=dTNHzgfUOL4osO2j/zaJgcQDZH2hhUWA+/riZkN8hcc=; b=fLE+S91c81gDGdaV186rZk6ZkBf8lZlEjJs6TggA1gYDMu/SZEFYCgQJ0/eNshi0vF IyyjdbM+C9T7qMNFIrYLQG8rXYRQ9wgpyrb5oUm2oa0+sVqm9nGSqElikJ8FzSaYjzgI sIra1rWEUpkfPlikyj9/OLWGBC/HQ1bgt2go0IS2as8YkYVyu2+/HfByG1mwreJOzbV8 TkffNh4QNyo98bmqHeXVdDeG9YaB+JgbjYJPGQEsJYsL3Glo/o5eSU3KLYqdwJWGJTS3 Hd9E40LeSFjVLm9Ial63MiYfP9WGuE/WCxFYKCoULIkeAdGqmulL4V4PTlJ43ZMC4+0z 5jzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qrMvkpn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q16-20020a170902edd000b00158897b40e5si1126020plk.48.2022.04.27.03.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:07:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qrMvkpn1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B7D682550CF; Wed, 27 Apr 2022 02:32:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238833AbiDZVPo (ORCPT + 99 others); Tue, 26 Apr 2022 17:15:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233055AbiDZVPf (ORCPT ); Tue, 26 Apr 2022 17:15:35 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FC6A75E5D; Tue, 26 Apr 2022 14:12:27 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id z16so19077311pfh.3; Tue, 26 Apr 2022 14:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dTNHzgfUOL4osO2j/zaJgcQDZH2hhUWA+/riZkN8hcc=; b=qrMvkpn1dhwLTmWBJPXzi8j82SmulVrBUqm+++Hg5yAlQt7JM9rqoaaQVhTL6+Qirj VkJnyWNCuwEF77pl3w3Yn7v1OKFwbznYzvA+WvXSzFqL9xqGq8WxuyLRTsOS/scvDpnx JS0tSuTVCGy0Oy+cOvHHdP9pgB1SHu2Y11M/T/aTLxvVm4AofVOpoX59bRz1GJkHajRb dyX/f65P2Ygha/5H8VxyqInUOsDxU1zXBQDDWwJB7lp6H0O0C7SW1rnjmXMZC/ChgwI+ 4xGvewgx/OvuNHOJ6X1uXSTWSZJ+eyaDI70Y0KmaG/FzPcX97+XoNr6Bn6LsM1gjSbJJ zxTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dTNHzgfUOL4osO2j/zaJgcQDZH2hhUWA+/riZkN8hcc=; b=uwhsM5AKpA+4XB36HZDaNrLtvon15V/k7GmTKXmbQAucaTVGXpqiXFCqhnkL6R8Tqk kTvLF4b9hBLOe26Oz1dEeh+9Ky17tMNzos9m45wZx7QA7T3tMpMNjXWE92JqDmtYesBg sS7GHGXlh+wuFqddnP4N0wV6I7XqloTgV9Xm2xedzeC8zcCcfyTPQZUb3FbkZcG576rc mIhl/XpfEGysztkdHGrwCRK09bz0e+VwVuBRcUVD/V6YsUyg47ZwR4f2r78xWQaYNLxY E71Am5wWTfAvrbCPMJ0qiGMGx20y0Y3+CvYlHHWj/P7uw5+AsK7lBmXxhuIbttWQO6PT fxhw== X-Gm-Message-State: AOAM533939sTNKIEeiUQGpKFYTISK8t8QtOqksC/nR7l7V0cNgPdZy7d C/CmvOMaKHLommDcgn125J8= X-Received: by 2002:a63:2b8a:0:b0:3aa:f59e:a4a7 with SMTP id r132-20020a632b8a000000b003aaf59ea4a7mr15560768pgr.91.1651007546318; Tue, 26 Apr 2022 14:12:26 -0700 (PDT) Received: from localhost (c-107-3-154-88.hsd1.ca.comcast.net. [107.3.154.88]) by smtp.gmail.com with ESMTPSA id f14-20020a63380e000000b0038253c4d5casm13765851pga.36.2022.04.26.14.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 14:12:25 -0700 (PDT) Date: Tue, 26 Apr 2022 14:12:23 -0700 From: Isaku Yamahata To: Sagi Shahar Cc: Kai Huang , "Yamahata, Isaku" , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , Jim Mattson , Erdem Aktas , Connor Kuehl , Sean Christopherson Subject: Re: [RFC PATCH v5 048/104] KVM: x86/tdp_mmu: Support TDX private mapping for TDP MMU Message-ID: <20220426211223.GA1719560@private.email.ne.jp> References: <7a5246c54427952728bd702bd7f2c6963eefa712.1646422845.git.isaku.yamahata@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 25, 2022 at 12:10:22PM -0700, Sagi Shahar wrote: > On Wed, Apr 6, 2022 at 5:50 PM Kai Huang wrote: > > > > On Fri, 2022-03-04 at 11:49 -0800, isaku.yamahata@intel.com wrote: > > > From: Isaku Yamahata ... > > > @@ -914,14 +1014,23 @@ static int tdp_mmu_map_handle_target_level(struct kvm_vcpu *vcpu, > > > u64 new_spte; > > > int ret = RET_PF_FIXED; > > > bool wrprot = false; > > > + unsigned long pte_access = ACC_ALL; > > > > > > WARN_ON(sp->role.level != fault->goal_level); > > > + > > > + /* TDX shared GPAs are no executable, enforce this for the SDV. */ > > > + if (!kvm_is_private_gfn(vcpu->kvm, iter->gfn)) > > This should be: > if (kvm_gfn_stolen_mask(vcpu->kvm) && !kvm_is_private_gfn(vcpu->kvm, iter->gfn)) > > Otherwise, when TDX is disabled, all EPTs are going to be considered > as shared non-executable EPTs. Oops, will fix it. Thank you for pointing it out. -- Isaku Yamahata