From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3C64C433F5 for ; Wed, 15 Sep 2021 08:55:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49F5B61178 for ; Wed, 15 Sep 2021 08:55:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 49F5B61178 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mQQhO-0002Gi-Dh for qemu-devel@archiver.kernel.org; Wed, 15 Sep 2021 04:55:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46500) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQQfP-0000Jj-FC for qemu-devel@nongnu.org; Wed, 15 Sep 2021 04:53:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQQfM-0003kl-My for qemu-devel@nongnu.org; Wed, 15 Sep 2021 04:53:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631695995; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TBaKNBu639ZEHh/xMX97nJQu/PlaKwVBQMbzZpIXLbg=; b=UqP4eW/CP4ydYEg9ccuRKR7GtgoJyKDeE0Y8FKBQyFng68rJpc9mcVv/ElOEur4so+lqnq c4qoYbP86e8fjNgPN1ZOHNLPEtzFyFl8xZjezmDCYs/hptq23kgPv/kIjAtEraPGAL0pVY K3IBrTRNAJuFW0Zrh/ajntar8k4x5cU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-Z3tcu2TcPT64z57HgXjrXw-1; Wed, 15 Sep 2021 04:53:12 -0400 X-MC-Unique: Z3tcu2TcPT64z57HgXjrXw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 250A31015DA3; Wed, 15 Sep 2021 08:53:09 +0000 (UTC) Received: from redhat.com (unknown [10.39.194.233]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91F4B10016FE; Wed, 15 Sep 2021 08:52:53 +0000 (UTC) Date: Wed, 15 Sep 2021 09:52:51 +0100 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Subject: Re: [PATCH v2 27/53] target/xtensa: convert to use format_state instead of dump_state Message-ID: References: <20210914142042.1655100-1-berrange@redhat.com> <20210914142042.1655100-28-berrange@redhat.com> <1cb38e8f-cc05-461a-c722-efb18519f6fe@amsat.org> MIME-Version: 1.0 In-Reply-To: <1cb38e8f-cc05-461a-c722-efb18519f6fe@amsat.org> User-Agent: Mutt/2.0.7 (2021-05-04) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.398, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Cc: Peter Maydell , Cornelia Huck , David Hildenbrand , Bin Meng , Mark Cave-Ayland , qemu-devel@nongnu.org, Peter Xu , Max Filippov , Taylor Simpson , Alistair Francis , Gerd Hoffmann , "Edgar E. Iglesias" , Eric Blake , Marek Vasut , Yoshinori Sato , Markus Armbruster , Halil Pasic , Christian Borntraeger , qemu-ppc@nongnu.org, Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , Richard Henderson , Greg Kurz , Yuval Shaia , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Stafford Horne , David Gibson , qemu-riscv@nongnu.org, Bastian Koppelmann , Chris Wulff , Laurent Vivier , Palmer Dabbelt , Aurelien Jarno , Paolo Bonzini , Aleksandar Rikalo , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, Sep 15, 2021 at 09:32:38AM +0200, Philippe Mathieu-Daudé wrote: > On 9/14/21 4:20 PM, Daniel P. Berrangé wrote: > > Signed-off-by: Daniel P. Berrangé > > --- > > target/xtensa/cpu.c | 2 +- > > target/xtensa/cpu.h | 2 +- > > target/xtensa/translate.c | 45 ++++++++++++++++++++------------------- > > 3 files changed, 25 insertions(+), 24 deletions(-) > > > -void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags) > > +void xtensa_cpu_format_state(CPUState *cs, GString *buf, int flags) > > { > > XtensaCPU *cpu = XTENSA_CPU(cs); > > CPUXtensaState *env = &cpu->env; > > xtensa_isa isa = env->config->isa; > > int i, j; > > > > - qemu_fprintf(f, "PC=%08x\n\n", env->pc); > > + g_string_append_printf(buf, "PC=%08x\n\n", env->pc); > > > > for (i = j = 0; i < xtensa_isa_num_sysregs(isa); ++i) { > > const uint32_t *reg = > > @@ -1340,55 +1340,56 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags) > > int regno = xtensa_sysreg_number(isa, i); > > > > if (regno >= 0) { > > - qemu_fprintf(f, "%12s=%08x%c", > > - xtensa_sysreg_name(isa, i), > > - reg[regno], > > - (j++ % 4) == 3 ? '\n' : ' '); > > + g_string_append_printf(buf, "%12s=%08x%c", > > + xtensa_sysreg_name(isa, i), > > + reg[regno], > > + (j++ % 4) == 3 ? '\n' : ' '); > > } > > } > > > > - qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n"); > > + g_string_append_printf(buf, (j % 4) == 0 ? "\n" : "\n\n"); > > > > for (i = 0; i < 16; ++i) { > > - qemu_fprintf(f, " A%02d=%08x%c", > > - i, env->regs[i], (i % 4) == 3 ? '\n' : ' '); > > + g_string_append_printf(buf, " A%02d=%08x%c", > > + i, env->regs[i], (i % 4) == 3 ? '\n' : ' '); > > } > > > > xtensa_sync_phys_from_window(env); > > - qemu_fprintf(f, "\n"); > > + g_string_append_printf(buf, "\n"); > > g_string_append_c(); pre-existing but better to move it before > xtensa_sync_phys_from_window(). I don't want to be re-arranging the code in this series. It is just a straight search/replace of qemu_fprintf with g_string_append_printf, with the bare minimum of other changes, to minimize risk of breaking something unexpected. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1mQQfV-0000Ow-Qp for mharc-qemu-riscv@gnu.org; Wed, 15 Sep 2021 04:53:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQQfQ-0000L5-Ux for qemu-riscv@nongnu.org; Wed, 15 Sep 2021 04:53:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33676) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mQQfM-0003km-La for qemu-riscv@nongnu.org; Wed, 15 Sep 2021 04:53:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631695995; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TBaKNBu639ZEHh/xMX97nJQu/PlaKwVBQMbzZpIXLbg=; b=UqP4eW/CP4ydYEg9ccuRKR7GtgoJyKDeE0Y8FKBQyFng68rJpc9mcVv/ElOEur4so+lqnq c4qoYbP86e8fjNgPN1ZOHNLPEtzFyFl8xZjezmDCYs/hptq23kgPv/kIjAtEraPGAL0pVY K3IBrTRNAJuFW0Zrh/ajntar8k4x5cU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-Z3tcu2TcPT64z57HgXjrXw-1; Wed, 15 Sep 2021 04:53:12 -0400 X-MC-Unique: Z3tcu2TcPT64z57HgXjrXw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 250A31015DA3; Wed, 15 Sep 2021 08:53:09 +0000 (UTC) Received: from redhat.com (unknown [10.39.194.233]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91F4B10016FE; Wed, 15 Sep 2021 08:52:53 +0000 (UTC) Date: Wed, 15 Sep 2021 09:52:51 +0100 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= Cc: qemu-devel@nongnu.org, Peter Maydell , Chris Wulff , David Hildenbrand , Bin Meng , Mark Cave-Ayland , Yuval Shaia , Laurent Vivier , Max Filippov , Taylor Simpson , Alistair Francis , Gerd Hoffmann , "Edgar E. Iglesias" , Eric Blake , Marek Vasut , Yoshinori Sato , Markus Armbruster , Halil Pasic , Christian Borntraeger , Palmer Dabbelt , Artyom Tarasenko , Laurent Vivier , Thomas Huth , Eduardo Habkost , Richard Henderson , Greg Kurz , "Dr. David Alan Gilbert" , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, Michael Rolnik , Peter Xu , Stafford Horne , David Gibson , qemu-riscv@nongnu.org, Bastian Koppelmann , Cornelia Huck , qemu-ppc@nongnu.org, Paolo Bonzini , Aleksandar Rikalo , Aurelien Jarno Subject: Re: [PATCH v2 27/53] target/xtensa: convert to use format_state instead of dump_state Message-ID: Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= References: <20210914142042.1655100-1-berrange@redhat.com> <20210914142042.1655100-28-berrange@redhat.com> <1cb38e8f-cc05-461a-c722-efb18519f6fe@amsat.org> MIME-Version: 1.0 In-Reply-To: <1cb38e8f-cc05-461a-c722-efb18519f6fe@amsat.org> User-Agent: Mutt/2.0.7 (2021-05-04) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) DKIMWL_WL_HIGH=-0.398, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-riscv@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Sep 2021 08:53:22 -0000 On Wed, Sep 15, 2021 at 09:32:38AM +0200, Philippe Mathieu-Daudé wrote: > On 9/14/21 4:20 PM, Daniel P. Berrangé wrote: > > Signed-off-by: Daniel P. Berrangé > > --- > > target/xtensa/cpu.c | 2 +- > > target/xtensa/cpu.h | 2 +- > > target/xtensa/translate.c | 45 ++++++++++++++++++++------------------- > > 3 files changed, 25 insertions(+), 24 deletions(-) > > > -void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags) > > +void xtensa_cpu_format_state(CPUState *cs, GString *buf, int flags) > > { > > XtensaCPU *cpu = XTENSA_CPU(cs); > > CPUXtensaState *env = &cpu->env; > > xtensa_isa isa = env->config->isa; > > int i, j; > > > > - qemu_fprintf(f, "PC=%08x\n\n", env->pc); > > + g_string_append_printf(buf, "PC=%08x\n\n", env->pc); > > > > for (i = j = 0; i < xtensa_isa_num_sysregs(isa); ++i) { > > const uint32_t *reg = > > @@ -1340,55 +1340,56 @@ void xtensa_cpu_dump_state(CPUState *cs, FILE *f, int flags) > > int regno = xtensa_sysreg_number(isa, i); > > > > if (regno >= 0) { > > - qemu_fprintf(f, "%12s=%08x%c", > > - xtensa_sysreg_name(isa, i), > > - reg[regno], > > - (j++ % 4) == 3 ? '\n' : ' '); > > + g_string_append_printf(buf, "%12s=%08x%c", > > + xtensa_sysreg_name(isa, i), > > + reg[regno], > > + (j++ % 4) == 3 ? '\n' : ' '); > > } > > } > > > > - qemu_fprintf(f, (j % 4) == 0 ? "\n" : "\n\n"); > > + g_string_append_printf(buf, (j % 4) == 0 ? "\n" : "\n\n"); > > > > for (i = 0; i < 16; ++i) { > > - qemu_fprintf(f, " A%02d=%08x%c", > > - i, env->regs[i], (i % 4) == 3 ? '\n' : ' '); > > + g_string_append_printf(buf, " A%02d=%08x%c", > > + i, env->regs[i], (i % 4) == 3 ? '\n' : ' '); > > } > > > > xtensa_sync_phys_from_window(env); > > - qemu_fprintf(f, "\n"); > > + g_string_append_printf(buf, "\n"); > > g_string_append_c(); pre-existing but better to move it before > xtensa_sync_phys_from_window(). I don't want to be re-arranging the code in this series. It is just a straight search/replace of qemu_fprintf with g_string_append_printf, with the bare minimum of other changes, to minimize risk of breaking something unexpected. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|