From nobody Fri Nov 14 06:45:23 2025 Delivered-To: importer@patchew.org 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; Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1585252790; cv=none; d=zohomail.com; s=zohoarc; b=cJ3VGbAaajnj1C/wN8ECCTdZr1WWYTCadWdYqOI2shDnAp/kyLaA6Ah5Czy3A6oxREIpThHGDDl2jiXz9Wz7BxGfgeAaJe2MBIC/BHn+SDylJd07k5+68MJRKprdYhLi3W6o3ymMx73V8XTYO1XJ+HfPJ+YBXGdazuvLh+MsBfY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585252790; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SMWSXLQojKe3xf38iwDswTcJa5hw68aVIzkImw5+21g=; b=jH+n4HO7v6KSnZUs4TJwUajIDC3K5sFtcSrML5DEubkYeaY+fzWQnaintYDYNI1xzwmRjyhoS6gfOPzrr4Io6uRGNXOJotzauT5cY26P9uIOE5qkTwmtnX7fEqkSmWfpGfHbywfo/nfeCAAoD51oAUTQDz6OyF3/8SHM1OWkQ9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1585252790886432.20769922916554; Thu, 26 Mar 2020 12:59:50 -0700 (PDT) Received: from localhost ([::1]:59250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHYfN-0005QH-Hy for importer@patchew.org; Thu, 26 Mar 2020 15:59:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59279) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHYLD-0008Dw-Va for qemu-devel@nongnu.org; Thu, 26 Mar 2020 15:39:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHYLC-00027z-ME for qemu-devel@nongnu.org; Thu, 26 Mar 2020 15:38:59 -0400 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]:36389) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jHYLC-00027s-Hh for qemu-devel@nongnu.org; Thu, 26 Mar 2020 15:38:58 -0400 Received: by mail-qv1-xf43.google.com with SMTP id z13so3708528qvw.3 for ; Thu, 26 Mar 2020 12:38:58 -0700 (PDT) Received: from Rfoley-MA01.hsd1.ma.comcast.net ([2601:199:4480:60c0:fd55:4e67:1038:8302]) by smtp.gmail.com with ESMTPSA id u51sm2161916qth.46.2020.03.26.12.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Mar 2020 12:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SMWSXLQojKe3xf38iwDswTcJa5hw68aVIzkImw5+21g=; b=ulsJJuPn6vcdvI4qE+Zfqur8TMA1wlNwhVQWyZIf0qD8GhP0poGc5JyvXNdp79EYDF u/Fqr35IyCjhFjx0wHIZfneZ8q6oGpTLFes98DH7YGQpZQ/1sNskLgyhOcyQSAK9rr/6 zZ5KSNXA462wOfJIloRfXWIkShAJFo4eRnXkPcbkUCKUJ1bUiPTR3TmHfM+WCVb1k/OE dfZqU5AfCBSTrWF64eXVH4XP/NhyDjMV8VVRDHShGbhofeIz2EtHpTaKubdKe/hlQuNg xrhnZfFaql4ZT+7QvusuU3EqcyD20c59W815aM7pF+Tsy67r9VkA+z/JSyamWDzMMXNn m0fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SMWSXLQojKe3xf38iwDswTcJa5hw68aVIzkImw5+21g=; b=fts/IqCsNtiPV6X4BTt1WAjRHpfz8EuJIUgNY1yQinLY+yV4YHeM+qtcaiGFuDYJyh MOl4wT4tk3WAw3dtcJDWYuFC4Hd79zwEzzvTumpggpLzv+TE1Tc0/FTXo7ho1KAyZ+gc UjomBQYY2F8Bl7vfa1yO4ga9GaNO/dsBRGyBhAc5HHA9RZSH65hvZKwV0UcOTga7/u6T rdf7tlpJq7UyoJCzghd9oalVQqh2118X30eHI+irMGivJ6yArPfmaAzuLk41VtE+xb8F Wq8SXbVP1I4O1En0xWTEYEjpn/Uk1/3K4baH7pXNZ89twIizT6Qc2Z747bI6LSl/LTLu dyog== X-Gm-Message-State: ANhLgQ21u/RgvXqg2IZ6ZYZ1AEABCZq4KYMGsHquoZ1pEsKLlt2a1tB4 d2OXjMVb0k8bnJeGe9hd30oX4htf53JyBQ== X-Google-Smtp-Source: ADFU+vsZQDr3xzhqc2GD10V3LWu/kX4ZCxMQCVlPhFsTb2s90vu8OkqTJzjpNIW4RaBcemWSJ4NQ1g== X-Received: by 2002:ad4:514d:: with SMTP id g13mr9632379qvq.229.1585251537028; Thu, 26 Mar 2020 12:38:57 -0700 (PDT) From: Robert Foley To: qemu-devel@nongnu.org Subject: [PATCH v8 60/74] accel/tcg: convert to cpu_interrupt_request Date: Thu, 26 Mar 2020 15:31:42 -0400 Message-Id: <20200326193156.4322-61-robert.foley@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200326193156.4322-1-robert.foley@linaro.org> References: <20200326193156.4322-1-robert.foley@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f43 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: richard.henderson@linaro.org, "Emilio G. Cota" , alex.bennee@linaro.org, robert.foley@linaro.org, peter.puhov@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: "Emilio G. Cota" Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Emilio G. Cota Signed-off-by: Robert Foley --- accel/tcg/cpu-exec.c | 15 ++++++++------- accel/tcg/tcg-all.c | 12 +++++++++--- accel/tcg/translate-all.c | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 099dd83ee0..b549a37847 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -431,7 +431,7 @@ static inline bool cpu_handle_halt_locked(CPUState *cpu) =20 if (cpu_halted(cpu)) { #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) - if ((cpu->interrupt_request & CPU_INTERRUPT_POLL) + if ((cpu_interrupt_request(cpu) & CPU_INTERRUPT_POLL) && replay_interrupt()) { X86CPU *x86_cpu =3D X86_CPU(cpu); =20 @@ -544,16 +544,17 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, */ atomic_mb_set(&cpu_neg(cpu)->icount_decr.u16.high, 0); =20 - if (unlikely(atomic_read(&cpu->interrupt_request))) { + if (unlikely(cpu_interrupt_request(cpu))) { int interrupt_request; + qemu_mutex_lock_iothread(); - interrupt_request =3D cpu->interrupt_request; + interrupt_request =3D cpu_interrupt_request(cpu); if (unlikely(cpu->singlestep_enabled & SSTEP_NOIRQ)) { /* Mask out external interrupts for this step. */ interrupt_request &=3D ~CPU_INTERRUPT_SSTEP_MASK; } if (interrupt_request & CPU_INTERRUPT_DEBUG) { - cpu->interrupt_request &=3D ~CPU_INTERRUPT_DEBUG; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_DEBUG); cpu->exception_index =3D EXCP_DEBUG; qemu_mutex_unlock_iothread(); return true; @@ -562,7 +563,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, /* Do nothing */ } else if (interrupt_request & CPU_INTERRUPT_HALT) { replay_interrupt(); - cpu->interrupt_request &=3D ~CPU_INTERRUPT_HALT; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_HALT); cpu_halted_set(cpu, 1); cpu->exception_index =3D EXCP_HLT; qemu_mutex_unlock_iothread(); @@ -599,10 +600,10 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, } /* The target hook may have updated the 'cpu->interrupt_reques= t'; * reload the 'interrupt_request' value */ - interrupt_request =3D cpu->interrupt_request; + interrupt_request =3D cpu_interrupt_request(cpu); } if (interrupt_request & CPU_INTERRUPT_EXITTB) { - cpu->interrupt_request &=3D ~CPU_INTERRUPT_EXITTB; + cpu_reset_interrupt(cpu, CPU_INTERRUPT_EXITTB); /* ensure that no TB jump will be modified as the program flow was changed */ *last_tb =3D NULL; diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index acfdcfdf59..79b01bf726 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -52,10 +52,16 @@ typedef struct TCGState { static void tcg_handle_interrupt(CPUState *cpu, int mask) { int old_mask; - g_assert(qemu_mutex_iothread_locked()); =20 - old_mask =3D cpu->interrupt_request; - cpu->interrupt_request |=3D mask; + if (!cpu_mutex_locked(cpu)) { + cpu_mutex_lock(cpu); + old_mask =3D cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + cpu_mutex_unlock(cpu); + } else { + old_mask =3D cpu_interrupt_request(cpu); + cpu_interrupt_request_or(cpu, mask); + } =20 /* * If called from iothread context, wake the target cpu in diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 78914154bf..eeb9cd2cd7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2387,7 +2387,7 @@ void dump_opcount_info(void) void cpu_interrupt(CPUState *cpu, int mask) { g_assert(qemu_mutex_iothread_locked()); - cpu->interrupt_request |=3D mask; + cpu_interrupt_request_or(cpu, mask); atomic_set(&cpu_neg(cpu)->icount_decr.u16.high, -1); } =20 --=20 2.17.1