Received: by 2002:a05:6512:2355:0:0:0:0 with SMTP id p21csp235993lfu; Mon, 28 Mar 2022 22:46:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRuyqWimGCwqYIYxC3y8vwUJgfgx3q9zD4mKjqT2jOySjK3kwwxy95yy8wXSybjBHuqBDR X-Received: by 2002:a17:907:1c0a:b0:6da:7ac4:5349 with SMTP id nc10-20020a1709071c0a00b006da7ac45349mr32206134ejc.596.1648532776099; Mon, 28 Mar 2022 22:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648532776; cv=none; d=google.com; s=arc-20160816; b=IE1TutVLxtkVybDKVQANSEil5NZRU9GwJ3sRyC43M//EcENMxHid3WWzq3GZAReXuS QaZEqMO/eYopBYMYmogVALEqov2MM+6aeIol7mIgXASHOLF6dlo+zIVN9iqsGLPDOLYI kfvWeakp/rK4RnUbHr9Lf+w2H00TOolorL5WlCqIyeuY5vJC7WH5f+hwGyLGlV31JNXr gr19UxV6sCDC4UdtmzNAd9AtzNtAJu+XuZGQ+9MqSTsQXd/hBLENqI/ZIanV9H6dMfYE 6VgNjDa431m5sB+15pA9rwCF4be1rHzpFXGpZYz5+Rv0brqRzkZzBakEiRVhminaAblP KUpg== 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 :message-id:date:subject:cc:to:from; bh=yYL8AADSXeIhw7tSoSa+TzLkDJ8UtzUoSpgKVB5woKc=; b=z3mjs6o5p8rxosYtadsW/BhnEWUaje3FXwJNeWRM1HXXcgBjvMKDXKj/2V4BX6+nor uF8RnqdVOe6ADsBQ7/KtUmme7gwLLJT2T9rbHKRMvbL38jZBm1BhP2xjkQQczWVinhT3 UryttpNC982M0l90soMfS8cF9TtahlV0lpENLM8cmD1O05rs7i4V5Y7DsqeS13ZWCNdQ F1FIKULviidcIZBG0t1xWAEgatZc/hVu8UJXCpxumg4XmYIDFkD69UfdMX8SwEl5UfRR qZZvVd78NmG+PWVo61wf7w4FkcpVURR0Lku06G4yJ7qsF28bhZnE7IS8+lG4dnGKgceL vv/w== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y19-20020a50eb93000000b004190893825csi16241891edr.375.2022.03.28.22.45.49; Mon, 28 Mar 2022 22:46:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231374AbiC2DC7 (ORCPT + 99 others); Mon, 28 Mar 2022 23:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231373AbiC2DC5 (ORCPT ); Mon, 28 Mar 2022 23:02:57 -0400 Received: from out0-142.mail.aliyun.com (out0-142.mail.aliyun.com [140.205.0.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1812923F9F6; Mon, 28 Mar 2022 20:01:13 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047187;MF=darcy.sh@antgroup.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---.NF0ngfN_1648522870; Received: from localhost(mailfrom:darcy.sh@antgroup.com fp:SMTPD_---.NF0ngfN_1648522870) by smtp.aliyun-inc.com(127.0.0.1); Tue, 29 Mar 2022 11:01:10 +0800 From: "SU Hang" To: seanjc@google.com, kvm@vger.kernel.org Cc: "Lai Jiangshan" , "SU Hang" , "Thomas Gleixner" , "Ingo Molnar" , "Borislav Petkov" , "H. Peter Anvin" , , "Paolo Bonzini" , "=?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?=" , Subject: [PATCH v2 0/2] KVM: x86: Replace magic number with readable macro Date: Tue, 29 Mar 2022 11:01:05 +0800 Message-Id: <20220329030108.97341-1-darcy.sh@antgroup.com> X-Mailer: git-send-email 2.32.0.3.g01195cf9f MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 Replace magic number 0x180 with `EPT_VIOLATION_GVA_IS_VALID | EPT_VIOLATION_GVA_TRANSLATED` in arch/x86/kvm/mmu/paging_tmpl.h Similarly, replace `(pte_access & 0x7) << 3` with `(pte_access & VMX_EPT_RWX_MASK) << EPT_VIOLATION_RWX_SHIFT`. v1 -> v2: https://lore.kernel.org/kvm/20220321094203.109546-1-darcy.sh@antgroup.com/ - Rename `EPT_VIOLATION_GVA_VALIDATION` to `EPT_VIOLATION_GVA_IS_VALID`. [Sean] - Using new added `VMX_EPT_RWX_MASK` to replace magic number 0x7 and so on, to avoid using branch statement in hotpath. [Sean] SU Hang (1): KVM: VMX: replace 0x180 with EPT_VIOLATION_* definition Sean Christopherson (1): KVM: x86/mmu: Derive EPT violation RWX bits from EPTE RWX bits arch/x86/include/asm/vmx.h | 9 +++------ arch/x86/kvm/mmu/paging_tmpl.h | 11 +++++++++-- arch/x86/kvm/vmx/vmx.c | 4 +--- 3 files changed, 13 insertions(+), 11 deletions(-) -- 2.32.0.3.g01195cf9f