From patchwork Mon Jan 29 23:01:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 767444 Delivered-To: patch@linaro.org Received: by 2002:adf:ee41:0:b0:33a:e5bd:fedd with SMTP id w1csp1119001wro; Mon, 29 Jan 2024 15:09:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3M6snZP1p21tMfoijKlXJUDOa7zjgC8W9lnCbCUmrsiT7cSW3qChaMm2SRAv0se0L1Kd/ X-Received: by 2002:ac8:5991:0:b0:42a:97dc:9e5d with SMTP id e17-20020ac85991000000b0042a97dc9e5dmr6795801qte.104.1706569791199; Mon, 29 Jan 2024 15:09:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706569791; cv=none; d=google.com; s=arc-20160816; b=Z14kdzhuKxgPkLfzuaLstJrzpZw+El8WvNYZ8EwFjN6Ckb2ROiqsgYxqVOLhaszwq4 a3usUINPeClzKmApKiLxxK/m8/iEaS4BwtdXIb16TF3zRFIzeN4WuA9WO1TnZv1wQ5P6 kobsQCMsnkxym4bpIX4HbxecxHuqO933GbsDOM1PUJZBcWE19fjPw+Ecjct7Na4uhoV+ xJNY/bEIDc7b5iCQ/WVuWTidJ0e3nsa1sLSRj3O2Sk02jGNFDGz29HtUbWk6TM6ZrALA l4k5INfVU7xRYCNEKhc/En6mlpAvm+8DD0tcBryR6RYbEXLyCW0zqqBLzkMNmps+a0yW nEQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T/uaC3GU2r5ag1NYLRtG0R3ws3tDO6FtLPMPWrHI/7I=; fh=HGG5jZNhe8Q+zQJ9+mddel2c/xsqW3vEoqbd78QYiOw=; b=A9iE18myK+qVebDl5CnjlVSzgaSgrzd7F2KyBRykrSg2MI4w0XPFpJ71UZKc0ziAh3 xirzZ2bzdYr1Aij46N74DWoy5r9JqKu/nhupXWXqfUozGAroLzW+G4IavZWbZ/lIBkj/ QorSTPd197euLFbK6HyjlpCbFdDUovQwkSw56FgkZ/dYE+FgnIKNg1Sw8k3QVcwG1UcT GfpUkNavW4aIIcHRssPdhXXIMaYAl6DW0Tbh8/iO2EZO+tfzsyj03NRrc0D5ZkXgLAgp KuAOCMWcUgTJRSk2Ef4ekEWHJE4/qXYZAz69hXOTsvPE0NcIfWXtr9oJYhdICu1xDVaY 3JEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmySVDk4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id m13-20020a05622a054d00b0042a5f89a503si8600163qtx.723.2024.01.29.15.09.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jan 2024 15:09:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SmySVDk4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUai2-0001Ph-9W; Mon, 29 Jan 2024 18:06:40 -0500 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 1rUaeT-000750-Id for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:03:00 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUaeN-00007H-9w for qemu-devel@nongnu.org; Mon, 29 Jan 2024 18:02:48 -0500 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1d8ef977f1eso6923735ad.0 for ; Mon, 29 Jan 2024 15:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706569365; x=1707174165; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T/uaC3GU2r5ag1NYLRtG0R3ws3tDO6FtLPMPWrHI/7I=; b=SmySVDk4CLGNNNDAGdf+kN3ViZI28aPf1/OUMu5YqX1fspLJMu8HxE8HeG6e4jJbkB uGz5Vg+zIZX8ZLRcqs5JfeLWhliaBqckfw/L8I6H13bzZXQdyV5p88Wx7XY2cl3u2LQ+ v5gtJxr4LqOlMrTHAAY15Hs6UmzOIAPmVrHCe+OyqisGCAnps4RED/9cRCC/qBUo+tVx nYqAHUymJ4K3iuh9/Ld/6AUXSLpTU9IJm3rKwd/D0w8yWScIsREduRF3L4VGV5mof+6t 0mB9CF19pqBnGtSrJi0GPbvMo0x3pNMZ10BRbnRMDymN5+4e3ciZ0ZTjBM4U8St1roFO gUPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706569365; x=1707174165; 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=T/uaC3GU2r5ag1NYLRtG0R3ws3tDO6FtLPMPWrHI/7I=; b=dQqcmMLsM8Tqol4WLRPCj+6mAeLeuoZtyc4pk0WhvyUZYibSowwGKaqBRKhG70buWp grwxHu0tHaQt3zwDBNiQnDUC8TsXt2Mp2k8Nt4rvyCC68h4PINhme90iI7LBzB7/1cTu /zGM4tzbvej/MZSF49I2ynL0nF4Cp8KMRUtI9AgxgddvMDjo7DvLaywp96+oB/aAXr66 r6gnZMSkW0LhnXzEd2Sknj2b4YPmU9t2trvmtDoJR+qQxS0nbri78GpynWn5hePKDGd2 Cw1kwz9mCeuEakVSiHySOXeTb3b+SP3hasT4EGtIZVUfSsnTK1QrmQiAvh7G/B5JuScm 8iKg== X-Gm-Message-State: AOJu0Yzole6WjA5uvlERdoGy5rk8LWagXvlj5JcOn45Wlq+epZeW/OZ/ N1D007noIcojs/ACrsr0tJOrBEstU4MgBnXYmypOZUjqYUqmFnPaGh0pWybvKqQ2fzgFL9mom9q Jul8= X-Received: by 2002:a05:6a20:b90a:b0:19c:a484:290e with SMTP id fe10-20020a056a20b90a00b0019ca484290emr1885572pzb.2.1706569365363; Mon, 29 Jan 2024 15:02:45 -0800 (PST) Received: from stoup.. ([103.210.27.218]) by smtp.gmail.com with ESMTPSA id r10-20020aa78b8a000000b006ddcf56fb78sm6419368pfd.62.2024.01.29.15.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 15:02:45 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Anton Johansson Subject: [PULL 31/31] target/i386: Extract x86_cpu_exec_halt() from accel/tcg/ Date: Tue, 30 Jan 2024 09:01:21 +1000 Message-Id: <20240129230121.8091-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240129230121.8091-1-richard.henderson@linaro.org> References: <20240129230121.8091-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Move this x86-specific code out of the generic accel/tcg/. Reported-by: Anton Johansson Reviewed-by: Anton Johansson Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20240124101639.30056-10-philmd@linaro.org> Signed-off-by: Richard Henderson --- target/i386/tcg/helper-tcg.h | 1 + accel/tcg/cpu-exec.c | 12 ------------ target/i386/tcg/sysemu/seg_helper.c | 13 +++++++++++++ target/i386/tcg/tcg-cpu.c | 1 + 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/target/i386/tcg/helper-tcg.h b/target/i386/tcg/helper-tcg.h index 253b1f561e..effc2c1c98 100644 --- a/target/i386/tcg/helper-tcg.h +++ b/target/i386/tcg/helper-tcg.h @@ -39,6 +39,7 @@ QEMU_BUILD_BUG_ON(TCG_PHYS_ADDR_BITS > TARGET_PHYS_ADDR_SPACE_BITS); */ void x86_cpu_do_interrupt(CPUState *cpu); #ifndef CONFIG_USER_ONLY +void x86_cpu_exec_halt(CPUState *cpu); bool x86_need_replay_interrupt(int interrupt_request); bool x86_cpu_exec_interrupt(CPUState *cpu, int int_req); #endif diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 82627b12b8..977576ca14 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -30,9 +30,6 @@ #include "qemu/rcu.h" #include "exec/log.h" #include "qemu/main-loop.h" -#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) -#include "hw/i386/apic.h" -#endif #include "sysemu/cpus.h" #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" @@ -666,15 +663,6 @@ static inline bool cpu_handle_halt(CPUState *cpu) if (cpu->halted) { const TCGCPUOps *tcg_ops = cpu->cc->tcg_ops; -#if defined(TARGET_I386) - if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { - X86CPU *x86_cpu = X86_CPU(cpu); - bql_lock(); - apic_poll_irq(x86_cpu->apic_state); - cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); - bql_unlock(); - } -#endif /* TARGET_I386 */ if (tcg_ops->cpu_exec_halt) { tcg_ops->cpu_exec_halt(cpu); } diff --git a/target/i386/tcg/sysemu/seg_helper.c b/target/i386/tcg/sysemu/seg_helper.c index e6f42282bb..2db8083748 100644 --- a/target/i386/tcg/sysemu/seg_helper.c +++ b/target/i386/tcg/sysemu/seg_helper.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" @@ -127,6 +128,18 @@ void x86_cpu_do_interrupt(CPUState *cs) } } +void x86_cpu_exec_halt(CPUState *cpu) +{ + if (cpu->interrupt_request & CPU_INTERRUPT_POLL) { + X86CPU *x86_cpu = X86_CPU(cpu); + + bql_lock(); + apic_poll_irq(x86_cpu->apic_state); + cpu_reset_interrupt(cpu, CPU_INTERRUPT_POLL); + bql_unlock(); + } +} + bool x86_need_replay_interrupt(int interrupt_request) { /* diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 5bdcf45199..cca19cd40e 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -119,6 +119,7 @@ static const TCGCPUOps x86_tcg_ops = { #else .tlb_fill = x86_cpu_tlb_fill, .do_interrupt = x86_cpu_do_interrupt, + .cpu_exec_halt = x86_cpu_exec_halt, .cpu_exec_interrupt = x86_cpu_exec_interrupt, .do_unaligned_access = x86_cpu_do_unaligned_access, .debug_excp_handler = breakpoint_handler,