From nobody Wed Jun 24 01:06:04 2026 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 CFA3FC433EF for ; Thu, 24 Feb 2022 14:54:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235663AbiBXOyk (ORCPT ); Thu, 24 Feb 2022 09:54:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235636AbiBXOyi (ORCPT ); Thu, 24 Feb 2022 09:54:38 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 41309254553 for ; Thu, 24 Feb 2022 06:54:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645714447; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nEhdWtMkHDnA/KPqof56Qj8ElfqWI75Bl68T1Q+UmUY=; b=T13ZzS7kFu1sj5Y+JR8pJoZVq3qp4bxXb/FFvaivRL6wZTCodE2SmwtYbwtK458RYa6TQX jOWnNyC+dWpl5z1UjIUvegQMCIagKQffv2izVm0BLoCg47ZISXoIU1lWbTLnAG34ipFKFR moRT9bB6AsTDSgLD4cI4pzZvx40pgk0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-EOlyh7jnMRGHILKnPRr2-w-1; Thu, 24 Feb 2022 09:54:05 -0500 X-MC-Unique: EOlyh7jnMRGHILKnPRr2-w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A84DB801AAD; Thu, 24 Feb 2022 14:54:04 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 585937F0DD; Thu, 24 Feb 2022 14:54:04 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Chao Gao Subject: [PATCH] KVM: x86: Do not change ICR on write to APIC_SELF_IPI Date: Thu, 24 Feb 2022 09:54:03 -0500 Message-Id: <20220224145403.2254840-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Emulating writes to SELF_IPI with a write to ICR has an unwanted side effec= t: the value of ICR in vAPIC page gets changed. The lists SELF_IPI as write-o= nly, with no associated MMIO offset, so any write should have no visible side effect in the vAPIC page. Reported-by: Chao Gao Signed-off-by: Paolo Bonzini Reviewed-by: Sean Christopherson --- arch/x86/kvm/lapic.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index ad8857359ad6..d5a33b6be7d5 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2120,10 +2120,9 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 = reg, u32 val) break; =20 case APIC_SELF_IPI: - if (apic_x2apic_mode(apic)) { - kvm_lapic_reg_write(apic, APIC_ICR, - APIC_DEST_SELF | (val & APIC_VECTOR_MASK)); - } else + if (apic_x2apic_mode(apic)) + kvm_apic_send_ipi(apic, APIC_DEST_SELF | (val & APIC_VECTOR_MASK), 0); + else ret =3D 1; break; default: --=20 2.31.1