Received: by 2002:ab2:7104:0:b0:1f7:f6c3:9cb1 with SMTP id z4csp49471lql; Tue, 7 May 2024 09:25:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWEQY7LQBJhwNidhieMvqEp+0I2VlqPTO184D9P26mPcu17GNRGL0541kStXS/GIet04Zovk0GvvaE2dEiC+MxFJZGOsLM8w/pNr4TeGg== X-Google-Smtp-Source: AGHT+IF3dO7/1BSIOj2DE3xfnAFUeP0XWS/Azl5p7wXQgcs5UgGah5Dl4vD9W2EPdz43++jEIwmZ X-Received: by 2002:a05:6358:8419:b0:192:4634:b1db with SMTP id e5c5f4694b2df-192d2e40913mr23655055d.11.1715099116649; Tue, 07 May 2024 09:25:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715099116; cv=pass; d=google.com; s=arc-20160816; b=MV8tkqvz4cDFcsANub6PK4v+w0TOidEqQP2Ln2qzBCNjF+nuFEakKzgqCv++aQ5n/1 LTmERGhHIJBakkXMdK1/CBPbDh3T1SzCuTS3SIeDN2mfn1w6216kAfRUP/Z8ITS5ULRA jzg+WHoo2xeWzOVkFE7TgEryU3vU5HFu4vu56dJiMzcZsNZ1YKetjCt7pVCGac+jrd5I /65qo7qWVng2TaHMiV1IGl0XLbPgNgywBcvQJrnkRnLVW37nkemoDQNAb8ZMLFHMpuzb 7xdkJrSGzwEz76yF4AkXwECFXKTC7GFGCZYBshO/AQAkxAy9iuJ23jy5sG1UlafBSXwk 7zeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=zDm0nic8Bf4ROxi6HvrqFLQrZg3PZkT7VQQx+aQhnBY=; fh=Xa5wE+F567DaZj01Zu46kUdvzaV/heOFcY04S8TVpcU=; b=yp63G9ui54HRNfgPJbDUQXGLGHtVxk2G0sADN9Cnl6I5RXBb6biD/wGKHkzFeFS8ox nftfkjz1KqPiCaq6MhI7Ar6GZPKxhOhSuZdWWzNMAjHmXNS0Bt3q5oAHn2OmZBjhxEId 6ylLY/zChAHeq1pKSPw/rW7WzC9QDAXggvbenQlAjmPDKDxa1c5hrybTU1FPDqRbIo+X R5cAx7N+5OLAHtbBy+kzZT6bBlrScZEwdYH/V+J+oqyD5hmNv8TIhWmLmlVp4GyTC6en qHn9yBdoRNVKrC6DZdN7v8t5NZxReKKxEH9WSKy3jzyz/l36O2YlxhIrucihuqyeKeIc 57GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=n7K6i1j0; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171791-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s8-20020a634508000000b005cdf8b03384si10708518pga.805.2024.05.07.09.25.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 09:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=n7K6i1j0; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-171791-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171791-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 01781283641 for ; Tue, 7 May 2024 16:24:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8901D16C455; Tue, 7 May 2024 16:24:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="n7K6i1j0" Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58C9916ABEA for ; Tue, 7 May 2024 16:24:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715099062; cv=none; b=OWEbKbu5+8zFVsJDi1HyxriT5OsnF8QEcKF+9PKMga7sfujgNnGkdRT1U0OFXX7hKaV+Iy0fwTmVcVFRm2jPGCCaBbyPNy0MBQylLmZshk1vcg7rSVSQvpcVn3rIviGUoS5e9GY8+9TMp+zqy5KKGbZf3OjuWieZb2WjWVD4HNc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715099062; c=relaxed/simple; bh=wJbp6WjEK+6FtVYJhPdauEq2bIrS1FhcPXI3PtQy6wU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RfT45XjfNAer3gzygXQbfggxKqvAcS1+g3dDzcwIrbxHrOei09kaViNRXKMSEF3iV9pEsxElZfvkj+aGx8HOoHosfIXCmxDs3ri2yWCh0zoY/HeYr9we18Bx37RneMksAs5haW0wvUYHQ30Euv8/cKlNMpuI1SAPeHPe/iJIdjQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=n7K6i1j0; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6dbdcfd39so6507150276.2 for ; Tue, 07 May 2024 09:24:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715099060; x=1715703860; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zDm0nic8Bf4ROxi6HvrqFLQrZg3PZkT7VQQx+aQhnBY=; b=n7K6i1j0CKyRAITHjMEkX8wOIaFkNBux9wU875LGgXTUDjA6mWdy0g7obvcMlINETx phVZICSPfWT1nQVGKBynSfnFcQ/9neh83sUHGf1oTu6vW8oMIJs63b5Bcwfh5VgrDZDm kwWYcFCyldVwrqJwLwEMhyUlQA07BUUjC5SHDEEtPolQoWhCjZH+Rr6MB2Wub2Yq6m6/ 3SaDgw9P/6tXWe3rOF7UVwJ2DhKqSo7T0WyVDdhslLM3q+WrxXH/puAXlNftOR1RLbmM LFdaEF3H7A7H6mFCg7eK2gXMN4t2FzSDJRUGdSYkzImsyVmFVsd2Nvk0ivENfVF2YPHt h/Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715099060; x=1715703860; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zDm0nic8Bf4ROxi6HvrqFLQrZg3PZkT7VQQx+aQhnBY=; b=S6gcBTJ4u/RtrjzyjleHl7I+FCTHqtkDRimrE8q8Rf+jLpVi8GdosCym23HWfa57WH RHiBR7u6exwC4csUokGBdyYuvXD7BbdCZ0HAxSeRNMFrAbkNdhy6IqFWro0a5DbWEUwS Nv7wkt8KFKRfvMw0wVyCfbVZEPfPdI/0MD4FPT7Z/MW/Be+OzBBTcitq3uzk1v5P1h/3 1nb560wrr1r7g4ER2bSKIsmAfnDyrC/R38P+ZKwCbvQH8datFgOQko9csywvmBg/Bdoo BVgJsGt+9mBTDKbxIztKkGtOAB1cycyG2Mx8dySJXGTmdqpb+VnB/CyJBy3o81ozdiDM AcHQ== X-Forwarded-Encrypted: i=1; AJvYcCUxOR2OxXomo8ydu2lNEPzSVzSbEiEh+XC3vWusQXJ6vtdpR0PIrUeaO2dtDVZq+gpKRHEMzgz7FXi+QV5pPvOtglaMNBTVRQDyPLlU X-Gm-Message-State: AOJu0YwZ/lxTKF7JZzhGShiGPdjyr6Bolfh40ZAhoe5oiUu70QPX7NfF uPPu33o3qJ8ifyjC/phWxrV315WbN+C/G6Ho0K03tscMtbPhL9NyfeP6tRbrsmHC/699VB4Mpto UKw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:44:0:b0:dc2:466a:23c4 with SMTP id 3f1490d57ef6-debb9d86d55mr29973276.4.1715099060476; Tue, 07 May 2024 09:24:20 -0700 (PDT) Date: Tue, 7 May 2024 09:24:18 -0700 In-Reply-To: <0ddb198c9a8ae72519c3f7847089d84a8de4821f.camel@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <900fc6f75b3704780ac16c90ace23b2f465bb689.camel@intel.com> <2383a1e9-ba2b-470f-8807-5f5f2528c7ad@intel.com> <5ffd4052-4735-449a-9bee-f42563add778@intel.com> <22b19d11-056c-402b-ac19-a389000d6339@intel.com> <0ddb198c9a8ae72519c3f7847089d84a8de4821f.camel@intel.com> Message-ID: Subject: Re: [PATCH v19 023/130] KVM: TDX: Initialize the TDX module when loading the KVM intel kernel module From: Sean Christopherson To: Kai Huang Cc: Tina Zhang , Hang Yuan , Bo2 Chen , "sagis@google.com" , "isaku.yamahata@gmail.com" , "linux-kernel@vger.kernel.org" , Erdem Aktas , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , Isaku Yamahata , "isaku.yamahata@linux.intel.com" Content-Type: text/plain; charset="us-ascii" On Tue, May 07, 2024, Kai Huang wrote: > > > So I think we have consensus to go with the approach that shows in your > > > second diff -- that is to always enable virtualization during module loading > > > for all other ARCHs other than x86, for which we only always enables > > > virtualization during module loading for TDX. > > > > Assuming the other arch maintainers are ok with that approach. If waiting until > > a VM is created is desirable for other architectures, then we'll need to figure > > out a plan b. E.g. KVM arm64 doesn't support being built as a module, so enabling > > hardware during initialization would mean virtualization is enabled for any kernel > > that is built with CONFIG_KVM=y. > > > > Actually, duh. There's absolutely no reason to force other architectures to > > choose when to enable virtualization. As evidenced by the massaging to have x86 > > keep enabling virtualization on-demand for !TDX, the cleanups don't come from > > enabling virtualization during module load, they come from registering cpuup and > > syscore ops when virtualization is enabled. > > > > I.e. we can keep kvm_usage_count in common code, and just do exactly what I > > proposed for kvm_x86_enable_virtualization(). > > > > I have patches to do this, and initial testing suggests they aren't wildly > > broken. I'll post them soon-ish, assuming nothing pops up in testing. They are > > clean enough that they can land in advance of TDX, e.g. in kvm-coco-queue even > > before other architectures verify I didn't break them. > > > > Hi Sean, > > Just want to check with you what is your plan on this? > > Please feel free to let me know if there's anything that I can help. Ah shoot, I posted patches[*] but managed to forget to Cc any of the TDX folks. Sorry :-/ [*] https://lore.kernel.org/all/20240425233951.3344485-1-seanjc@google.com