Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp13804pxh; Thu, 7 Apr 2022 21:15:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeN/cIRMG0MhEQzqk7k3r/M0bcyPbcwgxP3j3T3EWdYo/3uQoCx8DJcV9BYgRzduomnh9B X-Received: by 2002:a17:90a:4749:b0:1be:ea64:4348 with SMTP id y9-20020a17090a474900b001beea644348mr19580915pjg.231.1649391353219; Thu, 07 Apr 2022 21:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649391353; cv=none; d=google.com; s=arc-20160816; b=U+k31U/nqhz5s9UQdMNUcWziPWTu96lEzIK2LmlGzpPtZIDOa4xtJxERcgv68s5CwS 1NAxE+dU0g1g+mmM6zGryjKGxI1nIYnDOD5T408NhVHke06atg9gT5wnuZNo+6sy/CKN JfPzGS4c5feVxYWLNFIxz+r01GxrPzMiXdaG6mWp3c/gejCMHJ3HK+D8hD0FmrIgVSqb 0ptgbG7wbUWdHZamvWd/eNmBJB6QOrlDeizG1bQz8xFCaGHTn38K0T4TMB0QZq/ScmN2 u9cuaguS7cSNfv9sZcosIQxxXRRcOAHRwa0IgIRybTqIgaZfD+UycRTaIaAeMTz4AtEV DWaA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=pQ3qKw1cpdTuOMnW8XO0UfWbxnBpZP9Z51yPQ0+S3vY=; b=TlBCPV8kKO+6F21CNGKJ2/Rj4UCroyU0AoPD/GewBWzCKnAzCKO7Md2wF3A8zhU5VA KmdXO8h2vsj2O9sneQ925ZWhyMFg53/QFNdhwMSIJBmAxT93DuuW6F2Fsy4Md/GMUX7c WrVK2bGDmSZOdbr1wDEVMRh0fnwuWXyCAqgWiGEADknalwyVVcxTwisYmzvP8Q9ooJ/1 SZPfiR7ChcFVPPgQbHjtQT4zFO05lnbrJg5hOFn1y9WsvWjzuxiAvGnAha8fPHGEeW1o eXwVRzCSDJHq7aO32o0XpaG2KUKKPwksSAfYdVUT2AffYfFtDoint/UY59aThMvY7vvJ xAlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GGcaLejh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g23-20020a63e617000000b003816043f10bsi183254pgh.768.2022.04.07.21.15.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 21:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GGcaLejh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 31C73165A3; Thu, 7 Apr 2022 20:41:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbiDHDnF (ORCPT + 99 others); Thu, 7 Apr 2022 23:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233853AbiDHDnC (ORCPT ); Thu, 7 Apr 2022 23:43:02 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 884B062FC; Thu, 7 Apr 2022 20:41:00 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id a42so771260pfx.7; Thu, 07 Apr 2022 20:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=pQ3qKw1cpdTuOMnW8XO0UfWbxnBpZP9Z51yPQ0+S3vY=; b=GGcaLejhCvGkmYGBsgqOlr+R3ISka7TvB4jP38j5hLaFAcT7YkqDoHMOARChyvBQYt DL7NilLdv8DRTxKGru5U2TJVLFYf0/jP72Fe6QwbyInIH1VoEO4mvgl64UpQZaVVQrRH NI/JPzi8pbmf+KfexS1wkr0ngWgLTXMdFr0MO6jWRd//iuOLfq+FTw5kLxK9tim+amQy S+EHNI+sfKfts0cYncgLgZ4fbUXMg/Im2eMpfhrMI8zX1VsCcGLyOzEkeYIdg9ks+1Uy l3B778jgfUe1wab3vi4bhYJxLy0U6OIgh5Y/B8Q/2wql1/i4wK3xvQzK9spMwmaFrTOS J8Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=pQ3qKw1cpdTuOMnW8XO0UfWbxnBpZP9Z51yPQ0+S3vY=; b=WUOAKcd4+6YWLp59bhfdwb5HYP7mrGZD7t+bFVF+UisBDwRo9I0iC8binappnaETVP icx6kIzYKAxJvvy/G4sR5YkXYusLl+IrQ1PkhqPnt08jTNeA4cEx9g8E6TtwCy16wxEm ZS7JUZS2xaArOpRvfx+navvPaGKP9aQxs0LlDQLyVA8l78O1yOjFU86xtHkQmQNGIFrV aZCe7RfCstU3VznImnVK9J1vvRwnXhOd6HirUD4rR3AiHH8yfpT2p68dC05A/fxCFehX nFum+WP2EC6fdmUNThOtzSCp0557y3lOhAyZwW/lZDipImUnLFrLn6L3u37b5oH52J3k OKDQ== X-Gm-Message-State: AOAM533TfywXj0DAQj/haCxIiByOwmj/zP/bbwPfFix0DflIaFWo+WVi gXl7q8uSM2ZKVe9bBDkfRK4= X-Received: by 2002:a05:6a00:c8d:b0:505:6f48:8434 with SMTP id a13-20020a056a000c8d00b005056f488434mr4445866pfv.47.1649389259869; Thu, 07 Apr 2022 20:40:59 -0700 (PDT) Received: from localhost ([192.55.54.52]) by smtp.gmail.com with ESMTPSA id m13-20020a62a20d000000b004fe0ce6d7a1sm15006630pff.193.2022.04.07.20.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 20:40:59 -0700 (PDT) Date: Thu, 7 Apr 2022 20:40:58 -0700 From: Isaku Yamahata To: Paolo Bonzini Cc: Xiaoyao Li , isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Jim Mattson , erdemaktas@google.com, Connor Kuehl , Sean Christopherson , Tom Lendacky Subject: Re: [RFC PATCH v5 101/104] KVM: TDX: Silently ignore INIT/SIPI Message-ID: <20220408034058.GG2864606@ls.amr.corp.intel.com> References: <48ab3a81-a353-e6ee-7718-69c260c9ea17@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Thu, Apr 07, 2022 at 02:12:28PM +0200, Paolo Bonzini wrote: > On 4/7/22 13:09, Xiaoyao Li wrote: > > 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. > > Let's add .deliver_init to the kvm_x86_ops then. Will do. -- Isaku Yamahata