From patchwork Wed Jan 15 18:08:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32550C02183 for ; Wed, 15 Jan 2025 18:10:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7om-0006If-0W; Wed, 15 Jan 2025 13:08:40 -0500 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 1tY7oj-0006I0-Tn for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:37 -0500 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 1tY7oi-0006UV-Dk for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964515; 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=m6fmu5UNbIG+Zy8TKEXBZ0Py33cRbkHlfHziwEK/kCk=; b=ZQaO3yloSOQBjl9t/45YaAlTRNbJW+fBufx4B2lqtuvOtSoXmxee9wsDfWAqttrcq6ov5y lIrdEiQvN3bazfdMP4W5FpLvPM/yptnumJo+oJpDnqApXFfaJsnN3e1cHMIso/SKm2KJX+ ghPZTcT4CZPe5ira5PxptrqqTg7/RiY= 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-271-xxJtlPcJNseZcQJ-4VX8BA-1; Wed, 15 Jan 2025 13:08:33 -0500 X-MC-Unique: xxJtlPcJNseZcQJ-4VX8BA-1 X-Mimecast-MFC-AGG-ID: xxJtlPcJNseZcQJ-4VX8BA Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-385d7611ad3so44609f8f.2 for ; Wed, 15 Jan 2025 10:08:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964512; x=1737569312; 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=m6fmu5UNbIG+Zy8TKEXBZ0Py33cRbkHlfHziwEK/kCk=; b=cJXxIsxjoFjDOC07lJdOLr/wMfL7Yz4jQ/SuBs6duFcCWf2perMVXAiWeWa9DtB4Um SVRIRKiqo6A8xbocUhFA42eYUk+FTF7OtaSB4oXL3VbBBIZKL1qz7Zvguvtee6g2+Hq3 37hTNib4BDQIKoHZXkNIbRhm1mnmk6KNJ0K3YTGph9lI/zun6W04fryztEk3QSikjuCU GmRCTGBFR+K8X0X0gPU2KudiOvLhCeFsCtbQJ6fWQ8Y1keoRyTBSpoAfM8uCHdowNW/x H9V6FQm//2GfI8sVCX8wp39Bws5XHMtmlOpEHrKDPFF2XtKy0HdPOTZS5xdVh5BeI6iz p8Qg== X-Gm-Message-State: AOJu0YzCZ0RyKiqSUHBUsaB39W/sLGRAH0q3a0KXnYr62mWzFldZXX9b VXv7fseZssE29dPxMIwlO2YUQP9Fl9rr7X6iB99AQ8gNnui150Auj48EOvXfrftZ4z0F02DJyvH QW5BgRTwrS5LZBE2OBxH6aek9mKBh2gse8O9ZhrxgaKWAzR0r9DNAiFkVR5X++EErMVUbzXCRA1 PAYI40/Sdy/qhAl+SXg+l4lZVvWJ59Fg== X-Gm-Gg: ASbGncvjS7wIaCfP47xi8v+5Ill0+c4+0ZX1eslpCysfZp92Oft6IbHoQfZzLxl619w RqZ4csaMLXcPgNi+nQ9CN505iPgK5cpmKMVsrNSGXwOiir5/eRCSvW8jfMH6XEPW8gkY73QCnLp /F8W0r3u7KkZos9DB/U5hDoK3EDkXSXbrPdsMyht8CxQbjQfNvfO3egvydOHfqMpgbWP0fa3isc 0K3WHhFVQYTdC3IPeMTrKt3OlJGFvf1eC7zwCgKriU2M1rYZz10 X-Received: by 2002:a05:6000:1563:b0:385:f44a:a53 with SMTP id ffacd0b85a97d-38a872cfe40mr21742476f8f.4.1736964512091; Wed, 15 Jan 2025 10:08:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHDJaD8CKwez+RznVpLdNivNogm5ATuB3y63h+XfrYTOdlxbIWQxZGVvPN/VDISNafahRZZw== X-Received: by 2002:a05:6000:1563:b0:385:f44a:a53 with SMTP id ffacd0b85a97d-38a872cfe40mr21742449f8f.4.1736964511676; Wed, 15 Jan 2025 10:08:31 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38378csm18138284f8f.25.2025.01.15.10.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:31 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Dorinda Bassey , Stefano Garzarella , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Subject: [PULL 01/48] virtio-gpu: Add definition for resource_uuid feature Message-ID: <1e77a4a32f8b7b6699a2f8b1f98e8fada902ba1f.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Dorinda Bassey Add the VIRTIO_GPU_F_RESOURCE_UUID feature to enable the assignment of resources UUIDs for export to other virtio devices. Signed-off-by: Dorinda Bassey Message-Id: <20241007070013.3350752-1-dbassey@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-gpu.h | 3 +++ hw/display/vhost-user-gpu.c | 8 ++++++++ hw/display/virtio-gpu-base.c | 3 +++ 3 files changed, 14 insertions(+) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index bd93672185..a42957c4e2 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -98,6 +98,7 @@ enum virtio_gpu_base_conf_flags { VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED, VIRTIO_GPU_FLAG_RUTABAGA_ENABLED, VIRTIO_GPU_FLAG_VENUS_ENABLED, + VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED, }; #define virtio_gpu_virgl_enabled(_cfg) \ @@ -114,6 +115,8 @@ enum virtio_gpu_base_conf_flags { (_cfg.flags & (1 << VIRTIO_GPU_FLAG_CONTEXT_INIT_ENABLED)) #define virtio_gpu_rutabaga_enabled(_cfg) \ (_cfg.flags & (1 << VIRTIO_GPU_FLAG_RUTABAGA_ENABLED)) +#define virtio_gpu_resource_uuid_enabled(_cfg) \ + (_cfg.flags & (1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED)) #define virtio_gpu_hostmem_enabled(_cfg) \ (_cfg.hostmem > 0) #define virtio_gpu_venus_enabled(_cfg) \ diff --git a/hw/display/vhost-user-gpu.c b/hw/display/vhost-user-gpu.c index 12d5c37ee5..2aed6243f6 100644 --- a/hw/display/vhost-user-gpu.c +++ b/hw/display/vhost-user-gpu.c @@ -631,6 +631,14 @@ vhost_user_gpu_device_realize(DeviceState *qdev, Error **errp) error_report("EDID requested but the backend doesn't support it."); g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_EDID_ENABLED); } + if (virtio_has_feature(g->vhost->dev.features, + VIRTIO_GPU_F_RESOURCE_UUID)) { + g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED; + } + if (virtio_has_feature(g->vhost->dev.features, + VIRTIO_GPU_F_RESOURCE_UUID)) { + g->parent_obj.conf.flags |= 1 << VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED; + } if (!virtio_gpu_base_device_realize(qdev, NULL, NULL, errp)) { return; diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 4fc7ef8896..7827536ac4 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -235,6 +235,9 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features, if (virtio_gpu_context_init_enabled(g->conf)) { features |= (1 << VIRTIO_GPU_F_CONTEXT_INIT); } + if (virtio_gpu_resource_uuid_enabled(g->conf)) { + features |= (1 << VIRTIO_GPU_F_RESOURCE_UUID); + } return features; } From patchwork Wed Jan 15 18:08:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8313AC02183 for ; Wed, 15 Jan 2025 18:10:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7op-0006JP-90; Wed, 15 Jan 2025 13:08:43 -0500 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 1tY7oo-0006JG-8Z for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:42 -0500 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 1tY7ol-0006V9-UL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964518; 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=J6zW/tI+F7p0x6goRAt5C2uJU7HPuN9SAqTiBTbnTho=; b=Laq/U5vRDVw4pQCyrUVnqUJukEjlJETIaaarWCfkyl2P0hsKTGnDN5Of03XfhTioFlcAhJ FDm8ON/tNGQFEJe1rAWXPN67awkykbS1siyQ/t8U4+awfLB61s3XMF24+I57q7qJSZGFgY PR84CB2ayKw9YJxxUbHK/tJDdJ53IxI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-Q5go176UMyeaYCDL9LuoAw-1; Wed, 15 Jan 2025 13:08:36 -0500 X-MC-Unique: Q5go176UMyeaYCDL9LuoAw-1 X-Mimecast-MFC-AGG-ID: Q5go176UMyeaYCDL9LuoAw Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361ecebc5bso36861405e9.1 for ; Wed, 15 Jan 2025 10:08:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964515; x=1737569315; 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=J6zW/tI+F7p0x6goRAt5C2uJU7HPuN9SAqTiBTbnTho=; b=dxHr3uIZ0J+FWkJflLtzhWYc2us7ZGPG6+gF3hZH/kzN5avPyXhmMncP5GgaEbrkkf /30NH0O44D8AW8YbAfEHX2YZDM4g2DUKgZEt1FVyfScJcaHwyJv/Qxx1BfeClngyWAMg xP7nDi704HCSqKXk6eoyaka5h/Mjp1FRukuWzv6MPUc0Lghe15oHVRQY0Nk0xUqbBH7h 1KPCt0GWgf3UGYA+fXiMrRBkdD+6iqCB7T5YNPcn0ycRCYElP6CrgY+BO+dmJBGsdIJq Xi22q4eiKv/5tlR5QGoxY96d24LXnd5bBHUNmndPNv2P9vzSdVcdqXbt/KfKBhS00Cv+ qfyQ== X-Gm-Message-State: AOJu0Yx+ZN22Lu2xM7CYkuBxMgRJHYvZIuT3u/yyJf3uuyPmUvw0nHGZ KpNSO2B7FCFsOqhUeCmkaXZBc+vkqugKcZeZ2/udNZxBvFeFAGBojMvHAwQPk9PVJDwXpcCwM2B CrXqve9KmCObYSZBgM1o7cqteil+gPrzGV380teWZn4NfgcfdS8ZNaygGmN678Fi09QbxhQFfAR jAhe/O6XJm2vwdxeqzkyVM6bgv8YMxjA== X-Gm-Gg: ASbGncstlvkJy/V4hHA1nUiljOSX2rz3p+PhWedg/K6xavCWlVWg+DsCsFycJnlCR60 4BHwusjNIoxVMe1aarxc/eV0UwFMc2pSwc1c3IRbtIAeZn+o8qxoGnge3W8EbAwMcDqJXTHePUa sST+Usfhw8w6p9IvK4Dcqc5z3ibUa0KcdAqtV8ed4EalZ5STpKDIfjDCvrAUCf5D0XzzlNFD+IQ zGjkvUi6YxM0mQ9ImaDnRZ7jHY3ni2OvCqweRlNxWoBXa9wv/CZ X-Received: by 2002:a5d:5f85:0:b0:387:86cf:4e87 with SMTP id ffacd0b85a97d-38a872deb33mr27774461f8f.15.1736964515263; Wed, 15 Jan 2025 10:08:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkEdSlnyCI6GfyLWe8aYr6j8sU27WGhXY9nSoAfTgOoEkAxv8uLmqHuGImGuQOR/4iNrkrjw== X-Received: by 2002:a5d:5f85:0:b0:387:86cf:4e87 with SMTP id ffacd0b85a97d-38a872deb33mr27774423f8f.15.1736964514878; Wed, 15 Jan 2025 10:08:34 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e383882sm18422257f8f.34.2025.01.15.10.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:34 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:32 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Sebastian Ott , Zhenyu Zhang , Alex Williamson , Marcel Apfelbaum Subject: [PULL 02/48] pci: ensure valid link status bits for downstream ports Message-ID: <694632fd44987cc4618612a38ad151047524a590.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Sebastian Ott PCI hotplug for downstream endpoints on arm fails because Linux' PCIe hotplug driver doesn't like the QEMU provided LNKSTA: pcieport 0000:08:01.0: pciehp: Slot(2): Card present pcieport 0000:08:01.0: pciehp: Slot(2): Link Up pcieport 0000:08:01.0: pciehp: Slot(2): Cannot train link: status 0x2000 There's 2 cases where LNKSTA isn't setup properly: * the downstream device has no express capability * max link width of the bridge is 0 Move the sanity checks added via 88c869198aa63 ("pci: Sanity test minimum downstream LNKSTA") outside of the branch to make sure downstream ports always have a valid LNKSTA. Signed-off-by: Sebastian Ott Tested-by: Zhenyu Zhang Message-Id: <20241203121928.14861-1-sebott@redhat.com> Reviewed-by: Alex Williamson Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/pcie.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c index 0b455c8654..1b12db6fa2 100644 --- a/hw/pci/pcie.c +++ b/hw/pci/pcie.c @@ -1113,18 +1113,22 @@ void pcie_sync_bridge_lnk(PCIDevice *bridge_dev) if ((lnksta & PCI_EXP_LNKSTA_NLW) > (lnkcap & PCI_EXP_LNKCAP_MLW)) { lnksta &= ~PCI_EXP_LNKSTA_NLW; lnksta |= lnkcap & PCI_EXP_LNKCAP_MLW; - } else if (!(lnksta & PCI_EXP_LNKSTA_NLW)) { - lnksta |= QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1); } if ((lnksta & PCI_EXP_LNKSTA_CLS) > (lnkcap & PCI_EXP_LNKCAP_SLS)) { lnksta &= ~PCI_EXP_LNKSTA_CLS; lnksta |= lnkcap & PCI_EXP_LNKCAP_SLS; - } else if (!(lnksta & PCI_EXP_LNKSTA_CLS)) { - lnksta |= QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT); } } + if (!(lnksta & PCI_EXP_LNKSTA_NLW)) { + lnksta |= QEMU_PCI_EXP_LNKSTA_NLW(QEMU_PCI_EXP_LNK_X1); + } + + if (!(lnksta & PCI_EXP_LNKSTA_CLS)) { + lnksta |= QEMU_PCI_EXP_LNKSTA_CLS(QEMU_PCI_EXP_LNK_2_5GT); + } + pci_word_test_and_clear_mask(exp_cap + PCI_EXP_LNKSTA, PCI_EXP_LNKSTA_CLS | PCI_EXP_LNKSTA_NLW); pci_word_test_and_set_mask(exp_cap + PCI_EXP_LNKSTA, lnksta & From patchwork Wed Jan 15 18:08:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BFE0C02183 for ; Wed, 15 Jan 2025 18:09:42 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7ov-0006Mo-GT; Wed, 15 Jan 2025 13:08:49 -0500 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 1tY7or-0006M1-Qr for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:45 -0500 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 1tY7op-0006VI-ME for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964521; 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=eDEb1jmCYlGsY9igpHDK8At5L72Z0Fy0/80IJEPSb0E=; b=Af8kAWTavQM3rO/e4dRWDGrHx9alJ9qepXAc4XIyZn+dVkrmS7VS9c8jKGV5PPFK6ECjUc ALJTRZWdgNG2cKwQdAr5figpQvU6YLcVCxBG/obuEeBAqMdo1lqBhHcEb+n1lKqRV28Pmc da/nP9aGmOWH2aqEPwnHlfmWKw2kaeI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-bC_ToINANyGpMyksH5xzzw-1; Wed, 15 Jan 2025 13:08:39 -0500 X-MC-Unique: bC_ToINANyGpMyksH5xzzw-1 X-Mimecast-MFC-AGG-ID: bC_ToINANyGpMyksH5xzzw Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-436289a570eso32464695e9.0 for ; Wed, 15 Jan 2025 10:08:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964518; x=1737569318; 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=eDEb1jmCYlGsY9igpHDK8At5L72Z0Fy0/80IJEPSb0E=; b=F0Knr/d+SwdG48s45orEm+2buWNLMA+Nt/1b0mDDA165ZC4NDhSyy1Zw/Y8IyJeVE8 794ysECAVfXPidPL0wdkXm81x2hInoUXFOCkkcspI3rfsC7T/LH6PMaa5jJrbMG8Pz7Q c9Qei0r5iA0qRTsBglFSsUi6nmCSmX8OA4OarGdhwwpfQcW6o8e1DHTY3eBJmid7GT0H TN7koVEKvOwoe0af9Q+pSjswuoyotisFmwkJHScsMbeb5niKFUCEFe/oNWJHkKfzRkKt +CG7jPhBSP1P53uU5mhc991VtIFBJAvxZeeHSqMITu82aXQG5iNLK5R77fpQ5JE01YmQ /Miw== X-Gm-Message-State: AOJu0Yx9X/+ooi8WT9iLcx14Yhp+kDeHidCTtv2XBXSUjJ0o66mxknQy LzqCfzwBUWGLvNVMJ+z6DM3/RPM6beBRySa3IkHk7Vl6u5vP5Ga31UFtPQtVmDsd8SqavwD8Ryn AQTRRzkzCFBXln1kEF8rAOLlXwnWHCGBCBpNURhHRsANerKaRd1W2pwG6QdvXhy/oyclxbKRuNr +oDLN17wspDc8+VEr3DD9CgWOU93EVEg== X-Gm-Gg: ASbGncsrc3Te2ZVQ4J/zO1M+LHUNFNskWptltkwKh/dGMMlhJxfZ2PkDf0rpXkk812i ft8UuDLA14YXk96sn7MklLRUPZXzgrw30tP/rRfBc28voHeNddhnKToYI0tuB3/Jh0giHgobf4b T+iZjB53wVZ1QHLWjjuyvOx33RuzKRWSTBYyUlT8H8Io9hVtqRvc3GqoGMLM9qSI67ppjM/aJps iKkNusT6HyQsQHgjutN7dr+M4o4JGH765To8FtgBSVYV+XvpKtG X-Received: by 2002:a05:600c:1e02:b0:434:f131:1e71 with SMTP id 5b1f17b1804b1-436f04e048cmr205157085e9.8.1736964517997; Wed, 15 Jan 2025 10:08:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGErAs7BJq0grzq6CVsX59y15FOyD2Vvu/EOBUzx2FqIr0DwQCLG2wx+zOqn4xKFoK4buAq9w== X-Received: by 2002:a05:600c:1e02:b0:434:f131:1e71 with SMTP id 5b1f17b1804b1-436f04e048cmr205156825e9.8.1736964517618; Wed, 15 Jan 2025 10:08:37 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d0b1sm18410878f8f.12.2025.01.15.10.08.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:36 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:35 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Eric Mackay , Ani Sinha Subject: [PULL 03/48] tests: acpi: whitelist expected blobs 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20241210163945.3422623-2-imammedo@redhat.com> Tested-by: Eric Mackay Acked-by: Ani Sinha Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..a1047913af 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,43 @@ /* 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", +"tests/data/acpi/x86/q35/DSDT.acpierst", +"tests/data/acpi/x86/q35/DSDT.acpihmat", +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x", +"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator", +"tests/data/acpi/x86/q35/DSDT.applesmc", +"tests/data/acpi/x86/q35/DSDT.bridge", +"tests/data/acpi/x86/q35/DSDT.core-count", +"tests/data/acpi/x86/q35/DSDT.core-count2", +"tests/data/acpi/x86/q35/DSDT.cphp", +"tests/data/acpi/x86/q35/DSDT.cxl", +"tests/data/acpi/x86/q35/DSDT.dimmpxm", +"tests/data/acpi/x86/q35/DSDT.ipmibt", +"tests/data/acpi/x86/q35/DSDT.ipmismbus", +"tests/data/acpi/x86/q35/DSDT.ivrs", +"tests/data/acpi/x86/q35/DSDT.memhp", +"tests/data/acpi/x86/q35/DSDT.mmio64", +"tests/data/acpi/x86/q35/DSDT.multi-bridge", +"tests/data/acpi/x86/q35/DSDT.noacpihp", +"tests/data/acpi/x86/q35/DSDT.nohpet", +"tests/data/acpi/x86/q35/DSDT.numamem", +"tests/data/acpi/x86/q35/DSDT.pvpanic-isa", +"tests/data/acpi/x86/q35/DSDT.thread-count", +"tests/data/acpi/x86/q35/DSDT.thread-count2", +"tests/data/acpi/x86/q35/DSDT.tis.tpm12", +"tests/data/acpi/x86/q35/DSDT.tis.tpm2", +"tests/data/acpi/x86/q35/DSDT.type4-count", +"tests/data/acpi/x86/q35/DSDT.viot", +"tests/data/acpi/x86/q35/DSDT.xapic", From patchwork Wed Jan 15 18:08:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 703DAC02180 for ; Wed, 15 Jan 2025 18:09:23 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7ow-0006N6-5H; Wed, 15 Jan 2025 13:08:50 -0500 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 1tY7ot-0006MR-AJ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:47 -0500 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 1tY7or-0006VR-Ia for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964524; 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=8wJJjJt30l1/qgQLW37za6mc4YGsCzqM5YuQJ0KkPbo=; b=PGLbMjth2o07lnsHYu7uXzVs4fkgL/7J+XYtJ02gFnAG6YHg5Rb4iHk5InPgVKrc67Sl14 hZrQhHstsWNVlkHdFdKgvThkm0Td0Tx91cV8iIcjFf7onZMEoQODbPnssbJtcxTUAq8SEY 8n0hkUvar2wk+thhZv2/Fh8XAGZ0k4A= 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-172-P4ShFd6vOrWzQrDQlRPoPw-1; Wed, 15 Jan 2025 13:08:42 -0500 X-MC-Unique: P4ShFd6vOrWzQrDQlRPoPw-1 X-Mimecast-MFC-AGG-ID: P4ShFd6vOrWzQrDQlRPoPw Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-38a9118c486so62005f8f.1 for ; Wed, 15 Jan 2025 10:08:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964521; x=1737569321; 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=8wJJjJt30l1/qgQLW37za6mc4YGsCzqM5YuQJ0KkPbo=; b=oMMjhpqE7+bm7Z8v575qD54r7xBO6UrJuuaQ3uGLeAWuWabWGcA1J8PIiTXYfLDUsG zZc+nSZ4ikZHUyvT2ycfDjQb7SkjNHyhjwvZU2hEmGL1yUHhOqLOQz3rgUKKqmsX+XTf zfMYHCBepfisFA7P85s/Codtxm5O30a89MxOy8ss/ugkeXGq/rneHvYTVYXebOoShQAs y2vRtQqoMLvhLqblwnPr/10hOKZ9EZ4SLnjOgs8V9RR+oVlbW/DLR5W+jN1n7H7osLYa V7j5euhGmf0Np0aliaivk/uZs2MOQHjTun2OlEDB6ANQUEMR2bmrKB5Gajy/Ln17+SJ1 0L+Q== X-Gm-Message-State: AOJu0Yx9hBAQU2pgGsqanMIDmkxajg976njv8k4xaEeu6n2VOq6zpJ+s 9hlTHzDsqpEwmFrQ5/PH1Ugi1G4wBjARAFOCNG6MHb1GO4elWw7bFS9IjtuHSqkDyJz9hxYw1H3 OGgqrxaKQegXQ7u4bgNr3Acoa1cYWFi5XNZsXhyzvh9w5U+5CqgAjadowBzAi2PGaZJBunOpQD+ n1zLAPXofpTTHx+nt8C6ipR0JOB6qTpQ== X-Gm-Gg: ASbGncumq6ShsDbCMXfgowAHAsZDJ4iJ4nPgKSbKuZELRDv4Frl2UpbUctTHEFx76s0 QU0RrSSzqWjsctgjyYWQEVS0/4B84TlPj7T2pYKWU79/D51c1TJ2LH0Kch7E++jZtZy6RQpEY6z 3HCdfNUF7vmS2bNGCSVjXShnto3q6pLE/5X2/w7eZmpm5BEOfEhVmrpDLm/j4mdx5J9oApmRGD8 x3us/tDkWTMN9d11t8WnHJ0exJ0SSn/ZMmR7AbbPbdP0PPficq9 X-Received: by 2002:adf:9b9a:0:b0:38a:4575:5ffd with SMTP id ffacd0b85a97d-38a8730fbedmr21782191f8f.45.1736964521034; Wed, 15 Jan 2025 10:08:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeWMus/iA2fkkBLWPOgRikLyUIsc5gxU7c78rB3JNReuG5lO00yzPsGht3zBzat+Y0/SKtjQ== X-Received: by 2002:adf:9b9a:0:b0:38a:4575:5ffd with SMTP id ffacd0b85a97d-38a8730fbedmr21782166f8f.45.1736964520569; Wed, 15 Jan 2025 10:08:40 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4c1b05sm18070503f8f.88.2025.01.15.10.08.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:39 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:37 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Eric Mackay , Ani Sinha Subject: [PULL 04/48] cpuhp: make sure that remove events are handled within the same SCI Message-ID: <8aa35bebeeaed19ae57afbc3e110b8e7fe8587d0.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov CPU_SCAN_METHOD was processing insert events first and only if insert event was not present then it would check remove event. Normally it's not an issue as it doesn't make much sense tho hotplug and immediately unplug it. In this corner case, which can be reproduced with: qemu -smp 1,maxcpus=2 -cpu host -monitor stdio \ -drive if=pflash,format=raw,readonly,file=edk2-x86_64-code.fd * boot till GRUB prompt and pause guest (either via monitor or stop GRUB from automatic boot) * at monitor prompt add CPU: device_add host-x86_64-cpu,socket-id=0,core-id=1,thread-id=0,id=foo * let guest OS boot completely, and unplug CPU from monitor prompt: device_del foo which triggers GPE event that leads to CPU_SCAN_METHOD on guest side as result of above cpu 'foo' will not be hotunplugged, since QEMU sees insert event and ignores remove event (leaving it in pending state) for the GPE event. Any follow up CPU hotplug/unplug action from QEMU side will handle previously ignored event, so as workaround user can repeat device_del. Fix this corner-case by queuing remove events independently from insert events, aka the same way as we do with insert events. And then go over remove queue to send eject notify events to OSPM within the same GPE event. PS: Process remove queue after the cpu add queue has been processed 1st to ensure that OSPM gets hotadd evets after hotremove ones. PS2: Case where it's still borken happens when guest OS is Linux and device_del happens before guest OS initializes ACPI subsystem. Culprit in this case though is the guest kernel, which mangles GPE.sts (by clearing them up) and thus pending SCI turns to NOP leaving insert/remove events in pending state. That is the guest bug and should be fixed there. Signed-off-by: Igor Mammedov Reported-by: Eric Mackay Message-Id: <20241210163945.3422623-3-imammedo@redhat.com> Tested-by: Eric Mackay Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/cpu.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 9d530a24da..f70a2c045e 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -327,6 +327,7 @@ const VMStateDescription vmstate_cpu_hotplug = { #define CPU_EJECT_METHOD "CEJ0" #define CPU_OST_METHOD "COST" #define CPU_ADDED_LIST "CNEW" +#define CPU_EJ_LIST "CEJL" #define CPU_ENABLED "CPEN" #define CPU_SELECTOR "CSEL" @@ -488,7 +489,6 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, method = aml_method(CPU_SCAN_METHOD, 0, AML_SERIALIZED); { const uint8_t max_cpus_per_pass = 255; - Aml *else_ctx; Aml *while_ctx, *while_ctx2; Aml *has_event = aml_local(0); Aml *dev_chk = aml_int(1); @@ -499,6 +499,8 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, Aml *uid = aml_local(3); Aml *has_job = aml_local(4); Aml *new_cpus = aml_name(CPU_ADDED_LIST); + Aml *ej_cpus = aml_name(CPU_EJ_LIST); + Aml *num_ej_cpus = aml_local(5); aml_append(method, aml_acquire(ctrl_lock, 0xFFFF)); @@ -513,6 +515,8 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, */ aml_append(method, aml_name_decl(CPU_ADDED_LIST, aml_package(max_cpus_per_pass))); + aml_append(method, aml_name_decl(CPU_EJ_LIST, + aml_package(max_cpus_per_pass))); aml_append(method, aml_store(zero, uid)); aml_append(method, aml_store(one, has_job)); @@ -527,6 +531,7 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_append(while_ctx2, aml_store(one, has_event)); aml_append(while_ctx2, aml_store(zero, num_added_cpus)); + aml_append(while_ctx2, aml_store(zero, num_ej_cpus)); /* * Scan CPUs, till there are CPUs with events or @@ -559,8 +564,10 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, * if CPU_ADDED_LIST is full, exit inner loop and process * collected CPUs */ - ifctx = aml_if( - aml_equal(num_added_cpus, aml_int(max_cpus_per_pass))); + ifctx = aml_if(aml_lor( + aml_equal(num_added_cpus, aml_int(max_cpus_per_pass)), + aml_equal(num_ej_cpus, aml_int(max_cpus_per_pass)) + )); { aml_append(ifctx, aml_store(one, has_job)); aml_append(ifctx, aml_break()); @@ -577,16 +584,16 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_append(ifctx, aml_store(one, has_event)); } aml_append(while_ctx, ifctx); - else_ctx = aml_else(); + ifctx = aml_if(aml_equal(rm_evt, one)); { - aml_append(ifctx, - aml_call2(CPU_NOTIFY_METHOD, uid, eject_req)); - aml_append(ifctx, aml_store(one, rm_evt)); + /* cache to be removed CPUs to Notify later */ + aml_append(ifctx, aml_store(uid, + aml_index(ej_cpus, num_ej_cpus))); + aml_append(ifctx, aml_increment(num_ej_cpus)); aml_append(ifctx, aml_store(one, has_event)); } - aml_append(else_ctx, ifctx); - aml_append(while_ctx, else_ctx); + aml_append(while_ctx, ifctx); aml_append(while_ctx, aml_increment(uid)); } aml_append(while_ctx2, while_ctx); @@ -620,6 +627,24 @@ void build_cpus_aml(Aml *table, MachineState *machine, CPUHotplugFeatures opts, aml_append(while_ctx, aml_increment(cpu_idx)); } aml_append(while_ctx2, while_ctx); + + /* + * Notify OSPM about to be removed CPUs and clear remove flag + */ + aml_append(while_ctx2, aml_store(zero, cpu_idx)); + while_ctx = aml_while(aml_lless(cpu_idx, num_ej_cpus)); + { + aml_append(while_ctx, + aml_store(aml_derefof(aml_index(ej_cpus, cpu_idx)), + uid)); + aml_append(while_ctx, + aml_call2(CPU_NOTIFY_METHOD, uid, eject_req)); + aml_append(while_ctx, aml_store(uid, cpu_selector)); + aml_append(while_ctx, aml_store(one, rm_evt)); + aml_append(while_ctx, aml_increment(cpu_idx)); + } + aml_append(while_ctx2, while_ctx); + /* * If another batch is needed, then it will resume scanning * exactly at -- and not after -- the last CPU that's currently From patchwork Wed Jan 15 18:08:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D733C02185 for ; Wed, 15 Jan 2025 18:11:54 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7p1-0006OB-EZ; Wed, 15 Jan 2025 13:08:55 -0500 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 1tY7oz-0006Ne-BB for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:53 -0500 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 1tY7ov-0006W9-El for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964528; 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=3FeAuh1rxp1eg5yr5tRzEYlxvGW6OBKkk6dC9Q5CjiM=; b=XcxRiwungcyDXSapVBO2GOgH1NKQSpv8oC3emVYK3lx/20nMQ854azv2/7WBq2IgqTmciK OqxCNMG05lXlCC1v0sXs+qL1bJT3PZWZ2vPRXXrsqiKeOhxPFxC8edkgY66nCvxrZh21BR FSNaBU2PKQt8sAhSmiEfWP4eDqMjYj0= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-3QK4xvOWOi2XjVg_fbpPoA-1; Wed, 15 Jan 2025 13:08:46 -0500 X-MC-Unique: 3QK4xvOWOi2XjVg_fbpPoA-1 X-Mimecast-MFC-AGG-ID: 3QK4xvOWOi2XjVg_fbpPoA Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-386333ea577so38859f8f.1 for ; Wed, 15 Jan 2025 10:08:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964525; x=1737569325; 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=3FeAuh1rxp1eg5yr5tRzEYlxvGW6OBKkk6dC9Q5CjiM=; b=hgX2BV/EUrKnK12BKDzGOfTdByEtMzFiIpy5FSGEUA30IDBWTjW1UGUYnn8OVPcr9j 2IXG7bubWrtW5y7cXMIeh7wSmTM7diUDn3Ew/PhpCtmNqyo6njChyiLUtrk8gYxfYleo mYJZsQh8NhB8LpmHD9MupmiiX4YDVL2bZA4atrJK0BUQliLU0sgKPPmAJFL5EbifGJGz 2M3S+kLgtltmbyYTZ4ONjRUPrZr0/GsU7fUesh7VFYk6ta/B7HFZxSCOIGIqlpcfNik2 74sXsu9LyCTeAL4pbzZUSDloQMRJ5sFTAmbTeM8J8/zh2ZmpIl9Fzx8lqI98YonJKYAP DboQ== X-Gm-Message-State: AOJu0YwVe2EZpR9tp4eSkfDGEFa40xEpyHnD8/Bn8069gysCNTWMDNUH rxzWr4fqqF2A/kWPcsvAzXZZBLgnrYYCXU+diRaLaGNw6IUzAur0sEB6QtGiLLBsbW0vmkJPAir XHtDz6JGT668lC5VghJRRmHUcVXDGo8AJQKnpF0HIv8i6YpkKuMqhyTr4J+BN4pYayb/V3MzHTS ooiUvcqZ6zeClzWJ2516x/5T3ZwfZZDA== X-Gm-Gg: ASbGncvTPK8OZD1dEPDP24mT7HPpXuBKiqRuzqUk7RMPRCHCPBLljWYRigUFqs4zYBh Z+pXVqb9W37p1Allco3UQ3a0lyNaKrujlgJkAPHVapW0zX3kBP643CwNXJ25QEoL4GZjHVLHOkp aRI4Mdt2D9skYBDrPnDoEdltUi5V9fIKctElKqgYQSlNmvYBiOeRVQSe5yj76tWIzdLNGVoFHgJ 5JlTE2FIefPp5qDC3s0omW6gzn0EH6eNTPybx3iilYY5C3NXlME X-Received: by 2002:adf:a411:0:b0:38a:87cc:fbee with SMTP id ffacd0b85a97d-38a87ccfd10mr20253190f8f.14.1736964524434; Wed, 15 Jan 2025 10:08:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFd75eugmtAzHK9kKC4FU2FyRyVn3R9Sgrt8ZjRqDvlMqDfdZa7tRuGmHRqhuEFHZBSIAvZbA== X-Received: by 2002:adf:a411:0:b0:38a:87cc:fbee with SMTP id ffacd0b85a97d-38a87ccfd10mr20253158f8f.14.1736964523482; Wed, 15 Jan 2025 10:08:43 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c749a127sm31754215e9.7.2025.01.15.10.08.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:42 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:40 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Eric Mackay , Ani Sinha Subject: [PULL 05/48] tests: acpi: update expected blobs Message-ID: <9ccb69df554a5204077cda101b7bcf0f19544553.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov previous patch has changed cpu hotplug AML, expected diff: @@ -2942,6 +2942,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { Acquire (\_SB.PCI0.PRES.CPLK, 0xFFFF) Name (CNEW, Package (0xFF) {}) + Name (CEJL, Package (0xFF) {}) Local3 = Zero Local4 = One While ((Local4 == One)) @@ -2949,6 +2950,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) Local4 = Zero Local0 = One Local1 = Zero + Local5 = Zero While (((Local0 == One) && (Local3 < One))) { Local0 = Zero @@ -2959,7 +2961,7 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) Break } - If ((Local1 == 0xFF)) + If (((Local1 == 0xFF) || (Local5 == 0xFF))) { Local4 = One Break @@ -2972,10 +2974,11 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) Local1++ Local0 = One } - ElseIf ((\_SB.PCI0.PRES.CRMV == One)) + + If ((\_SB.PCI0.PRES.CRMV == One)) { - CTFY (Local3, 0x03) - \_SB.PCI0.PRES.CRMV = One + CEJL [Local5] = Local3 + Local5++ Local0 = One } @@ -2992,6 +2995,16 @@ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) \_SB.PCI0.PRES.CINS = One Local2++ } + + Local2 = Zero + While ((Local2 < Local5)) + { + Local3 = DerefOf (CEJL [Local2]) + CTFY (Local3, 0x03) + \_SB.PCI0.PRES.CSEL = Local3 + \_SB.PCI0.PRES.CRMV = One + Local2++ + } } Release (\_SB.PCI0.PRES.CPLK) Signed-off-by: Igor Mammedov Message-Id: <20241210163945.3422623-4-imammedo@redhat.com> Tested-by: Eric Mackay Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 42 ------------------ tests/data/acpi/x86/pc/DSDT | Bin 8526 -> 8593 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8437 -> 8504 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9851 -> 9918 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15397 -> 15464 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 8990 -> 9057 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10180 -> 10247 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8477 -> 8544 bytes tests/data/acpi/x86/pc/DSDT.hpbrroot | Bin 5033 -> 5100 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8598 -> 8665 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9885 -> 9952 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8384 -> 8451 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8532 -> 8599 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12319 -> 12386 bytes tests/data/acpi/x86/q35/DSDT | Bin 8355 -> 8422 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8372 -> 8439 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9680 -> 9747 bytes .../data/acpi/x86/q35/DSDT.acpihmat-generic-x | Bin 12565 -> 12632 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8634 -> 8701 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8401 -> 8468 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 11968 -> 12035 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12913 -> 12980 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33770 -> 33837 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8819 -> 8886 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13146 -> 13213 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10009 -> 10076 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8430 -> 8497 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8443 -> 8510 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8372 -> 8439 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9714 -> 9781 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9485 -> 9552 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13208 -> 13275 bytes tests/data/acpi/x86/q35/DSDT.noacpihp | Bin 8235 -> 8302 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8213 -> 8280 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8361 -> 8428 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8456 -> 8523 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12913 -> 12980 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33770 -> 33837 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 8961 -> 9028 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 8987 -> 9054 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18589 -> 18656 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14612 -> 14679 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35718 -> 35785 bytes 43 files changed, 42 deletions(-) diff --git a/tests/data/acpi/x86/pc/DSDT b/tests/data/acpi/x86/pc/DSDT index 8b8235fe79e2fa08a6f840c8479edb75f5a047b9..60d50b088a362556fd54395cb15364d6c0936be5 100644 GIT binary patch delta 191 zcmX@-G|`#MCDUq!chF6fh(fFr+T>=Ym1>}e1XEtR1(b#ghspHu-u(jq68 psY$5?&0vWnhGgdux5#8J=E*bp)mejl!%CAT$MK16zRh1O2mpbPI&}a5 delta 140 zcmV;70CWG5L(W19L{mgmP9XpQ0co)cxeNkNK9j`^umVjplXngM2Sye{Q$tP&lN}Bh zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5OWbzU?~#- diff --git a/tests/data/acpi/x86/pc/DSDT.acpierst b/tests/data/acpi/x86/pc/DSDT.acpierst index 06829b9c6c6d726d955dc7c99bc9f42448e22aeb..4c434c25c0b1602f22128e352781df498fa69ddf 100644 GIT binary patch delta 191 zcmezBxWkFdCDvQVJLo3K$X#7*ZGcaZldF=gYx2adINp z|H-M7nfM))7N|^)(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I=P(RPpW_+X^|7l p)TGpcX0SvOL$Y&-TVyg9^W>TQ>a0P&VWmlv$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5E>Em)hYD= diff --git a/tests/data/acpi/x86/pc/DSDT.acpihmat b/tests/data/acpi/x86/pc/DSDT.acpihmat index 2fe355ebdbb858fa9247d09112e21712e3eddc45..61b7d5caa55c44dbf69d649110c6b14bb4c3fdf5 100644 GIT binary patch delta 175 zcmezEv(J~yCDvQVJLo3K$X#7*ZGcb5GvO=f}Y}adINp|H-M7`S=}_7N|^) z(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I=PwOPo{t&X^|7l)TGpcX0SvOL$Y&- ZTVyg9b3yWCM?O{NAm6af=lR!&0RY%RHrfCH delta 117 zcmV-*0E+*vQVJLo3K$X#7*ZGcaZldF=gYx2adINp z|H-M7nfM))7N|^)(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I=P(RPpW_+X^|7l p)TGpcX0SvOL$Y&-TVyg9^W>TQ>a0P&VWmlvL{mgmB|HEC0e7(qxeNkNK9j`^umVjplXngM2Sye{Q$tP&lN}Bh zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5K1hi?{ulVG1 zd>qOg&aPfQLQMY)7?KMZQx-XhO-^AfU`Q!oOekPTEMQ1omGh zPPXTFU|ygydGbPjVIIbUkq;Fd oLsUjtV+sRs0bDNxUsFO~P(w*DP*O!xLsCsvld%s@vqcab6Skcv^Z)<= diff --git a/tests/data/acpi/x86/pc/DSDT.dimmpxm b/tests/data/acpi/x86/pc/DSDT.dimmpxm index 205219b99d903555125c4b07fc047c42993eb338..5b6471c8db9003b39bf5e20af34061f3e71cdbd5 100644 GIT binary patch delta 173 zcmX@&-yXo_66_MfuED^-7{8J0EDw`+$mE+m8<;#jH+Sg6NE z^uK^1xqvZck%QRe6vhIElmf>AO`El?~oSew@e{$+%D}D#11uBzc z^jYGAo#F$WJq-eaT!Wp1e8U(Ek~=`Ar81PJPF~ONCsn|Zw8)8NYEo)JGgu;tA=x>^ XEi##ldGbYmb><-7u+6{uPl^Ko(i=8M delta 141 zcmZni{HU?q4@&S$uasY@xe~<0nVNV0YR?8 e&OyFmjLso$k;z=l1&mlEC$Hi6+w354TpR%WuPVd< diff --git a/tests/data/acpi/x86/pc/DSDT.hpbridge b/tests/data/acpi/x86/pc/DSDT.hpbridge index 8fa8b519ec65bd5099c45f4e1c85b11b47a23845..67fe28699fbb261cfc7a52b2291f9965ab93c6a8 100644 GIT binary patch delta 191 zcmbR1^uUSBCDvQVJLo3K$X#7*ZGcaZldF=gYx2adINp z|H-M7nfM))7N|^)(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I=P(RPpW_+X^|7l p)TGpcX0SvOL$Y&-TVyg9^W>TQ>a0P&VWmlv$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5JC}S!YKj( diff --git a/tests/data/acpi/x86/pc/DSDT.hpbrroot b/tests/data/acpi/x86/pc/DSDT.hpbrroot index 01719462a72fd6d40ce433dac601e4b94eae574c..077a4cc988dc417a1bc9317dddd2dbd96ff1ff50 100644 GIT binary patch delta 195 zcmZ3f{zje4CD9Bw8j=gAe^8<-p{CTsEhW%rbF4tDnAn0$dpT${t$ z&ox|#=|6|FtCx=u)Bgg7vQVJLo3K$X#7*ZGcaZgU=_2uB3I60B) z|K!xkTX`Ln7N|^)(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I$4X)PpW_+X^|7l t)TGpcX0SvOL$Y&-TVyg9^W=P9vB`gV1X+W8!%CAT3-XF>?&FhY1pt{dJ23zN delta 157 zcmaE(zEYjbCD2JCu{NiWp@*E4tDnAn0$dpT!F*c z&ox|#>3;!3asgw?A{U{_DU1aSDFuuP1q_Lce0U}o@cJ@yPEMSBl-I#@q4@&S$uasY u@xe~<0nVNV0YR?8&OyFmjLso$k;z=l1&mlEC#&=MO%~)8+kBBvniT*|~5 diff --git a/tests/data/acpi/x86/pc/DSDT.ipmikcs b/tests/data/acpi/x86/pc/DSDT.ipmikcs index 0ca664688b16baa3a06b8440181de4f17511c6b0..9b2e81a7bcefb5c0e2dfbd2bbc5b6ea501f86306 100644 GIT binary patch delta 191 zcmbQ{eAAiBCDf~~MKdAzSq(x3F pQ$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5W5k-i7GGv diff --git a/tests/data/acpi/x86/pc/DSDT.memhp b/tests/data/acpi/x86/pc/DSDT.memhp index 03ff464ba4e72082fce0921815cfc09ca20b561a..9c66ccf150af1622d1b788a1ae04a6e5136cff9e 100644 GIT binary patch delta 191 zcmbR1`@omWCDUq!chF6fh(fFr+T>=Ym1>}e1XEtR1(b#ghspHu-u(jq68 psY$5?&0vWnhGgdux5#8J=E*bp)mejl!%CAT$MK16zRiC~3;@iTJ1_tM delta 140 zcmV;70CWG~O`S~&L{mgmohASP0b8*OxeNkDKa<4_umVFglXngM2Sye{Q$tP&lN}Bh zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5W*IV{wdA? diff --git a/tests/data/acpi/x86/pc/DSDT.nohpet b/tests/data/acpi/x86/pc/DSDT.nohpet index b081030f0ed171e52b13e28cfdc8770a04c2806e..28dbd8d8949d1421da9312cf0440d7ae3b64916e 100644 GIT binary patch delta 195 zcmX@$*zCmR66_MftjNH?$gz=2n}^BCd9pdr1||oK$uD{SvU^H72Rr+5Oz!6u*XD5c za}5__`p@C)>g6NE^uK^1xqvZck-zBV6vhIElmf=%Kd^z|gPEO?d zKRI=B37><~0+q=z`YiFmPVoWGo(2IyuEEYhzF~|7$sHimQW;89C%@$LlPX|HTI9qs tH7T{A87z^+kn9}d7MaY&JXw!VZ1NsnLDnGOu+pT-7kI@s`|=kH0sxakI)4BF delta 157 zcmZp6I^f9V66_LkK!JgQ(Rd@5HV>1(-DGo~4NShqlV9@uWp@*E4tDnAnB31RuE62! z=Nc}=^uK^1xqvZck&Dpe6vhIElmff~~MKdAzSq(x3F pQg5CHdWJ0$=B delta 140 zcmV;70CWGBL)1bFL{mgmR3QKW0TZzbxeNkDKa<4_umVFglXngM2Sye{Q$tP&lN}Bh zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5P1Uq!chF6fh(fFr+T>=Ym1>}e1XEtR1(b#ghspHu-u(jq68 psY$5?&0vWnhGgdux5#8J=E*bp)mejl!%CAT$MK16zRmBV000k|J01W4 delta 140 zcmV;70CWH1V4q+LL{mgmA20v_0rjy8xeNkNK9j`^umVjplXngM2Sye{Q$tP&lN}Bh zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Imhz4;7Pi4^ER_4i>W>5JVulO)0zp diff --git a/tests/data/acpi/x86/q35/DSDT b/tests/data/acpi/x86/q35/DSDT index fb89ae0ac6d4346e33156e9e4d3718698a0a1a8e..51ad37a351bffae8fbc9ba17f72c25ef61822f59 100644 GIT binary patch delta 180 zcmZ4N_{@>ZCDUq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRveH7+b|#D diff --git a/tests/data/acpi/x86/q35/DSDT.acpierst b/tests/data/acpi/x86/q35/DSDT.acpierst index 46fd25400b7c00ee9149ddb64cb5d5bd73f6a82b..dbd4f858354df0f4c050fd0b914581154f340ee8 100644 GIT binary patch delta 180 zcmdnu_}!7qCDLb; delta 109 zcmV-z0FwXrL9{^%L{mgmv>*Tg0oSn#2N?oSK9ds}umVjplf@bR0!9{-#2O?RZ~$X) z0c4^?5|d;BZ~$a*0bpfHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRve)OE4?7a diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat b/tests/data/acpi/x86/q35/DSDT.acpihmat index 61c5bd52a42242e85090934e8e45bf01642609d6..952752e30e9dfc9e2085e8fceaa0740dda6db89c 100644 GIT binary patch delta 159 zcmccMJ=urLCD!@#ID>c1b2j&&k4)8<_lUHy@ScU}W-=ntWbLMVZ6d)yqeS z>3;!3asgw?A_uX_DU1aSDFuuP1q_J=45^F!xhHc=`*HA1oSew@e{$;N7-^Ei##lxgdFRzmzI-kZ;&# IS((k80E*WzCIA2c delta 141 zcmbR2bHSU-CD!N}w;Hu=1iibMfJasgw? zB3GfwDU1aSDFuuP1q_Lce0e5|N&7K#PEMShBkf?i(0qaE$Yd_&0!A#7lg~-}ZBCNe$O!;@8!4;+ diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x b/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x index 497706c9742a9ea5396d6c9c4cc1cc2a4a530339..e95258cbd8681103a642f8973bd1ac9ef229cff7 100644 GIT binary patch delta 173 zcmbQ5bR&t&CDfOmyCjpp-(+FQ4NShyn~zG0Ffw^bO};IqqRip!>g6NE z^uK^1xqvZck%QRe6vhIElmf^zn{W$n0PEO?dKRI=BhO~py0+q=z z`YiFmPVoWGo(2IyuEEYhzF~|7$sHimQW;89C*PI!lPX|HTI9qsH7T{A87z^+kn9}d W7MaY&Jo&%0I&+Y3*k(kajR#XuiO7a*RGpe6Uk|fU~DTK#*&& ebC7QsqjQK`WHJ|X0V5X4$+x8aHs{H_5&-}%Gbwuj diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator b/tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator index 3aaa2bbdf54a0d0cade14421e84c6ec5a42f96fa..ba2a7d0004be7cd7220716dc7e8594be87197b98 100644 GIT binary patch delta 200 zcmdnx{MVVwCDqcEbYg^ zH*slS`x>loqH=j?rg{4|a+VaP~9^2yzW}4)P6SEJ*GEnU=~>nmYNVw4YP~ yL((EAmZ?dp1HmKYXFu0)A*TNY49NwIDT`c%CZ{kKFr*YPCKNCvF7oA>tS9Zq%sDx6a*MQs=|b}b zrjujzS>l78;scyL4FZB(gPntX!x)`I+#-{?mUq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvf+r*iaw} diff --git a/tests/data/acpi/x86/q35/DSDT.bridge b/tests/data/acpi/x86/q35/DSDT.bridge index d9938dba8fa5d405f7696c0dbdc24f3ae42ec934..1939fda2507cde6fcb6f7a093897f9bd2cb987ef 100644 GIT binary patch delta 180 zcmX>Q+Z@N`66_Mftk1x}sIifYU6RSkd9twN1||oK$wwvsvU^H72Rr+5Og4}apZq|I zLz%3;!3asgw?B7f1zDU1aSDFuuP1q_J=45^F!xF<>ba_~)@oXGWma_Zy& zX$PeRDwAXMS>l78;scyL4FZB(gPntX!x#&aJ3xk|GL)uHJ}T`eRltz6$cbfYQffgn dSR#ob**U~5GMS5c@^fi*<{;m&&4M!Pg#eBZHfR6< delta 109 zcmV-z0FwWMUcg-nL{mgmz%Bp)0aLLG2N?oSK9ds}umVjplf@bR0!9{-#2O?RZ~$X) z0c4^?5|d;BZ~$a*0bpfHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvfJo@Ma)J diff --git a/tests/data/acpi/x86/q35/DSDT.core-count b/tests/data/acpi/x86/q35/DSDT.core-count index a24b04cbdbf09383b933a42a2a15182545543a87..41c0832ab5041ff5361598813ec28fe7442b191b 100644 GIT binary patch delta 168 zcmeyEvL%(vCD>}qURltz6$cbfYQffgnSR#ob**U~5GMS5c Ra+;hvbC7S?<_U5Sg#j0XG*JKm delta 134 zcmV;10D1qkW$|PRL{mgmaWVh^0k5$N2N?p5TayzRu>y)vv&I>E0|!SILsLUe2$O&u z7n5Ec2pDhxV{idvqD2yuWC3shWN-msZ~$SVO$?KX9ZmxYlVOwJ9Y6%3H=s3>As!VR oLsUjtV+sRs0bDNxUsFO~P(w*DP*O!xLsCsvlR+L%v(+Bo6Qh?Xg#Z8m diff --git a/tests/data/acpi/x86/q35/DSDT.core-count2 b/tests/data/acpi/x86/q35/DSDT.core-count2 index 3a0cb8c581c8cc630a2ec21712b7f8b75fcad1c8..153b45f0f7443d25cecc2a752fb6dbd921160e78 100644 GIT binary patch delta 160 zcmaFW&a}3JiOVI}B}BJ{fr0VbMlNDW6B~&vB@cn1q>+#j0pt{i3JR)iyS6vst0iJO`M#_^?!2eWMuM^nk22F%;D_n*>_hQtDf)J6W>lWnB^IQS+`PUQMOIdyWcv;)%umB|;S zMY#)-J3zWq8A?+pGs*bL6fh($a$=d9lv>aXmPleqb`EiiOy*)PNS=H^N|iatH*B+? Hj4B%dq#Q5J delta 124 zcmV-?0E7RwMe{@oL{mgmb0Po$0h_T32N?oSTayzRumVj`v&9)X0Rl%Bk{cu#Z~$X) z0c4^@5|d;BZ~$a*0bpmkO;(ft8&0#693uw7dL)Se diff --git a/tests/data/acpi/x86/q35/DSDT.cxl b/tests/data/acpi/x86/q35/DSDT.cxl index 3c34d4dcab16783abe65f6fa5e64eb69d40795fb..0f1ccdfcc3ffbf151c172015cc4bf18bc4ead218 100644 GIT binary patch delta 180 zcmcbWHaDHiCDUq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvbqc@Dv~7 diff --git a/tests/data/acpi/x86/q35/DSDT.dimmpxm b/tests/data/acpi/x86/q35/DSDT.dimmpxm index 228374b55bd544116e359f659e546fc66cf8a895..eb5b6e9f52107d9c95e38e94a67a6b5001beafc1 100644 GIT binary patch delta 173 zcmbQ~cgK&*CDg6NE z^uK^1xqvZck%QRe6vhIElmf_0v{W$n0PEO?dKRI=BhqQyz0+q=z z`YiFmPVoWGo(2IyuEEYhzF~|7$sHimQW;89C;yf9lPX|HTI9qsH7T{A87z^+kn9}d W7MaY&JXu~wojJ%iY_q4#1ug)C4>Y*| delta 141 zcmccPH`9;HCDNE4v?P;9z+`pF4NPvXn{P@gFfzG|P5v#VB2mDQT)>#J z$W>@^3S$97N&#a+0Yl;;KKX$Z zhcbt=tCx=u)Bgg7vQVJLo3K$X#7*ZGcaZi%=<=~q*Ig#uCMBkrT_*q|}0D eutX9=vU7-AWHJ}?fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvg;|6`>%) diff --git a/tests/data/acpi/x86/q35/DSDT.ipmismbus b/tests/data/acpi/x86/q35/DSDT.ipmismbus index e5d6811bee1233d74236453c49060390d74d4416..d04d215a1d0fbc77739084d100a35af47a1c1a62 100644 GIT binary patch delta 180 zcmezExX+2pCDUq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvhRAPqrav diff --git a/tests/data/acpi/x86/q35/DSDT.ivrs b/tests/data/acpi/x86/q35/DSDT.ivrs index 46fd25400b7c00ee9149ddb64cb5d5bd73f6a82b..dbd4f858354df0f4c050fd0b914581154f340ee8 100644 GIT binary patch delta 180 zcmdnu_}!7qCDLb; delta 109 zcmV-z0FwXrL9{^%L{mgmv>*Tg0oSn#2N?oSK9ds}umVjplf@bR0!9{-#2O?RZ~$X) z0c4^?5|d;BZ~$a*0bpfHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRve)OE4?7a diff --git a/tests/data/acpi/x86/q35/DSDT.memhp b/tests/data/acpi/x86/q35/DSDT.memhp index 5ce081187a578ba7145a9ba20d30be36c13b7663..f73ade9bf6e4545f9912ed654a282884a54cec79 100644 GIT binary patch delta 180 zcmez5z14@yCDdw@xewec1b1==gGp78<^ZICLfjj%kC-V9PI4JG1)*yeDVV+ z4rLB!S1%tSrvC*D$pwrli~L0=r!W>Uq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvh0624*0f diff --git a/tests/data/acpi/x86/q35/DSDT.mmio64 b/tests/data/acpi/x86/q35/DSDT.mmio64 index bdf36c4d575bfc4eb2eac3f00c9b7b4270f88677..f0ddb4c83cdc9afdf4f289a66ed6bf0d630fd623 100644 GIT binary patch delta 180 zcmeD6y5Pm-66_KZpvu6&xNsvEyCjo`^JHPk4NPtplaEUNW%rbF4tDnAm~0>;KKX$Z zhcbt=tCx=u)Bgg7vQVJLo3K$X#7*ZGcaZi%=<=~q*Ig#uCMBkrT_*q|}0D eutX9=vU7-AWHJ}?fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvh{W)LtM& diff --git a/tests/data/acpi/x86/q35/DSDT.multi-bridge b/tests/data/acpi/x86/q35/DSDT.multi-bridge index 1db43a69e4c2affd8bd678bbef4d3c228380288e..3ad19e3f5e480db1c449b838c83833f7665186cd 100644 GIT binary patch delta 180 zcmbP{emkAZCDUq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvd*F{DB}m diff --git a/tests/data/acpi/x86/q35/DSDT.noacpihp b/tests/data/acpi/x86/q35/DSDT.noacpihp index 8bc16887e1c963c61aaecf71712a09c0554f6d67..9f7261d1b06bbf5d8a3e5a7a46b247a2a21eb544 100644 GIT binary patch delta 206 zcmZ4O@XmqDCDyP{5E_z>vDgk9+cFNnd`x ziIWq#{!dQj`d`49vb11wptSI0St&K81uBzc^jYGAo#F$WJq-eaT!Wp1e8U(Ek~=^K zr!thLPOgyhlPX|HTI9qsH7T{A87z^+kn9}d7MaY&Jb9LsI%|+`SZUJacuBF%cclDT E0gAanng9R* delta 161 zcmaFou-bvkCDV3(Xgp yPL9!Mi4S&)4{-K02nccwb`J6lV{{I2i%jNXE?~qWIk{BIZ*sh(*k*ZYe^vm=gF-S8<-p{CYwwCW%rbF4tDnAn0!}KT${t$ z&ox|#=|6|FtCx=u)Bgg7vQVJLo3K$X#7*ZGcaZfIi^5x*0I60B) z|K!xkhol^o7N|^)(PxPdc8U*h_B03xat(G4@(p7wNbUfcmda3?I@w&>PpW_+X^|7l p)TGpcX0SvOL$Y&-TVyg9^W;crb=Dx?u+pT-a#CWOXG>SH008%`I?Dh6 delta 140 zcmV;70CWG?K$SoWL{mgm6(9fr0RXWIc^CpuK9hwQumVjplQ$Xt2Sye{Q$tP&lie8? zAP7TFMOP96|8M|fZ~$vpf!_R uF9csxLSIlrNia}SMN>mkO;!OzR7P223Img|8x@l@8%~oR8WywO8+rsM6)9){ diff --git a/tests/data/acpi/x86/q35/DSDT.numamem b/tests/data/acpi/x86/q35/DSDT.numamem index ba6669437e65952f24516ded954b33fe54bdedfb..2867f5b44498d788fc0effd0bf616317821be88e 100644 GIT binary patch delta 180 zcmZ4K_{NdTCD delta 109 zcmV-z0FwXgL8(CsL{mgmsUQFV0pYO<2N?oIKa&#~umVFglf@bR0!9{-#2O?RZ~$X) z0c4^?5|d;BZ~$a*0bpfHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRveZD8^j=y diff --git a/tests/data/acpi/x86/q35/DSDT.pvpanic-isa b/tests/data/acpi/x86/q35/DSDT.pvpanic-isa index 6ad42873e91c80cef5a42224cb4d31936dad59b4..02cc07f010f880684216ba8925c8f3f55cfd80aa 100644 GIT binary patch delta 180 zcmeBhI_<>e66_M;KKX$Z zhcbt=tCx=u)Bgg7vQVJLo3K$X#7*ZGcaZi%=<=~q*Ig#uCMBkrT_*q|}0D eutX9=vU7-AWHJ}?fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvh&N%k3a4 diff --git a/tests/data/acpi/x86/q35/DSDT.thread-count b/tests/data/acpi/x86/q35/DSDT.thread-count index a24b04cbdbf09383b933a42a2a15182545543a87..41c0832ab5041ff5361598813ec28fe7442b191b 100644 GIT binary patch delta 168 zcmeyEvL%(vCD>}qURltz6$cbfYQffgnSR#ob**U~5GMS5c Ra+;hvbC7S?<_U5Sg#j0XG*JKm delta 134 zcmV;10D1qkW$|PRL{mgmaWVh^0k5$N2N?p5TayzRu>y)vv&I>E0|!SILsLUe2$O&u z7n5Ec2pDhxV{idvqD2yuWC3shWN-msZ~$SVO$?KX9ZmxYlVOwJ9Y6%3H=s3>As!VR oLsUjtV+sRs0bDNxUsFO~P(w*DP*O!xLsCsvlR+L%v(+Bo6Qh?Xg#Z8m diff --git a/tests/data/acpi/x86/q35/DSDT.thread-count2 b/tests/data/acpi/x86/q35/DSDT.thread-count2 index 3a0cb8c581c8cc630a2ec21712b7f8b75fcad1c8..153b45f0f7443d25cecc2a752fb6dbd921160e78 100644 GIT binary patch delta 160 zcmaFW&a}3JiOVI}B}BJ{fr0VbMlNDW6B~&vB@cn1q>+#j0pt{i3JR)iyS6vst0iJO`M#_^?!2e3;!3asgw?B7f1zDU1aSDFuuP1q_J=45^F!xF<>ba_~)@oXGWma_Zy& zX$PeRDwAXMS>l78;scyL4FZB(gPntX!x#&aJ3xk|GL)uHJ}T`eRltz6$cbfYQffgn dSR#ob**U~5GMS5c@^fi*<{;m&&4Mx?*Z`l;Ho5=+ delta 109 zcmV-z0FwX2MuA2OL{mgm0V4na0cWua2N?oSK9ds}umVjplf@bR0!9{-#2O?RZ~$X) z0c4^?5|d;BZ~$a*0bpfHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvhjImmMFN diff --git a/tests/data/acpi/x86/q35/DSDT.tis.tpm2 b/tests/data/acpi/x86/q35/DSDT.tis.tpm2 index a09253042ce4a715922027245de8a2ab7449c5b7..b05563deedc65df50f35b2399862d9ee8d4d1e0e 100644 GIT binary patch delta 180 zcmbR3cF&E=CDUq!chF6fh(fFr+T>$~1X*S&e delta 109 zcmV-z0FwXSMw>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvZWin{Xbx diff --git a/tests/data/acpi/x86/q35/DSDT.type4-count b/tests/data/acpi/x86/q35/DSDT.type4-count index edc23198cdb47a981bcbc82bc8e392b815abb554..00807e7fd4d758bc2ab9c69ac8869cf6864399f7 100644 GIT binary patch delta 200 zcmbO`k@3MqMlP3Nmyib@3=E8mHgd5`GW8sqEG)T^sdM}0W0I5D*uA8jgPr|2CNnCC zYjZgJxrPfd{pWCY_3{y7`d`41T)>#J$U$s!3S$97N&#a+0YhQ|L+T=b?#a^>{5bd~ zPEO?dKRI>sa|H*b1uBzc^jYGAo#F$WJq-eaT!Wp1e8U(Ek~=`Ar81PJPL5IZlPX|H zTI9qsH7T{A87z^+kn9}d7MaY&Jb9sl*knBgLG~cuu+pSx^~s3}!khOi-cthrpxZw^ delta 163 zcmaDbk#X)sMlP3Nmyo$03=E97H*&E{GIj2oEG)T^scrM-W0I5D*xkjPgPr|2CNnCC zD{wgbxrPfd{V!lhE?`Vq(KT@%~0Gc1b2D=gGp78<-p{CLfjj%kC-V9PI4JG1)*yeDVV+ z4rLB!S1%tSrvC*D$pwrli~L0=r!W>Uq!chF6fh(fFr+T>fHItJ;91{ouLsUjtV+sS4 PKO7a4!W&MrRvZBxw>BRO diff --git a/tests/data/acpi/x86/q35/DSDT.xapic b/tests/data/acpi/x86/q35/DSDT.xapic index d4acd851c62c956436a436f9fa6d08fc5f370fa7..227d421f16ed1824a87e8a91da734828f8b48cbf 100644 GIT binary patch delta 195 zcmZph&UA7*6PHV{OUTJ?1_s7U8@bpenOZ+i7M9$|)bwogG091M?A}t&!OnghlNmL{ zwK$ypT*HN!{&P6Hdie-3{V!lhE?`VqaXmPleqb`EiiOy**qT(7Cl9^@NVniQ=*IZ;D+^8w9ci2(KZKNSD~ delta 162 zcmX>(ovCd)6PHV{OGsNc0|VpRja=-KOigbm3rlWf>VLTTnB*irb`LS=Ym1>}e1X X-Patchwork-Id: 13940718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E6B0C02185 for ; Wed, 15 Jan 2025 18:09:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7p4-0006Oi-Pi; Wed, 15 Jan 2025 13:08:58 -0500 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 1tY7p0-0006OA-UK for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:55 -0500 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 1tY7oz-0006WY-5h for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964531; 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=BA+AAiUYSVdwa0YScwU4cx7B/C7WfTspevhXkrQeIKc=; b=WTnNpIvIOc8+aQki81AdsdEdZKw5Y5tUaBahLBtLS2U+/zjilNj0h0zf9OqZeaDDT+WPoj 2sMIhzJ7hAkRq5a2UWjPiMR2APZtQ2kjy+QZW0C7IJsOaqeVLz7N4UYyoThoVUiIfOt1W8 VqpWBkC+o9LigJOerkyJqHTUZIBtrmE= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-166-PVMmn7k0PsOtgECQyvRMTw-1; Wed, 15 Jan 2025 13:08:50 -0500 X-MC-Unique: PVMmn7k0PsOtgECQyvRMTw-1 X-Mimecast-MFC-AGG-ID: PVMmn7k0PsOtgECQyvRMTw Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-436723db6c4so47624185e9.3 for ; Wed, 15 Jan 2025 10:08:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964527; x=1737569327; 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=BA+AAiUYSVdwa0YScwU4cx7B/C7WfTspevhXkrQeIKc=; b=jpio+Ug6EvyTzyMDyRx8BS4igacFDBg+05YBE15GgzZdHU8JP306Qm+mBgEgQ0qTyh bpnaHR8V9oTZ5NFx1Nfb6CSMFQfJ/xvvBLw3rEcOILKceit3hNJkX6o+u/wMdZmfTvko ocwYeMMLzE2Y1/RnPfOl54IJb+v2z3Q25btDDg4yziZTY56tJkaMUmtL+JaIkYaCa99P 0OAm2VQgok0EpBKNjQv+E0J04Ww6/5SYiumTBO1VzGmIScwkbRsxkdUFyk2oVTDcZD0k 4dRtpGsZYue8MSfzlTupG9T4PHtuksP4vYn+87UKsJI7Re0gdYINoQ2XiVzPc0GGIRMr AX5w== X-Gm-Message-State: AOJu0Yw30RzN7NwEXrCiL84KZRXe7KqAjRvMkp9bCpVwDfgqRY6g7LTU mH7nOqx8TCg4bZTLERWgcTDEcsNsuzDhs3N/xFmFkuYtcbgs2XRTPJmG19yQ4aCWwcIbbZnm3ij /9UZq0P8bRtDEjNf6RYqJsgtDkuu0raj4m+ovnlk7QxgLjgzBJzDPFkK8VoecXYaLrxJXDj41cd 2WNq+QmtW3m2WO4FrHqnKfll/EmpX0Tg== X-Gm-Gg: ASbGncto84OqFqMpGrdyKaXEzk0kiZ7XU8mR/be1ZUVxtuJjzRYHWFiQVgyQxtkzPGa TIjH/L1r4kcMm5dIELtMF3i5F/7ULtttUmMJJwFzqwXQL79iR58k9tS8eJrDbBA/r3yogd2g3a4 gui/58MvG8KgKkHVYE7NIPe2kicsgacUQ+TP3xbIJBAo2/HUttODV3MEg/Zx+tE1PUhO+2p6IM+ M3aTh7XyMqumPX1bSoAV6umrXiJvnMIv9FrK1I63MqF7k4kLVn1 X-Received: by 2002:a05:600c:3ba0:b0:434:a802:43d with SMTP id 5b1f17b1804b1-436e27170c7mr248548195e9.27.1736964527411; Wed, 15 Jan 2025 10:08:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGi/RGdHLBf5LDbvhVDMM/MOlTqSeNTzFMKzF9AvI/GEK715h4l13UDc/Xmkd3tleUOgpw3Ig== X-Received: by 2002:a05:600c:3ba0:b0:434:a802:43d with SMTP id 5b1f17b1804b1-436e27170c7mr248547855e9.27.1736964526923; Wed, 15 Jan 2025 10:08:46 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74e3b97sm30941335e9.32.2025.01.15.10.08.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:46 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:43 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Yu Zhang , Zhenzhong Duan , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Yi Liu , Jason Wang , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 06/48] intel_iommu: Use the latest fault reasons defined by spec 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Yu Zhang Spec revision 3.0 or above defines more detailed fault reasons for scalable mode. So introduce them into emulation code, see spec section 7.1.2 for details. Note spec revision has no relation with VERSION register, Guest kernel should not use that register to judge what features are supported. Instead cap/ecap bits should be checked. Signed-off-by: Yu Zhang Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Acked-by: Jason Wang Message-Id: <20241212083757.605022-2-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 9 ++++++++- hw/i386/intel_iommu.c | 25 ++++++++++++++++--------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 4323fc5d6d..a987023692 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -311,7 +311,14 @@ typedef enum VTDFaultReason { * request while disabled */ VTD_FR_IR_SID_ERR = 0x26, /* Invalid Source-ID */ - VTD_FR_PASID_TABLE_INV = 0x58, /*Invalid PASID table entry */ + /* PASID directory entry access failure */ + VTD_FR_PASID_DIR_ACCESS_ERR = 0x50, + /* The Present(P) field of pasid directory entry is 0 */ + VTD_FR_PASID_DIR_ENTRY_P = 0x51, + VTD_FR_PASID_TABLE_ACCESS_ERR = 0x58, /* PASID table entry access failure */ + /* The Present(P) field of pasid table entry is 0 */ + VTD_FR_PASID_ENTRY_P = 0x59, + VTD_FR_PASID_TABLE_ENTRY_INV = 0x5b, /*Invalid PASID table entry */ /* Output address in the interrupt address range for scalable mode */ VTD_FR_SM_INTERRUPT_ADDR = 0x87, diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index a8c275f9ce..0ab1676d5f 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -796,7 +796,7 @@ static int vtd_get_pdire_from_pdir_table(dma_addr_t pasid_dir_base, addr = pasid_dir_base + index * entry_size; if (dma_memory_read(&address_space_memory, addr, pdire, entry_size, MEMTXATTRS_UNSPECIFIED)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_DIR_ACCESS_ERR; } pdire->val = le64_to_cpu(pdire->val); @@ -814,6 +814,7 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, dma_addr_t addr, VTDPASIDEntry *pe) { + uint8_t pgtt; uint32_t index; dma_addr_t entry_size; X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s); @@ -823,7 +824,7 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, addr = addr + index * entry_size; if (dma_memory_read(&address_space_memory, addr, pe, entry_size, MEMTXATTRS_UNSPECIFIED)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_TABLE_ACCESS_ERR; } for (size_t i = 0; i < ARRAY_SIZE(pe->val); i++) { pe->val[i] = le64_to_cpu(pe->val[i]); @@ -831,11 +832,13 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, /* Do translation type check */ if (!vtd_pe_type_check(x86_iommu, pe)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_TABLE_ENTRY_INV; } - if (!vtd_is_level_supported(s, VTD_PE_GET_LEVEL(pe))) { - return -VTD_FR_PASID_TABLE_INV; + pgtt = VTD_PE_GET_TYPE(pe); + if (pgtt == VTD_SM_PASID_ENTRY_SLT && + !vtd_is_level_supported(s, VTD_PE_GET_LEVEL(pe))) { + return -VTD_FR_PASID_TABLE_ENTRY_INV; } return 0; @@ -876,7 +879,7 @@ static int vtd_get_pe_from_pasid_table(IntelIOMMUState *s, } if (!vtd_pdire_present(&pdire)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_DIR_ENTRY_P; } ret = vtd_get_pe_from_pdire(s, pasid, &pdire, pe); @@ -885,7 +888,7 @@ static int vtd_get_pe_from_pasid_table(IntelIOMMUState *s, } if (!vtd_pe_present(pe)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_ENTRY_P; } return 0; @@ -938,7 +941,7 @@ static int vtd_ce_get_pasid_fpd(IntelIOMMUState *s, } if (!vtd_pdire_present(&pdire)) { - return -VTD_FR_PASID_TABLE_INV; + return -VTD_FR_PASID_DIR_ENTRY_P; } /* @@ -1795,7 +1798,11 @@ static const bool vtd_qualified_faults[] = { [VTD_FR_ROOT_ENTRY_RSVD] = false, [VTD_FR_PAGING_ENTRY_RSVD] = true, [VTD_FR_CONTEXT_ENTRY_TT] = true, - [VTD_FR_PASID_TABLE_INV] = false, + [VTD_FR_PASID_DIR_ACCESS_ERR] = false, + [VTD_FR_PASID_DIR_ENTRY_P] = true, + [VTD_FR_PASID_TABLE_ACCESS_ERR] = false, + [VTD_FR_PASID_ENTRY_P] = true, + [VTD_FR_PASID_TABLE_ENTRY_INV] = true, [VTD_FR_SM_INTERRUPT_ADDR] = true, [VTD_FR_MAX] = false, }; From patchwork Wed Jan 15 18:08:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8563C02180 for ; Wed, 15 Jan 2025 18:11:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7p6-0006PE-LI; Wed, 15 Jan 2025 13:09:00 -0500 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 1tY7p2-0006OP-63 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:57 -0500 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 1tY7p0-0006Wn-NL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:08:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964533; 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=o8FUzP/ipOTW2ewlNfL+QvXOqY/FnUZooNamJ6cM0LY=; b=e9zMirwDLCHyuICV+ZjrCZ4fEUa2sxZYEEC0th4MvvJXCfLWESC3hRN977Eh3/8eZZPP0N ef/6LjXgfI4Rs2bH2lL9dBiBz5+jbb8aDErc+wBvJWVgA3WfDgzDrK2O9AWswsP8EB5bTX hmdj9HdZh7sxcm7FYLpDP4iNZ0ecbtY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-408-YuYkSA2DOHC4RkaqQfvfbw-1; Wed, 15 Jan 2025 13:08:52 -0500 X-MC-Unique: YuYkSA2DOHC4RkaqQfvfbw-1 X-Mimecast-MFC-AGG-ID: YuYkSA2DOHC4RkaqQfvfbw Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436289a570eso32466685e9.0 for ; Wed, 15 Jan 2025 10:08:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964530; x=1737569330; 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=o8FUzP/ipOTW2ewlNfL+QvXOqY/FnUZooNamJ6cM0LY=; b=BkuYBWFEaU0eAUZ6dw1BjSlOwjcFEP2vFB3r8LvLVK1xagZvT46H1yl/l+1qsWMyhW 3YDkhkpzyMBxrkpMhnuS6Z40qOHP4LTmQ3XM13ie+ntYbMk8FhMrBhk6MN/xBEjB5/Pr qercIw3LzEE08ZbbSEcplrZtldhwUFb+C3Q+58LYVPLUg83RT5OMnYtiUL+SmZesYaFL pWZMlo/l7meysp7yj4hExPlwAc0V+MPPHtAJfRKmJsEFiK6Q3FRKAy8FGXtYbW7iTHgZ /N5i3wWSg7EEK2VWsasEiSA3iI+Q02jB/ZuKVfTq8c9+WW/lkec+GWpZrs3HDO/vb7R9 mBpw== X-Gm-Message-State: AOJu0YyJaTz9fUZkjdZDjiBEKvNsLhY4EVXDAZkXc9ha2LQme329j5fM lXFawpSeAWnB5cMiEEyNv8aUec6s4wFhZ+j+YpZG2gJez4g0XKaxOXObq7cZiOsNr2t3MqnCFLT 0MxkOdJZOEXRUnyNGjUz+0BI6uE98yse9qzPtCGzj1IzQmnT2r2tk+QIXG6XN4ertbuQ1LJOLRB urH3Hzlooj+9xewnum4hWp2FIk6knIvA== X-Gm-Gg: ASbGncu9mHgrE7t6sDuP1XeZuuIIddygxUWdUO9NQ70LHiXY5eljZgBO7Xl24enf6WS Zv0PlaK+xKROkUd+06E9cN0ZcM7rB5bcItKAOMrsR5FS4sCyxZXJJSv4G0gsC7avQZwpMFy+kyn FVtM2xiTaTtW4oNLsvsR5Ot913QYsW97dxdUvjNIiaJ2eB+J2WZxmddEfhSpZOkIxBDnB9UUSyS LSmHHBrQtqaQf5PFF/zr5gfIbK9gEEdWjHfcLJ1fBxKI2RDhuBZ X-Received: by 2002:a05:600c:450d:b0:434:a734:d279 with SMTP id 5b1f17b1804b1-436e26a8927mr346818355e9.16.1736964530607; Wed, 15 Jan 2025 10:08:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6sxC7X2XFgof1z74pcowgq7OTwbb8OZI96cM+j+2HZdcu6GORvYhO6QKL/FZ81UUNvDkRGw== X-Received: by 2002:a05:600c:450d:b0:434:a734:d279 with SMTP id 5b1f17b1804b1-436e26a8927mr346818005e9.16.1736964530188; Wed, 15 Jan 2025 10:08:50 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74e59fasm32071025e9.34.2025.01.15.10.08.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:49 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:47 -0500 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 07/48] intel_iommu: Make pasid entry type check accurate 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan When guest configures Nested Translation(011b) or First-stage Translation only (001b), type check passed unaccurately. Fails the type check in those cases as their simulation isn't supported yet. Fixes: fb43cf739e1 ("intel_iommu: scalable mode emulation") Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Acked-by: Jason Wang Message-Id: <20241212083757.605022-3-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0ab1676d5f..bd639b7ff7 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -759,20 +759,16 @@ static inline bool vtd_pe_type_check(X86IOMMUState *x86_iommu, VTDPASIDEntry *pe) { switch (VTD_PE_GET_TYPE(pe)) { - case VTD_SM_PASID_ENTRY_FLT: case VTD_SM_PASID_ENTRY_SLT: - case VTD_SM_PASID_ENTRY_NESTED: - break; + return true; case VTD_SM_PASID_ENTRY_PT: - if (!x86_iommu->pt_supported) { - return false; - } - break; + return x86_iommu->pt_supported; + case VTD_SM_PASID_ENTRY_FLT: + case VTD_SM_PASID_ENTRY_NESTED: default: /* Unknown type */ return false; } - return true; } static inline bool vtd_pdire_present(VTDPASIDDirEntry *pdire) From patchwork Wed Jan 15 18:08:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 145CAC02180 for ; Wed, 15 Jan 2025 18:15:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7p7-0006PZ-7r; Wed, 15 Jan 2025 13:09:01 -0500 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 1tY7p6-0006P5-BJ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:00 -0500 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 1tY7p4-0006XA-QR for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964537; 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=53vmistltzrVou/xTWf8YxfnU3gKvkLoNxNSySUwMVU=; b=DrOExO3MsJBCrbOEWm5hzxJV0BXv43VcNCXGnVaZfk/WzX6gPLuxPy/HAfAy9pJHZojcHI xDzlQAwZcgGtl22VEODey4g+eSR4Y03eXtrlmQ/XksvTuFsY24LNVQ0oAujRmfCipqTrlG LwfGQC5qNNnW2c0WCaSu2Rcov3jJ5u4= 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-127-UcXeNrBiMrGb3PHqZ_-l2A-1; Wed, 15 Jan 2025 13:08:55 -0500 X-MC-Unique: UcXeNrBiMrGb3PHqZ_-l2A-1 X-Mimecast-MFC-AGG-ID: UcXeNrBiMrGb3PHqZ_-l2A Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-385e2579507so36138f8f.1 for ; Wed, 15 Jan 2025 10:08:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964534; x=1737569334; 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=53vmistltzrVou/xTWf8YxfnU3gKvkLoNxNSySUwMVU=; b=gZkkGtWboydNJwZ3Gh6slQMfG+FEOuse03HKkD9RbPYEKi8BiqDQl5J00gD/clOV5K 5OfKhmFEEZnrkUBHQ+xJZrQ6izj4h67USlXLqF+wkDGEWyCNXQz8DnexlcRA2epn3Pqs yYZHuhrrZ/OD9Q8K8D9oxqmxWW6Dn4xGcGqsHLEWTXpNeinUv9T5ndz8Zeub7aGOQxkX Of3Ag/zJko7QG6ItDFelI7Awydx2MFr6oUpknZ/U9p3CFwxzY7HsvV/0xpxK8eeB4Bim e/C3HevzXLqhZ55hWACus1WSZOI3RFmihvkr+s+QORoEH52XgNosYY9dEAainq7282V3 mhwA== X-Gm-Message-State: AOJu0Yw2Wojg0SNwnWGfwDktde47MxuQxdHw1nhZOjjtnztpEL6MSnyF eUCPO/+ntpXr42gEfamRYBHgarr56+VKBVQrBgEoUfSbtsrdA9Tzhts24F0Q4VJV/+FAyhDrnmH Qd3BkN04LBPGQcWfWNnQCWyMgSIwHVupeiVDvDhB+IZ2E3co62m8uDdvOu3AvMg1tTh7/wQM9kB WCLpFRgzZh8RRYVk/O1jrTO5PdzW+UqQ== X-Gm-Gg: ASbGncs66kwpc65BVCCuSUMTEg8Zj7L8n/4IYKPYmU++8XP76Esje2W3oZAq6Jfk5qs s3MEfp1DOEBAuedF+fTR21LzpPyH/9w4cNBSSkePlfMNjBx5z5y9L3PQw96r4eW9xdGOTvt7Nz8 QFgszzVLeEMBm9BKNhdF3yQT7CENuMLuWsB+oIYjURkCU5yL0OIyOLdJsk5/0XWUIJtLVLOUA1s T08NSt97xnUMhNDAM2hV+vgoTixPV9l6zTHNJ8ta7R+zesEN5JV X-Received: by 2002:a05:6000:1847:b0:386:4a24:18f2 with SMTP id ffacd0b85a97d-38a8730adf0mr30686485f8f.25.1736964533952; Wed, 15 Jan 2025 10:08:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IHX2fYI7at9FIo8s3RZXuB0hggqKBz8NCyGGATLJaiO+fP75UQmOINK8D7DEooOYHQy9g18Pg== X-Received: by 2002:a05:6000:1847:b0:386:4a24:18f2 with SMTP id ffacd0b85a97d-38a8730adf0mr30686453f8f.25.1736964533503; Wed, 15 Jan 2025 10:08:53 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d085sm18563905f8f.13.2025.01.15.10.08.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:52 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Yi Liu , Jason Wang , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 08/48] intel_iommu: Add a placeholder variable for scalable mode stage-1 translation Message-ID: <791346f93d2aa3b7eaebf4a12f4b7c558e94ff6b.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Add an new element flts in IntelIOMMUState to mark stage-1 translation support in scalable mode, this element will be exposed as an intel_iommu property x-flts finally. For now, it's only a placehholder and used for address width compatibility check and block host device passthrough until nesting is supported. Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-4-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index d372cd396b..b19f3004f0 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -262,6 +262,7 @@ struct IntelIOMMUState { bool caching_mode; /* RO - is cap CM enabled? */ bool scalable_mode; /* RO - is Scalable Mode supported? */ + bool flts; /* RO - is stage-1 translation supported? */ bool snoop_control; /* RO - is SNP filed supported? */ dma_addr_t root; /* Current root table pointer */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index bd639b7ff7..d0c1d73974 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3917,7 +3917,13 @@ static bool vtd_check_hiod(IntelIOMMUState *s, HostIOMMUDevice *hiod, return false; } - return true; + if (!s->flts) { + /* All checks requested by VTD stage-2 translation pass */ + return true; + } + + error_setg(errp, "host device is uncompatible with stage-1 translation"); + return false; } static bool vtd_dev_set_iommu_device(PCIBus *bus, void *opaque, int devfn, @@ -4307,14 +4313,21 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) } } - /* Currently only address widths supported are 39 and 48 bits */ - if ((s->aw_bits != VTD_HOST_AW_39BIT) && - (s->aw_bits != VTD_HOST_AW_48BIT)) { - error_setg(errp, "Supported values for aw-bits are: %d, %d", + if (!s->flts && s->aw_bits != VTD_HOST_AW_39BIT && + s->aw_bits != VTD_HOST_AW_48BIT) { + error_setg(errp, "%s: supported values for aw-bits are: %d, %d", + s->scalable_mode ? "Scalable mode(flts=off)" : "Legacy mode", VTD_HOST_AW_39BIT, VTD_HOST_AW_48BIT); return false; } + if (s->flts && s->aw_bits != VTD_HOST_AW_48BIT) { + error_setg(errp, + "Scalable mode(flts=on): supported value for aw-bits is: %d", + VTD_HOST_AW_48BIT); + return false; + } + if (s->scalable_mode && !s->dma_drain) { error_setg(errp, "Need to set dma_drain for scalable mode"); return false; From patchwork Wed Jan 15 18:08:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8F6A3C02187 for ; Wed, 15 Jan 2025 18:09:18 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7pE-0006Ql-Rw; Wed, 15 Jan 2025 13:09:12 -0500 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 1tY7pC-0006QG-E1 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:06 -0500 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 1tY7pA-0006XU-LV for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964544; 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=mAoiUmsYN9Y3NroFhTF2ZOwH0Iq7c411sIjbila1LWg=; b=JVCMDpA4J/vgyQDEtJIW9vIjxdsk3CRBn8pzp38WqMIu8lQs6OSI54tFYVcQt7EEnSiHd+ fRh8yLYhnik0kcuamRkpeEcbJ5GpxcEn9tLEtjuNil+G2DrHfYudvvczSREW3iPo4v5ufV cbD+YpccRyiUpxZHz5VMdFMAzoRp718= 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-220-ghybGsBwPRGOhaYWD-OGcw-1; Wed, 15 Jan 2025 13:08:59 -0500 X-MC-Unique: ghybGsBwPRGOhaYWD-OGcw-1 X-Mimecast-MFC-AGG-ID: ghybGsBwPRGOhaYWD-OGcw Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-38a684a0971so42307f8f.2 for ; Wed, 15 Jan 2025 10:08:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964537; x=1737569337; 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=mAoiUmsYN9Y3NroFhTF2ZOwH0Iq7c411sIjbila1LWg=; b=u0wO3z21lhnu4zlRX51kRdf2FYQ80yW+Z/9U/W6FNiOEhAc2inF8geSAcRwaXIQ+nU 5SLXB6jtHoF+9HtBk+fdsF0BCCoOAbYwfw7R55Jm9IVogvWmejYM6Iqh4ClUO7/7KaYV +VqpS3LIbdTpx3bXcstgQa3n2f1PzF4k4cNOr2PNZCWFxuLI50iju068jYP8LL2pGTxs FAWa7oxbWlzSbmr+qgHBHUM0X6Hc4E2DeqrmzEXmsMZT1JJhDPf/mSYHcIdn39fmHZb0 1AldodkKqgRU3/Ha0RALFdDxFvV8YMhhTsIiUXQy8mCU7oFBrjfrU1XZSW8nOSdl/oO+ VPxg== X-Gm-Message-State: AOJu0Yyi96o4eEpgkVzR3tssbeFBJuAJGer6+FEQFM7bp8JIEKaqZ/k0 Vopva1Gs2ydnCsy943mAtyXzTu0FDH0OH7sc0p1N1CuFLZiBc2KEOBXCOeLQoz0JPP6+WLXX4dE eeQ4q+xXce8ipKyDdYWCSfWjLkdCyUuerOZDOtRjWkqibipc7d0NCcB4KrDzL5ghwjUkGC18VeM 2gO/XUKJRcUVu6PBA+4g3XQRN8k+CuLA== X-Gm-Gg: ASbGncsQOBG0OiJXn4s/8yfpmzmlYK73e8XjbIrR4k0okeUkuIf1LgaBbYY2xXwdE2K XC8ZldnLjjckjsv30zVw+oVBkWNo1qFvlDJR05/eaZlt23qSIu5SWnp8SzuxBDSF/hv4sAgiWO2 BVxVYRdu5hKbAWrizevCeMJPRdgZVGjgkBTHuWJHb+5mAlgjYS5zDFbAFnH+TVN3SRVYia1m0uJ 4RTenYqD4VBdw4wBlDpn+h3T/1+xogzLr8skEx/IoJnmeZy4IDX X-Received: by 2002:a05:6000:1446:b0:385:fc97:9c76 with SMTP id ffacd0b85a97d-38a872f7fd9mr27082249f8f.3.1736964537483; Wed, 15 Jan 2025 10:08:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFWqqvsWIxG+EfDPXt5YY5Dv1FgQHYVYH5ep2U7s9WbPOtNlOSqi7l8j36ZLj8grpo++jfmSA== X-Received: by 2002:a05:6000:1446:b0:385:fc97:9c76 with SMTP id ffacd0b85a97d-38a872f7fd9mr27082213f8f.3.1736964537040; Wed, 15 Jan 2025 10:08:57 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38c6a2sm18336847f8f.54.2025.01.15.10.08.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:56 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Jason Wang , Yi Liu , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 09/48] intel_iommu: Flush stage-2 cache in PASID-selective PASID-based iotlb invalidation 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Per VT-d spec 4.1, 6.5.2.4, "Table 21. PASID-based-IOTLB Invalidation", PADID-selective PASID-based iotlb invalidation will flush stage-2 iotlb entries with matching domain id and pasid. With stage-1 translation introduced, guest could send PASID-selective PASID-based iotlb invalidation to flush either stage-1 or stage-2 entries. By this chance, remove old IOTLB related definitions which were unused. Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang Message-Id: <20241212083757.605022-5-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 14 ++++-- hw/i386/intel_iommu.c | 85 +++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 6 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index a987023692..48019e2005 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -404,11 +404,6 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_IOTLB_AM(val) ((val) & 0x3fULL) #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) -#define VTD_INV_DESC_IOTLB_PASID(val) (((val) >> 32) & VTD_PASID_ID_MASK) -#define VTD_INV_DESC_IOTLB_PASID_RSVD_LO 0xfff00000000001c0ULL -#define VTD_INV_DESC_IOTLB_PASID_RSVD_HI 0xf80ULL /* Mask for Device IOTLB Invalidate Descriptor */ #define VTD_INV_DESC_DEVICE_IOTLB_ADDR(val) ((val) & 0xfffffffffffff000ULL) @@ -443,6 +438,15 @@ typedef union VTDInvDesc VTDInvDesc; (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM | VTD_SL_TM)) : \ (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) +/* Masks for PIOTLB Invalidate Descriptor */ +#define VTD_INV_DESC_PIOTLB_G (3ULL << 4) +#define VTD_INV_DESC_PIOTLB_ALL_IN_PASID (2ULL << 4) +#define VTD_INV_DESC_PIOTLB_PSI_IN_PASID (3ULL << 4) +#define VTD_INV_DESC_PIOTLB_DID(val) (((val) >> 16) & VTD_DOMAIN_ID_MASK) +#define VTD_INV_DESC_PIOTLB_PASID(val) (((val) >> 32) & 0xfffffULL) +#define VTD_INV_DESC_PIOTLB_RSVD_VAL0 0xfff000000000f1c0ULL +#define VTD_INV_DESC_PIOTLB_RSVD_VAL1 0xf80ULL + /* Information about page-selective IOTLB invalidate */ struct VTDIOTLBPageInvInfo { uint16_t domain_id; diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index d0c1d73974..bb1f43c4b3 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2692,6 +2692,83 @@ static bool vtd_process_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) return true; } +static gboolean vtd_hash_remove_by_pasid(gpointer key, gpointer value, + gpointer user_data) +{ + VTDIOTLBEntry *entry = (VTDIOTLBEntry *)value; + VTDIOTLBPageInvInfo *info = (VTDIOTLBPageInvInfo *)user_data; + + return ((entry->domain_id == info->domain_id) && + (entry->pasid == info->pasid)); +} + +static void vtd_piotlb_pasid_invalidate(IntelIOMMUState *s, + uint16_t domain_id, uint32_t pasid) +{ + VTDIOTLBPageInvInfo info; + VTDAddressSpace *vtd_as; + VTDContextEntry ce; + + info.domain_id = domain_id; + info.pasid = pasid; + + vtd_iommu_lock(s); + g_hash_table_foreach_remove(s->iotlb, vtd_hash_remove_by_pasid, + &info); + vtd_iommu_unlock(s); + + QLIST_FOREACH(vtd_as, &s->vtd_as_with_notifiers, next) { + if (!vtd_dev_to_context_entry(s, pci_bus_num(vtd_as->bus), + vtd_as->devfn, &ce) && + domain_id == vtd_get_domain_id(s, &ce, vtd_as->pasid)) { + uint32_t rid2pasid = VTD_CE_GET_RID2PASID(&ce); + + if ((vtd_as->pasid != PCI_NO_PASID || pasid != rid2pasid) && + vtd_as->pasid != pasid) { + continue; + } + + if (!s->flts) { + vtd_address_space_sync(vtd_as); + } + } + } +} + +static bool vtd_process_piotlb_desc(IntelIOMMUState *s, + VTDInvDesc *inv_desc) +{ + uint16_t domain_id; + uint32_t pasid; + uint64_t mask[4] = {VTD_INV_DESC_PIOTLB_RSVD_VAL0, + VTD_INV_DESC_PIOTLB_RSVD_VAL1, + VTD_INV_DESC_ALL_ONE, VTD_INV_DESC_ALL_ONE}; + + if (!vtd_inv_desc_reserved_check(s, inv_desc, mask, true, + __func__, "piotlb inv")) { + return false; + } + + domain_id = VTD_INV_DESC_PIOTLB_DID(inv_desc->val[0]); + pasid = VTD_INV_DESC_PIOTLB_PASID(inv_desc->val[0]); + switch (inv_desc->val[0] & VTD_INV_DESC_PIOTLB_G) { + case VTD_INV_DESC_PIOTLB_ALL_IN_PASID: + vtd_piotlb_pasid_invalidate(s, domain_id, pasid); + break; + + case VTD_INV_DESC_PIOTLB_PSI_IN_PASID: + break; + + default: + error_report_once("%s: invalid piotlb inv desc: hi=0x%"PRIx64 + ", lo=0x%"PRIx64" (type mismatch: 0x%llx)", + __func__, inv_desc->val[1], inv_desc->val[0], + inv_desc->val[0] & VTD_INV_DESC_IOTLB_G); + return false; + } + return true; +} + static bool vtd_process_inv_iec_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) { @@ -2810,6 +2887,13 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) } break; + case VTD_INV_DESC_PIOTLB: + trace_vtd_inv_desc("p-iotlb", inv_desc.val[1], inv_desc.val[0]); + if (!vtd_process_piotlb_desc(s, &inv_desc)) { + return false; + } + 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)) { @@ -2837,7 +2921,6 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) * 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; } From patchwork Wed Jan 15 18:08:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34075C02183 for ; Wed, 15 Jan 2025 18:09:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7pe-0006df-Hg; Wed, 15 Jan 2025 13:09:36 -0500 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 1tY7pE-0006Qm-Ea for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:08 -0500 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 1tY7pA-0006XY-VO for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964544; 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=KbvLWvFG17uGiVUmQSPZCxg3tEBFCEtMjh1R8yyzLLY=; b=P5vBIs2k+KH6x+ypd0Bj628J3cIsQZZCllV1HicfAoQAPESZHdVxhO8GXmiGyDPiPf8Cnx Jzo1YNgCb2ruyuuGJhDJGgw4CLZiP3ffSS+gtZqsbQO440aHFawsWMOtLG09D46+F3qcPG YVlZ+LFal0iQFxUzooyayPVtfs2NC1g= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-449-bGXiEORAOYel37qlT8olJg-1; Wed, 15 Jan 2025 13:09:02 -0500 X-MC-Unique: bGXiEORAOYel37qlT8olJg-1 X-Mimecast-MFC-AGG-ID: bGXiEORAOYel37qlT8olJg Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436219070b4so33424995e9.1 for ; Wed, 15 Jan 2025 10:09:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964541; x=1737569341; 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=KbvLWvFG17uGiVUmQSPZCxg3tEBFCEtMjh1R8yyzLLY=; b=MfkUiE3+qXOA7lAhgZ873RcJlN18UeXitkFwEtcYZetnWIudlbLw9P7+DupQSywpVR bT2y50Cqit2YuhdUl4b4rHhhTWCyZS+lMVrQiaEB8JkhoHT1RwJ6kz2Xcj3gZb4P7sr+ BeLjP8V2Td30XWnuwipbQcl6ViKo6jcFnfbGLu5h1Sz92J5os1mGLiW/oKGJB2lKgR3+ nuIsw+eqMwrBvrk5L0LK1rPDPZZPpVUhLU4mDKYZArHF1KI6FnwH7ZwvVQhqZS8G6bXM Q2t0POZHy/+MPTKW+QXKCvINoPISxfSwZ726L5PxSWwt/IQviaJImLolbncLjNru/MK3 OLjg== X-Gm-Message-State: AOJu0YyM9YMI5HNAxpAijXQl5GvFpI81yxPpP+StZVVyKOrJRPftUoCu 8nxshV68KiLJnOeyXdZnQjhZP7KwDFvSCOaVm9RdrfYpL7vSX17oHtTbmCoH0rFgp2h0iKlOWlx lxuiQbQLgZptvAeXx7Dnr2OjcG5R09/z/VHE20Ef05P66wjv76nA2oWXsgNVM4/ipcDQTxicDw5 g+t6bFuHkl6N62AC4kP4dMGeoRhalbDQ== X-Gm-Gg: ASbGnctcMoQGoZwD9VV+8wUroX1K77JYNvNQ41SWJgQ3Y7Xqpwv6ADzMDKwqrQHDjUu N+ulRJpi4G8316H//ga+9Vz91kTiZCaOFwEhAc8Sg/siRPVd8riU3rHQJDVvHiGC+GFVvYKhJ0u fg1BeIDPmwrX9zBJnePftNLt0phoJ3IXDVOJJQdcJHAAyKfVnRP7xd1b0VJt5YsFkoyeKRfnYce WBm05q4SaaYQls5WmEDhWybDLCQOsnwjrwKi99AopTOvE4wPNUV X-Received: by 2002:a05:600c:4ecd:b0:434:f739:7ce3 with SMTP id 5b1f17b1804b1-436e26954a9mr268107155e9.8.1736964540993; Wed, 15 Jan 2025 10:09:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXAu+j1x5il2RoCkeZwANGBBODaZkvaNI73LZx+JPdJUwYVC2LuftsPz3MfAul2X2rYidlAA== X-Received: by 2002:a05:600c:4ecd:b0:434:f739:7ce3 with SMTP id 5b1f17b1804b1-436e26954a9mr268106765e9.8.1736964540436; Wed, 15 Jan 2025 10:09:00 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c73e370fsm32110455e9.0.2025.01.15.10.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:08:59 -0800 (PST) Date: Wed, 15 Jan 2025 13:08:57 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Yi Liu , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Yi Sun , Zhenzhong Duan , Jason Wang , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 10/48] intel_iommu: Rename slpte to pte 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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Yi Liu Because we will support both FST(a.k.a, FLT) and SST(a.k.a, SLT) translation, rename variable and functions from slpte to pte whenever possible. But some are SST only, they are renamed with sl_ prefix. Signed-off-by: Yi Liu Co-developed-by: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-6-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 24 +++--- include/hw/i386/intel_iommu.h | 2 +- hw/i386/intel_iommu.c | 129 +++++++++++++++++---------------- 3 files changed, 78 insertions(+), 77 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 48019e2005..e810b0071f 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -533,24 +533,24 @@ typedef struct VTDRootEntry VTDRootEntry; /* Second Level Page Translation Pointer*/ #define VTD_SM_PASID_ENTRY_SLPTPTR (~0xfffULL) -/* Paging Structure common */ -#define VTD_SL_PT_PAGE_SIZE_MASK (1ULL << 7) -/* Bits to decide the offset for each level */ -#define VTD_SL_LEVEL_BITS 9 - /* Second Level Paging Structure */ -#define VTD_SL_PML4_LEVEL 4 -#define VTD_SL_PDP_LEVEL 3 -#define VTD_SL_PD_LEVEL 2 -#define VTD_SL_PT_LEVEL 1 -#define VTD_SL_PT_ENTRY_NR 512 - /* Masks for Second Level Paging Entry */ #define VTD_SL_RW_MASK 3ULL #define VTD_SL_R 1ULL #define VTD_SL_W (1ULL << 1) -#define VTD_SL_PT_BASE_ADDR_MASK(aw) (~(VTD_PAGE_SIZE - 1) & VTD_HAW_MASK(aw)) #define VTD_SL_IGN_COM 0xbff0000000000000ULL #define VTD_SL_TM (1ULL << 62) +/* Common for both First Level and Second Level */ +#define VTD_PML4_LEVEL 4 +#define VTD_PDP_LEVEL 3 +#define VTD_PD_LEVEL 2 +#define VTD_PT_LEVEL 1 +#define VTD_PT_ENTRY_NR 512 +#define VTD_PT_PAGE_SIZE_MASK (1ULL << 7) +#define VTD_PT_BASE_ADDR_MASK(aw) (~(VTD_PAGE_SIZE - 1) & VTD_HAW_MASK(aw)) + +/* Bits to decide the offset for each level */ +#define VTD_LEVEL_BITS 9 + #endif diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index b19f3004f0..f44f3eb63a 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -152,7 +152,7 @@ struct VTDIOTLBEntry { uint64_t gfn; uint16_t domain_id; uint32_t pasid; - uint64_t slpte; + uint64_t pte; uint64_t mask; uint8_t access_flags; }; diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index bb1f43c4b3..dfac5982d6 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -48,7 +48,8 @@ /* pe operations */ #define VTD_PE_GET_TYPE(pe) ((pe)->val[0] & VTD_SM_PASID_ENTRY_PGTT) -#define VTD_PE_GET_LEVEL(pe) (2 + (((pe)->val[0] >> 2) & VTD_SM_PASID_ENTRY_AW)) +#define VTD_PE_GET_SL_LEVEL(pe) \ + (2 + (((pe)->val[0] >> 2) & VTD_SM_PASID_ENTRY_AW)) /* * PCI bus number (or SID) is not reliable since the device is usaully @@ -284,15 +285,15 @@ static gboolean vtd_hash_remove_by_domain(gpointer key, gpointer value, } /* The shift of an addr for a certain level of paging structure */ -static inline uint32_t vtd_slpt_level_shift(uint32_t level) +static inline uint32_t vtd_pt_level_shift(uint32_t level) { assert(level != 0); - return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_SL_LEVEL_BITS; + return VTD_PAGE_SHIFT_4K + (level - 1) * VTD_LEVEL_BITS; } -static inline uint64_t vtd_slpt_level_page_mask(uint32_t level) +static inline uint64_t vtd_pt_level_page_mask(uint32_t level) { - return ~((1ULL << vtd_slpt_level_shift(level)) - 1); + return ~((1ULL << vtd_pt_level_shift(level)) - 1); } static gboolean vtd_hash_remove_by_page(gpointer key, gpointer value, @@ -349,7 +350,7 @@ static void vtd_reset_caches(IntelIOMMUState *s) static uint64_t vtd_get_iotlb_gfn(hwaddr addr, uint32_t level) { - return (addr & vtd_slpt_level_page_mask(level)) >> VTD_PAGE_SHIFT_4K; + return (addr & vtd_pt_level_page_mask(level)) >> VTD_PAGE_SHIFT_4K; } /* Must be called with IOMMU lock held */ @@ -360,7 +361,7 @@ static VTDIOTLBEntry *vtd_lookup_iotlb(IntelIOMMUState *s, uint16_t source_id, VTDIOTLBEntry *entry; unsigned level; - for (level = VTD_SL_PT_LEVEL; level < VTD_SL_PML4_LEVEL; level++) { + for (level = VTD_PT_LEVEL; level < VTD_PML4_LEVEL; level++) { key.gfn = vtd_get_iotlb_gfn(addr, level); key.level = level; key.sid = source_id; @@ -377,7 +378,7 @@ out: /* Must be with IOMMU lock held */ static void vtd_update_iotlb(IntelIOMMUState *s, uint16_t source_id, - uint16_t domain_id, hwaddr addr, uint64_t slpte, + uint16_t domain_id, hwaddr addr, uint64_t pte, uint8_t access_flags, uint32_t level, uint32_t pasid) { @@ -385,7 +386,7 @@ static void vtd_update_iotlb(IntelIOMMUState *s, uint16_t source_id, struct vtd_iotlb_key *key = g_malloc(sizeof(*key)); uint64_t gfn = vtd_get_iotlb_gfn(addr, level); - trace_vtd_iotlb_page_update(source_id, addr, slpte, domain_id); + trace_vtd_iotlb_page_update(source_id, addr, pte, domain_id); if (g_hash_table_size(s->iotlb) >= VTD_IOTLB_MAX_SIZE) { trace_vtd_iotlb_reset("iotlb exceeds size limit"); vtd_reset_iotlb_locked(s); @@ -393,9 +394,9 @@ static void vtd_update_iotlb(IntelIOMMUState *s, uint16_t source_id, entry->gfn = gfn; entry->domain_id = domain_id; - entry->slpte = slpte; + entry->pte = pte; entry->access_flags = access_flags; - entry->mask = vtd_slpt_level_page_mask(level); + entry->mask = vtd_pt_level_page_mask(level); entry->pasid = pasid; key->gfn = gfn; @@ -710,32 +711,32 @@ static inline dma_addr_t vtd_ce_get_slpt_base(VTDContextEntry *ce) return ce->lo & VTD_CONTEXT_ENTRY_SLPTPTR; } -static inline uint64_t vtd_get_slpte_addr(uint64_t slpte, uint8_t aw) +static inline uint64_t vtd_get_pte_addr(uint64_t pte, uint8_t aw) { - return slpte & VTD_SL_PT_BASE_ADDR_MASK(aw); + return pte & VTD_PT_BASE_ADDR_MASK(aw); } /* Whether the pte indicates the address of the page frame */ -static inline bool vtd_is_last_slpte(uint64_t slpte, uint32_t level) +static inline bool vtd_is_last_pte(uint64_t pte, uint32_t level) { - return level == VTD_SL_PT_LEVEL || (slpte & VTD_SL_PT_PAGE_SIZE_MASK); + return level == VTD_PT_LEVEL || (pte & VTD_PT_PAGE_SIZE_MASK); } -/* Get the content of a spte located in @base_addr[@index] */ -static uint64_t vtd_get_slpte(dma_addr_t base_addr, uint32_t index) +/* Get the content of a pte located in @base_addr[@index] */ +static uint64_t vtd_get_pte(dma_addr_t base_addr, uint32_t index) { - uint64_t slpte; + uint64_t pte; - assert(index < VTD_SL_PT_ENTRY_NR); + assert(index < VTD_PT_ENTRY_NR); if (dma_memory_read(&address_space_memory, - base_addr + index * sizeof(slpte), - &slpte, sizeof(slpte), MEMTXATTRS_UNSPECIFIED)) { - slpte = (uint64_t)-1; - return slpte; + base_addr + index * sizeof(pte), + &pte, sizeof(pte), MEMTXATTRS_UNSPECIFIED)) { + pte = (uint64_t)-1; + return pte; } - slpte = le64_to_cpu(slpte); - return slpte; + pte = le64_to_cpu(pte); + return pte; } /* Given an iova and the level of paging structure, return the offset @@ -743,12 +744,12 @@ static uint64_t vtd_get_slpte(dma_addr_t base_addr, uint32_t index) */ static inline uint32_t vtd_iova_level_offset(uint64_t iova, uint32_t level) { - return (iova >> vtd_slpt_level_shift(level)) & - ((1ULL << VTD_SL_LEVEL_BITS) - 1); + return (iova >> vtd_pt_level_shift(level)) & + ((1ULL << VTD_LEVEL_BITS) - 1); } /* Check Capability Register to see if the @level of page-table is supported */ -static inline bool vtd_is_level_supported(IntelIOMMUState *s, uint32_t level) +static inline bool vtd_is_sl_level_supported(IntelIOMMUState *s, uint32_t level) { return VTD_CAP_SAGAW_MASK & s->cap & (1ULL << (level - 2 + VTD_CAP_SAGAW_SHIFT)); @@ -833,7 +834,7 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, pgtt = VTD_PE_GET_TYPE(pe); if (pgtt == VTD_SM_PASID_ENTRY_SLT && - !vtd_is_level_supported(s, VTD_PE_GET_LEVEL(pe))) { + !vtd_is_sl_level_supported(s, VTD_PE_GET_SL_LEVEL(pe))) { return -VTD_FR_PASID_TABLE_ENTRY_INV; } @@ -972,7 +973,7 @@ static uint32_t vtd_get_iova_level(IntelIOMMUState *s, if (s->root_scalable) { vtd_ce_get_rid2pasid_entry(s, ce, &pe, pasid); - return VTD_PE_GET_LEVEL(&pe); + return VTD_PE_GET_SL_LEVEL(&pe); } return vtd_ce_get_level(ce); @@ -1040,9 +1041,9 @@ static inline uint64_t vtd_iova_limit(IntelIOMMUState *s, } /* Return true if IOVA passes range check, otherwise false. */ -static inline bool vtd_iova_range_check(IntelIOMMUState *s, - uint64_t iova, VTDContextEntry *ce, - uint8_t aw, uint32_t pasid) +static inline bool vtd_iova_sl_range_check(IntelIOMMUState *s, + uint64_t iova, VTDContextEntry *ce, + uint8_t aw, uint32_t pasid) { /* * Check if @iova is above 2^X-1, where X is the minimum of MGAW @@ -1083,17 +1084,17 @@ static bool vtd_slpte_nonzero_rsvd(uint64_t slpte, uint32_t level) /* * We should have caught a guest-mis-programmed level earlier, - * via vtd_is_level_supported. + * via vtd_is_sl_level_supported. */ assert(level < VTD_SPTE_RSVD_LEN); /* - * Zero level doesn't exist. The smallest level is VTD_SL_PT_LEVEL=1 and - * checked by vtd_is_last_slpte(). + * Zero level doesn't exist. The smallest level is VTD_PT_LEVEL=1 and + * checked by vtd_is_last_pte(). */ assert(level); - if ((level == VTD_SL_PD_LEVEL || level == VTD_SL_PDP_LEVEL) && - (slpte & VTD_SL_PT_PAGE_SIZE_MASK)) { + if ((level == VTD_PD_LEVEL || level == VTD_PDP_LEVEL) && + (slpte & VTD_PT_PAGE_SIZE_MASK)) { /* large page */ rsvd_mask = vtd_spte_rsvd_large[level]; } else { @@ -1119,7 +1120,7 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce, uint64_t access_right_check; uint64_t xlat, size; - if (!vtd_iova_range_check(s, iova, ce, aw_bits, pasid)) { + if (!vtd_iova_sl_range_check(s, iova, ce, aw_bits, pasid)) { error_report_once("%s: detected IOVA overflow (iova=0x%" PRIx64 "," "pasid=0x%" PRIx32 ")", __func__, iova, pasid); return -VTD_FR_ADDR_BEYOND_MGAW; @@ -1130,7 +1131,7 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce, while (true) { offset = vtd_iova_level_offset(iova, level); - slpte = vtd_get_slpte(addr, offset); + slpte = vtd_get_pte(addr, offset); if (slpte == (uint64_t)-1) { error_report_once("%s: detected read error on DMAR slpte " @@ -1161,17 +1162,17 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce, return -VTD_FR_PAGING_ENTRY_RSVD; } - if (vtd_is_last_slpte(slpte, level)) { + if (vtd_is_last_pte(slpte, level)) { *slptep = slpte; *slpte_level = level; break; } - addr = vtd_get_slpte_addr(slpte, aw_bits); + addr = vtd_get_pte_addr(slpte, aw_bits); level--; } - xlat = vtd_get_slpte_addr(*slptep, aw_bits); - size = ~vtd_slpt_level_page_mask(level) + 1; + xlat = vtd_get_pte_addr(*slptep, aw_bits); + size = ~vtd_pt_level_page_mask(level) + 1; /* * From VT-d spec 3.14: Untranslated requests and translation @@ -1322,14 +1323,14 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start, trace_vtd_page_walk_level(addr, level, start, end); - subpage_size = 1ULL << vtd_slpt_level_shift(level); - subpage_mask = vtd_slpt_level_page_mask(level); + subpage_size = 1ULL << vtd_pt_level_shift(level); + subpage_mask = vtd_pt_level_page_mask(level); while (iova < end) { iova_next = (iova & subpage_mask) + subpage_size; offset = vtd_iova_level_offset(iova, level); - slpte = vtd_get_slpte(addr, offset); + slpte = vtd_get_pte(addr, offset); if (slpte == (uint64_t)-1) { trace_vtd_page_walk_skip_read(iova, iova_next); @@ -1352,12 +1353,12 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start, */ entry_valid = read_cur | write_cur; - if (!vtd_is_last_slpte(slpte, level) && entry_valid) { + if (!vtd_is_last_pte(slpte, level) && entry_valid) { /* * This is a valid PDE (or even bigger than PDE). We need * to walk one further level. */ - ret = vtd_page_walk_level(vtd_get_slpte_addr(slpte, info->aw), + ret = vtd_page_walk_level(vtd_get_pte_addr(slpte, info->aw), iova, MIN(iova_next, end), level - 1, read_cur, write_cur, info); } else { @@ -1374,7 +1375,7 @@ static int vtd_page_walk_level(dma_addr_t addr, uint64_t start, event.entry.perm = IOMMU_ACCESS_FLAG(read_cur, write_cur); event.entry.addr_mask = ~subpage_mask; /* NOTE: this is only meaningful if entry_valid == true */ - event.entry.translated_addr = vtd_get_slpte_addr(slpte, info->aw); + event.entry.translated_addr = vtd_get_pte_addr(slpte, info->aw); event.type = event.entry.perm ? IOMMU_NOTIFIER_MAP : IOMMU_NOTIFIER_UNMAP; ret = vtd_page_walk_one(&event, info); @@ -1408,11 +1409,11 @@ static int vtd_page_walk(IntelIOMMUState *s, VTDContextEntry *ce, dma_addr_t addr = vtd_get_iova_pgtbl_base(s, ce, pasid); uint32_t level = vtd_get_iova_level(s, ce, pasid); - if (!vtd_iova_range_check(s, start, ce, info->aw, pasid)) { + if (!vtd_iova_sl_range_check(s, start, ce, info->aw, pasid)) { return -VTD_FR_ADDR_BEYOND_MGAW; } - if (!vtd_iova_range_check(s, end, ce, info->aw, pasid)) { + if (!vtd_iova_sl_range_check(s, end, ce, info->aw, pasid)) { /* Fix end so that it reaches the maximum */ end = vtd_iova_limit(s, ce, info->aw, pasid); } @@ -1527,7 +1528,7 @@ static int vtd_dev_to_context_entry(IntelIOMMUState *s, uint8_t bus_num, /* Check if the programming of context-entry is valid */ if (!s->root_scalable && - !vtd_is_level_supported(s, vtd_ce_get_level(ce))) { + !vtd_is_sl_level_supported(s, vtd_ce_get_level(ce))) { error_report_once("%s: invalid context entry: hi=%"PRIx64 ", lo=%"PRIx64" (level %d not supported)", __func__, ce->hi, ce->lo, @@ -1897,7 +1898,7 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, VTDContextEntry ce; uint8_t bus_num = pci_bus_num(bus); VTDContextCacheEntry *cc_entry; - uint64_t slpte, page_mask; + uint64_t pte, page_mask; uint32_t level, pasid = vtd_as->pasid; uint16_t source_id = PCI_BUILD_BDF(bus_num, devfn); int ret_fr; @@ -1918,13 +1919,13 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, cc_entry = &vtd_as->context_cache_entry; - /* Try to fetch slpte form IOTLB, we don't need RID2PASID logic */ + /* Try to fetch pte from IOTLB, we don't need RID2PASID logic */ if (!rid2pasid) { iotlb_entry = vtd_lookup_iotlb(s, source_id, pasid, addr); if (iotlb_entry) { - trace_vtd_iotlb_page_hit(source_id, addr, iotlb_entry->slpte, + trace_vtd_iotlb_page_hit(source_id, addr, iotlb_entry->pte, iotlb_entry->domain_id); - slpte = iotlb_entry->slpte; + pte = iotlb_entry->pte; access_flags = iotlb_entry->access_flags; page_mask = iotlb_entry->mask; goto out; @@ -1996,20 +1997,20 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, return true; } - /* Try to fetch slpte form IOTLB for RID2PASID slow path */ + /* Try to fetch pte from IOTLB for RID2PASID slow path */ if (rid2pasid) { iotlb_entry = vtd_lookup_iotlb(s, source_id, pasid, addr); if (iotlb_entry) { - trace_vtd_iotlb_page_hit(source_id, addr, iotlb_entry->slpte, + trace_vtd_iotlb_page_hit(source_id, addr, iotlb_entry->pte, iotlb_entry->domain_id); - slpte = iotlb_entry->slpte; + pte = iotlb_entry->pte; access_flags = iotlb_entry->access_flags; page_mask = iotlb_entry->mask; goto out; } } - ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &slpte, &level, + ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &pte, &level, &reads, &writes, s->aw_bits, pasid); if (ret_fr) { vtd_report_fault(s, -ret_fr, is_fpd_set, source_id, @@ -2017,14 +2018,14 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, goto error; } - page_mask = vtd_slpt_level_page_mask(level); + page_mask = vtd_pt_level_page_mask(level); access_flags = IOMMU_ACCESS_FLAG(reads, writes); vtd_update_iotlb(s, source_id, vtd_get_domain_id(s, &ce, pasid), - addr, slpte, access_flags, level, pasid); + addr, pte, access_flags, level, pasid); out: vtd_iommu_unlock(s); entry->iova = addr & page_mask; - entry->translated_addr = vtd_get_slpte_addr(slpte, s->aw_bits) & page_mask; + entry->translated_addr = vtd_get_pte_addr(pte, s->aw_bits) & page_mask; entry->addr_mask = ~page_mask; entry->perm = access_flags; return true; From patchwork Wed Jan 15 18:09:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 947BBC02180 for ; Wed, 15 Jan 2025 18:09:59 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7pS-0006aT-2d; Wed, 15 Jan 2025 13:09:25 -0500 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 1tY7pH-0006RD-NG for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:12 -0500 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 1tY7pF-0006YJ-H6 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964549; 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=PlqjkAn1GOlm1rdBdYghPXPBG+UbFaprj+bSyaXREJY=; b=d25nGh0OwciEXl6gzfwLVePmLl+lEjzGD2mycI8zUV1Mtr6l2oCxj3/XCqSVHX0lGxBwg4 RYbIwpZ3pEmGSC7XnBaYpZt7/JHNfJajt3ZJUZS/vLKQk4RwYrORSvM6VBMsBQBP5o8bVC 7ybkPv58C2JkQ2kQXvwiDaDDgCiwhxI= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-500-6JjloW3HNmyINCvTALHAnw-1; Wed, 15 Jan 2025 13:09:06 -0500 X-MC-Unique: 6JjloW3HNmyINCvTALHAnw-1 X-Mimecast-MFC-AGG-ID: 6JjloW3HNmyINCvTALHAnw Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43621907030so32468375e9.1 for ; Wed, 15 Jan 2025 10:09:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964544; x=1737569344; 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=PlqjkAn1GOlm1rdBdYghPXPBG+UbFaprj+bSyaXREJY=; b=KPw8zQqHhHLbsVUrImtQs7CHs0372+xPknVBCRMyghXoLTJ/I4sRaeSuwZRO78/c7d +4gCE3Pc3FYEN89HcG2A4P7skha/St2VN2bu8zK0BYSyplGTsRgHXsTerKob/z7G8QIf CJF1SkVWseamqgjSIUXoVID2VjA0Zz1E7gemKWAF+QminICMUVDE72bO/KPuUYaiFN/K KHzhY2URnNpyU/dBBMLD69Doschj6uqJ7y/ciAPnkhRosfIjtGH5VGzJcNFD5Oydj5mP UztlRd2zctbV9Bp4f0KpWy0+DnFWHgvzqCl7EA9+k1uxdihKpCGTCkFIrYnzSmgi+Fns fuVg== X-Gm-Message-State: AOJu0Yz/6FXGXLoaTUh9XMjSEnb6l7/IMXkxnYddIY9NbAl3eArZKqUw oqn9Cyy5hA85Zkt4izpcWA42l8vA6M+XAmqZPp4mHeQxJPzaFP5cJgslPMbEfi9HfMJOxt9I3o4 buMtRQZ9uQFu2QcAr4BxjDM0SplMkqxn4buqbRVf9pfJmHsmYfgfN/D+rc6rP1Zhx264p0U4GHd RXfqz4Vp2dqVU5uhnUZKpjmq+l37i4kA== X-Gm-Gg: ASbGncvCAEzJSYvUR9nmKa6H9mXkzYDSL4bGu8LnY7QLZA81UKZh1xPs011OmupHh/O K+Gzap36scyaybrmzgagNL0XoQoQcoQcuzUsp7cwBQx5OKSIQKgcWAxt0t5QUpCoRKA0fIsMn8u 2XIslE8JJV1+RtYpxzbOjbVFbShXOAu0wrqvTVyiVflJ/LQligjXoKf+Y7cs8NjJa6F1TS8GY8p 6iku5Iv6qRGQDapnGx/VKv8aAI5T/OLeHdIlxvnPmWhmT3aPHLs X-Received: by 2002:a5d:64e2:0:b0:38b:e32a:109f with SMTP id ffacd0b85a97d-38be32a1305mr6677603f8f.12.1736964544291; Wed, 15 Jan 2025 10:09:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGbb1NadXNCQKHClDQfeUX4DtZr/29cTo0WLFfbmgKFfBwdd5Q8YhZQBX1pc+O06qLZdf7A3Q== X-Received: by 2002:a5d:64e2:0:b0:38b:e32a:109f with SMTP id ffacd0b85a97d-38be32a1305mr6677569f8f.12.1736964543849; Wed, 15 Jan 2025 10:09:03 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b81e4sm18569634f8f.64.2025.01.15.10.09.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:03 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:00 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Yi Liu , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Yi Sun , Zhenzhong Duan , Jason Wang , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 11/48] intel_iommu: Implement stage-1 translation 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Yi Liu This adds stage-1 page table walking to support stage-1 only translation in scalable mode. Signed-off-by: Yi Liu Co-developed-by: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Message-Id: <20241212083757.605022-7-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 34 +++++++ hw/i386/intel_iommu.c | 158 ++++++++++++++++++++++++++++++++- 2 files changed, 188 insertions(+), 4 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index e810b0071f..86d3354198 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -320,6 +320,15 @@ typedef enum VTDFaultReason { VTD_FR_PASID_ENTRY_P = 0x59, VTD_FR_PASID_TABLE_ENTRY_INV = 0x5b, /*Invalid PASID table entry */ + /* Fail to access a first-level paging entry (not FS_PML4E) */ + VTD_FR_FS_PAGING_ENTRY_INV = 0x70, + VTD_FR_FS_PAGING_ENTRY_P = 0x71, + /* Non-zero reserved field in present first-stage paging entry */ + VTD_FR_FS_PAGING_ENTRY_RSVD = 0x72, + VTD_FR_PASID_ENTRY_FSPTPTR_INV = 0x73, /* Invalid FSPTPTR in PASID entry */ + VTD_FR_FS_PAGING_ENTRY_US = 0x81, /* Privilege violation */ + VTD_FR_SM_WRITE = 0x85, /* No write permission */ + /* Output address in the interrupt address range for scalable mode */ VTD_FR_SM_INTERRUPT_ADDR = 0x87, VTD_FR_MAX, /* Guard */ @@ -438,6 +447,22 @@ typedef union VTDInvDesc VTDInvDesc; (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM | VTD_SL_TM)) : \ (0x3ffff800ULL | ~(VTD_HAW_MASK(aw) | VTD_SL_IGN_COM)) +/* Rsvd field masks for fpte */ +#define VTD_FS_UPPER_IGNORED 0xfff0000000000000ULL +#define VTD_FPTE_PAGE_L1_RSVD_MASK(aw) \ + (~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) +#define VTD_FPTE_PAGE_L2_RSVD_MASK(aw) \ + (~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) +#define VTD_FPTE_PAGE_L3_RSVD_MASK(aw) \ + (~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) +#define VTD_FPTE_PAGE_L4_RSVD_MASK(aw) \ + (0x80ULL | ~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) + +#define VTD_FPTE_LPAGE_L2_RSVD_MASK(aw) \ + (0x1fe000ULL | ~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) +#define VTD_FPTE_LPAGE_L3_RSVD_MASK(aw) \ + (0x3fffe000ULL | ~(VTD_HAW_MASK(aw) | VTD_FS_UPPER_IGNORED)) + /* Masks for PIOTLB Invalidate Descriptor */ #define VTD_INV_DESC_PIOTLB_G (3ULL << 4) #define VTD_INV_DESC_PIOTLB_ALL_IN_PASID (2ULL << 4) @@ -530,6 +555,15 @@ typedef struct VTDRootEntry VTDRootEntry; #define VTD_SM_PASID_ENTRY_AW 7ULL /* Adjusted guest-address-width */ #define VTD_SM_PASID_ENTRY_DID(val) ((val) & VTD_DOMAIN_ID_MASK) +#define VTD_SM_PASID_ENTRY_FLPM 3ULL +#define VTD_SM_PASID_ENTRY_FLPTPTR (~0xfffULL) + +/* First Level Paging Structure */ +/* Masks for First Level Paging Entry */ +#define VTD_FL_P 1ULL +#define VTD_FL_RW (1ULL << 1) +#define VTD_FL_US (1ULL << 2) + /* Second Level Page Translation Pointer*/ #define VTD_SM_PASID_ENTRY_SLPTPTR (~0xfffULL) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index dfac5982d6..bd6de71c02 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -48,6 +48,8 @@ /* pe operations */ #define VTD_PE_GET_TYPE(pe) ((pe)->val[0] & VTD_SM_PASID_ENTRY_PGTT) +#define VTD_PE_GET_FL_LEVEL(pe) \ + (4 + (((pe)->val[2] >> 2) & VTD_SM_PASID_ENTRY_FLPM)) #define VTD_PE_GET_SL_LEVEL(pe) \ (2 + (((pe)->val[0] >> 2) & VTD_SM_PASID_ENTRY_AW)) @@ -755,6 +757,11 @@ static inline bool vtd_is_sl_level_supported(IntelIOMMUState *s, uint32_t level) (1ULL << (level - 2 + VTD_CAP_SAGAW_SHIFT)); } +static inline bool vtd_is_fl_level_supported(IntelIOMMUState *s, uint32_t level) +{ + return level == VTD_PML4_LEVEL; +} + /* Return true if check passed, otherwise false */ static inline bool vtd_pe_type_check(X86IOMMUState *x86_iommu, VTDPASIDEntry *pe) @@ -838,6 +845,11 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, return -VTD_FR_PASID_TABLE_ENTRY_INV; } + if (pgtt == VTD_SM_PASID_ENTRY_FLT && + !vtd_is_fl_level_supported(s, VTD_PE_GET_FL_LEVEL(pe))) { + return -VTD_FR_PASID_TABLE_ENTRY_INV; + } + return 0; } @@ -973,7 +985,11 @@ static uint32_t vtd_get_iova_level(IntelIOMMUState *s, if (s->root_scalable) { vtd_ce_get_rid2pasid_entry(s, ce, &pe, pasid); - return VTD_PE_GET_SL_LEVEL(&pe); + if (s->flts) { + return VTD_PE_GET_FL_LEVEL(&pe); + } else { + return VTD_PE_GET_SL_LEVEL(&pe); + } } return vtd_ce_get_level(ce); @@ -1060,7 +1076,11 @@ static dma_addr_t vtd_get_iova_pgtbl_base(IntelIOMMUState *s, if (s->root_scalable) { vtd_ce_get_rid2pasid_entry(s, ce, &pe, pasid); - return pe.val[0] & VTD_SM_PASID_ENTRY_SLPTPTR; + if (s->flts) { + return pe.val[2] & VTD_SM_PASID_ENTRY_FLPTPTR; + } else { + return pe.val[0] & VTD_SM_PASID_ENTRY_SLPTPTR; + } } return vtd_ce_get_slpt_base(ce); @@ -1800,6 +1820,12 @@ static const bool vtd_qualified_faults[] = { [VTD_FR_PASID_TABLE_ACCESS_ERR] = false, [VTD_FR_PASID_ENTRY_P] = true, [VTD_FR_PASID_TABLE_ENTRY_INV] = true, + [VTD_FR_FS_PAGING_ENTRY_INV] = true, + [VTD_FR_FS_PAGING_ENTRY_P] = true, + [VTD_FR_FS_PAGING_ENTRY_RSVD] = true, + [VTD_FR_PASID_ENTRY_FSPTPTR_INV] = true, + [VTD_FR_FS_PAGING_ENTRY_US] = true, + [VTD_FR_SM_WRITE] = true, [VTD_FR_SM_INTERRUPT_ADDR] = true, [VTD_FR_MAX] = false, }; @@ -1862,6 +1888,113 @@ out: trace_vtd_pt_enable_fast_path(source_id, success); } +/* + * Rsvd field masks for fpte: + * vtd_fpte_rsvd 4k pages + * vtd_fpte_rsvd_large large pages + * + * We support only 4-level page tables. + */ +#define VTD_FPTE_RSVD_LEN 5 +static uint64_t vtd_fpte_rsvd[VTD_FPTE_RSVD_LEN]; +static uint64_t vtd_fpte_rsvd_large[VTD_FPTE_RSVD_LEN]; + +static bool vtd_flpte_nonzero_rsvd(uint64_t flpte, uint32_t level) +{ + uint64_t rsvd_mask; + + /* + * We should have caught a guest-mis-programmed level earlier, + * via vtd_is_fl_level_supported. + */ + assert(level < VTD_FPTE_RSVD_LEN); + /* + * Zero level doesn't exist. The smallest level is VTD_PT_LEVEL=1 and + * checked by vtd_is_last_pte(). + */ + assert(level); + + if ((level == VTD_PD_LEVEL || level == VTD_PDP_LEVEL) && + (flpte & VTD_PT_PAGE_SIZE_MASK)) { + /* large page */ + rsvd_mask = vtd_fpte_rsvd_large[level]; + } else { + rsvd_mask = vtd_fpte_rsvd[level]; + } + + return flpte & rsvd_mask; +} + +static inline bool vtd_flpte_present(uint64_t flpte) +{ + return !!(flpte & VTD_FL_P); +} + +/* + * Given the @iova, get relevant @flptep. @flpte_level will be the last level + * of the translation, can be used for deciding the size of large page. + */ +static int vtd_iova_to_flpte(IntelIOMMUState *s, VTDContextEntry *ce, + uint64_t iova, bool is_write, + uint64_t *flptep, uint32_t *flpte_level, + bool *reads, bool *writes, uint8_t aw_bits, + uint32_t pasid) +{ + dma_addr_t addr = vtd_get_iova_pgtbl_base(s, ce, pasid); + uint32_t level = vtd_get_iova_level(s, ce, pasid); + uint32_t offset; + uint64_t flpte; + + while (true) { + offset = vtd_iova_level_offset(iova, level); + flpte = vtd_get_pte(addr, offset); + + if (flpte == (uint64_t)-1) { + if (level == vtd_get_iova_level(s, ce, pasid)) { + /* Invalid programming of pasid-entry */ + return -VTD_FR_PASID_ENTRY_FSPTPTR_INV; + } else { + return -VTD_FR_FS_PAGING_ENTRY_INV; + } + } + + if (!vtd_flpte_present(flpte)) { + *reads = false; + *writes = false; + return -VTD_FR_FS_PAGING_ENTRY_P; + } + + /* No emulated device supports supervisor privilege request yet */ + if (!(flpte & VTD_FL_US)) { + *reads = false; + *writes = false; + return -VTD_FR_FS_PAGING_ENTRY_US; + } + + *reads = true; + *writes = (*writes) && (flpte & VTD_FL_RW); + if (is_write && !(flpte & VTD_FL_RW)) { + return -VTD_FR_SM_WRITE; + } + if (vtd_flpte_nonzero_rsvd(flpte, level)) { + error_report_once("%s: detected flpte reserved non-zero " + "iova=0x%" PRIx64 ", level=0x%" PRIx32 + "flpte=0x%" PRIx64 ", pasid=0x%" PRIX32 ")", + __func__, iova, level, flpte, pasid); + return -VTD_FR_FS_PAGING_ENTRY_RSVD; + } + + if (vtd_is_last_pte(flpte, level)) { + *flptep = flpte; + *flpte_level = level; + return 0; + } + + addr = vtd_get_pte_addr(flpte, aw_bits); + level--; + } +} + static void vtd_report_fault(IntelIOMMUState *s, int err, bool is_fpd_set, uint16_t source_id, @@ -2010,8 +2143,13 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, } } - ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &pte, &level, - &reads, &writes, s->aw_bits, pasid); + if (s->flts && s->root_scalable) { + ret_fr = vtd_iova_to_flpte(s, &ce, addr, is_write, &pte, &level, + &reads, &writes, s->aw_bits, pasid); + } else { + ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &pte, &level, + &reads, &writes, s->aw_bits, pasid); + } if (ret_fr) { vtd_report_fault(s, -ret_fr, is_fpd_set, source_id, addr, is_write, pasid != PCI_NO_PASID, pasid); @@ -4286,6 +4424,18 @@ static void vtd_init(IntelIOMMUState *s) vtd_spte_rsvd_large[3] = VTD_SPTE_LPAGE_L3_RSVD_MASK(s->aw_bits, x86_iommu->dt_supported && s->stale_tm); + /* + * Rsvd field masks for fpte + */ + vtd_fpte_rsvd[0] = ~0ULL; + vtd_fpte_rsvd[1] = VTD_FPTE_PAGE_L1_RSVD_MASK(s->aw_bits); + vtd_fpte_rsvd[2] = VTD_FPTE_PAGE_L2_RSVD_MASK(s->aw_bits); + vtd_fpte_rsvd[3] = VTD_FPTE_PAGE_L3_RSVD_MASK(s->aw_bits); + vtd_fpte_rsvd[4] = VTD_FPTE_PAGE_L4_RSVD_MASK(s->aw_bits); + + vtd_fpte_rsvd_large[2] = VTD_FPTE_LPAGE_L2_RSVD_MASK(s->aw_bits); + vtd_fpte_rsvd_large[3] = VTD_FPTE_LPAGE_L3_RSVD_MASK(s->aw_bits); + if (s->scalable_mode || s->snoop_control) { vtd_spte_rsvd[1] &= ~VTD_SPTE_SNP; vtd_spte_rsvd_large[2] &= ~VTD_SPTE_SNP; From patchwork Wed Jan 15 18:09:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940744 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8E021C02180 for ; Wed, 15 Jan 2025 18:14:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7pX-0006bD-P0; Wed, 15 Jan 2025 13:09:29 -0500 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 1tY7pK-0006Rl-5y for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:16 -0500 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 1tY7pI-0006Yb-Lt for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964552; 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=yUynNl6G6n93MWB/hyqu1Gtvpusp5dtT/74ynqqHtUo=; b=F5DKYqjVyCYvijqMsYKai7xiZDJ2D49IiMmthMpI8BQd5EhJ7Gdz7fyhNOIFUw3A1WpP0C qitO7TblGONZHVSRXuN2sS+mPx1RuspI5zHgOD/sAY3/GyoER3Fvf38DIu0gSsi+XbNC6h hUD5JV59EEeAjNNDsTIUM77vna5oAb8= 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-79-elZhT-bhP2KefnbKFZhA0g-1; Wed, 15 Jan 2025 13:09:09 -0500 X-MC-Unique: elZhT-bhP2KefnbKFZhA0g-1 X-Mimecast-MFC-AGG-ID: elZhT-bhP2KefnbKFZhA0g Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-386333ea577so38950f8f.1 for ; Wed, 15 Jan 2025 10:09:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964547; x=1737569347; 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=yUynNl6G6n93MWB/hyqu1Gtvpusp5dtT/74ynqqHtUo=; b=RCwbCa4uT4NveddeZWieNHoeGtd7C6wYKSzcBUgshBqEuSkqAq7rgTT4zXKum4T56y HkFaF4GkuZs4A57mNf56oVB9LzuPzFOrMALKNwGZIMyaQyPI//9v/dE/qNAmJqeLRgv2 Gq360/5cT37swXCOftFZWt0+5idlNc1L4igpYGkXLZcmHhZbpOyKwM1duxNKJ0u42naG A76djWoIzWwVgRiq9MD0qL+AIf2lKHKNj8Zp/Pz1RuKVomqfGWZQ31yhBzNfW8Ko3Qfk k03dhSiQtQtAZhWiq89LMp3ALuYsrOa2+eXG0g4CIt6JUugmyIE6XTBuaO6Qzzq4hr1C X+BQ== X-Gm-Message-State: AOJu0Yy25Kr++h6A2RmZrFj053N2/oJZQZm1cHcbathx8AWHYL/hCF1L 9lKe40FNE/pgtagzGaNaplFeV4XnViLHnJCYLn/M5zqHh1mMaMmeALh8wSTDCwRu6rW+b08if2M p/f3ueEKuYQl74B604MvQXgXGWhlpBNCtupiSRdkoIdUfTx502kBLAuaH+rMYTk9kgotU28MHDV BnWdhio5Xi1mxPk2Bq//HxWeugzMM5hQ== X-Gm-Gg: ASbGncsMAZnIXPcgGLjt5ib4of3a8FL6iEa+dJus7hMvL9CnJ83Ab1crgZTkS2T1X3X tv2PkzW2gx13wVyfMfUdYO4wo4IlQ/1ahYsbBP65BbheZjEGVL/YHmqaw/rhp+l7jpLw/ATqNbT fMjQXoNum+P9MKlgsPhe1XAxCppBO4Ol4kTGj5rqSYg2zhDvml857Yelo0YlNdx/BjYzht0VrCA uMFRyLDT2le64sihLG4Y/Cs1PP+V16n08oOVyh3aqYjlhGVDAT6 X-Received: by 2002:a05:6000:18a3:b0:385:e1eb:a7af with SMTP id ffacd0b85a97d-38a873152c0mr32361717f8f.48.1736964547444; Wed, 15 Jan 2025 10:09:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI91oLDp0iaiN+0oUY8sFZ5Kux1uu+iOHQuUsla5sCW7g6aZUTWd+StvMOz+tqzBbYvsAZJw== X-Received: by 2002:a05:6000:18a3:b0:385:e1eb:a7af with SMTP id ffacd0b85a97d-38a873152c0mr32361683f8f.48.1736964547033; Wed, 15 Jan 2025 10:09:07 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d012sm18213801f8f.8.2025.01.15.10.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:06 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:04 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Zhenzhong Duan , Jason Wang , Yi Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 12/48] intel_iommu: Check if the input address is canonical Message-ID: <305e469b7188e5f1a896c40853d84fa158ee6ba4.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Clément Mathieu--Drif Stage-1 translation must fail if the address to translate is not canonical. Signed-off-by: Clément Mathieu--Drif Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-8-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 1 + hw/i386/intel_iommu.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 86d3354198..3e7365dfff 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -326,6 +326,7 @@ typedef enum VTDFaultReason { /* Non-zero reserved field in present first-stage paging entry */ VTD_FR_FS_PAGING_ENTRY_RSVD = 0x72, VTD_FR_PASID_ENTRY_FSPTPTR_INV = 0x73, /* Invalid FSPTPTR in PASID entry */ + VTD_FR_FS_NON_CANONICAL = 0x80, /* SNG.1 : Address for FS not canonical.*/ VTD_FR_FS_PAGING_ENTRY_US = 0x81, /* Privilege violation */ VTD_FR_SM_WRITE = 0x85, /* No write permission */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index bd6de71c02..3959fe44c7 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1824,6 +1824,7 @@ static const bool vtd_qualified_faults[] = { [VTD_FR_FS_PAGING_ENTRY_P] = true, [VTD_FR_FS_PAGING_ENTRY_RSVD] = true, [VTD_FR_PASID_ENTRY_FSPTPTR_INV] = true, + [VTD_FR_FS_NON_CANONICAL] = true, [VTD_FR_FS_PAGING_ENTRY_US] = true, [VTD_FR_SM_WRITE] = true, [VTD_FR_SM_INTERRUPT_ADDR] = true, @@ -1930,6 +1931,22 @@ static inline bool vtd_flpte_present(uint64_t flpte) return !!(flpte & VTD_FL_P); } +/* Return true if IOVA is canonical, otherwise false. */ +static bool vtd_iova_fl_check_canonical(IntelIOMMUState *s, uint64_t iova, + VTDContextEntry *ce, uint32_t pasid) +{ + uint64_t iova_limit = vtd_iova_limit(s, ce, s->aw_bits, pasid); + uint64_t upper_bits_mask = ~(iova_limit - 1); + uint64_t upper_bits = iova & upper_bits_mask; + bool msb = ((iova & (iova_limit >> 1)) != 0); + + if (msb) { + return upper_bits == upper_bits_mask; + } else { + return !upper_bits; + } +} + /* * Given the @iova, get relevant @flptep. @flpte_level will be the last level * of the translation, can be used for deciding the size of large page. @@ -1945,6 +1962,12 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VTDContextEntry *ce, uint32_t offset; uint64_t flpte; + if (!vtd_iova_fl_check_canonical(s, iova, ce, pasid)) { + error_report_once("%s: detected non canonical IOVA (iova=0x%" PRIx64 "," + "pasid=0x%" PRIx32 ")", __func__, iova, pasid); + return -VTD_FR_FS_NON_CANONICAL; + } + while (true) { offset = vtd_iova_level_offset(iova, level); flpte = vtd_get_pte(addr, offset); From patchwork Wed Jan 15 18:09:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E40AC02183 for ; Wed, 15 Jan 2025 18:14:37 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qH-0007Jp-0t; Wed, 15 Jan 2025 13:10:13 -0500 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 1tY7pN-0006WS-2l for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:17 -0500 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 1tY7pK-0006ZD-Dt for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964553; 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=Kdtm+2f9V+BfEyWZHZKI78yzC3XfKmF43hh2EJ0QkBU=; b=iuZ83PR9R7dwJ3EmYQI+vHrpx6GjCOsrkHMNbnb0XVzVrPV/7XI0d01pLhx3xtfFeDcoI+ uGA/SiGtxLyvj7Dwri3fgHdSdovpiKPsat8poFe+iBLL7ceOMBwhlM74/Bv6VzflgA5f9P R20CrNW6UqS5YlZhuYjf9N/pNeVA0ek= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-204-NFaMRDEqONmOl-ytxdT4wQ-1; Wed, 15 Jan 2025 13:09:12 -0500 X-MC-Unique: NFaMRDEqONmOl-ytxdT4wQ-1 X-Mimecast-MFC-AGG-ID: NFaMRDEqONmOl-ytxdT4wQ Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361a8fc3bdso37116445e9.2 for ; Wed, 15 Jan 2025 10:09:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964551; x=1737569351; 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=Kdtm+2f9V+BfEyWZHZKI78yzC3XfKmF43hh2EJ0QkBU=; b=vp94kiKw7HeH9JCx9PdxSjQSEAIDvj91pO0oQr06sVb5/5BaNx3Rjf5C8tEQGgKUzb NWvM8RoS76C4+phn4MBn2oDmy2SyJcIeIfHtsjh0sn1jOhVpI1hfTipuKN6iQwgHBTZA t2deo/ZyaxUb0ozZxgZRotmvgIEXmX62v97xUtfqRPVLS4adPQPeF881TIW2FkR77fOV EO7Y07ky0PBiwWAeYZIxMUpi9b+0rrLjPvrxhiz0DRsrIG9I7oI7Jg12FDm8oxA0lVX+ iJawRHgroEHEfM02Vi5cyhQq4JMOYHEJCxxSrCQi/HJF85Zbupr0nbLu9Tge17Wr+QYc TrYw== X-Gm-Message-State: AOJu0YxQx8FLzYa6QG6A/C9uutzMe1LVVlFJAv+2F2OsVfdO79zyH5g/ Yr/lQ5lWOFZyMvtJPDVNU8e3OXFYDd6dpujZ+JQLw01yxOO+JV+LxeZtyfgclLSjuxflfgPjIn1 IsqOo7kbVtTk/HV9HdRO3y+83B058t6EJr3RCS281kJaKXlequMEFLZElJ2zAs9UyaNxo+TYfRw FSWQYN/9PalQOLtVtYo9k4HC8nhztXbg== X-Gm-Gg: ASbGnctiqA3W0ohRFGaidm8OjsvFzlDPWbOVDUgRZ2eIOR1DuJM71wvKUKt3tFQzCGp kHHCIUUKCpC1hKwHVMdsCl0ggRtc9yPZBh9kFPTtPXjZjvvvw6cFCOXrknkV3XaqXOhzvSR8JWA IoCmQQVKN1H9PA1npO/GwyUcZfq3lAy1R0TEmswniJ6VWGYkRCNK2Qnef0ViTEOkmyKntNeDxHw sUPYe3CaSrBUxchcgv8O7cRz/ZndgKh3YRAfjKzBU+CnSezHp1Y X-Received: by 2002:a05:600c:1ca9:b0:435:136:75f6 with SMTP id 5b1f17b1804b1-436e2551d7bmr299616505e9.0.1736964550879; Wed, 15 Jan 2025 10:09:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6r9jsTuGkN/DnN9sXfOyIUHCV42SN+NOxRTvQ8WzYfUKaQQdiJuiMDdPuVCkKO+InLPw5XA== X-Received: by 2002:a05:600c:1ca9:b0:435:136:75f6 with SMTP id 5b1f17b1804b1-436e2551d7bmr299616035e9.0.1736964550413; Wed, 15 Jan 2025 10:09:10 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7499942sm31161245e9.6.2025.01.15.10.09.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:09 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:07 -0500 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 13/48] intel_iommu: Check stage-1 translation result with interrupt range 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Per VT-d spec 4.1 section 3.15, "Untranslated requests and translation requests that result in an address in the interrupt range will be blocked with condition code LGN.4 or SGN.8." This applies to both stage-1 and stage-2 IOMMU page table, move the check from vtd_iova_to_slpte() to vtd_do_iommu_translate() so stage-1 page table could also be checked. By this chance, update the comment with correct section number. Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang Message-Id: <20241212083757.605022-9-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 48 ++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 3959fe44c7..d53ce01e82 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1138,7 +1138,6 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce, uint32_t offset; uint64_t slpte; uint64_t access_right_check; - uint64_t xlat, size; if (!vtd_iova_sl_range_check(s, iova, ce, aw_bits, pasid)) { error_report_once("%s: detected IOVA overflow (iova=0x%" PRIx64 "," @@ -1191,28 +1190,7 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce, level--; } - xlat = vtd_get_pte_addr(*slptep, aw_bits); - size = ~vtd_pt_level_page_mask(level) + 1; - - /* - * From VT-d spec 3.14: Untranslated requests and translation - * requests that result in an address in the interrupt range will be - * blocked with condition code LGN.4 or SGN.8. - */ - if ((xlat > VTD_INTERRUPT_ADDR_LAST || - xlat + size - 1 < VTD_INTERRUPT_ADDR_FIRST)) { - return 0; - } else { - error_report_once("%s: xlat address is in interrupt range " - "(iova=0x%" PRIx64 ", level=0x%" PRIx32 ", " - "slpte=0x%" PRIx64 ", write=%d, " - "xlat=0x%" PRIx64 ", size=0x%" PRIx64 ", " - "pasid=0x%" PRIx32 ")", - __func__, iova, level, slpte, is_write, - xlat, size, pasid); - return s->scalable_mode ? -VTD_FR_SM_INTERRUPT_ADDR : - -VTD_FR_INTERRUPT_ADDR; - } + return 0; } typedef int (*vtd_page_walk_hook)(const IOMMUTLBEvent *event, void *private); @@ -2064,6 +2042,7 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, uint8_t access_flags; bool rid2pasid = (pasid == PCI_NO_PASID) && s->root_scalable; VTDIOTLBEntry *iotlb_entry; + uint64_t xlat, size; /* * We have standalone memory region for interrupt addresses, we @@ -2173,6 +2152,29 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &pte, &level, &reads, &writes, s->aw_bits, pasid); } + if (!ret_fr) { + xlat = vtd_get_pte_addr(pte, s->aw_bits); + size = ~vtd_pt_level_page_mask(level) + 1; + + /* + * Per VT-d spec 4.1 section 3.15: Untranslated requests and translation + * requests that result in an address in the interrupt range will be + * blocked with condition code LGN.4 or SGN.8. + */ + if ((xlat <= VTD_INTERRUPT_ADDR_LAST && + xlat + size - 1 >= VTD_INTERRUPT_ADDR_FIRST)) { + error_report_once("%s: xlat address is in interrupt range " + "(iova=0x%" PRIx64 ", level=0x%" PRIx32 ", " + "pte=0x%" PRIx64 ", write=%d, " + "xlat=0x%" PRIx64 ", size=0x%" PRIx64 ", " + "pasid=0x%" PRIx32 ")", + __func__, addr, level, pte, is_write, + xlat, size, pasid); + ret_fr = s->scalable_mode ? -VTD_FR_SM_INTERRUPT_ADDR : + -VTD_FR_INTERRUPT_ADDR; + } + } + if (ret_fr) { vtd_report_fault(s, -ret_fr, is_fpd_set, source_id, addr, is_write, pasid != PCI_NO_PASID, pasid); From patchwork Wed Jan 15 18:09:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940764 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED064C3DA4A for ; Wed, 15 Jan 2025 18:18:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s3-0005kb-4s; Wed, 15 Jan 2025 13:12:03 -0500 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 1tY7pV-0006cx-75 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:27 -0500 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 1tY7pT-0006cO-IH for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964563; 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=yUuOMI9pfBriuw1YERiIKw5x8dB/u/FGXCgcdZJucXc=; b=JnSLgxo9FOoDVnMXeD+jlOrQGUDjlg7P4ZMChVFo1N+UX6I3zvltKrIqfJcvzl0MmNMz6s enXjAyymgVum2MwbwPyvRR8ke4PKOoKHBA41xN0Sw19mbIY7zJpLaqLpitzl0U/pMXGHng H8W9rYrEGL9cLKAjcnTzWeGh1jmNyv8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-594-gfFyaFlKPgCbUcoPmMp7Kw-1; Wed, 15 Jan 2025 13:09:15 -0500 X-MC-Unique: gfFyaFlKPgCbUcoPmMp7Kw-1 X-Mimecast-MFC-AGG-ID: gfFyaFlKPgCbUcoPmMp7Kw Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-436289a570eso32469415e9.0 for ; Wed, 15 Jan 2025 10:09:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964554; x=1737569354; 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=yUuOMI9pfBriuw1YERiIKw5x8dB/u/FGXCgcdZJucXc=; b=kevC4j0yh3e2zp1O+bo0X2oeQqvcchy9cVpt3XdBNIyzSIn8xqN7pkdin2IO1jOcxb KyfowI9PeWVFaaIWTddk1rxB7uqsLnxBpFcpigIk4ttUTU9bg3ZvEafPYix/i9NSmfB9 fQ4aDNI06p9Ai4uWb9rAYiUojZQL5tGBx9VMs0O1AUDf8vuIp+c/4ciSPGYa5FgoKg0t wvTsgwo5CC4TtncAC8f4cS9u1nju7ZL4k4fbq1KCVEKa5RqA32wiWhHsxbHgBtZe9mE4 m+ys2GtvSloX0JF7IPBteEjMF6KGWg96SpKqCU3FWQscoFjZ6+2P2kP8gsLE8SUnSDKD MfSQ== X-Gm-Message-State: AOJu0Yw51C6jODsv10IxFM5Z51zIQKjt7tZsQTEi+OCkG3AOmTZKlPsH DgdE39qWuG67TfP3imrTx/kB/USP7l501fyW/vYbkkTiw6d8IuEV3fUyG1JDrko51K2XadmwOu1 uzFp17fZp12uLGze1bvcFsvEv68XJdcusyfXTlIOsTLFyet3mVcv8CthmEoBMuCqaM0/2HZwgA2 aUoNuXXKDS5gSuSPhddWrhmrvKgruXKg== X-Gm-Gg: ASbGncux5kqQO9bJuIkN2TpqIgKtu176AaCyTuyNtlZgh1iCYNXv4MldQXNBDPD2TPT SwhYae923iXpZbwShZc8Ae0FTBqhT3TFx5QlreSfVcR+Wbt2qsHeZJCgKIdKpwhMS5Z1menqHTg +dOfaAT3aBHcsN1Zxdr1Wm4N+QpWjbVnAAD/nMlmRdhkkZae2+41/5IjpRyfRn1VU4Fbivkoj06 hf7omVzsyCRZu7vF7WizgwYeSiEUYC0VRW3pLLVqWUlthr01C1V X-Received: by 2002:a05:600c:1d03:b0:434:a781:f5d9 with SMTP id 5b1f17b1804b1-436e2697b32mr267376865e9.11.1736964554100; Wed, 15 Jan 2025 10:09:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIneviXe17E+o3PnIig6VgM4OSau0R4EuAn4Q68ISo5oYe0VQd0Zlj4WjPCyDIeDVJQrnMZQ== X-Received: by 2002:a05:600c:1d03:b0:434:a781:f5d9 with SMTP id 5b1f17b1804b1-436e2697b32mr267376405e9.11.1736964553624; Wed, 15 Jan 2025 10:09:13 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c57ebsm30955795e9.20.2025.01.15.10.09.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:13 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:10 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Zhenzhong Duan , Yi Liu , Jason Wang , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 14/48] intel_iommu: Set accessed and dirty bits during stage-1 translation Message-ID: <65c4f0999991f6321d6a369fa56c81c57c5b87ad.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif Signed-off-by: Zhenzhong Duan Reviewed-by: Yi Liu Acked-by: Jason Wang Message-Id: <20241212083757.605022-10-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 3 +++ hw/i386/intel_iommu.c | 25 ++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 3e7365dfff..22dd3faf0c 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -332,6 +332,7 @@ typedef enum VTDFaultReason { /* Output address in the interrupt address range for scalable mode */ VTD_FR_SM_INTERRUPT_ADDR = 0x87, + VTD_FR_FS_BIT_UPDATE_FAILED = 0x91, /* SFS.10 */ VTD_FR_MAX, /* Guard */ } VTDFaultReason; @@ -564,6 +565,8 @@ typedef struct VTDRootEntry VTDRootEntry; #define VTD_FL_P 1ULL #define VTD_FL_RW (1ULL << 1) #define VTD_FL_US (1ULL << 2) +#define VTD_FL_A (1ULL << 5) +#define VTD_FL_D (1ULL << 6) /* Second Level Page Translation Pointer*/ #define VTD_SM_PASID_ENTRY_SLPTPTR (~0xfffULL) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index d53ce01e82..0aeb0dbde9 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -1806,6 +1806,7 @@ static const bool vtd_qualified_faults[] = { [VTD_FR_FS_PAGING_ENTRY_US] = true, [VTD_FR_SM_WRITE] = true, [VTD_FR_SM_INTERRUPT_ADDR] = true, + [VTD_FR_FS_BIT_UPDATE_FAILED] = true, [VTD_FR_MAX] = false, }; @@ -1925,6 +1926,20 @@ static bool vtd_iova_fl_check_canonical(IntelIOMMUState *s, uint64_t iova, } } +static MemTxResult vtd_set_flag_in_pte(dma_addr_t base_addr, uint32_t index, + uint64_t pte, uint64_t flag) +{ + if (pte & flag) { + return MEMTX_OK; + } + pte |= flag; + pte = cpu_to_le64(pte); + return dma_memory_write(&address_space_memory, + base_addr + index * sizeof(pte), + &pte, sizeof(pte), + MEMTXATTRS_UNSPECIFIED); +} + /* * Given the @iova, get relevant @flptep. @flpte_level will be the last level * of the translation, can be used for deciding the size of large page. @@ -1938,7 +1953,7 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VTDContextEntry *ce, dma_addr_t addr = vtd_get_iova_pgtbl_base(s, ce, pasid); uint32_t level = vtd_get_iova_level(s, ce, pasid); uint32_t offset; - uint64_t flpte; + uint64_t flpte, flag_ad = VTD_FL_A; if (!vtd_iova_fl_check_canonical(s, iova, ce, pasid)) { error_report_once("%s: detected non canonical IOVA (iova=0x%" PRIx64 "," @@ -1985,6 +2000,14 @@ static int vtd_iova_to_flpte(IntelIOMMUState *s, VTDContextEntry *ce, return -VTD_FR_FS_PAGING_ENTRY_RSVD; } + if (vtd_is_last_pte(flpte, level) && is_write) { + flag_ad |= VTD_FL_D; + } + + if (vtd_set_flag_in_pte(addr, offset, flpte, flag_ad) != MEMTX_OK) { + return -VTD_FR_FS_BIT_UPDATE_FAILED; + } + if (vtd_is_last_pte(flpte, level)) { *flptep = flpte; *flpte_level = level; From patchwork Wed Jan 15 18:09:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940762 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D91F5C02180 for ; Wed, 15 Jan 2025 18:18:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rJ-0002Gf-Ul; Wed, 15 Jan 2025 13:11:18 -0500 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 1tY7pT-0006cm-8k for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:27 -0500 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 1tY7pR-0006bf-Ic for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964561; 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=RQVvjCs9hJ4fa3Za7Y4VaNHAdY6GKN1MD2EFSfUnud4=; b=H07XI4JHSwEbZCz/dkh63eJbJULUr9OXNSZYxGOYJGmuyd6wZDvZ3FJTOt6X4ieYw6wVXh omPi1a5X5+kJ4trYTVmUmGIDqlJx5oKv8Mb9VFSMhS7BzG6ok5AC2CLQXq0mOLu6wtoffY 1OCGVVsl2c1yudg5Sc4u6SS40ORG9Dw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-98-DQkn53ULMBKS36Mt3Icifg-1; Wed, 15 Jan 2025 13:09:19 -0500 X-MC-Unique: DQkn53ULMBKS36Mt3Icifg-1 X-Mimecast-MFC-AGG-ID: DQkn53ULMBKS36Mt3Icifg Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4361f371908so47769235e9.0 for ; Wed, 15 Jan 2025 10:09:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964557; x=1737569357; 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=RQVvjCs9hJ4fa3Za7Y4VaNHAdY6GKN1MD2EFSfUnud4=; b=VKtC6UCrBhcJmgz0ozqg8bjObWQiwye7IuNBmf6AQWuVqhCF2R+HooBvoEjO1fOr3/ XimXQNLBo5+kaxWNHOmAFovWzUpZQFclhTN2sT/2jTyKknVrT0GTZIgvqUCoRnBGzQNj f15I72cZvVu4k97t7FDKv6WZ5HVTY/A2I+oGNW7vCRwUnQApqtbTaGCxQEiLW9OB3nRG U/2QUNYy/deb/is/oY65QLF+Ec4RHu+xowjG4oJxB4zL+Sk3AVJgsQRgvQRAF954SDZd IY7mr1JUf+/1VikeTKvcfnaE8ttWqvc/Omn++r4pg1XrYzhk32fY1YVZ+LrDJDCC87ki LC5A== X-Gm-Message-State: AOJu0Yx4DOv9RlRwXkOZbShND6sT4RA2zUsyv/7oOA8JibKGGYYF5oGG DlhszWsHpoOuf8mdxgsCw/DBYbG040TQyblO8lV2kbm+DdoAIQDaBt9Lj18ZYqMLyttqVg39m52 Gow8Kr5TzVz8+jbcUbr/ttVZmGLzmruRWPcxZVGSsAuVyKIWXj3mRVtYEaKNG+ID0hRDHxWbAYv aYlF+OTFs+W231RTI82H1StNgMsHopcA== X-Gm-Gg: ASbGncvpHmfROMBPc4IiMyldg2Jv4T/fqJvG9x9juQf40xmEODAiQpTK+a/YypKHR1G rJwgTG5CUcFs7hxXELsd8g71njz0LjYga45xnBY4LCE+Uzhduxmi14gjBgZmK8N3qvaltxsDfW5 k/17zqxUYdEDIrBC3RbgtqpN1NNPkFtXAEe7sex9MpspdXqIGtOgEFkRVIx4EsZ06ENEmOv/6Um O9FtW3oYwJryw+C5m606IXXDDHB09FuD7BAEV277R2XKJ4f6sYB X-Received: by 2002:a05:6000:1f81:b0:386:7fe:af8e with SMTP id ffacd0b85a97d-38a872fb180mr8610726f8f.12.1736964557508; Wed, 15 Jan 2025 10:09:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IEQkXfUKapP3mt5/pUn7Ms014kuuuqrdEw7Rmj8ArtLIgH4MGbkffSKeTsrN46emCSF/ib5bA== X-Received: by 2002:a05:6000:1f81:b0:386:7fe:af8e with SMTP id ffacd0b85a97d-38a872fb180mr8610688f8f.12.1736964557069; Wed, 15 Jan 2025 10:09:17 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c753c617sm31445005e9.37.2025.01.15.10.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:16 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Jason Wang , Yi Liu , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 15/48] intel_iommu: Flush stage-1 cache in iotlb invalidation Message-ID: <16d4e418e98feeb53f28d17eeffb198fe0fd6f22.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan According to spec, Page-Selective-within-Domain Invalidation (11b): 1. IOTLB entries caching second-stage mappings (PGTT=010b) or pass-through (PGTT=100b) mappings associated with the specified domain-id and the input-address range are invalidated. 2. IOTLB entries caching first-stage (PGTT=001b) or nested (PGTT=011b) mapping associated with specified domain-id are invalidated. So per spec definition the Page-Selective-within-Domain Invalidation needs to flush first stage and nested cached IOTLB entries as well. We don't support nested yet and pass-through mapping is never cached, so what in iotlb cache are only first-stage and second-stage mappings. Add a tag pgtt in VTDIOTLBEntry to mark PGTT type of the mapping and invalidate entries based on PGTT type. Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-11-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index f44f3eb63a..a434c2489c 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -155,6 +155,7 @@ struct VTDIOTLBEntry { uint64_t pte; uint64_t mask; uint8_t access_flags; + uint8_t pgtt; }; /* VT-d Source-ID Qualifier types */ diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0aeb0dbde9..95f344eb46 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -305,9 +305,21 @@ static gboolean vtd_hash_remove_by_page(gpointer key, gpointer value, VTDIOTLBPageInvInfo *info = (VTDIOTLBPageInvInfo *)user_data; uint64_t gfn = (info->addr >> VTD_PAGE_SHIFT_4K) & info->mask; uint64_t gfn_tlb = (info->addr & entry->mask) >> VTD_PAGE_SHIFT_4K; - return (entry->domain_id == info->domain_id) && - (((entry->gfn & info->mask) == gfn) || - (entry->gfn == gfn_tlb)); + + if (entry->domain_id != info->domain_id) { + return false; + } + + /* + * According to spec, IOTLB entries caching first-stage (PGTT=001b) or + * nested (PGTT=011b) mapping associated with specified domain-id are + * invalidated. Nested isn't supported yet, so only need to check 001b. + */ + if (entry->pgtt == VTD_SM_PASID_ENTRY_FLT) { + return true; + } + + return (entry->gfn & info->mask) == gfn || entry->gfn == gfn_tlb; } /* Reset all the gen of VTDAddressSpace to zero and set the gen of @@ -382,7 +394,7 @@ out: static void vtd_update_iotlb(IntelIOMMUState *s, uint16_t source_id, uint16_t domain_id, hwaddr addr, uint64_t pte, uint8_t access_flags, uint32_t level, - uint32_t pasid) + uint32_t pasid, uint8_t pgtt) { VTDIOTLBEntry *entry = g_malloc(sizeof(*entry)); struct vtd_iotlb_key *key = g_malloc(sizeof(*key)); @@ -400,6 +412,7 @@ static void vtd_update_iotlb(IntelIOMMUState *s, uint16_t source_id, entry->access_flags = access_flags; entry->mask = vtd_pt_level_page_mask(level); entry->pasid = pasid; + entry->pgtt = pgtt; key->gfn = gfn; key->sid = source_id; @@ -2062,7 +2075,7 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, bool is_fpd_set = false; bool reads = true; bool writes = true; - uint8_t access_flags; + uint8_t access_flags, pgtt; bool rid2pasid = (pasid == PCI_NO_PASID) && s->root_scalable; VTDIOTLBEntry *iotlb_entry; uint64_t xlat, size; @@ -2171,9 +2184,11 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, if (s->flts && s->root_scalable) { ret_fr = vtd_iova_to_flpte(s, &ce, addr, is_write, &pte, &level, &reads, &writes, s->aw_bits, pasid); + pgtt = VTD_SM_PASID_ENTRY_FLT; } else { ret_fr = vtd_iova_to_slpte(s, &ce, addr, is_write, &pte, &level, &reads, &writes, s->aw_bits, pasid); + pgtt = VTD_SM_PASID_ENTRY_SLT; } if (!ret_fr) { xlat = vtd_get_pte_addr(pte, s->aw_bits); @@ -2207,7 +2222,7 @@ static bool vtd_do_iommu_translate(VTDAddressSpace *vtd_as, PCIBus *bus, page_mask = vtd_pt_level_page_mask(level); access_flags = IOMMU_ACCESS_FLAG(reads, writes); vtd_update_iotlb(s, source_id, vtd_get_domain_id(s, &ce, pasid), - addr, pte, access_flags, level, pasid); + addr, pte, access_flags, level, pasid, pgtt); out: vtd_iommu_unlock(s); entry->iova = addr & page_mask; From patchwork Wed Jan 15 18:09:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940758 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 988DAC02183 for ; Wed, 15 Jan 2025 18:17:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7r5-0000YT-LD; Wed, 15 Jan 2025 13:11:04 -0500 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 1tY7pV-0006d8-Nv for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:27 -0500 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 1tY7pU-0006cc-3p for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964563; 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=9o3c4LwUlk7AnTB7u8f2qn4E+H/wLdxNYk39uQ2dceI=; b=c/gcUORUr6TrEhmUTiJudWn5YNDiD1TRsp7InnoQ+SJj6mgI8bjBsfugYYt51MAvjf52Vq UrpE8FOOowYGEx87zcaJggo+EUpkFN7/dpOlw71F7vTjUtOUxSX4BipoSIr/cRN9KvM9Fy Wv+oWPuqBu+rUfjTSlitonHeo46898s= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-443-nKAgLcyNNKizJwX1h5Y4GQ-1; Wed, 15 Jan 2025 13:09:22 -0500 X-MC-Unique: nKAgLcyNNKizJwX1h5Y4GQ-1 X-Mimecast-MFC-AGG-ID: nKAgLcyNNKizJwX1h5Y4GQ Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4359206e1e4so32469865e9.2 for ; Wed, 15 Jan 2025 10:09:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964561; x=1737569361; 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=9o3c4LwUlk7AnTB7u8f2qn4E+H/wLdxNYk39uQ2dceI=; b=BBawEmDJDkeg6vTVvvOAcatwt1sHvbYFz4IQXo9VSWAzdrfBnn8jF3BvPwFVZiZPB+ /WpEzsxlX6psSdCd95s9fXgQZ2QaKB9ngZgAde81ktziQFA4rFXSezwN3F0SfHsfoHp5 mdUYH7fC57iGpVpnZ5BTL98axynhS5Grms8FhmUg7mU6H4ooPSVCv4s4vZHdXXYiVTzU ccH6FReOTrr+zzLRXEO4Nrw9GhN4WLYk+YoC72AIdy/U5gbdKGlpNFOWQy7+010L+df0 0pBctSKlRKzwFF+8dGGifRtOwADFN/w51VdmhX55ZQa8fPobd5ecB/DF+7JzNZm+H6EY YbSg== X-Gm-Message-State: AOJu0YyDxBI1VdwyBeIOD+5iy+hE02l2r/tKbZIKJreOkVFrqfK3DdbK V/GG/YWIfgYuFL1jNXcqvKdPpSLHuLpH/c3K6f9AgKXs5Zhl6Cdj6HWOBk2MiRsi4FDz61ea8Lr GciPP4htAGXPOBlRlyxVMAy1nHfgaFyjnq5+B2zK4SbGAr6XyzoV8xTUnDyRQb3H+k0FyU++5OE mLWKvf93Dbx2a75JjZB5h+I2f4nPaHWw== X-Gm-Gg: ASbGncsaCwF9S6EYsm/c3Ln2qgZffMrQ0FwvSMTjbsw1yeka6w9+W8qwG9dWFadsLaI UTFN1t//WNURgM1WQsWQ0JvyvjBl0oMV+qSyMF6mZooVm/9bT1oxTzayKpxnVsD3QhE/VYGodi1 pD6LM9ZBEzSDCATUk7KqBR/6omwJlAo4XWKqtXTYHS1T7kL41WMCzKw/jpHvihwkjbCAIJlz/O5 1mPIIskfhv0iO+GMX+hsOcnGklNr7k7cBxjH1MkJtxR0yrx5AME X-Received: by 2002:a05:6000:184e:b0:382:46ea:113f with SMTP id ffacd0b85a97d-38a872fc1b3mr29158937f8f.10.1736964560808; Wed, 15 Jan 2025 10:09:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHC14EXULmcACxn9ulrF2zCZg2XFIRTLuCExnr1Q4wEzqZlbpCU02ARsB9t+SuZ7Tb/pQOMkw== X-Received: by 2002:a05:6000:184e:b0:382:46ea:113f with SMTP id ffacd0b85a97d-38a872fc1b3mr29158899f8f.10.1736964560342; Wed, 15 Jan 2025 10:09:20 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38c6dbsm18643752f8f.55.2025.01.15.10.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:19 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:17 -0500 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 , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 16/48] intel_iommu: Process PASID-based iotlb invalidation Message-ID: <6ebe6cf2a0663f46f94a69eca5296f608da12f2e.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan PASID-based iotlb (piotlb) is used during walking Intel VT-d stage-1 page table. This emulates the stage-1 page table iotlb invalidation requested by a PASID-based IOTLB Invalidate Descriptor (P_IOTLB). Signed-off-by: Yi Liu Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-12-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 3 +++ hw/i386/intel_iommu.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 22dd3faf0c..5e4e563e62 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -471,6 +471,9 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_PIOTLB_PSI_IN_PASID (3ULL << 4) #define VTD_INV_DESC_PIOTLB_DID(val) (((val) >> 16) & VTD_DOMAIN_ID_MASK) #define VTD_INV_DESC_PIOTLB_PASID(val) (((val) >> 32) & 0xfffffULL) +#define VTD_INV_DESC_PIOTLB_AM(val) ((val) & 0x3fULL) +#define VTD_INV_DESC_PIOTLB_IH(val) (((val) >> 6) & 0x1) +#define VTD_INV_DESC_PIOTLB_ADDR(val) ((val) & ~0xfffULL) #define VTD_INV_DESC_PIOTLB_RSVD_VAL0 0xfff000000000f1c0ULL #define VTD_INV_DESC_PIOTLB_RSVD_VAL1 0xf80ULL diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 95f344eb46..c45a486bf8 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -322,6 +322,28 @@ static gboolean vtd_hash_remove_by_page(gpointer key, gpointer value, return (entry->gfn & info->mask) == gfn || entry->gfn == gfn_tlb; } +static gboolean vtd_hash_remove_by_page_piotlb(gpointer key, gpointer value, + gpointer user_data) +{ + VTDIOTLBEntry *entry = (VTDIOTLBEntry *)value; + VTDIOTLBPageInvInfo *info = (VTDIOTLBPageInvInfo *)user_data; + uint64_t gfn = (info->addr >> VTD_PAGE_SHIFT_4K) & info->mask; + uint64_t gfn_tlb = (info->addr & entry->mask) >> VTD_PAGE_SHIFT_4K; + + /* + * According to spec, PASID-based-IOTLB Invalidation in page granularity + * doesn't invalidate IOTLB entries caching second-stage (PGTT=010b) + * or pass-through (PGTT=100b) mappings. Nested isn't supported yet, + * so only need to check first-stage (PGTT=001b) mappings. + */ + if (entry->pgtt != VTD_SM_PASID_ENTRY_FLT) { + return false; + } + + return entry->domain_id == info->domain_id && entry->pasid == info->pasid && + ((entry->gfn & info->mask) == gfn || entry->gfn == gfn_tlb); +} + /* Reset all the gen of VTDAddressSpace to zero and set the gen of * IntelIOMMUState to 1. Must be called with IOMMU lock held. */ @@ -2937,11 +2959,29 @@ static void vtd_piotlb_pasid_invalidate(IntelIOMMUState *s, } } +static void vtd_piotlb_page_invalidate(IntelIOMMUState *s, uint16_t domain_id, + uint32_t pasid, hwaddr addr, uint8_t am) +{ + VTDIOTLBPageInvInfo info; + + info.domain_id = domain_id; + info.pasid = pasid; + info.addr = addr; + info.mask = ~((1 << am) - 1); + + vtd_iommu_lock(s); + g_hash_table_foreach_remove(s->iotlb, + vtd_hash_remove_by_page_piotlb, &info); + vtd_iommu_unlock(s); +} + static bool vtd_process_piotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) { uint16_t domain_id; uint32_t pasid; + hwaddr addr; + uint8_t am; uint64_t mask[4] = {VTD_INV_DESC_PIOTLB_RSVD_VAL0, VTD_INV_DESC_PIOTLB_RSVD_VAL1, VTD_INV_DESC_ALL_ONE, VTD_INV_DESC_ALL_ONE}; @@ -2959,6 +2999,9 @@ static bool vtd_process_piotlb_desc(IntelIOMMUState *s, break; case VTD_INV_DESC_PIOTLB_PSI_IN_PASID: + am = VTD_INV_DESC_PIOTLB_AM(inv_desc->val[1]); + addr = (hwaddr) VTD_INV_DESC_PIOTLB_ADDR(inv_desc->val[1]); + vtd_piotlb_page_invalidate(s, domain_id, pasid, addr, am); break; default: From patchwork Wed Jan 15 18:09:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E5FFC02183 for ; Wed, 15 Jan 2025 18:10:45 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qG-0007JS-Da; Wed, 15 Jan 2025 13:10:13 -0500 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 1tY7pa-0006en-BJ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:36 -0500 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 1tY7pY-0006dc-2Q for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964566; 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=cb1uDbXRRItaCpZXeSioPd9EkaMevm8T9RBXmZ42Yp8=; b=F4GYEtXktc76/fsPOCxA7SN5+vcdwyrvKeN8ag0Fw6sbadaaF+Ms91Dkj3CWcmqbKwym3u e6nSI/RWrJ5hoOv6eZoXREmNZUVQi43Sjpbf3QoulAFWvdGMLh4UCC+PDAcWJqks8s5H/b MOMqr1Oezk/3fb7xUIMMmWIDDD0TD/M= 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-447-dujXYjqzM0u4K3ERkiapdg-1; Wed, 15 Jan 2025 13:09:25 -0500 X-MC-Unique: dujXYjqzM0u4K3ERkiapdg-1 X-Mimecast-MFC-AGG-ID: dujXYjqzM0u4K3ERkiapdg Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-385e2579507so36297f8f.1 for ; Wed, 15 Jan 2025 10:09:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964564; x=1737569364; 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=cb1uDbXRRItaCpZXeSioPd9EkaMevm8T9RBXmZ42Yp8=; b=HFgE1eY7kuN0oShOlghZ+BEl1LnVxVOACZK+yIGzIN49ggbHTGFJQPl0CXQI3kYjKm qU24YKSSSXLu6HnsXKGgtCdd3dRtMvNN8Azo0CJdvxiQ68MFiase6k/2N7R62fzlBpbn P2fjEkVGnIAR+WOnVr/KtqxVRAJ8b36ynJgYYZhd02WUQmqfIZV4eNteGza9FJMnPruW fSQ0bo/8+ZvU7VJT7j6n52JZIgr1+Y9hLbpsXjiUSD/jSjw/OrQTyw7fWHbedaiM8by/ ILY9Y4SAAmEOo/1hkpD9mPu9T1hM+vUI2mPdtTi66I3r/4cGE/zdoIN9P9Nm99Q8FBFD Rtlw== X-Gm-Message-State: AOJu0YxHLohTtUYckYKvOVQNTreFQOqx1231Ym8YmPGCUKb43+FMrAWU V2ZA4SzkwasV+6r8O1antTOxjSO4UpPHqlCWDpnSYP12/vs8btwB/UTNQ9h2V3UjoWWkbAMcOmV th6yT+6v7eyYzB/sQscacHB+/O0qfg1ddp5qJ92Pa4oOoHl634ukjIqfLoKUMiV0ENKMfteg8w8 zSd+2qj3KAhfOHk6O//L/h2JWIAoCrpA== X-Gm-Gg: ASbGncuOT+jhH0EzaokMoTqraDyMY7Tx8DJfK9b6GJgdrdaqO73p5YnbxbSpjOGlpzL 5KffCE/ASFGi8eEcRPWEsmV739H+Yp63TlQ4rLw7opSVyWq0Fcmc9r0WprsX2H4Y2HpNbVg1ShT 9ugx+N3thhiF38mnS844v0La6aybTXY8ydmZEP6YMpDW2GyI0fOm/aoDINvVZ4A78uwFqd2RjUY QO1S2eUH28QY0qtUBYUYoIScSipThMounVfLxToOPzGyXuvOawv X-Received: by 2002:a05:6000:18a4:b0:38a:a043:eacc with SMTP id ffacd0b85a97d-38aa043ee63mr13471003f8f.1.1736964563965; Wed, 15 Jan 2025 10:09:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsQagTnv3I232z/fF9csz2PfqcKqFVckBWArMJFh1/V1+WthI3USsAGzvwQvuny/3VxqL0FQ== X-Received: by 2002:a05:6000:18a4:b0:38a:a043:eacc with SMTP id ffacd0b85a97d-38aa043ee63mr13470976f8f.1.1736964563583; Wed, 15 Jan 2025 10:09:23 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74ac707sm31022335e9.15.2025.01.15.10.09.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:22 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:20 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Zhenzhong Duan , Jason Wang , Yi Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 17/48] intel_iommu: Add an internal API to find an address space with PASID Message-ID: <1075645d430e291404d19c88fc80d989669fa4c8.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Clément Mathieu--Drif This will be used to implement the device IOTLB invalidation Signed-off-by: Clément Mathieu--Drif Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Reviewed-by: Yi Liu Message-Id: <20241212083757.605022-13-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index c45a486bf8..9aa807593e 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -70,6 +70,11 @@ struct vtd_hiod_key { uint8_t devfn; }; +struct vtd_as_raw_key { + uint16_t sid; + uint32_t pasid; +}; + struct vtd_iotlb_key { uint64_t gfn; uint32_t pasid; @@ -1859,29 +1864,32 @@ static inline bool vtd_is_interrupt_addr(hwaddr addr) return VTD_INTERRUPT_ADDR_FIRST <= addr && addr <= VTD_INTERRUPT_ADDR_LAST; } -static gboolean vtd_find_as_by_sid(gpointer key, gpointer value, - gpointer user_data) +static gboolean vtd_find_as_by_sid_and_pasid(gpointer key, gpointer value, + gpointer user_data) { struct vtd_as_key *as_key = (struct vtd_as_key *)key; - uint16_t target_sid = *(uint16_t *)user_data; + struct vtd_as_raw_key *target = (struct vtd_as_raw_key *)user_data; uint16_t sid = PCI_BUILD_BDF(pci_bus_num(as_key->bus), as_key->devfn); - return sid == target_sid; + + return (as_key->pasid == target->pasid) && (sid == target->sid); +} + +static VTDAddressSpace *vtd_get_as_by_sid_and_pasid(IntelIOMMUState *s, + uint16_t sid, + uint32_t pasid) +{ + struct vtd_as_raw_key key = { + .sid = sid, + .pasid = pasid + }; + + return g_hash_table_find(s->vtd_address_spaces, + vtd_find_as_by_sid_and_pasid, &key); } static VTDAddressSpace *vtd_get_as_by_sid(IntelIOMMUState *s, uint16_t sid) { - uint8_t bus_num = PCI_BUS_NUM(sid); - VTDAddressSpace *vtd_as = s->vtd_as_cache[bus_num]; - - if (vtd_as && - (sid == PCI_BUILD_BDF(pci_bus_num(vtd_as->bus), vtd_as->devfn))) { - return vtd_as; - } - - vtd_as = g_hash_table_find(s->vtd_address_spaces, vtd_find_as_by_sid, &sid); - s->vtd_as_cache[bus_num] = vtd_as; - - return vtd_as; + return vtd_get_as_by_sid_and_pasid(s, sid, PCI_NO_PASID); } static void vtd_pt_enable_fast_path(IntelIOMMUState *s, uint16_t source_id) From patchwork Wed Jan 15 18:09:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6BDE6C02180 for ; Wed, 15 Jan 2025 18:14:25 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rH-0001mX-6f; Wed, 15 Jan 2025 13:11:15 -0500 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 1tY7pd-0006fA-IJ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:35 -0500 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 1tY7pb-0006eo-0t for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964570; 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=pePF8TiH1z30WiKUCjNM/Py5GVlpH/ceDZaRk5X9E4s=; b=K0Btoq5F/iANPJfIphZebXZNBD0Fq75IKgXPT5y6e7m35CUEWwqsKwjdiZGAPV9julw97M XoNDDAAz3JEpLklfQX3oHYRlpDzz1CpObl/vUAYHXia+pGnu5lDdmvR/kzz95rJZ07CiWD ceoXwmnlhqFIIL2MRsjP1HFOOUWamGw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626-rRoAdMyGNS6EaCAKKOl3Tw-1; Wed, 15 Jan 2025 13:09:29 -0500 X-MC-Unique: rRoAdMyGNS6EaCAKKOl3Tw-1 X-Mimecast-MFC-AGG-ID: rRoAdMyGNS6EaCAKKOl3Tw Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-436328fcfeeso55951985e9.1 for ; Wed, 15 Jan 2025 10:09:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964567; x=1737569367; 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=pePF8TiH1z30WiKUCjNM/Py5GVlpH/ceDZaRk5X9E4s=; b=wxJhXlGgQSwB/bNMivnRbE1kWKudeUvSZeN0U/wADgRkQQOAmrfGZ87ZKkqB9ejciT 1Li0plGbUHA9lvQPGZ6oY0/qKd8eoXzTMdb1uXa8S6uKKjsmDciwZIxwQvNzhBIPmbYz p/WmK7R2UzV0mBgrYziwPuspEzgAkT7+QCQ5BjJmyw4ptR4xgCzJujnWOfwTIw4sWgbZ tXMd5OevMYQGlLjU1NO0gTaaz2+vE6hKg2s9wX/VNPm5+gumo0LKGUaskyzK68bpmz83 mNRFe68jVLGuH0bpEAM3DN8sK83MOh+ZHYAImcB1CX5vEjvDeEzGxUTxOGHt/FlBMRJN tIhQ== X-Gm-Message-State: AOJu0YynJvkPMr9iCU35i2oqHZQSajELQ0f7RVTiOw5vi1OXoe4qIIZS ynUN9hSeCO8l7IWDpuNHww+jfxCwY+E7BegMLoeq8eWFZSqqKahFRS0AO43IYaXL00TN4x7oWG8 xd30gZxnUPqPtokTqF2prIU8F+P1gbl+uf/mOg6cCRrrU2P9iuv7PSZGHDtAGj346OerpwOuryS YRX/0zFUgq68c9hC7v1656zOc/f91Hsw== X-Gm-Gg: ASbGncs310XbACvORbcAZQKofmhj2flaaZwVRab3sNi/PyU8mtLepkXY1OXFr9xECuP +Y3eRk0eK2JrWqc++9zPxeeNUkKuHPpbLky2q0REaCv53ry4gUbU+mh1mWC1bJBbsy588kTM/Jh svFjDJpOIFt7892vyInzaZU7ev3jpFdLzhj88dP8UXWvHBN5SAxf3f27acjQW+KqiBlxoZu6pLW bauyGsLZXIzjepejyjbwuk/7fWemz2yqTYVpa49QMaGzbFmxyuZ X-Received: by 2002:a05:600c:4f47:b0:431:5632:448b with SMTP id 5b1f17b1804b1-436e26e23f8mr237581105e9.25.1736964567611; Wed, 15 Jan 2025 10:09:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGz1v6SRg9xAJi7VaJBfwK8A+M3bU6M0EI6TJnxHyI0EVp2VDPVBdEhbpLx5v8ss8phu19Qw== X-Received: by 2002:a05:600c:4f47:b0:431:5632:448b with SMTP id 5b1f17b1804b1-436e26e23f8mr237580775e9.25.1736964567153; Wed, 15 Jan 2025 10:09:27 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e383965sm18559474f8f.31.2025.01.15.10.09.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:26 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:24 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Zhenzhong Duan , Jason Wang , Yi Liu , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 18/48] intel_iommu: Add support for PASID-based device IOTLB invalidation 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Clément Mathieu--Drif Signed-off-by: Clément Mathieu--Drif Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Message-Id: <20241212083757.605022-14-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 | 50 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 5e4e563e62..2c977aa7da 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -385,6 +385,7 @@ typedef union VTDInvDesc VTDInvDesc; #define VTD_INV_DESC_WAIT 0x5 /* Invalidation Wait Descriptor */ #define VTD_INV_DESC_PIOTLB 0x6 /* PASID-IOTLB Invalidate Desc */ #define VTD_INV_DESC_PC 0x7 /* PASID-cache Invalidate Desc */ +#define VTD_INV_DESC_DEV_PIOTLB 0x8 /* PASID-based-DIOTLB inv_desc*/ #define VTD_INV_DESC_NONE 0 /* Not an Invalidate Descriptor */ /* Masks for Invalidation Wait Descriptor*/ @@ -426,6 +427,16 @@ typedef union VTDInvDesc VTDInvDesc; /* Masks for Interrupt Entry Invalidate Descriptor */ #define VTD_INV_DESC_IEC_RSVD 0xffff000007fff1e0ULL +/* Masks for PASID based Device IOTLB Invalidate Descriptor */ +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_ADDR(val) ((val) & \ + 0xfffffffffffff000ULL) +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_SIZE(val) ((val >> 11) & 0x1) +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_GLOBAL(val) ((val) & 0x1) +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_SID(val) (((val) >> 16) & 0xffffULL) +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_PASID(val) ((val >> 32) & 0xfffffULL) +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_RSVD_VAL0 0xfff000000000f000ULL +#define VTD_INV_DESC_PASID_DEVICE_IOTLB_RSVD_VAL1 0x7feULL + /* 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 9aa807593e..5634a37a74 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3075,6 +3075,49 @@ static void do_invalidate_device_tlb(VTDAddressSpace *vtd_dev_as, memory_region_notify_iommu(&vtd_dev_as->iommu, 0, event); } +static bool vtd_process_device_piotlb_desc(IntelIOMMUState *s, + VTDInvDesc *inv_desc) +{ + uint16_t sid; + VTDAddressSpace *vtd_dev_as; + bool size; + bool global; + hwaddr addr; + uint32_t pasid; + uint64_t mask[4] = {VTD_INV_DESC_PASID_DEVICE_IOTLB_RSVD_VAL0, + VTD_INV_DESC_PASID_DEVICE_IOTLB_RSVD_VAL1, + VTD_INV_DESC_ALL_ONE, VTD_INV_DESC_ALL_ONE}; + + if (!vtd_inv_desc_reserved_check(s, inv_desc, mask, true, + __func__, "device piotlb inv")) { + return false; + } + + global = VTD_INV_DESC_PASID_DEVICE_IOTLB_GLOBAL(inv_desc->hi); + size = VTD_INV_DESC_PASID_DEVICE_IOTLB_SIZE(inv_desc->hi); + addr = VTD_INV_DESC_PASID_DEVICE_IOTLB_ADDR(inv_desc->hi); + sid = VTD_INV_DESC_PASID_DEVICE_IOTLB_SID(inv_desc->lo); + if (global) { + QLIST_FOREACH(vtd_dev_as, &s->vtd_as_with_notifiers, next) { + if ((vtd_dev_as->pasid != PCI_NO_PASID) && + (PCI_BUILD_BDF(pci_bus_num(vtd_dev_as->bus), + vtd_dev_as->devfn) == sid)) { + do_invalidate_device_tlb(vtd_dev_as, size, addr); + } + } + } else { + pasid = VTD_INV_DESC_PASID_DEVICE_IOTLB_PASID(inv_desc->lo); + vtd_dev_as = vtd_get_as_by_sid_and_pasid(s, sid, pasid); + if (!vtd_dev_as) { + return true; + } + + do_invalidate_device_tlb(vtd_dev_as, size, addr); + } + + return true; +} + static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s, VTDInvDesc *inv_desc) { @@ -3161,6 +3204,13 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s) } break; + case VTD_INV_DESC_DEV_PIOTLB: + trace_vtd_inv_desc("device-piotlb", inv_desc.hi, inv_desc.lo); + if (!vtd_process_device_piotlb_desc(s, &inv_desc)) { + return false; + } + break; + case VTD_INV_DESC_DEVICE: trace_vtd_inv_desc("device", inv_desc.hi, inv_desc.lo); if (!vtd_process_device_iotlb_desc(s, &inv_desc)) { From patchwork Wed Jan 15 18:09:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2122EC02180 for ; Wed, 15 Jan 2025 18:19:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qv-0008Su-Ih; Wed, 15 Jan 2025 13:10:56 -0500 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 1tY7pi-0006gx-Tg for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:40 -0500 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 1tY7ph-0006f7-2P for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964576; 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=M8anF+JBkvRI7NWpt9ZB3PcYSjQ6xOt/WhSnYtqwjRU=; b=OvAn2wW44+CHehlPz0U4kQYqbC7NPAHhsNdKOPQHTM7J3IL+ljr2ELGewo5niBr9y7uDbm VnrFBVLbtBTPR/mMl5myRrF5MMa+NXWxFck3thIwErPSIr25AtFS3HJqwoxnTR0Xiszwir 2vWlP7gb9teY86jdDgoTpU4dtYpyJ58= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-118-Gfv0CHGyP96LbOmgPawzIA-1; Wed, 15 Jan 2025 13:09:32 -0500 X-MC-Unique: Gfv0CHGyP96LbOmgPawzIA-1 X-Mimecast-MFC-AGG-ID: Gfv0CHGyP96LbOmgPawzIA Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-385dcae001fso50847f8f.1 for ; Wed, 15 Jan 2025 10:09:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964571; x=1737569371; 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=M8anF+JBkvRI7NWpt9ZB3PcYSjQ6xOt/WhSnYtqwjRU=; b=jA2VtaSNalM2MHC7gm1GEHZtIJVL5ZQWkE06GHWdzzePVsOhSXLHaNUPvTaEY3oKFT R1pskmKBbc+7Yary2ynqvDmGuts7CF8++DxWTHlHTexAZnYrzlzv/XWOFni9MUokxsh5 hwXkAOLS6dM7Iu3OaWH6aGJr8sP6/JpKNrcKfnl+yCNEXmHbpzMj/5S7UeYCxMF/8M5Q yEcIgkDA5zbE+0MRVWdTNsq155gFcWhGTNuJ+CJ5935lZq+Ovx9tL9XXiBHaDXbsn5QQ wBVt6FPkxvWiQWA7jC1hM1meofUI10NbpSh9lP7QUltJTPaztO3cs4bg3J0PNACnN8hl 1rKQ== X-Gm-Message-State: AOJu0YzTmawXA1VOAdEgAhNJRoieaWf+a99t66IzEtvl0U/v7IdU/rFE tDFujmApudH+Ffon09sngoI78We8oJn8PpzMeomOxr4Rj16jqBe4SzJRVlsPCElmDfwkmAdg7fQ kOJ321wRYndIuyNvXF5Fm18RJIz4DpEozQB2Jz/fKSZt8BYjSXIsgN0cNN5D9KZbkxqBXeCNFxj WwFqALb4EjhfZaUo+qu6+ADTaB76kDfQ== X-Gm-Gg: ASbGncuGjofmA86FhL5Tv3nJN931F46oNT3BlqpPFtEpr7XITLfLwKu7t7ufkBce5kj /7juKqzj9jl/WpPB2H6o4xTW4EgJmxgMMDgW0nl9JQLUylYNdazI46rbOBjSZl8T+NibEuccxKH NR3GyUqMHnfSh01ILgZ0tyWt9E8FvZVc90fu4FopdPk94jAfsXU/f+DFc2FYTWqPJbA8vo2cZji Tfu18+UzcbMq78E67YKtXB/ha/JO2hIwCvmwuZbvdmuFSdbpHjZ X-Received: by 2002:a05:6000:719:b0:385:e879:45cc with SMTP id ffacd0b85a97d-38a873045d9mr22945671f8f.19.1736964571023; Wed, 15 Jan 2025 10:09:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IHovRL8dIO/+V4asAAqk6tHDbt90Ce9O2yWR/y35xnfF1N287i34IvK9i/2DCbNDB58NazpfA== X-Received: by 2002:a05:6000:719:b0:385:e879:45cc with SMTP id ffacd0b85a97d-38a873045d9mr22945645f8f.19.1736964570594; Wed, 15 Jan 2025 10:09:30 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c73e370fsm32124105e9.0.2025.01.15.10.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:29 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:27 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Yi Sun , Jason Wang , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Yi Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 19/48] intel_iommu: piotlb invalidation should notify unmap Message-ID: <1ab93575bdcb2972c99a174a957b598f7457a899.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan This is used by some emulated devices which caches address translation result. When piotlb invalidation issued in guest, those caches should be refreshed. There is already a similar implementation in iotlb invalidation. So update vtd_iotlb_page_invalidate_notify() to make it work also for piotlb invalidation. For device that does not implement ATS capability or disable it but still caches the translation result, it is better to implement ATS cap or enable it if there is need to cache the translation result. Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Reviewed-by: Clément Mathieu--Drif Message-Id: <20241212083757.605022-15-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 5634a37a74..7d4b99523d 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -2450,8 +2450,13 @@ static void vtd_iotlb_domain_invalidate(IntelIOMMUState *s, uint16_t domain_id) } } +/* + * There is no pasid field in iotlb invalidation descriptor, so PCI_NO_PASID + * is passed as parameter. Piotlb invalidation supports pasid, pasid in its + * descriptor is passed which should not be PCI_NO_PASID. + */ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s, - uint16_t domain_id, hwaddr addr, + uint16_t domain_id, hwaddr addr, uint8_t am, uint32_t pasid) { VTDAddressSpace *vtd_as; @@ -2460,19 +2465,37 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s, hwaddr size = (1 << am) * VTD_PAGE_SIZE; QLIST_FOREACH(vtd_as, &(s->vtd_as_with_notifiers), next) { - if (pasid != PCI_NO_PASID && pasid != vtd_as->pasid) { - continue; - } ret = vtd_dev_to_context_entry(s, pci_bus_num(vtd_as->bus), vtd_as->devfn, &ce); if (!ret && domain_id == vtd_get_domain_id(s, &ce, vtd_as->pasid)) { + uint32_t rid2pasid = PCI_NO_PASID; + + if (s->root_scalable) { + rid2pasid = VTD_CE_GET_RID2PASID(&ce); + } + + /* + * In legacy mode, vtd_as->pasid == pasid is always true. + * In scalable mode, for vtd address space backing a PCI + * device without pasid, needs to compare pasid with + * rid2pasid of this device. + */ + if (!(vtd_as->pasid == pasid || + (vtd_as->pasid == PCI_NO_PASID && pasid == rid2pasid))) { + continue; + } + if (vtd_as_has_map_notifier(vtd_as)) { /* - * As long as we have MAP notifications registered in - * any of our IOMMU notifiers, we need to sync the - * shadow page table. + * When stage-1 translation is off, as long as we have MAP + * notifications registered in any of our IOMMU notifiers, + * we need to sync the shadow page table. Otherwise VFIO + * device attaches to nested page table instead of shadow + * page table, so no need to sync. */ - vtd_sync_shadow_page_table_range(vtd_as, &ce, addr, size); + if (!s->flts || !s->root_scalable) { + vtd_sync_shadow_page_table_range(vtd_as, &ce, addr, size); + } } else { /* * For UNMAP-only notifiers, we don't need to walk the @@ -2960,7 +2983,7 @@ static void vtd_piotlb_pasid_invalidate(IntelIOMMUState *s, continue; } - if (!s->flts) { + if (!s->flts || !vtd_as_has_map_notifier(vtd_as)) { vtd_address_space_sync(vtd_as); } } @@ -2981,6 +3004,8 @@ static void vtd_piotlb_page_invalidate(IntelIOMMUState *s, uint16_t domain_id, g_hash_table_foreach_remove(s->iotlb, vtd_hash_remove_by_page_piotlb, &info); vtd_iommu_unlock(s); + + vtd_iotlb_page_invalidate_notify(s, domain_id, addr, am, pasid); } static bool vtd_process_piotlb_desc(IntelIOMMUState *s, From patchwork Wed Jan 15 18:09:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BC1B5C02183 for ; Wed, 15 Jan 2025 18:10:49 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qe-0007pf-3e; Wed, 15 Jan 2025 13:10:37 -0500 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 1tY7pj-0006hL-UN for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:43 -0500 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 1tY7ph-0006fC-9q for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964576; 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=l1lIcA2T55auu2mZERZOQ89Kmxf8Hn1zqHyiZZgMmBI=; b=LKtyD7TWv9wJkc5BPAaSAWaKepDl+MS0OA2YXrIrbNZIcgyQa/i3tOOnzLFWphFecCTCZs 5caVqpwWYau6SZkorkUxRcLSP20VwZxxYj8YbtHxul/DoqzYykHBp0GiOzxmgPxsZYX3fo OHYwXZwtGv+cFKJNYlQ0flFbsJyUkTQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-489-rExWmRq_M_WhgwjNOZJwEw-1; Wed, 15 Jan 2025 13:09:35 -0500 X-MC-Unique: rExWmRq_M_WhgwjNOZJwEw-1 X-Mimecast-MFC-AGG-ID: rExWmRq_M_WhgwjNOZJwEw Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43619b135bcso37154075e9.1 for ; Wed, 15 Jan 2025 10:09:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964574; x=1737569374; 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=l1lIcA2T55auu2mZERZOQ89Kmxf8Hn1zqHyiZZgMmBI=; b=U+38NOZtcs6O01GLlvkpnzF0es0DEJjEdOISFNYueXU6f/c/Dm58frINm7eMIESojq l+1qpFWbx7SxnlTNmwH/+09s5AZJct+cp1StEvLIjgdPRcS0G2pUNUCgkYqXOunwLT/q 4ibweQH3UiYok1Wygy5/ztWpS1/hGI7AHziIVx2AVTuijog8BE2DmGZPFPbqMRZClunz kS+S/n6wV0Y23zhDLuBYpwcpm/0Fj6RJmuRCluLL2t9IpfNguuHHib70IydjBI//wdxg R0CrxMe1VfobcAbJnbEmueaFwAECt/CiH/1fAzdHxpmHzYdoTw1SuQQP4vj/WjG135nP x+LA== X-Gm-Message-State: AOJu0YydzfKESP5//gbfa8CWpkJrOkY/BgzvNrizrX8ybYHDIp4Mt112 Tokyen2JesJPYhgt0c5j49bBbeFHSOpfJxh0qSQeXC/+UX3pBJXoWEe82QPJDnjy7fRgB/SHUWY 3PMBg6K1BNzahquL7FA2bxSNNqZMDeamdrKuJrN3JmmgtYuZ6RM+dTxVeCdbuCgxNE+wlkazOwp DPD+zjYGjTBHZ4L3JtrkwOvcemdz5bDA== X-Gm-Gg: ASbGncsZKJBNWsR9uheksV92vmQb9kE6Vm7CkubxJNIOh1jYKcjlDLfgBJrO0H5qjcn yQlq14lCbMHW84iepYZlDlheug0I7fa9rvAdOxk2Eaa7Ds8+AsQUPF9GYE6rTJ2ZH7RL6cfxEOe eEKroDsg4PSbWGUSmCsbH7WI3XV03d270PMjEwqpL7jEiAcKv8Pd6/uek9V7BNPgHx8ccUaT1N3 WtPuZ4X6q/FJJp2lAKcEEJGpR5eFmVYrXR5P3mi+pufLOEVRLSh X-Received: by 2002:a5d:6d83:0:b0:385:e429:e59e with SMTP id ffacd0b85a97d-38a87357af8mr25925070f8f.52.1736964573817; Wed, 15 Jan 2025 10:09:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgTqRDKXt/QMfii/3EI3UdjaEy/Zk8X/TP5tKC61xzB+//RIgBreRPAf3yaLlZ3bU7JFHPvQ== X-Received: by 2002:a5d:6d83:0:b0:385:e429:e59e with SMTP id ffacd0b85a97d-38a87357af8mr25925045f8f.52.1736964573444; Wed, 15 Jan 2025 10:09:33 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7499932sm31341385e9.7.2025.01.15.10.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:32 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:30 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Jason Wang , Igor Mammedov , Ani Sinha Subject: [PULL 20/48] tests/acpi: q35: allow DMAR acpi table changes Message-ID: <9609d7101867819086516c7df845337dcee1cf08.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Signed-off-by: Zhenzhong Duan Acked-by: Jason Wang Message-Id: <20241212083757.605022-16-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..46f80be9ca 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,2 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/x86/q35/DMAR.dmar", From patchwork Wed Jan 15 18:09:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940749 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14F47C02180 for ; Wed, 15 Jan 2025 18:15:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rT-0002vR-PE; Wed, 15 Jan 2025 13:11:28 -0500 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 1tY7pm-0006p3-8e for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:49 -0500 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 1tY7pk-0006fg-PP for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964580; 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=tenv3/Fn0175pDVwISZvpL0yo8/HEzy+5ymjzuGHC9U=; b=jGQiuISy2L1Yoy7vDg3R9lBmFI5SfQ67/2i44VSGwWLtc7sbt4FWzHzyeHDlaxZXPMXB0t GVys5CnbbmKWdG15Lme+BbMD9WnKy9y9Vwq9wfhg17Hymvol5A+TeoV/TfnuOx0MZMRVfc JsZQmFndTxMGCatuKKJS9w8+01Y7Zfk= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-102-vJBA7SRbM_aZvqzg9GRqjg-1; Wed, 15 Jan 2025 13:09:38 -0500 X-MC-Unique: vJBA7SRbM_aZvqzg9GRqjg-1 X-Mimecast-MFC-AGG-ID: vJBA7SRbM_aZvqzg9GRqjg Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4361c040ba8so39300825e9.1 for ; Wed, 15 Jan 2025 10:09:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964577; x=1737569377; 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=tenv3/Fn0175pDVwISZvpL0yo8/HEzy+5ymjzuGHC9U=; b=rHa/0MdhFC/PkBDRxOOqcHTIF58aznMYLFjUBQ0qTuCkQhRicaoHpX2hwMyyvUAQwH jx5NSiVK+Zw1A62st7qlGXtZHF3lGM2Rr5rKAaLRRNv7BwOJS4iswFfK4NgDeEFfUC2E C35KIkQNQ2uaFRYkTLNNTQWUZW+77qBYazfluhRYNnDv6DDvlDLy7nYQBumrhLS2cWDm gpu6liwTihw6rHFkFvPYQcej2f15TfINUOifmyHVksAeD5ItsquFPBpvbIMTOr5CVafw B0X0LYzUbW9RnzkWFqyEwLAdLHgJYzuVUehH1iRPAFhRMr1o54S6QwUaBB97hnZT+GHY 9xlQ== X-Gm-Message-State: AOJu0YzuNMQBvL3Z6pqDNTXIdVb89Ub3UQ63AZ/cvvVpGwUkDkEnHqBx UmBRpEavBuRKWVML+Zuuu5YdsS4+mjbBCwTFyZv45zkSfwgdG7Ydv5nBQ0Oy+E7sgYlFOZySGcx 77e5hDFMvCwnXwn4yYM2aC1U+JaerEm+W+mXxWrdfNcwNG8E4FojZdRD+3eEFPn1PQPjZDqV+Y6 +FlpduBw67pDLQIvisIpLqZChuOJ8m9Q== X-Gm-Gg: ASbGncvFX9dadsrjXQzy7IAPD69QLsq5/rm2sD9NxYIJiBhQkEiSscML9ATgi7SwKDy WHyOj21F5A3NW7pHO1ne8wJv3RANLT2621or9X7gI/gppQnBS8unGki898qKCCZl7a4Dx5a1EBK gpQPuSIa1h08w4T0GQhmRaSiM19H3nIzqiSvEXvdTv09kYNtD1BS+A8LPkffDUZWIRX9WS/l/PC +wpUQiLhbYg3sdCJYCrnXTSNU3BT2WfuYhVTIaLwjVUyZflSoLD X-Received: by 2002:a05:600c:3c97:b0:436:840b:261c with SMTP id 5b1f17b1804b1-436e26ab54fmr243211765e9.19.1736964577116; Wed, 15 Jan 2025 10:09:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkWsvTlCCO0h3rZ8fopHRAB+doxkT01YEymJhlBChmWhc38vAC7/Frsc5HpY2hjvNZsIrFCA== X-Received: by 2002:a05:600c:3c97:b0:436:840b:261c with SMTP id 5b1f17b1804b1-436e26ab54fmr243211475e9.19.1736964576654; Wed, 15 Jan 2025 10:09:36 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7499bbasm33026955e9.3.2025.01.15.10.09.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:36 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:33 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Jason Wang , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Yi Liu , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 21/48] intel_iommu: Set default aw_bits to 48 starting from QEMU 9.2 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan According to VTD spec, stage-1 page table could support 4-level and 5-level paging. However, 5-level paging translation emulation is unsupported yet. That means the only supported value for aw_bits is 48. So default aw_bits to 48 when stage-1 translation is turned on. For legacy and scalable modes, 48 is the default choice for modern OS when both 48 and 39 are supported. So it makes sense to set default to 48 for these two modes too starting from QEMU 9.2. Use pc_compat_9_1 to handle the compatibility for machines before 9.2. Suggested-by: Jason Wang Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Acked-by: Jason Wang Message-Id: <20241212083757.605022-17-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/intel_iommu.h | 2 +- hw/i386/pc.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index a434c2489c..72428fefa4 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -45,7 +45,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(IntelIOMMUState, INTEL_IOMMU_DEVICE) #define DMAR_REG_SIZE 0x230 #define VTD_HOST_AW_39BIT 39 #define VTD_HOST_AW_48BIT 48 -#define VTD_HOST_ADDRESS_WIDTH VTD_HOST_AW_39BIT +#define VTD_HOST_ADDRESS_WIDTH VTD_HOST_AW_48BIT #define VTD_HAW_MASK(aw) ((1ULL << (aw)) - 1) #define DMAR_REPORT_F_INTR (1) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 9334b033f6..b46975c8a4 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -86,6 +86,7 @@ GlobalProperty pc_compat_9_1[] = { { "ICH9-LPC", "x-smi-swsmi-timer", "off" }, { "ICH9-LPC", "x-smi-periodic-timer", "off" }, { TYPE_INTEL_IOMMU_DEVICE, "stale-tm", "on" }, + { TYPE_INTEL_IOMMU_DEVICE, "aw-bits", "39" }, }; const size_t pc_compat_9_1_len = G_N_ELEMENTS(pc_compat_9_1); From patchwork Wed Jan 15 18:09:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940757 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1281CC02180 for ; Wed, 15 Jan 2025 18:17:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s7-000632-DB; Wed, 15 Jan 2025 13:12:07 -0500 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 1tY7pq-0006zg-8y for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:51 -0500 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 1tY7pn-0006fz-H7 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964582; 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=ag3nS8CSRSWzObDvb75VNRNg7yyr8lxnvn6CfDV/TZ4=; b=MgIyACh72iJo7lxm96PPggAFctgXZbqIjJ+420AJ3NuRw40bv5t174nuaJMYEDVRLCmUgG jxKMHcfL22y5GL+P/BYjspLbpVyNelmJsREZvl8JZmls2y9YlsGnW8t9PnC84yStq5qE90 8WiFhRhwqtOpFqbsmqWH98dmqM34c5g= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-XtLt5IrVNz-KDr0HD35U7w-1; Wed, 15 Jan 2025 13:09:41 -0500 X-MC-Unique: XtLt5IrVNz-KDr0HD35U7w-1 X-Mimecast-MFC-AGG-ID: XtLt5IrVNz-KDr0HD35U7w Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43646b453bcso36825145e9.3 for ; Wed, 15 Jan 2025 10:09:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964580; x=1737569380; 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=ag3nS8CSRSWzObDvb75VNRNg7yyr8lxnvn6CfDV/TZ4=; b=VT9nOoOeFDdnX3YmdHbyqJKZfBsNfQTcO+tzG9pVfJyHI3oAYaK6ySVkg3w7cp2tBQ ynUASsCZ56DV9kPiW49164I1oA1W36M0WJ3igPOHdPMsiCObGiKkC0Dizb3jW77Vxxlv wZqer2JhQBnG2rIZlEbHI6+yS+1hslZF3n4wgaay4dQ86JU/wrmLK9T/zXJQsHG0eZ1P SIzv/qfP0HtG2HwtIg3YIvCzzdeQQtwk2+mjwgY/26tmBqnSDXDKSMGhiqxawy8PEImV CUcmC9q/DfJ83A6mab9Q43haZiiqaKIURpgETN98JFeoJ9O2jcx/Gj8D0EHCNErXq7Dz /0jA== X-Gm-Message-State: AOJu0YyoCtrXw7HDcq/7NQB58GSi/A+Of1VtbkiEMtWR6WCvX320DX+C J78dydefP6RATn5f2C6EcrIimAVzvX2KQi/TbJ8xlIO2Hh75HYCEEwAgRv5fucAVhgIXFtzB7YC v4p4NMIeJGYQI4TvlNr5hAPb5hhIF9jxJM07t60uUR71+9x5emIrbjKZfeQIQpGlq6LTcxFXhKr t6P3rL4g+tQvTw0Xff/21Is7wagCBjwQ== X-Gm-Gg: ASbGnctGhtQG4coLvsTlP+ncz0QLpK2+RcTJP7UKF2V7Eoyz44Qw8YXABQ6y9mb5Sub Y96jBHXO5r1qXVuOSBExLCwN7Hlj+hifmt5HA0zs34rtJO5eoUraLNMyxrbjQHEgCJCd1RyNU6e qFrEjAneWBCZ4TOb8doxb2BB8CPfuSJsbkC3SOVlKgOSKCjlL3oOo0Myq1bTXWRyVMC+UwHD83y j21YhF4reSisIIefAok9cmEANrTW/RdfJH/CLWL3Yfw+3uMKlep X-Received: by 2002:a05:600c:468a:b0:434:a968:89a3 with SMTP id 5b1f17b1804b1-436e26a78a5mr234939245e9.9.1736964579900; Wed, 15 Jan 2025 10:09:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1aZa0Ck+WEMB49/GhnZBuRGAB7VVFOIbhKJYK3EAUM5ujYSmPju3bAXwtFhZGKBqH4W08/A== X-Received: by 2002:a05:600c:468a:b0:434:a968:89a3 with SMTP id 5b1f17b1804b1-436e26a78a5mr234938975e9.9.1736964579486; Wed, 15 Jan 2025 10:09:39 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c753c617sm31454915e9.37.2025.01.15.10.09.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:38 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:36 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Igor Mammedov , Ani Sinha Subject: [PULL 22/48] tests/acpi: q35: Update host address width in DMAR Message-ID: <81ab964f21620db32558277f220eb0d803c14109.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Differences: @@ -1,39 +1,39 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20200925 (64-bit version) * Copyright (c) 2000 - 2020 Intel Corporation * - * Disassembly of tests/data/acpi/x86/q35/DMAR.dmar, Mon Nov 11 15:31:18 2024 + * Disassembly of /tmp/aml-SPJ4W2, Mon Nov 11 15:31:18 2024 * * ACPI Data Table [DMAR] * * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue */ [000h 0000 4] Signature : "DMAR" [DMA Remapping table] [004h 0004 4] Table Length : 00000078 [008h 0008 1] Revision : 01 -[009h 0009 1] Checksum : 15 +[009h 0009 1] Checksum : 0C [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 -[024h 0036 1] Host Address Width : 26 +[024h 0036 1] Host Address Width : 2F [025h 0037 1] Flags : 01 [026h 0038 10] Reserved : 00 00 00 00 00 00 00 00 00 00 [030h 0048 2] Subtable Type : 0000 [Hardware Unit Definition] [032h 0050 2] Length : 0040 [034h 0052 1] Flags : 00 [035h 0053 1] Reserved : 00 [036h 0054 2] PCI Segment Number : 0000 [038h 0056 8] Register Base Address : 00000000FED90000 [040h 0064 1] Device Scope Type : 03 [IOAPIC Device] [041h 0065 1] Entry Length : 08 [042h 0066 2] Reserved : 0000 [044h 0068 1] Enumeration ID : 00 [045h 0069 1] PCI Bus Number : FF Signed-off-by: Zhenzhong Duan Acked-by: Clément Mathieu--Drif Message-Id: <20241212083757.605022-18-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/x86/q35/DMAR.dmar | Bin 120 -> 120 bytes 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/x86/q35/DMAR.dmar b/tests/data/acpi/x86/q35/DMAR.dmar index 0dca6e68ad8a8ca5b981bcfbc745385a63e9f216..0c05976715c6f2f6ec46ef6d37790f86a392b5ea 100644 GIT binary patch delta 21 ccmb=Z;BxVG460yYU|{5#$R)+7KT$Op05(qqk^lez delta 21 ccmb=Z;BxVG460yYU|Sg05*ICk^lez diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 46f80be9ca..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/x86/q35/DMAR.dmar", From patchwork Wed Jan 15 18:09:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60C30C02180 for ; Wed, 15 Jan 2025 18:11:10 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qo-0008BP-Qy; Wed, 15 Jan 2025 13:10:48 -0500 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 1tY7ps-0006zz-Ma for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:52 -0500 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 1tY7pr-0006gM-3t for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964586; 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=ETnhhwJ4AroiA4dDpka4gKiY7LenBhWoiTYTB5Wyngk=; b=XH6j248wY8hUmWLYjDz8AhhKFQwQUTgY+5IDupFeyLiqY3HW5/VXkfGbZKb4UKj8y+ufEk WqcvfymIYh6YCITmquaDg0fl0VVkYGly4C8O6A7N95W3i1N8PjA0KyXR0UhFHOQebNfoNY m/DzOzpOGS8PNbwqTqXJtYp3Lpj/sGA= 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-48-DPch8Q0-O0KZYBurOtnO7g-1; Wed, 15 Jan 2025 13:09:44 -0500 X-MC-Unique: DPch8Q0-O0KZYBurOtnO7g-1 X-Mimecast-MFC-AGG-ID: DPch8Q0-O0KZYBurOtnO7g Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-386333ea577so39088f8f.1 for ; Wed, 15 Jan 2025 10:09:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964583; x=1737569383; 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=ETnhhwJ4AroiA4dDpka4gKiY7LenBhWoiTYTB5Wyngk=; b=efoP+TLuKvb9AAmjv/JYM7wQCN4AQnwub9GD8Fv0MuZ17jCybT8Lmg+2VTk//kAfwo DdWuVFNgGMvBCbm3hAazVbPq3wAK1pu4moXns3xcfCZcC55J23dEwmaRNlUhDDGEww8P mf8VartF1heb3sR6Vfnnw7OIVuYDUYDpWgCJEoSks4l1MeTvzYzGg+osF00zaVvHBdB4 2aPafVlVsRXubvL8N1jV6EQTbVyJWyn42rX0IGK2YPw767rFeQ0adY8aY5HiSd9jxyFq VBkOnlGKX3o8LCcc7LcFZNr2rg3EPNhtnvzCjjmUMEps0Ww5VMMi4vod59saGsBwHeWl Htuw== X-Gm-Message-State: AOJu0Yx7P5+K31TAkXn4bw4bNQ89/gvk4bdluUDQDLacGNjGhzR8i3eH OW/j9xuYftG/vpayDaejZt6u5A5NNmgaU42S+90higb4DkWiL/sfmGr16r2+uh2TlznRuARt2vu nH/DJk9UU60/gbfO5OGELIY6Q5UB4/VI8Y3MdeicURlh9N407yPYHkK2WveHT7n5DuO0RC9Z8xx uUM2rMhZ4uec5k0yoNeS2UjPawv+5Rog== X-Gm-Gg: ASbGncu/rzNmK1fFlEOcH99hGAWrOBftvCChv+PTx3xFoOGKMe4Wa2WDCM7a65ILKMK II0cqUiNGVqd8iQ3fYPU3AjSjA/+qCSzftxA1bhjbyUawkT6C/K/mVs4t3wdFAipvILQNV6hU6G ZV2msRWUR2fkO39hEF3SJDFU07ByHFxG52rOYibj1zrtmr/DhEmxfxVESivCPbmNbzL9SNX+dS4 f9emgHx79L7fCpGZv/nOU4hdCQPC4G14wYlAnuoujtc+5UxbCxu X-Received: by 2002:adf:a108:0:b0:38a:88ac:ed10 with SMTP id ffacd0b85a97d-38a88acedf9mr22371451f8f.25.1736964583237; Wed, 15 Jan 2025 10:09:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvEpBYCLwLSaI0pWIX/41ba8W5NS9zsXJ3fcnlLOa/9SCF30PmW2rUDzr2AUVT4IZCXVjhJg== X-Received: by 2002:adf:a108:0:b0:38a:88ac:ed10 with SMTP id ffacd0b85a97d-38a88acedf9mr22371416f8f.25.1736964582780; Wed, 15 Jan 2025 10:09:42 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c475csm32200845e9.20.2025.01.15.10.09.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:42 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:39 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Jason Wang , Yi Liu , Yi Sun , =?utf-8?q?C?= =?utf-8?q?l=C3=A9ment?= Mathieu--Drif , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 23/48] intel_iommu: Introduce a property x-flts for stage-1 translation 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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Intel VT-d 3.0 introduces scalable mode, and it has a bunch of capabilities related to scalable mode translation, thus there are multiple combinations. This vIOMMU implementation wants to simplify it with a new property "x-flts". When turned on in scalable mode, stage-1 translation is supported. When turned on in legacy mode, throw out error. With stage-1 translation support exposed to user, also accurate the pasid entry check in vtd_pe_type_check(). Suggested-by: Jason Wang Signed-off-by: Yi Liu Signed-off-by: Yi Sun Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Message-Id: <20241212083757.605022-19-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/intel_iommu_internal.h | 2 ++ hw/i386/intel_iommu.c | 28 +++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 2c977aa7da..e8b211e8b0 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -195,6 +195,7 @@ #define VTD_ECAP_PASID (1ULL << 40) #define VTD_ECAP_SMTS (1ULL << 43) #define VTD_ECAP_SLTS (1ULL << 46) +#define VTD_ECAP_FLTS (1ULL << 47) /* CAP_REG */ /* (offset >> 4) << 24 */ @@ -211,6 +212,7 @@ #define VTD_CAP_SLLPS ((1ULL << 34) | (1ULL << 35)) #define VTD_CAP_DRAIN_WRITE (1ULL << 54) #define VTD_CAP_DRAIN_READ (1ULL << 55) +#define VTD_CAP_FS1GP (1ULL << 56) #define VTD_CAP_DRAIN (VTD_CAP_DRAIN_READ | VTD_CAP_DRAIN_WRITE) #define VTD_CAP_CM (1ULL << 7) #define VTD_PASID_ID_SHIFT 20 diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 7d4b99523d..0111186f7a 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -803,16 +803,18 @@ static inline bool vtd_is_fl_level_supported(IntelIOMMUState *s, uint32_t level) } /* Return true if check passed, otherwise false */ -static inline bool vtd_pe_type_check(X86IOMMUState *x86_iommu, - VTDPASIDEntry *pe) +static inline bool vtd_pe_type_check(IntelIOMMUState *s, VTDPASIDEntry *pe) { switch (VTD_PE_GET_TYPE(pe)) { - case VTD_SM_PASID_ENTRY_SLT: - return true; - case VTD_SM_PASID_ENTRY_PT: - return x86_iommu->pt_supported; case VTD_SM_PASID_ENTRY_FLT: + return !!(s->ecap & VTD_ECAP_FLTS); + case VTD_SM_PASID_ENTRY_SLT: + return !!(s->ecap & VTD_ECAP_SLTS); case VTD_SM_PASID_ENTRY_NESTED: + /* Not support NESTED page table type yet */ + return false; + case VTD_SM_PASID_ENTRY_PT: + return !!(s->ecap & VTD_ECAP_PT); default: /* Unknown type */ return false; @@ -861,7 +863,6 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, uint8_t pgtt; uint32_t index; dma_addr_t entry_size; - X86IOMMUState *x86_iommu = X86_IOMMU_DEVICE(s); index = VTD_PASID_TABLE_INDEX(pasid); entry_size = VTD_PASID_ENTRY_SIZE; @@ -875,7 +876,7 @@ static int vtd_get_pe_in_pasid_leaf_table(IntelIOMMUState *s, } /* Do translation type check */ - if (!vtd_pe_type_check(x86_iommu, pe)) { + if (!vtd_pe_type_check(s, pe)) { return -VTD_FR_PASID_TABLE_ENTRY_INV; } @@ -3827,6 +3828,7 @@ static const Property vtd_properties[] = { VTD_HOST_ADDRESS_WIDTH), DEFINE_PROP_BOOL("caching-mode", IntelIOMMUState, caching_mode, FALSE), DEFINE_PROP_BOOL("x-scalable-mode", IntelIOMMUState, scalable_mode, FALSE), + DEFINE_PROP_BOOL("x-flts", IntelIOMMUState, flts, FALSE), DEFINE_PROP_BOOL("snoop-control", IntelIOMMUState, snoop_control, false), DEFINE_PROP_BOOL("x-pasid-mode", IntelIOMMUState, pasid, false), DEFINE_PROP_BOOL("dma-drain", IntelIOMMUState, dma_drain, true), @@ -4557,7 +4559,10 @@ static void vtd_cap_init(IntelIOMMUState *s) } /* TODO: read cap/ecap from host to decide which cap to be exposed. */ - if (s->scalable_mode) { + if (s->flts) { + s->ecap |= VTD_ECAP_SMTS | VTD_ECAP_FLTS; + s->cap |= VTD_CAP_FS1GP; + } else if (s->scalable_mode) { s->ecap |= VTD_ECAP_SMTS | VTD_ECAP_SRS | VTD_ECAP_SLTS; } @@ -4736,6 +4741,11 @@ static bool vtd_decide_config(IntelIOMMUState *s, Error **errp) } } + if (!s->scalable_mode && s->flts) { + error_setg(errp, "x-flts is only available in scalable mode"); + return false; + } + if (!s->flts && s->aw_bits != VTD_HOST_AW_39BIT && s->aw_bits != VTD_HOST_AW_48BIT) { error_setg(errp, "%s: supported values for aw-bits are: %d, %d", From patchwork Wed Jan 15 18:09:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940746 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAD4CC02183 for ; Wed, 15 Jan 2025 18:14:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7re-0003W7-DM; Wed, 15 Jan 2025 13:11:39 -0500 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 1tY7px-00074I-EE for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:57 -0500 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 1tY7pv-0006gp-UB for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964591; 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=3jraWayqR6S0TF4m7yuNwt/0UGk8nDQ+cyMTXQFXBV8=; b=LbFv8hrVQ05IUnsEp3oUFt6zOPkuYdECdHVCG8NTHm099n+zQehqFDIxJAQVEnTOelvpSV RBkyzOKCHUnhziT1vHDLJOsql6r7HoQqe4lfPf3mY0Io7PyVjCVXfYqv/k3ZHfqZZLcY9J dE0DQpA+cvvTvHeMi23oE0SV9ReCPHM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-1Xzz5eM4PiCnCvL4UM0pRA-1; Wed, 15 Jan 2025 13:09:48 -0500 X-MC-Unique: 1Xzz5eM4PiCnCvL4UM0pRA-1 X-Mimecast-MFC-AGG-ID: 1Xzz5eM4PiCnCvL4UM0pRA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43628594d34so39267705e9.2 for ; Wed, 15 Jan 2025 10:09:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964586; x=1737569386; 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=3jraWayqR6S0TF4m7yuNwt/0UGk8nDQ+cyMTXQFXBV8=; b=A8bpdy7RVmruy4VmihymiYQQs9mZDC5Jxlasv6btud8wRDoiPxVunrQRBe2VPxFTJj 2Zk9+qklb90BOM2o196+J1ihHEvq/wDjkuL7jXukSOzxGzUkEuhqCwLUtp+v+tIG1YeT ivAQxRWmBbinv6QuD/mZ6INK6DX5LKI2R3hu2ZJDeBSaOarg1t0HLzpRUNEraZwX5XUq iGexKKi991hb+vAkLafb+FqV3B4qJFUVFTHP3o0TSN3FZn9NLh7uLuFcpYl4b1GiA5b2 NcJ1V4TuLjg51Ofwa9KIAiQWNkNe3ykkUnG1pttOp+9dBdAXVM6jAgs5G6fY9PXGYI7G dmRw== X-Gm-Message-State: AOJu0Yyi0rYCUf22YnEFP+9gznbabHUnQBdyJ+3UCKSNJ+LAdP49rujm 7Rye2o1yJeVKhBX0JU69r6XggVYjlw59+ORFH53o4KTgtnX7cC2VJ7eYpe40At/JJIGkjKXyInp 06clLVCgXyIG1hTb4nBONxvmJE/73k1/xZAIW78CsRJTbOc6WhzwiG69n31XTik5uDCLje/42Ea 7qohq+rRytMHNXHl647oQ9cusMo+t+Pw== X-Gm-Gg: ASbGncuFxBikJ6qiLv4b7tvZuN1lA9UbuUN/WQK6qjq4PuTcKA0usKDexRBeNeDqp3g 1IeclZGzG9xuH+G2J52PaPYAd9vLN8qC0MOc3+uSIFeCEuWvdMpqGOiqQjR6KP+svAqMOefFVIh ZTxQJZ4baHi4yiRYOcT+nvwv0l03vcosBJnUz7WymqYHvi7+BWZkrtWP4/Oqj0Hrr1B4KkMnfRL Ehu55YxKS/S4XBbLS45fp71+x3/FTTlbFJBqAvZCCBiaeelMgue X-Received: by 2002:a05:600c:1d96:b0:434:f219:6b28 with SMTP id 5b1f17b1804b1-436e26d9477mr239161825e9.24.1736964586413; Wed, 15 Jan 2025 10:09:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeia6cob8To7qK8qMsr72Dx38m0WozvozxqB69X5RHH0cHm8nleanwVrYFqs/Qu25xxqGoEA== X-Received: by 2002:a05:600c:1d96:b0:434:f219:6b28 with SMTP id 5b1f17b1804b1-436e26d9477mr239161435e9.24.1736964585973; Wed, 15 Jan 2025 10:09:45 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7499884sm32110985e9.5.2025.01.15.10.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:45 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:43 -0500 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 , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 24/48] intel_iommu: Introduce a property to control FS1GP cap bit setting 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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan This gives user flexibility to turn off FS1GP for debug purpose. It is also useful for future nesting feature. When host IOMMU doesn't support FS1GP but vIOMMU does, nested page table on host side works after turning FS1GP off in vIOMMU. This property has no effect when vIOMMU is in legacy mode or x-flts=off in scalable modme. Signed-off-by: Zhenzhong Duan Reviewed-by: Clément Mathieu--Drif Reviewed-by: Yi Liu Acked-by: Jason Wang Message-Id: <20241212083757.605022-20-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/intel_iommu.h | 1 + hw/i386/intel_iommu.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 72428fefa4..9e92bffd5a 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -307,6 +307,7 @@ struct IntelIOMMUState { bool dma_drain; /* Whether DMA r/w draining enabled */ bool dma_translation; /* Whether DMA translation supported */ bool pasid; /* Whether to support PASID */ + bool fs1gp; /* First Stage 1-GByte Page Support */ /* Transient Mapping, Reserved(0) since VTD spec revision 3.2 */ bool stale_tm; diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 0111186f7a..f366c223d0 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3834,6 +3834,7 @@ static const Property vtd_properties[] = { DEFINE_PROP_BOOL("dma-drain", IntelIOMMUState, dma_drain, true), DEFINE_PROP_BOOL("dma-translation", IntelIOMMUState, dma_translation, true), DEFINE_PROP_BOOL("stale-tm", IntelIOMMUState, stale_tm, false), + DEFINE_PROP_BOOL("fs1gp", IntelIOMMUState, fs1gp, true), }; /* Read IRTE entry with specific index */ @@ -4561,7 +4562,9 @@ static void vtd_cap_init(IntelIOMMUState *s) /* TODO: read cap/ecap from host to decide which cap to be exposed. */ if (s->flts) { s->ecap |= VTD_ECAP_SMTS | VTD_ECAP_FLTS; - s->cap |= VTD_CAP_FS1GP; + if (s->fs1gp) { + s->cap |= VTD_CAP_FS1GP; + } } else if (s->scalable_mode) { s->ecap |= VTD_ECAP_SMTS | VTD_ECAP_SRS | VTD_ECAP_SLTS; } From patchwork Wed Jan 15 18:09:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940747 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 567A8C02183 for ; Wed, 15 Jan 2025 18:15:00 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rn-0003sR-In; Wed, 15 Jan 2025 13:11:47 -0500 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 1tY7q0-00076z-PJ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:00 -0500 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 1tY7py-0006h6-E2 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964593; 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=Utl+OxasX6fue59CsOg8gVr62uZ9JLK5ALR2hXp0wVc=; b=DKGhusBa7RjoG/0zWiQkaTmFiADfbtiP3sbSQARohYp+FTC/kODohiANOcsYChyFP6QFP2 D+3ngruXsTOfIys6BNd1gAJ+CQPnYY/BG/qyOJdfShUNX8VDEy/rLH6nrIRgCzTlj1ZHgT 06x99i1z6PTTfr+GWCDqqt3GeTCrdds= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-400-kdr7SepoPIiAvKYVuq6OmA-1; Wed, 15 Jan 2025 13:09:52 -0500 X-MC-Unique: kdr7SepoPIiAvKYVuq6OmA-1 X-Mimecast-MFC-AGG-ID: kdr7SepoPIiAvKYVuq6OmA Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361fc2b2d6so39258925e9.3 for ; Wed, 15 Jan 2025 10:09:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964591; x=1737569391; 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=Utl+OxasX6fue59CsOg8gVr62uZ9JLK5ALR2hXp0wVc=; b=ohCzpUILvX5sTSk64M3ZswM8OpenM04jwVzjYzvRpvnl1r1yFNZkRFeb2pPpZl0PG7 j1P4jnXSaxO9Sj8KpTYhZocQ3SmCGXNm4qcYuvEhF788oSnLdz2Ni7/XzOMcFRvRmZyu bHqZxbhbs/soT4LJapehK/8yjJ/uYz/bu3IN/VLke2lIQT7wFVS91Cv+b3Qm3dpnE7Hj YrcFfX+gfOXuLCbSA0WQaIL80siWkFsnPpEsY6QPeOXOIf2oZuXOD04SkB36IqrabQRc 1sXpgLkZNiRK0x2EcsKtrVCT2RORqy3B1F1Hqt4jsSosW2xvlHUrH7GbINdx+UMpF+ZU 5DGQ== X-Gm-Message-State: AOJu0YwPyCRM80ReCEVEu5+1XoRYC2hSRXYDkf/rBvfuVoEEz5oDWPJF vizhooMf8VYdUKZTLKkWPPQdJ4WWXonp1vC8rUypuN0I3ykS5Qnmp4VOJL8nSW+Cc3l2fJk0TX/ ZxDWiXevk6Ic+j00n+49A7eP3sZa2CZ85j85gEKDTZlzkqX1LjOdyiKL8H/GNZ2TLOfk7+fmaXA Zx1a7Kr87pE3LtmAT1TxE+5VZ8JnnQZQ== X-Gm-Gg: ASbGnctMrat1URZ3Wrlc47lrUlewPahCKTEcSXtTLlyi1BM5a6zbvPRyYJitQPnKmGz Z4Hb/B11I1Y2Hd2zQo029P9Sm1OZ3EP9NxIA2ENhQJkofQ3+XsRMcv59uRMkLF7zkM6P1E2dyGi cVbFKIgdX1sZuXsKGg4nm/ezucT/2lcc6QTEQjfRcdDmfjreaHMsXaEGwGiyjrm5AZLcvTZwjpI dbQKOBuBF+wegnAn9FIJPHfXeye16vt/nby5CSiuQeGA/ZhOo0Y X-Received: by 2002:a05:600c:5125:b0:434:eb73:b0c0 with SMTP id 5b1f17b1804b1-436e266f994mr308196255e9.5.1736964591028; Wed, 15 Jan 2025 10:09:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXa3m7zzPj005EoNBu8kHSWDeQuicEbzxPasdw01/usLnXGJeoJdba3feMu6rDusDkNorIKg== X-Received: by 2002:a05:600c:5125:b0:434:eb73:b0c0 with SMTP id 5b1f17b1804b1-436e266f994mr308195935e9.5.1736964590617; Wed, 15 Jan 2025 10:09:50 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74ab449sm31397065e9.10.2025.01.15.10.09.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:49 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:46 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Zhenzhong Duan , Thomas Huth , =?utf-8?q?Cl=C3=A9ment?= Mathieu--Drif , Jason Wang , Yi Liu , Marcel Apfelbaum , Fabiano Rosas , Laurent Vivier , Paolo Bonzini Subject: [PULL 25/48] tests/qtest: Add intel-iommu test Message-ID: <2c746dfe1c69896b0e434d37efe014654f0a3a65.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Zhenzhong Duan Add the framework to test the intel-iommu device. Currently only tested cap/ecap bits correctness when x-flts=on in scalable mode. Also tested cap/ecap bits consistency before and after system reset. Signed-off-by: Zhenzhong Duan Acked-by: Thomas Huth Reviewed-by: Clément Mathieu--Drif Acked-by: Jason Wang Message-Id: <20241212083757.605022-21-zhenzhong.duan@intel.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/i386/intel_iommu.h | 1 + tests/qtest/intel-iommu-test.c | 64 ++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + tests/qtest/meson.build | 1 + 4 files changed, 67 insertions(+) create mode 100644 tests/qtest/intel-iommu-test.c diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index 9e92bffd5a..e95477e855 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -47,6 +47,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(IntelIOMMUState, INTEL_IOMMU_DEVICE) #define VTD_HOST_AW_48BIT 48 #define VTD_HOST_ADDRESS_WIDTH VTD_HOST_AW_48BIT #define VTD_HAW_MASK(aw) ((1ULL << (aw)) - 1) +#define VTD_MGAW_FROM_CAP(cap) ((cap >> 16) & 0x3fULL) #define DMAR_REPORT_F_INTR (1) diff --git a/tests/qtest/intel-iommu-test.c b/tests/qtest/intel-iommu-test.c new file mode 100644 index 0000000000..c521b3796e --- /dev/null +++ b/tests/qtest/intel-iommu-test.c @@ -0,0 +1,64 @@ +/* + * QTest testcase for intel-iommu + * + * Copyright (c) 2024 Intel, Inc. + * + * Author: Zhenzhong Duan + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "hw/i386/intel_iommu_internal.h" + +#define CAP_STAGE_1_FIXED1 (VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND | \ + VTD_CAP_MAMV | VTD_CAP_PSI | VTD_CAP_SLLPS) +#define ECAP_STAGE_1_FIXED1 (VTD_ECAP_QI | VTD_ECAP_IR | VTD_ECAP_IRO | \ + VTD_ECAP_MHMV | VTD_ECAP_SMTS | VTD_ECAP_FLTS) + +static inline uint64_t vtd_reg_readq(QTestState *s, uint64_t offset) +{ + return qtest_readq(s, Q35_HOST_BRIDGE_IOMMU_ADDR + offset); +} + +static void test_intel_iommu_stage_1(void) +{ + uint8_t init_csr[DMAR_REG_SIZE]; /* register values */ + uint8_t post_reset_csr[DMAR_REG_SIZE]; /* register values */ + uint64_t cap, ecap, tmp; + QTestState *s; + + s = qtest_init("-M q35 -device intel-iommu,x-scalable-mode=on,x-flts=on"); + + cap = vtd_reg_readq(s, DMAR_CAP_REG); + g_assert((cap & CAP_STAGE_1_FIXED1) == CAP_STAGE_1_FIXED1); + + tmp = cap & VTD_CAP_SAGAW_MASK; + g_assert(tmp == (VTD_CAP_SAGAW_39bit | VTD_CAP_SAGAW_48bit)); + + tmp = VTD_MGAW_FROM_CAP(cap); + g_assert(tmp == VTD_HOST_AW_48BIT - 1); + + ecap = vtd_reg_readq(s, DMAR_ECAP_REG); + g_assert((ecap & ECAP_STAGE_1_FIXED1) == ECAP_STAGE_1_FIXED1); + + qtest_memread(s, Q35_HOST_BRIDGE_IOMMU_ADDR, init_csr, DMAR_REG_SIZE); + + qobject_unref(qtest_qmp(s, "{ 'execute': 'system_reset' }")); + qtest_qmp_eventwait(s, "RESET"); + + qtest_memread(s, Q35_HOST_BRIDGE_IOMMU_ADDR, post_reset_csr, DMAR_REG_SIZE); + /* Ensure registers are consistent after hard reset */ + g_assert(!memcmp(init_csr, post_reset_csr, DMAR_REG_SIZE)); + + qtest_quit(s); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + qtest_add_func("/q35/intel-iommu/stage-1", test_intel_iommu_stage_1); + + return g_test_run(); +} diff --git a/MAINTAINERS b/MAINTAINERS index 8b9d9a7cac..a928ce3e41 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3711,6 +3711,7 @@ F: hw/i386/intel_iommu.c F: hw/i386/intel_iommu_internal.h F: include/hw/i386/intel_iommu.h F: tests/functional/test_intel_iommu.py +F: tests/qtest/intel-iommu-test.c AMD-Vi Emulation S: Orphan diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index bf4d5c268b..edd53ec995 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -93,6 +93,7 @@ qtests_i386 = \ (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) + \ (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) + \ (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) + \ + (config_all_devices.has_key('CONFIG_VTD') ? ['intel-iommu-test'] : []) + \ (host_os != 'windows' and \ config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) + \ (config_all_devices.has_key('CONFIG_PCIE_PORT') and \ From patchwork Wed Jan 15 18:09:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12484C02183 for ; Wed, 15 Jan 2025 18:17:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rE-0001Pb-6i; Wed, 15 Jan 2025 13:11:12 -0500 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 1tY7q2-00079U-SY for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:00 -0500 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 1tY7q1-0006hf-HH for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:09:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964597; 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=RHTNE/Bc8eGdf6kTlbv87G0muLfR26JlONo5ZPM2ySM=; b=A7I/1W398D1gxSxPk7oxBofdauRcq0exxRnWtsDhZLbjV4JWz+IsZ4+whJn/s2lysbbfxD scHF+nYONM7F6WELih1Tcj8vX1pitFtM9pCl/Ty+XvfJTu3oKV8oLTyEq1kKmuUTvXbZDM C2rV40mtfo3GNrwd4MByLhxAlxQtAL4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-220-lEuWqYc3OXSqYVMRTbmrxA-1; Wed, 15 Jan 2025 13:09:55 -0500 X-MC-Unique: lEuWqYc3OXSqYVMRTbmrxA-1 X-Mimecast-MFC-AGG-ID: lEuWqYc3OXSqYVMRTbmrxA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4361efc9d1fso55873745e9.2 for ; Wed, 15 Jan 2025 10:09:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964594; x=1737569394; 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=RHTNE/Bc8eGdf6kTlbv87G0muLfR26JlONo5ZPM2ySM=; b=OtrCq0XZ598evEWM2BJQ9Fgb2G0un5G05QIx1oQYsS1EiXGMVz0vxU9KStCzpCyT2I ZqcCOMMYM6jCjZTAt5ozf+M9LYT7yXBLXQ+yS81s2vjDsd+14oqVPxHgofpCLvgJCen7 DhxYjTvQBZRfY+DC0b61KWmhOeJ8QHmBarl2SbFR3+gEeTNiEUW3cPhgwfagdfZ4GBzc jp/puVN14Pc+l8onscAgfUKh6HG58RGU4kMTy6U6IbaOIwiWQPPOj6m4LK1N1/WdbkEt GjBvqs2mbyDqJplH6MPtaj8lHm5hG81pQopdxmM05wM0mx3GuCzrjcuedF++go9ITSwp ceyQ== X-Gm-Message-State: AOJu0YxxxPCfn/Xtshb87PqnF1DdMJ0p1nJwdXt5snNWWdWXeSfdyXJt 0c2n5l5GDiOJltLW5D2kgijqMO8+kviSe770mttg2QOEs3fh7C8q/teIN0h/qAAtqTZEhDy+B76 lFYJfjxeA9E1SgHgS3YWmJzTe858ks/DI0jSQoOJyxIiNQtnDGBHHJOElXuKATG+Y7xD7UdOV5F 9EC8P/VOUVmA8AiurGwCzIqFAfna+U3g== X-Gm-Gg: ASbGncuFaXKDfk56l9C83KslISNa/4lQiNxwM252hjWcLXqHk66WITF2tS1IDtUgzWv 0xgT3Nd8hxigXF6P8N4yCFeGnU3ZfBO/o+VDrzPGtMkgUiGCMvPZHUnyDaXgHyujY4E2kmuuvVr CLegwTp9oIUITj64SDozplrDge57veSmHCvpjEevdjPns2LA4wXOP3V+s0AIAZt49b41SVbmV7d wLtf6q7S7xGtYSCmbYBC3zCfL5Jc8oHqVl1lmaeIqCufaet396w X-Received: by 2002:a05:600c:348c:b0:436:ed33:1535 with SMTP id 5b1f17b1804b1-436ed3316a4mr238301515e9.12.1736964593895; Wed, 15 Jan 2025 10:09:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN0d0m/M2vuGpz4hpXzBa17IvDvti49mrimxefrd8mrPQ/jlMC4AkPI3JweRJ1mPlBP24UBw== X-Received: by 2002:a05:600c:348c:b0:436:ed33:1535 with SMTP id 5b1f17b1804b1-436ed3316a4mr238301275e9.12.1736964593479; Wed, 15 Jan 2025 10:09:53 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c753bee8sm31945585e9.34.2025.01.15.10.09.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:52 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Nicholas Piggin , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Marcel Apfelbaum Subject: [PULL 26/48] pci/msix: Fix msix pba read vector poll end calculation Message-ID: <42e2a7a0ab23784e44fcb18369e06067abc89305.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Nicholas Piggin The end vector calculation has a bug that results in polling fewer than required vectors when reading at a non-zero offset in PBA memory. Fixes: bbef882cc193 ("msi: add API to get notified about pending bit poll") Signed-off-by: Nicholas Piggin Message-Id: <20241212120402.1475053-1-npiggin@gmail.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/pci/msix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/msix.c b/hw/pci/msix.c index d8a55a6474..57ec7084a4 100644 --- a/hw/pci/msix.c +++ b/hw/pci/msix.c @@ -250,7 +250,7 @@ static uint64_t msix_pba_mmio_read(void *opaque, hwaddr addr, PCIDevice *dev = opaque; if (dev->msix_vector_poll_notifier) { unsigned vector_start = addr * 8; - unsigned vector_end = MIN(addr + size * 8, dev->msix_entries_nr); + unsigned vector_end = MIN((addr + size) * 8, dev->msix_entries_nr); dev->msix_vector_poll_notifier(dev, vector_start, vector_end); } From patchwork Wed Jan 15 18:09:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4FA9AC02183 for ; Wed, 15 Jan 2025 18:11:21 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qT-0007Yn-A1; Wed, 15 Jan 2025 13:10:28 -0500 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 1tY7q6-0007DG-Sf for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:05 -0500 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 1tY7q4-0006iC-Oz for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964600; 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=xnd/UP08PD5Bozot/sSil++sem222YsXqqQSl4D4JTs=; b=SI5EL6QwQ7HMe8Ia7DLF6C8HUvEH7/t0z1F1j0KS2A/GtvN7dwSsGvHeKMRCk6HxF1FbNJ J1F976qd4o3ZtwpLfQ3zdxE5GhCIfCQX9gkVyLg4kwHuJXheX8ARp4cIQNEsvKdwT+9uq6 pZjlHwJA8nH3I1g8poXttx5iW6ziA+U= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-55-DVrzZK-4NDeElzzlS8q9sQ-1; Wed, 15 Jan 2025 13:09:58 -0500 X-MC-Unique: DVrzZK-4NDeElzzlS8q9sQ-1 X-Mimecast-MFC-AGG-ID: DVrzZK-4NDeElzzlS8q9sQ Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-385fdff9db5so48181f8f.0 for ; Wed, 15 Jan 2025 10:09:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964597; x=1737569397; 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=xnd/UP08PD5Bozot/sSil++sem222YsXqqQSl4D4JTs=; b=lYbm0Pk54zSSVST2hmWjwLYtsKnBFzXrF9N0CuxBdoaM+B2c3PxmY1+siTP2PZ2tWP 3m0xxBtjJfG9DwhGycAppitkBS4R28//cFyH7Uu946XZYofsIi4qc8ZbERzEn8PdI39V bl5ihb0auamEns7eT0p1nIQOoXajHkc+uM+S06IpCm77ZAdBakqFtPBDH+27UEhG/T/z Y4gut89UinJ0Zi5Y+awf4wkhUHgWMeEYJKMaTWso2eqimVvJ5ITcViXYhjzRgAhj+LVp EPkRIqfQm5i0KiIZapk/epCv2uyo2A8eFdNyKxmwj/L35EqDzbCdYFgzbsDGDt8Ul6+L TSsw== X-Gm-Message-State: AOJu0YzHG6r0govR/+JecWScTY0GMp7ZZB+HYAnCrcJH+Xob5fMSpDhS T9E2YXJWjOD1Vr1uH3iMF7KpL+SHTtRrGrJR3oCMpLu9C4OF+YhNkoCYIDCKQ0ycTOmNRElVN6P 0Seb+0f/u1Wc+vBzS8Fr7Y6YK4Mm+HPVRH/1uoEfxRWnl4rIEQibGB2f8tMqNV2aUgNUTJfd/q5 eTGYGV96jwWLpGwkkMTwdwNiMSlQl7pA== X-Gm-Gg: ASbGncsvVhREdc+ueJLhQtufJTqADkzbUJO1yNjM86au08HFQQKN6hOCzfUjPx3YEk+ jmGx8bbAp5nGWXj1FYCJ75w9QHlOTZVuuau9jm5AMHERXlNRMjQ1oTZBs0sR3c5a3j6WOaZ67cN kHJCI+bJ9AH3NV+SBeby+I1kb3DgYpHWs2xZPpurZkfPxj3OfXzv02Cw/+Rh9j6MCiUZ4XG9GDG UUszDd3zVZ80msCpPp6VWNSnx+e9enc0bMEAYkasQfcokBe2yJ/ X-Received: by 2002:a5d:598b:0:b0:385:ee40:2d75 with SMTP id ffacd0b85a97d-38a872da8b6mr23074652f8f.20.1736964596997; Wed, 15 Jan 2025 10:09:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2Gmzsa6zc26hLIJ/h9xOEqxzz09Bhm9ECAtsf3HEErkO2FzQ6tWk79lW55oX1ZTQEVld4xg== X-Received: by 2002:a5d:598b:0:b0:385:ee40:2d75 with SMTP id ffacd0b85a97d-38a872da8b6mr23074631f8f.20.1736964596557; Wed, 15 Jan 2025 10:09:56 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38c006sm18112587f8f.46.2025.01.15.10.09.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:55 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 27/48] acpi/ghes: get rid of ACPI_HEST_SRC_ID_RESERVED Message-ID: <239c3f7ed44d8b82a682a1c2e9e8c3355c10d321.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab This is just duplicating ACPI_GHES_ERROR_SOURCE_COUNT, which has a better name. So, drop the duplication. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: <9012bf4c9630adf15a22af3c88fda8270916887b.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 3 ++- hw/acpi/ghes.c | 7 ++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 674f6958e9..59e3b8fb24 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -59,7 +59,8 @@ enum AcpiGhesNotifyType { enum { ACPI_HEST_SRC_ID_SEA = 0, /* future ids go here */ - ACPI_HEST_SRC_ID_RESERVED, + + ACPI_GHES_ERROR_SOURCE_COUNT }; typedef struct AcpiGhesState { diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index e9511d9b8f..dc217694de 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -34,9 +34,6 @@ /* The max size in bytes for one error block */ #define ACPI_GHES_MAX_RAW_DATA_LENGTH (1 * KiB) -/* Now only support ARMv8 SEA notification type error source */ -#define ACPI_GHES_ERROR_SOURCE_COUNT 1 - /* Generic Hardware Error Source version 2 */ #define ACPI_GHES_SOURCE_GENERIC_ERROR_V2 10 @@ -396,7 +393,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) AcpiGedState *acpi_ged_state; AcpiGhesState *ags; - assert(source_id < ACPI_HEST_SRC_ID_RESERVED); + assert(source_id < ACPI_GHES_ERROR_SOURCE_COUNT); acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); @@ -407,7 +404,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) if (physical_address) { - if (source_id < ACPI_HEST_SRC_ID_RESERVED) { + if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { start_addr += source_id * sizeof(uint64_t); } From patchwork Wed Jan 15 18:09:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940753 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8173EC02180 for ; Wed, 15 Jan 2025 18:17:01 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7qt-0008Oy-BD; Wed, 15 Jan 2025 13:10:52 -0500 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 1tY7qA-0007H9-RU for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:09 -0500 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 1tY7q9-0006mk-6y for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964603; 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=91AZqunFcitL0HyZ4NOaEanpB7Q6GWIn9e4SYbBrSGc=; b=EjMV2t62NCajxpNMjdNp3YC9/1z4gyNUgcQEn2yltKV0tW/XuybIEX5lxhBTQNlEvrlQSk Z9vv1Un1OZ21AUUCW9EjgbcSgkSGbAFL2zTdthPdtT4gG0Uj48+ai8sz2qIti5NVKpztUk jd9Rw09LWXTy+r/qx9Hl3Jjq7RV/IA4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-541---hhx54mNXuAbqWZnj7TTA-1; Wed, 15 Jan 2025 13:10:01 -0500 X-MC-Unique: --hhx54mNXuAbqWZnj7TTA-1 X-Mimecast-MFC-AGG-ID: --hhx54mNXuAbqWZnj7TTA Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361efc9dc6so37607315e9.3 for ; Wed, 15 Jan 2025 10:10:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964600; x=1737569400; 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=91AZqunFcitL0HyZ4NOaEanpB7Q6GWIn9e4SYbBrSGc=; b=byZeUsUB/pXXn11BMD2G2v+SjKhoP7Myeol6yK+5hpLmoGatk4SfO7o52SAQcrqPn3 dUd3srSLOZzDzkNvaKHBj+WDxg0nPlpxpacuaJg0fUKGgoO8/K/TeaGpsvIEGP7a8dn3 xizNuO8GjIuXv5Amv3r0UsuD+C6iZZPc4NAPz3ZvxE3q4XtOd9CS+IYDVmn/Z3bm21yS giFRbVkQgeq4Y+feOQ2/AueCjen3KOiDIo22opX70gPYQi60T81Hdiqu+qtTDHUNoUxh MHCSfcH0/PGsj/ZPRP06fFsyb6mFXfOMqwu3vHaS1sV8S94XJV5MjGKNoiZPXxEReFMf iLug== X-Gm-Message-State: AOJu0YwQK1HXQeDpnXmabwjhmZyrdt0B31wc+WaP+BWlyobOwaaVwm3Y A6s6BTeto2+5+wROZFhoCBQRJ1D51/RphyuBG2aHX9Lwm9uTUCFF5Fhvj8b1hvzWWaqr8cG36P1 ePHFEnZNv1Q9Qi6ZWawZU4B3zgSl9hNOfZYJZgL0RBPL+JAbFMfPCHPTWJzxNJWH+bcsYfUSyKw Uno2Y+B5Z6JW0Yy8yRHvx3TGZ1QMs1JQ== X-Gm-Gg: ASbGncvTDLT5P4n0IIqeJFIFLbchfbM4Rdc4zWMuzSnx62jGaXLsigMOchEVd6nXVF0 jHoEItMYgdZNtZsCxOec9kYKxV7hTnL2kYsoUgg6bOQW3fEX8jj4C+0XCFdyEJzuLNbjj4o8OUE 2D3wWxtXer/Hf3ZeiDjxL0jJ4BChmhjOwl6MBEPb/qJTxY0sokCesABuTSPoO0lNloofuHu2H9n aZijbxdCfu4zUJuES1xt2XnV6uBudF9VG+F1xcJpamZOYjfeBRj X-Received: by 2002:a05:600c:3584:b0:434:9dfe:20e6 with SMTP id 5b1f17b1804b1-436e26f47efmr207490055e9.23.1736964600131; Wed, 15 Jan 2025 10:10:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IHoGFA4Tyll3sPlAq1Wj82NYZdXY4cmoGKcFXza8W813pfVn/Vn5aGlgczMg/8babH6tmJklw== X-Received: by 2002:a05:600c:3584:b0:434:9dfe:20e6 with SMTP id 5b1f17b1804b1-436e26f47efmr207489775e9.23.1736964599689; Wed, 15 Jan 2025 10:09:59 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d472sm17923756f8f.1.2025.01.15.10.09.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:09:58 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:56 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 28/48] acpi/ghes: simplify acpi_ghes_record_errors() code Message-ID: <872b69f21fe34f133982e02d04e33425d761d33b.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Reduce the ident of the function and prepares it for the next changes. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: <19af4188535217213486d169e0501e592bc78a95.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 56 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index dc217694de..e66f3be150 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -402,40 +402,42 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) start_addr = le64_to_cpu(ags->ghes_addr_le); - if (physical_address) { + if (!physical_address) { + return -1; + } - if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { - start_addr += source_id * sizeof(uint64_t); - } + if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { + start_addr += source_id * sizeof(uint64_t); + } - cpu_physical_memory_read(start_addr, &error_block_addr, - sizeof(error_block_addr)); + cpu_physical_memory_read(start_addr, &error_block_addr, + sizeof(error_block_addr)); - error_block_addr = le64_to_cpu(error_block_addr); + error_block_addr = le64_to_cpu(error_block_addr); - read_ack_register_addr = start_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); + read_ack_register_addr = start_addr + + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); - cpu_physical_memory_read(read_ack_register_addr, - &read_ack_register, sizeof(read_ack_register)); + cpu_physical_memory_read(read_ack_register_addr, + &read_ack_register, sizeof(read_ack_register)); - /* zero means OSPM does not acknowledge the error */ - if (!read_ack_register) { - error_report("OSPM does not acknowledge previous error," - " so can not record CPER for current error anymore"); - } else if (error_block_addr) { - read_ack_register = cpu_to_le64(0); - /* - * Clear the Read Ack Register, OSPM will write it to 1 when - * it acknowledges this error. - */ - cpu_physical_memory_write(read_ack_register_addr, - &read_ack_register, sizeof(uint64_t)); + /* zero means OSPM does not acknowledge the error */ + if (!read_ack_register) { + error_report("OSPM does not acknowledge previous error," + " so can not record CPER for current error anymore"); + } else if (error_block_addr) { + read_ack_register = cpu_to_le64(0); + /* + * Clear the Read Ack Register, OSPM will write it to 1 when + * it acknowledges this error. + */ + cpu_physical_memory_write(read_ack_register_addr, + &read_ack_register, sizeof(uint64_t)); - ret = acpi_ghes_record_mem_error(error_block_addr, - physical_address); - } else - error_report("can not find Generic Error Status Block"); + ret = acpi_ghes_record_mem_error(error_block_addr, + physical_address); + } else { + error_report("can not find Generic Error Status Block"); } return ret; From patchwork Wed Jan 15 18:09:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE151C02180 for ; Wed, 15 Jan 2025 18:12:06 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7r6-0000g6-Jp; Wed, 15 Jan 2025 13:11:04 -0500 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 1tY7qD-0007JC-Kl for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:10 -0500 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 1tY7qB-0006vL-4J for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964606; 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=uGpzkzEPXjWW+cnhrycoe32wPN8igkpXmmUB96WL6XY=; b=JaRfHXi7ZcYONpYorHIfWCa2X4VOCVAokUoCz3kTboekWBE6MChpHD7nQwzOVM+O+uZnIH /I+2QTQTRmB9XYaAaWhEN0LoVKJ6ck5UEiZJrG09EVN83MmRQIwakOArb+zSOUowpFDboC 1Q5qrD7JaHeERLSR5JKRaOybaH0Y4f4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-596-A9oQdMIrPZ-CrUXwAmMI7Q-1; Wed, 15 Jan 2025 13:10:05 -0500 X-MC-Unique: A9oQdMIrPZ-CrUXwAmMI7Q-1 X-Mimecast-MFC-AGG-ID: A9oQdMIrPZ-CrUXwAmMI7Q Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-38639b4f19cso91433f8f.0 for ; Wed, 15 Jan 2025 10:10:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964603; x=1737569403; 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=uGpzkzEPXjWW+cnhrycoe32wPN8igkpXmmUB96WL6XY=; b=MMR9zz/O1c4HARADvGL3nPK/OnGsp0WlHIZBwazRLsaEX7wwVA7FRb3kBhqUZ9zDSm OYpE/WoZ2eHC4FcvH/d1gt1B3W2ldfSbmg75Y/Rf2tQtTtWdYyY9hDYfQtwV+0fpAiQs mq7OliHywtV/57mSTuGCWmc4od924kkUH/JjU1UeriSbZl68JrqK96Cwn5gweVLAz/fj CzZ+kxtfCVxT8jQ56omxe8SNRFeYw6kZ0a4VIA0fzuzmSbhaibZpeeI996YAC/f4pGfo ifxfkwisSLxTF5r6sfI7R4pwuimN4exU7Ru6Y2nA5/91rX+efiL6ToN1/YsxJVatDoMw aONA== X-Gm-Message-State: AOJu0YzBZL1V79icbtPqGCckDjdQ/gX9BkRBNVQQLpqczvEPdLrfGn0O YeYp62K3F0HWDx3sKXOMQaBQpXDqX/x0x3vBANZQXlWiZOmxhIsPZqMamfxQI6W0Y3q6AmbZpcc r4fVdznna/KRc6Jlz1rS21esb2WJM9nOyd2lSsO6pYKVdtQZzcPsNT33puZCqO2IqU4tohbuIWR F+g4LdJbpxmy8KHJlHCPe6PZ/VdDcvlg== X-Gm-Gg: ASbGnctxHsbYiydPy252moCZByK7hlNSRL/JnF00YOQJXmyoAIns1mfscmlBzy1SdI2 t/RPx+1WTUY54RwbPxjMb9N0LJg+e/1Mh36yw0s9gLKXYCR7EHtGXKa5rMdmtzh1mWtPws1GN8e MWIL21xjFS6a2a2anEXLcS4LiTBR+/4V8qNDa5g3rL1ETA2HCNCiXWeq4VJL1clV99nmYIoOygz VtJZVEHu4NDl3X3VstlxyVn642d6pubTQIbK7yvY3aC+4ml4YB/ X-Received: by 2002:a05:6000:184e:b0:382:46ea:113f with SMTP id ffacd0b85a97d-38a872fc1b3mr29161512f8f.10.1736964603465; Wed, 15 Jan 2025 10:10:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoyPY8qKPIlAzIF65FSl/IiWWSA75r6C+kdnuMmKsI3XQxaDQW3OeSqnU5Okvi20qBRxy81w== X-Received: by 2002:a05:6000:184e:b0:382:46ea:113f with SMTP id ffacd0b85a97d-38a872fc1b3mr29161464f8f.10.1736964602858; Wed, 15 Jan 2025 10:10:02 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d01dsm18121376f8f.9.2025.01.15.10.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:02 -0800 (PST) Date: Wed, 15 Jan 2025 13:09:59 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , Shannon Zhao , qemu-arm@nongnu.org Subject: [PULL 29/48] acpi/ghes: simplify the per-arch caller to build HEST table Message-ID: <606a42c4c1d46b31a95cab09a7033e7f22f9ed3d.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab The GHES driver requires not only a HEST table, but also a separate firmware file to store Error Structure records. It can't do one without the other. Simplify the caller logic for it to require one function. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: <9584bb8953385e165681d5d185c503f8df8ef42f.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 4 ++-- hw/acpi/ghes.c | 7 +++++-- hw/arm/virt-acpi-build.c | 5 ++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 59e3b8fb24..20016c226d 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -68,8 +68,8 @@ typedef struct AcpiGhesState { bool present; /* True if GHES is present at all on this board */ } AcpiGhesState; -void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker); -void acpi_build_hest(GArray *table_data, BIOSLinker *linker, +void acpi_build_hest(GArray *table_data, GArray *hardware_errors, + BIOSLinker *linker, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index e66f3be150..4a6c45bcb4 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -233,7 +233,7 @@ static int acpi_ghes_record_mem_error(uint64_t error_block_address, * Initialize "etc/hardware_errors" and "etc/hardware_errors_addr" fw_cfg blobs. * See docs/specs/acpi_hest_ghes.rst for blobs format. */ -void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) +static void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) { int i, error_status_block_offset; @@ -356,12 +356,15 @@ static void build_ghes_v2(GArray *table_data, int source_id, BIOSLinker *linker) } /* Build Hardware Error Source Table */ -void acpi_build_hest(GArray *table_data, BIOSLinker *linker, +void acpi_build_hest(GArray *table_data, GArray *hardware_errors, + BIOSLinker *linker, const char *oem_id, const char *oem_table_id) { AcpiTable table = { .sig = "HEST", .rev = 1, .oem_id = oem_id, .oem_table_id = oem_table_id }; + build_ghes_error_table(hardware_errors, linker); + acpi_table_begin(&table, table_data); /* Error Source Count */ diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index c9b13057a3..3ac8f8e178 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -946,10 +946,9 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) build_dbg2(tables_blob, tables->linker, vms); if (vms->ras) { - build_ghes_error_table(tables->hardware_errors, tables->linker); acpi_add_table(table_offsets, tables_blob); - acpi_build_hest(tables_blob, tables->linker, vms->oem_id, - vms->oem_table_id); + acpi_build_hest(tables_blob, tables->hardware_errors, tables->linker, + vms->oem_id, vms->oem_table_id); } if (ms->numa_state->num_nodes > 0) { From patchwork Wed Jan 15 18:10:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57558C02183 for ; Wed, 15 Jan 2025 18:12:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rl-0003il-Mb; Wed, 15 Jan 2025 13:11:46 -0500 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 1tY7qJ-0007TA-E7 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:17 -0500 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 1tY7qF-0006wZ-FL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964610; 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=jusc2KOu8CYjh6OpTg0cDGaXqteaxjITOrBf0/V0A/Q=; b=IiF/sz3XYfmHb6Ljv6Ml2JY17KIiwuDdanwpJafBml/EPzjwA2Mdpey7ce5z9T16zC9VGC HO8BIxk431fzaJzmM6yXw0QHWnumbsX5gRSNhqzpB2mNDhWd8FNnLK9pteJCTCEfLSds/U b45r7F1YwiRE/2ohx3jqhLPjGb4thrk= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-627-8R_nRV4pMMyFnGihCQy_4Q-1; Wed, 15 Jan 2025 13:10:07 -0500 X-MC-Unique: 8R_nRV4pMMyFnGihCQy_4Q-1 X-Mimecast-MFC-AGG-ID: 8R_nRV4pMMyFnGihCQy_4Q Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436219070b4so33428605e9.1 for ; Wed, 15 Jan 2025 10:10:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964606; x=1737569406; 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=jusc2KOu8CYjh6OpTg0cDGaXqteaxjITOrBf0/V0A/Q=; b=f8YjMBlqZEfBVquz50Ex/RqdoIZFbtd0HM4v55xnTt2LbyUDtP5teidX0xLEyGnbfB cXwLsYOOmPzEiXFeVulWO/tQpnuUKziyT6+o7zEKXz2lYSROFqj6GXdG1+e35t8hXbw4 WS/wTWvNJeYwbjAXoyjHvq4XbxifBJgw97mU4PknAEXdmABdUwAnkHpGgWqhOiZPTc8x 5b+OGp1G7xol8vUKt+jqjuOizXmpF1pNaJHhB/SLLjFaQDkUP6vgMXwGhDjia0/F2EXD gEdpEYZ3wIKKk4erakzkgzWWOKkPTim5clibFDgfFx3Y2QN2NpxxrTUi92uuzhm+HUJY v0Mg== X-Gm-Message-State: AOJu0Yy9tp163czLdyrhe6SEdPxMdKOC43BSb7UCFc3fTsLMDZy1w1iR TAJw8OeaNDSssniWz2p+1PvWzV3KCM5IkU2QJVez6mxNaOg1ewwzSj1Qmt2fuJQ4S2GV9kZgoL9 e17snpTqoIlyeYvt3zB5CrQPUKq2n7Yul1hWawFxuBiDGMOBlzU5v3LqfTRlLlTeaY0ndIDGpCY pq+n35WnUz78BXt41aM7RlP8BlkMoDUw== X-Gm-Gg: ASbGncuK/p2tyP5BfjMtvW64sdzgZO++D1T6mcWVicwzEyANI4KIxprCpqGrJ0GrZug J4RMYUk3HDu9N0mb/U67o0HMR6u8IJd6Mp/9qeNlxnVbVfyXJ7gZJr9Q4rnmsxRHWdeFgX4a71y +KNxieN0pIA/A5RRSqVoJxuQFVRm+ks8HyCFXJFxhOhI2FlyzjO8070idWRsKqdrMJbd+HD+9Pe +aQ6D5GvXJ37SCPRUz5ACFDkQ+w5RTnmsSlCe47tMiyLfghNN/B X-Received: by 2002:a05:600c:a08b:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-436e26dda73mr234839525e9.24.1736964606403; Wed, 15 Jan 2025 10:10:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+UcDHey3YB0GtuhXY5QsfCKDHAKeg3yXN/XZN/OL3wZvIhBOUPHNGcn6ffH9qMuK63nQxzA== X-Received: by 2002:a05:600c:a08b:b0:431:5863:4240 with SMTP id 5b1f17b1804b1-436e26dda73mr234839235e9.24.1736964606030; Wed, 15 Jan 2025 10:10:06 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74ac712sm31122965e9.12.2025.01.15.10.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:05 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:03 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 30/48] acpi/ghes: better handle source_id and notification 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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab GHES has two fields that are stored on HEST error source blocks associated with notifications: - notification type, which is a number defined at the ACPI spec containing several arch-specific synchronous and assynchronous types; - source id, which is a HW/FW defined number, used to distinguish between different implemented sources. There could be several sources with the same notification type, which is dependent of the way each architecture maps notifications. Right now, build_ghes_v2() hardcodes a 1:1 mapping between such fields. Move it to two independent parameters, allowing the caller function to fill both. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: <133ff72ea1041fed7dbcf97b7a2b0f4dfacde31a.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 4a6c45bcb4..29cd7e4d81 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -284,9 +284,13 @@ static void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) } /* Build Generic Hardware Error Source version 2 (GHESv2) */ -static void build_ghes_v2(GArray *table_data, int source_id, BIOSLinker *linker) +static void build_ghes_v2(GArray *table_data, + BIOSLinker *linker, + enum AcpiGhesNotifyType notify, + uint16_t source_id) { uint64_t address_offset; + /* * Type: * Generic Hardware Error Source version 2(GHESv2 - Type 10) @@ -316,18 +320,8 @@ static void build_ghes_v2(GArray *table_data, int source_id, BIOSLinker *linker) address_offset + GAS_ADDR_OFFSET, sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, source_id * sizeof(uint64_t)); - switch (source_id) { - case ACPI_HEST_SRC_ID_SEA: - /* - * Notification Structure - * Now only enable ARMv8 SEA notification type - */ - build_ghes_hw_error_notification(table_data, ACPI_GHES_NOTIFY_SEA); - break; - default: - error_report("Not support this error source"); - abort(); - } + /* Notification Structure */ + build_ghes_hw_error_notification(table_data, notify); /* Error Status Block Length */ build_append_int_noprefix(table_data, ACPI_GHES_MAX_RAW_DATA_LENGTH, 4); @@ -369,7 +363,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, /* Error Source Count */ build_append_int_noprefix(table_data, ACPI_GHES_ERROR_SOURCE_COUNT, 4); - build_ghes_v2(table_data, ACPI_HEST_SRC_ID_SEA, linker); + build_ghes_v2(table_data, linker, + ACPI_GHES_NOTIFY_SEA, ACPI_HEST_SRC_ID_SEA); acpi_table_end(linker, &table); } From patchwork Wed Jan 15 18:10:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D2122C02180 for ; Wed, 15 Jan 2025 18:14:09 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rH-0001mk-C6; Wed, 15 Jan 2025 13:11:15 -0500 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 1tY7qP-0007cq-0y for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:23 -0500 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 1tY7qI-0006xI-3O for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964612; 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=8oi9KOXhifPD6YPugI1W0xaqab0w+uWNDdH+YVyo2Gs=; b=gVjaAdHgHmn2q8O/scAaitQnfkGp/CAv+fWWCeeahrJCjoeU+AUuVm9kTKyQDqws0ibkQs IZMT+i/3cklLMDed6exA902HVoqr7uqJTer+2MzetIjD/JvqFALZgnGbTxxVnl9NSBP3cs kFFWxMW1vKId+f+FQvj+CmB0uomNR2I= 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-500-pLIBgZOSNyytmsS-sjI28g-1; Wed, 15 Jan 2025 13:10:11 -0500 X-MC-Unique: pLIBgZOSNyytmsS-sjI28g-1 X-Mimecast-MFC-AGG-ID: pLIBgZOSNyytmsS-sjI28g Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-385d52591d6so39266f8f.1 for ; Wed, 15 Jan 2025 10:10:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964609; x=1737569409; 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=8oi9KOXhifPD6YPugI1W0xaqab0w+uWNDdH+YVyo2Gs=; b=lX/qsSkbN8h9fizyQVJH2bE/SR1rlR1kv9MvNWsV5tNWkSIugdk9E1M7YsyLJs3F93 274NA9yK7HSJtloV4eVwckBrhJyLLcA0qMpkvj9Jphkd4ylA1PUmzYwZCH2HQqNVVdiL NpVWYBQa8vOKUu84P03hZAMR5Udlfsd5oCLpLawU/dfcsEqCZMJYsnUseakToqq/Omgw D8wGiByn/b5zV7MylOkDKsniHbUkqYpOR2npN3qd6OgUBxVWt5lIblCArzXKyaQm5PEn +e3uv8F+WdpW6IdKLxzjZvQwH0+z6asNVc0H4kR6q0HKMIpmkDKk72MBFDbBGckOoEOW eIjw== X-Gm-Message-State: AOJu0Yxx+XK+6W7OPmCBEjkGgqu3LwPRGRJd9+8rPTCtt7plMUQNIN/B EJLuPq1IF/8C6UW7iaROQbRZ/VAFWNuuWZhDGd2nZkKK67+5r7UNreJ+X4ZHUHqeo4WedXtzoFl SpfmeBE8YAv9cuzswdn5OX6s8ArvgHyZmr4AoQm4N3v82ge4lzKv77TnezASrKPLTRvfboe5h0o 7+dr9vhaWfaocBCyKbbwaUvg38uKMh2g== X-Gm-Gg: ASbGnctMIZ+zZ5jVqYs5k7ZPqug2w3z3AC/CDPnpJziHOjFllQwa0Bv4EFgo0VaZM2S AzQ4sCXFdlbdBg7qcCtgtSnHD2vL6lbq5cpGKaFK/fOgaXzRG14cYVUe0ZLuDayLw/LN/4jO6MP wHI+IZQIwiARSgun3qF1vR7wNlDLcIh7ISigd3TVGJgcymi+nOxn3kRSXXp462bzJRZsFTG4bUv pkYf/ldfUcomwJ2ySP7w+7G6jAJewwG+lJwcZ52M2Uyk3bajQoD X-Received: by 2002:adf:b64f:0:b0:38a:a117:3db0 with SMTP id ffacd0b85a97d-38aa11740b8mr10363952f8f.3.1736964609413; Wed, 15 Jan 2025 10:10:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHtqidKngIe8ln12aOwRXhBjLzkqIkk0b2gJgADIc4ycOVYg4NPYZvuzVVWNne93XB3swaplg== X-Received: by 2002:adf:b64f:0:b0:38a:a117:3db0 with SMTP id ffacd0b85a97d-38aa11740b8mr10363924f8f.3.1736964609006; Wed, 15 Jan 2025 10:10:09 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c75298adsm31808245e9.30.2025.01.15.10.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:08 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:06 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 31/48] acpi/ghes: Fix acpi_ghes_record_errors() argument Message-ID: <5eb07a4ff067053b4d6bf55d2d614b65b00a476b.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Align the header file with the actual implementation of this function, as the first argument is source ID and not notification type. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 20016c226d..50e3a25ea3 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -73,7 +73,7 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); -int acpi_ghes_record_errors(uint8_t notify, uint64_t error_physical_addr); +int acpi_ghes_record_errors(uint8_t source_id, uint64_t error_physical_addr); /** * acpi_ghes_present: Report whether ACPI GHES table is present From patchwork Wed Jan 15 18:10:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940736 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9265C02180 for ; Wed, 15 Jan 2025 18:13:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rL-0002Rm-Da; Wed, 15 Jan 2025 13:11:19 -0500 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 1tY7qZ-0007p6-MP for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:34 -0500 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 1tY7qQ-0006yB-6Z for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964616; 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=nNCQTJMj4OnBLKxpitjAPWJHtAleMdi6j3FINftfiXk=; b=fxlwx77/0EZzMIszSx8Dkwltp/zyD8BADeXZ3D1Uy5ewIYglQeO169QRVWU4kKbF8pnAxY 73X8KJTPlI+7e3ON8TerVg3x89aA4d3kGJY6Lpiolmtb4cRBYdK9F/z58eeyvDGdDftz89 yLlj/+gBp7qsaBkPliHfPQdlEgVHnxU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-311-dcoULRrsOc69CWWAByR-Xw-1; Wed, 15 Jan 2025 13:10:15 -0500 X-MC-Unique: dcoULRrsOc69CWWAByR-Xw-1 X-Mimecast-MFC-AGG-ID: dcoULRrsOc69CWWAByR-Xw Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43619b135bcso37156285e9.1 for ; Wed, 15 Jan 2025 10:10:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964612; x=1737569412; 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=nNCQTJMj4OnBLKxpitjAPWJHtAleMdi6j3FINftfiXk=; b=JLRNU5v4PVKsI/d/WZQiNBxJGP70fEGE1jkLjAn7KAUWh0wpu8NMlj0klvHOPEhZzt JpBohTT0axFtn5+BL7vCZjfVe/9cQG2eS0LjeXt8LFFOW61/pg4Q3esPSmQnLx9+xAFI kmU7QsABXvKdno7EKeUs5YLV1SrOqKn7mJ3vsErRRwE1nbNIAIjNf17A65opEKUv6ksn CZLlo1+kJC0ovUS1vSqDMqYp9QE1udtwNQx0LEApsxOZC3BElcriTiQZnwTWg54Smmfs +u/RqpZQq8dq8isgI8hIpOiOUko7o3ArT5GnUm58RFWLfcTschAUzg1wVXJAtuQgN/bN 8EoQ== X-Gm-Message-State: AOJu0YwVZxeeXJWmZnjD+3XjWYB5+nYqspRdxczptu35+h+u+vaE8GXZ RsYi7Q5XCegO1RBlJ5OpziBnNCuIbIw7mzzVTlB8wS3liQ9ihQPJeYcAYOPQq/+4/ka2jLxTGLN zwMnoYxEHFe0RZQPyaQgwhXTNSiC1c1TPxgGCXy7AzEUVTemfrElgzT30p4DpBaE1OEd/BXSG3f W8X6YZSJTTZyRENi3bkCyhsQhePH8GXA== X-Gm-Gg: ASbGncvPg+kghvMxlNcSPybHnE3MiCLMyRbg5Sm4QZ72ZrtsOQY6tZ9EiRJ5qrP0jcY gSEo74uzTYR1V52B1Bnu7Ww6l9ffVmDDHylgg/Bqt6Uvds7F7mMWoOkqecN9xTveIDPMQNTZC5s sMvs1o9dwMtE25w50LobHEsg5Q4DUIuWbzhHv1V6XrUSE6osfO+MCfrsLcTbBmj1RAyfyfW4ih6 EQW9Su0mpoytUifW+qSXJ5BvDNAJFdPtKKn5I8kaFoYPC0W/PSR X-Received: by 2002:a05:600c:5848:b0:436:f3f6:9582 with SMTP id 5b1f17b1804b1-436f3f695dfmr167973665e9.8.1736964612487; Wed, 15 Jan 2025 10:10:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IFV46TI7HwfO5eWkYLJBkPwa/M9YdVixF6Y5Bp6YecEEoS2GtwDpfNkYNNnXrH6neGe9zA2VQ== X-Received: by 2002:a05:600c:5848:b0:436:f3f6:9582 with SMTP id 5b1f17b1804b1-436f3f695dfmr167973375e9.8.1736964612070; Wed, 15 Jan 2025 10:10:12 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7540ae7sm31006215e9.33.2025.01.15.10.10.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:11 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:09 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 32/48] acpi/ghes: Remove a duplicated out of bounds check Message-ID: <4ffedca347c458db17c464f9329222403fe54f22.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab acpi_ghes_record_errors() has an assert() at the beginning to ensure that source_id will be lower than ACPI_GHES_ERROR_SOURCE_COUNT. Remove a duplicated check. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 29cd7e4d81..5f67322bf0 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -404,9 +404,7 @@ int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) return -1; } - if (source_id < ACPI_GHES_ERROR_SOURCE_COUNT) { - start_addr += source_id * sizeof(uint64_t); - } + start_addr += source_id * sizeof(uint64_t); cpu_physical_memory_read(start_addr, &error_block_addr, sizeof(error_block_addr)); From patchwork Wed Jan 15 18:10:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7F8EEC02183 for ; Wed, 15 Jan 2025 18:19:12 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sA-0006TE-LH; Wed, 15 Jan 2025 13:12:10 -0500 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 1tY7qS-0007k2-CL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:28 -0500 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 1tY7qO-0006yc-Rp for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964618; 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=yBogc88mZ2zmIgkbCaN8F6OobF+5g446az5uTIFHM24=; b=PS6FmKQO/U4R3oqVVSFVO0nwsTlQgU/Y1p9KvcpG/XqHXgKRDqwz1x0/+Rs3Ol+xbevs2I 7Yl48zIZWOnF7haH/sOlbCcuuk1XULjw+jxm+Rtwoqdn/dG5Be8TtmDpKIsukd52Nqhl8C M/Ewz7rlxDyFpshfbCWs3BDe+fcv9/s= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-347-NMB2QlM8OUqfBAIPKtMJNQ-1; Wed, 15 Jan 2025 13:10:17 -0500 X-MC-Unique: NMB2QlM8OUqfBAIPKtMJNQ-1 X-Mimecast-MFC-AGG-ID: NMB2QlM8OUqfBAIPKtMJNQ Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43582d49dacso47640205e9.2 for ; Wed, 15 Jan 2025 10:10:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964615; x=1737569415; 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=yBogc88mZ2zmIgkbCaN8F6OobF+5g446az5uTIFHM24=; b=BEp0FMUg/qq8GqJCJeDv82aTXoyKZ4jdOqo4scSA0L5KOTnwWaGt27Cwe++6JCBb2t uudAu1yJXZUcJMZjQG1MTb5rfU+33JYMwQwvRSvmdBO5jQu3Nk9YUfnVwdCTJHjrAYkM KxM50XiuWU8CzHrEKoSBS59K8GC/IkrkXOYg935xKPQ7qv3sLj9dm2R9aFODuH/vwp68 n+DzlqQOpIfD164PPF/Y1m/34+3XaxuzU2sK691f0LbIIh/jKvSXQPWDs3qPNySOqj+t 4A46KlNutf/T70JO1xifrTZEfNw6kab+Lp3JCEzejAAUOLwgPP5dWQrOwCP5X5NK8Prd TAPg== X-Gm-Message-State: AOJu0YzhJwQi0NqrGcj6+0marCEw/ZxQtw2DbVWqzQRvSvBw9KdtS7Dg RIUjHGf1GeQbfTLB10UGRGtjcr6z/TIhqH9WY12DERKoN5gXYgs55r7z60DKVd+UGAG42flkqzx QrBXFg7TqbuYxhggQK6xvRcOTOLbv8elRmccJp8YAHXvyz8DcTOs1iGiC6QsahWCsbVrJl530xJ 7tA3T2X3eUl//b76dK63B73p2yz3GKiA== X-Gm-Gg: ASbGncvrs/vVyp+asLTgP2i3gA6M97pGZWP7qijFUp5cybIvYSLjSkeXCcHX040tchh nbupU19S8iOVpGFxNsIsK7yvJmF2S22E44Cl9n2noridDZbnjxTSQThdUkoPX9eqF5VEw+XngDA N+q4Xy+ZGvdaByEXjnFkwZaDWaG/D1YPz5vTRsJEWHIRmEdZy9GHZJu571pe/+qaoU5Tyn+jEif 48jUDQFV/b43ajSb2OOfpDTfCF/SLNw129ZDqGwL8IWYciX2ael X-Received: by 2002:a05:600c:3152:b0:434:f9e1:5cf8 with SMTP id 5b1f17b1804b1-436e271d3a2mr285758435e9.31.1736964615574; Wed, 15 Jan 2025 10:10:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWm1BVn50OC0S8qoOqMg4lRNsnAniYWag6+4dOCwaTYJ+k0G60RC1MyLCEdpiw7oa4N0IikQ== X-Received: by 2002:a05:600c:3152:b0:434:f9e1:5cf8 with SMTP id 5b1f17b1804b1-436e271d3a2mr285758015e9.31.1736964615171; Wed, 15 Jan 2025 10:10:15 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c753cc1fsm32024325e9.39.2025.01.15.10.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:14 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:12 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 33/48] acpi/ghes: Change the type for source_id Message-ID: <26e0893e420b34677e6e904a06edf55331bd937c.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab As described at: ACPI 6.5 spec at: 18.3.2. ACPI Error Source In particular at GHES/GHESv2 table: Table 18.10 Generic Hardware Error Source Structure HEST source ID is actually a 16-bit value. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: <0e83ba548c1aedd1299fe387b94db78986590a34.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 2 +- hw/acpi/ghes-stub.c | 2 +- hw/acpi/ghes.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 50e3a25ea3..9295e46be2 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -73,7 +73,7 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); -int acpi_ghes_record_errors(uint8_t source_id, uint64_t error_physical_addr); +int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_addr); /** * acpi_ghes_present: Report whether ACPI GHES table is present diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index c315de1802..2b64cbd281 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" -int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) { return -1; } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 5f67322bf0..edc74c38bf 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -383,7 +383,7 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, ags->present = true; } -int acpi_ghes_record_errors(uint8_t source_id, uint64_t physical_address) +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) { uint64_t error_block_addr, read_ack_register_addr, read_ack_register = 0; uint64_t start_addr; From patchwork Wed Jan 15 18:10:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940735 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A83D5C02180 for ; Wed, 15 Jan 2025 18:12:57 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rx-00052P-C1; Wed, 15 Jan 2025 13:11:57 -0500 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 1tY7qk-0008Cl-62 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:44 -0500 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 1tY7qf-0006zn-Gl for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964623; 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=GcEA8Xia0/aKbFvQOw0Cn9Z1faY/ZlIm/oUS1p8/iH0=; b=E4mZAvDZmk/slF35G2C3DZ8AduaZ0g9QwloCZO8gzmNtmlpQh6B8r84fHCkJDnx9f12b7h /iRFswK+853qbjjzudv7oeqnWcTiopXHH+lne2C8ddQ5Fd60q3rpHaWDaz/r9YbNyP5cvj uZsqufYTdQrqXLoPuEcgKju7Hu5KNc4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-IdHsjRuxNFOaLPE0PTeB2w-1; Wed, 15 Jan 2025 13:10:20 -0500 X-MC-Unique: IdHsjRuxNFOaLPE0PTeB2w-1 X-Mimecast-MFC-AGG-ID: IdHsjRuxNFOaLPE0PTeB2w Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361efc9d1fso55877905e9.2 for ; Wed, 15 Jan 2025 10:10:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964619; x=1737569419; 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=GcEA8Xia0/aKbFvQOw0Cn9Z1faY/ZlIm/oUS1p8/iH0=; b=C5LWh/J8YBRoQamu35WvyfrL4Ye/2PNThDerjnGgEkRBeCC8UyJ4YlG0ksmD+buQRz BqH+Zb9HJKUbTisL+sYR63sAb4jalD47mIwjuAJEsVmlq4odc4EBGTo7NRkmy/TsRlQ+ 6qSnrYyk7uiozj3/l/Oe4pTpR55LUIboz/TP/mL/57gBKckZAxyrYrqbe5ojIchJWCnu RVHzpWe2FMkMfTbcfh2kAenpPrlqT51fz0TBMByB01tXM4XQQiIJ0gx9/WIZPyaudZoW M9bVDRhtRt4sLZhy9P0pVl8Fu1tmn7Af87F/g4FFnW89RkP8zhbsNdN3tH9jtivdpmzi 8wbA== X-Gm-Message-State: AOJu0YyLVCXoN4++3Qfc08F5XEM8EFWKUKhGT5AR4/O05+/yqhomA+GD qQKMo5pw5AxUmZPZZtakp2mBPKSU86t4reu2sQCEUYvO4xTUscVhEkjlVTlKoMT1HNjVSjyk6E0 v2EGW5YX3ZaNKstPk5Zty5+DQkBg5ahZlYXgcvHXypSXR1F2xVTha2GBseGv26I0wkwHuthDIb3 I2WSA/96ZU5sVtOiiGn1t0D87gtz9qgg== X-Gm-Gg: ASbGnctHwP2/LYkAjbtNduyIO2CIFz1HMH4hQm0xYc2ISk7yDnh9/k6C/PN+rJbgVXM C01ACb4o+H+hjxoV7FCDrz+XAPOXtFkTW+BbMyX13XhrseS1N+18klcDkQahYE4J1FWKccrozxA HYfut+ilXWd4LGLOdMLm5M8Cz/EAIqNfvydtljzwjLAtsdrSkxFJ8h95ir6n7pmIiHWZTK7c23h Duyv4qZ41JYL8dArhMw/m4wEa998+OmPCBEkRP6hVPibw3nXoh9 X-Received: by 2002:a05:600c:3b0c:b0:434:f7e3:bfa0 with SMTP id 5b1f17b1804b1-436e26e2593mr233770885e9.21.1736964618911; Wed, 15 Jan 2025 10:10:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGP/afa4m7Fa8Xk3Et61DA9Qzhp3PfZtVxEZkeh1+fEfOJSbB8lHNgqS0aepmMaknXAFp/kuQ== X-Received: by 2002:a05:600c:3b0c:b0:434:f7e3:bfa0 with SMTP id 5b1f17b1804b1-436e26e2593mr233770635e9.21.1736964618431; Wed, 15 Jan 2025 10:10:18 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7525ee9sm31012265e9.32.2025.01.15.10.10.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:17 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:15 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 34/48] acpi/ghes: don't check if physical_address is not zero Message-ID: <2e223c5ec1146b61163d3372ac629d9240d57cb1.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab The 'physical_address' value is a faulty page. As such, 0 is as valid as any other value. Suggested-by: Igor Mammedov Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index edc74c38bf..a3dffd78b0 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -400,10 +400,6 @@ int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) start_addr = le64_to_cpu(ags->ghes_addr_le); - if (!physical_address) { - return -1; - } - start_addr += source_id * sizeof(uint64_t); cpu_physical_memory_read(start_addr, &error_block_addr, From patchwork Wed Jan 15 18:10:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 350CCC02180 for ; Wed, 15 Jan 2025 18:16:22 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rq-0004G3-4c; Wed, 15 Jan 2025 13:11:50 -0500 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 1tY7qk-0008Cm-68 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:44 -0500 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 1tY7qd-00070L-3X for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964625; 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=xBNsFrSHC6tZPAuv4tMyzabgeu+qdwUQ6rMhb6UnyS0=; b=hIAar0UngPr6qNYQ6BvcyTyIMpDubAt4mHviEOJXDDwCqZDUmox6NNMC/PGkaEryXW4YDy X3bREEkBZ3JIb2wn0nqdyjszKsjU1a/doQOQbHDpIlJyC6jBBmzhvAZ1ROHglP3Fpfzj0c Y3CqAvtPEoYxRgNF3svYkRlF5HNlgvI= 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-258-jUYAKHXpMnG7UFpRwRdj2A-1; Wed, 15 Jan 2025 13:10:23 -0500 X-MC-Unique: jUYAKHXpMnG7UFpRwRdj2A-1 X-Mimecast-MFC-AGG-ID: jUYAKHXpMnG7UFpRwRdj2A Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-385e27c5949so47677f8f.3 for ; Wed, 15 Jan 2025 10:10:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964622; x=1737569422; 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=xBNsFrSHC6tZPAuv4tMyzabgeu+qdwUQ6rMhb6UnyS0=; b=O/0WJBu7+p7kRCeR9dkO8LVGPDZPtl02GnlR7qB2JsfJ9X2cKLcgaMb1yl1+uDTX2P FnUMyoSmCMOKS2inx6c23tNyM/5A6Ct9Ri0KjrWiOhrNOisoDPC7Ee1mRutZZ2mnhbOI VquFiZ3cnvUMJVnnmMyVRDQREa9+7dS8ws6mSSjrtY84/iTRRGvFSsFPlQYhxaGFfsrp pI8asEC7eaiXPvIu2vaHV7L+WFMCk+6wqzjjYv6VD7slGJ28aqvcSfYKhHvHKJmV/oXT 3+yhudCgc6liW3y7Yu3EmyVS58RRuXxSFyT8VMXrlnGRXoaKKx+EAsE62y/X9bvPAjWz zn9w== X-Gm-Message-State: AOJu0YwaJw5wKVwnb0dGVAu1X0rB7nKg3IXCQCoQyqPwXc2/1LeG/IPh HdwJVAr6sDsvFeRhgBM4CUAx4BIbhyRmdA/k3bAs5qccef0lSGlfVKYp8MyYNT0dMaRgZVWVAVe MQKYy+pyjDsXc1VPSSQAspG+zm8eoOTO7em7B/hcyVzmqsksGmGbZJ+pZW7cOSUE+Gbe+buIgL+ /YrDj2JHKvPAWY5e7Ld+dtt1Kzdwf7FA== X-Gm-Gg: ASbGncuavWc6NanHLENs2IzG+G1Krby3Nxl/XREyFlRI4lWApP8dlb5PNDvqoE77Y77 S5/TzlFvjHUiquTvNo7bioGOW9X3pwaNjSTJ8ijXdZ3uUADmR++GWifsisH0rjKkTMUA9FrpIm3 dbFhU2m8WI+7Td6Bgq+Y1kGjfmBCXOsqGs/tYZyOTb/kFISp2lKWcUQNaNAa4aVgytukMQS0lVo xbBLP22Hw1GAPEz0RmFdhICB74H6IVW8XhmON9zENeUwID7b3fd X-Received: by 2002:a05:6000:4711:b0:386:2d40:a192 with SMTP id ffacd0b85a97d-38a872f51ffmr26463434f8f.34.1736964621887; Wed, 15 Jan 2025 10:10:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBVse3uqaKx3xSu0Z4rCYVL63Yjv/bwvuuFaphmlaODUpu2hZifV4n67QCaYCuaCSyTfa77A== X-Received: by 2002:a05:6000:4711:b0:386:2d40:a192 with SMTP id ffacd0b85a97d-38a872f51ffmr26463408f8f.34.1736964621434; Wed, 15 Jan 2025 10:10:21 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74ace90sm32150395e9.16.2025.01.15.10.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:20 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:18 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Dongjiu Geng , Ani Sinha , qemu-arm@nongnu.org Subject: [PULL 35/48] acpi/ghes: make the GHES record generation more generic Message-ID: <48b0dcdd67d3fafbd07f6298257259dec4f541ce.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Split the code into separate functions to allow using the common CPER filling code by different error sources. The generic code was moved to ghes_record_cper_errors(), and ghes_gen_err_data_uncorrectable_recoverable() now contains only a logic to fill the Generic Error Data part of the record, as described at: ACPI 6.2: 18.3.2.7.1 Generic Error Data The remaining code to generate a memory error now belongs to acpi_ghes_record_errors() function. A further patch will give it a better name. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: <68d9f787d8c4fc8d1dbc227d6902fe801e42dea9.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 3 ++ hw/acpi/ghes.c | 120 +++++++++++++++++++++++------------------ 2 files changed, 72 insertions(+), 51 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 9295e46be2..8859346af5 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -23,6 +23,7 @@ #define ACPI_GHES_H #include "hw/acpi/bios-linker-loader.h" +#include "qapi/error.h" /* * Values for Hardware Error Notification Type field @@ -73,6 +74,8 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); +void ghes_record_cper_errors(const void *cper, size_t len, + uint16_t source_id, Error **errp); int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_addr); /** diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index a3dffd78b0..6f40cd35a9 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -181,51 +181,24 @@ static void acpi_ghes_build_append_mem_cper(GArray *table, build_append_int_noprefix(table, 0, 7); } -static int acpi_ghes_record_mem_error(uint64_t error_block_address, - uint64_t error_physical_addr) +static void +ghes_gen_err_data_uncorrectable_recoverable(GArray *block, + const uint8_t *section_type, + int data_length) { - GArray *block; - - /* Memory Error Section Type */ - const uint8_t uefi_cper_mem_sec[] = - UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \ - 0xED, 0x7C, 0x83, 0xB1); - /* invalid fru id: ACPI 4.0: 17.3.2.6.1 Generic Error Data, * Table 17-13 Generic Error Data Entry */ QemuUUID fru_id = {}; - uint32_t data_length; - - block = g_array_new(false, true /* clear */, 1); - - /* This is the length if adding a new generic error data entry*/ - data_length = ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; - /* - * It should not run out of the preallocated memory if adding a new generic - * error data entry - */ - assert((data_length + ACPI_GHES_GESB_SIZE) <= - ACPI_GHES_MAX_RAW_DATA_LENGTH); /* Build the new generic error status block header */ acpi_ghes_generic_error_status(block, ACPI_GEBS_UNCORRECTABLE, 0, 0, data_length, ACPI_CPER_SEV_RECOVERABLE); /* Build this new generic error data entry header */ - acpi_ghes_generic_error_data(block, uefi_cper_mem_sec, + acpi_ghes_generic_error_data(block, section_type, ACPI_CPER_SEV_RECOVERABLE, 0, 0, ACPI_GHES_MEM_CPER_LENGTH, fru_id, 0); - - /* Build the memory section CPER for above new generic error data entry */ - acpi_ghes_build_append_mem_cper(block, error_physical_addr); - - /* Write the generic error data entry into guest memory */ - cpu_physical_memory_write(error_block_address, block->data, block->len); - - g_array_free(block, true); - - return 0; } /* @@ -383,15 +356,18 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, ags->present = true; } -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +void ghes_record_cper_errors(const void *cper, size_t len, + uint16_t source_id, Error **errp) { uint64_t error_block_addr, read_ack_register_addr, read_ack_register = 0; uint64_t start_addr; - bool ret = -1; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; - assert(source_id < ACPI_GHES_ERROR_SOURCE_COUNT); + if (len > ACPI_GHES_MAX_RAW_DATA_LENGTH) { + error_setg(errp, "GHES CPER record is too big: %zd", len); + return; + } acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); @@ -406,6 +382,10 @@ int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) sizeof(error_block_addr)); error_block_addr = le64_to_cpu(error_block_addr); + if (!error_block_addr) { + error_setg(errp, "can not find Generic Error Status Block"); + return; + } read_ack_register_addr = start_addr + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); @@ -415,24 +395,62 @@ int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) /* zero means OSPM does not acknowledge the error */ if (!read_ack_register) { - error_report("OSPM does not acknowledge previous error," - " so can not record CPER for current error anymore"); - } else if (error_block_addr) { - read_ack_register = cpu_to_le64(0); - /* - * Clear the Read Ack Register, OSPM will write it to 1 when - * it acknowledges this error. - */ - cpu_physical_memory_write(read_ack_register_addr, - &read_ack_register, sizeof(uint64_t)); - - ret = acpi_ghes_record_mem_error(error_block_addr, - physical_address); - } else { - error_report("can not find Generic Error Status Block"); + error_setg(errp, + "OSPM does not acknowledge previous error," + " so can not record CPER for current error anymore"); + return; } - return ret; + read_ack_register = cpu_to_le64(0); + /* + * Clear the Read Ack Register, OSPM will write 1 to this register when + * it acknowledges the error. + */ + cpu_physical_memory_write(read_ack_register_addr, + &read_ack_register, sizeof(uint64_t)); + + /* Write the generic error data entry into guest memory */ + cpu_physical_memory_write(error_block_addr, cper, len); + + return; +} + +int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +{ + /* Memory Error Section Type */ + const uint8_t guid[] = + UUID_LE(0xA5BC1114, 0x6F64, 0x4EDE, 0xB8, 0x63, 0x3E, 0x83, \ + 0xED, 0x7C, 0x83, 0xB1); + Error *errp = NULL; + int data_length; + GArray *block; + + block = g_array_new(false, true /* clear */, 1); + + data_length = ACPI_GHES_DATA_LENGTH + ACPI_GHES_MEM_CPER_LENGTH; + /* + * It should not run out of the preallocated memory if adding a new generic + * error data entry + */ + assert((data_length + ACPI_GHES_GESB_SIZE) <= + ACPI_GHES_MAX_RAW_DATA_LENGTH); + + ghes_gen_err_data_uncorrectable_recoverable(block, guid, data_length); + + /* Build the memory section CPER for above new generic error data entry */ + acpi_ghes_build_append_mem_cper(block, physical_address); + + /* Report the error */ + ghes_record_cper_errors(block->data, block->len, source_id, &errp); + + g_array_free(block, true); + + if (errp) { + error_report_err(errp); + return -1; + } + + return 0; } bool acpi_ghes_present(void) From patchwork Wed Jan 15 18:10:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30071C02185 for ; Wed, 15 Jan 2025 18:17:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7rt-0004gC-Tr; Wed, 15 Jan 2025 13:11:54 -0500 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 1tY7qj-00089d-5O for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:43 -0500 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 1tY7qZ-00070Z-SL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964627; 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=W72gn/X43iSEWHwc8vF+OcjzKNW4pEeZuQNi+6C4SJg=; b=LWZCVM707lD9aBgpGcPXKiPprgHEg6lDMSPEzWOTNrJkhacS/LsAUO/RcClfi2kOxvuPyi LCq6CC18GSCDT565+Rry8+4n/4D26ZPtGJ4ld0tvbrYbgOZKHreZbUGld6PjDPf/GSDqHu XFs8TA30n7vcoWqO/AUytzM40jaVLsI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-611-WiVeAr8iONyLPbcZjk4b7g-1; Wed, 15 Jan 2025 13:10:26 -0500 X-MC-Unique: WiVeAr8iONyLPbcZjk4b7g-1 X-Mimecast-MFC-AGG-ID: WiVeAr8iONyLPbcZjk4b7g Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43621907030so32477615e9.1 for ; Wed, 15 Jan 2025 10:10:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964625; x=1737569425; 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=W72gn/X43iSEWHwc8vF+OcjzKNW4pEeZuQNi+6C4SJg=; b=CVqB66lE05ZCMbpO2aoMse7VSEKi4+vZp2cA7YOGGtkQ8ZWj5p67Ie5SFJfSk50s3D XLof3lZfWek+Xh/AfATEeYN6IythaQQI+FcgAriF1sKgGyTFoQtZzcvcfVmoJCnWKHI0 xx2vli1G1vHD9ROUOJvcj+9gmYcpGk9Js//mKRQoRUPrQWP9VTeeaLYIkUQFxd7HkOaq qrgAsuOCHRinbAZdUJOGBbwEp2yIn2/12HFbl08VTN4m9tLqT+cuaC2yckCZouYoWu/3 C4g3r8wlLVEOJO/gWT5ACXKQ4hdxYcA7mFkdWXIKXbDTB+CoOJ7zRoc0GQMlDrOjnaQ4 2PxQ== X-Gm-Message-State: AOJu0YyV+qlYZmz5QD1KS6ZEt+ceatRS6YJvKxtbhgCF0bUWCWIliUeU /uataEcWWo3q2EPbBlHwZNSuBzCjXnPBZvVefc+hXiv4MPVelive8e0OrKP+cb5/B0T5Sfi7ApM OF38I1eIOqxGFGJJgoNpLJPH2tmkxdWAPWcPIvU8WfCBPSNWSeAA1A1h3dkZRsQ4KarjYoVTOsV taI+pBE+5aiNaXolpFFLlhuoI3HH9knQ== X-Gm-Gg: ASbGncusRh8omjOSfu8UJGTT8pGlyHssKt2dbHI1sW/auFzP9NvqGuttgFFCiMvgg5m D0Xm0zQ0VX/iLS7M1kOI2Ji2S+igYExLZLIbc/WS0OChKQjgoJWlXQfgL+9wUiqs5+DrEr/nZbI eQVRrMcKaHiiSivzz6fkJ2zvc1aG2eO0KPmPEKG2yn98tfxee4TtXMD3PRB1O/33PJp+KCDN5Q9 tmz+2yvQXeEgxF+YT6mKB6dyKevNvfLPrUaMIJZsIfl1D8xzw+f X-Received: by 2002:a05:600c:4586:b0:434:f817:4492 with SMTP id 5b1f17b1804b1-436e26f47f9mr300718145e9.31.1736964625163; Wed, 15 Jan 2025 10:10:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQBbQ/ucVqe/1aRLFuXcnKDdErlW+RXJrbuNeDn0+FcDJpY3P4Ms2jbcdoT38rACpbOJjs1A== X-Received: by 2002:a05:600c:4586:b0:434:f817:4492 with SMTP id 5b1f17b1804b1-436e26f47f9mr300717745e9.31.1736964624696; Wed, 15 Jan 2025 10:10:24 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38bf78sm18082767f8f.48.2025.01.15.10.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:23 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:21 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Ani Sinha , Dongjiu Geng , Paolo Bonzini , qemu-arm@nongnu.org, kvm@vger.kernel.org Subject: [PULL 36/48] acpi/ghes: better name GHES memory error 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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab The current function used to generate GHES data is specific for memory errors. Give a better name for it, as we now have a generic function as well. Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab Message-Id: <35b59121129d5e99cb5062cc3d775594bbb0905b.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 4 ++-- hw/acpi/ghes-stub.c | 2 +- hw/acpi/ghes.c | 2 +- target/arm/kvm.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 8859346af5..21666a4bcc 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -74,15 +74,15 @@ void acpi_build_hest(GArray *table_data, GArray *hardware_errors, const char *oem_id, const char *oem_table_id); void acpi_ghes_add_fw_cfg(AcpiGhesState *vms, FWCfgState *s, GArray *hardware_errors); +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t error_physical_addr); void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp); -int acpi_ghes_record_errors(uint16_t source_id, uint64_t error_physical_addr); /** * acpi_ghes_present: Report whether ACPI GHES table is present * * Returns: true if the system has an ACPI GHES table and it is - * safe to call acpi_ghes_record_errors() to record a memory error. + * safe to call acpi_ghes_memory_errors() to record a memory error. */ bool acpi_ghes_present(void); #endif diff --git a/hw/acpi/ghes-stub.c b/hw/acpi/ghes-stub.c index 2b64cbd281..7cec1812da 100644 --- a/hw/acpi/ghes-stub.c +++ b/hw/acpi/ghes-stub.c @@ -11,7 +11,7 @@ #include "qemu/osdep.h" #include "hw/acpi/ghes.h" -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t physical_address) { return -1; } diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 6f40cd35a9..66bd98337a 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -415,7 +415,7 @@ void ghes_record_cper_errors(const void *cper, size_t len, return; } -int acpi_ghes_record_errors(uint16_t source_id, uint64_t physical_address) +int acpi_ghes_memory_errors(uint16_t source_id, uint64_t physical_address) { /* Memory Error Section Type */ const uint8_t guid[] = diff --git a/target/arm/kvm.c b/target/arm/kvm.c index a9444a2c7a..da30bdbb23 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2387,7 +2387,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, void *addr) */ if (code == BUS_MCEERR_AR) { kvm_cpu_synchronize_state(c); - if (!acpi_ghes_record_errors(ACPI_HEST_SRC_ID_SEA, paddr)) { + if (!acpi_ghes_memory_errors(ACPI_HEST_SRC_ID_SEA, paddr)) { kvm_inject_arm_sea(c); } else { error_report("failed to record the error"); From patchwork Wed Jan 15 18:10:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E30C1C02183 for ; Wed, 15 Jan 2025 18:18:32 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sG-0006ux-7p; Wed, 15 Jan 2025 13:12:16 -0500 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 1tY7qq-0008Mr-S8 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:49 -0500 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 1tY7qk-00071A-6e for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964631; 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=Kii3OpRcU1wXLSEo03c2NmodU8Ev9h2TzMQ/hu40ANk=; b=JUXbjippCt/gThnTDjzwH12y5kFD1YaJPsbkiZ1lT/POMa0mS4ZA7Yizl7669h+3o00fHl P9N4pqIiLTE5IzSsucQS57p48StitqIYrjHvLony+xYuJtH4kfIqKMr8eKiooMur05VT+L tqxka1QP5NsDAIUz9BHrhh9oLfp06eY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-661-0L1rlHR6MLy--4TyZ2VCiA-1; Wed, 15 Jan 2025 13:10:30 -0500 X-MC-Unique: 0L1rlHR6MLy--4TyZ2VCiA-1 X-Mimecast-MFC-AGG-ID: 0L1rlHR6MLy--4TyZ2VCiA Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436289a570eso1165e9.0 for ; Wed, 15 Jan 2025 10:10:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964628; x=1737569428; 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=Kii3OpRcU1wXLSEo03c2NmodU8Ev9h2TzMQ/hu40ANk=; b=WCoVr+DT0niUzynpe88AgfFDfD9sjOy4SVszxE8i7LEN2zoojLy/lOtJ86YHwBeYjR hQ9PU7qfUtXg+jiMGXSyE0o8n3N5ebRnXPTm4PLEUG9MFGKkwklNXv4o6wcefkJx70cv hqfo2GFOBScVDu7wCnQUZj93wnBBgrX1xY4mzQt6w6yN2gFB7Pay0aCFD5VyS86MUYf8 9XkPhIVelWLMGH6FkysaA7KNFlD8/v7VLKyoBm2Bc8jYTXed/SwbNPnp2gE6/r509pR4 Mg1LeArN9ycRiVfjshG6fk0ODKOnQyV0USTU4Ck6Ya+DN6e+AV82Id7Y2/RDDjQMFMY5 paxg== X-Gm-Message-State: AOJu0YzPtLjszgtChERg6+VmJkmqFoI84BF85ueYvW23SBbPwVoxzbS9 yy7gwjYIeqdizgdPBrLI7jd7OXJQdEvc1ZsM1hpiR0xdepJCbDi0eWcKqNOegEQ3Kjs7BubOR5W AZyK5IWJ/pJYX0Pa/84a2KmZiRmICym9+I8lEyk+qhFtaNK0TGGgLT9Ez+1ziOHSnCLHA3XWhF5 o+ME/3otU7DUZWYAwzKBEdBDQjnqu5Sg== X-Gm-Gg: ASbGncsmzZKKN2cStR88S4lzzsVkWYQOPSmrHH/f6kRrSWNBg6bbv7ZnOJ5CZ3S7DD8 cdBFBQxhKFi7pquey8cvMcz1aTHC59CRUk0n9SuOUIvDet96b7VQhGgwzZvW4GEQotYjmf2FwIj 14LcfcW3KdZDixpSDEwUD4WnI09CnSYe0Zazj53Rm0I4OwSAscwDgxhtmJfBb2QEgsljfCQoNqA TYOq/Oe/A2DvdlN8ofhU2TBQ7Lz3GD1pzMcycopiWz21KGGMv2z X-Received: by 2002:a05:600c:54c5:b0:431:557e:b40c with SMTP id 5b1f17b1804b1-436e3fb231cmr256182615e9.27.1736964628371; Wed, 15 Jan 2025 10:10:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IFolWjDnyXe8Fyrvz0sfvcFYWUBgkNh9x94PI6ctfbfKCQhoGNAo4PAm+DW2CNNLzrfvK4YFQ== X-Received: by 2002:a05:600c:54c5:b0:431:557e:b40c with SMTP id 5b1f17b1804b1-436e3fb231cmr256182335e9.27.1736964627999; Wed, 15 Jan 2025 10:10:27 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c1664e8dsm43324755e9.1.2025.01.15.10.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:27 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:25 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 37/48] acpi/ghes: don't crash QEMU if ghes GED is not found Message-ID: <1acc8d4e647e3d9fc45cc43c216e784e47a74809.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Make error handling within ghes_record_cper_errors() consistent, i.e. instead abort just print a error in case ghes GED is not found. Reviewed-by: Jonathan Cameron Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 66bd98337a..6843ddf64b 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -371,7 +371,10 @@ void ghes_record_cper_errors(const void *cper, size_t len, acpi_ged_state = ACPI_GED(object_resolve_path_type("", TYPE_ACPI_GED, NULL)); - g_assert(acpi_ged_state); + if (!acpi_ged_state) { + error_setg(errp, "Can't find ACPI_GED object"); + return; + } ags = &acpi_ged_state->ghes_state; start_addr = le64_to_cpu(ags->ghes_addr_le); From patchwork Wed Jan 15 18:10:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940766 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DC21C02185 for ; Wed, 15 Jan 2025 18:19:04 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sD-0006gX-I8; Wed, 15 Jan 2025 13:12:13 -0500 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 1tY7qk-0008Da-92 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:44 -0500 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 1tY7qe-00071W-G7 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964634; 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=K7TcV59XEakRMbH2rRFcP0+60inS50NTD8WhVaPlkoo=; b=UTPkIkWHmy1RuUjdb41yztyABPwNeDFKtrCC6j3djj4IGwUSzfkUxONN8t7o6/FFsrQkqW i9IZkb1xX/0ueWN6vgjGIWpCJtDHPPJ9er4xRxAESRcC28KgG4yMdTbVzN2fZpb3qZVtb1 OL519Siqe6j4m/smG0Yaww9A6ronGfg= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-410-xjk6DicCPH2v6Bl1NpiRXg-1; Wed, 15 Jan 2025 13:10:33 -0500 X-MC-Unique: xjk6DicCPH2v6Bl1NpiRXg-1 X-Mimecast-MFC-AGG-ID: xjk6DicCPH2v6Bl1NpiRXg Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-436248d1240so33485325e9.0 for ; Wed, 15 Jan 2025 10:10:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964632; x=1737569432; 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=K7TcV59XEakRMbH2rRFcP0+60inS50NTD8WhVaPlkoo=; b=ZY7HG6u5RCuf63h+8bOlOyviXuNW2sdariiFeGQZ3iEuXoXCm1MGULMSRsrvpkgjoV cgSJEcoYnb+DJIBqC05jPLTWX7PBg9djsJzH4Q8glAzwAIrPxELPz7LNg+0KbXPasZFt ir4F90CWPNQ+2DGQ8Sv5o/1zoUpYsqCSwbrhHiEeuospkAqHTnyCvevGl9zAZODNH2mW SfCmvX4AgGYD4g5Vz5t7zMZQlXdUUXUIF4ykGhbiz6TmyWnRvGOcGznIfkbYmezbwqvC VR7ZxjLms9lya2+OZQmUJU5nPuNyyAGb2q8lz1OObKEZWc4ncmQritSf/iQOYDC+1BVT 5dKA== X-Gm-Message-State: AOJu0Yzbxug3DWLbfRu2NbEmM+yXdE4hYtfJYShwqez2dpFYjbrlrX9D 40Elzs52tmZQoCHQQBGFF4Ty3db+QSG87sQg1bJyNvZLGThtU9jHL+fnfAbVdcDJJwdLg+cgPyY KEidxXWgPYCOGZ/ZI+M1HUNNYLun50vPXrhlm5saBzPEco+FYqHfXuDZUz+Qu5pdRjUUEZPesGn 48Eo7jIksEMOWjffYDItXkMdOEMolODg== X-Gm-Gg: ASbGncvct5wZCHjTQ5MjAhDBZhmJ3TEQOyL/fW92Fn6j52OZLDUN9b5YUEzK+2orKj6 VUrxKf+DzMkxwOGJD5/gkJJgiKtJGb9yZolLckQcoQkMZyd9PSYQOiRb8kTE2qnBWbztL3hivbe KaZpKDWuJO4rCE3EAQl99tuialjRNzt6BIDgAKIItvnEYRNMHP/EunNGhOo0RusM9euzRWYEFWK l41vHCPTIs4h9+Rqoipsr3n8oXZ+hKycPmiSzZfbW1DQStiwmcU X-Received: by 2002:a5d:648b:0:b0:386:3e3c:ef1 with SMTP id ffacd0b85a97d-38a87312f36mr31933166f8f.35.1736964631656; Wed, 15 Jan 2025 10:10:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNYU9px69Bwn08aZIGn0EytgOIafkkuOs8HWJXp+4oMtAMZEors+fyzPmSAy8IPJFIPV6aiw== X-Received: by 2002:a5d:648b:0:b0:386:3e3c:ef1 with SMTP id ffacd0b85a97d-38a87312f36mr31933127f8f.35.1736964631210; Wed, 15 Jan 2025 10:10:31 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d2f5sm18409210f8f.17.2025.01.15.10.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:30 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Igor Mammedov , Jonathan Cameron , Dongjiu Geng , Ani Sinha , qemu-arm@nongnu.org Subject: [PULL 38/48] acpi/ghes: rename etc/hardware_error file macros Message-ID: <4651745dfc8d384bd260969c23d8423741462eac.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Now that we have also have a file to store HEST data location, which is part of GHES, better name the file where CPER records are stored. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Igor Mammedov Reviewed-by: Jonathan Cameron Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 6843ddf64b..3f94a5542b 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -28,8 +28,8 @@ #include "hw/nvram/fw_cfg.h" #include "qemu/uuid.h" -#define ACPI_GHES_ERRORS_FW_CFG_FILE "etc/hardware_errors" -#define ACPI_GHES_DATA_ADDR_FW_CFG_FILE "etc/hardware_errors_addr" +#define ACPI_HW_ERROR_FW_CFG_FILE "etc/hardware_errors" +#define ACPI_HW_ERROR_ADDR_FW_CFG_FILE "etc/hardware_errors_addr" /* The max size in bytes for one error block */ #define ACPI_GHES_MAX_RAW_DATA_LENGTH (1 * KiB) @@ -234,7 +234,7 @@ static void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) ACPI_GHES_MAX_RAW_DATA_LENGTH * ACPI_GHES_ERROR_SOURCE_COUNT); /* Tell guest firmware to place hardware_errors blob into RAM */ - bios_linker_loader_alloc(linker, ACPI_GHES_ERRORS_FW_CFG_FILE, + bios_linker_loader_alloc(linker, ACPI_HW_ERROR_FW_CFG_FILE, hardware_errors, sizeof(uint64_t), false); for (i = 0; i < ACPI_GHES_ERROR_SOURCE_COUNT; i++) { @@ -243,17 +243,21 @@ static void build_ghes_error_table(GArray *hardware_errors, BIOSLinker *linker) * corresponding "Generic Error Status Block" */ bios_linker_loader_add_pointer(linker, - ACPI_GHES_ERRORS_FW_CFG_FILE, sizeof(uint64_t) * i, - sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, - error_status_block_offset + i * ACPI_GHES_MAX_RAW_DATA_LENGTH); + ACPI_HW_ERROR_FW_CFG_FILE, + sizeof(uint64_t) * i, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + error_status_block_offset + + i * ACPI_GHES_MAX_RAW_DATA_LENGTH); } /* * tell firmware to write hardware_errors GPA into * hardware_errors_addr fw_cfg, once the former has been initialized. */ - bios_linker_loader_write_pointer(linker, ACPI_GHES_DATA_ADDR_FW_CFG_FILE, - 0, sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, 0); + bios_linker_loader_write_pointer(linker, ACPI_HW_ERROR_ADDR_FW_CFG_FILE, 0, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, 0); } /* Build Generic Hardware Error Source version 2 (GHESv2) */ @@ -290,8 +294,10 @@ static void build_ghes_v2(GArray *table_data, build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 0x40, 0, 4 /* QWord access */, 0); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, - address_offset + GAS_ADDR_OFFSET, sizeof(uint64_t), - ACPI_GHES_ERRORS_FW_CFG_FILE, source_id * sizeof(uint64_t)); + address_offset + GAS_ADDR_OFFSET, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + source_id * sizeof(uint64_t)); /* Notification Structure */ build_ghes_hw_error_notification(table_data, notify); @@ -308,9 +314,11 @@ static void build_ghes_v2(GArray *table_data, build_append_gas(table_data, AML_AS_SYSTEM_MEMORY, 0x40, 0, 4 /* QWord access */, 0); bios_linker_loader_add_pointer(linker, ACPI_BUILD_TABLE_FILE, - address_offset + GAS_ADDR_OFFSET, - sizeof(uint64_t), ACPI_GHES_ERRORS_FW_CFG_FILE, - (ACPI_GHES_ERROR_SOURCE_COUNT + source_id) * sizeof(uint64_t)); + address_offset + GAS_ADDR_OFFSET, + sizeof(uint64_t), + ACPI_HW_ERROR_FW_CFG_FILE, + (ACPI_GHES_ERROR_SOURCE_COUNT + source_id) + * sizeof(uint64_t)); /* * Read Ack Preserve field @@ -346,11 +354,11 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, GArray *hardware_error) { /* Create a read-only fw_cfg file for GHES */ - fw_cfg_add_file(s, ACPI_GHES_ERRORS_FW_CFG_FILE, hardware_error->data, + fw_cfg_add_file(s, ACPI_HW_ERROR_FW_CFG_FILE, hardware_error->data, hardware_error->len); /* Create a read-write fw_cfg file for Address */ - fw_cfg_add_file_callback(s, ACPI_GHES_DATA_ADDR_FW_CFG_FILE, NULL, NULL, + fw_cfg_add_file_callback(s, ACPI_HW_ERROR_ADDR_FW_CFG_FILE, NULL, NULL, NULL, &(ags->ghes_addr_le), sizeof(ags->ghes_addr_le), false); ags->present = true; From patchwork Wed Jan 15 18:10:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940750 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27C66C02183 for ; Wed, 15 Jan 2025 18:15:56 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sE-0006is-3z; Wed, 15 Jan 2025 13:12:14 -0500 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 1tY7qo-0008Jm-TH for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:48 -0500 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 1tY7qj-00072Q-PI for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964638; 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=jKE9c5M8qcrF2rVuiv+K3wTMAWn1KWYDQBuYnN9ug8U=; b=EFStBpAwSAopDlYwpHAyySjSLFkTJWDGo00trQ23/REaabIolDTEAyFQIMuO3iEpPALs3q xejGBfBEwhIrCC/Dzx45C+YRIPZr/kxlmATdp5binY4I1KV2zzNW7Qd8CWxI0VMLBYT+CT ynwZOJ7eiii0Ynwt9rCxVmEdaV4o4wk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-155-g7Mgwla6OmGu7kuyP-F1wA-1; Wed, 15 Jan 2025 13:10:37 -0500 X-MC-Unique: g7Mgwla6OmGu7kuyP-F1wA-1 X-Mimecast-MFC-AGG-ID: g7Mgwla6OmGu7kuyP-F1wA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4362b9c15d8so37111455e9.3 for ; Wed, 15 Jan 2025 10:10:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964635; x=1737569435; 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=jKE9c5M8qcrF2rVuiv+K3wTMAWn1KWYDQBuYnN9ug8U=; b=kup5/DjfcAq2xvplM0jjNOsdLe32lkeuAmjnE4nWS5bRNXk+aUQ+/ZkA0g3tzPlVUs EO61fOTGqUQrmk4WStBAlx0TnR4bq6tsJvrJQceog0CPAvv5f3g4KAO4hO29u7bwbEKq BHcJGEsbtDP6pbArImL/TbbwVmIJNmLrb80VHIEK+MMz2RtTilXI/FB2UIERWuD3GVYG YEyyVVN4JnwUIlW7MltX8/PwPdk7+05bGURCC3Qz9y5pi8VT6EPUWC15ZCoG2EBvDvF+ eqHPmQJQWDYGlOaW6kpSmoqBDdXB8SGJRWg7AS2FO7/ewloZR+/WhZ7XAtlEyWiKRlXn j7tw== X-Gm-Message-State: AOJu0YwPyG70x0dmoraDN6JQ1uziFoAJ9Y9FHo5fQMawlZu5QKi+TpCK bIkD7X1vs1+X37KlDHzIkjbI4yRJQg9AaDgKY4q4/98/ABZT0MFdW5/RNz+Iqb9AfTfILI5Sxa1 nXfkRmqKzUmp3xy21DgFNHInl8mNKU4xRttXIq6da+x/tFqd8Yza+aiYM/0UwyqDgfgfc2htKPk 5NrnpHbhZgpC32H2xXisjHmVV17tv0RQ== X-Gm-Gg: ASbGncu6Kja8fO/LLb51U1rtDX6tuP+LvRrD9eLlfsUcE81uzx/LgubllMH7N6amupr s9T07Hovvpo3b+BwLfOgBIuz2Jw1cLCXG2WdlHnTIglz48+iKNUhwoMM464EyEd9dNOnMBD4UDj D+UdmaVTxzwYnzGbb78kuLHCdz3O32pSsaLWzH+N0pg8tV1y0qo1KwgOQa5M8+qoLFglF0z3p3K DZYUQzpyxwQWa5Mr2GHNJ2mujcG7fCKaumB4rz3Y/06zubpgQUA X-Received: by 2002:a05:6000:154f:b0:386:373f:47c4 with SMTP id ffacd0b85a97d-38a873579b3mr26019287f8f.49.1736964634796; Wed, 15 Jan 2025 10:10:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IGATvq4Q040yTIpCKdqV7z3EL3LTn2Lmdrfl5f9AiMvN2mqfgLEnqYuOVWmOESEbMxlSPjEgA== X-Received: by 2002:a05:6000:154f:b0:386:373f:47c4 with SMTP id ffacd0b85a97d-38a873579b3mr26019261f8f.49.1736964634345; Wed, 15 Jan 2025 10:10:34 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e4b8214sm18165056f8f.78.2025.01.15.10.10.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:33 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:31 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 39/48] acpi/ghes: better name the offset of the hardware error firmware Message-ID: <652f6d86cbb60e193edc2510c365b75229734ccf.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab The hardware error firmware is where HEST error structures are stored. Those can be GHESv2, but they can also be other types. Better name the location of the hardware error. No functional changes. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ghes.h | 2 +- hw/acpi/generic_event_device.c | 4 ++-- hw/acpi/ghes.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/acpi/ghes.h b/include/hw/acpi/ghes.h index 21666a4bcc..39619a2457 100644 --- a/include/hw/acpi/ghes.h +++ b/include/hw/acpi/ghes.h @@ -65,7 +65,7 @@ enum { }; typedef struct AcpiGhesState { - uint64_t ghes_addr_le; + uint64_t hw_error_le; bool present; /* True if GHES is present at all on this board */ } AcpiGhesState; diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 58540c0aaf..c85d97ca37 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -363,7 +363,7 @@ static const VMStateDescription vmstate_ghes = { .version_id = 1, .minimum_version_id = 1, .fields = (const VMStateField[]) { - VMSTATE_UINT64(ghes_addr_le, AcpiGhesState), + VMSTATE_UINT64(hw_error_le, AcpiGhesState), VMSTATE_END_OF_LIST() }, }; @@ -371,7 +371,7 @@ static const VMStateDescription vmstate_ghes = { static bool ghes_needed(void *opaque) { AcpiGedState *s = opaque; - return s->ghes_state.ghes_addr_le; + return s->ghes_state.hw_error_le; } static const VMStateDescription vmstate_ghes_state = { diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 3f94a5542b..983e28505a 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -359,7 +359,7 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, /* Create a read-write fw_cfg file for Address */ fw_cfg_add_file_callback(s, ACPI_HW_ERROR_ADDR_FW_CFG_FILE, NULL, NULL, - NULL, &(ags->ghes_addr_le), sizeof(ags->ghes_addr_le), false); + NULL, &(ags->hw_error_le), sizeof(ags->hw_error_le), false); ags->present = true; } @@ -385,7 +385,7 @@ void ghes_record_cper_errors(const void *cper, size_t len, } ags = &acpi_ged_state->ghes_state; - start_addr = le64_to_cpu(ags->ghes_addr_le); + start_addr = le64_to_cpu(ags->hw_error_le); start_addr += source_id * sizeof(uint64_t); From patchwork Wed Jan 15 18:10:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940760 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26AEDC02180 for ; Wed, 15 Jan 2025 18:18:13 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sF-0006rP-Ms; Wed, 15 Jan 2025 13:12:15 -0500 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 1tY7qo-0008Is-4J for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:46 -0500 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 1tY7qj-00072u-Ox for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964641; 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=AB4WiK8znpsIPslofkGRIt3WQYAc+EnhWGK/9uLoHcg=; b=ddAnRR/5OlrwviTHYTk4Tyg5Xj8i4hNmCHa2fttoUJrek6PBYZBf13uTGDj0kQlrtkcdL1 o75G62kh3QA3Ew54MkvP3xqjQf3QFUfTsUtFn0VFcGgNT8My4S4U4y0OULZ4swYot6JFre 6yhpQ6dLSHs57pzmQ68jbeZAJAKRUMs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-106-T_7bJPltN2GPQD2DyKWs2Q-1; Wed, 15 Jan 2025 13:10:39 -0500 X-MC-Unique: T_7bJPltN2GPQD2DyKWs2Q-1 X-Mimecast-MFC-AGG-ID: T_7bJPltN2GPQD2DyKWs2Q Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-43582d49dacso47643635e9.2 for ; Wed, 15 Jan 2025 10:10:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964638; x=1737569438; 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=AB4WiK8znpsIPslofkGRIt3WQYAc+EnhWGK/9uLoHcg=; b=g0LB/5uFEiS7SQh1chHLrnwGiUOpGjcmIUWeYNbrhWJSq/LjHFqgJ15wV3Wk9r1+/6 wGiPSoQFoqzwYacQJnods4yZ8X8cFeHUSRWnZZpExyMy+JlZaQ4Vp9cLY0w1czAA6SGd saTGk/T6/jw2JQvdAxoZm+ls09HZgN2MvI2NNsxTy6rvL+DNvVQa13o/I8DtIGPX0gcu Bo2xzMuUAsPW5nhBXwQIWuE4tdI6R9Jlz3U0FQA3irWjiaTFNToyLMdeZpoA/Tnp55DQ 0OYh2SDiQvMyIQ4Ao9zNIzuEeunIs0R9exn9BYjOs4HPsv6/wPIWgw4meamjOaeiriQQ Kiug== X-Gm-Message-State: AOJu0YzUNKGXu55WJsk4iWcRVhwPw5DeFWGRugC31aFwxFBQbIgBuz4r uf2sObiIbIr+z67lqJiT3yug42F/tNBELeH4VR38xAbrnwXK33IWSHjPwoG2AxrA9qstSGGAN+L 1q0XSb9ah1NRjyCXT8tdvqQZvsqwC4l+qSPwaGsfzBF8xfLAwBwo+C2eS7BKFEGxhQ23kJB/RM6 pzLROFq/D7juVn7kLpJOnNqUDJ4Zo1NA== X-Gm-Gg: ASbGncu1F03DcJM6quUqV6EoGpax4XFxO0e30ma6iMWBTQhfEYxk1PiXnHnMfwWt6OC Rec84ePgO5stENop3rZANO/JkJfBypIS2CcitVzkjDrNK2BwaPsg+Vh4JILQWS3XcVFL/VWIEhH pxZ9nzUwZNgHoG0G1sHTCCr/AX5wq0Am+WwYdHaXg0SkOrh9WyFntMRB+fqRqoIrazYVXsLeAWO DhswdxM2oDzwjP13BD04bA1etoA2kS6BSTyIr3US3anjQJ8urY/ X-Received: by 2002:a05:600c:5491:b0:434:fddf:5bfa with SMTP id 5b1f17b1804b1-436e268626emr263771115e9.2.1736964638063; Wed, 15 Jan 2025 10:10:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IEnKVLGUGT2r6aoNW49z3WobAi9/w2xV1gGZW8fareqYGB0bqjNQsSWZfIy8rk7DQmgtbavwA== X-Received: by 2002:a05:600c:5491:b0:434:fddf:5bfa with SMTP id 5b1f17b1804b1-436e268626emr263770695e9.2.1736964637620; Wed, 15 Jan 2025 10:10:37 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c5bb5sm32289855e9.22.2025.01.15.10.10.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:36 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:34 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 40/48] acpi/ghes: move offset calculus to a separate function Message-ID: <1cd59b8981ce234c1d790111afce4a32218a88dd.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Currently, CPER address location is calculated as an offset of the hardware_errors table. It is also badly named, as the offset actually used is the address where the CPER data starts, and not the beginning of the error source. Move the logic which calculates such offset to a separate function, in preparation for a patch that will be changing the logic to calculate it from the HEST table. While here, properly name the variable which stores the cper address. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Message-Id: <60fdd1bf379ba1db3099710868802aa49a27febb.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index 983e28505a..ddb576b940 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -364,10 +364,37 @@ void acpi_ghes_add_fw_cfg(AcpiGhesState *ags, FWCfgState *s, ags->present = true; } +static void get_hw_error_offsets(uint64_t ghes_addr, + uint64_t *cper_addr, + uint64_t *read_ack_register_addr) +{ + if (!ghes_addr) { + return; + } + + /* + * non-HEST version supports only one source, so no need to change + * the start offset based on the source ID. Also, we can't validate + * the source ID, as it is stored inside the HEST table. + */ + + cpu_physical_memory_read(ghes_addr, cper_addr, + sizeof(*cper_addr)); + + *cper_addr = le64_to_cpu(*cper_addr); + + /* + * As the current version supports only one source, the ack offset is + * just sizeof(uint64_t). + */ + *read_ack_register_addr = ghes_addr + + ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); +} + void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp) { - uint64_t error_block_addr, read_ack_register_addr, read_ack_register = 0; + uint64_t cper_addr = 0, read_ack_register_addr = 0, read_ack_register; uint64_t start_addr; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; @@ -389,18 +416,13 @@ void ghes_record_cper_errors(const void *cper, size_t len, start_addr += source_id * sizeof(uint64_t); - cpu_physical_memory_read(start_addr, &error_block_addr, - sizeof(error_block_addr)); + get_hw_error_offsets(start_addr, &cper_addr, &read_ack_register_addr); - error_block_addr = le64_to_cpu(error_block_addr); - if (!error_block_addr) { + if (!cper_addr) { error_setg(errp, "can not find Generic Error Status Block"); return; } - read_ack_register_addr = start_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); - cpu_physical_memory_read(read_ack_register_addr, &read_ack_register, sizeof(read_ack_register)); @@ -421,7 +443,7 @@ void ghes_record_cper_errors(const void *cper, size_t len, &read_ack_register, sizeof(uint64_t)); /* Write the generic error data entry into guest memory */ - cpu_physical_memory_write(error_block_addr, cper, len); + cpu_physical_memory_write(cper_addr, cper, len); return; } From patchwork Wed Jan 15 18:10:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940738 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BEDE2C02180 for ; Wed, 15 Jan 2025 18:14:15 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s1-0005UP-3c; Wed, 15 Jan 2025 13:12:01 -0500 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 1tY7qt-0008Sl-9c for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:52 -0500 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 1tY7qo-00073p-SL for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964644; 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=YTFWj4vrkS7z96ILKG6Zp39DvnbZjnd3FKkrmyKnnqk=; b=CHFsJUqMMYKbWByAtqw24GGJOrMtCF+T6oKxnGo31lFa0dsTUZwemR4OIZjsDpuaaKLgOr 5cdr9poeR6PKOLPeBGfNpPt3ce2ARgniQ8l9Jh1Fsnngq+57HUtEi9KKDlw0CLSzCChgmX lWKiyDA0dmFGBb2Wml69OzeDG4MQt6M= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-584-eVgKupWYO9yhAjEkPMEaIA-1; Wed, 15 Jan 2025 13:10:43 -0500 X-MC-Unique: eVgKupWYO9yhAjEkPMEaIA-1 X-Mimecast-MFC-AGG-ID: eVgKupWYO9yhAjEkPMEaIA Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4362153dcd6so36836955e9.2 for ; Wed, 15 Jan 2025 10:10:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964642; x=1737569442; 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=YTFWj4vrkS7z96ILKG6Zp39DvnbZjnd3FKkrmyKnnqk=; b=qTmv2QtlD39ao5f0iArOrib+XLoP3Bk32gQ4FpyQVBopGAnQqR0V6S4OVJY+ue7EN9 gIkbbpgm4nWY3j/73X+dNxFTXUoAEM0u8xXJ5785+luUVhwYSWYKdlM7Y4NZsLk6efAd aoFqh17YYPx9XCFp102R37S2SqsEtA6e97TCzreLd0i/08gEMM6HrayWIEmSVtAqoNPo AofsbUb0sybGfhwBqYZWSWQg/U7472tLAGn5meMGgcY+cRJv9KQnbq3aTMF28PgDx0zE K5CCoUWnnpqX39U1GpnzSObYK3cQrckbw2kMyz/degTGM3ZtmfYXG3VX4hnO8Fn99/nP mtJQ== X-Gm-Message-State: AOJu0YwvAEkiHjOlXobjuE8T0U4tm/NDw6cuN9eR3POF0ka0O5Y28OIl mh0Mt0qmzoJTPFw1rtAcH4s/SVIFkLjsQQb3V7QQAoQTJdH468lgAoNMXUvugM1Y4e8ZnLwdT1c SQ5rSkSRAdl0e7/230E49K1qJ0xEyijH+231koQbvuyM43pgZseeewyFMcjCCgo5EFh2/tRFD05 8gGfZqoQJKOJ7XPs1g1gVVoJv1YSEWEw== X-Gm-Gg: ASbGncuFFmzsXMqH/cHdfT7oDwPfJY+dWUGZBQPGlet+/hmrxg2A7UrKKFzOMe8AVlJ IhVlzNKw/Q+eKFLSRXv9eVFqsd/Ewwu5/S5ATMt2X3AhsfWfUzuu2n/Lso46g4Gxo8Tp9U9vXHw hAag44mBpHZXueY8VxfcephIjYriSc69XsiqWcd5x4owfdw1sAQngeTORmFbS9p92uljBJg7lSD BtOUE9VG2ATE4YETUVnIx8FmNWiFasfgeXdR8foYXOT2OV73Xuh X-Received: by 2002:a05:600c:4744:b0:434:a7e7:a1ca with SMTP id 5b1f17b1804b1-436e26f043dmr254624775e9.20.1736964642064; Wed, 15 Jan 2025 10:10:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWW/2mdIrRZrdn0KmsMFg7vNvL2Cp5oP0G16i9jXeuCukrpPekidb68kmwoQKb+U0aittTPw== X-Received: by 2002:a05:600c:4744:b0:434:a7e7:a1ca with SMTP id 5b1f17b1804b1-436e26f043dmr254624545e9.20.1736964641713; Wed, 15 Jan 2025 10:10:41 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74ab250sm31338665e9.9.2025.01.15.10.10.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:40 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:37 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Ani Sinha , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 41/48] acpi/ghes: Change ghes fill logic to work with only one source Message-ID: <47935fc1e56f02c892d186ef89be7c923f73c89b.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab Extending to multiple sources require a BIOS pointer to the beginning of the HEST table, which in turn requires a backward-compatible code. So, the current code supports only one source. Ensure that and simplify the code. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: <66bddd42a64c8515ad98b9975d953b4a70ffcc6d.1736945236.git.mchehab+huawei@kernel.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/ghes.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/hw/acpi/ghes.c b/hw/acpi/ghes.c index ddb576b940..b709c177cd 100644 --- a/hw/acpi/ghes.c +++ b/hw/acpi/ghes.c @@ -387,15 +387,13 @@ static void get_hw_error_offsets(uint64_t ghes_addr, * As the current version supports only one source, the ack offset is * just sizeof(uint64_t). */ - *read_ack_register_addr = ghes_addr + - ACPI_GHES_ERROR_SOURCE_COUNT * sizeof(uint64_t); + *read_ack_register_addr = ghes_addr + sizeof(uint64_t); } void ghes_record_cper_errors(const void *cper, size_t len, uint16_t source_id, Error **errp) { uint64_t cper_addr = 0, read_ack_register_addr = 0, read_ack_register; - uint64_t start_addr; AcpiGedState *acpi_ged_state; AcpiGhesState *ags; @@ -412,11 +410,9 @@ void ghes_record_cper_errors(const void *cper, size_t len, } ags = &acpi_ged_state->ghes_state; - start_addr = le64_to_cpu(ags->hw_error_le); - - start_addr += source_id * sizeof(uint64_t); - - get_hw_error_offsets(start_addr, &cper_addr, &read_ack_register_addr); + assert(ACPI_GHES_ERROR_SOURCE_COUNT == 1); + get_hw_error_offsets(le64_to_cpu(ags->hw_error_le), + &cper_addr, &read_ack_register_addr); if (!cper_addr) { error_setg(errp, "can not find Generic Error Status Block"); From patchwork Wed Jan 15 18:10:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940756 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 94436C02180 for ; Wed, 15 Jan 2025 18:17:38 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s4-0005rg-V7; Wed, 15 Jan 2025 13:12:05 -0500 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 1tY7qv-000096-G5 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:55 -0500 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 1tY7qq-00074q-K2 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964647; 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=V/dUCsKb0TMFSGFh+lNfPFs4aoQ4JRtV+rc4QjtcMiM=; b=FUx7KNXsclSqiojYsajlDBNSYu3ubz8DE5qXjHyRg1z5UuJNqQn9QTZobyWeQ6184q+1ff erIoyS8wuZONQ1uA0tYeolSqfZ72W2rp/n4wJXPGXc3P4CGZeKYzab8+I0YbU9ds1ooM0u XXLn/rBF88MI6nkAQ+F+p3wBoJvzQNQ= 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-295-8JSjpnw_MySaO4CKppukfw-1; Wed, 15 Jan 2025 13:10:46 -0500 X-MC-Unique: 8JSjpnw_MySaO4CKppukfw-1 X-Mimecast-MFC-AGG-ID: 8JSjpnw_MySaO4CKppukfw Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-385e49efd59so48328f8f.0 for ; Wed, 15 Jan 2025 10:10:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964645; x=1737569445; 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=V/dUCsKb0TMFSGFh+lNfPFs4aoQ4JRtV+rc4QjtcMiM=; b=GS8K7VfSRS0UyRj7qC4jlTQgOhEKMTxvlpbgygwKVHpAitv9pQ31IK+NnYBhH1O+F6 SrNoWBnqV/wvcxMsFfvxBqsLHBLaYjb5ts91aMX5uhLU6xeCb1q/AwpdL7pme20eap+i bvFTilrRr9xsu9C6sV2pOOzVOLyiB07ridTbChjZnadJQSIpZ5gWsB7uMCOgAyVuP5gk tgEGwpzjIm8cVd67VzTYeTQlNAAMndAj6wQ17hOxFTIopg4FWK5qTBlNxs0wsqcuazJ+ /NgpgTDvcJlPosAbwrRF3lH2JX2VBLUDZTi1pBNn/pNnQlmok9kfW5loxlp7Zo8lNDDy N6bQ== X-Gm-Message-State: AOJu0YzjU6JQfyEY+RxxgdOvIrV6UG0nK+UdIOZxQ40sNhHvVpEdNjJM 6JfD56L2q+rSbZrBadGJMGm3h11eEo3NLkY0hCaD+k/xeJULkpFvKivDRSkd2kRPC9RhNMdMzc+ VP75HOsNwwrhfDb3N5gkubP/MVV94de4pi18u496uca77wDk591yCwbS6tzH2hzYyX0/krm0DUE 3YLo3VBFUeOfv1VZSDG1g7TzXPr7CFAw== X-Gm-Gg: ASbGncsEvD7Yj0LhFLuJquMqmSQ30PP1gFdwMocZ3SaonqCIThKk6Lu7b19ZERMZRWs uWQ86OSEFlEFk+xH3PGbo3uUT3sVafqI06RQ+8TphzmstCGUub95/RBHEwGdGmYytUiDIqwMWOv XK71GBOjxdMTRmzKItqfXgn8vqFQxErSIHodGr1OrvkFqFixE3XOJbafidQlCGfHtTPTCxsUVhP kHl/y8GUf884kGKvjRuucvmCRUx34dU/vbJTm8Yx63738VjLMd6 X-Received: by 2002:a5d:598d:0:b0:385:e8aa:2a4e with SMTP id ffacd0b85a97d-38a872ec201mr26677172f8f.31.1736964645025; Wed, 15 Jan 2025 10:10:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3Mv9vVAJJkAOQiw+N4OBrDBxt/CnK8sGKnUoKAfnkwLMXB+WdI7WtIzR/LXBGylLA9tMoLw== X-Received: by 2002:a5d:598d:0:b0:385:e8aa:2a4e with SMTP id ffacd0b85a97d-38a872ec201mr26677139f8f.31.1736964644607; Wed, 15 Jan 2025 10:10:44 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38bf65sm18074120f8f.49.2025.01.15.10.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:43 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:41 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Mauro Carvalho Chehab , Jonathan Cameron , Igor Mammedov , Dongjiu Geng , qemu-arm@nongnu.org Subject: [PULL 42/48] docs: acpi_hest_ghes: fix documentation for CPER size Message-ID: <84c146758d79b3689b6c9c7815b6bfbb70ba06b0.1736964488.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 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.141, 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_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Mauro Carvalho Chehab While the spec defines a CPER size of 4KiB for each record, currently it is set to 1KiB. Fix the documentation and add a pointer to the macro name there, as this may help to keep it updated. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Jonathan Cameron Reviewed-by: Igor Mammedov Message-Id: Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/specs/acpi_hest_ghes.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/specs/acpi_hest_ghes.rst b/docs/specs/acpi_hest_ghes.rst index 68f1fbe0a4..c3e9f8d9a7 100644 --- a/docs/specs/acpi_hest_ghes.rst +++ b/docs/specs/acpi_hest_ghes.rst @@ -67,8 +67,10 @@ Design Details (3) The address registers table contains N Error Block Address entries and N Read Ack Register entries. The size for each entry is 8-byte. The Error Status Data Block table contains N Error Status Data Block - entries. The size for each entry is 4096(0x1000) bytes. The total size - for the "etc/hardware_errors" fw_cfg blob is (N * 8 * 2 + N * 4096) bytes. + entries. The size for each entry is defined at the source code as + ACPI_GHES_MAX_RAW_DATA_LENGTH (currently 1024 bytes). The total size + for the "etc/hardware_errors" fw_cfg blob is + (N * 8 * 2 + N * ACPI_GHES_MAX_RAW_DATA_LENGTH) bytes. N is the number of the kinds of hardware error sources. (4) QEMU generates the ACPI linker/loader script for the firmware. The From patchwork Wed Jan 15 18:10:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940767 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCDDFC02180 for ; Wed, 15 Jan 2025 18:19:07 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sK-0007Bo-Ox; Wed, 15 Jan 2025 13:12:20 -0500 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 1tY7qz-0000Kd-Nx for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:59 -0500 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 1tY7qw-00076O-9k for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964653; 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=Z+GU4R9++g+qf0tHlV9qLsyuoJZasMIvP+okqs4b+WU=; b=WuSIS4Gg6UHHF+PoFj/f3+Fcjgz/x5uVaqU3y/G5GVDypeIuJw6cYMOaE1U9+pLyTVSnxW vy7sSE16skhQrVlupRl5XPJOqxaw0IivUV6uUsgjWVhpbTKqK2YcYs7nbCaNGs4TIUpx2f a2+Bql3USloyPi6WCrxHxLrL3dW7ovw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-659-brGT_t7-PNyJME1K37h2fQ-1; Wed, 15 Jan 2025 13:10:51 -0500 X-MC-Unique: brGT_t7-PNyJME1K37h2fQ-1 X-Mimecast-MFC-AGG-ID: brGT_t7-PNyJME1K37h2fQ Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4361c040ba8so39306115e9.1 for ; Wed, 15 Jan 2025 10:10:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964650; x=1737569450; 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=Z+GU4R9++g+qf0tHlV9qLsyuoJZasMIvP+okqs4b+WU=; b=vmbOgvrrZbQi54xztcMx4m6+YzOlpr+DnnsIma8kHOFWDiui/QBzqS8GOvW9f9qgG8 bza5idcIWIx96y0E4sdIQQRZwU0+9hayvZKUsbV+B/KSv0CcY431IB6ZgrQzA//s+2/v 4djrIX2uAOUXdZc5++hzHUWDLd4fjPI8rzTZB8U6yNGzZCnrAhtMHUlB0s1mDVfCae0D /nuCV4RkxwS43KkXi341V+lZgKk38smFW/kh/+4cjTyuwd4ZHP6OqnLZxB5nS7qBvMVg YHRKvfgxiO2u3+ObkhHwyllABShCXmKT4x9vguvRU7xzBguV7qrZPFfRAWqsF5l0b1L3 kwPA== X-Gm-Message-State: AOJu0Yy9OzVx1dQpin7gqyvLnWey9DsdHhroOou7Uy9hqCo+wzK9RgDr ZD40FzH/2L2sRXEcFdAjRzJuzrSl+b3SZpSyZd0LSHJOgjeTUcuvv4OKfUz3g4GCpFCLeg2DJV1 G7o0mWfPn25iS0KCWm7WqEbE6kIPcTHcx+2eGz8JkR7NXYpoCpS2inlK8jxarO6FGsb6ZjdRo28 INCCY4G5vtU5K8r4sLZA0a1/hSiB+S2Q== X-Gm-Gg: ASbGncs+7a0U1QeXMXGWdzyZiDAWD0v+KECB4lalwnKCjRFrFgasYhOXr/Gf9YLADth wYNkDEQTmYo+oLy7OtQhq6Sfun/qjLHAWU8R8LwlmnsIIpbbRjl1TicNcsUmP2pxVBB4Ou6Ttp+ 8M1RaliZec0tQTBegpl7iIptHQw6tDakjj0OcKl62fwL8rixtPRiI4dESQD9PRbrHFKDHdV792u yHvwzMdiK8y5FHJfuU7IPtEbslBTqwa7df6kHDgAdKkbfUBm0bm X-Received: by 2002:a05:600c:4eca:b0:434:ea21:e14f with SMTP id 5b1f17b1804b1-436e26937afmr267364545e9.13.1736964649819; Wed, 15 Jan 2025 10:10:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLQv6ChXKy+XMrZV9qU77ziEl5RcdrKgmd+vXTS336u5qXHslSMgOdTKfRJCryQlgK0drofw== X-Received: by 2002:a05:600c:4eca:b0:434:ea21:e14f with SMTP id 5b1f17b1804b1-436e26937afmr267364275e9.13.1736964649410; Wed, 15 Jan 2025 10:10:49 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c475csm32230185e9.20.2025.01.15.10.10.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:47 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:45 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 43/48] tests: acpi: whitelist expected blobs Message-ID: <1ad32644fe4c9fb25086be15a66dde1d55d3410f.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20250115125342.3883374-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..085dfa9ff4 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,41 @@ /* 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.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", +"tests/data/acpi/x86/q35/DSDT.acpierst", +"tests/data/acpi/x86/q35/DSDT.acpihmat", +"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x", +"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator", +"tests/data/acpi/x86/q35/DSDT.applesmc", +"tests/data/acpi/x86/q35/DSDT.bridge", +"tests/data/acpi/x86/q35/DSDT.core-count", +"tests/data/acpi/x86/q35/DSDT.core-count2", +"tests/data/acpi/x86/q35/DSDT.cphp", +"tests/data/acpi/x86/q35/DSDT.cxl", +"tests/data/acpi/x86/q35/DSDT.dimmpxm", +"tests/data/acpi/x86/q35/DSDT.ipmibt", +"tests/data/acpi/x86/q35/DSDT.ipmismbus", +"tests/data/acpi/x86/q35/DSDT.ivrs", +"tests/data/acpi/x86/q35/DSDT.memhp", +"tests/data/acpi/x86/q35/DSDT.mmio64", +"tests/data/acpi/x86/q35/DSDT.multi-bridge", +"tests/data/acpi/x86/q35/DSDT.nohpet", +"tests/data/acpi/x86/q35/DSDT.numamem", +"tests/data/acpi/x86/q35/DSDT.pvpanic-isa", +"tests/data/acpi/x86/q35/DSDT.thread-count", +"tests/data/acpi/x86/q35/DSDT.thread-count2", +"tests/data/acpi/x86/q35/DSDT.tis.tpm12", +"tests/data/acpi/x86/q35/DSDT.tis.tpm2", +"tests/data/acpi/x86/q35/DSDT.type4-count", +"tests/data/acpi/x86/q35/DSDT.viot", +"tests/data/acpi/x86/q35/DSDT.xapic", From patchwork Wed Jan 15 18:10:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940761 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B56AC02185 for ; Wed, 15 Jan 2025 18:18:14 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sK-0007A5-Cq; Wed, 15 Jan 2025 13:12:20 -0500 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 1tY7r0-0000Mm-E8 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:59 -0500 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 1tY7qy-00077A-Is for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:10:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964656; 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=+iBHg2OPngPHjw2/4BgKrx8Ylj0UqmearNkTjgWbPZw=; b=SXeRyA2uanXs9Avs563Ewi7PD7ewePUMhzCleyXse0ik8fxRw5nDrv4XWTbtrCFxx2OKeb tS10sg9BVB8VNZ7yqTxyd1jMr96tZjsCcHwufhNdmgUNS+WJo9pjL/s1/A4m2MMMDAqS4D CQljnQOpFd++5hWq49+0kov9FXM9IP4= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-JHG4J0IjPZ22CHjvWp7agA-1; Wed, 15 Jan 2025 13:10:54 -0500 X-MC-Unique: JHG4J0IjPZ22CHjvWp7agA-1 X-Mimecast-MFC-AGG-ID: JHG4J0IjPZ22CHjvWp7agA Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43625ceae52so37750385e9.0 for ; Wed, 15 Jan 2025 10:10:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964653; x=1737569453; 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=+iBHg2OPngPHjw2/4BgKrx8Ylj0UqmearNkTjgWbPZw=; b=GCYMU0Om59eVbwQAgmqd8Zevc13ZlM2HLQs8M42gjTxj0GuUh0o4J4Skd+tUSTQDnz 2uZ2WPzhY280XY08TL4zfQgf/wKXEKtMQZGIGD3wCgFllTPBkbNByMktkUku7lJ/m5hD rGB7xQGz4gvbXu9QYrGhlkv3cB7j733Fgkrkz7M1nk8caOHisHigT8yS3exiHT6TsHYz rJfWLZuckc+GLnfHg9OOSXlx6C0b5ue6RBqlA2vLtato+uPjnqfOz3TjeQU1xfJt3KPA aBoANCAgQZ6FSKW9KZbRTBFL6rhChg3oACLynjjO7sUUzQUfy+p6gy9z4WFGcl4dpkIL P5MQ== X-Gm-Message-State: AOJu0Yz4/CqBwx9gzED8qu2GHqIQ5YHOZIaxNQEe+ojs95eMWqj+1NWJ 5iIt5MYTy/EACsQhgtahF6rGZTC3GAsI5bYO5mEYk5yLafVsV2Nv7sUDhOG5w3iZponuT1tU7rV OcdtGcNQnX8L/mnDzR/upxXnML/kiaCzQn7pmbZt0ckYvyNGDP3zfiNamAcOD4A1DjzXwYk9LQk GCul5iqJWtoZf+mCR60g8OFjsfql3lmw== X-Gm-Gg: ASbGncs+7LstwyJnPxuGOcLG/qx4ZuUDs/EoVDGlOlFePGsX4i+RC7lmA88ZGsE6zUa QcBAT546sjMphrSVv4UmZDjbSn3efujEobwAcnelLGTAJSQTzGqzmquPZwUM6NseoY7oQt3kxbc pNwfUYFbnAHjdjR3DWBFqsWr/dCBVY8vRKaYPLxPUrzkcvxEStEQnBsZGskJHzfapdRW5QfyzuK W3+UbXGDW1LkiUqE/UCzt1Rz/dhSH7cBn0pU6S/F7oCZlkaPJEU X-Received: by 2002:a05:600c:138d:b0:433:c76d:d57e with SMTP id 5b1f17b1804b1-436e26849f2mr49916835e9.5.1736964653137; Wed, 15 Jan 2025 10:10:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGYWNt1gcTmJbIAQaT3qZS8+OwyZdqzGBwueOpfO26delrSiZ4FMufZR7Stiut5vK9BVseFbw== X-Received: by 2002:a05:600c:138d:b0:433:c76d:d57e with SMTP id 5b1f17b1804b1-436e26849f2mr49916535e9.5.1736964652660; Wed, 15 Jan 2025 10:10:52 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c5b2esm31238695e9.23.2025.01.15.10.10.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:51 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:49 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum Subject: [PULL 44/48] pci: acpi: Windows 'PCI Label Id' bug workaround Message-ID: <0b053391985abcc40b16ac8fc4a7f6588d1d95c1.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov Current versions of Windows call _DSM(func=7) regardless of whether it is supported or not. It leads to NICs having bogus 'PCI Label Id = 0', where none should be set at all. Also presence of 'PCI Label Id' triggers another Windows bug on localized versions that leads to hangs. The later bug is fixed in latest updates for 'Windows Server' but not in consumer versions of Windows (and there is no plans to fix it as far as I'm aware). Given it's easy, implement Microsoft suggested workaround (return invalid Package) so that affected Windows versions could boot on QEMU. This would effectvely remove bogus 'PCI Label Id's on NICs, but MS teem confirmed that flipping 'PCI Label Id' should not change 'Network Connection' ennumeration, so it should be safe for QEMU to change _DSM without any compat code. Smoke tested with WinXP and WS2022 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/774 Signed-off-by: Igor Mammedov Message-Id: <20250115125342.3883374-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 733b8f0851..1311a0d4f3 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -654,6 +654,7 @@ static Aml *aml_pci_pdsm(void) Aml *acpi_index = aml_local(2); Aml *zero = aml_int(0); Aml *one = aml_int(1); + Aml *not_supp = aml_int(0xFFFFFFFF); Aml *func = aml_arg(2); Aml *params = aml_arg(4); Aml *bnum = aml_derefof(aml_index(params, aml_int(0))); @@ -678,7 +679,7 @@ static Aml *aml_pci_pdsm(void) */ ifctx1 = aml_if(aml_lnot( aml_or(aml_equal(acpi_index, zero), - aml_equal(acpi_index, aml_int(0xFFFFFFFF)), NULL) + aml_equal(acpi_index, not_supp), NULL) )); { /* have supported functions */ @@ -704,18 +705,30 @@ static Aml *aml_pci_pdsm(void) { Aml *pkg = aml_package(2); - aml_append(pkg, zero); - /* - * optional, if not impl. should return null string - */ - aml_append(pkg, aml_string("%s", "")); - aml_append(ifctx, aml_store(pkg, ret)); - aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index)); + aml_append(ifctx, aml_store(pkg, ret)); /* - * update acpi-index to actual value + * Windows calls func=7 without checking if it's available, + * as workaround Microsoft has suggested to return invalid for func7 + * Package, so return 2 elements package but only initialize elements + * when acpi_index is supported and leave them uninitialized, which + * leads elements to being Uninitialized ObjectType and should trip + * Windows into discarding result as an unexpected and prevent setting + * bogus 'PCI Label' on the device. */ - aml_append(ifctx, aml_store(acpi_index, aml_index(ret, zero))); + ifctx1 = aml_if(aml_lnot(aml_lor( + aml_equal(acpi_index, zero), aml_equal(acpi_index, not_supp) + ))); + { + aml_append(ifctx1, aml_store(acpi_index, aml_index(ret, zero))); + /* + * optional, if not impl. should return null string + */ + aml_append(ifctx1, aml_store(aml_string("%s", ""), + aml_index(ret, one))); + } + aml_append(ifctx, ifctx1); + aml_append(ifctx, aml_return(ret)); } From patchwork Wed Jan 15 18:10:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940752 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14A53C02183 for ; Wed, 15 Jan 2025 18:16:29 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sM-0007JQ-37; Wed, 15 Jan 2025 13:12:22 -0500 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 1tY7r6-0000lS-7u for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:04 -0500 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 1tY7r2-00077i-PQ for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964660; 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=6M1jFL2vf83U/NINHWTEDkBtidr72+vppnl6seODX1A=; b=OxANHmxL6hAk1XCiV/sw895StfFS5hbr/r9zAU6gPcF2vZ4GkmeGqznd9iXNDF4vKCF23f urYfgOyd+gZfwxj42VhUgycDf2BnmPf4yfDXW+I6cC3h8Tbq/FKZ0RfrOiMUylr21FiL25 JhYRkEGy6lmBMOP/LoUAjIeEvpPj9MI= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-19-oAAZAO3NPD61ZBt855R_PQ-1; Wed, 15 Jan 2025 13:10:58 -0500 X-MC-Unique: oAAZAO3NPD61ZBt855R_PQ-1 X-Mimecast-MFC-AGG-ID: oAAZAO3NPD61ZBt855R_PQ Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436379713baso33394815e9.2 for ; Wed, 15 Jan 2025 10:10:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964656; x=1737569456; 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=6M1jFL2vf83U/NINHWTEDkBtidr72+vppnl6seODX1A=; b=WXjmh0tp2WhLe/fFH8NCLluA8MliFPxFnU38v6v2wlZGdEnNRj05oA/djuKz6gpncD n7VjK1/bUkY28GhWpj0KObF1EY/yO8NbuOGuBf4lmXOb3BFdS8qJo1CJsG9jLg3vYwLw mEKSK0HQWv0hW73zPuUIWwo0PLA59jB1F0UWP1nnYq6f7SziTYQTGEWA2dSc8/ctu4To k5PJwptNqCGI8jmX5SmRexyK+FciF7DbWjZG4nhMbVgiGK7vIKJfkwsH8+wcKYJFJJwf U0xWvBGTaNrwWbC7WA+Au7vW54Os+5Q+BDt1B7xrr0zNANpWXElpmTc6ETy4aPXkeyb9 +8cw== X-Gm-Message-State: AOJu0YznaWCJtfF3ZRd9dZ5GqCfip+GCEZYkbYg/txYy6MXhTd+YTLp7 AZQC9o6FPprGbuq9pzaPv/OvtJh/OtlkBXAKqgr+ccI/qtperVKnCjWyzlKLoDZfr5FCYACdi2S KARmcQ5ynMIKaVkXTj8sCkkE7/AC3xFfqheS0AKNEvW9uFte8seXSDXsjjCrW8YmIVD4SBkxG9Z K+IlnrpLGdjKN1l0mDYvnJlTvmGbjQag== X-Gm-Gg: ASbGncv1bOLwucHmCyXLnfWJCI3ODdNckpcMMa8S85dodfuvVEi1639qbrw4eXYNhxX Cl3V9iSZU4DMGHCltBL+4crxY5C7G9yWBTB6SlqNUhRLneq4nbI5EJ1FnJyotjJCg0x4mu7vrdY mWP1q/B5/HE7LU6YjgZLvL7hC6N6rF1h57m7pH1SYuoOdSV2elKw6Ly4ipaUi4JmbfZEbSmSiHT U5QGdD2HYC8nMlEGF1vxsYiRbbR5PuQ9yjow1G7N/GvxDnI7ZIJ X-Received: by 2002:a5d:6d8a:0:b0:386:4034:f9a8 with SMTP id ffacd0b85a97d-38a8733693fmr30766786f8f.38.1736964656070; Wed, 15 Jan 2025 10:10:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxDl94D+zJ48WlTFfVRrBG5yMAiAx1htNhBZy3G7SpDqQHryWVsbB6M3Ez/dDf9wT8uBR5lA== X-Received: by 2002:a5d:6d8a:0:b0:386:4034:f9a8 with SMTP id ffacd0b85a97d-38a8733693fmr30766748f8f.38.1736964655491; Wed, 15 Jan 2025 10:10:55 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e37d0bdsm18163484f8f.3.2025.01.15.10.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:54 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:52 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 45/48] tests: acpi: update expected blobs Message-ID: <9fb1c9a1bb26e111ee5fa5538070cd684de14c08.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Igor Mammedov _DSM function 7 AML should have followig change: If ((Arg2 == 0x07)) { - Local0 = Package (0x02) - { - Zero, - "" - } Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One] )) - Local0 [Zero] = Local2 + Local0 = Package (0x02) {} + If (!((Local2 == Zero) || (Local2 == 0xFFFFFFFF))) + { + Local0 [Zero] = Local2 + Local0 [One] = "" + } + Return (Local0) } } Signed-off-by: Igor Mammedov Message-Id: <20250115125342.3883374-4-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 40 ------------------ tests/data/acpi/x86/pc/DSDT | Bin 8593 -> 8611 bytes tests/data/acpi/x86/pc/DSDT.acpierst | Bin 8504 -> 8522 bytes tests/data/acpi/x86/pc/DSDT.acpihmat | Bin 9918 -> 9936 bytes tests/data/acpi/x86/pc/DSDT.bridge | Bin 15464 -> 15482 bytes tests/data/acpi/x86/pc/DSDT.cphp | Bin 9057 -> 9075 bytes tests/data/acpi/x86/pc/DSDT.dimmpxm | Bin 10247 -> 10265 bytes tests/data/acpi/x86/pc/DSDT.hpbridge | Bin 8544 -> 8562 bytes tests/data/acpi/x86/pc/DSDT.ipmikcs | Bin 8665 -> 8683 bytes tests/data/acpi/x86/pc/DSDT.memhp | Bin 9952 -> 9970 bytes tests/data/acpi/x86/pc/DSDT.nohpet | Bin 8451 -> 8469 bytes tests/data/acpi/x86/pc/DSDT.numamem | Bin 8599 -> 8617 bytes tests/data/acpi/x86/pc/DSDT.roothp | Bin 12386 -> 12404 bytes tests/data/acpi/x86/q35/DSDT | Bin 8422 -> 8440 bytes tests/data/acpi/x86/q35/DSDT.acpierst | Bin 8439 -> 8457 bytes tests/data/acpi/x86/q35/DSDT.acpihmat | Bin 9747 -> 9765 bytes .../data/acpi/x86/q35/DSDT.acpihmat-generic-x | Bin 12632 -> 12650 bytes .../acpi/x86/q35/DSDT.acpihmat-noinitiator | Bin 8701 -> 8719 bytes tests/data/acpi/x86/q35/DSDT.applesmc | Bin 8468 -> 8486 bytes tests/data/acpi/x86/q35/DSDT.bridge | Bin 12035 -> 12053 bytes tests/data/acpi/x86/q35/DSDT.core-count | Bin 12980 -> 12998 bytes tests/data/acpi/x86/q35/DSDT.core-count2 | Bin 33837 -> 33855 bytes tests/data/acpi/x86/q35/DSDT.cphp | Bin 8886 -> 8904 bytes tests/data/acpi/x86/q35/DSDT.cxl | Bin 13213 -> 13231 bytes tests/data/acpi/x86/q35/DSDT.dimmpxm | Bin 10076 -> 10094 bytes tests/data/acpi/x86/q35/DSDT.ipmibt | Bin 8497 -> 8515 bytes tests/data/acpi/x86/q35/DSDT.ipmismbus | Bin 8510 -> 8528 bytes tests/data/acpi/x86/q35/DSDT.ivrs | Bin 8439 -> 8457 bytes tests/data/acpi/x86/q35/DSDT.memhp | Bin 9781 -> 9799 bytes tests/data/acpi/x86/q35/DSDT.mmio64 | Bin 9552 -> 9570 bytes tests/data/acpi/x86/q35/DSDT.multi-bridge | Bin 13275 -> 13293 bytes tests/data/acpi/x86/q35/DSDT.nohpet | Bin 8280 -> 8298 bytes tests/data/acpi/x86/q35/DSDT.numamem | Bin 8428 -> 8446 bytes tests/data/acpi/x86/q35/DSDT.pvpanic-isa | Bin 8523 -> 8541 bytes tests/data/acpi/x86/q35/DSDT.thread-count | Bin 12980 -> 12998 bytes tests/data/acpi/x86/q35/DSDT.thread-count2 | Bin 33837 -> 33855 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm12 | Bin 9028 -> 9046 bytes tests/data/acpi/x86/q35/DSDT.tis.tpm2 | Bin 9054 -> 9072 bytes tests/data/acpi/x86/q35/DSDT.type4-count | Bin 18656 -> 18674 bytes tests/data/acpi/x86/q35/DSDT.viot | Bin 14679 -> 14697 bytes tests/data/acpi/x86/q35/DSDT.xapic | Bin 35785 -> 35803 bytes 41 files changed, 40 deletions(-) diff --git a/tests/data/acpi/x86/pc/DSDT b/tests/data/acpi/x86/pc/DSDT index 60d50b088a362556fd54395cb15364d6c0936be5..4beb5194b84a711fcb52e3e52cc2096497d18442 100644 GIT binary patch delta 89 zcmV-f0H*(uL!(0qL{mgmqagqQ0q~Iu-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXh>8L>3-R delta 71 zcmZ4NJkgoUCDfrkrZ{;3=vWj@ diff --git a/tests/data/acpi/x86/pc/DSDT.acpierst b/tests/data/acpi/x86/pc/DSDT.acpierst index 4c434c25c0b1602f22128e352781df498fa69ddf..abda6863b64c5dc8ba5aba1a286cbfa76772a1e4 100644 GIT binary patch delta 89 zcmV-f0H*)ALdrr4L{mgmN+AFM0XUHg-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXe!43(g%c delta 71 zcmX@*w8M$ZCDEFBZrY8sUWE%fnl>N6RSJ`_UaTb diff --git a/tests/data/acpi/x86/pc/DSDT.acpihmat b/tests/data/acpi/x86/pc/DSDT.acpihmat index 61b7d5caa55c44dbf69d649110c6b14bb4c3fdf5..d081db26d7ba504b3344fad130d5812419291ac0 100644 GIT binary patch delta 89 zcmV-f0H*)GP0&pWL{mgm&?W!?0j-e=-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXjewW-A`t delta 71 zcmccMyU&-)CDf|gg_5vYRCI()HgaSuT bmx$($90rEwjvPjYq=KZ51cuG7Ox-E~Jn|LX diff --git a/tests/data/acpi/x86/pc/DSDT.bridge b/tests/data/acpi/x86/pc/DSDT.bridge index d43e148bed19160f39d88ccf3364544150a3f87f..e16897dc5f0fbb3f7b4de8db913884046246cc3b 100644 GIT binary patch delta 89 zcmV-f0H*)wc=~t>L{mgmdOQFC0sfH+-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXga_qf{SP delta 71 zcmexW@uGsuCDEFBZrY8sUWE%fnl>Nlc^N|GxZf$ diff --git a/tests/data/acpi/x86/pc/DSDT.cphp b/tests/data/acpi/x86/pc/DSDT.cphp index 9fda0b56638e02097e58dd4536c9c5955986e88e..e95711cd9cde5d50b841b701ae0fed5a4b15e872 100644 GIT binary patch delta 89 zcmV-f0H*)pM)O7rL{mgmb0Yu%0b`L0-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXgFlMG+nf delta 71 zcmezD_Rx*XCDfrkCOt&}Bit1V diff --git a/tests/data/acpi/x86/pc/DSDT.dimmpxm b/tests/data/acpi/x86/pc/DSDT.dimmpxm index 5b6471c8db9003b39bf5e20af34061f3e71cdbd5..90ba66b9164f9a958d5a3c4371b1eec03e922828 100644 GIT binary patch delta 89 zcmV-f0H*(kP?=B)L{mgm87Ke%0T7W2-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXm5l+*loK delta 71 zcmbOk&>q0$66_MfuED^-7(bEg0h5oX&boH!>hW6V}kot(wRULeHE#K6mtP~hn4 b64Bg|!@$tok;BN4RFKq>z_8hs>53`<(lZon diff --git a/tests/data/acpi/x86/pc/DSDT.hpbridge b/tests/data/acpi/x86/pc/DSDT.hpbridge index 67fe28699fbb261cfc7a52b2291f9965ab93c6a8..0eafe5fbf3d73719c9c3e6e26371863bfb44ed2f 100644 GIT binary patch delta 89 zcmV-f0H*)oLh?ciL{mgmav=Z!0VI(M-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXgCiEEFBZrY8sUWE%fnl>Nlde1f5@i&- diff --git a/tests/data/acpi/x86/pc/DSDT.ipmikcs b/tests/data/acpi/x86/pc/DSDT.ipmikcs index 9b2e81a7bcefb5c0e2dfbd2bbc5b6ea501f86306..8d465f027772f9c59b0c328c1a099e374a6d2a90 100644 GIT binary patch delta 89 zcmV-f0H*)hL+e8dL{mgm>mdLD0c?>9-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXka`W%?fJ delta 71 zcmaFueAAiBCDf|gg_5vYRCI()HgaSuT bmx$($90rEwjvPjYq=KZ51cuG7Ov~f}J!2K= diff --git a/tests/data/acpi/x86/pc/DSDT.memhp b/tests/data/acpi/x86/pc/DSDT.memhp index 9c66ccf150af1622d1b788a1ae04a6e5136cff9e..e3b49757cb7abd7536ee89a6824967d2cb2485cf 100644 GIT binary patch delta 89 zcmV-f0H*)oP4Z0&L{mgm@+JTP0mP9C-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXkw7k1QX1 delta 71 zcmez5`@omWCDfrkrnM>nBq0B{Weh+qM;GXl^a{vRFN delta 71 zcmbR0)a=CN66_MftjNH?$T5-Y0h5oX&boH!>hW6V}kot(wRULeHE#K6mtP~hn4 b64Bg|!@$tok;BN4RFKq>z_8hs>4F>pvSt(8 diff --git a/tests/data/acpi/x86/pc/DSDT.numamem b/tests/data/acpi/x86/pc/DSDT.numamem index e256bbce790152f045247db631d9f1da81f90499..9bfbfc28213713c208dfc38a85abb46fb190871d 100644 GIT binary patch delta 89 zcmV-f0H*(!L#aawL{mgmsUZLW0eq1P-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXi8EC?*~8 delta 71 zcmZ4KJl&bgCDf|gg_5vYRCI()HgaSuT bmx$($90rEwjvPjYq=KZ51cuG7OeyjJ3|kcO diff --git a/tests/data/acpi/x86/pc/DSDT.roothp b/tests/data/acpi/x86/pc/DSDT.roothp index 0557810ddc18dc280d039163c72b25428a2486c1..efbee6d8aa5c62ff4fcb83e6c5cff59542977850 100644 GIT binary patch delta 89 zcmV-f0H*)qVDw-LL{mgmbT9w_0eq1P-~vt+k?gnvL<*Cp0c$ijlWGbFa6w5#Sc8ac v004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;GXgIzVfrkCVf2sJ7X1f diff --git a/tests/data/acpi/x86/q35/DSDT b/tests/data/acpi/x86/q35/DSDT index 51ad37a351bffae8fbc9ba17f72c25ef61822f59..e5e8d1e041e20e1b3ee56a5c93fe3d6ebd721ee6 100644 GIT binary patch delta 91 zcmV-h0HpusLHI!mL{mgm_#glP0lu*cp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1@*Q=CAJ6~* delta 73 zcmez2_{@>ZCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK_KSpX366wv?x diff --git a/tests/data/acpi/x86/q35/DSDT.acpierst b/tests/data/acpi/x86/q35/DSDT.acpierst index dbd4f858354df0f4c050fd0b914581154f340ee8..072a3fe2cd17dfe06658dfd82588f69787810114 100644 GIT binary patch delta 91 zcmV-h0Hpu-L5V^NL{mgm2_XOg0bQ{Qp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ110L!89X0>} delta 73 zcmeBl`tHc(66_N4U4emtaqUK~g^Wx-B9qrL?qG7_oSe>-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaECr8~`1R6gL0> diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat b/tests/data/acpi/x86/q35/DSDT.acpihmat index 952752e30e9dfc9e2085e8fceaa0740dda6db89c..2a4f2fc1d5c5649673353186e67ff5b5e59e8d53 100644 GIT binary patch delta 91 zcmV-h0HptuOr=Z;L{mgmB_;p>0eZ0tp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1A0z7h9by0g delta 73 zcmZ4LGuemBCD!@#IFXg^Wx-B9qrL?qG7_oSe>-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaIwKG63GX6Jr1X diff --git a/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x b/tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x index e95258cbd8681103a642f8973bd1ac9ef229cff7..7911c058bba5005d318b8db8d6da5c1ee381b0f1 100644 GIT binary patch delta 91 zcmV-h0HpueV(MZFL{mgmYB2x+0Uxmnp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1WG*SE9$f$c delta 73 zcmaErbR&t&CDfQ+LPjPZk;!WrcQ83|PEKdaR#Kgu#l>DA#LC3L%aBmu d=;;#C+>yh;(A<&3$dFW!)RDljnT&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ12_NN+9V-9; delta 73 zcmeBo`RmN(66_N4SCN5%v1KFILPjPZk;!WrcQ83|PEKdaR#Kgu#l>DA#LC3L%aBmu d=;;#C+>yh;(A<&3$dFW!)RDljnT?rK9sn9)6f6J$ diff --git a/tests/data/acpi/x86/q35/DSDT.applesmc b/tests/data/acpi/x86/q35/DSDT.applesmc index b6cb840953ea539092f601e08b7122fc999b3e1b..5e8220e38d6f88b103f6eb3eb7c78dfa466882dc 100644 GIT binary patch delta 91 zcmV-h0HptvLZ(6rL{mgmCLsU-0j;qLp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1ARhA09eV%( delta 73 zcmZ4HG{uR_CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaIvl9025j6MO&w diff --git a/tests/data/acpi/x86/q35/DSDT.bridge b/tests/data/acpi/x86/q35/DSDT.bridge index 1939fda2507cde6fcb6f7a093897f9bd2cb987ef..ee039453af1071e00a81ee7b37cf8f417f524257 100644 GIT binary patch delta 91 zcmV-h0HpteUX@-7L{mgm6)yk)0okz%p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ14=e_S9k&1g delta 73 zcmbOl*Br;?66_Mftk1x}sIif2AtRHI$mF$*JD8j}C#N%IE2&P-;$kllVr63BWk@J+ d^mK`6?#N+aXzs{iWJoGV>PTSN%*M>G0|2&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1z%Mu29_#=B delta 73 zcmX?>x+Rs%CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK^(eE=K{6zu>2 diff --git a/tests/data/acpi/x86/q35/DSDT.core-count2 b/tests/data/acpi/x86/q35/DSDT.core-count2 index 153b45f0f7443d25cecc2a752fb6dbd921160e78..d0394558a1faa0b4ba43abab66d474d96b477ff3 100644 GIT binary patch delta 93 zcmV-j0HXh`hyuTe0t!S^L{vY70004pu?nF90!|f^tpT_KL<*B<0&6rklWGbFa6w5# zSc8ac004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;^a447REFBZrY8sUWE%fnhTnvt=UyG{+SX diff --git a/tests/data/acpi/x86/q35/DSDT.cphp b/tests/data/acpi/x86/q35/DSDT.cphp index 231bc23d932e832ffa12dd253bcf54245b5ef88f..a055c2e7d3c4f5a00a03be20fd73227e322283a4 100644 GIT binary patch delta 91 zcmV-h0Hpu6MaV@8L{mgm$RYp$0Wq-(p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1!XF(89*+P3 delta 73 zcmX@%y3Li#CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK_Ec>o5=6p#P_ diff --git a/tests/data/acpi/x86/q35/DSDT.cxl b/tests/data/acpi/x86/q35/DSDT.cxl index 0f1ccdfcc3ffbf151c172015cc4bf18bc4ead218..20843549f54af1cb0e6017c4cfff7463318d9eb7 100644 GIT binary patch delta 91 zcmV-h0Hpt&XRl`pL{mgmuQLDu0rIg5p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1sW4h(A5s7S delta 73 zcmZ3VJ~y4qCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK_t0|5Ha6jJ~I diff --git a/tests/data/acpi/x86/q35/DSDT.dimmpxm b/tests/data/acpi/x86/q35/DSDT.dimmpxm index eb5b6e9f52107d9c95e38e94a67a6b5001beafc1..664e926e90765550136242f7e3e0bdc7719c1853 100644 GIT binary patch delta 91 zcmV-h0HpuiPVP<$L{mgmZYKZ$0p76+p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1Xe3r19`FDF delta 73 zcmaFocgK&*CDDA#LC3L%aBmu d=;;#C+>yh;(A<&3$dFW!)RDljnTA|L{mgmLm>bF0r9a4p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1Jsu@F9y0&{ delta 73 zcmX@?w9$#nCDDA#LC3L%aBmu d=;;#C+>yh;(A<&3$dFW!)RDljnT^?24gk>i6Epw- diff --git a/tests/data/acpi/x86/q35/DSDT.ipmismbus b/tests/data/acpi/x86/q35/DSDT.ipmismbus index d04d215a1d0fbc77739084d100a35af47a1c1a62..6d0b6b95c2a9fd01befc37b26650781ee1562e2a 100644 GIT binary patch delta 91 zcmV-h0HpuELeN4AL{mgmP$2*S0b;QVp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1N*)KE9oPT> delta 73 zcmccMw9kplCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaIv)902vK6WIU& diff --git a/tests/data/acpi/x86/q35/DSDT.ivrs b/tests/data/acpi/x86/q35/DSDT.ivrs index dbd4f858354df0f4c050fd0b914581154f340ee8..072a3fe2cd17dfe06658dfd82588f69787810114 100644 GIT binary patch delta 91 zcmV-h0Hpu-L5V^NL{mgm2_XOg0bQ{Qp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ110L!89X0>} delta 73 zcmeBl`tHc(66_N4U4emtaqUK~g^Wx-B9qrL?qG7_oSe>-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaECr8~`1R6gL0> diff --git a/tests/data/acpi/x86/q35/DSDT.memhp b/tests/data/acpi/x86/q35/DSDT.memhp index f73ade9bf6e4545f9912ed654a282884a54cec79..4f2f9bcfceff076490cc49b8286380295a340004 100644 GIT binary patch delta 91 zcmV-h0Hpu5Ovg+LL{mgmM&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1K_e9h9svLV delta 73 zcmX@^v(<;oCDdw@xex}g^Wx-B9qrL?qG7_oSe>-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaIv`G64VU6aoMM diff --git a/tests/data/acpi/x86/q35/DSDT.mmio64 b/tests/data/acpi/x86/q35/DSDT.mmio64 index f0ddb4c83cdc9afdf4f289a66ed6bf0d630fd623..0fb6aab16f1bd79f3c0790cc9f644f7e52ac37b1 100644 GIT binary patch delta 91 zcmV-h0HpuWO5#ciL{mgmVkH0o0aCFFp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1Tp}Dc9w-0+ delta 73 zcmaFlb-|0vCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaGY^5&#B26e$1z diff --git a/tests/data/acpi/x86/q35/DSDT.multi-bridge b/tests/data/acpi/x86/q35/DSDT.multi-bridge index 3ad19e3f5e480db1c449b838c83833f7665186cd..f6afa6d96d2525d512cc46f17439f7a49962b730 100644 GIT binary patch delta 91 zcmV-h0HpuhXYFSSL{mgm?K1!X0n@Pxp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1=P;20AS(a> delta 73 zcmaExemkAZCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK`B0{|wL6)XS% diff --git a/tests/data/acpi/x86/q35/DSDT.nohpet b/tests/data/acpi/x86/q35/DSDT.nohpet index c089b5877a0f4d808abd4d8d9396ee7d2a9a78e5..99ad629c9171ff6ab346d6b4c519e77ca23e5b1c 100644 GIT binary patch delta 91 zcmV-h0HpueK&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1WF0Hn9$x?e delta 73 zcmaFmaKnMiCD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaGY?EC3QZ6kq@V diff --git a/tests/data/acpi/x86/q35/DSDT.numamem b/tests/data/acpi/x86/q35/DSDT.numamem index 2867f5b44498d788fc0effd0bf616317821be88e..fd1d8a79d3d9b071c8796e5e99b76698a9a8d29c 100644 GIT binary patch delta 91 zcmV-h0HpuyLH&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1_#If%A9Mf! delta 73 zcmez8_{NdTCD&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1R~{KW9vT1u delta 73 zcmccXblQo_CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaGZb8~_8K6dM2l diff --git a/tests/data/acpi/x86/q35/DSDT.thread-count b/tests/data/acpi/x86/q35/DSDT.thread-count index 41c0832ab5041ff5361598813ec28fe7442b191b..7ebfceeb66460d0ad98471924ce224b7153e87ef 100644 GIT binary patch delta 91 zcmV-h0Hpu4WyWO+L{mgm#xei^0XDG;p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1z%Mu29_#=B delta 73 zcmX?>x+Rs%CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaK^(eE=K{6zu>2 diff --git a/tests/data/acpi/x86/q35/DSDT.thread-count2 b/tests/data/acpi/x86/q35/DSDT.thread-count2 index 153b45f0f7443d25cecc2a752fb6dbd921160e78..d0394558a1faa0b4ba43abab66d474d96b477ff3 100644 GIT binary patch delta 93 zcmV-j0HXh`hyuTe0t!S^L{vY70004pu?nF90!|f^tpT_KL<*B<0&6rklWGbFa6w5# zSc8ac004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;^a447REFBZrY8sUWE%fnhTnvt=UyG{+SX diff --git a/tests/data/acpi/x86/q35/DSDT.tis.tpm12 b/tests/data/acpi/x86/q35/DSDT.tis.tpm12 index d0330d26a54b89c02a17b06ef5f55c72e28e406e..f2ed40ca70cb13e733e39f4bad756be8688e01fe 100644 GIT binary patch delta 91 zcmV-h0HpuKM%G3OL{mgmRwDoa0q(I1p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1P#`;29*6({ delta 73 zcmccScEpX#CDDA#LC3L%aBmu d=;;#C+>yh;(A<&3$dFW!)RDljnT0RZBZ6Nvx- diff --git a/tests/data/acpi/x86/q35/DSDT.tis.tpm2 b/tests/data/acpi/x86/q35/DSDT.tis.tpm2 index b05563deedc65df50f35b2399862d9ee8d4d1e0e..5c975d2162d0bfee5a3a089e79b5ba038f82b7ef 100644 GIT binary patch delta 91 zcmV-h0HpukM({=oL{mgma3cT!0jRMGp#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1Y9K)v9;yHU delta 73 zcmez1cF&E=CD-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaGZ30stb_6srIL diff --git a/tests/data/acpi/x86/q35/DSDT.type4-count b/tests/data/acpi/x86/q35/DSDT.type4-count index 00807e7fd4d758bc2ab9c69ac8869cf6864399f7..3194a82b8b4f66aff1ecf7d2d60b4890181fc600 100644 GIT binary patch delta 93 zcmV-j0HXikkpc3N0SZJ@L{#!f0003~u?nF90!|f^tpT_KL<*B<0&6rklWGbFa6w5# zSc8ac004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;^aAWfn6V%~ delta 75 zcmV-R0JQ(|kpbY50SZJ@L{#8N0004^u?nF90!$Q>tpT_KLJ5;+0&5~AlWGbFa1sRq h01W_Oa6w5#Sc8ac004uCYykjbaAJsH0J8=I>_utB7C-<1 diff --git a/tests/data/acpi/x86/q35/DSDT.viot b/tests/data/acpi/x86/q35/DSDT.viot index c3d83e67660ee3fd59f6fae6242270bed4a567f1..129d43e1e561be3fd7cd71406829ab81d0a8aba0 100644 GIT binary patch delta 91 zcmV-h0Hpuda_MpkL{mgmX*mD@0g$l@p#cI;6_c$2xB^59lV<{JG&hrK3I}jONkmwK xh-?4=gNSSa0Ag?w0s>&58j_KdVgQq34FCWC|8Qc6U;qGc4FHH>0kiZ1V>Vb!9{K

(KT@%~1xg^Wx-B9qrL?qG7_oSe>-t)x0Ri;KNLh?R+fmm#6R d(bFZOxg&>xp}8Z6ks+xdsUv}5GaGZV82~kR6#D=G diff --git a/tests/data/acpi/x86/q35/DSDT.xapic b/tests/data/acpi/x86/q35/DSDT.xapic index 227d421f16ed1824a87e8a91da734828f8b48cbf..b37ab591110d1c8201575ad6bba83449d7b90b21 100644 GIT binary patch delta 93 zcmV-j0HXiNmjc_D0t!S^L{!_00004lu?nF90!|f^tpT_KL<*B<0&6rklWGbFa6w5# zSc8ac004uCYykjba1sInV4xb3k&|KolVS}2|NsARVu)Y>0B{Weh+qM;^a9n0sf!?| delta 75 zcmV-R0JQ(xmjcO`0t!S^L{!O(0005fu?nF90!$Q>tpT_KLJ5;+0&5~AlWGbFa1sRq h01W_Oa6w5#Sc8ac004uCYykjbaAJsH0J8=I)rfXx7N`IK diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 085dfa9ff4..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,41 +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.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", -"tests/data/acpi/x86/q35/DSDT.acpierst", -"tests/data/acpi/x86/q35/DSDT.acpihmat", -"tests/data/acpi/x86/q35/DSDT.acpihmat-generic-x", -"tests/data/acpi/x86/q35/DSDT.acpihmat-noinitiator", -"tests/data/acpi/x86/q35/DSDT.applesmc", -"tests/data/acpi/x86/q35/DSDT.bridge", -"tests/data/acpi/x86/q35/DSDT.core-count", -"tests/data/acpi/x86/q35/DSDT.core-count2", -"tests/data/acpi/x86/q35/DSDT.cphp", -"tests/data/acpi/x86/q35/DSDT.cxl", -"tests/data/acpi/x86/q35/DSDT.dimmpxm", -"tests/data/acpi/x86/q35/DSDT.ipmibt", -"tests/data/acpi/x86/q35/DSDT.ipmismbus", -"tests/data/acpi/x86/q35/DSDT.ivrs", -"tests/data/acpi/x86/q35/DSDT.memhp", -"tests/data/acpi/x86/q35/DSDT.mmio64", -"tests/data/acpi/x86/q35/DSDT.multi-bridge", -"tests/data/acpi/x86/q35/DSDT.nohpet", -"tests/data/acpi/x86/q35/DSDT.numamem", -"tests/data/acpi/x86/q35/DSDT.pvpanic-isa", -"tests/data/acpi/x86/q35/DSDT.thread-count", -"tests/data/acpi/x86/q35/DSDT.thread-count2", -"tests/data/acpi/x86/q35/DSDT.tis.tpm12", -"tests/data/acpi/x86/q35/DSDT.tis.tpm2", -"tests/data/acpi/x86/q35/DSDT.type4-count", -"tests/data/acpi/x86/q35/DSDT.viot", -"tests/data/acpi/x86/q35/DSDT.xapic", From patchwork Wed Jan 15 18:10:55 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE5D1C02185 for ; Wed, 15 Jan 2025 18:17:02 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s0-0005O1-7H; Wed, 15 Jan 2025 13:12:00 -0500 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 1tY7r6-0000lW-82 for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:04 -0500 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 1tY7r4-00077x-Bu for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964661; 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=Ieq/emO2kCfQcvYMmdgz0oHLufowA4A3MNBfjxWyJVg=; b=VJhsabcz1xpKOvVHytzFwZK3eTbNbTLjduhhTOO3awNwxKvSjtowjB2diHCAL8xuLhkNzP crzDRihOi4He9P5zoTmxOjGseeMf+prUedC4sQS2JN9exCEX0Xof0Y5R+u8sw0qcVuOOJw I+i8PqaHjhEuX+nIUZVDZJ6EMiqaixU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-DBMRQMb4OV2i4NnDShcRMw-1; Wed, 15 Jan 2025 13:11:00 -0500 X-MC-Unique: DBMRQMb4OV2i4NnDShcRMw-1 X-Mimecast-MFC-AGG-ID: DBMRQMb4OV2i4NnDShcRMw Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-43619b135bcso37160845e9.1 for ; Wed, 15 Jan 2025 10:11:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964659; x=1737569459; 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=Ieq/emO2kCfQcvYMmdgz0oHLufowA4A3MNBfjxWyJVg=; b=BIRM6IgbTH2nWrdN1ESbzIC7D+4z4qh3v//3Rv+dlK9L6I/lcfRZycXn5WdDjREUB4 KloYymic/4/inDC8SwIKBF27nB9MeJDZC1+v8zHNmEmMzfilcK2xLu3k3RD0codBRNsz GVgOTHWK+Gz5TWOEU52V7n9MN24yob+Gxoqa/1mI+4itxn9cPoIx8Qt7EJitmH6Ucm2t kxb1yBYpMQ2EV2nB329daZMSEDx1r4B4hPUXilQJaG6I2bXINrgNrPWhv60wKSpAoOMd ce/A+Gzdewo+eXOrkpZ4Xc2jSD2AKJuLbFzI8oa0nJQNvLK2nI4z0su2rvBKWQ/oOpL3 BJ5w== X-Gm-Message-State: AOJu0YzW4IK1QbKAuEpcx/ORdGDj8Vv9aIGH+ElABEcyeWK5yjxZbq2+ zDrpVSQJ+mBJR+uF59gd/wpY/x0Fjh1ZkJEF1XG5ej5JrnrVQ1ASlpf9ko8fCZ8E+OTQj0uBo6w 1/+ZD0grCm24mM7U2dWhggVkXlTJ/l45otV1qwfYSpZ4Obr7wvLv0wHfKMFJYbp4xpeZHJdp19p cUwDe//M3FQpvXL0541a/2C6O46y5X9w== X-Gm-Gg: ASbGnctChRhVwtmSdWCjRh4L7lHrZlFG5DePlpTmWyj2P+MMDM1MMsnRoRUWFErJCMW YpC2paRprQrTgK/IogUETrStx9NP0QU4fPr4v0tEiMYCfQJAcoFEhUtVaVDFUe6QJgMVyVMHhZv yyIS1p6y5CvlnrVTwlvNx5JvSJBFM0Qh5T8BUTK0uvvjkLpVp56sdhHUP0PycFnaycnhOCKyKlc +tjlZ+vfR71M4C582bLVkVF/y7dWG+2+u4xrbwpCWf/3VQsF4ac X-Received: by 2002:a5d:47c4:0:b0:385:ed16:c8b with SMTP id ffacd0b85a97d-38a87309d21mr9907998f8f.23.1736964658790; Wed, 15 Jan 2025 10:10:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLCDO37xmN2YYCVJlGY1P/4rsU6aFfWIy5IGM73ClnFG3Gs9nsnEg2umS34cTlRMc0YOqSYw== X-Received: by 2002:a5d:47c4:0:b0:385:ed16:c8b with SMTP id ffacd0b85a97d-38a87309d21mr9907962f8f.23.1736964658375; Wed, 15 Jan 2025 10:10:58 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a8e38f0eesm18569909f8f.61.2025.01.15.10.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:10:57 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:55 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Li Zhijian , Jonathan Cameron , Fan Ni Subject: [PULL 46/48] hw/cxl: Fix msix_notify: Assertion `vector < dev->msix_entries_nr` Message-ID: <1ce979e7269a34d19ea1a65808df014d8b2acbf6.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Li Zhijian This assertion always happens when we sanitize the CXL memory device. $ echo 1 > /sys/bus/cxl/devices/mem0/security/sanitize It is incorrect to register an MSIX number beyond the device's capability. Increase the device's MSIX number to cover the mailbox msix number(9). Fixes: 43efb0bfad2b ("hw/cxl/mbox: Wire up interrupts for background completion") Signed-off-by: Li Zhijian Message-Id: <20250115075834.167504-1-lizhijian@fujitsu.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/mem/cxl_type3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index bd7652740f..0ae1704a34 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -843,7 +843,7 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp) ComponentRegisters *regs = &cxl_cstate->crb; MemoryRegion *mr = ®s->component_registers; uint8_t *pci_conf = pci_dev->config; - unsigned short msix_num = 6; + unsigned short msix_num = 10; int i, rc; uint16_t count; From patchwork Wed Jan 15 18:10:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940765 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5FEE4C02180 for ; Wed, 15 Jan 2025 18:19:03 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7s9-0006Oh-QZ; Wed, 15 Jan 2025 13:12:09 -0500 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 1tY7r9-0000x9-4K for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:07 -0500 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 1tY7r7-00078O-4l for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964664; 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=R1Q6ecuMvkKdBN1XJ6lghkDja+Y8Z2DVDPha29KkwYw=; b=V7XUigFwNJb1voOUQ1XlNTPD/7M8WOxDQDFITYEtIFS+0h6ka9vFS1SrI++QTNxm3dfIAB Pnj22CCzqmjYXK1VZt+3vjcdgKhM0JxvjBskJknopPJ5ig0VPCUdotxaA7yAxKPRoHmXX7 a31rxYNC6IX53oM34/jgQ5xHecrxrFA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-Qzu4RRtUOWSo7jaRzdPUew-1; Wed, 15 Jan 2025 13:11:03 -0500 X-MC-Unique: Qzu4RRtUOWSo7jaRzdPUew-1 X-Mimecast-MFC-AGG-ID: Qzu4RRtUOWSo7jaRzdPUew Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3862be3bfc9so52986f8f.3 for ; Wed, 15 Jan 2025 10:11:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964661; x=1737569461; 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=R1Q6ecuMvkKdBN1XJ6lghkDja+Y8Z2DVDPha29KkwYw=; b=jEph52BVeCjYespOhF0aBi2H+OYt1b4xqiOYky+BBA4FtDCVwVZbSSDF7EWpVL/YiG C0MkbvbUJlh31nJA2Nk6UvX5kWUUjq8l3uw9jr18twoW6OQBa9oBXgaygBeOARHWjiTR r+ev/B4jkTKqvEBoIGbSw3CpANDrEZNPI8h+QtYsYUxmyMNU4wpp0EYUt+tXLqzT5kV4 s32rFH3UdmkF4+F3ISaJsfeZ/SRHG7xQH/vvgynKmhZzfLzvAxe8lnxqRz+JegVesDTJ qKRmZNYdT2qwxbcS2nmZ6vaGFyhlmNgHZ34xoK0yxrCSTTnQnuse1FK1fIhdPz4VOouJ 40tQ== X-Gm-Message-State: AOJu0Yy29rwKN+p3XbqyhU1nAaKJ6/br7tLnomRz76qCbez313LthYWd DajHUOwnQkLP/hBRtlrRZRfDhNhRg5Y97/fZPi3aiv1gLX7Y5Onl13nctOb0rBTehISOnIgXgba oxKa5MyngAPTriq9uxu5XXOvld5AP2bpj3Fe/Qiz/cppqqOT2lZLdWQEeebXGVlQI1chu5ACyu7 /GljKok5sRSKoKbgnV3imDr1q+ORgNZg== X-Gm-Gg: ASbGncuuDxZynMKda9I8m5tBecbtxrqlKYJ35nJsO/Z52NPd50HU/Fx+IqMDh9EFAHW AKzDZR1j69WoF6RRlesu+9cyOD66LvkfVVIg2wC93GcyR6/n6/dmOxjy08uiP7o8Zvt7+NPClMf djXz1fKxc2HAa7pvWkbj9fZoWuXFGB+QWralrjzO3RT/HtQXuNcFpo4QJcIAt7ZfrD5R9vakMDl bdzi+KPmI7+Xt7wRaBXSLJ+OznKuFoszomf7vZse3DVf8bgc5ef X-Received: by 2002:a5d:598d:0:b0:385:f72a:a3b0 with SMTP id ffacd0b85a97d-38a8733a3ecmr25541576f8f.55.1736964661560; Wed, 15 Jan 2025 10:11:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUKM3Qq74VPjvClTWSW0xtGkd/Kupo29cYE32UuFQwfVMQdyPwk8ZEp2D+CUizXZ1xzzR3VA== X-Received: by 2002:a5d:598d:0:b0:385:f72a:a3b0 with SMTP id ffacd0b85a97d-38a8733a3ecmr25541540f8f.55.1736964661098; Wed, 15 Jan 2025 10:11:01 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c75290a2sm32182865e9.29.2025.01.15.10.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:11:00 -0800 (PST) Date: Wed, 15 Jan 2025 13:10:58 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laurent Vivier , Hanna Czenczek Subject: [PULL 47/48] vhost: Add stubs for the migration state transfer interface Message-ID: <3f65357313e0f928e0bd3ff868b705855d0405bc.1736964488.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 client-ip=170.10.133.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -39 X-Spam_score: -4.0 X-Spam_bar: ---- X-Spam_report: (-4.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.141, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.793, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Laurent Vivier Migration state transfer interface is only used by vhost-user-fs, so the interface needs to be defined only when vhost is built. But I need to use this interface with virtio-net and vhost is not always enabled, and to avoid undefined reference error during build, define stub functions for vhost_supports_device_state(), vhost_save_backend_state() and vhost_load_backend_state(). Cc: Hanna Czenczek Signed-off-by: Laurent Vivier Message-Id: <20250115135044.799698-2-lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 461c168c37..a9469d50bc 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -365,7 +365,14 @@ static inline int vhost_reset_device(struct vhost_dev *hdev) * Returns true if the device supports these commands, and false if it * does not. */ +#ifdef CONFIG_VHOST bool vhost_supports_device_state(struct vhost_dev *dev); +#else +static inline bool vhost_supports_device_state(struct vhost_dev *dev) +{ + return false; +} +#endif /** * vhost_set_device_state_fd(): Begin transfer of internal state from/to @@ -448,7 +455,15 @@ int vhost_check_device_state(struct vhost_dev *dev, Error **errp); * * Returns 0 on success, and -errno otherwise. */ +#ifdef CONFIG_VHOST int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); +#else +static inline int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, + Error **errp) +{ + return -ENOSYS; +} +#endif /** * vhost_load_backend_state(): High-level function to load a vhost @@ -465,6 +480,14 @@ int vhost_save_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); * * Returns 0 on success, and -errno otherwise. */ +#ifdef CONFIG_VHOST int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, Error **errp); +#else +static inline int vhost_load_backend_state(struct vhost_dev *dev, QEMUFile *f, + Error **errp) +{ + return -ENOSYS; +} +#endif #endif From patchwork Wed Jan 15 18:11:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 13940734 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02BF9C02180 for ; Wed, 15 Jan 2025 18:12:43 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tY7sL-0007H2-Ts; Wed, 15 Jan 2025 13:12:21 -0500 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 1tY7rB-00018L-OX for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:10 -0500 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 1tY7r9-00078p-SW for qemu-devel@nongnu.org; Wed, 15 Jan 2025 13:11:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1736964667; 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=BEGdjo90qqstcjYDzVJsyocDHaSy9bqqB/C1TwUZ5n8=; b=VWgSJnGcpdytGHcWBgh9IesEXsGZDhTfr+VtMU9Yj43k97FltUI3wpCvXbl228VTcEx2RE gSlCdl2ZPjtoSzmZ0el5WhuyeCpTLmJ/nDt9GVgmM5NnK6+BJ9FCtUzafQh/YDcU6hCGv1 0xyAvGJ2ONjhqjuL7ZKL/iHNn6jL6Mc= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-427-lXlZ7V0zPDmaN1bTpWk4gA-1; Wed, 15 Jan 2025 13:11:05 -0500 X-MC-Unique: lXlZ7V0zPDmaN1bTpWk4gA-1 X-Mimecast-MFC-AGG-ID: lXlZ7V0zPDmaN1bTpWk4gA Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-4361ecebc5bso36870885e9.1 for ; Wed, 15 Jan 2025 10:11:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736964664; x=1737569464; 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=BEGdjo90qqstcjYDzVJsyocDHaSy9bqqB/C1TwUZ5n8=; b=JnIzb87/z0J2Qpuln8NtOInGf8OTJTT3Mg1Z3/1b+2J2+YwW40t3/VQQRAFp7KL+Kr EM7YAS3JYVSCW6f144nfQiuFSxZ0LsOD2Sz5u0YD5Vz9tXeOvoDdKvNS7yOY8Cj7kD/s mc9AkZ36Fsvx6j6XBcCq00TDC/fyC9UsMxQe1wkTb/5sjwKBV9LjQcT8zUrtrwF+cWhw jVYzRaqxhJbdQ0rw7UZyRRP1Xq2ONpDjISfujU9zyrBaO8xQsH9b9cIR7DmxTjE4m0LJ 8UDl1muXPtW3D3YMroeMAbkUMyXkYfdfru7EcS/A2bzFSoyhV3lSVgj5SdyPUxH2XJhi f6Wg== X-Gm-Message-State: AOJu0YxPFZjytznZ/biLfC5wKFesxnsrd/jQw9BxQXOrmDbJaXYcwq1a HRnrM/AY1Ggo6nts3TETR3b1M542eRifie0lLuo5RuQaKb+/yWGaWet8KEF0pN9TEj0kACs7Fs4 HwjcRoiGrB2au1wT8TBEE7smFfxfv/XEswGql2HNEhiPHCd+4cJn4XVhOBqbL1upt1+YDsRRXCZ zDt7vv94yIktFJL4vfpKE4lcUCnHc5ug== X-Gm-Gg: ASbGncv+SpyZt5gXJb6fASGvdYKdG2GwqOtu+9jRn4wKdP1pokMbeJgR5s3dn7D9ysj sXXjGkA+lSdxBzOzjb6LYIjcpRgLbOhSI6YHzKhPpwroyi60CE3I+pveoY8JAQzz9s4E+oYEWj8 S0WPBs0OfomG4CTOOt0Vfa+9VGfh3CBOv4adsYzz1im36TmnW78oh/jbdTutymqlw3wC24Tnkdj m1d/oUR3i3tVxgFR8FDAPFdC+iV7yMEoFPv9VvNADk4ybXWKQGQ X-Received: by 2002:a05:600c:4586:b0:431:44fe:fd9f with SMTP id 5b1f17b1804b1-436e26f041bmr246316635e9.23.1736964664352; Wed, 15 Jan 2025 10:11:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+V2hQZZ9f5rOnSH6Sk4dEveyDzjCfNx8NCFMjPNHi2wdKyOzMNhGHuNbivQsZb3eiaxAPNg== X-Received: by 2002:a05:600c:4586:b0:431:44fe:fd9f with SMTP id 5b1f17b1804b1-436e26f041bmr246316375e9.23.1736964663942; Wed, 15 Jan 2025 10:11:03 -0800 (PST) Received: from redhat.com ([2a0d:6fc7:342:db8c:4ec4:322b:a6a8:f411]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74e5e69sm31081175e9.37.2025.01.15.10.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 10:11:03 -0800 (PST) Date: Wed, 15 Jan 2025 13:11:01 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Laurent Vivier , Hanna Czenczek , Jason Wang Subject: [PULL 48/48] virtio-net: vhost-user: Implement internal migration Message-ID: <60f543ad917fad731e39ff8ce2ca83b9a9cc9d90.1736964488.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 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.141, 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_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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Laurent Vivier Add support of VHOST_USER_PROTOCOL_F_DEVICE_STATE in virtio-net with vhost-user backend. Cc: Hanna Czenczek Signed-off-by: Laurent Vivier Message-Id: <20250115135044.799698-3-lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/net/virtio-net.c | 135 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 112 insertions(+), 23 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 06f096abf6..85e14b788c 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3337,6 +3337,117 @@ static const VMStateDescription vmstate_virtio_net_rss = { }, }; +static struct vhost_dev *virtio_net_get_vhost(VirtIODevice *vdev) +{ + VirtIONet *n = VIRTIO_NET(vdev); + NetClientState *nc; + struct vhost_net *net; + + if (!n->nic) { + return NULL; + } + + nc = qemu_get_queue(n->nic); + if (!nc) { + return NULL; + } + + net = get_vhost_net(nc->peer); + if (!net) { + return NULL; + } + + return &net->dev; +} + +static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, + JSONWriter *vmdesc) +{ + VirtIONet *n = pv; + VirtIODevice *vdev = VIRTIO_DEVICE(n); + struct vhost_dev *vhdev; + Error *local_error = NULL; + int ret; + + vhdev = virtio_net_get_vhost(vdev); + if (vhdev == NULL) { + error_reportf_err(local_error, + "Error getting vhost back-end of %s device %s: ", + vdev->name, vdev->parent_obj.canonical_path); + return -1; + } + + ret = vhost_save_backend_state(vhdev, f, &local_error); + if (ret < 0) { + error_reportf_err(local_error, + "Error saving back-end state of %s device %s: ", + vdev->name, vdev->parent_obj.canonical_path); + return ret; + } + + return 0; +} + +static int vhost_user_net_load_state(QEMUFile *f, void *pv, size_t size, + const VMStateField *field) +{ + VirtIONet *n = pv; + VirtIODevice *vdev = VIRTIO_DEVICE(n); + struct vhost_dev *vhdev; + Error *local_error = NULL; + int ret; + + vhdev = virtio_net_get_vhost(vdev); + if (vhdev == NULL) { + error_reportf_err(local_error, + "Error getting vhost back-end of %s device %s: ", + vdev->name, vdev->parent_obj.canonical_path); + return -1; + } + + ret = vhost_load_backend_state(vhdev, f, &local_error); + if (ret < 0) { + error_reportf_err(local_error, + "Error loading back-end state of %s device %s: ", + vdev->name, vdev->parent_obj.canonical_path); + return ret; + } + + return 0; +} + +static bool vhost_user_net_is_internal_migration(void *opaque) +{ + VirtIONet *n = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(n); + struct vhost_dev *vhdev; + + vhdev = virtio_net_get_vhost(vdev); + if (vhdev == NULL) { + return false; + } + + return vhost_supports_device_state(vhdev); +} + +static const VMStateDescription vhost_user_net_backend_state = { + .name = "virtio-net-device/backend", + .version_id = 0, + .needed = vhost_user_net_is_internal_migration, + .fields = (const VMStateField[]) { + { + .name = "backend", + .info = &(const VMStateInfo) { + .name = "virtio-net vhost-user backend state", + .get = vhost_user_net_load_state, + .put = vhost_user_net_save_state, + }, + }, + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_virtio_net_device = { .name = "virtio-net-device", .version_id = VIRTIO_NET_VM_VERSION, @@ -3389,6 +3500,7 @@ static const VMStateDescription vmstate_virtio_net_device = { }, .subsections = (const VMStateDescription * const []) { &vmstate_virtio_net_rss, + &vhost_user_net_backend_state, NULL } }; @@ -3950,29 +4062,6 @@ static bool dev_unplug_pending(void *opaque) return vdc->primary_unplug_pending(dev); } -static struct vhost_dev *virtio_net_get_vhost(VirtIODevice *vdev) -{ - VirtIONet *n = VIRTIO_NET(vdev); - NetClientState *nc; - struct vhost_net *net; - - if (!n->nic) { - return NULL; - } - - nc = qemu_get_queue(n->nic); - if (!nc) { - return NULL; - } - - net = get_vhost_net(nc->peer); - if (!net) { - return NULL; - } - - return &net->dev; -} - static const VMStateDescription vmstate_virtio_net = { .name = "virtio-net", .minimum_version_id = VIRTIO_NET_VM_VERSION,