From patchwork Wed Aug 17 20:05:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 83E6BC25B08 for ; Wed, 17 Aug 2022 20:11:14 +0000 (UTC) Received: from localhost ([::1]:34970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPNh-0001KB-JQ for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:11:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIg-0002kf-FU for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPId-0000DZ-4Y for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766758; 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=PribNfOmPzTedqCM8ic9b/oy5lpMAXpt9o3tsirrg3k=; b=ZplnWbpVyIaxuDnTc2a/dxGO65wIwPbtHSZh8EUYEStNze4bst+UOekCyxMvEEU0RL3Wfe nZAE13aV0QrQdhcS/2DxCzk8m0wNygBjkYgvQSx6ymJhmuUQ3bDq+YCgsINDfZC7GxStLp QLVXBr7uJKjpDDL2xkosy3beY2fBdAE= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-656-Fov-mCO2NqWqNhqIMz19eg-1; Wed, 17 Aug 2022 16:05:56 -0400 X-MC-Unique: Fov-mCO2NqWqNhqIMz19eg-1 Received: by mail-wm1-f71.google.com with SMTP id v11-20020a1cf70b000000b003a318238826so604300wmh.2 for ; Wed, 17 Aug 2022 13:05:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=PribNfOmPzTedqCM8ic9b/oy5lpMAXpt9o3tsirrg3k=; b=kIOMGtWcfiLSDP1OKJxuRmmEUcIf4AZp9Ayn9xN46+aYNbAnxwVr9Jczy2aBd4W+YA wGfb3ywBz7AvSGQewatCZT8T3rVLrTtZWnXXIEne1A6iqFdwoN50/VLEw9e5KvSTxZ6t c15g7RiaYF9NjVPcsbYbrBk3VR2PD71FNNyzWckE2qHoW5TvT/CHmvBdWc4lJRNfj+xp +dEyxsRPafMxeJUVll14j+Pqccmj5WuVm3ZVEtzKzrftww9SyySjnYfHa5BTjWr01yq/ XkQkre9vxthrFluZScsvfNB2wQdectR6teg+BXuebfqLL2Pq5A3JL7uIkAEzdiBuHl4D etMg== X-Gm-Message-State: ACgBeo38w3ESR4nFPfuEjKgeFD8SWOP42KL3ADbsTYaU1Er4cLRO1h+q PyzvAx7a4rfP4nhrqW/svVcDfwzS+/1+yg3p+JwW/+2GrIIa5wPl6kOvR6MuU9+UpLi8y2a1DIg AykbsgU6Y7BJNku+Gm33cNWKd7NZXo2dn93E303gUKTUZDfFRF6WWu2vhCUjx X-Received: by 2002:adf:dcd0:0:b0:225:1abb:78cb with SMTP id x16-20020adfdcd0000000b002251abb78cbmr4971971wrm.5.1660766755039; Wed, 17 Aug 2022 13:05:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ajDaIrNfYPAsO4AVHjIrrBtlmVQamackDNdCZF+1rw/rQS8RArjnkT/2J6QE8z8zRen4lJg== X-Received: by 2002:adf:dcd0:0:b0:225:1abb:78cb with SMTP id x16-20020adfdcd0000000b002251abb78cbmr4971950wrm.5.1660766754627; Wed, 17 Aug 2022 13:05:54 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id j26-20020a05600c1c1a00b003a5c999cd1asm3863918wms.14.2022.08.17.13.05.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:05:54 -0700 (PDT) Date: Wed, 17 Aug 2022 16:05:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Stefan Hajnoczi , Qing Wang , Emanuele Giuseppe Esposito , Kevin Wolf , Hanna Reitz , Paolo Bonzini , Fam Zheng , qemu-block@nongnu.org Subject: [PULL 01/12] virtio-scsi: fix race in virtio_scsi_dataplane_start() Message-ID: <20220817200536.350795-2-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi As soon as virtio_scsi_data_plane_start() attaches host notifiers the IOThread may start virtqueue processing. There is a race between IOThread virtqueue processing and virtio_scsi_data_plane_start() because it only assigns s->dataplane_started after attaching host notifiers. When a virtqueue handler function in the IOThread calls virtio_scsi_defer_to_dataplane() it may see !s->dataplane_started and attempt to start dataplane even though we're already in the IOThread: #0 0x00007f67b360857c __pthread_kill_implementation (libc.so.6 + 0xa257c) #1 0x00007f67b35bbd56 raise (libc.so.6 + 0x55d56) #2 0x00007f67b358e833 abort (libc.so.6 + 0x28833) #3 0x00007f67b358e75b __assert_fail_base.cold (libc.so.6 + 0x2875b) #4 0x00007f67b35b4cd6 __assert_fail (libc.so.6 + 0x4ecd6) #5 0x000055ca87fd411b memory_region_transaction_commit (qemu-kvm + 0x67511b) #6 0x000055ca87e17811 virtio_pci_ioeventfd_assign (qemu-kvm + 0x4b8811) #7 0x000055ca87e14836 virtio_bus_set_host_notifier (qemu-kvm + 0x4b5836) #8 0x000055ca87f8e14e virtio_scsi_set_host_notifier (qemu-kvm + 0x62f14e) #9 0x000055ca87f8dd62 virtio_scsi_dataplane_start (qemu-kvm + 0x62ed62) #10 0x000055ca87e14610 virtio_bus_start_ioeventfd (qemu-kvm + 0x4b5610) #11 0x000055ca87f8c29a virtio_scsi_handle_ctrl (qemu-kvm + 0x62d29a) #12 0x000055ca87fa5902 virtio_queue_host_notifier_read (qemu-kvm + 0x646902) #13 0x000055ca882c099e aio_dispatch_handler (qemu-kvm + 0x96199e) #14 0x000055ca882c1761 aio_poll (qemu-kvm + 0x962761) #15 0x000055ca880e1052 iothread_run (qemu-kvm + 0x782052) #16 0x000055ca882c562a qemu_thread_start (qemu-kvm + 0x96662a) This patch assigns s->dataplane_started before attaching host notifiers so that virtqueue handler functions that run in the IOThread before virtio_scsi_data_plane_start() returns correctly identify that dataplane does not need to be started. This fix is taken from the virtio-blk dataplane code and it's worth adding a comment in virtio-blk as well to explain why it works. Note that s->dataplane_started does not need the AioContext lock because it is set before attaching host notifiers and cleared after detaching host notifiers. In other words, the IOThread always sees the value true and the main loop thread does not modify it while the IOThread is active. Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2099541 Reported-by: Qing Wang Signed-off-by: Stefan Hajnoczi Message-Id: <20220808162134.240405-1-stefanha@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/block/dataplane/virtio-blk.c | 5 +++++ hw/scsi/virtio-scsi-dataplane.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 49276e46f2..26f965cabc 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -219,6 +219,11 @@ int virtio_blk_data_plane_start(VirtIODevice *vdev) memory_region_transaction_commit(); + /* + * These fields are visible to the IOThread so we rely on implicit barriers + * in aio_context_acquire() on the write side and aio_notify_accept() on + * the read side. + */ s->starting = false; vblk->dataplane_started = true; trace_virtio_blk_data_plane_start(s); diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplane.c index 8bb6e6acfc..20bb91766e 100644 --- a/hw/scsi/virtio-scsi-dataplane.c +++ b/hw/scsi/virtio-scsi-dataplane.c @@ -136,6 +136,14 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) memory_region_transaction_commit(); + /* + * These fields are visible to the IOThread so we rely on implicit barriers + * in aio_context_acquire() on the write side and aio_notify_accept() on + * the read side. + */ + s->dataplane_starting = false; + s->dataplane_started = true; + aio_context_acquire(s->ctx); virtio_queue_aio_attach_host_notifier(vs->ctrl_vq, s->ctx); virtio_queue_aio_attach_host_notifier_no_poll(vs->event_vq, s->ctx); @@ -143,9 +151,6 @@ int virtio_scsi_dataplane_start(VirtIODevice *vdev) for (i = 0; i < vs->conf.num_queues; i++) { virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx); } - - s->dataplane_starting = false; - s->dataplane_started = true; aio_context_release(s->ctx); return 0; From patchwork Wed Aug 17 20:05:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 87438C2BB41 for ; Wed, 17 Aug 2022 20:09:44 +0000 (UTC) Received: from localhost ([::1]:57044 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPMF-0006gA-EY for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:09:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIi-0002tG-Jm for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49850) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIf-0000E6-Vu for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766761; 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=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=bd9lb73+sWzYFP92gYK4P74XVsqYYSAo6h+ZB4SH0rugJsdou++oFmO/dRB9/ZHD8sNkX5 vMfurZm3hBBba0LrZJdxbbJVHjmcay5x5AanwY4znaLgztVSY1QXkcZHqJG9LwHCedrGBs aJiX329LQY5wM8zr9d+IjC1wmbmo7b0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-286-JDqFfRhWPVeeLT6RoARiwQ-1; Wed, 17 Aug 2022 16:05:59 -0400 X-MC-Unique: JDqFfRhWPVeeLT6RoARiwQ-1 Received: by mail-wm1-f69.google.com with SMTP id j22-20020a05600c485600b003a5e4420552so1533567wmo.8 for ; Wed, 17 Aug 2022 13:05:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=ozctaTGrGQ5LQRIWk0B/C1392INCQSMAXN2eILD1/6hGbeTWAGTMBKF8qepaOea02L HqLBv2QrSm5fTOVfsQjPEjtEtJOS0ctJ4PFFg+oUFy28AbkaMr3CaqOr4ETExPd1BsP2 w1+1JFkjFkV0ygtLAUAKWwMQgUxB53SznSEmVq9MHP1HvMOxN+/SviE/eXTKedOtXIk8 +5OIY8Ax8DS4PBX893jLPr9W7+6VWqNtjze/nPrJnOsLokiZJpEU9v3UcThQ6+1VaeIp /yEv8Lsz7I6usWN+b/oesSr6cOdtOvAAbr/+kRZFe6zOxATr7HSi6BN9g0IvHs+HKoe8 u96g== X-Gm-Message-State: ACgBeo0gvgfGFHnCm/FYpBZCo4iE1D1SULwyMGdWX4Hfvnf/La1B6IBy GZHaxOrAXTd11xMERBm7shS1818A4xwrLbuJ6dL/5RXveKGCW4SkHjK+C6FNLW1oYBul7VLt8Tp o27I13dnme1csNL5Wh3Ir1Wa4phTfxX34AHB9B+o6DBecKQM7TQuZ4fPkol9j X-Received: by 2002:adf:ecce:0:b0:225:2c58:246f with SMTP id s14-20020adfecce000000b002252c58246fmr660139wro.460.1660766758201; Wed, 17 Aug 2022 13:05:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR6dGCuTb0RrUT48xfiv48zL+V1X06tcqTxoRQUxC5CMSdJeyBR/zinRb/nT120qUKbZX4+g0A== X-Received: by 2002:adf:ecce:0:b0:225:2c58:246f with SMTP id s14-20020adfecce000000b002252c58246fmr660133wro.460.1660766757923; Wed, 17 Aug 2022 13:05:57 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id u26-20020a05600c00da00b003a4f1385f0asm3061151wmm.24.2022.08.17.13.05.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:05:57 -0700 (PDT) Date: Wed, 17 Aug 2022 16:05:54 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 02/12] hw/virtio: gracefully handle unset vhost_dev vdev Message-ID: <20220817200536.350795-3-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée I've noticed asserts firing because we query the status of vdev after a vhost connection is closed down. Rather than faulting on the NULL indirect just quietly reply false. Signed-off-by: Alex Bennée Message-Id: <20220728135503.1060062-3-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 0827d631c0..f758f177bb 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -306,7 +306,7 @@ static inline void vhost_dev_log_resize(struct vhost_dev *dev, uint64_t size) dev->log_size = size; } -static int vhost_dev_has_iommu(struct vhost_dev *dev) +static bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev = dev->vdev; @@ -316,8 +316,12 @@ static int vhost_dev_has_iommu(struct vhost_dev *dev) * does not have IOMMU, there's no need to enable this feature * which may cause unnecessary IOTLB miss/update transactions. */ - return virtio_bus_device_iommu_enabled(vdev) && - virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + if (vdev) { + return virtio_bus_device_iommu_enabled(vdev) && + virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM); + } else { + return false; + } } static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, From patchwork Wed Aug 17 20:05:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 98F1EC25B08 for ; Wed, 17 Aug 2022 20:09:42 +0000 (UTC) Received: from localhost ([::1]:57046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPMD-0006mT-E3 for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:09:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIk-0002wh-V7 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:60419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIj-0000FC-He for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766765; 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=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=PmmGa4UKa6cXwpfvuOA5MjWz0AzNt9a9JzO0L+1sxmHNpswhQ8fyuSpz0a1RPeCrx/FYWn rhTisiFVqqh5uFoMyFCfjXqgZhARXyCTI5QMj0Bln9nI2ynxV5D6jYiMC8vDWMdUdlPJAV X+o3c70gmcJjQ8cQasnKY7scJ8oW/BY= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-586-adLoEtLSPf2rIJ3Lp-ETaA-1; Wed, 17 Aug 2022 16:06:03 -0400 X-MC-Unique: adLoEtLSPf2rIJ3Lp-ETaA-1 Received: by mail-wm1-f72.google.com with SMTP id f5-20020a1cc905000000b003a60ef7ec71so601491wmb.4 for ; Wed, 17 Aug 2022 13:06:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=g9Mi6+Nl8sbGS3tZYK3i11mGyje6qFBLQdLlyCZTtcqrdXtsAz3zRHk8KJ5VxdKO3U DMFjyL8qk+3clIDvbwJFBvzlOQjsN1Xhdf3b05xDchhgoLUH2RxO3W4BMdpQDUAtU0/E yYSlExMDY6mWJro/MP2LcUkhe1VCho3Urw7V/8JtiLqGFKQJ7aH20biNUyRj7JUwAreZ PcQq0HtM2kSfsZaoW6QlBoTQ2+NFEUgl6iznj0y6NMsqe0cIdfzZ32dvEvMxneAGKiMi 6O4o+8kmkzbDKU7Hfp3TZcZF2qW24zvUJbTsTCWHDaiuWP7vnL3lNrjI4AOHaNdyJlnb 6JpQ== X-Gm-Message-State: ACgBeo3kq5AELIZfYuhn7aGZY1QlnGlL6dGv2WbJVBgvhoW/gzCRdZdi 0eAzPHbcl6kZF840y2+5P+jWml5g/4E0TFE0GK+isuJNhEemguQVe6gLHRdAV1xtqJmktvmii2d Rb1tlm8LRjV0Ou37vxNxFIrILd25o31QzdNiKttaDh5GuoSwl/qr4cvw0wJqg X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr15289068wrb.345.1660766761602; Wed, 17 Aug 2022 13:06:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CGzl8WmmNjsKvtpc3kBTR5Y09SMCahs8R1AGsp6Hidz/WOXrOmCDQ/BAMeTjIUsHYr0UT7g== X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr15289050wrb.345.1660766761329; Wed, 17 Aug 2022 13:06:01 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id n4-20020a05600c3b8400b003a54fffa809sm2829643wms.17.2022.08.17.13.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:00 -0700 (PDT) Date: Wed, 17 Aug 2022 16:05:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 03/12] hw/virtio: handle un-configured shutdown in virtio-pci Message-ID: <20220817200536.350795-4-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée The assert() protecting against leakage is a little aggressive and causes needless crashes if a device is shutdown without having been configured. In this case no descriptors are lost because none have been assigned. Signed-off-by: Alex Bennée Message-Id: <20220728135503.1060062-4-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 45327f0b31..5ce61f9b45 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,9 +996,14 @@ static int virtio_pci_set_guest_notifiers(DeviceState *d, int nvqs, bool assign) nvqs = MIN(nvqs, VIRTIO_QUEUE_MAX); - /* When deassigning, pass a consistent nvqs value - * to avoid leaking notifiers. + /* + * When deassigning, pass a consistent nvqs value to avoid leaking + * notifiers. But first check we've actually been configured, exit + * early if we haven't. */ + if (!assign && !proxy->nvqs_with_notifiers) { + return 0; + } assert(assign || nvqs == proxy->nvqs_with_notifiers); proxy->nvqs_with_notifiers = nvqs; From patchwork Wed Aug 17 20:06:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D41E8C25B08 for ; Wed, 17 Aug 2022 20:12:07 +0000 (UTC) Received: from localhost ([::1]:59720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPOZ-00045U-0E for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:12:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50164) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIo-0002z0-UG for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:36930) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIn-0000FT-KK for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766767; 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=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=NliMa2iMB23DfIEWKngjfUO7wM4IDkp/ZvQMXt5/K32OmXID4NAv4JtwgWoDDZVQQydfxM gRmOkBEKUGW9Fdq9qqChyEL/CWHiKUjhFhRFc33D2BNgZL6FZk3yT2tZPB4pFU6/nuTBNv Tg8i4dMfzNXNroplVhnOA2I9LSobGbo= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-389-8IEXyy0rM5WOAnmWuCWBsw-1; Wed, 17 Aug 2022 16:06:06 -0400 X-MC-Unique: 8IEXyy0rM5WOAnmWuCWBsw-1 Received: by mail-wm1-f69.google.com with SMTP id f5-20020a1cc905000000b003a60ef7ec71so601560wmb.4 for ; Wed, 17 Aug 2022 13:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=XvP5IxLInow/SIsyMVhCXW97rKA1lkgPxmicTXKAplmB/S1N20CsSvW8soM3mc8Qyg czalNQnme2w4I2t3oaLIN9oVDnx+IYT7aolPJhAYPUtshsjG4O66lE6JdRHB83gQnGP2 FPPskVKWeRCJtGY2rvU711UnmPV9HgB1VaNRDN3eQV+wv7/0BX3gjMnxRDcoN9R7TlxR t3B8pxRMpMWiGV+DcTsEtENwZffX83F7yc566Z/h408XnETzZCm+n4mTnb7mqyTpg0Rb LfbusGAlok8qug8phTRvE5DmBcJs/g5CdFLa+XoC46Ad7iGW4f70UZ2xM4cUabN4Cd2H N8Nw== X-Gm-Message-State: ACgBeo2xM88C2da5o8sJuDNGoR2ZaOtEjAdf7UUydK/l9+ELXzwlfPIb vyEgSRwHJxT84vEAOoMVqIZoSToL4MKhqbt0RsL7LaS1p2mrMMmmdPxC1jLVJhLo6iZMuOYZaj3 q8utGH2BIt5vBUJJGVT1Rt1jH9hPDz9uKTZQ0QjREdxzkmhiX0mLdCP0+Rbsj X-Received: by 2002:a05:600c:206:b0:3a5:abe9:8a91 with SMTP id 6-20020a05600c020600b003a5abe98a91mr3066595wmi.155.1660766765156; Wed, 17 Aug 2022 13:06:05 -0700 (PDT) X-Google-Smtp-Source: AA6agR6ZewWLcpM48Wj0uMqKFj1ccKUTe9j/OC+aDlRxbfidwOvLSVwg0kwP6kN1P3JzdigfNPgAlg== X-Received: by 2002:a05:600c:206:b0:3a5:abe9:8a91 with SMTP id 6-20020a05600c020600b003a5abe98a91mr3066583wmi.155.1660766764835; Wed, 17 Aug 2022 13:06:04 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id r15-20020a5d52cf000000b0021f73c66198sm13813537wrv.1.2022.08.17.13.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:04 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Jason Wang Subject: [PULL 04/12] hw/virtio: fix vhost_user_read tracepoint Message-ID: <20220817200536.350795-5-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée As reads happen in the callback we were never seeing them. We only really care about the header so move the tracepoint to when the header is complete. Fixes: 6ca6d8ee9d (hw/virtio: add vhost_user_[read|write] trace points) Signed-off-by: Alex Bennée Acked-by: Jason Wang Message-Id: <20220728135503.1060062-5-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 75b8df21a4..bd24741be8 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -295,6 +295,8 @@ static int vhost_user_read_header(struct vhost_dev *dev, VhostUserMsg *msg) return -EPROTO; } + trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + return 0; } @@ -544,8 +546,6 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, } } - trace_vhost_user_read(msg.hdr.request, msg.hdr.flags); - return 0; } From patchwork Wed Aug 17 20:06:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 02A8DC25B08 for ; Wed, 17 Aug 2022 20:14:00 +0000 (UTC) Received: from localhost ([::1]:53710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPQN-0007WT-3H for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:13:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIt-000311-2X for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47479) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIr-0000Ft-A5 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766772; 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=4g8+3u7lQYsLQR7nRpbfTo7Ux1+U1muOR3lP40MDZH0=; b=MfrJLwsHPCoDJgxQLV8iZE4hpIGGSX2T4Whg12+/mLDi5TlGXhVKeyyt218SHWqXxJDtG1 27MrpAyWCkRu0ESCcMoApMZk1aX2TB66U4Xaz0dCxalB/cvl2tVP/s+LEAQY1R1JblgkNS 5huVt0bfDWiYRZC6Od/KAVvVB8p79eE= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-518-lyOhGUlYP1-jY8XqomZ3kg-1; Wed, 17 Aug 2022 16:06:11 -0400 X-MC-Unique: lyOhGUlYP1-jY8XqomZ3kg-1 Received: by mail-wr1-f69.google.com with SMTP id t12-20020adfba4c000000b0021e7440666bso2705627wrg.22 for ; Wed, 17 Aug 2022 13:06:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=4g8+3u7lQYsLQR7nRpbfTo7Ux1+U1muOR3lP40MDZH0=; b=y1DSt/5liE8BxKCioYhwnMqza/Zp5n+pKs2R7vc86NaLiVMnLXBTAugglwhYLIlohD y2i4y9foNXkGRw7izOpnLA34ydYzDkdNT0ii99ue+NUrIJXU89MFzfPIjZv9TZADW6SH zBaiUJuWZElx7UAnMS++nZwv1WdWSoDrzlkEK91ygwWtMHvT6ZDgQ/2h5Jaa5ja5H1Ff kGU+XtFL+OWUdQYxSFaW3JW/YqSPFnc6zXuZAbV6a530w0lDGytl9KdUPbtr2fmh/NCf Zi1CIkhe3asD/99YzZ6/loR5yi08lsi1aiZOsNlUeB+us5Gsni+QwgxRLyu3xnepwMTR vLCA== X-Gm-Message-State: ACgBeo1V3OaEQD3B++hCWHjZn7qcwadf1dveheLmZ/urPvPVtfs7Yga4 HWzKO6wC9imhDNGm/01Jq/9Ky/71kXZdHtQ6w5BZREZtj0YYKpGQMvriXyf5v95jnxKNTa32Bn3 Z0NZUBohN84WM61/XMK3amJqRei/Pyn0v+YX2hHkkZI7piXQLZuLq9zpQd4Z8 X-Received: by 2002:adf:c007:0:b0:220:76fc:eacc with SMTP id z7-20020adfc007000000b0022076fceaccmr14595614wre.101.1660766770174; Wed, 17 Aug 2022 13:06:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6HyIuriooZ8P343nbADBDK+NHwBltdLZDCvkxbj4fGF68FkjSTgbU4isT5kdB8v3QQfvME1g== X-Received: by 2002:adf:c007:0:b0:220:76fc:eacc with SMTP id z7-20020adfc007000000b0022076fceaccmr14595596wre.101.1660766769730; Wed, 17 Aug 2022 13:06:09 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c191400b003a5c1e916c8sm9919988wmq.1.2022.08.17.13.06.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:09 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gerd Hoffmann , "Jason A . Donenfeld" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Laurent Vivier , Sergio Lopez Subject: [PULL 05/12] x86: disable rng seeding via setup_data Message-ID: <20220817200536.350795-6-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Gerd Hoffmann Causes regressions when doing direct kernel boots with OVMF. At this point in the release cycle the only sensible action is to just disable this for 7.1 and sort it properly in the 7.2 devel cycle. Cc: Jason A. Donenfeld Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Peter Maydell Cc: Philippe Mathieu-Daudé Cc: Laurent Vivier Signed-off-by: Gerd Hoffmann Message-Id: <20220817083940.3174933-1-kraxel@redhat.com> Cc: Jason A. Donenfeld Cc: Marcel Apfelbaum Cc: Paolo Bonzini Cc: Richard Henderson Cc: Eduardo Habkost Cc: Peter Maydell Cc: Philippe Mathieu-Daudé Cc: Laurent Vivier Signed-off-by: Gerd Hoffmann --- hw/i386/microvm.c | 2 +- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index 7fe8cce03e..52cafa003d 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -332,7 +332,7 @@ static void microvm_memory_init(MicrovmMachineState *mms) rom_set_fw(fw_cfg); if (machine->kernel_filename != NULL) { - x86_load_linux(x86ms, fw_cfg, 0, true, false); + x86_load_linux(x86ms, fw_cfg, 0, true, true); } if (mms->option_roms) { diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index a5c65c1c35..20962c34e7 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -439,6 +439,7 @@ static void pc_i440fx_7_1_machine_options(MachineClass *m) m->alias = "pc"; m->is_default = true; pcmc->default_cpu_version = 1; + pcmc->legacy_no_rng_seed = true; } DEFINE_I440FX_MACHINE(v7_1, "pc-i440fx-7.1", NULL, @@ -450,7 +451,6 @@ static void pc_i440fx_7_0_machine_options(MachineClass *m) pc_i440fx_7_1_machine_options(m); m->alias = NULL; m->is_default = false; - pcmc->legacy_no_rng_seed = true; pcmc->enforce_amd_1tb_hole = false; compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len); compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 3a35193ff7..2e5dae9a89 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -376,6 +376,7 @@ static void pc_q35_7_1_machine_options(MachineClass *m) pc_q35_machine_options(m); m->alias = "q35"; pcmc->default_cpu_version = 1; + pcmc->legacy_no_rng_seed = true; } DEFINE_Q35_MACHINE(v7_1, "pc-q35-7.1", NULL, @@ -386,7 +387,6 @@ static void pc_q35_7_0_machine_options(MachineClass *m) PCMachineClass *pcmc = PC_MACHINE_CLASS(m); pc_q35_7_1_machine_options(m); m->alias = NULL; - pcmc->legacy_no_rng_seed = true; pcmc->enforce_amd_1tb_hole = false; compat_props_add(m->compat_props, hw_compat_7_0, hw_compat_7_0_len); compat_props_add(m->compat_props, pc_compat_7_0, pc_compat_7_0_len); From patchwork Wed Aug 17 20:06:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CCB20C25B08 for ; Wed, 17 Aug 2022 20:18:00 +0000 (UTC) Received: from localhost ([::1]:50440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPUF-0003j0-TO for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:17:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIz-00033K-C8 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49857) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPIx-0000HX-R7 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766778; 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=fnm7M7bNyw8gmdF3r4qZkT/IC0P8GJdi7SQtbAXfvhw=; b=JrtpTLhUTcvbw0s2KGM0Lv8QRyRA2KAGXtm8cuh9IfA2EZ6yOQ/+TnyMF4U0JoaLjdaFq8 3GWt4Q64BNFICem+tjhECV1cEjKI121Uu3jh/oJDvFGmsn1iu5m62ezequ50QmyaVDUgor cT44dLqWAcUAmWCjhrQhxHqpUBMgTZA= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-122-PgFpZILTNRmbOHSqWsvf9g-1; Wed, 17 Aug 2022 16:06:14 -0400 X-MC-Unique: PgFpZILTNRmbOHSqWsvf9g-1 Received: by mail-wm1-f72.google.com with SMTP id a17-20020a05600c349100b003a545125f6eso1539934wmq.4 for ; Wed, 17 Aug 2022 13:06:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=fnm7M7bNyw8gmdF3r4qZkT/IC0P8GJdi7SQtbAXfvhw=; b=eiTYlOz4B/+mDTGi1u4Jbtc3brX/NfSUaZk2hTztFlf6fdwfTFujHC7kH+QHiC46dM PTgBS+eZBkOHAu6lJXLVBjaHftB2xlmpJzaiHHFH1LxHL95p2pcNcgWtvQGQqsgzzneK aYMIyIskG9hXxEvPN3bsDeXExgkH2TjgPyldnp5NUSTLLFpXIR2/+15YYvDHgUBL3Cop PBHPSFLT40MTu3sQvSqD5GHhVLWUrgMRGKEpSCyLp1aU6DSzxolvtSnLZmtGopmqNfDP ulBLqTPadzvS0yUhGBvS267W48zV3sD1lchhvdgNeyjm4R3ZDrU9dhZPi5Nlt1ObNvMk +dmQ== X-Gm-Message-State: ACgBeo1xYcbAWdBIUuMoy9SgYNFeLBI2HZPOaH3C+5/8Rea4oXIocyoy EaSlbnVujaouRe9sHzuviK1KgX7bpdC7DcR95asj46XZJw8IY86IOci6qYOmTRjI9pxg0/Lhfu8 0mqnLNlN3G9+cVI1JZBegu2sj+r3Twi+E4MOBDHCItJN9F4tpaj6xv3V6Xpys X-Received: by 2002:a5d:45c1:0:b0:225:2803:e791 with SMTP id b1-20020a5d45c1000000b002252803e791mr2091118wrs.539.1660766773281; Wed, 17 Aug 2022 13:06:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR6v7dEp8v3+tEzCRIMpcJ7tkwEbDhXZVW3+9H24uDarmI4d7ksQQO7aWCM5yK75mZ0lHOlXEg== X-Received: by 2002:a5d:45c1:0:b0:225:2803:e791 with SMTP id b1-20020a5d45c1000000b002252803e791mr2091106wrs.539.1660766772928; Wed, 17 Aug 2022 13:06:12 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id c1-20020a5d4cc1000000b0021e4edba1e5sm13760483wrt.111.2022.08.17.13.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:12 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:10 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 06/12] hw/cxl: Fix memory leak in error paths Message-ID: <20220817200536.350795-7-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jonathan Cameron Use g_autofree to free the CXLFixedWindow structure if an error occurs in configuration before we have added to the list (via g_steal_pointer()) Fix Coverity CID: 1488872 Reported-by: Peter Maydell Signed-off-by: Jonathan Cameron Message-Id: <20220808122051.14822-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-host.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 483d8eb13f..faa68ef038 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -26,7 +26,7 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state, CXLFixedMemoryWindowOptions *object, Error **errp) { - CXLFixedWindow *fw = g_malloc0(sizeof(*fw)); + g_autofree CXLFixedWindow *fw = g_malloc0(sizeof(*fw)); strList *target; int i; @@ -64,7 +64,8 @@ static void cxl_fixed_memory_window_config(CXLState *cxl_state, fw->enc_int_gran = 0; } - cxl_state->fixed_windows = g_list_append(cxl_state->fixed_windows, fw); + cxl_state->fixed_windows = g_list_append(cxl_state->fixed_windows, + g_steal_pointer(&fw)); return; } From patchwork Wed Aug 17 20:06:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5E0F8C25B08 for ; Wed, 17 Aug 2022 20:15:29 +0000 (UTC) Received: from localhost ([::1]:44422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPRo-00010x-E4 for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:15:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJu-0004xW-B6 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:07:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJs-0000V3-Ke for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:07:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766836; 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=nWQVRRhfHKdS6zw8hDv8H7vDo6NdB5TZvkd9lopLAgA=; b=QNF5K9fewWniNuopJnfQITZwfMLy82JFNwH383MMS6MjkjNjTX4tqZshYNk1eTr3blVX5A 7ZPGQeyyIGEhMTdYiOwPHyB6lWnWIygfwxw4WsQy0954hUFJ64gWPOSu8aamJLqaByXIoe 2+mpHaEZ0qZLZN48NMwtsPY6agPANsw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-456-XgS5EuIkOqG2RoxaaBFjlA-1; Wed, 17 Aug 2022 16:06:18 -0400 X-MC-Unique: XgS5EuIkOqG2RoxaaBFjlA-1 Received: by mail-wm1-f70.google.com with SMTP id b4-20020a05600c4e0400b003a5a96f1756so1563004wmq.0 for ; Wed, 17 Aug 2022 13:06:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=nWQVRRhfHKdS6zw8hDv8H7vDo6NdB5TZvkd9lopLAgA=; b=7IVB5s3PAcEWfxXlUM5CHYJbV0G1Rrj4XL6ZzuZ8CIQfa1RsrqZRUBTh78RX+g+8hO uWVc6Co4kLlpF4bQfXwBy2r+grTyxHNTPaHP72BW4HWFWOreA081rUlZsssacnS94tdM KPeV48MGQKwipe+b6MX2IjePE7M+0Kn3brDRr1tY1t4nrvIozr/YGL1zAO8YZoUh0DNW ZDGbSsbstAwwvcjeyVnt8EC14rSSQ/CnASdBe/1BTHEnoPhQgrgeFqEzDYd+H64ENCqV b5KjzpGdBAUIlGtDNcR52JniYW3tWWGgaevP0G/p7ExC2i7qdTGK2Rc5a7vka0Ml6MjJ 2ZCQ== X-Gm-Message-State: ACgBeo0QeQW9ynHiTOdOEHZnLOnOv9X2sgqhe2aP+K5+QhXiNu19dJJa l8CtBxyDBz/Of7+pWq7qkBfP6rrFqh4oazItt06RbKF4Rk7D2f8mcGaUEMpg7yWaNgqM9iZMMxD Rosv8Nw58AZJfbf+Kk7qXdjkwGyRawuOeQjQcNl536jModzS5q7OXbiqtf1g9 X-Received: by 2002:adf:edc6:0:b0:224:f767:31ae with SMTP id v6-20020adfedc6000000b00224f76731aemr11630479wro.433.1660766777354; Wed, 17 Aug 2022 13:06:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR4VnM+aT9P8WjIz6X+gXyHhhk8kf9SEJuku/ndTC/6PdOI+QVFEevF0XfPijKqLvl+e+Yy1gQ== X-Received: by 2002:adf:edc6:0:b0:224:f767:31ae with SMTP id v6-20020adfedc6000000b00224f76731aemr11630462wro.433.1660766777044; Wed, 17 Aug 2022 13:06:17 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id p6-20020a05600c05c600b003a604a29a34sm2713392wmd.35.2022.08.17.13.06.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:16 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 07/12] hw/cxl: Fix wrong query of target ports Message-ID: <20220817200536.350795-8-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jonathan Cameron Two issues were present in this code: 1) Check on which register to look in was inverted. 2) Both branches use the _LO register. Whilst here moved to extract32() rather than hand rolling the field extraction as simpler and hopefully less error prone. Fixes Coverity CID: 1488873 Reported-by: Peter Maydell Signed-off-by: Jonathan Cameron Message-Id: <20220808122051.14822-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-host.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index faa68ef038..1adf61231a 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -104,7 +104,6 @@ static bool cxl_hdm_find_target(uint32_t *cache_mem, hwaddr addr, uint32_t ctrl; uint32_t ig_enc; uint32_t iw_enc; - uint32_t target_reg; uint32_t target_idx; ctrl = cache_mem[R_CXL_HDM_DECODER0_CTRL]; @@ -116,14 +115,13 @@ static bool cxl_hdm_find_target(uint32_t *cache_mem, hwaddr addr, iw_enc = FIELD_EX32(ctrl, CXL_HDM_DECODER0_CTRL, IW); target_idx = (addr / cxl_decode_ig(ig_enc)) % (1 << iw_enc); - if (target_idx > 4) { - target_reg = cache_mem[R_CXL_HDM_DECODER0_TARGET_LIST_LO]; - target_reg >>= target_idx * 8; + if (target_idx < 4) { + *target = extract32(cache_mem[R_CXL_HDM_DECODER0_TARGET_LIST_LO], + target_idx * 8, 8); } else { - target_reg = cache_mem[R_CXL_HDM_DECODER0_TARGET_LIST_LO]; - target_reg >>= (target_idx - 4) * 8; + *target = extract32(cache_mem[R_CXL_HDM_DECODER0_TARGET_LIST_HI], + (target_idx - 4) * 8, 8); } - *target = target_reg & 0xff; return true; } From patchwork Wed Aug 17 20:06:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id B222CC25B08 for ; Wed, 17 Aug 2022 20:11:48 +0000 (UTC) Received: from localhost ([::1]:44724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPOF-00034q-Pg for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:11:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ3-00035y-Up for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ2-0000In-G4 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766783; 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=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=UIESwbus61MLrC2tqVJJNxHXHJeI9RYJxNyqTKXj2s2t+UCsB/5z3yXSqriiOl0WzcjwKO vEhY50YrI8PGRre85OzBTAct+lcy4eronaP98JJqwKMITUrh+g2aG9QpPy1F0/vqDcm7Pw VyVPN/4/wPUpqRsATItGpUXqVMW6ARQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-439-lytPjezzMpmE41zIteNBbw-1; Wed, 17 Aug 2022 16:06:22 -0400 X-MC-Unique: lytPjezzMpmE41zIteNBbw-1 Received: by mail-wm1-f71.google.com with SMTP id 203-20020a1c02d4000000b003a5f5bce876so1547984wmc.2 for ; Wed, 17 Aug 2022 13:06:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=Xeyy3tmR4O1ab0jALlLH25qU2muUBICa563qGx6hlf3fjvzQhTg+miDWm6yt3xUH1n oM8Mpv4cPFrhIQnH9fNgtYfdx1tDD6NlBM76Oe5w5tBCUHhlnbZv6DzzJWX8w2J2APhO Agyj0FQvNK2I+NGuw0JJxqPch0SSCfl34FjICzFaV66c2EHNUFu9MS+QMstuiQ8fp0Zh IPlk4Ypus8l38EDFGBFnWC18e6FxxtkiG2nahARXOG9jQ0aKfxj5ybAHapnfzT1xFV+I mf0Pn4VORty+wrpFpivdfozav0xzCYB6HM58Lq9h6KlTeHi2B3fX/vVqOEWxekMIyRMt RfAA== X-Gm-Message-State: ACgBeo00yDu/dH5H0W0bNw15f29HJ9PITCyPujTNF3+9bchCrexn62uG dzy5Nv4g/hbxv8M6BE32USBJc5tuZiLuRAMJNBZCGnflkEqJ8uO7lkAeUprGsKTMLGVr9Bg99pX Is1OXs7iyIXNpmWGqIH7v1IrlMq6A4SpYkJr+kJkCCxX9tUoRUP929EuPRuv/ X-Received: by 2002:a7b:c5c5:0:b0:3a5:3e42:fa18 with SMTP id n5-20020a7bc5c5000000b003a53e42fa18mr3026228wmk.178.1660766781259; Wed, 17 Aug 2022 13:06:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR7i2BOD6HaZeZ0j18q5sfQqJb2hcNGZ92TRqD7+yX6pePq8Fx2fSSK0Th8x+n3seH81n0RzTA== X-Received: by 2002:a7b:c5c5:0:b0:3a5:3e42:fa18 with SMTP id n5-20020a7bc5c5000000b003a53e42fa18mr3026213wmk.178.1660766780978; Wed, 17 Aug 2022 13:06:20 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id d11-20020adffbcb000000b00224f7c1328dsm463251wrs.67.2022.08.17.13.06.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:20 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Bobo WL , Ben Widawsky Subject: [PULL 08/12] hw/cxl: Add stub write function for RO MemoryRegionOps entries. Message-ID: <20220817200536.350795-9-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jonathan Cameron There is no checking on the availability of a write callback. Hence QEMU crashes if a write does occur to one of these regions. Discovered whilst chasing a Linux kernel bug that incorrectly wrote into one of these regions. Fixes: 6364adacdf ("hw/cxl/device: Implement the CAP array (8.2.8.1-2)") Reported-by: Bobo WL Signed-off-by: Jonathan Cameron Message-Id: <20220817145759.32603-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-device-utils.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/cxl/cxl-device-utils.c b/hw/cxl/cxl-device-utils.c index 687759b301..83ce7a8270 100644 --- a/hw/cxl/cxl-device-utils.c +++ b/hw/cxl/cxl-device-utils.c @@ -141,9 +141,15 @@ static uint64_t mdev_reg_read(void *opaque, hwaddr offset, unsigned size) return retval; } +static void ro_reg_write(void *opaque, hwaddr offset, uint64_t value, + unsigned size) +{ + /* Many register sets are read only */ +} + static const MemoryRegionOps mdev_ops = { .read = mdev_reg_read, - .write = NULL, /* memory device register is read only */ + .write = ro_reg_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 1, @@ -173,7 +179,7 @@ static const MemoryRegionOps mailbox_ops = { static const MemoryRegionOps dev_ops = { .read = dev_reg_read, - .write = NULL, /* status register is read only */ + .write = ro_reg_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 1, @@ -188,7 +194,7 @@ static const MemoryRegionOps dev_ops = { static const MemoryRegionOps caps_ops = { .read = caps_reg_read, - .write = NULL, /* caps registers are read only */ + .write = ro_reg_write, .endianness = DEVICE_LITTLE_ENDIAN, .valid = { .min_access_size = 1, From patchwork Wed Aug 17 20:06:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0E302C2BB41 for ; Wed, 17 Aug 2022 20:12:06 +0000 (UTC) Received: from localhost ([::1]:59714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPOX-0003za-5k for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:12:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ7-0003Et-6r for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32525) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ5-0000Iz-JY for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766786; 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=qDm9ba4xKEi3LKXl4UlNy7JuhkQRFooUwFqHTDiXY2A=; b=VVsQoyW20By6a6bZgUcGv4r8k9OBIK9nu+a2lBhQRIWR6oePndKpWa8358ChJfEdag9Ke/ J3f8vlSjQlT5GJkLEQVIExKCZwh+zW6XHLbXhnrK7Wi4L21r67amT7g7rshEbUn/Kw6zCC ZK85S8Qc8VFU7NgQof1FRMEczn01NYM= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-453-DfVxw6_eML-e6M8s642TJg-1; Wed, 17 Aug 2022 16:06:25 -0400 X-MC-Unique: DfVxw6_eML-e6M8s642TJg-1 Received: by mail-wr1-f71.google.com with SMTP id d11-20020adfc08b000000b002207555c1f6so2647646wrf.7 for ; Wed, 17 Aug 2022 13:06:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=qDm9ba4xKEi3LKXl4UlNy7JuhkQRFooUwFqHTDiXY2A=; b=v5fzbN1irhRVkPwZ980mHj6oID6O8pr7g/CFmeimtN/fX8E+RNL04MtE1ZZh1UB3lc iX4JoLpzMtZZEv6fzmOLeVVZ3Zbb1NP5TDI33Nge9uqrvz9MkbnFwRiah+9mmql2Kt9H f86X+48aFbhtLT6aKz8B772WPSmQYrbSdpB8TN8/jkBxoyNjS81jwbV5JkjotzD59kBK j+RUbDrC1LMVhGihoWkLU+j80zs65AqN+VlNYp5rDqbDJlXB7PZpGRvNUwWFAtC9Q8KK v6pXkil415zV3WZVohZwlCKcgHHz0qaMyHVSjPhOmd6S4uSZiSNIrENGbhn9qbtal10N MfIg== X-Gm-Message-State: ACgBeo1ddeTLO49Ut7QTBzcf36ALnmLfpzF9QDF8l7fve6qhdU1nR3YJ MujuwnTVSr6CpoAT+NIPdZBmTKMrBzpCLz1po1r4Evn/rLLMtDnsPkIxJkvg56+zPZhE4VZZf7C njSfbZUKuMwyvgiX7D9o7/gY9x6WTyBuEPmSRqS1mGtJiOvZEymWHa8yjLg8X X-Received: by 2002:a5d:47cd:0:b0:220:70a2:5383 with SMTP id o13-20020a5d47cd000000b0022070a25383mr15544137wrc.258.1660766784562; Wed, 17 Aug 2022 13:06:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR7EHMkw7lAIJ96C+Gp7FspSVpQVrGyhoVDoZJUuzJtvnv5geYcQp/5BrwdWoX3mZ/ByxM9Tmw== X-Received: by 2002:a5d:47cd:0:b0:220:70a2:5383 with SMTP id o13-20020a5d47cd000000b0022070a25383mr15544119wrc.258.1660766784264; Wed, 17 Aug 2022 13:06:24 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id w10-20020a05600c014a00b003a32297598csm2915396wmm.43.2022.08.17.13.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:23 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 09/12] hw/cxl: Fix Get LSA input payload size which should be 8 bytes. Message-ID: <20220817200536.350795-10-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jonathan Cameron Get LSA needs 4 byte offset and 4 byte length arguments. CXL rev 2.0 Table 178. Fixes: 3ebe676a34 ("hw/cxl/device: Implement get/set Label Storage Area (LSA)") Signed-off-by: Jonathan Cameron Message-Id: <20220817145759.32603-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index bb66c765a5..3cea8b17a8 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -406,7 +406,7 @@ static struct cxl_cmd cxl_cmd_set[256][256] = { cmd_identify_memory_device, 0, 0 }, [CCLS][GET_PARTITION_INFO] = { "CCLS_GET_PARTITION_INFO", cmd_ccls_get_partition_info, 0, 0 }, - [CCLS][GET_LSA] = { "CCLS_GET_LSA", cmd_ccls_get_lsa, 0, 0 }, + [CCLS][GET_LSA] = { "CCLS_GET_LSA", cmd_ccls_get_lsa, 8, 0 }, [CCLS][SET_LSA] = { "CCLS_SET_LSA", cmd_ccls_set_lsa, ~0, IMMEDIATE_CONFIG_CHANGE | IMMEDIATE_DATA_CHANGE }, }; From patchwork Wed Aug 17 20:06:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 16436C32772 for ; Wed, 17 Aug 2022 20:15:30 +0000 (UTC) Received: from localhost ([::1]:44424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPRo-00012s-UE for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:15:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJB-0003Mn-2P for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:33 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:22803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJ9-0000JO-MI for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766790; 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=Dumk1EQg5Ag6vu8AL5g6B95ji6VBlJBMEnXMduaUodE=; b=dABd/0/K6n0Hf6+O3bplNyaJDJqpUMAg+5tB5dLoeBcHjJAE3eVVaVD2V+p6ZRXT+pgtGK FSfKEQ44pPvvedzq600r6v3BK83Y7AjoTqzENFQZT0PZmFX7Dv4kKu7oZ4up4PpEWZU5Id uk7TzJJabv75y/bOXUj1M3egU9uI/uk= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-207-0FbmhPlNPw22ZHkW8l35uQ-1; Wed, 17 Aug 2022 16:06:29 -0400 X-MC-Unique: 0FbmhPlNPw22ZHkW8l35uQ-1 Received: by mail-wm1-f71.google.com with SMTP id f7-20020a1c6a07000000b003a60ede816cso616998wmc.0 for ; Wed, 17 Aug 2022 13:06:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=Dumk1EQg5Ag6vu8AL5g6B95ji6VBlJBMEnXMduaUodE=; b=l+OY8k5EKd3ryEEB8AuU1el1IdGZEbBfq9jm0ryrJKMWDf49WfvzCN2O5FCleO+lYY twveYO+d+LLqJ3NNKxcnHRA4DQi1MQwHa33HtaC+oH4sjAivkM6watkABgUNqCIApz7X zv0swrvSaZ3DDsWpvVadvXgru1qOKM2BV+V89Eq9I9ANdo9sto7498li85jcneQeu0cd vBuRMxsDMMeE0lp0EvsTupqWVQeheQmqTT4+GJFgfzJEzYKbdjXT6ankRKXCDCs3qUk6 siSB8MqDRObIWQaEIGilcfOwWbBR1iVlsLrxWxhNfvohGk2uj61pYGk+tIsYijapZljr v/Gg== X-Gm-Message-State: ACgBeo1j7UdW36P+In3tIs/AwebBsGUHr7AonQp1kordYZIEW+szA99q /Rs2jQ/SU5MVjaSoYU7wnF+1BJgJuzN2y+PQBit0KfMyQZ1fOINlqTyX0iyd9EX2Z71OR+BDU0W U7qntZyP/co30tTJ876qdBEG2i/umYd1IKK4ByCr3iPh1hL/1QD1P4+vTA7D5 X-Received: by 2002:a5d:634f:0:b0:225:2ab4:d539 with SMTP id b15-20020a5d634f000000b002252ab4d539mr910962wrw.149.1660766787679; Wed, 17 Aug 2022 13:06:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR4n55/kBZDJXtsB8wbcMdm+czA81NyKpCJHPIfkXzAcdxUltnZcN735X2uH+vYTlS1AFmxO3w== X-Received: by 2002:a5d:634f:0:b0:225:2ab4:d539 with SMTP id b15-20020a5d634f000000b002252ab4d539mr910948wrw.149.1660766787322; Wed, 17 Aug 2022 13:06:27 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id q1-20020a05600c030100b003a331c6bffdsm2974368wmd.47.2022.08.17.13.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:26 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:24 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 10/12] hw/cxl: Correctly handle variable sized mailbox input payloads. Message-ID: <20220817200536.350795-11-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jonathan Cameron A placeholder of ~0 is used to indicate variable payload size. Whilst the checks for output payload correctly took this into account, those for input payload did not. This results in failure of the Set LSA command. Fixes: 464e14ac43 ("hw/cxl/device: Implement basic mailbox (8.2.8.4)") Signed-off-by: Jonathan Cameron Message-Id: <20220817145759.32603-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/cxl/cxl-mailbox-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 3cea8b17a8..bc1bb18844 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -425,7 +425,7 @@ void cxl_process_mailbox(CXLDeviceState *cxl_dstate) cxl_cmd = &cxl_cmd_set[set][cmd]; h = cxl_cmd->handler; if (h) { - if (len == cxl_cmd->in) { + if (len == cxl_cmd->in || cxl_cmd->in == ~0) { cxl_cmd->payload = cxl_dstate->mbox_reg_state + A_CXL_DEV_CMD_PAYLOAD; ret = (*h)(cxl_cmd, cxl_dstate, &len); From patchwork Wed Aug 17 20:06:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 047E7C25B08 for ; Wed, 17 Aug 2022 20:19:38 +0000 (UTC) Received: from localhost ([::1]:58904 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPVp-00059b-11 for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:19:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33376) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJD-0003Va-B8 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20727) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJB-0000Ji-Sq for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766793; 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=O2jVKSC/T/69XGJQ1pcYIKsl06VPDaFnR237r22fRUw=; b=MC/NnVZ3xSp1m8w/Ngc1O+ittjBBLdjjo356Ldn7bNnmCkNgEGEbJPbmy0Xcf/nf85de6Y n9sAjpbEnUhCKcbk8bDIdSTNYXE+sBXzCGMHYfhMQq5zFh39kwayQ7KGC/sB0VqugH5Eqp W62nqtjqIAOrtOP5RnMn2HBwTF+Yplw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-674-RRnRC6kLOO6nX9rkUxriuw-1; Wed, 17 Aug 2022 16:06:32 -0400 X-MC-Unique: RRnRC6kLOO6nX9rkUxriuw-1 Received: by mail-wr1-f70.google.com with SMTP id r8-20020adfbb08000000b00225239ce4deso682656wrg.1 for ; Wed, 17 Aug 2022 13:06:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=O2jVKSC/T/69XGJQ1pcYIKsl06VPDaFnR237r22fRUw=; b=1JlNCFlZ3P/6W2rUdgldq/BU7L3DYGBrnTdzf0djA3cGhhQ0uIJGB5ackyOjHtVgmL y14CR3GTGdmmdTfb2HzlYXjYscKHFg/1AjPVI0q4Ahmv8FprqhgwxQNU9ZS53bx1kII1 hyRhxTSGGqGwGsopdcnGhCkSKLYEvDSLbI8N0F7QZTw/97WBwQFw7fAjt2gx6iSHaXpE Eui8vDlaNdaFoF9CR+stheZOYF8vLUYMWRnAbe2BXEangcpda6v6XJ9n9NouiIlQkUb8 vN4UKLR8KYt3uAvcPFG/RN3jTlKhLcgIzcAVSbWd915iTgNHuLOWW56AQ8sQH4UVxObj fURg== X-Gm-Message-State: ACgBeo1NaRrKsElbvjOaQcXy4OQu1IEAIbGxt9EVP2ALpbiOpo84FUXq vQQRLHUFr1prvcTV9HkF+FD0Ho+FZ4+TR3k6wvKqZLWTjTKY6tGZb/LuaKs1dF1OKbrtoaPf3ov ZlOD28WPoVZdKSqJfArftAa49+9x2CfxJlEzOM0zAYvsmXD62T/ertPnCwAQT X-Received: by 2002:a1c:7c18:0:b0:3a5:aaae:d203 with SMTP id x24-20020a1c7c18000000b003a5aaaed203mr3176719wmc.2.1660766790986; Wed, 17 Aug 2022 13:06:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5uhAjCdsIYNKI43GuN2bYtumElHNmhvnJNAX6/vbd4LpXUCCDSxh2MF7ksUXygiRcQGguSRA== X-Received: by 2002:a1c:7c18:0:b0:3a5:aaae:d203 with SMTP id x24-20020a1c7c18000000b003a5aaaed203mr3176705wmc.2.1660766790752; Wed, 17 Aug 2022 13:06:30 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id m18-20020adfe0d2000000b0021ea1bcc300sm13648077wri.56.2022.08.17.13.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:30 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:27 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , Ani Sinha Subject: [PULL 11/12] tests: acpi: silence applesmc warning about invalid key Message-ID: <20220817200536.350795-12-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov OSK value is irrelevant for ACPI test case. Supply fake OSK explicitly to prevent QEMU complaining about invalid key when it fallbacks to default_osk. Suggested-by: Daniel P. Berrangé Signed-off-by: Igor Mammedov Message-Id: <20220728133713.1369596-1-imammedo@redhat.com> Reviewed-by: Daniel P. Berrangé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 359916c228..7c5f736b51 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1632,7 +1632,9 @@ static void test_acpi_q35_applesmc(void) .variant = ".applesmc", }; - test_acpi_one("-device isa-applesmc", &data); + /* supply fake 64-byte OSK to silence missing key warning */ + test_acpi_one("-device isa-applesmc,osk=any64characterfakeoskisenough" + "topreventinvalidkeywarningsonstderr", &data); free_test_data(&data); } From patchwork Wed Aug 17 20:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12946428 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A0CABC25B08 for ; Wed, 17 Aug 2022 20:21:25 +0000 (UTC) Received: from localhost ([::1]:45936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOPXY-0006u6-PS for qemu-devel@archiver.kernel.org; Wed, 17 Aug 2022 16:21:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36028) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJG-0003ie-Os for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56530) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOPJF-0000P4-4p for qemu-devel@nongnu.org; Wed, 17 Aug 2022 16:06:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660766796; 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=EeMkAHhf9AoIGqHoeQ4LAkZR3KVWS7ogggvX+tcW7Dw=; b=fyzX6dsea7LRjQBQxwyTjOYHSfMxbENwdrlYZLMdgfOciSiqa/LyjbiQPh7q54PyfwUvV6 cnQmeKjM9KXOuQFe1iTLnDGJ+cLYjEiVMi2kZkdmxcMtjMlAA0ADiple8bgwr382Qoun2D 69rtQG2rHPtsn+nyJikjtnoloq7dTys= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-264-sXGJoxADNNyWYCcpXMU9Kg-1; Wed, 17 Aug 2022 16:06:35 -0400 X-MC-Unique: sXGJoxADNNyWYCcpXMU9Kg-1 Received: by mail-wm1-f70.google.com with SMTP id v67-20020a1cac46000000b003a615c4893dso1182194wme.3 for ; Wed, 17 Aug 2022 13:06:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=EeMkAHhf9AoIGqHoeQ4LAkZR3KVWS7ogggvX+tcW7Dw=; b=nXKugYCB3On2uOMr3f2EeK3FkI7E3k4gZ+okeIX/jYfsyAxCKdZLCOdON1Ktp3suOx q8zuuny3dwQluBlm515xndVs/ZY8RjWASkbAltcScJZDubzevvfVn7bwH/K7pI7DPd2f 9/1VrAe1kzCngJBWpQ5E6HTna3KwsGvm00o3XHxai4uZawMo7tZ28VJVA9QTzF+bDCIL penK6tLLY3lXyzmnIDZzoEv/jiFp6EVrxVCrLjAX1v0BcR5KUuhJbgePLY0wC58fTGEK o0W61OZr5q83svZrNF6CSoTZGFZxEXU++MnYzufGPAKGxT3hfGPzieYJNMTo9zdzu4Ht KUsg== X-Gm-Message-State: ACgBeo3GbEv6hCS9UpqHCbeJuiFDsaeBZqcb6NJB457u9z+xOonRdZz5 Fw9aorTjiWvW9lza3aO4kNJBCEUit0BGEWkeukJLUfMXmR9hpU9eCuxKE0y9NIwVOuGAzTLZf1D mJcRUxxkvxDku6xurbwKwIh1tWRdT29fmOGbaknKkQ0iTtB5ivrbqa6WddTuq X-Received: by 2002:a05:600c:1c19:b0:3a5:51aa:d041 with SMTP id j25-20020a05600c1c1900b003a551aad041mr3087155wms.172.1660766793902; Wed, 17 Aug 2022 13:06:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR4NzTdNL3niBApWmTBPJWj/s42MnvhhoGX/r1VdDDY6Tzudh9p2adzJ9Pw3RTNgZbmSJWKirQ== X-Received: by 2002:a05:600c:1c19:b0:3a5:51aa:d041 with SMTP id j25-20020a05600c1c1900b003a551aad041mr3087143wms.172.1660766793621; Wed, 17 Aug 2022 13:06:33 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id e26-20020a05600c219a00b003a5de95b105sm3049855wme.41.2022.08.17.13.06.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 13:06:33 -0700 (PDT) Date: Wed, 17 Aug 2022 16:06:30 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 12/12] virtio-pci: don't touch pci on virtio reset Message-ID: <20220817200536.350795-13-mst@redhat.com> References: <20220817200536.350795-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817200536.350795-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" virtio level reset should not affect pci express registers such as PM, error or link. Fixes: 27ce0f3afc ("hw/virtio: fix Power Management Control Register for PCI Express virtio devices") Fixes: d584f1b9ca ("hw/virtio: fix Link Control Register for PCI Express virtio devices") Fixes: c2cabb3422 ("hw/virtio: fix error enabling flags in Device Control register") Cc: "Marcel Apfelbaum" Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 5ce61f9b45..a50c5a57d7 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1947,7 +1947,6 @@ static void virtio_pci_reset(DeviceState *qdev) { VirtIOPCIProxy *proxy = VIRTIO_PCI(qdev); VirtioBusState *bus = VIRTIO_BUS(&proxy->bus); - PCIDevice *dev = PCI_DEVICE(qdev); int i; virtio_bus_reset(bus); @@ -1960,6 +1959,13 @@ static void virtio_pci_reset(DeviceState *qdev) proxy->vqs[i].avail[0] = proxy->vqs[i].avail[1] = 0; proxy->vqs[i].used[0] = proxy->vqs[i].used[1] = 0; } +} + +static void virtio_pci_bus_reset(DeviceState *qdev) +{ + PCIDevice *dev = PCI_DEVICE(qdev); + + virtio_pci_reset(qdev); if (pci_is_express(dev)) { pcie_cap_deverr_reset(dev); @@ -2027,7 +2033,7 @@ static void virtio_pci_class_init(ObjectClass *klass, void *data) k->class_id = PCI_CLASS_OTHERS; device_class_set_parent_realize(dc, virtio_pci_dc_realize, &vpciklass->parent_dc_realize); - dc->reset = virtio_pci_reset; + dc->reset = virtio_pci_bus_reset; } static const TypeInfo virtio_pci_info = {