Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp267956rdf; Tue, 21 Nov 2023 02:02:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0z/FkMZ2daewPwztXR0tCqy82XAPLQMAhoxVDPw+zaPnItE2w16Pbv3tT8bIAjqMG1plZ X-Received: by 2002:a05:6808:188f:b0:3b8:33b7:233b with SMTP id bi15-20020a056808188f00b003b833b7233bmr1995489oib.25.1700560978643; Tue, 21 Nov 2023 02:02:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700560978; cv=none; d=google.com; s=arc-20160816; b=wZodsK86X5yG/QWs2HKA1xJtn3Rmt4FUx2ceAYOyxyuS9EMb9yHS9rRPkZa6LQvC0a HunI6/X6htNCLNbeW4+nDh/noM89Sx+GUYvQ83oYOsPo2xLj7umDJ7DOjcMv78jAP+Mt GIDcTqDvMNPWVl3pauHA6OsMUyqE+K8nlnavBLbexGtw0TgPs+5PBWq8/kuFNX2wxBkr Jb1notcPNZnQk7hZwsuRm9hrLH5ikrnopiIYGVH9Jwxg0UMtUHKG6nluHqivryDMBzdp TEbVvhaZNeYwoc2cKnpzXZ1/hh44KqY2K0pkfGTfSLavdupRkdttjcR041K75s2PILXR a/0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dc2+7NBnXd0WllCOtVE4Z4Od0BxFk25W+EUwsCxTWoE=; fh=1Be8UynfIG+Duu9kbImSJDV1BXKOznS5Lf0DQgUMWfI=; b=wci/I226VS3gL9qYixrhbKN/L2kJcMGANoGEaoRoaL2YDivG4GM5Jo6p4wsIUYVv5r flS5TO3SqWRQ5PzgjVIFbtV0Wm30un8XxBtkaNLXIA7h/2wShUXsaM2wCAMVE8hrCFno kJbUhw+e+X5zuNVuLDNuN9AXyCEhOq6G1hz0Zmf7RE2FD4rf9Cr2AXk4OfwDe+gLvKCo T6Oqx0q2lgg7K3IXaO4AsRwJjfFGF9+KqzUZQfWumRKekArtocai6E6ePg0Ted/TVCsI PmLruYwsQvQqiWX8BTY0AP/Ov4rG3Eazd/f6+7TTdF47UYcbN3fKF7qgdYSIKgOpkY39 22XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DdEJoy7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id n14-20020a63e04e000000b00578a44df6c1si10234805pgj.640.2023.11.21.02.02.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:02:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DdEJoy7B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id E36598056C56; Tue, 21 Nov 2023 02:02:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbjKUKCs (ORCPT + 99 others); Tue, 21 Nov 2023 05:02:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjKUKCq (ORCPT ); Tue, 21 Nov 2023 05:02:46 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFA3112C; Tue, 21 Nov 2023 02:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700560962; x=1732096962; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=P53K9nuYns+G3kNjOrAT6WDUrhQtdzcmrGZfrt36JG4=; b=DdEJoy7BLQPpraGlwMaUlxhU1r6bCQ+xy5OyfH5s8HAqzTuMS8gJHs4T M6B4MEHBaSU+DE+fxq3qmtd3QewOPZT/lcmtwo+xx732vMRvvn5krhrNK lRTLE06kiFRZRS4IY8wSfoE9SNk68qutKWYuAg8uFD41wlDPIeI7jPdi4 8UQKcFjeSzju9sNpBnnimo1qkZ4CUk20pK2K0FQoaydTiOFJ9OQp6WEDi 4eMI1s2D81z9twojdeuRKLk7hqqWU1nOKFdXoHeXmfGYErlvyYVXuK3Dr D67w4NLfH35YxEqecVnCUa1uuejAn7bQqzBGx+KXh4C8wQCEEq8Q1QJcm A==; X-IronPort-AV: E=McAfee;i="6600,9927,10900"; a="371980560" X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="371980560" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 02:02:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,215,1695711600"; d="scan'208";a="8033718" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 02:02:42 -0800 Date: Tue, 21 Nov 2023 02:02:41 -0800 From: Isaku Yamahata To: Binbin Wu Cc: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com, Xiaoyao Li , isaku.yamahata@linux.intel.com Subject: Re: [PATCH v6 07/16] KVM: MMU: Introduce level info in PFERR code Message-ID: <20231121100241.GE1109547@ls.amr.corp.intel.com> References: <8e0934a0-c478-413a-8a58-36f7d20c23e9@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <8e0934a0-c478-413a-8a58-36f7d20c23e9@linux.intel.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 02:02:55 -0800 (PST) On Mon, Nov 20, 2023 at 06:54:07PM +0800, Binbin Wu wrote: > > > On 11/7/2023 11:00 PM, isaku.yamahata@intel.com wrote: > > From: Xiaoyao Li > > > > For TDX, EPT violation can happen when TDG.MEM.PAGE.ACCEPT. > > And TDG.MEM.PAGE.ACCEPT contains the desired accept page level of TD guest. > > > > 1. KVM can map it with 4KB page while TD guest wants to accept 2MB page. > > > > TD geust will get TDX_PAGE_SIZE_MISMATCH and it should try to accept > s/geust/guest > > > 4KB size. > > > > 2. KVM can map it with 2MB page while TD guest wants to accept 4KB page. > > > > KVM needs to honor it because > > a) there is no way to tell guest KVM maps it as 2MB size. And > > b) guest accepts it in 4KB size since guest knows some other 4KB page > > in the same 2MB range will be used as shared page. > > > > For case 2, it need to pass desired page level to MMU's > > page_fault_handler. Use bit 29:31 of kvm PF error code for this purpose. > > The level info is needed not only for case 2, KVM also needs the info so > that > it can map a 2MB page when TD guest wants to accept a 2MB page. "MMU's page_fault_handler" = KVM MMU page fault handler, isn't it? I'll replace it with KVM MMU page fault handler for clarity. -- Isaku Yamahata