From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595857860; cv=none; d=zohomail.com; s=zohoarc; b=cmLTjHsXkYkI1SD0VI63Jjk6ZVsQP1x4s4nP8G1+8bDQ+p+HXMCLc/iHRny6sBZ6ZF3AqEd81yrKnhZ1mWYBn6/HC2ekT/jMupFbHqRYuq5bZmsbVjqCEZQKQ+9fS9USwUclaFh5ETzapsqD7LpBdNbn0/xmSdT/FX+IaXt6raM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595857860; h=Content-Type: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=AHMvwCpHzHvg1F3ImQSbDTzqzrVUtZ/6UHRF8xJVQi0=; b=B7VC9qpRqhu43nmxDhp8xm0fMeCtOK67NygaPp5RVZT4UNnTi7SSwQuuBONPrEkgpVn4hWdR8gwAy0yoKrucaVGMmY3SXMS5QcHnpzOJyd7Nc/3y0Lktb7vKhBsaeDSzvRdK1MLP+8ePe+kweITF53scXfNNS8tVUaQJTUo4kUA= 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 159585786079330.136378951153006; Mon, 27 Jul 2020 06:51:00 -0700 (PDT) Received: from localhost ([::1]:56306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03Ws-0006s7-T4 for importer@patchew.org; Mon, 27 Jul 2020 09:50:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33812) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vb-00055y-Vs for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:40 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:24392 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03VZ-0001r4-8g for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:39 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-99-vAS3g852PNSyXkNeCbsmag-1; Mon, 27 Jul 2020 09:49:34 -0400 Received: by mail-wr1-f70.google.com with SMTP id z1so3958288wrn.18 for ; Mon, 27 Jul 2020 06:49:34 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id 88sm13343163wrk.43.2020.07.27.06.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857776; 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=AHMvwCpHzHvg1F3ImQSbDTzqzrVUtZ/6UHRF8xJVQi0=; b=CXR9dZvvJh9rHBdgzzzOiL/aCEhzhCidiwVRlKoHT9RwvyTZMWCbAFv6vjEZsc8YZ10HgE /iPR98kK1cH2qSgevO2br/VNDyBqfNm4mx7xQTqKgRQ442hbChfEp1Wl+pbSgfbM6jmFR8 msV8GBujgepjQNb+dVZu/nCRg16gf10= X-MC-Unique: vAS3g852PNSyXkNeCbsmag-1 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=AHMvwCpHzHvg1F3ImQSbDTzqzrVUtZ/6UHRF8xJVQi0=; b=CVUiRcLf7dshG08UT8SxNjsbGSTuakhpd/mCo+q9gFCVCmuAwz41WuZHrGqLcSxEbu BAhy/mG9GgIZGpOxOYH9YVP7SyGZDpNbo6F1uytsWSX0UhL52wXT4Is91g+kuuT86PKd Wj8rft//rRTH3LopQHBR8Juklt62Tixvzmsxr9FPQF21qw1JYRohEIZtHC4PPHVmU+9+ q6kXFJiFGFcKOrYfei0dyhzEejk8U4hvCkg4JbLTLewRQLSm1h4ya2GaKzhDER7jJWMk FcMT7u+Qy5xt6qGkCaUhVIcQeP0OWbWlCWtERywlSqt2dM7Ex9bSTI5FVh1KkK5ggVyM wATQ== X-Gm-Message-State: AOAM532qzj1sLjfzAL79BofWuRZBOEY75wDklm3F1uO523XrG0wHhgMJ V9TjTzuNJVVsEgn2wu+Vpe+P/tC2YH3s0ZKucsTfxRETnXOrVr1JcgC+ao8/BqRdP485oK9wWGV GzMl28Fd4cHjrNPQ= X-Received: by 2002:adf:e94a:: with SMTP id m10mr8069260wrn.249.1595857772844; Mon, 27 Jul 2020 06:49:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyS7895x4hajfh+pBoM36f+0F94u3SBOH21OiopxXQCuKgddXx8EDy1TgZNblfui/NJEE9s5w== X-Received: by 2002:adf:e94a:: with SMTP id m10mr8069244wrn.249.1595857772636; Mon, 27 Jul 2020 06:49:32 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 1/7] virtio-mem-pci: force virtio version 1 Message-ID: <20200727134614.96376-2-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-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 (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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 00:16:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 , Cornelia Huck , qemu-stable@nongnu.org, David Hildenbrand 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 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Trying to run simple virtio-mem-pci examples currently fails with qemu-system-x86_64: -device virtio-mem-pci,id=3Dvm0,memdev=3Dmem0,node= =3D0, requested-size=3D300M: device is modern-only, use disable-legacy=3Don due to the added safety checks in 9b3a35ec8236 ("virtio: verify that legacy support is not accidentally on"). As noted by Conny, we have to force virtio version 1. While at it, use qdev_realize() to set the parent bus and realize - like most other virtio-*-pci implementations. Fixes: 0b9a2443a48b ("virtio-pci: Proxy for virtio-mem") Reviewed-by: Cornelia Huck Cc: Cornelia Huck Cc: "Michael S. Tsirkin" Signed-off-by: David Hildenbrand Message-Id: <20200727115905.129397-1-david@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-mem-pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-mem-pci.c b/hw/virtio/virtio-mem-pci.c index d375280ee1..590cec041b 100644 --- a/hw/virtio/virtio-mem-pci.c +++ b/hw/virtio/virtio-mem-pci.c @@ -21,8 +21,8 @@ static void virtio_mem_pci_realize(VirtIOPCIProxy *vpci_d= ev, Error **errp) VirtIOMEMPCI *mem_pci =3D VIRTIO_MEM_PCI(vpci_dev); DeviceState *vdev =3D DEVICE(&mem_pci->vdev); =20 - qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus)); - object_property_set_bool(OBJECT(vdev), "realized", true, errp); + virtio_pci_force_virtio_1(vpci_dev); + qdev_realize(vdev, BUS(&vpci_dev->bus), errp); } =20 static void virtio_mem_pci_set_addr(MemoryDeviceState *md, uint64_t addr, --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595857865; cv=none; d=zohomail.com; s=zohoarc; b=UHzLuA5INsUK4KTmwp0vp3zsFzcdVE71xns69fuW2YbF4mYVErirnxsX3d9SNwR+WsVDZQim1NxtBM0HTQ2ffikeUtooF+4DQ0rRaXTG2nnTMaa1G9u9Rfm78eLrjvDonPrd9Z329s0sGCxflKnEVjxq50CQlAMPIjagTOXOUio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595857865; h=Content-Type: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=G5Jqd+SmkXSBC/JZYFI43kAGxEBE3DwOl1zZvCWvDdA=; b=hZ8erEGRuTP6G9uxT/dzyDmy6n51uqztDjE8nTTc/DsNZYkcbgH/LXCW7ngLT9Zab2Dxk5NyPe6rrzqalwm1esaKDtHwcLxufRV+QH2JvS2Tf+yNrl32Ji85s5zo+sMdTJ4pCoTurpu3HAMLaYcuHpMzIOBuscesVny4D2oAkH8= 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 1595857865770541.4438653750022; Mon, 27 Jul 2020 06:51:05 -0700 (PDT) Received: from localhost ([::1]:56724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03Wy-00073r-9n for importer@patchew.org; Mon, 27 Jul 2020 09:51:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vf-0005Cq-Mx for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:43 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:51072 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vd-0001tR-OI for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:43 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-PQfYeY7CMPSHgiZX4n8FSg-1; Mon, 27 Jul 2020 09:49:37 -0400 Received: by mail-wr1-f70.google.com with SMTP id z12so3972500wrl.16 for ; Mon, 27 Jul 2020 06:49:37 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id i6sm11782355wrp.92.2020.07.27.06.49.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857780; 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=G5Jqd+SmkXSBC/JZYFI43kAGxEBE3DwOl1zZvCWvDdA=; b=Rz1fom05PIlgVmJ6p1GQtUe8Ed9WsIy5CWK9iwK1CQGBPwcOQC582rGHVExnlaPeWVEibU dmEs2IoccLGC2OXufDmrLMPn95qbBHwF+NuoOjyayiikYdYXm2IyJDgQWIEKogZjvG9hBM vH0+52SE4N8pVcfe2fnHn5PUZdGrE3U= X-MC-Unique: PQfYeY7CMPSHgiZX4n8FSg-1 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=G5Jqd+SmkXSBC/JZYFI43kAGxEBE3DwOl1zZvCWvDdA=; b=bXVUgzNIe8QyWmFT5WBYGZ3YvtISL8/DtUSqgqKTO8Y5wuKGHel6ochwxcqzxGwe0v ZCXz1MLLBlWjIxq2ccYyzb64HbTJZqxSpcijLm+ZB51T+WapEqsPV8WsDN/4aCj8HqRJ leZ2BQNczWMq/kwK8l7BlH8PILkJZ3mHpVEj5FixWyse9zVPW4UvFjaKs01JUyquJMyo 7JX/pyhu1qwXUPLZg90PdNI3jdonCLWleFAsgYiym/mFOGeiiyPAeFlkEcVl4jHqCGsS BHl9JA8k8UeHpMQ6vRX///JjtMgJiBO9ybsetn4wYGo/MZIgShvGQGpx5AM5PEhevhRB w5aw== X-Gm-Message-State: AOAM531DMbOxUTUdjDOepVdJE8UGU+fDnMFUMoJKY7e0CG/v3i54HZVw tx7ZjeQMu6EB9HqkfbP1IGnc9cf1JhBo7D/z+oWUT0yQit7HSHo+koC0B6g9irfyEgFx9/W/1sJ Eb3PYV13YldAltRU= X-Received: by 2002:a5d:4a0d:: with SMTP id m13mr21796996wrq.12.1595857776076; Mon, 27 Jul 2020 06:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdlVQyDbn+JMARwjE/qDBOF8uyA+C9le76/I9GiTPVRVdwWuBVAsr0/Gq6HQB+trX4CaahFw== X-Received: by 2002:a5d:4a0d:: with SMTP id m13mr21796978wrq.12.1595857775857; Mon, 27 Jul 2020 06:49:35 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:33 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 2/7] hw/pci-host: save/restore pci host config register Message-ID: <20200727134614.96376-3-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-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 (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; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 03:37:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 , Eduardo Habkost , qemu-stable@nongnu.org, Hogan Wang , Hogan Wang , Paolo Bonzini , Richard Henderson 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 Content-Type: text/plain; charset="utf-8" From: Hogan Wang The pci host config register is used to save PCI address for read/write config data. If guest write a value to config register, and then pause the vcpu to migrate, After the migration, the guest continue to write pci config data, and the write data will be ignored because of new qemu process lost the config register state. Reproduction steps are: 1. guest booting in seabios. 2. guest enable the SMRAM in seabios:piix4_apmc_smm_setup, and then expect to disable the SMRAM by pci_config_writeb. 3. after guest write the pci host config register, and then pasued vcpu to finish migration. 4. guest write config data(0x0A) fail to disable the SMRAM becasue of config register state lost. 5. guest continue to boot and crash in ipxe option ROM due to SMRAM in enabled state. Cc: qemu-stable@nongnu.org Signed-off-by: Hogan Wang Message-Id: <20200727084621.3279-1-hogan.wang@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pci_host.h | 1 + hw/i386/pc.c | 4 +++- hw/pci/pci_host.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h index 9ce088bd13..6210a7e14d 100644 --- a/include/hw/pci/pci_host.h +++ b/include/hw/pci/pci_host.h @@ -45,6 +45,7 @@ struct PCIHostState { MemoryRegion data_mem; MemoryRegion mmcfg; uint32_t config_reg; + bool mig_enabled; PCIBus *bus; =20 QLIST_ENTRY(PCIHostState) next; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3d419d5991..f6ff0c5514 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -97,7 +97,9 @@ #include "fw_cfg.h" #include "trace.h" =20 -GlobalProperty pc_compat_5_0[] =3D {}; +GlobalProperty pc_compat_5_0[] =3D { + { "pci-host-bridge", "x-config-reg-migration-enabled", "off" }, +}; const size_t pc_compat_5_0_len =3D G_N_ELEMENTS(pc_compat_5_0); =20 GlobalProperty pc_compat_4_2[] =3D { diff --git a/hw/pci/pci_host.c b/hw/pci/pci_host.c index ce7bcdb1d5..8ca5fadcbd 100644 --- a/hw/pci/pci_host.c +++ b/hw/pci/pci_host.c @@ -22,8 +22,10 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pci_host.h" +#include "hw/qdev-properties.h" #include "qemu/module.h" #include "hw/pci/pci_bus.h" +#include "migration/vmstate.h" #include "trace.h" =20 /* debug PCI */ @@ -200,12 +202,43 @@ const MemoryRegionOps pci_host_data_be_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, }; =20 +static bool pci_host_needed(void *opaque) +{ + PCIHostState *s =3D opaque; + return s->mig_enabled; +} + +const VMStateDescription vmstate_pcihost =3D { + .name =3D "PCIHost", + .needed =3D pci_host_needed, + .version_id =3D 1, + .minimum_version_id =3D 1, + .fields =3D (VMStateField[]) { + VMSTATE_UINT32(config_reg, PCIHostState), + VMSTATE_END_OF_LIST() + } +}; + +static Property pci_host_properties_common[] =3D { + DEFINE_PROP_BOOL("x-config-reg-migration-enabled", PCIHostState, + mig_enabled, true), + DEFINE_PROP_END_OF_LIST(), +}; + +static void pci_host_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + device_class_set_props(dc, pci_host_properties_common); + dc->vmsd =3D &vmstate_pcihost; +} + static const TypeInfo pci_host_type_info =3D { .name =3D TYPE_PCI_HOST_BRIDGE, .parent =3D TYPE_SYS_BUS_DEVICE, .abstract =3D true, .class_size =3D sizeof(PCIHostBridgeClass), .instance_size =3D sizeof(PCIHostState), + .class_init =3D pci_host_class_init, }; =20 static void pci_host_register_types(void) --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595858002; cv=none; d=zohomail.com; s=zohoarc; b=n2MNac7GOFh13KXgGfammBumQLpJo7PJXAjlnH1Aeh0eDZwcpjzl8AsUZGW5Cn87dZ2w5UoecuYN6DJWLUaaVpzCuOSNUjHfIAQQxR1OqQx12J4jTI8Zg9thFFR2TvDL5VK6YMUO1tgvLqorJ3t88ArfXX0ZjwGgE0MIzetZpas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595858002; h=Content-Type: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=jDOBhMj9mTthbBDayG63AdbCft5czYR2Ql8F2mkHukE=; b=EizFNoZUgaTZe9qEFp9K4etWEk4jMXkc9+YB5dWbmtHyyk1E7bmBZo8cLaLklJlHviQD6z90ET2HYwdcdPu5Fnu3c4tu+C6FrDiEig67k235EgLYJJpik8nyMACMMFVQ+4azMHSeRxJsJq9xboouCDDJBo9KXiXNRgHpsa68Xr8= 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 1595858002958287.5717508867068; Mon, 27 Jul 2020 06:53:22 -0700 (PDT) Received: from localhost ([::1]:36728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03ZB-0002CS-L8 for importer@patchew.org; Mon, 27 Jul 2020 09:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vj-0005LO-Je for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:28714 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vh-0001vL-PW for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:47 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-criklyX3M2OD6G6PPpq_RQ-1; Mon, 27 Jul 2020 09:49:41 -0400 Received: by mail-wr1-f70.google.com with SMTP id w1so1938089wro.4 for ; Mon, 27 Jul 2020 06:49:41 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id i4sm13165157wrw.26.2020.07.27.06.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857785; 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=jDOBhMj9mTthbBDayG63AdbCft5czYR2Ql8F2mkHukE=; b=RG9G+H4Mgzuo+QzlnD+O8ReeccCV/9qW5NFucGkWGC0Y2hAkRFUYBG/u5/1SBB7fHeY1kc r44q9bhgP3qfrlypXWxZERgeDxBhrkhfy+Ile+V8deqnSqe7Qx0w3Wq6i1pCgG4hhSF8vb Xm/58kvCECOXxp+yc/sB3So0gp3uhSY= X-MC-Unique: criklyX3M2OD6G6PPpq_RQ-1 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=jDOBhMj9mTthbBDayG63AdbCft5czYR2Ql8F2mkHukE=; b=bSTqn5dFacg7oSS8TFEgRbtcUzYCkyHCf4UDQZHFuUP5bmiggtQTwcMy8MjYB/mLeN z3HKHjuFPI4god+v3osaSjbrPyU9+HLIM5XsMd/fEYoOHaKgVffr/brRjc/7YfbF8mKk lCROb3FSlYCKjPWQWuWmU+rSW9r1KPGaC27gmbz3GSjEQ/SKSnnOD8vLd986WfICvicP 1KXBsiYNPUOAKvRIQLdbeZelgaEWRIDxS0yfPWHmDTqSU1czV4T8rpSKYH6GjPuwRTzo KvElykYxEyh5peCWmeca+jWFoTj2XODRmF/zYtPv92SQEwESLqPy22nA1u/uQRsfc2Hc GWcw== X-Gm-Message-State: AOAM531Zqmf46fh6kAS18jiWAIpKTWZHkvXBJ+dygn3kCV9ntv0c4olx ZTQUFaCV/tprwqPYEj5mEQc0rxhVdeFFH/yArORNUmFklIb0UCRFHROElCvJ+13YKc7difMRFnK E4R/k5Jf7IQdvFeQ= X-Received: by 2002:a1c:3c87:: with SMTP id j129mr12922489wma.176.1595857779569; Mon, 27 Jul 2020 06:49:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNXez94mI20inZp3KkKxHVxDf3UfdiETMSqDygy4VfJ0QvHeabE11/vNlc6R9DxvrsQC6Hjw== X-Received: by 2002:a1c:3c87:: with SMTP id j129mr12922470wma.176.1595857779235; Mon, 27 Jul 2020 06:49:39 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 3/7] hw/pci-host: save/restore pci host config register for old ones Message-ID: <20200727134614.96376-4-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-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 (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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 00:16:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 , Hogan Wang , qemu-stable@nongnu.org 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 Content-Type: text/plain; charset="utf-8" From: Hogan Wang The i440fx and q35 machines integrate i440FX or MCH PCI device by default. Refer to i440FX and ICH9-LPC spcifications, there are some reserved configuration registers can used to save/restore PCIHostState.config_reg. It's nasty but friendly to old ones. Reproducer steps: step 1. Make modifications to seabios and qemu for increase reproduction efficiency, write 0xf0 to 0x402 port notify qemu to stop vcpu after 0x0cf8 port wrote i440 configure register. qemu stop vcpu when catch 0x402 port wrote 0xf0. seabios:/src/hw/pci.c @@ -52,6 +52,11 @@ void pci_config_writeb(u16 bdf, u32 addr, u8 val) writeb(mmconfig_addr(bdf, addr), val); } else { outl(ioconfig_cmd(bdf, addr), PORT_PCI_CMD); + if (bdf =3D=3D 0 && addr =3D=3D 0x72 && val =3D=3D 0xa) { + dprintf(1, "stop vcpu\n"); + outb(0xf0, 0x402); // notify qemu to stop vcpu + dprintf(1, "resume vcpu\n"); + } outb(val, PORT_PCI_DATA + (addr & 3)); } } qemu:hw/char/debugcon.c @@ -60,6 +61,9 @@ static void debugcon_ioport_write(void *opaque, hwaddr ad= dr, uint64_t val, printf(" [debugcon: write addr=3D0x%04" HWADDR_PRIx " val=3D0x%02" PRI= x64 "]\n", addr, val); #endif + if (ch =3D=3D 0xf0) { + vm_stop(RUN_STATE_PAUSED); + } /* XXX this blocks entire thread. Rewrite to use * qemu_chr_fe_write and background I/O callbacks */ qemu_chr_fe_write_all(&s->chr, &ch, 1); step 2. start vm1 by the following command line, and then vm stopped. $ qemu-system-x86_64 -machine pc-i440fx-5.0,accel=3Dkvm\ -netdev tap,ifname=3Dtap-test,id=3Dhostnet0,vhost=3Don,downscript=3Dno,scr= ipt=3Dno\ -device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,bus=3Dpci.0,addr=3D0x13= ,bootindex=3D3\ -device cirrus-vga,id=3Dvideo0,vgamem_mb=3D16,bus=3Dpci.0,addr=3D0x2\ -chardev file,id=3Dseabios,path=3D/var/log/test.seabios,append=3Don\ -device isa-debugcon,iobase=3D0x402,chardev=3Dseabios\ -monitor stdio step 3. start vm2 to accept vm1 state. $ qemu-system-x86_64 -machine pc-i440fx-5.0,accel=3Dkvm\ -netdev tap,ifname=3Dtap-test1,id=3Dhostnet0,vhost=3Don,downscript=3Dno,sc= ript=3Dno\ -device virtio-net-pci,netdev=3Dhostnet0,id=3Dnet0,bus=3Dpci.0,addr=3D0x13= ,bootindex=3D3\ -device cirrus-vga,id=3Dvideo0,vgamem_mb=3D16,bus=3Dpci.0,addr=3D0x2\ -chardev file,id=3Dseabios,path=3D/var/log/test.seabios,append=3Don\ -device isa-debugcon,iobase=3D0x402,chardev=3Dseabios\ -monitor stdio \ -incoming tcp:127.0.0.1:8000 step 4. execute the following qmp command in vm1 to migrate. (qemu) migrate tcp:127.0.0.1:8000 step 5. execute the following qmp command in vm2 to resume vcpu. (qemu) cont Before this patch, we can get KVM "emulation failure" error on vm2. This patch fixes it. Cc: qemu-stable@nongnu.org Signed-off-by: Hogan Wang Message-Id: <20200727084621.3279-2-hogan.wang@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci-host/i440fx.c | 31 +++++++++++++++++++++++++++++++ hw/pci-host/q35.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index 8ed2417f0c..b78c8bc5f9 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -64,6 +64,14 @@ typedef struct I440FXState { */ #define I440FX_COREBOOT_RAM_SIZE 0x57 =20 +/* Older I440FX machines (5.0 and older) not support i440FX-pcihost state + * migration, use some reserved INTEL 82441 configuration registers to + * save/restore i440FX-pcihost config register. Refer to [INTEL 440FX PCIS= ET + * 82441FX PCI AND MEMORY CONTROLLER (PMC) AND 82442FX DATA BUS ACCELERATOR + * (DBX) Table 1. PMC Configuration Space] + */ +#define I440FX_PCI_HOST_CONFIG_REG 0x94 + static void i440fx_update_memory_mappings(PCII440FXState *d) { int i; @@ -98,8 +106,30 @@ static void i440fx_write_config(PCIDevice *dev, static int i440fx_post_load(void *opaque, int version_id) { PCII440FXState *d =3D opaque; + PCIDevice *dev; + PCIHostState *s =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/i440fx", = NULL), + TYPE_PCI_HOST_BRIDGE); =20 i440fx_update_memory_mappings(d); + + if (!s->mig_enabled) { + dev =3D PCI_DEVICE(d); + s->config_reg =3D pci_get_long(&dev->config[I440FX_PCI_HOST_CONFIG= _REG]); + } + return 0; +} + +static int i440fx_pre_save(void *opaque) +{ + PCIDevice *dev =3D opaque; + PCIHostState *s =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/i440fx", = NULL), + TYPE_PCI_HOST_BRIDGE); + if (!s->mig_enabled) { + pci_set_long(&dev->config[I440FX_PCI_HOST_CONFIG_REG], + s->config_reg); + } return 0; } =20 @@ -107,6 +137,7 @@ static const VMStateDescription vmstate_i440fx =3D { .name =3D "I440FX", .version_id =3D 3, .minimum_version_id =3D 3, + .pre_save =3D i440fx_pre_save, .post_load =3D i440fx_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PCII440FXState), diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index b67cb9c29f..a187f20296 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -43,6 +43,15 @@ =20 #define Q35_PCI_HOST_HOLE64_SIZE_DEFAULT (1ULL << 35) =20 +/* Older Q35 machines (5.0 and older) not support q35-pcihost state + * migration, use some reserved INTEL MCH configuration registers to + * save/restore q35-pcihost config register. Refer to [Intel 3 Series + * Chipset Family Datasheet Table 5-1. DRAM Controller Register Address + * Map (D0:F0)] + */ +#define Q35_PCI_HOST_CONFIG_REG 0x70 + + static void q35_host_realize(DeviceState *dev, Error **errp) { PCIHostState *pci =3D PCI_HOST_BRIDGE(dev); @@ -513,7 +522,27 @@ static void mch_update(MCHPCIState *mch) static int mch_post_load(void *opaque, int version_id) { MCHPCIState *mch =3D opaque; + PCIDevice *dev; + PCIHostState *s =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/q35", NUL= L), + TYPE_PCI_HOST_BRIDGE); mch_update(mch); + if (!s->mig_enabled) { + dev =3D PCI_DEVICE(mch); + s->config_reg =3D pci_get_long(&dev->config[Q35_PCI_HOST_CONFIG_RE= G]); + } + return 0; +} + +static int mch_pre_save(void *opaque) +{ + PCIDevice *dev =3D opaque; + PCIHostState *s =3D OBJECT_CHECK(PCIHostState, + object_resolve_path("/machine/q35", NUL= L), + TYPE_PCI_HOST_BRIDGE); + if (!s->mig_enabled) { + pci_set_long(&dev->config[Q35_PCI_HOST_CONFIG_REG], s->config_reg); + } return 0; } =20 @@ -521,6 +550,7 @@ static const VMStateDescription vmstate_mch =3D { .name =3D "mch", .version_id =3D 1, .minimum_version_id =3D 1, + .pre_save =3D mch_pre_save, .post_load =3D mch_post_load, .fields =3D (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, MCHPCIState), --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595858016; cv=none; d=zohomail.com; s=zohoarc; b=cXTJbXe3PC23ZUh28/S+lxLOLT/QJbwS5BrWTXC25Pufp64dQOD6ZDkfzay/hakXqPuDy6ScnYGtr5aDehy3RPpaiVAoCLYzc/xakzryHh6JlcvlLpHxWsirUm6ZKzDH2cI+jrGJOxdI/q5e8D2p1uwF9QQEKqzUdiT3BgULsxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595858016; 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=2bb6OtX/LD4ZX58mGeq2eGBkZlXvZDtQoKpqNCcHDcU=; b=NBMkPm0PgLkgVvh2kF5sagw1Q9Nb/ZrsGdEKTgrZLPo8TmwQkMCMFLWn1zDa3xTfv5sY1BSlHuue3JZv+N/WufXf/yHZQ9uDX7mhWR68pw5CzZRK+SB2Of6ZgwvYl5AVMAWkdKdLP5RdNIOHvh4FTL23ysgsX8m17AyRoYh1P4w= 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 1595858016578164.42486129118868; Mon, 27 Jul 2020 06:53:36 -0700 (PDT) Received: from localhost ([::1]:37898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03ZP-0002jX-AU for importer@patchew.org; Mon, 27 Jul 2020 09:53:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vq-0005U9-DA for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:54 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:58693 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vo-0001wN-KJ for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:54 -0400 Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-Dd-KUaD3Ncesp6VF0v6SXQ-1; Mon, 27 Jul 2020 09:49:50 -0400 Received: by mail-wr1-f70.google.com with SMTP id w1so1938234wro.4 for ; Mon, 27 Jul 2020 06:49:49 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id 32sm12283552wrn.86.2020.07.27.06.49.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857792; 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=2bb6OtX/LD4ZX58mGeq2eGBkZlXvZDtQoKpqNCcHDcU=; b=KLCvmUxA8pvPEU50bvWzM1f6RgxhbfUSS4h9clFDKx0E+LpRLK+FDpoQZmTYxi07XlXanj 9cNb+NQr6f1AneU9LIVfG+20qVS3ncxHUmOSwizAZtuk/+53waV+KtWNFeZdtiOxADQgl3 d2s8cAzQVGUglCF3sQE+e/oqUWclvdU= X-MC-Unique: Dd-KUaD3Ncesp6VF0v6SXQ-1 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=2bb6OtX/LD4ZX58mGeq2eGBkZlXvZDtQoKpqNCcHDcU=; b=QgErNLfwF/g11kCFUoEEKAKKwUxG2TUQKxxGcNjY1G9pChBmhEpnMi3JjODqvNCpg0 ziA2K40IoD11JDMfYVlh9Hgr6aDv3hG1TbyCtWRq2PzCWmFR+8NwLb84Q8mxkXNHrJHh 7Q81h4bPl7mzLkLI9fDl416IvdoSopeg2ZtzVVYeVblwEgtm9sTzjp2h7z/5fSWyB2jT j76uUUtcnvM33ZSJbC/YMhuAHZKYzEQrg10EG7KH2hubXLc//W1D3h6mC3CRyeQ2qGE1 cV/uCM/vuLJZvyjpkx+3gRCNjei4zQ12pQFQmgZg03myg+mFbABdo2CdUgb2yoLeHFMz eKuQ== X-Gm-Message-State: AOAM530K5gP2BrZlxJdenb+O6WdBhXDL2licRseBZONkC6nKjCqCpqxH 9lqq3nO8FBjqnEbQ7szFstE015f7tqGkGuImgUmT+w4x1sL8Wq0OHRjllVtpWBnQh847wJH2GfJ ToLJVdZqzS9uGVwk= X-Received: by 2002:a7b:c205:: with SMTP id x5mr21975195wmi.161.1595857787737; Mon, 27 Jul 2020 06:49:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc0bxZIVZdfd15jK1aD0TSqhIErH70IAF/kCvzhu9EUpS5F5h75F08gfobn/wRL4DKmLbSUg== X-Received: by 2002:a7b:c205:: with SMTP id x5mr21975179wmi.161.1595857787498; Mon, 27 Jul 2020 06:49:47 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 4/7] Fix vhost-user buffer over-read on ram hot-unplug Message-ID: <20200727134614.96376-5-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 01:44:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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 , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-stable@nongnu.org, Peter Turschmid , Raphael Norwitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Raphael Norwitz The VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS vhost-user protocol feature introduced a shadow-table, used by the backend to dynamically determine how a vdev's memory regions have changed since the last vhost_user_set_mem_table() call. On hot-remove, a memmove() operation is used to overwrite the removed shadow region descriptor(s). The size parameter of this memmove was off by 1 such that if a VM with a backend supporting the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS filled it's shadow-table (by performing the maximum number of supported hot-add operatons) and attempted to remove the last region, Qemu would read an out of bounds value and potentially crash. This change fixes the memmove() bounds such that this erroneous read can never happen. Signed-off-by: Peter Turschmid Signed-off-by: Raphael Norwitz Message-Id: <1594799958-31356-1-git-send-email-raphael.norwitz@nutanix.com> Fixes: f1aeb14b0809 ("Transmit vhost-user memory regions individually") Reviewed-by: Marc-Andr=C3=A9 Lureau Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 31231218dc..d7e2423762 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -672,7 +672,7 @@ static int send_remove_regions(struct vhost_dev *dev, memmove(&u->shadow_regions[shadow_reg_idx], &u->shadow_regions[shadow_reg_idx + 1], sizeof(struct vhost_memory_region) * - (u->num_shadow_regions - shadow_reg_idx)); + (u->num_shadow_regions - shadow_reg_idx - 1)); u->num_shadow_regions--; } =20 --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595858008; cv=none; d=zohomail.com; s=zohoarc; b=Wj0fm0pyhwtV5ryHSPs3bU5IXX+10U8+Rs4VG9KM7dsjW9wHqVm8DukS4LRLIMq3/m8xgvPe8xVR5vXvznQ/K26BSng/WBimky670JXrrfyAzwMbQlRvoORYlPuqkXdPoRYaZT4VrfQWkxKjxQuy4puiAM5w2H6pyUomGmxns6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595858008; 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=SlYRcRi7Yo9IrPxeu+mUP+g3rj5dPNkuezWzuDEddIw=; b=LQC3/dJgRgurR/ZkTny3x14J4cU2J8Q8OmjGyVK44InBqCCpCA+l8LkIwGCICJt22lqU8zqczKiHT05EBnyI27Owm2+w/tkozXb5bRtbICE57i00wD35VoXiCbhG+QMKZdnBXix6MG+dYLcblFQpL8pb5iKjUSlbkskufQLsVn8= 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 159585800889978.20259115172303; Mon, 27 Jul 2020 06:53:28 -0700 (PDT) Received: from localhost ([::1]:37132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03ZH-0002Nq-CY for importer@patchew.org; Mon, 27 Jul 2020 09:53:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vs-0005aD-OG for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:56 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:23847 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vr-0001wh-2u for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:56 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-JA6b0JLENf2o4EATBwhmGg-1; Mon, 27 Jul 2020 09:49:52 -0400 Received: by mail-wm1-f71.google.com with SMTP id z74so6543253wmc.4 for ; Mon, 27 Jul 2020 06:49:52 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id l67sm19650046wml.13.2020.07.27.06.49.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857794; 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=SlYRcRi7Yo9IrPxeu+mUP+g3rj5dPNkuezWzuDEddIw=; b=TkdqpEprmcv69rXIsuSypc0oE95Y7qQa39ILStKf6/lndYiK1jExJmBK2flqgR7HZe1YRg f0GyFuZBxg1cwkyFNvppp9M1rejFilPOtveCMxq4bH0JqiMo1AlVIPm+MTAT/37bCn9GpB 87ZDB6O9NtPwCmOKZTlr5OQJXY+dglE= X-MC-Unique: JA6b0JLENf2o4EATBwhmGg-1 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=SlYRcRi7Yo9IrPxeu+mUP+g3rj5dPNkuezWzuDEddIw=; b=cozG8ovcCP7qc7ofpsgRCL0XtST4V2lq8VFWtPIPPf52xlXBr+XoXOcxzoihQcZZcU cCQpvv6LKEnvaED9C+goCO08HUPcjy1AWZ0PsFIoHqkS8VfGMrzeBQbgVHeAEhb05ZZV 25FCzozXJtD1U3DehvY2Jru9LzV2cviZhZclEEDi/SeDJSdfyWxcwEYJIt2u9TDhbv8H exSWmCIxxT4AQkCs39ktohnPJr3wHEI1Ie3s2hr8fP3qBSPbwNboAyVJCCkoif2zOjEf HDJjYitK5SNyygDtA3VUXk8+RCu8NM63ImvmG81I0hTIz3yZ1hs3zKb0uy6wzywifIGV h1eQ== X-Gm-Message-State: AOAM53249M+zHgNZ6VJvqKXpeAWoZ3Jf6J9mgVA1OUMimAVknUsy1Orf L+ywn+XpxvPzgZFQm837JhBXGcyi4vFhUB4RfAWn53aOFrTPYN0gX2GhSvrH1m0XfvUli5HAYGv FzyNA8nH6taHFxJI= X-Received: by 2002:adf:9c8c:: with SMTP id d12mr20032799wre.369.1595857791077; Mon, 27 Jul 2020 06:49:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr5EMwKTZ0Jz+dKzgtog9m9+h7xvhRQu/erFzdAYyun6tOWypZ8hoHXo/Rncc8fCcuehGxhw== X-Received: by 2002:adf:9c8c:: with SMTP id d12mr20032779wre.369.1595857790901; Mon, 27 Jul 2020 06:49:50 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:47 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 5/7] libvhost-user: Report descriptor index on panic Message-ID: <20200727134614.96376-6-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 01:46:13 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -40 X-Spam_score: -4.1 X-Spam_bar: ---- X-Spam_report: (-4.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, 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 , Johannes Berg , qemu-stable@nongnu.org, Raphael Norwitz , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , "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) From: Philippe Mathieu-Daud=C3=A9 We want to report the index of the descriptor, not its pointer. Fixes: 7b2e5c65f4 ("contrib: add libvhost-user") Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200723171935.18535-1-philmd@redhat.com> Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Raphael Norwitz Reviewed-by: Stefan Hajnoczi Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/libvhost-user/libvhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/= libvhost-user.c index d315db1396..53f16bdf08 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -2074,7 +2074,7 @@ virtqueue_get_head(VuDev *dev, VuVirtq *vq, =20 /* If their number is silly, that's a fatal mistake. */ if (*head >=3D vq->vring.num) { - vu_panic(dev, "Guest says index %u is available", head); + vu_panic(dev, "Guest says index %u is available", *head); return false; } =20 @@ -2133,7 +2133,7 @@ virtqueue_read_next_desc(VuDev *dev, struct vring_des= c *desc, smp_wmb(); =20 if (*next >=3D max) { - vu_panic(dev, "Desc next is %u", next); + vu_panic(dev, "Desc next is %u", *next); return VIRTQUEUE_READ_DESC_ERROR; } =20 --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595857901; cv=none; d=zohomail.com; s=zohoarc; b=LQ5caMPTlRmEP2srWZvUSoVXwS4ww6iBx38WzKvAfpZYH/Lq17Vnti4HvyRf5tJ1XEUuaeb+5XMflRFyPKN2Oc7hyaQc4rhhYTkZcYFpElDRrljE3JqWtFj5tolr7f22fqq7QKZL2G8tm3rSYfhFYod5lXdj6dQD7okYEv5kzNM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595857901; h=Content-Type: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=nUT7Qbk7nFEddXYspzd8aisJc0jjaXW+jFGJmy8zWts=; b=fhBzSkG2fK1/m0ZHRvHjvLHQ7HRIr0BlZxp/OjoNAd6Qbq6oLyjFXA9dBV41M5EhG12LluS0/wtCkwn9Y/tk0JIxLakIKdx7J8kCtgu0xaCQ+A8QhQux96XQHFKea77aVtXqZ63ZFH/xQmWLAPnMJsBA5Ek/o1Ll7Xo2DUlUXe0= 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 159585790191921.39146655351226; Mon, 27 Jul 2020 06:51:41 -0700 (PDT) Received: from localhost ([::1]:59244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03XY-0008Bm-G6 for importer@patchew.org; Mon, 27 Jul 2020 09:51:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vv-0005hT-G1 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:59 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:49243 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vt-0001xB-R9 for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:49:59 -0400 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-oR3SZWCvMQGIzOBhVtD2xQ-1; Mon, 27 Jul 2020 09:49:55 -0400 Received: by mail-wr1-f69.google.com with SMTP id w1so1938315wro.4 for ; Mon, 27 Jul 2020 06:49:55 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id b63sm18839144wme.41.2020.07.27.06.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857797; 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=nUT7Qbk7nFEddXYspzd8aisJc0jjaXW+jFGJmy8zWts=; b=D/fUOl0qy2yJwQb5d7WGqPMn/vusWcSkiZI/5Du5VjvNJEU2EXDbAx4URazqQvni2bEjdL U4K1NbWLMwkj+e/HiG4TVSuZacBQRuVeQYHSgtuxTrnkfmjkLQ5AYHq8Dpl4syKljJ5IrT 1xwjiVk3dF6BbPCMKK45MAw52OZknN8= X-MC-Unique: oR3SZWCvMQGIzOBhVtD2xQ-1 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=nUT7Qbk7nFEddXYspzd8aisJc0jjaXW+jFGJmy8zWts=; b=uQDbxbuPMPbUQGTe+tEM7pY4VBc3a2IxrWxcUpPESJgw1aOAMEaopUweLoa6f8jHPX Yj8M802rZ8R3Ksg7SM98wJXzzl1ie/aN+CN8Hc/cj3KKiZ/y/OLkQrBDFUPMwwkRr4iN cfQlAoDMsETHbNGmhtYWQJNCW7wShcK2b9WGeDUSKaT4DQjBL8QvY6aXnCMFl7SwOCrl FrnV4aF02nJMYHcLeDKDwVjanfw4EmSh3BO6C/TBKr/zPahc51uMW3Kx9TkyciBAJkqS ukvjZLN3dzMmt2xUxpPsvQfvoHyV5khBud8umFY+SfHQkutoFj98kyHA6tKDdJg8nDT3 Lq1w== X-Gm-Message-State: AOAM532VwrWVzvcBxiKiWWkptAkpk7Fl6ZJU5Htqp2H1r0TuEdaLYAJZ 3yTs+dPwYQPwgCgUwnNDxYFrcXsIE5bZ376sNDE8XDDA1ueEuJhMDRdCFV8Ti7sAS3tYNuNZHad jRPboy3CJi0Ss1V0= X-Received: by 2002:adf:e504:: with SMTP id j4mr11918893wrm.205.1595857794108; Mon, 27 Jul 2020 06:49:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOaDPnh1xHkg2DFqBjjWwSiQkfkAuecs0pJAXikVeUHKS/Oyy0GegQwgUA9uyZnNeEjmdooQ== X-Received: by 2002:adf:e504:: with SMTP id j4mr11918879wrm.205.1595857793945; Mon, 27 Jul 2020 06:49:53 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 6/7] vhost-vdpa :Fix Coverity CID 1430270 / CID 1420267 Message-ID: <20200727134614.96376-7-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mst@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 03:37:14 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 , Jason Wang , Li Qiang , qemu-stable@nongnu.org, Cindy Lu 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 Content-Type: text/plain; charset="utf-8" From: Cindy Lu In the function vhost_vdpa_dma_map/unmap, The struct msg was not initialize= d all its fields. Signed-off-by: Cindy Lu Message-Id: <20200710064642.24505-1-lulu@redhat.com> Reviewed-by: Peter Maydell Acked-by: Jason Wang Reviewed-by: Li Qiang Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 65d5aaf08a..4580f3efd8 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -37,7 +37,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryReg= ionSection *section) static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr si= ze, void *vaddr, bool readonly) { - struct vhost_msg_v2 msg; + struct vhost_msg_v2 msg =3D {}; int fd =3D v->device_fd; int ret =3D 0; =20 @@ -60,7 +60,7 @@ static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwadd= r iova, hwaddr size, static int vhost_vdpa_dma_unmap(struct vhost_vdpa *v, hwaddr iova, hwaddr size) { - struct vhost_msg_v2 msg; + struct vhost_msg_v2 msg =3D {}; int fd =3D v->device_fd; int ret =3D 0; =20 --=20 MST From nobody Sun Feb 8 13:32:50 2026 Delivered-To: importer@patchew.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=1595858102; cv=none; d=zohomail.com; s=zohoarc; b=dtGht78ZFtoM0rAMk8zqb87uBVUgdtzwed/jKR2PLBCiH+G/zLjxZUK5kVsW+4UwMGnz8y5gX0zKfbvFddmKyExTTAE7JrNvGAIiypoe8UgTa9yVAlGdg290Z2yFtfa5OvoGlJHdLm1Qrkw0nga9KkyTAs16MJjWhA8bj/th4T4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595858102; 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=uXITvKmBNRuCK1oQcQxl+D6gdJLR2Jn4LOvKMTH1JwU=; b=gv8WQyAtBWa9c0wmCFpd+QTFMq//US9l4a/vxyz6NCzD+OBNs1trr7GIdC+6i+SQiFqvFYpMjB5494psSH9710SZs6hUR1AW3Izy12d1mG38PkD65tLSUIREdX37AQ1AZsuKy4YW3Kj/v+qC4iFa0SSWq82SVrpT660+FEcZUpQ= 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 1595858102915612.9970273411346; Mon, 27 Jul 2020 06:55:02 -0700 (PDT) Received: from localhost ([::1]:46010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k03an-00067f-N5 for importer@patchew.org; Mon, 27 Jul 2020 09:55:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k03Vz-0005rE-RA for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:50:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:25463 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1k03Vx-0001yc-Sr for qemu-devel@nongnu.org; Mon, 27 Jul 2020 09:50:03 -0400 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-k4u030l8NA2e93fexBbHCA-1; Mon, 27 Jul 2020 09:49:59 -0400 Received: by mail-wm1-f71.google.com with SMTP id b13so7845706wme.9 for ; Mon, 27 Jul 2020 06:49:59 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id 111sm6980416wrc.53.2020.07.27.06.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 06:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595857801; 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=uXITvKmBNRuCK1oQcQxl+D6gdJLR2Jn4LOvKMTH1JwU=; b=Hkqi0qXgfpMZkSq1LUvlj+sAbgaauIzSKSJ8XjdvQcP4R9txDe0Idl34wJ4zVyDjPvhrYe 6S6QjOeeUlUukPHGYijZB/AOIUhZ6E3k8uM3ldlLprwkpNP+WwR+qRXd5/qAvppxT6dC4s zjTqEnImNa7fE75TxhvYVrbTFoo4ToI= X-MC-Unique: k4u030l8NA2e93fexBbHCA-1 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=uXITvKmBNRuCK1oQcQxl+D6gdJLR2Jn4LOvKMTH1JwU=; b=AZRsOxdAaMTH5RfIO84Jchpk8TVjTb4iqnyioL01Md6Zt7LcuBpAua+DcXElMHmbdp Y6070Q7bcS5mtR/WL0NnThDHYD1l59fQMlNoIeP+MIOXe0U8hHvJn2wsUcDtFIjSfIgY AEQKwwZXyk3DnP1nyTuU/CGEIVdsTKl97YctsU5Ozgvkt69tRmdJzxrKg4HNOVysuQew 19lkpCQMFMxSVjxRZJTYME9d9kdB2LNPBkIKAKpgZhZE9djoOl1Kn+aIhhuU3JUsn59b 2c0b76nlKo+eMuHMz6tAxlE9A7aNY6AYAZueA78y7ePElVbPCijTLrl9+7khU2wjVIFo M6lw== X-Gm-Message-State: AOAM532oOSpBx95nOIXCuajEFKqXbGtdfEzUTIt7SXb89q8p/tTUs+jV KFFNd0f5HrDeRj6OJwRXPeWxxUk2rJXjFdp1+HfEvnR/N44FRhSDViPeKJ79E5b5oIKuDXlWTmk kj8NQtFAv6XcuZlc= X-Received: by 2002:a5d:4144:: with SMTP id c4mr20279497wrq.200.1595857797764; Mon, 27 Jul 2020 06:49:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzU5AsL6E7y4503fSx98Jssxl30XSXuHZ4FBywFGLzvPAcpIE4TRpOcuLGe+/JF3G0t6M9mwg== X-Received: by 2002:a5d:4144:: with SMTP id c4mr20279473wrq.200.1595857797601; Mon, 27 Jul 2020 06:49:57 -0700 (PDT) Date: Mon, 27 Jul 2020 09:49:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 7/7] MAINTAINERS: Cover the firmware JSON schema Message-ID: <20200727134614.96376-8-mst@redhat.com> References: <20200727134614.96376-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200727134614.96376-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mst@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 00:16:29 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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 , "Daniel P . Berrange" , Kashyap Chamarthy , Laszlo Ersek , Richard Henderson , Alex =?utf-8?Q?Benn=C3=A9e?= , Aleksandar Markovic , Gerd Hoffmann , Philippe =?utf-8?Q?Mathieu-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 an entry to cover firmware.json (see commit 3a0adfc9bf: schema that describes the different uses and properties of virtual machine firmware). Cc: Laszlo Ersek Cc: Gerd Hoffmann Cc: Michael S. Tsirkin Cc: Kashyap Chamarthy Cc: Daniel P. Berrange Suggested-by: Laszlo Ersek Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200703183450.32398-1-philmd@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laszlo Ersek Reviewed-by: Kashyap Chamarthy Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3395abd4e1..0886eb3d2b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2667,6 +2667,14 @@ F: include/hw/i2c/smbus_master.h F: include/hw/i2c/smbus_slave.h F: include/hw/i2c/smbus_eeprom.h =20 +Firmware schema specifications +M: Laszlo Ersek +M: Philippe Mathieu-Daud=C3=A9 +R: Daniel P. Berrange +R: Kashyap Chamarthy +S: Maintained +F: docs/interop/firmware.json + EDK2 Firmware M: Laszlo Ersek M: Philippe Mathieu-Daud=C3=A9 --=20 MST