From patchwork Thu Apr 18 19:25:10 2024 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: 1925233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=H9ay9pzy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VL79j2Ky9z1yZP for ; Fri, 19 Apr 2024 05:28:41 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxXQg-0002et-Nx; Thu, 18 Apr 2024 15:28:19 -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 1rxXP9-0008D8-9n for qemu-ppc@nongnu.org; Thu, 18 Apr 2024 15:26:48 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxXP6-0007W2-2Q for qemu-ppc@nongnu.org; Thu, 18 Apr 2024 15:26:42 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a51a1c8d931so134302766b.0 for ; Thu, 18 Apr 2024 12:26:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713468396; x=1714073196; 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=Jio+r+AEUkjjrU5gDZl4zBsemaqAFeHzEWFaXnqFrOQ=; b=H9ay9pzyZ3ABmD/RWdVRSmHZJ7NF0E3NBJrceLHGEJzh6D7hJPH+8f2V1ryKITt3ud /B3wppTVSXUgTFlvB63p+1EKTKSIGLDYekYP/JSXjD5ogQiuK89yM44cC6X0kRqw8VMq dPP4gljVL+cBnfA8M4m3V67fVvUoorMzwLr3wSy4Wg9JOhVtV8WbmGtvc/rN1bn4rP94 IfkdTDv83Dfn+TueCEwTIv5uOmw7J30z3m9GIha/9F5lkqNUyooZOiYbjS0Y81TSqkC7 qD+ALB49Pq+ZT8OnjAnk4roeyzf99jWE4yIgwVTFCCDLa+0kj5jnEdP6ueDv9/pMbc+l RIag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713468396; x=1714073196; 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=Jio+r+AEUkjjrU5gDZl4zBsemaqAFeHzEWFaXnqFrOQ=; b=VzNUzUsoETVZ4RH7Nl24dmanHbg3DPN/vexr2V/QC+MAuEhs/7dr3NckI2FyEttSnU uSLCRZ3TcJ0T0Hp1GUzva3ppYnTjHzVA6eIk0tcpDaZJkQ10YYCiTeoliIOkqruMarfX +PR2KrfaTPj9OAt9ywNcx7Q/YP1Vvh8jrEew5YPJWJ1l5HsLTHWefZAHpnkKmNf3i67B iRQjlYteY7nOrn8LjC0/lJ5HnJliICtDZdyHxuZSf2Aes3zP0L7XluY5MpeyiNRcnR7R v0EgQuqEQdL9eOVnMKU+q1KgxThKO2dluKD8Y0m0QXqulc1s8nZk3hOuRmw97xONbWD+ LaIw== X-Forwarded-Encrypted: i=1; AJvYcCU7F8BZm6HKQhB1qQL2vqeU+l8XyrYB6oxGjayHa6GFyKBtUyktF/eHZZ2yZ9n4r3YFF+dB7hdigtQG4i5huX8mtBy9 X-Gm-Message-State: AOJu0YytFDdKw9bnZJsHXn4TdfvPUB+1fV0YgE0tN9p2Vl94S3ELa94S bg2vHrLxa5BOLaAShuTczBSo60XM6lpS5at7bcfELhtUaSN/lYdJHMEBp1OD8Dw= X-Google-Smtp-Source: AGHT+IGvos0mZIxaTBgDhPQVJFUlHPzRnRLeB+2FoZuf4Lvw2zFvFjAnSJwEUd4r5lLo33Y0Jgv61A== X-Received: by 2002:a17:906:1f48:b0:a4e:cd5c:da72 with SMTP id d8-20020a1709061f4800b00a4ecd5cda72mr43114ejk.63.1713468396179; Thu, 18 Apr 2024 12:26:36 -0700 (PDT) Received: from m1x-phil.lan ([176.176.151.213]) by smtp.gmail.com with ESMTPSA id lu10-20020a170906faca00b00a52299d8eecsm1238430ejb.135.2024.04.18.12.26.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 18 Apr 2024 12:26:35 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Richard Henderson , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, qemu-riscv@nongnu.org, David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Anton Johansson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Xu Subject: [PATCH 11/24] exec: Move tlb_reset_dirty*() declarations to 'exec/cputlb.h' Date: Thu, 18 Apr 2024 21:25:10 +0200 Message-ID: <20240418192525.97451-12-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240418192525.97451-1-philmd@linaro.org> References: <20240418192525.97451-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-ppc@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-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-ppc-bounces+incoming=patchwork.ozlabs.org@nongnu.org Declare tlb_reset_dirty() and tlb_reset_dirty_range_all() in "exec/cputlb.h". Restrict tlb_reset_dirty_range_all() to TCG accel. Signed-off-by: Philippe Mathieu-Daudé --- include/exec/cputlb.h | 12 +++++++++++- include/exec/exec-all.h | 3 --- include/exec/ram_addr.h | 1 + system/physmem.c | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h index 3594f904b4..dc92befb93 100644 --- a/include/exec/cputlb.h +++ b/include/exec/cputlb.h @@ -49,6 +49,9 @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr, void tlb_protect_code(ram_addr_t ram_addr); void tlb_unprotect_code(ram_addr_t ram_addr); +void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); +void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length); + /** * iotlb_to_section: * @cpu: CPU performing the access @@ -69,6 +72,13 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu, #endif /* CONFIG_USER_ONLY */ -#endif /* CONFIG_TCG */ +#else /* !CONFIG_TCG */ + +static inline void tlb_reset_dirty_range_all(ram_addr_t start, + ram_addr_t length) +{ +} + +#endif /* !CONFIG_TCG */ #endif diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 778c82ba8e..6f46015ab4 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -640,9 +640,6 @@ static inline void mmap_lock(void) {} static inline void mmap_unlock(void) {} #define WITH_MMAP_LOCK_GUARD() -void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); -void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length); - #endif #endif diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index 3fc83587c0..f06ae9b516 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -26,6 +26,7 @@ #include "exec/ramlist.h" #include "exec/ramblock.h" #include "exec/exec-all.h" +#include "cputlb.h" #include "qemu/rcu.h" extern uint64_t total_dirty_pages; diff --git a/system/physmem.c b/system/physmem.c index 38d3ede9f9..7a7876a375 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -850,6 +850,7 @@ found: return block; } +#ifdef CONFIG_TCG void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) { CPUState *cpu; @@ -869,6 +870,7 @@ void tlb_reset_dirty_range_all(ram_addr_t start, ram_addr_t length) tlb_reset_dirty(cpu, start1, length); } } +#endif /* Note: start and end must be within the same ram block. */ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,