Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6691181rwd; Tue, 6 Jun 2023 00:03:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6siuWV7rJ4qL+PG+ZI5knMQvxbUW4niIgecMjlj39naWNvNb4BhSwapVrV4bYkc9NjrzJD X-Received: by 2002:a05:6214:20cc:b0:5f1:683e:9bd6 with SMTP id 12-20020a05621420cc00b005f1683e9bd6mr1643742qve.9.1686035009336; Tue, 06 Jun 2023 00:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686035009; cv=none; d=google.com; s=arc-20160816; b=cRIXoZ6CV8dZ8fiGeKhlE/KqknOMfBIPXM97lkKrB2D7LUdxvjNVgCQYV6EjRQGNKm ugR4Vo0UzqpX3YKyD8eLLocvrCBsRypyiX33DnvmXFhg9DZgkbUxGp6xwgC+5eyEMUhn 7MqmoD9Edl+8KHK4okYbMObtDHzNxx2dmM0SmS4R6ourpqPUi/6fezXCkwOmGdWzKOJn P+sbCz7zWv/0jCOrmMNLcwa5NxnzJ1zmpDvpuHPGoZRbZy/ih/3FGs8BtWDyk1yK1jcx +9j86sGfrc5HbXmIpScIlzNofqKOHtSHkJJEQvgJMVf/xTY5T6fVu+WrSYl1pfkp4jON Y0Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=YS/lc+7zkpEg5CnVvB4U8rlrYRFe77YIDHqjNUBNjW0=; b=lEnn3bwxfsKVy7D/yAPedq3ndMW1Hk/L94QTlwpj4Wtm009vZquQWBFAqNCPBGlzdw ngbfwDFfY4nCYlJp8SeXzXfjKBpcCdsrPEYy1LFYF3fUI04MimL4C4m1JAbji1NyQwST WMRaFpznnidol7uR8jgfRRqjFZX6BXQYlNCzgpp6zSyLIYfOwkpYPixpASGWEHmmvITu tp2nEcWhxajuRbA0J2dbUj1Wxn7Fs6KJSOipAQXiuzafAx2KhWb9quaeCkI/5stzBlwY 9aPJ/18EsXEFNnKGLfcd154aloHd01cq7zTi7shdQx2M+U4IArz8CrdCxuUDzMDDspgZ GcbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Z+ATVHqL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gu11-20020a056214260b00b006257fbcd23asi5991894qvb.111.2023.06.06.00.03.15; Tue, 06 Jun 2023 00:03:29 -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; dkim=pass header.i=@intel.com header.s=Intel header.b=Z+ATVHqL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235033AbjFFGZJ (ORCPT + 99 others); Tue, 6 Jun 2023 02:25:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235348AbjFFGYq (ORCPT ); Tue, 6 Jun 2023 02:24:46 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1D2E1BC7; Mon, 5 Jun 2023 23:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686032615; x=1717568615; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=CXtd0YeGNfY5a80bxilWa2DrAUjG4CbrDtjbo7HK6Rs=; b=Z+ATVHqLY17cvYx+ooqN97Agh/KFvDjyiQmKbnmAhcaMFk4Y1wNJFnhz rrvVSlWdf05L5XSfMIiubwe49DOMW7GEnOE5LEw4lXgrVlsxdkEzQ/a5f 0GOjoc/5J47MKm5aZcg/wiM6EgqOxbIPa2me6mHuSjjNED0AshhGDlGl1 3QPkZdAF6zVp6BbOqQ0hRaGhHFDayuYSaD5uxiQYHvUMi369KHHqkYVS7 14cisUx+J7oBuOt3HvYm+rfmt4wihpFF8KQjVwPTVEcb/WfzjJrM9mhWz fjSn1smXOMLgp8/FhXeSL+tobyURtOnkRYyoXG9NT2vW3SK4egkLcaZA3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="336201519" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="336201519" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 23:23:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10732"; a="742017981" X-IronPort-AV: E=Sophos;i="6.00,219,1681196400"; d="scan'208";a="742017981" Received: from zengguan-mobl1.ccr.corp.intel.com (HELO [10.249.170.218]) ([10.249.170.218]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jun 2023 23:23:01 -0700 Message-ID: Date: Tue, 6 Jun 2023 14:22:51 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH v1 3/6] KVM: VMX: Add new ops in kvm_x86_ops for LASS violation check Content-Language: en-US To: "Gao, Chao" Cc: Paolo Bonzini , "Christopherson,, Sean" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , H Peter Anvin , "kvm@vger.kernel.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" References: <20230601142309.6307-1-guang.zeng@intel.com> <20230601142309.6307-4-guang.zeng@intel.com> From: Zeng Guang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 On 6/5/2023 11:47 AM, Gao, Chao wrote: > On Thu, Jun 01, 2023 at 10:23:06PM +0800, Zeng Guang wrote: >> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h >> index 92d8e65fe88c..98666d1e7727 100644 >> --- a/arch/x86/include/asm/kvm_host.h >> +++ b/arch/x86/include/asm/kvm_host.h >> @@ -1731,6 +1731,8 @@ struct kvm_x86_ops { >> * Returns vCPU specific APICv inhibit reasons >> */ >> unsigned long (*vcpu_get_apicv_inhibit_reasons)(struct kvm_vcpu *vcpu); >> + >> + bool (*check_lass)(struct kvm_vcpu *vcpu, u64 access, u64 la, u32 flags); > It is better to declare the @la as gva_t since the address is a virtual address. > > Both @access and @flags provide additional informaiton about a memory access. I > think we can drop one of them e.g. adding a new bit X86EMUL_F_IMPLICIT_ACCESS. > > Or maybe in the first place, we can just extend PFERR_? for SKIP_LASS/LAM > behavior instead of adding another set of flags (X86EMUL_F_?). The benefit of > adding new flags is they won't collide with future hardware extensions. I am not > sure. Make sense. Prefer to adding a new bit of X86EMUL flags. PFERR_ is used for page fault case and actually not proper to be taken for LASS/LAM usage.