Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6280562iob; Tue, 10 May 2022 14:47:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzG1539gopx09RDMPDu2Y1U2JizxKR04Y4FcsbZQCtLmJ1k03UreActc/Pl9rhvuUAPqetn X-Received: by 2002:a05:6402:1c06:b0:428:727d:e38 with SMTP id ck6-20020a0564021c0600b00428727d0e38mr21894454edb.19.1652219233416; Tue, 10 May 2022 14:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652219233; cv=none; d=google.com; s=arc-20160816; b=uNy4H+1Q4EiURzbKAQn1WnNwhujOu/7C6rs73rvRPJ/nsD2jBRpfOBzynZRu7zPwtI LeEBStSIA/5LXgxI1n7a0pCOopyEflxbBMTzemi2JqMpIR3PBRr5hu9Z2dmHzCEFMPDo q1CjjJqnmYjjpJpPNx6ukIKGycYRV7kjYjU751yLxgDiVzJGHj2u5ogGzp9sakvQZvme jUiMy5T/Yiy+hqbYJc3Hibbvn0zV2RmJTYf1P4REeO37/tv/zsvNILHl3O1PAazntgFK YWFmhOK8lnjaE/dVHezywKTMOh/T6gSLa5fvfRHVh5rJsc5fKldbwRnpS2CMAjxO5lUs u76Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EpYEB6V7zoFVtm8NdfnLviO0fp9gjwI9zcavBaEcDqg=; b=gzQNdUUcP5vuVDuDtBmpETdu/5EVZ4s3FFPSp7p8cPg4f++PGXvZlhABay766hLCY8 lbo0pDXcruQwv7J+AMaUm6BeY7QJvb0UtKP6HXS/C0u1NAYX3YVLfLyGy0Il6kDOnLWM zvZA+ICwzBCwKpP3EYPbN/K3jwkwktMB0TgyCjWcICPFkBiJHaowQZ8yzDreSJNFOocb a4wqRtZFsr8k4trgpIIXsAgM5Uz5seNM1LEepoDnt8ZNkMpk5dx9S4mTd1kAOrhoKqDV EIZo6gYLblFLVELdEcmsKxG6ApFF9qexiHY6rS88jY9Xxwl9GNWLurD/gcNSf207mPtI iypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=JxzFxJdA; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di15-20020a170906730f00b006e871dcbafbsi536975ejc.575.2022.05.10.14.46.49; Tue, 10 May 2022 14:47:13 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=JxzFxJdA; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343732AbiEJN7h (ORCPT + 99 others); Tue, 10 May 2022 09:59:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245158AbiEJNif (ORCPT ); Tue, 10 May 2022 09:38:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DEE1261953; Tue, 10 May 2022 06:27:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2FCCCB81DA9; Tue, 10 May 2022 13:27:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79D49C385A6; Tue, 10 May 2022 13:27:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652189254; bh=dhkW1ASMyZWLN/zK5ccMxBpm7mwVmOaNbaYYAvXnbn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JxzFxJdA0wfqRpemUkzZi/dp27p7iSABKRVb74eYCh+fd2FrSxvnFlB1mqnjvLmvj Fp3Ld5leSJx9IvLu5bXyr1lcEEjOcrwI51Rmw8fGYj6uiBvu0KkDCa6u2PfRuRmd1t f5M+8j+U+pi8PfjF5Kxh7/g+IiNLVm6WEizH0pUM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Gao , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.10 61/70] KVM: x86: Do not change ICR on write to APIC_SELF_IPI Date: Tue, 10 May 2022 15:08:20 +0200 Message-Id: <20220510130734.653510441@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220510130732.861729621@linuxfoundation.org> References: <20220510130732.861729621@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: Paolo Bonzini [ Upstream commit d22a81b304a27fca6124174a8e842e826c193466 ] Emulating writes to SELF_IPI with a write to ICR has an unwanted side effect: the value of ICR in vAPIC page gets changed. The lists SELF_IPI as write-only, with no associated MMIO offset, so any write should have no visible side effect in the vAPIC page. Reported-by: Chao Gao Reviewed-by: Sean Christopherson Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin --- 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 de11149e28e0..e45ebf0870b6 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -2106,10 +2106,9 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) break; 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 = 1; break; default: -- 2.35.1