From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754022; cv=none; d=zohomail.com; s=zohoarc; b=GDKa8HQJP6xu211gIjq62xbpkwCRuGM+JyLnuj8cxSXhLIU4+6045929sFSwZiLpXGuH5iH0gckDHaiZt0hfcd72Ri9kdLqlS/Uo19IS/2E8vRNw1Txtf6O0EVCTpbiafmf0OYwI/ohEBP69Aq8MM6OQYXcAnBTXvsPWWd9d2W4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754022; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=PribNfOmPzTedqCM8ic9b/oy5lpMAXpt9o3tsirrg3k=; b=arLs2+SoXseQ6SX3ddLuvr5RBSEbLn8JIC2fE3N9TxunumzY2lPok00sQzo/NWKOlKT7q97v5DX9iqNV1hKF1LVbq87uHlm5iZ+yLQX7of1XI9iaZNWGHkOTg4pGe02egu9unAmMyHLj07Zt8HdAgjIUYegjqompScmxF8X9BMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754022134996.8171164485293; Wed, 17 Aug 2022 09:33:42 -0700 (PDT) Received: from localhost ([::1]:53654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLzA-0005Jn-R0 for importer@patchew.org; Wed, 17 Aug 2022 12:33:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgp-0007dS-5r for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52677) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgl-0001Of-OG for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:41 -0400 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-204-qRFuEBRGNCOv12_U4t_QaA-1; Wed, 17 Aug 2022 12:14:37 -0400 Received: by mail-wr1-f71.google.com with SMTP id g11-20020adfa48b000000b002250d091f76so1900157wrb.3 for ; Wed, 17 Aug 2022 09:14:37 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id c5-20020adffb05000000b0021e4f595590sm13354180wrr.28.2022.08.17.09.14.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752879; 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=IKq+Bd9sHsJIVXKHVyT13Vv6CdSXeYf2hEr5SwwadVm14g83uIRKgMrnjEhbYlJoag/xGS EN+ahj7ijAG7I+m5edPy3VxKmGsf091ti6Dzd5EYBk7HTyRhyfFU5dBA0kDBFcJWj2cqqV gAB59GxKR/3PI1cmx/1iyPqp9N8gOjA= X-MC-Unique: qRFuEBRGNCOv12_U4t_QaA-1 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=MN19nDcaEnIskWPp+5HtLNs1dSllx1XlY4nw3CnGVOcL+qVSppr+Vdr+Olp8mDKbYd eIiGCQNxdiBNbUHOdMLD6ml9z28HUzmqSTJeXI/JzCrJImrQEbWrHoxAw4QTyWfAPf1n ZLfkxPOADIz2xJVYQOPbU7C7n3RQVh1cOiuwN9V+epfz03b5bMqGc2EtKllA2XHyv0yE BwLhVXUOexb9LPxI8MMh2lXykeMwQK10p3ZHdGm6v6/FxyrfnECwITF1GsBM0vM4KeI1 k53u3Wg8rIEt3b+VUZFcReQQZ2vo0kj9Rnx51KXWnG4dQdwsfd7dZYnbmG4SwjSOeTrV uRdQ== X-Gm-Message-State: ACgBeo1hGffRtxrNI4ZMn5YAqKt/NDvc6xvLYPkhy9gbq7pFxVVpp1n9 jZLXWP9VD+CwflU/7fyZjKNiMrYBz2nso9BBxCrfP8kalQp2m1COWjMjCMWBRfoaO64J4O0QoBn lY9Xr90NqIUHt5UCrTo3wCJDzefpN03Q75EXbX2rfxSrB9i1i0B+rv7/SxY78 X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr14881255wrb.345.1660752876161; Wed, 17 Aug 2022 09:14:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR5YeLhWwuglMdG4X4k8vdAkq0CflO2XxzwgWm+gJfF8PvR7cSSkak/+PTxarIQPa7z2Zwhv5g== X-Received: by 2002:a5d:5a96:0:b0:223:8131:e4f2 with SMTP id bp22-20020a5d5a96000000b002238131e4f2mr14881228wrb.345.1660752875727; Wed, 17 Aug 2022 09:14:35 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:31 -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/10] virtio-scsi: fix race in virtio_scsi_dataplane_start() Message-ID: <20220817161342.240674-2-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754023864100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 + 0x675= 11b) #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 + 0x6469= 02) #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=3D2099541 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-bl= k.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) =20 memory_region_transaction_commit(); =20 + /* + * These fields are visible to the IOThread so we rely on implicit bar= riers + * in aio_context_acquire() on the write side and aio_notify_accept() = on + * the read side. + */ s->starting =3D false; vblk->dataplane_started =3D true; trace_virtio_blk_data_plane_start(s); diff --git a/hw/scsi/virtio-scsi-dataplane.c b/hw/scsi/virtio-scsi-dataplan= e.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) =20 memory_region_transaction_commit(); =20 + /* + * These fields are visible to the IOThread so we rely on implicit bar= riers + * in aio_context_acquire() on the write side and aio_notify_accept() = on + * the read side. + */ + s->dataplane_starting =3D false; + s->dataplane_started =3D 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 =3D 0; i < vs->conf.num_queues; i++) { virtio_queue_aio_attach_host_notifier(vs->cmd_vqs[i], s->ctx); } - - s->dataplane_starting =3D false; - s->dataplane_started =3D true; aio_context_release(s->ctx); return 0; =20 --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754400; cv=none; d=zohomail.com; s=zohoarc; b=E7nqIfR5pZjzRVJ6RYbsnmrP9lvQvXjot7KRe7cjJviw8AhLYp8SrQ4OCL4EJm66IsHnqGl46PwjyF/D3W5QvnPBblFivaKzQCnAC5nDlIsJzpm3SBWPt1itlcPGe6cJozTqHwelK7PLpdijNoR2TKeFNmlM1xBbp/145FuiB34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754400; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DV2CGvKwhVU6MHqdfffqDvMvVM56xezMHq/D8UxHfEk=; b=i+p1wmJ5Mq1T4qvpLMT5shSEmnFcS/Sm0UbSC29ILFZqD3+IEgmM4CMRYUk30DFeqDy7eW5wD8Y0iLZw0lKWqmOSnv35qIuSALyRpxih4QIXMb3//dWREOz2tdb8FeoQcloYdwf3JSyxwZ+nFR8pN2ObU+M5jalhDaLk1Dbvtpc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754400102830.6441573381786; Wed, 17 Aug 2022 09:40:00 -0700 (PDT) Received: from localhost ([::1]:53746 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOM5H-0004oH-1v for importer@patchew.org; Wed, 17 Aug 2022 12:39:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgt-0007sB-Pl for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgr-0001QO-D3 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:47 -0400 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-446-B27zF3UkNxeGpoxaOGaKLg-1; Wed, 17 Aug 2022 12:14:41 -0400 Received: by mail-wm1-f72.google.com with SMTP id r67-20020a1c4446000000b003a5fa79008bso1268540wma.5 for ; Wed, 17 Aug 2022 09:14:40 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id bt22-20020a056000081600b002251e86241csm4079931wrb.48.2022.08.17.09.14.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752884; 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=WwzOgjNhrosGvTZz5DdpAYvxvWa11FYTMMjdM2T4E0ewn7fou8ELwLVmwFgvhtBhSFzZ9j CURb+XRqTVeeCElg2MILvu3HfLq7auku849WipHm+lIx3EPH91V4MUegVyuaISWyJu7Rhx cFTBzhyNHR0r3g36ppbWKNgm9yrZVIU= X-MC-Unique: B27zF3UkNxeGpoxaOGaKLg-1 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=IXtQd27a8fErJuf1EJNHZj33FOWek34l3/4yFg+T+gIXxt6asI8apLCk7hVqc3R3HH 4J2HPvqFkswy4jG4qBwS6FZuoiwJNA/L9/6skL5ondmswzsq0EkO5Q+u57bWLS0ftIPN 29hgH75kaNzcWjb6PkGnyhKh4cRl4Ic65RRf7w6etvh3yd1ufhrvw5sQ0E94OyGoK8Fe 17uIHjWdBVQA7OCMtOlbU3sYBiRhj4l3suoz0GPIb4bjyJpr+TNb8/lltRF9YvioZK5m GuJnt8k31Hso0EoHP/lLGbDxfPfejdpeQu3++9MG6T9V5AenPYygm/V/8IbWG0zmnIH7 Djow== X-Gm-Message-State: ACgBeo2iGfmjrIPzckZXmzMLtmN3Z3F1aijKX24iKOduGdhBWkbEvMAT egCdIqX/Mx3Xul+AU5vbRjR8VFv+dKVEeY9V72Ih5WpTtOCOMnVTglIrk2f4JoOjj0J5DSQ8JH7 jhhmZgEF5TLFO9Cn67KA+JNuoQwq4yYtNW2tdA3diznVNJlqAp/MgBnWQs7Ky X-Received: by 2002:a05:600c:5022:b0:3a6:ad4:1c6 with SMTP id n34-20020a05600c502200b003a60ad401c6mr2617282wmr.177.1660752879692; Wed, 17 Aug 2022 09:14:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR77rB/xpdrJ8XduCTKKzxFBltKSaoRyt5HEEidQLtubQHzqYtnsIkFgqMPV4w8MaMtLtSuPPg== X-Received: by 2002:a05:600c:5022:b0:3a6:ad4:1c6 with SMTP id n34-20020a05600c502200b003a60ad401c6mr2617270wmr.177.1660752879332; Wed, 17 Aug 2022 09:14:39 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:36 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?Q?Benn=C3=A9e?= Subject: [PULL 02/10] hw/virtio: gracefully handle unset vhost_dev vdev Message-ID: <20220817161342.240674-3-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754400552100001 From: Alex Benn=C3=A9e 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=C3=A9e 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_de= v *dev, uint64_t size) dev->log_size =3D size; } =20 -static int vhost_dev_has_iommu(struct vhost_dev *dev) +static bool vhost_dev_has_iommu(struct vhost_dev *dev) { VirtIODevice *vdev =3D dev->vdev; =20 @@ -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; + } } =20 static void *vhost_memory_map(struct vhost_dev *dev, hwaddr addr, --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660753137; cv=none; d=zohomail.com; s=zohoarc; b=iqkQCRmncwO6e3XXzFOHqJDW6rW1/c/mw+vxGLvyWM66b1L8x612ZReJbnYCbM2LDqQkKvOGrDS0bwtL1MG+j4VPdzAjwtcF+8B/mFRmt7pkCeTPFQ8N3IPRza/LAH0wyUIA9U3OJ1GWp6VWwKRM7QwO6R5LhB1V7NytWFw7qbA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660753137; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ciBt2hYDKhvoSd8DxUzT64ugCS+WT394gSsu02mKQvA=; b=We8jffB4EXGPOvfonyRM+CiRh500WnkEfkk1Xd7dV5JmvDxsIcez8aK3Phddn3hkgLHOX8xRNPzXGKls0sl5k4xF8eh1vORSZs7k2qbazUhivotqL4vJ6ayRKqKbGpDsFjv+6e5HCaNjKvlNbnHLiNxrA1NJN46BEHad5F4HI4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660753137059433.8374037751363; Wed, 17 Aug 2022 09:18:57 -0700 (PDT) Received: from localhost ([::1]:51270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLkt-0002jT-Qg for importer@patchew.org; Wed, 17 Aug 2022 12:18:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgs-0007p9-Rt for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45221) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgr-0001QM-Cz for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:46 -0400 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-548-yWomPahsPSq-epQI6Oy1Bw-1; Wed, 17 Aug 2022 12:14:43 -0400 Received: by mail-wr1-f72.google.com with SMTP id m7-20020adfa3c7000000b002251ddd0e05so1023417wrb.10 for ; Wed, 17 Aug 2022 09:14:43 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id f16-20020adfb610000000b002237fd66585sm13148998wre.92.2022.08.17.09.14.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752884; 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=JkGI0SIzf/7z5qMaVRKEM6fWysxmW44+ZQQJ7SeVHnGqMyqzkWzdbvxKvCYXPIxkLleT6o 0aNDU4hPRXHxJN+wCElqT2lb7DKc3+R+4lzg1FrDeUGT+Yl9egl1sGtRq/VpUy8u/28/4u ZbvrwWVwQs/V8Hlp17K8JzpO/qI8Nsg= X-MC-Unique: yWomPahsPSq-epQI6Oy1Bw-1 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=dZi+v9a3jzY8WRxjA8H6Z1qYAbIghTm3IBjLVX0pyRVvdR/jUCUzPLQbV70Cqe5Kpl rIbQGM1dJhqhREb33zjqM2CjD7Rq3N7k0AyFuGj16p0+7Ts1jZ7PDU53A3uZX8s69V+X PE1Iu3U1ovDgk+RdRZLyxJVC0Hh0hdgye6G8zTuC0kyRK+NGdQPbeDJlNGB5lISaKxxv L5siGU/A/ia95W7y+i3nZou3yeTNruLf16mFt7ChJAGFbjznHizW1oSIlvZ0HrINYIMg Ngzz1DQTUvBnCsW1OTd17cW06YyDpz8mEl0FJiqh8BsC7Ob3GJhwv4TqsA20V0M+Zr9V W93A== X-Gm-Message-State: ACgBeo3L41Feg8WsUsy2mwIoVvmfWI9Ybzy6bxe4SWRLMXMIWv6p6VVe 0xYahgfdAMiSSO553xGtQJcrOzCB0l3bXjC/pTdmUz/S/RGWuO1fa7qoGJ/Zy2LNCGUSFyewwUF IUS5iFidc15lqSDPwJ7K8D2mDyg2BiWWyEyGuF4g8A9zv7a2lg27H+Anqqdsh X-Received: by 2002:adf:fc88:0:b0:220:61dc:d297 with SMTP id g8-20020adffc88000000b0022061dcd297mr14235067wrr.660.1660752882239; Wed, 17 Aug 2022 09:14:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR6I970uUIeB6Cn59nmyl+31nqJzE7HbTxOcOOvg+1AeaEKx7YiFeAkbP3xKVrLdWMP1RDsF1w== X-Received: by 2002:adf:fc88:0:b0:220:61dc:d297 with SMTP id g8-20020adffc88000000b0022061dcd297mr14235047wrr.660.1660752881921; Wed, 17 Aug 2022 09:14:41 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Alex =?utf-8?Q?Benn=C3=A9e?= Subject: [PULL 03/10] hw/virtio: handle un-configured shutdown in virtio-pci Message-ID: <20220817161342.240674-4-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660753139085100001 From: Alex Benn=C3=A9e 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=C3=A9e 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) =20 nvqs =3D MIN(nvqs, VIRTIO_QUEUE_MAX); =20 - /* 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 =3D=3D proxy->nvqs_with_notifiers); =20 proxy->nvqs_with_notifiers =3D nvqs; --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660753362; cv=none; d=zohomail.com; s=zohoarc; b=O9ycpWX1OPl5GjEfCtK2I19BxLFjMuiNSDR6T7yN5z8ftCKEtC1FQ2pKy5xf6Fvs3b2MEzmhqDgxZthDril1ltch/XSEqrsyEpUC493VDCNKLPfIJb8Ak2W6aNssmhzcCMbKl2vCyO0ZrxtH3+JVtB+84E64AchRM/Vhdip5yck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660753362; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rlFScFbd6bA9xQKNfgYlcaL7eylrZChQGwf+YKV00bU=; b=lUlvUUdlxN3/LZd8dH1YUC4QrDD0DXwmfb++/NklNjRM4oMfdzCnTareAxS1IFs3VUer2+kJtvjwMgS5NW2TeBsc4/HEo1nDwzgflm+WCO0w45v6OLs9onsciGY/dcjDStPrjM3CsRQOR0xJ2RwMqM9IAUSd2QpMqiymcIi4eg8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660753362002323.5422640733981; Wed, 17 Aug 2022 09:22:42 -0700 (PDT) Received: from localhost ([::1]:50430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLoW-0000Fx-Vd for importer@patchew.org; Wed, 17 Aug 2022 12:22:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgw-0007zI-GV for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLgu-0001Qy-L9 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:14:49 -0400 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-627-BVGuruKvNHuOyivTz1szHg-1; Wed, 17 Aug 2022 12:14:46 -0400 Received: by mail-wm1-f70.google.com with SMTP id b16-20020a05600c4e1000b003a5a47762c3so6475757wmq.9 for ; Wed, 17 Aug 2022 09:14:46 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id o12-20020a05600c4fcc00b003a5f2cc2f1dsm2537184wmq.42.2022.08.17.09.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752887; 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=jAkyFJBUXzEpN26MBWwJh6LSiAdsYZ7GQCoEVIylLUNw8zignhWj/Jui869vX5G7qjlxPu VXX02SjxIRkHwno7F8rBNvM1G/E2q4Ump9cCL2ZohncMSJuRywCwtmoAXerMkmxl3/yZwD zbOVdPueRHmZPqMXrAiIA20M4PDdB6Q= X-MC-Unique: BVGuruKvNHuOyivTz1szHg-1 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=QLHtx5diusUFyHR3ZtYyYpNEKBOoZUEIE0Oa/EzIfS8DC+DU4waRTaEUWBiNhYhM22 uEerYg4Ck55YDXsbEjT7fDCMtglQnT5F2Wf8X9Z3FX6wdCoOgilrQha6KrCyrnTDOIqB rzjcFWGqDSZPYuXhm7OJuM08QyMaYm82n6vxlIq+XX11CVlEZiINXVcYsAhL3XUCdr6s 0aiflBxuJGnU8JoOKF8YJdiYnSU31vrA95gyApYn2odAMtEWxvissMsojIxAXNe0QEtN IDOqWJO1W6DeUFAX8zcKq5Igv/igwOhNV9dDQUYAI2nLfUGJXbApt8XqOm5YYd829mJ5 F45g== X-Gm-Message-State: ACgBeo3RouYDJ9c4WUJFd7onrYjcYGQyruz9tmnQgJ2LqH40yaSaJECE JvGPPf0dHG3AOU31dtAqlyPTo8ruzlnYkBtaMQio1ug/9L3DWinEYAe3eXhh6bgGYTS33kdPYFl 4Ujd/WiWR+P/NlQbjj83c44hH4WvGx2PPbNzIA4+e2q0IvzJj9IZfSprbyog1 X-Received: by 2002:a05:6000:1092:b0:21f:13e7:3cc with SMTP id y18-20020a056000109200b0021f13e703ccmr15590631wrw.671.1660752885412; Wed, 17 Aug 2022 09:14:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR7LutJxEFlt5KN5ty4uYMHCBmtji3k36LxzSrSHZJQZ3xxmrNMGKqSCI1GsWup/atgLolt39A== X-Received: by 2002:a05:6000:1092:b0:21f:13e7:3cc with SMTP id y18-20020a056000109200b0021f13e703ccmr15590613wrw.671.1660752885168; Wed, 17 Aug 2022 09:14:45 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:42 -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/10] hw/virtio: fix vhost_user_read tracepoint Message-ID: <20220817161342.240674-5-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660753362750100001 From: Alex Benn=C3=A9e 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=C3=A9e 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; } =20 + trace_vhost_user_read(msg->hdr.request, msg->hdr.flags); + return 0; } =20 @@ -544,8 +546,6 @@ static int vhost_user_set_log_base(struct vhost_dev *de= v, uint64_t base, } } =20 - trace_vhost_user_read(msg.hdr.request, msg.hdr.flags); - return 0; } =20 --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754042; cv=none; d=zohomail.com; s=zohoarc; b=ibnK2DlLT/g1u3dYnfVK+t+mdi1J0PGG93uM3K8y7FEDNH/iez9Xzul9DOgmBDpWNTRiCSxzZcVUOnYf3EFLgqocPPKg/q3p+aYyBWrU734+N0dt+Ov5NNp6yrnKTqL/CBDzmAPxk805pghJZ/fDvYEfv7D9afJw3hDg8z6k3LE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754042; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4g8+3u7lQYsLQR7nRpbfTo7Ux1+U1muOR3lP40MDZH0=; b=gY6qzkvC1XN2zKLGrRwD/VyTHnsnuTQc/GH1hnFTGbA3DQ4sLsWJ6PHr9JqqSji7vh8t2n43EakEJnfiDY5YafwMjdbDgaOF/MMSs+BsCMSg6Ooy0nn5SeeIhcNfjCvPmowibAFSipvKppF6Qpvl+SlnE6xAlL8JqtFjHiwENn4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754042843641.027139696803; Wed, 17 Aug 2022 09:34:02 -0700 (PDT) Received: from localhost ([::1]:36738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLzV-0005xl-Ra for importer@patchew.org; Wed, 17 Aug 2022 12:34:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42154) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLmx-0006Me-04 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLmt-0005T6-Gn for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:01 -0400 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-235-GvMo0QXSOJ-6emTAnaU9uw-1; Wed, 17 Aug 2022 12:14:51 -0400 Received: by mail-wm1-f70.google.com with SMTP id v64-20020a1cac43000000b003a4bea31b4dso1275464wme.3 for ; Wed, 17 Aug 2022 09:14:51 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id j33-20020a05600c48a100b003a5bd5ea215sm2410335wmp.37.2022.08.17.09.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660753258; 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=F6Zfmkha4Aehsu2aJFfFDjPtRuTHU32AgZKxT6I886O/xv8iUjJSkJBVYGb+NybJXNTY91 LgCajJzPjdSHoMJtC55RgTAZ1ajNyzEOftiCW29SZdcT6/ju2gUtD4Sb7yoryh2HrT+oTC nuVNEggcsd7BrK+81TfaedAfxBGHh0E= X-MC-Unique: GvMo0QXSOJ-6emTAnaU9uw-1 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=duhSp6eLzPG4XVyFIaqTbXW7CL3Ko8QjGD8tW7tzuungmzrPHVuoz36xim9iqqquHp QZ19nrSL32txf4iDqhsB97U/5nE9lXPXmg26rtSbjCNGa2qsU+lyISQKzE1B2xDZsfq7 5Rnap9cYWVmbP44ZkBy6h9Q62+BkADd4bHfpEOCVgPRd1539Jqr5XXFfbbFIX0GfvamB jeDjO6w6xXNYRHQARAaX4qmV2ByAKeaic6LCKMsptoWdJ9N4vDuwaF2rz+nzz0EOeQ97 1we1b4Ty2xEJQAOryrq/qLpCOv+ozDmw++NZzshMXn12ZybuN/t5Z4p32IoLlhWN4BsJ TsUw== X-Gm-Message-State: ACgBeo2hD+UCtCdAb38fWT/QCaO7STRdBkcTqWfdPdJaxGUCLn4VchQ3 gAGutgo+FGrXAuohPOJXV+eYJtGVt7bqBDUlWPuEIZXS2odqrReDT1DlKUsYXBriO42PHVQROSU //V2JoUM/XwhacUtNtk6fld4uCCHYtKJFwKvSAEbv8rXbLuA6GHsZKs9/lj/C X-Received: by 2002:a05:6000:60e:b0:225:1d44:51c9 with SMTP id bn14-20020a056000060e00b002251d4451c9mr4379460wrb.0.1660752889886; Wed, 17 Aug 2022 09:14:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR6emVFN39zuy+dDn+GORmLFQEKBuNOvxdd98hE1lx8C2Rs2m2CIJCyEDwIltJWoBz62BE7WOw== X-Received: by 2002:a05:6000:60e:b0:225:1d44:51c9 with SMTP id bn14-20020a056000060e00b002251d4451c9mr4379444wrb.0.1660752889631; Wed, 17 Aug 2022 09:14:49 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:45 -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=C3=A9?= , Laurent Vivier , Sergio Lopez Subject: [PULL 05/10] x86: disable rng seeding via setup_data Message-ID: <20220817161342.240674-6-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754044071100003 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=C3=A9 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=C3=A9 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 *mm= s) rom_set_fw(fw_cfg); =20 if (machine->kernel_filename !=3D NULL) { - x86_load_linux(x86ms, fw_cfg, 0, true, false); + x86_load_linux(x86ms, fw_cfg, 0, true, true); } =20 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 =3D "pc"; m->is_default =3D true; pcmc->default_cpu_version =3D 1; + pcmc->legacy_no_rng_seed =3D true; } =20 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 =3D NULL; m->is_default =3D false; - pcmc->legacy_no_rng_seed =3D true; pcmc->enforce_amd_1tb_hole =3D 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 =3D "q35"; pcmc->default_cpu_version =3D 1; + pcmc->legacy_no_rng_seed =3D true; } =20 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 =3D PC_MACHINE_CLASS(m); pc_q35_7_1_machine_options(m); m->alias =3D NULL; - pcmc->legacy_no_rng_seed =3D true; pcmc->enforce_amd_1tb_hole =3D 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); --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754364; cv=none; d=zohomail.com; s=zohoarc; b=AMyLBRauVhwoZ1+AFIEnnpVy6XReqtlEghz7t7A1RsCSZCGBd18dcl48b6evMUQcC5yuxxXEgYK8QFE1HJPRhSs2VWxm4mLLyYGaG2fYu7uea/qbGNi4h6ZguHOL2K7NfKpCbphDcW/jRP+3buZVDupSuou1K0pGTWvcdGgkpJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754364; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=k2ZpeeYKQErXhazsoSi6NbKbSpJUbceXzvANU3WD8iY=; b=c5tHp2ZUr/KDl9NUk6TAH8hFFFZHiRRqqQ/kdFH+QCgTbybJaAWFBWN767i9gnVGDDwzidhA42v3Eh/XG9Mhexo5g4AaAdcyZLsa+6kWhjmxInFm/feAljj9Wia0hiSZ+1LR7E297IESCy1XDWlgqRpD7x8NNI7fKAmXr+07QWY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754364297498.7300522409239; Wed, 17 Aug 2022 09:39:24 -0700 (PDT) Received: from localhost ([::1]:43152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOM4g-0003Yz-3o for importer@patchew.org; Wed, 17 Aug 2022 12:39:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLmz-0006N1-GH for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20232) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLmw-0005TS-Eh for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:03 -0400 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-9-HqPrCmflMUS02vgPRigHmw-1; Wed, 17 Aug 2022 12:14:54 -0400 Received: by mail-wm1-f71.google.com with SMTP id c64-20020a1c3543000000b003a61987ffb3so556447wma.6 for ; Wed, 17 Aug 2022 09:14:54 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id r12-20020a5d498c000000b0022520aba90asm3177097wrq.107.2022.08.17.09.14.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660753261; 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=Xfz6XTswuwv4CH04aYzROToap1HStUuF/uvdy/rMF0ycvh7rIljZ5GIhCXm6ilWDweEXuw 0e4QIlXz1KW06geqqtx7A8dgpzkq11Nwxg1liQE47OQxPy1te+IS4btnG3Fgfyz+og50dg tvNE2aN98ctU3KeHlvwbf5d91+2vVF8= X-MC-Unique: HqPrCmflMUS02vgPRigHmw-1 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=UzU5YPfhjvfTv5fzXmE0dJny5l1cl9kPaQWy1x7lqvs4FHLOEAGUxDofBy2TblXhMi DhKcLEsozvLlNRk7zkr1PMIgsKXJ7kHWI77YreqjKnBz0VQhh7DJyPYABrLisWjnxy5h nN0Xbj7cAUeHMuzZZjjFL4yZYLWt1sLKWkrtaJPKOimJtBAO+bkdPGUsKWZNIb/MlcwT P/X1QFEGiyAdSrEw/F5lv4C65HRhvGdRv/7uFlz84IOX0tOuk3C5x40KMwCtyqK9CVqE iqZEJcug4WNF/JFTi+ElSTfCSSKC3qS8XomjXB4HXOvUdyYReJcERUAvoSyeurBpPkVg jFMQ== X-Gm-Message-State: ACgBeo2EAHC/9oZc432j/WpjOFqShus/fSICq0Z+ydkRTk6YC1jEWCN5 kA0RvdxXB67egp3lBLrfbqsVUWnUGWe6CSqGcXySi2wtNwRBJ+R/KuAH0IGJH84UCu1Wr7XhZ7p jfQhBioBbCaIyExsUuvAZheL9C85lL6/2l/TEWwk/sc/C00a0c3+Josbzahc6 X-Received: by 2002:a5d:4407:0:b0:222:cd99:3f0 with SMTP id z7-20020a5d4407000000b00222cd9903f0mr14416545wrq.44.1660752893105; Wed, 17 Aug 2022 09:14:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5z8UvQ2kNCwTfyDBH5EXNFtTaEIigbriRsC+9iN2s+TL03e13pODDfRlIVkkIqIy1mpE/odA== X-Received: by 2002:a5d:4407:0:b0:222:cd99:3f0 with SMTP id z7-20020a5d4407000000b00222cd9903f0mr14416526wrq.44.1660752892733; Wed, 17 Aug 2022 09:14:52 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:49 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Bobo WL , Ben Widawsky Subject: [PULL 06/10] hw/cxl: Add stub write function for RO MemoryRegionOps entries. Message-ID: <20220817161342.240674-7-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754366408100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 off= set, unsigned size) return retval; } =20 +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 =3D { .read =3D mdev_reg_read, - .write =3D NULL, /* memory device register is read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, @@ -173,7 +179,7 @@ static const MemoryRegionOps mailbox_ops =3D { =20 static const MemoryRegionOps dev_ops =3D { .read =3D dev_reg_read, - .write =3D NULL, /* status register is read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, @@ -188,7 +194,7 @@ static const MemoryRegionOps dev_ops =3D { =20 static const MemoryRegionOps caps_ops =3D { .read =3D caps_reg_read, - .write =3D NULL, /* caps registers are read only */ + .write =3D ro_reg_write, .endianness =3D DEVICE_LITTLE_ENDIAN, .valid =3D { .min_access_size =3D 1, --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660753646; cv=none; d=zohomail.com; s=zohoarc; b=fjtKuPZ67N6NzB7dt6sB3mUx2nwmyWrodPQjuNUyDX3z8pnF7gs4UHsFaYTfvaBoOKGQ9VFh+s1OhDxT5gmgKy3Ap9IeLm1B+WvlajOgBZyKQBozfX30ImcAIxnXEF1nKodBGPDI7CfR6p3Qr9Bzns7cl+8rwoU2/OEFYRHZIf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660753646; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qDm9ba4xKEi3LKXl4UlNy7JuhkQRFooUwFqHTDiXY2A=; b=S4krPqQdNb1ixBa1EgMTukMks+YAB5TejaGnVET3QdmR4Pdi4zObwanjsk6L2XcJ5Yp+vju+4MvvWpRSLsusBSzme/8S8P8Sk8juW/L+IVtvYxVu7XJGuDCEJC6bM1++UY0MnwK8fTNIAWzuRLXnQjyHgKdkDiZ/OGZmUJGawM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660753646140149.74539333095083; Wed, 17 Aug 2022 09:27:26 -0700 (PDT) Received: from localhost ([::1]:53078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLt3-0007Nm-48 for importer@patchew.org; Wed, 17 Aug 2022 12:27:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnU-0007dg-O4 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50716) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnS-0005Xk-5N for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:36 -0400 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-571-2MYvHjyxP1yB4DRqdlPhGg-1; Wed, 17 Aug 2022 12:14:58 -0400 Received: by mail-wm1-f71.google.com with SMTP id v67-20020a1cac46000000b003a615c4893dso944123wme.3 for ; Wed, 17 Aug 2022 09:14:57 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id bt22-20020a056000081600b002251e86241csm4080678wrb.48.2022.08.17.09.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660753293; 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=P85t7GzI1mZbcabWLBzH66kglfjS5OBJ0J5OCiMfI51FhNFUW5Ed2rEJO9FRSuZQ5d2yq8 zYjrm9ljEJl074HpRBIAOhYknH5aumyBaSO2Pz4TozT8DzXcv9d8J5ZskvxzmgH4HqHaGF Lz8xNC9zahecbUTzDoX0zNfMhi3OMaI= X-MC-Unique: 2MYvHjyxP1yB4DRqdlPhGg-1 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=DVHmts1VyFY7zgvkm+tyE3xCHtk3xpKfJ+PbsZgDGsEQN57vUvXqHAmtPaDPif0E9Z 5Vah2GBA8e8+DkfuWtlxNsQbVSq9zKXAlwJiutsHaUWDhlky5YH1nffl2xEuCJyxt+KW ct24mLWoJq/e7dVcFtnY6/bRRkAVp5ZrrmXj5DDI7KerCbv+x90cjZnJwW9+dhn3fkMe 2Cq189ZvMx9Tm9cnMzUjX/W6VQTd9XW81IawOSto0k8Y2FO0Pdqvq0sYc3veY3AsbNap M+dQ8YMsAah/PSKrUd4AhX4J8vKPOlzzeraplnhb6mJgVjx3h7YMI2ch4SIUBNQCFQmv fy6Q== X-Gm-Message-State: ACgBeo0cIfha83Nforwe1IJV2Z10V/vVz8+pdoeoEaJNEUP9bCK8Jlof WRZ2qq5QS5DftOr5n63UXD9JMX1k5Fh9x771PktRTmSXEPft9dGs8A+cE7ZKeeE5CNFocVI+ual 4C8eyyicfR9qxjhhaWQmY8+jvWTWrLwszFOPH7lWKIek3RXEJ0FwRyMFgyxYk X-Received: by 2002:a05:6000:50a:b0:225:210c:a7e4 with SMTP id a10-20020a056000050a00b00225210ca7e4mr3068145wrf.704.1660752896635; Wed, 17 Aug 2022 09:14:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR7N9BQhGx/L6Bl0z45YU07nurapipLrTJvNFQvghogz4N43zfTmgcYsMJ3mSLsA/m+vfa1NKg== X-Received: by 2002:a05:6000:50a:b0:225:210c:a7e4 with SMTP id a10-20020a056000050a00b00225210ca7e4mr3068131wrf.704.1660752896367; Wed, 17 Aug 2022 09:14:56 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 07/10] hw/cxl: Fix Get LSA input payload size which should be 8 bytes. Message-ID: <20220817161342.240674-8-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660753647239100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 (LS= A)") 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] =3D { cmd_identify_memory_device, 0, 0 }, [CCLS][GET_PARTITION_INFO] =3D { "CCLS_GET_PARTITION_INFO", cmd_ccls_get_partition_info, 0, 0 }, - [CCLS][GET_LSA] =3D { "CCLS_GET_LSA", cmd_ccls_get_lsa, 0, 0 }, + [CCLS][GET_LSA] =3D { "CCLS_GET_LSA", cmd_ccls_get_lsa, 8, 0 }, [CCLS][SET_LSA] =3D { "CCLS_SET_LSA", cmd_ccls_set_lsa, ~0, IMMEDIATE_CONFIG_CHANGE | IMMEDIATE_DATA_CHANGE }, }; --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754582; cv=none; d=zohomail.com; s=zohoarc; b=MAYbCoyHdWvONJeC1cIl+g6jqr/gxTSJqtaqwZvnTJVHT9uwMkCub8CNWADK8lwsC8tSdTn2l/WhDcZ5cuubRowAQQPAky6b17mV+KhMVzHIy3B+1cBQw9pQAtO2PUVJtno9O/NQ80/6fD40JHBrGOtd7Z7SKtP0mpdl4ZL4hh0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754582; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Dumk1EQg5Ag6vu8AL5g6B95ji6VBlJBMEnXMduaUodE=; b=ltd4JI7oSeSAs/uajdxWgvPlFcZul44SQqRg9yLV3Xa/21D3e/wsXgcJWlVTHu4lHTfWtVeH9dZNErwQCz1uhlEPxKqyRiaNGLrm5spS4iUngWy2pZB9VN48869Fg1ASIfFnHX0UIyO2P2E2IQyrB7GFZVLKrWMwgZMpw4+svbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754582509753.7426773355462; Wed, 17 Aug 2022 09:43:02 -0700 (PDT) Received: from localhost ([::1]:56056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOM8C-0000Y3-H8 for importer@patchew.org; Wed, 17 Aug 2022 12:43:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnX-0007ku-4t for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:45918) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnV-0005db-H4 for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:38 -0400 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-645-BibXulo_N7a2C56F0HNMmg-1; Wed, 17 Aug 2022 12:15:01 -0400 Received: by mail-wr1-f71.google.com with SMTP id g11-20020adfa48b000000b002250d091f76so1900438wrb.3 for ; Wed, 17 Aug 2022 09:15:00 -0700 (PDT) Received: from redhat.com ([2.55.4.37]) by smtp.gmail.com with ESMTPSA id b3-20020a05600010c300b002217339ce90sm13498386wrx.8.2022.08.17.09.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660753296; 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=fPENus8Fmlvz7CIiltFsGzgzaxSqh2FeIVZjrzge+h4tV/SSiAv8iIZsK+JkS2o8g47uIO umz4L/DoFHU8nDzaDdpY+h0HYqPzD2d2ouqL/eznuZVtF0hCG/1zGRGCNG/y8zPHk7PhAM UCUJiIKWZ0b/IPMnA2L1vkktIGnNaKE= X-MC-Unique: BibXulo_N7a2C56F0HNMmg-1 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=Ip+5mx/zoFOQEYbD9aXln1z4e1pA/vWmzGa6cXxPRP1lMTbkX16dL8HdnQrInvDG2O +Ot8pyNrzf8105ok92S2oKd3tBMD0oSi5lDlDiDqt6bBz9U/uNM/9SY63ccw1azWrY+8 63ipXMZwmCniQ8du5dFnG4KgDLqkuTS7hFyuB7wNvFUKKzyGsThWpKNTz2X5Of0ceT/I A2/JOM76EzL0xXMfYwm/rTKn4gUh/fTqU9uWDRm9YJC6ohWFzD77Eo2ucYLyHxBANi8z LfpufvpQvkw/M2cWBnSTo3cMxkOh14kBAIRKimQ6VLjaVsmhxKB+XhvNhvQ65xzWTfwj FUpg== X-Gm-Message-State: ACgBeo0MDMOJuUroQZ7VfAGbVdyoUkEgXxPhE3XEMZcFzaZNJ6TXottj xe0EIaRVdfW02S90Po9i4Zjh9Ys/NeHn6ARuvlKYMXCeSbmWQW48ByQcMqhJL1TV60qvRSEvUlC UU2gfjAo8QXm5P6aAjxOJ4H0iu0BbTmryGWK/mmqj91mtY2Iq1WPmyyH3MUJM X-Received: by 2002:a5d:64a1:0:b0:222:3b0d:c9a3 with SMTP id m1-20020a5d64a1000000b002223b0dc9a3mr15164680wrp.437.1660752899883; Wed, 17 Aug 2022 09:14:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR49T2bEym4M5bXS97Or9ylPWfRsZP1qYG8kyHvmtDY4k/Gt2RyGQWodrDvK+UXPSetHsBmJGw== X-Received: by 2002:a5d:64a1:0:b0:222:3b0d:c9a3 with SMTP id m1-20020a5d64a1000000b002223b0dc9a3mr15164664wrp.437.1660752899592; Wed, 17 Aug 2022 09:14:59 -0700 (PDT) Date: Wed, 17 Aug 2022 12:14:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky Subject: [PULL 08/10] hw/cxl: Correctly handle variable sized mailbox input payloads. Message-ID: <20220817161342.240674-9-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754584260100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D &cxl_cmd_set[set][cmd]; h =3D cxl_cmd->handler; if (h) { - if (len =3D=3D cxl_cmd->in) { + if (len =3D=3D cxl_cmd->in || cxl_cmd->in =3D=3D ~0) { cxl_cmd->payload =3D cxl_dstate->mbox_reg_state + A_CXL_DEV_CMD_PAYLOAD; ret =3D (*h)(cxl_cmd, cxl_dstate, &len); --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660754014; cv=none; d=zohomail.com; s=zohoarc; b=MeKk/LYGDMjj5SNRS7R8+iGyEuGa3tgdhugCKyDLuj7PhOf43r8UuCQXh73DygfVIe7l2u2j72G72BZZ2PkjDSQcRmj1ZJ/L4NIhoPvWMPfV0lYyBNLsLVXeWj/yxt9t8oFdgx58jnIegIluaqAKWv50qhztxN7AQZxwMra0X4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660754014; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=O2jVKSC/T/69XGJQ1pcYIKsl06VPDaFnR237r22fRUw=; b=VjHpX6li1AsQzuUdOoIiN2iYv+cLbn7dCsqYmXa3iJweyVnFXF3PztV5WY3HKMrllGd6xzmqNYu/2pY8VWebRjEu9tFqul18Bm4os9um1NS5W0yECQLPT7vDkxvJvgcAgfmZJFBT5kD26po22AutEUgHUSUkn+4G72DBUItuF64= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660754014620554.9453415295972; Wed, 17 Aug 2022 09:33:34 -0700 (PDT) Received: from localhost ([::1]:34868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLz2-0004wq-Qo for importer@patchew.org; Wed, 17 Aug 2022 12:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnc-000861-MS for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46134) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLnb-0005jq-3x for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:21:44 -0400 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-556-KnmV_bqpMYyWEXjWxqcr3A-1; Wed, 17 Aug 2022 12:15:04 -0400 Received: by mail-wm1-f70.google.com with SMTP id v64-20020a1cac43000000b003a4bea31b4dso1275708wme.3 for ; Wed, 17 Aug 2022 09:15:04 -0700 (PDT) Received: from redhat.com ([2.55.43.215]) by smtp.gmail.com with ESMTPSA id m18-20020adfe0d2000000b0021ea1bcc300sm13218852wri.56.2022.08.17.09.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660753302; 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=S2IdUMsavmGkpR5h2N/uoj7/A/K0aHIqCzc+RMLQFbPE6AzoDuSmtU5EoFcqNev8tIJarq pyZzRk1VJI5y/emnwFpZTrDmYq7S3tmIA5WW/1LJwpNMDCtPCEbCqQ+vYtfCsWaRjRVJIf E3r9jmI6NVo5YM/gD38Q5p3ZajuzCTM= X-MC-Unique: KnmV_bqpMYyWEXjWxqcr3A-1 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=XV/5r/y207Bzod9FvLga172TizdruixGnoo4eCgJJl7oUcmWXM7AS9NMi6xoiaR/HI zcQHukpP9CYFYGm34Hx+r1zH0NDEEVY8MCbXttRCOaqi6zNogV2Vh58xc1QveJYs1Lpf 6HlyscPvl4oMtYlc7Pka0uFz5KSMonhU0NS+KkYMrfiHS/xteu0xaqtlqJohr/fu2tD8 MI3zRG2HeUra8MqW+mDgX5Cm367AL+iLpHujdb8X0PdmDiCwwWHkwEPcg85a2Ee4IPZl gpUYM8xamAPdGSYkNN/KEyf356/KlXF+nJQOtTDwI/ZDZr2ZbNm3WOItQKQBsvRckD8z wljA== X-Gm-Message-State: ACgBeo2id1of8lamBxGJcAqEJPOUZwZdjreAqTGXY9P4v9Qh8LJJn+2/ aEI4nhLg1EJHE/nI9cR9cgl/ctw6x7+98O06PQr3U647XBtvaaC3ScvBkOD9SFSCmPINYlKoHq9 eO/uqc823SVjOFjpTsHhOkrNb+vpWr8I4F/Tdw7W1ivUDB1ZZwxwWMMj7YNW/ X-Received: by 2002:a05:600c:4e4b:b0:3a5:d36e:8349 with SMTP id e11-20020a05600c4e4b00b003a5d36e8349mr2703540wmq.44.1660752903562; Wed, 17 Aug 2022 09:15:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR4dww4JL+w+0a7mVI3yoN3Vo5tT/zjLrdxDDpRwNdtJsw8/OSfIUbZ8oU4KwcY4JupelJkTyw== X-Received: by 2002:a05:600c:4e4b:b0:3a5:d36e:8349 with SMTP id e11-20020a05600c4e4b00b003a5d36e8349mr2703520wmq.44.1660752903205; Wed, 17 Aug 2022 09:15:03 -0700 (PDT) Date: Wed, 17 Aug 2022 12:15:00 -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 09/10] tests: acpi: silence applesmc warning about invalid key Message-ID: <20220817161342.240674-10-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660754015877100001 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=C3=A9 Signed-off-by: Igor Mammedov Message-Id: <20220728133713.1369596-1-imammedo@redhat.com> Reviewed-by: Daniel P. Berrang=C3=A9 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 =3D ".applesmc", }; =20 - test_acpi_one("-device isa-applesmc", &data); + /* supply fake 64-byte OSK to silence missing key warning */ + test_acpi_one("-device isa-applesmc,osk=3Dany64characterfakeoskisenoug= h" + "topreventinvalidkeywarningsonstderr", &data); free_test_data(&data); } =20 --=20 MST From nobody Sun Apr 28 09:31:38 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1660753598; cv=none; d=zohomail.com; s=zohoarc; b=DJbcteEjiGtGJFyDDION6CER6sru+tGl7m900v2gItOfZ4mUO0Zysc8tPMUe4aQHzhs9a+Z7stuPMaZeoFE5p7rUm6x7qIFcZh4tGsdG7fvFPt9JIm4vL/vePllVp0WoKXtA+AjQFfTKzvc19Nz/LUJZEdaR5S/WeLp7aO4rCtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1660753598; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=EeMkAHhf9AoIGqHoeQ4LAkZR3KVWS7ogggvX+tcW7Dw=; b=RVmwF63kS0nigcDyV+AG4jWLlUKo9Cf2WG2/y44pDTxr0IMVw2nJH0JR45xomNr/6WPi0JkOCT9aaUxq5yNe4F2Rw4iN7oBfmEKM9DpOzp6sNnAff8TxUrnONQnsobTMVzrOZdcHldYOMtYyaKyclLB3t8CgrZktzWf18U6RBaE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1660753598243359.6646711658892; Wed, 17 Aug 2022 09:26:38 -0700 (PDT) Received: from localhost ([::1]:51564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOLsK-0006AF-La for importer@patchew.org; Wed, 17 Aug 2022 12:26:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLir-000269-Mj for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:16:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46038) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOLim-0000TD-Iz for qemu-devel@nongnu.org; Wed, 17 Aug 2022 12:16:48 -0400 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-648-thGiVR2fObeUDfqWi0NMOg-1; Wed, 17 Aug 2022 12:15:08 -0400 Received: by mail-wm1-f69.google.com with SMTP id az42-20020a05600c602a00b003a552086ba9so1266988wmb.6 for ; Wed, 17 Aug 2022 09:15:08 -0700 (PDT) Received: from redhat.com ([2.55.43.215]) by smtp.gmail.com with ESMTPSA id z1-20020adfec81000000b0021e51c039c5sm13467503wrn.80.2022.08.17.09.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 09:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660752972; 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=A1C6Da3efTyflyQ4ob5e5rbT6Y6n6wTdJnFH9CHwf01mKZEaLHguN05lwL7HPo/m/e3u/a V3e7AB2023I2qy/q4dk7cy9P4WYnwYl3OqprcN0ZfNMxuOxRma18VTFJX+CgQ+VU4Il2cK OKqxK/N9g7/O0bqP9h8R5VPPkJhRP/o= X-MC-Unique: thGiVR2fObeUDfqWi0NMOg-1 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=k62nU5rjBKZAiP4XHtdIOsADtFiDkD0cCtn76/yVK6RkUEtFH5ovOlZytAGnZRXlit DaSchKK/hRu1ny8zAciB0mOUSGHiyimj3T4XRgz+cRenVG1j9a8xjjGKCENKeGG8sUJk veCDA29+VT7qMFNX0KhcJDA3DVFiMqK3y3Rwk4cuV/y1JTiqzPeuzZ9YkAYFwqvFR0Dw vPFfzUe8P+ZSXVxgwS7dYcpiTU2wiNabv8mrk8rI/O7gHLVNhb0dRoTPydTUiKLbc14g 2pW0G2iiAXj2RnP2XOtC2V+NadCM5mECQZIhowh8VX4EuZeIgjRMfjHo1cZllcNStap9 WufA== X-Gm-Message-State: ACgBeo0+UnrzM4vV87WBnkQUxbIzwtuPN/SR5xTTsKnmK5qEio5YPJiX My9HkMF0sydj2ByA4iQxtEPtFxxI5hjfdn9OY4UaadgM4dtIoq2rtJgDoRLeZkJwhExtoWAFbY6 CCYVnruonhuCxcneUNIPuoHUzWtLh+r4/07i7IsHRtjVypftMZxFzQWkyuV52 X-Received: by 2002:a05:600c:4f07:b0:3a3:2277:7064 with SMTP id l7-20020a05600c4f0700b003a322777064mr2594478wmq.181.1660752907096; Wed, 17 Aug 2022 09:15:07 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pSXUwQlbxPGsJ/e8auNOh0Oz/Exj8NMtLR028QHjXR2BEDrE/ZnNFXxC3XDkyxxVHHiK+Cg== X-Received: by 2002:a05:600c:4f07:b0:3a3:2277:7064 with SMTP id l7-20020a05600c4f0700b003a322777064mr2594459wmq.181.1660752906829; Wed, 17 Aug 2022 09:15:06 -0700 (PDT) Date: Wed, 17 Aug 2022 12:15:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Marcel Apfelbaum Subject: [PULL 10/10] virtio-pci: don't touch pci on virtio reset Message-ID: <20220817161342.240674-11-mst@redhat.com> References: <20220817161342.240674-1-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220817161342.240674-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -9 X-Spam_score: -1.0 X-Spam_bar: - X-Spam_report: (-1.0 / 5.0 requ) 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=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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1660753599198100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 PC= I Express virtio devices") Fixes: d584f1b9ca ("hw/virtio: fix Link Control Register for PCI Express vi= rtio devices") Fixes: c2cabb3422 ("hw/virtio: fix error enabling flags in Device Control r= egister") 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 =3D VIRTIO_PCI(qdev); VirtioBusState *bus =3D VIRTIO_BUS(&proxy->bus); - PCIDevice *dev =3D PCI_DEVICE(qdev); int i; =20 virtio_bus_reset(bus); @@ -1960,6 +1959,13 @@ static void virtio_pci_reset(DeviceState *qdev) proxy->vqs[i].avail[0] =3D proxy->vqs[i].avail[1] =3D 0; proxy->vqs[i].used[0] =3D proxy->vqs[i].used[1] =3D 0; } +} + +static void virtio_pci_bus_reset(DeviceState *qdev) +{ + PCIDevice *dev =3D PCI_DEVICE(qdev); + + virtio_pci_reset(qdev); =20 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 =3D PCI_CLASS_OTHERS; device_class_set_parent_realize(dc, virtio_pci_dc_realize, &vpciklass->parent_dc_realize); - dc->reset =3D virtio_pci_reset; + dc->reset =3D virtio_pci_bus_reset; } =20 static const TypeInfo virtio_pci_info =3D { --=20 MST