From patchwork Mon Dec 17 23:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014854 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jccp0TYYz9s2P for ; Tue, 18 Dec 2018 10:22:18 +1100 (AEDT) Received: from localhost ([::1]:50474 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2DG-0003Vg-S7 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:22:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28K-00005U-HZ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28I-0002Xb-N5 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:08 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54530) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28I-0002VR-F2 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:06 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA37C804FA for ; Mon, 17 Dec 2018 23:17:05 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E69F6836F; Mon, 17 Dec 2018 23:17:04 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:26 +0100 Message-Id: <20181217231700.24482-2-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Dec 2018 23:17:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 01/35] accel: Improve selection of the default accelerator X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Thomas Huth When compiling with "--disable-tcg", we currently still use "tcg" as default accelerator. "kvm" should be used in this case instead. Also, some downstream distros provide QEMU binaries which have "kvm" in their names (e.g. "qemu-kvm" on RHEL or "kvm" on Ubuntu) that use KVM by default - and some users might want to do something similar with upstream binaries, too. Accomodate them by using "kvm:tcg" as default when we detect such a binary name. Signed-off-by: Thomas Huth Message-Id: <1538748792-19444-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- accel/accel.c | 18 +++++++++++++++--- include/sysemu/accel.h | 2 +- vl.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index 3da26eb90f..1b1214e273 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -69,7 +69,7 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms) return ret; } -void configure_accelerator(MachineState *ms) +void configure_accelerator(MachineState *ms, const char *progname) { const char *accel; char **accel_list, **tmp; @@ -80,8 +80,20 @@ void configure_accelerator(MachineState *ms) accel = qemu_opt_get(qemu_get_machine_opts(), "accel"); if (accel == NULL) { - /* Use the default "accelerator", tcg */ - accel = "tcg"; + /* Select the default accelerator */ + int pnlen = strlen(progname); + if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { + /* If the program name ends with "kvm", we prefer KVM */ + accel = "kvm:tcg"; + } else { +#if defined(CONFIG_TCG) + accel = "tcg"; +#elif defined(CONFIG_KVM) + accel = "kvm"; +#else +#error "No default accelerator available" +#endif + } } accel_list = g_strsplit(accel, ":", 0); diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 637358f430..285899e588 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -66,7 +66,7 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; -void configure_accelerator(MachineState *ms); +void configure_accelerator(MachineState *ms, const char *progname); /* Register accelerator specific global properties */ void accel_register_compat_props(AccelState *accel); /* Called just before os_setup_post (ie just before drop OS privs) */ diff --git a/vl.c b/vl.c index 2a8b2ee16d..5f6ff43b1b 100644 --- a/vl.c +++ b/vl.c @@ -4303,7 +4303,7 @@ int main(int argc, char **argv, char **envp) qemu_opt_foreach(machine_opts, machine_set_property, current_machine, &error_fatal); - configure_accelerator(current_machine); + configure_accelerator(current_machine, argv[0]); if (!qtest_enabled() && machine_class->deprecation_reason) { error_report("Machine type '%s' is deprecated: %s", From patchwork Mon Dec 17 23:16:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JchT5My3z9s2P for ; Tue, 18 Dec 2018 10:25:29 +1100 (AEDT) Received: from localhost ([::1]:50488 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2GM-00062l-Ob for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:25:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28Q-0000Ba-DC for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28P-000307-KT for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47860) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28P-0002uY-D9 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:13 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A643F753FC; Mon, 17 Dec 2018 23:17:12 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 344CA5D9C8; Mon, 17 Dec 2018 23:17:05 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:27 +0100 Message-Id: <20181217231700.24482-3-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 17 Dec 2018 23:17:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 02/35] vhost-user-bridge: fix "unknown type name" compilation error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , "Emilio G . Cota" , Michal Privoznik Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau osdep.h should be included first: CC tests/vhost-user-bridge.o In file included from /home/elmarco/src/qemu/tests/vhost-user-bridge.c:32: /home/elmarco/src/qemu/include/qemu/atomic.h:480:1: error: unknown type name ‘int64_t’ int64_t atomic_read_i64(const int64_t *ptr); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:480:32: error: unknown type name ‘int64_t’ int64_t atomic_read_i64(const int64_t *ptr); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:481:1: error: unknown type name ‘uint64_t’ uint64_t atomic_read_u64(const uint64_t *ptr); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:481:32: error: unknown type name ‘uint64_t’ uint64_t atomic_read_u64(const uint64_t *ptr); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:482:21: error: unknown type name ‘int64_t’ void atomic_set_i64(int64_t *ptr, int64_t val); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:482:35: error: unknown type name ‘int64_t’ void atomic_set_i64(int64_t *ptr, int64_t val); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:483:21: error: unknown type name ‘uint64_t’ void atomic_set_u64(uint64_t *ptr, uint64_t val); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:483:36: error: unknown type name ‘uint64_t’ void atomic_set_u64(uint64_t *ptr, uint64_t val); ^~~~~~~~ (regression from 782da5b2921c4d18777d5d5bd9385b9f7beae360) Signed-off-by: Marc-André Lureau Message-Id: <20181031104136.9953-1-marcandre.lureau@redhat.com> Reviewed-by: Michal Privoznik Reviewed-by: Emilio G. Cota Signed-off-by: Paolo Bonzini --- tests/vhost-user-bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 0cf8d0baca..e029e5b5a9 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -29,8 +29,9 @@ #define _FILE_OFFSET_BITS 64 -#include "qemu/atomic.h" #include "qemu/osdep.h" + +#include "qemu/atomic.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" #include "contrib/libvhost-user/libvhost-user.h" From patchwork Mon Dec 17 23:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014856 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcgs3Zvhz9s2P for ; Tue, 18 Dec 2018 10:24:57 +1100 (AEDT) Received: from localhost ([::1]:50484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Fq-0005dS-KZ for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:24:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28T-0000Ea-P1 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28R-000361-Ov for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44598) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28R-00034B-IQ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:15 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CF697C0703A6; Mon, 17 Dec 2018 23:17:14 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9905C5D9C8; Mon, 17 Dec 2018 23:17:13 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:28 +0100 Message-Id: <20181217231700.24482-4-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Dec 2018 23:17:14 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 03/35] checkpatch: fix premature exit when no input or --mailback X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" In some cases, checkpatch's process subroutine is exiting the whole process. This is wrong, just return from the subroutine instead. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a892a6cc7c..c503122911 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2819,19 +2819,19 @@ sub process { # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { - exit(0); + return 1; } # In mailback mode only produce a report in the negative, for # things that appear to be patches. if ($mailback && ($clean == 1 || !$is_patch)) { - exit(0); + return 1; } # This is not a patch, and we are are in 'no-patch' mode so # just keep quiet. if (!$chk_patch && !$is_patch) { - exit(0); + return 1; } if (!$is_patch) { From patchwork Mon Dec 17 23:16:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014860 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JclT6d8Nz9s2P for ; Tue, 18 Dec 2018 10:28:04 +1100 (AEDT) Received: from localhost ([::1]:50501 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Ir-00085c-4r for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:28:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28U-0000FY-Qf for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28U-0003CI-24 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:18 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52532) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28T-0003Bp-SZ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:17 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3AE8CD7E91; Mon, 17 Dec 2018 23:17:17 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 602F45D9C5; Mon, 17 Dec 2018 23:17:15 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:29 +0100 Message-Id: <20181217231700.24482-5-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Dec 2018 23:17:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 04/35] checkpatch: check Signed-off-by in --mailback mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Pull the test before the anticipated exits from the process sub. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index c503122911..d20bc58578 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2816,6 +2816,10 @@ sub process { } } + if ($is_patch && $chk_signoff && $signoff == 0) { + ERROR("Missing Signed-off-by: line(s)\n"); + } + # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { @@ -2837,9 +2841,6 @@ sub process { if (!$is_patch) { ERROR("Does not appear to be a unified-diff format patch\n"); } - if ($is_patch && $chk_signoff && $signoff == 0) { - ERROR("Missing Signed-off-by: line(s)\n"); - } print report_dump(); if ($summary && !($clean == 1 && $quiet == 1)) { From patchwork Mon Dec 17 23:16:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jccj6rVSz9s2P for ; Tue, 18 Dec 2018 10:22:13 +1100 (AEDT) Received: from localhost ([::1]:50472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2DD-0003Rf-3U for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:22:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28W-0000Fr-3q for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28V-0003Fm-C7 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44610) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28V-0003D8-5A for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:19 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8015DC056795 for ; Mon, 17 Dec 2018 23:17:18 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABAA45D9C8 for ; Mon, 17 Dec 2018 23:17:17 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:30 +0100 Message-Id: <20181217231700.24482-6-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Dec 2018 23:17:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 05/35] checkpatch: improve handling of multiple patches or files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Similar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom. In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first. Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of `git log` calls with --git", 2016-03-20). Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d20bc58578..2184a481ac 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -339,13 +339,18 @@ my @lines = (); my $vname; if ($chk_branch) { my @patches; + my %git_commits = (); my $HASH; - open($HASH, "-|", "git", "log", "--format=%H", $ARGV[0]) || - die "$P: git log --format=%H $ARGV[0] failed - $!\n"; - - while (<$HASH>) { - chomp; - push @patches, $_; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n"; + + for my $line (<$HASH>) { + $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 = $1; + my $subject = $2; + push(@patches, $sha1); + $git_commits{$sha1} = $subject; } close $HASH; @@ -353,21 +358,31 @@ if ($chk_branch) { die "$P: no revisions returned for revlist '$chk_branch'\n" unless @patches; + my $i = 1; + my $num_patches = @patches; for my $hash (@patches) { my $FILE; open($FILE, '-|', "git", "show", $hash) || die "$P: git show $hash - $!\n"; - $vname = $hash; while (<$FILE>) { chomp; push(@rawlines, $_); } close($FILE); + $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet == 0) { + print "$i/$num_patches Checking commit $vname\n"; + $vname = "Patch $i/$num_patches"; + } else { + $vname = "Commit " . $vname; + } if (!process($hash)) { $exit = 1; + print "\n" if ($num_patches > 1 && $quiet == 0); } @rawlines = (); @lines = (); + $i++; } } else { for my $filename (@ARGV) { @@ -386,6 +401,7 @@ if ($chk_branch) { } else { $vname = $filename; } + print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0; while (<$FILE>) { chomp; push(@rawlines, $_); From patchwork Mon Dec 17 23:16:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014851 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcbh1NC2z9s2P for ; Tue, 18 Dec 2018 10:21:20 +1100 (AEDT) Received: from localhost ([::1]:50465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2CL-0002l7-LM for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:21:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28Y-0000I2-KS for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28W-0003Gf-RR for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52538) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28W-0003GH-Is for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:20 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8014D215C; Mon, 17 Dec 2018 23:17:19 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id E72695D9C5; Mon, 17 Dec 2018 23:17:18 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:31 +0100 Message-Id: <20181217231700.24482-7-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Dec 2018 23:17:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 06/35] checkpatch: colorize output to terminal X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add optional colors to make seeing message types a bit easier. The default is to show them on a tty. Inspired by Linux commits 57230297116fa ("checkpatch: colorize output to terminal") and 737c0767758b ("checkpatch: change format of --color argument to --color[=WHEN]"). Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- scripts/checkpatch.pl | 49 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2184a481ac..df2da09b06 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7,6 +7,7 @@ use strict; use warnings; +use Term::ANSIColor qw(:constants); my $P = $0; $P =~ s@.*/@@g; @@ -26,6 +27,7 @@ my $tst_only; my $emacs = 0; my $terse = 0; my $file = undef; +my $color = "auto"; my $no_warnings = 0; my $summary = 1; my $mailback = 0; @@ -64,6 +66,8 @@ Options: is all off) --test-only=WORD report only warnings/errors containing WORD literally + --color[=WHEN] Use colors 'always', 'never', or only when output + is a terminal ('auto'). Default is 'auto'. -h, --help, --version display this help and exit When FILE is - read standard input. @@ -72,6 +76,14 @@ EOM exit($exitcode); } +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + GetOptions( 'q|quiet+' => \$quiet, 'tree!' => \$tree, @@ -89,6 +101,8 @@ GetOptions( 'debug=s' => \%debug, 'test-only=s' => \$tst_only, + 'color=s' => \$color, + 'no-color' => sub { $color = 'never'; }, 'h|help' => \$help, 'version' => \$help ) or help(1); @@ -144,6 +158,16 @@ if (!$chk_patch && !$chk_branch && !$file) { die "One of --file, --branch, --patch is required\n"; } +if ($color =~ /^always$/i) { + $color = 1; +} elsif ($color =~ /^never$/i) { + $color = 0; +} elsif ($color =~ /^auto$/i) { + $color = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + my $dbg_values = 0; my $dbg_possible = 0; my $dbg_type = 0; @@ -371,7 +395,9 @@ if ($chk_branch) { close($FILE); $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; if ($num_patches > 1 && $quiet == 0) { - print "$i/$num_patches Checking commit $vname\n"; + my $prefix = "$i/$num_patches"; + $prefix = BLUE . BOLD . $prefix . RESET if $color; + print "$prefix Checking commit $vname\n"; $vname = "Patch $i/$num_patches"; } else { $vname = "Commit " . $vname; @@ -1181,14 +1207,23 @@ sub possible { my $prefix = ''; sub report { - if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) { + my ($level, $msg) = @_; + if (defined $tst_only && $msg !~ /\Q$tst_only\E/) { return 0; } - my $line = $prefix . $_[0]; - $line = (split('\n', $line))[0] . "\n" if ($terse); + my $output = ''; + $output .= BOLD if $color; + $output .= $prefix; + $output .= RED if $color && $level eq 'ERROR'; + $output .= MAGENTA if $color && $level eq 'WARNING'; + $output .= $level . ':'; + $output .= RESET if $color; + $output .= ' ' . $msg . "\n"; + + $output = (split('\n', $output))[0] . "\n" if ($terse); - push(our @report, $line); + push(our @report, $output); return 1; } @@ -1196,13 +1231,13 @@ sub report_dump { our @report; } sub ERROR { - if (report("ERROR: $_[0]\n")) { + if (report("ERROR", $_[0])) { our $clean = 0; our $cnt_error++; } } sub WARN { - if (report("WARNING: $_[0]\n")) { + if (report("WARNING", $_[0])) { our $clean = 0; our $cnt_warn++; } From patchwork Mon Dec 17 23:16:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcgL5cTRz9s2P for ; Tue, 18 Dec 2018 10:24:30 +1100 (AEDT) Received: from localhost ([::1]:50481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2FP-0005Ha-Kb for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:24:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28Z-0000Ix-GR for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28Y-0003HN-Oz for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:23 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54592) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28Y-0003Gn-IZ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:22 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44EBC804FA for ; Mon, 17 Dec 2018 23:17:21 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AA125D9C5 for ; Mon, 17 Dec 2018 23:17:20 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:32 +0100 Message-Id: <20181217231700.24482-8-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Dec 2018 23:17:21 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 07/35] pam: wrap MemoryRegion initialization in a transaction X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This avoids a few re-rendering of the memory AddressSpace. Signed-off-by: Paolo Bonzini --- hw/pci-host/pam.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index e361ecb7ee..aa5ecfd0c2 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory, start, size); + memory_region_transaction_begin(); for (i = 0; i < 4; ++i) { memory_region_set_enabled(&mem->alias[i], false); memory_region_add_subregion_overlap(system_memory, start, &mem->alias[i], 1); } + memory_region_transaction_commit(); mem->current = 0; } From patchwork Mon Dec 17 23:16:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014864 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcq545jdz9s2P for ; Tue, 18 Dec 2018 10:31:13 +1100 (AEDT) Received: from localhost ([::1]:50517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Lu-0002L8-RT for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:31:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43118) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28h-0000Ng-6X for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28Z-0003I0-Qb for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44628) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28Z-0003HR-9R for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:23 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9F1B8C058CA2 for ; Mon, 17 Dec 2018 23:17:22 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id C43CC5D9C8 for ; Mon, 17 Dec 2018 23:17:21 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:33 +0100 Message-Id: <20181217231700.24482-9-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Dec 2018 23:17:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/35] memory: extract flat_range_coalesced_io_{del, add} X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Extract two new functions from memory_region_update_coalesced_range_as. To avoid duplication in the creation of the MemoryRegionSection, use MEMORY_LISTENER_UPDATE_REGION instead of MEMORY_LISTENER_CALL to invoke the listener callback. Signed-off-by: Paolo Bonzini --- memory.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/memory.c b/memory.c index d14c6dec1d..119b6e46d5 100644 --- a/memory.c +++ b/memory.c @@ -850,6 +850,33 @@ static void address_space_update_ioeventfds(AddressSpace *as) flatview_unref(view); } +static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) +{ + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, + int128_get64(fr->addr.start), + int128_get64(fr->addr.size)); +} + +static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) +{ + MemoryRegion *mr = fr->mr; + CoalescedMemoryRange *cmr; + AddrRange tmp; + + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { + tmp = addrrange_shift(cmr->addr, + int128_sub(fr->addr.start, + int128_make64(fr->offset_in_region))); + if (!addrrange_intersects(tmp, fr->addr)) { + continue; + } + tmp = addrrange_intersection(tmp, fr->addr); + MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, coalesced_io_add, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } +} + static void address_space_update_topology_pass(AddressSpace *as, const FlatView *old_view, const FlatView *new_view, @@ -2136,34 +2163,12 @@ static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpa { FlatView *view; FlatRange *fr; - CoalescedMemoryRange *cmr; - AddrRange tmp; - MemoryRegionSection section; view = address_space_get_flatview(as); FOR_EACH_FLAT_RANGE(fr, view) { if (fr->mr == mr) { - section = (MemoryRegionSection) { - .fv = view, - .offset_within_address_space = int128_get64(fr->addr.start), - .size = fr->addr.size, - }; - - MEMORY_LISTENER_CALL(as, coalesced_io_del, Reverse, §ion, - int128_get64(fr->addr.start), - int128_get64(fr->addr.size)); - QTAILQ_FOREACH(cmr, &mr->coalesced, link) { - tmp = addrrange_shift(cmr->addr, - int128_sub(fr->addr.start, - int128_make64(fr->offset_in_region))); - if (!addrrange_intersects(tmp, fr->addr)) { - continue; - } - tmp = addrrange_intersection(tmp, fr->addr); - MEMORY_LISTENER_CALL(as, coalesced_io_add, Forward, §ion, - int128_get64(tmp.start), - int128_get64(tmp.size)); - } + flat_range_coalesced_io_del(fr, as); + flat_range_coalesced_io_add(fr, as); } } flatview_unref(view); From patchwork Mon Dec 17 23:16:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014862 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcnP1JnZz9s2P for ; Tue, 18 Dec 2018 10:29:45 +1100 (AEDT) Received: from localhost ([::1]:50509 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2KU-00016H-IA for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:29:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28h-0000Nh-6d for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28a-0003Il-Rf for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39198) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28a-0003IM-Ji for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:24 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2BF942BC3 for ; Mon, 17 Dec 2018 23:17:23 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 10A925D9C8 for ; Mon, 17 Dec 2018 23:17:22 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:34 +0100 Message-Id: <20181217231700.24482-10-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Dec 2018 23:17:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 09/35] memory: avoid unnecessary coalesced_io_del operations X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Store whether the FlatRange has had any coalesced I/O ranges applied, and if not avoid calling coalesced_io_del. This is useful in preparation for the next patch, which will call coalesced_io_del when rendering memory regions. Signed-off-by: Paolo Bonzini --- memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/memory.c b/memory.c index 119b6e46d5..072769aa06 100644 --- a/memory.c +++ b/memory.c @@ -217,6 +217,7 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; + bool has_coalesced_range; }; #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -650,6 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; + fr.has_coalesced_range = false; /* Render the region itself into any gaps left by the current view. */ for (i = 0; i < view->nr && int128_nz(remain); ++i) { @@ -852,6 +854,10 @@ static void address_space_update_ioeventfds(AddressSpace *as) static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) { + if (!fr->has_coalesced_range) { + return; + } + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, int128_get64(fr->addr.start), int128_get64(fr->addr.size)); @@ -863,6 +869,11 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) CoalescedMemoryRange *cmr; AddrRange tmp; + if (QTAILQ_EMPTY(&mr->coalesced)) { + return; + } + + fr->has_coalesced_range = true; QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start, From patchwork Mon Dec 17 23:16:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcl04D7Hz9s2P for ; Tue, 18 Dec 2018 10:27:40 +1100 (AEDT) Received: from localhost ([::1]:50499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2IU-0007mx-4T for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:27:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43181) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28p-0000Uk-93 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28l-0003iP-3b for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44218) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28h-0003KG-Sj for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:33 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4603C070155; Mon, 17 Dec 2018 23:17:25 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B48C6836F; Mon, 17 Dec 2018 23:17:24 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:35 +0100 Message-Id: <20181217231700.24482-11-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Dec 2018 23:17:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/35] memory: update coalesced_range on transaction_commit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Atsushi Nemoto Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The e1000 driver calls memory_region_add_coalescing but kvm_coalesce_mmio_region is never called for those regions. The bug dates back to the introduction of the memory region API; to fix it, delete and re-add coalesced MMIO ranges when building the FlatViews. Because coalesced MMIO regions apply to all address spaces, the has_coalesced_range flag has to be changed into an int. Fixes: 093bc2cd885e ("Hierarchical memory region API") Reported-by: Atsushi Nemoto Signed-off-by: Paolo Bonzini --- memory.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/memory.c b/memory.c index 072769aa06..5759f74034 100644 --- a/memory.c +++ b/memory.c @@ -217,7 +217,7 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; - bool has_coalesced_range; + int has_coalesced_range; }; #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -651,7 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; - fr.has_coalesced_range = false; + fr.has_coalesced_range = 0; /* Render the region itself into any gaps left by the current view. */ for (i = 0; i < view->nr && int128_nz(remain); ++i) { @@ -858,6 +858,10 @@ static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) return; } + if (--fr->has_coalesced_range > 0) { + return; + } + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, int128_get64(fr->addr.start), int128_get64(fr->addr.size)); @@ -873,7 +877,10 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) return; } - fr->has_coalesced_range = true; + if (fr->has_coalesced_range++) { + return; + } + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start, @@ -920,6 +927,7 @@ static void address_space_update_topology_pass(AddressSpace *as, /* In old but not in new, or in both but attributes changed. */ if (!adding) { + flat_range_coalesced_io_del(frold, as); MEMORY_LISTENER_UPDATE_REGION(frold, as, Reverse, region_del); } @@ -927,7 +935,9 @@ static void address_space_update_topology_pass(AddressSpace *as, } else if (frold && frnew && flatrange_equal(frold, frnew)) { /* In both and unchanged (except logging may have changed) */ - if (adding) { + if (!adding) { + flat_range_coalesced_io_del(frold, as); + } else { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_nop); if (frnew->dirty_log_mask & ~frold->dirty_log_mask) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, log_start, @@ -939,6 +949,7 @@ static void address_space_update_topology_pass(AddressSpace *as, frold->dirty_log_mask, frnew->dirty_log_mask); } + flat_range_coalesced_io_add(frnew, as); } ++iold; @@ -948,6 +959,7 @@ static void address_space_update_topology_pass(AddressSpace *as, if (adding) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_add); + flat_range_coalesced_io_add(frnew, as); } ++inew; From patchwork Mon Dec 17 23:16:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014863 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcpN4hp4z9s2P for ; Tue, 18 Dec 2018 10:30:36 +1100 (AEDT) Received: from localhost ([::1]:50512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2LK-0001x5-5B for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:30:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28p-0000Ul-9c for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28n-0003jY-SJ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28l-0003NR-0P for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:35 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41F957FD42; Mon, 17 Dec 2018 23:17:27 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 369915D9C5; Mon, 17 Dec 2018 23:17:25 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:36 +0100 Message-Id: <20181217231700.24482-12-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Dec 2018 23:17:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/35] hax: Support for Linux hosts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandro Sanchez Bach Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Alexandro Sanchez Bach Intel HAXM supports now 32-bit and 64-bit Linux hosts. This patch includes the corresponding userland changes. Since the Darwin userland backend is POSIX-compliant, the hax-darwin.{c,h} files have been renamed to hax-posix.{c,h}. This prefix is consistent with the naming used in the rest of QEMU. Signed-off-by: Alexandro Sanchez Bach Message-Id: <20181115013331.65820-1-asanchez@kryptoslogic.com> Signed-off-by: Paolo Bonzini --- target/i386/Makefile.objs | 6 +++--- target/i386/hax-i386.h | 6 +++--- target/i386/{hax-darwin.c => hax-posix.c} | 0 target/i386/{hax-darwin.h => hax-posix.h} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename target/i386/{hax-darwin.c => hax-posix.c} (100%) rename target/i386/{hax-darwin.h => hax-posix.h} (100%) diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs index 32bf966300..cb9c265525 100644 --- a/target/i386/Makefile.objs +++ b/target/i386/Makefile.objs @@ -12,10 +12,10 @@ obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o ifeq ($(CONFIG_WIN32),y) obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o endif -ifeq ($(CONFIG_DARWIN),y) -obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o -obj-$(CONFIG_HVF) += hvf/ +ifeq ($(CONFIG_POSIX),y) +obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-posix.o endif +obj-$(CONFIG_HVF) += hvf/ obj-$(CONFIG_WHPX) += whpx-all.o endif obj-$(CONFIG_SEV) += sev.o diff --git a/target/i386/hax-i386.h b/target/i386/hax-i386.h index 6abc156f88..f13fa4638f 100644 --- a/target/i386/hax-i386.h +++ b/target/i386/hax-i386.h @@ -16,7 +16,7 @@ #include "cpu.h" #include "sysemu/hax.h" -#ifdef CONFIG_DARWIN +#ifdef CONFIG_POSIX typedef int hax_fd; #endif @@ -82,8 +82,8 @@ hax_fd hax_mod_open(void); void hax_memory_init(void); -#ifdef CONFIG_DARWIN -#include "target/i386/hax-darwin.h" +#ifdef CONFIG_POSIX +#include "target/i386/hax-posix.h" #endif #ifdef CONFIG_WIN32 diff --git a/target/i386/hax-darwin.c b/target/i386/hax-posix.c similarity index 100% rename from target/i386/hax-darwin.c rename to target/i386/hax-posix.c diff --git a/target/i386/hax-darwin.h b/target/i386/hax-posix.h similarity index 100% rename from target/i386/hax-darwin.h rename to target/i386/hax-posix.h From patchwork Mon Dec 17 23:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014867 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jctj5jWQz9s2P for ; Tue, 18 Dec 2018 10:34:21 +1100 (AEDT) Received: from localhost ([::1]:50530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Ox-0004hk-91 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:34:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28s-0000XT-B1 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28p-0003lI-Lq for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44244) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28p-0003gH-BL for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82A38C0495BF for ; Mon, 17 Dec 2018 23:17:31 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCC365D9C5; Mon, 17 Dec 2018 23:17:27 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:37 +0100 Message-Id: <20181217231700.24482-13-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Dec 2018 23:17:31 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 12/35] block/iscsi: drop unused IscsiAIOCB->buf field X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi The IscsiAIOCB->buf field has not been used since commit e49ab19fcaa617ad6cdfe1ac401327326b6a2552 ("block/iscsi: bump libiscsi requirement to 1.9.0"). It used to be a linear buffer for old libiscsi versions that didn't support scatter-gather. The minimum libiscsi version supports scatter-gather so we don't linearize buffers anymore. Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-2-stefanha@redhat.com> Reviewed-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- block/iscsi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 727dee50bf..a4e3730a82 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -117,7 +117,6 @@ typedef struct IscsiAIOCB { QEMUBH *bh; IscsiLun *iscsilun; struct scsi_task *task; - uint8_t *buf; int status; int64_t sector_num; int nb_sectors; @@ -150,9 +149,6 @@ iscsi_bh_cb(void *p) qemu_bh_delete(acb->bh); - g_free(acb->buf); - acb->buf = NULL; - acb->common.cb(acb->common.opaque, acb->status); if (acb->task != NULL) { @@ -933,9 +929,6 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, { IscsiAIOCB *acb = opaque; - g_free(acb->buf); - acb->buf = NULL; - acb->status = 0; if (status < 0) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s", @@ -1010,7 +1003,6 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->iscsilun = iscsilun; acb->bh = NULL; acb->status = -EINPROGRESS; - acb->buf = NULL; acb->ioh = buf; if (req != SG_IO) { From patchwork Mon Dec 17 23:16:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JchP3sDyz9s2P for ; Tue, 18 Dec 2018 10:25:25 +1100 (AEDT) Received: from localhost ([::1]:50486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2GJ-0005wx-27 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:25:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28q-0000VT-6A for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28p-0003kn-B4 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60822) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28n-0003hx-5P for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54A1890902 for ; Mon, 17 Dec 2018 23:17:33 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBDAB5D9C5; Mon, 17 Dec 2018 23:17:31 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:38 +0100 Message-Id: <20181217231700.24482-14-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Dec 2018 23:17:33 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 13/35] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use aio_context_acquire/release") introduced iscsilun->mutex but appears to have overlooked iscsi_timed_check_events() when introducing the mutex. iscsi_service() and iscsi_set_events() must be called with iscsilun->mutex held. iscsi_timed_check_events() is invoked from the AioContext and does not take the mutex. Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-3-stefanha@redhat.com> Reviewed-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- block/iscsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index a4e3730a82..1924a2b58e 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -344,6 +344,8 @@ static void iscsi_timed_check_events(void *opaque) { IscsiLun *iscsilun = opaque; + qemu_mutex_lock(&iscsilun->mutex); + /* check for timed out requests */ iscsi_service(iscsilun->iscsi, 0); @@ -356,6 +358,8 @@ static void iscsi_timed_check_events(void *opaque) * to return to service once this situation changes. */ iscsi_set_events(iscsilun); + qemu_mutex_unlock(&iscsilun->mutex); + timer_mod(iscsilun->event_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL); } From patchwork Mon Dec 17 23:16:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014861 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcm168hhz9s2P for ; Tue, 18 Dec 2018 10:28:33 +1100 (AEDT) Received: from localhost ([::1]:50505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2JL-0008SY-BY for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:28:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28r-0000Wr-Pu for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28p-0003lN-MH for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39260) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28p-0003jI-8U for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DF8516972A; Mon, 17 Dec 2018 23:17:36 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3BD155D9C8; Mon, 17 Dec 2018 23:17:33 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:39 +0100 Message-Id: <20181217231700.24482-15-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Dec 2018 23:17:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 14/35] block/iscsi: fix ioctl cancel use-after-free X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sreejith Mohanan , Stefan Hajnoczi , Felipe Franciosi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi iscsi_aio_cancel() does not increment the request's reference count, causing a use-after-free when ABORT TASK finishes after the request has already completed. There are some additional issues with iscsi_aio_cancel(): 1. Several ABORT TASKs may be sent for the same task if iscsi_aio_cancel() is invoked multiple times. It's better to avoid this just in case the command identifier is reused. 2. The iscsilun->mutex protection is missing in iscsi_aio_cancel(). Reported-by: Felipe Franciosi Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-4-stefanha@redhat.com> Reviewed-by: Felipe Franciosi Tested-by: Sreejith Mohanan Signed-off-by: Paolo Bonzini --- block/iscsi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 1924a2b58e..abb872d3d9 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -124,6 +124,7 @@ typedef struct IscsiAIOCB { #ifdef __linux__ sg_io_hdr_t *ioh; #endif + bool cancelled; } IscsiAIOCB; /* libiscsi uses time_t so its enough to process events every second */ @@ -287,6 +288,7 @@ static void iscsi_co_init_iscsitask(IscsiLun *iscsilun, struct IscsiTask *iTask) }; } +/* Called (via iscsi_service) with QemuMutex held. */ static void iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, void *private_data) @@ -295,6 +297,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, acb->status = -ECANCELED; iscsi_schedule_bh(acb); + qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */ } static void @@ -303,14 +306,25 @@ iscsi_aio_cancel(BlockAIOCB *blockacb) IscsiAIOCB *acb = (IscsiAIOCB *)blockacb; IscsiLun *iscsilun = acb->iscsilun; - if (acb->status != -EINPROGRESS) { + qemu_mutex_lock(&iscsilun->mutex); + + /* If it was cancelled or completed already, our work is done here */ + if (acb->cancelled || acb->status != -EINPROGRESS) { + qemu_mutex_unlock(&iscsilun->mutex); return; } + acb->cancelled = true; + + qemu_aio_ref(acb); /* released in iscsi_abort_task_cb() */ + /* send a task mgmt call to the target to cancel the task on the target */ - iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task, - iscsi_abort_task_cb, acb); + if (iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task, + iscsi_abort_task_cb, acb) < 0) { + qemu_aio_unref(acb); /* since iscsi_abort_task_cb() won't be called */ + } + qemu_mutex_unlock(&iscsilun->mutex); } static const AIOCBInfo iscsi_aiocb_info = { @@ -1008,6 +1022,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->bh = NULL; acb->status = -EINPROGRESS; acb->ioh = buf; + acb->cancelled = false; if (req != SG_IO) { iscsi_ioctl_handle_emulated(acb, req, buf); From patchwork Mon Dec 17 23:16:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014865 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcqn5yGYz9s4s for ; Tue, 18 Dec 2018 10:31:49 +1100 (AEDT) Received: from localhost ([::1]:50523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2MV-0002ot-9g for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:31:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28t-0000Yc-DF for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28p-0003lT-Mx for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44264) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28p-0003ji-CY for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:39 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 33F50C049581 for ; Mon, 17 Dec 2018 23:17:38 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3C5D5D9C5; Mon, 17 Dec 2018 23:17:36 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:40 +0100 Message-Id: <20181217231700.24482-16-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Dec 2018 23:17:38 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 15/35] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi The libiscsi iscsi_task_mgmt_async() API documentation says: abort_task will also cancel the scsi task. The callback for the scsi task will be invoked with SCSI_STATUS_CANCELLED The libiscsi implementation does not fulfil this promise. The task's callback is not invoked and its struct iscsi_pdu remains in the internal list (effectively leaked). This patch invokes the libiscsi iscsi_scsi_cancel_task() API to force the task's callback to be invoked with SCSI_STATUS_CANCELLED when the ABORT TASK TMF completes and the task's callback hasn't been invoked yet. Signed-off-by: Stefan Hajnoczi Message-Id: <20180215111526.2464-1-stefanha@redhat.com> Signed-off-by: Paolo Bonzini --- block/iscsi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index abb872d3d9..a7e8c1ffaf 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -295,8 +295,12 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, { IscsiAIOCB *acb = private_data; - acb->status = -ECANCELED; - iscsi_schedule_bh(acb); + /* If the command callback hasn't been called yet, drop the task */ + if (!acb->bh) { + /* Call iscsi_aio_ioctl_cb() with SCSI_STATUS_CANCELLED */ + iscsi_scsi_cancel_task(iscsi, acb->task); + } + qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */ } @@ -947,6 +951,14 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, { IscsiAIOCB *acb = opaque; + if (status == SCSI_STATUS_CANCELLED) { + if (!acb->bh) { + acb->status = -ECANCELED; + iscsi_schedule_bh(acb); + } + return; + } + acb->status = 0; if (status < 0) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s", From patchwork Mon Dec 17 23:16:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014869 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcvD4qTfz9s2P for ; Tue, 18 Dec 2018 10:34:48 +1100 (AEDT) Received: from localhost ([::1]:50533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2PO-00057q-5S for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:34:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28r-0000Wl-Mh for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28q-0003mh-O7 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39274) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28q-0003lo-E6 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:40 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B40EC432B9; Mon, 17 Dec 2018 23:17:39 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97A505D9C8; Mon, 17 Dec 2018 23:17:38 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:41 +0100 Message-Id: <20181217231700.24482-17-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Dec 2018 23:17:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 16/35] esp-pci: Fix status register write erase control X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guenter Roeck Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Guenter Roeck Per AM53C974 datasheet, definition of "SCSI Bus and Control (SBAC)" register: Bit 24 'STATUS' Write Erase Control This bit controls the Write Erase feature on bits 3:1 and bit 6 of the DMA Status Register ((B)+54h). When this bit is programmed to '1', the state of bits 3:1 are preserved when read. Bits 3:1 are only cleared when a '1' is written to the corresponding bit location. For example, to clear bit 1, the value of '0000_0010b' should be written to the register. When the DMA Status Preserve bit is '0', bits 3:1 are cleared when read. The status register is currently defined to bit 12, not bit 24. Also, its implementation is reversed: The status is auto-cleared if the bit is set to 1, and must be cleared explicitly when the bit is set to 0. This results in spurious interrupts reported by the Linux kernel, and in some cases even results in stalled SCSI operations. Set SBAC_STATUS to bit 24 and reverse the logic to fix the problem. Signed-off-by: Guenter Roeck Message-Id: <1543442171-24863-1-git-send-email-linux@roeck-us.net> Signed-off-by: Paolo Bonzini --- hw/scsi/esp-pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 419fc668ac..d956909186 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -59,7 +59,7 @@ #define DMA_STAT_SCSIINT 0x10 #define DMA_STAT_BCMBLT 0x20 -#define SBAC_STATUS 0x1000 +#define SBAC_STATUS (1 << 24) typedef struct PCIESPState { /*< private >*/ @@ -136,7 +136,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val) pci->dma_regs[saddr] = val; break; case DMA_STAT: - if (!(pci->sbac & SBAC_STATUS)) { + if (pci->sbac & SBAC_STATUS) { /* clear some bits on write */ uint32_t mask = DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE; pci->dma_regs[DMA_STAT] &= ~(val & mask); @@ -157,7 +157,7 @@ static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr) if (pci->esp.rregs[ESP_RSTAT] & STAT_INT) { val |= DMA_STAT_SCSIINT; } - if (pci->sbac & SBAC_STATUS) { + if (!(pci->sbac & SBAC_STATUS)) { pci->dma_regs[DMA_STAT] &= ~(DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE); } From patchwork Mon Dec 17 23:16:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcyn2dxrz9s4s for ; Tue, 18 Dec 2018 10:37:53 +1100 (AEDT) Received: from localhost ([::1]:50552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2SM-0007jC-T0 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:37:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28t-0000ZG-U0 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28s-0003nb-Fv for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44736) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28r-0003mw-VC for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:42 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44CF0C050DFB; Mon, 17 Dec 2018 23:17:41 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 281255D9C5; Mon, 17 Dec 2018 23:17:39 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:42 +0100 Message-Id: <20181217231700.24482-18-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Dec 2018 23:17:41 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 17/35] scsi: esp: Defer command completion until previous interrupts have been handled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guenter Roeck Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Guenter Roeck The guest OS reads RSTAT, RSEQ, and RINTR, and expects those registers to reflect a consistent state. However, it is possible that the registers can change after RSTAT was read, but before RINTR is read, when esp_command_complete() is called. Guest OS qemu -------- ---- [handle interrupt] Read RSTAT esp_command_complete() RSTAT = STAT_ST esp_dma_done() RSTAT |= STAT_TC RSEQ = 0 RINTR = INTR_BS Read RSEQ Read RINTR RINTR = 0 RSTAT &= ~STAT_TC RSEQ = SEQ_CD The guest OS would then try to handle INTR_BS combined with an old value of RSTAT. This sometimes resulted in lost events, spurious interrupts, guest OS confusion, and stalled SCSI operations. A typical guest error log (observed with various versions of Linux) looks as follows. scsi host1: Spurious irq, sreg=13. ... scsi host1: Aborting command [84531f10:2a] scsi host1: Current command [f882eea8:35] scsi host1: Queued command [84531f10:2a] scsi host1: Active command [f882eea8:35] scsi host1: Dumping command log scsi host1: ent[15] CMD val[44] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[00] event[0c] scsi host1: ent[16] CMD val[01] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[17] CMD val[43] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[18] EVENT val[0d] sreg[92] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c] ... Defer handling command completion until previous interrupts have been handled to fix the problem. Signed-off-by: Guenter Roeck --- hw/scsi/esp-pci.c | 4 ++-- hw/scsi/esp.c | 33 ++++++++++++++++++++++++++------- hw/scsi/trace-events | 1 + include/hw/scsi/esp.h | 2 ++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index d956909186..6b0bbb9b7f 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -313,8 +313,8 @@ static void esp_pci_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_esp_pci_scsi = { .name = "pciespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PCIESPState), VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)), diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 630d923623..ca8b36c0c5 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -286,11 +286,8 @@ static void esp_do_dma(ESPState *s) esp_dma_done(s); } -void esp_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +static void esp_report_command_complete(ESPState *s, uint32_t status) { - ESPState *s = req->hba_private; - trace_esp_command_complete(); if (s->ti_size != 0) { trace_esp_command_complete_unexpected(); @@ -311,6 +308,23 @@ void esp_command_complete(SCSIRequest *req, uint32_t status, } } +void esp_command_complete(SCSIRequest *req, uint32_t status, + size_t resid) +{ + ESPState *s = req->hba_private; + + if (s->rregs[ESP_RSTAT] & STAT_INT) { + /* Defer handling command complete until the previous + * interrupt has been handled. + */ + trace_esp_command_complete_deferred(); + s->deferred_status = status; + s->deferred_complete = true; + return; + } + esp_report_command_complete(s, status); +} + void esp_transfer_data(SCSIRequest *req, uint32_t len) { ESPState *s = req->hba_private; @@ -422,7 +436,10 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) s->rregs[ESP_RSTAT] &= ~STAT_TC; s->rregs[ESP_RSEQ] = SEQ_CD; esp_lower_irq(s); - + if (s->deferred_complete) { + esp_report_command_complete(s, s->deferred_status); + s->deferred_complete = false; + } return old_val; case ESP_TCHI: /* Return the unique id if the value has never been written */ @@ -582,6 +599,8 @@ const VMStateDescription vmstate_esp = { VMSTATE_UINT32(ti_wptr, ESPState), VMSTATE_BUFFER(ti_buf, ESPState), VMSTATE_UINT32(status, ESPState), + VMSTATE_UINT32(deferred_status, ESPState), + VMSTATE_BOOL(deferred_complete, ESPState), VMSTATE_UINT32(dma, ESPState), VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16), VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4), @@ -671,8 +690,8 @@ static void sysbus_esp_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_sysbus_esp_scsi = { .name = "sysbusespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState), VMSTATE_END_OF_LIST() diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 0fb6a99616..2fe8a7c062 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -167,6 +167,7 @@ esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d" esp_write_response(uint32_t status) "Transfer status (status=%d)" esp_do_dma(uint32_t cmdlen, uint32_t len) "command len %d + %d" esp_command_complete(void) "SCSI Command complete" +esp_command_complete_deferred(void) "SCSI Command complete deferred" esp_command_complete_unexpected(void) "SCSI command completed unexpectedly" esp_command_complete_fail(void) "Command failed" esp_transfer_data(uint32_t dma_left, int32_t ti_size) "transfer %d/%d" diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 682a0d2de0..adab63d1c9 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -23,6 +23,8 @@ struct ESPState { int32_t ti_size; uint32_t ti_rptr, ti_wptr; uint32_t status; + uint32_t deferred_status; + bool deferred_complete; uint32_t dma; uint8_t ti_buf[TI_BUFSZ]; SCSIBus bus; From patchwork Mon Dec 17 23:16:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcsR1lDBz9s2P for ; Tue, 18 Dec 2018 10:33:15 +1100 (AEDT) Received: from localhost ([::1]:50527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Ns-0003sx-Qg for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:33:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28x-0000cm-Am for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28v-0003qH-Rm for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28v-0003pZ-J2 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:45 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E103389AF5 for ; Mon, 17 Dec 2018 23:17:44 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC64E5D9C5; Mon, 17 Dec 2018 23:17:41 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:43 +0100 Message-Id: <20181217231700.24482-19-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Dec 2018 23:17:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 18/35] build-sys: don't include windows.h, osdep.h does it X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau osdep.h will also define the available Windows API version for QEMU. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/tcg/translate-all.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 639f0b2728..8cb8c8870e 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -16,12 +16,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#ifdef _WIN32 -#include -#endif #include "qemu/osdep.h" - #include "qemu-common.h" #define NO_CPU_IO_DEFS #include "cpu.h" From patchwork Mon Dec 17 23:16:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014878 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd2M2tG1z9s2P for ; Tue, 18 Dec 2018 10:40:59 +1100 (AEDT) Received: from localhost ([::1]:50568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2VM-0001xn-Pt for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:40:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ28y-0000ds-G3 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28x-0003r5-Gg for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56056) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28x-0003qe-9M for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:47 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 91ACE821CB for ; Mon, 17 Dec 2018 23:17:46 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F6E45D9C5; Mon, 17 Dec 2018 23:17:45 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:44 +0100 Message-Id: <20181217231700.24482-20-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Dec 2018 23:17:46 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 19/35] build-sys: move windows defines in osdep.h header X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau This removes some clutter in compilation logging, and allows some easier tweaking per compilation unit/CFLAGS overriding. Note that we can't move those define in os-win32.h, since they must be set before the first system headers are included. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 3 --- include/qemu/osdep.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 0886f45bf4..b4f7279f4d 100755 --- a/configure +++ b/configure @@ -905,9 +905,6 @@ fi if test "$mingw32" = "yes" ; then EXESUF=".exe" DSOSUF=".dll" - QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" - # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) - QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" # MinGW needs -mthreads for TLS and macro _MT. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 3bf48bcdec..7b6e5db9d0 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -74,13 +74,30 @@ typedef __float128 _Float128; extern int daemon(int, int); #endif +#ifdef _WIN32 +/* as defined in sdkddkver.h */ +#ifndef WINVER +#define WINVER 0x0501 /* XP */ +#endif +/* reduces the number of implicitly included headers */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#endif + #include #include #include #include #include #include + +/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */ +#ifdef __MINGW32__ +#define __USE_MINGW_ANSI_STDIO 1 +#endif #include + #include #include #include From patchwork Mon Dec 17 23:16:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcyM5RTBz9s4s for ; Tue, 18 Dec 2018 10:37:31 +1100 (AEDT) Received: from localhost ([::1]:50550 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2S1-0007QJ-8c for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:37:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ290-0000fP-4U for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ28z-0003sI-6f for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60900) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ28y-0003rg-Tz for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:49 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 284A523E6C1 for ; Mon, 17 Dec 2018 23:17:48 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 080E15D9C5; Mon, 17 Dec 2018 23:17:46 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:45 +0100 Message-Id: <20181217231700.24482-21-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Dec 2018 23:17:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 20/35] build-sys: build with Vista API by default X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Both qemu & qga build with Vista API by default already, by defining _WIN32_WINNT 0x0600. Set it globally in osdep.h instead. This replaces WINVER by _WIN32_WINNT in osdep.h. WINVER doesn't seem to be really useful these days. (see also https://blogs.msdn.microsoft.com/oldnewthing/20070411-00/?p=27283) Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/osdep.h | 4 ++-- qga/commands-win32.c | 6 +----- util/qemu-thread-win32.c | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 7b6e5db9d0..80df7253db 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -76,8 +76,8 @@ extern int daemon(int, int); #ifdef _WIN32 /* as defined in sdkddkver.h */ -#ifndef WINVER -#define WINVER 0x0501 /* XP */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 /* Vista */ #endif /* reduces the number of implicitly included headers */ #ifndef WIN32_LEAN_AND_MEAN diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 62e1b51dfe..f03b9c1d89 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -10,12 +10,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -#endif - #include "qemu/osdep.h" + #include #include #include diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 4a363ca675..572f88535d 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -11,10 +11,6 @@ * */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/thread.h" From patchwork Mon Dec 17 23:16:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014877 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd1y3f32z9s4s for ; Tue, 18 Dec 2018 10:40:38 +1100 (AEDT) Received: from localhost ([::1]:50563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2V1-0001f0-Pc for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:40:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ292-0000hG-3E for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ290-0003t5-TB for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54724) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ290-0003se-KL for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:50 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDED27FDE5 for ; Mon, 17 Dec 2018 23:17:49 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 91A015D9C5; Mon, 17 Dec 2018 23:17:48 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:46 +0100 Message-Id: <20181217231700.24482-22-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Dec 2018 23:17:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 21/35] qga: drop < Vista compatibility X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Marc-André Lureau Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building qemu-thread-win32.c, which requires Vista API since commit 12f8def0 (v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- qga/commands-win32.c | 64 -------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index f03b9c1d89..989b93e702 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -466,13 +466,11 @@ static STORAGE_BUS_TYPE win2qemu[] = { [BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA, [BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB, [BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID, -#if (_WIN32_WINNT >= 0x0600) [BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI, [BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS, [BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA, [BusTypeSd] = GUEST_DISK_BUS_TYPE_SD, [BusTypeMmc] = GUEST_DISK_BUS_TYPE_MMC, -#endif #if (_WIN32_WINNT >= 0x0601) [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL, [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL, @@ -724,10 +722,8 @@ static void get_single_disk_info(GuestDiskAddress *disk, Error **errp) if (disk->bus_type == GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE || disk->bus_type == GUEST_DISK_BUS_TYPE_RAID -#if (_WIN32_WINNT >= 0x0600) /* This bus type is not supported before Windows Server 2003 SP1 */ || disk->bus_type == GUEST_DISK_BUS_TYPE_SAS -#endif ) { /* We are able to use the same ioctls for different bus types * according to Microsoft docs @@ -1322,7 +1318,6 @@ static char *guest_addr_to_str(IP_ADAPTER_UNICAST_ADDRESS *ip_addr, return NULL; } -#if (_WIN32_WINNT >= 0x0600) static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) { /* For Windows Vista/2008 and newer, use the OnLinkPrefixLength @@ -1330,60 +1325,6 @@ static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) */ return ip_addr->OnLinkPrefixLength; } -#else -/* When using the Windows XP and 2003 build environment, do the best we can to - * figure out the prefix. - */ -static IP_ADAPTER_INFO *guest_get_adapters_info(void) -{ - IP_ADAPTER_INFO *adptr_info = NULL; - ULONG adptr_info_len = 0; - DWORD ret; - - /* Call the first time to get the adptr_info_len. */ - GetAdaptersInfo(adptr_info, &adptr_info_len); - - adptr_info = g_malloc(adptr_info_len); - ret = GetAdaptersInfo(adptr_info, &adptr_info_len); - if (ret != ERROR_SUCCESS) { - g_free(adptr_info); - adptr_info = NULL; - } - return adptr_info; -} - -static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) -{ - int64_t prefix = -1; /* Use for AF_INET6 and unknown/undetermined values. */ - IP_ADAPTER_INFO *adptr_info, *info; - IP_ADDR_STRING *ip; - struct in_addr *p; - - if (ip_addr->Address.lpSockaddr->sa_family != AF_INET) { - return prefix; - } - adptr_info = guest_get_adapters_info(); - if (adptr_info == NULL) { - return prefix; - } - - /* Match up the passed in ip_addr with one found in adaptr_info. - * The matching one in adptr_info will have the netmask. - */ - p = &((struct sockaddr_in *)ip_addr->Address.lpSockaddr)->sin_addr; - for (info = adptr_info; info; info = info->Next) { - for (ip = &info->IpAddressList; ip; ip = ip->Next) { - if (p->S_un.S_addr == inet_addr(ip->IpAddress.String)) { - prefix = ctpop32(inet_addr(ip->IpMask.String)); - goto out; - } - } - } -out: - g_free(adptr_info); - return prefix; -} -#endif #define INTERFACE_PATH_BUF_SZ 512 @@ -1904,7 +1845,6 @@ typedef struct _GA_WTSINFOA { GuestUserList *qmp_guest_get_users(Error **err) { -#if (_WIN32_WINNT >= 0x0600) #define QGA_NANOSECONDS 10000000 GHashTable *cache = NULL; @@ -1974,10 +1914,6 @@ GuestUserList *qmp_guest_get_users(Error **err) } g_hash_table_destroy(cache); return head; -#else - error_setg(err, QERR_UNSUPPORTED); - return NULL; -#endif } typedef struct _ga_matrix_lookup_t { From patchwork Mon Dec 17 23:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014872 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JcxG5D7mz9s2P for ; Tue, 18 Dec 2018 10:36:34 +1100 (AEDT) Received: from localhost ([::1]:50547 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2R6-0006gR-5l for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:36:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ293-0000hq-KH for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ292-0003tz-OZ for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33265) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ292-0003tc-HY for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:52 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D879281DE1 for ; Mon, 17 Dec 2018 23:17:51 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52BE35D9C5; Mon, 17 Dec 2018 23:17:50 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:47 +0100 Message-Id: <20181217231700.24482-23-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 23:17:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 22/35] test: execute g_test_run when tests are skipped X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped. Signed-off-by: Paolo Bonzini Message-Id: <1543513531-1151-2-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- tests/cdrom-test.c | 2 +- tests/migration-test.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cdrom-test.c b/tests/cdrom-test.c index 9b43dc9ab4..14bd981336 100644 --- a/tests/cdrom-test.c +++ b/tests/cdrom-test.c @@ -169,7 +169,7 @@ int main(int argc, char **argv) if (exec_genisoimg(genisocheck)) { /* genisoimage not available - so can't run tests */ - return 0; + return g_test_run(); } ret = prepare_image(arch, isoimage); diff --git a/tests/migration-test.c b/tests/migration-test.c index 06ca5068d8..8352612364 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -789,7 +789,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); if (!ufd_version_check()) { - return 0; + return g_test_run(); } /* @@ -800,7 +800,7 @@ int main(int argc, char **argv) if (g_str_equal(qtest_get_arch(), "ppc64") && access("/sys/module/kvm_hv", F_OK)) { g_test_message("Skipping test: kvm_hv not available"); - return 0; + return g_test_run(); } /* @@ -811,11 +811,11 @@ int main(int argc, char **argv) #if defined(HOST_S390X) if (access("/dev/kvm", R_OK | W_OK)) { g_test_message("Skipping test: kvm not available"); - return 0; + return g_test_run(); } #else g_test_message("Skipping test: Need s390x host to work properly"); - return 0; + return g_test_run(); #endif } From patchwork Mon Dec 17 23:16:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014882 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd5D2xvxz9s2P for ; Tue, 18 Dec 2018 10:43:27 +1100 (AEDT) Received: from localhost ([::1]:50581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Xl-00043h-0u for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:43:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ297-0000oD-F0 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ294-0003uw-S2 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44814) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ294-0003uW-IN for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:54 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCF00C0601ED for ; Mon, 17 Dec 2018 23:17:53 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 546F25D9C8; Mon, 17 Dec 2018 23:17:52 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:48 +0100 Message-Id: <20181217231700.24482-24-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Dec 2018 23:17:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 23/35] test: replace gtester with a TAP driver X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases. glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl. Signed-off-by: Paolo Bonzini Message-Id: <1543513531-1151-3-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- scripts/gtester-cat | 26 -- scripts/tap-driver.pl | 378 +++++++++++++++++++ scripts/tap-merge.pl | 110 ++++++ tests/Makefile.include | 54 +-- tests/docker/dockerfiles/centos7.docker | 1 + tests/docker/dockerfiles/debian-amd64.docker | 1 + tests/docker/dockerfiles/debian-ports.docker | 1 + tests/docker/dockerfiles/debian-sid.docker | 1 + tests/docker/dockerfiles/debian8.docker | 1 + tests/docker/dockerfiles/debian9.docker | 1 + tests/docker/dockerfiles/fedora.docker | 1 + tests/docker/dockerfiles/ubuntu.docker | 1 + 12 files changed, 529 insertions(+), 47 deletions(-) delete mode 100755 scripts/gtester-cat create mode 100755 scripts/tap-driver.pl create mode 100755 scripts/tap-merge.pl diff --git a/scripts/gtester-cat b/scripts/gtester-cat deleted file mode 100755 index 061a952cad..0000000000 --- a/scripts/gtester-cat +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright IBM, Corp. 2012 -# -# Authors: -# Anthony Liguori -# -# This work is licensed under the terms of the GNU GPLv2 or later. -# See the COPYING file in the top-level directory. - -cat < - - - qemu - 0.0 - rev - -EOF - -sed \ - -e '/$/d' \ - -e '//,/<\/info>/d' \ - -e '$b' \ - -e '/^<\/gtester>$/d' "$@" diff --git a/scripts/tap-driver.pl b/scripts/tap-driver.pl new file mode 100755 index 0000000000..5e59b5db49 --- /dev/null +++ b/scripts/tap-driver.pl @@ -0,0 +1,378 @@ +#! /usr/bin/env perl +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# ---------------------------------- # +# Imports, static data, and setup. # +# ---------------------------------- # + +use warnings FATAL => 'all'; +use strict; +use Getopt::Long (); +use TAP::Parser; +use Term::ANSIColor qw(:constants); + +my $ME = "tap-driver.pl"; +my $VERSION = "2018-11-30"; + +my $USAGE = <<'END'; +Usage: + tap-driver [--test-name=TEST] [--color={always|never|auto}] + [--verbose] [--show-failures-only] +END + +my $HELP = "$ME: TAP-aware test driver for QEMU testsuite harness." . + "\n" . $USAGE; + +# It's important that NO_PLAN evaluates "false" as a boolean. +use constant NO_PLAN => 0; +use constant EARLY_PLAN => 1; +use constant LATE_PLAN => 2; + +use constant DIAG_STRING => "#"; + +# ------------------- # +# Global variables. # +# ------------------- # + +my $testno = 0; # Number of test results seen so far. +my $bailed_out = 0; # Whether a "Bail out!" directive has been seen. +my $failed = 0; # Final exit code + +# Whether the TAP plan has been seen or not, and if yes, which kind +# it is ("early" is seen before any test result, "late" otherwise). +my $plan_seen = NO_PLAN; + +# ----------------- # +# Option parsing. # +# ----------------- # + +my %cfg = ( + "color" => 0, + "verbose" => 0, + "show-failures-only" => 0, +); + +my $color = "auto"; +my $test_name = undef; + +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + +Getopt::Long::GetOptions + ( + 'help' => sub { print $HELP; exit 0; }, + 'version' => sub { print "$ME $VERSION\n"; exit 0; }, + 'test-name=s' => \$test_name, + 'color=s' => \$color, + 'show-failures-only' => sub { $cfg{"show-failures-only"} = 1; }, + 'verbose' => sub { $cfg{"verbose"} = 1; }, + ) or exit 1; + +if ($color =~ /^always$/i) { + $cfg{'color'} = 1; +} elsif ($color =~ /^never$/i) { + $cfg{'color'} = 0; +} elsif ($color =~ /^auto$/i) { + $cfg{'color'} = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + +# ------------- # +# Prototypes. # +# ------------- # + +sub colored ($$); +sub decorate_result ($); +sub extract_tap_comment ($); +sub handle_tap_bailout ($); +sub handle_tap_plan ($); +sub handle_tap_result ($); +sub is_null_string ($); +sub main (); +sub report ($;$); +sub stringify_result_obj ($); +sub testsuite_error ($); + +# -------------- # +# Subroutines. # +# -------------- # + +# If the given string is undefined or empty, return true, otherwise +# return false. This function is useful to avoid pitfalls like: +# if ($message) { print "$message\n"; } +# which wouldn't print anything if $message is the literal "0". +sub is_null_string ($) +{ + my $str = shift; + return ! (defined $str and length $str); +} + +sub stringify_result_obj ($) +{ + my $result_obj = shift; + if ($result_obj->is_unplanned || $result_obj->number != $testno) + { + return "ERROR"; + } + elsif ($plan_seen == LATE_PLAN) + { + return "ERROR"; + } + elsif (!$result_obj->directive) + { + return $result_obj->is_ok ? "PASS" : "FAIL"; + } + elsif ($result_obj->has_todo) + { + return $result_obj->is_actual_ok ? "XPASS" : "XFAIL"; + } + elsif ($result_obj->has_skip) + { + return $result_obj->is_ok ? "SKIP" : "FAIL"; + } + die "$ME: INTERNAL ERROR"; # NOTREACHED +} + +sub colored ($$) +{ + my ($color_string, $text) = @_; + return $color_string . $text . RESET; +} + +sub decorate_result ($) +{ + my $result = shift; + return $result unless $cfg{"color"}; + my %color_for_result = + ( + "ERROR" => BOLD.MAGENTA, + "PASS" => GREEN, + "XPASS" => BOLD.YELLOW, + "FAIL" => BOLD.RED, + "XFAIL" => YELLOW, + "SKIP" => BLUE, + ); + if (my $color = $color_for_result{$result}) + { + return colored ($color, $result); + } + else + { + return $result; # Don't colorize unknown stuff. + } +} + +sub report ($;$) +{ + my ($msg, $result, $explanation) = (undef, @_); + if ($result =~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/) + { + # Output on console might be colorized. + $msg = decorate_result($result); + if ($result =~ /^(?:PASS|XFAIL|SKIP)/) + { + return if $cfg{"show-failures-only"}; + } + else + { + $failed = 1; + } + } + elsif ($result eq "#") + { + $msg = " "; + } + else + { + die "$ME: INTERNAL ERROR"; # NOTREACHED + } + $msg .= " $explanation" if defined $explanation; + print $msg . "\n"; +} + +sub testsuite_error ($) +{ + report "ERROR", "- $_[0]"; +} + +sub handle_tap_result ($) +{ + $testno++; + my $result_obj = shift; + + my $test_result = stringify_result_obj $result_obj; + my $string = $result_obj->number; + + my $description = $result_obj->description; + $string .= " $test_name" unless is_null_string $test_name; + $string .= " $description" unless is_null_string $description; + + if ($plan_seen == LATE_PLAN) + { + $string .= " # AFTER LATE PLAN"; + } + elsif ($result_obj->is_unplanned) + { + $string .= " # UNPLANNED"; + } + elsif ($result_obj->number != $testno) + { + $string .= " # OUT-OF-ORDER (expecting $testno)"; + } + elsif (my $directive = $result_obj->directive) + { + $string .= " # $directive"; + my $explanation = $result_obj->explanation; + $string .= " $explanation" + unless is_null_string $explanation; + } + + report $test_result, $string; +} + +sub handle_tap_plan ($) +{ + my $plan = shift; + if ($plan_seen) + { + # Error, only one plan per stream is acceptable. + testsuite_error "multiple test plans"; + return; + } + # The TAP plan can come before or after *all* the TAP results; we speak + # respectively of an "early" or a "late" plan. If we see the plan line + # after at least one TAP result has been seen, assume we have a late + # plan; in this case, any further test result seen after the plan will + # be flagged as an error. + $plan_seen = ($testno >= 1 ? LATE_PLAN : EARLY_PLAN); + # If $testno > 0, we have an error ("too many tests run") that will be + # automatically dealt with later, so don't worry about it here. If + # $plan_seen is true, we have an error due to a repeated plan, and that + # has already been dealt with above. Otherwise, we have a valid "plan + # with SKIP" specification, and should report it as a particular kind + # of SKIP result. + if ($plan->directive && $testno == 0) + { + my $explanation = is_null_string ($plan->explanation) ? + undef : "- " . $plan->explanation; + report "SKIP", $explanation; + } +} + +sub handle_tap_bailout ($) +{ + my ($bailout, $msg) = ($_[0], "Bail out!"); + $bailed_out = 1; + $msg .= " " . $bailout->explanation + unless is_null_string $bailout->explanation; + testsuite_error $msg; +} + +sub extract_tap_comment ($) +{ + my $line = shift; + if (index ($line, DIAG_STRING) == 0) + { + # Strip leading `DIAG_STRING' from `$line'. + $line = substr ($line, length (DIAG_STRING)); + # And strip any leading and trailing whitespace left. + $line =~ s/(?:^\s*|\s*$)//g; + # Return what is left (if any). + return $line; + } + return ""; +} + +sub main () +{ + my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN); + my $parser = TAP::Parser->new ({iterator => $iterator }); + + while (defined (my $cur = $parser->next)) + { + # Parsing of TAP input should stop after a "Bail out!" directive. + next if $bailed_out; + + if ($cur->is_plan) + { + handle_tap_plan ($cur); + } + elsif ($cur->is_test) + { + handle_tap_result ($cur); + } + elsif ($cur->is_bailout) + { + handle_tap_bailout ($cur); + } + elsif ($cfg{"verbose"}) + { + my $comment = extract_tap_comment ($cur->raw); + report "#", "$comment" if length $comment; + } + } + # A "Bail out!" directive should cause us to ignore any following TAP + # error. + if (!$bailed_out) + { + if (!$plan_seen) + { + testsuite_error "missing test plan"; + } + elsif ($parser->tests_planned != $parser->tests_run) + { + my ($planned, $run) = ($parser->tests_planned, $parser->tests_run); + my $bad_amount = $run > $planned ? "many" : "few"; + testsuite_error (sprintf "too %s tests run (expected %d, got %d)", + $bad_amount, $planned, $run); + } + } +} + +# ----------- # +# Main code. # +# ----------- # + +main; +exit($failed); + +# Local Variables: +# perl-indent-level: 2 +# perl-continued-statement-offset: 2 +# perl-continued-brace-offset: 0 +# perl-brace-offset: 0 +# perl-brace-imaginary-offset: 0 +# perl-label-offset: -2 +# cperl-indent-level: 2 +# cperl-brace-offset: 0 +# cperl-continued-brace-offset: 0 +# cperl-label-offset: -2 +# cperl-extra-newline-before-brace: t +# cperl-merge-trailing-else: nil +# cperl-continued-statement-offset: 2 +# End: diff --git a/scripts/tap-merge.pl b/scripts/tap-merge.pl new file mode 100755 index 0000000000..59e3fa5007 --- /dev/null +++ b/scripts/tap-merge.pl @@ -0,0 +1,110 @@ +#! /usr/bin/env perl +# Copyright (C) 2018 Red Hat, Inc. +# +# Author: Paolo Bonzini +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ---------------------------------- # +# Imports, static data, and setup. # +# ---------------------------------- # + +use warnings FATAL => 'all'; +use strict; +use Getopt::Long (); +use TAP::Parser; + +my $ME = "tap-merge.pl"; +my $VERSION = "2018-11-30"; + +my $HELP = "$ME: merge multiple TAP inputs from stdin."; + +use constant DIAG_STRING => "#"; + +# ----------------- # +# Option parsing. # +# ----------------- # + +Getopt::Long::GetOptions + ( + 'help' => sub { print $HELP; exit 0; }, + 'version' => sub { print "$ME $VERSION\n"; exit 0; }, + ); + +# -------------- # +# Subroutines. # +# -------------- # + +sub main () +{ + my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN); + my $parser = TAP::Parser->new ({iterator => $iterator }); + my $testno = 0; # Number of test results seen so far. + my $bailed_out = 0; # Whether a "Bail out!" directive has been seen. + + while (defined (my $cur = $parser->next)) + { + if ($cur->is_bailout) + { + $bailed_out = 1; + print DIAG_STRING . " " . $cur->as_string . "\n"; + next; + } + elsif ($cur->is_plan) + { + $bailed_out = 0; + next; + } + elsif ($cur->is_test) + { + $bailed_out = 0 if $cur->number == 1; + $testno++; + $cur = TAP::Parser::Result::Test->new({ + ok => $cur->ok, + test_num => $testno, + directive => $cur->directive, + explanation => $cur->explanation, + description => $cur->description + }); + } + elsif ($cur->is_version) + { + next if $testno > 0; + } + print $cur->as_string . "\n" unless $bailed_out; + } + print "1..$testno\n"; +} + +# ----------- # +# Main code. # +# ----------- # + +main; + +# Local Variables: +# perl-indent-level: 2 +# perl-continued-statement-offset: 2 +# perl-continued-brace-offset: 0 +# perl-brace-offset: 0 +# perl-brace-imaginary-offset: 0 +# perl-label-offset: -2 +# cperl-indent-level: 2 +# cperl-brace-offset: 0 +# cperl-continued-brace-offset: 0 +# cperl-label-offset: -2 +# cperl-extra-newline-before-brace: t +# cperl-merge-trailing-else: nil +# cperl-continued-statement-offset: 2 +# End: diff --git a/tests/Makefile.include b/tests/Makefile.include index fb0b449c02..62915e4388 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -799,41 +799,53 @@ tests/test-qga$(EXESUF): qemu-ga$(EXESUF) tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y) SPEED = quick -GTESTER_OPTIONS = -k $(if $(V),--verbose,-q) -GCOV_OPTIONS = -n $(if $(V),-f,) # gtester tests, possibly with verbose output +# do_test_tap runs all tests, even if some of them fail, while do_test_human +# stops at the first failure unless -k is given on the command line + +do_test_human = \ + $(call quiet-command, rc=0; \ + { $(foreach COMMAND, $1, \ + MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ + $2 $(COMMAND) -m=$(SPEED) -k --tap \ + | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" --color=always $(if $(V),, --show-failures-only) \ + || $(if $(findstring k, $(MAKEFLAGS)), rc=$$?, exit $$?); ) }; exit $$rc, \ + "TEST", "$@") + +do_test_tap = \ + $(call quiet-command, \ + { $(foreach COMMAND, $1, \ + MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ + $2 $(COMMAND) -m=$(SPEED) -k --tap | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \ + | ./scripts/tap-merge.pl | tee "$@" \ + | ./scripts/tap-driver.pl --color=always $(if $(V),, --show-failures-only), \ + "TAP","$@") .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS)) $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y) - $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ - QTEST_QEMU_IMG=qemu-img$(EXESUF) \ - MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@") + $(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \ + QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ + QTEST_QEMU_IMG=qemu-img$(EXESUF)) .PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)) $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: % - $(call quiet-command, \ - MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*") + $(call do_test_human, $*) -# gtester tests with XML output +# gtester tests with TAP output -$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y) - $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ - QTEST_QEMU_IMG=qemu-img$(EXESUF) \ - gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@") +$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: $(check-qtest-y) + $(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \ + QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ + QTEST_QEMU_IMG=qemu-img$(EXESUF)) -check-report-unit.xml: $(check-unit-y) - $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^,"GTESTER","$@") +check-report-unit.tap: $(check-unit-y) + $(call do_test_tap,$^) # Reports and overall runs -check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml - $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@,"GEN","$@") - -check-report.html: check-report.xml - $(call quiet-command,gtester-report $< > $@,"GEN","$@") +check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap + $(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@") # Per guest TCG tests diff --git a/tests/docker/dockerfiles/centos7.docker b/tests/docker/dockerfiles/centos7.docker index 0a04bfbed8..e0f18f5a41 100644 --- a/tests/docker/dockerfiles/centos7.docker +++ b/tests/docker/dockerfiles/centos7.docker @@ -22,6 +22,7 @@ ENV PACKAGES \ mesa-libEGL-devel \ mesa-libgbm-devel \ nettle-devel \ + perl-Test-Harness \ pixman-devel \ SDL-devel \ spice-glib-devel \ diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian-amd64.docker index 24b113b76f..c66e341e5f 100644 --- a/tests/docker/dockerfiles/debian-amd64.docker +++ b/tests/docker/dockerfiles/debian-amd64.docker @@ -16,6 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ liblzo2-dev \ librdmacm-dev \ libsnappy-dev \ + libtest-harness-perl \ libvte-dev # virgl diff --git a/tests/docker/dockerfiles/debian-ports.docker b/tests/docker/dockerfiles/debian-ports.docker index e05a9a9802..514ab53b80 100644 --- a/tests/docker/dockerfiles/debian-ports.docker +++ b/tests/docker/dockerfiles/debian-ports.docker @@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/debian-sid.docker b/tests/docker/dockerfiles/debian-sid.docker index 9a3d168705..b30cbe7fc0 100644 --- a/tests/docker/dockerfiles/debian-sid.docker +++ b/tests/docker/dockerfiles/debian-sid.docker @@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ ca-certificates \ flex \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/debian8.docker b/tests/docker/dockerfiles/debian8.docker index 52945631cd..cdc3f11e06 100644 --- a/tests/docker/dockerfiles/debian8.docker +++ b/tests/docker/dockerfiles/debian8.docker @@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ gettext \ git \ gnupg \ + libtest-harness-perl \ pkg-config \ python-minimal diff --git a/tests/docker/dockerfiles/debian9.docker b/tests/docker/dockerfiles/debian9.docker index 154ae2a455..9561d4f225 100644 --- a/tests/docker/dockerfiles/debian9.docker +++ b/tests/docker/dockerfiles/debian9.docker @@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker index 0c4eb9e49c..1d0e3dc4ec 100644 --- a/tests/docker/dockerfiles/fedora.docker +++ b/tests/docker/dockerfiles/fedora.docker @@ -70,6 +70,7 @@ ENV PACKAGES \ nss-devel \ numactl-devel \ perl \ + perl-Test-Harness \ pixman-devel \ python3 \ PyYAML \ diff --git a/tests/docker/dockerfiles/ubuntu.docker b/tests/docker/dockerfiles/ubuntu.docker index 36e2b17de5..229add533c 100644 --- a/tests/docker/dockerfiles/ubuntu.docker +++ b/tests/docker/dockerfiles/ubuntu.docker @@ -45,6 +45,7 @@ ENV PACKAGES flex bison \ libspice-protocol-dev \ libspice-server-dev \ libssh2-1-dev \ + libtest-harness-perl \ libusb-1.0-0-dev \ libusbredirhost-dev \ libvdeplug-dev \ From patchwork Mon Dec 17 23:16:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014870 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jcvp287Xz9s2P for ; Tue, 18 Dec 2018 10:35:18 +1100 (AEDT) Received: from localhost ([::1]:50536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Pr-0005ch-Qz for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:35:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ299-0000vC-Ej for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ298-0003wB-M7 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56094) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ298-0003vv-FC for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:17:58 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C85E18B10D for ; Mon, 17 Dec 2018 23:17:57 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A1A75D9C8; Mon, 17 Dec 2018 23:17:54 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:49 +0100 Message-Id: <20181217231700.24482-25-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Dec 2018 23:17:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 24/35] qemu/queue.h: do not access tqe_prev directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Use the QTAILQ_IN_USE macro instead, it does the same thing but the next patch will change it to a different definition. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- blockdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 81f95d920b..7604b2183b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -4259,7 +4259,7 @@ void qmp_blockdev_del(const char *node_name, Error **errp) goto out; } - if (!bs->monitor_list.tqe_prev) { + if (!QTAILQ_IN_USE(bs, monitor_list)) { error_setg(errp, "Node %s is not owned by the monitor", bs->node_name); goto out; From patchwork Mon Dec 17 23:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014887 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd8M5zzGz9s2P for ; Tue, 18 Dec 2018 10:46:11 +1100 (AEDT) Received: from localhost ([::1]:50600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2aP-0006f8-9u for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:46:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29G-00015i-9Z for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29C-00042Y-Sf for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48188) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29C-0003xe-M6 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:02 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F07545D607 for ; Mon, 17 Dec 2018 23:18:01 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71CDA5D9C8; Mon, 17 Dec 2018 23:17:58 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:50 +0100 Message-Id: <20181217231700.24482-26-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 17 Dec 2018 23:18:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 25/35] vfio: make vfio_address_spaces static X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Williamson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" It is not used outside hw/vfio/common.c, so it does not need to be extern. Acked-by: Alex Williamson Signed-off-by: Paolo Bonzini --- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7c185e5a2e..7aa804ea0b 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -39,7 +39,7 @@ struct vfio_group_head vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); -struct vfio_as_head vfio_address_spaces = +static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); #ifdef CONFIG_KVM diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 1b434d02f6..127ca47815 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -181,7 +181,6 @@ int vfio_get_device(VFIOGroup *group, const char *name, extern const MemoryRegionOps vfio_region_ops; extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; -extern QLIST_HEAD(vfio_as_head, VFIOAddressSpace) vfio_address_spaces; #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, From patchwork Mon Dec 17 23:16:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014885 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd6q2Z3Sz9s2P for ; Tue, 18 Dec 2018 10:44:51 +1100 (AEDT) Received: from localhost ([::1]:50589 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Z6-0005Th-40 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:44:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29H-00017Q-KK for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29E-0004Hf-RU for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60970) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29E-0004D3-IR for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:04 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E68B93C2CDF for ; Mon, 17 Dec 2018 23:18:03 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FD675D9C5 for ; Mon, 17 Dec 2018 23:18:02 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:51 +0100 Message-Id: <20181217231700.24482-27-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Dec 2018 23:18:03 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 26/35] qemu/queue.h: leave head structs anonymous unless necessary X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Most list head structs need not be given a name. In most cases the name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV or reverse iteration, but this does not apply to lists of other kinds, and even for QTAILQ in practice this is only rarely needed. In addition, we will soon reimplement those macros completely so that they do not need a name for the head struct. So clean up everything, not giving a name except in the rare case where it is necessary. Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 4 ++-- block/gluster.c | 2 +- block/mirror.c | 2 +- block/qcow2-bitmap.c | 4 +--- block/qcow2.h | 2 +- block/sheepdog.c | 6 +++--- block/vhdx.h | 2 +- blockdev.c | 2 +- contrib/ivshmem-client/ivshmem-client.h | 4 +--- contrib/ivshmem-server/ivshmem-server.h | 5 +---- exec.c | 2 +- fsdev/qemu-fsdev.c | 2 +- hw/block/nvme.h | 8 ++++---- hw/block/xen_disk.c | 6 +++--- hw/core/reset.c | 2 +- hw/i386/xen/xen-mapcache.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/usb/ccid-card-emulated.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/xen-usb.c | 6 +++--- hw/watchdog/watchdog.c | 2 +- hw/xen/xen_pvdev.c | 4 ++-- include/exec/memory.h | 4 ++-- include/hw/vfio/vfio-platform.h | 2 +- include/qom/cpu.h | 4 ++-- include/sysemu/kvm.h | 2 -- include/sysemu/rng.h | 2 +- linux-user/elfload.c | 2 +- memory.c | 2 +- migration/block-dirty-bitmap.c | 2 +- migration/block.c | 4 ++-- migration/ram.c | 2 +- monitor.c | 4 ++-- net/queue.c | 2 +- net/slirp.c | 2 +- slirp/slirp.c | 2 +- target/arm/kvm.c | 2 +- target/i386/hax-mem.c | 2 +- tcg/tcg.h | 2 +- tests/test-rcu-list.c | 2 +- vl.c | 2 +- 41 files changed, 56 insertions(+), 65 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4880a05399..4e1de942ce 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -86,7 +86,7 @@ struct KVMState int robust_singlestep; int debugregs; #ifdef KVM_CAP_SET_GUEST_DEBUG - struct kvm_sw_breakpoint_head kvm_sw_breakpoints; + QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints; #endif int many_ioeventfds; int intx_set_mask; @@ -102,7 +102,7 @@ struct KVMState int nr_allocated_irq_routes; unsigned long *used_gsi_bitmap; unsigned int gsi_count; - QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; + QTAILQ_HEAD(, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; #endif KVMMemoryListener memory_listener; QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus; diff --git a/block/gluster.c b/block/gluster.c index 5e300c96c8..72891060e3 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -72,7 +72,7 @@ typedef struct ListElement { GlfsPreopened saved; } ListElement; -static QLIST_HEAD(glfs_list, ListElement) glfs_list; +static QLIST_HEAD(, ListElement) glfs_list; static QemuOptsList qemu_gluster_create_opts = { .name = "qemu-gluster-create-opts", diff --git a/block/mirror.c b/block/mirror.c index 8f52c6215d..6250cc3c87 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -72,7 +72,7 @@ typedef struct MirrorBlockJob { unsigned long *in_flight_bitmap; int in_flight; int64_t bytes_in_flight; - QTAILQ_HEAD(MirrorOpList, MirrorOp) ops_in_flight; + QTAILQ_HEAD(, MirrorOp) ops_in_flight; int ret; bool unmap; int target_cluster_size; diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index accebef4cf..b946301429 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -77,8 +77,6 @@ typedef struct Qcow2BitmapTable { uint32_t size; /* number of 64bit entries */ QSIMPLEQ_ENTRY(Qcow2BitmapTable) entry; } Qcow2BitmapTable; -typedef QSIMPLEQ_HEAD(Qcow2BitmapTableList, Qcow2BitmapTable) - Qcow2BitmapTableList; typedef struct Qcow2Bitmap { Qcow2BitmapTable table; @@ -1316,7 +1314,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp) int ret; Qcow2BitmapList *bm_list; Qcow2Bitmap *bm; - Qcow2BitmapTableList drop_tables; + QSIMPLEQ_HEAD(, Qcow2BitmapTable) drop_tables; Qcow2BitmapTable *tb, *tb_next; if (!bdrv_has_changed_persistent_bitmaps(bs)) { diff --git a/block/qcow2.h b/block/qcow2.h index 8662b68575..d747dd14a2 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -281,7 +281,7 @@ typedef struct BDRVQcow2State { uint8_t *cluster_cache; uint8_t *cluster_data; uint64_t cluster_cache_offset; - QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs; + QLIST_HEAD(, QCowL2Meta) cluster_allocs; uint64_t *refcount_table; uint64_t refcount_table_offset; diff --git a/block/sheepdog.c b/block/sheepdog.c index 0125df9d49..90ab43baa4 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -391,12 +391,12 @@ struct BDRVSheepdogState { uint32_t aioreq_seq_num; /* Every aio request must be linked to either of these queues. */ - QLIST_HEAD(inflight_aio_head, AIOReq) inflight_aio_head; - QLIST_HEAD(failed_aio_head, AIOReq) failed_aio_head; + QLIST_HEAD(, AIOReq) inflight_aio_head; + QLIST_HEAD(, AIOReq) failed_aio_head; CoMutex queue_lock; CoQueue overlapping_queue; - QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head; + QLIST_HEAD(, SheepdogAIOCB) inflight_aiocb_head; }; typedef struct BDRVSheepdogReopenState { diff --git a/block/vhdx.h b/block/vhdx.h index 3a5f5293ad..1bfb4e4f73 100644 --- a/block/vhdx.h +++ b/block/vhdx.h @@ -398,7 +398,7 @@ typedef struct BDRVVHDXState { bool log_replayed_on_open; - QLIST_HEAD(VHDXRegionHead, VHDXRegionEntry) regions; + QLIST_HEAD(, VHDXRegionEntry) regions; } BDRVVHDXState; void vhdx_guid_generate(MSGUID *guid); diff --git a/blockdev.c b/blockdev.c index 7604b2183b..60d05ec7f5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2269,7 +2269,7 @@ void qmp_transaction(TransactionActionList *dev_list, BlkActionState *state, *next; Error *local_err = NULL; - QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states; + QSIMPLEQ_HEAD(, BlkActionState) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); /* Does this transaction get canceled as a group on failure? diff --git a/contrib/ivshmem-client/ivshmem-client.h b/contrib/ivshmem-client/ivshmem-client.h index 5ee942262b..fe3cc4a03d 100644 --- a/contrib/ivshmem-client/ivshmem-client.h +++ b/contrib/ivshmem-client/ivshmem-client.h @@ -46,9 +46,7 @@ typedef struct IvshmemClientPeer { int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */ unsigned vectors_count; /**< number of vectors */ } IvshmemClientPeer; -QTAILQ_HEAD(IvshmemClientPeerList, IvshmemClientPeer); -typedef struct IvshmemClientPeerList IvshmemClientPeerList; typedef struct IvshmemClient IvshmemClient; /** @@ -73,7 +71,7 @@ struct IvshmemClient { int sock_fd; /**< unix sock filedesc */ int shm_fd; /**< shm file descriptor */ - IvshmemClientPeerList peer_list; /**< list of peers */ + QTAILQ_HEAD(, IvshmemClientPeer) peer_list; /**< list of peers */ IvshmemClientPeer local; /**< our own infos */ IvshmemClientNotifCb notif_cb; /**< notification callback */ diff --git a/contrib/ivshmem-server/ivshmem-server.h b/contrib/ivshmem-server/ivshmem-server.h index 4af08e1bb7..d870adb6a0 100644 --- a/contrib/ivshmem-server/ivshmem-server.h +++ b/contrib/ivshmem-server/ivshmem-server.h @@ -52,9 +52,6 @@ typedef struct IvshmemServerPeer { EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one per vector */ unsigned vectors_count; /**< number of vectors */ } IvshmemServerPeer; -QTAILQ_HEAD(IvshmemServerPeerList, IvshmemServerPeer); - -typedef struct IvshmemServerPeerList IvshmemServerPeerList; /** * Structure describing an ivshmem server @@ -72,7 +69,7 @@ typedef struct IvshmemServer { unsigned n_vectors; /**< number of vectors */ uint16_t cur_id; /**< id to be given to next client */ bool verbose; /**< true in verbose mode */ - IvshmemServerPeerList peer_list; /**< list of peers */ + QTAILQ_HEAD(, IvshmemServerPeer) peer_list; /**< list of peers */ } IvshmemServer; /** diff --git a/exec.c b/exec.c index bb6170dbff..b6b2007f27 100644 --- a/exec.c +++ b/exec.c @@ -3464,7 +3464,7 @@ typedef struct MapClient { } MapClient; QemuMutex map_client_list_lock; -static QLIST_HEAD(map_client_list, MapClient) map_client_list +static QLIST_HEAD(, MapClient) map_client_list = QLIST_HEAD_INITIALIZER(map_client_list); static void cpu_unregister_map_client_do(MapClient *client) diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 7a3b87cc9e..82edf43a0d 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -18,7 +18,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" -static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries = +static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries = QTAILQ_HEAD_INITIALIZER(fsdriver_entries); static FsDriverTable FsDrivers[] = { diff --git a/hw/block/nvme.h b/hw/block/nvme.h index cabcf20c32..56c9d4b4b1 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -29,8 +29,8 @@ typedef struct NvmeSQueue { uint64_t dma_addr; QEMUTimer *timer; NvmeRequest *io_req; - QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list; - QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list; + QTAILQ_HEAD(, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeRequest) out_req_list; QTAILQ_ENTRY(NvmeSQueue) entry; } NvmeSQueue; @@ -45,8 +45,8 @@ typedef struct NvmeCQueue { uint32_t size; uint64_t dma_addr; QEMUTimer *timer; - QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list; - QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeSQueue) sq_list; + QTAILQ_HEAD(, NvmeRequest) req_list; } NvmeCQueue; typedef struct NvmeNamespace { diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 36eff94f84..2a254b99d0 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -82,9 +82,9 @@ struct XenBlkDev { int more_work; /* request lists */ - QLIST_HEAD(inflight_head, ioreq) inflight; - QLIST_HEAD(finished_head, ioreq) finished; - QLIST_HEAD(freelist_head, ioreq) freelist; + QLIST_HEAD(, ioreq) inflight; + QLIST_HEAD(, ioreq) finished; + QLIST_HEAD(, ioreq) freelist; int requests_total; int requests_inflight; int requests_finished; diff --git a/hw/core/reset.c b/hw/core/reset.c index 84c8869371..9c477f2bf5 100644 --- a/hw/core/reset.c +++ b/hw/core/reset.c @@ -35,7 +35,7 @@ typedef struct QEMUResetEntry { void *opaque; } QEMUResetEntry; -static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = +static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers = QTAILQ_HEAD_INITIALIZER(reset_handlers); void qemu_register_reset(QEMUResetHandler *func, void *opaque) diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 4e4f069a24..02e823c5a2 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -71,7 +71,7 @@ typedef struct MapCacheRev { typedef struct MapCache { MapCacheEntry *entry; unsigned long nr_buckets; - QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries; + QTAILQ_HEAD(, MapCacheRev) locked_entries; /* For most cases (>99.9%), the page address is the same. */ MapCacheEntry *last_entry; diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 1b0880ac9e..68dacf6356 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -42,7 +42,7 @@ enum sPAPRTCEAccess { #define IOMMU_PAGE_SIZE(shift) (1ULL << (shift)) #define IOMMU_PAGE_MASK(shift) (~(IOMMU_PAGE_SIZE(shift) - 1)) -static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; +static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables; sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn) { diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 25976ed84f..de880a8c30 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -119,11 +119,11 @@ struct EmulatedState { char *db; uint8_t atr[MAX_ATR_SIZE]; uint8_t atr_length; - QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; + QSIMPLEQ_HEAD(, EmulEvent) event_list; QemuMutex event_list_mutex; QemuThread event_thread_id; VReader *reader; - QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; + QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list; QemuMutex vreader_mutex; /* and guest_apdu_list mutex */ QemuMutex handle_apdu_mutex; QemuCond handle_apdu_cond; diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 385e090336..ffab3fabee 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -648,7 +648,7 @@ typedef struct USBNetState { char usbstring_mac[13]; NICState *nic; NICConf conf; - QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; + QTAILQ_HEAD(, rndis_response) rndis_resp; } USBNetState; #define TYPE_USB_NET "usb-net" diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 5b2e21ed18..5564eb977c 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -72,7 +72,7 @@ struct usbback_stub { USBPort port; unsigned int speed; bool attached; - QTAILQ_HEAD(submit_q_head, usbback_req) submit_q; + QTAILQ_HEAD(, usbback_req) submit_q; }; struct usbback_req { @@ -108,8 +108,8 @@ struct usbback_info { int num_ports; int usb_ver; bool ring_error; - QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q; - QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q; + QTAILQ_HEAD(, usbback_req) req_free_q; + QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q; struct usbback_stub ports[USBBACK_MAXPORTS]; struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE]; QEMUBH *bh; diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 33e6c20184..dce7c1db14 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -32,7 +32,7 @@ #include "qemu/help_option.h" static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET; -static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; +static QLIST_HEAD(, WatchdogTimerModel) watchdog_list; void watchdog_add_model(WatchdogTimerModel *model) { diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index aed783e844..f026556f62 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -31,10 +31,10 @@ struct xs_dirs { QTAILQ_ENTRY(xs_dirs) list; }; -static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = +static QTAILQ_HEAD(, xs_dirs) xs_cleanup = QTAILQ_HEAD_INITIALIZER(xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +static QTAILQ_HEAD(, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); /* ------------------------------------------------------------- */ diff --git a/include/exec/memory.h b/include/exec/memory.h index 8e61450de3..ce930689cf 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -379,9 +379,9 @@ struct MemoryRegion { MemoryRegion *alias; hwaddr alias_offset; int32_t priority; - QTAILQ_HEAD(subregions, MemoryRegion) subregions; + QTAILQ_HEAD(, MemoryRegion) subregions; QTAILQ_ENTRY(MemoryRegion) subregions_link; - QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; + QTAILQ_HEAD(, CoalescedMemoryRange) coalesced; const char *name; unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h index 0ee10b1d71..30d3c28d3b 100644 --- a/include/hw/vfio/vfio-platform.h +++ b/include/hw/vfio/vfio-platform.h @@ -53,7 +53,7 @@ typedef struct VFIOPlatformDevice { VFIORegion **regions; QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */ /* queue of pending IRQs */ - QSIMPLEQ_HEAD(pending_intp_queue, VFIOINTp) pending_intp_queue; + QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue; char *compat; /* DT compatible values, separated by NUL */ unsigned int num_compat; /* number of compatible values */ uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1396f53e5b..62aef77b87 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -375,9 +375,9 @@ struct CPUState { QTAILQ_ENTRY(CPUState) node; /* ice debug support */ - QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; + QTAILQ_HEAD(, CPUBreakpoint) breakpoints; - QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; + QTAILQ_HEAD(, CPUWatchpoint) watchpoints; CPUWatchpoint *watchpoint_hit; void *opaque; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 97d8d9d0d5..a6d1cd190f 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -412,8 +412,6 @@ struct kvm_sw_breakpoint { QTAILQ_ENTRY(kvm_sw_breakpoint) entry; }; -QTAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint); - struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, target_ulong pc); diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h index 45629c4c53..27b37da05d 100644 --- a/include/sysemu/rng.h +++ b/include/sysemu/rng.h @@ -57,7 +57,7 @@ struct RngBackend /*< protected >*/ bool opened; - QSIMPLEQ_HEAD(requests, RngRequest) requests; + QSIMPLEQ_HEAD(, RngRequest) requests; }; diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5bccd2e243..4cff9e1a31 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2844,7 +2844,7 @@ struct elf_note_info { struct target_elf_prstatus *prstatus; /* NT_PRSTATUS */ struct target_elf_prpsinfo *psinfo; /* NT_PRPSINFO */ - QTAILQ_HEAD(thread_list_head, elf_thread_status) thread_list; + QTAILQ_HEAD(, elf_thread_status) thread_list; #if 0 /* * Current version of ELF coredump doesn't support diff --git a/memory.c b/memory.c index 5759f74034..195c5cf639 100644 --- a/memory.c +++ b/memory.c @@ -2795,7 +2795,7 @@ struct MemoryRegionList { QTAILQ_ENTRY(MemoryRegionList) mrqueue; }; -typedef QTAILQ_HEAD(mrqueue, MemoryRegionList) MemoryRegionListHead; +typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead; #define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \ int128_sub((size), int128_one())) : 0) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 5e90f44c2f..6426151e4f 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -116,7 +116,7 @@ typedef struct DirtyBitmapMigBitmapState { } DirtyBitmapMigBitmapState; typedef struct DirtyBitmapMigState { - QSIMPLEQ_HEAD(dbms_list, DirtyBitmapMigBitmapState) dbms_list; + QSIMPLEQ_HEAD(, DirtyBitmapMigBitmapState) dbms_list; bool bulk_completed; bool no_bitmaps; diff --git a/migration/block.c b/migration/block.c index 4c04d937b1..0e24e18d13 100644 --- a/migration/block.c +++ b/migration/block.c @@ -93,12 +93,12 @@ typedef struct BlkMigBlock { } BlkMigBlock; typedef struct BlkMigState { - QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list; + QSIMPLEQ_HEAD(, BlkMigDevState) bmds_list; int64_t total_sector_sum; bool zero_blocks; /* Protected by lock. */ - QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list; + QSIMPLEQ_HEAD(, BlkMigBlock) blk_list; int submitted; int read_done; diff --git a/migration/ram.c b/migration/ram.c index 7e7deec4d8..1849979fed 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -322,7 +322,7 @@ struct RAMState { RAMBlock *last_req_rb; /* Queue of outstanding page requests from the destination */ QemuMutex src_page_req_mutex; - QSIMPLEQ_HEAD(src_page_requests, RAMSrcPageRequest) src_page_requests; + QSIMPLEQ_HEAD(, RAMSrcPageRequest) src_page_requests; }; typedef struct RAMState RAMState; diff --git a/monitor.c b/monitor.c index 6e81b09294..5982280d3c 100644 --- a/monitor.c +++ b/monitor.c @@ -266,12 +266,12 @@ typedef struct QMPRequest QMPRequest; /* Protects mon_list, monitor_qapi_event_state, monitor_destroyed. */ static QemuMutex monitor_lock; static GHashTable *monitor_qapi_event_state; -static QTAILQ_HEAD(mon_list, Monitor) mon_list; +static QTAILQ_HEAD(, Monitor) mon_list; static bool monitor_destroyed; /* Protects mon_fdsets */ static QemuMutex mon_fdsets_lock; -static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets; +static QLIST_HEAD(, MonFdset) mon_fdsets; static int mon_refcount; diff --git a/net/queue.c b/net/queue.c index 9c32abdb8f..61276ca4be 100644 --- a/net/queue.c +++ b/net/queue.c @@ -55,7 +55,7 @@ struct NetQueue { uint32_t nq_count; NetQueueDeliverFunc *deliver; - QTAILQ_HEAD(packets, NetPacket) packets; + QTAILQ_HEAD(, NetPacket) packets; unsigned delivering : 1; }; diff --git a/net/slirp.c b/net/slirp.c index f6dc03963a..38ae65e4a9 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -85,7 +85,7 @@ typedef struct SlirpState { } SlirpState; static struct slirp_config_str *slirp_configs; -static QTAILQ_HEAD(slirp_stacks, SlirpState) slirp_stacks = +static QTAILQ_HEAD(, SlirpState) slirp_stacks = QTAILQ_HEAD_INITIALIZER(slirp_stacks); static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp); diff --git a/slirp/slirp.c b/slirp/slirp.c index 322edf51eb..ab2fc4eb8b 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -47,7 +47,7 @@ static const uint8_t special_ethaddr[ETH_ALEN] = { u_int curtime; -static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances = +static QTAILQ_HEAD(, Slirp) slirp_instances = QTAILQ_HEAD_INITIALIZER(slirp_instances); static struct in_addr dns_addr; diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 44dd0ce6ce..e00ccf9c98 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -206,7 +206,7 @@ typedef struct KVMDevice { int dev_fd; } KVMDevice; -static QSLIST_HEAD(kvm_devices_head, KVMDevice) kvm_devices_head; +static QSLIST_HEAD(, KVMDevice) kvm_devices_head; static void kvm_arm_devlistener_add(MemoryListener *listener, MemoryRegionSection *section) diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c index 5c37e94caa..6bb5a24917 100644 --- a/target/i386/hax-mem.c +++ b/target/i386/hax-mem.c @@ -56,7 +56,7 @@ typedef struct HAXMapping { * send to the kernel only the removal of the pages from the MMIO hole after * having computed locally the result of the deletion and additions. */ -static QTAILQ_HEAD(HAXMappingListHead, HAXMapping) mappings = +static QTAILQ_HEAD(, HAXMapping) mappings = QTAILQ_HEAD_INITIALIZER(mappings); /** diff --git a/tcg/tcg.h b/tcg/tcg.h index f9a56a9520..1de74f982b 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -702,7 +702,7 @@ struct TCGContext { /* These structures are private to tcg-target.inc.c. */ #ifdef TCG_TARGET_NEED_LDST_LABELS - QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels; + QSIMPLEQ_HEAD(, TCGLabelQemuLdst) ldst_labels; #endif #ifdef TCG_TARGET_NEED_POOL_LABELS struct TCGLabelPoolData *pool_labels; diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c index 2e6f70bd59..6f076473e0 100644 --- a/tests/test-rcu-list.c +++ b/tests/test-rcu-list.c @@ -108,7 +108,7 @@ static void reclaim_list_el(struct rcu_head *prcu) } #if TEST_LIST_TYPE == 1 -static QLIST_HEAD(q_list_head, list_element) Q_list_head; +static QLIST_HEAD(, list_element) Q_list_head; #define TEST_NAME "qlist" #define TEST_LIST_REMOVE_RCU QLIST_REMOVE_RCU diff --git a/vl.c b/vl.c index 5f6ff43b1b..0903166812 100644 --- a/vl.c +++ b/vl.c @@ -1529,7 +1529,7 @@ struct vm_change_state_entry { QLIST_ENTRY (vm_change_state_entry) entries; }; -static QLIST_HEAD(vm_change_state_head, vm_change_state_entry) vm_change_state_head; +static QLIST_HEAD(, vm_change_state_entry) vm_change_state_head; VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void *opaque) From patchwork Mon Dec 17 23:16:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JczP6Ltcz9s2P for ; Tue, 18 Dec 2018 10:38:25 +1100 (AEDT) Received: from localhost ([::1]:50556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2St-00088w-Ar for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:38:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29L-0001DM-Bg for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29H-0004SD-In for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44138) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29H-0004Op-0y for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:07 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 431BA88E62 for ; Mon, 17 Dec 2018 23:18:06 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C37E68B18; Mon, 17 Dec 2018 23:18:04 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:52 +0100 Message-Id: <20181217231700.24482-28-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 23:18:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/35] qemu/queue.h: typedef QTAILQ heads X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will be needed when we change the QTAILQ head and elem structs to unions. However, it is also consistent with the usage elsewhere in QEMU for other list head structs (see for example FsMountList). Note that most QTAILQs only need their name in order to do backwards walks. Those do not break with the struct->union change, and anyway the change will also remove the need to name heads when doing backwards walks, so those are not touched here. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- exec.c | 3 ++- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 3 ++- include/qom/cpu.h | 5 +++-- ui/input.c | 14 ++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/exec.c b/exec.c index b6b2007f27..a629c98eb5 100644 --- a/exec.c +++ b/exec.c @@ -94,7 +94,8 @@ int target_page_bits; bool target_page_bits_decided; #endif -struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); + /* current CPU in the current thread. It is only valid inside cpu_exec() */ __thread CPUState *current_cpu; diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7aa804ea0b..4262b80c44 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -37,7 +37,7 @@ #include "trace.h" #include "qapi/error.h" -struct vfio_group_head vfio_group_list = +VFIOGroupList vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 127ca47815..7624c9f511 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -180,7 +180,8 @@ int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev, Error **errp); extern const MemoryRegionOps vfio_region_ops; -extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; +typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; +extern VFIOGroupList vfio_group_list; #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 62aef77b87..4662a205c1 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -435,8 +435,9 @@ struct CPUState { GArray *iommu_notifiers; }; -QTAILQ_HEAD(CPUTailQ, CPUState); -extern struct CPUTailQ cpus; +typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; +extern CPUTailQ cpus; + #define first_cpu QTAILQ_FIRST_RCU(&cpus) #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node) diff --git a/ui/input.c b/ui/input.c index 7c9a4109c4..35c7964f64 100644 --- a/ui/input.c +++ b/ui/input.c @@ -19,6 +19,9 @@ struct QemuInputHandlerState { }; typedef struct QemuInputEventQueue QemuInputEventQueue; +typedef QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) + QemuInputEventQueueHead; + struct QemuInputEventQueue { enum { QEMU_INPUT_QUEUE_DELAY = 1, @@ -37,8 +40,7 @@ static QTAILQ_HEAD(, QemuInputHandlerState) handlers = static NotifierList mouse_mode_notifiers = NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers); -static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue = - QTAILQ_HEAD_INITIALIZER(kbd_queue); +static QemuInputEventQueueHead kbd_queue = QTAILQ_HEAD_INITIALIZER(kbd_queue); static QEMUTimer *kbd_timer; static uint32_t kbd_default_delay_ms = 10; static uint32_t queue_count; @@ -257,7 +259,7 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) static void qemu_input_queue_process(void *opaque) { - struct QemuInputEventQueueHead *queue = opaque; + QemuInputEventQueueHead *queue = opaque; QemuInputEventQueue *item; g_assert(!QTAILQ_EMPTY(queue)); @@ -288,7 +290,7 @@ static void qemu_input_queue_process(void *opaque) } } -static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_delay(QemuInputEventQueueHead *queue, QEMUTimer *timer, uint32_t delay_ms) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); @@ -306,7 +308,7 @@ static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue, } } -static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_event(QemuInputEventQueueHead *queue, QemuConsole *src, InputEvent *evt) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); @@ -318,7 +320,7 @@ static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, queue_count++; } -static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue) +static void qemu_input_queue_sync(QemuInputEventQueueHead *queue) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); From patchwork Mon Dec 17 23:16:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd0q4TQyz9s4s for ; Tue, 18 Dec 2018 10:39:39 +1100 (AEDT) Received: from localhost ([::1]:50560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2U5-0000sx-4P for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:39:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29O-0001F4-Lh for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29M-0004xC-4q for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44388) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29K-0004V5-9q for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:11 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C5764C065F74 for ; Mon, 17 Dec 2018 23:18:07 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC64D5D9C5 for ; Mon, 17 Dec 2018 23:18:06 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:53 +0100 Message-Id: <20181217231700.24482-29-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Dec 2018 23:18:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 28/35] qemu/queue.h: remove Q_TAILQ_{HEAD, ENTRY} X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These are not present for other kinds of queue, and unused. Zap them before more changes are made to the QTAILQ implementation. Signed-off-by: Paolo Bonzini --- include/qemu/queue.h | 14 ++++++-------- scripts/cocci-macro-file.h | 10 ---------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index ac418efc43..b9571e93d8 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -350,22 +350,20 @@ struct { \ /* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ +#define QTAILQ_HEAD(name, type) \ struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ + type *tqh_first; /* first element */ \ + type **tqh_last; /* addr of last next element */ \ } -#define QTAILQ_HEAD(name, type) Q_TAILQ_HEAD(name, struct type,) #define QTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ +#define QTAILQ_ENTRY(type) \ struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ + type *tqe_next; /* next element */ \ + type **tqe_prev; /* address of previous next element */ \ } -#define QTAILQ_ENTRY(type) Q_TAILQ_ENTRY(struct type,) /* * Tail queue functions. diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index 7e200a1023..e274ca3682 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -92,11 +92,6 @@ struct { \ /* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} #define QTAILQ_HEAD(name, type) \ struct name { \ type *tqh_first; /* first element */ \ @@ -106,11 +101,6 @@ struct name { \ #define QTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} #define QTAILQ_ENTRY(type) \ struct { \ type *tqe_next; /* next element */ \ From patchwork Mon Dec 17 23:16:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014879 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd2y3Z2sz9s2P for ; Tue, 18 Dec 2018 10:41:30 +1100 (AEDT) Received: from localhost ([::1]:50574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Vr-0002RK-EP for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:41:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43643) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29P-0001FY-7m for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29N-00053u-6K for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56150) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29M-0004ki-4E for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:12 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA7865A1C3 for ; Mon, 17 Dec 2018 23:18:09 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3DAD75D9C5 for ; Mon, 17 Dec 2018 23:18:07 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:54 +0100 Message-Id: <20181217231700.24482-30-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 17 Dec 2018 23:18:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 29/35] qemu/queue.h: reimplement QTAILQ without pointer-to-pointers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" QTAILQ is a doubly linked list, with a pointer-to-pointer to the last element from the head, and the previous element from each node. But if you squint enough, QTAILQ becomes a combination of a singly-linked forwards list, and another singly-linked list which goes backwards and is circular. This is the idea that lets QTAILQ implement reverse iteration: only, because the backwards list points inside the node, accessing the previous element needs to go two steps back and one forwards. What this patch does is implement it in these terms, without actually changing the in-memory layout at all. The coexistence of the two lists is realized by making QTAILQ_HEAD and QTAILQ_ENTRY unions of the forwards pointer and a generic QTailQLink node. Thq QTailQLink can walk the list in both directions; the union is needed so that the forwards pointer can have the correct type, as a sort of poor man's template. While there are other ways to get the same layout without a union, this one has the advantage of simpler operation in the debugger, because the fields tqh_first and tqe_next still exist as before the patch. Those fields are also used by scripts/qemugdb/mtree.py, so it's a good idea to preserve them. The advantage of the new representation is that the two-back-one-forward dance done by backwards accesses can be done all while operating on QTailQLinks. No casting to the head struct is needed anymore because, even though the QTailQLink's forward pointer is a void *, we can use typeof to recover the correct type. This patch only changes the implementation, not the interface. The next patch will remove the head struct name from the backwards visit macros. Signed-off-by: Paolo Bonzini --- include/qemu/queue.h | 139 ++++++++++++++++--------------------- include/qemu/rcu_queue.h | 45 ++++++------ scripts/cocci-macro-file.h | 14 ++-- 3 files changed, 92 insertions(+), 106 deletions(-) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index b9571e93d8..a893facb86 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -346,23 +346,28 @@ struct { \ #define QSIMPLEQ_FIRST(head) ((head)->sqh_first) #define QSIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) +typedef struct QTailQLink { + void *tql_next; + struct QTailQLink *tql_prev; +} QTailQLink; /* - * Tail queue definitions. + * Tail queue definitions. The union acts as a poor man template, as if + * it were QTailQLink. */ #define QTAILQ_HEAD(name, type) \ -struct name { \ - type *tqh_first; /* first element */ \ - type **tqh_last; /* addr of last next element */ \ +union name { \ + struct type *tqh_first; /* first element */ \ + QTailQLink tqh_circ; /* link for circular backwards list */ \ } #define QTAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } } #define QTAILQ_ENTRY(type) \ -struct { \ - type *tqe_next; /* next element */ \ - type **tqe_prev; /* address of previous next element */ \ +union { \ + struct type *tqe_next; /* next element */ \ + QTailQLink tqe_circ; /* link for circular backwards list */ \ } /* @@ -370,51 +375,51 @@ struct { \ */ #define QTAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ + (head)->tqh_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + (head)->tqh_circ.tql_prev->tql_next = (elm); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + (listelm)->field.tqe_circ.tql_prev->tql_next = (elm); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - (elm)->field.tqe_prev = NULL; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_circ.tql_prev->tql_next = (elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH(var, head, field) \ @@ -428,13 +433,13 @@ struct { \ (var) = (next_var)) #define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + for ((var) = QTAILQ_LAST(head, headname); \ (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + (var) = QTAILQ_PREV(var, headname, field)) #define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var) && ((prev_var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)), 1); \ + for ((var) = QTAILQ_LAST(head, headname); \ + (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ (var) = (prev_var)) /* @@ -443,71 +448,49 @@ struct { \ #define QTAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define QTAILQ_FIRST(head) ((head)->tqh_first) #define QTAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_prev != NULL) +#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_circ.tql_prev != NULL) +#define QTAILQ_LINK_PREV(link) \ + ((link).tql_prev->tql_prev->tql_next) #define QTAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) + ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) #define QTAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ)) #define field_at_offset(base, offset, type) \ - ((type) (((char *) (base)) + (offset))) - -typedef struct DUMMY_Q_ENTRY DUMMY_Q_ENTRY; -typedef struct DUMMY_Q DUMMY_Q; - -struct DUMMY_Q_ENTRY { - QTAILQ_ENTRY(DUMMY_Q_ENTRY) next; -}; - -struct DUMMY_Q { - QTAILQ_HEAD(DUMMY_Q_HEAD, DUMMY_Q_ENTRY) head; -}; - -#define dummy_q ((DUMMY_Q *) 0) -#define dummy_qe ((DUMMY_Q_ENTRY *) 0) + ((type *) (((char *) (base)) + (offset))) /* - * Offsets of layout of a tail queue head. - */ -#define QTAILQ_FIRST_OFFSET (offsetof(typeof(dummy_q->head), tqh_first)) -#define QTAILQ_LAST_OFFSET (offsetof(typeof(dummy_q->head), tqh_last)) -/* - * Raw access of elements of a tail queue + * Raw access of elements of a tail queue head. Offsets are all zero + * because it's a union. */ #define QTAILQ_RAW_FIRST(head) \ - (*field_at_offset(head, QTAILQ_FIRST_OFFSET, void **)) -#define QTAILQ_RAW_TQH_LAST(head) \ - (*field_at_offset(head, QTAILQ_LAST_OFFSET, void ***)) - -/* - * Offsets of layout of a tail queue element. - */ -#define QTAILQ_NEXT_OFFSET (offsetof(typeof(dummy_qe->next), tqe_next)) -#define QTAILQ_PREV_OFFSET (offsetof(typeof(dummy_qe->next), tqe_prev)) + field_at_offset(head, 0, void *) +#define QTAILQ_RAW_TQH_CIRC(head) \ + field_at_offset(head, 0, QTailQLink) /* * Raw access of elements of a tail entry */ #define QTAILQ_RAW_NEXT(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **)) -#define QTAILQ_RAW_TQE_PREV(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***)) + field_at_offset(elm, entry, void *) +#define QTAILQ_RAW_TQE_CIRC(elm, entry) \ + field_at_offset(elm, entry, QTailQLink) /* - * Tail queue tranversal using pointer arithmetic. + * Tail queue traversal using pointer arithmetic. */ #define QTAILQ_RAW_FOREACH(elm, head, entry) \ - for ((elm) = QTAILQ_RAW_FIRST(head); \ + for ((elm) = *QTAILQ_RAW_FIRST(head); \ (elm); \ - (elm) = QTAILQ_RAW_NEXT(elm, entry)) + (elm) = *QTAILQ_RAW_NEXT(elm, entry)) /* * Tail queue insertion using pointer arithmetic. */ -#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ - QTAILQ_RAW_NEXT(elm, entry) = NULL; \ - QTAILQ_RAW_TQE_PREV(elm, entry) = QTAILQ_RAW_TQH_LAST(head); \ - *QTAILQ_RAW_TQH_LAST(head) = (elm); \ - QTAILQ_RAW_TQH_LAST(head) = &QTAILQ_RAW_NEXT(elm, entry); \ +#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ + *QTAILQ_RAW_NEXT(elm, entry) = NULL; \ + QTAILQ_RAW_TQE_CIRC(elm, entry)->tql_prev = QTAILQ_RAW_TQH_CIRC(head)->tql_prev; \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev->tql_next = (elm); \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev = QTAILQ_RAW_TQE_CIRC(elm, entry); \ } while (/*CONSTCOND*/0) #endif /* QEMU_SYS_QUEUE_H */ diff --git a/include/qemu/rcu_queue.h b/include/qemu/rcu_queue.h index 904b3372dc..2d386f303e 100644 --- a/include/qemu/rcu_queue.h +++ b/include/qemu/rcu_queue.h @@ -206,47 +206,50 @@ extern "C" { #define QTAILQ_INSERT_HEAD_RCU(head, elm, field) do { \ (elm)->field.tqe_next = (head)->tqh_first; \ if ((elm)->field.tqe_next != NULL) { \ - (head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(head)->tqh_first, (elm)); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - atomic_rcu_set((head)->tqh_last, (elm)); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + atomic_rcu_set(&(head)->tqh_circ.tql_prev->tql_next, (elm)); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER_RCU(head, listelm, elm, field) do { \ (elm)->field.tqe_next = (listelm)->field.tqe_next; \ if ((elm)->field.tqe_next != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(listelm)->field.tqe_next, (elm)); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - atomic_rcu_set((listelm)->field.tqe_prev, (elm)); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ - } while (/*CONSTCOND*/0) +#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + atomic_rcu_set(&(listelm)->field.tqe_circ.tql_prev->tql_next, (elm)); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ +} while (/*CONSTCOND*/0) #define QTAILQ_REMOVE_RCU(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ } else { \ - (head)->tqh_last = (elm)->field.tqe_prev; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ } \ - atomic_set((elm)->field.tqe_prev, (elm)->field.tqe_next); \ - (elm)->field.tqe_prev = NULL; \ + atomic_set(&(elm)->field.tqe_circ.tql_prev->tql_next, (elm)->field.tqe_next); \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH_RCU(var, head, field) \ diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index e274ca3682..e485cdccae 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -93,18 +93,18 @@ struct { \ * Tail queue definitions. */ #define QTAILQ_HEAD(name, type) \ -struct name { \ - type *tqh_first; /* first element */ \ - type **tqh_last; /* addr of last next element */ \ +union name { \ + struct type *tqh_first; /* first element */ \ + QTailQLink tqh_circ; /* link for last element */ \ } #define QTAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } } #define QTAILQ_ENTRY(type) \ -struct { \ - type *tqe_next; /* next element */ \ - type **tqe_prev; /* address of previous next element */ \ +union { \ + struct type *tqe_next; /* next element */ \ + QTailQLink tqe_circ; /* link for prev element */ \ } /* From glib */ From patchwork Mon Dec 17 23:16:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JdCY0R7Dz9s0n for ; Tue, 18 Dec 2018 10:48:57 +1100 (AEDT) Received: from localhost ([::1]:50617 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2d4-0000aJ-HT for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:48:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29P-0001GC-QK for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29N-000546-G4 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48234) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29N-0004vE-5i for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:13 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5C5F9F754 for ; Mon, 17 Dec 2018 23:18:11 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 563FD5D9C8 for ; Mon, 17 Dec 2018 23:18:09 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:55 +0100 Message-Id: <20181217231700.24482-31-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 17 Dec 2018 23:18:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 30/35] qemu/queue.h: simplify reverse access to QTAILQ X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The new definition of QTAILQ does not require passing the headname, remove it. Signed-off-by: Paolo Bonzini --- cpus-common.c | 2 +- dump.c | 2 +- hw/core/qdev.c | 4 ++-- hw/scsi/scsi-bus.c | 2 +- hw/usb/combined-packet.c | 2 +- hw/usb/dev-mtp.c | 4 ++-- hw/usb/hcd-ehci.c | 2 +- hw/usb/hcd-ehci.h | 2 +- hw/usb/hcd-uhci.c | 4 ++-- include/exec/memory.h | 2 +- include/hw/qdev-core.h | 2 +- include/hw/usb.h | 2 +- include/net/net.h | 2 +- include/qemu/option_int.h | 2 +- include/qemu/queue.h | 16 ++++++++-------- include/sysemu/memory_mapping.h | 2 +- memory.c | 17 ++++++----------- memory_mapping.c | 2 +- net/filter.c | 2 +- net/net.c | 2 +- qga/commands-posix.c | 2 +- tcg/tcg.c | 2 +- tcg/tcg.h | 4 ++-- tests/libqos/malloc.c | 2 +- tests/test-vmstate.c | 8 ++++---- ui/console.c | 4 ++-- util/qemu-option.c | 4 ++-- 27 files changed, 48 insertions(+), 53 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 98dd8c6ff1..3ca58c64e8 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -99,7 +99,7 @@ void cpu_list_remove(CPUState *cpu) return; } - assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, CPUTailQ))); + assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus))); QTAILQ_REMOVE_RCU(&cpus, cpu, node); cpu->cpu_index = UNASSIGNED_CPU_INDEX; diff --git a/dump.c b/dump.c index 4ec94c5e25..ef1d8025c9 100644 --- a/dump.c +++ b/dump.c @@ -1557,7 +1557,7 @@ static void get_max_mapnr(DumpState *s) { GuestPhysBlock *last_block; - last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead); + last_block = QTAILQ_LAST(&s->guest_phys_blocks.head); s->max_mapnr = dump_paddr_to_pfn(s, last_block->target_end); } diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55b27..a7dd4bebd6 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type) return dev; } -static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners +static QTAILQ_HEAD(, DeviceListener) device_listeners = QTAILQ_HEAD_INITIALIZER(device_listeners); enum ListenerDirection { Forward, Reverse }; @@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse }; break; \ case Reverse: \ QTAILQ_FOREACH_REVERSE(_listener, &device_listeners, \ - device_listeners, link) { \ + link) { \ if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \ diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 97cd167114..c480553083 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1554,7 +1554,7 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun) BusChild *kid; SCSIDevice *target_dev = NULL; - QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, ChildrenHead, sibling) { + QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, sibling) { DeviceState *qdev = kid->child; SCSIDevice *dev = SCSI_DEVICE(qdev); diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 01a7ed0848..fc98383d30 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -64,7 +64,7 @@ void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p) status = combined->first->status; actual_length = combined->first->actual_length; - short_not_ok = QTAILQ_LAST(&combined->packets, packets_head)->short_not_ok; + short_not_ok = QTAILQ_LAST(&combined->packets)->short_not_ok; QTAILQ_FOREACH_SAFE(p, &combined->packets, combined_entry, next) { if (!done) { diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 100b7171f4..c33d7d6b1f 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -191,7 +191,7 @@ struct MTPState { #ifdef CONFIG_INOTIFY1 /* inotify descriptor */ int inotifyfd; - QTAILQ_HEAD(events, MTPMonEntry) events; + QTAILQ_HEAD(, MTPMonEntry) events; #endif /* Responder is expecting a write operation */ bool write_pending; @@ -1982,7 +1982,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) case EP_EVENT: #ifdef CONFIG_INOTIFY1 if (!QTAILQ_EMPTY(&s->events)) { - struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); + struct MTPMonEntry *e = QTAILQ_LAST(&s->events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index e5acfc5ba5..a2105c8ab1 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1815,7 +1815,7 @@ static int ehci_state_fetchqtd(EHCIQueue *q) break; case EHCI_ASYNC_INFLIGHT: /* Check if the guest has added new tds to the queue */ - again = ehci_fill_queue(QTAILQ_LAST(&q->packets, pkts_head)); + again = ehci_fill_queue(QTAILQ_LAST(&q->packets)); /* Unfinished async handled packet, go horizontal */ ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); break; diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 0bc364b286..e4460aa1a8 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -247,7 +247,7 @@ struct EHCIQueue { uint32_t qtdaddr; /* address QTD read from */ int last_pid; /* pid of last packet executed */ USBDevice *dev; - QTAILQ_HEAD(pkts_head, EHCIPacket) packets; + QTAILQ_HEAD(, EHCIPacket) packets; }; typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead; diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 836b11f177..26f123ed78 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -99,7 +99,7 @@ struct UHCIQueue { UHCIState *uhci; USBEndpoint *ep; QTAILQ_ENTRY(UHCIQueue) next; - QTAILQ_HEAD(asyncs_head, UHCIAsync) asyncs; + QTAILQ_HEAD(, UHCIAsync) asyncs; int8_t valid; }; @@ -837,7 +837,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, } if (!async->done) { UHCI_TD last_td; - UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs, asyncs_head); + UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs); /* * While we are waiting for the current td to complete, the guest * may have added more tds to the queue. Note we re-read the td diff --git a/include/exec/memory.h b/include/exec/memory.h index ce930689cf..7353fa2ac6 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -445,7 +445,7 @@ struct AddressSpace { int ioeventfd_nb; struct MemoryRegionIoeventfd *ioeventfds; - QTAILQ_HEAD(memory_listeners_as, MemoryListener) listeners; + QTAILQ_HEAD(, MemoryListener) listeners; QTAILQ_ENTRY(AddressSpace) address_spaces_link; }; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 92851e55df..615b2b54ed 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -206,7 +206,7 @@ struct BusState { HotplugHandler *hotplug_handler; int max_index; bool realized; - QTAILQ_HEAD(ChildrenHead, BusChild) children; + QTAILQ_HEAD(, BusChild) children; QLIST_ENTRY(BusState) sibling; }; diff --git a/include/hw/usb.h b/include/hw/usb.h index a5080adecc..f9431a0ebc 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -408,7 +408,7 @@ struct USBPacket { struct USBCombinedPacket { USBPacket *first; - QTAILQ_HEAD(packets_head, USBPacket) packets; + QTAILQ_HEAD(, USBPacket) packets; QEMUIOVector iov; }; diff --git a/include/net/net.h b/include/net/net.h index ec13702dbf..643295d163 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -97,7 +97,7 @@ struct NetClientState { unsigned rxfilter_notify_enabled:1; int vring_enable; int vnet_hdr_len; - QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; + QTAILQ_HEAD(, NetFilterState) filters; }; typedef struct NICState { diff --git a/include/qemu/option_int.h b/include/qemu/option_int.h index 26b1d9e4d6..5dd9a5162d 100644 --- a/include/qemu/option_int.h +++ b/include/qemu/option_int.h @@ -47,7 +47,7 @@ struct QemuOpts { char *id; QemuOptsList *list; Location loc; - QTAILQ_HEAD(QemuOptHead, QemuOpt) head; + QTAILQ_HEAD(, QemuOpt) head; QTAILQ_ENTRY(QemuOpts) next; }; diff --git a/include/qemu/queue.h b/include/qemu/queue.h index a893facb86..1f8e219412 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -432,14 +432,14 @@ union { \ (var) && ((next_var) = ((var)->field.tqe_next), 1); \ (var) = (next_var)) -#define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = QTAILQ_LAST(head, headname); \ +#define QTAILQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = QTAILQ_LAST(head); \ (var); \ - (var) = QTAILQ_PREV(var, headname, field)) + (var) = QTAILQ_PREV(var, field)) -#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \ - for ((var) = QTAILQ_LAST(head, headname); \ - (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ +#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, field, prev_var) \ + for ((var) = QTAILQ_LAST(head); \ + (var) && ((prev_var) = QTAILQ_PREV(var, field)); \ (var) = (prev_var)) /* @@ -452,9 +452,9 @@ union { \ #define QTAILQ_LINK_PREV(link) \ ((link).tql_prev->tql_prev->tql_next) -#define QTAILQ_LAST(head, headname) \ +#define QTAILQ_LAST(head) \ ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) -#define QTAILQ_PREV(elm, headname, field) \ +#define QTAILQ_PREV(elm, field) \ ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ)) #define field_at_offset(base, offset, type) \ diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 706152d533..58452457ce 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -36,7 +36,7 @@ typedef struct GuestPhysBlock { /* point-in-time snapshot of guest-visible physical mappings */ typedef struct GuestPhysBlockList { unsigned num; - QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head; + QTAILQ_HEAD(, GuestPhysBlock) head; } GuestPhysBlockList; /* The physical and virtual address in the memory mapping are contiguous. */ diff --git a/memory.c b/memory.c index 195c5cf639..61d66e4441 100644 --- a/memory.c +++ b/memory.c @@ -39,7 +39,7 @@ static bool memory_region_update_pending; static bool ioeventfd_update_pending; static bool global_dirty_log = false; -static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners +static QTAILQ_HEAD(, MemoryListener) memory_listeners = QTAILQ_HEAD_INITIALIZER(memory_listeners); static QTAILQ_HEAD(, AddressSpace) address_spaces @@ -113,8 +113,7 @@ enum ListenerDirection { Forward, Reverse }; } \ break; \ case Reverse: \ - QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, \ - memory_listeners, link) { \ + QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, link) { \ if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \ @@ -128,19 +127,17 @@ enum ListenerDirection { Forward, Reverse }; #define MEMORY_LISTENER_CALL(_as, _callback, _direction, _section, _args...) \ do { \ MemoryListener *_listener; \ - struct memory_listeners_as *list = &(_as)->listeners; \ \ switch (_direction) { \ case Forward: \ - QTAILQ_FOREACH(_listener, list, link_as) { \ + QTAILQ_FOREACH(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \ } \ break; \ case Reverse: \ - QTAILQ_FOREACH_REVERSE(_listener, list, memory_listeners_as, \ - link_as) { \ + QTAILQ_FOREACH_REVERSE(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \ @@ -2691,8 +2688,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) listener->address_space = as; if (QTAILQ_EMPTY(&memory_listeners) - || listener->priority >= QTAILQ_LAST(&memory_listeners, - memory_listeners)->priority) { + || listener->priority >= QTAILQ_LAST(&memory_listeners)->priority) { QTAILQ_INSERT_TAIL(&memory_listeners, listener, link); } else { QTAILQ_FOREACH(other, &memory_listeners, link) { @@ -2704,8 +2700,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) } if (QTAILQ_EMPTY(&as->listeners) - || listener->priority >= QTAILQ_LAST(&as->listeners, - memory_listeners)->priority) { + || listener->priority >= QTAILQ_LAST(&as->listeners)->priority) { QTAILQ_INSERT_TAIL(&as->listeners, listener, link_as); } else { QTAILQ_FOREACH(other, &as->listeners, link_as) { diff --git a/memory_mapping.c b/memory_mapping.c index 724dd0b417..e3ec70624f 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -223,7 +223,7 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, if (!QTAILQ_EMPTY(&g->list->head)) { hwaddr predecessor_size; - predecessor = QTAILQ_LAST(&g->list->head, GuestPhysBlockHead); + predecessor = QTAILQ_LAST(&g->list->head); predecessor_size = predecessor->target_end - predecessor->target_start; /* the memory API guarantees monotonically increasing traversal */ diff --git a/net/filter.c b/net/filter.c index c9f9e5fa08..28d1930db7 100644 --- a/net/filter.c +++ b/net/filter.c @@ -55,7 +55,7 @@ static NetFilterState *netfilter_next(NetFilterState *nf, next = QTAILQ_NEXT(nf, next); } else { /* reverse order */ - next = QTAILQ_PREV(nf, NetFilterHead, next); + next = QTAILQ_PREV(nf, next); } return next; diff --git a/net/net.c b/net/net.c index 1f7d626197..3acbdccd61 100644 --- a/net/net.c +++ b/net/net.c @@ -563,7 +563,7 @@ static ssize_t filter_receive_iov(NetClientState *nc, } } } else { - QTAILQ_FOREACH_REVERSE(nf, &nc->filters, NetFilterHead, next) { + QTAILQ_FOREACH_REVERSE(nf, &nc->filters, next) { ret = qemu_netfilter_receive(nf, direction, sender, flags, iov, iovcnt, sent_cb); if (ret) { diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1877976522..18a4724bc9 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1291,7 +1291,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, /* cannot risk guest agent blocking itself on a write in this state */ ga_set_frozen(ga_state); - QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) { + QTAILQ_FOREACH_REVERSE(mount, &mounts, next) { /* To issue fsfreeze in the reverse order of mounts, check if the * mount is listed in the list here */ if (has_mountpoints) { diff --git a/tcg/tcg.c b/tcg/tcg.c index e85133ef05..2e090937a9 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2269,7 +2269,7 @@ static void liveness_pass_1(TCGContext *s) tcg_la_func_end(s); - QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) { + QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, link, op_prev) { int i, nb_iargs, nb_oargs; TCGOpcode opc_new, opc_new2; bool have_opc_new2; diff --git a/tcg/tcg.h b/tcg/tcg.h index 1de74f982b..973a7579aa 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -713,7 +713,7 @@ struct TCGContext { TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ - QTAILQ_HEAD(TCGOpHead, TCGOp) ops, free_ops; + QTAILQ_HEAD(, TCGOp) ops, free_ops; /* Tells which temporary holds a given register. It does not take into account fixed registers */ @@ -841,7 +841,7 @@ static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v) /* The last op that was emitted. */ static inline TCGOp *tcg_last_op(void) { - return QTAILQ_LAST(&tcg_ctx->ops, TCGOpHead); + return QTAILQ_LAST(&tcg_ctx->ops); } /* Test for whether to terminate the TB for using too many opcodes. */ diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index ac05874b0a..f7bae47a08 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -104,7 +104,7 @@ static void mlist_coalesce(MemList *head, MemBlock *node) do { merge = 0; - left = QTAILQ_PREV(node, MemList, MLIST_ENTNAME); + left = QTAILQ_PREV(node, MLIST_ENTNAME); right = QTAILQ_NEXT(node, MLIST_ENTNAME); /* clowns to the left of me */ diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 37a7a93784..0ab29a8216 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -630,7 +630,7 @@ struct TestQtailqElement { typedef struct TestQtailq { int16_t i16; - QTAILQ_HEAD(TestQtailqHead, TestQtailqElement) q; + QTAILQ_HEAD(, TestQtailqElement) q; int32_t i32; } TestQtailq; @@ -735,9 +735,9 @@ static void test_load_q(void) g_assert_cmpint(eof, ==, QEMU_VM_EOF); TestQtailqElement *qele_from = QTAILQ_FIRST(&obj_q.q); - TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q, TestQtailqHead); + TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q); TestQtailqElement *qele_to = QTAILQ_FIRST(&tgt.q); - TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q, TestQtailqHead); + TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q); while (1) { g_assert_cmpint(qele_to->b, ==, qele_from->b); @@ -755,7 +755,7 @@ static void test_load_q(void) /* clean up */ TestQtailqElement *qele; while (!QTAILQ_EMPTY(&tgt.q)) { - qele = QTAILQ_LAST(&tgt.q, TestQtailqHead); + qele = QTAILQ_LAST(&tgt.q); QTAILQ_REMOVE(&tgt.q, qele, next); free(qele); qele = NULL; diff --git a/ui/console.c b/ui/console.c index 3a285bae00..5a904e67d0 100644 --- a/ui/console.c +++ b/ui/console.c @@ -182,7 +182,7 @@ struct DisplayState { static DisplayState *display_state; static QemuConsole *active_console; -static QTAILQ_HEAD(consoles_head, QemuConsole) consoles = +static QTAILQ_HEAD(, QemuConsole) consoles = QTAILQ_HEAD_INITIALIZER(consoles); static bool cursor_visible_phase; static QEMUTimer *cursor_timer; @@ -1303,7 +1303,7 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type, s->index = 0; QTAILQ_INSERT_TAIL(&consoles, s, next); } else if (console_type != GRAPHIC_CONSOLE || qdev_hotplug) { - QemuConsole *last = QTAILQ_LAST(&consoles, consoles_head); + QemuConsole *last = QTAILQ_LAST(&consoles); s->index = last->index + 1; QTAILQ_INSERT_TAIL(&consoles, s, next); } else { diff --git a/util/qemu-option.c b/util/qemu-option.c index de42e2a406..ef60af70fc 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -280,7 +280,7 @@ QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name) { QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) { if (strcmp(opt->name, name) != 0) continue; return opt; @@ -379,7 +379,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts) { QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) { if (is_help_option(opt->name)) { return true; } From patchwork Mon Dec 17 23:16:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014880 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd4F031Cz9s4s for ; Tue, 18 Dec 2018 10:42:36 +1100 (AEDT) Received: from localhost ([::1]:50578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Wv-0003L0-O4 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:42:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43637) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29O-0001FF-V9 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29O-00054Q-8w for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44916) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29O-00053z-1i for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:14 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3183F89AEB for ; Mon, 17 Dec 2018 23:18:13 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2E8E35D9C5 for ; Mon, 17 Dec 2018 23:18:11 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:56 +0100 Message-Id: <20181217231700.24482-32-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 17 Dec 2018 23:18:13 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 31/35] checkpatch: warn about qemu/queue.h head structs that are not typedef-ed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" These are just like any other struct or union, so they should have CamelCase typedefs. Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index df2da09b06..440d95d117 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2262,6 +2262,11 @@ sub process { } } + if ($line =~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ && + $line !~ /^.typedef/) { + ERROR("named $1 should be typedefed separately\n" . $herecurr); + } + # Need a space before open parenthesis after if, while etc if ($line=~/\b(if|while|for|switch)\(/) { ERROR("space required before the open parenthesis '('\n" . $herecurr); From patchwork Mon Dec 17 23:16:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014890 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JdFq3lVZz9s4s for ; Tue, 18 Dec 2018 10:50:55 +1100 (AEDT) Received: from localhost ([::1]:50639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2ez-0002cH-76 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:50:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29R-0001I7-LC for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29Q-00055Q-Mx for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29Q-000550-Fk for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 697E17F6C5; Mon, 17 Dec 2018 23:18:15 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id C48F25D9C5; Mon, 17 Dec 2018 23:18:13 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:57 +0100 Message-Id: <20181217231700.24482-33-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Dec 2018 23:18:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 32/35] hw/watchdog/wdt_i6300esb: remove a unnecessary comment X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peng Hao Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peng Hao The registered memory region of i6300esb is not suitable for coalesced mmio, because a write for the region may trigger an immediate action and can't be delayed. Signed-off-by: Peng Hao Message-Id: <1544253511-82742-1-git-send-email-peng.hao2@zte.com.cn> Signed-off-by: Paolo Bonzini --- hw/watchdog/wdt_i6300esb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 7b59469888..1c6eddf86a 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -449,7 +449,6 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp) memory_region_init_io(&d->io_mem, OBJECT(d), &i6300esb_ops, d, "i6300esb", 0x10); pci_register_bar(&d->dev, 0, 0, &d->io_mem); - /* qemu_register_coalesced_mmio (addr, 0x10); ? */ } static void i6300esb_exit(PCIDevice *dev) From patchwork Mon Dec 17 23:16:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014886 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd7J0dmLz9s2P for ; Tue, 18 Dec 2018 10:45:16 +1100 (AEDT) Received: from localhost ([::1]:50592 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2ZV-0005ox-L1 for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:45:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29T-0001K4-Fw for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29S-00056H-M9 for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48252) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29S-00055j-GL for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:18 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F7FE5D608 for ; Mon, 17 Dec 2018 23:18:17 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDD985D9C5 for ; Mon, 17 Dec 2018 23:18:15 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:58 +0100 Message-Id: <20181217231700.24482-34-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 17 Dec 2018 23:18:17 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 33/35] scripts: add script to convert multiline comments into 4-line format X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Since we're adding checkpatch rules to enforce 4-line multiline comment format, i.e. with lone /* and */, this script can be run on existing code so that the comment style does not become inconsistent within a file. The alternative to awk-in-a-shell-script could be Perl, which also supports -i directly, but a2p seems to have bitrotten and I didn't quite feel like writing this twice... Signed-off-by: Paolo Bonzini --- scripts/fix-multiline-comments.sh | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 scripts/fix-multiline-comments.sh diff --git a/scripts/fix-multiline-comments.sh b/scripts/fix-multiline-comments.sh new file mode 100755 index 0000000000..93f9b10669 --- /dev/null +++ b/scripts/fix-multiline-comments.sh @@ -0,0 +1,62 @@ +#! /bin/sh +# +# Fix multiline comments to match CODING_STYLE +# +# Copyright (C) 2018 Red Hat, Inc. +# +# Author: Paolo Bonzini +# +# Usage: scripts/fix-multiline-comments.sh [-i] FILE... +# +# -i edits the file in place (requires gawk 4.1.0). +# +# Set the AWK environment variable to choose the awk interpreter to use +# (default 'awk') + +if test "$1" = -i; then + # gawk extension + inplace="-i inplace" + shift +fi +${AWK-awk} $inplace 'BEGIN { indent = -1 } +{ + line = $0 + # apply a star to the indent on lines after the first + if (indent != -1) { + if (line == "") { + line = sp " *" + } else if (substr(line, 1, indent + 2) == sp " ") { + line = sp " *" substr(line, indent + 3) + } + } + + is_lead = (line ~ /^[ \t]*\/\*/) + is_trail = (line ~ /\*\//) + if (is_lead && !is_trail) { + # grab the indent at the start of a comment, but not for + # single-line comments + match(line, /^[ \t]*\/\*/) + indent = RLENGTH - 2 + sp = substr(line, 1, indent) + } + + # the regular expression filters out lone /*, /**, or */ + if (indent != -1 && !(line ~ /^[ \t]*(\/\*+|\*\/)[ \t]*$/)) { + if (is_lead) { + # split the leading /* or /** on a separate line + match(line, /^[ \t]*\/\*+/) + lead = substr(line, 1, RLENGTH) + match(line, /^[ \t]*\/\*+[ \t]*/) + line = lead "\n" sp " *" substr(line, RLENGTH) + } + if (is_trail) { + # split the trailing */ on a separate line + match(line, /[ \t]*\*\//) + line = substr(line, 1, RSTART - 1) "\n" sp " */" + } + } + if (is_trail) { + indent = -1 + } + print line +}' "$@" From patchwork Mon Dec 17 23:16:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014888 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43JdBQ25wjz9s4s for ; Tue, 18 Dec 2018 10:47:58 +1100 (AEDT) Received: from localhost ([::1]:50611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2c7-00089m-Qw for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:47:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ29a-0001PP-NW for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ29X-00057m-GI for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ29X-00057W-7j for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:23 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 954AE1393F7; Mon, 17 Dec 2018 23:18:22 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E1005D9C5; Mon, 17 Dec 2018 23:18:17 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:16:59 +0100 Message-Id: <20181217231700.24482-35-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Dec 2018 23:18:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 34/35] remove space-tab sequences X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Henderson , Wainer dos Santos Moschetta Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There are not many, and they are all simple mistakes that ended up being committed. Remove them. Signed-off-by: Paolo Bonzini Message-Id: <20181213223737.11793-2-pbonzini@redhat.com> Reviewed-by: Wainer dos Santos Moschetta Acked-by: Richard Henderson Signed-off-by: Paolo Bonzini --- bsd-user/x86_64/target_syscall.h | 2 +- crypto/aes.c | 28 ++++++++++++++-------------- disas/alpha.c | 8 ++++---- disas/arm.c | 2 +- disas/i386.c | 4 ++-- disas/m68k.c | 4 ++-- hw/usb/hcd-uhci.c | 4 ++-- include/hw/elf_ops.h | 2 +- linux-user/linuxload.c | 2 +- linux-user/syscall.c | 2 +- linux-user/syscall_defs.h | 4 ++-- linux-user/x86_64/target_syscall.h | 2 +- slirp/ip_input.c | 4 ++-- slirp/tcp_input.c | 10 +++++----- slirp/tcp_output.c | 4 ++-- slirp/tcp_timer.c | 2 +- slirp/udp.c | 2 +- tests/tcg/arm/hello-arm.c | 10 +++++----- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/bsd-user/x86_64/target_syscall.h b/bsd-user/x86_64/target_syscall.h index 211ce29e90..a5d779884f 100644 --- a/bsd-user/x86_64/target_syscall.h +++ b/bsd-user/x86_64/target_syscall.h @@ -12,7 +12,7 @@ struct target_pt_regs { abi_ulong rbp; abi_ulong rbx; /* arguments: non interrupts/non tracing syscalls only save up to here */ - abi_ulong r11; + abi_ulong r11; abi_ulong r10; abi_ulong r9; abi_ulong r8; diff --git a/crypto/aes.c b/crypto/aes.c index 3456eacd08..773d246b00 100644 --- a/crypto/aes.c +++ b/crypto/aes.c @@ -1071,7 +1071,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key) { u32 *rk; - int i = 0; + int i = 0; u32 temp; if (!userKey || !key) @@ -1160,7 +1160,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits, rk[15] = rk[ 7] ^ rk[14]; rk += 8; - } + } } abort(); } @@ -1247,7 +1247,7 @@ void AES_encrypt(const unsigned char *in, unsigned char *out, t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[ 5]; t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[ 6]; t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[ 7]; - /* round 2: */ + /* round 2: */ s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[ 8]; s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[ 9]; s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[10]; @@ -1257,7 +1257,7 @@ void AES_encrypt(const unsigned char *in, unsigned char *out, t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[13]; t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[14]; t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[15]; - /* round 4: */ + /* round 4: */ s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[16]; s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[17]; s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[18]; @@ -1267,7 +1267,7 @@ void AES_encrypt(const unsigned char *in, unsigned char *out, t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[21]; t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[22]; t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[23]; - /* round 6: */ + /* round 6: */ s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[24]; s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[25]; s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[26]; @@ -1277,7 +1277,7 @@ void AES_encrypt(const unsigned char *in, unsigned char *out, t1 = AES_Te0[s1 >> 24] ^ AES_Te1[(s2 >> 16) & 0xff] ^ AES_Te2[(s3 >> 8) & 0xff] ^ AES_Te3[s0 & 0xff] ^ rk[29]; t2 = AES_Te0[s2 >> 24] ^ AES_Te1[(s3 >> 16) & 0xff] ^ AES_Te2[(s0 >> 8) & 0xff] ^ AES_Te3[s1 & 0xff] ^ rk[30]; t3 = AES_Te0[s3 >> 24] ^ AES_Te1[(s0 >> 16) & 0xff] ^ AES_Te2[(s1 >> 8) & 0xff] ^ AES_Te3[s2 & 0xff] ^ rk[31]; - /* round 8: */ + /* round 8: */ s0 = AES_Te0[t0 >> 24] ^ AES_Te1[(t1 >> 16) & 0xff] ^ AES_Te2[(t2 >> 8) & 0xff] ^ AES_Te3[t3 & 0xff] ^ rk[32]; s1 = AES_Te0[t1 >> 24] ^ AES_Te1[(t2 >> 16) & 0xff] ^ AES_Te2[(t3 >> 8) & 0xff] ^ AES_Te3[t0 & 0xff] ^ rk[33]; s2 = AES_Te0[t2 >> 24] ^ AES_Te1[(t3 >> 16) & 0xff] ^ AES_Te2[(t0 >> 8) & 0xff] ^ AES_Te3[t1 & 0xff] ^ rk[34]; @@ -1569,33 +1569,33 @@ void AES_decrypt(const unsigned char *in, unsigned char *out, * apply last round and * map cipher state to byte array block: */ - s0 = + s0 = (AES_Td4[(t0 >> 24) ] & 0xff000000) ^ (AES_Td4[(t3 >> 16) & 0xff] & 0x00ff0000) ^ (AES_Td4[(t2 >> 8) & 0xff] & 0x0000ff00) ^ (AES_Td4[(t1 ) & 0xff] & 0x000000ff) ^ - rk[0]; + rk[0]; PUTU32(out , s0); - s1 = + s1 = (AES_Td4[(t1 >> 24) ] & 0xff000000) ^ (AES_Td4[(t0 >> 16) & 0xff] & 0x00ff0000) ^ (AES_Td4[(t3 >> 8) & 0xff] & 0x0000ff00) ^ (AES_Td4[(t2 ) & 0xff] & 0x000000ff) ^ - rk[1]; + rk[1]; PUTU32(out + 4, s1); - s2 = + s2 = (AES_Td4[(t2 >> 24) ] & 0xff000000) ^ (AES_Td4[(t1 >> 16) & 0xff] & 0x00ff0000) ^ (AES_Td4[(t0 >> 8) & 0xff] & 0x0000ff00) ^ (AES_Td4[(t3 ) & 0xff] & 0x000000ff) ^ - rk[2]; + rk[2]; PUTU32(out + 8, s2); - s3 = + s3 = (AES_Td4[(t3 >> 24) ] & 0xff000000) ^ (AES_Td4[(t2 >> 16) & 0xff] & 0x00ff0000) ^ (AES_Td4[(t1 >> 8) & 0xff] & 0x0000ff00) ^ (AES_Td4[(t0 ) & 0xff] & 0x000000ff) ^ - rk[3]; + rk[3]; PUTU32(out + 12, s3); } diff --git a/disas/alpha.c b/disas/alpha.c index b7b0ae0d92..a0c9ecd49d 100644 --- a/disas/alpha.c +++ b/disas/alpha.c @@ -672,7 +672,7 @@ extract_ev6hwjhint(unsigned insn, int *invalid ATTRIBUTE_UNUSED) OPCODE is the instruction opcode. MASK is the opcode mask; this is used to tell the disassembler - which bits in the actual opcode must match OPCODE. + which bits in the actual opcode must match OPCODE. OPERANDS is the list of operands. @@ -699,10 +699,10 @@ extract_ev6hwjhint(unsigned insn, int *invalid ATTRIBUTE_UNUSED) And two annotations: EV56 BUT opcodes that are officially introduced as of the ev56, - but with defined results on previous implementations. + but with defined results on previous implementations. EV56 UNA opcodes that were introduced as of the ev56 with - presumably undefined results on previous implementations + presumably undefined results on previous implementations that were not assigned to a particular extension. */ @@ -832,7 +832,7 @@ const struct alpha_opcode alpha_opcodes[] = { { "cmovgt", OPR(0x11,0x66), BASE, ARG_OPR }, { "cmovgt", OPRL(0x11,0x66), BASE, ARG_OPRL }, { "implver", OPRL_(0x11,0x6C)|(31<<21)|(1<<13), - 0xFFFFFFE0, BASE, { RC } }, /* ev56 but */ + 0xFFFFFFE0, BASE, { RC } }, /* ev56 but */ { "mskbl", OPR(0x12,0x02), BASE, ARG_OPR }, { "mskbl", OPRL(0x12,0x02), BASE, ARG_OPRL }, diff --git a/disas/arm.c b/disas/arm.c index dda7b2a943..17ea120b44 100644 --- a/disas/arm.c +++ b/disas/arm.c @@ -1077,7 +1077,7 @@ static const struct opcode32 arm_opcodes[] = %S print Thumb register (bits 3..5 as high number if bit 6 set) %D print Thumb register (bits 0..2 as high number if bit 7 set) %I print bitfield as a signed decimal - (top bit of range being the sign bit) + (top bit of range being the sign bit) %N print Thumb register mask (with LR) %O print Thumb register mask (with PC) %M print Thumb register mask diff --git a/disas/i386.c b/disas/i386.c index a557e678ec..fc03b9f06a 100644 --- a/disas/i386.c +++ b/disas/i386.c @@ -6075,7 +6075,7 @@ OP_EM (int bytemode, int sizeflag) { bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode; used_prefixes |= (prefixes & PREFIX_DATA); - } + } OP_E (bytemode, sizeflag); return; } @@ -6112,7 +6112,7 @@ OP_EMC (int bytemode, int sizeflag) { bytemode = (prefixes & PREFIX_DATA) ? x_mode : q_mode; used_prefixes |= (prefixes & PREFIX_DATA); - } + } OP_E (bytemode, sizeflag); return; } diff --git a/disas/m68k.c b/disas/m68k.c index 0dc8aa1a3c..e544c7137f 100644 --- a/disas/m68k.c +++ b/disas/m68k.c @@ -350,7 +350,7 @@ struct m68k_opcode_alias * all (modes 0-6,7.0-4) ~ alterable memory (modes 2-6,7.0,7.1) - (not 0,1,7.2-4) + (not 0,1,7.2-4) % alterable (modes 0-6,7.0,7.1) (not 7.2-4) ; data (modes 0,2-6,7.0-4) @@ -1647,7 +1647,7 @@ print_insn_arg (const char *d, case 0x15: name = "%val"; break; case 0x16: name = "%scc"; break; case 0x17: name = "%ac"; break; - case 0x18: name = "%psr"; break; + case 0x18: name = "%psr"; break; case 0x19: name = "%pcsr"; break; case 0x1c: case 0x1d: diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 26f123ed78..e694b62086 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -1056,8 +1056,8 @@ static void uhci_process_frame(UHCIState *s) link = qh.link; } else { /* QH with elements */ - curr_qh = link; - link = qh.el_link; + curr_qh = link; + link = qh.el_link; } continue; } diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 81cecaf27e..3b6398cb39 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -343,7 +343,7 @@ static int glue(load_elf, SZ)(const char *name, int fd, } if (pentry) - *pentry = (uint64_t)(elf_sword)ehdr.e_entry; + *pentry = (uint64_t)(elf_sword)ehdr.e_entry; glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb, sym_cb); diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 6f0d6054ce..6717c9c6f0 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -54,7 +54,7 @@ static int prepare_binprm(struct linux_binprm *bprm) /* Set-uid? */ if(mode & S_ISUID) { - bprm->e_uid = st.st_uid; + bprm->e_uid = st.st_uid; } /* Set-gid? */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 280137da8c..5c53e84b7a 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -902,7 +902,7 @@ abi_long do_brk(abi_ulong new_brk) } target_brk = new_brk; DEBUGF_BRK(TARGET_ABI_FMT_lx " (new_brk <= brk_page)\n", target_brk); - return target_brk; + return target_brk; } /* We need to allocate more memory after the brk... Note that diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index 99bbce083c..12c8407144 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -1807,7 +1807,7 @@ struct target_stat { abi_ulong st_rdev; abi_long st_size; abi_long st_blksize; - abi_long st_blocks; /* Number 512-byte blocks allocated. */ + abi_long st_blocks; /* Number 512-byte blocks allocated. */ abi_ulong target_st_atime; abi_ulong target_st_atime_nsec; @@ -1816,7 +1816,7 @@ struct target_stat { abi_ulong target_st_ctime; abi_ulong target_st_ctime_nsec; - abi_long __unused[3]; + abi_long __unused[3]; }; #elif defined(TARGET_S390X) struct target_stat { diff --git a/linux-user/x86_64/target_syscall.h b/linux-user/x86_64/target_syscall.h index 983fb23d9b..5e221e1d9d 100644 --- a/linux-user/x86_64/target_syscall.h +++ b/linux-user/x86_64/target_syscall.h @@ -12,7 +12,7 @@ struct target_pt_regs { abi_ulong rbp; abi_ulong rbx; /* arguments: non interrupts/non tracing syscalls only save up to here */ - abi_ulong r11; + abi_ulong r11; abi_ulong r10; abi_ulong r9; abi_ulong r8; diff --git a/slirp/ip_input.c b/slirp/ip_input.c index 348e1dca5a..094a807d41 100644 --- a/slirp/ip_input.c +++ b/slirp/ip_input.c @@ -193,7 +193,7 @@ ip_input(struct mbuf *m) m = dtom(slirp, ip); } else if (fp) - ip_freef(slirp, fp); + ip_freef(slirp, fp); } else ip->ip_len -= hlen; @@ -537,7 +537,7 @@ typedef uint32_t n_time; if (opt == IPOPT_SSRR) { #define INA struct in_ifaddr * #define SA struct sockaddr * - if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) + if ((ia = (INA)ifa_ifwithdstaddr((SA)&ipaddr)) == 0) ia = (INA)ifa_ifwithnet((SA)&ipaddr); } else ia = ip_rtaddr(ipaddr.sin_addr); diff --git a/slirp/tcp_input.c b/slirp/tcp_input.c index d073ef9525..09bdf9b482 100644 --- a/slirp/tcp_input.c +++ b/slirp/tcp_input.c @@ -74,7 +74,7 @@ if (so->so_emu) { \ if (tcp_emu((so),(m))) sbappend((so), (m)); \ } else \ - sbappend((so), (m)); \ + sbappend((so), (m)); \ } else {\ (flags) = tcp_reass((tp), (ti), (m)); \ tp->t_flags |= TF_ACKNOW; \ @@ -1175,7 +1175,7 @@ trimthenstep6: } break; - /* + /* * In CLOSING STATE in addition to the processing for * the ESTABLISHED state if the ACK acknowledges our FIN * then enter the TIME-WAIT state, otherwise ignore @@ -1325,7 +1325,7 @@ dodata: } switch (tp->t_state) { - /* + /* * In SYN_RECEIVED and ESTABLISHED STATES * enter the CLOSE_WAIT state. */ @@ -1337,7 +1337,7 @@ dodata: tp->t_state = TCPS_CLOSE_WAIT; break; - /* + /* * If still in FIN_WAIT_1 STATE FIN has not been acked so * enter the CLOSING state. */ @@ -1345,7 +1345,7 @@ dodata: tp->t_state = TCPS_CLOSING; break; - /* + /* * In FIN_WAIT_2 state enter the TIME_WAIT state, * starting the time-wait timer, turning off the other * standard timers. diff --git a/slirp/tcp_output.c b/slirp/tcp_output.c index 90b5c376f7..c835432812 100644 --- a/slirp/tcp_output.c +++ b/slirp/tcp_output.c @@ -275,9 +275,9 @@ send: memcpy((caddr_t)(opt + 2), (caddr_t)&mss, sizeof(mss)); optlen = 4; } - } + } - hdrlen += optlen; + hdrlen += optlen; /* * Adjust data length if insertion of options will diff --git a/slirp/tcp_timer.c b/slirp/tcp_timer.c index 52ef5f9100..dc8288b511 100644 --- a/slirp/tcp_timer.c +++ b/slirp/tcp_timer.c @@ -263,7 +263,7 @@ tcp_timers(register struct tcpcb *tp, int timer) goto dropit; if ((SO_OPTIONS) && tp->t_state <= TCPS_CLOSE_WAIT) { - if (tp->t_idle >= TCPTV_KEEP_IDLE + TCP_MAXIDLE) + if (tp->t_idle >= TCPTV_KEEP_IDLE + TCP_MAXIDLE) goto dropit; /* * Send a packet designed to force a response diff --git a/slirp/udp.c b/slirp/udp.c index c47870a61b..5bb196c907 100644 --- a/slirp/udp.c +++ b/slirp/udp.c @@ -310,7 +310,7 @@ udp_tos(struct socket *so) while(udptos[i].tos) { if ((udptos[i].fport && ntohs(so->so_fport) == udptos[i].fport) || (udptos[i].lport && ntohs(so->so_lport) == udptos[i].lport)) { - so->so_emu = udptos[i].emu; + so->so_emu = udptos[i].emu; return udptos[i].tos; } i++; diff --git a/tests/tcg/arm/hello-arm.c b/tests/tcg/arm/hello-arm.c index e0daa7ad98..6e5a93bccf 100644 --- a/tests/tcg/arm/hello-arm.c +++ b/tests/tcg/arm/hello-arm.c @@ -78,9 +78,9 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ "mov\tr3,%4\n\t" \ __syscall(name) \ "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)) \ - : "r0","r1","r2","r3","lr"); \ + : "=r" (__res) \ + : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)) \ + : "r0","r1","r2","r3","lr"); \ __syscall_return(type,__res); \ } @@ -96,8 +96,8 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ "mov\tr4,%5\n\t" \ __syscall(name) \ "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)), \ + : "=r" (__res) \ + : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)), \ "r" ((long)(arg5)) \ : "r0","r1","r2","r3","r4","lr"); \ __syscall_return(type,__res); \ From patchwork Mon Dec 17 23:17:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1014883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Jd6L43pWz9s2P for ; Tue, 18 Dec 2018 10:44:26 +1100 (AEDT) Received: from localhost ([::1]:50587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2Yh-00054n-WE for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2018 18:44:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZ2AB-0001qD-1D for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:19:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZ2A3-0005LN-9D for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:19:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33002) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gZ2A2-0005L1-QN for qemu-devel@nongnu.org; Mon, 17 Dec 2018 18:18:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15A4A83F7B; Mon, 17 Dec 2018 23:18:54 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.112.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB19E5D9C8; Mon, 17 Dec 2018 23:18:22 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 18 Dec 2018 00:17:00 +0100 Message-Id: <20181217231700.24482-36-pbonzini@redhat.com> In-Reply-To: <20181217231700.24482-1-pbonzini@redhat.com> References: <20181217231700.24482-1-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Dec 2018 23:18:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 35/35] avoid TABs in files that only contain a few X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Aleksandar Markovic , "Michael S . Tsirkin" , Stefan Markovic , =?utf-8?q?Alex_Benn=C3=A9e?= , Richard Henderson , Wainer dos Santos Moschetta , Stefan Hajnoczi , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Most files that have TABs only contain a handful of them. Change them to spaces so that we don't confuse people. disas, standard-headers, linux-headers and libdecnumber are imported from other projects and probably should be exempted from the check. Outside those, after this patch the following files still contain both 8-space and TAB sequences at the beginning of the line. Many of them have a majority of TABs, or were initially committed with all tabs. bsd-user/i386/target_syscall.h bsd-user/x86_64/target_syscall.h crypto/aes.c hw/audio/fmopl.c hw/audio/fmopl.h hw/block/tc58128.c hw/display/cirrus_vga.c hw/display/xenfb.c hw/dma/etraxfs_dma.c hw/intc/sh_intc.c hw/misc/mst_fpga.c hw/net/pcnet.c hw/sh4/sh7750.c hw/timer/m48t59.c hw/timer/sh_timer.c include/crypto/aes.h include/disas/bfd.h include/hw/sh4/sh.h libdecnumber/decNumber.c linux-headers/asm-generic/unistd.h linux-headers/linux/kvm.h linux-user/alpha/target_syscall.h linux-user/arm/nwfpe/double_cpdo.c linux-user/arm/nwfpe/fpa11_cpdt.c linux-user/arm/nwfpe/fpa11_cprt.c linux-user/arm/nwfpe/fpa11.h linux-user/flat.h linux-user/flatload.c linux-user/i386/target_syscall.h linux-user/ppc/target_syscall.h linux-user/sparc/target_syscall.h linux-user/syscall.c linux-user/syscall_defs.h linux-user/x86_64/target_syscall.h slirp/cksum.c slirp/if.c slirp/ip.h slirp/ip_icmp.c slirp/ip_icmp.h slirp/ip_input.c slirp/ip_output.c slirp/mbuf.c slirp/misc.c slirp/sbuf.c slirp/socket.c slirp/socket.h slirp/tcp_input.c slirp/tcpip.h slirp/tcp_output.c slirp/tcp_subr.c slirp/tcp_timer.c slirp/tftp.c slirp/udp.c slirp/udp.h target/cris/cpu.h target/cris/mmu.c target/cris/op_helper.c target/sh4/helper.c target/sh4/op_helper.c target/sh4/translate.c tcg/sparc/tcg-target.inc.c tests/tcg/cris/check_addo.c tests/tcg/cris/check_moveq.c tests/tcg/cris/check_swap.c tests/tcg/multiarch/test-mmap.c ui/vnc-enc-hextile-template.h ui/vnc-enc-zywrle.h util/envlist.c util/readline.c The following have only TABs: bsd-user/i386/target_signal.h bsd-user/sparc64/target_signal.h bsd-user/sparc64/target_syscall.h bsd-user/sparc/target_signal.h bsd-user/sparc/target_syscall.h bsd-user/x86_64/target_signal.h crypto/desrfb.c hw/audio/intel-hda-defs.h hw/core/uboot_image.h hw/sh4/sh7750_regnames.c hw/sh4/sh7750_regs.h include/hw/cris/etraxfs_dma.h linux-user/alpha/termbits.h linux-user/arm/nwfpe/fpopcode.h linux-user/arm/nwfpe/fpsr.h linux-user/arm/syscall_nr.h linux-user/arm/target_signal.h linux-user/cris/target_signal.h linux-user/i386/target_signal.h linux-user/linux_loop.h linux-user/m68k/target_signal.h linux-user/microblaze/target_signal.h linux-user/mips64/target_signal.h linux-user/mips/target_signal.h linux-user/mips/target_syscall.h linux-user/mips/termbits.h linux-user/ppc/target_signal.h linux-user/sh4/target_signal.h linux-user/sh4/termbits.h linux-user/sparc64/target_syscall.h linux-user/sparc/target_signal.h linux-user/x86_64/target_signal.h linux-user/x86_64/termbits.h pc-bios/optionrom/optionrom.h slirp/mbuf.h slirp/misc.h slirp/sbuf.h slirp/tcp.h slirp/tcp_timer.h slirp/tcp_var.h target/i386/svm.h target/sparc/asi.h target/xtensa/core-dc232b/xtensa-modules.inc.c target/xtensa/core-dc233c/xtensa-modules.inc.c target/xtensa/core-de212/core-isa.h target/xtensa/core-de212/xtensa-modules.inc.c target/xtensa/core-fsf/xtensa-modules.inc.c target/xtensa/core-sample_controller/core-isa.h target/xtensa/core-sample_controller/xtensa-modules.inc.c target/xtensa/core-test_kc705_be/core-isa.h target/xtensa/core-test_kc705_be/xtensa-modules.inc.c tests/tcg/cris/check_abs.c tests/tcg/cris/check_addc.c tests/tcg/cris/check_addcm.c tests/tcg/cris/check_addoq.c tests/tcg/cris/check_bound.c tests/tcg/cris/check_ftag.c tests/tcg/cris/check_int64.c tests/tcg/cris/check_lz.c tests/tcg/cris/check_openpf5.c tests/tcg/cris/check_sigalrm.c tests/tcg/cris/crisutils.h tests/tcg/cris/sys.c tests/tcg/i386/test-i386-ssse3.c ui/vgafont.h Signed-off-by: Paolo Bonzini Message-Id: <20181213223737.11793-3-pbonzini@redhat.com> Reviewed-by: Aleksandar Markovic Reviewed-by: Stefan Hajnoczi Reviewed-by: Wainer dos Santos Moschetta Acked-by: Richard Henderson Acked-by: Eric Blake Acked-by: David Gibson Reviewed-by: Stefan Markovic Reviewed-by: Michael S. Tsirkin Reviewed-by: Alex Bennée Signed-off-by: Paolo Bonzini --- block/bochs.c | 22 ++--- block/file-posix.c | 2 +- block/file-win32.c | 8 +- block/linux-aio.c | 4 +- block/qcow2-cluster.c | 2 +- block/vpc.c | 2 +- bsd-user/elfload.c | 2 +- contrib/elf2dmp/main.c | 2 +- hw/alpha/typhoon.c | 12 +-- hw/arm/stellaris.c | 2 +- hw/arm/virt.c | 2 +- hw/char/sh_serial.c | 18 ++--- hw/char/virtio-serial-bus.c | 2 +- hw/char/xen_console.c | 58 ++++++------- hw/core/loader.c | 28 +++---- hw/display/tc6393xb.c | 6 +- hw/display/vga.c | 8 +- hw/display/virtio-gpu-3d.c | 6 +- hw/dma/pxa2xx_dma.c | 4 +- hw/dma/soc_dma.c | 2 +- hw/gpio/max7310.c | 2 +- hw/i386/xen/xen-hvm.c | 4 +- hw/ide/core.c | 94 +++++++++++----------- hw/input/lm832x.c | 2 +- hw/input/pckbd.c | 2 +- hw/input/tsc210x.c | 2 +- hw/intc/apic.c | 2 +- hw/mips/gt64xxx_pci.c | 6 +- hw/mips/mips_r4k.c | 4 +- hw/misc/max111x.c | 6 +- hw/misc/omap_l4.c | 4 +- hw/net/mipsnet.c | 16 ++-- hw/net/ne2000.c | 44 +++++----- hw/net/rocker/rocker.c | 2 +- hw/net/virtio-net.c | 4 +- hw/net/vmxnet3.c | 6 +- hw/pci/msix.c | 2 +- hw/pci/pci.c | 44 +++++----- hw/pci/pci_bridge.c | 2 +- hw/ppc/ppc405_uc.c | 2 +- hw/ppc/prep.c | 4 +- hw/scsi/lsi53c895a.c | 6 +- hw/sh4/r2d.c | 16 ++-- hw/usb/dev-bluetooth.c | 2 +- hw/usb/dev-hid.c | 6 +- hw/usb/dev-hub.c | 14 ++-- hw/xen/xen_devconfig.c | 2 +- hw/xenpv/xen_domainbuild.c | 8 +- include/elf.h | 10 +-- include/hw/acpi/acpi.h | 14 ++-- include/hw/elf_ops.h | 2 +- include/hw/ide/internal.h | 2 +- include/hw/sh4/sh_intc.h | 20 ++--- include/hw/xen/io/ring.h | 4 +- include/qemu/acl.h | 14 ++-- include/qemu/iov.h | 2 +- include/scsi/constants.h | 2 +- include/sysemu/balloon.h | 2 +- linux-user/linuxload.c | 14 ++-- linux-user/main.c | 4 +- linux-user/mmap.c | 10 +-- linux-user/qemu.h | 4 +- linux-user/signal.c | 16 ++-- linux-user/strace.c | 4 +- linux-user/uaccess.c | 2 +- linux-user/vm86.c | 2 +- nbd/client.c | 2 +- net/checksum.c | 2 +- qtest.c | 4 +- target/alpha/translate.c | 2 +- target/cris/helper.c | 2 +- target/cris/mmu.h | 10 +-- target/cris/translate_v10.inc.c | 2 +- target/i386/translate.c | 12 +-- target/mips/translate.c | 2 +- target/tilegx/translate.c | 2 +- tcg/i386/tcg-target.inc.c | 4 +- tests/tcg/alpha/test-cond.c | 4 +- tests/tcg/arm/hello-arm.c | 20 ++--- tests/tcg/cris/check_glibc_kernelversion.c | 8 +- tests/tcg/cris/check_mmap3.c | 2 +- tests/tcg/cris/check_openpf1.c | 2 +- tests/tcg/cris/check_settls1.c | 2 +- tests/tcg/i386/hello-i386.c | 14 ++-- tests/tcg/mips/hello-mips.c | 10 +-- tests/tcg/multiarch/sha1.c | 12 +-- tests/vhost-user-test.c | 4 +- ui/keymaps.h | 4 +- ui/qemu-pixman.c | 2 +- ui/vnc-enc-zywrle-template.c | 4 +- ui/vnc.c | 4 +- util/bitops.c | 4 +- util/osdep.c | 4 +- util/qemu-sockets.c | 4 +- 94 files changed, 388 insertions(+), 388 deletions(-) diff --git a/block/bochs.c b/block/bochs.c index 22e7d44211..79f95d3b50 100644 --- a/block/bochs.c +++ b/block/bochs.c @@ -85,14 +85,14 @@ static int bochs_probe(const uint8_t *buf, int buf_size, const char *filename) const struct bochs_header *bochs = (const void *)buf; if (buf_size < HEADER_SIZE) - return 0; + return 0; if (!strcmp(bochs->magic, HEADER_MAGIC) && - !strcmp(bochs->type, REDOLOG_TYPE) && - !strcmp(bochs->subtype, GROWING_TYPE) && - ((le32_to_cpu(bochs->version) == HEADER_VERSION) || - (le32_to_cpu(bochs->version) == HEADER_V1))) - return 100; + !strcmp(bochs->type, REDOLOG_TYPE) && + !strcmp(bochs->subtype, GROWING_TYPE) && + ((le32_to_cpu(bochs->version) == HEADER_VERSION) || + (le32_to_cpu(bochs->version) == HEADER_V1))) + return 100; return 0; } @@ -125,8 +125,8 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, if (strcmp(bochs.magic, HEADER_MAGIC) || strcmp(bochs.type, REDOLOG_TYPE) || strcmp(bochs.subtype, GROWING_TYPE) || - ((le32_to_cpu(bochs.version) != HEADER_VERSION) && - (le32_to_cpu(bochs.version) != HEADER_V1))) { + ((le32_to_cpu(bochs.version) != HEADER_VERSION) && + (le32_to_cpu(bochs.version) != HEADER_V1))) { error_setg(errp, "Image not in Bochs format"); return -EINVAL; } @@ -158,7 +158,7 @@ static int bochs_open(BlockDriverState *bs, QDict *options, int flags, } for (i = 0; i < s->catalog_size; i++) - le32_to_cpus(&s->catalog_bitmap[i]); + le32_to_cpus(&s->catalog_bitmap[i]); s->data_offset = le32_to_cpu(bochs.header) + (s->catalog_size * 4); @@ -217,7 +217,7 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num) extent_offset = (offset % s->extent_size) / 512; if (s->catalog_bitmap[extent_index] == 0xffffffff) { - return 0; /* not allocated */ + return 0; /* not allocated */ } bitmap_offset = s->data_offset + @@ -232,7 +232,7 @@ static int64_t seek_to_sector(BlockDriverState *bs, int64_t sector_num) } if (!((bitmap_entry >> (extent_offset % 8)) & 1)) { - return 0; /* not allocated */ + return 0; /* not allocated */ } return bitmap_offset + (512 * (s->bitmap_blocks + extent_offset)); diff --git a/block/file-posix.c b/block/file-posix.c index 07bbdab953..5c66c3b2bc 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2117,7 +2117,7 @@ again: #endif if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { #ifdef DIOCGMEDIASIZE - if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) + if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) #elif defined(DIOCGPART) { struct partinfo pi; diff --git a/block/file-win32.c b/block/file-win32.c index f1e2187f3b..6b2d67b239 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -176,7 +176,7 @@ int qemu_ftruncate64(int fd, int64_t length) BOOL res; if ((GetVersion() & 0x80000000UL) && (length >> 32) != 0) - return -1; + return -1; h = (HANDLE)_get_osfhandle(fd); @@ -184,13 +184,13 @@ int qemu_ftruncate64(int fd, int64_t length) li.HighPart = 0; li.LowPart = SetFilePointer (h, 0, &li.HighPart, FILE_CURRENT); if (li.LowPart == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { - return -1; + return -1; } high = length >> 32; dw = SetFilePointer(h, (DWORD) length, &high, FILE_BEGIN); if (dw == INVALID_SET_FILE_POINTER && GetLastError() != NO_ERROR) { - return -1; + return -1; } res = SetEndOfFile(h); @@ -203,7 +203,7 @@ static int set_sparse(int fd) { DWORD returned; return (int) DeviceIoControl((HANDLE)_get_osfhandle(fd), FSCTL_SET_SPARSE, - NULL, 0, NULL, 0, &returned, NULL); + NULL, 0, NULL, 0, &returned, NULL); } static void raw_detach_aio_context(BlockDriverState *bs) diff --git a/block/linux-aio.c b/block/linux-aio.c index 217ce60138..d4b61fb251 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -384,10 +384,10 @@ static int laio_do_submit(int fd, struct qemu_laiocb *laiocb, off_t offset, switch (type) { case QEMU_AIO_WRITE: io_prep_pwritev(iocbs, fd, qiov->iov, qiov->niov, offset); - break; + break; case QEMU_AIO_READ: io_prep_preadv(iocbs, fd, qiov->iov, qiov->niov, offset); - break; + break; /* Currently Linux kernel does not support other operations */ default: fprintf(stderr, "%s: invalid AIO request type 0x%x.\n", diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index d37fe08b3d..0145ce5218 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -402,7 +402,7 @@ static int count_contiguous_clusters(int nb_clusters, int cluster_size, } } - return i; + return i; } /* diff --git a/block/vpc.c b/block/vpc.c index 80c5b2b197..d886465b7e 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -187,7 +187,7 @@ static uint32_t vpc_checksum(uint8_t* buf, size_t size) static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename) { if (buf_size >= 8 && !strncmp((char *)buf, "conectix", 8)) - return 100; + return 100; return 0; } diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 7cccf3eb8b..32378af7b2 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1367,7 +1367,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs, if (!have_guest_base) { /* * Go through ELF program header table and find out whether - * any of the segments drop below our current mmap_min_addr and + * any of the segments drop below our current mmap_min_addr and * in that case set guest_base to corresponding address. */ for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; diff --git a/contrib/elf2dmp/main.c b/contrib/elf2dmp/main.c index 9b93dab662..7115b0d6d0 100644 --- a/contrib/elf2dmp/main.c +++ b/contrib/elf2dmp/main.c @@ -296,7 +296,7 @@ static int fill_header(WinDumpHeader64 *hdr, struct pa_space *ps, static int fill_context(KDDEBUGGER_DATA64 *kdbg, struct va_space *vs, QEMU_Elf *qe) { - int i; + int i; for (i = 0; i < qe->state_nr; i++) { uint64_t Prcb; uint64_t Context; diff --git a/hw/alpha/typhoon.c b/hw/alpha/typhoon.c index 8004afe45b..ad79638ffa 100644 --- a/hw/alpha/typhoon.c +++ b/hw/alpha/typhoon.c @@ -657,8 +657,8 @@ static bool window_translate(TyphoonWindow *win, hwaddr addr, pte_addr |= (addr & (wsm | 0xfe000)) >> 10; return pte_translate(pte_addr, ret); } else { - /* Direct-mapped translation. */ - return make_iommu_tlbe(tba & ~wsm_ext, wsm_ext, ret); + /* Direct-mapped translation. */ + return make_iommu_tlbe(tba & ~wsm_ext, wsm_ext, ret); } } @@ -693,7 +693,7 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, /* Check the fourth window for DAC disable. */ if ((pchip->win[3].wba & 0x80000000000ull) == 0 - && window_translate(&pchip->win[3], addr, &ret)) { + && window_translate(&pchip->win[3], addr, &ret)) { goto success; } } else { @@ -704,7 +704,7 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, if (pchip->ctl & 0x40) { /* See 10.1.4.4; in particular <39:35> is ignored. */ make_iommu_tlbe(0, 0x007ffffffffull, &ret); - goto success; + goto success; } } @@ -716,8 +716,8 @@ static IOMMUTLBEntry typhoon_translate_iommu(IOMMUMemoryRegion *iommu, pte_addr = pchip->win[3].tba & 0x7ffc00000ull; pte_addr |= (addr & 0xffffe000u) >> 10; if (pte_translate(pte_addr, &ret)) { - goto success; - } + goto success; + } } } } diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 6c69ce79b2..442529cc65 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -131,7 +131,7 @@ static void gptm_tick(void *opaque) s->state |= 1; if ((s->control & 0x20)) { /* Output trigger. */ - qemu_irq_pulse(s->trigger); + qemu_irq_pulse(s->trigger); } if (s->mode[0] & 1) { /* One-shot. */ diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 17f1b49d11..5b678237b7 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1854,7 +1854,7 @@ static const TypeInfo virt_machine_info = { .instance_size = sizeof(VirtMachineState), .class_size = sizeof(VirtMachineClass), .class_init = virt_machine_class_init, - .instance_init = virt_instance_init, + .instance_init = virt_instance_init, .interfaces = (InterfaceInfo[]) { { TYPE_HOTPLUG_HANDLER }, { } diff --git a/hw/char/sh_serial.c b/hw/char/sh_serial.c index 12831561a6..67740b7ee6 100644 --- a/hw/char/sh_serial.c +++ b/hw/char/sh_serial.c @@ -90,7 +90,7 @@ static void sh_serial_write(void *opaque, hwaddr offs, #ifdef DEBUG_SERIAL printf("sh_serial: write offs=0x%02x val=0x%02x\n", - offs, val); + offs, val); #endif switch(offs) { case 0x00: /* SMR */ @@ -98,17 +98,17 @@ static void sh_serial_write(void *opaque, hwaddr offs, return; case 0x04: /* BRR */ s->brr = val; - return; + return; case 0x08: /* SCR */ /* TODO : For SH7751, SCIF mask should be 0xfb. */ s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff); if (!(val & (1 << 5))) s->flags |= SH_SERIAL_FLAG_TEND; if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) { - qemu_set_irq(s->txi, val & (1 << 7)); + qemu_set_irq(s->txi, val & (1 << 7)); } if (!(val & (1 << 6))) { - qemu_set_irq(s->rxi, 0); + qemu_set_irq(s->rxi, 0); } return; case 0x0c: /* FTDR / TDR */ @@ -117,9 +117,9 @@ static void sh_serial_write(void *opaque, hwaddr offs, /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ qemu_chr_fe_write_all(&s->chr, &ch, 1); - } - s->dr = val; - s->flags &= ~SH_SERIAL_FLAG_TDE; + } + s->dr = val; + s->flags &= ~SH_SERIAL_FLAG_TDE; return; #if 0 case 0x14: /* FRDR / RDR */ @@ -210,7 +210,7 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs, break; case 0x04: ret = s->brr; - break; + break; case 0x08: ret = s->scr; break; @@ -288,7 +288,7 @@ static uint64_t sh_serial_read(void *opaque, hwaddr offs, } #ifdef DEBUG_SERIAL printf("sh_serial: read offs=0x%02x val=0x%x\n", - offs, ret); + offs, ret); #endif if (ret & ~((1 << 16) - 1)) { diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index 04e3ebe352..d76351d748 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -696,7 +696,7 @@ static void virtio_serial_save_device(VirtIODevice *vdev, QEMUFile *f) qemu_put_byte(f, port->guest_connected); qemu_put_byte(f, port->host_connected); - elem_popped = 0; + elem_popped = 0; if (port->elem) { elem_popped = 1; } diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index 44f7236382..b1a1e66d5a 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -60,34 +60,34 @@ static void buffer_append(struct XenConsole *con) size = prod - cons; if ((size == 0) || (size > sizeof(intf->out))) - return; + return; if ((buffer->capacity - buffer->size) < size) { - buffer->capacity += (size + 1024); - buffer->data = g_realloc(buffer->data, buffer->capacity); + buffer->capacity += (size + 1024); + buffer->data = g_realloc(buffer->data, buffer->capacity); } while (cons != prod) - buffer->data[buffer->size++] = intf->out[ - MASK_XENCONS_IDX(cons++, intf->out)]; + buffer->data[buffer->size++] = intf->out[ + MASK_XENCONS_IDX(cons++, intf->out)]; xen_mb(); intf->out_cons = cons; xen_pv_send_notify(&con->xendev); if (buffer->max_capacity && - buffer->size > buffer->max_capacity) { - /* Discard the middle of the data. */ + buffer->size > buffer->max_capacity) { + /* Discard the middle of the data. */ - size_t over = buffer->size - buffer->max_capacity; - uint8_t *maxpos = buffer->data + buffer->max_capacity; + size_t over = buffer->size - buffer->max_capacity; + uint8_t *maxpos = buffer->data + buffer->max_capacity; - memmove(maxpos - over, maxpos, over); - buffer->data = g_realloc(buffer->data, buffer->max_capacity); - buffer->size = buffer->capacity = buffer->max_capacity; + memmove(maxpos - over, maxpos, over); + buffer->data = g_realloc(buffer->data, buffer->max_capacity); + buffer->size = buffer->capacity = buffer->max_capacity; - if (buffer->consumed > buffer->max_capacity - over) - buffer->consumed = buffer->max_capacity - over; + if (buffer->consumed > buffer->max_capacity - over) + buffer->consumed = buffer->max_capacity - over; } } @@ -95,8 +95,8 @@ static void buffer_advance(struct buffer *buffer, size_t len) { buffer->consumed += len; if (buffer->consumed == buffer->size) { - buffer->consumed = 0; - buffer->size = 0; + buffer->consumed = 0; + buffer->size = 0; } } @@ -111,7 +111,7 @@ static int ring_free_bytes(struct XenConsole *con) space = prod - cons; if (space > sizeof(intf->in)) - return 0; /* ring is screwed: ignore it */ + return 0; /* ring is screwed: ignore it */ return (sizeof(intf->in) - space); } @@ -132,12 +132,12 @@ static void xencons_receive(void *opaque, const uint8_t *buf, int len) max = ring_free_bytes(con); /* The can_receive() func limits this, but check again anyway */ if (max < len) - len = max; + len = max; prod = intf->in_prod; for (i = 0; i < len; i++) { - intf->in[MASK_XENCONS_IDX(prod++, intf->in)] = - buf[i]; + intf->in[MASK_XENCONS_IDX(prod++, intf->in)] = + buf[i]; } xen_wmb(); intf->in_prod = prod; @@ -228,11 +228,11 @@ static int con_initialise(struct XenDevice *xendev) int limit; if (xenstore_read_int(con->console, "ring-ref", &con->ring_ref) == -1) - return -1; + return -1; if (xenstore_read_int(con->console, "port", &con->xendev.remote_port) == -1) - return -1; + return -1; if (xenstore_read_int(con->console, "limit", &limit) == 0) - con->buffer.max_capacity = limit; + con->buffer.max_capacity = limit; if (!xendev->dev) { xen_pfn_t mfn = con->ring_ref; @@ -244,7 +244,7 @@ static int con_initialise(struct XenDevice *xendev) PROT_READ | PROT_WRITE); } if (!con->sring) - return -1; + return -1; xen_be_bind_evtchn(&con->xendev); qemu_chr_fe_set_handlers(&con->chr, xencons_can_receive, @@ -252,10 +252,10 @@ static int con_initialise(struct XenDevice *xendev) xen_pv_printf(xendev, 1, "ring mfn %d, remote port %d, local port %d, limit %zd\n", - con->ring_ref, - con->xendev.remote_port, - con->xendev.local_port, - con->buffer.max_capacity); + con->ring_ref, + con->xendev.remote_port, + con->xendev.local_port, + con->buffer.max_capacity); return 0; } @@ -282,7 +282,7 @@ static void con_event(struct XenDevice *xendev) buffer_append(con); if (con->buffer.size - con->buffer.consumed) - xencons_send(con); + xencons_send(con); } /* -------------------------------------------------------------------- */ diff --git a/hw/core/loader.c b/hw/core/loader.c index aa0b3fc867..0b7762a062 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -269,26 +269,26 @@ int load_aout(const char *filename, hwaddr addr, int max_sz, case OMAGIC: if (e.a_text + e.a_data > max_sz) goto fail; - lseek(fd, N_TXTOFF(e), SEEK_SET); - size = read_targphys(filename, fd, addr, e.a_text + e.a_data); - if (size < 0) - goto fail; - break; + lseek(fd, N_TXTOFF(e), SEEK_SET); + size = read_targphys(filename, fd, addr, e.a_text + e.a_data); + if (size < 0) + goto fail; + break; case NMAGIC: if (N_DATADDR(e, target_page_size) + e.a_data > max_sz) goto fail; - lseek(fd, N_TXTOFF(e), SEEK_SET); - size = read_targphys(filename, fd, addr, e.a_text); - if (size < 0) - goto fail; + lseek(fd, N_TXTOFF(e), SEEK_SET); + size = read_targphys(filename, fd, addr, e.a_text); + if (size < 0) + goto fail; ret = read_targphys(filename, fd, addr + N_DATADDR(e, target_page_size), e.a_data); - if (ret < 0) - goto fail; - size += ret; - break; + if (ret < 0) + goto fail; + size += ret; + break; default: - goto fail; + goto fail; } close(fd); return size; diff --git a/hw/display/tc6393xb.c b/hw/display/tc6393xb.c index 3360be6f84..e1b1e302f2 100644 --- a/hw/display/tc6393xb.c +++ b/hw/display/tc6393xb.c @@ -319,7 +319,7 @@ static void tc6393xb_scr_writeb(TC6393xbState *s, hwaddr addr, uint32_t value) SCR_REG_B(DEBUG); } fprintf(stderr, "tc6393xb_scr: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } #undef SCR_REG_B #undef SCR_REG_W @@ -358,7 +358,7 @@ static void tc6393xb_nand_cfg_writeb(TC6393xbState *s, hwaddr addr, uint32_t val return; } fprintf(stderr, "tc6393xb_nand_cfg: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } static uint32_t tc6393xb_nand_readb(TC6393xbState *s, hwaddr addr) { @@ -421,7 +421,7 @@ static void tc6393xb_nand_writeb(TC6393xbState *s, hwaddr addr, uint32_t value) return; } fprintf(stderr, "tc6393xb_nand: unhandled write at %08x: %02x\n", - (uint32_t) addr, value & 0xff); + (uint32_t) addr, value & 0xff); } #define BITS 8 diff --git a/hw/display/vga.c b/hw/display/vga.c index 3ba3f6853c..910a23c12e 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -85,10 +85,10 @@ const uint8_t gr_mask[16] = { #define cbswap_32(__x) \ ((uint32_t)( \ - (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ - (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ - (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ - (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) + (((uint32_t)(__x) & (uint32_t)0x000000ffUL) << 24) | \ + (((uint32_t)(__x) & (uint32_t)0x0000ff00UL) << 8) | \ + (((uint32_t)(__x) & (uint32_t)0x00ff0000UL) >> 8) | \ + (((uint32_t)(__x) & (uint32_t)0xff000000UL) >> 24) )) #ifdef HOST_WORDS_BIGENDIAN #define PAT(x) cbswap_32(x) diff --git a/hw/display/virtio-gpu-3d.c b/hw/display/virtio-gpu-3d.c index 55d76405a9..bc6e99c943 100644 --- a/hw/display/virtio-gpu-3d.c +++ b/hw/display/virtio-gpu-3d.c @@ -498,9 +498,9 @@ static void virgl_write_fence(void *opaque, uint32_t fence) QTAILQ_FOREACH_SAFE(cmd, &g->fenceq, next, tmp) { /* - * the guest can end up emitting fences out of order - * so we should check all fenced cmds not just the first one. - */ + * the guest can end up emitting fences out of order + * so we should check all fenced cmds not just the first one. + */ if (cmd->cmd_hdr.fence_id > fence) { continue; } diff --git a/hw/dma/pxa2xx_dma.c b/hw/dma/pxa2xx_dma.c index f4eb26cf17..d498de8ffe 100644 --- a/hw/dma/pxa2xx_dma.c +++ b/hw/dma/pxa2xx_dma.c @@ -228,7 +228,7 @@ static void pxa2xx_dma_run(PXA2xxDMAState *s) !(ch->state & DCSR_NODESCFETCH)) pxa2xx_dma_descriptor_fetch(s, c); break; - } + } } ch->cmd = (ch->cmd & ~DCMD_LEN) | length; @@ -283,7 +283,7 @@ static uint64_t pxa2xx_dma_read(void *opaque, hwaddr offset, case DCSR0 ... DCSR31: channel = offset >> 2; - if (s->chan[channel].request) + if (s->chan[channel].request) return s->chan[channel].state | DCSR_REQPEND; return s->chan[channel].state; diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c index 45516241c6..58502721fa 100644 --- a/hw/dma/soc_dma.c +++ b/hw/dma/soc_dma.c @@ -345,7 +345,7 @@ void soc_dma_port_add_mem(struct soc_dma_s *soc, uint8_t *phys_base, while (entry < dma->memmap + dma->memmap_size && entry->addr <= virt_base) entry ++; - } + } memmove(entry + 1, entry, (uint8_t *) (dma->memmap + dma->memmap_size ++) - diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c index a560e3afd2..1a2478b5a9 100644 --- a/hw/gpio/max7310.c +++ b/hw/gpio/max7310.c @@ -118,7 +118,7 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data) break; case 0x00: /* Input port - ignore writes */ - break; + break; default: #ifdef VERBOSE printf("%s: unknown register %02x\n", __func__, s->command); diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c index 935a3676c8..bf4812cfc9 100644 --- a/hw/i386/xen/xen-hvm.c +++ b/hw/i386/xen/xen-hvm.c @@ -570,7 +570,7 @@ static void xen_io_del(MemoryListener *listener, } static void xen_device_realize(DeviceListener *listener, - DeviceState *dev) + DeviceState *dev) { XenIOState *state = container_of(listener, XenIOState, device_listener); @@ -588,7 +588,7 @@ static void xen_device_realize(DeviceListener *listener, } static void xen_device_unrealize(DeviceListener *listener, - DeviceState *dev) + DeviceState *dev) { XenIOState *state = container_of(listener, XenIOState, device_listener); diff --git a/hw/ide/core.c b/hw/ide/core.c index 04e22e751d..c3d779db6e 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -575,16 +575,16 @@ int64_t ide_get_sector(IDEState *s) int64_t sector_num; if (s->select & 0x40) { /* lba */ - if (!s->lba48) { - sector_num = ((s->select & 0x0f) << 24) | (s->hcyl << 16) | - (s->lcyl << 8) | s->sector; - } else { - sector_num = ((int64_t)s->hob_hcyl << 40) | - ((int64_t) s->hob_lcyl << 32) | - ((int64_t) s->hob_sector << 24) | - ((int64_t) s->hcyl << 16) | - ((int64_t) s->lcyl << 8) | s->sector; - } + if (!s->lba48) { + sector_num = ((s->select & 0x0f) << 24) | (s->hcyl << 16) | + (s->lcyl << 8) | s->sector; + } else { + sector_num = ((int64_t)s->hob_hcyl << 40) | + ((int64_t) s->hob_lcyl << 32) | + ((int64_t) s->hob_sector << 24) | + ((int64_t) s->hcyl << 16) | + ((int64_t) s->lcyl << 8) | s->sector; + } } else { sector_num = ((s->hcyl << 8) | s->lcyl) * s->heads * s->sectors + (s->select & 0x0f) * s->sectors + (s->sector - 1); @@ -596,19 +596,19 @@ void ide_set_sector(IDEState *s, int64_t sector_num) { unsigned int cyl, r; if (s->select & 0x40) { - if (!s->lba48) { + if (!s->lba48) { s->select = (s->select & 0xf0) | (sector_num >> 24); s->hcyl = (sector_num >> 16); s->lcyl = (sector_num >> 8); s->sector = (sector_num); - } else { - s->sector = sector_num; - s->lcyl = sector_num >> 8; - s->hcyl = sector_num >> 16; - s->hob_sector = sector_num >> 24; - s->hob_lcyl = sector_num >> 32; - s->hob_hcyl = sector_num >> 40; - } + } else { + s->sector = sector_num; + s->lcyl = sector_num >> 8; + s->hcyl = sector_num >> 16; + s->hob_sector = sector_num >> 24; + s->hob_lcyl = sector_num >> 32; + s->hob_hcyl = sector_num >> 40; + } } else { cyl = sector_num / (s->heads * s->sectors); r = sector_num % (s->heads * s->sectors); @@ -1188,17 +1188,17 @@ static void ide_cmd_lba48_transform(IDEState *s, int lba48) * full sector count in ->nsector and ignore ->hob_nsector from now */ if (!s->lba48) { - if (!s->nsector) - s->nsector = 256; + if (!s->nsector) + s->nsector = 256; } else { - if (!s->nsector && !s->hob_nsector) - s->nsector = 65536; - else { - int lo = s->nsector; - int hi = s->hob_nsector; + if (!s->nsector && !s->hob_nsector) + s->nsector = 65536; + else { + int lo = s->nsector; + int hi = s->hob_nsector; - s->nsector = (hi << 8) | lo; - } + s->nsector = (hi << 8) | lo; + } } } @@ -1258,35 +1258,35 @@ void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) bus->ifs[1].feature = val; break; case ATA_IOPORT_WR_SECTOR_COUNT: - ide_clear_hob(bus); - bus->ifs[0].hob_nsector = bus->ifs[0].nsector; - bus->ifs[1].hob_nsector = bus->ifs[1].nsector; + ide_clear_hob(bus); + bus->ifs[0].hob_nsector = bus->ifs[0].nsector; + bus->ifs[1].hob_nsector = bus->ifs[1].nsector; bus->ifs[0].nsector = val; bus->ifs[1].nsector = val; break; case ATA_IOPORT_WR_SECTOR_NUMBER: - ide_clear_hob(bus); - bus->ifs[0].hob_sector = bus->ifs[0].sector; - bus->ifs[1].hob_sector = bus->ifs[1].sector; + ide_clear_hob(bus); + bus->ifs[0].hob_sector = bus->ifs[0].sector; + bus->ifs[1].hob_sector = bus->ifs[1].sector; bus->ifs[0].sector = val; bus->ifs[1].sector = val; break; case ATA_IOPORT_WR_CYLINDER_LOW: - ide_clear_hob(bus); - bus->ifs[0].hob_lcyl = bus->ifs[0].lcyl; - bus->ifs[1].hob_lcyl = bus->ifs[1].lcyl; + ide_clear_hob(bus); + bus->ifs[0].hob_lcyl = bus->ifs[0].lcyl; + bus->ifs[1].hob_lcyl = bus->ifs[1].lcyl; bus->ifs[0].lcyl = val; bus->ifs[1].lcyl = val; break; case ATA_IOPORT_WR_CYLINDER_HIGH: - ide_clear_hob(bus); - bus->ifs[0].hob_hcyl = bus->ifs[0].hcyl; - bus->ifs[1].hob_hcyl = bus->ifs[1].hcyl; + ide_clear_hob(bus); + bus->ifs[0].hob_hcyl = bus->ifs[0].hcyl; + bus->ifs[1].hob_hcyl = bus->ifs[1].hcyl; bus->ifs[0].hcyl = val; bus->ifs[1].hcyl = val; break; case ATA_IOPORT_WR_DEVICE_HEAD: - /* FIXME: HOB readback uses bit 7 */ + /* FIXME: HOB readback uses bit 7 */ bus->ifs[0].select = (val & ~0x10) | 0xa0; bus->ifs[1].select = (val | 0x10) | 0xa0; /* select drive */ @@ -2146,7 +2146,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->error; } else { - ret = s->hob_feature; + ret = s->hob_feature; } break; case ATA_IOPORT_RR_SECTOR_COUNT: @@ -2155,7 +2155,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->nsector & 0xff; } else { - ret = s->hob_nsector; + ret = s->hob_nsector; } break; case ATA_IOPORT_RR_SECTOR_NUMBER: @@ -2164,7 +2164,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->sector; } else { - ret = s->hob_sector; + ret = s->hob_sector; } break; case ATA_IOPORT_RR_CYLINDER_LOW: @@ -2173,7 +2173,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->lcyl; } else { - ret = s->hob_lcyl; + ret = s->hob_lcyl; } break; case ATA_IOPORT_RR_CYLINDER_HIGH: @@ -2182,7 +2182,7 @@ uint32_t ide_ioport_read(void *opaque, uint32_t addr) } else if (!hob) { ret = s->hcyl; } else { - ret = s->hob_hcyl; + ret = s->hob_hcyl; } break; case ATA_IOPORT_RR_DEVICE_HEAD: @@ -2847,7 +2847,7 @@ static const VMStateDescription vmstate_ide_drive_pio_state = { .fields = (VMStateField[]) { VMSTATE_INT32(req_nb_sectors, IDEState), VMSTATE_VARRAY_INT32(io_buffer, IDEState, io_buffer_total_len, 1, - vmstate_info_uint8, uint8_t), + vmstate_info_uint8, uint8_t), VMSTATE_INT32(cur_io_buffer_offset, IDEState), VMSTATE_INT32(cur_io_buffer_len, IDEState), VMSTATE_UINT8(end_transfer_fn_idx, IDEState), diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c index 74da30d9ca..cffbf586d4 100644 --- a/hw/input/lm832x.c +++ b/hw/input/lm832x.c @@ -66,7 +66,7 @@ typedef struct { struct { uint16_t file[256]; - uint8_t faddr; + uint8_t faddr; uint8_t addr[3]; QEMUTimer *tm[3]; } pwm; diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index 07c8801387..3e66713b47 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -55,7 +55,7 @@ #define KBD_CCMD_WRITE_OUTPORT 0xD1 /* write output port */ #define KBD_CCMD_WRITE_OBUF 0xD2 #define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if - initiated by the auxiliary device */ + initiated by the auxiliary device */ #define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */ #define KBD_CCMD_DISABLE_A20 0xDD /* HP vectra only ? */ #define KBD_CCMD_ENABLE_A20 0xDF /* HP vectra only ? */ diff --git a/hw/input/tsc210x.c b/hw/input/tsc210x.c index 1cad57f644..ded0db9351 100644 --- a/hw/input/tsc210x.c +++ b/hw/input/tsc210x.c @@ -577,7 +577,7 @@ static void tsc2102_control_register_write( case 0x01: /* Status / Keypad Control */ if ((s->model & 0xff00) == 0x2100) s->pin_func = value >> 14; - else { + else { s->kb.scan = (value >> 14) & 1; s->kb.debounce = (value >> 11) & 7; if (s->kb.intr && s->kb.scan) { diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 97ffdd820f..4e8290c4e0 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -441,7 +441,7 @@ static int apic_find_dest(uint8_t dest) for (i = 0; i < MAX_APICS; i++) { apic = local_apics[i]; - if (apic && apic->id == dest) + if (apic && apic->id == dest) return i; if (!apic) break; diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index 1cd8aac658..f707e59c7a 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -395,7 +395,7 @@ static void gt64120_writel (void *opaque, hwaddr addr, s->regs[GT_CPU] = val; break; case GT_MULTI: - /* Read-only register as only one GT64xxx is present on the CPU bus */ + /* Read-only register as only one GT64xxx is present on the CPU bus */ break; /* CPU Address Decode */ @@ -457,13 +457,13 @@ static void gt64120_writel (void *opaque, hwaddr addr, case GT_CPUERR_DATALO: case GT_CPUERR_DATAHI: case GT_CPUERR_PARITY: - /* Read-only registers, do nothing */ + /* Read-only registers, do nothing */ break; /* CPU Sync Barrier */ case GT_PCI0SYNC: case GT_PCI1SYNC: - /* Read-only registers, do nothing */ + /* Read-only registers, do nothing */ break; /* SDRAM and Device Address Decode */ diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 3e852e98cf..1922407394 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -239,7 +239,7 @@ void mips_r4k_init(MachineState *machine) sector_len, mips_rom / sector_len, 4, 0, 0, 0, 0, be)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); - } + } } else if (!qtest_enabled()) { /* not fatal */ warn_report("could not load MIPS bios '%s'", bios_name); @@ -285,7 +285,7 @@ void mips_r4k_init(MachineState *machine) for(i = 0; i < MAX_IDE_BUS; i++) isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], - hd[MAX_IDE_DEVS * i + 1]); + hd[MAX_IDE_DEVS * i + 1]); isa_create_simple(isa_bus, TYPE_I8042); } diff --git a/hw/misc/max111x.c b/hw/misc/max111x.c index 6dbdc03677..ac6d35a81d 100644 --- a/hw/misc/max111x.c +++ b/hw/misc/max111x.c @@ -43,9 +43,9 @@ typedef struct { #define CB_START (1 << 7) #define CHANNEL_NUM(v, b0, b1, b2) \ - ((((v) >> (2 + (b0))) & 4) | \ - (((v) >> (3 + (b1))) & 2) | \ - (((v) >> (4 + (b2))) & 1)) + ((((v) >> (2 + (b0))) & 4) | \ + (((v) >> (3 + (b1))) & 2) | \ + (((v) >> (4 + (b2))) & 1)) static uint32_t max111x_read(MAX111xState *s) { diff --git a/hw/misc/omap_l4.c b/hw/misc/omap_l4.c index 96fc057b4e..c217728c78 100644 --- a/hw/misc/omap_l4.c +++ b/hw/misc/omap_l4.c @@ -112,8 +112,8 @@ static const MemoryRegionOps omap_l4ta_ops = { struct omap_target_agent_s *omap_l4ta_get(struct omap_l4_s *bus, const struct omap_l4_region_s *regions, - const struct omap_l4_agent_info_s *agents, - int cs) + const struct omap_l4_agent_info_s *agents, + int cs) { int i; struct omap_target_agent_s *ta = NULL; diff --git a/hw/net/mipsnet.c b/hw/net/mipsnet.c index 03b3104278..5ec13105df 100644 --- a/hw/net/mipsnet.c +++ b/hw/net/mipsnet.c @@ -112,27 +112,27 @@ static uint64_t mipsnet_ioport_read(void *opaque, hwaddr addr, addr &= 0x3f; switch (addr) { case MIPSNET_DEV_ID: - ret = be32_to_cpu(0x4d495053); /* MIPS */ + ret = be32_to_cpu(0x4d495053); /* MIPS */ break; case MIPSNET_DEV_ID + 4: - ret = be32_to_cpu(0x4e455430); /* NET0 */ + ret = be32_to_cpu(0x4e455430); /* NET0 */ break; case MIPSNET_BUSY: - ret = s->busy; + ret = s->busy; break; case MIPSNET_RX_DATA_COUNT: - ret = s->rx_count; + ret = s->rx_count; break; case MIPSNET_TX_DATA_COUNT: - ret = s->tx_count; + ret = s->tx_count; break; case MIPSNET_INT_CTL: - ret = s->intctl; + ret = s->intctl; s->intctl &= ~MIPSNET_INTCTL_TESTBIT; break; case MIPSNET_INTERRUPT_INFO: /* XXX: This seems to be a per-VPE interrupt number. */ - ret = 0; + ret = 0; break; case MIPSNET_RX_DATA_BUFFER: if (s->rx_count) { @@ -161,7 +161,7 @@ static void mipsnet_ioport_write(void *opaque, hwaddr addr, trace_mipsnet_write(addr, val); switch (addr) { case MIPSNET_TX_DATA_COUNT: - s->tx_count = (val <= MAX_ETH_FRAME_SIZE) ? val : 0; + s->tx_count = (val <= MAX_ETH_FRAME_SIZE) ? val : 0; s->tx_written = 0; break; case MIPSNET_INT_CTL: diff --git a/hw/net/ne2000.c b/hw/net/ne2000.c index 869518ee06..037afc8052 100644 --- a/hw/net/ne2000.c +++ b/hw/net/ne2000.c @@ -145,7 +145,7 @@ static void ne2000_update_irq(NE2000State *s) isr = (s->isr & s->imr) & 0x7f; #if defined(DEBUG_NE2000) printf("NE2000: Set IRQ to %d (%02x %02x)\n", - isr ? 1 : 0, s->isr, s->imr); + isr ? 1 : 0, s->isr, s->imr); #endif qemu_set_irq(s->irq, (isr != 0)); } @@ -396,12 +396,12 @@ static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr) case EN0_ISR: ret = s->isr; break; - case EN0_RSARLO: - ret = s->rsar & 0x00ff; - break; - case EN0_RSARHI: - ret = s->rsar >> 8; - break; + case EN0_RSARLO: + ret = s->rsar & 0x00ff; + break; + case EN0_RSARHI: + ret = s->rsar >> 8; + break; case EN1_PHYS ... EN1_PHYS + 5: ret = s->phys[offset - EN1_PHYS]; break; @@ -420,21 +420,21 @@ static uint32_t ne2000_ioport_read(void *opaque, uint32_t addr) case EN2_STOPPG: ret = s->stop >> 8; break; - case EN0_RTL8029ID0: - ret = 0x50; - break; - case EN0_RTL8029ID1: - ret = 0x43; - break; - case EN3_CONFIG0: - ret = 0; /* 10baseT media */ - break; - case EN3_CONFIG2: - ret = 0x40; /* 10baseT active */ - break; - case EN3_CONFIG3: - ret = 0x40; /* Full duplex */ - break; + case EN0_RTL8029ID0: + ret = 0x50; + break; + case EN0_RTL8029ID1: + ret = 0x43; + break; + case EN3_CONFIG0: + ret = 0; /* 10baseT media */ + break; + case EN3_CONFIG2: + ret = 0x40; /* 10baseT active */ + break; + case EN3_CONFIG3: + ret = 0x40; /* Full duplex */ + break; default: ret = 0x00; break; diff --git a/hw/net/rocker/rocker.c b/hw/net/rocker/rocker.c index c02cbefece..5266f9b7dd 100644 --- a/hw/net/rocker/rocker.c +++ b/hw/net/rocker/rocker.c @@ -1279,7 +1279,7 @@ static World *rocker_world_type_by_name(Rocker *r, const char *name) for (i = 0; i < ROCKER_WORLD_TYPE_MAX; i++) { if (strcmp(name, world_name(r->worlds[i])) == 0) { return r->worlds[i]; - } + } } return NULL; } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 385b1a03e9..e37fc34839 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1375,10 +1375,10 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) n->guest_hdr_len, -1); if (out_num == VIRTQUEUE_MAX_SIZE) { goto drop; - } + } out_num += 1; out_sg = sg2; - } + } } /* * If host wants to see the guest header as is, we can diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c index 3648630386..76f3ed319d 100644 --- a/hw/net/vmxnet3.c +++ b/hw/net/vmxnet3.c @@ -149,7 +149,7 @@ typedef struct { } Vmxnet3Ring; static inline void vmxnet3_ring_init(PCIDevice *d, - Vmxnet3Ring *ring, + Vmxnet3Ring *ring, hwaddr pa, uint32_t size, uint32_t cell_size, @@ -193,13 +193,13 @@ static inline hwaddr vmxnet3_ring_curr_cell_pa(Vmxnet3Ring *ring) } static inline void vmxnet3_ring_read_curr_cell(PCIDevice *d, Vmxnet3Ring *ring, - void *buff) + void *buff) { vmw_shmem_read(d, vmxnet3_ring_curr_cell_pa(ring), buff, ring->cell_size); } static inline void vmxnet3_ring_write_curr_cell(PCIDevice *d, Vmxnet3Ring *ring, - void *buff) + void *buff) { vmw_shmem_write(d, vmxnet3_ring_curr_cell_pa(ring), buff, ring->cell_size); } diff --git a/hw/pci/msix.c b/hw/pci/msix.c index 702dac4ec7..c7bdbeda9e 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -501,7 +501,7 @@ void msix_reset(PCIDevice *dev) } msix_clear_all_vectors(dev); dev->config[dev->msix_cap + MSIX_CONTROL_OFFSET] &= - ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET]; + ~dev->wmask[dev->msix_cap + MSIX_CONTROL_OFFSET]; memset(dev->msix_table, 0, dev->msix_entries_nr * PCI_MSIX_ENTRY_SIZE); memset(dev->msix_pba, 0, QEMU_ALIGN_UP(dev->msix_entries_nr, 64) / 8); msix_mask_all(dev, dev->msix_entries_nr); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 56b13b3320..13328a0827 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -211,13 +211,13 @@ int pci_bar(PCIDevice *d, int reg) static inline int pci_irq_state(PCIDevice *d, int irq_num) { - return (d->irq_state >> irq_num) & 0x1; + return (d->irq_state >> irq_num) & 0x1; } static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) { - d->irq_state &= ~(0x1 << irq_num); - d->irq_state |= level << irq_num; + d->irq_state &= ~(0x1 << irq_num); + d->irq_state |= level << irq_num; } static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) @@ -571,8 +571,8 @@ const VMStateDescription vmstate_pci_device = { 0, vmstate_info_pci_config, PCIE_CONFIG_SPACE_SIZE), VMSTATE_BUFFER_UNSAFE_INFO(irq_state, PCIDevice, 2, - vmstate_info_pci_irq_state, - PCI_NUM_PINS * sizeof(int32_t)), + vmstate_info_pci_irq_state, + PCI_NUM_PINS * sizeof(int32_t)), VMSTATE_END_OF_LIST() } }; @@ -624,21 +624,21 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp, p = addr; val = strtoul(p, &e, 16); if (e == p) - return -1; + return -1; if (*e == ':') { - bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) - return -1; - if (*e == ':') { - dom = bus; - bus = val; - p = e + 1; - val = strtoul(p, &e, 16); - if (e == p) - return -1; - } + bus = val; + p = e + 1; + val = strtoul(p, &e, 16); + if (e == p) + return -1; + if (*e == ':') { + dom = bus; + bus = val; + p = e + 1; + val = strtoul(p, &e, 16); + if (e == p) + return -1; + } } slot = val; @@ -657,10 +657,10 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp, /* if funcp == NULL func is 0 */ if (dom > 0xffff || bus > 0xff || slot > 0x1f || func > 7) - return -1; + return -1; if (*e) - return -1; + return -1; *domp = dom; *busp = bus; @@ -1217,7 +1217,7 @@ pcibus_t pci_get_bar_addr(PCIDevice *pci_dev, int region_num) } static pcibus_t pci_bar_address(PCIDevice *d, - int reg, uint8_t type, pcibus_t size) + int reg, uint8_t type, pcibus_t size) { pcibus_t new_addr, last_addr; int bar = pci_bar(d, reg); diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index ee9dff2d3a..55d0dacd60 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -369,7 +369,7 @@ void pci_bridge_initfn(PCIDevice *dev, const char *typename) * let users address the bus using the device name. */ if (!br->bus_name && dev->qdev.id && *dev->qdev.id) { - br->bus_name = dev->qdev.id; + br->bus_name = dev->qdev.id; } qbus_create_inplace(sec_bus, sizeof(br->sec_bus), typename, DEVICE(dev), diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c index 5c58415cf1..fbe2e7f857 100644 --- a/hw/ppc/ppc405_uc.c +++ b/hw/ppc/ppc405_uc.c @@ -1885,7 +1885,7 @@ CPUPPCState *ppc405ep_init(MemoryRegion *address_space_mem, pic = ppcuic_init(env, irqs, 0x0C0, 0, 1); *picp = pic; /* SDRAM controller */ - /* XXX 405EP has no ECC interrupt */ + /* XXX 405EP has no ECC interrupt */ ppc4xx_sdram_init(env, pic[17], 2, ram_memories, ram_bases, ram_sizes, do_init); /* External bus controller */ diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 2afb7f437e..7bda86a7d0 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -538,7 +538,7 @@ static void ppc_prep_init(MachineState *machine) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL) { - nd_table[i].model = g_strdup("ne2k_isa"); + nd_table[i].model = g_strdup("ne2k_isa"); } if (strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i], @@ -552,7 +552,7 @@ static void ppc_prep_init(MachineState *machine) for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[2 * i], - hd[2 * i + 1]); + hd[2 * i + 1]); } cpu = POWERPC_CPU(first_cpu); diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 52a38933b6..89def1421f 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -1850,7 +1850,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) break; case 0x0a: case 0x0b: /* Openserver writes to these readonly registers on startup */ - return; + return; case 0x0c: case 0x0d: case 0x0e: case 0x0f: /* Linux writes to these readonly registers on startup. */ return; @@ -1884,8 +1884,8 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) /* nothing to do */ break; case 0x1a: /* CTEST2 */ - s->ctest2 = val & LSI_CTEST2_PCICIE; - break; + s->ctest2 = val & LSI_CTEST2_PCICIE; + break; case 0x1b: /* CTEST3 */ s->ctest3 = val & 0x0f; break; diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index 6a5fc46a47..5b399e7161 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -139,11 +139,11 @@ static uint64_t r2d_fpga_read(void *opaque, hwaddr addr, unsigned int size) case PA_IRLMSK: return s->irlmsk; case PA_OUTPORT: - return s->outport; + return s->outport; case PA_POWOFF: - return 0x00; + return 0x00; case PA_VERREG: - return 0x10; + return 0x10; } return 0; @@ -158,18 +158,18 @@ r2d_fpga_write(void *opaque, hwaddr addr, uint64_t value, unsigned int size) case PA_IRLMSK: s->irlmsk = value; update_irl(s); - break; + break; case PA_OUTPORT: - s->outport = value; - break; + s->outport = value; + break; case PA_POWOFF: if (value & 1) { qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); } break; case PA_VERREG: - /* Discard writes */ - break; + /* Discard writes */ + break; } } diff --git a/hw/usb/dev-bluetooth.c b/hw/usb/dev-bluetooth.c index eac7365b0a..c539a1afc6 100644 --- a/hw/usb/dev-bluetooth.c +++ b/hw/usb/dev-bluetooth.c @@ -46,7 +46,7 @@ struct USBBtState { struct usb_hci_out_fifo_s { uint8_t data[4096]; - int len; + int len; } outcmd, outacl, outsco; }; diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c index 62d18290dc..90cd745f06 100644 --- a/hw/usb/dev-hid.c +++ b/hw/usb/dev-hid.c @@ -592,12 +592,12 @@ static void usb_hid_handle_control(USBDevice *dev, USBPacket *p, switch (value >> 8) { case 0x22: if (hs->kind == HID_MOUSE) { - memcpy(data, qemu_mouse_hid_report_descriptor, - sizeof(qemu_mouse_hid_report_descriptor)); + memcpy(data, qemu_mouse_hid_report_descriptor, + sizeof(qemu_mouse_hid_report_descriptor)); p->actual_length = sizeof(qemu_mouse_hid_report_descriptor); } else if (hs->kind == HID_TABLET) { memcpy(data, qemu_tablet_hid_report_descriptor, - sizeof(qemu_tablet_hid_report_descriptor)); + sizeof(qemu_tablet_hid_report_descriptor)); p->actual_length = sizeof(qemu_tablet_hid_report_descriptor); } else if (hs->kind == HID_KEYBOARD) { memcpy(data, qemu_keyboard_hid_report_descriptor, diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c index dc368179d1..7e9339b8a8 100644 --- a/hw/usb/dev-hub.c +++ b/hw/usb/dev-hub.c @@ -147,13 +147,13 @@ static const USBDesc desc_hub = { static const uint8_t qemu_hub_hub_descriptor[] = { - 0x00, /* u8 bLength; patched in later */ - 0x29, /* u8 bDescriptorType; Hub-descriptor */ - 0x00, /* u8 bNbrPorts; (patched later) */ - 0x0a, /* u16 wHubCharacteristics; */ - 0x00, /* (per-port OC, no power switching) */ - 0x01, /* u8 bPwrOn2pwrGood; 2ms */ - 0x00 /* u8 bHubContrCurrent; 0 mA */ + 0x00, /* u8 bLength; patched in later */ + 0x29, /* u8 bDescriptorType; Hub-descriptor */ + 0x00, /* u8 bNbrPorts; (patched later) */ + 0x0a, /* u16 wHubCharacteristics; */ + 0x00, /* (per-port OC, no power switching) */ + 0x01, /* u8 bPwrOn2pwrGood; 2ms */ + 0x00 /* u8 bHubContrCurrent; 0 mA */ /* DeviceRemovable and PortPwrCtrlMask patched in later */ }; diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c index aebc19bd71..3500d88a3e 100644 --- a/hw/xen/xen_devconfig.c +++ b/hw/xen/xen_devconfig.c @@ -6,7 +6,7 @@ /* ------------------------------------------------------------- */ static int xen_config_dev_dirs(const char *ftype, const char *btype, int vdev, - char *fe, char *be, int len) + char *fe, char *be, int len) { char *dom; diff --git a/hw/xenpv/xen_domainbuild.c b/hw/xenpv/xen_domainbuild.c index 188acaca16..2859280a6a 100644 --- a/hw/xenpv/xen_domainbuild.c +++ b/hw/xenpv/xen_domainbuild.c @@ -27,11 +27,11 @@ static int xenstore_domain_mkdir(char *path) if (!xs_mkdir(xenstore, 0, path)) { fprintf(stderr, "%s: xs_mkdir %s: failed\n", __func__, path); - return -1; + return -1; } if (!xs_set_permissions(xenstore, 0, path, perms_ro, 2)) { fprintf(stderr, "%s: xs_set_permissions failed\n", __func__); - return -1; + return -1; } for (i = 0; writable[i]; i++) { @@ -82,8 +82,8 @@ int xenstore_domain_init1(const char *kernel, const char *ramdisk, /* cpus */ for (i = 0; i < smp_cpus; i++) { - snprintf(path, sizeof(path), "cpu/%d/availability",i); - xenstore_write_str(dom, path, "online"); + snprintf(path, sizeof(path), "cpu/%d/availability",i); + xenstore_write_str(dom, path, "online"); } xenstore_write_int(vm, "vcpu_avail", smp_cpus); xenstore_write_int(vm, "vcpus", smp_cpus); diff --git a/include/elf.h b/include/elf.h index c151164b63..2a72b282f7 100644 --- a/include/elf.h +++ b/include/elf.h @@ -782,11 +782,11 @@ typedef struct { /* ARM-specific values for sh_flags */ #define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */ #define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined - in the input to a link step */ + in the input to a link step */ /* ARM-specific program header flags */ #define PF_ARM_SB 0x10000000 /* Segment contains the location - addressed by the static base */ + addressed by the static base */ /* ARM relocs. */ #define R_ARM_NONE 0 /* No reloc */ @@ -1047,7 +1047,7 @@ typedef struct { #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ #define R_X86_64_RELATIVE 8 /* Adjust by program base */ #define R_X86_64_GOTPCREL 9 /* 32 bit signed pc relative - offset to GOT */ + offset to GOT */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ #define R_X86_64_32S 11 /* Direct 32 bit sign extended */ #define R_X86_64_16 12 /* Direct 16 bit zero extended */ @@ -1070,7 +1070,7 @@ typedef struct { #define EF_PARISC_LSB 0x00040000 /* Program expects little endian. */ #define EF_PARISC_WIDE 0x00080000 /* Program expects wide mode. */ #define EF_PARISC_NO_KABP 0x00100000 /* No kernel assisted branch - prediction. */ + prediction. */ #define EF_PARISC_LAZYSWAP 0x00400000 /* Allow lazy swapping. */ #define EF_PARISC_ARCH 0x0000ffff /* Architecture version. */ @@ -1083,7 +1083,7 @@ typedef struct { /* Additional section indeces. */ #define SHN_PARISC_ANSI_COMMON 0xff00 /* Section for tenatively declared - symbols in ANSI C. */ + symbols in ANSI C. */ #define SHN_PARISC_HUGE_COMMON 0xff01 /* Common blocks in huge model. */ /* Legal values for sh_type field of Elf32_Shdr. */ diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index c20ace0d0b..bbf541263a 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -69,13 +69,13 @@ #define ACPI_BITMASK_WAKE_STATUS 0x8000 #define ACPI_BITMASK_ALL_FIXED_STATUS (\ - ACPI_BITMASK_TIMER_STATUS | \ - ACPI_BITMASK_BUS_MASTER_STATUS | \ - ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ - ACPI_BITMASK_POWER_BUTTON_STATUS | \ - ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ - ACPI_BITMASK_RT_CLOCK_STATUS | \ - ACPI_BITMASK_WAKE_STATUS) + ACPI_BITMASK_TIMER_STATUS | \ + ACPI_BITMASK_BUS_MASTER_STATUS | \ + ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ + ACPI_BITMASK_POWER_BUTTON_STATUS | \ + ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ + ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_WAKE_STATUS) /* PM1x_EN */ #define ACPI_BITMASK_TIMER_ENABLE 0x0001 diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h index 3b6398cb39..b84ba87e44 100644 --- a/include/hw/elf_ops.h +++ b/include/hw/elf_ops.h @@ -343,7 +343,7 @@ static int glue(load_elf, SZ)(const char *name, int fd, } if (pentry) - *pentry = (uint64_t)(elf_sword)ehdr.e_entry; + *pentry = (uint64_t)(elf_sword)ehdr.e_entry; glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb, sym_cb); diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 594081e57f..880413ddc7 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -342,7 +342,7 @@ enum ide_dma_cmd { extern const char *IDE_DMA_CMD_lookup[IDE_DMA__COUNT]; #define ide_cmd_is_read(s) \ - ((s)->dma_cmd == IDE_DMA_READ) + ((s)->dma_cmd == IDE_DMA_READ) typedef struct IDEBufferedRequest { QLIST_ENTRY(IDEBufferedRequest) list; diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h index fbcee94ed7..adfedb2efc 100644 --- a/include/hw/sh4/sh_intc.h +++ b/include/hw/sh4/sh_intc.h @@ -61,21 +61,21 @@ struct intc_desc { int sh_intc_get_pending_vector(struct intc_desc *desc, int imask); struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id); void sh_intc_toggle_source(struct intc_source *source, - int enable_adj, int assert_adj); + int enable_adj, int assert_adj); void sh_intc_register_sources(struct intc_desc *desc, - struct intc_vect *vectors, - int nr_vectors, - struct intc_group *groups, - int nr_groups); + struct intc_vect *vectors, + int nr_vectors, + struct intc_group *groups, + int nr_groups); int sh_intc_init(MemoryRegion *sysmem, struct intc_desc *desc, - int nr_sources, - struct intc_mask_reg *mask_regs, - int nr_mask_regs, - struct intc_prio_reg *prio_regs, - int nr_prio_regs); + int nr_sources, + struct intc_mask_reg *mask_regs, + int nr_mask_regs, + struct intc_prio_reg *prio_regs, + int nr_prio_regs); void sh_intc_set_irl(void *opaque, int n, int level); diff --git a/include/hw/xen/io/ring.h b/include/hw/xen/io/ring.h index ffa3ebadc8..1adacf09f9 100644 --- a/include/hw/xen/io/ring.h +++ b/include/hw/xen/io/ring.h @@ -235,8 +235,8 @@ typedef struct __name##_back_ring __name##_back_ring_t * to be ineffective where _req is a struct which consists of only bitfields. */ #define RING_COPY_REQUEST(_r, _idx, _req) do { \ - /* Use volatile to force the copy into _req. */ \ - *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ + /* Use volatile to force the copy into _req. */ \ + *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ } while (0) #define RING_GET_RESPONSE(_r, _idx) \ diff --git a/include/qemu/acl.h b/include/qemu/acl.h index 7c44119a47..73d2a71c8d 100644 --- a/include/qemu/acl.h +++ b/include/qemu/acl.h @@ -49,18 +49,18 @@ qemu_acl *qemu_acl_init(const char *aclname); qemu_acl *qemu_acl_find(const char *aclname); int qemu_acl_party_is_allowed(qemu_acl *acl, - const char *party); + const char *party); void qemu_acl_reset(qemu_acl *acl); int qemu_acl_append(qemu_acl *acl, - int deny, - const char *match); + int deny, + const char *match); int qemu_acl_insert(qemu_acl *acl, - int deny, - const char *match, - int index); + int deny, + const char *match, + int index); int qemu_acl_remove(qemu_acl *acl, - const char *match); + const char *match); #endif /* QEMU_ACL_H */ diff --git a/include/qemu/iov.h b/include/qemu/iov.h index 72d4c559b4..5f433c7768 100644 --- a/include/qemu/iov.h +++ b/include/qemu/iov.h @@ -35,7 +35,7 @@ size_t iov_size(const struct iovec *iov, const unsigned int iov_cnt); size_t iov_from_buf_full(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes); size_t iov_to_buf_full(const struct iovec *iov, const unsigned int iov_cnt, - size_t offset, void *buf, size_t bytes); + size_t offset, void *buf, size_t bytes); static inline size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, diff --git a/include/scsi/constants.h b/include/scsi/constants.h index 083a8e887a..0dc550732d 100644 --- a/include/scsi/constants.h +++ b/include/scsi/constants.h @@ -212,7 +212,7 @@ #define TYPE_ROM 0x05 #define TYPE_SCANNER 0x06 #define TYPE_MOD 0x07 /* Magneto-optical disk - - * - treated as TYPE_DISK */ + * - treated as TYPE_DISK */ #define TYPE_MEDIUM_CHANGER 0x08 #define TYPE_STORAGE_ARRAY 0x0c /* Storage array device */ #define TYPE_ENCLOSURE 0x0d /* Enclosure Services Device */ diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h index 66543ae8f4..c8f6145257 100644 --- a/include/sysemu/balloon.h +++ b/include/sysemu/balloon.h @@ -20,7 +20,7 @@ typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target); typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info); int qemu_add_balloon_handler(QEMUBalloonEvent *event_func, - QEMUBalloonStatus *stat_func, void *opaque); + QEMUBalloonStatus *stat_func, void *opaque); void qemu_remove_balloon_handler(void *opaque); bool qemu_balloon_is_inhibited(void); void qemu_balloon_inhibit(bool state); diff --git a/linux-user/linuxload.c b/linux-user/linuxload.c index 6717c9c6f0..a27e1d0d8b 100644 --- a/linux-user/linuxload.c +++ b/linux-user/linuxload.c @@ -38,15 +38,15 @@ static int prepare_binprm(struct linux_binprm *bprm) int retval; if(fstat(bprm->fd, &st) < 0) { - return(-errno); + return(-errno); } mode = st.st_mode; if(!S_ISREG(mode)) { /* Must be regular file */ - return(-EACCES); + return(-EACCES); } if(!(mode & 0111)) { /* Must have at least one execute bit set */ - return(-EACCES); + return(-EACCES); } bprm->e_uid = geteuid(); @@ -54,7 +54,7 @@ static int prepare_binprm(struct linux_binprm *bprm) /* Set-uid? */ if(mode & S_ISUID) { - bprm->e_uid = st.st_uid; + bprm->e_uid = st.st_uid; } /* Set-gid? */ @@ -64,13 +64,13 @@ static int prepare_binprm(struct linux_binprm *bprm) * executable. */ if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP)) { - bprm->e_gid = st.st_gid; + bprm->e_gid = st.st_gid; } retval = read(bprm->fd, bprm->buf, BPRM_BUF_SIZE); if (retval < 0) { - perror("prepare_binprm"); - exit(-1); + perror("prepare_binprm"); + exit(-1); } if (retval < BPRM_BUF_SIZE) { /* Make sure the rest of the loader won't read garbage. */ diff --git a/linux-user/main.c b/linux-user/main.c index 923cbb753a..a0aba9cb1e 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -740,8 +740,8 @@ int main(int argc, char **argv, char **envp) target_argc = argc - optind; target_argv = calloc(target_argc + 1, sizeof (char *)); if (target_argv == NULL) { - (void) fprintf(stderr, "Unable to allocate memory for target_argv\n"); - exit(EXIT_FAILURE); + (void) fprintf(stderr, "Unable to allocate memory for target_argv\n"); + exit(EXIT_FAILURE); } /* diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 41e0983ce8..e0249efe4f 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -485,11 +485,11 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, end = start + len; real_end = HOST_PAGE_ALIGN(end); - /* - * Test if requested memory area fits target address space - * It can fail only on 64-bit host with 32-bit target. - * On any other target/host host mmap() handles this error correctly. - */ + /* + * Test if requested memory area fits target address space + * It can fail only on 64-bit host with 32-bit target. + * On any other target/host host mmap() handles this error correctly. + */ if (!guest_range_valid(start, len)) { errno = ENOMEM; goto fail; diff --git a/linux-user/qemu.h b/linux-user/qemu.h index dd5771ce0c..069df8f1f9 100644 --- a/linux-user/qemu.h +++ b/linux-user/qemu.h @@ -50,7 +50,7 @@ struct image_info { abi_ulong env_strings; abi_ulong file_string; uint32_t elf_flags; - int personality; + int personality; abi_ulong alignment; /* The fields below are used in FDPIC mode. */ @@ -174,7 +174,7 @@ extern unsigned long mmap_min_addr; struct linux_binprm { char buf[BPRM_BUF_SIZE] __attribute__((aligned)); abi_ulong p; - int fd; + int fd; int e_uid, e_gid; int argc, envc; char **argv; diff --git a/linux-user/signal.c b/linux-user/signal.c index 602b631b92..e2c0b37173 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -727,7 +727,7 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp) } #endif - ret = -TARGET_EFAULT; + ret = -TARGET_EFAULT; if (!lock_user_struct(VERIFY_READ, uss, uss_addr, 1)) { goto out; } @@ -736,25 +736,25 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp) __get_user(ss.ss_flags, &uss->ss_flags); unlock_user_struct(uss, uss_addr, 0); - ret = -TARGET_EPERM; - if (on_sig_stack(sp)) + ret = -TARGET_EPERM; + if (on_sig_stack(sp)) goto out; - ret = -TARGET_EINVAL; - if (ss.ss_flags != TARGET_SS_DISABLE + ret = -TARGET_EINVAL; + if (ss.ss_flags != TARGET_SS_DISABLE && ss.ss_flags != TARGET_SS_ONSTACK && ss.ss_flags != 0) goto out; - if (ss.ss_flags == TARGET_SS_DISABLE) { + if (ss.ss_flags == TARGET_SS_DISABLE) { ss.ss_size = 0; ss.ss_sp = 0; - } else { + } else { ret = -TARGET_ENOMEM; if (ss.ss_size < minstacksize) { goto out; } - } + } target_sigaltstack_used.ss_sp = ss.ss_sp; target_sigaltstack_used.ss_size = ss.ss_size; diff --git a/linux-user/strace.c b/linux-user/strace.c index d1d14945f9..7318392e57 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -647,11 +647,11 @@ print_execve(const struct syscallname *name, for (arg_ptr_addr = arg2; ; arg_ptr_addr += sizeof(abi_ulong)) { abi_ulong *arg_ptr, arg_addr; - arg_ptr = lock_user(VERIFY_READ, arg_ptr_addr, sizeof(abi_ulong), 1); + arg_ptr = lock_user(VERIFY_READ, arg_ptr_addr, sizeof(abi_ulong), 1); if (!arg_ptr) return; arg_addr = tswapal(*arg_ptr); - unlock_user(arg_ptr, arg_ptr_addr, 0); + unlock_user(arg_ptr, arg_ptr_addr, 0); if (!arg_addr) break; if ((s = lock_user_string(arg_addr))) { diff --git a/linux-user/uaccess.c b/linux-user/uaccess.c index 0a5c0b0b29..e215ecc2a6 100644 --- a/linux-user/uaccess.c +++ b/linux-user/uaccess.c @@ -30,7 +30,7 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len) if ((ghptr = lock_user(VERIFY_WRITE, gaddr, len, 0))) { memcpy(ghptr, hptr, len); - unlock_user(ghptr, gaddr, len); + unlock_user(ghptr, gaddr, len); } else ret = -TARGET_EFAULT; diff --git a/linux-user/vm86.c b/linux-user/vm86.c index 3829b9a677..9c393df424 100644 --- a/linux-user/vm86.c +++ b/linux-user/vm86.c @@ -257,7 +257,7 @@ void handle_vm86_trap(CPUX86State *env, int trapno) #define CHECK_IF_IN_TRAP() \ if ((ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_active) && \ (ts->vm86plus.vm86plus.flags & TARGET_vm86dbg_TFpendig)) \ - newflags |= TF_MASK + newflags |= TF_MASK #define VM86_FAULT_RETURN \ if ((ts->vm86plus.vm86plus.flags & TARGET_force_return_for_pic) && \ diff --git a/nbd/client.c b/nbd/client.c index b4d457a19a..69f5e1b7d2 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -1028,7 +1028,7 @@ int nbd_disconnect(int fd) #else int nbd_init(int fd, QIOChannelSocket *ioc, NBDExportInfo *info, - Error **errp) + Error **errp) { error_setg(errp, "nbd_init is only supported on Linux"); return -ENOTSUP; diff --git a/net/checksum.c b/net/checksum.c index 4da72a6a6c..273bc9c6bc 100644 --- a/net/checksum.c +++ b/net/checksum.c @@ -43,7 +43,7 @@ uint32_t net_checksum_add_cont(int len, uint8_t *buf, int seq) uint16_t net_checksum_finish(uint32_t sum) { while (sum>>16) - sum = (sum & 0xFFFF)+(sum >> 16); + sum = (sum & 0xFFFF)+(sum >> 16); return ~sum; } diff --git a/qtest.c b/qtest.c index 69b9e9962b..55df6c43db 100644 --- a/qtest.c +++ b/qtest.c @@ -290,7 +290,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words) if (!dev) { qtest_send_prefix(chr); qtest_send(chr, "FAIL Unknown device\n"); - return; + return; } if (irq_intercept_dev) { @@ -300,7 +300,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } else { qtest_send(chr, "OK\n"); } - return; + return; } QLIST_FOREACH(ngl, &dev->gpios, node) { diff --git a/target/alpha/translate.c b/target/alpha/translate.c index e5d62850c5..9d8f9b3eea 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -804,7 +804,7 @@ static void gen_cvttq(DisasContext *ctx, int rb, int rc, int fn11) static void gen_ieee_intcvt(DisasContext *ctx, void (*helper)(TCGv, TCGv_ptr, TCGv), - int rb, int rc, int fn11) + int rb, int rc, int fn11) { TCGv vb, vc; diff --git a/target/cris/helper.c b/target/cris/helper.c index d2ec349191..b2dbb2075c 100644 --- a/target/cris/helper.c +++ b/target/cris/helper.c @@ -240,7 +240,7 @@ void cris_cpu_do_interrupt(CPUState *cs) /* Exception starts with dslot cleared. */ env->dslot = 0; } - + if (env->pregs[PR_CCS] & U_FLAG) { /* Swap stack pointers. */ env->pregs[PR_USP] = env->regs[R_SP]; diff --git a/target/cris/mmu.h b/target/cris/mmu.h index 8e249e812b..0217f476de 100644 --- a/target/cris/mmu.h +++ b/target/cris/mmu.h @@ -5,13 +5,13 @@ struct cris_mmu_result { - uint32_t phy; - int prot; - int bf_vec; + uint32_t phy; + int prot; + int bf_vec; }; void cris_mmu_init(CPUCRISState *env); void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid); int cris_mmu_translate(struct cris_mmu_result *res, - CPUCRISState *env, uint32_t vaddr, - int rw, int mmu_idx, int debug); + CPUCRISState *env, uint32_t vaddr, + int rw, int mmu_idx, int debug); diff --git a/target/cris/translate_v10.inc.c b/target/cris/translate_v10.inc.c index fce78825cc..a87b8bb281 100644 --- a/target/cris/translate_v10.inc.c +++ b/target/cris/translate_v10.inc.c @@ -384,7 +384,7 @@ static unsigned int dec10_setclrf(DisasContext *dc) } static inline void dec10_reg_prep_sext(DisasContext *dc, int size, int sext, - TCGv dd, TCGv ds, TCGv sd, TCGv ss) + TCGv dd, TCGv ds, TCGv sd, TCGv ss) { if (sext) { t_gen_sext(dd, sd, size); diff --git a/target/i386/translate.c b/target/i386/translate.c index 0dd5fbe45c..49cd298374 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -3445,7 +3445,7 @@ static void gen_sse(CPUX86State *env, DisasContext *s, int b, case 0x172: case 0x173: if (b1 >= 2) { - goto unknown_op; + goto unknown_op; } val = x86_ldub_code(env, s); if (is_xmm) { @@ -6400,7 +6400,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) SVM_IOIO_TYPE_MASK | svm_is_rep(prefixes)); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } tcg_gen_movi_i32(s->tmp2_i32, val); gen_helper_in_func(ot, s->T1, s->tmp2_i32); gen_op_mov_reg_v(s, ot, R_EAX, s->T1); @@ -6421,7 +6421,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } tcg_gen_movi_i32(s->tmp2_i32, val); tcg_gen_trunc_tl_i32(s->tmp3_i32, s->T1); gen_helper_out_func(ot, s->tmp2_i32, s->tmp3_i32); @@ -6439,7 +6439,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) SVM_IOIO_TYPE_MASK | svm_is_rep(prefixes)); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); gen_helper_in_func(ot, s->T1, s->tmp2_i32); gen_op_mov_reg_v(s, ot, R_EAX, s->T1); @@ -6459,7 +6459,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T0); tcg_gen_trunc_tl_i32(s->tmp3_i32, s->T1); gen_helper_out_func(ot, s->tmp2_i32, s->tmp3_i32); @@ -7166,7 +7166,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu) gen_jmp_im(s, pc_start - s->cs_base); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } gen_helper_rdtsc(cpu_env); if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) { gen_io_end(); diff --git a/target/mips/translate.c b/target/mips/translate.c index e9c23a594b..b8dcab5307 100644 --- a/target/mips/translate.c +++ b/target/mips/translate.c @@ -6942,7 +6942,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) /* Mark as an IO operation because we read the time. */ if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_start(); - } + } gen_helper_mfc0_count(arg, cpu_env); if (tb_cflags(ctx->base.tb) & CF_USE_ICOUNT) { gen_io_end(); diff --git a/target/tilegx/translate.c b/target/tilegx/translate.c index f201150fc7..df1e4d0fef 100644 --- a/target/tilegx/translate.c +++ b/target/tilegx/translate.c @@ -297,7 +297,7 @@ static TileExcp gen_st_opcode(DisasContext *dc, unsigned dest, unsigned srca, } tcg_gen_qemu_st_tl(load_gr(dc, srcb), load_gr(dc, srca), - dc->mmuidx, memop); + dc->mmuidx, memop); qemu_log_mask(CPU_LOG_TB_IN_ASM, "%s %s, %s", name, reg_names[srca], reg_names[srcb]); diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 436195894b..cdca3fe034 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -3424,8 +3424,8 @@ static void tcg_target_qemu_prologue(TCGContext *s) tcg_out_addi(s, TCG_REG_ESP, -stack_addend); /* jmp *tb. */ tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_ESP, - (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 - + stack_addend); + (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 + + stack_addend); #else tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); tcg_out_addi(s, TCG_REG_ESP, -stack_addend); diff --git a/tests/tcg/alpha/test-cond.c b/tests/tcg/alpha/test-cond.c index e625313b3e..3e11c4c105 100644 --- a/tests/tcg/alpha/test-cond.c +++ b/tests/tcg/alpha/test-cond.c @@ -6,7 +6,7 @@ int test_##N (long a) \ { \ int res = 1; \ - \ + \ asm ("cmov"#N" %1,$31,%0" \ : "+r" (res) : "r" (a)); \ return !res; \ @@ -18,7 +18,7 @@ int test_##N (long a) \ int test_##N (long a) \ { \ int res = 1; \ - \ + \ asm ("b"#N" %1,1f\n\t" \ "addq $31,$31,%0\n\t" \ "1: unop\n" \ diff --git a/tests/tcg/arm/hello-arm.c b/tests/tcg/arm/hello-arm.c index 6e5a93bccf..e33edf949f 100644 --- a/tests/tcg/arm/hello-arm.c +++ b/tests/tcg/arm/hello-arm.c @@ -11,7 +11,7 @@ #define __syscall_return(type, res) \ do { \ - return (type) (res); \ + return (type) (res); \ } while (0) #define _syscall0(type,name) \ @@ -33,7 +33,7 @@ type name(type1 arg1) { \ "mov %0,r0" \ : "=r" (__res) \ : "r" ((long)(arg1)) \ - : "r0","lr"); \ + : "r0","lr"); \ __syscall_return(type,__res); \ } @@ -47,7 +47,7 @@ type name(type1 arg1,type2 arg2) { \ "mov\t%0,r0" \ : "=r" (__res) \ : "r" ((long)(arg1)),"r" ((long)(arg2)) \ - : "r0","r1","lr"); \ + : "r0","r1","lr"); \ __syscall_return(type,__res); \ } @@ -78,9 +78,9 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ "mov\tr3,%4\n\t" \ __syscall(name) \ "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)) \ - : "r0","r1","r2","r3","lr"); \ + : "=r" (__res) \ + : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)) \ + : "r0","r1","r2","r3","lr"); \ __syscall_return(type,__res); \ } @@ -96,10 +96,10 @@ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) { \ "mov\tr4,%5\n\t" \ __syscall(name) \ "mov\t%0,r0" \ - : "=r" (__res) \ - : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)), \ - "r" ((long)(arg5)) \ - : "r0","r1","r2","r3","r4","lr"); \ + : "=r" (__res) \ + : "r" ((long)(arg1)),"r" ((long)(arg2)),"r" ((long)(arg3)),"r" ((long)(arg4)), \ + "r" ((long)(arg5)) \ + : "r0","r1","r2","r3","r4","lr"); \ __syscall_return(type,__res); \ } diff --git a/tests/tcg/cris/check_glibc_kernelversion.c b/tests/tcg/cris/check_glibc_kernelversion.c index 07448722c0..7aada89911 100644 --- a/tests/tcg/cris/check_glibc_kernelversion.c +++ b/tests/tcg/cris/check_glibc_kernelversion.c @@ -109,8 +109,8 @@ int main(void) if (parts < 3) version <<= 8 * (3 - parts); - if (version < __LINUX_KERNEL_VERSION) - err(); - pass(); - exit(0); + if (version < __LINUX_KERNEL_VERSION) + err(); + pass(); + exit(0); } diff --git a/tests/tcg/cris/check_mmap3.c b/tests/tcg/cris/check_mmap3.c index 34401fa0c9..cb890ef120 100644 --- a/tests/tcg/cris/check_mmap3.c +++ b/tests/tcg/cris/check_mmap3.c @@ -17,7 +17,7 @@ int main (int argc, char *argv[]) /* Check that we can map a non-multiple of a page and still get a full page. */ a = mmap (NULL, 0x4c, PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (a == NULL || a == (unsigned char *) -1) abort (); diff --git a/tests/tcg/cris/check_openpf1.c b/tests/tcg/cris/check_openpf1.c index fdcf4c5c3f..251d26eec2 100644 --- a/tests/tcg/cris/check_openpf1.c +++ b/tests/tcg/cris/check_openpf1.c @@ -19,7 +19,7 @@ int main (int argc, char *argv[]) { fnam = malloc (strlen (argv[0]) + 2); if (fnam == NULL) - abort (); + abort (); strcpy (fnam, "/"); strcat (fnam, argv[0]); } diff --git a/tests/tcg/cris/check_settls1.c b/tests/tcg/cris/check_settls1.c index 69d202652a..3abc3a9ea8 100644 --- a/tests/tcg/cris/check_settls1.c +++ b/tests/tcg/cris/check_settls1.c @@ -35,7 +35,7 @@ int main (void) syscall (SYS_set_thread_area, old_tp); if (tp != 0xeddeed00) { - * (volatile int *) 0 = 0; + * (volatile int *) 0 = 0; perror ("tls2"); abort (); } diff --git a/tests/tcg/i386/hello-i386.c b/tests/tcg/i386/hello-i386.c index cfeb24b2f5..59196dd0b7 100644 --- a/tests/tcg/i386/hello-i386.c +++ b/tests/tcg/i386/hello-i386.c @@ -4,19 +4,19 @@ static inline void exit(int status) { int __res; __asm__ volatile ("movl %%ecx,%%ebx\n"\ - "int $0x80" \ - : "=a" (__res) : "0" (__NR_exit),"c" ((long)(status))); + "int $0x80" \ + : "=a" (__res) : "0" (__NR_exit),"c" ((long)(status))); } static inline int write(int fd, const char * buf, int len) { int status; __asm__ volatile ("pushl %%ebx\n"\ - "movl %%esi,%%ebx\n"\ - "int $0x80\n" \ - "popl %%ebx\n"\ - : "=a" (status) \ - : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len))); + "movl %%esi,%%ebx\n"\ + "int $0x80\n" \ + "popl %%ebx\n"\ + : "=a" (status) \ + : "0" (__NR_write),"S" ((long)(fd)),"c" ((long)(buf)),"d" ((long)(len))); return status; } diff --git a/tests/tcg/mips/hello-mips.c b/tests/tcg/mips/hello-mips.c index f8256730dd..c7052fdf2e 100644 --- a/tests/tcg/mips/hello-mips.c +++ b/tests/tcg/mips/hello-mips.c @@ -24,9 +24,9 @@ static inline void exit1(int status) " syscall \n" " .set pop " : - : "i" (__NR_exit), "r" (__a0) - : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", - "memory"); + : "i" (__NR_exit), "r" (__a0) + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", + "memory"); } static inline int write(int fd, const char *buf, int len) @@ -46,8 +46,8 @@ static inline int write(int fd, const char *buf, int len) " .set pop " : "=r" (__v0), "=r" (__a3) : "i" (__NR_write), "r" (__a0), "r" (__a1), "r" (__a2) - : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", - "memory"); + : "$2", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", + "memory"); /* if (__a3 == 0) */ return (int) __v0; diff --git a/tests/tcg/multiarch/sha1.c b/tests/tcg/multiarch/sha1.c index 93b7c8e808..87bfbcdf52 100644 --- a/tests/tcg/multiarch/sha1.c +++ b/tests/tcg/multiarch/sha1.c @@ -152,7 +152,7 @@ uint32_t j; j = context->count[0]; if ((context->count[0] += len << 3) < j) - context->count[1]++; + context->count[1]++; context->count[1] += (len>>29); j = (j >> 3) & 63; if ((j + len) > 63) { @@ -186,11 +186,11 @@ unsigned char c; for (i = 0; i < 2; i++) { - uint32_t t = context->count[i]; - int j; + uint32_t t = context->count[i]; + int j; - for (j = 0; j < 4; t >>= 8, j++) - *--fcp = (unsigned char) t; + for (j = 0; j < 4; t >>= 8, j++) + *--fcp = (unsigned char) t; } #else for (i = 0; i < 8; i++) { @@ -201,7 +201,7 @@ unsigned char c; c = 0200; SHA1Update(context, &c, 1); while ((context->count[0] & 504) != 448) { - c = 0000; + c = 0000; SHA1Update(context, &c, 1); } SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 45d58d8ea2..54982f68e7 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -354,8 +354,8 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) break; case VHOST_USER_SET_FEATURES: - g_assert_cmpint(msg.payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), - !=, 0ULL); + g_assert_cmpint(msg.payload.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES), + !=, 0ULL); if (s->test_flags == TEST_FLAGS_DISCONNECT) { qemu_chr_fe_disconnect(chr); s->test_flags = TEST_FLAGS_BAD; diff --git a/ui/keymaps.h b/ui/keymaps.h index 98213a4191..4e9c87fb8f 100644 --- a/ui/keymaps.h +++ b/ui/keymaps.h @@ -28,8 +28,8 @@ #include "qemu-common.h" typedef struct { - const char* name; - int keysym; + const char* name; + int keysym; } name2keysym_t; /* scancode without modifiers */ diff --git a/ui/qemu-pixman.c b/ui/qemu-pixman.c index 3e52abd92d..1429cf08d5 100644 --- a/ui/qemu-pixman.c +++ b/ui/qemu-pixman.c @@ -36,7 +36,7 @@ PixelFormat qemu_pixelformat_from_pixman(pixman_format_code_t format) pf.rshift = 0; break; case PIXMAN_TYPE_BGRA: - pf.bshift = bpp - pf.bbits; + pf.bshift = bpp - pf.bbits; pf.gshift = bpp - (pf.bbits + pf.gbits); pf.rshift = bpp - (pf.bbits + pf.gbits + pf.rbits); pf.ashift = 0; diff --git a/ui/vnc-enc-zywrle-template.c b/ui/vnc-enc-zywrle-template.c index b446380a7a..e9be55966e 100644 --- a/ui/vnc-enc-zywrle-template.c +++ b/ui/vnc-enc-zywrle-template.c @@ -44,8 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /* Change Log: V0.02 : 2008/02/04 : Fix mis encode/decode when width != scanline - (Thanks Johannes Schindelin, author of LibVNC - Server/Client) + (Thanks Johannes Schindelin, author of LibVNC + Server/Client) V0.01 : 2007/02/06 : Initial release */ diff --git a/ui/vnc.c b/ui/vnc.c index 0c1b477425..9e4b2beb71 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -3097,8 +3097,8 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc, buffer_init(&vs->zrle.zlib, "vnc-zrle-zlib/%p", sioc); if (skipauth) { - vs->auth = VNC_AUTH_NONE; - vs->subauth = VNC_AUTH_INVALID; + vs->auth = VNC_AUTH_NONE; + vs->subauth = VNC_AUTH_INVALID; } else { if (websocket) { vs->auth = vd->ws_auth; diff --git a/util/bitops.c b/util/bitops.c index f2364015c4..3fe6b1c4f1 100644 --- a/util/bitops.c +++ b/util/bitops.c @@ -18,7 +18,7 @@ * Find the next set bit in a memory region. */ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) + unsigned long offset) { const unsigned long *p = addr + BIT_WORD(offset); unsigned long result = offset & ~(BITS_PER_LONG-1); @@ -83,7 +83,7 @@ found_middle: * Linus' asm-alpha/bitops.h. */ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) + unsigned long offset) { const unsigned long *p = addr + BIT_WORD(offset); unsigned long result = offset & ~(BITS_PER_LONG-1); diff --git a/util/osdep.c b/util/osdep.c index 1c8d1e2ee0..4b5dc7287d 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -470,8 +470,8 @@ void fips_set_state(bool requested) #ifdef _FIPS_DEBUG fprintf(stderr, "FIPS mode %s (requested %s)\n", - (fips_enabled ? "enabled" : "disabled"), - (requested ? "enabled" : "disabled")); + (fips_enabled ? "enabled" : "disabled"), + (requested ? "enabled" : "disabled")); #endif } diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index 8bd8bb64eb..9705051690 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -270,8 +270,8 @@ static int inet_listen_saddr(InetSocketAddress *saddr, /* create socket + bind/listen */ for (e = res; e != NULL; e = e->ai_next) { getnameinfo((struct sockaddr*)e->ai_addr,e->ai_addrlen, - uaddr,INET6_ADDRSTRLEN,uport,32, - NI_NUMERICHOST | NI_NUMERICSERV); + uaddr,INET6_ADDRSTRLEN,uport,32, + NI_NUMERICHOST | NI_NUMERICSERV); port_min = inet_getport(e); port_max = saddr->has_to ? saddr->to + port_offset : port_min;