From nobody Sun Nov 24 05:35:22 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=1726065134; cv=none; d=zohomail.com; s=zohoarc; b=Y63sujETIIrt5UCyCm6fLdvZl+Gp9hM6W88MyqNdoacALYQrbb7aKRg5IMbhqC6K6/Q++AKsi1euDFjN2eIDuqeQmUTjd+1GCcCC7YpaWbNFTJ8Lod/qVjQQlf7nefUaRWkr+YpdovU3rbIeeZ/1Oeicoh3Xoqn2b4cnxMEOIwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065134; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=R5ePHMPfQwBzPpsGte/yR9q9ulk7hoKYYN7lCYMftAw=; b=C4jQRN69Aqs78TVTwHjGJvNtCPf69ygzX1LPPgAC+oxmryqi0LXDL/SbKeT/KBOClPNT9EeUfcBJfl9IURYV0rWmv2VQYSkPzPBemkZzmpQKc723sSyhXgdtCdRL8664+V1vD9fg6oHthzYE7mubkiwovRLVeBVwgXbtp1yP+wE= 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 1726065134767457.42140427880236; Wed, 11 Sep 2024 07:32:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOKF-0000p7-OY; Wed, 11 Sep 2024 10:28:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJR-00079d-Tr for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJN-0003NJ-A1 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:15 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-316-BiHTkPcBPKySs71RUCzzFQ-1; Wed, 11 Sep 2024 09:51:32 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a870f3a65a0so490938166b.0 for ; Wed, 11 Sep 2024 06:51:31 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cec10asm613690266b.160.2024.09.11.06.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726064832; 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=R5ePHMPfQwBzPpsGte/yR9q9ulk7hoKYYN7lCYMftAw=; b=hact8nxCQRbz/LW1pUfuNLnCNHF9q7LiOsihXR0nvrzY/Z408PCtPu0CQybB9TE45hxKaJ NUoTx6i+7SmLmSO8dR/0qV8g+edDBmK1krMe9bMcxEmZD/x+P1HpRAqDTKFa/QHMJaS5lg STXLN0UPv5sqhKECkCh1FMMsj8VfoOM= X-MC-Unique: BiHTkPcBPKySs71RUCzzFQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062689; x=1726667489; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=R5ePHMPfQwBzPpsGte/yR9q9ulk7hoKYYN7lCYMftAw=; b=sZOcBhElDOcYQociXdLEyLkJq8si2HMPuZf+B6Bsag9wFrMGYhJDKqDpvUe7INTi3Y O8dLBZtCLiDQl+ai/gGzmorI3j7QCasFWCb3I1a1kjdxg7eQ/N25mDQi6u2E48Y8wK/D +yGFbcc06wn7TorBCE+MRMLWN7f1AhgeDgwrhneO0QnVDrnuo9Rvgq5hzIaGmf3DMlvv r3TnZ9trUZ/aDJ/pxJRhBXimmdK1KDu7waMMrcOfXUcRbfKMofgcg+iLUjWeuSCXQfw9 mqBaEKE4NkTcZSaG7I4Hi+ZEmsEbX/J1/8Sb5nXPvlilFt9k6YMoJb+J7ZVqs+pSq7X2 NGQw== X-Gm-Message-State: AOJu0YzVjuha4S+PI/Ygj+4qAz46ho8NxdThQYQSAy54hyKKpbdT3kr3 uC7W9gCjA8nmr8l/ZD3soRiWDD//xZ3lsMGEiYSM1jv2Nn/ikUjw2GiNII+K+D7yI+mwwTT5vRA x6JIIjSVFzuCNJppKZ2pE4voeW3CJ1tfes+rtDxjjcqEy25cQI7MRNPULpCyUDstKigBKrPiFPn uZDmyVOvqG0kxSFEjNK+tc+dNZR25KnA== X-Received: by 2002:a17:907:9487:b0:a86:7924:11bd with SMTP id a640c23a62f3a-a8ffad9d1a8mr452160566b.41.1726062689271; Wed, 11 Sep 2024 06:51:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFY+bWB+IztdPuwAyYLrFzsLbCvl61KtjpyJeZQfkrPuLoif8uHr5PqRAsy2azdqO7WXIAXmA== X-Received: by 2002:a17:907:9487:b0:a86:7924:11bd with SMTP id a640c23a62f3a-a8ffad9d1a8mr452156966b.41.1726062688686; Wed, 11 Sep 2024 06:51:28 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:25 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hanna Czenczek , Stefan Hajnoczi , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Stefano Garzarella , Jason Wang , "Gonglei (Arei)" Subject: [PULL 01/18] virtio: Allow .get_vhost() without vhost_started Message-ID: <00adced5c3166ee65b6880b48c1e0826b7304f76.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065136760116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hanna Czenczek Historically, .get_vhost() was probably only called when vdev->vhost_started is true. However, we now decidedly want to call it also when vhost_started is false, specifically so we can issue a reset to the vhost back-end while device operation is stopped. Some .get_vhost() implementations dereference some pointers (or return offsets from them) that are probably guaranteed to be non-NULL when vhost_started is true, but not necessarily otherwise. This patch makes all such implementations check all such pointers, returning NULL if any is NULL. Signed-off-by: Hanna Czenczek Message-Id: <20240723163941.48775-2-hreitz@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefan Hajnoczi --- include/hw/virtio/virtio.h | 1 + hw/display/vhost-user-gpu.c | 2 +- hw/net/virtio-net.c | 19 +++++++++++++++++-- hw/virtio/virtio-crypto.c | 18 +++++++++++++++--- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 0fcbc5c0c6..f526ecc8fc 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -223,6 +223,7 @@ struct VirtioDeviceClass { int (*post_load)(VirtIODevice *vdev); const VMStateDescription *vmsd; bool (*primary_unplug_pending)(void *opaque); + /* May be called even when vdev->vhost_started is false */ struct vhost_dev *(*get_vhost)(VirtIODevice *vdev); void (*toggle_device_iotlb)(VirtIODevice *vdev); }; diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index c0c66910f1..14548f1a57 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -642,7 +642,7 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error = **errp) static struct vhost_dev *vhost_user_gpu_get_vhost(VirtIODevice *vdev) { VhostUserGPU *g =3D VHOST_USER_GPU(vdev); - return &g->vhost->dev; + return g->vhost ? &g->vhost->dev : NULL; } =20 static Property vhost_user_gpu_properties[] =3D { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index ed33a32877..fb84d142ee 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3896,8 +3896,23 @@ static bool dev_unplug_pending(void *opaque) static struct vhost_dev *virtio_net_get_vhost(VirtIODevice *vdev) { VirtIONet *n =3D VIRTIO_NET(vdev); - NetClientState *nc =3D qemu_get_queue(n->nic); - struct vhost_net *net =3D get_vhost_net(nc->peer); + NetClientState *nc; + struct vhost_net *net; + + if (!n->nic) { + return NULL; + } + + nc =3D qemu_get_queue(n->nic); + if (!nc) { + return NULL; + } + + net =3D get_vhost_net(nc->peer); + if (!net) { + return NULL; + } + return &net->dev; } =20 diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 5034768bff..0793f56965 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -1247,9 +1247,21 @@ static bool virtio_crypto_guest_notifier_pending(Vir= tIODevice *vdev, int idx) static struct vhost_dev *virtio_crypto_get_vhost(VirtIODevice *vdev) { VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(vdev); - CryptoDevBackend *b =3D vcrypto->cryptodev; - CryptoDevBackendClient *cc =3D b->conf.peers.ccs[0]; - CryptoDevBackendVhost *vhost_crypto =3D cryptodev_get_vhost(cc, b, 0); + CryptoDevBackend *b; + CryptoDevBackendClient *cc; + CryptoDevBackendVhost *vhost_crypto; + + b =3D vcrypto->cryptodev; + if (!b) { + return NULL; + } + + cc =3D b->conf.peers.ccs[0]; + vhost_crypto =3D cryptodev_get_vhost(cc, b, 0); + if (!vhost_crypto) { + return NULL; + } + return &vhost_crypto->dev; } =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726067177; cv=none; d=zohomail.com; s=zohoarc; b=FQ2xosu25f+8xb4IWc4eMQpBkND3MoJ9NNGDMXpUHcc/vywolfHVu6p5Lw73KWxYcXKbHAPILsA0KHyKm+7a4guwQfiHCJG2eFaVttYbYAgxKpcuhKpdE8JrLtnOqfbSMlWy1+s0FrjzNTKU85IQAWVOrhWJGCTGg4TNCsDoAfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726067177; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=H3/RbhQGQ6+o6xoRvkRMHa82wsOC3BKipqBPf5VTk9U=; b=ZaCS/bPVl5TsuZ25UloUNIKRa6OTyWRJWgVTjzE+5xcxx+ykALzv8Coei+lNZbIAwuJOQHB9BPDLN8iHE/f5u/K+dZMHhPdPv0Ur6Mb//Dr86FAwUoVSQp8lkDq1WP3pkYcHrTZLJ3CsQMSU+Mhqyp+rWgZ107SRc6H+ViGX3Q0= 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 1726067177742998.0078414823981; Wed, 11 Sep 2024 08:06:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOjN-000488-Kr; Wed, 11 Sep 2024 10:54:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOiS-0001fb-G1 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:53:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOiP-0007HI-Jt for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:53:07 -0400 Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-250-xX71cbeAMSaKl3xvr-KG7A-1; Wed, 11 Sep 2024 09:51:34 -0400 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-536589936d3so1813392e87.0 for ; Wed, 11 Sep 2024 06:51:34 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25835b0bsm625639466b.12.2024.09.11.06.51.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066383; 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=H3/RbhQGQ6+o6xoRvkRMHa82wsOC3BKipqBPf5VTk9U=; b=QMF+C6SXSVE0pa9s6W1VyOtHDYEy/KPVtWBzqhdDV+1Bg3W5JbB/9zl7AhCmTO3aAxhGEN ojQrmZjntMkHCY45wy+D32Qe56QfrgorgxbFPJa40AZUJMT0DjqQwU8CRQURwpSQ/KHT7d IG7wXbDGe8jZKFEQAZychwYdn/u9EEE= X-MC-Unique: xX71cbeAMSaKl3xvr-KG7A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062693; x=1726667493; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H3/RbhQGQ6+o6xoRvkRMHa82wsOC3BKipqBPf5VTk9U=; b=kNT1yLa5UkyETYzsCfAZiH2akdmB6GlxcZxOHvBlMwTzDuIIQB0guCy4be2J5ZvdcT yaLZcIQy/IZEFrptZi7CYiOvAxLElzRXtHLg+vIdNBpQE/a1PR1pI02GWzye0Da2kGjH fXzukTo9pJ3Vhs97edLavWjKBIKRzphSEKa6KRElDeLM4ZgcAu+ao8vfTVWSJnMhhniG ZExSroEnmKiv6vo7mjbHMuEIfTV0fJrD+HvqQV0i0QWapzmb7Bpa8NNE5ZQ613eJMiZU NA08VSTUUHZckv78S09UATUWy1hq0IdslPiqL75S9UaSzK/ohVSe/7n/guHQWaam66Lw pXRQ== X-Gm-Message-State: AOJu0YxKvpErl8AINKOpLYwnx6YDZ9TtQIUWrqX/D7ZSMCvAFjZwazYk T2HNnbL1+wW77PJwm8jv7DdJEIqHX2aswqfNMJOqODsA35QWwQyHTnEZbdiFc/qGhHBnlp3EXGR HmFHd0p760Lo4BFu6IvmfI7TPumectNK2NOREC9DINWdpwifQAr6Dt02phhhz+U/BTlmDW5N0Dh eG+eC9ddiNp0fdBjPwxvMA2nY17h8XWw== X-Received: by 2002:a05:6512:b1c:b0:52c:dfa2:5ac1 with SMTP id 2adb3069b0e04-53673b5fa9bmr1671326e87.24.1726062692846; Wed, 11 Sep 2024 06:51:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFYvyO7rDO2vQrMeqXdTh83xQG9qGuW9kbCIlblfYqUWqLcu2QsOKRrsj/bTuarXyVcehKXBg== X-Received: by 2002:a05:6512:b1c:b0:52c:dfa2:5ac1 with SMTP id 2adb3069b0e04-53673b5fa9bmr1671271e87.24.1726062691756; Wed, 11 Sep 2024 06:51:31 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Hanna Czenczek , Stefan Hajnoczi Subject: [PULL 02/18] virtio: Always reset vhost devices Message-ID: <2688e8df60f5a655dc34c5e38523e425556f8483.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726067179747116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Hanna Czenczek Requiring `vhost_started` to be true for resetting vhost devices in `virtio_reset()` seems like the wrong condition: Most importantly, the preceding `virtio_set_status(vdev, 0)` call will (for vhost devices) end up in `vhost_dev_stop()` (through vhost devices' `.set_status` implementations), setting `vdev->vhost_started =3D false`. Therefore, the gated `vhost_reset_device()` call is unreachable. `vhost_started` is not documented, so it is hard to say what exactly it is supposed to mean, but judging from the fact that `vhost_dev_start()` sets it and `vhost_dev_stop()` clears it, it seems like it indicates whether there is a vhost back-end, and whether that back-end is currently running and processing virtio requests. Making a reset conditional on whether the vhost back-end is processing virtio requests seems wrong; in fact, it is probably better to reset it only when it is not currently processing requests, which is exactly the current order of operations in `virtio_reset()`: First, the back-end is stopped through `virtio_set_status(vdev, 0)`, then we want to send a reset. Therefore, we should drop the `vhost_started` condition, but in its stead we then have to verify that we can indeed send a reset to this vhost device, by not just checking `k->get_vhost !=3D NULL` (introduced by commit 95e1019a4a9), but also that the vhost back-end is connected (`hdev =3D k->get_vhost(); hdev !=3D NULL && hdev->vhost_ops !=3D NULL`). Reviewed-by: Stefan Hajnoczi Reviewed-by: Michael S. Tsirkin Signed-off-by: Hanna Czenczek Message-Id: <20240723163941.48775-3-hreitz@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 9e10cbc058..42589adf2c 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2331,8 +2331,12 @@ void virtio_reset(void *opaque) vdev->device_endian =3D virtio_default_endian(); } =20 - if (vdev->vhost_started && k->get_vhost) { - vhost_reset_device(k->get_vhost(vdev)); + if (k->get_vhost) { + struct vhost_dev *hdev =3D k->get_vhost(vdev); + /* Only reset when vhost back-end is connected */ + if (hdev && hdev->vhost_ops) { + vhost_reset_device(hdev); + } } =20 if (k->reset) { --=20 MST From nobody Sun Nov 24 05:35:22 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=1726067193; cv=none; d=zohomail.com; s=zohoarc; b=E7zH0GTJN7OKRRaQ+FxbeloF364ZQNJFPSyIQEUQkuFUF7fZxEM5taglXRxDxx8Q0gjWlfYZnAclrxU6Vmji9ZyR862zwPvJOQpJ8oxUiMeYGffwJiI0UrAr0g9Xpq6neFxiZyrgxGG5I2jLgSnOUVwpGT9PVzg+w1jNOn/7zjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726067193; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cW6rJsKhPMN4DAXnpRk9aJejhnXYOKSdkgv1oLepLKc=; b=ftVHbshJCwc9PhbtGDjHKCjkSEsatkyF71kOJeuV3j9vejbv9XuykXkNOWT4s41neOiWluasUqWCRqvT6IS3xUyhwY7sf/KmF/sLr25WnCq2saVlZxyvdt22g0HRLOjaia8i/75jgMdPT8MSgo8cKAPjE/TXfPBKyNTTuYYGp+w= 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 1726067193638654.8398260688233; Wed, 11 Sep 2024 08:06:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOmg-0001My-8V; Wed, 11 Sep 2024 10:57:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhi-00070k-Be for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhX-0007Dd-73 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:15 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-550-uku9yfBzMNqmtwfAvz6AZA-1; Wed, 11 Sep 2024 09:51:37 -0400 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c25c45afb2so4829182a12.1 for ; Wed, 11 Sep 2024 06:51:37 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d259c1fa3sm616631166b.80.2024.09.11.06.51.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066329; 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=cW6rJsKhPMN4DAXnpRk9aJejhnXYOKSdkgv1oLepLKc=; b=UOzKZ/LkrVY2P0xxqap6GqTzzhVJfUEyCR5O9WnyYM/hYdutN79nbugmOSRosPxLBPcdiJ 3aAY84fHcvs6idYVd+FJe2fgS4YMqoK1Oo90TD0WYRO1Yh4T6Lk+rvRixYSZqK6g71Mck1 Wzt4GJFe36rDGTw545bhb3q1w5KDauU= X-MC-Unique: uku9yfBzMNqmtwfAvz6AZA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062695; x=1726667495; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cW6rJsKhPMN4DAXnpRk9aJejhnXYOKSdkgv1oLepLKc=; b=U6edi+VD2seSGOTusjonRapM/ryDqo+ePL252+7kyZh5am2rv9KY9asmiCIPswb4Yj n+9acIwUU2+7dna2CGRgUlYYqd0iDYEGIKnKd7PgvrPXM/OC2F74ea0ViWHUlqi2bBRx j2GNnlKT09IwrOqSGfYAndUqXYzKneqkGJESZEHpJaNATMHus7IvCb7/WHI6G8uj78zf RCEybm+g2+LrZbvpXtrYqTi7YeZkKR4FP65Nw/NO2GcXlQDLMQ5D6rQ0X68FTzC23Ldo QDeB9r1tcTl3KGwABkHnX2oGE2g49ivTzKtbxKoWfkiKcLQpiQKGOM4pE5+F40pcx95G XtzA== X-Gm-Message-State: AOJu0Ywhjg/IbJiikg4ThA+/m5Yttblo+beeTo5MeJtoEmyJReDiT1L9 lyEPGNku6A3pTGYmpsSwNjBXTp8M0pSg5gPHwsg+BKBw4Cnyw/W1C7kasvsN9bGoTtXBAdYgEt1 SYnBm7ZsA8LDs+jA2CY1PHzpC+zVD+AN+KSxukGSoQtkBXRENzHp6EbPVO8YIPBuFRrytP19Vuo 5HZNt/FPQBt7Oggh64v48RE0mDza777A== X-Received: by 2002:a17:907:7f10:b0:a8b:6ee7:ba25 with SMTP id a640c23a62f3a-a8ffadb0612mr405072366b.47.1726062695518; Wed, 11 Sep 2024 06:51:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGlSiPBnTtHcvdwGtlu9vE+aMb07EQGcKjwLV6c8rHV3ngBWdOtgs2ai/xRWXpg0D8Crxxr8w== X-Received: by 2002:a17:907:7f10:b0:a8b:6ee7:ba25 with SMTP id a640c23a62f3a-a8ffadb0612mr405067566b.47.1726062694589; Wed, 11 Sep 2024 06:51:34 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , BALATON Zoltan Subject: [PULL 03/18] hw: Move declaration of IRQState to header and add init function Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726067195693116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan To allow embedding a qemu_irq in a struct move its definition to the header and add a function to init it in place without allocating it. Signed-off-by: BALATON Zoltan Message-Id: Signed-off-by: BALATON Zoltan --- include/hw/irq.h | 18 ++++++++++++++++++ hw/core/irq.c | 25 +++++++++++-------------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/include/hw/irq.h b/include/hw/irq.h index 645b73d251..c861c1debd 100644 --- a/include/hw/irq.h +++ b/include/hw/irq.h @@ -1,9 +1,20 @@ #ifndef QEMU_IRQ_H #define QEMU_IRQ_H =20 +#include "qom/object.h" + /* Generic IRQ/GPIO pin infrastructure. */ =20 #define TYPE_IRQ "irq" +OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ) + +struct IRQState { + Object parent_obj; + + qemu_irq_handler handler; + void *opaque; + int n; +}; =20 void qemu_set_irq(qemu_irq irq, int level); =20 @@ -23,6 +34,13 @@ static inline void qemu_irq_pulse(qemu_irq irq) qemu_set_irq(irq, 0); } =20 +/* + * Init a single IRQ. The irq is assigned with a handler, an opaque data + * and the interrupt number. + */ +void qemu_init_irq(IRQState *irq, qemu_irq_handler handler, void *opaque, + int n); + /* Returns an array of N IRQs. Each IRQ is assigned the argument handler a= nd * opaque data. */ diff --git a/hw/core/irq.c b/hw/core/irq.c index 3f14e2dda7..db95ffc18f 100644 --- a/hw/core/irq.c +++ b/hw/core/irq.c @@ -26,16 +26,6 @@ #include "hw/irq.h" #include "qom/object.h" =20 -OBJECT_DECLARE_SIMPLE_TYPE(IRQState, IRQ) - -struct IRQState { - Object parent_obj; - - qemu_irq_handler handler; - void *opaque; - int n; -}; - void qemu_set_irq(qemu_irq irq, int level) { if (!irq) @@ -44,6 +34,15 @@ void qemu_set_irq(qemu_irq irq, int level) irq->handler(irq->opaque, irq->n, level); } =20 +void qemu_init_irq(IRQState *irq, qemu_irq_handler handler, void *opaque, + int n) +{ + object_initialize(irq, sizeof(*irq), TYPE_IRQ); + irq->handler =3D handler; + irq->opaque =3D opaque; + irq->n =3D n; +} + qemu_irq *qemu_extend_irqs(qemu_irq *old, int n_old, qemu_irq_handler hand= ler, void *opaque, int n) { @@ -69,10 +68,8 @@ qemu_irq qemu_allocate_irq(qemu_irq_handler handler, voi= d *opaque, int n) { IRQState *irq; =20 - irq =3D IRQ(object_new(TYPE_IRQ)); - irq->handler =3D handler; - irq->opaque =3D opaque; - irq->n =3D n; + irq =3D g_new(IRQState, 1); + qemu_init_irq(irq, handler, opaque, n); =20 return irq; } --=20 MST From nobody Sun Nov 24 05:35:22 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=1726066651; cv=none; d=zohomail.com; s=zohoarc; b=dZnKqbe5Wm6ifEXsEKyscRdd7i/KzPm8Uo4/DESQv6/9dd140CYGBSol11/BnsKqevU2UCmrYKfq/R3yERWTmKoiw4FVUbVdxpVc3N/7a/oG4m7rKBRcDickkXV7heHrJHptSBduyqk15P8tUS6QR/utAyTA6Bn4CNi7wsmGUWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726066651; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Hje9oGIw2otX3n3e6GR0YuFJNQxqhspv7J1M4mo3f28=; b=R2ESyirpDSFjCyghbBi0yaHUF/Z/BT9L4eeOGuyarsExPFHRSQExoTOkx8ZqlKZNdS+Ho0nce07yvCdLqZNYC6/BHtOzYIVd1q5WinqN4pgb+MMZW5ddYl7mKXjNjPJAEGTrjZCENMpo3VN40o5qOoh2llEn0UUqBa08oYl6Zjg= 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 172606665182172.17993750195797; Wed, 11 Sep 2024 07:57:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOjv-00078Q-Mu; Wed, 11 Sep 2024 10:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhk-00079M-P3 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhc-0007Dw-N9 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:24 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-524-VH3gesR8PkCYoMjLDScvAw-1; Wed, 11 Sep 2024 09:51:40 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a8a877c1d22so330361966b.1 for ; Wed, 11 Sep 2024 06:51:40 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25a073b1sm612326266b.82.2024.09.11.06.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066332; 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=Hje9oGIw2otX3n3e6GR0YuFJNQxqhspv7J1M4mo3f28=; b=iXgLLhbpWthxegEe79bIE076DuOoVSiaWIJ62txPcBAK90mTl+aCUgEiqmnU+KJwmPhhMX bNPKmCznPjS5y1nv1/S5PD1Co1DThT02fJTVnw5JuKIwYXQd8LmU/U3NvNXe+Q1lgLEG2t cUEtIISt7Pik0cnZLY6APkPnDuMxzt0= X-MC-Unique: VH3gesR8PkCYoMjLDScvAw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062698; x=1726667498; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Hje9oGIw2otX3n3e6GR0YuFJNQxqhspv7J1M4mo3f28=; b=SGUB0kLBwIocZ/v9yq5xJXf4XGzAMZu74r5STeebOySSnTGBZMhv6/nyl5CTgk6PE7 oGdTWh+PlTYT8maeUxrkOBgjZduXMveW2HhCP5xmcA332onxg3zLoDiBEzWyZG85WYg9 L/j+AVdpAROd3ikFJH6t49dHF//rMunqTrsUwfrEiMiPuMEf8iQo8xlRrKTkIWCZMKcE A0isqGjjSMJjjcEhiroShtOccqY7TUI8b4uq8DR38fb3Qbe/BaF0rUsHSbRFOiCtnD+y 0egNrQyFEqgzs6JoO9/v3V2xBClxoGMAM65zfl65lEVRnKB0QZWNGA8z7jKayjoKuctq mc4w== X-Gm-Message-State: AOJu0YwjVcjebpPGkLDmbbWNJPMJQXeR2Gakrynm3pH0T7VZQUUkV5q+ aBrrsQ/yOjQiYEcs02/f8MNAq9Oatg+z/b2UI6or0UQFT/5p18N09vQ0iuMXb9fLxkhJf/WhNOo V23D2kzsLh5BUPxzB2Ky3ovjGtNeeqZKjznlzTDPBBOzgdXtuHOGleARVH4PgqQtjG/HCRUH9Tn TbIDnjvfhj6Ud287gkK04DqSz/rh87PA== X-Received: by 2002:a17:907:6d0e:b0:a8a:835f:4cb9 with SMTP id a640c23a62f3a-a8ffadf04ffmr336003966b.46.1726062698536; Wed, 11 Sep 2024 06:51:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6bD5XcAmB/xGWz6Ei3wFwoAeoEQsyQsfXaF1vCQ+x21OsHGZC9dt/pUD5oEbtl1oNshF04w== X-Received: by 2002:a17:907:6d0e:b0:a8a:835f:4cb9 with SMTP id a640c23a62f3a-a8ffadf04ffmr336000366b.46.1726062698036; Wed, 11 Sep 2024 06:51:38 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , BALATON Zoltan , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Jiaxun Yang Subject: [PULL 04/18] hw/isa/vt82c686.c: Embed i8259 irq in device state instead of allocating Message-ID: <2225dc562a93dc191c3b2a43f273639bebad5d9a.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726066652981116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan To avoid a warning about unfreed qemu_irq embed the i8259 irq in the device state instead of allocating it. Signed-off-by: BALATON Zoltan Message-Id: Signed-off-by: BALATON Zoltan --- hw/isa/vt82c686.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/isa/vt82c686.c b/hw/isa/vt82c686.c index 505b44c4e6..82591e3e07 100644 --- a/hw/isa/vt82c686.c +++ b/hw/isa/vt82c686.c @@ -592,6 +592,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(ViaISAState, VIA_ISA) =20 struct ViaISAState { PCIDevice dev; + + IRQState i8259_irq; qemu_irq cpu_intr; qemu_irq *isa_irqs_in; uint16_t irq_state[ISA_NUM_IRQS]; @@ -715,13 +717,12 @@ static void via_isa_realize(PCIDevice *d, Error **err= p) ViaISAState *s =3D VIA_ISA(d); DeviceState *dev =3D DEVICE(d); PCIBus *pci_bus =3D pci_get_bus(d); - qemu_irq *isa_irq; ISABus *isa_bus; int i; =20 qdev_init_gpio_out_named(dev, &s->cpu_intr, "intr", 1); qdev_init_gpio_in_named(dev, via_isa_pirq, "pirq", PCI_NUM_PINS); - isa_irq =3D qemu_allocate_irqs(via_isa_request_i8259_irq, s, 1); + qemu_init_irq(&s->i8259_irq, via_isa_request_i8259_irq, s, 0); isa_bus =3D isa_bus_new(dev, pci_address_space(d), pci_address_space_i= o(d), errp); =20 @@ -729,7 +730,7 @@ static void via_isa_realize(PCIDevice *d, Error **errp) return; } =20 - s->isa_irqs_in =3D i8259_init(isa_bus, *isa_irq); + s->isa_irqs_in =3D i8259_init(isa_bus, &s->i8259_irq); isa_bus_register_input_irqs(isa_bus, s->isa_irqs_in); i8254_pit_init(isa_bus, 0x40, 0, NULL); i8257_dma_init(OBJECT(d), isa_bus, 0); --=20 MST From nobody Sun Nov 24 05:35:22 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=1726066943; cv=none; d=zohomail.com; s=zohoarc; b=k5erSG0tjRy5OtE6oJhuPJVHxnC3OGPUpfX/wDR552b1GI6ufLt/JzzeSJ2vCVRSplURNYeil/0fFkp18vHAJUHkAhxioPfcfrPZc2u7p0bbEmTzPkHO8ia3kUD3ZwZYDYzcqUqGkRWHdTK3IRs+vilFcYjPRScsuo/zerX5/L4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726066943; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=rBqbG6UDFb2lXZqZscxyCV5To5/Zi8zm0XTznNZpuMA=; b=LUrJ+TbAXEJ+LCFP3VGToupc5jwLndSXMilAf0nHIoXxP3qbTAzr7zqcYUlcH+WychjNTYxwKJ+mj9S3mI/OGy9Il0ebK6ihrvko8ct1GidD/E2tbGMI495uLN2Tihu9Lm1ZZduB4v98Td3PaOsytlM0Ifuo/WWn7YNjEqRQRZw= 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 1726066943293808.2672241783459; Wed, 11 Sep 2024 08:02:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOkP-0000Jr-78; Wed, 11 Sep 2024 10:55:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhl-0007AC-09 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhe-0007Dm-T6 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:24 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-674-InaZLajGMWCDvGbR7dM2kA-1; Wed, 11 Sep 2024 09:51:43 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c3ea11cabcso3033020a12.1 for ; Wed, 11 Sep 2024 06:51:43 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd467desm5376296a12.40.2024.09.11.06.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066330; 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=rBqbG6UDFb2lXZqZscxyCV5To5/Zi8zm0XTznNZpuMA=; b=LZzR9+bLH/4pv3pqpi4CWl6IVdM5IGDOlldeBtnU7pekrvt8GhI3Mkrh2Q/vtCfUT1vt4F MyA+xjmRvT9020Q8m7SgCbMbvoAzHrEadMQyXdEwd7IbgMYa+81p8klYX3pHCV5ZxCDSEA 4NFsILYEly/wMeEpJ8yMe30dQPGF29s= X-MC-Unique: InaZLajGMWCDvGbR7dM2kA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062702; x=1726667502; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rBqbG6UDFb2lXZqZscxyCV5To5/Zi8zm0XTznNZpuMA=; b=rL0E+1+KF94czu8X4phH5Pu3x3M2x1cLuCbS3rITki8ujKk+ekMXqXlVaXIfJs1cNs fqI3oUDWH+VptdLqA9ILCaF7h568aLOpdXoGzrDoTbZjZhx6QKSb5ZE0/aUwAZ/0FZ/+ 51Vv7wgZKJJv7+Ao0j4FzpJXp8aXJla1+yhR2x8KUVt7PGpwmZMzlP6HBnxbfYyatR65 n6V2kQyOHdKL/m8KtuS2D6+ltzDwmwW8914LY10DLjRKcURFCSmZZGfpvHUjaiNVcGAm GwLHJ2qpmaKvfsfinZMPX0rFAUVZxIzkWkBn5fYG5pS42PNbVjMGgyR7wP7lKEkhsTR5 DfKw== X-Gm-Message-State: AOJu0YzX9gWocVnBxDaN50H+UiPmeQCY5eMAU5bFn+G4j5UEj6UCjZka BpH6NXft3pXDUpjkVx4udUS8LREQphyYF/e4A8HfzA+CHT5ZHEStmPjfxaQuG+C3odZTaugXLbU BlBxZFI0LmRAUYTVCiMUUDvPJjzxOLwMf3ydGAI2nCqMSU4lA3aChmyOjrUfh6Xn8lx/iWRnHhe 6NEwILM6FF8yLlxz5ZE+X4lzQkG6bb8g== X-Received: by 2002:a05:6402:13cc:b0:5c2:68e9:8cf with SMTP id 4fb4d7f45d1cf-5c3dc7baefemr15736950a12.24.1726062702262; Wed, 11 Sep 2024 06:51:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrVtn1ykVlfRoVI4AyHGxcVezidGX8RW5X7BjjPMETGEVnKYajuEHMepFWgmtWmq8iKQ2t9g== X-Received: by 2002:a05:6402:13cc:b0:5c2:68e9:8cf with SMTP id 4fb4d7f45d1cf-5c3dc7baefemr15736913a12.24.1726062701706; Wed, 11 Sep 2024 06:51:41 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:38 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Dongli Zhang , Aswin Unnikrishnan , Marcel Apfelbaum Subject: [PULL 05/18] pci: don't skip function 0 occupancy verification for devfn auto assign Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726066944317116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dongli Zhang When the devfn is already assigned in the command line, the do_pci_register_device() may verify if the function 0 is already occupied. However, when devfn < 0, the verification is skipped because it is part of the last "else if". For instance, suppose there is already a device at addr=3D00.00 of a port. -device pcie-root-port,bus=3Dpcie.0,chassis=3D115,id=3Dport01,addr=3D0e.00 \ -device virtio-net-pci,bus=3Dport01,id=3Dvnet01,addr=3D00.00 \ When 'addr' is specified for the 2nd device, the hotplug is denied. (qemu) device_add virtio-net-pci,bus=3Dport01,id=3Dvnet02,addr=3D01.00 Error: PCI: slot 0 function 0 already occupied by virtio-net-pci, new func = virtio-net-pci cannot be exposed to guest. When 'addr' is automatically assigned, the hotplug is not denied. This is because the verification is skipped. (qemu) device_add virtio-net-pci,bus=3Dport01,id=3Dvnet02 warning: PCI: slot 1 is not valid for virtio-net-pci, parent device only al= lows plugging into slot 0. Fix the issue by moving the verification into an independent 'if' statement. Fixes: 3f1e1478db2d ("enable multi-function hot-add") Reported-by: Aswin Unnikrishnan Signed-off-by: Dongli Zhang Message-Id: <20240708041056.54504-1-dongli.zhang@oracle.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index d2caf3ee8b..87da35ca9b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1181,14 +1181,15 @@ static PCIDevice *do_pci_register_device(PCIDevice = *pci_dev, PCI_SLOT(devfn), PCI_FUNC(devfn), name, bus->devices[devfn]->name, bus->devices[devfn]->qdev.id= ); return NULL; - } /* - * Populating function 0 triggers a scan from the guest that - * exposes other non-zero functions. Hence we need to ensure that - * function 0 wasn't added yet. - */ - else if (dev->hotplugged && - !pci_is_vf(pci_dev) && - pci_get_function_0(pci_dev)) { + } + + /* + * Populating function 0 triggers a scan from the guest that + * exposes other non-zero functions. Hence we need to ensure that + * function 0 wasn't added yet. + */ + if (dev->hotplugged && !pci_is_vf(pci_dev) && + pci_get_function_0(pci_dev)) { error_setg(errp, "PCI: slot %d function 0 already occupied by %s," " new func %s cannot be exposed to guest.", PCI_SLOT(pci_get_function_0(pci_dev)->devfn), --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065058; cv=none; d=zohomail.com; s=zohoarc; b=Ry6bV6+UZTnmlv78Rm6/uX3CLC5AdhZGe05SeLJJYJXWSgi5oqfaxxlvyxcpJIji9YFsQIGGERh0qfmsKjA60TOZjW8nCsBwfrZ8iaeYBWhJlADAgIQnfuoqHWOOIG2RCEX/kF98bLGLDXpy/Utu0JF56agpf4Cyp5MO5PYe1lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065058; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=iEUY6iNItmilx4GQ008agO3v3YGH5P6LxKz939t7m08=; b=AqadMQy8m0ERFSCu5NisultcZ6U92Emr94Fxy0ppzmx4qm633pNJ9dzjug3H68PEwpKg7RHSIGre0ncVDKBaKHikCo5zvHwTGuJu6j3Vy9oFSl5v1ELfpbqW3hZIZPfOlfpqIX13oObnb2NIlmNoNRlKDcanboESJ0zFNqD7MQE= 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 1726065058381904.838989176762; Wed, 11 Sep 2024 07:30:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOKD-0000Vd-7q; Wed, 11 Sep 2024 10:28:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJR-00079e-Ti for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJO-0003NK-3q for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:15 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-345-BgIOjzUWOwmXZs7R1SCXDA-1; Wed, 11 Sep 2024 09:51:47 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a870f3a65a0so490947966b.0 for ; Wed, 11 Sep 2024 06:51:47 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d2593dbb7sm616986366b.56.2024.09.11.06.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726064832; 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=iEUY6iNItmilx4GQ008agO3v3YGH5P6LxKz939t7m08=; b=K4bUneE59c19ooa5tkGnHmgw2y1zGKa6q6umzd/YW2L7qqaazPvTbwMD1AXdoSyRTnBFEG jlH0ZRMWv/QK2CpNugmNvrxhfHai7ev+MrVR+g4DECgF8+Vi3t17Fdk3IMpqgtGhLd9H6R mP1gKOVCpk2izKy3SJ0BG1xVqXK7GiE= X-MC-Unique: BgIOjzUWOwmXZs7R1SCXDA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062705; x=1726667505; 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:subject:date:message-id:reply-to; bh=iEUY6iNItmilx4GQ008agO3v3YGH5P6LxKz939t7m08=; b=tHxZcFXGiE7zWYXFZUFjCKqkzvDwoZeJhuJh3QXy51m0ysyfDV7SYPAJrK9AKh4Ae/ oS8mk0Dmd77cgcqcaaVAQqotkzqEnqc425yPCcV1ui1y4MXzeTCnYXpWj3f52i2RItJu IgYlAK0/6PCWx/1Ju8r4Y7GssDgF8A53MUKMOCaaRsHEGa9ol1mJzClhscAzy5/M3s+q 1pTTbzh7zv3b8OwM7+zn62AviZSU4w1g4D9N4It/OadbiFlofg2Ki/8Q7+AIM1sDfuak kzk4YaIyVkaW+MJbosN462ZCYracsnbSipJzJNI4E0CVwH7AXsEszZ0ukEvrhXnUHglf loWA== X-Gm-Message-State: AOJu0YyHv+kRkIJdNvB1CVapv4/zqeRYMxufEJTmCzuDGIqGgfMQNymu zlLDTEZrSbRskz84oxWrKPvKYljQ5yD9oM6i2Mp2c35JWZd1mVyopfvOunZyZCgc6YHX5sZywkQ a3Ww9lBRID8R9p9IGozyt/UkPDy/fi95oY0xL2hESehtg17nL7cuTNcm5YoYTy9YBwgxcjKjS1x YPuCpNO8NuLTEb7Cs/6K/s0j9+Azo2Eg== X-Received: by 2002:a17:906:794f:b0:a86:91c3:9517 with SMTP id a640c23a62f3a-a8ffab70902mr459445666b.35.1726062705417; Wed, 11 Sep 2024 06:51:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXPDKKnMF35RBQtFeyBFrrESbl4FumZQ7bj7lit8s9FtDwIrT3ZqdsFp8v83Z6DooXPauh/A== X-Received: by 2002:a17:906:794f:b0:a86:91c3:9517 with SMTP id a640c23a62f3a-a8ffab70902mr459442066b.35.1726062704829; Wed, 11 Sep 2024 06:51:44 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:41 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum Subject: [PULL 06/18] hw/pci/pci-hmp-cmds: Avoid displaying bogus size in 'info pci' Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065060062116600 From: Philippe Mathieu-Daud=C3=A9 When BAR aren't mapped, we get: (qemu) info pci Bus 0, device 0, function 0: Host bridge: PCI device dead:beef ... BAR4: 32 bit memory at 0xffffffffffffffff [0x00000ffe]. BAR5: I/O at 0xffffffffffffffff [0x0ffe]. Check the BAR is mapped comparing its address to PCI_BAR_UNMAPPED which is what the PCI layer uses for unmapped BARs. See pci_bar_address and pci_update_mappings implementations and in "hw/pci/pci.h": typedef struct PCIIORegion { pcibus_t addr; /* current PCI mapping address. -1 means not mapped */ #define PCI_BAR_UNMAPPED (~(pcibus_t)0) ... This improves the logging, not displaying bogus sizes: (qemu) info pci Bus 0, device 0, function 0: Host bridge: PCI device dead:beef ... BAR4: 32 bit memory (not mapped) BAR5: I/O (not mapped) Remove trailing dot which is not used in other commands format. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20240801131449.51328-1-philmd@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pci-hmp-cmds.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/pci/pci-hmp-cmds.c b/hw/pci/pci-hmp-cmds.c index b09fce9377..fdfe44435c 100644 --- a/hw/pci/pci-hmp-cmds.c +++ b/hw/pci/pci-hmp-cmds.c @@ -83,15 +83,25 @@ static void hmp_info_pci_device(Monitor *mon, const Pci= DeviceInfo *dev) monitor_printf(mon, " BAR%" PRId64 ": ", region->value->bar); =20 if (!strcmp(region->value->type, "io")) { - monitor_printf(mon, "I/O at 0x%04" PRIx64 - " [0x%04" PRIx64 "].\n", - addr, addr + size - 1); + if (addr !=3D PCI_BAR_UNMAPPED) { + monitor_printf(mon, "I/O at 0x%04" PRIx64 + " [0x%04" PRIx64 "]\n", + addr, addr + size - 1); + } else { + monitor_printf(mon, "I/O (not mapped)\n"); + } } else { - monitor_printf(mon, "%d bit%s memory at 0x%08" PRIx64 - " [0x%08" PRIx64 "].\n", - region->value->mem_type_64 ? 64 : 32, - region->value->prefetch ? " prefetchable" : "", - addr, addr + size - 1); + if (addr !=3D PCI_BAR_UNMAPPED) { + monitor_printf(mon, "%d bit%s memory at 0x%08" PRIx64 + " [0x%08" PRIx64 "]\n", + region->value->mem_type_64 ? 64 : 32, + region->value->prefetch ? " prefetchable" := "", + addr, addr + size - 1); + } else { + monitor_printf(mon, "%d bit%s memory (not mapped)\n", + region->value->mem_type_64 ? 64 : 32, + region->value->prefetch ? " prefetchable" := ""); + } } } =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065146; cv=none; d=zohomail.com; s=zohoarc; b=ivHUoGNBiCE38bnKb92cBL+XJhbVAGOe9mQ+A/s4+v5sIy2k/TtNpJheua7pykiG+6eHHuL/dcAyI+K/zP55cYDBx8Nu1EaQd+RUvF/pHmkOW5CCNPnYaezgRG7On7APToaIhbHNpgkX2c2SH/90g5HYJNihY/t/L8POYmJQEnc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065146; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9zYqBsPTLqrTzbWp9haBTVRFIhZalRfUREIb3ugShtk=; b=QPzzbJtSev0b5vriocq36blNHE83k3mSXd2UCAzGXAE0t0mKAQlXFCxr/8MckuU70gF87guX79F1B7EZUshz8YUT0OmrZP+rL9wlfJ6jJLxApXeWPnzMXcX7D5VnXToGZ08LgjprpB5JPz5pGx8kSL5+KUTC7alc1Sy6BBGkDBg= 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 1726065146023120.12413987467062; Wed, 11 Sep 2024 07:32:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOMQ-0003HC-0t; Wed, 11 Sep 2024 10:30:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOMJ-0002mo-Mj for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:30:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOMH-0003z7-Id for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:30:15 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-164-S1qeoSNsPQmPUueHa0qQHw-1; Wed, 11 Sep 2024 09:51:50 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a8a7463c3d0so428596866b.2 for ; Wed, 11 Sep 2024 06:51:49 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c62541sm621866966b.111.2024.09.11.06.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726065012; 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=9zYqBsPTLqrTzbWp9haBTVRFIhZalRfUREIb3ugShtk=; b=IIPwhmyMf1kwfeTvJpCfsdxz6ceQYAcGzlW0/nnblhtebE6IFN/GeXrXFmsMFj4vJl6CgQ JwwWpJGzCx8CfzVIeXvjEfoqtm9XlNonkLD4Y9hLbgWN+IaDn2FKMiLLgyehvuSUye0uAv gbT5H7uPQjRcZr/XnQEN4rQAf0so1lE= X-MC-Unique: S1qeoSNsPQmPUueHa0qQHw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062708; x=1726667508; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9zYqBsPTLqrTzbWp9haBTVRFIhZalRfUREIb3ugShtk=; b=ZAcjcVjv0HJSfq8L3ZLj2Ph+Ui21QvtgxrfuNzGsVHQP2KdJNdsoNSuG7dRu0AbGjW xDiRcMFvZBATsE80q3mUqST3AhAwNRQzaEjbTzYKiLf/SOKyrypzX+2bXArwTgW5MV1t NqnDnV9JQ9XCGGvVnKnq8OPvwb2QLJN8K0Qz9AJisoDpEVe5a5pxELopKGp6XkEX6q2Y Pj/NYgNB5NjIg4HbmpTpZtPEUbhoNooXlPRsHzh92UIlZq/Ygne/4Ntr7SzYVe+dmqRo MPbZdx0/gMTQ0IHq/Lu5if4deg88fs6lgKhmC4QPUVFlaY2vrpDZiTTOyaALiqfWCR+h f3yA== X-Gm-Message-State: AOJu0Yzfyf41rM1mspZ1ygvtxa7xmM2MHYBbCByK35E/Bjwkzd8LyfJW 2u74smDqlByZIM4rF8+sHcsLG0dd5vZxhsav6TykOboY1QcJrdxYCzzWnrPqt76GsfTwZi8dNL7 tGfArLO4iJJUJqCUZ2kX57ZEde7ozVhKZh0jUbeEJFr7pSYYW8wAvbdiHf0PoePp545Kowztz24 doCPKd3dCExtzhAGSjeGyZ7xT4TvzooA== X-Received: by 2002:a17:907:3d8e:b0:a8d:4e13:55f9 with SMTP id a640c23a62f3a-a8ffaae3670mr459512166b.19.1726062708365; Wed, 11 Sep 2024 06:51:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGXJxl0aTKQb2byWlm3XEdxeHepi5POGTMCrx84gqqyUSQ7HgXr1fjPY9AUOB0fBDYzlpIwmQ== X-Received: by 2002:a17:907:3d8e:b0:a8d:4e13:55f9 with SMTP id a640c23a62f3a-a8ffaae3670mr459508666b.19.1726062707830; Wed, 11 Sep 2024 06:51:47 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Wenyu Huang Subject: [PULL 07/18] virtio: rename virtio_split_packed_update_used_idx Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065146612116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Wenyu Huang virtio_split_packed_update_used_idx should be virtio_queue_split_update_used_idx like virtio_split_packed_update_used_idx. Signed-off-by: Wenyu Huang Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 42589adf2c..a26f18908e 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -3669,7 +3669,7 @@ static void virtio_queue_packed_update_used_idx(VirtI= ODevice *vdev, int n) return; } =20 -static void virtio_split_packed_update_used_idx(VirtIODevice *vdev, int n) +static void virtio_queue_split_update_used_idx(VirtIODevice *vdev, int n) { RCU_READ_LOCK_GUARD(); if (vdev->vq[n].vring.desc) { @@ -3682,7 +3682,7 @@ void virtio_queue_update_used_idx(VirtIODevice *vdev,= int n) if (virtio_vdev_has_feature(vdev, VIRTIO_F_RING_PACKED)) { return virtio_queue_packed_update_used_idx(vdev, n); } else { - return virtio_split_packed_update_used_idx(vdev, n); + return virtio_queue_split_update_used_idx(vdev, n); } } =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726067317; cv=none; d=zohomail.com; s=zohoarc; b=oFoe1X8QeHhKzyv1qtFtjjjgUXHwi2DzZHNDH4aMMknuSeTZn5sG2e/AztfC8PA5borJnec+U5BhrnL1+g3UOJMSmDDxJsuOBO7tBBTvsqThFWn9V6SmnbV/u7qcYy1utz86JlJt2+r6p1sl193QiD/dwRUl5YSE0VZjOcXUNjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726067317; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bY3kFhk2MQOhFrrXbGMngbSdwByo8f4uY8jy3ERVqew=; b=QflJWFIFh2/u221uksHk5U64Lm1P9aHv24vshYpb6LLPNdQ4hev/VbkS5KZcu6NyGU1z6mQ+m6opP2ZmBPDa5rLHTHR0Bl1FlXTJZIq7/JG29jigdyaBG326uagSG7/GmMjp+JjrSi5yoDVsiNwogboZTaBIJuDQWyRPWG/6Ou0= 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 1726067317037693.0463650521766; Wed, 11 Sep 2024 08:08:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOn7-0003ig-Ph; Wed, 11 Sep 2024 10:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhk-00078a-Ib for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOha-0007Dt-Sd for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:20 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-412-0xm-B_Y7OL--D-ct_F0bXg-1; Wed, 11 Sep 2024 09:51:54 -0400 Received: by mail-ed1-f72.google.com with SMTP id 4fb4d7f45d1cf-5c3c256e2a3so5362058a12.2 for ; Wed, 11 Sep 2024 06:51:53 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d258354d1sm620068366b.13.2024.09.11.06.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066332; 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=bY3kFhk2MQOhFrrXbGMngbSdwByo8f4uY8jy3ERVqew=; b=cZOl26mRMJ/eJnI/OdKQr8YFGRU5qnjDxfcT+ogVKaP8n49g7KY87qHCPmX1xUdZg/qZoq VB8Gx1bLhFl+p9sDGumKJIKmNkyd3QRi25OH7t0crXllFyWV11ZsMWjwpPOE80iDTFDPUH jG58bJvR4W5yoJk61kKdEm9S9dvVuBY= X-MC-Unique: 0xm-B_Y7OL--D-ct_F0bXg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062712; x=1726667512; 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:subject:date:message-id:reply-to; bh=bY3kFhk2MQOhFrrXbGMngbSdwByo8f4uY8jy3ERVqew=; b=LV4wkkVSb0zFluHNAqdsKi+C20owZuNSPTNQ1lOwXzxIIoW5kwuziqf5bePiK7j2Kq 5GgzQZr4zQxqqa4d6HSayU5DWWb0l8x15lVW1CvBDw4VZHrBv1ZI2OrIh1CZlLDkc3Q7 EICB+PzkrLt0LN0H9ggOo4zgVX50sfZddV1KHXQkXdkF2vNG8kG2PMM74sP3SU5Nwyum 26Uye73rt50oEXxdYdKlfJ9oY+mxfMKyBaKa05s6JtDfnr7+9WpiGMuDifPCZdQIZP0g sZldntAq431+uDy8+EMvvmbBpOFMxdL817fyHPoqns22958EPmltWF+L4gAEmu1puCsS zhQA== X-Gm-Message-State: AOJu0Yxi5QIl4oHEYG4SYqUBCRopbPgbqADNUlCjVDSvjNkwn3kzSzcy Nm7ssSuFdO7finMvAI6TEhvs3ck4R5o2RiGokLDQhDpizwnt50nL5hzh5+mOoJHG39lh1nXvuTY 2MAJTcqU1eWOcz5M38mZv8GDLAs79/98chx5q3IitlHiNTJdzDyjoho/u+HE3txKwb+K/dUPqwN djPBW7UYROUSAiDwBJjHmKwT2dKgS1KQ== X-Received: by 2002:a17:906:d54b:b0:a8c:d6a3:d03a with SMTP id a640c23a62f3a-a8ffab18781mr379087666b.21.1726062712056; Wed, 11 Sep 2024 06:51:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEdUTOIul3p3RXD60SbSrV4T0ZNZ8f38tSJB3JJikoRHl9kx7775iRWvtWUySz6TnMaK7nc1Q== X-Received: by 2002:a17:906:d54b:b0:a8c:d6a3:d03a with SMTP id a640c23a62f3a-a8ffab18781mr379083266b.21.1726062711359; Wed, 11 Sep 2024 06:51:51 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , =?utf-8?Q?Cl=C3=A9ment?= Mathieu--Drif , Yi Liu , Jason Wang , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 08/18] intel_iommu: Fix invalidation descriptor type field Message-ID: <663168943d3db6d9b51d3dfa0998848a6e6eda71.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726067318262116600 From: Zhenzhong Duan According to spec, invalidation descriptor type is 7bits which is concatenation of bits[11:9] and bits[3:0] of invalidation descriptor. Currently we only pick bits[3:0] as the invalidation type and treat bits[11:9] as reserved zero. This is not a problem for now as bits[11:9] is zero for all current invalidation types. But it will break if newer type occupies bits[11:9]. Fix it by taking bits[11:9] into type and make reserved bits check accurate. Suggested-by: Cl=C3=A9ment Mathieu--Drif Signed-off-by: Zhenzhong Duan Reviewed-by: Yi Liu Reviewed-by: Cl=C3=A9ment Mathieu--Drif Message-Id: <20240814071321.2621384-2-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 11 ++++++----- hw/i386/intel_iommu.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 5f32c36943..13d5d129ae 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -356,7 +356,8 @@ union VTDInvDesc { typedef union VTDInvDesc VTDInvDesc; =20 /* Masks for struct VTDInvDesc */ -#define VTD_INV_DESC_TYPE 0xf +#define VTD_INV_DESC_TYPE(val) ((((val) >> 5) & 0x70ULL) | \ + ((val) & 0xfULL)) #define VTD_INV_DESC_CC 0x1 /* Context-cache Invalidate De= sc */ #define VTD_INV_DESC_IOTLB 0x2 #define VTD_INV_DESC_DEVICE 0x3 @@ -372,7 +373,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_WAIT_IF (1ULL << 4) #define VTD_INV_DESC_WAIT_FN (1ULL << 6) #define VTD_INV_DESC_WAIT_DATA_SHIFT 32 -#define VTD_INV_DESC_WAIT_RSVD_LO 0Xffffff80ULL +#define VTD_INV_DESC_WAIT_RSVD_LO 0Xfffff180ULL #define VTD_INV_DESC_WAIT_RSVD_HI 3ULL =20 /* Masks for Context-cache Invalidation Descriptor */ @@ -383,7 +384,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_CC_DID(val) (((val) >> 16) & VTD_DOMAIN_ID_MAS= K) #define VTD_INV_DESC_CC_SID(val) (((val) >> 32) & 0xffffUL) #define VTD_INV_DESC_CC_FM(val) (((val) >> 48) & 3UL) -#define VTD_INV_DESC_CC_RSVD 0xfffc00000000ffc0ULL +#define VTD_INV_DESC_CC_RSVD 0xfffc00000000f1c0ULL =20 /* Masks for IOTLB Invalidate Descriptor */ #define VTD_INV_DESC_IOTLB_G (3ULL << 4) @@ -393,7 +394,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_IOTLB_DID(val) (((val) >> 16) & VTD_DOMAIN_ID_MAS= K) #define VTD_INV_DESC_IOTLB_ADDR(val) ((val) & ~0xfffULL) #define VTD_INV_DESC_IOTLB_AM(val) ((val) & 0x3fULL) -#define VTD_INV_DESC_IOTLB_RSVD_LO 0xffffffff0000ff00ULL +#define VTD_INV_DESC_IOTLB_RSVD_LO 0xffffffff0000f100ULL #define VTD_INV_DESC_IOTLB_RSVD_HI 0xf80ULL #define VTD_INV_DESC_IOTLB_PASID_PASID (2ULL << 4) #define VTD_INV_DESC_IOTLB_PASID_PAGE (3ULL << 4) @@ -406,7 +407,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_DEVICE_IOTLB_SIZE(val) ((val) & 0x1) #define VTD_INV_DESC_DEVICE_IOTLB_SID(val) (((val) >> 32) & 0xFFFFULL) #define VTD_INV_DESC_DEVICE_IOTLB_RSVD_HI 0xffeULL -#define VTD_INV_DESC_DEVICE_IOTLB_RSVD_LO 0xffff0000ffe0fff8 +#define VTD_INV_DESC_DEVICE_IOTLB_RSVD_LO 0xffff0000ffe0f1f0 =20 /* Rsvd field masks for spte */ #define VTD_SPTE_SNP 0x800ULL diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 16d2885fcc..68cb72a481 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2744,7 +2744,7 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) return false; } =20 - desc_type =3D inv_desc.lo & VTD_INV_DESC_TYPE; + desc_type =3D VTD_INV_DESC_TYPE(inv_desc.lo); /* FIXME: should update at first or at last? */ s->iq_last_desc_type =3D desc_type; =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726066850; cv=none; d=zohomail.com; s=zohoarc; b=hQUbL41TEMv5N/eZ0tT6eTHCljRtXRv857rx+ikM7mDzaEB8mhrfhHYdTybWfdTM1krzDxR9Rho8Box99zLVHlqEaj8mOvui68hA7SDwjicweO9YTTlqbfxe1Xk9h2kT28YtCHQ5s6MT/Z2GZlSiRNhm7t9jkGDgQGgAd2XjzzE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726066850; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3Zv+AcVES8CQaHrznfI8esSyWVUaPQBotZar40Wzxw0=; b=AO78jMj50BpAeeCxd+xfAML/5dU/phB8F0tzaL8Kj+sc8ovVISctAvOtnc5LhSBjF89oT74W3gJFd6zkIwLQkFGCEJi21B7aF6EnAKfHR3cls7676/ep2istgJJ6fGkjZ3AeiPOOaNZ/MkZ4VWlAa5YJUvOW49ZlrRJFyEUX+es= 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 1726066850160377.25549676903563; Wed, 11 Sep 2024 08:00:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOnZ-00066F-Ke; Wed, 11 Sep 2024 10:58:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhn-0007Kz-Sc for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhi-0007EO-4A for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:25 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-L2d2ENr7OYmhmroUZu_fjw-1; Wed, 11 Sep 2024 09:51:56 -0400 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-a868b6d6882so96312266b.1 for ; Wed, 11 Sep 2024 06:51:56 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c82eaesm619003566b.118.2024.09.11.06.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066336; 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=3Zv+AcVES8CQaHrznfI8esSyWVUaPQBotZar40Wzxw0=; b=K5Xwx0VyTDzfewXyWrnj+5dPpjk0I8w65d4moWpE3UW8Vz31QxrxdfNGzdKege/393IQ/7 K9Apx9h/+VKfyzRNioBd48LJShneBouA2jSiznmD4EXsUYV+KZyaKFNINtkrTVPFKVNG/S LEGcb61N6B8hCoIuzfNFNkfsLoAJaNk= X-MC-Unique: L2d2ENr7OYmhmroUZu_fjw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062715; x=1726667515; 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:subject:date:message-id:reply-to; bh=3Zv+AcVES8CQaHrznfI8esSyWVUaPQBotZar40Wzxw0=; b=xQfMshW0+XC+exFHH4UuMgmDJ1G+xZUNj6iTKHFK2AM5GNMV4g/B00mPma9GeXLZkx yW/1xaYkXKO3kMOjZ4cYkUb+YLM8oUNek54LyhVGnrTO9rRu9tkY/22PR1tBTvv3TZO8 wLYs/fr/0usNEHx8MjO+ovIapVSkdRqehlO4nVGy/rnX09UIWEEA0YqfJ74ILmEXUwm9 GEGRt913ZNjyq5CP6KRIDQobo/mbZW4/HeGyML7Psb0LJUMc4PgtF0EedJKyUJFzcEGc 4r/0BETJ7fs42B/lFCWcUNG2grQHAHHF/zNPppL0lhx6y/J/PQoBe4F6Pt1NhAW/iOzx DpGA== X-Gm-Message-State: AOJu0Yysixc2YAmn+DPr6VPnLldPG5qTpwJMNmsG44w8ezxZb2y6zP67 OVDioBr3Bz6y/PSunsl7rwqflAv4Gblvm+npn8/84gFDd1wKx7BQmWLQdmyJjgp3Xdy3nJNfirc g39lZsPTJUUe5ld2jyf7cNyBkmMbaPjZEQBnmAVjKQklhaVRswphv1g0YwqfNcN+sxa2lZs1n1O phVxwYx7HUg7A8wBI705KfT8GRvUZI1w== X-Received: by 2002:a17:907:7f16:b0:a8a:6db7:6659 with SMTP id a640c23a62f3a-a8ffab6cbbfmr442551866b.9.1726062715335; Wed, 11 Sep 2024 06:51:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQ563Z43scq9UThhGmH4KPDKOFBk+Lb1vsH7g6KkuYMmRsuy+k/OUdBc9E6TCx/appZJrk3Q== X-Received: by 2002:a17:907:7f16:b0:a8a:6db7:6659 with SMTP id a640c23a62f3a-a8ffab6cbbfmr442545666b.9.1726062714737; Wed, 11 Sep 2024 06:51:54 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Yi Liu , =?utf-8?Q?Cl=C3=A9ment?= Mathieu--Drif , Jason Wang , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 09/18] intel_iommu: Make PASID-cache and PIOTLB type invalid in legacy mode Message-ID: <3b52cea829d873706ff86913ae99b4bd621c20e6.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726066851705116600 From: Zhenzhong Duan In vtd_process_inv_desc(), VTD_INV_DESC_PC and VTD_INV_DESC_PIOTLB are bypassed without scalable mode check. These two types are not valid in legacy mode and we should report error. Fixes: 4a4f219e8a10 ("intel_iommu: add scalable-mode option to make scalabl= e mode work") Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Cl=C3=A9ment Mathieu--Drif Reviewed-by: Yi Liu Message-Id: <20240814071321.2621384-3-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 68cb72a481..90cd4e5044 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2763,17 +2763,6 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) } break; =20 - /* - * TODO: the entity of below two cases will be implemented in future s= eries. - * To make guest (which integrates scalable mode support patch set in - * iommu driver) work, just return true is enough so far. - */ - case VTD_INV_DESC_PC: - break; - - case VTD_INV_DESC_PIOTLB: - break; - case VTD_INV_DESC_WAIT: trace_vtd_inv_desc("wait", inv_desc.hi, inv_desc.lo); if (!vtd_process_wait_desc(s, &inv_desc)) { @@ -2795,6 +2784,17 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) } break; =20 + /* + * TODO: the entity of below two cases will be implemented in future s= eries. + * To make guest (which integrates scalable mode support patch set in + * iommu driver) work, just return true is enough so far. + */ + case VTD_INV_DESC_PC: + case VTD_INV_DESC_PIOTLB: + if (s->scalable_mode) { + break; + } + /* fallthrough */ default: error_report_once("%s: invalid inv desc: hi=3D%"PRIx64", lo=3D%"PR= Ix64 " (unknown type)", __func__, inv_desc.hi, --=20 MST From nobody Sun Nov 24 05:35:22 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=1726067342; cv=none; d=zohomail.com; s=zohoarc; b=Pva4jIMuvxPnjsbwx7lYCdBhr0C0cjKO9uzOM0362hN5a7Vc7rlWFUm3qmOKn9pj8TJVneW1qPuA40FsQQS6rm3IqK9SoFTOrtyQ2D48GVf5NlLAzF/+TtcXzSQiHGiF1+WXs280eajs1teg1Mwqkx9LJ+9lRFMO98cvw8Bxduo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726067342; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8ycrQIYgW1gN05eLNxaUg6SdKNvOfcU2FQLbxdjG4Rw=; b=P5wZXUGgAD1xHuhUeKLkPIh94mUnxO2iKLIFWzTZCAe/eJD4uPgor6haL8Z2GzP+OgBYa2JID9oY4lInbvBR2FcAqgCvAJUg8IAC4O5GTpNszQv1VkTiheummEzVdHmv6BZ+65JL9jgNde95DD8EEmcm3EDnT63b3ZLeFkyRKv0= 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 1726067342945309.9408547281748; Wed, 11 Sep 2024 08:09:02 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOoH-0000Oj-9w; Wed, 11 Sep 2024 10:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhn-0007KT-NZ for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:30 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhi-0007EU-Uv for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:25 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-147-5mNS_49oPDCgvbWvTk6fXg-1; Wed, 11 Sep 2024 09:52:00 -0400 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-5c3c256e2a3so5362107a12.2 for ; Wed, 11 Sep 2024 06:52:00 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd8cdebsm5375494a12.95.2024.09.11.06.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:51:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066338; 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=8ycrQIYgW1gN05eLNxaUg6SdKNvOfcU2FQLbxdjG4Rw=; b=BcxKmx2N0Xbp0chQzZaHeaWPbpJqIxPpEvJsWxYX+qYx9xreD7KnndhcDa6pQu1XAg5beI HhwSbnoLAu0vwk6kNdsLd//+1Gf5xy26t59ezRlzqYCvCnmUjTDPlW3x4EPq2kvdzF4Blk wCJPsz8HrJW/UJuaKWCrjlWnHJj8v2g= X-MC-Unique: 5mNS_49oPDCgvbWvTk6fXg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062719; x=1726667519; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8ycrQIYgW1gN05eLNxaUg6SdKNvOfcU2FQLbxdjG4Rw=; b=PZpqkqMvVyvRjbl/0ov+f7XZFWncAallft1XNd6a1nwsoH+EqBMPe3Q1xh1DApEyff XEbvmUGyU9VII9Cy2tb1m+EdRuCJe3I8GRxMj4oCOqNZKyqUTgxv2quncwJ+eI2MkB1U JKEE5Aq8jXJOAmpbSRQ/FvfKbZiUnORbFYq7J7TN7Endg1puTxHc3pFzbuMbrUOrPZ9z kB/FLwf+P0hEyA0ibknTWzd+6MSzYacVO3zjwb+iyMlWtsLUVGlRrYAE/H6AHzRvuaMh KWkk7rXNAVjNvEbodHso5ocwGGX+exUIyfkpVWL1fDOPHMz1jdYDqZ525spyn5OVQ1Pl OxIw== X-Gm-Message-State: AOJu0Yz+mB92nwhpP1/qKOWfiKHnZkEKIlaKRlcevhv8ihoEMIK4aFEj yaOitnpvxiHWvMpvPijuEfoNk83+yi+nNINTo07EBzCqd6n7q5RRXWe/4L4o2dikS39/m/ppfQh 9N+uXv1zNNeAIo+ohMZ1J4jP/hhPOED4xfOd6PsGd9wElT/eHOtd2dlVmE6Icx3C2O2nM1mzoiO HDSkogVK7Czy8v/raG6+gKfNJy2GBj5w== X-Received: by 2002:a05:6402:2551:b0:5c2:769a:df79 with SMTP id 4fb4d7f45d1cf-5c3dc7c6c83mr12618121a12.32.1726062718815; Wed, 11 Sep 2024 06:51:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGa1U2meNUnhGlkhb8QGTZBePl0Blwq+nl0sH21K51an8Q2T6CcuWRGWK3mDSR+gMZEoY/yrA== X-Received: by 2002:a05:6402:2551:b0:5c2:769a:df79 with SMTP id 4fb4d7f45d1cf-5c3dc7c6c83mr12618092a12.32.1726062718157; Wed, 11 Sep 2024 06:51:58 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ricardo Ribalda , Igor Mammedov , Ani Sinha Subject: [PULL 10/18] tests/acpi: pc: allow DSDT acpi table changes Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726067344288116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ricardo Ribalda Signed-off-by: Ricardo Ribalda Message-Id: <20240814115736.1580337-2-ribalda@chromium.org> Reviewed-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index dfb8523c8b..f81f4e2469 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,16 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/pc/DSDT", +"tests/data/acpi/x86/pc/DSDT.acpierst", +"tests/data/acpi/x86/pc/DSDT.acpihmat", +"tests/data/acpi/x86/pc/DSDT.bridge", +"tests/data/acpi/x86/pc/DSDT.cphp", +"tests/data/acpi/x86/pc/DSDT.dimmpxm", +"tests/data/acpi/x86/pc/DSDT.hpbridge", +"tests/data/acpi/x86/pc/DSDT.hpbrroot", +"tests/data/acpi/x86/pc/DSDT.ipmikcs", +"tests/data/acpi/x86/pc/DSDT.memhp", +"tests/data/acpi/x86/pc/DSDT.nohpet", +"tests/data/acpi/x86/pc/DSDT.numamem", +"tests/data/acpi/x86/pc/DSDT.roothp", +"tests/data/acpi/x86/q35/DSDT.cxl", +"tests/data/acpi/x86/q35/DSDT.viot", --=20 MST From nobody Sun Nov 24 05:35:22 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=1726068309; cv=none; d=zohomail.com; s=zohoarc; b=A0xlcvGSnnHzE1FQrfEdZM/4+78NTmec3N0XClsMAv5i359IinMgz+gLSu64PE4ugKIJonQDH6dTZ8lL9W1zKn7AOg6j7HUdNn7NTOPeqmbSpJvK/3Q2sa6QyaHWdcp9cQ4pW1J8rlTFG+OR/7ZlRdbULoejx31FdpK7CrhVe3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726068309; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=21NUaZFIhKQyua/2/GS7TeIRDshB3RMyrgRirFWhK1A=; b=HjzHBYpPLKE7EFUCatGlIZ8vJWZOnyjZrrAwqRDoWsyho3L3QQop6bxWLMt7VgJtVHRiA+csp5g0BcTouTvWUDwAmR2zFBNsozRD19TV9yP/HXsz86vE3WW9U5CgnRtVdztFqvAukc4o3DjeWkDdS/5Jow3tby6PBWOgVe5L57s= 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 1726068309741707.9837943289475; Wed, 11 Sep 2024 08:25:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOlE-00043C-Kg; Wed, 11 Sep 2024 10:56:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhn-0007L8-U0 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOhk-0007EZ-4b for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:52:26 -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_256_GCM_SHA384) id us-mta-581-oxgrtz_VOhSIef3AGv6bXg-1; Wed, 11 Sep 2024 09:52:04 -0400 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-374c960ee7aso4965221f8f.3 for ; Wed, 11 Sep 2024 06:52:03 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d2598b85bsm613363966b.77.2024.09.11.06.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066341; 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=21NUaZFIhKQyua/2/GS7TeIRDshB3RMyrgRirFWhK1A=; b=AbnWMPuLXPFNq6bNiaEZ2hIAf026U5DtimHGNHQ2YTZNIS/ADur7WbGQyH7RB3SsVCK9Vo 17OpJGyKensvSgFlRDVYVA5njXBKc/avh4/dMU8NPqm6S2XD9BJar8IX3s4D0WB+bDckup /jUxUWda9QwBSEfC3Gbh0MnqjXaDIe0= X-MC-Unique: oxgrtz_VOhSIef3AGv6bXg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062722; x=1726667522; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=21NUaZFIhKQyua/2/GS7TeIRDshB3RMyrgRirFWhK1A=; b=Ir7FvGQvDvLpQEa478T4thqzNbmTr9zrUK9p0ybPJIC40ytDA6bIUHBMHpfGOQregM Yu8JLjy0ykarwD0oNJi4dtqHZrghg70XNhdNAEDUu+pdmQYDIare4L7gFBeJ1xka5KCx E0ncf8S83xaJzkv0V1oO+v1pRd2tUqyHlC10gif5az00QJRYDa71apPhQqjWTBkW8NvV ozd0E0EgKodvN/jALr2mpELKZ3RKEhhho3BlMePWIqRQInM/lLEqUNaPgbtTQ681keS9 DJ4pUNBltsblJ9yXl3DRhT8oamjCT7wqkb4OspAQqFdS15rg8Jgovl2AO/3BS67fvK1e bNEw== X-Gm-Message-State: AOJu0YxXFBsJkZq98bVhcwtdxn7phtqDh93VBXjCCXNXpc37wvl9GTY+ 7kvw87v1acIbuIw4pdW6j5NVdI/AQLZWS/oM6tvPEv1Fr3pf2oeQoT6oL+MVtVdmvJzTo4uiI9m dgtjmFVatP4NuocTDva85jPnuQ049Vs/6HNH30wJmIu40DC9pTtSJDo5YuZsMuFhur0I8kO80Ok tHadHI0EE6PhRHB0OcXDIQ3pxT/y80kQ== X-Received: by 2002:adf:fa0e:0:b0:374:c1c5:43ca with SMTP id ffacd0b85a97d-378922b76a7mr11326639f8f.32.1726062722297; Wed, 11 Sep 2024 06:52:02 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgJ9pcGrlZ32rWOY4HYbjerStdbxUQoPUG/5a/myHUXn/GwQj1W6gKLd0zWa/Et38nB572FA== X-Received: by 2002:adf:fa0e:0:b0:374:c1c5:43ca with SMTP id ffacd0b85a97d-378922b76a7mr11326597f8f.32.1726062721645; Wed, 11 Sep 2024 06:52:01 -0700 (PDT) Date: Wed, 11 Sep 2024 09:51:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ricardo Ribalda , Igor Mammedov , Richard Henderson , Ani Sinha , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 11/18] hw/i386/acpi-build: Return a pre-computed _PRT table Message-ID: <99cb2c6c7b3674359c61a40fb17a75516b8e159d.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726068311297116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ricardo Ribalda When qemu runs without kvm acceleration the ACPI executions take a great amount of time. If they take more than the default time (30sec), the ACPI calls fail and the system might not behave correctly. Now the _PRT table is computed on the fly. We can drastically reduce the execution of the _PRT method if we return a pre-computed table. Without this patch: [ 51.343484] ACPI Error: Aborting method \_SB.PCI0._PRT due to previous e= rror (AE_AML_LOOP_TIMEOUT) (20230628/psparse-529) [ 51.527032] ACPI Error: Method execution failed \_SB.PCI0._PRT due to pr= evious error (AE_AML_LOOP_TIMEOUT) (20230628/uteval-68) [ 51.530049] virtio-pci 0000:00:02.0: can't derive routing for PCI INT A [ 51.530797] virtio-pci 0000:00:02.0: PCI INT A: no GSI [ 81.922901] ACPI Error: Aborting method \_SB.PCI0._PRT due to previous e= rror (AE_AML_LOOP_TIMEOUT) (20230628/psparse-529) [ 82.103534] ACPI Error: Method execution failed \_SB.PCI0._PRT due to pr= evious error (AE_AML_LOOP_TIMEOUT) (20230628/uteval-68) [ 82.106088] virtio-pci 0000:00:04.0: can't derive routing for PCI INT A [ 82.106761] virtio-pci 0000:00:04.0: PCI INT A: no GSI [ 112.192568] ACPI Error: Aborting method \_SB.PCI0._PRT due to previous e= rror (AE_AML_LOOP_TIMEOUT) (20230628/psparse-529) [ 112.486687] ACPI Error: Method execution failed \_SB.PCI0._PRT due to pr= evious error (AE_AML_LOOP_TIMEOUT) (20230628/uteval-68) [ 112.489554] virtio-pci 0000:00:05.0: can't derive routing for PCI INT A [ 112.490027] virtio-pci 0000:00:05.0: PCI INT A: no GSI [ 142.559448] ACPI Error: Aborting method \_SB.PCI0._PRT due to previous e= rror (AE_AML_LOOP_TIMEOUT) (20230628/psparse-529) [ 142.718596] ACPI Error: Method execution failed \_SB.PCI0._PRT due to pr= evious error (AE_AML_LOOP_TIMEOUT) (20230628/uteval-68) [ 142.722889] virtio-pci 0000:00:06.0: can't derive routing for PCI INT A [ 142.724578] virtio-pci 0000:00:06.0: PCI INT A: no GSI With this patch: [ 22.938076] ACPI: \_SB_.LNKB: Enabled at IRQ 10 [ 24.214002] ACPI: \_SB_.LNKD: Enabled at IRQ 11 [ 25.465170] ACPI: \_SB_.LNKA: Enabled at IRQ 10 [ 27.944920] ACPI: \_SB_.LNKC: Enabled at IRQ 11 ACPI disassembly: Scope (PCI0) { Method (_PRT, 0, NotSerialized) // _PRT: PCI Routing Table { Return (Package (0x80) { Package (0x04) { 0xFFFF, Zero, LNKD, Zero }, Package (0x04) { 0xFFFF, One, LNKA, Zero }, Package (0x04) { 0xFFFF, 0x02, LNKB, Zero }, Package (0x04) { 0xFFFF, 0x03, LNKC, Zero }, Package (0x04) { 0x0001FFFF, Zero, LNKS, Zero }, Context: https://lore.kernel.org/virtualization/20240417145544.38d7b482@ima= mmedo.users.ipa.redhat.com/T/#t Signed-off-by: Ricardo Ribalda Reviewed-by: Igor Mammedov Reviewed-by: Richard Henderson Message-Id: <20240814115736.1580337-3-ribalda@chromium.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 118 ++++++++----------------------------------- 1 file changed, 21 insertions(+), 97 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 5d4bd2b710..4967aa7459 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -724,120 +724,44 @@ static Aml *aml_pci_pdsm(void) return method; } =20 -/** - * build_prt_entry: - * @link_name: link name for PCI route entry - * - * build AML package containing a PCI route entry for @link_name - */ -static Aml *build_prt_entry(const char *link_name) -{ - Aml *a_zero =3D aml_int(0); - Aml *pkg =3D aml_package(4); - aml_append(pkg, a_zero); - aml_append(pkg, a_zero); - aml_append(pkg, aml_name("%s", link_name)); - aml_append(pkg, a_zero); - return pkg; -} - /* - * initialize_route - Initialize the interrupt routing rule - * through a specific LINK: - * if (lnk_idx =3D=3D idx) - * route using link 'link_name' - */ -static Aml *initialize_route(Aml *route, const char *link_name, - Aml *lnk_idx, int idx) -{ - Aml *if_ctx =3D aml_if(aml_equal(lnk_idx, aml_int(idx))); - Aml *pkg =3D build_prt_entry(link_name); - - aml_append(if_ctx, aml_store(pkg, route)); - - return if_ctx; -} - -/* - * build_prt - Define interrupt rounting rules + * build_prt - Define interrupt routing rules * * Returns an array of 128 routes, one for each device, * based on device location. * The main goal is to equally distribute the interrupts * over the 4 existing ACPI links (works only for i440fx). - * The hash function is (slot + pin) & 3 -> "LNK[D|A|B|C]". + * The hash function is: (slot + pin) & 3 -> "LNK[D|A|B|C]". * */ static Aml *build_prt(bool is_pci0_prt) { - Aml *method, *while_ctx, *pin, *res; + const int nroutes =3D 128; + Aml *rt_pkg, *method; + int pin; =20 method =3D aml_method("_PRT", 0, AML_NOTSERIALIZED); - res =3D aml_local(0); - pin =3D aml_local(1); - aml_append(method, aml_store(aml_package(128), res)); - aml_append(method, aml_store(aml_int(0), pin)); + rt_pkg =3D aml_varpackage(nroutes); =20 - /* while (pin < 128) */ - while_ctx =3D aml_while(aml_lless(pin, aml_int(128))); - { - Aml *slot =3D aml_local(2); - Aml *lnk_idx =3D aml_local(3); - Aml *route =3D aml_local(4); + for (pin =3D 0; pin < nroutes; pin++) { + Aml *pkg =3D aml_package(4); + int slot =3D pin >> 2; =20 - /* slot =3D pin >> 2 */ - aml_append(while_ctx, - aml_store(aml_shiftright(pin, aml_int(2), NULL), slot)); - /* lnk_idx =3D (slot + pin) & 3 */ - aml_append(while_ctx, - aml_store(aml_and(aml_add(pin, slot, NULL), aml_int(3), NULL), - lnk_idx)); - - /* route[2] =3D "LNK[D|A|B|C]", selection based on pin % 3 */ - aml_append(while_ctx, initialize_route(route, "LNKD", lnk_idx, 0)); - if (is_pci0_prt) { - Aml *if_device_1, *if_pin_4, *else_pin_4; - - /* device 1 is the power-management device, needs SCI */ - if_device_1 =3D aml_if(aml_equal(lnk_idx, aml_int(1))); - { - if_pin_4 =3D aml_if(aml_equal(pin, aml_int(4))); - { - aml_append(if_pin_4, - aml_store(build_prt_entry("LNKS"), route)); - } - aml_append(if_device_1, if_pin_4); - else_pin_4 =3D aml_else(); - { - aml_append(else_pin_4, - aml_store(build_prt_entry("LNKA"), route)); - } - aml_append(if_device_1, else_pin_4); - } - aml_append(while_ctx, if_device_1); + aml_append(pkg, aml_int((slot << 16) | 0xFFFF)); + aml_append(pkg, aml_int(pin & 3)); + /* device 1 is the power-management device, needs SCI */ + if (is_pci0_prt && pin =3D=3D 4) { + aml_append(pkg, aml_name("%s", "LNKS")); } else { - aml_append(while_ctx, initialize_route(route, "LNKA", lnk_idx,= 1)); + static const char link_name[][5] =3D {"LNKD", "LNKA", "LNKB", = "LNKC"}; + int hash =3D (slot + pin) & 3; + aml_append(pkg, aml_name("%s", link_name[hash])); } - aml_append(while_ctx, initialize_route(route, "LNKB", lnk_idx, 2)); - aml_append(while_ctx, initialize_route(route, "LNKC", lnk_idx, 3)); - - /* route[0] =3D 0x[slot]FFFF */ - aml_append(while_ctx, - aml_store(aml_or(aml_shiftleft(slot, aml_int(16)), aml_int(0xF= FFF), - NULL), - aml_index(route, aml_int(0)))); - /* route[1] =3D pin & 3 */ - aml_append(while_ctx, - aml_store(aml_and(pin, aml_int(3), NULL), - aml_index(route, aml_int(1)))); - /* res[pin] =3D route */ - aml_append(while_ctx, aml_store(route, aml_index(res, pin))); - /* pin++ */ - aml_append(while_ctx, aml_increment(pin)); + aml_append(pkg, aml_int(0)); + aml_append(rt_pkg, pkg); } - aml_append(method, while_ctx); - /* return res*/ - aml_append(method, aml_return(res)); + + aml_append(method, aml_return(rt_pkg)); =20 return method; } --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065151; cv=none; d=zohomail.com; s=zohoarc; b=kr+q8h6Z8N94gygERm62Pisa9LFUGLMMBpxvPuMlLFcEMjT7GmusXCXiz+HEsxE5fBa4FhsflzW8fquuLCwFgUc4GXSazlr6/k9DzKmBgLOYtdL3+VYYWWbaROXpgQPNfOjp2lft0/csh5eVO1IxP5/rys2rOf1Nw9xxIscISZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065151; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MWvinVVNh5bzHESG2Go2I3vqMmFKIn5JdAQAKvb4He4=; b=HeK2uBBgpL9cQPYEDn7iGnWYyUwxyE0q7i1aLVuvkGpj1FrOzyt+2R8vXAOYwniM4Bdx8+oq7KAwqW9eoSoriQa3Mho6yDuHl5jk5lstMmYTsbYNI8myiZC26+I8Fd+ymBE9Jb3ebAMSBWZfMQiCsqv+zUDraNxsaPUpR//bFo8= 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 1726065151819556.5546861335462; Wed, 11 Sep 2024 07:32:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soONQ-0000ER-VT; Wed, 11 Sep 2024 10:31:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soON7-0007YX-EO for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:31:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soON3-00047N-Of for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:31:05 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-670-8lxJOfJCO1iE-lkZMGJNCA-1; Wed, 11 Sep 2024 09:52:08 -0400 Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c40e867910so227840a12.2 for ; Wed, 11 Sep 2024 06:52:08 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd467a7sm5368254a12.28.2024.09.11.06.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726065060; 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=MWvinVVNh5bzHESG2Go2I3vqMmFKIn5JdAQAKvb4He4=; b=B+GidpO9I3A/N9TW1NzvHZKeOsdycInjbxUOT7RjFSzb2hp1/tGKL+2NIo9Jdg4vuIsANx wIF44Wf56Cal5HJuVAnUEwp9Qwd7dn/3bz9R9sKf1kTKeqmjfLp2iYs/yFCR+sGYN2/hZy SD5Jg/uqOGZGug6U5/hNBhKYeX5D0aM= X-MC-Unique: 8lxJOfJCO1iE-lkZMGJNCA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062727; x=1726667527; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MWvinVVNh5bzHESG2Go2I3vqMmFKIn5JdAQAKvb4He4=; b=Yx+qLSYD+/Iq6KLeb3ph24Ohuxj3TMk9+AtNXRX+omEYvGjjTiG8cby+9DtqrkdZ+g i6Z/EdQylJ0kg+AiHPGVYNbEk47AOwb3kPa+SXDue7ZquGsvI4Z2Cxk2YXsj4zvRLZnk r4ZSMvflnsBRvPfop9yJf99v6K5IuPpYnOAS0ZTKMEQzqOhAyONafGT42hPjyjh7Gav1 Y9LOap2Gov6jM6eDuGhT3utRE2YkuZI1oql6Nn2p/sAno2w0CV7b+47q7CvdJ7Tn2Xx3 8znmkiY0YEB9dZXGQwilKM4/HguJHmYnjdX/BeqPV38KsrhM3DCU/QYTYwH7We2emdRP MH+A== X-Gm-Message-State: AOJu0YyauB9y2KeX2+S264l3bSMIrLrNbMmHF90kxonYau+cH/HsyKPT sAhprBA9dMRPDuAnBPFMQt46e8r8Gd0cYCnTZGZ8cKsnBkHQ7qGpoeGedLWNQ3HOWunnE9Y96r2 1vucv1eosAfIy27gv23vTCwsLbg5weImwaeRNY7PeiRkNl9C78XzF7jedqfHG0a2Pahmnn3XhyM LT/NuPKXoBoC1fazOHUY50R3X0s6uLKQ== X-Received: by 2002:a05:6402:34c3:b0:5c2:58fe:9304 with SMTP id 4fb4d7f45d1cf-5c3dc77b0a4mr18389128a12.1.1726062726202; Wed, 11 Sep 2024 06:52:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFbF0tqpV83JVygqv7GTdJvqukQXRqCbIqG6bJ3IQnJGPxf1d8iuoEKKj54aizkOPuIHsfAqw== X-Received: by 2002:a05:6402:34c3:b0:5c2:58fe:9304 with SMTP id 4fb4d7f45d1cf-5c3dc77b0a4mr18389045a12.1.1726062725200; Wed, 11 Sep 2024 06:52:05 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:01 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Ricardo Ribalda , Igor Mammedov , Ani Sinha Subject: [PULL 12/18] tests/acpi: pc: update golden masters for DSDT Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065152680116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ricardo Ribalda Signed-off-by: Ricardo Ribalda Message-Id: <20240814115736.1580337-4-ribalda@chromium.org> Acked-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 15 --------------- tests/data/acpi/x86/pc/DSDT | Bin 6830 -> 8527 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 6741 -> 8438 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 8155 -> 9852 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 13701 -> 15398 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 7294 -> 8991 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 8484 -> 10181 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 6781 -> 8478 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 3337 -> 5034 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 6902 -> 8599 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 8189 -> 9886 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 6688 -> 8385 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 6836 -> 8533 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 10623 -> 12320 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 9714 -> 13148 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 9464 -> 14615 bytes 16 files changed, 15 deletions(-) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios= -tables-test-allowed-diff.h index f81f4e2469..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,16 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/x86/pc/DSDT", -"tests/data/acpi/x86/pc/DSDT.acpierst", -"tests/data/acpi/x86/pc/DSDT.acpihmat", -"tests/data/acpi/x86/pc/DSDT.bridge", -"tests/data/acpi/x86/pc/DSDT.cphp", -"tests/data/acpi/x86/pc/DSDT.dimmpxm", -"tests/data/acpi/x86/pc/DSDT.hpbridge", -"tests/data/acpi/x86/pc/DSDT.hpbrroot", -"tests/data/acpi/x86/pc/DSDT.ipmikcs", -"tests/data/acpi/x86/pc/DSDT.memhp", -"tests/data/acpi/x86/pc/DSDT.nohpet", -"tests/data/acpi/x86/pc/DSDT.numamem", -"tests/data/acpi/x86/pc/DSDT.roothp", -"tests/data/acpi/x86/q35/DSDT.cxl", -"tests/data/acpi/x86/q35/DSDT.viot", diff --git a/tests/data/acpi/x86/pc/DSDT b/tests/data/acpi/x86/pc/DSDT index c93ad6b7f83a168a1833d7dba1112dd2ab8a431f..92225236e717b2e522a2ee00492= fb0ded418dc7b 100644 GIT binary patch delta 1914 zcmY+_OODep0DxgPNnd%jP12_CiUT0A;Q&p;V$`UN=3DxkV3oPpV!ldxiqgg66h&cP{+ zY{yalUETPX{l!W9^Znl{tnc;9$2UR@KK}~edh+S}<6b@H&Fk~!>0R;R_3`}aMf}K{ zui>{W3L>RMbGz2UejYTp>se&6{yy}Y+qH57zqws6B1?i;se#bVy&LJO5?N}mneO6- zQkb-ECwnHXx{*%ZT+gO;n|ii9w{v|{x-IyobW?p>p4-y5rCCMBN(Cl$TL?_*<_0!( z+YfB&mKmDTZD9!MkkTQcqZTUdEgL~PqI5**7}7DMV@k(8X{^))(1|W(C!J6_p>zuA z6w)cBQ%b{DYM~*Zp^)Zra0eAq8bKOC8c`Zi8bcbJ(j95shf1Z#{iip9G=3DVgsG@&$w zG=3D(&^rGusp+MfRm(ix;PN@tYLA)P}y?@N^)_Mr=3D1n)5er?E=3DyTr3*?kNHa(?N;4<5 ztK@*@Lh3i%-IbiuoYDf)0@8xgg3_fa-D|q+L#0|$x}XXxTxf z`Bf|_T|>HtbWQ1+(ha1WzEo`p-I!A9J(=3D_0Lb`=3D?OX-%<9i%%*cb(KgcZBYRZ2w-& v7WR&3@8YKQCul;%81oaj=3D^7L(1Z93hC)pF2U};b!Ak^BO@J!EO)E` z8Q_hhIHYHpz=3D)r`$a7P VSu!$E3k_1#Im4bk^4G2;e?PvR!t!3eyuDMZ_w#r7-qTM%9{2NOR=3Dqx7o<8KCULVh&U(~Ox z`WAjqqaZRyRkv%Y?B`x}yPi}U*WZU;b-SM3z^`uCi%KU!Y)ntp&AlDf)mf#9y(Zno z4YiWAY$kh>p4(BKy1AZB%O>?~d1~hRQo1epQo5ibJ}V2`pD}1ksKa*IGw0GP_P8Zv9R^MC&L{dN;v;W{Q*1RR|$ZhmvgczF#x~ WkQE~XjnE)PQ!wn=3Dqj+7c?eGW5el%79 diff --git a/tests/data/acpi/x86/pc/DSDT.acpihmat b/tests/data/acpi/x86/pc/= DSDT.acpihmat index 9d3695ff289036856886a093733926667a32a058..73a9ce59e9426b180fea0ec5820= c4841ebdb6700 100644 GIT binary patch delta 1914 zcmY+_OODzw0DxhWgjZfb62dFMuDeRTK?S6X5fK`d*`uDJv#jKvq^n+_>T!C4Zo3}I zmF+mnzr)18>@QB>&&RhWtnc;9w|7De%3tAoPd@#4+|Q4B^ZI;w`cQm&eLR1D5kK?h zYxq5jf=3DDUR+^)5-p9jtDdJs17FlYqneO6- zQkb-ECwnG6cO#v;xt>kyHuY?IYUlc8AR&Jhi27OS6iMl?qJiwh)-q%?)ho zwjbEkEi*Kw+rkjiA*Dk?M=3Dey^TQ-7pMCpjqF{EQi$CQqH(paeppc7rnPCB7-3G=3D?-br90BN50y%f`%iBIX##0NX+miV zX$om-O9xFIv_1bBq%%lol+GxfLpq0a-j^yp>_Zp2H0N*L+6ANwN*9!7kYM4bk#wn z`Bhv|x`uQO>6+3tr5i{$eW}_Ix-q5Hdot(0g>(z)meMVyJ4kns?mDS~?g*`fZ2w-& u7Ai<9N-IkDknSPfQ@XdMgC6?OFX{m4fzkt|M@Wy59w|LK>F>YZzv@4Lfz1m5 delta 204 zcmX}gy$XU*7zW_ipT#c%mByf@H3({t)S*x!(p`_|T)-h{D2W`U_0Vq74MaE5J#-h% zfzjglJm2U&qaY5F_W;md4;tyG#Wan*)DCIwFUP%r()A{RboDZmU^maYFe>GNk&avz zTb6?i@Y+@!(zQ$=3DT7>~bJycw)9mU9OJBGM+Tg@SAM{&~I@%}SWoQ$@72zlJ+WTVqG Ys01JjMg}UOL5eD4*s*)|JX@ds52i3S0{{R3 diff --git a/tests/data/acpi/x86/pc/DSDT.bridge b/tests/data/acpi/x86/pc/DS= DT.bridge index 840b45f354ac14c858d0af8fbd31e97949a65d4b..4cef454e379e1009141694e0f40= 36a2a701c80d7 100644 GIT binary patch delta 1914 zcmY+_xsKC79DwnO?OZ-`*v@@*bStf>X_A;?6)Rei?IS7*O17XI8r}j?A$r79@f3sn zACKj)%f$0(=3DI61K@1K8v4U1dx^5&gVolk$l2Two!yx&guN%{JGetOK`zuuoeyr^GU z`6c|8MnPnZDzBG9+0UKwdO4~zuD%bw@_ISBfnQ!PXO$*FY)nU0&8-<#)k&ozdri8t z8)_wKQBU?HJvE~$b#pzN7Io^`@>tLHrF2{HrF2t$TORAux23G2V`BnI-4+5#-Q2*Y zZu@~v-7;M%-4?o#b}8)=3D+N+`3-m)H~JxY6&_95*<+NZSNlE%gi03B4NZlnWB2b2yW z9YQ*!bVzAfOD!}6G*nt12X{~*r4ghNq!FbNr7@(jl6+3tr5i{$kZu~OKsSVLm9GC@ wWD8qJx0G%v-9fs8bVupVmJYgaLqD25q5c|YF%2Z)!aP0Ui`Cgs-;0LeYG=3DKmA diff --git a/tests/data/acpi/x86/pc/DSDT.cphp b/tests/data/acpi/x86/pc/DSDT= .cphp index dbc0141b2bbc77a6d806ff046dc137992c59a899..1dc928333d7ae7e4df6bb51d850= af5e1cb480158 100644 GIT binary patch delta 1914 zcmY+_yROqP0DxgPNpHEeP0~wx%fO7p$l5j_9W|H%Q+->W+S0eBSw+T51txV{2u$kc1~zru z4{Yj|8Jf~Av(jlRv7Aoy68$mjvbVTVG(lMlCO2<8EtkeY1i7sU)olrWVbPDMd z(kZ1=3DO2bxap&_85kmhl42NhBpK^j3CQ5sPiLmHdX9ckQ$N~OpBr#FE#fi$5sp)`dw zg*3ILgQgDJp8pKe8Kg5xXOzw%okKeBOO+n>p$lD_^EYqp0@4Mg3raIcGe|Q^GbgpH zNniom7LO?(gM-~(t^^0(xoZgYr5=3D1rCL(Dq;v)83epv&D@xapu1)En>kcZ- zui~204Wt`LH!YQdJUKno{aLne*R5x`lL0>6X$Rq&rA=3Dozy^ggzklG|6a@% t_K@x=3D-BWsi^Z@CB(t|A>^w@`fR!2yWlpZOqAgv&+D6O3I_h0W@`5$`N%&PzZ delta 204 zcmX}gJqvEIjFA#mdj26e| zxzE2-Vj+vpeZbhhX=3Dq*+lQ?u^$EUzsj=3DGHEU=3Du-g%xj{+pRQeSx~d~56RFB}JOx=3D0 zrK1H@$8G?twa*~Sffh#D)|?u3hmem}tr=3Dw5)`HA>-2aTVAgeA9Qk@PdIcQcDatWx6 UlZ9LwP%=3D+A_WYH6Zg$c80pWTyqW}N^ diff --git a/tests/data/acpi/x86/pc/DSDT.dimmpxm b/tests/data/acpi/x86/pc/D= SDT.dimmpxm index 1294f655d418dbdccc095e0d47ab220869a61a07..9f71d2e58b1707e733584e38dab= 7f73f9bda5eb7 100644 GIT binary patch delta 1914 zcmY+_OODzw0DxhWgjZfb65bG&T~+G7D?+*$5z$eZJ?a@cdw1JQbTt>KdWJbnPvOdT z9Od6(;$QX`C-7Fie+}z<{qp`nh{3Nv;YUwC{eIl5$GmxczC3*@zPvu3zrBdJy!jFS z%%UJtN;J1?E$rt(bGx2J7VGaruen_-H}IR=3D^&+w)h?N=3D$-Q2s8t}2nG_L}J~ZYYIG z>vpnd(yANj)Xnv5TDPfZ%X2%|H>KNxZ%Q}Sx8=3DDleOsDUWUN$RQn!V`q;76tQ@8!V zrf!*`Dcu%^kPayw5;|(3(%!NWq$5g4l#U@CLpr8(+>^#iO#q$fQg+e_r4vf0kWL|; zQaYtHY^4?&0vZZw9tU?&A*B(d5u_2N5v4Jtu_@h=3D#(k(%dfb0{6G#(C6G{_GQ%F-t zQ(HP{>Y(lU&mf&aI-_((=3D^WBIr1QR1>0uwb(4{$l^VTjPT~NB9G=3DnsQG@~?gQoBkH zXfC9F!`)rUDa|P@AT1y*C@m;mn$o?d%RW@9C8bMBSCFnCT~WHCbPeg+ln%P?pwj#* zt|{F>x`A{<>4wrRq}#q!Z3*3)QtCaK^WQ_fk+64H{=3DlF}2TCrD3}o}BdWKksw-AM!HHs{jB1 delta 204 zcmX}gy$XU*7zW_ipT#c%mF6I54T73#N*xNLB;ECR&IKHThLXrpS`Y0O-avE>U6;|~ z_&ncz<53U?$#?{4i#JX5+j^eHUTTLF`J3q=3Dpfoxpkgi^4671z!4@RZDFw&9B;>dE4 z0bbjRL%Nm;Y0+EJYJZoL1@6epuAA3|QwIoas7Eh+)X Vf{}qrXpo}H7*4FoK6h(5`~hC_Got_i diff --git a/tests/data/acpi/x86/pc/DSDT.hpbridge b/tests/data/acpi/x86/pc/= DSDT.hpbridge index 8012b5eb3155377dc7995b73059ecb267d19232c..db420593a3c51eced25cd574203= 53fbb9ccdf63c 100644 GIT binary patch delta 1914 zcmY+_OODzw0DxhWgjZfb5(sb9161mw7a*jI5fK`d*`uDJvv)7hUDvbf1*)E^hp0TV z9Y^_hnE03d#R>fX{8okay?!}<5MuE2Px#T3Pj8QV^_VxW&zGl9#h2H|^Vb*gJ8!;+ zKe8x@loHMDS_}Jm(A=3D(Pk;VG^&}(kj$_@PHcD;x!31X!NLO1trq^n9~sl8^piyKN| z(z>1OnY8LgI(2hBo7QdW+49`Z^-bxv;G5D-^=3D)}>OW&4e6&WiPnAB|{FsYjx*wk%5 zu&G;SXiB$*A*4e}hlGw=3DsI<3i1nG#<5v5~D$B>RG9rvWMQWHQYx|E%CLg|FkDWp?K zr<6`94O^*&hJc1bn#aK%R7hzAX#{CRX+&uZX>3Y&q;VfAl^*w>-UQMF(uC54(iGAZ z($tm?nmTBE{xe8tkj^NbQ96fo4(YrvReIQmE_7+m-@LU8NEehYD9s?vAk8SvoYbz8 z1DXq|-*9(Va!PYb3rGt{3rY)0m!@>D>9P-%YDwvm(iNmDNLQ4uC@mo^P3fRz2bJbm zv7~ej=3D^D~CrE5wzkZ$@?wIOt4N~!l`&VLK(7Sb)HTS|A3?jYTDQUl!)x)-wjdof$s tL%OGQPw4^D1EdE^54LpBV;}lW9U(nZdZhFO=3D?T&kr6(u-`_KDTz5}&$%xeGu delta 204 zcmX}gy$XU*7zW_ipT#c%l^|$t4T9VwbtsIGbl2lK7jOs~N+d^VJ++2KHxON46fKU=3D zbMrqQg-MuJBS4$KXriB%UY7Wo9Z?*trh|~Oc$-4HdYwzKhi_dO)$+(lMsXV3h7wl2dTv#B&=3D diff --git a/tests/data/acpi/x86/pc/DSDT.hpbrroot b/tests/data/acpi/x86/pc/= DSDT.hpbrroot index 4fa0c6fe720f7859f0541b82f828c0329a3c0548..31b6adb4eb941e5bf0c02ec8c38= 19c9213adf022 100644 GIT binary patch delta 1913 zcmY+_yN=3DpG7(n3xo11TdZEogPrp+q=3DPO-v5tFS%F1Ek8f(WFh8K1!8p+q_WTWLEyi zWBGIpo}-!1W5dtl?L$!B%a^xIsowWr!GHbq=3DW#zjX4UKS<>_Po>Gkpa`9=3DNBs&B!M zH1tDbRCT+S%6{%ux9drzQT=3D_;uWr|~8+g_2dQoZYN5=3DG2-Q3$zU7b~$*lW^V+)yh? z%Vu(4(sMhiQ#ZG7)3QnXwmda+Jt^H5JSp8&&z7gA^lT}s=3D*SpfQnv+PQa9JPsoTD9 zQ@6}OO1FgpqytI^gbo|1wzq5u>5$SPr6Wj3kd7!Fb)=3DCoV?f7ssaxro(lMnINGFg^ zD4kFmG*Sx<01cFu$H5&`KxqhR2x&-ZNNEIVB&9pjs0-Dm9(SMK7}6Nhn9`Wi1kwc3 z#Fh@4IB0YJQ%I+fPAQ#II)iiu>8vX?^{@+_*QK1lytQ*k=3DakMVO(9JoO({*C)UJ{N znkiks;qIy6H;IhR}_ay55tVe*tL$X+dd0=3D@!y0q}x_1&@G`mrJKJO*}@Le r9i=3D-;_mJ)(-BY@^rGp;2&@biy>4DM%rAJ7QkRB;LI_baPy|3XrepAd$ delta 203 zcmX}gF$;n~7zW^1ZOBgom8RyPErMDbGKZpwNOwK&*5C*lN+L%a<7mI4skJ}UKPg&n ze4bbD(xEtsQ?~_J{VRRWvr(2rnZKa*bUtXul&v=3D@WN25p1bam8jZr0!jBFIL+_3`W zfNNiI$k1&7%he)=3D&|SqX9VkW((+R}AWi)}%f#PJFiT*QGoE%eA2zfdb`~9q*}J!xU01z8)wA>vy+F4f z#m*n)+hO8Q_AgH0|L3=3DJSlz0Zw+~A7{{9X>div?-{dT%f>(}S=3D)2HIg>;3ubi~5z< z-@_kS6hy|T`g*C9``oLqm!rz!=3DKIjAua}by{Q7!1t1Jm(V|uD-ZjVt@om7^(YqmSf zP%E2O?PSlUr^l#CWv=3DJas!cst9^1LTEoBS7EoG|j%41vluC%M@*qFekvW38=3DGB800&{0$Bhjc{gh|)2n zV@Su8jwuaWse^`qhDzJVK@KXUG=3DemOG@>-3G=3D?;`r5tJ8g=3D*7`yH9TdX##0NX+miV zX$ooTN`a;VZO?xK=3D>*aVr4vf0kWL|;cBQ5ncA>MTwC8W%+8LxXN@tX2kYp(Qo5yd2k8#d9i=3D;03UuFvelvSW_mu7_JwSSZ^g!uBq<{W-N%;=3D-%*>hq delta 204 zcmX}gy$XU*7zW_ipT#c(m4;|;4T9Y)&M8d7^g9H!%bUjfc{$4xKXW3AgVm%TQWkGhNKdbF3HJ1@8>31d8R;lwxnl*$ z0B;<{AwA0k)|)7VXhw=3D_jjI@$T_+F^yVC-qaTO=3DM8~;C3#mVR@fRLv{K@NIti&_A( UWMrTg8lLDsuw&N)O z4io>fzc_(^pPygD>R!D)KL|0Xe}^AE`SN_+FOPZi{(61+RD5}VyncHVzw+is_%n-w zNGZ|W>PpzpgXUJBMHcJtL$A5j7dP;mTYVK-62wXkgl_KLNLLq;rS_WXu5KuWNvn3U zXVObI(y5#4*|cg?&z9$Qu5U`W1>clzs&C74Tl%&%tH@ZXz@%;qfl1xmz@~2dflb{q zLsPmf3?Us-IwW+|LZ!WBBS=3DS-jwl^NI)-#i>9{A2m6`xL(WUI96G|tPP9dE_I;C_< zY1m3FGz2sh(mW3Cph8L`NFzuiN+U{RNMlpFBaQn|sr0!2^d^udkS3HSl%|lTkfyeD z(9}WO^PfRFgLFpejM6!zb4cfXsnWwfbfHUg{^qS+K)RrGL1_kQ25ClV=3DA?F&9MD`y z{f4`{l2e*fT0mMrT2NY0x-_MGO_zPBR7*;il&&CMLAs)JMd=3D#SwJ9BR-9e@KRa{fL zfpi1uhSCkCTS&KksoD~{HKo*hGUva8bO-5<(jBFHNcWKLJE?*02|Wne{=3DJwj93VYV pdZ4s~w1l*zw6vvz9{bSm>ImtP(j%oONKcTSC_OpppTAyF{s&CX%t`dVRh;eayeSKAyk6sNY%j zJ^YbIL1c`oZr4(|&%Nq)J*hOVzYo3Yc0J3$uWr|iN|PWqrl;!W-j3?(tkQ|QX1j|F zwX$j1O!jPgZbx-0b3K=3DqP3pPw)Xep5DO>PuDN}t{o|@8krCmkG#soH%Ed(}|xq(Y% z`+-YknZ7M$3w=3DoYl=3DcZ7G*Ins*#Oc3r2|TbkPaaoQabENV`D~uj_Ojk(h;R2O2?3n zAstgXrZjA%4jKX)Ds3MJIjE4*2+|1Bh|-AC7}D65a-?w=3Ds!cuaKD`N~38V?738fQA zCy-8DDbR^PoAaMSI)!vf>6FqLq%%loU8$*uUFf_n?fKicb`I&B(mACmq$#8+rKw2W zDjA@e()AlIcO|1Vqcn#!hcu@&r*vUUc}*8xs5T2q7nCj`T|&B~bV+FeX<I=3DO3j+kwJmkMCwu-INH>sfDBV!Hg>(z)wv}4wme8Hj&EJdN u!Vc0Mr8`RZknSPfQ@VGhKo4E$H*a)`{F0!Nu=3DCqp32CbBe)jEfY*tt~T_r$+)I;%Y=3DhDsea zyaKrpCeQ*Z@;zX&oTrecr-fre&B?Q!LEf5HV@MNfLCj9_pP?4y+L}PBKlA2W z_&tk)NGZ|WuC=3DhA2hHtz7Fn#n554Agt=3DzzGZr6**k|0)UAarx@M!Kp*mfCBkySSkg zCav4ao=3DK~2q*FK7vuWL?o-NPqT;G%)7cRNt28w)AajR*|t%fl1vK0+YJAflb}^ z1Dm>KhNg5|7(zOvbV%r^g-UzNMv#su9Z@=3DlbPVa3(s553D>VUhqD$FHCzMVookBW=3D zbV})z(y*0UXb5O1qwORU1M#rj&Y5=3DKQyiZXw-Lx}|gn=3D?>CeCpFL=3Dp?e|QzZbKG tJ*0a|_mmzWJwSS(^k7Q|J@%nr)e+JorAJCnke(ntQF?OH-*4XE@;}cy%sv1B delta 204 zcmX}gy$XU*7zW_ipT#c%l^|$t4T9F32XiM+%PY2z=3D)y?~On$v=3DT*7)EUv!~z3Os4%D}HK=3Dab5kAU39>>gIYM)zwjDsk>&olMJ=3D8 zY1vHnYQv@>E-jnXbLF9#>)TSc;M-EB`mQ`QrSD3+ijIv5Y${s_Y$|gDm&*17 zm&!6-Tgn!?kaj8U654B^+TF4qq&-S|l=3DdO*L)xdb-;&103;-R}rM^oClny8zLOO(W zNa>K$u#q}w2xzFZeH`SVLP{e@BS<4kBT8dPV_V9R#%-uJ^|<}?CXgnOCX^bPVYj(s5gA>R}r?sY`qQ_N|>jI-ztzX$ENqX+~)#QnyMD zXs&eqhRa>aDa|P@AT1y*C@mCsp~!2^It)_f^9p>zxB7Sb)HTUQEn*M@#IJ4knw?kL?ux`%X6>0YFNKfE8G{{x?A%_RT; delta 204 zcmX}gO$vfQ7zW_ipN(GxDjgw$7C}%KNL>_0NV?Z?<^V&`q9k-FZHH<*MHh$;XtZ(p zJi6%i6s1vCPXXicp_y5)mw6iGZcItInU5mMlYIv1n@u6XUV(FC)W|a<6Q!&UtOQx$ z+EpCVcWhw0iz5g|K1X&VBL&G=3DnuA diff --git a/tests/data/acpi/x86/q35/DSDT.cxl b/tests/data/acpi/x86/q35/DSD= T.cxl index afcdc0d0ba8e41bb70ac20a78dcc8562ca0cb74b..f561750cab8b061c123c041fe22= 09d74c7a740f1 100644 GIT binary patch delta 3550 zcmeI#JC4&p0LJn0BZ=3Dcj9(GA$B`fN(V@k&=3D2AOQ0x`x*aqzp zxCWPi3k>p%C&~W^NbWL;Kl%I3#52j?^7q@YxG8S$o(bWUKf~-I+J3t`+-weSzP$YU zczJQ<$mgF9uU_AZ@7eBS_&JUINGY+~mxVB|o!!1%i!`p@58d6q+}MG)+m~CBCVs4x zBdW~$II2<`k@n1II=3D4Lyt7K7MD_tGk)I(QC?X|9n7IoAWI%;p@>7=3DdT>7>2XGs$(G z^i0y;#n(w)LB>k?I%=3D=3D=3DP1M%+P1N3|1!)V?7Nsqdw9+=3D9?HVf0B(*7RQ`&*F18IlS z4yD0K8Y>k58dOPnTBv~1E~H&ZyOee*4IvF{sey)shLX|<(g@Os(umR+(iqa%B<+&M zXV7Z>6G#(C6G{_Gdyw`Z?NQnzv|mG|d4T$m_9^XCI)HQl>44I~nKV{v2IO5*r%@Nle oamPo$IpXxswdRP^J63bV>2E`G#F>99dNTfpBX08e;>m;m5BYsr8UO$Q delta 354 zcmcbU_Q{*eCD`LRz;HxP*9yH$i>Xik;2GOkkXNm$WWTN XBw_M0)oc`J%BT%SXKtRQcZdZ54M$#( diff --git a/tests/data/acpi/x86/q35/DSDT.viot b/tests/data/acpi/x86/q35/DS= DT.viot index 64e81f571120e3eb2b8c6c9545293a78c75b7bbd..8d98dd8845a60a08df5aff27097= 646bea4913b75 100644 GIT binary patch literal 14615 zcmeI3O>7&-6~|}zrPXpNE~%Ad%d$l{3DP!2LfMIvwrEgtmtU4huep?+U=3D5IxoL062 zWD(myoWOuA1Bv5PW7R>AOuzuWwWnTVpqKXMTT}GZLoc}&MSKd2H#5(gM^Qipp8|*n zYIkp`LXmhTn{g#u@c!8ZK08;MIS-15q`E>Fi2 zJiL<@+g`a=3DHk_Y&<<%Ph{buj;Uhl>yJ-!yP^)Ky*>ub^7d%blAoo=3Dp2rU@JN@^m*S zcf;*Q)^{64qg!uyR_U>67+qIx#f|Q2!(-0MME6|aChlKju6J>%-%9Rm=3DB7Blk*cHDAnwOQ~R-dlx` zmsi|n=3DDgs$m9w$%IoKNxqfO`$-Qrgmj1j&F%>(AVRBCu{jq3$tMex>BeS1!M(ii8` zOC9Khvb6|A#0k86?_JK;`|}TO@2s<(b!#{r4%zKBzIJ=3D<7B?q$PjLSQa`s0Ch}PxD zVE7HU${effH(VZV!k)c-fy4Q=3D-EYOU>9;$6e);-VKAlJphis*_Tw!vXue6q{EN?-( z8Cz*B*KjAk(ps*wd?sNHhnzu7_30i&)mVN?9usl(-Cc;RsJ<}~S$nz%k=3DQjRBP%L0 z#zZ8l#6=3D`#5EqfyH7+BoDl#r3Q6(WFF@uDN#I6Y$iODBqB&s9{XOeIxDQ8kfqDqQz zrU++>a;7Nf1mT<@oD-CDf^r&!(;%D%DZ)8LIj1ORmT+bXXO?niDW^?1ZNh0& zPMdP(2xpFP<|t>5a^?wVo^a+VXP$CS6V7SEIZZjIDW^j?9m45QPKR>N5Y8FGIYT*T zDCaEUoF$yIlyjDH&JoTz!Z}Ad=3DP2h9!g+*n9-*8^DCbcTSyE5Uqaw1b9(G4%q`SKd z&s$IRohOm=3DByyfc&Pz>mA`sK%KkoLRyN z1ytjN0;+M^gwrORP(U?KD4-f=3Dj&SA(ClpYP6AGxtnJ1ii!U+Xb~4;hZ6yP(U?KD4-hWEa99boKQeDPAH%n=3DN#djBb-n` zHBKm?8s`zhd4zC60o6F6fNGpaMWj|hYe7RVptYc(7tmVJz%n>bBIkuBMnVDABB6k4 zk;h2nF%k&{REvZHszol4$ORG!1yqZK0;)wGCy~cVBot6B5(=3Dmmc|t_uGya5##AiGd zQ0?480oBg!BGFtVnovMBO(>v3)0yx3?GEc(JL1dg0KSlZk%B)ZXS#7d=3D*=3DGwr$ij4tU3MZ6q}4E8Dl16EX^3Z#hh$6=3D#o@*YzwNZg$LYvTf{ed#=3D+tI^5it;ba>f&TblV`M+Y+{YnR~ey$e%!>zjCX)=3Dqk z$KR(}BD`b6{`7@P%PaV8uUl}=3Dh{_W|OD}?^wGVry-RoPQ?ey4AFFhO%SbyrXoi+Bm zHH-c0zsUg`m|1xR=3Dgg^(Ct*4L@%JnNb#r8-@7;*rz4@EM`|n(T@8&hO47->o$A}MzPYo>K6Z=3D6;uWW! za)VB3GJNjRD+wJG0ASsJv^l7(MBs$%j2-}l$jtV_7xx@lSswJ9W)iRtCd5aFs+=3Dv3 z9p9G6jfJYv0QV^mTA zk2bnZuRr&2wACwhHoodl?yQ-^h+qCH8h5<^{GKxhpL?`%4{}^%H`gNG`{MQfYkRth zE2C3=3Dd&7+HJu&U(g^2fVZh-ApNl4!f23%(wB8EpB;nH}xJtw)*3U02CKh4ca_gv7i z_BqYtua-UIyG<{;GUnVwW^A+-x?UY^^h%wv*@buCfNNTsWsU_;31a|PH#54;QYV)- z4Q4O~(_v?-doJjt0fuc}x#}Fd^fEjKx|QN7rtWySk>HxL&uv|j4}+E$o>w5_nKvaK+AWm}<&w5^a+ z+E&+E$o>w5_nKvaK+AWm}<&w5>1$XQBAiUAT`M~gSJ|M1y z!}-AQa6TZegdgmDpuh@a=3DL1V>K48oFfPFY0IGhiN836qIF3wjE*9YL79L@(0=3DL3iH z0sQKDxIO^SgdgmDz-Hi+i}iu#jCA7UZ=3D2vZJ!jMApK&39u`K+Uiq-fN>xspUdl|;9 zICvJ{S&Tigp6+LcL&n&D#E*f*aro~W@zfNr7$ZLuGKRz9ALSAD2Xf@maQOB2^2nn% z@4v(tjwWB=3DhQQBg47HCh*uTZXZ8uT#E7Il=3Dzf>v}&oF6yLc8X98sN8>X=3D$?x&$Ey! zq__=3D(oK5(3zb)oMBZK&EV~l^gcdSR&Ba0uo#q1wnf}^Lq`BZ{)2HUT8^G3pqnK7~V z8XN%#`xm<(L%98N^`a~7_00K7bG2A3o*JWKC+#G-w02`rcs_P%QT)(qI~^2@U87s_ z+AQ4uNl<)4?pW}VJ4QEH^4LIZoWhOMun}%&gC!McF&2{zyTNhMaB8p))@+tRR^Jz?yi_2|H%#-+&I5SS#BIbp5 w$98vR8U=3D%n8d)v%#gf5U~)1;fe2`a)27jb4tDX6VX;u2us{{Nq$BZYyXpgK{Ii (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 1726064856794904.4154755697332; Wed, 11 Sep 2024 07:27:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOI2-0004cx-65; Wed, 11 Sep 2024 10:25:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOHL-00048E-DX for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:25:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOGR-0007zt-Gt for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:25:06 -0400 Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-81-au1uDgSkPOGTLP08l9c3OA-1; Wed, 11 Sep 2024 09:52:11 -0400 Received: by mail-lf1-f70.google.com with SMTP id 2adb3069b0e04-53661a13121so3605555e87.0 for ; Wed, 11 Sep 2024 06:52:11 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25ced18csm612219766b.161.2024.09.11.06.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726064646; 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=XMtC5Kei8mxn7YHbK2SX3QVuhzxpI5xgFrkix64PgUI=; b=MzQrDSi3XPuvrpwYaQofeaJyfLPEPz0W+8yLnjZkJU1pw13+jQVuP54O2EqVXLVTy5sYQh anRm30au7E2Td1KU/3UAwFE49hXsZZB8xxHtrI6sBD8g5kphauhXg6IpSPWGV7c5shfPFY WfV+K8rUL/w5tAthHx2E8Viv/j6+Uss= X-MC-Unique: au1uDgSkPOGTLP08l9c3OA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062729; x=1726667529; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XMtC5Kei8mxn7YHbK2SX3QVuhzxpI5xgFrkix64PgUI=; b=vL0HtUo3TCtJEuLafKzM6zpf51K7Bj8DlWbjQ8UUwktFCEAsM5gWaDAmeB04QQ9/V9 54l/tsXkdNCiS6p5xyS6Ft9UkyxVdPMCzG6E1reBJqoaEaAWVTkRUlzFyqi2gAaN3H0+ aX/zGzht80Z/QrqYI/uL/1l3xmSJq/xX4YOBdLoI0JWJyC8yHay53c+B/AvBvMH4M27L nr53t3jAT4l829GZXOObu6GZFDoUH1jopycBNSYzgdQeaQ/J6qaQZfTVguKjVnYTV5S+ oIqPD2zWToRb6J7Y5ECYnhQVmeWEgztaUGZlBODF0QGzsCpOkdJYbVfBmJz8EeChPFUy ePAQ== X-Gm-Message-State: AOJu0Yx6inKm8YUAdPJKhMo7HgDY2EKT/PmH9wAjlz04+lWyDcIgYIWn 2qTT9dna8WxwmzfAS4p0O5r5+ECjq9s9NoWP23ty1Rl0bM8lMqprWEUkg5gRmZyZHC3OqRdIyKu YZ0XSuHCzrmUspUnV0xBxhNrSdNnbVISXaVTxyuJOLHuu4IOK1Zk+XkSMoq0N1CYbpeI7tu5dLK 2VExw3EIbKXvMDZWodcnISucRnobzD7A== X-Received: by 2002:a05:6512:1388:b0:535:6a84:68df with SMTP id 2adb3069b0e04-536587b5421mr11748610e87.27.1726062729259; Wed, 11 Sep 2024 06:52:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHBWytkJ5CWSFxMbY7O4YMGl+gyzbtWIAORmncdYcSIAUTUOVvIm5SzPCDv1FawPAkuriqtwA== X-Received: by 2002:a05:6512:1388:b0:535:6a84:68df with SMTP id 2adb3069b0e04-536587b5421mr11748576e87.27.1726062728400; Wed, 11 Sep 2024 06:52:08 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zuoboqun , Stefano Garzarella , Jason Wang Subject: [PULL 13/18] vhost_net: configure all host notifiers in a single MR transaction Message-ID: <6166799f698512ab35e216b4ff4f7156f47923c6.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726064858106116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: zuoboqun This allows the vhost_net device which has multiple virtqueues to batch the setup of all its host notifiers. This significantly reduces the vhost_net device starting and stoping time, e.g. the time spend on enabling notifiers reduce from 630ms to 75ms and the time spend on disabling notifiers reduce from 441ms to 45ms for a VM with 192 vCPUs and 15 vhost-user-net devices (64vq per device) in our case. Signed-off-by: zuoboqun Message-Id: <20240816070835.8309-1-zuoboqun@baidu.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 4 + hw/net/vhost_net.c | 155 +++++++++++++++++++++++++++++++++++--- hw/virtio/vhost.c | 6 +- 3 files changed, 150 insertions(+), 15 deletions(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index d75faf46e9..c75be46c06 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -171,6 +171,10 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaqu= e, */ void vhost_dev_cleanup(struct vhost_dev *hdev); =20 +void vhost_dev_disable_notifiers_nvqs(struct vhost_dev *hdev, + VirtIODevice *vdev, + unsigned int nvqs); + /** * vhost_dev_enable_notifiers() - enable event notifiers * @hdev: common vhost_dev structure diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index dedf9ad7c2..997aab0557 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -162,6 +162,135 @@ void vhost_net_save_acked_features(NetClientState *nc) #endif } =20 +static void vhost_net_disable_notifiers_nvhosts(VirtIODevice *dev, + NetClientState *ncs, int data_queue_pairs, int nvhosts) +{ + VirtIONet *n =3D VIRTIO_NET(dev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(dev))); + struct vhost_net *net; + struct vhost_dev *hdev; + int r, i, j; + NetClientState *peer; + + /* + * Batch all the host notifiers in a single transaction to avoid + * quadratic time complexity in address_space_update_ioeventfds(). + */ + memory_region_transaction_begin(); + + for (i =3D 0; i < nvhosts; i++) { + if (i < data_queue_pairs) { + peer =3D qemu_get_peer(ncs, i); + } else { + peer =3D qemu_get_peer(ncs, n->max_queue_pairs); + } + + net =3D get_vhost_net(peer); + hdev =3D &net->dev; + for (j =3D 0; j < hdev->nvqs; j++) { + r =3D virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), + hdev->vq_index + j, + false); + if (r < 0) { + error_report("vhost %d VQ %d notifier cleanup failed: %d", + i, j, -r); + } + assert(r >=3D 0); + } + } + /* + * The transaction expects the ioeventfds to be open when it + * commits. Do it now, before the cleanup loop. + */ + memory_region_transaction_commit(); + + for (i =3D 0; i < nvhosts; i++) { + if (i < data_queue_pairs) { + peer =3D qemu_get_peer(ncs, i); + } else { + peer =3D qemu_get_peer(ncs, n->max_queue_pairs); + } + + net =3D get_vhost_net(peer); + hdev =3D &net->dev; + for (j =3D 0; j < hdev->nvqs; j++) { + virtio_bus_cleanup_host_notifier(VIRTIO_BUS(qbus), + hdev->vq_index + j); + } + virtio_device_release_ioeventfd(dev); + } +} + +static int vhost_net_enable_notifiers(VirtIODevice *dev, + NetClientState *ncs, int data_queue_pairs, int cvq) +{ + VirtIONet *n =3D VIRTIO_NET(dev); + BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(dev))); + int nvhosts =3D data_queue_pairs + cvq; + struct vhost_net *net; + struct vhost_dev *hdev; + int r, i, j; + NetClientState *peer; + + /* + * Batch all the host notifiers in a single transaction to avoid + * quadratic time complexity in address_space_update_ioeventfds(). + */ + memory_region_transaction_begin(); + + for (i =3D 0; i < nvhosts; i++) { + if (i < data_queue_pairs) { + peer =3D qemu_get_peer(ncs, i); + } else { + peer =3D qemu_get_peer(ncs, n->max_queue_pairs); + } + + net =3D get_vhost_net(peer); + hdev =3D &net->dev; + /* + * We will pass the notifiers to the kernel, make sure that QEMU + * doesn't interfere. + */ + r =3D virtio_device_grab_ioeventfd(dev); + if (r < 0) { + error_report("binding does not support host notifiers"); + memory_region_transaction_commit(); + goto fail_nvhosts; + } + + for (j =3D 0; j < hdev->nvqs; j++) { + r =3D virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), + hdev->vq_index + j, + true); + if (r < 0) { + error_report("vhost %d VQ %d notifier binding failed: %d", + i, j, -r); + memory_region_transaction_commit(); + vhost_dev_disable_notifiers_nvqs(hdev, dev, j); + goto fail_nvhosts; + } + } + } + + memory_region_transaction_commit(); + + return 0; +fail_nvhosts: + vhost_net_disable_notifiers_nvhosts(dev, ncs, data_queue_pairs, i); + return r; +} + +/* + * Stop processing guest IO notifications in qemu. + * Start processing them in vhost in kernel. + */ +static void vhost_net_disable_notifiers(VirtIODevice *dev, + NetClientState *ncs, int data_queue_pairs, int cvq) +{ + vhost_net_disable_notifiers_nvhosts(dev, ncs, data_queue_pairs, + data_queue_pairs + cvq); +} + static int vhost_net_get_fd(NetClientState *backend) { switch (backend->info->type) { @@ -272,11 +401,6 @@ static int vhost_net_start_one(struct vhost_net *net, } } =20 - r =3D vhost_dev_enable_notifiers(&net->dev, dev); - if (r < 0) { - goto fail_notifiers; - } - r =3D vhost_dev_start(&net->dev, dev, false); if (r < 0) { goto fail_start; @@ -328,8 +452,6 @@ fail: } vhost_dev_stop(&net->dev, dev, false); fail_start: - vhost_dev_disable_notifiers(&net->dev, dev); -fail_notifiers: return r; } =20 @@ -351,7 +473,6 @@ static void vhost_net_stop_one(struct vhost_net *net, if (net->nc->info->stop) { net->nc->info->stop(net->nc); } - vhost_dev_disable_notifiers(&net->dev, dev); } =20 int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, @@ -396,10 +517,16 @@ int vhost_net_start(VirtIODevice *dev, NetClientState= *ncs, } } =20 + r =3D vhost_net_enable_notifiers(dev, ncs, data_queue_pairs, cvq); + if (r < 0) { + error_report("Error enabling host notifiers: %d", -r); + goto err; + } + r =3D k->set_guest_notifiers(qbus->parent, total_notifiers, true); if (r < 0) { error_report("Error binding guest notifier: %d", -r); - goto err; + goto err_host_notifiers; } =20 for (i =3D 0; i < nvhosts; i++) { @@ -414,19 +541,19 @@ int vhost_net_start(VirtIODevice *dev, NetClientState= *ncs, r =3D vhost_set_vring_enable(peer, peer->vring_enable); =20 if (r < 0) { - goto err_start; + goto err_guest_notifiers; } } =20 r =3D vhost_net_start_one(get_vhost_net(peer), dev); if (r < 0) { - goto err_start; + goto err_guest_notifiers; } } =20 return 0; =20 -err_start: +err_guest_notifiers: while (--i >=3D 0) { peer =3D qemu_get_peer(ncs, i < data_queue_pairs ? i : n->max_queue_pairs); @@ -437,6 +564,8 @@ err_start: fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e); fflush(stderr); } +err_host_notifiers: + vhost_net_disable_notifiers(dev, ncs, data_queue_pairs, cvq); err: return r; } @@ -468,6 +597,8 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *= ncs, fflush(stderr); } assert(r >=3D 0); + + vhost_net_disable_notifiers(dev, ncs, data_queue_pairs, cvq); } =20 void vhost_net_cleanup(struct vhost_net *net) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 06fc71746e..7c5ef81b55 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1682,9 +1682,9 @@ void vhost_dev_cleanup(struct vhost_dev *hdev) memset(hdev, 0, sizeof(struct vhost_dev)); } =20 -static void vhost_dev_disable_notifiers_nvqs(struct vhost_dev *hdev, - VirtIODevice *vdev, - unsigned int nvqs) +void vhost_dev_disable_notifiers_nvqs(struct vhost_dev *hdev, + VirtIODevice *vdev, + unsigned int nvqs) { BusState *qbus =3D BUS(qdev_get_parent_bus(DEVICE(vdev))); int i, r; --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065019; cv=none; d=zohomail.com; s=zohoarc; b=b0ArZOMDkc+D1vA5nPSxO9Z7UzPBOr8MQasEtneaQBjtAGz7+SpJjPCjGR+LcZ+9WvYJSDVOvGp+Nt+a7TMH9HCDsSILY9zOExH9wFlrxsiW7QB5ke0yL4EE/YfUzEuW94ss/AO6gtXDzDLzVdw3hinEAf9Rcr6ZHYbTB7ya13s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065019; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7SP0llBIv1hTkxB2e1G9eZTNJY30OOtKHAC0GZkH5pk=; b=S4TAU3KMANCAVaX32WaDL8A0yyFwaLFUJueD8Lb9hW7SnRP5rxgS7DFKYAoWnhwlHgbogKeCAVkNR+p4BC+9Q8oq0MWVyn5Ti/UQL2tMQeoYdZAHRqPf/3z/Ei6XFefBBLCTxWeX4tXFAuBGZu/AV3XFlwZmjJD/2cWqVaAU9Ps= 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 17260650188631002.9070993141906; Wed, 11 Sep 2024 07:30:18 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOKB-0000H5-4X; Wed, 11 Sep 2024 10:28:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJP-00076Y-HO for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJN-0003NH-0g for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:15 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-356-4IZLYEVzO3-T-EduSWVDiw-1; Wed, 11 Sep 2024 09:52:13 -0400 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a8d10954458so367259666b.3 for ; Wed, 11 Sep 2024 06:52:13 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25a455besm622550566b.93.2024.09.11.06.52.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726064832; 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=7SP0llBIv1hTkxB2e1G9eZTNJY30OOtKHAC0GZkH5pk=; b=iqhG2mQw+L4d0UJpHk0V0paQYZlaolYPVK4XUrIddbBQptD2AW/zToaE9VeqGzA8w6+1Kk VZoiPGg12sA8gHoxF09RgXsSGePUnPvGOQC73MCxHZ2eZdSw2CiRn61ohJhqQudaKcez/g be+VcFiLuhmXYueFaK/haQCcUKzVgE8= X-MC-Unique: 4IZLYEVzO3-T-EduSWVDiw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062732; x=1726667532; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=7SP0llBIv1hTkxB2e1G9eZTNJY30OOtKHAC0GZkH5pk=; b=kpoVlGJxdX+2VK+jPzgmBpDhLaRiNVHG/8YC6a9GXTKJTiBvo8RBCmOe74OCeq68h8 22SAOLLaAAq235Hs7oC7Bl0RHxNJRccers7jcVCOhC9SPOhbpaJHAi9ODFtIVMXkHmmC uC2efNj1jSWSPZXZsaD8yp4IudCVIsmut4vIEfsE+auoutH52zrVMGT7ZXLSVsqVrAoA 9IkDQQOrnsbZoT/wv0wS2fwavcFZnI6EMF33MtDHZx42WF09df9hV2ODAh7SzwVsGf6E 1k/i0Vjgb/TbujynZ8ZkPgwBGpy6RRDZ4HhajhMT3rYMoSpILsSqEGWB/TFo2jgX9sx9 S19g== X-Gm-Message-State: AOJu0YxSDTer921HGdwz1AXL1L8iI9v91y/vWPjahtu7nw6UNf0wd1n1 R1QZHIAIlTcxu4BiYMj+czdyfmej+kuNik6G6p949IrTEPQzuSdF8GOGKuBrqDNmmXByClUqvSa GOtv61fDl/mXzXbPV7yy29g0CZ4dA2U683PgeLTmO7+8V1WzZEf+F23u+CHSWq1Cnx/jR3jVvRm +h2t24OrwJYOUqSsOFTaNC1taHxt2+aQ== X-Received: by 2002:a17:907:2d0c:b0:a8d:2e5f:8fdd with SMTP id a640c23a62f3a-a8ffae0bea7mr436046766b.59.1726062732015; Wed, 11 Sep 2024 06:52:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF9j3Zx7fBOmvGDs7LU/brNk/yeDDdgCfqQPYw6awSNHdmBK8k+8SMZdZd0Drc88ss0oO7qvA== X-Received: by 2002:a17:907:2d0c:b0:a8d:2e5f:8fdd with SMTP id a640c23a62f3a-a8ffae0bea7mr436043766b.59.1726062731403; Wed, 11 Sep 2024 06:52:11 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Gao Shiyuan , Zuo Boqun Subject: [PULL 14/18] virtio-pci: Add lookup subregion of VirtIOPCIRegion MR Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065020110116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Gao Shiyuan Now virtio_address_space_lookup only lookup common/isr/device/notify MR and exclude their subregions. When VHOST_USER_PROTOCOL_F_HOST_NOTIFIER enable, the notify MR has host-notifier subregions and we need use host-notifier MR to notify the hardware accelerator directly instead of eventfd notify. Further more, maybe common/isr/device MR also has subregions in the future, so need memory_region_find for each MR incluing their subregions. Add lookup subregion of VirtIOPCIRegion MR instead of only lookup container= MR. Fixes: a93c8d8 ("virtio-pci: Replace modern_as with direct access to modern= _bar") Co-developed-by: Zuo Boqun Signed-off-by: Gao Shiyuan Signed-off-by: Zuo Boqun Message-Id: <20240903120304.97833-1-gaoshiyuan@baidu.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-pci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 524b63e5c7..4d832fe845 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -615,8 +615,12 @@ static MemoryRegion *virtio_address_space_lookup(VirtI= OPCIProxy *proxy, reg =3D &proxy->regs[i]; if (*off >=3D reg->offset && *off + len <=3D reg->offset + reg->size) { - *off -=3D reg->offset; - return ®->mr; + MemoryRegionSection mrs =3D memory_region_find(®->mr, + *off - reg->offset, len); + assert(mrs.mr); + *off =3D mrs.offset_within_region; + memory_region_unref(mrs.mr); + return mrs.mr; } } =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065143; cv=none; d=zohomail.com; s=zohoarc; b=iRuozZ0qe2SsW3GASl+VxCtNruf43jqk0BGS+knyy7DLSQ7FY7ovFsC6HqEOwmBlzkhqJtVdd/uBFdQdFjlkCNZnyoVCFajqklVI9UsIWSIc7g59zUwqLWY27GPOdNBRDLdge2K62rkW4sEQgsqXUzodaWkh9xeFEjjelgn8Aoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065143; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=s7eWEC+J3I9Lev0M7HtiUi/IanEUkElHv0I4GaiCIw8=; b=ILL7KJaioYkeUdHQMDRzTCdyXj/A/jwqjBC13ikB+PBlgaBTbcTSwLF5Vcho5lHf13vTzod9f1DzKBlblishPN33bfMep4Lzt8Rt5zsMvqlzKOGpowtUwHaHi5ohuEtw6e5llrXG/xxXCzs5NIjU03/u8BZMKruI6S77DVy90Hc= 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 1726065143172285.0870047758509; Wed, 11 Sep 2024 07:32:23 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOMk-00052k-Cm; Wed, 11 Sep 2024 10:30:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOMh-0004tQ-Cz for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:30:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOMf-00044c-9f for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:30:38 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-68-RJmG23MwOHSOHOvb3rg9Qg-1; Wed, 11 Sep 2024 09:52:17 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c25c45afb2so4829621a12.1 for ; Wed, 11 Sep 2024 06:52:16 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd41be4sm5361685a12.18.2024.09.11.06.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726065036; 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=s7eWEC+J3I9Lev0M7HtiUi/IanEUkElHv0I4GaiCIw8=; b=eISEn2qVf62ZM2n5aB8zkDG75esudLUoEsfGXjIE/wtIlmAxURar5yHVvCEMHhOsaJ+G8s VHk5o9SRmp1zCpVt/T+U7Kh7AHyhFZing5eFtEXTII8SThdGZJ4b/4A2DEwQ8L10kKhrbM jD6aTv1pJ2iDxYnerS+eule4ZydXg1g= X-MC-Unique: RJmG23MwOHSOHOvb3rg9Qg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062735; x=1726667535; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s7eWEC+J3I9Lev0M7HtiUi/IanEUkElHv0I4GaiCIw8=; b=ufvTDFT8p+uem6p/jSuqxLqNhECafJ0omcHXyLC9RKReXkD0ODlxlM5dG6QgCNLzed 2Ty7OtTVdWfBArNqWHzNF17w9bpqLAjSPw6i9wNwRkA119tqrWsTnHYPt31pKLgpB2HD alB3YwVWjJK98L7YpaM4+f8zj9ZJEf4UpTpvp96M98iZw2QiGu6TTlx9mGGSTiWBhTkV ClylMeDGRNeXAx++Mzqk6J4z2zjogQEenTeOmZUDHjneR/J0ydX+ZTscqHFiniW99W1k MIvSjof5rmsQP5c5/B3J6K40mIcyBCrmIHiHHCIPrLVQGnfW/IcwmBrcVvBh6Wx96XCv CUvg== X-Gm-Message-State: AOJu0YzxMOlEUki71X4br/AsIcSMp9flIeQEON2Q0xiqbUuzHAIedKpc yNx3kSu7kcZ21GNnGgvRBAhsYfSRUT6sX529W7eHpGbFy0sMlR5rtkdWs1uRVc0hYQ+OF2IN1br KEybP6AhESmn05rNzA3STt42iX0QocEnZDFS8CZPKWxCIYrn4QGyQxaSeE6+BB5MhB7DQnDfmK9 gKIJvcNg3yiaucu0rXW8+UOsV/LyXSng== X-Received: by 2002:a05:6402:528d:b0:5be:fd66:edf3 with SMTP id 4fb4d7f45d1cf-5c3dc79b7a6mr12720156a12.18.1726062735419; Wed, 11 Sep 2024 06:52:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGzLNZKPzU44WOHzWzxWuIOTk/S6psIjrahnWH+D/HwRtJ/7DEgGqSrj3xM9gxcltyj57xeeA== X-Received: by 2002:a05:6402:528d:b0:5be:fd66:edf3 with SMTP id 4fb4d7f45d1cf-5c3dc79b7a6mr12720129a12.18.1726062734725; Wed, 11 Sep 2024 06:52:14 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , peng guo , Jonathan Cameron , Fan Ni Subject: [PULL 15/18] hw/cxl: fix physical address field in get scan media results output Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065145002116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: peng guo When using the mailbox command get scan media results, the scan media restart physical address field in the ouput palyload is not 64-byte aligned. This patch removed the error source of the restart physical address. The Scan Media Restart Physical Address is the location from which the host should restart the Scan Media operation. [5:0] bits are reserved. Refer to CXL spec r3.1 Table 8-146 Fixes: 89b5cfcc31e6 ("hw/cxl: Add get scan media results cmd support") Reviewed-by: Jonathan Cameron Link: https://lore.kernel.org/linux-cxl/20240819154206.16456-1-engguopeng@b= uaa.edu.cn/ Signed-off-by: peng guo Message-Id: <20240825102212.3871-1-engguopeng@buaa.edu.cn> 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 3ebbd32e10..9258e48f95 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -2076,7 +2076,7 @@ static CXLRetCode cmd_media_get_scan_media_results(co= nst struct cxl_cmd *cmd, =20 start =3D ROUND_DOWN(ent->start, 64ull); stop =3D ROUND_DOWN(ent->start, 64ull) + ent->length; - stq_le_p(&out->records[i].addr, start | (ent->type & 0x7)); + stq_le_p(&out->records[i].addr, start); stl_le_p(&out->records[i].length, (stop - start) / CXL_CACHE_LINE_= SIZE); i++; =20 --=20 MST From nobody Sun Nov 24 05:35:22 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=1726065142; cv=none; d=zohomail.com; s=zohoarc; b=c3l2DAhxeTx8G51X+N5Mqv/6fVlg8sC+f8QgUnNRvd35NQJGO+Vo0rlk3HBN540aADSA4IGr32OvsFWRi8PgN/BhHdybqlPvP0UPLhvEgpwTQRYzCBRsziVuAtsDh3Qj5KBvfIAOGhpSy3vYIe0RlDRz32MXA6A4OhmmV6kUtcU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726065142; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=DB9NGbeaAbvfzy7mNKPYp8OuO5yV58WQSC8D88JNFOQ=; b=JxYWk5FtCuHHAyIuGrx/6di3kfDgas59/QqB4Jhw5roK0qrUIa50lGh58oiRIhBpsgAofvbXoZSW/FflNiTyyNJ3ZXI1g+lbWSIUOBmrkI1f3IJrvPHbJ+nl34mJVraUqCVnBpVHoxmyhyQTDHO8gOsflbwG5/ux7JQUY5/nEE8= 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 1726065142280862.3291249694242; Wed, 11 Sep 2024 07:32:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOKA-0000Ao-KU; Wed, 11 Sep 2024 10:28:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJR-00079c-S1 for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOJN-0003NL-9A for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:27:15 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-UrGgz0SqPeKAk9b-vi0G1A-1; Wed, 11 Sep 2024 09:52:21 -0400 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-a8d2e6a6989so251058666b.1 for ; Wed, 11 Sep 2024 06:52:19 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c727e4sm614180366b.126.2024.09.11.06.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726064832; 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=DB9NGbeaAbvfzy7mNKPYp8OuO5yV58WQSC8D88JNFOQ=; b=eotXh7+4MPPvOD4EKTyVDdEgp3MYOHNK2m+0SbRwXUQ+wueZGqOPfF3aOwYbmC2PsQg5MB E2s+TT/SCsH+A4N3+AsB01uSd2U9KjACa051zXub8k9FhkNnbZKMmSPesrLKbup3hhgtoz t8qFZpe2tmK4G9a+4AjkY0x/Bzw7Yeg= X-MC-Unique: UrGgz0SqPeKAk9b-vi0G1A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062738; x=1726667538; 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:subject:date:message-id:reply-to; bh=DB9NGbeaAbvfzy7mNKPYp8OuO5yV58WQSC8D88JNFOQ=; b=hhD829JtsUSXq5Z2l1GvS/8MAJIFgm0/nuSyp8uK1MpsrxoGE7yhGnOl+kCw5UPeuo dU8Gcjnq4Xja1xKm5YaLc8xcvKQbtucGpkY6RD/x0NYfDI8/17G21mEqE9ndqruX5FNA fg4aWy894wXgpB1dL6PbfLFLSVJ3tRhMA37FB0RGCQ7iwvtFhaVBjVGCGMZH2ksqgUd8 qHjyWF7/xK2UKPLV2gJNjQzovRiSRIkZediTlE4Fg582N+GXJD+YOl3Hi+j6c+03jeTU hL6a6km7kKN4mP2NfNSPVZQcbNMn5/Jy6JLqsCajb9q6cCxCCA6KkAkPCpF5KQymtx4b 65ew== X-Gm-Message-State: AOJu0YxkbOexp//ys0yxBwvU8DbO9SqjqwRZUkYpQvMCIhBQM3nunXX0 Zyd5Zt+ruTbdb7jENW+9Iaz2OufPV6LX5Dvgeue45C4pZy2UDoxwPsefSZiEp39AKV2+50T2Pci eNr1MnOiW1laCY5o0OhCcatwuEClZ7Dw3S0XVnAqR3o3k/uTEbhTNQjVu5n7LFnWwvWi0orPnoa ec0O2SpKe9KGki2SEFp+Q5sp79xba2bw== X-Received: by 2002:a17:907:60ca:b0:a8d:3e29:a82d with SMTP id a640c23a62f3a-a8ffab771b9mr459881066b.37.1726062738367; Wed, 11 Sep 2024 06:52:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEyRf5v+DYP/9JUh8QHbJzGLb2wgjxLVIaqhTZr6pP7FjtSjnlbJet8bU6YApEOMBOSO/qlgQ== X-Received: by 2002:a17:907:60ca:b0:a8d:3e29:a82d with SMTP id a640c23a62f3a-a8ffab771b9mr459877466b.37.1726062737792; Wed, 11 Sep 2024 06:52:17 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Volker =?utf-8?Q?R=C3=BCmelin?= , Gerd Hoffmann , Manos Pitsidianakis Subject: [PULL 16/18] hw/audio/virtio-sound: fix heap buffer overflow Message-ID: <7fc6611cad3e9627b23ce83e550b668abba6c886.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726065142773116600 From: Volker R=C3=BCmelin Currently, the guest may write to the device configuration space, whereas the virtio sound device specification in chapter 5.14.4 clearly states that the fields in the device configuration space are driver-read-only. Remove the set_config function from the virtio_snd class. This also prevents a heap buffer overflow. See QEMU issue #2296. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2296 Signed-off-by: Volker R=C3=BCmelin Message-Id: <20240901130112.8242-1-vr_qemu@t-online.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/audio/virtio-snd.c | 24 ------------------------ hw/audio/trace-events | 1 - 2 files changed, 25 deletions(-) diff --git a/hw/audio/virtio-snd.c b/hw/audio/virtio-snd.c index d1cf5eb445..69838181dd 100644 --- a/hw/audio/virtio-snd.c +++ b/hw/audio/virtio-snd.c @@ -107,29 +107,6 @@ virtio_snd_get_config(VirtIODevice *vdev, uint8_t *con= fig) =20 } =20 -static void -virtio_snd_set_config(VirtIODevice *vdev, const uint8_t *config) -{ - VirtIOSound *s =3D VIRTIO_SND(vdev); - const virtio_snd_config *sndconfig =3D - (const virtio_snd_config *)config; - - - trace_virtio_snd_set_config(vdev, - s->snd_conf.jacks, - sndconfig->jacks, - s->snd_conf.streams, - sndconfig->streams, - s->snd_conf.chmaps, - sndconfig->chmaps); - - memcpy(&s->snd_conf, sndconfig, sizeof(virtio_snd_config)); - le32_to_cpus(&s->snd_conf.jacks); - le32_to_cpus(&s->snd_conf.streams); - le32_to_cpus(&s->snd_conf.chmaps); - -} - static void virtio_snd_pcm_buffer_free(VirtIOSoundPCMBuffer *buffer) { @@ -1400,7 +1377,6 @@ static void virtio_snd_class_init(ObjectClass *klass,= void *data) vdc->realize =3D virtio_snd_realize; vdc->unrealize =3D virtio_snd_unrealize; vdc->get_config =3D virtio_snd_get_config; - vdc->set_config =3D virtio_snd_set_config; vdc->get_features =3D get_features; vdc->reset =3D virtio_snd_reset; vdc->legacy_features =3D 0; diff --git a/hw/audio/trace-events b/hw/audio/trace-events index b1870ff224..b8ef572767 100644 --- a/hw/audio/trace-events +++ b/hw/audio/trace-events @@ -41,7 +41,6 @@ asc_update_irq(int irq, int a, int b) "set IRQ to %d (A: = 0x%x B: 0x%x)" =20 #virtio-snd.c virtio_snd_get_config(void *vdev, uint32_t jacks, uint32_t streams, uint32= _t chmaps) "snd %p: get_config jacks=3D%"PRIu32" streams=3D%"PRIu32" chmaps= =3D%"PRIu32"" -virtio_snd_set_config(void *vdev, uint32_t jacks, uint32_t new_jacks, uint= 32_t streams, uint32_t new_streams, uint32_t chmaps, uint32_t new_chmaps) "= snd %p: set_config jacks from %"PRIu32"->%"PRIu32", streams from %"PRIu32"-= >%"PRIu32", chmaps from %"PRIu32"->%"PRIu32 virtio_snd_get_features(void *vdev, uint64_t features) "snd %p: get_featur= es 0x%"PRIx64 virtio_snd_vm_state_running(void) "vm state running" virtio_snd_vm_state_stopped(void) "vm state stopped" --=20 MST From nobody Sun Nov 24 05:35:22 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=1726066825; cv=none; d=zohomail.com; s=zohoarc; b=dPgoW1xJLZGOw74g5it2aIn+OzT2bZyKzLsg8HBj/BEJnAUtiW47NjZ9ZI8i6zCc3/F+NiHZXf+/nolHGsT0HDYWUMt6TUn37LEAI6ew8jyKukGcLum/qMd3R70QE8YdUYOONvGBkQSoefqy2MBHAOlVuCzNMvb04xc2QzgFUvo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726066825; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4veiozMEGfv+9OEJSb+cGyfH7FXaz+7Wyk7isIZPzXI=; b=nMplmoCBQIL7FtXXZXvJOPWnwkzuDwkgZRhR/72T+RNhjtg1+yJkhj8YCF0aclLoabykB4Z7b/u434K0qYd/GPt+GIDRNPcz+1U+BmkQMTJyoJb2wCmc2jDNkN9dZWT6tpeXCyghaur2qgD9QSPSnxXnbj1zoY2knOulOEwKuIc= 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 1726066824963421.67928731770905; Wed, 11 Sep 2024 08:00:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOli-0006Zz-8z; Wed, 11 Sep 2024 10:56:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOig-0002ck-KS for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:53:29 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOid-0007IU-1t for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:53:20 -0400 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_256_GCM_SHA384) id us-mta-76-JNxwyFy8OGS6N0S9wd4tQA-1; Wed, 11 Sep 2024 09:52:23 -0400 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-374b981dd62so1079003f8f.3 for ; Wed, 11 Sep 2024 06:52:23 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd46886sm5388659a12.34.2024.09.11.06.52.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066398; 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=4veiozMEGfv+9OEJSb+cGyfH7FXaz+7Wyk7isIZPzXI=; b=VBZloT7g8sNtsVS+csbWn3h0Zy6zGrhaVDLTSaTHcnVNRgaTMvRnRgq/gjJwVvD8pbiO8H Y7KBftllqj8H9wL3GBEnw4L+tbG06lXsag569BW4YfcKfjAl3g/FFvgrHLpe283QdgrdnN SfAN22RyhJRwKcPw383LpNJhoAj4dFM= X-MC-Unique: JNxwyFy8OGS6N0S9wd4tQA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062742; x=1726667542; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4veiozMEGfv+9OEJSb+cGyfH7FXaz+7Wyk7isIZPzXI=; b=YuGQU+Y439gQWsqF1oLI37OSiObE1Te/gi8Ih/q49GvZXVvnA8s5ACtzS+1CipTwtw FjaWI8Bov6utRAjqWLz95an+xiB9GTEklaB+894hP0bcfX+uysog8EdbUmdwo0VAC6eN 4zAdSKOMw5Q5i0A8PFbBBe2F97ubiJdHoG0AcaO+HLHkkV/PX2Q3vWx+gcqfr3VHASiy kmoQpnEh/y8sCQ9+68G6ZL2rVQuf1u2XYnprF/NfamLCTqRzLa8ESxM5kAAWhf+QU0C5 UXlxOi7zzwkuk/QU5xgikXhKgaxiZomaeFJ4+XrKbTqiqqI8RB+oedD/vFDIG9evv86V dq5Q== X-Gm-Message-State: AOJu0YxkaoLhlzxiIwTkHUxyfXOVaLkY5UBLgiCJC1kc03cxh4ayD4r0 Zlef37Yh/EPGavQ4NhEpqXR7Clx5u+1yPhwFdeboNfKYYd+HkxfgV1F+QzluzWZqbbpOgbaasWC 7G/oBccmt8sYYlo15KHtXtcx0cRrvCE27GI5IRkrwhkaAmjB52dPL5ZPJ/8oVZqPtWtrkIbZOfa D9tgeWAyKXWaQpxYp+aRBHU8x1CI2NKg== X-Received: by 2002:a05:6000:156e:b0:378:7e94:d613 with SMTP id ffacd0b85a97d-378b07f6ad8mr2411386f8f.42.1726062741683; Wed, 11 Sep 2024 06:52:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3fvnhE/laytZOuXh9GtvogEZU9g8iP2CK+EAn9uPy3+gHAc7EKj5dFV1iyfaiUOt7pcxJ0Q== X-Received: by 2002:a05:6000:156e:b0:378:7e94:d613 with SMTP id ffacd0b85a97d-378b07f6ad8mr2411344f8f.42.1726062740959; Wed, 11 Sep 2024 06:52:20 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:18 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , David Hildenbrand , Gavin Shan , Juraj Marcin Subject: [PULL 17/18] virtio-mem: don't warn about THP sizes on a kernel without THP support Message-ID: <95b717a8154b955de2782305f305b63f357b0576.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726066827389116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: David Hildenbrand If the config directory in sysfs does not exist at all, we are dealing with a system that does not support THPs. Simply use 1 MiB block size then, instead of warning "Could not detect THP size, falling back to ..." and falling back to the default THP size. Cc: "Michael S. Tsirkin" Cc: Gavin Shan Cc: Juraj Marcin Signed-off-by: David Hildenbrand Message-Id: <20240910163433.2100295-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-mem.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c index ef64bf1b4a..4075f3d4ce 100644 --- a/hw/virtio/virtio-mem.c +++ b/hw/virtio/virtio-mem.c @@ -88,6 +88,7 @@ static uint32_t virtio_mem_default_thp_size(void) static uint32_t thp_size; =20 #define HPAGE_PMD_SIZE_PATH "/sys/kernel/mm/transparent_hugepage/hpage_pmd= _size" +#define HPAGE_PATH "/sys/kernel/mm/transparent_hugepage/" static uint32_t virtio_mem_thp_size(void) { gchar *content =3D NULL; @@ -98,6 +99,12 @@ static uint32_t virtio_mem_thp_size(void) return thp_size; } =20 + /* No THP -> no restrictions. */ + if (!g_file_test(HPAGE_PATH, G_FILE_TEST_EXISTS)) { + thp_size =3D VIRTIO_MEM_MIN_BLOCK_SIZE; + return thp_size; + } + /* * Try to probe the actual THP size, fallback to (sane but eventually * incorrect) default sizes. --=20 MST From nobody Sun Nov 24 05:35:22 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=1726067692; cv=none; d=zohomail.com; s=zohoarc; b=agubwGoG9qB6I0QtdZJvH/v7ZjDTnUwXXXHcelr6JDLKJB9wW4Fyn/NTM846Xpd5OyNnhoyYq06WdO83CUuLHuJpweiqnUcG/LkrI2ydbDikW1eYjN+9am03tepWRXCXpc9xD8ddQ5gez6f1e/zpwRRWxkqYLgwqahL42EfWwMY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1726067692; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2Jbb3zSd/FAyigLmm8Lyz5T3+QqcWo7wpMZLcIaqupo=; b=dwyIZrOxXBzpNAOurJr0qV9d3afhC1N/7Qjw7B5Gd9ksjxUBjNQwhSk6J8bS8wNC/skD2QrWWBC+N3akZpMkTbR++yH6xybgPRu/fVTTY4o1l93Ll+a6IZpBjnKFsCve+h8DTI4EkqMJhC1T3SEKKyrZhHVYepFSlzbGOGDI+Z0= 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 1726067692401876.7578773209541; Wed, 11 Sep 2024 08:14:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1soOqc-0000Xd-2f; Wed, 11 Sep 2024 11:01:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOjO-0005Zg-Nc for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:54:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1soOjM-0007Kf-8I for qemu-devel@nongnu.org; Wed, 11 Sep 2024 10:54:06 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-628-U_Vu12O9MAaTryrxCbcBUA-1; Wed, 11 Sep 2024 09:52:27 -0400 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-5c3c398b511so5902301a12.2 for ; Wed, 11 Sep 2024 06:52:26 -0700 (PDT) Received: from redhat.com ([2.55.9.133]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd8cdf7sm5424056a12.92.2024.09.11.06.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 06:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726066443; 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=2Jbb3zSd/FAyigLmm8Lyz5T3+QqcWo7wpMZLcIaqupo=; b=dkR4Fz7kS0LBnYfMQ7eUyVsUd6ibCM8UOiIzWtLPX5MAS7N7a2JDr+7XfZgvhgDto3kGCS 0EXDngq7++dDYeUvi2VzS0HaGD/8bA9DpGVb/jcJHL71t81VcswPSvLtKHkX1Dk8MUS4Qn Cns+RXr86+X67sj1zmnqFeuxcddyb9o= X-MC-Unique: U_Vu12O9MAaTryrxCbcBUA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726062745; x=1726667545; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2Jbb3zSd/FAyigLmm8Lyz5T3+QqcWo7wpMZLcIaqupo=; b=klS0f7B4hHHqs0K5I6tzo3JKoyf0V4oDB3tOUfCxfZhHoe8dwLAgXRm0c+pWGB2zzp JB1oqRajKo0dbq4YYl1GRude0cLaITDzUvOmtglQcKiJQ8DFKKvpX2nX2HimejMPsLcP m9rZx4XjQRcaZJJ3k3uxncuIU+N8Qr9guhbSaJrShMvCyyI2dPYn1gizJjSyjWRI6vO1 +XiSl1vxA3bLihPO3riQU1pserOHSubkQZDg3mC/rJOiSUisiHTeKl5ZJCH8TtoBIQ5N wrcHqOdLFLjqM1UKIaxwitTuLr3kq82gZ/hWqiB1lJT7FJEw1h9S8WSPDaP2qK7sNw+v od9A== X-Gm-Message-State: AOJu0YwnG5Ki1YMhlqP9VXmDSzQwT4U34QaaCXoKHngEnv2+OVtbZT1l YjSiX4L2XL+b+frU/d6HtKNhEqTzPyoaS/lqvPXudlLRU83wd6TtdpE2+95vDMWfc0BUkNYA5y8 59B0xNw5KZ/tYtx1UcxxZvfTm4GI6ruKhDcM80ZZ8ISFVGKUjEISLVF9ykz6xzVmKuSArK2A9qR gbsdV5KmLUu8fargOkkVqpiE2ojcBbOw== X-Received: by 2002:a05:6402:5188:b0:5c3:9fa9:1b72 with SMTP id 4fb4d7f45d1cf-5c3e95335d1mr13501485a12.6.1726062745174; Wed, 11 Sep 2024 06:52:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYbuGXOLRVFU4WvXWJNIWM/47EeOtk49Kxsno0na54m4y3am4dPgDW5XboDfLP1T0Ph57CpA== X-Received: by 2002:a05:6402:5188:b0:5c3:9fa9:1b72 with SMTP id 4fb4d7f45d1cf-5c3e95335d1mr13501446a12.6.1726062744563; Wed, 11 Sep 2024 06:52:24 -0700 (PDT) Date: Wed, 11 Sep 2024 09:52:21 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Dominic Prinz , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 18/18] hw/acpi/ich9: Add periodic and swsmi timer Message-ID: <6e3c2d58e967cde3dadae298e81c5e8eb9fb9080.1726062663.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: 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: -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.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1726067694223116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Dominic Prinz This patch implements the periodic and the swsmi ICH9 chipset timers. They = are especially useful when prototyping UEFI firmware (e.g. with EDK2's OVMF) using QEMU. For backwards compatibility, the compat properties "x-smi-swsmi-timer", and "x-smi-periodic-timer" are introduced. Additionally, writes to the SMI_STS register are enabled for the corresponding two bits using a write mask to make future work easier. Signed-off-by: Dominic Prinz Message-Id: <1d90ea69e01ab71a0f2ced116801dc78e04f4448.1725991505.git.git@dp= rinz.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ich9.h | 6 +++ include/hw/acpi/ich9_timer.h | 23 +++++++++ include/hw/southbridge/ich9.h | 4 ++ hw/acpi/ich9.c | 23 +++++++++ hw/acpi/ich9_timer.c | 93 +++++++++++++++++++++++++++++++++++ hw/i386/pc.c | 5 +- hw/isa/lpc_ich9.c | 14 ++++++ hw/acpi/meson.build | 2 +- 8 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 include/hw/acpi/ich9_timer.h create mode 100644 hw/acpi/ich9_timer.c diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 2faf7f0cae..245fe08dc2 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -46,6 +46,7 @@ typedef struct ICH9LPCPMRegs { uint32_t smi_en; uint32_t smi_en_wmask; uint32_t smi_sts; + uint32_t smi_sts_wmask; =20 qemu_irq irq; /* SCI */ =20 @@ -68,6 +69,11 @@ typedef struct ICH9LPCPMRegs { bool smm_compat; bool enable_tco; TCOIORegs tco_regs; + + bool swsmi_timer_enabled; + bool periodic_timer_enabled; + QEMUTimer *swsmi_timer; + QEMUTimer *periodic_timer; } ICH9LPCPMRegs; =20 #define ACPI_PM_PROP_TCO_ENABLED "enable_tco" diff --git a/include/hw/acpi/ich9_timer.h b/include/hw/acpi/ich9_timer.h new file mode 100644 index 0000000000..5112df4385 --- /dev/null +++ b/include/hw/acpi/ich9_timer.h @@ -0,0 +1,23 @@ +/* + * QEMU ICH9 Timer emulation + * + * Copyright (c) 2024 Dominic Prinz + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#ifndef HW_ACPI_ICH9_TIMER_H +#define HW_ACPI_ICH9_TIMER_H + +#include "hw/acpi/ich9.h" + +void ich9_pm_update_swsmi_timer(ICH9LPCPMRegs *pm, bool enable); + +void ich9_pm_swsmi_timer_init(ICH9LPCPMRegs *pm); + +void ich9_pm_update_periodic_timer(ICH9LPCPMRegs *pm, bool enable); + +void ich9_pm_periodic_timer_init(ICH9LPCPMRegs *pm); + +#endif diff --git a/include/hw/southbridge/ich9.h b/include/hw/southbridge/ich9.h index fd01649d04..6c60017024 100644 --- a/include/hw/southbridge/ich9.h +++ b/include/hw/southbridge/ich9.h @@ -196,8 +196,12 @@ struct ICH9LPCState { #define ICH9_PMIO_GPE0_LEN 16 #define ICH9_PMIO_SMI_EN 0x30 #define ICH9_PMIO_SMI_EN_APMC_EN (1 << 5) +#define ICH9_PMIO_SMI_EN_SWSMI_EN (1 << 6) #define ICH9_PMIO_SMI_EN_TCO_EN (1 << 13) +#define ICH9_PMIO_SMI_EN_PERIODIC_EN (1 << 14) #define ICH9_PMIO_SMI_STS 0x34 +#define ICH9_PMIO_SMI_STS_SWSMI_STS (1 << 6) +#define ICH9_PMIO_SMI_STS_PERIODIC_STS (1 << 14) #define ICH9_PMIO_TCO_RLD 0x60 #define ICH9_PMIO_TCO_LEN 32 =20 diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 02d8546bd3..c15e5b8281 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -35,6 +35,7 @@ #include "sysemu/runstate.h" #include "hw/acpi/acpi.h" #include "hw/acpi/ich9_tco.h" +#include "hw/acpi/ich9_timer.h" =20 #include "hw/southbridge/ich9.h" #include "hw/mem/pc-dimm.h" @@ -108,6 +109,18 @@ static void ich9_smi_writel(void *opaque, hwaddr addr,= uint64_t val, } pm->smi_en &=3D ~pm->smi_en_wmask; pm->smi_en |=3D (val & pm->smi_en_wmask); + if (pm->swsmi_timer_enabled) { + ich9_pm_update_swsmi_timer(pm, pm->smi_en & + ICH9_PMIO_SMI_EN_SWSMI_EN); + } + if (pm->periodic_timer_enabled) { + ich9_pm_update_periodic_timer(pm, pm->smi_en & + ICH9_PMIO_SMI_EN_PERIODI= C_EN); + } + break; + case 4: + pm->smi_sts &=3D ~pm->smi_sts_wmask; + pm->smi_sts |=3D (val & pm->smi_sts_wmask); break; } } @@ -286,6 +299,8 @@ static void pm_powerdown_req(Notifier *n, void *opaque) =20 void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) { + pm->smi_sts_wmask =3D 0; + memory_region_init(&pm->io, OBJECT(lpc_pci), "ich9-pm", ICH9_PMIO_SIZE= ); memory_region_set_enabled(&pm->io, false); memory_region_add_subregion(pci_address_space_io(lpc_pci), @@ -305,6 +320,14 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *p= m, qemu_irq sci_irq) "acpi-smi", 8); memory_region_add_subregion(&pm->io, ICH9_PMIO_SMI_EN, &pm->io_smi); =20 + if (pm->swsmi_timer_enabled) { + ich9_pm_swsmi_timer_init(pm); + } + + if (pm->periodic_timer_enabled) { + ich9_pm_periodic_timer_init(pm); + } + if (pm->enable_tco) { acpi_pm_tco_init(&pm->tco_regs, &pm->io); } diff --git a/hw/acpi/ich9_timer.c b/hw/acpi/ich9_timer.c new file mode 100644 index 0000000000..5b1c910156 --- /dev/null +++ b/hw/acpi/ich9_timer.c @@ -0,0 +1,93 @@ +/* + * QEMU ICH9 Timer emulation + * + * Copyright (c) 2024 Dominic Prinz + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/core/cpu.h" +#include "hw/pci/pci.h" +#include "hw/southbridge/ich9.h" +#include "qemu/timer.h" + +#include "hw/acpi/ich9_timer.h" + +void ich9_pm_update_swsmi_timer(ICH9LPCPMRegs *pm, bool enable) +{ + uint16_t swsmi_rate_sel; + int64_t expire_time; + ICH9LPCState *lpc; + + if (enable) { + lpc =3D container_of(pm, ICH9LPCState, pm); + swsmi_rate_sel =3D + (pci_get_word(lpc->d.config + ICH9_LPC_GEN_PMCON_3) & 0xc0) >>= 6; + + if (swsmi_rate_sel =3D=3D 0) { + expire_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 150000= 0LL; + } else { + expire_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + 8 * (1 << swsmi_rate_sel) * 1000000LL; + } + + timer_mod(pm->swsmi_timer, expire_time); + } else { + timer_del(pm->swsmi_timer); + } +} + +static void ich9_pm_swsmi_timer_expired(void *opaque) +{ + ICH9LPCPMRegs *pm =3D opaque; + + pm->smi_sts |=3D ICH9_PMIO_SMI_STS_SWSMI_STS; + ich9_generate_smi(); + + ich9_pm_update_swsmi_timer(pm, pm->smi_en & ICH9_PMIO_SMI_EN_SWSMI_EN); +} + +void ich9_pm_swsmi_timer_init(ICH9LPCPMRegs *pm) +{ + pm->smi_sts_wmask |=3D ICH9_PMIO_SMI_STS_SWSMI_STS; + pm->swsmi_timer =3D + timer_new_ns(QEMU_CLOCK_VIRTUAL, ich9_pm_swsmi_timer_expired, pm); +} + +void ich9_pm_update_periodic_timer(ICH9LPCPMRegs *pm, bool enable) +{ + uint16_t per_smi_sel; + int64_t expire_time; + ICH9LPCState *lpc; + + if (enable) { + lpc =3D container_of(pm, ICH9LPCState, pm); + per_smi_sel =3D pci_get_word(lpc->d.config + ICH9_LPC_GEN_PMCON_1)= & 3; + expire_time =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + + 8 * (1 << (3 - per_smi_sel)) * NANOSECONDS_PER_SECON= D; + + timer_mod(pm->periodic_timer, expire_time); + } else { + timer_del(pm->periodic_timer); + } +} + +static void ich9_pm_periodic_timer_expired(void *opaque) +{ + ICH9LPCPMRegs *pm =3D opaque; + + pm->smi_sts =3D ICH9_PMIO_SMI_STS_PERIODIC_STS; + ich9_generate_smi(); + + ich9_pm_update_periodic_timer(pm, + pm->smi_en & ICH9_PMIO_SMI_EN_PERIODIC_E= N); +} + +void ich9_pm_periodic_timer_init(ICH9LPCPMRegs *pm) +{ + pm->smi_sts_wmask |=3D ICH9_PMIO_SMI_STS_PERIODIC_STS; + pm->periodic_timer =3D + timer_new_ns(QEMU_CLOCK_VIRTUAL, ich9_pm_periodic_timer_expired, p= m); +} diff --git a/hw/i386/pc.c b/hw/i386/pc.c index ba0ff51183..8d84c22458 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -79,7 +79,10 @@ { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }= ,\ { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, }, =20 -GlobalProperty pc_compat_9_1[] =3D {}; +GlobalProperty pc_compat_9_1[] =3D { + { "ICH9-LPC", "x-smi-swsmi-timer", "off" }, + { "ICH9-LPC", "x-smi-periodic-timer", "off" }, +}; const size_t pc_compat_9_1_len =3D G_N_ELEMENTS(pc_compat_9_1); =20 GlobalProperty pc_compat_9_0[] =3D { diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index bd727b2320..ab17b76f54 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -43,6 +43,7 @@ #include "hw/southbridge/ich9.h" #include "hw/acpi/acpi.h" #include "hw/acpi/ich9.h" +#include "hw/acpi/ich9_timer.h" #include "hw/pci/pci_bus.h" #include "hw/qdev-properties.h" #include "sysemu/runstate.h" @@ -531,6 +532,15 @@ ich9_lpc_pmcon_update(ICH9LPCState *lpc) uint16_t gen_pmcon_1 =3D pci_get_word(lpc->d.config + ICH9_LPC_GEN_PMC= ON_1); uint16_t wmask; =20 + if (lpc->pm.swsmi_timer_enabled) { + ich9_pm_update_swsmi_timer( + &lpc->pm, lpc->pm.smi_en & ICH9_PMIO_SMI_EN_SWSMI_EN); + } + if (lpc->pm.periodic_timer_enabled) { + ich9_pm_update_periodic_timer( + &lpc->pm, lpc->pm.smi_en & ICH9_PMIO_SMI_EN_PERIODIC_EN); + } + if (gen_pmcon_1 & ICH9_LPC_GEN_PMCON_1_SMI_LOCK) { wmask =3D pci_get_word(lpc->d.wmask + ICH9_LPC_GEN_PMCON_1); wmask &=3D ~ICH9_LPC_GEN_PMCON_1_SMI_LOCK; @@ -826,6 +836,10 @@ static Property ich9_lpc_properties[] =3D { ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT, true), DEFINE_PROP_BIT64("x-smi-cpu-hotunplug", ICH9LPCState, smi_host_featur= es, ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT, true), + DEFINE_PROP_BOOL("x-smi-swsmi-timer", ICH9LPCState, + pm.swsmi_timer_enabled, true), + DEFINE_PROP_BOOL("x-smi-periodic-timer", ICH9LPCState, + pm.periodic_timer_enabled, true), DEFINE_PROP_END_OF_LIST(), }; =20 diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build index fa5c07db90..7f8ccc9b7a 100644 --- a/hw/acpi/meson.build +++ b/hw/acpi/meson.build @@ -24,7 +24,7 @@ acpi_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_true: file= s('pci-bridge.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c')) acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-s= tub.c')) acpi_ss.add(when: 'CONFIG_ACPI_VIOT', if_true: files('viot.c')) -acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c= ')) +acpi_ss.add(when: 'CONFIG_ACPI_ICH9', if_true: files('ich9.c', 'ich9_tco.c= ', 'ich9_timer.c')) acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c')) acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files= ('ipmi-stub.c')) acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c')) --=20 MST