From patchwork Thu Oct 20 15:23:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 13013660 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 2C788C433FE for ; Thu, 20 Oct 2022 15:24:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbiJTPYa (ORCPT ); Thu, 20 Oct 2022 11:24:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbiJTPY2 (ORCPT ); Thu, 20 Oct 2022 11:24:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5D71C19D1 for ; Thu, 20 Oct 2022 08:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666279458; 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: in-reply-to:in-reply-to:references:references; bh=DTA/VcOk33R5phQxQH82CCraNakgkfTTXm7Ga+i4nlY=; b=ALmaDNVWhXVgqXTXGRPk+Q236JRSxNW3piZYNyAJq437hxgLqpN0fZuVND4rw8jljmIolK yD1KihbX5JEVQmA1RMQp7D8iaVgQbRPk9kogDv+J9SsT9LQ5gZGFci7rsDlAG6YFT7Bh5j FyS7OsrorRckMpTBPYVRSAPkcqbeAco= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-nFqBpFRaPEOlo5NHWlA0dg-1; Thu, 20 Oct 2022 11:24:14 -0400 X-MC-Unique: nFqBpFRaPEOlo5NHWlA0dg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CA192A59557 for ; Thu, 20 Oct 2022 15:24:14 +0000 (UTC) Received: from localhost.localdomain (ovpn-192-51.brq.redhat.com [10.40.192.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4BA542024CB7; Thu, 20 Oct 2022 15:24:13 +0000 (UTC) From: Maxim Levitsky To: kvm@vger.kernel.org Cc: Maxim Levitsky , Cathy Avery , Paolo Bonzini Subject: [kvm-unit-tests PATCH 04/16] svm: make svm_intr_intercept_mix_if/gif test a bit more robust Date: Thu, 20 Oct 2022 18:23:52 +0300 Message-Id: <20221020152404.283980-5-mlevitsk@redhat.com> In-Reply-To: <20221020152404.283980-1-mlevitsk@redhat.com> References: <20221020152404.283980-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When injecting self IPI the test assumes that initial EFLAGS.IF flag is zero, but previous tests might have set it. Explicitly disable interrupts to avoid this assumption. Signed-off-by: Maxim Levitsky --- x86/svm_tests.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x86/svm_tests.c b/x86/svm_tests.c index a6b26e72..d734e5f7 100644 --- a/x86/svm_tests.c +++ b/x86/svm_tests.c @@ -3155,6 +3155,7 @@ static void svm_intr_intercept_mix_if(void) vmcb->save.rflags &= ~X86_EFLAGS_IF; test_set_guest(svm_intr_intercept_mix_if_guest); + irq_disable(); apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_FIXED | 0x55, 0); svm_intr_intercept_mix_run_guest(&dummy_isr_recevied, SVM_EXIT_INTR); } @@ -3187,6 +3188,7 @@ static void svm_intr_intercept_mix_gif(void) vmcb->save.rflags &= ~X86_EFLAGS_IF; test_set_guest(svm_intr_intercept_mix_gif_guest); + irq_disable(); apic_icr_write(APIC_DEST_SELF | APIC_DEST_PHYSICAL | APIC_DM_FIXED | 0x55, 0); svm_intr_intercept_mix_run_guest(&dummy_isr_recevied, SVM_EXIT_INTR); }