From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSnxN-0000Ow-W1 for qemu-devel@nongnu.org; Mon, 08 Feb 2016 10:42:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSnxN-0001tF-56 for qemu-devel@nongnu.org; Mon, 08 Feb 2016 10:42:29 -0500 Received: from mail-vk0-x234.google.com ([2607:f8b0:400c:c05::234]:34581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSnxN-0001sz-0h for qemu-devel@nongnu.org; Mon, 08 Feb 2016 10:42:29 -0500 Received: by mail-vk0-x234.google.com with SMTP id e185so97537077vkb.1 for ; Mon, 08 Feb 2016 07:42:27 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: <1454256948-10485-1-git-send-email-serge.fdrv@gmail.com> <1454256948-10485-2-git-send-email-serge.fdrv@gmail.com> From: Peter Maydell Date: Mon, 8 Feb 2016 15:42:07 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH v3 1/2] cpu: Add callback to check architectural watchpoint match List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sergey Fedorov Cc: Peter Crosthwaite , QEMU Developers , qemu-arm , Paolo Bonzini , =?UTF-8?Q?Andreas_F=C3=A4rber?= , Richard Henderson Andreas -- can I nudge you to say your preferences on whether QOM CPU methods should have wrapper functions, please? I think this patchset is otherwise ready to apply. thanks -- PMM On 2 February 2016 at 12:23, Peter Maydell wrote: > On 31 January 2016 at 16:15, Sergey Fedorov wrote: >> When QEMU watchpoint matches, that is not definitely an architectural >> watchpoint match yet. If it is a stop-before-access watchpoint then that >> is hardly possible to ignore it after throwing a TCG exception. >> >> A special callback is introduced to check for architectural watchpoint >> match before raising a TCG exception. >> >> Signed-off-by: Sergey Fedorov > > This looks OK to me, but there's one QOM CPU style question > I'd like Andreas's view on. > >> @@ -2024,6 +2024,7 @@ static const MemoryRegionOps notdirty_mem_ops = { >> static void check_watchpoint(int offset, int len, MemTxAttrs attrs, int flags) >> { >> CPUState *cpu = current_cpu; >> + CPUClass *cc = CPU_GET_CLASS(cpu); >> CPUArchState *env = cpu->env_ptr; >> target_ulong pc, cs_base; >> target_ulong vaddr; >> @@ -2049,6 +2050,11 @@ static void check_watchpoint(int offset, int len, MemTxAttrs attrs, int flags) >> wp->hitaddr = vaddr; >> wp->hitattrs = attrs; >> if (!cpu->watchpoint_hit) { >> + if (wp->flags & BP_CPU && >> + !cc->debug_check_watchpoint(cpu, wp)) { > > At least some of the QOM CPU methods have wrapper functions > (eg cpu_set_pc(), cpu_unaligned_access()) that just bundle up > the CPU_GET_CLASS and method invocation). Should new methods > like the debug_check_watchpoint() introduced by this patch have > that kind of wrapper function, or is it optional? > > (There also seems to be a mix of "implement default/common > behaviour in a common method implementation" vs "implement > it in the wrapper function if the method pointer is NULL". > I think the former, as done in this patch, is probably nicer > but again would defer to Andreas.) > > thanks > -- PMM