From patchwork Tue Mar 28 16:02:02 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: 667865 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp1743480wrt; Tue, 28 Mar 2023 09:03:53 -0700 (PDT) X-Google-Smtp-Source: AKy350YMCPORiM4nx5pPcA36m20Zp99R4e2zFzg4F9AHXvK1wY9wp+O4VpRR8jY66f8lLAi4EQpd X-Received: by 2002:a05:7500:2d8f:b0:fb:b9c5:a7b0 with SMTP id er15-20020a0575002d8f00b000fbb9c5a7b0mr452315gab.46.1680019433519; Tue, 28 Mar 2023 09:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680019433; cv=none; d=google.com; s=arc-20160816; b=F2ySp3v1xNKPaX3Q9u3wNhM7WEFLiCacy3bUpmvj5xRLJEf7Lao4M+GAeqijm2k6FD rmxj2rEBznK4dIPnzOSolMZ5zfH/vrX7fOQ9WbrNSSrILvviwiJFmNlCSAUwYUS/tdHU fMUUI9Ius3tqJhkvQg3rrUtw1PkwqkCst0gr2RoKQSjKnpY70/dlQITHlzj/xLqKKv+k jGVklUDr1jDSAv/d8h+L2vXa9ddjetfHniFg6j17l3A832D1QUXW3MhVHRH+itN8Es2u QIygixOVUMLaVRPdo/UQ5l0VSwqELPEeRCRC1n2bTDgFpXiue+E9y+YAcvx/QNJTAxOi dnwQ== 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=OyRcr9DasCtgvInsYY6GlB+tbhS02lFwPYhN+M0bqAw=; b=h62vL6jGkLu3QuKWHa8cjAK/qrpCgEuhqkAYTq/XSXyRP/XbDjmMCY+nBF+7eABWf1 +wm/eojJS6HJugaAg31XV7V3iEScGaYmB7ee5NOa2QREsk9VHlGjlD95YuCq1IKbQj+c KKUNigtZdlTJBCAtciReroEgr4ppjcpZYzpnwEGBvjtB92hDYiX2KyISzqw5NwGQx+DL wjBwRK2GHnlij1dF/YYJgWOB+UYKjvBM/CuUd71jhz61WXri4wHiGw+oPRdZbeOCCXWG 2VmVr9lN2Wi+7tRowNSk3iLZRnaH6Xxa9rYVHmXliPWZA7kJC2Y0m6jpSPh0zOCVtVtw 659w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="M/V1i9iW"; 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 i128-20020a378686000000b0074684e8fd13si15757036qkd.659.2023.03.28.09.03.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 28 Mar 2023 09:03:53 -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="M/V1i9iW"; 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 1phBmD-0008ON-4C; Tue, 28 Mar 2023 12:02:25 -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 1phBmC-0008L4-1C for qemu-devel@nongnu.org; Tue, 28 Mar 2023 12:02:24 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phBmA-0004FN-2w for qemu-devel@nongnu.org; Tue, 28 Mar 2023 12:02:23 -0400 Received: by mail-wm1-x334.google.com with SMTP id j18-20020a05600c1c1200b003ee5157346cso9782956wms.1 for ; Tue, 28 Mar 2023 09:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680019340; 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=OyRcr9DasCtgvInsYY6GlB+tbhS02lFwPYhN+M0bqAw=; b=M/V1i9iWetntCRWzrdkWeGidDB588xHxXoR+BeABnw3ooUjzybpg9e3+r+Q0Zmkd70 5/EG66HBTqiYyxNjit8pVI20J/nY57KRVTImmW4VZBbiy2Mt2waNfp70Ig2F2w7ut11a JobQqrP2ocleeTiv5b6UCHOEedXqK5pZIQwPGEciAV2ECerpZV/tDlyCQMjFn2xYy8MJ ydi1oyXJkFMW3im5pHwawf995v2kV5hq3TF7mtas0/yt8U9QHyp6cQZ2h9Uky7LdPUZo lzeeJKxX4uC6TYUYdREct6y9MssE9rjbVyt+B1Rz+HoPMbEANrrY5jxR23Mmme4zuG1q vJGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680019340; 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=OyRcr9DasCtgvInsYY6GlB+tbhS02lFwPYhN+M0bqAw=; b=VPG/3NlXDWg2S+Hk0KHzugqkWM4iuLbdANaLb6RgDKoQndXacuBehWs3/sxVFxYq3m aj6j/3JhIuRpjaacJ7KS2TY+ArPm8k0wuKLtEgku6eT2zJlNYnZXEImdXOYydzBH2KSE iQ1A+RAZzWE089dpYMP9EkCMZ6sNHLtwBWw05+434/nBiMnRTtBkhtKD4A8qgcDgrSDi bJnTdoPYps40CNJYsIDosKjh5fQBqURQ7GkvKAFErqPYK6YFSTnmW4W15qbnxlEhbS66 a5lJUgCpXuqKI7XYMVdLbEzFtKfZdWmnD3IrWgFpIJ3goHZkmMkCXDwPyIOu1bJhl74E ZpuA== X-Gm-Message-State: AO0yUKUCCCSn14mTqE/3z2V2Q0VNOakZ8XnQDNKt9dqEQjY+1gm/Tq3O Zn8W03kKg+Xt7pa187MXQPpl3sDsyHFwY8JfHwQ= X-Received: by 2002:a05:600c:2114:b0:3dc:1687:9ba2 with SMTP id u20-20020a05600c211400b003dc16879ba2mr11868573wml.35.1680019340251; Tue, 28 Mar 2023 09:02:20 -0700 (PDT) Received: from localhost.localdomain ([176.187.210.212]) by smtp.gmail.com with ESMTPSA id n20-20020a7bc5d4000000b003ee10fb56ebsm17690163wmk.9.2023.03.28.09.02.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 28 Mar 2023 09:02:19 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , kvm@vger.kernel.org, qemu-s390x@nongnu.org, Fabiano Rosas , David Hildenbrand , Marcel Apfelbaum , Paolo Bonzini , Greg Kurz , Christian Borntraeger , Thomas Huth , Peter Maydell , Richard Henderson , Ilya Leoshkevich , Halil Pasic , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Daniel Henrique Barboza , David Gibson , Yanan Wang , qemu-ppc@nongnu.org, =?utf-8?q?Alex_Be?= =?utf-8?q?nn=C3=A9e?= , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.0 2/3] softmmu: Restrict cpu_check_watchpoint / address_matches to TCG accel Date: Tue, 28 Mar 2023 18:02:02 +0200 Message-Id: <20230328160203.13510-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230328160203.13510-1-philmd@linaro.org> References: <20230328160203.13510-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.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-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 Both cpu_check_watchpoint() and cpu_watchpoint_address_matches() are specific to TCG system emulation. Declare them in "tcg-cpu-ops.h" to be sure accessing them from non-TCG code is a compilation error. Signed-off-by: Philippe Mathieu-Daudé --- include/hw/core/cpu.h | 37 ------------------------------ include/hw/core/tcg-cpu-ops.h | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 821e937020..ce312745d5 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -970,17 +970,6 @@ static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu, static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask) { } - -static inline void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, - MemTxAttrs atr, int fl, uintptr_t ra) -{ -} - -static inline int cpu_watchpoint_address_matches(CPUState *cpu, - vaddr addr, vaddr len) -{ - return 0; -} #else int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, int flags, CPUWatchpoint **watchpoint); @@ -988,32 +977,6 @@ int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, int flags); void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint); void cpu_watchpoint_remove_all(CPUState *cpu, int mask); - -/** - * cpu_check_watchpoint: - * @cpu: cpu context - * @addr: guest virtual address - * @len: access length - * @attrs: memory access attributes - * @flags: watchpoint access type - * @ra: unwind return address - * - * Check for a watchpoint hit in [addr, addr+len) of the type - * specified by @flags. Exit via exception with a hit. - */ -void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, - MemTxAttrs attrs, int flags, uintptr_t ra); - -/** - * cpu_watchpoint_address_matches: - * @cpu: cpu context - * @addr: guest virtual address - * @len: access length - * - * Return the watchpoint flags that apply to [addr, addr+len). - * If no watchpoint is registered for the range, the result is 0. - */ -int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); #endif /** diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h index 20e3c0ffbb..0ae08df47e 100644 --- a/include/hw/core/tcg-cpu-ops.h +++ b/include/hw/core/tcg-cpu-ops.h @@ -175,4 +175,47 @@ struct TCGCPUOps { }; +#if defined(CONFIG_USER_ONLY) + +static inline void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, + MemTxAttrs atr, int fl, uintptr_t ra) +{ +} + +static inline int cpu_watchpoint_address_matches(CPUState *cpu, + vaddr addr, vaddr len) +{ + return 0; +} + +#else + +/** + * cpu_check_watchpoint: + * @cpu: cpu context + * @addr: guest virtual address + * @len: access length + * @attrs: memory access attributes + * @flags: watchpoint access type + * @ra: unwind return address + * + * Check for a watchpoint hit in [addr, addr+len) of the type + * specified by @flags. Exit via exception with a hit. + */ +void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, + MemTxAttrs attrs, int flags, uintptr_t ra); + +/** + * cpu_watchpoint_address_matches: + * @cpu: cpu context + * @addr: guest virtual address + * @len: access length + * + * Return the watchpoint flags that apply to [addr, addr+len). + * If no watchpoint is registered for the range, the result is 0. + */ +int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len); + +#endif + #endif /* TCG_CPU_OPS_H */