Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp772805pxb; Tue, 5 Apr 2022 22:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0AS5P8luBWzf51VSNK2+7YdBTCiNwbLSnc/NU53clyONQBQnRmhAlwUcDI3v+X5yrgV4C X-Received: by 2002:a17:90a:d083:b0:1c9:94bb:732d with SMTP id k3-20020a17090ad08300b001c994bb732dmr8132539pju.106.1649223754309; Tue, 05 Apr 2022 22:42:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649223754; cv=pass; d=google.com; s=arc-20160816; b=PSq+Gql+EVoI8F+54exDtw7R0oUmIUglPW4gOqvZb6xVZjyFDelcVrZRJVdpsMRg/L goVmbmaKVSsTqE3QYhoJx5yvP4fQxIl/BNJV2tpsIhVOwfkBPcgmAf4y2BaAPfiTwckg rye+44ORMvJOoc2wGQ3gDpdU3k9HXFmiO5M8pg3nOWBFVmF6zD9ZsFOaEJJvIgk3ho66 uXrfenDCZiWplxVq4gnz4hW3xeCYvdRzDvlg5pFyx+DI34IdfSR8mtJr4F6NLhuE0e4L fQ5hVZHMf/A2O5hockEOo7MxeCUbNp33n5DeSKRiVeVa5XcnLA2w7hp2zQq+ivYXRCAL 7qlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=cx0Md85+OjQl+K3dA8Y50XnOsnMOptANWRBjNvTs12c=; b=uJJqLn59E5Ry+7kajJl3ic89gV66Vg1PZFxdlZaKMnr8Ep2dpu/daJkzWRjxNh6Ktz 0fDBVSOupiO0uaIQ3VGqoSGC5usqjHLKefPTw81R35o9LLvEXDS5ImIwhmTvbh1V++q6 eB9YnC+FA6VeJCmEzuHRmaypBoh8BkJNm6rOszk3RqNndKy7d3qh9mxyr0thgktoxKQ1 zOkIp8SbBYTt/l9+6GNk5Uz6kb5992i/OMfpm7sbu9ZrlwgR1I4Vr0Nb2moZB1ln9swf NLADJCc45UuU9kjiZ7Dtyx9g3+gvuGcM8BE3ZNpNozHK/KIYlocLDi7DtoeMJH22s9xm V/eg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xmk9n5U7; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k1-20020a170902c40100b00154304022c6si15405853plk.564.2022.04.05.22.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 22:42:34 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Xmk9n5U7; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 909574405FC; Tue, 5 Apr 2022 21:47:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345745AbiDEVDK (ORCPT + 99 others); Tue, 5 Apr 2022 17:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573088AbiDERzg (ORCPT ); Tue, 5 Apr 2022 13:55:36 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2079.outbound.protection.outlook.com [40.107.223.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA840C53; Tue, 5 Apr 2022 10:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JF1+LxTe2qiU3qpt5EQyT0gqHpY7rs1xGXU7qDN7XVUdOwuEGFHl0BFFXsfFfUY/NTtqiR3GZbWJ/SXlk4ObZPpAmqZ1XM3vhuZXr1lP1k0lO1xXvLCekM96SuHIiK5qv/55Aiv2di/0UAptcpVL/jHYU6/mF1fHWcqwRbsrJ1P8hWpexv2HyN5nZY0r6EUtpfaCXN+4rGj3UDpijIb3b90Ynv63yq/ovhve3kPsGlUpDZQq/3oQIIsjBmR3cdXdb3T75sb2smrHAsdWkdcK/LFiDW9Qsv8sVsJNyoQICMr9Z1e6WUHoeObIxSDUAXuAb2KzJxmJRqxKSpejbXrO8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cx0Md85+OjQl+K3dA8Y50XnOsnMOptANWRBjNvTs12c=; b=EddQpUNsDsQYY93A6J6fygARxm/95nDscMrMH5K81XrzM+/AXBqcEDP8Sw/pVo3qOzFOtgmm43Wz0h30lGzIzYzqTF04FrOaI0+8g8T76pB71pcqkwLGEaD/2NFuF89TERwZllw3o3u3qVS6CGnJE65SzzRh5IafEogud9kWbsm+pREYhWu/yR0CQlkdxWqXdhKfM1ScdYvt6P8S9i6+kxlx1Qv6N0Fw6lW4GTiT1xLi5dQ2lnL4pn18zWDvvIeELFAGowig+aXt7uSHRn/gWKYY/+ogeGU/fwzdERjdKQYYIj5DL6JiNqfn0Am3MfbJ3YhZzV10b8ar2kYwBCHRqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cx0Md85+OjQl+K3dA8Y50XnOsnMOptANWRBjNvTs12c=; b=Xmk9n5U7mahqHeFWo1JS2HqGf4+/IvcUfCbZ7grFjaCgHhF4WYQRUfLtizE50Iqor6gZDhySiM9w8Wi3bK5wcO5fUHUQYcMcXqs4A3l6mdyMabWMopu+YvCvyJONIausj94OqTFijv4dI9l2BFYufPxfH3Bpbr+uuhHCGKga7D0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) by DM5PR12MB1849.namprd12.prod.outlook.com (2603:10b6:3:107::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Tue, 5 Apr 2022 17:53:33 +0000 Received: from DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::1946:2337:6656:ae2e]) by DM4PR12MB5229.namprd12.prod.outlook.com ([fe80::1946:2337:6656:ae2e%9]) with mapi id 15.20.5123.031; Tue, 5 Apr 2022 17:53:33 +0000 Message-ID: <700e336a-7d2f-e468-f38b-96e6d35174e7@amd.com> Date: Tue, 5 Apr 2022 12:53:30 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 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 References: From: Tom Lendacky In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BL0PR1501CA0022.namprd15.prod.outlook.com (2603:10b6:207:17::35) To DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bef6279a-302a-4310-60e7-08da172d3375 X-MS-TrafficTypeDiagnostic: DM5PR12MB1849:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7pQkoUL9rNeFdMBi7OWm6P42tcz6Vieizr6+NJdLrN545w9v6UhkGd5Aou1T7iqiXnjxyZbrkW94T8iyoGFmWZq7FxgdRFHZZxI/kVk2xJbhZxi4pF1Tv/eTOIXdYDefkuqi8D/LM5Qmf7+NANi7wNw119bNH5cFvc7SyoICrkQGigGM+PM3FiXh7WmWpsx7bb5p3JHQuQd3nDG6+Rjj3FsP0NFVMg9kLSW6RdK0WoT/M42eUPsIFYenh+xS5Z32xfRmGFBO1LpQcV09Ou8fJUbgbU4b2p//2+fb1l7BoiQYwoKF7NrmZiD0acnr1gG1BmD2LFjjOengVhmnzFxvgJwgWH+R5gok7xkkadhjPRPO3N/e07m2afZcDvNjxojEyaXK5keJhYXu5K7YPU5Ljwu+jbgZ3g1hDO1fw1W2QJ1MGkHjMiy5KNjE14wvg2eflrCR455sd/JHnXtd5wQ+WRhf7j/lvRtHRJ/tKlWc3i+1goNl8XxoeuBN8QxaB3pZqJjBkmCyoBmORYQreDohJOJtv/RMN8vlyCm9gfrsqcxMujnuhLr6vAVvT/DJUHRUDu5Eks0LLKoy/ywT6u9WbCAZdMZWqqg+TsTsDBlYEw5XUrJFGODx0aSg8Mwp+PGyql7Ll/24pZrJbxNqBkqRiO6NhOqU1rOlNQqkL3icqy3mDfwsOoqSTx97pqjMCKZDS1IkzIeckOLmAeunxe7lVDsNZ7gOMm69c/3gqn+qC0g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR12MB5229.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8936002)(26005)(31696002)(54906003)(6486002)(186003)(86362001)(316002)(2616005)(508600001)(66946007)(66556008)(66476007)(4326008)(53546011)(6506007)(6512007)(8676002)(36756003)(31686004)(2906002)(83380400001)(38100700002)(5660300002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YUlON0didXRHYUZrREdyL2d6ZkZrcngzUUlsdCtDQmo5TC84Qmg0UGhBOE03?= =?utf-8?B?Z0VBYW8xamFaZThSSUNNYkN2TWUxQ2x0UVFjWGVGb1RObTljWFo2MUM0WnFQ?= =?utf-8?B?dW9PWmdLQnkvTmRLTkpFRktEQlYrdnd3REtsWEpWMkovSVVDcGZYeVdna0Jm?= =?utf-8?B?NDd2SXQ3Rk53cmQvM3JnelBOSXkzTW0vclU3SmNEU0x2ZWtUM3ZNZTJZWHpT?= =?utf-8?B?SWUzVFgxbG5vNjJBazlRVWVqRWozQlVlTXNXdWk0QlBVUmJER0N3VWRxWmw1?= =?utf-8?B?aEluc3VrZ3RWWUk4VmRPUk4wVURQYVZwUDlGK0puMXZnTWVqQXhZdW9IQTJP?= =?utf-8?B?cnkxMWFhUk52UmxTMW5VZklKcGpNcG5mS0hObkZndkZZRHVGTnB5NWc4aTFF?= =?utf-8?B?N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ERXBhVitRRjdvaVdIVkhW?= =?utf-8?B?cEpFK2xPU1hDditPV0U3clFId1M1cjZKMlIwN2J5L1k0UFd3K25QZGNvRVVW?= =?utf-8?B?azVXRE1JLzlNd1BJOVZxcjJzeWF0WW5yYmFlM3lmVEJvTmREODMzUT09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: bef6279a-302a-4310-60e7-08da172d3375 X-MS-Exchange-CrossTenant-AuthSource: DM4PR12MB5229.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2022 17:53:33.2831 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aDjYfTRsBnD3yVp3tXT3tZk0NGY5OwWPAC+2nnaOkx/Akp0FVDe9qeoYDYmYtbnUgnsCH/c9uQitZUeEO3X+KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1849 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 4/5/22 10:48, 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?  KVM_APIC_INIT is not valid for SEV-ES either, if I > remember correctly. While the INIT doesn't update any actual state that is in the encrypted VMSA, SEV-ES still calls kvm_vcpu_reset() to allow KVM to set any internal tracking state, etc. I haven't ever tested SEV-ES where that is bypassed. Thanks, Tom > > Paolo