From patchwork Tue Mar 2 14:21:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1446069 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IK7vix6F; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DqfXq5P4lz9sVt for ; Wed, 3 Mar 2021 01:24:59 +1100 (AEDT) Received: from localhost ([::1]:57624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5xI-0006Bu-GD for incoming@patchwork.ozlabs.org; Tue, 02 Mar 2021 09:24:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH5tv-00045z-1U for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:21:27 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lH5ts-0000EE-8L for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:21:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614694883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aSTS7Zkq3P2VbrOZPe9sjI2kH1SjBjp0OmfmXgyEvhw=; b=IK7vix6FHyHKv/UJ8fmqLYO1hAUN6Jx4b2ejNnqz+F/USu0/A1azLvzQgmNwslSzdgBN/G IbSCempjOGGucSrDVK2QQQsC84r20WKyR4SXe3a2Y5pgrFEQMIGkurPxAt7i/M8abQWU1/ eOG5REOh/wxVGV4XlzPe1yj/NrIGzG8= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575-coE4v09iM8SWxbLE4Fge1g-1; Tue, 02 Mar 2021 09:21:15 -0500 X-MC-Unique: coE4v09iM8SWxbLE4Fge1g-1 Received: by mail-ej1-f71.google.com with SMTP id w22so8612560ejv.18 for ; Tue, 02 Mar 2021 06:21:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=aSTS7Zkq3P2VbrOZPe9sjI2kH1SjBjp0OmfmXgyEvhw=; b=f0hDA4xVtI0hrrDBk1777J16pzDkaXVyS5WLRJ3QkzxHSCmCAYK8UzEP2V80rrfqwn tbe+D+T48RE/6PPUNQI+S8Y2xIaAk2WrNH89lEutEdRxyMqzl2qy48jrL0JBIa63SEKZ DLy1F6cZ5JAm1ButIgCLjHaHFvd56j2EqqGgRnHW+UAhaN9kYJs5QneGBHlh8bGZ+3VB LP8fBZGWeJnCNT/TEH1rHRtTYQYZTLfxK5i+73ojK3t5E9iRwMP9DOAOs3kfz0mBkaLG LW1HnGhsQq1hG0rBSZIV9S8vRtw6ZbyKeVvEDJMv9ZmqbTME63uUuygkq73dk16c4iUU Kgxg== X-Gm-Message-State: AOAM532Xo8oAsMJfuVP7wUe7BQXWAgtyvMOyrBB3GC81HZtHJCqCM6+2 Jbmf5zFZ5H4g8TdhHSqb505DSwqsCQtAyigZ86rWsBIf5n73b6+OiBbymn6HVL0v3oRkMp3Fk4X LXNQMiNbiFTcr1+M5uUs2I06vF+jHhO/Bbk/7XxWBL3CWFnxYIiBRjVoodQ5I X-Received: by 2002:a50:e882:: with SMTP id f2mr9286035edn.184.1614694873388; Tue, 02 Mar 2021 06:21:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzXpglCX9t10C4DlyZp/HwCVgBpN17UAyP6sL7bohrGs5RFWJaB2Mh+WY5wNGcsm1O+K8saug== X-Received: by 2002:a50:e882:: with SMTP id f2mr9286011edn.184.1614694873154; Tue, 02 Mar 2021 06:21:13 -0800 (PST) Received: from redhat.com (bzq-79-180-2-31.red.bezeqint.net. [79.180.2.31]) by smtp.gmail.com with ESMTPSA id v7sm8608763edt.90.2021.03.02.06.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 06:21:12 -0800 (PST) Date: Tue, 2 Mar 2021 09:21:10 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 1/4] i386/acpi: restore device paths for pre-5.1 vms Message-ID: <20210302142014.141135-2-mst@redhat.com> References: <20210302142014.141135-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210302142014.141135-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Richard Henderson , qemu-stable@nongnu.org, Vitaly Cheptsov , Paolo Bonzini , Igor Mammedov , Thomas Lamprecht Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Vitaly Cheptsov After fixing the _UID value for the primary PCI root bridge in af1b80ae it was discovered that this change updates Windows configuration in an incompatible way causing network configuration failure unless DHCP is used. More details provided on the list: https://lists.gnu.org/archive/html/qemu-devel/2021-02/msg08484.html This change reverts the _UID update from 1 to 0 for q35 and i440fx VMs before version 5.2 to maintain the original behaviour when upgrading. Cc: qemu-stable@nongnu.org Cc: qemu-devel@nongnu.org Reported-by: Thomas Lamprecht Suggested-by: Michael S. Tsirkin Signed-off-by: Vitaly Cheptsov Message-Id: <20210301195919.9333-1-cheptsov@ispras.ru> Tested-by: Thomas Lamprecht Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Fixes: af1b80ae56c9 ("i386/acpi: fix inconsistent QEMU/OVMF device paths") --- include/hw/i386/pc.h | 1 + hw/i386/acpi-build.c | 4 ++-- hw/i386/pc_piix.c | 2 ++ hw/i386/pc_q35.c | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index c9d194a5e7..d4c3d73c11 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -105,6 +105,7 @@ struct PCMachineClass { int legacy_acpi_table_size; unsigned acpi_data_size; bool do_not_add_smb_acpi; + int pci_root_uid; /* SMBIOS compat: */ bool smbios_defaults; diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 31a5f6f4a5..442b4629a9 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -1277,7 +1277,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, dev = aml_device("PCI0"); aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); aml_append(sb_scope, dev); aml_append(dsdt, sb_scope); @@ -1296,7 +1296,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A08"))); aml_append(dev, aml_name_decl("_CID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); - aml_append(dev, aml_name_decl("_UID", aml_int(0))); + aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); aml_append(dev, build_q35_osc_method()); aml_append(sb_scope, dev); if (mcfg_valid) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2904b40163..46cc951073 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -405,6 +405,7 @@ static void pc_i440fx_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pcmc->default_nic_model = "e1000"; + pcmc->pci_root_uid = 0; m->family = "pc_piix"; m->desc = "Standard PC (i440FX + PIIX, 1996)"; @@ -448,6 +449,7 @@ static void pc_i440fx_5_1_machine_options(MachineClass *m) compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false; + pcmc->pci_root_uid = 1; } DEFINE_I440FX_MACHINE(v5_1, "pc-i440fx-5.1", NULL, diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 0a212443aa..53450190f5 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -329,6 +329,7 @@ static void pc_q35_machine_options(MachineClass *m) { PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pcmc->default_nic_model = "e1000e"; + pcmc->pci_root_uid = 0; m->family = "pc_q35"; m->desc = "Standard PC (Q35 + ICH9, 2009)"; @@ -375,6 +376,7 @@ static void pc_q35_5_1_machine_options(MachineClass *m) compat_props_add(m->compat_props, hw_compat_5_1, hw_compat_5_1_len); compat_props_add(m->compat_props, pc_compat_5_1, pc_compat_5_1_len); pcmc->kvmclock_create_always = false; + pcmc->pci_root_uid = 1; } DEFINE_Q35_MACHINE(v5_1, "pc-q35-5.1", NULL, From patchwork Tue Mar 2 14:21:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1446071 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LhJiEAnY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dqfb63rPRz9sVt for ; Wed, 3 Mar 2021 01:26:58 +1100 (AEDT) Received: from localhost ([::1]:33854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5zE-00085o-Hd for incoming@patchwork.ozlabs.org; Tue, 02 Mar 2021 09:26:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34262) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH5wY-00060c-8q for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:24:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:34146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lH5wW-0000W2-EI for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:24:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614695044; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BZ132pm3LKEVz/5JvGWOpjOlCZruw+8zw22+Ezbthfc=; b=LhJiEAnYVmY3mLpHqAq0O4bVJXHQsFjaW/R2udLTIidwYI+LeU26kR3fr5VgGkNMS3kR9n 5Ty9vSNvAAm4gz+KFGA7R7symSK0lo43DCpaa4NnqYNYWgBIYGGVlOhu+18TLZXcbBCuxJ TFmQVBg5K05pCIPfL/SBwKKBWFeCq+E= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-452-lz2CaCioPSqld2VncLir-Q-1; Tue, 02 Mar 2021 09:21:17 -0500 X-MC-Unique: lz2CaCioPSqld2VncLir-Q-1 Received: by mail-ej1-f72.google.com with SMTP id di5so32986ejc.1 for ; Tue, 02 Mar 2021 06:21:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BZ132pm3LKEVz/5JvGWOpjOlCZruw+8zw22+Ezbthfc=; b=Quo5km4LCORxx9MzJkuvTB7iyk+DSlTBAorZx1Yp/xBf1RWH0jLsau/QEdFG82obrV MPXLliBmDDBIYdsoe29PkYsIfGNEIlS6FJiDGWQ/gMFLUus9/z1gb+W6GhtWmTThoIBr 9ckyRilfRh9dBA3KopEaBy0XM4vgxdWliRVEMuF3Doi2vdDKw3oz0z8zXWBiY4iFkoSg EUW9CuZ9ZF8ksNo61btxU9Dgc0+KCdReOi2aOM4Rk4fOGtfE3CZhOZz6CzxI0sv0pK+a cSww7GoXPwP31QkOQmslp6+YBqtN0jVa33LbfVUoL7SRIjQ4jSYcnGjJdqrRgEGWgtVA m7og== X-Gm-Message-State: AOAM530sdoVpu7PZ45nrKRKRuGNOo+Z1osN4bzBYvkrR35+rNucjWuHv UB4ka8oAaF4jgt9O0wy2Ttio4Qy/58FEyT3dwnGP4Uxcsu5nyomm6SpxwPxJagebqYDv1+0GbwV UpSSkyempe1nBPTFs1LrWDuziqD6lSveQtCID1gHblzFoG0flKI2XGG9KJjjF X-Received: by 2002:a17:906:c24b:: with SMTP id bl11mr21439351ejb.80.1614694875730; Tue, 02 Mar 2021 06:21:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxCbM3qHueMEn5bHJgxPmr7u4EfQclQlPKtyadyv01TDhqNmUDpcMI6NUBAhhtFNJkXWbx7rg== X-Received: by 2002:a17:906:c24b:: with SMTP id bl11mr21439321ejb.80.1614694875488; Tue, 02 Mar 2021 06:21:15 -0800 (PST) Received: from redhat.com (bzq-79-180-2-31.red.bezeqint.net. [79.180.2.31]) by smtp.gmail.com with ESMTPSA id u13sm1134759ejy.31.2021.03.02.06.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 06:21:15 -0800 (PST) Date: Tue, 2 Mar 2021 09:21:13 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 2/4] virtio-net: handle zero mac for a vdpa peer Message-ID: <20210302142014.141135-3-mst@redhat.com> References: <20210302142014.141135-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210302142014.141135-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cindy Lu , Jason Wang , Parav Pandit , Sean Mooney , Eli Cohen , Adrian Moreno Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Cindy Lu Some mlx vdpa devices with kernels at least up to 5.11 currently present 0 as their MAC address. This is because they have not been pre-configured with a MAC: they have a learning bridge and only learn the MAC once guest is up. Kernel patches and tools to allow programming the MAC from host are being developed. For now - since these combinations exist in the field - let's detect zero mac and just try to proceed with the mac from the qemu command line. This makes the guest use this MAC to send packets in turn teaching the MAC to the card, and things work. TODO: report the actual MAC from QEMU commad line in the info message. TODO: detect that a (non-zero) hardware MAC does not match QEMU command line and fail init. Signed-off-by: Cindy Lu Message-Id: <20210225165506.18321-2-lulu@redhat.com> mst: rewritten code comments, message printed and the commit log. Cc: Eli Cohen Cc: Parav Pandit Tested-by: Adrian Moreno Tested-by: Sean Mooney Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 439f823b19..96a3cc8357 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -126,6 +126,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) VirtIONet *n = VIRTIO_NET(vdev); struct virtio_net_config netcfg; NetClientState *nc = qemu_get_queue(n->nic); + static const MACAddr zero = { .a = { 0, 0, 0, 0, 0, 0 } }; int ret = 0; memset(&netcfg, 0 , sizeof(struct virtio_net_config)); @@ -151,6 +152,17 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) ret = vhost_net_get_config(get_vhost_net(nc->peer), (uint8_t *)&netcfg, n->config_size); if (ret != -1) { + /* + * Some NIC/kernel combinations present 0 as the mac address. As + * that is not a legal address, try to proceed with the + * address from the QEMU command line in the hope that the + * address has been configured correctly elsewhere - just not + * reported by the device. + */ + if (memcmp(&netcfg.mac, &zero, sizeof(zero)) == 0) { + info_report("Zero hardware mac address detected. Ignoring."); + memcpy(netcfg.mac, n->mac, ETH_ALEN); + } memcpy(config, &netcfg, n->config_size); } } From patchwork Tue Mar 2 14:21:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1446067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cRppB7za; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DqfTW1CYqz9sVt for ; Wed, 3 Mar 2021 01:22:07 +1100 (AEDT) Received: from localhost ([::1]:52832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5uX-00048i-6d for incoming@patchwork.ozlabs.org; Tue, 02 Mar 2021 09:22:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH5tw-000477-BV for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:21:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31959) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lH5tt-0000ET-05 for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:21:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614694884; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vPtb2onXCNJQivydBBk7bSI4OhV4B1OeZvbfsR5zn18=; b=cRppB7zasPrGXebq63vCvj5GBfmcGHeDBUZlSf5kqxohVbCtfsYON7eWszL5fIkqYy/9bU moUIA7lYPjdYKlNCMN0M20wwywz0cpddgz8yea4AnuFtEnZ+eKF7iIZV+JPF31d1wx61E5 foqwWNJAs/P1ShoYiKGY8nc5dGQ1VVU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-wTWrpvlSO5aH1aifc3-gBw-1; Tue, 02 Mar 2021 09:21:19 -0500 X-MC-Unique: wTWrpvlSO5aH1aifc3-gBw-1 Received: by mail-ed1-f70.google.com with SMTP id i6so3995487edq.12 for ; Tue, 02 Mar 2021 06:21:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=vPtb2onXCNJQivydBBk7bSI4OhV4B1OeZvbfsR5zn18=; b=StFOXmR9Xo0KRsWVxS8L0NQJUBgAL1FELq2JtEuQeLLemelJjv8qzl3DHSvAFerEPR 3OlPoMt40D/ulncJGBefgPUbODerirpT0mG0Pe1NQ9whDdWY+9lPreFuZJkTg1mnbyw0 ngvPxOonW8w/isRAMHVkyQ/6xLc2moJwyzraQCmjZ0CTmyI6shv0L/7hhFXT4zhkGP50 pl5nKMnnkY6i1GTFTkP8jLWkzBHJD1W6/twzBOSIxMJJN/AQ1xtFxnUNFy7oF+PtdGR7 zB60Q9yVpn+yIa0GZWiKmSuIBUt/MbC18RVtqDWvqhLBvKKCI7e+S/SlzUYqkODqyOLD bPYw== X-Gm-Message-State: AOAM532KtC7UClyphTkLrbA72snHrbWdrykJdpewVQQTLICZjiUPyzBy H/y2IuPFWfxAJxWv4jCfAg/1dOmrpeFqIFvzi4lBIhaFfX7yMed2TeZBDZ4TT1j10+dG0E7Bajs 4LIm5gfwW2v5hyKXzg0mYNcx6XXy7ZexWOxCDMRIMCs413+9NASM3jHD13mSf X-Received: by 2002:a17:906:a8a:: with SMTP id y10mr576016ejf.288.1614694877773; Tue, 02 Mar 2021 06:21:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdHNGMrLa7HDRo/7OleAXiszLQD/n34fzFvVAy3OkGIwKfSQviM9tMU19z7cnNOZVoNj3mMA== X-Received: by 2002:a17:906:a8a:: with SMTP id y10mr576006ejf.288.1614694877646; Tue, 02 Mar 2021 06:21:17 -0800 (PST) Received: from redhat.com (bzq-79-180-2-31.red.bezeqint.net. [79.180.2.31]) by smtp.gmail.com with ESMTPSA id de17sm11285699ejc.16.2021.03.02.06.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 06:21:17 -0800 (PST) Date: Tue, 2 Mar 2021 09:21:15 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 3/4] hw/pci: Have safer pcie_bus_realize() by checking error path Message-ID: <20210302142014.141135-4-mst@redhat.com> References: <20210302142014.141135-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210302142014.141135-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?q?Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Markus Armbruster Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé While pci_bus_realize() currently does not use the Error* argument, it would be an error to leave pcie_bus_realize() setting bus->flags if pci_bus_realize() had failed. Fix by using a local Error* and return early (propagating the error) if pci_bus_realize() failed. Reported-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20210201153700.618946-1-philmd@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index fa97a671d1..0eadcdbc9e 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -132,8 +132,13 @@ static void pci_bus_realize(BusState *qbus, Error **errp) static void pcie_bus_realize(BusState *qbus, Error **errp) { PCIBus *bus = PCI_BUS(qbus); + Error *local_err = NULL; - pci_bus_realize(qbus, errp); + pci_bus_realize(qbus, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } /* * A PCI-E bus can support extended config space if it's the root From patchwork Tue Mar 2 14:21:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1446070 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=d5MWxtfu; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DqfXx2qBTz9sW1 for ; Wed, 3 Mar 2021 01:25:05 +1100 (AEDT) Received: from localhost ([::1]:57828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lH5xP-0006H1-Db for incoming@patchwork.ozlabs.org; Tue, 02 Mar 2021 09:25:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lH5wW-0005xf-Pb for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:24:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lH5wR-0000Vt-RE for qemu-devel@nongnu.org; Tue, 02 Mar 2021 09:24:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614695043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bVzIzD7Ro1WRiD8tdQmS3Q50kGlZuhnBQiiDtoTlZjk=; b=d5MWxtfuWEPL4BRB0UCTFue8gBZ/2oeDJA+6JfMolnroN7zQAtj8knuz0HnqtS9uyfJJUC 2HAueFzsS/iss1hEvf9UAa8DaTFXRufjR5eepOdlr883+Q5QCvlyRtIlM8EIYt/ZjhBsqv V5DFnBiYtg9WCzuj8mk99eUXdLDlKE8= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-503-wd9HbWaaOKWVggQzWTLY0Q-1; Tue, 02 Mar 2021 09:21:21 -0500 X-MC-Unique: wd9HbWaaOKWVggQzWTLY0Q-1 Received: by mail-ej1-f71.google.com with SMTP id p8so2390420ejl.0 for ; Tue, 02 Mar 2021 06:21:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=bVzIzD7Ro1WRiD8tdQmS3Q50kGlZuhnBQiiDtoTlZjk=; b=SCwArQB6ypeteKhKJxn3+6IVoAsWLzJjlRWI7KSa+boRIT13hqJq30adKVzzJ+AOQp ty+oaJOuAQgkiECtriRK3DlwG/MFMxhpxuZYdAvwtloWxqgiRZhpC63K7OXZFK1k56l1 e3qUPECPSC/7od2el+IceqHIUTa5lJAhEz13lyLKfAVMepcH8Y9LStZy1NXpeBGrPQX+ p5X2zxlXTxRJfBBlO+BKCOTWwdGQFxkF3EkS3NgZJw4va60gHothaKFsXSvKv0nQ+BL4 XlHURhysBSbx18JL9wzNRTDf84a8ZvF79r3J6nmq1gn+yZ8PjI76hMEnL8zdVoDi2Rec Jf1w== X-Gm-Message-State: AOAM5332WmBPvTaFCkumbbUSCHMGubpRFZ31Ay58zdY2/wugZfTXIehn K9kcfvQ9OoD+BP1GZTzwgCWRqJtFn5lGboUz6rtrr383Sgm9wPWiJVEGxVRTQ5iNjRdJBvKZOB3 EqteLiXvR/zEPSijzcdyDwv5VAzJ3uheBjME/7qJsifWLsxO/aF7KUQmQwUCz X-Received: by 2002:a17:906:9714:: with SMTP id k20mr20898845ejx.519.1614694879960; Tue, 02 Mar 2021 06:21:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU7t0hIRNzHF8HEDrB2Ml46STbpBKNBHtl/st/7WZVBcMIz+d2+kyPJV1zf1zbDUoQ5huC6A== X-Received: by 2002:a17:906:9714:: with SMTP id k20mr20898821ejx.519.1614694879770; Tue, 02 Mar 2021 06:21:19 -0800 (PST) Received: from redhat.com (bzq-79-180-2-31.red.bezeqint.net. [79.180.2.31]) by smtp.gmail.com with ESMTPSA id s18sm17921492ejc.79.2021.03.02.06.21.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 06:21:19 -0800 (PST) Date: Tue, 2 Mar 2021 09:21:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 4/4] vhost: simplify vhost_dev_init() fail_busyloop label Message-ID: <20210302142014.141135-5-mst@redhat.com> References: <20210302142014.141135-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210302142014.141135-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?q?Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Stefan Hajnoczi , Stefano Garzarella Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi Requiring a conditional for every goto is tedious: if (busyloop_timeout) { goto fail_busyloop; } else { goto fail; } Move the conditional to into the fail_busyloop label so that it's safe to jump to this label unconditionally. This change makes the migrate_add_blocker() error case more consistent. It jumped to fail_busyloop unconditionally whereas the memslots limits error case was conditional. Signed-off-by: Stefan Hajnoczi Message-Id: <20210222114931.272308-1-stefanha@redhat.com> Reviewed-by: Stefano Garzarella Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 6e17d631f7..2a01662b08 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1388,18 +1388,16 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, error_report("vhost backend memory slots limit is less" " than current number of present memory slots"); r = -1; - if (busyloop_timeout) { - goto fail_busyloop; - } else { - goto fail; - } + goto fail_busyloop; } return 0; fail_busyloop: - while (--i >= 0) { - vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i, 0); + if (busyloop_timeout) { + while (--i >= 0) { + vhost_virtqueue_set_busyloop_timeout(hdev, hdev->vq_index + i, 0); + } } fail: hdev->nvqs = n_initialized_vqs;