On 9/29/21 3:09 AM, Gerd Hoffmann wrote:
TODO: Not sure whenever "check function pointer before call" or "function pointers to stubs" is better. Right now the patch has both which clearly doesn't make sense. Comments on that are welcome.
I guess I don't mind either way, but we do need to pick one.
--- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -25,6 +25,7 @@ #include "exec/cpu_ldst.h" #endif #include "sysemu/cpu-timers.h" +#include "tcg/tcg-module.h"
Surely not required here.
+/** + * tlb_flush: + * @cpu: CPU whose TLB should be flushed + * + * Flush the entire TLB for the specified CPU. Most CPU architectures + * allow the implementation to drop entries from the TLB at any time + * so this is generally safe. If more selective flushing is required + * use one of the other functions for efficiency. + */ +void tlb_flush(CPUState *cpu); + #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
Going too far here, since CONFIG_USER_ONLY always uses TCG, never uses modules, and does not implement a softmmu tlb that requires flushing. I think you can just change the ifdef to remove the CONFIG_TCG check.
Alternately, we could keep this slight inefficiency to fix...
+ +/* 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 +}
... this bit of silliness. r~