Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1885528pxv; Fri, 2 Jul 2021 15:09:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmcCS5VtRxhCEBVPYdpMRjStmQ/129a2KDRuyKGBqo3r7H9Jq7Rcm1S/HZyssZxPTf3cDc X-Received: by 2002:a17:906:7290:: with SMTP id b16mr1872366ejl.503.1625263746985; Fri, 02 Jul 2021 15:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625263746; cv=none; d=google.com; s=arc-20160816; b=hwu97kF3biUw5YL85/9Po+/HUge2D/XAa7QXYG9XfEmaWD04xTP9qGo4sDJnYFgLH1 b9CphyonblTktwvYF8FNjkraF0i79/xJT7J/KC9rKyXMQn8vo+G6Ndtu6PCdF5uBzlSW SUUw71GiO6z7pTZHcBYMBt88W6SuaPpLcNg5ovk3Y6jhEDBl+Q4FOHEkxWzD7ARi/cLl imKOIQDbZzVDWPXz4/+PBcj5Tka0sVuItyee4qvOfgLVne+yzyCvBkBPOiUnu+O3h9cx ncEu8AOaxslg1gfKplz/H4wEv5IHRWq9Al5a+3ot881wkCYt9Tq9KIq/OtE+M5x25Sgj Oghg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+KpYrnNaHsy7YgHPiQaZBUGSW8Z/Zpi7+f7c/rAhFXI=; b=oKFwrZ4rRDhwCnvRtxNizNLNonW1Z9iduvcN7AdjUnuCe/1/v8a95aJGuDiqgtqRSz Y+O1y3wvDvXttvslbzCGrebczkJUtA5vTCMQBlnPGywaQ8I7mhyoLd9AovoIzzbdVbWL otLIQ7gfbNb+mbUH9HzLwfOE1ebLYckYBssklDDiBcx1C74EP2wbTgCi4BNv4VPyXMW8 9cUkezGPaQCCo/uVB2j+iRNNMqcdKnTvmREoGsgrdu48FBuVudAueKmBIWGIGZ3ord33 qbWly3oMh3xj+ZAk7krgh7cZ7VLsS4GZVMBen/6giUNTMNGtQuJ3jyeUt/Z4jqsjovRm uXxg== 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 j23si5233224eje.551.2021.07.02.15.08.44; Fri, 02 Jul 2021 15:09:06 -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 S233601AbhGBWJ3 (ORCPT + 99 others); Fri, 2 Jul 2021 18:09:29 -0400 Received: from mga14.intel.com ([192.55.52.115]:56255 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233161AbhGBWH7 (ORCPT ); Fri, 2 Jul 2021 18:07:59 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10033"; a="208609453" X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="208609453" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:27 -0700 X-IronPort-AV: E=Sophos;i="5.83,320,1616482800"; d="scan'208";a="642814812" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2021 15:05:26 -0700 From: isaku.yamahata@intel.com To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Sean Christopherson Subject: [RFC PATCH v2 42/69] KVM: x86/mmu: Explicitly check for MMIO spte in fast page fault Date: Fri, 2 Jul 2021 15:04:48 -0700 Message-Id: <26005d563a9303ecc6ca68a9baea77895a75e8e0.1625186503.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson Explicity check for an MMIO spte in the fast page fault flow. TDX will use a not-present entry for MMIO sptes, which can be mistaken for an access-tracked spte since both have SPTE_SPECIAL_MASK set. Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/mmu/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 990ee645b8a2..631b92e6e9ba 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -3060,7 +3060,7 @@ static int fast_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, break; sp = sptep_to_sp(iterator.sptep); - if (!is_last_spte(spte, sp->role.level)) + if (!is_last_spte(spte, sp->role.level) || is_mmio_spte(spte)) break; /* -- 2.25.1