From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670719; cv=none; d=zohomail.com; s=zohoarc; b=SyS5gxzQ/qfttph3Ms2fEz9aqt/YKBAt1VFmjax72WnUSTTZNA26wIc/JVuKX3Qz8e/Rt4IrQlVCEs7M+6nNBZRA0cPpBk4WPyWokqcCoRzdu8pHHMnCdSS4hvInVZm8p0vmEEgJrPseNdsydRN3LbRpE/v++GCYxJrQpHGOiQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670719; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gryOh3U23b2tAbBDpurdFE7ycHJ1ns2a5UODB6airmA=; b=RPak4pEb4wXtTqru2HbKFYY8vt+8AFNYK+HbrkIQjodCe8mnxzJIEOrjhNgeypf+G7CLh0NoWZEcpyjDEAVD3mcHGV/WK0pilDt9DmwczUPAcIZ0UG5yOOIPsXrSpqRcbsJZhmo5syN9uFfG0HA0odJy4CrhT/kE5bG4z81xteA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670719628522.4542948528488; Wed, 18 Dec 2019 04:05:19 -0800 (PST) Received: from localhost ([::1]:53160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY4r-00088p-T4 for importer@patchew.org; Wed, 18 Dec 2019 07:05:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44126) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2e-0005uk-Kf for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2c-0007jv-V1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:00 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:53436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2c-0007hC-Hw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:02:58 -0500 Received: by mail-wm1-x330.google.com with SMTP id m24so1550921wmc.3 for ; Wed, 18 Dec 2019 04:02:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.02.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:02:56 -0800 (PST) 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=gryOh3U23b2tAbBDpurdFE7ycHJ1ns2a5UODB6airmA=; b=gjPFCwmk0rHZowOIWWp8cZocVrP53gD0WQVEapC9qtK03Xt7eBbjSpIZhekZ0Lrpko qqRdC5j2x6XTlxX89HsOMofQ1LdoKp5JPuZEqoaSXGMbZkmZ4NUeSqyjSv+be5oeR1rR 8N2B4KNjy0UIe0RZPPjcZ8Hsjtc8e6o78Lw2NtWYFayHUW0Z3JpAbXCD9EijCvNlHyjC ZQXA7rHqtDAublYKOSnmnElXVE1JU4qE8tQzX2e4BHqLg9Ihqkuq9rXsTDVKCb7I18DB WToOIs09itDaa4oUTr/U6ZOiSXt8YK2Fyvov99l0rYiq+FahCWUWIlz4MlM4tow4ObqO hcTw== 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=gryOh3U23b2tAbBDpurdFE7ycHJ1ns2a5UODB6airmA=; b=OjfCXN++nEScAfWUw85mXhxkIy/K0oghR9gLhXijdAKGsLisTIwZd0e78QJ2CWvedM XP0GnWP2Z6B3pwEnk84CH+UXrOG0IREoGFV+aMo1PdH4A/T/4iHs8Y/huic6APE56zlD xCNwLe5sirpyWjQ4jTK2RU8OkYXg9fwaAcgx6nL0mablsP8HbxA5um5ccQhozWRJOqpB KE3ciDE8B96e8vukD7TbjE1qP9r0SYL3/32rJwYEevOWlblOgVyuJEmiVkD9U2BtkQpS XLfPZfjcey8VRgB7AAjEGubEfUJVc/7BXxZIiXL1KytZe0xdYqJ6wjpMolecd1JJZVfS 8SJg== X-Gm-Message-State: APjAAAXQ/Cn+b6XbSoALXpEhZQvHCdHOpgXrAhKxUVryAyJqgiwlQ6ye kOBZecL9aQt2yOAlsLsOFxVs8AGZ X-Google-Smtp-Source: APXvYqyFSz+4Gh4NQcw4rvLcSfQcUvKa7zoE5HSBcdzx99fxkPcJyi4aN434LxwukNobURRUEqomQw== X-Received: by 2002:a7b:c407:: with SMTP id k7mr2948665wmi.46.1576670576659; Wed, 18 Dec 2019 04:02:56 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/87] kvm: Reallocate dirty_bmap when we change a slot Date: Wed, 18 Dec 2019 13:01:27 +0100 Message-Id: <1576670573-48048-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" kvm_set_phys_mem can be called to reallocate a slot by something the guest does (e.g. writing to PAM and other chipset registers). This can happen in the middle of a migration, and if we're unlucky it can now happen between the split 'sync' and 'clear'; the clear asserts if there's no bmap to clear. Recreate the bmap whenever we change the slot, keeping the clear path happy. Typically this is triggered by the guest rebooting during a migrate. Corresponds to: https://bugzilla.redhat.com/show_bug.cgi?id=3D1772774 https://bugzilla.redhat.com/show_bug.cgi?id=3D1771032 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu --- accel/kvm/kvm-all.c | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index ca00daa..7b9f92d 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -518,6 +518,27 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionS= ection *section, =20 #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) =20 +/* Allocate the dirty bitmap for a slot */ +static void kvm_memslot_init_dirty_bitmap(KVMSlot *mem) +{ + /* + * XXX bad kernel interface alert + * For dirty bitmap, kernel allocates array of size aligned to + * bits-per-long. But for case when the kernel is 64bits and + * the userspace is 32bits, userspace can't align to the same + * bits-per-long, since sizeof(long) is different between kernel + * and user space. This way, userspace will provide buffer which + * may be 4 bytes less than the kernel will use, resulting in + * userspace memory corruption (which is not detectable by valgrind + * too, in most cases). + * So for now, let's align to 64 instead of HOST_LONG_BITS here, in + * a hope that sizeof(long) won't become >8 any time soon. + */ + hwaddr bitmap_size =3D ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), + /*HOST_LONG_BITS*/ 64) / 8; + mem->dirty_bmap =3D g_malloc0(bitmap_size); +} + /** * kvm_physical_sync_dirty_bitmap - Sync dirty bitmap from kernel space * @@ -550,23 +571,9 @@ static int kvm_physical_sync_dirty_bitmap(KVMMemoryLis= tener *kml, goto out; } =20 - /* XXX bad kernel interface alert - * For dirty bitmap, kernel allocates array of size aligned to - * bits-per-long. But for case when the kernel is 64bits and - * the userspace is 32bits, userspace can't align to the same - * bits-per-long, since sizeof(long) is different between kernel - * and user space. This way, userspace will provide buffer which - * may be 4 bytes less than the kernel will use, resulting in - * userspace memory corruption (which is not detectable by valgrind - * too, in most cases). - * So for now, let's align to 64 instead of HOST_LONG_BITS here, in - * a hope that sizeof(long) won't become >8 any time soon. - */ if (!mem->dirty_bmap) { - hwaddr bitmap_size =3D ALIGN(((mem->memory_size) >> TARGET_PAG= E_BITS), - /*HOST_LONG_BITS*/ 64) / 8; /* Allocate on the first log_sync, once and for all */ - mem->dirty_bmap =3D g_malloc0(bitmap_size); + kvm_memslot_init_dirty_bitmap(mem); } =20 d.dirty_bitmap =3D mem->dirty_bmap; @@ -1067,6 +1074,13 @@ static void kvm_set_phys_mem(KVMMemoryListener *kml, mem->ram =3D ram; mem->flags =3D kvm_mem_flags(mr); =20 + if (mem->flags & KVM_MEM_LOG_DIRTY_PAGES) { + /* + * Reallocate the bmap; it means it doesn't disappear in + * middle of a migrate. + */ + kvm_memslot_init_dirty_bitmap(mem); + } err =3D kvm_set_user_memory_region(kml, mem, true); if (err) { fprintf(stderr, "%s: error registering slot: %s\n", __func__, --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670718; cv=none; d=zohomail.com; s=zohoarc; b=cUJT+9HkwhDGG+LC+xoRcvTYcZ+/tYz1cvTa/dcRIWYTDL2pw1MjtchfGKsilIzrhxVRQB0NjrOR1Lj322Cd+zghPM7DK4xZOYMev9mRHVtJDplC9MN97116f3FDVrfnBiLRjJEbbpf2IBNppok8K0T/jTLpZANGWUV6Gd4Ae+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670718; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=BLttWc7xIfiVJzAzVWvbxazDo12fWqVBLMv/5vrUv30=; b=lyRBuBk5Kn0cMfRajIVQLMkDfJqEXReMeD+gtnyRRDclEFqT4ssqDCW9XEI7j822sDYAXtN7vaawSKPp0kWAPKmvhj/mZK30wC8SkihDp47mYXm4QgL7QvOJANR9CgnQBzI+FOlYk3f3WmIDkCf9xxHP/Aq9IMArMlQGsJtv6Ms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670718789343.9985872842823; Wed, 18 Dec 2019 04:05:18 -0800 (PST) Received: from localhost ([::1]:53159 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY4q-000866-FX for importer@patchew.org; Wed, 18 Dec 2019 07:05:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44151) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2e-0005ur-Me for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2d-0007kp-4d for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:00 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:35501) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2c-0007hF-SB for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:02:59 -0500 Received: by mail-wm1-x32d.google.com with SMTP id p17so1618794wmb.0 for ; Wed, 18 Dec 2019 04:02:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.02.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:02:56 -0800 (PST) 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=BLttWc7xIfiVJzAzVWvbxazDo12fWqVBLMv/5vrUv30=; b=K+XJm6HNnf5lU1sEDWYXI1c0KD/VUpWBRPNW1dk2EfO77fR4UG2fAlPvibeY5FU4fJ lH/Yey/fYdDCC60dLDRoRR26mnEewoOtWZ03cxmzNIwM2870o/OFm4jbtKPHMOFsfgIf 0QrlqoQPxMv4IKAPxK5t2LU6NKPvL2hponkkdVsaWkDz3nQobYFcYMkCNE3cDWTfM9Un nwAGiFUmd2z+s/AKU1py8ZQZaTEmdBtvS1LrHL82+FyMlpa8qOr510GoxqJ+jbK+1UcP ty0YP02H0RRJLR510KQ7xKZ/6GSAKKOGlc8fPi8j8xA9QhXZBVmooG+8BDTSLWPHLAIj n5gw== 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=BLttWc7xIfiVJzAzVWvbxazDo12fWqVBLMv/5vrUv30=; b=Bt1PNrsxhW2KNoFW3QukXriUTjXTM1NrhWjfqEeSl4bPlPrWcq02c9yrRlotNpmMKb 6bOV1HA6JMZtdJDUMz5Xg853c5gpcmydN1jrtY03PH0CIBive3Gv+KD3K6bgjwP+h2FO 5PBHS0MHRIl9gvOQMwJ1dpxDDuDu2FzNZ7c7VSTdBmSrSXuxBKPfs2c5Trf711rjLU78 YI5tnuZ/csv/0BMGIASa+q/RIP6mHzsz5G83reEKt3Y1JfneW9W48JpxJ2izGVGeYRAv MP2KFmzLOXmS56npgw1xCCbtxcukPsvVJBVxKgE7gxhOn1bmVNBzJok3Yk+g9pGRfhFn bR3g== X-Gm-Message-State: APjAAAWLFlTzzlzMguVsi7YfPBBoH/cMKU223ImxQ1h5REBsJDJJ5wi5 hkTifj2WB28ZGxl3C3+/0eGMpMu7 X-Google-Smtp-Source: APXvYqypAuJP/R2x7XQZo/1L8qbed3Ah/IF79bSDN3kFPU6Mto8fGmhmHjflCD02uFkJwZO4C5lPsw== X-Received: by 2002:a1c:f60f:: with SMTP id w15mr2791082wmc.132.1576670577385; Wed, 18 Dec 2019 04:02:57 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/87] migration-test: Create cmd_soure and cmd_target Date: Wed, 18 Dec 2019 13:01:28 +0100 Message-Id: <1576670573-48048-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela We are repeating almost everything for each machine while creating the command line for migration. And once for source and another for destination. We start putting there opts_src and opts_dst. Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index a5343fd..fbddcf2 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -557,6 +557,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, const char *opts_dst) { gchar *cmd_src, *cmd_dst; + gchar *cmd_source, *cmd_target; char *bootpath =3D NULL; char *extra_opts =3D NULL; char *shmem_path =3D NULL; @@ -584,16 +585,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 150M" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" - " -drive file=3D%s,format=3Draw %s %s", + " -drive file=3D%s,format=3Draw %s", accel, tmpfs, bootpath, - extra_opts ? extra_opts : "", opts_src); + extra_opts ? extra_opts : ""); cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 150M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -drive file=3D%s,format=3Draw" - " -incoming %s %s %s", + " -incoming %s %s", accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts : "", opts_dst); + extra_opts ? extra_opts : ""); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { @@ -601,15 +602,15 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, extra_opts =3D use_shmem ? get_shmem_opts("128M", shmem_path) : NU= LL; cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 128M" " -name source,debug-threads=3Don" - " -serial file:%s/src_serial -bios %s %s= %s", + " -serial file:%s/src_serial -bios %s %s= ", accel, tmpfs, bootpath, - extra_opts ? extra_opts : "", opts_src); + extra_opts ? extra_opts : ""); cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 128M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial -bios %s" - " -incoming %s %s %s", + " -incoming %s %s", accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts : "", opts_dst); + extra_opts ? extra_opts : ""); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { @@ -620,15 +621,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until' %s %s", accel, tmpfs, end_addre= ss, - start_address, extra_opts ? extra_opts := "", - opts_src); + "until' %s", accel, tmpfs, end_address, + start_address, extra_opts ? extra_opts := ""); cmd_dst =3D g_strdup_printf("-machine accel=3D%s,vsmt=3D8 -m 256M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" - " -incoming %s %s %s", + " -incoming %s %s", accel, tmpfs, uri, - extra_opts ? extra_opts : "", opts_dst); + extra_opts ? extra_opts : ""); =20 start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -638,16 +638,16 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, cmd_src =3D g_strdup_printf("-machine virt,accel=3D%s,gic-version= =3Dmax " "-name vmsource,debug-threads=3Don -cpu = max " "-m 150M -serial file:%s/src_serial " - "-kernel %s %s %s", + "-kernel %s %s", accel, tmpfs, bootpath, - extra_opts ? extra_opts : "", opts_src); + extra_opts ? extra_opts : ""); cmd_dst =3D g_strdup_printf("-machine virt,accel=3D%s,gic-version= =3Dmax " "-name vmdest,debug-threads=3Don -cpu ma= x " "-m 150M -serial file:%s/dest_serial " "-kernel %s " - "-incoming %s %s %s", + "-incoming %s %s", accel, tmpfs, bootpath, uri, - extra_opts ? extra_opts : "", opts_dst); + extra_opts ? extra_opts : ""); =20 start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; @@ -671,11 +671,17 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, cmd_dst =3D tmp; } =20 - *from =3D qtest_init(cmd_src); + cmd_source =3D g_strdup_printf("%s %s", + cmd_src, opts_src); g_free(cmd_src); + *from =3D qtest_init(cmd_source); + g_free(cmd_source); =20 - *to =3D qtest_init(cmd_dst); + cmd_target =3D g_strdup_printf("%s %s", + cmd_dst, opts_dst); g_free(cmd_dst); + *to =3D qtest_init(cmd_target); + g_free(cmd_target); =20 /* * Remove shmem file immediately to avoid memory leak in test failed c= ase. --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670863; cv=none; d=zohomail.com; s=zohoarc; b=DOXdYzINswWt80vkBinf5iPTKxqdSMpf5ZH/Ah6EwO6bNJDtT4SoexgUh+gZd2Sa32s52tX7CK0BtoZCyFvpaVM+VmakHoNA2Pw549LcwMRZNWIokpUgIT84zpgVFOOMCQLp/DHEB6Pc0pM2EUmrMGdo7aXImEJ36jJJBB8yUZw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670863; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ievJYPkFEpwy+miP6JKeICVpFi5b+iJvMsgIGat87Fg=; b=jt7/B05MZ+bR786Tb2Tna76RG5qSvhkQLSqUk5cppVgFGX7PsFcnX5KaJ6x5kM7WAjN1rbIHx3IzEhfQHxytHRpfW5juS5bvCVX85J4plLRoA8BNPicaf1+TM9MO77wKqej3QOo2PKtDRp+M+yBUwcsnb71doz9QMJT/GA1Y3+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670863005893.0126644819136; Wed, 18 Dec 2019 04:07:43 -0800 (PST) Received: from localhost ([::1]:53206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY7B-0003Jm-94 for importer@patchew.org; Wed, 18 Dec 2019 07:07:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44328) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2f-0005vl-KD for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2e-0007pX-90 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:01 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2d-0007kr-T8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:00 -0500 Received: by mail-wm1-x333.google.com with SMTP id p17so1617332wma.1 for ; Wed, 18 Dec 2019 04:02:59 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.02.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:02:58 -0800 (PST) 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=ievJYPkFEpwy+miP6JKeICVpFi5b+iJvMsgIGat87Fg=; b=ArCDdoeIkfi05KhsYAFuItNji8W/U6OpTzqtI86JGgWUzgncSEmbv01UBEy4Sv60Nd xNMd6JNFPLHU81Un5GCzmBfAHPHQjmDOzv1GMFZwsjLcVrlyFNfBU/zpLl4DtaCWCdKO 2/kfEFaICnjhhPoxzfFBtXzkwrLxao7ZcIu6WCDlV9iOuBpPVdPvZ10UXT0EjCMX4sKe 5LmPFy6F3YRDDv/iUox4LxoyqDWFWg6pMzTt0RrJQTpsKFDhI7mxZeDu71qChQcqmqgF 3ir2E6Re0RsTJcosBFUIaU9RktDOSmHv9V95tUDaRcqU7NApMmtGFbEGi3qD7pswAz85 AhxQ== 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=ievJYPkFEpwy+miP6JKeICVpFi5b+iJvMsgIGat87Fg=; b=qiZIfXxt/+0W+Qmnn5J8M6ve3Kiiu4s4zm7vcWj6z7RujmLnkqF4Q1G6iKCE1FvQtH WnRqXuRK7AJ2l+gGIEBq1PCV6xUuo2KqxvaFAdWacoXAkmp5ho+SRNL7GUibfGBVWeAz dnkKN75NS+WKPMRZf27j/a4xXOY2WXnv8a8cjFhpNqY1ZEZoNJy1AI7JJrgg2LaQi8TK p7YJjZPAHJFU6bvqx/9ZmVlIbMHk2H1npWQFVXEwvLSAPxXwijKIa1DH9adQie/9RF7R ZYDN/5TDpCvhlx6eo4S5pUxD4mUHcA81xZwWVi6UoZkqcsVnzVUm2KKuRThnTgG8URhb Z6aA== X-Gm-Message-State: APjAAAW/bzy72A9o0slsd3Cy8kTwZz3iNFhQR37LuyBRB5faZ172FNDR ndaSAoNBpZJ4zIZTeehXgcm5i9UE X-Google-Smtp-Source: APXvYqw0Whx9Y3w5YJoDKCSkav07LFoCV4bDGRSeBBpzSQzTPp54ZwI+SwI/vR+Ql8aKyViFt8omLg== X-Received: by 2002:a05:600c:246:: with SMTP id 6mr2639177wmj.122.1576670578547; Wed, 18 Dec 2019 04:02:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/87] migration-test: Move hide_stderr to common commandline Date: Wed, 18 Dec 2019 13:01:29 +0100 Message-Id: <1576670573-48048-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index fbddcf2..0c01ed3 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -558,6 +558,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, { gchar *cmd_src, *cmd_dst; gchar *cmd_source, *cmd_target; + const gchar *ignore_stderr; char *bootpath =3D NULL; char *extra_opts =3D NULL; char *shmem_path =3D NULL; @@ -661,24 +662,19 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, g_free(extra_opts); =20 if (hide_stderr) { - gchar *tmp; - tmp =3D g_strdup_printf("%s 2>/dev/null", cmd_src); - g_free(cmd_src); - cmd_src =3D tmp; - - tmp =3D g_strdup_printf("%s 2>/dev/null", cmd_dst); - g_free(cmd_dst); - cmd_dst =3D tmp; + ignore_stderr =3D "2>/dev/null"; + } else { + ignore_stderr =3D ""; } =20 - cmd_source =3D g_strdup_printf("%s %s", - cmd_src, opts_src); + cmd_source =3D g_strdup_printf("%s %s %s", + cmd_src, opts_src, ignore_stderr); g_free(cmd_src); *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 - cmd_target =3D g_strdup_printf("%s %s", - cmd_dst, opts_dst); + cmd_target =3D g_strdup_printf("%s %s %s", + cmd_dst, opts_dst, ignore_stderr); g_free(cmd_dst); *to =3D qtest_init(cmd_target); g_free(cmd_target); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670867; cv=none; d=zohomail.com; s=zohoarc; b=nBHtwCSqFVKJyOrpMZdXIlUh/RYlfnuUBctshyqNrYV5DMenhXqeOBOevoEHszBn9gaDinTuzn6wHkbV5HGfrVc9ZuVIT1J7l79p9EJsDx1nLwdcbPwR+wAwfwbIOxGYNq0sV1JCDkFiG9eh9boJnTUSgvtnXAktxNQMTRHXQbw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670867; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=lQcQ8hHYJ9b8wR89sWSdLjNQioFt95lRtiBn1TJrwfs=; b=KjewoJO3x7mpE/VxjQRzwZoCZGBTmRT4/eqk/7gdfyFzZN7yYQrmJh8Z7zcoFtVpCFHt23zBkyHqenGvU/38XFQkYf8DKc8+8gP1TGjuty5m0ZrubZkLcrVGbMk+NdMuN9j3IpdLrcv5Mn1ZwIsUOFrdB4bprmRqvZyE0N2Uno4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670867071253.6612750216293; Wed, 18 Dec 2019 04:07:47 -0800 (PST) Received: from localhost ([::1]:53208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY7F-0003NU-EB for importer@patchew.org; Wed, 18 Dec 2019 07:07:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44596) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2g-0005xO-VU for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2f-0007tX-7b for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:02 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:55116) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2e-0007pi-SW for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:01 -0500 Received: by mail-wm1-x332.google.com with SMTP id b19so1551179wmj.4 for ; Wed, 18 Dec 2019 04:03:00 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:02:58 -0800 (PST) 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=lQcQ8hHYJ9b8wR89sWSdLjNQioFt95lRtiBn1TJrwfs=; b=r88j6abDZc5HEwSRSlVxzAneVWBsiD9Ng2qBsfy0cI+jEHdQsSbPgAjjqaeyk1XGs4 4MPsNAfcEOHcJySK1qcwrQ6XIuXiH4OQR9sivlWQTnXDsjC/Xgo0rJgc2jU4//32YMx/ iU94PtQFXBiwLix987+umGllMMHdbaHA3PZi/AsF3IaVjkup9pYegqxqOp3KyKa3dkRm JHgELlme/90pb5NDeGWuriz+BccQwvUsQVA+v8+DW3a9l0YZjn2QLEr31X1HGgBncGv/ BOeyKHP6/c3fJz3FD9i37ea6cIXsuP/ZdwK5Zwf9bmX14RybOWkVJ4POo1yuM4r+UMq+ p1+A== 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=lQcQ8hHYJ9b8wR89sWSdLjNQioFt95lRtiBn1TJrwfs=; b=JJP2ApxFPHihed+C6/7zRLZjJSyLc8b9JD4lYp9vi57qVHFV3uItNiRpWW5C/42now kuykLN3jn0ThGvOWdKbz/w/t97h17bRESLAgWnulY2414xneXBili4fTwAKBcnZj7M/k smdtJ0RHkuEdmI0GZ6/zOleEOCFPp5I2Tq6CvkRzEiYe98RJPn37fdOYdTtFJNeOWDSq 4YwgeDVn/yv+REaAlDGAKCGxwRlyzjKL2Hc1pCE1ckwLNKNdsD5CTBziX/vo8EvJLXJ3 2AFg04mV5KTrvq6xXMAsnpJWfNpeRhfaw0m9lWbIEnf+OKBNOmaoxuoYlz1olAoNLZX5 0RkA== X-Gm-Message-State: APjAAAU9c1IQgk9A9RDyeNkqAeYHDU1+SfB8H+mRt4oMpWBOSt1eWFYU 9DdiVv/bKb05UopuRvK7zIhCR5MF X-Google-Smtp-Source: APXvYqwjcxTglWr+KY8LYDlrpO5+04SEvgB3V5jwKl/aeNtE86MGTyWM20++8CsfD+6w9ujKjxjG9g== X-Received: by 2002:a1c:7d92:: with SMTP id y140mr2635340wmc.145.1576670579430; Wed, 18 Dec 2019 04:02:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/87] migration-test: Move -machine to common commandline Date: Wed, 18 Dec 2019 13:01:30 +0100 Message-Id: <1576670573-48048-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 51 +++++++++++++++++++++++++++++-----------------= ---- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 0c01ed3..5a63158 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -563,7 +563,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, char *extra_opts =3D NULL; char *shmem_path =3D NULL; const char *arch =3D qtest_get_arch(); - const char *accel =3D "kvm:tcg"; + const char *machine_type; + const char *machine_args; =20 opts_src =3D opts_src ? opts_src : ""; opts_dst =3D opts_dst ? opts_dst : ""; @@ -582,72 +583,78 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, /* the assembled x86 boot sector should be exactly one sector larg= e */ assert(sizeof(x86_bootsect) =3D=3D 512); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); + machine_type =3D ""; + machine_args =3D ""; extra_opts =3D use_shmem ? get_shmem_opts("150M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 150M" + cmd_src =3D g_strdup_printf("-m 150M" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -drive file=3D%s,format=3Draw %s", - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts : ""); - cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 150M" + cmd_dst =3D g_strdup_printf("-m 150M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -drive file=3D%s,format=3Draw" " -incoming %s %s", - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts : ""); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); + machine_type =3D ""; + machine_args =3D ""; extra_opts =3D use_shmem ? get_shmem_opts("128M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-machine accel=3D%s -m 128M" + cmd_src =3D g_strdup_printf("-m 128M" " -name source,debug-threads=3Don" " -serial file:%s/src_serial -bios %s %s= ", - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts : ""); - cmd_dst =3D g_strdup_printf("-machine accel=3D%s -m 128M" + cmd_dst =3D g_strdup_printf("-m 128M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial -bios %s" " -incoming %s %s", - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts : ""); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { + machine_type =3D ""; + machine_args =3D ",vsmt=3D8"; extra_opts =3D use_shmem ? get_shmem_opts("256M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-machine accel=3D%s,vsmt=3D8 -m 256M = -nodefaults" + cmd_src =3D g_strdup_printf("-m 256M -nodefaults" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until' %s", accel, tmpfs, end_address, + "until' %s", tmpfs, end_address, start_address, extra_opts ? extra_opts := ""); - cmd_dst =3D g_strdup_printf("-machine accel=3D%s,vsmt=3D8 -m 256M" + cmd_dst =3D g_strdup_printf("-m 256M" " -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -incoming %s %s", - accel, tmpfs, uri, + tmpfs, uri, extra_opts ? extra_opts : ""); =20 start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); + machine_type =3D "virt,"; + machine_args =3D "gic-version=3Dmax"; extra_opts =3D use_shmem ? get_shmem_opts("150M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-machine virt,accel=3D%s,gic-version= =3Dmax " - "-name vmsource,debug-threads=3Don -cpu = max " + cmd_src =3D g_strdup_printf("-name vmsource,debug-threads=3Don -cp= u max " "-m 150M -serial file:%s/src_serial " "-kernel %s %s", - accel, tmpfs, bootpath, + tmpfs, bootpath, extra_opts ? extra_opts : ""); - cmd_dst =3D g_strdup_printf("-machine virt,accel=3D%s,gic-version= =3Dmax " - "-name vmdest,debug-threads=3Don -cpu ma= x " + cmd_dst =3D g_strdup_printf("-name vmdest,debug-threads=3Don -cpu = max " "-m 150M -serial file:%s/dest_serial " "-kernel %s " "-incoming %s %s", - accel, tmpfs, bootpath, uri, + tmpfs, bootpath, uri, extra_opts ? extra_opts : ""); =20 start_address =3D ARM_TEST_MEM_START; @@ -667,13 +674,15 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, ignore_stderr =3D ""; } =20 - cmd_source =3D g_strdup_printf("%s %s %s", + cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s %s %s %s", + machine_type, machine_args, cmd_src, opts_src, ignore_stderr); g_free(cmd_src); *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 - cmd_target =3D g_strdup_printf("%s %s %s", + cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s %s %s %s", + machine_type, machine_args, cmd_dst, opts_dst, ignore_stderr); g_free(cmd_dst); *to =3D qtest_init(cmd_target); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670722; cv=none; d=zohomail.com; s=zohoarc; b=IWRlqOZAfPDkAmzigVm7lg60xr23SqJ6glfDwGuXx3Q2gZiVYqh5rGrsZrqV50z0Dw54y5LQOlIwL2+s3AwhSv24dqeCWePOnMK4ZkA4TI4Ob8B9+2ziWVfB/tTxSIo4TU/xwnDL3NfG5De/EyLrkZ3JNE+jLykXe4+2osepeos= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670722; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=srkmaf06yoLUqqvgRxOJoc6+fa6oxP9fbSy0KoDwxQ0=; b=dFhJNjHPQ7tFuwQ9pX/vLjxd32f1uyZOZqA6sNK5uSNUYjOGnUDuyo6aU2JSnVUjPtwDlLDyBzMfhIvIwVaVwDTKHeroJP8eVPgIEtvHVpX57GC/tW8mUuBR08D9DpXWqy7AmeD45HcSiiNgHbkDpud6AMusKRtxMuT52JkfmQE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670722470608.1023963552277; Wed, 18 Dec 2019 04:05:22 -0800 (PST) Received: from localhost ([::1]:53162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY4u-0008Bb-LS for importer@patchew.org; Wed, 18 Dec 2019 07:05:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44772) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2h-0005yR-NX for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2g-0007xb-6a for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:03 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:41745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2f-0007tP-Su for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:02 -0500 Received: by mail-wr1-x430.google.com with SMTP id c9so1997935wrw.8 for ; Wed, 18 Dec 2019 04:03:01 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.02.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:02:59 -0800 (PST) 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=srkmaf06yoLUqqvgRxOJoc6+fa6oxP9fbSy0KoDwxQ0=; b=FaT/ejRMTb0VBSunUWeQmI3WFUVzgBwnc9sRDeraaDUVLLZ/lFY42ViODDOxDyHNQ1 g02uW52LQEJNUIzlb3UwhIQuM9j7YC1ewa7Ql77Bf4H+YhtunX+YWo/S+nKzzZP3jEMY 3eRwWDQDDGvV7MI9fdUrKjugMI6K0d9UCAVHjYCG0Szg1IFo6+CfVsboNPnIdX9wt0S7 EMufhyuP/hAM/UIg0MsUX7VDDpSwYUXZb12p405n1DwdkfZDfsTlT1jJ/GMr8ivKPWcx 3uEZWH7GwWwfVrAlmk12vV+AgiHgITQrt9aaN2x/DsoYqPV7cI8uCLKF37tfgDLZaac+ ilNg== 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=srkmaf06yoLUqqvgRxOJoc6+fa6oxP9fbSy0KoDwxQ0=; b=TCeNNYYHWyjm6mzoJnrKcmJw/u5sT8Mn7lzb64gXZ7uQJYIV4MKJOnXw5XhdnIESTi nKovbvEmVWlHrQybYCbwZKVwfwQzwVI0Akx9rIxiskqumM1y83mJb7GQRqJINvexG00C xYoyWt4mCGId3YvznxBjKJqAg2XAfI+cHxqKCQKoWrpJvBap2yIuuJUyZIt3/uCW2BGp Pi230Ox0mn35DXSwF0r/+aoNpCgQ7BG9LsXJvjkqh0DsKYhKRTE3CckawEoaboYVJlRP SBacOgK8i8Y1PJjBSaaPKIWSgs/zPggSHM0s9kmgCcI+vUoiX75TfyBlmjj7e6TPUU74 P/7g== X-Gm-Message-State: APjAAAXaFQG6FVn2u5k0Wzj1PcwpN6kILDCCkxG2RxESRccf1vjHdOr6 IMoz2vEwlGF7Z1wNrTE0q+0VSul1 X-Google-Smtp-Source: APXvYqwNPOP0VPFg7LSrcB0hJRJkjSmj5r6V2FVC6r92H3MCq8yN3MIZzPXSCNvUs3duRCAf7QVTGg== X-Received: by 2002:adf:f508:: with SMTP id q8mr2442302wro.334.1576670580371; Wed, 18 Dec 2019 04:03:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/87] migration-test: Move memory size to common commandline Date: Wed, 18 Dec 2019 13:01:31 +0100 Message-Id: <1576670573-48048-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 5a63158..9d40f2d 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -565,6 +565,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, const char *arch =3D qtest_get_arch(); const char *machine_type; const char *machine_args; + const char *memory_size; =20 opts_src =3D opts_src ? opts_src : ""; opts_dst =3D opts_dst ? opts_dst : ""; @@ -585,15 +586,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); machine_type =3D ""; machine_args =3D ""; - extra_opts =3D use_shmem ? get_shmem_opts("150M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-m 150M" - " -name source,debug-threads=3Don" + memory_size =3D "150M"; + extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; + cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -drive file=3D%s,format=3Draw %s", tmpfs, bootpath, extra_opts ? extra_opts : ""); - cmd_dst =3D g_strdup_printf("-m 150M" - " -name target,debug-threads=3Don" + cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -drive file=3D%s,format=3Draw" " -incoming %s %s", @@ -605,14 +605,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); machine_type =3D ""; machine_args =3D ""; - extra_opts =3D use_shmem ? get_shmem_opts("128M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-m 128M" - " -name source,debug-threads=3Don" + memory_size =3D "128M"; + extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; + cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" " -serial file:%s/src_serial -bios %s %s= ", tmpfs, bootpath, extra_opts ? extra_opts : ""); - cmd_dst =3D g_strdup_printf("-m 128M" - " -name target,debug-threads=3Don" + cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial -bios %s" " -incoming %s %s", tmpfs, bootpath, uri, @@ -622,8 +621,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, } else if (strcmp(arch, "ppc64") =3D=3D 0) { machine_type =3D ""; machine_args =3D ",vsmt=3D8"; - extra_opts =3D use_shmem ? get_shmem_opts("256M", shmem_path) : NU= LL; - cmd_src =3D g_strdup_printf("-m 256M -nodefaults" + memory_size =3D "256M"; + extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; + cmd_src =3D g_strdup_printf("-nodefaults" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " @@ -631,8 +631,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until' %s", tmpfs, end_address, start_address, extra_opts ? extra_opts := ""); - cmd_dst =3D g_strdup_printf("-m 256M" - " -name target,debug-threads=3Don" + cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -incoming %s %s", tmpfs, uri, @@ -644,14 +643,15 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); machine_type =3D "virt,"; machine_args =3D "gic-version=3Dmax"; - extra_opts =3D use_shmem ? get_shmem_opts("150M", shmem_path) : NU= LL; + memory_size =3D "150M"; + extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; cmd_src =3D g_strdup_printf("-name vmsource,debug-threads=3Don -cp= u max " - "-m 150M -serial file:%s/src_serial " + "-serial file:%s/src_serial " "-kernel %s %s", tmpfs, bootpath, extra_opts ? extra_opts : ""); cmd_dst =3D g_strdup_printf("-name vmdest,debug-threads=3Don -cpu = max " - "-m 150M -serial file:%s/dest_serial " + "-serial file:%s/dest_serial " "-kernel %s " "-incoming %s %s", tmpfs, bootpath, uri, @@ -674,15 +674,21 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, ignore_stderr =3D ""; } =20 - cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s %s %s %s", + cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + "-m %s " + "%s %s %s", machine_type, machine_args, + memory_size, cmd_src, opts_src, ignore_stderr); g_free(cmd_src); *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 - cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s %s %s %s", + cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + "-m %s " + "%s %s %s", machine_type, machine_args, + memory_size, cmd_dst, opts_dst, ignore_stderr); g_free(cmd_dst); *to =3D qtest_init(cmd_target); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670998; cv=none; d=zohomail.com; s=zohoarc; b=jDrnaOwwHgLL4aq2LGtlFHbmjhUMBSocrJqzv/M2iHm0OFvJrEqjF7rTiNKEAFYBuVUKwloE2gJWeTrcpaObzEJPgKqb5CFoIQdcQ+EA/oqLTMyp34lFvfk1UgVNbJlwx/X74rWnvstC7YfvYTxGwiKOOyYE/kWkgk5NdritE+s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670998; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=aH3EykeL08EUheSeMlIhlQO84iNBgJfxB8x8n+2PQ/0=; b=P+LkO2pMml61yEy5g3UAbKZezFozRFPIfDunzAUh1GXK7TAAgCjDOkQKGTNKhRH6u1C4tmtfRXJkkEnk0u1VrplEY4cyRA5p5lyJZdUt/hpF30VIYKUoTLH5Jw00vHm+vW5E3SwNZ8BTU7EuyKvQ3cg198E0kqsIqSOoz1HqUnQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670998610737.6034946930033; Wed, 18 Dec 2019 04:09:58 -0800 (PST) Received: from localhost ([::1]:53230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY9N-0006l6-0n for importer@patchew.org; Wed, 18 Dec 2019 07:09:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45090) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2j-00060W-1k for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2h-00084M-F0 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:04 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:33695) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2h-0007z5-3n for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:03 -0500 Received: by mail-wm1-x334.google.com with SMTP id d139so4489865wmd.0 for ; Wed, 18 Dec 2019 04:03:03 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:00 -0800 (PST) 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=aH3EykeL08EUheSeMlIhlQO84iNBgJfxB8x8n+2PQ/0=; b=ioOoB3NxuLOzcJHDbLNGZi7sZQbdaAsNahg0lKjnjxVQrJR1P6gNHUjdzEZrEA19Us h3+i6dJPf/NmzlyidLCVfVieZWHIlaiaqKLeRO80Xs61yEm6T/Sp/51u9kDIjA6Jfb9i Pf5nn0K54gRPh6+rtHXdNYVLvI0sp2EhE+G3UHUSAw+sp5gQKmuCo4p3c/5EsiJbflvq KzLPCXGdl+4uu4+ZB0tMetw5ZJvGay4TMBE1EZ5xmtWQHgVU6i3eI6RbZWkRz9i0aeQJ G11KGMkZjbX9ClmWCKm0+XBXM3YHGVP6+WcR7+lgL+lemFjV9U7FWtqODRXe2OVVHs2b 1gyg== 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=aH3EykeL08EUheSeMlIhlQO84iNBgJfxB8x8n+2PQ/0=; b=c1rt37KHm7mqFt93gQhnPBF8xdkEo5Igbs+16AGmBejiQd6I3sgkMZoDpYWxv1abMt vLV7mYL6B4mBlq7G5P8NBJCT0y9+qDEhHLSCInGF6Sl3zXbZn5bnrxPYoB8jPT3VE0ej XYO6+8+sDjzbIbi7ySxji9Qo0D3pLTz1DJ+XaE4vA0guBWOX2tnbayqU1rfcyt8mLvH8 yxNi7GcX5AU9o9ZahIRPVACcNz7kKlzDVSlsoO9vTmTPmgb2dCD09V8zw+pE420PEXr2 2Rx6ZD6dSo8weznM/Wk34g9vtLPWGi4IAvTOE7YZ/wEm21n+QykdGwbw6X97kgqxCnJU ZgfQ== X-Gm-Message-State: APjAAAWEQmyaDzAPk/1PpaDPC5qGglJ3oVtfMBWGsTyNQis7e00zyl0G Hs+BQtE561Z1uEshET+GzsdVQ3Mz X-Google-Smtp-Source: APXvYqwEKgd7hr2a9uFcGVItVQLxGG1RROYeMjajswDvI70fq0Fqcr++314xfGXrUlpaCuOLaUEs3Q== X-Received: by 2002:a7b:c759:: with SMTP id w25mr2955083wmk.15.1576670581640; Wed, 18 Dec 2019 04:03:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/87] migration-test: Move shmem handling to common commandline Date: Wed, 18 Dec 2019 13:01:32 +0100 Message-Id: <1576670573-48048-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 76 ++++++++++++++++++++++------------------------= ---- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 9d40f2d..e17d432 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -380,13 +380,6 @@ static void cleanup(const char *filename) g_free(path); } =20 -static char *get_shmem_opts(const char *mem_size, const char *shmem_path) -{ - return g_strdup_printf("-object memory-backend-file,id=3Dmem0,size=3D%= s" - ",mem-path=3D%s,share=3Don -numa node,memdev=3D= mem0", - mem_size, shmem_path); -} - static char *SocketAddress_to_str(SocketAddress *addr) { switch (addr->type) { @@ -560,8 +553,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, gchar *cmd_source, *cmd_target; const gchar *ignore_stderr; char *bootpath =3D NULL; - char *extra_opts =3D NULL; - char *shmem_path =3D NULL; + char *shmem_opts; + char *shmem_path; const char *arch =3D qtest_get_arch(); const char *machine_type; const char *machine_args; @@ -575,7 +568,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_test_skip("/dev/shm is not supported"); return -1; } - shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); } =20 got_stop =3D false; @@ -587,18 +579,15 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "150M"; - extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" " -serial file:%s/src_serial" - " -drive file=3D%s,format=3Draw %s", - tmpfs, bootpath, - extra_opts ? extra_opts : ""); + " -drive file=3D%s,format=3Draw", + tmpfs, bootpath); cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial" " -drive file=3D%s,format=3Draw" - " -incoming %s %s", - tmpfs, bootpath, uri, - extra_opts ? extra_opts : ""); + " -incoming %s", + tmpfs, bootpath, uri); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { @@ -606,36 +595,31 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "128M"; - extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" - " -serial file:%s/src_serial -bios %s %s= ", - tmpfs, bootpath, - extra_opts ? extra_opts : ""); + " -serial file:%s/src_serial -bios %s", + tmpfs, bootpath); cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial -bios %s" - " -incoming %s %s", - tmpfs, bootpath, uri, - extra_opts ? extra_opts : ""); + " -incoming %s", + tmpfs, bootpath, uri); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { machine_type =3D ""; machine_args =3D ",vsmt=3D8"; memory_size =3D "256M"; - extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; cmd_src =3D g_strdup_printf("-nodefaults" " -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until' %s", tmpfs, end_address, - start_address, extra_opts ? extra_opts := ""); + "until'", tmpfs, end_address, + start_address); cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" " -serial file:%s/dest_serial" - " -incoming %s %s", - tmpfs, uri, - extra_opts ? extra_opts : ""); + " -incoming %s", + tmpfs, uri); =20 start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; @@ -644,18 +628,15 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D "virt,"; machine_args =3D "gic-version=3Dmax"; memory_size =3D "150M"; - extra_opts =3D use_shmem ? get_shmem_opts(memory_size, shmem_path)= : NULL; cmd_src =3D g_strdup_printf("-name vmsource,debug-threads=3Don -cp= u max " "-serial file:%s/src_serial " - "-kernel %s %s", - tmpfs, bootpath, - extra_opts ? extra_opts : ""); + "-kernel %s", + tmpfs, bootpath); cmd_dst =3D g_strdup_printf("-name vmdest,debug-threads=3Don -cpu = max " "-serial file:%s/dest_serial " "-kernel %s " - "-incoming %s %s", - tmpfs, bootpath, uri, - extra_opts ? extra_opts : ""); + "-incoming %s", + tmpfs, bootpath, uri); =20 start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; @@ -666,7 +647,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, } =20 g_free(bootpath); - g_free(extra_opts); =20 if (hide_stderr) { ignore_stderr =3D "2>/dev/null"; @@ -674,26 +654,38 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, ignore_stderr =3D ""; } =20 + if (use_shmem) { + shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); + shmem_opts =3D g_strdup_printf( + "-object memory-backend-file,id=3Dmem0,size=3D%s" + ",mem-path=3D%s,share=3Don -numa node,memdev=3Dmem0", + memory_size, shmem_path); + } else { + shmem_path =3D NULL; + shmem_opts =3D g_strdup(""); + } + cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " "-m %s " - "%s %s %s", + "%s %s %s %s", machine_type, machine_args, memory_size, - cmd_src, opts_src, ignore_stderr); + cmd_src, shmem_opts, opts_src, ignore_std= err); g_free(cmd_src); *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " "-m %s " - "%s %s %s", + "%s %s %s %s", machine_type, machine_args, memory_size, - cmd_dst, opts_dst, ignore_stderr); + cmd_dst, shmem_opts, opts_dst, ignore_std= err); g_free(cmd_dst); *to =3D qtest_init(cmd_target); g_free(cmd_target); =20 + g_free(shmem_opts); /* * Remove shmem file immediately to avoid memory leak in test failed c= ase. * It's valid becase QEMU has already opened this file --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671003; cv=none; d=zohomail.com; s=zohoarc; b=edu7Nln5lbIm93A0NayV8Els32sWlwqqsv3Gw+GT8uhn0jT20X/R1whK1xLHbp4GkrIm5mLRQOiZ8npRQawnLZl8AQ/WF3SKCLMCnw6kO7YJxos5PeeVDx7GOvDGG+Eh4+AdEyFwYfqwnnV+VXYv/MuAZzlIqvJGlmyBeASjKxE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671003; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=S5gg3HelWS0RPKMW3/Z/axKXbBTscXO2B/ZJUs+kb3g=; b=Ye0mVaJ5tEFL4rE/2hUNN24vQBzvK7ubupv82FIADIdgQ9tiWjTSzFT9iis1xw4oWKl/cNYI/w3Xb2OZWA1NHfETzO6KNJn/D1JC2dX19m9yctBVXJCWEfiUaAQMj6fL+6t0A3mLS05iMVjPSAv9NZKsE4OIwO/azv9URZijd8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671003023483.54037651575675; Wed, 18 Dec 2019 04:10:03 -0800 (PST) Received: from localhost ([::1]:53232 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY9R-0006sa-8Y for importer@patchew.org; Wed, 18 Dec 2019 07:10:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45261) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2j-00061T-Nv for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2i-00089q-H1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:05 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:44237) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2i-00084g-6i for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:04 -0500 Received: by mail-wr1-x436.google.com with SMTP id q10so1982645wrm.11 for ; Wed, 18 Dec 2019 04:03:04 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:01 -0800 (PST) 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=S5gg3HelWS0RPKMW3/Z/axKXbBTscXO2B/ZJUs+kb3g=; b=kxqzuzWBzC02WaR4k1mOP91wbzCLveS5Rf95RJWHhB/KbLk0C2YIGhOesy6xtABbmQ RVUts1IBxJSBcPqhmcDVPhPz3N1XuTVZ+g7NBFhHnhi+gWMqZYeSXt5Fsm/04KTWHEe9 UmtKfgoslzsvJa9P89GGv4yW0voJ3mwh3aoBe+q2naN2Adyksc09bnSNhZ6PvbNMB5od lVFAf7lNVQnmS/9QNMTA2oiqur3FLYAI/PnzQqkM1hQd7xyEE6IJ9YwF+Ve2PzIxd9hW IbKO0OE/VyaLKvUeEaQIyEmnnG5d6w3UT/MOGw+toAlwCtwMidZhfOJNIlw/fEF6nCnH XO/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; bh=S5gg3HelWS0RPKMW3/Z/axKXbBTscXO2B/ZJUs+kb3g=; b=lg4jN7q491zEPLJ53kXj0BLJN4CeF0v7V4RFjx9aoPryEj+pARzRVkkhJYFCQf9aam bePisTKM33BYEcN+zm805yc0YVJeYzrK717HYToCokzvvu3b8ZBnokZTUAp8Ux4tJn/O FDHuN9fjERQs9uI3jTTUxWZuW/xibsIDP4qezRGT0kdRLdMFguCofd1NJEphM9vFQXfR 1XIdMGOGyHy5uUUAv1A7J9wwjgViXUoqpESk5TWCWdP/6Zhg1WZEMFzcUkJpbKtxjYIe CzNFscOJvbKLLXfBils028HcsuNgBXVUX4Jv8LRJmHyUkpTknlsLEIgpa1hJd0GBy89j HTRg== X-Gm-Message-State: APjAAAW3QupRh47M5Awk+mcDVrWdS58jvKvGO0+nViWkumh2Y6Tgz+YD KQU6i++asj6jlQ/I3vkBvip+UOL/ X-Google-Smtp-Source: APXvYqwu8IUrzIftMIO4JIMuRaw5SHC7hqSiWV8Lfo7zBkHIQCan+9OSqLxLnkgY6666HFh2gUzgeA== X-Received: by 2002:adf:f491:: with SMTP id l17mr2405428wro.149.1576670582780; Wed, 18 Dec 2019 04:03:02 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/87] migration-test: Move -name handling to common commandline Date: Wed, 18 Dec 2019 13:01:33 +0100 Message-Id: <1576670573-48048-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index e17d432..6e828fb 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -579,12 +579,10 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "150M"; - cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" - " -serial file:%s/src_serial" + cmd_src =3D g_strdup_printf(" -serial file:%s/src_serial" " -drive file=3D%s,format=3Draw", tmpfs, bootpath); - cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" - " -serial file:%s/dest_serial" + cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial" " -drive file=3D%s,format=3Draw" " -incoming %s", tmpfs, bootpath, uri); @@ -595,11 +593,9 @@ static int test_migrate_start(QTestState **from, QTest= State **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "128M"; - cmd_src =3D g_strdup_printf(" -name source,debug-threads=3Don" - " -serial file:%s/src_serial -bios %s", + cmd_src =3D g_strdup_printf(" -serial file:%s/src_serial -bios %s", tmpfs, bootpath); - cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" - " -serial file:%s/dest_serial -bios %s" + cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial -bios %s" " -incoming %s", tmpfs, bootpath, uri); start_address =3D S390_TEST_MEM_START; @@ -609,15 +605,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_args =3D ",vsmt=3D8"; memory_size =3D "256M"; cmd_src =3D g_strdup_printf("-nodefaults" - " -name source,debug-threads=3Don" " -serial file:%s/src_serial" " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until'", tmpfs, end_address, start_address); - cmd_dst =3D g_strdup_printf(" -name target,debug-threads=3Don" - " -serial file:%s/dest_serial" + cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial" " -incoming %s", tmpfs, uri); =20 @@ -628,11 +622,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D "virt,"; machine_args =3D "gic-version=3Dmax"; memory_size =3D "150M"; - cmd_src =3D g_strdup_printf("-name vmsource,debug-threads=3Don -cp= u max " + cmd_src =3D g_strdup_printf("-cpu max " "-serial file:%s/src_serial " "-kernel %s", tmpfs, bootpath); - cmd_dst =3D g_strdup_printf("-name vmdest,debug-threads=3Don -cpu = max " + cmd_dst =3D g_strdup_printf("-cpu max " "-serial file:%s/dest_serial " "-kernel %s " "-incoming %s", @@ -666,6 +660,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, } =20 cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + "-name source,debug-threads=3Don " "-m %s " "%s %s %s %s", machine_type, machine_args, @@ -676,6 +671,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, g_free(cmd_source); =20 cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + "-name target,debug-threads=3Don " "-m %s " "%s %s %s %s", machine_type, machine_args, --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671158; cv=none; d=zohomail.com; s=zohoarc; b=I9tw84lmfXWcfryzr51XzmIqGT8NbHrTMcNucrAkgQTX0gZ8OgxUqo5z0i0kjLWcpvmGllN1oq4u5H+md9ycxJrOn8iMhzMuxJYQdrXSTkoHwLHgrv4O0EDjo3CrNFWqwLQfi6aAJcgxrcaxju0utrvESsugekxbCJ9Qkr8ihBU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671158; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ZHJ4rnTOgWg//hYbF0PT3ZZVPprY5k8HnSbmiQGtXFc=; b=SvqhO12qPtJgbOBc6D63iGjzw1k2+sYIpIeTONNT56QaAcZwjLPgFBxwv2hiXat2p4WNjuDOCtffD8HEizr4craoxbAkD+oUDoZMztnRjKVNINSQBw9QhgCMyuwAG5ckzwwaYUGHuZ354I8dUHNDcexgPEOyaKOnTrXWKBFCzB0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671158896383.24314754243085; Wed, 18 Dec 2019 04:12:38 -0800 (PST) Received: from localhost ([::1]:53270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYBx-000288-2q for importer@patchew.org; Wed, 18 Dec 2019 07:12:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45493) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2k-00062c-Pr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2j-0008Do-BE for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:06 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:39949) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2j-00089L-0u for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:05 -0500 Received: by mail-wm1-x32e.google.com with SMTP id t14so1598790wmi.5 for ; Wed, 18 Dec 2019 04:03:04 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:03 -0800 (PST) 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=ZHJ4rnTOgWg//hYbF0PT3ZZVPprY5k8HnSbmiQGtXFc=; b=n2JlhvMfw9DJoxJpcLkfSZYJBYzPSywvJp/+MZ1qtUkTcE2AczAYwGXWN6Ee8g8Zbd s20s8kPBuqQ0rNZ807AqiIdDOiOGPL2g3uchGPGnb57YiB1Lwv9rHPwhD0AX0zyl/rDK zcQWYwKNW6mRUKKv2tgyBXwwSq2HrCuUzJR2VYc9mv+GWybSyNEeKbZz/02US2SEGrYF 9lgBj9EbNx7aQfOfpSv8QBUSf9k0VUgFPwqPLtEKwzqs/pRdQIgeIRilCyRqBTzPUW4d 5BUl+/PCCleEOT+OGYId68agKA0QU0SyL5YqHAkXXJI7qc4tDokHg5yDAQmfwHwU3WZR 5Law== 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=ZHJ4rnTOgWg//hYbF0PT3ZZVPprY5k8HnSbmiQGtXFc=; b=pU7MSolBxN/1JSBlJcztyptiPUvhiHkp2NpWB6pQxou5Sx6oAs0/K6RUiohQV+/4zj MGYllo72fRrehvPWsPMHEepGi0ivBtS5TS4c3L29UDSmS76ljC1SFDaMadNoSj3I7OjX d3MTBXiXvV9AOrbeCYQiuxcEv35ZliWuZxaCNhLOsk+yO8eTkyXfBrDcSQ61kVE6RVgs omrxduYjaUNg/0EngpIh4MQFN7Y4WKXYudHhlfl/yyrMTVvgSCzC4kl7MQ1asGnfH6Up X47R9Xh5vbwi6ErOtrUbo59nhCX0DIILx5a7n9xO8Shj969CDnpgkEmF1At8h6XLME/S ROVw== X-Gm-Message-State: APjAAAWzT1L6i1aaZm7F2I4gTptvlz7HMunYAPjVxUhByXzDSs/T6v3e Fi2JeYdbFUh0P7Rf/TC5SMF75VIc X-Google-Smtp-Source: APXvYqzr94oMQB1P75dHIpL3Wm2H++lcaN3aQJtaiI0Cf72mZGdLCUlP6gi8sED4rqtnKddqosh3Jw== X-Received: by 2002:a1c:e91a:: with SMTP id q26mr2842927wmc.59.1576670583779; Wed, 18 Dec 2019 04:03:03 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/87] migration-test: Move -serial handling to common commandline Date: Wed, 18 Dec 2019 13:01:34 +0100 Message-Id: <1576670573-48048-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 6e828fb..e1304d7 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -579,13 +579,10 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "150M"; - cmd_src =3D g_strdup_printf(" -serial file:%s/src_serial" - " -drive file=3D%s,format=3Draw", - tmpfs, bootpath); - cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial" - " -drive file=3D%s,format=3Draw" + cmd_src =3D g_strdup_printf("-drive file=3D%s,format=3Draw", bootp= ath); + cmd_dst =3D g_strdup_printf("-drive file=3D%s,format=3Draw" " -incoming %s", - tmpfs, bootpath, uri); + bootpath, uri); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { @@ -593,28 +590,22 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "128M"; - cmd_src =3D g_strdup_printf(" -serial file:%s/src_serial -bios %s", - tmpfs, bootpath); - cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial -bios %s" + cmd_src =3D g_strdup_printf("-bios %s", bootpath); + cmd_dst =3D g_strdup_printf("-bios %s" " -incoming %s", - tmpfs, bootpath, uri); + bootpath, uri); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { machine_type =3D ""; machine_args =3D ",vsmt=3D8"; memory_size =3D "256M"; - cmd_src =3D g_strdup_printf("-nodefaults" - " -serial file:%s/src_serial" - " -prom-env 'use-nvramrc?=3Dtrue' -prom-= env " + cmd_src =3D g_strdup_printf("-nodefaults " + "-prom-env 'use-nvramrc?=3Dtrue' -prom-e= nv " "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until'", tmpfs, end_address, - start_address); - cmd_dst =3D g_strdup_printf(" -serial file:%s/dest_serial" - " -incoming %s", - tmpfs, uri); - + "until'", end_address, start_address); + cmd_dst =3D g_strdup_printf(" -incoming %s", uri); start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; } else if (strcmp(arch, "aarch64") =3D=3D 0) { @@ -623,14 +614,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_args =3D "gic-version=3Dmax"; memory_size =3D "150M"; cmd_src =3D g_strdup_printf("-cpu max " - "-serial file:%s/src_serial " "-kernel %s", - tmpfs, bootpath); + bootpath); cmd_dst =3D g_strdup_printf("-cpu max " - "-serial file:%s/dest_serial " "-kernel %s " "-incoming %s", - tmpfs, bootpath, uri); + bootpath, uri); =20 start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; @@ -661,10 +650,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " "-name source,debug-threads=3Don " + "-serial file:%s/src_serial " "-m %s " "%s %s %s %s", machine_type, machine_args, - memory_size, + tmpfs, memory_size, cmd_src, shmem_opts, opts_src, ignore_std= err); g_free(cmd_src); *from =3D qtest_init(cmd_source); @@ -673,9 +663,10 @@ static int test_migrate_start(QTestState **from, QTest= State **to, cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " "-name target,debug-threads=3Don " "-m %s " + "-serial file:%s/dest_serial " "%s %s %s %s", machine_type, machine_args, - memory_size, + tmpfs, memory_size, cmd_dst, shmem_opts, opts_dst, ignore_std= err); g_free(cmd_dst); *to =3D qtest_init(cmd_target); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670911; cv=none; d=zohomail.com; s=zohoarc; b=c0V+hGk9aQfx8PGc4mxBmZQ4aKJTrU9aIls07pp7TmfAZGMtDQ4g9IAnDE3BKpfvYgX1B4s8mKKlod/ikWgbXJ/ajs1tBPOkZtpynah8XC8JM/xie68BI7G/4Y1nix7mKKMfa8l8J0DhFcNKijsj656/zwnZHitO2c1OMaw2ziU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670911; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Gj+EHCblifh5MMn3itLSDnoZXL5PyxBzL8vDQC39wXs=; b=hTIuXANsZWBpKswoM2SlxpCgxqwXl3eFCo/TNniV26KhiU+zKtFIVu5Ufo6EM7Rc+/XxyC2uDA5tfpArLpzztuQAbc2NXszxZ2iLPeRe58kOj5yN/GsxbZFk9LKyXcG8qpgKGvVUSsxL0CO93MwPAKmCDch7rQdfrnxnCJWtwoE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670911893723.4807593629545; Wed, 18 Dec 2019 04:08:31 -0800 (PST) Received: from localhost ([::1]:53212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY7y-0004gT-A5 for importer@patchew.org; Wed, 18 Dec 2019 07:08:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45751) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2o-00063x-CA for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2k-0008Hv-65 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:39620) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2j-0008DS-UI for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:06 -0500 Received: by mail-wr1-x42a.google.com with SMTP id y11so2002064wrt.6 for ; Wed, 18 Dec 2019 04:03:05 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:04 -0800 (PST) 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=Gj+EHCblifh5MMn3itLSDnoZXL5PyxBzL8vDQC39wXs=; b=qDWtq3qr6BfXGg3qZlv8Z5pOH/cljN/w38ndHGVqzhaYIdW07ITG3ir2z/fiS6c7P7 TvWznhQJs+SRmJsAB3ch4RqnmROPi9hD6hqL3plC+uX989dARYx4jDGtOB+EDKFAWKyX Ip9TPBGCltwICdGn/3NmhfzPdBLE59rrjwu90K385uzCRbu0DKZqEt29caOhd+jl1JJl Xg7bKpsywtbUah+oBUV7mbZUsLDKEV4JEdAtWYwoIg9qbiiMr0bkYk8kQoyQ2w8meazl r+4Zm88yZoWxLsTh9FFVFj5W21DrKGUZ3rktwTW3oj0zxeuw3vys7NSR569COaBxqF+6 3nMQ== 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=Gj+EHCblifh5MMn3itLSDnoZXL5PyxBzL8vDQC39wXs=; b=f9cMF/Jv8b/Pv+pXG3/KmzNejAiGaE0G20ywbr8GyAS2I9Umtqa2tcFOntq4Dd/jis xEsMwcrVsjcigSsca68wdlkGgMYiuWIchf+NnB4ZCxcHiSAeZB3pODQRRF7ajMSZ69Rx C2UsvotQ/p4iq+jGjvxWBNR346D68gC9E8NzQbTWFdHjclyGty11TPrXJkVhdk/xffil gpECW+zgg+v+Hye+rJuoWIk6j1pbMBFnI4KCHwTqRxdlLr7bQ2kwejuF+HMeQW0eBhPx pWlz646EVS9I+OTuJdBvckXCjMWSFbnmMPqHrs/be1pJMPC7G4LNT/ixrNrvXk00jyPS BFxw== X-Gm-Message-State: APjAAAX8lk46xc92aTIZFhelvI7WUtmNHx/pLYp2cd2pL7odKDdH8a24 p0OEnn9pRtTwolnxFSEH9d2xFjoa X-Google-Smtp-Source: APXvYqzaJEK04tFi6qV8oYnDTnzcYe84a/m4v8i5sy8Er09QFPscZ5mFxTEBObO4woIdrBr1zeGJyQ== X-Received: by 2002:a05:6000:11c3:: with SMTP id i3mr2431079wrx.244.1576670584579; Wed, 18 Dec 2019 04:03:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/87] migration-test: Move -incomming handling to common commandline Date: Wed, 18 Dec 2019 13:01:35 +0100 Message-Id: <1576670573-48048-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index e1304d7..14f2ce3 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -580,9 +580,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_args =3D ""; memory_size =3D "150M"; cmd_src =3D g_strdup_printf("-drive file=3D%s,format=3Draw", bootp= ath); - cmd_dst =3D g_strdup_printf("-drive file=3D%s,format=3Draw" - " -incoming %s", - bootpath, uri); + cmd_dst =3D g_strdup(cmd_src); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { @@ -591,9 +589,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_args =3D ""; memory_size =3D "128M"; cmd_src =3D g_strdup_printf("-bios %s", bootpath); - cmd_dst =3D g_strdup_printf("-bios %s" - " -incoming %s", - bootpath, uri); + cmd_dst =3D g_strdup(cmd_src); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { @@ -605,7 +601,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "'nvramrc=3Dhex .\" _\" begin %x %x " "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " "until'", end_address, start_address); - cmd_dst =3D g_strdup_printf(" -incoming %s", uri); + cmd_dst =3D g_strdup(""); start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; } else if (strcmp(arch, "aarch64") =3D=3D 0) { @@ -616,11 +612,7 @@ static int test_migrate_start(QTestState **from, QTest= State **to, cmd_src =3D g_strdup_printf("-cpu max " "-kernel %s", bootpath); - cmd_dst =3D g_strdup_printf("-cpu max " - "-kernel %s " - "-incoming %s", - bootpath, uri); - + cmd_dst =3D g_strdup(cmd_src); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -650,11 +642,11 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " "-name source,debug-threads=3Don " - "-serial file:%s/src_serial " "-m %s " + "-serial file:%s/src_serial " "%s %s %s %s", machine_type, machine_args, - tmpfs, memory_size, + memory_size, tmpfs, cmd_src, shmem_opts, opts_src, ignore_std= err); g_free(cmd_src); *from =3D qtest_init(cmd_source); @@ -664,9 +656,10 @@ static int test_migrate_start(QTestState **from, QTest= State **to, "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " + "-incoming %s " "%s %s %s %s", machine_type, machine_args, - tmpfs, memory_size, + memory_size, tmpfs, uri, cmd_dst, shmem_opts, opts_dst, ignore_std= err); g_free(cmd_dst); *to =3D qtest_init(cmd_target); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671153; cv=none; d=zohomail.com; s=zohoarc; b=kXYkWwJeNH4I0bGcE4L1ceKdEhSYez9G7Sj2zhQcFAC69WWcwCxxLUNH3EHwJEm16968StIQzwWKnMnA0lDhDR4pjj3cz5/0hwTFWrJdB67Wdqh52yfpnJvwS3TIwL3vVWIvrXasKQTU76OVUsFs1CoF/jocM2yDxfYSm9cMdOo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671153; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hDnMTI6Tisyyc4MUAZDZjzS6Nao0qdWk6sKjID5q248=; b=cOFwNc0WwxQwRLCejTIp0ugiqUig923yX7swoS3Y9BqA5+SnXzoBATLvuf+aiTGVW3syDf6BrMaU3NtbWjYyHWQgAMeclPy6+7W4D511l0ZCovtveuSr3eWyDmSLCDvcYj3yRiX2AxnLqqyPb3OH/hn3Ca3Oautj2pm7B2tz8tg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671153078529.6840571114315; Wed, 18 Dec 2019 04:12:33 -0800 (PST) Received: from localhost ([::1]:53268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYBr-00021H-FR for importer@patchew.org; Wed, 18 Dec 2019 07:12:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45749) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2o-00063w-Bd for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2l-0008M2-2Z for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:39523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2k-0008Hy-Qb for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:06 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 20so1481093wmj.4 for ; Wed, 18 Dec 2019 04:03:06 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:04 -0800 (PST) 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=hDnMTI6Tisyyc4MUAZDZjzS6Nao0qdWk6sKjID5q248=; b=enTGWBfIQQZ4aaMxTNMEmogZ7YcH7CGbrEXTQfK0tNVWdGUQjJyrmJ/xjsntZ5qq8N eMATICr9B8EfvrEPh60NZ1Tq6lx0Xp/8dHW80KH8vjhQPvqvwdG2adm3D7AXCDR1/AET xose8T/DCjPZX9TqzH14Zs52xEm5kjLH9IQzu0skJL/xIXcgQKck1DYSlnF3z8bfthGY aNt2X6C9wzZQLLwkXv4MhDq4NVx7xKIJ08g0pUC0YPFagx0IvTfTDxgT29TbrmyYqKLo YbpzIeY6Owc4lWlnvO7XtbbI+MHZsYDqRKRUAXAfC/srS3k7+KjLL6/ZKmvhnWevwws6 vb7w== 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=hDnMTI6Tisyyc4MUAZDZjzS6Nao0qdWk6sKjID5q248=; b=FN8KjrzIO1bXy/onnE26nLIvJSQQxJnaZEHgXei11hWwKJsBj5VmUasv3JvoSWHXgQ 9RBz4mNKuWRMCaMgZNqRF3YluROpistC4+4D5/V+CF2TwIDM2oeb/YH5DC81PIiiqAQO 0g9hq2o/6/UFjVKDLAsM7sDSSZoG2MEFM8Fm0ZHk8i+rGCh6fxERvfUm7vV5CWYDq2Rt cWhysnvDsmOFqXJVUdZngh0vr98N3xWaF1ZiFouZET5IdIiTNo3UXZ1Yr1xR61sw7Dbu oNecZGIemxeJHu5e9ujGj/Par0Fg5b+FH73QwMWM1Znn3G61eiCKdazQSbr6ydUhrzp5 D7ZQ== X-Gm-Message-State: APjAAAV8x8yL0bqvwzEB+BPK7cF0kAeYO0RrXbmSsc1j5GKPEeqfua2I HnNaTMtU43MU2kANUz7VanWR/gkX X-Google-Smtp-Source: APXvYqw1qtJaloA/iZRFhYRg0/IBUYePXPN5rlud5t1eyL2s7twKSS0dXtT5mmRiblKZH8/Wc43mYQ== X-Received: by 2002:a7b:c00c:: with SMTP id c12mr2841557wmb.174.1576670585533; Wed, 18 Dec 2019 04:03:05 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/87] migration-test: Rename cmd_src/dst to arch_source/arch_target Date: Wed, 18 Dec 2019 13:01:36 +0100 Message-Id: <1576670573-48048-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela This explains better what they do and avoid confussino with command_src/target. Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 14f2ce3..37e9663 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -549,7 +549,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, bool use_shmem, const char *opts_src, const char *opts_dst) { - gchar *cmd_src, *cmd_dst; + gchar *arch_source, *arch_target; gchar *cmd_source, *cmd_target; const gchar *ignore_stderr; char *bootpath =3D NULL; @@ -579,8 +579,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "150M"; - cmd_src =3D g_strdup_printf("-drive file=3D%s,format=3Draw", bootp= ath); - cmd_dst =3D g_strdup(cmd_src); + arch_source =3D g_strdup_printf("-drive file=3D%s,format=3Draw", b= ootpath); + arch_target =3D g_strdup(arch_source); start_address =3D X86_TEST_MEM_START; end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { @@ -588,20 +588,20 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D ""; machine_args =3D ""; memory_size =3D "128M"; - cmd_src =3D g_strdup_printf("-bios %s", bootpath); - cmd_dst =3D g_strdup(cmd_src); + arch_source =3D g_strdup_printf("-bios %s", bootpath); + arch_target =3D g_strdup(arch_source); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { machine_type =3D ""; machine_args =3D ",vsmt=3D8"; memory_size =3D "256M"; - cmd_src =3D g_strdup_printf("-nodefaults " - "-prom-env 'use-nvramrc?=3Dtrue' -prom-e= nv " - "'nvramrc=3Dhex .\" _\" begin %x %x " - "do i c@ 1 + i c! 1000 +loop .\" B\" 0 " - "until'", end_address, start_address); - cmd_dst =3D g_strdup(""); + arch_source =3D g_strdup_printf("-nodefaults " + "-prom-env 'use-nvramrc?=3Dtrue' -pr= om-env " + "'nvramrc=3Dhex .\" _\" begin %x %x " + "do i c@ 1 + i c! 1000 +loop .\" B\"= 0 " + "until'", end_address, start_address= ); + arch_target =3D g_strdup(""); start_address =3D PPC_TEST_MEM_START; end_address =3D PPC_TEST_MEM_END; } else if (strcmp(arch, "aarch64") =3D=3D 0) { @@ -609,10 +609,10 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, machine_type =3D "virt,"; machine_args =3D "gic-version=3Dmax"; memory_size =3D "150M"; - cmd_src =3D g_strdup_printf("-cpu max " - "-kernel %s", - bootpath); - cmd_dst =3D g_strdup(cmd_src); + arch_source =3D g_strdup_printf("-cpu max " + "-kernel %s", + bootpath); + arch_target =3D g_strdup(arch_source); start_address =3D ARM_TEST_MEM_START; end_address =3D ARM_TEST_MEM_END; =20 @@ -647,8 +647,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", machine_type, machine_args, memory_size, tmpfs, - cmd_src, shmem_opts, opts_src, ignore_std= err); - g_free(cmd_src); + arch_source, shmem_opts, opts_src, + ignore_stderr); + g_free(arch_source); *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 @@ -660,8 +661,9 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", machine_type, machine_args, memory_size, tmpfs, uri, - cmd_dst, shmem_opts, opts_dst, ignore_std= err); - g_free(cmd_dst); + arch_target, shmem_opts, opts_dst, + ignore_stderr); + g_free(arch_target); *to =3D qtest_init(cmd_target); g_free(cmd_target); =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671056; cv=none; d=zohomail.com; s=zohoarc; b=JBtyDpNoae0dUYk7afAbyV5lft3BCesKVxgStw1DZk8OgOgdHxmtitu8wp/0f2g8p1JUOv6nbV5pN+1flqnPIoQk3gLq0eU3O8JwyEoh00/3tpbs4paUqDSudYoCysTS1ZRLfJGvjWMbqJC7+HG5hWuFjDQMEuqq13/wB1inQQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671056; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ef/FO6qoNGMLr8f5Vz4w7Or3wCDjsjS3iUWUZAId/HY=; b=QjiCOBRyOTNpyREYGtsrIEajDPidrcgnXA2UqrfTdo0gXo8PNW5Hkek+iGBYMhKM+XQiADozCiPR/oWU3cIqyfm3GKP97iJl05LvdG0zpN2OVoXpUVl5BYuJxIkB0K4zevrVh0BhTPdAwqHVSybPChLytrnbhiEx9VaVlnJnGvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671056173590.295685668361; Wed, 18 Dec 2019 04:10:56 -0800 (PST) Received: from localhost ([::1]:53236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYAI-00085X-DT for importer@patchew.org; Wed, 18 Dec 2019 07:10:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2q-00067B-JD for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2o-0008Pa-MO for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:12 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:54493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2o-0008Mi-Bb for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: by mail-wm1-x341.google.com with SMTP id b19so1551536wmj.4 for ; Wed, 18 Dec 2019 04:03:07 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:05 -0800 (PST) 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=ef/FO6qoNGMLr8f5Vz4w7Or3wCDjsjS3iUWUZAId/HY=; b=eTvrffLxlaX3tv1AZe1Ck3pvc62zwHDQnSELzOfP+G57cxQu7G2QmBbG27O+OVjOf7 nP5vbE3RFNxcPL4CBPdBy++Ow6b4JWrINC40a6SnrWA9XMBdF5BTFtxfv9uELpqMKoLm NeYwjZjg9JO2ekv5/zxkimre/Td3sSwONW2qcQ6N09La4TZkD9CXqst2GixJxCvnInsB yfFAabYfT7HXSSmWlksIH5r/uLlgnx7oTt85TYZzscFPRyGpwBMpgpYIKoT4F5/xH3Gr OExuAE/cgmutJ5pVx2GSN06ID8RTSn0ZS5dTcGMS5zwFUExvfKIPqKXxKqD6ZU7rCUAP jV5g== 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=ef/FO6qoNGMLr8f5Vz4w7Or3wCDjsjS3iUWUZAId/HY=; b=oZ6bBSM/iJYQ9GXsuZAGCoZ3h34AJmWbPwXzutDtuygPx2t/SKjpoPduqBC1P9vc6p UktYuut7CCZ7+6DqRm0N8eA6xhWDZN15m4Aif961DjQgNnof7j4VaQ8+3ZfF+AW8J5mw K/+hy7mpsnCfa06ALuDmiEiH6s033Qr8DQBKRxUO058qtcpaxQbmidtcAzM1vq3gghmB UN9ciK2F4EqRREzuIjkCFIk/O8gv1miNQw3A8zwcKVia+sY4p22CCISMAl9wpj9yIC9b EdXPh2JGzJ4rbVzjS3XZaMtl66XYtZXcs5uHxiwsV6w+M5RCd3hLDUmQSfOhUojKQxjF UNuw== X-Gm-Message-State: APjAAAUrdHofrs9IKOtZpgdvN9fWsfwEetkGfXlCXdKvi+UmPoFOA+B0 kxJiVoThHdAdehkoQrxuiI5RtlMI X-Google-Smtp-Source: APXvYqx+Fhbcnj3Sz5sajxBJy1sVHmrQH1uhQ1/x45m06ugL+mDFYGkMhC1dw4jUyzjN9ZtQ8068aw== X-Received: by 2002:a1c:9e4c:: with SMTP id h73mr2794428wme.177.1576670586403; Wed, 18 Dec 2019 04:03:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/87] migration-test: Use a struct for test_migrate_start parameters Date: Wed, 18 Dec 2019 13:01:37 +0100 Message-Id: <1576670573-48048-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Juan Quintela Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Juan Quintela It has two bools and two strings, it is very difficult to remember which does what. And it makes very difficult to add new parameters as we need to modify all the callers. Signed-off-by: Juan Quintela Tested-by: Cornelia Huck #s390x Tested-by: Laurent Vivier --- tests/migration-test.c | 118 ++++++++++++++++++++++++++++++++-------------= ---- 1 file changed, 78 insertions(+), 40 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 37e9663..dbe25b8 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -544,10 +544,31 @@ static void migrate_postcopy_start(QTestState *from, = QTestState *to) qtest_qmp_eventwait(to, "RESUME"); } =20 +typedef struct { + bool hide_stderr; + bool use_shmem; + char *opts_source; + char *opts_target; +} MigrateStart; + +static MigrateStart *migrate_start_new(void) +{ + MigrateStart *args =3D g_new0(MigrateStart, 1); + + args->opts_source =3D g_strdup(""); + args->opts_target =3D g_strdup(""); + return args; +} + +static void migrate_start_destroy(MigrateStart *args) +{ + g_free(args->opts_source); + g_free(args->opts_target); + g_free(args); +} + static int test_migrate_start(QTestState **from, QTestState **to, - const char *uri, bool hide_stderr, - bool use_shmem, const char *opts_src, - const char *opts_dst) + const char *uri, MigrateStart *args) { gchar *arch_source, *arch_target; gchar *cmd_source, *cmd_target; @@ -560,10 +581,7 @@ static int test_migrate_start(QTestState **from, QTest= State **to, const char *machine_args; const char *memory_size; =20 - opts_src =3D opts_src ? opts_src : ""; - opts_dst =3D opts_dst ? opts_dst : ""; - - if (use_shmem) { + if (args->use_shmem) { if (!g_file_test("/dev/shm", G_FILE_TEST_IS_DIR)) { g_test_skip("/dev/shm is not supported"); return -1; @@ -623,13 +641,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, =20 g_free(bootpath); =20 - if (hide_stderr) { + if (args->hide_stderr) { ignore_stderr =3D "2>/dev/null"; } else { ignore_stderr =3D ""; } =20 - if (use_shmem) { + if (args->use_shmem) { shmem_path =3D g_strdup_printf("/dev/shm/qemu-%d", getpid()); shmem_opts =3D g_strdup_printf( "-object memory-backend-file,id=3Dmem0,size=3D%s" @@ -647,7 +665,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", machine_type, machine_args, memory_size, tmpfs, - arch_source, shmem_opts, opts_src, + arch_source, shmem_opts, args->opts_sourc= e, ignore_stderr); g_free(arch_source); *from =3D qtest_init(cmd_source); @@ -661,8 +679,8 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, "%s %s %s %s", machine_type, machine_args, memory_size, tmpfs, uri, - arch_target, shmem_opts, opts_dst, - ignore_stderr); + arch_target, shmem_opts, + args->opts_target, ignore_stderr); g_free(arch_target); *to =3D qtest_init(cmd_target); g_free(cmd_target); @@ -672,11 +690,12 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, * Remove shmem file immediately to avoid memory leak in test failed c= ase. * It's valid becase QEMU has already opened this file */ - if (use_shmem) { + if (args->use_shmem) { unlink(shmem_path); g_free(shmem_path); } =20 + migrate_start_destroy(args); return 0; } =20 @@ -762,13 +781,13 @@ static void test_deprecated(void) } =20 static int migrate_postcopy_prepare(QTestState **from_ptr, - QTestState **to_ptr, - bool hide_error) + QTestState **to_ptr, + MigrateStart *args) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, hide_error, false, NULL, NULL)= ) { + if (test_migrate_start(&from, &to, uri, args)) { return -1; } =20 @@ -813,9 +832,10 @@ static void migrate_postcopy_complete(QTestState *from= , QTestState *to) =20 static void test_postcopy(void) { + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; =20 - if (migrate_postcopy_prepare(&from, &to, false)) { + if (migrate_postcopy_prepare(&from, &to, args)) { return; } migrate_postcopy_start(from, to); @@ -824,10 +844,13 @@ static void test_postcopy(void) =20 static void test_postcopy_recovery(void) { + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; char *uri; =20 - if (migrate_postcopy_prepare(&from, &to, true)) { + args->hide_stderr =3D true; + + if (migrate_postcopy_prepare(&from, &to, args)) { return; } =20 @@ -910,9 +933,12 @@ static void wait_for_migration_fail(QTestState *from, = bool allow_active) =20 static void test_baddest(void) { + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, "tcp:0:0", true, false, NULL, NULL)= ) { + args->hide_stderr =3D true; + + if (test_migrate_start(&from, &to, "tcp:0:0", args)) { return; } migrate(from, "tcp:0:0", "{}"); @@ -923,9 +949,10 @@ static void test_baddest(void) static void test_precopy_unix(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, false, false, NULL, NULL)) { + if (test_migrate_start(&from, &to, uri, args)) { return; } =20 @@ -1001,9 +1028,10 @@ static void test_ignore_shared(void) =20 static void test_xbzrle(const char *uri) { + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, false, false, NULL, NULL)) { + if (test_migrate_start(&from, &to, uri, args)) { return; } =20 @@ -1052,11 +1080,11 @@ static void test_xbzrle_unix(void) =20 static void test_precopy_tcp(void) { + MigrateStart *args =3D migrate_start_new(); char *uri; QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", false, false, - NULL, NULL)) { + if (test_migrate_start(&from, &to, "tcp:127.0.0.1:0", args)) { return; } =20 @@ -1096,13 +1124,14 @@ static void test_precopy_tcp(void) =20 static void test_migrate_fd_proto(void) { + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; int ret; int pair[2]; QDict *rsp; const char *error_desc; =20 - if (test_migrate_start(&from, &to, "defer", false, false, NULL, NULL))= { + if (test_migrate_start(&from, &to, "defer", args)) { return; } =20 @@ -1178,15 +1207,12 @@ static void test_migrate_fd_proto(void) test_migrate_end(from, to, true); } =20 -static void do_test_validate_uuid(const char *uuid_arg_src, - const char *uuid_arg_dst, - bool should_fail, bool hide_stderr) +static void do_test_validate_uuid(MigrateStart *args, bool should_fail) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); QTestState *from, *to; =20 - if (test_migrate_start(&from, &to, uri, hide_stderr, false, - uuid_arg_src, uuid_arg_dst)) { + if (test_migrate_start(&from, &to, uri, args)) { return; } =20 @@ -1216,33 +1242,45 @@ static void do_test_validate_uuid(const char *uuid_= arg_src, =20 static void test_validate_uuid(void) { - do_test_validate_uuid("-uuid 11111111-1111-1111-1111-111111111111", - "-uuid 11111111-1111-1111-1111-111111111111", - false, false); + MigrateStart *args =3D migrate_start_new(); + + args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); + args->opts_target =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); + do_test_validate_uuid(args, false); } =20 static void test_validate_uuid_error(void) { - do_test_validate_uuid("-uuid 11111111-1111-1111-1111-111111111111", - "-uuid 22222222-2222-2222-2222-222222222222", - true, true); + MigrateStart *args =3D migrate_start_new(); + + args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); + args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); + args->hide_stderr =3D true; + do_test_validate_uuid(args, true); } =20 static void test_validate_uuid_src_not_set(void) { - do_test_validate_uuid(NULL, "-uuid 11111111-1111-1111-1111-11111111111= 1", - false, true); + MigrateStart *args =3D migrate_start_new(); + + args->opts_target =3D g_strdup("-uuid 22222222-2222-2222-2222-22222222= 2222"); + args->hide_stderr =3D true; + do_test_validate_uuid(args, false); } =20 static void test_validate_uuid_dst_not_set(void) { - do_test_validate_uuid("-uuid 11111111-1111-1111-1111-111111111111", NU= LL, - false, true); + MigrateStart *args =3D migrate_start_new(); + + args->opts_source =3D g_strdup("-uuid 11111111-1111-1111-1111-11111111= 1111"); + args->hide_stderr =3D true; + do_test_validate_uuid(args, false); } =20 static void test_migrate_auto_converge(void) { char *uri =3D g_strdup_printf("unix:%s/migsocket", tmpfs); + MigrateStart *args =3D migrate_start_new(); QTestState *from, *to; int64_t remaining, percentage; =20 @@ -1261,7 +1299,7 @@ static void test_migrate_auto_converge(void) */ const int64_t expected_threshold =3D max_bandwidth * downtime_limit / = 1000; =20 - if (test_migrate_start(&from, &to, uri, false, false, NULL, NULL)) { + if (test_migrate_start(&from, &to, uri, args)) { return; } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671306; cv=none; d=zohomail.com; s=zohoarc; b=Pz0L4kQf3P4RlNSCZaUBrCL/ogmbCTMZRGOrSMasSRTSgSJ+5Ytb2qRovF/n9dyCr6n7CJFMhBOKyBgj0KlIIXcZLpvE7KMxj+0oBJaJAU0G3u7bjeD4PGfIbJBEHAz7ug8oR/PqHjLPIDKohjcY2zbSM44TpG7wR25nehJlpfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671306; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TAsGaMkNvgX/1PLIh8rhtcIKT0XZhmfnt+sThwwjUYM=; b=AewbsJHgCvphht4+dZRc8UzXh1HeQZhzhomdvHFloeOjUGgNWsawHh9AQAC7CSJuH0XF4wOtS3nTpHH+YJOnA5tOA5DlLc2iPbIF9hzMvX7k1Nq9W0cyhI7sqZiwU64fK2Be4UW9EKpBTE5n4RZeGSSo3M/P+GwRJ+UK9qitr9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667130694539.59674051030163; Wed, 18 Dec 2019 04:15:06 -0800 (PST) Received: from localhost ([::1]:53290 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYEL-0005T6-7t for importer@patchew.org; Wed, 18 Dec 2019 07:15:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46041) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2p-00066E-WA for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2o-0008PG-Mx for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:33357) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2o-0008Mn-AF for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: by mail-wr1-x430.google.com with SMTP id b6so2028887wrq.0 for ; Wed, 18 Dec 2019 04:03:08 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:06 -0800 (PST) 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=TAsGaMkNvgX/1PLIh8rhtcIKT0XZhmfnt+sThwwjUYM=; b=J/7utKiPuH2S7OdchHgT5h5XYsAukmf4Dd/hSJ9kwhxhyRetf6KaphydiOKijXLdzF eGw4mX0sgIF/2b/uykbjCk5fxmBErSbpsKRgfP7dMEcPHdAsuID7jNP+QO5BmXLUYWkH UTI3qaqh3uQtBaER0O6fDLQXFDe215vhOEQjrtNkIjzOOOwb5d0Ym8Y7a0wmUx58XoEo 2XfV4Yu2z+XwfzDRm/QV73IvZtkYXRMiqjOx/bGS405H0uz/5Xx7V+aTbCHF2jRDcoKj RY3JqcWCM0bzuXcZa6vboR8XQ1WaHnKou+1vaKfYvzykfwxxn7YX8uNg9PzcZWwkqUNs vHCw== 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=TAsGaMkNvgX/1PLIh8rhtcIKT0XZhmfnt+sThwwjUYM=; b=i9W3JRGlH8YZFAEtxjL5K1vavXqaVhhgAV9HkRYQkHQJ3EjbKNjQlChxg7ZcEDD2te Q+4+7eK4XT4qfdN2TYXpAm5vYO9BFeYxIGQTO+LCENqD2YuTP+jIAp/zGTL9kFxP9o+J 8Ojz7gihV7QyYZyJi0GA2tOudLkilbNDXyCl904mrRD991mZkrXZbv4TpwmakSzdyPgS GjgGlEK9ddGYW4pXDwNidr+W6bJzDNd1oZllt4PJ/kzX/Hefh5wJw8mWK7RmGYtzpbUf sWnSjSrgGITMHvWAtivgZfaoO9G4TRZcIvz8iX7AKrRNEElQ2ecVYb1ZozSXkRT6NOev myvg== X-Gm-Message-State: APjAAAVh7RixjcXpWXOUhKlPfNVnTHy6HFGlbu35kGvrHgw93E/9R9VV 6ne6Ynn9lxWP2dbbB1RniweStYLf X-Google-Smtp-Source: APXvYqzcdlIELg70iyA5ZS8mpkes5PYtTnsSAuilVVpEinWuhGz/7q0O3TCEqMDO9eCke68kGDCKTw== X-Received: by 2002:a5d:6a83:: with SMTP id s3mr2344446wru.99.1576670587594; Wed, 18 Dec 2019 04:03:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/87] memory: do not look at current_machine->accel Date: Wed, 18 Dec 2019 13:01:38 +0100 Message-Id: <1576670573-48048-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::430 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) "info mtree -f" prints the wrong accelerator name if used with for example "-machine accel=3Dkvm:tcg". The right thing to do is to fetch the name from the AccelClass, which will also work nicely once current_machine->accel stops existing. Tested-by: Thomas Huth Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- memory.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/memory.c b/memory.c index 0228cad..d7b9bb6 100644 --- a/memory.c +++ b/memory.c @@ -2991,7 +2991,6 @@ struct FlatViewInfo { bool dispatch_tree; bool owner; AccelClass *ac; - const char *ac_name; }; =20 static void mtree_print_flatview(gpointer key, gpointer value, @@ -3061,7 +3060,7 @@ static void mtree_print_flatview(gpointer key, gpoint= er value, if (fvi->ac->has_memory(current_machine, as, int128_get64(range->addr.start), MR_SIZE(range->addr.size) + 1)) { - qemu_printf(" %s", fvi->ac_name); + qemu_printf(" %s", fvi->ac->name); } } } @@ -3109,8 +3108,6 @@ void mtree_info(bool flatview, bool dispatch_tree, bo= ol owner) =20 if (ac->has_memory) { fvi.ac =3D ac; - fvi.ac_name =3D current_machine->accel ? current_machine->acce= l : - object_class_get_name(OBJECT_CLASS(ac)); } =20 /* Gather all FVs in one table */ --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576670877; cv=none; d=zohomail.com; s=zohoarc; b=QTh6gE6BeDW0+GiTyBL5dwpYkBYRhi7bcYcQIdMt5I2s2XWTP2zZxG30ByIvoXJT30qZxockoUctZ8ouMoh1417EXU7WbAC2hE6UJ/fMEfJXaOtxBaEt+NVkZQ7SuCs3V5vBQOGTBfrtcxFPgjZR3qSeVNJjUJq1yoc1vQucJsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576670877; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wpdalmmTK/FCoQs/NtWe2+gF7RTn+BqZ+IAbD5CsqGs=; b=VLgLlnXZWblDEGyjUE6RR8u4ixfmghN9A5k/qgwVbISvGjd2dLzUQjW84pvx0srN5BHovPxenA9GfkET4az/0esLYirOoyvnJB/YIDlobjJoEeaFf6bXq/JEJwFJUXlj0kK0cvyTZ0xX0gsS2l9yB9ELsOlL+rK84tAPlK98nhs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576670877868746.8835332337421; Wed, 18 Dec 2019 04:07:57 -0800 (PST) Received: from localhost ([::1]:53210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY7Q-0003n0-8Y for importer@patchew.org; Wed, 18 Dec 2019 07:07:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46065) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2q-00066J-1c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2o-0008PP-Na for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:51499) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2o-0008N6-C4 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: by mail-wm1-x343.google.com with SMTP id d73so1561039wmd.1 for ; Wed, 18 Dec 2019 04:03:09 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:07 -0800 (PST) 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=wpdalmmTK/FCoQs/NtWe2+gF7RTn+BqZ+IAbD5CsqGs=; b=AbjDn1YpIIy8iVVP2uw7d3EDL20dZoUDPuC9yuO1mcLnzerfQ/pFd5NyxOcxFbxe6K Kx0YotAPebeuSgwP9j1Ur3gWkVYzX5hhJnD3/aFAIjIVIDdxSz4ZcV0s4XsoGZHkHDB8 sC/ASss97Tp4GRs6B8KJX7q4AbJ7E7tTfaax3txUKkN46McCZAR3C7dUMXlPwzgyIL/p xJFkOpIu0pzOm22dbOhn+O4vTNg4BPOe+ORkDd4qOE33BICKZYN032udiBMN80/rwco/ fdcD/xochb3ruCqfuq71DYDQY5u7MC6f1R+GCY3Xbt9v4WzkJ/jzRUueVND/DiuGiun6 Vo3A== 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=wpdalmmTK/FCoQs/NtWe2+gF7RTn+BqZ+IAbD5CsqGs=; b=dkz0KS5F7egkSg5fCj7z8VPqGrgBAn6a978t1v6sCnI1vbxhS9+3lm77ljPc12Ht7e L/1Rlc2a0S8Zlf/GOeKJzwO2NuYCUuwCtmiC4sLPndaB8PoubrRXNZPr7uw7GvrXfuQD XQFSVcmpDF0xNehx8qil6vTfuZZcSoRpVqHmUm4r/NDfSe+VsW8TBR0YgQkWo+HyD6h5 PFOc/KJpbhyiLfyn0X4P9bS7ktRSuYyASIgEikWywDeayVGStCsfSSUDWesIWNUtDUYf 5iUO9ezR60A2r4FlfaJuIpzAl33dAqEejOxagy4YkeHFPk/GcDu0Brh7lTQ4UPV3hlM/ lH0w== X-Gm-Message-State: APjAAAU3qDOc7YipPpKfJn+FXadU1ZaUlCdz4bveRGLTvL5YSJUujf1R WTgLiy8eB1htpcPj3kRFHEmFVpfe X-Google-Smtp-Source: APXvYqz1XrF5BAb3px2qnqxZgD89d5G1SgdY/95FQrg9vuKQz7la+FigzgKmJJZfSUWAIAPHJQzgIw== X-Received: by 2002:a7b:c317:: with SMTP id k23mr2884998wmj.75.1576670588532; Wed, 18 Dec 2019 04:03:08 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/87] vl: move icount configuration earlier Date: Wed, 18 Dec 2019 13:01:39 +0100 Message-Id: <1576670573-48048-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Once qemu_tcg_configure is turned into a QOM property setter, it will not be able to set a default value for mttcg_enabled. Setting the default will move to the TCG instance_init function, which currently runs before "-icoun= t" is processed. However, it is harmless to do configure_icount for all accelerators; we will just fail later if a non-TCG accelerator is selected. So do that. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- vl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vl.c b/vl.c index 9450830..6e58c1d 100644 --- a/vl.c +++ b/vl.c @@ -2700,6 +2700,12 @@ static void user_register_global_props(void) global_init_func, NULL, NULL); } =20 +static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) +{ + configure_icount(opts, errp); + return 0; +} + int main(int argc, char **argv, char **envp) { int i; @@ -4010,6 +4016,8 @@ int main(int argc, char **argv, char **envp) * Note: uses machine properties such as kernel-irqchip, must run * after machine_set_property(). */ + qemu_opts_foreach(qemu_find_opts("icount"), + do_configure_icount, NULL, &error_fatal); configure_accelerator(current_machine, argv[0]); =20 /* @@ -4095,13 +4103,9 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); =20 cpu_ticks_init(); - if (icount_opts) { - if (!tcg_enabled()) { - error_report("-icount is not allowed with hardware virtualizat= ion"); - exit(1); - } - configure_icount(icount_opts, &error_abort); - qemu_opts_del(icount_opts); + if (use_icount && !(tcg_enabled() || qtest_enabled())) { + error_report("-icount is not allowed with hardware virtualization"= ); + exit(1); } =20 if (tcg_enabled()) { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671319; cv=none; d=zohomail.com; s=zohoarc; b=CfBZaM0CvPMo9mJjekPPtZzNnKxqfKkJyB8uZLeaRev7csv7dvVhy70dXW+3q/NJ/ZIRVt7kkt3PLsmwWMCwyQm7rVi747IbCeZ0lYLcu0imq/Aoe27oWRB0y1V6WZuMcEaolQlFs77WZvTG/3qoXUSACqVqWPbiWbU8ZT9aE8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671319; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=u7/VzsObPJenJKrRI20Is7W11ftIW2OHO+f1XruWVNs=; b=YfWUQst1XiS9pzjx9Og4a0XHLM5qNrhkePPpuaRiSCkeRtKCP5Ld/Y4Il3/XuXdFcF/5Vsftz8aoPMOtDGjZ1ZWgjop/thDylew9X7NdCR2qWgpqd/fJ3iHOu/xTHSwfKGcg9w0/YLL5ApfK+BM7J0b42K24ypYY4Y5L7VljOP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671319231470.09438708438995; Wed, 18 Dec 2019 04:15:19 -0800 (PST) Received: from localhost ([::1]:53292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYEX-0005ez-Jf for importer@patchew.org; Wed, 18 Dec 2019 07:15:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46217) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2q-00067C-In for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2o-0008QO-V5 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:12 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:33689) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2o-0008NP-Gk for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:10 -0500 Received: by mail-wm1-x32d.google.com with SMTP id d139so4490111wmd.0 for ; Wed, 18 Dec 2019 04:03:10 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:08 -0800 (PST) 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=u7/VzsObPJenJKrRI20Is7W11ftIW2OHO+f1XruWVNs=; b=YswgD7vSTwH9TOZkhS7aoliHMjEXmHuoodyIrKzCo2Q/zbbVM/Pk+OKVsSfuvEaHs7 mAaI1Hvsm4M7UwDMQDDVCeAVfzXm/nw/iH6ybr6AJ1aVPihUBnZDROeX3wWvK8umOwip 8tvjJLQTYcarKrn73tgBpgL6mQZTwRyujvsxcVYkP7Co61Cyj4DYDKKTFLsJsKaJN0/b f1XaZzOAsDUCfajW7Wubdcl91CT/mISB2+iVQ7s8LasauqOrL1xrTCr/0rCqhlb3xy5l WqAr3wyekWTtWxsmCCT5aWq69MpmK6ZQAkJPFTHxFZRoZxvSjsGZl5UZmLkQ3n8DFj7+ NL9g== 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=u7/VzsObPJenJKrRI20Is7W11ftIW2OHO+f1XruWVNs=; b=DaHr8/HjLxv0S78VxPcRiImAf5IUAEAYbWlXi3skLV6D6vLcpq2g/ltOylTIfU84u0 xoySsMFBDD4uR5FqXDjYs6+5aXlRwSgJ+drLh9JausNn6/YJTVY46nEKyqz22WyHdOMK tEr/MwkYwL2vsJcRrsMY0HjmnZsgT4SOipxl2w9s3TgStfDWcLCICy3M0kHkkI1Hseq2 E64kUcb0euqnmZeDL4uY2OZ7cJBToCWm9N25ja5Qj9sz99ub8fG6vK1NNELQeOJHbii3 xQ7bMxgRnfizKC9xnD8V6m754uu6KB79SlKlga0mQdkKuEbP1tR9j6tunC1nBrcv6Cxy L6+Q== X-Gm-Message-State: APjAAAW4oKgASiLmjqnwoZP0gwxWMMIPZbg9gZMuC7g69oFtihjRikQl 0/rbpUuli7arLSwQ88am4ZC+SEMI X-Google-Smtp-Source: APXvYqxSntZ0XUDATuCAtKRph+gouhEvzPC/LquMsFpEgEMX9/EIozE51ooLpZVPecwVHqa3VZFxBw== X-Received: by 2002:a7b:c936:: with SMTP id h22mr2722213wml.115.1576670589310; Wed, 18 Dec 2019 04:03:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/87] tcg: move qemu_tcg_configure to accel/tcg/tcg-all.c Date: Wed, 18 Dec 2019 13:01:40 +0100 Message-Id: <1576670573-48048-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move everything related to mttcg_enabled in accel/tcg/tcg-all.c, which will make even more sense when "thread" becomes a QOM property. For now, initializing mttcg_enabled in the instance_init function prepares for the next patch, which will only invoke qemu_tcg_configure when the command line includes a -accel option. Signed-off-by: Paolo Bonzini --- accel/tcg/tcg-all.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++= ++++ cpus.c | 72 ---------------------------------------------- 2 files changed, 83 insertions(+), 72 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index c59d5b0..6b000f0 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -30,6 +30,11 @@ #include "cpu.h" #include "sysemu/cpus.h" #include "qemu/main-loop.h" +#include "tcg/tcg.h" +#include "include/qapi/error.h" +#include "include/qemu/error-report.h" +#include "include/hw/boards.h" +#include "qemu/option.h" =20 unsigned long tcg_tb_size; =20 @@ -58,6 +63,53 @@ static void tcg_handle_interrupt(CPUState *cpu, int mask) } } =20 +/* + * We default to false if we know other options have been enabled + * which are currently incompatible with MTTCG. Otherwise when each + * guest (target) has been updated to support: + * - atomic instructions + * - memory ordering primitives (barriers) + * they can set the appropriate CONFIG flags in ${target}-softmmu.mak + * + * Once a guest architecture has been converted to the new primitives + * there are two remaining limitations to check. + * + * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) + * - The host must have a stronger memory order than the guest + * + * It may be possible in future to support strong guests on weak hosts + * but that will require tagging all load/stores in a guest with their + * implicit memory order requirements which would likely slow things + * down a lot. + */ + +static bool check_tcg_memory_orders_compatible(void) +{ +#if defined(TCG_GUEST_DEFAULT_MO) && defined(TCG_TARGET_DEFAULT_MO) + return (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) =3D=3D 0; +#else + return false; +#endif +} + +static bool default_mttcg_enabled(void) +{ + if (use_icount || TCG_OVERSIZED_GUEST) { + return false; + } else { +#ifdef TARGET_SUPPORTS_MTTCG + return check_tcg_memory_orders_compatible(); +#else + return false; +#endif + } +} + +static void tcg_accel_instance_init(Object *obj) +{ + mttcg_enabled =3D default_mttcg_enabled(); +} + static int tcg_init(MachineState *ms) { tcg_exec_init(tcg_tb_size * 1024 * 1024); @@ -65,6 +117,36 @@ static int tcg_init(MachineState *ms) return 0; } =20 +void qemu_tcg_configure(QemuOpts *opts, Error **errp) +{ + const char *t =3D qemu_opt_get(opts, "thread"); + if (!t) { + return; + } + if (strcmp(t, "multi") =3D=3D 0) { + if (TCG_OVERSIZED_GUEST) { + error_setg(errp, "No MTTCG when guest word size > hosts"); + } else if (use_icount) { + error_setg(errp, "No MTTCG when icount is enabled"); + } else { +#ifndef TARGET_SUPPORTS_MTTCG + warn_report("Guest not yet converted to MTTCG - " + "you may get unexpected results"); +#endif + if (!check_tcg_memory_orders_compatible()) { + warn_report("Guest expects a stronger memory ordering " + "than the host provides"); + error_printf("This may cause strange/hard to debug errors\= n"); + } + mttcg_enabled =3D true; + } + } else if (strcmp(t, "single") =3D=3D 0) { + mttcg_enabled =3D false; + } else { + error_setg(errp, "Invalid 'thread' setting %s", t); + } +} + static void tcg_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac =3D ACCEL_CLASS(oc); @@ -78,6 +160,7 @@ static void tcg_accel_class_init(ObjectClass *oc, void *= data) static const TypeInfo tcg_accel_type =3D { .name =3D TYPE_TCG_ACCEL, .parent =3D TYPE_ACCEL, + .instance_init =3D tcg_accel_instance_init, .class_init =3D tcg_accel_class_init, }; =20 diff --git a/cpus.c b/cpus.c index 63bda15..b472378 100644 --- a/cpus.c +++ b/cpus.c @@ -166,78 +166,6 @@ typedef struct TimersState { static TimersState timers_state; bool mttcg_enabled; =20 -/* - * We default to false if we know other options have been enabled - * which are currently incompatible with MTTCG. Otherwise when each - * guest (target) has been updated to support: - * - atomic instructions - * - memory ordering primitives (barriers) - * they can set the appropriate CONFIG flags in ${target}-softmmu.mak - * - * Once a guest architecture has been converted to the new primitives - * there are two remaining limitations to check. - * - * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) - * - The host must have a stronger memory order than the guest - * - * It may be possible in future to support strong guests on weak hosts - * but that will require tagging all load/stores in a guest with their - * implicit memory order requirements which would likely slow things - * down a lot. - */ - -static bool check_tcg_memory_orders_compatible(void) -{ -#if defined(TCG_GUEST_DEFAULT_MO) && defined(TCG_TARGET_DEFAULT_MO) - return (TCG_GUEST_DEFAULT_MO & ~TCG_TARGET_DEFAULT_MO) =3D=3D 0; -#else - return false; -#endif -} - -static bool default_mttcg_enabled(void) -{ - if (use_icount || TCG_OVERSIZED_GUEST) { - return false; - } else { -#ifdef TARGET_SUPPORTS_MTTCG - return check_tcg_memory_orders_compatible(); -#else - return false; -#endif - } -} - -void qemu_tcg_configure(QemuOpts *opts, Error **errp) -{ - const char *t =3D qemu_opt_get(opts, "thread"); - if (t) { - if (strcmp(t, "multi") =3D=3D 0) { - if (TCG_OVERSIZED_GUEST) { - error_setg(errp, "No MTTCG when guest word size > hosts"); - } else if (use_icount) { - error_setg(errp, "No MTTCG when icount is enabled"); - } else { -#ifndef TARGET_SUPPORTS_MTTCG - warn_report("Guest not yet converted to MTTCG - " - "you may get unexpected results"); -#endif - if (!check_tcg_memory_orders_compatible()) { - warn_report("Guest expects a stronger memory ordering " - "than the host provides"); - error_printf("This may cause strange/hard to debug err= ors\n"); - } - mttcg_enabled =3D true; - } - } else if (strcmp(t, "single") =3D=3D 0) { - mttcg_enabled =3D false; - } else { - error_setg(errp, "Invalid 'thread' setting %s", t); - } - } else { - mttcg_enabled =3D default_mttcg_enabled(); - } -} =20 /* The current number of executed instructions is based on what we * originally budgeted minus the current state of the decrementing --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671490; cv=none; d=zohomail.com; s=zohoarc; b=OYnbVsT2mrUZdgNH2iWUuO8/Rd/phy48TpQsOZT2LheNcQW/JH8wvzig7mRlPwXhfTmuqLWJv0a9cnbJhWbNnkGcO1Kzcqddj+Ay4TOpI8b2C9kBUxW93vKtzX/UVE92yR9T/Q9Ioo1uHTcoaAo2C2MNV3YyPuHK5S3VEvkeUZ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671490; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gHpB9VBgS6owHr3NE5d8EsFR0LXGLo1Ca+/lorSA0No=; b=jFtrIQtcA71Ys/rwvlhEvjd6WZuVGm4zFpNs4YtUJTvsnuHTt9jQscR3di92WadFIiW3YTs2dvqP22CvE9KHp5/TgAc7uZYSO09XXTroke/sl3aL6KcWem758MBRIf/RjGL8hIwLCjD6PHqJwu3S92jiUfiO15YZDCkbSK/dfgY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671490228700.6473596665675; Wed, 18 Dec 2019 04:18:10 -0800 (PST) Received: from localhost ([::1]:53332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYHI-0000wb-D6 for importer@patchew.org; Wed, 18 Dec 2019 07:18:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46346) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2r-000687-E7 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2p-0008Uj-Sn for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:12 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:41980) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2p-0008QI-Ki for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:11 -0500 Received: by mail-wr1-x443.google.com with SMTP id c9so1998468wrw.8 for ; Wed, 18 Dec 2019 04:03:11 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:09 -0800 (PST) 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=gHpB9VBgS6owHr3NE5d8EsFR0LXGLo1Ca+/lorSA0No=; b=PugTkC4JU+8PJde+ZygRyZ89UWHsiqUAfCd6J5W/sZLp8EoX9MeG/W75FBmCA4hwFy lyXAKyX2Q8f+kc+1lqtM9t0KBNwCivo8T60k0eKhm6+sYLJQuRuBUKdMeAaWD+bEwS3s eYCNvEiTr7upCWMe3dhnoT+lVfOafvmZGuLsZSWcpSE2s2k95gDdNBI+nwbF/hnVTLmP CGJu+O7Psgax0XWBnO7HfISAv+gMiokjlPXyQMCNeT0qcvWbquxoUnINOU6ydJYSXO4e WiirTM0VYFTD2EUWuqZ01yOq1CFJXJigJoOl81jGc3WTf5NP/tLgz/L8QcQ6KgC1kW1v R2gw== 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=gHpB9VBgS6owHr3NE5d8EsFR0LXGLo1Ca+/lorSA0No=; b=tHVTyUoN/sY/cF8+T9fH4j891lCChD1s3V9TLbExXbwN4114xLK5Ih91RpeTwNAfpe J9r0SxQljFu5+AToY6b6C+d7PmzYLr2vJfa8kZxCMaY6Hyj9osglC0z2hoDpkn0E0697 0Yi6+MesIk41WwaYXZlZIL0FPiWejetPuP3x4LrASBlIkdQEDmrPPbZXdQNjTks72UTa xE66UPy9NsZztOQPna0V1E+M/FkjloQpeokzpQBLFQf5xetyI5c59+5uKpXvmE0sEl7g WBlVrRnZ18Od7RGB5BAwQKiNVzmcCAChaOsvPPMdx/NIfm3Fyr9XnvMRfsvR7S1Tq6OH mJgw== X-Gm-Message-State: APjAAAW5KzQuFsC+KbPyyish00wypwL3IEhD3Lwejb8bswIuP+Hg1Qpo EpnlOOpji+MqYUcMY/BYFxF/8lX0 X-Google-Smtp-Source: APXvYqz+niIFp7yMD7LTxod3V6z4Kw9i2ZbUabKe32Vk6PG78DANN5E6YqXsMGLQCmFgupYyVqwEdw== X-Received: by 2002:a5d:6802:: with SMTP id w2mr2373008wru.353.1576670590265; Wed, 18 Dec 2019 04:03:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/87] vl: extract accelerator option processing to a separate function Date: Wed, 18 Dec 2019 13:01:41 +0100 Message-Id: <1576670573-48048-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" As a first step towards supporting multiple "-accel" options, push the late processing of -icount and -accel into a new function, and use qemu_opts_foreach to retrieve -accel options instead of stashing them into globals. Signed-off-by: Paolo Bonzini --- vl.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/vl.c b/vl.c index 6e58c1d..7ed9026 100644 --- a/vl.c +++ b/vl.c @@ -2706,6 +2706,25 @@ static int do_configure_icount(void *opaque, QemuOpt= s *opts, Error **errp) return 0; } =20 +static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **= errp) +{ + if (tcg_enabled()) { + qemu_tcg_configure(opts, &error_fatal); + } + return 0; +} + +static void configure_accelerators(void) +{ + qemu_opts_foreach(qemu_find_opts("accel"), + do_configure_accelerator, NULL, &error_fatal); + + if (use_icount && !(tcg_enabled() || qtest_enabled())) { + error_report("-icount is not allowed with hardware virtualization"= ); + exit(1); + } +} + int main(int argc, char **argv, char **envp) { int i; @@ -4103,14 +4122,7 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); =20 cpu_ticks_init(); - if (use_icount && !(tcg_enabled() || qtest_enabled())) { - error_report("-icount is not allowed with hardware virtualization"= ); - exit(1); - } - - if (tcg_enabled()) { - qemu_tcg_configure(accel_opts, &error_fatal); - } + configure_accelerators(); =20 if (default_net) { QemuOptsList *net =3D qemu_find_opts("net"); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671013; cv=none; d=zohomail.com; s=zohoarc; b=ExQO5AbStFfL4upT6vj+eEWwQ95wR6US0wTai7HhnH2USPxqKEsxwx5qd1u2vi7dXEMmboIG3HmMGXH39mXoRDHtNv13jY3+0eQxJ5oG/MIJWEPZzOFbxzw8imYiQ2DHBp3+/kCH6fOqgBaAHjF9zjrPKFv9vex9t80eVPjg2PQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671013; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3BGv9sEI70WyhhrGO9t9As7mziy/qWreFJRvngEh1iI=; b=oB2kLywik5rn3oJijf5sAze76QibMvuRLy1FzsH+We0t/DCEDnN5BhkAVkfv21aZSQkNzD6CDIi98L5StuEUgBqNcJ6Uyu0z4EJQo6A2qhBSkfLejFWVIOdqiuXFZEz+OlP/HiR4i6wnMg0HQ8JuWMrwMs8nBzHjU+8J1iSW4NI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671013063299.792829617742; Wed, 18 Dec 2019 04:10:13 -0800 (PST) Received: from localhost ([::1]:53234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY9b-0007Dn-EP for importer@patchew.org; Wed, 18 Dec 2019 07:10:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46667) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2s-0006AG-Uu for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2r-00007m-6F for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40160) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2q-0008Us-Ih for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:12 -0500 Received: by mail-wr1-x431.google.com with SMTP id c14so1999803wrn.7 for ; Wed, 18 Dec 2019 04:03:12 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:10 -0800 (PST) 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=3BGv9sEI70WyhhrGO9t9As7mziy/qWreFJRvngEh1iI=; b=bckHgj1qzyZg7X1bfUpWLTYkKim2Ldq3YZQ7hM8Bb0Ae7pYqD2BFA4Pf9LyyZvb3Z2 cucFORzqJL/hEy1NlcrWxbVXScMV6qWfreFQuFiCZqUyLvfWg9a4ugSiQHZ7DFM5/+2j KAWyPi4BNA01IfdzqHzCSxINukVvrdzAc8SUzdJEjwj7o7gQYs6jSSXmpMQyVMCqxp5T FBmqm6cuLlJCW8XpIuaxtzAIUvAvKYRr34Drsc9HixBTFoDgwvZxGFy+5c9DJEABH3wY j0084x2b85neIBWLff4TVXIXXqdRvPCxHOsQt5zF8RueDKPtscNO9+rPA5J88f+7Vlbp Cfug== 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=3BGv9sEI70WyhhrGO9t9As7mziy/qWreFJRvngEh1iI=; b=SihKq2tASRrulp9ZiyMmBfaJEJVPPnVA/3d5jgpzs6VqlJPldSd4N6yAKAgXHA9rwk HgA+6v0bnUO7SgpqFM/eXoy0Ta2biLaJz5iH2iA2vOvWmKjJ00WaYwSFRMjnYe9K5JmA w+oznZk469exiJw9ITz5qRY7GUiH0UFIZbU3Re/qudVGs6kpv8jxtNfYFku5e2Gm86OE tiNAmOBl1H2js9rYHFQmOq8PnLeGu4UwLkobL7db3VlQQLHUK+2Nh942QjKC+GAu9//o tMuQXY/4WdWST+IlY9XyImzOk9eX4rJLzFyQtFBObGjvlKlyYyahelzQ2BHg2u0fUJBT hwVw== X-Gm-Message-State: APjAAAXxA643giw3411j/gpbVxiitd80gEjIvPhlABzxSEzSVkfmW4Sg 94uj4/BY6MitDAOZFsecOu6IGZyH X-Google-Smtp-Source: APXvYqwDLfC/ZaLJLwJ2XR2wouZlpl3NuDbeM+/kIlb2w0JJ5F1fuNTHxksdXixEJ0DN+Mqkbo5ptA== X-Received: by 2002:a5d:5403:: with SMTP id g3mr2487465wrv.302.1576670591223; Wed, 18 Dec 2019 04:03:11 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/87] vl: merge -accel processing into configure_accelerators Date: Wed, 18 Dec 2019 13:01:42 +0100 Message-Id: <1576670573-48048-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::431 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The next step is to move the parsing of "-machine accel=3D..." into vl.c, unifying it with the configure_accelerators() function that has just been introduced. This way, we will be able to desugar it into multiple "-accel" options, without polluting accel/accel.c. The CONFIG_TCG and CONFIG_KVM symbols are not available in vl.c, but we can use accel_find instead to find their value at runtime. Once we know that the binary has one of TCG or KVM, the default accelerator can be expressed simply as "tcg:kvm", because TCG never fails to initialize. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- accel/accel.c | 69 ++--------------------------------------------= ---- include/sysemu/accel.h | 4 ++- vl.c | 64 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 64 insertions(+), 73 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index 5fa3171..60c3827 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -28,13 +28,7 @@ #include "hw/boards.h" #include "sysemu/arch_init.h" #include "sysemu/sysemu.h" -#include "sysemu/kvm.h" -#include "sysemu/qtest.h" -#include "hw/xen/xen.h" #include "qom/object.h" -#include "qemu/error-report.h" -#include "qemu/option.h" -#include "qapi/error.h" =20 static const TypeInfo accel_type =3D { .name =3D TYPE_ACCEL, @@ -44,7 +38,7 @@ static const TypeInfo accel_type =3D { }; =20 /* Lookup AccelClass from opt_name. Returns NULL if not found */ -static AccelClass *accel_find(const char *opt_name) +AccelClass *accel_find(const char *opt_name) { char *class_name =3D g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name); AccelClass *ac =3D ACCEL_CLASS(object_class_by_name(class_name)); @@ -52,7 +46,7 @@ static AccelClass *accel_find(const char *opt_name) return ac; } =20 -static int accel_init_machine(AccelClass *acc, MachineState *ms) +int accel_init_machine(AccelClass *acc, MachineState *ms) { ObjectClass *oc =3D OBJECT_CLASS(acc); const char *cname =3D object_class_get_name(oc); @@ -71,65 +65,6 @@ static int accel_init_machine(AccelClass *acc, MachineSt= ate *ms) return ret; } =20 -void configure_accelerator(MachineState *ms, const char *progname) -{ - const char *accel; - char **accel_list, **tmp; - int ret; - bool accel_initialised =3D false; - bool init_failed =3D false; - AccelClass *acc =3D NULL; - - accel =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (accel =3D=3D NULL) { - /* Select the default accelerator */ - int pnlen =3D strlen(progname); - if (pnlen >=3D 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { - /* If the program name ends with "kvm", we prefer KVM */ - accel =3D "kvm:tcg"; - } else { -#if defined(CONFIG_TCG) - accel =3D "tcg"; -#elif defined(CONFIG_KVM) - accel =3D "kvm"; -#else - error_report("No accelerator selected and" - " no default accelerator available"); - exit(1); -#endif - } - } - - accel_list =3D g_strsplit(accel, ":", 0); - - for (tmp =3D accel_list; !accel_initialised && tmp && *tmp; tmp++) { - acc =3D accel_find(*tmp); - if (!acc) { - continue; - } - ret =3D accel_init_machine(acc, ms); - if (ret < 0) { - init_failed =3D true; - error_report("failed to initialize %s: %s", - acc->name, strerror(-ret)); - } else { - accel_initialised =3D true; - } - } - g_strfreev(accel_list); - - if (!accel_initialised) { - if (!init_failed) { - error_report("-machine accel=3D%s: No accelerator found", acce= l); - } - exit(1); - } - - if (init_failed) { - error_report("Back to %s accelerator", acc->name); - } -} - void accel_setup_post(MachineState *ms) { AccelState *accel =3D ms->accelerator; diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 8eb60b8..90b6213 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -66,7 +66,9 @@ typedef struct AccelClass { =20 extern unsigned long tcg_tb_size; =20 -void configure_accelerator(MachineState *ms, const char *progname); +AccelClass *accel_find(const char *opt_name); +int accel_init_machine(AccelClass *acc, MachineState *ms); + /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); =20 diff --git a/vl.c b/vl.c index 7ed9026..28adf38 100644 --- a/vl.c +++ b/vl.c @@ -2714,8 +2714,65 @@ static int do_configure_accelerator(void *opaque, Qe= muOpts *opts, Error **errp) return 0; } =20 -static void configure_accelerators(void) +static void configure_accelerators(const char *progname) { + const char *accel; + char **accel_list, **tmp; + int ret; + bool accel_initialised =3D false; + bool init_failed =3D false; + AccelClass *acc =3D NULL; + + qemu_opts_foreach(qemu_find_opts("icount"), + do_configure_icount, NULL, &error_fatal); + + accel =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); + if (accel =3D=3D NULL) { + /* Select the default accelerator */ + if (!accel_find("tcg") && !accel_find("kvm")) { + error_report("No accelerator selected and" + " no default accelerator available"); + exit(1); + } else { + int pnlen =3D strlen(progname); + if (pnlen >=3D 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { + /* If the program name ends with "kvm", we prefer KVM */ + accel =3D "kvm:tcg"; + } else { + accel =3D "tcg:kvm"; + } + } + } + + accel_list =3D g_strsplit(accel, ":", 0); + + for (tmp =3D accel_list; !accel_initialised && tmp && *tmp; tmp++) { + acc =3D accel_find(*tmp); + if (!acc) { + continue; + } + ret =3D accel_init_machine(acc, current_machine); + if (ret < 0) { + init_failed =3D true; + error_report("failed to initialize %s: %s", + acc->name, strerror(-ret)); + } else { + accel_initialised =3D true; + } + } + g_strfreev(accel_list); + + if (!accel_initialised) { + if (!init_failed) { + error_report("-machine accel=3D%s: No accelerator found", acce= l); + } + exit(1); + } + + if (init_failed) { + error_report("Back to %s accelerator", acc->name); + } + qemu_opts_foreach(qemu_find_opts("accel"), do_configure_accelerator, NULL, &error_fatal); =20 @@ -4035,9 +4092,7 @@ int main(int argc, char **argv, char **envp) * Note: uses machine properties such as kernel-irqchip, must run * after machine_set_property(). */ - qemu_opts_foreach(qemu_find_opts("icount"), - do_configure_icount, NULL, &error_fatal); - configure_accelerator(current_machine, argv[0]); + configure_accelerators(argv[0]); =20 /* * Beware, QOM objects created before this point miss global and @@ -4122,7 +4177,6 @@ int main(int argc, char **argv, char **envp) qemu_spice_init(); =20 cpu_ticks_init(); - configure_accelerators(); =20 if (default_net) { QemuOptsList *net =3D qemu_find_opts("net"); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671668; cv=none; d=zohomail.com; s=zohoarc; b=ezRA5lYY5J8+H7CXs3cSrfTWn8877N3PjrjBzREAojDKWJXkt+Vin3GA38JI5WohyZTySA4CX3S/ZMaa+j/ZV0jw0g0bK6gvFLa2HxNkgrcw/xjtEYw/dCVfNGdl0vhGjPilM04EDyxjFZlzkITxs+1joMlnT7SC2uD5m3AoJ6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671668; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=+astimZn8Je4fKicS3bRyHB/lJlYx/kgk/kvsdzU+FM=; b=XU8uwlH976q2laNVNRd4BQHizZXaToeiIhhq5yd75vCPJ3sm+myxYmMxO0+rEt+2dPGReKojd9MUioV/HudnMunPXcxYYtz1ycVEYHLyfIJS88qLUwFeq7iQN4CIptQyu8xdvuX6gIWi7301u+v/V19oketWEVKwfVeAfaXIE3w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671668637570.4396210859869; Wed, 18 Dec 2019 04:21:08 -0800 (PST) Received: from localhost ([::1]:53364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYKA-0004mR-TY for importer@patchew.org; Wed, 18 Dec 2019 07:21:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46817) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2t-0006BO-Kd for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2s-0000Bx-AG for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:15 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:43632) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2s-00008e-0d for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: by mail-wr1-x42a.google.com with SMTP id d16so1982743wre.10 for ; Wed, 18 Dec 2019 04:03:13 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:11 -0800 (PST) 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=+astimZn8Je4fKicS3bRyHB/lJlYx/kgk/kvsdzU+FM=; b=oYb+ZgPv4c/bxGsXNkBw4AOzjvdL94VPOt5cDS9+q0pHdognWh7XNwRCp4H+rYnS6I Z4X9nDPm7t5d0HWt+gJKNzA+Bfl8KlahSmaHskP+dbSK7HBv9UuFAmCx/Hu0aGeIrYCx +b5aFfo234G/Euz1iSVka9Ch4nuC/CXuH6AJO87GXHN/uDMyhxurJNDms/mO24tcz6UW xpP1ahZnG2ez6kYhXw6fHvq30pDXi+0EmjBV5hlMgiPx5vlWvuPb9qdGXOMz9YslZvs+ ItnGbWqotqatN6LFmMP9MF2kLd7H4tXHW4mpKBNgixTtvDhGDOkflO6buWup8bk6P4iQ qr1w== 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=+astimZn8Je4fKicS3bRyHB/lJlYx/kgk/kvsdzU+FM=; b=Xp4rfur6yDyH9K6y8w86dYq8vVj3aFYIdRcqFDCotS05IHTu02mvUIGvZLRVGjB7le SVyeN/CL6ICErZ6Elkmmd+276YY+aGxyPJn8ZZsvfbUOAs0ZIaGxxSPguY6ej2EMo230 MgMYTGx/WIs1gtTy8TyNBxYbh5OXjNSxWUuFUm5/vLsJG5D8pr1u00dXr9Zn5fryb6m0 2wIybLkJPcqSVvxHa7sOA/4AzpBAXA9qdVYTK+MTYrZuSSFnbBtCwO5ODooRF7umDwty GO4vGA7Wj8Uxhg5TenVf/TPl51+qEu32i7WAjhu17SAq0fOBj28WnsTzpnVuk0LL0qFK ZhuA== X-Gm-Message-State: APjAAAUvgOb0vgxQxrL8QMl9ZOrADiLaknZpkGhGmK+jerIHr90g49OO w1W9p0QjsHR6CV4Fw+m8agUcM0F6 X-Google-Smtp-Source: APXvYqyzFhBOcFtDIZniGhEagoJCKQ7/O0eZDTx6QNHVpEUIAk/5xqIOf2cqv+P+GOqwXpuoN/lTmg== X-Received: by 2002:a5d:50cf:: with SMTP id f15mr2428379wrt.381.1576670592241; Wed, 18 Dec 2019 04:03:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 17/87] accel: compile accel/accel.c just once Date: Wed, 18 Dec 2019 13:01:43 +0100 Message-Id: <1576670573-48048-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that accel/accel.c does not use CONFIG_TCG or CONFIG_KVM anymore, it need not be compiled once for every softmmu target. Signed-off-by: Paolo Bonzini --- Makefile.objs | 1 + accel/Makefile.objs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.objs b/Makefile.objs index 4e4d6dd..c4bc783 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -55,6 +55,7 @@ common-obj-$(CONFIG_POSIX) +=3D os-posix.o =20 common-obj-$(CONFIG_LINUX) +=3D fsdev/ =20 +common-obj-y +=3D accel/ common-obj-y +=3D migration/ =20 common-obj-y +=3D audio/ diff --git a/accel/Makefile.objs b/accel/Makefile.objs index 8b498d3..17e5ac6 100644 --- a/accel/Makefile.objs +++ b/accel/Makefile.objs @@ -1,4 +1,4 @@ -obj-$(CONFIG_SOFTMMU) +=3D accel.o +common-obj-$(CONFIG_SOFTMMU) +=3D accel.o obj-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_POSIX)) +=3D qtest.o obj-$(CONFIG_KVM) +=3D kvm/ obj-$(CONFIG_TCG) +=3D tcg/ --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671503; cv=none; d=zohomail.com; s=zohoarc; b=YxnaESqx+FOTQe/7LTyA7v6O5EAFrKasm015hxVLjG/ROxpbCqaruOiLfA4gZxi6bY2CvuRgLrBV6EQEypXzowzrqwVT19Gv1rhNtCFT/YWi0vhlln1doOe7IyIauduzicQVJ1ChjCpOvjZHjy3f1usn+W6QjYhG1LwNBXZI1Fg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671503; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gdbUgW5i1U+9qsmIX6EVDvxzwkOri5LRfbM8A+wcoPs=; b=b431TZza9ptiMuxQZnEfPwAhW2XJk4L0GBEbZ22DB7XxfUNOSVHYh+7wnW83ZWrZB3NkvtdbFRZ360McNaUWezIjYiVdv9/yms4MtDbUeEaS7k9nB74A+F96oDaLfpt5nfZWjeU5iu5yDFlWDOxvP1OIRUi2rYxQaa/dMaCnDpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671503022724.0286118594851; Wed, 18 Dec 2019 04:18:23 -0800 (PST) Received: from localhost ([::1]:53334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYHV-0001Ee-6I for importer@patchew.org; Wed, 18 Dec 2019 07:18:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46918) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2u-0006Bs-34 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2s-0000DN-O8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:15 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:33697) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2s-00009f-Df for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:14 -0500 Received: by mail-wm1-x335.google.com with SMTP id d139so4490226wmd.0 for ; Wed, 18 Dec 2019 04:03:14 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:12 -0800 (PST) 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=gdbUgW5i1U+9qsmIX6EVDvxzwkOri5LRfbM8A+wcoPs=; b=b2wp3UbJ5cnbTIsThkdPiRKex1/NJPNu63ZCs7TeN/VBer/Ayo77q0sodk8UHLPQUw 5sFtHXNCT/MZRjDencqWcEDdsWsra1K5YM14IKaMGOJemPlgzJ4dinqV6gFMmi72DcQn JWy+4J3C5UFWLV6am3R176J7DB9ekgEc7IrjCWccO5E6nW5m7xOy1QpGAeBkG63cmnXO Dxz5n/cSyE4dKZ1JHQQ8Mu/8143NCfH1STXRh0m20YuA1P0x/556CkDjLv4zR8QiLquQ QHuq9YkzZUlZZaFrhrp13ahjQStpIHzJc4+HWXOaWZ9d3f7zjPvvmKfKTK42h0m7I593 ldJg== 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=gdbUgW5i1U+9qsmIX6EVDvxzwkOri5LRfbM8A+wcoPs=; b=p1jeCKdhLO32He2qx01EerZpvwH1QoO2Ip2C21k/hDwQ9Ug+/q+TpIWMdyfGHGVWJQ plhcAptx9iLIMgqSSkHi1efG1SVrw0ir2QvT97VXraFwtCY8x5POIckRhrhHNMMO6Uz6 Yu3HM5773xpfCL3HBjkChQ6E2+0PjkkisnQVWcqiiSbHvw2XO1L1D0F/Yr2qZ1wM4owf hZ+lkXyuAne0gKUskDtDGHLWcb1I5CiURZHEje7lP8Ts4UpJbGImDlMrpPAtkODnwCnm TdW/hQH/cY3Kw13vCw3DY0kuf9pLTbOTUMOckU8RQ3oqovWwYGco//WsrvVasuez1giH ojEQ== X-Gm-Message-State: APjAAAX71NduldyjIetF297BJhvnROtb2NNy5N8OpTSOABxLGDeFW6l/ pjYFmPiE6b6DFq/lI12amROIDQN5 X-Google-Smtp-Source: APXvYqyxXsayKAogwSYxpGBTfQtejSiAOBGIth24CBtsbz6UrUv+QfasVK38PlC6jCcxn6ETEQJLwQ== X-Received: by 2002:a1c:7d92:: with SMTP id y140mr2636417wmc.145.1576670593124; Wed, 18 Dec 2019 04:03:13 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 18/87] vl: introduce object_parse_property_opt Date: Wed, 18 Dec 2019 13:01:44 +0100 Message-Id: <1576670573-48048-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We will reuse the parsing loop of machine_set_property soon for "-accel", but we do not want the "_" -> "-" conversion since "-accel" can just standardize on dashes. We will also add a bunch of legacy option handling to keep the QOM machine object clean. Extract the loop into a separate function, and keep the legacy handling in machine_set_property. Signed-off-by: Paolo Bonzini --- vl.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/vl.c b/vl.c index 28adf38..efd3b11 100644 --- a/vl.c +++ b/vl.c @@ -2490,27 +2490,17 @@ static MachineClass *select_machine(void) return machine_class; } =20 -static int machine_set_property(void *opaque, - const char *name, const char *value, - Error **errp) +static int object_parse_property_opt(Object *obj, + const char *name, const char *value, + const char *skip, Error **errp) { - Object *obj =3D OBJECT(opaque); Error *local_err =3D NULL; - char *p, *qom_name; =20 - if (strcmp(name, "type") =3D=3D 0) { + if (g_str_equal(name, skip)) { return 0; } =20 - qom_name =3D g_strdup(name); - for (p =3D qom_name; *p; p++) { - if (*p =3D=3D '_') { - *p =3D '-'; - } - } - - object_property_parse(obj, value, qom_name, &local_err); - g_free(qom_name); + object_property_parse(obj, value, name, &local_err); =20 if (local_err) { error_propagate(errp, local_err); @@ -2520,6 +2510,21 @@ static int machine_set_property(void *opaque, return 0; } =20 +static int machine_set_property(void *opaque, + const char *name, const char *value, + Error **errp) +{ + g_autofree char *qom_name =3D g_strdup(name); + char *p; + + for (p =3D qom_name; *p; p++) { + if (*p =3D=3D '_') { + *p =3D '-'; + } + } + + return object_parse_property_opt(opaque, name, value, "type", errp); +} =20 /* * Initial object creation happens before all other --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671687; cv=none; d=zohomail.com; s=zohoarc; b=YJ7phfN+p4tnEaQkZ+Cx0xatXvCQ0TBHi/ryNxiFAbGeM+BxOj+mCRYDM3cFk8+wC6WmysH6EBHHu9/gWSDX62UmoTQu6S/6DtXGgU5IPxwc6e013TN6R0XOu2Gsy9JAyFG4i36OP2VzztXBWDVzLiOq1orcvfNYRhopwVg8Nbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671687; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=meJ3c7hsdmH9Bt9d5yNFDIbdJ46wwRMldpHUVRjZwpk=; b=DAM8ULvq3c7qtjsEax5g5M2mjTsWWMcuPNzQ9NEznuezq+zwcm/Mk4zn+eETgovpTx3/NsUyoxYrlWa6FN96dB5TJ6w5Urz72cOICbprYd+2QjnXNxzx939MRUgXLBp8yRUpUmnDm83kIzc679aPVm0EFT0Dyz4s+qgYw1EuMRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671687012227.46017055730215; Wed, 18 Dec 2019 04:21:27 -0800 (PST) Received: from localhost ([::1]:53370 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYKT-00057K-Fb for importer@patchew.org; Wed, 18 Dec 2019 07:21:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47127) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2x-0006Da-Mw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2u-0000JY-0Q for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:18 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:51666) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2t-0000FM-Jg for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:15 -0500 Received: by mail-wm1-x334.google.com with SMTP id d73so1561380wmd.1 for ; Wed, 18 Dec 2019 04:03:15 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:13 -0800 (PST) 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=meJ3c7hsdmH9Bt9d5yNFDIbdJ46wwRMldpHUVRjZwpk=; b=ecscruxtZ32moibs9ZvfE9EprSAOcmiB0KxuR4iCE64alJrx/vVN4zNhTpQS3kbRnA QfcYEkB83/UGGLX43jZFv3ohIKy/0ZvzdqFcEktT9RAVkg5ctH/L5T94h0ggsZav3CBP TGUN+jl2Cj4s3b9wWjLia8L6+QXnasvA6X23TLcz+7IJ2e1N1/BcWQhGYNx4TTbtePs7 a5NrXLSvUO3H4iJEq7cPK3LDHCeCfCJvTE0GGt7K42CECNnE2fIJbecAGKkiAk7yM31A hd7xy8GclETklfv6P0qLFbQ8ItjvTV5Iw0AOAqsK2rbDJPheQf0OuIndB7ytbreQ7Xjf LIXA== 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=meJ3c7hsdmH9Bt9d5yNFDIbdJ46wwRMldpHUVRjZwpk=; b=o3QGXG8dcWE72WX1r3g2UleW7bKMrdsgpb5zPo5LG4j68YCGO+glolYoQ6eOMKXdQM tziWy936L83G8k/zrtUFLT9qq2ma8DGez5H1qhIYJ3Z6uzcRlJvBfckEtku4U+OYJthN y1X8uDykRGrK95Hazd36TXfnOqQZ1vAl2QljQ1U/Fx249HG5ldWwRyZS40soVJZ9AglV BoKrsH2OXXiK1E2G/RhK1v04UaoWFmpJrLjNnvP+QbkBiVex7yxeQxFBOoXsDRAuGOF/ lcwmCV8gqzuSZ4uEnER1dzUd9IJ4iWhBoJft0TK/A2JPCHFVCictzwtwBjCrOp7Dstp/ OEcg== X-Gm-Message-State: APjAAAXTMJWqMbeqeqiNv7jgtM6flctT5FZe4LvWBlrSxEkd5MMs9SoP fAxi1aEudGbUI8t+EwYsSI+RKUVj X-Google-Smtp-Source: APXvYqx/RS1R6uHMGOlt2qc7zBrm2gB7IlswiE3UgmIg/LpAbwYe+Hq+AJdqDxAfpIbmwfdheo6pKw== X-Received: by 2002:a1c:9602:: with SMTP id y2mr2825571wmd.23.1576670593978; Wed, 18 Dec 2019 04:03:13 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 19/87] vl: configure accelerators from -accel options Date: Wed, 18 Dec 2019 13:01:45 +0100 Message-Id: <1576670573-48048-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Drop the "accel" property from MachineState, and instead desugar "-machine accel=3D" to a list of "-accel" options. This has a semantic change due to removing merge_lists from -accel. For example: - "-accel kvm -accel tcg" all but ignored "-accel kvm". This is a bugfix. - "-accel kvm -accel thread=3Dsingle" ignored "thread=3Dsingle", since it applied the option to KVM. Now it fails due to not specifying the accelerator on "-accel thread=3Dsingle". - "-accel tcg -accel thread=3Dsingle" chose single-threaded TCG, while now it will fail due to not specifying the accelerator on "-accel thread=3Dsingle". Also, "-machine accel" and "-accel" become incompatible. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 21 ----------- include/hw/boards.h | 1 - tests/arm-cpu-features.c | 4 +- tests/bios-tables-test.c | 16 ++++---- tests/boot-serial-test.c | 4 +- tests/cdrom-test.c | 2 +- tests/libqtest.c | 4 +- tests/migration-test.c | 23 +++++------- tests/pflash-cfi02-test.c | 4 +- tests/pnv-xscom-test.c | 4 +- tests/prom-env-test.c | 2 +- tests/pxe-test.c | 2 +- tests/vmgenid-test.c | 2 +- vl.c | 93 +++++++++++++++++++++++++++----------------= ---- 14 files changed, 85 insertions(+), 97 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index 023548b..e661fa6 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -178,21 +178,6 @@ GlobalProperty hw_compat_2_1[] =3D { }; const size_t hw_compat_2_1_len =3D G_N_ELEMENTS(hw_compat_2_1); =20 -static char *machine_get_accel(Object *obj, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - return g_strdup(ms->accel); -} - -static void machine_set_accel(Object *obj, const char *value, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - g_free(ms->accel); - ms->accel =3D g_strdup(value); -} - static void machine_set_kernel_irqchip(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -813,11 +798,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) mc->numa_mem_align_shift =3D 23; mc->numa_auto_assign_ram =3D numa_default_auto_assign_ram; =20 - object_class_property_add_str(oc, "accel", - machine_get_accel, machine_set_accel, &error_abort); - object_class_property_set_description(oc, "accel", - "Accelerator list", &error_abort); - object_class_property_add(oc, "kernel-irqchip", "on|off|split", NULL, machine_set_kernel_irqchip, NULL, NULL, &error_abort); @@ -976,7 +956,6 @@ static void machine_finalize(Object *obj) { MachineState *ms =3D MACHINE(obj); =20 - g_free(ms->accel); g_free(ms->kernel_filename); g_free(ms->initrd_filename); g_free(ms->kernel_cmdline); diff --git a/include/hw/boards.h b/include/hw/boards.h index 24cbeec..96f2084 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -275,7 +275,6 @@ struct MachineState { =20 /*< public >*/ =20 - char *accel; bool kernel_irqchip_allowed; bool kernel_irqchip_required; bool kernel_irqchip_split; diff --git a/tests/arm-cpu-features.c b/tests/arm-cpu-features.c index 6e99aa9..bef3ed2 100644 --- a/tests/arm-cpu-features.c +++ b/tests/arm-cpu-features.c @@ -20,8 +20,8 @@ */ #define SVE_MAX_VQ 16 =20 -#define MACHINE "-machine virt,gic-version=3Dmax,accel=3Dtcg " -#define MACHINE_KVM "-machine virt,gic-version=3Dmax,accel=3Dkvm:tcg " +#define MACHINE "-machine virt,gic-version=3Dmax -accel tcg " +#define MACHINE_KVM "-machine virt,gic-version=3Dmax -accel kvm -accel tcg= " #define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \ " 'arguments': { 'type': 'full', " #define QUERY_TAIL "}}" diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 79f5da0..bc0ad59 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -51,7 +51,7 @@ #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML" =20 typedef struct { - const char *accel; + bool tcg_only; const char *machine; const char *variant; const char *uefi_fl1; @@ -607,19 +607,19 @@ static void test_acpi_one(const char *params, test_da= ta *data) * TODO: convert '-drive if=3Dpflash' to new syntax (see e33763be7= cd3) * when arm/virt boad starts to support it. */ - args =3D g_strdup_printf("-machine %s,accel=3D%s -nodefaults -nogr= aphic " + args =3D g_strdup_printf("-machine %s %s -accel tcg -nodefaults -n= ographic " "-drive if=3Dpflash,format=3Draw,file=3D%s,readonly " "-drive if=3Dpflash,format=3Draw,file=3D%s,snapshot=3Don -cdro= m %s %s", - data->machine, data->accel ? data->accel : "kvm:tcg", + data->machine, data->tcg_only ? "" : "-accel kvm", data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : ""= ); =20 } else { /* Disable kernel irqchip to be able to override apic irq0. */ - args =3D g_strdup_printf("-machine %s,accel=3D%s,kernel-irqchip=3D= off " + args =3D g_strdup_printf("-machine %s,kernel-irqchip=3Doff %s -acc= el tcg " "-net none -display none %s " "-drive id=3Dhd0,if=3Dnone,file=3D%s,format=3Draw " "-device ide-hd,drive=3Dhd0 ", - data->machine, data->accel ? data->accel : "kvm:tcg", + data->machine, data->tcg_only ? "" : "-accel kvm", params ? params : "", disk); } =20 @@ -904,7 +904,7 @@ static void test_acpi_virt_tcg_memhp(void) { test_data data =3D { .machine =3D "virt", - .accel =3D "tcg", + .tcg_only =3D true, .uefi_fl1 =3D "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 =3D "pc-bios/edk2-arm-vars.fd", .cd =3D "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.= qcow2", @@ -929,7 +929,7 @@ static void test_acpi_virt_tcg_numamem(void) { test_data data =3D { .machine =3D "virt", - .accel =3D "tcg", + .tcg_only =3D true, .uefi_fl1 =3D "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 =3D "pc-bios/edk2-arm-vars.fd", .cd =3D "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.= qcow2", @@ -951,7 +951,7 @@ static void test_acpi_virt_tcg(void) { test_data data =3D { .machine =3D "virt", - .accel =3D "tcg", + .tcg_only =3D true, .uefi_fl1 =3D "pc-bios/edk2-aarch64-code.fd", .uefi_fl2 =3D "pc-bios/edk2-arm-vars.fd", .cd =3D "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.= qcow2", diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index d3a54a0..05c7f44 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -215,9 +215,9 @@ static void test_machine(const void *data) * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - qts =3D qtest_initf("%s %s -M %s,accel=3Dtcg:kvm -no-shutdown " + qts =3D qtest_initf("%s %s -M %s -no-shutdown " "-chardev file,id=3Dserial0,path=3D%s " - "-serial chardev:serial0 %s", + "-serial chardev:serial0 -accel tcg -accel kvm %s", codeparam, code ? codetmp : "", test->machine, serialtmp, test->extra); if (code) { diff --git a/tests/cdrom-test.c b/tests/cdrom-test.c index 34e9974..67635e3 100644 --- a/tests/cdrom-test.c +++ b/tests/cdrom-test.c @@ -120,7 +120,7 @@ static void test_cdboot(gconstpointer data) { QTestState *qts; =20 - qts =3D qtest_initf("-M accel=3Dkvm:tcg -no-shutdown %s%s", (const cha= r *)data, + qts =3D qtest_initf("-accel kvm -accel tcg -no-shutdown %s%s", (const = char *)data, isoimage); boot_sector_test(qts); qtest_quit(qts); diff --git a/tests/libqtest.c b/tests/libqtest.c index f36e30a..76c9f8e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -241,9 +241,9 @@ QTestState *qtest_init_without_qmp_handshake(const char= *extra_args) "-qtest-log %s " "-chardev socket,path=3D%s,id=3Dchar0 " "-mon chardev=3Dchar0,mode=3Dcontrol " - "-accel qtest " "-display none " - "%s", qemu_binary, socket_path, + "%s" + " -accel qtest", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/nu= ll", qmp_socket_path, extra_args ?: ""); diff --git a/tests/migration-test.c b/tests/migration-test.c index dbe25b8..e56e6dc 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -577,8 +577,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, char *shmem_opts; char *shmem_path; const char *arch =3D qtest_get_arch(); - const char *machine_type; - const char *machine_args; + const char *machine_opts =3D NULL; const char *memory_size; =20 if (args->use_shmem) { @@ -594,8 +593,6 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, /* the assembled x86 boot sector should be exactly one sector larg= e */ assert(sizeof(x86_bootsect) =3D=3D 512); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); - machine_type =3D ""; - machine_args =3D ""; memory_size =3D "150M"; arch_source =3D g_strdup_printf("-drive file=3D%s,format=3Draw", b= ootpath); arch_target =3D g_strdup(arch_source); @@ -603,16 +600,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, end_address =3D X86_TEST_MEM_END; } else if (g_str_equal(arch, "s390x")) { init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); - machine_type =3D ""; - machine_args =3D ""; memory_size =3D "128M"; arch_source =3D g_strdup_printf("-bios %s", bootpath); arch_target =3D g_strdup(arch_source); start_address =3D S390_TEST_MEM_START; end_address =3D S390_TEST_MEM_END; } else if (strcmp(arch, "ppc64") =3D=3D 0) { - machine_type =3D ""; - machine_args =3D ",vsmt=3D8"; + machine_opts =3D "vsmt=3D8"; memory_size =3D "256M"; arch_source =3D g_strdup_printf("-nodefaults " "-prom-env 'use-nvramrc?=3Dtrue' -pr= om-env " @@ -624,8 +618,7 @@ static int test_migrate_start(QTestState **from, QTestS= tate **to, end_address =3D PPC_TEST_MEM_END; } else if (strcmp(arch, "aarch64") =3D=3D 0) { init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); - machine_type =3D "virt,"; - machine_args =3D "gic-version=3Dmax"; + machine_opts =3D "virt,gic-version=3Dmax"; memory_size =3D "150M"; arch_source =3D g_strdup_printf("-cpu max " "-kernel %s", @@ -658,12 +651,13 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, shmem_opts =3D g_strdup(""); } =20 - cmd_source =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + cmd_source =3D g_strdup_printf("-accel kvm -accel tcg%s%s " "-name source,debug-threads=3Don " "-m %s " "-serial file:%s/src_serial " "%s %s %s %s", - machine_type, machine_args, + machine_opts ? " -machine " : "", + machine_opts ? machine_opts : "", memory_size, tmpfs, arch_source, shmem_opts, args->opts_sourc= e, ignore_stderr); @@ -671,13 +665,14 @@ static int test_migrate_start(QTestState **from, QTes= tState **to, *from =3D qtest_init(cmd_source); g_free(cmd_source); =20 - cmd_target =3D g_strdup_printf("-machine %saccel=3Dkvm:tcg%s " + cmd_target =3D g_strdup_printf("-accel kvm -accel tcg%s%s " "-name target,debug-threads=3Don " "-m %s " "-serial file:%s/dest_serial " "-incoming %s " "%s %s %s %s", - machine_type, machine_args, + machine_opts ? " -machine " : "", + machine_opts ? machine_opts : "", memory_size, tmpfs, uri, arch_target, shmem_opts, args->opts_target, ignore_stderr); diff --git a/tests/pflash-cfi02-test.c b/tests/pflash-cfi02-test.c index d3b23f4..17aa669 100644 --- a/tests/pflash-cfi02-test.c +++ b/tests/pflash-cfi02-test.c @@ -260,7 +260,7 @@ static void test_geometry(const void *opaque) { const FlashConfig *config =3D opaque; QTestState *qtest; - qtest =3D qtest_initf("-M musicpal,accel=3Dqtest" + qtest =3D qtest_initf("-M musicpal" " -drive if=3Dpflash,file=3D%s,format=3Draw,copy-o= n-read" /* Device geometry properties. */ " -global driver=3Dcfi.pflash02," @@ -580,7 +580,7 @@ static void test_cfi_in_autoselect(const void *opaque) { const FlashConfig *config =3D opaque; QTestState *qtest; - qtest =3D qtest_initf("-M musicpal,accel=3Dqtest" + qtest =3D qtest_initf("-M musicpal" " -drive if=3Dpflash,file=3D%s,format=3Draw,copy-o= n-read", image_path); FlashConfig explicit_config =3D expand_config_defaults(config); diff --git a/tests/pnv-xscom-test.c b/tests/pnv-xscom-test.c index 9fddc7d..2c46d5c 100644 --- a/tests/pnv-xscom-test.c +++ b/tests/pnv-xscom-test.c @@ -84,7 +84,7 @@ static void test_cfam_id(const void *data) machine =3D "powernv9"; } =20 - qts =3D qtest_initf("-M %s,accel=3Dtcg -cpu %s", + qts =3D qtest_initf("-M %s -accel tcg -cpu %s", machine, chip->cpu_model); test_xscom_cfam_id(qts, chip); qtest_quit(qts); @@ -125,7 +125,7 @@ static void test_core(const void *data) machine =3D "powernv9"; } =20 - qts =3D qtest_initf("-M %s,accel=3Dtcg -cpu %s", + qts =3D qtest_initf("-M %s -accel tcg -cpu %s", machine, chip->cpu_model); test_xscom_core(qts, chip); qtest_quit(qts); diff --git a/tests/prom-env-test.c b/tests/prom-env-test.c index 61bc1d1..9be52c7 100644 --- a/tests/prom-env-test.c +++ b/tests/prom-env-test.c @@ -57,7 +57,7 @@ static void test_machine(const void *machine) " -machine cap-cfpc=3Dbroken,cap-sbbc=3Dbroken,cap-ibs=3Dbroke= n"; } =20 - qts =3D qtest_initf("-M %s,accel=3Dtcg %s -prom-env 'use-nvramrc?=3Dtr= ue' " + qts =3D qtest_initf("-M %s -accel tcg %s -prom-env 'use-nvramrc?=3Dtru= e' " "-prom-env 'nvramrc=3D%x %x l!' ", (const char *)mac= hine, extra_args, MAGIC, ADDRESS); check_guest_memory(qts); diff --git a/tests/pxe-test.c b/tests/pxe-test.c index aaae54f..f68d0aa 100644 --- a/tests/pxe-test.c +++ b/tests/pxe-test.c @@ -74,7 +74,7 @@ static void test_pxe_one(const testdef_t *test, bool ipv6) } =20 args =3D g_strdup_printf( - "-machine %s,accel=3Dkvm:tcg -nodefaults -boot order=3Dn " + "-accel kvm -accel tcg -machine %s -nodefaults -boot order=3Dn " "-netdev user,id=3D" NETNAME ",tftp=3D./,bootfile=3D%s,ipv4=3D%s,i= pv6=3D%s " "-device %s,bootindex=3D1,netdev=3D" NETNAME " %s", test->machine, disk, ipv6 ? "off" : "on", ipv6 ? "on" : "off", diff --git a/tests/vmgenid-test.c b/tests/vmgenid-test.c index 85d8e64..efba76e 100644 --- a/tests/vmgenid-test.c +++ b/tests/vmgenid-test.c @@ -109,7 +109,7 @@ static void read_guid_from_monitor(QTestState *qts, Qem= uUUID *guid) static char disk[] =3D "tests/vmgenid-test-disk-XXXXXX"; =20 #define GUID_CMD(guid) \ - "-machine accel=3Dkvm:tcg " \ + "-accel kvm -accel tcg " \ "-device vmgenid,id=3Dtestvgid,guid=3D%s " \ "-drive id=3Dhd0,if=3Dnone,file=3D%s,format=3Draw " \ "-device ide-hd,drive=3Dhd0 ", guid, disk diff --git a/vl.c b/vl.c index efd3b11..0f620be 100644 --- a/vl.c +++ b/vl.c @@ -292,7 +292,6 @@ static QemuOptsList qemu_accel_opts =3D { .name =3D "accel", .implied_opt_name =3D "accel", .head =3D QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head), - .merge_lists =3D true, .desc =3D { { .name =3D "accel", @@ -2523,6 +2522,11 @@ static int machine_set_property(void *opaque, } } =20 + /* Legacy options do not correspond to MachineState properties. */ + if (g_str_equal(qom_name, "accel")) { + return 0; + } + return object_parse_property_opt(opaque, name, value, "type", errp); } =20 @@ -2713,74 +2717,88 @@ static int do_configure_icount(void *opaque, QemuOp= ts *opts, Error **errp) =20 static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **= errp) { + bool *p_init_failed =3D opaque; + const char *acc =3D qemu_opt_get(opts, "accel"); + AccelClass *ac =3D accel_find(acc); + int ret; + + if (!ac) { + return 0; + } + ret =3D accel_init_machine(ac, current_machine); + if (ret < 0) { + *p_init_failed =3D true; + error_report("failed to initialize %s: %s", + acc, strerror(-ret)); + return 0; + } + if (tcg_enabled()) { qemu_tcg_configure(opts, &error_fatal); } - return 0; + return 1; } =20 static void configure_accelerators(const char *progname) { const char *accel; char **accel_list, **tmp; - int ret; bool accel_initialised =3D false; bool init_failed =3D false; - AccelClass *acc =3D NULL; =20 qemu_opts_foreach(qemu_find_opts("icount"), do_configure_icount, NULL, &error_fatal); =20 accel =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (accel =3D=3D NULL) { - /* Select the default accelerator */ - if (!accel_find("tcg") && !accel_find("kvm")) { - error_report("No accelerator selected and" - " no default accelerator available"); - exit(1); - } else { - int pnlen =3D strlen(progname); - if (pnlen >=3D 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { - /* If the program name ends with "kvm", we prefer KVM */ - accel =3D "kvm:tcg"; + if (QTAILQ_EMPTY(&qemu_accel_opts.head)) { + if (accel =3D=3D NULL) { + /* Select the default accelerator */ + if (!accel_find("tcg") && !accel_find("kvm")) { + error_report("No accelerator selected and" + " no default accelerator available"); + exit(1); } else { - accel =3D "tcg:kvm"; + int pnlen =3D strlen(progname); + if (pnlen >=3D 3 && g_str_equal(&progname[pnlen - 3], "kvm= ")) { + /* If the program name ends with "kvm", we prefer KVM = */ + accel =3D "kvm:tcg"; + } else { + accel =3D "tcg:kvm"; + } } } - } =20 - accel_list =3D g_strsplit(accel, ":", 0); + accel_list =3D g_strsplit(accel, ":", 0); =20 - for (tmp =3D accel_list; !accel_initialised && tmp && *tmp; tmp++) { - acc =3D accel_find(*tmp); - if (!acc) { - continue; + for (tmp =3D accel_list; !accel_initialised && tmp && *tmp; tmp++)= { + /* + * Filter invalid accelerators here, to prevent obscenities + * such as "-machine accel=3Dtcg,,thread=3Dsingle". + */ + if (accel_find(*tmp)) { + qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, tru= e); + } } - ret =3D accel_init_machine(acc, current_machine); - if (ret < 0) { - init_failed =3D true; - error_report("failed to initialize %s: %s", - acc->name, strerror(-ret)); - } else { - accel_initialised =3D true; + } else { + if (accel !=3D NULL) { + error_report("The -accel and \"-machine accel=3D\" options are= incompatible"); + exit(1); } } - g_strfreev(accel_list); =20 - if (!accel_initialised) { + if (!qemu_opts_foreach(qemu_find_opts("accel"), + do_configure_accelerator, &init_failed, &error_= fatal)) { if (!init_failed) { - error_report("-machine accel=3D%s: No accelerator found", acce= l); + error_report("no accelerator found"); } exit(1); } =20 if (init_failed) { - error_report("Back to %s accelerator", acc->name); + AccelClass *ac =3D ACCEL_GET_CLASS(current_machine->accelerator); + error_report("Back to %s accelerator", ac->name); } =20 - qemu_opts_foreach(qemu_find_opts("accel"), - do_configure_accelerator, NULL, &error_fatal); - if (use_icount && !(tcg_enabled() || qtest_enabled())) { error_report("-icount is not allowed with hardware virtualization"= ); exit(1); @@ -3461,9 +3479,6 @@ int main(int argc, char **argv, char **envp) "use -M accel=3D... for now instead"); exit(1); } - opts =3D qemu_opts_create(qemu_find_opts("machine"), NULL, - false, &error_abort); - qemu_opt_set(opts, "accel", optarg, &error_abort); break; case QEMU_OPTION_usb: olist =3D qemu_find_opts("machine"); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671979; cv=none; d=zohomail.com; s=zohoarc; b=QFGk7oLxkphnGpzbqThH7+f+Dzy9nMGpC2bXkRq+7h1wfDQhy6gqAvHFNQS+6UVmmaaulftp3AoRDSbFxZ2lRd/bzF9LM1RNoWA+aIKyT1FubpvmMpqkVUbcOKqCNbS9KnzKbpQ9OQamrX78/n58STIj4ytc9qe6G4kRrkKG2BQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671979; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=NgSYMCj2GDzG+EWzpAKdPv4XL0MvO6XGircBD2DIF5Y=; b=CsBiR0JUXpPhstRqUTbJ3dXhEQvlTCBysTwbrncjJfZR/aWK+GO1jmmq7H7IyqtGOfvazFNAFQR/8vbM2QD5MAp+COh5vtJTF6hJYcPamypeQyk+GPrjOoZETsHBLmTTebly93Wvj7uzHDmWdcKnO3QSK+bFH7h3239bQQSqI3s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671979940576.8149641200428; Wed, 18 Dec 2019 04:26:19 -0800 (PST) Received: from localhost ([::1]:53436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYPC-00042A-5a for importer@patchew.org; Wed, 18 Dec 2019 07:26:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47216) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2z-0006F5-Ut for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2x-0000M9-Li for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:21 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:35343) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2v-0000K1-Qx for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:18 -0500 Received: by mail-wr1-x442.google.com with SMTP id g17so2022260wro.2 for ; Wed, 18 Dec 2019 04:03:16 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:14 -0800 (PST) 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=NgSYMCj2GDzG+EWzpAKdPv4XL0MvO6XGircBD2DIF5Y=; b=cZJY/7unMYQxW9mRq0zUV5e7jAbV7Jy/akC+s2T+Gv1w9Iia9NaI1PjMJEq8Jmb93f UBpkISjnjh4ZRkcxgliUzeRWjK4FMA5vlFglOk8qqWesKzLCNrZF46l07PgvaG7sZeKu quI3PlXG7X0su2vW72NRENLrr7OA3tJVsRXjcVJjlV6CaaRsv3lmLKxst9bVj4DUnq0T jVsrtpMz6w20ddKE0elLAVc1BLmQk0yVxuEKtVkhqY7vMEkV+8Rh5KmTineNA4YA86px /KdmA6+8kBbGv0vvSz4W5clQJBnh0NyNEUSezgRWWiPG52d6dc5h9lUYohfcub5rOt/N jHcg== 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=NgSYMCj2GDzG+EWzpAKdPv4XL0MvO6XGircBD2DIF5Y=; b=lUXaPmjxka4/Or5b7Yp+baAQe2bYqPICZAqSgdWPJJDVqzIaODyu9chjBb1V3I+hbj qu0wcWfBHLxiDoDv3ORiJn59npCJZIILP0p2cmbGFkp2IjUar8bRBfQ9VefOnOZk9mSd x93FbWzPWigIMWtz2QNCl+5PGffBvA9L3CF+SJFag1uuXpdwFCzMYk1lK7fMnnRDWaSx /Z9m9Ix3K11WNDHxBwMEVJIT46iKLjPWMqC9g69z+Z0/mvm2BSLvHtWq2wPmd5sgr66J qi54ZbcLG4ZzesBVZJ1Gt42ndGD7ZNrXGIQY/S5jAulEwo/ZX0SGLa5mnd/50VLFNzXx mnPg== X-Gm-Message-State: APjAAAVRjsDq57TtwLbdif6oXeRK8o3nXMxxb860d2dDHXWFouGtnVV/ LGQk3Lsz8Xy36Xux7TA86hWjuLTa X-Google-Smtp-Source: APXvYqwJxZ8/AKZUnptbkHw+mmpvF0PrLWhkD5Rvzl7EgRHVQSqR7jK4IOxonpis5HrlzmnFXH8nOg== X-Received: by 2002:a5d:4045:: with SMTP id w5mr2302015wrp.59.1576670595285; Wed, 18 Dec 2019 04:03:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/87] vl: warn for unavailable accelerators, clarify messages Date: Wed, 18 Dec 2019 13:01:46 +0100 Message-Id: <1576670573-48048-21-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) So far, specifying an accelerator that was not compiled in did not result in an error; fix that. While at it, clarify the mysterious "Back to TCG" message. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- vl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vl.c b/vl.c index 0f620be..c350eef 100644 --- a/vl.c +++ b/vl.c @@ -2723,6 +2723,8 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) int ret; =20 if (!ac) { + *p_init_failed =3D true; + error_report("invalid accelerator %s", acc); return 0; } ret =3D accel_init_machine(ac, current_machine); @@ -2777,6 +2779,9 @@ static void configure_accelerators(const char *progna= me) */ if (accel_find(*tmp)) { qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, tru= e); + } else { + init_failed =3D true; + error_report("invalid accelerator %s", *tmp); } } } else { @@ -2796,7 +2801,7 @@ static void configure_accelerators(const char *progna= me) =20 if (init_failed) { AccelClass *ac =3D ACCEL_GET_CLASS(current_machine->accelerator); - error_report("Back to %s accelerator", ac->name); + error_report("falling back to %s", ac->name); } =20 if (use_icount && !(tcg_enabled() || qtest_enabled())) { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671828; cv=none; d=zohomail.com; s=zohoarc; b=hxx3RdjGLXSVNWu3aiJFTve5XiGdJ7L7wvMB9nNBFmNikGiqpr9HWVz6dYp5BW887ixF+1Ap4nAObpsZet7vfcnM02FbYVaZ3OyXkVodSYitPfmClorzgph8cSfm3jGoFJ313GsXbw+6QLKJlVnB/mJgilnUcS7Rchm3gCybSts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671828; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=O2k/K3Tg/TtNp6VLEfh3O4q9xXs1rgDoImCIOl/OQ3M=; b=ceqQ+x2/J+UUywMP0/n5WSJSRlYf+et2He2PLnzYyDLyJ8l2vnED6F9eCa3jIM0qTrLgYl8wbgpaH83THg6co95bOvsq6kBGRB5jEYpS0oK2mx95fK9x6E0jlLRf3YBr3Y75rY+KQA0d+Y/BF5cIIxYqUuc5Q9JE2CgJp16TV24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671828643206.86445774789672; Wed, 18 Dec 2019 04:23:48 -0800 (PST) Received: from localhost ([::1]:53398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYMk-0000E8-Pg for importer@patchew.org; Wed, 18 Dec 2019 07:23:46 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47208) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2z-0006F4-Ts for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2x-0000M4-LT for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:21 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:37760) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2w-0000Ks-Oa for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:19 -0500 Received: by mail-wm1-x32e.google.com with SMTP id f129so1610322wmf.2 for ; Wed, 18 Dec 2019 04:03:18 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:15 -0800 (PST) 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=O2k/K3Tg/TtNp6VLEfh3O4q9xXs1rgDoImCIOl/OQ3M=; b=GQtHMx4HVC6KY3ksnD5vi92QIUeninhKkamP7hk6g8Ow7mEof4HwdRMwCAIW8QSjYA nDCA3Vy/mCR0b+P09apHJT9W5CDZXfkEKFJmT67K3qTuVYjG/ZVpAheYgtHEvQEoj2cC QOCqyW1yMMiZUKf42W1H+aWzTLt4BuGEJH6RE1rFyZWTEQICfLMWniIghSFKBpGz2TKy OFbrmBSbTed0PO05vReMw4ExPqn+mk3wH75/v4QeFiuY2wPb2SqHJPxpL/QRpdnXo1HO Pz6lwcKYMl5cFdWGFNroAMtWsRMDuFXXNgM/KWEht72PVgyYnjXq2uRhuo5qR4Tk/zq+ Kliw== 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=O2k/K3Tg/TtNp6VLEfh3O4q9xXs1rgDoImCIOl/OQ3M=; b=KL5pZljBopznJsJXW+9HLn08jVUSLlo5MFdWYE9Z2kOz2dOg6pj+ElZuAcuIdehSTq vFFRKiFk8ASlwf3fivisOTcWFFjl5Z6Bazd7z1sMZXyh5Mk43YMAhnXC7eEKQGubFSV0 4XUxrzWhaBEF5KXuk+RkfiU/U5voQspeRiXqDCZrQzWQeMet+Xk5LnCHCYb9RXKxK9Gy S2XaBpvYjLomSynZdEi0CL0neXxiofBN2rZXD0nbuglPtS2WMm/LI/WfTjAIEMLzfD8d J/DWLctWB97h1HI1273sAFmi4afnZLkoc8Kdx8QoV1spBPuZGOtZJXvP5yzmGeMIFa6T fK+g== X-Gm-Message-State: APjAAAVSjvVBA6tUWF84KjqSiy8dHGIUDC1lFwofOXA68sloPVA2Oh6j HftBxZtkQZeMVhe3vV++GD5rYziW X-Google-Smtp-Source: APXvYqzpOx3BS8qljdA/RoYWSMM7/Ek7x94MaexAS0yrGnT1J6UJZ3PFD75e3trpfzrPCS8SVCJa2w== X-Received: by 2002:a1c:bbc3:: with SMTP id l186mr2865186wmf.101.1576670596528; Wed, 18 Dec 2019 04:03:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 21/87] qom: introduce object_register_sugar_prop Date: Wed, 18 Dec 2019 13:01:47 +0100 Message-Id: <1576670573-48048-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Similar to the existing "-rtc driftfix" option, we will convert some legacy "-machine" command line options to global properties on accelerators. Because accelerators are not devices, we cannot use qdev_prop_register_glob= al. Instead, provide a slot in the generic object_compat_props arrays for command line syntactic sugar. Signed-off-by: Paolo Bonzini --- include/qom/object.h | 1 + qom/object.c | 23 +++++++++++++++++++++-- vl.c | 10 +++------- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 128d00c..230b18f 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -679,6 +679,7 @@ void object_apply_global_props(Object *obj, const GPtrA= rray *props, Error **errp); void object_set_machine_compat_props(GPtrArray *compat_props); void object_set_accelerator_compat_props(GPtrArray *compat_props); +void object_register_sugar_prop(const char *driver, const char *prop, cons= t char *value); void object_apply_compat_props(Object *obj); =20 /** diff --git a/qom/object.c b/qom/object.c index d51b57f..e7b72f7 100644 --- a/qom/object.c +++ b/qom/object.c @@ -414,10 +414,29 @@ void object_apply_global_props(Object *obj, const GPt= rArray *props, Error **errp * Global property defaults * Slot 0: accelerator's global property defaults * Slot 1: machine's global property defaults + * Slot 2: global properties from legacy command line option * Each is a GPtrArray of of GlobalProperty. * Applied in order, later entries override earlier ones. */ -static GPtrArray *object_compat_props[2]; +static GPtrArray *object_compat_props[3]; + +/* + * Retrieve @GPtrArray for global property defined with options + * other than "-global". These are generally used for syntactic + * sugar and legacy command line options. + */ +void object_register_sugar_prop(const char *driver, const char *prop, cons= t char *value) +{ + GlobalProperty *g; + if (!object_compat_props[2]) { + object_compat_props[2] =3D g_ptr_array_new(); + } + g =3D g_new0(GlobalProperty, 1); + g->driver =3D g_strdup(driver); + g->property =3D g_strdup(prop); + g->value =3D g_strdup(value); + g_ptr_array_add(object_compat_props[2], g); +} =20 /* * Set machine's global property defaults to @compat_props. @@ -445,7 +464,7 @@ void object_apply_compat_props(Object *obj) =20 for (i =3D 0; i < ARRAY_SIZE(object_compat_props); i++) { object_apply_global_props(obj, object_compat_props[i], - &error_abort); + i =3D=3D 2 ? &error_fatal : &error_abort= ); } } =20 diff --git a/vl.c b/vl.c index c350eef..b95c161 100644 --- a/vl.c +++ b/vl.c @@ -895,13 +895,9 @@ static void configure_rtc(QemuOpts *opts) value =3D qemu_opt_get(opts, "driftfix"); if (value) { if (!strcmp(value, "slew")) { - static GlobalProperty slew_lost_ticks =3D { - .driver =3D "mc146818rtc", - .property =3D "lost_tick_policy", - .value =3D "slew", - }; - - qdev_prop_register_global(&slew_lost_ticks); + object_register_sugar_prop("mc146818rtc", + "lost_tick_policy", + "slew"); } else if (!strcmp(value, "none")) { /* discard is default */ } else { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671173; cv=none; d=zohomail.com; s=zohoarc; b=m/APdhJ/fRmBiTQuhRFWEDQAc7fgm4czt8HJM8uxTHuWd99cq571OE57KlRHVer7B/OaY9vNMGtjGXma50NskL/iGa/WuLD7T1YVsf6GdquUlKKuDtdVQylCS84IljzVG1GfwlFNeMzkmKqTlNYvTFYemdL4N4hbFZMVYQ/u7iI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671173; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3WRnncE6Xv1vFi9oT2WvIobLxUM3RsPPFBEVRSOhGZo=; b=gdB3WNvh1YzzAEYSL2bm5GCSgrs6/2NverEs9sLDnHrznFxZfZnCyoIBY1kosDva0NnSKtEpD/4aZCrcWqCeIq2ushy4mfmaCdnGhtLgoU4AI54zHUJ9pvHMnV9MlsEEF/zGKAuxEFtbrj8PCKp4z0NoKFIAtPsHD8bq/tVock8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671173563907.7603136629411; Wed, 18 Dec 2019 04:12:53 -0800 (PST) Received: from localhost ([::1]:53272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYCB-0002Us-Un for importer@patchew.org; Wed, 18 Dec 2019 07:12:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47222) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2z-0006F6-VJ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2x-0000N8-Pr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:21 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:36348) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2x-0000L2-97 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:19 -0500 Received: by mail-wm1-x330.google.com with SMTP id p17so1618462wma.1 for ; Wed, 18 Dec 2019 04:03:18 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:16 -0800 (PST) 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=3WRnncE6Xv1vFi9oT2WvIobLxUM3RsPPFBEVRSOhGZo=; b=q+21bkDe8EJfA6/igHJN7CBs+7C3RTaJ0sUHdUQTdAWHiLYj2WJ6KRKPLCmofRkYc4 OlRunhh2rsfryzbiM63RYtgN/yfT+rksRhBOfpf7d1lS1vW9MxsmoJgapEvq4Z3utevU 3wO69bv5zMNxN4NYskYbyl7xcPGgt6wlsXvBGzf76r6rurZTXrtLN9tdyM1j8TIqVQJX SmD3pijYsdEaiaVbgH2L6hJgJiZBbc7wXmVUMvDRngN/u0gj5gYrZ05y8QQxxiMgycyj h4eG4sAMv6I+rX1rihODWK6UydhAPbTtzL65/d9k5EyQ0kvgL3yDgsA/WGEjtMpyBjvf vVTw== 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=3WRnncE6Xv1vFi9oT2WvIobLxUM3RsPPFBEVRSOhGZo=; b=O24xtFT0OCE3CMKBIbP/s0hZfQHORxV+iPJJLhL/X/CBZnVX/emZv8cerL2RAmubHK 6wQ09BVwPHjLni733cVFMqHuibJ+aGIPQSv2mVr7DqzByTskJtP+uWRHnpBVK+UKl93q h8FcvLz9H0bJdhsuDBqKdLStVR+N5P5ndvwCmzM8oFVCRxM/epHWaDYZkrY/+Cjk/2jm PyBfwAUNIflFf4fmkoKMdqvojymF/KLo2uUAsPIwsQP+KmuPuCZ3rXy2rxladaAR5VdK bnBM0mLAEUlKl5X8x/af3lGzegh6mGNOZa2FNAZ202htlNhCGqxrOjq4GrOTN5Tjxs4c OrDQ== X-Gm-Message-State: APjAAAX14f1/UD17SSbXuC1sZWZPjup1hFnAnpYUoxhANKgsqxN+8EDb qMvLAodYBBWXgSAZYUAXV4kYI4eF X-Google-Smtp-Source: APXvYqy3FS1RxeLcAhiZNgia8I5FX+tB821vn1Fp0BDEaMtmesmHoDujwuAaC+3CQmESZMPVdbvAOQ== X-Received: by 2002:a7b:c851:: with SMTP id c17mr2941339wml.71.1576670597336; Wed, 18 Dec 2019 04:03:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 22/87] qom: add object_new_with_class Date: Wed, 18 Dec 2019 13:01:48 +0100 Message-Id: <1576670573-48048-23-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::330 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Similar to CPU and machine classes, "-accel" class names are mangled, so we have to first get a class via accel_find and then instantiate it. Provide a new function to instantiate a class without going through object_class_get_name, and use it for CPUs and machines already. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- accel/accel.c | 4 +--- include/qom/object.h | 12 ++++++++++++ qom/object.c | 5 +++++ target/i386/cpu.c | 8 ++++---- target/s390x/cpu_models.c | 4 ++-- vl.c | 3 +-- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index 60c3827..dd38a46 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -48,9 +48,7 @@ AccelClass *accel_find(const char *opt_name) =20 int accel_init_machine(AccelClass *acc, MachineState *ms) { - ObjectClass *oc =3D OBJECT_CLASS(acc); - const char *cname =3D object_class_get_name(oc); - AccelState *accel =3D ACCEL(object_new(cname)); + AccelState *accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(acc))); int ret; ms->accelerator =3D accel; *(acc->allowed) =3D true; diff --git a/include/qom/object.h b/include/qom/object.h index 230b18f..f9ad692 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -593,6 +593,18 @@ struct InterfaceClass __FILE__, __LINE__, __func__)) =20 /** + * object_new_with_class: + * @klass: The class to instantiate. + * + * This function will initialize a new object using heap allocated memory. + * The returned object has a reference count of 1, and will be freed when + * the last reference is dropped. + * + * Returns: The newly allocated and instantiated object. + */ +Object *object_new_with_class(ObjectClass *klass); + +/** * object_new: * @typename: The name of the type of the object to instantiate. * diff --git a/qom/object.c b/qom/object.c index e7b72f7..0d971ca 100644 --- a/qom/object.c +++ b/qom/object.c @@ -658,6 +658,11 @@ static Object *object_new_with_type(Type type) return obj; } =20 +Object *object_new_with_class(ObjectClass *klass) +{ + return object_new_with_type(klass->type); +} + Object *object_new(const char *typename) { TypeImpl *ti =3D type_get_by_name(typename); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 0a9ac65..e1eb9f4 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4695,7 +4695,7 @@ static void x86_cpu_class_check_missing_features(X86C= PUClass *xcc, return; } =20 - xc =3D X86_CPU(object_new(object_class_get_name(OBJECT_CLASS(xcc)))); + xc =3D X86_CPU(object_new_with_class(OBJECT_CLASS(xcc))); =20 x86_cpu_expand_features(xc, &err); if (err) { @@ -4763,7 +4763,7 @@ static GSList *get_sorted_cpu_model_list(void) =20 static char *x86_cpu_class_get_model_id(X86CPUClass *xc) { - Object *obj =3D object_new(object_class_get_name(OBJECT_CLASS(xc))); + Object *obj =3D object_new_with_class(OBJECT_CLASS(xc)); char *r =3D object_property_get_str(obj, "model-id", &error_abort); object_unref(obj); return r; @@ -5141,7 +5141,7 @@ static X86CPU *x86_cpu_from_model(const char *model, = QDict *props, Error **errp) goto out; } =20 - xc =3D X86_CPU(object_new(object_class_get_name(OBJECT_CLASS(xcc)))); + xc =3D X86_CPU(object_new_with_class(OBJECT_CLASS(xcc))); if (props) { object_apply_props(OBJECT(xc), props, &err); if (err) { @@ -5983,7 +5983,7 @@ static void x86_cpu_apic_create(X86CPU *cpu, Error **= errp) APICCommonState *apic; ObjectClass *apic_class =3D OBJECT_CLASS(apic_get_class()); =20 - cpu->apic_state =3D DEVICE(object_new(object_class_get_name(apic_class= ))); + cpu->apic_state =3D DEVICE(object_new_with_class(apic_class)); =20 object_property_add_child(OBJECT(cpu), "lapic", OBJECT(cpu->apic_state), &error_abort); diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 547bab8..7c32180 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -440,7 +440,7 @@ static void create_cpu_model_list(ObjectClass *klass, v= oid *opaque) if (cpu_list_data->model) { Object *obj; S390CPU *sc; - obj =3D object_new(object_class_get_name(klass)); + obj =3D object_new_with_class(klass); sc =3D S390_CPU(obj); if (sc->model) { info->has_unavailable_features =3D true; @@ -498,7 +498,7 @@ static void cpu_model_from_info(S390CPUModel *model, co= nst CpuModelInfo *info, error_setg(errp, "The CPU definition '%s' requires KVM", info->nam= e); return; } - obj =3D object_new(object_class_get_name(oc)); + obj =3D object_new_with_class(oc); cpu =3D S390_CPU(obj); =20 if (!cpu->model) { diff --git a/vl.c b/vl.c index b95c161..65e6b75 100644 --- a/vl.c +++ b/vl.c @@ -3834,8 +3834,7 @@ int main(int argc, char **argv, char **envp) cleanup_add_fd, NULL, &error_fatal); #endif =20 - current_machine =3D MACHINE(object_new(object_class_get_name( - OBJECT_CLASS(machine_class)))); + current_machine =3D MACHINE(object_new_with_class(OBJECT_CLASS(machine= _class))); if (machine_help_func(qemu_get_machine_opts(), current_machine)) { exit(0); } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671336; cv=none; d=zohomail.com; s=zohoarc; b=kXQpGrzI+JzGO4hfrXMU9xUrXUAcbqM8QxdnUamuLdMgwgWGQXK4ptV2JziXX8NPEjoC+rNrEjmIOiQ9mzSvkPnrCS82cIxTR2r834g6i+0AGr1f50E7KDj8wpsjfIvAlV1TUtUiHdK9/nvQQtwS5KnOf+qQF0ee/7FJMxn5Wrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671336; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=68N7S2GMWXB6Wxfq+Q7vQW0ttC/7iAxjGXgUq3dx0c4=; b=l/RYDCq4zSryCZXWK1WladKWXthUh2vQmlNxJKq3h5Rqi0g4szV9TD/KaZCUd1fi4b+0Fjg2q8awxDDO4Rp6/FrCnbO0nX1b9G75JcS+zOnv8lGQkkfM6inoAHyIBSk4uVs7AMrbY+YnytHIaa25PtlX71qvbkS9qiSaayXiEMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671336158915.2803097532311; Wed, 18 Dec 2019 04:15:36 -0800 (PST) Received: from localhost ([::1]:53294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYEo-00065S-33 for importer@patchew.org; Wed, 18 Dec 2019 07:15:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47200) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY2z-0006F3-Tg for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2x-0000Ot-WB for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:21 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:50297) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2x-0000LV-Lu for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:19 -0500 Received: by mail-wm1-x334.google.com with SMTP id a5so1561974wmb.0 for ; Wed, 18 Dec 2019 04:03:19 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:17 -0800 (PST) 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=68N7S2GMWXB6Wxfq+Q7vQW0ttC/7iAxjGXgUq3dx0c4=; b=eCRZDY7v49kCODUceKl1GPUf1+RP/6J6WZUaJEEklcJn2DbVAbNCaZXxptQVY/7Irb +jvtGwbV3MJmCWJ4oOV/krEmr+zcuCH9fhn/XulNT9TiMGnTDrZ+Xa8dEV58AHsUfR/T ErQ867xmBJf0h2yNWXoqVJ+tpTSgW0SRGnld+u13qZoWFlCTLEd1HtWBcqZbG26yAlYp bXDOGPNQ0VCLlwYNi2XM+3utmaCX/ubOfH4L2pcpAOryHVwxvJamMY6fH1oJQMgJJrdo fVlWc7iwV61GKTSZVG40IrWAG9hpO5LVszVsDBO+I9k/iQQtNgEz75+4E3WYYMnwaUIz 576A== 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=68N7S2GMWXB6Wxfq+Q7vQW0ttC/7iAxjGXgUq3dx0c4=; b=tsdv7BzmBUOsXiyQ9Aa/vC05h/DtD4SxXquELx6QQR2cDdLlbrAS+CYV1bddzcd25f Q1yiSqbYO7145XMJQkh6qc/sDa+wAkx1K+ve/AFH3GK/fFcuKv22nU5DiwWpapJXHWJv cLQlM3aGWVheBGJn4pCsGH0Qk+EW8emBnnN48e3NJ09LkMjU9Cwn6OwXJUXceA/VjBXO jqDjqIDBNUNUsZURVYjegLjm2kIjarrp2BVStvqAZnvVmKMM+cgppRwJlVC6SPTBQdws L8T4665vj7hn8+mAvXE+ZoHB+0n2q3p8xiDRIUqGOf8EcuVzPXE5NAGVztveuQ6s0IQ0 nVfQ== X-Gm-Message-State: APjAAAWk7sURdp/pL6XhVNkRQtzEsYDrsGGQMDTdMERYaphR4W1S4JOi 7Fj31/JvIz4sbrl30rmvLEXOwhgw X-Google-Smtp-Source: APXvYqyDnMvO7HM8FOEYLEr8FM/K6w2OOgaCFbU4gpF+fu6RoIf3cFEZl+oq4bIL7bn/JF8qn6eOwg== X-Received: by 2002:a7b:c936:: with SMTP id h22mr2723031wml.115.1576670598269; Wed, 18 Dec 2019 04:03:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 23/87] accel: pass object to accel_init_machine Date: Wed, 18 Dec 2019 13:01:49 +0100 Message-Id: <1576670573-48048-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::334 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We will have to set QOM properties before accel_init_machine, based on the options provided to -accel. Construct the object outside it so that it will be possible to iterate on properties between object_new_with_class and accel_init_machine. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- accel/accel.c | 4 ++-- include/sysemu/accel.h | 2 +- vl.c | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index dd38a46..1c5c3a6 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -46,9 +46,9 @@ AccelClass *accel_find(const char *opt_name) return ac; } =20 -int accel_init_machine(AccelClass *acc, MachineState *ms) +int accel_init_machine(AccelState *accel, MachineState *ms) { - AccelState *accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(acc))); + AccelClass *acc =3D ACCEL_GET_CLASS(accel); int ret; ms->accelerator =3D accel; *(acc->allowed) =3D true; diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 90b6213..22cac0f 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -67,7 +67,7 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; =20 AccelClass *accel_find(const char *opt_name); -int accel_init_machine(AccelClass *acc, MachineState *ms); +int accel_init_machine(AccelState *accel, MachineState *ms); =20 /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); diff --git a/vl.c b/vl.c index 65e6b75..b2f00cc 100644 --- a/vl.c +++ b/vl.c @@ -2716,6 +2716,7 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) bool *p_init_failed =3D opaque; const char *acc =3D qemu_opt_get(opts, "accel"); AccelClass *ac =3D accel_find(acc); + AccelState *accel; int ret; =20 if (!ac) { @@ -2723,7 +2724,8 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) error_report("invalid accelerator %s", acc); return 0; } - ret =3D accel_init_machine(ac, current_machine); + accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(ac))); + ret =3D accel_init_machine(accel, current_machine); if (ret < 0) { *p_init_failed =3D true; error_report("failed to initialize %s: %s", --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671524; cv=none; d=zohomail.com; s=zohoarc; b=WWLDdUJp+lrsgOeWRFWMcdQWJCJHPZNuULiyRDGm+jxcK7NpLhpl3AzOxZWG9Vhbu3UIdi9HcysN2Z6YFLMvm9YLkZtyhIbz/Zq2C9j9fLB7dCEtG1y+vhmkLwsHbtwYuHKTX9Jc/m3ZzkzT9VqSuzb0ViU4ELaFqIs4ck98M8g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671524; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oafxCydgQY02VpdhM1ynHEUTP4YLeatsAL+0uqEzaBs=; b=QRNTGpgKNfxbHBAYXkCuIMcViB4MKEUPVecQzGqO1uQ3hTytgpY5G5598XY9XEM2Sq/Uwnr/SJ/PaJuvXRKfivblEfHspavNfUEBPW5R76ND8XMiky0c7/UUu5rHo3KYOve42hE+6+ncWjuMeX/nnXnzbxXY0ppehMhLiyn0ZrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671524090951.1754698259062; Wed, 18 Dec 2019 04:18:44 -0800 (PST) Received: from localhost ([::1]:53336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYHq-0001b3-EW for importer@patchew.org; Wed, 18 Dec 2019 07:18:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47350) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY35-0006FL-M3 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY2z-0000RV-Vf for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:52331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2z-0000Nc-E6 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:21 -0500 Received: by mail-wm1-x342.google.com with SMTP id p9so1561170wmc.2 for ; Wed, 18 Dec 2019 04:03:20 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:18 -0800 (PST) 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=oafxCydgQY02VpdhM1ynHEUTP4YLeatsAL+0uqEzaBs=; b=tSb4RNaNFxFKj+9Ya45PDfb52UGb3HQCMvo6nSPQ4aFqE6bmsHFYHcMt9YufIAhlw5 m1uraC4LnNEm/oGvK4UMnd+SblUqA79za7dDMu2s4N477gHsT/JIQaCiaCJhnoEw1MLY DZGqjSKNzNMU+N8icZ2NpqU7p9Co2ElFvcBqlx5Oyiv3EJJb3MGSPoSrmLU5zALSyGzp bxNxbTsj76OiitolyBS/VknuBYJuhU31Ra5KTZc5KCmVVFGFlSL9YdzZL8AiNmE44RJA LxAuO1W3GA/ipPnLkfYduB/qDHVTdR62TcGRKpb85nks/nt0Zn6RDkUPhK+ylBmJNOB7 JEaQ== 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=oafxCydgQY02VpdhM1ynHEUTP4YLeatsAL+0uqEzaBs=; b=c+4/XcE2ozMlQzx+Ga4y0psLgjBGRR2AfD+XDNnVCQDn91etWkWe2n6BVaBeiw8pGS 50tu+jvWjD2LGU12dJkwocaVtiMkuLiqatUs7R4YwshpHppvcQycQr7H7Tt58YGk1SYi OVXMgCKa69Egcu1WFei9fUHfFY6ZBbCBUOrPkvOCLDEm5bzpJZy2OhIjBss193/18vNx Th01L6jGB+cwZWCoH9gWMR16g5BNt+YcvHDdA7VNtJDt5RvdjutRKKZXEk6WAoNJIopk vuiztSkhXQLGAfowljsoCrB3+Zuwm8eToCeNcepCk1vuoSiq/feM8r7Ak6MM0Lo5hFE2 GtGw== X-Gm-Message-State: APjAAAWecYiqg95zfAc+XuZ4WzgoX+XNyza+7ts6KExY3XEBd5qT/9SA UlByg8fIZ7eu7igLP3wYMRAjpcXx X-Google-Smtp-Source: APXvYqwbVfpAAexCDztdV/e2eu2ACZGkEjDI/AD8B6cOclL4gE2hRgK0/0CW0nILOOvkEYtJLaxpHg== X-Received: by 2002:a1c:5a0a:: with SMTP id o10mr2788652wmb.114.1576670599170; Wed, 18 Dec 2019 04:03:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 24/87] tcg: convert "-accel threads" to a QOM property Date: Wed, 18 Dec 2019 13:01:50 +0100 Message-Id: <1576670573-48048-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Replace the ad-hoc qemu_tcg_configure with generic code invoking QOM property getters and setters. More properties (and thus more valid -accel suboptions) will be added in the next patches, which will move accelerator-related "-machine" options to accelerators. Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- accel/tcg/tcg-all.c | 52 +++++++++++++++++++++++++++++++++++++----------= ---- include/sysemu/cpus.h | 2 -- vl.c | 32 ++++++++++++++++--------------- 3 files changed, 55 insertions(+), 31 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 6b000f0..7829f02 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -34,7 +34,17 @@ #include "include/qapi/error.h" #include "include/qemu/error-report.h" #include "include/hw/boards.h" -#include "qemu/option.h" + +typedef struct TCGState { + AccelState parent_obj; + + bool mttcg_enabled; +} TCGState; + +#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") + +#define TCG_STATE(obj) \ + OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL) =20 unsigned long tcg_tb_size; =20 @@ -107,23 +117,33 @@ static bool default_mttcg_enabled(void) =20 static void tcg_accel_instance_init(Object *obj) { - mttcg_enabled =3D default_mttcg_enabled(); + TCGState *s =3D TCG_STATE(obj); + + s->mttcg_enabled =3D default_mttcg_enabled(); } =20 static int tcg_init(MachineState *ms) { + TCGState *s =3D TCG_STATE(current_machine->accelerator); + tcg_exec_init(tcg_tb_size * 1024 * 1024); cpu_interrupt_handler =3D tcg_handle_interrupt; + mttcg_enabled =3D s->mttcg_enabled; return 0; } =20 -void qemu_tcg_configure(QemuOpts *opts, Error **errp) +static char *tcg_get_thread(Object *obj, Error **errp) { - const char *t =3D qemu_opt_get(opts, "thread"); - if (!t) { - return; - } - if (strcmp(t, "multi") =3D=3D 0) { + TCGState *s =3D TCG_STATE(obj); + + return g_strdup(s->mttcg_enabled ? "multi" : "single"); +} + +static void tcg_set_thread(Object *obj, const char *value, Error **errp) +{ + TCGState *s =3D TCG_STATE(obj); + + if (strcmp(value, "multi") =3D=3D 0) { if (TCG_OVERSIZED_GUEST) { error_setg(errp, "No MTTCG when guest word size > hosts"); } else if (use_icount) { @@ -138,12 +158,12 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp) "than the host provides"); error_printf("This may cause strange/hard to debug errors\= n"); } - mttcg_enabled =3D true; + s->mttcg_enabled =3D true; } - } else if (strcmp(t, "single") =3D=3D 0) { - mttcg_enabled =3D false; + } else if (strcmp(value, "single") =3D=3D 0) { + s->mttcg_enabled =3D false; } else { - error_setg(errp, "Invalid 'thread' setting %s", t); + error_setg(errp, "Invalid 'thread' setting %s", value); } } =20 @@ -153,15 +173,19 @@ static void tcg_accel_class_init(ObjectClass *oc, voi= d *data) ac->name =3D "tcg"; ac->init_machine =3D tcg_init; ac->allowed =3D &tcg_allowed; -} =20 -#define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") + object_class_property_add_str(oc, "thread", + tcg_get_thread, + tcg_set_thread, + NULL); +} =20 static const TypeInfo tcg_accel_type =3D { .name =3D TYPE_TCG_ACCEL, .parent =3D TYPE_ACCEL, .instance_init =3D tcg_accel_instance_init, .class_init =3D tcg_accel_class_init, + .instance_size =3D sizeof(TCGState), }; =20 static void register_accel_types(void) diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h index 32c05f2..3c1da6a 100644 --- a/include/sysemu/cpus.h +++ b/include/sysemu/cpus.h @@ -40,6 +40,4 @@ extern int smp_threads; =20 void list_cpus(const char *optarg); =20 -void qemu_tcg_configure(QemuOpts *opts, Error **errp); - #endif diff --git a/vl.c b/vl.c index b2f00cc..7f2f3fb 100644 --- a/vl.c +++ b/vl.c @@ -293,17 +293,12 @@ static QemuOptsList qemu_accel_opts =3D { .implied_opt_name =3D "accel", .head =3D QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head), .desc =3D { - { - .name =3D "accel", - .type =3D QEMU_OPT_STRING, - .help =3D "Select the type of accelerator", - }, - { - .name =3D "thread", - .type =3D QEMU_OPT_STRING, - .help =3D "Enable/disable multi-threaded TCG", - }, - { /* end of list */ } + /* + * no elements =3D> accept any + * sanity checking will happen later + * when setting accelerator properties + */ + { } }, }; =20 @@ -2711,6 +2706,13 @@ static int do_configure_icount(void *opaque, QemuOpt= s *opts, Error **errp) return 0; } =20 +static int accelerator_set_property(void *opaque, + const char *name, const char *value, + Error **errp) +{ + return object_parse_property_opt(opaque, name, value, "accel", errp); +} + static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **= errp) { bool *p_init_failed =3D opaque; @@ -2725,6 +2727,10 @@ static int do_configure_accelerator(void *opaque, Qe= muOpts *opts, Error **errp) return 0; } accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(ac))); + qemu_opt_foreach(opts, accelerator_set_property, + accel, + &error_fatal); + ret =3D accel_init_machine(accel, current_machine); if (ret < 0) { *p_init_failed =3D true; @@ -2732,10 +2738,6 @@ static int do_configure_accelerator(void *opaque, Qe= muOpts *opts, Error **errp) acc, strerror(-ret)); return 0; } - - if (tcg_enabled()) { - qemu_tcg_configure(opts, &error_fatal); - } return 1; } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671702; cv=none; d=zohomail.com; s=zohoarc; b=g2iiVjhnoaCY2aJe6ZGYBA8OuuQpKNhZxScuUfUNbx7wSU+uVHfneVeKJo5Q5VzR0O0hRTRDhhct08qqLOLBdi9FeeU9PcuLvLnT6wMlnsu4vjTPP34VoqwREFD9Hr4BLSKruMCzQCCawK13YV1CUhf3F7Pxd9unmOo9A4Zub5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671702; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4RMbJ1vgiB2ahPcjjY43T5z1jQHk/pVa3Mh71/KfOko=; b=ERAkP8Ydi1u7X/wlmKuGyw4jFAUPOem/zYxQffzLo+1cUNdZVwWXdcJ+eXgJHy/XPVJEzJGW3NTcTzZx17kW7LXWJDkQLwQXAs6ff1o2c19+1YCVWrynfIxOiNLGNF+ceGMl96cX9uCdm3JJvb/tbCZVoSZZCB+5ky2g9KNkgxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667170247475.52959419683259; Wed, 18 Dec 2019 04:21:42 -0800 (PST) Received: from localhost ([::1]:53374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYKj-0005Xg-0s for importer@patchew.org; Wed, 18 Dec 2019 07:21:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47550) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY37-0006Hd-Bh for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY35-0000TB-3r for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:36635) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY2z-0000QB-UR for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:22 -0500 Received: by mail-wr1-x42c.google.com with SMTP id z3so2023018wru.3 for ; Wed, 18 Dec 2019 04:03:21 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:19 -0800 (PST) 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=4RMbJ1vgiB2ahPcjjY43T5z1jQHk/pVa3Mh71/KfOko=; b=lG+0VwIScgbnXTvwj3g0j5NFtiBRuFf0EXntw6vJu9oh1f+iASjDj53KUQOBIbI3lg OUGJSvktegxjnq3CfRrd9fhc65l9zJE/aWu6BhK0Ei+Zv4KvGp3rZSMXgVH6FOCxsjRs R5NLWLu0PYCsNQSF1VOUgBpNtmr/4WZq5PRZI+DCV1TqSJLG8DE4SsM9gP49XEA5+p5G PEampx1j65U+zb+RvTxVv5/SzWRtOttg9FG1iagoQkDZ1/tbWnhyB8r4/hZE6OGK4hzx p6pVTfbXD63VKuVCkIODqAAxq9WZaUZJCELUzDvulkijOphfwsYG1A8dPyTUlsHrG05Y lajA== 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=4RMbJ1vgiB2ahPcjjY43T5z1jQHk/pVa3Mh71/KfOko=; b=njzcQ/ClX4AWK4chbZnWR7n2jdxIB2QlVcHGdJV20Oe6wVGx9RrXHaZ4dh9BSv5czu q0PE7q5fyNqbUgwTGYU9vGDtMKyERDprKMUj2G5XuHhXjD2yC2FttRFXy0PU/OYCZqKm b1SNzliCCn2ZsVfaUG2U/wBTJXwXfv0Gv9KiGiOxUPEcY+2zoUQmQRGrBrWT7iPWJ3sE jdLMLAGaa67vypJhNJfYOuI3elgEsQ0zaEn0EMITFxhvQaG731Z84mM7p0bsOP8apQ1W E5lmxgHaMk+X/tPsoorJI7uyRRgbtImFq35GsSJCwlbAJeKzrEVvdLNjhJoTtBSqcx7s HLNw== X-Gm-Message-State: APjAAAWKqFuu6JtY8QAKAmtbFMVhbOxlf9D9NdmCTyvYg8dX6AwtrN9e URyZnD/AmO15Vup61Q7Zhdt9qgnj X-Google-Smtp-Source: APXvYqx13J5jyZLllEhTNuvQMjlZTRJUNwyReVcUJ4aW3NINinwW60S5IEOUUpauU9vvK2T5rcNJLg== X-Received: by 2002:a5d:51c6:: with SMTP id n6mr2378181wrv.250.1576670600392; Wed, 18 Dec 2019 04:03:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 25/87] tcg: add "-accel tcg,tb-size" and deprecate "-tb-size" Date: Wed, 18 Dec 2019 13:01:51 +0100 Message-Id: <1576670573-48048-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" -tb-size fits nicely in the new framework for accelerator-specific options.= It is a very niche option, so insta-deprecate it. Signed-off-by: Paolo Bonzini --- accel/tcg/tcg-all.c | 40 +++++++++++++++++++++++++++++++++++++--- include/sysemu/accel.h | 2 -- qemu-deprecated.texi | 6 ++++++ qemu-options.hx | 8 ++++++-- vl.c | 8 ++++---- 5 files changed, 53 insertions(+), 11 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 7829f02..1dc384c 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -34,11 +34,13 @@ #include "include/qapi/error.h" #include "include/qemu/error-report.h" #include "include/hw/boards.h" +#include "qapi/qapi-builtin-visit.h" =20 typedef struct TCGState { AccelState parent_obj; =20 bool mttcg_enabled; + unsigned long tb_size; } TCGState; =20 #define TYPE_TCG_ACCEL ACCEL_CLASS_NAME("tcg") @@ -46,8 +48,6 @@ typedef struct TCGState { #define TCG_STATE(obj) \ OBJECT_CHECK(TCGState, (obj), TYPE_TCG_ACCEL) =20 -unsigned long tcg_tb_size; - /* mask must never be zero, except for A20 change call */ static void tcg_handle_interrupt(CPUState *cpu, int mask) { @@ -126,7 +126,7 @@ static int tcg_init(MachineState *ms) { TCGState *s =3D TCG_STATE(current_machine->accelerator); =20 - tcg_exec_init(tcg_tb_size * 1024 * 1024); + tcg_exec_init(s->tb_size * 1024 * 1024); cpu_interrupt_handler =3D tcg_handle_interrupt; mttcg_enabled =3D s->mttcg_enabled; return 0; @@ -167,6 +167,33 @@ static void tcg_set_thread(Object *obj, const char *va= lue, Error **errp) } } =20 +static void tcg_get_tb_size(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + TCGState *s =3D TCG_STATE(obj); + uint32_t value =3D s->tb_size; + + visit_type_uint32(v, name, &value, errp); +} + +static void tcg_set_tb_size(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + TCGState *s =3D TCG_STATE(obj); + Error *error =3D NULL; + uint32_t value; + + visit_type_uint32(v, name, &value, &error); + if (error) { + error_propagate(errp, error); + return; + } + + s->tb_size =3D value; +} + static void tcg_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac =3D ACCEL_CLASS(oc); @@ -178,6 +205,13 @@ static void tcg_accel_class_init(ObjectClass *oc, void= *data) tcg_get_thread, tcg_set_thread, NULL); + + object_class_property_add(oc, "tb-size", "int", + tcg_get_tb_size, tcg_set_tb_size, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, "tb-size", + "TCG translation block cache size", &error_abort); + } =20 static const TypeInfo tcg_accel_type =3D { diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 22cac0f..d4c1429 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -64,8 +64,6 @@ typedef struct AccelClass { #define ACCEL_GET_CLASS(obj) \ OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL) =20 -extern unsigned long tcg_tb_size; - AccelClass *accel_find(const char *opt_name); int accel_init_machine(AccelState *accel, MachineState *ms); =20 diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 62680f7..e88f6d1 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -142,6 +142,12 @@ QEMU 4.1 has three options, please migrate to one of t= hese three: to do is specify the kernel they want to boot with the -kernel option 3. ``-bios `` - Tells QEMU to load the specified file as the firmwr= ae. =20 +@subsection -tb-size option (since 5.0) + +QEMU 5.0 introduced an alternative syntax to specify the size of the trans= lation +block cache, @option{-accel tcg,tb-size=3D}. The new syntax deprecates the +previously available @option{-tb-size} option. + @section QEMU Machine Protocol (QMP) commands =20 @subsection change (since 2.5.0) diff --git a/qemu-options.hx b/qemu-options.hx index c63e794..ee1f676 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -118,8 +118,9 @@ Select CPU model (@code{-cpu help} for list and additio= nal feature selection) ETEXI =20 DEF("accel", HAS_ARG, QEMU_OPTION_accel, - "-accel [accel=3D]accelerator[,thread=3Dsingle|multi]\n" + "-accel [accel=3D]accelerator[,prop[=3Dvalue][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; = use 'help' for a list)\n" + " tb-size=3Dn (TCG translation block cache size)\n" " thread=3Dsingle|multi (enable multi-threaded TCG)\n",= QEMU_ARCH_ALL) STEXI @item -accel @var{name}[,prop=3D@var{value}[,...]] @@ -129,6 +130,8 @@ kvm, xen, hax, hvf, whpx or tcg can be available. By de= fault, tcg is used. If th more than one accelerator specified, the next one is used if the previous = one fails to initialize. @table @option +@item tb-size=3D@var{n} +Controls the size (in MiB) of the TCG translation block cache. @item thread=3Dsingle|multi Controls number of TCG threads. When the TCG is multi-threaded there will = be one thread per vCPU therefor taking advantage of additional host cores. The de= fault @@ -3923,7 +3926,8 @@ DEF("tb-size", HAS_ARG, QEMU_OPTION_tb_size, \ STEXI @item -tb-size @var{n} @findex -tb-size -Set TB size. +Set TCG translation block cache size. Deprecated, use @samp{-accel tcg,tb= -size=3D@var{n}} +instead. ETEXI =20 DEF("incoming", HAS_ARG, QEMU_OPTION_incoming, \ diff --git a/vl.c b/vl.c index 7f2f3fb..900f97a 100644 --- a/vl.c +++ b/vl.c @@ -2727,6 +2727,7 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) return 0; } accel =3D ACCEL(object_new_with_class(OBJECT_CLASS(ac))); + object_apply_compat_props(OBJECT(accel)); qemu_opt_foreach(opts, accelerator_set_property, accel, &error_fatal); @@ -2738,6 +2739,7 @@ static int do_configure_accelerator(void *opaque, Qem= uOpts *opts, Error **errp) acc, strerror(-ret)); return 0; } + return 1; } =20 @@ -3590,10 +3592,8 @@ int main(int argc, char **argv, char **envp) error_report("TCG is disabled"); exit(1); #endif - if (qemu_strtoul(optarg, NULL, 0, &tcg_tb_size) < 0) { - error_report("Invalid argument to -tb-size"); - exit(1); - } + warn_report("The -tb-size option is deprecated, use -accel= tcg,tb-size instead"); + object_register_sugar_prop(ACCEL_CLASS_NAME("tcg"), "tb-si= ze", optarg); break; case QEMU_OPTION_icount: icount_opts =3D qemu_opts_parse_noisily(qemu_find_opts("ic= ount"), --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671272; cv=none; d=zohomail.com; s=zohoarc; b=N672XKvVWveMbz91kjGZaP3QWtv1NusJD0yhqk/lhqo8kme2mP+FnBPOM2xOqIHSc8uvyhvzCt/M4/5OHSOgQ6CpPQCkxVKOfi3BKxNUlbbgsgwmgmUgwBTbIBqtn6Ado7yt0APG3LpY3GGHUcG3kNvP+c029BkQhC8hr+GY7E8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671272; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qHzAYil75oWgqUim8nsgFtlMQDggWDpdj4zdhH7uJus=; b=YJjQppyrNa4ppxk4D7aLLzm5PrCgcr8wfkksNiaESUTUcX9CNFZfNSn43We3Ba62VRl/YnXzw4bcIRFvMM8J+U2w1YlJLv7kSIZQO1H+2SED/SEVX0Ty4TCDJS54ddFcrO6MgqkO9+DGhBM/P59DBx3ryTXEoKxwUzOQIBNLM9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671272693879.0742252273199; Wed, 18 Dec 2019 04:14:32 -0800 (PST) Received: from localhost ([::1]:53288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYDn-0004hv-77 for importer@patchew.org; Wed, 18 Dec 2019 07:14:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47701) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006Ij-3z for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY35-0000UK-SR for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:42111) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000S2-4b for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: by mail-wr1-x442.google.com with SMTP id q6so1979344wro.9 for ; Wed, 18 Dec 2019 04:03:22 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:20 -0800 (PST) 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=qHzAYil75oWgqUim8nsgFtlMQDggWDpdj4zdhH7uJus=; b=AfwqlyMePoFrXnYTXAao1184Gfqx9QXeSDYt0iZVA3f4JnTa2aCADz9195135gptbp CxnzdtxR9tfynaMgcvdyDTWVxGvBw3un+TRamLKaqDfc01hQQz3CV/UK4OZgMnCowTT7 hBFdl5tKw6yxLHCOfZGTJcySvALWiFa1t5w8D8ixpfRXlaJ9FFdlNoKVDNpoDvgZVl9i yA36IGQSvg7OY4aqgK5pCTuLv3uoFNTx9eNtAsl6eUkBiWAWUHzsVRqWi7gjWp2673lt Q2h9j6ORBucWQmvQ3h2LDjW6ebgY6EtlMRPE8DgA/500W2SUmWGS3m49g4ZMQoEr5glA g7EA== 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=qHzAYil75oWgqUim8nsgFtlMQDggWDpdj4zdhH7uJus=; b=iDSznrG+t6B/KzLaxUVIPKlpjyt0dNrEDXtzi1oabXWg+nCO1Vm9zfKtKejVdBVYdp h5+TiB4Cdt2nZxa5+Q9QHcyRb5oPeeK78jZgo7itI723LK6X1MhsulaZCysqcsV7De6r wkWgFMs9LL9xsqdQgo9DmYplUQkm0YbfHPLG+CbW72EoLFGm2mM6MFSNswcHpKk+gVax qihy4V9iw3gjcVpRAaKIYM4MTdiSltwrR31gDrd1UyTXov2IKkv5jzOsW2zOtVMijmj3 GeprAC+Jik/crYxtJ+pQdh+iEjlQX3HrY9Mxt7WXpALsWNsce2TuGuGMPzSxQiOQ716E 5zwQ== X-Gm-Message-State: APjAAAV9up282XW6yx89IJ0rxbOx4HQvu9EXCv9GfUcpXZSbq6P+MIus IN7El/zoIeuVCVuDFMv1xOHJPGCD X-Google-Smtp-Source: APXvYqzaKKYv15lcGA9UB6z/A+2hptCrImiWFa2PXvjW1SN6deL1S/uI7ODw5jGwQTc6z99kg/+1uQ== X-Received: by 2002:a5d:410e:: with SMTP id l14mr2413681wrp.238.1576670601352; Wed, 18 Dec 2019 04:03:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 26/87] xen: convert "-machine igd-passthru" to an accelerator property Date: Wed, 18 Dec 2019 13:01:52 +0100 Message-Id: <1576670573-48048-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The first machine property to fall is Xen's Intel integrated graphics passthrough. The "-machine igd-passthru" option does not set anymore a property on the machine object, but desugars to a GlobalProperty on accelerator objects. The setter is very simple, since the value ends up in a global variable, so this patch also provides an example before the more complicated cases that follow it. Signed-off-by: Paolo Bonzini --- hw/core/machine.c | 20 -------------------- hw/xen/xen-common.c | 18 ++++++++++++++++++ hw/xen/xen_pt.c | 2 ++ include/hw/boards.h | 1 - qemu-options.hx | 7 ++++--- vl.c | 14 ++++---------- 6 files changed, 28 insertions(+), 34 deletions(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index e661fa6..05cea3a 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -417,20 +417,6 @@ static void machine_set_graphics(Object *obj, bool val= ue, Error **errp) ms->enable_graphics =3D value; } =20 -static bool machine_get_igd_gfx_passthru(Object *obj, Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - - return ms->igd_gfx_passthru; -} - -static void machine_set_igd_gfx_passthru(Object *obj, bool value, Error **= errp) -{ - MachineState *ms =3D MACHINE(obj); - - ms->igd_gfx_passthru =3D value; -} - static char *machine_get_firmware(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -867,12 +853,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) object_class_property_set_description(oc, "graphics", "Set on/off to enable/disable graphics emulation", &error_abort); =20 - object_class_property_add_bool(oc, "igd-passthru", - machine_get_igd_gfx_passthru, machine_set_igd_gfx_passthru, - &error_abort); - object_class_property_set_description(oc, "igd-passthru", - "Set on/off to enable/disable igd passthrou", &error_abort); - object_class_property_add_str(oc, "firmware", machine_get_firmware, machine_set_firmware, &error_abort); diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c index 5284b0d..15650d7 100644 --- a/hw/xen/xen-common.c +++ b/hw/xen/xen-common.c @@ -11,7 +11,9 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qapi/error.h" #include "hw/xen/xen-legacy-backend.h" +#include "hw/xen/xen_pt.h" #include "chardev/char.h" #include "sysemu/accel.h" #include "sysemu/runstate.h" @@ -124,6 +126,16 @@ static void xen_change_state_handler(void *opaque, int= running, } } =20 +static bool xen_get_igd_gfx_passthru(Object *obj, Error **errp) +{ + return has_igd_gfx_passthru; +} + +static void xen_set_igd_gfx_passthru(Object *obj, bool value, Error **errp) +{ + has_igd_gfx_passthru =3D value; +} + static void xen_setup_post(MachineState *ms, AccelState *accel) { int rc; @@ -177,6 +189,12 @@ static void xen_accel_class_init(ObjectClass *oc, void= *data) ac->compat_props =3D g_ptr_array_new(); =20 compat_props_add(ac->compat_props, compat, G_N_ELEMENTS(compat)); + + object_class_property_add_bool(oc, "igd-passthru", + xen_get_igd_gfx_passthru, xen_set_igd_gfx_passthru, + &error_abort); + object_class_property_set_description(oc, "igd-passthru", + "Set on/off to enable/disable igd passthrou", &error_abort); } =20 #define TYPE_XEN_ACCEL ACCEL_CLASS_NAME("xen") diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 8fbaf2e..9e767d4 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -65,6 +65,8 @@ #include "qemu/range.h" #include "exec/address-spaces.h" =20 +bool has_igd_gfx_passthru; + #define XEN_PT_NR_IRQS (256) static uint8_t xen_pt_mapped_machine_irq[XEN_PT_NR_IRQS] =3D {0}; =20 diff --git a/include/hw/boards.h b/include/hw/boards.h index 96f2084..5025c1a 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -287,7 +287,6 @@ struct MachineState { bool mem_merge; bool usb; bool usb_disabled; - bool igd_gfx_passthru; char *firmware; bool iommu; bool suppress_vmdesc; diff --git a/qemu-options.hx b/qemu-options.hx index ee1f676..1535390 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -37,7 +37,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " kvm_shadow_mem=3Dsize of KVM shadow MMU in bytes\n" " dump-guest-core=3Don|off include guest memory in a co= re dump (default=3Don)\n" " mem-merge=3Don|off controls memory merge support (def= ault: on)\n" - " igd-passthru=3Don|off controls IGD GFX passthrough su= pport (default=3Doff)\n" " aes-key-wrap=3Don|off controls support for AES key wr= apping (default=3Don)\n" " dea-key-wrap=3Don|off controls support for DEA key wr= apping (default=3Don)\n" " suppress-vmdesc=3Don|off disables self-describing mig= ration (default=3Doff)\n" @@ -71,8 +70,6 @@ more than one accelerator specified, the next one is used= if the previous one fails to initialize. @item kernel_irqchip=3Don|off Controls in-kernel irqchip support for the chosen accelerator when availab= le. -@item gfx_passthru=3Don|off -Enables IGD GFX passthrough support for the chosen machine when available. @item vmport=3Don|off|auto Enables emulation of VMWare IO port, for vmmouse etc. auto says to select = the value based on accel. For accel=3Dxen the default is off otherwise the def= ault @@ -120,6 +117,7 @@ ETEXI DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=3D]accelerator[,prop[=3Dvalue][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; = use 'help' for a list)\n" + " igd-passthru=3Don|off (enable Xen integrated Intel gr= aphics passthrough, default=3Doff)\n" " tb-size=3Dn (TCG translation block cache size)\n" " thread=3Dsingle|multi (enable multi-threaded TCG)\n",= QEMU_ARCH_ALL) STEXI @@ -130,6 +128,9 @@ kvm, xen, hax, hvf, whpx or tcg can be available. By de= fault, tcg is used. If th more than one accelerator specified, the next one is used if the previous = one fails to initialize. @table @option +@item igd-passthru=3Don|off +When Xen is in use, this option controls whether Intel integrated graphics +devices can be passed through to the guest (default=3Doff) @item tb-size=3D@var{n} Controls the size (in MiB) of the TCG translation block cache. @item thread=3Dsingle|multi diff --git a/vl.c b/vl.c index 900f97a..774305c 100644 --- a/vl.c +++ b/vl.c @@ -1133,13 +1133,6 @@ static void configure_msg(QemuOpts *opts) } =20 =20 -/* Now we still need this for compatibility with XEN. */ -bool has_igd_gfx_passthru; -static void igd_gfx_passthru(void) -{ - has_igd_gfx_passthru =3D current_machine->igd_gfx_passthru; -} - /***********************************************************/ /* USB devices */ =20 @@ -2517,6 +2510,10 @@ static int machine_set_property(void *opaque, if (g_str_equal(qom_name, "accel")) { return 0; } + if (g_str_equal(qom_name, "igd-passthru")) { + object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, valu= e); + return 0; + } =20 return object_parse_property_opt(opaque, name, value, "type", errp); } @@ -4297,9 +4294,6 @@ int main(int argc, char **argv, char **envp) exit(1); } =20 - /* Check if IGD GFX passthrough. */ - igd_gfx_passthru(); - /* init generic devices */ rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE); qemu_opts_foreach(qemu_find_opts("device"), --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671841; cv=none; d=zohomail.com; s=zohoarc; b=n7G7GkpVtN4TH3P5LZYy7oUf8i4wHD/JxA/bD1cvay4QhHnKbdfN5FzDHFxd6fEu3AjXz7QLx949wOxs/ORMYC8Eu6EcqBn8WqOu066aB+9ImSdiAgK4zAl7NwclL7MfrQuZndt8b5iV4OvmdVUbBiVRwKTbiWyPNa3jRZ+8fGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671841; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=fy+B/TRcCsC3WIuPseL3Gdys+E0bj/B1JxAW2ZkWrwk=; b=Wc3RYkWqyzz8WXHQ4tURtGKfQUUQUexqPrmPygsVv2RCMQgFWacxsnZSvxuUYd+zIQBfhRWXKtQGmzk0l3txW8oewplkjJ23LgbBja2K7U7tCC47oQzjLhR6wWd0q3c6qyjDnzj2uqOeuFcVXiOa5UoW4e2FhBuJXVVF1s2s6lY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671841226191.12755755068326; Wed, 18 Dec 2019 04:24:01 -0800 (PST) Received: from localhost ([::1]:53400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYMx-0000cP-El for importer@patchew.org; Wed, 18 Dec 2019 07:23:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47774) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006J9-HQ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY36-0000Ux-3v for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:41745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000Sh-Lf for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: by mail-wr1-x42c.google.com with SMTP id c9so1999185wrw.8 for ; Wed, 18 Dec 2019 04:03:24 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:21 -0800 (PST) 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=fy+B/TRcCsC3WIuPseL3Gdys+E0bj/B1JxAW2ZkWrwk=; b=cFjP8YNsCdrUqiRwtXHzwGI9hQ6m85yMviwW5hhjOTlIEr0oyuY85KEF8I41MBTlcn LFKorWB5Q5gcpGOBMCsyIIYsrZCoxoZt/KWyrcHD2U2+qYfpbYeZtucVlkcew9BqXI9J 0M46bsPoupyF4I9i6ueWjtrRULGQsHuk+3Ya2BxmN0NfGYjqueeFEfurvhh6IbuWnN5F 3/YDuklE2V4yqQqaPbRrYZHlceHnSQ33d5Gekf6XG//6jsfKrKXiPWdC4/sXB1k7puc8 0Ps3OkUfInjHQBDpyl7XGZMNjFU3nCtHYhQ1BHw4HHNkwONhWgIwWk2vF4sQskzlCYLh MSmQ== 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=fy+B/TRcCsC3WIuPseL3Gdys+E0bj/B1JxAW2ZkWrwk=; b=gFY+cRkvDsMBV9SmBf33cKIllnGTXcbMkipRbrKfJqPm7APx7aZw3ZCrjmjJPKIbSR R3FqDl5QJbmzvxZgWRk7OB5HhgkgQnto07dV3fvP+kl6fxjY0KPnIswxXNnASr2R7wvR hxUAScI09/9ZQPVt4Z4bZU9gPL5N2tEA9piYsg1xJndNA+nINukpRZCbCeocWOLKaL48 etjm47WJ/TqGa0l1xwNsqqMjEMhL3XmDXt2rjYtoi5X5H2KyH2Vrzu12xMUF4bhwGnZw gee9jyHPM1Xl7M64o9BqEgJ3pfw9Bj+w43UShfSYkpat07o7gH84WZ11Q5+s6wMiAZYa CT/g== X-Gm-Message-State: APjAAAXa3QGjEbHvTYpm5gSjhoA3Avw/dbeABP3xR3y2dFLkrvHAsb7i uhQksvIJS/Vh1DBUY8yupgVlPDNZ X-Google-Smtp-Source: APXvYqxoObiN3zvHG7DH0ELngLpcm28bcGvl3F873+9alGcXlQgNGgifRE+NkcBgB5gx86ly7/Marg== X-Received: by 2002:a5d:5403:: with SMTP id g3mr2488643wrv.302.1576670602629; Wed, 18 Dec 2019 04:03:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 27/87] kvm: convert "-machine kvm_shadow_mem" to an accelerator property Date: Wed, 18 Dec 2019 13:01:53 +0100 Message-Id: <1576670573-48048-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 43 +++++++++++++++++++++++++++++++++++++++++++ hw/core/machine.c | 39 --------------------------------------- include/hw/boards.h | 2 -- qemu-options.hx | 6 +++--- target/i386/kvm.c | 2 +- vl.c | 4 ++++ 6 files changed, 51 insertions(+), 45 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 7b9f92d..4770dd8 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -41,6 +41,7 @@ #include "hw/irq.h" #include "sysemu/sev.h" #include "sysemu/balloon.h" +#include "qapi/visitor.h" =20 #include "hw/boards.h" =20 @@ -92,6 +93,7 @@ struct KVMState int max_nested_state_len; int many_ioeventfds; int intx_set_mask; + int kvm_shadow_mem; bool sync_mmu; bool manual_dirty_log_protect; /* The man page (and posix) say ioctl numbers are signed int, but @@ -2954,6 +2956,40 @@ static bool kvm_accel_has_memory(MachineState *ms, A= ddressSpace *as, return false; } =20 +static void kvm_get_kvm_shadow_mem(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + KVMState *s =3D KVM_STATE(obj); + int64_t value =3D s->kvm_shadow_mem; + + visit_type_int(v, name, &value, errp); +} + +static void kvm_set_kvm_shadow_mem(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + KVMState *s =3D KVM_STATE(obj); + Error *error =3D NULL; + int64_t value; + + visit_type_int(v, name, &value, &error); + if (error) { + error_propagate(errp, error); + return; + } + + s->kvm_shadow_mem =3D value; +} + +static void kvm_accel_instance_init(Object *obj) +{ + KVMState *s =3D KVM_STATE(obj); + + s->kvm_shadow_mem =3D -1; +} + static void kvm_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac =3D ACCEL_CLASS(oc); @@ -2961,11 +2997,18 @@ static void kvm_accel_class_init(ObjectClass *oc, v= oid *data) ac->init_machine =3D kvm_init; ac->has_memory =3D kvm_accel_has_memory; ac->allowed =3D &kvm_allowed; + + object_class_property_add(oc, "kvm-shadow-mem", "int", + kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, "kvm-shadow-mem", + "KVM shadow MMU size", &error_abort); } =20 static const TypeInfo kvm_accel_type =3D { .name =3D TYPE_KVM_ACCEL, .parent =3D TYPE_ACCEL, + .instance_init =3D kvm_accel_instance_init, .class_init =3D kvm_accel_class_init, .instance_size =3D sizeof(KVMState), }; diff --git a/hw/core/machine.c b/hw/core/machine.c index 05cea3a..9c93353 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -216,33 +216,6 @@ static void machine_set_kernel_irqchip(Object *obj, Vi= sitor *v, } } =20 -static void machine_get_kvm_shadow_mem(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - int64_t value =3D ms->kvm_shadow_mem; - - visit_type_int(v, name, &value, errp); -} - -static void machine_set_kvm_shadow_mem(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - MachineState *ms =3D MACHINE(obj); - Error *error =3D NULL; - int64_t value; - - visit_type_int(v, name, &value, &error); - if (error) { - error_propagate(errp, error); - return; - } - - ms->kvm_shadow_mem =3D value; -} - static char *machine_get_kernel(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -790,12 +763,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) object_class_property_set_description(oc, "kernel-irqchip", "Configure KVM in-kernel irqchip", &error_abort); =20 - object_class_property_add(oc, "kvm-shadow-mem", "int", - machine_get_kvm_shadow_mem, machine_set_kvm_shadow_mem, - NULL, NULL, &error_abort); - object_class_property_set_description(oc, "kvm-shadow-mem", - "KVM shadow MMU size", &error_abort); - object_class_property_add_str(oc, "kernel", machine_get_kernel, machine_set_kernel, &error_abort); object_class_property_set_description(oc, "kernel", @@ -897,7 +864,6 @@ static void machine_initfn(Object *obj) =20 ms->kernel_irqchip_allowed =3D true; ms->kernel_irqchip_split =3D mc->default_kernel_irqchip_split; - ms->kvm_shadow_mem =3D -1; ms->dump_guest_core =3D true; ms->mem_merge =3D true; ms->enable_graphics =3D true; @@ -968,11 +934,6 @@ bool machine_kernel_irqchip_split(MachineState *machin= e) return machine->kernel_irqchip_split; } =20 -int machine_kvm_shadow_mem(MachineState *machine) -{ - return machine->kvm_shadow_mem; -} - int machine_phandle_start(MachineState *machine) { return machine->phandle_start; diff --git a/include/hw/boards.h b/include/hw/boards.h index 5025c1a..6084e61 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -66,7 +66,6 @@ bool machine_usb(MachineState *machine); bool machine_kernel_irqchip_allowed(MachineState *machine); bool machine_kernel_irqchip_required(MachineState *machine); bool machine_kernel_irqchip_split(MachineState *machine); -int machine_kvm_shadow_mem(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); @@ -278,7 +277,6 @@ struct MachineState { bool kernel_irqchip_allowed; bool kernel_irqchip_required; bool kernel_irqchip_split; - int kvm_shadow_mem; char *dtb; char *dumpdtb; int phandle_start; diff --git a/qemu-options.hx b/qemu-options.hx index 1535390..004370c 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -34,7 +34,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " supported accelerators are kvm, xen, hax, hvf, whpx o= r tcg (default: tcg)\n" " kernel_irqchip=3Don|off|split controls accelerated ir= qchip support (default=3Doff)\n" " vmport=3Don|off|auto controls emulation of vmport (de= fault: auto)\n" - " kvm_shadow_mem=3Dsize of KVM shadow MMU in bytes\n" " dump-guest-core=3Don|off include guest memory in a co= re dump (default=3Don)\n" " mem-merge=3Don|off controls memory merge support (def= ault: on)\n" " aes-key-wrap=3Don|off controls support for AES key wr= apping (default=3Don)\n" @@ -74,8 +73,6 @@ Controls in-kernel irqchip support for the chosen acceler= ator when available. Enables emulation of VMWare IO port, for vmmouse etc. auto says to select = the value based on accel. For accel=3Dxen the default is off otherwise the def= ault is on. -@item kvm_shadow_mem=3Dsize -Defines the size of the KVM shadow MMU. @item dump-guest-core=3Don|off Include guest memory in a core dump. The default is on. @item mem-merge=3Don|off @@ -118,6 +115,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=3D]accelerator[,prop[=3Dvalue][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; = use 'help' for a list)\n" " igd-passthru=3Don|off (enable Xen integrated Intel gr= aphics passthrough, default=3Doff)\n" + " kvm-shadow-mem=3Dsize of KVM shadow MMU in bytes\n" " tb-size=3Dn (TCG translation block cache size)\n" " thread=3Dsingle|multi (enable multi-threaded TCG)\n",= QEMU_ARCH_ALL) STEXI @@ -131,6 +129,8 @@ fails to initialize. @item igd-passthru=3Don|off When Xen is in use, this option controls whether Intel integrated graphics devices can be passed through to the guest (default=3Doff) +@item kvm-shadow-mem=3Dsize +Defines the size of the KVM shadow MMU. @item tb-size=3D@var{n} Controls the size (in MiB) of the TCG translation block cache. @item thread=3Dsingle|multi diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 1d10046..62ce681 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2163,7 +2163,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } qemu_register_reset(kvm_unpoison_all, NULL); =20 - shadow_mem =3D machine_kvm_shadow_mem(ms); + shadow_mem =3D object_property_get_int(OBJECT(s), "kvm-shadow-mem", &e= rror_abort); if (shadow_mem !=3D -1) { shadow_mem /=3D 4096; ret =3D kvm_vm_ioctl(s, KVM_SET_NR_MMU_PAGES, shadow_mem); diff --git a/vl.c b/vl.c index 774305c..8c6fcda 100644 --- a/vl.c +++ b/vl.c @@ -2514,6 +2514,10 @@ static int machine_set_property(void *opaque, object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, valu= e); return 0; } + if (g_str_equal(qom_name, "kvm-shadow-mem")) { + object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), qom_name, valu= e); + return 0; + } =20 return object_parse_property_opt(opaque, name, value, "type", errp); } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672141; cv=none; d=zohomail.com; s=zohoarc; b=Yrx7GhT71bkcKL8bxTkBIDjLdDI3SfET2nHurW2Vg1ttdlXOYWfs0C8SKZsFiYHAOWObBFxFt4PD80DBJ9jje2soXRTu9Pcl1SQEstD7rl38sqe3d/wKZZAOPmJ3ByYljKrUi6/sYQB1hIVRg5O+4qx8Ed9E2ZFucoDbTLW+ZXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672141; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3y6IGYns50JgdKFrUSTcRScelBo2Wc6Cc3hO0Vp2NeM=; b=cIsIhZ0bbzrh/jri+49jwXy/1znQu+kp6VY5bqlhqKBh74iwRnarMMBCbxz9u+8rpRZ7F7Bf19Qws0G7lTzLX6lcWofNpTLtujMWyxx63eRn9RyiGjmxWCVkG4cGQA+BER8rUA0d0jOWDlalKXESQCpY5oXNBampCMwvHK1s0hk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672141773651.9246224225295; Wed, 18 Dec 2019 04:29:01 -0800 (PST) Received: from localhost ([::1]:53464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYRo-0007Xo-Bm for importer@patchew.org; Wed, 18 Dec 2019 07:29:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47766) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006J8-HI for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY36-0000VS-8y for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:43636) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000Sj-Su for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:28 -0500 Received: by mail-wr1-x42d.google.com with SMTP id d16so1983331wre.10 for ; Wed, 18 Dec 2019 04:03:24 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:22 -0800 (PST) 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=3y6IGYns50JgdKFrUSTcRScelBo2Wc6Cc3hO0Vp2NeM=; b=W9cHxF8hGzv5ZZ3Rk8vzbo4+07stPs1mluyACw79e1PsWeb484lcK5S2dGDxW84bcX 8Akn0Xf67YzTAS/tzmfeOuMxskNQLH0KHwUEGqLdVgD0dg7UDh1yPWs/iWQJJVw/p5V5 MR9ZfA9Xq7COojCUsL6dV0wqVwYuoDCpsaehoYbHMV7U1guRz7G3uvL1gLD2WF4RvwQ2 AId7pb3uoWbRqtfKU2WDHSDKH7Jmz9cA5di5LEP/geTpOqqVysWn39HLYozmos9DmYTF AIkwbQe3FToiLB5eTkBfMYaD608UGyAjtSOkpdlqGwFsbJmjNUpTKRrVDR8kZja7xMmY F7og== 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=3y6IGYns50JgdKFrUSTcRScelBo2Wc6Cc3hO0Vp2NeM=; b=FiGRfxh2wN/jPgdzSpdIeEo9O7BfU4jP3fnYiAY+ZYsSJpGYbVl36aJerEXSuUfEve LfIGSr4V9J+Gqic2QuYBEbhafkZ7cQKtt/D53flJJWSRCBYr2HOA52bdfl3SKs3Zmw+G FqaVP3z02a4QMckq6aDxM8CVj2Og+j0RvVKN6Up1EigUSc5+6JIP4Z40HsQna5GTAPxO X2cBlAt6e1+ZbFCW+RdDSubvqcX65rt5Dl/E/KAN3y9JTECKxEMz++qLePOcUpT3mOdY OYIWtLEbvtvOclxzYSwTyK0H/IDMimLcvlEPS/JKY3wozHgOa6tf0L4CH6IKmr9WV5o+ GVhw== X-Gm-Message-State: APjAAAXCfTvaYQ5qxHb+l198LjTAKGQaSWmGSixQE3UIEOUO4+KDIeyF x6tiLNcHiOJKdEehyAglYui8Xu6i X-Google-Smtp-Source: APXvYqx21P/Rphf4tICx5mfautnBUHiWrjvFaBU5/yD7OTSXXi2Bsns2sjgPEOPhJIiyVpCDIgY/eQ== X-Received: by 2002:adf:de84:: with SMTP id w4mr2350315wrl.97.1576670603343; Wed, 18 Dec 2019 04:03:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 28/87] kvm: introduce kvm_kernel_irqchip_* functions Date: Wed, 18 Dec 2019 13:01:54 +0100 Message-Id: <1576670573-48048-29-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The KVMState struct is opaque, so provide accessors for the fields that will be moved from current_machine to the accelerator. For now they just forward to the machine object, but this will change. Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 23 +++++++++++++++++++---- hw/ppc/e500.c | 5 ++--- hw/ppc/spapr_irq.c | 16 ++++------------ include/sysemu/kvm.h | 7 +++++-- target/arm/kvm.c | 8 ++++---- target/i386/kvm.c | 4 ++-- target/mips/kvm.c | 2 +- target/ppc/kvm.c | 2 +- target/s390x/kvm.c | 2 +- 9 files changed, 39 insertions(+), 30 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4770dd8..34e8f26 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1774,7 +1774,7 @@ void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_ir= q irq, int gsi) g_hash_table_insert(s->gsimap, irq, GINT_TO_POINTER(gsi)); } =20 -static void kvm_irqchip_create(MachineState *machine, KVMState *s) +static void kvm_irqchip_create(KVMState *s) { int ret; =20 @@ -1792,9 +1792,9 @@ static void kvm_irqchip_create(MachineState *machine,= KVMState *s) =20 /* First probe and see if there's a arch-specific hook to create the * in-kernel irqchip for us */ - ret =3D kvm_arch_irqchip_create(machine, s); + ret =3D kvm_arch_irqchip_create(s); if (ret =3D=3D 0) { - if (machine_kernel_irqchip_split(machine)) { + if (kvm_kernel_irqchip_split()) { perror("Split IRQ chip mode not supported."); exit(1); } else { @@ -2066,7 +2066,7 @@ static int kvm_init(MachineState *ms) } =20 if (machine_kernel_irqchip_allowed(ms)) { - kvm_irqchip_create(ms, s); + kvm_irqchip_create(s); } =20 if (kvm_eventfds_allowed) { @@ -2983,6 +2983,21 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Visi= tor *v, s->kvm_shadow_mem =3D value; } =20 +bool kvm_kernel_irqchip_allowed(void) +{ + return machine_kernel_irqchip_allowed(current_machine); +} + +bool kvm_kernel_irqchip_required(void) +{ + return machine_kernel_irqchip_required(current_machine); +} + +bool kvm_kernel_irqchip_split(void) +{ + return machine_kernel_irqchip_split(current_machine); +} + static void kvm_accel_instance_init(Object *obj) { KVMState *s =3D KVM_STATE(obj); diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 91cd4c2..12b6a5b 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -793,7 +793,6 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineSta= te *pms, MemoryRegion *ccsr, IrqLines *irqs) { - MachineState *machine =3D MACHINE(pms); const PPCE500MachineClass *pmc =3D PPCE500_MACHINE_GET_CLASS(pms); DeviceState *dev =3D NULL; SysBusDevice *s; @@ -801,10 +800,10 @@ static DeviceState *ppce500_init_mpic(PPCE500MachineS= tate *pms, if (kvm_enabled()) { Error *err =3D NULL; =20 - if (machine_kernel_irqchip_allowed(machine)) { + if (kvm_kernel_irqchip_allowed()) { dev =3D ppce500_init_mpic_kvm(pmc, irqs, &err); } - if (machine_kernel_irqchip_required(machine) && !dev) { + if (kvm_kernel_irqchip_required() && !dev) { error_reportf_err(err, "kernel_irqchip requested but unavailable: "= ); exit(1); diff --git a/hw/ppc/spapr_irq.c b/hw/ppc/spapr_irq.c index 07e08d6..373505d 100644 --- a/hw/ppc/spapr_irq.c +++ b/hw/ppc/spapr_irq.c @@ -75,12 +75,11 @@ int spapr_irq_init_kvm(SpaprInterruptControllerInitKvm = fn, uint32_t nr_servers, Error **errp) { - MachineState *machine =3D MACHINE(qdev_get_machine()); Error *local_err =3D NULL; =20 - if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) { + if (kvm_enabled() && kvm_kernel_irqchip_allowed()) { if (fn(intc, nr_servers, &local_err) < 0) { - if (machine_kernel_irqchip_required(machine)) { + if (kvm_kernel_irqchip_required()) { error_prepend(&local_err, "kernel_irqchip requested but unavailable: "= ); error_propagate(errp, local_err); @@ -185,7 +184,7 @@ static int spapr_irq_check(SpaprMachineState *spapr, Er= ror **errp) */ if (kvm_enabled() && spapr->irq =3D=3D &spapr_irq_dual && - machine_kernel_irqchip_required(machine) && + kvm_kernel_irqchip_required() && xics_kvm_has_broken_disconnect(spapr)) { error_setg(errp, "KVM is too old to support ic-mode=3Ddual,kernel-= irqchip=3Don"); return -1; @@ -288,20 +287,13 @@ uint32_t spapr_irq_nr_msis(SpaprMachineState *spapr) =20 void spapr_irq_init(SpaprMachineState *spapr, Error **errp) { - MachineState *machine =3D MACHINE(spapr); SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(spapr); =20 - if (machine_kernel_irqchip_split(machine)) { + if (kvm_enabled() && kvm_kernel_irqchip_split()) { error_setg(errp, "kernel_irqchip split mode not supported on pseri= es"); return; } =20 - if (!kvm_enabled() && machine_kernel_irqchip_required(machine)) { - error_setg(errp, - "kernel_irqchip requested but only available with KVM"); - return; - } - if (spapr_irq_check(spapr, errp) < 0) { return; } diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 9fe233b..aaf2a50 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -519,10 +519,13 @@ void kvm_pc_gsi_handler(void *opaque, int n, int leve= l); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); =20 +bool kvm_kernel_irqchip_allowed(void); +bool kvm_kernel_irqchip_required(void); +bool kvm_kernel_irqchip_split(void); + /** * kvm_arch_irqchip_create: * @KVMState: The KVMState pointer - * @MachineState: The MachineState pointer * * Allow architectures to create an in-kernel irq chip themselves. * @@ -530,7 +533,7 @@ void kvm_init_irq_routing(KVMState *s); * 0: irq chip was not created * > 0: irq chip was created */ -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s); +int kvm_arch_irqchip_create(KVMState *s); =20 /** * kvm_set_one_reg - set a register value in KVM via KVM_SET_ONE_REG ioctl diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 5b82cef..b87b59a 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -741,11 +741,11 @@ void kvm_arch_init_irq_routing(KVMState *s) { } =20 -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { - if (machine_kernel_irqchip_split(ms)) { - perror("-machine kernel_irqchip=3Dsplit is not supported on ARM."= ); - exit(1); + if (kvm_kernel_irqchip_split()) { + perror("-machine kernel_irqchip=3Dsplit is not supported on ARM."); + exit(1); } =20 /* If we can create the VGIC using the newer device control API, we diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 62ce681..ef63f3a 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -4494,10 +4494,10 @@ void kvm_arch_init_irq_routing(KVMState *s) } } =20 -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { int ret; - if (machine_kernel_irqchip_split(ms)) { + if (kvm_kernel_irqchip_split()) { ret =3D kvm_vm_enable_cap(s, KVM_CAP_SPLIT_IRQCHIP, 0, 24); if (ret) { error_report("Could not enable split irqchip mode: %s", diff --git a/target/mips/kvm.c b/target/mips/kvm.c index 578bc14..de3e26e 100644 --- a/target/mips/kvm.c +++ b/target/mips/kvm.c @@ -57,7 +57,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } =20 -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 7406d18..f7e187c 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -152,7 +152,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } =20 -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index ad6e38c..15260ae 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -374,7 +374,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) return 0; } =20 -int kvm_arch_irqchip_create(MachineState *ms, KVMState *s) +int kvm_arch_irqchip_create(KVMState *s) { return 0; } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671991; cv=none; d=zohomail.com; s=zohoarc; b=JM+xSH+TtsJO+eky5J2oDqCxNegaBpQ9tyyzQbzUPN9l6eH8kqo27AjhI8PZXDshSNPchXEH4AoKl+GRR7SF9wJOeTdvBY3wudVXaBX44K5tbli1rwyjLOozjizQHlBB43v+Z8GlWzE+/W0JUV891F0DT+jPP/SEx1Cl53IB/BI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671991; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=o7A6ug5Mdlq4+wSzMttY8PZCN40HV0ufczSQm1VvlTk=; b=AQ9o3TVocCYnbC7ZmuzCbR8G811W+zIbImdGO94HOvtn5o3/NyRzgdIxHtnXQJvHwhqv1hG55lFrzM8d5eJEitE73jC2yjpgF245iurwdQfdEQ6sXKcRe/lg0P8GLuZd9tqvfF76m6mNZ84zNWQRR3Aq/rVqofjW+tHhFQaBGT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667199189546.375302287321915; Wed, 18 Dec 2019 04:26:31 -0800 (PST) Received: from localhost ([::1]:53438 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYPO-0004Li-5g for importer@patchew.org; Wed, 18 Dec 2019 07:26:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47775) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006JA-Hi for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY36-0000VB-5C for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:38425) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000Sr-QR for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:28 -0500 Received: by mail-wm1-x331.google.com with SMTP id u2so1607137wmc.3 for ; Wed, 18 Dec 2019 04:03:25 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:23 -0800 (PST) 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=o7A6ug5Mdlq4+wSzMttY8PZCN40HV0ufczSQm1VvlTk=; b=AGs1XBEEyVi3yx6bJaj5+O4HeznyXuZyDJmPAXyJuBdkGK5OTgxn3TXJ0xsNbOFnki 7lIqO67WmXG2CfzxkeEkExd7SnVyQUAtEjIJTkw/Yb7mI9tchWvWcLV0BsD2zgoxwBIs w7QZ9Ij5dCQnTLhESPuUqPNyBrCLOKThnlYgzwCqh8AMFlFNW0lKQ5/QLCBYNW7go8lb Z0+GJezPu9a/4DBX0m0oYNSiRcKaW9Oj2uUz0k8tax0n0ScGeGSVKHRaJDzUUKtCToiG +lNjup0jpa69SlgSAMLKU4wvsanXSlrAo43reL3PCgad3LpRpgL2pCenlg6tikZ7i9ao W2Jw== 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=o7A6ug5Mdlq4+wSzMttY8PZCN40HV0ufczSQm1VvlTk=; b=pDjy1GcoC6ecdAMwYTW2d/5Xf3fc6JNHTQNMSE15JZyqae9tnPMPfZwJ89nmPCae/P gb+QctNpRNd4c394orObE3ZqiZAYpG7cIulvzEC1zaGcG5vSKRZ9FWEyucWZfgb5ejNm 6tPtqErwhc80UARuJUyyWktMA65v0XyT2hsO9pKoghNanmv3jEal1yrmkM4N01nq4D8t 3BJXMCfibQows1eA0UsqJXc1VjmaG1bylr+qBYTvlbO0ySEVPUpJFNIfozaa7l05k5Ts VXoULEVTE+109AMD9pqs/mlyJAFVem0OEYnVgprb7V0CQUQgZy1J5B/Fcz+cD48fasFn 3gGg== X-Gm-Message-State: APjAAAXkHTTwwBQiGRmVrBC7x0bU8Dru3IavN1LDbi0myIOttfwoBlgV MUmrky+pO9zNyGvPGlr+IZKUSGwk X-Google-Smtp-Source: APXvYqzj9Ho2YhSN4K8hAor+QAXgJp089Ao2hBJzSuYz2HbJNiXlgNG+AlM/nzvnaGp6HVb+8olGVg== X-Received: by 2002:a7b:c759:: with SMTP id w25mr2957203wmk.15.1576670604242; Wed, 18 Dec 2019 04:03:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 29/87] kvm: convert "-machine kernel_irqchip" to an accelerator property Date: Wed, 18 Dec 2019 13:01:55 +0100 Message-Id: <1576670573-48048-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++---= -- hw/core/machine.c | 61 -------------------------------------------------= ---- include/hw/boards.h | 3 --- qemu-options.hx | 9 +++++--- vl.c | 3 ++- 5 files changed, 62 insertions(+), 73 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 34e8f26..b2f1a5b 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -42,6 +42,8 @@ #include "sysemu/sev.h" #include "sysemu/balloon.h" #include "qapi/visitor.h" +#include "qapi/qapi-types-common.h" +#include "qapi/qapi-visit-common.h" =20 #include "hw/boards.h" =20 @@ -94,6 +96,9 @@ struct KVMState int many_ioeventfds; int intx_set_mask; int kvm_shadow_mem; + bool kernel_irqchip_allowed; + bool kernel_irqchip_required; + bool kernel_irqchip_split; bool sync_mmu; bool manual_dirty_log_protect; /* The man page (and posix) say ioctl numbers are signed int, but @@ -1794,7 +1799,7 @@ static void kvm_irqchip_create(KVMState *s) * in-kernel irqchip for us */ ret =3D kvm_arch_irqchip_create(s); if (ret =3D=3D 0) { - if (kvm_kernel_irqchip_split()) { + if (s->kernel_irqchip_split) { perror("Split IRQ chip mode not supported."); exit(1); } else { @@ -2065,7 +2070,7 @@ static int kvm_init(MachineState *ms) goto err; } =20 - if (machine_kernel_irqchip_allowed(ms)) { + if (s->kernel_irqchip_allowed) { kvm_irqchip_create(s); } =20 @@ -2983,19 +2988,57 @@ static void kvm_set_kvm_shadow_mem(Object *obj, Vis= itor *v, s->kvm_shadow_mem =3D value; } =20 +static void kvm_set_kernel_irqchip(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + Error *err =3D NULL; + KVMState *s =3D KVM_STATE(obj); + OnOffSplit mode; + + visit_type_OnOffSplit(v, name, &mode, &err); + if (err) { + error_propagate(errp, err); + return; + } else { + switch (mode) { + case ON_OFF_SPLIT_ON: + s->kernel_irqchip_allowed =3D true; + s->kernel_irqchip_required =3D true; + s->kernel_irqchip_split =3D false; + break; + case ON_OFF_SPLIT_OFF: + s->kernel_irqchip_allowed =3D false; + s->kernel_irqchip_required =3D false; + s->kernel_irqchip_split =3D false; + break; + case ON_OFF_SPLIT_SPLIT: + s->kernel_irqchip_allowed =3D true; + s->kernel_irqchip_required =3D true; + s->kernel_irqchip_split =3D true; + break; + default: + /* The value was checked in visit_type_OnOffSplit() above. If + * we get here, then something is wrong in QEMU. + */ + abort(); + } + } +} + bool kvm_kernel_irqchip_allowed(void) { - return machine_kernel_irqchip_allowed(current_machine); + return kvm_state->kernel_irqchip_allowed; } =20 bool kvm_kernel_irqchip_required(void) { - return machine_kernel_irqchip_required(current_machine); + return kvm_state->kernel_irqchip_required; } =20 bool kvm_kernel_irqchip_split(void) { - return machine_kernel_irqchip_split(current_machine); + return kvm_state->kernel_irqchip_split; } =20 static void kvm_accel_instance_init(Object *obj) @@ -3013,6 +3056,12 @@ static void kvm_accel_class_init(ObjectClass *oc, vo= id *data) ac->has_memory =3D kvm_accel_has_memory; ac->allowed =3D &kvm_allowed; =20 + object_class_property_add(oc, "kernel-irqchip", "on|off|split", + NULL, kvm_set_kernel_irqchip, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, "kernel-irqchip", + "Configure KVM in-kernel irqchip", &error_abort); + object_class_property_add(oc, "kvm-shadow-mem", "int", kvm_get_kvm_shadow_mem, kvm_set_kvm_shadow_mem, NULL, NULL, &error_abort); diff --git a/hw/core/machine.c b/hw/core/machine.c index 9c93353..56137e9 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -178,44 +178,6 @@ GlobalProperty hw_compat_2_1[] =3D { }; const size_t hw_compat_2_1_len =3D G_N_ELEMENTS(hw_compat_2_1); =20 -static void machine_set_kernel_irqchip(Object *obj, Visitor *v, - const char *name, void *opaque, - Error **errp) -{ - Error *err =3D NULL; - MachineState *ms =3D MACHINE(obj); - OnOffSplit mode; - - visit_type_OnOffSplit(v, name, &mode, &err); - if (err) { - error_propagate(errp, err); - return; - } else { - switch (mode) { - case ON_OFF_SPLIT_ON: - ms->kernel_irqchip_allowed =3D true; - ms->kernel_irqchip_required =3D true; - ms->kernel_irqchip_split =3D false; - break; - case ON_OFF_SPLIT_OFF: - ms->kernel_irqchip_allowed =3D false; - ms->kernel_irqchip_required =3D false; - ms->kernel_irqchip_split =3D false; - break; - case ON_OFF_SPLIT_SPLIT: - ms->kernel_irqchip_allowed =3D true; - ms->kernel_irqchip_required =3D true; - ms->kernel_irqchip_split =3D true; - break; - default: - /* The value was checked in visit_type_OnOffSplit() above. If - * we get here, then something is wrong in QEMU. - */ - abort(); - } - } -} - static char *machine_get_kernel(Object *obj, Error **errp) { MachineState *ms =3D MACHINE(obj); @@ -757,12 +719,6 @@ static void machine_class_init(ObjectClass *oc, void *= data) mc->numa_mem_align_shift =3D 23; mc->numa_auto_assign_ram =3D numa_default_auto_assign_ram; =20 - object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, machine_set_kernel_irqchip, - NULL, NULL, &error_abort); - object_class_property_set_description(oc, "kernel-irqchip", - "Configure KVM in-kernel irqchip", &error_abort); - object_class_property_add_str(oc, "kernel", machine_get_kernel, machine_set_kernel, &error_abort); object_class_property_set_description(oc, "kernel", @@ -862,8 +818,6 @@ static void machine_initfn(Object *obj) MachineState *ms =3D MACHINE(obj); MachineClass *mc =3D MACHINE_GET_CLASS(obj); =20 - ms->kernel_irqchip_allowed =3D true; - ms->kernel_irqchip_split =3D mc->default_kernel_irqchip_split; ms->dump_guest_core =3D true; ms->mem_merge =3D true; ms->enable_graphics =3D true; @@ -919,21 +873,6 @@ bool machine_usb(MachineState *machine) return machine->usb; } =20 -bool machine_kernel_irqchip_allowed(MachineState *machine) -{ - return machine->kernel_irqchip_allowed; -} - -bool machine_kernel_irqchip_required(MachineState *machine) -{ - return machine->kernel_irqchip_required; -} - -bool machine_kernel_irqchip_split(MachineState *machine) -{ - return machine->kernel_irqchip_split; -} - int machine_phandle_start(MachineState *machine) { return machine->phandle_start; diff --git a/include/hw/boards.h b/include/hw/boards.h index 6084e61..61f8bb8 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -63,9 +63,6 @@ extern MachineState *current_machine; =20 void machine_run_board_init(MachineState *machine); bool machine_usb(MachineState *machine); -bool machine_kernel_irqchip_allowed(MachineState *machine); -bool machine_kernel_irqchip_required(MachineState *machine); -bool machine_kernel_irqchip_split(MachineState *machine); int machine_phandle_start(MachineState *machine); bool machine_dump_guest_core(MachineState *machine); bool machine_mem_merge(MachineState *machine); diff --git a/qemu-options.hx b/qemu-options.hx index 004370c..71ec733 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -32,7 +32,6 @@ DEF("machine", HAS_ARG, QEMU_OPTION_machine, \ " selects emulated machine ('-machine help' for list)\n" " property accel=3Daccel1[:accel2[:...]] selects accele= rator\n" " supported accelerators are kvm, xen, hax, hvf, whpx o= r tcg (default: tcg)\n" - " kernel_irqchip=3Don|off|split controls accelerated ir= qchip support (default=3Doff)\n" " vmport=3Don|off|auto controls emulation of vmport (de= fault: auto)\n" " dump-guest-core=3Don|off include guest memory in a co= re dump (default=3Don)\n" " mem-merge=3Don|off controls memory merge support (def= ault: on)\n" @@ -67,8 +66,6 @@ This is used to enable an accelerator. Depending on the t= arget architecture, kvm, xen, hax, hvf, whpx or tcg can be available. By default, tcg is used.= If there is more than one accelerator specified, the next one is used if the previous = one fails to initialize. -@item kernel_irqchip=3Don|off -Controls in-kernel irqchip support for the chosen accelerator when availab= le. @item vmport=3Don|off|auto Enables emulation of VMWare IO port, for vmmouse etc. auto says to select = the value based on accel. For accel=3Dxen the default is off otherwise the def= ault @@ -115,6 +112,7 @@ DEF("accel", HAS_ARG, QEMU_OPTION_accel, "-accel [accel=3D]accelerator[,prop[=3Dvalue][,...]]\n" " select accelerator (kvm, xen, hax, hvf, whpx or tcg; = use 'help' for a list)\n" " igd-passthru=3Don|off (enable Xen integrated Intel gr= aphics passthrough, default=3Doff)\n" + " kernel-irqchip=3Don|off|split controls accelerated ir= qchip support (default=3Don)\n" " kvm-shadow-mem=3Dsize of KVM shadow MMU in bytes\n" " tb-size=3Dn (TCG translation block cache size)\n" " thread=3Dsingle|multi (enable multi-threaded TCG)\n",= QEMU_ARCH_ALL) @@ -129,6 +127,11 @@ fails to initialize. @item igd-passthru=3Don|off When Xen is in use, this option controls whether Intel integrated graphics devices can be passed through to the guest (default=3Doff) +@item kernel-irqchip=3Don|off|split +Controls KVM in-kernel irqchip support. The default is full acceleration = of the +interrupt controllers. On x86, split irqchip reduces the kernel attack +surface, at a performance cost for non-MSI interrupts. Disabling the in-k= ernel +irqchip completely is not recommended except for debugging purposes. @item kvm-shadow-mem=3Dsize Defines the size of the KVM shadow MMU. @item tb-size=3D@var{n} diff --git a/vl.c b/vl.c index 8c6fcda..4034c23 100644 --- a/vl.c +++ b/vl.c @@ -2514,7 +2514,8 @@ static int machine_set_property(void *opaque, object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), qom_name, valu= e); return 0; } - if (g_str_equal(qom_name, "kvm-shadow-mem")) { + if (g_str_equal(qom_name, "kvm-shadow-mem") || + g_str_equal(qom_name, "kernel-irqchip")) { object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), qom_name, valu= e); return 0; } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671808; cv=none; d=zohomail.com; s=zohoarc; b=alYw0m4RcQ3j8pACRG+dG6EmZKyY9p/LUc0PyT8+jJ2R/wgr40FL0iu9ZNhipvl3QlTGXqaYDpaPFojYb2+g7s5c9Y1GBG+uVRtLgifK/LzAbsvMyUI+wZXsogxHQ7oHVEXTpOngcQkGXzLfMo/g9RJPqqkmjrl1XdMetic4e0E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671808; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HDTYKQfotEZNCNNOb0BXo5V66sef5b68rxGZly+OEbw=; b=KeTEfW1baIkRiRzsZoqlqbF1XM6XwHMCKzFVxEh2uX0OZ0m0k08ieSmeTV9wQq8VfnB3ALBDv+PnO6mYbpEqUT4nwAxVYImE9QF94X6okqRQXZ3k3ltT4Tt30BZmYq3xPbCr4Jo87ccXlN+D3kyRAuv+b50q/0tG5BHo/ILWJXc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15766718083371022.0366790479945; Wed, 18 Dec 2019 04:23:28 -0800 (PST) Received: from localhost ([::1]:53394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYMQ-0008AF-Eo for importer@patchew.org; Wed, 18 Dec 2019 07:23:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47554) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY37-0006Hh-Cm for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY35-0000UR-Sw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:50299) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000Sy-5P for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: by mail-wm1-x335.google.com with SMTP id a5so1562352wmb.0 for ; Wed, 18 Dec 2019 04:03:26 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:24 -0800 (PST) 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=HDTYKQfotEZNCNNOb0BXo5V66sef5b68rxGZly+OEbw=; b=GTqPHkJec84E7vCDNGzQVNMF52SwmR09e55dkb8HGQySz7taDeejFxYqjDePGvkFSU q8HEsQECqwgUuwR98ECP7BJnAhrPSDE+CI7wzKfqxX2dcmX8Efp3i6svX1Dz2UJkWIhs 3FmH21WiWx710nYnVGDYUWMfFvYYrkJu4DB9yxcL/pN3KhCnzx1veA1fvJCNGMvC8Fr5 L6XYRRm+Osj4R4C812kXg6OHZvCbp07RyKYdk92SWu1xM+JCmHBQqRcXdnZ95CYjls6n xeo15HZEk9TcZp4i5gzuKbdsQ4uzd0WLVc5E9QbxW110NMnf+Ho5oELFrQ0TgjupIn/e f2CQ== 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=HDTYKQfotEZNCNNOb0BXo5V66sef5b68rxGZly+OEbw=; b=Oi4fOUZodflGRbC9hKMl8Icx91eJnWCaCufXZpG5oninxkllOXV7s67tdB4QgNMmXC qgr2/yXs9OFOXG6/A1CN0yF6BWkk+dSfOiraQXUHE0p+j42huianXp25WcVEEYMIlv4B 8jaqQuYQKQwEANdf0z8uD5m0ojLFoSeXBwdmJNe2ckp6345xPdLSkxuXcQVElqG32WQT fiNxzUeetnfceqH/LgJpRH3ReZtF5yN1fBdgQuqV2OmxNOi8cqs28+/LUiBHovqoRohq UjvkZajwkZ+4dKJjiT0xIoKVMUWT/Z1R5R5FpBRAUIAo30bnKEfafZS4kiHZ9ao3zOtB Tg3Q== X-Gm-Message-State: APjAAAWC2uZ9kqBdFy+RyshHWqk+cJFQnI+lXT57xpBJHng8Ua6oegl3 U8nJ/WQ9v9qqwxbwT/BntPtpDOKY X-Google-Smtp-Source: APXvYqzUa9LgNBI63zogv8pVSln3x50q2gr4LpOH7RcvXTZ9rCVdRO+Gel2dZzvvzr1/66TI24M58g== X-Received: by 2002:a1c:7d93:: with SMTP id y141mr2951165wmc.111.1576670605225; Wed, 18 Dec 2019 04:03:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 30/87] Makefile: remove unused variables Date: Wed, 18 Dec 2019 13:01:56 +0100 Message-Id: <1576670573-48048-31-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index 1361def..a2acef3 100644 --- a/Makefile +++ b/Makefile @@ -445,10 +445,6 @@ dummy :=3D $(call unnest-vars,, \ io-obj-y \ common-obj-y \ common-obj-m \ - ui-obj-y \ - ui-obj-m \ - audio-obj-y \ - audio-obj-m \ trace-obj-y) =20 include $(SRC_PATH)/tests/Makefile.include --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671955; cv=none; d=zohomail.com; s=zohoarc; b=meSRh6HOQ7evXUHamSIhgMfxtQ6iDiacoxYrvrsZRp0jQEvAH6xMgbf2e2U1DrOiJRCczxwHJ4WKqrkSeSsZ5PGSDDHIFGRIhCV869UrlAA/j/vZVhzDNYixsABHB+HNS6fl6ac+whFGNWfiVW7k9k62wPu1uvOLTXb5fL9tx1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671955; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=0e9iZbZwVOF2w7GIO2zU28bMFshOQAQOAmPOJxZU0us=; b=A4V2xN12WztLavUwrxlmOE1tT7jyQjGIflxmo41n2UOmXWJv8c7va/bgZWgwqK7W9pJeLOFc2hAl2rhqxKXMj4dH5gBkWus03HQben6ixy6kcoZ5oWKR1B1BnCqWq/gnvNs1YaUJt4FuDPJby7aHUalYzapyUP5dK9dAeuNEWek= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671955282668.3424096614665; Wed, 18 Dec 2019 04:25:55 -0800 (PST) Received: from localhost ([::1]:53422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYOn-0003F8-Ox for importer@patchew.org; Wed, 18 Dec 2019 07:25:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47689) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006Ic-0m for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY36-0000WM-EX for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:38306) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY35-0000T7-P1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:27 -0500 Received: by mail-wr1-x441.google.com with SMTP id y17so2010285wrh.5 for ; Wed, 18 Dec 2019 04:03:27 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:25 -0800 (PST) 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=0e9iZbZwVOF2w7GIO2zU28bMFshOQAQOAmPOJxZU0us=; b=rCSv5bNzkE6a+ZVDTCqrxIsa2bGL3+gU5ilt1Am50Q5Eb+IWwWppIypqbzIpBzxCHE /kTrmSd+dvqim7HDCtGvCK6+N1sONdc7uN6R0T7Je/jmwscCb+N4MA/NeNBvrOryOjXE Unwl5M4jAeiMn1IsTcHAOhWYYB1XA3EgAA205mzd9fe57zoZebayOfnCjXAMb/m1Bf4o URTaBGJfp9t+G+y3u0EYgbUHQaA+IGxQ6QWn6m1jP0l49ZzugUB79ZGhjvIZhz3ITz8r i+QHN3y+HzQSuAt63qVhQLqtCy7UrSwVXH7s9L1S/siyw9rOXpWfosvoZrPORk467naJ ZGyg== 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=0e9iZbZwVOF2w7GIO2zU28bMFshOQAQOAmPOJxZU0us=; b=JAg0JeJfgoXvMy/m2i1AZ9sdmc5OolBKWL8p50WUzloryF3R+jZcL6vMAOBb4ROuAM sJpCkkp+1KDzT3cKmiJB/OXcUZDaE0HhTtoVFRXrppduJBsBPH1znxabrOHOc3U88KB9 ZlryT+EkcsWxKOpRThQgRx/B7HZhCWom/LyH8Zbz12wIsGtqDK2y0rllX1gKlxin+4dz fkkWVM+MwLu0QFV+q7iFfheQQycu8H9ueDOSl3et4MPsiU4WoVz5ZPQGFm0cwx23NFD/ DRMw6S8vTWYFiDyOTU87FVc5f425MuncR28qhLYnrvGEx6XPP3eDQ6NYnC+tyNvoZAJV pQDg== X-Gm-Message-State: APjAAAUdsCrE2dvxOVTY6zbRb1JWB8lfkdgJ9y404Ih1KHMpePHdbyWU SmhuHniFeTssko5GaQrqAG35Q/xo X-Google-Smtp-Source: APXvYqyfDgicVsOuPxkMeKjpzWR4ecSzCY7LsGkprmQxaJp4aNKPZ0CK2/LpMbP2cqIeZmUruYGvFw== X-Received: by 2002:adf:e984:: with SMTP id h4mr2380406wrm.275.1576670606354; Wed, 18 Dec 2019 04:03:26 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 31/87] object: Improve documentation of interfaces Date: Wed, 18 Dec 2019 13:01:57 +0100 Message-Id: <1576670573-48048-32-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Greg Kurz QOM interfaces allow a limited form of multiple inheritance, at the condition of being stateless. That is, they cannot be instantiated and a pointer to an interface shouldn't be dereferenceable in any way. This is achieved by making the QOM instance type an incomplete type, which is, as mentioned by Markus Armbruster, the closest you can get to abstract class in C. Incomplete types are widely used to hide implementation details, but people usually expect to find at least one place where the type is fully defined. The fact that it doesn't happen with QOM interfaces is quite disturbing, especially since it isn't documented anywhere as recently discussed in this thread: https://lists.gnu.org/archive/html/qemu-devel/2019-12/msg01579.html Amend the documentation in the object.h header file to provide more details about why and how to implement QOM interfaces using incomplete types. Signed-off-by: Greg Kurz Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- include/qom/object.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index f9ad692..bd68d19 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -200,8 +200,14 @@ typedef struct InterfaceInfo InterfaceInfo; * * Interfaces allow a limited form of multiple inheritance. Instances are * similar to normal types except for the fact that are only defined by - * their classes and never carry any state. You can dynamically cast an o= bject - * to one of its #Interface types and vice versa. + * their classes and never carry any state. As a consequence, a pointer to + * an interface instance should always be of incomplete type in order to be + * sure it cannot be dereferenced. That is, you should define the + * 'typedef struct SomethingIf SomethingIf' so that you can pass around + * 'SomethingIf *si' arguments, but not define a 'struct SomethingIf { ...= }'. + * The only things you can validly do with a 'SomethingIf *' are to pass i= t as + * an argument to a method on its corresponding SomethingIfClass, or to + * dynamically cast it to an object that implements the interface. * * # Methods # * --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672113; cv=none; d=zohomail.com; s=zohoarc; b=ZVn0Y8bOfhMowka9LX6Vl/fm+vwVy0z2GtnL9zLgvgl81y9nZg3o4hgVWsbck4jfqERhB752Sf7wlrYq/z+/JtU5s51W4V/kY8pua4jMZQRstXqhNTfkfPOlJ/cDbVmHu414+u5EjYMvPfYvUJymQfcEtrq+oYUWJm6EHr4I/Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672113; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=S3pmMgcEmeHBtI4+AVbPDjiFOAavVsNacKUoCx6hTZI=; b=R+dwoHLm5Iuqmp3dvqzJubOFhV/1UbCgJdHfghyinx0qulfgfGrwQ2Ie4Sk5AzPHjxAglgJl5y/UDZht/MwTv/fGF8xqeEXteJbGMAQYqKkjyEoEzpQHZFy4EiyQWK68R7O1a/5tihAwt8rkfFU8PmKGGK8DE/IaAfV5NPmmY6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672113222346.0448871228966; Wed, 18 Dec 2019 04:28:33 -0800 (PST) Received: from localhost ([::1]:53460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYRL-0006vG-HD for importer@patchew.org; Wed, 18 Dec 2019 07:28:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47814) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY38-0006JN-Jj for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY37-0000Yq-8F for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:37759) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY36-0000VH-Rn for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:29 -0500 Received: by mail-wm1-x32b.google.com with SMTP id f129so1610891wmf.2 for ; Wed, 18 Dec 2019 04:03:28 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:26 -0800 (PST) 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=S3pmMgcEmeHBtI4+AVbPDjiFOAavVsNacKUoCx6hTZI=; b=S0faSzCrrz5Wrn9iD03aP5O5HxAyfBRFtFZko6bx/Ix6vJow5wEdBg8kxjzRE3Wnim HwohNFi7h3J3joRstetjogFGJxNUrDIxw5kFJLUE3AN8g183oGaFWLWfsikvEGPBtcdf 9Kh95ziGsZZx6Ac/tWDe0Meqhk7F2f7ru7uWvaJ4yM44f1XElQYbMpxheSE6lT1PcXeP jydlX9J5thtW61iiisE+nWKOHQknLqhRip+87L4cxmIlcr1zco9z252yxr2qffmeZj2d WCQwQp1+EDAyqctj9eSB0ccJFA8/Z+PwGNQPU2FSlee8WFRTvwzA8z3YjyYO4A3c/E4L U6hA== 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=S3pmMgcEmeHBtI4+AVbPDjiFOAavVsNacKUoCx6hTZI=; b=hCeU7c66AgmBaetlCGdU6XKSS2apWqtEHnGXqWLPe8cCt60MkLs0kB/M2N6lAxuWzo 0rEOo/Y3RglCsa+G9hPlJ2zSahQb6vMV9Jbu5qEx0ciiIAXnzv/QuK4JjF3u/NmFtzLC VdtMEW8xnJ9Nur4/T1jUU0xCtlWO1ElxDZCbqUnx13yZgpicNWF6jkWN3QcbS78xDVgE 1Tt/1jrkm/Vg4Qn45nArPhuamXbLQgrMzWyuGI88s+gUtJIKjLcMSSOqb7YfUAszh9ZO vEOqc4xn8izQiNtCTjSK7ikdsmEYWJRKE4PLeYQOi9OFuIt8ummw2zPH9GU1m2I++erG s1VA== X-Gm-Message-State: APjAAAUYGeaPrtPwlvuiskdHMuT4bhkz4LoOk9oMLC+jSAQC9MBKfxf5 dYw9NQ34B6xjd3tGLWeFQfa4Gp8C X-Google-Smtp-Source: APXvYqzdLnUnWaYZsp/oZwhgry3e4iYvvb9r6dK9sodNHG+DxsvsmyuQDQQBoZq1e/shEzyNGlqj3w== X-Received: by 2002:a1c:bbc3:: with SMTP id l186mr2866346wmf.101.1576670607463; Wed, 18 Dec 2019 04:03:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 32/87] build-sys: build vhost-user-gpu only if CONFIG_TOOLS Date: Wed, 18 Dec 2019 13:01:58 +0100 Message-Id: <1576670573-48048-33-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::32b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau vhost-user-gpu is always built and installed, but it is not part of the emu= lator proper. Cut it if --disable-tools is specified. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a2acef3..bfd8ba3 100644 --- a/Makefile +++ b/Makefile @@ -321,14 +321,10 @@ HELPERS-y =3D =20 HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) =3D qemu-bridge-hel= per$(EXESUF) =20 -ifdef CONFIG_LINUX -ifdef CONFIG_VIRGL -ifdef CONFIG_GBM +ifeq ($(CONFIG_LINUX)$(CONFIG_VIRGL)$(CONFIG_GBM)$(CONFIG_TOOLS),yyyy) HELPERS-y +=3D vhost-user-gpu$(EXESUF) vhost-user-json-y +=3D contrib/vhost-user-gpu/50-qemu-gpu.json endif -endif -endif =20 # Sphinx does not allow building manuals into the same directory as # the source files, so if we're doing an in-tree QEMU build we must --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672318; cv=none; d=zohomail.com; s=zohoarc; b=gGUvwfsrS03NQWBqVwIvduQQNMlsCRgOjlh6947L7oGetefkmM4bE5kpEF/xzrnW5ejGahA9TUskBpv7gPq6tucD7ytg5E7N58uuJrHzdqX0pAW+rm7Yra1OWBnYEB0JN1p6Qc3LU8zhpgpwzLXLsQVCq85JSskZTk5ydma4tdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672318; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3VnxJZY4tD2v4gsJNEYlwpenNaYCda4MoHpaOzUowl4=; b=fbSz2VlFfUG015GylydAB7zRMP8g/vhK8AEvxkMRomx1TDGKancWjuQZW+M4NdqmnCKLoMFoq2S9Ues6Se97Ga9W+4QHPFIdZBOQG47A8nUIPw3Oh0L7NENNfS2XlwA5pGzg/1mHuzxIV1pbUce7PPP0zsoP8ERgI2/qpPSEB7g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672318134266.4081950366342; Wed, 18 Dec 2019 04:31:58 -0800 (PST) Received: from localhost ([::1]:53510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYUe-0002gj-6F for importer@patchew.org; Wed, 18 Dec 2019 07:31:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48120) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3A-0006Lh-4Z for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY38-0000ej-IC for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:31 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37887) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY38-0000az-9L for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:30 -0500 Received: by mail-wm1-x342.google.com with SMTP id f129so1610982wmf.2 for ; Wed, 18 Dec 2019 04:03:30 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:27 -0800 (PST) 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=3VnxJZY4tD2v4gsJNEYlwpenNaYCda4MoHpaOzUowl4=; b=p3nODk+2jHEUOc4dsL39MrnoixejOfyMPbgVtW4GFUV76pRDQp+my4Ym7kRnW0wuQ/ /fN2Q2lsk50Qv8gDffHgC9io/ofBvZrQO8dHlQsMFLl4N/ipw6rLv7ZRF0227zis+aR6 8VY/x+pNLJsf2Kh3Akak3wwRmv7gmhH+uXC5ckHLlDaZ2hEy2k5C8VaiQ7aOi8VPEqwW +XNo9kabhSLOBhJ7SzK8G8I4jMHis5IThNd1UB4lVdbvBexeij76xPnqzXIwsEUo9QVt xzjTmLnxee3J1Ywos58Ja0eLh6dYDS/G/XjAP259F3LBswgswgpM+2UYne7zwyV181m4 hITg== 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=3VnxJZY4tD2v4gsJNEYlwpenNaYCda4MoHpaOzUowl4=; b=E4DdhGymASa1mTNWhXJBFontRp1xF4oDjw3eb3wkfsLTjKypDL1msvA0oGECNfzzwf ubgC8L1bsHV5JmXgq+frxuwBTShegME7WV7FJazFjWtytQIRnROwnfS9nXht9haA241e vHOxTv4RTN/Sb+6uDTuyjBb1tqYxBm2KHvMrftAzM5OJMFQyiUXGuCvTsG3WM+dmh8Kr 4BLYjPySh2mWC7eurAJG1opEcbFzRtuWKqJKoKU3abr3QcFPTX67vwiOwjr3T40FbBlo DydNJ8vDbxo7STq0t/VXjotsmRc3A6tx17FKw1hatR0jVXYiGX1rKoHVlveHhjQmryt0 3stQ== X-Gm-Message-State: APjAAAXODekHOlGQG4G0w4OsZALLBxnogA/EJZXw49MhIzi42O+CI8fY kWQ9Xvi8ST9Sr8GWOZK67WfaPO2j X-Google-Smtp-Source: APXvYqz75hNPofecjyvZyeKJPfEJkrYw0UbOMRD9lRxrHneYDOkYkp5uYGsC2BUGTOKSeN6NWG8nUA== X-Received: by 2002:a1c:1bc3:: with SMTP id b186mr2852139wmb.79.1576670608922; Wed, 18 Dec 2019 04:03:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 33/87] build-sys: do not include Windows SLIRP dependencies in $LIBS Date: Wed, 18 Dec 2019 13:01:59 +0100 Message-Id: <1576670573-48048-34-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) When including the internal SLIRP library, we should add all the libraries = that it needs for the build. Right now they are all included by QEMU, but -liph= lpapi is not needed without slirp. Move it from LIBS to slirp_libs. Based on a patch by Marc-Andr=C3=A9 Lureau. Acked-by: Samuel Thibault Signed-off-by: Paolo Bonzini --- configure | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 84b413d..55d386c 100755 --- a/configure +++ b/configure @@ -925,7 +925,7 @@ if test "$mingw32" =3D "yes" ; then DSOSUF=3D".dll" # MinGW needs -mthreads for TLS and macro _MT. QEMU_CFLAGS=3D"-mthreads $QEMU_CFLAGS" - LIBS=3D"-lwinmm -lws2_32 -liphlpapi $LIBS" + LIBS=3D"-lwinmm -lws2_32 $LIBS" write_c_skeleton; if compile_prog "" "-liberty" ; then LIBS=3D"-liberty $LIBS" @@ -6027,6 +6027,9 @@ case "$slirp" in mkdir -p slirp slirp_cflags=3D"-I\$(SRC_PATH)/slirp/src -I\$(BUILD_DIR)/slirp/src" slirp_libs=3D"-L\$(BUILD_DIR)/slirp -lslirp" + if test "$mingw32" =3D "yes" ; then + slirp_libs=3D"$slirp_libs -lws2_32 -liphlpapi" + fi ;; =20 system) --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672270; cv=none; d=zohomail.com; s=zohoarc; b=ZY/1LaFTPLyZOc+U+aNeXmaG1xzFrsFSO4s+2qj1DV2NWvYzIlbgDz3HTUemvlZAhW8PN3ltEcFJ4ywpoOtKYBouMuTgcRmhYIfrtpysK2px4RgxtKgQ9S7GFbIkbqpIRTkpZe+bM9Jd/3sYjkR68bfhcAikpaqEU45r4PctkFQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672270; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=M7st8zYRftA//6nYaWbb7lkO5v3FUGpG+F+usf39Ve4=; b=K8fRWIALL218JLaHUb6GeWDJhlK7Y2sFg1lEa9DBW4cy/Gj8mPuE1PH0cXHNqBOtZQvW5xIbdYJAFRvgYiTwlila1zjnEWFB/vkDNGTkWGH39VHYxMdckx2GsQuPzxT3N3/tpIE3UZse5Cer0bB4VVXy1NJicmWrWyzMrH+czDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672270785436.0527061672318; Wed, 18 Dec 2019 04:31:10 -0800 (PST) Received: from localhost ([::1]:53492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYTt-0001lx-K8 for importer@patchew.org; Wed, 18 Dec 2019 07:31:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48267) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3A-0006MZ-Q8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY39-0000hv-Ju for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:37766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY39-0000eD-9l for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:31 -0500 Received: by mail-wm1-x332.google.com with SMTP id f129so1611039wmf.2 for ; Wed, 18 Dec 2019 04:03:31 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:29 -0800 (PST) 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=M7st8zYRftA//6nYaWbb7lkO5v3FUGpG+F+usf39Ve4=; b=YfRJFl5VtYNlKCyjkld3TPF8k1UR3owE4ZgFqyH+mbdGd2b1eRM0XOaJQtgvyMH/lH mxPTB+J9CQ2c/4RORI8w3+TdZ6TgF8t9nV6PwCgyK59J0HljDMoC3umWYNbJqtlxCOcm /mLJxqy/WgWA1+6PU+L91+8G+rSqEThDJ/ybVXVU2K/CBuVDYpdvV/YRd5s8x4CmsN9s 78hGFpfqklfWyYQJweSn291wubwrsuKFNRRTg21BfcxoBmIfciCwabnwKwRX8OAWZrdw DRZKQgOi/4JuwuHRQvjFjlF16TRj1WE9ZYyZ3706KoW4q1bOaNufB13p/9goNHip1YBx 4/lA== 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=M7st8zYRftA//6nYaWbb7lkO5v3FUGpG+F+usf39Ve4=; b=lBONz5Bf/8rbUHKVIkBa15uaSFSMDitEOuFHdvtkSrX385yTL19BMnzp3vY+vsdBMB 4Pm+lIKOvD1BPD8ERlAJYqr4iHtuC0ygd7KnmHCJewvOX3CWnEn2xG5psCL7TyUqyV0u Dmhp+MOBiUCZsIGmhagpuDbDp3sjaRo0UNV6Z/UUdVo9AL0iEdMNDNl2HPwzh5sggzNY zmcNO0MavOS9bogZ5zSRV5EA2qbppoykGC22tpBedHvWfIEkf8MsKI6AP+QoKUB3kvxl +T7PtlBwJqWlb2p9Od0fw3xcOqUXGNIJfI/fRY+rGfDdjqXhRFBbEq936O0FdSQ753e4 fPTA== X-Gm-Message-State: APjAAAVGLp7zXSEckiD443rMp96hD73ZbVVoMJB/zgs0+4Y0xk4elN0d 6VYpMomwJM9Igk87q7nLrzMc1jVY X-Google-Smtp-Source: APXvYqxC01kCDU71i1V4ZVX8np9KmBC21m9bVHDEXAardiJnHHkPeLxsj9uRKiVYKV+mVkZq0zIhow== X-Received: by 2002:a7b:c317:: with SMTP id k23mr2887169wmj.75.1576670609806; Wed, 18 Dec 2019 04:03:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 34/87] migration: fix maybe-uninitialized warning Date: Wed, 18 Dec 2019 13:02:00 +0100 Message-Id: <1576670573-48048-35-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::332 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau ../migration/ram.c: In function =E2=80=98multifd_recv_thread=E2=80=99: /home/elmarco/src/qq/include/qapi/error.h:165:5: error: =E2=80=98block=E2= =80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitia= lized] 165 | error_setg_internal((errp), __FILE__, __LINE__, __func__, \ | ^~~~~~~~~~~~~~~~~~~ ../migration/ram.c:818:15: note: =E2=80=98block=E2=80=99 was declared here 818 | RAMBlock *block; | ^~~~~ Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- migration/ram.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 38070f1..219e3ca 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -863,15 +863,17 @@ static int multifd_recv_unfill_packet(MultiFDRecvPara= ms *p, Error **errp) p->next_packet_size =3D be32_to_cpu(packet->next_packet_size); p->packet_num =3D be64_to_cpu(packet->packet_num); =20 - if (p->pages->used) { - /* make sure that ramblock is 0 terminated */ - packet->ramblock[255] =3D 0; - block =3D qemu_ram_block_by_name(packet->ramblock); - if (!block) { - error_setg(errp, "multifd: unknown ram block %s", - packet->ramblock); - return -1; - } + if (p->pages->used =3D=3D 0) { + return 0; + } + + /* make sure that ramblock is 0 terminated */ + packet->ramblock[255] =3D 0; + block =3D qemu_ram_block_by_name(packet->ramblock); + if (!block) { + error_setg(errp, "multifd: unknown ram block %s", + packet->ramblock); + return -1; } =20 for (i =3D 0; i < p->pages->used; i++) { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671460; cv=none; d=zohomail.com; s=zohoarc; b=IWrkNJO84zR9Z8AJ0umQ9NBCRC6Rya6PU/Ci4HxiyVaTmU4V/bIURLpjmEf/FZ7dQkJG1sHZkbyqW0QxmciErMz6JtPKWJahjcF8WppqbSNNBcObE9Mb3L8ec4Y8t5i3n3QWI1zQABo7lLjoe3cJ+QSIBldbqM8jGCptwvrYh3o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671460; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=NABusbWK2RDVtNWDdA1xRJstrO0N2C/FzQIaTOYWc0xUInkAdJrZ/y08flkzLRcQJ0qkt2DA1jG40Dc+V3+NA1TQqUnKFc/W2I5LtyCCjqxPdBL3wPQ1mx/INja4hgUU7uIS4/YxoblTWTN8xBfS5/F/lFakO8AlYiWurIjHR0U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667146071791.31534009290374; Wed, 18 Dec 2019 04:17:40 -0800 (PST) Received: from localhost ([::1]:53330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYGn-0000Nc-Ie for importer@patchew.org; Wed, 18 Dec 2019 07:17:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48418) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3B-0006NX-H5 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3A-0000kh-9p for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:33 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46592) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3A-0000hB-1i for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: by mail-wr1-x434.google.com with SMTP id z7so1963174wrl.13 for ; Wed, 18 Dec 2019 04:03:31 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:30 -0800 (PST) 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=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=k74tXKopfKzRPy/wQkZEPWyGWwStkA7fEXXEmn2NxdV+grs0EapWmEJ2Afonm/eJjG GkX8+L6pr4Qc4wm3C06iM8VDGpyTTNIiF9J+qDZRcAkcpbJZbBs/OK/ta/szGZprBnLH nqksaUXuMKIxwElnc41+AiJ2zodKk3LfArk2WRzZ019vMN+nC/3WOavUwqdRGP6BUoat 2OYZQ1ErBOtXnpakoXJkddVW82XjuobCy/E4DSxayZDR14Qxc2LS/MAKFKG/wczXLaSF 6cyDX+EmSmR4tP2f+gkkbNgwQLVHp6s9Q2HSWBpdJT9ZVfFoBle/iFH4hku1VtEEGYaw l0Pg== 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=SnbM4HZb29FsG4J6fiW5WwWfE0ShjwYvCK5bmD3CYRU=; b=iNzep+bK90HrmKgTDTbnrX0+E+tGSAFJK84lMBvL42rZAx19g8aQzYBhjutIfraTD+ 0CFtX39tg+I3YHPYrBqiLvyAwu4+DEcC2UFGOCeug4x/qiXYGdsigj5q9agayp+16h1D xxwMA3G05t6Ii9kU+vkmXUjyO0ph0WQ076zFBDeKQ4pxY803E/Q5NmJckHJ7DgU1Ajg/ C6xaJt4BpOuKYc5z44UdhGvo3hnERMmCrC/n4yr07BFw0ROXA467seiwHhBw0o+TDyT7 GLA6oriwq2bUFDec05wMU5Tdx5UTkav7U0o+u2xTvoF84sDHe3X6+hAxkH02IkjBLJt8 iBhw== X-Gm-Message-State: APjAAAVd+lSMSEDTu7UC3URWQ1yHF+ustkCbKTLzWz3e9aqsB1G45NCo 1UXgp4MiGMZgPjvUGFrfTBg4ehT7 X-Google-Smtp-Source: APXvYqwE3r6OKAQOed6N+x8WWR8x6cTahbcHKP9KJJXfsw2dJMOzZ5XKEkY0k4YyE6MjKJSoGZ6F9A== X-Received: by 2002:a5d:6a8e:: with SMTP id s14mr2543802wru.150.1576670610728; Wed, 18 Dec 2019 04:03:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 35/87] monitor: fix maybe-uninitialized Date: Wed, 18 Dec 2019 13:02:01 +0100 Message-Id: <1576670573-48048-36-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::434 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau ../monitor/misc.c: In function =E2=80=98mon_get_cpu_sync=E2=80=99: /home/elmarco/src/qq/include/sysemu/hw_accel.h:22:9: error: =E2=80=98cpu=E2= =80=99 may be used uninitialized in this function [-Werror=3Dmaybe-uninitia= lized] 22 | kvm_cpu_synchronize_state(cpu); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../monitor/misc.c:397:15: note: =E2=80=98cpu=E2=80=99 was declared here 397 | CPUState *cpu; | ^~~ Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- monitor/misc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monitor/misc.c b/monitor/misc.c index 3baa15f..a74cff3 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -394,7 +394,7 @@ int monitor_set_cpu(int cpu_index) /* Callers must hold BQL. */ static CPUState *mon_get_cpu_sync(bool synchronize) { - CPUState *cpu; + CPUState *cpu =3D NULL; =20 if (cur_mon->mon_cpu_path) { cpu =3D (CPUState *) object_resolve_path_type(cur_mon->mon_cpu_pat= h, @@ -411,6 +411,7 @@ static CPUState *mon_get_cpu_sync(bool synchronize) monitor_set_cpu(first_cpu->cpu_index); cpu =3D first_cpu; } + assert(cpu !=3D NULL); if (synchronize) { cpu_synchronize_state(cpu); } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672441; cv=none; d=zohomail.com; s=zohoarc; b=cdgP1kB4NwjF6+IGGKv8GmBFdgcvfrIHLR+AB6liSQhRaituavyp4kKKQQlbvBkfQph5LQ62Oqu35pIKgB9dFqqSKuOm6EiNobTZ/1Ar9xetDp552nL6ejg25ILDUtNjc4wPz1tmBZUtNG0h1vmRv5NJ5tSvkVdybu6Nass+/Ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672441; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G3GeihMZT3FWsjutpTGVLlWKTkWWsva27E3p012qRdM=; b=ewtpCIXXbl6zXeAcXUtHXSpb4+uXuHcMwOVeEbTKL4mIxteIhv+RNfNZ1C2Srditd2XfhJtQJdN9VDPc0iGgqJgXuHOXzIkfnWOVfV8rNUj2H6XlGrqusU2IrNgAjjo8czW+8Mi1yZMZRnVIBcE5godxAj/Kjm14Woj4mfGRDJE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667244127853.57191615570457; Wed, 18 Dec 2019 04:34:01 -0800 (PST) Received: from localhost ([::1]:53534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYWd-0005jN-K1 for importer@patchew.org; Wed, 18 Dec 2019 07:33:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48559) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3C-0006OX-5p for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3B-0000nq-0j for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:33 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:45269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3A-0000jx-PY for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:32 -0500 Received: by mail-wr1-x42e.google.com with SMTP id j42so1972988wrj.12 for ; Wed, 18 Dec 2019 04:03:32 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:31 -0800 (PST) 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=G3GeihMZT3FWsjutpTGVLlWKTkWWsva27E3p012qRdM=; b=CFS9oj86sUF7LLkO19IkaBH++BMSH/tS5zPzmnbTWi/nSZ1FNFqbRjJZj/T9AYBctp e2TBe2xlsj8BiB9AHXVssQyno5WmQ7cinRWQQOeANh5JT+TVmXZtPJLI39cPzh9Ve/wQ bSWCNCKqsQhHTZcyCRGdQyhFCMTNqSobr4UBg2osxzWC7BWDnXeeISyxFQ9bcRvZbys7 NGnghwQhHRVVmGbRBhhiHGAK1JwDOKUH7q/Lq0iX6bw0aB+mn0KBZZJacqNjz4ORB7xX VbB8+mW8q6wJHDQlVWETp0ua+kGu5fQAyFs6ah1mIutWSpBUtH7geWau91zsfz6AmXmi mCHQ== 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=G3GeihMZT3FWsjutpTGVLlWKTkWWsva27E3p012qRdM=; b=XY0wvyew5Y0827EZ8MaMxVPKwFVqKsJuXVUmDbUSBJvYc7tHoZYq8/ZOafX8UxphZ/ AKFdSXItO0/nXVtzTL+6Y2GnoGb5BJKqMQhgGaepcMQ/3kuklDsX7RYK04VmMJ3OKBz+ Ion8W5jc4YPLixjpOeqyxD7+K47w43oWMZwuqtwD8FUqFCjD4Av99tifsOQ1B/yjH2Cs letG2Qy5krBRip9dTwWXtCJu6YXb7appxbmk33LwdRQg/2ot0O+zrn/Yl9EFvmQ6B66E iWDqrooGsp3QjxxMeSeE9SATu2fnKOo+u4Azw/bI3bwQF0UYn9XaTCL0uwKi0KyKZyy4 Diiw== X-Gm-Message-State: APjAAAX8SsRfMBu0F72TH0K3qkOoIteXHerrUH6cmy/Lw3LCVlUpLxOR oIX7YsOx13uKke7NjUknkmD4VqFI X-Google-Smtp-Source: APXvYqxbXVP6KGME1HcVxEnFzGiQTlOVs+3UObyZ4mUqY6Qs4LcKRpCSACNh3r/9tB1Xae9XbIaBkQ== X-Received: by 2002:adf:dd52:: with SMTP id u18mr2454929wrm.131.1576670611454; Wed, 18 Dec 2019 04:03:31 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 36/87] vhost-user-scsi: fix printf format warning Date: Wed, 18 Dec 2019 13:02:02 +0100 Message-Id: <1576670573-48048-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau Fixes: ../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wforma= t] g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5); Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user= -scsi/vhost-user-scsi.c index 0fc14d7..7a1db16 100644 --- a/contrib/vhost-user-scsi/vhost-user-scsi.c +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c @@ -115,7 +115,7 @@ static int get_cdb_len(uint8_t *cdb) case 4: return 16; case 5: return 12; } - g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5); + g_warning("Unable to determine cdb len (0x%02hhX)", (uint8_t)(cdb[0] >= > 5)); return -1; } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671647; cv=none; d=zohomail.com; s=zohoarc; b=FCN1r+5W0caK7nz24JP96d/XM2hmqKnjZINGSyNglCB4U+QCSlqCsm2IKoPTIZAEeDbel6VLW9jrG+HhNpP+N2oXjNo0nVJ8isqa+Cu0wiXfz/EQANk46WP8IEQshDAd9OaQXtg+tB0EHDGK5fYj/sLiJWntvVelOFPh7Xwcn/E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671647; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6P+O7fP7RdRxtrVlibSaBNIUsO6tN03n2SE/FwGlPpk=; b=dX37p28hhW/WUOlge3XQXSu8UqZ4Cvi9AQg81lDtnicCsNLk4ek12l76pto0gWwcEP2r7AqjIvK6r+uelIIQtYrIyO0XCUIlrG06lKeBMVlNh7rrTTeTWI+F+92IgK5mo9wxVBNUEgyEm0733rRujmZC5I3e4zKtHdLhrlSGtp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671647009578.3587877165025; Wed, 18 Dec 2019 04:20:47 -0800 (PST) Received: from localhost ([::1]:53354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYJp-0004CV-AV for importer@patchew.org; Wed, 18 Dec 2019 07:20:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48852) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3D-0006QG-D7 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3C-0000s2-3r for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:35 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:45881) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3B-0000oB-M4 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:33 -0500 Received: by mail-wr1-x442.google.com with SMTP id j42so1973029wrj.12 for ; Wed, 18 Dec 2019 04:03:33 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:31 -0800 (PST) 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=6P+O7fP7RdRxtrVlibSaBNIUsO6tN03n2SE/FwGlPpk=; b=miA0lSclqjGTCqb16hKq7TUktdbqTH6EHMZ0cO9YhwK56Tet4Lpkad0yOMsLx3o35B EbPjQmLDuREmFaFc5yblwlVZWLTMo6l3c7ggiTUEusGORrmb3Y/3WYaUWkdGsEbTuu5U mXh7BPUqnuR0ueMPyXVrIMrJE4ppSal7s03CquV8N4PfJ1UQezfnSNrOw5V6lDzZ7RIw rE16sda+6sJwEyNKXI4ZcQk/1jMtKwJO88kMLvEDq/HR8Ags07+9as3xTVyAIax32h6v 9jL6yu4g0Pcy2kdJqjWEEsEaDYSLC+UoelYWVrD1l0YCZU3yjnVoj+cn1DM07wdFUplF uHVg== 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=6P+O7fP7RdRxtrVlibSaBNIUsO6tN03n2SE/FwGlPpk=; b=M+JgVYP595UoQPOlJx9Z5tj42srwJLLp1CrFlLN+Tdf38ZUfCQLXgT1S3w9sXgje+6 I66bcf/oonU5VclmPGdKUEOv1jKkxd/3He5ujn+FXk2F7zZeKrmP/BkkD/m7Pfpg36P8 kBLyzqElK9vedO0ZuUBJ7qWa1GdKtxGtm1KAIe2i1DgI2rip1k7mBM7whh5mZkhs/v7Z 9YcOB208V5xhd4mTKqZLnZeZTYZ7MhB2ImFVTQvlDpseSqUKR5HWDEmANw+tVIxtN2gb H6i9r75NW5k05k+nFEFX9MJjr6cDzf3BHs5eEL+7i1xPQn+urrjl1GkXVtQ51bGiK8iK rbqQ== X-Gm-Message-State: APjAAAVP6dor6LT2jugh9rprRSpt0kdPfOIhDsJxebCsgOF3hf6FJknM TvP1WnJO+0K/LXk4RdMXHbx8QUJV X-Google-Smtp-Source: APXvYqxoQCnU/nZNlnbJF3WG5vf098NEyOV8+e4CbePt/kVlJvX8VOvZm1T6AWMumYA5rSrXynUJ8g== X-Received: by 2002:a5d:50cf:: with SMTP id f15mr2430490wrt.381.1576670612469; Wed, 18 Dec 2019 04:03:32 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 37/87] os-posix: simplify os_find_datadir Date: Wed, 18 Dec 2019 13:02:03 +0100 Message-Id: <1576670573-48048-38-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau Use g_build_filename instead of sprintf, and g_autofree instead of manual freeing. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- os-posix.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/os-posix.c b/os-posix.c index 86cffd2..3cd52e1 100644 --- a/os-posix.c +++ b/os-posix.c @@ -80,41 +80,26 @@ void os_setup_signal_handling(void) sigaction(SIGTERM, &act, NULL); } =20 -/* Find a likely location for support files using the location of the bina= ry. - For installed binaries this will be "$bindir/../share/qemu". When - running from the build tree this will be "$bindir/../pc-bios". */ -#define SHARE_SUFFIX "/share/qemu" -#define BUILD_SUFFIX "/pc-bios" +/* + * Find a likely location for support files using the location of the bina= ry. + * When running from the build tree this will be "$bindir/../pc-bios". + * Otherwise, this is CONFIG_QEMU_DATADIR. + */ char *os_find_datadir(void) { - char *dir, *exec_dir; - char *res; - size_t max_len; + g_autofree char *exec_dir =3D NULL; + g_autofree char *dir =3D NULL; =20 exec_dir =3D qemu_get_exec_dir(); - if (exec_dir =3D=3D NULL) { - return NULL; - } - dir =3D g_path_get_dirname(exec_dir); - - max_len =3D strlen(dir) + - MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1; - res =3D g_malloc0(max_len); - snprintf(res, max_len, "%s%s", dir, SHARE_SUFFIX); - if (access(res, R_OK)) { - snprintf(res, max_len, "%s%s", dir, BUILD_SUFFIX); - if (access(res, R_OK)) { - g_free(res); - res =3D NULL; - } + g_return_val_if_fail(exec_dir !=3D NULL, NULL); + + dir =3D g_build_filename(exec_dir, "..", "pc-bios", NULL); + if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { + return g_steal_pointer(&dir); } =20 - g_free(dir); - g_free(exec_dir); - return res; + return g_strdup(CONFIG_QEMU_DATADIR); } -#undef SHARE_SUFFIX -#undef BUILD_SUFFIX =20 void os_set_proc_name(const char *s) { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671797; cv=none; d=zohomail.com; s=zohoarc; b=Byo/1HlM3KZoPEvMePxDe7+ocmmSoySXxp6NtH+UDefnGOHLu0RPSymuWXV2N34OWiH2qY8KKKobFUdZfUK6zojQocT1TEi+ioiSHqJxcgiyh6W9bZ44gzAwoGl7UDNbxjZOTIZY+pMV4/+CAf8JUQUoWT7TON7Qzas0vqXoUMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671797; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mfpu4YCJ7dJvQ7hqXOMh4Cdm0EQQJgAWWvy/fePDydo=; b=SqrJD7IBbMunXlXc9y3jr+qDftA8nRhQz9N66CWTX7bhsddPafpMfKTNdoWFAk6DBZwxcHNaaRi+Wc1hMCvQnqPGadEB2Rx30xNgcMkKYDwqr58m2DI5A93nS5MhSKWw217haCUQJu6GFJn6lMOmgAAUQBALY8Ap7Xe7bGHPsvw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671797062567.2652779226459; Wed, 18 Dec 2019 04:23:17 -0800 (PST) Received: from localhost ([::1]:53392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYMF-0007qb-Cu for importer@patchew.org; Wed, 18 Dec 2019 07:23:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49088) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3E-0006Rp-DV for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3D-0000xs-93 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:36 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:35430) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3C-0000sr-Tc for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:35 -0500 Received: by mail-wr1-x42b.google.com with SMTP id g17so2023311wro.2 for ; Wed, 18 Dec 2019 04:03:34 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:32 -0800 (PST) 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=mfpu4YCJ7dJvQ7hqXOMh4Cdm0EQQJgAWWvy/fePDydo=; b=eY4dAjrR4BenAwAvVqApiGbu2+qico3fnFjfdModZaarIiZ+R+lmSw45PfQfbTikKo iXL0PgWG7R9H2UmRZPgkEI2Sqa+um/iEGRnd4n9+/x6r13yGR9WfFyNgU107MM9k7Cjb Mg6nP/RcEn+gXMdP+ibc6lIkjD51ua9UXYSPoD66iKX4wb8wrLubA1fbcam3kWKbvP2H Jtn+ITNvfvynWwBt2glIXGFzjpPDxWHwtU2o2vf8vthvTQvUrXIX6L1aFWe42xyEecw5 VpQ+fdTw0ukqrkOPG4j32mSTKyQO/8jj30WIMeGjyXRcSDS98cyqXvQcfz3OzNkiM4I5 TS/A== 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=mfpu4YCJ7dJvQ7hqXOMh4Cdm0EQQJgAWWvy/fePDydo=; b=I/LXfAM0kJ2+S4BrusmdVJOTIvuDuMTQ/47mN6w1fHjEPt06H6O2xoW3xYbKR8t9bJ dnI8+d203Zb73SS0F0o1vEJHZqIZax1R1MpmqoMTXNOoTevFj3lOPyO9dFCqZiHbQ2Mn PA2eTkVweVT/rRw8dct1BA5AkxnrgUF84m5ayiGY7daBEuvOXzrMCOjeTTa64znlTEe9 0K+pESkt5pSffJGNyxPgI4VfDQlyl5naKUgaLlegsNSqayTOPOwIDtu0/+yJcQgC2V0g NiPI3uUIaB1BGpRHfD0NGAyw6VMHwEQL1oFv99tgSBVkCcEQcwC5NSg63L8l2vNtHnWG MX8A== X-Gm-Message-State: APjAAAVk3ww0HUnyuVQ0ELwgQ+RfOyrEU50axWrFeUKp2sDu5lEk+Aq9 +FmdVI/mCW742WfO4d2WmKHiCutt X-Google-Smtp-Source: APXvYqzOPeJDy3NTt/HGG/6KwgbqOa88zuH2ot01zUAVuW0PbtlPQrT/SXwryZkjSoIjzicox8ecCg== X-Received: by 2002:a05:6000:f:: with SMTP id h15mr2361840wrx.90.1576670613222; Wed, 18 Dec 2019 04:03:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 38/87] tests: skip block layer tests if !CONFIG_TOOLS Date: Wed, 18 Dec 2019 13:02:04 +0100 Message-Id: <1576670573-48048-39-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::42b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau The block tests, as well as ahci-test needs qemu-img. Do not run them if it wasn't built. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index b381387..31b8667 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -167,7 +167,7 @@ check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) +=3D tests/ivs= hmem-test$(EXESUF) check-qtest-i386-$(CONFIG_ISA_TESTDEV) =3D tests/endianness-test$(EXESUF) check-qtest-i386-y +=3D tests/fdc-test$(EXESUF) check-qtest-i386-y +=3D tests/ide-test$(EXESUF) -check-qtest-i386-y +=3D tests/ahci-test$(EXESUF) +check-qtest-i386-$(CONFIG_TOOLS) +=3D tests/ahci-test$(EXESUF) check-qtest-i386-y +=3D tests/hd-geo-test$(EXESUF) check-qtest-i386-y +=3D tests/boot-order-test$(EXESUF) check-qtest-i386-y +=3D tests/bios-tables-test$(EXESUF) @@ -1191,7 +1191,9 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) .PHONY: check-block check-qapi-schema check-qtest check-unit check check-c= lean check-qapi-schema: check-tests/qapi-schema/frontend check-tests/qapi-schem= a/doc-good.texi check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS)) +ifeq ($(CONFIG_TOOLS),y) check-block: $(patsubst %,check-%, $(check-block-y)) +endif check: check-block check-qapi-schema check-unit check-softfloat check-qtes= t check-decodetree check-clean: rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y) --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672580; cv=none; d=zohomail.com; s=zohoarc; b=m2gWCDMz1Eugge24QLpmB/TwZS1wzesrhzKvtQoeEtwNnpA9Udb2J8Esiw7dtTI7W5mlzTLdf7TxtezK30Bjx/H8WT0v26waq4lEykU3PFV+DbtboFmB73FUUQPOz6wUYnRPrE+eE1JRppOOj9YslpSUnuUBZCRDY6jwHh5R5xs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672580; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L79BeMo6HCbokM7jk/FE+RUtQdWgo2iqz0AB4yqz6vk=; b=U+hLPjEU4p4aYMzjelLl0iL3M+YcvkVdkIhlPVdT1Hsz1GR/U3R+QO7D5aPUqX2md2wcCVyxHsO5WbOOGdhT3fpXyTchL3iHm62det3bKPn21asr3tRD2qKzb8JlZHlpuJJD4VPmpHuC+apaDznrklHSo0/E1X9XbPAodLkT3Ds= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672580113487.13821618369855; Wed, 18 Dec 2019 04:36:20 -0800 (PST) Received: from localhost ([::1]:53570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYYs-0001W1-Fp for importer@patchew.org; Wed, 18 Dec 2019 07:36:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49176) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3E-0006SO-Pm for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3D-0000zF-Iw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:36 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:33882) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3D-0000vL-AQ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:35 -0500 Received: by mail-wr1-x42a.google.com with SMTP id t2so2029455wrr.1 for ; Wed, 18 Dec 2019 04:03:35 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:33 -0800 (PST) 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=L79BeMo6HCbokM7jk/FE+RUtQdWgo2iqz0AB4yqz6vk=; b=UV9lOaC5XmWEP5z0PqS0z0dx1KheABVCpwVFnzDTXvYdAwiXvA5rX14si+dl1DpazR 6g2DzxJrzJ3VQtcuYJQ5l0P89MU8lUivf67txxNCZz743we/k315KVvc3oPdz5e0S9gB Y97n5e9cOQfRapWl+5geu8Yy/QSnhdoe/egvZHnCalLkUpE2khXpUoGqyZoMQsGzJck3 THyy1teXcl2wSM4wUnokRl5IzqpFM7JMpk8ptfPl8MpOB0ljNRlH5Bh4JNqodAx2NMNM v1QLuTPPzX8PDLjzjentTip9qTBNMoXQtk/+P0B3kImp2SybhMPqgTK4OGz9C8Jj6Jxh aBDw== 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=L79BeMo6HCbokM7jk/FE+RUtQdWgo2iqz0AB4yqz6vk=; b=JAoG3A2Zav8dTzPLmsIjcHHbTcR6MtVrIhnRrDXfr4NMdpF1W3EIP6q5CUB1vuSQDm GTvH65jknPH9q3zcA4SUS7J5RGpnt+LuAL93ntMgdKbh6RuxCYeCIzjy8QGgT1CHBWJi Tr5rqESAtmNImkA+b/CmqbRfcSm2jyeUkeebqFbU404rkieW07lMoP8ySLsKz9rqB2s1 LnPCRRq6tDe5RAlUjoUfGuY54stLd3FhPC+gp+O0CA7VNFrM+FhDrHukpD2R8Y9Dljos bhVFe6tYZXFGpb1zDzAo1CVuwxg4CzGrk5Mf9siSmuQ+zQUFg39N5jC1z5/tsCdQW4/t kd4A== X-Gm-Message-State: APjAAAURNMpTVoQNPRO3o6ff1GCVsLdeOz4l6b5ry+FFS6WAokQSbrjY OaR2rCycQcc+E397KUG+BwizoyUC X-Google-Smtp-Source: APXvYqwwEzEurWIm97zSIrJpEdZtBWNFRphdyJeuKJlhyeP0SapFX2dkvGYb0EOsXWqYDes2kb4DzQ== X-Received: by 2002:adf:f605:: with SMTP id t5mr2405919wrp.282.1576670614055; Wed, 18 Dec 2019 04:03:34 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 39/87] libvixl: remove per-target compiler flags Date: Wed, 18 Dec 2019 13:02:05 +0100 Message-Id: <1576670573-48048-40-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are already including -D__STDC_LIMIT_MACROS in the global CXXFLAGS, so it makes sense to do the same for -D__STDC_CONSTANT_MACROS and -D__STDC_FORMAT_MACROS instead of limiting that to libvixl. The -Wno-sign-compare option can also be removed since GCC 4.6 is not supported anymore. Signed-off-by: Paolo Bonzini --- configure | 3 ++- disas/libvixl/Makefile.objs | 11 +---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 55d386c..0a63c75 100755 --- a/configure +++ b/configure @@ -101,7 +101,7 @@ update_cxxflags() { # Set QEMU_CXXFLAGS from QEMU_CFLAGS by filtering out those # options which some versions of GCC's C++ compiler complain about # because they only make sense for C programs. - QEMU_CXXFLAGS=3D"$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS" + QEMU_CXXFLAGS=3D"$QEMU_CXXFLAGS -D__STDC_LIMIT_MACROS -D__STDC_CONSTAN= T_MACROS -D__STDC_FORMAT_MACROS" =20 for arg in $QEMU_CFLAGS; do case $arg in @@ -595,6 +595,7 @@ QEMU_CFLAGS=3D"-Wall -Wundef -Wwrite-strings -Wmissing-= prototypes $QEMU_CFLAGS" QEMU_CFLAGS=3D"-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS" QEMU_CFLAGS=3D"-D_GNU_SOURCE -D_FILE_OFFSET_BITS=3D64 -D_LARGEFILE_SOURCE = $QEMU_CFLAGS" QEMU_INCLUDES=3D"-iquote . -iquote \$(SRC_PATH) -iquote \$(SRC_PATH)/accel= /tcg -iquote \$(SRC_PATH)/include" +QEMU_INCLUDES=3D"$QEMU_INCLUDES -iquote \$(SRC_PATH)/disas/libvixl" if test "$debug_info" =3D "yes"; then CFLAGS=3D"-g $CFLAGS" LDFLAGS=3D"-g $LDFLAGS" diff --git a/disas/libvixl/Makefile.objs b/disas/libvixl/Makefile.objs index 27183b7..99a637f 100644 --- a/disas/libvixl/Makefile.objs +++ b/disas/libvixl/Makefile.objs @@ -1,14 +1,5 @@ -libvixl_OBJS =3D vixl/utils.o \ +common-obj-$(CONFIG_ARM_A64_DIS) =3D vixl/utils.o \ vixl/compiler-intrinsics.o \ vixl/a64/instructions-a64.o \ vixl/a64/decoder-a64.o \ vixl/a64/disasm-a64.o - -# The -Wno-sign-compare is needed only for gcc 4.6, which complains about -# some signed-unsigned equality comparisons which later gcc versions do no= t. -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS :=3D -I$(SRC_PATH)/dis= as/libvixl $(QEMU_CXXFLAGS) -Wno-sign-compare -# Ensure that C99 macros are defined regardless of the inclusion order of -# headers in vixl. This is required at least on NetBSD. -$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CXXFLAGS +=3D -D__STDC_CONSTANT= _MACROS -D__STDC_FORMAT_MACROS - -common-obj-$(CONFIG_ARM_A64_DIS) +=3D $(libvixl_OBJS) --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672207; cv=none; d=zohomail.com; s=zohoarc; b=Q9jFjcgs7xZHu13lQzyQ9rgJH/BVgk8ybYBFj3i4DfZJ+TK6ysXqveATzp7iptSs50JV1UzHIzeJDgx5YcxsbQfg/ATLoOMpyMlNYFWM028OYqbAhs7UN/EyjDAOXBbpneNFDK6Z/I0gGRZR+M7q2EtMehmWaXL3+H5FLuFJRpc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672207; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=GM9FF6o5yd7hCzXYevTaivpadzWj/BJulQGpyMX5be0=; b=OluNwz9nGCtVB+F9//WPprHhgz1VMxAQhbjdfy2/wHIiOfYNK9VFeOdv74Vow+iU7FV/6TsvVhlgMAHnI7PrKgx/kZCKiBgZaPmev+dl23i/S7f64IO5IkThAfsZnsvA0Oq8x1uQ1Nh1Wd4l7roVBPuK9KM0VFsmy56cPrheG/g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672207353981.1234308687215; Wed, 18 Dec 2019 04:30:07 -0800 (PST) Received: from localhost ([::1]:53478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYSr-0000cA-MO for importer@patchew.org; Wed, 18 Dec 2019 07:30:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49430) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3J-0006Vy-7k for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3E-00015G-UO for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:40 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:39061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3E-00011a-Li for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:36 -0500 Received: by mail-wr1-x441.google.com with SMTP id y11so2003902wrt.6 for ; Wed, 18 Dec 2019 04:03:36 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:34 -0800 (PST) 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=GM9FF6o5yd7hCzXYevTaivpadzWj/BJulQGpyMX5be0=; b=Sd2g5GXftq3YafHZXwxF5XxdTHv6loIrpwFQftLKC9j425UPulQ1y5Uz9HBXu875yz wHnW2ZqxpIqbIdFvdsZRClhx+CmqPFTb2i8TjBnCEpKcessCnN4Iv4iIa02znGKFiG87 ogQSpaOFhIkkcFKjM4NKuk3B/jBWp/5uRMUECE57SS5ga8tjGc/kIwf1GhpHLASbunnI p3cah7ncht3cpDH4IyETu67i62e0luJxcV6XiMDSK1C9ASpqYvOp6iP2MGnBLzsa9b25 J4Z8Eddb4eaoOZTlQaZerncch3AgkiYRIldi8fq4+Ye0X6idpWBSt7qErbosmWGvIzZ8 5qYQ== 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=GM9FF6o5yd7hCzXYevTaivpadzWj/BJulQGpyMX5be0=; b=Mh2ukou1K38fQvHCLPMiJhcYp+EQtJNI9OgYKPrqP9bfmt5GUAs1jp04GM3rTpnzxr pVehp71LwCC3uZBjGIugCb6tSSM0wXM6Oz+Q4jQcb6RLH7FzRhuHDN327NRswJbqiHde Pg3JKP+i634sH9MQKN0UgnwxToC1AVoGw7xX+d6dSHIxJiSPV1i61yuGPqXFvr0GyeIj JmjrzcswX3RsphSFAQ0wjfKaz/cCkrGauAJDHhJrF0tWbYQX2bNwFdnTSW/0dVmia+mS tmI9V7g/ZhjlnI/6oF3MxMe+AaWw08w7+RK3Px2/i7Z+u6psFki0375vBeX+yJQYkn3K Rx8A== X-Gm-Message-State: APjAAAVvn68N1oKfqbfELYL02rvZZvPX2YcMYiFlnBIZ9zYrYOyR+XSR B9GxJJ13pvhukZW/lH+gN0yyK2Af X-Google-Smtp-Source: APXvYqypfWrJkjuvA0SSLA0CPvpwE0cjY+hdqVH8jXaoSClh+yIMZR0c7xF1I6ZW/QaX4mbWdnqgNA== X-Received: by 2002:adf:f98c:: with SMTP id f12mr2370586wrr.138.1576670615018; Wed, 18 Dec 2019 04:03:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 40/87] crypto: move common bits for all emulators to libqemuutil Date: Wed, 18 Dec 2019 13:02:06 +0100 Message-Id: <1576670573-48048-41-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" qcrypto_random_*, AES and qcrypto_init do not need to be linked as a whole and are the only parts that are used by user-mode emulation. Place them in libqemuutil, so that whatever needs them will pick them up automatically. Signed-off-by: Paolo Bonzini --- Makefile | 3 +-- Makefile.objs | 3 +-- Makefile.target | 2 -- crypto/Makefile.objs | 12 +++++------- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index bfd8ba3..fb1728e 100644 --- a/Makefile +++ b/Makefile @@ -436,7 +436,6 @@ dummy :=3D $(call unnest-vars,, \ block-obj-y \ block-obj-m \ crypto-obj-y \ - crypto-user-obj-y \ qom-obj-y \ io-obj-y \ common-obj-y \ @@ -524,7 +523,7 @@ subdir-capstone: capstone/all subdir-slirp: slirp/all =20 $(filter %/all, $(TARGET_DIRS_RULES)): libqemuutil.a $(common-obj-y) \ - $(qom-obj-y) $(crypto-user-obj-$(CONFIG_USER_ONLY)) + $(qom-obj-y) =20 ROM_DIRS =3D $(addprefix pc-bios/, $(ROMS)) ROM_DIRS_RULES=3D$(foreach t, all clean, $(addsuffix /$(t), $(ROM_DIRS))) diff --git a/Makefile.objs b/Makefile.objs index c4bc783..6807c8b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -1,7 +1,7 @@ ####################################################################### # Common libraries for tools and emulators stub-obj-y =3D stubs/ util/ crypto/ -util-obj-y =3D util/ qobject/ qapi/ +util-obj-y =3D crypto/ util/ qobject/ qapi/ =20 chardev-obj-y =3D chardev/ =20 @@ -25,7 +25,6 @@ block-obj-m =3D block/ # crypto-obj-y is code used by both qemu system emulation and qemu-img =20 crypto-obj-y =3D crypto/ -crypto-user-obj-y =3D crypto/ =20 ####################################################################### # qom-obj-y is code used by both qemu system emulation and qemu-img diff --git a/Makefile.target b/Makefile.target index 24d79d2..6e61f60 100644 --- a/Makefile.target +++ b/Makefile.target @@ -184,7 +184,6 @@ dummy :=3D $(call unnest-vars,.., \ block-obj-m \ chardev-obj-y \ crypto-obj-y \ - crypto-user-obj-y \ qom-obj-y \ io-obj-y \ common-obj-y \ @@ -193,7 +192,6 @@ all-obj-y +=3D $(common-obj-y) all-obj-y +=3D $(qom-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(authz-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(block-obj-y) $(chardev-obj-y) -all-obj-$(CONFIG_USER_ONLY) +=3D $(crypto-user-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(crypto-obj-y) all-obj-$(CONFIG_SOFTMMU) +=3D $(io-obj-y) =20 diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs index cdb01f9..58014d1 100644 --- a/crypto/Makefile.objs +++ b/crypto/Makefile.objs @@ -19,10 +19,6 @@ crypto-obj-y +=3D tlscredspsk.o crypto-obj-y +=3D tlscredsx509.o crypto-obj-y +=3D tlssession.o crypto-obj-y +=3D secret.o -crypto-rng-obj-$(CONFIG_GCRYPT) +=3D random-gcrypt.o -crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) +=3D random-gnutl= s.o -crypto-rng-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) +=3D ra= ndom-platform.o -crypto-obj-y +=3D $(crypto-rng-obj-y) crypto-obj-y +=3D pbkdf.o crypto-obj-$(CONFIG_NETTLE) +=3D pbkdf-nettle.o crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) +=3D pbkdf-gcrypt.o @@ -36,7 +32,9 @@ crypto-obj-y +=3D block.o crypto-obj-y +=3D block-qcow.o crypto-obj-y +=3D block-luks.o =20 -# Let the userspace emulators avoid linking stuff they won't use. -crypto-user-obj-y =3D aes.o $(crypto-rng-obj-y) init.o - stub-obj-y +=3D pbkdf-stub.o + +util-obj-$(CONFIG_GCRYPT) +=3D random-gcrypt.o +util-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) +=3D random-gnutls.o +util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) +=3D random-p= latform.o +util-obj-y +=3D aes.o init.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576671949; cv=none; d=zohomail.com; s=zohoarc; b=G4hiEe6m46/JyTs9c/UHaIApQBfzjRpxTOpmN9raE0ugEluKDr+lsGYI4AQFxs+CVTSRhWB6Q6zNP6YqRc98jQ2X0/r1RR/V7CDosTvt92qAJ8LKd6v/29XNdir7bsUGjWVIW5//d6LLHHS+hMvYxUVPq7PvT45GQ2MVUlXRO5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576671949; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=eX9q8umIrXfd/sk2F6QDWc9JJlH4gBHHbDDQi+DXr74=; b=UJjOKgLP8BDj1gi1mm5oMbdTJHF2RDpfXKhL8vNiPqTanEwxeF44+4uzSonuFTS5bnMikdwPGHqPPFC80LLBTifb4ksxFm5Bx3eruPvpf54WzsY9AUlvXtYe2G1pPr4ft3cK9oGJhEWAJPHvtiwHq1CKHV/p/TazQL86WPj7KgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576671949620489.67232365727034; Wed, 18 Dec 2019 04:25:49 -0800 (PST) Received: from localhost ([::1]:53420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYOh-00032T-TO for importer@patchew.org; Wed, 18 Dec 2019 07:25:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49404) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3J-0006Vx-5r for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3F-00016n-8b for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:40 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:44234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3E-000138-Up for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:37 -0500 Received: by mail-wr1-x42e.google.com with SMTP id q10so1984378wrm.11 for ; Wed, 18 Dec 2019 04:03:36 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:35 -0800 (PST) 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=eX9q8umIrXfd/sk2F6QDWc9JJlH4gBHHbDDQi+DXr74=; b=WF2pFPF6046r/94+RXAsFrjvf99tn68ygwUA/3wE+AXgvZgD5C3NbfjkQPJQd+9pS5 hbhGOS3s3D/BEG+zyaLlyjDFxZsKSpoLcxG26BaW47xGLoYm3WVW8dgKAgVff4D7ow3D jPqkBM73c0oMKfTE17GEtXRa6/q7ZOAlvfBjQ3nwDJ37Gjri3qJ2jwJYwGFwceeyMAqC 4UvKdM4Xbv5Ng3G41HmGhzexqDGe+3fAGEod9tFsSe4ah4gCSITV/IJZtsLc5OcnY/69 9G6jivNK6TGBgDJVnGfA5wMvG1OMMP44aZJsrQjjoRXB80+jmI/Tw2dRuMMRI5gA3sCc b6OQ== 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=eX9q8umIrXfd/sk2F6QDWc9JJlH4gBHHbDDQi+DXr74=; b=H7USb3bs4OqnKHfXh7t3lCqudMB1DOW3Z7pc01b5pdzOc65bRb1JjB3GO1FnQH5QT6 GcjbOVwFzco3fuQd5bBmqfGLkYP/OZN0HaM/DsxLXW9U6sh+VbN90tqruADMsgr5JwYF FxnQCa/QijK6XZpt2E6OKHiG8J23qwIl6fWIwzLLWk2cy/1fVqdNlMNDLtcHv2gU0+Kw QoZylaeyXpOT+XEws/4txjOFB2nLjbptAN02MtBsKy6Y14U1MLJz+iGO2AZRUYoDATs2 sXo4YN14TUOAl1ZrUz9hdmdOtR5ANetI+l967BNhPlE7Y6M8L8THiVug6upfkYeWE9Rw 39QA== X-Gm-Message-State: APjAAAXzKKMVDCcK000Vk/oJ2Br4cqX/e/vG1P0AkeBrbBLUEK6d+kwq dViddAgOwAGMMltqeNHRh/uAsO0U X-Google-Smtp-Source: APXvYqwWIGQadIUjviFhD2SIc7xN7alqSD5fNrkcwVRIGIhWuEFN76RXxmcM/mjDBRZZZsOQITYUJQ== X-Received: by 2002:adf:d184:: with SMTP id v4mr2489334wrc.76.1576670615832; Wed, 18 Dec 2019 04:03:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 41/87] stubs: replace stubs with lnot if applicable Date: Wed, 18 Dec 2019 13:02:07 +0100 Message-Id: <1576670573-48048-42-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The stubs mechanism relies on static libraries and compilation order, which is a bit brittle and should be avoided unless necessary. Replace it with Boolean operations on CONFIG_* symbols. Signed-off-by: Paolo Bonzini --- Makefile.objs | 2 +- crypto/Makefile.objs | 3 +-- util/Makefile.objs | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile.objs b/Makefile.objs index 6807c8b..02bf5ce 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -1,6 +1,6 @@ ####################################################################### # Common libraries for tools and emulators -stub-obj-y =3D stubs/ util/ crypto/ +stub-obj-y =3D stubs/ util-obj-y =3D crypto/ util/ qobject/ qapi/ =20 chardev-obj-y =3D chardev/ diff --git a/crypto/Makefile.objs b/crypto/Makefile.objs index 58014d1..c2a371b 100644 --- a/crypto/Makefile.objs +++ b/crypto/Makefile.objs @@ -22,6 +22,7 @@ crypto-obj-y +=3D secret.o crypto-obj-y +=3D pbkdf.o crypto-obj-$(CONFIG_NETTLE) +=3D pbkdf-nettle.o crypto-obj-$(if $(CONFIG_NETTLE),n,$(CONFIG_GCRYPT)) +=3D pbkdf-gcrypt.o +crypto-obj-$(if $(CONFIG_NETTLE),n,$(if $(CONFIG_GCRYPT),n,y)) +=3D pbkdf-= stub.o crypto-obj-y +=3D ivgen.o crypto-obj-y +=3D ivgen-essiv.o crypto-obj-y +=3D ivgen-plain.o @@ -32,8 +33,6 @@ crypto-obj-y +=3D block.o crypto-obj-y +=3D block-qcow.o crypto-obj-y +=3D block-luks.o =20 -stub-obj-y +=3D pbkdf-stub.o - util-obj-$(CONFIG_GCRYPT) +=3D random-gcrypt.o util-obj-$(if $(CONFIG_GCRYPT),n,$(CONFIG_GNUTLS)) +=3D random-gnutls.o util-obj-$(if $(CONFIG_GCRYPT),n,$(if $(CONFIG_GNUTLS),n,y)) +=3D random-p= latform.o diff --git a/util/Makefile.objs b/util/Makefile.objs index df124af..63599d6 100644 --- a/util/Makefile.objs +++ b/util/Makefile.objs @@ -52,8 +52,7 @@ util-obj-y +=3D stats64.o util-obj-y +=3D systemd.o util-obj-y +=3D iova-tree.o util-obj-$(CONFIG_INOTIFY1) +=3D filemonitor-inotify.o +util-obj-$(call lnot,$(CONFIG_INOTIFY1)) +=3D filemonitor-stub.o util-obj-$(CONFIG_LINUX) +=3D vfio-helpers.o util-obj-$(CONFIG_POSIX) +=3D drm.o util-obj-y +=3D guest-random.o - -stub-obj-y +=3D filemonitor-stub.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672712; cv=none; d=zohomail.com; s=zohoarc; b=iqVnHWjflygY7m/+QLK6aMX/vYJP/X0bFAoJ1xWGm2ZTx2P2HvjW+C20Z0anUhCuVm2m5KoIo1R18yDuU4vpSGHZCYB3HkhAGqlQvZxd2PKSoiH31mhXOVA/Vb4S8CaWlPksQukw8CzNnGBta92s2sGWn8ihkRbTb1mDEnPBRg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672712; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=4/VXcI8eYmiuGhNIitLwvxt1jFWhzm+DXm68V+YOb4o=; b=iodvcbeAfOZLqJjTy5rIxekxDBe15kNiKmpaPP98/HbYHs59Q12F0tWPWE12OUMvIoI9yf3ySylZig6ZpJC9mxRVd16n5Z4nWYq80gOZz72btxOWRl3zLAU7kjSDXJ+3UBYAK/d7To15+gBXdwWPsB6QcyFhYEnl1gmVJz6RRjQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672712385426.75693661102184; Wed, 18 Dec 2019 04:38:32 -0800 (PST) Received: from localhost ([::1]:53594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYb0-0004vS-SZ for importer@patchew.org; Wed, 18 Dec 2019 07:38:30 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49832) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3L-0006Z7-Bg for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3J-00018V-4m for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:43 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:35440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3I-00017E-3u for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:41 -0500 Received: by mail-wr1-x435.google.com with SMTP id g17so2023493wro.2 for ; Wed, 18 Dec 2019 04:03:37 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:36 -0800 (PST) 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=4/VXcI8eYmiuGhNIitLwvxt1jFWhzm+DXm68V+YOb4o=; b=izDV2WSVLptNxaVwpq3bnK/bq+mS1jjT+xY1S5CtpCTN9DFfAKrB56crU1OPH61kEx B5yft5flSDXIAg1XweSxOYtOmYXeePo/5SwAxasrVxtdPhovKu4gdtq0bp1KHzMVMd8Z ZOVdgiytikqGHDdE5qEG3Pqhp9QaQg8R+3Sy79TbnC80XqcVmZPKDtZ9QHcJV0vQqxvP OTHcHK5DRNifJd85U+pFad7pSfYAlhTdkXq9Np1PIXUqh+0IdZMQMHVYBKChJvepdBFB 6BuB5AmINuCqC2b7CG+gbXJiXweas8DYWXJ//c9Y6/z5BFmQrJ5ghRPXLN8BsrbQxeSH zESA== 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=4/VXcI8eYmiuGhNIitLwvxt1jFWhzm+DXm68V+YOb4o=; b=eAS92bwWN8rvqxkVEE8QZjZLnlGKTCWxdObCB2VEr1sATSb7+Y1drGXbH8Bot4mHYm PV8vEWrn1IGTm87l2dO1L6JVNkYQsX0MFt5udDGmx6nWr3cBKjQs+xbGFzImqtqwulWI khcz45TbLdF15jQ3WWfIquezSUR7MWBEhuDUTCbn+XvV9AtI9pRVC/1p+PH9y6pyYm61 6N25fS9UjagaxGOd1CU3qxVZZrAP8ol86Qvr1ZdvDDbMQj8Ez0pxDeB7jZRhXsfkrB1d yQc46rTLrHk/iKZPvhIXb0PArl5jnOwtuP3SL1nFvbz7IK7fVwp0he0sutS25fJZY+BT IIJw== X-Gm-Message-State: APjAAAWyvDoYboI93dbHf6nPdjmca8sra1Q/c+mR5BfBZ/+YIwPH3yeq tYNRxmTUag9ixwe2c1T7db5Su9zB X-Google-Smtp-Source: APXvYqzicw4FYBOIO3B6wE5/hGTq4I4shso9U0BjbYa2ADuz5rvsXECEz9ClM12tzuruFce6IgbXyA== X-Received: by 2002:a5d:4085:: with SMTP id o5mr2387051wrp.321.1576670616727; Wed, 18 Dec 2019 04:03:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 42/87] configure: set $PYTHON to a full path Date: Wed, 18 Dec 2019 13:02:08 +0100 Message-Id: <1576670573-48048-43-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::435 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This will make it possible to replace it in a shebang line. Signed-off-by: Paolo Bonzini --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 0a63c75..2943f5d 100755 --- a/configure +++ b/configure @@ -908,7 +908,7 @@ for binary in "${PYTHON-python3}" python python2 do if has "$binary" then - python=3D"$binary" + python=3D$(command -v "$binary") break fi done --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672613; cv=none; d=zohomail.com; s=zohoarc; b=SwSTAqm/4UPj87qQWmnJXNsiLJ5bYfIwaPpG+oDQy8/ISz1q6uDwScjKWD+WNkQrTFVUiIwIadg96fSsogDDDcZOIoR6kYHiW9/ifINBJNYL+Io9mdGe8gfn9HTH5EO3EZ+Kp+vr+n5gIam/sBvqKcvIqUZFPQP4JR9hGogIGZ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672613; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=waJxQlBb94XR6Ggskx6BDndQcoTTNWF9QTJRASbqMgE=; b=B/72pKXDDQdsE5wPrWrYPENLIx08l/SP8FcreeTEE+NEgnSjhUuJFmzt57ZA7Ol0cwRMIwN9JwLdt4WjqS+6+iGEm7Zh2vIuVHjoox7SpUiATgIUd3Xy8N5pOo0ZcxW9SqdZPHc9aniI9j6d+KBMuazu8NbnmN7zCbw3ZeExT4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672613408816.5289170241837; Wed, 18 Dec 2019 04:36:53 -0800 (PST) Received: from localhost ([::1]:53576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYZP-0002LD-KK for importer@patchew.org; Wed, 18 Dec 2019 07:36:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49683) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3K-0006Y1-Li for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3J-00019V-DQ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:42 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:35429) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3J-00017U-3S for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:41 -0500 Received: by mail-wr1-x429.google.com with SMTP id g17so2023536wro.2 for ; Wed, 18 Dec 2019 04:03:38 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:37 -0800 (PST) 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=waJxQlBb94XR6Ggskx6BDndQcoTTNWF9QTJRASbqMgE=; b=DaLHz5W4puy/asKxGWx0ACkDk32e/Sd5YW8FDKPC4wlKsF2xtoBQA/1P8AJqLD/Qiw EoEm8zWwGbAM8uw6DEL4JhW70uMhrsudFEg+dK9w8y/9jftGzFybxlFGlfoFBFz4XL33 9LJfH2gmqNY4zfTLk+CTvqXMC+87T4TprlgYByry1RQg0n215gsmwN0iyUYFzl3U7o9v 9TWgu0v0ZVcEedsaKkZRruG8cu9SuytiP4wYUJM5FLmRJta/c8JlKv5EpvMc+DSeXY+i 7ZqIGjXnLA8QYBJ4NknpFd7yFoDMt2cIyhWBpBUVCB4chgTIYB0VQSj6hX6N7kpbfqx6 co4Q== 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=waJxQlBb94XR6Ggskx6BDndQcoTTNWF9QTJRASbqMgE=; b=rSWU74Ob4+AjwGNdQ4iU5Z15w6g70ZZ0OwEq/6OYVrhVF3roZykoqj4Cd4K59Af+KV GQ+ncKneKG6mDmB+5HnTkTHFMQcZ4DQmCqUD1ytKkTzMgezHTpwkgh3DAzigiKJU2Utr ZUqaefCVINm7fsVzchPjNvZ9tmiHLJUqAkroRl5/hHVJfscCdkGu9/tvcuDMl/0X7a8r 8YDbK1TWQcJ+vyhHzijAv+xkZ+VZjNkxnMAawdfcm6Swf7h7M8oj8ISVEsr9NhgWeejM 4UMAT0mcFgQtMAZGKKytfMLBPRpXxZHqd/ugauVmucVUVtyRdMF76bwk27J89Gpd/dlK Z2ng== X-Gm-Message-State: APjAAAUbrLEEm/0aMJqNWaHFkFUzKGWbr9AmXyjEBlukPbi2VEj5DNka HWurDo5Sgvx6GobTH8pTJyl8mgXv X-Google-Smtp-Source: APXvYqxBjtQH9Rsg1JeFhwS96pnfu1FIg7A4V0XX37EumhxAfa1DQrHdGrwwy+dYEmNwADQkcDJ+GA== X-Received: by 2002:adf:c147:: with SMTP id w7mr2498695wre.389.1576670617638; Wed, 18 Dec 2019 04:03:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 43/87] configure: simplify vhost condition with Kconfig Date: Wed, 18 Dec 2019 13:02:09 +0100 Message-Id: <1576670573-48048-44-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::429 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- Kconfig.host | 5 +++++ Makefile | 1 + hw/virtio/Kconfig | 3 +++ hw/virtio/Makefile.objs | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Kconfig.host b/Kconfig.host index bb6e116..55136e0 100644 --- a/Kconfig.host +++ b/Kconfig.host @@ -25,6 +25,11 @@ config TPM =20 config VHOST_USER bool + select VHOST + +config VHOST_KERNEL + bool + select VHOST =20 config XEN bool diff --git a/Makefile b/Makefile index fb1728e..531e955 100644 --- a/Makefile +++ b/Makefile @@ -382,6 +382,7 @@ MINIKCONF_ARGS =3D \ CONFIG_OPENGL=3D$(CONFIG_OPENGL) \ CONFIG_X11=3D$(CONFIG_X11) \ CONFIG_VHOST_USER=3D$(CONFIG_VHOST_USER) \ + CONFIG_VHOST_KERNEL=3D$(CONFIG_VHOST_KERNEL) \ CONFIG_VIRTFS=3D$(CONFIG_VIRTFS) \ CONFIG_LINUX=3D$(CONFIG_LINUX) \ CONFIG_PVRDMA=3D$(CONFIG_PVRDMA) diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index 3724ff8..f87def2 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -1,3 +1,6 @@ +config VHOST + bool + config VIRTIO bool =20 diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index e2f70fb..de0f5fc 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -2,8 +2,8 @@ ifeq ($(CONFIG_VIRTIO),y) common-obj-y +=3D virtio-bus.o obj-y +=3D virtio.o =20 -obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) +=3D vhost.o v= host-backend.o -common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERN= EL))) +=3D vhost-stub.o +obj-$(CONFIG_VHOST) +=3D vhost.o vhost-backend.o +common-obj-$(call lnot,$(CONFIG_VHOST)) +=3D vhost-stub.o obj-$(CONFIG_VHOST_USER) +=3D vhost-user.o =20 common-obj-$(CONFIG_VIRTIO_RNG) +=3D virtio-rng.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672474; cv=none; d=zohomail.com; s=zohoarc; b=mqtFWna7eddOyW0JNi/GtbdY6onWIeTj68vW1QjGXe4R5dTNTPXN1rC7uSoYT1oKuvQ1uvNl8JIyw9cO5Hqyt4Gl2KGAysuAdap4gEOOonF2ZvnHUXF+ZjNcM6a6zwvsP0876AYPLuZ+oQhvirnj2J6vmA8dqlWlQTDe5w4L7KI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672474; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=X8qg4vC4u62X+krIpf2n1pZJRXcVq9s/dN9HuyUC68E=; b=KzwYnrplGDqmksLp1n/+lk8gjnB5QeN05J7Aaw5UNqysYDkeowRJs4oFT7gvmhcAaNbng4SD7ImvpgXY1DZsguyiVx3OShghHvnIgy9gXnKTFh7lW9tJ71pzA8Xxdzxg8NWiof4SmVT3BNHY3EGkt4rPTM3ZJlIHr+v08iOCjx8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672474908606.0315844556987; Wed, 18 Dec 2019 04:34:34 -0800 (PST) Received: from localhost ([::1]:53540 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYXB-0006ka-Bm for importer@patchew.org; Wed, 18 Dec 2019 07:34:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49681) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3K-0006Y0-N6 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3J-00019Q-DF for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:42 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:35506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3J-00017X-4O for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:41 -0500 Received: by mail-wm1-x32b.google.com with SMTP id p17so1621139wmb.0 for ; Wed, 18 Dec 2019 04:03:39 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:37 -0800 (PST) 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=X8qg4vC4u62X+krIpf2n1pZJRXcVq9s/dN9HuyUC68E=; b=CC+F/sAP858AlRVRbSe3byqpaKoSnJwT/jqPPbtHyCyLFU4SX+yuTHnKyeR7RPyPeM Q8JXelV/EmsQ1H3Pw2rv6COcRVxKdsoRPzYLqMcUsdJ7s9aBmwxkUygv/Zy/Md3OZuq1 26DZB+dLiGzT73DyO1DBDYhdY2ehLfdayb4oDP6qqz9rdnJf7+oMIZJsjDmnYUAggZa3 Ydo0aOgRAsfupHOpvOqFqw7/BiGlJ1ps2nNhpZsZcm0rhcRLEOA1tVKod6lfdTi6T+fL 6uR639YPuOUl79bFb1cb8UEeBmV2a6HUiUGORDng6p33EC15VLu0rbJJIXIkcr2hLGw6 g0AA== 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=X8qg4vC4u62X+krIpf2n1pZJRXcVq9s/dN9HuyUC68E=; b=H4cYaM5ErXBv25z6/J7nnMBnSxeOnuoYHrrL0x7tGbrj5eH95cTs1PR47ldhYRD0fI 6HZpx9S2Jyj5EU5s1vfbaRsgWzxzmheAD8See5y5j5S4+RG/cqD/SfS8Z6fucq5XkLJ0 Bdlg0j7dRW6M80ALcSi9kQ+TcOiTmTsawb0ZfS2yKSlbD/K3inBNbML3MQYQQT/ezHIk OithOl2iFm/pUzwwgLXKztrgGHP9mBgc5nxbfJdWtypomoZWkBYKO1mZXTUDn+zxV+DC XVTQ/seGmo4ynq82U4WX3HvlxtH6AEGDK7kREYiWujH6ARNN7lCqyzGVuQHR0Zgh1N1e c+aA== X-Gm-Message-State: APjAAAW0zyYjslp3kmZCGGXYdHCi5evrTQ4516m3ISo43xNds0uwjlC1 Yxyq0KfHRPaoNWKaAbkpbWxAEFxs X-Google-Smtp-Source: APXvYqyWEo6Ixn8GYQMsTtI7R/9TEMehZmysdbvBLJOlF3Z0A6tDKeAmok5Ye+g0CAAFKFQpmi5DRg== X-Received: by 2002:a7b:c759:: with SMTP id w25mr2958815wmk.15.1576670618753; Wed, 18 Dec 2019 04:03:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 44/87] i386: conditionally compile more files Date: Wed, 18 Dec 2019 13:02:10 +0100 Message-Id: <1576670573-48048-45-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/i386/Makefile.objs | 6 +++--- hw/i386/kvm/Makefile.objs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 0d195b5..01ae202 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -1,11 +1,11 @@ obj-$(CONFIG_KVM) +=3D kvm/ obj-y +=3D e820_memory_layout.o multiboot.o obj-y +=3D x86.o -obj-y +=3D pc.o +obj-$(CONFIG_PC) +=3D pc.o pc_sysfw.o obj-$(CONFIG_I440FX) +=3D pc_piix.o obj-$(CONFIG_Q35) +=3D pc_q35.o obj-$(CONFIG_MICROVM) +=3D microvm.o -obj-y +=3D fw_cfg.o pc_sysfw.o +obj-y +=3D fw_cfg.o obj-y +=3D x86-iommu.o obj-$(CONFIG_VTD) +=3D intel_iommu.o obj-$(CONFIG_AMD_IOMMU) +=3D amd_iommu.o @@ -14,4 +14,4 @@ obj-$(CONFIG_VMPORT) +=3D vmport.o obj-$(CONFIG_VMMOUSE) +=3D vmmouse.o =20 obj-y +=3D kvmvapic.o -obj-y +=3D acpi-build.o +obj-$(CONFIG_PC) +=3D acpi-build.o diff --git a/hw/i386/kvm/Makefile.objs b/hw/i386/kvm/Makefile.objs index 4224ed9..0c8d5f2 100644 --- a/hw/i386/kvm/Makefile.objs +++ b/hw/i386/kvm/Makefile.objs @@ -1 +1,5 @@ -obj-y +=3D clock.o apic.o i8259.o ioapic.o i8254.o +obj-y +=3D clock.o +obj-$(CONFIG_APIC) +=3D apic.o +obj-$(CONFIG_IOAPIC) +=3D ioapic.o +obj-$(CONFIG_I8254) +=3D i8254.o +obj-$(CONFIG_I8259) +=3D i8259.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672387; cv=none; d=zohomail.com; s=zohoarc; b=ZWiaD1Ti90zJ99EJqFj2zdtzUm1+lKRAafxXxaTHm4l7qjQa8CQLNvFVwKj4Juxhs2hdY2CYzedITUT5Ud1zb8cwiZglsatxSu0zKJN8RPwylnA/B7M6yCC7rCphBuAWu5Uza0Ev+5IWSiv4m7lIGyURG5ePbadRQ77Xgl8frwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672387; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=eYZEgxMO6lxQ1qaiC5oqX7/XxqB0vnO44sAssJEBGz4=; b=izGmal64OViKwQgr3EmFnHtA7SC3Qj0MNMcBmkvFlL5Xjm9UiNlpnorL/qc4foM+EZXyUKkyDZw+a7CvH2j7t6ZUfItw51zsEZOA7f79bA0/aWg02Fhxx9sb1kH4ges4B7JFweGH8f4nPJE8mh7n7l5LjJln0fGIoPNrKyJXkSg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672387223931.6050517080761; Wed, 18 Dec 2019 04:33:07 -0800 (PST) Received: from localhost ([::1]:53524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYVl-0004BY-DU for importer@patchew.org; Wed, 18 Dec 2019 07:33:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50543) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3O-0006da-M4 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3N-0001Rg-EK for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:46 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:35435) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3N-0001NW-1d for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:45 -0500 Received: by mail-wr1-x42e.google.com with SMTP id g17so2023908wro.2 for ; Wed, 18 Dec 2019 04:03:44 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:38 -0800 (PST) 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=eYZEgxMO6lxQ1qaiC5oqX7/XxqB0vnO44sAssJEBGz4=; b=mb+Z6AvEo88e6YDdEeL2qMVOG4+xk7lKoRAG98JXno3VpivbHU5XDVUvBu463BetiS Jsygywx0pE/4aWrULEyw0bwSTzF6yLMLBZGepfV1y6GBAaLXe85SdFsoFR9MJ/VAQFEe 4q3te6xqk5vLv/TIZIkrMGZ+TU5rtLfUxrDI2uEbamBk1yUSC2/Ow+JZJt1Al7s5icwp b9F+ZgnybuNauqUgdKI6sJCAD7Xkjzf7UKAzs3ltAyv0k19K3T6FrS6K6F+X3g3gwW05 i9VPk8HiI/B0Eq0qOE5uDE+mZa/dhfwdyDBOcRVGfTaGxRBOQQNo9aAM7X19GjdmrJ4D wO8g== 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=eYZEgxMO6lxQ1qaiC5oqX7/XxqB0vnO44sAssJEBGz4=; b=WQXkPbNsEUmbuebHBfUEn8+ol/5REYEpdzUjGKoiOQKrrZRibfRQr/BUrHcBOmg4LK sN0XhBi9Ui6gX47zGb7aItnI95pF8w1odZ2nYlRQxapd5iXkJWZU4NC9w5fjFKaU5Yex n+0Ka4atF+RhLimwFws6YOkGouvH/xncbSyZH09gK4bzOjUZqUxXWqhUMdelwmoI2aRa LFhKODUMxPFxMwCXq95d9OcyvmLKGrLaLMrkzJCWnyntH67LSr7DgkdkIcz0YY1zfplV oA2qHLjkEDyajb2xci+VIsmMbAkV5D2kqxvst1vqNh0wXSsdYhCUI1gJDfGdaCePHnGY G1fA== X-Gm-Message-State: APjAAAXqwJudeelA6kufi7/GLcRD5jRNnlxP5aA3C0azDdmcksW9GIqW Pel9OLpLTlSildEzp/5/R4dWXje3 X-Google-Smtp-Source: APXvYqzLm2/FPRP12mjfkm1gfrX5wr6dMoqndKgP3gzAiAkb7sya9zYe7nVSFQYUC6MpD4KjpeGS6A== X-Received: by 2002:a05:6000:f:: with SMTP id h15mr2362853wrx.90.1576670623822; Wed, 18 Dec 2019 04:03:43 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 45/87] fw_cfg: allow building without other devices Date: Wed, 18 Dec 2019 13:02:11 +0100 Message-Id: <1576670573-48048-46-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The microvm machine type uses fw_cfg but lacks SMBIOS and ACPI. Do not include the files if the symbol is not present in QEMU and remove dependencies on machine-specific files. Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/i386/fw_cfg.c | 7 +++++++ hw/i386/pc.c | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 39b6bc6..326e33e 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -22,6 +22,9 @@ #include "hw/nvram/fw_cfg.h" #include "e820_memory_layout.h" #include "kvm_i386.h" +#include "config-devices.h" + +struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; =20 const char *fw_cfg_arch_key_name(uint16_t key) { @@ -46,6 +49,7 @@ const char *fw_cfg_arch_key_name(uint16_t key) =20 void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw_cfg) { +#ifdef CONFIG_SMBIOS uint8_t *smbios_tables, *smbios_anchor; size_t smbios_tables_len, smbios_anchor_len; struct smbios_phys_mem_area *mem_array; @@ -83,6 +87,7 @@ void fw_cfg_build_smbios(MachineState *ms, FWCfgState *fw= _cfg) fw_cfg_add_file(fw_cfg, "etc/smbios/smbios-anchor", smbios_anchor, smbios_anchor_len); } +#endif } =20 FWCfgState *fw_cfg_arch_create(MachineState *ms, @@ -114,8 +119,10 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms, */ fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, apic_id_limit); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); +#ifdef CONFIG_ACPI fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, acpi_tables, acpi_tables_len); +#endif fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override(= )); =20 fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 58867f9..4bb1710 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -101,8 +101,6 @@ #define DPRINTF(fmt, ...) #endif =20 -struct hpet_fw_config hpet_cfg =3D {.count =3D UINT8_MAX}; - GlobalProperty pc_compat_4_2[] =3D {}; const size_t pc_compat_4_2_len =3D G_N_ELEMENTS(pc_compat_4_2); =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672894; cv=none; d=zohomail.com; s=zohoarc; b=Gsx2YhB2OnS1570vhiMU9ZeLbpT3Ur8jaiJ6YOkBwYbkja7ot0sJSoGsCMaKku1/jSn2njjtPR6cIsu868s2Vf+ILR6xDLIvfZ/p9ilx14+R2TnWAcDBKVgZC/QbJ6tfIxmj9Td16QVb7zzGiivV3AgQGHFwv2Y9x3yKMOkIi5w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672894; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=caRDt6OxCGoej2w718ZKAw/mcjhQpfku4bt3zEwAXZM=; b=NB2FXWkQQVZ2eq7RLehxFm5vP9qPz/agQvc2gnSqlGSgbI4+KNq9WF3Lkf8NcCKZdsWWSipsWKECV/zN5KlN7P1iAGRsUepjOaa9+P1DB5qRhFfluM6R7idgwh6mok8Rhy0JZCwv+DSh6m/mN68/17XPrNz0V60m0LkNT+9OgsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672894194911.3062062396149; Wed, 18 Dec 2019 04:41:34 -0800 (PST) Received: from localhost ([::1]:53632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYdw-0000wl-Eo for importer@patchew.org; Wed, 18 Dec 2019 07:41:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50989) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3Q-0006gT-IX for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3O-0001W0-CF for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:48 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:50302) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3O-0001S0-23 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:46 -0500 Received: by mail-wm1-x334.google.com with SMTP id a5so1563499wmb.0 for ; Wed, 18 Dec 2019 04:03:45 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:44 -0800 (PST) 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=caRDt6OxCGoej2w718ZKAw/mcjhQpfku4bt3zEwAXZM=; b=A9VscNrdgBypgOF6aUmXN8Q48hq913C78yTdHIQ9c5C48rEo6LaM8qj3INY3Zhi1W+ UejwLRoh5O/mdr33PhGri1hy2xt6UaYaRxukBo4MDEmOZIpf7oRdcSFnUMri/dz7LMV1 Mtox6f1P3rPkXsjj74Y3cV1/zVYHukXdV+22crzq4055TondJL+4g6qQYIsTFIQaN+HL hXs4rX1kcB3JZgt6AKR8HKBY6bWzSbiUisce11LC6uOw1xhJSCznurDSu92zAvCIIL1j ieC73XpvvQBMOrkVDsqYq7KscZz+Gm1X7VJpd8PsxfvZCgPb79ujQWX5vi1SIP9de1dL Yi5w== 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=caRDt6OxCGoej2w718ZKAw/mcjhQpfku4bt3zEwAXZM=; b=e+0HISqx7hCfu9z2oyYKtF9mmF75/9sQKP+nR/fAHbugah7sPaJ/47ybxlSc3Gib2R Nn711px+DpftkV/TjhUMUJsAFO9APQJL8DjOrIXZZz4Bb9ibrkclFG+5TrqAHmjjalVx h32m7XaYbQzeQ6Nq28TRjQw1s5xrYicC1hS1jiIgFwLzrclkZs/ckafIVi1W51HhYPIZ uvmvdrwblMMR36/BWKsTT4kqoqrC5dPXSXodBYu1UquDf8Va7zUnkQXouETW8nTmWKNr vh0NpxjmTulOmI5MuOSkwl1mJlFH73rvzjIJ17iyXpVgV5sy6+3vJF6pbwF0woXbX9dg ZoLA== X-Gm-Message-State: APjAAAWLNE+gQ7QZY5TbYCYbVvyd9p3pxYcdnAnKFhs3/a0peNUDv8S7 xF5T1khisZCvTZOhg6Ky7W9asvyy X-Google-Smtp-Source: APXvYqziSATgk4L63D7ziHAb3PtgggenN7L9Vy/QJAh4+ggzO+8a9zNzn+QtJYcXUPHobd+BxEsMHg== X-Received: by 2002:a05:600c:21ce:: with SMTP id x14mr2717656wmj.120.1576670624548; Wed, 18 Dec 2019 04:03:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 46/87] hw: replace hw/i386/pc.h with a header just for the i8259 Date: Wed, 18 Dec 2019 13:02:12 +0100 Message-Id: <1576670573-48048-47-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Remove the need to include i386/pc.h to get to the i8259 functions. This is enough to remove the inclusion of hw/i386/pc.h from all non-x86 files. Signed-off-by: Paolo Bonzini --- hw/alpha/alpha_sys.h | 3 ++- hw/alpha/dp264.c | 1 + hw/hppa/hppa_sys.h | 3 ++- hw/hppa/machine.c | 1 + hw/i386/kvm/i8259.c | 1 + hw/i386/microvm.c | 1 + hw/i386/pc.c | 1 + hw/i386/x86.c | 1 + hw/input/pckbd.c | 1 - hw/intc/Kconfig | 2 ++ hw/intc/apic.c | 2 +- hw/intc/i8259.c | 2 +- hw/intc/i8259_common.c | 2 +- hw/intc/ioapic.c | 3 ++- hw/isa/i82378.c | 2 +- hw/isa/lpc_ich9.c | 1 - hw/isa/piix4.c | 2 +- hw/mips/gt64xxx_pci.c | 2 +- hw/mips/mips_fulong2e.c | 2 +- hw/mips/mips_jazz.c | 2 +- hw/mips/mips_r4k.c | 2 +- hw/pci-host/bonito.c | 1 - hw/pci-host/prep.c | 2 +- include/hw/i386/pc.h | 8 -------- include/hw/intc/i8259.h | 12 ++++++++++++ include/hw/isa/i8259_internal.h | 2 +- target/i386/monitor.c | 1 - 27 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 include/hw/intc/i8259.h diff --git a/hw/alpha/alpha_sys.h b/hw/alpha/alpha_sys.h index 4e127a6..95033d7 100644 --- a/hw/alpha/alpha_sys.h +++ b/hw/alpha/alpha_sys.h @@ -7,7 +7,8 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" =20 =20 PCIBus *typhoon_init(ram_addr_t, ISABus **, qemu_irq *, AlphaCPU *[4], diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c index 51b3cf7..f2026fd 100644 --- a/hw/alpha/dp264.c +++ b/hw/alpha/dp264.c @@ -19,6 +19,7 @@ #include "hw/timer/i8254.h" #include "hw/isa/superio.h" #include "hw/dma/i8257.h" +#include "net/net.h" #include "qemu/cutils.h" =20 #define MAX_IDE_BUS 2 diff --git a/hw/hppa/hppa_sys.h b/hw/hppa/hppa_sys.h index 43d25d2..4e50196 100644 --- a/hw/hppa/hppa_sys.h +++ b/hw/hppa/hppa_sys.h @@ -6,7 +6,8 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ide.h" -#include "hw/i386/pc.h" +#include "hw/boards.h" +#include "hw/intc/i8259.h" =20 #include "hppa_hardware.h" =20 diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index b30aba6..5d0de26 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -19,6 +19,7 @@ #include "hppa_sys.h" #include "qemu/units.h" #include "qapi/error.h" +#include "net/net.h" #include "qemu/log.h" =20 #define MAX_IDE_BUS 2 diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index d0c1b1d..e404fdc 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -12,6 +12,7 @@ =20 #include "qemu/osdep.h" #include "hw/isa/i8259_internal.h" +#include "hw/intc/i8259.h" #include "qemu/module.h" #include "hw/i386/apic_internal.h" #include "hw/irq.h" diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index def37e6..2068319 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -34,6 +34,7 @@ #include "hw/i386/x86.h" #include "hw/i386/pc.h" #include "target/i386/cpu.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" #include "hw/char/serial.h" diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 4bb1710..b4384e2 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -44,6 +44,7 @@ #include "migration/vmstate.h" #include "multiboot.h" #include "hw/rtc/mc146818rtc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/input/i8042.h" diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 394edc2..3e4aee5 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -39,6 +39,7 @@ #include "target/i386/cpu.h" #include "hw/i386/topology.h" #include "hw/i386/fw_cfg.h" +#include "hw/intc/i8259.h" =20 #include "hw/acpi/cpu_hotplug.h" #include "hw/nmi.h" diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c index f0acfd8..2f09f78 100644 --- a/hw/input/pckbd.c +++ b/hw/input/pckbd.c @@ -26,7 +26,6 @@ #include "qemu/log.h" #include "hw/isa/isa.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/input/ps2.h" #include "hw/irq.h" #include "hw/input/i8042.h" diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 5347f84..10a680b 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -9,6 +9,7 @@ config PL190 =20 config IOAPIC bool + select I8259 =20 config ARM_GIC bool @@ -21,6 +22,7 @@ config OPENPIC config APIC bool select MSI_NONBROKEN + select I8259 =20 config ARM_GIC_KVM bool diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 2a74f7b..bd40467 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -22,10 +22,10 @@ #include "hw/i386/apic_internal.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "qemu/host-utils.h" #include "trace.h" -#include "hw/i386/pc.h" #include "hw/i386/apic-msidef.h" #include "qapi/error.h" =20 diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index 211a989..51b27f6 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -23,7 +23,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/isa/isa.h" #include "qemu/timer.h" diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index bd37bb5..e7b1a10 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -24,7 +24,7 @@ */ =20 #include "qemu/osdep.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/isa/i8259_internal.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c index ead14e1..4f55776 100644 --- a/hw/intc/ioapic.c +++ b/hw/intc/ioapic.c @@ -23,10 +23,11 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/i386/ioapic.h" #include "hw/i386/ioapic_internal.h" +#include "hw/i386/x86.h" +#include "hw/intc/i8259.h" #include "hw/pci/msi.h" #include "hw/qdev-properties.h" #include "sysemu/kvm.h" diff --git a/hw/isa/i82378.c b/hw/isa/i82378.c index de276cd..dcb6b47 100644 --- a/hw/isa/i82378.c +++ b/hw/isa/i82378.c @@ -19,8 +19,8 @@ =20 #include "qemu/osdep.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" +#include "hw/intc/i8259.h" #include "hw/timer/i8254.h" #include "migration/vmstate.h" #include "hw/audio/pcspk.h" diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 17c292e..170792a 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -35,7 +35,6 @@ #include "hw/isa/isa.h" #include "hw/sysbus.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/isa/apm.h" #include "hw/i386/ioapic.h" diff --git a/hw/isa/piix4.c b/hw/isa/piix4.c index 86678e6..7edec5e 100644 --- a/hw/isa/piix4.c +++ b/hw/isa/piix4.c @@ -26,11 +26,11 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "hw/irq.h" -#include "hw/i386/pc.h" #include "hw/southbridge/piix.h" #include "hw/pci/pci.h" #include "hw/isa/isa.h" #include "hw/sysbus.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/timer/i8254.h" #include "hw/rtc/mc146818rtc.h" diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c index f1af840..b2ea13f 100644 --- a/hw/mips/gt64xxx_pci.c +++ b/hw/mips/gt64xxx_pci.c @@ -30,7 +30,7 @@ #include "hw/pci/pci_host.h" #include "hw/southbridge/piix.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "exec/address-spaces.h" #include "trace.h" diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c index 03a27e1..9eaa6e2 100644 --- a/hw/mips/mips_fulong2e.c +++ b/hw/mips/mips_fulong2e.c @@ -23,7 +23,7 @@ #include "qemu/units.h" #include "qapi/error.h" #include "cpu.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/isa/superio.h" #include "net/net.h" diff --git a/hw/mips/mips_jazz.c b/hw/mips/mips_jazz.c index ac4d7ac..291fd6c 100644 --- a/hw/mips/mips_jazz.c +++ b/hw/mips/mips_jazz.c @@ -26,7 +26,7 @@ #include "qemu-common.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/dma/i8257.h" #include "hw/char/serial.h" #include "hw/char/parallel.h" diff --git a/hw/mips/mips_r4k.c b/hw/mips/mips_r4k.c index 3891be6..fd926a3 100644 --- a/hw/mips/mips_r4k.c +++ b/hw/mips/mips_r4k.c @@ -15,7 +15,7 @@ #include "cpu.h" #include "hw/mips/mips.h" #include "hw/mips/cpudevs.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/char/serial.h" #include "hw/isa/isa.h" #include "net/net.h" diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c index 4692d41..cc6545c 100644 --- a/hw/pci-host/bonito.c +++ b/hw/pci-host/bonito.c @@ -41,7 +41,6 @@ #include "qemu/osdep.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" -#include "hw/i386/pc.h" #include "hw/irq.h" #include "hw/mips/mips.h" #include "hw/pci/pci_host.h" diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 85d7ba9..afa136d 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -32,7 +32,7 @@ #include "hw/pci/pci_host.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" -#include "hw/i386/pc.h" +#include "hw/intc/i8259.h" #include "hw/irq.h" #include "hw/loader.h" #include "hw/or-irq.h" diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 61a998d..e2cd453 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -134,14 +134,6 @@ typedef struct PCMachineClass { #define PC_MACHINE_CLASS(klass) \ OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE) =20 -/* i8259.c */ - -extern DeviceState *isa_pic; -qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); -qemu_irq *kvm_i8259_init(ISABus *bus); -int pic_read_irq(DeviceState *d); -int pic_get_output(DeviceState *d); - /* ioapic.c */ =20 /* Global System Interrupts */ diff --git a/include/hw/intc/i8259.h b/include/hw/intc/i8259.h new file mode 100644 index 0000000..e2b1e8c --- /dev/null +++ b/include/hw/intc/i8259.h @@ -0,0 +1,12 @@ +#ifndef HW_I8259_H +#define HW_I8259_H + +/* i8259.c */ + +extern DeviceState *isa_pic; +qemu_irq *i8259_init(ISABus *bus, qemu_irq parent_irq); +qemu_irq *kvm_i8259_init(ISABus *bus); +int pic_get_output(DeviceState *d); +int pic_read_irq(DeviceState *d); + +#endif diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_interna= l.h index ee189e4..861d70d 100644 --- a/include/hw/isa/i8259_internal.h +++ b/include/hw/isa/i8259_internal.h @@ -25,9 +25,9 @@ #ifndef QEMU_I8259_INTERNAL_H #define QEMU_I8259_INTERNAL_H =20 -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "hw/intc/intc.h" +#include "hw/intc/i8259.h" =20 typedef struct PICCommonState PICCommonState; =20 diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 9fb4d64..27ebfa3 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -28,7 +28,6 @@ #include "monitor/hmp-target.h" #include "monitor/hmp.h" #include "qapi/qmp/qdict.h" -#include "hw/i386/pc.h" #include "sysemu/kvm.h" #include "sysemu/sev.h" #include "qapi/error.h" --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672533; cv=none; d=zohomail.com; s=zohoarc; b=AmfPd3sU1GbCnxG+JKlQ4L3xVusOrI9kdJ5PbxYhiOVIR//DFCGUi0arBFHJLHLXTAvmWO0VSwxJPn/Frb4ZFvbwhoGpbC61WkJfWKsPfXusLsjVYsjpu9U+mmz03wx9C8XxuKuJUrS2oM8UXvApt/e4J2r54mVJ3KtAfHhbgno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672533; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=U3vOKBgC/i6K4YScuB6kA+GIuvMW8sSGRrxjWYPsniE=; b=G+h7VEsQpL2HQpsbgGrV32S1Ksh/DftLy2cfV12MA1e+oBIwUpWPadHhhk1DNgGSdwAsHpcB/nIsVccXmldViM2wDuxbsDFu5v9yT7B+ns+Z0KTDmXHkO6b8Yq5vi2ymRqmInptUAPVUoSjxPbttf+t/OzLyFA8NVynQDLpfTYI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672533444446.72134436297347; Wed, 18 Dec 2019 04:35:33 -0800 (PST) Received: from localhost ([::1]:53550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYY7-00006u-R8 for importer@patchew.org; Wed, 18 Dec 2019 07:35:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50925) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3Q-0006ft-Cz for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3P-0001ZE-5X for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:48 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45885) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3O-0001Vc-R6 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:47 -0500 Received: by mail-wr1-x443.google.com with SMTP id j42so1973769wrj.12 for ; Wed, 18 Dec 2019 04:03:46 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:44 -0800 (PST) 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=U3vOKBgC/i6K4YScuB6kA+GIuvMW8sSGRrxjWYPsniE=; b=cp2WFQZdFjT1tq/07bQw+/SFwFrzH69/UWRF2haQi6dortstS5U4SnMrBmXshgnGln qqyNQeDoWg4JUnS2wJIHVozXbKkRcxCvbRufGJvmgc5hqTwgDJBC/hOcz9USKv/SY/mu w7939wZhCxPxj3GDRjjzqRk7uBItzWkJeV2Rgft+h4t+ijJhIKiWth3eFO6v4hMrb7RF /yV24NbqzwsZPwkiXI5Iobfv1375XnQ6ZEPF/tok8AtvDDsB557/m/WBdxA6eyuMBmd6 ptZwm716d1o14jT1wUtxRYjZxB0SQcyi8wWdv3dUaRPrQNxbCCk2Zgwema1y4cLo+BLo 5ONQ== 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=U3vOKBgC/i6K4YScuB6kA+GIuvMW8sSGRrxjWYPsniE=; b=I99YvWSPBV2ap5TnxzPO3Yq1QYaTZq+2yU/97uxQPxqrOEpS3uU1peYYyMV2OxW3h9 +6rACVLanWOzHTFC9UQhMzbDDEKt6ndL1wUm4N1T1g/MkO3sHOZ8QiOcii+FdNu1IyMA mFPq/xwtc+cD1myOv4WXu0bYNOviNj/swZxYcAhBRD5297KIFN2MtzG+0OKYVq1/86ij 6+zws+UiVbPQoRm8Was1v1O1lg/c2UQAYPyrAYQrw6CFfftc4r6oY25DMs5xmjmKAvvg r+8DMw/iopG5eWgLVI4hDcksd0/Fad1juKLi2jtpVSTNkvLFuqv6Ihb2gcWJPMVwPHne 21Dw== X-Gm-Message-State: APjAAAXTfhnyLpFUX6fdJv7K8Nwgq5PEb/b5BksG2XXh0W2RwzvujQjL IEvGAzKWhQecvEfuU4umo6vLlgCT X-Google-Smtp-Source: APXvYqznEiG9Usijk+TmaWMrus2m5qPMDTG36wnvwHtbiZhNoj26YyL4p3N1hngP5Pa6qr6ZW1w1Sg== X-Received: by 2002:adf:f491:: with SMTP id l17mr2409540wro.149.1576670625640; Wed, 18 Dec 2019 04:03:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 47/87] pci-stub: add more MSI functions Date: Wed, 18 Dec 2019 13:02:13 +0100 Message-Id: <1576670573-48048-48-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On x86, KVM needs some function from the PCI subsystem in order to set up interrupt routes. Provide some stubs to support x86 machines that lack PCI. Reviewed-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/pci/pci-stub.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/hw/pci/pci-stub.c b/hw/pci/pci-stub.c index c04a5df..cc2a2e1 100644 --- a/hw/pci/pci-stub.c +++ b/hw/pci/pci-stub.c @@ -26,6 +26,7 @@ #include "qapi/qmp/qerror.h" #include "hw/pci/pci.h" #include "hw/pci/msi.h" +#include "hw/pci/msix.h" =20 bool msi_nonbroken; bool pci_available; @@ -64,3 +65,29 @@ void msi_notify(PCIDevice *dev, unsigned int vector) { g_assert_not_reached(); } + +/* Required by target/i386/kvm.c */ +bool msi_is_masked(const PCIDevice *dev, unsigned vector) +{ + g_assert_not_reached(); +} + +MSIMessage msi_get_message(PCIDevice *dev, unsigned int vector) +{ + g_assert_not_reached(); +} + +int msix_enabled(PCIDevice *dev) +{ + return false; +} + +bool msix_is_masked(PCIDevice *dev, unsigned vector) +{ + g_assert_not_reached(); +} + +MSIMessage msix_get_message(PCIDevice *dev, unsigned int vector) +{ + g_assert_not_reached(); +} --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672756; cv=none; d=zohomail.com; s=zohoarc; b=ibBNdUORKihffgrF7a/tngasG494mNkd8EG1qzMkIn5v1glfba26Vygr1YBcUeFhoeMTIUIGyJsc2ZDxkLPxKDKIj4CBgtV0b2+4Jey1BUyL/CZlde1sXTA5exMl9qKnboouWWCf146p1hK180lCzoBOOofsg72XQJ/EHbSn9vE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672756; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ToK2OtnJ76oO0K5jmaY8PLTL4AZ+PoZe2UIvk4xI5zw=; b=eJySmaCd/m8KRbY7d8CVozBYIXdvvB96pUjBzzABax/hMPIqTg1CTlcWXnZ5mdnI3XbbNi9SnJ22xeWT8jEdltf9xPVdDcdCy4SGQ/VxcA3hrm6Esyo6IuWHpDC0v4wVIXdJ0EMGfVS5JjVcGklUBJENKG5CLodvtQO/kXkjFRA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672756638979.787195750742; Wed, 18 Dec 2019 04:39:16 -0800 (PST) Received: from localhost ([::1]:53602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYbi-00063X-OC for importer@patchew.org; Wed, 18 Dec 2019 07:39:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51266) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3S-0006iR-5S for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3Q-0001cy-79 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:49 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:51664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3P-0001ZW-TB for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:48 -0500 Received: by mail-wm1-x32d.google.com with SMTP id d73so1563189wmd.1 for ; Wed, 18 Dec 2019 04:03:47 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:45 -0800 (PST) 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=ToK2OtnJ76oO0K5jmaY8PLTL4AZ+PoZe2UIvk4xI5zw=; b=MNPZIVg0oGlWOD0hmb+ikmSFSYW4gGOR3FHSr4+CshFYOw6nw/lDu9IZ3D172zOCe0 rp9I+lmZcBh1nBigPg+bA/Ige+q3xPVhoHakcCq3B4+s2s2P/glKkU7ZL6qaHjdiSMcP vteokl8k6zniom70oQanHVkxlYfD1hBGPpC8WlG+qpSZb4UTF9eYW+lo8y9jvcylc+dX 6/PCpbvpLzQohVPwMT/AJ3g90Z1KQFOStQZPIbITPxeH1mRL/kRWyzxojON8T8YZEceS +rs27Eq4jx5mX7D/GA0yvVcRnHE5SlJaRL0ptcFkq1h2Zw+raDY8/5I3Dq0rpHKsKBO9 6I2w== 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=ToK2OtnJ76oO0K5jmaY8PLTL4AZ+PoZe2UIvk4xI5zw=; b=kf0PNPEIzARCi/+2ldaxQ5l9cCK/wJM1Gw/ibR5y78JXCKGCyFujLOWgIBHTp2sStf fsSndD6d31BmxAl+aA3sJFFObdMOeOnVSvWfqFh1znS8iENRYvEcbnk9cHvM5z4gq1Qw x1XxAp8Xe1R3MVLB/jj08rWscDgELhfofAePHD0S2NAD2Rq/qMSMuuR2zFMbJaaOFwB6 oIzt8tC2saB3hs3lqzCuazmaM9sstlLyfKRWzHURhB23gD68hHWY72hF07zzRS74hPlm AEyat+FLvJf2KmsAtsID8YIF7DAOLkBpGtYcYaYDUHZbMJ4di1q1aBjdnhhwQQXXl1/v Qn3Q== X-Gm-Message-State: APjAAAWUZUb89QVtMt709d8z3dpTkOuZ8iO6eIjxPdjjzIi68cr0TMD2 QEzgRhZ0yT4C6auEhll+5nUB9/PB X-Google-Smtp-Source: APXvYqxB8FIepv2qpRk/TyhDtGNEk222N3LHB9WQr0bzYGBHZ6gCAVhI2iSxo+vzeBXtu3YBvG4IEg== X-Received: by 2002:a1c:8116:: with SMTP id c22mr2790240wmd.27.1576670626486; Wed, 18 Dec 2019 04:03:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 48/87] x86: move SMM property to X86MachineState Date: Wed, 18 Dec 2019 13:02:14 +0100 Message-Id: <1576670573-48048-49-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add it to microvm as well, it is a generic property of the x86 architecture. Suggested-by: Sergio Lopez Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 49 -----------------------------------------------= -- hw/i386/pc_piix.c | 6 +++--- hw/i386/pc_q35.c | 2 +- hw/i386/x86.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++= ++- include/hw/i386/pc.h | 3 --- include/hw/i386/x86.h | 5 +++++ target/i386/kvm.c | 3 +-- 7 files changed, 59 insertions(+), 59 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b4384e2..e330a91 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2031,48 +2031,6 @@ static void pc_machine_set_vmport(Object *obj, Visit= or *v, const char *name, visit_type_OnOffAuto(v, name, &pcms->vmport, errp); } =20 -bool pc_machine_is_smm_enabled(PCMachineState *pcms) -{ - bool smm_available =3D false; - - if (pcms->smm =3D=3D ON_OFF_AUTO_OFF) { - return false; - } - - if (tcg_enabled() || qtest_enabled()) { - smm_available =3D true; - } else if (kvm_enabled()) { - smm_available =3D kvm_has_smm(); - } - - if (smm_available) { - return true; - } - - if (pcms->smm =3D=3D ON_OFF_AUTO_ON) { - error_report("System Management Mode not supported by this hypervi= sor."); - exit(1); - } - return false; -} - -static void pc_machine_get_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCMachineState *pcms =3D PC_MACHINE(obj); - OnOffAuto smm =3D pcms->smm; - - visit_type_OnOffAuto(v, name, &smm, errp); -} - -static void pc_machine_set_smm(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - PCMachineState *pcms =3D PC_MACHINE(obj); - - visit_type_OnOffAuto(v, name, &pcms->smm, errp); -} - static bool pc_machine_get_smbus(Object *obj, Error **errp) { PCMachineState *pcms =3D PC_MACHINE(obj); @@ -2119,7 +2077,6 @@ static void pc_machine_initfn(Object *obj) { PCMachineState *pcms =3D PC_MACHINE(obj); =20 - pcms->smm =3D ON_OFF_AUTO_AUTO; #ifdef CONFIG_VMPORT pcms->vmport =3D ON_OFF_AUTO_AUTO; #else @@ -2226,12 +2183,6 @@ static void pc_machine_class_init(ObjectClass *oc, v= oid *data) pc_machine_get_device_memory_region_size, NULL, NULL, NULL, &error_abort); =20 - object_class_property_add(oc, PC_MACHINE_SMM, "OnOffAuto", - pc_machine_get_smm, pc_machine_set_smm, - NULL, NULL, &error_abort); - object_class_property_set_description(oc, PC_MACHINE_SMM, - "Enable SMM (pc & q35)", &error_abort); - object_class_property_add(oc, PC_MACHINE_VMPORT, "OnOffAuto", pc_machine_get_vmport, pc_machine_set_vmport, NULL, NULL, &error_abort); diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index ffb30c3..b3f0304 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -281,7 +281,7 @@ else { /* TODO: Populate SPD eeprom data. */ pcms->smbus =3D piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, x86ms->gsi[9], smi_irq, - pc_machine_is_smm_enabled(pcms), + x86_machine_is_smm_enabled(x86ms), &piix4_pm); smbus_eeprom_init(pcms->smbus, 8, NULL, 0); =20 @@ -309,9 +309,9 @@ else { =20 static void pc_compat_2_3_fn(MachineState *machine) { - PCMachineState *pcms =3D PC_MACHINE(machine); + X86MachineState *x86ms =3D X86_MACHINE(machine); if (kvm_enabled()) { - pcms->smm =3D ON_OFF_AUTO_OFF; + x86ms->smm =3D ON_OFF_AUTO_OFF; } } =20 diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 7398d7b..52f4573 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -276,7 +276,7 @@ static void pc_q35_init(MachineState *machine) 0xff0104); =20 /* connect pm stuff to lpc */ - ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms)); + ich9_lpc_pm_init(lpc, x86_machine_is_smm_enabled(x86ms)); =20 if (pcms->sata_enabled) { /* ahci and SATA device, for q35 1 ahci controller is built-in */ diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 3e4aee5..6fb01e4 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -746,10 +746,53 @@ static void x86_machine_set_max_ram_below_4g(Object *= obj, Visitor *v, x86ms->max_ram_below_4g =3D value; } =20 +bool x86_machine_is_smm_enabled(X86MachineState *x86ms) +{ + bool smm_available =3D false; + + if (x86ms->smm =3D=3D ON_OFF_AUTO_OFF) { + return false; + } + + if (tcg_enabled() || qtest_enabled()) { + smm_available =3D true; + } else if (kvm_enabled()) { + smm_available =3D kvm_has_smm(); + } + + if (smm_available) { + return true; + } + + if (x86ms->smm =3D=3D ON_OFF_AUTO_ON) { + error_report("System Management Mode not supported by this hypervi= sor."); + exit(1); + } + return false; +} + +static void x86_machine_get_smm(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms =3D X86_MACHINE(obj); + OnOffAuto smm =3D x86ms->smm; + + visit_type_OnOffAuto(v, name, &smm, errp); +} + +static void x86_machine_set_smm(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + X86MachineState *x86ms =3D X86_MACHINE(obj); + + visit_type_OnOffAuto(v, name, &x86ms->smm, errp); +} + static void x86_machine_initfn(Object *obj) { X86MachineState *x86ms =3D X86_MACHINE(obj); =20 + x86ms->smm =3D ON_OFF_AUTO_AUTO; x86ms->max_ram_below_4g =3D 0; /* use default */ x86ms->smp_dies =3D 1; } @@ -770,9 +813,14 @@ static void x86_machine_class_init(ObjectClass *oc, vo= id *data) object_class_property_add(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "size", x86_machine_get_max_ram_below_4g, x86_machine_set_max_ram_below_4g, NULL, NULL, &error_abort); - object_class_property_set_description(oc, X86_MACHINE_MAX_RAM_BELOW_4G, "Maximum ram below the 4G boundary (32bit boundary)", &error_abort= ); + + object_class_property_add(oc, X86_MACHINE_SMM, "OnOffAuto", + x86_machine_get_smm, x86_machine_set_smm, + NULL, NULL, &error_abort); + object_class_property_set_description(oc, X86_MACHINE_SMM, + "Enable SMM", &error_abort); } =20 static const TypeInfo x86_machine_info =3D { diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index e2cd453..ade5a85 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -43,7 +43,6 @@ struct PCMachineState { =20 /* Configuration options: */ OnOffAuto vmport; - OnOffAuto smm; =20 bool acpi_build_enabled; bool smbus_enabled; @@ -61,7 +60,6 @@ struct PCMachineState { #define PC_MACHINE_ACPI_DEVICE_PROP "acpi-device" #define PC_MACHINE_DEVMEM_REGION_SIZE "device-memory-region-size" #define PC_MACHINE_VMPORT "vmport" -#define PC_MACHINE_SMM "smm" #define PC_MACHINE_SMBUS "smbus" #define PC_MACHINE_SATA "sata" #define PC_MACHINE_PIT "pit" @@ -165,7 +163,6 @@ void vmmouse_set_data(const uint32_t *data); /* pc.c */ extern int fd_bootchk; =20 -bool pc_machine_is_smm_enabled(PCMachineState *pcms); void pc_acpi_smi_interrupt(void *opaque, int irq, int level); =20 void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp); diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 4b84917..97d1575 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -60,6 +60,8 @@ typedef struct { uint16_t boot_cpus; unsigned smp_dies; =20 + OnOffAuto smm; + /* * Address space used by IOAPIC device. All IOAPIC interrupts * will be translated to MSI messages in the address space. @@ -68,6 +70,7 @@ typedef struct { } X86MachineState; =20 #define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g" +#define X86_MACHINE_SMM "smm" =20 #define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86") #define X86_MACHINE(obj) \ @@ -95,4 +98,6 @@ void x86_load_linux(X86MachineState *x86ms, bool pvh_enabled, bool linuxboot_dma_enabled); =20 +bool x86_machine_is_smm_enabled(X86MachineState *x86ms); + #endif diff --git a/target/i386/kvm.c b/target/i386/kvm.c index ef63f3a..c7ff67a 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2173,8 +2173,7 @@ int kvm_arch_init(MachineState *ms, KVMState *s) } =20 if (kvm_check_extension(s, KVM_CAP_X86_SMM) && - object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE) && - pc_machine_is_smm_enabled(PC_MACHINE(ms))) { + x86_machine_is_smm_enabled(X86_MACHINE(ms))) { smram_machine_done.notify =3D register_smram_listener; qemu_add_machine_init_done_notifier(&smram_machine_done); } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672666; cv=none; d=zohomail.com; s=zohoarc; b=FqXgBFAbCProrTfkRfFf4lluPb2MExB8TcUhucPHcw9TZDaSv8r0nvQNbnrbrt9zA1eSuWV2MjneU1u5vUWlqqianevQzw2TslDVbbWdZsDlfR9KjfXAYn019vGbj9TVOiEMPQ7XMW6jhYiK9XEJSV9q+WFf9K82YaaHqxXi5+c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672666; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SpgbQ9V34H0m21+BzAIwX/uz5DHNKZyNJLeHPTNtum0=; b=MwFWRG2r7ZA7xYUckRoi0gJzQ35AFONg9ZwepOEXfQO6gLSRL+/fxWKFYe6xaCjaV58YIdhb7Z223PtWdpXEqrsHBPByo3h5owmn1Zq1q4LFUEQxdLDV+SEChjOXFSXU8cuBRmr3BcYPPMWjJ89c78qEyW2/Y/QH+Z3h11YQPxc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672666219266.0375103295129; Wed, 18 Dec 2019 04:37:46 -0800 (PST) Received: from localhost ([::1]:53586 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYaG-0003ih-NP for importer@patchew.org; Wed, 18 Dec 2019 07:37:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51433) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3T-0006jX-0T for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3R-0001hN-Ct for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:50 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:54504) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3R-0001d7-42 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:49 -0500 Received: by mail-wm1-x343.google.com with SMTP id b19so1553742wmj.4 for ; Wed, 18 Dec 2019 04:03:49 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:46 -0800 (PST) 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=SpgbQ9V34H0m21+BzAIwX/uz5DHNKZyNJLeHPTNtum0=; b=NtZvfvZzg9ibENMM4u+shcQ3U3atavXI01VQj+VRzZFrF3h9Jo5nVM5g0NDOvND3PX 2bfSvliOi0pTiweUl1rVZcDbF/5VsEkXzmCfVJcUVxxT29a3f0e0+6opv0P+LIehXB53 lhBTklIuOPNPm6Nnd1nISrFC3qprD7zPXcf4tExTpA/J6KSO+WjxOn4S4/NostQc0xmF 9Iywipn/xC9Q5tpGh4FRT03oGcz/EBsxjFq9J/LrOaXW96T1nm7CT1ZXEJ0sI2duBSYy mTBhoORyacQ8IsF/IaJwm81+2wo/HJktXuA6rq35lXAaXMun07TMjtmF8JhzBw3jmfFV np/A== 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=SpgbQ9V34H0m21+BzAIwX/uz5DHNKZyNJLeHPTNtum0=; b=Ne3VZ3YFoxlWqDMDGK/Lq1NcjgEiBIj6I2PJwS0fgE9F19Q9n102yGnwz9nfRa7QoZ AaNTL7Tm4wEPrlunAMotGcPkxQSekVA0EM0mHUYaLTnRac8Ypq7A6yy3HlczEzyYbXrA fxfcHMgCWZMp0WhWnYd7lZJT9QvmJPHsOSgnHpC4OvCdtAvlFNvfGWrVnCIcagOVfaP7 KFij7mRJR/G7oJ24YBhzfDof9eSHSHY7EHf3pxmpDz7DP2KQLDcb9/o3Fygzn4B/AP3Z AfpgsJTdPKgWO6u9vEMEL1SuLBB9PTo5iqIKDXNB3XdLNQdieovjiOSGwTVXPCCuI70C /jzQ== X-Gm-Message-State: APjAAAV/RXzXh2wgD6AnnPlCAivKCJwYZPvauCCAq5b8f9pzwHKEoZ4o bi21fk9juu8vV0USlIY9r2k50cRz X-Google-Smtp-Source: APXvYqyOsjh/wHvrdvKCK6bZqBiNvRPJtoXxQTJnSjUMFI6Fn8WW/juP/4mLLYxhsg6bE8ISvTzxNQ== X-Received: by 2002:a1c:e91a:: with SMTP id q26mr2847284wmc.59.1576670627578; Wed, 18 Dec 2019 04:03:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 49/87] hw/i386/pc: Convert DPRINTF() to trace events Date: Wed, 18 Dec 2019 13:02:15 +0100 Message-Id: <1576670573-48048-50-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Convert the deprecated DPRINTF() macro to trace events. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 19 +++++-------------- hw/i386/trace-events | 6 ++++++ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e330a91..d3075e7 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -91,16 +91,7 @@ #include "config-devices.h" #include "e820_memory_layout.h" #include "fw_cfg.h" - -/* debug PC/ISA interrupts */ -//#define DEBUG_IRQ - -#ifdef DEBUG_IRQ -#define DPRINTF(fmt, ...) \ - do { printf("CPUIRQ: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) -#endif +#include "trace.h" =20 GlobalProperty pc_compat_4_2[] =3D {}; const size_t pc_compat_4_2_len =3D G_N_ELEMENTS(pc_compat_4_2); @@ -350,7 +341,7 @@ void gsi_handler(void *opaque, int n, int level) { GSIState *s =3D opaque; =20 - DPRINTF("pc: %s GSI %d\n", level ? "raising" : "lowering", n); + trace_pc_gsi_interrupt(n, level); if (n < ISA_NUM_IRQS) { qemu_set_irq(s->i8259_irq[n], level); } @@ -428,7 +419,7 @@ static void pic_irq_request(void *opaque, int irq, int = level) CPUState *cs =3D first_cpu; X86CPU *cpu =3D X86_CPU(cs); =20 - DPRINTF("pic_irqs: %s irq %d\n", level? "raise" : "lower", irq); + trace_pc_pic_interrupt(irq, level); if (cpu->apic_state && !kvm_irqchip_in_kernel()) { CPU_FOREACH(cs) { cpu =3D X86_CPU(cs); @@ -762,7 +753,7 @@ static void port92_write(void *opaque, hwaddr addr, uin= t64_t val, Port92State *s =3D opaque; int oldval =3D s->outport; =20 - DPRINTF("port92: write 0x%02" PRIx64 "\n", val); + trace_port92_write(val); s->outport =3D val; qemu_set_irq(s->a20_out, (val >> 1) & 1); if ((val & 1) && !(oldval & 1)) { @@ -777,7 +768,7 @@ static uint64_t port92_read(void *opaque, hwaddr addr, uint32_t ret; =20 ret =3D s->outport; - DPRINTF("port92: read 0x%02x\n", ret); + trace_port92_read(ret); return ret; } =20 diff --git a/hw/i386/trace-events b/hw/i386/trace-events index c8bc464..43f33cf 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -111,3 +111,9 @@ amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%"= PRIx64" lo 0x%"PRIx64 # vmport.c vmport_register(unsigned char command, void *func, void *opaque) "command:= 0x%02x func: %p opaque: %p" vmport_command(unsigned char command) "command: 0x%02x" + +# pc.c +pc_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" +pc_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" +port92_read(uint8_t val) "port92: read 0x%02x" +port92_write(uint8_t val) "port92: write 0x%02x" --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672933; cv=none; d=zohomail.com; s=zohoarc; b=OEoNlgTXovWAM8t1ZcZ1o0/vN3IY82YaRz1XK7lmVuvX0Yqsqk90cgXYkqczfngoZcIHHjIjltqlkPPI9CeQZG98CdXpdTHmf6G7IJ4+svrk0ndrMYKqwGKaPxXOihYTs57Qasu0vnfVGJYMHjegOhe+EDfolTpVfwddvt9E8Y0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672933; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=uOIP5vP1b127eDbPjKV75YB4yucXJJPzJg+VRiqPXok=; b=M4gpB0KDZF+l/+2rfO7Gx7IWSEE7bxovAx25dLXm5UtHum2U/cNSovBew9QeejGc3cc5m1y/NLGdgQj9xjKoLt98ES+TVUSkhOMCHYH9bo62rm7DmpER9tUnK1IZpXdVbsK0Qa56HvHwvBIMRVGhUSxlxW2/q5ZqnzJ8vfyQX7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672933169749.4958559747153; Wed, 18 Dec 2019 04:42:13 -0800 (PST) Received: from localhost ([::1]:53636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYeY-0001ql-Uu for importer@patchew.org; Wed, 18 Dec 2019 07:42:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52101) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3W-0006oS-E3 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3S-0001nF-Oc for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:54 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:42333) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3S-0001iq-As for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:50 -0500 Received: by mail-wr1-x42a.google.com with SMTP id q6so1980898wro.9 for ; Wed, 18 Dec 2019 04:03:50 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:47 -0800 (PST) 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=uOIP5vP1b127eDbPjKV75YB4yucXJJPzJg+VRiqPXok=; b=jB/AbgyF4eb3TtdzLV8gtv+NPjRxj4y8Oko0pSgmwVBwfyASuLKfFS1fwB+2/gtr9F D9thEbNtcQUYB6MFoEFCxtOwXSSU7DLeMvKjHaOQUmUZ2hK7ZcY+jTJW4L4ekz6xSwje jXA7rp+UxPnKmx4fRgl5RQ67DxhNQ8MEO8jKlvTH4RZukdWVcngZO2HFCYi4k1I9x84O 9cBKtYWIJfFurgtDjYf75tCTsoDil1vaTqdlKb7gyiE9KG9CPnSWxeWn0y+YYjuDnkGP 0iwIDog29yEjJD1XN0SiCWWp6MYcyObcYU3bUtmotWqBCDgcOYw27KY90ljprx+QjXaK Oa+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:subject:date:message-id :in-reply-to:references; bh=uOIP5vP1b127eDbPjKV75YB4yucXJJPzJg+VRiqPXok=; b=S3Wq+tuO0LaHxHG7Zw9TRq+9EaYzOQGrcWN/+7yrN2PE+oWM1i/HBWOrPOvY9rynpD 6QVRTkIVuLsMpZpRkelfrgONqUS95YaAVIOMgQelF/SYk38iupCctvaBmPJadcz9gt6a uCHDiH3ETpqsF0gv+bs1rZPpmEu64PLA3NUiChfr3aC2ZUPCPYnX86NclCEU+yq+sXnE /HyNciR3UrEMG+WaOdGkCTjjMYm+3S3zUTBG16Sd5Y0hMHjDaDhe8Qd+NESwFIQ2SHEu 28juYHnG4+0+nRYbKpOtI103NOgitm0mtMIYPJhotNdQyIeFQsWl2ihjZ5rheAhggV2e vH/g== X-Gm-Message-State: APjAAAX4pdtO7VlkJV1+oiqeiGB1EYo4x4TSkJOOweoYgXwBKpEYF5Ls 8FaJ7xEz6CRSWF7nWGhhceO3HF1s X-Google-Smtp-Source: APXvYqx4anwFAxXONN07kBSyGd4WK0F4yraJP/D0xVcSRor8sSNVI6wUQpmX8JWUuqqPOqCHT4Cosw== X-Received: by 2002:a5d:6349:: with SMTP id b9mr2565561wrw.346.1576670628773; Wed, 18 Dec 2019 04:03:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 50/87] x86: move more x86-generic functions out of PC files Date: Wed, 18 Dec 2019 13:02:16 +0100 Message-Id: <1576670573-48048-51-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These are needed by microvm too, so move them outside of PC-specific files. With this patch, microvm.c need not include pc.h anymore. Signed-off-by: Paolo Bonzini --- hw/i386/acpi-build.c | 1 + hw/i386/fw_cfg.c | 1 - hw/i386/fw_cfg.h | 2 + hw/i386/kvm/ioapic.c | 2 +- hw/i386/microvm.c | 3 +- hw/i386/pc.c | 101 +---------------------------------------------= --- hw/i386/trace-events | 6 ++- hw/i386/x86.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ include/hw/i386/pc.h | 20 ---------- include/hw/i386/x86.h | 18 +++++++++ target/i386/kvm.c | 2 +- target/i386/machine.c | 2 +- 12 files changed, 133 insertions(+), 128 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 12ff55f..7b8da62 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -53,6 +53,7 @@ /* Supported chipsets: */ #include "hw/southbridge/piix.h" #include "hw/acpi/pcihp.h" +#include "hw/i386/fw_cfg.h" #include "hw/i386/ich9.h" #include "hw/pci/pci_bus.h" #include "hw/pci-host/q35.h" diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c index 326e33e..da60ada 100644 --- a/hw/i386/fw_cfg.c +++ b/hw/i386/fw_cfg.c @@ -16,7 +16,6 @@ #include "sysemu/numa.h" #include "hw/acpi/acpi.h" #include "hw/firmware/smbios.h" -#include "hw/i386/pc.h" #include "hw/i386/fw_cfg.h" #include "hw/timer/hpet.h" #include "hw/nvram/fw_cfg.h" diff --git a/hw/i386/fw_cfg.h b/hw/i386/fw_cfg.h index e0856a3..9e74278 100644 --- a/hw/i386/fw_cfg.h +++ b/hw/i386/fw_cfg.h @@ -12,6 +12,8 @@ #include "hw/boards.h" #include "hw/nvram/fw_cfg.h" =20 +#define FW_CFG_IO_BASE 0x510 + #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0) #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1) #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2) diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index f94729c..8703f19 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -12,7 +12,7 @@ =20 #include "qemu/osdep.h" #include "monitor/monitor.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/irq.h" #include "hw/qdev-properties.h" #include "hw/i386/ioapic_internal.h" diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 2068319..827ce29 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -32,7 +32,6 @@ #include "hw/kvm/clock.h" #include "hw/i386/microvm.h" #include "hw/i386/x86.h" -#include "hw/i386/pc.h" #include "target/i386/cpu.h" #include "hw/intc/i8259.h" #include "hw/timer/i8254.h" @@ -133,7 +132,7 @@ static void microvm_devices_init(MicrovmMachineState *m= ms) if (mms->pic =3D=3D ON_OFF_AUTO_ON || mms->pic =3D=3D ON_OFF_AUTO_AUTO= ) { qemu_irq *i8259; =20 - i8259 =3D i8259_init(isa_bus, pc_allocate_cpu_irq()); + i8259 =3D i8259_init(isa_bus, x86_allocate_cpu_irq()); for (i =3D 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] =3D i8259[i]; } diff --git a/hw/i386/pc.c b/hw/i386/pc.c index d3075e7..dff09e4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -337,17 +337,6 @@ GlobalProperty pc_compat_1_4[] =3D { }; const size_t pc_compat_1_4_len =3D G_N_ELEMENTS(pc_compat_1_4); =20 -void gsi_handler(void *opaque, int n, int level) -{ - GSIState *s =3D opaque; - - trace_pc_gsi_interrupt(n, level); - if (n < ISA_NUM_IRQS) { - qemu_set_irq(s->i8259_irq[n], level); - } - qemu_set_irq(s->ioapic_irq[n], level); -} - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled) { GSIState *s; @@ -387,55 +376,6 @@ static uint64_t ioportF0_read(void *opaque, hwaddr add= r, unsigned size) return 0xffffffffffffffffULL; } =20 -/* TSC handling */ -uint64_t cpu_get_tsc(CPUX86State *env) -{ - return cpu_get_ticks(); -} - -/* IRQ handling */ -int cpu_get_pic_interrupt(CPUX86State *env) -{ - X86CPU *cpu =3D env_archcpu(env); - int intno; - - if (!kvm_irqchip_in_kernel()) { - intno =3D apic_get_interrupt(cpu->apic_state); - if (intno >=3D 0) { - return intno; - } - /* read the irq from the PIC */ - if (!apic_accept_pic_intr(cpu->apic_state)) { - return -1; - } - } - - intno =3D pic_read_irq(isa_pic); - return intno; -} - -static void pic_irq_request(void *opaque, int irq, int level) -{ - CPUState *cs =3D first_cpu; - X86CPU *cpu =3D X86_CPU(cs); - - trace_pc_pic_interrupt(irq, level); - if (cpu->apic_state && !kvm_irqchip_in_kernel()) { - CPU_FOREACH(cs) { - cpu =3D X86_CPU(cs); - if (apic_accept_pic_intr(cpu->apic_state)) { - apic_deliver_pic_intr(cpu->apic_state, level); - } - } - } else { - if (level) { - cpu_interrupt(cs, CPU_INTERRUPT_HARD); - } else { - cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); - } - } -} - /* PC cmos mappings */ =20 #define REG_EQUIPMENT_BYTE 0x14 @@ -879,16 +819,6 @@ void pc_init_ne2k_isa(ISABus *bus, NICInfo *nd) nb_ne2k++; } =20 -DeviceState *cpu_get_current_apic(void) -{ - if (current_cpu) { - X86CPU *cpu =3D X86_CPU(current_cpu); - return cpu->apic_state; - } else { - return NULL; - } -} - void pc_acpi_smi_interrupt(void *opaque, int irq, int level) { X86CPU *cpu =3D opaque; @@ -1284,11 +1214,6 @@ uint64_t pc_pci_hole64_start(void) return ROUND_UP(hole64_start, 1 * GiB); } =20 -qemu_irq pc_allocate_cpu_irq(void) -{ - return qemu_allocate_irq(pic_irq_request, NULL, 0); -} - DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus) { DeviceState *dev =3D NULL; @@ -1465,7 +1390,7 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259= _irqs) } else if (xen_enabled()) { i8259 =3D xen_interrupt_controller_init(); } else { - i8259 =3D i8259_init(isa_bus, pc_allocate_cpu_irq()); + i8259 =3D i8259_init(isa_bus, x86_allocate_cpu_irq()); } =20 for (size_t i =3D 0; i < ISA_NUM_IRQS; i++) { @@ -1475,30 +1400,6 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i825= 9_irqs) g_free(i8259); } =20 -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) -{ - DeviceState *dev; - SysBusDevice *d; - unsigned int i; - - if (kvm_ioapic_in_kernel()) { - dev =3D qdev_create(NULL, TYPE_KVM_IOAPIC); - } else { - dev =3D qdev_create(NULL, TYPE_IOAPIC); - } - if (parent_name) { - object_property_add_child(object_resolve_path(parent_name, NULL), - "ioapic", OBJECT(dev), NULL); - } - qdev_init_nofail(dev); - d =3D SYS_BUS_DEVICE(dev); - sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); - - for (i =3D 0; i < IOAPIC_NUM_PINS; i++) { - gsi_state->ioapic_irq[i] =3D qdev_get_gpio_in(dev, i); - } -} - static void pc_memory_pre_plug(HotplugHandler *hotplug_dev, DeviceState *d= ev, Error **errp) { diff --git a/hw/i386/trace-events b/hw/i386/trace-events index 43f33cf..a9b6437 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -112,8 +112,10 @@ amdvi_ir_irte_ga_val(uint64_t hi, uint64_t lo) "hi 0x%= "PRIx64" lo 0x%"PRIx64 vmport_register(unsigned char command, void *func, void *opaque) "command:= 0x%02x func: %p opaque: %p" vmport_command(unsigned char command) "command: 0x%02x" =20 +# x86.c +x86_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" +x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" + # pc.c -pc_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" -pc_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" port92_read(uint8_t val) "port92: read 0x%02x" port92_write(uint8_t val) "port92: write 0x%02x" diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 6fb01e4..80e33be 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -34,6 +34,7 @@ #include "sysemu/numa.h" #include "sysemu/replay.h" #include "sysemu/sysemu.h" +#include "trace.h" =20 #include "hw/i386/x86.h" #include "target/i386/cpu.h" @@ -42,11 +43,14 @@ #include "hw/intc/i8259.h" =20 #include "hw/acpi/cpu_hotplug.h" +#include "hw/irq.h" #include "hw/nmi.h" #include "hw/loader.h" #include "multiboot.h" #include "elf.h" #include "standard-headers/asm-x86/bootparam.h" +#include "config-devices.h" +#include "kvm_i386.h" =20 #define BIOS_FILENAME "bios.bin" =20 @@ -221,6 +225,105 @@ static long get_file_size(FILE *f) return size; } =20 +/* TSC handling */ +uint64_t cpu_get_tsc(CPUX86State *env) +{ + return cpu_get_ticks(); +} + +/* IRQ handling */ +static void pic_irq_request(void *opaque, int irq, int level) +{ + CPUState *cs =3D first_cpu; + X86CPU *cpu =3D X86_CPU(cs); + + trace_x86_pic_interrupt(irq, level); + if (cpu->apic_state && !kvm_irqchip_in_kernel()) { + CPU_FOREACH(cs) { + cpu =3D X86_CPU(cs); + if (apic_accept_pic_intr(cpu->apic_state)) { + apic_deliver_pic_intr(cpu->apic_state, level); + } + } + } else { + if (level) { + cpu_interrupt(cs, CPU_INTERRUPT_HARD); + } else { + cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD); + } + } +} + +qemu_irq x86_allocate_cpu_irq(void) +{ + return qemu_allocate_irq(pic_irq_request, NULL, 0); +} + +int cpu_get_pic_interrupt(CPUX86State *env) +{ + X86CPU *cpu =3D env_archcpu(env); + int intno; + + if (!kvm_irqchip_in_kernel()) { + intno =3D apic_get_interrupt(cpu->apic_state); + if (intno >=3D 0) { + return intno; + } + /* read the irq from the PIC */ + if (!apic_accept_pic_intr(cpu->apic_state)) { + return -1; + } + } + + intno =3D pic_read_irq(isa_pic); + return intno; +} + +DeviceState *cpu_get_current_apic(void) +{ + if (current_cpu) { + X86CPU *cpu =3D X86_CPU(current_cpu); + return cpu->apic_state; + } else { + return NULL; + } +} + +void gsi_handler(void *opaque, int n, int level) +{ + GSIState *s =3D opaque; + + trace_x86_gsi_interrupt(n, level); + if (n < ISA_NUM_IRQS) { + qemu_set_irq(s->i8259_irq[n], level); + } + qemu_set_irq(s->ioapic_irq[n], level); +} + +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name) +{ + DeviceState *dev; + SysBusDevice *d; + unsigned int i; + + if (kvm_ioapic_in_kernel()) { + dev =3D qdev_create(NULL, TYPE_KVM_IOAPIC); + } else { + dev =3D qdev_create(NULL, TYPE_IOAPIC); + } + if (parent_name) { + object_property_add_child(object_resolve_path(parent_name, NULL), + "ioapic", OBJECT(dev), NULL); + } + qdev_init_nofail(dev); + d =3D SYS_BUS_DEVICE(dev); + sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); + + for (i =3D 0; i < IOAPIC_NUM_PINS; i++) { + gsi_state->ioapic_irq[i] =3D qdev_get_gpio_in(dev, i); + } +} + struct setup_data { uint64_t next; uint32_t type; diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ade5a85..58aaa23 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -3,11 +3,9 @@ =20 #include "exec/memory.h" #include "hw/boards.h" -#include "hw/isa/isa.h" #include "hw/block/fdc.h" #include "hw/block/flash.h" #include "net/net.h" -#include "hw/i386/ioapic.h" #include "hw/i386/x86.h" =20 #include "qemu/range.h" @@ -134,17 +132,6 @@ typedef struct PCMachineClass { =20 /* ioapic.c */ =20 -/* Global System Interrupts */ - -#define GSI_NUM_PINS IOAPIC_NUM_PINS - -typedef struct GSIState { - qemu_irq i8259_irq[ISA_NUM_IRQS]; - qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; -} GSIState; - -void gsi_handler(void *opaque, int n, int level); - GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enabled); =20 /* vmport.c */ @@ -188,7 +175,6 @@ void pc_memory_init(PCMachineState *pcms, MemoryRegion *rom_memory, MemoryRegion **ram_memory); uint64_t pc_pci_hole64_start(void); -qemu_irq pc_allocate_cpu_irq(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, @@ -206,18 +192,12 @@ void pc_pci_device_init(PCIBus *pci_bus); typedef void (*cpu_set_smm_t)(int smm, void *arg); =20 void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_irqs); -void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); =20 ISADevice *pc_find_fdc0(void); int cmos_get_fd_drive_type(FloppyDriveType fd0); =20 -#define FW_CFG_IO_BASE 0x510 - #define PORT92_A20_LINE "a20" =20 -/* hpet.c */ -extern int no_hpet; - /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memor= y); diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index 97d1575..41fe37b 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -23,6 +23,8 @@ =20 #include "hw/boards.h" #include "hw/nmi.h" +#include "hw/isa/isa.h" +#include "hw/i386/ioapic.h" =20 typedef struct { /*< private >*/ @@ -100,4 +102,20 @@ void x86_load_linux(X86MachineState *x86ms, =20 bool x86_machine_is_smm_enabled(X86MachineState *x86ms); =20 +/* Global System Interrupts */ + +#define GSI_NUM_PINS IOAPIC_NUM_PINS + +typedef struct GSIState { + qemu_irq i8259_irq[ISA_NUM_IRQS]; + qemu_irq ioapic_irq[IOAPIC_NUM_PINS]; +} GSIState; + +qemu_irq x86_allocate_cpu_irq(void); +void gsi_handler(void *opaque, int n, int level); +void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name); + +/* hpet.c */ +extern int no_hpet; + #endif diff --git a/target/i386/kvm.c b/target/i386/kvm.c index c7ff67a..55e6265 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -35,7 +35,7 @@ #include "qemu/main-loop.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "hw/i386/pc.h" +#include "hw/i386/x86.h" #include "hw/i386/apic.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic-msidef.h" diff --git a/target/i386/machine.c b/target/i386/machine.c index 2699eed..b6720d8 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -1,10 +1,10 @@ #include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" -#include "hw/i386/pc.h" #include "hw/isa/isa.h" #include "migration/cpu.h" #include "hyperv.h" +#include "hw/i386/x86.h" #include "kvm_i386.h" =20 #include "sysemu/kvm.h" --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672105; cv=none; d=zohomail.com; s=zohoarc; b=TqKpyOtJeFCP2nDPP4nbxTZsmWn5vcTPMYzZwi7M+VJ2u0eG6l06oxSgYp6yztGeI+4e1k0yZCVMdPdiQj6Vp35qf+NZgKvIpOr/AN2+63+3SYZSsUL5lYkgWNiD4rF/Kegm4WZvRZP6g0LV9ZGoUDjMhPg8pja9Iq4pNXHh7/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672105; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=bCglA2xU8XIovJ5evRIXUQsgqKR2GztUSfl273PP6MA=; b=JS6MOJI74lOtQsldylBWX2lQCy030S+V/vstgHJcpJetN2BVeePu1KNLpM36be57AqWtDAvCQyDqM7cs49u2c2gfdVhD4rPfNfacajtzO8riH8mbCb+DBUV11S8XaFFCEzllXNvEZIgxkxCZJrHX+4pD7UHq/hgbdeYSrrDG9+c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672105278595.7865049203904; Wed, 18 Dec 2019 04:28:25 -0800 (PST) Received: from localhost ([::1]:53458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYRD-0006ek-Q5 for importer@patchew.org; Wed, 18 Dec 2019 07:28:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52935) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3a-0006vE-BN for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3Z-0002DF-4s for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:58 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:35439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3Y-00029i-TP for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:57 -0500 Received: by mail-wr1-x430.google.com with SMTP id g17so2024596wro.2 for ; Wed, 18 Dec 2019 04:03:56 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:49 -0800 (PST) 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=bCglA2xU8XIovJ5evRIXUQsgqKR2GztUSfl273PP6MA=; b=r1OTnd6TgT0Odu3JhHL/KfCZ9Luq7IFhzSJeMIL6T4OJTeLtfn8W5jrdpLGmUTvU5+ aFJ42fVxm1mZUbIvzbBON+WDHv6CuayWsJHeF2vSJp70gPEjJFHs//DgksAPToX2iWz5 iCsq02SBRkJsUWH7mtbsFtKuiV+H6oWdlT8DY18avA/ZMZ372QEEEK/qaxfdMuByAPXc OGJc4DrMPi7UvW/6GZpnRmckrYekr/IvmTD0jYkK6Tf9ZrbqhVYQB7E/KNjZsB+Kk7iK bwYG8HuMLeDVtQGSmJBulWCd4VAYtZILvLAi2ylxd1s4X4E7Exl6hOvPbbwiLNzzk3vU s3Pg== 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=bCglA2xU8XIovJ5evRIXUQsgqKR2GztUSfl273PP6MA=; b=fjczZMsjJhxaO/wwdn2Mo6T2VlUxDeXSN9cRha8CGKa9Q4qtDWMqeEXC/YdBN85uqy RzdMARDRQ7xlWhHIMNoa3wGvy41uFVDJSEibgfCWQ6RLeIhrzmG5htSYRnIfeLXFMnCX swnLv8/HvOR8ETcMJLYRskjiAGeecajLH4BSulT1M1eMiLwb7VgAtSGizEiTv2ljjPMa AgHPUoOHyplT1U5Te19M/NPk2Hr53zG+4auOGzREMTA2kbjuojLXicPeH/ewOF0C3jOG mOlkRVVGELwHyAKu/cuYqxQerszudfl1iTy5FpEZNojQV3eNJ/wJ1VIMB22NahlH5LR+ bsWw== X-Gm-Message-State: APjAAAWakiCuwJ66Iujq0r4z9t95tYjUU3aUYWaWyqhxPJTtOJWqwQ95 HSevlQMAiTi0sCxbojG1xHQgqHY5 X-Google-Smtp-Source: APXvYqzHvZ/AvLx1bHzYeyMa8Hur/16+RSPt+GGl9/GYI5FoGbiCQfD+732ird3QAgqgCH4fsiMfGg== X-Received: by 2002:adf:c147:: with SMTP id w7mr2500529wre.389.1576670635635; Wed, 18 Dec 2019 04:03:55 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 51/87] acpi: move PC stubs out of stubs/ Date: Wed, 18 Dec 2019 13:02:17 +0100 Message-Id: <1576670573-48048-52-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is a small cleanup that lets microvm build entirely without include/hw/i386/pc.h. Signed-off-by: Paolo Bonzini --- hw/acpi/Makefile.objs | 3 ++- stubs/pc_madt_cpu_entry.c =3D> hw/acpi/acpi-x86-stub.c | 0 stubs/Makefile.objs | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) rename stubs/pc_madt_cpu_entry.c =3D> hw/acpi/acpi-x86-stub.c (100%) diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 655a9c1..9925305 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -8,6 +8,7 @@ common-obj-$(CONFIG_ACPI_NVDIMM) +=3D nvdimm.o common-obj-$(CONFIG_ACPI_VMGENID) +=3D vmgenid.o common-obj-$(CONFIG_ACPI_HW_REDUCED) +=3D generic_event_device.o common-obj-$(call lnot,$(CONFIG_ACPI_X86)) +=3D acpi-stub.o +common-obj-$(call lnot,$(CONFIG_PC)) +=3D acpi-x86-stub.o =20 common-obj-y +=3D acpi_interface.o common-obj-y +=3D bios-linker-loader.o @@ -20,4 +21,4 @@ common-obj-$(call lnot,$(CONFIG_IPMI)) +=3D ipmi-stub.o else common-obj-y +=3D acpi-stub.o endif -common-obj-$(CONFIG_ALL) +=3D acpi-stub.o ipmi-stub.o +common-obj-$(CONFIG_ALL) +=3D acpi-stub.o acpi-x86-stub.o ipmi-stub.o diff --git a/stubs/pc_madt_cpu_entry.c b/hw/acpi/acpi-x86-stub.c similarity index 100% rename from stubs/pc_madt_cpu_entry.c rename to hw/acpi/acpi-x86-stub.c diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 4a50e95..8b0ff25 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -33,7 +33,6 @@ stub-obj-y +=3D fd-register.o stub-obj-y +=3D qmp_memory_device.o stub-obj-y +=3D target-monitor-defs.o stub-obj-y +=3D target-get-monitor-def.o -stub-obj-y +=3D pc_madt_cpu_entry.o stub-obj-y +=3D vmgenid.o stub-obj-y +=3D xen-common.o stub-obj-y +=3D xen-hvm.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673099; cv=none; d=zohomail.com; s=zohoarc; b=RrHJ+cvDoZTeCOmz0WlPMb56OaYXOHrG/g+ywoadVVyEJUtC4nbWfzMtFM9xfBTBgBGHTi7CZ0CVwF2C7Cb2kUkTdATVNmtLfNZBzLBUyZefXJ04KrhcvOyru5EP84SIeboT5SEnd2WX8cO9s3lAcvg+WeyCslD1KgegD/BdqlQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673099; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=9NSUuNQ9Jf+FzPsRmj7s9FDau0CX5jauhzpAS1A8igc=; b=RrjjfdlZAqWuKrU4OWipqO32A1GRN5N/hr+4zXjGWHvnXKH/yAuILo4Xs9AhQSFYXJ3Ex2IuXJTJWu0tQi95Bd+LZ+jglsAd0k/sH9Gln5sP/iFEBCeLWr9Qq5nRWbW2qN4MVz/tq+qfFsJBIgx72rtz0soDg5q1AiTaFyPvYXU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673099039533.6852358958057; Wed, 18 Dec 2019 04:44:59 -0800 (PST) Received: from localhost ([::1]:53660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYhF-0005ut-FP for importer@patchew.org; Wed, 18 Dec 2019 07:44:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53168) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3b-0006wf-DB for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3Z-0002Gv-TW for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:59 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:40713) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3Z-0002Ch-IE for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:57 -0500 Received: by mail-wm1-x341.google.com with SMTP id t14so1601790wmi.5 for ; Wed, 18 Dec 2019 04:03:57 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:55 -0800 (PST) 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=9NSUuNQ9Jf+FzPsRmj7s9FDau0CX5jauhzpAS1A8igc=; b=Lltcuq+0ldRHjf0er3qRVaIC81aT3bi5KEE3iNcfJosmGuQK0YNnp/Sw4nfP/rb/Ia aBQ3Aio6wEF873h0T74Qe1iUVoPDrPIYO+z7tstBBL1SRWnQjYLD24bUVVKU4+Yw3LXt 5ex6M2OjOTEq7BacruMTg2l4BhOmP6UePS2AgKKhad4CGpyg7SqmpojdE0oXHtU+5xA9 I2UdwQSDNwL5dxMu0Lb1/GjiCv35ZfX2wqxqjU6AIJvgk7WDNIPgbu1fk+t+SC6r+KWZ 7Fs/Dvi9bAmEPv6/MRTmg4gbileFUa07ow7emxftjURhvCzBATPejoYe8nbqJYEIB4+9 V9yg== 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=9NSUuNQ9Jf+FzPsRmj7s9FDau0CX5jauhzpAS1A8igc=; b=iN3kGX0I/r5n2hF/rUa0PhKKLY8kjCyRCG0wxlORNFXmIRosv1dAT79Nrd0ZS03dlU ExjVlvC8vMWPCoKotc8eDe2/wifNK0ZJfNKI13TaPCXoKMu/SdfJxJD0eVFAU69yF5fi Mg4WreAfnGKZNhDKrgggItxklyx1/InNZNbbdxM1pvZvJfc5Jd4NHFW9vbx5i0noFfcP 1/usB5WDB7SXCri1uWuaEW1dBGd/Laslhh3o9BWlP2SrN/wlwMGEFIYmBjm6UVPTv8Fr l0qSVUPeFqPO38tGGPj/+xuRYC9CDmFWU9JcArSnVH9AtlCQbsX0oooJXN4u9U2Lypj2 +nQg== X-Gm-Message-State: APjAAAXEZHrWBbxEcE3MyqEfO+6cH28znCYLPDlAaVZAGQ1B3BrM0b1h YRJSxsiAvGfXtnMYXs1GnyYTZUK/ X-Google-Smtp-Source: APXvYqybIevhvTsxNbcpHBy1vU1D6eLHZhSvbguAZPjCAxgB1qrCxISjQ6694Ysze0BnOgaRj16u0g== X-Received: by 2002:a05:600c:246:: with SMTP id 6mr2645075wmj.122.1576670636351; Wed, 18 Dec 2019 04:03:56 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 52/87] pc: stubify x86 iommu Date: Wed, 18 Dec 2019 13:02:18 +0100 Message-Id: <1576670573-48048-53-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Allow building microvm without x86-iommu.c. Signed-off-by: Paolo Bonzini --- hw/i386/Kconfig | 6 ++++++ hw/i386/Makefile.objs | 3 ++- hw/i386/x86-iommu-stub.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 hw/i386/x86-iommu-stub.c diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig index 5a49434..91cf584 100644 --- a/hw/i386/Kconfig +++ b/hw/i386/Kconfig @@ -103,11 +103,17 @@ config MICROVM select MC146818RTC select VIRTIO_MMIO =20 +config X86_IOMMU + bool + depends on PC + config VTD bool + select X86_IOMMU =20 config AMD_IOMMU bool + select X86_IOMMU =20 config VMPORT bool diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 01ae202..1236c3b 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -6,7 +6,8 @@ obj-$(CONFIG_I440FX) +=3D pc_piix.o obj-$(CONFIG_Q35) +=3D pc_q35.o obj-$(CONFIG_MICROVM) +=3D microvm.o obj-y +=3D fw_cfg.o -obj-y +=3D x86-iommu.o +obj-$(CONFIG_X86_IOMMU) +=3D x86-iommu.o +obj-$(call lnot,$(CONFIG_X86_IOMMU)) +=3D x86-iommu-stub.o obj-$(CONFIG_VTD) +=3D intel_iommu.o obj-$(CONFIG_AMD_IOMMU) +=3D amd_iommu.o obj-$(CONFIG_XEN) +=3D ../xenpv/ xen/ diff --git a/hw/i386/x86-iommu-stub.c b/hw/i386/x86-iommu-stub.c new file mode 100644 index 0000000..03576cd --- /dev/null +++ b/hw/i386/x86-iommu-stub.c @@ -0,0 +1,34 @@ +/* + * Stubs for X86 IOMMU emulation + * + * Copyright (C) 2019 Red Hat, Inc. + * + * Author: Paolo Bonzini + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#include "qemu/osdep.h" +#include "hw/i386/x86-iommu.h" + +void x86_iommu_iec_register_notifier(X86IOMMUState *iommu, + iec_notify_fn fn, void *data) +{ +} + +X86IOMMUState *x86_iommu_get_default(void) +{ + return NULL; +} + --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673051; cv=none; d=zohomail.com; s=zohoarc; b=Rw6pf/dKoqyknNgeU2Xo6MPyUgNY7niK5uqgUmBYEtQA1vXApIsMnb+qyPQ6meknAApYZilPjQHV0Oklmup388oPq48WNjoH4miuZKs8Wn5bj0ugzMbKO5IXTjGKfvFdmlWtuvVyKsLwP80AGeIuhenxtK8VKnmYcpLnnHRkEtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673051; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=Rce8aJtBhKhrBYptPbKYFXczMkoQTuRBLcam8ly8QxZuR9uO0p6evdplZuG62Xrov1xUjWSWU1xcS4BTW1uy9jenQqwTJbLO44YnrmE6r7ss14Or/XW/l8OF9ErrxxZSM7uAx5kUreUVxdZ1s8yApUC0Fk/Zgg/kvnd0G6DWKvc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673051379599.9127011130794; Wed, 18 Dec 2019 04:44:11 -0800 (PST) Received: from localhost ([::1]:53656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYgT-0004wk-OO for importer@patchew.org; Wed, 18 Dec 2019 07:44:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53345) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3c-0006y8-9v for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3a-0002Lc-VJ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:00 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:43642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3a-0002HG-JR for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:58 -0500 Received: by mail-wr1-x42e.google.com with SMTP id d16so1985298wre.10 for ; Wed, 18 Dec 2019 04:03:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:56 -0800 (PST) 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=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=DXgcoH4l/3iV6ULg2ZN9xXRCxKgJI5KNZKomQXqwcZ5abiD9twAZm8gQtET2AioCg6 e72bXRE9yUvoQpPZ90McmauI7bMiZiKtHtVoZiB6WPRQfOcPJ5fDC/yllzE/scPUwoQk 4IKKE58NAM1PKHH9Ah+j6ARdPy8tEm8VLQQm87ePMkqpw9CKQgKdZ1V6655L4vsO90A9 qNjNV166ZE1AbuXS+i2azlJe7Yx+olB8PsO0hSb5EF8L1mX9GVl0LfML9ZgEpjpzYSHd DzjXB/88nQoouM/5G6PgHvzsykfPp0zGIIYxceAfT8zE+Re7wu8ieaoN/5YUwslBKmLB pxlA== 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=WOlXgr5dZa9g4c2a4JN2toyyzN/vi7Wxgjlick+Xxu0=; b=P2GBCDEc2RrKEX+b46l0L0CGkuV4vHc/z2Z7IxVIyzifH44jVC+fgYSZcplGyS18xg IV6CiUi0fC5LKnOXOK2N6DDywsLq59vxnRmLntwhmgcflXVh6bhSbC2/QnAv5Be8rplt PgbEUHJo1Ix9u4PQ85o+tihHLsqZiDsSAAuHqI8rgIKCwif9L2JDaUAUgnwazyt53Jxz wzIF7G9AYZ65TYxAE/83PFpafOAfFQ4/fJw6Wd2vVVDk4ojukkdebVfaivHIsRfJkyc+ hI+Z4b2SPN2lpjCbVchFBtiJjVPaNu/z/2GKXsrglSoqKmdBwHI7XTkYyyaEWlTauTyZ BdPA== X-Gm-Message-State: APjAAAVUhB6k3bkQQ07ZzNcdhqx+Q+W2OEeiUPil0EJRUDMVoAS1QD1Z Eogwh18VW9Dzk2kkX8gpEWmqo63O X-Google-Smtp-Source: APXvYqzUknMQshY2w4SQ6DOB8HB53WnZnAnVge94gTia/SrQJhy7k9U1hwonEKAftJDTZzt0ITE2zQ== X-Received: by 2002:a5d:5403:: with SMTP id g3mr2492287wrv.302.1576670637404; Wed, 18 Dec 2019 04:03:57 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 53/87] hw/i386: De-duplicate gsi_handler() to remove kvm_pc_gsi_handler() Date: Wed, 18 Dec 2019 13:02:19 +0100 Message-Id: <1576670573-48048-54-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::42e X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Both gsi_handler() and kvm_pc_gsi_handler() have the same content, except one comment. Move the comment, and de-duplicate the code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/kvm/ioapic.c | 12 ------------ hw/i386/pc.c | 4 +--- hw/i386/x86.c | 1 + include/sysemu/kvm.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c index 8703f19..973e2b2 100644 --- a/hw/i386/kvm/ioapic.c +++ b/hw/i386/kvm/ioapic.c @@ -48,18 +48,6 @@ void kvm_pc_setup_irq_routing(bool pci_enabled) } } =20 -void kvm_pc_gsi_handler(void *opaque, int n, int level) -{ - GSIState *s =3D opaque; - - if (n < ISA_NUM_IRQS) { - /* Kernel will forward to both PIC and IOAPIC */ - qemu_set_irq(s->i8259_irq[n], level); - } else { - qemu_set_irq(s->ioapic_irq[n], level); - } -} - typedef struct KVMIOAPICState KVMIOAPICState; =20 struct KVMIOAPICState { diff --git a/hw/i386/pc.c b/hw/i386/pc.c index dff09e4..ea7320b 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -344,10 +344,8 @@ GSIState *pc_gsi_create(qemu_irq **irqs, bool pci_enab= led) s =3D g_new0(GSIState, 1); if (kvm_ioapic_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); - *irqs =3D qemu_allocate_irqs(kvm_pc_gsi_handler, s, GSI_NUM_PINS); - } else { - *irqs =3D qemu_allocate_irqs(gsi_handler, s, GSI_NUM_PINS); } + *irqs =3D qemu_allocate_irqs(gsi_handler, s, GSI_NUM_PINS); =20 return s; } diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 80e33be..d18a3ef 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -295,6 +295,7 @@ void gsi_handler(void *opaque, int n, int level) =20 trace_x86_gsi_interrupt(n, level); if (n < ISA_NUM_IRQS) { + /* Under KVM, Kernel will forward to both PIC and IOAPIC */ qemu_set_irq(s->i8259_irq[n], level); } qemu_set_irq(s->ioapic_irq[n], level); diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index aaf2a50..141342d 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -515,7 +515,6 @@ int kvm_irqchip_add_irqfd_notifier(KVMState *s, EventNo= tifier *n, int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, qemu_irq irq); void kvm_irqchip_set_qemuirq_gsi(KVMState *s, qemu_irq irq, int gsi); -void kvm_pc_gsi_handler(void *opaque, int n, int level); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672265; cv=none; d=zohomail.com; s=zohoarc; b=maflKEQe6s3bTLu+0Dxrs1t+pEC/BY8yO4Uy6hsWAx4s5GR3R7qLDfiNPIA/UQC+I+dIBB9dU+x4hpwNEnEFULHYaKDSPVM1mMBJw4oPj7OCWMZKdFHzOQD65zLIbeG81BEEgBMjyYF1/vGR0M/83atFHcBIMtEhQ4e66x5Sgv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672265; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3xRW0dWjMhO1EPoHD9jweteGOAO0mpniEjjgSK1VhoQ=; b=M/zYa7Lc6e7FL1ZTWF5f2CzZHXNLt/ohq2vkMRZBxBxJQmCGvFHKJ/vh5aiYZURHVpeLP82Lnr/9JOG/7yORMwYkm/rx7vjkTsAF1ro6KG93hF4W1VrDw601IA5i+il23dshdLHEP8zolHmW1j68eLCVJyzaGOLxWCSyeWO/em0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672265901334.50082462972; Wed, 18 Dec 2019 04:31:05 -0800 (PST) Received: from localhost ([::1]:53490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYTo-0001fM-6s for importer@patchew.org; Wed, 18 Dec 2019 07:31:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53440) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3c-0006z8-Sj for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3b-0002OI-MH for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:00 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:44164) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3b-0002Kb-Ba for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:03:59 -0500 Received: by mail-wr1-x441.google.com with SMTP id q10so1985680wrm.11 for ; Wed, 18 Dec 2019 04:03:59 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:57 -0800 (PST) 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=3xRW0dWjMhO1EPoHD9jweteGOAO0mpniEjjgSK1VhoQ=; b=sFTJiknWNhiykVK/xkhmcw8lZI9VIXn95ayasZ9wFxUJuU0LhINvDhuxe0EtqFp6CQ Ov1b+eAj4AgUcWf5LDOeBm2WJkXX9AG1f1O7U6IozW3poC+lk1CuYZu2WaOzbodo+HZg FKpyKBluJd9fgWAbgueTndi4TcoeIyDZDM83d/UL6C+J+GZqcRatRiykhuTfVbRc/CEk B75dum2GbrlYS0mB9WMes4aI+xN2sILSgiBJ5merz7fVdZ3T5tGLbNAWKb9T4iTbm6Of bP1VcPlUzm6mtxqzc1LIhxFZnCMS09xv0RW+mXGfPfzCMdsm3AyqU2pVUHnZxNgDgb/T Xclw== 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=3xRW0dWjMhO1EPoHD9jweteGOAO0mpniEjjgSK1VhoQ=; b=AEscerwK97i3QaKdFMeC7ltJmBowP/Kl/b1bMcchcFBgTgHAb/DJ0MvA3gczXcERYo wJ3XNgPkscgQB9JFGswKxQpRbwLnn1BERmrWy6xSB46yTKO/leD7USWoUS7JYH6dorUV 7ejAJ36EXC7tcd4FBibHLVFqb5DGJ+OpKNu6WAG92GNQEUg88hnRerpcoWnp6gtdhEAU boBLqR3SB5V1fK+9xjDHhsTLtLWVAQh/WYPhJqIhVwYKdN05zjeASviOgo2h0Xlg6XYJ 2sLEyb3kNmtWkzVzeVIhD2CaUIW9bV+cErLACyphwqtlmT4r1uTdF0ciRlrVVAt0EL+I dx6Q== X-Gm-Message-State: APjAAAWQ65p1wgSLonKx5sC9alBV1X5RzkW8rKD8/g65logyt92YHyJa jMa8F7EFbuBFoISu9pPyu5q8fv7a X-Google-Smtp-Source: APXvYqwQ2tpoJX5QYmArLnVaHhW47aKaLqZdz5fQVaSh5OLJN2hIbwraUJQDqERCaCqhDT8elja8CQ== X-Received: by 2002:adf:f508:: with SMTP id q8mr2447900wro.334.1576670638175; Wed, 18 Dec 2019 04:03:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 54/87] hw/i386: Simplify ioapic_init_gsi() Date: Wed, 18 Dec 2019 13:02:20 +0100 Message-Id: <1576670573-48048-55-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 All callers of ioapic_init_gsi() provide a parent. We want new uses to follow the same good practice and provide the parent name, so do not make this optional: assert the parent name is provided, and simplify the code. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/x86.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index d18a3ef..d8bb5c2 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -307,15 +307,14 @@ void ioapic_init_gsi(GSIState *gsi_state, const char = *parent_name) SysBusDevice *d; unsigned int i; =20 + assert(parent_name); if (kvm_ioapic_in_kernel()) { dev =3D qdev_create(NULL, TYPE_KVM_IOAPIC); } else { dev =3D qdev_create(NULL, TYPE_IOAPIC); } - if (parent_name) { - object_property_add_child(object_resolve_path(parent_name, NULL), - "ioapic", OBJECT(dev), NULL); - } + object_property_add_child(object_resolve_path(parent_name, NULL), + "ioapic", OBJECT(dev), NULL); qdev_init_nofail(dev); d =3D SYS_BUS_DEVICE(dev); sysbus_mmio_map(d, 0, IO_APIC_DEFAULT_ADDRESS); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673285; cv=none; d=zohomail.com; s=zohoarc; b=TmQ0NaLwynM1a9GLq7t1k10ta78HEDFCvNMpTl40sBKb4TKsfwzCYq8zYDtFAJdYSZDQmcJkH0ixfUETypX+eThHYwMWTmN2rlBr1Vgacw6UhkMYVE2e1g6KOZhHtbWMHsP3H0s+aiVTv8ksPm2CXdNd4b0iIj9KtUO4aoEigqw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673285; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uHPnz/CuhNDw7Q8yQgUAYEh1mPj3Ixi1rl2oxYokSDY=; b=F92TlxHkqZu2iZmS4eLMjNUIYx2/TfT08cYuOh2Nb//KqT99OLH/8kwuh+WgbqOuDrvTwmB/cb08RNjglftW5b886mzVRsAFZ8rBrwws8ydDfWnCmkUtuwTJWm8WopF7WFI5M8GwPhBiYKJkCNFFdCu0euzIQqHTAy4k1v56c8w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673285770250.82155140460816; Wed, 18 Dec 2019 04:48:05 -0800 (PST) Received: from localhost ([::1]:53704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYkF-0000T9-RU for importer@patchew.org; Wed, 18 Dec 2019 07:48:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53668) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3e-00071u-Ey for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3d-0002VA-5A for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:02 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:53450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3c-0002RN-RP for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:00 -0500 Received: by mail-wm1-x335.google.com with SMTP id m24so1554173wmc.3 for ; Wed, 18 Dec 2019 04:04:00 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:58 -0800 (PST) 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=uHPnz/CuhNDw7Q8yQgUAYEh1mPj3Ixi1rl2oxYokSDY=; b=hkOVweFoN9gpvN537B2OCzUpld8kUSUm5LFQtqVmKZvp88Mf45kf1fHiorV3ww4Kot cmyUHJQIvRqKl6WjPckEjWTvze95HRyldCW+OGsYnox2SLEBJmtQkAWNjxFhko095xxm ucQuFlCbQB31ziVETFpNi/pYpZ2WmsUzY4mdKj7fGIBhSmPOp5jWOwItkP0y6idNNPKX NCNDYwFFhjOHi5ywlWdJKwCXpfiC/96Hx6gGy2Cb5gaSqsAi9qd87rfM2JK/N1oux4/s WUhaQH1a2YWDNK6iG2JXhv7R0Bmqn54LkALHS1kw7AG5rjZDIP2BfKgos1xIU7SxVFJf es7w== 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=uHPnz/CuhNDw7Q8yQgUAYEh1mPj3Ixi1rl2oxYokSDY=; b=B8g3XuEQH8RHTta4iJroCoMi0iKokmDWHBFNbZZSFSDZfp0SphrcuVn7E+b0TXaaEh p25hj7ZV+CxXzOInIwMCg/b6LrzAWXvie+N6reAwjcYDLIlB97P+ioAiT7inV9sQnvKS 8F282Ji2JJjZHQba94E1BRVva0hMKvU3O6Tp76yo1y+hD085538wOq7a/PvGgQp6tTrE v9tnpQEgcggQKFSDdJ4m/IMC840bS+68pmAyjPNEV/RvSYKz2jOpC+meduNF3JBw5n7+ VYfPxjCvrMz4j1Wt4S4ZyOYvpsq6SFvwraRAYaE9mIEn7eQICJ8oSsT0KpiYr4bCcoqo 7+Bw== X-Gm-Message-State: APjAAAUVVLZ89Z0Iv5XXZEjawmNHsf2h+RrPvWBaiXk3Io4MbAuip2KR tP218yE1voGa4xC0kdNwCy0mdVnD X-Google-Smtp-Source: APXvYqyGG9+wogbJwc0Juvg9Z0UHi7JNdevRmz1Ds+t5VLs58Lm7D9I6mkG948uvv/X14IGhnVdNNA== X-Received: by 2002:a7b:cc97:: with SMTP id p23mr2994613wma.89.1576670639267; Wed, 18 Dec 2019 04:03:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 55/87] hw/isa/isa-bus: cleanup irq functions Date: Wed, 18 Dec 2019 13:02:21 +0100 Message-Id: <1576670573-48048-56-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::335 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The irq number is unsigned; we reject negative values. But -1 is used for the isairq array, which is declared unsigned! And since we have a definition for the number of ISA IRQs, use it. Based on a patch by Philippe Mathieu-Daud=C3=A9. Signed-off-by: Paolo Bonzini --- hw/isa/isa-bus.c | 11 +++++++---- include/hw/isa/isa.h | 8 ++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/hw/isa/isa-bus.c b/hw/isa/isa-bus.c index 3888006..798dd91 100644 --- a/hw/isa/isa-bus.c +++ b/hw/isa/isa-bus.c @@ -82,24 +82,27 @@ void isa_bus_irqs(ISABus *bus, qemu_irq *irqs) * This function is only for special cases such as the 'ferr', and * temporary use for normal devices until they are converted to qdev. */ -qemu_irq isa_get_irq(ISADevice *dev, int isairq) +qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq) { assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) =3D=3D isabus= ); - if (isairq < 0 || isairq > 15) { + if (isairq >=3D ISA_NUM_IRQS) { hw_error("isa irq %d invalid", isairq); } return isabus->irqs[isairq]; } =20 -void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) +void isa_init_irq(ISADevice *dev, qemu_irq *p, unsigned isairq) { assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); + if (isairq >=3D ISA_NUM_IRQS) { + hw_error("isa irq %d invalid", isairq); + } dev->isairq[dev->nirqs] =3D isairq; *p =3D isa_get_irq(dev, isairq); dev->nirqs++; } =20 -void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, int isairq) +void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq) { qemu_irq irq; isa_init_irq(isadev, &irq, isairq); diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h index 79f703f..e9ac1f1 100644 --- a/include/hw/isa/isa.h +++ b/include/hw/isa/isa.h @@ -88,7 +88,7 @@ struct ISADevice { DeviceState parent_obj; /*< public >*/ =20 - uint32_t isairq[2]; + int8_t isairq[2]; /* -1 =3D unassigned */ int nirqs; int ioport_id; }; @@ -96,9 +96,9 @@ struct ISADevice { ISABus *isa_bus_new(DeviceState *dev, MemoryRegion *address_space, MemoryRegion *address_space_io, Error **errp); void isa_bus_irqs(ISABus *bus, qemu_irq *irqs); -qemu_irq isa_get_irq(ISADevice *dev, int isairq); -void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq); -void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, int isairq); +qemu_irq isa_get_irq(ISADevice *dev, unsigned isairq); +void isa_init_irq(ISADevice *dev, qemu_irq *p, unsigned isairq); +void isa_connect_gpio_out(ISADevice *isadev, int gpioirq, unsigned isairq); void isa_bus_dma(ISABus *bus, IsaDma *dma8, IsaDma *dma16); IsaDma *isa_get_dma(ISABus *bus, int nchan); MemoryRegion *isa_address_space(ISADevice *dev); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673056; cv=none; d=zohomail.com; s=zohoarc; b=FxxjPRUXmdZ03DaVbOw+8yPH65RUwXVUxBqSMYjtgIYEq9wQ7OsXsQeosNPwBdV8r9pF9cZas6TMLOXyvf7QtxIXWqVZZMMTcG5kO66MtN1ncnbHdA7hDxWiZ2QPWJ67jb6G/LoKEg0MdvqwaL8MR5tBp+ycCCNDsgARHEawwB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673056; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RhBoR/tLrwpSdP9TuRs6Sxp42lksgrEoIqiHxg6Q7mo=; b=RKM3jxJW0BvaROUf7t0apxn1R+aaxG8yVLa4S4BOgPlVrDUbJPouPjw9ppGI7dkTC7r51ZGejoXih3G9ULZdPrm5Pv47CTVxdW35q4gDeeNptilALjLD6ASX3FjJm45tBcfmMcPmsAGe4VsfT7DdrMSB+pRwbRRySSWgx7PHhsY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673056637772.6619011493997; Wed, 18 Dec 2019 04:44:16 -0800 (PST) Received: from localhost ([::1]:53658 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYgZ-000554-1Z for importer@patchew.org; Wed, 18 Dec 2019 07:44:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53818) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3f-00072h-2S for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3e-0002WA-2M for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:02 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:42121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3d-0002ST-5G for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:01 -0500 Received: by mail-wr1-x442.google.com with SMTP id q6so1981486wro.9 for ; Wed, 18 Dec 2019 04:04:01 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:03:59 -0800 (PST) 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=RhBoR/tLrwpSdP9TuRs6Sxp42lksgrEoIqiHxg6Q7mo=; b=QzapCugbnZ8RmTONGSO8ow5T/IxVty+EpyHLZj1QfrWXEZ7o2Uqz8e0yOGdJEQYhKl 5FJGd8q6xbaH1gQNyWVbL2EwOEoqtvGeLIH9oVqbnT9EAjXUZAW34mJsKi8ebzRxxYdt 3CYRu4LKeO1QotnWlM3w91fYZ11SMwBbdfcYXZzRtvpryznd9EXVtPFUTqv8uxy93rCE 2/T7I6bRJRZBf+ZIPocyamRk6PI5Y+r+GVA8KEJlHYSjEbaPgkB6nr6058sVcSlklcir eeKNCQQk2WDE1IOfrB7rxifA0jLtvCf0CL2KX9/fTCG0jkcj+tGYXlAwRPwxdjN6wrN2 f86A== 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=RhBoR/tLrwpSdP9TuRs6Sxp42lksgrEoIqiHxg6Q7mo=; b=RVq9/Uuk5Z1TVOxLq4bR66ueXgl7603bACGnpzYUg7n1OFZTPteMtFK+tLmFCoQLsm LWSNQGrI85P+nZQsyqoGHLiAbh/vGto+mbwxlJmDZnOAC23u3+AvqM3WyEiFPRFOoNFo jGWcW92tKHG3nWB0orMmk5owEGikNHOia2LKFpFwUNpbNkPzXASoaOX+qHrElTarrw0A hzGpN0igXcLUW7aoAtcneKeJazDrPNWI3baxVJHX9n8bZPd458kjBIUkNbhEd3LnWtut hhLwLprXcR/faKqL39WDM9fHYhrIAnvvcpCVuVbl0S3jQjKFMM3AXIjxJlyKB0E1uVXm 5hgA== X-Gm-Message-State: APjAAAU7vCqBSiE13+Jv6/69q8a0v0lY+jcNO+3jiq8bnRu0tl+q7XVS t/FaPbJ/O3y8yrZGcwrHlywQwYpU X-Google-Smtp-Source: APXvYqxZmMlcnGWQHdUKFl8p/uoimCk0WeRdjCKxmPWqCd4pU326UY22JXJxU2Pq+kJJG+27cIxqQA== X-Received: by 2002:adf:f605:: with SMTP id t5mr2408374wrp.282.1576670639901; Wed, 18 Dec 2019 04:03:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 56/87] hw/i386/pc: Use TYPE_PORT92 instead of hardcoded string Date: Wed, 18 Dec 2019 13:02:22 +0100 Message-Id: <1576670573-48048-57-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 By using the TYPE_* definitions for devices, we can: - quickly find where devices are used with 'git-grep' - easily rename a device (one-line change). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ea7320b..67fddcc 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1278,7 +1278,7 @@ static void pc_superio_init(ISABus *isa_bus, bool cre= ate_fdctrl, bool no_vmport) qdev_prop_set_ptr(dev, "ps2_mouse", i8042); qdev_init_nofail(dev); } - port92 =3D isa_create_simple(isa_bus, "port92"); + port92 =3D isa_create_simple(isa_bus, TYPE_PORT92); =20 a20_line =3D qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); i8042_setup_a20_line(i8042, a20_line[0]); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672897; cv=none; d=zohomail.com; s=zohoarc; b=HImyjauWYaDULps4K5U52HPerp+1lHbByt//d92vUVAkpzl8MrBWJ7LNvnJZlUgArJmovwHYAbQBOffzVkcbYylz+uFtA985xZUS/23kl5vrOHPigp4T4+0UUt9HmqoUhz2phnymwOdLqzefS+zNtoGY/JCoJVYnb25jjX9KAMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672897; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=uKWbw2FnihoJIGt9f/+APcjo5dktAD56+VxJMIHASKI=; b=IQlGFtwGc1JWDajWFWWAkaFqm7OR2yOaD6ZU1/kZBuiWojkwUi0Dm8rdCT+OzIoWDlg86Pe0ZRe4DY8vdwRTdqwOdayCe9ox/Az+SJiUypY5yEbP31kCJkWqedB9cPLKb+JRlUrNmO3KrTPHHlHf3+vZtsyGjg9oNoL+t8/TROA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672897962326.8652648083902; Wed, 18 Dec 2019 04:41:37 -0800 (PST) Received: from localhost ([::1]:53634 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYe0-00013x-Id for importer@patchew.org; Wed, 18 Dec 2019 07:41:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53906) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3f-00073f-MH for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3e-0002Ww-8j for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:03 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:33895) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3d-0002Vf-Un for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:02 -0500 Received: by mail-wr1-x434.google.com with SMTP id t2so2030973wrr.1 for ; Wed, 18 Dec 2019 04:04:01 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.03.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:00 -0800 (PST) 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=uKWbw2FnihoJIGt9f/+APcjo5dktAD56+VxJMIHASKI=; b=L7CL1f+RwifD7VM9rNQavIU+2YSt1KDNNBSMahvUg/w0442Sjkse93vcBDTeBoL6K6 KrIn9cRpaq5dGOtMMvsgUpiB5DdxtqFQDHfwRj9Dgz0bRdQ8jdlxbFbXikgKzxHI3ySg 1mGgZVLLcahK702AVVH6QSIcWlT7bMVORs5+ej1dBa33F7/n0EqBfobkPIS4f9SGeHwf 76IH/yQKCWXDboLIqmGCgjivMEHkt9U+sidWpY7JdzJcHdFP+Tm+UxX7YvVtY2EcgS9P diwnfdzOeu3dgM2MbAZGD/QXea0fknV4aS5cXN4EH1x8kxOmiNPbjP5qAeNtn8UnSTeR U9cw== 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=uKWbw2FnihoJIGt9f/+APcjo5dktAD56+VxJMIHASKI=; b=kbFx92D1dy9AnPzZxJTclqUAH8+YY8RHmkd9fdCh18z4LvjAquG+l+u4o1p+LFHi1I RLrXWS9ddeVyEf+6qCe3NQX6SRUO/v8GKoqnRN2PdV97HIT2vCh4q2W3FOoDLEirglAf TmLjn0ZGrAcVlMcjDmW075UdWBrWY830r6jZCq8sRX8onkP0zMi0GvLe+BJljDS+gdNk p+EisyJ34SBeUbEgy7kpwcWuVX2Y6lu+0IxLK2Is64JWGPFqUl60P/oTaN0+HmzFGWY9 7mgERQ7s5UlsMhA//Mzoiyjekcjkz4/MISMFzM7GlbVzhNrQT2sW3YBdqwisqJEaLKNO XayA== X-Gm-Message-State: APjAAAWz1JZ5X8V5NXqzh5ZoBQFIl0HgmhsjkplOpL1jAFM4VHKmqMRp xHz42R2m4I9tfi5wQcOrJ720ymot X-Google-Smtp-Source: APXvYqwfXpIiaMA2H+cxRwaRvO3UA+MwL8OxczZ1xq/a9TWj7FgPVxG7wXYFhD6QK+FhM3sBuCKF8Q== X-Received: by 2002:adf:e5cb:: with SMTP id a11mr2411040wrn.28.1576670640735; Wed, 18 Dec 2019 04:04:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 57/87] hw/i386/pc: Inline port92_init() Date: Wed, 18 Dec 2019 13:02:23 +0100 Message-Id: <1576670573-48048-58-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::434 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 This one-line function is not very helpful, so remove it by inlining the call to qdev_connect_gpio_out_named(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/pc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 67fddcc..e36053f 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -710,11 +710,6 @@ static uint64_t port92_read(void *opaque, hwaddr addr, return ret; } =20 -static void port92_init(ISADevice *dev, qemu_irq a20_out) -{ - qdev_connect_gpio_out_named(DEVICE(dev), PORT92_A20_LINE, 0, a20_out); -} - static const VMStateDescription vmstate_port92_isa =3D { .name =3D "port92", .version_id =3D 1, @@ -770,8 +765,8 @@ static void port92_class_initfn(ObjectClass *klass, voi= d *data) dc->vmsd =3D &vmstate_port92_isa; /* * Reason: unlike ordinary ISA devices, this one needs additional - * wiring: its A20 output line needs to be wired up by - * port92_init(). + * wiring: its A20 output line needs to be wired up with + * qdev_connect_gpio_out_named(). */ dc->user_creatable =3D false; } @@ -1282,7 +1277,8 @@ static void pc_superio_init(ISABus *isa_bus, bool cre= ate_fdctrl, bool no_vmport) =20 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]); + qdev_connect_gpio_out_named(DEVICE(port92), + PORT92_A20_LINE, 0, a20_line[1]); g_free(a20_line); } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672438; cv=none; d=zohomail.com; s=zohoarc; b=U5StymMVlL8Hy21Nhq3lSboKI6eY9P8hwLz4PhzSOtGS8KwkaVB9fODhjFBS84/aKTSdZkdCgr99m0oxWXvFXUCqfiOIdI2a2vZxPt+hUUIvRtYPqxpwaZnoRFLtpvO9OXbs5fOMwi5o1oeVVm4xwwoc1A4cJJv+qP+OrmX6+Po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672438; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rDif3jIy3NQWrPrWp+OG7Re6McoAeV4H/8rGZ5nE6Ss=; b=iCp4ePM5fwz2MNBiIraOsHIkVnYX7S+O87w/q7Fkz+0iWydmm3JpziZndnl7WzR6vYMAOESTFPWNoNws8WoIs0loobddEs6foPFzoA5WiZvrL8byOXbpxshFLY7IzzYosG8q/7f37GKnkbdND4k1jot5LGnC5Fv/PyiiPy8jGls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672438835877.3413501127798; Wed, 18 Dec 2019 04:33:58 -0800 (PST) Received: from localhost ([::1]:53532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYWb-0005cl-4j for importer@patchew.org; Wed, 18 Dec 2019 07:33:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54294) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3h-00076L-8K for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3f-0002dK-Ex for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:05 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:39898) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3f-0002XT-5M for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:03 -0500 Received: by mail-wm1-x344.google.com with SMTP id 20so1484074wmj.4 for ; Wed, 18 Dec 2019 04:04:03 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:01 -0800 (PST) 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=rDif3jIy3NQWrPrWp+OG7Re6McoAeV4H/8rGZ5nE6Ss=; b=OBzDOfj9RfWITy9p4YQA6RTKYI6Fxw9CapJ2CCN5wsUyLKZcCVUxf12hjExF6q9E93 2UtLbVruCIUs+AD03oog+vxuvuXUv0Xz/HlEy2QVS+zdFJyceaoh5A+ZRid4rM1+2Wea ZGp7BAMtLV/ibYnuWFcztwUB4gJB2FgAav27jEZYfa0tcb4SuCbW29ySIhF5Adh58xd5 nYPFVXqrNyBWrtjbZlkLX1wP5u8p2cnhi1aIuQ9ZzTaz7oUd7SdSNOLKQJpeQMVEvKUn ASPiGSqAIxlCg1hl1XGg8kDSfVkpJjkj2AVryduF1DQdEuw9vn4WkZDWT1LSIYcBSy0X aDLQ== 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=rDif3jIy3NQWrPrWp+OG7Re6McoAeV4H/8rGZ5nE6Ss=; b=tMPZpAAOMoPd9UPG7hfbFmowwuytMGXSPZNHy2E+6JAkSTdGJauGJw86LRx4msu6Dv 26T15Xmx7pqf8WSpZXk8DfizJt+mZuW0sp5tVd5NyWjTPDtcm3mbhts717rdQjoaYHE9 wYqbT5/haB8uw2GMS+diuwqWvac8MehOmy1kG+lnxSaoMk1t6rWyZy6w4xT6ByphNymI 1StXH7Y/R58+0WmljxGDruwmcQLgMlrIyj8Y4TMIT0GfRz/yQwdZxVunkzE/ONdzKJsg ltt6msfv3R4akdf1iPxEqfR+YAt5fZvsHWL1ot0yfdEChXJHVlTE9ZVqGqcdQARj79jj 3pMA== X-Gm-Message-State: APjAAAVPcIoqCniWTGzVy+DPOX7735RCS6qOd3FP9OskRHncyQFhMq9e 4GIh71rM5+v//e5oJbMcWcc+T+Rb X-Google-Smtp-Source: APXvYqw0UiYshy3Tu1qaEpr79/rkDbueK2ncAWYeC+eE1BiRIJ55nPdWWAw6bITv8tfJB1Y5a+ZUDQ== X-Received: by 2002:a1c:9e4c:: with SMTP id h73mr2799982wme.177.1576670641580; Wed, 18 Dec 2019 04:04:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 58/87] hw/i386/pc: Extract the port92 device Date: Wed, 18 Dec 2019 13:02:24 +0100 Message-Id: <1576670573-48048-59-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 This device is only used by the PC machines. The pc.c file is already big enough, with 2255 lines. By removing 113 lines of it, we reduced it by 5%. It is now a bit easier to navigate the file. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/Makefile.objs | 1 + hw/i386/pc.c | 113 -------------------------------------------- hw/i386/port92.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/i386/trace-events | 2 +- include/hw/i386/pc.h | 3 ++ 5 files changed, 131 insertions(+), 114 deletions(-) create mode 100644 hw/i386/port92.c diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index 1236c3b..8ce1b26 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -13,6 +13,7 @@ obj-$(CONFIG_AMD_IOMMU) +=3D amd_iommu.o obj-$(CONFIG_XEN) +=3D ../xenpv/ xen/ obj-$(CONFIG_VMPORT) +=3D vmport.o obj-$(CONFIG_VMMOUSE) +=3D vmmouse.o +obj-$(CONFIG_PC) +=3D port92.o =20 obj-y +=3D kvmvapic.o obj-$(CONFIG_PC) +=3D acpi-build.o diff --git a/hw/i386/pc.c b/hw/i386/pc.c index e36053f..42014b0 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -673,119 +673,6 @@ void pc_cmos_init(PCMachineState *pcms, qemu_register_reset(pc_cmos_init_late, &arg); } =20 -#define TYPE_PORT92 "port92" -#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) - -/* port 92 stuff: could be split off */ -typedef struct Port92State { - ISADevice parent_obj; - - MemoryRegion io; - uint8_t outport; - qemu_irq a20_out; -} Port92State; - -static void port92_write(void *opaque, hwaddr addr, uint64_t val, - unsigned size) -{ - Port92State *s =3D opaque; - int oldval =3D s->outport; - - trace_port92_write(val); - s->outport =3D val; - qemu_set_irq(s->a20_out, (val >> 1) & 1); - if ((val & 1) && !(oldval & 1)) { - qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); - } -} - -static uint64_t port92_read(void *opaque, hwaddr addr, - unsigned size) -{ - Port92State *s =3D opaque; - uint32_t ret; - - ret =3D s->outport; - trace_port92_read(ret); - return ret; -} - -static const VMStateDescription vmstate_port92_isa =3D { - .name =3D "port92", - .version_id =3D 1, - .minimum_version_id =3D 1, - .fields =3D (VMStateField[]) { - VMSTATE_UINT8(outport, Port92State), - VMSTATE_END_OF_LIST() - } -}; - -static void port92_reset(DeviceState *d) -{ - Port92State *s =3D PORT92(d); - - s->outport &=3D ~1; -} - -static const MemoryRegionOps port92_ops =3D { - .read =3D port92_read, - .write =3D port92_write, - .impl =3D { - .min_access_size =3D 1, - .max_access_size =3D 1, - }, - .endianness =3D DEVICE_LITTLE_ENDIAN, -}; - -static void port92_initfn(Object *obj) -{ - Port92State *s =3D PORT92(obj); - - memory_region_init_io(&s->io, OBJECT(s), &port92_ops, s, "port92", 1); - - s->outport =3D 0; - - qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, PORT92_A20_LINE, 1); -} - -static void port92_realizefn(DeviceState *dev, Error **errp) -{ - ISADevice *isadev =3D ISA_DEVICE(dev); - Port92State *s =3D PORT92(dev); - - isa_register_ioport(isadev, &s->io, 0x92); -} - -static void port92_class_initfn(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - - dc->realize =3D port92_realizefn; - dc->reset =3D port92_reset; - dc->vmsd =3D &vmstate_port92_isa; - /* - * Reason: unlike ordinary ISA devices, this one needs additional - * wiring: its A20 output line needs to be wired up with - * qdev_connect_gpio_out_named(). - */ - dc->user_creatable =3D false; -} - -static const TypeInfo port92_info =3D { - .name =3D TYPE_PORT92, - .parent =3D TYPE_ISA_DEVICE, - .instance_size =3D sizeof(Port92State), - .instance_init =3D port92_initfn, - .class_init =3D port92_class_initfn, -}; - -static void port92_register_types(void) -{ - type_register_static(&port92_info); -} - -type_init(port92_register_types) - static void handle_a20_line_change(void *opaque, int irq, int level) { X86CPU *cpu =3D opaque; diff --git a/hw/i386/port92.c b/hw/i386/port92.c new file mode 100644 index 0000000..19866c4 --- /dev/null +++ b/hw/i386/port92.c @@ -0,0 +1,126 @@ +/* + * QEMU I/O port 0x92 (System Control Port A, to handle Fast Gate A20) + * + * Copyright (c) 2003-2004 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "sysemu/runstate.h" +#include "migration/vmstate.h" +#include "hw/irq.h" +#include "hw/i386/pc.h" +#include "trace.h" + +#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) + +typedef struct Port92State { + ISADevice parent_obj; + + MemoryRegion io; + uint8_t outport; + qemu_irq a20_out; +} Port92State; + +static void port92_write(void *opaque, hwaddr addr, uint64_t val, + unsigned size) +{ + Port92State *s =3D opaque; + int oldval =3D s->outport; + + trace_port92_write(val); + s->outport =3D val; + qemu_set_irq(s->a20_out, (val >> 1) & 1); + if ((val & 1) && !(oldval & 1)) { + qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); + } +} + +static uint64_t port92_read(void *opaque, hwaddr addr, + unsigned size) +{ + Port92State *s =3D opaque; + uint32_t ret; + + ret =3D s->outport; + trace_port92_read(ret); + + return ret; +} + +static const VMStateDescription vmstate_port92_isa =3D { + .name =3D "port92", + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(outport, Port92State), + VMSTATE_END_OF_LIST() + } +}; + +static void port92_reset(DeviceState *d) +{ + Port92State *s =3D PORT92(d); + + s->outport &=3D ~1; +} + +static const MemoryRegionOps port92_ops =3D { + .read =3D port92_read, + .write =3D port92_write, + .impl =3D { + .min_access_size =3D 1, + .max_access_size =3D 1, + }, + .endianness =3D DEVICE_LITTLE_ENDIAN, +}; + +static void port92_initfn(Object *obj) +{ + Port92State *s =3D PORT92(obj); + + memory_region_init_io(&s->io, OBJECT(s), &port92_ops, s, "port92", 1); + + s->outport =3D 0; + + qdev_init_gpio_out_named(DEVICE(obj), &s->a20_out, PORT92_A20_LINE, 1); +} + +static void port92_realizefn(DeviceState *dev, Error **errp) +{ + ISADevice *isadev =3D ISA_DEVICE(dev); + Port92State *s =3D PORT92(dev); + + isa_register_ioport(isadev, &s->io, 0x92); +} + +static void port92_class_initfn(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + + dc->realize =3D port92_realizefn; + dc->reset =3D port92_reset; + dc->vmsd =3D &vmstate_port92_isa; + /* + * Reason: unlike ordinary ISA devices, this one needs additional + * wiring: its A20 output line needs to be wired up with + * qdev_connect_gpio_out_named(). + */ + dc->user_creatable =3D false; +} + +static const TypeInfo port92_info =3D { + .name =3D TYPE_PORT92, + .parent =3D TYPE_ISA_DEVICE, + .instance_size =3D sizeof(Port92State), + .instance_init =3D port92_initfn, + .class_init =3D port92_class_initfn, +}; + +static void port92_register_types(void) +{ + type_register_static(&port92_info); +} + +type_init(port92_register_types) diff --git a/hw/i386/trace-events b/hw/i386/trace-events index a9b6437..e48bef2 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -116,6 +116,6 @@ vmport_command(unsigned char command) "command: 0x%02x" x86_gsi_interrupt(int irqn, int level) "GSI interrupt #%d level:%d" x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d level:%d" =20 -# pc.c +# port92.c port92_read(uint8_t val) "port92: read 0x%02x" port92_write(uint8_t val) "port92: write 0x%02x" diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 58aaa23..d5ac76d 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -196,8 +196,11 @@ void pc_i8259_create(ISABus *isa_bus, qemu_irq *i8259_= irqs); ISADevice *pc_find_fdc0(void); int cmos_get_fd_drive_type(FloppyDriveType fd0); =20 +/* port92.c */ #define PORT92_A20_LINE "a20" =20 +#define TYPE_PORT92 "port92" + /* pc_sysfw.c */ void pc_system_flash_create(PCMachineState *pcms); void pc_system_firmware_init(PCMachineState *pcms, MemoryRegion *rom_memor= y); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673455; cv=none; d=zohomail.com; s=zohoarc; b=aq+iPPw8Nw8bJ+UV7IC5dld4Iv3+aLazf8k/CiQjog0QLMDCM9iC8YFHsyVrM6Kp/NGXe0KcQYW+mDXBau0Fi+w/mJVa+CMLKltfFGllETfrfioVB1LV/gGMk9BjowQ8rEWetuLO3YdhTR55lZPNAaHm5AyRpkunPKQeOiQCr6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673455; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PMUWoCpuqKP+tFU4xIk4lPZAxU6QOkIu0guoobq7qFU=; b=QVzt/zWuJ5+7ednrCICuYCRnOUQTRQIMPB5c09rB756gcNJPd1M2EQ/er0nnhTxYqYg98s92xoccBDgPtcqW4/JI+/gudwLcNSUMQ35AAAGnwf8dH++5VAPPTw4RIgoDYAMOHVmvSTdRRDyLuzqt/ffY7t4x3pvqZVAH/GAZ6xM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673455147965.5883596463929; Wed, 18 Dec 2019 04:50:55 -0800 (PST) Received: from localhost ([::1]:53742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYmz-0004Bc-LH for importer@patchew.org; Wed, 18 Dec 2019 07:50:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54326) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3h-00076e-E8 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3g-0002fp-4e for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:05 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51515) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3f-0002cR-Q1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:04 -0500 Received: by mail-wm1-x344.google.com with SMTP id d73so1564076wmd.1 for ; Wed, 18 Dec 2019 04:04:03 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:01 -0800 (PST) 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=PMUWoCpuqKP+tFU4xIk4lPZAxU6QOkIu0guoobq7qFU=; b=ZkbC5IyIou4nJ01fjN74/JoWx54TLPr4hibIPZ9IlIO6EykiHaQVukqbynsiwioBPU 9xiM1B6LVfUfciOSHraHB1LRK+2Pnit/KymcWhDTEDAHT3WDOXIgv/qKIgvZpvTxxnN4 tnLh58yrdCxFpSTzEpLBWe0RKi9gXq6m89o5svWe6jmd0UYy2pId3J4zplxrSfUsM4j8 lUmINcHq6OmVhn7DIOj3sGvJIGzxj95Cj4ljQsxg7g3270raIEyuosEplJy4D4HBKpfz 0Be8/XGl+oPNYRQr7sUD8lM0grjduYvjNoM5yPOnacI7NIKSG6Ff8smRGW9XIc9XFp1f MUHA== 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=PMUWoCpuqKP+tFU4xIk4lPZAxU6QOkIu0guoobq7qFU=; b=Gb/SzHNs81Vxf8SkMxF1mFBb+eyhSLMvEBUxqj4YON1M7noF9cbm76upJyr+5EleA6 b7IcAy8UzFWFszv85gSIYu9Rb6hcq9TpL9eWPE688RfLe21rh4/oj/YT4HIB64zgatm0 f8LBsOh9duXH9a5kfx6d73ECBaXVHK3MiT2lDbAxlN+PCq7+I2MtQLdYv3bPFN3ql8Qk pK8YmV1Fu9/V142c9iNzxpWXvp6/nHmTN08iep9utIgTB+WnaAq3777IDuXO0iEY/LK4 w12ekr53HnRX24YXmjX7436yUzblonVVSqGTYhMBxe63qExzKZmbjYtl3HHqdSYSoTzt mxYg== X-Gm-Message-State: APjAAAWp+oPv2XZhaKv1j20lK+PHKrwksNZqPeN0E5uA1HiWMEu0UtBp nSlGvbkHJs+YI/3O/7bmIcO8PJjx X-Google-Smtp-Source: APXvYqydfsrLM1JR2rtTjcc0ucVHhvXnxLajZqRezAQz+XkwORV7OdQkWhneuFpqzki6TE7Fk4BTdA== X-Received: by 2002:a1c:dcd5:: with SMTP id t204mr3026723wmg.34.1576670642647; Wed, 18 Dec 2019 04:04:02 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 59/87] hyperv: Use auto rcu_read macros Date: Wed, 18 Dec 2019 13:02:25 +0100 Message-Id: <1576670573-48048-60-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Use RCU_READ_LOCK_GUARD and WITH_RCU_READ_LOCK_GUARD to replace the manual rcu_read_(un)lock calls. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- hw/hyperv/hyperv.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 6ebf31c..da8ce82 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -546,14 +546,14 @@ uint16_t hyperv_hcall_post_message(uint64_t param, bo= ol fast) } =20 ret =3D HV_STATUS_INVALID_CONNECTION_ID; - rcu_read_lock(); - QLIST_FOREACH_RCU(mh, &msg_handlers, link) { - if (mh->conn_id =3D=3D (msg->connection_id & HV_CONNECTION_ID_MASK= )) { - ret =3D mh->handler(msg, mh->data); - break; + WITH_RCU_READ_LOCK_GUARD() { + QLIST_FOREACH_RCU(mh, &msg_handlers, link) { + if (mh->conn_id =3D=3D (msg->connection_id & HV_CONNECTION_ID_= MASK)) { + ret =3D mh->handler(msg, mh->data); + break; + } } } - rcu_read_unlock(); =20 unmap: cpu_physical_memory_unmap(msg, len, 0, 0); @@ -619,7 +619,6 @@ int hyperv_set_event_flag_handler(uint32_t conn_id, Eve= ntNotifier *notifier) =20 uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast) { - uint16_t ret; EventFlagHandler *handler; =20 if (unlikely(!fast)) { @@ -645,15 +644,12 @@ uint16_t hyperv_hcall_signal_event(uint64_t param, bo= ol fast) return HV_STATUS_INVALID_HYPERCALL_INPUT; } =20 - ret =3D HV_STATUS_INVALID_CONNECTION_ID; - rcu_read_lock(); + RCU_READ_LOCK_GUARD(); QLIST_FOREACH_RCU(handler, &event_flag_handlers, link) { if (handler->conn_id =3D=3D param) { event_notifier_set(handler->notifier); - ret =3D 0; - break; + return 0; } } - rcu_read_unlock(); - return ret; + return HV_STATUS_INVALID_CONNECTION_ID; } --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673293; cv=none; d=zohomail.com; s=zohoarc; b=aHDcISAiNYgey02nUWoFz/IZlXdLtS3N64sVwASBba8aHuN59cbt5U6vCwNheGFEIyNuZg6NLDRrNO3Nr+XIeSl8uJ5YGtWk3lTrRg3i2vQojkW9iv1ABYGjXD2Yat0hVA3IfGqAbLO5iwetmVKRVNvDY6l1l925KQBu4Qakv7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673293; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=nb2hZFwKzalXfmKpcbYjmUeCAEo1SDTH5IqQlmfU414=; b=XPvFMHVFY7TvueJO4XlaV8rNjFhUf4Q95o0DCGHOVwRDO4cle6VqVz3SPSC1m56zQCDst2OAYojT2BF04PNYTOlkzCXBYZ9lAb6sHITHet5uWGmYdoLlhCO7+Bu9N8TbXdkVqrOiUp0L8LbkyVqiPAvNoIy99u2eRg/b63R8jac= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673293828464.5501568319852; Wed, 18 Dec 2019 04:48:13 -0800 (PST) Received: from localhost ([::1]:53708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYkN-0000ij-SL for importer@patchew.org; Wed, 18 Dec 2019 07:48:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54539) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3i-00078N-Ce for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3h-0002ka-1I for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:06 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:37876) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3g-0002g5-PA for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:04 -0500 Received: by mail-wr1-x443.google.com with SMTP id w15so2020313wru.4 for ; Wed, 18 Dec 2019 04:04:04 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:02 -0800 (PST) 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=nb2hZFwKzalXfmKpcbYjmUeCAEo1SDTH5IqQlmfU414=; b=fHW1zUV2NBhZZyFNuIowLz4r8UhpwuyCtZXruINma5lD1n7f+nKSTyOfk3bPgoZ5pk bR7GlCt4BT/NWeAjq5HZk9MyAQ99qCwJSxSltvzEbSa7NqWe03WgXlcEA8mC10QdJARz jhWBNH6Rp5LM3Bgeu2tAUCwdadi0d5Oh1gJiakMRHysVA6kNoHTie6an6uJ03ZRjgAgW B9nweCRRNqmM40I4eFMD/tIrouVMsifL7aiy9nnujLyvQVlpp+Zy2+BzXh3PIJNhaPhX z0fhayWkC1ZrAvUCdR9VdlSJ2vHegItofBEXTWL6DRJHGH/nzRkUYFwTLdfAuEGUbZCK nmMQ== 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=nb2hZFwKzalXfmKpcbYjmUeCAEo1SDTH5IqQlmfU414=; b=ApMRytfk7Bg/9h/zX/f7y1kK+ZyC78mOPb09jydzuFdGzo7jDN5+yCI6o4IWaYZCyZ Mssrlk6MO52pI/OAisp7EdxzrK6MBJjicP0eWgF1uaLfKeTFFL56ZkyD/CYvCSLbLQRd PXrskJtTQhrMJVSc9ITclZxhjkQMa/VOf5tqTY1esAcvhn1AMTrzjrlmR1XWBoxszk6z 7S6vr9by3v/XsdtwsIjn+e9qir89VhIkks9jS5ZGrx5XEaZZ9jfq1TQcTn0+z9pGfEbJ ZoGP1m91Y3w9IMx7xDaphRl94mvZWN0jOa3miRZ1HF/XoB52GSGCxxWYK7nI+d6jIj/Z NI2A== X-Gm-Message-State: APjAAAXtTQhLflGHJUPSOM+BWijExybYfkipaSCtpCpBqK1+fvnW4hlS 66Ne5gapR3ARtkwuE1Kc56DNclMZ X-Google-Smtp-Source: APXvYqwJR0ocuhTVEdjWJrsWVGEGaynZQ5wMNX7bUGXbRwVxH7U/givIl86J91O296mNrm031sfRfQ== X-Received: by 2002:a5d:6901:: with SMTP id t1mr2333089wru.94.1576670643458; Wed, 18 Dec 2019 04:04:03 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 60/87] qsp: Use WITH_RCU_READ_LOCK_GUARD Date: Wed, 18 Dec 2019 13:02:26 +0100 Message-Id: <1576670573-48048-61-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" The automatic rcu read lock maintenance works quite nicely in this case where it previously relied on a comment to delimit the lifetime and now has a block. Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- util/qsp.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/util/qsp.c b/util/qsp.c index 6226541..7d5147f 100644 --- a/util/qsp.c +++ b/util/qsp.c @@ -598,7 +598,6 @@ static void qsp_ht_delete(void *p, uint32_t h, void *ht= p) =20 static void qsp_mktree(GTree *tree, bool callsite_coalesce) { - QSPSnapshot *snap; struct qht ht, coalesce_ht; struct qht *htp; =20 @@ -610,20 +609,19 @@ static void qsp_mktree(GTree *tree, bool callsite_coa= lesce) * We must remain in an RCU read-side critical section until we're done * with the snapshot. */ - rcu_read_lock(); - snap =3D atomic_rcu_read(&qsp_snapshot); + WITH_RCU_READ_LOCK_GUARD() { + QSPSnapshot *snap =3D atomic_rcu_read(&qsp_snapshot); =20 - /* Aggregate all results from the global hash table into a local one */ - qht_init(&ht, qsp_entry_no_thread_cmp, QSP_INITIAL_SIZE, - QHT_MODE_AUTO_RESIZE | QHT_MODE_RAW_MUTEXES); - qht_iter(&qsp_ht, qsp_aggregate, &ht); + /* Aggregate all results from the global hash table into a local o= ne */ + qht_init(&ht, qsp_entry_no_thread_cmp, QSP_INITIAL_SIZE, + QHT_MODE_AUTO_RESIZE | QHT_MODE_RAW_MUTEXES); + qht_iter(&qsp_ht, qsp_aggregate, &ht); =20 - /* compute the difference wrt the snapshot, if any */ - if (snap) { - qsp_diff(&snap->ht, &ht); + /* compute the difference wrt the snapshot, if any */ + if (snap) { + qsp_diff(&snap->ht, &ht); + } } - /* done with the snapshot; RCU can reclaim it */ - rcu_read_unlock(); =20 htp =3D &ht; if (callsite_coalesce) { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673337; cv=none; d=zohomail.com; s=zohoarc; b=IsVFDw/X8WhvzVqn1zsHQ8lSB7oOucusKKcEqRhUDRyzNPUvG5q50Lrsz+zw2ueVu++jTGIfDmbHXAu7400xaCKo6BAFr+GHolOSUx7RzuRNPuuDvoZJHSdQwwdWSQA7OPtf4R/ob0idOWlZugc20cQKdJcg5n8DCB20H0K5RMM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673337; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=GLnTbT7DrMhmAKNR/jbBoBJjkKqPWblBYnI5K43pAHM=; b=kgvsoIfAfOyzfy2xK00BNxVBtmKQcqcOpgWP5Kx8PlGkuZQmkb214AsIuVSq7oLsE+n/SCUlg1s6M9UlY42HzBUc8ByRUEqz4I0wQbRbrBd2iZBjbxVqeCrsrpo508C3OtwfYUFqBactrseaecFvlYE0KHt3GJLdO6AUvEuZb5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673337455636.3553939775134; Wed, 18 Dec 2019 04:48:57 -0800 (PST) Received: from localhost ([::1]:53710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYl6-0001VS-7M for importer@patchew.org; Wed, 18 Dec 2019 07:48:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3j-00079c-7d for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3h-0002oV-Vu for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:07 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:39631) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3h-0002kt-Mt for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:05 -0500 Received: by mail-wr1-x42c.google.com with SMTP id y11so2005756wrt.6 for ; Wed, 18 Dec 2019 04:04:05 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:03 -0800 (PST) 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=GLnTbT7DrMhmAKNR/jbBoBJjkKqPWblBYnI5K43pAHM=; b=r7ZtFfuBc4fQtX8TWPtSf4zgOA5mP5flDUcJqaSNAghZlo/y8k5lM39tKFpeDIfp+p f2sUoSYsZmjgMhpNp3irUwh9KKOoY70woM9SRIntHN0/2cJRLq6xFZZdRhiar2SxSFWO x27t1czt7SiwOM3u9xGeuKh8qPDyqzs5Ro2WHO9J0be32VV2Di2cxiY4WLJAcisvlm/Q gPnJz2Nb4MCY+yfTxYkE6ykKz4KjEqNp0ynEiGxnrkUSvreaQamotbIdedEoWhsaQEe2 gy/YaGEYXt19rypu3jlc2D4JEpfYcg22phw6ZTAVLLJOS6qieXe0F9uBo2enf9iplhnv HQWQ== 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=GLnTbT7DrMhmAKNR/jbBoBJjkKqPWblBYnI5K43pAHM=; b=SvGzGo0wxboLfagKwvIplMEK8Hn6fQg3ap411urvaGSNa1Ng1DOpiQZuHHpQeskqo4 GwiSTruqmfHCdk9FQQ6Ugc1UDOmNAK+jBrGRtxMGZKTtMNCiuoToSOAxwVWxjblSz5pB ODNzr357BnhQg4Tfo856iFAGpjyLpcX9glqlUS+t8WrITNrZKpU91VXBBHE5rdHdSHb4 mnlJE06dDISWr3wrnnetppa2hvO4jX0t+ftwAWBdEcTDbT5b7uWPMY6AT/sXKGhWuRSL W0tLAgJkE0QniUVWIo02LStk+AKn0AtxVfFzh/544qWyFFaS7OUnIgjaWpEcd9eZz8H3 fkQw== X-Gm-Message-State: APjAAAXEfD4BvN0Rgv5UfcznH9P5+eku32LyIay18q+hV8noXX7G6KI2 scQu9tEHYM65o3doxnYg/KpDMYBA X-Google-Smtp-Source: APXvYqxXSX6am7bSp8RnSV0ljBrpEsXUyQn8+D+MtEyQuZAcDY1nGL3YGrgrfk0ubT9w4p5EX101FA== X-Received: by 2002:a5d:6a83:: with SMTP id s3mr2349947wru.99.1576670644589; Wed, 18 Dec 2019 04:04:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 61/87] memory: use RCU_READ_LOCK_GUARD Date: Wed, 18 Dec 2019 13:02:27 +0100 Message-Id: <1576670573-48048-62-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 27a84e0..9d3fdb5 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -2171,7 +2171,7 @@ MemTxResult address_space_read(AddressSpace *as, hwad= dr addr, =20 if (__builtin_constant_p(len)) { if (len) { - rcu_read_lock(); + RCU_READ_LOCK_GUARD(); fv =3D address_space_to_flatview(as); l =3D len; mr =3D flatview_translate(fv, addr, &addr1, &l, false, attrs); @@ -2182,7 +2182,6 @@ MemTxResult address_space_read(AddressSpace *as, hwad= dr addr, result =3D flatview_read_continue(fv, addr, attrs, buf, le= n, addr1, l, mr); } - rcu_read_unlock(); } } else { result =3D address_space_read_full(as, addr, attrs, buf, len); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673486; cv=none; d=zohomail.com; s=zohoarc; b=e2D82YXS052/VyGpWs6qA0QKzv/yeQJ6LPHra4Q4WT5t3nUmDM6On3HKJdKjSFn1QSinu7Jw/CR7RbbF69K4xro0aWA8RBOFNvfLoWBh54tr+hjVvE0MXcrIA+9mkaDAyka8qxFYsoNgC9Qyp3fwP96zJkfmOVuiumTguj9oUN0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673486; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YQVEU3O9cxdPzw/GFJ2T/1zXOw28kW3W4l2Fhmj7puw=; b=UyCosK3G8NBciCpYq0OxTmMYZemxWT2ri4N0LHSQSdv9VvfAt9FnVHjZxET85Re0C8C1gaoN9NwhNe+IjQGbN/WcL0X2oiQuGqZ9DIVxx+CyljRzpUFKTLlemFrtdj2mT4RcW1sA9puz/IRcyJUOQnSWOYL37Qb3ChEzGyo5Pb8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673486832570.4963955874721; Wed, 18 Dec 2019 04:51:26 -0800 (PST) Received: from localhost ([::1]:53752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYnU-000547-KG for importer@patchew.org; Wed, 18 Dec 2019 07:51:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54886) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3k-0007AZ-7p for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3i-0002sf-TU for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:08 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:33351) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3i-0002oz-LD for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:06 -0500 Received: by mail-wr1-x442.google.com with SMTP id b6so2032143wrq.0 for ; Wed, 18 Dec 2019 04:04:06 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:04 -0800 (PST) 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=YQVEU3O9cxdPzw/GFJ2T/1zXOw28kW3W4l2Fhmj7puw=; b=MFqtA6w9Ni+vy+/kvPGMq+MWejGgU7CKpsgaNDizHLAkp8tY6QbSGqdJ2v9DUQcNVz GSj/0EuiG0SUuK7HsgZ5F54geVnOymMdj8lTepEzFCThWpOYyTuBLI1BxuzorZ2qttlg OYnubCptwV1Y2jgG0e78E/qQQZygC6g/fCD+InMFLbI777eN4enDb8yDnLA/MUPgKB+A Wsya8e+WG+fef3fqeN6kyqMih968qodKyctgp27TOEGS7j5MTQ3zRfY4KrlM96groKvV CtUy6vakxVb/jPMDflINhs0PRY9Ja8XPUL0XI0Q7mIo38cl3rBUJBb77HANpETFg184R ArHA== 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=YQVEU3O9cxdPzw/GFJ2T/1zXOw28kW3W4l2Fhmj7puw=; b=l62BnTSLmdOs9fmqWdEryr6SHjfDJLfijPbieV2542qaXIitCS3EYLX2Q3tOMAkTVH dq8SwvomC6rXbcjk26maJJrANOaC2xPPRTqUtm0Z2jakPwDwGSYOTsbKjfXQs9+R/za3 RhkM7nc8vStih/vmB3s04V8B3tSbOU1KogNikupi0j798pe5curAtgFvc+FTXZB2EJ2G F/Q0xGRc4wZSXXkrCk7STkklIkgztC2sBZddL9+rt8EBKujrAR7eJmp56O8qmXonZh4o wZVTwXOHxeyWJcIXgCIG6ndihNuuKeRAdZXTnLbTrLBnFNz/71Ib0CitiENL2mYwoEKk 2dJw== X-Gm-Message-State: APjAAAW+4H5CiPTFllHlTX+oNsp/GN+gccWbTM/KpHNd2+pqDRBMtZeh JvX2GvqruFIXgoT3d8WYPnfjI15M X-Google-Smtp-Source: APXvYqzV3iOP1xJz0i+9SaThGGNKKUrbynBQL1+2BY3cP1euB/ZygZsag3B8a7Mk/6kq0maalOYnxg== X-Received: by 2002:a5d:6802:: with SMTP id w2mr2378483wru.353.1576670645402; Wed, 18 Dec 2019 04:04:05 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 62/87] colo: fix return without releasing RCU Date: Wed, 18 Dec 2019 13:02:28 +0100 Message-Id: <1576670573-48048-63-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use WITH_RCU_READ_LOCK_GUARD to avoid exiting colo_init_ram_cache without releasing RCU. Cc: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- migration/ram.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index 219e3ca..96feb40 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3890,26 +3890,27 @@ int colo_init_ram_cache(void) { RAMBlock *block; =20 - rcu_read_lock(); - RAMBLOCK_FOREACH_NOT_IGNORED(block) { - block->colo_cache =3D qemu_anon_ram_alloc(block->used_length, - NULL, - false); - if (!block->colo_cache) { - error_report("%s: Can't alloc memory for COLO cache of block %= s," - "size 0x" RAM_ADDR_FMT, __func__, block->idstr, - block->used_length); - RAMBLOCK_FOREACH_NOT_IGNORED(block) { - if (block->colo_cache) { - qemu_anon_ram_free(block->colo_cache, block->used_leng= th); - block->colo_cache =3D NULL; + WITH_RCU_READ_LOCK_GUARD() { + RAMBLOCK_FOREACH_NOT_IGNORED(block) { + block->colo_cache =3D qemu_anon_ram_alloc(block->used_length, + NULL, + false); + if (!block->colo_cache) { + error_report("%s: Can't alloc memory for COLO cache of blo= ck %s," + "size 0x" RAM_ADDR_FMT, __func__, block->idst= r, + block->used_length); + RAMBLOCK_FOREACH_NOT_IGNORED(block) { + if (block->colo_cache) { + qemu_anon_ram_free(block->colo_cache, block->used_= length); + block->colo_cache =3D NULL; + } } + return -errno; } - return -errno; + memcpy(block->colo_cache, block->host, block->used_length); } - memcpy(block->colo_cache, block->host, block->used_length); } - rcu_read_unlock(); + /* * Record the dirty pages that sent by PVM, we use this dirty bitmap to= gether * with to decide which page in cache should be flushed into SVM's RAM.= Here --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673602; cv=none; d=zohomail.com; s=zohoarc; b=JzvsTQhzAGOVnRsF5WvIX/tBHBJ90PRleOgD662XUXjh07NuxIxViwZ/ANlmy3ZHZSD719+cq1dWLQbOZoYutLK7di7L+UTdIIE6QFIutISWUfLkODniC+yp94qGE6J/lX7YiLUUuJ0Ls3pHLMp+MdcPKIeanq9oeQPLhsJncUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673602; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=JkFx8EZyku6wPBzGFRNiCBerrbPJdOzb00ZCzJtUmrE=; b=ccUaZRMbbRFu68PVfoPwaeoUOrw1n1Ynz6Fvvz0AipVC4ykDLJgq33C22iEJR/YAQvG3bmNO8umcNCkjfi5PB5Sdc1gYnlABvk9+SvNEkwMJw2TXdGShJC+X1+SCBbeI91QF00Zn2xMGCAI/XnNwXV4Lup3ucin0IxLTaqVSg8k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673602314523.6786980349423; Wed, 18 Dec 2019 04:53:22 -0800 (PST) Received: from localhost ([::1]:53770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYpM-0007nM-P3 for importer@patchew.org; Wed, 18 Dec 2019 07:53:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55114) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3l-0007CM-G2 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3k-0002va-4u for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:09 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51150) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3j-0002sn-Fz for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:07 -0500 Received: by mail-wm1-x342.google.com with SMTP id a5so1564591wmb.0 for ; Wed, 18 Dec 2019 04:04:07 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:05 -0800 (PST) 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=JkFx8EZyku6wPBzGFRNiCBerrbPJdOzb00ZCzJtUmrE=; b=IRastHimq8NodMQwvTjCQtfstnwpS8wSDRCnbDFjf5BjyIgO/XxicxKMoRMHy9/HqU gq8FdEdfaDFw8yuKp/IWnJL+HDvliw00v72NOvNynSEJUvD+QGJZwij5UiWDFy+fipaV RuM9h6i/ly23bEqjCLTBMj2jqk8RXqMb/6A/PJFNRp9YaFdMJmH/EaHH8b9lpsDg6Y39 QZCQT7VdACLmqIW8aLqZkmBZ016jAI1emSKTOAkbp3j1SEUgNNjGCzxtTDj/bkjZW3eR 4ObRlBnjE3gG89E7j7Tol9yOivfcUcrJo6NIBzowax7iMTZAyxiDkdiNhNPO4whoo8/8 7jng== 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=JkFx8EZyku6wPBzGFRNiCBerrbPJdOzb00ZCzJtUmrE=; b=N6UFHJHgyM+9TtAMMNpqZvD0aiGmei54Bf+ExJAD7yCAqK6sFDFPBN3uwoMHZmiBXn tnsh4oOq19Bw7DFEpuKrM3jop0aIzrvF2gRXM09O+Qjt9yH6hXo+YHL76mMLyLIbtn51 +iaB1s1I809Q1oxI95kOma5GEZhoIG1HDl6S/+p8/M74yoekT2d4z+eEsJWd2WM49NMW WFdvqVUaXapTSuAiM/VM8uI08RS4b/zwuKtTQg/c46Q/emOtq11s0xxYRSNU2528NNzt v+SMrEvFjpk6O5NJ8yJY6X9AsEBPIGZ7ki7zduS0GZasXbOUY1scdHfNYTf9Qd5d1Mzy i9ag== X-Gm-Message-State: APjAAAXJtelilsH3KQaeBeOOT1TwWl1DA6Y7O/xeWU1p89pNj/7sQ6Vy 9vnG6eJsoUzEBxZ50VHlRqpMEiGO X-Google-Smtp-Source: APXvYqzREdO5W8uimBYCK6b3rsb8V40ZSn+HD4WSgGazObGIndzKuM50BLT8k2NeMgJ1JrFqO842Xg== X-Received: by 2002:a1c:6809:: with SMTP id d9mr2926060wmc.70.1576670646215; Wed, 18 Dec 2019 04:04:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 63/87] build: rename CONFIG_LIBCAP to CONFIG_LIBCAP_NG Date: Wed, 18 Dec 2019 13:02:29 +0100 Message-Id: <1576670573-48048-64-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since we are actually testing for the newer capng library, rename the symbol to match. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- configure | 2 +- qemu-bridge-helper.c | 6 +++--- scsi/qemu-pr-helper.c | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 2943f5d..5723a29 100755 --- a/configure +++ b/configure @@ -6720,7 +6720,7 @@ if test "$l2tpv3" =3D "yes" ; then echo "CONFIG_L2TPV3=3Dy" >> $config_host_mak fi if test "$cap_ng" =3D "yes" ; then - echo "CONFIG_LIBCAP=3Dy" >> $config_host_mak + echo "CONFIG_LIBCAP_NG=3Dy" >> $config_host_mak fi echo "CONFIG_AUDIO_DRIVERS=3D$audio_drv_list" >> $config_host_mak for drv in $audio_drv_list; do diff --git a/qemu-bridge-helper.c b/qemu-bridge-helper.c index 3d50ec0..88b2674 100644 --- a/qemu-bridge-helper.c +++ b/qemu-bridge-helper.c @@ -43,7 +43,7 @@ =20 #include "net/tap-linux.h" =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG #include #endif =20 @@ -207,7 +207,7 @@ static int send_fd(int c, int fd) return sendmsg(c, &msg, 0); } =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG static int drop_privileges(void) { /* clear all capabilities */ @@ -246,7 +246,7 @@ int main(int argc, char **argv) int access_allowed, access_denied; int ret =3D EXIT_SUCCESS; =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG /* if we're run from an suid binary, immediately drop privileges prese= rving * cap_net_admin */ if (geteuid() =3D=3D 0 && getuid() !=3D geteuid()) { diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index debb18f..0659cee 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -24,7 +24,7 @@ #include #include =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG #include #endif #include @@ -70,7 +70,7 @@ static int num_active_sockets =3D 1; static int noisy; static int verbose; =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG static int uid =3D -1; static int gid =3D -1; #endif @@ -97,7 +97,7 @@ static void usage(const char *name) " (default '%s')\n" " -T, --trace [[enable=3D]][,events=3D][,file=3D]\n" " specify tracing options\n" -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG " -u, --user=3DUSER user to drop privileges to\n" " -g, --group=3DGROUP group to drop privileges to\n" #endif @@ -827,7 +827,7 @@ static void close_server_socket(void) num_active_sockets--; } =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG static int drop_privileges(void) { /* clear all capabilities */ @@ -920,7 +920,7 @@ int main(int argc, char **argv) pidfile =3D g_strdup(optarg); pidfile_specified =3D true; break; -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG case 'u': { unsigned long res; struct passwd *userinfo =3D getpwnam(optarg); @@ -1056,7 +1056,7 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } =20 -#ifdef CONFIG_LIBCAP +#ifdef CONFIG_LIBCAP_NG if (drop_privileges() < 0) { error_report("Failed to drop privileges: %s", strerror(errno)); exit(EXIT_FAILURE); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674357; cv=none; d=zohomail.com; s=zohoarc; b=LLpvZZpf2Q51f+dwuSvquCRsGw0Kkn74+EZ31F1KiKlOItnXi+dKo1Z3pMI527LIPabml3G79dxNJHu58zMU1TdziS+bJN3a4ysbkoW7Lz5pGhHwu2sigbY8FwwLKTNosEgvXSRqucDXROg4HxebydPzNVPbOAbWnRd69PMxqxs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674357; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lgkLaXoz9f6pXuj1UTSEA1h8UKQghuFJSvuukXaLCzs=; b=UnP4u40dbY8kzBLQnlVmbDWE6U2J3it5iJToSN2XVYHI+HnRttRoPUnf6r0RLvwoShPLOJler/LYAPFYBmhUY2E9b1A6S4CVLqhPiMvki6lwYPzVr7t74hqStFI7zlugLYDS1/zc2aCHp5tMT/Dq0kf+/kWbLYqtf4Hdil+YUXI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667435739057.46217846646675; Wed, 18 Dec 2019 05:05:57 -0800 (PST) Received: from localhost ([::1]:53968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ1X-0007B7-Kf for importer@patchew.org; Wed, 18 Dec 2019 08:05:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57099) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3w-0007Ov-47 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3n-0003BR-ED for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:19 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:53047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3m-000369-PJ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:11 -0500 Received: by mail-wm1-x334.google.com with SMTP id p9so1563946wmc.2 for ; Wed, 18 Dec 2019 04:04:10 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:06 -0800 (PST) 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=lgkLaXoz9f6pXuj1UTSEA1h8UKQghuFJSvuukXaLCzs=; b=JQgmqy7YF0IvLgppGuVW4dPjpCp7s/LSe7ksWRQEbX6Zpb82Z1CxdD6nrjHB6tI8ra Lz5u7e0wb4SNicCJ8ff56i4HSkgCxqyRspX8wOWO3fg+TYEe0k7wvTw1qSSZuZuBJpPl OnAVvFhsXes/Fy1KPFXxrqnJH2hjs2GJ/jRlFpvEiAqxw+Mj35j4eEGNYhfE3s5YB5W0 8Ug1j/SZQ9FZtSA7bG4eTu08MviYVToptP0jRcthpiSLb8pFm5A3+JNDwHMWZ65n5nD7 6iyMwFRfcxxcl6QfS+0DtIjsKY+/bcL//rLTCdSUgDVwiCiX0G7fKHjwqTKgd4RUAwgt vFcQ== 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=lgkLaXoz9f6pXuj1UTSEA1h8UKQghuFJSvuukXaLCzs=; b=nsuXg82YpS/cxMuS+LWA9m1iEHtlUWzzv7LTeTEPbfAOoeo5w4Hi2zwLsQn8H9IlH1 8xPVK2nYYVOOHymDoi79kqeR8dAO8THi+hngxbHl9llhdO5kEBs3BC4WnTkFOJji3NFs EJMGuh4ztllc536ZKDSQGfAvQqDRZ0uOTkh9+eT0qSLJHiCH4MKC8NJlKxYLblWX2/9G agbvLv7NYUuy0nYK75nQsEr0HETxRDU6oauXvtW/HZHuU2NAAzX7OO1dCiGhSAMXdAKp uMY7UVNPhCsNDjuLLqFR/Kzgd6DQcHH/bsiPrdi6d8/xuQ7MvX37G7GDTPVj0YCteW5t Oybw== X-Gm-Message-State: APjAAAUeFIdlZw6DKaqx+ChTydXb4nPXm9/SZ1HrmWmd8YhKZ4clNsoh L4pf4vbb+/01oymhE28P/w6kYHpO X-Google-Smtp-Source: APXvYqxPaLFePkJ8HtiYhgvk6sn6BUsaWfrLX9obGO9cTVRyfTifE/7GQlQmKyBbLjAtuPza2bxtVA== X-Received: by 2002:a05:600c:246:: with SMTP id 6mr2646268wmj.122.1576670647478; Wed, 18 Dec 2019 04:04:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 64/87] docs: import Linux kernel-doc script and extension Date: Wed, 18 Dec 2019 13:02:30 +0100 Message-Id: <1576670573-48048-65-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::334 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Import Linux's kernel-doc script as of commit 15e2544ed38a1e, as well as the Sphinx extension to call kernel-doc according to the arguments and parameters given to a reStructuredText directive. The kernel-doc extension accepts a filename, which is relative to the QEMU source tree root. The extension also notifies Sphinx about the document dependency on the file, causing the document to be rebuilt when the file has been changed. Signed-off-by: Paolo Bonzini --- docs/sphinx/kerneldoc.py | 172 ++++ docs/sphinx/kernellog.py | 28 + scripts/kernel-doc | 2226 ++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 2426 insertions(+) create mode 100644 docs/sphinx/kerneldoc.py create mode 100644 docs/sphinx/kernellog.py create mode 100755 scripts/kernel-doc diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py new file mode 100644 index 0000000..1159405 --- /dev/null +++ b/docs/sphinx/kerneldoc.py @@ -0,0 +1,172 @@ +# coding=3Dutf-8 +# +# Copyright =C2=A9 2016 Intel Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"= ), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice (including the next +# paragraph) shall be included in all copies or substantial portions of the +# Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS = OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTH= ER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL= INGS +# IN THE SOFTWARE. +# +# Authors: +# Jani Nikula +# +# Please make sure this works on both python2 and python3. +# + +import codecs +import os +import subprocess +import sys +import re +import glob + +from docutils import nodes, statemachine +from docutils.statemachine import ViewList +from docutils.parsers.rst import directives, Directive + +# +# AutodocReporter is only good up to Sphinx 1.7 +# +import sphinx + +Use_SSI =3D sphinx.__version__[:3] >=3D '1.7' +if Use_SSI: + from sphinx.util.docutils import switch_source_input +else: + from sphinx.ext.autodoc import AutodocReporter + +import kernellog + +__version__ =3D '1.0' + +class KernelDocDirective(Directive): + """Extract kernel-doc comments from the specified file""" + required_argument =3D 1 + optional_arguments =3D 4 + option_spec =3D { + 'doc': directives.unchanged_required, + 'functions': directives.unchanged, + 'export': directives.unchanged, + 'internal': directives.unchanged, + } + has_content =3D False + + def run(self): + env =3D self.state.document.settings.env + cmd =3D [env.config.kerneldoc_bin, '-rst', '-enable-lineno'] + + filename =3D env.config.kerneldoc_srctree + '/' + self.arguments[0] + export_file_patterns =3D [] + + # Tell sphinx of the dependency + env.note_dependency(os.path.abspath(filename)) + + tab_width =3D self.options.get('tab-width', self.state.document.se= ttings.tab_width) + + # FIXME: make this nicer and more robust against errors + if 'export' in self.options: + cmd +=3D ['-export'] + export_file_patterns =3D str(self.options.get('export')).split= () + elif 'internal' in self.options: + cmd +=3D ['-internal'] + export_file_patterns =3D str(self.options.get('internal')).spl= it() + elif 'doc' in self.options: + cmd +=3D ['-function', str(self.options.get('doc'))] + elif 'functions' in self.options: + functions =3D self.options.get('functions').split() + if functions: + for f in functions: + cmd +=3D ['-function', f] + else: + cmd +=3D ['-no-doc-sections'] + + for pattern in export_file_patterns: + for f in glob.glob(env.config.kerneldoc_srctree + '/' + patter= n): + env.note_dependency(os.path.abspath(f)) + cmd +=3D ['-export-file', f] + + cmd +=3D [filename] + + try: + kernellog.verbose(env.app, + 'calling kernel-doc \'%s\'' % (" ".join(cmd)= )) + + p =3D subprocess.Popen(cmd, stdout=3Dsubprocess.PIPE, stderr= =3Dsubprocess.PIPE) + out, err =3D p.communicate() + + out, err =3D codecs.decode(out, 'utf-8'), codecs.decode(err, '= utf-8') + + if p.returncode !=3D 0: + sys.stderr.write(err) + + kernellog.warn(env.app, + 'kernel-doc \'%s\' failed with return code = %d' % (" ".join(cmd), p.returncode)) + return [nodes.error(None, nodes.paragraph(text =3D "kernel= -doc missing"))] + elif env.config.kerneldoc_verbosity > 0: + sys.stderr.write(err) + + lines =3D statemachine.string2lines(out, tab_width, convert_wh= itespace=3DTrue) + result =3D ViewList() + + lineoffset =3D 0; + line_regex =3D re.compile("^#define LINENO ([0-9]+)$") + for line in lines: + match =3D line_regex.search(line) + if match: + # sphinx counts lines from 0 + lineoffset =3D int(match.group(1)) - 1 + # we must eat our comments since the upset the markup + else: + result.append(line, filename, lineoffset) + lineoffset +=3D 1 + + node =3D nodes.section() + self.do_parse(result, node) + + return node.children + + except Exception as e: # pylint: disable=3DW0703 + kernellog.warn(env.app, 'kernel-doc \'%s\' processing failed w= ith: %s' % + (" ".join(cmd), str(e))) + return [nodes.error(None, nodes.paragraph(text =3D "kernel-doc= missing"))] + + def do_parse(self, result, node): + if Use_SSI: + with switch_source_input(self.state, result): + self.state.nested_parse(result, 0, node, match_titles=3D1) + else: + save =3D self.state.memo.title_styles, self.state.memo.section= _level, self.state.memo.reporter + self.state.memo.reporter =3D AutodocReporter(result, self.stat= e.memo.reporter) + self.state.memo.title_styles, self.state.memo.section_level = =3D [], 0 + try: + self.state.nested_parse(result, 0, node, match_titles=3D1) + finally: + self.state.memo.title_styles, self.state.memo.section_leve= l, self.state.memo.reporter =3D save + + +def setup(app): + app.add_config_value('kerneldoc_bin', None, 'env') + app.add_config_value('kerneldoc_srctree', None, 'env') + app.add_config_value('kerneldoc_verbosity', 1, 'env') + + app.add_directive('kernel-doc', KernelDocDirective) + + return dict( + version =3D __version__, + parallel_read_safe =3D True, + parallel_write_safe =3D True + ) diff --git a/docs/sphinx/kernellog.py b/docs/sphinx/kernellog.py new file mode 100644 index 0000000..af924f5 --- /dev/null +++ b/docs/sphinx/kernellog.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Sphinx has deprecated its older logging interface, but the replacement +# only goes back to 1.6. So here's a wrapper layer to keep around for +# as long as we support 1.4. +# +import sphinx + +if sphinx.__version__[:3] >=3D '1.6': + UseLogging =3D True + from sphinx.util import logging + logger =3D logging.getLogger('kerneldoc') +else: + UseLogging =3D False + +def warn(app, message): + if UseLogging: + logger.warning(message) + else: + app.warn(message) + +def verbose(app, message): + if UseLogging: + logger.verbose(message) + else: + app.verbose(message) + + diff --git a/scripts/kernel-doc b/scripts/kernel-doc new file mode 100755 index 0000000..81dc917 --- /dev/null +++ b/scripts/kernel-doc @@ -0,0 +1,2226 @@ +#!/usr/bin/env perl +# SPDX-License-Identifier: GPL-2.0 + +use warnings; +use strict; + +## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## +## Copyright (C) 2000, 1 Tim Waugh ## +## Copyright (C) 2001 Simon Huggins ## +## Copyright (C) 2005-2012 Randy Dunlap ## +## Copyright (C) 2012 Dan Luedtke ## +## ## +## #define enhancements by Armin Kuster ## +## Copyright (c) 2000 MontaVista Software, Inc. ## +## ## +## This software falls under the GNU General Public License. ## +## Please read the COPYING file for more information ## + +# 18/01/2001 - Cleanups +# Functions prototyped as foo(void) same as foo() +# Stop eval'ing where we don't need to. +# -- huggie@earth.li + +# 27/06/2001 - Allowed whitespace after initial "/**" and +# allowed comments before function declarations. +# -- Christian Kreibich + +# Still to do: +# - add perldoc documentation +# - Look more closely at some of the scarier bits :) + +# 26/05/2001 - Support for separate source and object trees. +# Return error code. +# Keith Owens + +# 23/09/2001 - Added support for typedefs, structs, enums and unions +# Support for Context section; can be terminated using empty = line +# Small fixes (like spaces vs. \s in regex) +# -- Tim Jansen + +# 25/07/2012 - Added support for HTML5 +# -- Dan Luedtke + +sub usage { + my $message =3D <<"EOF"; +Usage: $0 [OPTION ...] FILE ... + +Read C language source or header FILEs, extract embedded documentation com= ments, +and print formatted documentation to standard output. + +The documentation comments are identified by "/**" opening comment mark. S= ee +Documentation/doc-guide/kernel-doc.rst for the documentation comment synta= x. + +Output format selection (mutually exclusive): + -man Output troff manual page format. This is the default. + -rst Output reStructuredText format. + -none Do not output documentation, only warnings. + +Output selection (mutually exclusive): + -export Only output documentation for symbols that have been + exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() + in any input FILE or -export-file FILE. + -internal Only output documentation for symbols that have NOT been + exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() + in any input FILE or -export-file FILE. + -function NAME Only output documentation for the given function(s) + or DOC: section title(s). All other functions and DOC: + sections are ignored. May be specified multiple times. + -nofunction NAME Do NOT output documentation for the given function(s); + only output documentation for the other functions and + DOC: sections. May be specified multiple times. + +Output selection modifiers: + -no-doc-sections Do not output DOC: sections. + -enable-lineno Enable output of #define LINENO lines. Only works = with + reStructuredText format. + -export-file FILE Specify an additional FILE in which to look for + EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL(). To be use= d with + -export or -internal. May be specified multiple ti= mes. + +Other parameters: + -v Verbose output, more warnings and other information. + -h Print this help. + +EOF + print $message; + exit 1; +} + +# +# format of comments. +# In the following table, (...)? signifies optional structure. +# (...)* signifies 0 or more structure elements +# /** +# * function_name(:)? (- short description)? +# (* @parameterx: (description of parameter x)?)* +# (* a blank line)? +# * (Description:)? (Description of function)? +# * (section header: (section description)? )* +# (*)?*/ +# +# So .. the trivial example would be: +# +# /** +# * my_function +# */ +# +# If the Description: header tag is omitted, then there must be a blank li= ne +# after the last parameter specification. +# e.g. +# /** +# * my_function - does my stuff +# * @my_arg: its mine damnit +# * +# * Does my stuff explained. +# */ +# +# or, could also use: +# /** +# * my_function - does my stuff +# * @my_arg: its mine damnit +# * Description: Does my stuff explained. +# */ +# etc. +# +# Besides functions you can also write documentation for structs, unions, +# enums and typedefs. Instead of the function name you must write the name +# of the declaration; the struct/union/enum/typedef must always precede +# the name. Nesting of declarations is not supported. +# Use the argument mechanism to document members or constants. +# e.g. +# /** +# * struct my_struct - short description +# * @a: first member +# * @b: second member +# * +# * Longer description +# */ +# struct my_struct { +# int a; +# int b; +# /* private: */ +# int c; +# }; +# +# All descriptions can be multiline, except the short function description. +# +# For really longs structs, you can also describe arguments inside the +# body of the struct. +# eg. +# /** +# * struct my_struct - short description +# * @a: first member +# * @b: second member +# * +# * Longer description +# */ +# struct my_struct { +# int a; +# int b; +# /** +# * @c: This is longer description of C +# * +# * You can use paragraphs to describe arguments +# * using this method. +# */ +# int c; +# }; +# +# This should be use only for struct/enum members. +# +# You can also add additional sections. When documenting kernel functions = you +# should document the "Context:" of the function, e.g. whether the functio= ns +# can be called form interrupts. Unlike other sections you can end it with= an +# empty line. +# A non-void function should have a "Return:" section describing the return +# value(s). +# Example-sections should contain the string EXAMPLE so that they are mark= ed +# appropriately in DocBook. +# +# Example: +# /** +# * user_function - function that can only be called in user context +# * @a: some argument +# * Context: !in_interrupt() +# * +# * Some description +# * Example: +# * user_function(22); +# */ +# ... +# +# +# All descriptive text is further processed, scanning for the following sp= ecial +# patterns, which are highlighted appropriately. +# +# 'funcname()' - function +# '$ENVVAR' - environmental variable +# '&struct_name' - name of a structure (up to two words including 'struct') +# '&struct_name.member' - name of a structure member +# '@parameter' - name of a parameter +# '%CONST' - name of a constant. +# '``LITERAL``' - literal string without any spaces on it. + +## init lots of data + +my $errors =3D 0; +my $warnings =3D 0; +my $anon_struct_union =3D 0; + +# match expressions used to find embedded type information +my $type_constant =3D '\b``([^\`]+)``\b'; +my $type_constant2 =3D '\%([-_\w]+)'; +my $type_func =3D '(\w+)\(\)'; +my $type_param =3D '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)'; +my $type_fp_param =3D '\@(\w+)\(\)'; # Special RST handling for func ptr = params +my $type_env =3D '(\$\w+)'; +my $type_enum =3D '\&(enum\s*([_\w]+))'; +my $type_struct =3D '\&(struct\s*([_\w]+))'; +my $type_typedef =3D '\&(typedef\s*([_\w]+))'; +my $type_union =3D '\&(union\s*([_\w]+))'; +my $type_member =3D '\&([_\w]+)(\.|->)([_\w]+)'; +my $type_fallback =3D '\&([_\w]+)'; +my $type_member_func =3D $type_member . '\(\)'; + +# Output conversion substitutions. +# One for each output format + +# these are pretty rough +my @highlights_man =3D ( + [$type_constant, "\$1"], + [$type_constant2, "\$1"], + [$type_func, "\\\\fB\$1\\\\fP"], + [$type_enum, "\\\\fI\$1\\\\fP"], + [$type_struct, "\\\\fI\$1\\\\fP"], + [$type_typedef, "\\\\fI\$1\\\\fP"], + [$type_union, "\\\\fI\$1\\\\fP"], + [$type_param, "\\\\fI\$1\\\\fP"], + [$type_member, "\\\\fI\$1\$2\$3\\\\fP"], + [$type_fallback, "\\\\fI\$1\\\\fP"] + ); +my $blankline_man =3D ""; + +# rst-mode +my @highlights_rst =3D ( + [$type_constant, "``\$1``"], + [$type_constant2, "``\$1``"], + # Note: need to escape () to avoid func matching la= ter + [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\= \\\) <\$1>`"], + [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], + [$type_fp_param, "**\$1\\\\(\\\\)**"], + [$type_func, "\$1()"], + [$type_enum, "\\:c\\:type\\:`\$1 <\$2>`"], + [$type_struct, "\\:c\\:type\\:`\$1 <\$2>`"], + [$type_typedef, "\\:c\\:type\\:`\$1 <\$2>`"], + [$type_union, "\\:c\\:type\\:`\$1 <\$2>`"], + # in rst this can refer to any type + [$type_fallback, "\\:c\\:type\\:`\$1`"], + [$type_param, "**\$1**"] + ); +my $blankline_rst =3D "\n"; + +# read arguments +if ($#ARGV =3D=3D -1) { + usage(); +} + +my $kernelversion; +my $dohighlight =3D ""; + +my $verbose =3D 0; +my $output_mode =3D "rst"; +my $output_preformatted =3D 0; +my $no_doc_sections =3D 0; +my $enable_lineno =3D 0; +my @highlights =3D @highlights_rst; +my $blankline =3D $blankline_rst; +my $modulename =3D "Kernel API"; + +use constant { + OUTPUT_ALL =3D> 0, # output all symbols and doc sections + OUTPUT_INCLUDE =3D> 1, # output only specified symbols + OUTPUT_EXCLUDE =3D> 2, # output everything except specified symbo= ls + OUTPUT_EXPORTED =3D> 3, # output exported symbols + OUTPUT_INTERNAL =3D> 4, # output non-exported symbols +}; +my $output_selection =3D OUTPUT_ALL; +my $show_not_found =3D 0; # No longer used + +my @export_file_list; + +my @build_time; +if (defined($ENV{'KBUILD_BUILD_TIMESTAMP'}) && + (my $seconds =3D `date -d"${ENV{'KBUILD_BUILD_TIMESTAMP'}}" +%s`) ne '= ') { + @build_time =3D gmtime($seconds); +} else { + @build_time =3D localtime; +} + +my $man_date =3D ('January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', + 'November', 'December')[$build_time[4]] . + " " . ($build_time[5]+1900); + +# Essentially these are globals. +# They probably want to be tidied up, made more localised or something. +# CAVEAT EMPTOR! Some of the others I localised may not want to be, which +# could cause "use of undefined value" or other bugs. +my ($function, %function_table, %parametertypes, $declaration_purpose); +my $declaration_start_line; +my ($type, $declaration_name, $return_type); +my ($newsection, $newcontents, $prototype, $brcount, %source_map); + +if (defined($ENV{'KBUILD_VERBOSE'})) { + $verbose =3D "$ENV{'KBUILD_VERBOSE'}"; +} + +# Generated docbook code is inserted in a template at a point where +# docbook v3.1 requires a non-zero sequence of RefEntry's; see: +# http://www.oasis-open.org/docbook/documentation/reference/html/refentry.= html +# We keep track of number of generated entries and generate a dummy +# if needs be to ensure the expanded template can be postprocessed +# into html. +my $section_counter =3D 0; + +my $lineprefix=3D""; + +# Parser states +use constant { + STATE_NORMAL =3D> 0, # normal code + STATE_NAME =3D> 1, # looking for function name + STATE_BODY_MAYBE =3D> 2, # body - or maybe more description + STATE_BODY =3D> 3, # the body of the comment + STATE_PROTO =3D> 4, # scanning prototype + STATE_DOCBLOCK =3D> 5, # documentation block + STATE_INLINE =3D> 6, # gathering documentation outside main blo= ck +}; +my $state; +my $in_doc_sect; +my $leading_space; + +# Inline documentation state +use constant { + STATE_INLINE_NA =3D> 0, # not applicable ($state !=3D STATE_INLINE) + STATE_INLINE_NAME =3D> 1, # looking for member name (@foo:) + STATE_INLINE_TEXT =3D> 2, # looking for member documentation + STATE_INLINE_END =3D> 3, # done + STATE_INLINE_ERROR =3D> 4, # error - Comment without header was found. + # Spit a warning as it's not + # proper kernel-doc and ignore the rest. +}; +my $inline_doc_state; + +#declaration types: can be +# 'function', 'struct', 'union', 'enum', 'typedef' +my $decl_type; + +my $doc_start =3D '^/\*\*\s*$'; # Allow whitespace at end of comment start. +my $doc_end =3D '\*/'; +my $doc_com =3D '\s*\*\s*'; +my $doc_com_body =3D '\s*\* ?'; +my $doc_decl =3D $doc_com . '(\w+)'; +# @params and a strictly limited set of supported section names +my $doc_sect =3D $doc_com . + '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\= s*:(.*)'; +my $doc_content =3D $doc_com_body . '(.*)'; +my $doc_block =3D $doc_com . 'DOC:\s*(.*)?'; +my $doc_inline_start =3D '^\s*/\*\*\s*$'; +my $doc_inline_sect =3D '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)'; +my $doc_inline_end =3D '^\s*\*/\s*$'; +my $doc_inline_oneline =3D '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$'; +my $export_symbol =3D '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;'; + +my %parameterdescs; +my %parameterdesc_start_lines; +my @parameterlist; +my %sections; +my @sectionlist; +my %section_start_lines; +my $sectcheck; +my $struct_actual; + +my $contents =3D ""; +my $new_start_line =3D 0; + +# the canonical section names. see also $doc_sect above. +my $section_default =3D "Description"; # default section +my $section_intro =3D "Introduction"; +my $section =3D $section_default; +my $section_context =3D "Context"; +my $section_return =3D "Return"; + +my $undescribed =3D "-- undescribed --"; + +reset_state(); + +while ($ARGV[0] =3D~ m/^--?(.*)/) { + my $cmd =3D $1; + shift @ARGV; + if ($cmd eq "man") { + $output_mode =3D "man"; + @highlights =3D @highlights_man; + $blankline =3D $blankline_man; + } elsif ($cmd eq "rst") { + $output_mode =3D "rst"; + @highlights =3D @highlights_rst; + $blankline =3D $blankline_rst; + } elsif ($cmd eq "none") { + $output_mode =3D "none"; + } elsif ($cmd eq "module") { # not needed for XML, inherits from calli= ng document + $modulename =3D shift @ARGV; + } elsif ($cmd eq "function") { # to only output specific functions + $output_selection =3D OUTPUT_INCLUDE; + $function =3D shift @ARGV; + $function_table{$function} =3D 1; + } elsif ($cmd eq "nofunction") { # output all except specific functions + $output_selection =3D OUTPUT_EXCLUDE; + $function =3D shift @ARGV; + $function_table{$function} =3D 1; + } elsif ($cmd eq "export") { # only exported symbols + $output_selection =3D OUTPUT_EXPORTED; + %function_table =3D (); + } elsif ($cmd eq "internal") { # only non-exported symbols + $output_selection =3D OUTPUT_INTERNAL; + %function_table =3D (); + } elsif ($cmd eq "export-file") { + my $file =3D shift @ARGV; + push(@export_file_list, $file); + } elsif ($cmd eq "v") { + $verbose =3D 1; + } elsif (($cmd eq "h") || ($cmd eq "help")) { + usage(); + } elsif ($cmd eq 'no-doc-sections') { + $no_doc_sections =3D 1; + } elsif ($cmd eq 'enable-lineno') { + $enable_lineno =3D 1; + } elsif ($cmd eq 'show-not-found') { + $show_not_found =3D 1; # A no-op but don't fail + } else { + # Unknown argument + usage(); + } +} + +# continue execution near EOF; + +# get kernel version from env +sub get_kernel_version() { + my $version =3D 'unknown kernel version'; + + if (defined($ENV{'KERNELVERSION'})) { + $version =3D $ENV{'KERNELVERSION'}; + } + return $version; +} + +# +sub print_lineno { + my $lineno =3D shift; + if ($enable_lineno && defined($lineno)) { + print "#define LINENO " . $lineno . "\n"; + } +} +## +# dumps section contents to arrays/hashes intended for that purpose. +# +sub dump_section { + my $file =3D shift; + my $name =3D shift; + my $contents =3D join "\n", @_; + + if ($name =3D~ m/$type_param/) { + $name =3D $1; + $parameterdescs{$name} =3D $contents; + $sectcheck =3D $sectcheck . $name . " "; + $parameterdesc_start_lines{$name} =3D $new_start_line; + $new_start_line =3D 0; + } elsif ($name eq "@\.\.\.") { + $name =3D "..."; + $parameterdescs{$name} =3D $contents; + $sectcheck =3D $sectcheck . $name . " "; + $parameterdesc_start_lines{$name} =3D $new_start_line; + $new_start_line =3D 0; + } else { + if (defined($sections{$name}) && ($sections{$name} ne "")) { + # Only warn on user specified duplicate section names. + if ($name ne $section_default) { + print STDERR "${file}:$.: warning: duplicate section name '$name'\n"; + ++$warnings; + } + $sections{$name} .=3D $contents; + } else { + $sections{$name} =3D $contents; + push @sectionlist, $name; + $section_start_lines{$name} =3D $new_start_line; + $new_start_line =3D 0; + } + } +} + +## +# dump DOC: section after checking that it should go out +# +sub dump_doc_section { + my $file =3D shift; + my $name =3D shift; + my $contents =3D join "\n", @_; + + if ($no_doc_sections) { + return; + } + + if (($output_selection =3D=3D OUTPUT_ALL) || + ($output_selection =3D=3D OUTPUT_INCLUDE && + defined($function_table{$name})) || + ($output_selection =3D=3D OUTPUT_EXCLUDE && + !defined($function_table{$name}))) + { + dump_section($file, $name, $contents); + output_blockhead({'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'module' =3D> $modulename, + 'content-only' =3D> ($output_selection !=3D OUTPUT_ALL), }); + } +} + +## +# output function +# +# parameterdescs, a hash. +# function =3D> "function name" +# parameterlist =3D> @list of parameters +# parameterdescs =3D> %parameter descriptions +# sectionlist =3D> @list of sections +# sections =3D> %section descriptions +# + +sub output_highlight { + my $contents =3D join "\n",@_; + my $line; + +# DEBUG +# if (!defined $contents) { +# use Carp; +# confess "output_highlight got called with no args?\n"; +# } + +# print STDERR "contents b4:$contents\n"; + eval $dohighlight; + die $@ if $@; +# print STDERR "contents af:$contents\n"; + + foreach $line (split "\n", $contents) { + if (! $output_preformatted) { + $line =3D~ s/^\s*//; + } + if ($line eq ""){ + if (! $output_preformatted) { + print $lineprefix, $blankline; + } + } else { + if ($output_mode eq "man" && substr($line, 0, 1) eq ".") { + print "\\&$line"; + } else { + print $lineprefix, $line; + } + } + print "\n"; + } +} + +## +# output function in man +sub output_function_man(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'function'}\" 9 \"$args{'function'}\" \"$man_date\"= \"Kernel Hacker's Manual\" LINUX\n"; + + print ".SH NAME\n"; + print $args{'function'} . " \\- " . $args{'purpose'} . "\n"; + + print ".SH SYNOPSIS\n"; + if ($args{'functiontype'} ne "") { + print ".B \"" . $args{'functiontype'} . "\" " . $args{'function'} . "\n"; + } else { + print ".B \"" . $args{'function'} . "\n"; + } + $count =3D 0; + my $parenth =3D "("; + my $post =3D ","; + foreach my $parameter (@{$args{'parameterlist'}}) { + if ($count =3D=3D $#{$args{'parameterlist'}}) { + $post =3D ");"; + } + $type =3D $args{'parametertypes'}{$parameter}; + if ($type =3D~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print ".BI \"" . $parenth . $1 . "\" " . $parameter . " \") (" . $2 .= ")" . $post . "\"\n"; + } else { + $type =3D~ s/([^\*])$/$1 /; + print ".BI \"" . $parenth . $type . "\" " . $parameter . " \"" . $pos= t . "\"\n"; + } + $count++; + $parenth =3D ""; + } + + print ".SH ARGUMENTS\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name =3D $parameter; + $parameter_name =3D~ s/\[.*//; + + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"", uc $section, "\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output enum in man +sub output_enum_man(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'module'}\" 9 \"enum $args{'enum'}\" \"$man_date\" = \"API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print "enum " . $args{'enum'} . " \\- " . $args{'purpose'} . "\n"; + + print ".SH SYNOPSIS\n"; + print "enum " . $args{'enum'} . " {\n"; + $count =3D 0; + foreach my $parameter (@{$args{'parameterlist'}}) { + print ".br\n.BI \" $parameter\"\n"; + if ($count =3D=3D $#{$args{'parameterlist'}}) { + print "\n};\n"; + last; + } + else { + print ", \n.br\n"; + } + $count++; + } + + print ".SH Constants\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name =3D $parameter; + $parameter_name =3D~ s/\[.*//; + + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output struct in man +sub output_struct_man(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + + print ".TH \"$args{'module'}\" 9 \"" . $args{'type'} . " " . $args{'st= ruct'} . "\" \"$man_date\" \"API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print $args{'type'} . " " . $args{'struct'} . " \\- " . $args{'purpose= '} . "\n"; + + my $declaration =3D $args{'definition'}; + $declaration =3D~ s/\t/ /g; + $declaration =3D~ s/\n/"\n.br\n.BI \"/g; + print ".SH SYNOPSIS\n"; + print $args{'type'} . " " . $args{'struct'} . " {\n.br\n"; + print ".BI \"$declaration\n};\n.br\n\n"; + + print ".SH Members\n"; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =3D~ /^#/) && next; + + my $parameter_name =3D $parameter; + $parameter_name =3D~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + print ".IP \"" . $parameter . "\" 12\n"; + output_highlight($args{'parameterdescs'}{$parameter_name}); + } + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output typedef in man +sub output_typedef_man(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + + print ".TH \"$args{'module'}\" 9 \"$args{'typedef'}\" \"$man_date\" \"= API Manual\" LINUX\n"; + + print ".SH NAME\n"; + print "typedef " . $args{'typedef'} . " \\- " . $args{'purpose'} . "\n= "; + + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +sub output_blockhead_man(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + my $count; + + print ".TH \"$args{'module'}\" 9 \"$args{'module'}\" \"$man_date\" \"A= PI Manual\" LINUX\n"; + + foreach $section (@{$args{'sectionlist'}}) { + print ".SH \"$section\"\n"; + output_highlight($args{'sections'}{$section}); + } +} + +## +# output in restructured text +# + +# +# This could use some work; it's used to output the DOC: sections, and +# starts by putting out the name of the doc section itself, but that tends +# to duplicate a header already in the template file. +# +sub output_blockhead_rst(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + + foreach $section (@{$args{'sectionlist'}}) { + if ($output_selection !=3D OUTPUT_INCLUDE) { + print "**$section**\n\n"; + } + print_lineno($section_start_lines{$section}); + output_highlight_rst($args{'sections'}{$section}); + print "\n"; + } +} + +# +# Apply the RST highlights to a sub-block of text. +# +sub highlight_block($) { + # The dohighlight kludge requires the text be called $contents + my $contents =3D shift; + eval $dohighlight; + die $@ if $@; + return $contents; +} + +# +# Regexes used only here. +# +my $sphinx_literal =3D '^[^.].*::$'; +my $sphinx_cblock =3D '^\.\.\ +code-block::'; + +sub output_highlight_rst { + my $input =3D join "\n",@_; + my $output =3D ""; + my $line; + my $in_literal =3D 0; + my $litprefix; + my $block =3D ""; + + foreach $line (split "\n",$input) { + # + # If we're in a literal block, see if we should drop out + # of it. Otherwise pass the line straight through unmunged. + # + if ($in_literal) { + if (! ($line =3D~ /^\s*$/)) { + # + # If this is the first non-blank line in a literal + # block we need to figure out what the proper indent is. + # + if ($litprefix eq "") { + $line =3D~ /^(\s*)/; + $litprefix =3D '^' . $1; + $output .=3D $line . "\n"; + } elsif (! ($line =3D~ /$litprefix/)) { + $in_literal =3D 0; + } else { + $output .=3D $line . "\n"; + } + } else { + $output .=3D $line . "\n"; + } + } + # + # Not in a literal block (or just dropped out) + # + if (! $in_literal) { + $block .=3D $line . "\n"; + if (($line =3D~ /$sphinx_literal/) || ($line =3D~ /$sphinx_cblock/)) { + $in_literal =3D 1; + $litprefix =3D ""; + $output .=3D highlight_block($block); + $block =3D "" + } + } + } + + if ($block) { + $output .=3D highlight_block($block); + } + foreach $line (split "\n", $output) { + print $lineprefix . $line . "\n"; + } +} + +sub output_function_rst(%) { + my %args =3D %{$_[0]}; + my ($parameter, $section); + my $oldprefix =3D $lineprefix; + my $start =3D ""; + + if ($args{'typedef'}) { + print ".. c:type:: ". $args{'function'} . "\n\n"; + print_lineno($declaration_start_line); + print " **Typedef**: "; + $lineprefix =3D ""; + output_highlight_rst($args{'purpose'}); + $start =3D "\n\n**Syntax**\n\n ``"; + } else { + print ".. c:function:: "; + } + if ($args{'functiontype'} ne "") { + $start .=3D $args{'functiontype'} . " " . $args{'function'} . " ("; + } else { + $start .=3D $args{'function'} . " ("; + } + print $start; + + my $count =3D 0; + foreach my $parameter (@{$args{'parameterlist'}}) { + if ($count ne 0) { + print ", "; + } + $count++; + $type =3D $args{'parametertypes'}{$parameter}; + + if ($type =3D~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { + # pointer-to-function + print $1 . $parameter . ") (" . $2; + } else { + print $type . " " . $parameter; + } + } + if ($args{'typedef'}) { + print ");``\n\n"; + } else { + print ")\n\n"; + print_lineno($declaration_start_line); + $lineprefix =3D " "; + output_highlight_rst($args{'purpose'}); + print "\n"; + } + + print "**Parameters**\n\n"; + $lineprefix =3D " "; + foreach $parameter (@{$args{'parameterlist'}}) { + my $parameter_name =3D $parameter; + $parameter_name =3D~ s/\[.*//; + $type =3D $args{'parametertypes'}{$parameter}; + + if ($type ne "") { + print "``$type $parameter``\n"; + } else { + print "``$parameter``\n"; + } + + print_lineno($parameterdesc_start_lines{$parameter_name}); + + if (defined($args{'parameterdescs'}{$parameter_name}) && + $args{'parameterdescs'}{$parameter_name} ne $undescribed) { + output_highlight_rst($args{'parameterdescs'}{$parameter_name}); + } else { + print " *undescribed*\n"; + } + print "\n"; + } + + $lineprefix =3D $oldprefix; + output_section_rst(@_); +} + +sub output_section_rst(%) { + my %args =3D %{$_[0]}; + my $section; + my $oldprefix =3D $lineprefix; + $lineprefix =3D ""; + + foreach $section (@{$args{'sectionlist'}}) { + print "**$section**\n\n"; + print_lineno($section_start_lines{$section}); + output_highlight_rst($args{'sections'}{$section}); + print "\n"; + } + print "\n"; + $lineprefix =3D $oldprefix; +} + +sub output_enum_rst(%) { + my %args =3D %{$_[0]}; + my ($parameter); + my $oldprefix =3D $lineprefix; + my $count; + my $name =3D "enum " . $args{'enum'}; + + print "\n\n.. c:type:: " . $name . "\n\n"; + print_lineno($declaration_start_line); + $lineprefix =3D " "; + output_highlight_rst($args{'purpose'}); + print "\n"; + + print "**Constants**\n\n"; + $lineprefix =3D " "; + foreach $parameter (@{$args{'parameterlist'}}) { + print "``$parameter``\n"; + if ($args{'parameterdescs'}{$parameter} ne $undescribed) { + output_highlight_rst($args{'parameterdescs'}{$parameter}); + } else { + print " *undescribed*\n"; + } + print "\n"; + } + + $lineprefix =3D $oldprefix; + output_section_rst(@_); +} + +sub output_typedef_rst(%) { + my %args =3D %{$_[0]}; + my ($parameter); + my $oldprefix =3D $lineprefix; + my $name =3D "typedef " . $args{'typedef'}; + + print "\n\n.. c:type:: " . $name . "\n\n"; + print_lineno($declaration_start_line); + $lineprefix =3D " "; + output_highlight_rst($args{'purpose'}); + print "\n"; + + $lineprefix =3D $oldprefix; + output_section_rst(@_); +} + +sub output_struct_rst(%) { + my %args =3D %{$_[0]}; + my ($parameter); + my $oldprefix =3D $lineprefix; + my $name =3D $args{'type'} . " " . $args{'struct'}; + + print "\n\n.. c:type:: " . $name . "\n\n"; + print_lineno($declaration_start_line); + $lineprefix =3D " "; + output_highlight_rst($args{'purpose'}); + print "\n"; + + print "**Definition**\n\n"; + print "::\n\n"; + my $declaration =3D $args{'definition'}; + $declaration =3D~ s/\t/ /g; + print " " . $args{'type'} . " " . $args{'struct'} . " {\n$declaration= };\n\n"; + + print "**Members**\n\n"; + $lineprefix =3D " "; + foreach $parameter (@{$args{'parameterlist'}}) { + ($parameter =3D~ /^#/) && next; + + my $parameter_name =3D $parameter; + $parameter_name =3D~ s/\[.*//; + + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; + $type =3D $args{'parametertypes'}{$parameter}; + print_lineno($parameterdesc_start_lines{$parameter_name}); + print "``" . $parameter . "``\n"; + output_highlight_rst($args{'parameterdescs'}{$parameter_name}); + print "\n"; + } + print "\n"; + + $lineprefix =3D $oldprefix; + output_section_rst(@_); +} + +## none mode output functions + +sub output_function_none(%) { +} + +sub output_enum_none(%) { +} + +sub output_typedef_none(%) { +} + +sub output_struct_none(%) { +} + +sub output_blockhead_none(%) { +} + +## +# generic output function for all types (function, struct/union, typedef, = enum); +# calls the generated, variable output_ function name based on +# functype and output_mode +sub output_declaration { + no strict 'refs'; + my $name =3D shift; + my $functype =3D shift; + my $func =3D "output_${functype}_$output_mode"; + if (($output_selection =3D=3D OUTPUT_ALL) || + (($output_selection =3D=3D OUTPUT_INCLUDE || + $output_selection =3D=3D OUTPUT_EXPORTED) && + defined($function_table{$name})) || + (($output_selection =3D=3D OUTPUT_EXCLUDE || + $output_selection =3D=3D OUTPUT_INTERNAL) && + !($functype eq "function" && defined($function_table{$name})))) + { + &$func(@_); + $section_counter++; + } +} + +## +# generic output function - calls the right one based on current output mo= de. +sub output_blockhead { + no strict 'refs'; + my $func =3D "output_blockhead_" . $output_mode; + &$func(@_); + $section_counter++; +} + +## +# takes a declaration (struct, union, enum, typedef) and +# invokes the right handler. NOT called for functions. +sub dump_declaration($$) { + no strict 'refs'; + my ($prototype, $file) =3D @_; + my $func =3D "dump_" . $decl_type; + &$func(@_); +} + +sub dump_union($$) { + dump_struct(@_); +} + +sub dump_struct($$) { + my $x =3D shift; + my $file =3D shift; + + if ($x =3D~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|= __attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) { + my $decl_type =3D $1; + $declaration_name =3D $2; + my $members =3D $3; + + # ignore members marked private: + $members =3D~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi; + $members =3D~ s/\/\*\s*private:.*//gosi; + # strip comments: + $members =3D~ s/\/\*.*?\*\///gos; + # strip attributes + $members =3D~ s/\s*__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)//gi; + $members =3D~ s/\s*__aligned\s*\([^;]*\)//gos; + $members =3D~ s/\s*__packed\s*//gos; + $members =3D~ s/\s*CRYPTO_MINALIGN_ATTR//gos; + # replace DECLARE_BITMAP + $members =3D~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $= 1\[BITS_TO_LONGS($2)\]/gos; + # replace DECLARE_HASHTABLE + $members =3D~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned lon= g $1\[1 << (($2) - 1)\]/gos; + # replace DECLARE_KFIFO + $members =3D~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \= *$1/gos; + # replace DECLARE_KFIFO_PTR + $members =3D~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos; + + my $declaration =3D $members; + + # Split nested struct/union elements as newer ones + while ($members =3D~ m/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*= )\;/) { + my $newmember; + my $maintype =3D $1; + my $ids =3D $4; + my $content =3D $3; + foreach my $id(split /,/, $ids) { + $newmember .=3D "$maintype $id; "; + + $id =3D~ s/[:\[].*//; + $id =3D~ s/^\s*\**(\S+)\s*/$1/; + foreach my $arg (split /;/, $content) { + next if ($arg =3D~ m/^\s*$/); + if ($arg =3D~ m/^([^\(]+\(\*?\s*)([\w\.]*)(\s*\).*)/) { + # pointer-to-function + my $type =3D $1; + my $name =3D $2; + my $extra =3D $3; + next if (!$name); + if ($id =3D~ m/^\s*$/) { + # anonymous struct/union + $newmember .=3D "$type$name$extra; "; + } else { + $newmember .=3D "$type$id.$name$extra; "; + } + } else { + my $type; + my $names; + $arg =3D~ s/^\s+//; + $arg =3D~ s/\s+$//; + # Handle bitmaps + $arg =3D~ s/:\s*\d+\s*//g; + # Handle arrays + $arg =3D~ s/\[.*\]//g; + # The type may have multiple words, + # and multiple IDs can be defined, like: + # const struct foo, *bar, foobar + # So, we remove spaces when parsing the + # names, in order to match just names + # and commas for the names + $arg =3D~ s/\s*,\s*/,/g; + if ($arg =3D~ m/(.*)\s+([\S+,]+)/) { + $type =3D $1; + $names =3D $2; + } else { + $newmember .=3D "$arg; "; + next; + } + foreach my $name (split /,/, $names) { + $name =3D~ s/^\s*\**(\S+)\s*/$1/; + next if (($name =3D~ m/^\s*$/)); + if ($id =3D~ m/^\s*$/) { + # anonymous struct/union + $newmember .=3D "$type $name; "; + } else { + $newmember .=3D "$type $id.$name; "; + } + } + } + } + } + $members =3D~ s/(struct|union)([^\{\};]+)\{([^\{\}]*)\}([^\{\}\;]*)\;/$n= ewmember/; + } + + # Ignore other nested elements, like enums + $members =3D~ s/(\{[^\{\}]*\})//g; + + create_parameterlist($members, ';', $file, $declaration_name); + check_sections($file, $declaration_name, $decl_type, $sectcheck, $struct_= actual); + + # Adjust declaration for better display + $declaration =3D~ s/([\{;])/$1\n/g; + $declaration =3D~ s/\}\s+;/};/g; + # Better handle inlined enums + do {} while ($declaration =3D~ s/(enum\s+\{[^\}]+),([^\n])/$1,\n$2/); + + my @def_args =3D split /\n/, $declaration; + my $level =3D 1; + $declaration =3D ""; + foreach my $clause (@def_args) { + $clause =3D~ s/^\s+//; + $clause =3D~ s/\s+$//; + $clause =3D~ s/\s+/ /; + next if (!$clause); + $level-- if ($clause =3D~ m/(\})/ && $level > 1); + if (!($clause =3D~ m/^\s*#/)) { + $declaration .=3D "\t" x $level; + } + $declaration .=3D "\t" . $clause . "\n"; + $level++ if ($clause =3D~ m/(\{)/ && !($clause =3D~m/\}/)); + } + output_declaration($declaration_name, + 'struct', + {'struct' =3D> $declaration_name, + 'module' =3D> $modulename, + 'definition' =3D> $declaration, + 'parameterlist' =3D> \@parameterlist, + 'parameterdescs' =3D> \%parameterdescs, + 'parametertypes' =3D> \%parametertypes, + 'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'purpose' =3D> $declaration_purpose, + 'type' =3D> $decl_type + }); + } + else { + print STDERR "${file}:$.: error: Cannot parse struct or union!\n"; + ++$errors; + } +} + + +sub show_warnings($$) { + my $functype =3D shift; + my $name =3D shift; + + return 1 if ($output_selection =3D=3D OUTPUT_ALL); + + if ($output_selection =3D=3D OUTPUT_EXPORTED) { + if (defined($function_table{$name})) { + return 1; + } else { + return 0; + } + } + if ($output_selection =3D=3D OUTPUT_INTERNAL) { + if (!($functype eq "function" && defined($function_table{$name}))) { + return 1; + } else { + return 0; + } + } + if ($output_selection =3D=3D OUTPUT_INCLUDE) { + if (defined($function_table{$name})) { + return 1; + } else { + return 0; + } + } + if ($output_selection =3D=3D OUTPUT_EXCLUDE) { + if (!defined($function_table{$name})) { + return 1; + } else { + return 0; + } + } + die("Please add the new output type at show_warnings()"); +} + +sub dump_enum($$) { + my $x =3D shift; + my $file =3D shift; + + $x =3D~ s@/\*.*?\*/@@gos; # strip comments. + # strip #define macros inside enums + $x =3D~ s@#\s*((define|ifdef)\s+|endif)[^;]*;@@gos; + + if ($x =3D~ /enum\s+(\w*)\s*\{(.*)\}/) { + $declaration_name =3D $1; + my $members =3D $2; + my %_members; + + $members =3D~ s/\s+$//; + + foreach my $arg (split ',', $members) { + $arg =3D~ s/^\s*(\w+).*/$1/; + push @parameterlist, $arg; + if (!$parameterdescs{$arg}) { + $parameterdescs{$arg} =3D $undescribed; + if (show_warnings("enum", $declaration_name)) { + print STDERR "${file}:$.: warning: Enum value '$arg' not described in e= num '$declaration_name'\n"; + } + } + $_members{$arg} =3D 1; + } + + while (my ($k, $v) =3D each %parameterdescs) { + if (!exists($_members{$k})) { + if (show_warnings("enum", $declaration_name)) { + print STDERR "${file}:$.: warning: Excess enum value '$k' descripti= on in '$declaration_name'\n"; + } + } + } + + output_declaration($declaration_name, + 'enum', + {'enum' =3D> $declaration_name, + 'module' =3D> $modulename, + 'parameterlist' =3D> \@parameterlist, + 'parameterdescs' =3D> \%parameterdescs, + 'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'purpose' =3D> $declaration_purpose + }); + } + else { + print STDERR "${file}:$.: error: Cannot parse enum!\n"; + ++$errors; + } +} + +sub dump_typedef($$) { + my $x =3D shift; + my $file =3D shift; + + $x =3D~ s@/\*.*?\*/@@gos; # strip comments. + + # Parse function prototypes + if ($x =3D~ /typedef\s+(\w+)\s*\(\*\s*(\w\S+)\s*\)\s*\((.*)\);/ || + $x =3D~ /typedef\s+(\w+)\s*(\w\S+)\s*\s*\((.*)\);/) { + + # Function typedefs + $return_type =3D $1; + $declaration_name =3D $2; + my $args =3D $3; + + create_parameterlist($args, ',', $file, $declaration_name); + + output_declaration($declaration_name, + 'function', + {'function' =3D> $declaration_name, + 'typedef' =3D> 1, + 'module' =3D> $modulename, + 'functiontype' =3D> $return_type, + 'parameterlist' =3D> \@parameterlist, + 'parameterdescs' =3D> \%parameterdescs, + 'parametertypes' =3D> \%parametertypes, + 'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'purpose' =3D> $declaration_purpose + }); + return; + } + + while (($x =3D~ /\(*.\)\s*;$/) || ($x =3D~ /\[*.\]\s*;$/)) { + $x =3D~ s/\(*.\)\s*;$/;/; + $x =3D~ s/\[*.\]\s*;$/;/; + } + + if ($x =3D~ /typedef.*\s+(\w+)\s*;/) { + $declaration_name =3D $1; + + output_declaration($declaration_name, + 'typedef', + {'typedef' =3D> $declaration_name, + 'module' =3D> $modulename, + 'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'purpose' =3D> $declaration_purpose + }); + } + else { + print STDERR "${file}:$.: error: Cannot parse typedef!\n"; + ++$errors; + } +} + +sub save_struct_actual($) { + my $actual =3D shift; + + # strip all spaces from the actual param so that it looks like one str= ing item + $actual =3D~ s/\s*//g; + $struct_actual =3D $struct_actual . $actual . " "; +} + +sub create_parameterlist($$$$) { + my $args =3D shift; + my $splitter =3D shift; + my $file =3D shift; + my $declaration_name =3D shift; + my $type; + my $param; + + # temporarily replace commas inside function pointer definition + while ($args =3D~ /(\([^\),]+),/) { + $args =3D~ s/(\([^\),]+),/$1#/g; + } + + foreach my $arg (split($splitter, $args)) { + # strip comments + $arg =3D~ s/\/\*.*\*\///; + # strip leading/trailing spaces + $arg =3D~ s/^\s*//; + $arg =3D~ s/\s*$//; + $arg =3D~ s/\s+/ /; + + if ($arg =3D~ /^#/) { + # Treat preprocessor directive as a typeless variable just to fill + # corresponding data structures "correctly". Catch it later in + # output_* subs. + push_parameter($arg, "", $file); + } elsif ($arg =3D~ m/\(.+\)\s*\(/) { + # pointer-to-function + $arg =3D~ tr/#/,/; + $arg =3D~ m/[^\(]+\(\*?\s*([\w\.]*)\s*\)/; + $param =3D $1; + $type =3D $arg; + $type =3D~ s/([^\(]+\(\*?)\s*$param/$1/; + save_struct_actual($param); + push_parameter($param, $type, $file, $declaration_name); + } elsif ($arg) { + $arg =3D~ s/\s*:\s*/:/g; + $arg =3D~ s/\s*\[/\[/g; + + my @args =3D split('\s*,\s*', $arg); + if ($args[0] =3D~ m/\*/) { + $args[0] =3D~ s/(\*+)\s*/ $1/; + } + + my @first_arg; + if ($args[0] =3D~ /^(.*\s+)(.*?\[.*\].*)$/) { + shift @args; + push(@first_arg, split('\s+', $1)); + push(@first_arg, $2); + } else { + @first_arg =3D split('\s+', shift @args); + } + + unshift(@args, pop @first_arg); + $type =3D join " ", @first_arg; + + foreach $param (@args) { + if ($param =3D~ m/^(\*+)\s*(.*)/) { + save_struct_actual($2); + push_parameter($2, "$type $1", $file, $declaration_name); + } + elsif ($param =3D~ m/(.*?):(\d+)/) { + if ($type ne "") { # skip unnamed bit-fields + save_struct_actual($1); + push_parameter($1, "$type:$2", $file, $declaration_name) + } + } + else { + save_struct_actual($param); + push_parameter($param, $type, $file, $declaration_name); + } + } + } + } +} + +sub push_parameter($$$$) { + my $param =3D shift; + my $type =3D shift; + my $file =3D shift; + my $declaration_name =3D shift; + + if (($anon_struct_union =3D=3D 1) && ($type eq "") && + ($param eq "}")) { + return; # ignore the ending }; from anon. struct/union + } + + $anon_struct_union =3D 0; + $param =3D~ s/[\[\)].*//; + + if ($type eq "" && $param =3D~ /\.\.\.$/) + { + if (!$param =3D~ /\w\.\.\.$/) { + # handles unnamed variable parameters + $param =3D "..."; + } + if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq ""= ) { + $parameterdescs{$param} =3D "variable arguments"; + } + } + elsif ($type eq "" && ($param eq "" or $param eq "void")) + { + $param=3D"void"; + $parameterdescs{void} =3D "no arguments"; + } + elsif ($type eq "" && ($param eq "struct" or $param eq "union")) + # handle unnamed (anonymous) union or struct: + { + $type =3D $param; + $param =3D "{unnamed_" . $param . "}"; + $parameterdescs{$param} =3D "anonymous\n"; + $anon_struct_union =3D 1; + } + + # warn if parameter has no description + # (but ignore ones starting with # as these are not parameters + # but inline preprocessor statements); + # Note: It will also ignore void params and unnamed structs/unions + if (!defined $parameterdescs{$param} && $param !~ /^#/) { + $parameterdescs{$param} =3D $undescribed; + + if (show_warnings($type, $declaration_name) && $param !~ /\./) { + print STDERR + "${file}:$.: warning: Function parameter or member '$param' not d= escribed in '$declaration_name'\n"; + ++$warnings; + } + } + + # strip spaces from $param so that it is one continuous string + # on @parameterlist; + # this fixes a problem where check_sections() cannot find + # a parameter like "addr[6 + 2]" because it actually appears + # as "addr[6", "+", "2]" on the parameter list; + # but it's better to maintain the param string unchanged for output, + # so just weaken the string compare in check_sections() to ignore + # "[blah" in a parameter string; + ###$param =3D~ s/\s*//g; + push @parameterlist, $param; + $type =3D~ s/\s\s+/ /g; + $parametertypes{$param} =3D $type; +} + +sub check_sections($$$$$) { + my ($file, $decl_name, $decl_type, $sectcheck, $prmscheck) =3D @_; + my @sects =3D split ' ', $sectcheck; + my @prms =3D split ' ', $prmscheck; + my $err; + my ($px, $sx); + my $prm_clean; # strip trailing "[array size]" and/or beginning "*" + + foreach $sx (0 .. $#sects) { + $err =3D 1; + foreach $px (0 .. $#prms) { + $prm_clean =3D $prms[$px]; + $prm_clean =3D~ s/\[.*\]//; + $prm_clean =3D~ s/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i; + # ignore array size in a parameter string; + # however, the original param string may contain + # spaces, e.g.: addr[6 + 2] + # and this appears in @prms as "addr[6" since the + # parameter list is split at spaces; + # hence just ignore "[..." for the sections check; + $prm_clean =3D~ s/\[.*//; + + ##$prm_clean =3D~ s/^\**//; + if ($prm_clean eq $sects[$sx]) { + $err =3D 0; + last; + } + } + if ($err) { + if ($decl_type eq "function") { + print STDERR "${file}:$.: warning: " . + "Excess function parameter " . + "'$sects[$sx]' " . + "description in '$decl_name'\n"; + ++$warnings; + } + } + } +} + +## +# Checks the section describing the return value of a function. +sub check_return_section { + my $file =3D shift; + my $declaration_name =3D shift; + my $return_type =3D shift; + + # Ignore an empty return type (It's a macro) + # Ignore functions with a "void" return type. (But don't ignore "v= oid *") + if (($return_type eq "") || ($return_type =3D~ /void\s*\w*\s*$/)) { + return; + } + + if (!defined($sections{$section_return}) || + $sections{$section_return} eq "") { + print STDERR "${file}:$.: warning: " . + "No description found for return value of " . + "'$declaration_name'\n"; + ++$warnings; + } +} + +## +# takes a function prototype and the name of the current file being +# processed and spits out all the details stored in the global +# arrays/hashes. +sub dump_function($$) { + my $prototype =3D shift; + my $file =3D shift; + my $noret =3D 0; + + $prototype =3D~ s/^static +//; + $prototype =3D~ s/^extern +//; + $prototype =3D~ s/^asmlinkage +//; + $prototype =3D~ s/^inline +//; + $prototype =3D~ s/^__inline__ +//; + $prototype =3D~ s/^__inline +//; + $prototype =3D~ s/^__always_inline +//; + $prototype =3D~ s/^noinline +//; + $prototype =3D~ s/__init +//; + $prototype =3D~ s/__init_or_module +//; + $prototype =3D~ s/__meminit +//; + $prototype =3D~ s/__must_check +//; + $prototype =3D~ s/__weak +//; + $prototype =3D~ s/__sched +//; + $prototype =3D~ s/__printf\s*\(\s*\d*\s*,\s*\d*\s*\) +//; + my $define =3D $prototype =3D~ s/^#\s*define\s+//; #ak added + $prototype =3D~ s/__attribute__\s*\(\( + (?: + [\w\s]++ # attribute name + (?:\([^)]*+\))? # attribute arguments + \s*+,? # optional comma at the end + )+ + \)\)\s+//x; + + # Yes, this truly is vile. We are looking for: + # 1. Return type (may be nothing if we're looking at a macro) + # 2. Function name + # 3. Function parameters. + # + # All the while we have to watch out for function pointer parameters + # (which IIRC is what the two sections are for), C types (these + # regexps don't even start to express all the possibilities), and + # so on. + # + # If you mess with these regexps, it's a good idea to check that + # the following functions' documentation still comes out right: + # - parport_register_device (function pointer parameters) + # - atomic_set (macro) + # - pci_match_device, __copy_to_user (long return type) + + if ($define && $prototype =3D~ m/^()([a-zA-Z0-9_~:]+)\s+/) { + # This is an object-like macro, it has no return type and no param= eter + # list. + # Function-like macros are not allowed to have spaces between + # declaration_name and opening parenthesis (notice the \s+). + $return_type =3D $1; + $declaration_name =3D $2; + $noret =3D 1; + } elsif ($prototype =3D~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =3D~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =3D~ m/^(\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =3D~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ || + $prototype =3D~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ = || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\(]*)\)/ = || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\(]= *)\)/ || + $prototype =3D~ m/^()([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =3D~ m/^(\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =3D~ m/^(\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =3D~ m/^(\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ || + $prototype =3D~ m/^(\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ = || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]*)\)/ = || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(([^\{]= *)\)/ || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+\s+\w+)\s+([a-zA-Z0-9_~:]+)\s*\(([^\{]= *)\)/ || + $prototype =3D~ m/^(\w+\s+\w+\s+\w+\s+\w+\s*\*+)\s*([a-zA-Z0-9_~:]+)\s*\(= ([^\{]*)\)/ || + $prototype =3D~ m/^(\w+\s+\w+\s*\*+\s*\w+\s*\*+\s*)\s*([a-zA-Z0-9_~:]+)\s= *\(([^\{]*)\)/) { + $return_type =3D $1; + $declaration_name =3D $2; + my $args =3D $3; + + create_parameterlist($args, ',', $file, $declaration_name); + } else { + print STDERR "${file}:$.: warning: cannot understand function prototype: = '$prototype'\n"; + return; + } + + my $prms =3D join " ", @parameterlist; + check_sections($file, $declaration_name, "function", $sectcheck, $prms); + + # This check emits a lot of warnings at the moment, because many + # functions don't have a 'Return' doc section. So until the number + # of warnings goes sufficiently down, the check is only performed = in + # verbose mode. + # TODO: always perform the check. + if ($verbose && !$noret) { + check_return_section($file, $declaration_name, $return_typ= e); + } + + output_declaration($declaration_name, + 'function', + {'function' =3D> $declaration_name, + 'module' =3D> $modulename, + 'functiontype' =3D> $return_type, + 'parameterlist' =3D> \@parameterlist, + 'parameterdescs' =3D> \%parameterdescs, + 'parametertypes' =3D> \%parametertypes, + 'sectionlist' =3D> \@sectionlist, + 'sections' =3D> \%sections, + 'purpose' =3D> $declaration_purpose + }); +} + +sub reset_state { + $function =3D ""; + %parameterdescs =3D (); + %parametertypes =3D (); + @parameterlist =3D (); + %sections =3D (); + @sectionlist =3D (); + $sectcheck =3D ""; + $struct_actual =3D ""; + $prototype =3D ""; + + $state =3D STATE_NORMAL; + $inline_doc_state =3D STATE_INLINE_NA; +} + +sub tracepoint_munge($) { + my $file =3D shift; + my $tracepointname =3D 0; + my $tracepointargs =3D 0; + + if ($prototype =3D~ m/TRACE_EVENT\((.*?),/) { + $tracepointname =3D $1; + } + if ($prototype =3D~ m/DEFINE_SINGLE_EVENT\((.*?),/) { + $tracepointname =3D $1; + } + if ($prototype =3D~ m/DEFINE_EVENT\((.*?),(.*?),/) { + $tracepointname =3D $2; + } + $tracepointname =3D~ s/^\s+//; #strip leading whitespace + if ($prototype =3D~ m/TP_PROTO\((.*?)\)/) { + $tracepointargs =3D $1; + } + if (($tracepointname eq 0) || ($tracepointargs eq 0)) { + print STDERR "${file}:$.: warning: Unrecognized tracepoint format: \n". + "$prototype\n"; + } else { + $prototype =3D "static inline void trace_$tracepointname($tracepointargs= )"; + } +} + +sub syscall_munge() { + my $void =3D 0; + + $prototype =3D~ s@[\r\n]+@ @gos; # strip newlines/CR's +## if ($prototype =3D~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { + if ($prototype =3D~ m/SYSCALL_DEFINE0/) { + $void =3D 1; +## $prototype =3D "long sys_$1(void)"; + } + + $prototype =3D~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func= name + if ($prototype =3D~ m/long (sys_.*?),/) { + $prototype =3D~ s/,/\(/; + } elsif ($void) { + $prototype =3D~ s/\)/\(void\)/; + } + + # now delete all of the odd-number commas in $prototype + # so that arg types & arg names don't have a comma between them + my $count =3D 0; + my $len =3D length($prototype); + if ($void) { + $len =3D 0; # skip the for-loop + } + for (my $ix =3D 0; $ix < $len; $ix++) { + if (substr($prototype, $ix, 1) eq ',') { + $count++; + if ($count % 2 =3D=3D 1) { + substr($prototype, $ix, 1) =3D ' '; + } + } + } +} + +sub process_proto_function($$) { + my $x =3D shift; + my $file =3D shift; + + $x =3D~ s@\/\/.*$@@gos; # strip C99-style comments to end of line + + if ($x =3D~ m#\s*/\*\s+MACDOC\s*#io || ($x =3D~ /^#/ && $x !~ /^#\s*de= fine/)) { + # do nothing + } + elsif ($x =3D~ /([^\{]*)/) { + $prototype .=3D $1; + } + + if (($x =3D~ /\{/) || ($x =3D~ /\#\s*define/) || ($x =3D~ /;/)) { + $prototype =3D~ s@/\*.*?\*/@@gos; # strip comments. + $prototype =3D~ s@[\r\n]+@ @gos; # strip newlines/cr's. + $prototype =3D~ s@^\s+@@gos; # strip leading spaces + if ($prototype =3D~ /SYSCALL_DEFINE/) { + syscall_munge(); + } + if ($prototype =3D~ /TRACE_EVENT/ || $prototype =3D~ /DEFINE_EVENT/ || + $prototype =3D~ /DEFINE_SINGLE_EVENT/) + { + tracepoint_munge($file); + } + dump_function($prototype, $file); + reset_state(); + } +} + +sub process_proto_type($$) { + my $x =3D shift; + my $file =3D shift; + + $x =3D~ s@[\r\n]+@ @gos; # strip newlines/cr's. + $x =3D~ s@^\s+@@gos; # strip leading spaces + $x =3D~ s@\s+$@@gos; # strip trailing spaces + $x =3D~ s@\/\/.*$@@gos; # strip C99-style comments to end of line + + if ($x =3D~ /^#/) { + # To distinguish preprocessor directive from regular declaration later. + $x .=3D ";"; + } + + while (1) { + if ( $x =3D~ /([^\{\};]*)([\{\};])(.*)/ ) { + if( length $prototype ) { + $prototype .=3D " " + } + $prototype .=3D $1 . $2; + ($2 eq '{') && $brcount++; + ($2 eq '}') && $brcount--; + if (($2 eq ';') && ($brcount =3D=3D 0)) { + dump_declaration($prototype, $file); + reset_state(); + last; + } + $x =3D $3; + } else { + $prototype .=3D $x; + last; + } + } +} + + +sub map_filename($) { + my $file; + my ($orig_file) =3D @_; + + if (defined($ENV{'SRCTREE'})) { + $file =3D "$ENV{'SRCTREE'}" . "/" . $orig_file; + } else { + $file =3D $orig_file; + } + + if (defined($source_map{$file})) { + $file =3D $source_map{$file}; + } + + return $file; +} + +sub process_export_file($) { + my ($orig_file) =3D @_; + my $file =3D map_filename($orig_file); + + if (!open(IN,"<$file")) { + print STDERR "Error: Cannot open file $file\n"; + ++$errors; + return; + } + + while () { + if (/$export_symbol/) { + $function_table{$2} =3D 1; + } + } + + close(IN); +} + +# +# Parsers for the various processing states. +# +# STATE_NORMAL: looking for the /** to begin everything. +# +sub process_normal() { + if (/$doc_start/o) { + $state =3D STATE_NAME; # next line is always the function name + $in_doc_sect =3D 0; + $declaration_start_line =3D $. + 1; + } +} + +# +# STATE_NAME: Looking for the "name - description" line +# +sub process_name($$) { + my $file =3D shift; + my $identifier; + my $descr; + + if (/$doc_block/o) { + $state =3D STATE_DOCBLOCK; + $contents =3D ""; + $new_start_line =3D $. + 1; + + if ( $1 eq "" ) { + $section =3D $section_intro; + } else { + $section =3D $1; + } + } + elsif (/$doc_decl/o) { + $identifier =3D $1; + if (/\s*([\w\s]+?)(\(\))?\s*-/) { + $identifier =3D $1; + } + + $state =3D STATE_BODY; + # if there's no @param blocks need to set up default section + # here + $contents =3D ""; + $section =3D $section_default; + $new_start_line =3D $. + 1; + if (/-(.*)/) { + # strip leading/trailing/multiple spaces + $descr=3D $1; + $descr =3D~ s/^\s*//; + $descr =3D~ s/\s*$//; + $descr =3D~ s/\s+/ /g; + $declaration_purpose =3D $descr; + $state =3D STATE_BODY_MAYBE; + } else { + $declaration_purpose =3D ""; + } + + if (($declaration_purpose eq "") && $verbose) { + print STDERR "${file}:$.: warning: missing initial short description = on line:\n"; + print STDERR $_; + ++$warnings; + } + + if ($identifier =3D~ m/^struct\b/) { + $decl_type =3D 'struct'; + } elsif ($identifier =3D~ m/^union\b/) { + $decl_type =3D 'union'; + } elsif ($identifier =3D~ m/^enum\b/) { + $decl_type =3D 'enum'; + } elsif ($identifier =3D~ m/^typedef\b/) { + $decl_type =3D 'typedef'; + } else { + $decl_type =3D 'function'; + } + + if ($verbose) { + print STDERR "${file}:$.: info: Scanning doc for $identifier\n"; + } + } else { + print STDERR "${file}:$.: warning: Cannot understand $_ on line $.", + " - I thought it was a doc line\n"; + ++$warnings; + $state =3D STATE_NORMAL; + } +} + + +# +# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment. +# +sub process_body($$) { + my $file =3D shift; + + if (/$doc_sect/i) { # case insensitive for supported section names + $newsection =3D $1; + $newcontents =3D $2; + + # map the supported section names to the canonical names + if ($newsection =3D~ m/^description$/i) { + $newsection =3D $section_default; + } elsif ($newsection =3D~ m/^context$/i) { + $newsection =3D $section_context; + } elsif ($newsection =3D~ m/^returns?$/i) { + $newsection =3D $section_return; + } elsif ($newsection =3D~ m/^\@return$/) { + # special: @return is a section, not a param description + $newsection =3D $section_return; + } + + if (($contents ne "") && ($contents ne "\n")) { + if (!$in_doc_sect && $verbose) { + print STDERR "${file}:$.: warning: contents before sections\n"; + ++$warnings; + } + dump_section($file, $section, $contents); + $section =3D $section_default; + } + + $in_doc_sect =3D 1; + $state =3D STATE_BODY; + $contents =3D $newcontents; + $new_start_line =3D $.; + while (substr($contents, 0, 1) eq " ") { + $contents =3D substr($contents, 1); + } + if ($contents ne "") { + $contents .=3D "\n"; + } + $section =3D $newsection; + $leading_space =3D undef; + } elsif (/$doc_end/) { + if (($contents ne "") && ($contents ne "\n")) { + dump_section($file, $section, $contents); + $section =3D $section_default; + $contents =3D ""; + } + # look for doc_com + + doc_end: + if ($_ =3D~ m'\s*\*\s*[a-zA-Z_0-9:\.]+\*/') { + print STDERR "${file}:$.: warning: suspicious ending line: $_"; + ++$warnings; + } + + $prototype =3D ""; + $state =3D STATE_PROTO; + $brcount =3D 0; + } elsif (/$doc_content/) { + # miguel-style comment kludge, look for blank lines after + # @parameter line to signify start of description + if ($1 eq "") { + if ($section =3D~ m/^@/ || $section eq $section_context) { + dump_section($file, $section, $contents); + $section =3D $section_default; + $contents =3D ""; + $new_start_line =3D $.; + } else { + $contents .=3D "\n"; + } + $state =3D STATE_BODY; + } elsif ($state =3D=3D STATE_BODY_MAYBE) { + # Continued declaration purpose + chomp($declaration_purpose); + $declaration_purpose .=3D " " . $1; + $declaration_purpose =3D~ s/\s+/ /g; + } else { + my $cont =3D $1; + if ($section =3D~ m/^@/ || $section eq $section_context) { + if (!defined $leading_space) { + if ($cont =3D~ m/^(\s+)/) { + $leading_space =3D $1; + } else { + $leading_space =3D ""; + } + } + $cont =3D~ s/^$leading_space//; + } + $contents .=3D $cont . "\n"; + } + } else { + # i dont know - bad line? ignore. + print STDERR "${file}:$.: warning: bad line: $_"; + ++$warnings; + } +} + + +# +# STATE_PROTO: reading a function/whatever prototype. +# +sub process_proto($$) { + my $file =3D shift; + + if (/$doc_inline_oneline/) { + $section =3D $1; + $contents =3D $2; + if ($contents ne "") { + $contents .=3D "\n"; + dump_section($file, $section, $contents); + $section =3D $section_default; + $contents =3D ""; + } + } elsif (/$doc_inline_start/) { + $state =3D STATE_INLINE; + $inline_doc_state =3D STATE_INLINE_NAME; + } elsif ($decl_type eq 'function') { + process_proto_function($_, $file); + } else { + process_proto_type($_, $file); + } +} + +# +# STATE_DOCBLOCK: within a DOC: block. +# +sub process_docblock($$) { + my $file =3D shift; + + if (/$doc_end/) { + dump_doc_section($file, $section, $contents); + $section =3D $section_default; + $contents =3D ""; + $function =3D ""; + %parameterdescs =3D (); + %parametertypes =3D (); + @parameterlist =3D (); + %sections =3D (); + @sectionlist =3D (); + $prototype =3D ""; + $state =3D STATE_NORMAL; + } elsif (/$doc_content/) { + if ( $1 eq "" ) { + $contents .=3D $blankline; + } else { + $contents .=3D $1 . "\n"; + } + } +} + +# +# STATE_INLINE: docbook comments within a prototype. +# +sub process_inline($$) { + my $file =3D shift; + + # First line (state 1) needs to be a @parameter + if ($inline_doc_state =3D=3D STATE_INLINE_NAME && /$doc_inline_sect/o)= { + $section =3D $1; + $contents =3D $2; + $new_start_line =3D $.; + if ($contents ne "") { + while (substr($contents, 0, 1) eq " ") { + $contents =3D substr($contents, 1); + } + $contents .=3D "\n"; + } + $inline_doc_state =3D STATE_INLINE_TEXT; + # Documentation block end */ + } elsif (/$doc_inline_end/) { + if (($contents ne "") && ($contents ne "\n")) { + dump_section($file, $section, $contents); + $section =3D $section_default; + $contents =3D ""; + } + $state =3D STATE_PROTO; + $inline_doc_state =3D STATE_INLINE_NA; + # Regular text + } elsif (/$doc_content/) { + if ($inline_doc_state =3D=3D STATE_INLINE_TEXT) { + $contents .=3D $1 . "\n"; + # nuke leading blank lines + if ($contents =3D~ /^\s*$/) { + $contents =3D ""; + } + } elsif ($inline_doc_state =3D=3D STATE_INLINE_NAME) { + $inline_doc_state =3D STATE_INLINE_ERROR; + print STDERR "${file}:$.: warning: "; + print STDERR "Incorrect use of kernel-doc format: $_"; + ++$warnings; + } + } +} + + +sub process_file($) { + my $file; + my $initial_section_counter =3D $section_counter; + my ($orig_file) =3D @_; + + $file =3D map_filename($orig_file); + + if (!open(IN,"<$file")) { + print STDERR "Error: Cannot open file $file\n"; + ++$errors; + return; + } + + $. =3D 1; + + $section_counter =3D 0; + while () { + while (s/\\\s*$//) { + $_ .=3D ; + } + # Replace tabs by spaces + while ($_ =3D~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; + # Hand this line to the appropriate state handler + if ($state =3D=3D STATE_NORMAL) { + process_normal(); + } elsif ($state =3D=3D STATE_NAME) { + process_name($file, $_); + } elsif ($state =3D=3D STATE_BODY || $state =3D=3D STATE_BODY_MAYBE) { + process_body($file, $_); + } elsif ($state =3D=3D STATE_INLINE) { # scanning for inline parameters + process_inline($file, $_); + } elsif ($state =3D=3D STATE_PROTO) { + process_proto($file, $_); + } elsif ($state =3D=3D STATE_DOCBLOCK) { + process_docblock($file, $_); + } + } + + # Make sure we got something interesting. + if ($initial_section_counter =3D=3D $section_counter && $ + output_mode ne "none") { + if ($output_selection =3D=3D OUTPUT_INCLUDE) { + print STDERR "${file}:1: warning: '$_' not found\n" + for keys %function_table; + } + else { + print STDERR "${file}:1: warning: no structured comments found\n"; + } + } +} + + +$kernelversion =3D get_kernel_version(); + +# generate a sequence of code that will splice in highlighting information +# using the s// operator. +for (my $k =3D 0; $k < @highlights; $k++) { + my $pattern =3D $highlights[$k][0]; + my $result =3D $highlights[$k][1]; +# print STDERR "scanning pattern:$pattern, highlight:($result)\n"; + $dohighlight .=3D "\$contents =3D~ s:$pattern:$result:gs;\n"; +} + +# Read the file that maps relative names to absolute names for +# separate source and object directories and for shadow trees. +if (open(SOURCE_MAP, "<.tmp_filelist.txt")) { + my ($relname, $absname); + while() { + chop(); + ($relname, $absname) =3D (split())[0..1]; + $relname =3D~ s:^/+::; + $source_map{$relname} =3D $absname; + } + close(SOURCE_MAP); +} + +if ($output_selection =3D=3D OUTPUT_EXPORTED || + $output_selection =3D=3D OUTPUT_INTERNAL) { + + push(@export_file_list, @ARGV); + + foreach (@export_file_list) { + chomp; + process_export_file($_); + } +} + +foreach (@ARGV) { + chomp; + process_file($_); +} +if ($verbose && $errors) { + print STDERR "$errors errors\n"; +} +if ($verbose && $warnings) { + print STDERR "$warnings warnings\n"; +} + +exit($output_mode eq "none" ? 0 : $errors); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673458; cv=none; d=zohomail.com; s=zohoarc; b=XVCSZU8UD/yDHLStErC8iCWqdq+o30nJ7A3kjxAdC3Q9H0HVAHcqOkK/Q7iQhEHktEKixW2exXukD9RIQDDGmL3CdN3oJ/P2Qjj7PxyhOGle6hDGcKvWIWQ0Mg/hX3zPOgmRzVePC9uJCDNrWJLpJHxVT8cGiLXdjuuYoU9YQ4c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673458; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=KB33/P7pdd5zyToITAll1MNS1ualBhVbh7OSCHIhH1g=; b=XTrSL//Q2Te46Ob7/cG1owN0bbmDJr8JzdWTZM9pxU+v4nkhYboc+VZTDXdOe6LZnjHYokf1jvMpW2WWnJzd2kHT1zDDE5rT32ZTT+AM0e8h8xyJ8XtoxQsHYSNVaP97OdHBZzcWu6D/AZYWnxASoU+p42NPGUASILkGJl2uf6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673458942239.2698003374975; Wed, 18 Dec 2019 04:50:58 -0800 (PST) Received: from localhost ([::1]:53748 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYn3-0004Lh-Hy for importer@patchew.org; Wed, 18 Dec 2019 07:50:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55443) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3n-0007EU-2c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3l-00033o-Nd for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:10 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:52347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3l-0002zW-Em for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:09 -0500 Received: by mail-wm1-x343.google.com with SMTP id p9so1563865wmc.2 for ; Wed, 18 Dec 2019 04:04:09 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:07 -0800 (PST) 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=KB33/P7pdd5zyToITAll1MNS1ualBhVbh7OSCHIhH1g=; b=a5KkxY0GKUs696wveW2SDwo8j8SUpugFuqA5PWnurYSrKg1fPmFGrSXTNx9MXRhJNi 92ML/clLkiG6j66Xb1HsdRK0Svxl3wbgdjfGZfj6S/3ESt+6mmOfC7QvdJZ0pMFdGjL1 SrHcjuh7GaUbVqvus/XZWDun1WaXygFLXmQn1BdOy6sHBrJal1Go6ewACO8HosFGnTOR 2m/duyWLQdER82AZigpu0XVNQ7xBV+z2s2eGtnAak0Jh3LNeY6SSODxwTjEX9sTdaDVJ nKKzFTXcVNkD4idsbPfNORE/xwQQ71poGenLoSw//qxYYgaNF3Ps9GII/2U4xjrDPmt5 ECyQ== 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=KB33/P7pdd5zyToITAll1MNS1ualBhVbh7OSCHIhH1g=; b=gI18tC95cNrnPLmCfMYV0QmNLlRN9Ox9GfKwax15B7EVinN61sBdmbU4MixyA5JH8i HgJeF9GBKecqbiIYZ4GpZbSPR17MV9TiAAW6XKPM36Pk6baZ9J0sUCbWqBXvKQqZTRap 5BicvynWmmqNLRkMdRtSa5nar0xFMKqnqqQrhI8GzShqPkK+4PEqLSFrGShXtKC2SMC2 rlvzXrav5Z/XhcKDMThRa+lwi4lRgU3+Svkj0K7G3WtLkdGaA4DoTiGH+/WaUZmLNv2n YH/EcLX/EDw3w8wZnKwzG07JxAH/Ufpm7LidfTdnNjmz/nuVt5nPxgBvtO3Lz03svE/6 KZrA== X-Gm-Message-State: APjAAAUvSLrTIhda6rBm8LN25tZGV3/+7vK5EBEzknuzUD2clJ1n9veU z3IWCj0S2F//dJ0ei4aTdjkeOa/F X-Google-Smtp-Source: APXvYqzVdydMVMI3qwU86/NfcSMDBIwbXJ2bSKYBFhntj02NZmJFTnLxKeRxdvbQcPm0C5JRB/UtFw== X-Received: by 2002:a1c:7d92:: with SMTP id y140mr2641764wmc.145.1576670648148; Wed, 18 Dec 2019 04:04:08 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 65/87] docs: tweak kernel-doc for QEMU coding standards Date: Wed, 18 Dec 2019 13:02:31 +0100 Message-Id: <1576670573-48048-66-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Surprisingly, QEMU does have a pretty consistent doc comment style and it is not very different from the Linux kernel's. Of the documentation "sigils", only "#" separates the QEMU doc comment style from Linux's, and it has 200+ instances vs. 6 for the kernel's '&struct foo' (all in accel/tcg/translate-all.c), so it's clear that the two standards are different in this respect. In addition, our structs are typedefed and recognized by CamelCase names. Adjust kernel-doc's parser for these two aspects of the QEMU coding standards. The patch has been valid, with hardly any change, for over two years, so it should not be an issue to keep kernel-doc in sync with the Linux copy. Signed-off-by: Paolo Bonzini --- scripts/kernel-doc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 81dc917..af470eb 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -215,12 +215,12 @@ my $type_func =3D '(\w+)\(\)'; my $type_param =3D '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)'; my $type_fp_param =3D '\@(\w+)\(\)'; # Special RST handling for func ptr = params my $type_env =3D '(\$\w+)'; -my $type_enum =3D '\&(enum\s*([_\w]+))'; -my $type_struct =3D '\&(struct\s*([_\w]+))'; -my $type_typedef =3D '\&(typedef\s*([_\w]+))'; -my $type_union =3D '\&(union\s*([_\w]+))'; -my $type_member =3D '\&([_\w]+)(\.|->)([_\w]+)'; -my $type_fallback =3D '\&([_\w]+)'; +my $type_enum =3D '#(enum\s*([_\w]+))'; +my $type_struct =3D '#(struct\s*([_\w]+))'; +my $type_typedef =3D '#(([A-Z][_\w]*))'; +my $type_union =3D '#(union\s*([_\w]+))'; +my $type_member =3D '#([_\w]+)(\.|->)([_\w]+)'; +my $type_fallback =3D '(?!)'; # this never matches my $type_member_func =3D $type_member . '\(\)'; =20 # Output conversion substitutions. @@ -1050,6 +1050,14 @@ sub output_blockhead { sub dump_declaration($$) { no strict 'refs'; my ($prototype, $file) =3D @_; + if ($decl_type eq 'type name') { + if ($prototype =3D~ /^(enum|struct|union)\s+/) { + $decl_type =3D $1; + } else { + return; + } + } + my $func =3D "dump_" . $decl_type; &$func(@_); } @@ -1878,7 +1886,7 @@ sub process_name($$) { } elsif (/$doc_decl/o) { $identifier =3D $1; - if (/\s*([\w\s]+?)(\(\))?\s*-/) { + if (/\s*([\w\s]+?)(\s*-|:)/) { $identifier =3D $1; } =20 @@ -1888,7 +1896,7 @@ sub process_name($$) { $contents =3D ""; $section =3D $section_default; $new_start_line =3D $. + 1; - if (/-(.*)/) { + if (/[-:](.*)/) { # strip leading/trailing/multiple spaces $descr=3D $1; $descr =3D~ s/^\s*//; @@ -1906,7 +1914,9 @@ sub process_name($$) { ++$warnings; } =20 - if ($identifier =3D~ m/^struct\b/) { + if ($identifier =3D~ m/^[A-Z]/) { + $decl_type =3D 'type name'; + } elsif ($identifier =3D~ m/^struct\b/) { $decl_type =3D 'struct'; } elsif ($identifier =3D~ m/^union\b/) { $decl_type =3D 'union'; --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672577; cv=none; d=zohomail.com; s=zohoarc; b=QSFbEFWvYD4V5htg0v9nIFZQJ8maJUO/2LwWj/kiJsibJPWzzpl5RFpaIatsHL5o4mJeVj76j73eFIfE2g5UxmaOd8JGeetzMftyWmDFqV7V9Ld553RC11AzksVsjmd+IUPjJP5uqG4235+ii6RNQ9D2VWc5O8XnCFPZLPpgqrE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672577; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=uGE6rR1IJJ9r/VKOprUnSz1PtFT2C2MrjAAe7zPzb4Q=; b=IOHfRVbCJjmu9A6fyQrNfV8gbsQP0pmkx/vgXirjzijPQMP6FyXPDCjdf2DdB2AeKQuRNYTRcWjgBmIJokfHV4v5s1J1OoNwtvrlNMv7cH4d46HN1zneSjvx+WbEmo2Qmu7BkZvI4lrvXCNJeRDR6dXxSlmcWNVQc/a9M7tshGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672576992583.9168433037521; Wed, 18 Dec 2019 04:36:16 -0800 (PST) Received: from localhost ([::1]:53568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYYp-0001SE-4c for importer@patchew.org; Wed, 18 Dec 2019 07:36:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55743) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3o-0007Fm-OU for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3m-00038J-J0 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:11 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:55126) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3m-00034S-Bw for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:10 -0500 Received: by mail-wm1-x331.google.com with SMTP id b19so1554986wmj.4 for ; Wed, 18 Dec 2019 04:04:10 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:08 -0800 (PST) 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=uGE6rR1IJJ9r/VKOprUnSz1PtFT2C2MrjAAe7zPzb4Q=; b=iS90RVAv5i5quMQlaS/MzeNOfPVYMasCfz6tWH9PE7j+cHYtkiYtH9WDC7ImeL9MpE g4cs9OyVIZxs2Bp/vdz7LM0khhTZU4zJuJgbbknoK9EWuDxc8mfjHWeJkY3bYGLU3BQM gVSf8ORmVcuwIcdQVUkz7T47o/rNqVyx9zzprblgU2lMOF7GWhMUoCBWAKRLJbO4eyfT +uHdbHqznKNBO5LQGoPYqAsY/FFecaia/GxpD04Vu7ZwPKe9KQS3R4q7oxCXFdtLwWdi pwjAXJklZvCPDCHKzg6fOrRxTovHqC0OafJVWwpmJDEtT+eGlxUsTe5hUASjhLvzvRl/ tKEg== 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=uGE6rR1IJJ9r/VKOprUnSz1PtFT2C2MrjAAe7zPzb4Q=; b=ltR8H83DL4ZZC2DOg90hfArDlTzs3O7i6PQp5590jc3bWYYRsJEUzhh3cfxcTZvQdt 2nbVVz/uM4jgqQqUtzphNRsLO5bvuFf3qI+7LchuWb/tBTbJ3PD3o++QQlo09qvv/7pP I46pigzKIUzAU+7jGirCtorCnjYjlRIuNREKQbAgD4aUzDhh2Bg0tmsEgf+miKqCgRdk 9ZDLw8sovd7WXVOkt4hhF8wKcmX2iYLTspKsgYv+c59Hzmu4/kYEqSqgJkuhg8ncfGef RnIVfC71KbWvr0j6IWadxPHVboQPBf+zZ/Abk/ZLS0xnRu7HZBDememNR5m6S8QqAIVA 60FA== X-Gm-Message-State: APjAAAXkokJ7BeCSIQQUZKWJXxW7x3HvAEAIu2kErwjbUosvXplvI+g2 DLjWjgZZXNAwsAvyKPl+JawJ2wjV X-Google-Smtp-Source: APXvYqwyUIk/v9CbhOnh0rY6sjXSvnzb7XTGj8exJm1iK6Hd3LO5QAyBMxey92unekmamoz/tWmoWg== X-Received: by 2002:a1c:9602:: with SMTP id y2mr2831196wmd.23.1576670649194; Wed, 18 Dec 2019 04:04:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 66/87] docs/conf.py: Enable use of kerneldoc sphinx extension Date: Wed, 18 Dec 2019 13:02:32 +0100 Message-Id: <1576670573-48048-67-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Signed-off-by: Peter Maydell Message-Id: <20190521122519.12573-4-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- docs/conf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index b7edb06..259c604 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -54,7 +54,7 @@ needs_sphinx =3D '1.3' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions =3D ['qmp_lexer'] +extensions =3D ['kerneldoc', 'qmp_lexer'] =20 # Add any paths that contain templates here, relative to this directory. templates_path =3D ['_templates'] @@ -216,3 +216,8 @@ texinfo_documents =3D [ =20 =20 =20 +# We use paths starting from qemu_docdir here so that you can run +# sphinx-build from anywhere and the kerneldoc extension can still +# find everything. +kerneldoc_bin =3D os.path.join(qemu_docdir, '../scripts/kernel-doc') +kerneldoc_srctree =3D os.path.join(qemu_docdir, '..') --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673754; cv=none; d=zohomail.com; s=zohoarc; b=EzLXqL7yA1I1u26iw7EccMqwDo7J6PXlD4wcatIrwkzVsxf5xvs1U2Xn8mqaYL8objROSJXbzgzh3MpjBbjN2emLmBKNQ/jj4DgNYP8apsqZ5NbNfXA8GTE+fRkyB4B0aa+QQcJbA7tqqxNCGMBmJA5U8qjZVKy9OWzci9nKp7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673754; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hQn5BCLt9ly+0ISKdp5mviL+DCI+GuaIKgSx0WHQgTU=; b=jJ+JczgCr+FQVKf4itZB5pnxyxojXkrnqYw0/Vrtt6RCpu9fWVJa7hP7LV5gf6qW08VI/OHPkuHutgwl9P5IhUp4ZvEV9HinCJbOSMYhGPzHyX2L/3sULT8lKFV3/z/8oQUCA1O93S9BVFxpm4oGjHfy7oEpAnlUjANjDVefsuM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673754716387.5371824949748; Wed, 18 Dec 2019 04:55:54 -0800 (PST) Received: from localhost ([::1]:53804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYrp-0002gr-D2 for importer@patchew.org; Wed, 18 Dec 2019 07:55:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55785) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3p-0007Fu-2E for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3n-0003C6-Jo for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:12 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:53453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3n-00038q-Aq for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:11 -0500 Received: by mail-wm1-x336.google.com with SMTP id m24so1554742wmc.3 for ; Wed, 18 Dec 2019 04:04:11 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:09 -0800 (PST) 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=hQn5BCLt9ly+0ISKdp5mviL+DCI+GuaIKgSx0WHQgTU=; b=rc1uwZpRhdqIDpd+HUK9tFWpL2f4o2J0ob2s0kE8re2YXkm3T2Lm3dJYzq4g7ySjwu yNRKpjSOlX9LyojW/9sPASj9rcaYvGG7A0D8qgRWOYgAw8fg1XbLggtvm85IJLjuwis8 h+4Y4lodne7cp8CT7jChkezTKyVMoFmZE/enBy0+ffsmCVTqY5PAHesPHBHa6YuUBuxJ 3c9Gayf6bI7HT5cTs/cPno/3YW33sV1Fjo3R1T4VsZS6SwxnNN939wZKeJjI9WtQz6UX vIHHd8uNUa4iI0d9Ifp9FEVEKQIrjhv2WZwMmP5qQA3Bp07mu2GgLJr3eevqEAiMxnzC BxUQ== 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=hQn5BCLt9ly+0ISKdp5mviL+DCI+GuaIKgSx0WHQgTU=; b=t6gm+b9FPrh4TLXDOhsVpN3UtT/bcS/LAoxQTPQmkOXsJSdzV9AB75zUUSS4tC9Mee 6kymccL95gQYogdKUyzLj98vhvEi6CasjyVLwSfcSgHw0zX4oDm+Mm0mJQ8vZ4NhE4s5 QjmFtIwNugdnlJpJ7NQw2qZYO9Bd+RdWSztIEOJbbeQTEoeBZGil/HrO808kkqYYtMOH XuiENI5ox4cwx9yj2ayzj/qrjHWcdHVNLhi8wvR+Ye79OpxB3h/6l97+Kku24hLAMGv8 4/vdQ5mxbzkBSn5kFdLOf76DQlf27vqLBTF4c3OIPjvKRX+4xBQge3HuZ5oWarESxw4u q45A== X-Gm-Message-State: APjAAAVNBmPbHMRsQ8Hr+0FofxYK0dPp9W5lQ79ZGnJTP9YYpl1rhzW7 GuM0vBS9zdUid9ZSGNZrder+2py3 X-Google-Smtp-Source: APXvYqzrDX6Q4Pky8qKO2JuqpH0k26VkKKncfhkIk6YhwyjSCqr3KzdNV7+JyYsyjAvdPC2SPQLqew== X-Received: by 2002:a7b:c93a:: with SMTP id h26mr2798903wml.83.1576670650020; Wed, 18 Dec 2019 04:04:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 67/87] Makefile: disable Sphinx nitpicking Date: Wed, 18 Dec 2019 13:02:33 +0100 Message-Id: <1576670573-48048-68-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Turn off Sphinx nitpicking as a temporary (?) measure so sphinx builds complete even with warnings about missing references. Signed-off-by: Peter Maydell Message-Id: <20190521122519.12573-11-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 531e955..6b5ad11 100644 --- a/Makefile +++ b/Makefile @@ -1001,7 +1001,7 @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MAN= UAL_BUILDDIR)/interop/index # Note the use of different doctree for each (manual, builder) tuple; # this works around Sphinx not handling parallel invocation on # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946 -build-manual =3D $(call quiet-command,CONFDIR=3D"$(qemu_confdir)" sphinx-b= uild $(if $(V),,-q) -W -n -b $2 -D version=3D$(VERSION) -D release=3D"$(FUL= L_VERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"= SPHINX","$(MANUAL_BUILDDIR)/$1") +build-manual =3D $(call quiet-command,CONFDIR=3D"$(qemu_confdir)" sphinx-b= uild $(if $(V),,-q) -W -b $2 -D version=3D$(VERSION) -D release=3D"$(FULL_V= ERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPH= INX","$(MANUAL_BUILDDIR)/$1") # We assume all RST files in the manual's directory are used in it manual-deps =3D $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/= conf.py $(SRC_PATH)/docs/conf.py =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673638; cv=none; d=zohomail.com; s=zohoarc; b=JtWvpuPh4QNzmPhitHgpZSY9dUWpMCVcBnFluguOdWHHITsO90L3tieFyt5CvNn6kKTzoXUvphlax1svDpFtCDUmHkACOlbd2a0eop/jjqezyY6d/RKAFIWx0f7kMM0bVNHGE1qzGqLnKzScufTkQHFKiy/jcELJ/dbRrK5B4Ww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673638; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=vTtE2quRQYcYlfKRpBZjr5cgNUsYu4H3G5CXjyyh7e0=; b=ZEtlvEXxuUVJEdUSGBPoSaX33WDEh9dz9+LDZIzDUb/iGvlWzb1N6pxwoeP8WXvQYOhRRSRGaMDCV4TwX8jCrb86nw6TLetQqwTtfe+UoiifJIQIrNcQkoNbL/I5J07TpbA/y23vBUJtP6701W+s8o9w2nD1PdYFXv2wZw7baXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673638565810.3589968939817; Wed, 18 Dec 2019 04:53:58 -0800 (PST) Received: from localhost ([::1]:53776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYpw-00006X-Ps for importer@patchew.org; Wed, 18 Dec 2019 07:53:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56231) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3r-0007JR-HJ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3p-0003KD-Jh for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:15 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:36362) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3p-0003C7-9p for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:13 -0500 Received: by mail-wm1-x336.google.com with SMTP id p17so1621725wma.1 for ; Wed, 18 Dec 2019 04:04:13 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:10 -0800 (PST) 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=vTtE2quRQYcYlfKRpBZjr5cgNUsYu4H3G5CXjyyh7e0=; b=Du4VCRyhtJDAIY+Y+wKdBs50YBKdbAFO9QlO02+wvB8GZuRTIxPuMmnTpzywj689kI bMtPBriuV3NqbScGiIWPjT4PlZnEpU8aPZmAscRX+60ONaOLHuymHzQn7LqphnNT2ShR BWDc4afBgH07YJyRfPY+nMrTn9CpuIEFhQ+clCvdG18WVMUhsHiCmHFUrmyjPfjNs1p5 xROgiSII18eFvVmewRKyQU3vsEUtYyMNnSeFYT6p9eGRWLP6u+zNhw3jx39ayH57Yhob x+U8HP0/S+q+LDI/TSj2PUkEeQD5gkvcVPCgjYyyISRHchUvuHxxbgGE3x/7GL+1YVzN EtSQ== 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=vTtE2quRQYcYlfKRpBZjr5cgNUsYu4H3G5CXjyyh7e0=; b=sTC11z3+17sGZ18Oxds/+fCVUJflzBY8VgF3aJyHJwBJjUN+8MbAbz6OG+6T+VzXMD ZQccqiTGGgwQCMBRZfwu3FYzhyfoBMk5z9aGNVmIbDGH9AOiSnDlfDuVGoxDKIvIG7pg r3ZVAik9HH5/FhblBPW929LKKRaglRv6EH2MT5Bqdro5q4V2asdrgYooS257mfPnVbRr oqQhnprplTsnIc2+im7HIN4m6XRPXA/2Ew6GqKesSnni2JTpDqaw1P50Mx9XTNw8n+wB /lxX0oTE9rtyt5AbxTZ1y1OCr0EqaLQ+LcGA42YoqHQbaMLJF0TUabjDpVXIUg12G0cQ qtEw== X-Gm-Message-State: APjAAAWvUeIm1xYjp5mxAW4agR2IS4qyn6ewXHWth7HDtwP4D7qUj9so DbMyHEUrsKCTDsKH1SRpoCGWL2JP X-Google-Smtp-Source: APXvYqyBhjpuOnqcgmy0piy5oQtLMae+vmTSZ6xxxexR9pgvWLMnlCCRsGBaKqGTv+8tIL2qXnJV+w== X-Received: by 2002:a1c:7d93:: with SMTP id y141mr2956081wmc.111.1576670650922; Wed, 18 Dec 2019 04:04:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 68/87] bitops.h: Silence kernel-doc complaints Date: Wed, 18 Dec 2019 13:02:34 +0100 Message-Id: <1576670573-48048-69-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Fix the problems with kernel-doc/sphinx syntax in the doc comments for the shuffle and unshuffle functions: * mismatch between comment and prototype for argument name * the inline bit patterns need to be marked up so they are processed properly and rendered as monospace Signed-off-by: Peter Maydell Message-Id: <20190521122519.12573-6-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- include/qemu/bitops.h | 52 +++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h index ee76552..02c1ce6 100644 --- a/include/qemu/bitops.h +++ b/include/qemu/bitops.h @@ -424,13 +424,16 @@ static inline uint64_t deposit64(uint64_t value, int = start, int length, =20 /** * half_shuffle32: - * @value: 32-bit value (of which only the bottom 16 bits are of interest) + * @x: 32-bit value (of which only the bottom 16 bits are of interest) + * + * Given an input value:: + * + * xxxx xxxx xxxx xxxx ABCD EFGH IJKL MNOP * - * Given an input value: - * xxxx xxxx xxxx xxxx ABCD EFGH IJKL MNOP * return the value where the bottom 16 bits are spread out into - * the odd bits in the word, and the even bits are zeroed: - * 0A0B 0C0D 0E0F 0G0H 0I0J 0K0L 0M0N 0O0P + * the odd bits in the word, and the even bits are zeroed:: + * + * 0A0B 0C0D 0E0F 0G0H 0I0J 0K0L 0M0N 0O0P * * Any bits set in the top half of the input are ignored. * @@ -450,13 +453,16 @@ static inline uint32_t half_shuffle32(uint32_t x) =20 /** * half_shuffle64: - * @value: 64-bit value (of which only the bottom 32 bits are of interest) + * @x: 64-bit value (of which only the bottom 32 bits are of interest) + * + * Given an input value:: + * + * xxxx xxxx xxxx .... xxxx xxxx ABCD EFGH IJKL MNOP QRST UVWX YZab cdef * - * Given an input value: - * xxxx xxxx xxxx .... xxxx xxxx ABCD EFGH IJKL MNOP QRST UVWX YZab cdef * return the value where the bottom 32 bits are spread out into - * the odd bits in the word, and the even bits are zeroed: - * 0A0B 0C0D 0E0F 0G0H 0I0J 0K0L 0M0N .... 0U0V 0W0X 0Y0Z 0a0b 0c0d 0e0f + * the odd bits in the word, and the even bits are zeroed:: + * + * 0A0B 0C0D 0E0F 0G0H 0I0J 0K0L 0M0N .... 0U0V 0W0X 0Y0Z 0a0b 0c0d 0e0f * * Any bits set in the top half of the input are ignored. * @@ -477,13 +483,16 @@ static inline uint64_t half_shuffle64(uint64_t x) =20 /** * half_unshuffle32: - * @value: 32-bit value (of which only the odd bits are of interest) + * @x: 32-bit value (of which only the odd bits are of interest) + * + * Given an input value:: + * + * xAxB xCxD xExF xGxH xIxJ xKxL xMxN xOxP * - * Given an input value: - * xAxB xCxD xExF xGxH xIxJ xKxL xMxN xOxP * return the value where all the odd bits are compressed down - * into the low half of the word, and the high half is zeroed: - * 0000 0000 0000 0000 ABCD EFGH IJKL MNOP + * into the low half of the word, and the high half is zeroed:: + * + * 0000 0000 0000 0000 ABCD EFGH IJKL MNOP * * Any even bits set in the input are ignored. * @@ -504,13 +513,16 @@ static inline uint32_t half_unshuffle32(uint32_t x) =20 /** * half_unshuffle64: - * @value: 64-bit value (of which only the odd bits are of interest) + * @x: 64-bit value (of which only the odd bits are of interest) + * + * Given an input value:: + * + * xAxB xCxD xExF xGxH xIxJ xKxL xMxN .... xUxV xWxX xYxZ xaxb xcxd xexf * - * Given an input value: - * xAxB xCxD xExF xGxH xIxJ xKxL xMxN .... xUxV xWxX xYxZ xaxb xcxd xexf * return the value where all the odd bits are compressed down - * into the low half of the word, and the high half is zeroed: - * 0000 0000 0000 .... 0000 0000 ABCD EFGH IJKL MNOP QRST UVWX YZab cdef + * into the low half of the word, and the high half is zeroed:: + * + * 0000 0000 0000 .... 0000 0000 ABCD EFGH IJKL MNOP QRST UVWX YZab cdef * * Any even bits set in the input are ignored. * --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673604; cv=none; d=zohomail.com; s=zohoarc; b=nzwHd4YQ+Ss78PdfupRzEzypPmize8LzccnEu1tOT9XbSrd5ndKs7NkpMbwB1UhxLm1VslDvEc0emdC/IJmGivsHuGTkwFFxTVFMPf3ebsYsf9K57YoJKPVrheDiys1oL8x3wGWFvOIRqV1NnGQBGaMCB4OkGB4cPdj5j09MSuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673604; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=0RravkZg4GJs8al28mPtQXZKMfdxgs/SErQE/3uoU0E=; b=gBxuIypH1Ei+VPzD7nwXbbsfbveTSWKst/mV8WdiE8cWXja3jaxy01cNGfaZYyRX7UqaCcSdzgaGFSrsTjt0vnHimm6heVeah3w7HNr3dx6jO+bg8zredkDAaEHqH9hitVZ0MLW+d7a3bl1DxhecYuoOms3CfwdNL7qAK9HF3Ms= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673604365254.60616970960598; Wed, 18 Dec 2019 04:53:24 -0800 (PST) Received: from localhost ([::1]:53773 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYpO-0007py-O0 for importer@patchew.org; Wed, 18 Dec 2019 07:53:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56311) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3s-0007Jz-0L for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3p-0003Kj-Nc for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:15 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:33369) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3p-0003GE-Bg for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:13 -0500 Received: by mail-wr1-x432.google.com with SMTP id b6so2032556wrq.0 for ; Wed, 18 Dec 2019 04:04:13 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:11 -0800 (PST) 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=0RravkZg4GJs8al28mPtQXZKMfdxgs/SErQE/3uoU0E=; b=bSaeIsvZJdjx874TaEqBWWL/9Y8tw0cc0u6FXF8Ee+pY6FvPkG1GU7Ia0hyR8oA+WX EmRAFioB0+alCZz6UvtgGRIgP2hiqXAfDPDLw5U8MIcPEWJ/ZKOi9Fi9ZYOX6EEODa9n SWxQffs3P8tnRFrfaj0685/XAcHQZ9WyC5Ge/u7oZtySWhQMnRklegn5cYRtDfRJBsge e9JbYQGl6dGU3WcA+Hf4NywdM9qMIUWf+fBJrP0x6Voqyo7TwWjEe05bI/ZhGIotFlDA gxr3mQFFFgDbTcnIMJY0tRHscY8WB1xLh6L/ZME2C6yzwM1kobqq5p7hGlFUstiP8ag5 fSzA== 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=0RravkZg4GJs8al28mPtQXZKMfdxgs/SErQE/3uoU0E=; b=N6s+ty/Ek0ihCF+KJS+AUhc+w8yxUZXi5Yf/0SvSew4jsevmoY2/3n7ceV8TyUxe+S Wcz+MpIrZLYBvJOadraLE54jsQ1TjAN8RzfBwA3jTLBpLkm43iDU6AbbMizhZ5glLqog c7+jA1BQBlbYM4swDhCqvdrwahV+FuU5w/YuO6g/0gLJhwYaEB5k8Cxh7LSNq2KEEsst XbW10uP4JTBOEl/gnohtZQN6gVHsk8Ex4+y/NI5LYi6GjWtAdNCDW9ArwvsEdxJx/2/f 65W21NKGOKF1H2q4raBb0l2rg2xuit1KBgINccjX2op2H5X7Do6n3+JAPYgLh99MA58h 0yLA== X-Gm-Message-State: APjAAAXen0yobGVgf+EuxBeUjLRfVg7nqhbEnMUFoLnxaW0eIp/sLtBI /hzVZD7KA/UyGM7t+hYycTOUj5yp X-Google-Smtp-Source: APXvYqztM9aA5KO+EQm15CgOWoGN8+2UfpqlGGOIfJMu5YK/Jq1ue/ta1h5HWkZONVUyGtih8Tr8Nw== X-Received: by 2002:adf:e984:: with SMTP id h4mr2384917wrm.275.1576670652036; Wed, 18 Dec 2019 04:04:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 69/87] docs: Create bitops.rst as example of kernel-docs Date: Wed, 18 Dec 2019 13:02:35 +0100 Message-Id: <1576670573-48048-70-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Create a bitops.rst which is just a container for the kernel-doc comments in qemu/bitops.h. This is mostly a test of the kernel-doc extension machinery. Signed-off-by: Peter Maydell Message-Id: <20190521122519.12573-7-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- docs/devel/bitops.rst | 8 ++++++++ docs/devel/index.rst | 1 + 2 files changed, 9 insertions(+) create mode 100644 docs/devel/bitops.rst diff --git a/docs/devel/bitops.rst b/docs/devel/bitops.rst new file mode 100644 index 0000000..6addaec --- /dev/null +++ b/docs/devel/bitops.rst @@ -0,0 +1,8 @@ +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Bitwise operations +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The header ``qemu/bitops.h`` provides utility functions for +performing bitwise operations. + +.. kernel-doc:: include/qemu/bitops.h diff --git a/docs/devel/index.rst b/docs/devel/index.rst index c86a3cd..ac86215 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -23,3 +23,4 @@ Contents: secure-coding-practices tcg tcg-plugins + bitops --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672706; cv=none; d=zohomail.com; s=zohoarc; b=F23Op3oZOt5Wasxvkvpt11QbOZXmtpZHxBSlM+BTAmnLMfBZEnHKaOzx5r3RiLHpzcCfSq4k/PsfcaXYn+SJhBoLYmSScWoo683SiXmm861CkwL6RFMg8C5/+XhmswcsxqxlKWEBcInKaQxcVVe3QDBW5ty4dBZRoiMi5GIwOBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672706; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=OQTWLYrlwKCqlPGQTAn1oHemTcy+syR9pMtUyWDmhSc=; b=VzRUIs9XjG2u+suZ4ydy7LrZruK/E1PeYhsIghxrITOH16jWhm1r10pp2Jh7+0GjdknUiWC2QtKmCpGPqTu8mOYosXmxrYk7T9utkZDefkNibEe6ksZc7Z3f/92a54d89QwJUYqWcSk1QjW+KbLGpp9Zwpgwa8+ExWt1/gNSGpk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672706274659.199395488671; Wed, 18 Dec 2019 04:38:26 -0800 (PST) Received: from localhost ([::1]:53592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYau-0004lX-Jm for importer@patchew.org; Wed, 18 Dec 2019 07:38:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56502) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3s-0007LL-Sd for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3r-0003SA-E9 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:16 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:43642) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3q-0003Jb-4D for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:15 -0500 Received: by mail-wr1-x42b.google.com with SMTP id d16so1986191wre.10 for ; Wed, 18 Dec 2019 04:04:14 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:12 -0800 (PST) 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=OQTWLYrlwKCqlPGQTAn1oHemTcy+syR9pMtUyWDmhSc=; b=ri8SSylw4YiYtS8bWeiSP4xSuDAL59nETQl5WxRtvXZSCjStDyPhBvikBxiOhyaqSW rSzL/8glez6HcsaB8TtR9wdLbxnCbjCPXfoSQc5ZGyhnH9h5rydPYmOLYcFffB3ZqMNU vQs8Q746xQQKjjitpoJZHvX+WaDnidRiEFJUaB3qgILwMb7QqSnZ2YcniftT24RmPxiU DKIobMSN7ATBpl7OMHSUB94tAF/OYzqj+MDKxh6P4jxR23KKLwqw8XIruWh7MWUznKi4 XHfSPMst9QccECCDB/fu7ldBUK+WvZNCPyZOO2cOxvkLTjqKOm6sV/OP13Cj4mI/LOtd IXjQ== 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=OQTWLYrlwKCqlPGQTAn1oHemTcy+syR9pMtUyWDmhSc=; b=rTkdhK1q2zujNnbhW0ZMxut0ssOW2F8zvCZUBDESaFUM10kZ5CRwvCbqkuxVfAH44i tDQwv9/lMDpvpoQIPzGjDaqAMUR9U61BAoWb6lEiHMMHywqPmanPlXDt5E1lD0zpkjpM 2i7e3/TDFdO0eLfbCNBOrAlHHZV1UHLhWB8GO3d2CQkwaUR8aHWfUHn3I2YWSDHPL7ex KE5HQ9jbzUtizFHVjzW0bOZgw/jL9mb0jIvgYUcD6RRu7QkHEkEBJweeShZ/CXknSeaV 9mpBPDvOZSxBTVxioXljPbjFd+izC5OGEIKNngqMESpnLLoVs/HEK1TCKRGngEQJswBI YoTw== X-Gm-Message-State: APjAAAU7mref1RnARsYaYWqFsAzzvJa3/eW8NJ0ITW6sbTt6pKSuXlL0 7Z5vPI2bUktzZ3NXYBbtmuRtz24E X-Google-Smtp-Source: APXvYqxXLUH4tGe2UXggD2UOwTa5rUJg3c5ElKbcQQvUJWD2Av969lmUGZdDo+7VNYjBwAQ0EemUvA== X-Received: by 2002:adf:f98c:: with SMTP id f12mr2374120wrr.138.1576670652810; Wed, 18 Dec 2019 04:04:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 70/87] memory.h: Silence kernel-doc complaints Date: Wed, 18 Dec 2019 13:02:36 +0100 Message-Id: <1576670573-48048-71-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fix a few instances where kernel-doc complains about doc comments in memory.h. Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 9d3fdb5..4754749 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -360,10 +360,14 @@ typedef struct IOMMUMemoryRegionClass { typedef struct CoalescedMemoryRange CoalescedMemoryRange; typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd; =20 +/** MemoryRegion: + * + * A struct representing a memory region. + */ struct MemoryRegion { Object parent_obj; =20 - /* All fields are private - violators will be prosecuted */ + /* private: */ =20 /* The following fields should fit in a cache line */ bool romd_mode; @@ -452,7 +456,7 @@ struct MemoryListener { * AddressSpace: describes a mapping of addresses to #MemoryRegion objects */ struct AddressSpace { - /* All fields are private. */ + /* private: */ struct rcu_head rcu; char *name; MemoryRegion *root; @@ -1679,8 +1683,8 @@ bool memory_region_is_mapped(MemoryRegion *mr); * * Returns a #MemoryRegionSection that describes a contiguous overlap. * It will have the following characteristics: - * .@size =3D 0 iff no overlap was found - * .@mr is non-%NULL iff an overlap was found + * - @size =3D 0 iff no overlap was found + * - @mr is non-%NULL iff an overlap was found * * Remember that in the return value the @offset_within_region is * relative to the returned region (in the .@mr field), not to the @@ -1691,8 +1695,8 @@ bool memory_region_is_mapped(MemoryRegion *mr); * returned one. However, in the special case where the @mr argument * has no container (and thus is the root of the address space), the * following will hold: - * .@offset_within_address_space >=3D @addr - * .@offset_within_address_space + .@size <=3D @addr + @size + * - @offset_within_address_space >=3D @addr + * - @offset_within_address_space + .@size <=3D @addr + @size * * @mr: a MemoryRegion within which @addr is a relative address * @addr: start of the area within @as to be searched --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673788; cv=none; d=zohomail.com; s=zohoarc; b=OmLa2zPN1RZzD6+LiuvpOfjKkpY8e9K0KmNXH13sONbnWSetnL7hjWHPRBR92IgHJRyQJKJMtqLBbREsBBNb7cMnW88/mvBvpTKu+qJ+LBB+m+ObjaW5l1h3Q0kZdjl695xpn5fJkdAcbLx3rbR9aZSx7tJGRAbbK/kusyA/POw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673788; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=OjMB1EI/hWRJqhSpYyL+FZY8NSTWMA7fRjTMsv4X++c=; b=BKyQ53oBIUX9rWV1rmnoLUtwlUFKICmWDgPrxl7J5fx2rz4os7WRl+kRD+ffhbRFzBGkE++S5IMNqv0/JR/VCShe28NRqi4IGUIFKVJ6yn8EQp3KEPp0Sb1tKKxfID5nBFoLuOhBd1UEDg5MZAIg3kqMBirxA7MezRKR/A6ol68= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667378800760.41735971445951; Wed, 18 Dec 2019 04:56:28 -0800 (PST) Received: from localhost ([::1]:53820 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYsM-0003Rp-Fb for importer@patchew.org; Wed, 18 Dec 2019 07:56:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56399) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3s-0007KY-Cj for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3r-0003R6-95 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:16 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:45272) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3q-0003N5-VM for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:15 -0500 Received: by mail-wr1-x42b.google.com with SMTP id j42so1975332wrj.12 for ; Wed, 18 Dec 2019 04:04:14 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:13 -0800 (PST) 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=OjMB1EI/hWRJqhSpYyL+FZY8NSTWMA7fRjTMsv4X++c=; b=d1G4NhaJkpPtP161Y6mCgwK1HpeptY7sBTWJM19uRPyJORa/iU9gllx8UVP2Vekohq wdSJL5pMJ8RW5P1/Dn6yiymqfSWORK53QBfeYUQWXDI0DTAtfoFBNuz8ju9HdWlrbtEi eAmfQFfvz2I/Kum5gCr4lw6Hby6xWzijFROo4zXiefCY215IDsAg9lvVWLgoW2CI9qlQ CXsaZwopJmnD1jt87Cx6fLRYuovcHs7/2bSb79sMZ8katcyObs5/dqPNDvIEmcSLOrRv JNI0M985/2jZ6EPz571tInHR5BzGqJMJN1c+eIZpwUwUS3crrZfxVHO7+bsmV3tlVkmg RQCg== 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=OjMB1EI/hWRJqhSpYyL+FZY8NSTWMA7fRjTMsv4X++c=; b=FtylJM9ym9bpWInvqwsKXoa9lY7NZvY1PF6nI0kf0/onr7TMF8s9w+vme5PvqqWNG/ msSwy/iouVW1PHXADxTcq9BnSyMgRU+XLEPd1yuPVZ7gLjGphB/lxgQ8sDymfLvJAeY4 XZDZhbrXr+pBV6a0NTCDzkJ94VNLAqH9s+4ya0/aPU04V0+ChH9OZNOMfvyXny5mwWz8 Ml2085doGTTf19XZyAlE0s6/IpBSfy6JqXHJoGMW79hFf/BT0RArev6CdxdK7wwoQ5dT Yjq/Iew87vJ58JrwpjC+hqAm1W5UH5Z+Yj021eA1AT4827TAfZwnrrUYXCerMWVmu6L5 F5lA== X-Gm-Message-State: APjAAAVvzE5jL76V7WbX3zNqyneO3cUbkyy29Uv+MAhN8+IDmXlIfNKA VfAwRN/pyeKGAcV1yHDHxMAbAVy2 X-Google-Smtp-Source: APXvYqxKGm+IzzpbwMffSczasJrnAoDWetkchP3rPpS5G1r6TzgVKVQgRv5retP0M7/Iebt+0mIhZw== X-Received: by 2002:adf:81e3:: with SMTP id 90mr2437543wra.23.1576670653826; Wed, 18 Dec 2019 04:04:13 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 71/87] docs: add memory API reference Date: Wed, 18 Dec 2019 13:02:37 +0100 Message-Id: <1576670573-48048-72-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add kernel-doc directive to parse and include doc comments from include/exec/memory.h. Signed-off-by: Paolo Bonzini --- docs/devel/memory.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/devel/memory.rst b/docs/devel/memory.rst index b6a4c37..5dc8a12 100644 --- a/docs/devel/memory.rst +++ b/docs/devel/memory.rst @@ -361,3 +361,8 @@ callbacks are called: - .impl.unaligned specifies that the *implementation* supports unaligned accesses; if false, unaligned accesses will be emulated by two aligned accesses. + +API Reference +------------- + +.. kernel-doc:: include/exec/memory.h --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576672888; cv=none; d=zohomail.com; s=zohoarc; b=iSF7sGgDQF2QecLHPmeHC6NnHUXpzvu/NzNnkpAHolcnoEW6oa+yF/F/X0+FNCmyG0FIEjKbwP6DEC0/gFi2ROEixzp4K6Lm5Ezo5ZnVUr0rJzlhlZU7t4WX0/LN+YFxeLbXSaz2mCO27eCOA8SpjVAC8ENLbm+DNzjqJN4IlQI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576672888; h=Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=wKT5fGLcBjweK2g0j9x3iDEnS480C/vWZj9Pg704MW0=; b=bYRC9L9L0ZU5UR+YJYuiBoflKZCVVppowTCj2B8cEPIALg1EUujHl203+clgd4nmOQ1C4dkdWlxzW2U59FTqka6FUYljzWjbmm6xF8IaffVtKFlhbHmJAzHaN/TJdjDVm7xRKWJAqZbwKDdz2RH0JBGVpYf3zjh1uf9ShHAHa7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576672888598799.0430609822123; Wed, 18 Dec 2019 04:41:28 -0800 (PST) Received: from localhost ([::1]:53630 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYdq-0000nh-MV for importer@patchew.org; Wed, 18 Dec 2019 07:41:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57069) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3w-0007Ol-1h for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3s-0003XM-IG for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:19 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:42346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3s-0003Sd-91 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:16 -0500 Received: by mail-wr1-x433.google.com with SMTP id q6so1982349wro.9 for ; Wed, 18 Dec 2019 04:04:16 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:14 -0800 (PST) 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=wKT5fGLcBjweK2g0j9x3iDEnS480C/vWZj9Pg704MW0=; b=uBFEGF9cpKGqQQW24pCETvFvKQe01KIQ50Ckw6KE2SiW5QFuItoyeNHQwLgz6riuLL MwKZZaw2f/UHk1JQC+L/iFzB0P11KDEkxRsP3VM9z+X/kY1QP6dImo3d0cmXr3p2dKWN eN9DhiHEF/GUWvyWGMuJCzbVjvVd8pZvQj6/jnFIbrRS7itTO0MwEk5Ycg43QCfFKgsb Od4CPz8HhB0QsfeRjzbt4798usSPNJ1QpYET2fu+TTRa5M1QrCvGuX8pzOW1tr6AyoHD ZjGpKf5A8lbj598Xm/ac1WIANB5D2BuZem6JBaumyUeEstZQ/PKrtnnFd+8ltLIgsZFi MGBw== 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=wKT5fGLcBjweK2g0j9x3iDEnS480C/vWZj9Pg704MW0=; b=gLmKPxB5foap3hlQQfYDbmonmmuhODxph5UAkX+KszIjmqtHVHzkMKGluRoXJl1W+U +xeNUx3JIvb99rrXQtfG/s6hX1toh+jv2WDPcGoOi7xHBXVBOqvnentiyjfesbhU8JvW 9oaPItMYbpPQ5BDxud+eV27L8H20ivOtALDtVrUSdOsrTQsIrmRekNm9scazMDpQPieQ 8ImTwNJy0pkLWLJgmwmnTqUnrg4FFB4WpPQIA26y4IG3uoE5WNUfQF40JdQ4FH+zQ+EF LwqaKS0YpV4VBXASjQSahRxB1yNsiHOEpTJU5xYV4TnPbQzLXpNRP+PLfrSg8T3IQw4e lMHg== X-Gm-Message-State: APjAAAUmGmahhjFNRdr9T4klME8NZcVfjffFDh7O3vSjSbmFXssEhU5G ITCfuGtriWrmJR860Vm3P8W90dCq X-Google-Smtp-Source: APXvYqyPnT4GBD2x23hiCCRvwgJzih3+z8nN6BygoY6e2h9shmBuQ8Fkrb9CL7f5ApMV8VA2VgCOgQ== X-Received: by 2002:a5d:6901:: with SMTP id t1mr2334165wru.94.1576670654720; Wed, 18 Dec 2019 04:04:14 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 72/87] memory: include MemoryListener documentation and some missing function parameters Date: Wed, 18 Dec 2019 13:02:38 +0100 Message-Id: <1576670573-48048-73-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These cover the remaining warnings from kernel-doc. Signed-off-by: Paolo Bonzini Message-Id: <20191029162248.13383-7-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 218 ++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 214 insertions(+), 4 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 4754749..e85b7de 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -423,30 +423,232 @@ struct IOMMUMemoryRegion { * Use with memory_listener_register() and memory_listener_unregister(). */ struct MemoryListener { + /** + * @begin: + * + * Called at the beginning of an address space update transaction. + * Followed by calls to #MemoryListener.region_add(), + * #MemoryListener.region_del(), #MemoryListener.region_nop(), + * #MemoryListener.log_start() and #MemoryListener.log_stop() in + * increasing address order. + * + * @listener: The #MemoryListener. + */ void (*begin)(MemoryListener *listener); + + /** + * @commit: + * + * Called at the end of an address space update transaction, + * after the last call to #MemoryListener.region_add(), + * #MemoryListener.region_del() or #MemoryListener.region_nop(), + * #MemoryListener.log_start() and #MemoryListener.log_stop(). + * + * @listener: The #MemoryListener. + */ void (*commit)(MemoryListener *listener); + + /** + * @region_add: + * + * Called during an address space update transaction, + * for a section of the address space that is new in this address space + * space since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The new #MemoryRegionSection. + */ void (*region_add)(MemoryListener *listener, MemoryRegionSection *sect= ion); + + /** + * @region_del: + * + * Called during an address space update transaction, + * for a section of the address space that has disappeared in the addr= ess + * space since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The old #MemoryRegionSection. + */ void (*region_del)(MemoryListener *listener, MemoryRegionSection *sect= ion); + + /** + * @region_nop: + * + * Called during an address space update transaction, + * for a section of the address space that is in the same place in the= address + * space as in the last transaction. + * + * @listener: The #MemoryListener. + * @section: The #MemoryRegionSection. + */ void (*region_nop)(MemoryListener *listener, MemoryRegionSection *sect= ion); + + /** + * @log_start: + * + * Called during an address space update transaction, after + * one of #MemoryListener.region_add(),#MemoryListener.region_del() or + * #MemoryListener.region_nop(), if dirty memory logging clients have + * become active since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The #MemoryRegionSection. + * @old: A bitmap of dirty memory logging clients that were active in + * the previous transaction. + * @new: A bitmap of dirty memory logging clients that are active in + * the current transaction. + */ void (*log_start)(MemoryListener *listener, MemoryRegionSection *secti= on, int old, int new); + + /** + * @log_stop: + * + * Called during an address space update transaction, after + * one of #MemoryListener.region_add(), #MemoryListener.region_del() or + * #MemoryListener.region_nop() and possibly after + * #MemoryListener.log_start(), if dirty memory logging clients have + * become inactive since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The #MemoryRegionSection. + * @old: A bitmap of dirty memory logging clients that were active in + * the previous transaction. + * @new: A bitmap of dirty memory logging clients that are active in + * the current transaction. + */ void (*log_stop)(MemoryListener *listener, MemoryRegionSection *sectio= n, int old, int new); + + /** + * @log_sync: + * + * Called by memory_region_snapshot_and_clear_dirty() and + * memory_global_dirty_log_sync(), before accessing QEMU's "official" + * copy of the dirty memory bitmap for a #MemoryRegionSection. + * + * @listener: The #MemoryListener. + * @section: The #MemoryRegionSection. + */ void (*log_sync)(MemoryListener *listener, MemoryRegionSection *sectio= n); + + /** + * @log_clear: + * + * Called before reading the dirty memory bitmap for a + * #MemoryRegionSection. + * + * @listener: The #MemoryListener. + * @section: The #MemoryRegionSection. + */ void (*log_clear)(MemoryListener *listener, MemoryRegionSection *secti= on); + + /** + * @log_global_start: + * + * Called by memory_global_dirty_log_start(), which + * enables the %DIRTY_LOG_MIGRATION client on all memory regions in + * the address space. #MemoryListener.log_global_start() is also + * called when a #MemoryListener is added, if global dirty logging is + * active at that time. + * + * @listener: The #MemoryListener. + */ void (*log_global_start)(MemoryListener *listener); + + /** + * @log_global_stop: + * + * Called by memory_global_dirty_log_stop(), which + * disables the %DIRTY_LOG_MIGRATION client on all memory regions in + * the address space. + * + * @listener: The #MemoryListener. + */ void (*log_global_stop)(MemoryListener *listener); + + /** + * @log_global_after_sync: + * + * Called after reading the dirty memory bitmap + * for any #MemoryRegionSection. + * + * @listener: The #MemoryListener. + */ void (*log_global_after_sync)(MemoryListener *listener); + + /** + * @eventfd_add: + * + * Called during an address space update transaction, + * for a section of the address space that has had a new ioeventfd + * registration since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The new #MemoryRegionSection. + * @match_data: The @match_data parameter for the new ioeventfd. + * @data: The @data parameter for the new ioeventfd. + * @e: The #EventNotifier parameter for the new ioeventfd. + */ void (*eventfd_add)(MemoryListener *listener, MemoryRegionSection *sec= tion, bool match_data, uint64_t data, EventNotifier *e); + + /** + * @eventfd_del: + * + * Called during an address space update transaction, + * for a section of the address space that has dropped an ioeventfd + * registration since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The new #MemoryRegionSection. + * @match_data: The @match_data parameter for the dropped ioeventfd. + * @data: The @data parameter for the dropped ioeventfd. + * @e: The #EventNotifier parameter for the dropped ioeventfd. + */ void (*eventfd_del)(MemoryListener *listener, MemoryRegionSection *sec= tion, bool match_data, uint64_t data, EventNotifier *e); + + /** + * @coalesced_io_add: + * + * Called during an address space update transaction, + * for a section of the address space that has had a new coalesced + * MMIO range registration since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The new #MemoryRegionSection. + * @addr: The starting address for the coalesced MMIO range. + * @len: The length of the coalesced MMIO range. + */ void (*coalesced_io_add)(MemoryListener *listener, MemoryRegionSection= *section, hwaddr addr, hwaddr len); + + /** + * @coalesced_io_del: + * + * Called during an address space update transaction, + * for a section of the address space that has dropped a coalesced + * MMIO range since the last transaction. + * + * @listener: The #MemoryListener. + * @section: The new #MemoryRegionSection. + * @addr: The starting address for the coalesced MMIO range. + * @len: The length of the coalesced MMIO range. + */ void (*coalesced_io_del)(MemoryListener *listener, MemoryRegionSection= *section, hwaddr addr, hwaddr len); - /* Lower =3D earlier (during add), later (during del) */ + /** + * @priority: + * + * Govern the order in which memory listeners are invoked. Lower prior= ities + * are invoked earlier for "add" or "start" callbacks, and later for "= delete" + * or "stop" callbacks. + */ unsigned priority; + + /* private: */ AddressSpace *address_space; QTAILQ_ENTRY(MemoryListener) link; QTAILQ_ENTRY(MemoryListener) link_as; @@ -940,6 +1142,7 @@ void memory_region_init_rom(MemoryRegion *mr, * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count * @ops: callbacks for write access handling (must not be NULL). + * @opaque: passed to the read and write callbacks of the @ops structure. * @name: Region name, becomes part of RAMBlock name used in migration str= eam * must be unique within any device * @size: size of the region. @@ -1028,7 +1231,7 @@ static inline IOMMUMemoryRegion *memory_region_get_io= mmu(MemoryRegion *mr) * Returns pointer to IOMMUMemoryRegionClass if a memory region is an iomm= u, * otherwise NULL. This is fast path avoiding QOM checking, use with cauti= on. * - * @mr: the memory region being queried + * @iommu_mr: the memory region being queried */ static inline IOMMUMemoryRegionClass *memory_region_get_iommu_class_nochec= k( IOMMUMemoryRegion *iommu_mr) @@ -1098,6 +1301,7 @@ void memory_region_notify_one(IOMMUNotifier *notifier, * @n: the IOMMUNotifier to be added; the notify callback receives a * pointer to an #IOMMUTLBEntry as the opaque value; the pointer * ceases to be valid on exit from the notifier. + * @errp: pointer to Error*, to store an error if it happens. */ int memory_region_register_iommu_notifier(MemoryRegion *mr, IOMMUNotifier *n, Error **errp); @@ -1270,9 +1474,12 @@ void *memory_region_get_ram_ptr(MemoryRegion *mr); void memory_region_ram_resize(MemoryRegion *mr, ram_addr_t newsize, Error **errp); /** - * memory_region_do_writeback: Trigger writeback for selected address range - * [addr, addr + size] + * memory_region_do_writeback: Trigger cache writeback or msync for + * selected address range * + * @mr: the memory region to be updated + * @addr: the initial address of the range to be written back + * @size: the size of the range to be written back */ void memory_region_do_writeback(MemoryRegion *mr, hwaddr addr, hwaddr size= ); =20 @@ -1591,6 +1798,8 @@ void memory_region_add_subregion_overlap(MemoryRegion= *mr, /** * memory_region_get_ram_addr: Get the ram address associated with a memory * region + * + * @mr: the region to be queried */ ram_addr_t memory_region_get_ram_addr(MemoryRegion *mr); =20 @@ -2161,6 +2370,7 @@ static inline bool memory_access_is_direct(MemoryRegi= on *mr, bool is_write) * @addr: address within that address space * @attrs: memory transaction attributes * @buf: buffer with the data transferred + * @len: length of the data transferred */ static inline __attribute__((__always_inline__)) MemTxResult address_space_read(AddressSpace *as, hwaddr addr, --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673906; cv=none; d=zohomail.com; s=zohoarc; b=Gmt0QEEnYd7gPx4JDKMTW0VkBe9rcc/aMZuOcHFZd8kjLHAvbQ8YwA6DRQ3zpMzxnFNzjH4V3CY1bVUMNiw9FEXYL0EQBPlaU/TlaV8fl/ddP2FNzEqZNjD4wLA1mbNVVcEkSsbj9W2cvchS/hgjWW5u4fjL4fzqD7GeytP5QRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673906; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YpJua1nbXfmWc7u8N3DBv+ySntOx6HMwLCHAHrE1P9g=; b=KdvrVGblt7iBdfCyteOslmFV7uieQQ2MMpFjV4Ds6BoQUuhCMRttp2fUX06WeDpgVMoolqjzhFApTAwFWzfj2H8ssX44IgKG8TTH3PZ42jMJ0OnJ1KzkI08t/jjrgzna8N3vwpxrcMJu5FLuyy3jjQhchsnTCfaDgKE2rYNeUM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673906547528.9906452359994; Wed, 18 Dec 2019 04:58:26 -0800 (PST) Received: from localhost ([::1]:53838 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYuH-0006MG-Al for importer@patchew.org; Wed, 18 Dec 2019 07:58:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56983) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3v-0007O0-Fx for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3t-0003Zw-B0 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:19 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:45893) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3t-0003Wx-11 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:17 -0500 Received: by mail-wr1-x441.google.com with SMTP id j42so1975432wrj.12 for ; Wed, 18 Dec 2019 04:04:16 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:14 -0800 (PST) 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=YpJua1nbXfmWc7u8N3DBv+ySntOx6HMwLCHAHrE1P9g=; b=Y8zLeZhMXuV6LESFo43F7ppdRQTj0tlpPmttnlNqhdDRS2Q44UNVS5093K/V8GD2Et g4KCGgmNOICwy8slW0GFd9Rqt8VRcHGyf6R7BvLA9jDA9H6TlIZoXsrVBkHNhjpG6lGy LCKu+UlzCRNQ3ZvHBcQQ83IjK+4OVysfkJ/ri4TwX+44p8/UWi9/afMtQjEBuO2Ufh1G S8daZa9aFpiJxSd2dc21lCDasZwjtF/oU1iQCsy0fpFjMqPc8K/mp14Ni14PlhFkPpMP RgMWNRA9z39qjXG+0waAgUlKg1WY49B59BEgyNQJbVpVc+jiBLsQ6qYBPUGfgOXklhiW GJzQ== 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=YpJua1nbXfmWc7u8N3DBv+ySntOx6HMwLCHAHrE1P9g=; b=d1oN0a40UFG8iv15ZcYnaxcv19/1sOvWRxVvQzJLVXMCZM7cZNf4XHM66Gi/ilJwkX 82qxqbxEQlObgsFNU/EPtpD5I4HRlm9ucTJS22eVOprp5ie4U6l2AKYAkKj5kHpKbVzY hvrEiaM3HNWJPX3eO5SMMNyetEU/x7xnshXUCMYw1hTlsaA7FFeVY/dOzAjRONC3VgFE J2Qyy2t8nh2gCOPEHcDtDS3nrfpSrd9yq8BOntqibg4g/m832I5EW/DrUv6IYMZ/S1IJ gXCXj+h0WJ68rSlZMAsy8v1tr39UTidP6guyyGUAeBxhbTE2HFZhwkTqcbphcZA6AvyN REYw== X-Gm-Message-State: APjAAAVTqnhdjp8QGOoxyD4b2Vb584TScJMJE1b2TUJrWuWCpZcBCxAE CgmLXJmBErL4t5G8ldhy9rvul7m6 X-Google-Smtp-Source: APXvYqya2I6NXy72fHMxn0RkQnK2PkVGtLNQGFYrpvm+mMhU8sJYlKv4RIAU/XT4sB+SyZ0+5MPXjQ== X-Received: by 2002:a5d:6a83:: with SMTP id s3mr2351075wru.99.1576670655834; Wed, 18 Dec 2019 04:04:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 73/87] migration: check length directly to make sure the range is aligned Date: Wed, 18 Dec 2019 13:02:39 +0100 Message-Id: <1576670573-48048-74-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wei Yang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Wei Yang Since the start addr is already checked, to make sure the range is aligned, checking the length is enough. Signed-off-by: Wei Yang Reviewed-by: Dr. David Alan Gilbert Message-Id: <20190712032704.7826-1-richardw.yang@linux.intel.com> Signed-off-by: Paolo Bonzini --- exec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index a34c348..dfe2096 100644 --- a/exec.c +++ b/exec.c @@ -3901,10 +3901,9 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t s= tart, size_t length) =20 if ((start + length) <=3D rb->used_length) { bool need_madvise, need_fallocate; - uint8_t *host_endaddr =3D host_startaddr + length; - if ((uintptr_t)host_endaddr & (rb->page_size - 1)) { - error_report("ram_block_discard_range: Unaligned end address: = %p", - host_endaddr); + if (length & (rb->page_size - 1)) { + error_report("ram_block_discard_range: Unaligned length: %zx", + length); goto err; } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673760; cv=none; d=zohomail.com; s=zohoarc; b=bYxJSM+yG+IsivIc32M1vIJmRYzCBGY+4ZG4ejmZOMOWJygr+Enqyf4S0ln2Lfe8/lq5H0fM/eDf4+S3ALtWS4+PuQEqLcJh5TsfL1mtWizyQYMtZ/I8TLmoX8Qvzu6F/HzNDyr3jj94XHMiUL6ts4PIRcxIlVOhDWR2XPOYo8w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673760; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=oWlQxy3gHFTwYR2OAKyR7heGQKIg7ID0fB2XfRVmZV0=; b=Wywzp70y+zTA4CullIy68E/8Wk2kh52jMmcQnhBui3ykvJSHo1sa+ukOvEC0KPDw23TbI/U30nipg3b1XMiexx1EJpEg+9WqlZfBxcQlB1MOGDbs9if8ENc1F+1Wf1pwIa3zlteq/t99fZjJI37rwLB/udDoIZaGFPdLHQIHWYE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673760797717.6542291727563; Wed, 18 Dec 2019 04:56:00 -0800 (PST) Received: from localhost ([::1]:53806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYrt-0002kM-KD for importer@patchew.org; Wed, 18 Dec 2019 07:55:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57275) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3x-0007QR-3S for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3v-0003ij-FT for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:20 -0500 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:40972) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3v-0003ao-5M for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:19 -0500 Received: by mail-wr1-x442.google.com with SMTP id c9so2002162wrw.8 for ; Wed, 18 Dec 2019 04:04:18 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:16 -0800 (PST) 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=oWlQxy3gHFTwYR2OAKyR7heGQKIg7ID0fB2XfRVmZV0=; b=VAFtmbG1WmEbcoy3vxWyuytJK8xTNRjZ3LPZmlxs4bNP17hyqUAYSK04S46ixZenOQ l4WAw1NHT9rafXGePdqZCUW2OFy2M+jBOW3OZc9NIIlNO48HZMxSP0cCCSPhnzZWv08U ZJAt3jvxTHrfKq37P7IbKhWpEf80PPoTZkZoN5+GgycqhBqV3Qx+5SrXW4g8acbOjrvv XXbKLbilJnhZu/pRVXWz8q8PawgL6Q9apxthW1bhWFAU8WF/jSooShqm4T2Lw0/LsdAw GFlK5F3tuA/n2siBvkx68whLf9ygks193af8qQn8Ew/W/XPbu5g/QxblV+8utjRmutHO 6UeA== 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=oWlQxy3gHFTwYR2OAKyR7heGQKIg7ID0fB2XfRVmZV0=; b=twvufvffqheUJiqOz5t072rlAM6aWHLDKOgeKlp28ZWk87bRA09oIfCMErbcv9cYHl cAZESep8rhBmSawyPeNzKF8HtMgQPUh64t2zed1XqyXIvE/KyQEYi/Da0litrNoPUEuS AsGgjgWu6wzUAsNJcEALasym723KmzdIWti5Jgzh8SqrkyS0ah13GfDMWcR5ShZmg/CR iBQRm+2tgpDDSolHCpc3Y+OZbWCd6SyCdXl1mC5XoQj8fgymzP0scjuKpDqz/Wrlmb4o Vg8oNih83nEfs/3fSFe0B28LlBPd0hoFeYqXJjywnxu3flGmH/U3o+7s5Mq2UkvkCsBb ZGqg== X-Gm-Message-State: APjAAAX+APdd4oQ4S04tzBXdKyFe+po0DcwKXU6bxyf/GM6kDVAIW4jM oaOhRK5h4sEGoP4rH9yzGiPoWT9j X-Google-Smtp-Source: APXvYqyP29bwoVRnmYf5nsse0VFydatCcPFA+YCLCC3tbR3L9s+fhUFv3rntzcKIHhkkwSmrCx3SgQ== X-Received: by 2002:a5d:5403:: with SMTP id g3mr2494282wrv.302.1576670656716; Wed, 18 Dec 2019 04:04:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 74/87] WHPX: refactor load library Date: Wed, 18 Dec 2019 13:02:40 +0100 Message-Id: <1576670573-48048-75-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::442 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sunil Muthuswamy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sunil Muthuswamy This refactors the load library of WHV libraries to make it more modular. It makes a helper routine that can be called on demand. This allows future expansion of load library/functions to support functionality that is dependent on some feature being available. Signed-off-by: Sunil Muthuswamy Message-Id: Signed-off-by: Paolo Bonzini --- target/i386/whp-dispatch.h | 4 +++ target/i386/whpx-all.c | 85 +++++++++++++++++++++++++++++++-----------= ---- 2 files changed, 62 insertions(+), 27 deletions(-) diff --git a/target/i386/whp-dispatch.h b/target/i386/whp-dispatch.h index 23791fb..87d049c 100644 --- a/target/i386/whp-dispatch.h +++ b/target/i386/whp-dispatch.h @@ -50,5 +50,9 @@ extern struct WHPDispatch whp_dispatch; =20 bool init_whp_dispatch(void); =20 +typedef enum WHPFunctionList { + WINHV_PLATFORM_FNS_DEFAULT, + WINHV_EMULATION_FNS_DEFAULT, +} WHPFunctionList; =20 #endif /* WHP_DISPATCH_H */ diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index def0c28..3ed2aa1 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -1356,6 +1356,58 @@ static void whpx_handle_interrupt(CPUState *cpu, int= mask) } =20 /* + * Load the functions from the given library, using the given handle. If a + * handle is provided, it is used, otherwise the library is opened. The + * handle will be updated on return with the opened one. + */ +static bool load_whp_dispatch_fns(HMODULE *handle, + WHPFunctionList function_list) +{ + HMODULE hLib =3D *handle; + + #define WINHV_PLATFORM_DLL "WinHvPlatform.dll" + #define WINHV_EMULATION_DLL "WinHvEmulation.dll" + #define WHP_LOAD_FIELD(return_type, function_name, signature) \ + whp_dispatch.function_name =3D \ + (function_name ## _t)GetProcAddress(hLib, #function_name); \ + if (!whp_dispatch.function_name) { \ + error_report("Could not load function %s", #function_name); \ + goto error; \ + } \ + + #define WHP_LOAD_LIB(lib_name, handle_lib) \ + if (!handle_lib) { \ + handle_lib =3D LoadLibrary(lib_name); \ + if (!handle_lib) { \ + error_report("Could not load library %s.", lib_name); \ + goto error; \ + } \ + } \ + + switch (function_list) { + case WINHV_PLATFORM_FNS_DEFAULT: + WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) + LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) + break; + + case WINHV_EMULATION_FNS_DEFAULT: + WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) + LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) + break; + } + + *handle =3D hLib; + return true; + +error: + if (hLib) { + FreeLibrary(hLib); + } + + return false; +} + +/* * Partition support */ =20 @@ -1490,51 +1542,30 @@ static void whpx_type_init(void) =20 bool init_whp_dispatch(void) { - const char *lib_name; - HMODULE hLib; - if (whp_dispatch_initialized) { return true; } =20 - #define WHP_LOAD_FIELD(return_type, function_name, signature) \ - whp_dispatch.function_name =3D \ - (function_name ## _t)GetProcAddress(hLib, #function_name); \ - if (!whp_dispatch.function_name) { \ - error_report("Could not load function %s from library %s.", \ - #function_name, lib_name); \ - goto error; \ - } \ - - lib_name =3D "WinHvPlatform.dll"; - hWinHvPlatform =3D LoadLibrary(lib_name); - if (!hWinHvPlatform) { - error_report("Could not load library %s.", lib_name); + if (!load_whp_dispatch_fns(&hWinHvPlatform, WINHV_PLATFORM_FNS_DEFAULT= )) { goto error; } - hLib =3D hWinHvPlatform; - LIST_WINHVPLATFORM_FUNCTIONS(WHP_LOAD_FIELD) =20 - lib_name =3D "WinHvEmulation.dll"; - hWinHvEmulation =3D LoadLibrary(lib_name); - if (!hWinHvEmulation) { - error_report("Could not load library %s.", lib_name); + if (!load_whp_dispatch_fns(&hWinHvEmulation, WINHV_EMULATION_FNS_DEFAU= LT)) { goto error; } - hLib =3D hWinHvEmulation; - LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) =20 whp_dispatch_initialized =3D true; - return true; - - error: =20 + return true; +error: if (hWinHvPlatform) { FreeLibrary(hWinHvPlatform); } + if (hWinHvEmulation) { FreeLibrary(hWinHvEmulation); } + return false; } =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673879; cv=none; d=zohomail.com; s=zohoarc; b=dtxmGL+YLZkdGNG5Vd2jMEnHlONEznjJ8D5voc83qHdHcbqe+t1a71600ZrHyColR7qn+5kRxtpDfcCj5iV73f+llZsaP7ytCMxPTJqTt4BLVEJ1gVT0dD+cWh2K5BE3DRJRQnLAv5sVTayCRL5Mk3Zwje2zMnpyn7jP6BJae8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673879; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xoiVKpP9hu9WCjJ4oCdzKyi18D0F4vTbBwktrThFJeE=; b=n37/p/a61N+30z+R9JtPdGayojHsIar0Q/dO+vLiuR437Tcz4jS2Jw5HGyFViuuuJe7RkQCcnP3oLviQ3SPf1JBClWLgcAhQzU2CNFxFPfT3fvGwA3eITuKoEtA4392owiLWXjvRGCfYh+r4oWKum1KnsoIrbESaP8OdjZImik0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673879327463.3022146037338; Wed, 18 Dec 2019 04:57:59 -0800 (PST) Received: from localhost ([::1]:53834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYtp-0005lI-Nq for importer@patchew.org; Wed, 18 Dec 2019 07:57:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57329) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3x-0007Ql-Eb for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3v-0003ik-FE for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:21 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38576) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3v-0003ej-4Z; Wed, 18 Dec 2019 07:04:19 -0500 Received: by mail-wr1-x42a.google.com with SMTP id y17so2013266wrh.5; Wed, 18 Dec 2019 04:04:19 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:17 -0800 (PST) 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=xoiVKpP9hu9WCjJ4oCdzKyi18D0F4vTbBwktrThFJeE=; b=YJ/uJLWBZxg8la5DghZ0zMXGKR5HMj1GVEIdeEtmw33/h0A01X1zSkGPSJhiAo/QnC iYpPkAZRjlMuW2tsAAhfwgKl86G+qkz30RLZz3x1mbZiwcvxsvc0YZS6PeIXkwqYYo8X v+D1whVCvQkpiYVTKzhvOlXlJRHKEv/aGJ35OLOC3Ezi2f3qY16HUZFhCELSGVqcyVHa txTmgBaR7UhCy5eltJGFF+4gh254h+IxpQO1xZRWqXbCsxZf5HBswWjrgRBxUFJI7ciF xxCi8q/tzsiYewZ/5IoOtqbXVXZd6XtSR1X/QAWde2t6XVFAaXFgXHFHl4i11CeXjRQT V7Cw== 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=xoiVKpP9hu9WCjJ4oCdzKyi18D0F4vTbBwktrThFJeE=; b=JJKf7Ul9x3dDIudosdgIn+UnSN+Y8nsxwDeLwTb9Uu0egEpQB66YtNqO9HEMQsJPHq ksmm/0ZcK9q8hpHJiAfZfxBKtqMgz239WnraPncm8hSEhtVGX0zmHMTiDbqu0OJljgPN 2F7KWC8DDPu4ljJOAbN6CoPx1JHksqeB3aPT1kKUg3QoDetuOOT2SevvDyDvjYgwphDC 9aQtv4qnTJdwZ2tBOaBbash0qHiq5AmZdHqftj1fdLNziJnJrZzSJyS6UrQMsLjmDSjO u6FVs7gHWzmK724XQmTv9u4RU86Ai/ZKjaCElo1KSFkjceudT0AmX1o+kNZv048Fzsb1 H2Bg== X-Gm-Message-State: APjAAAUS5dwll4wueu4r05dDfDUITYEYGRA8U23WLhdSDbwLx5q2pHsN sABUeLYV5NBbgOypP9YEMMlKi+6k X-Google-Smtp-Source: APXvYqyp14ZH+erO5k4m5jU7LCGriOlnOIxoJRZ9U9/WBknXiG8DLtoyeYIL01UWssLyDgh6SJ9uqA== X-Received: by 2002:adf:f508:: with SMTP id q8mr2449904wro.334.1576670657870; Wed, 18 Dec 2019 04:04:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 75/87] target/i386: remove unused pci-assign codes Date: Wed, 18 Dec 2019 13:02:41 +0100 Message-Id: <1576670573-48048-76-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-trivial@nongnu.org, Eiichi Tsukata Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eiichi Tsukata Legacy PCI device assignment has been already removed in commit ab37bfc7d641 ("pci-assign: Remove"), but some codes remain unused. CC: qemu-trivial@nongnu.org Signed-off-by: Eiichi Tsukata Message-Id: <20191209072932.313056-1-devel@etsukata.com> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 140 ---------------------------------------------= ---- target/i386/kvm_i386.h | 20 ------- 2 files changed, 160 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 55e6265..0b51190 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -4512,146 +4512,6 @@ int kvm_arch_irqchip_create(KVMState *s) } } =20 -/* Classic KVM device assignment interface. Will remain x86 only. */ -int kvm_device_pci_assign(KVMState *s, PCIHostDeviceAddress *dev_addr, - uint32_t flags, uint32_t *dev_id) -{ - struct kvm_assigned_pci_dev dev_data =3D { - .segnr =3D dev_addr->domain, - .busnr =3D dev_addr->bus, - .devfn =3D PCI_DEVFN(dev_addr->slot, dev_addr->function), - .flags =3D flags, - }; - int ret; - - dev_data.assigned_dev_id =3D - (dev_addr->domain << 16) | (dev_addr->bus << 8) | dev_data.devfn; - - ret =3D kvm_vm_ioctl(s, KVM_ASSIGN_PCI_DEVICE, &dev_data); - if (ret < 0) { - return ret; - } - - *dev_id =3D dev_data.assigned_dev_id; - - return 0; -} - -int kvm_device_pci_deassign(KVMState *s, uint32_t dev_id) -{ - struct kvm_assigned_pci_dev dev_data =3D { - .assigned_dev_id =3D dev_id, - }; - - return kvm_vm_ioctl(s, KVM_DEASSIGN_PCI_DEVICE, &dev_data); -} - -static int kvm_assign_irq_internal(KVMState *s, uint32_t dev_id, - uint32_t irq_type, uint32_t guest_irq) -{ - struct kvm_assigned_irq assigned_irq =3D { - .assigned_dev_id =3D dev_id, - .guest_irq =3D guest_irq, - .flags =3D irq_type, - }; - - if (kvm_check_extension(s, KVM_CAP_ASSIGN_DEV_IRQ)) { - return kvm_vm_ioctl(s, KVM_ASSIGN_DEV_IRQ, &assigned_irq); - } else { - return kvm_vm_ioctl(s, KVM_ASSIGN_IRQ, &assigned_irq); - } -} - -int kvm_device_intx_assign(KVMState *s, uint32_t dev_id, bool use_host_msi, - uint32_t guest_irq) -{ - uint32_t irq_type =3D KVM_DEV_IRQ_GUEST_INTX | - (use_host_msi ? KVM_DEV_IRQ_HOST_MSI : KVM_DEV_IRQ_HOST_INTX); - - return kvm_assign_irq_internal(s, dev_id, irq_type, guest_irq); -} - -int kvm_device_intx_set_mask(KVMState *s, uint32_t dev_id, bool masked) -{ - struct kvm_assigned_pci_dev dev_data =3D { - .assigned_dev_id =3D dev_id, - .flags =3D masked ? KVM_DEV_ASSIGN_MASK_INTX : 0, - }; - - return kvm_vm_ioctl(s, KVM_ASSIGN_SET_INTX_MASK, &dev_data); -} - -static int kvm_deassign_irq_internal(KVMState *s, uint32_t dev_id, - uint32_t type) -{ - struct kvm_assigned_irq assigned_irq =3D { - .assigned_dev_id =3D dev_id, - .flags =3D type, - }; - - return kvm_vm_ioctl(s, KVM_DEASSIGN_DEV_IRQ, &assigned_irq); -} - -int kvm_device_intx_deassign(KVMState *s, uint32_t dev_id, bool use_host_m= si) -{ - return kvm_deassign_irq_internal(s, dev_id, KVM_DEV_IRQ_GUEST_INTX | - (use_host_msi ? KVM_DEV_IRQ_HOST_MSI : KVM_DEV_IRQ_HOST_INTX)); -} - -int kvm_device_msi_assign(KVMState *s, uint32_t dev_id, int virq) -{ - return kvm_assign_irq_internal(s, dev_id, KVM_DEV_IRQ_HOST_MSI | - KVM_DEV_IRQ_GUEST_MSI, virq); -} - -int kvm_device_msi_deassign(KVMState *s, uint32_t dev_id) -{ - return kvm_deassign_irq_internal(s, dev_id, KVM_DEV_IRQ_GUEST_MSI | - KVM_DEV_IRQ_HOST_MSI); -} - -bool kvm_device_msix_supported(KVMState *s) -{ - /* The kernel lacks a corresponding KVM_CAP, so we probe by calling - * KVM_ASSIGN_SET_MSIX_NR with an invalid parameter. */ - return kvm_vm_ioctl(s, KVM_ASSIGN_SET_MSIX_NR, NULL) =3D=3D -EFAULT; -} - -int kvm_device_msix_init_vectors(KVMState *s, uint32_t dev_id, - uint32_t nr_vectors) -{ - struct kvm_assigned_msix_nr msix_nr =3D { - .assigned_dev_id =3D dev_id, - .entry_nr =3D nr_vectors, - }; - - return kvm_vm_ioctl(s, KVM_ASSIGN_SET_MSIX_NR, &msix_nr); -} - -int kvm_device_msix_set_vector(KVMState *s, uint32_t dev_id, uint32_t vect= or, - int virq) -{ - struct kvm_assigned_msix_entry msix_entry =3D { - .assigned_dev_id =3D dev_id, - .gsi =3D virq, - .entry =3D vector, - }; - - return kvm_vm_ioctl(s, KVM_ASSIGN_SET_MSIX_ENTRY, &msix_entry); -} - -int kvm_device_msix_assign(KVMState *s, uint32_t dev_id) -{ - return kvm_assign_irq_internal(s, dev_id, KVM_DEV_IRQ_HOST_MSIX | - KVM_DEV_IRQ_GUEST_MSIX, 0); -} - -int kvm_device_msix_deassign(KVMState *s, uint32_t dev_id) -{ - return kvm_deassign_irq_internal(s, dev_id, KVM_DEV_IRQ_GUEST_MSIX | - KVM_DEV_IRQ_HOST_MSIX); -} - int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, uint64_t address, uint32_t data, PCIDevice *d= ev) { diff --git a/target/i386/kvm_i386.h b/target/i386/kvm_i386.h index 06fe06b..7d0242f 100644 --- a/target/i386/kvm_i386.h +++ b/target/i386/kvm_i386.h @@ -40,26 +40,6 @@ void kvm_synchronize_all_tsc(void); void kvm_arch_reset_vcpu(X86CPU *cs); void kvm_arch_do_init_vcpu(X86CPU *cs); =20 -int kvm_device_pci_assign(KVMState *s, PCIHostDeviceAddress *dev_addr, - uint32_t flags, uint32_t *dev_id); -int kvm_device_pci_deassign(KVMState *s, uint32_t dev_id); - -int kvm_device_intx_assign(KVMState *s, uint32_t dev_id, - bool use_host_msi, uint32_t guest_irq); -int kvm_device_intx_set_mask(KVMState *s, uint32_t dev_id, bool masked); -int kvm_device_intx_deassign(KVMState *s, uint32_t dev_id, bool use_host_m= si); - -int kvm_device_msi_assign(KVMState *s, uint32_t dev_id, int virq); -int kvm_device_msi_deassign(KVMState *s, uint32_t dev_id); - -bool kvm_device_msix_supported(KVMState *s); -int kvm_device_msix_init_vectors(KVMState *s, uint32_t dev_id, - uint32_t nr_vectors); -int kvm_device_msix_set_vector(KVMState *s, uint32_t dev_id, uint32_t vect= or, - int virq); -int kvm_device_msix_assign(KVMState *s, uint32_t dev_id); -int kvm_device_msix_deassign(KVMState *s, uint32_t dev_id); - void kvm_put_apicbase(X86CPU *cpu, uint64_t value); =20 bool kvm_enable_x2apic(void); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674041; cv=none; d=zohomail.com; s=zohoarc; b=BYHE+4ldiLgoKuPW+UGz3C0qhP3nmiPTMH3zS8ODP8ZdCOvovOZoZ+y1DA/Xoscl4Fq7NDYk5ou79VGikXrncOQk34a6KvFO3xIWcHENJFplUw6p/nddMMXkoGSng3FhjBQKKv/BgnjlfGEW+mBSCCzBLSZFCtq+8dJHxrtrpuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674041; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=0G5D0ozjbHj5sAqDM4QYNat78/7TY1w8UX8v8w/OBsk=; b=K/VxaTgBxadc8jUfyHmScZdGYN4m/0X6q6eIJH7UosFwUM5/4pf9yCD58Vby/wjg3T9+N/k9nC6IhEaTbVbotAmRnOKUldSlSnb/Ea1RrjJfQAHGRS3T0Z470gAwy96hz0wuHet62IS5Gz/n7RdP/uD+tu5DHYTmv3s6ehBt+lw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674041153289.9794272838551; Wed, 18 Dec 2019 05:00:41 -0800 (PST) Received: from localhost ([::1]:53862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYwR-0000Ro-Jk for importer@patchew.org; Wed, 18 Dec 2019 08:00:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57511) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3y-0007S2-C1 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3w-0003nm-PB for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:22 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:36029) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3w-0003kB-G4 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:20 -0500 Received: by mail-wm1-x343.google.com with SMTP id p17so1622249wma.1 for ; Wed, 18 Dec 2019 04:04:20 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:18 -0800 (PST) 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=0G5D0ozjbHj5sAqDM4QYNat78/7TY1w8UX8v8w/OBsk=; b=BKdL18c7czG/3xjwhDSrZp/ZzKXZ28lSa1V3d9DP4+mCxWJejAuCivVYqWy2yBONLk We7tvBXfig52phPpYnoUC2wiC3Qen24GT1Tb6S7611BmIG6zK6RmScRVyezfHtZF7lex hqZkxw4OTyUBpjsuOliqv/pzn6OmWcxIvGs2bqGtwgQwQNkI9IAJg9/EInY5TobuSP8c 0v2IPAraiREaKk8TJTGeVMpf1u88t7vv3zhM7/F5yghPuWAe6WK4/vzH5119L3kD6j5I Y5xkcE+eMaOKa0R4OaltHjZqkPCPYxS3OCtbqIrb+qVDpi9Aa+rGD7aITRas5bOy3SMy mqjQ== 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=0G5D0ozjbHj5sAqDM4QYNat78/7TY1w8UX8v8w/OBsk=; b=m59WvFx/HDJoE7vd+WU6Iw3Xr1ojBm1x97LYKjhWq0sLC+pZjoa0hZlGolFA5HjapY 2wZ9Dfsmcv/73A4OnQDJbsTASOc8V6TAVg71QY012/HN3j1dDGcdR1JcOuAiYnULNSDh vjjdFMezOApYyUmGREqGIG4ttGwhruMnmBFFFO7V/B3d30AMvLpJALezEyjOVE+ZkJkb xDl3uj5yReqKcmaZephPLbxeSHhlHmGSmJhE06PBrMA7E7YWYA0QKW/jeC+RUzPDZogY J/66FgDIJu0UazOtzMhUVP6TmhuDQlkW3ntgJ1M8TtUVpIdb+2ezpnc1g/CbUM0cmIAL t9pw== X-Gm-Message-State: APjAAAVMLf+2mjR/FqPelAQbLEVE3+4jVTmxYIxhQPEattNn6sRrCtCP RHFip1G8ZDVPPkjBqOtfoXQoxN6B X-Google-Smtp-Source: APXvYqxwKOo7DrrNMdzXevWWUh1hU3KTPdRJfbFrViw5UsR7+XxxoTqrJN+LymYMXjQW37sv6MOVdw== X-Received: by 2002:a05:600c:20c7:: with SMTP id y7mr2945346wmm.21.1576670659252; Wed, 18 Dec 2019 04:04:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 76/87] Fix some comment spelling errors. Date: Wed, 18 Dec 2019 13:02:42 +0100 Message-Id: <1576670573-48048-77-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cameron Esfahani Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Cameron Esfahani Signed-off-by: Cameron Esfahani Message-Id: <086c197db928384b8697edfa64755e2cb46c8100.1575685843.git.dirty@= apple.com> Reviewed-by: Stefan Weil Signed-off-by: Paolo Bonzini --- target/i386/machine.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/machine.c b/target/i386/machine.c index b6720d8..0c96531 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -261,7 +261,7 @@ static int cpu_pre_save(void *opaque) * intercepted anymore. * * Furthermore, when a L2 exception is intercepted by L1 - * hypervisor, it's exception payload (CR2/DR6 on #PF/#DB) + * hypervisor, its exception payload (CR2/DR6 on #PF/#DB) * should not be set yet in the respective vCPU register. * Thus, in case an exception is pending, it is * important to save the exception payload seperately. @@ -271,9 +271,9 @@ static int cpu_pre_save(void *opaque) * distinguish between a pending and injected exception * and we don't need to store seperately the exception payload. * - * In order to preserve better backwards-compatabile migration, + * In order to preserve better backwards-compatible migration, * convert a pending exception to an injected exception in - * case it is not important to distingiush between them + * case it is not important to distinguish between them * as described above. */ if (env->exception_pending && !(env->hflags & HF_GUEST_MASK)) { @@ -415,7 +415,7 @@ static bool exception_info_needed(void *opaque) =20 /* * It is important to save exception-info only in case - * we need to distingiush between a pending and injected + * we need to distinguish between a pending and injected * exception. Which is only required in case there is a * pending exception and vCPU is running L2. * For more info, refer to comment in cpu_pre_save(). --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674163; cv=none; d=zohomail.com; s=zohoarc; b=mmfg0tCUWJuO71DHUL06oTrcD6UBGp0Ceo5bAkfI4cEuWJx6pD2iLSrHF9Pte2iiBe5o5D5lgT/Gt/I8utIpfLI6NKFXAXYioTz59P0Sio+HQP71FeQnx6shTqq2AnnTULtoGlrwnow59OO3QDg7EBIk4HjJiUgnLCXLJudxjiw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674163; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+3NmuoiiOR4K6FlJJ+4sxocF9vH1N56yvHdXlcbt7s0=; b=IEDCT+F8XI8sFvKy1tX2ErRYsg/AZ/CSUJc+fES1zC2IBNqJSh94WzonDucrRQN9zU8oFQMw7ZuQfpSH6Y2B0SJKMZLgrLmZLd1dsVdxmt6dIo0kmWZE484EHlaDWJ5EoTOOPiJtMzh77fBMLTLGU8oo8U0j4mboC2/YmFHT4Tw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674163889410.38348917136057; Wed, 18 Dec 2019 05:02:43 -0800 (PST) Received: from localhost ([::1]:53934 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYyP-0002lW-WE for importer@patchew.org; Wed, 18 Dec 2019 08:02:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57633) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3z-0007Sn-2D for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3x-0003rb-Td for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:22 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39539) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3x-0003ny-Hl for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:21 -0500 Received: by mail-wm1-x332.google.com with SMTP id 20so1485214wmj.4 for ; Wed, 18 Dec 2019 04:04:21 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:19 -0800 (PST) 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=+3NmuoiiOR4K6FlJJ+4sxocF9vH1N56yvHdXlcbt7s0=; b=QejMMHHB97lxBKsD0u/CCrHMpcIW1W8wwX5PYp1wmUksDIJKFwbnUTM0KW7Rh59Mvw XFbWfN4onuG5NkCtOdloiVMVqaX/91FOdd1DCOy7ep+rOt2/GA7PmLQRznf1S2YmfGfD nlh1rcfNX1a9tDPXFGPPSo3MNSN+BvQC/EenThnPCWL/HiIwDxXiP0PFsGvVwlgyrWOj XrEweoyJP2/TGGuyyRQbT27L2TN0pB7biebvIA4XF6enX1nk19FSKKprsqHSCWq1Nyhy EKmaM4dKq5C6ZYciOVdnxIWGvABjrmqSyVMvaSk2h5/DpAhDEyOtRZvXVos0P1TK+iAO kKyA== 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=+3NmuoiiOR4K6FlJJ+4sxocF9vH1N56yvHdXlcbt7s0=; b=J/NRinzIOz2T/QtIYMFwQ4tPhD3jeySV+DrxN8/WUmfPZSUXcValo3LIbIOG1Aj7t+ zV8JaMLpiE+zWxfubHtMT5enFfHFPoOjooZ86LulXGJ6/BYH5mLFeRL5hnczjKiK8MxW OZiJQuYssaz+Xo7Hu+wzJKsjV/BXABNCCp364W/13Ni2gwsMr9iQFIe4y38YqhfuBMzB hmDoV5YHaZ3a5sikTZeyUb75g+W/Km+3Tj48jc+pj+Ohm6N+BRR4n0yGXs3a1XHOZTlC eYXvFewZ4xQkNSWFz/hv5FngAxlpWglS/CJDbqMNpuZIhSw1QQ17aCAE3trXwRlmahfN w4qw== X-Gm-Message-State: APjAAAU+hKZmqSp8dH7ks/NPNT6m2XvtnIxx3NLuEJf9Is9OEyfq6AT3 z99PkUKmfyX+fldnhhZZYhUyt2gV X-Google-Smtp-Source: APXvYqzQ20VgKws9PDX1GHC5VtZm1UzClNUMjIYOUfV0NUOhLO1dzl/VhxE4SMqhP2R+uSv+b1DAJw== X-Received: by 2002:a7b:c936:: with SMTP id h22mr2729219wml.115.1576670660057; Wed, 18 Dec 2019 04:04:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 77/87] hw/pci-host/i440fx: Correct the header description Date: Wed, 18 Dec 2019 13:02:43 +0100 Message-Id: <1576670573-48048-78-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::332 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Missed during the refactor in commits 14a026dd58 and 0f25d865a, this file is now only about the i440FX chipset. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20191209095002.32194-2-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- hw/pci-host/i440fx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index f271311..3fc9442 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -1,5 +1,5 @@ /* - * QEMU i440FX/PIIX3 PCI Bridge Emulation + * QEMU i440FX PCI Bridge Emulation * * Copyright (c) 2006 Fabrice Bellard * --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674233; cv=none; d=zohomail.com; s=zohoarc; b=jKxRXQ2/5KQF1uhw0IiWX3Z3dADCfV22vhleS/9a6weIdU6G0fhQXoPDQ0ujp3gTm+xramOfw/yj4sMl9JYX55ii51lY53TF3m2EgrrWuPn2h6emghV9B0YzxnkQvMDcZaYFs4SOGE94H2aHXwUDYvOCQCVRZFuWv+J26foFKvk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674233; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9X2hwIcj1HfDRf0oxNBJGWqhVs/TtZghOe20kMkyMnU=; b=TR8g7tjSGzapUZnzOlcaAP/Dxfb6GHpAevE0tPtTzbDg6BxwEWmDqOPxpu1BCPgfU5zP4Wc4Px2Cz61jISQqq0IgsOYlLlT2a5HN+851Z36GSDeQN3V61t4JBpKiodCpoUJX9NQ5ucIufHna/UWTizjJb91Q7AQ0GxyLsHQlXcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674233657302.53736624703834; Wed, 18 Dec 2019 05:03:53 -0800 (PST) Received: from localhost ([::1]:53950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYzX-0004u4-SC for importer@patchew.org; Wed, 18 Dec 2019 08:03:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57817) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY3z-0007U5-ST for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3y-0003u3-FP for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:23 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:37406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3y-0003qW-5T for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:22 -0500 Received: by mail-wr1-x42b.google.com with SMTP id w15so2021378wru.4 for ; Wed, 18 Dec 2019 04:04:22 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:20 -0800 (PST) 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=9X2hwIcj1HfDRf0oxNBJGWqhVs/TtZghOe20kMkyMnU=; b=Dn7qkoTmDoUzeKuFtsG+cWcMUN6DDzC1jO2ABvt5EOX15rOezvx7A5am6XK+/rUgVl btsUHy5SuPcaKHi2cNitTyNiR65L8sYEzAHA2gNsni6JE0KfzW/Tw8dhSscpkTvtTO2O yOO/YLSj64btK+L7jwkcuMRr+KhJxQxobz86eYlkSFFmKWOGd/bje8lXYt58ZB/H9h+Z bkyUeEHRlvYFV4sNqBxWZIuwjoJFjB0hm4aRNXiQavxe/otwCFF0+UzEsy20l7tf+uEo dQ1yxI7tdarJkNi3L8MMOReMzs1EI5lpid3LhNNGB9f4o7l9pkPDUVyx3L3gwC2jV64O +WiA== 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=9X2hwIcj1HfDRf0oxNBJGWqhVs/TtZghOe20kMkyMnU=; b=b0m4ESc6jo9zFI/qWJrjeMQVhfDJkf5HAGGEqgFihBWZiTrwosIzHaNCLdmiIknXMS cmNkx7HufW7nfwTIM/q0EMnpuM2ondjIRNlcDwiKZU4OQ0/vWBmM+cjkwhT+49ChQ+TL GzPgq/hCkDvhHGhlX1eqtg8o/23mSXyuA78ckuLFidukMOkulhijnoGdvUmZ+v44I+5J 13iOuWUia8Q0dY9piwwUYMNWn3d3UCBtP77PjQFX+wNdiyBIXlPqW7vCjHazH2pidU3I RO0uAnQ5k2qdyRzD2n+IrbOMqz0C/teF11v0pZSFRtmykBD6flR4XpzhntDMicDTrMbe Qtyw== X-Gm-Message-State: APjAAAWDdyXFuDlkU1lC+uDRiZjSiPFw2zF8QxC5Vtr+sOtTNtLCK32V TF170bt4xaiPIVSyc+IuPcSPm4Jo X-Google-Smtp-Source: APXvYqxdmywXKDo9QTvLUgq3fSKIBzUWEKXbb2M59mu5EPlveScqCXneyGGp19EPOuuq/3JBzds82A== X-Received: by 2002:adf:e984:: with SMTP id h4mr2385793wrm.275.1576670660909; Wed, 18 Dec 2019 04:04:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 78/87] hw/pci-host/i440fx: Extract PCII440FXState to "hw/pci-host/i440fx.h" Date: Wed, 18 Dec 2019 13:02:44 +0100 Message-Id: <1576670573-48048-79-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::42b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Make the PCII440FXState structure public, so it can be used out of this source file. This will allow us to extract the IGD Passthrough Host Bridge, which is a children of the TYPE_I440FX_PCI_DEVICE. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20191209095002.32194-3-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- hw/pci-host/i440fx.c | 18 ------------------ include/hw/pci-host/i440fx.h | 19 +++++++++++++++++-- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 3fc9442..fbdc563 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -31,7 +31,6 @@ #include "hw/sysbus.h" #include "qapi/error.h" #include "migration/vmstate.h" -#include "hw/pci-host/pam.h" #include "qapi/visitor.h" #include "qemu/error-report.h" =20 @@ -51,23 +50,6 @@ typedef struct I440FXState { uint32_t short_root_bus; } I440FXState; =20 -#define I440FX_PCI_DEVICE(obj) \ - OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) - -struct PCII440FXState { - /*< private >*/ - PCIDevice parent_obj; - /*< public >*/ - - MemoryRegion *system_memory; - MemoryRegion *pci_address_space; - MemoryRegion *ram_memory; - PAMMemoryRegion pam_regions[13]; - MemoryRegion smram_region; - MemoryRegion smram, low_smram; -}; - - #define I440FX_PAM 0x59 #define I440FX_PAM_SIZE 7 #define I440FX_SMRAM 0x72 diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h index f54e646..cc58d82 100644 --- a/include/hw/pci-host/i440fx.h +++ b/include/hw/pci-host/i440fx.h @@ -13,12 +13,27 @@ =20 #include "hw/hw.h" #include "hw/pci/pci_bus.h" - -typedef struct PCII440FXState PCII440FXState; +#include "hw/pci-host/pam.h" =20 #define TYPE_I440FX_PCI_HOST_BRIDGE "i440FX-pcihost" #define TYPE_I440FX_PCI_DEVICE "i440FX" =20 +#define I440FX_PCI_DEVICE(obj) \ + OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE) + +typedef struct PCII440FXState { + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ + + MemoryRegion *system_memory; + MemoryRegion *pci_address_space; + MemoryRegion *ram_memory; + PAMMemoryRegion pam_regions[13]; + MemoryRegion smram_region; + MemoryRegion smram, low_smram; +} PCII440FXState; + #define TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE "igd-passthrough-i440FX" =20 PCIBus *i440fx_init(const char *host_type, const char *pci_type, --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673883; cv=none; d=zohomail.com; s=zohoarc; b=HVx5GLYHDvN8F2IsMGlhjHv/0kmajztBFVUsTSnZo5As2kZ2J+bFPw7rZQF6uz2MPFbUrXIpnP2vLDi7QxtvFGLjdPyXsTxnOsuSqGCI3HcHLXEdhlzFaYo0c8RfjqH/CGwf0MVvBv/+IKpZF7hcZpRD/Zywku//iAFiOJjevDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673883; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=x5YkySL2mKW7ugobt1wcSialbS2GyDoRr4H4ExH3cV0=; b=kbC4BevcQnzcVeWUkbtcMhsysHQYl6NGC1pfD8Lebx6EApHHZWS2AmWDObrzlWDa/bT6A4GCsa6wFHgmvq7/h0ctljDYhDN1CWyjQ7gYRkor3C3phvoQ0hd4aQm6T7TD7Qc98JYKMA4HlRkCU0zjjqkD4o//WqT1DPhohkszErs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673883349975.7077350631383; Wed, 18 Dec 2019 04:58:03 -0800 (PST) Received: from localhost ([::1]:53836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYtt-0005wJ-RE for importer@patchew.org; Wed, 18 Dec 2019 07:58:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:57950) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY40-0007Uy-IZ for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY3z-0003y0-9M for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:24 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:36648) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3z-0003td-0j for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:23 -0500 Received: by mail-wr1-x42f.google.com with SMTP id z3so2026703wru.3 for ; Wed, 18 Dec 2019 04:04:22 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:21 -0800 (PST) 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=x5YkySL2mKW7ugobt1wcSialbS2GyDoRr4H4ExH3cV0=; b=p3htYOC7NtF5niJ8rlL3I7KmzXXkvtsi4svvUyVMgQCIDxCCTTMnny27SuDI9vPu5O AMcmJ4dEbXk6GEy7LXrimjykMnkaHHwNO92oKq9qzBPU5JsL/Zgd9HoVqL82Ln8hkbvO gKSg9Tu1N9NQivThAvcuL7gHF9xMQ7D4JhS1hBY1ZDpvcVRaDM++/QB9qmk+cF82AxZU C6ZQAJeSRke+YzsIzGR511AmS0I1ZEur8NzX1zXUnOeOgykqwzFYjiT2Vw2Cp3tZ8i+l hhMDuhSzhEwBx2OKRnpxFiLBFZiwLrSQkEo8B0JFrxCf4rGMR0w1z8+dw/KDkJ5ohzxz uTVA== 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=x5YkySL2mKW7ugobt1wcSialbS2GyDoRr4H4ExH3cV0=; b=s/6tsGZ4SEXDAjwEHicDgE6UJ8nwzoQIQYTQSHEdq0e6YV+5FQkr8cDU25UwQle4DE N+jxEilRwQsO60cOwQcpewePijHRM8F2FEinv145DDA0Z8iIuYnwNcUObscHrvn7bMle AQ17ZIc0w110xPtz/fOnN5XFjhU3rCJgsUVF55hmdstPZToaXRYBRpevPWrdcejqgNSi rJnf3Y116irD46GsfNuOpUuKL48eQ7b1KkHkGjfD0XPyz7gJZv1yRbJMncWu2+10niLp xzZuJrrUtOmPAkXYmjZOciGtC8HAmsqm5xGkmkIPpWa53wtk8cjc0o6/r6jaWFw+JLi3 16yA== X-Gm-Message-State: APjAAAXHGyLyXNw3LluPejPPSb0e3oc0on8lxHq+U96vSVj2jEZkuaYp VyjdI38kqXlo+ZtDeL2dnravVVoS X-Google-Smtp-Source: APXvYqyOHAPfHbUFPSYtK01Q3q/sbNgPqxi/I5tFkMB80eNkau7fv7oyVR/DQH4J1bXE8TsnqeRRpg== X-Received: by 2002:adf:f98c:: with SMTP id f12mr2374977wrr.138.1576670661771; Wed, 18 Dec 2019 04:04:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 79/87] hw/pci-host/i440fx: Use size_t to iterate over ARRAY_SIZE() Date: Wed, 18 Dec 2019 13:02:45 +0100 Message-Id: <1576670573-48048-80-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::42f X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 We don't enforce the -Wsign-conversion CPPFLAG, but it doesn't hurt to avoid this warning: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka '= unsigned long') [-Wsign-conversion] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20191209095002.32194-4-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- hw/pci-host/i440fx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index fbdc563..0cc80b2 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -419,12 +419,11 @@ out: static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) { uint32_t val =3D 0; - int i, num; + size_t i; int pos, len; Error *local_err =3D NULL; =20 - num =3D ARRAY_SIZE(igd_host_bridge_infos); - for (i =3D 0; i < num; i++) { + for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { pos =3D igd_host_bridge_infos[i].offset; len =3D igd_host_bridge_infos[i].len; host_pci_config_read(pos, len, &val, &local_err); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673046; cv=none; d=zohomail.com; s=zohoarc; b=lK8dLLtgUS5Sv15Vi5+ATXeJq7PXfM55VF7kxZ2nUFRnc14k5joqz8yJprcDZEi3ZYcYVru4q5FKaIjcRR2eZyDQHLeKSNS9vNjqTkn7r+LB5yC5uuysDjxJq0zVynMHFQyDvZc2aUKKuqUe0/3qlTpbYfflrT1G92iS+mSk20I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673046; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EfCRPrfO2biQWPtpACUiz6MHo21mxHWi/LuYvOKz/io=; b=NYav9cXltFuhKBGfZKYwgtCXSsyQHIQyTzP3362oFw1g3PDpchDHaPox5/EAfiLc6JxFQhPC8qIvDRyNUcORDVcOo6vmN8rQNwZAZNxxfgMkOPIEf7nn4wSCA+s7/GVTW17T2DM4lqe+MGQwdDEHITl3ZVZod9fuPm2+Wh95+G8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157667304662935.25487947069871; Wed, 18 Dec 2019 04:44:06 -0800 (PST) Received: from localhost ([::1]:53654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYgP-0004qV-54 for importer@patchew.org; Wed, 18 Dec 2019 07:44:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58105) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY41-0007W6-Ce for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY40-00040l-4y for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:25 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:44249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY3z-0003xl-SE for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:24 -0500 Received: by mail-wr1-x436.google.com with SMTP id q10so1987069wrm.11 for ; Wed, 18 Dec 2019 04:04:23 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:22 -0800 (PST) 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=EfCRPrfO2biQWPtpACUiz6MHo21mxHWi/LuYvOKz/io=; b=l3CNsr9XVQOvGzo+iTNPndyIiTg9tSm+V9fvgqXzwbTavnPr3MgW6EtpOGvHajk9x8 vIzBDaEQj0uN+QGUajjohzwjdf0C1D7vrRuNildl9hy+oSTRfklw9OFAYDXNE4+B/yjH oUdGNM/C3MmGisj1Mw3xCNVUQVuOyxD2mq2NPmd+o/S+ASEpQWelCjGFAbJUWeU/uH1h RlEOIzaC4o/TqDlRnJMyrpEa0ZEdPW1jMN1YA1owYM+RtybZlU4q6rd4GnBdZwPfA/nE w7aqRfzfZWJ8LVLJ18EJnYp8pApjA7NxzVVuH+3ZsOz86D/Qsuc9zAwTLYy2ACCeAij6 CqgA== 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=EfCRPrfO2biQWPtpACUiz6MHo21mxHWi/LuYvOKz/io=; b=ivgJmyL4EsDd5+tm+luNIQbpozveaQbDO8qosCQJWzmn+FFB75zduttVRsMvAnTLee OG0val/1ckb/krIMe1McwVJnLbTUvHnbb9wGroMezD7QhBiQvWJdO2ibPEQZpS8qc5jS ZIOlM4Dd/T95w8vIPyEizOSNdQkEXdCrcUtKwkFcclsMcg7oIp1vUubT9rnqJ19KwbZh bGxJiAz/D1KLJYouWxRMMIP9/1HzXFhytZJ7qRorVkSIfj7+5qXxxoIgJ0CP5nXZrmSi bYFzIOM/bzlPMxV8hENrl7bMIBK69m75b3pdCX7GPM4+JdEUptyHRjPq5x4WpZzULs0w VzwQ== X-Gm-Message-State: APjAAAU52R1o2C/OnUhExVL1LK5miqPR6184MvFeALQNyTOUj//3Q+Em lF8YFW1ZyF76kodPmQRacyNG2feI X-Google-Smtp-Source: APXvYqxZUO2zDWWn/2bnhkHn1xZi6ua1ZMHUpSRgwk1f+sbPdc2jn6Q2LGM05qEVusJIxTEA7c7iBA== X-Received: by 2002:a5d:6ac5:: with SMTP id u5mr2436728wrw.271.1576670662551; Wed, 18 Dec 2019 04:04:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 80/87] hw/pci-host/i440fx: Use definitions instead of magic values Date: Wed, 18 Dec 2019 13:02:46 +0100 Message-Id: <1576670573-48048-81-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::436 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Use definitions from "hw/pci/pci_regs.h". This also helps when using git-grep. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Message-Id: <20191209095002.32194-5-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- hw/pci-host/i440fx.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 0cc80b2..4141385 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -376,13 +376,13 @@ typedef struct { =20 /* Here we just expose minimal host bridge offset subset. */ static const IGDHostInfo igd_host_bridge_infos[] =3D { - {0x08, 2}, /* revision id */ - {0x2c, 2}, /* sybsystem vendor id */ - {0x2e, 2}, /* sybsystem id */ - {0x50, 2}, /* SNB: processor graphics control register */ - {0x52, 2}, /* processor graphics control register */ - {0xa4, 4}, /* SNB: graphics base of stolen memory */ - {0xa8, 4}, /* SNB: base of GTT stolen memory */ + {PCI_REVISION_ID, 2}, + {PCI_SUBSYSTEM_VENDOR_ID, 2}, + {PCI_SUBSYSTEM_ID, 2}, + {0x50, 2}, /* SNB: processor graphics control regis= ter */ + {0x52, 2}, /* processor graphics control register */ + {0xa4, 4}, /* SNB: graphics base of stolen memory */ + {0xa8, 4}, /* SNB: base of GTT stolen memory */ }; =20 static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674396; cv=none; d=zohomail.com; s=zohoarc; b=aglharxQysAaF6w8xHvjpHSR9LqneSoj1AE7UXil2HTb0kMiRlmfiX4XSAlPy1zxZKn8iF61bzOyzLLA1CjyXvE1uKIAixeLhTSrFWcEAToT0nQk2sqpUcaChGOQ0Xb5ldFDbATd5Cg3m93XmD8AApTuz93k+O+nPldUy/AG0M4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674396; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BMprzZ05gfG3DwfidaFtIVUxsm/A7BywNPdloh21sNo=; b=bwRrizNl+PMcS1qHWF7hf3BfsaVY6ShZob0KJPhdLMKhaqYaJ7IPMISGpGIWuXaGuagVUMDfuBMvNNSTU0akfHZJmCHu8LfCj2kqkrdSfFdm/3C0j2Kqkqg/CMaADx+EXLcMJtjRqcrbOdM3fYoHI7T/R8b2WU+dPT5HVmwgB/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674396437396.65641861637835; Wed, 18 Dec 2019 05:06:36 -0800 (PST) Received: from localhost ([::1]:53992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ2A-0008PV-Re for importer@patchew.org; Wed, 18 Dec 2019 08:06:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58478) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY43-0007Yl-9U for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY41-000464-9E for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:27 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:37777) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY40-00041i-Tr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:25 -0500 Received: by mail-wm1-x335.google.com with SMTP id f129so1614180wmf.2 for ; Wed, 18 Dec 2019 04:04:24 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:22 -0800 (PST) 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=BMprzZ05gfG3DwfidaFtIVUxsm/A7BywNPdloh21sNo=; b=PwFvLoel5J33QGC9d8RQ1gD4hw05pLh8sL7Z5v8a1arj2hBV5x2bi5R+GNeuSg6S+4 JviRmODY4ejnFyFtycfMvao0Bc3Y1MxoY3VKBkrmyaQu8C0581seGNRnFHjRTOTXChyC PFUsoKgwC+979erTB1IMGOY5hQLc1kKQos4n7infC4JiMu0dtk2wpQikYhTkELGYGXdj WReg6dStNlg5Z/dCLIu/u8D/Q0//RvxZZl5YYp/dOZ9TWVRjua4xqE2xOvYUC93HvB91 eIBMKhddzERsnxNomSYNQaZY9AxDz6FUWZK91c6KhDUMYG7vQOxQ39jK4u2ZYeN0Ifb8 OZiQ== 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=BMprzZ05gfG3DwfidaFtIVUxsm/A7BywNPdloh21sNo=; b=Q/Tjg3giGTTfwxPWk1BqzGRo3irGcH2iM4TUKOvgNvXxb2axAPC6Dh3mh3dkNdnYeM w6zxwQXvFRbt44LsD16yz6DJePrwouz09r8RF21KidMrzyM8A5V3EqYv5z/SEalPLGNo YFyezEJ6x2S6UDK3dNkMxZ1TfVV+GcuTKrYt5q8diLlD/QGIoBAKrA3iIZlvtgEb3CMj g+jnVdea7VBs95bHDMHDE7zQI/RUyZu0jm+mTaTvKG+GVeEAB84mvl1Wi2NRrQgrw167 G245B4KfoMYVYk5pcrM9vl3UlALncpA+LqZ9uKx9Ixk84x62Chqm0L6/hGDl0BKLkaU2 r93g== X-Gm-Message-State: APjAAAViETaAQtcsMucHnAlJNGKFIHkfPi8UmzKYnP/EROG24K6Puf+P exnc4EzElWqxHlIWtp+/M5cZuzBt X-Google-Smtp-Source: APXvYqyV2UzYHZkFX688M5P5cNPdG5G8+JycZfBliQw0UjfEXSwgAFxUwBQL6XHTc7yUboiIaY44oQ== X-Received: by 2002:a7b:c759:: with SMTP id w25mr2963563wmk.15.1576670663622; Wed, 18 Dec 2019 04:04:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 81/87] hw/pci-host/i440fx: Extract the IGD passthrough host bridge device Date: Wed, 18 Dec 2019 13:02:47 +0100 Message-Id: <1576670573-48048-82-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::335 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 We can use a i440FX without the IGD passthrough host bridge. Extract it into a new file, 'hw/pci-host/xen_igd_pt.c'. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20191209095002.32194-6-philmd@redhat.com> Acked-by: Paul Durrant Signed-off-by: Paolo Bonzini --- MAINTAINERS | 1 + hw/pci-host/Makefile.objs | 1 + hw/pci-host/i440fx.c | 84 -------------------------------- hw/pci-host/xen_igd_pt.c | 120 ++++++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 122 insertions(+), 84 deletions(-) create mode 100644 hw/pci-host/xen_igd_pt.c diff --git a/MAINTAINERS b/MAINTAINERS index 740401b..0c36106 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -420,6 +420,7 @@ F: hw/block/dataplane/xen* F: hw/xen/ F: hw/xenpv/ F: hw/i386/xen/ +F: hw/pci-host/xen_igd_pt.c F: include/hw/block/dataplane/xen* F: include/hw/xen/ F: include/sysemu/xen-mapcache.h diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index efd752b..fa6d155 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -14,6 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) +=3D versatile.o common-obj-$(CONFIG_PCI_SABRE) +=3D sabre.o common-obj-$(CONFIG_FULONG) +=3D bonito.o common-obj-$(CONFIG_PCI_I440FX) +=3D i440fx.o +common-obj-$(CONFIG_PCI_I440FX) +=3D xen_igd_pt.o common-obj-$(CONFIG_PCI_EXPRESS_Q35) +=3D q35.o common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) +=3D gpex.o common-obj-$(CONFIG_PCI_EXPRESS_XILINX) +=3D xilinx-pcie.o diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 4141385..bae7b42 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -368,89 +368,6 @@ static const TypeInfo i440fx_info =3D { }, }; =20 -/* IGD Passthrough Host Bridge. */ -typedef struct { - uint8_t offset; - uint8_t len; -} IGDHostInfo; - -/* Here we just expose minimal host bridge offset subset. */ -static const IGDHostInfo igd_host_bridge_infos[] =3D { - {PCI_REVISION_ID, 2}, - {PCI_SUBSYSTEM_VENDOR_ID, 2}, - {PCI_SUBSYSTEM_ID, 2}, - {0x50, 2}, /* SNB: processor graphics control regis= ter */ - {0x52, 2}, /* processor graphics control register */ - {0xa4, 4}, /* SNB: graphics base of stolen memory */ - {0xa8, 4}, /* SNB: base of GTT stolen memory */ -}; - -static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) -{ - int rc, config_fd; - /* Access real host bridge. */ - char *path =3D g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d= /%s", - 0, 0, 0, 0, "config"); - - config_fd =3D open(path, O_RDWR); - if (config_fd < 0) { - error_setg_errno(errp, errno, "Failed to open: %s", path); - goto out; - } - - if (lseek(config_fd, pos, SEEK_SET) !=3D pos) { - error_setg_errno(errp, errno, "Failed to seek: %s", path); - goto out_close_fd; - } - - do { - rc =3D read(config_fd, (uint8_t *)val, len); - } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); - if (rc !=3D len) { - error_setg_errno(errp, errno, "Failed to read: %s", path); - } - -out_close_fd: - close(config_fd); -out: - g_free(path); -} - -static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) -{ - uint32_t val =3D 0; - size_t i; - int pos, len; - Error *local_err =3D NULL; - - for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { - pos =3D igd_host_bridge_infos[i].offset; - len =3D igd_host_bridge_infos[i].len; - host_pci_config_read(pos, len, &val, &local_err); - if (local_err) { - error_propagate(errp, local_err); - return; - } - pci_default_write_config(pci_dev, pos, val, len); - } -} - -static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *da= ta) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); - - k->realize =3D igd_pt_i440fx_realize; - dc->desc =3D "IGD Passthrough Host bridge"; -} - -static const TypeInfo igd_passthrough_i440fx_info =3D { - .name =3D TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE, - .parent =3D TYPE_I440FX_PCI_DEVICE, - .instance_size =3D sizeof(PCII440FXState), - .class_init =3D igd_passthrough_i440fx_class_init, -}; - static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge, PCIBus *rootbus) { @@ -495,7 +412,6 @@ static const TypeInfo i440fx_pcihost_info =3D { static void i440fx_register_types(void) { type_register_static(&i440fx_info); - type_register_static(&igd_passthrough_i440fx_info); type_register_static(&i440fx_pcihost_info); } =20 diff --git a/hw/pci-host/xen_igd_pt.c b/hw/pci-host/xen_igd_pt.c new file mode 100644 index 0000000..efcc934 --- /dev/null +++ b/hw/pci-host/xen_igd_pt.c @@ -0,0 +1,120 @@ +/* + * QEMU Intel IGD Passthrough Host Bridge Emulation + * + * Copyright (c) 2006 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "hw/pci/pci.h" +#include "hw/pci/pci_host.h" +#include "hw/pci-host/i440fx.h" +#include "qapi/error.h" + +typedef struct { + uint8_t offset; + uint8_t len; +} IGDHostInfo; + +/* Here we just expose minimal host bridge offset subset. */ +static const IGDHostInfo igd_host_bridge_infos[] =3D { + {PCI_REVISION_ID, 2}, + {PCI_SUBSYSTEM_VENDOR_ID, 2}, + {PCI_SUBSYSTEM_ID, 2}, + {0x50, 2}, /* SNB: processor graphics control regis= ter */ + {0x52, 2}, /* processor graphics control register */ + {0xa4, 4}, /* SNB: graphics base of stolen memory */ + {0xa8, 4}, /* SNB: base of GTT stolen memory */ +}; + +static void host_pci_config_read(int pos, int len, uint32_t *val, Error **= errp) +{ + int rc, config_fd; + /* Access real host bridge. */ + char *path =3D g_strdup_printf("/sys/bus/pci/devices/%04x:%02x:%02x.%d= /%s", + 0, 0, 0, 0, "config"); + + config_fd =3D open(path, O_RDWR); + if (config_fd < 0) { + error_setg_errno(errp, errno, "Failed to open: %s", path); + goto out; + } + + if (lseek(config_fd, pos, SEEK_SET) !=3D pos) { + error_setg_errno(errp, errno, "Failed to seek: %s", path); + goto out_close_fd; + } + + do { + rc =3D read(config_fd, (uint8_t *)val, len); + } while (rc < 0 && (errno =3D=3D EINTR || errno =3D=3D EAGAIN)); + if (rc !=3D len) { + error_setg_errno(errp, errno, "Failed to read: %s", path); + } + + out_close_fd: + close(config_fd); + out: + g_free(path); +} + +static void igd_pt_i440fx_realize(PCIDevice *pci_dev, Error **errp) +{ + uint32_t val =3D 0; + size_t i; + int pos, len; + Error *local_err =3D NULL; + + for (i =3D 0; i < ARRAY_SIZE(igd_host_bridge_infos); i++) { + pos =3D igd_host_bridge_infos[i].offset; + len =3D igd_host_bridge_infos[i].len; + host_pci_config_read(pos, len, &val, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + pci_default_write_config(pci_dev, pos, val, len); + } +} + +static void igd_passthrough_i440fx_class_init(ObjectClass *klass, void *da= ta) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); + + k->realize =3D igd_pt_i440fx_realize; + dc->desc =3D "IGD Passthrough Host bridge"; +} + +static const TypeInfo igd_passthrough_i440fx_info =3D { + .name =3D TYPE_IGD_PASSTHROUGH_I440FX_PCI_DEVICE, + .parent =3D TYPE_I440FX_PCI_DEVICE, + .instance_size =3D sizeof(PCII440FXState), + .class_init =3D igd_passthrough_i440fx_class_init, +}; + +static void igd_pt_i440fx_register_types(void) +{ + type_register_static(&igd_passthrough_i440fx_info); +} + +type_init(igd_pt_i440fx_register_types) --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674488; cv=none; d=zohomail.com; s=zohoarc; b=Z+mHfWtGouwKYKUiWEJYe+f3++otQLJ+GBqEmHyH0rhcpcJ8qtdaLT8jDPlckDWPrAqkVNmGM17XJpKIrNZStbeEnq1AKjcFIBC7W3nlzHo2AkDVkwodigvuqryj8tXIAr1BJiOVGRuJK2N75GTn0biTiyEXCq532zuLnc6AkhQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674488; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RqZ6EtuRaEedpHWuCxAMFOQ9c7FiAv/LhujsQ09biqY=; b=jHnjFNthF9aCMQLKxKDJh2ZhjkCMCWgRzwaP2rCLdA3nIRBBPu768KIYUt4ogS9UDIuULyRRBs/aMHZEC1iPP8gQEaR1Xc0klD7nm9ZvFyRXWDgj2MczsOFZ+9TFWu6tBGf/nYhVgB9VNTniL83URt1kP/2bPkfHQn0gPBnWO1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674488615524.4347055075866; Wed, 18 Dec 2019 05:08:08 -0800 (PST) Received: from localhost ([::1]:54020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ3f-0002Vi-Ei for importer@patchew.org; Wed, 18 Dec 2019 08:08:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58527) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY43-0007Z5-I3 for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY42-00049s-9e for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:27 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:39541) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY42-000475-1L for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:26 -0500 Received: by mail-wm1-x333.google.com with SMTP id 20so1485472wmj.4 for ; Wed, 18 Dec 2019 04:04:25 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:23 -0800 (PST) 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=RqZ6EtuRaEedpHWuCxAMFOQ9c7FiAv/LhujsQ09biqY=; b=bnUPh49REdb5UYwxnJyJq3R2GGpHWfII7Hl5hO9viXcccHW2FZwV4zKSmCm0+jedbr 5hoRmdxS4stlEgOqNwNUe5ybXMF7s3hyP4XkOqGlyEXNilhTVaJH88wRFqWv5Oi/jj1t 65YxhEGfpCuMS9+pB4/TA0PVhAw3KrbRdBLbf1mSwwzaWolbhCQ2O9xxzX+L/VQTWbOr o7yZ7qKG6oXxnmzD4XQ9kCw+ArbIjW1S4tLx0+w/xR/hJKzk/Vb3qBC3SGVqnZQ8Avkt kSQv7hyanzk9Gna3g5kGydnrOo+NmM7NWt+Rk5ECb+Pan4VKv/11ZySdVxm7b4m91672 +/FQ== 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=RqZ6EtuRaEedpHWuCxAMFOQ9c7FiAv/LhujsQ09biqY=; b=ReAIG7W4po8xK7xW2pUZDZvg60MxOhmqUxrGONxcBtxWW63HAfSQLFRD+uCaD0EELf t3ByeJ1sohMxDh3qyqP7D7R8dj4SoprOxip2naz0FfZFS3T0WNSm0gwkONqy9c0HrNm7 PCiCRX0uQt5HrwQEOrPnifBDGORf9tFH9h/kc0oxIrJKCLmxJl9OnquEkCwb8BIj8qPs WDgRs3AolYpCs2N6Xrk6ovDm/1WMgH5OVvzOelZzfoWuWRz+dRA/AfrAn5ENYacY4/Ec dpFYzFetsnfo5f+UVknFR2iQk52riBp7lGpwkYUVOgaj3V7enCfUhUbX3fQw08+LZjyL EJqQ== X-Gm-Message-State: APjAAAXZ9vD7sKxzUYIJljoYx6bz5cdQWktUtMMGoaj2XlPkIM78fExS ZW+z9YxPR9/NLIHLOGGf8WWeP0n7 X-Google-Smtp-Source: APXvYqwL+K5r9yIeL6/zLurLszf+jK8yLl3+g74D7D3p5YdsM77snXttRg+Ilc0Itzm7qwW7eLLUiQ== X-Received: by 2002:a1c:7d93:: with SMTP id y141mr2957558wmc.111.1576670664758; Wed, 18 Dec 2019 04:04:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 82/87] hw/pci-host: Add Kconfig entry to select the IGD Passthrough Host Bridge Date: Wed, 18 Dec 2019 13:02:48 +0100 Message-Id: <1576670573-48048-83-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::333 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Philippe Mathieu-Daud=C3=A9 Add the XEN_IGD_PASSTHROUGH Kconfig option. Xen build has that option selected by default. Non-Xen builds now have to select this feature manually. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20191209095002.32194-7-philmd@redhat.com> Acked-by: Paul Durrant Signed-off-by: Paolo Bonzini --- hw/pci-host/Kconfig | 5 +++++ hw/pci-host/Makefile.objs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig index b0aa835..9642c77 100644 --- a/hw/pci-host/Kconfig +++ b/hw/pci-host/Kconfig @@ -1,6 +1,11 @@ config PAM bool =20 +config XEN_IGD_PASSTHROUGH + bool + default y + depends on XEN && PCI_I440FX + config PREP_PCI bool select PCI diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs index fa6d155..9c466fa 100644 --- a/hw/pci-host/Makefile.objs +++ b/hw/pci-host/Makefile.objs @@ -14,7 +14,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) +=3D versatile.o common-obj-$(CONFIG_PCI_SABRE) +=3D sabre.o common-obj-$(CONFIG_FULONG) +=3D bonito.o common-obj-$(CONFIG_PCI_I440FX) +=3D i440fx.o -common-obj-$(CONFIG_PCI_I440FX) +=3D xen_igd_pt.o +common-obj-$(CONFIG_XEN_IGD_PASSTHROUGH) +=3D xen_igd_pt.o common-obj-$(CONFIG_PCI_EXPRESS_Q35) +=3D q35.o common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) +=3D gpex.o common-obj-$(CONFIG_PCI_EXPRESS_XILINX) +=3D xilinx-pcie.o --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674704; cv=none; d=zohomail.com; s=zohoarc; b=FS00TUkDj3B3DDGiA0h30/USmuxRQeY5vDnfCh80ZUAzTVNEXN5iz0WZIhVE8+mVHZb46o3r1m6xeZgsz9b8gK4OwiW4YSvS8ca3LWuEt/z94HOsf3Fbh6l26s3ahux5dkH936qHvtG/Gd3RTsdUkeiciJ9nYCngapMUGoC8hko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674704; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=f03cV1xZMlUyzeguprQnKHNJAtwUBVsYj3upmIv2MNo=; b=BrNQccv6IWyePej17d9v+EZ4lrEPWue8oZDmTGYqMyZzeV9vr50M+tsQEYQeUqSsn5yhgQgdo7U2WTX/ZgpDn6HDye90DoK3jcB9pT38ANLhshBRdqdEKxY+jA/iD+mjBsR3k7RIsInU46/y9mAN1HAg0D09EAXjybHVPYY2uDo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674704165132.61318817413894; Wed, 18 Dec 2019 05:11:44 -0800 (PST) Received: from localhost ([::1]:54128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ78-0007SS-Mb for importer@patchew.org; Wed, 18 Dec 2019 08:11:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58861) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY45-0007bG-7i for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY43-0004EI-8c for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:29 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:46600) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY42-0004AE-UA for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:27 -0500 Received: by mail-wr1-x433.google.com with SMTP id z7so1965963wrl.13 for ; Wed, 18 Dec 2019 04:04:26 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:25 -0800 (PST) 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=f03cV1xZMlUyzeguprQnKHNJAtwUBVsYj3upmIv2MNo=; b=C9E/eNuX0u/6KxxqEUSL4OSCf5GM5sRaZW37Sw2bVK9ZQfcXOFOTHSQhr2mqGTY6aJ PQkw1YViEw1ZaI1XJ0Fxae84HVW2VwShRovb7EOE46djkCrVwhS29MZU+VwrfMt9OF10 q+rljaxc1Chch9Gr9p6z1n+Psnv2dvkvJNg4KUGfUi1GvpVSeU7wJtAkql59LOYy1IRg PniQWjZ3fAq+PE1xqUIaxb0yBv2fEnND6hbvnGJ9PwEY8jKLb3upc4IC/mQGN4ZoR/p9 pbjjBWV3xxOlww4ldBFcgwx9gg0PlOWJywZ55jDG7IiU/mvg2Xq/NBiurJ3o/MQ5CCp2 bZGA== 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=f03cV1xZMlUyzeguprQnKHNJAtwUBVsYj3upmIv2MNo=; b=iQsTn7led247ELlS+UgF/w3Nsq69YTpcurM151VUmNxwh9FBlZAhArrT6FZjB/jGyg aUxBqgjrW9oln7SmSKkJSWrMszexLP/X9sb2iltIvJ7TMV33iABRLyGBytHKtdRIu1d1 Jk6aSbq4DSoKnZk8Eqv1J3OwWj8tHJ3ef+hQcsFqVdgEk6oLOm/bZJNgVvZ5ETLqHCuH XRiDAvCKwoavYFxVYaszaRHLWm9ugs5m5nwZHTkYyf+5PkDO5WYhVMbCVdxcndkyhXMd DDxmyG0I11X3GPOytLhNgZbjWAbZ3TwiSLdmEyy7SDJvhYkA4TP3pW2WFVEIHHcX2XQo abLw== X-Gm-Message-State: APjAAAXua+DtvkmfQOfsjQFFG1WhwgGyhoATGAS3EhGAZWzD6LUFf8up KochJleir0vx+VC/DtGo1SDMwgJ0 X-Google-Smtp-Source: APXvYqwYrKy4pDL/rg63/uQw/XxfP1JszfQW8hGIgw7RjuiZyON7hgvye/8FkxnPPfvlZfv2SVzdNA== X-Received: by 2002:a5d:4085:: with SMTP id o5mr2392019wrp.321.1576670665687; Wed, 18 Dec 2019 04:04:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 83/87] hw/i386: Remove the deprecated machines 0.12 up to 0.15 Date: Wed, 18 Dec 2019 13:02:49 +0100 Message-Id: <1576670573-48048-84-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::433 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Thomas Huth These machines can't be used reliably for migration anymore, quoting https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg04516.html : " due to the introduction of the memory API, the firmware is not migrated correctly from source to destination. On QEMU <1.3 the 0xf0000-0xfffff area is basically a copy of the higher 0xffff0000-0xffffffff area, while on more recent versions it is initialized with zeroes and the firmware copies from 0xffff0000 to 0xf0000. When you migrate from old to new QEMU, after reboot there's nothing at 0xf0000 and bugs ensue. " The pc-0.x machines have been marked as deprecated since QEMU v4.0, so it is time to remove them now. And while we're at it, mark the remaining pc-1.x machine types as deprecated now, too, so that we finally only have "pc-i440fx" and "pc-q35" machine types left (apart from the non-versioned "isapc" and "microvm") once we remove them in a couple of releases. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth Message-Id: <20191209125248.5849-2-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/i386/pc_piix.c | 85 ++---------------------------------------------= ---- qemu-deprecated.texi | 2 +- tests/cpu-plug-test.c | 6 +--- 3 files changed, 4 insertions(+), 89 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b3f0304..721c7aa 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -357,19 +357,13 @@ static void pc_compat_1_3(MachineState *machine) pc_compat_1_4_fn(machine); } =20 -/* PC compat function for pc-0.14 to pc-1.2 */ +/* PC compat function for pc-1.0 to pc-1.2 */ static void pc_compat_1_2(MachineState *machine) { pc_compat_1_3(machine); x86_cpu_change_kvm_default("kvm-pv-eoi", NULL); } =20 -/* PC compat function for pc-0.12 and pc-0.13 */ -static void pc_compat_0_13(MachineState *machine) -{ - pc_compat_1_2(machine); -} - static void pc_init_isa(MachineState *machine) { pc_init1(machine, TYPE_I440FX_PCI_HOST_BRIDGE, TYPE_I440FX_PCI_DEVICE); @@ -745,6 +739,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass = *m) =20 pc_i440fx_1_4_machine_options(m); m->hw_version =3D "1.3.0"; + m->deprecation_reason =3D "use a newer machine type instead"; x86mc->compat_apic_id_mode =3D true; compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); } @@ -813,82 +808,6 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2, pc_i440fx_1_0_machine_options); =20 =20 -static void pc_i440fx_0_15_machine_options(MachineClass *m) -{ - static GlobalProperty compat[] =3D { - PC_CPU_MODEL_IDS("0.15") - }; - - pc_i440fx_1_0_machine_options(m); - m->hw_version =3D "0.15"; - m->deprecation_reason =3D "use a newer machine type instead"; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); -} - -DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2, - pc_i440fx_0_15_machine_options); - - -static void pc_i440fx_0_14_machine_options(MachineClass *m) -{ - static GlobalProperty compat[] =3D { - PC_CPU_MODEL_IDS("0.14") - { "virtio-blk-pci", "event_idx", "off" }, - { "virtio-serial-pci", "event_idx", "off" }, - { "virtio-net-pci", "event_idx", "off" }, - { "virtio-balloon-pci", "event_idx", "off" }, - { "qxl", "revision", "2" }, - { "qxl-vga", "revision", "2" }, - }; - - pc_i440fx_0_15_machine_options(m); - m->hw_version =3D "0.14"; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); -} - -DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2, - pc_i440fx_0_14_machine_options); - -static void pc_i440fx_0_13_machine_options(MachineClass *m) -{ - PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); - static GlobalProperty compat[] =3D { - PC_CPU_MODEL_IDS("0.13") - { TYPE_PCI_DEVICE, "command_serr_enable", "off" }, - { "AC97", "use_broken_id", "1" }, - { "virtio-9p-pci", "vectors", "0" }, - { "VGA", "rombar", "0" }, - { "vmware-svga", "rombar", "0" }, - }; - - pc_i440fx_0_14_machine_options(m); - m->hw_version =3D "0.13"; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); - pcmc->kvmclock_enabled =3D false; -} - -DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13, - pc_i440fx_0_13_machine_options); - -static void pc_i440fx_0_12_machine_options(MachineClass *m) -{ - static GlobalProperty compat[] =3D { - PC_CPU_MODEL_IDS("0.12") - { "virtio-serial-pci", "max_ports", "1" }, - { "virtio-serial-pci", "vectors", "0" }, - { "usb-mouse", "serial", "1" }, - { "usb-tablet", "serial", "1" }, - { "usb-kbd", "serial", "1" }, - }; - - pc_i440fx_0_13_machine_options(m); - m->hw_version =3D "0.12"; - compat_props_add(m->compat_props, compat, G_N_ELEMENTS(compat)); -} - -DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13, - pc_i440fx_0_12_machine_options); - typedef struct { uint16_t gpu_device_id; uint16_t pch_device_id; diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index e88f6d1..97ba3cb 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -265,7 +265,7 @@ The 'scsi-disk' device is deprecated. Users should use = 'scsi-hd' or This machine type is very old and unmaintained. Users should use the 'malt= a' machine type instead. =20 -@subsection pc-0.12, pc-0.13, pc-0.14 and pc-0.15 (since 4.0) +@subsection pc-1.0, pc-1.1, pc-1.2 and pc-1.3 (since 5.0) =20 These machine types are very old and likely can not be used for live migra= tion from old QEMU versions anymore. A newer machine type should be used instea= d. diff --git a/tests/cpu-plug-test.c b/tests/cpu-plug-test.c index 30e514b..e8ffbbc 100644 --- a/tests/cpu-plug-test.c +++ b/tests/cpu-plug-test.c @@ -148,11 +148,7 @@ static void add_pc_test_case(const char *mname) (strcmp(mname, "pc-1.3") =3D=3D 0) || (strcmp(mname, "pc-1.2") =3D=3D 0) || (strcmp(mname, "pc-1.1") =3D=3D 0) || - (strcmp(mname, "pc-1.0") =3D=3D 0) || - (strcmp(mname, "pc-0.15") =3D=3D 0) || - (strcmp(mname, "pc-0.14") =3D=3D 0) || - (strcmp(mname, "pc-0.13") =3D=3D 0) || - (strcmp(mname, "pc-0.12") =3D=3D 0)) { + (strcmp(mname, "pc-1.0") =3D=3D 0)) { path =3D g_strdup_printf("cpu-plug/%s/init/%ux%ux%u&maxcpus=3D%u", mname, data->sockets, data->cores, data->threads, data->maxcpus); --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674565; cv=none; d=zohomail.com; s=zohoarc; b=VzAkttSJEP6rjingFRB3HqZAV72gK5tXC6GmYMlzt87AXD1UoCYEzMlj5wM2rNzH7fcIM2wQYEec9XS+yeBIDU8SlvaNnyFXsc41olCyrX+vlPeIN3aWe4nqhWv16dl0h6oN2plaXlurpGl/zWV8OdR6uC5PoaHE+m+Avie+5yw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674565; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4Jcio20l5vVSzyGNtxWMBugfhVYAAbulnAjuFKBNWM4=; b=HqDc2qyFwEyQomhCy39G/V9uY6jSWeh/R8nBzhNHV6egar4PnYC0gsLB9nFp7gq67Ie5Jt6oANRmHmA+e9OV1yY/kDQPZFGuVUDrMts5S1K/4qR8aqil0+7tbRGlzgGOG4aOUl97rdhDWhmq90pxwRVn3hruj4jIUSwvVsPGPmE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674565913175.53983207961858; Wed, 18 Dec 2019 05:09:25 -0800 (PST) Received: from localhost ([::1]:54044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ4u-0004EH-EQ for importer@patchew.org; Wed, 18 Dec 2019 08:09:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58904) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY45-0007bZ-Dz for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY44-0004Ie-Da for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:29 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:53047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY44-0004FT-4W for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:28 -0500 Received: by mail-wm1-x331.google.com with SMTP id p9so1564832wmc.2 for ; Wed, 18 Dec 2019 04:04:28 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:25 -0800 (PST) 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=4Jcio20l5vVSzyGNtxWMBugfhVYAAbulnAjuFKBNWM4=; b=mq5L19V0ZHFuiicTUsfVFMTyM6RuxfHwe0xcELs1xuxKY53/j5EcKh/Fia8ZiJ162M 3LHpVyWYUHk2YxFol1ykdOa39FYil51xs766QZGEj7rnRLnTM6TxC4IfetS/Xra4TFw1 mfX8A91MIl+WabrnFJ5xTpGJz7QNBUPNTT+yaHlBoGQ9bFnG4zorkaGN55IJl3KPm5f5 Rb4CKbeDNG9UL/+kIWumnTMNVguz+U2DEEbeCpxnycKEY1zsqacc+36fOyux45sA9BhD btqY02oEVk4k91iRoxvYetFzlCVYeOEPx7TduSGTi0TCBFwKI2cRgCnBBZsOMwMbyPsa OzYQ== 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=4Jcio20l5vVSzyGNtxWMBugfhVYAAbulnAjuFKBNWM4=; b=FFwT+/Ysb6zaR4qqxaIDrDZ9bjcFOeqj1RTKG54y13Q5l5lUboU9/HHJ74FHM5vnet BYgdNDsy8DXczF074wWrJW0cQ1KHvsRaINAeo63KxTTWDH0Tv9m8z1GL4sKCFY+DW0RK GW4gWKKqb9CvdqALt5rMlHizj67VvXPL7iRctT+JzneK30foAe0nRRdMiRmI2ykDxnpB ZLUXnpENidcAwHkcVShA3MdCewwcyhEgf2EZL2/mrRK8mmh+DuA6jcsoHTU0yb8+2pMJ q++csRBhm9l/sqfKuciQMCLO8rtP8FkOKLwn9Ii6jHRr9J0W1FdRz3E663zQnYpnqYvR ojMw== X-Gm-Message-State: APjAAAWGC1lI9P9dIst6UIFmxM2xMufTpy3sPHeMEzl6KNWnkxff/WBc bh5fts43j7ol6tH82i+DDmwq/WtT X-Google-Smtp-Source: APXvYqxzO5fY0CBPMS2zueh/qSwr65wu3l5iiJfxDJ9iA3p2mCQ6+Dol6NydpK69KoLGgWcxRF40Bg== X-Received: by 2002:a1c:f008:: with SMTP id a8mr2794675wmb.81.1576670666579; Wed, 18 Dec 2019 04:04:26 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 84/87] hw/audio: Remove the "use_broken_id" hack from the AC97 device Date: Wed, 18 Dec 2019 13:02:50 +0100 Message-Id: <1576670573-48048-85-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::331 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) From: Thomas Huth Now that the old pc-0.x machine types are gone, we do not need the "use_broken_id" hack anymore. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Thomas Huth Message-Id: <20191209125248.5849-3-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/audio/ac97.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c index a136b97..78cda88 100644 --- a/hw/audio/ac97.c +++ b/hw/audio/ac97.c @@ -161,7 +161,6 @@ typedef struct AC97BusMasterRegs { typedef struct AC97LinkState { PCIDevice dev; QEMUSoundCard card; - uint32_t use_broken_id; uint32_t glob_cnt; uint32_t glob_sta; uint32_t cas; @@ -1373,13 +1372,6 @@ static void ac97_realize(PCIDevice *dev, Error **err= p) c[PCI_BASE_ADDRESS_0 + 6] =3D 0x00; c[PCI_BASE_ADDRESS_0 + 7] =3D 0x00; =20 - if (s->use_broken_id) { - c[PCI_SUBSYSTEM_VENDOR_ID] =3D 0x86; - c[PCI_SUBSYSTEM_VENDOR_ID + 1] =3D 0x80; - c[PCI_SUBSYSTEM_ID] =3D 0x00; - c[PCI_SUBSYSTEM_ID + 1] =3D 0x00; - } - c[PCI_INTERRUPT_LINE] =3D 0x00; /* intr_ln interrupt line rw */ c[PCI_INTERRUPT_PIN] =3D 0x01; /* intr_pn interrupt pin ro */ =20 @@ -1411,7 +1403,6 @@ static int ac97_init (PCIBus *bus) =20 static Property ac97_properties[] =3D { DEFINE_AUDIO_PROPERTIES(AC97LinkState, card), - DEFINE_PROP_UINT32 ("use_broken_id", AC97LinkState, use_broken_id, 0), DEFINE_PROP_END_OF_LIST (), }; =20 --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674820; cv=none; d=zohomail.com; s=zohoarc; b=iiISScKrRAV8ConbEXA0+ZkFwflPhCuYxAAflQuS+nmrFp2JFS/rBxZmUshfLBhvc/f+ctNuGtJE3kslu0tDTB7iUVtHgeNu3tpHj9uUFay6rfxfhnJFx2n6/Gt9WZkg+zx17LqtnAD/F2/PyBIprEOXhroYKFJUdojNr0Kaphw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674820; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=beFvSsXmScK7eTwdxPz2BvPM7K8KAbUI0Ch3SEZ3qI0=; b=Cg/JrWtbzVIoAw0xJ/P9/0XxzIJNOt8iovPqUVf9q3rrPTIL99oyK7+5qglx7/I2xwhUZMDoruonM1QE7PXfLQ6jfq6cPFfvEz8C8cxjgKULb6WsQKtg4o65mNd6ysyuoNWZAj/kPhUEJYFpnIt1t4vmx7Tgx2NugW+mltI97tE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674820965728.6241844885205; Wed, 18 Dec 2019 05:13:40 -0800 (PST) Received: from localhost ([::1]:54160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZ91-0001iK-JM for importer@patchew.org; Wed, 18 Dec 2019 08:13:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59012) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY46-0007cF-0F for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY44-0004KI-Pi for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:29 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:56106) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY44-0004H4-Go for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:28 -0500 Received: by mail-wm1-x32b.google.com with SMTP id q9so1556643wmj.5 for ; Wed, 18 Dec 2019 04:04:28 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:26 -0800 (PST) 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=beFvSsXmScK7eTwdxPz2BvPM7K8KAbUI0Ch3SEZ3qI0=; b=aq5yCIOvPEMLaWeHwWf+h8E/rnUhq1Eavqa2FoN1GgFP/6clgkoKBC056Usfj95Oph nMIz6q7OOlNiFVbGaU+f1ft7pA6/EpPB0vLNqXQIFAMT4YxaT8S0FYr5jF9vIb9Vv9tD pdJfosrS5wvfBy5WTY/mRQTL8gdI/TbCJireBVYxRA6zRLZps4+LZSUSmsrp0QG42+9d oVfo51E4E1Rg2Xdey4zTX8Vxbhinf6azft0/U7seh8gmNsUWBG8KEKYqX9JaMEEnnqKQ eHDPhXnwYx84boaPOVRJRtRvtUrWb3zdiEpb6hkERrfE770BFsUJ57Jc8c4ov/LPaG5I iEww== 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=beFvSsXmScK7eTwdxPz2BvPM7K8KAbUI0Ch3SEZ3qI0=; b=Fg+462++FSXw9VHaKKLR10i1aPniwpRJdAFF63eG6QGrGQOToiCgk4vjB/hofszZsx HyZxAPpYqf9tRujRgU4hqg/LeOZLHfrytNd8TpBodHTBMICMW/W3U0tPfcneR1QCudjE 6VF2J9tNITEX6BnIqXfDRYQJXxhoxHZ97EsZOZOFZIL7VwBxbQhn1ROj9th8+fN/HvGN 40q/6rkDvQT492lTOz2XDYen4e7mLQLoQtxuAz9MgjJlt7e/4eTVTAIyoCrJY5p9/PCf oCPktQwBO/GAB5bUtTCi9+WObchDJZ8yMCXIv/x0ghAG1WGa0u42cTu1YGwecbvRWA75 CRJw== X-Gm-Message-State: APjAAAVnnnV8mSXazPvA3/SsUTLba2mwG3k6FglzozM1cmAJj4IGHSOS P+MMjE1VocGTQEYyX/N6FZKXik4R X-Google-Smtp-Source: APXvYqxWvSB7li+NvGovYJCdsD5PbgGzzcRUnocG4vwCp3qRqK/4bQeOUZkWlKuTHw5xYqyjaNpaUQ== X-Received: by 2002:a7b:c00c:: with SMTP id c12mr2849806wmb.174.1576670667380; Wed, 18 Dec 2019 04:04:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 85/87] hw/pci: Remove the "command_serr_enable" property Date: Wed, 18 Dec 2019 13:02:51 +0100 Message-Id: <1576670573-48048-86-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Now that the old pc-0.x machine types have been removed, this config knob is not required anymore. Signed-off-by: Thomas Huth Message-Id: <20191209125248.5849-4-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/pci/pci.c | 6 +----- include/hw/pci/pci.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index cbc7a32..e3d31036 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -69,8 +69,6 @@ static Property pci_props[] =3D { DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), - DEFINE_PROP_BIT("command_serr_enable", PCIDevice, cap_present, - QEMU_PCI_CAP_SERR_BITNR, true), DEFINE_PROP_BIT("x-pcie-lnksta-dllla", PCIDevice, cap_present, QEMU_PCIE_LNKSTA_DLLLA_BITNR, true), DEFINE_PROP_BIT("x-pcie-extcap-init", PCIDevice, cap_present, @@ -751,9 +749,7 @@ static void pci_init_wmask(PCIDevice *dev) pci_set_word(dev->wmask + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INTX_DISABLE); - if (dev->cap_present & QEMU_PCI_CAP_SERR) { - pci_word_test_and_set_mask(dev->wmask + PCI_COMMAND, PCI_COMMAND_S= ERR); - } + pci_word_test_and_set_mask(dev->wmask + PCI_COMMAND, PCI_COMMAND_SERR); =20 memset(dev->wmask + PCI_CONFIG_HEADER_SIZE, 0xff, config_size - PCI_CONFIG_HEADER_SIZE); diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index db75c6d..2acd832 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -174,7 +174,7 @@ enum { #define QEMU_PCI_CAP_MULTIFUNCTION_BITNR 3 QEMU_PCI_CAP_MULTIFUNCTION =3D (1 << QEMU_PCI_CAP_MULTIFUNCTION_BITNR), =20 - /* command register SERR bit enabled */ + /* command register SERR bit enabled - unused since QEMU v5.0 */ #define QEMU_PCI_CAP_SERR_BITNR 4 QEMU_PCI_CAP_SERR =3D (1 << QEMU_PCI_CAP_SERR_BITNR), /* Standard hot plug controller. */ --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576674966; cv=none; d=zohomail.com; s=zohoarc; b=mkpHz8uNlpVBzIDtBFxh5qnDln06a2owDqRwCYwRcyrlaU/vD/Z+tD46zWQlCJ5z2gHUQXzPaO+SW+TYkndbQ8uxpF1RRDBlqQO9epPsSPU8hu3qxzs8UNtdaKzRQCIBbitmCai0o2UHeMOcyeHG3biZIn6IdRBrzkhDjNl3gg0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576674966; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Z/hXY9tyxJP4bVUicIuKlm95MuHXrp390uv2lcHmGj0=; b=gWmlvVd/dqh//5s2SCk6LgvTx0cN6rOZ1Cs1/ZkawWSE4PBOShQEsl4nNTf7jyurmBQbN8Bx4l5RCnrcf5Ep6H6GqXKkMGbwchhcJKTXprhdG7njJkf8Ndz6kaM8mRx1MYyhhizoBbFnjDaRtitnMCSzM3TaZra+NqC4bK+1X54= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576674966213792.5641618836402; Wed, 18 Dec 2019 05:16:06 -0800 (PST) Received: from localhost ([::1]:54214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihZBM-0004kU-F8 for importer@patchew.org; Wed, 18 Dec 2019 08:16:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59215) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY46-0007dd-Uj for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY45-0004OJ-My for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:30 -0500 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:53444) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY45-0004Kc-Fr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:29 -0500 Received: by mail-wm1-x32a.google.com with SMTP id m24so1555627wmc.3 for ; Wed, 18 Dec 2019 04:04:29 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:27 -0800 (PST) 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=Z/hXY9tyxJP4bVUicIuKlm95MuHXrp390uv2lcHmGj0=; b=rDm98M/WphT/aoL4zE4nk0r6gR+5HRziKtZ866QuYYuA3cibw3+t6BSAqVqSmZbrhZ T23VN4uTEXNWl+TmRIKI8l+fuvSK4STMI+PlBGCMpXPgAst7GRC4vnoeDql8LocC5Pn+ 7VGS8sWHkqck/513Mf9tYsY9HngNbiS7mo7HQwF+OaDCJlNGheuhBmslmDPk3CZJegQy +L5iQMSjTrqfFRmHktS4pHZcZSHHReufxmM4HzyGoUNWBfm5gS9+x+VCWNCqBDMJ9eF5 9FWWcqjrL+/zrO8wHLIgjsRUCYR5N/1TLvZV0cwsm1qkHGk+Jt7VMKLIESo5MI49V6f7 kkHA== 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=Z/hXY9tyxJP4bVUicIuKlm95MuHXrp390uv2lcHmGj0=; b=sM051OuVn8duVZtNIHEySqd0Y1/eBsLPHaBiuz4UNQgJFKAB32X750TcHl4trqOkyA mFwUuy61HkDrblpbw1WQoEkniguZ3mBp+CPeWbHuSrT+xsN8WwlpV7acEJxGyL2f4DvO 0EA6zphYIhNNjzKY/pBihcV2HscqDo6jwe1OyyCmNj0OoLTasacH/iblJg75itBqWhJW jRzBAvnDMnisQ103rdSV6zkA+nEWVNZZYV5F2y3fxGu72Pk+1y6VO/LuflM2coPZdTPZ u10NVxGsRo3k2tF0jTPUXoAmjFvUXH4rkAVRCfOeH6j91sORbBUZTkjR9uzAg1vdoi80 ActQ== X-Gm-Message-State: APjAAAVjB6mN8M4he4FxoLa1IE16FHmgEsoQlU3Cvw8fY8c8X5zv/huk dgYVA+d3kAHXZ/kjjz5VcAlPZLYY X-Google-Smtp-Source: APXvYqxlTm5T37D7m9hBcABsn5EHOcDW3+gEVEf/FS7wFKGKWh6MMV/CeRK3FlSPtvZVoqNboWbnAg== X-Received: by 2002:a1c:22c6:: with SMTP id i189mr3040979wmi.15.1576670668222; Wed, 18 Dec 2019 04:04:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 86/87] hw/display: Remove "rombar" hack from vga-pci and vmware_vga Date: Wed, 18 Dec 2019 13:02:52 +0100 Message-Id: <1576670573-48048-87-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32a X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Now that the old pc-0.x machine types have been removed, we do not need the old "rombar" hacks anymore. Signed-off-by: Thomas Huth Message-Id: <20191209125248.5849-5-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/display/vga-pci.c | 5 ----- hw/display/vga.c | 4 +--- hw/display/vmware_vga.c | 5 ----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index a27b881..cfe0957 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -264,11 +264,6 @@ static void pci_std_vga_realize(PCIDevice *dev, Error = **errp) =20 pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mm= io); } - - if (!dev->rom_bar) { - /* compatibility with pc-0.13 and older */ - vga_init_vbe(s, OBJECT(dev), pci_address_space(dev)); - } } =20 static void pci_std_vga_init(Object *obj) diff --git a/hw/display/vga.c b/hw/display/vga.c index 82ebe53..636586a 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -2304,9 +2304,7 @@ void vga_init(VGACommonState *s, Object *obj, MemoryR= egion *address_space, =20 void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *system_mem= ory) { - /* With pc-0.12 and below we map both the PCI BAR and the fixed VBE re= gion, - * so use an alias to avoid double-mapping the same region. - */ + /* Use an alias to avoid double-mapping the same region */ memory_region_init_alias(&s->vram_vbe, obj, "vram.vbe", &s->vram, 0, memory_region_size(&s->vram)); /* XXX: use optimized standard vga accesses */ diff --git a/hw/display/vmware_vga.c b/hw/display/vmware_vga.c index 23dc891..ead754e 100644 --- a/hw/display/vmware_vga.c +++ b/hw/display/vmware_vga.c @@ -1312,11 +1312,6 @@ static void pci_vmsvga_realize(PCIDevice *dev, Error= **errp) &s->chip.vga.vram); pci_register_bar(dev, 2, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->chip.fifo_ram); - - if (!dev->rom_bar) { - /* compatibility with pc-0.13 and older */ - vga_init_vbe(&s->chip.vga, OBJECT(dev), pci_address_space(dev)); - } } =20 static Property vga_vmware_properties[] =3D { --=20 1.8.3.1 From nobody Sun Apr 28 13:29:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1576673286; cv=none; d=zohomail.com; s=zohoarc; b=U6uMRfsuhZJIjDGQx51BdPor4uvOTTWyA84Yc7blXVyyy/UsObUE5e8MvlwCNOXXxERhaJKtVQar7FBgiCW8ERFNXSLVsSQG7VILIL4/BMKHXUu2L8ATTqmY6/o8UgV+ndLspcbbUJBNhh4Y+bv2xQ4qiQgJPcFNy6nZ/+qy0EY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576673286; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CgppvqZAewfZJvWnPL9K16Q5E1v7zyG2NScejjiBbbI=; b=WmE6GYeVd5vRmlFV74Qt1saDni1Od7b4meYRtwobvnS3GqGd8wcbAwnIjdlhB18TJqAf+fpcYIybcQdvdyYtE6HTAh2t5tSs06VUZNqQG5HeGGGG0PQgB394uprf8PPLwZRtp+UbggFw0HHnXIelFTYzS/p1nxwP2FP4Za9uZvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1576673286665548.7894378406584; Wed, 18 Dec 2019 04:48:06 -0800 (PST) Received: from localhost ([::1]:53706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihYkG-0000Uz-E7 for importer@patchew.org; Wed, 18 Dec 2019 07:48:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59395) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ihY47-0007f2-Qr for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ihY46-0004RU-Fc for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:31 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:50310) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ihY46-0004OQ-8g for qemu-devel@nongnu.org; Wed, 18 Dec 2019 07:04:30 -0500 Received: by mail-wm1-x336.google.com with SMTP id a5so1565711wmb.0 for ; Wed, 18 Dec 2019 04:04:30 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n67sm2236838wmf.46.2019.12.18.04.04.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 04:04:28 -0800 (PST) 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=CgppvqZAewfZJvWnPL9K16Q5E1v7zyG2NScejjiBbbI=; b=hUg+86FdBnwQl84WMFa++8Z/EYHBZtAOgUbDC1eMA07rjyL5PBiHtdljMtLjPfZfA/ yxw01OISlrnmbMvqXrDgmyfDwL3xWwGU37qOL92YyMSjPBTgjffisA7VupMklA8C8ipM l9KL7ff2CtfrR2hUcGs0zq/g9lRNU7vITZxVd8SIut8cPmmc9NlsESQc1ufpD/VGTbHe 7sU5idQmd3hurWbYf9hzsnP7oe4+gXI1rpaDMXv5t77GiXn8/7dhf1sCubTodpfzrADu bNxlT0ksMwbM+9X/OhxsZ0QZGlAVW5OgHu/sTMmWsH28YIH9XJsOyMfMsvGvvNkHX7Y6 gNjQ== 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=CgppvqZAewfZJvWnPL9K16Q5E1v7zyG2NScejjiBbbI=; b=pWQJ8cNki/aB43mBElPkmiquzqL0mvzWV8us/xCD8sDD7fbpdhnR1OsBZFqhNgHX+U RgcL+FOyRO80vT77uGRkbPvKnD/u5GIz2yRuacR6Am5muYvoT47Onij9W/uyuDfOIxOX Gq1cWDdkeDVa5isrReVdmxOlMKKLixkdKxFHQM+GQXeJ/Z8F9V1ZdQTpHtSwgI2cccxW AUz6Q1KYAj2oDb/DwrwMY4lkKNfF7k+nBq9LwVxFEvrS/oRzHeXtjKrGNyIygP7l44xn HYF5Jb/lrrHxB/ffjAaEXbQ3ACfwLrnWO7+/sFY70GVMgIYHAJbFdul68mcWjofjecb9 KBNw== X-Gm-Message-State: APjAAAWxf7yz2Hlvu31Z/J5GPi2uM+9Rk0FgGYhy3682CISXMYCror7e l+em34S8Vvm85xT7nD/ivcoUraVS X-Google-Smtp-Source: APXvYqwMW4UcPkuhfdEAwZgsvGWJxIhOhagY2ku5x+JIXcbt5OJdNCwLaD+ddVfrwPjrQAUbmqdsJg== X-Received: by 2002:a05:600c:20c7:: with SMTP id y7mr2946375wmm.21.1576670669034; Wed, 18 Dec 2019 04:04:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 87/87] vga: cleanup mapping of VRAM for non-PCI VGA Date: Wed, 18 Dec 2019 13:02:53 +0100 Message-Id: <1576670573-48048-88-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576670573-48048-1-git-send-email-pbonzini@redhat.com> References: <1576670573-48048-1-git-send-email-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:4864:20::336 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) vga_init_vbe is now used only from ISA VGA cards. Since the alias is not needed anymore, remove it (effectively reverting commit 8294a64d7f, "vga: fix vram double-mapping with -vga std and -M pc-0.12", 2012-05-29) and the now unused vbe_mapped field of VGACommonState. The function now consists of a single memory_region_add_subregion call, so we can inline it; this avoids incorrect usage from PCI cards. Suggested-by: Philippe Mathieu-Daud=C3=A9 Based-on: <05af415a-5058-98b4-4a12-9d093a30b1e3@redhat.com> Signed-off-by: Paolo Bonzini --- hw/display/vga-isa-mm.c | 5 ++++- hw/display/vga-isa.c | 4 +++- hw/display/vga.c | 12 ------------ hw/display/vga_int.h | 3 --- 4 files changed, 7 insertions(+), 17 deletions(-) diff --git a/hw/display/vga-isa-mm.c b/hw/display/vga-isa-mm.c index e9c43e5..7321b7a 100644 --- a/hw/display/vga-isa-mm.c +++ b/hw/display/vga-isa-mm.c @@ -106,6 +106,9 @@ int isa_vga_mm_init(hwaddr vram_base, =20 s->vga.con =3D graphic_console_init(NULL, 0, s->vga.hw_ops, s); =20 - vga_init_vbe(&s->vga, NULL, address_space); + memory_region_add_subregion(address_space, + VBE_DISPI_LFB_PHYSICAL_ADDRESS, + &s->vga.vram); + return 0; } diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 873e5e9..08a2730 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -76,7 +76,9 @@ static void vga_isa_realizefn(DeviceState *dev, Error **e= rrp) memory_region_set_coalescing(vga_io_memory); s->con =3D graphic_console_init(DEVICE(dev), 0, s->hw_ops, s); =20 - vga_init_vbe(s, OBJECT(dev), isa_address_space(isadev)); + memory_region_add_subregion(isa_address_space(isadev), + VBE_DISPI_LFB_PHYSICAL_ADDRESS, + &s->vram); /* ROM BIOS */ rom_add_vga(VGABIOS_FILENAME); } diff --git a/hw/display/vga.c b/hw/display/vga.c index 636586a..061fd9a 100644 --- a/hw/display/vga.c +++ b/hw/display/vga.c @@ -2301,15 +2301,3 @@ void vga_init(VGACommonState *s, Object *obj, Memory= Region *address_space, portio_list_add(&s->vbe_port_list, address_space_io, 0x1ce); } } - -void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *system_mem= ory) -{ - /* Use an alias to avoid double-mapping the same region */ - memory_region_init_alias(&s->vram_vbe, obj, "vram.vbe", - &s->vram, 0, memory_region_size(&s->vram)); - /* XXX: use optimized standard vga accesses */ - memory_region_add_subregion(system_memory, - VBE_DISPI_LFB_PHYSICAL_ADDRESS, - &s->vram_vbe); - s->vbe_mapped =3D 1; -} diff --git a/hw/display/vga_int.h b/hw/display/vga_int.h index 55c418e..847e784 100644 --- a/hw/display/vga_int.h +++ b/hw/display/vga_int.h @@ -60,7 +60,6 @@ typedef struct VGACommonState { MemoryRegion *legacy_address_space; uint8_t *vram_ptr; MemoryRegion vram; - MemoryRegion vram_vbe; uint32_t vram_size; uint32_t vram_size_mb; /* property */ uint32_t vbe_size; @@ -106,7 +105,6 @@ typedef struct VGACommonState { uint32_t vbe_start_addr; uint32_t vbe_line_offset; uint32_t vbe_bank_mask; - int vbe_mapped; /* display refresh support */ QemuConsole *con; uint32_t font_offsets[2]; @@ -178,7 +176,6 @@ void vga_invalidate_scanlines(VGACommonState *s, int y1= , int y2); =20 int vga_ioport_invalid(VGACommonState *s, uint32_t addr); =20 -void vga_init_vbe(VGACommonState *s, Object *obj, MemoryRegion *address_sp= ace); uint32_t vbe_ioport_read_data(void *opaque, uint32_t addr); void vbe_ioport_write_index(void *opaque, uint32_t addr, uint32_t val); void vbe_ioport_write_data(void *opaque, uint32_t addr, uint32_t val); --=20 1.8.3.1