From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981394923347.279480558376; Tue, 13 Mar 2018 15:49:54 -0700 (PDT) Received: from localhost ([::1]:43281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsjw-0006tN-Pd for importer@patchew.org; Tue, 13 Mar 2018 18:49:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshb-0005Lw-PQ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshY-0002e8-0W for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:27 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:51047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshX-0002ce-O4 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:23 -0400 Received: by mail-wm0-x243.google.com with SMTP id w128so866479wmw.0 for ; Tue, 13 Mar 2018 15:47:23 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.20 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8qg9Q9rdQxqNibdphKgwimRppw34N8eblv6OWd3e46Q=; b=cnrc8R2qo5q6zYq4L4DSB2gOREd9AUydRW6DWjeBpPVABtlmSRuGuuHveVsHTLTM6d PQjYqYpYcEkgJT9kS7qWxvhM+MuWF+WRHXFT7rXqkCOHhRpGy0BzN/Su1XMdIMjJwy4D C0+riwHuYvGxY9dHSyzNtSRqlincSZg0ANh2+mlGonh1HKRbn+dMr6uDvI7Jkq6qUaCv 0jIuJmh0a++5J9x97StU43igARpXdlrQ2qPGm6B0DQ5BRjJY873J3cLqSHENMTXpluS2 eubFamCuQaPQ7seGcyiO9Ed8wwYB6lYQYlAoKME0QrAWIIuQvjNd3wv/jUXVnjDrkr0r uFJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8qg9Q9rdQxqNibdphKgwimRppw34N8eblv6OWd3e46Q=; b=Pac7RcfAkwCZWILeCvjrM9myCKdlpohS4kWhmdOlQL9CkJ3vNEgs4a5bXUGq/nxi5y +uGr5OLiIlcp/f3zOfNspum7bkOtYHuLE2sCokkTr116CIZxdYdLoXN7uDfRPycJTCpn 1/KB/Uu0SNWd1Qb2TdTPu8pLPy3Um27G7rUpwSv4sZ91RPQuwx1moYMmZ6YmHghgabsK JasqP5mDylENsYtIvbYV1RnPHCUFqqW6bTOABEtVDoKGv7c5KnwPfyMU23XhwbYqkLTV q6knk+lT988fKpeySiDbo5QlSEVtg6MCuyBTpfhCrTnZDkZ66PNGcWeCQXz/qj4jIS1f 7aMg== X-Gm-Message-State: AElRT7Hr/IyCwkiSzH6AX72ELvI3ysGjC9KLCIceS+cCOiptD5IQ1Kts Aym6hnjB1RvJLwGs0hxIX6fVnXWH X-Google-Smtp-Source: AG47ELv+jc0YLvJi+15j8mILa3Irou8ejyXKxF7bSn8+3itshL6mgvGm9lOrtOrBBsJURBLFfRzv7Q== X-Received: by 10.28.93.82 with SMTP id r79mr1954380wmb.73.1520981241944; Tue, 13 Mar 2018 15:47:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:11 +0100 Message-Id: <20180313224719.4954-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 01/69] qom: introduce object_class_get_list_sorted 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Unify half a dozen copies of very similar code (the only difference being whether comparisons were case-sensitive) and use it also in Tricore, which did not do any sorting of CPU model names. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- include/qom/object.h | 11 +++++++++++ qdev-monitor.c | 9 +-------- qom/object.c | 13 +++++++++++++ target/alpha/cpu.c | 15 +-------------- target/hppa/cpu.c | 15 +-------------- target/lm32/cpu.c | 15 +-------------- target/sh4/cpu.c | 15 +-------------- target/tricore/helper.c | 2 +- 8 files changed, 30 insertions(+), 65 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 4f07090db0..96ce81bc5e 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -913,6 +913,17 @@ void object_class_foreach(void (*fn)(ObjectClass *klas= s, void *opaque), GSList *object_class_get_list(const char *implements_type, bool include_abstract); =20 +/** + * object_class_get_list_sorted: + * @implements_type: The type to filter for, including its derivatives. + * @include_abstract: Whether to include abstract classes. + * + * Returns: A singly-linked list of the classes in alphabetical + * case-insensitive order. + */ +GSList *object_class_get_list_sorted(const char *implements_type, + bool include_abstract); + /** * object_ref: * @obj: the object diff --git a/qdev-monitor.c b/qdev-monitor.c index b7e3291f8b..61e0300991 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -122,12 +122,6 @@ static void qdev_print_devinfo(DeviceClass *dc) error_printf("\n"); } =20 -static gint devinfo_cmp(gconstpointer a, gconstpointer b) -{ - return strcasecmp(object_class_get_name((ObjectClass *)a), - object_class_get_name((ObjectClass *)b)); -} - static void qdev_print_devinfos(bool show_no_user) { static const char *cat_name[DEVICE_CATEGORY_MAX + 1] =3D { @@ -146,8 +140,7 @@ static void qdev_print_devinfos(bool show_no_user) int i; bool cat_printed; =20 - list =3D g_slist_sort(object_class_get_list(TYPE_DEVICE, false), - devinfo_cmp); + list =3D object_class_get_list_sorted(TYPE_DEVICE, false); =20 for (i =3D 0; i <=3D DEVICE_CATEGORY_MAX; i++) { cat_printed =3D false; diff --git a/qom/object.c b/qom/object.c index 755ad03819..6088f55943 100644 --- a/qom/object.c +++ b/qom/object.c @@ -891,6 +891,19 @@ GSList *object_class_get_list(const char *implements_t= ype, return list; } =20 +static gint object_class_cmp(gconstpointer a, gconstpointer b) +{ + return strcasecmp(object_class_get_name((ObjectClass *)a), + object_class_get_name((ObjectClass *)b)); +} + +GSList *object_class_get_list_sorted(const char *implements_type, + bool include_abstract) +{ + return g_slist_sort(object_class_get_list(implements_type, include_abs= tract), + object_class_cmp); +} + void object_ref(Object *obj) { if (!obj) { diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c index 55675ce419..b08078e7fc 100644 --- a/target/alpha/cpu.c +++ b/target/alpha/cpu.c @@ -71,18 +71,6 @@ static void alpha_cpu_realizefn(DeviceState *dev, Error = **errp) acc->parent_realize(dev, errp); } =20 -/* Sort alphabetically by type name. */ -static gint alpha_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a =3D (ObjectClass *)a; - ObjectClass *class_b =3D (ObjectClass *)b; - const char *name_a, *name_b; - - name_a =3D object_class_get_name(class_a); - name_b =3D object_class_get_name(class_b); - return strcmp(name_a, name_b); -} - static void alpha_cpu_list_entry(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; @@ -100,8 +88,7 @@ void alpha_cpu_list(FILE *f, fprintf_function cpu_fprint= f) }; GSList *list; =20 - list =3D object_class_get_list(TYPE_ALPHA_CPU, false); - list =3D g_slist_sort(list, alpha_cpu_list_compare); + list =3D object_class_get_list_sorted(TYPE_ALPHA_CPU, false); (*cpu_fprintf)(f, "Available CPUs:\n"); g_slist_foreach(list, alpha_cpu_list_entry, &s); g_slist_free(list); diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c index 969f628f0a..c261b6b090 100644 --- a/target/hppa/cpu.c +++ b/target/hppa/cpu.c @@ -110,18 +110,6 @@ static void hppa_cpu_realizefn(DeviceState *dev, Error= **errp) #endif } =20 -/* Sort hppabetically by type name. */ -static gint hppa_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a =3D (ObjectClass *)a; - ObjectClass *class_b =3D (ObjectClass *)b; - const char *name_a, *name_b; - - name_a =3D object_class_get_name(class_a); - name_b =3D object_class_get_name(class_b); - return strcmp(name_a, name_b); -} - static void hppa_cpu_list_entry(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; @@ -138,8 +126,7 @@ void hppa_cpu_list(FILE *f, fprintf_function cpu_fprint= f) }; GSList *list; =20 - list =3D object_class_get_list(TYPE_HPPA_CPU, false); - list =3D g_slist_sort(list, hppa_cpu_list_compare); + list =3D object_class_get_list_sorted(TYPE_HPPA_CPU, false); (*cpu_fprintf)(f, "Available CPUs:\n"); g_slist_foreach(list, hppa_cpu_list_entry, &s); g_slist_free(list); diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c index 96c2499d0b..0003152469 100644 --- a/target/lm32/cpu.c +++ b/target/lm32/cpu.c @@ -32,18 +32,6 @@ static void lm32_cpu_set_pc(CPUState *cs, vaddr value) cpu->env.pc =3D value; } =20 -/* Sort alphabetically by type name. */ -static gint lm32_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a =3D (ObjectClass *)a; - ObjectClass *class_b =3D (ObjectClass *)b; - const char *name_a, *name_b; - - name_a =3D object_class_get_name(class_a); - name_b =3D object_class_get_name(class_b); - return strcmp(name_a, name_b); -} - static void lm32_cpu_list_entry(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; @@ -65,8 +53,7 @@ void lm32_cpu_list(FILE *f, fprintf_function cpu_fprintf) }; GSList *list; =20 - list =3D object_class_get_list(TYPE_LM32_CPU, false); - list =3D g_slist_sort(list, lm32_cpu_list_compare); + list =3D object_class_get_list_sorted(TYPE_LM32_CPU, false); (*cpu_fprintf)(f, "Available CPUs:\n"); g_slist_foreach(list, lm32_cpu_list_entry, &s); g_slist_free(list); diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c index 6302cfda3a..541ffc2d97 100644 --- a/target/sh4/cpu.c +++ b/target/sh4/cpu.c @@ -85,18 +85,6 @@ typedef struct SuperHCPUListState { FILE *file; } SuperHCPUListState; =20 -/* Sort alphabetically by type name. */ -static gint superh_cpu_list_compare(gconstpointer a, gconstpointer b) -{ - ObjectClass *class_a =3D (ObjectClass *)a; - ObjectClass *class_b =3D (ObjectClass *)b; - const char *name_a, *name_b; - - name_a =3D object_class_get_name(class_a); - name_b =3D object_class_get_name(class_b); - return strcmp(name_a, name_b); -} - static void superh_cpu_list_entry(gpointer data, gpointer user_data) { SuperHCPUListState *s =3D user_data; @@ -114,8 +102,7 @@ void sh4_cpu_list(FILE *f, fprintf_function cpu_fprintf) }; GSList *list; =20 - list =3D object_class_get_list(TYPE_SUPERH_CPU, false); - list =3D g_slist_sort(list, superh_cpu_list_compare); + list =3D object_class_get_list_sorted(TYPE_SUPERH_CPU, false); g_slist_foreach(list, superh_cpu_list_entry, &s); g_slist_free(list); } diff --git a/target/tricore/helper.c b/target/tricore/helper.c index 45276d3782..dad7eea085 100644 --- a/target/tricore/helper.c +++ b/target/tricore/helper.c @@ -101,7 +101,7 @@ void tricore_cpu_list(FILE *f, fprintf_function cpu_fpr= intf) }; GSList *list; =20 - list =3D object_class_get_list(TYPE_TRICORE_CPU, false); + list =3D object_class_get_list_sorted(TYPE_TRICORE_CPU, false); (*cpu_fprintf)(f, "Available CPUs:\n"); g_slist_foreach(list, tricore_cpu_list_entry, &s); g_slist_free(list); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981577201895.391903545833; Tue, 13 Mar 2018 15:52:57 -0700 (PDT) Received: from localhost ([::1]:43299 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsmp-000107-Sp for importer@patchew.org; Tue, 13 Mar 2018 18:52:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57742) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshb-0005Lx-Q6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshZ-0002fc-0Z for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:27 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:40556) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshY-0002eU-QU for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:24 -0400 Received: by mail-wr0-x241.google.com with SMTP id s12so12602wre.7 for ; Tue, 13 Mar 2018 15:47:24 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Mw4alALPJ3sE7K3m853LgDjc/mOY7pbVgsCWLe9BmpY=; b=f/UV0nKXK6O3N0PnrLMOmWMshQtHwCDT3lu2tJ3v5a7Xg32hslBR1IgBjuHLM0H4oX E0SMLm2EU6kWVAcNFA+Xme9LQ5mDJYEPSFK0FKhgBMy0TqGjfgY7gJmcsItLFeHZdj/e m6CO8kZvRtw+2NquFuy7YXWqVvQXYHOAAEeUXYjeqVcQOYrezhufEHVYk+ip368oFtRH qYZlK0GHy2KrqiK7CBQwlyNn3W+g2gDw0dlfVCsJw81KNHLUa9riEagZNZazPtd81CpN j9M6hLBKjCmyvlGh+pYP7RS/aQHIGl9ZSPt7SfmOhYwIGcS6g9sfyT2Jr2ryw6jl0kHL oQ2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Mw4alALPJ3sE7K3m853LgDjc/mOY7pbVgsCWLe9BmpY=; b=LKN6D3ebvS7bUuvQGTy8tz52kmGNCXSIMZZ8kWceGkpvO9JpD4YbYP8O3dP5Cj3Ng/ +3oBS4iUADDFcHq9lpqoB5qIe/OGI+r9/kALRpsZOIpGEvo6FKo94D+QpMVwoi2Zbypt 7rrIoFjUOXn60jHN/zoV5lUuSkFNRGEFKAdEpSZaiIi/0lVHNDItq/CfXIQI9cWTCYdn negjxJd4v8wUj/K+ejWay0MwfN6EcW0fTM+qYiMfE3e2oaZcrOn4dD/jYZ7AHqOdaJ6D kR/75moFy4EDBocTjVQvu/DYsXm1ZCUvOAkJxfmSS2USFDUSgy4JQsC0jdIgW9ZgN8tc g2Nw== X-Gm-Message-State: AElRT7HIQr1vaQxB8OZl3jyjLq3ijgkTrUElkZXXuK1WGc+7UgJVFFsN 5tbXuld5ieMK81zB5sTuS5TWC+zJ X-Google-Smtp-Source: AG47ELv3JCxiF+eHk5HP7mh8Z51up4VFRmWbXQUfL2+qDpFEeGd6z71QcU7Us1DKhUvyqNbiayWJAg== X-Received: by 10.223.173.3 with SMTP id p3mr1935282wrc.202.1520981243508; Tue, 13 Mar 2018 15:47:23 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:12 +0100 Message-Id: <20180313224719.4954-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 02/69] net: allow using any PCI NICs in -net or -nic 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Remove the hard-coded list of PCI NIC names; instead, fill an array using all PCI devices listed under DEVICE_CATEGORY_NETWORK. Keep the old shortcut "virtio" for virtio-net-pci. Suggested-by: Thomas Huth Reviewed-by: Thomas Huth Reviewed-by: Jason Wang Signed-off-by: Paolo Bonzini --- hw/pci/pci.c | 61 +++++++++++++++++++++++++++++--------------------------= ---- hw/ppc/e500.c | 2 +- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 2174c254eb..67a3f72bd6 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1815,49 +1815,48 @@ PciInfoList *qmp_query_pci(Error **errp) return head; } =20 -static const char * const pci_nic_models[] =3D { - "ne2k_pci", - "i82551", - "i82557b", - "i82559er", - "rtl8139", - "e1000", - "pcnet", - "virtio", - "sungem", - NULL -}; - -static const char * const pci_nic_names[] =3D { - "ne2k_pci", - "i82551", - "i82557b", - "i82559er", - "rtl8139", - "e1000", - "pcnet", - "virtio-net-pci", - "sungem", - NULL -}; - /* Initialize a PCI NIC. */ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus, const char *default_model, const char *default_devaddr) { const char *devaddr =3D nd->devaddr ? nd->devaddr : default_devaddr; + GSList *list; + GPtrArray *pci_nic_models; PCIBus *bus; PCIDevice *pci_dev; DeviceState *dev; int devfn; int i; =20 - if (qemu_show_nic_models(nd->model, pci_nic_models)) { + if (nd->model && !strcmp(nd->model, "virtio")) { + g_free(nd->model); + nd->model =3D g_strdup("virtio-net-pci"); + } + + list =3D object_class_get_list_sorted(TYPE_PCI_DEVICE, false); + pci_nic_models =3D g_ptr_array_new(); + while (list) { + DeviceClass *dc =3D OBJECT_CLASS_CHECK(DeviceClass, list->data, + TYPE_DEVICE); + GSList *next; + if (test_bit(DEVICE_CATEGORY_NETWORK, dc->categories) && + dc->user_creatable) { + const char *name =3D object_class_get_name(list->data); + g_ptr_array_add(pci_nic_models, (gpointer)name); + } + next =3D list->next; + g_slist_free_1(list); + list =3D next; + } + g_ptr_array_add(pci_nic_models, NULL); + + if (qemu_show_nic_models(nd->model, (const char **)pci_nic_models->pda= ta)) { exit(0); } =20 - i =3D qemu_find_nic_model(nd, pci_nic_models, default_model); + i =3D qemu_find_nic_model(nd, (const char **)pci_nic_models->pdata, + default_model); if (i < 0) { exit(1); } @@ -1865,15 +1864,15 @@ PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus = *rootbus, bus =3D pci_get_bus_devfn(&devfn, rootbus, devaddr); if (!bus) { error_report("Invalid PCI device address %s for device %s", - devaddr, pci_nic_names[i]); + devaddr, nd->model); exit(1); } =20 - pci_dev =3D pci_create(bus, devfn, pci_nic_names[i]); + pci_dev =3D pci_create(bus, devfn, nd->model); dev =3D &pci_dev->qdev; qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); - + g_ptr_array_free(pci_nic_models, true); return pci_dev; } =20 diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 43c15d18c4..2238f963c4 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -916,7 +916,7 @@ void ppce500_init(MachineState *machine, PPCE500Params = *params) if (pci_bus) { /* Register network interfaces. */ for (i =3D 0; i < nb_nics; i++) { - pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio", NULL); + pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio-net-pci", N= ULL); } } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981395341409.90393928772016; Tue, 13 Mar 2018 15:49:55 -0700 (PDT) Received: from localhost ([::1]:43282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsjy-0006to-B3 for importer@patchew.org; Tue, 13 Mar 2018 18:49:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshb-0005Ly-SL for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsha-0002hS-Lj for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:27 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:39399) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsha-0002gR-CZ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:26 -0400 Received: by mail-wm0-x242.google.com with SMTP id u10so666626wmu.4 for ; Tue, 13 Mar 2018 15:47:26 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=h7Q9nkd8GV/N5/vb6+7tgA2wN66pDyMoCxBuowPEsDQ=; b=LJE2kyme7jQZ98rNVWkRlmQ7nvgQlwngmJlcM9z9WWqGOlWeYN5o3/Gm9qt5+ws6nw /jkJWzGfqKnM1FtzLVvHuXeqTBmBpczpKvSFb5iX7KNK+ILYNwB80HGfkqg0iqkPr+Gz 7fz2RH/wUWCmV5gfpl91YF2QsbV5v5V+YGX4p9kgQ6l1o09uOAxGkwsuRA/UpLiptr5q xkU4Fr78CDDOuWC3DwrX/oSWqru9PVD+ke3M8pSOasYiAYdu51j5UmIBps6nwIWsYxnl 3Rj3PkRB/zggJ4X6Ad83C8+feoOplLmNqMF56C7diT8adxrLOvzCWOqFe/bLE3S1F1GI 0ucg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=h7Q9nkd8GV/N5/vb6+7tgA2wN66pDyMoCxBuowPEsDQ=; b=JgYp1VpoF68gOrVuFprBMRBZAZPlUQNbIrCpHuGr/OzTFbk/FuEp/WgMNviPa+s3Dj 73hR6fDyclqPtshxw2KzCthui0/TvgWbmIZh4HwgNI3kWl1pHCHAETBk04hl3d11EnT9 q5DENU3sSSE7OYDolOd6uUd/XCNWfmHFG3PsT3tdmeh3X0q27Fm8EckgF6M9gFF8axPq 8mEoUUr8NFh6aqYhtS/6oCoCqD32LUHIz4SYE/QYVVOu9vJpehFltkZ76DwaBTYjHcU4 MG1O9x1+binTQ4Os2F7SVDGYKmVRga8BU643Ka9Nuf1SprIk1ZoT40Lle766Z92AcXBQ q1wg== X-Gm-Message-State: AElRT7Hrx6HB/7pwagpd+JT9X8KRlhDPEqT1cS3upysG+YWrHzTL3X41 hO2Uq4ktd7ivxkMcULnziwnmal8S X-Google-Smtp-Source: AG47ELv7HUeZlzRLIRlVAB7ZULW9O74IzcuWB09wnYlWxn4xY7zFcC9reFxghan6vtBO8IHVIBticg== X-Received: by 10.28.236.83 with SMTP id k80mr724035wmh.148.1520981244804; Tue, 13 Mar 2018 15:47:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:13 +0100 Message-Id: <20180313224719.4954-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 03/69] q35: change default NIC to e1000e 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The e1000 NIC is getting old and is not a very good default for a PCIe machine type. Change it to e1000e, which should be supported by a good number of guests. In particular, drivers for 82574 were added first to Linux 2.6.27 (2008) and Windows 2008 R2. This does mean that Windows 2008 will not work anymore with Q35 machine types and a default "-net nic -net xxx" network configuration; it did work before because it does have an AHCI driver. However, Windows 2008 has been declared out of main stream support in 2015. It will get out of extended support in 2020. Windows 2008 R2 has the same end of support dates and, since the two are basically Vista vs. Windows 7, R2 probably is more popular. Reviewed-by: Jason Wang Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 7 ++++--- hw/i386/pc_piix.c | 6 +++++- hw/i386/pc_q35.c | 8 +++++++- include/hw/i386/pc.h | 3 ++- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 35fcb6efdf..dc1f535697 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1619,18 +1619,19 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq= *gsi, } } =20 -void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus) +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) { int i; =20 rom_set_order_override(FW_CFG_ORDER_OVERRIDE_NIC); for (i =3D 0; i < nb_nics; i++) { NICInfo *nd =3D &nd_table[i]; + const char *model =3D nd->model ? nd->model : pcmc->default_nic_mo= del; =20 - if (!pci_bus || (nd->model && strcmp(nd->model, "ne2k_isa") =3D=3D= 0)) { + if (g_str_equal(model, "ne2k_isa")) { pc_init_ne2k_isa(isa_bus, nd); } else { - pci_nic_init_nofail(nd, pci_bus, "e1000", NULL); + pci_nic_init_nofail(nd, pci_bus, model, NULL); } } rom_reset_order_override(); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 8658bcba63..0f1966d547 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -240,7 +240,7 @@ static void pc_init1(MachineState *machine, pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true, (pcms->vmport !=3D ON_OFF_AUTO_ON), pcms->pit, 0x= 4); =20 - pc_nic_init(isa_bus, pci_bus); + pc_nic_init(pcmc, isa_bus, pci_bus); =20 ide_drive_get(hd, ARRAY_SIZE(hd)); if (pcmc->pci_enabled) { @@ -417,6 +417,9 @@ static void pc_xen_hvm_init(MachineState *machine) =20 static void pc_i440fx_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pcmc->default_nic_model =3D "e1000"; + m->family =3D "pc_piix"; m->desc =3D "Standard PC (i440FX + PIIX, 1996)"; m->default_machine_opts =3D "firmware=3Dbios-256k.bin"; @@ -1114,6 +1117,7 @@ static void isapc_machine_options(MachineClass *m) pcmc->gigabyte_align =3D false; pcmc->smbios_legacy_mode =3D true; pcmc->has_reserved_memory =3D false; + pcmc->default_nic_model =3D "ne2k_isa"; m->default_cpu_type =3D X86_CPU_TYPE_NAME("486"); } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0c0bc48137..9ae916327e 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -272,7 +272,7 @@ static void pc_q35_init(MachineState *machine) =20 /* the rest devices to which pci devfn is automatically assigned */ pc_vga_init(isa_bus, host_bus); - pc_nic_init(isa_bus, host_bus); + pc_nic_init(pcmc, isa_bus, host_bus); =20 if (pcms->acpi_nvdimm_state.is_enabled) { nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io, @@ -294,6 +294,9 @@ static void pc_q35_init(MachineState *machine) =20 static void pc_q35_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pcmc->default_nic_model =3D "e1000e"; + m->family =3D "pc_q35"; m->desc =3D "Standard PC (Q35 + ICH9, 2009)"; m->units_per_default_bus =3D 1; @@ -316,7 +319,10 @@ DEFINE_Q35_MACHINE(v2_12, "pc-q35-2.12", NULL, =20 static void pc_q35_2_11_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); + pc_q35_2_12_machine_options(m); + pcmc->default_nic_model =3D "e1000"; m->alias =3D NULL; SET_MACHINE_COMPAT(m, PC_COMPAT_2_11); } diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index bb49165fe0..e81654eb7f 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -114,6 +114,7 @@ struct PCMachineClass { /* Device configuration: */ bool pci_enabled; bool kvmclock_enabled; + const char *default_nic_model; =20 /* Compat options: */ =20 @@ -248,7 +249,7 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd); void pc_cmos_init(PCMachineState *pcms, BusState *ide0, BusState *ide1, ISADevice *s); -void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus); +void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus); void pc_pci_device_init(PCIBus *pci_bus); =20 typedef void (*cpu_set_smm_t)(int smm, void *arg); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981585761409.8679684145908; Tue, 13 Mar 2018 15:53:05 -0700 (PDT) Received: from localhost ([::1]:43298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsmm-0000zb-Mn for importer@patchew.org; Tue, 13 Mar 2018 18:52:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshc-0005M0-Hn for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshb-0002iL-HZ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:28 -0400 Received: from mail-wr0-x22a.google.com ([2a00:1450:400c:c0c::22a]:34287) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshb-0002ha-BZ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:27 -0400 Received: by mail-wr0-x22a.google.com with SMTP id o8so2597588wra.1 for ; Tue, 13 Mar 2018 15:47:27 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=F+xEpHrU6Z+I42OD0RSwChBmw4eawrXdlAv7SajXprs=; b=S6A7ncepD+RevD37ujM1bNAbUO+p/Ax2vvzkZbtVztBcxX3WpJ3RxrAQQSn0yanxZh BCKRwwQYHF/+MNGQC1lwiNllLBgvaclqW475Orzs0D7eiFPWH8RYdZ9Xc/GLgsoq07v0 iggwSqV3kHxlF7W0oElzDO1itEsG6+FC40n0QN5PxsFyrWaRfDsV43n/dukXaIwGrNHI IRWLSd5duWNACXllKRoqEj5DLPFZzGNRbAzlhUlAoju6LgWP2SkQfbhI7CEesKDnRglP N0/TgbnA9DOWxIa3k9ojyd4NRj77tbhHk3Vrz5csgAY8t16D3tJR+OENzWlHvV84Pq2Y SSQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=F+xEpHrU6Z+I42OD0RSwChBmw4eawrXdlAv7SajXprs=; b=sC48GF2YXwHoSdiltJNAzjWxswm5ZHSrgMTqXI6lonUpaHcT4LmlppAShKeQr2upVR ALyWGJiS9tur9qaz1GU2snGvfe8IIuxS6213wtxEg+9kYO1HpYSKDR+Th/uki2RNIXVx Dh5j8tAfvK/zBPMNcw9Lu9++DbLMzx8IETle85sisSHPuWDAoyPStHP73tS8cFoxMuzW QMCGimETVW5AHewrDvmGJHIPsak7irDZYVZcparWsOAo6mdbGQuEoYLXmnujlFv1H4nL jqtInjl/gPbF5U6vDN78C0REE245pVKxWuHFR8Qf/Iku+z6mF3T8efWbSkbF9+76uWD3 bZCg== X-Gm-Message-State: AElRT7F76wtuYv5bv/Eiy92Ig18TQvqE7UYIXOUMrnGK4E9exDGaLLBb CAwdYerz9vOyQYNwRcdXVq3f98Rg X-Google-Smtp-Source: AG47ELvwrRcdXqYdalMM3uM+y/DBJveOpOktSVnwyApaxI1rVl/N59cLPYLI4pO/jGoflhYMr47L2A== X-Received: by 10.223.164.138 with SMTP id g10mr1826743wrb.74.1520981245916; Tue, 13 Mar 2018 15:47:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:14 +0100 Message-Id: <20180313224719.4954-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22a Subject: [Qemu-devel] [PULL 04/69] scsi-disk.c: consider bl->max_transfer in INQUIRY emulation 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: Daniel Henrique Barboza Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Daniel Henrique Barboza The calculation of the max_transfer atribute of BlockDriverState makes considerations such as max_segments and transfer_length via the BLKSECTGET ioctl (if available). However, bl->max_transfer isn't considered when emulating the INQUIRY 'Block Limit' response to the scsi-hd devices. This leads to situations where the declared max_sectors from the INQUIRY response is inconsistent with the block limits, which isn't ideal. It can also be misleading to the user that sets /sys/block//queue/max_sectors_kb to a certain value, then finds a different value in the guest OS for the same disk. Following the same logic scsi_read_complete from scsi-generic.c does when patching the response of the Block Limits VPD back to the guest, change the max_io_sectors value of the emulated Block Limits VPD response by considering the blk_get_max_transfer of the related BlockDriverState. Use MIN_NOT_ZERO to be sure that the minimal value is chosen. Given that we're changing max_io_sectors, consider that min_io_sectors and opt_io_sectors can't be greater than the new calculated value. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Fam Zheng Message-Id: <20180306154411.18462-1-danielhb@linux.vnet.ibm.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 49d2559d93..c65c1ce56d 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -704,6 +704,21 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req,= uint8_t *outbuf) page_code); return -1; } + if (s->qdev.type =3D=3D TYPE_DISK) { + int max_transfer_blk =3D blk_get_max_transfer(s->qdev.conf= .blk); + int max_io_sectors_blk =3D + max_transfer_blk / s->qdev.blocksize; + + max_io_sectors =3D + MIN_NON_ZERO(max_io_sectors_blk, max_io_sectors); + + /* min_io_size and opt_io_size can't be greater than + * max_io_sectors */ + min_io_size =3D + MIN_NON_ZERO(min_io_size, max_io_sectors); + opt_io_size =3D + MIN_NON_ZERO(opt_io_size, max_io_sectors); + } /* required VPD size with unmap support */ buflen =3D 0x40; memset(outbuf + 4, 0, buflen - 4); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981742769724.582143873132; Tue, 13 Mar 2018 15:55:42 -0700 (PDT) Received: from localhost ([::1]:43311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evspS-0003P9-UW for importer@patchew.org; Tue, 13 Mar 2018 18:55:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshe-0005M5-9U for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshd-0002kL-4p for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:30 -0400 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:42068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshc-0002jE-UA for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:29 -0400 Received: by mail-wr0-x232.google.com with SMTP id s18so2505294wrg.9 for ; Tue, 13 Mar 2018 15:47:28 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5htEyYqNHN1AEPzoCfrK2HEQwz6w2gP2makGzdzNhUA=; b=ej/EttEIo+NP0XNHpkufpEVfuWBkZIcWKIKZ8FF/SBe3APQifcosn4EsUNEzR3cL7z ACWa9THZDb7+YRqiKvBMsXebNZhI4w/lkyXQ9L+dl9AffL54Rgx/RfMvtR48qpCf/YZH bsuoqrH/XAfjQtYDfqDU0UnnK1UHXbyRFQuU8KFGw3EZEU6cCG0vRAlqcW4e/NZFs9re K+pFDHFYGMfSziDFdwnpcDed1fyPwXBUZh5sOwLLQMKPMZqEnyb79duzGTEctwUtr0F7 FmGvMqwgr8nqg9bOpD18XOB0t8W/O65ytODhinwbeqUoAqbKwp/vlFZJcnb9EwnA7vN3 8BNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5htEyYqNHN1AEPzoCfrK2HEQwz6w2gP2makGzdzNhUA=; b=BZvvb/8aimSw/4DUCF2j11oa+fB9V5+vvFu+ySl3iaAJ/HAvqLlFsIMXSFiNuqDRn6 Os4XEGhf7fDXSATtdVLX1KHhljXqZI6Xf/qTM7pdzp4qRkSEbymcMx1WZLOJe7D2hL/R aNoY5b73MFFQVqcfsy0oxdpUYh/TQiN5aup3v+1AyjUoV7cx+JFbRuifllU3Q+krGZ6t tXO6Vl6RfgZv6QtIDNoKCsCtX/2DGAIiZEuYZ3Ef/mkXrJCqmi3XxfVOsFMFC/eTHp2F QqzcWvqVGLnJKUIR+0YP/AMcVYyEPxk9Av+Oon9A0gpmRBn3bbJc5YXvAFSZJjvDDBmC 8cjA== X-Gm-Message-State: AElRT7H4cyJ65amA/qk0KzYDEsRVX6+l3JvVWPjbEd4PlrBDpQQPqkBS EGBTDs4EKWvnKdU8ot2mu5qIEVEt X-Google-Smtp-Source: AG47ELsnxE9V7qlejiw8l+KpjxGD6+MrfKVqSE5CbDHEQfcrM2Y0M1rUs85amh3WFoqvxsLunpnEsA== X-Received: by 10.223.129.203 with SMTP id 69mr1989409wra.45.1520981247424; Tue, 13 Mar 2018 15:47:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:15 +0100 Message-Id: <20180313224719.4954-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::232 Subject: [Qemu-devel] [PULL 05/69] qemu-doc: update deprecation section to use -nic and -netdev hubport 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: Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The deprecated SLIRP options -tftp, -bootp, -redir, -smb provide sample replacements that use "-net nic". Suggest "-nic" instead, since we finally have a path towards getting rid of "-net". For "-net vlan" the replacement involves hubport network devices, so mention that too. Cc: Jason Wang Acked-by: Thomas Huth Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 39e38c87ec..918d97c18b 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2643,42 +2643,46 @@ combined with ``-vnc tls-creds=3Dtls0' =20 @subsection -tftp (since 2.6.0) =20 -The ``-tftp /some/dir'' argument is replaced by -``-netdev user,id=3Dx,tftp=3D/some/dir'', either accompanied with -``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +The ``-tftp /some/dir'' argument is replaced by either +``-netdev user,id=3Dx,tftp=3D/some/dir '' (for pluggable NICs, accompanied +with ``-device ...,netdev=3Dx''), or ``-nic user,tftp=3D/some/dir'' (for embedded NICs). The new syntax allows different settings to be provided per NIC. =20 @subsection -bootp (since 2.6.0) =20 -The ``-bootp /some/file'' argument is replaced by -``-netdev user,id=3Dx,bootp=3D/some/file'', either accompanied with -``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +The ``-bootp /some/file'' argument is replaced by either +``-netdev user,id=3Dx,bootp=3D/some/file '' (for pluggable NICs, accompani= ed +with ``-device ...,netdev=3Dx''), or ``-nic user,bootp=3D/some/file'' (for embedded NICs). The new syntax allows different settings to be provided per NIC. =20 @subsection -redir (since 2.6.0) =20 The ``-redir [tcp|udp]:hostport:[guestaddr]:guestport'' argument is -replaced by ``-netdev -user,id=3Dx,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport'= ', -either accompanied with ``-device ...,netdev=3Dx'' (for pluggable NICs) or -``-net nic,netdev=3Dx'' (for embedded NICs). The new syntax allows differe= nt -settings to be provided per NIC. +replaced by either +``-netdev user,id=3Dx,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:= guestport'' +(for pluggable NICs, accompanied with ``-device ...,netdev=3Dx'') or +``-nic user,hostfwd=3D[tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport'' +(for embedded NICs). The new syntax allows different settings to be +provided per NIC. =20 @subsection -smb (since 2.6.0) =20 -The ``-smb /some/dir'' argument is replaced by -``-netdev user,id=3Dx,smb=3D/some/dir'', either accompanied with -``-device ...,netdev=3Dx'' (for pluggable NICs) or ``-net nic,netdev=3Dx'' +The ``-smb /some/dir'' argument is replaced by either +``-netdev user,id=3Dx,smb=3D/some/dir '' (for pluggable NICs, accompanied +with ``-device ...,netdev=3Dx''), or ``-nic user,smb=3D/some/dir'' (for embedded NICs). The new syntax allows different settings to be provided per NIC. =20 @subsection -net vlan (since 2.9.0) =20 -The ``-net vlan=3DNN'' argument is partially replaced with the -new ``-netdev'' argument. The remaining use cases will no -longer be directly supported in QEMU. +The ``-net vlan=3DNN'' argument was mostly used to attach separate +network backends to different virtual NICs. This is the default +behavior for ``-netdev'' and ``-nic''. You can connect multiple +``-netdev'' and ``-nic'' devices to the same network using the +"hubport" network backend, created with ``-netdev hubport,hubid=3DNN,...'' +and ``-nic hubport,hubid=3DNN''. =20 @subsection -drive cyls=3D...,heads=3D...,secs=3D...,trans=3D... (since 2.= 10.0) =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098152722714.306077936067595; Tue, 13 Mar 2018 15:52:07 -0700 (PDT) Received: from localhost ([::1]:43297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evslx-0000Fi-Vh for importer@patchew.org; Tue, 13 Mar 2018 18:51:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshf-0005MC-Gq for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshe-0002lv-7p for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:41584) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshe-0002km-1P for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:30 -0400 Received: by mail-wr0-x242.google.com with SMTP id f14so2516806wre.8 for ; Tue, 13 Mar 2018 15:47:29 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Nlx3pdSTTHPa9zYW+NjQfgwtfBIv0qQv0Ae1ZBaWsRw=; b=UlHZY9O73fgO8eNEvGT+ZiX2RSAlCnGuBcrZccBgv7U7EvUuB5c3k1l1BJ0Gv6NLwR uAi6RJO2e75UIp94NbJoXvYLQbdiWAbB83sAcQPCl0jD0nV9M8R1RgYj+FaMY1fuWM8b wcrpSmgsu3LeQLctR5y1SduBJRw40bx+Ej1CMLo+u90YFPDy1WDQjwSFEmnI8K23/MPZ GMcC0VXmUAfbOqZw37waj/2/6Ke28UOoTvUo4z5uTHca/q+qntpldT166fd90sxQxaGT xCV8+BgwODTviXLkcdfzcGdVeVkVjqepL9rn1twHVEAnT+Vry2VDJ3urpVjFWo4u6jfM kabA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Nlx3pdSTTHPa9zYW+NjQfgwtfBIv0qQv0Ae1ZBaWsRw=; b=pHoXGHRI+7PPh3HL9GH+s9rqYzoftsjpewlJp4niTmYiWJ79H7tml8T0bzEcz577N+ Wn7ZtifMwY90dCaKNtrBUxHlBy6XQ0ScxC4QblMyMb4Clmnb8vkcQ5ydPkz9V1saFXJj k6yH62v267P1Ue/3DqI+5Y2j0ShBSHKZEnxmKilNvUN8BUMNvX5ZXLPQhK5GzSUDSRWv jg1YkkgJHNy41b/OFPHZd0BRcpPqDsEU01v2sCHu3pTCFVy1HWxOFfCOgzhKuRE0BjmX JokTxUnubV1WiPw2347PcW+r6OmGUZk4MBNtOffIYc5JBpp7leH8zZaRCt/RqfzrHNo6 uy1Q== X-Gm-Message-State: AElRT7F5A7XbeLF59miKjyGYs+QIxkPSq/X4GxlSfmwzDhxk1JdC7GFa MOlCNcgf/2sYamqLUheqJoSzqIOB X-Google-Smtp-Source: AG47ELt7UWit1HHjsz21JR0AH4CsQ+HZplmycgZdzw+0lFmNmXXyRmEybPQGH5o8VTHaE0/H556hxw== X-Received: by 10.223.176.237 with SMTP id j42mr1937996wra.25.1520981248434; Tue, 13 Mar 2018 15:47:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:16 +0100 Message-Id: <20180313224719.4954-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 06/69] qemu-doc: Add the paragraph about the -no-frame deprecation again 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The section has accidentially been removed while resolving a contextual conflict during a rebase, so add this again. Fixes: f29d4450428fe07e9d6b0655cef2e59bfa0b2ea5 Signed-off-by: Thomas Huth Message-Id: <1520405769-22179-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qemu-doc.texi b/qemu-doc.texi index 918d97c18b..f8da9b8135 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2732,6 +2732,12 @@ filesystem test suite. Also it requires the CAP_DAC_= READ_SEARCH capability, which is not the recommended way to run QEMU. This backend should not be used and it will be removed with no replacement. =20 +@subsection -no-frame (since 2.12.0) + +The @code{--no-frame} argument works with SDL 1.2 only. The other user +interfaces never implemented this in the first place. So this will be +removed together with SDL 1.2 support. + @subsection -rtc-td-hack (since 2.12.0) =20 The @code{-rtc-td-hack} option has been replaced by --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981737408594.400342272679; Tue, 13 Mar 2018 15:55:37 -0700 (PDT) Received: from localhost ([::1]:43312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evspU-0003Q0-HU for importer@patchew.org; Tue, 13 Mar 2018 18:55:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshg-0005Mr-1y for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshf-0002nP-CI for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:32 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36081) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshf-0002mN-4n for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:31 -0400 Received: by mail-wr0-x242.google.com with SMTP id d10so2571198wrf.3 for ; Tue, 13 Mar 2018 15:47:30 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R4XzauQ55b9NWDB5rIVOL2Qp8EFZ+BPugb8Rhhxm5f0=; b=mOp4vHU/Or0mcUPAsx2NusoVZr6ySntQ+wyU7KTrcqdeov2qSaKPVotHu1PBT7PAlb NlcCRfFrBkF5WDHcVhhHvw8RhQhUXaSOlsbdZ6MfKEkLX11Rv78YFGCBe8ONnJ0zbTI5 8y7OPzfISW9cfW/YAemvOR4ojVwqdLIx4tUphlrVHk7vIR0oiOwhtGQbexTZwlxYteyl 3EZ5P+8gralhOYUKHx88F70tB3s7CX7/xS3x1ezkrZNDBoIbTCy3KKHW2Ph7CW7D+DA3 J6nb8adnSOQch9tlgZnT+kYaM6kLfi6E++2nsy3ncdZxzmBEbDTQDnil7T8PwYMw2McX CHyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=R4XzauQ55b9NWDB5rIVOL2Qp8EFZ+BPugb8Rhhxm5f0=; b=VECXw4z6x4c6+8zKSyCikHnun5DZpHjRSOTIY+K38HRgH3DRIKaCFUO0htjE31c091 ygk3Y2JYx8qSz6SHqrBm2/hOoyKcrMrtJgfeYurRfg7PY5kHEt9V1phc0o0IMIh6y75n S00xXuPjwN3Nzg5bI8/goS9I2OTBqwrzIL0ErHhbiTsIkcsObt43yZGaXWKm32gshwCH HatF9FpjG69V3ITELJ9cyYnapJlOIrhGhvOXO+xWPLLgx8V3vsE3A35dXpkYRSGM1jJl cTCD1gfi21oy7/6wk1To3JmLPDyuWLs8SDiRyMFg3PFx4wYAVO7k5QdSridinHiJzoIc nnOw== X-Gm-Message-State: AElRT7E3YstHSFmnN265Vc5UqgdYHi95V3d4r28fVmmVjE9t5edoOQhf wnC3OX+c1w+dUdRlUn3fi1ZzDrbI X-Google-Smtp-Source: AG47ELsG7NrgIYkp01JvLABA0YvjBjMCWNWoK6FeTKKJwxPm4BuhEyxTnKQIVQzEaP5y7gi4u0PRBw== X-Received: by 10.223.161.195 with SMTP id v3mr1956247wrv.184.1520981249746; Tue, 13 Mar 2018 15:47:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:17 +0100 Message-Id: <20180313224719.4954-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 07/69] build-sys: make help could have 'modules' target 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=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Available when configure --enable-modules. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180306161728.20890-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 9a75c48ae0..5d9ef3b8fd 100644 --- a/Makefile +++ b/Makefile @@ -1046,6 +1046,9 @@ include $(SRC_PATH)/tests/vm/Makefile.include help: @echo 'Generic targets:' @echo ' all - Build all' +ifdef CONFIG_MODULES + @echo ' modules - Build all modules' +endif @echo ' dir/file.o - Build specified target only' @echo ' install - Install QEMU, documentation and tools' @echo ' ctags/TAGS - Generate tags file for editors' --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981907226899.862419168118; Tue, 13 Mar 2018 15:58:27 -0700 (PDT) Received: from localhost ([::1]:43331 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evss4-0005rp-IF for importer@patchew.org; Tue, 13 Mar 2018 18:58:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshm-0005SY-1N for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshh-0002pm-1U for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:54367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshg-0002oD-NM for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:32 -0400 Received: by mail-wm0-x22b.google.com with SMTP id h76so869427wme.4 for ; Tue, 13 Mar 2018 15:47:32 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=FBgIyHoo1YHUTWLs5jezXo10UYZtTGofQKqwS/yeIRs=; b=b0pD8Ci3GKPm4g3XpLX44CltFccPeNuRy3nL7ZwypDHxTZS+lyEeEc5J3XcLCF2dg7 CAxhRCnFzXEUOnAw8sXjSPgpun0AWrJuFBLf/kKLeowDdnqEuXBtfVz21YSd3IKux/fw 6gkXNEXsl7I40MXyZFkmtorY0Mn0bDGbUd4XHfvPTm+5krzaeOWVPImTKy+foVZ9MoFS d0kUKcNzobxpy516jTcowMOU1PWEhn9fkexGV9NNpBk51fYAYjU1YE1PKIDRmBZwW8UZ 3LMP4A3ahKjbxXZExZ+4WuDh1MJUY47QGRyCjXJnb3V5nX9hcNfBSnT1FGjWrEFYGcg1 Y9+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=FBgIyHoo1YHUTWLs5jezXo10UYZtTGofQKqwS/yeIRs=; b=i67vVI1rC3tnJx2+qTWqagui7mYzAHV786xUzDLxzyS3FXX7YMx4avR4gxqMDhBFEa fFhayfKiw4Qwfd6yHVi/9Ld0X3lSDtnHSy6YBbA/G6KbH45ICj5tUkwa7WKAgAUtGk3X rswG6++dlG7fMHFFMQpIe3T94m8pQeaRQtN9dGSJJXLCmX9Syx1HLm8Dayg1pOyqoR9R a405oBrtC3mFglzWtQr3XJK1xlplI4t9xAaXcOCaXX80TZBiOJ28UfoH42RV5w9/NxJN VB3M18N/YisV3sBoTOToxwmThyNhpUPXppwLq9QBSPYU4QAUCbVyRqeMZcerLMQAhGO6 fTEQ== X-Gm-Message-State: AElRT7EwYT3lbc0ZgS0Eun2mG280ayC+o/COdZV5z4p7KEIIlebxJGqa jln1R2KV/rETGDVFc6YlN/wTNZP5 X-Google-Smtp-Source: AG47ELtbDqeGD8gxkKTStIqNwli8zi7fS2GzjtEqXPqlL2OF8qKq5f5IocqeXwbMLsNno/dTuZ8Vew== X-Received: by 10.28.230.68 with SMTP id d65mr2117360wmh.13.1520981251154; Tue, 13 Mar 2018 15:47:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:18 +0100 Message-Id: <20180313224719.4954-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b Subject: [Qemu-devel] [PULL 08/69] hw: Do not include "sysemu/block-backend.h" if it is not 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: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth After reviewing a patch from Philippe that removes block-backend.h from hw/lm32/milkymist.c, I noticed that this header is included unnecessarily in a lot of other files, too. Remove those unneeded includes to speed up the compilation process a little bit. Signed-off-by: Thomas Huth Message-Id: <1518684912-31637-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/arm/highbank.c | 1 - hw/arm/msf2-soc.c | 1 - hw/arm/realview.c | 1 - hw/arm/tosa.c | 1 - hw/i386/pc.c | 2 -- hw/i386/pc_piix.c | 1 - hw/ide/ahci-allwinner.c | 1 - hw/ide/cmd646.c | 1 - hw/ide/ich.c | 1 - hw/ide/isa.c | 1 - hw/ide/microdrive.c | 1 - hw/ide/mmio.c | 1 - hw/mips/mips_fulong2e.c | 1 - hw/mips/mips_jazz.c | 1 - hw/ppc/mac_newworld.c | 1 - hw/ppc/mac_oldworld.c | 1 - hw/ppc/prep.c | 1 - hw/scsi/mptendian.c | 1 - hw/sd/core.c | 1 - hw/sparc/sun4m.c | 1 - hw/tricore/tricore_testboard.c | 2 -- 21 files changed, 23 deletions(-) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index 287392bbdc..1742cf6f6c 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -27,7 +27,6 @@ #include "sysemu/kvm.h" #include "sysemu/sysemu.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index a8ec2cdf36..f68df56b97 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -29,7 +29,6 @@ #include "exec/address-spaces.h" #include "hw/char/serial.h" #include "hw/boards.h" -#include "sysemu/block-backend.h" #include "qemu/cutils.h" #include "hw/arm/msf2-soc.h" #include "hw/misc/unimp.h" diff --git a/hw/arm/realview.c b/hw/arm/realview.c index 87cd1e583c..2139a62e25 100644 --- a/hw/arm/realview.c +++ b/hw/arm/realview.c @@ -20,7 +20,6 @@ #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/i2c/i2c.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" #include "hw/char/pl011.h" diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index a55b1a369c..7a925fa5e6 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -22,7 +22,6 @@ #include "hw/boards.h" #include "hw/i2c/i2c.h" #include "hw/ssi/ssi.h" -#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" #include "sysemu/sysemu.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dc1f535697..0c140f4dc7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -50,8 +50,6 @@ #include "sysemu/qtest.h" #include "kvm_i386.h" #include "hw/xen/xen.h" -#include "sysemu/block-backend.h" -#include "hw/block/block.h" #include "ui/qemu-spice.h" #include "exec/memory.h" #include "exec/address-spaces.h" diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 0f1966d547..729a0508aa 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -40,7 +40,6 @@ #include "sysemu/sysemu.h" #include "hw/sysbus.h" #include "sysemu/arch_init.h" -#include "sysemu/block-backend.h" #include "hw/i2c/smbus.h" #include "hw/xen/xen.h" #include "exec/memory.h" diff --git a/hw/ide/ahci-allwinner.c b/hw/ide/ahci-allwinner.c index c3f1604936..5397483fd8 100644 --- a/hw/ide/ahci-allwinner.c +++ b/hw/ide/ahci-allwinner.c @@ -18,7 +18,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "qemu/error-report.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "hw/ide/internal.h" #include "hw/ide/ahci_internal.h" diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c index 65aff518ec..6bb92d717f 100644 --- a/hw/ide/cmd646.c +++ b/hw/ide/cmd646.c @@ -26,7 +26,6 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" -#include "sysemu/block-backend.h" #include "sysemu/sysemu.h" #include "sysemu/dma.h" =20 diff --git a/hw/ide/ich.c b/hw/ide/ich.c index c01b24ecbe..134478ebb2 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -65,7 +65,6 @@ #include "hw/pci/msi.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" #include "hw/ide/pci.h" #include "hw/ide/ahci_internal.h" diff --git a/hw/ide/isa.c b/hw/ide/isa.c index 9fb24fc92b..028bd61774 100644 --- a/hw/ide/isa.c +++ b/hw/ide/isa.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/isa/isa.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" =20 #include "hw/ide/internal.h" diff --git a/hw/ide/microdrive.c b/hw/ide/microdrive.c index 58e4f52f7d..34bb98dce8 100644 --- a/hw/ide/microdrive.c +++ b/hw/ide/microdrive.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/pcmcia.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" =20 #include "hw/ide/internal.h" diff --git a/hw/ide/mmio.c b/hw/ide/mmio.c index 6f12f456ed..42fcf139ee 100644 --- a/hw/ide/mmio.c +++ b/hw/ide/mmio.c @@ -25,7 +25,6 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/sysbus.h" -#include "sysemu/block-backend.h" #include "sysemu/dma.h" =20 #include "hw/ide/internal.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index f68c625666..be4f83973d 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -27,7 +27,6 @@ #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index b09871a814..08e6f620fc 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -41,7 +41,6 @@ #include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" -#include "sysemu/block-backend.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index a749e2565d..2f5b6f651a 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -69,7 +69,6 @@ #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "hw/usb.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "hw/sysbus.h" #include "qemu/cutils.h" diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 935493c966..10e291ca22 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -44,7 +44,6 @@ #include "qemu/error-report.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" #include "qemu/cutils.h" =20 diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 096d4d4cfb..c9d8950de7 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -43,7 +43,6 @@ #include "hw/timer/mc146818rtc.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" -#include "sysemu/block-backend.h" #include "sysemu/arch_init.h" #include "sysemu/kvm.h" #include "sysemu/qtest.h" diff --git a/hw/scsi/mptendian.c b/hw/scsi/mptendian.c index 3415229b5e..8ae39a76f4 100644 --- a/hw/scsi/mptendian.c +++ b/hw/scsi/mptendian.c @@ -24,7 +24,6 @@ #include "hw/hw.h" #include "hw/pci/pci.h" #include "sysemu/dma.h" -#include "sysemu/block-backend.h" #include "hw/pci/msi.h" #include "qemu/iov.h" #include "hw/scsi/scsi.h" diff --git a/hw/sd/core.c b/hw/sd/core.c index 3c6eae6c88..820345f704 100644 --- a/hw/sd/core.c +++ b/hw/sd/core.c @@ -21,7 +21,6 @@ =20 #include "qemu/osdep.h" #include "hw/qdev-core.h" -#include "sysemu/block-backend.h" #include "hw/sd/sd.h" #include "trace.h" =20 diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 0f5804b3b4..2b8af2c884 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -44,7 +44,6 @@ #include "hw/empty_slot.h" #include "hw/loader.h" #include "elf.h" -#include "sysemu/block-backend.h" #include "trace.h" #include "qemu/cutils.h" =20 diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c index ac75eb2128..8e61dfc3e6 100644 --- a/hw/tricore/tricore_testboard.c +++ b/hw/tricore/tricore_testboard.c @@ -28,9 +28,7 @@ #include "sysemu/sysemu.h" #include "hw/boards.h" #include "hw/loader.h" -#include "sysemu/block-backend.h" #include "exec/address-spaces.h" -#include "hw/block/flash.h" #include "elf.h" #include "hw/tricore/tricore.h" #include "qemu/error-report.h" --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981954696447.5742225138017; Tue, 13 Mar 2018 15:59:14 -0700 (PDT) Received: from localhost ([::1]:43334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evssz-0006ks-Rh for importer@patchew.org; Tue, 13 Mar 2018 18:59:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshm-0005SZ-1a for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshh-0002qh-SL for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:33092) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshh-0002ps-LR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:33 -0400 Received: by mail-wm0-x243.google.com with SMTP id s206so16178239wme.0 for ; Tue, 13 Mar 2018 15:47:33 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=m8RBfumB60112apTP4Bf6c5RXnmdP7PYTGRPnDf5Wqs=; b=czrmb/k+6qimhUjGbMWoeEYh0CW3WYiHlSymDTrAZF9+NSyWMbCgc+zXCXKEKTMJjK cbhT3h0gUbUGzcOdD5YJqLfQ5sV3nB+cVWQJt8+pBq3ET3GtmmqtS3oQvGkrWvRr3pHn sZy/72uvmrvLNRBxB0A2/xy8mLkAAXLiSrsYAIMvXzsM7BdXdo48A+ArTym+GosAdO/p l3hklOEETDhWxVYk/zCROe6SQ5zTwaYrdf9RQUjBnRw4Sz549FiOSZUTLc8HnsgVz0l8 lqoZOAZdNj1luFx261Zuk409p4NSl+j2QViLCK8U8rabLG1aB2aJ1zQqUR5CnUZ4DSe+ L8Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=m8RBfumB60112apTP4Bf6c5RXnmdP7PYTGRPnDf5Wqs=; b=hW67Xbpdms0Yv+hD+6hsXpud/G6mI0NiyavJK3zh0YW0hpuKjcjtZrwQA9KbQkcoFk hSYVNbH0eiI6gMYATZqaovWBys3BoFp1GjsvnqKimnfYdIXC7n35eoMLmhsWeUOMDujt b1clYYYhAxlLoWAH/hScK3jmoVVaZRbktaPmwW7moPAUcqVnE1UJE59ldyzy8V6uQ+L/ aQzLk8iNv/MRjVK7oFZiOia+b0NvmmRzGUjlYeGijkWTxipIgbvVLHg5b4CxJj++IjrJ FLIW1HkLL/uSVpp7tVgY4YnWDN6orjXEbfCJLBntNu/6lquj7CcE5siijxIoCLiitqeK C7Dw== X-Gm-Message-State: AElRT7FgZ1yyCaqzPV1QQEBRV+ZlhaznkII8/oUVPeI6PDkMAe3hT82T +TYs2uQjciOjAeTbTfwCmkYhNDBc X-Google-Smtp-Source: AG47ELtSmjtuiGTrTqnFvO02GFFEPLfhTbSREOjQk1tRE/tWE7xmneGp740+qoZbiPWEidSi9ZghCA== X-Received: by 10.28.51.67 with SMTP id z64mr1965041wmz.59.1520981252194; Tue, 13 Mar 2018 15:47:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:19 +0100 Message-Id: <20180313224719.4954-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 09/69] checkpatch: Exempt long URLs 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eric Blake Sometimes, we want to refer to really long URLs, but checkpatch balks, and we have to manually bypass the check. URL shorteners may be nice at reducing long links, but it's hard to guarantee the shortened link will live as long as the real target, and it is also nice to see the original target without having to load the shortened URL through a browser. So exempt a line containing only a URL from the long-line syntax check. Reviewed-by: Stefan Hajnoczi Suggested-by: Peter Maydell Signed-off-by: Eric Blake Message-Id: <20180222215838.18223-1-eblake@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d1fe79bcc4..57daae05ea 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1447,9 +1447,10 @@ sub process { # check we are in a valid source file if not then ignore this hunk next if ($realfile !~ /$SrcFile/); =20 -#90 column limit +#90 column limit; exempt URLs, if no other words on line if ($line =3D~ /^\+/ && !($line =3D~ /^\+\s*"[^"]*"\s*(?:\s*|,|\)\s*;)\s*$/) && + !($rawline =3D~ /^[^[:alnum:]]*https?:\S*$/) && $length > 80) { if ($length > 90) { --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981691091927.1905229577368; Tue, 13 Mar 2018 15:54:51 -0700 (PDT) Received: from localhost ([::1]:43309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsok-0002gs-77 for importer@patchew.org; Tue, 13 Mar 2018 18:54:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshm-0005SW-1H for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshi-0002s6-Ug for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:55341) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshi-0002r6-Nl for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:34 -0400 Received: by mail-wm0-x244.google.com with SMTP id q83so871076wme.5 for ; Tue, 13 Mar 2018 15:47:34 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XZSgFd9sftsEU7gW3Iv/RIUMr/BR8XYNfNvwmhunedc=; b=OrfNKtcrsQJl7QcHIROJXO+EE8KHfZST/ufhKtAwZpBTCOR6viONTjdfs1PpyJ0MCh Tu6AdDrhK6I5yd9/LDaGwZPD1h1CY2j34/wGjtL2qnkCQgSJgU2MTJYekK8ET/9Tt8rX cqiDhAgBHQvRo40S+6b38yF3xWpK+wo4qD8zBvhiyoq0xwLD1OqUirRU0j5VTnivgGWP uFuHE/loLNFdALF48hyJolAtEzj0PRDpkGUKMlFTLK6SlX11kU8sYUpHuTze9u2RsZWv 7jIcnZ7Y3ReQEPlobhLG2xDUNpTjuD2oPMjHMa6+Qzad4Pn6pBlVGdB8qCRmocIfJ2B+ kiag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XZSgFd9sftsEU7gW3Iv/RIUMr/BR8XYNfNvwmhunedc=; b=tTpz3k1uQoqw1ces389N3bFsdMa8K5gCZm/vh6YeVi0o5d0CiDCq4oG/XHQjIBeeu+ sx4t77EEnlxfzXzywOWbDgqkCcdfzwl7fvVEN1tmpCiXeRy1XPmv8kXLp78bzlHVF9E9 IsLdR9qswaajjygxNKXJHeVlfNMplYDk80OBm5m3SVv1rgzVQRFVCC+axu2ha0SzM1Ve /J6XCKplEBwTjqukcoM61Jm8QeGb6FwJ/jl3dtyrwJTMiUMbILPXRyuTfrqD4P4N7ivJ 4sxN/RciuKhPXxDDFXYnrfX9JL+/eB62ZfLv1Qr+wjXIzn8lQbKZPmkQE0yhJ9cjjjYC G5nw== X-Gm-Message-State: AElRT7GRCBIL9R4u4Psl8qtClbR3ifQTCkYwEskA3YB8qrglbsb89KjP MLmYy09T0cy9c3nGr19CHDdKCUbu X-Google-Smtp-Source: AG47ELuFKwx5TlsNxCu2I/vuuyFrQxwLGvmZyUnjT4FT2el3OE9juvqujCGDxgWV0r1V8KZhWQvVbw== X-Received: by 10.28.1.208 with SMTP id 199mr2125390wmb.26.1520981253416; Tue, 13 Mar 2018 15:47:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:20 +0100 Message-Id: <20180313224719.4954-11-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 10/69] vl: export machine_init_done 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu We have that variable but not exported. Export that so modules can have a way to poke on whether machine init has finished. Meanwhile, set that up even before calling the notifiers, so that notifiers who may depend on this field will get a correct answer. Suggested-by: Paolo Bonzini Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-2-peterx@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Acked-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- include/sysemu/sysemu.h | 2 ++ stubs/machine-init-done.c | 2 ++ vl.c | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index 356bfdc1c1..2b42151c63 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -88,6 +88,8 @@ void qemu_system_guest_panicked(GuestPanicInformation *in= fo); void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); =20 +extern bool machine_init_done; + void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); =20 diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c index 9a0d62514f..4121f1709b 100644 --- a/stubs/machine-init-done.c +++ b/stubs/machine-init-done.c @@ -2,6 +2,8 @@ #include "qemu-common.h" #include "sysemu/sysemu.h" =20 +bool machine_init_done =3D true; + void qemu_add_machine_init_done_notifier(Notifier *notify) { } diff --git a/vl.c b/vl.c index 3ef04ce991..26662eb9e7 100644 --- a/vl.c +++ b/vl.c @@ -2696,7 +2696,7 @@ static void qemu_run_exit_notifiers(void) notifier_list_notify(&exit_notifiers, NULL); } =20 -static bool machine_init_done; +bool machine_init_done; =20 void qemu_add_machine_init_done_notifier(Notifier *notify) { @@ -2713,8 +2713,8 @@ void qemu_remove_machine_init_done_notifier(Notifier = *notify) =20 static void qemu_run_machine_init_done_notifiers(void) { - notifier_list_notify(&machine_init_done_notifiers, NULL); machine_init_done =3D true; + notifier_list_notify(&machine_init_done_notifiers, NULL); } =20 static const QEMUOption *lookup_opt(int argc, char **argv, --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981578354247.8145972698834; Tue, 13 Mar 2018 15:52:58 -0700 (PDT) Received: from localhost ([::1]:43300 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsmq-00011J-F9 for importer@patchew.org; Tue, 13 Mar 2018 18:52:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshm-0005SX-1K for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshk-0002to-6Q for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:52829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshj-0002sj-V0 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:36 -0400 Received: by mail-wm0-x242.google.com with SMTP id t3so867637wmc.2 for ; Tue, 13 Mar 2018 15:47:35 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ROp3wnLvUUt3TW5IA+OU+MCe1Z4tC7St2LCqPF8Aoeg=; b=Irnd3AAGkYC+Vkl3GfWs792S6j10ZgMTHrdBlYm5dbVuXPD24l/Ifx/4qqTMVxPS51 MIHn3+9RRnVDl1Ff78AVZjBxNj7GwnNDzKH1N+tnIWp/MltO1G9mOvqxLlsSEyPgk4gB T7VgLxx2fY2mwxa3dfQ12is1JfOMU1mqR5+SnS3E7XZKSAO7gtWMhWnTsdeUyNXvLxvN 8lE4YDOKSHVt0fGp+qONeNXL1hQDsJOcWEvGEw4lZ1ip6gX/o33Ih58Egc26zH1wQT6C jXTSufVpxeHdYDz8/vSpCoXryllI0Gx+Q3pkJu8oMhUxxUGWYR/xHP7862iJTZeAJ3eN sGMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ROp3wnLvUUt3TW5IA+OU+MCe1Z4tC7St2LCqPF8Aoeg=; b=PPgcuxLLqfdp6Y/PglEaknsk0DZ4JeEyEjRcO151x7pUAZUKCJhhxDntNebdM6WgEC FrqYiBxzCTdbq3v+8waINtSsJrPktFGEiyr9KJGc2lteLzL5tiWkauhmGfw1/MyL7OWL SeOVlZD1CUEQDoh2po4ZTHpZqlBfKhGsYJ6/LGGTzpJboaGyjnDl3RveFbCLuBloPVnh zDuX+tmR95bir0EY9RArstQUvBpH6rWP9MLIqpO9dKuc0tx2VhDC7FiXrlEUkZBQ/HZ+ TV/0v5AcZytdb1jFYq8QWR07r2EVuy3CzaPGtyAzFRPYXZf2UsG+oXcsk1AYrUN5qm2z eN6Q== X-Gm-Message-State: AElRT7EjQTXKkzbKSISiG4BIcqFsz9QJ+wiknW0w10ufnC7MZkLFBr6G ehBlpEq2X1b44xZ9Mc/SmLN8KTaj X-Google-Smtp-Source: AG47ELtjiVyo9hYOXGW5+9tSGEBqyCuVSje2MUvK+BnyfQuQPf7JFm3prHsRzQXcZCkWSv/hYYv1LQ== X-Received: by 10.28.180.132 with SMTP id d126mr2113617wmf.93.1520981254566; Tue, 13 Mar 2018 15:47:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:21 +0100 Message-Id: <20180313224719.4954-12-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 11/69] chardev: fix handling of EAGAIN for TCP chardev 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Daniel P. Berrang=C3=A9 When this commit was applied commit 9894dc0cdcc397ee5b26370bc53da6d360a363c2 Author: Daniel P. Berrange Date: Tue Jan 19 11:14:29 2016 +0000 char: convert from GIOChannel to QIOChannel The tcp_chr_recv() function was changed to return QIO_CHANNEL_ERR_BLOCK which corresonds to -2. As such the handling for EAGAIN was able to be removed from tcp_chr_read(). Unfortunately in a later commit: commit b6572b4f97a7b126c7b24e165893ed9fe3d72e1f Author: Marc-Andr=C3=A9 Lureau Date: Fri Mar 11 18:55:24 2016 +0100 char: translate from QIOChannel error to errno The tcp_chr_recv() function was changed back to return -1, with errno set to EAGAIN, without also re-addding support for this to tcp_chr_read() Reported-by: Aleksey Kuleshov Signed-off-by: Daniel P. Berrang=C3=A9 Message-Id: <20180222121351.26191-1-berrange@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index a220803c01..541fcf487d 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -450,7 +450,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondi= tion cond, void *opaque) len =3D s->max_size; } size =3D tcp_chr_recv(chr, (void *)buf, len); - if (size =3D=3D 0 || size =3D=3D -1) { + if (size =3D=3D 0 || (size =3D=3D -1 && errno !=3D EAGAIN)) { /* connection closed */ tcp_chr_disconnect(chr); } else if (size > 0) { --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982131224519.4354285253146; Tue, 13 Mar 2018 16:02:11 -0700 (PDT) Received: from localhost ([::1]:43356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsvq-0000tA-Cm for importer@patchew.org; Tue, 13 Mar 2018 19:02:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshm-0005Ss-FF for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshl-0002vY-J8 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:54931) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshl-0002uV-CP for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:37 -0400 Received: by mail-wm0-x241.google.com with SMTP id h76so869688wme.4 for ; Tue, 13 Mar 2018 15:47:37 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gtR/SPNNKJE6NzAdl6SnmtzuQMkpvyJ2O56FC8US/yk=; b=fOjLpNlHDnIIX3q10FaPM66jiv65FUeRZlh6WX7L4AW7nk2s7T8JAOkcFBwtlyoop5 78In72khEz/I5V370O0DxNjfiYaYoBE6jRXZr4yIpEQityYo4m6oQswAHe/5TA1U77uq 3WQUYiXqi+YXqs8pI0eUDcOysnqsYFuq7HxBuUtBrnTVtmegyA+Mj6Nwyx3D3R++U7Q6 U1ChnNr77+e7rEW8qUn7UNH35QFbWGm/wWfC87a5agBiLkOGMzQ5gzXm0lgcXH7M/eNf hIB1CBgel9k5oa4IwPVLHgiFzyipJaVbLEXQcCHrpS6TpClYKkfKmZ7MQRAlbKoy9LFf Og9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=gtR/SPNNKJE6NzAdl6SnmtzuQMkpvyJ2O56FC8US/yk=; b=okKPhSb6Rhyd/+3yAK/lb3B5cwIbskyIpvfgdJnR/Meam2ce8Y0bQMj4BCrTLdEl/e 6zal0rJDeF/v2UG+zp4/3FCOmzRt/5jLQmKVNf7a0Yg1dfp2XqCC25lGXfy+t6Ad6gsD VGxnz7ANcXBEyW3iZ4rRLDKgzHgKcbIxOCXDHWn9NrRA9uaOjp1la879gg6ZW4GSMRoK xie//eY0K1aIe/tcH9SCYSz8U+Umt2lGErf0oswrsvfId494iBWXWVCI+FQ4LYZYrlnL mmPyouUsvFkiO6qLLQeClrmL9z89qtMowune1vmjpvCFEgWNqbXLBlTt2Hqf2acjNuC5 +Y3A== X-Gm-Message-State: AElRT7EXeOgsNwFmG6KHZBB/jwrBggjw6QVILs/p1LwrsvVgRQjBf/km qnmoMUn86ZBwFzEF9kZNwLZ2Y5qe X-Google-Smtp-Source: AG47ELs+R6ME2jU8Z3rvBAEQ8+AqvKRHKgRkpe9vsMRvQm0X69XQ47DHpQl7sIk/602VJfAHCmJ/aQ== X-Received: by 10.28.17.77 with SMTP id 74mr2090244wmr.67.1520981255885; Tue, 13 Mar 2018 15:47:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:22 +0100 Message-Id: <20180313224719.4954-13-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 12/69] chardev: update net listener gcontext 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu TCP chardevs can be using QIO network listeners working in the background when in listening mode. However the network listeners are always running in main context. This can race with chardevs that are running in non-main contexts. To solve this, we need to re-setup the net listeners in tcp_chr_update_read_handler() with the newly cached gcontext. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-4-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 541fcf487d..2475e1d52f 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -423,8 +423,8 @@ static void tcp_chr_disconnect(Chardev *chr) tcp_chr_free_connection(chr); =20 if (s->listener) { - qio_net_listener_set_client_func(s->listener, tcp_chr_accept, - chr, NULL); + qio_net_listener_set_client_func_full(s->listener, tcp_chr_accept, + chr, NULL, chr->gcontext); } update_disconnected_filename(s); if (emit_close) { @@ -560,6 +560,16 @@ static void tcp_chr_update_read_handler(Chardev *chr) { SocketChardev *s =3D SOCKET_CHARDEV(chr); =20 + if (s->listener) { + /* + * It's possible that chardev context is changed in + * qemu_chr_be_update_read_handlers(). Reset it for QIO net + * listener if there is. + */ + qio_net_listener_set_client_func_full(s->listener, tcp_chr_accept, + chr, NULL, chr->gcontext); + } + if (!s->connected) { return; } @@ -744,7 +754,8 @@ static int tcp_chr_new_client(Chardev *chr, QIOChannelS= ocket *sioc) qio_channel_set_delay(s->ioc, false); } if (s->listener) { - qio_net_listener_set_client_func(s->listener, NULL, NULL, NULL); + qio_net_listener_set_client_func_full(s->listener, NULL, NULL, + NULL, chr->gcontext); } =20 if (s->tls_creds) { @@ -825,7 +836,8 @@ static void char_socket_finalize(Object *obj) tcp_chr_reconn_timer_cancel(s); qapi_free_SocketAddress(s->addr); if (s->listener) { - qio_net_listener_set_client_func(s->listener, NULL, NULL, NULL); + qio_net_listener_set_client_func_full(s->listener, NULL, NULL, + NULL, chr->gcontext); object_unref(OBJECT(s->listener)); } if (s->tls_creds) { @@ -981,8 +993,10 @@ static void qmp_chardev_open_socket(Chardev *chr, return; } if (!s->ioc) { - qio_net_listener_set_client_func(s->listener, tcp_chr_acce= pt, - chr, NULL); + qio_net_listener_set_client_func_full(s->listener, + tcp_chr_accept, + chr, NULL, + chr->gcontext); } } else if (qemu_chr_wait_connected(chr, errp) < 0) { goto error; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982060319589.4088772722241; Tue, 13 Mar 2018 16:01:00 -0700 (PDT) Received: from localhost ([::1]:43349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsug-0008NY-8t for importer@patchew.org; Tue, 13 Mar 2018 19:00:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshn-0005UI-Rf for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshm-0002xw-Rc for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:39 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:54932) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshm-0002wU-Ie for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:38 -0400 Received: by mail-wm0-x242.google.com with SMTP id h76so869748wme.4 for ; Tue, 13 Mar 2018 15:47:38 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/f9WYDaLS5E3ea3YgWTOcg8sJkeE7JjKA4gZEIu1iBo=; b=Kf4FDjNpHiCiJh4OEpk9ISUAOx/QUGOf14hBAnUpvGav409KBJsWEODQ2Inmsbiohc U6oR/paqwT23igdvylVMyzMeADlZj5kKMpfRy6a4KZrQiTJK3OKd9EY8cDh9fWqr5AI1 sWbfBAefChe/C2QMx2TW10cE2+2ocjrT2aH59tb0i8iYz69gyM8hlAug/mtIy083CIoZ 5raS7A6kFui7y3rBrXMc8X2CwRayafs9MAOf/4CTZlVbVCMqIcjYwhX3j3L3WmUiBdyP FTL91NXdQ6Z7PSa9jtukjHWNbXyAwvMR16frkteMeclG0gRzSig78+K7YY9EcRWQiEKc ZmdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/f9WYDaLS5E3ea3YgWTOcg8sJkeE7JjKA4gZEIu1iBo=; b=YQr2wh6sJpOodCroxJ4zLXA19oxsu5AVyeRw/cpsNq43MXE8aPFojw0OYKi0mgcQiW geBJqcO8fQMb0uX/TOm2lh7fYi9W29m9tzixYgE7cEWOpGyeK8yc51HsnePtR66aRNwQ AszIduhM1b/q2VBVM7NhchL+3b2iINW9eSDhMdSNr1/Quca4DLTDcyTH5swy/hkkZbTQ s/GjHtKJ+JKwWL8LrXT7TzjXr/N9ncoEZdbWJRKyTp1uGu48/4rZQWqdQo+59xnNIYeh um5bV4gM37GZC2ZRfQJWpSyhsjHElybhiu11eujXoyHLG1bL+OCbymy104/+4+gpwzKP nuwQ== X-Gm-Message-State: AElRT7HFOwcDD6Ea039NNdyJZD+MrDhuJCHz1O201fCaS8JLWejPBkMJ N26NPGAgHwJ8kjp0R/PnpH8M0N0h X-Google-Smtp-Source: AG47ELtE6hTKKx3hznHPiJU9lMj8mbrKTvrhztGBw0MEdajuu2mmBenZTSIwUs9yLLCLWltaY72asA== X-Received: by 10.28.235.4 with SMTP id j4mr2166254wmh.52.1520981257139; Tue, 13 Mar 2018 15:47:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:23 +0100 Message-Id: <20180313224719.4954-14-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 13/69] chardev: allow telnet gsource to switch gcontext 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu It was originally created by qio_channel_add_watch() so it's always assigning the task to main context. Now we use the new API called qio_channel_add_watch_source() so that we get the GSource handle rather than the tag ID. Meanwhile, caching the gsource and TCPChardevTelnetInit (which holds the handshake data) in SocketChardev.telnet_source so that we can also do dynamic context switch when update read handlers. Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-5-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 67 +++++++++++++++++++++++++++++++++++++++--------= ---- 1 file changed, 51 insertions(+), 16 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 2475e1d52f..82c7d7a323 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -40,6 +40,11 @@ =20 #define TCP_MAX_FDS 16 =20 +typedef struct { + char buf[21]; + size_t buflen; +} TCPChardevTelnetInit; + typedef struct { Chardev parent; QIOChannel *ioc; /* Client I/O channel */ @@ -60,6 +65,8 @@ typedef struct { bool is_listen; bool is_telnet; bool is_tn3270; + GSource *telnet_source; + TCPChardevTelnetInit *telnet_init; =20 GSource *reconnect_timer; int64_t reconnect_time; @@ -70,6 +77,7 @@ typedef struct { OBJECT_CHECK(SocketChardev, (obj), TYPE_CHARDEV_SOCKET) =20 static gboolean socket_reconnect_timeout(gpointer opaque); +static void tcp_chr_telnet_init(Chardev *chr); =20 static void tcp_chr_reconn_timer_cancel(SocketChardev *s) { @@ -556,6 +564,15 @@ static void tcp_chr_connect(void *opaque) qemu_chr_be_event(chr, CHR_EVENT_OPENED); } =20 +static void tcp_chr_telnet_destroy(SocketChardev *s) +{ + if (s->telnet_source) { + g_source_destroy(s->telnet_source); + g_source_unref(s->telnet_source); + s->telnet_source =3D NULL; + } +} + static void tcp_chr_update_read_handler(Chardev *chr) { SocketChardev *s =3D SOCKET_CHARDEV(chr); @@ -570,6 +587,10 @@ static void tcp_chr_update_read_handler(Chardev *chr) chr, NULL, chr->gcontext); } =20 + if (s->telnet_source) { + tcp_chr_telnet_init(CHARDEV(s)); + } + if (!s->connected) { return; } @@ -583,32 +604,30 @@ static void tcp_chr_update_read_handler(Chardev *chr) } } =20 -typedef struct { - Chardev *chr; - char buf[21]; - size_t buflen; -} TCPChardevTelnetInit; - static gboolean tcp_chr_telnet_init_io(QIOChannel *ioc, GIOCondition cond G_GNUC_UNUSED, gpointer user_data) { - TCPChardevTelnetInit *init =3D user_data; + SocketChardev *s =3D user_data; + Chardev *chr =3D CHARDEV(s); + TCPChardevTelnetInit *init =3D s->telnet_init; ssize_t ret; =20 + assert(init); + ret =3D qio_channel_write(ioc, init->buf, init->buflen, NULL); if (ret < 0) { if (ret =3D=3D QIO_CHANNEL_ERR_BLOCK) { ret =3D 0; } else { - tcp_chr_disconnect(init->chr); + tcp_chr_disconnect(chr); goto end; } } init->buflen -=3D ret; =20 if (init->buflen =3D=3D 0) { - tcp_chr_connect(init->chr); + tcp_chr_connect(chr); goto end; } =20 @@ -617,16 +636,30 @@ static gboolean tcp_chr_telnet_init_io(QIOChannel *io= c, return G_SOURCE_CONTINUE; =20 end: - g_free(init); + g_free(s->telnet_init); + s->telnet_init =3D NULL; + g_source_unref(s->telnet_source); + s->telnet_source =3D NULL; return G_SOURCE_REMOVE; } =20 static void tcp_chr_telnet_init(Chardev *chr) { SocketChardev *s =3D SOCKET_CHARDEV(chr); - TCPChardevTelnetInit *init =3D g_new0(TCPChardevTelnetInit, 1); + TCPChardevTelnetInit *init; size_t n =3D 0; =20 + /* Destroy existing task */ + tcp_chr_telnet_destroy(s); + + if (s->telnet_init) { + /* We are possibly during a handshake already */ + goto cont; + } + + s->telnet_init =3D g_new0(TCPChardevTelnetInit, 1); + init =3D s->telnet_init; + #define IACSET(x, a, b, c) \ do { \ x[n++] =3D a; \ @@ -634,7 +667,6 @@ static void tcp_chr_telnet_init(Chardev *chr) x[n++] =3D c; \ } while (0) =20 - init->chr =3D chr; if (!s->is_tn3270) { init->buflen =3D 12; /* Prep the telnet negotion to put telnet in binary, @@ -657,10 +689,11 @@ static void tcp_chr_telnet_init(Chardev *chr) =20 #undef IACSET =20 - qio_channel_add_watch( - s->ioc, G_IO_OUT, - tcp_chr_telnet_init_io, - init, NULL); +cont: + s->telnet_source =3D qio_channel_add_watch_source(s->ioc, G_IO_OUT, + tcp_chr_telnet_init_io, + s, NULL, + chr->gcontext); } =20 =20 @@ -835,6 +868,8 @@ static void char_socket_finalize(Object *obj) tcp_chr_free_connection(chr); tcp_chr_reconn_timer_cancel(s); qapi_free_SocketAddress(s->addr); + tcp_chr_telnet_destroy(s); + g_free(s->telnet_init); if (s->listener) { qio_net_listener_set_client_func_full(s->listener, NULL, NULL, NULL, chr->gcontext); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981848254530.953509373568; Tue, 13 Mar 2018 15:57:28 -0700 (PDT) Received: from localhost ([::1]:43328 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsrH-0005AY-An for importer@patchew.org; Tue, 13 Mar 2018 18:57:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshp-0005VZ-Kc for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsho-0002zc-6F for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:41 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:55340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshn-0002yQ-Sz for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:40 -0400 Received: by mail-wm0-x241.google.com with SMTP id q83so871350wme.5 for ; Tue, 13 Mar 2018 15:47:39 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ODMIbUWNj1JP1adI+4rQVxRgz3VibYJej0WX91XiScA=; b=ZZrz0EUpUaj/QqOnKtJxZLYiyBz1rPqCVxPU0sokDp4AOu4WR7AskWw+sKE0rX7vte /x/ruYbAx5oMIt8pCpHLdkRJO4W0bvRDSVWZgshqGhjFd9f5zKJQwVOv8ttcZ3tgx2dh nsZiEpGc74NjEPE9il1TJMXmnOoAffQ6aXr0FwSql2hO/qTe6irjRJ2H4auDUVy4m7Hi 674Zl2lFqXgJPsdxWiDnP4m774ywKtXWgdeSFdSCCJ92wedDh8VqYyPtsnyfRLIwSrlg Fwp1HCbQ10Bv+kmfFyQHYQHp9YUw0TEsp+owf+WqH2eHuEG/7lZ+bKHIWnXYjklJpQZz casg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ODMIbUWNj1JP1adI+4rQVxRgz3VibYJej0WX91XiScA=; b=srMV5b13mf9UZPjJYifr9wjaQ7Wof3Is6Vwf6qJKSy/BUty5cGAw9vdfGeZhPGR8ja BhZ0Ny0WB0NX/in/HN40TImlQlyCYcMKxmBhqb7cdQiWF/ter04fUY5FR3NZwy70qY5O r3+x68CTs05eKvW/o03fX86A9tNbeOeIXeOmKYktEkLtujxNUn8cBTcci7y5NqUhhZb8 IUEEePdrWaXmPNRFyb0v6vzYXjMv36Xz/m+qCfZGP8fHHhfRwlRRGKC35RTVEBfWnWeo ytia/ZUVIVfFZ82ThjF3W4RTxsTWBXhUULQnXMAp0boBfVd4H/vlonEpuHcLI4J1DbAj MvPw== X-Gm-Message-State: AElRT7HYkVsXYMQGStxYQlhwE6JdhkSVdch7pkMW/YVMTohnwbDbYNg+ wmI5TOP8fZ82eV/e6sgWmkrr50f/ X-Google-Smtp-Source: AG47ELsr0uWxctYqA9N+Os9FrJuW1c7POYjffAsXLDJ3nWagKussMRkIQ64XAbuZk+G9O41t2xoqKQ== X-Received: by 10.28.20.84 with SMTP id 81mr2154349wmu.70.1520981258438; Tue, 13 Mar 2018 15:47:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:24 +0100 Message-Id: <20180313224719.4954-15-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 14/69] chardev: introduce chr_machine_done hook 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu Introduce ChardevClass.chr_machine_done() hook so that chardevs can run customized procedures after machine init. There was an existing mux user already that did similar thing but used a raw machine done notifier. Generalize it into a framework, and let the mux chardevs provide such a class-specific hook to achieve the same thing. Then we can move the mux related code to the char-mux.c file. Since at it, replace the mux_realized variable with the global machine_init_done varible. This notifier framework will be further leverged by other type of chardevs soon. Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-6-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-mux.c | 33 +++++++++++++++++++++++++++++---- chardev/char.c | 43 +++++++++++++++++-------------------------- include/chardev/char-mux.h | 2 -- include/chardev/char.h | 2 ++ tests/test-char.c | 1 - 5 files changed, 48 insertions(+), 33 deletions(-) diff --git a/chardev/char-mux.c b/chardev/char-mux.c index d48e78103a..1b925c8dec 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -27,6 +27,7 @@ #include "qemu/option.h" #include "chardev/char.h" #include "sysemu/block-backend.h" +#include "sysemu/sysemu.h" #include "chardev/char-mux.h" =20 /* MUX driver for serial I/O splitting */ @@ -230,14 +231,12 @@ static void mux_chr_read(void *opaque, const uint8_t = *buf, int size) } } =20 -bool muxes_realized; - void mux_chr_send_all_event(Chardev *chr, int event) { MuxChardev *d =3D MUX_CHARDEV(chr); int i; =20 - if (!muxes_realized) { + if (!machine_init_done) { return; } =20 @@ -327,7 +326,7 @@ static void qemu_chr_open_mux(Chardev *chr, /* only default to opened state if we've realized the initial * set of muxes */ - *be_opened =3D muxes_realized; + *be_opened =3D machine_init_done; qemu_chr_fe_init(&d->chr, drv, errp); } =20 @@ -347,6 +346,31 @@ static void qemu_chr_parse_mux(QemuOpts *opts, Chardev= Backend *backend, mux->chardev =3D g_strdup(chardev); } =20 +/** + * Called after processing of default and command-line-specified + * chardevs to deliver CHR_EVENT_OPENED events to any FEs attached + * to a mux chardev. This is done here to ensure that + * output/prompts/banners are only displayed for the FE that has + * focus when initial command-line processing/machine init is + * completed. + * + * After this point, any new FE attached to any new or existing + * mux will receive CHR_EVENT_OPENED notifications for the BE + * immediately. + */ +static int open_muxes(Chardev *chr) +{ + /* send OPENED to all already-attached FEs */ + mux_chr_send_all_event(chr, CHR_EVENT_OPENED); + /* + * mark mux as OPENED so any new FEs will immediately receive + * OPENED event + */ + qemu_chr_be_event(chr, CHR_EVENT_OPENED); + + return 0; +} + static void char_mux_class_init(ObjectClass *oc, void *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); @@ -357,6 +381,7 @@ static void char_mux_class_init(ObjectClass *oc, void *= data) cc->chr_accept_input =3D mux_chr_accept_input; cc->chr_add_watch =3D mux_chr_add_watch; cc->chr_be_event =3D mux_chr_be_event; + cc->chr_machine_done =3D open_muxes; } =20 static const TypeInfo char_mux_type_info =3D { diff --git a/chardev/char.c b/chardev/char.c index 5d7b079ef0..a6250cac80 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -281,40 +281,31 @@ static const TypeInfo char_type_info =3D { .class_init =3D char_class_init, }; =20 -/** - * Called after processing of default and command-line-specified - * chardevs to deliver CHR_EVENT_OPENED events to any FEs attached - * to a mux chardev. This is done here to ensure that - * output/prompts/banners are only displayed for the FE that has - * focus when initial command-line processing/machine init is - * completed. - * - * After this point, any new FE attached to any new or existing - * mux will receive CHR_EVENT_OPENED notifications for the BE - * immediately. - */ -static int open_muxes(Object *child, void *opaque) +static int chardev_machine_done_notify_one(Object *child, void *opaque) { - if (CHARDEV_IS_MUX(child)) { - /* send OPENED to all already-attached FEs */ - mux_chr_send_all_event(CHARDEV(child), CHR_EVENT_OPENED); - /* mark mux as OPENED so any new FEs will immediately receive - * OPENED event - */ - qemu_chr_be_event(CHARDEV(child), CHR_EVENT_OPENED); + Chardev *chr =3D (Chardev *)child; + ChardevClass *class =3D CHARDEV_GET_CLASS(chr); + + if (class->chr_machine_done) { + return class->chr_machine_done(chr); } =20 return 0; } =20 -static void muxes_realize_done(Notifier *notifier, void *unused) +static void chardev_machine_done_hook(Notifier *notifier, void *unused) { - muxes_realized =3D true; - object_child_foreach(get_chardevs_root(), open_muxes, NULL); + int ret =3D object_child_foreach(get_chardevs_root(), + chardev_machine_done_notify_one, NULL); + + if (ret) { + error_report("Failed to call chardev machine_done hooks"); + exit(1); + } } =20 -static Notifier muxes_realize_notify =3D { - .notify =3D muxes_realize_done, +static Notifier chardev_machine_done_notify =3D { + .notify =3D chardev_machine_done_hook, }; =20 static bool qemu_chr_is_busy(Chardev *s) @@ -1118,7 +1109,7 @@ static void register_types(void) * as part of realize functions like serial_isa_realizefn when -nograp= hic * is specified */ - qemu_add_machine_init_done_notifier(&muxes_realize_notify); + qemu_add_machine_init_done_notifier(&chardev_machine_done_notify); } =20 type_init(register_types); diff --git a/include/chardev/char-mux.h b/include/chardev/char-mux.h index 8928977897..1e13187767 100644 --- a/include/chardev/char-mux.h +++ b/include/chardev/char-mux.h @@ -27,8 +27,6 @@ #include "chardev/char.h" #include "chardev/char-fe.h" =20 -extern bool muxes_realized; - #define MAX_MUX 4 #define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */ #define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1) diff --git a/include/chardev/char.h b/include/chardev/char.h index ebf1e0ba04..04de45795e 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -248,6 +248,8 @@ typedef struct ChardevClass { void (*chr_set_echo)(Chardev *chr, bool echo); void (*chr_set_fe_open)(Chardev *chr, int fe_open); void (*chr_be_event)(Chardev *s, int event); + /* Return 0 if succeeded, 1 if failed */ + int (*chr_machine_done)(Chardev *chr); } ChardevClass; =20 Chardev *qemu_chardev_new(const char *id, const char *typename, diff --git a/tests/test-char.c b/tests/test-char.c index b3a77af085..c731313098 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -166,7 +166,6 @@ static void char_mux_test(void) FeHandler h1 =3D { 0, }, h2 =3D { 0, }; CharBackend chr_be1, chr_be2; =20 - muxes_realized =3D true; /* done after machine init */ opts =3D qemu_opts_create(qemu_find_opts("chardev"), "mux-label", 1, &error_abort); qemu_opt_set(opts, "backend", "ringbuf", &error_abort); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209817384279.470546334752498; Tue, 13 Mar 2018 15:55:38 -0700 (PDT) Received: from localhost ([::1]:43313 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evspV-0003Qp-Cs for importer@patchew.org; Tue, 13 Mar 2018 18:55:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57926) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshq-0005W4-22 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshp-00031G-BR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:42 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshp-000301-4A for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:41 -0400 Received: by mail-wr0-x241.google.com with SMTP id h2so2479341wre.12 for ; Tue, 13 Mar 2018 15:47:40 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9PpId5oIMzlM/o07QJm2W2GX7Ab99JcLs9bF5+DYFAQ=; b=L6CNG4BD7xvr9qlR1DTR4/YbHk93oqYMstGe1OpeFAXqQevNY5wIYl0YvhTPgZw8/9 r4q+Yk5m5Vxg9u37eNprduG9QE+3ntsW0U/JA8iThzEKHomnAltsXmKjHEXOqSmyilu9 wpWQBol23Z+fLRJMtEF4wi+T2yLGhK7a5Q2itfoduFggUgtpIpm746a50BwBWVJ4NLqH vm52zcZ0nFQMjuOXo0KDOFLmqldl4LaPfYkU+u7najkuYIz98hUETaXB1c/Z8YaX2Q+1 cc7Fvs4B4/tXa3zq/TrgT/T5ZDNbGM7vziAi/oj5gd0gA9zslvmuES4LIEMhtFgvWsbn TvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=9PpId5oIMzlM/o07QJm2W2GX7Ab99JcLs9bF5+DYFAQ=; b=uR//AmChtFqR6Z8QafAh5dXt2rXQ7mv7v/ZVXd1PLZtLOLEPPkmclBa7F6woXdG30a x33IJod7avJrc2Jb/wCmRRdpRJWrcGJZhJr90AofisKQOc11n0e+gclCXHXvJc+fpQyR bDuh5pKQggb02Qc4tehQ3qLg+FF8Ai76jRNuRuV8d1Lrz6bzX615Yya9O+2GSEFZDc0e rY1IzAn8wqMobo2nGHDTO42XDcaBCC7JC9dAZ2GJ3cS2dCHGdjSBL7LzcDrw8G/1UaQQ qIGePJBanSqy6KAZNoA/awoJqobG5VgVok5Sk+yKTdLpktyGGYbkBJVfFs+CD0MPhu+l NIpA== X-Gm-Message-State: AElRT7F6YSmHL7hfnkMWjPKIT3xK9/oC7CAHsmQvJK7UoypVS2DvymW8 q/okxnQZsQbR4Nqh/w3QL9sdMWFx X-Google-Smtp-Source: AG47ELtBaBy8mBa1Q0KJ7mBDM/NAINx0QwhQEE3GTD3bVcyRlGiojG5hGR6hJHzI/zU/pTaPl2N7dQ== X-Received: by 10.223.142.164 with SMTP id q33mr1950176wrb.72.1520981259722; Tue, 13 Mar 2018 15:47:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:25 +0100 Message-Id: <20180313224719.4954-16-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 15/69] chardev: use chardev's gcontext for async connect 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu Generalize the function to create the async QIO task connection. Also, fix the context pointer to use the chardev's gcontext. Reviewed-by: Paolo Bonzini Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-7-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 82c7d7a323..09aa345869 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -902,11 +902,22 @@ cleanup: object_unref(OBJECT(sioc)); } =20 +static void tcp_chr_connect_async(Chardev *chr) +{ + SocketChardev *s =3D SOCKET_CHARDEV(chr); + QIOChannelSocket *sioc; + + sioc =3D qio_channel_socket_new(); + tcp_chr_set_client_ioc_name(chr, sioc); + qio_channel_socket_connect_async(sioc, s->addr, + qemu_chr_socket_connected, + chr, NULL, chr->gcontext); +} + static gboolean socket_reconnect_timeout(gpointer opaque) { Chardev *chr =3D CHARDEV(opaque); SocketChardev *s =3D SOCKET_CHARDEV(opaque); - QIOChannelSocket *sioc; =20 g_source_unref(s->reconnect_timer); s->reconnect_timer =3D NULL; @@ -915,11 +926,7 @@ static gboolean socket_reconnect_timeout(gpointer opaq= ue) return false; } =20 - sioc =3D qio_channel_socket_new(); - tcp_chr_set_client_ioc_name(chr, sioc); - qio_channel_socket_connect_async(sioc, s->addr, - qemu_chr_socket_connected, - chr, NULL, NULL); + tcp_chr_connect_async(chr); =20 return false; } @@ -999,11 +1006,7 @@ static void qmp_chardev_open_socket(Chardev *chr, } =20 if (s->reconnect_time) { - sioc =3D qio_channel_socket_new(); - tcp_chr_set_client_ioc_name(chr, sioc); - qio_channel_socket_connect_async(sioc, s->addr, - qemu_chr_socket_connected, - chr, NULL, NULL); + tcp_chr_connect_async(chr); } else { if (s->is_listen) { char *name; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982323262740.7380432528594; Tue, 13 Mar 2018 16:05:23 -0700 (PDT) Received: from localhost ([::1]:43369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsyw-0003LW-Aq for importer@patchew.org; Tue, 13 Mar 2018 19:05:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57944) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshr-0005Y7-MV for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshq-00033V-QX for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:43 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:42346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshq-00032U-JU for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:42 -0400 Received: by mail-wr0-x241.google.com with SMTP id s18so2505702wrg.9 for ; Tue, 13 Mar 2018 15:47:42 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BY+Necp4Mpvv48CjfR6C29VX7sXN9k6ii0bVCQH3u2Y=; b=DuyUM3gSNp2LkQkCPJqDZkA/4SHM3lTvKkcN/+/WlMqJk0VHjaFGHA+lVG8C7BXJVy m0oBjpixg0FH0LSsfmLcG3aZZDV6BMA8jaW3X32e/QWkwkpXMaFw2Hu5neZ6wVk4gKur aoFkv+0Gfc8b4PJs9So3quO9/vKIig4hqoO0irP/MxB6lS6FNExVBNPm5Kus95Jn7CxM CWcoC9XF2d6XFprGymdlLzPveXZSjXr1FbEL6gxEzCxVnIReK9bp106Gm4X18wxlAw1F hgGvdEsBJ2O1+6VD+ov4c48bl1Z2sAaY+7TLgFTWP1EAJtnDF/6YgIoBfW8EFtxrPoH1 +UgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BY+Necp4Mpvv48CjfR6C29VX7sXN9k6ii0bVCQH3u2Y=; b=eDo4UiswlRSWmn7LM+AmUoOYxD4S8UgS3VH0m6/5m7VC7yMZsfYIcWEDJSrvCaNm3c Wf7ZNoLQXkGFIEpoIKN7dIuMhjS1kWo/j6jTmVNGNJQTnwWIFhPIeQ0pmwxpGm58kXEF ltYIzKDTmWS85aghGxvzAPZHr13GqoZ3WagoW0NibXMXAi0Lp95TR0DPaZHcV7H0C0jJ IXdOvkn+ambnAvpIjaLfFr9cVvfJydh6oidoztY1HQ/hnxrP58axLySdwkVM+DHjPNdk azp4keGTqYWqFaad0HLIYszTy2LnvtuM0+qDEwiCn8ne4z/0NNYqDtHJF6/mt1LHrcbJ M4/g== X-Gm-Message-State: AElRT7H2O+I+GQ21arHK6jxMejiN1FCOHcKOQm2WXPPitvJjzRtK8GVJ fl83Z3z6pT8+N0dMw9bk+QaMEY2S X-Google-Smtp-Source: AG47ELvPfO5YPZCxh6SzMmBpU9pwrip/IoyLN/zBnhrcpWfocNqrN0myA+kE1tydCnXfgIegOP5Y6g== X-Received: by 10.223.195.206 with SMTP id d14mr2024743wrg.0.1520981261186; Tue, 13 Mar 2018 15:47:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:26 +0100 Message-Id: <20180313224719.4954-17-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 16/69] chardev: tcp: postpone async connection setup 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu This patch allows the socket chardev async connection be setup with non-default gcontext. We do it by postponing the setup to machine done, since until then we can know which context we should run the async operation on. Reviewed-by: Paolo Bonzini Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-8-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 09aa345869..f6ad6ee4d8 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -1005,9 +1005,8 @@ static void qmp_chardev_open_socket(Chardev *chr, s->reconnect_time =3D reconnect; } =20 - if (s->reconnect_time) { - tcp_chr_connect_async(chr); - } else { + /* If reconnect_time is set, will do that in chr_machine_done. */ + if (!s->reconnect_time) { if (s->is_listen) { char *name; s->listener =3D qio_net_listener_new(); @@ -1139,6 +1138,17 @@ char_socket_get_connected(Object *obj, Error **errp) return s->connected; } =20 +static int tcp_chr_machine_done_hook(Chardev *chr) +{ + SocketChardev *s =3D SOCKET_CHARDEV(chr); + + if (s->reconnect_time) { + tcp_chr_connect_async(chr); + } + + return 0; +} + static void char_socket_class_init(ObjectClass *oc, void *data) { ChardevClass *cc =3D CHARDEV_CLASS(oc); @@ -1154,6 +1164,7 @@ static void char_socket_class_init(ObjectClass *oc, v= oid *data) cc->chr_add_client =3D tcp_chr_add_client; cc->chr_add_watch =3D tcp_chr_add_watch; cc->chr_update_read_handler =3D tcp_chr_update_read_handler; + cc->chr_machine_done =3D tcp_chr_machine_done_hook; =20 object_class_property_add(oc, "addr", "SocketAddress", char_socket_get_addr, NULL, --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982255425322.22109515144393; Tue, 13 Mar 2018 16:04:15 -0700 (PDT) Received: from localhost ([::1]:43366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsxj-0002QV-1Y for importer@patchew.org; Tue, 13 Mar 2018 19:04:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshx-0005e2-3D for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshs-00035E-3W for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshr-00034D-TG for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:44 -0400 Received: by mail-wr0-x241.google.com with SMTP id o8so2597949wra.1 for ; Tue, 13 Mar 2018 15:47:43 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5bjd1hCyAxlBj8/w3GjH9MTFV7OQg2DgOoYAv9EPVBI=; b=F83+J/HhLALTOVaBj+oCT5eDOYh5Wmgm8K4/AprCvlUQdyhAZOiYTLaezKtVMxylqi neJiEgAiaRipxHcTach2NaMF8MAINS/lBpHd4bWI0S/o9/Kn6FjJqThDmpvXxCco2YXV ZUZpGdwldGfJwaH88o10a0Gcxzq1RG4KnQ6O+6yOxmN67eAsCPQSdDJ+p9JRSxIr3+KQ ENU9fu547mZY9OCvYQ4lWmD7lq7cGurkG63OaPJJdvy+gYRXPpB5QVFXcMbmsmkKZXDt khiHQgZEz9ynXShI0Ntrtiy2SQqcUeTCIxMSlzv5DqLm+lXqw5CNnBhuza304VuGN43E k4lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5bjd1hCyAxlBj8/w3GjH9MTFV7OQg2DgOoYAv9EPVBI=; b=QbMUOykXcKcCYcIoFVZlpsa5PPbuPWUrX9LhlfbNMUizqaV+p8r7A7K4JYT8W8pRmU wvGQUQrG7qWKpb+DzrlgDhhleUGfnqK6hjEgrPkRM75PvGqvdCmAuNxJ3Q8BZqkvtH13 ld7nTeHDm1W3SiJv9FpdjgNNMHUaPCMXrRlJq6ONwtUEPaPYS67RiPFos7kVGE/ZemKW qmY2yYChkYYrwpsK59Ov4wyASmGV0NVlNLUWdYukABZXAiB5pZnkeVIQ3O+42w5kpgy2 RQkpv7VKBqJZQVOL6i7KABwv7HBHakdXR9ySg7X75OTjREXRTzgMp34MzUYJOqkOks/l ik6w== X-Gm-Message-State: AElRT7Hoyy2boPr88J10Cx1JSFa8Ab4g3yC0naNDkVtAW4+6LjHs2Fcs Ns8/GnzKEHUnRsnsPfRnZyM28JQL X-Google-Smtp-Source: AG47ELvq9VlRekVRnR/+u0HGeDNfnWqzAdDeCr9ebO6tUHum7dVyCAkIasNvPIGKany61s4ogttSCw== X-Received: by 10.223.132.103 with SMTP id 94mr1854776wrf.275.1520981262489; Tue, 13 Mar 2018 15:47:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:27 +0100 Message-Id: <20180313224719.4954-18-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 17/69] chardev: tcp: let TLS run on chardev context 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: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu Now qio_channel_tls_handshake() is ready to receive the context. Let socket chardev use it, then the TLS handshake of chardev will always be with the chardev's context. Signed-off-by: Peter Xu Message-Id: <20180306053320.15401-9-peterx@redhat.com> Acked-by: Stefan Hajnoczi Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index f6ad6ee4d8..36a8fcc194 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -751,7 +751,7 @@ static void tcp_chr_tls_init(Chardev *chr) tcp_chr_tls_handshake, chr, NULL, - NULL); + chr->gcontext); } =20 =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982002734171.6576133541763; Tue, 13 Mar 2018 16:00:02 -0700 (PDT) Received: from localhost ([::1]:43340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evstl-0007VZ-U9 for importer@patchew.org; Tue, 13 Mar 2018 19:00:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshx-0005e4-3r for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsht-00037J-Fo for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:39238) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsht-000368-8O for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:45 -0400 Received: by mail-wr0-x242.google.com with SMTP id k3so2529725wrg.6 for ; Tue, 13 Mar 2018 15:47:45 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.42 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=x86Ja8yEM2QxMMge7ZPIBHrD6nEN+Zl8NJZJjNgl4N8=; b=ZCDFAYELvCozGcGmMAVRMlbxvKPZO8qOraHRF39vXiANHCGvEk4rlwS1aoBr5Fn0+o p63KUkMCUfwdS8NEBEEqMJSJHz/LiueMWzUUfuI4YSKC7wh1Ix1GOjW8fKM0vY9dXpWM SroahQ3/z0cNAD9k+wVqkwJQjTLAxjX9rbPDCJLXPNE+IHgDoixAG77J95mi/EoLPOk2 6Qb0PxfRWoZPJiqlGtHfgdO3+c5SYN7VANE0TCmdXuEWCEoHW8Bwr6PHYxe7hqAi60kp W3BOV0AxsTpiV+qxc9psPnrwH+vIXWjnv6Zz/ez6SnwRfEAY3upCKi1QbUvBnvymbtqj Z+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=x86Ja8yEM2QxMMge7ZPIBHrD6nEN+Zl8NJZJjNgl4N8=; b=O99OGyS4Zp9uAgFvid2BByz/PsW/bli/6mpYtmTA+SntxOyYPFvN7wMS4928sBS/KI TvCeGMzzuLduXY6fHUQVk0su48+DQj39mJcKJnp96zed6uG9SW9hMkU9ISD1BsIe9PMv zFjY2qCXBSkq+2cAj/qOnfjdSvMrXuVmpfEQ7V0Nf71mtMbZf2NQAEH1exveZ+IFaA7+ IsZ4JSsu+JHz/yp/+GnKBzwTO0utL8iYAKApDODSAEx58rzhxt8X1x+WUrtwCIFl4Poi x2LB+/yjqTABOXQxmpGERZGuK9alOPuCFmU4FNLnfOKngQ4hAtYcXpXqCrPW+z2Zaw9E nzrg== X-Gm-Message-State: AElRT7H0L+vw04c6a87HSRq7BY0CSxFgNimzaDfySgehM94eWnec+07a VA8Pi0PTVgtOVtC5Fdq7eRHzlJY/ X-Google-Smtp-Source: AG47ELuFGhpHkKsjJw8twAZvnvhi9IRxSZhcwmS6wT7drJqvcMORu42hzUe4jfYEftoTWnqZGemueA== X-Received: by 10.223.142.244 with SMTP id q107mr1989985wrb.64.1520981263804; Tue, 13 Mar 2018 15:47:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:28 +0100 Message-Id: <20180313224719.4954-19-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 18/69] scsi: support NDOB (no data-out buffer) for WRITE SAME commands 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" A NDOB bit set to one specifies that the disk shall not transfer data from the data-out buffer and shall process the command as if the data-out buffer contained user data set to all zeroes. Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 2 +- hw/scsi/scsi-disk.c | 2 +- tests/virtio-scsi-test.c | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 1eaeffc830..9646743a7d 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -944,7 +944,7 @@ static int scsi_req_xfer(SCSICommand *cmd, SCSIDevice *= dev, uint8_t *buf) break; case WRITE_SAME_10: case WRITE_SAME_16: - cmd->xfer =3D dev->blocksize; + cmd->xfer =3D buf[1] & 1 ? 0 : dev->blocksize; break; case READ_CAPACITY_10: cmd->xfer =3D 8; diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index c65c1ce56d..5b7a48f5a5 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -1807,7 +1807,7 @@ static void scsi_disk_emulate_write_same(SCSIDiskReq = *r, uint8_t *inbuf) return; } =20 - if (buffer_is_zero(inbuf, s->qdev.blocksize)) { + if ((req->cmd.buf[1] & 0x1) || buffer_is_zero(inbuf, s->qdev.blocksize= )) { int flags =3D (req->cmd.buf[1] & 0x8) ? BDRV_REQ_MAY_UNMAP : 0; =20 /* The request is used as the AIO opaque value, so add a ref. */ diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index 7393d69bb2..037872bb98 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -216,6 +216,9 @@ static void test_unaligned_write_same(void) const uint8_t write_same_cdb_2[VIRTIO_SCSI_CDB_SIZE] =3D { 0x41, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x33, 0x00, 0x00 }; + const uint8_t write_same_cdb_ndob[VIRTIO_SCSI_CDB_SIZE] =3D { + 0x41, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x33, 0x00, 0x00 + }; =20 vs =3D qvirtio_scsi_pci_init(PCI_SLOT); =20 @@ -225,6 +228,9 @@ static void test_unaligned_write_same(void) g_assert_cmphex(0, =3D=3D, virtio_scsi_do_command(vs, write_same_cdb_2, NULL, 0, buf2, 512, N= ULL)); =20 + g_assert_cmphex(0, =3D=3D, + virtio_scsi_do_command(vs, write_same_cdb_ndob, NULL, 0, NULL, 0, = NULL)); + qvirtio_scsi_pci_free(vs); } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982499550576.9938773937338; Tue, 13 Mar 2018 16:08:19 -0700 (PDT) Received: from localhost ([::1]:43387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt1k-0005sY-Ky for importer@patchew.org; Tue, 13 Mar 2018 19:08:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshx-0005e3-3G for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshu-00038p-GH for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43554) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshu-00037T-99 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:46 -0400 Received: by mail-wr0-x244.google.com with SMTP id o1so2498868wro.10 for ; Tue, 13 Mar 2018 15:47:46 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.43 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kc0jPwGXta6m03/S0nr5VTOS83t4cEHXkNbqG4VHGnM=; b=rHmBcIA1d2L5F9dNjaP2QdtVtxIMpgTjsJIxtrnC70Uu18ggmsJ9uzoFvnoZ+o4i5I ugE1zgsQPY1x9fvaCbkueCXsFkanSr20gjO5ENmlapuPKpYp9jmRyqwyEJpR14k2MmVn OQc7/+kkemp+RAdfhuUgYJDi18p5HuVAXmOB4mNg3+ARHc/eyLKgeDB3gKS0udt75V4/ B2sIGlawF1p2/Kf5MQIs2b5ZWYxxrqtaDHow229FdRyYsvrfvCPU2UiKszQ0I4Vjk4rT fpt+9TVvfahvybgNA3hQwrdAszyPtiAxNlF2aqLnMlOokaWn5E5v/oNDg2pMaxyQ5k4r mXtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kc0jPwGXta6m03/S0nr5VTOS83t4cEHXkNbqG4VHGnM=; b=FFjYHRjsVC6GIrpbWEenC81lI//qm2PeTFqQk3XqfNZa8OVXW02zK1lRoMJ64X/HEJ 5xjZDOGU2ivHeTlZvwZZhWW7WnxqUFubjl4bdY0HL0GGcFZzbg10vfBBLVUEJapna14V 0ufovLA9gcjZhNJfjRGMDRSFDVf7Jp2v62qYMQrEVg5Y5gQGPHhUtBU66ikgFT/SxIvr S6zl6tbUMczeK4P9Zi/FnUYoC6F4dKuq9m3gnWSRWCQFNOy/UUaUT0aeUyU+2B1Lt/nV IG/jh33fGxsJA1HV1tPjI+I+sAt1qHOnSuZV6+8VmNF3MbqiNlDLM6A7mA/YNZbBT8YJ 27FA== X-Gm-Message-State: AElRT7FeSjtijKvZqE8sntnmzzI4dcmX+NXeWGUckspE1GSA7s2HLKxa jQieNfl8XC3H1jbX7Q0j/XzG/4qZ X-Google-Smtp-Source: AG47ELuh4ygJzwaTgisHgavALTuMo5kpaz+B2V8GXQzJ5u6c893EGAw8CuFesNxzDUDXnOcz/XO+3A== X-Received: by 10.223.133.182 with SMTP id 51mr1798757wrt.226.1520981264830; Tue, 13 Mar 2018 15:47:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:29 +0100 Message-Id: <20180313224719.4954-20-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 19/69] hw/i386: make IOMMUs configurable via default-configs/ 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Allow distributions to disable the Intel and/or AMD IOMMU devices. Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- default-configs/i386-softmmu.mak | 2 ++ default-configs/x86_64-softmmu.mak | 2 ++ hw/i386/Makefile.objs | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmm= u.mak index 3326e3e0bb..9e5a29fa4a 100644 --- a/default-configs/i386-softmmu.mak +++ b/default-configs/i386-softmmu.mak @@ -63,3 +63,5 @@ CONFIG_PXB=3Dy CONFIG_ACPI_VMGENID=3Dy CONFIG_FW_CFG_DMA=3Dy CONFIG_I2C=3Dy +CONFIG_VTD=3Dy +CONFIG_AMD_IOMMU=3Dy diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-so= ftmmu.mak index 1c6cda1d9a..7baf91b921 100644 --- a/default-configs/x86_64-softmmu.mak +++ b/default-configs/x86_64-softmmu.mak @@ -63,3 +63,5 @@ CONFIG_PXB=3Dy CONFIG_ACPI_VMGENID=3Dy CONFIG_FW_CFG_DMA=3Dy CONFIG_I2C=3Dy +CONFIG_VTD=3Dy +CONFIG_AMD_IOMMU=3Dy diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index fd279e7584..fa87a14152 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -2,8 +2,8 @@ obj-$(CONFIG_KVM) +=3D kvm/ obj-y +=3D multiboot.o obj-y +=3D pc.o pc_piix.o pc_q35.o obj-y +=3D pc_sysfw.o -obj-y +=3D x86-iommu.o intel_iommu.o -obj-y +=3D amd_iommu.o +obj-$(CONFIG_VTD) +=3D x86-iommu.o intel_iommu.o +obj-$(CONFIG_AMD_IOMMU) +=3D x86-iommu.o amd_iommu.o obj-$(CONFIG_XEN) +=3D ../xenpv/ xen/ obj-$(CONFIG_VMPORT) +=3D vmport.o obj-$(CONFIG_VMMOUSE) +=3D vmmouse.o --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098219873061.976597880104805; Tue, 13 Mar 2018 16:03:18 -0700 (PDT) Received: from localhost ([::1]:43362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evswm-0001dz-Qb for importer@patchew.org; Tue, 13 Mar 2018 19:03:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshx-0005eO-Cl for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshw-0003As-0u for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:40139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshv-00039j-Ls for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:47 -0400 Received: by mail-wm0-x242.google.com with SMTP id t6so879301wmt.5 for ; Tue, 13 Mar 2018 15:47:47 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=zjTnvIkfkzDm4gqzQY3QZRuTfgx3e9wQIbYkT4OIV24=; b=hbR8pHKHETRCxqNM94sPhakOP1loPsjoCzvl1pnq2Q1JVcFRIRrIRIuHQcUMwKSgMy F2qNpaQbbIAUpJYJHu4GVhp4yrt9EciO4hQ+Ktc0VKvEhSzxF3eocCLXUGBkkb68VxcB nZPpYKOKE5Sg13jRf6k+rd2TSwubh8xoE7EyeP3hIERbp7pd2eZRTaCZfiAeqOMnP6nv +SAJrwUfMbMGo+M5XlbapFMfhy7Lz5g1k9dy97ABUynPKtvCnnK9hJEI0/sC6cQufuGt uodVfGU8YvPdM8TIrjcXJvh+S8/YL8P0EYfVtEGdS3zbiSK5wSHMjgMWYSsczJnUAnDl +m1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=zjTnvIkfkzDm4gqzQY3QZRuTfgx3e9wQIbYkT4OIV24=; b=JUZEu0eSPqWygT6oNaHZ/pOI0Jv7FjeYzwfWQTMUV1vHWQi+giKlRNoVpUVa162G7i T4kc/erZUyx8wVoRRMKGV5Wqgh/1wmS5bq4ryh4BoIg07NnXqYW328bpbdRkhi0DcUED iQZLeb07Cj7CSOdjmeVB8wJ5uiis+2/by4B0Zb0aohfN6nhgdXD0ZKeBVEJvEU/Zh4va lMl/vT+OO9zEAxmSCjl62f4imKzNcbxUzSRq/Yh0BAkJDQwQROkRA+LmHmqTjzE9ss0Z objW9n4S3QzTsuwSVA44Yv3hSn6z3HvCNV+QtyXC0IOONPlxocs8xd0FJJ663TbQ6iiL vmMw== X-Gm-Message-State: AElRT7GkYagOFS8T4wlFzoAWtFHKAi+KdbkhaUwykoTV65oyqO33XtOV /ZuWYzQDORBsNJyNKLzXDvlPb0lB X-Google-Smtp-Source: AG47ELtUgekQMjuv3ZTSODiOIlzThZPLGOQ1id1CH1B5yjeZ0R7onubBD11mj9Yv2jElmjLNA0xH3Q== X-Received: by 10.28.207.207 with SMTP id f198mr5389wmg.0.1520981266096; Tue, 13 Mar 2018 15:47:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:30 +0100 Message-Id: <20180313224719.4954-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 20/69] Polish the version strings containing the package version 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since commit 67a1de0d195a there is no space anymore between the version number and the parentheses when running configure with --with-pkgversion=3Dfoo : $ qemu-system-s390x --version QEMU emulator version 2.11.50(foo) But the space is included when building without that option when building from a git checkout: $ qemu-system-s390x --version QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty) The same confusion exists with the "query-version" QMP command. Let's fix this by introducing a proper QEMU_FULL_VERSION definition that includes the space and parentheses, while the QEMU_PKGVERSION should just cleanly contain the package version string itself. Note that this also changes the behavior of the "query-version" QMP command (the space and parentheses are not included there anymore), but that's supposed to be OK since the strings there are not meant to be parsed by other tools. Fixes: 67a1de0d195a6185c39b436159c9ffc7720bf979 Buglink: https://bugs.launchpad.net/qemu/+bug/1673373 Signed-off-by: Thomas Huth Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- Makefile | 20 +++++++++++--------- bsd-user/main.c | 2 +- configure | 2 +- linux-user/main.c | 2 +- qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- qga/main.c | 2 +- scsi/qemu-pr-helper.c | 2 +- ui/cocoa.m | 2 +- vl.c | 2 +- 11 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 5d9ef3b8fd..416a81c7ca 100644 --- a/Makefile +++ b/Makefile @@ -434,21 +434,23 @@ all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules qemu-version.h: FORCE $(call quiet-command, \ (cd $(SRC_PATH); \ - printf '#define QEMU_PKGVERSION '; \ if test -n "$(PKGVERSION)"; then \ - printf '"$(PKGVERSION)"\n'; \ + pkgvers=3D"$(PKGVERSION)"; \ else \ if test -d .git; then \ - printf '" ('; \ - git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ + pkgvers=3D$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\ if ! git diff-index --quiet HEAD &>/dev/null; then \ - printf -- '-dirty'; \ + pkgvers=3D"$${pkgvers}-dirty"; \ fi; \ - printf ')"\n'; \ - else \ - printf '""\n'; \ fi; \ - fi) > $@.tmp) + fi; \ + printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \ + if test -n "$${pkgvers}"; then \ + printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"= \n'; \ + else \ + printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \ + fi; \ + ) > $@.tmp) $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ mv $@.tmp $@; \ else \ diff --git a/bsd-user/main.c b/bsd-user/main.c index efef5ff8c5..05aa5594a9 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -649,7 +649,7 @@ void cpu_loop(CPUSPARCState *env) =20 static void usage(void) { - printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION + printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" "BSD CPU emulator (compiled for %s emulation)\n" diff --git a/configure b/configure index f74e1f3b7c..26d56eb5bb 100755 --- a/configure +++ b/configure @@ -1163,7 +1163,7 @@ for opt do ;; --disable-blobs) blobs=3D"no" ;; - --with-pkgversion=3D*) pkgversion=3D" ($optarg)" + --with-pkgversion=3D*) pkgversion=3D"$optarg" ;; --with-coroutine=3D*) coroutine=3D"$optarg" ;; diff --git a/linux-user/main.c b/linux-user/main.c index 7bc9bc79b0..abbd14e208 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4163,7 +4163,7 @@ static void handle_arg_strace(const char *arg) =20 static void handle_arg_version(const char *arg) { - printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION + printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); exit(EXIT_SUCCESS); } diff --git a/qemu-img.c b/qemu-img.c index 088d89043e..855fa52514 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -46,7 +46,7 @@ #include "crypto/init.h" #include "trace/control.h" =20 -#define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION QEMU_PKGVERSION \ +#define QEMU_IMG_VERSION "qemu-img version " QEMU_FULL_VERSION \ "\n" QEMU_COPYRIGHT "\n" =20 typedef struct img_cmd_t { diff --git a/qemu-io.c b/qemu-io.c index 160fb2a89f..e692c555e0 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -558,7 +558,7 @@ int main(int argc, char **argv) trace_file =3D trace_opt_parse(optarg); break; case 'V': - printf("%s version " QEMU_VERSION QEMU_PKGVERSION "\n" + printf("%s version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n", progname); exit(0); case 'h': diff --git a/qemu-nbd.c b/qemu-nbd.c index ed5d9b5062..0af0560ad1 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -130,7 +130,7 @@ QEMU_HELP_BOTTOM "\n" static void version(const char *name) { printf( -"%s " QEMU_VERSION QEMU_PKGVERSION "\n" +"%s " QEMU_FULL_VERSION "\n" "Written by Anthony Liguori.\n" "\n" QEMU_COPYRIGHT "\n" diff --git a/qga/main.c b/qga/main.c index f9c83050c5..837a75a46a 100644 --- a/qga/main.c +++ b/qga/main.c @@ -218,7 +218,7 @@ static void usage(const char *cmd) { printf( "Usage: %s [-m -p ] []\n" -"QEMU Guest Agent " QEMU_VERSION QEMU_PKGVERSION "\n" +"QEMU Guest Agent " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "\n" " -m, --method transport method: one of unix-listen, virtio-serial,\= n" diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 9fe615c73c..3facbba170 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -102,7 +102,7 @@ QEMU_HELP_BOTTOM "\n" static void version(const char *name) { printf( -"%s " QEMU_VERSION QEMU_PKGVERSION "\n" +"%s " QEMU_FULL_VERSION "\n" "Written by Paolo Bonzini.\n" "\n" QEMU_COPYRIGHT "\n" diff --git a/ui/cocoa.m b/ui/cocoa.m index 18de0bb3ea..110b393e4e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1330,7 +1330,7 @@ QemuCocoaView *cocoaView; /* Create the version string*/ NSString *version_string; version_string =3D [[NSString alloc] initWithFormat: - @"QEMU emulator version %s%s", QEMU_VERSION, QEMU_PKGVERSION]; + @"QEMU emulator version %s", QEMU_FULL_VERSION]; [version_label setStringValue: version_string]; [superView addSubview: version_label]; =20 diff --git a/vl.c b/vl.c index 26662eb9e7..e81152417a 100644 --- a/vl.c +++ b/vl.c @@ -1948,7 +1948,7 @@ static void main_loop(void) =20 static void version(void) { - printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" + printf("QEMU emulator version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982670599381.08832372031793; Tue, 13 Mar 2018 16:11:10 -0700 (PDT) Received: from localhost ([::1]:43406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt4X-0008NJ-Km for importer@patchew.org; Tue, 13 Mar 2018 19:11:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshy-0005fP-FE for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshx-0003CO-2i for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:50 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:52461) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshw-0003Az-OG for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:48 -0400 Received: by mail-wm0-x234.google.com with SMTP id t3so868280wmc.2 for ; Tue, 13 Mar 2018 15:47:48 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v1EPGv9Cce9uuLtorMLRNSGF8tQZyoqASX916tvwq0U=; b=Yslgc2Qc1ak8rkk5OukbyuNMkInji50c3EpDG0XOLgmYqtWTnBclLeRj7h63Xm+qWs xISAV5xKMvoNWQGwzFBQRuCLKCfUIRoZWQXZmm3tzB81AOhRdzFlU+zyCDGB1mxMqubv /XLP8dskwqF0hJgAp4On5ey9qaTNk5B4/gE+L3IMAbJQZWsCi/8qTdxXqn+bEmxO0LoL gwUsFII0nVfrkSBSWocwtgWuwpG28rIOEakG2qHDADTzZOpTd8o8ay19B8zLxqsh+5kZ 3pZUFGgdcf/XgExRVDnO+T5EB4v0j3G6LEIenkPs3qLvFtUj8kVyiVXJ7ggCuXzaYxeB MA9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=v1EPGv9Cce9uuLtorMLRNSGF8tQZyoqASX916tvwq0U=; b=pxhV7gX5l1CxAgyz2DM7dAiigazUAY5UIhAxJs60r/YtFAOl7nDqiv2k93KdrYRS/f Lz36JGqPNuK/XS5GYvmQyiKiIHjojwjFN/g/TTta+RQluU1M5X+WV6XsbaUaQ6jaDbj+ afogQvyxfIejqP87WPQimQolEYBboIvCQ2ovkdIijnHXx6N1D9kTgNgNTlzOVFbCZOBX 8r9nkA68Wf7imyKUYZq+311J54HXy+FLEUu0+c8ySpLoTcxlyo5r+DCoViQgZY3fe5RU B2n41oha7g45CW8pvZCPyp6ZQEvZh3ffBczQUxr3jbG+EnbAZGymg+QEi70zpm4g0W3U 1mgg== X-Gm-Message-State: AElRT7ESKFSsz7wiIds2w2mUPJqxiEa5XkHmr6Jj1AXZbXf6kSbp2YiN OVSOP5cK9P31YAzneF7KML81v/gB X-Google-Smtp-Source: AG47ELtDHYHQ9xSh1Yw9ZTPRjreGhN1gJ8V/HQJHTBGwWl/egJGze9EQfcAomp5FRIrP/5NrqoETOw== X-Received: by 10.28.16.21 with SMTP id 21mr2075069wmq.109.1520981267264; Tue, 13 Mar 2018 15:47:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:31 +0100 Message-Id: <20180313224719.4954-22-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::234 Subject: [Qemu-devel] [PULL 21/69] hw/mips/jazz: Fix implicit creation of "-drive if=scsi" devices 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Thomas Huth The global hack for creating SCSI devices has recently been removed, but this apparently broke SCSI devices on some boards that were not ready for this change yet. For the pica61 machine you now get: $ mips64-softmmu/qemu-system-mips64 -M pica61 -cdrom x.iso qemu-system-mips64: -cdrom x.iso: machine type does not support if=3Dscsi,b= us=3D0,unit=3D2 Fix it by calling scsi_bus_legacy_handle_cmdline() after creating the corresponding SCSI controller. Fixes: 1454509726719e0933c800fad00d6999752688ea Signed-off-by: Thomas Huth Message-Id: <1520414644-11535-1-git-send-email-thuth@redhat.com> Reviewed-by: Herv=C3=A9 Poussineau Signed-off-by: Paolo Bonzini --- hw/mips/mips_jazz.c | 7 ++++--- hw/scsi/esp.c | 12 +++++++----- include/hw/scsi/esp.h | 10 +++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 08e6f620fc..e135385265 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -146,6 +146,7 @@ static void mips_jazz_init(MachineState *machine, MemoryRegion *ram =3D g_new(MemoryRegion, 1); MemoryRegion *bios =3D g_new(MemoryRegion, 1); MemoryRegion *bios2 =3D g_new(MemoryRegion, 1); + ESPState *esp; =20 /* init CPUs */ cpu =3D MIPS_CPU(cpu_create(machine->cpu_type)); @@ -277,9 +278,9 @@ static void mips_jazz_init(MachineState *machine, } =20 /* SCSI adapter */ - esp_init(0x80002000, 0, - rc4030_dma_read, rc4030_dma_write, dmas[0], - qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable); + esp =3D esp_init(0x80002000, 0, rc4030_dma_read, rc4030_dma_write, dma= s[0], + qdev_get_gpio_in(rc4030, 5), &esp_reset, &dma_enable); + scsi_bus_legacy_handle_cmdline(&esp->bus); =20 /* Floppy */ for (n =3D 0; n < MAX_FD; n++) { diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 45975c21e8..64ec285826 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -618,11 +618,11 @@ static const MemoryRegionOps sysbus_esp_mem_ops =3D { .valid.accepts =3D esp_mem_accepts, }; =20 -void esp_init(hwaddr espaddr, int it_shift, - ESPDMAMemoryReadWriteFunc dma_memory_read, - ESPDMAMemoryReadWriteFunc dma_memory_write, - void *dma_opaque, qemu_irq irq, qemu_irq *reset, - qemu_irq *dma_enable) +ESPState *esp_init(hwaddr espaddr, int it_shift, + ESPDMAMemoryReadWriteFunc dma_memory_read, + ESPDMAMemoryReadWriteFunc dma_memory_write, + void *dma_opaque, qemu_irq irq, qemu_irq *reset, + qemu_irq *dma_enable) { DeviceState *dev; SysBusDevice *s; @@ -644,6 +644,8 @@ void esp_init(hwaddr espaddr, int it_shift, sysbus_mmio_map(s, 0, espaddr); *reset =3D qdev_get_gpio_in(dev, 0); *dma_enable =3D qdev_get_gpio_in(dev, 1); + + return esp; } =20 static const struct SCSIBusInfo esp_scsi_info =3D { diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 3b160f858c..93fdaced67 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -7,11 +7,6 @@ /* esp.c */ #define ESP_MAX_DEVS 7 typedef void (*ESPDMAMemoryReadWriteFunc)(void *opaque, uint8_t *buf, int = len); -void esp_init(hwaddr espaddr, int it_shift, - ESPDMAMemoryReadWriteFunc dma_memory_read, - ESPDMAMemoryReadWriteFunc dma_memory_write, - void *dma_opaque, qemu_irq irq, qemu_irq *reset, - qemu_irq *dma_enable); =20 #define ESP_REGS 16 #define TI_BUFSZ 16 @@ -136,6 +131,11 @@ typedef struct { #define TCHI_FAS100A 0x4 #define TCHI_AM53C974 0x12 =20 +ESPState *esp_init(hwaddr espaddr, int it_shift, + ESPDMAMemoryReadWriteFunc dma_memory_read, + ESPDMAMemoryReadWriteFunc dma_memory_write, + void *dma_opaque, qemu_irq irq, qemu_irq *reset, + qemu_irq *dma_enable); void esp_dma_enable(ESPState *s, int irq, int level); void esp_request_cancelled(SCSIRequest *req); void esp_command_complete(SCSIRequest *req, uint32_t status, size_t resid); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520981899978158.64670443671434; Tue, 13 Mar 2018 15:58:19 -0700 (PDT) Received: from localhost ([::1]:43330 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evss2-0005qM-JX for importer@patchew.org; Tue, 13 Mar 2018 18:58:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshy-0005fW-Hk for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshx-0003Dj-QD for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:50 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:52186) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshx-0003CK-Jg for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: by mail-wm0-x241.google.com with SMTP id h21so868361wmd.1 for ; Tue, 13 Mar 2018 15:47:49 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.47 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=eZ9u5ghfK5e3BcNtVbWSmQEDahh0fYGsAnpFejQPl8w=; b=DUxq5FIoLo+LObZc7nKCcfynTS5Cyki93U4br/NJXHnLz5Edr/xX2+APbC2HHNQXjC ExAg2QIpq2Zgjv1K1LbeSVc1HobLZPEUeTgXAYYegmGIpTL8eOh0tfoS64cVtkt8+ngg 0FF6+FEuhVvumBjBT1wy14Jy9KxHMVyWOB+YeFmU1P9IfryOg6ROiqVoehZP6BPeDqwZ wwnAajv2ie4wAglK7FZoLNC7Srf3NHK4nIqf6jiB1MSagtmunqJamV44ltgDrUpcHwq6 sKSzPiYOgsra5rZKA7cNRG8hMzp/8oSGfWblwEWT2FNMdNvn2uoXKA0N9/sJ2/q0FYMe eawA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=eZ9u5ghfK5e3BcNtVbWSmQEDahh0fYGsAnpFejQPl8w=; b=Of3inb2e3JQU8Ut4U6dLIPKSpxjMfKhZrbt1a0Zgu8XL9gASCKBN07d8xRKd7YOc3m phq5OEDckkVZyCnyDH19ag9Bcp2dVYtu0jPFi2rv1p5u0BWxmyifaWR+vOo5PZ2scYya 7cRq0ANKfs/PCes0TBq3h+XigEmi4DmuOkq2LkeO3IFOA/frUOpXOp986xYN58VEXTM3 i0v4Ay+KHc+b4sSj06G7Ikoe7P0laKTyu2V6HB8Q7LjpV0byfiiMxg/OkIZfrXQv/bJA VlTTSq1z+WgDMNMCXKwzu0adC6ts0tCrYKgRu/0QvRvZspnEXim8qQqXWON8+peey2MN U5aQ== X-Gm-Message-State: AElRT7Egrdk/ddYiYs1B7engd9t8Vlf1RbcGwT7DP05ddNsyuVuMnt9P BHDphfV5dlstvygRhrRVYaN++rLx X-Google-Smtp-Source: AG47ELsTAvoYU8BniqN87X7xCLtzFv1unV+TeXD3oBy6PWeS1a+vXXalLX5ul2hmNq5BrqiYjJv8Ig== X-Received: by 10.28.8.201 with SMTP id 192mr2098868wmi.47.1520981268228; Tue, 13 Mar 2018 15:47:48 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:32 +0100 Message-Id: <20180313224719.4954-23-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 22/69] rcutorture: remove synchronize_rcu from readers 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This gives much worse numbers for readers, especially if synchronize_rcu is made more expensive as is the case with --enable-membarrier. Before: $ tests/rcutorture 10 stress 10 n_reads: 98304 n_updates: 529 n_mberror: 0 rcu_stress_count: 98302 2 0 0 0 0 0 0 0 0 0 After: $ tests/rcutorture 10 stress 10 n_reads: 165158482 n_updates: 429 n_mberror: 0 rcu_stress_count: 165154364 4118 0 0 0 0 0 0 0 0 0 Signed-off-by: Paolo Bonzini --- tests/rcutorture.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/rcutorture.c b/tests/rcutorture.c index 4002ecf123..49311c82ea 100644 --- a/tests/rcutorture.c +++ b/tests/rcutorture.c @@ -238,7 +238,6 @@ long long rcu_stress_count[RCU_STRESS_PIPE_LEN + 1]; static void *rcu_read_stress_test(void *arg) { int i; - int itercnt =3D 0; struct rcu_stress *p; int pc; long long n_reads_local =3D 0; @@ -269,9 +268,6 @@ static void *rcu_read_stress_test(void *arg) } rcu_stress_local[pc]++; n_reads_local++; - if ((++itercnt % 0x1000) =3D=3D 0) { - synchronize_rcu(); - } } qemu_mutex_lock(&counts_mutex); n_reads +=3D n_reads_local; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982436423357.2303334050839; Tue, 13 Mar 2018 16:07:16 -0700 (PDT) Received: from localhost ([::1]:43383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt0l-0004yI-HG for importer@patchew.org; Tue, 13 Mar 2018 19:07:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi0-0005je-OD for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshz-0003GJ-LD for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:52 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:37049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshz-0003FE-CY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:51 -0400 Received: by mail-wm0-x241.google.com with SMTP id 139so879359wmn.2 for ; Tue, 13 Mar 2018 15:47:51 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.48 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=i+9Wg6hajlI5XpxyCpTM/+fFSyFsebW9g9br3zICc9M=; b=jfSX4DMWnOCEyWkeia37vePbCo44LfPdlCopMf6IYkO3spuArft+XrSvE48IC5FSsW 4NbHJrmeWkPdOBaiE0PmYBoafHm7TQ/gFuhf0WHeFNJASrZVCNTsUGctV827SU8i/NS6 3LG8DIq4JZJiOQvP8JleUPX5GL8yBEyEL4gBxJqWuph//6ccBg+cbcujnOT8hXZXr/9s 78slXJa53h8fcRElIkEDRhAyqxY3EIaWIfj7PuDRFmLO7OppIeSZvl78Uac/RdZJ3Amm t0t2ib0NjgV5Kb70bndabTV9ErROHTr6wb1T38/3hPjm3bg/4VZjuPAewOxNSk3jihLy Gz9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=i+9Wg6hajlI5XpxyCpTM/+fFSyFsebW9g9br3zICc9M=; b=qsO7Emvflku0/mRn9B8n0OnwZFUJfz7Fs31EFp5CPuaOm5VD/a8G16HHfB262uj08C ZQOcahrYpmVjcaSeCEozDgwoxN6fi3ClQw4i6061IE/JlxHBS6zLCw9oMQ/yj9koWiJ7 agzYmWmM4NG4G+hnw5/qdu/ctWDLwI8QEOHbE/uhagjV1CuDACYzRSO3Cn9eb5jmi6GD FQ+VvwxNyoIZxelEZSNMh66rcvlNiWC7WrmbzIzUBMXyvnuUOnvPIzYFWgrRwOnJDJ0N YdWzyx4MQY5Z2i19V2exnE4QS5TNmNL2GaaEg4hlJTKSj5X2g5/+4vddQjUQAERr0M0v zdlA== X-Gm-Message-State: AElRT7Hcj7aVU/3HclXSHAvXL/U+UIS1wrs25tsDv/nGYK558s7bjAPs g8krmj//AxysiU8nnEQViv/hooi8 X-Google-Smtp-Source: AG47ELtBD11zNPOGF+YzRKQ93DmVhSPRWb0ynDdYsR8bMCkTIeCv+mv1BV8b4xprqJwmzn3SwiNtNw== X-Received: by 10.28.51.67 with SMTP id z64mr1965426wmz.59.1520981269406; Tue, 13 Mar 2018 15:47:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:33 +0100 Message-Id: <20180313224719.4954-24-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 23/69] docs: document atomic_load_acquire and atomic_store_release 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We will use them in the next patch, document what they do. Signed-off-by: Paolo Bonzini --- docs/devel/atomics.txt | 57 ++++++++++++++++++++++++++--------------------= ---- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/docs/devel/atomics.txt b/docs/devel/atomics.txt index 10c5fa37e8..a4db3a4aaa 100644 --- a/docs/devel/atomics.txt +++ b/docs/devel/atomics.txt @@ -122,20 +122,30 @@ In general, if the algorithm you are writing includes= both writes and reads on the same side, it is generally simpler to use sequentially consistent primitives. =20 -When using this model, variables are accessed with atomic_read() and -atomic_set(), and restrictions to the ordering of accesses is enforced +When using this model, variables are accessed with: + +- atomic_read() and atomic_set(); these prevent the compiler from + optimizing accesses out of existence and creating unsolicited + accesses, but do not otherwise impose any ordering on loads and + stores: both the compiler and the processor are free to reorder + them. + +- atomic_load_acquire(), which guarantees the LOAD to appear to + happen, with respect to the other components of the system, + before all the LOAD or STORE operations specified afterwards. + Operations coming before atomic_load_acquire() can still be + reordered after it. + +- atomic_store_release(), which guarantees the STORE to appear to + happen, with respect to the other components of the system, + after all the LOAD or STORE operations specified afterwards. + Operations coming after atomic_store_release() can still be + reordered after it. + +Restrictions to the ordering of accesses can also be specified using the memory barrier macros: smp_rmb(), smp_wmb(), smp_mb(), smp_mb_acquire(), smp_mb_release(), smp_read_barrier_depends(). =20 -atomic_read() and atomic_set() prevents the compiler from using -optimizations that might otherwise optimize accesses out of existence -on the one hand, or that might create unsolicited accesses on the other. -In general this should not have any effect, because the same compiler -barriers are already implied by memory barriers. However, it is useful -to do so, because it tells readers which variables are shared with -other threads, and which are local to the current thread or protected -by other, more mundane means. - Memory barriers control the order of references to shared memory. They come in six kinds: =20 @@ -232,7 +242,7 @@ make atomic_mb_set() the more expensive operation. =20 There are two common cases in which atomic_mb_read and atomic_mb_set generate too many memory barriers, and thus it can be useful to manually -place barriers instead: +place barriers, or use atomic_load_acquire/atomic_store_release instead: =20 - when a data structure has one thread that is always a writer and one thread that is always a reader, manual placement of @@ -243,18 +253,15 @@ place barriers instead: thread 1 thread 1 ------------------------- ------------------------ (other writes) - smp_mb_release() - atomic_mb_set(&a, x) atomic_set(&a, x) - smp_wmb() - atomic_mb_set(&b, y) atomic_set(&b, y) + atomic_mb_set(&a, x) atomic_store_release(&a, x) + atomic_mb_set(&b, y) atomic_store_release(&b, y) =20 =3D> thread 2 thread 2 ------------------------- ------------------------ - y =3D atomic_mb_read(&b) y =3D atomic_read(&b) - smp_rmb() - x =3D atomic_mb_read(&a) x =3D atomic_read(&a) - smp_mb_acquire() + y =3D atomic_mb_read(&b) y =3D atomic_load_acquire(&= b) + x =3D atomic_mb_read(&a) x =3D atomic_load_acquire(&= a) + (other reads) =20 Note that the barrier between the stores in thread 1, and between the loads in thread 2, has been optimized here to a write or a @@ -276,7 +283,6 @@ place barriers instead: smp_mb_acquire(); =20 Similarly, atomic_mb_set() can be transformed as follows: - smp_mb(): =20 smp_mb_release(); for (i =3D 0; i < 10; i++) =3D> for (i =3D 0; i < 10; i++) @@ -284,6 +290,8 @@ place barriers instead: smp_mb(); =20 =20 + The other thread can still use atomic_mb_read()/atomic_mb_set(). + The two tricks can be combined. In this case, splitting a loop in two lets you hoist the barriers out of the loops _and_ eliminate the expensive smp_mb(): @@ -296,8 +304,6 @@ expensive smp_mb(): atomic_set(&a[i], false); smp_mb(); =20 - The other thread can still use atomic_mb_read()/atomic_mb_set() - =20 Memory barrier pairing ---------------------- @@ -386,10 +392,7 @@ and memory barriers, and the equivalents in QEMU: note that smp_store_mb() is a little weaker than atomic_mb_set(). atomic_mb_read() compiles to the same instructions as Linux's smp_load_acquire(), but this should be treated as an implementation - detail. QEMU does have atomic_load_acquire() and atomic_store_release() - macros, but for now they are only used within atomic.h. This may - change in the future. - + detail. =20 SOURCES =3D=3D=3D=3D=3D=3D=3D --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982056357815.7183426831389; Tue, 13 Mar 2018 16:00:56 -0700 (PDT) Received: from localhost ([::1]:43348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsud-0008KJ-Dp for importer@patchew.org; Tue, 13 Mar 2018 19:00:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi1-0005kr-Up for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi1-0003JV-2n for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:53 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33095) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi0-0003I8-RY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:52 -0400 Received: by mail-wm0-x242.google.com with SMTP id s206so16179041wme.0 for ; Tue, 13 Mar 2018 15:47:52 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.49 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ccO3p8t35wxJ+0nzNyklf4tZrUd4yZLT5/Kzmwd/wow=; b=sLV97+WlNqnvu/ac8gvyL/1Q37anXe8bdjsHmQdq0tl67tDoNXsk/DiQI8v5hqgqg2 0NN00fNu2dp/y2JFsZL5229MHx2fVS/l5U/Tlygszi2I9aWoVmQ8As5WyU3RB+I3Tbjw mFsypZ9WLZYh7kcw1JagR/jgInDa278cupGm+U1wX8TxFCykimfCyXcE3AtgBtLZ8fMU I8YR/FiTwcxZf25CfsLIO+y27P9pNnvLvpIjhLuJomA2I2EfeSKFla1/S0BupZO2coZl 3THS6Z6A349Qp7a79fIN6nldQYGjJFln3DRdtKDD2crK3uJy+XX9zTtTB2DDWesghmoh Czpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ccO3p8t35wxJ+0nzNyklf4tZrUd4yZLT5/Kzmwd/wow=; b=AV8XOfanpng0wrdSItFhnRnfM9kSPdUDY4gdNseyjd51OP1mVjWRoesprBE9J81d/S vEh5os15MedHgqxN+mdZAf9zIKHVZkMUbKH0/6QhW3W0GIEIHp/pR2FLpnht2p+rSC8y tWsNRlPfFA+/oOMhU6jbC09nkhbLtHTWsq0fIgBxujZSd8b1Yo/YEItKOt+Jufgl0NGz nKDxZWFBzNf8lJJd5lST1ndpPFKKWyFNRHNmJ5Hucjh5GdF2g9+7fKgmyBnpFmO4NZGW qaW1bba9NHDkra+lLgVve7eL2CATDwCFkvMlhRz9SW18Nnh1pgPKBh+9ts64pB321yh+ T3kw== X-Gm-Message-State: AElRT7FjbW7DtMAD4k7kr+vxAFn6hVMaQys5Z/2P4hMOZfE8VDSdlX47 L1bbV3iKX1qVluw+DGrqGspfiS/c X-Google-Smtp-Source: AG47ELsA+5IFKeSdlU94folMaef9j7LMf1QMQAaDJUxINb9jJGsJh5AWGfqYSv8fECP9uSlcxduBIQ== X-Received: by 10.28.180.132 with SMTP id d126mr2114056wmf.93.1520981271366; Tue, 13 Mar 2018 15:47:51 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:34 +0100 Message-Id: <20180313224719.4954-25-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 24/69] rcu: make memory barriers more explicit 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Prepare for introducing smp_mb_placeholder() and smp_mb_global(). The new smp_mb() in synchronize_rcu() is not strictly necessary, since the first atomic_mb_set for rcu_gp_ctr provides the required ordering. However, synchronize_rcu is not performance critical, and it *will* be necessary to introduce a smp_mb_global before calling wait_for_readers(). Signed-off-by: Paolo Bonzini --- include/qemu/rcu.h | 15 +++++++++++++-- util/rcu.c | 12 +++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index f19413d649..625f09ac09 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -79,7 +79,10 @@ static inline void rcu_read_lock(void) } =20 ctr =3D atomic_read(&rcu_gp_ctr); - atomic_xchg(&p_rcu_reader->ctr, ctr); + atomic_set(&p_rcu_reader->ctr, ctr); + + /* Write p_rcu_reader->ctr before reading RCU-protected pointers. */ + smp_mb(); } =20 static inline void rcu_read_unlock(void) @@ -91,7 +94,15 @@ static inline void rcu_read_unlock(void) return; } =20 - atomic_xchg(&p_rcu_reader->ctr, 0); + /* Ensure that the critical section is seen to precede the + * store to p_rcu_reader->ctr. Together with the following + * smp_mb(), this ensures writes to p_rcu_reader->ctr + * are sequentially consistent. + */ + atomic_store_release(&p_rcu_reader->ctr, 0); + + /* Write p_rcu_reader->ctr before reading p_rcu_reader->waiting. */ + smp_mb(); if (unlikely(atomic_read(&p_rcu_reader->waiting))) { atomic_set(&p_rcu_reader->waiting, false); qemu_event_set(&rcu_gp_event); diff --git a/util/rcu.c b/util/rcu.c index f4d09c8304..7366dc50dd 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -92,8 +92,9 @@ static void wait_for_readers(void) atomic_set(&index->waiting, true); } =20 - /* Here, order the stores to index->waiting before the - * loads of index->ctr. + /* Here, order the stores to index->waiting before the loads of + * index->ctr. Pairs with smp_mb() in rcu_read_unlock(), + * ensuring that the loads of index->ctr are sequentially consiste= nt. */ smp_mb(); =20 @@ -142,8 +143,13 @@ static void wait_for_readers(void) void synchronize_rcu(void) { qemu_mutex_lock(&rcu_sync_lock); - qemu_mutex_lock(&rcu_registry_lock); =20 + /* Write RCU-protected pointers before reading p_rcu_reader->ctr. + * Pairs with smp_mb() in rcu_read_lock(). + */ + smp_mb(); + + qemu_mutex_lock(&rcu_registry_lock); if (!QLIST_EMPTY(®istry)) { /* In either case, the atomic_mb_set below blocks stores that free * old RCU-protected pointers. --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983175490100.26331676619566; Tue, 13 Mar 2018 16:19:35 -0700 (PDT) Received: from localhost ([::1]:43419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt7A-0002O9-39 for importer@patchew.org; Tue, 13 Mar 2018 19:13:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi3-0005mb-DK for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi2-0003LR-FY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:55 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:39403) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi2-0003KT-9A for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:54 -0400 Received: by mail-wm0-x241.google.com with SMTP id u10so668113wmu.4 for ; Tue, 13 Mar 2018 15:47:54 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.51 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ExzxZn7QcYy3zxF01QFKugrs7TwEbSMtHSqbXh0L32U=; b=f2cqSPa/ya7ItpGKHlYZnfRRzuO7WqbPeodzU20iYqJAN37hNaFnaPt0lxJvDhnGfh YX/u5D/7O8Fc4GzfP1u46NU2Sdb7n9NrDEIF3K6xnIOig5+nKXV6/J0f6viFoGeEaRd8 liIj4GN4WdnhUMgvlqTsm2rqI5yjlbgYvVSvuIJvCP6Gwn/SnGDwpA/1Y3z0QT+1OLh8 +UCtRdLUGuC10H9Cyo32XullGLXLKD/26tFAuRK5k8HFAfi8tlyf4th4+/Ih1SM8tOrj OirYnQJpJeC2ibFPSEGkn2q4MDMlCvy9mGKpgqIz8ef0GihoW4WGaO04jsGAoAYvZULE 1Bsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ExzxZn7QcYy3zxF01QFKugrs7TwEbSMtHSqbXh0L32U=; b=aElOdqSDsddS1YLTdRJNl6soEIFI2N0mVBQOQbQrNCd1IZ/yb3y2sodLX/XBmaPBcu EdesXtHGjl+HdPLqrufPSrUo5ER/h2ZksrjFgXmLyoSck5hIyqzcFQTAE+Fg5Mt/eLcO H6y02nnX/jzkZvNL3ON1NauY94a+m1VWD9IvwPSiTUc8azm8ciorM6Rtcd4WrLQZcqsA ZYEoNrTAKztxN+tqCFoFVyLugyMkxJPuA8Cmkrl0EdMh3ttSjDjMR+7n9U8GkVkLOMxF LbNBDm8eho6zUC7GSLUNrNeZmZozUn0XdZKG5yZRZnr/+uk9MJzegFf1XwLfOu6NplrB GTcw== X-Gm-Message-State: AElRT7E4vi0DJpRhVe+bxFfe6qCz+jvdyZWgC7bxW16Sl6p8z7T+oRBG D9MH3fJLNU1eptBmWOSvwO5SNJ/8 X-Google-Smtp-Source: AG47ELuGci05DfwVDrM6500y/CMoRydFvRRGO5VVo9WrZBUV5MR+rv0Ai4xA3ZjyvmkcJBptO4yNog== X-Received: by 10.28.108.6 with SMTP id h6mr2074477wmc.6.1520981272855; Tue, 13 Mar 2018 15:47:52 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:35 +0100 Message-Id: <20180313224719.4954-26-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 25/69] membarrier: introduce qemu/sys_membarrier.h 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This new header file provides heavy-weight "global" memory barriers that enforce memory ordering on each running thread belonging to the current process. For now, use a dummy implementation that issues memory barriers on both sides (matching what QEMU has been doing so far). Signed-off-by: Paolo Bonzini --- include/qemu/rcu.h | 7 ++++--- include/qemu/sys_membarrier.h | 17 +++++++++++++++++ util/rcu.c | 9 +++++---- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 include/qemu/sys_membarrier.h diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 625f09ac09..22876d1428 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -27,6 +27,7 @@ #include "qemu/thread.h" #include "qemu/queue.h" #include "qemu/atomic.h" +#include "qemu/sys_membarrier.h" =20 #ifdef __cplusplus extern "C" { @@ -82,7 +83,7 @@ static inline void rcu_read_lock(void) atomic_set(&p_rcu_reader->ctr, ctr); =20 /* Write p_rcu_reader->ctr before reading RCU-protected pointers. */ - smp_mb(); + smp_mb_placeholder(); } =20 static inline void rcu_read_unlock(void) @@ -96,13 +97,13 @@ static inline void rcu_read_unlock(void) =20 /* Ensure that the critical section is seen to precede the * store to p_rcu_reader->ctr. Together with the following - * smp_mb(), this ensures writes to p_rcu_reader->ctr + * smp_mb_placeholder(), this ensures writes to p_rcu_reader->ctr * are sequentially consistent. */ atomic_store_release(&p_rcu_reader->ctr, 0); =20 /* Write p_rcu_reader->ctr before reading p_rcu_reader->waiting. */ - smp_mb(); + smp_mb_placeholder(); if (unlikely(atomic_read(&p_rcu_reader->waiting))) { atomic_set(&p_rcu_reader->waiting, false); qemu_event_set(&rcu_gp_event); diff --git a/include/qemu/sys_membarrier.h b/include/qemu/sys_membarrier.h new file mode 100644 index 0000000000..9ce7f5210b --- /dev/null +++ b/include/qemu/sys_membarrier.h @@ -0,0 +1,17 @@ +/* + * Process-global memory barriers + * + * Copyright (c) 2018 Red Hat, Inc. + * + * Author: Paolo Bonzini + */ + +#ifndef QEMU_SYS_MEMBARRIER_H +#define QEMU_SYS_MEMBARRIER_H 1 + +/* Keep it simple, execute a real memory barrier on both sides. */ +static inline void smp_mb_global_init(void) {} +#define smp_mb_global() smp_mb() +#define smp_mb_placeholder() smp_mb() + +#endif diff --git a/util/rcu.c b/util/rcu.c index 7366dc50dd..5676c22bd1 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -93,10 +93,10 @@ static void wait_for_readers(void) } =20 /* Here, order the stores to index->waiting before the loads of - * index->ctr. Pairs with smp_mb() in rcu_read_unlock(), + * index->ctr. Pairs with smp_mb_placeholder() in rcu_read_unlock= (), * ensuring that the loads of index->ctr are sequentially consiste= nt. */ - smp_mb(); + smp_mb_global(); =20 QLIST_FOREACH_SAFE(index, ®istry, node, tmp) { if (!rcu_gp_ongoing(&index->ctr)) { @@ -145,9 +145,9 @@ void synchronize_rcu(void) qemu_mutex_lock(&rcu_sync_lock); =20 /* Write RCU-protected pointers before reading p_rcu_reader->ctr. - * Pairs with smp_mb() in rcu_read_lock(). + * Pairs with smp_mb_placeholder() in rcu_read_lock(). */ - smp_mb(); + smp_mb_global(); =20 qemu_mutex_lock(&rcu_registry_lock); if (!QLIST_EMPTY(®istry)) { @@ -376,6 +376,7 @@ static void rcu_init_child(void) =20 static void __attribute__((__constructor__)) rcu_init(void) { + smp_mb_global_init(); #ifdef CONFIG_POSIX pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child); #endif --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982255376813.2083458437294; Tue, 13 Mar 2018 16:04:15 -0700 (PDT) Received: from localhost ([::1]:43365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsxi-0002Oq-Nk for importer@patchew.org; Tue, 13 Mar 2018 19:04:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58131) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi8-0005p9-J1 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi3-0003NO-Pq for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:00 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:34364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi3-0003Lt-GH for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:55 -0400 Received: by mail-wm0-x241.google.com with SMTP id a20so16162290wmd.1 for ; Tue, 13 Mar 2018 15:47:55 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=Ry7nhQiq71fqJW0Nx3+t7ZqoUCjrgq6c1KhHLZlBI2U=; b=V7vCGidnd+AE31YzE1LWTiXdXll55iLf2AwnUTUaPtTK+jVWcp4IE2kl01FssEDiqa BlIzCtcl5Sy0OBbPd/2Y0kcu3DpqBMZMvAATODudTzA4n0xZsVSF7COr/nU7x/LFmUzX PLxjmJLMiZ0kAdDZAxc4H271wtlIODgOm95SXwLkGfvbBrutF5c9blXlQJPOVmKifkFA qcd6AYFwwaOpf+f8pf3Op2UyYfWZIho7tpl3OTJFAVIbcmTPvz9/HLuMjBF4R8YUjQfg I/gDa8CUpGt/Eh6GfdVmQjeDmkakeMPJB7KmfV/78+P9slWYhMGSi2KOCWToB0nZJd0d BI3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=Ry7nhQiq71fqJW0Nx3+t7ZqoUCjrgq6c1KhHLZlBI2U=; b=qjUJQXgN1mFI8lDuFiZpAfaalwuye7Xto643OxDJ2uQN24KqraV++3QKwDBU015fcq NczYrzypQx+I13wV10ebRDfDJj7Lo8oo4d90++BANf2ISZBrIJ5Y6UJfLUb6vSC68Qlr hZEGQc7mpEq3Cd+jbQxIj7GiyNP0bZaGNdKfK35LDMDsYeVTyINcF6wu1hPx95Zs5l/m tnIFHDV3LBY3QKtK5fo24odvLfh8DAyxHt6o/H31Ll+7v/+8A4Ca9HyZOEi8Uf+0jH2n Gb37ap2319w7LizkQvRHs0FP7Q3eOa7jyOP+YPGJPICVBH2XMr5CyZf//Xa45S0hc+2v yL8g== X-Gm-Message-State: AElRT7GjiYBbi6/M9gBBwdPL8UUO2UpySeVm1pTlrQ55f+pXOgZgCTMD ikNa9mPH9BxoHDJFrzz3w+BpeP9S X-Google-Smtp-Source: AG47ELsLsy+22G37QcCLbkcGj8Sw+m4eC93QrdJ/VEIJk4GWB59SrswdHaKTYG0MsofIw2sYDMRsKg== X-Received: by 10.28.144.5 with SMTP id s5mr2083297wmd.98.1520981273963; Tue, 13 Mar 2018 15:47:53 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:36 +0100 Message-Id: <20180313224719.4954-27-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 26/69] membarrier: add --enable-membarrier 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Actually enable the global memory barriers if supported by the OS. Because only recent versions of Linux include the support, they are disabled by default. Note that it also has to be disabled for QEMU to run under Wine. Before this patch, rcutorture reports 85 ns/read for my machine, after the patch it reports 12.5 ns/read. On the other hand updates go from 50 *micro*seconds to 20 *milli*seconds. Signed-off-by: Paolo Bonzini --- configure | 42 +++++++++++++++++++++++++++++++++++- include/qemu/sys_membarrier.h | 10 +++++++++ util/Makefile.objs | 1 + util/sys_membarrier.c | 50 +++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 util/sys_membarrier.c diff --git a/configure b/configure index 26d56eb5bb..db87fc4fed 100755 --- a/configure +++ b/configure @@ -342,7 +342,7 @@ attr=3D"" libattr=3D"" xfs=3D"" tcg=3D"yes" - +membarrier=3D"" vhost_net=3D"no" vhost_crypto=3D"no" vhost_scsi=3D"no" @@ -1161,6 +1161,10 @@ for opt do ;; --enable-attr) attr=3D"yes" ;; + --disable-membarrier) membarrier=3D"no" + ;; + --enable-membarrier) membarrier=3D"yes" + ;; --disable-blobs) blobs=3D"no" ;; --with-pkgversion=3D*) pkgversion=3D"$optarg" @@ -1577,6 +1581,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: xen-pci-passthrough brlapi BrlAPI (Braile) curl curl connectivity + membarrier membarrier system call (for Linux 4.14+ or Windows) fdt fdt device tree bluez bluez stack connectivity kvm KVM acceleration support @@ -5137,6 +5142,37 @@ if compile_prog "" "" ; then have_fsxattr=3Dyes fi =20 +########################################## +# check for usable membarrier system call +if test "$membarrier" =3D "yes"; then + have_membarrier=3Dno + if test "$mingw32" =3D "yes" ; then + have_membarrier=3Dyes + elif test "$linux" =3D "yes" ; then + cat > $TMPC << EOF + #include + #include + #include + #include + int main(void) { + syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0); + syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0); + exit(0); + } +EOF + if compile_prog "" "" ; then + have_membarrier=3Dyes + fi + fi + if test "$have_membarrier" =3D "no"; then + feature_not_found "membarrier" "membarrier system call not available" + fi +else + # Do not enable it by default even for Mingw32, because it doesn't + # work on Wine. + membarrier=3Dno +fi + ########################################## # check if rtnetlink.h exists and is useful have_rtnetlink=3Dno @@ -5763,6 +5799,7 @@ fi echo "malloc trim support $malloc_trim" echo "RDMA support $rdma" echo "fdt support $fdt" +echo "membarrier $membarrier" echo "preadv support $preadv" echo "fdatasync $fdatasync" echo "madvise $madvise" @@ -6245,6 +6282,9 @@ fi if test "$fdt" =3D "yes" ; then echo "CONFIG_FDT=3Dy" >> $config_host_mak fi +if test "$membarrier" =3D "yes" ; then + echo "CONFIG_MEMBARRIER=3Dy" >> $config_host_mak +fi if test "$signalfd" =3D "yes" ; then echo "CONFIG_SIGNALFD=3Dy" >> $config_host_mak fi diff --git a/include/qemu/sys_membarrier.h b/include/qemu/sys_membarrier.h index 9ce7f5210b..316e3dc4a2 100644 --- a/include/qemu/sys_membarrier.h +++ b/include/qemu/sys_membarrier.h @@ -9,9 +9,19 @@ #ifndef QEMU_SYS_MEMBARRIER_H #define QEMU_SYS_MEMBARRIER_H 1 =20 +#ifdef CONFIG_MEMBARRIER +/* Only block reordering at the compiler level in the performance-critical + * side. The slow side forces processor-level ordering on all other cores + * through a system call. + */ +extern void smp_mb_global_init(void); +extern void smp_mb_global(void); +#define smp_mb_placeholder() barrier() +#else /* Keep it simple, execute a real memory barrier on both sides. */ static inline void smp_mb_global_init(void) {} #define smp_mb_global() smp_mb() #define smp_mb_placeholder() smp_mb() +#endif =20 #endif diff --git a/util/Makefile.objs b/util/Makefile.objs index ae90b9963d..728c3541db 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -33,6 +33,7 @@ util-obj-y +=3D throttle.o util-obj-y +=3D getauxval.o util-obj-y +=3D readline.o util-obj-y +=3D rcu.o +util-obj-$(CONFIG_MEMBARRIER) +=3D sys_membarrier.o util-obj-y +=3D qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o util-obj-y +=3D qemu-coroutine-sleep.o util-obj-y +=3D coroutine-$(CONFIG_COROUTINE_BACKEND).o diff --git a/util/sys_membarrier.c b/util/sys_membarrier.c new file mode 100644 index 0000000000..8dcb53e63e --- /dev/null +++ b/util/sys_membarrier.c @@ -0,0 +1,50 @@ +/* + * Process-global memory barriers + * + * Copyright (c) 2018 Red Hat, Inc. + * + * Author: Paolo Bonzini + */ + +#include +#include +#include + +#ifdef CONFIG_LINUX +#include +#include + +static int +membarrier(int cmd, int flags) +{ + return syscall(__NR_membarrier, cmd, flags); +} +#endif + +void smp_mb_global(void) +{ +#if defined CONFIG_WIN32 + FlushProcessWriteBuffers(); +#elif defined CONFIG_LINUX + membarrier(MEMBARRIER_CMD_SHARED, 0); +#else +#error --enable-membarrier is not supported on this operating system. +#endif +} + +void smp_mb_global_init(void) +{ +#ifdef CONFIG_LINUX + int ret =3D membarrier(MEMBARRIER_CMD_QUERY, 0); + if (ret < 0) { + error_report("This QEMU binary requires the membarrier system call= ."); + error_report("Please upgrade your system to a newer version of Lin= ux"); + exit(1); + } + if (!(ret & MEMBARRIER_CMD_SHARED)) { + error_report("This QEMU binary requires MEMBARRIER_CMD_SHARED supp= ort."); + error_report("Please upgrade your system to a newer version of Lin= ux"); + exit(1); + } +#endif +} --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098243482938.1213616378202; Tue, 13 Mar 2018 16:07:14 -0700 (PDT) Received: from localhost ([::1]:43382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt0j-0004wS-Lo for importer@patchew.org; Tue, 13 Mar 2018 19:07:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi8-0005p7-Hw for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi5-0003PE-CL for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:00 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:52189) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi5-0003OA-23 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:57 -0400 Received: by mail-wm0-x243.google.com with SMTP id h21so868784wmd.1 for ; Tue, 13 Mar 2018 15:47:56 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pBLLDz4HGHPjoXu2yiDXrQIGcElJQ1rSZfmAWadfKRE=; b=gXpIYhyEFswF1vGi45nTFqh1UNolStC3jX+iXTO5iKpYTsazxD9vCXCel54lLdbYOZ v5G+EOzvhc7k+IeKXxPm54XPUygrEyAbT+feLl58WjLMDeXuzMMZ31X5d/t47AgjH/wE gZA6EQAJVgR7ioX/9TVS2eZsnKEh1q1kLL754L/sMBW6iL7dJLK2sIlkqLgUq6fShC+e 6SyWgzsig4l0mRU8VSrJY2ANgIURBRzSE0sw8oXb+gSOVhGv6wCAqt5Sm1NzclBN32to 4pN5/73zWBRigPWi8l9ziCRbAxk929Ahg16GvsjR2l3TekUUGdRymmy/MiZcznYDj01h M6qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pBLLDz4HGHPjoXu2yiDXrQIGcElJQ1rSZfmAWadfKRE=; b=GzwpRCHNn55tW6s/NDqI1NzjytP+jSdCA5uVEc2q9HvYB6JQrHLvkIA6qFvmc62g7z ozncwzzP4xoVi+3AB4L9mdUuq/ZDAtmtYdkGQ/zoUuZdRqSOWhDsxul6HdSp3nl3Yccs SG/eVamEOGENSDwt+WlNKxIYTz0OEd1kpvnG7uQUA/EkdqPTZ7dtvq9nZF0yp9DT/utg bopzToC7twk1eOpaC4ZYEsWI/7sVKACZGUy1B/sxUuLh1TeQ+RMQOajMad+/cvXa802p Yz/tJ7gdwFqb/mEimE1fBuzBEXRI7YRusgwM66h5ejincsJdtpNopa7XsvFFYF/w0idi 6jyQ== X-Gm-Message-State: AElRT7HmiehEpwSynw9Nyafh/pKsntTyWl7wOumvy5ipkSTlNOCoVbZh 0VfWg2xGI2PRgWZhrMVHlCxJFwTo X-Google-Smtp-Source: AG47ELsVqAhnBC30K65Ha0eXf5yJhb5/S7mquB6c5+1XNgwF1xwL3nBc6yQ0tGFem9jTT67/1vJN2Q== X-Received: by 10.28.93.82 with SMTP id r79mr1955160wmb.73.1520981275506; Tue, 13 Mar 2018 15:47:55 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:37 +0100 Message-Id: <20180313224719.4954-28-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 27/69] hw/isa: Move parallel_hds_isa_init() to hw/char/parallel-isa.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Again... (after 07dc788054d7 and 9157eee1b1c0). We now extract the ISA bus specific helpers. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-2-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- MAINTAINERS | 3 ++- hw/char/Makefile.objs | 1 + hw/char/parallel-isa.c | 36 ++++++++++++++++++++++++++++++++++++ hw/char/parallel.c | 2 +- hw/i386/pc.c | 1 + hw/isa/isa-bus.c | 26 -------------------------- hw/mips/mips_fulong2e.c | 1 + hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 1 + hw/sparc64/sun4u.c | 1 + include/hw/char/parallel.h | 14 ++++++++++++++ include/hw/i386/pc.h | 8 -------- 12 files changed, 59 insertions(+), 36 deletions(-) create mode 100644 hw/char/parallel-isa.c create mode 100644 include/hw/char/parallel.h diff --git a/MAINTAINERS b/MAINTAINERS index 354a18ce49..02ac81432f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -924,7 +924,7 @@ M: Michael S. Tsirkin M: Paolo Bonzini S: Supported F: hw/char/debugcon.c -F: hw/char/parallel.c +F: hw/char/parallel* F: hw/char/serial* F: hw/dma/i8257* F: hw/i2c/pm_smbus.c @@ -939,6 +939,7 @@ F: hw/timer/i8254* F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: include/hw/display/vga.h +F: include/hw/char/parallel.h F: include/hw/i2c/pm_smbus.h F: include/hw/isa/i8257.h F: include/hw/timer/hpet.h diff --git a/hw/char/Makefile.objs b/hw/char/Makefile.objs index 1bcd37e98d..1b979100b7 100644 --- a/hw/char/Makefile.objs +++ b/hw/char/Makefile.objs @@ -1,6 +1,7 @@ common-obj-$(CONFIG_IPACK) +=3D ipoctal232.o common-obj-$(CONFIG_ESCC) +=3D escc.o common-obj-$(CONFIG_PARALLEL) +=3D parallel.o +common-obj-$(CONFIG_PARALLEL) +=3D parallel-isa.o common-obj-$(CONFIG_PL011) +=3D pl011.o common-obj-$(CONFIG_SERIAL) +=3D serial.o common-obj-$(CONFIG_SERIAL_ISA) +=3D serial-isa.o diff --git a/hw/char/parallel-isa.c b/hw/char/parallel-isa.c new file mode 100644 index 0000000000..639e179585 --- /dev/null +++ b/hw/char/parallel-isa.c @@ -0,0 +1,36 @@ +/* + * QEMU Parallel PORT (ISA bus helpers) + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" +#include "hw/char/parallel.h" + +static void parallel_init(ISABus *bus, int index, Chardev *chr) +{ + DeviceState *dev; + ISADevice *isadev; + + isadev =3D isa_create(bus, "isa-parallel"); + dev =3D DEVICE(isadev); + qdev_prop_set_uint32(dev, "index", index); + qdev_prop_set_chr(dev, "chardev", chr); + qdev_init_nofail(dev); +} + +void parallel_hds_isa_init(ISABus *bus, int n) +{ + int i; + + assert(n <=3D MAX_PARALLEL_PORTS); + + for (i =3D 0; i < n; i++) { + if (parallel_hds[i]) { + parallel_init(bus, i, parallel_hds[i]); + } + } +} diff --git a/hw/char/parallel.c b/hw/char/parallel.c index f79dc76543..1542d62201 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -28,7 +28,7 @@ #include "chardev/char-parallel.h" #include "chardev/char-fe.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" +#include "hw/char/parallel.h" #include "sysemu/sysemu.h" =20 //#define DEBUG_PARALLEL diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 0c140f4dc7..8fa51d8eba 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -26,6 +26,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/i386/apic.h" #include "hw/i386/topology.h" #include "sysemu/cpus.h" diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 0f2e426d02..63fa77effc 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -24,7 +24,6 @@ #include "hw/sysbus.h" #include "sysemu/sysemu.h" #include "hw/isa/isa.h" -#include "hw/i386/pc.h" =20 static ISABus *isabus; =20 @@ -288,28 +287,3 @@ MemoryRegion *isa_address_space_io(ISADevice *dev) } =20 type_init(isabus_register_types) - -static void parallel_init(ISABus *bus, int index, Chardev *chr) -{ - DeviceState *dev; - ISADevice *isadev; - - isadev =3D isa_create(bus, "isa-parallel"); - dev =3D DEVICE(isadev); - qdev_prop_set_uint32(dev, "index", index); - qdev_prop_set_chr(dev, "chardev", chr); - qdev_init_nofail(dev); -} - -void parallel_hds_isa_init(ISABus *bus, int n) -{ - int i; - - assert(n <=3D MAX_PARALLEL_PORTS); - - for (i =3D 0; i < n; i++) { - if (parallel_hds[i]) { - parallel_init(bus, i, parallel_hds[i]); - } - } -} diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index be4f83973d..a8e8c23733 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,6 +23,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index e135385265..c87a122ddf 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -28,6 +28,7 @@ #include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "sysemu/sysemu.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 6f0deb99e7..c74882c7e9 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -28,6 +28,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index da28ab9413..ceb1ba7eaf 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -34,6 +34,7 @@ #include "hw/pci-host/sabre.h" #include "hw/i386/pc.h" #include "hw/char/serial.h" +#include "hw/char/parallel.h" #include "hw/timer/m48t59.h" #include "hw/block/fdc.h" #include "net/net.h" diff --git a/include/hw/char/parallel.h b/include/hw/char/parallel.h new file mode 100644 index 0000000000..d6dd62fb9f --- /dev/null +++ b/include/hw/char/parallel.h @@ -0,0 +1,14 @@ +#ifndef HW_PARALLEL_H +#define HW_PARALLEL_H + +#include "exec/memory.h" +#include "hw/isa/isa.h" +#include "chardev/char.h" + +void parallel_hds_isa_init(ISABus *bus, int n); + +bool parallel_mm_init(MemoryRegion *address_space, + hwaddr base, int it_shift, qemu_irq irq, + Chardev *chr); + +#endif diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e81654eb7f..962ee7de0c 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -152,14 +152,6 @@ struct PCMachineClass { #define PC_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) =20 -/* parallel.c */ - -void parallel_hds_isa_init(ISABus *bus, int n); - -bool parallel_mm_init(MemoryRegion *address_space, - hwaddr base, int it_shift, qemu_irq irq, - Chardev *chr); - /* i8259.c */ =20 extern DeviceState *isa_pic; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982674192252.14074271547167; Tue, 13 Mar 2018 16:11:14 -0700 (PDT) Received: from localhost ([::1]:43407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt4b-0008QP-A9 for importer@patchew.org; Tue, 13 Mar 2018 19:11:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58130) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsi8-0005p8-It for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi6-0003Qt-Dg for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:00 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi6-0003Pe-4O for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:58 -0400 Received: by mail-wm0-x241.google.com with SMTP id x7so878106wmc.0 for ; Tue, 13 Mar 2018 15:47:57 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=az8I/f8vyKt324wBJCayoTUky/M1VToseC7iTJiQ2LM=; b=j9Mc+dvM8JGZNAnADG1qtLs9WlhflQJTiTB6ReOAXhLt856ID4K26R1QuKw+nM9EO4 qBSjeO1RtXdU6D2QFbTKQYgCfsNH4rjVPFGl8dqd9S5W3vKz6MNyzpPRIXqiqaH2SSH4 ie31zXJysNEjSKEqloWWNOwhkZyQ4f/3jdR/ETNkEohdfZXIytW7mfXUyx1g7J3jMTyG kvrdz5nMoZRwRxiKjJiW7LvlLNuhYxBiAG0tJlENAiAv6n1mCBfKyVRUHyOoLFSFGXXX C+coGlKCAuc5SrcoUpqQe1aMPxl9a/r0pSkk9heZ2TRZA6iSMlqoudfZTxvYA6FOFwTI 3TxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=az8I/f8vyKt324wBJCayoTUky/M1VToseC7iTJiQ2LM=; b=c3v9Oh/tK4XNRgcxtkBhW7JO79d0KLF1nMEK2NUimP0p2FIVNuNSFn36LeP2Lc8VWM 5cG32OdONJTLRtDrJT+gpy5NKk6raz0j3zs24SLHAbD/w16zyFbSJHraBkkMUh3wleWU K+v19UQTBUH8mGKOfA4klrmzkWUWWt6SJalLtRkpVZ6C6p5nUtH5sh9j60GUB7hfUnyB lOaHw/c356K16S7/JogGRYAbKrgPfJ23J8OMPoFl2jKM0IK4mgv8FJ2PJXDwXi3GjYAB n1iDl/DnNQ7r1Smihzio6KiAWIFjK7IiBA6QKLMhW+e4HUrBBqbSb8LqW92s3rYrMmC5 IBQg== X-Gm-Message-State: AElRT7EJYplGwL8Fa/kKxxUurzzdykJcXWM2OrbUrTz0wN/GnAT+VtVI C4unFTWJyYZIIt0hOyOJL8og+FHJ X-Google-Smtp-Source: AG47ELvj0rE4qsoFbGL8Od9pRWW9FH/2jfnCKfYpH2WNveW6QfGW7yryTeh1jrBcOdBBSPq/xR99wg== X-Received: by 10.28.178.81 with SMTP id b78mr2183574wmf.78.1520981276620; Tue, 13 Mar 2018 15:47:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:38 +0100 Message-Id: <20180313224719.4954-29-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 28/69] hw/dma/i8257: Rename DMA_init() to i8257_dma_init() 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 - Move the header from hw/isa/ to hw/dma/ - Remove the old i386/pc dependency - use a bool type for the high_page_enable argument Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-3-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 +- hw/dma/i82374.c | 3 ++- hw/dma/i8257.c | 4 ++-- hw/i386/pc.c | 3 ++- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 3 ++- hw/mips/mips_malta.c | 3 ++- hw/sparc/sun4m.c | 4 ---- hw/sparc64/sun4u.c | 4 ---- include/hw/{isa =3D> dma}/i8257.h | 6 ++++++ include/hw/isa/isa.h | 2 -- 11 files changed, 19 insertions(+), 18 deletions(-) rename include/hw/{isa =3D> dma}/i8257.h (86%) diff --git a/MAINTAINERS b/MAINTAINERS index 02ac81432f..319ac9f929 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -940,8 +940,8 @@ F: hw/timer/mc146818rtc* F: hw/watchdog/wdt_ib700.c F: include/hw/display/vga.h F: include/hw/char/parallel.h +F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h -F: include/hw/isa/i8257.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* diff --git a/hw/dma/i82374.c b/hw/dma/i82374.c index 6c0f975df0..83c87d92e0 100644 --- a/hw/dma/i82374.c +++ b/hw/dma/i82374.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "hw/isa/isa.h" +#include "hw/dma/i8257.h" =20 #define TYPE_I82374 "i82374" #define I82374(obj) OBJECT_CHECK(I82374State, (obj), TYPE_I82374) @@ -123,7 +124,7 @@ static void i82374_realize(DeviceState *dev, Error **er= rp) portio_list_add(&s->port_list, isa_address_space_io(&s->parent_obj), s->iobase); =20 - DMA_init(isa_bus_from_device(ISA_DEVICE(dev)), 1); + i8257_dma_init(isa_bus_from_device(ISA_DEVICE(dev)), true); memset(s->commands, 0, sizeof(s->commands)); } =20 diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index bd23e893bf..52675e97c9 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -24,7 +24,7 @@ #include "qemu/osdep.h" #include "hw/hw.h" #include "hw/isa/isa.h" -#include "hw/isa/i8257.h" +#include "hw/dma/i8257.h" #include "qemu/main-loop.h" #include "trace.h" =20 @@ -622,7 +622,7 @@ static void i8257_register_types(void) =20 type_init(i8257_register_types) =20 -void DMA_init(ISABus *bus, int high_page_enable) +void i8257_dma_init(ISABus *bus, bool high_page_enable) { ISADevice *isa1, *isa2; DeviceState *d; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 8fa51d8eba..a6ceea9c64 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -41,6 +41,7 @@ #include "elf.h" #include "multiboot.h" #include "hw/timer/mc146818rtc.h" +#include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" @@ -1607,7 +1608,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *= gsi, port92_init(port92, a20_line[1]); g_free(a20_line); =20 - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); =20 for(i =3D 0; i < MAX_FD; i++) { fd[i] =3D drive_get(IF_FLOPPY, 0, i); diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index a8e8c23733..1e43768589 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -22,6 +22,7 @@ #include "qapi/error.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h" @@ -359,7 +360,7 @@ static void mips_fulong2e_init(MachineState *machine) =20 /* init other devices */ pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); =20 /* Super I/O */ isa_create_simple(isa_bus, "i8042"); diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index c87a122ddf..8b6f03a889 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -27,6 +27,7 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/isa/isa.h" @@ -220,7 +221,7 @@ static void mips_jazz_init(MachineState *machine, /* ISA devices */ i8259 =3D i8259_init(isa_bus, env->irq[4]); isa_bus_irqs(isa_bus, i8259); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); pcspk_init(isa_bus, pit); =20 diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index c74882c7e9..9cb86c432e 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -27,6 +27,7 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/block/fdc.h" @@ -1209,7 +1210,7 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); - DMA_init(isa_bus, 0); + i8257_dma_init(isa_bus, 0); =20 /* Super I/O */ isa_create_simple(isa_bus, "i8042"); diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c index 2b8af2c884..6471aca25d 100644 --- a/hw/sparc/sun4m.c +++ b/hw/sparc/sun4m.c @@ -98,10 +98,6 @@ struct sun4m_hwdef { uint8_t nvram_machine_id; }; =20 -void DMA_init(ISABus *bus, int high_page_enable) -{ -} - static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index ceb1ba7eaf..0ca0243821 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -90,10 +90,6 @@ typedef struct EbusState { #define TYPE_EBUS "ebus" #define EBUS(obj) OBJECT_CHECK(EbusState, (obj), TYPE_EBUS) =20 -void DMA_init(ISABus *bus, int high_page_enable) -{ -} - static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { diff --git a/include/hw/isa/i8257.h b/include/hw/dma/i8257.h similarity index 86% rename from include/hw/isa/i8257.h rename to include/hw/dma/i8257.h index 88a2766a3f..2cab50bb6c 100644 --- a/include/hw/isa/i8257.h +++ b/include/hw/dma/i8257.h @@ -1,6 +1,10 @@ #ifndef HW_I8257_H #define HW_I8257_H =20 +#include "hw/hw.h" +#include "hw/isa/isa.h" +#include "exec/ioport.h" + #define TYPE_I8257 "i8257" =20 typedef struct I8257Regs { @@ -40,4 +44,6 @@ typedef struct I8257State { PortioList portio_pageh; } I8257State; =20 +void i8257_dma_init(ISABus *bus, bool high_page_enable); + #endif diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 95593408ef..b9dbab24b4 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -151,6 +151,4 @@ static inline ISABus *isa_bus_from_device(ISADevice *d) return ISA_BUS(qdev_get_parent_bus(DEVICE(d))); } =20 -/* i8257.c */ -void DMA_init(ISABus *bus, int high_page_enable); #endif --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209823860961016.9560426303705; Tue, 13 Mar 2018 16:06:26 -0700 (PDT) Received: from localhost ([::1]:43379 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evszv-0004Ev-3N for importer@patchew.org; Tue, 13 Mar 2018 19:06:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58160) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiA-0005qg-6s for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi7-0003Sq-TP for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:52188) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi7-0003Ra-Is for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:59 -0400 Received: by mail-wm0-x241.google.com with SMTP id h21so868925wmd.1 for ; Tue, 13 Mar 2018 15:47:59 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TpGdl/8fioNZpryHU6rUWzhhzG6Uf0xl1XKiPtsdhBU=; b=Ycx6SiTgI6Nw1NdBOnZSZI3wG/TrT9fHnrSUkLnIJmMwspipbVU+1u0JqQorKM/WTk +o/6vH9jwvQn6GODgq8TANR1VJfbgaMb4lEEd/Dnap+A9m1/k0tP/eDZhKx+a2aqJoOC Tp2zxrqTbk4CT8caBcwbE+XvMMRhez06gXv1A3guLGJCBWWY4yFNvjm7WCBkymldfUqR ItYRaUAKepRAnFE7DIoOmwRcngWvG10zR85LGTRtH3KWujdQrSJ/N3FSjwKk0DB/+ymb hIVeYdGsc04A+fhuiA2lUVgiJP5HTbfU601Hlvlu3iAcnibBwjut+C8ObvxpzI3kUgbB lprQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TpGdl/8fioNZpryHU6rUWzhhzG6Uf0xl1XKiPtsdhBU=; b=b+jVwNCTbdPG2OhNTOsUiEr5/SqIgNPGMEJDTkWNjMY8wBmS1+DPGRRMo9ZpSW4o+F q4OEYDD+F5W8XJPx3YRY8nyGWIIu7GHfw0qujWZsDPho0MWAIZdKYSmFmx7ZmbY5jrvF xIv+shZkLO7HnYwjmbW+B33COgP16GhFTVtURDDfFT+CoEiDmMwNRH+XIMKg9QDIMPw7 HHRqkHJ93rxWbSQ9EvkhyBYB/tS1RIPKQHQ5Pb28mQXoxQKOcXoqN0UqbVmR1KDL5d0b H+8NtKLQ86Qfx/MrF8yPm9g3HuFzuzEMzt3NnBttjWYpmmSmtj695z/JldGU75+KIjZf Uz4Q== X-Gm-Message-State: AElRT7FvPvRv6PMtVf7vCrTHxlW1FIzBDSw/rLM6QrDDD7PrPV3LQM+y PJ5qwSJgo4HhHV0M5a9vCmFNFXEN X-Google-Smtp-Source: AG47ELvMbVEHyskFzrNkmoMYsb6J9JB1gxwTKnEx3rLVXuu96h3M7ad1QtSIzu/0vXAnA8UOAqsQEA== X-Received: by 10.28.237.19 with SMTP id l19mr1964791wmh.157.1520981278055; Tue, 13 Mar 2018 15:47:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:39 +0100 Message-Id: <20180313224719.4954-30-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 29/69] hw/input/i8042: Extract declarations from i386/pc.h into input/i8042.h 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson (hw/ppc) Message-Id: <20180308223946.26784-4-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + hw/alpha/dp264.c | 3 ++- hw/i386/pc.c | 1 + hw/i386/vmmouse.c | 1 + hw/i386/vmport.c | 1 + hw/input/pckbd.c | 2 +- hw/mips/mips_fulong2e.c | 3 ++- hw/mips/mips_jazz.c | 1 + hw/mips/mips_malta.c | 3 ++- hw/mips/mips_r4k.c | 3 ++- hw/ppc/prep.c | 5 +++-- hw/sparc64/sun4u.c | 1 + hw/unicore32/puv3.c | 1 + include/hw/i386/pc.h | 9 --------- include/hw/input/i8042.h | 24 ++++++++++++++++++++++++ 15 files changed, 43 insertions(+), 16 deletions(-) create mode 100644 include/hw/input/i8042.h diff --git a/MAINTAINERS b/MAINTAINERS index 319ac9f929..6703ac8c89 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -942,6 +942,7 @@ F: include/hw/display/vga.h F: include/hw/char/parallel.h F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h +F: include/hw/input/i8042.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 766373eec7..e13cb576fd 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -19,6 +19,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "qemu/cutils.h" =20 @@ -81,7 +82,7 @@ static void clipper_init(MachineState *machine) mc146818_rtc_init(isa_bus, 1900, rtc_irq); =20 i8254_pit_init(isa_bus, 0x40, 0, NULL); - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); =20 /* VGA setup. Don't bother loading the bios. */ pci_vga_init(pci_bus); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a6ceea9c64..853a01d791 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -43,6 +43,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "hw/audio/pcspk.h" #include "hw/pci/msi.h" #include "hw/sysbus.h" diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index 65ef55329e..5d2d278be4 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -25,6 +25,7 @@ #include "hw/hw.h" #include "ui/console.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "hw/qdev.h" =20 /* debug only vmmouse */ diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c index 116aa09819..3bf8cfe041 100644 --- a/hw/i386/vmport.c +++ b/hw/i386/vmport.c @@ -25,6 +25,7 @@ #include "hw/hw.h" #include "hw/isa/isa.h" #include "hw/i386/pc.h" +#include "hw/input/i8042.h" #include "sysemu/hw_accel.h" #include "hw/qdev.h" #include "qemu/log.h" diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index c479f827b6..f17f18e51b 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -26,6 +26,7 @@ #include "hw/isa/isa.h" #include "hw/i386/pc.h" #include "hw/input/ps2.h" +#include "hw/input/i8042.h" #include "sysemu/sysemu.h" =20 /* debug PC keyboard */ @@ -480,7 +481,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, qemu_register_reset(kbd_reset, s); } =20 -#define TYPE_I8042 "i8042" #define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042) =20 typedef struct ISAKBDState { diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 1e43768589..a15d3b60cc 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -43,6 +43,7 @@ #include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" +#include "hw/input/i8042.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" @@ -363,7 +364,7 @@ static void mips_fulong2e_init(MachineState *machine) i8257_dma_init(isa_bus, 0); =20 /* Super I/O */ - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); =20 mc146818_rtc_init(isa_bus, 2000, NULL); =20 diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index 8b6f03a889..7223085547 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -43,6 +43,7 @@ #include "hw/timer/i8254.h" #include "hw/display/vga.h" #include "hw/audio/pcspk.h" +#include "hw/input/i8042.h" #include "hw/sysbus.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9cb86c432e..cd7bd0eef6 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -47,6 +47,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" @@ -1213,7 +1214,7 @@ void mips_malta_init(MachineState *machine) i8257_dma_init(isa_bus, 0); =20 /* Super I/O */ - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); =20 mc146818_rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 0, 2); diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 830ee7732c..aeadc4a340 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -28,6 +28,7 @@ #include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/block-backend.h" #include "exec/address-spaces.h" @@ -286,7 +287,7 @@ void mips_r4k_init(MachineState *machine) hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); =20 - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); } =20 static void mips_machine_init(MachineClass *mc) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index c9d8950de7..85b4fae3c7 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -41,6 +41,7 @@ #include "hw/ide.h" #include "hw/loader.h" #include "hw/timer/mc146818rtc.h" +#include "hw/input/i8042.h" #include "hw/isa/pc87312.h" #include "hw/net/ne2000-isa.h" #include "sysemu/arch_init.h" @@ -640,7 +641,7 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); =20 cpu =3D POWERPC_CPU(first_cpu); sysctrl->reset_irq =3D cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; @@ -770,7 +771,7 @@ static void ibm_40p_init(MachineState *machine) =20 /* add some more devices */ if (defaults_enabled()) { - isa_create_simple(isa_bus, "i8042"); + isa_create_simple(isa_bus, TYPE_I8042); m48t59 =3D NVRAM(isa_create_simple(isa_bus, "isa-m48t59")); =20 dev =3D DEVICE(isa_create(isa_bus, "cs4231a")); diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index 0ca0243821..2044a52ded 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -36,6 +36,7 @@ #include "hw/char/serial.h" #include "hw/char/parallel.h" #include "hw/timer/m48t59.h" +#include "hw/input/i8042.h" #include "hw/block/fdc.h" #include "net/net.h" #include "qemu/timer.h" diff --git a/hw/unicore32/puv3.c b/hw/unicore32/puv3.c index db26959a1d..830fe3face 100644 --- a/hw/unicore32/puv3.c +++ b/hw/unicore32/puv3.c @@ -20,6 +20,7 @@ =20 #undef DEBUG_PUV3 #include "hw/unicore32/puv3.h" +#include "hw/input/i8042.h" =20 #define KERNEL_LOAD_ADDR 0x03000000 #define KERNEL_MAX_SIZE 0x00800000 /* Just a guess */ diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 962ee7de0c..6598d571a0 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -189,15 +189,6 @@ void vmport_register(unsigned char command, VMPortRead= Func *func, void *opaque); void vmmouse_get_data(uint32_t *data); void vmmouse_set_data(const uint32_t *data); =20 -/* pckbd.c */ -#define I8042_A20_LINE "a20" - -void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, - MemoryRegion *region, ram_addr_t size, - hwaddr mask); -void i8042_isa_mouse_fake_event(void *opaque); -void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); - /* pc.c */ extern int fd_bootchk; =20 diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h new file mode 100644 index 0000000000..f6ff146364 --- /dev/null +++ b/include/hw/input/i8042.h @@ -0,0 +1,24 @@ +/* + * QEMU PS/2 Controller + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ +#ifndef HW_INPUT_I8042_H +#define HW_INPUT_I8042_H + +#include "hw/hw.h" +#include "hw/isa/isa.h" + +#define TYPE_I8042 "i8042" + +#define I8042_A20_LINE "a20" + +void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq, + MemoryRegion *region, ram_addr_t size, + hwaddr mask); +void i8042_isa_mouse_fake_event(void *opaque); +void i8042_setup_a20_line(ISADevice *dev, qemu_irq a20_out); + +#endif /* HW_INPUT_I8042_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983207727167.04509258598102; Tue, 13 Mar 2018 16:20:07 -0700 (PDT) Received: from localhost ([::1]:43420 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt7F-0002PP-Bf for importer@patchew.org; Tue, 13 Mar 2018 19:13:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiA-0005qS-19 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsi8-0003UK-Nz for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:42349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsi8-0003T1-GC for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:00 -0400 Received: by mail-wr0-x242.google.com with SMTP id s18so2506167wrg.9 for ; Tue, 13 Mar 2018 15:48:00 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U7e2tleM/sfNG/jglQ4TatxxqjA/RizsCPBexPx43Ds=; b=Fbz8yfsBbz1rNNL0/RiqRS3pqVHAWMjsfofhao4ffXeb+30o610FhakLMUuPrgmk3V rT+mm8L0swhlncmcJG2ErH4Z71vd1+xDGS0ewcQ9yrHFmhFdC0gUpA564QzgpKHDEt3T y0ln8sE+6bPytlZznrvDHf7R+NDh8UanrI5a411enFAdd+g55LpGpYJKpDQ1Ri9SmEZM 0h0W/5Q04SnUSQL6CZaRCElmerj0lMl+PVu/KEGMsS0cg1QUZ7sCnKMHwJMrzUrKroin yDVemsAxZJH87y8re+sEDnNTm2oUQTyk5EMkidiR9CLE8cQBIyRGbdVaxpKawU5hi4pN UaDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=U7e2tleM/sfNG/jglQ4TatxxqjA/RizsCPBexPx43Ds=; b=rYhXAHPijHGY53J195R0WXpa8QxUpYU9/+qVplx8C27snGOevwn8DrJmapvVPKFgqC jjpsdHmEDiiXaruXt6IMzDQYFZdolfMwOTGlSq1g75lqwaaJiB63xtvKauZI0idEtGcf M1VEhaElQl+KHIshWKvoTF1IhmZn3X28UxN69MaNygYLcGRARGJrgwjCdTNdPBYTHPPR mqUy5512St5MkrnYF/a52c+C1MyeUG8lm9DvbDS8KvIiQ13AMwpxEfEEVFJ+DcYtGaTf qF0/1bnkHl8tvT5nyThk9MT900l6fEBcRPaqQ7dW7aPC99Ass8sC9+fLV9l3iYa0PClI ZE6A== X-Gm-Message-State: AElRT7Ga4QoeSr9+TZrhHUSNcRShHqcORCUdcoJ4t8B+GbvXLYJVxmqv FpGQjq+EBML1VkaEMxE/puztNg1O X-Google-Smtp-Source: AG47ELshz6vH+JSgaruLK1bcjlovrVGuXjLnVTEDMkg4sA0U3rw8TcMlg6nHlDn5/xcBFK5zh7TD2w== X-Received: by 10.223.141.200 with SMTP id o66mr1899649wrb.39.1520981279123; Tue, 13 Mar 2018 15:47:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:40 +0100 Message-Id: <20180313224719.4954-31-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 30/69] MAINTAINERS: Fix the PC87312 include path 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Missed while moving it in 0d09e41a51aa. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-5-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6703ac8c89..1ff22ce610 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -776,9 +776,10 @@ F: hw/ppc/prep_systemio.c F: hw/ppc/rs6000_mc.c F: hw/pci-host/prep.[hc] F: hw/isa/i82378.c -F: hw/isa/pc87312.[hc] +F: hw/isa/pc87312.c F: hw/dma/i82374.c F: hw/timer/m48t59-isa.c +F: include/hw/isa/pc87312.h F: include/hw/timer/m48t59.h F: pc-bios/ppc_rom.bin =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209826016461021.6703357597225; Tue, 13 Mar 2018 16:10:01 -0700 (PDT) Received: from localhost ([::1]:43397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt3Q-0007LY-O3 for importer@patchew.org; Tue, 13 Mar 2018 19:10:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiB-0005sW-Oo for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiA-0003X4-LB for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:03 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:45855) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiA-0003VO-Dd for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:02 -0400 Received: by mail-wr0-x243.google.com with SMTP id h2so2479921wre.12 for ; Tue, 13 Mar 2018 15:48:02 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IJjZgkRNgV81BXU22Ub3AU0Ymd/Sp9WKafNXrv5tXZc=; b=qC55iPVbOhIJ8SIuyp2fhQReV8RoWV8xyXqdjMs6huJ1fYQ0AbG52gv/I227hasPOI +eqam5YNkDcrZUarltbWjW2FdHG7ioqfClBLpbykL3de6uMSefjrwFg6Dpfz1DaJC4gH szKzQJDVvuGhfMqVtH3WiprVKh0sMyRswGAs8Dm7TJ+oXoygAbyuiRiBXluOLSQzqvWn xBoVQG5UtcQs9BgHa/IPr7mlJ2IhdcH7x1txvEXt/ECNprHukd2QYDgiX6UL4dQFY9bo u6E6uJXE/Cb4zLXFJVtBXBDx2+QtqlJO3sEoE+96Am5xqyhr5gsqW32x6Dk1HgETAoyN yQHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IJjZgkRNgV81BXU22Ub3AU0Ymd/Sp9WKafNXrv5tXZc=; b=VqNq4DXfcUsCd6kM+nRlcEJPK2W4o1iDfGgn1Hl7Gp/amnss+9GNNkXyx8aoDmFRfQ 1qML2Evs6pab3imAPynSIbKnE7G67K8OdwC4Ch7JMc3uw7D3LKGeU6B2sRSCZmp4k1d2 p3AK1cVcz63Bo/Q21cY7IoxGkTYI0GvyM8KXX7XtfKUXRJ17iGwulLpj3m9vClI3RoIz CNMFBi9VVShxnvw+BRLgwMZ+q8q7TmIXdHXkIhVkj3JSH2UxGG8yEUk3w8H15cjeqDAC yoOnSS/NGF5fArin9eBTO6DnnetTokoPt18/XWxd6X+dgGLHRmxgbexLrjYcCCQPufuv 1iIA== X-Gm-Message-State: AElRT7Hr8Q2sxOS1PC/R60IjqMbKO2pPr5T+o6S3VZmehJyQhPIYvd/J cfN6CWV4i5IgYflvn52v+5rVYjKP X-Google-Smtp-Source: AG47ELsHJUjOw+zmt8H5qmvR6xHpO+Zq+T2NYOUydGslRMdeFpLUjpNUqTXHVPn/H14k0Y9zl2jRlg== X-Received: by 10.223.142.164 with SMTP id q33mr1950662wrb.72.1520981280606; Tue, 13 Mar 2018 15:48:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:41 +0100 Message-Id: <20180313224719.4954-32-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 31/69] hw/isa/pc87312: Rename the device type as TYPE_PC87312_SUPERIO 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson (hw/ppc) Message-Id: <20180308223946.26784-6-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- hw/isa/pc87312.c | 2 +- hw/ppc/prep.c | 2 +- include/hw/isa/pc87312.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 48b29e3c3c..e9edbc6c50 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -391,7 +391,7 @@ static void pc87312_class_init(ObjectClass *klass, void= *data) } =20 static const TypeInfo pc87312_type_info =3D { - .name =3D TYPE_PC87312, + .name =3D TYPE_PC87312_SUPERIO, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(PC87312State), .instance_init =3D pc87312_initfn, diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index 85b4fae3c7..df774bd384 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -612,7 +612,7 @@ static void ppc_prep_init(MachineState *machine) isa_bus =3D ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); =20 /* Super I/O (parallel + serial ports) */ - isa =3D isa_create(isa_bus, TYPE_PC87312); + isa =3D isa_create(isa_bus, TYPE_PC87312_SUPERIO); dev =3D DEVICE(isa); qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */ qdev_init_nofail(dev); diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index bf74470d40..710eb1c807 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -28,8 +28,8 @@ #include "hw/isa/isa.h" =20 =20 -#define TYPE_PC87312 "pc87312" -#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312) +#define TYPE_PC87312_SUPERIO "pc87312" +#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERI= O) =20 typedef struct PC87312State { ISADevice dev; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983008952928.6682230812638; Tue, 13 Mar 2018 16:16:48 -0700 (PDT) Received: from localhost ([::1]:43438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtA0-0003uV-4T for importer@patchew.org; Tue, 13 Mar 2018 19:16:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiC-0005t7-C7 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiB-0003Y2-A0 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:04 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45854) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiB-0003Wf-0x for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:03 -0400 Received: by mail-wr0-x241.google.com with SMTP id h2so2479952wre.12 for ; Tue, 13 Mar 2018 15:48:02 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qyc9MswLQ4sjH+Vti2P6DVcLBX4/bajQXSQ2fSyv/fY=; b=LxTE9cc/f4Kd7Ms/O3kGgxBJlmn37t7f+vg5KUfy+FIvRGm+sXK6p1DxvJmFcAArdO qP8ZZJ+FMIyzkxbFqpoNoQGJhTgS5rytC/Wyk704fmR9dDNRv61lBjP0vr/e/4MeHHbw AOUSO48wGbhe8eKeApOyQghL+Ela1AgCYOM8UbVRPxD+fw0jnh1MaEo0wjsR3+bCa9eQ krGF2Z+qFXMe4FNoEE6U6UljD4a2j6qvDiBeM9edsOJWm7rxLhzb0Xp1aPNFi9gSwj8E 4cV0+8+tu/CBYmlV3CtqTNvuPXu0jBaztMji5JYWqrQBa3SbyA9h7mBaPDQsHAJXyDj7 1wyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=qyc9MswLQ4sjH+Vti2P6DVcLBX4/bajQXSQ2fSyv/fY=; b=Z2Ah/zNT8c9TJlYRb/1HMip93KpgOktqps0sIZj33j42oRx3B9cqa6A1klAdO7VoL/ 4Ttp8sEHEp+5QWHjlUnG/rjP4o6xIvTU9JBWXoPxYewQt9jJa8J3JwCaNIbFi5tDkosG prX7/bb2No73D2ANbsPi7ZU/rsadV+uHjB9ycq+xhtkWw+uPoJNQ2W0eOKk3jbizNjxO ppUCFULipRfViYjef7LV/mpavjVwU4tw35+kzT6x4jH16+RCOi/GMT/an3K6I3VFTJ9W qb95BYH6MvnalBoo4E2LOa25BF+l86uKz0qn3XXoHjhqYoxs0v8eWUxFefJKCT9789zZ PO1w== X-Gm-Message-State: AElRT7FqMEW5D8i3wQZXDUNIF7jG/8bofeO0PBxmK9tZ8vAm465IwLhv 4RFcXyZhzO6gIEiHwe/NaALlXuNx X-Google-Smtp-Source: AG47ELtrEgpWORnUW0TnX3sJ+4U8UX46HCAogw2roH2snAT2XRYWU3AAzetubTNxkjljw7/KG0W8RQ== X-Received: by 10.223.195.116 with SMTP id e49mr1926320wrg.5.1520981281636; Tue, 13 Mar 2018 15:48:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:42 +0100 Message-Id: <20180313224719.4954-33-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 32/69] hw/isa/pc87312: Use uint16_t for the ISA I/O base address 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 This matches the isa_register_ioport() prototype. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-7-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/pc87312.c | 14 +++++++------- include/hw/isa/pc87312.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index e9edbc6c50..105c23e680 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -69,9 +69,9 @@ static inline bool is_parallel_enabled(PC87312State *s) return s->regs[REG_FER] & FER_PARALLEL_EN; } =20 -static const uint32_t parallel_base[] =3D { 0x378, 0x3bc, 0x278, 0x00 }; +static const uint16_t parallel_base[] =3D { 0x378, 0x3bc, 0x278, 0x00 }; =20 -static inline uint32_t get_parallel_iobase(PC87312State *s) +static inline uint16_t get_parallel_iobase(PC87312State *s) { return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } @@ -92,12 +92,12 @@ static inline uint32_t get_parallel_irq(PC87312State *s) =20 /* UARTs */ =20 -static const uint32_t uart_base[2][4] =3D { +static const uint16_t uart_base[2][4] =3D { { 0x3e8, 0x338, 0x2e8, 0x220 }, { 0x2e8, 0x238, 0x2e0, 0x228 } }; =20 -static inline uint32_t get_uart_iobase(PC87312State *s, int i) +static inline uint16_t get_uart_iobase(PC87312State *s, int i) { int idx; idx =3D (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; @@ -130,7 +130,7 @@ static inline bool is_fdc_enabled(PC87312State *s) return s->regs[REG_FER] & FER_FDC_EN; } =20 -static inline uint32_t get_fdc_iobase(PC87312State *s) +static inline uint16_t get_fdc_iobase(PC87312State *s) { return (s->regs[REG_FER] & FER_FDC_ADDR) ? 0x370 : 0x3f0; } @@ -143,7 +143,7 @@ static inline bool is_ide_enabled(PC87312State *s) return s->regs[REG_FER] & FER_IDE_EN; } =20 -static inline uint32_t get_ide_iobase(PC87312State *s) +static inline uint16_t get_ide_iobase(PC87312State *s) { return (s->regs[REG_FER] & FER_IDE_ADDR) ? 0x170 : 0x1f0; } @@ -373,7 +373,7 @@ static const VMStateDescription vmstate_pc87312 =3D { }; =20 static Property pc87312_properties[] =3D { - DEFINE_PROP_UINT32("iobase", PC87312State, iobase, 0x398), + DEFINE_PROP_UINT16("iobase", PC87312State, iobase, 0x398), DEFINE_PROP_UINT8("config", PC87312State, config, 1), DEFINE_PROP_END_OF_LIST() }; diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index 710eb1c807..b65b219a8a 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -34,7 +34,7 @@ typedef struct PC87312State { ISADevice dev; =20 - uint32_t iobase; + uint16_t iobase; uint8_t config; /* initial configuration */ =20 struct { --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983003383272.9447271552435; Tue, 13 Mar 2018 16:16:43 -0700 (PDT) Received: from localhost ([::1]:43437 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt9p-0003qD-8W for importer@patchew.org; Tue, 13 Mar 2018 19:16:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiD-0005uO-At for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiC-0003Zf-Bb for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:05 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:39407) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiC-0003YV-3S for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:04 -0400 Received: by mail-wm0-x244.google.com with SMTP id u10so668593wmu.4 for ; Tue, 13 Mar 2018 15:48:03 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dj7RvaH3EuGZ3K5WUvfULwP8FgbXyoulwV8gqD3TKyg=; b=ngBdndnLhl2/A9wgPvBLI87Flsi6mnGmzSFW12dl+Er+2vSvn7pcI43NqlxpvmpoPB eCtzSx6V3lRQwP5uwTyp5PmGw/yKY82D+nFmGy6r6fTGwRE6vx7yjXXQUld1hRHVfM4J F/aiZ8zk+FKKiapIOHf8SYcb2RwKvD6UfPJRhaKxOr3x1C5HYZTk7HuohKJApipqGnba PaqASG6QuaiBXLh+rl4zRSToqaJv5zZ8XDt3vxFwWdgq1AZyUIOMcMwG+9OTQ1sV1/6q 3RxdryuPEBC/KkrZC4NPhGuBEQ2BDvm0mM/0Mp5rcTmDZBkIR2XyK68gBljZH59P7Ufi OwKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dj7RvaH3EuGZ3K5WUvfULwP8FgbXyoulwV8gqD3TKyg=; b=Qn9CtNJooyYMWEq6JEl8PCdit083ZVloWa5PbDGZrOtJJHfPIUMwXJbbVre/XXag0l oPXRSwt7ZhRQPQPVLlcI993x7u5392byesm8ibQWmkHTPqBNQawe7ZS8xEbDclwOX30z eh9ownQ7a1CHvCUR6OR2fWLDRks/m0NXK1thQVF2fvOhfxF5bVEQZyFssE1G3PtyDzIG d3hPc/lUqqkIWNpsQ/32MeLYtkzJBzhg8jZPOvsNfuTWNMnkJEqQpLgJB7+5rvMGhYP7 pH8eochkioY29Oj6M/ewExGvZC8f+Wr0T78vIJ7vd2sIwjbTUQtTNYd0cPN7+vyqEO4T k/ow== X-Gm-Message-State: AElRT7E2RQhKcFZkvoFwmH4imHraZKMxOkVoAx1ZbMTPuNZgr5peit2t P2I6I6O/zDGGdxAW508AGsKqyEbe X-Google-Smtp-Source: AG47ELsDjWyHCHAmQ0ne7w2YTY9Npt3gpHL6Y8lLSTmkId0FP2q8Od/arrs1lRxeedV85baCy8HQqQ== X-Received: by 10.28.51.67 with SMTP id z64mr1965733wmz.59.1520981282700; Tue, 13 Mar 2018 15:48:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:43 +0100 Message-Id: <20180313224719.4954-34-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 33/69] hw/isa/pc87312: Use 'unsigned int' for the irq value 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-8-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Signed-off-by: Paolo Bonzini --- hw/isa/pc87312.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 105c23e680..fda91fed21 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -76,9 +76,9 @@ static inline uint16_t get_parallel_iobase(PC87312State *= s) return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } =20 -static const uint32_t parallel_irq[] =3D { 5, 7, 5, 0 }; +static const unsigned int parallel_irq[] =3D { 5, 7, 5, 0 }; =20 -static inline uint32_t get_parallel_irq(PC87312State *s) +static inline unsigned int get_parallel_irq(PC87312State *s) { int idx; idx =3D (s->regs[REG_FAR] & FAR_PARALLEL_ADDR); @@ -110,7 +110,7 @@ static inline uint16_t get_uart_iobase(PC87312State *s,= int i) } } =20 -static inline uint32_t get_uart_irq(PC87312State *s, int i) +static inline unsigned int get_uart_irq(PC87312State *s, int i) { int idx; idx =3D (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982769829920.4397330837294; Tue, 13 Mar 2018 16:12:49 -0700 (PDT) Received: from localhost ([::1]:43416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt68-0001PK-TG for importer@patchew.org; Tue, 13 Mar 2018 19:12:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiE-0005vf-Kc for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiD-0003bN-DS for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:06 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:39405) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiD-0003a4-5v for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:05 -0400 Received: by mail-wm0-x241.google.com with SMTP id u10so668643wmu.4 for ; Tue, 13 Mar 2018 15:48:05 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1iu5nR6twMNpMDcGXmTmrLwJzZ1DaDeciJmYloRZnLw=; b=PaoXMV1JfHNxlA+hX1JscMt+G2OLPjgXNjPuox4EMMELXAErlrSk2zPmiADsrlkIB2 Fi4nch6MuUJZpGkXjBnEMOJPElBODK01VvgpZ+Feomf5VWmmKMAzBEmErhzFLvDIQtHF WR69+5kxP5epyjEGLPMsKX30ns+0uAbXMzc48cbCRSCVHDbgXHtp6fPjKh9MWL+omQFS eq/3EQNOwHfbnpYSSYcMBGkSe0B4QZQkD+lLF17trWTWvvaB+pkTPbyMmWGz6NhqX6/g KjKwbbPgu42ITGEmLCU5trJtOtpx7AmQDdlbfpupx7YThdy5NNFEEhUnK7hg3G7aS89J xYhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1iu5nR6twMNpMDcGXmTmrLwJzZ1DaDeciJmYloRZnLw=; b=lGi/K9Oq8VT8EzQkVFu3s1zBcnKljmnjPmxEY3EL6SGLe+XR/eB0jLt6mfXj7IgNtd DAFqLvt42QxYT1tn7Ry8fWjb+F6VwTIXQ+pkLv3sHxG1R9jOGOhG/YjgIm8POQ2dPFDJ Br9DoclE5DH09Zn+wGZcb2Y779foA0brII5YFR2ds4cPp3z0aFQC4dKmi09r7CPA4URG VXqorhXCsriSJMqudbk2A2q2094zAerUH1zEd1CXTfE4ABKOcTAs5xlFyimp+jtUcnfj 2t0pjsv1iRyNSpf9lMXsy0adts9XeOAz3c+7pt6yc1ITOLPf6WUiymK/1M/12591yl9J Zakw== X-Gm-Message-State: AElRT7HxUkQoeyrQa0M0JXjQtfRbKnQnZ+yfW5CCtR9rycnDsxRRGO6U xpeO4XNYhUBxrrEZGkko7HTegFSx X-Google-Smtp-Source: AG47ELtxSw+YxkAMZcbyAZ0TVL0rjiPzRn3MXL76xz6prcdnX45wUuqniZvahd9m027gVRJRw6vTWw== X-Received: by 10.28.1.208 with SMTP id 199mr2126095wmb.26.1520981283732; Tue, 13 Mar 2018 15:48:03 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:44 +0100 Message-Id: <20180313224719.4954-35-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 34/69] hw/isa/superio: Add a Super I/O template based on the PC87312 device 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-9-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ hw/isa/Makefile.objs | 1 + hw/isa/isa-superio.c | 28 ++++++++++++++++++++++++++++ include/hw/isa/superio.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 hw/isa/isa-superio.c create mode 100644 include/hw/isa/superio.h diff --git a/MAINTAINERS b/MAINTAINERS index 1ff22ce610..9f7b8e79c4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -933,6 +933,7 @@ F: hw/input/pckbd.c F: hw/intc/apic* F: hw/intc/ioapic* F: hw/intc/i8259* +F: hw/isa/isa-superio.c F: hw/misc/debugexit.c F: hw/misc/pc-testdev.c F: hw/timer/hpet* @@ -944,6 +945,7 @@ F: include/hw/char/parallel.h F: include/hw/dma/i8257.h F: include/hw/i2c/pm_smbus.h F: include/hw/input/i8042.h +F: include/hw/isa/superio.h F: include/hw/timer/hpet.h F: include/hw/timer/i8254* F: include/hw/timer/mc146818rtc* diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs index fb37c55cf2..cac655ba58 100644 --- a/hw/isa/Makefile.objs +++ b/hw/isa/Makefile.objs @@ -1,4 +1,5 @@ common-obj-$(CONFIG_ISA_BUS) +=3D isa-bus.o +common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o common-obj-$(CONFIG_APM) +=3D apm.o common-obj-$(CONFIG_I82378) +=3D i82378.o common-obj-$(CONFIG_PC87312) +=3D pc87312.o diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c new file mode 100644 index 0000000000..14ec16f831 --- /dev/null +++ b/hw/isa/isa-superio.c @@ -0,0 +1,28 @@ +/* + * Generic ISA Super I/O + * + * Copyright (c) 2010-2012 Herve Poussineau + * Copyright (c) 2011-2012 Andreas F=C3=A4rber + * Copyright (c) 2018 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include "qemu/osdep.h" +#include "hw/isa/superio.h" +#include "trace.h" + +static const TypeInfo isa_superio_type_info =3D { + .name =3D TYPE_ISA_SUPERIO, + .parent =3D TYPE_ISA_DEVICE, + .abstract =3D true, + .class_size =3D sizeof(ISASuperIOClass), +}; + +static void isa_superio_register_types(void) +{ + type_register_static(&isa_superio_type_info); +} + +type_init(isa_superio_register_types) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h new file mode 100644 index 0000000000..cff6ad6c08 --- /dev/null +++ b/include/hw/isa/superio.h @@ -0,0 +1,44 @@ +/* + * Generic ISA Super I/O + * + * Copyright (c) 2018 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef HW_ISA_SUPERIO_H +#define HW_ISA_SUPERIO_H + +#include "qemu-common.h" +#include "sysemu/sysemu.h" +#include "hw/isa/isa.h" + +#define TYPE_ISA_SUPERIO "isa-superio" +#define ISA_SUPERIO(obj) \ + OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_GET_CLASS(obj) \ + OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO) +#define ISA_SUPERIO_CLASS(klass) \ + OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) + +typedef struct ISASuperIODevice { + ISADevice parent_obj; +} ISASuperIODevice; + +typedef struct ISASuperIOFuncs { + size_t count; + bool (*is_enabled)(ISASuperIODevice *sio, uint8_t index); + uint16_t (*get_iobase)(ISASuperIODevice *sio, uint8_t index); + unsigned int (*get_irq)(ISASuperIODevice *sio, uint8_t index); + unsigned int (*get_dma)(ISASuperIODevice *sio, uint8_t index); +} ISASuperIOFuncs; + +typedef struct ISASuperIOClass { + /*< private >*/ + ISADeviceClass parent_class; + /*< public >*/ + DeviceRealize parent_realize; +} ISASuperIOClass; + +#endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983192487885.615355720132; Tue, 13 Mar 2018 16:19:52 -0700 (PDT) Received: from localhost ([::1]:43450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtCx-0006VQ-K6 for importer@patchew.org; Tue, 13 Mar 2018 19:19:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiJ-0005wi-Cq for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiE-0003ci-CN for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:51056) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiE-0003bh-4j for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:06 -0400 Received: by mail-wm0-x242.google.com with SMTP id w128so868819wmw.0 for ; Tue, 13 Mar 2018 15:48:05 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dZwMdyo1gCWlnO6qDcmJAHo4l3W7aS0cxnVo6aJHnyc=; b=eDIwUAiBBGBIS3+U9vNAvn0UhTpM5bwdVHUNe4CSKK50JtCimqmiGdKwVJpkyLb/7R Bd5EfqjeLztJdBBSiW/Raqvm+fplEs7eY7m9NJNpmihFHVoryZBbNNkOE8E7bbn/HPAm 68nJBPKg/1g/oK14WFdMNSls81EXnF0mIMzR8rcZnBPO5qavHkji+YAmzQVPocbZkaub cikSWC1vCP3iuwzUQgg9FxC6Ir407jQH5fye5X6Oi3o1rQeG1DJqUKnCMtZ29wuo2eMO gllDY/LDGpaz6cS70UdISR4KwMxU+8aiUQeQCYEGV1NBHev3pPvX6PkGevL6kMQiu2tO r7Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dZwMdyo1gCWlnO6qDcmJAHo4l3W7aS0cxnVo6aJHnyc=; b=ma/bnD/PEDtOzPrrSEEtFKtasCvfT3J+UyufnoZtM8ws/tDUiZ0/cGBRlCA7NXE5kH dBz9LUnsgo5aSckFtgh6Hd6HnrOsGgmG+YjTaSG/23dTkcnrw8ptOCTR7v8cQs+/3GI+ dit3RN47cATP1tiEZVp/N1sCd+2vHunjqfKlZdEEtRVd5aCspvK6pQ9Nl4Vj/Lb1FPma vknMt04uixjF77fhN7UqPQ+oDmqooW/hEaObyG/5RBb/UKXd53fp+4n4gDdHmeRNw6HK tu68ij9UK0BLnYYIARZcW3F2KpDIuKe6YH1dTHuah2wFAOvzODujtn8LIRk7W60DlWmu 38cw== X-Gm-Message-State: AElRT7Eef+iIO8sqBoMptNELqfiy0AW8+u7ujBBGgKB79kBktQX2a1Dr YFq+9FFJwO5sEN2qo9MEwMVhzf5K X-Google-Smtp-Source: AG47ELtKdPQ1nFSacYDL004Mlm4HKiXv3MU+o/99S7paMDsAg6Jv0Utyff/eMFc5DZVmKCJImDYkTA== X-Received: by 10.28.180.132 with SMTP id d126mr2114372wmf.93.1520981284682; Tue, 13 Mar 2018 15:48:04 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:45 +0100 Message-Id: <20180313224719.4954-36-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 35/69] hw/isa/pc87312: Inherit from the abstract TYPE_ISA_SUPERIO 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-10-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/pc87312.c | 11 ++++++++++- include/hw/isa/pc87312.h | 6 ++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index fda91fed21..6b8100ff56 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -270,6 +270,7 @@ static void pc87312_realize(DeviceState *dev, Error **e= rrp) ISABus *bus; Chardev *chr; DriveInfo *drive; + Error *local_err =3D NULL; char name[5]; int i; =20 @@ -279,6 +280,12 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) isa_register_ioport(isa, &s->io, s->iobase); pc87312_hard_reset(s); =20 + ISA_SUPERIO_GET_CLASS(dev)->parent_realize(dev, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + if (is_parallel_enabled(s)) { /* FIXME use a qdev chardev prop instead of parallel_hds[] */ chr =3D parallel_hds[0]; @@ -381,7 +388,9 @@ static Property pc87312_properties[] =3D { static void pc87312_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); =20 + sc->parent_realize =3D dc->realize; dc->realize =3D pc87312_realize; dc->reset =3D pc87312_reset; dc->vmsd =3D &vmstate_pc87312; @@ -392,7 +401,7 @@ static void pc87312_class_init(ObjectClass *klass, void= *data) =20 static const TypeInfo pc87312_type_info =3D { .name =3D TYPE_PC87312_SUPERIO, - .parent =3D TYPE_ISA_DEVICE, + .parent =3D TYPE_ISA_SUPERIO, .instance_size =3D sizeof(PC87312State), .instance_init =3D pc87312_initfn, .class_init =3D pc87312_class_init, diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index b65b219a8a..f3761d6fe1 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -25,14 +25,16 @@ #ifndef QEMU_PC87312_H #define QEMU_PC87312_H =20 -#include "hw/isa/isa.h" +#include "hw/isa/superio.h" =20 =20 #define TYPE_PC87312_SUPERIO "pc87312" #define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERI= O) =20 typedef struct PC87312State { - ISADevice dev; + /*< private >*/ + ISASuperIODevice parent_dev; + /*< public >*/ =20 uint16_t iobase; uint8_t config; /* initial configuration */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982568606869.4038569999904; Tue, 13 Mar 2018 16:09:28 -0700 (PDT) Received: from localhost ([::1]:43393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt2k-0006hz-MR for importer@patchew.org; Tue, 13 Mar 2018 19:09:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiJ-0005wt-GU for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiG-0003f6-3F for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:45856) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiF-0003dq-OW for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:08 -0400 Received: by mail-wr0-x243.google.com with SMTP id h2so2480095wre.12 for ; Tue, 13 Mar 2018 15:48:07 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3FpfdL9XIls7NbRs+zU8TDQYmuUffn0trG4D7JJssUw=; b=hBNq84DppCpJeLWxS/5yDas8MKRjJFk8G8Lhxcx+owVmUzLUTjo+2JXS2LBrUo5TbN m5wB1hRt0LZZlJscYLNvtvK/Y09lFMtMJo50l+wbN5BpNQj6wsYuF0fo0n9DAh7b95pb pnwJd2cxZ9fab4Yycm23RQNp50Uz4VPIXmRIoypvCU0NoHJM6Ajgb8T2TTpzc+o4eQHF 0sj7936OxoT4sAoqcGYV7Lj0pASxN8nIJouBWlPK98aGS0tq2I3jFtFWD2GHPRB/C/Fs HK/f+XhG4As1t6qncUx2qUNy1qfUTCl+gv7PbxzGYdhkl7q1sahhxTZUxgpPNl+G7yJw uZ/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3FpfdL9XIls7NbRs+zU8TDQYmuUffn0trG4D7JJssUw=; b=Zs5TMTFsf9QAyECDdY1jKD4dnMIVC7wKGlwFcWhZzFKIFvCdwytN5bR5hB0j2UjIgR oZcDsSQzjanBSawXn+urDXJzBmBDeErc//tMvvH3X6hStJEaatnKTSbsLrHpMdvVQTtz ULPYzHZfOFhlhC98IznvWgX6t624KVAlVAeujePuYdzVEvDy/gLsqbseV84rhsaZhtI9 A1cuYM8UhfewTEgpKfC7HR8ESLOR7dvAxpxBrevL0ESDTVa9EKu7LnHvsh/tNQLAf64I DRLj7GoSsZBrSz1S5POff9hUt1Gd3u/cywwokiqASBgJD0rmUoQSDdG/tQST8Ia3eqeG aoYA== X-Gm-Message-State: AElRT7FjjgcVPAXPDjRxEO7rovgAg/KtlIVpmOmd7WhRqTywK3gUVDC+ yQQXX81eGZ9Spr8GibSXv935sJ6p X-Google-Smtp-Source: AG47ELs6AaV8ugJOBrVJLqM/5r95LiwJD4xSkeMxzHOU/elyvHvHLUQagpXDlnQUxhpknsFxntqjCQ== X-Received: by 10.223.183.75 with SMTP id n11mr1874205wre.22.1520981286267; Tue, 13 Mar 2018 15:48:06 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:46 +0100 Message-Id: <20180313224719.4954-37-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 36/69] hw/isa/superio: Factor out the parallel code from pc87312.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-11-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 65 ++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/isa/pc87312.c | 38 +++++++++++----------------- hw/isa/trace-events | 4 ++- include/hw/isa/pc87312.h | 4 --- include/hw/isa/superio.h | 6 +++++ 5 files changed, 89 insertions(+), 28 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 14ec16f831..eb263fcc3a 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -10,14 +10,79 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "sysemu/sysemu.h" +#include "chardev/char.h" #include "hw/isa/superio.h" #include "trace.h" =20 +static void isa_superio_realize(DeviceState *dev, Error **errp) +{ + ISASuperIODevice *sio =3D ISA_SUPERIO(dev); + ISASuperIOClass *k =3D ISA_SUPERIO_GET_CLASS(sio); + ISABus *bus =3D isa_bus_from_device(ISA_DEVICE(dev)); + ISADevice *isa; + DeviceState *d; + Chardev *chr; + char *name; + int i; + + /* Parallel port */ + for (i =3D 0; i < k->parallel.count; i++) { + if (i >=3D ARRAY_SIZE(sio->parallel)) { + warn_report("superio: ignoring %td parallel controllers", + k->parallel.count - ARRAY_SIZE(sio->parallel)); + break; + } + if (!k->parallel.is_enabled || k->parallel.is_enabled(sio, i)) { + /* FIXME use a qdev chardev prop instead of parallel_hds[] */ + chr =3D parallel_hds[i]; + if (chr =3D=3D NULL || chr->be) { + name =3D g_strdup_printf("discarding-parallel%d", i); + chr =3D qemu_chr_new(name, "null"); + } else { + name =3D g_strdup_printf("parallel%d", i); + } + isa =3D isa_create(bus, "isa-parallel"); + d =3D DEVICE(isa); + qdev_prop_set_uint32(d, "index", i); + if (k->parallel.get_iobase) { + qdev_prop_set_uint32(d, "iobase", + k->parallel.get_iobase(sio, i)); + } + if (k->parallel.get_irq) { + qdev_prop_set_uint32(d, "irq", k->parallel.get_irq(sio, i)= ); + } + qdev_prop_set_chr(d, "chardev", chr); + qdev_init_nofail(d); + sio->parallel[i] =3D isa; + trace_superio_create_parallel(i, + k->parallel.get_iobase ? + k->parallel.get_iobase(sio, i) := -1, + k->parallel.get_irq ? + k->parallel.get_irq(sio, i) : -1= ); + object_property_add_child(OBJECT(dev), name, + OBJECT(sio->parallel[i]), NULL); + g_free(name); + } + } +} + +static void isa_superio_class_init(ObjectClass *oc, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(oc); + + dc->realize =3D isa_superio_realize; + /* Reason: Uses parallel_hds[0] in realize(), so it can't be used twic= e */ + dc->user_creatable =3D false; +} + static const TypeInfo isa_superio_type_info =3D { .name =3D TYPE_ISA_SUPERIO, .parent =3D TYPE_ISA_DEVICE, .abstract =3D true, .class_size =3D sizeof(ISASuperIOClass), + .class_init =3D isa_superio_class_init, }; =20 static void isa_superio_register_types(void) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 6b8100ff56..1c15715c69 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -64,22 +64,25 @@ =20 /* Parallel port */ =20 -static inline bool is_parallel_enabled(PC87312State *s) +static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index) { - return s->regs[REG_FER] & FER_PARALLEL_EN; + PC87312State *s =3D PC87312(sio); + return index ? false : s->regs[REG_FER] & FER_PARALLEL_EN; } =20 static const uint16_t parallel_base[] =3D { 0x378, 0x3bc, 0x278, 0x00 }; =20 -static inline uint16_t get_parallel_iobase(PC87312State *s) +static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); return parallel_base[s->regs[REG_FAR] & FAR_PARALLEL_ADDR]; } =20 static const unsigned int parallel_irq[] =3D { 5, 7, 5, 0 }; =20 -static inline unsigned int get_parallel_irq(PC87312State *s) +static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); int idx; idx =3D (s->regs[REG_FAR] & FAR_PARALLEL_ADDR); if (idx =3D=3D 0) { @@ -286,24 +289,6 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) return; } =20 - if (is_parallel_enabled(s)) { - /* FIXME use a qdev chardev prop instead of parallel_hds[] */ - chr =3D parallel_hds[0]; - if (chr =3D=3D NULL) { - chr =3D qemu_chr_new("par0", "null"); - } - isa =3D isa_create(bus, "isa-parallel"); - d =3D DEVICE(isa); - qdev_prop_set_uint32(d, "index", 0); - qdev_prop_set_uint32(d, "iobase", get_parallel_iobase(s)); - qdev_prop_set_uint32(d, "irq", get_parallel_irq(s)); - qdev_prop_set_chr(d, "chardev", chr); - qdev_init_nofail(d); - s->parallel.dev =3D isa; - trace_pc87312_info_parallel(get_parallel_iobase(s), - get_parallel_irq(s)); - } - for (i =3D 0; i < 2; i++) { if (is_uart_enabled(s, i)) { /* FIXME use a qdev chardev prop instead of serial_hds[] */ @@ -395,8 +380,15 @@ static void pc87312_class_init(ObjectClass *klass, voi= d *data) dc->reset =3D pc87312_reset; dc->vmsd =3D &vmstate_pc87312; dc->props =3D pc87312_properties; - /* Reason: Uses parallel_hds[0] in realize(), so it can't be used twic= e */ + /* Reason: Uses serial_hds[0] in realize(), so it can't be used twice = */ dc->user_creatable =3D false; + + sc->parallel =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_parallel_enabled, + .get_iobase =3D get_parallel_iobase, + .get_irq =3D get_parallel_irq, + }; } =20 static const TypeInfo pc87312_type_info =3D { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index a4ab4e3634..97b1949981 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -1,9 +1,11 @@ # See docs/devel/tracing.txt for syntax documentation. =20 +# hw/isa/isa-superio.c +superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=3D%d,= base 0x%03x, irq %u" + # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=3D0x%x val=3D0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=3D0x%x val=3D0x%= x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_parallel(uint32_t base, uint32_t irq) "base 0x%x, irq %u" pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=3D%d, base 0x%= x, irq %u" diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index f3761d6fe1..bcc4578479 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ =20 - struct { - ISADevice *dev; - } parallel; - struct { ISADevice *dev; } uart[2]; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index cff6ad6c08..e9879cfde1 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -23,7 +23,11 @@ OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO) =20 typedef struct ISASuperIODevice { + /*< private >*/ ISADevice parent_obj; + /*< public >*/ + + ISADevice *parallel[MAX_PARALLEL_PORTS]; } ISASuperIODevice; =20 typedef struct ISASuperIOFuncs { @@ -39,6 +43,8 @@ typedef struct ISASuperIOClass { ISADeviceClass parent_class; /*< public >*/ DeviceRealize parent_realize; + + ISASuperIOFuncs parallel; } ISASuperIOClass; =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982933735835.2317983447268; Tue, 13 Mar 2018 16:15:33 -0700 (PDT) Received: from localhost ([::1]:43429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt8m-0002rN-QG for importer@patchew.org; Tue, 13 Mar 2018 19:15:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58254) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiJ-0005wk-DR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiH-0003gr-AU for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:36935) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiH-0003fX-09 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:09 -0400 Received: by mail-wr0-x241.google.com with SMTP id z12so2563187wrg.4 for ; Tue, 13 Mar 2018 15:48:08 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/T9mimLrUSUK+UmgRdL/HPXuwI5QRhyhlbLL+RoEasQ=; b=ltkx5QjcTJ+QJAKsGYhGShp7Idc63GnxeJmMieMXpLNIQ9G5IwbZpBx7XMXkTJ1UqR esfKSkjswUIxxOOTBC0dw3vvBkJOAwSy/JRArNFobnUW6hxQ0u6FBT4HEU4zBEPZg0vw j7VGNB6MKJ7fA19NSbmyJiJXzxDXBvl6W63KqYiU2TVC8Ef69Rp6dCQsFjh/NThzYIrI a6xXqKwBjC7riBdA2KluNt/wp/MuE9JnGltQO31boIbwtrFyVEgSvnE/iSUYOq0Gav59 PpMM9sn51bwDGa3NdusI+Ch8o+DXw95gYYnBHOTWR3Ch0G7n6goFJaqYdzVyUBCaAZlG Rs0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/T9mimLrUSUK+UmgRdL/HPXuwI5QRhyhlbLL+RoEasQ=; b=sgqZ+OjJQrXrqgJ9WTjVj79G1gLr8TOqFOZdI/otkQhfG4Js+A3yt2z8ljIVqDjxqi 0Pj2+MCLjOtZ5udASEpepU+OgF0iuZlwGTXr44McmALKDywoxg6vdMpWetqJNI6/lVrw hnaI//cPYQnVRjTHHdxVDWT8FkXK0dI+SCPk9GANAcKbHGhCAUExH+CpPLMLzyL0cTDw Cml0Ahjpa+S0yLajTXJBU2FmL0JUtL7DCmTKeftycbBIxxkLuvvYSWbY3KWXPVkMB9Xe Tbm5kNzT60q963vbZhAf45aSHPoeXQDJMvU2Ic1l6lOYjzKIpO7+wM3hF9hLTfaCtn/w MYjw== X-Gm-Message-State: AElRT7FVXHNL9vnuHpf/xzI6p4NsZauTfE4RNwPYaXL1IUp42pdLBQV/ LzXwBRuHflDUXTMLNgUgw/VBUvyz X-Google-Smtp-Source: AG47ELuoPvwWxXX7JcMGpFDTI+/uNyxxZgMr4DzD74ZYEKKkZ4/E3IsWA55xv8AhgDtXcqehAVRwNQ== X-Received: by 10.223.148.37 with SMTP id 34mr1938378wrq.243.1520981287507; Tue, 13 Mar 2018 15:48:07 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:47 +0100 Message-Id: <20180313224719.4954-38-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 37/69] hw/isa/superio: Factor out the serial code from pc87312.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-12-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 41 +++++++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 43 ++++++++++++------------------------------- hw/isa/trace-events | 2 +- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ 5 files changed, 56 insertions(+), 36 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index eb263fcc3a..6962421aad 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -14,6 +14,7 @@ #include "sysemu/sysemu.h" #include "chardev/char.h" #include "hw/isa/superio.h" +#include "hw/char/serial.h" #include "trace.h" =20 static void isa_superio_realize(DeviceState *dev, Error **errp) @@ -66,6 +67,46 @@ static void isa_superio_realize(DeviceState *dev, Error = **errp) g_free(name); } } + + /* Serial */ + for (i =3D 0; i < k->serial.count; i++) { + if (i >=3D ARRAY_SIZE(sio->serial)) { + warn_report("superio: ignoring %td serial controllers", + k->serial.count - ARRAY_SIZE(sio->serial)); + break; + } + if (!k->serial.is_enabled || k->serial.is_enabled(sio, i)) { + /* FIXME use a qdev chardev prop instead of serial_hds[] */ + chr =3D serial_hds[i]; + if (chr =3D=3D NULL || chr->be) { + name =3D g_strdup_printf("discarding-serial%d", i); + chr =3D qemu_chr_new(name, "null"); + } else { + name =3D g_strdup_printf("serial%d", i); + } + isa =3D isa_create(bus, TYPE_ISA_SERIAL); + d =3D DEVICE(isa); + qdev_prop_set_uint32(d, "index", i); + if (k->serial.get_iobase) { + qdev_prop_set_uint32(d, "iobase", + k->serial.get_iobase(sio, i)); + } + if (k->serial.get_irq) { + qdev_prop_set_uint32(d, "irq", k->serial.get_irq(sio, i)); + } + qdev_prop_set_chr(d, "chardev", chr); + qdev_init_nofail(d); + sio->serial[i] =3D isa; + trace_superio_create_serial(i, + k->serial.get_iobase ? + k->serial.get_iobase(sio, i) : -1, + k->serial.get_irq ? + k->serial.get_irq(sio, i) : -1); + object_property_add_child(OBJECT(dev), name, + OBJECT(sio->serial[0]), NULL); + g_free(name); + } + } } =20 static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index 1c15715c69..c2837bca43 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -29,8 +29,6 @@ #include "qemu/error-report.h" #include "sysemu/block-backend.h" #include "sysemu/blockdev.h" -#include "sysemu/sysemu.h" -#include "chardev/char.h" #include "trace.h" =20 =20 @@ -100,8 +98,9 @@ static const uint16_t uart_base[2][4] =3D { { 0x2e8, 0x238, 0x2e0, 0x228 } }; =20 -static inline uint16_t get_uart_iobase(PC87312State *s, int i) +static uint16_t get_uart_iobase(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s =3D PC87312(sio); int idx; idx =3D (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; if (idx =3D=3D 0) { @@ -113,15 +112,17 @@ static inline uint16_t get_uart_iobase(PC87312State *= s, int i) } } =20 -static inline unsigned int get_uart_irq(PC87312State *s, int i) +static unsigned int get_uart_irq(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s =3D PC87312(sio); int idx; idx =3D (s->regs[REG_FAR] >> (2 * i + 2)) & 0x3; return (idx & 1) ? 3 : 4; } =20 -static inline bool is_uart_enabled(PC87312State *s, int i) +static bool is_uart_enabled(ISASuperIODevice *sio, uint8_t i) { + PC87312State *s =3D PC87312(sio); return s->regs[REG_FER] & (FER_UART1_EN << i); } =20 @@ -271,11 +272,8 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) DeviceState *d; ISADevice *isa; ISABus *bus; - Chardev *chr; DriveInfo *drive; Error *local_err =3D NULL; - char name[5]; - int i; =20 s =3D PC87312(dev); isa =3D ISA_DEVICE(dev); @@ -289,27 +287,6 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) return; } =20 - for (i =3D 0; i < 2; i++) { - if (is_uart_enabled(s, i)) { - /* FIXME use a qdev chardev prop instead of serial_hds[] */ - chr =3D serial_hds[i]; - if (chr =3D=3D NULL) { - snprintf(name, sizeof(name), "ser%d", i); - chr =3D qemu_chr_new(name, "null"); - } - isa =3D isa_create(bus, "isa-serial"); - d =3D DEVICE(isa); - qdev_prop_set_uint32(d, "index", i); - qdev_prop_set_uint32(d, "iobase", get_uart_iobase(s, i)); - qdev_prop_set_uint32(d, "irq", get_uart_irq(s, i)); - qdev_prop_set_chr(d, "chardev", chr); - qdev_init_nofail(d); - s->uart[i].dev =3D isa; - trace_pc87312_info_serial(i, get_uart_iobase(s, i), - get_uart_irq(s, i)); - } - } - if (is_fdc_enabled(s)) { isa =3D isa_create(bus, "isa-fdc"); d =3D DEVICE(isa); @@ -380,8 +357,6 @@ static void pc87312_class_init(ObjectClass *klass, void= *data) dc->reset =3D pc87312_reset; dc->vmsd =3D &vmstate_pc87312; dc->props =3D pc87312_properties; - /* Reason: Uses serial_hds[0] in realize(), so it can't be used twice = */ - dc->user_creatable =3D false; =20 sc->parallel =3D (ISASuperIOFuncs){ .count =3D 1, @@ -389,6 +364,12 @@ static void pc87312_class_init(ObjectClass *klass, voi= d *data) .get_iobase =3D get_parallel_iobase, .get_irq =3D get_parallel_irq, }; + sc->serial =3D (ISASuperIOFuncs){ + .count =3D 2, + .is_enabled =3D is_uart_enabled, + .get_iobase =3D get_uart_iobase, + .get_irq =3D get_uart_irq, + }; } =20 static const TypeInfo pc87312_type_info =3D { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 97b1949981..c78dd6c353 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -2,10 +2,10 @@ =20 # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=3D%d,= base 0x%03x, irq %u" +superio_create_serial(int id, uint16_t base, unsigned int irq) "id=3D%d, b= ase 0x%03x, irq %u" =20 # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=3D0x%x val=3D0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=3D0x%x val=3D0x%= x" pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" -pc87312_info_serial(int n, uint32_t base, uint32_t irq) "id=3D%d, base 0x%= x, irq %u" diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index bcc4578479..1480615a2c 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ =20 - struct { - ISADevice *dev; - } uart[2]; - struct { ISADevice *dev; } fdc; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index e9879cfde1..0b516721c3 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -28,6 +28,7 @@ typedef struct ISASuperIODevice { /*< public >*/ =20 ISADevice *parallel[MAX_PARALLEL_PORTS]; + ISADevice *serial[MAX_SERIAL_PORTS]; } ISASuperIODevice; =20 typedef struct ISASuperIOFuncs { @@ -45,6 +46,7 @@ typedef struct ISASuperIOClass { DeviceRealize parent_realize; =20 ISASuperIOFuncs parallel; + ISASuperIOFuncs serial; } ISASuperIOClass; =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983297447800.921466962882; Tue, 13 Mar 2018 16:21:37 -0700 (PDT) Received: from localhost ([::1]:43466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtEe-0008Qg-Ha for importer@patchew.org; Tue, 13 Mar 2018 19:21:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiK-0005y3-R6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiJ-0003jd-3y for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:12 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33475) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiI-0003iK-QR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: by mail-wr0-x242.google.com with SMTP id r8so2594970wrg.0 for ; Tue, 13 Mar 2018 15:48:10 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yDi6n/qIPG7JPfRaWfZbi9IJlv70wL3esgqYSMo41JQ=; b=uYwF5GyzO6xufr5f6CkAT/BBcHIByoliq7NpuZX08YXAMmHuFbYZfsfcbLiNq3x/EZ XIPOd25Jsocc5k9sWQGHwYsUgUsi+WiaTrYQRA2m9+4npB8f0AJzjxqCMnrOtvJiJ4QD QJG8t9wJS6N5GZUGRWDmGSXMJXjK+MZcjh2dBGsgH1Pq72Ud0oM958iW4L4zptcWJlei 5r8pKtFfmgUAyTELqo3WvEeFTiscksS429rSk4YZ1oX2VFvB0sxYlTSl9g4yoB6XtMgu q0bFTLHQLpaFG8VwBb5qd8KhAiomBu6sCmqcgjvihv+sqFqTqsDY9U8wyIcvguFTthX8 a7Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yDi6n/qIPG7JPfRaWfZbi9IJlv70wL3esgqYSMo41JQ=; b=ruNHD6V+NQJMb/oCjmZN6IO1WAE3Z4dEZrC1ObtkV9AikR5SAB+Xu/pMRNHlkDchex ihep+03s3o19Y9HQjq/B0sA1VR5wzLjsK1xnfK7RFzr7xXCtoLraDORXE7EYO0QFKlVd 9x8nNzZ+TvkEtAkexuOOsjeKzKpHLtNp4r/Zy+QNMIl5/qQ+2hZbg9LQ3Nn6Uu2jJn+g INP94Im6sRo7aUcDxdGVsNAhrrnmCK1iyEXeTiO1pQiyXKLVW+CLUq16I6p+FayHrgcn v83tsybbrHrwffegyQ8hqltIF5k/tdJiphAyl3pH8pBFKs8lwynIRujcRIKzL01mzg6F JuDQ== X-Gm-Message-State: AElRT7EuCUHipMA/vBynfQ4aBwCQpKFB+QIEcjT+K6z+XL9WGcvEI6iP xpB0P6xENzPyelXyxSYe9OnNedWb X-Google-Smtp-Source: AG47ELvhT3HXWtabSweh/F33jBCx/Gdc8pbliTZbsa4Npn5ZNgGdFGmMN9fIL+XJuuop0Vtzfa/Brg== X-Received: by 10.223.173.3 with SMTP id p3mr1936407wrc.202.1520981289306; Tue, 13 Mar 2018 15:48:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:48 +0100 Message-Id: <20180313224719.4954-39-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 38/69] hw/isa/superio: Factor out the floppy disc controller code from pc87312.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-13-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 36 ++++++++++++++++++++++++++++++++++++ hw/isa/pc87312.c | 46 +++++++++++++++++++-------------------------= -- hw/isa/trace-events | 2 +- include/hw/isa/pc87312.h | 4 ---- include/hw/isa/superio.h | 2 ++ 5 files changed, 58 insertions(+), 32 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 6962421aad..4b5e280b38 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -11,7 +11,10 @@ */ #include "qemu/osdep.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "sysemu/sysemu.h" +#include "sysemu/block-backend.h" +#include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" #include "hw/char/serial.h" @@ -25,6 +28,7 @@ static void isa_superio_realize(DeviceState *dev, Error *= *errp) ISADevice *isa; DeviceState *d; Chardev *chr; + DriveInfo *drive; char *name; int i; =20 @@ -107,6 +111,38 @@ static void isa_superio_realize(DeviceState *dev, Erro= r **errp) g_free(name); } } + + /* Floppy disc */ + if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) { + isa =3D isa_create(bus, "isa-fdc"); + d =3D DEVICE(isa); + if (k->floppy.get_iobase) { + qdev_prop_set_uint32(d, "iobase", k->floppy.get_iobase(sio, 0)= ); + } + if (k->floppy.get_irq) { + qdev_prop_set_uint32(d, "irq", k->floppy.get_irq(sio, 0)); + } + /* FIXME use a qdev drive property instead of drive_get() */ + drive =3D drive_get(IF_FLOPPY, 0, 0); + if (drive !=3D NULL) { + qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive), + &error_fatal); + } + /* FIXME use a qdev drive property instead of drive_get() */ + drive =3D drive_get(IF_FLOPPY, 0, 1); + if (drive !=3D NULL) { + qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive), + &error_fatal); + } + qdev_init_nofail(d); + sio->floppy =3D isa; + trace_superio_create_floppy(0, + k->floppy.get_iobase ? + k->floppy.get_iobase(sio, 0) : -1, + k->floppy.get_irq ? + k->floppy.get_irq(sio, 0) : -1); + } + } =20 static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index c2837bca43..a1845a91c3 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -27,8 +27,6 @@ #include "hw/isa/pc87312.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "sysemu/block-backend.h" -#include "sysemu/blockdev.h" #include "trace.h" =20 =20 @@ -129,16 +127,26 @@ static bool is_uart_enabled(ISASuperIODevice *sio, ui= nt8_t i) =20 /* Floppy controller */ =20 -static inline bool is_fdc_enabled(PC87312State *s) +static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); + assert(!index); return s->regs[REG_FER] & FER_FDC_EN; } =20 -static inline uint16_t get_fdc_iobase(PC87312State *s) +static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); + assert(!index); return (s->regs[REG_FER] & FER_FDC_ADDR) ? 0x370 : 0x3f0; } =20 +static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index) +{ + assert(!index); + return 6; +} + =20 /* IDE controller */ =20 @@ -272,7 +280,6 @@ static void pc87312_realize(DeviceState *dev, Error **e= rrp) DeviceState *d; ISADevice *isa; ISABus *bus; - DriveInfo *drive; Error *local_err =3D NULL; =20 s =3D PC87312(dev); @@ -287,28 +294,6 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) return; } =20 - if (is_fdc_enabled(s)) { - isa =3D isa_create(bus, "isa-fdc"); - d =3D DEVICE(isa); - qdev_prop_set_uint32(d, "iobase", get_fdc_iobase(s)); - qdev_prop_set_uint32(d, "irq", 6); - /* FIXME use a qdev drive property instead of drive_get() */ - drive =3D drive_get(IF_FLOPPY, 0, 0); - if (drive !=3D NULL) { - qdev_prop_set_drive(d, "driveA", blk_by_legacy_dinfo(drive), - &error_fatal); - } - /* FIXME use a qdev drive property instead of drive_get() */ - drive =3D drive_get(IF_FLOPPY, 0, 1); - if (drive !=3D NULL) { - qdev_prop_set_drive(d, "driveB", blk_by_legacy_dinfo(drive), - &error_fatal); - } - qdev_init_nofail(d); - s->fdc.dev =3D isa; - trace_pc87312_info_floppy(get_fdc_iobase(s)); - } - if (is_ide_enabled(s)) { isa =3D isa_create(bus, "isa-ide"); d =3D DEVICE(isa); @@ -370,6 +355,12 @@ static void pc87312_class_init(ObjectClass *klass, voi= d *data) .get_iobase =3D get_uart_iobase, .get_irq =3D get_uart_irq, }; + sc->floppy =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_fdc_enabled, + .get_iobase =3D get_fdc_iobase, + .get_irq =3D get_fdc_irq, + }; } =20 static const TypeInfo pc87312_type_info =3D { @@ -378,6 +369,7 @@ static const TypeInfo pc87312_type_info =3D { .instance_size =3D sizeof(PC87312State), .instance_init =3D pc87312_initfn, .class_init =3D pc87312_class_init, + /* FIXME use a qdev drive property instead of drive_get() */ }; =20 static void pc87312_register_types(void) diff --git a/hw/isa/trace-events b/hw/isa/trace-events index c78dd6c353..8d9900882f 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -3,9 +3,9 @@ # hw/isa/isa-superio.c superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=3D%d,= base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=3D%d, b= ase 0x%03x, irq %u" +superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=3D%d, b= ase 0x%03x, irq %u" =20 # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=3D0x%x val=3D0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=3D0x%x val=3D0x%= x" -pc87312_info_floppy(uint32_t base) "base 0x%x" pc87312_info_ide(uint32_t base) "base 0x%x" diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h index 1480615a2c..e16263d4b1 100644 --- a/include/hw/isa/pc87312.h +++ b/include/hw/isa/pc87312.h @@ -39,10 +39,6 @@ typedef struct PC87312State { uint16_t iobase; uint8_t config; /* initial configuration */ =20 - struct { - ISADevice *dev; - } fdc; - struct { ISADevice *dev; } ide; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 0b516721c3..e8007b9eee 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -29,6 +29,7 @@ typedef struct ISASuperIODevice { =20 ISADevice *parallel[MAX_PARALLEL_PORTS]; ISADevice *serial[MAX_SERIAL_PORTS]; + ISADevice *floppy; } ISASuperIODevice; =20 typedef struct ISASuperIOFuncs { @@ -47,6 +48,7 @@ typedef struct ISASuperIOClass { =20 ISASuperIOFuncs parallel; ISASuperIOFuncs serial; + ISASuperIOFuncs floppy; } ISASuperIOClass; =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983123762723.893639723637; Tue, 13 Mar 2018 16:18:43 -0700 (PDT) Received: from localhost ([::1]:43447 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtBq-0005S0-TM for importer@patchew.org; Tue, 13 Mar 2018 19:18:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiL-0005yF-01 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiJ-0003kq-R2 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:12 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiJ-0003jP-Kc for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:11 -0400 Received: by mail-wr0-x242.google.com with SMTP id v65so2494159wrc.11 for ; Tue, 13 Mar 2018 15:48:11 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zdXOHOoyQ2N4wPRnnOjrHBXDdcAD2/q1FYM8IFQIpSw=; b=VGYs671VVFvlRx9EdPx4W82rRhgmi2oAwxVOy5ja4OevSLaFWIS4Mojm26ETELjSFN fS/ucvdijkyDi1GLgGFbDu1wTvNxuOrfAh38d9Bj95jtqqfiWBC5NuLqI3KrYYELUDU+ HAxRRf8qZzgUYsy/LeH9bD4KCjUFTGCJgZilXwywiq3/lhP/+ObAsFu+7yfdpjAUMyOu 4Of831fFRNGc/VNqBk+EHDEcZLYj19fEevCtmjdy81S51GNkZ0qZsxceo1jQ7Wy06jOp lCUAcyZgw6QHGOY8w2j3FisKeqTH/2/szdSYF7uxZ1Bs/ZPbDlF26w+RU0QfxHvqYU8R s0mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=zdXOHOoyQ2N4wPRnnOjrHBXDdcAD2/q1FYM8IFQIpSw=; b=Cjs7uTAhbL8hHoRWMA9x8gevbeu5/BKtD2TmBzI1rcaK/0uR23KKNpUISLJcIWTkj6 ylkT1e9i1vYz0QxDOdDOSznArcWVPQbyDlNqhaszN1aohxQoyRuhvN/ijKAJjE3DZDii o5xZnnYky+y/A2d3CpgQLLl8y1k3KXRAesQ/WDFiEMnJKNOSW2nTKEvK8wKe4F+gptMK 3EUrFoj9Ahv9KIK5Isgep1bTo39x38PMmE1Lf5r7hKBGQXcxptAV6TtIQqZxcGGuVLR6 d14ELcp3pkFl+uanL8XanVI2Upu2OB+DO4I5JKNpnnUKWbDzvnPACQD5lB8BH+XY6BOo ljiw== X-Gm-Message-State: AElRT7Gnim9oOIIf/loZA9TkWOG/z0H9Al3ZHnpWonKSvxqXrWvDLpKM qBZJ02qRg+4UIJOVLLY5h41+0jgP X-Google-Smtp-Source: AG47ELsfPL0Bbuw8d+dKgTR7SKUJb/ZB3pxrhcbtOyOSrhGPQZiaATqOnfR1BfxOs/pn5GYNzv2rBg== X-Received: by 10.223.164.138 with SMTP id g10mr1827738wrb.74.1520981290317; Tue, 13 Mar 2018 15:48:10 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:49 +0100 Message-Id: <20180313224719.4954-40-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 39/69] hw/isa/superio: Add a keyboard/mouse controller (8042) 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Since the PC87312 inherits this abstract model, we remove the I8042 instance in the PREP machine. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: David Gibson Message-Id: <20180308223946.26784-14-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 3 +++ hw/ppc/prep.c | 1 - include/hw/isa/superio.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 4b5e280b38..041b47bdbf 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -17,6 +17,7 @@ #include "sysemu/blockdev.h" #include "chardev/char.h" #include "hw/isa/superio.h" +#include "hw/input/i8042.h" #include "hw/char/serial.h" #include "trace.h" =20 @@ -143,6 +144,8 @@ static void isa_superio_realize(DeviceState *dev, Error= **errp) k->floppy.get_irq(sio, 0) : -1); } =20 + /* Keyboard, mouse */ + sio->kbc =3D isa_create_simple(bus, TYPE_I8042); } =20 static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c index df774bd384..5c78503069 100644 --- a/hw/ppc/prep.c +++ b/hw/ppc/prep.c @@ -641,7 +641,6 @@ static void ppc_prep_init(MachineState *machine) hd[2 * i], hd[2 * i + 1]); } - isa_create_simple(isa_bus, TYPE_I8042); =20 cpu =3D POWERPC_CPU(first_cpu); sysctrl->reset_irq =3D cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index e8007b9eee..2fc33bf3d3 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -30,6 +30,7 @@ typedef struct ISASuperIODevice { ISADevice *parallel[MAX_PARALLEL_PORTS]; ISADevice *serial[MAX_SERIAL_PORTS]; ISADevice *floppy; + ISADevice *kbc; } ISASuperIODevice; =20 typedef struct ISASuperIOFuncs { --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983368448317.7072777157707; Tue, 13 Mar 2018 16:22:48 -0700 (PDT) Received: from localhost ([::1]:43471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtFn-0001GW-EA for importer@patchew.org; Tue, 13 Mar 2018 19:22:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiN-00061O-I6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiL-0003o4-Rk for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:15 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:54381) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiL-0003m9-J7 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:13 -0400 Received: by mail-wm0-x236.google.com with SMTP id h76so871629wme.4 for ; Tue, 13 Mar 2018 15:48:13 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x6ViZ1Q3cHMooFXaEmLO0PLoFpb1SmrTLVqTNXNPnYs=; b=ZV5s2DPxMVHsT2p0l7NRbugdYDI4+S1SKrXVbd8lNuaA+ZIzBM4EF9adY546YzGvFs 7q9rVU2uLK5xnE7to2U1uJJJ3FIVdBqcGx0fYOAbkqcEfcdw0aEJEEZrwf1z6SCQxd4j 7M0lBBRVjSvwGYI8Q19o6cjfNezyixm2v3W/7Jtp4IXuEDdhvpohutRRd48UGMtDSam9 LDuqlhjeAr/CIpZ0dAcfYuxc1cXyqFIz2Y1oTpsO4VvYpTRhwYfyf0RQ5ahwZz9Aa00x cfiNMK5o3K0qRBw3OsS3K4T6nG//+QoOqF6V38L9Pqi/UK0inNMT4s0H/hXf4XWvr+50 1boA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=x6ViZ1Q3cHMooFXaEmLO0PLoFpb1SmrTLVqTNXNPnYs=; b=LzIyTNMPDS6EaGgWjAJuSeNYZq0z9JAZk9Jpjd4HX+bK8do/bQLNzMOn5eRMug6AyI zEP+JhD5tbMhXizRq94d4HzvAWxPip3LFnuN5ONNAOZckm+C3UFExe9hsU16K6MnIEkO zK2M9mUWmLJ9iSumyuAUElFPxxqGgPUSCo0mbS5eMdbODOzW/WswQ1IAEuI3XKw6zrvL QViceJJSz9Yi3JQvv8fxTWBofN4eY0EH4Gu+3dzB6E1gO/pcTmEQyZrWFI4rz24dSGOC S3eq3mEbgrKLpZsYEGEW1E9sRoE65ZhQiiLHJfJB65PGxdMn8hJOf9uCy+ifDbJeg58D Ra1Q== X-Gm-Message-State: AElRT7Hzw1X8usf+khWP3AvwStdWoI3By6IfAB7jrnSqCA0Zkqr8XXFM BK/LBL/YCeRoINiljniij2l+HGWK X-Google-Smtp-Source: AG47ELvYyJZrZ+dCDO0LqaFU3a2m8z+qxTDwgOxLkSOepB5Mh6UeXpuM3tf6ZpaW9qJgn4LGEOKQTA== X-Received: by 10.28.54.11 with SMTP id d11mr1220797wma.104.1520981291945; Tue, 13 Mar 2018 15:48:11 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:50 +0100 Message-Id: <20180313224719.4954-41-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 Subject: [Qemu-devel] [PULL 40/69] hw/isa/superio: Factor out the IDE code from pc87312.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-15-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 22 ++++++++++++++++++++++ hw/isa/pc87312.c | 36 ++++++++++++++++++++---------------- hw/isa/trace-events | 2 +- include/hw/isa/superio.h | 2 ++ 4 files changed, 45 insertions(+), 17 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index 041b47bdbf..f98711beff 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -146,6 +146,28 @@ static void isa_superio_realize(DeviceState *dev, Erro= r **errp) =20 /* Keyboard, mouse */ sio->kbc =3D isa_create_simple(bus, TYPE_I8042); + + /* IDE */ + if (k->ide.count && (!k->ide.is_enabled || k->ide.is_enabled(sio, 0)))= { + isa =3D isa_create(bus, "isa-ide"); + d =3D DEVICE(isa); + if (k->ide.get_iobase) { + qdev_prop_set_uint32(d, "iobase", k->ide.get_iobase(sio, 0)); + } + if (k->ide.get_iobase) { + qdev_prop_set_uint32(d, "iobase2", k->ide.get_iobase(sio, 1)); + } + if (k->ide.get_irq) { + qdev_prop_set_uint32(d, "irq", k->ide.get_irq(sio, 0)); + } + qdev_init_nofail(d); + sio->ide =3D isa; + trace_superio_create_ide(0, + k->ide.get_iobase ? + k->ide.get_iobase(sio, 0) : -1, + k->ide.get_irq ? + k->ide.get_irq(sio, 0) : -1); + } } =20 static void isa_superio_class_init(ObjectClass *oc, void *data) diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c index a1845a91c3..5cf64505fe 100644 --- a/hw/isa/pc87312.c +++ b/hw/isa/pc87312.c @@ -150,16 +150,28 @@ static unsigned int get_fdc_irq(ISASuperIODevice *sio= , uint8_t index) =20 /* IDE controller */ =20 -static inline bool is_ide_enabled(PC87312State *s) +static bool is_ide_enabled(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); + return s->regs[REG_FER] & FER_IDE_EN; } =20 -static inline uint16_t get_ide_iobase(PC87312State *s) +static uint16_t get_ide_iobase(ISASuperIODevice *sio, uint8_t index) { + PC87312State *s =3D PC87312(sio); + + if (index =3D=3D 1) { + return get_ide_iobase(sio, 0) + 0x206; + } return (s->regs[REG_FER] & FER_IDE_ADDR) ? 0x170 : 0x1f0; } =20 +static unsigned int get_ide_irq(ISASuperIODevice *sio, uint8_t index) +{ + assert(index =3D=3D 0); + return 14; +} =20 static void reconfigure_devices(PC87312State *s) { @@ -277,14 +289,11 @@ static void pc87312_reset(DeviceState *d) static void pc87312_realize(DeviceState *dev, Error **errp) { PC87312State *s; - DeviceState *d; ISADevice *isa; - ISABus *bus; Error *local_err =3D NULL; =20 s =3D PC87312(dev); isa =3D ISA_DEVICE(dev); - bus =3D isa_bus_from_device(isa); isa_register_ioport(isa, &s->io, s->iobase); pc87312_hard_reset(s); =20 @@ -293,17 +302,6 @@ static void pc87312_realize(DeviceState *dev, Error **= errp) error_propagate(errp, local_err); return; } - - if (is_ide_enabled(s)) { - isa =3D isa_create(bus, "isa-ide"); - d =3D DEVICE(isa); - qdev_prop_set_uint32(d, "iobase", get_ide_iobase(s)); - qdev_prop_set_uint32(d, "iobase2", get_ide_iobase(s) + 0x206); - qdev_prop_set_uint32(d, "irq", 14); - qdev_init_nofail(d); - s->ide.dev =3D isa; - trace_pc87312_info_ide(get_ide_iobase(s)); - } } =20 static void pc87312_initfn(Object *obj) @@ -361,6 +359,12 @@ static void pc87312_class_init(ObjectClass *klass, voi= d *data) .get_iobase =3D get_fdc_iobase, .get_irq =3D get_fdc_irq, }; + sc->ide =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_ide_enabled, + .get_iobase =3D get_ide_iobase, + .get_irq =3D get_ide_irq, + }; } =20 static const TypeInfo pc87312_type_info =3D { diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 8d9900882f..80ac6175d6 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -4,8 +4,8 @@ superio_create_parallel(int id, uint16_t base, unsigned int irq) "id=3D%d,= base 0x%03x, irq %u" superio_create_serial(int id, uint16_t base, unsigned int irq) "id=3D%d, b= ase 0x%03x, irq %u" superio_create_floppy(int id, uint16_t base, unsigned int irq) "id=3D%d, b= ase 0x%03x, irq %u" +superio_create_ide(int id, uint16_t base, unsigned int irq) "id=3D%d, base= 0x%03x, irq %u" =20 # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=3D0x%x val=3D0x%x" pc87312_io_write(uint32_t addr, uint32_t val) "write addr=3D0x%x val=3D0x%= x" -pc87312_info_ide(uint32_t base) "base 0x%x" diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 2fc33bf3d3..3dd5448f8c 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -31,6 +31,7 @@ typedef struct ISASuperIODevice { ISADevice *serial[MAX_SERIAL_PORTS]; ISADevice *floppy; ISADevice *kbc; + ISADevice *ide; } ISASuperIODevice; =20 typedef struct ISASuperIOFuncs { @@ -50,6 +51,7 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs parallel; ISASuperIOFuncs serial; ISASuperIOFuncs floppy; + ISASuperIOFuncs ide; } ISASuperIOClass; =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209831969711002.9630173865464; Tue, 13 Mar 2018 16:19:56 -0700 (PDT) Received: from localhost ([::1]:43452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtD2-0006ba-2s for importer@patchew.org; Tue, 13 Mar 2018 19:19:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiN-00061E-C6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiM-0003oj-Cd for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:15 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:45855) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiM-0003nW-66 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:14 -0400 Received: by mail-wr0-x241.google.com with SMTP id h2so2480283wre.12 for ; Tue, 13 Mar 2018 15:48:14 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8RuZJSRYSi9JcAVrCNicdklVykQ+67TVPTnceLb5E6w=; b=IMwJ1wub3weVSMqDH83r+Dk4lQehnfQzfHPouvffFFdtrQQiFWrO4p0WducK8DWXyX l4LwsdMvfbY1UXxXVSgM9IWvnhngIZWoT/VbCTKknYKC0x4PQmuPaHLW4UYIPG9PTO6f iSrAJedFbix4JFJ7eL3vwEdfTpZsGkgpqZ7/+5pRyH9xnrQNww5dYIhYaO3xAJja8qro M3CVJpceuFLT+wdHiTDhDbrq3WRyXYqybBEAW6JHAjT65tBWBQMKPaiOjzra/VU8/5ON HS/dUuRRYQqpLtMPJKlq+G81ar1yJGMB4Jqnyjrb/uqC/NkG6ot0Ff4nIt+HlL93txlB utHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8RuZJSRYSi9JcAVrCNicdklVykQ+67TVPTnceLb5E6w=; b=FrKACOiSQNfLJzj5XZFphvZM6xTn79soqfqPybeUJYBD02uXZK33UpXRem80XBtqWp qzF1+gln4XKwRbdxQh6VLAabYouh8DCS2NkEZMt1nMOcQfu96sCuL189syxKst1UCujU 2J1yl71RM+U72itnaTm3ZO8w/2pkAIqlo8FZPKyUq5PXNUZUUsLj9HbYILWe/dMrPVXy ek+iC+eAV84NEhd6Mj/lIO354AVOPxtjnJDrLu62F6/rys70+RLURB8qjpFDx8K6xSQg D+WXSJSyB2CPzAiJZHQ2Igo2GTWrtB3wLJT+ZVSZ4oRvVuG7eMRhKuCY0PfBEY12/xyM dfpQ== X-Gm-Message-State: AElRT7HR7dbEH0q93NKg9uN4+lxdvxgFyiodeH58/UxtppgZtSixE3p4 UGbmToBy/KaaIhDwhwrQiXb9ns+I X-Google-Smtp-Source: AG47ELsf6tYODz0rrVll4WW9IVFZZ8JaDUjjYRIEniA4j5e82akLC69FaYA0XLy8fzOVRz8+oZ0v9w== X-Received: by 10.223.199.10 with SMTP id k10mr1939126wrg.186.1520981292891; Tue, 13 Mar 2018 15:48:12 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:51 +0100 Message-Id: <20180313224719.4954-42-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 41/69] hw/mips/malta: Code movement 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Move the SouthBridge peripherals first, and keep the Super I/O peripherals last. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-16-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/mips/mips_malta.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index cd7bd0eef6..9e0724ca5a 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -1062,10 +1062,6 @@ void mips_malta_init(MachineState *machine) memory_region_add_subregion(system_memory, 512 << 20, ram_low_post= io); } =20 - /* generate SPD EEPROM data */ - generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); - generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]); - #ifdef TARGET_WORDS_BIGENDIAN be =3D 1; #else @@ -1208,15 +1204,19 @@ void mips_malta_init(MachineState *machine) pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci"); smbus =3D piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, isa_get_irq(NULL, 9), NULL, 0, NULL); - smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); - g_free(smbus_eeprom_buf); pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(isa_bus, 0); + mc146818_rtc_init(isa_bus, 2000, NULL); + + /* generate SPD EEPROM data */ + generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size); + generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]); + smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); + g_free(smbus_eeprom_buf); =20 /* Super I/O */ isa_create_simple(isa_bus, TYPE_I8042); =20 - mc146818_rtc_init(isa_bus, 2000, NULL); serial_hds_isa_init(isa_bus, 0, 2); parallel_hds_isa_init(isa_bus, 1); =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520982726949248.45814531547137; Tue, 13 Mar 2018 16:12:06 -0700 (PDT) Received: from localhost ([::1]:43411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt5R-0000mq-Ti for importer@patchew.org; Tue, 13 Mar 2018 19:12:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiP-00063F-64 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiN-0003qq-U1 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:17 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:37053) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiN-0003pT-K2 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:15 -0400 Received: by mail-wm0-x241.google.com with SMTP id 139so880543wmn.2 for ; Tue, 13 Mar 2018 15:48:15 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bWc+GVoGWITKLr4csFcP4vwWEVKwjo8x8/rRrTpyjQo=; b=kgoMYR7LKJqApyrAsPrV5jdc9eqaUrjZsmX6/vwoxaDW/eftkAGzTNemDza89tgI1j SbRmySe84GGcNHfL9enqL1QO5todZClzlrFA4y2OvaK+tQaBoHfF7KlrVV8IRjk5kFiJ d05xG8tWZ9v85cCXVvnOJdlrmnVpxJrirHinlNXIly7YYtboDiMsNMCpBOYA/HatD2PX T1b7YzallnyxNX3yDaiw2SJC495HOXqb8ofEE1J1BCK4x8H0gyz2Gr2svSXySICmFT2B +uGZvlXuJylK2ardF/5wLk1BvOB1Wv6ZnhJZ4T2Lhbd4pV/57ii2nU1tGf5/eHFbfBuK 0alQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=bWc+GVoGWITKLr4csFcP4vwWEVKwjo8x8/rRrTpyjQo=; b=dtsAzNWPQWLH5AJ0m6LNPgq6PcNciz9ufrpFCOyYv6xS4gjO5yQp8XHd2fu6MDr/GV rFSLzQW0VVtluQ3IWcBy7rkTtGKhUBxHLMKa5UyNGKzimvGH7NyCcLlEtwWXYTHdinWV URhSrQtQ9y3UPF3XGv/KdlWlv1qtvoYPRXhqHTnV3Usc2gu/OPTgUxy4kazvI87Z83yS 6zzw9Y5VHn+bVc4TX1fELBGVm4m/ufr6nkjBSSslHfGVpac/iYPooFcQpzCL5KEX/+Vy nN466uHgG9JTb4NE8lovypYiZMqzmdLRrnrIdush/NMIENiD6qja9+8/roCJcgSFVMD/ b2Xg== X-Gm-Message-State: AElRT7GzN8drX/3Db2qKiQgoIe0LTrkTIc7D5YnQRi9K88bQy2WVRfrT Ab8H4Yjrq877lhzQeGXvj5vc08Vz X-Google-Smtp-Source: AG47ELuWABWxKqy9xeZCrtyUkrROsrto1UgHhEPw9JYrHi9nhGYab3CbTHqODbdOKfNiRivQgZqjQA== X-Received: by 10.28.74.88 with SMTP id x85mr2139822wma.106.1520981293974; Tue, 13 Mar 2018 15:48:13 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:52 +0100 Message-Id: <20180313224719.4954-43-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 42/69] hw/isa/superio: Factor out the FDC37M817 Super I/O from mips_malta.c 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-17-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/isa-superio.c | 19 +++++++++++++++++++ hw/mips/mips_malta.c | 35 ++++++++++------------------------- include/hw/isa/superio.h | 2 ++ 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c index f98711beff..b95608a003 100644 --- a/hw/isa/isa-superio.c +++ b/hw/isa/isa-superio.c @@ -187,9 +187,28 @@ static const TypeInfo isa_superio_type_info =3D { .class_init =3D isa_superio_class_init, }; =20 +/* SMS FDC37M817 Super I/O */ +static void fdc37m81x_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); + + sc->serial.count =3D 2; /* NS16C550A */ + sc->parallel.count =3D 1; + sc->floppy.count =3D 1; /* SMSC 82077AA Compatible */ + sc->ide.count =3D 0; +} + +static const TypeInfo fdc37m81x_type_info =3D { + .name =3D TYPE_FDC37M81X_SUPERIO, + .parent =3D TYPE_ISA_SUPERIO, + .instance_size =3D sizeof(ISASuperIODevice), + .class_init =3D fdc37m81x_class_init, +}; + static void isa_superio_register_types(void) { type_register_static(&isa_superio_type_info); + type_register_static(&fdc37m81x_type_info); } =20 type_init(isa_superio_register_types) diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c index 9e0724ca5a..f6513a4fd5 100644 --- a/hw/mips/mips_malta.c +++ b/hw/mips/mips_malta.c @@ -27,14 +27,12 @@ #include "cpu.h" #include "hw/hw.h" #include "hw/i386/pc.h" +#include "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" -#include "sysemu/block-backend.h" #include "hw/block/flash.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" @@ -47,7 +45,6 @@ #include "hw/loader.h" #include "elf.h" #include "hw/timer/mc146818rtc.h" -#include "hw/input/i8042.h" #include "hw/timer/i8254.h" #include "sysemu/blockdev.h" #include "exec/address-spaces.h" @@ -1005,10 +1002,8 @@ void mips_malta_init(MachineState *machine) qemu_irq cbus_irq, i8259_irq; int piix4_devfn; I2CBus *smbus; - int i; DriveInfo *dinfo; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - DriveInfo *fd[MAX_FD]; int fl_idx =3D 0; int fl_sectors =3D bios_size >> 16; int be; @@ -1023,15 +1018,6 @@ void mips_malta_init(MachineState *machine) =20 qdev_init_nofail(dev); =20 - /* Make sure the first 3 serial ports are associated with a device. */ - for(i =3D 0; i < 3; i++) { - if (!serial_hds[i]) { - char label[32]; - snprintf(label, sizeof(label), "serial%d", i); - serial_hds[i] =3D qemu_chr_new(label, "null"); - } - } - /* create CPU */ mips_create_cpu(s, machine->cpu_type, &cbus_irq, &i8259_irq); =20 @@ -1067,7 +1053,14 @@ void mips_malta_init(MachineState *machine) #else be =3D 0; #endif + /* FPGA */ + + /* Make sure the second serial port is associated with a device. */ + if (!serial_hds[2]) { + serial_hds[2] =3D qemu_chr_new("fpga-uart", "null"); + } + /* The CBUS UART is attached to the MIPS CPU INT2 pin, ie interrupt 4 = */ malta_fpga_init(system_memory, FPGA_ADDRESS, cbus_irq, serial_hds[2]); =20 @@ -1214,16 +1207,8 @@ void mips_malta_init(MachineState *machine) smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size); g_free(smbus_eeprom_buf); =20 - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - - serial_hds_isa_init(isa_bus, 0, 2); - parallel_hds_isa_init(isa_bus, 1); - - for(i =3D 0; i < MAX_FD; i++) { - fd[i] =3D drive_get(IF_FLOPPY, 0, i); - } - fdctrl_init_isa(isa_bus, fd); + /* Super I/O: SMS FDC37M817 */ + isa_create_simple(isa_bus, TYPE_FDC37M81X_SUPERIO); =20 /* Network card */ network_init(pci_bus); diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index 3dd5448f8c..b47aac3cf8 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -54,4 +54,6 @@ typedef struct ISASuperIOClass { ISASuperIOFuncs ide; } ISASuperIOClass; =20 +#define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" + #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209828977151013.3966614591183; Tue, 13 Mar 2018 16:14:57 -0700 (PDT) Received: from localhost ([::1]:43423 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evt85-0002Vz-EO for importer@patchew.org; Tue, 13 Mar 2018 19:14:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiU-000691-2y for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiO-0003rz-U2 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38145) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiO-0003qz-Kn for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:16 -0400 Received: by mail-wm0-x241.google.com with SMTP id z9so879586wmb.3 for ; Tue, 13 Mar 2018 15:48:16 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hmkeF5g/Z+NcEqwRXCjIt/qPB92XGzX1qFist+bI9fM=; b=hp6yPw3t2jzNSA/nt3EPlBcCcCh2flpeknlBQD5LmrvBDh8tedFDtLQOjGvRDBjVJs YwpORrVeBYvXDaFdf5BwCZSHSLmHA96W21lwcs4WfJKhtHTP1cs6pPVyS6UOvtM7pBgS CYTfxAzC09MBlXcQH4ol7OWNt7VRoiSPOr2qdJFdRzNd7uVoEWQMk3jfSJlH6rqyKTdV 5VmQlFqyDGEKTSU3r32gkNSfCLhe5TfTnH8GuB/rFKIgXaUx/kQpQjYTtRp3I77dLt1o dNMUNfRBIkioGAWHQASckr8J9P6fmnJvDAEyrXNEFUyhVeNT0xW6/PseBKvYDAtF6co2 s/CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hmkeF5g/Z+NcEqwRXCjIt/qPB92XGzX1qFist+bI9fM=; b=dSo6yJiIZccE2dsNuTjS7Z3ew8XweoQGOZu2xwriA69bmF1f3FFcgSwb/csblrv7/O vq3clhvmZWMrmpB9KiXhxw+t+rk1y7spG+xibaW+yIMJkFfEyUDs0TP6+ztKt3xNiqoQ yKFSHD1VQPaJ+G3eEaGSrAbwO+kaxx8BQgbseWJqaAoIE5uhxdruldXLyavIiVLAWJFP I8IINFlMJEko4eaAKzt3E4q2pn2PbP+khUNcsw2Lec1PD41SiOPptnnJWPnhUQ11fJ29 v1yyAyg3oQFTfOZyFu45yeGFwaWQR3ukELO7TvZeRFUb7p1OfklIHeSBDMk6KVWLPJwm PQ8Q== X-Gm-Message-State: AElRT7GTVYGXWI4vYsep0jCh6vDh9bAen4SaKSL4a/orpVY5ol0MkhJ2 QsPFl+f+seWK5vwpa4wS0TLw8aL9 X-Google-Smtp-Source: AG47ELsSE1WbewzShQodsMw9zkvc1AVpam25eaCu0fzcpoRZLYiKyA/sCPlvXu40OhndXi0TXxbv+w== X-Received: by 10.28.8.201 with SMTP id 192mr2099468wmi.47.1520981295243; Tue, 13 Mar 2018 15:48:15 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:53 +0100 Message-Id: <20180313224719.4954-44-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 43/69] hw/mips/mips_fulong2e: Factor out vt82c686b_southbridge_init() 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-18-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/mips/mips_fulong2e.c | 83 ++++++++++++++++++++++++---------------------= ---- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index a15d3b60cc..2697d772eb 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -77,8 +77,6 @@ #define FULONG2E_ATI_SLOT 6 #define FULONG2E_RTL8139_SLOT 7 =20 -static ISADevice *pit; - static struct _loaderparams { int ram_size; const char *kernel_filename; @@ -231,11 +229,44 @@ static const uint8_t eeprom_spd[0x80] =3D { 0x20,0x30,0x20 }; =20 -/* Audio support */ -static void audio_init (PCIBus *pci_bus) +static void vt82c686b_southbridge_init(PCIBus *pci_bus, int slot, qemu_irq= intc, + I2CBus **i2c_bus, ISABus **p_isa_bu= s) { - vt82c686b_ac97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 5)); - vt82c686b_mc97_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 6)); + qemu_irq *i8259; + ISABus *isa_bus; + DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + + isa_bus =3D vt82c686b_init(pci_bus, PCI_DEVFN(slot, 0)); + if (!isa_bus) { + fprintf(stderr, "vt82c686b_init error\n"); + exit(1); + } + *p_isa_bus =3D isa_bus; + /* Interrupt controller */ + /* The 8259 -> IP5 */ + i8259 =3D i8259_init(isa_bus, intc); + isa_bus_irqs(isa_bus, i8259); + /* init other devices */ + i8254_pit_init(isa_bus, 0x40, 0, NULL); + i8257_dma_init(isa_bus, 0); + + ide_drive_get(hd, ARRAY_SIZE(hd)); + vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(slot, 1)); + + pci_create_simple(pci_bus, PCI_DEVFN(slot, 2), "vt82c686b-usb-uhci"); + pci_create_simple(pci_bus, PCI_DEVFN(slot, 3), "vt82c686b-usb-uhci"); + + *i2c_bus =3D vt82c686b_pm_init(pci_bus, PCI_DEVFN(slot, 4), 0xeee1, NU= LL); + + /* Audio support */ + vt82c686b_ac97_init(pci_bus, PCI_DEVFN(slot, 5)); + vt82c686b_mc97_init(pci_bus, PCI_DEVFN(slot, 6)); + + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_I8042); + + serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, 1); } =20 /* Network support */ @@ -268,11 +299,9 @@ static void mips_fulong2e_init(MachineState *machine) MemoryRegion *bios =3D g_new(MemoryRegion, 1); long bios_size; int64_t kernel_entry; - qemu_irq *i8259; PCIBus *pci_bus; ISABus *isa_bus; I2CBus *smbus; - DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; MIPSCPU *cpu; CPUMIPSState *env; =20 @@ -334,46 +363,16 @@ static void mips_fulong2e_init(MachineState *machine) /* North bridge, Bonito --> IP2 */ pci_bus =3D bonito_init((qemu_irq *)&(env->irq[2])); =20 - /* South bridge */ - ide_drive_get(hd, ARRAY_SIZE(hd)); - - isa_bus =3D vt82c686b_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 0)); - if (!isa_bus) { - error_report("vt82c686b_init error"); - exit(1); - } - - /* Interrupt controller */ - /* The 8259 -> IP5 */ - i8259 =3D i8259_init(isa_bus, env->irq[5]); - isa_bus_irqs(isa_bus, i8259); - - vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(FULONG2E_VIA_SLOT, 1)); - pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 2), - "vt82c686b-usb-uhci"); - pci_create_simple(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 3), - "vt82c686b-usb-uhci"); + /* South bridge -> IP5 */ + vt82c686b_southbridge_init(pci_bus, FULONG2E_VIA_SLOT, env->irq[5], + &smbus, &isa_bus); =20 - smbus =3D vt82c686b_pm_init(pci_bus, PCI_DEVFN(FULONG2E_VIA_SLOT, 4), - 0xeee1, NULL); /* TODO: Populate SPD eeprom data. */ smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd)); =20 - /* init other devices */ - pit =3D i8254_pit_init(isa_bus, 0x40, 0, NULL); - i8257_dma_init(isa_bus, 0); - - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - mc146818_rtc_init(isa_bus, 2000, NULL); =20 - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, 1); - - /* Sound card */ - audio_init(pci_bus); - /* Network card */ + /* Network card: RTL8139D */ network_init(pci_bus); } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983540959144.2985892070052; Tue, 13 Mar 2018 16:25:40 -0700 (PDT) Received: from localhost ([::1]:43490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtIa-00057J-3I for importer@patchew.org; Tue, 13 Mar 2018 19:25:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58425) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiU-00068z-2s for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiP-0003tT-Uw for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:38378) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiP-0003sO-OK for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:17 -0400 Received: by mail-wr0-x241.google.com with SMTP id l8so2547239wrg.5 for ; Tue, 13 Mar 2018 15:48:17 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=upSZFQiKB9xHfBmHKZ7i1f3Kcg0tut1l815AhW7rkcY=; b=YTSsaltGcNKtQJ4H9wEmNt5EXVm8l0kDG6D8jLDT4psCkkJt21TVf9f8mh1+bOecal LOdeTLGC6CVpQUQrT5kOb3/+RL92b8N8MWarSkzC8l4bw3jH0yWsjicjOEr6dVi8DPr4 ZwdAq/QNmuvjdYKWL2QBxaZt6O6/Xk0aIwCyem8G4hjtrO6rnnwP1P0Yl4EPUM+BmQha ca7L+Vf81n2V8WnMagjJNmxldCq7RoPLel+/2wHLjCwL+CNlSU3VBgZE8akoiepFzFCA C3XScXbvgsjHUJjTS3uFvokgK+EKHbkxXvbINDml/I9lW+rZsPj8I9Yd1OZnvpAvP32F MW0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=upSZFQiKB9xHfBmHKZ7i1f3Kcg0tut1l815AhW7rkcY=; b=iUDo2W2lN4QILXt6J+XlovVfFrrXBkZwQJbF2Wrvy35YFPuTpYQQIYGoiLLGEpugzX bZsE5is0s9SdwgUuuH0wY1ioVxaRSzYgv1c0YayUiiIfCdvaBtLVQF2be8IXSWyNcC/g VZMhZqctznq4+wVyBR48kG5ZemH+2ZL0P4RL/tTZUkns2KaIaN1ot9yhMJthWTElF7O7 scsyRethU0/Iv9VKnBDERIYsXwrz0/Cm/OkVbbvWK00AbKap7RwvQ+8IvdSPXAoI7lDt cy7b0kllEMf6bHcPUGU/F2oQJ49NxgtzHIrD0cbMixg/IuyEZvNZy3lZbxe/PfDMkQcL qJCw== X-Gm-Message-State: AElRT7EDtjJLYZcan5JriC1kReExDd7GWh82ogFYpkH8uSZ/8N233jUv BLlGh716pze7LL0ZFg9El4mT0cgo X-Google-Smtp-Source: AG47ELtk5g25N2QH46PHMHhuxZPWZa/QDqM2pSUjYiR9WuxFbTpO6qit9S0PAwn4Tg97KhHI2ZKh1g== X-Received: by 10.223.157.24 with SMTP id k24mr1921760wre.273.1520981296185; Tue, 13 Mar 2018 15:48:16 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:54 +0100 Message-Id: <20180313224719.4954-45-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 44/69] hw/isa/vt82c686: Rename vt82c686b_init() -> vt82c686b_isa_init() 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 This function only initialize the ISA bus. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-19-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/vt82c686.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- include/hw/isa/vt82c686.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 070cc1889f..7eaf3c7e8f 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -478,7 +478,7 @@ static void vt82c686b_realize(PCIDevice *d, Error **err= p) qemu_register_reset(vt82c686b_reset, d); } =20 -ISABus *vt82c686b_init(PCIBus *bus, int devfn) +ISABus *vt82c686b_isa_init(PCIBus *bus, int devfn) { PCIDevice *d; =20 diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 2697d772eb..b14dab8781 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -236,7 +236,7 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus,= int slot, qemu_irq intc, ISABus *isa_bus; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; =20 - isa_bus =3D vt82c686b_init(pci_bus, PCI_DEVFN(slot, 0)); + isa_bus =3D vt82c686b_isa_init(pci_bus, PCI_DEVFN(slot, 0)); if (!isa_bus) { fprintf(stderr, "vt82c686b_init error\n"); exit(1); diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index 471b5e9e53..db97c8ed7a 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -2,7 +2,7 @@ #define HW_VT82C686_H =20 /* vt82c686.c */ -ISABus *vt82c686b_init(PCIBus * bus, int devfn); +ISABus *vt82c686b_isa_init(PCIBus * bus, int devfn); void vt82c686b_ac97_init(PCIBus *bus, int devfn); void vt82c686b_mc97_init(PCIBus *bus, int devfn); I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098336717343.210696773664836; Tue, 13 Mar 2018 16:22:47 -0700 (PDT) Received: from localhost ([::1]:43470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtFi-00019k-PR for importer@patchew.org; Tue, 13 Mar 2018 19:22:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiU-00068o-1E for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiR-0003wZ-Bv for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34371) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiR-0003vR-57 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:19 -0400 Received: by mail-wm0-x244.google.com with SMTP id a20so16163387wmd.1 for ; Tue, 13 Mar 2018 15:48:18 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fsIp2Nv7x6GepK3jyHdbM7JBBrTAlyfnrLOIrDr58eY=; b=afagOQb2o9osGIZGzylmqqQsYX0I+YgRvoLVYsg55dIPCKQ9Ls/+B0aJI0dZd/FLkB U/tJ3BVCfZrzaIQu9BKqSfBNSrrlahhtbNHzhCIJ/J0mKg/r2+0rAGFk/rFIZscP7j9q Kzd84iuqbN3MFkBf8JU9+xMqW6sL5yeox09N7tmgHGnM/dA9NNxUvIYTMS35FTU0vWez scgotjosmo9fk5fiVejktLFfBs50qw4T1CBbBsc3MX5FIzHrNtajUHTWJHX0NJqG8o6C zGXGQ3tMJFAl98uADUYgcRYc+uJ8E+hoZHJpSWAoBiZ7Lz/lrODaaHdw08jNcc/7O7DD RXzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fsIp2Nv7x6GepK3jyHdbM7JBBrTAlyfnrLOIrDr58eY=; b=kFptrSAG7Uxw+52J61sVIoGXtbyKjRANH+ygt+bhYrfCeh5yhZ0eiR/BiGgurtOTpz IpdbhcN7AV+pau7TUSaUUFvo9VRbOnxjc4ICvzApWZ5dz2CfMLsUKl3/b0mI4O/+JlTt kqDfNO/aKinYlLQxjGg+6ULvz62Su+rz1qcTey8guANBVwaEOL+Ik7th7ldv+7wh+cg+ aVJIBolEfLHgH7ox9A8yDmGaNZxY05UhI/Na00PKOxMESrjLhKWUxDvNg7vuNgLlr+Dm BYr+0nEVFlePb3XtOq+a3O9OKM3tbTA4wo4P6X2K3nzv0VoUiVRMFvU7G0FSa2uvNsb5 IMbA== X-Gm-Message-State: AElRT7FMAjhV0NL7sE4O98VvruqAzzikMkZlrt3bUnq8CUTgURoC+KAx gt/IalIQ2gpyslMw1CyCUJOWV/qF X-Google-Smtp-Source: AG47ELuUNCoAyi19a6WF8Jk8cdQbZBeZ89LGILNcwrlMQ8484L2MFz40V6zYYTwXOLEmxVprxVeXWA== X-Received: by 10.28.17.77 with SMTP id 74mr2091152wmr.67.1520981297696; Tue, 13 Mar 2018 15:48:17 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:55 +0100 Message-Id: <20180313224719.4954-46-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 45/69] hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-20-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/isa/vt82c686.c | 20 ++++++++++++++++++++ hw/mips/mips_fulong2e.c | 15 +++------------ include/hw/isa/vt82c686.h | 2 ++ 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 7eaf3c7e8f..cff1946232 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -17,6 +17,7 @@ #include "hw/i2c/smbus.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" +#include "hw/isa/superio.h" #include "hw/sysbus.h" #include "hw/mips/mips.h" #include "hw/isa/apm.h" @@ -519,11 +520,30 @@ static const TypeInfo via_info =3D { }, }; =20 +static void vt82c686b_superio_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); + + sc->serial.count =3D 2; + sc->parallel.count =3D 1; + sc->ide.count =3D 0; + sc->floppy.count =3D 1; +} + +static const TypeInfo via_superio_info =3D { + .name =3D TYPE_VT82C686B_SUPERIO, + .parent =3D TYPE_ISA_SUPERIO, + .instance_size =3D sizeof(ISASuperIODevice), + .class_size =3D sizeof(ISASuperIOClass), + .class_init =3D vt82c686b_superio_class_init, +}; + static void vt82c686b_register_types(void) { type_register_static(&via_ac97_info); type_register_static(&via_mc97_info); type_register_static(&via_pm_info); + type_register_static(&via_superio_info); type_register_static(&via_info); } =20 diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index b14dab8781..02fb2fdcc4 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,9 +23,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/dma/i8257.h" -#include "hw/char/serial.h" -#include "hw/char/parallel.h" -#include "hw/block/fdc.h" +#include "hw/isa/superio.h" #include "net/net.h" #include "hw/boards.h" #include "hw/i2c/smbus.h" @@ -33,7 +31,6 @@ #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" #include "hw/pci/pci.h" -#include "sysemu/sysemu.h" #include "audio/audio.h" #include "qemu/log.h" #include "hw/loader.h" @@ -43,8 +40,6 @@ #include "hw/isa/vt82c686.h" #include "hw/timer/mc146818rtc.h" #include "hw/timer/i8254.h" -#include "hw/input/i8042.h" -#include "sysemu/blockdev.h" #include "exec/address-spaces.h" #include "sysemu/qtest.h" #include "qemu/error-report.h" @@ -249,6 +244,8 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus,= int slot, qemu_irq intc, /* init other devices */ i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(isa_bus, 0); + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_VT82C686B_SUPERIO); =20 ide_drive_get(hd, ARRAY_SIZE(hd)); vt82c686b_ide_init(pci_bus, hd, PCI_DEVFN(slot, 1)); @@ -261,12 +258,6 @@ static void vt82c686b_southbridge_init(PCIBus *pci_bus= , int slot, qemu_irq intc, /* Audio support */ vt82c686b_ac97_init(pci_bus, PCI_DEVFN(slot, 5)); vt82c686b_mc97_init(pci_bus, PCI_DEVFN(slot, 6)); - - /* Super I/O */ - isa_create_simple(isa_bus, TYPE_I8042); - - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, 1); } =20 /* Network support */ diff --git a/include/hw/isa/vt82c686.h b/include/hw/isa/vt82c686.h index db97c8ed7a..c3c2b6e786 100644 --- a/include/hw/isa/vt82c686.h +++ b/include/hw/isa/vt82c686.h @@ -1,6 +1,8 @@ #ifndef HW_VT82C686_H #define HW_VT82C686_H =20 +#define TYPE_VT82C686B_SUPERIO "vt82c686b-superio" + /* vt82c686.c */ ISABus *vt82c686b_isa_init(PCIBus * bus, int devfn); void vt82c686b_ac97_init(PCIBus *bus, int devfn); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983701499612.8974848417956; Tue, 13 Mar 2018 16:28:21 -0700 (PDT) Received: from localhost ([::1]:43506 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtLA-0008Iw-HR for importer@patchew.org; Tue, 13 Mar 2018 19:28:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiU-00068p-1U for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiS-0003xV-Da for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:38148) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiS-0003wn-6W for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:20 -0400 Received: by mail-wm0-x244.google.com with SMTP id z9so879748wmb.3 for ; Tue, 13 Mar 2018 15:48:20 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ReoCLOSD4hz9saNmTWLZlNgahKfJ1WJS0k3uV9wmmR8=; b=Y718qOuydY+Q3s2CGbjXlZpalVX381EO2VJEtWiZvXI6KGB7Fsf7FmIik644rBant7 jW2ZVPhj7aN2FE6dWeYtFbDMWufO6XiaHNF0gzyoA7Y1cLvSf76eFb3f8w5ntTEcdCbe cIK0IUi0UylHL8quSP/ZFUtUkkSI+GiFPu61jIsA1M0V/yISkIhE4WhXl8FUv0JqSG65 dqtubv7HurtdpQ2yK2jfl0cfKr+Ac6d5h1FLQmBEgqE4szeVpOkmKvSFU7DipntNxGF0 gSQf2EMIbAUD5NbZNykIlVh71p4Sa0yokRHxLQlQPRwLB+CI6lrica8EZ4LPUt3sIIz7 gJpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ReoCLOSD4hz9saNmTWLZlNgahKfJ1WJS0k3uV9wmmR8=; b=FLfa4N/8HTCr1ve/GNWf1+9u7d7ZyPV3qp1OTu0Ez5e0DdWDCGR/0VCghfR2hPA79k NqcAJ2DCrW+QvZTzQ1DYwrYpYyEIAQYDKvDihXEAYHPM0teQfsGpOvggKk2CAyX5XdbL TDbWZSEbgxckt4zYg8pW+zWjkdxuDCuena9AJLpV/kPZgLX/G3GsgR4FaRIv6EWi8H6T lBiAmwLH5j5eISXZmXml94bhHxBujLCQ4et7z1pwwC8IDIUBlXj+18V2yZ1PONCNyW8u LnL8mOwlFKLssBim/NdI2RfDKoeKHlDAJ2G7hUCc2EEFB5j/aAU0BbAz8eXXdnRGjy8Q Q29g== X-Gm-Message-State: AElRT7F9MV2bxQa5oOfIAGIZJfGHhbTKoDL1wsATWU2BiTJw4AjE/aJN M2inigKVKoiSL9zK4cOPRprisZdR X-Google-Smtp-Source: AG47ELvtSzbooeLAfRoLLkBwQ+S/BGvPInJdPRdr/b3AvCi+sZqR7MkR1hP3IbOStR9DvdIMiLIVbA== X-Received: by 10.28.20.84 with SMTP id 81mr2155394wmu.70.1520981298728; Tue, 13 Mar 2018 15:48:18 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:56 +0100 Message-Id: <20180313224719.4954-47-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 46/69] MAINTAINERS: Add entries for the VT82C686B Super I/O 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 So far, it is only used by the MIPS Fulong 2E mini PC. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-21-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 9f7b8e79c4..07684a1f2d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -700,6 +700,8 @@ Fulong 2E M: Yongbok Kim S: Odd Fixes F: hw/mips/mips_fulong2e.c +F: hw/isa/vt82c686.c +F: include/hw/isa/vt82c686.h =20 Boston M: Paul Burton --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983875010629.3769762137912; Tue, 13 Mar 2018 16:31:15 -0700 (PDT) Received: from localhost ([::1]:43523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtNp-0001US-Nn for importer@patchew.org; Tue, 13 Mar 2018 19:31:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58432) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiU-00069R-Fo for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiT-0003yL-HW for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:38148) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiT-0003xq-BK for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:21 -0400 Received: by mail-wm0-x243.google.com with SMTP id z9so879810wmb.3 for ; Tue, 13 Mar 2018 15:48:21 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s9HrRf4eQ8b2PjfUp9ocx+ygRVZAlb9mWlcK1+syrjI=; b=TeqzrJOIRrN0suHrl+t+GBHsAtOU5ETh38k3Z/GrBEnAAZPIMRaa3mcXpdgKmCtm20 /wrqbPfazSt14h9U2yEQEkhnKc2Aq9/VfS+WfoQAa5Lxy4bMd1e1J/PmZj5Vb4+Jd0BW k/ocWr4sh5jj7yJxQ9uscqxL+00UAPc2aNHkD/zYMMaDNhbySn3J/wWVTlDoIhowI/pX 5DDPm3n31G/8By9ieEmlFOgq0P4iD4oQWhARIJkv7O49NgoSkXU6QuXoqbJ4x7qzK+DR g+dM83L8Wme84XJcFK0B9Z3N819WBhnaZ5CVvCaTP6BSVu+zrYlGQCs3BffkTB8aMLFk 0hYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=s9HrRf4eQ8b2PjfUp9ocx+ygRVZAlb9mWlcK1+syrjI=; b=BnRzJjIWVdv3Ro3r7tJjq1lrm7E3SF/tg3i1FSf6FF7QigNssL6RrONbJyqu1SyKmf wjjqRkHe04rCRphS0WODhUa6KWUAcjgdqrc6ap26G6773PsieCs9L76EDnCdtLkjQmEz QnJITq8zkRlpunBtiiXawgGsY24zntRNPzpnHI1zgmwelCUFvUlkYTrA8wvclTbw/kMQ qQ/XMFd1PD4x7/TlB9iheqaTgb8ZzBhiC5E8Xu9C2LEihvhWHvHEzS4EPrhmVedE6kCv YswY6UmuecdcL6vJJ/C2ZyoHU49BIVpphnUqLsc+p+YcLkYTiZstAY8g9HWiR9F201ea /55w== X-Gm-Message-State: AElRT7GsHIKSHQPgZPgJrjxFYJ2azPkI+YI+Arucpxyd7ntkWvcD3HR5 jDGFoBX0O+HtfvKrGVDVtynMrQdz X-Google-Smtp-Source: AG47ELvth8FDMJl56/2+QugfExuH0HAhaBiYVXDsCbhgEOhAjGc29G6ZqPMivsoMeGRdCoNKiM7LNA== X-Received: by 10.28.54.11 with SMTP id d11mr1221000wma.104.1520981299974; Tue, 13 Mar 2018 15:48:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:57 +0100 Message-Id: <20180313224719.4954-48-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 47/69] MAINTAINERS: Split the Alpha TCG/machine section 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-22-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 07684a1f2d..b17324107f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -127,7 +127,6 @@ Alpha M: Richard Henderson S: Maintained F: target/alpha/ -F: hw/alpha/ F: tests/tcg/alpha/ F: disas/alpha.c =20 @@ -413,6 +412,11 @@ F: include/*/*win32* X: qga/*win32* F: qemu.nsi =20 +Alpha Machines +M: Richard Henderson +S: Maintained +F: hw/alpha/ + ARM Machines ------------ Allwinner-a10 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983703214284.24331379404; Tue, 13 Mar 2018 16:28:23 -0700 (PDT) Received: from localhost ([::1]:43505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtL3-0008BQ-2y for importer@patchew.org; Tue, 13 Mar 2018 19:28:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58470) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiW-0006BW-9e for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiV-0003zn-1x for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:24 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:33975) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiU-0003yj-Nk for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:22 -0400 Received: by mail-wr0-x243.google.com with SMTP id o8so2598942wra.1 for ; Tue, 13 Mar 2018 15:48:22 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M1zhUfv16YFP019e1YEXTyAoKHVM5Bbw3qs3fjbc1UY=; b=SUCeoseqbKJEBSmWHzNM6R7k7d7PhJgpyj4lNL0edV4nIoytfGerJxMETCzcY+szIm +qdYynIqM7rqdI0FFmBz3WH10I9s2Ehqxpr6kZ8T74hPrAlyOREeIvGoWvl2gPuyVxkB HMGo5T9UZpGdDJH2rcnCjgziQEuG+l6NGHGtpKazpi4EbZ5+YQIDDqFrb2B2wgCJgJXy qF/MHqEY3YCmm2kz6T7jeF2s1t0e6ZwpdsAx2hTXH8KsBTDjk9GRUANF+Q28EjWTU+7M bFImM+59Ru+613BL3XZLArPbIlyRH5t0f1o6pCJJ2rDfBv75iCLWPTb4L/9b+GQoKB5a Q3Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=M1zhUfv16YFP019e1YEXTyAoKHVM5Bbw3qs3fjbc1UY=; b=t0GWutv/fbSjzBP2FFpwNH/tt5z9zwBS0tPuWyM+i0mFZe4ig12Un5dCnhHpxWbi3w E4dRbNvDdNNFCYlV52kwL+JgisAKKeZQzbdTBTGsabPUpXvP7JYFgn8j8Z4NtZJgG9om q1zw7o6c+bObufWWRz10cg7tXwBN1G0wYG/T86qeJTfX8kMOsQ79snEcVDDNC5Q4TMJn wpY0gvm/c50qRBe2H0wyM1uNWvAftwl4pu+eYm89kczD0dTxoOksF1Thf9Z9BCpvVaW7 aUdz2fRRbR7gLme5Kloj0JE2U4MYN0Noy5naknk+jxhrs87IJNatr2rHj3F5cJv4Yfzz Y7Pg== X-Gm-Message-State: AElRT7GDUp6slG7PotugT/J66pvpYUNUGsDHEdbVPZ7/jwsjYiKOmYhI qTJs4RgRDjdAt7OgISuGpjF0P8AM X-Google-Smtp-Source: AG47ELszzIxmz8UASboFD3lxPwg9INDO77F6VWx7FwnZebVidJYNEVYlumHxAepnRkN3GWHpYVgZvQ== X-Received: by 10.223.135.26 with SMTP id a26mr1986436wra.211.1520981301026; Tue, 13 Mar 2018 15:48:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:58 +0100 Message-Id: <20180313224719.4954-49-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 48/69] hw/isa/superio: Add the SMC FDC37C669 Super I/O 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-23-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + hw/isa/Makefile.objs | 2 +- hw/isa/smc37c669-superio.c | 115 +++++++++++++++++++++++++++++++++++++++++= ++++ include/hw/isa/superio.h | 1 + 4 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 hw/isa/smc37c669-superio.c diff --git a/MAINTAINERS b/MAINTAINERS index b17324107f..216d01efd6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -416,6 +416,7 @@ Alpha Machines M: Richard Henderson S: Maintained F: hw/alpha/ +F: hw/isa/smc37c669-superio.c =20 ARM Machines ------------ diff --git a/hw/isa/Makefile.objs b/hw/isa/Makefile.objs index cac655ba58..83e06f6c04 100644 --- a/hw/isa/Makefile.objs +++ b/hw/isa/Makefile.objs @@ -1,5 +1,5 @@ common-obj-$(CONFIG_ISA_BUS) +=3D isa-bus.o -common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o +common-obj-$(CONFIG_ISA_BUS) +=3D isa-superio.o smc37c669-superio.o common-obj-$(CONFIG_APM) +=3D apm.o common-obj-$(CONFIG_I82378) +=3D i82378.o common-obj-$(CONFIG_PC87312) +=3D pc87312.o diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c new file mode 100644 index 0000000000..aa233c6967 --- /dev/null +++ b/hw/isa/smc37c669-superio.c @@ -0,0 +1,115 @@ +/* + * SMC FDC37C669 Super I/O controller + * + * Copyright (c) 2018 Philippe Mathieu-Daud=C3=A9 + * + * This code is licensed under the GNU GPLv2 and later. + * See the COPYING file in the top-level directory. + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/isa/superio.h" + +/* UARTs (compatible with NS16450 or PC16550) */ + +static bool is_serial_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 2; +} + +static uint16_t get_serial_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return index ? 0x2f8 : 0x3f8; +} + +static unsigned int get_serial_irq(ISASuperIODevice *sio, uint8_t index) +{ + return index ? 3 : 4; +} + +/* Parallel port */ + +static bool is_parallel_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 1; +} + +static uint16_t get_parallel_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return 0x3bc; +} + +static unsigned int get_parallel_irq(ISASuperIODevice *sio, uint8_t index) +{ + return 7; +} + +static unsigned int get_parallel_dma(ISASuperIODevice *sio, uint8_t index) +{ + return 3; +} + +/* Diskette controller (Software compatible with the Intel PC8477) */ + +static bool is_fdc_enabled(ISASuperIODevice *sio, uint8_t index) +{ + return index < 1; +} + +static uint16_t get_fdc_iobase(ISASuperIODevice *sio, uint8_t index) +{ + return 0x3f0; +} + +static unsigned int get_fdc_irq(ISASuperIODevice *sio, uint8_t index) +{ + return 6; +} + +static unsigned int get_fdc_dma(ISASuperIODevice *sio, uint8_t index) +{ + return 2; +} + +static void smc37c669_class_init(ObjectClass *klass, void *data) +{ + ISASuperIOClass *sc =3D ISA_SUPERIO_CLASS(klass); + + sc->parallel =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_parallel_enabled, + .get_iobase =3D get_parallel_iobase, + .get_irq =3D get_parallel_irq, + .get_dma =3D get_parallel_dma, + }; + sc->serial =3D (ISASuperIOFuncs){ + .count =3D 2, + .is_enabled =3D is_serial_enabled, + .get_iobase =3D get_serial_iobase, + .get_irq =3D get_serial_irq, + }; + sc->floppy =3D (ISASuperIOFuncs){ + .count =3D 1, + .is_enabled =3D is_fdc_enabled, + .get_iobase =3D get_fdc_iobase, + .get_irq =3D get_fdc_irq, + .get_dma =3D get_fdc_dma, + }; + sc->ide.count =3D 0; +} + +static const TypeInfo smc37c669_type_info =3D { + .name =3D TYPE_SMC37C669_SUPERIO, + .parent =3D TYPE_ISA_SUPERIO, + .instance_size =3D sizeof(ISASuperIODevice), + .class_size =3D sizeof(ISASuperIOClass), + .class_init =3D smc37c669_class_init, +}; + +static void smc37c669_register_types(void) +{ + type_register_static(&smc37c669_type_info); +} + +type_init(smc37c669_register_types) diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h index b47aac3cf8..f9ba29aa30 100644 --- a/include/hw/isa/superio.h +++ b/include/hw/isa/superio.h @@ -55,5 +55,6 @@ typedef struct ISASuperIOClass { } ISASuperIOClass; =20 #define TYPE_FDC37M81X_SUPERIO "fdc37m81x-superio" +#define TYPE_SMC37C669_SUPERIO "smc37c669-superio" =20 #endif /* HW_ISA_SUPERIO_H */ --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983536552327.8482553120108; Tue, 13 Mar 2018 16:25:36 -0700 (PDT) Received: from localhost ([::1]:43487 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtIQ-0004sZ-ST for importer@patchew.org; Tue, 13 Mar 2018 19:25:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiW-0006Br-Fo for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiV-00040F-JJ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:24 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:36937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiV-0003zY-C0 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:23 -0400 Received: by mail-wr0-x243.google.com with SMTP id z12so2563527wrg.4 for ; Tue, 13 Mar 2018 15:48:23 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E2kNX/klygRs2q8tBXHtfuOhrrcDHdBSUrDH2R15Sj8=; b=rVNYficBlt9cz67rs+U3pZgln2n5+mVPBLHgVY52wnL+ou2y0C7HA2uV1T06Uo/Wzr gkYPJlBWbmfHgLkzp9jCpcGmhc3YIHOHkJ0e1qP1G1kD0rtUQOX+7839SDuKLLGGPMUL 7gcSmhAh6v1OFt0m04iW4GXZfIPG4NsCgY9aPrif0yotsBtY2sZL0cGmHaGlUhC3DYVB nu9fONurPhJ+sZ9d7jesS7FpM390qY2nQmj+kCMAR1Zm96YUV2S8cF9kuoeraODqO4A7 Qn9lujiCltmujFTspCvRCeeIE5a4U6Ci90eSwHSWRm3DHiDKLP2Sb35eutgS/TXu7yQh 2Nxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=E2kNX/klygRs2q8tBXHtfuOhrrcDHdBSUrDH2R15Sj8=; b=IUvfcoEQPQ/mJHr+qsOOjMKK4BxoRc8cOq8ofTU120b0P+Gjc0xmzX5X7XijWqPCnr 3eesbaub0vtFrhajZMlmcI3oavvUplOBMVLKnElkcaJ35tpNWpwVQ71Y+BWAcgAOjKsS bkH5SVbmqUlezqJIzeatlXLCltwNuf6YucE2Wj50S19g+VmKQms9Dd1JtYebjsFb8KWc ry1rTiWQouKqI6uMdxuim5jEd/6T8lPT1fXzoJ8gdjVic5VHzTkkp/nsZR6YTbVvFV4+ NA26K5uDLJtphumtRfqHz3aRcrEx+2Mod/mO/oW9FLzqa1WPqD1AMVZRXRdfnkfZhK4+ hLqA== X-Gm-Message-State: AElRT7HcXwAOFJYh4x6uRgqHWiQTPgyI+1E3P1K9bdM0qrIvb3QO6mF6 THO/+IQAkub4xu6mN00LmvR3Mm2k X-Google-Smtp-Source: AG47ELuwvGTguiGQcP1x1+5FTCTCu3JJdRJja8DeN0pIr8+Qqd8WYia2T39Q33PEklaPkyq0ncP30A== X-Received: by 10.223.132.103 with SMTP id 94mr1855641wrf.275.1520981301999; Tue, 13 Mar 2018 15:48:21 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:59 +0100 Message-Id: <20180313224719.4954-50-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 49/69] hw/alpha/dp264: Add the ISA DMA controller 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-24-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- default-configs/alpha-softmmu.mak | 2 ++ hw/alpha/dp264.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-soft= mmu.mak index e0d75e3058..3740adc5e9 100644 --- a/default-configs/alpha-softmmu.mak +++ b/default-configs/alpha-softmmu.mak @@ -4,7 +4,9 @@ include pci.mak include usb.mak CONFIG_SERIAL=3Dy CONFIG_SERIAL_ISA=3Dy +CONFIG_I82374=3Dy CONFIG_I8254=3Dy +CONFIG_I8257=3Dy CONFIG_PCKBD=3Dy CONFIG_VGA_CIRRUS=3Dy CONFIG_IDE_CORE=3Dy diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index e13cb576fd..ffad678ea7 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -21,6 +21,7 @@ #include "hw/timer/i8254.h" #include "hw/input/i8042.h" #include "hw/char/serial.h" +#include "hw/dma/i8257.h" #include "qemu/cutils.h" =20 #define MAX_IDE_BUS 2 @@ -95,6 +96,9 @@ static void clipper_init(MachineState *machine) pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); } =20 + /* 2 82C37 (dma) */ + isa_create_simple(isa_bus, "i82374"); + /* IDE disk setup. */ { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984062606790.399266320213; Tue, 13 Mar 2018 16:34:22 -0700 (PDT) Received: from localhost ([::1]:43536 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtQz-0003uE-Pn for importer@patchew.org; Tue, 13 Mar 2018 19:34:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiX-0006Cz-GZ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiW-000416-Ls for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:25 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:51060) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiW-00040N-ET for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:24 -0400 Received: by mail-wm0-x242.google.com with SMTP id w128so869810wmw.0 for ; Tue, 13 Mar 2018 15:48:24 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0E9eeR2DIbZwar82apkB3N6g1950iHi59y2WLzde1RM=; b=nabVJL/kZP2PnjsQjRj86AMmdmPGZ1hnq3PVeVHPRCn4YbOduK0RX8ckTI6mUO5dBN kfku4nMWgWKDCyzIxz58ANEg8Fln1qaYte1ikB6YyLkIG+zDCe6WS+UZ5BxlYVObo/fC C7wVqGABmAwl1l7SNPXtgZS2CzG+lYZjUz6jxJcfhYLZeIYrx/h7+E/AdS+pSZCGf4vP obBnKzz0ot/AHymuStpsDTsas4bLhFnpy2RtfU6dGA0vkOD8B/DmOsW4cMojIy/CbA3j cNFuJvwWDxwXF32v+Dy7cOTVfrCHCGQIwMeva74ql+qGFb0XLRJ6lhmIeO4+BYHGD0hY tXiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0E9eeR2DIbZwar82apkB3N6g1950iHi59y2WLzde1RM=; b=GuZDPuO4a3hNUkDLyrt+eZaxon/4HKz1mFAXzgFgQyQmlFCKMihmX0RHy6ytCLcrk2 pH+48LplfX8weJRQ5EraZ+rh2AEbqAF7FUk3r3bwlhjgPywrWA0JAYAvDVpj8890FxXy 5U2YccRTfzmlFIKqVEpB3DoPl+X9woNURW3kyMFRT6PJXHf7k/CouGSHvcE+gIp0eWXu 88JNg+P4A79XzInzAr9FPtZzFcS/Z0Jz2Th5LH9wI5GwER+aGRZv8YZIcF+Ef7MBe3iU mX1SZS16cpKZpbfapfFEmnZQxRjOiNC8WX8fkaxCQGpMV28DwzwFyMlWanFIpbKzN2wZ l6Vg== X-Gm-Message-State: AElRT7GhpBo2wCY8/jewyLBbhg0qOy+QRZtaWVXYeAembtX3W8x9oSu6 la/q1yfJHf/EIedPbkC9uG8ifZ/4 X-Google-Smtp-Source: AG47ELttB8pPQKTMHt8Y5bIcbVvu2NmB0bfW7I358k9ouWkA94apPF4x4QVn44EpdWicrexy9Ocmrw== X-Received: by 10.28.16.21 with SMTP id 21mr2075851wmq.109.1520981302994; Tue, 13 Mar 2018 15:48:22 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:00 +0100 Message-Id: <20180313224719.4954-51-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 50/69] hw/alpha/dp264: Use the TYPE_SMC37C669_SUPERIO 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-25-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- default-configs/alpha-softmmu.mak | 3 +++ hw/alpha/dp264.c | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/default-configs/alpha-softmmu.mak b/default-configs/alpha-soft= mmu.mak index 3740adc5e9..bbe361f01a 100644 --- a/default-configs/alpha-softmmu.mak +++ b/default-configs/alpha-softmmu.mak @@ -7,6 +7,9 @@ CONFIG_SERIAL_ISA=3Dy CONFIG_I82374=3Dy CONFIG_I8254=3Dy CONFIG_I8257=3Dy +CONFIG_PARALLEL=3Dy +CONFIG_PARALLEL_ISA=3Dy +CONFIG_FDC=3Dy CONFIG_PCKBD=3Dy CONFIG_VGA_CIRRUS=3Dy CONFIG_IDE_CORE=3Dy diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index ffad678ea7..80b987f7fb 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -19,8 +19,7 @@ #include "hw/timer/mc146818rtc.h" #include "hw/ide.h" #include "hw/timer/i8254.h" -#include "hw/input/i8042.h" -#include "hw/char/serial.h" +#include "hw/isa/superio.h" #include "hw/dma/i8257.h" #include "qemu/cutils.h" =20 @@ -83,14 +82,10 @@ static void clipper_init(MachineState *machine) mc146818_rtc_init(isa_bus, 1900, rtc_irq); =20 i8254_pit_init(isa_bus, 0x40, 0, NULL); - isa_create_simple(isa_bus, TYPE_I8042); =20 /* VGA setup. Don't bother loading the bios. */ pci_vga_init(pci_bus); =20 - /* Serial code setup. */ - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - /* Network setup. e1000 is good enough, failing Tulip support. */ for (i =3D 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL); @@ -99,6 +94,9 @@ static void clipper_init(MachineState *machine) /* 2 82C37 (dma) */ isa_create_simple(isa_bus, "i82374"); =20 + /* Super I/O */ + isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO); + /* IDE disk setup. */ { DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983080163593.7858506944966; Tue, 13 Mar 2018 16:18:00 -0700 (PDT) Received: from localhost ([::1]:43442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtB5-0004lZ-7e for importer@patchew.org; Tue, 13 Mar 2018 19:17:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58511) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiY-0006E4-Kd for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiX-00041v-M2 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:26 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33099) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiX-00041M-Fe for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:25 -0400 Received: by mail-wm0-x242.google.com with SMTP id s206so16180520wme.0 for ; Tue, 13 Mar 2018 15:48:25 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sUaSHlyaLBBpkK2BkO2inVTuimuRwxYimBfjFsFjvok=; b=rrfubew7IgyCA6orNxNx5ycMU4DCpjIL99CtUxBY2u6+IU5wgzd76UzuAU0ZnxJQ4T H9puWq2fYbcAjlHlWPhfiYsmu8hoVyofe3w2D1LsdJhbGnu9daWPf+aJML4+N79EBHPb aKY4b6ttKYHF16J/46DHtLKc/HdaH+70rpe0dEPafF1kbQa6JYVHpHIInsjOnPHrr8lQ GSYOFFQ+vEZqH9TF2KZhEGsS30nYi9n+xNQwl/IW2NqGCQd6JPK2Xqe8oZgrA1dm1JOL F7HHri5VeDXlZ5y54GLyFZdDJ09SMbj2kvMgb8OWL9kosRVWSQppaQKk1gUgMXICsENb iHqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=sUaSHlyaLBBpkK2BkO2inVTuimuRwxYimBfjFsFjvok=; b=Nfjyl/3n6SGYUv5ujDmrQPa/Abb5stsDTebfEZBuXN9KPDWEyeO9J0nmrCt2K5wD6v kSZd8V0IdClKnqFz0w0LZm2ZRy1C+bLUN5oHuwvfaiZWf4imtb855xUAWY276f/5FbXp bPKWwCkek2caxRaGZAmIspxaOUV86t6saCWhap5OTaCf17MXcijEl19OdVBj13OfFsUQ hkmvjqvkdI/WORXUOtvQw8z8zjT45m2kXhWWQPpKWCgI2QTBrNLS8xqdK3ql9ZEuhlE8 kJiYHrpxmd5N+EEGPD+gTAB0kTfjXPX7SaSsUYRp5RFlV/9SeyVPP+4KGSBIciRH96lw HEaw== X-Gm-Message-State: AElRT7E7GLxtEz4ARBNCJGrVWhyZvevPyjkk+kX9nepxA/eXotktisTG nJv7YcusNiusvY+L8D9zEqpJf1Yj X-Google-Smtp-Source: AG47ELu2r1hbDbmJu+wgJDmEECe+h3ELQLVcOM9Te3Fx8P6H+RfuiV0+rkv6JbYhOsAYTfKFr7qiCQ== X-Received: by 10.28.144.82 with SMTP id s79mr1944524wmd.4.1520981304024; Tue, 13 Mar 2018 15:48:24 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:01 +0100 Message-Id: <20180313224719.4954-52-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 51/69] hw/i386/pc: Factor out the superio code 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=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20180308223946.26784-26-f4bug@amsat.org> Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 72 ++++++++++++++++++++++++++++++++++----------------------= ---- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 853a01d791..d36bac8c89 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1517,6 +1517,44 @@ static const MemoryRegionOps ioportF0_io_ops =3D { }, }; =20 +static void pc_superio_init(ISABus *isa_bus, bool create_fdctrl, bool no_v= mport) +{ + int i; + DriveInfo *fd[MAX_FD]; + qemu_irq *a20_line; + ISADevice *i8042, *port92, *vmmouse; + + serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); + parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); + + for (i =3D 0; i < MAX_FD; i++) { + fd[i] =3D drive_get(IF_FLOPPY, 0, i); + create_fdctrl |=3D !!fd[i]; + } + if (create_fdctrl) { + fdctrl_init_isa(isa_bus, fd); + } + + i8042 =3D isa_create_simple(isa_bus, "i8042"); + if (!no_vmport) { + vmport_init(isa_bus); + vmmouse =3D isa_try_create(isa_bus, "vmmouse"); + } else { + vmmouse =3D NULL; + } + if (vmmouse) { + DeviceState *dev =3D DEVICE(vmmouse); + qdev_prop_set_ptr(dev, "ps2_mouse", i8042); + qdev_init_nofail(dev); + } + port92 =3D isa_create_simple(isa_bus, "port92"); + + a20_line =3D qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); + i8042_setup_a20_line(i8042, a20_line[0]); + port92_init(port92, a20_line[1]); + g_free(a20_line); +} + void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, bool create_fdctrl, @@ -1525,13 +1563,11 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq= *gsi, uint32_t hpet_irqs) { int i; - DriveInfo *fd[MAX_FD]; DeviceState *hpet =3D NULL; int pit_isa_irq =3D 0; qemu_irq pit_alt_irq =3D NULL; qemu_irq rtc_irq =3D NULL; - qemu_irq *a20_line; - ISADevice *i8042, *port92, *vmmouse, *pit =3D NULL; + ISADevice *pit =3D NULL; MemoryRegion *ioport80_io =3D g_new(MemoryRegion, 1); MemoryRegion *ioportF0_io =3D g_new(MemoryRegion, 1); =20 @@ -1588,36 +1624,10 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq= *gsi, pcspk_init(isa_bus, pit); } =20 - serial_hds_isa_init(isa_bus, 0, MAX_SERIAL_PORTS); - parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS); - - a20_line =3D qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); - i8042 =3D isa_create_simple(isa_bus, "i8042"); - i8042_setup_a20_line(i8042, a20_line[0]); - if (!no_vmport) { - vmport_init(isa_bus); - vmmouse =3D isa_try_create(isa_bus, "vmmouse"); - } else { - vmmouse =3D NULL; - } - if (vmmouse) { - DeviceState *dev =3D DEVICE(vmmouse); - qdev_prop_set_ptr(dev, "ps2_mouse", i8042); - qdev_init_nofail(dev); - } - port92 =3D isa_create_simple(isa_bus, "port92"); - port92_init(port92, a20_line[1]); - g_free(a20_line); - i8257_dma_init(isa_bus, 0); =20 - for(i =3D 0; i < MAX_FD; i++) { - fd[i] =3D drive_get(IF_FLOPPY, 0, i); - create_fdctrl |=3D !!fd[i]; - } - if (create_fdctrl) { - fdctrl_init_isa(isa_bus, fd); - } + /* Super I/O */ + pc_superio_init(isa_bus, create_fdctrl, no_vmport); } =20 void pc_nic_init(PCMachineClass *pcmc, ISABus *isa_bus, PCIBus *pci_bus) --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983859346464.18701945227804; Tue, 13 Mar 2018 16:30:59 -0700 (PDT) Received: from localhost ([::1]:43522 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtNi-0001OB-BJ for importer@patchew.org; Tue, 13 Mar 2018 19:30:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiZ-0006FI-Ka for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiY-00042h-LG for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:27 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:54943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiY-000427-Do for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:26 -0400 Received: by mail-wm0-x244.google.com with SMTP id h76so872307wme.4 for ; Tue, 13 Mar 2018 15:48:26 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dEqAtHiYGIMCeu4sUlZ5EN0affr9x1E9X7PP6TWOz7E=; b=uZ/wTptQvFl2AFrd/PQ1/e/AlKqFy4cxyNF9v4UXdLQsyXikJV/Rn1tDcctcX+yQ4+ mGDOohrx8hg9Cng2LCP2FzL4tzt0QxSke43dhnteUhEpcaGpXySKB9cEis+NBOlWNL/t PW5TbYaDpR9TGnDvjifg8XEIZpKs7Kc3Z6QgutHQ8Vjr3BnHSdLC8lpEl69DuZSshPdw 6SuFCuKQU5ZZLM7BEF38t4JKSm/4CkSZ2kkNPtLI5/zIGh/ZvT9icYkrZVoRVvj49qDL q9msG6yvuVxNvcXWbiwnACr682yvUcmL9RrxQ+74580mOqQEeGsbqEDmhFqXgSrp6diW lhSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dEqAtHiYGIMCeu4sUlZ5EN0affr9x1E9X7PP6TWOz7E=; b=ROBykS1dGtXQyb2qI6tj/zyl0Zec9v0DIuYVkhp2DqhvobRLfZNK5fqiCCO986U0e4 mrAgiVZEsCLMN2iZZ1/VSqQJizVOczKP1eis6JMSqOdw4kcJHwVhB1HfA78MgsDF2AmD Ws8LrkmkhooWs0CuEFeGlkfg2R1AF/Y4nMM98zz5rnmGkvZcTKDnxfYLKnhIOFpQFQUU PNIx/qLQBwe9lqXZoTLsttGKrKHnfpSMushzzA1opaymUk4zrjLLVU9mzMiEXt3AFJhM HyBFp2RUNd1i/Y4SJOHHwXaa1YMSf7q1AvbHlqFw6hDJy+oXrDV1MvTmfwjf2fyfxIsc kHvg== X-Gm-Message-State: AElRT7HNTo8e4inxNCLDEwoQPYsXubNNWj6kOSlrquqq2pkFB5ovNkVi 05MnEml9Q+FO/W5kcEKWd30Z3dnt X-Google-Smtp-Source: AG47ELvcU1zV4X9vIOjLeYBoIiZ1NLD4LVgqyAR+D5maaftNqUB56vay9y241mm4jf4yb/zWbi3Vkg== X-Received: by 10.28.51.67 with SMTP id z64mr1966209wmz.59.1520981305057; Tue, 13 Mar 2018 15:48:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:02 +0100 Message-Id: <20180313224719.4954-53-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 52/69] cpu-exec: fix exception_index handling 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Function cpu_handle_interrupt calls cc->cpu_exec_interrupt to process pending hardware interrupts. Under the hood cpu_exec_interrupt uses cpu->exception_index to pass information to the internal function which is usually common for exception and interrupt processing. But this value is not reset after return and may be processed again by cpu_handle_exception. This does not happen due to overwriting the exception_index at the end of cpu_handle_interrupt. But this branch may also overwrite the valid exception_index in some cases. Therefore this patch: 1. resets exception_index just after the call to cpu_exec_interrupt 2. prevents overwriting the meaningful value of exception_index Signed-off-by: Pavel Dovgalyuk Signed-off-by: Paolo Bonzini Message-Id: <20180227095140.1060.61357.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- accel/tcg/cpu-exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 280200f737..9cc697205c 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -585,6 +585,7 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, else { if (cc->cpu_exec_interrupt(cpu, interrupt_request)) { replay_interrupt(); + cpu->exception_index =3D -1; *last_tb =3D NULL; } /* The target hook may have updated the 'cpu->interrupt_reques= t'; @@ -606,7 +607,9 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, if (unlikely(atomic_read(&cpu->exit_request) || (use_icount && cpu->icount_decr.u16.low + cpu->icount_extra =3D= =3D 0))) { atomic_set(&cpu->exit_request, 0); - cpu->exception_index =3D EXCP_INTERRUPT; + if (cpu->exception_index =3D=3D -1) { + cpu->exception_index =3D EXCP_INTERRUPT; + } return true; } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983258980859.2976414230397; Tue, 13 Mar 2018 16:20:58 -0700 (PDT) Received: from localhost ([::1]:43460 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtDy-0007eN-PK for importer@patchew.org; Tue, 13 Mar 2018 19:20:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsie-0006Ig-6P for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiZ-00043W-Jy for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:31 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:54941) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsiZ-00042y-CY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:27 -0400 Received: by mail-wm0-x241.google.com with SMTP id h76so872351wme.4 for ; Tue, 13 Mar 2018 15:48:27 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=gQDAssWwvpvTdPo4MmLUEmGj1LK/+5tdRoynRD0rk6Y=; b=pUX3j9rADtOpNoLFPE52e8zjE5Rt1p9ZGjKMkAeLUMU/LDX8HcuSpSskVHt/+7z00R kvU/Ekp/RDqoP0+uflJalt7K1Wgcw81XBY16v+uxS9g/r5zHa/uC6G+hYzh2vyZH2S7j ZQR/0elhCcbVwyJSvNLP2pRGu0BxIQI/Y+vJIaXSByRVmeLlopDvfSyIlSpwaZSSxKkc 5dCqm0Mq2Dc9eGdO8LGsghOBxLzA7dKUJr2iaPz84ZGMSIu4uZdtyHpwWux6dkipQdnI bjGpzgcObRUPXcllAOjBmkAwCBN36Cjm/XVj0cH1cM7jWXo7lRgT7prkxfOIkt4SYM3p cp0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=gQDAssWwvpvTdPo4MmLUEmGj1LK/+5tdRoynRD0rk6Y=; b=PsfL1Nte2LD3L9yWfMirKv3qJ11fuPpoQflZtRghAsv8fxRLhw0fdFwL22CRwFqreZ NtJ6JMo8ylfIs5fp3upoKWsXrzD9ox/jQx/HocZ0/hHgIXTLSXWVx21TzGPne9ZtTrsF 0Oe4p+VvWkHER3+RxctKRx0ELaGvxdw0AJXI9MNxCA4BHaHtkR2ZOniQBIymy4CDmsuC sj1zknMWlEflIuxvBc6NK03TQASovlZrVO2rmpQnsVxdG617BdM+9Qa+7iWg9nu+l4Jc PjSUVdVSX2Qu0hXcKJVy/HUb/IKT6d65p3jRzSWjgw16gOgBhxG7fCFDhkwOqjgBMeXM DGpQ== X-Gm-Message-State: AElRT7EYQNCilFIOBajIxWxBwrJh+VBOoSwVI0MZa/IyTUwuYJoO04Z3 2GjbHRxdceqRTPSaYb9ZvleImnpx X-Google-Smtp-Source: AG47ELuzLwc+Oqo3ybqlryRd0LeXfawh6HnevQLZZHU71f/FY8n7eqEBymO6Dj42VcRTlc8PC9Z61w== X-Received: by 10.28.207.73 with SMTP id f70mr8936wmg.92.1520981306002; Tue, 13 Mar 2018 15:48:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:03 +0100 Message-Id: <20180313224719.4954-54-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 53/69] replay: fix processing async 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Asynchronous events saved at checkpoints may invoke callbacks when processed. These callbacks may also generate/read new events (e.g. clock reads). Therefore event processing flag must be reset before callback invocation. Signed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095203.1060.70831.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-events.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/replay/replay-events.c b/replay/replay-events.c index 94a6dcccfc..768b505f3d 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -295,13 +295,13 @@ void replay_read_events(int checkpoint) if (!event) { break; } + replay_finish_event(); + read_event_kind =3D -1; replay_mutex_unlock(); replay_run_event(event); replay_mutex_lock(); =20 g_free(event); - replay_finish_event(); - read_event_kind =3D -1; } } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983424844291.19025191483126; Tue, 13 Mar 2018 16:23:44 -0700 (PDT) Received: from localhost ([::1]:43476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtGi-0002Pq-3O for importer@patchew.org; Tue, 13 Mar 2018 19:23:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58599) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsif-0006Jh-Hr for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsib-00044h-6a for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:33 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:36937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsia-000444-Vx for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:29 -0400 Received: by mail-wr0-x242.google.com with SMTP id z12so2563700wrg.4 for ; Tue, 13 Mar 2018 15:48:28 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=298X1TXy5qi3jxahN8yymiR5sm+0Q0Al552aCZLr0wY=; b=Elf3/FsRZf6KBM426PPO99jPeyO2Ug4skRNxUk0kLjO8EfCQLtIskc+vUDz4ErLRK4 4HruvzOj6V8xiMgav7MVMzvlvi+ateqQsNrv+C1KJdUr4a64COmzJBT2t3iY2pJWr+9o qFFwVHeStPn4T+/D3HzKJKceSBcRoBDbkBxliKeueQivMWbs11IpLvk2KsxRR2YY/ghw zi6s/V1G89EB5fuP6yxgzF7i80wCxv0w2HguLtcMOk93+MJqvkZeu2/aM3C04WL8G6LB pI0HqtbDN7erZi4qU7SgLjHTA4di/oa8/TFkdwMBrzl5KyCIkP58O7boG2CAJflDYU1P nvDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=298X1TXy5qi3jxahN8yymiR5sm+0Q0Al552aCZLr0wY=; b=jvzJNQk2E2sas6IAuaOGlh93LLNv5LMXJ31IQj23qGmFzjIfxT52WtfjDWZuKJis3c dIQEEEOVKDareA8rOG+bFYJuCjcQQbZ/AENE7c6urWLCbsXK7WuVJuGr0TDwnngDNLPK TD91e6cYqTlIjJDKb3avOH4QtSpX33TKbVljwcn4A5xyLIupoZCEBzNCs7wWCfwQK70M s+53PyGo/qhERgDSnOGC6aCVo4YjEMJ+8E+suLoQNcnB8QEKy/8XZ6X6r2jDkuMn57xF 968pPO+0tixxf9oUAbqZDIrOtL6O3c5GO+jddm/lJTD/OdPS7HcjFyB7+hL5/LynzOpf MpPg== X-Gm-Message-State: AElRT7EGiClZPipnaRxLYOZCHcVgqo89wulTv29/4vBhnqWvDsAtiMfy O4GOiHD73lDdoFgqGyLrtBcNbHsl X-Google-Smtp-Source: AG47ELuBJGqb03XnIJax+FVpk0udCtQ0JZa1bqT4oqrnOtpnRe61aNbiYzATRT/jJVyMLwPIrn6H4w== X-Received: by 10.223.170.157 with SMTP id h29mr1910381wrc.107.1520981307577; Tue, 13 Mar 2018 15:48:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:04 +0100 Message-Id: <20180313224719.4954-55-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 54/69] replay: fixed replay_enable_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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch fixes assignment to internal events_enabled variable. Now it is set only in record/replay mode. This affects the behavior of the external functions that check this flag. Signed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095209.1060.45884.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-events.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/replay/replay-events.c b/replay/replay-events.c index 768b505f3d..e858254074 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -67,7 +67,9 @@ static void replay_run_event(Event *event) =20 void replay_enable_events(void) { - events_enabled =3D true; + if (replay_mode !=3D REPLAY_MODE_NONE) { + events_enabled =3D true; + } } =20 bool replay_has_events(void) @@ -141,7 +143,7 @@ void replay_add_event(ReplayAsyncEventKind event_kind, =20 void replay_bh_schedule_event(QEMUBH *bh) { - if (replay_mode !=3D REPLAY_MODE_NONE && events_enabled) { + if (events_enabled) { uint64_t id =3D replay_get_current_step(); replay_add_event(REPLAY_ASYNC_EVENT_BH, bh, NULL, id); } else { @@ -161,7 +163,7 @@ void replay_add_input_sync_event(void) =20 void replay_block_event(QEMUBH *bh, uint64_t id) { - if (replay_mode !=3D REPLAY_MODE_NONE && events_enabled) { + if (events_enabled) { replay_add_event(REPLAY_ASYNC_EVENT_BLOCK, bh, NULL, id); } else { qemu_bh_schedule(bh); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209835908781002.7581436280348; Tue, 13 Mar 2018 16:26:30 -0700 (PDT) Received: from localhost ([::1]:43495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtJO-0000Qu-2B for importer@patchew.org; Tue, 13 Mar 2018 19:26:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsig-0006KH-6U for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsic-00045f-JP for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:34 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsic-00045E-D9 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:30 -0400 Received: by mail-wr0-x242.google.com with SMTP id r8so2595534wrg.0 for ; Tue, 13 Mar 2018 15:48:30 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pDGrlfPmR48s1TMPOVmA89rhSwylmN027JVypkJyjcE=; b=L31JhuGJAYz0qJVnRV3be4JwLYRp9lXaIlMs51lQr9sdvs7KngPhXGSGLrwMnJYhNl n1EILn63tMyigagNXGxUpXJFHuqj5EPIVr9g043uMlMi71tpUPOqMU4DNXCUtqstRwS4 MhI3rIrUfi9tU3cpla+Mvu0Biw4AMjNsvGCYRYVCIehqc+8K8tN6cZe3NjycDL4nG3cq F+5XjXPKot8Mg3ohmlsJq6r8hUS2fxyxdpiVjnc+TkplFtY3AXRqXC3wE7SltqBuG74p SLrf6bSyOGfFyPpGybiP4EwVmnZKIlv0Kkv+AjW0C+nwU2GeiFxBdPMdqPzzhRUwvrKr 31eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pDGrlfPmR48s1TMPOVmA89rhSwylmN027JVypkJyjcE=; b=XHhOE9WwpPcKrOSrROIgvHgb4htL8BkLsYs7Qwz+7xfM1RDKvAUQlVS0w/AKpkX7lM QpIwzsbxhm/i2yO1N12y6hi3dNhFrXb6R74CpWUnKQ3TyRAQB1FQrW2EetY9TluNZ4MJ ZePa72829Nih1C/s3PYojFVNMN7jisBe93ldg8iSFgNq5jPKpnqd9hrorVQbjH73jbSK IGJdKMGE89ItJJrDSeSlCaZnm5fjg/lsIw1bYyyPTXrYyLisoi9Wqgnnm58SjYOjyXyb 49naYlOA3S4WBEskB6jSQKvXZCSBehujAvS65N7leWaZgh3qK1oILve0Dx3bf8y+BKhk qZHQ== X-Gm-Message-State: AElRT7FjxAtR+V2GudPGz7TmULh50cQVi0EwJ7tvgURjxmlRXPiCRtSW ihMquj3YMTXLHHfdTkN/f+VmGoST X-Google-Smtp-Source: AG47ELsX7rGuEAqBR6GAyLYqxa9LnKLT0fqL0uLMZ0DwST/Kpo+rfvqfuqP4B/nq46P5OnlKDn0StA== X-Received: by 10.223.208.132 with SMTP id y4mr1812624wrh.185.1520981308963; Tue, 13 Mar 2018 15:48:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:05 +0100 Message-Id: <20180313224719.4954-56-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 55/69] replay: fix save/load vm for non-empty queue 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch does not allows saving/loading vmstate when replay events queue is not empty. There is no reliable way to save events queue, because it describes internal coroutine state. Therefore saving and loading operations should be deferred to another record/replay step. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095214.1060.32939.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- include/sysemu/replay.h | 3 +++ migration/savevm.c | 13 +++++++++++++ replay/replay-snapshot.c | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index c0204e641c..401de12130 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -166,5 +166,8 @@ void replay_audio_in(int *recorded, void *samples, int = *wpos, int size); /*! Called at the start of execution. Loads or saves initial vmstate depending on execution mode. */ void replay_vmstate_init(void); +/*! Called to ensure that replay state is consistent and VM snapshot + can be created */ +bool replay_can_snapshot(void); =20 #endif diff --git a/migration/savevm.c b/migration/savevm.c index 358c5b51e2..fbeac658c1 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -54,6 +54,7 @@ #include "qemu/cutils.h" #include "io/channel-buffer.h" #include "io/channel-file.h" +#include "sysemu/replay.h" =20 #ifndef ETH_P_RARP #define ETH_P_RARP 0x8035 @@ -2197,6 +2198,12 @@ int save_snapshot(const char *name, Error **errp) struct tm tm; AioContext *aio_context; =20 + if (!replay_can_snapshot()) { + error_report("Record/replay does not allow making snapshot " + "right now. Try once more later."); + return ret; + } + if (!bdrv_all_can_snapshot(&bs)) { error_setg(errp, "Device '%s' is writable but does not support " "snapshots", bdrv_get_device_name(bs)); @@ -2388,6 +2395,12 @@ int load_snapshot(const char *name, Error **errp) AioContext *aio_context; MigrationIncomingState *mis =3D migration_incoming_get_current(); =20 + if (!replay_can_snapshot()) { + error_report("Record/replay does not allow loading snapshot " + "right now. Try once more later."); + return -EINVAL; + } + if (!bdrv_all_can_snapshot(&bs)) { error_setg(errp, "Device '%s' is writable but does not support snapshots= ", diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index b2e10769a6..7075986ab5 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -83,3 +83,9 @@ void replay_vmstate_init(void) } } } + +bool replay_can_snapshot(void) +{ + return replay_mode =3D=3D REPLAY_MODE_NONE + || !replay_has_events(); +} --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984247691713.8722208240932; Tue, 13 Mar 2018 16:37:27 -0700 (PDT) Received: from localhost ([::1]:43553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtTu-0006No-Dy for importer@patchew.org; Tue, 13 Mar 2018 19:37:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58608) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsig-0006KG-5y for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsid-00046M-QY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:34 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:44650) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsid-00045p-Gm for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:31 -0400 Received: by mail-wr0-x22b.google.com with SMTP id v65so2494678wrc.11 for ; Tue, 13 Mar 2018 15:48:31 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EQF+H36ScYIVOmEU9qBqaxbZ5C+Pe2vaWehlGZhjI94=; b=p/xs8ORtHooIV0BW67Hvr+8KFGzJpBJJId+rGtXf/VdZrNm3wv5HuRtxjtnkB/km5H PtPsVSQlh2zm0ZwBDVQU1mxaIpOzkBJJvgWvA2QKwNynsx/+4Y+QGdeh3YqSyOZ4x4pW m33WMexNwj6+LjNid1xqXcACis7B+BqynSVLCVKKO88zfCkfCJRLzNTVjHSkPP8ROWex /YURP3ShlLSvlB1bqk7HQHzW9PsN2RYakR8wF3DTC1CNxlCyqEXIiZo1y9iLRFCmMwMz j6Cg9HydSc6PuLlo7hysmmGcAf/gvBWLv2Iozyk0Iyw4kRzHyvyicrOWFSr6l2e1td/S kspw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=EQF+H36ScYIVOmEU9qBqaxbZ5C+Pe2vaWehlGZhjI94=; b=pMr17kTEQs2qQAbY2Bd+cYD8qlGR+IxIkRZJSNcyUjTj0X8yakdghho8refJDfXbvL We1MvrL0QGv4RhzQpgaZv19vDrrcMOnVCJjXz9Hxap50NoxX+1bvFscbpqgfN04E8bUC C5pcVwJYERiX9MoQY39Nu3Cavm0kbzK6i0Z2LItVp2zhbSj+o8qYqTDifqi8FL0fsags /mn2UW3DzaOi4+9Jg0OFVyKEj+bESzhaWKx9hHrQlOPfDBowjoAq2QN4mk+L2IT9dyb5 i8kRZ3bxsYgV1dpRz5cr85Sf1punNWRg/IxLcSl9tHpzhIld2rZh86nIiigeQEWs1CSE utWQ== X-Gm-Message-State: AElRT7GgbPVKWCbxO6m24AnLS4opkCi+MXw5IoA+nXIYOTbl85ZFILaK FScaHi1uolC4+pIVNzGsOK9Ak60A X-Google-Smtp-Source: AG47ELv8K9snPvlum6DOein41UYXNVBqSSPXK6RQ4FPSooQ3gt9mG4WPkOTWEgAG76jVphMmgl31Rw== X-Received: by 10.223.157.24 with SMTP id k24mr1922113wre.273.1520981309970; Tue, 13 Mar 2018 15:48:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:06 +0100 Message-Id: <20180313224719.4954-57-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [PULL 56/69] replay: added replay log format description 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch adds description of the replay log file format into the docs/replay.txt. Signed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095220.1060.58759.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- docs/replay.txt | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 69 insertions(+) diff --git a/docs/replay.txt b/docs/replay.txt index 486c1e0e9d..c52407fe23 100644 --- a/docs/replay.txt +++ b/docs/replay.txt @@ -232,3 +232,72 @@ Audio devices Audio data is recorded and replay automatically. The command line for reco= rding and replaying must contain identical specifications of audio hardware, e.g= .: -soundhw ac97 + +Replay log format +----------------- + +Record/replay log consits of the header and the sequence of execution +events. The header includes 4-byte replay version id and 8-byte reserved +field. Version is updated every time replay log format changes to prevent +using replay log created by another build of qemu. + +The sequence of the events describes virtual machine state changes. +It includes all non-deterministic inputs of VM, synchronization marks and +instruction counts used to correctly inject inputs at replay. + +Synchronization marks (checkpoints) are used for synchronizing qemu threads +that perform operations with virtual hardware. These operations may change +system's state (e.g., change some register or generate interrupt) and +therefore should execute synchronously with CPU thread. + +Every event in the log includes 1-byte event id and optional arguments. +When argument is an array, it is stored as 4-byte array length +and corresponding number of bytes with data. +Here is the list of events that are written into the log: + + - EVENT_INSTRUCTION. Instructions executed since last event. + Argument: 4-byte number of executed instructions. + - EVENT_INTERRUPT. Used to synchronize interrupt processing. + - EVENT_EXCEPTION. Used to synchronize exception handling. + - EVENT_ASYNC. This is a group of events. They are always processed + together with checkpoints. When such an event is generated, it is + stored in the queue and processed only when checkpoint occurs. + Every such event is followed by 1-byte checkpoint id and 1-byte + async event id from the following list: + - REPLAY_ASYNC_EVENT_BH. Bottom-half callback. This event synchronizes + callbacks that affect virtual machine state, but normally called + asyncronously. + Argument: 8-byte operation id. + - REPLAY_ASYNC_EVENT_INPUT. Input device event. Contains + parameters of keyboard and mouse input operations + (key press/release, mouse pointer movement). + Arguments: 9-16 bytes depending of input event. + - REPLAY_ASYNC_EVENT_INPUT_SYNC. Internal input synchronization event. + - REPLAY_ASYNC_EVENT_CHAR_READ. Character (e.g., serial port) device = input + initiated by the sender. + Arguments: 1-byte character device id. + Array with bytes were read. + - REPLAY_ASYNC_EVENT_BLOCK. Block device operation. Used to synchroni= ze + operations with disk and flash drives with CPU. + Argument: 8-byte operation id. + - REPLAY_ASYNC_EVENT_NET. Incoming network packet. + Arguments: 1-byte network adapter id. + 4-byte packet flags. + Array with packet bytes. + - EVENT_SHUTDOWN. Occurs when user sends shutdown event to qemu, + e.g., by closing the window. + - EVENT_CHAR_WRITE. Used to synchronize character output operations. + Arguments: 4-byte output function return value. + 4-byte offset in the output array. + - EVENT_CHAR_READ_ALL. Used to synchronize character input operations, + initiated by qemu. + Argument: Array with bytes that were read. + - EVENT_CHAR_READ_ALL_ERROR. Unsuccessful character input operation, + initiated by qemu. + Argument: 4-byte error code. + - EVENT_CLOCK + clock_id. Group of events for host clock read operations. + Argument: 8-byte clock value. + - EVENT_CHECKPOINT + checkpoint_id. Checkpoint for synchronization of + CPU, internal threads, and asynchronous input events. May be followed + by one or more EVENT_ASYNC events. + - EVENT_END. Last event in the log. --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984058240235.84699879024515; Tue, 13 Mar 2018 16:34:18 -0700 (PDT) Received: from localhost ([::1]:43535 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtQr-0003oV-AE for importer@patchew.org; Tue, 13 Mar 2018 19:34:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsig-0006KK-7i for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsie-000475-SR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:34 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:46919) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsie-00046i-Kq for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:32 -0400 Received: by mail-wr0-x243.google.com with SMTP id m12so2473691wrm.13 for ; Tue, 13 Mar 2018 15:48:32 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Zbc5X/sBU78LkJBkYRysc/VoHFcj5cdYzRgbRDAwJd8=; b=jRnVh0F+ZzzufNyG8eEqHAMPcQWum5pExKF5izDDhtfKCyXZKh2rrrw1gVyhB4yO35 MhiQgZ6nsl/5n+ajFvBA7qAhsCXU2HEi4gqitzjXwDZhd2mZdviX33S4C8amZKXMdMR+ v9hK2XpsEhwRiEB9q2LJcRvgYZe+8DH1TzCiCTzPrt74Kq0ke7fyppX8bwENwrNQO4zp mWgzISryNRc3K30ukEOdTGZMBqhBa9rpok4ICKZ1ibBrAAt1BelxUFYZdJgrZsABnEMZ wxjWKG08Wq+UHfvfPNAzMYcPEO+pOuhMK5pzdfJrKhbdJEgZp7N0ZmzpMIs8GjYlC/Zp Iw7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Zbc5X/sBU78LkJBkYRysc/VoHFcj5cdYzRgbRDAwJd8=; b=Q5B1+wNsLw9FLpNDQjzlkRSgtSJw3LvtldMIgQgUYlZXnCkwBQ6uWI5n4uPTCplWX+ Kh6lfCq74bPExJMTdY0MXxrrw9ESSnf0TNNBZRV7FuyqYGyCol70JZECthtl/Z1RBSXb /vD2O74wjI5q/uNS/Yj5B+p49eMWyJzwf0nwAP7oXKCwtLYNkS981pfiqyHXQzTVsuJO YEKKyfDr0NwpKRi7jQASNCwnO/48G3iCYZAUTPxxEHVEFkQRZc+AOcYgx6YcPIm9ucDN rzWl60MiIxG0+svAFGf4NGaoGOzQvoNal9qEiHyaTNrSpuvuYxjBIXbh8d5QRfRsRlPW TPcg== X-Gm-Message-State: AElRT7FVkaNS5dXTihL1Gk8ddMrB3qLFASaMWlZrtPldmX1Ve0dIocha Cv+8pffq67WbXusFTdLOcAf4Uhy+ X-Google-Smtp-Source: AG47ELuJyEoMT6zplW8UHdQydxajzeO2U9iav6FPyJMfoNJpm5KTNXWGabKgQ4LQv1yZvOv5EzJIxA== X-Received: by 10.223.142.164 with SMTP id q33mr1951394wrb.72.1520981311190; Tue, 13 Mar 2018 15:48:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:07 +0100 Message-Id: <20180313224719.4954-58-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 57/69] replay: save prior value of the host clock 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch adds saving/restoring of the host clock field 'last'. It is used in host clock calculation and therefore clock may become incorrect when using restored vmstate. Signed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095226.1060.50975.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- include/qemu/timer.h | 14 ++++++++++++++ replay/replay-internal.h | 2 ++ replay/replay-snapshot.c | 3 +++ util/qemu-timer.c | 12 ++++++++++++ 4 files changed, 31 insertions(+) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 3b5a54b014..39ea907e65 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -251,6 +251,20 @@ bool qemu_clock_run_timers(QEMUClockType type); */ bool qemu_clock_run_all_timers(void); =20 +/** + * qemu_clock_get_last: + * + * Returns last clock query time. + */ +uint64_t qemu_clock_get_last(QEMUClockType type); +/** + * qemu_clock_set_last: + * + * Sets last clock query time. + */ +void qemu_clock_set_last(QEMUClockType type, uint64_t last); + + /* * QEMUTimerList */ diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 3ebb19912a..be96d7e879 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -78,6 +78,8 @@ typedef struct ReplayState { This counter is global, because requests from different block devices should not get overlapping ids. */ uint64_t block_request_id; + /*! Prior value of the host clock */ + uint64_t host_clock_last; } ReplayState; extern ReplayState replay_state; =20 diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index 7075986ab5..e0b2204765 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -25,6 +25,7 @@ static int replay_pre_save(void *opaque) { ReplayState *state =3D opaque; state->file_offset =3D ftell(replay_file); + state->host_clock_last =3D qemu_clock_get_last(QEMU_CLOCK_HOST); =20 return 0; } @@ -33,6 +34,7 @@ static int replay_post_load(void *opaque, int version_id) { ReplayState *state =3D opaque; fseek(replay_file, state->file_offset, SEEK_SET); + qemu_clock_set_last(QEMU_CLOCK_HOST, state->host_clock_last); /* If this was a vmstate, saved in recording mode, we need to initialize replay data fields. */ replay_fetch_data_kind(); @@ -54,6 +56,7 @@ static const VMStateDescription vmstate_replay =3D { VMSTATE_UINT32(has_unread_data, ReplayState), VMSTATE_UINT64(file_offset, ReplayState), VMSTATE_UINT64(block_request_id, ReplayState), + VMSTATE_UINT64(host_clock_last, ReplayState), VMSTATE_END_OF_LIST() }, }; diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 82d56507a2..2ed1bf2778 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -622,6 +622,18 @@ int64_t qemu_clock_get_ns(QEMUClockType type) } } =20 +uint64_t qemu_clock_get_last(QEMUClockType type) +{ + QEMUClock *clock =3D qemu_clock_ptr(type); + return clock->last; +} + +void qemu_clock_set_last(QEMUClockType type, uint64_t last) +{ + QEMUClock *clock =3D qemu_clock_ptr(type); + clock->last =3D last; +} + void qemu_clock_register_reset_notifier(QEMUClockType type, Notifier *notifier) { --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098353589427.900860945034196; Tue, 13 Mar 2018 16:25:35 -0700 (PDT) Received: from localhost ([::1]:43486 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtIN-0004lV-RJ for importer@patchew.org; Tue, 13 Mar 2018 19:25:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58633) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsig-0006L6-VE for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsif-00047g-SS for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:40562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsif-00047K-M6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:33 -0400 Received: by mail-wr0-x244.google.com with SMTP id s12so14430wre.7 for ; Tue, 13 Mar 2018 15:48:33 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0gWafmiRSPTaWEmXlFXCR87hdsMuZo8RIGdEgNRtP3Y=; b=ZK8PYYJvE3UfQ73hoUpZ5SpK6Fes8HSrtfND2+i49aLtHxO6yt4FAgpxU7PDpKFYkO PQE3YbMM8ROup8/UzAKL56mKz/OXH+b+8hrEPLxsAGBY4HZYYhgWLuqgDbeZnl+fDlph EgB5vggkW/E1N102lKElSZeQMrSA/47EP5jbeSq5NtDN4iPB8iv8gvNx4MHSzZw5pE3M mG41d8zpcLLrUeeRbo8qj1AsJEK4F9LrgPkkl20acKoh6ebrWBkDd2jFxPHeKhH4PN34 oDfhl8N13Z7fN/ZoXSq5VmqFghRVTF8mmnsCojzw2xWCGVtEHDwnsdaisyWk0fAvvGXn WHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=0gWafmiRSPTaWEmXlFXCR87hdsMuZo8RIGdEgNRtP3Y=; b=qQHUqpDHaX7c8wmjiL9LhyEt1iHwKddkqfG6/UMo2HIq/hH3u8KAm4RGIJKAR7TyUZ o7gIW4H5BFQUpwL9z4CWJbCOOQloiAZ2KW/MleKptnyIIPJ9rwEFxts/J3aVkVnToXqY g+2RY45kWd4QmWF5Iaw91ECifLc6Ms7U5ouYO8vSS8HhOu71qBLz65vTOAnakiGX+w58 e9yy9pYrILfMz6TAHD3ky6Yzv4a8VR7WbhoMk8I/CzldFcdrPb/GrJDc5QpNv1A5xcM0 HXPKIEAl+NLpE5P6UO00CkR2RAY8j3eLjsWLBVGwmCb7wE6DfQtC/0Om6J3rpthz2ZEs 6u0Q== X-Gm-Message-State: AElRT7Fm3dZ6p0Q4j0N8dH6yVm66C1SQtw7T+4la0bI2mu2WaAfPC1ts nn1sRxJ1vJfRpvBDX3m2ZbpUAbKT X-Google-Smtp-Source: AG47ELtkyArwOU1oyhaRBhw0eBRUk2OtmXqeQJ8JHcY+iAzjE3IYFP2t3UUS62p7yi54Mp62IxDYmg== X-Received: by 10.223.195.206 with SMTP id d14mr2026117wrg.0.1520981312246; Tue, 13 Mar 2018 15:48:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:08 +0100 Message-Id: <20180313224719.4954-59-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 58/69] replay/replay.c: bump REPLAY_VERSION again 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?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e This time commit 802f045a5f61b781df55e4492d896b4d20503ba7 broke the replay file format. Also add a comment about this to replay-internal.h. Signed-off-by: Alex Benn=C3=A9e Reviewed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095231.1060.91180.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- replay/replay-internal.h | 2 +- replay/replay.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/replay/replay-internal.h b/replay/replay-internal.h index be96d7e879..8e4c701751 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -12,7 +12,7 @@ * */ =20 - +/* Any changes to order/number of events will need to bump REPLAY_VERSION = */ enum ReplayEvents { /* for instruction event */ EVENT_INSTRUCTION, diff --git a/replay/replay.c b/replay/replay.c index 7a23c62d61..9cddb6bfc9 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -22,7 +22,7 @@ =20 /* Current version of the replay mechanism. Increase it when file format changes. */ -#define REPLAY_VERSION 0xe02006 +#define REPLAY_VERSION 0xe02007 /* Size of replay log header */ #define HEADER_SIZE (sizeof(uint32_t) + sizeof(uint64_t)) =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098630573960.68354473106376; Tue, 13 Mar 2018 17:11:45 -0700 (PDT) Received: from localhost ([::1]:43507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtM4-0000c7-K8 for importer@patchew.org; Tue, 13 Mar 2018 19:29:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58670) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsii-0006Mh-Cn for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsih-00049M-Bw for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:36 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:37059) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsih-00048O-6J for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:35 -0400 Received: by mail-wm0-x244.google.com with SMTP id 139so881430wmn.2 for ; Tue, 13 Mar 2018 15:48:35 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kwu9R4Oqu/XdgRnje5Q8FcF8hFd8m9i/JhVoPskPzvQ=; b=jepM2SVe01KD/NOj0IQ6G4vnE5Joqti+6K5tT7WuQ++XgCN2rW7hgujMiVN5NjYAov 9sHlGpHFxgyHmLwW9W77P3I0x6uv+Np9GeCn5tPW7peIQl19K1IodkAqlTfDIhAKJvKL 9OWR4jpVonw9Pduf2XS0B7ibBMdYPtNrnP9Ded1vYTOxaFHPceYCun3XeYmV8fGAUPwg iIXCQbKqLFDYtd10AhM1HLokUCTpVhjEIAam0GEOkTCwDs0aWDUBjRje1pjmQCM3eG0Q JkLBrNGtAlncs0PPXutFbLVJARcgJyyqISc2Z9/4AWuE4cSrZV7QwUPvM4ePsBspgIKm pMsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Kwu9R4Oqu/XdgRnje5Q8FcF8hFd8m9i/JhVoPskPzvQ=; b=SPAItG5r07TxvrHIbPovY3Z/7/dCKjJ4BaGhR14InKv5R0+llzDreXDowTT/Bjh8+o oyAGlcr4biscp73+9rS165WfGOzZDK1ZaK8KBG+udaEMkYkqtdwNUoIbDxLxILlDoa8q Vv3uZteVUvXTod2ddPD9DSKMG8nx9hlCIcToNaho+u8iiMc1BM/Wvo4urpwRorf13rcw GZNyBnAbHARgvE58tEI2K20s+Gavz230D1+0G+fG5X+/WD3DvHgcZ8SwLNv5AtAP6SyP MC8meK3m0lnFvtXa/bLMD27qL9encvBuxa3zUFdRueCJc0REvBjib2a8xYRgofch2snu zgpA== X-Gm-Message-State: AElRT7F3/G+O6Vi14RFeCvLd2+Ul157wR0x1RWW5xs7OyZepHyggKNkR JO9A1lEYL4itip7odOerSgFW6glC X-Google-Smtp-Source: AG47ELt4zd7/NS6jOMxL7FZEspjimppvogGf6Z8a9sG09OLFkO6GuXZlaw9694eEEzpkXSup0Urolw== X-Received: by 10.28.144.5 with SMTP id s5mr2084180wmd.98.1520981313802; Tue, 13 Mar 2018 15:48:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:09 +0100 Message-Id: <20180313224719.4954-60-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 59/69] replay/replay-internal.c: track holding of replay_lock 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?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e This is modelled after the iothread mutex lock. We keep a TLS flag to indicate when that thread has acquired the lock and assert we don't double-lock or release when we shouldn't have. Signed-off-by: Alex Benn=C3=A9e Tested-by: Pavel Dovgalyuk Message-Id: <20180227095237.1060.44661.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- replay/replay-internal.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/replay/replay-internal.c b/replay/replay-internal.c index fca8514012..0d7e1d6bc4 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -169,6 +169,8 @@ void replay_finish_event(void) replay_fetch_data_kind(); } =20 +static __thread bool replay_locked; + void replay_mutex_init(void) { qemu_mutex_init(&lock); @@ -179,13 +181,22 @@ void replay_mutex_destroy(void) qemu_mutex_destroy(&lock); } =20 +static bool replay_mutex_locked(void) +{ + return replay_locked; +} + void replay_mutex_lock(void) { + g_assert(!replay_mutex_locked()); qemu_mutex_lock(&lock); + replay_locked =3D true; } =20 void replay_mutex_unlock(void) { + g_assert(replay_mutex_locked()); + replay_locked =3D false; qemu_mutex_unlock(&lock); } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984426061140.33766044932167; Tue, 13 Mar 2018 16:40:26 -0700 (PDT) Received: from localhost ([::1]:43569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtWr-0000Oo-5s for importer@patchew.org; Tue, 13 Mar 2018 19:40:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsij-0006Ne-Eo for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsii-0004AK-HW for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:37 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:33977) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsii-00049c-9l for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:36 -0400 Received: by mail-wr0-x243.google.com with SMTP id o8so2599343wra.1 for ; Tue, 13 Mar 2018 15:48:36 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XTH1yi6oxPFB16KTQCK1koIP4f8avjYkPChlxnpddOA=; b=cJ6FIVJ+fhKeV7kjG7yyEPKJES+y/Yl10e//L4/EX3J65EJUeouUMohAcD49yPBH1w lrznMQ5fvqtz5ifKAcm7XhB88zUTpRjCPyXOUiQUTquWHvqyVYxr0rG+NQAfAd/aDzwu aD+WXPJzNKNMthuBk+J+O6JyG1umtdyZXZuQyx8GMlWBJ8QisukgJDxb6nAmGeQhz1YX yQGh4fdUQ9NPKppc/AXYc5BT/k+D1jHZrwgLmkkF0kv3xL33Zazy1dkkst5rlxHUN7Mw sYGPjva/7+pxh5Qja3qYq2zP44prMjqWdrB4OEADkdslsLutUTPJ6HLIs/Gox2Lmfh64 bsKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=XTH1yi6oxPFB16KTQCK1koIP4f8avjYkPChlxnpddOA=; b=Am0inZ9SkDrcmOM5WALDSjrF0Y2zc+uXqqtfVRRJBUah1MgL2V1Y9+ke/g5PFp7sp3 CceNxUhtYUVBBo8xsYzVC5vuSbu1Ir1ENuBt9O/ua/mzJkFukVy2k6+jUw/0WXkHYxjg Ua+TEqvQiukdKyT5l6TCrZBdCVyomvt0Oqf8++KDdB8qYNoi3s1qxkUp/u6DYVbNgg4r PW0/jRWpayXYK9f5KSgg+qtoBVZ9LaJbk+tveORTdbu4UYADenHfYo/BVFmgZ3ezDyPX IKearLibCKBb0WQqh0QFtZSdnhiFYuiv6n3bhhzbX4AaLNOZDLObh7gs/1kQcOXSvJj0 WItg== X-Gm-Message-State: AElRT7FUQqHFNdrB3KcGZPLrD5/Gawbd+Feug66xOknrQqHAu87Ja5Fi C472DhXgKapsGWrV4tHwYxL/wr62 X-Google-Smtp-Source: AG47ELtEKfuKzzMzh4BSdNRDcFiwhwp0sxN7LUUrkHzrWZhDXSJrr7ru4qT1SCEBKpXLwfiu9Mb95g== X-Received: by 10.223.135.26 with SMTP id a26mr1986792wra.211.1520981314827; Tue, 13 Mar 2018 15:48:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:10 +0100 Message-Id: <20180313224719.4954-61-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 60/69] replay: make locking visible outside replay code 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?Alex=20Benn=C3=A9e?= , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e The replay_mutex_lock/unlock/locked functions are now going to be used for ensuring lock-step behaviour between the two threads. Make them public API functions and also provide stubs for non-QEMU builds on common paths. Signed-off-by: Alex Benn=C3=A9e Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095242.1060.16601.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- include/sysemu/replay.h | 13 +++++++++++++ replay/replay-internal.c | 2 +- replay/replay-internal.h | 6 +++--- stubs/replay.c | 8 ++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h index 401de12130..3ced6bc231 100644 --- a/include/sysemu/replay.h +++ b/include/sysemu/replay.h @@ -48,6 +48,19 @@ extern ReplayMode replay_mode; /* Name of the initial VM snapshot */ extern char *replay_snapshot; =20 +/* Replay locking + * + * The locks are needed to protect the shared structures and log file + * when doing record/replay. They also are the main sync-point between + * the main-loop thread and the vCPU thread. This was a role + * previously filled by the BQL which has been busy trying to reduce + * its impact across the code. This ensures blocks of events stay + * sequential and reproducible. + */ + +void replay_mutex_lock(void); +void replay_mutex_unlock(void); + /* Replay process control functions */ =20 /*! Enables recording or saving event log with specified parameters */ diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 0d7e1d6bc4..7cdefeaa04 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -181,7 +181,7 @@ void replay_mutex_destroy(void) qemu_mutex_destroy(&lock); } =20 -static bool replay_mutex_locked(void) +bool replay_mutex_locked(void) { return replay_locked; } diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 8e4c701751..41eee66e9b 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -100,12 +100,12 @@ int64_t replay_get_qword(void); void replay_get_array(uint8_t *buf, size_t *size); void replay_get_array_alloc(uint8_t **buf, size_t *size); =20 -/* Mutex functions for protecting replay log file */ +/* Mutex functions for protecting replay log file and ensuring + * synchronisation between vCPU and main-loop threads. */ =20 void replay_mutex_init(void); void replay_mutex_destroy(void); -void replay_mutex_lock(void); -void replay_mutex_unlock(void); +bool replay_mutex_locked(void); =20 /*! Checks error status of the file. */ void replay_check_error(void); diff --git a/stubs/replay.c b/stubs/replay.c index 9c8aa48c9c..04279abb2c 100644 --- a/stubs/replay.c +++ b/stubs/replay.c @@ -72,3 +72,11 @@ uint64_t blkreplay_next_id(void) { return 0; } + +void replay_mutex_lock(void) +{ +} + +void replay_mutex_unlock(void) +{ +} --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983934769981.7707597007742; Tue, 13 Mar 2018 16:32:14 -0700 (PDT) Received: from localhost ([::1]:43524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtOp-0002Ex-RK for importer@patchew.org; Tue, 13 Mar 2018 19:32:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsik-0006Oi-Aq for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsij-0004Au-DH for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:38 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:54943) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsij-0004AO-5x for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:37 -0400 Received: by mail-wm0-x241.google.com with SMTP id h76so872886wme.4 for ; Tue, 13 Mar 2018 15:48:36 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=f89+1xjoNOupEoqpSPNpB12CPh9goqHHqSk48G/2Cro=; b=YcSmzJ9qZtiHEnrqRhCvXuIQQDf87vd/ok94AjAjD/ShivPLSONXzBtd7TFAQTU6vU zWizIxe2CzImGx/m5MNTRXquiuF40v5F0fFdcVUBoQm2Izju67gtW4or6H8xf3ZqxFCb lAmHZ1oeiIhbuueen0JPaIabMfwMZbNEVItyu9y5JPRjcTWQPehOCGJ9F3aZt7z4/x+1 t09KIsILcB0bpzgYa3QVDH3/ChMFrYVt2xtxIW7La0D8BCwW/FX+IODcG0OWo+vCXK5N vvt1u0VJUj6yI6LzBGILlwpmwCLtklwkPCYfGxehHKePncmJXbmaosEg/hH9CvKxaLXr TeEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=f89+1xjoNOupEoqpSPNpB12CPh9goqHHqSk48G/2Cro=; b=jznIplMIu1d8apeJt1IbDM+9+S3QzVMEM3qpRn5dF98Q4rYlYHuhOqce7cSYQ05B+J RUWTqyGK1DwzFDNxUmov5wzXPkzWkPDqN7U4IvP/inVu3heHMyH3Jf34YGjVgTDCANLr Tce+qlPd1E/PwAqLVDFDMQ2xMrOrKoAX4/KH/VdiyjbpzLfnBVoE+SsUF/utHAqD8IsM AsQxqef7CsA4TaZ/SvZPI0xvToQ++P9X4fVNapnzx69qTVuexYkRnsBwkd9r1iQGVP7d FA/aWZ/l67cwCFFQR3DvVhLKrPBjQVhM2HD4ejAzEk3Bi/nbYZheHanPWx2U+fenZgGc 5X4w== X-Gm-Message-State: AElRT7FkSbGsVxeeqp28V9ZT3xidvQu3442Z/uN7sZ7i4pdKrHqG6wDw dHfFk5nEs+EufRivA1xHqhyumw2x X-Google-Smtp-Source: AG47ELtzsLbH1EOVEC0PmRMiioSELxkFt/MaToWnzn2YUvX0nDHvRzjeP2Zd6D2MK/A5fSLtRUoBPA== X-Received: by 10.28.54.11 with SMTP id d11mr1221432wma.104.1520981315776; Tue, 13 Mar 2018 15:48:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:11 +0100 Message-Id: <20180313224719.4954-62-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 61/69] replay: don't destroy mutex at exit 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Replay mutex is held by vCPU thread and destroy function is called from atexit of the main thread. Therefore we cannot destroy it safely. Signed-off-by: Pavel Dovgalyuk Acked-by: Paolo Bonzini Message-Id: <20180227095254.1060.96971.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.c | 5 ----- replay/replay-internal.h | 1 - replay/replay.c | 1 - 3 files changed, 7 deletions(-) diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 7cdefeaa04..fa7bba6dfd 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -176,11 +176,6 @@ void replay_mutex_init(void) qemu_mutex_init(&lock); } =20 -void replay_mutex_destroy(void) -{ - qemu_mutex_destroy(&lock); -} - bool replay_mutex_locked(void) { return replay_locked; diff --git a/replay/replay-internal.h b/replay/replay-internal.h index 41eee66e9b..d4037058e4 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -104,7 +104,6 @@ void replay_get_array_alloc(uint8_t **buf, size_t *size= ); * synchronisation between vCPU and main-loop threads. */ =20 void replay_mutex_init(void); -void replay_mutex_destroy(void); bool replay_mutex_locked(void); =20 /*! Checks error status of the file. */ diff --git a/replay/replay.c b/replay/replay.c index 9cddb6bfc9..5d05ee0460 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -358,7 +358,6 @@ void replay_finish(void) replay_snapshot =3D NULL; =20 replay_finish_events(); - replay_mutex_destroy(); } =20 void replay_add_blocker(Error *reason) --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984248051804.3153230962735; Tue, 13 Mar 2018 16:37:28 -0700 (PDT) Received: from localhost ([::1]:43551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtTo-0006Ir-6s for importer@patchew.org; Tue, 13 Mar 2018 19:37:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsip-0006TL-R4 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsil-0004C7-T6 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:43 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38151) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsil-0004Bj-GW for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:39 -0400 Received: by mail-wm0-x241.google.com with SMTP id z9so880786wmb.3 for ; Tue, 13 Mar 2018 15:48:39 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fgYiUTid+XNCv/a+4jIL7xv2lGthhnQtJJPPnG39TFs=; b=uMcxXLea/tOy5hcyJ8o9aDBHg1nEkbn8RIBLZZY+zPv+lOyAHY6ySjEgmWUfdkPlv+ T6SKzAEl4C8GWOKE7teiHlcoek73ML3kqExhXA9148OobldX61PJC0Omu6awmq5FhTIt D3Durcu+LuKnt+sQ/RmPgjXitVGML19JRnnC/Zzfdh/G9DCopvKl2r23dhemXpFqRlMT qrn7sv7fwMqgmAnsAhDLioAbXQsGNsPuISNsgE8S+KKERyOtpr2TbmXllOjXuWPZVdK7 Q3wt6xiTrpLQcdgbhrAy0W1Cz80mjlV0cTFo5J6wF8lXO46RdVvhRLL1SXKMCrkCSYg8 L2pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=fgYiUTid+XNCv/a+4jIL7xv2lGthhnQtJJPPnG39TFs=; b=gfQaOqKQ+JwBuVtp2c2wvAmibG7GKx5TXzrNLoAtBnBv2aTwbHvJmY0gXry2dTCMiE zlUl3WZ8/fZn7T5F1jjbxkfWB5ND7m3whnhJN9/gX967hTKe1SnPtq8rDvHuMVwbuWDU XPdWkbZQ04IfrHnJghpk50KgeO5yZhk+SjYdWY53BGLOthKIVRXOFpLAH2DLR/t3+q3d hI+ejKs8B1R98Zx0YsU5TLXVP2+WpOBHedUadze3gsf7Sw/FKAB6iekXx103aphpiDgz aw4eV2zpNBn0/bDArajpDYgdHKqV0TK8LsfOPWRqEb8WXCEaf2+kB5LaYid2DJeG6t/H Cbrg== X-Gm-Message-State: AElRT7FN6y/j7hvFrnF0bAZqsIyyJeknwCyyiCrvBTxEqAcRjGrGPJSf 29ktAQgDaXyZEDmD2SLFX3Zfuz4P X-Google-Smtp-Source: AG47ELtuXPi9gH0hKNkYIXbKRYYS8+H4tUMiyXkdpK0I5wn/9Gv739Vrn5g9khNYuGZNrAkHEE7H+A== X-Received: by 10.28.74.199 with SMTP id n68mr2087038wmi.83.1520981317854; Tue, 13 Mar 2018 15:48:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:12 +0100 Message-Id: <20180313224719.4954-63-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 62/69] replay: push replay_mutex_lock up the call tree 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?Alex=20Benn=C3=A9e?= , Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e Now instead of using the replay_lock to guard the output of the log we now use it to protect the whole execution section. This replaces what the BQL used to do when it was held during TCG execution. We also introduce some rules for locking order - mainly that you cannot take the replay_mutex while holding the BQL. This leads to some slight sophistry during start-up and extending the replay_mutex_destroy function to unlock the mutex without checking for the BQL condition so it can be cleanly dropped in the non-replay case. Signed-off-by: Alex Benn=C3=83=C2=A9e Signed-off-by: Pavel Dovgalyuk Tested-by: Pavel Dovgalyuk Message-Id: <20180227095248.1060.40374.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Alex Benn=C3=A9e --- cpus.c | 24 ++++++++++++++++++++++-- docs/replay.txt | 22 ++++++++++++++++++++++ replay/replay-audio.c | 14 ++++---------- replay/replay-char.c | 21 ++++++++------------- replay/replay-events.c | 20 +++++++------------- replay/replay-internal.c | 24 ++++++++++++++++-------- replay/replay-time.c | 10 +++++----- replay/replay.c | 34 +++++++++++++--------------------- util/main-loop.c | 15 +++++++++++---- vl.c | 1 + 10 files changed, 109 insertions(+), 76 deletions(-) diff --git a/cpus.c b/cpus.c index c652da84cf..2e6701795b 100644 --- a/cpus.c +++ b/cpus.c @@ -1317,6 +1317,8 @@ static void prepare_icount_for_run(CPUState *cpu) insns_left =3D MIN(0xffff, cpu->icount_budget); cpu->icount_decr.u16.low =3D insns_left; cpu->icount_extra =3D cpu->icount_budget - insns_left; + + replay_mutex_lock(); } } =20 @@ -1332,6 +1334,8 @@ static void process_icount_data(CPUState *cpu) cpu->icount_budget =3D 0; =20 replay_account_executed_instructions(); + + replay_mutex_unlock(); } } =20 @@ -1346,11 +1350,9 @@ static int tcg_cpu_exec(CPUState *cpu) #ifdef CONFIG_PROFILER ti =3D profile_getclock(); #endif - qemu_mutex_unlock_iothread(); cpu_exec_start(cpu); ret =3D cpu_exec(cpu); cpu_exec_end(cpu); - qemu_mutex_lock_iothread(); #ifdef CONFIG_PROFILER tcg_time +=3D profile_getclock() - ti; #endif @@ -1417,6 +1419,9 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) cpu->exit_request =3D 1; =20 while (1) { + qemu_mutex_unlock_iothread(); + replay_mutex_lock(); + qemu_mutex_lock_iothread(); /* Account partial waits to QEMU_CLOCK_VIRTUAL. */ qemu_account_warp_timer(); =20 @@ -1425,6 +1430,8 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) */ handle_icount_deadline(); =20 + replay_mutex_unlock(); + if (!cpu) { cpu =3D first_cpu; } @@ -1440,11 +1447,13 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) if (cpu_can_run(cpu)) { int r; =20 + qemu_mutex_unlock_iothread(); prepare_icount_for_run(cpu); =20 r =3D tcg_cpu_exec(cpu); =20 process_icount_data(cpu); + qemu_mutex_lock_iothread(); =20 if (r =3D=3D EXCP_DEBUG) { cpu_handle_guest_debug(cpu); @@ -1634,7 +1643,9 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) while (1) { if (cpu_can_run(cpu)) { int r; + qemu_mutex_unlock_iothread(); r =3D tcg_cpu_exec(cpu); + qemu_mutex_lock_iothread(); switch (r) { case EXCP_DEBUG: cpu_handle_guest_debug(cpu); @@ -1781,12 +1792,21 @@ void pause_all_vcpus(void) } } =20 + /* We need to drop the replay_lock so any vCPU threads woken up + * can finish their replay tasks + */ + replay_mutex_unlock(); + while (!all_vcpus_paused()) { qemu_cond_wait(&qemu_pause_cond, &qemu_global_mutex); CPU_FOREACH(cpu) { qemu_cpu_kick(cpu); } } + + qemu_mutex_unlock_iothread(); + replay_mutex_lock(); + qemu_mutex_lock_iothread(); } =20 void cpu_resume(CPUState *cpu) diff --git a/docs/replay.txt b/docs/replay.txt index c52407fe23..959633e7ea 100644 --- a/docs/replay.txt +++ b/docs/replay.txt @@ -49,6 +49,28 @@ Modifications of qemu include: * recording/replaying user input (mouse and keyboard) * adding internal checkpoints for cpu and io synchronization =20 +Locking and thread synchronisation +---------------------------------- + +Previously the synchronisation of the main thread and the vCPU thread +was ensured by the holding of the BQL. However the trend has been to +reduce the time the BQL was held across the system including under TCG +system emulation. As it is important that batches of events are kept +in sequence (e.g. expiring timers and checkpoints in the main thread +while instruction checkpoints are written by the vCPU thread) we need +another lock to keep things in lock-step. This role is now handled by +the replay_mutex_lock. It used to be held only for each event being +written but now it is held for a whole execution period. This results +in a deterministic ping-pong between the two main threads. + +As the BQL is now a finer grained lock than the replay_lock it is almost +certainly a bug, and a source of deadlocks, to take the +replay_mutex_lock while the BQL is held. This is enforced by an assert. +While the unlocks are usually in the reverse order, this is not +necessary; you can drop the replay_lock while holding the BQL, without +doing a more complicated unlock_iothread/replay_unlock/lock_iothread +sequence. + Non-deterministic events ------------------------ =20 diff --git a/replay/replay-audio.c b/replay/replay-audio.c index 3d837434d4..b113836de4 100644 --- a/replay/replay-audio.c +++ b/replay/replay-audio.c @@ -19,20 +19,17 @@ void replay_audio_out(int *played) { if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + g_assert(replay_mutex_locked()); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_AUDIO_OUT); replay_put_dword(*played); - replay_mutex_unlock(); } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); replay_account_executed_instructions(); - replay_mutex_lock(); if (replay_next_event_is(EVENT_AUDIO_OUT)) { *played =3D replay_get_dword(); replay_finish_event(); - replay_mutex_unlock(); } else { - replay_mutex_unlock(); error_report("Missing audio out event in the replay log"); abort(); } @@ -44,8 +41,8 @@ void replay_audio_in(int *recorded, void *samples, int *w= pos, int size) int pos; uint64_t left, right; if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + g_assert(replay_mutex_locked()); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_AUDIO_IN); replay_put_dword(*recorded); replay_put_dword(*wpos); @@ -55,10 +52,9 @@ void replay_audio_in(int *recorded, void *samples, int *= wpos, int size) replay_put_qword(left); replay_put_qword(right); } - replay_mutex_unlock(); } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); replay_account_executed_instructions(); - replay_mutex_lock(); if (replay_next_event_is(EVENT_AUDIO_IN)) { *recorded =3D replay_get_dword(); *wpos =3D replay_get_dword(); @@ -69,9 +65,7 @@ void replay_audio_in(int *recorded, void *samples, int *w= pos, int size) audio_sample_from_uint64(samples, pos, left, right); } replay_finish_event(); - replay_mutex_unlock(); } else { - replay_mutex_unlock(); error_report("Missing audio in event in the replay log"); abort(); } diff --git a/replay/replay-char.c b/replay/replay-char.c index cbf7c04a9f..736cc8c2e6 100755 --- a/replay/replay-char.c +++ b/replay/replay-char.c @@ -96,25 +96,24 @@ void *replay_event_char_read_load(void) =20 void replay_char_write_event_save(int res, int offset) { + g_assert(replay_mutex_locked()); + replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_CHAR_WRITE); replay_put_dword(res); replay_put_dword(offset); - replay_mutex_unlock(); } =20 void replay_char_write_event_load(int *res, int *offset) { + g_assert(replay_mutex_locked()); + replay_account_executed_instructions(); - replay_mutex_lock(); if (replay_next_event_is(EVENT_CHAR_WRITE)) { *res =3D replay_get_dword(); *offset =3D replay_get_dword(); replay_finish_event(); - replay_mutex_unlock(); } else { - replay_mutex_unlock(); error_report("Missing character write event in the replay log"); exit(1); } @@ -122,23 +121,21 @@ void replay_char_write_event_load(int *res, int *offs= et) =20 int replay_char_read_all_load(uint8_t *buf) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); + if (replay_next_event_is(EVENT_CHAR_READ_ALL)) { size_t size; int res; replay_get_array(buf, &size); replay_finish_event(); - replay_mutex_unlock(); res =3D (int)size; assert(res >=3D 0); return res; } else if (replay_next_event_is(EVENT_CHAR_READ_ALL_ERROR)) { int res =3D replay_get_dword(); replay_finish_event(); - replay_mutex_unlock(); return res; } else { - replay_mutex_unlock(); error_report("Missing character read all event in the replay log"); exit(1); } @@ -146,19 +143,17 @@ int replay_char_read_all_load(uint8_t *buf) =20 void replay_char_read_all_save_error(int res) { + g_assert(replay_mutex_locked()); assert(res < 0); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_CHAR_READ_ALL_ERROR); replay_put_dword(res); - replay_mutex_unlock(); } =20 void replay_char_read_all_save_buf(uint8_t *buf, int offset) { + g_assert(replay_mutex_locked()); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_CHAR_READ_ALL); replay_put_array(buf, offset); - replay_mutex_unlock(); } diff --git a/replay/replay-events.c b/replay/replay-events.c index e858254074..54dd9d2606 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -79,16 +79,14 @@ bool replay_has_events(void) =20 void replay_flush_events(void) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); + while (!QTAILQ_EMPTY(&events_list)) { Event *event =3D QTAILQ_FIRST(&events_list); - replay_mutex_unlock(); replay_run_event(event); - replay_mutex_lock(); QTAILQ_REMOVE(&events_list, event, events); g_free(event); } - replay_mutex_unlock(); } =20 void replay_disable_events(void) @@ -102,14 +100,14 @@ void replay_disable_events(void) =20 void replay_clear_events(void) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); + while (!QTAILQ_EMPTY(&events_list)) { Event *event =3D QTAILQ_FIRST(&events_list); QTAILQ_REMOVE(&events_list, event, events); =20 g_free(event); } - replay_mutex_unlock(); } =20 /*! Adds specified async event to the queue */ @@ -136,9 +134,8 @@ void replay_add_event(ReplayAsyncEventKind event_kind, event->opaque2 =3D opaque2; event->id =3D id; =20 - replay_mutex_lock(); + g_assert(replay_mutex_locked()); QTAILQ_INSERT_TAIL(&events_list, event, events); - replay_mutex_unlock(); } =20 void replay_bh_schedule_event(QEMUBH *bh) @@ -207,13 +204,11 @@ static void replay_save_event(Event *event, int check= point) /* Called with replay mutex locked */ void replay_save_events(int checkpoint) { + g_assert(replay_mutex_locked()); while (!QTAILQ_EMPTY(&events_list)) { Event *event =3D QTAILQ_FIRST(&events_list); replay_save_event(event, checkpoint); - - replay_mutex_unlock(); replay_run_event(event); - replay_mutex_lock(); QTAILQ_REMOVE(&events_list, event, events); g_free(event); } @@ -292,6 +287,7 @@ static Event *replay_read_event(int checkpoint) /* Called with replay mutex locked */ void replay_read_events(int checkpoint) { + g_assert(replay_mutex_locked()); while (replay_state.data_kind =3D=3D EVENT_ASYNC) { Event *event =3D replay_read_event(checkpoint); if (!event) { @@ -299,9 +295,7 @@ void replay_read_events(int checkpoint) } replay_finish_event(); read_event_kind =3D -1; - replay_mutex_unlock(); replay_run_event(event); - replay_mutex_lock(); =20 g_free(event); } diff --git a/replay/replay-internal.c b/replay/replay-internal.c index fa7bba6dfd..8e7474f787 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -174,6 +174,9 @@ static __thread bool replay_locked; void replay_mutex_init(void) { qemu_mutex_init(&lock); + /* Hold the mutex while we start-up */ + qemu_mutex_lock(&lock); + replay_locked =3D true; } =20 bool replay_mutex_locked(void) @@ -181,25 +184,31 @@ bool replay_mutex_locked(void) return replay_locked; } =20 +/* Ordering constraints, replay_lock must be taken before BQL */ void replay_mutex_lock(void) { - g_assert(!replay_mutex_locked()); - qemu_mutex_lock(&lock); - replay_locked =3D true; + if (replay_mode !=3D REPLAY_MODE_NONE) { + g_assert(!qemu_mutex_iothread_locked()); + g_assert(!replay_mutex_locked()); + qemu_mutex_lock(&lock); + replay_locked =3D true; + } } =20 void replay_mutex_unlock(void) { - g_assert(replay_mutex_locked()); - replay_locked =3D false; - qemu_mutex_unlock(&lock); + if (replay_mode !=3D REPLAY_MODE_NONE) { + g_assert(replay_mutex_locked()); + replay_locked =3D false; + qemu_mutex_unlock(&lock); + } } =20 /*! Saves cached instructions. */ void replay_save_instructions(void) { if (replay_file && replay_mode =3D=3D REPLAY_MODE_RECORD) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); int diff =3D (int)(replay_get_current_step() - replay_state.curren= t_step); =20 /* Time can only go forward */ @@ -210,6 +219,5 @@ void replay_save_instructions(void) replay_put_dword(diff); replay_state.current_step +=3D diff; } - replay_mutex_unlock(); } } diff --git a/replay/replay-time.c b/replay/replay-time.c index f70382a88f..6a7565ec8d 100644 --- a/replay/replay-time.c +++ b/replay/replay-time.c @@ -17,13 +17,13 @@ =20 int64_t replay_save_clock(ReplayClockKind kind, int64_t clock) { - replay_save_instructions(); =20 if (replay_file) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); + + replay_save_instructions(); replay_put_event(EVENT_CLOCK + kind); replay_put_qword(clock); - replay_mutex_unlock(); } =20 return clock; @@ -46,16 +46,16 @@ void replay_read_next_clock(ReplayClockKind kind) /*! Reads next clock event from the input. */ int64_t replay_read_clock(ReplayClockKind kind) { + g_assert(replay_file && replay_mutex_locked()); + replay_account_executed_instructions(); =20 if (replay_file) { int64_t ret; - replay_mutex_lock(); if (replay_next_event_is(EVENT_CLOCK + kind)) { replay_read_next_clock(kind); } ret =3D replay_state.cached_clock[kind]; - replay_mutex_unlock(); =20 return ret; } diff --git a/replay/replay.c b/replay/replay.c index 5d05ee0460..90f98b7490 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -81,7 +81,7 @@ int replay_get_instructions(void) void replay_account_executed_instructions(void) { if (replay_mode =3D=3D REPLAY_MODE_PLAY) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); if (replay_state.instructions_count > 0) { int count =3D (int)(replay_get_current_step() - replay_state.current_step); @@ -100,24 +100,22 @@ void replay_account_executed_instructions(void) qemu_notify_event(); } } - replay_mutex_unlock(); } } =20 bool replay_exception(void) { + if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + g_assert(replay_mutex_locked()); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_EXCEPTION); - replay_mutex_unlock(); return true; } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); bool res =3D replay_has_exception(); if (res) { - replay_mutex_lock(); replay_finish_event(); - replay_mutex_unlock(); } return res; } @@ -129,10 +127,9 @@ bool replay_has_exception(void) { bool res =3D false; if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); replay_account_executed_instructions(); - replay_mutex_lock(); res =3D replay_next_event_is(EVENT_EXCEPTION); - replay_mutex_unlock(); } =20 return res; @@ -141,17 +138,15 @@ bool replay_has_exception(void) bool replay_interrupt(void) { if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + g_assert(replay_mutex_locked()); replay_save_instructions(); - replay_mutex_lock(); replay_put_event(EVENT_INTERRUPT); - replay_mutex_unlock(); return true; } else if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); bool res =3D replay_has_interrupt(); if (res) { - replay_mutex_lock(); replay_finish_event(); - replay_mutex_unlock(); } return res; } @@ -163,10 +158,9 @@ bool replay_has_interrupt(void) { bool res =3D false; if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); replay_account_executed_instructions(); - replay_mutex_lock(); res =3D replay_next_event_is(EVENT_INTERRUPT); - replay_mutex_unlock(); } return res; } @@ -174,9 +168,8 @@ bool replay_has_interrupt(void) void replay_shutdown_request(ShutdownCause cause) { if (replay_mode =3D=3D REPLAY_MODE_RECORD) { - replay_mutex_lock(); + g_assert(replay_mutex_locked()); replay_put_event(EVENT_SHUTDOWN + cause); - replay_mutex_unlock(); } } =20 @@ -190,9 +183,9 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) return true; } =20 - replay_mutex_lock(); =20 if (replay_mode =3D=3D REPLAY_MODE_PLAY) { + g_assert(replay_mutex_locked()); if (replay_next_event_is(EVENT_CHECKPOINT + checkpoint)) { replay_finish_event(); } else if (replay_state.data_kind !=3D EVENT_ASYNC) { @@ -205,12 +198,12 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) checkpoint were processed */ res =3D replay_state.data_kind !=3D EVENT_ASYNC; } else if (replay_mode =3D=3D REPLAY_MODE_RECORD) { + g_assert(replay_mutex_locked()); replay_put_event(EVENT_CHECKPOINT + checkpoint); replay_save_events(checkpoint); res =3D true; } out: - replay_mutex_unlock(); return res; } =20 @@ -233,8 +226,6 @@ static void replay_enable(const char *fname, int mode) =20 atexit(replay_finish); =20 - replay_mutex_init(); - replay_file =3D fopen(fname, fmode); if (replay_file =3D=3D NULL) { fprintf(stderr, "Replay: open %s: %s\n", fname, strerror(errno)); @@ -242,8 +233,9 @@ static void replay_enable(const char *fname, int mode) } =20 replay_filename =3D g_strdup(fname); - replay_mode =3D mode; + replay_mutex_init(); + replay_state.data_kind =3D -1; replay_state.instructions_count =3D 0; replay_state.current_step =3D 0; diff --git a/util/main-loop.c b/util/main-loop.c index 7558eb5f53..992f9b0f34 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -29,6 +29,7 @@ #include "qemu/sockets.h" // struct in_addr needed for libslirp.h #include "sysemu/qtest.h" #include "sysemu/cpus.h" +#include "sysemu/replay.h" #include "slirp/libslirp.h" #include "qemu/main-loop.h" #include "block/aio.h" @@ -245,18 +246,19 @@ static int os_host_main_loop_wait(int64_t timeout) timeout =3D SCALE_MS; } =20 + if (timeout) { spin_counter =3D 0; - qemu_mutex_unlock_iothread(); } else { spin_counter++; } + qemu_mutex_unlock_iothread(); + replay_mutex_unlock(); =20 ret =3D qemu_poll_ns((GPollFD *)gpollfds->data, gpollfds->len, timeout= ); =20 - if (timeout) { - qemu_mutex_lock_iothread(); - } + replay_mutex_lock(); + qemu_mutex_lock_iothread(); =20 glib_pollfds_poll(); =20 @@ -463,8 +465,13 @@ static int os_host_main_loop_wait(int64_t timeout) poll_timeout_ns =3D qemu_soonest_timeout(poll_timeout_ns, timeout); =20 qemu_mutex_unlock_iothread(); + + replay_mutex_unlock(); + g_poll_ret =3D qemu_poll_ns(poll_fds, n_poll_fds + w->num, poll_timeou= t_ns); =20 + replay_mutex_lock(); + qemu_mutex_lock_iothread(); if (g_poll_ret > 0) { for (i =3D 0; i < w->num; i++) { diff --git a/vl.c b/vl.c index e81152417a..5925a4b502 100644 --- a/vl.c +++ b/vl.c @@ -3058,6 +3058,7 @@ int main(int argc, char **argv, char **envp) =20 qemu_init_cpu_list(); qemu_init_cpu_loop(); + qemu_mutex_lock_iothread(); =20 atexit(qemu_run_exit_notifiers); --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984597898587.5679350418345; Tue, 13 Mar 2018 16:43:17 -0700 (PDT) Received: from localhost ([::1]:43594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtZU-0002vP-19 for importer@patchew.org; Tue, 13 Mar 2018 19:43:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiq-0006UV-US for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsim-0004Ci-Ib for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:44 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsim-0004C0-Bw for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:40 -0400 Received: by mail-wr0-x241.google.com with SMTP id o8so2599429wra.1 for ; Tue, 13 Mar 2018 15:48:40 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=GahpV3pSBQjcTUHRybvZOQ7iXVz0wfAQy2xOoWpHmzA=; b=LsQbkohjLWS1gG93GOl2lArgQasReeB3ooaNT7AQ8wLNBm2KE3ViBn/KMMjsVD2F1C YHDGO9TV3ZwSR9/hbCWFQF6NTU10M40k3WIzLzu5p+UYzFqri/vj6bzLbuHF5FjCoUnD fMD6jpvgYNYwz8FKPZzaDWz8CavOaBmwpkN+VVopvQwCzVNY1zG+juSoJ4RKG/VSmg5i wr69VWyhJwEceIRG4eweYqUgkepT3Z7WKNfYvc3/J7GWes9ywdhV880kL2OPttfvUq4z lxoQmAG2C7ptPMTC3SzWHu7KcM8x2pUDgZryPxqiHaF4ObrlazlrtYoa2V71fuuvlHlM dKWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=GahpV3pSBQjcTUHRybvZOQ7iXVz0wfAQy2xOoWpHmzA=; b=mea1H4IxQgwhJDmuES0cQDujJoQtTYw+ng6tco/UDE5NaJ5VMIL8Pgur70/dfbE0RX ydbyE/DUDfOqO0lkg+Hh/oRWm6EYeEa078qwLE9U5anfRAhnUVMLfSrIdGI4t6EgJw3R 6CkDI+KKzozK+kNnpKOc4e0RbI/GXaFz2uIc5ioGkrxW4eD/DWnwSfTcXEoPCT+4XYDC SC+Sxhctgq/9w6GfUVTZs10X5s3P1Jh1GgTDM/WCz4qzkJKnHVl34nO+nsQQb/ZFwmaZ 3toEgKy9QCOAGQ/NesDBDCcqu6UBqAStbalbUX9SP8ykBTdEMJQw99d8UP+VzKDx6V9u RG7w== X-Gm-Message-State: AElRT7GEx/7ZnrK93DNzBm2rd3g4idEiMaOpXWhb0J7W0XVFeX8PJ0b+ lf2tKwPCz7xNzhMO3pmrhncasW3l X-Google-Smtp-Source: AG47ELvyGoawrHGe9ovjF5iio8y1EfHgFaQGlaVXbpronKXcwCe1KZWZEl7LePk9+HIu8DLuDzfq6g== X-Received: by 10.223.133.182 with SMTP id 51mr1799936wrt.226.1520981318953; Tue, 13 Mar 2018 15:48:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:13 +0100 Message-Id: <20180313224719.4954-64-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 63/69] replay: check return values of fwrite 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch adds error reporting when fwrite cannot completely save the buffer to the file. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095259.1060.86410.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-internal.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/replay/replay-internal.c b/replay/replay-internal.c index 8e7474f787..b077cb5fd5 100644 --- a/replay/replay-internal.c +++ b/replay/replay-internal.c @@ -24,12 +24,23 @@ static QemuMutex lock; =20 /* File for replay writing */ +static bool write_error; FILE *replay_file; =20 +static void replay_write_error(void) +{ + if (!write_error) { + error_report("replay write error"); + write_error =3D true; + } +} + void replay_put_byte(uint8_t byte) { if (replay_file) { - putc(byte, replay_file); + if (putc(byte, replay_file) =3D=3D EOF) { + replay_write_error(); + } } } =20 @@ -62,7 +73,9 @@ void replay_put_array(const uint8_t *buf, size_t size) { if (replay_file) { replay_put_dword(size); - fwrite(buf, 1, size, replay_file); + if (fwrite(buf, 1, size, replay_file) !=3D size) { + replay_write_error(); + } } } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209841189800.4604201837524897; Tue, 13 Mar 2018 16:35:18 -0700 (PDT) Received: from localhost ([::1]:43537 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtRu-0004fC-5R for importer@patchew.org; Tue, 13 Mar 2018 19:35:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsir-0006UY-0I for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsin-0004Do-Pt for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:45 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:40563) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsin-0004DG-KI for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:41 -0400 Received: by mail-wr0-x244.google.com with SMTP id s12so14667wre.7 for ; Tue, 13 Mar 2018 15:48:41 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dsy6/qBDo7N1pj+3YEWW/24s3ZMWabsCkcNkPA6O1+Y=; b=XgTWHG12MBDAEwdGUG3kYh+tIqBo8rFQzLAElXynTUwus0xlA/Dby2XdMe2OF5iR4Z Hq+Fcp8mW+KZ4QerZPTo/wMEdYOAuysEOfnyy8SKlDwAvk1VeABR0y3yjQhusOPCdoUh 2PvW1bmdrJnDl60cvnSVYAo5lnbpUFezHr1VAS+ali0jah598a2MC25XMuQtLU0yktmn Vy4jWSUsdvVhJVrKGjJETxYwRM8c8j0Ht1xW0FWevI/h4Ne6RwzxuUVyLg/RdPJUlOIX qqWSTublJOR4UdlzyqekHwHdE/N3UXXA0eMXNMW/ZcdCKF5zxNoejg+29vaCpRUP88UN m9xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dsy6/qBDo7N1pj+3YEWW/24s3ZMWabsCkcNkPA6O1+Y=; b=nCzVT6AVlc9RpJj69cOt3jJf6eVlmv61l8VN69gkkTXs4vlw+3cQ3bplC+VMm0JxUd JW/9C3CQkvbSn5Qr1z7G1SQGiXfYhp2JZefKKNCcaS/I7rSQx8S/9ScDqtt55GsW2oXt vp2ROAOZ+3ukqEYL6tyDJEGsoaw5rGlQAoUP65SWrEzXb23aMa+RQSnbKvcXdCWiDyWN BT6VX2vlr4sbUDEZoBFBkXNEDxm2eYc2+OjN6CzwhlJdYqAxCg5lZoyBFIUGAh0MRleB pzXwIfr/p23PejFKAU8KLlzpdJjiOvmTVMVM/l7eJM2bTmHJUfnkXcl3IlLaIcpQufPL Qv/A== X-Gm-Message-State: AElRT7G3WKgIyrBRLJ1sT9dV5/9aj3lrUYEvrJQdEtYNjg3GNWIJkTrr bHDMWIz5AdqHZG2dorXGESwwW7BM X-Google-Smtp-Source: AG47ELtsSpf1thJrjJ6LWRlLrr4Q4WblChFTp9fyTagwst43dYpwRuwtt0588B07D8u1XC0ciglRhg== X-Received: by 10.223.169.54 with SMTP id u51mr2028055wrc.232.1520981320215; Tue, 13 Mar 2018 15:48:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:14 +0100 Message-Id: <20180313224719.4954-65-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 64/69] replay: avoid recursive call of checkpoints 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch adds a flag which denies recursive call of replay_checkpoint function. Checkpoints may be accompanied by the hardware events. When event is processed, virtual device may invoke timer modification functions that also invoke the checkpoint function. This leads to infinite loop. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095305.1060.56463.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/replay/replay.c b/replay/replay.c index 90f98b7490..eae8daf18a 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -176,13 +176,24 @@ void replay_shutdown_request(ShutdownCause cause) bool replay_checkpoint(ReplayCheckpoint checkpoint) { bool res =3D false; + static bool in_checkpoint; assert(EVENT_CHECKPOINT + checkpoint <=3D EVENT_CHECKPOINT_LAST); - replay_save_instructions(); =20 if (!replay_file) { return true; } =20 + if (in_checkpoint) { + /* If we are already in checkpoint, then there is no need + for additional synchronization. + Recursion occurs when HW event modifies timers. + Timer modification may invoke the checkpoint and + proceed to recursion. */ + return true; + } + in_checkpoint =3D true; + + replay_save_instructions(); =20 if (replay_mode =3D=3D REPLAY_MODE_PLAY) { g_assert(replay_mutex_locked()); @@ -204,6 +215,7 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) res =3D true; } out: + in_checkpoint =3D false; return res; } =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15209843006141012.7635119078606; Tue, 13 Mar 2018 16:38:20 -0700 (PDT) Received: from localhost ([::1]:43554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtUp-000792-PA for importer@patchew.org; Tue, 13 Mar 2018 19:38:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsir-0006Up-90 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsip-0004Eu-CR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:45 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:35976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsip-0004EG-1P for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:43 -0400 Received: by mail-wr0-x234.google.com with SMTP id d10so2573276wrf.3 for ; Tue, 13 Mar 2018 15:48:42 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4Vlrd7SbMe43nB+/halXfcomflyEBlE8n2JZ+Snr2Jg=; b=i8+7cD65lAhNKWvXqTodXfJWwQu0QoQFhqHxsPTVegK02NlB7n5wyYexd5qZ/FtBRx QiFo+VTIu1kTXyEt3T0eWBdcy0Iop0H9/8hKYl6fwlSE8tHfSNEOqBHUtuvkFvOOlRdY RcuPxwLL3OppLKfo03spP6TfHpxakOEnF8JWndYCEuBzftoet4FHcreXkjZ9klmbE1iv Uq2kcNuhpApgu7ZRzyhiCAioYcMmhOlZJH6njIJ3JW1LNRKXP650gcCuWwOHxcFWJeBH vCxjGsOk/iutXNm5Es3TyfuG5ihtY9nQLloiMjdNlU5t4I5PVxXWQNpGW/JibRsN/sJ7 T/fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4Vlrd7SbMe43nB+/halXfcomflyEBlE8n2JZ+Snr2Jg=; b=qc0V0UjCp4VqLXwE4S6kVsFs8O03NfMFA9iJuNWbyRpQxYZEzvoIBmWF7ev72KvFTl 07oEVbr8Ltux8Y51ROzOQrFSirm83i1/wmVVRhhyCEjbiIlcsCdChYtiLZHPlKADez4P f4p4QRl0bnvNYwvEG8EJeVDD0pTdze0tykwVAQ6SokkLv+Prroyke7Qlr6ztDIAN2uz3 I4D6henD3klf65Q/gM0YOBfX6p2qdqv2YOl4Wy83V2uHVRiB6//EzBZIarz3vgstpQql krzDEWQpjw4Y7bV11naLUTwWi1DW+m5Vd0gL4D7Q/uUOx06uPuSB+9T0sV8GYutoIJ6Q t6+Q== X-Gm-Message-State: AElRT7EYLfQjvbog3p6PEV3JAMWjpyGXzfuAhZFJ/BzROR86HfkX2dbs qtm2SWllZlfq5NxGyiZraBeOrk5c X-Google-Smtp-Source: AG47ELshExzamyOKHXBThHvnZ9YlkYTS5yzfRpxoJZq8jM1Th4XUbKCEAKyGor7eEnpfAr87QEba1g== X-Received: by 10.223.176.237 with SMTP id j42mr1939890wra.25.1520981321487; Tue, 13 Mar 2018 15:48:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:15 +0100 Message-Id: <20180313224719.4954-66-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PULL 65/69] scripts/replay-dump.py: replay log dumper 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?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e This script is a debugging tool for looking through the contents of a replay log file. It is incomplete but should fail gracefully at events it doesn't understand. It currently understands two different log formats as the audio record/replay support was merged during since MTTCG. It was written to help debug what has caused the BQL changes to break replay support. Signed-off-by: Alex Benn=C3=A9e Message-Id: <20180227095310.1060.14500.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- scripts/replay-dump.py | 308 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 308 insertions(+) create mode 100755 scripts/replay-dump.py diff --git a/scripts/replay-dump.py b/scripts/replay-dump.py new file mode 100755 index 0000000000..e274086277 --- /dev/null +++ b/scripts/replay-dump.py @@ -0,0 +1,308 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Dump the contents of a recorded execution stream +# +# Copyright (c) 2017 Alex Benn=C3=83=C2=A9e +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +import argparse +import struct +from collections import namedtuple + +# This mirrors some of the global replay state which some of the +# stream loading refers to. Some decoders may read the next event so +# we need handle that case. Calling reuse_event will ensure the next +# event is read from the cache rather than advancing the file. + +class ReplayState(object): + def __init__(self): + self.event =3D -1 + self.event_count =3D 0 + self.already_read =3D False + self.current_checkpoint =3D 0 + self.checkpoint =3D 0 + + def set_event(self, ev): + self.event =3D ev + self.event_count +=3D 1 + + def get_event(self): + self.already_read =3D False + return self.event + + def reuse_event(self, ev): + self.event =3D ev + self.already_read =3D True + + def set_checkpoint(self): + self.checkpoint =3D self.event - self.checkpoint_start + + def get_checkpoint(self): + return self.checkpoint + +replay_state =3D ReplayState() + +# Simple read functions that mirror replay-internal.c +# The file-stream is big-endian and manually written out a byte at a time. + +def read_byte(fin): + "Read a single byte" + return struct.unpack('>B', fin.read(1))[0] + +def read_event(fin): + "Read a single byte event, but save some state" + if replay_state.already_read: + return replay_state.get_event() + else: + replay_state.set_event(read_byte(fin)) + return replay_state.event + +def read_word(fin): + "Read a 16 bit word" + return struct.unpack('>H', fin.read(2))[0] + +def read_dword(fin): + "Read a 32 bit word" + return struct.unpack('>I', fin.read(4))[0] + +def read_qword(fin): + "Read a 64 bit word" + return struct.unpack('>Q', fin.read(8))[0] + +# Generic decoder structure +Decoder =3D namedtuple("Decoder", "eid name fn") + +def call_decode(table, index, dumpfile): + "Search decode table for next step" + decoder =3D next((d for d in table if d.eid =3D=3D index), None) + if not decoder: + print "Could not decode index: %d" % (index) + print "Entry is: %s" % (decoder) + print "Decode Table is:\n%s" % (table) + return False + else: + return decoder.fn(decoder.eid, decoder.name, dumpfile) + +# Print event +def print_event(eid, name, string=3DNone, event_count=3DNone): + "Print event with count" + if not event_count: + event_count =3D replay_state.event_count + + if string: + print "%d:%s(%d) %s" % (event_count, name, eid, string) + else: + print "%d:%s(%d)" % (event_count, name, eid) + + +# Decoders for each event type + +def decode_unimp(eid, name, _unused_dumpfile): + "Unimplimented decoder, will trigger exit" + print "%s not handled - will now stop" % (name) + return False + +# Checkpoint decoder +def swallow_async_qword(eid, name, dumpfile): + "Swallow a qword of data without looking at it" + step_id =3D read_qword(dumpfile) + print " %s(%d) @ %d" % (name, eid, step_id) + return True + +async_decode_table =3D [ Decoder(0, "REPLAY_ASYNC_EVENT_BH", swallow_async= _qword), + Decoder(1, "REPLAY_ASYNC_INPUT", decode_unimp), + Decoder(2, "REPLAY_ASYNC_INPUT_SYNC", decode_unimp), + Decoder(3, "REPLAY_ASYNC_CHAR_READ", decode_unimp), + Decoder(4, "REPLAY_ASYNC_EVENT_BLOCK", decode_unimp= ), + Decoder(5, "REPLAY_ASYNC_EVENT_NET", decode_unimp), +] +# See replay_read_events/replay_read_event +def decode_async(eid, name, dumpfile): + """Decode an ASYNC event""" + + print_event(eid, name) + + async_event_kind =3D read_byte(dumpfile) + async_event_checkpoint =3D read_byte(dumpfile) + + if async_event_checkpoint !=3D replay_state.current_checkpoint: + print " mismatch between checkpoint %d and async data %d" % ( + replay_state.current_checkpoint, async_event_checkpoint) + return True + + return call_decode(async_decode_table, async_event_kind, dumpfile) + + +def decode_instruction(eid, name, dumpfile): + ins_diff =3D read_dword(dumpfile) + print_event(eid, name, "0x%x" % (ins_diff)) + return True + +def decode_audio_out(eid, name, dumpfile): + audio_data =3D read_dword(dumpfile) + print_event(eid, name, "%d" % (audio_data)) + return True + +def decode_checkpoint(eid, name, dumpfile): + """Decode a checkpoint. + + Checkpoints contain a series of async events with their own specific d= ata. + """ + replay_state.set_checkpoint() + # save event count as we peek ahead + event_number =3D replay_state.event_count + next_event =3D read_event(dumpfile) + + # if the next event is EVENT_ASYNC there are a bunch of + # async events to read, otherwise we are done + if next_event !=3D 3: + print_event(eid, name, "no additional data", event_number) + else: + print_event(eid, name, "more data follows", event_number) + + replay_state.reuse_event(next_event) + return True + +def decode_checkpoint_init(eid, name, dumpfile): + print_event(eid, name) + return True + +def decode_interrupt(eid, name, dumpfile): + print_event(eid, name) + return True + +def decode_clock(eid, name, dumpfile): + clock_data =3D read_qword(dumpfile) + print_event(eid, name, "0x%x" % (clock_data)) + return True + + +# pre-MTTCG merge +v5_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), + Decoder(1, "EVENT_INTERRUPT", decode_interrupt), + Decoder(2, "EVENT_EXCEPTION", decode_unimp), + Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(4, "EVENT_SHUTDOWN", decode_unimp), + Decoder(5, "EVENT_CHAR_WRITE", decode_unimp), + Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp), + Decoder(7, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp), + Decoder(8, "EVENT_CLOCK_HOST", decode_clock), + Decoder(9, "EVENT_CLOCK_VIRTUAL_RT", decode_clock), + Decoder(10, "EVENT_CP_CLOCK_WARP_START", decode_checkpoi= nt), + Decoder(11, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkp= oint), + Decoder(12, "EVENT_CP_RESET_REQUESTED", decode_checkpoin= t), + Decoder(13, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpo= int), + Decoder(14, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint), + Decoder(15, "EVENT_CP_CLOCK_HOST", decode_checkpoint), + Decoder(16, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoi= nt), + Decoder(17, "EVENT_CP_INIT", decode_checkpoint_init), + Decoder(18, "EVENT_CP_RESET", decode_checkpoint), +] + +# post-MTTCG merge, AUDIO support added +v6_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), + Decoder(1, "EVENT_INTERRUPT", decode_interrupt), + Decoder(2, "EVENT_EXCEPTION", decode_unimp), + Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(4, "EVENT_SHUTDOWN", decode_unimp), + Decoder(5, "EVENT_CHAR_WRITE", decode_unimp), + Decoder(6, "EVENT_CHAR_READ_ALL", decode_unimp), + Decoder(7, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp), + Decoder(8, "EVENT_AUDIO_OUT", decode_audio_out), + Decoder(9, "EVENT_AUDIO_IN", decode_unimp), + Decoder(10, "EVENT_CLOCK_HOST", decode_clock), + Decoder(11, "EVENT_CLOCK_VIRTUAL_RT", decode_clock), + Decoder(12, "EVENT_CP_CLOCK_WARP_START", decode_checkpoi= nt), + Decoder(13, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkp= oint), + Decoder(14, "EVENT_CP_RESET_REQUESTED", decode_checkpoin= t), + Decoder(15, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpo= int), + Decoder(16, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint), + Decoder(17, "EVENT_CP_CLOCK_HOST", decode_checkpoint), + Decoder(18, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoi= nt), + Decoder(19, "EVENT_CP_INIT", decode_checkpoint_init), + Decoder(20, "EVENT_CP_RESET", decode_checkpoint), +] + +# Shutdown cause added +v7_event_table =3D [Decoder(0, "EVENT_INSTRUCTION", decode_instruction), + Decoder(1, "EVENT_INTERRUPT", decode_interrupt), + Decoder(2, "EVENT_EXCEPTION", decode_unimp), + Decoder(3, "EVENT_ASYNC", decode_async), + Decoder(4, "EVENT_SHUTDOWN", decode_unimp), + Decoder(5, "EVENT_SHUTDOWN_HOST_ERR", decode_unimp), + Decoder(6, "EVENT_SHUTDOWN_HOST_QMP", decode_unimp), + Decoder(7, "EVENT_SHUTDOWN_HOST_SIGNAL", decode_unimp), + Decoder(8, "EVENT_SHUTDOWN_HOST_UI", decode_unimp), + Decoder(9, "EVENT_SHUTDOWN_GUEST_SHUTDOWN", decode_unimp= ), + Decoder(10, "EVENT_SHUTDOWN_GUEST_RESET", decode_unimp), + Decoder(11, "EVENT_SHUTDOWN_GUEST_PANIC", decode_unimp), + Decoder(12, "EVENT_SHUTDOWN___MAX", decode_unimp), + Decoder(13, "EVENT_CHAR_WRITE", decode_unimp), + Decoder(14, "EVENT_CHAR_READ_ALL", decode_unimp), + Decoder(15, "EVENT_CHAR_READ_ALL_ERROR", decode_unimp), + Decoder(16, "EVENT_AUDIO_OUT", decode_audio_out), + Decoder(17, "EVENT_AUDIO_IN", decode_unimp), + Decoder(18, "EVENT_CLOCK_HOST", decode_clock), + Decoder(19, "EVENT_CLOCK_VIRTUAL_RT", decode_clock), + Decoder(20, "EVENT_CP_CLOCK_WARP_START", decode_checkpoi= nt), + Decoder(21, "EVENT_CP_CLOCK_WARP_ACCOUNT", decode_checkp= oint), + Decoder(22, "EVENT_CP_RESET_REQUESTED", decode_checkpoin= t), + Decoder(23, "EVENT_CP_SUSPEND_REQUESTED", decode_checkpo= int), + Decoder(24, "EVENT_CP_CLOCK_VIRTUAL", decode_checkpoint), + Decoder(25, "EVENT_CP_CLOCK_HOST", decode_checkpoint), + Decoder(26, "EVENT_CP_CLOCK_VIRTUAL_RT", decode_checkpoi= nt), + Decoder(27, "EVENT_CP_INIT", decode_checkpoint_init), + Decoder(28, "EVENT_CP_RESET", decode_checkpoint), +] + +def parse_arguments(): + "Grab arguments for script" + parser =3D argparse.ArgumentParser() + parser.add_argument("-f", "--file", help=3D'record/replay dump to read= from', + required=3DTrue) + return parser.parse_args() + +def decode_file(filename): + "Decode a record/replay dump" + dumpfile =3D open(filename, "rb") + + # read and throwaway the header + version =3D read_dword(dumpfile) + junk =3D read_qword(dumpfile) + + print "HEADER: version 0x%x" % (version) + + if version =3D=3D 0xe02007: + event_decode_table =3D v7_event_table + replay_state.checkpoint_start =3D 12 + elif version =3D=3D 0xe02006: + event_decode_table =3D v6_event_table + replay_state.checkpoint_start =3D 12 + else: + event_decode_table =3D v5_event_table + replay_state.checkpoint_start =3D 10 + + try: + decode_ok =3D True + while decode_ok: + event =3D read_event(dumpfile) + decode_ok =3D call_decode(event_decode_table, event, dumpfile) + finally: + dumpfile.close() + +if __name__ =3D=3D "__main__": + args =3D parse_arguments() + decode_file(args.file) --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520986316005141.56805030927626; Tue, 13 Mar 2018 17:11:56 -0700 (PDT) Received: from localhost ([::1]:43508 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtM5-0000cj-KD for importer@patchew.org; Tue, 13 Mar 2018 19:29:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsir-0006Uh-5b for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiq-0004Fd-5E for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:45 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:40150) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsip-0004Et-Ur for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:44 -0400 Received: by mail-wm0-x244.google.com with SMTP id t6so882099wmt.5 for ; Tue, 13 Mar 2018 15:48:43 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=/AKEmLhNQt13Xd/dKSgMcFNBRR4tuZM3HZUkNF/3biI=; b=jXLr+xeY2lTSPfzR56hmGj1i+Sv22x33blpNHGEfUl/tdVpVNaHyfkjdjxYzP9HoJp 9P8j2YldXMhXV04zRHHa5Wz98KsgbLDnv3atTAys3J0yOEl1Ue9PiVDleu27kbH3ziGg rY4oUpif9QVLV8TlooY+/vcgfloUjBe7Mp/6dnhxnYY72IKBQKXZdjyKi33jdfrvER4Q Ieok+9/r4M/+xvOviQGj22Toy8Zqva9PJsM7DS0GJrxmpV0eHdVoudc4Z3svqzfHLpRO MoZfwiYeXNE1LwzZ63XoHQQ7UOZDRJxALGe4/21MCoaiT6fBo890Kj9neaPmXwwzhxYP zYUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=/AKEmLhNQt13Xd/dKSgMcFNBRR4tuZM3HZUkNF/3biI=; b=Cebp7LNEQrnGIcIp9+E2dFSkpGmkYztK+G4VV7FZzvdDa/ngv+ZBbd5QPcvp66ASFi +MGV0FQFCwXXDdQOaPO3Iv3i7FC/uEiwJupDzjOPt6MctxaJnjc/QjOqdDgj9KPMSQBW 4SAIjWWvhD9GUDf/H51E/6Fx3hhKv7shzq4BYvjyuiuSBoLmHzPPC+Eh9D5M97vK9b1h hn/5kQE8GG9Qh3UGNOgE63qLC1ihaoPbfhNXNIhKc4GtBHbQCjCBZW4vkO1zGWRosBi5 P5LrGGhj3dl9Xl5y2gOeD3Susf1LxPtSazuR0Tw551BgabqXUMvHC20AyxGDJJJVFA2G GrHw== X-Gm-Message-State: AElRT7GNamV/y76TVgIXpWbB8yL94tuSYazmJdiAG0GGmy0W3YdkfMgI VMn7xaqQuYWD3S7fTLsNr8miLjDb X-Google-Smtp-Source: AG47ELtUhHj6D2QxIQ1gAaLMA78sB+sQnsrQOonm0Ign+BDsrOQELQgJZPJAFAtVmLb4tVoeYswHQA== X-Received: by 10.28.74.88 with SMTP id x85mr2140495wma.106.1520981322557; Tue, 13 Mar 2018 15:48:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:16 +0100 Message-Id: <20180313224719.4954-67-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 66/69] replay: don't process async events when warping the clock 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk Virtual clock is warped from iothread and vcpu thread. When the hardware events associated with warp checkpoint, then interrupt delivering may be non-deterministic if checkpoint is processed in different threads in record and replay. This patch disables event processing for clock warp checkpoint and leaves all hardware events to other checkpoints (e.g., virtual clock). Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095316.1060.4134.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- replay/replay-events.c | 1 + replay/replay.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/replay/replay-events.c b/replay/replay-events.c index 54dd9d2606..3d5fc8a479 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -205,6 +205,7 @@ static void replay_save_event(Event *event, int checkpo= int) void replay_save_events(int checkpoint) { g_assert(replay_mutex_locked()); + g_assert(checkpoint !=3D CHECKPOINT_CLOCK_WARP_START); while (!QTAILQ_EMPTY(&events_list)) { Event *event =3D QTAILQ_FIRST(&events_list); replay_save_event(event, checkpoint); diff --git a/replay/replay.c b/replay/replay.c index eae8daf18a..8228261401 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -211,7 +211,12 @@ bool replay_checkpoint(ReplayCheckpoint checkpoint) } else if (replay_mode =3D=3D REPLAY_MODE_RECORD) { g_assert(replay_mutex_locked()); replay_put_event(EVENT_CHECKPOINT + checkpoint); - replay_save_events(checkpoint); + /* This checkpoint belongs to several threads. + Processing events from different threads is + non-deterministic */ + if (checkpoint !=3D CHECKPOINT_CLOCK_WARP_START) { + replay_save_events(checkpoint); + } res =3D true; } out: --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520983933238744.2987711981298; Tue, 13 Mar 2018 16:32:13 -0700 (PDT) Received: from localhost ([::1]:43525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtOq-0002HP-G5 for importer@patchew.org; Tue, 13 Mar 2018 19:32:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsis-0006Wl-OY for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsir-0004Gl-EZ for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:46 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsir-0004Fr-5Z for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:45 -0400 Received: by mail-wr0-x242.google.com with SMTP id v65so2495065wrc.11 for ; Tue, 13 Mar 2018 15:48:45 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=0fLcL6Se/Dki1X8TEMGzoVU3A36vkkDwDLOh4ZB5lSg=; b=kB8TnampRwOG/yr7zFotIC5/UUyujTLb8Put9kV82Bwmb0lBpi9Oqix0rDpnEU1kID 8s0Aa1BBfk7Gu+NoHtRwp/tuFGZnXAeLz4Qky2gI3y1oe1HWbFk5TbYs192NBvfy8BrI S2DgQRc3RuSN5Kv9Rfu7/n18erdy9+vxkLYHsgbN1AESLmuQWl55JWBsAQkkOq79R2jL a9fhbci5uQZDHS+6Kd2dcPj0l6wOeX9I4F8cAC5dnRknJON4MSvKkfLoi3nezbj8utBF S16RrD+GRLXnor7sFrvkgouI4gXNmG4m8DQcJGQuLzWvXw3u7OJuzydVhO+ai04dDp+H PZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=0fLcL6Se/Dki1X8TEMGzoVU3A36vkkDwDLOh4ZB5lSg=; b=Icr6CdaJOxUhAwoyupkyD4CRL8FoxebtLRBhlQ0nWJquhqAKU0v2g2SNXYXJ46rZe9 vLnYJboh8pWYZwX0NfHDiMeVkxBBZFbDybr6e1U8XnExlhFsKJmDdZcQmCwLdN++DYqk Ly1PCO2UnKkFbEIi5MkLybBbNznCaZV1qKNOZLsole4IciB78DcBKI7at99/e+prEVOC /t56AncyGF8L2sMFwCu0xzW0pKnH59SUBmcERIoopdcmfwwfWGUTYpFjbpWixCV8cPq0 qtuk95Xz4cPBMa4qVOyO72dWchcGSoLACgN/Dav97fZKY9qCsweBAGSKBGv+6oNlbtn9 6rgQ== X-Gm-Message-State: AElRT7Exzqgo7wIIDRNECSi5153pfiqucfVYf7wgget2PFukZ88ZBaE8 IY4c+KOKekE0JF3N6kQenKKmwsBN X-Google-Smtp-Source: AG47ELvKdAUcu7GoDp4QFml1g0oGkoMMss6VlktgXBpfMFuW3NbKw9GA8IAgwH3ak6zwXeWfz9wNsw== X-Received: by 10.223.161.195 with SMTP id v3mr1958153wrv.184.1520981323795; Tue, 13 Mar 2018 15:48:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:17 +0100 Message-Id: <20180313224719.4954-68-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 67/69] replay: save vmstate of the asynchronous 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch fixes saving and loading the snapshots in the replay mode. It is required for the snapshots created in the moment when the header of the asynchronous event is read. This information was not saved in the snapshot. After loading the vmstate replay continued with the file offs= et passed the event header. The event header is lost in this case and replay hangs. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095322.1060.53929.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini --- replay/replay-events.c | 44 +++++++++++++++++++++----------------------- replay/replay-internal.h | 6 ++++++ replay/replay-snapshot.c | 3 +++ 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/replay/replay-events.c b/replay/replay-events.c index 3d5fc8a479..707de3867b 100644 --- a/replay/replay-events.c +++ b/replay/replay-events.c @@ -27,10 +27,6 @@ typedef struct Event { } Event; =20 static QTAILQ_HEAD(, Event) events_list =3D QTAILQ_HEAD_INITIALIZER(events= _list); -static unsigned int read_event_kind =3D -1; -static uint64_t read_id =3D -1; -static int read_checkpoint =3D -1; - static bool events_enabled; =20 /* Functions */ @@ -218,58 +214,60 @@ void replay_save_events(int checkpoint) static Event *replay_read_event(int checkpoint) { Event *event; - if (read_event_kind =3D=3D -1) { - read_checkpoint =3D replay_get_byte(); - read_event_kind =3D replay_get_byte(); - read_id =3D -1; + if (replay_state.read_event_kind =3D=3D -1) { + replay_state.read_event_checkpoint =3D replay_get_byte(); + replay_state.read_event_kind =3D replay_get_byte(); + replay_state.read_event_id =3D -1; replay_check_error(); } =20 - if (checkpoint !=3D read_checkpoint) { + if (checkpoint !=3D replay_state.read_event_checkpoint) { return NULL; } =20 /* Events that has not to be in the queue */ - switch (read_event_kind) { + switch (replay_state.read_event_kind) { case REPLAY_ASYNC_EVENT_BH: - if (read_id =3D=3D -1) { - read_id =3D replay_get_qword(); + if (replay_state.read_event_id =3D=3D -1) { + replay_state.read_event_id =3D replay_get_qword(); } break; case REPLAY_ASYNC_EVENT_INPUT: event =3D g_malloc0(sizeof(Event)); - event->event_kind =3D read_event_kind; + event->event_kind =3D replay_state.read_event_kind; event->opaque =3D replay_read_input_event(); return event; case REPLAY_ASYNC_EVENT_INPUT_SYNC: event =3D g_malloc0(sizeof(Event)); - event->event_kind =3D read_event_kind; + event->event_kind =3D replay_state.read_event_kind; event->opaque =3D 0; return event; case REPLAY_ASYNC_EVENT_CHAR_READ: event =3D g_malloc0(sizeof(Event)); - event->event_kind =3D read_event_kind; + event->event_kind =3D replay_state.read_event_kind; event->opaque =3D replay_event_char_read_load(); return event; case REPLAY_ASYNC_EVENT_BLOCK: - if (read_id =3D=3D -1) { - read_id =3D replay_get_qword(); + if (replay_state.read_event_id =3D=3D -1) { + replay_state.read_event_id =3D replay_get_qword(); } break; case REPLAY_ASYNC_EVENT_NET: event =3D g_malloc0(sizeof(Event)); - event->event_kind =3D read_event_kind; + event->event_kind =3D replay_state.read_event_kind; event->opaque =3D replay_event_net_load(); return event; default: - error_report("Unknown ID %d of replay event", read_event_kind); + error_report("Unknown ID %d of replay event", + replay_state.read_event_kind); exit(1); break; } =20 QTAILQ_FOREACH(event, &events_list, events) { - if (event->event_kind =3D=3D read_event_kind - && (read_id =3D=3D -1 || read_id =3D=3D event->id)) { + if (event->event_kind =3D=3D replay_state.read_event_kind + && (replay_state.read_event_id =3D=3D -1 + || replay_state.read_event_id =3D=3D event->id)) { break; } } @@ -295,7 +293,7 @@ void replay_read_events(int checkpoint) break; } replay_finish_event(); - read_event_kind =3D -1; + replay_state.read_event_kind =3D -1; replay_run_event(event); =20 g_free(event); @@ -304,7 +302,7 @@ void replay_read_events(int checkpoint) =20 void replay_init_events(void) { - read_event_kind =3D -1; + replay_state.read_event_kind =3D -1; } =20 void replay_finish_events(void) diff --git a/replay/replay-internal.h b/replay/replay-internal.h index d4037058e4..ac4b27b674 100644 --- a/replay/replay-internal.h +++ b/replay/replay-internal.h @@ -80,6 +80,12 @@ typedef struct ReplayState { uint64_t block_request_id; /*! Prior value of the host clock */ uint64_t host_clock_last; + /*! Asynchronous event type read from the log */ + int32_t read_event_kind; + /*! Asynchronous event id read from the log */ + uint64_t read_event_id; + /*! Asynchronous event checkpoint id read from the log */ + int32_t read_event_checkpoint; } ReplayState; extern ReplayState replay_state; =20 diff --git a/replay/replay-snapshot.c b/replay/replay-snapshot.c index e0b2204765..2ab85cfc60 100644 --- a/replay/replay-snapshot.c +++ b/replay/replay-snapshot.c @@ -57,6 +57,9 @@ static const VMStateDescription vmstate_replay =3D { VMSTATE_UINT64(file_offset, ReplayState), VMSTATE_UINT64(block_request_id, ReplayState), VMSTATE_UINT64(host_clock_last, ReplayState), + VMSTATE_INT32(read_event_kind, ReplayState), + VMSTATE_UINT64(read_event_id, ReplayState), + VMSTATE_INT32(read_event_checkpoint, ReplayState), VMSTATE_END_OF_LIST() }, }; --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984476641488.2806214455511; Tue, 13 Mar 2018 16:41:16 -0700 (PDT) Received: from localhost ([::1]:43575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtXf-0001Dc-MT for importer@patchew.org; Tue, 13 Mar 2018 19:41:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiv-0006Ym-0h for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsit-0004I4-7l for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:48 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:34753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsis-0004HK-SR for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:47 -0400 Received: by mail-wm0-x229.google.com with SMTP id a20so16164583wmd.1 for ; Tue, 13 Mar 2018 15:48:46 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5EJ5QKXvv/r+l3jOBspIqp/YXJzdxuVremBWi0vkpdY=; b=pdpNXVTlAil1BOho6gYMqepAcGikGOeKqHOamsJ5otpdUx+MFLRuhvUqwLqxxazFVZ IxDrJzMFWc+HX7WiNM9U3wlL/jzc5dM05tyzbHyYImOG4DiONNm615K/v0y9eGLgUnnC NSAw6lpHsrCRQX31r/oDmQEHlsc3tvogy1xkVTf7XFM3ljwMGIkvu2zbPHEKI7yoUcud XEtBR7LSZpX7JtmZu5Ud/8VeUAxY3g1gMs8M0g0SdiEx2M/ASoXxNuxThZuOqgHESJdE aCi77bl+ESdNy4hjMxrhno04UNxR0JGfeUl9rPaUY0vOsPYZ/NGJ+fLF5V6XDFJV/8zs +H0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5EJ5QKXvv/r+l3jOBspIqp/YXJzdxuVremBWi0vkpdY=; b=ngE/DQRtQoIOOuNQZdCBWnRgrZxtvPqsrwqKQFO6ZnKpTC0meZKhGjvQqQa5ABq1lk 6OK/2S0Le6lzCOtk2x/VFb5Xd7TgJg+jMHbhThUIt5XAWq4y5spEaPVtUoEUCPIjOaqo yyWUK6VcPjr6Bpyxb7ATGRrSxPSnd8y9qwz+7x40PTVBrxf+kH6OygAO2PeUKuX/e6mM 0pv9T0QZ8Vxy/uwafp1ZphnSoXc3yGhY9wuyFgU8E9vKX4HKIcSHhIHNgnccRe8kFlUa iCauWzCitL05tRY4nBuBLBQc/qpN3StLq1jSDvetyJLOsdKIAsIoxj2vPO5f3tPeQLW+ SlRA== X-Gm-Message-State: AElRT7HUG2WsE5LoVKrqWlHd2aIV49rEvmlv3DiGY1e/ziEjfJ5BUAzZ KGSXTffjYG0IAk6FHY1x0BrehRa5 X-Google-Smtp-Source: AG47ELtyA+nlME3ekvCd2wm33w0MOynFgjN/4O8VG/Mzk9PTags18+OFaxv4KjF2g3IKBCKGZGDRrQ== X-Received: by 10.28.144.82 with SMTP id s79mr1944980wmd.4.1520981325286; Tue, 13 Mar 2018 15:48:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:18 +0100 Message-Id: <20180313224719.4954-69-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::229 Subject: [Qemu-devel] [PULL 68/69] replay: update documentation 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk This patch clarifies the description of the record/replay feature in docs/replay.txt Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095333.1060.1331.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- docs/replay.txt | 72 +++++++++++++++++++++++++++++++++++++++++------------= ---- 1 file changed, 52 insertions(+), 20 deletions(-) diff --git a/docs/replay.txt b/docs/replay.txt index 959633e7ea..2e21e9ccb0 100644 --- a/docs/replay.txt +++ b/docs/replay.txt @@ -7,14 +7,10 @@ See the COPYING file in the top-level directory. Record/replay ------------- =20 -Record/replay functions are used for the reverse execution and determinist= ic -replay of qemu execution. This implementation of deterministic replay can -be used for deterministic debugging of guest code through a gdb remote -interface. - +Record/replay functions are used for the deterministic replay of qemu exec= ution. Execution recording writes a non-deterministic events log, which can be la= ter used for replaying the execution anywhere and for unlimited number of time= s. -It also supports checkpointing for faster rewinding during reverse debuggi= ng. +It also supports checkpointing for faster rewind to the specific replay mo= ment. Execution replaying reads the log and replays all non-deterministic events including external input, hardware clocks, and interrupts. =20 @@ -28,16 +24,36 @@ Deterministic replay has the following features: input devices. =20 Usage of the record/replay: - * First, record the execution, by adding the following arguments to the c= ommand line: - '-icount shift=3D7,rr=3Drecord,rrfile=3Dreplay.bin -net none'. - Block devices' images are not actually changed in the recording mode, + * First, record the execution with the following command line: + qemu-system-i386 \ + -icount shift=3D7,rr=3Drecord,rrfile=3Dreplay.bin \ + -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct \ + -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkre= play \ + -device ide-hd,drive=3Dimg-blkreplay \ + -netdev user,id=3Dnet1 -device rtl8139,netdev=3Dnet1 \ + -object filter-replay,id=3Dreplay,netdev=3Dnet1 + * After recording, you can replay it by using another command line: + qemu-system-i386 \ + -icount shift=3D7,rr=3Dreplay,rrfile=3Dreplay.bin \ + -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct \ + -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkre= play \ + -device ide-hd,drive=3Dimg-blkreplay \ + -netdev user,id=3Dnet1 -device rtl8139,netdev=3Dnet1 \ + -object filter-replay,id=3Dreplay,netdev=3Dnet1 + The only difference with recording is changing the rr option + from record to replay. + * Block device images are not actually changed in the recording mode, because all of the changes are written to the temporary overlay file. - * Then you can replay it by using another command - line option: '-icount shift=3D7,rr=3Dreplay,rrfile=3Dreplay.bin -net no= ne' - * '-net none' option should also be specified if network replay patches - are not applied. - -Papers with description of deterministic replay implementation: + This behavior is enabled by using blkreplay driver. It should be used + for every enabled block device, as described in 'Block devices' section. + * '-net none' option should be specified when network is not used, + because QEMU adds network card by default. When network is needed, + it should be configured explicitly with replay filter, as described + in 'Network devices' section. + * Interaction with audio devices and serial ports are recorded and replay= ed + automatically when such devices are enabled. + +Academic papers with description of deterministic replay implementation: http://www.computer.org/csdl/proceedings/csmr/2012/4666/00/4666a553-abs.ht= ml http://dl.acm.org/citation.cfm?id=3D2786805.2803179 =20 @@ -46,8 +62,11 @@ Modifications of qemu include: * saving different asynchronous events (e.g. system shutdown) into the log * synchronization of the bottom halves execution * synchronization of the threads from thread pool - * recording/replaying user input (mouse and keyboard) + * recording/replaying user input (mouse, keyboard, and microphone) * adding internal checkpoints for cpu and io synchronization + * network filter for recording and replaying the packets + * block driver for making block layer deterministic + * serial port input record and replay =20 Locking and thread synchronisation ---------------------------------- @@ -77,12 +96,11 @@ Non-deterministic events Our record/replay system is based on saving and replaying non-deterministic events (e.g. keyboard input) and simulating deterministic ones (e.g. readi= ng from HDD or memory of the VM). Saving only non-deterministic events makes -log file smaller, simulation faster, and allows using reverse debugging ev= en -for realtime applications. +log file smaller and simulation faster. =20 The following non-deterministic data from peripheral devices is saved into the log: mouse and keyboard input, network packets, audio controller input, -USB packets, serial port input, and hardware clocks (they are non-determin= istic +serial port input, and hardware clocks (they are non-deterministic too, because their values are taken from the host machine). Inputs from simulated hardware, memory of VM, software interrupts, and execution of instructions are not saved into the log, because they are deterministic and @@ -205,7 +223,7 @@ Block devices record/replay module intercepts calls of bdrv coroutine functions at the top of block drivers stack. To record and replay block operations the drive must be configured as following: - -drive file=3Ddisk.qcow,if=3Dnone,id=3Dimg-direct + -drive file=3Ddisk.qcow2,if=3Dnone,id=3Dimg-direct -drive driver=3Dblkreplay,if=3Dnone,image=3Dimg-direct,id=3Dimg-blkreplay -device ide-hd,drive=3Dimg-blkreplay =20 @@ -234,6 +252,12 @@ This snapshot is created at start of recording and res= tored at start of replaying. It also can be loaded while replaying to roll back the execution. =20 +Use QEMU monitor to create additional snapshots. 'savevm ' command +created the snapshot and 'loadvm ' restores it. To prevent corruption +of the original disk image, use overlay files linked to the original image= s. +Therefore all new snapshots (including the starting one) will be saved in +overlays and the original image remains unchanged. + Network devices --------------- =20 @@ -255,6 +279,14 @@ Audio data is recorded and replay automatically. The c= ommand line for recording and replaying must contain identical specifications of audio hardware, e.g= .: -soundhw ac97 =20 +Serial ports +------------ + +Serial ports input is recorded and replay automatically. The command lines +for recording and replaying must contain identical number of ports in reco= rd +and replay modes, but their backends may differ. +E.g., '-serial stdio' in record mode, and '-serial null' in replay mode. + Replay log format ----------------- =20 --=20 2.14.3 From nobody Tue Dec 16 05:36:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1520984744646536.4302704039483; Tue, 13 Mar 2018 16:45:44 -0700 (PDT) Received: from localhost ([::1]:43613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evtbz-0005MU-NK for importer@patchew.org; Tue, 13 Mar 2018 19:45:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evsiv-0006Yn-0i for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evsiu-0004IN-01 for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:49 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33103) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evsit-0004Hv-PL for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:48:47 -0400 Received: by mail-wm0-x242.google.com with SMTP id s206so16181396wme.0 for ; Tue, 13 Mar 2018 15:48:47 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.48.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XAh0cTYGWr98+60+kv5Q99wVSYfI9EVhd1DOIudsuN8=; b=ISFVddFbE+DQOawqORs/1fRoJkWqCCzMY4p27dYMlrRIYSPXSPhuUTbYXM+HlXD8M9 Iwu3lOogPWfldj62XrVXBp/nyyerseWEjl5GD3b3+QVuFp0oS9tz2JgAtGFuEmc5Zksb WDW4HFwcesQD4WM5qgNEwtP6MvbNDaFJRPmHbPhHGwBjSDFXY4AnY5RvFDwZoZlLPtBG qTWTXR7C8J4NDkioFHi80e3fbarWvsBe16D3Oz/ERls9yQwum/GNu5+8wOkv31gWZFoT Zt2yk5baBjeETvb85NhmDIW5tAXrAE7PO1/+4Sfz6OHkbS4HmOsdrJg85UhskesjyzDd GhtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=XAh0cTYGWr98+60+kv5Q99wVSYfI9EVhd1DOIudsuN8=; b=kPlxcGbJpW2f27YPtl6TGxZQHdekI/CK4TAiC/Nu3B7wVy0qEQE2v325NkkD/efkKb j1n1oVOcsHG3A+6wplHuAdxPNIbFd+lLxE+FM5r5oqij1JZOkp10a9WR6BThGzuP5w4s SNsYsLXg8chwq7LZSjsKeAAr6dggduK14KmhDPeDl76UXxUJClCnQtYC+nht3VaY42BJ tv9wZH7uUE701p5k0B4yY5Kp4q/2S+mHUFJ7zivnmC6aCRZx5Jw2iFJ+v463G7MYaj1Q oRxg5cuF7SQWBPhecvvjSmZeQna1XVpcdEXpQiBEvCeUFl9X4qjvSt3aY8X9iG2PRShj oqyg== X-Gm-Message-State: AElRT7E8a1ylB2u+YURDDQjNmRe2EhvuyfFd+gbWD+G8zsly1sjnVeID o5miLSqlVckocBNlLHE/HGMNzDoc X-Google-Smtp-Source: AG47ELs2qaVMJRD3n5vIjwk2ayBYfQiVOSVDrS0e8CYmARLJo58fTBICdWfKFuxOde3H5eGfuUcIEA== X-Received: by 10.28.51.67 with SMTP id z64mr1966684wmz.59.1520981326304; Tue, 13 Mar 2018 15:48:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:47:19 +0100 Message-Id: <20180313224719.4954-70-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 69/69] tcg: fix cpu_io_recompile 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: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Pavel Dovgalyuk cpu_io_recompile() function was broken by the commit 9b990ee5a3cc6aa38f81266fb0c6ef37a36c45b9. Instead of regenerating the block starting from PC of the original block, it just set the instructi= on counter for TCG. In most cases this was unnoticed, but in icount mode there was an exception for incorrect usage of CF_LAST_IO flag. This patch recovers recompilation of the original block and also configures translation for executing single IO instruction which caused a recompilation. Signed-off-by: Pavel Dovgalyuk Message-Id: <20180227095338.1060.27385.stgit@pasha-VirtualBox> Signed-off-by: Paolo Bonzini Signed-off-by: Pavel Dovgalyuk --- accel/tcg/translate-all.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 67795cd78c..5ad1b919bc 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1728,7 +1728,8 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retadd= r) CPUArchState *env =3D cpu->env_ptr; #endif TranslationBlock *tb; - uint32_t n; + uint32_t n, flags; + target_ulong pc, cs_base; =20 tb_lock(); tb =3D tb_find_pc(retaddr); @@ -1766,8 +1767,14 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_abort(cpu, "TB too big during recompile"); } =20 - /* Adjust the execution state of the next TB. */ - cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | n; + pc =3D tb->pc; + cs_base =3D tb->cs_base; + flags =3D tb->flags; + tb_phys_invalidate(tb, -1); + + /* Execute one IO instruction without caching + instead of creating large TB. */ + cpu->cflags_next_tb =3D curr_cflags() | CF_LAST_IO | CF_NOCACHE | 1; =20 if (tb->cflags & CF_NOCACHE) { if (tb->orig_tb) { @@ -1778,6 +1785,11 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) tb_remove(tb); } =20 + /* Generate new TB instead of the current one. */ + /* FIXME: In theory this could raise an exception. In practice + we have already translated the block once so it's probably ok. */ + tb_gen_code(cpu, pc, cs_base, flags, curr_cflags() | CF_LAST_IO | n); + /* TODO: If env->pc !=3D tb->pc (i.e. the faulting instruction was not * the first in the TB) then we end up generating a whole new TB and * repeating the fault, which is horribly inefficient. --=20 2.14.3