From patchwork Fri Oct 30 14:11:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391058 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=ikZFrorP; 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 4CN46622Wyz9s0b for ; Sat, 31 Oct 2020 01:13:17 +1100 (AEDT) Received: from localhost ([::1]:48180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYV9W-0003dl-36 for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:13:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8I-0003dV-Ef for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:11:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8G-0007Eq-LV for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:11:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067115; 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=zjLk5rYnsVamvL3ZAKIsdxK/c57DAaLzJqbsx6rIiu4=; b=ikZFrorPSIsCAAhiBgOrTmCZtHh63PlJhUJIgmC7/XKMJ9yd2cXy6JywRa96IM/jrD3n/a RrXx2Ktvc3+F5oY1Gi2EE/WGHFjq3fyKQ9DBEudoSDmAB3rlanYQW4edF2Ann5M0peWhOi 6/+uTJdljVVH56/7vg4J8K1R8j0yWRg= 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-108-Du8iAnm_PF6prei9SduhxA-1; Fri, 30 Oct 2020 10:11:53 -0400 X-MC-Unique: Du8iAnm_PF6prei9SduhxA-1 Received: by mail-wr1-f69.google.com with SMTP id t11so2711890wrv.10 for ; Fri, 30 Oct 2020 07:11:53 -0700 (PDT) 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=zjLk5rYnsVamvL3ZAKIsdxK/c57DAaLzJqbsx6rIiu4=; b=b7/nd31lW9a7gHXpt+Nx2pzVY1nEaqLJsRtklKs21n9r30AR+/p+RdRCy7hvGAOc1+ VBZkM2bPpputDbPd+v6JVmVYAi5sPtVcKDYUTeLYbcKVhrShkOmHNz5eEd1YxceF/u2o S+BGPrjEGpe8afd1qRQZnxtdzmo2j6scRfnRe3aCMrlEnrMUjZoi2NW9VTCQQsBKtjNY PXg6YsFbq9bYqthTqK73H39lohUg+wQrnh7PQXWCYWStmTuB/RW2AMvifBOBOQWH7fXE ygWjb3kd6I+vXpomKozZuFjv2UXK/4jcQAwmlGLiAj+sP0Bwl8jBo3E1A0g4Tnh97ncA MI1w== X-Gm-Message-State: AOAM530KmRZ6GbZiRmZgGsSMJeSk4lo4axDFcjMiJDOYXuyl6tOnbzBa t6jjdRemx3QXC5OXj3u9qm3010VfcSc3p90SxN4n9wyBTbuYWGEIHENknfEGsFczkmk9jahVyQh Y01lBmXYoE2PaEoI= X-Received: by 2002:adf:e801:: with SMTP id o1mr3445194wrm.359.1604067111977; Fri, 30 Oct 2020 07:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ7rwxJD03mNtlZc9HA8WzkmryMRJRZMfCq1l1d5syilYFhE7x+osPmSN8FHFqIWSVk54Qhg== X-Received: by 2002:adf:e801:: with SMTP id o1mr3445174wrm.359.1604067111841; Fri, 30 Oct 2020 07:11:51 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id u202sm5046704wmu.23.2020.10.30.07.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:11:51 -0700 (PDT) Date: Fri, 30 Oct 2020 10:11:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 01/15] vhost-vdpa: negotiate VIRTIO_NET_F_STATUS with driver Message-ID: <20201030141136.1013521-2-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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: Si-Wei Liu , Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Si-Wei Liu Vendor driver may not support or implement config interrupt delivery for link status notifications. In this event, vendor driver is expected to NACK the feature, but guest will keep link always up. Signed-off-by: Si-Wei Liu Message-Id: <1601582985-14944-1-git-send-email-si-wei.liu@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index e2b3ba85bf..99c476db8c 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -55,6 +55,7 @@ const int vdpa_feature_bits[] = { VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, VIRTIO_NET_F_GUEST_ANNOUNCE, + VIRTIO_NET_F_STATUS, VHOST_INVALID_FEATURE_BIT }; From patchwork Fri Oct 30 14:11:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391065 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; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G8sHSqy6; 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 4CN4B46xzsz9s0b for ; Sat, 31 Oct 2020 01:16:44 +1100 (AEDT) Received: from localhost ([::1]:56576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVCs-0007Kj-K6 for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:16:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8O-0003fp-Qq for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8M-0007FC-3e for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067121; 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=3iN6qY5085FKhuB3oQvig3p5w7EA9qYLRFEmWUtLf20=; b=G8sHSqy66vielRPCn4oVUl8sNJR3u2fsW7Z60iHSdd4oh/NDdsJWElsgeHoKsLYM27Tv1L xu4n7Nu3wI/08sJgT74fb7iBx1WuO4NTz6hIOoiO4mA70IgsNUWsIOeMNLhSGTNmulspar ODr9rlX6HC7goPvOQJMha4N7jwSE9QU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-149-3mFcp4RWNbqkjf_ZY8GhyQ-1; Fri, 30 Oct 2020 10:11:55 -0400 X-MC-Unique: 3mFcp4RWNbqkjf_ZY8GhyQ-1 Received: by mail-wm1-f70.google.com with SMTP id y21so397235wmi.7 for ; Fri, 30 Oct 2020 07:11:55 -0700 (PDT) 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=3iN6qY5085FKhuB3oQvig3p5w7EA9qYLRFEmWUtLf20=; b=GejI8WGd6FfV1mpx5qWVnPL78bXvqvu/VjgKDTOjgHTTL/yh3I7ZG5eFiOU4j5uX3k v3igLuNGhJLQsmb63q9Yd+SCZ3qAGJDseqzsm+4vKhMQWYQetn2TtnBefkhht2e8sQ4W 2pumqUruNSRAdzvBPMKcYnsqSYXFJjw83D7Y/oWYdU7OkdcSo/u8yOPYrh+NjrlYUTev 3qzQH+8rt060TicZ9gHLpDpuGlVkmNqTcVPAr3K/qkdNd1GEmQb6FAt3mbWgsQDNAP3Y G3r5K7/o+mR1pWH6Wc6h1JHiHinrxx6IISP6CVdh9hkHO4JPXMLoNLzU+nLyKVJJtkox 8R8w== X-Gm-Message-State: AOAM532LTU8cMTCcrxGNTGSSGdnc4Ly8gjGxrw/ItuYZVeAhpt9xUcMT Wfkv+bky/IAhhJKPNIy21tUGvwJtqkydFpFVwfmlRiy4FneQBK9mKmtnb7Vy/iZFZE9SO9ig1Zk VjezMYFAHK0lRpt4= X-Received: by 2002:a5d:534d:: with SMTP id t13mr3295093wrv.69.1604067114191; Fri, 30 Oct 2020 07:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRswmFwFXfYKNzZjeNymBYTd7pW0k8LdpW4QABK5PwsJB5f3l/VKb+AKj4DKO4QsWQl341yQ== X-Received: by 2002:a5d:534d:: with SMTP id t13mr3295083wrv.69.1604067114045; Fri, 30 Oct 2020 07:11:54 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id 130sm5151750wmd.18.2020.10.30.07.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:11:53 -0700 (PDT) Date: Fri, 30 Oct 2020 10:11:52 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 02/15] vhost-vsock: set vhostfd to non-blocking mode Message-ID: <20201030141136.1013521-3-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Stefano Garzarella Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefano Garzarella vhost IOTLB API uses read()/write() to exchange iotlb messages with the kernel module. The QEMU implementation expects a non-blocking fd, indeed commit c471ad0e9b ("vhost_net: device IOTLB support") set it for vhost-net. Without this patch, if we enable iommu for the vhost-vsock device, QEMU can hang when exchanging IOTLB messages. As commit 894022e616 ("net: check if the file descriptor is valid before using it") did for tap, let's use qemu_try_set_nonblock() when fd is provided by the user. Signed-off-by: Stefano Garzarella Message-Id: <20201029144849.70958-1-sgarzare@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vsock.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index f9db4beb47..8ddfb9abfe 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -16,6 +16,7 @@ #include "qapi/error.h" #include "hw/virtio/virtio-access.h" #include "qemu/error-report.h" +#include "qemu/sockets.h" #include "hw/qdev-properties.h" #include "hw/virtio/vhost-vsock.h" #include "monitor/monitor.h" @@ -148,6 +149,13 @@ static void vhost_vsock_device_realize(DeviceState *dev, Error **errp) error_prepend(errp, "vhost-vsock: unable to parse vhostfd: "); return; } + + ret = qemu_try_set_nonblock(vhostfd); + if (ret < 0) { + error_setg_errno(errp, -ret, + "vhost-vsock: unable to set non-blocking mode"); + return; + } } else { vhostfd = open("/dev/vhost-vsock", O_RDWR); if (vhostfd < 0) { @@ -155,6 +163,8 @@ static void vhost_vsock_device_realize(DeviceState *dev, Error **errp) "vhost-vsock: failed to open vhost device"); return; } + + qemu_set_nonblock(vhostfd); } vhost_vsock_common_realize(vdev, "vhost-vsock"); From patchwork Fri Oct 30 14:11:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391060 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=QFGmXGmR; 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 4CN4683h6yz9s0b for ; Sat, 31 Oct 2020 01:13:20 +1100 (AEDT) Received: from localhost ([::1]:48266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYV9a-0003gs-Hd for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:13:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45888) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8N-0003fl-UW for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38037) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8L-0007F6-F0 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067120; 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=smveN6Rzbijww7fMqUTE3pDIKVjvYutAyE50uFiM4wM=; b=QFGmXGmRFpNJXJc5yRhbqwoWjECm69KYbYdC3Os0vRVOZcj0j8+EdtEJvlt/4ljEuJFjEH N/IuNV+qo+RRyraVyFzxvF0AdWdcaJiH8Iou9N7qXZg6VHYONyvHN8aPj2MVY/3VOJAiz2 +VBCWgQufEBl55zuhE1Ij6orzkVhnoE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-XxxoqjE3O2qlh_fdMTNGsw-1; Fri, 30 Oct 2020 10:11:58 -0400 X-MC-Unique: XxxoqjE3O2qlh_fdMTNGsw-1 Received: by mail-wm1-f70.google.com with SMTP id l23so668159wmg.6 for ; Fri, 30 Oct 2020 07:11:58 -0700 (PDT) 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=smveN6Rzbijww7fMqUTE3pDIKVjvYutAyE50uFiM4wM=; b=cPVHXXLFQLr7bKiCNokkpQGowsCnrW4Vy3VUh6HmErJy+DgtR+OM8mq3z670s3/vdL 5+RyJayhGmbF5rfF9jYMgjARZQjD9DSxsQ7K2rdQ04ZTa9JIJrICbFlP+/hWhy9V9cKI PSn+rIWv+Gd1wDqDPHht6P+yhdVGoYYNF9f1IVzKEPCQu6rFEZ3rU8AeRdi6l6gLC9xg MNMuysEkqEf0R6SReroc/seQOittD9cWRy+GlQXkP9SUDCeg2e5HrNW8kr3hpa3IJrf5 QNSWXAl3WKihjFTr0JqMcOEMyhSbufLAc07BSWS/jFDmCR07EnV2zQnHgRKjR4+ob/DP RHjQ== X-Gm-Message-State: AOAM531sUoUN8/y2Gfq7FWT3lZCR/A1vFZRHzrOR5mtAAKxHqhNsDWpz /z/H9pIrJ0mChpExiKRDotSZ8NjDOWliFyMPpBPg87PbpZNDhsKCrl/+ogdb3lEgpeCizgvLwz9 /I1BVF8D+nJFFVoc= X-Received: by 2002:a5d:6cc9:: with SMTP id c9mr3727074wrc.276.1604067116803; Fri, 30 Oct 2020 07:11:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAt7GGceYMLbksXnePSKL6GK/AXRaAnEXZdJOoy/uuSfG/o9rgJClybsLY+cbBNl+tNytLUg== X-Received: by 2002:a5d:6cc9:: with SMTP id c9mr3727053wrc.276.1604067116638; Fri, 30 Oct 2020 07:11:56 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id o197sm4816442wme.17.2020.10.30.07.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:11:55 -0700 (PDT) Date: Fri, 30 Oct 2020 10:11:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 03/15] acpi/crs: Prevent bad ranges for host bridges Message-ID: <20201030141136.1013521-4-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Ben Widawsky , Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Ben Widawsky Prevent _CRS resources being quietly chopped off and instead throw an assertion. _CRS is used by host bridges to declare regions of io and/or memory that they consume. On some (all?) platforms the host bridge doesn't have PCI header space and so they need some way to convey the information. Signed-off-by: Ben Widawsky Message-Id: <20201026193924.985014-1-ben.widawsky@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Igor Mammedov --- hw/i386/acpi-build.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index e3a4bc206c..98ff9f5cef 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -866,6 +866,8 @@ static Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set) crs_range_merge(temp_range_set.mem_ranges); for (i = 0; i < temp_range_set.mem_ranges->len; i++) { entry = g_ptr_array_index(temp_range_set.mem_ranges, i); + assert(entry->limit <= UINT32_MAX && + (entry->limit - entry->base + 1) <= UINT32_MAX); aml_append(crs, aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED, AML_NON_CACHEABLE, From patchwork Fri Oct 30 14:11:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391063 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=jLrHeNJC; 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 4CN4B35Yd6z9s0b for ; Sat, 31 Oct 2020 01:16:43 +1100 (AEDT) Received: from localhost ([::1]:56506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVCr-0007J2-MU for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:16:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8R-0003fz-IA for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8P-0007FL-UY for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067123; 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=LjrL669fVKay5a5661uPNZ920ikHdDz6ECFPczH1Ej8=; b=jLrHeNJC0zHFv45O6NsI0KiwP7Py/37hcgdZP5KAULHxDwfQrDxDoCs3cRdMBqHFUZfBXc lftI0GTq3buk9kC99mDJrA/hJX8e6DcWtOr8rDjNiUW8GFdFvadNYPbypaI+PA2FLJma1U 452EeLlCJkfExs+1ccPCeMlMZE8mKfE= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-AyE4HnMfN8iPceiKyCugfg-1; Fri, 30 Oct 2020 10:12:01 -0400 X-MC-Unique: AyE4HnMfN8iPceiKyCugfg-1 Received: by mail-wr1-f71.google.com with SMTP id j15so2705917wrd.16 for ; Fri, 30 Oct 2020 07:12:00 -0700 (PDT) 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=LjrL669fVKay5a5661uPNZ920ikHdDz6ECFPczH1Ej8=; b=PRNAuLOeHJJk5V6lh6NFw694M5qgud8d4vE+UWghGzWIVQ4h4Xh618xg0Vf5eH0nTF XtWGlaJwNQ6yQ067Y4yidN4IDMQBL1Buni/Z13Dv+mAEk0GUQt5+uRXbbKfd30ec1fEJ XlINSDF3fG5ebF5dE4cd81LxkEp6i/adGWl89U8DlgJJ1SWYf/T8TsvL6A70sN8Vdr6q DCbo9P9lWd2KueliOGQopA3dPfhEgLwAHbs4l47af4UWsscbJ5BUSOczo56N4bq5frBc l0ZkWyCAOooAg/GA5UJe11VOEeIkxLelZ31lVZHV87kb46gVrkEd/l6Vo+fpQJMMtQDV 8uOg== X-Gm-Message-State: AOAM532VFirQr+A2SCXjK5CTwznV7FDtJDyHAfOh0P+piF539i+SrUTm YEOwvOADsc2riDDJDlWmrdZ2YkchgohK7ei59QDCLBvgDsOADNmuihkdEOiCPHY8SkqVc/BqGhb fj4X/ZcWPCr4SPYU= X-Received: by 2002:adf:f4ca:: with SMTP id h10mr3349535wrp.89.1604067119399; Fri, 30 Oct 2020 07:11:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy57ZauUsYn++m5CJUSyedZk/Cr1sXkdcX/CAJFi7ldufNkNgGcLvjG+Er+N352oLtHDrgE5g== X-Received: by 2002:adf:f4ca:: with SMTP id h10mr3349514wrp.89.1604067119254; Fri, 30 Oct 2020 07:11:59 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id h7sm10390978wrt.45.2020.10.30.07.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:11:58 -0700 (PDT) Date: Fri, 30 Oct 2020 10:11:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 04/15] acpi/crs: Support ranges > 32b for hosts Message-ID: <20201030141136.1013521-5-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , Ben Widawsky , Eduardo Habkost , Igor Mammedov , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Ben Widawsky According to PCIe spec 5.0 Type 1 header space Base Address Registers are defined by 7.5.1.2.1 Base Address Registers (same as Type 0). The _CRS region should allow for the same range (up to 64b). Prior to this change, any host bridge utilizing more than 32b for the BAR would have the address truncated and likely lead to conflicts when the operating systems reads the _CRS object. Signed-off-by: Ben Widawsky Message-Id: <20201026193924.985014-2-ben.widawsky@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov --- hw/i386/acpi-build.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 98ff9f5cef..4f66642d88 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -786,8 +786,14 @@ static Aml *build_crs(PCIHostState *host, CrsRangeSet *range_set) crs_range_insert(temp_range_set.io_ranges, range_base, range_limit); } else { /* "memory" */ - crs_range_insert(temp_range_set.mem_ranges, - range_base, range_limit); + uint64_t length = range_limit - range_base + 1; + if (range_limit <= UINT32_MAX && length <= UINT32_MAX) { + crs_range_insert(temp_range_set.mem_ranges, range_base, + range_limit); + } else { + crs_range_insert(temp_range_set.mem_64bit_ranges, + range_base, range_limit); + } } } From patchwork Fri Oct 30 14:11:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391062 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; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SZGAN0kv; 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 4CN4B16LXjz9s0b for ; Sat, 31 Oct 2020 01:16:41 +1100 (AEDT) Received: from localhost ([::1]:56244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVCp-0007Cj-PS for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:16:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8a-0003gx-8B for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:31379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8S-0007FS-9g for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067126; 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=z+z1Pzm/JUurzVLAFZHFV/vzVTD3l9eIdz7HgpfiM6o=; b=SZGAN0kvq/VNwwdsRY2qBAOuAWdF0cfFzJp/RJMBHtAqPmmAdjwi6BcoEuJ68TGVyaWuKu y5XDqiXXSKsxmcj9B5Yum2bueQtt56gqbc65gZ3Nyqm3vr5+2oBuAW9aUjW+EuESlJTSs5 o2pKZ2f1wRfY5n90APQ0vinueBAeDvo= 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-566-LwwQ2NVbPzi9KMZzXJwGEg-1; Fri, 30 Oct 2020 10:12:03 -0400 X-MC-Unique: LwwQ2NVbPzi9KMZzXJwGEg-1 Received: by mail-wm1-f71.google.com with SMTP id l16so675029wmh.1 for ; Fri, 30 Oct 2020 07:12:03 -0700 (PDT) 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=z+z1Pzm/JUurzVLAFZHFV/vzVTD3l9eIdz7HgpfiM6o=; b=B1LNoqLCgAYR4cpJacUgmrfdGJqvSH83p82pyJGVR/ELNFanPA9Xxmu0f+AMnrpPdx zH72HHzTMH0oF35umTXzDfDxv1oNDc+pByVIWLBP9Ps43BZGtwt2kROa7/gk7mTjhgHc 8b0xUvdG/XniHtALB6ahLfM+MYrxUINLTFmf6ANKyHFSOdWXdgSwCiV8Sq5J5/85BDzZ KLjVFSBs43hffLNrFpFy6qkBv0yX96S3jmgqSSUuwE2z4PRZenlHbAQcjQCF+S9cD77H XRXpSy671ftm2Og2D0NT5CyJDoCkrmjdKKIZMoezWwdpchP2WnXogJOzV5kgfiZCRrzn mdqA== X-Gm-Message-State: AOAM5330UBBVyoDzOkFBYUDElZhdxJw+rSTVp0yEba1zScnaI3n7/OSW pCsy7H3UitvjE4XUq9rwAErwCk2XdnQ5GyTjjBEeoltimPMnBVxo2wv9YXAxf0pz2qIbJajLoc+ wPEGEQb6CrNnrnUQ= X-Received: by 2002:adf:a345:: with SMTP id d5mr3676938wrb.55.1604067121944; Fri, 30 Oct 2020 07:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJK59V30B6pikZed9qa0DwPV4Xs2nCeHAvWuN+ruiG4H7WUWeA+xqGtoqzm7aXzDl+5anUyA== X-Received: by 2002:adf:a345:: with SMTP id d5mr3676925wrb.55.1604067121820; Fri, 30 Oct 2020 07:12:01 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id z10sm3106178wrp.2.2020.10.30.07.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:01 -0700 (PDT) Date: Fri, 30 Oct 2020 10:11:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 05/15] hw/virtio/vhost-vdpa: Fix Coverity CID 1432864 Message-ID: <20201030141136.1013521-6-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Fix uninitialized value issues reported by Coverity: Field 'msg.reserved' is uninitialized when calling write(). Fixes: a5bd05800f8 ("vhost-vdpa: batch updating IOTLB mappings") Reported-by: Coverity (CID 1432864: UNINIT) Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201028154004.776760-1-philmd@redhat.com> 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 4f1039910a..01d2101d09 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -90,7 +90,7 @@ static void vhost_vdpa_listener_begin(MemoryListener *listener) { struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener); struct vhost_dev *dev = v->dev; - struct vhost_msg_v2 msg; + struct vhost_msg_v2 msg = {}; int fd = v->device_fd; if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { @@ -110,7 +110,7 @@ static void vhost_vdpa_listener_commit(MemoryListener *listener) { struct vhost_vdpa *v = container_of(listener, struct vhost_vdpa, listener); struct vhost_dev *dev = v->dev; - struct vhost_msg_v2 msg; + struct vhost_msg_v2 msg = {}; int fd = v->device_fd; if (!(dev->backend_cap & (0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH))) { From patchwork Fri Oct 30 14:12:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391061 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=G4uqe4aO; 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 4CN46D5dbNz9s0b for ; Sat, 31 Oct 2020 01:13:24 +1100 (AEDT) Received: from localhost ([::1]:48340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYV9e-0003jN-PA for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:13:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8a-0003gz-IN for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56227) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8W-0007Fi-7w for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067127; 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=rJH7iZei/FUThhkCklYQGVmfL7OJejtyEbzG9hdsPU0=; b=G4uqe4aOv01YJdqYif+e2Mw+I8jmiVATAbAgbCrNbEbs9Di/716NxZlKEWJcd2IxhBiDAt OIin2s3x4TuYm4BXRy0OLAnTskVnBZw4ciYMV/Sh4I4I3lCQ6XfN6Bmgdy/ubMyM92r3RP CGNJKFl4Wisbh74N00vkzawat4hcLxM= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-Z1H_bqEsM1WXEuvfMStGfg-1; Fri, 30 Oct 2020 10:12:06 -0400 X-MC-Unique: Z1H_bqEsM1WXEuvfMStGfg-1 Received: by mail-wr1-f72.google.com with SMTP id m20so2704306wrb.21 for ; Fri, 30 Oct 2020 07:12:05 -0700 (PDT) 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=rJH7iZei/FUThhkCklYQGVmfL7OJejtyEbzG9hdsPU0=; b=WUZxnd/010cBFtslt3KXDOod8Nw09Fe91QcAIVaPIAgMyypHTZPAo8uv+Idh83blJL wJ0Ob8mHXvt6sKJ/Pe1AWic2CbqPSi5P33HZdZ++li72KXqLUyh2yjXrJnHKa9+LPFQf sy+w8FVRAnz/D/iyLuvf7s8CuK5CuYMjrAtOFZWGQrEHVGMvFIUqkfaO703P+zAYHjiE Krg2PT0bD8dmKcmiKGDpOxCyy/iOT8Ohuc+DMGvePRFKCkve0pv9s2eon44ThRrnMwN6 RzdLdGbyQD3+xDxRz2oyDAFY6kyb8Z+94qoyHrvGVkZkPid0Dns9phDeYJdnP+ifcxF/ lOEw== X-Gm-Message-State: AOAM5317u+4kJTW1LGBOMPF7jQWPf9o0QcoYTD1Speo5tVhkFXSnnjef UjY1TzKVxKkUGheSLqlykUY/xWXOE1aLk3OXMdy55ume9ecf7JP9HdA/Ojg1n9Sl4SLLVfTweL7 4+CWt0Fh5KHnKb6A= X-Received: by 2002:a5d:4747:: with SMTP id o7mr3543326wrs.423.1604067124405; Fri, 30 Oct 2020 07:12:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7w+2Y04FRPM846EQJivrPXE9bZkKljysc9zSbbPwK9GD/heTRctZf2hWk9oDVJCO/KBzivw== X-Received: by 2002:a5d:4747:: with SMTP id o7mr3543310wrs.423.1604067124223; Fri, 30 Oct 2020 07:12:04 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id y200sm266949wmc.23.2020.10.30.07.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:03 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 06/15] hw/pci: Extract pci_bus_change_irq_level() from pci_change_irq_level() Message-ID: <20201030141136.1013521-7-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Mark Cave-Ayland , Philippe =?utf-8?q?Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé Extract pci_bus_change_irq_level() from pci_change_irq_level() to make it clearer it operates on the bus. Reported-by: Mark Cave-Ayland Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201024203900.3619498-2-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 100c9381c2..081ddcadd1 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -248,6 +248,12 @@ static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) d->irq_state |= level << irq_num; } +static void pci_bus_change_irq_level(PCIBus *bus, int irq_num, int change) +{ + bus->irq_count[irq_num] += change; + bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0); +} + static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) { PCIBus *bus; @@ -258,8 +264,7 @@ static void pci_change_irq_level(PCIDevice *pci_dev, int irq_num, int change) break; pci_dev = bus->parent_dev; } - bus->irq_count[irq_num] += change; - bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0); + pci_bus_change_irq_level(bus, irq_num, change); } int pci_bus_get_irq_level(PCIBus *bus, int irq_num) From patchwork Fri Oct 30 14:12:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391066 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=WkU7fxjW; 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 4CN4FX2HPCz9sPB for ; Sat, 31 Oct 2020 01:19:42 +1100 (AEDT) Received: from localhost ([::1]:36480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVFj-0002HL-8B for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:19:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8e-0003i9-Fr for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:56617) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8Z-0007Fx-2M for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067132; 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=B/zT27wrNEHsIn9RPNBpuM2tzqmJYYoAGZySli/obU8=; b=WkU7fxjW3w8waHRYU9T4WRwy+GDJxfZ1CizWcI9GR/JLNntWKXZ/qy4tQGf0dpW8aOMHg5 eyAB9SvKQzgixeL7pxmSTrV3CGa6bODcRNBdWaTc1JUt6BlBhPj1LLMflgGkMcKYxEpt3l kvxsWQoLayknZCMV8psnMToV3aI590E= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-3es-3gwWM8WqwBsIRMZ-Zg-1; Fri, 30 Oct 2020 10:12:08 -0400 X-MC-Unique: 3es-3gwWM8WqwBsIRMZ-Zg-1 Received: by mail-wr1-f72.google.com with SMTP id w3so616969wrt.11 for ; Fri, 30 Oct 2020 07:12:08 -0700 (PDT) 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=B/zT27wrNEHsIn9RPNBpuM2tzqmJYYoAGZySli/obU8=; b=dChyVuJPVA5qpka8/lh9wWDITGxescW6j+5+KiJnkGDZUKKjI3YmB4HWm2GH424tdc AL9AsIai8CgbFPHA4d+dPi06aSrr0ZSlrtLnr0ZWW0hXlj52/9im0oWgWsNimYgDs4NS PLzJv74sQObD5kqdLLMOxC5j6nZmymduyn2MbT7TYo/zgGGHiaW735XURaMG1KgNj6FE 2UKoIql2N35WMtPVqQwCVGkyX67YPVF5+LgBWgF56BpscJh0/6heMBAcgK4qMsWg0FBv dkmad+1jMhSSkxVuxuDoY/HB9E6F75btqu3comHSwISffQaPtX8+ZLc0+MXJcb+oDFCV baCA== X-Gm-Message-State: AOAM531GwDwBqCZNlc5imJVuV+2KyzQaPwq8CNsCQbFvIHuJaUdCbMkP 5TqqFcvfPp1eJinFE2pciPMcLo0OCFCrRVsb1Vexe6axltWmKOvuU0l0K5UlmHxnz3FqwWrrcJ/ ey3unPI6YMFmkgEA= X-Received: by 2002:a5d:688c:: with SMTP id h12mr3577080wru.92.1604067126720; Fri, 30 Oct 2020 07:12:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz88sXk08d3H74+ai8QgMNtx7G+dDD6r5jEDCWNgQ+yd73QVVkxAb6mKY5UPzwkhqDBXLLmfg== X-Received: by 2002:a5d:688c:: with SMTP id h12mr3577066wru.92.1604067126579; Fri, 30 Oct 2020 07:12:06 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id m14sm10754435wro.43.2020.10.30.07.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:05 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 07/15] pci: Assert irqnum is between 0 and bus->nirqs in pci_bus_change_irq_level Message-ID: <20201030141136.1013521-8-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , Mark Cave-Ayland , Philippe =?utf-8?q?Mathie?= =?utf-8?q?u-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Mark Cave-Ayland These assertions similar to those in the adjacent pci_bus_get_irq_level() function ensure that irqnum lies within the valid PCI bus IRQ range. Signed-off-by: Mark Cave-Ayland Message-Id: <20201011082022.3016-1-mark.cave-ayland@ilande.co.uk> Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201024203900.3619498-3-f4bug@amsat.org> Reviewed-by: Mark Cave-Ayland Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 081ddcadd1..dc4019865b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -250,6 +250,8 @@ static inline void pci_set_irq_state(PCIDevice *d, int irq_num, int level) static void pci_bus_change_irq_level(PCIBus *bus, int irq_num, int change) { + assert(irq_num >= 0); + assert(irq_num < bus->nirq); bus->irq_count[irq_num] += change; bus->set_irq(bus->irq_opaque, irq_num, bus->irq_count[irq_num] != 0); } From patchwork Fri Oct 30 14:12:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391068 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=V+KoyEvk; 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 4CN4Fs3Gdxz9sSG for ; Sat, 31 Oct 2020 01:20:01 +1100 (AEDT) Received: from localhost ([::1]:36814 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVG3-0002PM-Cx for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:19:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46002) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8f-0003iN-UZ for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60533) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8a-0007G5-9f for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067133; 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=hB2moo/cmsKV0TlRa+A5mqgcufQ43ovjOtrGZziNS+A=; b=V+KoyEvkiRU3MIQ+gYQoeJj4cGyDmqJbFJFhqnQUngEA0xykjOK912jFGR/d3KYLb0dlbB dGVuWZmxaFrWZ3hmmDxBRTRWdy9HZwiJe5AtadbFFv2oF9pJbB9Xfdrw+e26J7nxOAZgB3 Lj1AJsNF8C1ZrybbilKgSuQpdd9kPwY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-529-FqOT1Xs7OLSgcj_hswXgng-1; Fri, 30 Oct 2020 10:12:11 -0400 X-MC-Unique: FqOT1Xs7OLSgcj_hswXgng-1 Received: by mail-wm1-f69.google.com with SMTP id c10so440124wmh.6 for ; Fri, 30 Oct 2020 07:12:11 -0700 (PDT) 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=hB2moo/cmsKV0TlRa+A5mqgcufQ43ovjOtrGZziNS+A=; b=gnl156ttR+6Gn1CTu3JqqBlcfYAJStYiX4oVLeWsy5SU8r0hgT3Z9tDel4csd4OH+2 Wo7ImTqVL2NAKqEqK039dWMjAMtOv0p6TymTWa9bqb/23rY+LBoCNAS2oMmDk3jfJVyx owdLR0Mt5KVV4gV5piR9+xmyprQnzGTLQYohK5RTziW9pTdjTjv7D1q8ldtAYxiiLXGI KAdOD/dXFo4DmfUc3tdrVSeH1NmFH0vcVS6Dxwoc7Q/bRwUq9TglkyisMXJmeYf+81N+ Dkz7CGCDOSz1Dw+MyLHInq5InHCyfSuwC7qVwNQV3HituenUkc39kCpIX/dKceDna93b ATiw== X-Gm-Message-State: AOAM532GAR0NBDPsZyHgV8rNNhxs+6EGqNgdaiOLVUbucNhNB8XpJG96 oL/Sda4nTCbY5vFAewbuvsmopwCsVkVuCtp8SiYqshROeqAQLNfbWo6n3bEDHTQVMa8U0XPlU4w O6NksOIoYq5hzbNY= X-Received: by 2002:adf:cf10:: with SMTP id o16mr3136186wrj.264.1604067129560; Fri, 30 Oct 2020 07:12:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOXgFNg4LO+U7irrJ4ZfGItiEcSJhOgCYjGmSqPSQQuLf8S0P2kbGnfhHYpJFDbFCO6lf5vQ== X-Received: by 2002:adf:cf10:: with SMTP id o16mr3136118wrj.264.1604067128824; Fri, 30 Oct 2020 07:12:08 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id p4sm11205572wrf.67.2020.10.30.07.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:08 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 08/15] vhost: Don't special case vq->used_phys in vhost_get_log_size() Message-ID: <20201030141136.1013521-9-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Jason Wang , Greg Kurz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Greg Kurz The first loop in vhost_get_log_size() computes the size of the dirty log bitmap so that it allows to track changes in the entire guest memory, in terms of GPA. When not using a vIOMMU, the address of the vring's used structure, vq->used_phys, is a GPA. It is thus already covered by the first loop. When using a vIOMMU, vq->used_phys is a GIOVA that will be translated to an HVA when the vhost backend needs to update the used structure. It will log the corresponding GPAs into the bitmap but it certainly won't log the GIOVA. So in any case, vq->used_phys shouldn't be explicitly used to size the bitmap. Drop the second loop. This fixes a crash of the source when migrating a guest using in-kernel vhost-net and iommu_platform=on on POWER, because DMA regions are put over 0x800000000000000ULL. The resulting insanely huge log size causes g_malloc0() to abort. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1879349 Signed-off-by: Greg Kurz Message-Id: <160208823418.29027.15172801181796272300.stgit@bahia.lan> Acked-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 3077fa6ef5..79b2be20df 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -172,16 +172,6 @@ static uint64_t vhost_get_log_size(struct vhost_dev *dev) reg->memory_size); log_size = MAX(log_size, last / VHOST_LOG_CHUNK + 1); } - for (i = 0; i < dev->nvqs; ++i) { - struct vhost_virtqueue *vq = dev->vqs + i; - - if (!vq->used_phys && !vq->used_size) { - continue; - } - - uint64_t last = vq->used_phys + vq->used_size - 1; - log_size = MAX(log_size, last / VHOST_LOG_CHUNK + 1); - } return log_size; } From patchwork Fri Oct 30 14:12:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391067 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=F0SPUVCf; 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 4CN4Fb43T8z9sPB for ; Sat, 31 Oct 2020 01:19:47 +1100 (AEDT) Received: from localhost ([::1]:36666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVFp-0002Lr-FB for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:19:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8n-0003kh-Px for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30971) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8b-0007GD-W2 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067135; 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=et4yufnnD++h3AJk3UX83J9geIWo0Gn07GUHuuNVBW4=; b=F0SPUVCfnu3exJAzS0b/bO2Yd4hWv6TqlEXYsoTvjXL3XSBBObpgsfmJbicGu8dtnNiAu4 Jl+1r5AcOicjO9KbbJXbhbiWPCMUZScsw5vhYVj2haw+sPbXO6idKltAHy59l6KvUzYWDy 5RLGysrsl6bE+zho2B/MO/edftchNj0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-557-LZsVszREPCuToUf3RoNSGA-1; Fri, 30 Oct 2020 10:12:13 -0400 X-MC-Unique: LZsVszREPCuToUf3RoNSGA-1 Received: by mail-wm1-f69.google.com with SMTP id t21so664509wmt.8 for ; Fri, 30 Oct 2020 07:12:12 -0700 (PDT) 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=et4yufnnD++h3AJk3UX83J9geIWo0Gn07GUHuuNVBW4=; b=ogPajFItmHCvMreWDq0mw1GN+NigC9q9hoITPTbu1apQO28i9uJuZMe3JbjDzh1pFu zuZ3xTbcj7ZluNln7z27kQJF9/xb+8hhDmFDJZEfo4PdtQwJ4q4t5yeQJ9S28l9ILR39 HPIrA3J0NZViF5XSXx4FDMWXbRHqak7IX39ZfOBfb/fpL7zm0DYMTVZXKbmKSImbVsjx gFlv1ASh1BpJfV+U0EslxH4nmVQFc0GNMkvN+XdBsjnvSUy8tZGmN+joNkpxjrTBXYRY T5BttbgrK335KCqdoGQ2bQ+SOzTfZ0/GGcCxrwJU/WnM7KkuL4+Gx1DoK2Np2TDCbB3m JXLw== X-Gm-Message-State: AOAM5325ceq3iBfxvX090RxtaVdqeMUBv2JHcB553u//EruCyi6j01sA JF2LMX2qtLuVsjpxcnF0KKL5p4qqZXBytYi8z0En0FjUJKOVX6lw2v2skhhr2rqUJUbni3pAfOw dRA7pzJeFb5L+ARM= X-Received: by 2002:adf:de91:: with SMTP id w17mr3381734wrl.84.1604067131523; Fri, 30 Oct 2020 07:12:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxenQYLluWaV0MelRk2jGRS+18z8P0Ya7gU76Jyn65Op9K1fHWh3ZLUmaSI+6Yohfm6PQw55Q== X-Received: by 2002:adf:de91:: with SMTP id w17mr3381718wrl.84.1604067131349; Fri, 30 Oct 2020 07:12:11 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id t7sm10157363wrx.42.2020.10.30.07.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:10 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 09/15] pc: Implement -no-hpet as sugar for -machine hpet=on Message-ID: <20201030141136.1013521-10-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Richard Henderson , Eduardo Habkost , Paolo Bonzini Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Eduardo Habkost Get rid of yet another global variable. The default will be hpet=on only if CONFIG_HPET=y. Signed-off-by: Eduardo Habkost Message-Id: <20201021144716.1536388-1-ehabkost@redhat.com> Acked-by: Paolo Bonzini Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/pc.h | 1 + include/hw/i386/x86.h | 3 --- hw/i386/pc.c | 63 +++++++++++++++++++++++++++++-------------- hw/i386/pc_piix.c | 2 +- softmmu/vl.c | 4 +-- 5 files changed, 47 insertions(+), 26 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 84639d0ebc..911e460097 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -43,6 +43,7 @@ typedef struct PCMachineState { bool smbus_enabled; bool sata_enabled; bool pit_enabled; + bool hpet_enabled; /* NUMA information: */ uint64_t numa_nodes; diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h index bfa9cb2a25..739fac5087 100644 --- a/include/hw/i386/x86.h +++ b/include/hw/i386/x86.h @@ -126,7 +126,4 @@ 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/hw/i386/pc.c b/hw/i386/pc.c index 4e323755d0..416fb0e0f6 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1142,28 +1142,31 @@ void pc_basic_device_init(struct PCMachineState *pcms, * Without KVM_CAP_PIT_STATE2, we cannot switch off the in-kernel PIT * when the HPET wants to take over. Thus we have to disable the latter. */ - if (!no_hpet && (!kvm_irqchip_in_kernel() || kvm_has_pit_state2())) { + if (pcms->hpet_enabled && (!kvm_irqchip_in_kernel() || + kvm_has_pit_state2())) { hpet = qdev_try_new(TYPE_HPET); - if (hpet) { - /* For pc-piix-*, hpet's intcap is always IRQ2. For pc-q35-1.7 - * and earlier, use IRQ2 for compat. Otherwise, use IRQ16~23, - * IRQ8 and IRQ2. - */ - uint8_t compat = object_property_get_uint(OBJECT(hpet), - HPET_INTCAP, NULL); - if (!compat) { - qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs); - } - sysbus_realize_and_unref(SYS_BUS_DEVICE(hpet), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE); - - for (i = 0; i < GSI_NUM_PINS; i++) { - sysbus_connect_irq(SYS_BUS_DEVICE(hpet), i, gsi[i]); - } - pit_isa_irq = -1; - pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT); - rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT); + if (!hpet) { + error_report("couldn't create HPET device"); + exit(1); } + /* For pc-piix-*, hpet's intcap is always IRQ2. For pc-q35-1.7 + * and earlier, use IRQ2 for compat. Otherwise, use IRQ16~23, + * IRQ8 and IRQ2. + */ + uint8_t compat = object_property_get_uint(OBJECT(hpet), + HPET_INTCAP, NULL); + if (!compat) { + qdev_prop_set_uint32(hpet, HPET_INTCAP, hpet_irqs); + } + sysbus_realize_and_unref(SYS_BUS_DEVICE(hpet), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(hpet), 0, HPET_BASE); + + for (i = 0; i < GSI_NUM_PINS; i++) { + sysbus_connect_irq(SYS_BUS_DEVICE(hpet), i, gsi[i]); + } + pit_isa_irq = -1; + pit_alt_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_PIT_INT); + rtc_irq = qdev_get_gpio_in(hpet, HPET_LEGACY_RTC_INT); } *rtc_state = mc146818_rtc_init(isa_bus, 2000, rtc_irq); @@ -1535,6 +1538,20 @@ static void pc_machine_set_pit(Object *obj, bool value, Error **errp) pcms->pit_enabled = value; } +static bool pc_machine_get_hpet(Object *obj, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + + return pcms->hpet_enabled; +} + +static void pc_machine_set_hpet(Object *obj, bool value, Error **errp) +{ + PCMachineState *pcms = PC_MACHINE(obj); + + pcms->hpet_enabled = value; +} + static void pc_machine_get_max_ram_below_4g(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -1585,6 +1602,9 @@ static void pc_machine_initfn(Object *obj) pcms->smbus_enabled = true; pcms->sata_enabled = true; pcms->pit_enabled = true; +#ifdef CONFIG_HPET + pcms->hpet_enabled = true; +#endif pc_system_flash_create(pcms); pcms->pcspk = isa_new(TYPE_PC_SPEAKER); @@ -1705,6 +1725,9 @@ static void pc_machine_class_init(ObjectClass *oc, void *data) object_class_property_add_bool(oc, PC_MACHINE_PIT, pc_machine_get_pit, pc_machine_set_pit); + + object_class_property_add_bool(oc, "hpet", + pc_machine_get_hpet, pc_machine_set_hpet); } static const TypeInfo pc_machine_info = { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 0cf22a57ad..13d1628f13 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -216,7 +216,7 @@ static void pc_init1(MachineState *machine, i440fx_state = NULL; isa_bus = isa_bus_new(NULL, get_system_memory(), system_io, &error_abort); - no_hpet = 1; + pcms->hpet_enabled = false; } isa_bus_irqs(isa_bus, x86ms->gsi); diff --git a/softmmu/vl.c b/softmmu/vl.c index 7c1c6d37ef..a537a0377f 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -146,7 +146,6 @@ static Chardev **serial_hds; Chardev *parallel_hds[MAX_PARALLEL_PORTS]; int win2k_install_hack = 0; int singlestep = 0; -int no_hpet = 0; int fd_bootchk = 1; static int no_reboot; int no_shutdown = 0; @@ -3562,7 +3561,8 @@ void qemu_init(int argc, char **argv, char **envp) qemu_opts_parse_noisily(olist, "acpi=off", false); break; case QEMU_OPTION_no_hpet: - no_hpet = 1; + olist = qemu_find_opts("machine"); + qemu_opts_parse_noisily(olist, "hpet=off", false); break; case QEMU_OPTION_no_reboot: no_reboot = 1; From patchwork Fri Oct 30 14:12:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391069 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=fRkobOkC; 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 4CN4Jh4PqBz9sPB for ; Sat, 31 Oct 2020 01:22:28 +1100 (AEDT) Received: from localhost ([::1]:44638 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVIQ-0005im-Ge for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:22:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8n-0003kb-27 for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8e-0007GP-5o for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067137; 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=2qvybBCIE1Zjv+mt4qBhgbngIyzXePj4i5BwfD1rO8Y=; b=fRkobOkCOuLtGRwVoTJ09pOtj9QZ23IegeDvX1AJrDf1im1NB3XbMdiesi6qLg3WuBrUiO cPBn0URkX/x2fRAuPKqT/CWjctH/ZjW3B50noUwJzx1OQYcHCdnAYIsaaUi4Q9dVlPdPPI tZgUXy1akFDqmCtGzFVesEyezt2l/vY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-267-W60H11_yMPqhqjjq6OPXeQ-1; Fri, 30 Oct 2020 10:12:15 -0400 X-MC-Unique: W60H11_yMPqhqjjq6OPXeQ-1 Received: by mail-wm1-f69.google.com with SMTP id s25so1288277wmj.7 for ; Fri, 30 Oct 2020 07:12:15 -0700 (PDT) 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=2qvybBCIE1Zjv+mt4qBhgbngIyzXePj4i5BwfD1rO8Y=; b=UazhQq/dLbYlSyZGGAV6/WnBbH2hwgKJXTrKXYMb/Gui/pyi7iL585Y06qNLj1NP7p JA6R10jsT8ZJ3HAfPy1oR2jIQJ2Ndnan/wzZeOQav6f0NWQ98rQG1afuJNwz16S2pp7w 7ndlBwUieUJLtGRuFSZKyQSXbCouoa2rSsDrz0ybfr+/tZC6Z/LJpgGorzMjpSIUmcoT Oeye3qffPRtwRhCBFK7xD11ENGOZ92GM6aroPmklc7QWwHBA6qwII6PBGf9A2qtu23es LT08BK6Ts9krrX8CT+GoPKpD4Z7MDLL8cCA0PX5abyzXe5UdBm9arFZDwjsMO7NoImes /Ovg== X-Gm-Message-State: AOAM533YXz2T3hCKf8mcKuXE0oJ/ehGLBmLRUjt5HnQ+Uj+XajewIXGi 4uNiY7BLkLYP4U1I3uSPDx7WaUPmNIzRkl2qQotrcd3fyHKYT8ZbpjtY0brDpXJxPSd1+IPobxH tRMC/8KNoDexQHCY= X-Received: by 2002:adf:f3d2:: with SMTP id g18mr3385102wrp.367.1604067134045; Fri, 30 Oct 2020 07:12:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN5kYZwPcNmSF7+TOoJ8g7ZuWgR9u7nQCz4L3ssK5qlCIn5bV6VWcBJQDRJiNcTgeL3C38Uw== X-Received: by 2002:adf:f3d2:: with SMTP id g18mr3385078wrp.367.1604067133852; Fri, 30 Oct 2020 07:12:13 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id m1sm4744210wmm.34.2020.10.30.07.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:13 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 10/15] pci: advertise a page aligned ATS Message-ID: <20201030141136.1013521-11-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Jason Wang , qemu-stable@nongnu.org, Peter Xu Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang After Linux kernel commit 61363c1474b1 ("iommu/vt-d: Enable ATS only if the device uses page aligned address."), ATS will be only enabled if device advertises a page aligned request. Unfortunately, vhost-net is the only user and we don't advertise the aligned request capability in the past since both vhost IOTLB and address_space_get_iotlb_entry() can support non page aligned request. Though it's not clear that if the above kernel commit makes sense. Let's advertise a page aligned ATS here to make vhost device IOTLB work with Intel IOMMU again. Note that in the future we may extend pcie_ats_init() to accept parameters like queue depth and page alignment. Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang Message-Id: <20200909081731.24688-1-jasowang@redhat.com> Reviewed-by: Peter Xu Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 5b48bae0f6..d4010cf8f3 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -971,8 +971,9 @@ void pcie_ats_init(PCIDevice *dev, uint16_t offset) dev->exp.ats_cap = offset; - /* Invalidate Queue Depth 0, Page Aligned Request 0 */ - pci_set_word(dev->config + offset + PCI_ATS_CAP, 0); + /* Invalidate Queue Depth 0, Page Aligned Request 1 */ + pci_set_word(dev->config + offset + PCI_ATS_CAP, + PCI_ATS_CAP_PAGE_ALIGNED); /* STU 0, Disabled by default */ pci_set_word(dev->config + offset + PCI_ATS_CTRL, 0); From patchwork Fri Oct 30 14:12:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391073 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=ZrzXhAdS; 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 4CN4MB0kJsz9sPB for ; Sat, 31 Oct 2020 01:24:38 +1100 (AEDT) Received: from localhost ([::1]:50942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVKU-0008Lp-9P for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:24:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8p-0003ko-JR for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:24665) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8g-0007Gr-4D for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067140; 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=OQbV+eeH0Jal8wQ3qnCI4bc8h7HSMGkH1TuPaMitNA4=; b=ZrzXhAdSZLfwy/MiubA2A466KuFbSriDmKP3EzRRU5coPqfBwMpN7KGlZhcFQ7Z7glQ41u pwdaPjxVbZGPnIyOzLMddFWmUtD4WeciQ/u32//hdzXZWs6gSJNqQLVXiUAOVu9rcdUeNy FEHahum/0Wjrv00mg0HORnXauznD0lQ= 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-584-x38lNmS3PgKJFA258oCA6A-1; Fri, 30 Oct 2020 10:12:18 -0400 X-MC-Unique: x38lNmS3PgKJFA258oCA6A-1 Received: by mail-wr1-f70.google.com with SMTP id u1so438427wri.6 for ; Fri, 30 Oct 2020 07:12:17 -0700 (PDT) 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=OQbV+eeH0Jal8wQ3qnCI4bc8h7HSMGkH1TuPaMitNA4=; b=OLguExaIpH5R37Go0QOUCc/o65H/Gt6z5GQkSpCxAIKStHYbqktYFnGX0jesyB4sb6 2pji4i4EAX08bvbCIt1RELnW43jeed5BUOm1q+sTD7wTINo6a3yx7LjzH7uOB326RRSk Ju+fJqlRjrNG51kfEAd52X9l/BAW30kZcHS9EZko2q4oZmo7FLn0n8mY49P/NDBr84CV aecFwfQcVhCeso1HsYMaKATH5FbsRYIHeITIGqIjpatCaCIiz82tAFT/EOhvL2IBsJGF ULr9oFn5O9UUQYFfkZylyeWaN2rs1mzppdkHAeM7mT0tzKXOrXYzYW9cWOEzvIJVgMbL jtGw== X-Gm-Message-State: AOAM530Rbg62KHSwsn2zHN3ASFQSVFFtiGuqG0Yl+LqgA4X8QfdOOYYh fvl+UeTZFw/xNgwOMXVnpE90ikN8dCFYAYFUVynSqiUXMAQ8AyKBLH2HewVvyqtcgKeNUQwJciX XG+wnXcSn09TFr7U= X-Received: by 2002:adf:f90f:: with SMTP id b15mr3446882wrr.343.1604067136512; Fri, 30 Oct 2020 07:12:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeKwql4grIXbCG102LUAkCgmz3vxKB9/n7D9FrORDWmRxPH//XyZpPV2rGKGklAFjvUFKF7g== X-Received: by 2002:adf:f90f:: with SMTP id b15mr3446858wrr.343.1604067136337; Fri, 30 Oct 2020 07:12:16 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id y2sm4616786wmi.21.2020.10.30.07.12.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:15 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 11/15] pci: Change error_report to assert(3) Message-ID: <20201030141136.1013521-12-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , Ben Widawsky , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Ben Widawsky Asserts are used for developer bugs. As registering a bar of the wrong size is not something that should be possible for a user to achieve, this is a developer bug. While here, use the more obvious helper function. Signed-off-by: Ben Widawsky Message-Id: <20201015181411.89104-1-ben.widawsky@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé --- hw/pci/pci.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index dc4019865b..e5b7c9a42b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1151,11 +1151,7 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, assert(region_num >= 0); assert(region_num < PCI_NUM_REGIONS); - if (size & (size-1)) { - error_report("ERROR: PCI region size must be pow2 " - "type=0x%x, size=0x%"FMT_PCIBUS"", type, size); - exit(1); - } + assert(is_power_of_2(size)); r = &pci_dev->io_regions[region_num]; r->addr = PCI_BAR_UNMAPPED; From patchwork Fri Oct 30 14:12:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391071 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=JCAgmYUo; 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 4CN4KB4y6Hz9sSG for ; Sat, 31 Oct 2020 01:22:54 +1100 (AEDT) Received: from localhost ([::1]:45860 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVIq-0006Ej-6D for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:22:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8s-0003o7-2p for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:34302) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8n-0007H7-AV for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067143; 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=l6Xr3YozF4IKRpFrhD0A/HyzyCVetEbDlqfMsE4vvfI=; b=JCAgmYUo/KvXnGnW0Vq1xN5YrKCS0QzjvChkESFVHZpvJwctYg0SNJ1K4BTESKLnyC3jkN oUvNU2kYp3hRxbz3euOjaEwKOO4n1qislJUR9VzvfUaGtk5j/fQAW2eB7ZypnbsnNXDdU4 6S3xHnps+22W33SqsDHxg3V+JY3nmww= 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-433-VNtCPUKrOA61vRHvJ9iOfA-1; Fri, 30 Oct 2020 10:12:20 -0400 X-MC-Unique: VNtCPUKrOA61vRHvJ9iOfA-1 Received: by mail-wr1-f70.google.com with SMTP id h8so2712714wrt.9 for ; Fri, 30 Oct 2020 07:12:20 -0700 (PDT) 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=l6Xr3YozF4IKRpFrhD0A/HyzyCVetEbDlqfMsE4vvfI=; b=WO/jlhJb8M4Wpl8CqE/W7F/gE+CE9w7rETq38cfzJ1FNEoWHI7C4K3a+wylq6oApyC ZUkcefGomEU5Li6i6izpbD/XIATq9JrA2JXvEivUiFeZSQe/apw+RCVG5wTGkUApiPmH VgVMNWkCgS1tZzmCENAWgdJusxsKiEFH21mwrcjpN6LocXm/3pns14oRY08/1985JSAr xYK/CzFuZHlsPc2lDOAvt5Pu+ro7dYsRvv+ztElYC78gIw28UpOAltA97Oq36IyBtD+n hvM/SpyX0Ym29AxrJXpchXZPLIQYeS5kzNqv+Y7nm5OB2A7oYNGoBgUxKzuohKA6UiOe dDqw== X-Gm-Message-State: AOAM5305PVXe2qOJ84yZ1Ld8xj9y2XR2uIpXobOTa7cR4f0wG8X4/VU1 48FfPfnzUohgmUCvuNJjmYTjdxZvKFpSXnAy7AleTXMuW0Bc5/1JoS4+9bj6GcC7f5WInlwp8Pa TXTa8VXc3ec6VPPk= X-Received: by 2002:adf:e892:: with SMTP id d18mr3620631wrm.103.1604067138891; Fri, 30 Oct 2020 07:12:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfdnUb2d32ttTtm/PYVoQtbPY8uGtcVL12j/NYgBMoAc4PMSRACN7d5AyVvcQspH/JJnefDg== X-Received: by 2002:adf:e892:: with SMTP id d18mr3620590wrm.103.1604067138633; Fri, 30 Oct 2020 07:12:18 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id j9sm7394525wrr.49.2020.10.30.07.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:18 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 12/15] pci: Disallow improper BAR registration for type 1 Message-ID: <20201030141136.1013521-13-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 02:24:40 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, 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 , Ben Widawsky Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Ben Widawsky Prevent future developers working on root complexes, root ports, or bridges that also wish to implement a BAR for those, from shooting themselves in the foot. PCI type 1 headers only support 2 base address registers. It is incorrect and difficult to figure out what is wrong with the device when this mistake is made. With this, it is immediate and obvious what has gone wrong. Signed-off-by: Ben Widawsky Message-Id: <20201015181411.89104-2-ben.widawsky@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index e5b7c9a42b..0131d9d02c 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1148,11 +1148,17 @@ void pci_register_bar(PCIDevice *pci_dev, int region_num, uint32_t addr; /* offset in pci config space */ uint64_t wmask; pcibus_t size = memory_region_size(memory); + uint8_t hdr_type; assert(region_num >= 0); assert(region_num < PCI_NUM_REGIONS); assert(is_power_of_2(size)); + /* A PCI bridge device (with Type 1 header) may only have at most 2 BARs */ + hdr_type = + pci_dev->config[PCI_HEADER_TYPE] & ~PCI_HEADER_TYPE_MULTI_FUNCTION; + assert(hdr_type != PCI_HEADER_TYPE_BRIDGE || region_num < 2); + r = &pci_dev->io_regions[region_num]; r->addr = PCI_BAR_UNMAPPED; r->size = size; From patchwork Fri Oct 30 14:12:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391075 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=iCVqmiEC; 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 4CN4Q62JqNz9sSG for ; Sat, 31 Oct 2020 01:27:10 +1100 (AEDT) Received: from localhost ([::1]:57850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVMy-0002zU-7w for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:27:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46078) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8p-0003ls-TW for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:22887) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8n-0007HJ-BC for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067146; 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=gHTVvLyQX/nQL7WIpglC+HzeG7xS+O6ap0K+bTpJUHA=; b=iCVqmiECvBkDMnMdUBsyg29MoN+94+T+bDq8Vz62JqwOxotYaN71WCAIB9zz12wCLoQfDb 4Qv/c5PaNPSA70y4yV9N4YnUmTlW8NkH8wP75iMXu0WKuHGqSuYyPFIlOj+Y5FbsWz2CBe PZxT9IIemj8ZdNfN8Txtk/td1GVHqsc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-G3rtJnvINvyIs8QTY_2PtQ-1; Fri, 30 Oct 2020 10:12:23 -0400 X-MC-Unique: G3rtJnvINvyIs8QTY_2PtQ-1 Received: by mail-wm1-f72.google.com with SMTP id z7so1287059wme.8 for ; Fri, 30 Oct 2020 07:12:23 -0700 (PDT) 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=gHTVvLyQX/nQL7WIpglC+HzeG7xS+O6ap0K+bTpJUHA=; b=sieULGPfv4tbxmXZGdt2gIshVCLxQddVQZzEF5nIUWq0sEo6txeu70l75IKW9xoF+A Q4CQjFQETsrFlGzNja+PeDmLCQsSRbYZPZ6BXy6iTsrzI1pphWf7CPcUnbamNvtbFu7I LfJSdUIqSYOW9BCnQwHBsGVZgXw7048QaXsivG9Y6OpEugwqUfQAFrCGEZi4RutzAFom 1rWFTQi0gyvAHn8Qaeducilfv/yTIJmwphGNW+rQklO7pRwqVh4A41fo0BHoE7Rw/iOJ 19soGF97HX1NUdWGP1G319oyMGQJa5QS02lJQMYO/unsKZrfUB8HHNm5v3FticxM9Ph2 vnfw== X-Gm-Message-State: AOAM5308fhw5xXfrpR4SmRny0kMWGAJSEIxR8RwYWZQC0an4xhEt0twO Fj0EnJ9pTePTa077u8ZAULrvAaZKm5fPeiyXmEq5pXYhTbiV5gZZo556WXoWFxzJZsDg23Ph8T9 c3irkVzK9mPUrm8Q= X-Received: by 2002:adf:9066:: with SMTP id h93mr3661150wrh.166.1604067141297; Fri, 30 Oct 2020 07:12:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDIMb00/CfHdELkB/TIcXkpKPMTsvEx4C3H1aYIpKNR9OWMzVwoBhsXZEX7aY1Dh2QgUdd+g== X-Received: by 2002:adf:9066:: with SMTP id h93mr3661131wrh.166.1604067141159; Fri, 30 Oct 2020 07:12:21 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id t19sm5423460wmi.26.2020.10.30.07.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:20 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 13/15] vhost-blk: set features before setting inflight feature Message-ID: <20201030141136.1013521-14-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Jin Yu , Max Reitz , Raphael Norwitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Jin Yu Virtqueue has split and packed, so before setting inflight, you need to inform the back-end virtqueue format. Signed-off-by: Jin Yu Message-Id: <20200910134851.7817-1-jin.yu@intel.com> Acked-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 1 + hw/block/vhost-user-blk.c | 6 ++++++ hw/virtio/vhost.c | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 94585067f7..839bfb153c 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -141,6 +141,7 @@ void vhost_dev_reset_inflight(struct vhost_inflight *inflight); void vhost_dev_free_inflight(struct vhost_inflight *inflight); void vhost_dev_save_inflight(struct vhost_inflight *inflight, QEMUFile *f); int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f); +int vhost_dev_prepare_inflight(struct vhost_dev *hdev); int vhost_dev_set_inflight(struct vhost_dev *dev, struct vhost_inflight *inflight); int vhost_dev_get_inflight(struct vhost_dev *dev, uint16_t queue_size, diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c index a076b1e54d..f67b29bbf3 100644 --- a/hw/block/vhost-user-blk.c +++ b/hw/block/vhost-user-blk.c @@ -131,6 +131,12 @@ static int vhost_user_blk_start(VirtIODevice *vdev) s->dev.acked_features = vdev->guest_features; + ret = vhost_dev_prepare_inflight(&s->dev); + if (ret < 0) { + error_report("Error set inflight format: %d", -ret); + goto err_guest_notifiers; + } + if (!s->inflight->addr) { ret = vhost_dev_get_inflight(&s->dev, s->queue_size, s->inflight); if (ret < 0) { diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 79b2be20df..f2482378c6 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1645,6 +1645,24 @@ int vhost_dev_load_inflight(struct vhost_inflight *inflight, QEMUFile *f) return 0; } +int vhost_dev_prepare_inflight(struct vhost_dev *hdev) +{ + int r; + + if (hdev->vhost_ops->vhost_get_inflight_fd == NULL || + hdev->vhost_ops->vhost_set_inflight_fd == NULL) { + return 0; + } + + r = vhost_dev_set_features(hdev, hdev->log_enabled); + if (r < 0) { + VHOST_OPS_DEBUG("vhost_dev_prepare_inflight failed"); + return r; + } + + return 0; +} + int vhost_dev_set_inflight(struct vhost_dev *dev, struct vhost_inflight *inflight) { From patchwork Fri Oct 30 14:12:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391064 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=gO4u/vr3; 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 4CN4B428Dhz9sSG for ; Sat, 31 Oct 2020 01:16:44 +1100 (AEDT) Received: from localhost ([::1]:56572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVCs-0007Kg-5d for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:16:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8s-0003oB-Ip for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8p-0007HR-8j for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067147; 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=509YkEUpGBV1ErtRUsNd1psMy3xW+1ruB0fSsKITRuw=; b=gO4u/vr3snnPovY3mtEmw1gXtexieY/vAwSrCX1Q2SX8Rf/EpRsFIii6BOYQVaodq6GXlj B2I5tSvD3BF1UPiBELMaS2dN5kuixBHwjPVOXF7ZCv5ddxSGv95k3DNKYXTJ0zkHMewo9W 1pYYfMTdE4Zm3tyzliSFCA7OhJfJUio= 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-464-_ekKt7giO7-UWTdQIuQ4RA-1; Fri, 30 Oct 2020 10:12:25 -0400 X-MC-Unique: _ekKt7giO7-UWTdQIuQ4RA-1 Received: by mail-wm1-f71.google.com with SMTP id b68so670546wme.5 for ; Fri, 30 Oct 2020 07:12:25 -0700 (PDT) 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=509YkEUpGBV1ErtRUsNd1psMy3xW+1ruB0fSsKITRuw=; b=cwh6k4RqNmrSsT+jTDumUIueioxKmn7Z4bdCrGtLuQ9Vkzl4yzTxrdkwDs1GhmSieq SdSdeDls+rTz++qbPIrentLPqDRlMIGV6RatQ4bwjGuh2S9DZ1jadS8wCZo9kHyCdowv b4gOCLT/tCvuwzTEEx+TgUZV094a6OvloRNBX4fYVcaB+XPgYF9+Yn/D8UF8Jlng69N0 cIi/BR35KSmXdnnxABew4TdGKxOj4100olT7tE+9cZYIqntimUx+J6/Ou7xXd8tSc0SV GSlTWNhOmz4N97tZEKCreN+dh0Sz4IIHbLn1/pDltBIArsyZeEDTri6ZLN3sxs6BRI52 bnyw== X-Gm-Message-State: AOAM531j+UnYkxBI9QxPM+4Q3LhPF3bIUHXeQT/rsEmMMnNbVk6ngFHP r5zhbscdhkZfC+i09lkbb3UVbchDZLqK+FInije3E8v1JEH88YPhYAKhlwkcpQ6IZ6qwSat8mT4 Pd8j9DsQoxmLAN2o= X-Received: by 2002:a5d:554b:: with SMTP id g11mr3476477wrw.370.1604067143794; Fri, 30 Oct 2020 07:12:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOO1kOXsh78wpA3CxygZa/o5KI1H5QmBu/eqD3taBkynXdsgJrLRVEMZJZSrrWzhta7oZtHA== X-Received: by 2002:a5d:554b:: with SMTP id g11mr3476461wrw.370.1604067143643; Fri, 30 Oct 2020 07:12:23 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id a3sm4835738wmb.46.2020.10.30.07.12.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:22 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 14/15] virtio: skip guest index check on device load Message-ID: <20201030141136.1013521-15-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , Jason Wang , Felipe Franciosi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Felipe Franciosi QEMU must be careful when loading device state off migration streams to prevent a malicious source from exploiting the emulator. Overdoing these checks has the side effect of allowing a guest to "pin itself" in cloud environments by messing with state which is entirely in its control. Similarly to what f3081539 achieved in usb_device_post_load(), this commit removes such a check from virtio_load(). Worth noting, the result of a load without this check is the same as if a guest enables a VQ with invalid indexes to begin with. That is, the virtual device is set in a broken state (by the datapath handler) and must be reset. Signed-off-by: Felipe Franciosi Message-Id: <20201028134643.110698-1-felipe@nutanix.com> Acked-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 6f8f865aff..ceb58fda6c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -17,6 +17,7 @@ #include "trace.h" #include "exec/address-spaces.h" #include "qemu/error-report.h" +#include "qemu/log.h" #include "qemu/main-loop.h" #include "qemu/module.h" #include "hw/virtio/virtio.h" @@ -3160,12 +3161,12 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id) nheads = vring_avail_idx(&vdev->vq[i]) - vdev->vq[i].last_avail_idx; /* Check it isn't doing strange things with descriptor numbers. */ if (nheads > vdev->vq[i].vring.num) { - error_report("VQ %d size 0x%x Guest index 0x%x " - "inconsistent with Host index 0x%x: delta 0x%x", - i, vdev->vq[i].vring.num, - vring_avail_idx(&vdev->vq[i]), - vdev->vq[i].last_avail_idx, nheads); - return -1; + qemu_log_mask(LOG_GUEST_ERROR, + "VQ %d size 0x%x Guest index 0x%x " + "inconsistent with Host index 0x%x: delta 0x%x", + i, vdev->vq[i].vring.num, + vring_avail_idx(&vdev->vq[i]), + vdev->vq[i].last_avail_idx, nheads); } vdev->vq[i].used_idx = vring_used_idx(&vdev->vq[i]); vdev->vq[i].shadow_avail_idx = vring_avail_idx(&vdev->vq[i]); From patchwork Fri Oct 30 14:12:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1391070 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; dmarc=fail (p=none dis=none) header.from=redhat.com 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=LQLHxNQS; 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 4CN4Jm6YqRz9sPB for ; Sat, 31 Oct 2020 01:22:32 +1100 (AEDT) Received: from localhost ([::1]:44974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kYVIU-0005rh-Ox for incoming@patchwork.ozlabs.org; Fri, 30 Oct 2020 10:22:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kYV8t-0003pI-HD for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43097) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kYV8r-0007Hk-Ax for qemu-devel@nongnu.org; Fri, 30 Oct 2020 10:12:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604067151; 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=d0O00/al7cwQGWZwwOP6NLGwTcTYmOVWX7BhS/dcA4E=; b=LQLHxNQSzW3VeNodyJ5moxkw8cJY6i+LB0PxAK2pE7fGl2wnzAsxeUIrF+cq43W2Y+Eo85 /c17p02jwlH5wFXBVpQ3/5Unl8TnVDdoIFF2k0Y3i/i5wpZ5vPxkLg9UHEJ7Ihqdf4OG40 npFVExakoJ5TKmAQMa3hAcWGzcah+oU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-0iXj627ONi2OBktI-Bue_g-1; Fri, 30 Oct 2020 10:12:28 -0400 X-MC-Unique: 0iXj627ONi2OBktI-Bue_g-1 Received: by mail-wm1-f70.google.com with SMTP id t21so664749wmt.8 for ; Fri, 30 Oct 2020 07:12:28 -0700 (PDT) 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=d0O00/al7cwQGWZwwOP6NLGwTcTYmOVWX7BhS/dcA4E=; b=hLWfqELOjrcDBZyfN7TuDJ8N4L1VOqSd1YugzDwRMCECRN3WqZBkNsXV4ruyvnZaSD eSO5t2/IvQia/GYamTc27aLSIYHWDK0Jr7ZmfYbw39ljb3cUaDv1KIpX71K6tT97RuPG Q479w+Xqz5D66PVJcLAS1bDa6xCIGhmQ+AMlYCtXlLrJFNbpaiwfiUGSg3DcsLd5Pmxi DD9pVWnVxdLEJ1osoyXrqHi+mMQ6zU+2R9KMqLb/HeixTj7sbwu+U8ioz9E1cMva8Nyf oNRtcXD94fpcWp1OHzrqTlyCAW0/rHkVHv7JyYRCeJ5UWXrgElTQcT2Ifuuf77req9RX x77A== X-Gm-Message-State: AOAM5312OS4vU/z3bYwz72Zh1W05W/atSJlSxGmOdc3PSBzPB+1S0v8I 1rIW8WRfqUGqahVwcPuNI43vIf7si6K/QvbUWtlFHR0Asa0u7Sx+o3JfbzFfill9wtCKxnC9uEM WUdKisHR3LciyxyI= X-Received: by 2002:a1c:4646:: with SMTP id t67mr3036968wma.40.1604067146761; Fri, 30 Oct 2020 07:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcTcYNgqIFZ0NNodQZDD9IwI+YtMCFvbOWX+sYeS8Vc9t8Afe/H296/0mB688FAqZA7kKPqg== X-Received: by 2002:a1c:4646:: with SMTP id t67mr3036929wma.40.1604067146524; Fri, 30 Oct 2020 07:12:26 -0700 (PDT) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id b4sm2655071wro.57.2020.10.30.07.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 07:12:25 -0700 (PDT) Date: Fri, 30 Oct 2020 10:12:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL 15/15] intel_iommu: Fix two misuse of "0x%u" prints Message-ID: <20201030141136.1013521-16-mst@redhat.com> References: <20201030141136.1013521-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201030141136.1013521-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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/30 01:22:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_NONE=-0.0001, RCVD_IN_MSPIKE_H5=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 , Eduardo Habkost , Jason Wang , "Dr . David Alan Gilbert" , Peter Xu , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Peter Xu Dave magically found this. Fix them with "0x%x". Reported-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <20201019173922.100270-1-peterx@redhat.com> Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daudé Acked-by: Jason Wang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 749eb6ad63..70ac837733 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2665,7 +2665,7 @@ static uint64_t vtd_mem_read(void *opaque, hwaddr addr, unsigned size) if (addr + size > DMAR_REG_SIZE) { error_report_once("%s: MMIO over range: addr=0x%" PRIx64 - " size=0x%u", __func__, addr, size); + " size=0x%x", __func__, addr, size); return (uint64_t)-1; } @@ -2716,7 +2716,7 @@ static void vtd_mem_write(void *opaque, hwaddr addr, if (addr + size > DMAR_REG_SIZE) { error_report_once("%s: MMIO over range: addr=0x%" PRIx64 - " size=0x%u", __func__, addr, size); + " size=0x%x", __func__, addr, size); return; }