Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1665092pxm; Thu, 24 Feb 2022 07:15:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj8IcICkOIoqcYyV1P1FGzs7bEf5an5zt4bkWL5jnScsVQww6CpH97j6sqfqXzCLk6lBVM X-Received: by 2002:a05:6a00:124a:b0:4e1:7cfb:634c with SMTP id u10-20020a056a00124a00b004e17cfb634cmr3437383pfi.12.1645715724298; Thu, 24 Feb 2022 07:15:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645715724; cv=none; d=google.com; s=arc-20160816; b=FFVmj0I7rXiDv4lwS6ftNPsmbEocIPgrTGuatCiAJZTmJzq+52r0t8Esd0mclGizOR 1UR1UsskfaRCU8dq1+TQF3FtoLVWu+zm690XoKHojU8dEeT4WMU2GZjw2i15lZMChgPd yTeguxcKFkYeM8JyGXitnDzgqBFmlfzwaShcrXDEFQgQeKtIxhByLcLeI+ODYA4ew9UO zOwJay0pXM6um04xkMX1RwNp+wDpLnJwXOk+MO819GPbRAcEWHbgF9gyNud6jgS5bPoh RZ9h5u7fuMhFGNJmcbcMfHf1oqq8YyJnMK6mnrlxIam4Q/SUJM3b23RaxowHDILE93pZ Ckcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7t/PhndngG1sSe9ScfhTi54FhdXHMvtO4i3SsRE9GWw=; b=w27GAYw5WPIGtUPheC8vSGzjW2TLWYNqWGRAvmXcRUuRCKVBdhH7qSUDoVDQD07Rix OZrDoArBII65gzf83kpoJF0Obov7IrOB4ogAt2DYqgJIxzigcG6eI5OVy+R/7IgLWWqU M8q+qDT59vNVEAhRP8mAwww7zuBEaBFsWSeuCOowpz8++FbNbq3X1Ce1pWx8UPdjHkal cRMbRqzwECe7vuo/v3g98Nq6AmImNiK3WOVxPZcuKBkNkbq3mPGl0p0FFh9HFOw92AW4 IPhr2sBoCrsOdzT3QobMmRpTLq0jCo7ej5TTSABD8UudqjBD1I+GpsNciSFkrBapNFJC zhwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N2uVPf5j; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8si2325936pfa.193.2022.02.24.07.15.07; Thu, 24 Feb 2022 07:15:24 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=N2uVPf5j; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235685AbiBXO73 (ORCPT + 99 others); Thu, 24 Feb 2022 09:59:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235691AbiBXO71 (ORCPT ); Thu, 24 Feb 2022 09:59:27 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF4EC1B0C4B for ; Thu, 24 Feb 2022 06:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645714735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7t/PhndngG1sSe9ScfhTi54FhdXHMvtO4i3SsRE9GWw=; b=N2uVPf5jL1sKJFp08z1CFdJMFTBqFspK0mP74DDmtXKb8RZpuzFdJaK0rF8ln+X3eiiAP8 esE/1T8qIdeKD1YzFvy3h6/K78yo3Qpj491d6HqOFVtOmYZvjtLhYpwYmpOu+xy7/wDamy G+tXwUFUcTOtllR73hi7vTTvYlA9cS8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-402-SOFb325mMcStH_464N3obQ-1; Thu, 24 Feb 2022 09:58:54 -0500 X-MC-Unique: SOFb325mMcStH_464N3obQ-1 Received: by mail-ed1-f69.google.com with SMTP id s7-20020a508dc7000000b0040f29ccd65aso860358edh.1 for ; Thu, 24 Feb 2022 06:58:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=7t/PhndngG1sSe9ScfhTi54FhdXHMvtO4i3SsRE9GWw=; b=VOTRlatxANEbP5wCZA8QDvEqBbfYafTLKG4vZiCZ0ncCNgC6U8KtK0XOf2KlRZFKwo RQqX5L4Zh5PODWwA/1cbgTY/+ltF7JiIQ/439BSekdiNBfapt/1/HqDjX6f+xWqWC7Pk QaQZXijlW9S1W/rrOLjNdgbawGhSNO5JEdt18kPriQ7b+s9SHCjJLlL6UADngkXS9RZf WMTGV3u2wE2TT0LBLtN6IbbWiGd5HZg3cjjI2iAD0XnxCF+8xmT/1nrbxCTuvN0fIPuW zv2/wobvo9FucAmB82gp1LxKoAB1VHZof1ZzZMI71ihITi82gC4ulVkwAo7pv3nyBLSx wN3g== X-Gm-Message-State: AOAM531ThjkKxQsb1raKSRfD/Sfhj1zlCPTvxs1QhYZ7rQLphRrPRSXq Ok8D1NGTPbJWTky19zW/a1m4nD+8j6X4YmbHIRjpo1cFJZun07O/4yk6n+h0klG6MK9+/L+kKdT FPTT379bzQR+Sk4gfaYhTTzxl X-Received: by 2002:a50:ef0b:0:b0:413:2c17:d967 with SMTP id m11-20020a50ef0b000000b004132c17d967mr2647077eds.307.1645714733019; Thu, 24 Feb 2022 06:58:53 -0800 (PST) X-Received: by 2002:a50:ef0b:0:b0:413:2c17:d967 with SMTP id m11-20020a50ef0b000000b004132c17d967mr2647058eds.307.1645714732810; Thu, 24 Feb 2022 06:58:52 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.googlemail.com with ESMTPSA id g20sm37931ejk.209.2022.02.24.06.58.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Feb 2022 06:58:52 -0800 (PST) Message-ID: Date: Thu, 24 Feb 2022 15:58:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 00/11] KVM: x86: Prep work for VMX IPI virtualization Content-Language: en-US To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zeng Guang , Chao Gao , Maxim Levitsky References: <20220204214205.3306634-1-seanjc@google.com> From: Paolo Bonzini In-Reply-To: <20220204214205.3306634-1-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On 2/4/22 22:41, Sean Christopherson wrote: > Prepare for VMX's IPI virtualization, in which hardware treats ICR as a > single 64-bit register in x2APIC mode. The SDM wasn't clear on how ICR > should be modeled, KVM just took the easier path and guessed wrong. > > Hardware's implementation of ICR as a 64-bit register requires explicit > handling to maintain backwards compatibility in KVM_{G,S}ET_REG, as > migrating a VM between hosts with different IPI virtualization support > would lead to ICR "corruption" for writes that aren't intercepted by > KVM (hardware doesn't fill ICR2 in vAPIC page). > > This series includes AVIC cleanups for things I encountered along the way. > AVIC still has multiple issues, this only fixes the easy bugs. > > Sean Christopherson (11): > Revert "svm: Add warning message for AVIC IPI invalid target" > KVM: VMX: Handle APIC-write offset wrangling in VMX code > KVM: x86: Use "raw" APIC register read for handling APIC-write VM-Exit > KVM: SVM: Use common kvm_apic_write_nodecode() for AVIC write traps > KVM: SVM: Don't rewrite guest ICR on AVIC IPI virtualization failure > KVM: x86: WARN if KVM emulates an IPI without clearing the BUSY flag > KVM: x86: Make kvm_lapic_reg_{read,write}() static > KVM: x86: Add helpers to handle 64-bit APIC MSR read/writes > KVM: x86: Treat x2APIC's ICR as a 64-bit register, not two 32-bit regs > KVM: x86: Make kvm_lapic_set_reg() a "private" xAPIC helper > KVM: selftests: Add test to verify KVM handles x2APIC ICR=>ICR2 dance > > arch/x86/kvm/lapic.c | 193 ++++++++++++------ > arch/x86/kvm/lapic.h | 21 +- > arch/x86/kvm/svm/avic.c | 38 ++-- > arch/x86/kvm/trace.h | 6 +- > arch/x86/kvm/vmx/vmx.c | 11 +- > arch/x86/kvm/x86.c | 15 +- > tools/testing/selftests/kvm/.gitignore | 1 + > tools/testing/selftests/kvm/Makefile | 1 + > .../selftests/kvm/include/x86_64/apic.h | 1 + > .../selftests/kvm/x86_64/xapic_state_test.c | 150 ++++++++++++++ > 10 files changed, 325 insertions(+), 112 deletions(-) > create mode 100644 tools/testing/selftests/kvm/x86_64/xapic_state_test.c > > > base-commit: 17179d0068b20413de2355f84c75a93740257e20 Queued, with patch 4 adjusted. Thanks, Paolo