Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3017322imw; Sun, 10 Jul 2022 23:02:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZ9AueKIGuG8pgK8N9v8W5QVHpYxTTn6pMFXQkbQAraeZmtkQS0mybBTjHzCUW+K+GTBAU X-Received: by 2002:a05:6402:b9b:b0:43a:5aac:ed6 with SMTP id cf27-20020a0564020b9b00b0043a5aac0ed6mr22302816edb.131.1657519324777; Sun, 10 Jul 2022 23:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657519324; cv=none; d=google.com; s=arc-20160816; b=fFHlvmKTRSyaE+kfMIiX5DsPcAsM6sakMNi6+A7HmxrtxWJv7K357hDEE7lv46oPx6 OjHmUyMJ4/ilc4LLXrtRcx7on48s7cru/Hj/69DE9pkzVPsaoQzUc0e3M9UzTeHphiFV gk8xv4G38BrpEpGOlJdXUup0H1thKC0clcNJkXEUr2vmKoVPnhz3jYugLM2IXQ2Beui6 1Orwx9S8+7xliMj21Y8u0ABnd3eGobaDUDAEH/rn0D3y6MRU6gs54Kjd3C/nSYPl8R2T QonCkDhyQf1fZtT0/9ME6cL0CXAqZSUAfzv79tPblFOEowB0oj+tboVp1PM+M0u/n/ME PaSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=YpV6wMoJa1W0KwZb+bigxSXidQTGET8L13Y1E6CcGmw=; b=ReUeGSkA4sSWdLH+Ob7OnW83oRRGv1WWVjyME4wh6vceiRW6g36p73Y/TEqxs7Kbo7 I09O7QZo/3pmEcUiMfLtvxCmcF/wQxOf3tS0Yt65+rA/ErOYrEL2KnNyQ8BDQNISyLib M9hvXANQi77Cy70MlTTz6eJs58DwtTkVN7XLSaHBkHqKonegfMKtUOFh1a0PElZddDUr d/wLMZ7E92OSiDHKErtw2zNQE177Qf0rz+S0bTciW1jUw9aFs7eHd/1pJNhBekhdUO2k JA0hSVcBVpCpjLpaQpURoeNxzS4ZOzzD+YFSR0zJqT8MUZ69+cYEQ/yuvUzRtOZt79PE 8w5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="X85//BZq"; 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 g17-20020a056402425100b0043ac9258fbasi6551427edb.188.2022.07.10.23.01.38; Sun, 10 Jul 2022 23:02:04 -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="X85//BZq"; 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 S229544AbiGKFsu (ORCPT + 99 others); Mon, 11 Jul 2022 01:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiGKFss (ORCPT ); Mon, 11 Jul 2022 01:48:48 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49CC415FCC; Sun, 10 Jul 2022 22:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657518527; x=1689054527; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nJ8PlUBoQwoeShO3ziyubBuG2AA62mhcNqL/Nkw5+kg=; b=X85//BZqeOUqbF6OOFzYdQ8dJjFqifi4pNcmUDAcqFNCuZEetTNyOUT0 pt6imWpgfsGEpqRZ0XciucJtpZuZc+bP+wWsM6cM1YYVmfzvkkZ6ZdZN3 KPZExkLO7IVjU4iK44LoIG3Kkv16+CkqaFYfDn+yulZCxd84wmqy+G5Py tUBvMgDMMPjplDFoDztm7CVGSF6lsLyzPXQdRw9MQZHm1Pmv9fEH29mUT 8lDKF0sZF7moTuUNC42ou/GWnIG93hHVuI7QRfEMXx5e9Yfs/6/z4jVKL xweF1l8BghffHqcYI+f7MI8CkDO9IaH8LXtvDC2pz4RMofbzislXh+AnB Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10404"; a="264357379" X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="264357379" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jul 2022 22:48:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,262,1650956400"; d="scan'208";a="598921065" Received: from yy-desk-7060.sh.intel.com (HELO localhost) ([10.239.159.76]) by fmsmga007.fm.intel.com with ESMTP; 10 Jul 2022 22:48:45 -0700 Date: Mon, 11 Jul 2022 13:48:44 +0800 From: Yuan Yao To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini Subject: Re: [PATCH v7 043/102] KVM: x86/mmu: Focibly use TDP MMU for TDX Message-ID: <20220711054844.wb34vvqf74wkb2jp@yy-desk-7060> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Mon, Jun 27, 2022 at 02:53:35PM -0700, isaku.yamahata@intel.com wrote: > From: Isaku Yamahata > > In this patch series, TDX supports only TDP MMU and doesn't support legacy > MMU. Forcibly use TDP MMU for TDX irrelevant of kernel parameter to > disable TDP MMU. > > Signed-off-by: Isaku Yamahata > --- > arch/x86/kvm/mmu/tdp_mmu.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c > index 82f1bfac7ee6..7eb41b176d1e 100644 > --- a/arch/x86/kvm/mmu/tdp_mmu.c > +++ b/arch/x86/kvm/mmu/tdp_mmu.c > @@ -18,8 +18,13 @@ int kvm_mmu_init_tdp_mmu(struct kvm *kvm) > { > struct workqueue_struct *wq; > > - if (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled)) > - return 0; > + /* > + * Because TDX supports only TDP MMU, forcibly use TDP MMU in the case > + * of TDX. > + */ > + if (kvm->arch.vm_type != KVM_X86_TDX_VM && > + (!tdp_enabled || !READ_ONCE(tdp_mmu_enabled))) > + return false; Please return 0 here for int return value type. > > wq = alloc_workqueue("kvm", WQ_UNBOUND|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 0); > if (!wq) > -- > 2.25.1 >