From nobody Mon Nov 25 07:50:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717485671; cv=none; d=zohomail.com; s=zohoarc; b=NnTiQ6HN3W6cusaxPYUSNuTu9yy139xwzZPfv0zs7zL8uMyLjzcVVAvGiCgm51lG+EybAk4IMZW5sNsHIjrbYnbCscheONdeQFajuKhIebYcWN8e2kYhQFetCYgdRvmdBUtlZkdG5NVJrhYk7O7y52rdr4axR2qdqoz/uBAZBic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717485671; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7QRT7KodLZb3R6daWVQofmOuNLtzn1249htY3GzAkRw=; b=DERHE+zQRbsCgorN8rAVyxIbCb2DOyuRjj5xLZgzTaxIId8pG+OCizftnMpTe6wZsvHSErYdY1ixVfiaOQQ18g5AglCHZpc2Pgp5uEi1RgnqghA0zi0eXpQ3aUpbFJkNKec2+tJ9kktUCu2CizgVQ8H7tIoiTniqWtEKPFOEAZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717485670997805.5652926278849; Tue, 4 Jun 2024 00:21:10 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEORx-0003Tz-7y; Tue, 04 Jun 2024 03:19:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEORs-0003Jn-AL for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:19:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEORq-0005ed-Tf for qemu-devel@nongnu.org; Tue, 04 Jun 2024 03:19:12 -0400 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.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-367-O9t0rNKEPI2U-nDgKXyVGg-1; Tue, 04 Jun 2024 03:19:03 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5785176c796so2529924a12.3 for ; Tue, 04 Jun 2024 00:19:03 -0700 (PDT) Received: from avogadro.local ([151.81.115.112]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57a31c9c0b8sm6920580a12.86.2024.06.04.00.19.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717485550; 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=7QRT7KodLZb3R6daWVQofmOuNLtzn1249htY3GzAkRw=; b=CMYvL3kH736vf2LqhENjLcck/BvwaFLixNiBOd3o26AWEKtMVlCnF4pBS48eMkokpEaltp YtXaiHtFyXqVD9xHDF8hihiCUIZOCu5ab25hWvdi7oBbZxghBy86zaQSuuSoDm0aG9WqnK lMfIaaP3HhJLp/thrNNZi96O5hTVa6o= X-MC-Unique: O9t0rNKEPI2U-nDgKXyVGg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717485541; x=1718090341; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7QRT7KodLZb3R6daWVQofmOuNLtzn1249htY3GzAkRw=; b=DcVYmMUDds0viAnRdk7ILq6qhtDn0CSZUi18cGgcIf5RwFP1Nk0S6VJurNDZ1puYzj iLIWq5mkvUNFYmHOxuqREqcGPz2Uz/eJr+0OsSa+aoqbVqfXNYeA9VhRiCHfoLwYwPfk Xm+3QHG7dcw5/Od+l4gumaJZJiS28aBHqnbkRitHn6HOwCwUvlRFBrJwbpYRC0yBI2F4 2RnY6T7MiELs6t6jj0qj9fqz+WVjwGA38Jmfut24XgM6fB1bG+xpmH1BxNAwUPkdhIGy lADYrpqVfuK9NSm8b9VNQZccO4JWLDyDw0rImlKLBytFXRjgZGDM5KgSni0n/DnK1Jxu CNzg== X-Gm-Message-State: AOJu0YwblkOMbkvNRGr0+UVMhBxrQRP6SHqbYu8bvlX2CODR8VHBdMMW yMH23fdRX8DbxyP9Wbs2AR2m9uTsmZzh+WWptVzatq3upiqiOSMg2kkNw1yMofaMf9PzVqPQxts zT3nEVRlHgdAVyivAhxlAwuBv5QFpKwKW5hJ6DODziq72Xs6Pbbxqjv7K4nDFl+S1th4Bbs/+Go Gbalvp6xw2zWCCEuGd9iUDNSYahTjINXvhFvp9 X-Received: by 2002:a50:bac4:0:b0:57a:4af2:fcf5 with SMTP id 4fb4d7f45d1cf-57a4af301e7mr5552127a12.2.1717485541844; Tue, 04 Jun 2024 00:19:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhle3APIdal4Bk/OucXEarJ/czXHdsdM6YxIQkHqBU3g2Eie1cm8u0xHfzyTcpyo9qYd2Whw== X-Received: by 2002:a50:bac4:0:b0:57a:4af2:fcf5 with SMTP id 4fb4d7f45d1cf-57a4af301e7mr5552115a12.2.1717485541494; Tue, 04 Jun 2024 00:19:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: richard.henderson@linaro.org Subject: [PATCH 08/11] target/i386: fix INHIBIT_IRQ/TF/RF handling for PAUSE Date: Tue, 4 Jun 2024 09:18:30 +0200 Message-ID: <20240604071833.962574-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604071833.962574-1-pbonzini@redhat.com> References: <20240604071833.962574-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717485671799100006 Content-Type: text/plain; charset="utf-8" PAUSE uses DISAS_NORETURN because the corresponding helper calls cpu_loop_exit(). However, while HLT clear HF_INHIBIT_IRQ_MASK to correctly handle "STI; HLT", the same is missing from PAUSE. And also gen_eob() clears HF_RF_MASK and synthesizes a #DB exception if single-step is active; none of this is done by HLT and PAUSE. Start fixing PAUSE, HLT will follow. Signed-off-by: Paolo Bonzini Reviewed-by: Richard Henderson --- target/i386/tcg/misc_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c index 8316d42ffcd..ed4cda8001e 100644 --- a/target/i386/tcg/misc_helper.c +++ b/target/i386/tcg/misc_helper.c @@ -92,6 +92,10 @@ G_NORETURN void helper_pause(CPUX86State *env) { CPUState *cs =3D env_cpu(env); =20 + /* Do gen_eob() tasks before going back to the main loop. */ + do_end_instruction(env); + helper_rechecking_single_step(env); + /* Just let another CPU run. */ cs->exception_index =3D EXCP_INTERRUPT; cpu_loop_exit(cs); --=20 2.45.1