Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp1443760rwj; Sun, 30 Oct 2022 00:26:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5da/navUoCC/PUfKI6zvpgbzkoEesUVtacRTerARus0AERYyxn6oybsdbR/o30iZNj0/5n X-Received: by 2002:a17:902:b614:b0:186:940d:7e98 with SMTP id b20-20020a170902b61400b00186940d7e98mr8139043pls.80.1667114812192; Sun, 30 Oct 2022 00:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667114812; cv=none; d=google.com; s=arc-20160816; b=UOP3OlEfivcbQXA/xWbxIPf4AC/EvSEEcTIlIPc7jsSi8SttZZ340vk/acX7ezIzcN TBI/d8EwuSiAya+GiCLJNxR91Slei+z6xgHHdhiwIUP9VFzGToaNK3aIrBNlYzUTCGud fu7ETGFQGjSOwIUR/kEn+SOt1fiiOELoFaZ5Vz2ArNoHASiYlE9djS5vWl+vdTCvSbzh HobWt5DMSTXgKn6KA6O4tEngqG9B/SPfaqig+S0DmDqd4yftZTDNQp5qClJhcm3S9ixP /TPyaIl8ztlp9wH71O0fsPKWpA0oVVm6d5ya3ZxqoyWzuijDl7HN3GGSees70fmcY48N Bu0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=inxVGe4vF4QKhLwMNf44Py0JWUdBuj5CIFdGMj7BVmc=; b=C+JaYnhWjTsH4pcJT9nvsWcSXSH0MJYsh57pCNyrqOoNHM1SaIVPdu65y5ZUxbFGsm OE64226pE0ImJU06X8mJ+psfldDXz491r/y9Q8guuYRkzpJPp+M492qIg0pGKnnEA3T6 HZLxHWbn1KDCffRczECZyJJe0dQDnecq6nSpL4vhdQIXH/bB15Gs0T//Q/qoXvPAzri6 DUhimJFiQEhsrUDqenRZW4oOuhdBke3BJuxqSEuPjOhSRYOCNfPbYHyZk6jzmdQrU/y6 obSiCtLBS9gre/JEmJVFqQGddR4XUsP+pRhQ19xowdF/ZY+TPHfIvBSjDZDk65cpovWs M9ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ChN4CBjE; 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 bj19-20020a056a02019300b0044e466f47a2si4774845pgb.141.2022.10.30.00.26.40; Sun, 30 Oct 2022 00:26:52 -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=ChN4CBjE; 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 S231372AbiJ3GbJ (ORCPT + 99 others); Sun, 30 Oct 2022 02:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbiJ3G3k (ORCPT ); Sun, 30 Oct 2022 02:29:40 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B168D33F; Sat, 29 Oct 2022 23:24: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=1667111087; x=1698647087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WudwhLKpm6+sj0md1RnElvGL9BNFi0c26OmHP/0eVm4=; b=ChN4CBjE9xf493v4op0BGibWSdPyTEVD97lGfzKssanIDo/vsccIvkvc JVQYwm46VQWWqWxQKsVYAMAXIXR3NqSmVsBtIL53Tpa5s5W9OtsQUFeee OwXEDRolbzf45HvDiZyECQXOmE0EcuIOUsg2C/A5iVEluNxhmZvRQ5F8p aN8b6YoT0StxgiQE5K9EO2xDvDxHZJ5qv9g6eoF4LslfZ+j7KMOx7nlz8 y5JJfHBfiz4J95Hl1OQOZrxdMKIj7yqHrx4GCW23coDJbrjPo47jJr9YF f+Sb2nV9yHYPVKMmopNvmfXiT3rQsjxOBZ+9lsBJknjHeqsaJZTl3eptV Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037195" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037195" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:11 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878393107" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878393107" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:11 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack Subject: [PATCH v10 082/108] KVM: TDX: Implements vcpu request_immediate_exit Date: Sat, 29 Oct 2022 23:23:23 -0700 Message-Id: <6901f181c0bfb99a8f675fdffc6429559edb5732.1667110240.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 From: Isaku Yamahata Now we are able to inject interrupts into TDX vcpu, it's ready to block TDX vcpu. Wire up kvm x86 methods for blocking/unblocking vcpu for TDX. To unblock on pending events, request immediate exit methods is also needed. Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- arch/x86/kvm/vmx/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index 13ad1278bef2..3e9007a7edfb 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -319,6 +319,14 @@ static void vt_enable_irq_window(struct kvm_vcpu *vcpu) vmx_enable_irq_window(vcpu); } +static void vt_request_immediate_exit(struct kvm_vcpu *vcpu) +{ + if (is_td_vcpu(vcpu)) + return __kvm_request_immediate_exit(vcpu); + + vmx_request_immediate_exit(vcpu); +} + static int vt_mem_enc_ioctl(struct kvm *kvm, void __user *argp) { if (!is_td(kvm)) @@ -446,7 +454,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = { .check_intercept = vmx_check_intercept, .handle_exit_irqoff = vmx_handle_exit_irqoff, - .request_immediate_exit = vmx_request_immediate_exit, + .request_immediate_exit = vt_request_immediate_exit, .sched_in = vt_sched_in, -- 2.25.1