From patchwork Wed Jul 5 07:14:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 784426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x2XKj0ZdPz9s7f for ; Wed, 5 Jul 2017 17:18:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="eRP5rw8g"; dkim-atps=neutral Received: from localhost ([::1]:44494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSeaE-00072i-MU for incoming@patchwork.ozlabs.org; Wed, 05 Jul 2017 03:18:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46409) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSeWc-0004RH-Mx for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSeWb-0007Wq-MI for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:02 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35222) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSeWb-0007WI-Fc for qemu-devel@nongnu.org; Wed, 05 Jul 2017 03:15:01 -0400 Received: by mail-wm0-x242.google.com with SMTP id u23so30502493wma.2 for ; Wed, 05 Jul 2017 00:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=02rsNOp32b79/khq4qAj2tLsPqnszu5eUNL2AFh4OIQ=; b=eRP5rw8gBOXjrAdKnbC2LJ/bQyoiFsVV+yrxKkjPhId7tVpzxYUM0riovCX62IvVjX bXxXQXotDXvIeIortb3F3pnQDkAyN+wX0hY5t7eZVoeNYkDfHNB/imFGh5ugDaxeWmJg bsiM+DRf0YN093kFI5ZDv7TGn0oI1l/y5G04VufaMReltHPFFYmT9OrADTMFYn9ngsxC AgaWVTJ3j1bNNYlpq4AmsXuRqoWXaLvwnHplGAFDK0sSrf525dndsnQGWyDKM8LsgS1N aJr8OsgPo/3G+sXw64SyNCwWxczeyEhdvzdyZSKYH0UPjnKjmuHxUeS91xLKkXBI5tbD 5yiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=02rsNOp32b79/khq4qAj2tLsPqnszu5eUNL2AFh4OIQ=; b=uHirqmG9Ki1YW7xtJFTlzpnIiTMTPaKAEVAbBbumKBx2yr7W341TRtWvBJ7kBluAn6 mkP4mgkqyPl3RbvMj7clbybOMA4Qk1f++sfGRetlhPaUCVVeYSwgcQENpO4mTCMXqYIH jUewMgNAuweSMZRY9J7Pzf9lWLHf07VPT4aYI01JPQXQb3qOSNp7N15l186B1sEgawpF lmCoGr1X1JGqHDm7PbjZIrXzscCfzZunJDMqwAxvyrGQVWDxScfKoYBE5BeZvvayr4pd YNSh/0koAUfTLLMpw8/2slq6+BzhByfBo/N0cEMixKfc4CqQZ+1XpSZj5d/7r8qjPj79 E6kA== X-Gm-Message-State: AIVw111LB7Kp5aJ7fTmkdIkw7tX6v7V7velZ2/Bpr+8xxY99c4CbWzm8 a2t/tR0s09kKfe9AVhU= X-Received: by 10.28.149.209 with SMTP id x200mr21534116wmd.91.1499238900279; Wed, 05 Jul 2017 00:15:00 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id y35sm22202793wrc.51.2017.07.05.00.14.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 00:14:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 5 Jul 2017 09:14:12 +0200 Message-Id: <1499238885-26161-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> References: <1499238885-26161-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 09/42] cpu: Introduce a wrapper for tlb_flush() that can be used in common code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth Commit 1f5c00cfdb8114c ("qom/cpu: move tlb_flush to cpu_common_reset") moved the call to tlb_flush() from the target-specific reset handlers into the common code qom/cpu.c file, and protected the call with "#ifdef CONFIG_SOFTMMU" to avoid that it is called for linux-user only targets. But since qom/cpu.c is common code, CONFIG_SOFTMMU is *never* defined here, so the tlb_flush() was simply never executed anymore. Fix it by introducing a wrapper for tlb_flush() in a file that is re-compiled for each target, i.e. in translate-all.c. Fixes: 1f5c00cfdb8114c1e3a13426588ceb64f82c9ddb Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1498454578-18709-5-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- accel/tcg/translate-all.c | 8 ++++++++ include/exec/cpu-common.h | 2 ++ qom/cpu.c | 5 ++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 93fb923..dc7e816 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2223,3 +2223,11 @@ int page_unprotect(target_ulong address, uintptr_t pc) return 0; } #endif /* CONFIG_USER_ONLY */ + +/* 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/include/exec/cpu-common.h b/include/exec/cpu-common.h index 4d45a72..74341b1 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -28,6 +28,8 @@ void qemu_init_cpu_list(void); void cpu_list_lock(void); void cpu_list_unlock(void); +void tcg_flush_softmmu_tlb(CPUState *cs); + #if !defined(CONFIG_USER_ONLY) enum device_endian { diff --git a/qom/cpu.c b/qom/cpu.c index 585419b..7b20f84 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -26,6 +26,7 @@ #include "qemu/notify.h" #include "qemu/log.h" #include "exec/log.h" +#include "exec/cpu-common.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "hw/qdev-properties.h" @@ -293,9 +294,7 @@ static void cpu_common_reset(CPUState *cpu) if (tcg_enabled()) { cpu_tb_jmp_cache_clear(cpu); -#ifdef CONFIG_SOFTMMU - tlb_flush(cpu, 0); -#endif + tcg_flush_softmmu_tlb(cpu); } }