From patchwork Mon Sep 18 10:41:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 724151 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp1609314wro; Mon, 18 Sep 2023 03:43:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGW2F28A0deb1BHSMslyoF3FR7rzqSAt1u2VqCwYSelA9PuTG51GFni59sCOz3ZoRpKsWE X-Received: by 2002:a0d:d204:0:b0:584:2ea4:a24b with SMTP id u4-20020a0dd204000000b005842ea4a24bmr8375539ywd.19.1695033807001; Mon, 18 Sep 2023 03:43:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695033806; cv=none; d=google.com; s=arc-20160816; b=aAeApAn28R83vS5uT2LaMuoijb23Sv6yVcuup4kAIzqDKWbWVslNljvBnAandHf0vK 4ybHk43B6ORybqJhD6k+zEiv+sLOmLwsxK9sQUdHEvUEcYOqvecNoirpXtgL1MAeP/fs OdIKaChRWJi3QRqhpbDf6dVXOSNNvYDY1xC6ztp1Lh1lx/hAEfPKbNVisn0pmO6uizio DS1C0Y9Qwv4+cFBqkqFFTiWbKP6ghAIEYCL4w6FDbS8FkFyLIu/+5Dg0OvaMrUD01acR +rqEaAP7K6tbWDtVOlzhQx0pfGMgpyHiUuoI+mcH2e9mFVGhrOsjsCv1NAfa1XhPwcxs OFRw== 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=YZeRMydDkG6M2arrXdQxyoLJFYtUvfDVk8wUBcDyUf4=; fh=BF3LKKifiA+jF5p/lRDAQaBJUKq1weCvFbpq4CIoQ/U=; b=g7gH27OEf0DkNjBCVkpNWuhibrvjfZZJ+cjsQbKf6FQIzxQxGhhV/Rl5FdmxIrkBor glHv7EZbZREEJPzqQ/byHr+8AcudehpdBFv0MYFJSVQr5EMqabBkJN3ah6etkirixJhq OLq4R4ApCdP6TGMlQPOc7Vh+3dl/8FvYp1oGYJCN9878WLNqvg88eSqHUaEljPgwQHsA e2fEnZUmZyi989q3zAByJPi8W+irU7eym2InkIBVwi292jvnYVFwwYKoIzuVxUFlQZ+M uHFJyUeeLUpOjnLMEsJkdQ8Z7zppSNWW2HhEnsvFuXnU8FlYuqM2KLcGCW85rX5oifFf 1Q2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rvFfw7+D; 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 a5-20020a0ce385000000b0063cd7353f78si5710368qvl.253.2023.09.18.03.43.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Sep 2023 03:43:26 -0700 (PDT) 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=rvFfw7+D; 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 1qiBiK-0002xc-1x; Mon, 18 Sep 2023 06:42:48 -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 1qiBiI-0002wF-25 for qemu-devel@nongnu.org; Mon, 18 Sep 2023 06:42:46 -0400 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiBiG-0004Jo-5u for qemu-devel@nongnu.org; Mon, 18 Sep 2023 06:42:45 -0400 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-31c65820134so3858389f8f.1 for ; Mon, 18 Sep 2023 03:42:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695033762; x=1695638562; 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=YZeRMydDkG6M2arrXdQxyoLJFYtUvfDVk8wUBcDyUf4=; b=rvFfw7+DFMfZOpa4lyOgLD9yy2Elr4YEbIiGQKHzkwCRR8MqBhaTG7wHoU50GwFDEW htkRaOKoIephPHsLPMQwhyOjcQJoxGFU+v9ceO5k/Y58KSJ2vF6VZWY4zQcUMsYcZV6C N7Y1I3//ci9kCQeXKE+Uz6YfyHAwq7BLFfeGNPiqXpUBTidR/kF2YZ/cCdr5/enaG1Xi iufKtcpNkV3ZH2vYWW7NvHg6Hh0U7zWw8iysHgPmKZ9lfLK/OE6Jyxa/8si6R0Xkaps4 NTCvgcwsmjf1TVP0MGLLt0RHXQr0ybt4jff7l6jxRHWVl+A+XgS2gv7oxWmShR1unfde nLaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695033762; x=1695638562; 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=YZeRMydDkG6M2arrXdQxyoLJFYtUvfDVk8wUBcDyUf4=; b=qPOHcj2MnkTDruJ11CIeADaSHaz4Z7W2KdPLtmdFKs35CM91qxVviH8u+ZkILX9vFi hL/X6t058WoLC6Y/PwfXA9yB/GzCf6KJLRDi4Ihq1RjPeFOZhFaK6vhAQWBmLlJdLTDO gfGMsWQH4UKJVOOfI4Fpfn6nQMWW19R+klX8tBJOcRmEG9/lSvJZZDvibNJUG0FazrUZ 1lMvHU3lPE86t/CgNz5eqAc9i+2Q1culDJhbUBOqfX7xs80xjKZ0Pmh8LB2/Wi0Vw35k WzGn+1Pvy8YIwOmc7GiY+DCxvyBOfUdHmODm7mOMHc5hFfXj7civDeIulVXxighbLbsE fa3Q== X-Gm-Message-State: AOJu0YzSvCoaWxXCoqVmYLE3donVZLSRx7XAMILsJnLZick/zIv4XF0O 7Y+7qtBSMSXth5WcjGq3qUSYeylV1eOj2QwgzvWaoA== X-Received: by 2002:a5d:58e1:0:b0:319:79bb:980c with SMTP id f1-20020a5d58e1000000b0031979bb980cmr6614964wrd.64.1695033762316; Mon, 18 Sep 2023 03:42:42 -0700 (PDT) Received: from localhost.localdomain (5.red-88-29-175.dynamicip.rima-tde.net. [88.29.175.5]) by smtp.gmail.com with ESMTPSA id q11-20020adff50b000000b0031c71693449sm12314748wro.1.2023.09.18.03.42.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 18 Sep 2023 03:42:41 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Anton Johansson , Riku Voipio , Richard Henderson , Claudio Fontana , Yanan Wang , Paolo Bonzini , Alessandro Di Federico , Fabiano Rosas , Marcel Apfelbaum , Daniel Henrique Barboza , Mahmoud Mandour , Eduardo Habkost , Alexandre Iooss , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= Subject: [PATCH 3/3] accel/tcg: Factor tcg_cpu_reset_hold() out Date: Mon, 18 Sep 2023 12:41:52 +0200 Message-ID: <20230918104153.24433-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230918104153.24433-1-philmd@linaro.org> References: <20230918104153.24433-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=philmd@linaro.org; helo=mail-wr1-x431.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 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 Factor the TCG specific code from cpu_common_reset_hold() to tcg_cpu_reset_hold() within tcg-accel-ops.c. Since this file is sysemu specific, we can inline tcg_flush_softmmu_tlb(), removing its declaration in "exec/cpu-common.h". Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cpu-common.h | 2 -- accel/stubs/tcg-stub.c | 4 ---- accel/tcg/tcg-accel-ops.c | 8 ++++++++ accel/tcg/translate-all.c | 8 -------- hw/core/cpu-common.c | 5 ----- 5 files changed, 8 insertions(+), 19 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 1eff233565..d71b4d712d 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -38,8 +38,6 @@ void cpu_list_lock(void); void cpu_list_unlock(void); unsigned int cpu_list_generation_id_get(void); -void tcg_flush_softmmu_tlb(CPUState *cs); - void tcg_iommu_init_notifier_list(CPUState *cpu); void tcg_iommu_free_notifier_list(CPUState *cpu); diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index a9e7a2d5b4..8a496a2a6f 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -22,10 +22,6 @@ void tlb_set_dirty(CPUState *cpu, vaddr vaddr) { } -void tcg_flush_jmp_cache(CPUState *cpu) -{ -} - int probe_access_flags(CPUArchState *env, vaddr addr, int size, MMUAccessType access_type, int mmu_idx, bool nonfault, void **phost, uintptr_t retaddr) diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 748539f289..0882464d03 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -78,6 +78,13 @@ int tcg_cpus_exec(CPUState *cpu) return ret; } +static void tcg_cpu_reset_hold(CPUState *cpu) +{ + tcg_flush_jmp_cache(cpu); + + tlb_flush(cpu); +} + /* mask must never be zero, except for A20 change call */ void tcg_handle_interrupt(CPUState *cpu, int mask) { @@ -206,6 +213,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops) } } + ops->cpu_reset_hold = tcg_cpu_reset_hold; ops->supports_guest_debug = tcg_supports_guest_debug; ops->insert_breakpoint = tcg_insert_breakpoint; ops->remove_breakpoint = tcg_remove_breakpoint; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index b2d4e22c17..0f3ed835cb 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -801,11 +801,3 @@ void tcg_flush_jmp_cache(CPUState *cpu) qatomic_set(&jc->array[i].tb, NULL); } } - -/* This is a wrapper for common code that can not use CONFIG_SOFTMMU */ -void tcg_flush_softmmu_tlb(CPUState *cs) -{ -#ifdef CONFIG_SOFTMMU - tlb_flush(cs); -#endif -} diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index b50bc22fb7..23040e0398 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -27,7 +27,6 @@ #include "qemu/main-loop.h" #include "exec/log.h" #include "exec/cpu-common.h" -#include "exec/tb-flush.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "sysemu/tcg.h" @@ -138,10 +137,6 @@ static void cpu_common_reset_hold(Object *obj) cpu->cflags_next_tb = -1; cpu_exec_reset_hold(cpu); - if (tcg_enabled()) { - tcg_flush_jmp_cache(cpu); - tcg_flush_softmmu_tlb(cpu); - } } static bool cpu_common_has_work(CPUState *cs)