Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2284612pxp; Mon, 21 Mar 2022 15:52:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWcN71k3CV1LprJOsFeprPgZHOz/nEWqW9D45KPE3go66m+HPNmdbheNoFvbZkXSnuGsyC X-Received: by 2002:a17:90a:644c:b0:1c6:2577:6577 with SMTP id y12-20020a17090a644c00b001c625776577mr1431960pjm.217.1647903177374; Mon, 21 Mar 2022 15:52:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647903177; cv=none; d=google.com; s=arc-20160816; b=emFj4TEUHIxUd7h7g2IQdvoZuYYzLeJbam/FrTUSbp7tj6x+7JO+An7AUmz1DAKsxc BML5dy7VneTCNVCY2P2mc8iRDTPBT673QeIBKPr1a0EN8oGmLgi2O/ng9p/IEJlA+Sdf ypOGF1biCEGs12/UWWN4QOKs3NT2m84qXmtxUd2s3DcvUJ8wZ3mu1UGxLjjeDieiwr5k dOY+WeJGCxOHC4c66AO78Auh+FgQFUmaH2sMki9ruHq6ggAqUxfde3lCHWE8vbwwzBPU b38YL3LbEGA/pgQNyQ1hss6PubcNosQJMkSaWYglwm78igBStX+Uun0Tbr08yy7Ecc4x ZLWQ== 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=Tbbj8ILKaHmSsjBp3Rm9LEmpzE7Yji5O4GavRLO4qNU=; b=ieXudXSU2p9t8I7RyDG7oAkG58upKWJQuyuWXkgkFqlu5EnQOUYXNirhfKUbQdDS+b VwZJB4lgDGH+K186gRvmUx5XiYJzJVl3V538dhaU+Y/agpnm/BPJjy6t62R40idTPUaM U6RZTq72ghXZX7a1TGlwpG4vYaRWQOZiOexq8syseW15b+1ToI31pebEplaIA+Ae7rE8 SeLefoo2hFAQXJh9S6sPdC5nxtevV3zVP6PeKXUwwpGIvj/sh0vGR2Apf3JZ5K6AwY6b x9dXDWmGxI3cCyeCM49bKyCjHwP9JaAogwZgoO8RRUvro/j2cuwmlBqR+uPL79lmX5Ec 0X3A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s1-20020aa78d41000000b004fa3a8dffe6si8131558pfe.157.2022.03.21.15.52.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:52:57 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C295833644C; Mon, 21 Mar 2022 15:01:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345997AbiCUJpJ (ORCPT + 99 others); Mon, 21 Mar 2022 05:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345985AbiCUJpF (ORCPT ); Mon, 21 Mar 2022 05:45:05 -0400 Received: from out0-143.mail.aliyun.com (out0-143.mail.aliyun.com [140.205.0.143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72E414016; Mon, 21 Mar 2022 02:43:39 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047213;MF=darcy.sh@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.N99c1i1_1647855816; Received: from localhost(mailfrom:darcy.sh@antgroup.com fp:SMTPD_---.N99c1i1_1647855816) by smtp.aliyun-inc.com(127.0.0.1); Mon, 21 Mar 2022 17:43:36 +0800 From: "SU Hang" To: kvm@vger.kernel.org Cc: "=?UTF-8?B?6LWW5rGf5bGx?=" , "SU Hang" , "Paolo Bonzini" , "Sean Christopherson" , "Vitaly Kuznetsov" , "Wanpeng Li" , "Jim Mattson" , "Joerg Roedel" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , , "H. Peter Anvin" , Subject: [PATCH 2/2] KVM: X86: use EPT_VIOLATION_* instead of 0x7 Date: Mon, 21 Mar 2022 17:42:03 +0800 Message-Id: <20220321094203.109546-2-darcy.sh@antgroup.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f In-Reply-To: <20220321094203.109546-1-darcy.sh@antgroup.com> References: <20220321094203.109546-1-darcy.sh@antgroup.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 Use symbolic value, EPT_VIOLATION_*, instead of 0x7 in FNAME(walk_addr_generic)(). Signed-off-by: SU Hang --- arch/x86/kvm/mmu/paging_tmpl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h index 7853c7ef13a1..2e2b1f7ccaca 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -531,7 +531,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_READ; if (fetch_fault) vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_INSTR; - vcpu->arch.exit_qualification |= (pte_access & 0x7) << 3; + if (pte_access & ACC_USER_MASK) + vcpu->arch.exit_qualification |= EPT_VIOLATION_READABLE; + if (pte_access & ACC_WRITE_MASK) + vcpu->arch.exit_qualification |= EPT_VIOLATION_WRITABLE; + if (pte_access & ACC_EXEC_MASK) + vcpu->arch.exit_qualification |= EPT_VIOLATION_EXECUTABLE; } #endif walker->fault.address = addr; -- 2.32.0.3.g01195cf9f