From patchwork Wed Mar 8 01:10:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753766 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QARiOaS+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ5Q31tDz1yWm for ; Wed, 8 Mar 2023 12:11:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKc-0007wP-1P; Tue, 07 Mar 2023 20:11:02 -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 1pZiKa-0007w3-Oh for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11: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 1pZiKY-0001Tu-Ll for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237858; 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=McBtSOGEBTJvsblVq2tLEPlzp+2+oHjiJJpbaZ1J1gc=; b=QARiOaS+JBgS9WL4xhWyLxyaS5udh0DSufG+JUElefyIRaJAnruns5tu2CMOESt4Cx3ta4 N1XUDErawdmQyhnbMMoIu8Yh198gtjA2qZhxMB/sNGVBV5CMbfEVoTI/TS7E/rgqSEV2oX mX52L1IMWvFK6KHzzzIjDzNtsie7FDw= 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-67-ZDQD6XP2NkSWlowl8fgffQ-1; Tue, 07 Mar 2023 20:10:56 -0500 X-MC-Unique: ZDQD6XP2NkSWlowl8fgffQ-1 Received: by mail-wm1-f70.google.com with SMTP id j6-20020a05600c1c0600b003eaf882cb85so113772wms.9 for ; Tue, 07 Mar 2023 17:10:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237854; 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=McBtSOGEBTJvsblVq2tLEPlzp+2+oHjiJJpbaZ1J1gc=; b=yu5qlTcst+3YRKSSDtALrkYA1N+qgCY3/SUtCdQ5nliSxTqq/+n83TQk+FvSyVeh0y p/Wnw7bB8qyKjCygRmK6gLcQSm6zVN7c/hXke/YHJClPSVtFCL8IQ44Mp3Sm7pujhgRM yv8NGQo/owW8ITXEUrSiPDJtvJQ7gABc71KhY4yEwwHN7iKp983fm5eCkyxBbz7H4xXH ZAc1NFW3/zriQ4nzKHpmFizn21owDtolIiGbcXdWHJfjtW3TJtaLli9K5wLPixqlN1IX ZRZOmSukgc2JS001MUm31r/BskOSH9KBxRztKJ00w+jGdt0IgjcBu9i63lRclQ7MT3Vj ck+A== X-Gm-Message-State: AO0yUKVLhIYx+EpD+gz/IAwmAonLKZ5agrDW++by41VB7SYmAWqzDgI1 u6BC1UefxCMBeybBJmP7MgUO00Yyo3TuMzhrishSAbUsVU9IVf1qH9U3hjj49Tjg7ZPcaI62tYV UaREjN+4P2AAesKnMgRWMTx/MSkL+3mhEqMz2iY3qVOMObZPTrkYygN4OKSrjEfelSYnM X-Received: by 2002:a5d:624a:0:b0:2c8:42b5:8022 with SMTP id m10-20020a5d624a000000b002c842b58022mr8288236wrv.59.1678237854319; Tue, 07 Mar 2023 17:10:54 -0800 (PST) X-Google-Smtp-Source: AK7set8UtbTy9SVhu0dz4ps+FopnDKgWKrkS6ZWJgj9tr3J3ZX6xAkLyF68+uV4ZMxpWkuZKeVXeBA== X-Received: by 2002:a5d:624a:0:b0:2c8:42b5:8022 with SMTP id m10-20020a5d624a000000b002c842b58022mr8288217wrv.59.1678237853973; Tue, 07 Mar 2023 17:10:53 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id x5-20020a5d4445000000b002c70a0e2cd0sm13666743wrr.101.2023.03.07.17.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:10:53 -0800 (PST) Date: Tue, 7 Mar 2023 20:10:51 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Eric Blake , Markus Armbruster , Michael Roth Subject: [PULL 01/73] cryptodev: Introduce cryptodev.json Message-ID: <14c9fd1673ac8c6855a93c882870da8403b5a5d6.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Introduce QCryptodevBackendType in cryptodev.json, also apply this to related codes. Then we can drop 'enum CryptoDevBackendOptionsType'. Note that `CRYPTODEV_BACKEND_TYPE_NONE` is *NOT* used by anywhere, so drop it(no 'none' enum in QCryptodevBackendType). Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-2-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cryptodev.json | 20 ++++++++++++++++++++ qapi/qapi-schema.json | 1 + include/sysemu/cryptodev.h | 11 ++--------- backends/cryptodev-builtin.c | 2 +- backends/cryptodev-lkcf.c | 2 +- backends/cryptodev-vhost-user.c | 4 ++-- backends/cryptodev-vhost.c | 4 ++-- MAINTAINERS | 1 + qapi/meson.build | 1 + 9 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 qapi/cryptodev.json diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json new file mode 100644 index 0000000000..b65edbe183 --- /dev/null +++ b/qapi/cryptodev.json @@ -0,0 +1,20 @@ +# -*- Mode: Python -*- +# vim: filetype=python +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @QCryptodevBackendType: +# +# The crypto device backend type +# +# @builtin: the QEMU builtin support +# @vhost-user: vhost-user +# @lkcf: Linux kernel cryptographic framework +# +# Since: 8.0 +## +{ 'enum': 'QCryptodevBackendType', + 'prefix': 'QCRYPTODEV_BACKEND_TYPE', + 'data': ['builtin', 'vhost-user', 'lkcf']} diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index f000b90744..1e923945db 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -95,3 +95,4 @@ { 'include': 'pci.json' } { 'include': 'stats.json' } { 'include': 'virtio.json' } +{ 'include': 'cryptodev.json' } diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index cf9b3f07fe..8d2adda974 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -25,6 +25,7 @@ #include "qemu/queue.h" #include "qom/object.h" +#include "qapi/qapi-types-cryptodev.h" /** * CryptoDevBackend: @@ -215,16 +216,8 @@ struct CryptoDevBackendClass { void *opaque); }; -typedef enum CryptoDevBackendOptionsType { - CRYPTODEV_BACKEND_TYPE_NONE = 0, - CRYPTODEV_BACKEND_TYPE_BUILTIN = 1, - CRYPTODEV_BACKEND_TYPE_VHOST_USER = 2, - CRYPTODEV_BACKEND_TYPE_LKCF = 3, - CRYPTODEV_BACKEND_TYPE__MAX, -} CryptoDevBackendOptionsType; - struct CryptoDevBackendClient { - CryptoDevBackendOptionsType type; + QCryptodevBackendType type; char *model; char *name; char *info_str; diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index cda6ca3b71..8c7c10847d 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -76,7 +76,7 @@ static void cryptodev_builtin_init( "cryptodev-builtin", NULL); cc->info_str = g_strdup_printf("cryptodev-builtin0"); cc->queue_index = 0; - cc->type = CRYPTODEV_BACKEND_TYPE_BUILTIN; + cc->type = QCRYPTODEV_BACKEND_TYPE_BUILTIN; backend->conf.peers.ccs[0] = cc; backend->conf.crypto_services = diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index 133bd706a4..91e02c0df9 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -226,7 +226,7 @@ static void cryptodev_lkcf_init(CryptoDevBackend *backend, Error **errp) cc = cryptodev_backend_new_client("cryptodev-lkcf", NULL); cc->info_str = g_strdup_printf("cryptodev-lkcf0"); cc->queue_index = 0; - cc->type = CRYPTODEV_BACKEND_TYPE_LKCF; + cc->type = QCRYPTODEV_BACKEND_TYPE_LKCF; backend->conf.peers.ccs[0] = cc; backend->conf.crypto_services = diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index ab3028e045..c165a1b1d6 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -67,7 +67,7 @@ cryptodev_vhost_user_get_vhost( { CryptoDevBackendVhostUser *s = CRYPTODEV_BACKEND_VHOST_USER(b); - assert(cc->type == CRYPTODEV_BACKEND_TYPE_VHOST_USER); + assert(cc->type == QCRYPTODEV_BACKEND_TYPE_VHOST_USER); assert(queue < MAX_CRYPTO_QUEUE_NUM); return s->vhost_crypto[queue]; @@ -203,7 +203,7 @@ static void cryptodev_vhost_user_init( cc->info_str = g_strdup_printf("cryptodev-vhost-user%zu to %s ", i, chr->label); cc->queue_index = i; - cc->type = CRYPTODEV_BACKEND_TYPE_VHOST_USER; + cc->type = QCRYPTODEV_BACKEND_TYPE_VHOST_USER; backend->conf.peers.ccs[i] = cc; diff --git a/backends/cryptodev-vhost.c b/backends/cryptodev-vhost.c index 74ea0ad63d..93523732f3 100644 --- a/backends/cryptodev-vhost.c +++ b/backends/cryptodev-vhost.c @@ -127,7 +127,7 @@ cryptodev_get_vhost(CryptoDevBackendClient *cc, switch (cc->type) { #if defined(CONFIG_VHOST_USER) && defined(CONFIG_LINUX) - case CRYPTODEV_BACKEND_TYPE_VHOST_USER: + case QCRYPTODEV_BACKEND_TYPE_VHOST_USER: vhost_crypto = cryptodev_vhost_user_get_vhost(cc, b, queue); break; #endif @@ -195,7 +195,7 @@ int cryptodev_vhost_start(VirtIODevice *dev, int total_queues) * because vhost user doesn't interrupt masking/unmasking * properly. */ - if (cc->type == CRYPTODEV_BACKEND_TYPE_VHOST_USER) { + if (cc->type == QCRYPTODEV_BACKEND_TYPE_VHOST_USER) { dev->use_guest_notifier_mask = false; } } diff --git a/MAINTAINERS b/MAINTAINERS index 5340de0515..cbb05de8eb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2879,6 +2879,7 @@ M: Gonglei S: Maintained F: include/sysemu/cryptodev*.h F: backends/cryptodev*.c +F: qapi/cryptodev.json Python library M: John Snow diff --git a/qapi/meson.build b/qapi/meson.build index fbdb442fdf..1c37ae7491 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -56,6 +56,7 @@ if have_system qapi_all_modules += [ 'acpi', 'audio', + 'cryptodev', 'qdev', 'pci', 'rdma', From patchwork Wed Mar 8 01:10:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NOU01km8; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ791zJmz1yWm for ; Wed, 8 Mar 2023 12:12:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKg-0008CO-Ak; Tue, 07 Mar 2023 20:11:06 -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 1pZiKe-00082Y-A4 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20: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 1pZiKc-0001UA-G3 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237861; 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=K0THZO2ut7vkZDqLfF6bLkw4mZcd8okDWsTM1o8ijpw=; b=NOU01km8ee3cu9dJUa+iwe+NzrXRtqxnXjV2hoHk+mf+0D8Hlo6Tcey3bPA3f/xO7pkNVq T8WHv2A2EOmhaKCAY4XpvAtB8l/JiQiXkVD1UXJDfx//wkkcM2pUMVsYL1onYmInw+hYAn l9WUAz4c92kBqcF/otsKo8sozoXOJ3k= 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-265-7jBOmlq4O7OYLmq64ox_cQ-1; Tue, 07 Mar 2023 20:11:00 -0500 X-MC-Unique: 7jBOmlq4O7OYLmq64ox_cQ-1 Received: by mail-wm1-f72.google.com with SMTP id t1-20020a7bc3c1000000b003dfe223de49so199731wmj.5 for ; Tue, 07 Mar 2023 17:10:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237858; 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=K0THZO2ut7vkZDqLfF6bLkw4mZcd8okDWsTM1o8ijpw=; b=0/vMelFPWs+MZj/SzmlQ2zHcqrrbUqMvMD/xDqdxwDXzA/UkWTGGZVJOGpZFH+lVS5 hcRQG7aoACl2Qe2aISOeBsSwN+BkCHD2gwtMwqciQ+sx2Yx6tT9hIBofLvUaH6atXLv9 udSQ4pv0gtvN3Jwj7k4Ys1Ry7URT3CDGTjTs5+WJCWdHGuT6yYlISXOZ83qR+BQ220eC NW71znrRGEjNZMRJH6682Bjhmzqnj6LWDe0BBA7ECSVrboYHwhLTm25ujO3oaK9kJhMd GaNPqTxNEFutGpLeTBSa/KF77HYlmvEdwy24JfWZZTLiT1v8UtsEBEDo+WtWnJJ8HufH unng== X-Gm-Message-State: AO0yUKWHeqRmqZ9XOjycnFg09h+UqUP4+ewgS+RRuCONfmKXDLmjrMeE ihtXzOcDhOLbf9mS3ox0rAX4Ho3+/ASn7nMbKee2Y5T8uldjv3Qm1ReDL3IS3/XWOltpixPn6Iw X+fGMSbqHE5uWs82aWsRg51GNd1eI7YPjx+doW4991L+fX8JAypWi7o/ZIKlKIZNCKY2K X-Received: by 2002:a05:600c:1992:b0:3e2:9b4:4303 with SMTP id t18-20020a05600c199200b003e209b44303mr14672197wmq.19.1678237858469; Tue, 07 Mar 2023 17:10:58 -0800 (PST) X-Google-Smtp-Source: AK7set9SOru86d4P+TNx5MzyHjaFTR4fSl3x5kSmR7s7CvrWfPRzuL2NEYU6/bZTbeoYf+8+UcgWSQ== X-Received: by 2002:a05:600c:1992:b0:3e2:9b4:4303 with SMTP id t18-20020a05600c199200b003e209b44303mr14672168wmq.19.1678237857973; Tue, 07 Mar 2023 17:10:57 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id s25-20020a05600c319900b003db03725e86sm14135921wmp.8.2023.03.07.17.10.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:10:57 -0800 (PST) Date: Tue, 7 Mar 2023 20:10:54 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" Subject: [PULL 02/73] cryptodev: Remove 'name' & 'model' fields Message-ID: <3f478371fde24778ac09b4f7ffa82b00e87a97ec.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi We have already used qapi to generate crypto device types, this allows to convert type to a string 'model', so the 'model' field is not needed. And the 'name' field is not used by any backend driver, drop it. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-3-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/sysemu/cryptodev.h | 12 +++--------- backends/cryptodev-builtin.c | 3 +-- backends/cryptodev-lkcf.c | 2 +- backends/cryptodev-vhost-user.c | 3 +-- backends/cryptodev.c | 11 +---------- 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index 8d2adda974..af152d09db 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -218,8 +218,6 @@ struct CryptoDevBackendClass { struct CryptoDevBackendClient { QCryptodevBackendType type; - char *model; - char *name; char *info_str; unsigned int queue_index; int vring_enable; @@ -264,11 +262,8 @@ struct CryptoDevBackend { /** * cryptodev_backend_new_client: - * @model: the cryptodev backend model - * @name: the cryptodev backend name, can be NULL * - * Creates a new cryptodev backend client object - * with the @name in the model @model. + * Creates a new cryptodev backend client object. * * The returned object must be released with * cryptodev_backend_free_client() when no @@ -276,9 +271,8 @@ struct CryptoDevBackend { * * Returns: a new cryptodev backend client object */ -CryptoDevBackendClient * -cryptodev_backend_new_client(const char *model, - const char *name); +CryptoDevBackendClient *cryptodev_backend_new_client(void); + /** * cryptodev_backend_free_client: * @cc: the cryptodev backend client object diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 8c7c10847d..08895271eb 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -72,8 +72,7 @@ static void cryptodev_builtin_init( return; } - cc = cryptodev_backend_new_client( - "cryptodev-builtin", NULL); + cc = cryptodev_backend_new_client(); cc->info_str = g_strdup_printf("cryptodev-builtin0"); cc->queue_index = 0; cc->type = QCRYPTODEV_BACKEND_TYPE_BUILTIN; diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index 91e02c0df9..de3d1867c5 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -223,7 +223,7 @@ static void cryptodev_lkcf_init(CryptoDevBackend *backend, Error **errp) return; } - cc = cryptodev_backend_new_client("cryptodev-lkcf", NULL); + cc = cryptodev_backend_new_client(); cc->info_str = g_strdup_printf("cryptodev-lkcf0"); cc->queue_index = 0; cc->type = QCRYPTODEV_BACKEND_TYPE_LKCF; diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index c165a1b1d6..580bd1abb0 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -198,8 +198,7 @@ static void cryptodev_vhost_user_init( s->opened = true; for (i = 0; i < queues; i++) { - cc = cryptodev_backend_new_client( - "cryptodev-vhost-user", NULL); + cc = cryptodev_backend_new_client(); cc->info_str = g_strdup_printf("cryptodev-vhost-user%zu to %s ", i, chr->label); cc->queue_index = i; diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 54ee8c81f5..81941af816 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -34,18 +34,11 @@ static QTAILQ_HEAD(, CryptoDevBackendClient) crypto_clients; -CryptoDevBackendClient * -cryptodev_backend_new_client(const char *model, - const char *name) +CryptoDevBackendClient *cryptodev_backend_new_client(void) { CryptoDevBackendClient *cc; cc = g_new0(CryptoDevBackendClient, 1); - cc->model = g_strdup(model); - if (name) { - cc->name = g_strdup(name); - } - QTAILQ_INSERT_TAIL(&crypto_clients, cc, next); return cc; @@ -55,8 +48,6 @@ void cryptodev_backend_free_client( CryptoDevBackendClient *cc) { QTAILQ_REMOVE(&crypto_clients, cc, next); - g_free(cc->name); - g_free(cc->model); g_free(cc->info_str); g_free(cc); } From patchwork Wed Mar 8 01:10:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753829 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c9NrXHo4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJB4KNpz1yWp for ; Wed, 8 Mar 2023 12:20:42 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKi-0008M7-1h; Tue, 07 Mar 2023 20:11:08 -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 1pZiKg-0008CA-Ez for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:06 -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 1pZiKe-0001UN-7f for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237863; 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=+n2903OEBoDs4//94l8pk5jICPgWucbjyFt83qTfpN8=; b=c9NrXHo4VS0C1AL3vfObe6T3i5SPyAzHR3E77Ipo2fzkDnVo9s9DFK7Su5JEw3tztHWVid rVF3J67qQlWCvn3Pyjs7OOIQEoDR0uUTBukcF5npiLY9m17jL3crgKzQLX9pSCIuN604Y3 TmqBd+U5DR1tuLgk+KLlR9eO4HK0wdQ= 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-MeR0kYfbMFm9_i3s-N5WBw-1; Tue, 07 Mar 2023 20:11:02 -0500 X-MC-Unique: MeR0kYfbMFm9_i3s-N5WBw-1 Received: by mail-wm1-f69.google.com with SMTP id k36-20020a05600c1ca400b003eac86e4387so194407wms.8 for ; Tue, 07 Mar 2023 17:11:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237861; 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=+n2903OEBoDs4//94l8pk5jICPgWucbjyFt83qTfpN8=; b=yUkZOR6XUs170YyuBKJ7GH1H4bXl0kcwmpLytH6mUrXfgw33QILpuBQeo6WPAkAoI+ 4ngkpzG8eJ/AwA0GBtN3lMJA4PXiJyCoyJ7YRBApVVJsfSffDlgyGxrMMjWWUUDaS+Uu 4EWXNNufT4Sn+BXnUDhaXHZU4qFL5SOv+XGispEV40uWERfeoGccX/3PPvdsfL2OmHGI HB1m1RGhqaerbDv5rWDOvDa0jGHxC9gqbaAJcgSKHBVUvlBeQTzu+h2TSPAczEhSN35Y I+dPBI+XAvhzNwDRZcA4yZVnV+liCyhC3rs64N8pNv+pWoQ1daI+hICc47DtzxqnoRoE 3rmQ== X-Gm-Message-State: AO0yUKW3tIdkpPDsje/EJ9F1SXhwM93gWpsg/O/IciruXi15daEy9sqB vhlpu+BOHJlvsWtGlZss+Ks77X4yYmbm90Z6DqhVqrhz276TjUwj7wblZj6u9xf3haShcAUdF/e JReA1HBHzeb5oqCAUFRKyJCayvKRYjE+dCE82DP1zcr3wHbS+E7b21tCgZMwjHMmMh5T5 X-Received: by 2002:adf:fc52:0:b0:2c5:4a22:937c with SMTP id e18-20020adffc52000000b002c54a22937cmr13439911wrs.27.1678237861245; Tue, 07 Mar 2023 17:11:01 -0800 (PST) X-Google-Smtp-Source: AK7set+wYpLtyvkYUn4LhzTb3nOrhA5BYHiQzGTG50WIvtMASomztirHSCkV6YXy+w/Zm/IOC0NZFQ== X-Received: by 2002:adf:fc52:0:b0:2c5:4a22:937c with SMTP id e18-20020adffc52000000b002c54a22937cmr13439894wrs.27.1678237860890; Tue, 07 Mar 2023 17:11:00 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id n1-20020adffe01000000b002c4084d3472sm14011325wrr.58.2023.03.07.17.10.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:00 -0800 (PST) Date: Tue, 7 Mar 2023 20:10:58 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Eric Blake , Markus Armbruster Subject: [PULL 03/73] cryptodev: Introduce cryptodev alg type in QAPI Message-ID: <999c789f0018151906484c25faff495b89b549dc.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Introduce cryptodev alg type in cryptodev.json, then apply this to related codes, and drop 'enum CryptoDevBackendAlgType'. There are two options: 1, { 'enum': 'QCryptodevBackendAlgType', 'prefix': 'CRYPTODEV_BACKEND_ALG', 'data': ['sym', 'asym']} Then we can keep 'CRYPTODEV_BACKEND_ALG_SYM' and avoid lots of changes. 2, changes in this patch(with prefix 'QCRYPTODEV_BACKEND_ALG'). To avoid breaking the rule of QAPI, use 2 here. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-4-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cryptodev.json | 14 ++++++++++++++ include/sysemu/cryptodev.h | 8 +------- backends/cryptodev-builtin.c | 6 +++--- backends/cryptodev-lkcf.c | 4 ++-- backends/cryptodev.c | 6 +++--- hw/virtio/virtio-crypto.c | 14 +++++++------- 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json index b65edbe183..ebb6852035 100644 --- a/qapi/cryptodev.json +++ b/qapi/cryptodev.json @@ -4,6 +4,20 @@ # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. +## +# @QCryptodevBackendAlgType: +# +# The supported algorithm types of a crypto device. +# +# @sym: symmetric encryption +# @asym: asymmetric Encryption +# +# Since: 8.0 +## +{ 'enum': 'QCryptodevBackendAlgType', + 'prefix': 'QCRYPTODEV_BACKEND_ALG', + 'data': ['sym', 'asym']} + ## # @QCryptodevBackendType: # diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index af152d09db..16f01dd48a 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -49,12 +49,6 @@ typedef struct CryptoDevBackendPeers CryptoDevBackendPeers; typedef struct CryptoDevBackendClient CryptoDevBackendClient; -enum CryptoDevBackendAlgType { - CRYPTODEV_BACKEND_ALG_SYM, - CRYPTODEV_BACKEND_ALG_ASYM, - CRYPTODEV_BACKEND_ALG__MAX, -}; - /** * CryptoDevBackendSymSessionInfo: * @@ -181,7 +175,7 @@ typedef struct CryptoDevBackendAsymOpInfo { } CryptoDevBackendAsymOpInfo; typedef struct CryptoDevBackendOpInfo { - enum CryptoDevBackendAlgType algtype; + QCryptodevBackendAlgType algtype; uint32_t op_code; uint64_t session_id; union { diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index 08895271eb..e70dcd5dad 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -537,7 +537,7 @@ static int cryptodev_builtin_operation( CryptoDevBackendBuiltinSession *sess; CryptoDevBackendSymOpInfo *sym_op_info; CryptoDevBackendAsymOpInfo *asym_op_info; - enum CryptoDevBackendAlgType algtype = op_info->algtype; + QCryptodevBackendAlgType algtype = op_info->algtype; int status = -VIRTIO_CRYPTO_ERR; Error *local_error = NULL; @@ -549,11 +549,11 @@ static int cryptodev_builtin_operation( } sess = builtin->sessions[op_info->session_id]; - if (algtype == CRYPTODEV_BACKEND_ALG_SYM) { + if (algtype == QCRYPTODEV_BACKEND_ALG_SYM) { sym_op_info = op_info->u.sym_op_info; status = cryptodev_builtin_sym_operation(sess, sym_op_info, &local_error); - } else if (algtype == CRYPTODEV_BACKEND_ALG_ASYM) { + } else if (algtype == QCRYPTODEV_BACKEND_ALG_ASYM) { asym_op_info = op_info->u.asym_op_info; status = cryptodev_builtin_asym_operation(sess, op_info->op_code, asym_op_info, &local_error); diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index de3d1867c5..53a932b58d 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -477,7 +477,7 @@ static int cryptodev_lkcf_operation( CryptoDevBackendLKCF *lkcf = CRYPTODEV_BACKEND_LKCF(backend); CryptoDevBackendLKCFSession *sess; - enum CryptoDevBackendAlgType algtype = op_info->algtype; + QCryptodevBackendAlgType algtype = op_info->algtype; CryptoDevLKCFTask *task; if (op_info->session_id >= MAX_SESSIONS || @@ -488,7 +488,7 @@ static int cryptodev_lkcf_operation( } sess = lkcf->sess[op_info->session_id]; - if (algtype != CRYPTODEV_BACKEND_ALG_ASYM) { + if (algtype != QCRYPTODEV_BACKEND_ALG_ASYM) { error_report("algtype not supported: %u", algtype); return -VIRTIO_CRYPTO_NOTSUPP; } diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 81941af816..c2a053db0e 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -120,10 +120,10 @@ int cryptodev_backend_crypto_operation( { VirtIOCryptoReq *req = opaque1; CryptoDevBackendOpInfo *op_info = &req->op_info; - enum CryptoDevBackendAlgType algtype = req->flags; + QCryptodevBackendAlgType algtype = req->flags; - if ((algtype != CRYPTODEV_BACKEND_ALG_SYM) - && (algtype != CRYPTODEV_BACKEND_ALG_ASYM)) { + if ((algtype != QCRYPTODEV_BACKEND_ALG_SYM) + && (algtype != QCRYPTODEV_BACKEND_ALG_ASYM)) { error_report("Unsupported cryptodev alg type: %" PRIu32 "", algtype); return -VIRTIO_CRYPTO_NOTSUPP; } diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 516425e26a..0d1be0ada9 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -462,7 +462,7 @@ static void virtio_crypto_init_request(VirtIOCrypto *vcrypto, VirtQueue *vq, req->in_iov = NULL; req->in_num = 0; req->in_len = 0; - req->flags = CRYPTODEV_BACKEND_ALG__MAX; + req->flags = QCRYPTODEV_BACKEND_ALG__MAX; memset(&req->op_info, 0x00, sizeof(req->op_info)); } @@ -472,7 +472,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req) return; } - if (req->flags == CRYPTODEV_BACKEND_ALG_SYM) { + if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) { size_t max_len; CryptoDevBackendSymOpInfo *op_info = req->op_info.u.sym_op_info; @@ -485,7 +485,7 @@ static void virtio_crypto_free_request(VirtIOCryptoReq *req) /* Zeroize and free request data structure */ memset(op_info, 0, sizeof(*op_info) + max_len); g_free(op_info); - } else if (req->flags == CRYPTODEV_BACKEND_ALG_ASYM) { + } else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) { CryptoDevBackendAsymOpInfo *op_info = req->op_info.u.asym_op_info; if (op_info) { g_free(op_info->src); @@ -570,10 +570,10 @@ static void virtio_crypto_req_complete(void *opaque, int ret) VirtIODevice *vdev = VIRTIO_DEVICE(vcrypto); uint8_t status = -ret; - if (req->flags == CRYPTODEV_BACKEND_ALG_SYM) { + if (req->flags == QCRYPTODEV_BACKEND_ALG_SYM) { virtio_crypto_sym_input_data_helper(vdev, req, status, req->op_info.u.sym_op_info); - } else if (req->flags == CRYPTODEV_BACKEND_ALG_ASYM) { + } else if (req->flags == QCRYPTODEV_BACKEND_ALG_ASYM) { virtio_crypto_akcipher_input_data_helper(vdev, req, status, req->op_info.u.asym_op_info); } @@ -875,7 +875,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) switch (opcode) { case VIRTIO_CRYPTO_CIPHER_ENCRYPT: case VIRTIO_CRYPTO_CIPHER_DECRYPT: - op_info->algtype = request->flags = CRYPTODEV_BACKEND_ALG_SYM; + op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_SYM; ret = virtio_crypto_handle_sym_req(vcrypto, &req.u.sym_req, op_info, out_iov, out_num); @@ -885,7 +885,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) case VIRTIO_CRYPTO_AKCIPHER_DECRYPT: case VIRTIO_CRYPTO_AKCIPHER_SIGN: case VIRTIO_CRYPTO_AKCIPHER_VERIFY: - op_info->algtype = request->flags = CRYPTODEV_BACKEND_ALG_ASYM; + op_info->algtype = request->flags = QCRYPTODEV_BACKEND_ALG_ASYM; ret = virtio_crypto_handle_asym_req(vcrypto, &req.u.akcipher_req, op_info, out_iov, out_num); From patchwork Wed Mar 8 01:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PldGVjPx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ5g4LZdz1yWs for ; Wed, 8 Mar 2023 12:11:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKm-0000KI-Qq; Tue, 07 Mar 2023 20: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 1pZiKk-0000A8-O9 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20: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 1pZiKi-0001Uh-VK for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237868; 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=7DUUrDnDnLyU3QbG090wNnF7ycpTepVpTSdNdHaWNHo=; b=PldGVjPxUeXW1xkEJzY6B4SMFAzePs3mbUCsJCMyXyWxhuRNv8lREXomDhcZgj8mcU9eu1 90SKhToATuXEhy3jeSEToBk8vGc+ygoSb4CQ1fr+X9oJCH88YcUsYXOFdc2SAENzGjkXGu 014H9YpVn6sYVYU661QlcInFw9L2ldU= 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-671-OCfwVGsrPFq-j6-6LCBSqg-1; Tue, 07 Mar 2023 20:11:06 -0500 X-MC-Unique: OCfwVGsrPFq-j6-6LCBSqg-1 Received: by mail-wm1-f71.google.com with SMTP id k26-20020a05600c0b5a00b003dfe4bae099so125861wmr.0 for ; Tue, 07 Mar 2023 17:11:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237865; 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=7DUUrDnDnLyU3QbG090wNnF7ycpTepVpTSdNdHaWNHo=; b=wAFDLXW6ll4dvjWg+SGLPpnClDfLipUpCmRM5V7tVdCg+OawvrdcdWYH5hqOBw/ZJw WG/t2WBL5sU4XADlWpKwUa2stJ+sxJ3/frXDs68/dEt0TYPPp76EZiq8tzP5BCI5HhOi EzJBMVQroGXYOb5TT7M1TPE1WKf7Q9LbuXX2xHDu8/hoZ7S1F+5bNWErWqbgV9IJp+jn SMjZWaYyhgUalsX1hCWCV4ptLiz+0DCaf07A/y2SLau7dd1HVLcIcr1rkz6VnZql2Bub REXFu9KGuhJ/CNVojM6T+jRhpUbpgsVc1vAiWFzjMLKrY2wN2Sp8QAmkveX27mmGN7zT dm+Q== X-Gm-Message-State: AO0yUKVHM73N1R5XHTPLJaMM4qe1xdv0Az+cooVOcJDikXv9/Lq277yJ mHGzto+TjXM1zm8O0Hmh1ccJ1QUgxzJ2XWXrGfNdel76+Tnm9JYhLTmxVJmLwFlBgwqkFzygBqb w+P2156mYa9odNysI2Mb5i9Zwfuk61y8Z28E2WuUF3Sp3GvRpHscB/MnVFN5hnwdMbJMo X-Received: by 2002:a05:600c:190b:b0:3ea:e7f6:f8f9 with SMTP id j11-20020a05600c190b00b003eae7f6f8f9mr14429346wmq.19.1678237865055; Tue, 07 Mar 2023 17:11:05 -0800 (PST) X-Google-Smtp-Source: AK7set+IC+fYSrMceBWtMdujm0qpFq7klVr2fkdwtlm2cP2+LKvaxZYn8SJHaCAS/+1iUxbH3NXzbA== X-Received: by 2002:a05:600c:190b:b0:3ea:e7f6:f8f9 with SMTP id j11-20020a05600c190b00b003eae7f6f8f9mr14429327wmq.19.1678237864785; Tue, 07 Mar 2023 17:11:04 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id hg13-20020a05600c538d00b003d9aa76dc6asm17961794wmb.0.2023.03.07.17.11.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:03 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:01 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Eric Blake , Markus Armbruster Subject: [PULL 04/73] cryptodev: Introduce server type in QAPI 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Introduce cryptodev service type in cryptodev.json, then apply this to related codes. Now we can remove VIRTIO_CRYPTO_SERVICE_xxx dependence from QEMU cryptodev. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-5-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cryptodev.json | 11 +++++++++++ backends/cryptodev-builtin.c | 8 ++++---- backends/cryptodev-lkcf.c | 2 +- backends/cryptodev-vhost-user.c | 6 +++--- hw/virtio/virtio-crypto.c | 27 +++++++++++++++++++++++++-- 5 files changed, 44 insertions(+), 10 deletions(-) diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json index ebb6852035..8732a30524 100644 --- a/qapi/cryptodev.json +++ b/qapi/cryptodev.json @@ -18,6 +18,17 @@ 'prefix': 'QCRYPTODEV_BACKEND_ALG', 'data': ['sym', 'asym']} +## +# @QCryptodevBackendServiceType: +# +# The supported service types of a crypto device. +# +# Since: 8.0 +## +{ 'enum': 'QCryptodevBackendServiceType', + 'prefix': 'QCRYPTODEV_BACKEND_SERVICE', + 'data': ['cipher', 'hash', 'mac', 'aead', 'akcipher']} + ## # @QCryptodevBackendType: # diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index e70dcd5dad..c0fbb650d7 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -79,10 +79,10 @@ static void cryptodev_builtin_init( backend->conf.peers.ccs[0] = cc; backend->conf.crypto_services = - 1u << VIRTIO_CRYPTO_SERVICE_CIPHER | - 1u << VIRTIO_CRYPTO_SERVICE_HASH | - 1u << VIRTIO_CRYPTO_SERVICE_MAC | - 1u << VIRTIO_CRYPTO_SERVICE_AKCIPHER; + 1u << QCRYPTODEV_BACKEND_SERVICE_CIPHER | + 1u << QCRYPTODEV_BACKEND_SERVICE_HASH | + 1u << QCRYPTODEV_BACKEND_SERVICE_MAC | + 1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER; backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC; backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1; backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA; diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index 53a932b58d..edec99f104 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -230,7 +230,7 @@ static void cryptodev_lkcf_init(CryptoDevBackend *backend, Error **errp) backend->conf.peers.ccs[0] = cc; backend->conf.crypto_services = - 1u << VIRTIO_CRYPTO_SERVICE_AKCIPHER; + 1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER; backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA; lkcf->running = true; diff --git a/backends/cryptodev-vhost-user.c b/backends/cryptodev-vhost-user.c index 580bd1abb0..b1d9eb735f 100644 --- a/backends/cryptodev-vhost-user.c +++ b/backends/cryptodev-vhost-user.c @@ -221,9 +221,9 @@ static void cryptodev_vhost_user_init( cryptodev_vhost_user_event, NULL, s, NULL, true); backend->conf.crypto_services = - 1u << VIRTIO_CRYPTO_SERVICE_CIPHER | - 1u << VIRTIO_CRYPTO_SERVICE_HASH | - 1u << VIRTIO_CRYPTO_SERVICE_MAC; + 1u << QCRYPTODEV_BACKEND_SERVICE_CIPHER | + 1u << QCRYPTODEV_BACKEND_SERVICE_HASH | + 1u << QCRYPTODEV_BACKEND_SERVICE_MAC; backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC; backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1; diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 0d1be0ada9..e4f0de4d1c 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -997,12 +997,35 @@ static void virtio_crypto_reset(VirtIODevice *vdev) } } +static uint32_t virtio_crypto_init_services(uint32_t qservices) +{ + uint32_t vservices = 0; + + if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_CIPHER)) { + vservices |= (1 << VIRTIO_CRYPTO_SERVICE_CIPHER); + } + if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_HASH)) { + vservices |= (1 << VIRTIO_CRYPTO_SERVICE_HASH); + } + if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_MAC)) { + vservices |= (1 << VIRTIO_CRYPTO_SERVICE_MAC); + } + if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_AEAD)) { + vservices |= (1 << VIRTIO_CRYPTO_SERVICE_AEAD); + } + if (qservices & (1 << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER)) { + vservices |= (1 << VIRTIO_CRYPTO_SERVICE_AKCIPHER); + } + + return vservices; +} + static void virtio_crypto_init_config(VirtIODevice *vdev) { VirtIOCrypto *vcrypto = VIRTIO_CRYPTO(vdev); - vcrypto->conf.crypto_services = - vcrypto->conf.cryptodev->conf.crypto_services; + vcrypto->conf.crypto_services = virtio_crypto_init_services( + vcrypto->conf.cryptodev->conf.crypto_services); vcrypto->conf.cipher_algo_l = vcrypto->conf.cryptodev->conf.cipher_algo_l; vcrypto->conf.cipher_algo_h = From patchwork Wed Mar 8 01:11:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RVKa07UB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ6y1k0rz1yWs for ; Wed, 8 Mar 2023 12:12:42 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKo-0000PV-G6; Tue, 07 Mar 2023 20:11: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 1pZiKn-0000Ko-AP for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:13 -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 1pZiKl-0001WD-AS for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237870; 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=M913g5KmMg2h4dGyCgCV10+MOAMlx7uevooxuvfZS4o=; b=RVKa07UB0Po6N9soTA358No056/VO1Ad3jR8gGJR4a2F8NYhyoHss4FTUSI0nSHUgNHhb9 qgWypyNIbrISwCHn1MySdwHKQXt5dCzZ+G9Suq4Y+S10UJUuqve49qD/ca5PDO/fGW67q0 044mI2zxjT8ulnqjW2Wl95wFJzfuj/s= 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-332-LR6Vs7FLNFKzjzo87W_Zig-1; Tue, 07 Mar 2023 20:11:09 -0500 X-MC-Unique: LR6Vs7FLNFKzjzo87W_Zig-1 Received: by mail-wr1-f69.google.com with SMTP id o3-20020a5d6483000000b002cc4fe0f7fcso2561860wri.7 for ; Tue, 07 Mar 2023 17:11:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237868; 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=M913g5KmMg2h4dGyCgCV10+MOAMlx7uevooxuvfZS4o=; b=NA66AjJByo7l6CwwliUwGXU11CExDvJFRXVCPvpoMoWKjK1nA8VCEfxXqnHyz71ENv Xmb9M1LcXiIrEBSgoHT6W0UPBwwVyDBKw6XW5yWNReJaH1CFUHmQooQ74mBgKzY1WcWG 1ni1J+hRzhEyNtahdnI+C6EiuCbH8KNYwN/JFN4C+ccNoBvOM2cQE2t2LxXScaRnyaH5 DA33gDoBWwy6Y40GyhSR2Jqk+/hN/aU6mLAwsi/TCLMv18eOhH2+k/AXNTMtuFicubtv ieNYwjjOPHOTQYtD4SgaBC8ROnMEpOGbF8jEPg9puN8fEA5rTlf5d2tOWJjW+vwo/eTf H8kg== X-Gm-Message-State: AO0yUKWhm+NMZSkupqriGebJocum4YiaPMzGyww/xw8OLlzzwI+GXXBZ 14p+3pzYgLy6psG5LkDwp6NYN97qxJZxx2KhIpluXPl73+KV/lbjo4Lyk+46uBDSdAsrCj5m6Hh o+LRbL8NQBd+8KBNmaWwCd6TVXGWB18/vjSZgPBtLliCK9h5UgfHtBllaP7I5piXqu3jt X-Received: by 2002:a05:600c:468b:b0:3ea:e554:77fe with SMTP id p11-20020a05600c468b00b003eae55477femr14156233wmo.12.1678237867902; Tue, 07 Mar 2023 17:11:07 -0800 (PST) X-Google-Smtp-Source: AK7set+/klS09aWLVgtrjZORgHaucvIvn6ytkLKT/HXSfQ0MnLRtaUUs6kOrYI+9t4INHds/4mAROw== X-Received: by 2002:a05:600c:468b:b0:3ea:e554:77fe with SMTP id p11-20020a05600c468b00b003eae55477femr14156211wmo.12.1678237867592; Tue, 07 Mar 2023 17:11:07 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id t14-20020a05600c450e00b003e1fee8baacsm19108826wmo.25.2023.03.07.17.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:07 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:04 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Eric Blake , Markus Armbruster Subject: [PULL 05/73] cryptodev: Introduce 'query-cryptodev' QMP command Message-ID: <5dcb0198109429c9f54adce939ad825eabe857b4.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Now we have a QMP command to query crypto devices: virsh qemu-monitor-command vm '{"execute": "query-cryptodev"}' | jq { "return": [ { "service": [ "akcipher", "mac", "hash", "cipher" ], "id": "cryptodev1", "client": [ { "queue": 0, "type": "builtin" } ] }, { "service": [ "akcipher" ], "id": "cryptodev0", "client": [ { "queue": 0, "type": "lkcf" } ] } ], "id": "libvirt-417" } Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-6-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cryptodev.json | 44 +++++++++++++++++++++++++++++++++++++++++++ backends/cryptodev.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/qapi/cryptodev.json b/qapi/cryptodev.json index 8732a30524..f33f96a692 100644 --- a/qapi/cryptodev.json +++ b/qapi/cryptodev.json @@ -43,3 +43,47 @@ { 'enum': 'QCryptodevBackendType', 'prefix': 'QCRYPTODEV_BACKEND_TYPE', 'data': ['builtin', 'vhost-user', 'lkcf']} + +## +# @QCryptodevBackendClient: +# +# Information about a queue of crypto device. +# +# @queue: the queue index of the crypto device +# +# @type: the type of the crypto device +# +# Since: 8.0 +## +{ 'struct': 'QCryptodevBackendClient', + 'data': { 'queue': 'uint32', + 'type': 'QCryptodevBackendType' } } + +## +# @QCryptodevInfo: +# +# Information about a crypto device. +# +# @id: the id of the crypto device +# +# @service: supported service types of a crypto device +# +# @client: the additional infomation of the crypto device +# +# Since: 8.0 +## +{ 'struct': 'QCryptodevInfo', + 'data': { 'id': 'str', + 'service': ['QCryptodevBackendServiceType'], + 'client': ['QCryptodevBackendClient'] } } + +## +# @query-cryptodev: +# +# Returns information about current crypto devices. +# +# Returns: a list of @QCryptodevInfo +# +# Since: 8.0 +## +{ 'command': 'query-cryptodev', 'returns': ['QCryptodevInfo']} diff --git a/backends/cryptodev.c b/backends/cryptodev.c index c2a053db0e..3a45d19823 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -24,6 +24,7 @@ #include "qemu/osdep.h" #include "sysemu/cryptodev.h" #include "qapi/error.h" +#include "qapi/qapi-commands-cryptodev.h" #include "qapi/visitor.h" #include "qemu/config-file.h" #include "qemu/error-report.h" @@ -33,6 +34,50 @@ static QTAILQ_HEAD(, CryptoDevBackendClient) crypto_clients; +static int qmp_query_cryptodev_foreach(Object *obj, void *data) +{ + CryptoDevBackend *backend; + QCryptodevInfoList **infolist = data; + uint32_t services, i; + + if (!object_dynamic_cast(obj, TYPE_CRYPTODEV_BACKEND)) { + return 0; + } + + QCryptodevInfo *info = g_new0(QCryptodevInfo, 1); + info->id = g_strdup(object_get_canonical_path_component(obj)); + + backend = CRYPTODEV_BACKEND(obj); + services = backend->conf.crypto_services; + for (i = 0; i < QCRYPTODEV_BACKEND_SERVICE__MAX; i++) { + if (services & (1 << i)) { + QAPI_LIST_PREPEND(info->service, i); + } + } + + for (i = 0; i < backend->conf.peers.queues; i++) { + CryptoDevBackendClient *cc = backend->conf.peers.ccs[i]; + QCryptodevBackendClient *client = g_new0(QCryptodevBackendClient, 1); + + client->queue = cc->queue_index; + client->type = cc->type; + QAPI_LIST_PREPEND(info->client, client); + } + + QAPI_LIST_PREPEND(*infolist, info); + + return 0; +} + +QCryptodevInfoList *qmp_query_cryptodev(Error **errp) +{ + QCryptodevInfoList *list = NULL; + Object *objs = container_get(object_get_root(), "/objects"); + + object_child_foreach(objs, qmp_query_cryptodev_foreach, &list); + + return list; +} CryptoDevBackendClient *cryptodev_backend_new_client(void) { From patchwork Wed Mar 8 01:11:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XNyOHlFw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ5g3P7Kz1yWm for ; Wed, 8 Mar 2023 12:11:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKu-0000eY-5N; Tue, 07 Mar 2023 20:11: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 1pZiKs-0000XB-OV for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:18 -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 1pZiKr-0001WQ-1T for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237876; 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=wsSdnH9a7tudhjoUI7fD5la6QwQG8MoHhpYbHRlxQoQ=; b=XNyOHlFwjMyrN8BhoAIjWPI3+An+ZrjsXNOwK+8U0rx5OzMWrqLGxz5Y35dSpD4GuJJ6n6 MyIenuGziK1nX7t0vAI3uulAoRI04yxRta3sKQHXDah0YsaOvHN1R8wfSns+UOO9aUJlq+ gmhwoN8SiRQizPzIlk1Qfbsti9Tn0Vc= 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-172-bDRNbuA7Oymq45aHXoOYWQ-1; Tue, 07 Mar 2023 20:11:12 -0500 X-MC-Unique: bDRNbuA7Oymq45aHXoOYWQ-1 Received: by mail-wr1-f69.google.com with SMTP id m7-20020a056000008700b002c7047ea429so2601003wrx.21 for ; Tue, 07 Mar 2023 17:11:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237871; 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=wsSdnH9a7tudhjoUI7fD5la6QwQG8MoHhpYbHRlxQoQ=; b=mPLPvbQ9KZTnduIMNOo7UI0bWDyh0zDfbBUFr9eXf0Wpo2Sg4XTqqEXIbyKcDAOt2C 2bu/aQqQsnOp1etjLhIH7GGWz9qbOpgH39oiddi3wqr+3Nq5MI+d2m1cYy3P3idki75k lWikox/H/7p+FML8lwbV2OAESwkQ80WGZmVOJPqRYl2znTsvjd550bf3D1SHynGu6UvU 2Rkp+NiEmIESBkaVLe9EJfgZ84ZoOW3yz8ItydIBhG/+xkjNDcKbdVpgMzOE7rk6RoEF 06mt44UztZlsuPOp6sXDwOA2WfZzpAcmmZqvCIgz2PfzDdozQHprJTR7PPI8KGy7JEgO YfMw== X-Gm-Message-State: AO0yUKUfilemWZCEksinsNySIfO96dpEP2/Refxj+Xf6vAG+U9xVrx+S 9rNywxl7JVvIrnnjIRpTh9QRkt/5GPYtFuuXgvfDqMz34pRV1sjV4p/j8OiDJEykCNVIwZVepMv 7xCS2I0ZNL1Aag2f6IkNDKOqjuk0RVpMg4v9SZD9db2RYzkvlTheg5KU/Sm+eeUh6NuLh X-Received: by 2002:a05:600c:3108:b0:3eb:37ce:4c3d with SMTP id g8-20020a05600c310800b003eb37ce4c3dmr14088739wmo.38.1678237870945; Tue, 07 Mar 2023 17:11:10 -0800 (PST) X-Google-Smtp-Source: AK7set+rJF1/4MaPpU8Yrg7U+xjS2DcE6+zUtgKtktyzhC0sSJVpm7bjIC62ioeab3+VLv5kUAsBBw== X-Received: by 2002:a05:600c:3108:b0:3eb:37ce:4c3d with SMTP id g8-20020a05600c310800b003eb37ce4c3dmr14088720wmo.38.1678237870641; Tue, 07 Mar 2023 17:11:10 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id l26-20020a05600c1d1a00b003e20970175dsm20237605wms.32.2023.03.07.17.11.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:10 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:08 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" Subject: [PULL 06/73] cryptodev-builtin: Detect akcipher capability 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Rather than exposing akcipher service/RSA algorithm to virtio crypto device unconditionally, detect akcipher capability from akcipher crypto framework. This avoids unsuccessful requests. Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-7-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- backends/cryptodev-builtin.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index c0fbb650d7..c45b5906c5 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -59,6 +59,19 @@ struct CryptoDevBackendBuiltin { CryptoDevBackendBuiltinSession *sessions[MAX_NUM_SESSIONS]; }; +static void cryptodev_builtin_init_akcipher(CryptoDevBackend *backend) +{ + QCryptoAkCipherOptions opts; + + opts.alg = QCRYPTO_AKCIPHER_ALG_RSA; + opts.u.rsa.padding_alg = QCRYPTO_RSA_PADDING_ALG_RAW; + if (qcrypto_akcipher_supports(&opts)) { + backend->conf.crypto_services |= + (1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER); + backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA; + } +} + static void cryptodev_builtin_init( CryptoDevBackend *backend, Error **errp) { @@ -81,11 +94,9 @@ static void cryptodev_builtin_init( backend->conf.crypto_services = 1u << QCRYPTODEV_BACKEND_SERVICE_CIPHER | 1u << QCRYPTODEV_BACKEND_SERVICE_HASH | - 1u << QCRYPTODEV_BACKEND_SERVICE_MAC | - 1u << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER; + 1u << QCRYPTODEV_BACKEND_SERVICE_MAC; backend->conf.cipher_algo_l = 1u << VIRTIO_CRYPTO_CIPHER_AES_CBC; backend->conf.hash_algo = 1u << VIRTIO_CRYPTO_HASH_SHA1; - backend->conf.akcipher_algo = 1u << VIRTIO_CRYPTO_AKCIPHER_RSA; /* * Set the Maximum length of crypto request. * Why this value? Just avoid to overflow when @@ -94,6 +105,7 @@ static void cryptodev_builtin_init( backend->conf.max_size = LONG_MAX - sizeof(CryptoDevBackendOpInfo); backend->conf.max_cipher_key_len = CRYPTODEV_BUITLIN_MAX_CIPHER_KEY_LEN; backend->conf.max_auth_key_len = CRYPTODEV_BUITLIN_MAX_AUTH_KEY_LEN; + cryptodev_builtin_init_akcipher(backend); cryptodev_backend_set_ready(backend, true); } From patchwork Wed Mar 8 01:11:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753826 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VYQGh7qY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJ30Tqjz1yWp for ; Wed, 8 Mar 2023 12:20:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiKv-0000kv-Rv; Tue, 07 Mar 2023 20:11: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 1pZiKu-0000gF-DJ for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:20 -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 1pZiKr-0001WY-N5 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237876; 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=P5BqJTeJKUER7ahJjWEDggh8lRcUNxJHYwuJFTh5R+Q=; b=VYQGh7qYJD18o/Ms+PidMIHZnFUqb4l9f5FluMmFkVeZNxbBfk2x5g/Ikqda/d0ejiKdLY FBfHRlmtkVXuTu7aypsWjG+4Fj5c79Nwbg4AA6Zb6ru9NYEyCgKGBwhQ6pZIHKjlb1yreP U22Q2DtDBj6a2h1aLar5CT/EW5Lp04E= 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-471-L0vJktE6Puq9m1KOszgYKw-1; Tue, 07 Mar 2023 20:11:15 -0500 X-MC-Unique: L0vJktE6Puq9m1KOszgYKw-1 Received: by mail-wm1-f71.google.com with SMTP id f26-20020a7bcd1a000000b003e71cde0e70so708523wmj.0 for ; Tue, 07 Mar 2023 17:11:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237874; 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=P5BqJTeJKUER7ahJjWEDggh8lRcUNxJHYwuJFTh5R+Q=; b=h5DcCUTAyapRwOAMq7MBeHBEsv1bIsdriJmBLk83wmJeleWlUe/88C38jyEuGrALjv u1O4J/StROwlWaszclH3BSGIj6c3M+QfzEpnRzsQUaOmlteYdh6oFJFYtNEHR1NpyfB3 ntMiIoe3NxO6+9s9rzimeuRbS7BEHEMkkIb2DkNgK0auzygwNCuEAEFA+BLOw27ttikQ DfrmGwvpDsDzk+UCCY1Q0lOfJYi0JKgMC/1zidPJE+YWH1z3BP0J91Lf/SofBIUNwkSO JeIP0+6bviJ3RbknUZkWZo7/6s+SLnqbIDSvbOPULb4IcviDYT6gJuBjTIGgSiCYbyeq 9IZg== X-Gm-Message-State: AO0yUKV5kF7dHdLrLtaAqfR4OP+RK7YJmj7HYiCGYceT7dOKSdlF8mux T+3y7mU9OEYf40ARUStQ9zpsPrxJ0yph15PeCmaxkN+il/JFNk7DTUx8S51Bnxd/K3/aiIU8C+L CUlHAjyKpOhIL8wNRpTfGLnhcY69aLb1mA6v3htez450F6nIKlVX+LjqJJEAiUqFlmPgZ X-Received: by 2002:a05:600c:3d14:b0:3df:9858:c033 with SMTP id bh20-20020a05600c3d1400b003df9858c033mr14770552wmb.8.1678237874127; Tue, 07 Mar 2023 17:11:14 -0800 (PST) X-Google-Smtp-Source: AK7set/ywsABS8IvTRq/VrJOl6GLTDSJFl5hKmjrFuAA/RBL+JAn0pN/1B25xeGWuVslu74TFtO5iQ== X-Received: by 2002:a05:600c:3d14:b0:3df:9858:c033 with SMTP id bh20-20020a05600c3d1400b003df9858c033mr14770539wmb.8.1678237873811; Tue, 07 Mar 2023 17:11:13 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id s8-20020a7bc388000000b003eb2e685c7dsm18099364wmj.9.2023.03.07.17.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:13 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:11 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , "Dr . David Alan Gilbert" , Daniel P =?utf-8?b?LiBC?= =?utf-8?b?ZXJyYW5nw6k=?= , "Gonglei (Arei)" Subject: [PULL 07/73] hmp: add cryptodev info command 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Example of this command: # virsh qemu-monitor-command vm --hmp info cryptodev cryptodev1: service=[akcipher|mac|hash|cipher] queue 0: type=builtin cryptodev0: service=[akcipher] queue 0: type=lkcf Acked-by: Dr. David Alan Gilbert Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-8-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/monitor/hmp.h | 1 + backends/cryptodev-hmp-cmds.c | 54 +++++++++++++++++++++++++++++++++++ backends/meson.build | 1 + hmp-commands-info.hx | 14 +++++++++ 4 files changed, 70 insertions(+) create mode 100644 backends/cryptodev-hmp-cmds.c diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h index efae6b06bc..fdb69b7f9c 100644 --- a/include/monitor/hmp.h +++ b/include/monitor/hmp.h @@ -180,5 +180,6 @@ void hmp_ioport_read(Monitor *mon, const QDict *qdict); void hmp_ioport_write(Monitor *mon, const QDict *qdict); void hmp_boot_set(Monitor *mon, const QDict *qdict); void hmp_info_mtree(Monitor *mon, const QDict *qdict); +void hmp_info_cryptodev(Monitor *mon, const QDict *qdict); #endif diff --git a/backends/cryptodev-hmp-cmds.c b/backends/cryptodev-hmp-cmds.c new file mode 100644 index 0000000000..4f7220bb13 --- /dev/null +++ b/backends/cryptodev-hmp-cmds.c @@ -0,0 +1,54 @@ +/* + * HMP commands related to cryptodev + * + * Copyright (c) 2023 Bytedance.Inc + * + * Authors: + * zhenwei pi + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * (at your option) any later version. + */ + +#include "qemu/osdep.h" +#include "monitor/hmp.h" +#include "monitor/monitor.h" +#include "qapi/qapi-commands-cryptodev.h" +#include "qapi/qmp/qdict.h" + + +void hmp_info_cryptodev(Monitor *mon, const QDict *qdict) +{ + QCryptodevInfoList *il; + QCryptodevBackendServiceTypeList *sl; + QCryptodevBackendClientList *cl; + + for (il = qmp_query_cryptodev(NULL); il; il = il->next) { + g_autofree char *services = NULL; + QCryptodevInfo *info = il->value; + char *tmp_services; + + /* build a string like 'service=[akcipher|mac|hash|cipher]' */ + for (sl = info->service; sl; sl = sl->next) { + const char *service = QCryptodevBackendServiceType_str(sl->value); + + if (!services) { + services = g_strdup(service); + } else { + tmp_services = g_strjoin("|", services, service, NULL); + g_free(services); + services = tmp_services; + } + } + monitor_printf(mon, "%s: service=[%s]\n", info->id, services); + + for (cl = info->client; cl; cl = cl->next) { + QCryptodevBackendClient *client = cl->value; + monitor_printf(mon, " queue %" PRIu32 ": type=%s\n", + client->queue, + QCryptodevBackendType_str(client->type)); + } + } + + qapi_free_QCryptodevInfoList(il); +} diff --git a/backends/meson.build b/backends/meson.build index 954e658b25..b369e0a9d0 100644 --- a/backends/meson.build +++ b/backends/meson.build @@ -1,5 +1,6 @@ softmmu_ss.add([files( 'cryptodev-builtin.c', + 'cryptodev-hmp-cmds.c', 'cryptodev.c', 'hostmem-ram.c', 'hostmem.c', diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx index 754b1e8408..47d63d26db 100644 --- a/hmp-commands-info.hx +++ b/hmp-commands-info.hx @@ -993,3 +993,17 @@ SRST ``info virtio-queue-element`` *path* *queue* [*index*] Display element of a given virtio queue ERST + + { + .name = "cryptodev", + .args_type = "", + .params = "", + .help = "show the crypto devices", + .cmd = hmp_info_cryptodev, + .flags = "p", + }, + +SRST + ``info cryptodev`` + Show the crypto devices. +ERST From patchwork Wed Mar 8 01:11:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753791 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cV+723kA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ925b39z1yWm for ; Wed, 8 Mar 2023 12:14:30 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiL0-0000mI-G7; Tue, 07 Mar 2023 20:11:26 -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 1pZiKy-0000lp-PF for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:25 -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 1pZiKw-0001XT-Vh for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237882; 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=X43XlaXTmEJblhkbQ9fpaEKb8qO1YVpXU0xjMSWwZRw=; b=cV+723kAOvv8uXf2VwdHdAy0p26E6msVTotWMpaJgiY2EMpCR9s5CSnXFEYcxr9Qyx3Upk Vs60vOVvZleRj3+143iMGwLGqnHuCsJEV2q6C5dcMwzSDqrEE0TUUzVzDVgWDOBtTBv3kd W7Y9OYLUb65Dh+I0+dENTiMUVBGsFc8= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-78-_pgFmKfsM_O9uKhZ32JoWg-1; Tue, 07 Mar 2023 20:11:18 -0500 X-MC-Unique: _pgFmKfsM_O9uKhZ32JoWg-1 Received: by mail-ed1-f70.google.com with SMTP id m8-20020a056402430800b004cdaaa4f428so18674615edc.20 for ; Tue, 07 Mar 2023 17:11:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237877; 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=X43XlaXTmEJblhkbQ9fpaEKb8qO1YVpXU0xjMSWwZRw=; b=MxiBpn1yWqyRLn5Yf06WWw5LuJxJWZCVteR8Ecr6HMZLs6TjmgHS2mRlVdC25pR42D lKYAwxryuSwyzTwih4HQVyuQTs+ORRQnlm/NqvfGR+n6MjJKtXikezpN52fuxQC7aq9O xFonN9YNZa+/CTkFsIlFCPTNb8f2+7QtoMAEADigJK3SBh7SC07cYGKXiMDw6+VicTax X5fvJmSgF6qMRq0baS2GHyvxpRKh17rtUWZaQC9D8LrDd1zbPZMlaKp++T7Q2J999u0c JdRN+TqQNZXFBWxuDd8Q5MOaUGCAvgKRuZJK5tVNAwTUxu3sWC9uBtGJEZ6PJdldFTa2 8/5Q== X-Gm-Message-State: AO0yUKVMVHkMD48BgS1PyVNwD9l/uXZQhKcM04X9zvai0XyGKEgzrpxb LBv3EHr4tu3SP9FePWAnYbGBGWcESPj7EJENKvMpjk0gIPubRnt3Kg0ituKXQugR8PHf5e/gsxf LPqbgyiF+exApEIo+Oni51dEN28ujqX4AbRG08rYXpdNRiITz1mspvVa12MFmwGizyQ5t X-Received: by 2002:a17:907:7d8e:b0:87b:dac0:b23b with SMTP id oz14-20020a1709077d8e00b0087bdac0b23bmr21054995ejc.55.1678237877275; Tue, 07 Mar 2023 17:11:17 -0800 (PST) X-Google-Smtp-Source: AK7set8x66ZCstlDWe5NAZeew0yDdLBNIym474NeZZhPAUzlgAjSrJL+1/0QPR/GopwEs0w7SoJYvg== X-Received: by 2002:a17:907:7d8e:b0:87b:dac0:b23b with SMTP id oz14-20020a1709077d8e00b0087bdac0b23bmr21054979ejc.55.1678237876901; Tue, 07 Mar 2023 17:11:16 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id o21-20020a170906289500b008ef42f9cf48sm6731733ejd.82.2023.03.07.17.11.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:16 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" Subject: [PULL 08/73] cryptodev: Use CryptoDevBackendOpInfo for operation Message-ID: <2cb0692768c2d29333a6ad89fd081c97562bd899.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Move queue_index, CryptoDevCompletionFunc and opaque into struct CryptoDevBackendOpInfo, then cryptodev_backend_crypto_operation() needs an argument CryptoDevBackendOpInfo *op_info only. And remove VirtIOCryptoReq from cryptodev. It's also possible to hide VirtIOCryptoReq into virtio-crypto.c in the next step. (In theory, VirtIOCryptoReq is a private structure used by virtio-crypto only) Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-9-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/sysemu/cryptodev.h | 26 ++++++++++---------------- backends/cryptodev-builtin.c | 9 +++------ backends/cryptodev-lkcf.c | 9 +++------ backends/cryptodev.c | 18 +++++------------- hw/virtio/virtio-crypto.c | 7 ++++--- 5 files changed, 25 insertions(+), 44 deletions(-) diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index 16f01dd48a..048a627035 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -174,9 +174,14 @@ typedef struct CryptoDevBackendAsymOpInfo { uint8_t *dst; } CryptoDevBackendAsymOpInfo; +typedef void (*CryptoDevCompletionFunc) (void *opaque, int ret); + typedef struct CryptoDevBackendOpInfo { QCryptodevBackendAlgType algtype; uint32_t op_code; + uint32_t queue_index; + CryptoDevCompletionFunc cb; + void *opaque; /* argument for cb */ uint64_t session_id; union { CryptoDevBackendSymOpInfo *sym_op_info; @@ -184,7 +189,6 @@ typedef struct CryptoDevBackendOpInfo { } u; } CryptoDevBackendOpInfo; -typedef void (*CryptoDevCompletionFunc) (void *opaque, int ret); struct CryptoDevBackendClass { ObjectClass parent_class; @@ -204,10 +208,7 @@ struct CryptoDevBackendClass { void *opaque); int (*do_op)(CryptoDevBackend *backend, - CryptoDevBackendOpInfo *op_info, - uint32_t queue_index, - CryptoDevCompletionFunc cb, - void *opaque); + CryptoDevBackendOpInfo *op_info); }; struct CryptoDevBackendClient { @@ -335,24 +336,17 @@ int cryptodev_backend_close_session( /** * cryptodev_backend_crypto_operation: * @backend: the cryptodev backend object - * @opaque1: pointer to a VirtIOCryptoReq object - * @queue_index: queue index of cryptodev backend client - * @errp: pointer to a NULL-initialized error object - * @cb: callbacks when operation is completed - * @opaque2: parameter passed to cb + * @op_info: pointer to a CryptoDevBackendOpInfo object * - * Do crypto operation, such as encryption and - * decryption + * Do crypto operation, such as encryption, decryption, signature and + * verification * * Returns: 0 for success and cb will be called when creation is completed, * negative value for error, and cb will not be called. */ int cryptodev_backend_crypto_operation( CryptoDevBackend *backend, - void *opaque1, - uint32_t queue_index, - CryptoDevCompletionFunc cb, - void *opaque2); + CryptoDevBackendOpInfo *op_info); /** * cryptodev_backend_set_used: diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c index c45b5906c5..39d0455280 100644 --- a/backends/cryptodev-builtin.c +++ b/backends/cryptodev-builtin.c @@ -539,10 +539,7 @@ static int cryptodev_builtin_asym_operation( static int cryptodev_builtin_operation( CryptoDevBackend *backend, - CryptoDevBackendOpInfo *op_info, - uint32_t queue_index, - CryptoDevCompletionFunc cb, - void *opaque) + CryptoDevBackendOpInfo *op_info) { CryptoDevBackendBuiltin *builtin = CRYPTODEV_BACKEND_BUILTIN(backend); @@ -574,8 +571,8 @@ static int cryptodev_builtin_operation( if (local_error) { error_report_err(local_error); } - if (cb) { - cb(opaque, status); + if (op_info->cb) { + op_info->cb(op_info->opaque, status); } return 0; } diff --git a/backends/cryptodev-lkcf.c b/backends/cryptodev-lkcf.c index edec99f104..45aba1ff67 100644 --- a/backends/cryptodev-lkcf.c +++ b/backends/cryptodev-lkcf.c @@ -469,10 +469,7 @@ static void *cryptodev_lkcf_worker(void *arg) static int cryptodev_lkcf_operation( CryptoDevBackend *backend, - CryptoDevBackendOpInfo *op_info, - uint32_t queue_index, - CryptoDevCompletionFunc cb, - void *opaque) + CryptoDevBackendOpInfo *op_info) { CryptoDevBackendLKCF *lkcf = CRYPTODEV_BACKEND_LKCF(backend); @@ -495,8 +492,8 @@ static int cryptodev_lkcf_operation( task = g_new0(CryptoDevLKCFTask, 1); task->op_info = op_info; - task->cb = cb; - task->opaque = opaque; + task->cb = op_info->cb; + task->opaque = op_info->opaque; task->sess = sess; task->lkcf = lkcf; task->status = -VIRTIO_CRYPTO_ERR; diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 3a45d19823..ba7b0bc770 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -143,29 +143,22 @@ int cryptodev_backend_close_session( static int cryptodev_backend_operation( CryptoDevBackend *backend, - CryptoDevBackendOpInfo *op_info, - uint32_t queue_index, - CryptoDevCompletionFunc cb, - void *opaque) + CryptoDevBackendOpInfo *op_info) { CryptoDevBackendClass *bc = CRYPTODEV_BACKEND_GET_CLASS(backend); if (bc->do_op) { - return bc->do_op(backend, op_info, queue_index, cb, opaque); + return bc->do_op(backend, op_info); } return -VIRTIO_CRYPTO_NOTSUPP; } int cryptodev_backend_crypto_operation( CryptoDevBackend *backend, - void *opaque1, - uint32_t queue_index, - CryptoDevCompletionFunc cb, void *opaque2) + CryptoDevBackendOpInfo *op_info) { - VirtIOCryptoReq *req = opaque1; - CryptoDevBackendOpInfo *op_info = &req->op_info; - QCryptodevBackendAlgType algtype = req->flags; + QCryptodevBackendAlgType algtype = op_info->algtype; if ((algtype != QCRYPTODEV_BACKEND_ALG_SYM) && (algtype != QCRYPTODEV_BACKEND_ALG_ASYM)) { @@ -173,8 +166,7 @@ int cryptodev_backend_crypto_operation( return -VIRTIO_CRYPTO_NOTSUPP; } - return cryptodev_backend_operation(backend, op_info, queue_index, - cb, opaque2); + return cryptodev_backend_operation(backend, op_info); } static void diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index e4f0de4d1c..802e1b9659 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -871,6 +871,9 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) opcode = ldl_le_p(&req.header.opcode); op_info->session_id = ldq_le_p(&req.header.session_id); op_info->op_code = opcode; + op_info->queue_index = queue_index; + op_info->cb = virtio_crypto_req_complete; + op_info->opaque = request; switch (opcode) { case VIRTIO_CRYPTO_CIPHER_ENCRYPT: @@ -898,9 +901,7 @@ check_result: virtio_crypto_req_complete(request, -VIRTIO_CRYPTO_NOTSUPP); } else { ret = cryptodev_backend_crypto_operation(vcrypto->cryptodev, - request, queue_index, - virtio_crypto_req_complete, - request); + op_info); if (ret < 0) { virtio_crypto_req_complete(request, ret); } From patchwork Wed Mar 8 01:11:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753788 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ErjtJrKG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ8Z5Kz2z1yWm for ; Wed, 8 Mar 2023 12:14:06 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiL0-0000mN-OD; Tue, 07 Mar 2023 20:11:26 -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 1pZiKz-0000lz-8P for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:25 -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 1pZiKx-0001XX-JR for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237883; 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=dkJycY5uty7BvGapmoRs4tZJwgcuAre7/M98IxWSCgQ=; b=ErjtJrKGVJQ5A5fXJ2XugPZ5t3aEwR7ufS1TXk6UJbwg/c3PV8PgOvXzRgpLXCiVbqvgay zl4cWt2nENdrl9erDnmmCg1TWSD60r/BWjZH817LeMILtr6MIPgZ3AFFq0CU9mJc4Sg3E+ nBZSsJQri6zcZtS4RXbGDlRvctYvjxU= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-531-JUHllARGNxGrED0gERCMzg-1; Tue, 07 Mar 2023 20:11:22 -0500 X-MC-Unique: JUHllARGNxGrED0gERCMzg-1 Received: by mail-ed1-f72.google.com with SMTP id d35-20020a056402402300b004e37aed9832so11978188eda.18 for ; Tue, 07 Mar 2023 17:11:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237880; 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=dkJycY5uty7BvGapmoRs4tZJwgcuAre7/M98IxWSCgQ=; b=qoSdC7U73mkqySogSdpcElTbSWydNI0BAFPX/4Pp2ljLJfy8VCbcPiXLd0moDclwO9 7qh9pRydCdLtxDB0/yli2fsPi9tzAHfNh8oFPZoMv13khXpqW5p1prjyhsrCwW4aT0oh DMomWwww2wleOv5TSGQDxSTMxIVuHJJkT2HRIYUh8ZOdCOf34lHC8he76Ad+rejRI0DN 3+i49I09hqs0mxHy9PAbrg3SetvuyIXMU3zu54+Bo8zCKptcr9pZu2pxo3oiEIZT2D1z lED64989364YulwiLls9O0O3Tjwhc3UEAex2SCoAOQKcvX0ANnBaUkx5XV8NK56EbS45 S0/w== X-Gm-Message-State: AO0yUKUQV7S9U1pmLD9OBwjA70Jr13g+vkVCMl1MFTabf9SlS/dP2iai YQouGjxppYPDR2Yu6KcmtCOqE78yfXNICv5c6gd6mmddtjGR0mzMPlQepr3ZCC8mpe8vrcnbji9 wZ5b75uC/kzpl4Jo1+8KxrOj3/1dHG2DPIN5jtEASnaf5Z00mXfgTsjrWSl20cwzZtTjS X-Received: by 2002:a17:907:9703:b0:8af:514f:1078 with SMTP id jg3-20020a170907970300b008af514f1078mr19955525ejc.31.1678237880467; Tue, 07 Mar 2023 17:11:20 -0800 (PST) X-Google-Smtp-Source: AK7set/FXPN+JSrTjFgRO7OE3DHf+jGpcd4U2ls8QXEggo93tiniHTQ1V++mLvZK1Vj3mbVEgc24pg== X-Received: by 2002:a17:907:9703:b0:8af:514f:1078 with SMTP id jg3-20020a170907970300b008af514f1078mr19955503ejc.31.1678237880155; Tue, 07 Mar 2023 17:11:20 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id o18-20020a170906769200b008dedf1359a0sm6782681ejm.104.2023.03.07.17.11.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:19 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" Subject: [PULL 09/73] cryptodev: Account statistics 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Account OPS/BPS for crypto device, this will be used for 'query-stats' QEMU monitor command and QoS in the next step. Note that a crypto device may support symmetric mode, asymmetric mode, both symmetric and asymmetric mode. So we use two structure to describe the statistics of a crypto device. Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-10-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Daniel P. Berrangé --- include/sysemu/cryptodev.h | 49 +++++++++++++++++++++++++++ backends/cryptodev.c | 68 +++++++++++++++++++++++++++++++++++--- 2 files changed, 112 insertions(+), 5 deletions(-) diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index 048a627035..c0250c4a2c 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -246,6 +246,24 @@ struct CryptoDevBackendConf { uint64_t max_size; }; +typedef struct CryptodevBackendSymStat { + int64_t encrypt_ops; + int64_t decrypt_ops; + int64_t encrypt_bytes; + int64_t decrypt_bytes; +} CryptodevBackendSymStat; + +typedef struct CryptodevBackendAsymStat { + int64_t encrypt_ops; + int64_t decrypt_ops; + int64_t sign_ops; + int64_t verify_ops; + int64_t encrypt_bytes; + int64_t decrypt_bytes; + int64_t sign_bytes; + int64_t verify_bytes; +} CryptodevBackendAsymStat; + struct CryptoDevBackend { Object parent_obj; @@ -253,8 +271,39 @@ struct CryptoDevBackend { /* Tag the cryptodev backend is used by virtio-crypto or not */ bool is_used; CryptoDevBackendConf conf; + CryptodevBackendSymStat *sym_stat; + CryptodevBackendAsymStat *asym_stat; }; +#define CryptodevSymStatInc(be, op, bytes) do { \ + be->sym_stat->op##_bytes += (bytes); \ + be->sym_stat->op##_ops += 1; \ +} while (/*CONSTCOND*/0) + +#define CryptodevSymStatIncEncrypt(be, bytes) \ + CryptodevSymStatInc(be, encrypt, bytes) + +#define CryptodevSymStatIncDecrypt(be, bytes) \ + CryptodevSymStatInc(be, decrypt, bytes) + +#define CryptodevAsymStatInc(be, op, bytes) do { \ + be->asym_stat->op##_bytes += (bytes); \ + be->asym_stat->op##_ops += 1; \ +} while (/*CONSTCOND*/0) + +#define CryptodevAsymStatIncEncrypt(be, bytes) \ + CryptodevAsymStatInc(be, encrypt, bytes) + +#define CryptodevAsymStatIncDecrypt(be, bytes) \ + CryptodevAsymStatInc(be, decrypt, bytes) + +#define CryptodevAsymStatIncSign(be, bytes) \ + CryptodevAsymStatInc(be, sign, bytes) + +#define CryptodevAsymStatIncVerify(be, bytes) \ + CryptodevAsymStatInc(be, verify, bytes) + + /** * cryptodev_backend_new_client: * diff --git a/backends/cryptodev.c b/backends/cryptodev.c index ba7b0bc770..5ee7507ca5 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -107,6 +107,9 @@ void cryptodev_backend_cleanup( if (bc->cleanup) { bc->cleanup(backend, errp); } + + g_free(backend->sym_stat); + g_free(backend->asym_stat); } int cryptodev_backend_create_session( @@ -154,16 +157,61 @@ static int cryptodev_backend_operation( return -VIRTIO_CRYPTO_NOTSUPP; } +static int cryptodev_backend_account(CryptoDevBackend *backend, + CryptoDevBackendOpInfo *op_info) +{ + enum QCryptodevBackendAlgType algtype = op_info->algtype; + int len; + + if (algtype == QCRYPTODEV_BACKEND_ALG_ASYM) { + CryptoDevBackendAsymOpInfo *asym_op_info = op_info->u.asym_op_info; + len = asym_op_info->src_len; + switch (op_info->op_code) { + case VIRTIO_CRYPTO_AKCIPHER_ENCRYPT: + CryptodevAsymStatIncEncrypt(backend, len); + break; + case VIRTIO_CRYPTO_AKCIPHER_DECRYPT: + CryptodevAsymStatIncDecrypt(backend, len); + break; + case VIRTIO_CRYPTO_AKCIPHER_SIGN: + CryptodevAsymStatIncSign(backend, len); + break; + case VIRTIO_CRYPTO_AKCIPHER_VERIFY: + CryptodevAsymStatIncVerify(backend, len); + break; + default: + return -VIRTIO_CRYPTO_NOTSUPP; + } + } else if (algtype == QCRYPTODEV_BACKEND_ALG_SYM) { + CryptoDevBackendSymOpInfo *sym_op_info = op_info->u.sym_op_info; + len = sym_op_info->src_len; + switch (op_info->op_code) { + case VIRTIO_CRYPTO_CIPHER_ENCRYPT: + CryptodevSymStatIncEncrypt(backend, len); + break; + case VIRTIO_CRYPTO_CIPHER_DECRYPT: + CryptodevSymStatIncDecrypt(backend, len); + break; + default: + return -VIRTIO_CRYPTO_NOTSUPP; + } + } else { + error_report("Unsupported cryptodev alg type: %" PRIu32 "", algtype); + return -VIRTIO_CRYPTO_NOTSUPP; + } + + return len; +} + int cryptodev_backend_crypto_operation( CryptoDevBackend *backend, CryptoDevBackendOpInfo *op_info) { - QCryptodevBackendAlgType algtype = op_info->algtype; + int ret; - if ((algtype != QCRYPTODEV_BACKEND_ALG_SYM) - && (algtype != QCRYPTODEV_BACKEND_ALG_ASYM)) { - error_report("Unsupported cryptodev alg type: %" PRIu32 "", algtype); - return -VIRTIO_CRYPTO_NOTSUPP; + ret = cryptodev_backend_account(backend, op_info); + if (ret < 0) { + return ret; } return cryptodev_backend_operation(backend, op_info); @@ -202,10 +250,20 @@ cryptodev_backend_complete(UserCreatable *uc, Error **errp) { CryptoDevBackend *backend = CRYPTODEV_BACKEND(uc); CryptoDevBackendClass *bc = CRYPTODEV_BACKEND_GET_CLASS(uc); + uint32_t services; if (bc->init) { bc->init(backend, errp); } + + services = backend->conf.crypto_services; + if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_CIPHER)) { + backend->sym_stat = g_new0(CryptodevBackendSymStat, 1); + } + + if (services & (1 << QCRYPTODEV_BACKEND_SERVICE_AKCIPHER)) { + backend->asym_stat = g_new0(CryptodevBackendAsymStat, 1); + } } void cryptodev_backend_set_used(CryptoDevBackend *backend, bool used) From patchwork Wed Mar 8 01:11:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753813 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RcKh18DG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDs6YZHz1yWt for ; Wed, 8 Mar 2023 12:17:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiL5-0000nU-N3; Tue, 07 Mar 2023 20:11:31 -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 1pZiL4-0000nI-IT for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:30 -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 1pZiL2-0001Xy-09 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237887; 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=Ra4vIkJKM9hi6aLAOIQfbGKBCS5/tNINdUWp+/DWurY=; b=RcKh18DG4T4aeY+tKrku3l8xIws/iK27q5LGwWH6+5KBGVBaPrZMbCDWuzBclFRywCEMX7 xWVWHMVrfKAN7V7ko/OOB7bGxwRYSOobVZT+vupVtn1lgY13WNGgT9Xbvoz9JyvBlRJR8D V8T7n8bOHpTxsb1X9PgY4J06w6b666M= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-217-96T5X7I0NsC7OCQLE8vdFA-1; Tue, 07 Mar 2023 20:11:26 -0500 X-MC-Unique: 96T5X7I0NsC7OCQLE8vdFA-1 Received: by mail-ed1-f72.google.com with SMTP id da22-20020a056402177600b004c60694083eso21248622edb.5 for ; Tue, 07 Mar 2023 17:11:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237884; 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=Ra4vIkJKM9hi6aLAOIQfbGKBCS5/tNINdUWp+/DWurY=; b=Am1E8A/j5VsaMHg3LDi4KS9eBBtPL6Cy342dAHySxlYOzGcRgbJL3Vexw3yK/S+g66 KzY+550po8DcxBDm/RB4Tbwo3F68tl0JVmGTAU7UPwfgjPVuNeFtwySvhk02nnB4r5V2 hP0rXXrBko1hPU6hP/dvvQXnTU+aJxJoXGOqFJCQmL+7W+0QhipZTnB2JaTWjja3p8j4 QZMvccFkQI1Z9zvZx+yUQH/88CS7kpr7QdG9NeJzBRrK27rx/DPsireZljybBSE+z9uf 09aFUPxyUZMhRq/63IK4RSniNuFyv158RKvQT3Kao/0c4Ej+Kww+2GBl2VLORdHYTi/P Zjfw== X-Gm-Message-State: AO0yUKXtRcQfdREBTqqP2pYNaRHILbLSJeKYW6Q/s1+hCKyNC7/7+Hma fEhIcXpKUpMa/GjgEZMc+48yrxUAvH2vjmqChjDthWFi3vver9h0fjpnEubru58BItJCKb5Gswa RsdmqdXO08nXrcuzHPpAdQ6CKNfkvogxG/cE+mwBw1VOqo8B0Z0mRL3kXTfk8sylQrJwC X-Received: by 2002:a17:906:3b4b:b0:85d:dd20:60a4 with SMTP id h11-20020a1709063b4b00b0085ddd2060a4mr15328711ejf.40.1678237884570; Tue, 07 Mar 2023 17:11:24 -0800 (PST) X-Google-Smtp-Source: AK7set8cDelW2YeUMWTXY+oKNayqnFhVD4v28Z9K/gQGMdRqFJrq67IcwJXqQDwY9pdnmPv6bhRsoA== X-Received: by 2002:a17:906:3b4b:b0:85d:dd20:60a4 with SMTP id h11-20020a1709063b4b00b0085ddd2060a4mr15328690ejf.40.1678237884140; Tue, 07 Mar 2023 17:11:24 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id a25-20020a50c319000000b004af62273b66sm7444234edb.18.2023.03.07.17.11.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:23 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:20 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Paolo Bonzini , Eduardo Habkost , Eric Blake , Markus Armbruster Subject: [PULL 10/73] cryptodev: support QoS Message-ID: <2580b452ffccfb2bcba97dbfcb0d6067d06bc453.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Add 'throttle-bps' and 'throttle-ops' limitation to set QoS. The two arguments work with both QEMU command line and QMP command. Example of QEMU command line: -object cryptodev-backend-builtin,id=cryptodev1,throttle-bps=1600,\ throttle-ops=100 Example of QMP command: virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \ throttle-ops 100 or cancel limitation: virsh qemu-monitor-command buster --hmp qom-set /objects/cryptodev1 \ throttle-ops 0 Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-11-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/qom.json | 8 ++- include/sysemu/cryptodev.h | 7 ++ backends/cryptodev.c | 138 +++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) diff --git a/qapi/qom.json b/qapi/qom.json index 30e76653ad..a877b879b9 100644 --- a/qapi/qom.json +++ b/qapi/qom.json @@ -278,10 +278,16 @@ # cryptodev-backend and must be 1 for cryptodev-backend-builtin. # (default: 1) # +# @throttle-bps: limit total bytes per second (Since 8.0) +# +# @throttle-ops: limit total operations per second (Since 8.0) +# # Since: 2.8 ## { 'struct': 'CryptodevBackendProperties', - 'data': { '*queues': 'uint32' } } + 'data': { '*queues': 'uint32', + '*throttle-bps': 'uint64', + '*throttle-ops': 'uint64' } } ## # @CryptodevVhostUserProperties: diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index c0250c4a2c..bc021ce847 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -24,6 +24,7 @@ #define CRYPTODEV_H #include "qemu/queue.h" +#include "qemu/throttle.h" #include "qom/object.h" #include "qapi/qapi-types-cryptodev.h" @@ -187,6 +188,7 @@ typedef struct CryptoDevBackendOpInfo { CryptoDevBackendSymOpInfo *sym_op_info; CryptoDevBackendAsymOpInfo *asym_op_info; } u; + QTAILQ_ENTRY(CryptoDevBackendOpInfo) next; } CryptoDevBackendOpInfo; struct CryptoDevBackendClass { @@ -273,6 +275,11 @@ struct CryptoDevBackend { CryptoDevBackendConf conf; CryptodevBackendSymStat *sym_stat; CryptodevBackendAsymStat *asym_stat; + + ThrottleState ts; + ThrottleTimers tt; + ThrottleConfig tc; + QTAILQ_HEAD(, CryptoDevBackendOpInfo) opinfos; }; #define CryptodevSymStatInc(be, op, bytes) do { \ diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 5ee7507ca5..7c10a2e1cb 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -28,6 +28,7 @@ #include "qapi/visitor.h" #include "qemu/config-file.h" #include "qemu/error-report.h" +#include "qemu/main-loop.h" #include "qom/object_interfaces.h" #include "hw/virtio/virtio-crypto.h" @@ -203,17 +204,53 @@ static int cryptodev_backend_account(CryptoDevBackend *backend, return len; } +static void cryptodev_backend_throttle_timer_cb(void *opaque) +{ + CryptoDevBackend *backend = (CryptoDevBackend *)opaque; + CryptoDevBackendOpInfo *op_info, *tmpop; + int ret; + + QTAILQ_FOREACH_SAFE(op_info, &backend->opinfos, next, tmpop) { + QTAILQ_REMOVE(&backend->opinfos, op_info, next); + ret = cryptodev_backend_account(backend, op_info); + if (ret < 0) { + op_info->cb(op_info->opaque, ret); + continue; + } + + throttle_account(&backend->ts, true, ret); + cryptodev_backend_operation(backend, op_info); + if (throttle_enabled(&backend->tc) && + throttle_schedule_timer(&backend->ts, &backend->tt, true)) { + break; + } + } +} + int cryptodev_backend_crypto_operation( CryptoDevBackend *backend, CryptoDevBackendOpInfo *op_info) { int ret; + if (!throttle_enabled(&backend->tc)) { + goto do_account; + } + + if (throttle_schedule_timer(&backend->ts, &backend->tt, true) || + !QTAILQ_EMPTY(&backend->opinfos)) { + QTAILQ_INSERT_TAIL(&backend->opinfos, op_info, next); + return 0; + } + +do_account: ret = cryptodev_backend_account(backend, op_info); if (ret < 0) { return ret; } + throttle_account(&backend->ts, true, ret); + return cryptodev_backend_operation(backend, op_info); } @@ -245,12 +282,98 @@ cryptodev_backend_set_queues(Object *obj, Visitor *v, const char *name, backend->conf.peers.queues = value; } +static void cryptodev_backend_set_throttle(CryptoDevBackend *backend, int field, + uint64_t value, Error **errp) +{ + uint64_t orig = backend->tc.buckets[field].avg; + bool enabled = throttle_enabled(&backend->tc); + + if (orig == value) { + return; + } + + backend->tc.buckets[field].avg = value; + if (!throttle_enabled(&backend->tc)) { + throttle_timers_destroy(&backend->tt); + cryptodev_backend_throttle_timer_cb(backend); /* drain opinfos */ + return; + } + + if (!throttle_is_valid(&backend->tc, errp)) { + backend->tc.buckets[field].avg = orig; /* revert change */ + return; + } + + if (!enabled) { + throttle_init(&backend->ts); + throttle_timers_init(&backend->tt, qemu_get_aio_context(), + QEMU_CLOCK_REALTIME, + cryptodev_backend_throttle_timer_cb, /* FIXME */ + cryptodev_backend_throttle_timer_cb, backend); + } + + throttle_config(&backend->ts, QEMU_CLOCK_REALTIME, &backend->tc); +} + +static void cryptodev_backend_get_bps(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); + uint64_t value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg; + + visit_type_uint64(v, name, &value, errp); +} + +static void cryptodev_backend_set_bps(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); + uint64_t value; + + if (!visit_type_uint64(v, name, &value, errp)) { + return; + } + + cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp); +} + +static void cryptodev_backend_get_ops(Object *obj, Visitor *v, const char *name, + void *opaque, Error **errp) +{ + CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); + uint64_t value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg; + + visit_type_uint64(v, name, &value, errp); +} + +static void cryptodev_backend_set_ops(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); + uint64_t value; + + if (!visit_type_uint64(v, name, &value, errp)) { + return; + } + + cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp); +} + static void cryptodev_backend_complete(UserCreatable *uc, Error **errp) { CryptoDevBackend *backend = CRYPTODEV_BACKEND(uc); CryptoDevBackendClass *bc = CRYPTODEV_BACKEND_GET_CLASS(uc); uint32_t services; + uint64_t value; + + QTAILQ_INIT(&backend->opinfos); + value = backend->tc.buckets[THROTTLE_OPS_TOTAL].avg; + cryptodev_backend_set_throttle(backend, THROTTLE_OPS_TOTAL, value, errp); + value = backend->tc.buckets[THROTTLE_BPS_TOTAL].avg; + cryptodev_backend_set_throttle(backend, THROTTLE_BPS_TOTAL, value, errp); if (bc->init) { bc->init(backend, errp); @@ -294,8 +417,12 @@ cryptodev_backend_can_be_deleted(UserCreatable *uc) static void cryptodev_backend_instance_init(Object *obj) { + CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); + /* Initialize devices' queues property to 1 */ object_property_set_int(obj, "queues", 1, NULL); + + throttle_config_init(&backend->tc); } static void cryptodev_backend_finalize(Object *obj) @@ -303,6 +430,9 @@ static void cryptodev_backend_finalize(Object *obj) CryptoDevBackend *backend = CRYPTODEV_BACKEND(obj); cryptodev_backend_cleanup(backend, NULL); + if (throttle_enabled(&backend->tc)) { + throttle_timers_destroy(&backend->tt); + } } static void @@ -318,6 +448,14 @@ cryptodev_backend_class_init(ObjectClass *oc, void *data) cryptodev_backend_get_queues, cryptodev_backend_set_queues, NULL, NULL); + object_class_property_add(oc, "throttle-bps", "uint64", + cryptodev_backend_get_bps, + cryptodev_backend_set_bps, + NULL, NULL); + object_class_property_add(oc, "throttle-ops", "uint64", + cryptodev_backend_get_ops, + cryptodev_backend_set_ops, + NULL, NULL); } static const TypeInfo cryptodev_backend_info = { From patchwork Wed Mar 8 01:11:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Eovnxg1r; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ5t2bJvz1yWm for ; Wed, 8 Mar 2023 12:11:46 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiL9-0000x8-F1; Tue, 07 Mar 2023 20:11:35 -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 1pZiL7-0000nc-At for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:33 -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 1pZiL5-0001YK-83 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237890; 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=zvXrSdmjxjxzGODrxbz+n6TWMukma32X8pz1bxfaXDc=; b=Eovnxg1rkY+WBa3qsQwY+xQZ+qeXhE1ZXjqe06SjmKRXxTk8FVq6MmrAz32uwld+Cj9f5h dN5zcAcyUzeWAkoRdyRL+zCetF2dqvifwMLYpBdOIOMBFCBgPyiF7WiYoxmhfSaqYqZAdm nzmUJHsR28ygjDkWj8oYQ+3TlP6isPY= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-qHBJZ0GYN4WxH3myAlR0Pg-1; Tue, 07 Mar 2023 20:11:29 -0500 X-MC-Unique: qHBJZ0GYN4WxH3myAlR0Pg-1 Received: by mail-ed1-f69.google.com with SMTP id p36-20020a056402502400b004bb926a3d54so21287106eda.2 for ; Tue, 07 Mar 2023 17:11:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237887; 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=zvXrSdmjxjxzGODrxbz+n6TWMukma32X8pz1bxfaXDc=; b=ineRoxB41kjUs1fVc65VSnx1uEP8TbaYjM8VKs9nxaxuTVpD7bqLPp9bUeEuoKeZzh S3m7YTOmHH9XR5eULLFPDLvsSwhrIMVaqgxPHAD3Tm60UosHlITkVxIzqputmV51MIny 9ehH9gQDyFpCv6Ko0dRFyNDLcvjM5v8i8NiK+G88KLYPflrJDHGu2daBxuOq1jf4tBGZ +s0RkR50BFJ3mamSFfbVk3XNOu/niVhq7NWzTHXtfwXcPI+IGWnTHlYM+75u4OlGXs0l pw/gNQawXg09v2uwbq2OrnKpAbXYpg7QZQqLvEdrLpNRnpABW/YWEpSx8FdLSQIje1uf bkkQ== X-Gm-Message-State: AO0yUKUSiIzMmv9cTUol9s/Z2dGqoTLRtCsAPTnAjT/9ivSyPq+9/spL /3sc3GVBLHkSNmiXqOprbWLi4lOt9HV9EEUDDT1songA31FADKkCI9Kor78Btklwzmis/0Hp6bH Pc1cpXd4CpLEtUkdnp/hPzHE09YTCQBYWNVkmfIjm6B+aENnHJy2WskQ/8B9NO9zPK4Mp X-Received: by 2002:a17:907:98a3:b0:88a:1ea9:a5ea with SMTP id ju3-20020a17090798a300b0088a1ea9a5eamr16379032ejc.65.1678237887675; Tue, 07 Mar 2023 17:11:27 -0800 (PST) X-Google-Smtp-Source: AK7set8fzqRUExeKq74ilBxvpiR6hlj0bhDQfWJ0kLCF48mWBbUWWB0fetHCqrffXuqCceggA5tNFw== X-Received: by 2002:a17:907:98a3:b0:88a:1ea9:a5ea with SMTP id ju3-20020a17090798a300b0088a1ea9a5eamr16379017ejc.65.1678237887386; Tue, 07 Mar 2023 17:11:27 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id se18-20020a170906ce5200b008d6e551e1bcsm6752398ejb.2.2023.03.07.17.11.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:26 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:24 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Daniel P =?utf-8?b?LiBCZXJyYW5nw6k=?= , "Gonglei (Arei)" , Eric Blake , Markus Armbruster Subject: [PULL 11/73] cryptodev: Support query-stats QMP command 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi Now we can use "query-stats" QMP command to query statistics of crypto devices. (Originally this was designed to show statistics by '{"execute": "query-cryptodev"}'. Daniel Berrangé suggested that querying configuration info by "query-cryptodev", and querying runtime performance info by "query-stats". This makes sense!) Example: ~# virsh qemu-monitor-command vm '{"execute": "query-stats", \ "arguments": {"target": "cryptodev"} }' | jq { "return": [ { "provider": "cryptodev", "stats": [ { "name": "asym-verify-bytes", "value": 7680 }, ... { "name": "asym-decrypt-ops", "value": 32 }, { "name": "asym-encrypt-ops", "value": 48 } ], "qom-path": "/objects/cryptodev0" # support asym only }, { "provider": "cryptodev", "stats": [ { "name": "asym-verify-bytes", "value": 0 }, ... { "name": "sym-decrypt-bytes", "value": 5376 }, ... ], "qom-path": "/objects/cryptodev1" # support asym/sym } ], "id": "libvirt-422" } Suggested-by: Daniel P. Berrangé Reviewed-by: Daniel P. Berrangé Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-12-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/stats.json | 10 ++- backends/cryptodev.c | 155 +++++++++++++++++++++++++++++++++++++++++ stats/stats-hmp-cmds.c | 5 ++ stats/stats-qmp-cmds.c | 2 + 4 files changed, 170 insertions(+), 2 deletions(-) diff --git a/qapi/stats.json b/qapi/stats.json index 57db5b1c74..1f5d3c59ab 100644 --- a/qapi/stats.json +++ b/qapi/stats.json @@ -50,10 +50,14 @@ # # Enumeration of statistics providers. # +# @kvm: since 7.1 +# +# @cryptodev: since 8.0 +# # Since: 7.1 ## { 'enum': 'StatsProvider', - 'data': [ 'kvm' ] } + 'data': [ 'kvm', 'cryptodev' ] } ## # @StatsTarget: @@ -65,10 +69,12 @@ # # @vcpu: statistics that apply to a single virtual CPU. # +# @cryptodev: statistics that apply to a crypto device. since 8.0 +# # Since: 7.1 ## { 'enum': 'StatsTarget', - 'data': [ 'vm', 'vcpu' ] } + 'data': [ 'vm', 'vcpu', 'cryptodev' ] } ## # @StatsRequest: diff --git a/backends/cryptodev.c b/backends/cryptodev.c index 7c10a2e1cb..94ca393cee 100644 --- a/backends/cryptodev.c +++ b/backends/cryptodev.c @@ -23,8 +23,10 @@ #include "qemu/osdep.h" #include "sysemu/cryptodev.h" +#include "sysemu/stats.h" #include "qapi/error.h" #include "qapi/qapi-commands-cryptodev.h" +#include "qapi/qapi-types-stats.h" #include "qapi/visitor.h" #include "qemu/config-file.h" #include "qemu/error-report.h" @@ -32,6 +34,28 @@ #include "qom/object_interfaces.h" #include "hw/virtio/virtio-crypto.h" +#define SYM_ENCRYPT_OPS_STR "sym-encrypt-ops" +#define SYM_DECRYPT_OPS_STR "sym-decrypt-ops" +#define SYM_ENCRYPT_BYTES_STR "sym-encrypt-bytes" +#define SYM_DECRYPT_BYTES_STR "sym-decrypt-bytes" + +#define ASYM_ENCRYPT_OPS_STR "asym-encrypt-ops" +#define ASYM_DECRYPT_OPS_STR "asym-decrypt-ops" +#define ASYM_SIGN_OPS_STR "asym-sign-ops" +#define ASYM_VERIFY_OPS_STR "asym-verify-ops" +#define ASYM_ENCRYPT_BYTES_STR "asym-encrypt-bytes" +#define ASYM_DECRYPT_BYTES_STR "asym-decrypt-bytes" +#define ASYM_SIGN_BYTES_STR "asym-sign-bytes" +#define ASYM_VERIFY_BYTES_STR "asym-verify-bytes" + +typedef struct StatsArgs { + union StatsResultsType { + StatsResultList **stats; + StatsSchemaList **schema; + } result; + strList *names; + Error **errp; +} StatsArgs; static QTAILQ_HEAD(, CryptoDevBackendClient) crypto_clients; @@ -435,6 +459,134 @@ static void cryptodev_backend_finalize(Object *obj) } } +static StatsList *cryptodev_backend_stats_add(const char *name, int64_t *val, + StatsList *stats_list) +{ + Stats *stats = g_new0(Stats, 1); + + stats->name = g_strdup(name); + stats->value = g_new0(StatsValue, 1); + stats->value->type = QTYPE_QNUM; + stats->value->u.scalar = *val; + + QAPI_LIST_PREPEND(stats_list, stats); + return stats_list; +} + +static int cryptodev_backend_stats_query(Object *obj, void *data) +{ + StatsArgs *stats_args = data; + StatsResultList **stats_results = stats_args->result.stats; + StatsList *stats_list = NULL; + StatsResult *entry; + CryptoDevBackend *backend; + CryptodevBackendSymStat *sym_stat; + CryptodevBackendAsymStat *asym_stat; + + if (!object_dynamic_cast(obj, TYPE_CRYPTODEV_BACKEND)) { + return 0; + } + + backend = CRYPTODEV_BACKEND(obj); + sym_stat = backend->sym_stat; + if (sym_stat) { + stats_list = cryptodev_backend_stats_add(SYM_ENCRYPT_OPS_STR, + &sym_stat->encrypt_ops, stats_list); + stats_list = cryptodev_backend_stats_add(SYM_DECRYPT_OPS_STR, + &sym_stat->decrypt_ops, stats_list); + stats_list = cryptodev_backend_stats_add(SYM_ENCRYPT_BYTES_STR, + &sym_stat->encrypt_bytes, stats_list); + stats_list = cryptodev_backend_stats_add(SYM_DECRYPT_BYTES_STR, + &sym_stat->decrypt_bytes, stats_list); + } + + asym_stat = backend->asym_stat; + if (asym_stat) { + stats_list = cryptodev_backend_stats_add(ASYM_ENCRYPT_OPS_STR, + &asym_stat->encrypt_ops, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_DECRYPT_OPS_STR, + &asym_stat->decrypt_ops, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_SIGN_OPS_STR, + &asym_stat->sign_ops, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_VERIFY_OPS_STR, + &asym_stat->verify_ops, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_ENCRYPT_BYTES_STR, + &asym_stat->encrypt_bytes, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_DECRYPT_BYTES_STR, + &asym_stat->decrypt_bytes, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_SIGN_BYTES_STR, + &asym_stat->sign_bytes, stats_list); + stats_list = cryptodev_backend_stats_add(ASYM_VERIFY_BYTES_STR, + &asym_stat->verify_bytes, stats_list); + } + + entry = g_new0(StatsResult, 1); + entry->provider = STATS_PROVIDER_CRYPTODEV; + entry->qom_path = g_strdup(object_get_canonical_path(obj)); + entry->stats = stats_list; + QAPI_LIST_PREPEND(*stats_results, entry); + + return 0; +} + +static void cryptodev_backend_stats_cb(StatsResultList **result, + StatsTarget target, + strList *names, strList *targets, + Error **errp) +{ + switch (target) { + case STATS_TARGET_CRYPTODEV: + { + Object *objs = container_get(object_get_root(), "/objects"); + StatsArgs stats_args; + stats_args.result.stats = result; + stats_args.names = names; + stats_args.errp = errp; + + object_child_foreach(objs, cryptodev_backend_stats_query, &stats_args); + break; + } + default: + break; + } +} + +static StatsSchemaValueList *cryptodev_backend_schemas_add(const char *name, + StatsSchemaValueList *list) +{ + StatsSchemaValueList *schema_entry = g_new0(StatsSchemaValueList, 1); + + schema_entry->value = g_new0(StatsSchemaValue, 1); + schema_entry->value->type = STATS_TYPE_CUMULATIVE; + schema_entry->value->name = g_strdup(name); + schema_entry->next = list; + + return schema_entry; +} + +static void cryptodev_backend_schemas_cb(StatsSchemaList **result, + Error **errp) +{ + StatsSchemaValueList *stats_list = NULL; + const char *sym_stats[] = { SYM_ENCRYPT_OPS_STR, SYM_DECRYPT_OPS_STR, + SYM_ENCRYPT_BYTES_STR, SYM_DECRYPT_BYTES_STR }; + const char *asym_stats[] = { ASYM_ENCRYPT_OPS_STR, ASYM_DECRYPT_OPS_STR, + ASYM_SIGN_OPS_STR, ASYM_VERIFY_OPS_STR, + ASYM_ENCRYPT_BYTES_STR, ASYM_DECRYPT_BYTES_STR, + ASYM_SIGN_BYTES_STR, ASYM_VERIFY_BYTES_STR }; + + for (int i = 0; i < ARRAY_SIZE(sym_stats); i++) { + stats_list = cryptodev_backend_schemas_add(sym_stats[i], stats_list); + } + + for (int i = 0; i < ARRAY_SIZE(asym_stats); i++) { + stats_list = cryptodev_backend_schemas_add(asym_stats[i], stats_list); + } + + add_stats_schema(result, STATS_PROVIDER_CRYPTODEV, STATS_TARGET_CRYPTODEV, + stats_list); +} + static void cryptodev_backend_class_init(ObjectClass *oc, void *data) { @@ -456,6 +608,9 @@ cryptodev_backend_class_init(ObjectClass *oc, void *data) cryptodev_backend_get_ops, cryptodev_backend_set_ops, NULL, NULL); + + add_stats_callbacks(STATS_PROVIDER_CRYPTODEV, cryptodev_backend_stats_cb, + cryptodev_backend_schemas_cb); } static const TypeInfo cryptodev_backend_info = { diff --git a/stats/stats-hmp-cmds.c b/stats/stats-hmp-cmds.c index 531e35d128..1f91bf8bd5 100644 --- a/stats/stats-hmp-cmds.c +++ b/stats/stats-hmp-cmds.c @@ -155,6 +155,8 @@ static StatsFilter *stats_filter(StatsTarget target, const char *names, filter->u.vcpu.vcpus = vcpu_list; break; } + case STATS_TARGET_CRYPTODEV: + break; default: break; } @@ -226,6 +228,9 @@ void hmp_info_stats(Monitor *mon, const QDict *qdict) int cpu_index = monitor_get_cpu_index(mon); filter = stats_filter(target, names, cpu_index, provider); break; + case STATS_TARGET_CRYPTODEV: + filter = stats_filter(target, names, -1, provider); + break; default: abort(); } diff --git a/stats/stats-qmp-cmds.c b/stats/stats-qmp-cmds.c index bc973747fb..e214b964fd 100644 --- a/stats/stats-qmp-cmds.c +++ b/stats/stats-qmp-cmds.c @@ -64,6 +64,8 @@ static bool invoke_stats_cb(StatsCallbacks *entry, targets = filter->u.vcpu.vcpus; } break; + case STATS_TARGET_CRYPTODEV: + break; default: abort(); } From patchwork Wed Mar 8 01:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753770 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gZ5ZHyfo; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ6T30jnz1yWm for ; Wed, 8 Mar 2023 12:12:17 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLB-0000yx-4o; Tue, 07 Mar 2023 20:11: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 1pZiL9-0000xo-Um for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:35 -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 1pZiL8-0001YX-6z for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237893; 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=rChHAev6adIa0o9WmxAEYbKw6MUNz8l/c+RQN4k0e3Y=; b=gZ5ZHyfo7dXCci4jWUhS8jozduTidna6S1hVp8WQplFAQ06TlzMzKLKw2fMGkLpxmQFrTp prmtrSVIR3YB4crB5txZGLkyB2OjvNgllnrtV4+XBsB5DB3FLJ581tyceoExL1kY5tttwu reVZmwJ1SKz7kqEXXjAf5Yd/vO9WzSk= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-369-W1hz64XUO2WdVHLGg_mYqw-1; Tue, 07 Mar 2023 20:11:32 -0500 X-MC-Unique: W1hz64XUO2WdVHLGg_mYqw-1 Received: by mail-ed1-f69.google.com with SMTP id ee15-20020a056402290f00b004f059728d91so4492288edb.23 for ; Tue, 07 Mar 2023 17:11:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237891; 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=rChHAev6adIa0o9WmxAEYbKw6MUNz8l/c+RQN4k0e3Y=; b=jJ7cyhenDjq85Uiie3d61L//nP4QbS8YKyohSbVnHyk1DIgqaCRkZJYMOGf1uupmDZ nqjUmBs9vqiT8XTz4qDq1KJNmQJ4yV6y0e/2oyBIgGQ8OvU6qO24Zi3+PnMmuGii0kBt gUs3QxzmTv18EywueKOfmC+hljZ/mMGF0twU/3yl2Lh6RK1tpzO1KstfnBChhY+MGQ89 aWp4NPeTPoeWwgNu51ozm2TvDK0d+ex820QYaz77mQzXBalqtFlhnIE/XkZ0wRzStCyo SFrq/z2lqflJLU0JlT4+mMWE2xggp0IGhwTxiw7GcTjpWkZ/bDYDeUG9WMoG5HO4IqtT wogQ== X-Gm-Message-State: AO0yUKW7xQ6mbMA38j3hMee3UDiqkmU/H2GfMWAQ6jfQP7+Y1K9LRjPB 5esOID+j+IvZUH1sf7D425YS+jIvUgYSD51TqbvEZqouDlABct1tPvWSQ+6lS5yRB8WskZlACt6 ujzQLFtQyd6r6Sb65ZcQ9JoN/e2k38smEozmSTJdzUORUnc6ulBCjS5G2hzeUJefcKM9z X-Received: by 2002:a17:906:7948:b0:8b2:37b5:cc4 with SMTP id l8-20020a170906794800b008b237b50cc4mr24407444ejo.7.1678237890805; Tue, 07 Mar 2023 17:11:30 -0800 (PST) X-Google-Smtp-Source: AK7set/+xhnQ33SWH86S5czY3dMKejwDs1TCS57fwnu63mzAB1oabhPHy1lPjKVzr/pHkMIM4yJSxA== X-Received: by 2002:a17:906:7948:b0:8b2:37b5:cc4 with SMTP id l8-20020a170906794800b008b237b50cc4mr24407418ejo.7.1678237890430; Tue, 07 Mar 2023 17:11:30 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d6-20020a1709064c4600b008eb5b085075sm6681877ejw.122.2023.03.07.17.11.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:29 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:27 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , zhenwei pi , Gonglei , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson , Thomas Huth , Alex =?utf-8?q?Benn=C3=A9e?= Subject: [PULL 12/73] MAINTAINERS: add myself as the maintainer for cryptodev Message-ID: <2133e07c4ca1d0befa382e557d2f6b38c77ed689.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: zhenwei pi I developed the akcipher service, QoS setting, QMP/HMP commands and statistics accounting for crypto device. Making myself as the maintainer for QEMU's cryptodev. Cc: Gonglei Signed-off-by: zhenwei pi Message-Id: <20230301105847.253084-13-pizhenwei@bytedance.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index cbb05de8eb..72ac2ac4b6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2876,6 +2876,7 @@ T: git https://gitlab.com/ehabkost/qemu.git machine-next Cryptodev Backends M: Gonglei +M: zhenwei pi S: Maintained F: include/sysemu/cryptodev*.h F: backends/cryptodev*.c From patchwork Wed Mar 8 01:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753772 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KJO4xoo6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ6x5MmJz1yWm for ; Wed, 8 Mar 2023 12:12:41 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLE-00011C-TX; Tue, 07 Mar 2023 20:11: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 1pZiLC-0000zt-Nb for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:38 -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 1pZiLA-0001Yr-PC for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237896; 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=e3Ohk9wF7jUIc7lyfPautXjbsnuEi5eU7cxKR4NhDqw=; b=KJO4xoo6+WexfTdFhEBWyCa5SPZ2mMPKPTR88mLUB9jR6i5ZbtBKl1Qu3zMJkGQv3lugKY 7L+hnWU4HzzqZxBrKThoeYYLXqtYSRaZaR/5e46gOlUmMX/7dr3+u9PC/cR7SOLCyR18F8 Nd/1/tBlFgOa/JReOUfKEMjisqI/MhY= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-97-lGwI2pjBMBicDYWCboKUZg-1; Tue, 07 Mar 2023 20:11:35 -0500 X-MC-Unique: lGwI2pjBMBicDYWCboKUZg-1 Received: by mail-ed1-f72.google.com with SMTP id ec11-20020a0564020d4b00b004e2cb85c8bcso12384878edb.16 for ; Tue, 07 Mar 2023 17:11:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237893; 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=e3Ohk9wF7jUIc7lyfPautXjbsnuEi5eU7cxKR4NhDqw=; b=WzgUFuMh7SPzubbTzjFbmcaCBwYtY6mf8V55bs0alEVWxdh5fWKheVpTwlZbXyErl8 M1qOS0z7lYxNdd7kjWG2tg8XHS52lzsUbc5m2VM6fT4y5kNHW18FI0E5v/8cK8Waczyd F1m8rWHEmqIhFA1CP+fJG69/oPdON58LJs8RkjJMtC6+ePltZTD+rybDUERBVSu2Y4UX grGfMLeyPJEpkRlmkRQA6WlyKYyozwZnr+YjTnIr8Fw1XqN7uujIAHakLsdUyNXK63E7 GfkiDELR4/d3exQqY3Ejd1mPdm3dTSfU0wabKEaBs7MlgJQTaexZmhK8XwfwUIQd1ye0 WfJg== X-Gm-Message-State: AO0yUKXCwxvmMDTvXwpkIWRYi9Pd8PFlpehk0lk9Kyo1u0Zt+1IJ7Q5j zqlosQEZzZsjh5+chXBXHmD7FXrQelxwEM05RJarzleorfJr4AOzkzctF6tNkXZ0MyFnUPKy0RE eXPw7cFhG2xcDlJom4DhSzm4QWZhmy6JAkAoEctvbsbEMZJ6L3ZFLPsputTnr3AY8iHu7 X-Received: by 2002:a17:906:a042:b0:8aa:875d:9d9a with SMTP id bg2-20020a170906a04200b008aa875d9d9amr17224932ejb.50.1678237893296; Tue, 07 Mar 2023 17:11:33 -0800 (PST) X-Google-Smtp-Source: AK7set/vtCWuooc14yCGLUQNd9/koY37+e/cBVtS6SN9ttxrf1AexxIONkRGKq7O38MwH5ArFXd63Q== X-Received: by 2002:a17:906:a042:b0:8aa:875d:9d9a with SMTP id bg2-20020a170906a04200b008aa875d9d9amr17224917ejb.50.1678237892977; Tue, 07 Mar 2023 17:11:32 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id le16-20020a170907171000b008da6a37de1bsm6906861ejc.10.2023.03.07.17.11.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:32 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:30 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Lei Yang Subject: [PULL 13/73] vdpa net: move iova tree creation from init to start Message-ID: <00ef422e9fbfef1fb40447b08826db0951d788dd.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez Only create iova_tree if and when it is needed. The cleanup keeps being responsible for the last VQ but this change allows it to merge both cleanup functions. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20230303172445.1089785-2-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 113 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 30 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index de5ed8ff22..d195f48776 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -178,13 +178,9 @@ err_init: static void vhost_vdpa_cleanup(NetClientState *nc) { VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc); - struct vhost_dev *dev = &s->vhost_net->dev; qemu_vfree(s->cvq_cmd_out_buffer); qemu_vfree(s->status); - if (dev->vq_index + dev->nvqs == dev->vq_index_end) { - g_clear_pointer(&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); - } if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); g_free(s->vhost_net); @@ -234,10 +230,64 @@ static ssize_t vhost_vdpa_receive(NetClientState *nc, const uint8_t *buf, return size; } +/** From any vdpa net client, get the netclient of the first queue pair */ +static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s) +{ + NICState *nic = qemu_get_nic(s->nc.peer); + NetClientState *nc0 = qemu_get_peer(nic->ncs, 0); + + return DO_UPCAST(VhostVDPAState, nc, nc0); +} + +static void vhost_vdpa_net_data_start_first(VhostVDPAState *s) +{ + struct vhost_vdpa *v = &s->vhost_vdpa; + + if (v->shadow_vqs_enabled) { + v->iova_tree = vhost_iova_tree_new(v->iova_range.first, + v->iova_range.last); + } +} + +static int vhost_vdpa_net_data_start(NetClientState *nc) +{ + VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc); + struct vhost_vdpa *v = &s->vhost_vdpa; + + assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); + + if (v->index == 0) { + vhost_vdpa_net_data_start_first(s); + return 0; + } + + if (v->shadow_vqs_enabled) { + VhostVDPAState *s0 = vhost_vdpa_net_first_nc_vdpa(s); + v->iova_tree = s0->vhost_vdpa.iova_tree; + } + + return 0; +} + +static void vhost_vdpa_net_client_stop(NetClientState *nc) +{ + VhostVDPAState *s = DO_UPCAST(VhostVDPAState, nc, nc); + struct vhost_dev *dev; + + assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); + + dev = s->vhost_vdpa.dev; + if (dev->vq_index + dev->nvqs == dev->vq_index_end) { + g_clear_pointer(&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); + } +} + static NetClientInfo net_vhost_vdpa_info = { .type = NET_CLIENT_DRIVER_VHOST_VDPA, .size = sizeof(VhostVDPAState), .receive = vhost_vdpa_receive, + .start = vhost_vdpa_net_data_start, + .stop = vhost_vdpa_net_client_stop, .cleanup = vhost_vdpa_cleanup, .has_vnet_hdr = vhost_vdpa_has_vnet_hdr, .has_ufo = vhost_vdpa_has_ufo, @@ -351,7 +401,7 @@ dma_map_err: static int vhost_vdpa_net_cvq_start(NetClientState *nc) { - VhostVDPAState *s; + VhostVDPAState *s, *s0; struct vhost_vdpa *v; uint64_t backend_features; int64_t cvq_group; @@ -415,8 +465,6 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc) return r; } - v->iova_tree = vhost_iova_tree_new(v->iova_range.first, - v->iova_range.last); v->shadow_vqs_enabled = true; s->vhost_vdpa.address_space_id = VHOST_VDPA_NET_CVQ_ASID; @@ -425,6 +473,27 @@ out: return 0; } + s0 = vhost_vdpa_net_first_nc_vdpa(s); + if (s0->vhost_vdpa.iova_tree) { + /* + * SVQ is already configured for all virtqueues. Reuse IOVA tree for + * simplicity, whether CVQ shares ASID with guest or not, because: + * - Memory listener need access to guest's memory addresses allocated + * in the IOVA tree. + * - There should be plenty of IOVA address space for both ASID not to + * worry about collisions between them. Guest's translations are + * still validated with virtio virtqueue_pop so there is no risk for + * the guest to access memory that it shouldn't. + * + * To allocate a iova tree per ASID is doable but it complicates the + * code and it is not worth it for the moment. + */ + v->iova_tree = s0->vhost_vdpa.iova_tree; + } else { + v->iova_tree = vhost_iova_tree_new(v->iova_range.first, + v->iova_range.last); + } + r = vhost_vdpa_cvq_map_buf(&s->vhost_vdpa, s->cvq_cmd_out_buffer, vhost_vdpa_net_cvq_cmd_page_len(), false); if (unlikely(r < 0)) { @@ -449,15 +518,9 @@ static void vhost_vdpa_net_cvq_stop(NetClientState *nc) if (s->vhost_vdpa.shadow_vqs_enabled) { vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->cvq_cmd_out_buffer); vhost_vdpa_cvq_unmap_buf(&s->vhost_vdpa, s->status); - if (!s->always_svq) { - /* - * If only the CVQ is shadowed we can delete this safely. - * If all the VQs are shadows this will be needed by the time the - * device is started again to register SVQ vrings and similar. - */ - g_clear_pointer(&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); - } } + + vhost_vdpa_net_client_stop(nc); } static ssize_t vhost_vdpa_net_cvq_add(VhostVDPAState *s, size_t out_len, @@ -667,8 +730,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, int nvqs, bool is_datapath, bool svq, - struct vhost_vdpa_iova_range iova_range, - VhostIOVATree *iova_tree) + struct vhost_vdpa_iova_range iova_range) { NetClientState *nc = NULL; VhostVDPAState *s; @@ -690,7 +752,6 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.shadow_data = svq; - s->vhost_vdpa.iova_tree = iova_tree; if (!is_datapath) { s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(), vhost_vdpa_net_cvq_cmd_page_len()); @@ -760,7 +821,6 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, uint64_t features; int vdpa_device_fd; g_autofree NetClientState **ncs = NULL; - g_autoptr(VhostIOVATree) iova_tree = NULL; struct vhost_vdpa_iova_range iova_range; NetClientState *nc; int queue_pairs, r, i = 0, has_cvq = 0; @@ -812,12 +872,8 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, goto err; } - if (opts->x_svq) { - if (!vhost_vdpa_net_valid_svq_features(features, errp)) { - goto err_svq; - } - - iova_tree = vhost_iova_tree_new(iova_range.first, iova_range.last); + if (opts->x_svq && !vhost_vdpa_net_valid_svq_features(features, errp)) { + goto err; } ncs = g_malloc0(sizeof(*ncs) * queue_pairs); @@ -825,7 +881,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, for (i = 0; i < queue_pairs; i++) { ncs[i] = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd, i, 2, true, opts->x_svq, - iova_range, iova_tree); + iova_range); if (!ncs[i]) goto err; } @@ -833,13 +889,11 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, if (has_cvq) { nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd, i, 1, false, - opts->x_svq, iova_range, iova_tree); + opts->x_svq, iova_range); if (!nc) goto err; } - /* iova_tree ownership belongs to last NetClientState */ - g_steal_pointer(&iova_tree); return 0; err: @@ -849,7 +903,6 @@ err: } } -err_svq: qemu_close(vdpa_device_fd); return -1; From patchwork Wed Mar 8 01:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753771 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UMByV/UY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ6b5n7Bz1yWm for ; Wed, 8 Mar 2023 12:12:23 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLG-00011U-Gq; Tue, 07 Mar 2023 20:11:42 -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 1pZiLF-00011G-0E for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:41 -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 1pZiLD-0001Z6-Ko for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237899; 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=KoF+K0Z/bB0Jssj7kEbUqe1HsYBZTQrBtW/A5NQcmoE=; b=UMByV/UYq9sxKtXiE4Jm39xQZwPtsJtqo+YbnZEQj6BKUe2q03manNWNU3WpXrLT0Evc5D CbCwYEa+3XECMqKHL4TEiBIYuKSxQ8yyCyUAov6SzmQFy9nx30agytcxX4AipnahS5eVhh li0e4CgeXhAfDVBo2O1I17I5LJ9qVD8= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-52-LJz-7DYBMnqLScILuBAGpA-1; Tue, 07 Mar 2023 20:11:38 -0500 X-MC-Unique: LJz-7DYBMnqLScILuBAGpA-1 Received: by mail-ed1-f70.google.com with SMTP id d35-20020a056402402300b004e37aed9832so11979041eda.18 for ; Tue, 07 Mar 2023 17:11:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237896; 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=KoF+K0Z/bB0Jssj7kEbUqe1HsYBZTQrBtW/A5NQcmoE=; b=O+nYasFhEo4+8CVZNrtRmgWVsibFk4zSk6tascmDcdjBwmtUQbYlOmW4Q1mqZB+ZTi LQTzm0vM3quDOmjaAkuQhvErNhXvN/l4v+D0W44pbie3mwUO7sz4jURK0jmB2HLfUTQ4 h5EfP0bx3bcXN6nnqQlEzPXlxnJX6N4L/oS3dZsVO/60+XS6sfY4fkamOCVCqto98BcS MfpLD0puDULUlvgxr/IIA0xjPc+jVK25iI04zLfraQKuf2Heya8bvhQqkLE/+RlkIWaf njUYQSNNTWGoiCEUYAb9IhBQ6/FcA4W5gMdIdH6RpTe9sd/C0tVV8Hj7uZ1rS5ELAWmy AsGA== X-Gm-Message-State: AO0yUKWGYKMm8N4+t4OaxSsNTSq2D9EwLNI9CpzxUydeT6ocypRbQzfu deu3luU4nFhpEqgwzA2NBGGKsWCH23A/Toc8+O8VTibO0npdm3ymyEicJ+ksvMZxhWF0e2GE5qo woR6TrqI4lwTD/W9/7clEhOdKE8XL7ZlC8YroWoA9fxuatMyG05rat3ytn0FqQBS6sWxQ X-Received: by 2002:a17:906:b10d:b0:8c0:6422:e0c2 with SMTP id u13-20020a170906b10d00b008c06422e0c2mr16594553ejy.22.1678237896305; Tue, 07 Mar 2023 17:11:36 -0800 (PST) X-Google-Smtp-Source: AK7set9hDjBKQgLNIyrszt0OyvQ3AuV2UyWwjc+JL8w2UWM/ZKyh+VAXaeNfGEQ+4ubNSYQs53gwiQ== X-Received: by 2002:a17:906:b10d:b0:8c0:6422:e0c2 with SMTP id u13-20020a170906b10d00b008c06422e0c2mr16594541ejy.22.1678237896026; Tue, 07 Mar 2023 17:11:36 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id p20-20020a17090653d400b008e97fdd6c7csm6725361ejo.129.2023.03.07.17.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:35 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:33 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 14/73] vdpa: Remember last call fd set 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez As SVQ can be enabled dynamically at any time, it needs to store call fd always. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-3-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index df3a1e92ac..108cd63289 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1227,16 +1227,16 @@ static int vhost_vdpa_set_vring_call(struct vhost_dev *dev, struct vhost_vring_file *file) { struct vhost_vdpa *v = dev->opaque; + int vdpa_idx = file->index - dev->vq_index; + VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx); + /* Remember last call fd because we can switch to SVQ anytime. */ + vhost_svq_set_svq_call_fd(svq, file->fd); if (v->shadow_vqs_enabled) { - int vdpa_idx = file->index - dev->vq_index; - VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx); - - vhost_svq_set_svq_call_fd(svq, file->fd); return 0; - } else { - return vhost_vdpa_set_vring_dev_call(dev, file); } + + return vhost_vdpa_set_vring_dev_call(dev, file); } static int vhost_vdpa_get_features(struct vhost_dev *dev, From patchwork Wed Mar 8 01:11:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753774 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MPnZg/6Y; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ704wvZz1yWm for ; Wed, 8 Mar 2023 12:12:44 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLJ-00015B-Op; Tue, 07 Mar 2023 20:11:45 -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 1pZiLI-00011t-8f for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11: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 1pZiLG-0001ZH-T2 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237902; 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=FyT6N8lDTFKoLVEIvDcV9LdLznYSzYH679P93J0oUXE=; b=MPnZg/6YhRBu5nFNbeOgDFjadsWbJ3d7uN3BuLFmVwvghheVwvR3TmzXtKOtE0vxdzJeDq 4dFmEVef6sF5r79WftLKSW3CLQqYmkEN1n/GzyOdWGx3lc7FE1/q4UmBPZVYpoJS3f5+ir 8CZGn6aRenjgvnEjFMQc9x0TBOK2fvc= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-303-AfKxDybwPOK7B2Pbx0j5hg-1; Tue, 07 Mar 2023 20:11:40 -0500 X-MC-Unique: AfKxDybwPOK7B2Pbx0j5hg-1 Received: by mail-ed1-f71.google.com with SMTP id b7-20020a056402350700b004d2a3d5cd3fso16146416edd.8 for ; Tue, 07 Mar 2023 17:11:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237899; 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=FyT6N8lDTFKoLVEIvDcV9LdLznYSzYH679P93J0oUXE=; b=xRj7ShBl5grvRZqJuz4i+ykKOoWVM6Dsj5zMDRd4X528tOxUs4Lw4ctd8rNTwjIpOE d8BRVIasNJudZQ0chZd00dvxVhNI0hl+XSknlohLc0uHPiXBCAN52VzJQg4Gm514nHcG bBwD/Rb+vsOcAylPbirBJuFB2cRWB//QMh1/ISc1E6A+EBZq1LwgEhw/LOpG7AuC1pj9 CZk+SrS+J9xxDFssXVHdHXI1G86+U9uDdwydFZcAdwzA48bV8l5eiZysyAj51w5rgW7S c4a7gk/yn48apPC7bweL/FjS4fOMoP75+inXbNYNCtBP/1SVZ6L2OyP60bV7YRAFceQk F8fQ== X-Gm-Message-State: AO0yUKXCAecIWREHQjbfwajVQn3CUGHqbMxt09y1t32d/dFuqOqZ2LOq SSP8YyeXEeNic1JCY4QXWkUcYtSd9HmkhMU9z0yzzQx+QZkNixS5mRYg+WPMXewNX9w1wB5b4Sb 2MP9lQg4cU4OO9LyxEAKcEpAcNhslJJtvncsnInzD0ICguEeXgYcF+fAahJzxr7vWkerB X-Received: by 2002:a17:906:3197:b0:8b1:3293:ead2 with SMTP id 23-20020a170906319700b008b13293ead2mr17389707ejy.25.1678237899020; Tue, 07 Mar 2023 17:11:39 -0800 (PST) X-Google-Smtp-Source: AK7set83wB0wRh0T5Qkx8fAgsHJ2BDpc/+W7FSTwY1vpXj8Ci8VCbWhKeHMsAn4SQuVvAbFi1FXhAQ== X-Received: by 2002:a17:906:3197:b0:8b1:3293:ead2 with SMTP id 23-20020a170906319700b008b13293ead2mr17389693ejy.25.1678237898822; Tue, 07 Mar 2023 17:11:38 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id jy24-20020a170907763800b008d7a8083dffsm6767036ejc.222.2023.03.07.17.11.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:38 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:36 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Lei Yang Subject: [PULL 15/73] vdpa: Negotiate _F_SUSPEND feature 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez This is needed for qemu to know it can suspend the device to retrieve its status and enable SVQ with it, so all the process is transparent to the guest. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20230303172445.1089785-4-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 108cd63289..5cfa9d5d27 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -659,7 +659,8 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) uint64_t features; uint64_t f = 0x1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2 | 0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH | - 0x1ULL << VHOST_BACKEND_F_IOTLB_ASID; + 0x1ULL << VHOST_BACKEND_F_IOTLB_ASID | + 0x1ULL << VHOST_BACKEND_F_SUSPEND; int r; if (vhost_vdpa_call(dev, VHOST_GET_BACKEND_FEATURES, &features)) { From patchwork Wed Mar 8 01:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753828 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bp7i+vXp; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJ70hVzz1yWp for ; Wed, 8 Mar 2023 12:20:39 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLO-0001Mi-7F; Tue, 07 Mar 2023 20: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 1pZiLL-0001B4-ST for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:47 -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 1pZiLJ-0001Za-Fw for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:47 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237905; 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=jAuJ8Cc9JessIKgxqVQNv+vUmTknjcYl89umLK8p05M=; b=bp7i+vXpSSx8B0MG97TSa61KQOnX7yhuzQJnPfEVvtzXRIcpVVguflb9omsbjLiaET6q3C GRRRzgwbKr+d+gZnFNZ2bGVE8l3adky5vN6fFTqmQBG5Id1MqF85Oy7zCuiCZ9zx2F0ifr U+lybw8iPz6nea/b+0GelTevPIg5lRQ= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-445-k4wAfioMOf2gg7BJNrWVKA-1; Tue, 07 Mar 2023 20:11:43 -0500 X-MC-Unique: k4wAfioMOf2gg7BJNrWVKA-1 Received: by mail-ed1-f69.google.com with SMTP id y24-20020aa7ccd8000000b004be3955a42eso21651500edt.22 for ; Tue, 07 Mar 2023 17:11:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237902; 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=jAuJ8Cc9JessIKgxqVQNv+vUmTknjcYl89umLK8p05M=; b=5Kp3LPkvy360CaGEv/Ti1kdW92DtaGGgveuf3tKKB2odg7OAqUatEuv922ya6aNbRj UiaWZLpSdxusfkh88giCNQMUfEHv86wYPO/vg6h8ZCHIY6EY1VuYOUq4mECYlG6YmOOZ dp3jYbxp0xeqNCZlrvzQCftvH/m9IxETiPIrs/a9y7SVf1/1JEYQ5ybO254qiU/IxS4u jwlQMP0rkncD3s2sdovKEmMyhM3HnePEj11M7D7kNKiKLc2TPrOkNooBrI5qYIWnGfj6 s1B3lgD8VH/8m2bakVqEpaZKlHPTTAdR45VO6Op8LaSDbmGmdwFmiWvqsu21NbtVbynS c3dQ== X-Gm-Message-State: AO0yUKUCkpM8sjLbuwaBzNlKETTuo3fOc9KHyDB2yx7xYlEM8TCRudtb 9PS621cpqF6LlzmND0LepWQBQAycbIkc6FPEwSNrp2ebypZvnCUGc4V/puSTRHZxmRFO/JuSCbn biD/71dqf1H0aRzbxxj0ZMZBnRgcDK4xoTNsDXR0NCIIQhjHU8pb+LBxew9rz9fe8Rbys X-Received: by 2002:a17:907:a40b:b0:87b:d2b3:67ca with SMTP id sg11-20020a170907a40b00b0087bd2b367camr20507654ejc.75.1678237902271; Tue, 07 Mar 2023 17:11:42 -0800 (PST) X-Google-Smtp-Source: AK7set/2rNSpx30C2REoaSoM9I38lPqLJqey+XDL34YFYFfdLpO/WWRrqPt9Fmc5fLJ7xhKWcZ01nQ== X-Received: by 2002:a17:907:a40b:b0:87b:d2b3:67ca with SMTP id sg11-20020a170907a40b00b0087bd2b367camr20507633ejc.75.1678237901944; Tue, 07 Mar 2023 17:11:41 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id l26-20020a170906231a00b008b69aa62efcsm6775079eja.62.2023.03.07.17.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:41 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:38 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Lei Yang Subject: [PULL 16/73] vdpa: rewind at get_base, not set_base Message-ID: <4241e8bd728f1014ac977eb6756e41f549d93efd.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez At this moment it is only possible to migrate to a vdpa device running with x-svq=on. As a protective measure, the rewind of the inflight descriptors was done at the destination. That way if the source sent a virtqueue with inuse descriptors they are always discarded. Since this series allows to migrate also to passthrough devices with no SVQ, the right thing to do is to rewind at the source so the base of vrings are correct. Support for inflight descriptors may be added in the future. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20230303172445.1089785-5-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-shadow-virtqueue.c | 8 ++++++-- hw/virtio/vhost-vdpa.c | 11 ----------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-virtqueue.c index 515ccf870d..8361e70d1b 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -694,13 +694,17 @@ void vhost_svq_stop(VhostShadowVirtqueue *svq) g_autofree VirtQueueElement *elem = NULL; elem = g_steal_pointer(&svq->desc_state[i].elem); if (elem) { - virtqueue_detach_element(svq->vq, elem, 0); + /* + * TODO: This is ok for networking, but other kinds of devices + * might have problems with just unpop these. + */ + virtqueue_unpop(svq->vq, elem, 0); } } next_avail_elem = g_steal_pointer(&svq->next_guest_avail_elem); if (next_avail_elem) { - virtqueue_detach_element(svq->vq, next_avail_elem, 0); + virtqueue_unpop(svq->vq, next_avail_elem, 0); } svq->vq = NULL; g_free(svq->desc_next); diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 5cfa9d5d27..1550b1e26a 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1170,18 +1170,7 @@ static int vhost_vdpa_set_vring_base(struct vhost_dev *dev, struct vhost_vring_state *ring) { struct vhost_vdpa *v = dev->opaque; - VirtQueue *vq = virtio_get_queue(dev->vdev, ring->index); - /* - * vhost-vdpa devices does not support in-flight requests. Set all of them - * as available. - * - * TODO: This is ok for networking, but other kinds of devices might - * have problems with these retransmissions. - */ - while (virtqueue_rewind(vq, 1)) { - continue; - } if (v->shadow_vqs_enabled) { /* * Device vring base was set at device start. SVQ base is handled by From patchwork Wed Mar 8 01:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ZLWQoRmw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZGQ55bqz1yWr for ; Wed, 8 Mar 2023 12:19:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLP-0001Ph-BG; Tue, 07 Mar 2023 20:11:51 -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 1pZiLN-0001Kw-LG for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11: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 1pZiLM-0001Zi-02 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237907; 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=oA8R5GnRl2r5pdtAn8QzizgEI8Vtmh5N+JhG5tVfA9Y=; b=ZLWQoRmwkyFvmIxXBBEUICxbjoX+A1Iav1as+6L6LJWqgDCiBVFQSJXRW+/9wcVrjelrlR qQ8oAoFDz/AZ1gWya/dQnL1rlr6SGVXWZRVVbTj59eMrzsqx2qTb3SKYXVzA8QOLmG/cbz lxrD2bakNRSAKIvkcGBph/hbA1LtXoU= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-xrsbqluYN8i3C2CYjp5Tkw-1; Tue, 07 Mar 2023 20:11:46 -0500 X-MC-Unique: xrsbqluYN8i3C2CYjp5Tkw-1 Received: by mail-ed1-f71.google.com with SMTP id y1-20020a056402358100b004ea439d57b7so9284136edc.12 for ; Tue, 07 Mar 2023 17:11:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237905; 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=oA8R5GnRl2r5pdtAn8QzizgEI8Vtmh5N+JhG5tVfA9Y=; b=LO4xMDxFbSyJS3d8RzeK9XXPgBZr5ytJCAJcjuTK25l+zIr6D13ZYXvVdWApPan2gI fTJS3KqyjsERObRQO2N7Db3sjRQhOLpoD164cF9AwW+RLX3qs3kpZzvYpN8zhdbRmDJ8 A0B7XMzNRFnsr58+j9x860SIAKAD3YUSCBGAozWCy3Sa24+hQlq1hyuSgAPiGw7EzTo8 JN1ZdvxcKTDyBeewNJE9ae4ZzgQytN+Ja7kUBudK7Q2Tuv22BvNlzIakuQsYlhuUtMVj KNYuDr+EaxEe7VkSyF2uDO68HeM9r7ZcNxFtAzeALPPUklBqXuHkUeSfA+q3sXsd1KbG ht2Q== X-Gm-Message-State: AO0yUKX3DwIEa1W9g0A7x0RlxAxe3+wf6HqP3ZiwDZvUvWZSBRbpeyAK EMapoPpdkEujJYcBrTTDB5zZmgbxob19Si0HF6Z0shLw7GOqqsQweH0E/TEJu+mFcwc7kRA7zzL Cbpg/IC0hMGOQDlbz4Zrxqup9NYi/BKHGrMflrpH1ZeZ8EJgJZsYVhf+8velLgIw/CyU0 X-Received: by 2002:a17:907:6e0f:b0:907:672b:736a with SMTP id sd15-20020a1709076e0f00b00907672b736amr19715792ejc.31.1678237904773; Tue, 07 Mar 2023 17:11:44 -0800 (PST) X-Google-Smtp-Source: AK7set/3a3uk2v0eOSoYm+oR1FZJrDR0jEkKzuVpanGhEUk3vxkqNfzRigIAh8gtxbzzfUqwcCxeJQ== X-Received: by 2002:a17:907:6e0f:b0:907:672b:736a with SMTP id sd15-20020a1709076e0f00b00907672b736amr19715767ejc.31.1678237904473; Tue, 07 Mar 2023 17:11:44 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id x8-20020a170906440800b008e8e975e185sm6752540ejo.32.2023.03.07.17.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:44 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:42 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 17/73] vdpa: add vhost_vdpa->suspended parameter 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez This allows vhost_vdpa to track if it is safe to get the vring base from the device or not. If it is not, vhost can fall back to fetch idx from the guest buffer again. No functional change intended in this patch, later patches will use this field. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-6-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-vdpa.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 7997f09a8d..4a7d396674 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -42,6 +42,8 @@ typedef struct vhost_vdpa { bool shadow_vqs_enabled; /* Vdpa must send shadow addresses as IOTLB key for data queues, not GPA */ bool shadow_data; + /* Device suspended successfully */ + bool suspended; /* IOVA mapping used by the Shadow Virtqueue */ VhostIOVATree *iova_tree; GPtrArray *shadow_vqs; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 1550b1e26a..517e3cdc8d 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1193,6 +1193,14 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev, return 0; } + if (!v->suspended) { + /* + * Cannot trust in value returned by device, let vhost recover used + * idx from guest. + */ + return -1; + } + ret = vhost_vdpa_call(dev, VHOST_GET_VRING_BASE, ring); trace_vhost_vdpa_get_vring_base(dev, ring->index, ring->num); return ret; From patchwork Wed Mar 8 01:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eL0TCEcY; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDx1N3mz1yWr for ; Wed, 8 Mar 2023 12:17:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLQ-0001Y2-Uf; Tue, 07 Mar 2023 20:11: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 1pZiLQ-0001Vw-8d for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11: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 1pZiLO-0001ae-Jv for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237910; 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=8J7gZZ73EUFltGtHdVYKijIV4gpjyA4HHIFnkio3PoY=; b=eL0TCEcYwkWx87GkNj6ikqH6NNyoH7LcaCJCoTT19rEzcLd7iZaD9vEabbwYGaaw2LKGJX 5Dy8ZZBzCfm+mBBse7seJpPOZUWMEdrorWq0PksAsXGBo3NGpJkoz6uvaJ8mb49iwh3iFZ 5v2Pzx/6Coco1z8FeMEAC0z8ulF76SA= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-T9bvATT3P2-yKKo0exAe0g-1; Tue, 07 Mar 2023 20:11:49 -0500 X-MC-Unique: T9bvATT3P2-yKKo0exAe0g-1 Received: by mail-ed1-f71.google.com with SMTP id w7-20020a056402268700b004bbcdf3751bso21218137edd.1 for ; Tue, 07 Mar 2023 17:11:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237907; 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=8J7gZZ73EUFltGtHdVYKijIV4gpjyA4HHIFnkio3PoY=; b=L/RwX6OwB73z1t+zvOcKyY9MfnAvAFOtOkbcZhcKoHc/rAVjj7f9jXj93JXHiYoHUX JsI7ZRCh+4Yk8r/VGoQ+wVOmV/3YhIXoJ8IB1oeMcKjyUggYnnHp0jsEZh3kcgtC5lsD olev6aIVlHMSeaRe4LB5nA6JpLnoe9oaq6hGxcqJi8MzVrmejClnJWGna6X0FMDVJHsV g2V1uXPoVtfwNTeOBKrqo6fXU+l/umsccsa8AYFyTvWcZQksCLjVoHntcT1VAx2Jqb50 dTsZ57RdmpFszO3kca6+cpekw8I1kPd2UCK5VQj84CI8c3HqgCcKK/7x4jMeDrJHSaOW 8WPg== X-Gm-Message-State: AO0yUKWI+3Ov00yH/XjLdu3sAmlzPNGn2nkkMTPoNrI2XlKLk8rL6b7Y UQtpo8Ja5kPFvYWuQRoNEWfj4rf4t5rBpVpFGO2ImCCuXL2k1sf8Rghm1Vsu3sQsYR/KalSqJqu bO0BzhmGPKAHfQBouusIy/h5h1R36POzdfXBefU6MLgw1JlBJeDqgef/zHugx3jcmqQV2 X-Received: by 2002:a17:907:cbc1:b0:8aa:c2bd:a71c with SMTP id vk1-20020a170907cbc100b008aac2bda71cmr18342232ejc.75.1678237907406; Tue, 07 Mar 2023 17:11:47 -0800 (PST) X-Google-Smtp-Source: AK7set8floUVvrxtGjVuHaxpf2lnwQMfnzttdQwvBLEZPOAATc6d6f3rVglFrRRNhVOoXnpT2eK+Hg== X-Received: by 2002:a17:907:cbc1:b0:8aa:c2bd:a71c with SMTP id vk1-20020a170907cbc100b008aac2bda71cmr18342215ejc.75.1678237907095; Tue, 07 Mar 2023 17:11:47 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id w19-20020a17090633d300b009197dc4138csm178839eja.84.2023.03.07.17.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:46 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:44 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 18/73] vdpa: add vhost_vdpa_suspend Message-ID: <0bb302a9960a186fc488068d268dc373e6b70876.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez The function vhost.c:vhost_dev_stop fetches the vring base so the vq state can be migrated to other devices. However, this is unreliable in vdpa, since we didn't signal the device to suspend the queues, making the value fetched useless. Suspend the device if possible before fetching first and subsequent vring bases. Moreover, vdpa totally reset and wipes the device at the last device before fetch its vrings base, making that operation useless in the last device. This will be fixed in later patches of this series. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-7-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 26 ++++++++++++++++++++++++++ hw/virtio/trace-events | 1 + 2 files changed, 27 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 517e3cdc8d..aecc01c6a7 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -692,11 +692,13 @@ static int vhost_vdpa_get_device_id(struct vhost_dev *dev, static int vhost_vdpa_reset_device(struct vhost_dev *dev) { + struct vhost_vdpa *v = dev->opaque; int ret; uint8_t status = 0; ret = vhost_vdpa_call(dev, VHOST_VDPA_SET_STATUS, &status); trace_vhost_vdpa_reset_device(dev, status); + v->suspended = false; return ret; } @@ -1095,6 +1097,29 @@ static void vhost_vdpa_svqs_stop(struct vhost_dev *dev) } } +static void vhost_vdpa_suspend(struct vhost_dev *dev) +{ + struct vhost_vdpa *v = dev->opaque; + int r; + + if (!vhost_vdpa_first_dev(dev)) { + return; + } + + if (dev->backend_cap & BIT_ULL(VHOST_BACKEND_F_SUSPEND)) { + trace_vhost_vdpa_suspend(dev); + r = ioctl(v->device_fd, VHOST_VDPA_SUSPEND); + if (unlikely(r)) { + error_report("Cannot suspend: %s(%d)", g_strerror(errno), errno); + } else { + v->suspended = true; + return; + } + } + + vhost_vdpa_reset_device(dev); +} + static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) { struct vhost_vdpa *v = dev->opaque; @@ -1109,6 +1134,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) } vhost_vdpa_set_vring_ready(dev); } else { + vhost_vdpa_suspend(dev); vhost_vdpa_svqs_stop(dev); vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs); } diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index a87c5f39a2..8f8d05cf9b 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -50,6 +50,7 @@ vhost_vdpa_set_vring_ready(void *dev) "dev: %p" vhost_vdpa_dump_config(void *dev, const char *line) "dev: %p %s" vhost_vdpa_set_config(void *dev, uint32_t offset, uint32_t size, uint32_t flags) "dev: %p offset: %"PRIu32" size: %"PRIu32" flags: 0x%"PRIx32 vhost_vdpa_get_config(void *dev, void *config, uint32_t config_len) "dev: %p config: %p config_len: %"PRIu32 +vhost_vdpa_suspend(void *dev) "dev: %p" vhost_vdpa_dev_start(void *dev, bool started) "dev: %p started: %d" vhost_vdpa_set_log_base(void *dev, uint64_t base, unsigned long long size, int refcnt, int fd, void *log) "dev: %p base: 0x%"PRIx64" size: %llu refcnt: %d fd: %d log: %p" vhost_vdpa_set_vring_addr(void *dev, unsigned int index, unsigned int flags, uint64_t desc_user_addr, uint64_t used_user_addr, uint64_t avail_user_addr, uint64_t log_guest_addr) "dev: %p index: %u flags: 0x%x desc_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" log_guest_addr: 0x%"PRIx64 From patchwork Wed Mar 8 01:11:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753778 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=iwsRuJTT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7R39jMz1yWm for ; Wed, 8 Mar 2023 12:13:07 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLW-00024O-0b; Tue, 07 Mar 2023 20:11: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 1pZiLT-0001ow-88 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11: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 1pZiLR-0001b7-KD for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237913; 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=LR/2NC5b3GMc7dlS3VMn63WeWMHdgJP7N4ThX8xxwRk=; b=iwsRuJTT0R4XSgE3lzPWurmQEXtT2KgjUX0+MHQCrwzW1hw6iflp55ysPAZ6gAQO5LGCgU ulSsNUZcFgBwRmRyN/LwLLHOnEiG1onJTvj0i5r8ABYkAZ+Nbeg3urw7MJrcW0iFyBUM3H K+1UiXK7W1GstLsODaacHqJKQRx3YuY= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-IXKHSVFvOvufomeJqEg_fw-1; Tue, 07 Mar 2023 20:11:51 -0500 X-MC-Unique: IXKHSVFvOvufomeJqEg_fw-1 Received: by mail-ed1-f71.google.com with SMTP id ec11-20020a0564020d4b00b004e2cb85c8bcso12385783edb.16 for ; Tue, 07 Mar 2023 17:11:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237910; 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=LR/2NC5b3GMc7dlS3VMn63WeWMHdgJP7N4ThX8xxwRk=; b=6V3wJrshdZGjjqTsTPIEtT5yaheeTiaThks/0ld4mWr67KvpWG4TKBmMwiM3M8xsyL xBU8FcUDAb1GVdxfNuRsd36Ujc1ZfsBTsPOo7nAHtIrZ4EymrGTjs1wq2XSJKLoE9ADy UeBglEIX5oXWBGUXUN9PCakEkznykuChSk7/SzXMxNWIJsnG2SVpfI9QIvgu8FVy839E CKITM6n2L7Vt4FJJYkqV8KlQSljo32nxw6kCZaBR3hrI4HkIxHexK1SQ4uwqlrtsgmGe 8f/cdNqMGEdeEZWgVRdneNvoBXS7UFgHNnVpFEDBT7M6/wUP/p0gKp/ZkGcfHRi+ZFNH wMIQ== X-Gm-Message-State: AO0yUKUoUV+w+CdwdoxtFH4/o9nbDe+yVaAMsYeow01Dqvg57Fu7og3n lClwaP3PHZ8O3gVXHQshZWgB2X6/jneIKhSNgY/CftrnHdEvSPXFbhnCwPVft7WjghT9bGiNdYg EH2K6ShIDwOANVmBRzbENMymHUAiIBmG/z6LixnbwDPY8hs5xjOxDLp4++X7EbMj+RbDP X-Received: by 2002:a17:906:9b88:b0:8b1:fc:b06d with SMTP id dd8-20020a1709069b8800b008b100fcb06dmr20900164ejc.77.1678237910271; Tue, 07 Mar 2023 17:11:50 -0800 (PST) X-Google-Smtp-Source: AK7set/K/17pZ+A2iTPLX4H+A10afWqFexZPDu8dIWNCW1taqyIo3ApBSeKlHdkDJKA1qi6Fsguscg== X-Received: by 2002:a17:906:9b88:b0:8b1:fc:b06d with SMTP id dd8-20020a1709069b8800b008b100fcb06dmr20900143ejc.77.1678237909967; Tue, 07 Mar 2023 17:11:49 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id qt2-20020a170906ece200b008e938e98046sm6735972ejb.223.2023.03.07.17.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:49 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:47 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 19/73] vdpa: move vhost reset after get vring base 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez The function vhost.c:vhost_dev_stop calls vhost operation vhost_dev_start(false). In the case of vdpa it totally reset and wipes the device, making the fetching of the vring base (virtqueue state) totally useless. The kernel backend does not use vhost_dev_start vhost op callback, but vhost-user do. A patch to make vhost_user_dev_start more similar to vdpa is desirable, but it can be added on top. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-8-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-backend.h | 4 ++++ hw/virtio/vhost-vdpa.c | 24 +++++++++++++++++------- hw/virtio/vhost.c | 3 +++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index c5ab49051e..ec3fbae58d 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -130,6 +130,9 @@ typedef bool (*vhost_force_iommu_op)(struct vhost_dev *dev); typedef int (*vhost_set_config_call_op)(struct vhost_dev *dev, int fd); + +typedef void (*vhost_reset_status_op)(struct vhost_dev *dev); + typedef struct VhostOps { VhostBackendType backend_type; vhost_backend_init vhost_backend_init; @@ -177,6 +180,7 @@ typedef struct VhostOps { vhost_get_device_id_op vhost_get_device_id; vhost_force_iommu_op vhost_force_iommu; vhost_set_config_call_op vhost_set_config_call; + vhost_reset_status_op vhost_reset_status; } VhostOps; int vhost_backend_update_device_iotlb(struct vhost_dev *dev, diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index aecc01c6a7..c9a82ce5e0 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1146,14 +1146,23 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) if (started) { memory_listener_register(&v->listener, &address_space_memory); return vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); - } else { - vhost_vdpa_reset_device(dev); - vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | - VIRTIO_CONFIG_S_DRIVER); - memory_listener_unregister(&v->listener); - - return 0; } + + return 0; +} + +static void vhost_vdpa_reset_status(struct vhost_dev *dev) +{ + struct vhost_vdpa *v = dev->opaque; + + if (dev->vq_index + dev->nvqs != dev->vq_index_end) { + return; + } + + vhost_vdpa_reset_device(dev); + vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | + VIRTIO_CONFIG_S_DRIVER); + memory_listener_unregister(&v->listener); } static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base, @@ -1337,4 +1346,5 @@ const VhostOps vdpa_ops = { .vhost_vq_get_addr = vhost_vdpa_vq_get_addr, .vhost_force_iommu = vhost_vdpa_force_iommu, .vhost_set_config_call = vhost_vdpa_set_config_call, + .vhost_reset_status = vhost_vdpa_reset_status, }; diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index eb8c4c378c..a266396576 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -2049,6 +2049,9 @@ void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev, bool vrings) hdev->vqs + i, hdev->vq_index + i); } + if (hdev->vhost_ops->vhost_reset_status) { + hdev->vhost_ops->vhost_reset_status(hdev); + } if (vhost_dev_has_iommu(hdev)) { if (hdev->vhost_ops->vhost_set_iotlb_callback) { From patchwork Wed Mar 8 01:11:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=c6ge1J3U; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDz4mN8z1yWr for ; Wed, 8 Mar 2023 12:17:55 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLY-0002De-LY; Tue, 07 Mar 2023 20: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 1pZiLW-00028C-Ls for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:58 -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 1pZiLU-0001bO-Pf for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:11:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237916; 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=hovKUNAuuewScR8Z3znrdDkYwgEnlrBBEGPBW/OLpfQ=; b=c6ge1J3UjjQZR4g15fDOTb6ELfIdlgRBnP6LI0FtuCDLU+7s1P6xqO/DEEXQCctQYkMvRN KCoaZLj5SanwYWXXdohiuzN9XhHqIUB9LHKdv84hThwj2KKwzccQVWqkOkCQ9GWtCnHdaw ZkI1MHeuAWooqYpyk4TRN5UYL7Yh5C0= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-604-MZfKRkNnPxi1T3D3Ql0zfg-1; Tue, 07 Mar 2023 20:11:54 -0500 X-MC-Unique: MZfKRkNnPxi1T3D3Ql0zfg-1 Received: by mail-ed1-f72.google.com with SMTP id ec11-20020a0564020d4b00b004e2cb85c8bcso12385936edb.16 for ; Tue, 07 Mar 2023 17:11:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237913; 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=hovKUNAuuewScR8Z3znrdDkYwgEnlrBBEGPBW/OLpfQ=; b=QHRJiNrjVYENYRaa6VkZGEJdp76Yx7QE6slc+7z0x40DUuqTxcw3wyeuxc/IuMsvoi 7sznIC1SX172Zgz8XRBZl84GFyppErZyVddnRUnr8ranpuSHoy0pVA+OVEP4UCixhzrR gtCepg48hsnMYsYFT6/AzMgZsb7h8kwamd4lwpSei904Mw3gXD6/PnJbMk6Frwy9tRaV zf028vxGVxzUMLPtQraYDHcmeN3LByBK1cKL7YqYTkee5q3et7ItW54jt0d6qPktJ1iT 1TV+LY+JaNQHrogCwlACi7Vvj7d76R7FMD4gLNhCsKLbEg4I7MLYITVMspQ2BOFYzixC UETQ== X-Gm-Message-State: AO0yUKWjt2m8JCBrQ75moL4xa6vdExJeIXqeNhvnxhegI9SLGtTfLCaQ KZi9it2rUJMfcezAmzYFh2hROAIk3W4/WwPzsN1JaYcw7BngcGOLJ9JKFkVLJJvo7TjZsH0eR5L i6txcDtPXiCTt+yoRD0vVEeB0eoy93R20cqFRbFeHiAH+vicEPWaIcPk7i0680SHkBi7U X-Received: by 2002:a17:906:fe07:b0:879:ab3:93d1 with SMTP id wy7-20020a170906fe0700b008790ab393d1mr23857724ejb.4.1678237913083; Tue, 07 Mar 2023 17:11:53 -0800 (PST) X-Google-Smtp-Source: AK7set+hOqN4vZtzLCutyLIZpQTWSg7ygTcUCGT/RdEoJV8ESEimJ1bOxss1zIxQzWsxx852s4+Vsw== X-Received: by 2002:a17:906:fe07:b0:879:ab3:93d1 with SMTP id wy7-20020a170906fe0700b008790ab393d1mr23857710ejb.4.1678237912772; Tue, 07 Mar 2023 17:11:52 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id q2-20020a1709060e4200b009140707b475sm2542433eji.33.2023.03.07.17.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:52 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:50 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang , Jason Wang Subject: [PULL 20/73] vdpa: add vdpa net migration state notifier Message-ID: <6949843046b6f9c4c6cd28922d5427a17414dfc9.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez This allows net to restart the device backend to configure SVQ on it. Ideally, these changes should not be net specific and they could be done in: * vhost_vdpa_set_features (with VHOST_F_LOG_ALL) * vhost_vdpa_set_vring_addr (with .enable_log) * vhost_vdpa_set_log_base. However, the vdpa net backend is the one with enough knowledge to configure everything because of some reasons: * Queues might need to be shadowed or not depending on its kind (control vs data). * Queues need to share the same map translations (iova tree). Also, there are other problems that may have solutions but complicates the implementation at this stage: * We're basically duplicating vhost_dev_start and vhost_dev_stop, and they could go out of sync. If we want to reuse them, we need a way to skip some function calls to avoid recursiveness (either vhost_ops -> vhost_set_features, vhost_set_vring_addr, ...). * We need to traverse all vhost_dev of a given net device twice: one to stop and get the vq state and another one after the reset to configure properties like address, fd, etc. Because of that it is cleaner to restart the whole net backend and configure again as expected, similar to how vhost-kernel moves between userspace and passthrough. If more kinds of devices need dynamic switching to SVQ we can: * Create a callback struct like VhostOps and move most of the code there. VhostOps cannot be reused since all vdpa backend share them, and to personalize just for networking would be too heavy. * Add a parent struct or link all the vhost_vdpa or vhost_dev structs so we can traverse them. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-9-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index d195f48776..167b43679d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -26,12 +26,15 @@ #include #include "standard-headers/linux/virtio_net.h" #include "monitor/monitor.h" +#include "migration/migration.h" +#include "migration/misc.h" #include "hw/virtio/vhost.h" /* Todo:need to add the multiqueue support here */ typedef struct VhostVDPAState { NetClientState nc; struct vhost_vdpa vhost_vdpa; + Notifier migration_state; VHostNetState *vhost_net; /* Control commands shadow buffers */ @@ -239,10 +242,59 @@ static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s) return DO_UPCAST(VhostVDPAState, nc, nc0); } +static void vhost_vdpa_net_log_global_enable(VhostVDPAState *s, bool enable) +{ + struct vhost_vdpa *v = &s->vhost_vdpa; + VirtIONet *n; + VirtIODevice *vdev; + int data_queue_pairs, cvq, r; + + /* We are only called on the first data vqs and only if x-svq is not set */ + if (s->vhost_vdpa.shadow_vqs_enabled == enable) { + return; + } + + vdev = v->dev->vdev; + n = VIRTIO_NET(vdev); + if (!n->vhost_started) { + return; + } + + data_queue_pairs = n->multiqueue ? n->max_queue_pairs : 1; + cvq = virtio_vdev_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ) ? + n->max_ncs - n->max_queue_pairs : 0; + /* + * TODO: vhost_net_stop does suspend, get_base and reset. We can be smarter + * in the future and resume the device if read-only operations between + * suspend and reset goes wrong. + */ + vhost_net_stop(vdev, n->nic->ncs, data_queue_pairs, cvq); + + /* Start will check migration setup_or_active to configure or not SVQ */ + r = vhost_net_start(vdev, n->nic->ncs, data_queue_pairs, cvq); + if (unlikely(r < 0)) { + error_report("unable to start vhost net: %s(%d)", g_strerror(-r), -r); + } +} + +static void vdpa_net_migration_state_notifier(Notifier *notifier, void *data) +{ + MigrationState *migration = data; + VhostVDPAState *s = container_of(notifier, VhostVDPAState, + migration_state); + + if (migration_in_setup(migration)) { + vhost_vdpa_net_log_global_enable(s, true); + } else if (migration_has_failed(migration)) { + vhost_vdpa_net_log_global_enable(s, false); + } +} + static void vhost_vdpa_net_data_start_first(VhostVDPAState *s) { struct vhost_vdpa *v = &s->vhost_vdpa; + add_migration_state_change_notifier(&s->migration_state); if (v->shadow_vqs_enabled) { v->iova_tree = vhost_iova_tree_new(v->iova_range.first, v->iova_range.last); @@ -256,6 +308,15 @@ static int vhost_vdpa_net_data_start(NetClientState *nc) assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); + if (s->always_svq || + migration_is_setup_or_active(migrate_get_current()->state)) { + v->shadow_vqs_enabled = true; + v->shadow_data = true; + } else { + v->shadow_vqs_enabled = false; + v->shadow_data = false; + } + if (v->index == 0) { vhost_vdpa_net_data_start_first(s); return 0; @@ -276,6 +337,10 @@ static void vhost_vdpa_net_client_stop(NetClientState *nc) assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_VDPA); + if (s->vhost_vdpa.index == 0) { + remove_migration_state_change_notifier(&s->migration_state); + } + dev = s->vhost_vdpa.dev; if (dev->vq_index + dev->nvqs == dev->vq_index_end) { g_clear_pointer(&s->vhost_vdpa.iova_tree, vhost_iova_tree_delete); @@ -412,11 +477,12 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc) s = DO_UPCAST(VhostVDPAState, nc, nc); v = &s->vhost_vdpa; - v->shadow_data = s->always_svq; + s0 = vhost_vdpa_net_first_nc_vdpa(s); + v->shadow_data = s0->vhost_vdpa.shadow_vqs_enabled; v->shadow_vqs_enabled = s->always_svq; s->vhost_vdpa.address_space_id = VHOST_VDPA_GUEST_PA_ASID; - if (s->always_svq) { + if (s->vhost_vdpa.shadow_data) { /* SVQ is already configured for all virtqueues */ goto out; } @@ -473,7 +539,6 @@ out: return 0; } - s0 = vhost_vdpa_net_first_nc_vdpa(s); if (s0->vhost_vdpa.iova_tree) { /* * SVQ is already configured for all virtqueues. Reuse IOVA tree for @@ -749,6 +814,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.device_fd = vdpa_device_fd; s->vhost_vdpa.index = queue_pair_index; s->always_svq = svq; + s->migration_state.notify = vdpa_net_migration_state_notifier; s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.shadow_data = svq; From patchwork Wed Mar 8 01:11:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753780 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Y5IoibWB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7f3yfJz1yWm for ; Wed, 8 Mar 2023 12:13:18 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLa-0002Gb-BV; Tue, 07 Mar 2023 20:12:02 -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 1pZiLY-0002Di-VK for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiLX-0001bX-6N for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237918; 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=zunM/9fttTGR9NAQCUCFyN3JaEHGcb4VhaqCJlS6DMk=; b=Y5IoibWBR+N6r3vLUbYy/kuz5XVMCVadHI+HFlZ1dRKXXhwZcNDKIJ0TiArYrsxREgHEGF FhG8s9c/zTBziiFyw3WelhjaG+TQvRPkymUSx8FJH+Fwc2fx7Nv+hd/jQ74RGf9b3dvM0O 9m8oJgK9zinvmrJyxojslXwjjOCBNJc= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-428-YEd8a78vPLem8tH6B1mZXg-1; Tue, 07 Mar 2023 20:11:57 -0500 X-MC-Unique: YEd8a78vPLem8tH6B1mZXg-1 Received: by mail-ed1-f69.google.com with SMTP id fi8-20020a056402550800b004a26cc7f6cbso21406089edb.4 for ; Tue, 07 Mar 2023 17:11:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237916; 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=zunM/9fttTGR9NAQCUCFyN3JaEHGcb4VhaqCJlS6DMk=; b=mV/eosrPHllCFxesB+vxHDdZBqpUywPPkXVKQU9cwTrQisNV97/Dx7Z1eeCBvypbRF 8p1lRh59zMuT+AGs7cYrg23U1gAfpn/thUW8ilDdtVjhOKG4HfJBj/qtPwNFhZqUv7a6 tPKwwbthrfB9AdMCtEDpaFsin4BF2W02/84+kfpZgUFwSp/jCfFBh3W8Go2eiFu6quHm 20WjgXvEwTRpenjyMVG5MFlammC81NyYGrrVEiDW03IrWzQxlcussM43RjQW4jd/AnBB kgyN0a2+5C3YHbGpPitscS5h1cDqc0XIxmioC8cs6ISORRa2cBk5ZX7kBziVnLx7hbzq i/0A== X-Gm-Message-State: AO0yUKWWL8xO1MzGSlAoDEjTj0z9suXQndmfdjYG03UinUXXwhlApqp1 mO1tqXgYynPViGQDpDduXFJVg5eZir8NOX0gQDpDijJKSfiVgYgoJB7OEZ23nLFbtUsggTFt4sq nRnBEHQWN9zuhalSJ9++GeaxOvJthxhxZJ/CdRHr/EmnRg3aqC+IzjnTEKdyi9PMPKgTD X-Received: by 2002:a17:906:e08b:b0:8ea:825:a5d8 with SMTP id gh11-20020a170906e08b00b008ea0825a5d8mr17026704ejb.17.1678237915977; Tue, 07 Mar 2023 17:11:55 -0800 (PST) X-Google-Smtp-Source: AK7set+M/apB2ANplbSROLm/n1mn7zisOYJzoMUVL3ZN+Mf3oqzFrIMUXR/rIH+/gsJn2RrM9uev/A== X-Received: by 2002:a17:906:e08b:b0:8ea:825:a5d8 with SMTP id gh11-20020a170906e08b00b008ea0825a5d8mr17026683ejb.17.1678237915596; Tue, 07 Mar 2023 17:11:55 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id y27-20020a17090629db00b008f14cc5f2e4sm6798044eje.68.2023.03.07.17.11.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:55 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 21/73] vdpa: disable RAM block discard only for the first device 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez Although it does not make a big difference, its more correct and simplifies the cleanup path in subsequent patches. Move ram_block_discard_disable(false) call to the top of vhost_vdpa_cleanup because: * We cannot use vhost_vdpa_first_dev after dev->opaque = NULL assignment. * Improve the stack order in cleanup: since it is the last action taken in init, it should be the first at cleanup. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-10-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index c9a82ce5e0..49afa59261 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -431,16 +431,6 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) trace_vhost_vdpa_init(dev, opaque); int ret; - /* - * Similar to VFIO, we end up pinning all guest memory and have to - * disable discarding of RAM. - */ - ret = ram_block_discard_disable(true); - if (ret) { - error_report("Cannot set discarding of RAM broken"); - return ret; - } - v = opaque; v->dev = dev; dev->opaque = opaque ; @@ -452,6 +442,16 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) return 0; } + /* + * Similar to VFIO, we end up pinning all guest memory and have to + * disable discarding of RAM. + */ + ret = ram_block_discard_disable(true); + if (ret) { + error_report("Cannot set discarding of RAM broken"); + return ret; + } + vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER); @@ -577,12 +577,15 @@ static int vhost_vdpa_cleanup(struct vhost_dev *dev) assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA); v = dev->opaque; trace_vhost_vdpa_cleanup(dev, v); + if (vhost_vdpa_first_dev(dev)) { + ram_block_discard_disable(false); + } + vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs); memory_listener_unregister(&v->listener); vhost_vdpa_svq_cleanup(dev); dev->opaque = NULL; - ram_block_discard_disable(false); return 0; } From patchwork Wed Mar 8 01:11:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SYRT9Pe2; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ8W3XzFz1yWm for ; Wed, 8 Mar 2023 12:14:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLc-0002LE-OX; Tue, 07 Mar 2023 20:12: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 1pZiLb-0002I0-EB for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:03 -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 1pZiLZ-0001bi-Ot for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237921; 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=UuFH6NlrsTnaJq6Zh/BJrEuKPkPGNQB+Ipy4umSvtP0=; b=SYRT9Pe2sC7zOPs2Obf1CVc04wnT/4aB+h21xdpaTRWB1yqeVpCpL7QCvi2bphaUFhuzbf YIhbHX+a9w1MFKkPyCB06K+GDw3fATX/GfNf8m2Hri9Jsa38XjOaudAmRrRFcRH4WlEBet zDwpKgMPc2Dc7mq8ZJ865qySx6FjBPI= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-646-9RL1nWXMOyOEQP0fB4l-TA-1; Tue, 07 Mar 2023 20:12:00 -0500 X-MC-Unique: 9RL1nWXMOyOEQP0fB4l-TA-1 Received: by mail-ed1-f69.google.com with SMTP id h15-20020a056402280f00b004bf9e193c23so21672367ede.11 for ; Tue, 07 Mar 2023 17:12:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237918; 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=UuFH6NlrsTnaJq6Zh/BJrEuKPkPGNQB+Ipy4umSvtP0=; b=XmJI5Xv1D1vv/xaqR+4LzF55pOSuPHOaMg3c5cD+kK0n4kxavmILcaN8u8DihmQKzc iVtzRGqmqxU2qdgFfpio1aPZq7HiYtAzQaGet0ujMEXmMYwR493OOpx+DXbf2PLXjpdr QWuox8wXetYTBeFucCYjbNBBsweFbI1J4vwLYGl3y6V5F4UzG95z8SS49DbmxPVTmink akGvRbK0KXc28+r9YPyDJZviaBUlZ12gkAPGnzyHRu6ymuqr8Fs61KL3kIZr5ZJM7BKv qZJ/7Rt20nc9VQ6g7RZUZ1cLnX9C2SEcrWwiH3cYg/LnU1eJRX5BmYPYL9U/xtV/kvnV ridA== X-Gm-Message-State: AO0yUKXygJWOd1qrc6d4KawZugxVZO/EbOHiVZCr6RXqcMHs5sgrEXp6 ucK+R9XWkt2BzWPUDVsWhiGoJOjcdnUzgUz7Q1L+Cooo7stYqQd+6uhvmtOhWUKbtridOhwWSJE ynpAzAsIfy9Yg45YHz/8zWebGsKxCJfj0FSi5c5DQm154F/p3LwF3i1V57Ox/kJ79Vmap X-Received: by 2002:a17:906:6a18:b0:8a9:e031:c4ae with SMTP id qw24-20020a1709066a1800b008a9e031c4aemr21687154ejc.2.1678237918638; Tue, 07 Mar 2023 17:11:58 -0800 (PST) X-Google-Smtp-Source: AK7set/hLRCgZ+41dOBU36SZ/y2mHU7EC97RXRvThTl1V3/hZEpuzn2D+P1kZbnctccBKXlNQy1QeA== X-Received: by 2002:a17:906:6a18:b0:8a9:e031:c4ae with SMTP id qw24-20020a1709066a1800b008a9e031c4aemr21687139ejc.2.1678237918381; Tue, 07 Mar 2023 17:11:58 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id dt9-20020a170906b78900b008dd76b67ae6sm6833435ejb.175.2023.03.07.17.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:11:57 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:55 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang , Jason Wang Subject: [PULL 22/73] vdpa net: block migration if the device has CVQ Message-ID: <9c363cf6d5982c568431531a8da26ccb0fcb3038.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez Devices with CVQ need to migrate state beyond vq state. Leaving this to future series. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-11-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 1 + net/vhost-vdpa.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 4a7d396674..c278a2a8de 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -50,6 +50,7 @@ typedef struct vhost_vdpa { const VhostShadowVirtqueueOps *shadow_vq_ops; void *shadow_vq_ops_opaque; struct vhost_dev *dev; + Error *migration_blocker; VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX]; } VhostVDPA; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 49afa59261..e9167977d5 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -438,6 +438,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) v->msg_type = VHOST_IOTLB_MSG_V2; vhost_vdpa_init_svq(dev, v); + error_propagate(&dev->migration_blocker, v->migration_blocker); if (!vhost_vdpa_first_dev(dev)) { return 0; } diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 167b43679d..533ba54317 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -828,6 +828,15 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vq_ops = &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque = s; + + /* + * TODO: We cannot migrate devices with CVQ as there is no way to set + * the device state (MAC, MQ, etc) before starting the datapath. + * + * Migration blocker ownership now belongs to s->vhost_vdpa. + */ + error_setg(&s->vhost_vdpa.migration_blocker, + "net vdpa cannot migrate with CVQ feature"); } ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, nvqs); if (ret) { From patchwork Wed Mar 8 01:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UbX3hgy0; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ896j1Xz1yWm for ; Wed, 8 Mar 2023 12:13:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM4-0003b9-BG; Tue, 07 Mar 2023 20:12:32 -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 1pZiLj-0002xY-Ux for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiLi-0001dX-AW for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237929; 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=NTGWe/7pl2LtGkXf67BPThJG4gqOmFwAmyUVCwtNab0=; b=UbX3hgy0hRCxHVtIPAoL7OF86i0l5xL9okWPdxnfcmHwhU6UiPE3XRJiawN9wTGgawEJd3 ZpF9+bSerMLP2YYn4ydo0T7UOLuIdQBcquLQ2i6XxbnU99npbULtOzQXW7P0BrdQ6VJTzG Nn1HAcNjcFNMp6gt7WTFJaVAGHijM9w= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-335-e2jdFNBdOdKr1K5KEl0tlQ-1; Tue, 07 Mar 2023 20:12:02 -0500 X-MC-Unique: e2jdFNBdOdKr1K5KEl0tlQ-1 Received: by mail-ed1-f72.google.com with SMTP id b7-20020a056402350700b004d2a3d5cd3fso16147457edd.8 for ; Tue, 07 Mar 2023 17:12:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237921; 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=NTGWe/7pl2LtGkXf67BPThJG4gqOmFwAmyUVCwtNab0=; b=7S96jCpe4MJxzHvdXvCvcr3MtIXyI0OsTaLVd/aI3WakxEN5ihUPfLm4vUw6OEJ2xM Qil+ljJEgmi4B0WB+c11ntdk3Q+rpUglMtPTjI7iYRScleihlEc+KIvn0ZaLNOetqPz2 hWviTJei+vixieWZQ9eI2F4WywSGy+4VsFWWSip23UH48MbZfAq6Lld0owGf1r5krGy8 GHzMu9ULVKFaGBE1+8yiYIWNAwDWSIhWfmKcFxAFGcfwkucomFiW12rcYMNrn5v6YZaj rusx+NjCPXMQIo+GVvyK2SqemCZiyWrlS4LU7+/FsZK9NyJGz4YKOn16B9E6Nsmms2EA wTUg== X-Gm-Message-State: AO0yUKVWlvusTGIV653rm0/6EgB28Ki1vYqHXzPCM984V7p2oqXob7/3 /zSHgxMra1rYlrcwwUwOhAT+03NJ21FcLcVEuFDEKadE90HKnbFp+ALFBVApodH7YLhTatlQCby SvEYSngaqzFTeugLi+W5ASJzrxA+NB6jLWPMUFicUrgW0XXhHZix8D3s4kWp4Jlv5MYY9 X-Received: by 2002:a17:907:6e25:b0:878:54e3:e3e1 with SMTP id sd37-20020a1709076e2500b0087854e3e3e1mr20527869ejc.73.1678237921507; Tue, 07 Mar 2023 17:12:01 -0800 (PST) X-Google-Smtp-Source: AK7set8DUpOU7QS6qISDaILLKeDZ+CWtJ4Vha4a1VIxT4X4VQ0MBhixGTyn1bq3juX5fUq6sP/R0nQ== X-Received: by 2002:a17:907:6e25:b0:878:54e3:e3e1 with SMTP id sd37-20020a1709076e2500b0087854e3e3e1mr20527854ejc.73.1678237921272; Tue, 07 Mar 2023 17:12:01 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id t26-20020a1709060c5a00b008ec793ac3f4sm6726429ejf.192.2023.03.07.17.11.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:00 -0800 (PST) Date: Tue, 7 Mar 2023 20:11:58 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang , Jason Wang Subject: [PULL 23/73] vdpa: block migration if device has unsupported features Message-ID: <5c1ebd4c432eda629aeb7a4ecab45220d0272616.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez A vdpa net device must initialize with SVQ in order to be migratable at this moment, and initialization code verifies some conditions. If the device is not initialized with the x-svq parameter, it will not expose _F_LOG so the vhost subsystem will block VM migration from its initialization. Next patches change this, so we need to verify migration conditions differently. QEMU only supports a subset of net features in SVQ, and it cannot migrate state that cannot track or restore in the destination. Add a migration blocker if the device offers an unsupported feature. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-12-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 533ba54317..1089c35959 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -795,7 +795,8 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, int nvqs, bool is_datapath, bool svq, - struct vhost_vdpa_iova_range iova_range) + struct vhost_vdpa_iova_range iova_range, + uint64_t features) { NetClientState *nc = NULL; VhostVDPAState *s; @@ -818,7 +819,10 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.shadow_data = svq; - if (!is_datapath) { + if (queue_pair_index == 0) { + vhost_vdpa_net_valid_svq_features(features, + &s->vhost_vdpa.migration_blocker); + } else if (!is_datapath) { s->cvq_cmd_out_buffer = qemu_memalign(qemu_real_host_page_size(), vhost_vdpa_net_cvq_cmd_page_len()); memset(s->cvq_cmd_out_buffer, 0, vhost_vdpa_net_cvq_cmd_page_len()); @@ -956,7 +960,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, for (i = 0; i < queue_pairs; i++) { ncs[i] = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd, i, 2, true, opts->x_svq, - iova_range); + iova_range, features); if (!ncs[i]) goto err; } @@ -964,7 +968,7 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, if (has_cvq) { nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd, i, 1, false, - opts->x_svq, iova_range); + opts->x_svq, iova_range, features); if (!nc) goto err; } From patchwork Wed Mar 8 01:12:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VP7WHNFT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZCz0Ncfz1yWr for ; Wed, 8 Mar 2023 12:17:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiLu-00032Y-13; Tue, 07 Mar 2023 20:12:24 -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 1pZiLh-0002rU-TI for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiLg-0001bz-24 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237927; 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=iCSOV5r/QWCCL26j+7uWnJ/RqfqYZ3ThBkhFOMSpoLM=; b=VP7WHNFTBXMfHRpdyZ8GYTJIYNHTP20ojkWfCkYPpvhsVtVJpUxyUFKLX1K+y+OYCcCGNm mGMDBUsWGaEYG+Wdehniwgqln+IdXFKXHl7QQqg8GPgvfLrwPUkE/tzZ05mprtJqWynYGS KOFpoKuzVngRoUKf+1rxJ825nr21DNQ= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-ZpIh-secNoq3KAYPp-IjCA-1; Tue, 07 Mar 2023 20:12:06 -0500 X-MC-Unique: ZpIh-secNoq3KAYPp-IjCA-1 Received: by mail-ed1-f70.google.com with SMTP id q13-20020a5085cd000000b004af50de0bcfso21715196edh.15 for ; Tue, 07 Mar 2023 17:12:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237924; 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=iCSOV5r/QWCCL26j+7uWnJ/RqfqYZ3ThBkhFOMSpoLM=; b=Zuzpw9P19KP1a4/BsSQkqayvlxpaw8vHzVsoASILLj5QID+R5QYDLoeg7eNz8aM7Mz 1MCXlDH2eals556TUuy4sleHxmV5gRe9C/yF0t/oL+LPouokH1EtR/0tHUJKvFe4vzJd Kx6Dd/oJ6Neh8ylk5vxKBzPQDLbh14/E77DxN5Nj3/g9K02tRy6ziBQMAjHlExkGLIsO y07q18rPpHyC2gXO/Q+Fk2Na1Pd0zT4z+4yW8379bF3b6ZbxYXmdHRTDkyyxvYtDe6Tf WN+3bs4XCa8WtpYq35rFQmYe83YRm5nJ0UgbVwAAQXHI3QESlhL2oue/Eha6p7oH4jv7 fXRw== X-Gm-Message-State: AO0yUKUHH6ankmeMrJtMjbsU3toNEW7Q168G9DAuCrhpkqAl8PIUMoFt 95zYO/99lD/Xuehz8of17X3AaTw/mhoPNwPHmz2/nk8vlXp/0D2iTZIjViO3J/uOrOooWl0gRjP 5hXaPCEdBfPDbk6M4WnnI/eUtY/j0HD8eOUO+DMtnB69N4lEUFnjg66KaydkKplluTSmE X-Received: by 2002:a17:907:7daa:b0:8b1:30da:b586 with SMTP id oz42-20020a1709077daa00b008b130dab586mr19899571ejc.49.1678237924420; Tue, 07 Mar 2023 17:12:04 -0800 (PST) X-Google-Smtp-Source: AK7set9x5AnyRSL4lcDOzqWKdrnnfjKLP2Egq8CzYPhd6pPcPG+A+0cYnc8fmAbOIb2HdE78kVlQJw== X-Received: by 2002:a17:907:7daa:b0:8b1:30da:b586 with SMTP id oz42-20020a1709077daa00b008b130dab586mr19899548ejc.49.1678237924093; Tue, 07 Mar 2023 17:12:04 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id v5-20020a1709063bc500b008c327bef167sm6746961ejf.7.2023.03.07.17.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:03 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:01 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Lei Yang Subject: [PULL 24/73] vdpa: block migration if SVQ does not admit a feature Message-ID: <57ac831865e370012496fb581a38d261cb72c5d0.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez Next patches enable devices to be migrated even if vdpa netdev has not been started with x-svq. However, not all devices are migratable, so we need to block migration if we detect that. Block migration if we detect the device expose a feature SVQ does not know how to work with. Signed-off-by: Eugenio Pérez Message-Id: <20230303172445.1089785-13-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index e9167977d5..48ffb67a34 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -443,6 +443,21 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) return 0; } + /* + * If dev->shadow_vqs_enabled at initialization that means the device has + * been started with x-svq=on, so don't block migration + */ + if (dev->migration_blocker == NULL && !v->shadow_vqs_enabled) { + /* We don't have dev->features yet */ + uint64_t features; + ret = vhost_vdpa_get_dev_features(dev, &features); + if (unlikely(ret)) { + error_setg_errno(errp, -ret, "Could not get device features"); + return ret; + } + vhost_svq_valid_features(features, &dev->migration_blocker); + } + /* * Similar to VFIO, we end up pinning all guest memory and have to * disable discarding of RAM. From patchwork Wed Mar 8 01:12:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753779 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dogR+0ML; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7V5MjYz1yWm for ; Wed, 8 Mar 2023 12:13:10 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM4-0003bw-Lk; Tue, 07 Mar 2023 20:12:32 -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 1pZiLj-0002xZ-V5 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiLi-0001dZ-Dl for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237929; 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=I0l1LaAqsmg29CKo7QKOuWkd4tPIVmOJ6o7QVmDHx8A=; b=dogR+0MLCvd4ucvniaop49GLJwiXUMRSZhWz3nkZJhBexdmo+RNjo17/rtv627pISLCeDi BScmonX6EGPfvUOFD+++Hc5msqti6HwgZxx7iB9DhK6YqZeM4Xz+Cj2hXRnNhU6W4UeXOH 8IpPUf1UXG07HjjqX7j/PLbiItzHpQw= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-79-Nr-a9BmpMnqL1wZEnr3MyQ-1; Tue, 07 Mar 2023 20:12:08 -0500 X-MC-Unique: Nr-a9BmpMnqL1wZEnr3MyQ-1 Received: by mail-ed1-f72.google.com with SMTP id b1-20020aa7dc01000000b004ad062fee5eso21181462edu.17 for ; Tue, 07 Mar 2023 17:12:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237927; 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=I0l1LaAqsmg29CKo7QKOuWkd4tPIVmOJ6o7QVmDHx8A=; b=7/10ul02Eu/TMHDseGykdEr7vZBTQcf1D3kf0N2j5TNtTxjsNt94Da3BO3uZduX49n xPDDrr7vd7I1Jd3syoGXN61Fd/P6EB+AMESEU8nnSMnWtWZnC4JklEfcsqod/31kl2Th TswkgT3YxNcoQK5NP+uosZ9us5aH76HeF/K3lXHYYYVMX9ojUCVCcqgYpfD1LrB3mKhH ze9C6dv49bIMxLo4T7cjwWUWgbahx5N+xHgAHJTMWVwoIlIvAPcaNTCUpxmHm8+K4KJ3 R1i8jWYqwg6erRBuo9nKsTRMVRZnB9koAO5plNd+r+kcg1U2K9IqkzdYx3dhpWhDfAkJ GoBQ== X-Gm-Message-State: AO0yUKWuTwuY6AHAs8GssnL3Uo0glbzZY1QTW1r68mWt1+g+zkf61bbq tZj96+NoR/0yS9ync/d4q8rxnZOHZRzL7gyV53tuxIMgtKnqDCDv0liCR4ea1HmkH8QVRaKG6LA ddIHo1NH9WkoZxvptv2tolhMw0T3v+o1TDxll8xwdo5rE098pdfVAcpiEr6M1f4U4iWCM X-Received: by 2002:a17:907:1b1e:b0:8b2:8876:2a11 with SMTP id mp30-20020a1709071b1e00b008b288762a11mr22862295ejc.28.1678237927119; Tue, 07 Mar 2023 17:12:07 -0800 (PST) X-Google-Smtp-Source: AK7set9pZkIzuRTjIuuF5fpW3igiVa95nBp11UC9MP9RD+PSjDb8BG0eFfruwcRxSqUwiANzBsQ5xA== X-Received: by 2002:a17:907:1b1e:b0:8b2:8876:2a11 with SMTP id mp30-20020a1709071b1e00b008b288762a11mr22862278ejc.28.1678237926922; Tue, 07 Mar 2023 17:12:06 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id i2-20020a17090685c200b008dcaf24bf77sm6730399ejy.36.2023.03.07.17.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:06 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:04 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Lei Yang Subject: [PULL 25/73] vdpa net: allow VHOST_F_LOG_ALL Message-ID: <609ab4c3ed8d6b6a4d94930fb9185412b2ba0d0c.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez Since some actions move to the start function instead of init, the device features may not be the parent vdpa device's, but the one returned by vhost backend. If transition to SVQ is supported, the vhost backend will return _F_LOG_ALL to signal the device is migratable. Add VHOST_F_LOG_ALL. HW dirty page tracking can be added on top of this change if the device supports it in the future. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20230303172445.1089785-14-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 1089c35959..99904a0da7 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -101,6 +101,8 @@ static const uint64_t vdpa_svq_device_features = BIT_ULL(VIRTIO_NET_F_MQ) | BIT_ULL(VIRTIO_F_ANY_LAYOUT) | BIT_ULL(VIRTIO_NET_F_CTRL_MAC_ADDR) | + /* VHOST_F_LOG_ALL is exposed by SVQ */ + BIT_ULL(VHOST_F_LOG_ALL) | BIT_ULL(VIRTIO_NET_F_RSC_EXT) | BIT_ULL(VIRTIO_NET_F_STANDBY); From patchwork Wed Mar 8 01:12:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753802 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Nn2Nt8eU; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBX4qctz1yWr for ; Wed, 8 Mar 2023 12:15:48 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM2-0003S5-86; Tue, 07 Mar 2023 20:12:30 -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 1pZiLm-0002yR-NK for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:18 -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 1pZiLl-0001dt-DJ for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237932; 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=O5puY1+aX+yn6M9yjqvoNhyMx/KFthsrofWTajhTdp4=; b=Nn2Nt8eU96D6WOedP4K0KvvjVdN1oWFUohVjS+IIbpIn5fcGUfJfdQbsiA+nFSy6alXfdu /m7I97hTI0vCfpnER7BtlKXxxevkMVUw+x51C5ieBKdhd/wXVfbL7pbuo5bnW6Oq+R4/OB VbRpMsVR+cap5JCvXxm4YyP+adqUrGo= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-433-NPm0RcupNsSg17arWMaKfg-1; Tue, 07 Mar 2023 20:12:11 -0500 X-MC-Unique: NPm0RcupNsSg17arWMaKfg-1 Received: by mail-ed1-f71.google.com with SMTP id d35-20020a056402402300b004e37aed9832so11980650eda.18 for ; Tue, 07 Mar 2023 17:12:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237930; 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=O5puY1+aX+yn6M9yjqvoNhyMx/KFthsrofWTajhTdp4=; b=hnZyp4E9Sy/90EYN2bnRM0o2cZiCU9foypQ444uvwxCYDIEJbMS6S+BCRBcJ/bV+El joAgYk9ebzTigEC7rf9H5d7HGILI79a2wiTX7l8+bOxvDmndwJku/LN9gItQ/FJLku4K LsX6c5pSLsMI9r1trKx4KYVce8EkJ3Gqy4u2Ev2V3binJ5FEW5ug4BUsXlO1FmVgF/av H8BUN+g9GfPd4WFQfGYYeDPBuWbdPe2skl8UJn2AfoH6drR9jc0+HiO8RGjcGnzEGgji lOwiFXp/6UddRjX7Jw24ELVDMZLWBDIfdC7D9VLSTIvVUVWPa54GPa1uGKGiu34Bi2cQ RywQ== X-Gm-Message-State: AO0yUKXRYvpAnL3+jacXRbEkf8vPuQHBUClcrPS8hWOZmwuggTxWkxLC EtpR01zPDM/NMDpG8HyHvr2H8ekftFNb536+/lXyNK/neoyZ01qhCqaR0pUMbUSOtEb4PqBPUp2 emG4PwtQZoT9sarafMO8bVpIcwZS2rHWqf1Tl7cNgjwhLXrj9X1i/UAbUoNpcQ6QGvI1I X-Received: by 2002:a17:906:2802:b0:86f:e30c:72c1 with SMTP id r2-20020a170906280200b0086fe30c72c1mr15555023ejc.8.1678237930275; Tue, 07 Mar 2023 17:12:10 -0800 (PST) X-Google-Smtp-Source: AK7set9Yj7Ja3ONILcoUNtLbNSt9WAQeMb+4fd+diXRSw3hT4jnFHPUWM8xZlHv9JpGBcwpG4lMh0w== X-Received: by 2002:a17:906:2802:b0:86f:e30c:72c1 with SMTP id r2-20020a170906280200b0086fe30c72c1mr15555009ejc.8.1678237930086; Tue, 07 Mar 2023 17:12:10 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id c15-20020a170906170f00b008c6c47f59c1sm6701514eje.48.2023.03.07.17.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:09 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:07 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Eugenio =?utf-8?b?UMOpcmV6?= , Jason Wang , Lei Yang Subject: [PULL 26/73] vdpa: return VHOST_F_LOG_ALL in vhost-vdpa devices 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Eugenio Pérez vhost-vdpa devices can return this feature now that blockers have been set in case some features are not met. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20230303172445.1089785-15-eperezma@redhat.com> Tested-by: Lei Yang Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 48ffb67a34..bc6bad23d5 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1294,10 +1294,9 @@ static int vhost_vdpa_set_vring_call(struct vhost_dev *dev, static int vhost_vdpa_get_features(struct vhost_dev *dev, uint64_t *features) { - struct vhost_vdpa *v = dev->opaque; int ret = vhost_vdpa_get_dev_features(dev, features); - if (ret == 0 && v->shadow_vqs_enabled) { + if (ret == 0) { /* Add SVQ logging capabilities */ *features |= BIT_ULL(VHOST_F_LOG_ALL); } From patchwork Wed Mar 8 01:12:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QHi8WQ/y; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7r43zzz1yWm for ; Wed, 8 Mar 2023 12:13:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM6-0003hc-VI; Tue, 07 Mar 2023 20:12:35 -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 1pZiLr-00035f-08 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:20 -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 1pZiLo-0001e7-Tc for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237936; 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=LNPdCgNcGFicFdbhUZpb5Sxp+gVyCyM6+pEBdFgxZcU=; b=QHi8WQ/y6AxgjxWKGPhMFSm4j/0dmpa91iBnaIvZmMB3ya/x8Wb1EXRULvI9tpSYrosmA+ 7BHMcB1G1Kv5mKv0ZfhqYa8Z3AVtyEeQRZJrXp2wvoW8ijsg3ACqGqOPtPb5zZkADRMuWx SI4T/rghlSR2i/ECQO0xb2uKPfDyAKw= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-520-rVHuTq8wMB2sm6mtLpT6xg-1; Tue, 07 Mar 2023 20:12:15 -0500 X-MC-Unique: rVHuTq8wMB2sm6mtLpT6xg-1 Received: by mail-ed1-f70.google.com with SMTP id p36-20020a056402502400b004bb926a3d54so21289391eda.2 for ; Tue, 07 Mar 2023 17:12:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237933; 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=LNPdCgNcGFicFdbhUZpb5Sxp+gVyCyM6+pEBdFgxZcU=; b=g1VtvNw6PGm/g5DgNJE4x5hY2SG8VuT30P4eiVray9H7KShO29dIeJxsmrrm6nJA7M j3SN8Ysrr/jQhvuOOt9hLW1q3WIlS7ahUAfmhS3ARuR2r+9qRK/JZYp0KEziZSK4r2aD hlsuRQ0VyhLScNr/5aLu+yQXXV6RLBwlA244Pfpg/0Ula4WJCYJzy1y73QzOUKS5my0B O7Uz3XdwgxmK10VIoHpxA2rCHOW4Hx95+eEbe6Bg/GQTda7NN5p3ucQDd5su+cJ95/T8 ot94b0XotSvY7TvjbZ13jZdq7AywfVWqLMnMI3HAqVF6kbqXh+N5XDuv+yn6P8cYoLm5 tiLA== X-Gm-Message-State: AO0yUKVnSMViCxPD7bxhdUKnuMPBPNXxt9X0BDDX7IptNDTn5we995Q1 /njTvWt+2nfVsLBkRX1bdGEBY8ukULpqCgeFnDB0fnOgF1K/GsTVcQu7QIEbIelrG1PnhkNgb7a 0XLQ54bz7CFH9d7LnkzbVcLq51RmR/6tTlzONb2GV/255TcJtFGnyrFIaxx9YbdXd44vb X-Received: by 2002:a17:906:539a:b0:88d:f759:15ae with SMTP id g26-20020a170906539a00b0088df75915aemr16590449ejo.42.1678237933458; Tue, 07 Mar 2023 17:12:13 -0800 (PST) X-Google-Smtp-Source: AK7set+fc4knA6K0C+PdESDjLyFIMKOlwNOTWsDO3PFM6Iee3VeFOcUkhjHk92FTRrmDZj9PzDHnhw== X-Received: by 2002:a17:906:539a:b0:88d:f759:15ae with SMTP id g26-20020a170906539a00b0088df75915aemr16590435ejo.42.1678237933211; Tue, 07 Mar 2023 17:12:13 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 21-20020a170906309500b008b1779ba3c1sm6744393ejv.115.2023.03.07.17.12.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:12 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:10 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Fabiano Rosas , Ani Sinha Subject: [PULL 27/73] Revert "tests/qtest: Check for devices in bios-tables-test" Message-ID: <7cb230788eb73aaadfa9336839bf5527bb4f0f4c.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov This reverts commit c471eb4f40445908c1be7bb11a37ac676a0edae7. which broke acpi tables test and rebuild due to skipping some tests even thought none of devices tests depend on weren't disabled. As result it leads to some expected tables not being updated, merge conflicts and tests failure. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-2-imammedo@redhat.com> Acked-by: Fabiano Rosas Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 75 ++-------------------------------- 1 file changed, 4 insertions(+), 71 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index d29a4e47af..d8c8cda58e 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1008,12 +1008,6 @@ static void test_acpi_q35_multif_bridge(void) .machine = MACHINE_Q35, .variant = ".multi-bridge", }; - - if (!qtest_has_device("pcie-root-port")) { - g_test_skip("Device pcie-root-port is not available"); - goto out; - } - test_vm_prepare("-S" " -device virtio-balloon,id=balloon0,addr=0x4.0x2" " -device pcie-root-port,id=rp0,multifunction=on," @@ -1049,7 +1043,6 @@ static void test_acpi_q35_multif_bridge(void) /* check that reboot/reset doesn't change any ACPI tables */ qtest_qmp_send(data.qts, "{'execute':'system_reset' }"); process_acpi_tables(&data); -out: free_test_data(&data); } @@ -1403,11 +1396,6 @@ static void test_acpi_tcg_dimm_pxm(const char *machine) { test_data data; - if (!qtest_has_device("nvdimm")) { - g_test_skip("Device nvdimm is not available"); - return; - } - memset(&data, 0, sizeof(data)); data.machine = machine; data.variant = ".dimmpxm"; @@ -1456,11 +1444,6 @@ static void test_acpi_virt_tcg_memhp(void) .scan_len = 256ULL * 1024 * 1024, }; - if (!qtest_has_device("nvdimm")) { - g_test_skip("Device nvdimm is not available"); - goto out; - } - data.variant = ".memhp"; test_acpi_one(" -machine nvdimm=on" " -cpu cortex-a57" @@ -1474,7 +1457,7 @@ static void test_acpi_virt_tcg_memhp(void) " -device pc-dimm,id=dimm0,memdev=ram2,node=0" " -device nvdimm,id=dimm1,memdev=nvm0,node=1", &data); -out: + free_test_data(&data); } @@ -1492,11 +1475,6 @@ static void test_acpi_microvm_tcg(void) { test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=off", &data); @@ -1507,11 +1485,6 @@ static void test_acpi_microvm_usb_tcg(void) { test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); data.variant = ".usb"; test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,usb=on,rtc=off", @@ -1523,11 +1496,6 @@ static void test_acpi_microvm_rtc_tcg(void) { test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); data.variant = ".rtc"; test_acpi_one(" -machine microvm,acpi=on,ioapic2=off,rtc=on", @@ -1539,11 +1507,6 @@ static void test_acpi_microvm_pcie_tcg(void) { test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); data.variant = ".pcie"; data.tcg_only = true; /* need constant host-phys-bits */ @@ -1556,11 +1519,6 @@ static void test_acpi_microvm_ioapic2_tcg(void) { test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); data.variant = ".ioapic2"; test_acpi_one(" -machine microvm,acpi=on,ioapic2=on,rtc=off", @@ -1600,12 +1558,6 @@ static void test_acpi_virt_tcg_pxb(void) .ram_start = 0x40000000ULL, .scan_len = 128ULL * 1024 * 1024, }; - - if (!qtest_has_device("pcie-root-port")) { - g_test_skip("Device pcie-root-port is not available"); - goto out; - } - /* * While using -cdrom, the cdrom would auto plugged into pxb-pcie, * the reason is the bus of pxb-pcie is also root bus, it would lead @@ -1624,7 +1576,7 @@ static void test_acpi_virt_tcg_pxb(void) " -cpu cortex-a57" " -device pxb-pcie,bus_nr=128", &data); -out: + free_test_data(&data); } @@ -1812,12 +1764,6 @@ static void test_acpi_microvm_acpi_erst(void) gchar *params; test_data data; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - g_free(tmp_path); - return; - } - test_acpi_microvm_prepare(&data); data.variant = ".pcie"; data.tcg_only = true; /* need constant host-phys-bits */ @@ -1878,11 +1824,6 @@ static void test_acpi_q35_viot(void) .variant = ".viot", }; - if (!qtest_has_device("virtio-iommu")) { - g_test_skip("Device virtio-iommu is not available"); - goto out; - } - /* * To keep things interesting, two buses bypass the IOMMU. * VIOT should only describes the other two buses. @@ -1893,7 +1834,6 @@ static void test_acpi_q35_viot(void) "-device pxb-pcie,bus_nr=0x20,id=pcie.200,bus=pcie.0,bypass_iommu=on " "-device pxb-pcie,bus_nr=0x30,id=pcie.300,bus=pcie.0", &data); -out: free_test_data(&data); } @@ -1954,10 +1894,8 @@ static void test_acpi_virt_viot(void) .scan_len = 128ULL * 1024 * 1024, }; - if (qtest_has_device("virtio-iommu")) { - test_acpi_one("-cpu cortex-a57 " - "-device virtio-iommu-pci", &data); - } + test_acpi_one("-cpu cortex-a57 " + "-device virtio-iommu-pci", &data); free_test_data(&data); } @@ -2066,11 +2004,6 @@ static void test_acpi_microvm_oem_fields(void) test_data data; char *args; - if (!qtest_has_device("virtio-blk-device")) { - g_test_skip("Device virtio-blk-device is not available"); - return; - } - test_acpi_microvm_prepare(&data); args = test_acpi_create_args(&data, From patchwork Wed Mar 8 01:12:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Gz/B6lN5; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ743w0nz1yWm for ; Wed, 8 Mar 2023 12:12:48 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM3-0003ad-So; Tue, 07 Mar 2023 20:12:32 -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 1pZiLt-00039W-Qp for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:22 -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 1pZiLs-0001eH-0h for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237939; 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=Ya5Cro5wypV5ailmtJu7KeS2J+LYt2/Y2DT4fIUNEAc=; b=Gz/B6lN5SuJndpXsuT/sTWcEzEeggTpqaN6LIiIKsGbPcWZf6VmXbV9PAJgUbAfloIhfz9 aGn9p8He9oS0bbMvfSBKOug4B6ZSK3l8z1VFsDfNBjxXBgqgvCjRfH0VClBLT8fmX6svJ2 e5hIMmDUPZeFv2ZvZNRCS9oEl9yCNXI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-319-vlRVFqt3MkiHgVItoA6X0A-1; Tue, 07 Mar 2023 20:12:18 -0500 X-MC-Unique: vlRVFqt3MkiHgVItoA6X0A-1 Received: by mail-ed1-f70.google.com with SMTP id fi8-20020a056402550800b004a26cc7f6cbso21407065edb.4 for ; Tue, 07 Mar 2023 17:12:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237936; 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=Ya5Cro5wypV5ailmtJu7KeS2J+LYt2/Y2DT4fIUNEAc=; b=ow54jFdhe3Zz1ESY5npFByehKinh4yJ+E0KR2ooShnnO7xkhNjTQZHvJl9Yd8GvXOK Faqi7UBGJkR7HPIYXWjuKJdJ143L88ghfHmNS21G6mo0qP4460AVmwLfit0AVtBeGRu6 kaCKgKlmCLx6r0PZWG39wBP7UxX8MOFzZTwvc2sBPub4jS8eXQzCz9aYvVMHrLedQRWj 5oBThIxUQitFZdI8CFO8szoiKFfGnXYzeNAAcp321jI8rsKjtdG0vricT8kDii3gvCyN Sp22hmPVRLY92sNRTz1JDmIkcjrCtvXnIdZYchQbBnWCpV5+Vlp3OXwIriDcIofKPO86 dLuw== X-Gm-Message-State: AO0yUKVSesCvCquJZbHBFvvtJ+PvS5wv6z2siTWEenYSJV9FNJOT0mTF R+kznETgeFp80U6GwpbF1xAPQfi9olJv0udGb92kM6x/nfp/9YO/wP2ViDuRI1GD+WhiABv/7oU IrQyuXB7Jr1BQUsDxD7QDopwF6863BDxeCf0VnhL3TUs9Mw55zwauOanfAp/7OMppj6Vu X-Received: by 2002:a17:907:1051:b0:8b1:c5aa:4c8b with SMTP id oy17-20020a170907105100b008b1c5aa4c8bmr15019344ejb.77.1678237936623; Tue, 07 Mar 2023 17:12:16 -0800 (PST) X-Google-Smtp-Source: AK7set/wcEWpE1w0Z1ix3qNF2iRfqNR31q5YrSwVleoUIa0I/JvVMzSQ8i6MAE7qDJKAIqXhjippmw== X-Received: by 2002:a17:907:1051:b0:8b1:c5aa:4c8b with SMTP id oy17-20020a170907105100b008b1c5aa4c8bmr15019332ejb.77.1678237936389; Tue, 07 Mar 2023 17:12:16 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id j22-20020a1709066dd600b008e6bd130b14sm6828952ejt.64.2023.03.07.17.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:15 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:13 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 28/73] tests: acpi: whitelist new q35.noacpihp test and pc.hpbrroot 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov for q35.noacpihp use plain default Q35 DSDT table as a starting point. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ tests/data/acpi/q35/DSDT.noacpihp | Bin 0 -> 8252 bytes 2 files changed, 2 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.noacpihp GIT binary patch literal 8252 zcmb7JOKcm*8J^`sS}m8-l3H7~>{x`8ppO&@W#@%Hf|9#@*`iEwDLcg);8Jp0*$I$E z5(9Ap1F`}nj!#Wk2R$-@0`%6NdaZ$8+M90;&{Ge+EP5*dS-ZGGk3-x|ap-Ho;wfo^WamPH3nZN48=`{ABvb-Y&D z>^ED!U3qAkX5SM>X|rGPyUgrwwtVKU&Gs(^UgqAL%=53Tj@Gloox-B!gzbNx|8C{< zFTc3*Ugg0r{_*R3Z(11u&f(X@@A;U%q7NhMOf+&nA6_?Z6P=%19W8!72>B)$dk3-p71ry;JtetLT^44GJsP=}(pzvuSYX^QVJ@gTIJF=Gh2}p#IIaG8k0~ylT020Vk^K?XHn~ zC}R&AZ6lXFFc)LMnWkqJx8YhY;~C<2s`p;SZ>JpSjOfz?p`k zTrqt`2{v-8a~(fu=STj`@CJ(uX@f;E8;q7e7X$zBmB0Txc^wqM z=ZvOvhBGB}M%Rf@)j6x_oYi#B>N*jsI!#Tdsp&Lzod{K(bDGXMP3N4h6QQcp(sWvy zPD|H`P}P~!bmlajIbA10Ri~}#v^AZ!t`niEGq35)YdZ6~PK2t?c}?fMrgL7`iBQ$K zpy^!DbS~&R5vn>JO{b&jbab5vRh*NIToxv1$})O0TD zIuWWmT}`K}>2!6S2vwcOG@ZvZoyT;Y2vwcOHJ!&boyT>Z2vwc1F)?THS!qerxuokv zsOmhS={%w7JfZ7EsOmh)nU!QFJjt2WWU@OcnBJ3+n0|s?)|ks0b6IC1RGFtV<|&PN zN@pTenWr`8X^nYWXChRYPif4jH0Dz}6QRmH!Az;Y%GRDqI#3Mj8h28vMXgnf}LawZul zLa7r5DzKah16818paRO7WS|J;^@M>6EN8+%6(|{~fN~}oC_Az;Y%GRDqI#3Mglifg+STVW0xbnJ`cVN(L&RoJj_XQ0jz%3M^;BKouw% zsDN@N87M-j69y``0?L_Wpa`W-7^uK< zCJa=8l7R{+XOe*;lsaLc0?U~&Pz6c`DxjQ628vMXgnf}LawZulLa7r5 zDzKah16818paRO7WS|J8P8g`bawZH^fs%m=C})y^B9uB|paRR8Fi-_b1}dPONd}5g z>V$zJQVbN4YM=;J14XD9sKSJSDoip^g-HggFkzqy69%d<$v_n*8K}a9fhtTGsKO)z zRhVR;3KIsZFkzqylMGa0l7T8r7$_onbzz{0aK-pwl7S+`Wso5;<=DbN5y`QIfg+M) zO9qNijx8A|Lab9P_hF%IWDohD)qVOy`sED$RNTeZ2LAt#=03D`ci6r)w{PX#7h4-% zcMi7OEf?mk+@~{ajxQzLV)v-c%Hq2ff4E~UFgik_ZaLgrn}yF;W&mG=)R?9~KYN7oO{IL3 zmv4@hZyr*gM7qP(0u@M?g^T`W%OZSD+zXkk9w zZFYKXhBxnr-{%;Xt{sXOFW1)nQm5`H%4zgpxD-S;K<5+i!Hlb<9`1PODrlzs#IVuZb=; zt*bAj<$8OkTMJ}wEzA+G#pc=zp_?`*&EE(;B>vvx6gX!4fT zFut+Bu?_nc)L~l3n*BGnWrufuNI`{_yiRT1@LKDE;dR@W4XnJE>8ozAwCA;btnL>H znf8L(S_yE!(ko%vy0zXiV@8d5_|9MD8w2Q&=wza1wM^X*8z5P?;PvXiN{y`H4*S@H z)a!0@2HOUex$x<$FJx4qB!Jfa$D2_sX3=PQIDUd8#MT1V`zOwJ2>x=(_9m9nsYhv+3bLrR>VJ-H0w-t+Y-lg_qP8R6toJZ+LX=a{vIOo}J&wJdP9O{ts i^3*YlnPHw~26bm4s8^G5PqP)~*z^eEU7?1}@c#ikX|rko literal 0 HcmV?d00001 diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..b2c5312871 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,3 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/q35/DSDT.noacpihp", diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp new file mode 100644 index 0000000000000000000000000000000000000000..d68c472b460e4609a64ea67de3c4cebfca76164d From patchwork Wed Mar 8 01:12:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eyHgkLXm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBG6V4Wz1yWr for ; Wed, 8 Mar 2023 12:15:34 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM5-0003eR-Nh; Tue, 07 Mar 2023 20:12:33 -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 1pZiLw-0003H3-GV for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiLu-0001ea-S8 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237942; 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=2trXRR7GZlC7iwSMQlzM1Jn2Wy6O8R7FMtjsHnpZWNY=; b=eyHgkLXmalktQelKfu3tmXWU7EELZPgAsflpraZqly7e6xGhx8f150r/FY7gc39eG+YMzu 6S3OG0NdT7grlCPcWFLT5roalg2f+2aFpGnRcSOhz0UR6gXDLDjQBubxyZg3ZOaG7QJ5JX GVGuPKYRUZDaRvdTWHCNorz2J9I9XjE= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-336-zS43haidN1KLSbZnHCnCRA-1; Tue, 07 Mar 2023 20:12:21 -0500 X-MC-Unique: zS43haidN1KLSbZnHCnCRA-1 Received: by mail-ed1-f72.google.com with SMTP id fi8-20020a056402550800b004a26cc7f6cbso21407227edb.4 for ; Tue, 07 Mar 2023 17:12:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237939; 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=2trXRR7GZlC7iwSMQlzM1Jn2Wy6O8R7FMtjsHnpZWNY=; b=0czZJomYifkXZ8aroBcHIdDFOn+0iZsEts87S1a72fcc4vhXeEsxSSF/fkKNAW/z6u D53B4fyVBc+3PyRg2ngJXWHVZXSuU8bE5+XrU1UEs5A5QazxZ2BkfULWelq6cGWC6oLC hmoAvwk0cRiquvKd3bryg8p1jvZPox/fKWTnhLxXOAgfQl7IhR+JjFdmaGckfGchkgMl ibnnqqIsUP5rO3THg1UdC1iBYQkjEz1ykbthhgtx3PRIy5tkdmJavQY1FeD7ohxEpeHH fVmZG35JwNRzU7v5FeJClBMI20leU+dLGh1Zg0usOjAJOnFia2/dC3o1X/7wae/i7lK6 Q7nA== X-Gm-Message-State: AO0yUKX7sXaLeFsr4BhXpSE6UG9S6hKZIXxXNCIFh0D0fqZUyFovoI1l cGoAP5BHlJYcllcRYJeEpnp4V8GUfMKZB3u1D3PRl4LAMv4X9vVrTioo8tuUrSY+4+Ob/NedEij 1xI9B5nWFkHEVOrrpYDig4TXFxiPe5XqTI5loNPYfyfDs1Wtyy9520awkOG9OL54A+tRM X-Received: by 2002:a17:907:888b:b0:877:573d:e919 with SMTP id rp11-20020a170907888b00b00877573de919mr16086776ejc.20.1678237939570; Tue, 07 Mar 2023 17:12:19 -0800 (PST) X-Google-Smtp-Source: AK7set95ysHUdGzP5I3kLkdB/efxQkaoV1Oe6VDvZ8pMOeBB+xNsoUAf5qcmS1tUdSTO2Byy7zfBCw== X-Received: by 2002:a17:907:888b:b0:877:573d:e919 with SMTP id rp11-20020a170907888b00b00877573de919mr16086763ejc.20.1678237939362; Tue, 07 Mar 2023 17:12:19 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id rp6-20020a170906d96600b008b9b4ab6ad1sm6810355ejb.102.2023.03.07.17.12.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:18 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:16 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 29/73] tests: acpi: add test_acpi_q35_tcg_no_acpi_hotplug test and extend test_acpi_piix4_no_acpi_pci_hotplug 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov test bridge AML generator with ACPI PCI hotplug disabled (i.e. with native hotplug enabled/disabled per bridge/root port) PS: while at make sure that devices on pci-bridge are starting from addr=1.0 as slot 0 is not available there and test passes only because of a bug in ACPI hotplug that will be fixed by follow up patch Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-4-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 42 +++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index d8c8cda58e..7828c6b7e6 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -949,9 +949,14 @@ static void test_acpi_piix4_no_acpi_pci_hotplug(void) data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); test_acpi_one("-global PIIX4_PM.acpi-root-pci-hotplug=off " "-global PIIX4_PM.acpi-pci-hotplug-with-bridge-support=off " - "-device pci-bridge,chassis_nr=1 " - "-device pci-testdev,bus=pci.0 " - "-device pci-testdev,bus=pci.1", &data); + "-device pci-bridge,chassis_nr=1,addr=4.0 " + "-device pci-testdev,bus=pci.0,addr=5.0 " + "-device pci-testdev,bus=pci.0,addr=6.0,acpi-index=101 " + "-device pci-testdev,bus=pci.1,addr=1.0 " + "-device pci-testdev,bus=pci.1,addr=2.0,acpi-index=201 " + "-device pci-bridge,id=nhpbr,chassis_nr=2,shpc=off,addr=7.0 " + "-device pci-testdev,bus=nhpbr,addr=1.0,acpi-index=301 " + , &data); free_test_data(&data); } @@ -1002,6 +1007,35 @@ static void test_acpi_q35_tcg_bridge(void) free_test_data(&data); } +static void test_acpi_q35_tcg_no_acpi_hotplug(void) +{ + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_Q35; + data.variant = ".noacpihp"; + data.required_struct_types = base_required_struct_types; + data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); + test_acpi_one("-global ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off" + " -device pci-testdev,bus=pcie.0,acpi-index=101,addr=3.0" + " -device pci-bridge,chassis_nr=1,id=shpcbr,addr=4.0" + " -device pci-testdev,bus=shpcbr,addr=1.0,acpi-index=201" + " -device pci-bridge,chassis_nr=2,shpc=off,id=noshpcbr,addr=5.0" + " -device pci-testdev,bus=noshpcbr,addr=1.0,acpi-index=301" + " -device pcie-root-port,id=hprp,port=0x0,chassis=1,addr=6.0" + " -device pci-testdev,bus=hprp,acpi-index=401" + " -device pcie-root-port,id=nohprp,port=0x0,chassis=2,hotplug=off," + "addr=7.0" + " -device pci-testdev,bus=nohprp,acpi-index=501" + " -device pcie-root-port,id=nohprpint,port=0x0,chassis=3,hotplug=off," + "addr=8.0" + " -device pcie-root-port,id=hprp2,port=0x0,chassis=4,bus=nohprpint," + "addr=9.0" + " -device pci-testdev,bus=hprp2,acpi-index=601" + , &data); + free_test_data(&data); +} + static void test_acpi_q35_multif_bridge(void) { test_data data = { @@ -2094,6 +2128,8 @@ int main(int argc, char *argv[]) test_acpi_q35_tcg_tpm12_tis); } qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge); + qtest_add_func("acpi/q35/no-acpi-hotplug", + test_acpi_q35_tcg_no_acpi_hotplug); qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge); qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64); From patchwork Wed Mar 8 01:12:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753786 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=MZorPD+J; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ8J0HtNz1yWm for ; Wed, 8 Mar 2023 12:13:52 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM6-0003hK-Ta; Tue, 07 Mar 2023 20:12:34 -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 1pZiLz-0003NU-TD for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:29 -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 1pZiLy-0001ep-41 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237945; 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=v1CYajCO17Y5cS/tLpZ/xk1GD8VgUXYqeWSjKJLY76c=; b=MZorPD+JMJ3ODHIDXFhC3gREKp2EATPhMR8XqlI5pdS2gzMfD+1MDGY68LaR1k8mLqteeD xGJItJ65krCEd4ECfoVoqQLYdZlq9hYHp48jSQflPDmOH5qDg5afy1EM4RSG5fF1J5AKBK Bss7Z87EFoPZ3peDZJsojV8ETQESYOg= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-150-J8xjDbqMNlGdhf1tYBUVPg-1; Tue, 07 Mar 2023 20:12:24 -0500 X-MC-Unique: J8xjDbqMNlGdhf1tYBUVPg-1 Received: by mail-ed1-f69.google.com with SMTP id da22-20020a056402177600b004c60694083eso21251622edb.5 for ; Tue, 07 Mar 2023 17:12:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237943; 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=v1CYajCO17Y5cS/tLpZ/xk1GD8VgUXYqeWSjKJLY76c=; b=gXh3bmSWKozA8SdHLxlL+CCrx2Hf03w87RcdB1ovlS4wrBJpL9r0IOq5+Box6LrN3o U/x7xcumCRWTbTFmijMRJ675Lqt0dcMxD0HE1Ya1vjzyK7dhv5jS1m6w9CTEHmCMzT5Z 5lQW5d9i7MUN972jxgBPF16rDt+SCSczqS0Ilf63kt+e9lGEzmL1SBhf7D9f3aFDmh0y +R4h5tUxr+JaP4VoJcexGwymE6zR/Fh9gWBU0ci2e413hVW/2wHI2PB+xuwAyDNPFxUj rxQM5IqVwITgQaRsWe4xnHuCrgOM28sEQmxxL3mqZsGohER/TJGxZN4R1UGW/7CLI1gy uGVw== X-Gm-Message-State: AO0yUKWJGJCdGmsuFt4sAGnun/SgZ1Lyyn2QH8sARDkk6L4zZyQlhdIM Zc9PMGSVsyMiQdwKgprQ0d2jSVhoOjOqMyFxapjfy0BuMKu77AhZzkfwLr0scOLxWObeXkAwqs6 gdvKjjb9QHvvQQBPbNloXgBoXWOSugzSNB7PBQTZPbtqW55+hc9NjVWJfcKvsl8JUsdJk X-Received: by 2002:a05:6402:792:b0:49e:4786:a0e2 with SMTP id d18-20020a056402079200b0049e4786a0e2mr15209923edy.14.1678237942864; Tue, 07 Mar 2023 17:12:22 -0800 (PST) X-Google-Smtp-Source: AK7set+4WBSl4FVWRWIaeN12X8dAOBfrCLRj+iApUQf7rt2eYBU4aAyIdCIksRdzxlMDEhKpZAeobQ== X-Received: by 2002:a05:6402:792:b0:49e:4786:a0e2 with SMTP id d18-20020a056402079200b0049e4786a0e2mr15209906edy.14.1678237942538; Tue, 07 Mar 2023 17:12:22 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id v8-20020a50c408000000b004c09f0ba24dsm7499730edf.48.2023.03.07.17.12.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:22 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:19 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 30/73] tests: acpi: update expected blobs Message-ID: <6bf2d446d470dfbd8ba45da27d10ade4616586b1.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov expected changes: Basically adds devices present on root bus in form: Device (SXX) { Name (_ADR, 0xYYYYYYYY) // _ADR: Address } On top of that For q35.noacpihp, all ACPI PCI hotplug AML is removed and _OSC get native hotplug enabled: CreateDWordField (Arg3, 0x04, CDW2) CreateDWordField (Arg3, 0x08, CDW3) Local0 = CDW3 /* \_SB_.PCI0._OSC.CDW3 */ - Local0 &= 0x1E + Local0 &= 0x1F If ((Arg1 != One)) { CDW1 |= 0x08 Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-5-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/pc/DSDT.hpbrroot | Bin 3081 -> 3115 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8252 -> 7932 bytes 3 files changed, 2 deletions(-) diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/pc/DSDT.hpbrroot index a71ed4fbaa14be655c28a5e03e50157b4476e480..d77752960285a5afa6d0c0a04e400842f6acd2ed 100644 GIT binary patch delta 100 zcmeB_SS`Wj66_M9&BMUJ_;DlGJx(rXm6-Tor+5Kx<;|Zse=<548N_qMJGuk`Rj@Eb YH}MA>S-=HY!2-qz6>JazgbH>B01xpO00000 delta 66 zcmZ22(J8^@66_Mf$-}_Fcyc4xJx(r1rI`3&r+5KR#m%2Me=^D$TEuh2JGuk`RWLI| NH}MA>8NdZt7ywGL58eO( diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp index d68c472b460e4609a64ea67de3c4cebfca76164d..f35338db30a44638cc3a55d2870e0e377af4246f 100644 GIT binary patch delta 160 zcmdnv@W+@xe~< z0!|8(r^?wU^9LJR#B;8NdZtAOZ*#tY86SgbFr@073;jSil6K Lf@AYVxj04uw-F~b delta 485 zcmexkyT^gcCDVuVVj)AP$0<6$dFLLkhnl<(&P+5VJ?9S<|m&9n^yTw z6o2I_dDz)^Nx}m5shM0%OA-n|mNa+dFfjN7Nk)bwpq|>vNeq*dc>V(cLv12sVr^n2 zBNsbEVnJd@0s{k3uj=G1F7^T;Rwf2spgnLCAO;j9K~!xHVN{c1@)g}&BhAm~72V{; z65tUK#1Ze|>B1Y}7hvFMV8*}^9}40*dn$P3mlWibrYjVs7U!21C8rhx<$^;Txwtvv zor8h}dAYdU84vIr;9-=Q+$odE^Cozjb`K(;E8t+a1~*TcQr6% F000aMj?@4E diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index b2c5312871..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,3 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT.hpbrroot", -"tests/data/acpi/q35/DSDT.noacpihp", From patchwork Wed Mar 8 01:12:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XH9TnQiT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZC32dnMz1yWr for ; Wed, 8 Mar 2023 12:16:15 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM6-0003fk-4G; Tue, 07 Mar 2023 20:12:34 -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 1pZiM2-0003TA-FR for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:30 -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 1pZiM1-0001f3-0V for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237948; 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=rF0SXZBaKaXInEGmRiFB0FY2stf33tILeVSsXB3T3wg=; b=XH9TnQiTaWBrIx0Va/vVFxoKFRWADJlwy1cXSJnKsJ695MjI8DqOJgXveGJu9uHvCXp2NB Qv3GO6XLbas8XhoK1jKbirIyl8nNXf0rqRNFG1u8Z/UgJ6N2OatFootggJcmwQINLNYvBe pbisZJ8KzdZYMQCBWBMFkts/DS22a3o= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-425-OeVdXYG9NB2eaSa5UFx9wA-1; Tue, 07 Mar 2023 20:12:27 -0500 X-MC-Unique: OeVdXYG9NB2eaSa5UFx9wA-1 Received: by mail-ed1-f70.google.com with SMTP id k12-20020a50c8cc000000b004accf30f6d3so21465893edh.14 for ; Tue, 07 Mar 2023 17:12:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237945; 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=rF0SXZBaKaXInEGmRiFB0FY2stf33tILeVSsXB3T3wg=; b=XSFERFevmDhepfSLy8TZR5Xu2FBEDIyix0mjd7W77FHobxFcCTtGtRX4ikYZBEVkxI ul6iT7ze1MV+sc2E+U0LP6GeX3BB1z0Ef0h+zfOJu55LNEUpATUxvPEuB+5A040kUAVL ly7TVLHLzRSLLlEhUapzRv+v+66mN/hEEK854EGNUO6HgFSTUb1Z91Z0EMx6sZd2CRSi 39lQQdrpQu67qjrGMWO2hNjvF1kQDJontmH2+QvMJsGWcEhBu4jqjFZB4E1KjhH7872b 1lXOHcCT4QJU2W5sgpWAzgR+yKFmePN6zvagcprM1djHB30YbpPqHDGi02sb2yx67gVG 3G4A== X-Gm-Message-State: AO0yUKV1gLh3RS3GQcLmubXfqtYq4BJyHkSiewpCnBOtdgcqRx3LDBai 9P3ZAWaK/L+0EvAUaALLeHIeeNX3C08C+jFDE1K5dPfNZvsQ+2H2FRG2kWwK5q1qLuRPfozvoS3 QjA8SGWnkHzJdyJgRw4p1izeETQAK2KHbhjcjYqmj//7Gn2rDd6Di+0CVtPSTjV04nwRD X-Received: by 2002:aa7:d6c6:0:b0:4af:59c0:d303 with SMTP id x6-20020aa7d6c6000000b004af59c0d303mr14331894edr.26.1678237945667; Tue, 07 Mar 2023 17:12:25 -0800 (PST) X-Google-Smtp-Source: AK7set8t0p2Yfl2uR+dD9oxumh0K7ms7GuKoYXdgHmxJbWvzJh6olAsmtE5AfqcHiDkMSZUtaUO3FQ== X-Received: by 2002:aa7:d6c6:0:b0:4af:59c0:d303 with SMTP id x6-20020aa7d6c6000000b004af59c0d303mr14331878edr.26.1678237945378; Tue, 07 Mar 2023 17:12:25 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id z15-20020a5096cf000000b004f0de6d52fcsm1204416eda.74.2023.03.07.17.12.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:24 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:22 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 31/73] tests: acpi: whitelist q35/DSDT.multi-bridge before extending testcase Message-ID: <0ece4e3bc339a0dcbd0eb575b8ede2fab7844271.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-6-imammedo@redhat.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..dabc024f53 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/q35/DSDT.multi-bridge", From patchwork Wed Mar 8 01:12:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753793 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PnYjGA84; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ9Z4vfKz1yWm for ; Wed, 8 Mar 2023 12:14:58 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiM9-0004B8-Om; Tue, 07 Mar 2023 20:12: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 1pZiM5-0003eU-FZ for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:33 -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 1pZiM3-0001fH-QS for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237951; 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=Y13c106N8K8vctWFiYbDioLEH1WyId4rKqeKyUjFaYc=; b=PnYjGA84xa/ogBFXM/DjntdgicObuymF6teq/YNJBT1cNbPtpvqkMmuLyV/wqGGXboXkkW aNO/+m1XOsHqM2GjLQF+Wuy5sQi1PazDxt+SS36Kn89gBPzjSGYyESmuUyu63I0yztHNeK YbAWIb8gL7uxAvnkwsFHtzIrJK/xVe8= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-556-7DSWauALNqWtp1X0kG68tw-1; Tue, 07 Mar 2023 20:12:30 -0500 X-MC-Unique: 7DSWauALNqWtp1X0kG68tw-1 Received: by mail-ed1-f70.google.com with SMTP id u10-20020a056402064a00b004c689813557so21165616edx.10 for ; Tue, 07 Mar 2023 17:12:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237948; 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=Y13c106N8K8vctWFiYbDioLEH1WyId4rKqeKyUjFaYc=; b=KOT37T5yP3UducV3OaRRHN7Z+9zVRw33dIxn6hmXp1WwaHSBDX2nL5igSi1sT/vAyu BQmXerVx8EGJbic5bZDbsyfwQ9+voxm5b3QxeL2KAktAAXHMpwWp3T8SM85d7HdEdXMd o3eoQAt1OzehtcaUKPdbKfln3BKeUem5vWZnYffYjJt/m2XLcmD8s/ZYwjCPqLIcjlkL ZJgQdqXFFM2m0ATyVk+6q/Yn0jvdUCdungTbHwpRYsCduOU1g78MGkKiU/5Bcu09rrIK 1532drTwCllRYbfvVD3bktkE4prD0XEv9XR+Qo2h+OKZ6qO2hEUtSGgZJIElYIac6kt6 2Efw== X-Gm-Message-State: AO0yUKWyzj5aTzu7D8obiyQQr8ziZ88sdXDDUoE38GTAEDgfP/+MM0gR Z9M8/05+nmrfe8VN/rvPR6v8gtFIHlKssGSdtuBItjN89dXlm6JqfEm1xED7xtAh0dz+MwKzGnz XkGDt//t0WXkcF6wEl53aWrhGRAiV4DcfTWl/i/B8aXbVPynjxittd3gWS5kcKTRjT7xn X-Received: by 2002:a17:907:c282:b0:884:930:b017 with SMTP id tk2-20020a170907c28200b008840930b017mr20310934ejc.60.1678237948440; Tue, 07 Mar 2023 17:12:28 -0800 (PST) X-Google-Smtp-Source: AK7set9cPXdCrb+JWHoeYUUImJzyCEUXqaTkXLJ4FianhVmzW6vjWuceZsGqdW3dHA70Pbl7HT/wdw== X-Received: by 2002:a17:907:c282:b0:884:930:b017 with SMTP id tk2-20020a170907c28200b008840930b017mr20310915ejc.60.1678237948171; Tue, 07 Mar 2023 17:12:28 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id e16-20020a1709061e9000b008bfe95c46c3sm6783905ejj.220.2023.03.07.17.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:27 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:25 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 32/73] tests: acpi: extend multi-bridge case with case 'root-port,id=HOHP,hotplug=off root-port,bus=NOHP' Message-ID: <0c3bf7c4314f1512dcc6070994eeba3c6f526f41.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Following corner case wasn't covered: -device pcie-root-port,id=NO_HOTPLUG,hotplug=off -device pcie-root-port,bus=NO_HOTPLUG when intermediate root-port has explicitly disabled hotplug, all hierarchy below it is not described anymore (used to be described in 7.2) So as result we see only NO_HOTPLUG root-port described + Device (S50) + { + Name (_ADR, 0x000A0000) // _ADR: Address + } and no children nor notification chain for them are being composed. Follow up patches will fix missing leaf root-port descriptor and notification chain that should accompany it. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-7-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 7828c6b7e6..295d80740e 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1055,7 +1055,10 @@ static void test_acpi_q35_multif_bridge(void) " -device pci-testdev,bus=pcie.0,addr=2.4" " -device pci-testdev,bus=pcie.0,addr=5.0" " -device pci-testdev,bus=rp0,addr=0.0" - " -device pci-testdev,bus=br1", &data); + " -device pci-testdev,bus=br1" + " -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off" + " -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp" + , &data); /* hotplugged bridges section */ qtest_qmp_device_add(data.qts, "pci-bridge", "hpbr1", From patchwork Wed Mar 8 01:12:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Dxh7Kfny; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7h59RNz1yWm for ; Wed, 8 Mar 2023 12:13:20 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMA-0004LP-Jf; Tue, 07 Mar 2023 20:12:38 -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 1pZiM8-00041w-Oa for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiM7-0001fS-34 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237954; 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=HPL0VRVJ57Yfjl6d5EjiF2dYWygETGBKxIqXYP+XM24=; b=Dxh7KfnyXWU4jFXKB12trvjZ2i+5WtWQ4WJ69LiZQgSuwUCiT8rhhTKARRwhEDUqLx+SSS rlcwNhdpEkxVoJa6rX6/k5VG7Irv9mi648naWxFQCviquRWKIqLs6qxyJRmIs8WuFbcr9H u0EDc6vaEOaEUc03QbsUyuIOE8Bgb9s= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-25-QLuS06YgOIOOqY8DYU7JpQ-1; Tue, 07 Mar 2023 20:12:33 -0500 X-MC-Unique: QLuS06YgOIOOqY8DYU7JpQ-1 Received: by mail-ed1-f70.google.com with SMTP id ev6-20020a056402540600b004bc2358ac04so21652541edb.21 for ; Tue, 07 Mar 2023 17:12:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237951; 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=HPL0VRVJ57Yfjl6d5EjiF2dYWygETGBKxIqXYP+XM24=; b=H7AUktakltepEPqjTDeYbm7vhBd7b/8Q7uTypmkvIOQeA5o/oD0cIvaR39Mo1n9dl9 ZxIklOMtOVk4h/UomzNtSOHMHGGSelGrnazBNfHMeAX8yAJ9rzlDfr7IZkYiqWOgMA8d tGH7RfBfH/S9AL2rxluXCseYy6vfTJCbHb09tMLrwRzCRxoTaE3hWWCcqPeOnLq+DGcq aYN8MEDgIDhGaB67J0Y0hTMo9zjWSPOVYW5t79JS0FAKtylvNtnxje+F6Y+//NsSNnON dddC4Vlzz7hswv5rZeIjBSiThVRGQXyga0OW3224BN3ml+wEhJ7/XFMHKPoYIC3x6ztx 6FrA== X-Gm-Message-State: AO0yUKVvoVbuXCc/WIF1JK2LJCUL1OxcffpiDCs5lYAZ1sIgnrwy95AH Dm8Aprgjo4i4pKoRH1wFaV/bU9WH6YKXJrjICnB1fvcqHjaAFtAUhfB2xKI1yz6v5LGx7pUPg9q qQvFJIfLviHVPrQ21G+s8DuzPRC8YSgP0+S0Oz69QNvw1W4zJrux/QmokO9DSr7aRUUD9 X-Received: by 2002:aa7:cf0d:0:b0:4ae:eae1:1109 with SMTP id a13-20020aa7cf0d000000b004aeeae11109mr14247676edy.2.1678237951642; Tue, 07 Mar 2023 17:12:31 -0800 (PST) X-Google-Smtp-Source: AK7set9qzf8RFpW7Ecqw6uszxP8HA7Yiixt2TrtyMvO9F9Ta+rxFdZfMajqBf9x7/c/ZrnGSjrzj3g== X-Received: by 2002:aa7:cf0d:0:b0:4ae:eae1:1109 with SMTP id a13-20020aa7cf0d000000b004aeeae11109mr14247660edy.2.1678237951415; Tue, 07 Mar 2023 17:12:31 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id v5-20020a50d085000000b004af5968cb3bsm7466370edd.17.2023.03.07.17.12.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:30 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:28 -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 33/73] x86: pcihp: fix missing PCNT callchain when intermediate root-port has 'hotplug=off' set Message-ID: <11215a349e39353f272256a72ed0fd4affe5fc78.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Beside BSEL numbers change (due to 2 extra root-ports in q35/miltibridge test), following change is expected: Scope (\_SB.PCI0) { ... + Scope (S50) + { + Scope (S00) + { + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + + Method (PCNT, 0, NotSerialized) + { + ^S00.PCNT + } + } ... Method (PCNT, 0, NotSerialized) { + ^S50.PCNT () ^S13.PCNT () ^S12.PCNT () ^S11.PCNT () I practice [1] hasn't broke anything since on hardware side we unset hotplug_handler on such intermediate port => hotplug behind it has not been properly wired and as result not worked. 1) Fixes: ddab4d3fae4e8 ("pcihp: compose PCNT callchain right before its user _GPE._E01") Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-8-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index b19fb4259e..c691104d47 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -517,16 +517,24 @@ static bool build_append_notfication_callback(Aml *parent_scope, PCIBus *sec; QObject *bsel; int nr_notifiers = 0; + GQueue *pcnt_bus_list = g_queue_new(); QLIST_FOREACH(sec, &bus->child, sibling) { Aml *br_scope = aml_scope("S%.02X", sec->parent_dev->devfn); - if (pci_bus_is_root(sec) || - !object_property_find(OBJECT(sec), ACPI_PCIHP_PROP_BSEL)) { + if (pci_bus_is_root(sec)) { continue; } nr_notifiers = nr_notifiers + build_append_notfication_callback(br_scope, sec); - aml_append(parent_scope, br_scope); + /* + * add new child scope to parent + * and keep track of bus that have PCNT, + * bus list is used later to call children PCNTs from this level PCNT + */ + if (nr_notifiers) { + g_queue_push_tail(pcnt_bus_list, sec); + aml_append(parent_scope, br_scope); + } } /* @@ -550,17 +558,13 @@ static bool build_append_notfication_callback(Aml *parent_scope, } /* Notify about child bus events in any case */ - QLIST_FOREACH(sec, &bus->child, sibling) { - if (pci_bus_is_root(sec) || - !object_property_find(OBJECT(sec), ACPI_PCIHP_PROP_BSEL)) { - continue; - } - + while ((sec = g_queue_pop_head(pcnt_bus_list))) { aml_append(method, aml_name("^S%.02X.PCNT", sec->parent_dev->devfn)); } aml_append(parent_scope, method); qobject_unref(bsel); + g_queue_free(pcnt_bus_list); return !!nr_notifiers; } From patchwork Wed Mar 8 01:12:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=EsH5N+Nl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ8B0dSvz1yWs for ; Wed, 8 Mar 2023 12:13:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMC-0004df-F9; Tue, 07 Mar 2023 20:12: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 1pZiMB-0004Vl-Hq for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:39 -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 1pZiM9-0001fd-RB for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237957; 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=gW+p6KyETzsPQsf4toG486wSUbl2JUTVEY4se5cpAEw=; b=EsH5N+NlEZ3aMKQecuG5UacMVabw/2b70sQKCMwqy63GrM4a/K0kd1QikaN8F+QDn3Ggiz yDp6P/7D7tHDCDFedfLkNGgU0v3X4Ft5e30N64/gCuAjAblC3D2h9kPsQzVZlJx6wP+sMn xxYZygVBeTKBsioJ6c0B8eXmH7mV3GI= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-235-WvdJPXhBNE-rb-Pkye0KMw-1; Tue, 07 Mar 2023 20:12:36 -0500 X-MC-Unique: WvdJPXhBNE-rb-Pkye0KMw-1 Received: by mail-ed1-f69.google.com with SMTP id h15-20020a056402280f00b004bf9e193c23so21674180ede.11 for ; Tue, 07 Mar 2023 17:12:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237954; 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=gW+p6KyETzsPQsf4toG486wSUbl2JUTVEY4se5cpAEw=; b=KqhZX1L18QI1SvcewCMze5SXXFxyGAZ4cl6hBe6pHr60froPlBg2bXuDJ3IQ9r3sm1 pOcc9w0Rq1gH2YhtLagOOoRfU+1nubRnfNtgrvJORsmMA38hFsNBtj9RNc9ZLG/bHj3j yDFyb5qbMOtt9cIiPMwLz+t9bVuWWK+BfeLFUH+ZWnStsvQ8xyHPCyybI+V7PC35L9cx cI25HUjYDOuwwuVN2tzBO/1iguCJCm+pkSoAEOIDguO5QlltlFNjlB1UJabkGWXYOy8U /KUSb3kKtARG6mjrUT2pefIp/t8VbOO5OkUAv7vO53fBxvtP2nevc3gtkK4aaCuVBRC4 zfrg== X-Gm-Message-State: AO0yUKVk/Fc599Kh6OuwN/0ofuiEA6AUhziqgfmz9ZqSVdqewRlEHOph TKLtIk4bJ5Hrim+27TFNci3EV4ycr8AA7u3uwY6LLqIxKHO6clzmQnWMG8FjFhAonrUtE6XfPVp b1c6irYCFuBPF5LuENuTqDd9zjKPkR9ZyvpZ2eE+eqTvsPs1ez7xl0tULRvOWeC41IrSL X-Received: by 2002:a17:907:6e0f:b0:907:672b:736a with SMTP id sd15-20020a1709076e0f00b00907672b736amr19718110ejc.31.1678237954421; Tue, 07 Mar 2023 17:12:34 -0800 (PST) X-Google-Smtp-Source: AK7set8r0MR/Uha7cCQj/qzFfblZw7hKhVnbC+jCJ8ukTdBvx9iIY12JHu7wuO7r2OYHtAFQCswv/A== X-Received: by 2002:a17:907:6e0f:b0:907:672b:736a with SMTP id sd15-20020a1709076e0f00b00907672b736amr19718090ejc.31.1678237954121; Tue, 07 Mar 2023 17:12:34 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id gf7-20020a170906e20700b008cee005346csm6778369ejb.34.2023.03.07.17.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:33 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:31 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 34/73] tests: acpi: whitelist pc/DSDT.hpbrroot and pc/DSDT.hpbridge tests Message-ID: <1c103f35d19601d6ded430d4303be8d3b9ff44bd.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov follow up fix for missing root-port AML will affect these tests by adding non-hotpluggable Device descriptors of colplugged bridges when bridge hotplug is disabled. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-9-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dabc024f53..a0dbb28cde 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1,5 @@ /* List of comma-separated changed AML files to ignore */ "tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/pc/DSDT.hpbridge", +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/q35/DSDT.noacpihp", From patchwork Wed Mar 8 01:12:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753834 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=OmlXcvey; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZKG104bz1yWs for ; Wed, 8 Mar 2023 12:21:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMH-0005T5-DG; Tue, 07 Mar 2023 20:12:45 -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 1pZiMG-0005Gz-80 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiME-0001fz-F1 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237961; 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=kGE0Vk2WtPdgTDKtcdyiScwg+yF9hq4OjdBcilItQG0=; b=OmlXcveyCawPhP6bDwCib0it7AbsHNajXIf3+wkmOCMWL0ePsaYy3sgq1SBtPcwgsfqTVB oDwJOV5gsBx+88CsVgHSm/BxOOQQ6RL5Bi4+GPgsTE1B1rDDTZPcAUP/LcCWzOfy30abpb 0scO1QWVL5M1QLwT6U07uM8y0nXCl0k= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-f8cCBFS7OHm5hHLeOQTwlQ-1; Tue, 07 Mar 2023 20:12:39 -0500 X-MC-Unique: f8cCBFS7OHm5hHLeOQTwlQ-1 Received: by mail-ed1-f72.google.com with SMTP id m8-20020a056402430800b004cdaaa4f428so18678684edc.20 for ; Tue, 07 Mar 2023 17:12:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237958; 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=kGE0Vk2WtPdgTDKtcdyiScwg+yF9hq4OjdBcilItQG0=; b=ybTZgGmkspyzQTmPbxpYELGK8MGKVJyxcqpUhaaGgJlnSzDKM1DGfO1L8Tnumcd/rq REMRBMLq1ohKgOF2J+vdZXFJFpEqvJHiUBrOX7/txFfheB+QRPtAWIX4emgXrnwCvvi0 7BJWtU/15mxEupMq1gPF7M9f2VDOXVznNN8pbTJvQbIogb8QKcyPwnjCnnb0AMmc6IJO xg2Ul8RxHsc6PrbkyIZC3X24ERKizMd2WgNgWprij4wHSkHq++PKlxz4ythPQSp/75E4 VEetsJjIzIaHFfspBy15y+SKAxPCxLzPwfJmb4q3OX7pw8qdu6H+3gfijWrldtEWJMAc 5CZw== X-Gm-Message-State: AO0yUKU9N+Zllz5nSbc4QfO3zXpag2TWrd9d7TjYXSVdGDKmRE1fqnJl u8MMJa28GRdyaQw4r2GuAFeLoDfo77upe3pra9dYs5CkI2I+oI5xNydf4R8FiQqVap0aRVyU/PU JsSdUMEsp0B2zNZC+9HL/RzfbKIQaZ7gwUyqV5AXWJ1ax6+6KYYxURm5aayvTu43yTMFm X-Received: by 2002:a17:906:6c84:b0:8aa:33c4:87d5 with SMTP id s4-20020a1709066c8400b008aa33c487d5mr15250512ejr.10.1678237957846; Tue, 07 Mar 2023 17:12:37 -0800 (PST) X-Google-Smtp-Source: AK7set+HbeG14/mcfQ9ZLZqpOrdhyQarPsEilqhq1QIxkALHm6YLcW3SXLlByHXtv46hlJ8wFux9cQ== X-Received: by 2002:a17:906:6c84:b0:8aa:33c4:87d5 with SMTP id s4-20020a1709066c8400b008aa33c487d5mr15250500ejr.10.1678237957520; Tue, 07 Mar 2023 17:12:37 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id b4-20020a170906038400b008d4df095034sm6759795eja.195.2023.03.07.17.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:37 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:34 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 35/73] x86: pcihp: fix missing bridge AML when intermediate root-port has 'hotplug=off' set Message-ID: <0e84fd3b98feb2bdbfea75b9f7ff7993b2d5300f.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov (I practice [1] hasn't broke anything since on hardware side we unset hotplug_handler on such intermediate port => hotplug behind it has never worked) When deciding if bridge should be described, the original condition was cold_plugged_bridge && pcihp_bridge_en which was replaced [1] by bridge has ACPI_PCIHP_PROP_BSEL the later however is not the same thing as the original and flips to false if intermediate bridge has hotplug turned off (root-port with 'hotplug=off' option). Since we already in build_pci_bridge_aml(), the question if it's bridge is answered. Use DeviceState::hotplugged to make decision if bridge should describe its slots. What's left out is pcihp_bridge_en, which tells us if ACPI bridge hotplug is enabled. With hotplug and non hotplug part now being mostly separated, omitting this check will only lead to colplugged bridges describe occupied slots in case when ACPI bridge hotplug is disabled. Which makes behavior consistent with occupied slots on hostbridge. Ex (pc/DSDT.hpbrroot diff): ... Device (S20) { Name (_ADR, 0x00040000) // _ADR: Address + Device (S08) + { + Name (_ADR, 0x00010000) // _ADR: Address + } + + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + } } ... PS: testing shows that above doesn't affect adversely guest OS behavior: i.e. if ACPI bridge hotplug is enabled it's expected behaviour, and with ACPI bridge hotplug is disabled (a.k. native hotplug), it doesn't break slot enumeration nor native hotplug. (tested with RHEL9.0 and WS2022). 1) Fixes: 6c36ec46b0d ("pcihp: make bridge describe itself using AcpiDevAmlIfClass:build_dev_aml") Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-10-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/pci-bridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/pci-bridge.c b/hw/acpi/pci-bridge.c index 5f3ee5157f..4fbf6da6ad 100644 --- a/hw/acpi/pci-bridge.c +++ b/hw/acpi/pci-bridge.c @@ -21,7 +21,7 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope) { PCIBridge *br = PCI_BRIDGE(adev); - if (object_property_find(OBJECT(&br->sec_bus), ACPI_PCIHP_PROP_BSEL)) { + if (!DEVICE(br)->hotplugged) { build_append_pci_bus_devices(scope, pci_bridge_get_sec_bus(br)); } } From patchwork Wed Mar 8 01:12:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753777 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bCTq1ZgD; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ7L0mVJz1yWm for ; Wed, 8 Mar 2023 12:13:02 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMJ-00065F-Tn; Tue, 07 Mar 2023 20:12: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 1pZiMH-0005al-SW for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiMF-0001gA-SJ for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237963; 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=lzIkUjr/QYt2mzV+mGVZPiVPR9/LNVK8AnObS8YCn8U=; b=bCTq1ZgDy0DaDs42IDv9YdIlUrwkH4G2G2VoTiy2e0V5K2inHIE1w9YOIgKQhtluQPfSYh uQAFlqGXrlsl6YblW0w7Yd6O2GjrxdlPYQeN6Vblnp1aElQimXeTDdwfD92yMlzDGTiHfw ka02w5/L/VITSxqPqW4i9XTJ5F27JEA= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-82-zaqI1yMcPH2N0TT1MqO1EQ-1; Tue, 07 Mar 2023 20:12:42 -0500 X-MC-Unique: zaqI1yMcPH2N0TT1MqO1EQ-1 Received: by mail-ed1-f70.google.com with SMTP id h11-20020a0564020e8b00b004e59d4722a3so11262286eda.6 for ; Tue, 07 Mar 2023 17:12:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237960; 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=lzIkUjr/QYt2mzV+mGVZPiVPR9/LNVK8AnObS8YCn8U=; b=bCuPA8jBE77zCndVKJipLxMDsOCggSgYwPYGMXy57xkumcSNHIOppCVdADrfSuZM0d XM9gUW3gPDw4w6TGunnTIIX3LX27aMYSsSAqF0CRd62IcGkVj7zHv768a7OI7Dsf6ZHm AdkL+YK1fbl+H+qrtEVZGUJTpU1fUEwMP4TshvlAZocbzLV4n+zHy52EhjjWBDPoY3iq NTyQcC2AtYQ6a5fV/mQKPPXwl2MI+zmqGaXhlboAOdeOO/qZpaTnnzustVNw7l7hGpke N2OuF1GpRQZoyJbdvJKnnsaXOqk2tm75ET2OG4gC9/h6KESFwSxnBn7ja6MHB1g67ueS 3nKQ== X-Gm-Message-State: AO0yUKVl42Qu1cVU87WVGJtWdqcOero97HoBhALXZ3eAct1IGhFU29o5 NwNlAMhTqggU7A3k19ulvM95TbyhOubmtzDYY8UHRI2f56QDntk+QgonkzaVHfpkPXVT9Xl9J+t BnXh47X8qYBgVnpRAsHFSwJ4ytNS3yp7VAaArbDreRs63LK7C1azA/h6l0efwk1poIf2o X-Received: by 2002:a17:906:3503:b0:8af:40b0:3dd1 with SMTP id r3-20020a170906350300b008af40b03dd1mr16377778eja.27.1678237960381; Tue, 07 Mar 2023 17:12:40 -0800 (PST) X-Google-Smtp-Source: AK7set9YkKYRkxnqRHMzZXPuDIdxBuD4C2ePvVs9hPBpVXuUkqgWogxLkVEJQHNvhZCqm0FlNbLYxA== X-Received: by 2002:a17:906:3503:b0:8af:40b0:3dd1 with SMTP id r3-20020a170906350300b008af40b03dd1mr16377763eja.27.1678237960157; Tue, 07 Mar 2023 17:12:40 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id g26-20020a17090613da00b008d044ede804sm6662221ejc.163.2023.03.07.17.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:39 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:37 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 36/73] tests: acpi: update expected blobs Message-ID: <30216b3eaf3b5c3c36d90a5c7402a67ed6a5fcb9.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov BNUM numbering changes across DSDT due to addition of new bridges. Fixed missing PCI tree brunch (q35/DSDT.multi-bridge case): // -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off + Device (S50) + { + Name (_ADR, 0x000A0000) // _ADR: Address // -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp + Device (S00) + { + Name (_ADR, Zero) // _ADR: Address + Name (BSEL, Zero) + Device (S00) + { + Name (_ADR, Zero) // _ADR: Address + Name (ASUN, Zero) + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Local0 = Package (0x02) + { + BSEL, + ASUN + } + Return (PDSM (Arg0, Arg1, Arg2, Arg3, Local0)) + } + + Name (_SUN, Zero) // _SUN: Slot User Number + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device + { + PCEJ (BSEL, _SUN) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + } + } Fixed hotplug notification for leaf root port (hotplug=on) attached to intermediate root port (hotplug=off) (q35/DSDT.multi-bridge case) // -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off + Scope (S50) + { // -device pcie-root-port,id=rp3,chassis=9,bus=rpnohp + Scope (S00) + { + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + + Method (PCNT, 0, NotSerialized) + { + ^S00.PCNT () + } + } ... Method (PCNT, 0, NotSerialized) { + ^S50.PCNT () ^S13.PCNT () Populated slots being described on coldplugged bridges even if ACPI bridge hotplug is disabled. (pc/DSDT.hpbridge and pc/DSDT.hpbrroot) ... Device (S18) { Name (_ADR, 0x00030000) // _ADR: Address + Device (S08) + { + Name (_ADR, 0x00010000) // _ADR: Address + } + + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + } } ... Device (S18) { Name (_ADR, 0x00030000) // _ADR: Address + Device (S00) + { + Name (_ADR, Zero) // _ADR: Address + } } Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-11-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- tests/data/acpi/pc/DSDT.hpbridge | Bin 6289 -> 6323 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3115 -> 3166 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12337 -> 12545 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 7932 -> 8022 bytes 5 files changed, 4 deletions(-) diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpbridge index 834c27002edbd3e2298a71c9ff1b501e3a3314f7..5dea100bc9492bb2367aac8660522201785c1efb 100644 GIT binary patch delta 89 zcmbPexY>})CD3^ufg=ZJT73F2X3 bU}lJJ;tw`J2rz;L3=QBam^M$~W#k3`PB0c2 delta 55 zcmdmNIMI;HCDq)j=ZJT73F2X3 LVBWlmmysI)zZnl0 diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/pc/DSDT.hpbrroot index d77752960285a5afa6d0c0a04e400842f6acd2ed..893ab221c2cca1829937a4c26152680313633df4 100644 GIT binary patch delta 121 zcmZ22aZiHFCDM`-bPVoYMYMVcCerGf=3^p=|=ZJT72?DBN iVTf+x4>quX3owEO3=t}rCV%HvRZs{vMyO%O)C2%vb{qNt delta 70 zcmca7v08%5CDmc@#99Wdz@U(DlzfFPVoZX%9}rNerM$44>mH0=ZJT72?DBN SnJmep%FiEcYylTyX8-`NSP<#} diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index 66b39be294a261a6bd991c6bcbd8e2a04a03403f..f2f60fdbb3b44ab9adb69bb36e4a80978536af9b 100644 GIT binary patch delta 312 zcmdm((3r&K66_MfXvo08IAdU1Tle9hQ^ck>8bJ<#fvC_B@4KiCNI<% zpL}1BALs!Pi%nm4@&bLy$u{~Nla=))CdcRtPj=B)5)e=eHZ(wJV+Sgh5OijNSpl>e K#GJfezX$-13sfWk delta 216 zcmZon+L*xQ66_LUXu!b0*uIggQI5;|e@uL^Q@nul|H;$kk{H=07brwdz97#sIb2?T z@@M(D$yem%Cg&?eP4-n#Vq^fyu4H5dk}jL$6qj?Wvxu;{g!zRqaX1CL`fxErdC^V$ z!A2JG9Py4WK|Bl$tPGns=*BS$dWps8f$R!!_B0Ss4K_5Mtg5fb3St>ej?q`;F^m^c z2ypfbVJP5YnyjxcKKZo1EYLE2eTm6B23nJ~4LB!n2C{t&BqzVnmt?a5tDW3$Py_&m C13TgX diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp index f35338db30a44638cc3a55d2870e0e377af4246f..4ea982de2df3cf7cd89cb3b4467a350eaf8f5d29 100644 GIT binary patch delta 213 zcmexkd(Do^CDfA}!Nv$P*nldygAJepKn_qAp`RU1R<}tv*aV@O1FYTz Op`H^({pNYHaf|>-)-eG9 delta 122 zcmca+_s5pYCD X-Patchwork-Id: 1753827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=G0u6goz4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJ34wYvz1yWs for ; Wed, 8 Mar 2023 12:20:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMN-0006T6-3S; Tue, 07 Mar 2023 20:12:51 -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 1pZiML-0006Ml-8U for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiMJ-0001gd-GO for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237966; 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=SephERjw7iPJOmXRt8b/SpRqtuCQhkw927GRfe/TcY4=; b=G0u6goz4vsasN3AsqUxYvAtz/S4cw1uMBm7Jyqhltco1lqdmxGDEFMRO3kUVc6ZYkaMpyV udTYCeiwHTJTV6Fv0PF7HcRBbIihRXYERbqIqDxPEDQQE7U7ZvjK/OjhYeQH48nhOR/0i/ qQAoCna0fZtoXXT1b2eN1yUFCg4Y/7Y= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-gupfG9AWM06EborXIGTm4w-1; Tue, 07 Mar 2023 20:12:45 -0500 X-MC-Unique: gupfG9AWM06EborXIGTm4w-1 Received: by mail-ed1-f69.google.com with SMTP id u10-20020a056402064a00b004c689813557so21166349edx.10 for ; Tue, 07 Mar 2023 17:12:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237963; 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=SephERjw7iPJOmXRt8b/SpRqtuCQhkw927GRfe/TcY4=; b=lM/VDz3YVtN5aP9z02Tvl0RkRlmd5qc+mqOzjQiBya1YA/LENGNvaMUaqEa/K30YSJ 0qVz3sVdykv3j7gOWt1wWH1E61i2zvsnyYBWE3gcypbFq0RfoyKn4ZWdPWDP15kFfceA UOx6LhvvJjapr2n7t35BJ5Q85NZA+8q4VuRnMS1yQLigoNZQKR850FTVaMfdUsEFeFm5 w+RAr1PMJ8ELE3eMIi//fjgJ3uVcDB0eddnwGuQLhyNgch2lmrlMJwn4BQZxXFYMSuQs uMc3v5Ev7uCmlwcTp4qfIck8mwz6yFxiXN3x/rNP/kU7BbPCoOVn3v//oComU+njqt1q TFzw== X-Gm-Message-State: AO0yUKUtMbh9A3rTCnA9nNrEsdLxP5Yht8naQOtbroEdgDsdG7/Y7/nI jqRlDR2ABc0RZH+vkVMdLEITq5FQJtjaXabibTQ45sQAKaOCLY4QpE6Kf0uS9hBq4fEgsdP7OCK TMn/5OGREUfiqbch5rDl9va40tbE9Z0wI8w8DHQrCJXmcWMNN2iXU55c2lg4U2wIcS2J/ X-Received: by 2002:a17:906:66d8:b0:872:b17a:9b59 with SMTP id k24-20020a17090666d800b00872b17a9b59mr16182066ejp.38.1678237963372; Tue, 07 Mar 2023 17:12:43 -0800 (PST) X-Google-Smtp-Source: AK7set/bYBqRfSLJdrM7wI4B5rg6EB99+A0jE60xTbboSTZ6k33MU3fsKmW93QnbjBRDHeRni+jHbg== X-Received: by 2002:a17:906:66d8:b0:872:b17a:9b59 with SMTP id k24-20020a17090666d800b00872b17a9b59mr16182051ejp.38.1678237963108; Tue, 07 Mar 2023 17:12:43 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id r25-20020a1709067fd900b008e125ee7be4sm6816227ejs.176.2023.03.07.17.12.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:42 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:40 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Aurelien Jarno , Marcel Apfelbaum Subject: [PULL 37/73] pcihp: piix4: do not redirect hotplug controller to piix4 when ACPI hotplug is disabled 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov commit [1] added ability to disable ACPI PCI hotplug on hostbridge but forgot to take into account that it should disable all ACPI hotplug machinery in case both hostbridge and bridge hotplug are disabled. Commit [2] tried to fix that, however it forgot to remove hotplug_handler override which hands hotplug control over to piix4 hotplug controller (uninitialized after [2]). As result at the time bridge is plugged in, its default (SHPC) hotplug handler is replaced by piix4 one in acpi_pcihp_device_plug_cb() ... if (!s->legacy_piix && ... qbus_set_hotplug_handler(BUS(sec), OBJECT(hotplug_dev)); which is acting on uninitialized s->legacy_piix value (0 by default) that was supposed to be initialized by acpi_pcihp_init(), that is no longer called due to following condition being false: piix4_acpi_system_hot_add_init() if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { and the bridge ends up with piix4 as hotplug handler instead of shpc one. Followup hotplug on that bridge as result yields piix4 specific error: Error: Unsupported bus. Bus doesn't have property 'acpi-pcihp-bsel' set 1) 3d7e78aa777 (Introduce a new flag for i440fx to disable PCI hotplug on the root bus) 2) df4008c9c59 (piix4: don't reserve hw resources when hotplug is off globally) Fixes: df4008c9c59 (piix4: don't reserve hw resources when hotplug is off globally) Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-12-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/piix4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index eac2125abd..8fc422829a 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -492,7 +492,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp) piix4_acpi_system_hot_add_init(pci_address_space_io(dev), pci_get_bus(dev), s); - qbus_set_hotplug_handler(BUS(pci_get_bus(dev)), OBJECT(s)); piix4_pm_add_properties(s); } @@ -564,6 +563,7 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent, s->use_acpi_hotplug_bridge, ACPI_PCIHP_ADDR_PIIX4); + qbus_set_hotplug_handler(BUS(pci_get_bus(PCI_DEVICE(s))), OBJECT(s)); } s->cpu_hotplug_legacy = true; From patchwork Wed Mar 8 01:12:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753812 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KX3akl/9; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDs13BVz1yWr for ; Wed, 8 Mar 2023 12:17:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMP-0006ki-Q9; Tue, 07 Mar 2023 20:12:53 -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 1pZiMN-0006ZC-MU for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:52 -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 1pZiML-0001h0-UK for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237969; 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=PlWCxBVoNHan2SX2kTcXYxvUjOFyDeTDnartL4mlgHo=; b=KX3akl/9itOLFE/L6jeo241Wcc7cQA9fVTl2TwYSbPLmuKH/tJF5a+6ZW77nxteAs2bNCa Tv23VjGMB8ZhMY31X8cTzAc+nSFb1v+vbdNbRP1sZfvfhrs5MkSKGf9wFmGlOBDfmCbPKU TFK+t0AROsj8I4dAZJfrA5BnuWZMn9c= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-573-U3dNjJORNN2fSFCse5cIzQ-1; Tue, 07 Mar 2023 20:12:48 -0500 X-MC-Unique: U3dNjJORNN2fSFCse5cIzQ-1 Received: by mail-ed1-f69.google.com with SMTP id h15-20020a056402280f00b004bf9e193c23so21674763ede.11 for ; Tue, 07 Mar 2023 17:12:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237966; 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=PlWCxBVoNHan2SX2kTcXYxvUjOFyDeTDnartL4mlgHo=; b=QgumIlJsEzcLdG6V05KUnxN6HjG5y/eGm1+SQIlBr2C9bo7Ick6PBhb619JwEpqCFS GEBof3tnBQOzRf9aceYo4/9WK5Vbw8U9rvPTWfrUohxbBnHeChrJWUgUT/xiE4RYAbsA xdjgJSSoNLE/JcnzEmi/0MqtSlilwts/cyUqMLfMOOlPdwF8S0x+0KhNkwhDCmSr6n1U eywMSZanAvjnovDYbO/M2YXFHzhXWHN/TYlMWQk6vMr7slJhrGVft53cY8puBSNmz+le 6au22OfgLna5KCzR+Qh4wXqeSRp6tXqHoSElWDuCnfEQI3whURIByjHS/trHxH1qFLdY lQCQ== X-Gm-Message-State: AO0yUKWDcX+v0AbE/BYZOg9tF9gHnDYYR6qJPE+iiznhKRb5sbtokODq 9oN7SCZmsBbyrhTcbYc0crgXTs7N/1/3xwjvHgqNmmV4+k5Apu/50ntEAyQbu0QTCRCXIcce7Za H0WXcZdUZ+VWisvqbrDgK5iFcl2496gngGCtucPxpqDcNOEBSZ0Py3HAGpz1PftqH0nwQ X-Received: by 2002:a17:906:398a:b0:88d:d700:fe15 with SMTP id h10-20020a170906398a00b0088dd700fe15mr17185794eje.0.1678237966570; Tue, 07 Mar 2023 17:12:46 -0800 (PST) X-Google-Smtp-Source: AK7set/CH/d/L+jYdGYP17viXUEFkNE5kBE5acnIQEE3+qopU9eT89gkmuw8lvV6YYYFVM9dIovbKA== X-Received: by 2002:a17:906:398a:b0:88d:d700:fe15 with SMTP id h10-20020a170906398a00b0088dd700fe15mr17185781eje.0.1678237966322; Tue, 07 Mar 2023 17:12:46 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d26-20020a50f69a000000b004c0239e41d8sm7401286edn.81.2023.03.07.17.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:45 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:43 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Marcel Apfelbaum , Paolo Bonzini , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Eduardo Habkost Subject: [PULL 38/73] pci: fix 'hotplugglable' property behavior 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Currently the property may flip its state during VM bring up or just doesn't work as the name implies. In particular with PCIE root port that has 'hotplug={on|off}' property, and when it's turned off, one would expect 'hotpluggable' == false for any devices attached to it. Which is not the case since qbus_is_hotpluggable() used by the property just checks for presence of any hotplug_handler set on bus. The problem is that name BusState::hotplug_handler from its inception is misnomer, as it handles not only hotplug but also in many cases coldplug as well (i.e. generic wiring interface), and it's fine to have hotplug_handler set on bus while it doesn't support hotplug (ex. pcie-slot with hotplug=off). Another case of root port flipping 'hotpluggable' state when ACPI PCI hotplug is enabled in this case root port with 'hotplug=off' starts as hotpluggable and then later on, pcihp hotplug_handler clears hotplug_handler explicitly after checking root port's 'hotplug' property. So root-port hotpluggablity check sort of works if pcihp is enabled but is broken if pcihp is disabled. One way to deal with the issue is to ask hotplug_handler if bus it controls is hotpluggable or not. To do that add is_hotpluggable_bus() hook to HotplugHandler interface and use it in 'hotpluggable' property + teach pcie-slot to actually look into 'hotplug' property state before deciding if bus is hotpluggable. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-13-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/hotplug.h | 2 ++ include/hw/qdev-core.h | 13 ++++++++++++- hw/pci/pcie_port.c | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h index e15f59c8b3..a9840ed485 100644 --- a/include/hw/hotplug.h +++ b/include/hw/hotplug.h @@ -48,6 +48,7 @@ typedef void (*hotplug_fn)(HotplugHandler *plug_handler, * @unplug: unplug callback. * Used for device removal with devices that implement * asynchronous and synchronous (surprise) removal. + * @is_hotpluggable_bus: called to check if bus/its parent allow hotplug on bus */ struct HotplugHandlerClass { /* */ @@ -58,6 +59,7 @@ struct HotplugHandlerClass { hotplug_fn plug; hotplug_fn unplug_request; hotplug_fn unplug; + bool (*is_hotpluggable_bus)(HotplugHandler *plug_handler, BusState *bus); }; /** diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index f5b3b2f89a..bd50ad5ee1 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -812,7 +812,18 @@ void qbus_set_bus_hotplug_handler(BusState *bus); static inline bool qbus_is_hotpluggable(BusState *bus) { - return bus->hotplug_handler; + HotplugHandler *plug_handler = bus->hotplug_handler; + bool ret = !!plug_handler; + + if (plug_handler) { + HotplugHandlerClass *hdc; + + hdc = HOTPLUG_HANDLER_GET_CLASS(plug_handler); + if (hdc->is_hotpluggable_bus) { + ret = hdc->is_hotpluggable_bus(plug_handler, bus); + } + } + return ret; } /** diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c index 65a397ad23..000633fec1 100644 --- a/hw/pci/pcie_port.c +++ b/hw/pci/pcie_port.c @@ -161,6 +161,13 @@ PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn) return NULL; } +static bool pcie_slot_is_hotpluggbale_bus(HotplugHandler *plug_handler, + BusState *bus) +{ + PCIESlot *s = PCIE_SLOT(bus->parent); + return s->hotplug; +} + static const TypeInfo pcie_port_type_info = { .name = TYPE_PCIE_PORT, .parent = TYPE_PCI_BRIDGE, @@ -188,6 +195,7 @@ static void pcie_slot_class_init(ObjectClass *oc, void *data) hc->plug = pcie_cap_slot_plug_cb; hc->unplug = pcie_cap_slot_unplug_cb; hc->unplug_request = pcie_cap_slot_unplug_request_cb; + hc->is_hotpluggable_bus = pcie_slot_is_hotpluggbale_bus; } static const TypeInfo pcie_slot_type_info = { From patchwork Wed Mar 8 01:12:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=S0WBTiVn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDx21Bxz1yWs for ; Wed, 8 Mar 2023 12:17:53 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMX-0007SC-3u; Tue, 07 Mar 2023 20:13: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 1pZiMU-0007Eq-Ey for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:58 -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 1pZiMS-0001hN-L4 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237975; 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=fBOKE0cyKeoFLUCat4Ux/9uXF2e8CfWnWBPumDi1QW0=; b=S0WBTiVngCPumCtH+HGV0HNY2D6wxz9RL1VjOt3E5ZljbG8JKIc/JBXoRtyqfwh4DYYv50 RDhPoEpRtM3CN3lREmWDA7CEp0iFg1CWvy/TYVXVZmPDzG74CqpzlPxLBrys8E5Ra4mbXC kG4+PvoIGfl1bw9MzKhD0PO4b24DSmE= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-2OrRgSVwM-aLcMeppOJ1qQ-1; Tue, 07 Mar 2023 20:12:54 -0500 X-MC-Unique: 2OrRgSVwM-aLcMeppOJ1qQ-1 Received: by mail-ed1-f72.google.com with SMTP id dn8-20020a05640222e800b004bd35dd76a9so21591149edb.13 for ; Tue, 07 Mar 2023 17:12:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237969; 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=fBOKE0cyKeoFLUCat4Ux/9uXF2e8CfWnWBPumDi1QW0=; b=Bqhon6sr3ZHSxVlmMKhdBkogmHZQIpTWQnE5E8gz3nDIGPrk2hdkmdwWUYOlm6CLxA qttPYmrbDz+DCJckK1/sQic9ZtQPtVa9yjghpWuhexHQ0aXQIGBdkZOJbQvefHeVZeBQ izDaA3VJ8nfCcZDTtMWHMScaJhSdd9RWJ5tchOK8SRDbccAyg7lxLVySd1Y0IcVtLYC5 /sSBkyVxSQBRhGHWjqkA08a/E+6VNhDM3aTy9ZFSmI70eDoVhqxmQBxRsix2L/fbqR3B hnaSHK016a9a0j/76Gjw70TgG5vah/+hgu5w/oAT0RXXbiYv9hSJqdYM0ARsA8+UB2yD g1gQ== X-Gm-Message-State: AO0yUKVIG2kqxaBZ6GhEZM8aWmKv/rsfb+b86BT2NFLT0YxJuPnTl3uL 0xTxsRIkvuxYXg+XAh1LX4KctX+0eqWej+f5xP3FkWYsh48xvMAJCeImhR8IBovNqzuS8+7j+f4 qZYJ+hQQaekTmDLemH9ntTv7qUzQa1qJ1zi5BOvhb1DsX+b7naZ2TA6qB7Qc1qgO9AO/S X-Received: by 2002:a17:907:98a3:b0:88a:1ea9:a5ea with SMTP id ju3-20020a17090798a300b0088a1ea9a5eamr16381451ejc.65.1678237969375; Tue, 07 Mar 2023 17:12:49 -0800 (PST) X-Google-Smtp-Source: AK7set/3g5eov8WEfQWyJVqOA2REqhGYL8Yi00FAtuBP5D8wCndj/zwEEWBlUcxw9o7RLnUHPqOpLQ== X-Received: by 2002:a17:907:98a3:b0:88a:1ea9:a5ea with SMTP id ju3-20020a17090798a300b0088a1ea9a5eamr16381441ejc.65.1678237969087; Tue, 07 Mar 2023 17:12:49 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id bi23-20020a170906a25700b008d356cafaedsm6739807ejb.40.2023.03.07.17.12.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:48 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:46 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 39/73] tests: acpi: whitelist DSDT blobs before isolating PCI _DSM func 0 prolog 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-14-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..7e7745db39 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,36 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.acpierst", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.hpbridge", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.nohpet", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/pc/DSDT.roothp", +"tests/data/acpi/q35/DSDT", +"tests/data/acpi/q35/DSDT.acpierst", +"tests/data/acpi/q35/DSDT.acpihmat", +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator", +"tests/data/acpi/q35/DSDT.applesmc", +"tests/data/acpi/q35/DSDT.bridge", +"tests/data/acpi/q35/DSDT.core-count2", +"tests/data/acpi/q35/DSDT.cphp", +"tests/data/acpi/q35/DSDT.cxl", +"tests/data/acpi/q35/DSDT.dimmpxm", +"tests/data/acpi/q35/DSDT.ipmibt", +"tests/data/acpi/q35/DSDT.ipmismbus", +"tests/data/acpi/q35/DSDT.ivrs", +"tests/data/acpi/q35/DSDT.memhp", +"tests/data/acpi/q35/DSDT.mmio64", +"tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/q35/DSDT.nohpet", +"tests/data/acpi/q35/DSDT.numamem", +"tests/data/acpi/q35/DSDT.pvpanic-isa", +"tests/data/acpi/q35/DSDT.tis.tpm12", +"tests/data/acpi/q35/DSDT.tis.tpm2", +"tests/data/acpi/q35/DSDT.viot", +"tests/data/acpi/q35/DSDT.xapic", From patchwork Wed Mar 8 01:12:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753795 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HRGxqGkK; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBF1Tnpz1yWr for ; Wed, 8 Mar 2023 12:15:33 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMV-0007Ih-2S; Tue, 07 Mar 2023 20:12:59 -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 1pZiMT-0007A6-PW for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12: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 1pZiMR-0001hJ-Ut for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:12:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237975; 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=mXazmb8yGfIFutAyjxdmizsN731JFjREXW9aEnmsoIQ=; b=HRGxqGkKAhWKCAg0DIak0t5JRMUXIG6+rSqNT1jToLQwlQqSaJFRqrSGP4t3oTislB1+3Y e0UFuABBc4wCXuWrsyDn9LjREwYPAxaGbThI7erWX/M8F9YLNn2LeJHtoJeqgTlZIkfn7y njc+X6+A1VqD9J6nA1mJzhxeo4oBIkc= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-YB-1JxJ7O7G87s9jhQoAxg-1; Tue, 07 Mar 2023 20:12:54 -0500 X-MC-Unique: YB-1JxJ7O7G87s9jhQoAxg-1 Received: by mail-ed1-f72.google.com with SMTP id b1-20020aa7dc01000000b004ad062fee5eso21183715edu.17 for ; Tue, 07 Mar 2023 17:12:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237972; 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=mXazmb8yGfIFutAyjxdmizsN731JFjREXW9aEnmsoIQ=; b=scXyQdWRAmn3apWzxZMlif2KI5ubgny7Y8jxpj2gEnWtUUJdagh6UoYHP0UNQhu4gP UUhcPWN0Jy/OYxtCcFmp6whVGkYwiM/uwVOCgrASNrG7rrwdlxSj6ppmE3Bdz53p9l8+ HZLsSn2Khklzjtl1569/RPvLBUvRPBYbNV+jbDDBPvfd1pdCvZrnQLTOEuj9tVYOhqFh eFceko4sJV/UwUNrMvKMbK9lPd3Gs94JJIzFBhE+mZe2FN5MqkIdGF9+9P+JYlHIS5Iz lVmGmOXbY8pTsMpkUP1XAg6UT6dVXnHX03mdlm3MWIjyxMapvsbkh10XPmc3LhkrJlNS YQtQ== X-Gm-Message-State: AO0yUKVZy8tshOMDHoRcj730eUBWTA89I9Y8XD9IweYRoot9U23tlEXT Z8hngAMpQ4nalw1lvHA4GxdnJuyDHJ2tdUP4RnfCMitBbuOcYHA5L7IMcuHHqMiE7eTNWOELAdh +8uGHRi1G/N53Y2BxOa2RZ7dUeWs1sfPN28CFBNTgJ4QBlfHNekeNoFdGRlDtSDbs7qRl X-Received: by 2002:a17:907:c24c:b0:8b1:293a:ef21 with SMTP id tj12-20020a170907c24c00b008b1293aef21mr16356265ejc.64.1678237972633; Tue, 07 Mar 2023 17:12:52 -0800 (PST) X-Google-Smtp-Source: AK7set9jlAueE+OQvY9zVleU1xkFxoX+b7++UekU3pQ+1ZyN7jlut7UGsFw3kd4LYVfzEiDBwnYKpg== X-Received: by 2002:a17:907:c24c:b0:8b1:293a:ef21 with SMTP id tj12-20020a170907c24c00b008b1293aef21mr16356244ejc.64.1678237972375; Tue, 07 Mar 2023 17:12:52 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d25-20020a1709064c5900b008b17de96f00sm6778740ejw.151.2023.03.07.17.12.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:51 -0800 (PST) Date: Tue, 7 Mar 2023 20:12: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 40/73] pcihp: move PCI _DSM function 0 prolog into separate function Message-ID: <0a4584fca3b255fb75437d8b95491533512ed515.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov it will be reused by follow up patches that will implement static _DSM for non-hotpluggable devices. no functional AML change, only context one, where 'cap' (Local1) initialization is moved after UUID/revision checks. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-15-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 54 ++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index c691104d47..d8ec91b8e3 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -373,6 +373,33 @@ Aml *aml_pci_device_dsm(void) return method; } +static void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar) +{ + Aml *UUID, *ifctx1; + uint8_t byte_list[1] = { 0 }; /* nothing supported yet */ + + aml_append(ctx, aml_store(aml_buffer(1, byte_list), retvar)); + /* + * PCI Firmware Specification 3.1 + * 4.6. _DSM Definitions for PCI + */ + UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D"); + ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(0), UUID))); + { + /* call is for unsupported UUID, bail out */ + aml_append(ifctx1, aml_return(retvar)); + } + aml_append(ctx, ifctx1); + + ifctx1 = aml_if(aml_lless(aml_arg(1), aml_int(2))); + { + /* call is for unsupported REV, bail out */ + aml_append(ifctx1, aml_return(retvar)); + } + aml_append(ctx, ifctx1); +} + + static void build_append_pcihp_notify_entry(Aml *method, int slot) { Aml *if_ctx; @@ -570,14 +597,13 @@ static bool build_append_notfication_callback(Aml *parent_scope, static Aml *aml_pci_pdsm(void) { - Aml *method, *UUID, *ifctx, *ifctx1; + Aml *method, *ifctx, *ifctx1; Aml *ret = aml_local(0); Aml *caps = aml_local(1); Aml *acpi_index = aml_local(2); Aml *zero = aml_int(0); Aml *one = aml_int(1); Aml *func = aml_arg(2); - Aml *rev = aml_arg(1); Aml *params = aml_arg(4); Aml *bnum = aml_derefof(aml_index(params, aml_int(0))); Aml *sunum = aml_derefof(aml_index(params, aml_int(1))); @@ -587,29 +613,9 @@ static Aml *aml_pci_pdsm(void) /* get supported functions */ ifctx = aml_if(aml_equal(func, zero)); { - uint8_t byte_list[1] = { 0 }; /* nothing supported yet */ - aml_append(ifctx, aml_store(aml_buffer(1, byte_list), ret)); + build_append_pci_dsm_func0_common(ifctx, ret); + aml_append(ifctx, aml_store(zero, caps)); - - /* - * PCI Firmware Specification 3.1 - * 4.6. _DSM Definitions for PCI - */ - UUID = aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D"); - ifctx1 = aml_if(aml_lnot(aml_equal(aml_arg(0), UUID))); - { - /* call is for unsupported UUID, bail out */ - aml_append(ifctx1, aml_return(ret)); - } - aml_append(ifctx, ifctx1); - - ifctx1 = aml_if(aml_lless(rev, aml_int(2))); - { - /* call is for unsupported REV, bail out */ - aml_append(ifctx1, aml_return(ret)); - } - aml_append(ifctx, ifctx1); - aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_index)); /* From patchwork Wed Mar 8 01:12:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753790 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cKri7Mve; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ8z75l9z1yWm for ; Wed, 8 Mar 2023 12:14:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMZ-0007ha-W1; Tue, 07 Mar 2023 20:13: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 1pZiMY-0007cs-Qe for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:02 -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 1pZiMW-0001hp-51 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237979; 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=9Uy1PNvm0L6zv1wjmYXGCzc+Fi5qiD8YTgX/76C7wVg=; b=cKri7Mvexh/5SCCYbxWH/3M33mXj+j0TfcXO6OeVT4YXS7iWXfxfAUjo2mzEJPPZsbm+CX tRocv4xoI2tK0WxdcYJ/FdrTBNyVaERHMNM51O0OMASnanJsT+xtlh7gsC03+6AKcdk1e0 jzrmgTVBkRL0XL3mSZwVN8yRUdtgvuM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-70-8zaV1DBTNd-qw6iR_6jLvA-1; Tue, 07 Mar 2023 20:12:58 -0500 X-MC-Unique: 8zaV1DBTNd-qw6iR_6jLvA-1 Received: by mail-ed1-f69.google.com with SMTP id b7-20020a056402350700b004d2a3d5cd3fso16150320edd.8 for ; Tue, 07 Mar 2023 17:12:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237976; 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=9Uy1PNvm0L6zv1wjmYXGCzc+Fi5qiD8YTgX/76C7wVg=; b=5nEGbL4cd2Yr5D6an8Fdt113ysvk3hn/fVogRDmU2tPbHYVC2ZW5UjcxYQvb99HrB/ rURPlKKoB0yMrUJdrn0pdulG/ku3p5GL/OlKLX0Od8aj44GKVvbzMgPfkl/r+k0plGrb xsKHUWbSiOaULt7g6bIPXmD1pHqQgxGZf5g/CJAGW3rhtNe4nwTPncoc0Yjw80IeSiqD F0ECCqMXFu43+V6ZpNd2Jv4OPZKXobnRYeAdgq1RLv11FyKmV4h543tMN2glp1w6DPMs OazrUSUA1ZpkOPbDebQGEYev66jbWoZ0QwQWzvwWXg2us1aOF+7+VIigJFM3T9+T/NH4 X2zw== X-Gm-Message-State: AO0yUKVl9YWq0WorzrEzoK41rsiXYuOD1Amtmh7guzkXp1ub0LEHMS1/ jj8su9oaPmEqsnfEK9qvyroBOO/CX9yPRXpAWi+ZCoVMja3AMyIqWL5xnQBp4xQxr4geCIraiOK 4h7WkPHaL5Z2rg5bKQjZ4pll0TRXt/+UXEx34rebcnK3CD3yPGqPTX7SuqMvLfzgZLUns X-Received: by 2002:a17:906:6dd8:b0:87f:546d:7cb5 with SMTP id j24-20020a1709066dd800b0087f546d7cb5mr14812486ejt.37.1678237976137; Tue, 07 Mar 2023 17:12:56 -0800 (PST) X-Google-Smtp-Source: AK7set+YJkqPzIXSAFi9iCofzYpJzw3OWeErlDL4DyRAy+xAG0RKXJCXH9+/POMhxxUvVDiYA9ZCYQ== X-Received: by 2002:a17:906:6dd8:b0:87f:546d:7cb5 with SMTP id j24-20020a1709066dd800b0087f546d7cb5mr14812465ejt.37.1678237975703; Tue, 07 Mar 2023 17:12:55 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 20-20020a508e54000000b004d8d2735251sm5453951edx.43.2023.03.07.17.12.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:55 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:52 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 41/73] tests: acpi: update 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov only following context change: - Local1 = Zero If ((Arg0 != ToUUID ("e5c937d0-3553-4d7a-9117-ea4d19c3434d") /* Device Labeling Interface */)) { Return (Local0) ... Return (Local0) } + Local1 = Zero Local2 = AIDX (DerefOf (Arg4 [Zero]), DerefOf (Arg4 [One] Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-16-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 35 ------------------ tests/data/acpi/pc/DSDT | Bin 6360 -> 6360 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6283 -> 6283 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7685 -> 7685 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12487 -> 12487 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6824 -> 6824 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8014 -> 8014 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6323 -> 6323 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6432 -> 6432 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7719 -> 7719 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6218 -> 6218 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6366 -> 6366 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9745 -> 9745 bytes tests/data/acpi/q35/DSDT | Bin 8252 -> 8252 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8269 -> 8269 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9577 -> 9577 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8531 -> 8531 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8298 -> 8298 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11481 -> 11481 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32392 -> 32392 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8716 -> 8716 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9564 -> 9564 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9906 -> 9906 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8327 -> 8327 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8340 -> 8340 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8269 -> 8269 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9611 -> 9611 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9382 -> 9382 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12545 -> 12545 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8110 -> 8110 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8258 -> 8258 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8353 -> 8353 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8858 -> 8858 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8884 -> 8884 bytes tests/data/acpi/q35/DSDT.viot | Bin 9361 -> 9361 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35615 -> 35615 bytes 36 files changed, 35 deletions(-) diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index 0b475fb5a966543fef2cd7672a0b198838a63151..ec133a6d3aabcfd22b7b46019338db2de255da70 100644 GIT binary patch delta 19 acmca%c*Af*JmcgfMinN8#LcaY!Quc(l?Foq delta 20 bcmca%c*Af*JR@@fL*nFkMwQKNj6vc6P%j3t diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/pc/DSDT.acpierst index 17ef7caeb6fe4445f1234ff060c3db6809184ef6..2b4b7f31919f360e038e37de713639da753f13aa 100644 GIT binary patch delta 19 acmeA+>^9sG&p0`WQH6;iadRspn>YYICk0#p delta 20 bcmeA+>^9sG&&XWBkT^M>QDt)*Bda(7L?;Ex diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/pc/DSDT.acpihmat index 675b674eaa92d99513ac243a97064d369791ee53..714a123e7a500cf0f862ff6c4e9a3f50a96af056 100644 GIT binary patch delta 19 acmZp*X|>r9&p0`WQH6;iadRtUgA4#az6Ip~ delta 20 bcmZp*X|>r9&&XWBkT^M>QDt)*W4#OjMaTwI diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge index c1ce06136619f55c084a34c51997c059c29cb06a..6c0543cf75ad3e02468ed4925fd3369a183e9b45 100644 GIT binary patch delta 19 acmX?}csy}KJmcgfMinN8#LcaYPWk{%hX#lM delta 20 bcmX?}csy}KJR@@fL*nFkMwQKNjE?#MR9^=6 diff --git a/tests/data/acpi/pc/DSDT.cphp b/tests/data/acpi/pc/DSDT.cphp index 754ab854dc48fc1af2d335e7269c23a056e66eb8..e1bcb0a4f3ee1269bdd5e949206b40d0e3c076e6 100644 GIT binary patch delta 19 acmZ2sy25lrJmcgfMinN8#LcaY%8~#={{_7O delta 20 bcmZ2sy25lrJR@@fL*nFkMwQKNj7pLKNkIlH diff --git a/tests/data/acpi/pc/DSDT.dimmpxm b/tests/data/acpi/pc/DSDT.dimmpxm index 170503336b3fd94cc7a4356003fa080f0ef57b01..1c90e119c5d3dc7e86d04942114e5cfe40de6039 100644 GIT binary patch delta 19 acmX?Scg}7@JmcgfMinN8#LcaYCuIRj*#^Y` delta 20 bcmX?Scg}7@JR@@fL*nFkMwQKNj3;CPQF#Y5 diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpbridge index 5dea100bc9492bb2367aac8660522201785c1efb..04e1c20f63be7c6c574e72590332707ca410852a 100644 GIT binary patch delta 19 acmdmNxY=++JmcgfMinN8#LcaYdg1^?7X{P+ delta 20 bcmdmNxY=++JR@@fL*nFkMwQKNjJo0gN@oT_ diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmikcs index dd7135602709fc4a361930c74f9bebc6b32e6916..3c2aba132f10b5e4a9931877533a9d8f260b7381 100644 GIT binary patch delta 19 acmZ2rw7_UXJmcgfMinN8#LcaYv&8{IX9gVr delta 20 bcmZ2rw7_UXJR@@fL*nFkMwQKNjI+c6NRtMO diff --git a/tests/data/acpi/pc/DSDT.memhp b/tests/data/acpi/pc/DSDT.memhp index 2f895e9b385c1ae2f58c7ade4de02328b1be7356..811965f42d97adadde6e9ec6d6153e767041bc6d 100644 GIT binary patch delta 19 acmZ2(v)pDwJmcgfMinN8#LcaYi(~*q$_7gS delta 20 bcmZ2(v)pDwJR@@fL*nFkMwQKNj0Z diff --git a/tests/data/acpi/pc/DSDT.nohpet b/tests/data/acpi/pc/DSDT.nohpet index c012b63ace2f359eec0368ed22ef507ee3905c78..bbf73023ade329770ff9f9ac5c897218764182b5 100644 GIT binary patch delta 19 acmX?QaLQmqJmcgfMinN8#LcaYN5ue0UIvx` delta 20 bcmX?QaLQmqJR@@fL*nFkMwQKNj7P)(PTB_q diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numamem index f2ef4b97290cc58c514c3ce7fd45cb08214d7138..c5d93366a417ad1a92c01659f1db9c159caa7132 100644 GIT binary patch delta 19 acmca-c+YS{JmcgfMinN8#LcaYk>UVKc?MMg delta 20 bcmca-c+YS{JR@@fL*nFkMwQKNj1l4hQ6C1w diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp index 657c8263f0c649abc806a67576fd74cb32af60c3..9e3d482366bd800cf987044801eebc814629b15b 100644 GIT binary patch delta 19 acmbQ}Gtp;5JmcgfMinN8#LcaYJt_c0t_Cpx delta 20 bcmbQ}Gtp;5JR@@fL*nFkMwQKNjNK{#N$>`r diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index d68c472b460e4609a64ea67de3c4cebfca76164d..c304e15e366d7317fd0e9db0a144f02e0437d7a1 100644 GIT binary patch delta 19 acmdnvu*YG864PW=CKV=z#LXT|Ut|G790nW! delta 20 bcmdnvu*YG85)*R)L*is5CY8;eOrK=|NfZW( diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.acpierst index de7ae27125f9667d7aa7a7cc0e8210773b61a2e2..3aa5c4b3193d32bb8263a1fe06c05b714541c532 100644 GIT binary patch delta 19 acmX@>aModi64PW=CKV=z#LXT|ta1QCqXkd^ delta 20 bcmX@>aModi5)*R)L*is5CY8;eOe}H$NxcQW diff --git a/tests/data/acpi/q35/DSDT.acpihmat b/tests/data/acpi/q35/DSDT.acpihmat index 48e2862257ac614b5fd6391c4ec425106c48afb1..3ffbf8f83f64144ace17ff5f06bcb4fec9df33d9 100644 GIT binary patch delta 19 acmaFq_0nsD64PW=CKV=z#LXT|ipl^;Bn764PW=CKV=z#LXT|N^$^3@dc*< delta 20 bcmaFm@XBF>5)*R)L*is5CY8;eOp0;Ukaf1@mWK|{=CWge#9!w5309TO)+W-In delta 22 dcmeD9%h>Ukaf1>Qa{)u*WF;n*&7Ms5H2`0o2T1?` diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp index beeb83c33b385fc8b41d44f299b8d9ba7203d935..725998cb587c02ac963f290bac5c14d665bc85e9 100644 GIT binary patch delta 19 acmeBi>2cYh#57rzNrj0aakB^05qSVRh6R=Y delta 20 bcmeBi>2cYh#Kc^{kT_Y1NoBJq(_wi4LM8?T diff --git a/tests/data/acpi/q35/DSDT.cxl b/tests/data/acpi/q35/DSDT.cxl index 4586b9a18b24acd946cd32c7e3e3a70891a246d2..d87736dccf18631bbaf0a4505d0f5d83d7501a15 100644 GIT binary patch delta 19 acmccPb;oOi64PW=CKV=z#LXT|BFX?pHU*Xd delta 20 bcmccPb;oOi5)*R)L*is5CY8;eOv1_lO@aml diff --git a/tests/data/acpi/q35/DSDT.dimmpxm b/tests/data/acpi/q35/DSDT.dimmpxm index 99a93e12a7faac78e9524ad6758f42c5c0df18eb..ef643b4ee02cacb9a55f89b8e7f05524125515a1 100644 GIT binary patch delta 19 acmdnwyUBNh64PW=CKV=z#LXT|St;64PW=CKV=z#LXT|K5_s%PX#9c delta 20 bcmbQ@IK^>;5)*R)L*is5CY8;eOx|(;LHPxh diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs index de7ae27125f9667d7aa7a7cc0e8210773b61a2e2..3aa5c4b3193d32bb8263a1fe06c05b714541c532 100644 GIT binary patch delta 19 acmX@>aModi64PW=CKV=z#LXT|ta1QCqXkd^ delta 20 bcmX@>aModi5)*R)L*is5CY8;eOe}H$NxcQW diff --git a/tests/data/acpi/q35/DSDT.memhp b/tests/data/acpi/q35/DSDT.memhp index 79bce5c8f0132e72b8e700488ea56c7593737810..9709e5a7a7edcb7509954b553f7bf29a424033db 100644 GIT binary patch delta 19 acmeD7?)KiG#57rzNrj0aakB@LvoZiXQUxUd delta 20 bcmeD7?)KiG#Kc^{kT_Y1NoBJqlan$4LH-4k diff --git a/tests/data/acpi/q35/DSDT.mmio64 b/tests/data/acpi/q35/DSDT.mmio64 index c249929add97439ceb9f891d44c425311517ad18..e1cd01f2349bb8c2f7f8badad11441ffe6d57acc 100644 GIT binary patch delta 19 acmZ4Hxy*Be64PW=CKV=z#LXT|aY_I`4+U`m delta 20 bcmZ4Hxy*Be5)*R)L*is5CY8;eOtDG;MePOO diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index f2f60fdbb3b44ab9adb69bb36e4a80978536af9b..3b9dffb565833cc87bbf08dadfc1f31ac858e93b 100644 GIT binary patch delta 19 acmZonYE0Uo#57rzNrj0aakB^0PCWoU?*+gB delta 20 bcmZonYE0Uo#Kc^{kT_Y1NoBJq(+)iVM70Jk diff --git a/tests/data/acpi/q35/DSDT.nohpet b/tests/data/acpi/q35/DSDT.nohpet index 9ff9983a80a7487470ccd02ce587200444675816..2cf7f6db0fd8de357278f942a4082e714804dca9 100644 GIT binary patch delta 19 acmZ2yzs`Px64PW=CKV=z#LXT|X|e!5<^^y7 delta 20 bcmZ2yzs`Px5)*R)L*is5CY8;eOsTQ}MZg8# diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem index 1e7c45ef3ccb000a06f64152622b4bd27916d181..310e3d5053b90863f96c29dd69a514b4999b4a19 100644 GIT binary patch delta 19 acmX@)aL8eU64PW=CKV=z#LXT|zhnVJ00u4q delta 20 bcmX@)aL8eU5)*R)L*is5CY8;eOh07-N(2U+ diff --git a/tests/data/acpi/q35/DSDT.pvpanic-isa b/tests/data/acpi/q35/DSDT.pvpanic-isa index ed47451c44e3041e5b7fed55de7b6ef1aca54350..6672b6fa05c8ee30a8ea4ab0931d59c1315a4e9c 100644 GIT binary patch delta 19 acmZ4JxX^Kf64PW=CKV=z#LXT|k#Yb%Jq1nx delta 20 bcmZ4JxX^Kf5)*R)L*is5CY8;eOc8PbL;(f7 diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12 index efc2efc19f00ca7564467756616da44f5fd71cfe..eae2dc599331516e11632356f05d7831d1fa1e6a 100644 GIT binary patch delta 19 acmbQ`I?Hu~64PW=CKV=z#LXT|K?(poy#+%6 delta 20 bcmbQ`I?Hu~5)*R)L*is5CY8;eOo0jjLwg0W diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2 index 675339715f72b4400445ce8c0dd12f416aa0efb0..68c6a7d244cfc78efa6b9cd1385f2134ca149ad7 100644 GIT binary patch delta 19 acmdnuy2W*a64PW=CKV=z#LXT|ISK$knFWym delta 20 bcmdnuy2W*a5)*R)L*is5CY8;eOxX$mM~emj diff --git a/tests/data/acpi/q35/DSDT.viot b/tests/data/acpi/q35/DSDT.viot index eeb40b360f7c1de93501e1ddcd7dab306a51113b..4f93d46859b6c0a69afc41d5aa7585ebd686c1d2 100644 GIT binary patch delta 19 acmbQ}Ini^264PW=CKV=z#LXT|o=N~a@dYvf delta 20 bcmbQ}Ini^25)*R)L*is5CY8;eOdd)ALZt3c_doW$^002#l2H*ey delta 22 ecmbO~jcNWgrVUC=%moaIla-iMHhVH%>i_^$`Ug$` diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 7e7745db39..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,36 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT", -"tests/data/acpi/pc/DSDT.acpierst", -"tests/data/acpi/pc/DSDT.acpihmat", -"tests/data/acpi/pc/DSDT.bridge", -"tests/data/acpi/pc/DSDT.cphp", -"tests/data/acpi/pc/DSDT.dimmpxm", -"tests/data/acpi/pc/DSDT.hpbridge", -"tests/data/acpi/pc/DSDT.ipmikcs", -"tests/data/acpi/pc/DSDT.memhp", -"tests/data/acpi/pc/DSDT.nohpet", -"tests/data/acpi/pc/DSDT.numamem", -"tests/data/acpi/pc/DSDT.roothp", -"tests/data/acpi/q35/DSDT", -"tests/data/acpi/q35/DSDT.acpierst", -"tests/data/acpi/q35/DSDT.acpihmat", -"tests/data/acpi/q35/DSDT.acpihmat-noinitiator", -"tests/data/acpi/q35/DSDT.applesmc", -"tests/data/acpi/q35/DSDT.bridge", -"tests/data/acpi/q35/DSDT.core-count2", -"tests/data/acpi/q35/DSDT.cphp", -"tests/data/acpi/q35/DSDT.cxl", -"tests/data/acpi/q35/DSDT.dimmpxm", -"tests/data/acpi/q35/DSDT.ipmibt", -"tests/data/acpi/q35/DSDT.ipmismbus", -"tests/data/acpi/q35/DSDT.ivrs", -"tests/data/acpi/q35/DSDT.memhp", -"tests/data/acpi/q35/DSDT.mmio64", -"tests/data/acpi/q35/DSDT.multi-bridge", -"tests/data/acpi/q35/DSDT.nohpet", -"tests/data/acpi/q35/DSDT.numamem", -"tests/data/acpi/q35/DSDT.pvpanic-isa", -"tests/data/acpi/q35/DSDT.tis.tpm12", -"tests/data/acpi/q35/DSDT.tis.tpm2", -"tests/data/acpi/q35/DSDT.viot", -"tests/data/acpi/q35/DSDT.xapic", From patchwork Wed Mar 8 01:12:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=V/IE3M2S; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ821GX0z1yWm for ; Wed, 8 Mar 2023 12:13:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMc-0007uR-NP; Tue, 07 Mar 2023 20:13:06 -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 1pZiMa-0007iL-5o for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiMY-0001iA-A0 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237981; 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=m5rr5IpPPDGOUsKcdUwoNYKsT4lBju+PDcSDFh4/Yw8=; b=V/IE3M2SDYp+OoqHwwQ97udxJ/PdZzEMJFJk681Uq9p2uQj5L+QnstoI1OVnvlKdRn2fvM 3cnWDZeh9nf6JnLDmAxwa24jDWUoIE2o6erHanuJo42yzQpCSef5EMAIjJs2XBB/VPfYSe 3OIu9poGtcQ/KE6mwc80A8SZFP7uQL8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-589-JP1oaIFBNzOQ8SP6WUlwSA-1; Tue, 07 Mar 2023 20:13:00 -0500 X-MC-Unique: JP1oaIFBNzOQ8SP6WUlwSA-1 Received: by mail-ed1-f69.google.com with SMTP id ee15-20020a056402290f00b004f059728d91so4496598edb.23 for ; Tue, 07 Mar 2023 17:13:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237979; 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=m5rr5IpPPDGOUsKcdUwoNYKsT4lBju+PDcSDFh4/Yw8=; b=n9PN1eYiWwQLFq2mX4AmTx5vwTeX/SYgIl4APbVAG/1+TZmlyCm7qSV6mst1ubnvar 28Tzmavu5RjA9HgfypwrSWmwNYR5amImVxuSHb3EeKqZMuxnxUIT9aH6aMkswWKTjBVe WDpuoNb6ljaBSHYmhVyDULqt3ohkr8MCd4QnSrP5lh0ICvqq2ri2ZvHNIIUmywZ5zLyr abtNzKCuYjLAK8u5GZkt8IZBdPAfSZEzkDAo3wMdw6zPXz4ylUxjs05BbJmZXNs1cXMR yjNgQK0d/ZFlMY0anMk+ZrctMwFrw1Lfxe1S5K0r/NAaRF4kQp9ESMqajkKLWL44K7q0 t8cg== X-Gm-Message-State: AO0yUKVVLXcb9VordfoCKHbYAlAcSm4mFBpV+uuI8Lq60lqjCZb1PV+Y JWVmAcl78ViWD7+bW3maYzznJeKZacwpcTaEPMUJ+3JXRaF2fEZpbuPEGsdzuV/I4pmpxAgjdzh Tedy/KkRimlzXf9acFCA+GivyvqWQqo9ZjXKhVE5PWfA+NTqZ2lTE30DV6puP7JfFIDcW X-Received: by 2002:a17:907:80ca:b0:889:58bd:86f1 with SMTP id io10-20020a17090780ca00b0088958bd86f1mr16831636ejc.14.1678237978919; Tue, 07 Mar 2023 17:12:58 -0800 (PST) X-Google-Smtp-Source: AK7set8PHsO9Ff6WORaBQ9SLBJQpe7g5MB3HdOfm3an1njmir1YCoYJUHiQRxx6CanDMmyO1UpO+nw== X-Received: by 2002:a17:907:80ca:b0:889:58bd:86f1 with SMTP id io10-20020a17090780ca00b0088958bd86f1mr16831623ejc.14.1678237978701; Tue, 07 Mar 2023 17:12:58 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id rp21-20020a170906d97500b008de50990fa7sm6731741ejb.21.2023.03.07.17.12.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:12:58 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:55 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 42/73] tests: acpi: whitelist DSDT before adding EDSM method 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-17-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..8911b10650 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,38 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.acpierst", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.hpbridge", +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.nohpet", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/pc/DSDT.roothp", +"tests/data/acpi/q35/DSDT", +"tests/data/acpi/q35/DSDT.acpierst", +"tests/data/acpi/q35/DSDT.acpihmat", +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator", +"tests/data/acpi/q35/DSDT.applesmc", +"tests/data/acpi/q35/DSDT.bridge", +"tests/data/acpi/q35/DSDT.core-count2", +"tests/data/acpi/q35/DSDT.cphp", +"tests/data/acpi/q35/DSDT.cxl", +"tests/data/acpi/q35/DSDT.dimmpxm", +"tests/data/acpi/q35/DSDT.ipmibt", +"tests/data/acpi/q35/DSDT.ipmismbus", +"tests/data/acpi/q35/DSDT.ivrs", +"tests/data/acpi/q35/DSDT.memhp", +"tests/data/acpi/q35/DSDT.mmio64", +"tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/q35/DSDT.noacpihp", +"tests/data/acpi/q35/DSDT.nohpet", +"tests/data/acpi/q35/DSDT.numamem", +"tests/data/acpi/q35/DSDT.pvpanic-isa", +"tests/data/acpi/q35/DSDT.tis.tpm12", +"tests/data/acpi/q35/DSDT.tis.tpm2", +"tests/data/acpi/q35/DSDT.viot", +"tests/data/acpi/q35/DSDT.xapic", From patchwork Wed Mar 8 01:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=gI1Pd2Ax; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZF101qDz1yWs for ; Wed, 8 Mar 2023 12:17:57 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMe-00081x-Q9; Tue, 07 Mar 2023 20:13:08 -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 1pZiMd-0007yi-Si for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:07 -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 1pZiMc-0001iS-1j for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237985; 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=J9ti866gyx6DOxptU+MHiY2Rogorph6rb11rc9zbrrY=; b=gI1Pd2AxX4eddeSBszx0lMQm8CBYE1WkNIS86Z9rLiZYsViJaAJ96CA78KY8J619p3KMrO CpVp9aSBrnzs6tmEcPNh2kBw5syhd3wyRDmwq7d2gjoNSAGs2c8fSwZooBElweAxTcLi4r ozUdw0AR9acatFuq8iuTXvTPjNHDer0= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-265-iB-4VPYvO_eomV4OmCOkAg-1; Tue, 07 Mar 2023 20:13:03 -0500 X-MC-Unique: iB-4VPYvO_eomV4OmCOkAg-1 Received: by mail-ed1-f70.google.com with SMTP id w7-20020a056402268700b004bbcdf3751bso21221707edd.1 for ; Tue, 07 Mar 2023 17:13:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237982; 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=J9ti866gyx6DOxptU+MHiY2Rogorph6rb11rc9zbrrY=; b=Hz0nxW6GFZAexKqbSfy0q1Mii1D60fXNSrWIkwjvMQP4PommmeMzUnJQ55vK1kWamS ++i+kmB6unlxrDPYhkHLdPkHfscLrOTF4OfSN7TVdw3F240oLK/MqKo2OtxN2vHrTt7y yH6Qe23Vc5NxCAMZrOol1/lovkt+KAbsvlOc4fuisWuw5Kb5OYZyoGBiCjAv2VjNQOKE BvNxDFKGkk0Kaec3qAzD7yijv3D2XrknQB4BIvH2R0Xy64WkU3fEdcGplHElj0iJiHVZ rD2P1/TQ9BXfwJNqaeBubaDI5WUJ4H+Ypq2+Tgy2QMQWuDHJ+tAJFpDDPhhq2sE9Scat H4Vw== X-Gm-Message-State: AO0yUKWjVYkm2CTwtrLMz22fhTlhqUgYRC3oVvHpRcPAfgQSxHIvIF9q WLOJ3J0Oh2aNBPwTxQXTX52+q/5MNKbEZ66etGLdQmVoSgt9PZ7KBVXlpBIti1/pxJZuToYMulK I/GCwJwV6k2441bPW62EQRmn64XZ+il5hh854/mYF8NsElMTWvJ82FSXKnHjUC7c6kyFy X-Received: by 2002:a17:906:fe0c:b0:8b3:b74:aeb5 with SMTP id wy12-20020a170906fe0c00b008b30b74aeb5mr20862800ejb.30.1678237982226; Tue, 07 Mar 2023 17:13:02 -0800 (PST) X-Google-Smtp-Source: AK7set95WoljaVcnVYohrRZGmc7Q4t40CNqagR8V2ugL/AdvNd4iF6wk6YBbnM9GmHwAfUkG4HzuAw== X-Received: by 2002:a17:906:fe0c:b0:8b3:b74:aeb5 with SMTP id wy12-20020a170906fe0c00b008b30b74aeb5mr20862782ejb.30.1678237981905; Tue, 07 Mar 2023 17:13:01 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id o13-20020a1709062e8d00b008e22978b98bsm6816302eji.61.2023.03.07.17.13.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:01 -0800 (PST) Date: Tue, 7 Mar 2023 20:12:59 -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 43/73] acpi: pci: add EDSM method to DSDT Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov it's a helper method for acpi-index support on PCI buses that do no support or have disabled ACPI PCI hotplug or for non-hotpluggble endpoint devices. (like non-hotpluggble NICs, integrated endpoints and later for machines that do not support ACPI PCI hotplug) no functional change, commit adds only EDSM method in DSDT without any users. (the follow up patches will use it) Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-18-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index d8ec91b8e3..6f5501fb74 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -399,6 +399,58 @@ static void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar) aml_append(ctx, ifctx1); } +static Aml *aml_pci_edsm(void) +{ + Aml *method, *ifctx; + Aml *zero = aml_int(0); + Aml *func = aml_arg(2); + Aml *ret = aml_local(0); + Aml *aidx = aml_local(1); + Aml *params = aml_arg(4); + + method = aml_method("EDSM", 5, AML_SERIALIZED); + + /* get supported functions */ + ifctx = aml_if(aml_equal(func, zero)); + { + /* 1: have supported functions */ + /* 7: support for function 7 */ + const uint8_t caps = 1 | BIT(7); + build_append_pci_dsm_func0_common(ifctx, ret); + aml_append(ifctx, aml_store(aml_int(caps), aml_index(ret, zero))); + aml_append(ifctx, aml_return(ret)); + } + aml_append(method, ifctx); + + /* handle specific functions requests */ + /* + * PCI Firmware Specification 3.1 + * 4.6.7. _DSM for Naming a PCI or PCI Express Device Under + * Operating Systems + */ + ifctx = aml_if(aml_equal(func, aml_int(7))); + { + 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)); + + /* + * IASL is fine when initializing Package with computational data, + * however it makes guest unhappy /it fails to process such AML/. + * So use runtime assignment to set acpi-index after initializer + * to make OSPM happy. + */ + aml_append(ifctx, + aml_store(aml_derefof(aml_index(params, aml_int(0))), aidx)); + aml_append(ifctx, aml_store(aidx, aml_index(ret, zero))); + aml_append(ifctx, aml_return(ret)); + } + aml_append(method, ifctx); + + return method; +} static void build_append_pcihp_notify_entry(Aml *method, int slot) { @@ -1398,6 +1450,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03"))); aml_append(dev, aml_name_decl("_ADR", aml_int(0))); aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); + aml_append(dev, aml_pci_edsm()); aml_append(sb_scope, dev); aml_append(dsdt, sb_scope); @@ -1413,6 +1466,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, aml_append(dev, aml_name_decl("_ADR", aml_int(0))); aml_append(dev, aml_name_decl("_UID", aml_int(pcmc->pci_root_uid))); aml_append(dev, build_q35_osc_method(!pm->pcihp_bridge_en)); + aml_append(dev, aml_pci_edsm()); aml_append(sb_scope, dev); if (mcfg_valid) { aml_append(sb_scope, build_q35_dram_controller(&mcfg)); From patchwork Wed Mar 8 01:13:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=galnRbij; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZHv2c4Qz1yWp for ; Wed, 8 Mar 2023 12:20:27 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMi-0008O5-Pr; Tue, 07 Mar 2023 20:13: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 1pZiMh-0008IV-LX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:11 -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 1pZiMe-0001ik-GF for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237988; 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=J5fTJeSihQK+1mURbRAJ5wNeCnXw7+2eE+6VKA0B7E4=; b=galnRbij71WrX3Z/3VeM9F1E1DZfp0kjFK6Us0vDcBORa3bvz/KNX0c3t/CxQ4wz7ZaQ+H ScHfUikGy2Bm/aWmmS4gWNO6yTfTBGxC1addJeNDFk15TaNhNm5dB6jMlv5XTCS+tUGLm5 UPsrNHRX8vZk05c6TMV2Xsu/jE3R04M= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-466-QmH7Ue3gPRWYHM2JHjHeSg-1; Tue, 07 Mar 2023 20:13:06 -0500 X-MC-Unique: QmH7Ue3gPRWYHM2JHjHeSg-1 Received: by mail-ed1-f69.google.com with SMTP id p36-20020a056402502400b004bb926a3d54so21291850eda.2 for ; Tue, 07 Mar 2023 17:13:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237985; 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=J5fTJeSihQK+1mURbRAJ5wNeCnXw7+2eE+6VKA0B7E4=; b=NOIvrb35vQbZJ6mIZ0EmIoBvQrKO56xre1f9QJjBZRq/euZDc91k99QNyLdzeJkW69 SbHOSKmKxoHAbDKQ0WUgW5Nq0jL/Nr4o2MBOawdEpLEpyzxTzn75lc/uM6E6es0ry7uZ x+LXRL5l8ZGkjlB7Rwxux5bvy4hiXyjlZ/37W5aWZt98XrnhoxUbd0a9x5ArSn3JTYR2 TH4mR7o9t6yEjALYxGp9k/12YoS2Z6NW049wDjFN4qlAl5t2OX6lJaC6NNZV7VHHbj40 R8xwYYgg0YcHZPiwWac2Bfpn9/u3JtaNfJ6yP9WJSzVs66w+gHx8+SSWtK+hSFXSK11m LWkg== X-Gm-Message-State: AO0yUKXAdUeQrtSDc/6ZgbbIc22KHU7gIfHSW7xVw/HawwlsTsmK+hYT W31IPNNgLrBPO04Z3iBuREbCG8LQIy2H7eoI7TvtXfGZHv15u11vXmhm/zno2AlissA0uJEN9Wn 2XVYWoFR5JA3lrqFAGAbUJm3AnxzADNDKmwmZI/jaIfqDG19c+k/sZDbqYJNK25Qv6eI3 X-Received: by 2002:a17:906:1396:b0:8b0:fc14:bbcb with SMTP id f22-20020a170906139600b008b0fc14bbcbmr15721609ejc.42.1678237984954; Tue, 07 Mar 2023 17:13:04 -0800 (PST) X-Google-Smtp-Source: AK7set80HIH8rofZEf3ilawM8/a5V6zb7vr0ZJudfnE9k+ODEi1NqOfQTIpMYwUB2CeBIz/uf3+KhQ== X-Received: by 2002:a17:906:1396:b0:8b0:fc14:bbcb with SMTP id f22-20020a170906139600b008b0fc14bbcbmr15721586ejc.42.1678237984542; Tue, 07 Mar 2023 17:13:04 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d13-20020a170906370d00b008d5183c1e20sm6759799ejc.190.2023.03.07.17.13.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:04 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:02 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 44/73] tests: acpi: update 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-19-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 37 ------------------ tests/data/acpi/pc/DSDT | Bin 6360 -> 6454 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6283 -> 6377 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7685 -> 7779 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12487 -> 12581 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6824 -> 6918 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8014 -> 8108 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6323 -> 6417 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3166 -> 3260 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6432 -> 6526 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7719 -> 7813 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6218 -> 6312 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6366 -> 6460 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9745 -> 9839 bytes tests/data/acpi/q35/DSDT | Bin 8252 -> 8344 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8269 -> 8361 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9577 -> 9669 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8531 -> 8623 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8298 -> 8390 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11481 -> 11573 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32392 -> 32484 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8716 -> 8808 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9564 -> 9656 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9906 -> 9998 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8327 -> 8419 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8340 -> 8432 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8269 -> 8361 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9611 -> 9703 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9382 -> 9474 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12545 -> 12637 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8022 -> 8114 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8110 -> 8202 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8258 -> 8350 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8353 -> 8445 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8858 -> 8950 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8884 -> 8976 bytes tests/data/acpi/q35/DSDT.viot | Bin 9361 -> 9453 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35615 -> 35707 bytes 38 files changed, 37 deletions(-) diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index ec133a6d3aabcfd22b7b46019338db2de255da70..521062a756d1fcd5939683e41071d29407a45b22 100644 GIT binary patch delta 111 zcmca%xXp;mCDrvw L2$9@4(Om)nP{SR3 delta 57 zcmdmHbiHokY4008b%5ODwi diff --git a/tests/data/acpi/pc/DSDT.acpierst b/tests/data/acpi/pc/DSDT.acpierst index 2b4b7f31919f360e038e37de713639da753f13aa..12b9e94bf1449995d460edffd40d1ff7b9f292cc 100644 GIT binary patch delta 111 zcmeA+d}+w#66_N4Qi6ejk!vDXs-6Q!e6Uk|bdv{rfU~CoN4$rp3yrvw L2$9@4@s~INTzwuz delta 57 zcmaE9*loz=66_MvEy2LR=sS@sRY@s6*eO1`NjkvU(|{x1!_$Sw@d6h!N4%p;5Ccbi MsHY3V#`nL(0md{CIsgCw diff --git a/tests/data/acpi/pc/DSDT.acpihmat b/tests/data/acpi/pc/DSDT.acpihmat index 714a123e7a500cf0f862ff6c4e9a3f50a96af056..876d0184d8d56cc2fc9d4c0a619d5d449ba81687 100644 GIT binary patch delta 111 zcmZp*d2GYw66_L^EXTmW=suAvRnLJVKG-Qfy2*n*z}eG)Bi_T)g~#y%7c)n^qe~D2 zM|`NK3xkL^tE)?}FYf}g$zhDTs$7j72@DKN5*Elz&f;P(5MpIw;AKcCXzs{iU`Q-T Lgh+0jSRxAmL&P17 delta 57 zcmaEC(`v)z66_MfD#yUU*fo(WRY@s6*eO1`NjkvU(|{x1!_$Sw@d6h!N4%p;5Ccbi MsHY3V#`h(%0J(t=fdBvi diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge index 6c0543cf75ad3e02468ed4925fd3369a183e9b45..219ddba2713015616e41c19f66d891c63b05e4ab 100644 GIT binary patch delta 111 zcmX?}xHO5&CDzPt;}CWkTVs&X}UBrq^6Nmw8=Ig5+EK!}xzftMknpt&Q5fg!OV L5hA&9qL~2zi1!{4 delta 57 zcmZ3QbUcyECDrvw L2$9@4QCtcDJ{uh@ delta 57 zcmZoOTVcxO66_MPLW+Tb(P$!9s*+NCuv2_=lXQTyrvXR2ho=jV;{`5ej(A6xAO?>3 MP)`?zjqk;!0Jqi;ApigX diff --git a/tests/data/acpi/pc/DSDT.dimmpxm b/tests/data/acpi/pc/DSDT.dimmpxm index 1c90e119c5d3dc7e86d04942114e5cfe40de6039..fbe755975d94e5e607820bb7acb2fb189b1105ee 100644 GIT binary patch delta 111 zcmX?Sx5l2!CDgR3)YOV5j)#Cg}iYPXms44^I~!#|vD{9Py4WK@1%6 Np`I=b8{hAh0|4L15T5`5 diff --git a/tests/data/acpi/pc/DSDT.hpbridge b/tests/data/acpi/pc/DSDT.hpbridge index 04e1c20f63be7c6c574e72590332707ca410852a..12d7daf950ba93deaeb67655d303df3960569a64 100644 GIT binary patch delta 111 zcmdmNIMIm9CDzPt;}CWkTVs&X}UBrq^6Nmw8=Ig5+EK!}xzftMknpt&Q5fg!OV L5hA&9qLKsvN_rhr delta 57 zcmbPewAql$CDzPt;}CTB4e2r@G=BrK4cG&w_1m`mV-`N^ljrd7TZ#b5bK9(ML! zlCXe%Y9<%cl7s@T#*PFA2B3h<PZs-6Q!e6Uk|bdv{rfU~CoN4$rp3yrvw L2$9@4v0nlJLd_kS delta 57 zcmexow7`hVCD3 MP)`?zjqm#<0J?AwjsO4v diff --git a/tests/data/acpi/pc/DSDT.memhp b/tests/data/acpi/pc/DSDT.memhp index 811965f42d97adadde6e9ec6d6153e767041bc6d..8ad5c523fdf76b90286a145f797454dff6da050c 100644 GIT binary patch delta 111 zcmZ2((`w7*66_MvD#yUUSTm6;RnLJVKG-Qfy2*n*z}eG)Bi_T)g~#y%7c)n^qe~D2 zM|`NK3xkL^tE)?}FYf}g$zhDTs$7j72@DKN5*Elz&f;P(5MpIw;AKcCXzs{iU`Q-T Lgh+0jI87D+OwAq2 delta 57 zcmZp*U2enW66_M9F2}&YxPKy7s*+NCuv2_=lXQTyrvXR2ho=jV;{`5ej(A6xAO?>3 NP)`?zjqj()0syhbCDzPt;}CWkTVs&X}UBrq^6Nmw8=Ig5+EK!}xzftMknpt&Q5fg!OV L5hA&9;!be@T~!_m delta 57 zcmZ2sc*=mwCDrvw L2$9@4(N_WhH^m)3 delta 57 zcmdmEbkC5>CDrvw L2$9@4u|X98R^lDX delta 57 zcmaFwGtr03CDq3sF=HZEs*+NCuv2_=lXQTyrvXR2ho=jV;{`5ej(A6xAO?>3 MP)`?zjqe*&0mH)&zW@LL diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index c304e15e366d7317fd0e9db0a144f02e0437d7a1..3dadeba912d9133f0ccb6e9b89a22ca7dc43f18f 100644 GIT binary patch delta 90 zcmdnvFvF3{CDTiFmWRx&-_3E-;%c$)u~w q)!321z_27?fz0GAF7^T;Rwf2shJ=FVjvNMt#DYYKu+ovsCDkW5h(RR4zx6_+Y2_=q7*uiIoevM7&vDU4ngi7nn_!WYSgT qYV1g0U|5o{KxT3l7khyaD-#1RLqb7wM-Br+VnHHAaFfB*mh diff --git a/tests/data/acpi/q35/DSDT.acpihmat-noinitiator b/tests/data/acpi/q35/DSDT.acpihmat-noinitiator index ebec32b575d310f98937fe9208f0c60349ca753d..631a1048fc01a3c84aadfdea8e0eccc36c68d8a4 100644 GIT binary patch delta 90 zcmccYwBDJ^CDWA{X^R4zx6_+Y2_=q7*uiIoevM7&vDU4ngi7nn_!WYSgT qYV1g0U|5o{KxT3l7khyaD-#1RLqb7wM-Br+VnHHAaDwiu?e6Uk|bdxjJ#L9)6%NPUX0o*YQnE(I) diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge index 8e11b8ea4862c8ec27376703c9c43e9895ca60eb..cdfd51ce70d7201fa827bfabfd23e413596b1094 100644 GIT binary patch delta 90 zcmcZ^xiyN*CD~p1Hcp delta 37 scmdnteaDN-CD3o@xVl`R4zx6_+Y2_=q7*uiIoevM7&vDU4ngi7nn_!WYSgT qYV1g0U|5o{KxT3l7khyaD-#1RLqb7wM-Br+VnHHAay;_ZgA^ delta 37 scmaFt*zU;X66_MvuE4;+xN9O;Dwiu?e6Uk|bdxjJ#L9)6%NTRz0ox=C!vFvP diff --git a/tests/data/acpi/q35/DSDT.ipmismbus b/tests/data/acpi/q35/DSDT.ipmismbus index 0970dbd5896fc0038b1369dbbcc982ead7736ae6..9fe6d1686a777ffddc2953420cd4838832226bad 100644 GIT binary patch delta 90 zcmbQ@_`#9OCDu+ovsCDI5 delta 37 tcmcbc)R@HO66_MfXvo08IAQ0|3+S3-AB{ diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp index 4ea982de2df3cf7cd89cb3b4467a350eaf8f5d29..44ee5e74c533f2c7554885b73adb947ed74b421f 100644 GIT binary patch delta 130 zcmca+x5=K%CDHsS delta 37 tcmeBjSZB}W66_MPPM(2*F@7RfDwiu?e6Uk|bdxjJ#L9)6%NVD~0RYc^3x5Cr diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem index 310e3d5053b90863f96c29dd69a514b4999b4a19..5e94a2b61f840c68d27257831cf608d41ee7c154 100644 GIT binary patch delta 90 zcmX@)Fwc?8CD0|47X3%LLQ diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12 index eae2dc599331516e11632356f05d7831d1fa1e6a..fc6cc4585a6b1d955bc80700ec2dc2720b7e4a89 100644 GIT binary patch delta 90 zcmbQ``puQgCDTiFmWRx&-_3E-;%c$)u~w q)!321z_27?fz0GAF7^T;Rwf2shJ=FVjvNMt#DYYKPE@Ny^1OVk43?~2p diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2 index 68c6a7d244cfc78efa6b9cd1385f2134ca149ad7..815006e445d0ec44c2f4a7c8d30ead6616a32b32 100644 GIT binary patch delta 90 zcmdnuI>C+0CDDwm^3e6Uk|bdx{-#L9(SBHpa7F2TOM3(O`w#AjpCDU@n=Hws stIE~bk-)&PBw>NfV0OF+@2LJ#7 delta 39 vcmex8jcNWgCN7s?mk{}G1_nm&iCn2%u6*&qPVv!A&Ri2K7j7 X-Patchwork-Id: 1753804 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YPhqj2oc; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBh2w3lz1yWs for ; Wed, 8 Mar 2023 12:15:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMk-00005b-Rr; Tue, 07 Mar 2023 20:13: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 1pZiMi-0008OG-P9 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiMg-0001kG-Qt for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237990; 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=RMd8rd20zEEZ4sK5kfD9/Q46KHVDJ80++rBVhjvB3LE=; b=YPhqj2ocoI1R0oJIWYSl1CKeM1B/VF73nZ5A9wbY1sTXXx+JExdQnmJJHUUKRbrNzbN68W Vf3ETTSaG1BsNFi969M5oWbPD9g0RQDBGJjcay19IQ5DFRIKu8OqDzA1iGwYOFudnG5bWV l+EsOjksDqtSsZuGx0JwGneVg8dkn1c= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-336-lIJTIUoLPIO2oLyJkUgjrQ-1; Tue, 07 Mar 2023 20:13:09 -0500 X-MC-Unique: lIJTIUoLPIO2oLyJkUgjrQ-1 Received: by mail-ed1-f72.google.com with SMTP id v11-20020a056402348b00b004ce34232666so18101424edc.3 for ; Tue, 07 Mar 2023 17:13:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237987; 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=RMd8rd20zEEZ4sK5kfD9/Q46KHVDJ80++rBVhjvB3LE=; b=CBZe0YoUY4jx7R1Y1iwx+9EKR7JtoDtx+vaqdrbkgDCZgu7ByVdt9X9fUf/b5MUbvo j61opWXd10xMylQturmRRiqgKJD+T4XOxZiLbUkg2XKOcp9/BHXg012V3Ey3eRCcHa3Z j8hZbXFlf1xoJfNO5psAnRpVCbVB4ZRt+ave3KlOUU+h01HzcsFr0CElog5IMF75HhPY irUyphv0LQ/fwpnT7FYcFl09dK4WgYU+fJnpyVMH8aTu00yJOku2w0hNiuiqi9/gLguM 2n5bj8RnwlkRJMUEn7hMIyV6IxgohOb4RnCHNe5DOtxmbSFI9EFaY3HxIOPtrRSpPxMY rPHg== X-Gm-Message-State: AO0yUKVSLngZUFrFhdM2RQyOAujAV5llk8GlurKknI1gecUs6rdSyJer rWiLiSAxRGiu0iRxeSsPuYFFjFS8g4QpUBFi3mS6AK1comDSsFtkuGccGpo1adJ00cKKYnASBg0 pljuKTVsVsAhJ3S3PdmAXSs3pBBrkaeswmJ9DsXJSYwDIEi1HRD2sDhPHwu/seRCUMTeq X-Received: by 2002:a17:906:a4b:b0:88a:cbd1:e663 with SMTP id x11-20020a1709060a4b00b0088acbd1e663mr14488985ejf.6.1678237987728; Tue, 07 Mar 2023 17:13:07 -0800 (PST) X-Google-Smtp-Source: AK7set9Apo0pTrN6FaT4NfK4foKxyqn9W9cDyDwQwDmlbSb/XMLwoA0UJrbawiplqh5mHhIeTYS1+Q== X-Received: by 2002:a17:906:a4b:b0:88a:cbd1:e663 with SMTP id x11-20020a1709060a4b00b0088acbd1e663mr14488970ejf.6.1678237987476; Tue, 07 Mar 2023 17:13:07 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id mb3-20020a170906eb0300b008e772c97db6sm6732434ejb.128.2023.03.07.17.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:07 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:04 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 45/73] tests: acpi: whitelist DSDT before adding device with acpi-index to testcases Message-ID: <52ad9eb2372245ba5829742fc176f3c8af36f592.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-20-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..70244976c9 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,4 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/q35/DSDT.noacpihp", From patchwork Wed Mar 8 01:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UEF+9gSE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBh1ct8z1yWr for ; Wed, 8 Mar 2023 12:15:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMn-0000H3-Lu; Tue, 07 Mar 2023 20:13:17 -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 1pZiMm-00008o-4d for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:16 -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 1pZiMk-0001mm-Lz for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237994; 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=nVFVvTqVMAy3jtA1iNwo3ZEuay2y2+K610EAHg197tI=; b=UEF+9gSExQBQhw/JbSllKLdwznFRecdFQgzAzJKyux7M7gxdna0X714MtS9gBnWJkfheOv 6pPS7fntk9emLK7gc9xgRcLO0jU6mh6t8nG9smJFVTHf/t+oceLy8/NIeeDxrZ5z4QByCB nTvKS5p13dhr6d2+6vaMp09CgeL9h+Q= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-216-ldh4nVDhMbOq5tCZwToh1Q-1; Tue, 07 Mar 2023 20:13:12 -0500 X-MC-Unique: ldh4nVDhMbOq5tCZwToh1Q-1 Received: by mail-ed1-f71.google.com with SMTP id g2-20020a056402320200b004e98d45ee7dso9599285eda.0 for ; Tue, 07 Mar 2023 17:13:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237991; 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=nVFVvTqVMAy3jtA1iNwo3ZEuay2y2+K610EAHg197tI=; b=hBjsX1/UhiBD2cB4PDBT8kK8z78Wi1MBjxIaSvBZvyR2oShYgRXShsurCpVm+9BW6p bao+H4IyZ/GirwZm36s8zgkFXrDA354vvd3kCk3ZbYV2lnEF2sShp9B5c0zi61xtFVKK cS9wyjR/73NrnWg/mBG7QepjSzF0TmHnrJLLutIZx3vil63wSLU+vBdpc+qWXL2ZvzLV S5GLf7ZHzL7g86gyVWItCQ3sZX934vT/zOUcJn4U9z6xERluS3vL32ALhSP5JJxRLtCj oiL9hpGN6uoFkbpACOPJsGNMxhr6G0PU/TecQnECSU6jaemrYHzGyXNIrqGKZTgvH5EK c3Xw== X-Gm-Message-State: AO0yUKXL7Hx8SeZtGp7U4NCVpCHjodeCPn5KguC8OqIu1smbhH6sr9tW PrTcVN3dzgXm9xDJidjE7Tv7Fqr+agiS4NBoAtgxHaB+laeKlvMpmvr/XiTTzyBeLJ/Pd7bksf8 ufKYVOtKIBg7z7TEirtiwIokDNm8LIcTXt+qNShyl3riiEPU/EBDo104nGJfwYXUnPoHm X-Received: by 2002:a17:906:63d2:b0:881:44e3:baae with SMTP id u18-20020a17090663d200b0088144e3baaemr14335012ejk.54.1678237991221; Tue, 07 Mar 2023 17:13:11 -0800 (PST) X-Google-Smtp-Source: AK7set+CzLrOgvAgs/+XIKq3ojpTakam9cVpC2xlXVNFaHiNH58BRu5qUCzmwUvKLI+0J0Kn04kJrQ== X-Received: by 2002:a17:906:63d2:b0:881:44e3:baae with SMTP id u18-20020a17090663d200b0088144e3baaemr14334995ejk.54.1678237990880; Tue, 07 Mar 2023 17:13:10 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id e19-20020a170906315300b008f2b0c6052csm6764693eje.89.2023.03.07.17.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:10 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:07 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 46/73] tests: acpi: add device with acpi-index on non-hotpluggble bus Message-ID: <22c8dd000fe4e7ce74531c22a427af58c4042d9a.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-21-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 295d80740e..d7c34ba504 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1054,6 +1054,7 @@ static void test_acpi_q35_multif_bridge(void) " -device pcie-root-port,id=rphptgt3,port=0x0,chassis=7,addr=2.3" " -device pci-testdev,bus=pcie.0,addr=2.4" " -device pci-testdev,bus=pcie.0,addr=5.0" + " -device pci-testdev,bus=pcie.0,addr=0xf.0,acpi-index=101" " -device pci-testdev,bus=rp0,addr=0.0" " -device pci-testdev,bus=br1" " -device pcie-root-port,id=rpnohp,chassis=8,addr=0xA.0,hotplug=off" From patchwork Wed Mar 8 01:13:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SNPsAG+/; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ9X6Jk6z1yWm for ; Wed, 8 Mar 2023 12:14:56 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMq-0000UW-Dj; Tue, 07 Mar 2023 20:13: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 1pZiMp-0000Om-8k for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:19 -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 1pZiMn-0001pL-N0 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237997; 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=ERnHGD+WHTZ7klTG5kNjn7sN1MSben7lbHWCXSMxb1Q=; b=SNPsAG+/0DTFUugEuwNSIB/MxJjCPJl6dZAtkcB/P6XG3pgw2d6n7rtdLmdkS9qXEphDrv 06m9jv7xMf86o2vxdWsAz7QXxcp7o5dGf7z73Xb49Bc4j1i42g+RyMksUyIkrWZM2pJo+p xtXaXA/nRcop/8wOCY4TDXDjYvP2X0A= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-391-D8_QNs5SM3ajRYXYnYDv2w-1; Tue, 07 Mar 2023 20:13:16 -0500 X-MC-Unique: D8_QNs5SM3ajRYXYnYDv2w-1 Received: by mail-ed1-f71.google.com with SMTP id u10-20020a056402064a00b004c689813557so21167773edx.10 for ; Tue, 07 Mar 2023 17:13:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237994; 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=ERnHGD+WHTZ7klTG5kNjn7sN1MSben7lbHWCXSMxb1Q=; b=1flIpRkh/uInjW7U9QyARgvrvhQMxu/lAFdqtx3CO5Mmh3arMiYCS0in76AUVQAiq2 GSVpB9Wl9PLSthsBF+F59L4KYGXstByyNad1vRso76iH7UeYWxM+CeO0Byf0ciF97rXm kLkRynqcn4c/RIJbd6IY5BRb6RoDZNIN1NSUrihCcKSibIEKqYhuplz1n6aQzWh3ZAaq lvrraER/oXEm5mAMoqa2hnT+qcNcYRMxXJhFMdQG8yBgrymqiRrR7fbaqmXUMrzj1iSO xfYaofPxwCxNwVGThxZdq0XdNB3g47LdSKripCOixF1cWS9Cvpx0y5yfAwKUTGu/VcM8 uMWA== X-Gm-Message-State: AO0yUKXSwWAPmta02g4pl4T9l8w7oWxbhJr563rnGm3gzBWuSqX94lfz UwyztRj+6oG6kf6iO5UOTc2wAjPj/FCBuXprtpJH0eiNn+5EeSmsc6opOtVivGEyoPXnXtFQX6h Etzo2NRWyUP7PQesDTO231dI8w62qYR8gcMFFPNDv1m+Ks+/0F7Ymnu5FeDlJvhHYOrZb X-Received: by 2002:a17:906:b307:b0:8b1:7eb1:590e with SMTP id n7-20020a170906b30700b008b17eb1590emr15136416ejz.20.1678237994448; Tue, 07 Mar 2023 17:13:14 -0800 (PST) X-Google-Smtp-Source: AK7set827JLZkYrhcF605Gd7vhIy/FF4JX4cu8ACItZDblkV2a74274uM6dFsQ7czQQi0tP19kUqVQ== X-Received: by 2002:a17:906:b307:b0:8b1:7eb1:590e with SMTP id n7-20020a170906b30700b008b17eb1590emr15136401ejz.20.1678237994077; Tue, 07 Mar 2023 17:13:14 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id x22-20020a170906b09600b008d9ddd2da88sm6763929ejy.6.2023.03.07.17.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:13 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:11 -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 47/73] acpi: pci: support acpi-index for non-hotpluggable devices Message-ID: <7fb1d7388b10f5d0738aee94110344ce4132fafe.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Inject static _DSM (EDSM) if non-hotpluggable device has acpi-index configured on it. It lets use acpi-index non-hotpluggable devices / devices attached to non-hotpluggable bus. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-22-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 6f5501fb74..46f78e9338 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -452,6 +452,25 @@ static Aml *aml_pci_edsm(void) return method; } +static Aml *aml_pci_static_endpoint_dsm(PCIDevice *pdev) +{ + Aml *method; + + g_assert(pdev->acpi_index != 0); + method = aml_method("_DSM", 4, AML_SERIALIZED); + { + Aml *params = aml_local(0); + Aml *pkg = aml_package(1); + aml_append(pkg, aml_int(pdev->acpi_index)); + aml_append(method, aml_store(pkg, params)); + aml_append(method, + aml_return(aml_call5("EDSM", aml_arg(0), aml_arg(1), + aml_arg(2), aml_arg(3), params)) + ); + } + return method; +} + static void build_append_pcihp_notify_entry(Aml *method, int slot) { Aml *if_ctx; @@ -577,6 +596,12 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus) aml_append(dev, aml_name_decl("_ADR", aml_int(adr))); call_dev_aml_func(DEVICE(bus->devices[devfn]), dev); + /* add _DSM if device has acpi-index set */ + if (pdev->acpi_index && !bsel && + !object_property_get_bool(OBJECT(pdev), "hotpluggable", + &error_abort)) { + aml_append(dev, aml_pci_static_endpoint_dsm(pdev)); + } /* device descriptor has been composed, add it into parent context */ aml_append(parent_scope, dev); From patchwork Wed Mar 8 01:13:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753805 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NVrHCCLp; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBm6PQbz1yWr for ; Wed, 8 Mar 2023 12:16:00 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiMx-0000bF-4G; Tue, 07 Mar 2023 20:13:27 -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 1pZiMs-0000YC-BR for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:22 -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 1pZiMq-0001qR-3n for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678237999; 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=52ErR+y1nMMu9lZZj/vgcQcxjEFsUfP7aYsuP2kUOw8=; b=NVrHCCLpFPRoJlPUkORIxV/+bMLFe+dKf8olljW7DDYvdtsvN83sLH5CpsZYnyNMgMpkX1 khlsSiT/uYM6/mVR3unHS1Tzb4aft6Qo2tvmfboYkT1ks5g/cmtiztZvwyQ/yEAn3oS6Wx mHZXMyQ4MGNrre97maSR4B5o/u4uyog= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-gHZvMSu5NFWj2J0lhyVVqQ-1; Tue, 07 Mar 2023 20:13:18 -0500 X-MC-Unique: gHZvMSu5NFWj2J0lhyVVqQ-1 Received: by mail-ed1-f69.google.com with SMTP id u10-20020a056402064a00b004c689813557so21167961edx.10 for ; Tue, 07 Mar 2023 17:13:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678237997; 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=52ErR+y1nMMu9lZZj/vgcQcxjEFsUfP7aYsuP2kUOw8=; b=EZp8IkeqPjN6n+7DEGrUP5HK3b2bEn7qLZjymgjgsDtk9GEehJhONXybShsMhZCchC PcQ17JksN+TzxmVxraxQGkRsS+AULj7aQpYiApmFU0kKci2/ESDPe8mtGN01HykeFyZX BY0rY0l9yj+ULFiBiTukLT66UN2+lLHMK32NaS5n/uKgjAzM+kAoF0PyxtbcH9NZny6t NZJuSWwBgP+sscfQSTVKN4dtAcJqoep1BgZgLwpX1jSN1nx9S2Y3Ci39RNpnG82tBTJ0 MS/TcFMnPA6ZI/HaES0LevT9x9UQaCIUXokJZ7ySY6c84UJsMTzjqMLXUJhqypu5MhGG r0OQ== X-Gm-Message-State: AO0yUKULzOEBzK2CjWrcXb/ZHZlKnusBMZ1Mr3EWO5AzsWhmFjYE8JoN uUXXMDUIOVVS4HgpVssNLagrsXSVTrKBbBt+Euic82YbvApVtoIwRZnNO7nE1T7lbA4cuziRJTX UlRSXm/5I7HLuNtX9SeMeGzB1i0jRabm0+yCDEE4FayI2cSQjcoD661YVGibBuMSoBX7C X-Received: by 2002:aa7:c153:0:b0:4ac:b309:3d76 with SMTP id r19-20020aa7c153000000b004acb3093d76mr19265588edp.31.1678237997055; Tue, 07 Mar 2023 17:13:17 -0800 (PST) X-Google-Smtp-Source: AK7set8dH/1cHjJieVMzkk7ckS/tOE4EsWYz1d8Unb5GDjKkOCI+c78h35Xa2TB/uRCYUM04/ByO8A== X-Received: by 2002:aa7:c153:0:b0:4ac:b309:3d76 with SMTP id r19-20020aa7c153000000b004acb3093d76mr19265563edp.31.1678237996675; Tue, 07 Mar 2023 17:13:16 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id f21-20020a50d555000000b004c059535b43sm7581122edj.31.2023.03.07.17.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:16 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 48/73] tests: acpi: update 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov the only chenge is addition of _DSM- > EDSM method on non-hotpluggable devices with configured acpi-index. Something like: + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Local0 = Package (0x01) + { + 0x65 + } + Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0)) + } Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-23-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 3 --- tests/data/acpi/pc/DSDT.hpbrroot | Bin 3260 -> 3309 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12637 -> 12678 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8114 -> 8188 bytes 4 files changed, 3 deletions(-) diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/pc/DSDT.hpbrroot index bfe0bf37180c0f0521d264d3e35b5f51feff2630..bee88c5ee815f0acf022b278876f0a212b1da84a 100644 GIT binary patch delta 134 zcmdlZ`Bsw4CDq#0Y(N938+q1Ms8h3 GB&`7G*&wt4 delta 85 zcmaDWxkr-ACDcQp~@f`7vEA0{{}H42A#z diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp index 44ee5e74c533f2c7554885b73adb947ed74b421f..c292c2369b011b779af44d0fa6fd2f7994098b2e 100644 GIT binary patch delta 199 zcmdmF|Hq!oCD=r+5K3t;rFx_Uh`vh8FQ0@s2J*JPZuX z3?kz3F2TM$1wt&0T&W35T!Ea7%&hE$$;)I_EG>hL5NcT&qMI~=4G;p13?dRx&8&>v lx{S!WU&$(%ng$yq6te?$s{|VuK&(d5`4w5`W;MAUMgVo#G5-Jn delta 125 zcmexkzsa7_A1_!3G8plNdG^$n`J+09-yC ANdN!< diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 70244976c9..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,4 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT.hpbrroot", -"tests/data/acpi/q35/DSDT.multi-bridge", -"tests/data/acpi/q35/DSDT.noacpihp", From patchwork Wed Mar 8 01:13:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CSZiRewH; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZKG1XfDz1yWt for ; Wed, 8 Mar 2023 12:21:38 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNH-0001WA-4C; Tue, 07 Mar 2023 20:13: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 1pZiMy-0000g4-Aj for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiMu-0001r6-3e for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238002; 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=cE1lvbrQD/be0DTValbD3GGh7xrknElB20eCW82+vjc=; b=CSZiRewHZWxahpUPLRn5ddknkXBx4Vxdogqd7F3jl+zxQsQijqIvfcU0w316oD+DB7DCyF s1rnN87L7utI21FhRUlxqMsAYSaPNJQMOE+YmjqRLNpPaM3gOEYJzjlCReL2JbGXnjVR5J THXSBqhYkew/W3RhxJNptHdv/GKHg5E= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-586-SSy2PBXfPmKjW0Zxp8WnJQ-1; Tue, 07 Mar 2023 20:13:21 -0500 X-MC-Unique: SSy2PBXfPmKjW0Zxp8WnJQ-1 Received: by mail-ed1-f72.google.com with SMTP id y1-20020a056402358100b004ea439d57b7so9288845edc.12 for ; Tue, 07 Mar 2023 17:13:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238000; 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=cE1lvbrQD/be0DTValbD3GGh7xrknElB20eCW82+vjc=; b=YOsCDlOJM+OJbA/GSKoCfGRWNZi8ACnQb8Mqu5/uQ2X4QUgpwW0Vk3957nXed9Dyfe 79f6KfueJ59KXKZ9lRYGYvU93NABy+mAirmguGpsZ3h3MM2euoNBvdzG7LIJgOxD44kE FJaMSEQ15WdMKdRXKmjSm0yyhvvwESdu64MhKbvLTwCMjgOmvOMu51IvP0wtYDC2Ksfn hXTJyUiUDQuapS69GzzM6zToZ4bGSdtqP24Wgi/RyG6d6b5fr5KmbNEIJGxxytEzejRX j4blN8G+Y8oAisu93+pOmAmFpJw4lhA1WEs0k/VjvZHL3MW6JKHXTPHpxKS4vPYPEkZl lKWQ== X-Gm-Message-State: AO0yUKUwHIbocdFAjMF4roiG28ZvnpshMoPYqrIvUqmcTaZ5/J0UW4Hp zrVAY7W54ZU0NHSoOVsKK5U/bUg8vuAdqKGBbJaij7ViKMZpSajMO6ovTEn23qS4HwT8TD9kS8G 5mDD/LoAoFegU04yDvh57UIPpiBWOqh1OzObX9EUZXNof8j8vFRLI/Z58JvkxSgNjUlXM X-Received: by 2002:a17:906:1411:b0:8b1:779c:a8ac with SMTP id p17-20020a170906141100b008b1779ca8acmr16877988ejc.13.1678237999927; Tue, 07 Mar 2023 17:13:19 -0800 (PST) X-Google-Smtp-Source: AK7set9UKOlRdfVIWchOoTPTst9M1aU83fP7chv5pMzY9Nl1Tk4rBgvvh66qmNs7YVxC7ZwRrkjLaQ== X-Received: by 2002:a17:906:1411:b0:8b1:779c:a8ac with SMTP id p17-20020a170906141100b008b1779ca8acmr16877973ejc.13.1678237999682; Tue, 07 Mar 2023 17:13:19 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id bj8-20020a170906b04800b008d85435f914sm6841593ejb.98.2023.03.07.17.13.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:19 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:16 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 49/73] tests: acpi: whitelist DSDT before exposing non zero functions 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-24-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..8911b10650 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,38 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/pc/DSDT", +"tests/data/acpi/pc/DSDT.acpierst", +"tests/data/acpi/pc/DSDT.acpihmat", +"tests/data/acpi/pc/DSDT.bridge", +"tests/data/acpi/pc/DSDT.cphp", +"tests/data/acpi/pc/DSDT.dimmpxm", +"tests/data/acpi/pc/DSDT.hpbridge", +"tests/data/acpi/pc/DSDT.hpbrroot", +"tests/data/acpi/pc/DSDT.ipmikcs", +"tests/data/acpi/pc/DSDT.memhp", +"tests/data/acpi/pc/DSDT.nohpet", +"tests/data/acpi/pc/DSDT.numamem", +"tests/data/acpi/pc/DSDT.roothp", +"tests/data/acpi/q35/DSDT", +"tests/data/acpi/q35/DSDT.acpierst", +"tests/data/acpi/q35/DSDT.acpihmat", +"tests/data/acpi/q35/DSDT.acpihmat-noinitiator", +"tests/data/acpi/q35/DSDT.applesmc", +"tests/data/acpi/q35/DSDT.bridge", +"tests/data/acpi/q35/DSDT.core-count2", +"tests/data/acpi/q35/DSDT.cphp", +"tests/data/acpi/q35/DSDT.cxl", +"tests/data/acpi/q35/DSDT.dimmpxm", +"tests/data/acpi/q35/DSDT.ipmibt", +"tests/data/acpi/q35/DSDT.ipmismbus", +"tests/data/acpi/q35/DSDT.ivrs", +"tests/data/acpi/q35/DSDT.memhp", +"tests/data/acpi/q35/DSDT.mmio64", +"tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/q35/DSDT.noacpihp", +"tests/data/acpi/q35/DSDT.nohpet", +"tests/data/acpi/q35/DSDT.numamem", +"tests/data/acpi/q35/DSDT.pvpanic-isa", +"tests/data/acpi/q35/DSDT.tis.tpm12", +"tests/data/acpi/q35/DSDT.tis.tpm2", +"tests/data/acpi/q35/DSDT.viot", +"tests/data/acpi/q35/DSDT.xapic", From patchwork Wed Mar 8 01:13:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PYwx1/p0; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJZ3QKxz1yWp for ; Wed, 8 Mar 2023 12:21:02 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNH-0001VQ-3m; Tue, 07 Mar 2023 20:13: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 1pZiN1-0000hT-72 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:35 -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 1pZiMx-0001rh-Tx for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238005; 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=Uqi1rrzUPnYKXVFI3/Tctah8op09lI3yLaNvKTATt4k=; b=PYwx1/p0fh5/l+Owlwj0ievJmUg+AxQkbFzTwGZsGfeMw+XZWhq35DdFywyFwvxhAEpboW E4f6Vr8goB55/srIB9ZB+eCz8eL/uh0mDABFoXivy4W9y+2q/AxxDuwJQAN43rIgVpGf0h i5Tk2cXVfB70RB79abEpDaI4l5mHTog= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-219-gA9-lDCxPtWudyaTRR7lxg-1; Tue, 07 Mar 2023 20:13:24 -0500 X-MC-Unique: gA9-lDCxPtWudyaTRR7lxg-1 Received: by mail-ed1-f71.google.com with SMTP id ec11-20020a0564020d4b00b004e2cb85c8bcso12390434edb.16 for ; Tue, 07 Mar 2023 17:13:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238003; 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=Uqi1rrzUPnYKXVFI3/Tctah8op09lI3yLaNvKTATt4k=; b=FriiopwlpA2k4yss1EETWL8UXBaRmGOONDnn8kQ8B0v+ww1O9FrMR89F6Yj0AyLp+A 5XIlHfVNURH1017axvcewoZvdwCijaMZ2tDfHGRoM5yFJK4tW8oPbfkvAqy6T1jFROw4 2t0BRWZ+ACl2iPPGC8YvVdPZ+9Wvsi33PJydhBu54wVLgwuxmv91bxAqaXIiad1z3333 ii6XkQZrJiQzjgQqvcGkYbXdwIm0nOJA9oO0ZySqPP4zgYJRNOXLVXXIpJqgueAlHdZ0 aB/mUwjofKc9oMjC00WTLLs9diNiElqbbBaPAPpSK+0Wns9gmNxEMO/NXcb19GUkMv4c unlQ== X-Gm-Message-State: AO0yUKXDVOgqfKPN1b3HAmdKduU0/a/GsqwiiTT2JANB9YEvKJEximv9 ZevDLlIY6JOS3rUA4224NXcVR9O5QywFnyfYJiBJiFIPhP85WY+Y6voAva3rKmxYtbw7zApzwMB Wu5nZAkSYQnulQKbgjq4bM2W9KBozvYVTUSZPoo8JV1VuGbv1mSIYmnn5+P5+wHdxP1/t X-Received: by 2002:a17:907:9b03:b0:8f0:9566:c1ff with SMTP id kn3-20020a1709079b0300b008f09566c1ffmr17493610ejc.69.1678238003236; Tue, 07 Mar 2023 17:13:23 -0800 (PST) X-Google-Smtp-Source: AK7set/gD0CvcNpgs38R5f24AQLz8rdDdHsjJ5O+GsldOxrw+WlfhechauuTc7bnnHsl05DXAczksw== X-Received: by 2002:a17:907:9b03:b0:8f0:9566:c1ff with SMTP id kn3-20020a1709079b0300b008f09566c1ffmr17493593ejc.69.1678238002937; Tue, 07 Mar 2023 17:13:22 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id o18-20020a170906769200b008dedf1359a0sm6784280ejm.104.2023.03.07.17.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:22 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:20 -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 50/73] acpi: pci: describe all functions on populated slots Message-ID: <05a49b9c2fbe79661ac185aa4389ab250e2d689a.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov describing all present devices on functions other than 0 was complicated when non hotplug and hotplug code was intermixed. So QEMU has been excluding non zero functions since they are not supported by hotplug code, then a condition to whitelist coldplugged bridges was added and later whitelisting of devices that advertise presence of their own AML description. With non hotplug and hotplug code separated, it is possible to relax rules and allow describing all non-hotpluggble functions and hence simplify conditions whether PCI device should be enumerated by generic (non-hotplug) code. Price of that simplification is an extra few Device() descriptors in DSDT exposing built-in chipset functions, which has no functional effect on guest side. Apart from that, the enumeration of non zero functions, allows to attach more NICs with acpi-index enabled directly on hostbridge (if hotplug is not required). Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-25-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 46f78e9338..8e2481fe5e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -494,12 +494,6 @@ static bool is_devfn_ignored_generic(const int devfn, const PCIBus *bus) if (DEVICE(pdev)->hotplugged) { return true; } - } else if (!get_dev_aml_func(DEVICE(pdev))) { - /* - * Ignore all other devices on !0 functions unless they - * have AML description (i.e have get_dev_aml_func() != 0) - */ - return true; } } return false; From patchwork Wed Mar 8 01:13:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=I1N/2QAC; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJV0cSYz1yWp for ; Wed, 8 Mar 2023 12:20:58 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNI-0001ko-GN; Tue, 07 Mar 2023 20:13: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 1pZiN7-0000pf-Of for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:39 -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 1pZiN2-0001tR-9a for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238011; 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=Gr8sM8UcBFUoAJw1vANV+QfvK9w9njNSg2CczAsAkbw=; b=I1N/2QACUY7KDkTZ063Sp1WzBMHsS/w3Gc4Hys3ZThIUqHNd5WhnTILzmrdwKnHuM1eJHQ 9Bf7AvOqao5g8VY6fCqek2MHvC+fxMVEd21wS+DKZzI4kyDFlIpXZdBPSXxSKgeuf4bjft pa/2Q4sq/UbgwzhF2+s2HgeXctPOvu0= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-222-pgdBX2GjPBaRjrDt0o9T_w-1; Tue, 07 Mar 2023 20:13:27 -0500 X-MC-Unique: pgdBX2GjPBaRjrDt0o9T_w-1 Received: by mail-ed1-f72.google.com with SMTP id fi8-20020a056402550800b004a26cc7f6cbso21410502edb.4 for ; Tue, 07 Mar 2023 17:13:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238006; 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=Gr8sM8UcBFUoAJw1vANV+QfvK9w9njNSg2CczAsAkbw=; b=18KqQovVZSr74g2xp6lG1xk4NwhGAh2RgABhM5n8hDWS66qJkoFkteCNu7dppeC+AX xXuTqr1KX5bUe5FJM7iSN6Th2i/5JFC4iv7fkEMpUzQe3V/b7rQJLNKjZr4xyrR9raPQ sz1s/RzTxvTXYNv7YiLYoI6YX/tM5Fsw2+aEW8gRbiyFilog7FzhDJMMMd2jukrQgD0L Qt/amMvQHpcSSBmdAqAvJhVGpmBzgLrI+DnDcOpfC15flErn6mqxd7rJ8mJLfIyE5njB +Z3QOovb/GbmNYMGykJE39e6FfJrSbXKYOb5HdopeOlq883/SQRElVtt/b/SHOk5gxEN 6k2A== X-Gm-Message-State: AO0yUKWZVgw1V+VoGOt2GGHhr+k4t2CUjvbworudTSZ6TR+DX5l0f/ux ENifhpfxohTMu9kfOxAKlfplZLOgPEYIwrM2dGwskxgFvQx/EmzsIP2PGdRbSKCnTtwMzVyi7br 6WRLOAKTrh1Rn0vAvc+oYVzUpTCXEQ/rh9ZDEUj4IwSkKkK1UGdbChVNizId0oXBn8VA3 X-Received: by 2002:a05:6402:7ce:b0:4af:6408:699a with SMTP id u14-20020a05640207ce00b004af6408699amr13891230edy.1.1678238006049; Tue, 07 Mar 2023 17:13:26 -0800 (PST) X-Google-Smtp-Source: AK7set+h7IilFCpYYa2KlYzdjkeO4Ffnwq1u1/Zax7bHTewRZe9i199/bpoJj+vCT3z/R14o8e7yKA== X-Received: by 2002:a05:6402:7ce:b0:4af:6408:699a with SMTP id u14-20020a05640207ce00b004af6408699amr13891213edy.1.1678238005664; Tue, 07 Mar 2023 17:13:25 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id q2-20020a50cc82000000b004acbda55f6bsm7422566edi.27.2023.03.07.17.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:25 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:23 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 51/73] tests: acpi: update expected blobs Message-ID: <05041d20d7fd264c71b63de5aa176da156805be8.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov in PC machine case piix3-ide and PIIX4_PM get exposed + Device (S09) + { + Name (_ADR, 0x00010001) // _ADR: Address + } + + Device (S0B) + { + Name (_ADR, 0x00010003) // _ADR: Address + } in q35 machine case ich9-ahci gets exposed + Device (SFA) + { + Name (_ADR, 0x001F0002) // _ADR: Address + } and addtional pci-testdev, virtio-balloon exposed in q35 multi-bridge test case + Device (S14) + { + Name (_ADR, 0x00020004) // _ADR: Address + } + ... + Device (S22) + { + Name (_ADR, 0x00040002) // _ADR: Address + } Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-26-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 37 ------------------ tests/data/acpi/pc/DSDT | Bin 6454 -> 6488 bytes tests/data/acpi/pc/DSDT.acpierst | Bin 6377 -> 6411 bytes tests/data/acpi/pc/DSDT.acpihmat | Bin 7779 -> 7813 bytes tests/data/acpi/pc/DSDT.bridge | Bin 12581 -> 12615 bytes tests/data/acpi/pc/DSDT.cphp | Bin 6918 -> 6952 bytes tests/data/acpi/pc/DSDT.dimmpxm | Bin 8108 -> 8142 bytes tests/data/acpi/pc/DSDT.hpbridge | Bin 6417 -> 6451 bytes tests/data/acpi/pc/DSDT.hpbrroot | Bin 3309 -> 3343 bytes tests/data/acpi/pc/DSDT.ipmikcs | Bin 6526 -> 6560 bytes tests/data/acpi/pc/DSDT.memhp | Bin 7813 -> 7847 bytes tests/data/acpi/pc/DSDT.nohpet | Bin 6312 -> 6346 bytes tests/data/acpi/pc/DSDT.numamem | Bin 6460 -> 6494 bytes tests/data/acpi/pc/DSDT.roothp | Bin 9839 -> 9873 bytes tests/data/acpi/q35/DSDT | Bin 8344 -> 8361 bytes tests/data/acpi/q35/DSDT.acpierst | Bin 8361 -> 8378 bytes tests/data/acpi/q35/DSDT.acpihmat | Bin 9669 -> 9686 bytes tests/data/acpi/q35/DSDT.acpihmat-noinitiator | Bin 8623 -> 8640 bytes tests/data/acpi/q35/DSDT.applesmc | Bin 8390 -> 8407 bytes tests/data/acpi/q35/DSDT.bridge | Bin 11573 -> 11590 bytes tests/data/acpi/q35/DSDT.core-count2 | Bin 32484 -> 32501 bytes tests/data/acpi/q35/DSDT.cphp | Bin 8808 -> 8825 bytes tests/data/acpi/q35/DSDT.cxl | Bin 9656 -> 9673 bytes tests/data/acpi/q35/DSDT.dimmpxm | Bin 9998 -> 10015 bytes tests/data/acpi/q35/DSDT.ipmibt | Bin 8419 -> 8436 bytes tests/data/acpi/q35/DSDT.ipmismbus | Bin 8432 -> 8449 bytes tests/data/acpi/q35/DSDT.ivrs | Bin 8361 -> 8378 bytes tests/data/acpi/q35/DSDT.memhp | Bin 9703 -> 9720 bytes tests/data/acpi/q35/DSDT.mmio64 | Bin 9474 -> 9491 bytes tests/data/acpi/q35/DSDT.multi-bridge | Bin 12678 -> 12729 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8188 -> 8205 bytes tests/data/acpi/q35/DSDT.nohpet | Bin 8202 -> 8219 bytes tests/data/acpi/q35/DSDT.numamem | Bin 8350 -> 8367 bytes tests/data/acpi/q35/DSDT.pvpanic-isa | Bin 8445 -> 8462 bytes tests/data/acpi/q35/DSDT.tis.tpm12 | Bin 8950 -> 8967 bytes tests/data/acpi/q35/DSDT.tis.tpm2 | Bin 8976 -> 8993 bytes tests/data/acpi/q35/DSDT.viot | Bin 9453 -> 9470 bytes tests/data/acpi/q35/DSDT.xapic | Bin 35707 -> 35724 bytes 38 files changed, 37 deletions(-) diff --git a/tests/data/acpi/pc/DSDT b/tests/data/acpi/pc/DSDT index 521062a756d1fcd5939683e41071d29407a45b22..32d255cfc0a207c89bf8459edaca11fad12979e9 100644 GIT binary patch delta 72 zcmdmHbi;_tCDXro#F*tFKm9veVS38KiI%Bo+IATC5VTS WfsrA)2`JzM6<}sy+`N&ul^Xyg{1i$6 delta 40 wcmca%w9SaiCDquj=ZJT73F2X7 WU}T7H0tz@m1(+EaH*e&%;06Hf%o7j* delta 40 wcmeA+dTGez66_N4Qi6ejk!vH@RcgAFX>IpQ5%f_NAi V7#X6QfC5fX0cHlq&G&>_xdG9V62Jfe delta 40 wcmZp*eQd+!66_L^EXTmW=)RGQNs!C?TugkhQ@nulxy@pNrx`ah3pa5C0PMvJp#T5? diff --git a/tests/data/acpi/pc/DSDT.bridge b/tests/data/acpi/pc/DSDT.bridge index 219ddba2713015616e41c19f66d891c63b05e4ab..69a73ea2a691de387b82bf85a7ba1a2279c01a0c 100644 GIT binary patch delta 73 zcmZ3QbUca6CDT_Rc`K1Po|joV5fM22G7l}xX&=k^9LJP#&g6wx&-ks XGB7ekHvt8lpaRScjGH&}7AXS&{T>rr delta 41 xcmX?}v^0s!CDquj=ZJT73F2X7 WU}T7H0tz@m1(+EaH#hRPasvR%(-NKl delta 40 wcmZ2s)@H`#66_MfCe6UW_--TDQeH0ab20J3PVoZH=Qi);JqXro#F*tFKmt%I?X80A8cS5&k^tF62!yE Wz{n8Y1Qc+B3NSM;ZdMm*qN0ssI2 diff --git a/tests/data/acpi/pc/DSDT.hpbrroot b/tests/data/acpi/pc/DSDT.hpbrroot index bee88c5ee815f0acf022b278876f0a212b1da84a..a4073f36d686201296455e142e3bcbb2f368bbd2 100644 GIT binary patch delta 71 zcmaDW*)PTA66_Mf&&$BT_;w?g4HuWEPE35TQ@ntq&gKBF(~R=`!3LJ`9Py4WK|G8M Uj119DKmjMH05b#QWC@=r+5K>&CLN^rx_>P@>~J{=n)Io diff --git a/tests/data/acpi/pc/DSDT.ipmikcs b/tests/data/acpi/pc/DSDT.ipmikcs index 3a19ce439825c2aa97adee3a965ac050dec6f2d0..06aa7bfdeca40e10ee8411eeda08486599b90e39 100644 GIT binary patch delta 72 zcmexow7{6lCDT_Rcquj=ZJT73F2X7 VU}T7H0tz@m1(+EaHwm|L0|3mt5<&m~ delta 40 wcmZ2(+iJ_@66_MvD#yUUShJB!MUcz;TugkhQ@nulxy=@Wrx`b^3O8{B0P>CuBLDyZ diff --git a/tests/data/acpi/pc/DSDT.nohpet b/tests/data/acpi/pc/DSDT.nohpet index 4fd4d38e5ffe889fed812b67d3d7b1825325e909..6905312d827502e8bb5852418cf58290eda8d86b 100644 GIT binary patch delta 72 zcmZ2sc*>B=CDquj=ZJT73F2X7 WU}T7H0tz@m1(+EaH!JhDasvSLxe~nq delta 40 wcmX?QxWbUjCDcWy54b20J3PVoZH=Qc-kpJv?b!P~?Q0R2Y{od5s; diff --git a/tests/data/acpi/pc/DSDT.numamem b/tests/data/acpi/pc/DSDT.numamem index 4cfb3765c5c5c7cf73732f2d3fd5bf9932399c14..59e31338eeb3a84c39ed3ae63105226ce2ad1125 100644 GIT binary patch delta 72 zcmdmEbkB&(CD)ikK_y7O^ diff --git a/tests/data/acpi/pc/DSDT.roothp b/tests/data/acpi/pc/DSDT.roothp index 8b695cca83c04b4123986e1334d0c57ddb22687d..448d596cf413d7e487af114e5c80bc73311d17f9 100644 GIT binary patch delta 73 zcmaFwGtrmJCDYGM*#e(Itq7 Xk%5sRx(O)Y1QlRrVBEZ!caH=BIGPl> delta 41 xcmbQ}``(AkCD;ND;y%N;`3CP!2>=@34w(P| diff --git a/tests/data/acpi/q35/DSDT b/tests/data/acpi/q35/DSDT index 3dadeba912d9133f0ccb6e9b89a22ca7dc43f18f..720e8cbbbb10d86a458027b5cb47884bf8c5ee78 100644 GIT binary patch delta 51 zcmbQ?xYCi!CDtp10jOU1VbP3{NVvwI) HsUQykodFKD delta 39 vcmZ4KIKz?4CDtmceK|vA#@?8u- diff --git a/tests/data/acpi/q35/DSDT.acpierst b/tests/data/acpi/q35/DSDT.acpierst index 7e43fa88c39737198427744ddb8d902edd517794..f26b1f2a19529c508d53ed3f434be0083c18dbab 100644 GIT binary patch delta 51 zcmZ4KxXY2tCDkW5h--E)^~pshId+r+5J$$<1;qeTSzl! diff --git a/tests/data/acpi/q35/DSDT.acpihmat-noinitiator b/tests/data/acpi/q35/DSDT.acpihmat-noinitiator index 631a1048fc01a3c84aadfdea8e0eccc36c68d8a4..a894a2d16c81fff8ade2c5ddb20858a03169fd47 100644 GIT binary patch delta 51 zcmZ4Qe88E@CD&6RN diff --git a/tests/data/acpi/q35/DSDT.applesmc b/tests/data/acpi/q35/DSDT.applesmc index cb117fd671effe2557a41115015b57df87d7936b..276ae1df511346ccd286216c6de03cd56db410fd 100644 GIT binary patch delta 51 zcmX@+c-@i9CD_ZxGN8h delta 39 vcmccac+8Q@CDWA{d`yK-DkvN7?&PVoX>GMhij?O~j}PeBp@1)dEU diff --git a/tests/data/acpi/q35/DSDT.bridge b/tests/data/acpi/q35/DSDT.bridge index cdfd51ce70d7201fa827bfabfd23e413596b1094..9f8a208aaadc167135e59839eefcd5b594c2f28a 100644 GIT binary patch delta 51 zcmdlQbu5a@CD52&T{$lAyD{;>PVoZHcQ=2O+rrE37|#*!=n}-k#2`O; HzRolNyG;WwKa;%CDEb5R3o- delta 41 xcmezRm+{G8MlP3NmyjoQ3=E9hHgaj!a=A#w#0NXY3;0NGwyo`BoP4KF5&%+z4;KIc diff --git a/tests/data/acpi/q35/DSDT.cphp b/tests/data/acpi/q35/DSDT.cphp index 1837442bd39f1249fb753530ea508d05e8d177f4..612c85b1b4c8e4cc642734b1d52f5d5e1e2ec4eb 100644 GIT binary patch delta 51 zcmaFi^3#ROCD6rLnr+5Khsm%u!`WU$#<2m9TU4nR+8005= HD#-%?l?e_9 delta 39 vcmezA^1_A7CDXHE0WeRBk diff --git a/tests/data/acpi/q35/DSDT.ipmibt b/tests/data/acpi/q35/DSDT.ipmibt index c552e668983198d077348a57a5b22065d01b40f1..541bb70522e72dd477f72cba2f71a336f6978de4 100644 GIT binary patch delta 78 zcmaFt_{EXSCDu1FT9ThGYshId+r+5J$$;}QbeT&R|7)^0KR|?Qvd(} diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index 595ab64601ae3deb12bbf18ca463e39ba0a86195..4e4b5229502000550f169948393ba8cbc7a793d5 100644 GIT binary patch delta 92 zcmZom-kHqh66_MP(~yCI@$N>hyK>xpyo@pN!A|i4t-PB*$r&^8^9LK6#B;h)X%@o6VHqX=LVp_aY Gp9uhq*bim^ diff --git a/tests/data/acpi/q35/DSDT.noacpihp b/tests/data/acpi/q35/DSDT.noacpihp index c292c2369b011b779af44d0fa6fd2f7994098b2e..1c17aa30f7f0155a81988aa43c56e2f71530b4e4 100644 GIT binary patch delta 65 zcmexk-|N8T66_MftH8j(IAi!7I)R!n@bQ@nti*5(M=8B9D*@f`7vEdieNDU_d delta 39 ucmbR3(B;7866_MfrNF?zn6i<}UyjQ~DkeVIDPF)wa&xj=ALC>u1xWzKnhCQ2 diff --git a/tests/data/acpi/q35/DSDT.numamem b/tests/data/acpi/q35/DSDT.numamem index 5e94a2b61f840c68d27257831cf608d41ee7c154..0cdec0b4c53b2b0e38cd019caab552f66f7728e7 100644 GIT binary patch delta 51 zcmbQ|xZaV=CDrrDNiQo#F+2r8a+;>tp10jOU1VbP3{NVvwI) HuOJTql|2rF delta 39 vcmZ4QIM0#GCDK$66_N4SAl_n(QhNyT{$jKg_!tYr+5KJh0P!3J~K}Ksvrpf1%wTB diff --git a/tests/data/acpi/q35/DSDT.tis.tpm12 b/tests/data/acpi/q35/DSDT.tis.tpm12 index fc6cc4585a6b1d955bc80700ec2dc2720b7e4a89..628bf628f6891f906bf872f8916692ba0ccb6877 100644 GIT binary patch delta 51 zcmez7+U~~X66_MfuFSx|sJ4;or5u;LLri?IQ@nt`{pP=N516?f<2m9TU4nR+8005k HSCR(+ghURd delta 39 vcmZp7`{v5!66_N4O^Jbl@ytf9mvUTg_A&9nPVoYMcANjoJz$>vPDv5~6zvW$ diff --git a/tests/data/acpi/q35/DSDT.tis.tpm2 b/tests/data/acpi/q35/DSDT.tis.tpm2 index 815006e445d0ec44c2f4a7c8d30ead6616a32b32..35c6b08068d4d2fb0353802dc2460cc2912c129c 100644 GIT binary patch delta 51 zcmbQ>w$P2sCD9yaxwA2PVoW`a+{fyFELJjsv-#h4V?_h diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic index 8cf5b9703d617d0a0b16d41cd713f7883c80fcfe..d4a34e23512c295f73abbe5ef1370fac7a1a06cd 100644 GIT binary patch delta 53 zcmex8jj3lk6PHV{OGr;Q0|Volja&yhxm=}V;)9*y1$?D8U+L^);$TrN^E@xe~<0zQ(PuXOe?PA=}21OOw$4kG{n diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index 8911b10650..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,38 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/pc/DSDT", -"tests/data/acpi/pc/DSDT.acpierst", -"tests/data/acpi/pc/DSDT.acpihmat", -"tests/data/acpi/pc/DSDT.bridge", -"tests/data/acpi/pc/DSDT.cphp", -"tests/data/acpi/pc/DSDT.dimmpxm", -"tests/data/acpi/pc/DSDT.hpbridge", -"tests/data/acpi/pc/DSDT.hpbrroot", -"tests/data/acpi/pc/DSDT.ipmikcs", -"tests/data/acpi/pc/DSDT.memhp", -"tests/data/acpi/pc/DSDT.nohpet", -"tests/data/acpi/pc/DSDT.numamem", -"tests/data/acpi/pc/DSDT.roothp", -"tests/data/acpi/q35/DSDT", -"tests/data/acpi/q35/DSDT.acpierst", -"tests/data/acpi/q35/DSDT.acpihmat", -"tests/data/acpi/q35/DSDT.acpihmat-noinitiator", -"tests/data/acpi/q35/DSDT.applesmc", -"tests/data/acpi/q35/DSDT.bridge", -"tests/data/acpi/q35/DSDT.core-count2", -"tests/data/acpi/q35/DSDT.cphp", -"tests/data/acpi/q35/DSDT.cxl", -"tests/data/acpi/q35/DSDT.dimmpxm", -"tests/data/acpi/q35/DSDT.ipmibt", -"tests/data/acpi/q35/DSDT.ipmismbus", -"tests/data/acpi/q35/DSDT.ivrs", -"tests/data/acpi/q35/DSDT.memhp", -"tests/data/acpi/q35/DSDT.mmio64", -"tests/data/acpi/q35/DSDT.multi-bridge", -"tests/data/acpi/q35/DSDT.noacpihp", -"tests/data/acpi/q35/DSDT.nohpet", -"tests/data/acpi/q35/DSDT.numamem", -"tests/data/acpi/q35/DSDT.pvpanic-isa", -"tests/data/acpi/q35/DSDT.tis.tpm12", -"tests/data/acpi/q35/DSDT.tis.tpm2", -"tests/data/acpi/q35/DSDT.viot", -"tests/data/acpi/q35/DSDT.xapic", From patchwork Wed Mar 8 01:13:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aeo0l8UK; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBH1Mx5z1yWt for ; Wed, 8 Mar 2023 12:15:35 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNC-0000zT-VY; Tue, 07 Mar 2023 20:13: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 1pZiN5-0000nq-Rj for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:38 -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 1pZiN3-0001tV-M5 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238011; 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=6GlQWF7RM0/vFabPNXHud7W0nOaWqrKzuNGguVzygmA=; b=aeo0l8UKlD+o7UoFyExpdeCSsiMZJg+e5wpedO0twlCLG1MB/3GWIJh7c+UV8s8cDkZlcF JuhnHBDyYeLyBzNSc3GwpnHsJe7+IDU6sabWdpTGGMUtCpoqEZ4SccsHsw9jAk05kqa2Ga pizZTrZY5j/XPvXLXqXFFIV0+lofSzY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-58-i1AzUJTtPDKUiESE56mRxA-1; Tue, 07 Mar 2023 20:13:30 -0500 X-MC-Unique: i1AzUJTtPDKUiESE56mRxA-1 Received: by mail-ed1-f70.google.com with SMTP id u10-20020a056402064a00b004c689813557so21168692edx.10 for ; Tue, 07 Mar 2023 17:13:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238008; 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=6GlQWF7RM0/vFabPNXHud7W0nOaWqrKzuNGguVzygmA=; b=WMf6DSRJdIbMJspH/kf1RPpVuKEjBTnLZsL+wKAw7nnodP6lTjOgBw3DrOMrKs6mDN 4CVxnsyFLo3szUlYgq8KDf/idNSZLdqvEwc/KyUzIbKb0zmRNgQZCc9YLZHgKVC6AlRe ucrDYP5Jh5kMgLnCwB6/yy2pqpj/eQ6vTwOIkSffchZaaKip4CNhJ2B4SYPwpL+Ol0LH 5l+T3jp1GXfLer99J5Kq1CWKbbdzVJLMGtP8S851FI2A0Tfk47CAs954VqMlTHQKasVP 32SYxa3ndNWRUuYUhBOYMv8PAF3fOh2xD00uLAo7tjwAekdHBb1lL1LjOnNrapNVZ915 nlmA== X-Gm-Message-State: AO0yUKWYPc3vLhGbKtld9zjNupgQFdZ71Ux9Ferrqwij1H8YJlmCJUaq mX5hFEQUmE25A3vQqQelfpzmSo5QyectPMTOkcvxzE0jevWdt190qVjQ/UUmPpkCz+Iw2+/TLDd qbjjYn2rflhNg9vA+zCGvY/Y9tuw5Nf4bed/eZkuiyWFBuayiN92QS2rqtG8jN4WrbHco X-Received: by 2002:a17:906:a0d8:b0:8f3:dc49:d8eb with SMTP id bh24-20020a170906a0d800b008f3dc49d8ebmr14881305ejb.71.1678238008781; Tue, 07 Mar 2023 17:13:28 -0800 (PST) X-Google-Smtp-Source: AK7set+sTd7AfHn2MSJjl7vvaKXowcloy6adoBCW8+KSxZOxprS0feTy+WegvgjpHmvUXNFdeBM9xQ== X-Received: by 2002:a17:906:a0d8:b0:8f3:dc49:d8eb with SMTP id bh24-20020a170906a0d800b008f3dc49d8ebmr14881294ejb.71.1678238008586; Tue, 07 Mar 2023 17:13:28 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id j22-20020a1709066dd600b008e6bd130b14sm6829931ejt.64.2023.03.07.17.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:28 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:26 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 52/73] tests: acpi: whitelist DSDT before adding non-0 function device with acpi-index to testcases 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-27-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..ad2b429de8 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,3 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.multi-bridge", +"tests/data/acpi/q35/DSDT.noacpihp", From patchwork Wed Mar 8 01:13:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XudCQLUd; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBT0lb0z1yWr for ; Wed, 8 Mar 2023 12:15:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNE-0001Fj-NU; Tue, 07 Mar 2023 20:13:44 -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 1pZiN7-0000pg-QG for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:39 -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 1pZiN5-0001uS-Kd for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238013; 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=dYqHvsIH8FToDb11McSEqIC0K23NImaszE63Tu3v/ug=; b=XudCQLUdODnSKAOE9+ZAVcqCxDP7DNzL+mQu6wzOMDcEjymR7eyPZItOvzKqoB1zR7vHNq kFctcPYKfCvNyqZ26Uqmr/6mpxDth5haOHXyu7bNyjnzv3eYd6kJhMBE3ZX6LZX/vQVfss QvhssbleJShoa3xaqoSoZaA6AuzSN2M= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-319-cmlgmCoRNrGSyGGxM8clmw-1; Tue, 07 Mar 2023 20:13:32 -0500 X-MC-Unique: cmlgmCoRNrGSyGGxM8clmw-1 Received: by mail-ed1-f70.google.com with SMTP id y1-20020a056402358100b004ea439d57b7so9289441edc.12 for ; Tue, 07 Mar 2023 17:13:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238011; 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=dYqHvsIH8FToDb11McSEqIC0K23NImaszE63Tu3v/ug=; b=WYcRqJRCL1ESJaaqwjThCnt9d76bq+fcSxSlFhNk+Xdcx0SIzNyQYLonXcKHYcvFVE xFCka8b07PcOCBq08aoBbZ4T24rPChf5CqEe6ldyg51q319R21UQsa1/LDV/wv98vnYf Yc+dwi48ryB9KbmBZgquiJtMmzIth51yOSi10tGtq+GyFAxwXxZnAQNrXDE/n+onmZux Ir8KhRz/c+F7PRImKz4QZCDGeynNbPmFN+/Iu3OPRcqVSXSFRBKv/Ps9uA5xeQn7joJ5 WEeQVk0LgujiKDlBXP4uObX3Y52745iC5WA3cZDVEH8s1F5zQ+C1JhkTY2Xrki+qHmID hNdg== X-Gm-Message-State: AO0yUKWRK9+FncBILxOWXkdi2Vostd7nH+mNxmlWqkJlJWJL/2Yb9fK7 y0zHOL189QF+dFo69up/i4pDm/59LrNhrrNhSH4MDjeXuYveoL+aGG0RBhxXYgZPqlfSsrnockQ Spr8QP9Ke+yp7JYeeNOEUphFKoWPoVQSKvqaAc5zO+nl/36oFOiT1K4TYbmQXleydExo8 X-Received: by 2002:a17:906:2297:b0:8f8:1501:be60 with SMTP id p23-20020a170906229700b008f81501be60mr13666825eja.7.1678238011373; Tue, 07 Mar 2023 17:13:31 -0800 (PST) X-Google-Smtp-Source: AK7set/bDVvUmLPbYXen7PYZ9gvr38X89+BLOhcqqx8FJbMiwLFDwSrf59y1oTE7NB7+p8MRXKnAOg== X-Received: by 2002:a17:906:2297:b0:8f8:1501:be60 with SMTP id p23-20020a170906229700b008f81501be60mr13666808eja.7.1678238011098; Tue, 07 Mar 2023 17:13:31 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id rp21-20020a170906d97500b008de50990fa7sm6732223ejb.21.2023.03.07.17.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:30 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 53/73] tests: acpi: add non zero function device with acpi-index on non-hotpluggble bus 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-28-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index d7c34ba504..76d5100911 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1028,10 +1028,11 @@ static void test_acpi_q35_tcg_no_acpi_hotplug(void) "addr=7.0" " -device pci-testdev,bus=nohprp,acpi-index=501" " -device pcie-root-port,id=nohprpint,port=0x0,chassis=3,hotplug=off," - "addr=8.0" + "multifunction=on,addr=8.0" + " -device pci-testdev,bus=nohprpint,acpi-index=601,addr=8.1" " -device pcie-root-port,id=hprp2,port=0x0,chassis=4,bus=nohprpint," "addr=9.0" - " -device pci-testdev,bus=hprp2,acpi-index=601" + " -device pci-testdev,bus=hprp2,acpi-index=602" , &data); free_test_data(&data); } @@ -1053,6 +1054,7 @@ static void test_acpi_q35_multif_bridge(void) " -device pcie-root-port,id=rphptgt2,port=0x0,chassis=6,addr=2.2" " -device pcie-root-port,id=rphptgt3,port=0x0,chassis=7,addr=2.3" " -device pci-testdev,bus=pcie.0,addr=2.4" + " -device pci-testdev,bus=pcie.0,addr=2.5,acpi-index=102" " -device pci-testdev,bus=pcie.0,addr=5.0" " -device pci-testdev,bus=pcie.0,addr=0xf.0,acpi-index=101" " -device pci-testdev,bus=rp0,addr=0.0" From patchwork Wed Mar 8 01:13:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Yl+tqoCM; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBG735sz1yWs for ; Wed, 8 Mar 2023 12:15:34 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNE-0001Ey-Mz; Tue, 07 Mar 2023 20:13:44 -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 1pZiNA-0000qq-4q for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiN8-0001vH-Hx for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238017; 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=gVzALV9eo73qgbhHi47U1gGIQnYGFFh3jdTc10kfp0c=; b=Yl+tqoCM8B0wzs3yzJmkyLZmv5J9XIrHEOlupBSmDWiflTucV1yeX2lH08BSjH9F0FHYf/ Fi8qjygUzULAIne2F1rNyFNIFSbQBrLAEWB1N+bgGIf01wxilrU2ib7zt15ceVRUwlHPA6 4WraIBP9cw9gDRFaMAt4N6NdAlrgVSE= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-196-nYsx62B-OIeydbRDAYHBDA-1; Tue, 07 Mar 2023 20:13:35 -0500 X-MC-Unique: nYsx62B-OIeydbRDAYHBDA-1 Received: by mail-ed1-f69.google.com with SMTP id d35-20020a056402402300b004e37aed9832so11984919eda.18 for ; Tue, 07 Mar 2023 17:13:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238014; 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=gVzALV9eo73qgbhHi47U1gGIQnYGFFh3jdTc10kfp0c=; b=hglj8/c2H/Q+rchmZs7G1UB0DTp6z7gAuSEiHcKa7WCeR0wT462oT9KIwYtmW5NgWZ Luv80vR8/veIBPUpNf9fPPvAj6Wndzptd74lzNRYXgffiNYgkMSdsANx8ijTXCE8mFIR Xqg25aM4YOB4yAaMJ71eHOLoc05dXO5Wm5gixhL9NaJqpOUbHzoAZeILeZG2uXjmuJfY 1bJ48+Uw6QruHgtJydMHMRKzEqpjncmxBByyQYPEsW8PSSiKdJtQK3hWG0jKn+62CXKJ SUbz5eFoFZ8VEu3oe0gBjJo5qFURblnFQBbNsA0EjFCoz8qUf8zBQh3KNF56IFxdiehT cjlQ== X-Gm-Message-State: AO0yUKVY/iBoZPzGzX2KbPm/dxyZQbI+OUuGaz8F7lBzjbgFyA+V6i8L 1Lx+TKyIefq/GyZ0xKeDGcv4EDoRb1yX9sB9LZ92y/tfII2M93Aj4jSxPxkJzQ0/anLRzA/3BhW eayrHHd3dBx9mQ0ip3EVfVkMwLrtVNp1+vC0Bxs6A4b80WDJBetUDxRuo7ksbn4dkkTv+ X-Received: by 2002:a17:907:2050:b0:8ae:6b88:e52d with SMTP id pg16-20020a170907205000b008ae6b88e52dmr20572116ejb.7.1678238014275; Tue, 07 Mar 2023 17:13:34 -0800 (PST) X-Google-Smtp-Source: AK7set+ugYhQPq6Uwp3CNuhdajdX7H4uES8UiWbe/X7DRuvDD2gnZUqSRTotND3P36jnkDz+AnlTnw== X-Received: by 2002:a17:907:2050:b0:8ae:6b88:e52d with SMTP id pg16-20020a170907205000b008ae6b88e52dmr20572100ejb.7.1678238014014; Tue, 07 Mar 2023 17:13:34 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id e5-20020a17090681c500b008d269233bd4sm6752406ejx.204.2023.03.07.17.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:33 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:31 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha Subject: [PULL 54/73] tests: acpi: update expected blobs Message-ID: <0a7044eb643d035e6c235ca94760a1e61d165cd6.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov an extra devices at non-zero function address with static _DSM method get exposed, ex: + Device (S15) + { + Name (_ADR, 0x00020005) // _ADR: Address + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Local0 = Package (0x01) + { + 0x66 + } + Return (EDSM (Arg0, Arg1, Arg2, Arg3, Local0)) + } + } Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-29-imammedo@redhat.com> --- tests/qtest/bios-tables-test-allowed-diff.h | 2 -- tests/data/acpi/q35/DSDT.multi-bridge | Bin 12729 -> 12770 bytes tests/data/acpi/q35/DSDT.noacpihp | Bin 8205 -> 8248 bytes 3 files changed, 2 deletions(-) diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index 4e4b5229502000550f169948393ba8cbc7a793d5..9ae8ee0b41738bd8951b9449abcfc67c293fdce1 100644 GIT binary patch delta 81 zcmdm){3w~rCD X-Patchwork-Id: 1753840 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FcxYQVGr; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZL452F7z1yWv for ; Wed, 8 Mar 2023 12:22:19 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNI-0001l4-Ll; Tue, 07 Mar 2023 20:13: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 1pZiND-00010k-0j for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiNA-0001vx-Kg for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238019; 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=MO4qORxRLOBc3/4AUP8HBqjXu+QcEdhXTFIaUTOEzYU=; b=FcxYQVGr3NHrMsWxU6aRZZxdq/YyTJ5cAwviG4m2vN5Dd8YcMsThNl2IQGkd1V3LVthWLL tGl58ccRVX3VnrRMYSYTUhpQG7792uAhJxiMHYtJjnak5vyg4vbNIT9pNENpITiYWFv/LP vjUmTqT79ql3ZjX2SHpj2c0oOaBoTjU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-4KPyGVjrN_m9dwebh3bb0g-1; Tue, 07 Mar 2023 20:13:38 -0500 X-MC-Unique: 4KPyGVjrN_m9dwebh3bb0g-1 Received: by mail-ed1-f70.google.com with SMTP id g2-20020a056402320200b004e98d45ee7dso9600750eda.0 for ; Tue, 07 Mar 2023 17:13:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238017; 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=MO4qORxRLOBc3/4AUP8HBqjXu+QcEdhXTFIaUTOEzYU=; b=vmeBQxZojkswcne7ICh6Sc468FYMmfDcdbD0h2o7rmDWo8LcFy7X673L2pW7a9NBDQ OFQKyJAOqnPpBcDWa/O4mL+x64HstC4jhhuYGEcH+bDB85r/uTohNrMCFysgjK9hQxFy Mx1uxtvu99WoRFuQ1x20ezrHr1ruozBK2priCx3tQhGjQZEzCBv45c1KEJ884U85OV4c GVnafM6dfW/F0o6+Uk55kVjeIBuZgKSnC4L5wYoDoMqjnLlcgNw1/tdvZjewaU9Jc1Kk nrQFOn5mIaRw3l7gKGdWI7gbKSWOhM/tj9tqSKkPUJ97RYbS1h3M7LbVG01as+M43nhl M5gA== X-Gm-Message-State: AO0yUKUbeKsyHk1ER7CumPUirzka823FXteLOu3bTzXT5q2IVZjFiyaU aea4V8ZVnaMVbDWaukkY+TfdO9MZLv6FhZV5Tc9ivxCQBDSn01YCg1oeoiAiSn+LJgQPLvKpjV6 Zt3rNF71dXdeJodmU+wkpRrskBrefUeMCP94qu5JStlHq9emjBcPJqdLIgptgx+2bpL7j X-Received: by 2002:a17:906:9451:b0:8e1:d996:dca2 with SMTP id z17-20020a170906945100b008e1d996dca2mr15205278ejx.64.1678238017129; Tue, 07 Mar 2023 17:13:37 -0800 (PST) X-Google-Smtp-Source: AK7set/qIsltI/lkzudNkjW9SrYpjPElR4/h1XRhBVwL6ijL07Zkvbo888nz7v+/LTLS2o7O83MKnA== X-Received: by 2002:a17:906:9451:b0:8e1:d996:dca2 with SMTP id z17-20020a170906945100b008e1d996dca2mr15205255ejx.64.1678238016776; Tue, 07 Mar 2023 17:13:36 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 20-20020a170906301400b008cf1b61a73esm6776563ejz.41.2023.03.07.17.13.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:36 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:34 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Marcel Apfelbaum Subject: [PULL 55/73] pci: move acpi-index uniqueness check to generic PCI device code Message-ID: <041b1c40f38a63baff7c375d1e3df6f365aa5882.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov acpi-index is now working with non-hotpluggable buses (pci/q35 machine hostbridge), it can be used even if ACPI PCI hotplug is disabled and as result acpi-index uniqueness check will be omitted (since the check is done by ACPI PCI hotplug handler, which isn't wired when ACPI PCI hotplug is disabled). Move check and related code to generic PCIDevice so it would be independent of ACPI PCI hotplug. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-30-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/acpi/pcihp.c | 56 ------------------------------------------------ hw/pci/pci.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 5dc7377411..adf45e8443 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -54,21 +54,6 @@ typedef struct AcpiPciHpFind { PCIBus *bus; } AcpiPciHpFind; -static gint g_cmp_uint32(gconstpointer a, gconstpointer b, gpointer user_data) -{ - return a - b; -} - -static GSequence *pci_acpi_index_list(void) -{ - static GSequence *used_acpi_index_list; - - if (!used_acpi_index_list) { - used_acpi_index_list = g_sequence_new(NULL); - } - return used_acpi_index_list; -} - static int acpi_pcihp_get_bsel(PCIBus *bus) { Error *local_err = NULL; @@ -300,8 +285,6 @@ void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off) acpi_pcihp_update(s); } -#define ONBOARD_INDEX_MAX (16 * 1024 - 1) - void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { @@ -314,34 +297,6 @@ void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, ACPI_PCIHP_PROP_BSEL "' set"); return; } - - /* - * capped by systemd (see: udev-builtin-net_id.c) - * as it's the only known user honor it to avoid users - * misconfigure QEMU and then wonder why acpi-index doesn't work - */ - if (pdev->acpi_index > ONBOARD_INDEX_MAX) { - error_setg(errp, "acpi-index should be less or equal to %u", - ONBOARD_INDEX_MAX); - return; - } - - /* - * make sure that acpi-index is unique across all present PCI devices - */ - if (pdev->acpi_index) { - GSequence *used_indexes = pci_acpi_index_list(); - - if (g_sequence_lookup(used_indexes, GINT_TO_POINTER(pdev->acpi_index), - g_cmp_uint32, NULL)) { - error_setg(errp, "a PCI device with acpi-index = %" PRIu32 - " already exist", pdev->acpi_index); - return; - } - g_sequence_insert_sorted(used_indexes, - GINT_TO_POINTER(pdev->acpi_index), - g_cmp_uint32, NULL); - } } void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, @@ -401,17 +356,6 @@ void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, trace_acpi_pci_unplug(PCI_SLOT(pdev->devfn), acpi_pcihp_get_bsel(pci_get_bus(pdev))); - /* - * clean up acpi-index so it could reused by another device - */ - if (pdev->acpi_index) { - GSequence *used_indexes = pci_acpi_index_list(); - - g_sequence_remove(g_sequence_lookup(used_indexes, - GINT_TO_POINTER(pdev->acpi_index), - g_cmp_uint32, NULL)); - } - qdev_unrealize(dev); } diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 034fe49e9a..def5000e7b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -95,6 +95,21 @@ static const VMStateDescription vmstate_pcibus = { } }; +static gint g_cmp_uint32(gconstpointer a, gconstpointer b, gpointer user_data) +{ + return a - b; +} + +static GSequence *pci_acpi_index_list(void) +{ + static GSequence *used_acpi_index_list; + + if (!used_acpi_index_list) { + used_acpi_index_list = g_sequence_new(NULL); + } + return used_acpi_index_list; +} + static void pci_init_bus_master(PCIDevice *pci_dev) { AddressSpace *dma_as = pci_device_iommu_address_space(pci_dev); @@ -1246,6 +1261,17 @@ static void pci_qdev_unrealize(DeviceState *dev) do_pci_unregister_device(pci_dev); pci_dev->msi_trigger = NULL; + + /* + * clean up acpi-index so it could reused by another device + */ + if (pci_dev->acpi_index) { + GSequence *used_indexes = pci_acpi_index_list(); + + g_sequence_remove(g_sequence_lookup(used_indexes, + GINT_TO_POINTER(pci_dev->acpi_index), + g_cmp_uint32, NULL)); + } } void pci_register_bar(PCIDevice *pci_dev, int region_num, @@ -2005,6 +2031,8 @@ PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn) return bus->devices[devfn]; } +#define ONBOARD_INDEX_MAX (16 * 1024 - 1) + static void pci_qdev_realize(DeviceState *qdev, Error **errp) { PCIDevice *pci_dev = (PCIDevice *)qdev; @@ -2014,6 +2042,35 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp) bool is_default_rom; uint16_t class_id; + /* + * capped by systemd (see: udev-builtin-net_id.c) + * as it's the only known user honor it to avoid users + * misconfigure QEMU and then wonder why acpi-index doesn't work + */ + if (pci_dev->acpi_index > ONBOARD_INDEX_MAX) { + error_setg(errp, "acpi-index should be less or equal to %u", + ONBOARD_INDEX_MAX); + return; + } + + /* + * make sure that acpi-index is unique across all present PCI devices + */ + if (pci_dev->acpi_index) { + GSequence *used_indexes = pci_acpi_index_list(); + + if (g_sequence_lookup(used_indexes, + GINT_TO_POINTER(pci_dev->acpi_index), + g_cmp_uint32, NULL)) { + error_setg(errp, "a PCI device with acpi-index = %" PRIu32 + " already exist", pci_dev->acpi_index); + return; + } + g_sequence_insert_sorted(used_indexes, + GINT_TO_POINTER(pci_dev->acpi_index), + g_cmp_uint32, NULL); + } + if (pci_dev->romsize != -1 && !is_power_of_2(pci_dev->romsize)) { error_setg(errp, "ROM size %u is not a power of two", pci_dev->romsize); return; From patchwork Wed Mar 8 01:13:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753794 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=eu/INKHi; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZB9335wz1yWr for ; Wed, 8 Mar 2023 12:15:29 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNM-00025V-6R; Tue, 07 Mar 2023 20:13: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 1pZiNG-0001Qx-7z for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:46 -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 1pZiNE-0001xI-6S for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238023; 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=NiVZH2cd8MhbH6SXMN81UWaoK1zb3nOIQh2BBsQUr/E=; b=eu/INKHihbx/o74JN8P2OvxJCEuWL2gI61hO6sF9XtKqI+5+WJao9UrITPNrO/qcAYOJ5B uPXOq8/Lof4p8Wdfm9d3Zbl2+v4hn4QpzkjtlPTKB8abF4jhnD9KDfMzXycYyR3vZNKcUY 31reFvXhqvW7jnHK604iqq6601qR8Ow= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-617-_x6cS_LHPZmQ1E_XN7vzRg-1; Tue, 07 Mar 2023 20:13:42 -0500 X-MC-Unique: _x6cS_LHPZmQ1E_XN7vzRg-1 Received: by mail-ed1-f71.google.com with SMTP id ev6-20020a056402540600b004bc2358ac04so21656075edb.21 for ; Tue, 07 Mar 2023 17:13:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238020; 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=NiVZH2cd8MhbH6SXMN81UWaoK1zb3nOIQh2BBsQUr/E=; b=XQnCQQgs6v1lktLyHTimHUhhAJ9LNEy4MTrYQ+noFiFeyEzCA4NWdzf/wsjEwVkWZb DE3e+g6fPmr3sIsZkT6ruJ/6XuYNS8jJKVL29HAlKbTFxdkAnj47m+ZN5AgAAfVNA/ss y3rve81/aEm8SSfQg4r6LBGz1P+PG2leGnujbikpEFP4aarG7RLwtxRnYyK6MfYhlSsI 1XTrk5kxGRG0e4N8yu77Nial/cbVG5RnD6mwzkt8wus3SovzVL13V+mmEK0urmePZmVP Sk59cNCd7f+0pelMCh455HRok/1g7uidSNjTyyNkbnVRmKJmw3tabrCifMI3ax5JXliv d/NQ== X-Gm-Message-State: AO0yUKXrkourt/tG9GAqiUClR+Kx2f/6U0MUL49d0A/iUm5v2a08qes9 dTNpRDWYfKNH4cgkBh4is/qMKB0Jtz9QQDJE0M1U3dI6txewvGzrjIx1Me8ug+Gl7nGgS0+l0DY gXjnEjsK0jnEUoTpOyyF89hz6QJRIsukEcpb4m5BqBmEHKcQhleKm58PHsjYXKyMyBzsG X-Received: by 2002:a17:906:b050:b0:8b1:e791:faef with SMTP id bj16-20020a170906b05000b008b1e791faefmr16070718ejb.67.1678238020462; Tue, 07 Mar 2023 17:13:40 -0800 (PST) X-Google-Smtp-Source: AK7set9wjztgnezAeIFAUh1i+Q0neiLpjXNQqE68dPjLfoMLeJfUdZIEH8HLlXy0LSTA8TzDtQVCug== X-Received: by 2002:a17:906:b050:b0:8b1:e791:faef with SMTP id bj16-20020a170906b05000b008b1e791faefmr16070703ejb.67.1678238020277; Tue, 07 Mar 2023 17:13:40 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 1-20020a170906308100b008de345f4f9asm6770149ejv.49.2023.03.07.17.13.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:39 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:37 -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 56/73] acpi: pci: drop BSEL usage when deciding that device isn't hotpluggable Message-ID: <419233b2b417eec65211b4a5160d94978546467b.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov previous commit ("pci: fix 'hotplugglable' property behavior") fixed pcie root port's 'hotpluggable' property to behave consistently. So we don't need a BSEL crutch anymore to see of device is not hotpluggable, drop it from 'generic' PCI slots description handling. BSEL is still used to decide if hotplug part should be called but that will be moved out of generic code to hotplug one by followup patches. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-31-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 8e2481fe5e..ce14866eda 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -591,7 +591,7 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus) call_dev_aml_func(DEVICE(bus->devices[devfn]), dev); /* add _DSM if device has acpi-index set */ - if (pdev->acpi_index && !bsel && + if (pdev->acpi_index && !object_property_get_bool(OBJECT(pdev), "hotpluggable", &error_abort)) { aml_append(dev, aml_pci_static_endpoint_dsm(pdev)); From patchwork Wed Mar 8 01:13:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Rt/pT2Hn; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBJ4nRlz1yWr for ; Wed, 8 Mar 2023 12:15:36 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNK-0001tp-TC; Tue, 07 Mar 2023 20:13:51 -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 1pZiNI-0001lG-Jv for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiNG-0001yJ-Oh for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238026; 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=VEGZepK0Rp8JIhaQqMzWupcnrgzDBH5zuK/fgFSMHbY=; b=Rt/pT2HnpSqJGg6WFiLf5NJJPY/0pKRfXQwj5DT9kMqwDZuUZAGBkKVuZ4sss4/GxnEh8/ 7dDqep0i6dxVWGbWyFL3YobCEqyF7RZCXtJnaHxLjhSb/5/JmukBauHceNLUdCsDk0rdaA uTNcULqt+WTFCtoOPp5jS73hX0yaWhg= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-ZBnRvrQBMVqafP9V2UoU-A-1; Tue, 07 Mar 2023 20:13:45 -0500 X-MC-Unique: ZBnRvrQBMVqafP9V2UoU-A-1 Received: by mail-ed1-f69.google.com with SMTP id da22-20020a056402177600b004c60694083eso21255653edb.5 for ; Tue, 07 Mar 2023 17:13:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238023; 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=VEGZepK0Rp8JIhaQqMzWupcnrgzDBH5zuK/fgFSMHbY=; b=6IedMM/OpAVFeigbWUsWHuEz5a/dib2wRmJSAbPkxBbiw7DOhXhGL8g5vkc1kG+epH MjS/lVfoQArXkKIJWpcCRzqy8HFQ/OC9hrXWXmytuDIKmAxe8CMTYxUPMyAnHrQU560F 59IdPgqepU/J4MTCegaU4PHhRx9ZpVYEBdiCfN4yyjgSsYALSCKAAoyfUQmObIPdAsRK K7GiAqLLB0VoAp+JTahwTSpGRunqRswl6UyTlHXbUNJPkaeQHtLNw3SHtRzxJaBnQf5y o5g9L8BjM/1IQJgRJdLdh2LXhs1PpItnx0IvzvaVyG5iiPBpftYgD1F0/hpLDJaL2f+u jPpg== X-Gm-Message-State: AO0yUKW97zBHKvoZKqJPZAlH5heWW10UXte3xXTNrx2h7XfuCzQaS6vS 2gHAyjMZRjkmZTetMHyL+dbDKOHaHbUGcrNHJeT/NBPqOe1srmsWd+m6vqkp1KQEUdSA4Fu3ML+ iHQ6yieNXEIpgE0IBjCbH4zR1j7pvhRzaFdRh5Zzkft9PYNwiEWTvTM3UFs0Uzd8fKDbX X-Received: by 2002:a17:906:db0c:b0:909:3c55:a1b3 with SMTP id xj12-20020a170906db0c00b009093c55a1b3mr22181098ejb.38.1678238023585; Tue, 07 Mar 2023 17:13:43 -0800 (PST) X-Google-Smtp-Source: AK7set+1W9Xvum+at7tU1bMNPJCbV56mbb8BVncyjTQXAeIY4OaoYVVkEx9KxBXrcpu9WpU+TiBMJw== X-Received: by 2002:a17:906:db0c:b0:909:3c55:a1b3 with SMTP id xj12-20020a170906db0c00b009093c55a1b3mr22181084ejb.38.1678238023376; Tue, 07 Mar 2023 17:13:43 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id d9-20020a17090648c900b008b17b0f5d07sm6762946ejt.217.2023.03.07.17.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:43 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:40 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 57/73] acpi: pci: move BSEL into build_append_pcihp_slots() Message-ID: <62dd55fcf736994958eb5706cee5806480acfe25.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Generic PCI enumeration code doesn't really need access to BSEL value, it is only used as means to decide if hotplug enumerator should be called. Use stateless object_property_find() to do that, and move the rest of BSEL handling into build_append_pcihp_slots() where it belongs. This cleans up generic code a bit from hotplug stuff and follow up patch will remove remaining call to build_append_pcihp_slots() from generic code, making it possible to use without ACPI PCI hotplug dependencies. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-32-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index ce14866eda..0459acfbb4 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -520,12 +520,14 @@ static bool is_devfn_ignored_hotplug(const int devfn, const PCIBus *bus) return false; } -static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus, - QObject *bsel) +static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus) { int devfn; Aml *dev, *notify_method = NULL, *method; + QObject *bsel = object_property_get_qobject(OBJECT(bus), + ACPI_PCIHP_PROP_BSEL, NULL); uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel)); + qobject_unref(bsel); aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val))); notify_method = aml_method("DVNT", 2, AML_NOTSERIALIZED); @@ -570,12 +572,9 @@ static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus, void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus) { - QObject *bsel; int devfn; Aml *dev; - bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL); - for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) { /* ACPI spec: 1.0b: Table 6-2 _ADR Object Bus Types, PCI type */ int adr = PCI_SLOT(devfn) << 16 | PCI_FUNC(devfn); @@ -601,11 +600,9 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus) aml_append(parent_scope, dev); } - if (bsel) { - build_append_pcihp_slots(parent_scope, bus, bsel); + if (object_property_find(OBJECT(bus), ACPI_PCIHP_PROP_BSEL)) { + build_append_pcihp_slots(parent_scope, bus); } - - qobject_unref(bsel); } static bool build_append_notfication_callback(Aml *parent_scope, From patchwork Wed Mar 8 01:13:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753839 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=VolWp5oI; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZL44glMz1yWt for ; Wed, 8 Mar 2023 12:22:19 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNT-0003RI-Np; Tue, 07 Mar 2023 20:13:59 -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 1pZiNR-0002za-F0 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiNP-0001z9-HK for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238034; 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=PvK1sjWBwmXgmqva75M2OfnltUEHJkHEl+PUlTqgdeQ=; b=VolWp5oIBIK4zGXb9bA09UmoOGDRuV+zglu4ZVfKtwuz15Fr6QRPjma/7y54J6xHyOiR62 QQRJT9hQ8sKOSL7jdrNujNsG77x280W1u7k3DI35moQ7xbqtnyArmXvnSdlf/r15NHq6CY OulOnekP5lIFioUif8Bgu1EiYcURvWI= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-675-IP-sSnLFMki-Vcz6hNd2PA-1; Tue, 07 Mar 2023 20:13:48 -0500 X-MC-Unique: IP-sSnLFMki-Vcz6hNd2PA-1 Received: by mail-ed1-f71.google.com with SMTP id y1-20020a056402358100b004ea439d57b7so9290195edc.12 for ; Tue, 07 Mar 2023 17:13:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238026; 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=PvK1sjWBwmXgmqva75M2OfnltUEHJkHEl+PUlTqgdeQ=; b=Zo7uOK4yQpQFCm3A72cO4+cmQKa7pm0z5mbY84985aX8bHqMtrf6wMK6epsKPebrr7 C6v25IbQX+o1MsKbQ0IkFraU3ih7gro7jfnQ6VS9Eaqx7BoAIqhNoaMc+KMVMm0cy4/W gOgkbzvYA3n2gS46EHGVD6Pg3Ui7zZ0Qrlj30nVlnQtC/3QEPYhtSSp9J5SREyVPPl8o DRjHMDnJNfMfljZDYQkRtttOyM/4nwS9dL2Vt+19gOSIbzIIPR/Vwxk+qA5PN7MAplTR UIzLIxXFg91lOdoC3Vn3bREqHRaEF9Mk+twyABi6YJ9MqC8t9gy5wpplwlWTFtPqBynt 9LHg== X-Gm-Message-State: AO0yUKV5W8GXFQrx7/YKHwYVs6Y5p4Jwty0wAi77ndDaGak9xLhNN7OT qAj6nA5BwCU/YWCMYJrBi/870Vy5TbL7oVgNcraUgpPWKluch2DMSHuR0ehXlOcxkgJL4wvNdPq DRpltrP0zx+uYX/mLPNwK2cq900ucJG/tOEQTS/qUbVsytI6UhWECHXdhEFAMjU8AIIYb X-Received: by 2002:a17:907:6d92:b0:8ed:e8d6:4e0e with SMTP id sb18-20020a1709076d9200b008ede8d64e0emr23883328ejc.36.1678238026487; Tue, 07 Mar 2023 17:13:46 -0800 (PST) X-Google-Smtp-Source: AK7set+OdbYu/0EOLsujRrBcupWcRM5JV5dUI2eXzTeQU+56efhMMh2/v2kyhx7jMVgw5rL31fv8hg== X-Received: by 2002:a17:907:6d92:b0:8ed:e8d6:4e0e with SMTP id sb18-20020a1709076d9200b008ede8d64e0emr23883308ejc.36.1678238026289; Tue, 07 Mar 2023 17:13:46 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id pv16-20020a170907209000b009079442dd11sm6773455ejb.154.2023.03.07.17.13.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:45 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:43 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PULL 58/73] acpi: pci: move out ACPI PCI hotplug generator from generic slot generator build_append_pci_bus_devices() Message-ID: <02c106139a5c01a5668246c748939b5a4bb0c467.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-33-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/pcihp.h | 2 ++ hw/acpi/pci-bridge.c | 12 +++++++++++- hw/i386/acpi-build.c | 9 ++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index 7e268c2c9c..cd18ebdcdc 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -71,6 +71,8 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, /* Called on reset */ void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off); +void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus); + extern const VMStateDescription vmstate_acpi_pcihp_pci_status; #define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp, test_acpi_index) \ diff --git a/hw/acpi/pci-bridge.c b/hw/acpi/pci-bridge.c index 4fbf6da6ad..7baa7034a1 100644 --- a/hw/acpi/pci-bridge.c +++ b/hw/acpi/pci-bridge.c @@ -22,6 +22,16 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope) PCIBridge *br = PCI_BRIDGE(adev); if (!DEVICE(br)->hotplugged) { - build_append_pci_bus_devices(scope, pci_bridge_get_sec_bus(br)); + PCIBus *sec_bus = pci_bridge_get_sec_bus(br); + + build_append_pci_bus_devices(scope, sec_bus); + + /* + * generate hotplug slots descriptors if + * bridge has ACPI PCI hotplug attached, + */ + if (object_property_find(OBJECT(sec_bus), ACPI_PCIHP_PROP_BSEL)) { + build_append_pcihp_slots(scope, sec_bus); + } } } diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 0459acfbb4..ec857a117e 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -520,7 +520,7 @@ static bool is_devfn_ignored_hotplug(const int devfn, const PCIBus *bus) return false; } -static void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus) +void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus) { int devfn; Aml *dev, *notify_method = NULL, *method; @@ -599,10 +599,6 @@ void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus) /* device descriptor has been composed, add it into parent context */ aml_append(parent_scope, dev); } - - if (object_property_find(OBJECT(bus), ACPI_PCIHP_PROP_BSEL)) { - build_append_pcihp_slots(parent_scope, bus); - } } static bool build_append_notfication_callback(Aml *parent_scope, @@ -1790,6 +1786,9 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, Aml *scope = aml_scope("PCI0"); /* Scan all PCI buses. Generate tables to support hotplug. */ build_append_pci_bus_devices(scope, bus); + if (object_property_find(OBJECT(bus), ACPI_PCIHP_PROP_BSEL)) { + build_append_pcihp_slots(scope, bus); + } aml_append(sb_scope, scope); } } From patchwork Wed Mar 8 01:13:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753838 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IZiQ6jut; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZL44WWLz1yWp for ; Wed, 8 Mar 2023 12:22:19 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNR-0002u3-A0; Tue, 07 Mar 2023 20:13: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 1pZiNP-0002do-OT for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13: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 1pZiNN-0001yw-BT for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238032; 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=u0abA4a9iIhVvhgBVi0sbRg9TnAU3XPQFF5wCUhX2/0=; b=IZiQ6jutwjzIebQ+/xZU4SDOUiRH9CsPoMf9a6UJkkgIg+5kjTfS0RVyVizU4I0tIgEuDU WAzl87Qupo0+s+w9Rmkd9RfIvkejjPOErBFHqSH+kA5uKM6Rvig/5BqA1kqzwSzFgECm5i 43syqZnQG9B/unINtsyglTnxEIRLtL8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-641-Q-8z0dyXMyGNZ_ZULsj8dg-1; Tue, 07 Mar 2023 20:13:51 -0500 X-MC-Unique: Q-8z0dyXMyGNZ_ZULsj8dg-1 Received: by mail-ed1-f69.google.com with SMTP id v11-20020a056402348b00b004ce34232666so18103615edc.3 for ; Tue, 07 Mar 2023 17:13:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238030; 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=u0abA4a9iIhVvhgBVi0sbRg9TnAU3XPQFF5wCUhX2/0=; b=Cdx5yLKSmcFwnXPJ1L3d0dV+zSrlUS6GwaEU08lQ9okv+sDeDGJMiHCcdTEDI5L2c9 JltCO5mAl6XQtPFh2f5tKhT4d5AwqZqVZmpIo4btt88RoL6d3WPcLfi2NTdwhDpIBOJf JicZ91igl9V1yL2i0YOF/23kiUyXVbZu/Hb1lhFxEvNpdsHDww/AySzYs0Q5UhQ46+8m oSxjKvZTp+Z+69IKUHiGeTEtZblsBVlpde0c+f1v251tMZbJ4Hhop75cFUtGWRz6Ttuh 9XK9q951e1Zp/BM1oYAKFpG07FeTPCUdQ6oSMsj2rEUozkvMZ8LT17oxQxEu5zwwJ/pM COJw== X-Gm-Message-State: AO0yUKU/B3R7+pxAZ8ol4vpk58MIlVkPFdQ53TpdjlcSh7YjlhihvIf6 JAfCiWaG8AIn8CUpL0oRik8kWNOIWfuU6YOzPQi8GPugaXutcuT63pVcYlTPUPJJjs16olF7jFm urLMKbWTm+fu0v60kN2SmkPWYiVz6oHw8gUBr4+wdLO+LK2xV02grX9tM9TvnqpyJ0uD2 X-Received: by 2002:aa7:c657:0:b0:4af:6969:73d4 with SMTP id z23-20020aa7c657000000b004af696973d4mr13640638edr.30.1678238029743; Tue, 07 Mar 2023 17:13:49 -0800 (PST) X-Google-Smtp-Source: AK7set/GurSCSzm0X9i1jzWd79d6QT+164IcXwScX2ttxU+ckh0ujib0muBduombR1oxLBq0Njz6Fw== X-Received: by 2002:aa7:c657:0:b0:4af:6969:73d4 with SMTP id z23-20020aa7c657000000b004af696973d4mr13640623edr.30.1678238029442; Tue, 07 Mar 2023 17:13:49 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id v15-20020a50954f000000b004c09527d62dsm7529450eda.30.2023.03.07.17.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:49 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:46 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Aurelien Jarno Subject: [PULL 59/73] pcihp: move fields enabling hotplug into AcpiPciHpState Message-ID: <6536e427ce490d1d57e9d4369f1765f9f1a85310.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov ... instead of duplicating them in piix4 and lpc and then trying to pass them to pcihp routines as arguments. it simplifies call sites and places pcihp specific in its own structure. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-34-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/pcihp.h | 8 ++++---- include/hw/acpi/piix4.h | 2 -- hw/acpi/acpi-pci-hotplug-stub.c | 5 ++--- hw/acpi/ich9.c | 15 +++++++-------- hw/acpi/pcihp.c | 16 ++++++++-------- hw/acpi/piix4.c | 23 +++++++++++++---------- 6 files changed, 34 insertions(+), 35 deletions(-) diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index cd18ebdcdc..04c98511a4 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -49,14 +49,14 @@ typedef struct AcpiPciHpState { uint32_t acpi_index; PCIBus *root; MemoryRegion io; - bool legacy_piix; uint16_t io_base; uint16_t io_len; + bool use_acpi_hotplug_bridge; + bool use_acpi_root_pci_hotplug; } AcpiPciHpState; void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root, - MemoryRegion *address_space_io, bool bridges_enabled, - uint16_t io_base); + MemoryRegion *address_space_io, uint16_t io_base); void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); @@ -69,7 +69,7 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, Error **errp); /* Called on reset */ -void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off); +void acpi_pcihp_reset(AcpiPciHpState *s); void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus); diff --git a/include/hw/acpi/piix4.h b/include/hw/acpi/piix4.h index be1f8ea80e..eb1c122d80 100644 --- a/include/hw/acpi/piix4.h +++ b/include/hw/acpi/piix4.h @@ -57,8 +57,6 @@ struct PIIX4PMState { Notifier powerdown_notifier; AcpiPciHpState acpi_pci_hotplug; - bool use_acpi_hotplug_bridge; - bool use_acpi_root_pci_hotplug; bool not_migrate_acpi_index; uint8_t disable_s3; diff --git a/hw/acpi/acpi-pci-hotplug-stub.c b/hw/acpi/acpi-pci-hotplug-stub.c index a43f6dafc9..d1794399f7 100644 --- a/hw/acpi/acpi-pci-hotplug-stub.c +++ b/hw/acpi/acpi-pci-hotplug-stub.c @@ -5,8 +5,7 @@ const VMStateDescription vmstate_acpi_pcihp_pci_status; void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, - MemoryRegion *address_space_io, bool bridges_enabled, - uint16_t io_base) + MemoryRegion *address_space_io, uint16_t io_base) { return; } @@ -36,7 +35,7 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, return; } -void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off) +void acpi_pcihp_reset(AcpiPciHpState *s) { return; } diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index d23bfcaa6b..f778ade7ea 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -218,7 +218,7 @@ static bool vmstate_test_use_pcihp(void *opaque) { ICH9LPCPMRegs *s = opaque; - return s->use_acpi_hotplug_bridge; + return s->acpi_pci_hotplug.use_acpi_hotplug_bridge; } static const VMStateDescription vmstate_pcihp_state = { @@ -277,8 +277,8 @@ static void pm_reset(void *opaque) } pm->smi_en_wmask = ~0; - if (pm->use_acpi_hotplug_bridge) { - acpi_pcihp_reset(&pm->acpi_pci_hotplug, true); + if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) { + acpi_pcihp_reset(&pm->acpi_pci_hotplug); } acpi_update_sci(&pm->acpi_regs, pm->irq); @@ -316,12 +316,11 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq) acpi_pm_tco_init(&pm->tco_regs, &pm->io); } - if (pm->use_acpi_hotplug_bridge) { + if (pm->acpi_pci_hotplug.use_acpi_hotplug_bridge) { acpi_pcihp_init(OBJECT(lpc_pci), &pm->acpi_pci_hotplug, pci_get_bus(lpc_pci), pci_address_space_io(lpc_pci), - true, ACPI_PCIHP_ADDR_ICH9); qbus_set_hotplug_handler(BUS(pci_get_bus(lpc_pci)), @@ -403,14 +402,14 @@ static bool ich9_pm_get_acpi_pci_hotplug(Object *obj, Error **errp) { ICH9LPCState *s = ICH9_LPC_DEVICE(obj); - return s->pm.use_acpi_hotplug_bridge; + return s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge; } static void ich9_pm_set_acpi_pci_hotplug(Object *obj, bool value, Error **errp) { ICH9LPCState *s = ICH9_LPC_DEVICE(obj); - s->pm.use_acpi_hotplug_bridge = value; + s->pm.acpi_pci_hotplug.use_acpi_hotplug_bridge = value; } static bool ich9_pm_get_keep_pci_slot_hpc(Object *obj, Error **errp) @@ -435,7 +434,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm) pm->disable_s3 = 0; pm->disable_s4 = 0; pm->s4_val = 2; - pm->use_acpi_hotplug_bridge = true; + pm->acpi_pci_hotplug.use_acpi_hotplug_bridge = true; pm->keep_pci_slot_hpc = true; pm->enable_tco = true; diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index adf45e8443..34cad061a8 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -276,12 +276,12 @@ static void acpi_pcihp_update(AcpiPciHpState *s) } } -void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off) +void acpi_pcihp_reset(AcpiPciHpState *s) { - if (acpihp_root_off) { + if (!s->use_acpi_root_pci_hotplug) { acpi_pcihp_disable_root_bus(); } - acpi_set_pci_info(!s->legacy_piix); + acpi_set_pci_info(s->use_acpi_hotplug_bridge); acpi_pcihp_update(s); } @@ -316,7 +316,7 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, * Overwrite the default hotplug handler with the ACPI PCI one * for cold plugged bridges only. */ - if (!s->legacy_piix && + if (s->use_acpi_hotplug_bridge && object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { PCIBus *sec = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev)); @@ -398,7 +398,7 @@ static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) switch (addr) { case PCI_UP_BASE: val = s->acpi_pcihp_pci_status[bsel].up; - if (!s->legacy_piix) { + if (s->use_acpi_hotplug_bridge) { s->acpi_pcihp_pci_status[bsel].up = 0; } trace_acpi_pci_up_read(val); @@ -473,7 +473,8 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data, trace_acpi_pci_ej_write(addr, data); break; case PCI_SEL_BASE: - s->hotplug_select = s->legacy_piix ? ACPI_PCIHP_BSEL_DEFAULT : data; + s->hotplug_select = s->use_acpi_hotplug_bridge ? data : + ACPI_PCIHP_BSEL_DEFAULT; trace_acpi_pci_sel_write(addr, data); default: break; @@ -491,14 +492,13 @@ static const MemoryRegionOps acpi_pcihp_io_ops = { }; void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, - MemoryRegion *address_space_io, bool bridges_enabled, + MemoryRegion *address_space_io, uint16_t io_base) { s->io_len = ACPI_PCIHP_SIZE; s->io_base = io_base; s->root = root_bus; - s->legacy_piix = !bridges_enabled; memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, "acpi-pci-hotplug", s->io_len); diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 8fc422829a..0a233fa95d 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -170,14 +170,14 @@ static const VMStateDescription vmstate_pci_status = { static bool vmstate_test_use_acpi_hotplug_bridge(void *opaque, int version_id) { PIIX4PMState *s = opaque; - return s->use_acpi_hotplug_bridge; + return s->acpi_pci_hotplug.use_acpi_hotplug_bridge; } static bool vmstate_test_no_use_acpi_hotplug_bridge(void *opaque, int version_id) { PIIX4PMState *s = opaque; - return !s->use_acpi_hotplug_bridge; + return !s->acpi_pci_hotplug.use_acpi_hotplug_bridge; } static bool vmstate_test_use_memhp(void *opaque) @@ -234,7 +234,8 @@ static bool piix4_vmstate_need_smbus(void *opaque, int version_id) static bool vmstate_test_migrate_acpi_index(void *opaque, int version_id) { PIIX4PMState *s = PIIX4_PM(opaque); - return s->use_acpi_hotplug_bridge && !s->not_migrate_acpi_index; + return s->acpi_pci_hotplug.use_acpi_hotplug_bridge && + !s->not_migrate_acpi_index; } /* qemu-kvm 1.2 uses version 3 but advertised as 2 @@ -303,8 +304,9 @@ static void piix4_pm_reset(DeviceState *dev) acpi_update_sci(&s->ar, s->irq); pm_io_space_update(s); - if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { - acpi_pcihp_reset(&s->acpi_pci_hotplug, !s->use_acpi_root_pci_hotplug); + if (s->acpi_pci_hotplug.use_acpi_hotplug_bridge || + s->acpi_pci_hotplug.use_acpi_root_pci_hotplug) { + acpi_pcihp_reset(&s->acpi_pci_hotplug); } } @@ -487,7 +489,7 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp) qemu_add_machine_init_done_notifier(&s->machine_ready); if (xen_enabled()) { - s->use_acpi_hotplug_bridge = false; + s->acpi_pci_hotplug.use_acpi_hotplug_bridge = false; } piix4_acpi_system_hot_add_init(pci_address_space_io(dev), @@ -560,9 +562,10 @@ static void piix4_acpi_system_hot_add_init(MemoryRegion *parent, "acpi-gpe0", GPE_LEN); memory_region_add_subregion(parent, GPE_BASE, &s->io_gpe); - if (s->use_acpi_hotplug_bridge || s->use_acpi_root_pci_hotplug) { + if (s->acpi_pci_hotplug.use_acpi_hotplug_bridge || + s->acpi_pci_hotplug.use_acpi_root_pci_hotplug) { acpi_pcihp_init(OBJECT(s), &s->acpi_pci_hotplug, bus, parent, - s->use_acpi_hotplug_bridge, ACPI_PCIHP_ADDR_PIIX4); + ACPI_PCIHP_ADDR_PIIX4); qbus_set_hotplug_handler(BUS(pci_get_bus(PCI_DEVICE(s))), OBJECT(s)); } @@ -602,9 +605,9 @@ static Property piix4_pm_properties[] = { DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_DISABLED, PIIX4PMState, disable_s4, 0), DEFINE_PROP_UINT8(ACPI_PM_PROP_S4_VAL, PIIX4PMState, s4_val, 2), DEFINE_PROP_BOOL(ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, PIIX4PMState, - use_acpi_hotplug_bridge, true), + acpi_pci_hotplug.use_acpi_hotplug_bridge, true), DEFINE_PROP_BOOL(ACPI_PM_PROP_ACPI_PCI_ROOTHP, PIIX4PMState, - use_acpi_root_pci_hotplug, true), + acpi_pci_hotplug.use_acpi_root_pci_hotplug, true), DEFINE_PROP_BOOL("memory-hotplug-support", PIIX4PMState, acpi_memory_hotplug.is_enabled, true), DEFINE_PROP_BOOL("smm-compat", PIIX4PMState, smm_compat, false), From patchwork Wed Mar 8 01:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=f87uRRyw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBq0XJ2z1yWr for ; Wed, 8 Mar 2023 12:16:03 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNU-0003UX-C3; Tue, 07 Mar 2023 20:14: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 1pZiNS-0003KI-OA for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:58 -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 1pZiNQ-0001zJ-Ct for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:13:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238035; 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=wjqSjKZVM4uvusMfe+UV5rGNkLAJNX4ER32Wm66+3LY=; b=f87uRRywSmoNS/Nh5Dc45nbcxfgsaa4ZceNeOnvXQtFdrGZhm8y861z1xBtLzyfPJCREg1 qGG/JNA/UIQiqsv6+Fyn0Q22Q/Kye6lFLTBQ/ceX4qkO0SthMRzUBb67Q4uCnLGHo1PXKA QV8FAhvBK7BD3xwV0+Q37fMjxtv/NgQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-499-bMtb90nfMgOw6Lm5Ou_19w-1; Tue, 07 Mar 2023 20:13:54 -0500 X-MC-Unique: bMtb90nfMgOw6Lm5Ou_19w-1 Received: by mail-ed1-f72.google.com with SMTP id z14-20020a05640235ce00b004e07ddbc2f8so12719700edc.7 for ; Tue, 07 Mar 2023 17:13:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238033; 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=wjqSjKZVM4uvusMfe+UV5rGNkLAJNX4ER32Wm66+3LY=; b=U5+M+27GTeEhofoG+hb+oj79iflz+AE9F4IjYJfXHxNXTxx9J424wAaZIeAZxbv853 DV0ngp6YZCD6DYMVPuraRKCMO8nlSxE0fH4495a8FRvIXDdp9D6GvO5hlz0A/Clm6yrY en3N2yLK7OLRLEtrCZSgJZrco+4upCEii3D4b6odNdNYyD/PImQgInWoQ/JkxBzcQBos 2Gugc781lQu3UdlhcdqxG/qhb94k1D4d/b5yrGQDRhB3KxSehkQNCYxdozLyk1UOJz1Z qZNrYlaIilAKvxagRfk1dPJNcEp8PgFHMykfFBqHWFO+uxG4N5uIVRXWp0VnLndCzc/R +pnA== X-Gm-Message-State: AO0yUKXkVpP41DB0XS/Yzj24jyg0buvhemUKPp4lS1fp7TaSu53N/KyK MULOshuiMVBnG0qfbWeld7i2fNnA2yCjTVTalyFF6aYgZLxARQZTBc/IYMfa+0vSC1pLvF/MrqF 5Lfp/CR0vi+zLr4OTuJANAY08KIwjPpfQx62zUkt615yM6jX2TtqPjWmCoMmnurBve1T5 X-Received: by 2002:a17:907:9484:b0:886:7eae:26c4 with SMTP id dm4-20020a170907948400b008867eae26c4mr21064781ejc.5.1678238032833; Tue, 07 Mar 2023 17:13:52 -0800 (PST) X-Google-Smtp-Source: AK7set8HwdiBtg00lp1J7bTH99VvSLWrIFTINR/25MSA0ASWzSxNFSItKJmAjJ8/QGm27Xv1bmg3mA== X-Received: by 2002:a17:907:9484:b0:886:7eae:26c4 with SMTP id dm4-20020a170907948400b008867eae26c4mr21064761ejc.5.1678238032547; Tue, 07 Mar 2023 17:13:52 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id q8-20020a170906940800b008eb89a435c9sm6715144ejx.164.2023.03.07.17.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:52 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:49 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Igor Mammedov , Ani Sinha , Marcel Apfelbaum , Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= , Aurelien Jarno Subject: [PULL 60/73] pcihp: add ACPI PCI hotplug specific is_hotpluggable_bus() callback 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Provide pcihp specific callback to check if bus is hotpluggable and consolidate its scattered hotplug criteria there. While at it clean up no longer needed qbus_set_hotplug_handler(BUS(bus), NULL) workarounds since callback makes qbus_is_hotpluggable() return correct answer even if hotplug_handler is set on bus. PS: see ("pci: fix 'hotplugglable' property behavior") for details why callback was introduced. Signed-off-by: Igor Mammedov Message-Id: <20230302161543.286002-35-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/acpi/ich9.h | 1 + include/hw/acpi/pcihp.h | 1 + hw/acpi/acpi-pci-hotplug-stub.c | 4 ++++ hw/acpi/ich9.c | 6 +++++ hw/acpi/pcihp.c | 42 ++++++++++++++------------------- hw/acpi/piix4.c | 8 +++++++ hw/isa/lpc_ich9.c | 1 + 7 files changed, 39 insertions(+), 24 deletions(-) diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h index 57a542c4b8..2faf7f0cae 100644 --- a/include/hw/acpi/ich9.h +++ b/include/hw/acpi/ich9.h @@ -87,6 +87,7 @@ void ich9_pm_device_unplug_request_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); +bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bus); void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list); #endif /* HW_ACPI_ICH9_H */ diff --git a/include/hw/acpi/pcihp.h b/include/hw/acpi/pcihp.h index 04c98511a4..ef59810c17 100644 --- a/include/hw/acpi/pcihp.h +++ b/include/hw/acpi/pcihp.h @@ -58,6 +58,7 @@ typedef struct AcpiPciHpState { void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root, MemoryRegion *address_space_io, uint16_t io_base); +bool acpi_pcihp_is_hotpluggbale_bus(AcpiPciHpState *s, BusState *bus); void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp); void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, diff --git a/hw/acpi/acpi-pci-hotplug-stub.c b/hw/acpi/acpi-pci-hotplug-stub.c index d1794399f7..dcee3ad7a1 100644 --- a/hw/acpi/acpi-pci-hotplug-stub.c +++ b/hw/acpi/acpi-pci-hotplug-stub.c @@ -40,3 +40,7 @@ void acpi_pcihp_reset(AcpiPciHpState *s) return; } +bool acpi_pcihp_is_hotpluggbale_bus(AcpiPciHpState *s, BusState *bus) +{ + return true; +} diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index f778ade7ea..25e2c7243e 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -578,6 +578,12 @@ void ich9_pm_device_unplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev, } } +bool ich9_pm_is_hotpluggable_bus(HotplugHandler *hotplug_dev, BusState *bus) +{ + ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); + return acpi_pcihp_is_hotpluggbale_bus(&lpc->pm.acpi_pci_hotplug, bus); +} + void ich9_pm_ospm_status(AcpiDeviceIf *adev, ACPIOSTInfoList ***list) { ICH9LPCState *s = ICH9_LPC_DEVICE(adev); diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 34cad061a8..dcfb779a7a 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -121,20 +121,6 @@ static void acpi_set_pci_info(bool has_bridge_hotplug) } } -static void acpi_pcihp_disable_root_bus(void) -{ - Object *host = acpi_get_i386_pci_host(); - PCIBus *bus; - - bus = PCI_HOST_BRIDGE(host)->bus; - if (bus && qbus_is_hotpluggable(BUS(bus))) { - /* setting the hotplug handler to NULL makes the bus non-hotpluggable */ - qbus_set_hotplug_handler(BUS(bus), NULL); - } - - return; -} - static void acpi_pcihp_test_hotplug_bus(PCIBus *bus, void *opaque) { AcpiPciHpFind *find = opaque; @@ -278,9 +264,6 @@ static void acpi_pcihp_update(AcpiPciHpState *s) void acpi_pcihp_reset(AcpiPciHpState *s) { - if (!s->use_acpi_root_pci_hotplug) { - acpi_pcihp_disable_root_bus(); - } acpi_set_pci_info(s->use_acpi_hotplug_bridge); acpi_pcihp_update(s); } @@ -320,13 +303,6 @@ void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, object_dynamic_cast(OBJECT(dev), TYPE_PCI_BRIDGE)) { PCIBus *sec = pci_bridge_get_sec_bus(PCI_BRIDGE(pdev)); - /* Remove all hot-plug handlers if hot-plug is disabled on slot */ - if (object_dynamic_cast(OBJECT(dev), TYPE_PCIE_SLOT) && - !PCIE_SLOT(pdev)->hotplug) { - qbus_set_hotplug_handler(BUS(sec), NULL); - return; - } - qbus_set_hotplug_handler(BUS(sec), OBJECT(hotplug_dev)); /* We don't have to overwrite any other hotplug handler yet */ assert(QLIST_EMPTY(&sec->child)); @@ -385,6 +361,24 @@ void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); } +bool acpi_pcihp_is_hotpluggbale_bus(AcpiPciHpState *s, BusState *bus) +{ + Object *o = OBJECT(bus->parent); + + if (s->use_acpi_hotplug_bridge && + object_dynamic_cast(o, TYPE_PCI_BRIDGE)) { + if (object_dynamic_cast(o, TYPE_PCIE_SLOT) && !PCIE_SLOT(o)->hotplug) { + return false; + } + return true; + } + + if (s->use_acpi_root_pci_hotplug) { + return true; + } + return false; +} + static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) { AcpiPciHpState *s = opaque; diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index 0a233fa95d..63d2113b86 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -404,6 +404,13 @@ static void piix4_device_unplug_cb(HotplugHandler *hotplug_dev, } } +static bool piix4_is_hotpluggable_bus(HotplugHandler *hotplug_dev, + BusState *bus) +{ + PIIX4PMState *s = PIIX4_PM(hotplug_dev); + return acpi_pcihp_is_hotpluggbale_bus(&s->acpi_pci_hotplug, bus); +} + static void piix4_pm_machine_ready(Notifier *n, void *opaque) { PIIX4PMState *s = container_of(n, PIIX4PMState, machine_ready); @@ -644,6 +651,7 @@ static void piix4_pm_class_init(ObjectClass *klass, void *data) hc->plug = piix4_device_plug_cb; hc->unplug_request = piix4_device_unplug_request_cb; hc->unplug = piix4_device_unplug_cb; + hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus; adevc->ospm_status = piix4_ospm_status; adevc->send_event = piix4_send_gpe; adevc->madt_cpu = pc_madt_cpu_entry; diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index d8303d0322..9714b0001e 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -865,6 +865,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) hc->plug = ich9_pm_device_plug_cb; hc->unplug_request = ich9_pm_device_unplug_request_cb; hc->unplug = ich9_pm_device_unplug_cb; + hc->is_hotpluggable_bus = ich9_pm_is_hotpluggable_bus; adevc->ospm_status = ich9_pm_ospm_status; adevc->send_event = ich9_send_gpe; adevc->madt_cpu = pc_madt_cpu_entry; From patchwork Wed Mar 8 01:13:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=RbsRi6vN; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZHz5R87z1yWp for ; Wed, 8 Mar 2023 12:20:31 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNW-0003ej-L3; Tue, 07 Mar 2023 20:14:02 -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 1pZiNV-0003XY-0f for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:01 -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 1pZiNT-0001zi-DC for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238038; 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=P/flEEtcx2Nxz0vaaqNrcWx22W07Ea7y0fK3PKtwLFs=; b=RbsRi6vNJ3HNwekrDZzY8a5w6h4E2fqnmtUJSyoV9mORnvF2xDKFuU2w4u9nrmiKi2Ud8Z EhC2Dq9hb9cpCoacOQsZcHDUGRUnTRpW3JQmYyOTkJZzb988Mv1XwanMM/tE4MvhqEEHrD R/++7IkSUJu7OVixCCkr3AQ5kBI76ys= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-464-SKx21tBXOuy0lUSLSyfkIA-1; Tue, 07 Mar 2023 20:13:57 -0500 X-MC-Unique: SKx21tBXOuy0lUSLSyfkIA-1 Received: by mail-ed1-f72.google.com with SMTP id fi8-20020a056402550800b004a26cc7f6cbso21411845edb.4 for ; Tue, 07 Mar 2023 17:13:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238036; 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=P/flEEtcx2Nxz0vaaqNrcWx22W07Ea7y0fK3PKtwLFs=; b=Ir9a3FL/ZJbgw0eTbABlodnF3jUNhtSuYt0gl9h1podYNbI4w1+AJJJqFqjpDjGNE0 RilvWOHu0nazfdcv1shi1XzbY0UEICg9gzTRr0LA881UYNS/fwp6kCaB/9jhT4DbFvM5 qN1vetnJu9lxZS0V2i4apuy6g/zLYx6g+ns5q+pgGr5Vn5PGupyIeyGKMSJozeUzcnMB IVvPh/7u5weZVK9oRXHsKRKRSEISk2KCFgicY26dbdgkxSEzL0q59zHPjl+G8U7z5gxo GEzj+w1xKOqu5zZpLZ0FFOKYfmCVKlWVOTgmflixYgu8sMBqCaX/69tMOe5UMfU+LCw9 5Odg== X-Gm-Message-State: AO0yUKXb30VUz695qNLU36/2B4oomKzRrwq16JclaK1xljK25aqMrg9p B0DVCf8Lc2V9K0xeufztHVjAmikH3lKfxD1VlyBjvMr1ySDWFSt5wXBbumqPHuYnDZLfcuetKL1 SDwgUSzbmx1RQkacISkLGNlHA+wZifUD4WCKsdKZYFmq9HauCmJW8cEheaTFDraflcAFQ X-Received: by 2002:a17:906:a1cc:b0:878:7189:a457 with SMTP id bx12-20020a170906a1cc00b008787189a457mr17235267ejb.51.1678238035910; Tue, 07 Mar 2023 17:13:55 -0800 (PST) X-Google-Smtp-Source: AK7set8BWTnyXRlcm2Zqlw3PKZEvkqcE4NUGdK68J8rBVspLkWY55qZS+UrEk7gxRjAlSksiVj0QuQ== X-Received: by 2002:a17:906:a1cc:b0:878:7189:a457 with SMTP id bx12-20020a170906a1cc00b008787189a457mr17235256ejb.51.1678238035700; Tue, 07 Mar 2023 17:13:55 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 22-20020a508756000000b004c0ac1df341sm7557824edv.50.2023.03.07.17.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:55 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:53 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Fan Ni , Marcel Apfelbaum Subject: [PULL 61/73] hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register Message-ID: <010746ae1db7f52700cb2e2c46eb94f299cfa0d2.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron This register in AER should be both writeable and should have a default value with a couple of the errors masked including the Uncorrectable Internal Error used by CXL for it's error reporting. Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang Message-Id: <20230302133709.30373-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- include/hw/pci/pcie_regs.h | 3 +++ hw/pci/pcie_aer.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h index 1fe0bdd25b..4972106c42 100644 --- a/include/hw/pci/pcie_regs.h +++ b/include/hw/pci/pcie_regs.h @@ -141,6 +141,9 @@ typedef enum PCIExpLinkWidth { PCI_ERR_UNC_ATOP_EBLOCKED | \ PCI_ERR_UNC_TLP_PRF_BLOCKED) +#define PCI_ERR_UNC_MASK_DEFAULT (PCI_ERR_UNC_INTN | \ + PCI_ERR_UNC_TLP_PRF_BLOCKED) + #define PCI_ERR_UNC_SEVERITY_DEFAULT (PCI_ERR_UNC_DLP | \ PCI_ERR_UNC_SDN | \ PCI_ERR_UNC_FCP | \ diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 9a19be44ae..909e027d99 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -112,6 +112,10 @@ int pcie_aer_init(PCIDevice *dev, uint8_t cap_ver, uint16_t offset, pci_set_long(dev->w1cmask + offset + PCI_ERR_UNCOR_STATUS, PCI_ERR_UNC_SUPPORTED); + pci_set_long(dev->config + offset + PCI_ERR_UNCOR_MASK, + PCI_ERR_UNC_MASK_DEFAULT); + pci_set_long(dev->wmask + offset + PCI_ERR_UNCOR_MASK, + PCI_ERR_UNC_SUPPORTED); pci_set_long(dev->config + offset + PCI_ERR_UNCOR_SEVER, PCI_ERR_UNC_SEVERITY_DEFAULT); From patchwork Wed Mar 8 01:13:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753819 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FXJZB4Jv; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZF50sdzz1yWr for ; Wed, 8 Mar 2023 12:18:01 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNZ-0003wO-Kb; Tue, 07 Mar 2023 20:14: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 1pZiNX-0003lp-U2 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14: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 1pZiNW-0001zz-7I for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238041; 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=N2NhsnhpjRETx99G++Bw+Z5dX+en0cbOsz59rYFYC2A=; b=FXJZB4JvXyXVRtUSOIO3MSJayR8vXBwE8OlRAi3jO/kmv+wAhEDmEMee6t1eHKnrq8cXDp S0ffBW2rtqsz+NRvXl6lyzn4IGpH/QSOZaNtvKTBNEBlAExg99fdV7Vemd+kY1Oa92MTgK qhgXPAws1WTejNYSIf88sV2p0dKFBro= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-640-mW_AD0frNwarU8t-8ZRSvw-1; Tue, 07 Mar 2023 20:14:00 -0500 X-MC-Unique: mW_AD0frNwarU8t-8ZRSvw-1 Received: by mail-ed1-f71.google.com with SMTP id h11-20020a0564020e8b00b004e59d4722a3so11266171eda.6 for ; Tue, 07 Mar 2023 17:14:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238039; 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=N2NhsnhpjRETx99G++Bw+Z5dX+en0cbOsz59rYFYC2A=; b=SdoHfzrTHw526kBvmM5zHV9uNnbFtgn5sfCOGY0uz16plgvhh2HQhkO2WSLuzrV/KU 6rZ3t2/VX5DNMgctW9vghBAy5bmL1tN9lKrRCYLZ32Kfxqo4p8VO5trxv4dOak7H/idr uhA4OKjbm3PmpLkT1f7gGRUksPnom4qq2kuoSX/AmPFI5W7uYLBDlOeSP5Iw09fHIX1X 6iAg+LL0seM8l80fu56YUjfKvj2aSytpqrvVO2nrpov82ZWixK05VpFemb0Kuu0pbR3I FWqE6rvBlJjFIRrpJb+zdFOypVxQ1YBAGWfKmcTf7AxwfpLUEqP2RAr2KJrIExoXjWvD Ne+A== X-Gm-Message-State: AO0yUKUh6tX7iXUkwXHiAvT8o+tcNXBDTontHhqKLzKvDik7Lba4az02 SB1P29Q151lfe7xz1kYeDTSkDImefPvyoLxPZnI5UB5u4Hd6g5np3bAaS+rlHE6gVvM5SlDlGYE Z2oDGPu5I1Co/X8kK9Z3qhb7BfNu+AwK+EXKhTkRDO5LTOxewLuNpMqq+EkiR3j3QxTGr X-Received: by 2002:a17:906:730d:b0:8b1:3193:4874 with SMTP id di13-20020a170906730d00b008b131934874mr20775406ejc.46.1678238038918; Tue, 07 Mar 2023 17:13:58 -0800 (PST) X-Google-Smtp-Source: AK7set9Z6qIhQmnmSmpNjTUIiGNQJMIjaiXe/Leaiuzdg2VmWPRlu1uw8/W8d9BqBUh4+bilPAIguA== X-Received: by 2002:a17:906:730d:b0:8b1:3193:4874 with SMTP id di13-20020a170906730d00b008b131934874mr20775387ejc.46.1678238038666; Tue, 07 Mar 2023 17:13:58 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id y26-20020a170906519a00b008e53874f8d8sm6774271ejk.180.2023.03.07.17.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:13:58 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:56 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Fan Ni , Marcel Apfelbaum Subject: [PULL 62/73] hw/pci/aer: Add missing routing for AER errors Message-ID: <9a6ef182c03eaa138bae553f0fbb5a123bef9a53.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron PCIe r6.0 Figure 6-3 "Pseudo Logic Diagram for Selected Error Message Control and Status Bits" includes a right hand branch under "All PCI Express devices" that allows for messages to be generated or sent onwards without SERR# being set as long as the appropriate per error class bit in the PCIe Device Control Register is set. Implement that branch thus enabling routing of ERR_COR, ERR_NONFATAL and ERR_FATAL under OSes that set these bits appropriately (e.g. Linux) Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang Message-Id: <20230302133709.30373-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/pci/pcie_aer.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hw/pci/pcie_aer.c b/hw/pci/pcie_aer.c index 909e027d99..103667c368 100644 --- a/hw/pci/pcie_aer.c +++ b/hw/pci/pcie_aer.c @@ -192,8 +192,16 @@ static void pcie_aer_update_uncor_status(PCIDevice *dev) static bool pcie_aer_msg_alldev(PCIDevice *dev, const PCIEAERMsg *msg) { + uint16_t devctl = pci_get_word(dev->config + dev->exp.exp_cap + + PCI_EXP_DEVCTL); if (!(pcie_aer_msg_is_uncor(msg) && - (pci_get_word(dev->config + PCI_COMMAND) & PCI_COMMAND_SERR))) { + (pci_get_word(dev->config + PCI_COMMAND) & PCI_COMMAND_SERR)) && + !((msg->severity == PCI_ERR_ROOT_CMD_NONFATAL_EN) && + (devctl & PCI_EXP_DEVCTL_NFERE)) && + !((msg->severity == PCI_ERR_ROOT_CMD_COR_EN) && + (devctl & PCI_EXP_DEVCTL_CERE)) && + !((msg->severity == PCI_ERR_ROOT_CMD_FATAL_EN) && + (devctl & PCI_EXP_DEVCTL_FERE))) { return false; } From patchwork Wed Mar 8 01:13:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753833 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jA7S6V3Y; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZKF6xDJz1yWp for ; Wed, 8 Mar 2023 12:21:37 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNc-00043K-Jb; Tue, 07 Mar 2023 20:14:08 -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 1pZiNb-00041v-02 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14: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 1pZiNZ-00020K-EX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238044; 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=8u+wqiyIGWdIFx3L2uxAk2b2QIaEfOdTnlLdNSylGZw=; b=jA7S6V3YrBIBDsn6DqVStvOBiHKelu5qzOlwNUXtEkczZeprfwy0vv1mUL80k0TCtCogTt iuWUqX1pRhb+VAB9fGwVuLyOKxSF2IMUbs0D0KSaIbkF3UoNxGYKYk2R1jjyWVwnP9NWi9 Cxf0mwzMOv38EOJc/l2eJxB00Iw+eZA= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-LeaHc68hNqyXiDAWqWsoIA-1; Tue, 07 Mar 2023 20:14:03 -0500 X-MC-Unique: LeaHc68hNqyXiDAWqWsoIA-1 Received: by mail-ed1-f72.google.com with SMTP id y24-20020aa7ccd8000000b004be3955a42eso21658562edt.22 for ; Tue, 07 Mar 2023 17:14:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238042; 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=8u+wqiyIGWdIFx3L2uxAk2b2QIaEfOdTnlLdNSylGZw=; b=1Uh07dp0ohD2oG3S/XYpRoycBukiVnU57DM40hBgfzZEVsF8OO6CCxEYrzhLU95ODh +CRgybqp7Exoc6mjGLwn8kgHCZ+8qF38G0J4f5aNzmUqYY7+e0STcjy8SiDrw1eMFfMI zjq9wUj1EjYeHNxn1jgB+ilSeCJKBz5x5Vzk+7CL6AxMUnCRt/xI/g6SF57V8ct/3erD SIXsMCuEUUGCJNRak0DgxDi/GbEXn2CGH1VFIu1tKbqlz2JiqsP84EKXYMAkTmr8Is+q 1nIwMo3zol8D0kSvxncwUJP7KP+XSCYv4xq99xaAoY/jd49QwM/qRM3a/emF0I6LPMja IccA== X-Gm-Message-State: AO0yUKVMTeXXxFWCr2s5DeG6ubt2N7fe108zhNgjTR+1XLXJU85ZL6bs hezubsSb7lQqHCE3TtCuWhH6PfXfj3Fx9oGpfUzOxJnAVg+nDxV35gARZIvHiChknIhPyNvvCDB I5fcWn6aqjWJUDk3XeF7K+m7aEXUAvLTObMxYWgJlkXwQJsA2VC9CpVF2FzvfhqFdCQeQ X-Received: by 2002:a05:6402:6cc:b0:4af:62ad:1571 with SMTP id n12-20020a05640206cc00b004af62ad1571mr15810123edy.23.1678238041874; Tue, 07 Mar 2023 17:14:01 -0800 (PST) X-Google-Smtp-Source: AK7set9ZKCvuN5NUs64AJvyaIVuBJyGIfF0kxuQYmYcWTsyBIEPiMCjp4PRvN0gEPLNNMGKfjZZrFw== X-Received: by 2002:a05:6402:6cc:b0:4af:62ad:1571 with SMTP id n12-20020a05640206cc00b004af62ad1571mr15810112edy.23.1678238041645; Tue, 07 Mar 2023 17:14:01 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id s22-20020a50ab16000000b004f238d1ad8asm250171edc.38.2023.03.07.17.14.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:01 -0800 (PST) Date: Tue, 7 Mar 2023 20:13:58 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Fan Ni , Marcel Apfelbaum Subject: [PULL 63/73] hw/pci-bridge/cxl_root_port: Wire up AER Message-ID: <47f0e7ab3272737c174ca68c03843e0d1996dc22.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron We are missing necessary config write handling for AER emulation in the CXL root port. Add it based on pcie_root_port.c Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang Message-Id: <20230302133709.30373-4-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/pci-bridge/cxl_root_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/pci-bridge/cxl_root_port.c b/hw/pci-bridge/cxl_root_port.c index 6664783974..00195257f7 100644 --- a/hw/pci-bridge/cxl_root_port.c +++ b/hw/pci-bridge/cxl_root_port.c @@ -187,12 +187,15 @@ static void cxl_rp_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { uint16_t slt_ctl, slt_sta; + uint32_t root_cmd = + pci_get_long(d->config + d->exp.aer_cap + PCI_ERR_ROOT_COMMAND); pcie_cap_slot_get(d, &slt_ctl, &slt_sta); pci_bridge_write_config(d, address, val, len); pcie_cap_flr_write_config(d, address, val, len); pcie_cap_slot_write_config(d, slt_ctl, slt_sta, address, val, len); pcie_aer_write_config(d, address, val, len); + pcie_aer_root_write_config(d, address, val, len, root_cmd); cxl_rp_dvsec_write_config(d, address, val, len); } From patchwork Wed Mar 8 01:14:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jP6L1qHq; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZJF6Ntcz1yWp for ; Wed, 8 Mar 2023 12:20:45 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNf-0004B8-Dn; Tue, 07 Mar 2023 20:14:11 -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 1pZiNe-00045K-5U for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14: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 1pZiNc-00020Z-5f for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238047; 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=E+0DVMZ4W9/J1tN7ovW0ZkJvu2M3AxmaE/zD1Fzhx94=; b=jP6L1qHqar1uT2Bx32OhAiLUCvAMTUi1cvrsGxPgAcBA/fpGIiA7t7SpP+/jUAlO3OopW0 t38ok7dEPyQp7n1iVe3Ras1aeva+vSTFcYDWbJesn9MnQ+TE9vVOtyXl4aghIYE2PndKGz dysFfCYght/c5FX4nGCIcS+eRJGzqUk= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-CfzFdvfXOrG4d5iB2DLwJg-1; Tue, 07 Mar 2023 20:14:06 -0500 X-MC-Unique: CfzFdvfXOrG4d5iB2DLwJg-1 Received: by mail-ed1-f70.google.com with SMTP id k12-20020a50c8cc000000b004accf30f6d3so21470789edh.14 for ; Tue, 07 Mar 2023 17:14:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238045; 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=E+0DVMZ4W9/J1tN7ovW0ZkJvu2M3AxmaE/zD1Fzhx94=; b=sTEKoAaF5bZEFbCSh/0jom3BbhKaB+mT38O24Vv6s4VB383uQMuQ5fJd0YVgakmcQd u6/zi2K9Tdy78E4VZaOn0apqnsSo85nfwcTWpJvwlKUWE4Ve3mINBhjMVahg+JuEOn9h CePGtTW3xnqA8hXExANMMCbFnoHlRgfcF593ptiZryeT0JfhFBjrXcBLWOLpitZhfNpt tMlXPJiLJ0SLHy2OgFDF2R1Iez/eGFsW0McOKlfrTjJqH8twr3LGIRIbb+SlyUyYt3Hh /LVBoiAxFlq87c2K7bOC/WcG4nWHIzXv2jWlhxAEy1H31HwsDzvxXMvqotPdxRpNxKoi OoOA== X-Gm-Message-State: AO0yUKWd3RATqbV0NFlcXD8shUHjO5o7bIWXWkLOTRyNWp0MnhXNjgz1 IcvlKh1GzGqp763MLsLLIi/cTazZptDqgaSCWOQAsiJAPn9comukfY8jDuts80BrY6pxTMoHl0B OFRYjJhl2i0bmQEU+wvwroCa4mlXCRzUqnH+tsvTaA8xWwIpe20jPmdQebCclzyjibLys X-Received: by 2002:a17:906:fe41:b0:8f1:949f:37b5 with SMTP id wz1-20020a170906fe4100b008f1949f37b5mr20114161ejb.32.1678238044759; Tue, 07 Mar 2023 17:14:04 -0800 (PST) X-Google-Smtp-Source: AK7set9WfrZmx2ofKrazSHiqplQKdU3cloTCa9Ib0YmzrYeS4rMkyQKxt0jOwj+oa+bV9F/uzv52cQ== X-Received: by 2002:a17:906:fe41:b0:8f1:949f:37b5 with SMTP id wz1-20020a170906fe4100b008f1949f37b5mr20114147ejb.32.1678238044532; Tue, 07 Mar 2023 17:14:04 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id v19-20020a17090606d300b008f100fd50e5sm6905559ejb.140.2023.03.07.17.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:04 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:01 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Fan Ni , Marcel Apfelbaum Subject: [PULL 64/73] hw/pci-bridge/cxl_root_port: Wire up MSI Message-ID: <7e33517fdd25ce2dc95b22b8afd743a979d8dfb4.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron Done to avoid fixing ACPI route description of traditional PCI interrupts on q35 and because we should probably move with the times anyway. Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang Message-Id: <20230302133709.30373-5-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/pci-bridge/cxl_root_port.c | 61 +++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/hw/pci-bridge/cxl_root_port.c b/hw/pci-bridge/cxl_root_port.c index 00195257f7..7dfd20aa67 100644 --- a/hw/pci-bridge/cxl_root_port.c +++ b/hw/pci-bridge/cxl_root_port.c @@ -22,6 +22,7 @@ #include "qemu/range.h" #include "hw/pci/pci_bridge.h" #include "hw/pci/pcie_port.h" +#include "hw/pci/msi.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" #include "qapi/error.h" @@ -29,6 +30,10 @@ #define CXL_ROOT_PORT_DID 0x7075 +#define CXL_RP_MSI_OFFSET 0x60 +#define CXL_RP_MSI_SUPPORTED_FLAGS PCI_MSI_FLAGS_MASKBIT +#define CXL_RP_MSI_NR_VECTOR 2 + /* Copied from the gen root port which we derive */ #define GEN_PCIE_ROOT_PORT_AER_OFFSET 0x100 #define GEN_PCIE_ROOT_PORT_ACS_OFFSET \ @@ -47,6 +52,49 @@ typedef struct CXLRootPort { #define TYPE_CXL_ROOT_PORT "cxl-rp" DECLARE_INSTANCE_CHECKER(CXLRootPort, CXL_ROOT_PORT, TYPE_CXL_ROOT_PORT) +/* + * If two MSI vector are allocated, Advanced Error Interrupt Message Number + * is 1. otherwise 0. + * 17.12.5.10 RPERRSTS, 32:27 bit Advanced Error Interrupt Message Number. + */ +static uint8_t cxl_rp_aer_vector(const PCIDevice *d) +{ + switch (msi_nr_vectors_allocated(d)) { + case 1: + return 0; + case 2: + return 1; + case 4: + case 8: + case 16: + case 32: + default: + break; + } + abort(); + return 0; +} + +static int cxl_rp_interrupts_init(PCIDevice *d, Error **errp) +{ + int rc; + + rc = msi_init(d, CXL_RP_MSI_OFFSET, CXL_RP_MSI_NR_VECTOR, + CXL_RP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT, + CXL_RP_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT, + errp); + if (rc < 0) { + assert(rc == -ENOTSUP); + } + + return rc; +} + +static void cxl_rp_interrupts_uninit(PCIDevice *d) +{ + msi_uninit(d); +} + static void latch_registers(CXLRootPort *crp) { uint32_t *reg_state = crp->cxl_cstate.crb.cache_mem_registers; @@ -183,6 +231,15 @@ static void cxl_rp_dvsec_write_config(PCIDevice *dev, uint32_t addr, } } +static void cxl_rp_aer_vector_update(PCIDevice *d) +{ + PCIERootPortClass *rpc = PCIE_ROOT_PORT_GET_CLASS(d); + + if (rpc->aer_vector) { + pcie_aer_root_set_vector(d, rpc->aer_vector(d)); + } +} + static void cxl_rp_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { @@ -192,6 +249,7 @@ static void cxl_rp_write_config(PCIDevice *d, uint32_t address, uint32_t val, pcie_cap_slot_get(d, &slt_ctl, &slt_sta); pci_bridge_write_config(d, address, val, len); + cxl_rp_aer_vector_update(d); pcie_cap_flr_write_config(d, address, val, len); pcie_cap_slot_write_config(d, slt_ctl, slt_sta, address, val, len); pcie_aer_write_config(d, address, val, len); @@ -220,6 +278,9 @@ static void cxl_root_port_class_init(ObjectClass *oc, void *data) rpc->aer_offset = GEN_PCIE_ROOT_PORT_AER_OFFSET; rpc->acs_offset = GEN_PCIE_ROOT_PORT_ACS_OFFSET; + rpc->aer_vector = cxl_rp_aer_vector; + rpc->interrupts_init = cxl_rp_interrupts_init; + rpc->interrupts_uninit = cxl_rp_interrupts_uninit; dc->hotpluggable = false; } From patchwork Wed Mar 8 01:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=S843AZjT; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZHp6JPSz1yWs for ; Wed, 8 Mar 2023 12:20:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNi-0004Ly-7c; Tue, 07 Mar 2023 20:14: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 1pZiNg-0004HO-TW for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14: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 1pZiNf-00022D-9Z for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238050; 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=wufX2lxAwCV78OvZ69Ib6mWVa5AYIDMc4PTsR/964xI=; b=S843AZjTIkacykgVbYNQ0KTL8XiiaT34gc1WA/0VDaWSvC1rDIN0Bulz9pV6t4j8q9aP8Z W5hKiWCiTdzr4Cj+BA5W2dNfMQRP+gLKo5z4SLLVXPqmLKkiqCk53YwvNdeNkeR2wpfh0o PPurnx8x0scEj7nDHH6QKzpXap335Nc= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-536-zrgvZKb-PP2PUHA0gzPIEw-1; Tue, 07 Mar 2023 20:14:09 -0500 X-MC-Unique: zrgvZKb-PP2PUHA0gzPIEw-1 Received: by mail-ed1-f69.google.com with SMTP id y24-20020aa7ccd8000000b004be3955a42eso21658836edt.22 for ; Tue, 07 Mar 2023 17:14:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238048; 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=wufX2lxAwCV78OvZ69Ib6mWVa5AYIDMc4PTsR/964xI=; b=LJ5ok5qr6RCzjen6J3uFQc+8B+8v13/WeRashRZ+XqzDevlHmokyxA++qoyq6GcsNR v8NCeqxvHY0oIUZ0x00Hw23Vk82cMK1gwkVuS/rHxt/1Uq+34/hgreWCVOj/r8gXq7TL rtj4zOuCFZ/PVmjK3dfUMQyF7dQZ/+ptGzfDJHD79RoNu+trb2XVpnfjr+vKauyBejhd 53kmRQeTpfKSDoydFj9pkKAmviTLwi30YfHNTrPVQCxwO134b7a0xF1M1l3oLMFEKZ+E 1ON5zWghW88hNj64luEZfCDrtbQ0RZkfEagrbBphJInxz9riE2+ZxyrfJFm6o1IzXdhn A2qg== X-Gm-Message-State: AO0yUKXJgsFM9mrWHSg8BtNfSrfvK69TCPqh556w7WCTb31xuTvcMrRA PMpOp6UdylTRkJUkOzhWj1Etv88hC8bxn0PsGuCPVxueHuxJI5frqdfBEEMqM+9oR1hbp4PQIx+ l/i6qwlQaOZjICZGKblZtmxzKo4D+zG4bPcdZ50sgvuV5vyXVu/EZ0DibSpdml973OJFi X-Received: by 2002:a17:906:4a5a:b0:87b:bbdc:468 with SMTP id a26-20020a1709064a5a00b0087bbbdc0468mr16730808ejv.70.1678238047938; Tue, 07 Mar 2023 17:14:07 -0800 (PST) X-Google-Smtp-Source: AK7set/aaCy0v896k5XUX64Nf3Zp13SqU1cKT9G9R2GmQNmf6ANy0fo3nvn7ZBRGMtjLmx/xJ/oMhQ== X-Received: by 2002:a17:906:4a5a:b0:87b:bbdc:468 with SMTP id a26-20020a1709064a5a00b0087bbbdc0468mr16730793ejv.70.1678238047661; Tue, 07 Mar 2023 17:14:07 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id vf22-20020a170907239600b008ee64893786sm6850927ejb.99.2023.03.07.17.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:07 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:05 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Fan Ni , Ben Widawsky Subject: [PULL 65/73] hw/mem/cxl-type3: Add AER extended capability Message-ID: <6be947bdfcaca6e87ee93a76b2ab2c5536b3b8a6.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron This enables AER error injection to function as expected. It is intended as a building block in enabling CXL RAS error injection in the following patches. Signed-off-by: Jonathan Cameron Reviewed-by: Dave Jiang Message-Id: <20230302133709.30373-6-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/mem/cxl_type3.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 217a5e639b..6cdd988d1d 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -250,6 +250,7 @@ static void ct3d_config_write(PCIDevice *pci_dev, uint32_t addr, uint32_t val, pcie_doe_write_config(&ct3d->doe_cdat, addr, val, size); pci_default_write_config(pci_dev, addr, val, size); + pcie_aer_write_config(pci_dev, addr, val, size); } /* @@ -452,8 +453,19 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp) cxl_cstate->cdat.free_cdat_table = ct3_free_cdat_table; cxl_cstate->cdat.private = ct3d; cxl_doe_cdat_init(cxl_cstate, errp); + + pcie_cap_deverr_init(pci_dev); + /* Leave a bit of room for expansion */ + rc = pcie_aer_init(pci_dev, PCI_ERR_VER, 0x200, PCI_ERR_SIZEOF, NULL); + if (rc) { + goto err_release_cdat; + } + return; +err_release_cdat: + cxl_doe_cdat_release(cxl_cstate); + g_free(regs->special_ops); err_address_space_free: address_space_destroy(&ct3d->hostmem_as); return; @@ -465,6 +477,7 @@ static void ct3_exit(PCIDevice *pci_dev) CXLComponentState *cxl_cstate = &ct3d->cxl_cstate; ComponentRegisters *regs = &cxl_cstate->crb; + pcie_aer_exit(pci_dev); cxl_doe_cdat_release(cxl_cstate); g_free(regs->special_ops); address_space_destroy(&ct3d->hostmem_as); From patchwork Wed Mar 8 01:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ijxzekw9; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZKM6VVqz1yWp for ; Wed, 8 Mar 2023 12:21:43 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNl-0004Mz-Dr; Tue, 07 Mar 2023 20:14:17 -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 1pZiNj-0004MX-VX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:15 -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 1pZiNi-00022i-Hx for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238053; 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=ZoK2di6xsTepZuvXZJ2+V7C+E8PsZ5zr9sGf7es+2dQ=; b=Ijxzekw9vEh3niPI1nEAoj63xQZXslu8YXifxb8fGIsTuBXvbPt85dR0n0OvoMOXaSAKaP 3HIsphqsDwSUoHbnfvDfx64tkEfS4XchGIWIgs7mHAAuz7HGwZekY97DRtVD0e2DlhOgKj f53f80RFVmmyVyjuj45i6OPdDaZQqMY= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-PlHaKUOwNru7YmdVDzJEUQ-1; Tue, 07 Mar 2023 20:14:12 -0500 X-MC-Unique: PlHaKUOwNru7YmdVDzJEUQ-1 Received: by mail-ed1-f72.google.com with SMTP id p36-20020a056402502400b004bb926a3d54so21295113eda.2 for ; Tue, 07 Mar 2023 17:14:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238051; 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=ZoK2di6xsTepZuvXZJ2+V7C+E8PsZ5zr9sGf7es+2dQ=; b=UDJptNkUWS4D3l7KzFBllqrQEHKQy/V5WlWHvfgCvSxkCXUN1b8V50fkm+DQPxPmA9 Mv5a+peBHHobEN4KAbOaUIx0gb/vCL4j7FyVW7JuLuLhuKDPV4cvSZ6HgaxnocE1yQaN KN1199blnycmn89hszQf8To0+PsVlFi6LPC+Zbu1qohikX/TKh4dqp1I0BirWxrd9Sii jOVak/VkWutb6qeC2k3U9ZX4OeV7iq9qv/tgtK7RStYrSG1+5qPJ0BLnf/VbioIbFy+r +a+6Xb9zn/aTE51a/nHzsGNa0zFajofsGH1AAvNSdXgfQ2FI05dMRvkv8fEfJ8h8RbX9 Mb/w== X-Gm-Message-State: AO0yUKWKnpf9ztQHiEokeeNh7uv9+yFKuy5xGayQoPBXSTCxx/RMbkH/ ZiIat97PpIJtSflwuztBeEwhz9C+DyHPq9Wdo2aaeXYtzjzZBintozy5u4YnDkRI6yE151gFsBf MqWA1+lePVYndqdjZHP4DIwBk7GdXu6UPTtz870y0x+mHs/5cfYh1OuWzd0N5ELyO93qf X-Received: by 2002:a17:907:7ea5:b0:8a5:3d1e:6302 with SMTP id qb37-20020a1709077ea500b008a53d1e6302mr19472022ejc.56.1678238050763; Tue, 07 Mar 2023 17:14:10 -0800 (PST) X-Google-Smtp-Source: AK7set/UC6lEPQBYtnj9r1QJU3eawvlsCK+PEOjYiDy3e6l7w7f0Nu4GNXoys6/WCuViT7RUE+rOaA== X-Received: by 2002:a17:907:7ea5:b0:8a5:3d1e:6302 with SMTP id qb37-20020a1709077ea500b008a53d1e6302mr19471998ejc.56.1678238050445; Tue, 07 Mar 2023 17:14:10 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id ga1-20020a170906b84100b008b17879ec95sm6747968ejb.22.2023.03.07.17.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:10 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:07 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Fan Ni , Ben Widawsky Subject: [PULL 66/73] hw/cxl: Fix endian issues in CXL RAS capability defaults / masks 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron As these are about to be modified, fix the endian handle for this set of registers rather than making it worse. Note that CXL is currently only supported in QEMU on x86 (arm64 patches out of tree) so we aren't going to yet hit an problems with big endian. However it is good to avoid making things worse for that support in the future. Reviewed-by: Dave Jiang Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron Message-Id: <20230302133709.30373-7-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/cxl/cxl-component-utils.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index 3edd303a33..737b4764b9 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw/cxl/cxl-component-utils.c @@ -141,17 +141,17 @@ static void ras_init_common(uint32_t *reg_state, uint32_t *write_msk) * Error status is RW1C but given bits are not yet set, it can * be handled as RO. */ - reg_state[R_CXL_RAS_UNC_ERR_STATUS] = 0; + stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_STATUS, 0); /* Bits 12-13 and 17-31 reserved in CXL 2.0 */ - reg_state[R_CXL_RAS_UNC_ERR_MASK] = 0x1cfff; - write_msk[R_CXL_RAS_UNC_ERR_MASK] = 0x1cfff; - reg_state[R_CXL_RAS_UNC_ERR_SEVERITY] = 0x1cfff; - write_msk[R_CXL_RAS_UNC_ERR_SEVERITY] = 0x1cfff; - reg_state[R_CXL_RAS_COR_ERR_STATUS] = 0; - reg_state[R_CXL_RAS_COR_ERR_MASK] = 0x7f; - write_msk[R_CXL_RAS_COR_ERR_MASK] = 0x7f; + stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_MASK, 0x1cfff); + stl_le_p(write_msk + R_CXL_RAS_UNC_ERR_MASK, 0x1cfff); + stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_SEVERITY, 0x1cfff); + stl_le_p(write_msk + R_CXL_RAS_UNC_ERR_SEVERITY, 0x1cfff); + stl_le_p(reg_state + R_CXL_RAS_COR_ERR_STATUS, 0); + stl_le_p(reg_state + R_CXL_RAS_COR_ERR_MASK, 0x7f); + stl_le_p(write_msk + R_CXL_RAS_COR_ERR_MASK, 0x7f); /* CXL switches and devices must set */ - reg_state[R_CXL_RAS_ERR_CAP_CTRL] = 0x00; + stl_le_p(reg_state + R_CXL_RAS_ERR_CAP_CTRL, 0x00); } static void hdm_init_common(uint32_t *reg_state, uint32_t *write_msk, From patchwork Wed Mar 8 01:14:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753789 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ck/JwFGs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZ902KHRz1yWs for ; Wed, 8 Mar 2023 12:14:28 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNo-0004NJ-3Q; Tue, 07 Mar 2023 20:14: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 1pZiNm-0004N2-JO for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:18 -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 1pZiNl-00023K-4b for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238056; 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=tzdleBV3ydVretX/x8wf3hLhlAqIVmJyGtJ2OmsiBtw=; b=Ck/JwFGsIU4swltFKxJLEI+1lMR2BkoBnuT55rnn85WWwjVp35YnccE7pp39DGxncuMTPs obLmKzCfcmlsjwuN34iObkixUn/bjJB5sTWh8bz7Yu5fEvtic4o1IBywWFqIH/o3lykNpJ HGFK41xmJldP3hF9MOtM5bBDLgMotyU= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-20-lxrfCHXJMamVryQ2kYbjTA-1; Tue, 07 Mar 2023 20:14:15 -0500 X-MC-Unique: lxrfCHXJMamVryQ2kYbjTA-1 Received: by mail-ed1-f71.google.com with SMTP id ev6-20020a056402540600b004bc2358ac04so21657713edb.21 for ; Tue, 07 Mar 2023 17:14:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238053; 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=tzdleBV3ydVretX/x8wf3hLhlAqIVmJyGtJ2OmsiBtw=; b=B1LW3c0XxoZhMkKnB0HBSVHaEdZU89TaIrn9zklj7of4KIjvJvMF2LusIBeR/lhM99 +QkiXREVwWhERNJgDIK1Mxwc+wEJ7CAbhJxqnvkNVm2WUVxJvwBh+RjIUJihDXd1ogmn PJ7QmHcsXXifL7mqHos0negSlTvT7G8Xhxlgrqxe2Gd8O3f1i+bmjLi0gGYjg7vVkis1 R/lA5vBLqSRzz3zXSuvYu+ftlNAezY3SxUmFCIjyMXkb0jHi1ex7xwRxEAKmzc0di/DE QknV8EkHaPvpAKlQryHhgad2LOu33C9Zm4TtGexbm31+2j4RgtJSVHHznTztd9dwGUt8 YgGw== X-Gm-Message-State: AO0yUKXR7kSL0DK7Zkv4hnG+mBhZEV2bH63ADweiWg+S9rk5P9b1i9JU qsRqE+i8N9LrsWkoaTZKLEnHOM4ZO7BE80+ICvGGXtRo6Ns+9qFS47tQ3v3i1Ers4xBPuh3J8Br NTCDz+vdWtnPM7EUvvk08ZIGpczW8Tl3nechmd3KPsau4SEgGxrFJGcq6mQy6by0tskt5 X-Received: by 2002:a17:907:9a99:b0:918:668d:d6f9 with SMTP id km25-20020a1709079a9900b00918668dd6f9mr2356400ejc.16.1678238053764; Tue, 07 Mar 2023 17:14:13 -0800 (PST) X-Google-Smtp-Source: AK7set97JfDyG04FSmZCG3ZbrahM9m35IUMnN7//wOEPSBUCUzJyA6MQzOD8MjRcwPbehVKQCs+O1g== X-Received: by 2002:a17:907:9a99:b0:918:668d:d6f9 with SMTP id km25-20020a1709079a9900b00918668dd6f9mr2356381ejc.16.1678238053512; Tue, 07 Mar 2023 17:14:13 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id y7-20020a170906470700b008ef13127b5fsm6782613ejq.29.2023.03.07.17.14.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:13 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:10 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Dave Jiang , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Fan Ni , Marcel Apfelbaum Subject: [PULL 67/73] hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use. Message-ID: <4a295211f7d76d092bf0abcbee6891e8f053f6b8.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron This infrastructure will be reused for CXL RAS error injection in patches that follow. Reviewed-by: Dave Jiang Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Jonathan Cameron Message-Id: <20230302133709.30373-8-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Fan Ni --- hw/pci/pci-internal.h | 1 - include/hw/pci/pcie_aer.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci-internal.h b/hw/pci/pci-internal.h index 2ea356bdf5..a7d6d8a732 100644 --- a/hw/pci/pci-internal.h +++ b/hw/pci/pci-internal.h @@ -20,6 +20,5 @@ void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent); int pcie_aer_parse_error_string(const char *error_name, uint32_t *status, bool *correctable); -int pcie_aer_inject_error(PCIDevice *dev, const PCIEAERErr *err); #endif diff --git a/include/hw/pci/pcie_aer.h b/include/hw/pci/pcie_aer.h index 65e71d98fe..1234fdc4e2 100644 --- a/include/hw/pci/pcie_aer.h +++ b/include/hw/pci/pcie_aer.h @@ -100,4 +100,5 @@ void pcie_aer_root_write_config(PCIDevice *dev, uint32_t addr, uint32_t val, int len, uint32_t root_cmd_prev); +int pcie_aer_inject_error(PCIDevice *dev, const PCIEAERErr *err); #endif /* QEMU_PCIE_AER_H */ From patchwork Wed Mar 8 01:14:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ajNqHw2O; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZCj2qNvz1yWr for ; Wed, 8 Mar 2023 12:16:47 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNt-0004YL-PU; Tue, 07 Mar 2023 20:14: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 1pZiNs-0004SA-1E for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:24 -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 1pZiNp-00023Z-3J for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238060; 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=TiqhwQhxDUFf15M/U0odvx6DlCwJ2sDwp/+vpZj/v7g=; b=ajNqHw2OnvTHhuncLEgEp9DAxNrIbTtpHUG8e4CYnIS3C6LwX4a/yl8Gu/YjaPnG9vTDRU 4Y9vyNmRoToGZ3sJ0+9ygCQxFxfI/PeKbFPleTCpUNKPEYkogeXr9f8Y4XhQAhzy0yszcJ +1QIS/uq2MnQ6su5DBMXrV561Inm2e4= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-PUbaGU3JMiuGpLwPp8E--g-1; Tue, 07 Mar 2023 20:14:19 -0500 X-MC-Unique: PUbaGU3JMiuGpLwPp8E--g-1 Received: by mail-ed1-f70.google.com with SMTP id c1-20020a0564021f8100b004acbe232c03so21093984edc.9 for ; Tue, 07 Mar 2023 17:14:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238057; 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=TiqhwQhxDUFf15M/U0odvx6DlCwJ2sDwp/+vpZj/v7g=; b=ZLHNPuN0sU8cQaiqE9xEpPbcctHyuj22dNY5UZ9hHl0C9ivSCO9Pc9ehOtQsfwQvtY zk2jFXQR3DIvezgmpwVqCM9kork7/Ic/K7qJ/fZLzWLMxUy+0k8peU3k4LpHcdqI7zyC bUGSTHsuIL8CibbXOEVUt4AJhB6qbQX0Aze+LnYahKLeirsB1RkrK7Aj2YSc6sduOzik dr+XVK2a2esbK+TtlzIL4PQpdiuBxhSqfXiSCSNsGqRHheCg8RtBbZyDw1qLKSTPICX8 X4/+GyieqQrg7LwCNqWiMbGVS1wzBmD6ZYUzWdS1yAuI4iKlTcB4WAmbSkgtCJP+UP5O yifw== X-Gm-Message-State: AO0yUKUbRc0mrZkfzHe6sTLq1iFESBwOxni0wzJYs///aOEo1UxKfEJO fBsZbBQyseZbRhVcJ3APDXq/5J/IoKpSOfiRdaYNPaf31hMguBnM/rekl+EhROVSXfhX9KuVyTT TvFx0SEvH8LO0gohrw31ASsJDyNT/s6LYSvS4VBhtEevriao0Dyt1e3T/NYKpOQW7wPg4 X-Received: by 2002:a17:907:c297:b0:8f6:88b7:73a7 with SMTP id tk23-20020a170907c29700b008f688b773a7mr14442960ejc.7.1678238057252; Tue, 07 Mar 2023 17:14:17 -0800 (PST) X-Google-Smtp-Source: AK7set8Pcy2e7Bv0rVSF7MTxm8HSMeH7sl6LS8YxhLhPeXZ3ex7j0HftSF+qc1BDVxSpqrcUK9l3IA== X-Received: by 2002:a17:907:c297:b0:8f6:88b7:73a7 with SMTP id tk23-20020a170907c29700b008f688b773a7mr14442939ejc.7.1678238056679; Tue, 07 Mar 2023 17:14:16 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id j6-20020a17090686c600b008c44438734csm6790724ejy.113.2023.03.07.17.14.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:16 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:13 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Ben Widawsky , Fan Ni , Eric Blake , Markus Armbruster , Michael Roth Subject: [PULL 68/73] hw/mem/cxl_type3: Add CXL RAS Error Injection Support. Message-ID: <415442a1b4ad31521bbe7ae8bf4ee5d25af3977f.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron CXL uses PCI AER Internal errors to signal to the host that an error has occurred. The host can then read more detailed status from the CXL RAS capability. For uncorrectable errors: support multiple injection in one operation as this is needed to reliably test multiple header logging support in an OS. The equivalent feature doesn't exist for correctable errors, so only one error need be injected at a time. Note: - Header content needs to be manually specified in a fashion that matches the specification for what can be in the header for each error type. Injection via QMP: { "execute": "qmp_capabilities" } ... { "execute": "cxl-inject-uncorrectable-errors", "arguments": { "path": "/machine/peripheral/cxl-pmem0", "errors": [ { "type": "cache-address-parity", "header": [ 3, 4] }, { "type": "cache-data-parity", "header": [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31] }, { "type": "internal", "header": [ 1, 2, 4] } ] }} ... { "execute": "cxl-inject-correctable-error", "arguments": { "path": "/machine/peripheral/cxl-pmem0", "type": "physical" } } Signed-off-by: Jonathan Cameron Message-Id: <20230302133709.30373-9-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- qapi/cxl.json | 128 +++++++++++++++ qapi/qapi-schema.json | 1 + include/hw/cxl/cxl_component.h | 26 +++ include/hw/cxl/cxl_device.h | 11 ++ hw/cxl/cxl-component-utils.c | 4 +- hw/mem/cxl_type3.c | 281 +++++++++++++++++++++++++++++++++ hw/mem/cxl_type3_stubs.c | 17 ++ hw/mem/meson.build | 2 + qapi/meson.build | 1 + 9 files changed, 470 insertions(+), 1 deletion(-) create mode 100644 qapi/cxl.json create mode 100644 hw/mem/cxl_type3_stubs.c diff --git a/qapi/cxl.json b/qapi/cxl.json new file mode 100644 index 0000000000..4be7d46041 --- /dev/null +++ b/qapi/cxl.json @@ -0,0 +1,128 @@ +# -*- Mode: Python -*- +# vim: filetype=python + +## +# = CXL devices +## + +## +# @CxlUncorErrorType: +# +# Type of uncorrectable CXL error to inject. These errors are reported via +# an AER uncorrectable internal error with additional information logged at +# the CXL device. +# +# @cache-data-parity: Data error such as data parity or data ECC error CXL.cache +# @cache-address-parity: Address parity or other errors associated with the +# address field on CXL.cache +# @cache-be-parity: Byte enable parity or other byte enable errors on CXL.cache +# @cache-data-ecc: ECC error on CXL.cache +# @mem-data-parity: Data error such as data parity or data ECC error on CXL.mem +# @mem-address-parity: Address parity or other errors associated with the +# address field on CXL.mem +# @mem-be-parity: Byte enable parity or other byte enable errors on CXL.mem. +# @mem-data-ecc: Data ECC error on CXL.mem. +# @reinit-threshold: REINIT threshold hit. +# @rsvd-encoding: Received unrecognized encoding. +# @poison-received: Received poison from the peer. +# @receiver-overflow: Buffer overflows (first 3 bits of header log indicate which) +# @internal: Component specific error +# @cxl-ide-tx: Integrity and data encryption tx error. +# @cxl-ide-rx: Integrity and data encryption rx error. +# +# Since: 8.0 +## + +{ 'enum': 'CxlUncorErrorType', + 'data': ['cache-data-parity', + 'cache-address-parity', + 'cache-be-parity', + 'cache-data-ecc', + 'mem-data-parity', + 'mem-address-parity', + 'mem-be-parity', + 'mem-data-ecc', + 'reinit-threshold', + 'rsvd-encoding', + 'poison-received', + 'receiver-overflow', + 'internal', + 'cxl-ide-tx', + 'cxl-ide-rx' + ] + } + +## +# @CXLUncorErrorRecord: +# +# Record of a single error including header log. +# +# @type: Type of error +# @header: 16 DWORD of header. +# +# Since: 8.0 +## +{ 'struct': 'CXLUncorErrorRecord', + 'data': { + 'type': 'CxlUncorErrorType', + 'header': [ 'uint32' ] + } +} + +## +# @cxl-inject-uncorrectable-errors: +# +# Command to allow injection of multiple errors in one go. This allows testing +# of multiple header log handling in the OS. +# +# @path: CXL Type 3 device canonical QOM path +# @errors: Errors to inject +# +# Since: 8.0 +## +{ 'command': 'cxl-inject-uncorrectable-errors', + 'data': { 'path': 'str', + 'errors': [ 'CXLUncorErrorRecord' ] }} + +## +# @CxlCorErrorType: +# +# Type of CXL correctable error to inject +# +# @cache-data-ecc: Data ECC error on CXL.cache +# @mem-data-ecc: Data ECC error on CXL.mem +# @crc-threshold: Component specific and applicable to 68 byte Flit mode only. +# @cache-poison-received: Received poison from a peer on CXL.cache. +# @mem-poison-received: Received poison from a peer on CXL.mem +# @physical: Received error indication from the physical layer. +# +# Since: 8.0 +## +{ 'enum': 'CxlCorErrorType', + 'data': ['cache-data-ecc', + 'mem-data-ecc', + 'crc-threshold', + 'retry-threshold', + 'cache-poison-received', + 'mem-poison-received', + 'physical'] +} + +## +# @cxl-inject-correctable-error: +# +# Command to inject a single correctable error. Multiple error injection +# of this error type is not interesting as there is no associated header log. +# These errors are reported via AER as a correctable internal error, with +# additional detail available from the CXL device. +# +# @path: CXL Type 3 device canonical QOM path +# @type: Type of error. +# +# Since: 8.0 +## +{ 'command': 'cxl-inject-correctable-error', + 'data': { 'path': 'str', + 'type': 'CxlCorErrorType' + } +} diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index 1e923945db..7c09af5cc8 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -96,3 +96,4 @@ { 'include': 'stats.json' } { 'include': 'virtio.json' } { 'include': 'cryptodev.json' } +{ 'include': 'cxl.json' } diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h index 692d7a5507..ec4203b83f 100644 --- a/include/hw/cxl/cxl_component.h +++ b/include/hw/cxl/cxl_component.h @@ -65,11 +65,37 @@ CXLx_CAPABILITY_HEADER(SNOOP, 0x14) #define CXL_RAS_REGISTERS_OFFSET 0x80 #define CXL_RAS_REGISTERS_SIZE 0x58 REG32(CXL_RAS_UNC_ERR_STATUS, CXL_RAS_REGISTERS_OFFSET) +#define CXL_RAS_UNC_ERR_CACHE_DATA_PARITY 0 +#define CXL_RAS_UNC_ERR_CACHE_ADDRESS_PARITY 1 +#define CXL_RAS_UNC_ERR_CACHE_BE_PARITY 2 +#define CXL_RAS_UNC_ERR_CACHE_DATA_ECC 3 +#define CXL_RAS_UNC_ERR_MEM_DATA_PARITY 4 +#define CXL_RAS_UNC_ERR_MEM_ADDRESS_PARITY 5 +#define CXL_RAS_UNC_ERR_MEM_BE_PARITY 6 +#define CXL_RAS_UNC_ERR_MEM_DATA_ECC 7 +#define CXL_RAS_UNC_ERR_REINIT_THRESHOLD 8 +#define CXL_RAS_UNC_ERR_RSVD_ENCODING 9 +#define CXL_RAS_UNC_ERR_POISON_RECEIVED 10 +#define CXL_RAS_UNC_ERR_RECEIVER_OVERFLOW 11 +#define CXL_RAS_UNC_ERR_INTERNAL 14 +#define CXL_RAS_UNC_ERR_CXL_IDE_TX 15 +#define CXL_RAS_UNC_ERR_CXL_IDE_RX 16 +#define CXL_RAS_UNC_ERR_CXL_UNUSED 63 /* Magic value */ REG32(CXL_RAS_UNC_ERR_MASK, CXL_RAS_REGISTERS_OFFSET + 0x4) REG32(CXL_RAS_UNC_ERR_SEVERITY, CXL_RAS_REGISTERS_OFFSET + 0x8) REG32(CXL_RAS_COR_ERR_STATUS, CXL_RAS_REGISTERS_OFFSET + 0xc) +#define CXL_RAS_COR_ERR_CACHE_DATA_ECC 0 +#define CXL_RAS_COR_ERR_MEM_DATA_ECC 1 +#define CXL_RAS_COR_ERR_CRC_THRESHOLD 2 +#define CXL_RAS_COR_ERR_RETRY_THRESHOLD 3 +#define CXL_RAS_COR_ERR_CACHE_POISON_RECEIVED 4 +#define CXL_RAS_COR_ERR_MEM_POISON_RECEIVED 5 +#define CXL_RAS_COR_ERR_PHYSICAL 6 REG32(CXL_RAS_COR_ERR_MASK, CXL_RAS_REGISTERS_OFFSET + 0x10) REG32(CXL_RAS_ERR_CAP_CTRL, CXL_RAS_REGISTERS_OFFSET + 0x14) + FIELD(CXL_RAS_ERR_CAP_CTRL, FIRST_ERROR_POINTER, 0, 6) +REG32(CXL_RAS_ERR_HEADER0, CXL_RAS_REGISTERS_OFFSET + 0x18) +#define CXL_RAS_ERR_HEADER_NUM 32 /* Offset 0x18 - 0x58 reserved for RAS logs */ /* 8.2.5.10 - CXL Security Capability Structure */ diff --git a/include/hw/cxl/cxl_device.h b/include/hw/cxl/cxl_device.h index 7e5ad65c1d..d589f78202 100644 --- a/include/hw/cxl/cxl_device.h +++ b/include/hw/cxl/cxl_device.h @@ -232,6 +232,14 @@ REG64(CXL_MEM_DEV_STS, 0) FIELD(CXL_MEM_DEV_STS, MBOX_READY, 4, 1) FIELD(CXL_MEM_DEV_STS, RESET_NEEDED, 5, 3) +typedef struct CXLError { + QTAILQ_ENTRY(CXLError) node; + int type; /* Error code as per FE definition */ + uint32_t header[32]; +} CXLError; + +typedef QTAILQ_HEAD(, CXLError) CXLErrorList; + struct CXLType3Dev { /* Private */ PCIDevice parent_obj; @@ -248,6 +256,9 @@ struct CXLType3Dev { /* DOE */ DOECap doe_cdat; + + /* Error injection */ + CXLErrorList error_list; }; #define TYPE_CXL_TYPE3 "cxl-type3" diff --git a/hw/cxl/cxl-component-utils.c b/hw/cxl/cxl-component-utils.c index 737b4764b9..b665d4f565 100644 --- a/hw/cxl/cxl-component-utils.c +++ b/hw/cxl/cxl-component-utils.c @@ -142,16 +142,18 @@ static void ras_init_common(uint32_t *reg_state, uint32_t *write_msk) * be handled as RO. */ stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_STATUS, 0); + stl_le_p(write_msk + R_CXL_RAS_UNC_ERR_STATUS, 0x1cfff); /* Bits 12-13 and 17-31 reserved in CXL 2.0 */ stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_MASK, 0x1cfff); stl_le_p(write_msk + R_CXL_RAS_UNC_ERR_MASK, 0x1cfff); stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_SEVERITY, 0x1cfff); stl_le_p(write_msk + R_CXL_RAS_UNC_ERR_SEVERITY, 0x1cfff); stl_le_p(reg_state + R_CXL_RAS_COR_ERR_STATUS, 0); + stl_le_p(write_msk + R_CXL_RAS_COR_ERR_STATUS, 0x7f); stl_le_p(reg_state + R_CXL_RAS_COR_ERR_MASK, 0x7f); stl_le_p(write_msk + R_CXL_RAS_COR_ERR_MASK, 0x7f); /* CXL switches and devices must set */ - stl_le_p(reg_state + R_CXL_RAS_ERR_CAP_CTRL, 0x00); + stl_le_p(reg_state + R_CXL_RAS_ERR_CAP_CTRL, 0x200); } static void hdm_init_common(uint32_t *reg_state, uint32_t *write_msk, diff --git a/hw/mem/cxl_type3.c b/hw/mem/cxl_type3.c index 6cdd988d1d..abe60b362c 100644 --- a/hw/mem/cxl_type3.c +++ b/hw/mem/cxl_type3.c @@ -1,6 +1,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/error-report.h" +#include "qapi/qapi-commands-cxl.h" #include "hw/mem/memory-device.h" #include "hw/mem/pc-dimm.h" #include "hw/pci/pci.h" @@ -323,6 +324,66 @@ static void hdm_decoder_commit(CXLType3Dev *ct3d, int which) ARRAY_FIELD_DP32(cache_mem, CXL_HDM_DECODER0_CTRL, COMMITTED, 1); } +static int ct3d_qmp_uncor_err_to_cxl(CxlUncorErrorType qmp_err) +{ + switch (qmp_err) { + case CXL_UNCOR_ERROR_TYPE_CACHE_DATA_PARITY: + return CXL_RAS_UNC_ERR_CACHE_DATA_PARITY; + case CXL_UNCOR_ERROR_TYPE_CACHE_ADDRESS_PARITY: + return CXL_RAS_UNC_ERR_CACHE_ADDRESS_PARITY; + case CXL_UNCOR_ERROR_TYPE_CACHE_BE_PARITY: + return CXL_RAS_UNC_ERR_CACHE_BE_PARITY; + case CXL_UNCOR_ERROR_TYPE_CACHE_DATA_ECC: + return CXL_RAS_UNC_ERR_CACHE_DATA_ECC; + case CXL_UNCOR_ERROR_TYPE_MEM_DATA_PARITY: + return CXL_RAS_UNC_ERR_MEM_DATA_PARITY; + case CXL_UNCOR_ERROR_TYPE_MEM_ADDRESS_PARITY: + return CXL_RAS_UNC_ERR_MEM_ADDRESS_PARITY; + case CXL_UNCOR_ERROR_TYPE_MEM_BE_PARITY: + return CXL_RAS_UNC_ERR_MEM_BE_PARITY; + case CXL_UNCOR_ERROR_TYPE_MEM_DATA_ECC: + return CXL_RAS_UNC_ERR_MEM_DATA_ECC; + case CXL_UNCOR_ERROR_TYPE_REINIT_THRESHOLD: + return CXL_RAS_UNC_ERR_REINIT_THRESHOLD; + case CXL_UNCOR_ERROR_TYPE_RSVD_ENCODING: + return CXL_RAS_UNC_ERR_RSVD_ENCODING; + case CXL_UNCOR_ERROR_TYPE_POISON_RECEIVED: + return CXL_RAS_UNC_ERR_POISON_RECEIVED; + case CXL_UNCOR_ERROR_TYPE_RECEIVER_OVERFLOW: + return CXL_RAS_UNC_ERR_RECEIVER_OVERFLOW; + case CXL_UNCOR_ERROR_TYPE_INTERNAL: + return CXL_RAS_UNC_ERR_INTERNAL; + case CXL_UNCOR_ERROR_TYPE_CXL_IDE_TX: + return CXL_RAS_UNC_ERR_CXL_IDE_TX; + case CXL_UNCOR_ERROR_TYPE_CXL_IDE_RX: + return CXL_RAS_UNC_ERR_CXL_IDE_RX; + default: + return -EINVAL; + } +} + +static int ct3d_qmp_cor_err_to_cxl(CxlCorErrorType qmp_err) +{ + switch (qmp_err) { + case CXL_COR_ERROR_TYPE_CACHE_DATA_ECC: + return CXL_RAS_COR_ERR_CACHE_DATA_ECC; + case CXL_COR_ERROR_TYPE_MEM_DATA_ECC: + return CXL_RAS_COR_ERR_MEM_DATA_ECC; + case CXL_COR_ERROR_TYPE_CRC_THRESHOLD: + return CXL_RAS_COR_ERR_CRC_THRESHOLD; + case CXL_COR_ERROR_TYPE_RETRY_THRESHOLD: + return CXL_RAS_COR_ERR_RETRY_THRESHOLD; + case CXL_COR_ERROR_TYPE_CACHE_POISON_RECEIVED: + return CXL_RAS_COR_ERR_CACHE_POISON_RECEIVED; + case CXL_COR_ERROR_TYPE_MEM_POISON_RECEIVED: + return CXL_RAS_COR_ERR_MEM_POISON_RECEIVED; + case CXL_COR_ERROR_TYPE_PHYSICAL: + return CXL_RAS_COR_ERR_PHYSICAL; + default: + return -EINVAL; + } +} + static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { @@ -341,6 +402,83 @@ static void ct3d_reg_write(void *opaque, hwaddr offset, uint64_t value, should_commit = FIELD_EX32(value, CXL_HDM_DECODER0_CTRL, COMMIT); which_hdm = 0; break; + case A_CXL_RAS_UNC_ERR_STATUS: + { + uint32_t capctrl = ldl_le_p(cache_mem + R_CXL_RAS_ERR_CAP_CTRL); + uint32_t fe = FIELD_EX32(capctrl, CXL_RAS_ERR_CAP_CTRL, FIRST_ERROR_POINTER); + CXLError *cxl_err; + uint32_t unc_err; + + /* + * If single bit written that corresponds to the first error + * pointer being cleared, update the status and header log. + */ + if (!QTAILQ_EMPTY(&ct3d->error_list)) { + if ((1 << fe) ^ value) { + CXLError *cxl_next; + /* + * Software is using wrong flow for multiple header recording + * Following behavior in PCIe r6.0 and assuming multiple + * header support. Implementation defined choice to clear all + * matching records if more than one bit set - which corresponds + * closest to behavior of hardware not capable of multiple + * header recording. + */ + QTAILQ_FOREACH_SAFE(cxl_err, &ct3d->error_list, node, cxl_next) { + if ((1 << cxl_err->type) & value) { + QTAILQ_REMOVE(&ct3d->error_list, cxl_err, node); + g_free(cxl_err); + } + } + } else { + /* Done with previous FE, so drop from list */ + cxl_err = QTAILQ_FIRST(&ct3d->error_list); + QTAILQ_REMOVE(&ct3d->error_list, cxl_err, node); + g_free(cxl_err); + } + + /* + * If there is another FE, then put that in place and update + * the header log + */ + if (!QTAILQ_EMPTY(&ct3d->error_list)) { + uint32_t *header_log = &cache_mem[R_CXL_RAS_ERR_HEADER0]; + int i; + + cxl_err = QTAILQ_FIRST(&ct3d->error_list); + for (i = 0; i < CXL_RAS_ERR_HEADER_NUM; i++) { + stl_le_p(header_log + i, cxl_err->header[i]); + } + capctrl = FIELD_DP32(capctrl, CXL_RAS_ERR_CAP_CTRL, + FIRST_ERROR_POINTER, cxl_err->type); + } else { + /* + * If no more errors, then follow recomendation of PCI spec + * r6.0 6.2.4.2 to set the first error pointer to a status + * bit that will never be used. + */ + capctrl = FIELD_DP32(capctrl, CXL_RAS_ERR_CAP_CTRL, + FIRST_ERROR_POINTER, + CXL_RAS_UNC_ERR_CXL_UNUSED); + } + stl_le_p((uint8_t *)cache_mem + A_CXL_RAS_ERR_CAP_CTRL, capctrl); + } + unc_err = 0; + QTAILQ_FOREACH(cxl_err, &ct3d->error_list, node) { + unc_err |= 1 << cxl_err->type; + } + stl_le_p((uint8_t *)cache_mem + offset, unc_err); + + return; + } + case A_CXL_RAS_COR_ERR_STATUS: + { + uint32_t rw1c = value; + uint32_t temp = ldl_le_p((uint8_t *)cache_mem + offset); + temp &= ~rw1c; + stl_le_p((uint8_t *)cache_mem + offset, temp); + return; + } default: break; } @@ -404,6 +542,8 @@ static void ct3_realize(PCIDevice *pci_dev, Error **errp) unsigned short msix_num = 1; int i, rc; + QTAILQ_INIT(&ct3d->error_list); + if (!cxl_setup_memory(ct3d, errp)) { return; } @@ -631,6 +771,147 @@ static void set_lsa(CXLType3Dev *ct3d, const void *buf, uint64_t size, */ } +/* For uncorrectable errors include support for multiple header recording */ +void qmp_cxl_inject_uncorrectable_errors(const char *path, + CXLUncorErrorRecordList *errors, + Error **errp) +{ + Object *obj = object_resolve_path(path, NULL); + static PCIEAERErr err = {}; + CXLType3Dev *ct3d; + CXLError *cxl_err; + uint32_t *reg_state; + uint32_t unc_err; + bool first; + + if (!obj) { + error_setg(errp, "Unable to resolve path"); + return; + } + + if (!object_dynamic_cast(obj, TYPE_CXL_TYPE3)) { + error_setg(errp, "Path does not point to a CXL type 3 device"); + return; + } + + err.status = PCI_ERR_UNC_INTN; + err.source_id = pci_requester_id(PCI_DEVICE(obj)); + err.flags = 0; + + ct3d = CXL_TYPE3(obj); + + first = QTAILQ_EMPTY(&ct3d->error_list); + reg_state = ct3d->cxl_cstate.crb.cache_mem_registers; + while (errors) { + uint32List *header = errors->value->header; + uint8_t header_count = 0; + int cxl_err_code; + + cxl_err_code = ct3d_qmp_uncor_err_to_cxl(errors->value->type); + if (cxl_err_code < 0) { + error_setg(errp, "Unknown error code"); + return; + } + + /* If the error is masked, nothing to do here */ + if (!((1 << cxl_err_code) & + ~ldl_le_p(reg_state + R_CXL_RAS_UNC_ERR_MASK))) { + errors = errors->next; + continue; + } + + cxl_err = g_malloc0(sizeof(*cxl_err)); + if (!cxl_err) { + return; + } + + cxl_err->type = cxl_err_code; + while (header && header_count < 32) { + cxl_err->header[header_count++] = header->value; + header = header->next; + } + if (header_count > 32) { + error_setg(errp, "Header must be 32 DWORD or less"); + return; + } + QTAILQ_INSERT_TAIL(&ct3d->error_list, cxl_err, node); + + errors = errors->next; + } + + if (first && !QTAILQ_EMPTY(&ct3d->error_list)) { + uint32_t *cache_mem = ct3d->cxl_cstate.crb.cache_mem_registers; + uint32_t capctrl = ldl_le_p(cache_mem + R_CXL_RAS_ERR_CAP_CTRL); + uint32_t *header_log = &cache_mem[R_CXL_RAS_ERR_HEADER0]; + int i; + + cxl_err = QTAILQ_FIRST(&ct3d->error_list); + for (i = 0; i < CXL_RAS_ERR_HEADER_NUM; i++) { + stl_le_p(header_log + i, cxl_err->header[i]); + } + + capctrl = FIELD_DP32(capctrl, CXL_RAS_ERR_CAP_CTRL, + FIRST_ERROR_POINTER, cxl_err->type); + stl_le_p(cache_mem + R_CXL_RAS_ERR_CAP_CTRL, capctrl); + } + + unc_err = 0; + QTAILQ_FOREACH(cxl_err, &ct3d->error_list, node) { + unc_err |= (1 << cxl_err->type); + } + if (!unc_err) { + return; + } + + stl_le_p(reg_state + R_CXL_RAS_UNC_ERR_STATUS, unc_err); + pcie_aer_inject_error(PCI_DEVICE(obj), &err); + + return; +} + +void qmp_cxl_inject_correctable_error(const char *path, CxlCorErrorType type, + Error **errp) +{ + static PCIEAERErr err = {}; + Object *obj = object_resolve_path(path, NULL); + CXLType3Dev *ct3d; + uint32_t *reg_state; + uint32_t cor_err; + int cxl_err_type; + + if (!obj) { + error_setg(errp, "Unable to resolve path"); + return; + } + if (!object_dynamic_cast(obj, TYPE_CXL_TYPE3)) { + error_setg(errp, "Path does not point to a CXL type 3 device"); + return; + } + + err.status = PCI_ERR_COR_INTERNAL; + err.source_id = pci_requester_id(PCI_DEVICE(obj)); + err.flags = PCIE_AER_ERR_IS_CORRECTABLE; + + ct3d = CXL_TYPE3(obj); + reg_state = ct3d->cxl_cstate.crb.cache_mem_registers; + cor_err = ldl_le_p(reg_state + R_CXL_RAS_COR_ERR_STATUS); + + cxl_err_type = ct3d_qmp_cor_err_to_cxl(type); + if (cxl_err_type < 0) { + error_setg(errp, "Invalid COR error"); + return; + } + /* If the error is masked, nothting to do here */ + if (!((1 << cxl_err_type) & ~ldl_le_p(reg_state + R_CXL_RAS_COR_ERR_MASK))) { + return; + } + + cor_err |= (1 << cxl_err_type); + stl_le_p(reg_state + R_CXL_RAS_COR_ERR_STATUS, cor_err); + + pcie_aer_inject_error(PCI_DEVICE(obj), &err); +} + static void ct3_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); diff --git a/hw/mem/cxl_type3_stubs.c b/hw/mem/cxl_type3_stubs.c new file mode 100644 index 0000000000..d574c58f9a --- /dev/null +++ b/hw/mem/cxl_type3_stubs.c @@ -0,0 +1,17 @@ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-cxl.h" + +void qmp_cxl_inject_uncorrectable_errors(const char *path, + CXLUncorErrorRecordList *errors, + Error **errp) +{ + error_setg(errp, "CXL Type 3 support is not compiled in"); +} + +void qmp_cxl_inject_correctable_error(const char *path, CxlCorErrorType type, + Error **errp) +{ + error_setg(errp, "CXL Type 3 support is not compiled in"); +} diff --git a/hw/mem/meson.build b/hw/mem/meson.build index 609b2b36fc..56c2618b84 100644 --- a/hw/mem/meson.build +++ b/hw/mem/meson.build @@ -4,6 +4,8 @@ mem_ss.add(when: 'CONFIG_DIMM', if_true: files('pc-dimm.c')) mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c')) mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c')) mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c')) +softmmu_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c')) +softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('cxl_type3_stubs.c')) softmmu_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss) diff --git a/qapi/meson.build b/qapi/meson.build index 1c37ae7491..9fd480c4d8 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -31,6 +31,7 @@ qapi_all_modules = [ 'compat', 'control', 'crypto', + 'cxl', 'dump', 'error', 'introspect', From patchwork Wed Mar 8 01:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753800 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=IBLGlNCP; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZBS0hHzz1yWr for ; Wed, 8 Mar 2023 12:15:44 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiNt-0004Z6-W5; Tue, 07 Mar 2023 20:14:26 -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 1pZiNs-0004U1-Tg for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:24 -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 1pZiNr-00023n-8n for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238062; 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=TI0QwX5R2AUisoNDQLeEN83k4qGzeGJatZpv9QZn/bA=; b=IBLGlNCPmSNqmIF1PULx31eg2diakeixFV6Yj597Oahr1XJ7lGyXg5kNIPoPggh+Pmd4m/ 9DS1+6UmCXRJIlYlI3PlivY5aSKNkednz5UbjTr3nMZHdC81gESFNWGG95e9Y6EdKNyQDm 42KFw69wdTMP/xFKUkPQVmC+kPpOCTQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-630-iHm3Sk7AM8WX-ybBbXMv-Q-1; Tue, 07 Mar 2023 20:14:21 -0500 X-MC-Unique: iHm3Sk7AM8WX-ybBbXMv-Q-1 Received: by mail-ed1-f72.google.com with SMTP id ec11-20020a0564020d4b00b004e2cb85c8bcso12393275edb.16 for ; Tue, 07 Mar 2023 17:14:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238060; 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=TI0QwX5R2AUisoNDQLeEN83k4qGzeGJatZpv9QZn/bA=; b=FI3E8uSLC97JsXNqSEgGk026FAS+WD5DEsdjODyVUSh13gfiB+4oa6YKNH/ttxOKdV ep+nTcbHwuwK0nQpP8L/dWknLtpUxjj83lnnE7T33ewtEGsbLms3cAGftBNNLHEONeo2 yONYlgxAKzcBTzwReHOmqHuF+RcNM/nViMjtwyTAVR4z+5K/Yn7B7t5tS/mcHFzVePjT J1jAstpobTFzE3xlMAgLYh/Szh09f3pKi3oOPMsr9M/XlneMQ1CURWzupwvmn2cWwlvL her/vCIYDgfjEU9VETkv8C9rWrZG12w0wIkEcJTixMZBCuC0PEdBP8Zj7jHUdzro/ntQ J71w== X-Gm-Message-State: AO0yUKXxQSlv1MK7wZFKT2UxOJ3A4lax+L9vG8LXvO65Wzt/ZalB4Ngu FWFDtk6F9kw6IIhHJAjWouia5Ox4K4rub1Qb/0LOoXzuWbzdfMKYHg4DSIDhQlIbaygoCT4B96N CnoGcq7Z6lsmIczkSf9YN8qv1XeOpwPMjGvowD7zbd1qp8qJlIs8r0Lvpa0bXtgFW/f8f X-Received: by 2002:a17:907:a602:b0:8f1:939b:9701 with SMTP id vt2-20020a170907a60200b008f1939b9701mr17353400ejc.66.1678238060200; Tue, 07 Mar 2023 17:14:20 -0800 (PST) X-Google-Smtp-Source: AK7set/u/Uz1q+glNH11POot4im1LjgXUh7t2SMDSLiGnbdntTqKeIeR0Wzqrnl9dJW3sgPtKOqDVw== X-Received: by 2002:a17:907:a602:b0:8f1:939b:9701 with SMTP id vt2-20020a170907a60200b008f1939b9701mr17353380ejc.66.1678238059839; Tue, 07 Mar 2023 17:14:19 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id j6-20020a17090686c600b008c44438734csm6790766ejy.113.2023.03.07.17.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:19 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Marcel Apfelbaum Subject: [PULL 69/73] hw/pci: Add pcie_count_ds_port() and pcie_find_port_first() helpers Message-ID: <84344ee2da1f8a23819c15361298d997d9e69dbf.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron These two helpers enable host bridges to operate differently depending on the number of downstream ports, in particular if there is only a single port. Useful for CXL where HDM address decoders are allowed to be implicit in the host bridge if there is only a single root port. Signed-off-by: Jonathan Cameron Message-Id: <20230227153128.8164-2-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/pci/pcie_port.h | 2 ++ hw/pci/pcie_port.c | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h index 6c40e3733f..90e6cf45b8 100644 --- a/include/hw/pci/pcie_port.h +++ b/include/hw/pci/pcie_port.h @@ -41,6 +41,8 @@ struct PCIEPort { void pcie_port_init_reg(PCIDevice *d); PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn); +PCIDevice *pcie_find_port_first(PCIBus *bus); +int pcie_count_ds_ports(PCIBus *bus); #define TYPE_PCIE_SLOT "pcie-slot" OBJECT_DECLARE_SIMPLE_TYPE(PCIESlot, PCIE_SLOT) diff --git a/hw/pci/pcie_port.c b/hw/pci/pcie_port.c index 000633fec1..20ff2b39e8 100644 --- a/hw/pci/pcie_port.c +++ b/hw/pci/pcie_port.c @@ -161,6 +161,44 @@ PCIDevice *pcie_find_port_by_pn(PCIBus *bus, uint8_t pn) return NULL; } +/* Find first port in devfn number order */ +PCIDevice *pcie_find_port_first(PCIBus *bus) +{ + int devfn; + + for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) { + PCIDevice *d = bus->devices[devfn]; + + if (!d || !pci_is_express(d) || !d->exp.exp_cap) { + continue; + } + + if (object_dynamic_cast(OBJECT(d), TYPE_PCIE_PORT)) { + return d; + } + } + + return NULL; +} + +int pcie_count_ds_ports(PCIBus *bus) +{ + int dsp_count = 0; + int devfn; + + for (devfn = 0; devfn < ARRAY_SIZE(bus->devices); devfn++) { + PCIDevice *d = bus->devices[devfn]; + + if (!d || !pci_is_express(d) || !d->exp.exp_cap) { + continue; + } + if (object_dynamic_cast(OBJECT(d), TYPE_PCIE_PORT)) { + dsp_count++; + } + } + return dsp_count; +} + static bool pcie_slot_is_hotpluggbale_bus(HotplugHandler *plug_handler, BusState *bus) { From patchwork Wed Mar 8 01:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=cEkzax7f; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDy03cGz1yWs for ; Wed, 8 Mar 2023 12:17:54 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiO1-0005Uy-7r; Tue, 07 Mar 2023 20:14:33 -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 1pZiNy-0005Bk-Uz for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:30 -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 1pZiNw-00024I-M5 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238068; 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=JiQyBH5vvYnrxd9UFWpoF/hKiImKzIRaFV619s3+oeQ=; b=cEkzax7fgTBJvS//i3qsD7gUt3TfX49DnrlDHMgb62IWu/4zi3r2/22/5DSgvoyZicg8yH qytIY4tVznvAvjgM7DpcQnnxsYb9C/2fZZx/fwohG7xU0eK8/lskG3WsPyoe4hYVl4w7+y 22MwczR8LTlm4ykL4NI8Oc3jUQmTU7w= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-OVZZJQfFMc-GwrgrXZ6ePw-1; Tue, 07 Mar 2023 20:14:24 -0500 X-MC-Unique: OVZZJQfFMc-GwrgrXZ6ePw-1 Received: by mail-ed1-f72.google.com with SMTP id p36-20020a056402502400b004bb926a3d54so21295873eda.2 for ; Tue, 07 Mar 2023 17:14:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238063; 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=JiQyBH5vvYnrxd9UFWpoF/hKiImKzIRaFV619s3+oeQ=; b=HXDZ41LL6mmbI4zdYSolskXeabtpGBBC1jqK0qdkL13DUz667x91lmV2IpSdZ4owgY nF+3WV5wvZF7eBUa1SPUAT2OMr2TMh1fOJIIPVm0c4xF6WfKDoy0+4XA1PeYKI9Qnioh xfYXwjZTI2BcZ5e7zb4FP7q9dnjKxW1HvCDSV0q3mlOKG1Mim2EStADD+0sSD/jjB8dR CW3lyY853EdNBVzvYldmqZfFYpfH2rizY8aFeg8RrtPFJQp+XE8Fvg/2DYMnrmJV5xyS C6ItkfdGsrOyng106epKsPcc4+ooHPWLJPXKme5HZaZY8q5S+slHNJoso8ji+futb8o1 /Lrw== X-Gm-Message-State: AO0yUKW6/0XdMHpyU2AfiD9KhnvUOM/ggl88ibDHn2CCjdzmevjzTryy UjPooy4XPeM5DHk5oCRZ2vI+EbBxXohAyufk5ToZSUYNEjxws3Jkrci1oWZWmpf0wUh8H8XjYmS /dpmz081UAtQxdLX2DCMvkiIyUj1ySW3pFkpT0L38CoacG8Mxfk/zNuIMYM7vTDri084S X-Received: by 2002:a17:907:8e88:b0:878:7cf3:a9e7 with SMTP id tx8-20020a1709078e8800b008787cf3a9e7mr18901732ejc.65.1678238062947; Tue, 07 Mar 2023 17:14:22 -0800 (PST) X-Google-Smtp-Source: AK7set9AfKUXmKVlp/7CSUI+0trg4mzPaH6IuLs9HZwZKLSUvmTnwv8iZOuJ0Fqj6trlU49kbhzFlw== X-Received: by 2002:a17:907:8e88:b0:878:7cf3:a9e7 with SMTP id tx8-20020a1709078e8800b008787cf3a9e7mr18901710ejc.65.1678238062596; Tue, 07 Mar 2023 17:14:22 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id k12-20020a50ce4c000000b004c0459c20f9sm7424936edj.66.2023.03.07.17.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:22 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:20 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Jonathan Cameron , Fan Ni , Ben Widawsky , Marcel Apfelbaum Subject: [PULL 70/73] hw/pxb-cxl: Support passthrough HDM Decoders unless overridden Message-ID: <154070eaf6597c47f64c3ea917bcba62427ae61f.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jonathan Cameron The CXL r3.0 specification allows for there to be no HDM decoders on CXL Host Bridges if they have only a single root port. Instead, all accesses directed to the host bridge (as specified in CXL Fixed Memory Windows) are assumed to be routed to the single root port. Linux currently assumes this implementation choice. So to simplify testing, make QEMU emulation also default to no HDM decoders under these particular circumstances, but provide a hdm_for_passthrough boolean option to have HDM decoders as previously. Technically this is breaking backwards compatibility, but given the only known software stack used with the QEMU emulation is the Linux kernel and this configuration did not work before this change, there are unlikely to be any complaints that it now works. The option is retained to allow testing of software that does allow for these HDM decoders to exist, once someone writes it. Reported-by: Fan Ni Reviewed-by: Fan Ni Tested-by: Fan Ni Signed-off-by: Jonathan Cameron --- v2: Pick up and fix typo in tag from Fan Ni Message-Id: <20230227153128.8164-3-Jonathan.Cameron@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/cxl/cxl.h | 1 + include/hw/cxl/cxl_component.h | 1 + include/hw/pci/pci_bridge.h | 1 + hw/cxl/cxl-host.c | 31 ++++++++++++-------- hw/pci-bridge/pci_expander_bridge.c | 44 +++++++++++++++++++++++++---- 5 files changed, 61 insertions(+), 17 deletions(-) diff --git a/include/hw/cxl/cxl.h b/include/hw/cxl/cxl.h index b161be59b7..b2cffbb364 100644 --- a/include/hw/cxl/cxl.h +++ b/include/hw/cxl/cxl.h @@ -49,6 +49,7 @@ struct CXLHost { PCIHostState parent_obj; CXLComponentState cxl_cstate; + bool passthrough; }; #define TYPE_PXB_CXL_HOST "pxb-cxl-host" diff --git a/include/hw/cxl/cxl_component.h b/include/hw/cxl/cxl_component.h index ec4203b83f..42c7e581a7 100644 --- a/include/hw/cxl/cxl_component.h +++ b/include/hw/cxl/cxl_component.h @@ -247,6 +247,7 @@ static inline hwaddr cxl_decode_ig(int ig) } CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb); +bool cxl_get_hb_passthrough(PCIHostState *hb); void cxl_doe_cdat_init(CXLComponentState *cxl_cstate, Error **errp); void cxl_doe_cdat_release(CXLComponentState *cxl_cstate); diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h index 63a7521567..81a058bb2c 100644 --- a/include/hw/pci/pci_bridge.h +++ b/include/hw/pci/pci_bridge.h @@ -92,6 +92,7 @@ struct PXBDev { uint8_t bus_nr; uint16_t numa_node; bool bypass_iommu; + bool hdm_for_passthrough; struct cxl_dev { CXLHost *cxl_host_bridge; /* Pointer to a CXLHost */ } cxl; diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c index 3c1ec8732a..6e923ceeaf 100644 --- a/hw/cxl/cxl-host.c +++ b/hw/cxl/cxl-host.c @@ -146,21 +146,28 @@ static PCIDevice *cxl_cfmws_find_device(CXLFixedWindow *fw, hwaddr addr) return NULL; } - hb_cstate = cxl_get_hb_cstate(hb); - if (!hb_cstate) { - return NULL; - } + if (cxl_get_hb_passthrough(hb)) { + rp = pcie_find_port_first(hb->bus); + if (!rp) { + return NULL; + } + } else { + hb_cstate = cxl_get_hb_cstate(hb); + if (!hb_cstate) { + return NULL; + } - cache_mem = hb_cstate->crb.cache_mem_registers; + cache_mem = hb_cstate->crb.cache_mem_registers; - target_found = cxl_hdm_find_target(cache_mem, addr, &target); - if (!target_found) { - return NULL; - } + target_found = cxl_hdm_find_target(cache_mem, addr, &target); + if (!target_found) { + return NULL; + } - rp = pcie_find_port_by_pn(hb->bus, target); - if (!rp) { - return NULL; + rp = pcie_find_port_by_pn(hb->bus, target); + if (!rp) { + return NULL; + } } d = pci_bridge_get_sec_bus(PCI_BRIDGE(rp))->devices[0]; diff --git a/hw/pci-bridge/pci_expander_bridge.c b/hw/pci-bridge/pci_expander_bridge.c index e752a21292..ead33f0c05 100644 --- a/hw/pci-bridge/pci_expander_bridge.c +++ b/hw/pci-bridge/pci_expander_bridge.c @@ -15,6 +15,7 @@ #include "hw/pci/pci.h" #include "hw/pci/pci_bus.h" #include "hw/pci/pci_host.h" +#include "hw/pci/pcie_port.h" #include "hw/qdev-properties.h" #include "hw/pci/pci_bridge.h" #include "hw/pci-bridge/pci_expander_bridge.h" @@ -79,6 +80,13 @@ CXLComponentState *cxl_get_hb_cstate(PCIHostState *hb) return &host->cxl_cstate; } +bool cxl_get_hb_passthrough(PCIHostState *hb) +{ + CXLHost *host = PXB_CXL_HOST(hb); + + return host->passthrough; +} + static int pxb_bus_num(PCIBus *bus) { PXBDev *pxb = convert_to_pxb(bus->parent_dev); @@ -289,15 +297,32 @@ static int pxb_map_irq_fn(PCIDevice *pci_dev, int pin) return pin - PCI_SLOT(pxb->devfn); } -static void pxb_dev_reset(DeviceState *dev) +static void pxb_cxl_dev_reset(DeviceState *dev) { CXLHost *cxl = PXB_CXL_DEV(dev)->cxl.cxl_host_bridge; CXLComponentState *cxl_cstate = &cxl->cxl_cstate; + PCIHostState *hb = PCI_HOST_BRIDGE(cxl); uint32_t *reg_state = cxl_cstate->crb.cache_mem_registers; uint32_t *write_msk = cxl_cstate->crb.cache_mem_regs_write_mask; + int dsp_count = 0; cxl_component_register_init_common(reg_state, write_msk, CXL2_ROOT_PORT); - ARRAY_FIELD_DP32(reg_state, CXL_HDM_DECODER_CAPABILITY, TARGET_COUNT, 8); + /* + * The CXL specification allows for host bridges with no HDM decoders + * if they only have a single root port. + */ + if (!PXB_DEV(dev)->hdm_for_passthrough) { + dsp_count = pcie_count_ds_ports(hb->bus); + } + /* Initial reset will have 0 dsp so wait until > 0 */ + if (dsp_count == 1) { + cxl->passthrough = true; + /* Set Capability ID in header to NONE */ + ARRAY_FIELD_DP32(reg_state, CXL_HDM_CAPABILITY_HEADER, ID, 0); + } else { + ARRAY_FIELD_DP32(reg_state, CXL_HDM_DECODER_CAPABILITY, TARGET_COUNT, + 8); + } } static gint pxb_compare(gconstpointer a, gconstpointer b) @@ -481,9 +506,18 @@ static void pxb_cxl_dev_realize(PCIDevice *dev, Error **errp) } pxb_dev_realize_common(dev, CXL, errp); - pxb_dev_reset(DEVICE(dev)); + pxb_cxl_dev_reset(DEVICE(dev)); } +static Property pxb_cxl_dev_properties[] = { + /* Note: 0 is not a legal PXB bus number. */ + DEFINE_PROP_UINT8("bus_nr", PXBDev, bus_nr, 0), + DEFINE_PROP_UINT16("numa_node", PXBDev, numa_node, NUMA_NODE_UNASSIGNED), + DEFINE_PROP_BOOL("bypass_iommu", PXBDev, bypass_iommu, false), + DEFINE_PROP_BOOL("hdm_for_passthrough", PXBDev, hdm_for_passthrough, false), + DEFINE_PROP_END_OF_LIST(), +}; + static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -497,12 +531,12 @@ static void pxb_cxl_dev_class_init(ObjectClass *klass, void *data) */ dc->desc = "CXL Host Bridge"; - device_class_set_props(dc, pxb_dev_properties); + device_class_set_props(dc, pxb_cxl_dev_properties); set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); /* Host bridges aren't hotpluggable. FIXME: spec reference */ dc->hotpluggable = false; - dc->reset = pxb_dev_reset; + dc->reset = pxb_cxl_dev_reset; } static const TypeInfo pxb_cxl_dev_info = { From patchwork Wed Mar 8 01:14:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=QPFEBpBG; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZDs2Mbhz1yWs for ; Wed, 8 Mar 2023 12:17:49 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiO0-0005NH-6f; Tue, 07 Mar 2023 20:14:32 -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 1pZiNy-00057t-Ja for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:30 -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 1pZiNw-00024P-Vf for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238068; 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=GpL4q25IuknOPB1RIp1qp8KrJ0+1tHccB9yllob9AFg=; b=QPFEBpBGMOK9gCUWiUVKQ1iTO3dHD3i7Vr0O/wuYSR7upmZt1e1TtWxlZ4S/1OcMTygwOU KDrc51Xfq1qrrztPNC+r8p8n8VYnX0IEQVJyu11zEl3xN5kuldlG17OJ91OY9v5MYkBCXt QqojK4fYuJlws964FNxhlvjj4Rp+vVI= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-142--aShlAc5N8-VGUdP4EPaqg-1; Tue, 07 Mar 2023 20:14:27 -0500 X-MC-Unique: -aShlAc5N8-VGUdP4EPaqg-1 Received: by mail-ed1-f71.google.com with SMTP id h11-20020a0564020e8b00b004e59d4722a3so11267637eda.6 for ; Tue, 07 Mar 2023 17:14:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238065; 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=GpL4q25IuknOPB1RIp1qp8KrJ0+1tHccB9yllob9AFg=; b=D3VAUMgjRTctskpx893T5VkPO9USyfID+QAHDG3b1g+ppGDNvHhGlg3LiCXY+StVYe 68UOI6pwtux/lFVpMHONlYm80DOMInVSToaCuNU9pnhQ1Ji5c6nBg0F5+Wc4FyHuaNj2 3QHQmCCtsxI82PLlIyl1q+b64pP3eLN2t3u6v2xEImN1Ffbf04M78zXRcLLV26+6B4Fo FYuem6Ce/2HiFg6wXDEPm385eCwVfLO5MfW5Hn0bKI467G9E5YimfMxvHJN2JTnYXri0 Djwx+wHmwoKzRwGvLkXZxCxVVeT4Um4goqhYK5kgyvLB1SFsGrQhlG9JQJup2BZZB3km I6Gw== X-Gm-Message-State: AO0yUKXEI0Z0zeNHNI2PIdf+AzbfbTSeSJj3+NMDhY7Niz4aTBVcTnmf 89B5zfxiRns0xevdpjY5tyt0xYaRrivTLvXpfIX4k2acv0lXAKXeBiPVolYdQzyB9VD+6e41zKp 9M00gvXTAWo5rSAQrhrpV20mLeFYh0aAj3p6ajGgblh4IbLfW7xWivhJduWbiU5HQ7FTP X-Received: by 2002:a17:906:6b83:b0:8e5:c06b:90e2 with SMTP id l3-20020a1709066b8300b008e5c06b90e2mr15080528ejr.21.1678238065561; Tue, 07 Mar 2023 17:14:25 -0800 (PST) X-Google-Smtp-Source: AK7set83UHgXr/qOT0NbK8WfgRSltmFmPnBn0L1jquS33EwsITuouldiAvN2sfulsHRoK0Ox/C1VKw== X-Received: by 2002:a17:906:6b83:b0:8e5:c06b:90e2 with SMTP id l3-20020a1709066b8300b008e5c06b90e2mr15080515ejr.21.1678238065293; Tue, 07 Mar 2023 17:14:25 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id 27-20020a170906005b00b008b175c46867sm6748607ejg.116.2023.03.07.17.14.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:24 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:22 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Albert Esteve Subject: [PULL 71/73] hw/virtio/vhost-user: avoid using unitialized errp Message-ID: <90e31232cf8fa7f257263dd431ea954a1ae54bff.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Albert Esteve During protocol negotiation, when we the QEMU stub does not support a backend with F_CONFIG, it throws a warning and supresses the VHOST_USER_PROTOCOL_F_CONFIG bit. However, the warning uses warn_reportf_err macro and passes an unitialized errp pointer. However, the macro tries to edit the 'msg' member of the unitialized Error and segfaults. Instead, just use warn_report, which prints a warning message directly to the output. Fixes: 5653493 ("hw/virtio/vhost-user: don't suppress F_CONFIG when supported") Signed-off-by: Albert Esteve Message-Id: <20230302121719.9390-1-aesteve@redhat.com> Reviewed-by: Peter Maydell Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 8968541514..e5285df4ba 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -2031,8 +2031,8 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque, } else { if (virtio_has_feature(protocol_features, VHOST_USER_PROTOCOL_F_CONFIG)) { - warn_reportf_err(*errp, "vhost-user backend supports " - "VHOST_USER_PROTOCOL_F_CONFIG but QEMU does not."); + warn_report("vhost-user backend supports " + "VHOST_USER_PROTOCOL_F_CONFIG but QEMU does not."); protocol_features &= ~(1ULL << VHOST_USER_PROTOCOL_F_CONFIG); } } From patchwork Wed Mar 8 01:14:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753823 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Q4IUKVO4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZHp49LKz1yWp for ; Wed, 8 Mar 2023 12:20:22 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiO9-0005c8-KT; Tue, 07 Mar 2023 20:14: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 1pZiO1-0005YO-Ge for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:33 -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 1pZiNz-00025R-K6 for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238071; 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=SFOs7K/mMfl02ujCfNEGSvBgQGYosRoiMqAddvEZMgQ=; b=Q4IUKVO4vU7kCmFbQhVpUWip1bMqoZSzklTP6G/osjkLok12phGi4TyoY6efrQY7FOzR1F 2qMVLZ8UjUBjQTIEO02szb6t89h15CjiY9GZl1jmpummTSKLMgi/poGGOobe8V8xcVQXvO 6KTxuIAv0NZkO1K/gKrfOUXPoGJnaNM= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-SCydqCeuPSeVUl9hNVEoAA-1; Tue, 07 Mar 2023 20:14:30 -0500 X-MC-Unique: SCydqCeuPSeVUl9hNVEoAA-1 Received: by mail-ed1-f72.google.com with SMTP id z14-20020a05640235ce00b004e07ddbc2f8so12721673edc.7 for ; Tue, 07 Mar 2023 17:14:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238068; 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=SFOs7K/mMfl02ujCfNEGSvBgQGYosRoiMqAddvEZMgQ=; b=7BWY+8ruWRN4e+pr9aT6FwAPLwtjVYn8Rr/oEyO9YpTyTzZfsIylOa35w9bLqo9Xa6 OBS9Zh6VRPpK+CPsbR95gR2P0XcHAOAZL6j5tGckfdxqx+lyHb7hLcPrw5rYiJllU88E 2ukEiVUr5CmxFcP9XapiuX3jIyDEy5M+4NjTalhrOs0E7rZezJdMaKZapgtPBPk8eWUk xqMfjVVTo1RYHMBTJxtu4YHl9wBnP9rGUnyyMGRdp3waVPec+nQd/Ubey7rRZ/V+//6+ VlrQtW5c6j2bSsBS9iRUjcQCb1hbiaXeb4lv27ApkQJY7avUL4QGm0hSDy2IBXyrR4qQ 8gWw== X-Gm-Message-State: AO0yUKXSOdZMFoTL1wKn75pMy0+cxj2brp4R50miy7fRJ81VHetqbJ88 gSFoIUvjdEPIZD+83aCuspIKDnMSOm563nW9SLvhEwTeu3IG7eJQEpnPFtw7oTjc8k9uOW/mOH2 wt9yCtTR0fjyq9Is7rHCT2ejYyouBPjL0SlgZG2qQLn0Yu0lX7QhTXo6MSwrYP4Sjh/lE X-Received: by 2002:a17:907:16a4:b0:8af:3fcc:2b05 with SMTP id hc36-20020a17090716a400b008af3fcc2b05mr21136735ejc.12.1678238068333; Tue, 07 Mar 2023 17:14:28 -0800 (PST) X-Google-Smtp-Source: AK7set9FbARJHgyg/sD6/KkR2AOIZPKg5zzZrGV9Cz1YkU0p8F4NL0Z7DEd/2t2iDIqHNuIf9ozCEg== X-Received: by 2002:a17:907:16a4:b0:8af:3fcc:2b05 with SMTP id hc36-20020a17090716a400b008af3fcc2b05mr21136725ejc.12.1678238068122; Tue, 07 Mar 2023 17:14:28 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id gu21-20020a170906f29500b008e8e9859905sm6729328ejb.184.2023.03.07.17.14.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:27 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:25 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Carlos =?utf-8?b?TMOzcGV6?= Subject: [PULL 72/73] virtio: fix reachable assertion due to stale value of cached region size 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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Carlos López In virtqueue_{split,packed}_get_avail_bytes() descriptors are read in a loop via MemoryRegionCache regions and calls to vring_{split,packed}_desc_read() - these take a region cache and the index of the descriptor to be read. For direct descriptors we use a cache provided by the caller, whose size matches that of the virtqueue vring. We limit the number of descriptors we can read by the size of that vring: max = vq->vring.num; ... MemoryRegionCache *desc_cache = &caches->desc; For indirect descriptors, we initialize a new cache and limit the number of descriptors by the size of the intermediate descriptor: len = address_space_cache_init(&indirect_desc_cache, vdev->dma_as, desc.addr, desc.len, false); desc_cache = &indirect_desc_cache; ... max = desc.len / sizeof(VRingDesc); However, the first initialization of `max` is done outside the loop where we process guest descriptors, while the second one is done inside. This means that a sequence of an indirect descriptor followed by a direct one will leave a stale value in `max`. If the second descriptor's `next` field is smaller than the stale value, but greater than the size of the virtqueue ring (and thus the cached region), a failed assertion will be triggered in address_space_read_cached() down the call chain. Fix this by initializing `max` inside the loop in both functions. Fixes: 9796d0ac8fb0 ("virtio: use address_space_map/unmap to access descriptors") Signed-off-by: Carlos López Message-Id: <20230302100358.3613-1-clopez@suse.de> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index f35178f5fc..98c4819fcc 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -1069,7 +1069,7 @@ static void virtqueue_split_get_avail_bytes(VirtQueue *vq, VRingMemoryRegionCaches *caches) { VirtIODevice *vdev = vq->vdev; - unsigned int max, idx; + unsigned int idx; unsigned int total_bufs, in_total, out_total; MemoryRegionCache indirect_desc_cache = MEMORY_REGION_CACHE_INVALID; int64_t len = 0; @@ -1078,13 +1078,12 @@ static void virtqueue_split_get_avail_bytes(VirtQueue *vq, idx = vq->last_avail_idx; total_bufs = in_total = out_total = 0; - max = vq->vring.num; - while ((rc = virtqueue_num_heads(vq, idx)) > 0) { MemoryRegionCache *desc_cache = &caches->desc; unsigned int num_bufs; VRingDesc desc; unsigned int i; + unsigned int max = vq->vring.num; num_bufs = total_bufs; @@ -1206,7 +1205,7 @@ static void virtqueue_packed_get_avail_bytes(VirtQueue *vq, VRingMemoryRegionCaches *caches) { VirtIODevice *vdev = vq->vdev; - unsigned int max, idx; + unsigned int idx; unsigned int total_bufs, in_total, out_total; MemoryRegionCache *desc_cache; MemoryRegionCache indirect_desc_cache = MEMORY_REGION_CACHE_INVALID; @@ -1218,14 +1217,14 @@ static void virtqueue_packed_get_avail_bytes(VirtQueue *vq, wrap_counter = vq->last_avail_wrap_counter; total_bufs = in_total = out_total = 0; - max = vq->vring.num; - for (;;) { unsigned int num_bufs = total_bufs; unsigned int i = idx; int rc; + unsigned int max = vq->vring.num; desc_cache = &caches->desc; + vring_packed_desc_read(vdev, &desc, desc_cache, idx, true); if (!is_desc_avail(desc.flags, wrap_counter)) { break; From patchwork Wed Mar 8 01:14:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1753837 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fhIDvfSB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PWZL44bW0z1yWs for ; Wed, 8 Mar 2023 12:22:19 +1100 (AEDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZiOO-00065r-D6; Tue, 07 Mar 2023 20:14: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 1pZiOE-0005sU-QX for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14: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 1pZiOD-00026S-6c for qemu-devel@nongnu.org; Tue, 07 Mar 2023 20:14:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678238074; 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=xKR+Q7wzkUusg5xffymHbVluJFNxgc89LXOjBTMJesM=; b=fhIDvfSBLRa9CQQIGDi3RjfaplbV46CEf/CzgQdiVD26mBBusqeHNpMwCfvHW1Sx7CAWtQ UeIlJuySZfEm4T7VEeV0WtbH3baU99ia481xvAMebf6joGGDK6SYvm2a8N7jDyknBEzOvL DyBr+L/8NwP4EWN9TdAuwWdBC7W1090= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-RIByHt66NHOnhUlNsNrLxQ-1; Tue, 07 Mar 2023 20:14:33 -0500 X-MC-Unique: RIByHt66NHOnhUlNsNrLxQ-1 Received: by mail-ed1-f69.google.com with SMTP id v11-20020a056402348b00b004ce34232666so18105978edc.3 for ; Tue, 07 Mar 2023 17:14:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678238072; 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=xKR+Q7wzkUusg5xffymHbVluJFNxgc89LXOjBTMJesM=; b=V7IN85GaH5VOItUin942Qqh8CYai2wVVaRGjKfpH8X/RYPgAy+51jhx0r12ER0sFjS ISD0xske8k4wU6COjc8KCm8G8S7jiGdzkC39v3P1apLM1xX+NVpBfZzur9lJcC6a3D+C YBGiAqFK/5iBeSRMDkiBum+v4kGRXIrRye6nGprH4nkfMdZkkiE8EPKb8w2mb9rJxIsN DFLLwU1JGVcS8vrdBGAysaypm07ETaRs7zBM280wTfJgZf3w4JlYkmVlW+450mk/OEjC Z38zAEiPiWHa5dwq0cEBHotNTvvSLn+I5hk2ze+Pza3uoz2m8dDIbHdzr+zBvr9Tj8Fb RO7w== X-Gm-Message-State: AO0yUKVUPl2njitc0fin+t5HjQAGY8LQYbJnm61VXDck1vbomQJWj84H pRcVd9oy6RBRkuhYp0tp2zqyXhevA2FZjs6cYUd45t+gAhVq36B4RLCWhEXcV5vCNWal/6lqeKk COu/xVxcu+DjFna/g/dQHkcSK0WiWiDuUsdfgEjNHQeZCB3r7Hp/LhGku4C8h20n4D0Sj X-Received: by 2002:a17:907:728c:b0:8b1:788f:2198 with SMTP id dt12-20020a170907728c00b008b1788f2198mr20524302ejc.19.1678238072039; Tue, 07 Mar 2023 17:14:32 -0800 (PST) X-Google-Smtp-Source: AK7set9uDB2t5mH3joOlL6wV6YlIZFajQIystAnVjDXCzHRKY3uZIdEYP6YDn2VFhaq4hYRua0UFsg== X-Received: by 2002:a17:907:728c:b0:8b1:788f:2198 with SMTP id dt12-20020a170907728c00b008b1788f2198mr20524271ejc.19.1678238071670; Tue, 07 Mar 2023 17:14:31 -0800 (PST) Received: from redhat.com ([2.52.138.216]) by smtp.gmail.com with ESMTPSA id n24-20020a1709062bd800b008b17aa6afc8sm6774590ejg.30.2023.03.07.17.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 17:14:31 -0800 (PST) Date: Tue, 7 Mar 2023 20:14:28 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , Carlos =?utf-8?b?TMOzcGV6?= , Thomas Huth , Cornelia Huck , Halil Pasic , Eric Farman , Christian Borntraeger , Richard Henderson , David Hildenbrand , Ilya Leoshkevich , qemu-s390x@nongnu.org Subject: [PULL 73/73] virtio: refresh vring region cache after updating a virtqueue size Message-ID: <52062b213c13bd7fff966d36b554c04609c925d6.1678237635.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Carlos López When a virtqueue size is changed by the guest via virtio_queue_set_num(), its region cache is not automatically updated. If the size was increased, this could lead to accessing the cache out of bounds. For example, in vring_get_used_event(): static inline uint16_t vring_get_used_event(VirtQueue *vq) { return vring_avail_ring(vq, vq->vring.num); } static inline uint16_t vring_avail_ring(VirtQueue *vq, int i) { VRingMemoryRegionCaches *caches = vring_get_region_caches(vq); hwaddr pa = offsetof(VRingAvail, ring[i]); if (!caches) { return 0; } return virtio_lduw_phys_cached(vq->vdev, &caches->avail, pa); } vq->vring.num will be greater than caches->avail.len, which will trigger a failed assertion down the call path of virtio_lduw_phys_cached(). Fix this by calling virtio_queue_update_rings() after virtio_queue_set_num() if we are not already calling virtio_queue_set_rings(). Signed-off-by: Carlos López Message-Id: <20230302101447.4499-1-clopez@suse.de> Acked-by: Thomas Huth Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/s390x/virtio-ccw.c | 1 + hw/virtio/virtio-mmio.c | 5 ++--- hw/virtio/virtio-pci.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index e33e5207ab..89891ac58a 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -237,6 +237,7 @@ static int virtio_ccw_set_vqs(SubchDev *sch, VqInfoBlock *info, return -EINVAL; } virtio_queue_set_num(vdev, index, num); + virtio_queue_update_rings(vdev, index); } else if (virtio_queue_get_num(vdev, index) > num) { /* Fail if we don't have a big enough queue. */ return -EINVAL; diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c index 23ba625eb6..c74822308f 100644 --- a/hw/virtio/virtio-mmio.c +++ b/hw/virtio/virtio-mmio.c @@ -350,10 +350,9 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value, case VIRTIO_MMIO_QUEUE_NUM: trace_virtio_mmio_queue_write(value, VIRTQUEUE_MAX_SIZE); virtio_queue_set_num(vdev, vdev->queue_sel, value); + virtio_queue_update_rings(vdev, vdev->queue_sel); - if (proxy->legacy) { - virtio_queue_update_rings(vdev, vdev->queue_sel); - } else { + if (!proxy->legacy) { proxy->vqs[vdev->queue_sel].num = value; } break; diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 247325c193..a0a2f2c965 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1554,6 +1554,7 @@ static void virtio_pci_common_write(void *opaque, hwaddr addr, proxy->vqs[vdev->queue_sel].num = val; virtio_queue_set_num(vdev, vdev->queue_sel, proxy->vqs[vdev->queue_sel].num); + virtio_queue_update_rings(vdev, vdev->queue_sel); break; case VIRTIO_PCI_COMMON_Q_MSIX: vector = virtio_queue_vector(vdev, vdev->queue_sel);