From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F227BC433F5 for ; Thu, 7 Apr 2022 11:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233784AbiDGLME (ORCPT ); Thu, 7 Apr 2022 07:12:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244680AbiDGLMB (ORCPT ); Thu, 7 Apr 2022 07:12:01 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C390D64E8; Thu, 7 Apr 2022 04:09:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649329793; x=1680865793; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=EQGzKLPkMKM4S+AjnO1qx/YQtzyW0JHeQb2G2zJJxgA=; b=DAUufCwV31fU6M1MrDQHZzhX3+UYl+kKkdv+2OPhTRycEJydlRA9wN7o ziarUu7ao2t06Pyf5+HEzNZKnPzygeqlw7wBKmQxnGTL7LCramO1wVHu5 uWUlffYwTkH8LZn5krzQJCehKL0oKsR5agDWwdpWDQ3e+pKBUk2U8K8ji cedfnFS/4EvbWWln4fcqsvAf9oKNJySgjN3lBKA2JI4gqzEJD1DJRYM3P k7pRae0XHnqjCPxKpUMqwoOrcjr5cZOyAeGTUpVnQffMIpS2WtxIZYOF6 3bk8SKa4qfk1gWnC5w8PEs0hCdUfNHs7LoXsWrQMiVq81bGdx1MULnzQz g==; X-IronPort-AV: E=McAfee;i="6200,9189,10309"; a="324455542" X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="324455542" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 04:09:40 -0700 X-IronPort-AV: E=Sophos;i="5.90,241,1643702400"; d="scan'208";a="722919033" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.255.28.125]) ([10.255.28.125]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 04:09:38 -0700 Message-ID: <48ab3a81-a353-e6ee-7718-69c260c9ea17@intel.com> Date: Thu, 7 Apr 2022 19:09:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.7.0 Subject: Re: [RFC PATCH v5 101/104] KVM: TDX: Silently ignore INIT/SIPI Content-Language: en-US To: Paolo Bonzini , isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , Tom Lendacky References: From: Xiaoyao Li In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On 4/5/2022 11:48 PM, Paolo Bonzini wrote: > On 3/4/22 20:49, isaku.yamahata@intel.com wrote: >> +        if (kvm_init_sipi_unsupported(vcpu->kvm)) >> +            /* >> +             * TDX doesn't support INIT.  Ignore INIT event.  In the >> +             * case of SIPI, the callback of >> +             * vcpu_deliver_sipi_vector ignores it. >> +             */ >>               vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; >> -        else >> -            vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; >> +        else { >> +            kvm_vcpu_reset(vcpu, true); >> +            if (kvm_vcpu_is_bsp(apic->vcpu)) >> +                vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; >> +            else >> +                vcpu->arch.mp_state = KVM_MP_STATE_INIT_RECEIVED; >> +        } > > Should you check vcpu->arch.guest_state_protected instead of > special-casing TDX? We cannot use vcpu->arch.guest_state_protected because TDX supports debug TD, of which the states are not protected. At least we need another flag, I think. > KVM_APIC_INIT is not valid for SEV-ES either, if I > remember correctly. > > Paolo