From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Riku Voipio" <riku.voipio@iki.fi>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Claudio Fontana" <cfontana@suse.de>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>
Subject: [RFC PATCH 6/6] softmmu: Restrict watchpoint handlers to TCG accelerator
Date: Sun, 17 Jan 2021 17:48:13 +0100 [thread overview]
Message-ID: <20210117164813.4101761-7-f4bug@amsat.org> (raw)
In-Reply-To: <20210117164813.4101761-1-f4bug@amsat.org>
Watchpoint funtions use cpu_restore_state() which is only
available when TCG accelerator is built. Restrict them
to TCG.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
RFC because we could keep that code by adding an empty
stub for cpu_restore_state(), but it is unclear as
the function is named generically.
---
include/hw/core/cpu.h | 4 ++--
softmmu/physmem.c | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 140fa32a5e3..1b4af30db04 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1033,7 +1033,7 @@ static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask)
return false;
}
-#ifdef CONFIG_USER_ONLY
+#if !defined(CONFIG_TCG) || defined(CONFIG_USER_ONLY)
static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint)
{
@@ -1098,7 +1098,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr 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 /* !CONFIG_TCG || CONFIG_USER_ONLY */
/**
* cpu_get_address_space:
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 65602ed548e..5135a6371b5 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -765,6 +765,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx)
return cpu->cpu_ases[asidx].as;
}
+#ifdef CONFIG_TCG
/* Add a watchpoint. */
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint)
@@ -873,6 +874,7 @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
}
return ret;
}
+#endif /* CONFIG_TCG */
/* Called from RCU critical section */
static RAMBlock *qemu_get_ram_block(ram_addr_t addr)
@@ -2356,6 +2358,7 @@ ram_addr_t qemu_ram_addr_from_host(void *ptr)
return block->offset + offset;
}
+#ifdef CONFIG_TCG
/* Generate a debug exception if a watchpoint has been hit. */
void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
MemTxAttrs attrs, int flags, uintptr_t ra)
@@ -2424,6 +2427,7 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
}
}
}
+#endif /* CONFIG_TCG */
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
MemTxAttrs attrs, void *buf, hwaddr len);
--
2.26.2
next prev parent reply other threads:[~2021-01-17 16:51 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-17 16:48 [PATCH 0/6] accel: Restrict TCG-specific code Philippe Mathieu-Daudé
2021-01-17 16:48 ` [PATCH 1/6] accel/tcg: Make cpu_gen_init() static Philippe Mathieu-Daudé
2021-01-18 9:14 ` Claudio Fontana
2021-01-21 5:54 ` Richard Henderson
2021-01-17 16:48 ` [PATCH 2/6] accel/tcg: Restrict tb_flush_jmp_cache() from other accelerators Philippe Mathieu-Daudé
2021-01-18 9:14 ` Claudio Fontana
2021-01-21 5:55 ` Richard Henderson
2021-01-17 16:48 ` [PATCH 3/6] accel/tcg: Restrict tb_gen_code() " Philippe Mathieu-Daudé
2021-01-18 9:12 ` Claudio Fontana
2021-01-21 6:06 ` Richard Henderson
2021-03-15 13:52 ` Claudio Fontana
2021-03-15 14:48 ` Philippe Mathieu-Daudé
2021-01-17 16:48 ` [PATCH 4/6] accel/tcg: Declare missing cpu_loop_exit*() stubs Philippe Mathieu-Daudé
2021-01-18 9:02 ` Claudio Fontana
2021-01-18 9:29 ` Claudio Fontana
2021-01-18 9:39 ` Philippe Mathieu-Daudé
2021-01-18 10:03 ` Claudio Fontana
2021-02-15 12:01 ` Alex Bennée
2021-01-21 6:21 ` Richard Henderson
2021-01-17 16:48 ` [RFC PATCH 5/6] accel/tcg: Restrict cpu_io_recompile() from other accelerators Philippe Mathieu-Daudé
2021-01-18 9:04 ` Claudio Fontana
2021-01-21 6:53 ` Richard Henderson
2021-01-17 16:48 ` Philippe Mathieu-Daudé [this message]
2021-01-18 9:10 ` [RFC PATCH 6/6] softmmu: Restrict watchpoint handlers to TCG accelerator Claudio Fontana
2021-01-18 9:36 ` Philippe Mathieu-Daudé
2021-02-15 10:42 ` Claudio Fontana
2021-02-15 12:05 ` Alex Bennée
2021-01-21 6:56 ` Richard Henderson
2021-01-18 9:20 ` [PATCH 0/6] accel: Restrict TCG-specific code Claudio Fontana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210117164813.4101761-7-f4bug@amsat.org \
--to=f4bug@amsat.org \
--cc=alex.bennee@linaro.org \
--cc=cfontana@suse.de \
--cc=chenhuacai@kernel.org \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).