From patchwork Tue Nov 18 09:14:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 5326841 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5494A9F1E1 for ; Tue, 18 Nov 2014 09:19:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D2A420115 for ; Tue, 18 Nov 2014 09:19:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5E05200E8 for ; Tue, 18 Nov 2014 09:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753375AbaKRJTx (ORCPT ); Tue, 18 Nov 2014 04:19:53 -0500 Received: from mga11.intel.com ([192.55.52.93]:51007 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752715AbaKRJTw (ORCPT ); Tue, 18 Nov 2014 04:19:52 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Nov 2014 01:19:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,408,1413270000"; d="scan'208";a="633735182" Received: from tchen0-linux.bj.intel.com ([10.238.135.72]) by fmsmga002.fm.intel.com with ESMTP; 18 Nov 2014 01:19:50 -0800 From: Tiejun Chen To: pbonzini@redhat.com Cc: kvm@vger.kernel.org Subject: [PATCH] kvm: x86: vmx: remove MMIO_GEN_MASK Date: Tue, 18 Nov 2014 17:14:38 +0800 Message-Id: <1416302078-6324-1-git-send-email-tiejun.chen@intel.com> X-Mailer: git-send-email 1.9.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Actually MMIO_MAX_GEN is same as MMIO_GEN_MASK, and especially in all cases we already AND this so its also unnecessary to generate such a WARN_ON(). Signed-off-by: Tiejun Chen --- arch/x86/kvm/mmu.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ac1c4de..7712345 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -213,15 +213,12 @@ EXPORT_SYMBOL_GPL(kvm_mmu_set_mmio_spte_mask); #define MMIO_GEN_SHIFT 20 #define MMIO_GEN_LOW_SHIFT 10 #define MMIO_GEN_LOW_MASK ((1 << MMIO_GEN_LOW_SHIFT) - 2) -#define MMIO_GEN_MASK ((1 << MMIO_GEN_SHIFT) - 1) #define MMIO_MAX_GEN ((1 << MMIO_GEN_SHIFT) - 1) static u64 generation_mmio_spte_mask(unsigned int gen) { u64 mask; - WARN_ON(gen > MMIO_MAX_GEN); - mask = (gen & MMIO_GEN_LOW_MASK) << MMIO_SPTE_GEN_LOW_SHIFT; mask |= ((u64)gen >> MMIO_GEN_LOW_SHIFT) << MMIO_SPTE_GEN_HIGH_SHIFT; return mask; @@ -240,7 +237,7 @@ static unsigned int get_mmio_spte_generation(u64 spte) static unsigned int kvm_current_mmio_generation(struct kvm *kvm) { - return kvm_memslots(kvm)->generation & MMIO_GEN_MASK; + return kvm_memslots(kvm)->generation & MMIO_MAX_GEN; } static void mark_mmio_spte(struct kvm *kvm, u64 *sptep, u64 gfn,