From patchwork Wed Oct 20 10:19:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12571983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1050CC433F5 for ; Wed, 20 Oct 2021 10:21:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A8F661374 for ; Wed, 20 Oct 2021 10:21:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9A8F661374 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8j5-0005GC-Ho for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:21:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gs-0002km-NU for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gr-0002bB-5m for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725160; 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=CWf29uc3qYZQ1YtyfEGbkZhDDSeIdnNB9/3KYMX/bN4=; b=FNEW8LUUkrc0w5ghErhQKJtmOFQYI+LRZydOXiGlHqTHXM4izVn9mclllrMkj/zR4fDB8P 6Vflsva9EZKbbFZXBqDuLvwVrHD6ejBXKh7mdkw7p5vvaJ0L6x2pyvFxivVCRy3lWTc2+H fpr8pIIlDXeVWtx0kdYt51Q31P1Ud9w= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-577-Cvk58VbNM52KFICd68ZEsA-1; Wed, 20 Oct 2021 06:19:18 -0400 X-MC-Unique: Cvk58VbNM52KFICd68ZEsA-1 Received: by mail-ed1-f72.google.com with SMTP id g28-20020a50d0dc000000b003dae69dfe3aso20514415edf.7 for ; Wed, 20 Oct 2021 03:19:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=CWf29uc3qYZQ1YtyfEGbkZhDDSeIdnNB9/3KYMX/bN4=; b=TPUoWXXjZEDdge9rqwGP7fp9OMlB+JtcQQiy6ouutD/H4cKgR3GbuY2zpG/PsVk8Ea h6ZqGXO1/n+nXzSh5ajKtouIipqCW/rjEBMSi5za6GV/8dxyhBdS5/YVXG8SMNUKhGCS NHClVTr41Kfba2CHdXOUkq296EZ/pXH/POl6vl3zTMzIXbjFqqHrYdEOy/DZrVPeTtgj PgrA759MkgVASNopEvJhkETFFO2gfi9FMHruNVHG5YKkAlGj3OqGXASPrpbCefnLle67 57n1te5qOSTjfvZdrhowsCVjVWa1tyknol1F+GrNKVB09nFqST7RM/8oBMNlxf0a/K/3 rDPg== X-Gm-Message-State: AOAM532vOXpqfQ33EmOqpQVSXvgV3ssfQSrriaSPYdZwcdORFqDmp+IJ LUldzw8SLGbf4XaqBB6NabMcm9QbGE4WUnfHfX+v0Y6rR71/0i1DIaE4JrO+VgOXqg4JaJQDekM OarkawvtFBZMA6Pq7H2WY2A/RZsnCcmNg6ao8nq1hwOp8BVJfypdOUUOoT8fy X-Received: by 2002:a17:907:d89:: with SMTP id go9mr34199560ejc.451.1634725157366; Wed, 20 Oct 2021 03:19:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBFmjpfoyst+9j0hshERCjvixFLiP7WJ+ccd/60Nv0WQcZB1YjUbGj4RzjqxMFkYFVFuHi2Q== X-Received: by 2002:a17:907:d89:: with SMTP id go9mr34199532ejc.451.1634725157136; Wed, 20 Oct 2021 03:19:17 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id og39sm809279ejc.93.2021.10.20.03.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:16 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:14 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 01/44] tests: acpi: dump table with failed checksum Message-ID: <20211020101844.988480-2-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Igor Mammedov , Ani Sinha , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-2-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/acpi-utils.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/qtest/acpi-utils.c b/tests/qtest/acpi-utils.c index d2a202efca..766c48e3a6 100644 --- a/tests/qtest/acpi-utils.c +++ b/tests/qtest/acpi-utils.c @@ -98,6 +98,20 @@ void acpi_fetch_table(QTestState *qts, uint8_t **aml, uint32_t *aml_len, ACPI_ASSERT_CMP(**aml, sig); } if (verify_checksum) { + if (acpi_calc_checksum(*aml, *aml_len)) { + gint fd, ret; + char *fname = NULL; + GError *error = NULL; + + fprintf(stderr, "Invalid '%.4s'(%d)\n", *aml, *aml_len); + fd = g_file_open_tmp("malformed-XXXXXX.dat", &fname, &error); + g_assert_no_error(error); + fprintf(stderr, "Dumping invalid table into '%s'\n", fname); + ret = qemu_write_full(fd, *aml, *aml_len); + g_assert(ret == *aml_len); + close(fd); + g_free(fname); + } g_assert(!acpi_calc_checksum(*aml, *aml_len)); } } From patchwork Wed Oct 20 10:19:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12571995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACA2AC433F5 for ; Wed, 20 Oct 2021 10:26:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 483C161260 for ; Wed, 20 Oct 2021 10:26:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 483C161260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8ni-0002ey-CF for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:26:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gv-0002ll-Ms for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38934) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gt-0002dj-TE for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725163; 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=nFIbNXb69EoGDBsD2BE8d4rSsxtOhWqVTfNUrOCk/LM=; b=HzBmxs804K7aJp0SU+61gJVUeIBhWhTO8REgBhO/KJJumKXAzq9JN/+gfeCUXj5rzQ0p6T imXsEUNgcbtD+blbN7ZxOTqdlHnSL9M3w/IcD2+cLuPilNT9Sp3YPdzbL6gF4I7YPjaEYF miuX10qT8Nf5Yq4dkqDYViH4h5gUaUw= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-216-AD4-npwLPV6sRoXhzslOfg-1; Wed, 20 Oct 2021 06:19:21 -0400 X-MC-Unique: AD4-npwLPV6sRoXhzslOfg-1 Received: by mail-ed1-f70.google.com with SMTP id u17-20020a50d511000000b003daa3828c13so20511687edi.12 for ; Wed, 20 Oct 2021 03:19:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nFIbNXb69EoGDBsD2BE8d4rSsxtOhWqVTfNUrOCk/LM=; b=NITMmVjTJwJFD6yLlR795i0gsKAgYsSFm9WTuHN7BMt+e28HrM0GIYyMaypvOkV063 1Rxzv8nzSFbrAFkGxFPMytoOuh9Ny2lyJ4As9K6Wrb7KeRmSsLKw9iRt5iR2fo6eV67Y IPVAl1KgvBAgCwpmXEq3W9iip3OgEsscbHIv/+Tu7AY8NNFfPHjwTanmYXHgOZNDeB4+ nr4koXXGfZIrqLClNn6oTaDlX6PhgPb77KeOJbb2ygNklVhIvFV7XSFOjvwHhswSYoy4 cbEngj2O8EvMCOiwfd9UxIIxa/CHqk2Dk/swbf4qtCs3HXz4rIxFv3bVp6mEbu4r8YfU 0ZzA== X-Gm-Message-State: AOAM5315x/YFCbJzcYvJlc/Cru63S8Qp+hwAIBQESY2pm6d54BTJh16O AqfbvpUDk4kDBQJVN9WeqQisGBd4jHRWv+kzlKlEz/iWjrEppnQ3FvS0NEL2NrIFWdVH5WsNbPs EhLW4JDOV6CAvItY2lmAWrjYIhobrCMG/cny5YHVCOAF2p44ieCPjh44a+hBQ X-Received: by 2002:a17:907:9889:: with SMTP id ja9mr47561753ejc.361.1634725160324; Wed, 20 Oct 2021 03:19:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/yw8BHYZw07mbvXut9V9k6+CUGqAsAZZ3EMuf3wX6xhauYrr8CQWONO/MgzJ39hmm4ig3GQ== X-Received: by 2002:a17:907:9889:: with SMTP id ja9mr47561727ejc.361.1634725160129; Wed, 20 Oct 2021 03:19:20 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id ck13sm953151edb.0.2021.10.20.03.19.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:19 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 02/44] tests: qtest: add qtest_has_accel() to check if tested binary supports accelerator Message-ID: <20211020101844.988480-3-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Currently it is not possible to create tests that have KVM as a hard requirement on a host that doesn't support KVM for tested target binary (modulo going through the trouble of compiling out the offending test case). Following scenario makes test fail when it's run on non x86 host: qemu-system-x86_64 -enable-kvm -M q35,kernel-irqchip=on -smp 1,maxcpus=288 This patch introduces qtest_has_accel() to let users check if accel is available in advance and avoid executing non run-able test-cases. It implements detection of TCG and KVM only, the rest could be added later on, when we actually start testing them in qtest. Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-3-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/libqos/libqtest.h | 8 ++++++++ tests/qtest/libqtest.c | 27 +++++++++++++++++++++++++++ meson.build | 6 ++++++ 3 files changed, 41 insertions(+) diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqos/libqtest.h index a68dcd79d4..59e9271195 100644 --- a/tests/qtest/libqos/libqtest.h +++ b/tests/qtest/libqos/libqtest.h @@ -588,6 +588,14 @@ bool qtest_big_endian(QTestState *s); */ const char *qtest_get_arch(void); +/** + * qtest_has_accel: + * @accel_name: Accelerator name to check for. + * + * Returns: true if the accelerator is built in. + */ +bool qtest_has_accel(const char *accel_name); + /** * qtest_add_func: * @str: Test case path. diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 73f6b977a6..25aeea385b 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -922,6 +922,33 @@ const char *qtest_get_arch(void) return end + 1; } +bool qtest_has_accel(const char *accel_name) +{ + if (g_str_equal(accel_name, "tcg")) { +#if defined(CONFIG_TCG) + return true; +#else + return false; +#endif + } else if (g_str_equal(accel_name, "kvm")) { + int i; + const char *arch = qtest_get_arch(); + const char *targets[] = { CONFIG_KVM_TARGETS }; + + for (i = 0; i < ARRAY_SIZE(targets); i++) { + if (!strncmp(targets[i], arch, strlen(arch))) { + if (!access("/dev/kvm", R_OK | W_OK)) { + return true; + } + } + } + } else { + /* not implemented */ + g_assert_not_reached(); + } + return false; +} + bool qtest_get_irq(QTestState *s, int num) { /* dummy operation in order to make sure irq is up to date */ diff --git a/meson.build b/meson.build index 9ed9a993e2..2c5b53cbe2 100644 --- a/meson.build +++ b/meson.build @@ -75,6 +75,12 @@ else kvm_targets = [] endif +kvm_targets_c = '' +if not get_option('kvm').disabled() and targetos == 'linux' + kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"' +endif +config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c) + accelerator_targets = { 'CONFIG_KVM': kvm_targets } if cpu in ['aarch64'] From patchwork Wed Oct 20 10:19:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572001 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E9F0C433EF for ; Wed, 20 Oct 2021 10:30:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37B5B61004 for ; Wed, 20 Oct 2021 10:30:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 37B5B61004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8rK-000074-4L for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:30:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47846) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gy-0002oy-2n for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gw-0002gF-F5 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725165; 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=8l2qJYP9VLojED18WIThA5ayhCuizkU4T6ELRj0TeQo=; b=Cx57WIi96azwCyDX3QMgt5mwSIJI8+m4bidOIwYC0XnUWKyev/YF1m0O412tL3eq3UfhWZ yqARnHkTj57NmiOUmivTIcZQhspDE8Zp2bymswzoqfZZ5PzxK7XbZzBHuekxjCoUIsZEqM kd+MOlqI8LXT7tUkVzCwbkMFGtG2v8o= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-441-8nQ4p4O_NqSevjKMaO8AiA-1; Wed, 20 Oct 2021 06:19:24 -0400 X-MC-Unique: 8nQ4p4O_NqSevjKMaO8AiA-1 Received: by mail-ed1-f72.google.com with SMTP id l10-20020a056402230a00b003db6977b694so20503403eda.23 for ; Wed, 20 Oct 2021 03:19:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8l2qJYP9VLojED18WIThA5ayhCuizkU4T6ELRj0TeQo=; b=pZx9aZ6BvxK6FbDSh2QJlX7p6IqbY8czgZeIPQdu9WhQ4IP5w30qZj1ZVAOwbASH0p A3nWx1SmoLZDJPQ6MthUTt0uWdbpL160xIVpkopqv/xNGEJ41m6+qnvup1JU7TOalWml BXp/qx1uDwtBiPDcZwWbQkH1LHoZZG6X1dHK5UzIKlvh+EpC4fXxzNSsGCfk3YSR3CN3 gcg4HWhjznWzEgLUxlJt+YrF3MBwK0ZeUbysIXf7q8BwUjFGclL3sSftbuEtIDxT1a+0 7ybeLaZtBBXrZHcZuD31hMkjgMEJ20U2tklRnZTZic4IqK6+LpNX69elCk5Ncq5DBjTQ suWg== X-Gm-Message-State: AOAM530J2o9JDIJyVXPALUDNoTUbv+EWXxNKajrh3U9+70pwF5aV3gem KrgSJmkL7Mudu90X9wGAuwbRFA5TzKCJ6MD2q8/XHj7dnBsl+1qr5dhdd/Z2AwOaWtEKWc/xAiw axA1jBYH2A51EX4enrDp9CXzA+FjdpeOOyYHY2Qo0ZcZ00HZ49O87K7xEWVoQ X-Received: by 2002:a17:907:168a:: with SMTP id hc10mr45161732ejc.214.1634725163337; Wed, 20 Oct 2021 03:19:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzFM7l3ZuuoRqK+bTOoDlh0ihfoY8G+5rvj4yyxM+lWJzqVN9PL9tRGMCxrZneosH2ebk/xvQ== X-Received: by 2002:a17:907:168a:: with SMTP id hc10mr45161705ejc.214.1634725163114; Wed, 20 Oct 2021 03:19:23 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id p10sm826321ejf.45.2021.10.20.03.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:22 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 03/44] tests: acpi: whitelist expected tables for acpi/q35/xapic testcase Message-ID: <20211020101844.988480-4-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-4-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ++++ tests/data/acpi/q35/APIC.xapic | 0 tests/data/acpi/q35/DSDT.xapic | 0 tests/data/acpi/q35/FACP.xapic | 0 tests/data/acpi/q35/SRAT.xapic | 0 5 files changed, 4 insertions(+) create mode 100644 tests/data/acpi/q35/APIC.xapic create mode 100644 tests/data/acpi/q35/DSDT.xapic create mode 100644 tests/data/acpi/q35/FACP.xapic create mode 100644 tests/data/acpi/q35/SRAT.xapic diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..344eee3acc 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1 +1,5 @@ /* List of comma-separated changed AML files to ignore */ +"tests/data/acpi/q35/DSDT.xapic", +"tests/data/acpi/q35/SRAT.xapic", +"tests/data/acpi/q35/FACP.xapic", +"tests/data/acpi/q35/APIC.xapic", diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/q35/APIC.xapic new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/FACP.xapic b/tests/data/acpi/q35/FACP.xapic new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/SRAT.xapic b/tests/data/acpi/q35/SRAT.xapic new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 20 10:19:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12571993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86EB6C433EF for ; Wed, 20 Oct 2021 10:26:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 39D9661004 for ; Wed, 20 Oct 2021 10:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 39D9661004 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8nc-0002Uz-8X for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:26:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h1-0002vw-Qc for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52877) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8gz-0002iK-03 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725168; 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=l+JdS6odhHQCqe4i6vULlhCYcRkCV8MNyhPFF2gnM/c=; b=YT82Krb2mKpm670DXLL/4pihvtvx4Kyzfox28F65TFXUfVtybJeCxGx/nLYOZ9OaBUXmA0 ZWs11xDo9s15o2mf7/OgP5Dj/66WQ2bgoyKATJg+3fnBfnCDYerqmshHLaUOHjEOqs54c7 ZiMOt31u5NDxWaAgasrhAIvMTOdTT9c= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-bpqPYhtLPtieV1knZ_yGJw-1; Wed, 20 Oct 2021 06:19:27 -0400 X-MC-Unique: bpqPYhtLPtieV1knZ_yGJw-1 Received: by mail-ed1-f70.google.com with SMTP id u23-20020a50a417000000b003db23c7e5e2so20547558edb.8 for ; Wed, 20 Oct 2021 03:19:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=l+JdS6odhHQCqe4i6vULlhCYcRkCV8MNyhPFF2gnM/c=; b=p/ZUiJbcBaQyBRocOng3MZMslv/lwlkYtxR7C40JU5M6G8DZAciCMnw9vS0tz1bfIK 0pdVCuGXi0YkffFgFA09y3sCrNFVyUt+enGWyNGCeYFGjQ7mggYB01Xh3iu3917pnAw0 nJccPUK3OzaUUd3I8RZdcGHHfULwfE64e2Gxx5QOUNPLszXJl6wJ545kqvlqugLrN9c+ XNQjMFSzyKWrGJpJjgV64NQ4B5B2kGku+nBUo3KbH4aPha6lbtGR6sC01KJsW8H+uHZi PNy1xtNsCeYrQDG4G+1Js334WFbeulQWvjJqTyycy1Pn3Md2Gxbp62XSWDI/X62Yw3Wm zeAQ== X-Gm-Message-State: AOAM532wy9EMpzhbDTLjLl32T8XVYzsjv+TbkWIfd5M186+9g0SSoW57 3GsAnCdBpFuWOSl+glHWvijV5S1g1fzeJlJXCw2EoBEHzrm86dYzLWu86H8TF6NdYYYPTrUd25S CwCoftIkS77JDs5IG81OMfQokfLlIN3JwfHm4Qn8vvh9tVDDWtNBDaaZA3+aA X-Received: by 2002:a50:9b4b:: with SMTP id a11mr62232493edj.316.1634725165849; Wed, 20 Oct 2021 03:19:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzj5sYQPKAOtqBMegzg2kL4GqOKEawWQONY3Bk3TKKRUuV2q6n5GH9bNmsTAjCzwntMprF7TQ== X-Received: by 2002:a50:9b4b:: with SMTP id a11mr62232456edj.316.1634725165617; Wed, 20 Oct 2021 03:19:25 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id v6sm1026913edc.52.2021.10.20.03.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:25 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 04/44] tests: acpi: q35: test for x2APIC entries in SRAT Message-ID: <20211020101844.988480-5-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Set -smp 1,maxcpus=288 to test for ACPI code that deal with CPUs with large APIC ID (>255). PS: Test requires KVM and in-kernel irqchip support, so skip test if KVM is not available. Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-5-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 4f11d03055..87a94a59fa 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1033,6 +1033,19 @@ static void test_acpi_q35_tcg_numamem(void) free_test_data(&data); } +static void test_acpi_q35_kvm_xapic(void) +{ + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_Q35; + data.variant = ".xapic"; + test_acpi_one(" -object memory-backend-ram,id=ram0,size=128M" + " -numa node -numa node,memdev=ram0" + " -machine kernel-irqchip=on -smp 1,maxcpus=288", &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_nosmm(void) { test_data data; @@ -1509,6 +1522,7 @@ static void test_acpi_oem_fields_virt(void) int main(int argc, char *argv[]) { const char *arch = qtest_get_arch(); + const bool has_kvm = qtest_has_accel("kvm"); int ret; g_test_init(&argc, &argv, NULL); @@ -1567,6 +1581,9 @@ int main(int argc, char *argv[]) if (strcmp(arch, "x86_64") == 0) { qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg); } + if (has_kvm) { + qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); + } } else if (strcmp(arch, "aarch64") == 0) { qtest_add_func("acpi/virt", test_acpi_virt_tcg); qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem); From patchwork Wed Oct 20 10:19:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12571985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D21C433F5 for ; Wed, 20 Oct 2021 10:22:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2270D60FC2 for ; Wed, 20 Oct 2021 10:22:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2270D60FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:45202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8jo-0006Fv-3M for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:22:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h7-0003A4-DX for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52745) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h3-0002lv-Sx for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725173; 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=Q8HkFq1zNtlwzux0hXle1dIWLbUMV3WzdovaxjwiAxU=; b=Nk0HsUhLqmESqSEFVpkcvLZBhxMpcA9Arwk/aWSl/GzkflsO1QRYn15m7OaXHImsFGfoTA xbtTEUz5lhjobBSrQ8opXuI9+r7k31Us9Dxxebdg1bUTXq3enLTt7uU5TPl2dYst0ce6jZ M5h2uadAvT6cOGqdp00M9x0py11Cb6A= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-kfgS5AyENAmJpD1D286SWw-1; Wed, 20 Oct 2021 06:19:31 -0400 X-MC-Unique: kfgS5AyENAmJpD1D286SWw-1 Received: by mail-ed1-f70.google.com with SMTP id x5-20020a50f185000000b003db0f796903so20522787edl.18 for ; Wed, 20 Oct 2021 03:19:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Q8HkFq1zNtlwzux0hXle1dIWLbUMV3WzdovaxjwiAxU=; b=tgj+yNwgMcwzTM+GFVcE/HoA4b93HP5Y/5z4fM2j2xqaPjun2BM1EslQYgiNB2Z6mx tzxQZ2l0wJCTHxlCZJ8GC1RpUIB62eP0mC3uXUXcByrbRqIEc6VzQ/mAiM9/bO4uCfP9 DRpPl7kwQ8ho237hUjsthUPi7BzvdGGd0qdaMvms3Gi5ugptktbMjKAD6rdmIOsFby71 gPrYWgCP2rjBfur1gXCILXF86uRx8gvZ5/moPyG/ScuTrrZ87iYo7lSc7PjIBeWbwmBd 1pnX9xFy5FizxOuPvL4T2o+nVUfU0CNUzPhLObn1+wgCBfyswZ8maVzBos1QdOipT3UV A7jQ== X-Gm-Message-State: AOAM532mqQbdCy6OjDoja53X1UD2cnJ45E01Mg4VF4lZjqI7uRzbTO/+ HApec136TXdEM0NFxQnLIdUiDeYy1SbRfqlzrY+OAkiF80PDj4d2M65oXWQgcnpldEYlVbWOW/3 aEft5Kmi29ZEvMBZgw6kKwJUjdYMHMcbA2+/svOejFbYUgWi437JMngoiNPZ4 X-Received: by 2002:aa7:d459:: with SMTP id q25mr61457675edr.236.1634725169442; Wed, 20 Oct 2021 03:19:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwctyo2G3qOLFxlKhu+NWVoy5z9R1xlt29zuiL/TLhTZxN0ha857yghMY45Z9zg1KPEY3bKNQ== X-Received: by 2002:aa7:d459:: with SMTP id q25mr61457586edr.236.1634725168774; Wed, 20 Oct 2021 03:19:28 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id o10sm939360edj.79.2021.10.20.03.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:28 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:25 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 05/44] tests: acpi: update expected tables blobs Message-ID: <20211020101844.988480-6-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Update adds CPU entries to MADT/SRAT/FACP and DSDT to cover 288 CPUs. Notable changes are that CPUs with APIC ID 255 and higher use 'Processor Local x2APIC Affinity' structure in SRAT and "Device" element in DSDT. FACP: - Use APIC Cluster Model (V4) : 0 + Use APIC Cluster Model (V4) : 1 SRAT: ... +[1010h 4112 1] Subtable Type : 00 [Processor Local APIC/SAPIC Affinity] +[1011h 4113 1] Length : 10 + +[1012h 4114 1] Proximity Domain Low(8) : 00 +[1013h 4115 1] Apic ID : FE +[1014h 4116 4] Flags (decoded below) : 00000001 + Enabled : 1 +[1018h 4120 1] Local Sapic EID : 00 +[1019h 4121 3] Proximity Domain High(24) : 000000 +[101Ch 4124 4] Clock Domain : 00000000 + +[1020h 4128 1] Subtable Type : 02 [Processor Local x2APIC Affinity] +[1021h 4129 1] Length : 18 + +[1022h 4130 2] Reserved1 : 0000 +[1024h 4132 4] Proximity Domain : 00000001 +[1028h 4136 4] Apic ID : 000000FF +[102Ch 4140 4] Flags (decoded below) : 00000001 + Enabled : 1 +[1030h 4144 4] Clock Domain : 00000000 +[1034h 4148 4] Reserved2 : 00000000 ... +[1320h 4896 1] Subtable Type : 02 [Processor Local x2APIC Affinity] +[1321h 4897 1] Length : 18 + +[1322h 4898 2] Reserved1 : 0000 +[1324h 4900 4] Proximity Domain : 00000001 +[1328h 4904 4] Apic ID : 0000011F +[132Ch 4908 4] Flags (decoded below) : 00000001 + Enabled : 1 +[1330h 4912 4] Clock Domain : 00000000 +[1334h 4916 4] Reserved2 : 00000000 DSDT: ... + Processor (C0FE, 0xFE, 0x00000000, 0x00) + { ... + } + + Device (C0FF) + { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0xFF) // _UID: Unique ID ... + } + Device (C11F) + { + Name (_HID, "ACPI0007" /* Processor Device */) // _HID: Hardware ID + Name (_UID, 0x011F) // _UID: Unique ID ... + } APIC: +[034h 0052 1] Subtable Type : 00 [Processor Local APIC] +[035h 0053 1] Length : 08 +[036h 0054 1] Processor ID : 01 +[037h 0055 1] Local Apic ID : 01 +[038h 0056 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 ... +[81Ch 2076 1] Subtable Type : 00 [Processor Local APIC] +[81Dh 2077 1] Length : 08 +[81Eh 2078 1] Processor ID : FE +[81Fh 2079 1] Local Apic ID : FE +[820h 2080 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 + +[824h 2084 1] Subtable Type : 09 [Processor Local x2APIC] +[825h 2085 1] Length : 10 +[826h 2086 2] Reserved : 0000 +[828h 2088 4] Processor x2Apic ID : 000000FF +[82Ch 2092 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 +[830h 2096 4] Processor UID : 000000FF ... +[A24h 2596 1] Subtable Type : 09 [Processor Local x2APIC] +[A25h 2597 1] Length : 10 +[A26h 2598 2] Reserved : 0000 +[A28h 2600 4] Processor x2Apic ID : 0000011F +[A2Ch 2604 4] Flags (decoded below) : 00000000 + Processor Enabled : 0 +[A30h 2608 4] Processor UID : 0000011F + +[A34h 2612 1] Subtable Type : 01 [I/O APIC] +[A35h 2613 1] Length : 0C +[A36h 2614 1] I/O Apic ID : 00 +[A37h 2615 1] Reserved : 00 +[A38h 2616 4] Address : FEC00000 +[A3Ch 2620 4] Interrupt : 00000000 + +[A40h 2624 1] Subtable Type : 02 [Interrupt Source Override] +[A41h 2625 1] Length : 0A +[A42h 2626 1] Bus : 00 +[A43h 2627 1] Source : 00 +[A44h 2628 4] Interrupt : 00000002 +[A48h 2632 2] Flags (decoded below) : 0000 Polarity : 0 Trigger Mode : 0 -[04Ah 0074 1] Subtable Type : 02 [Interrupt Source Override] -[04Bh 0075 1] Length : 0A -[04Ch 0076 1] Bus : 00 -[04Dh 0077 1] Source : 05 -[04Eh 0078 4] Interrupt : 00000005 -[052h 0082 2] Flags (decoded below) : 000D +[A4Ah 2634 1] Subtable Type : 02 [Interrupt Source Override] +[A4Bh 2635 1] Length : 0A +[A4Ch 2636 1] Bus : 00 +[A4Dh 2637 1] Source : 05 +[A4Eh 2638 4] Interrupt : 00000005 +[A52h 2642 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[054h 0084 1] Subtable Type : 02 [Interrupt Source Override] -[055h 0085 1] Length : 0A -[056h 0086 1] Bus : 00 -[057h 0087 1] Source : 09 -[058h 0088 4] Interrupt : 00000009 -[05Ch 0092 2] Flags (decoded below) : 000D +[A54h 2644 1] Subtable Type : 02 [Interrupt Source Override] +[A55h 2645 1] Length : 0A +[A56h 2646 1] Bus : 00 +[A57h 2647 1] Source : 09 +[A58h 2648 4] Interrupt : 00000009 +[A5Ch 2652 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[05Eh 0094 1] Subtable Type : 02 [Interrupt Source Override] -[05Fh 0095 1] Length : 0A -[060h 0096 1] Bus : 00 -[061h 0097 1] Source : 0A -[062h 0098 4] Interrupt : 0000000A -[066h 0102 2] Flags (decoded below) : 000D +[A5Eh 2654 1] Subtable Type : 02 [Interrupt Source Override] +[A5Fh 2655 1] Length : 0A +[A60h 2656 1] Bus : 00 +[A61h 2657 1] Source : 0A +[A62h 2658 4] Interrupt : 0000000A +[A66h 2662 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[068h 0104 1] Subtable Type : 02 [Interrupt Source Override] -[069h 0105 1] Length : 0A -[06Ah 0106 1] Bus : 00 -[06Bh 0107 1] Source : 0B -[06Ch 0108 4] Interrupt : 0000000B -[070h 0112 2] Flags (decoded below) : 000D +[A68h 2664 1] Subtable Type : 02 [Interrupt Source Override] +[A69h 2665 1] Length : 0A +[A6Ah 2666 1] Bus : 00 +[A6Bh 2667 1] Source : 0B +[A6Ch 2668 4] Interrupt : 0000000B +[A70h 2672 2] Flags (decoded below) : 000D Polarity : 1 Trigger Mode : 3 -[072h 0114 1] Subtable Type : 04 [Local APIC NMI] -[073h 0115 1] Length : 06 -[074h 0116 1] Processor ID : FF -[075h 0117 2] Flags (decoded below) : 0000 +[A72h 2674 1] Subtable Type : 0A [Local x2APIC NMI] +[A73h 2675 1] Length : 0C +[A74h 2676 2] Flags (decoded below) : 0000 Polarity : 0 Trigger Mode : 0 -[077h 0119 1] Interrupt Input LINT : 01 +[A76h 2678 4] Processor UID : FFFFFFFF +[A7Ah 2682 1] Interrupt Input LINT : 01 +[A7Bh 2683 3] Reserved : 000000 Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-6-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 4 ---- tests/data/acpi/q35/APIC.xapic | Bin 0 -> 2686 bytes tests/data/acpi/q35/DSDT.xapic | Bin 0 -> 35652 bytes tests/data/acpi/q35/FACP.xapic | Bin 0 -> 244 bytes tests/data/acpi/q35/SRAT.xapic | Bin 0 -> 5080 bytes 5 files changed, 4 deletions(-) diff --git a/tests/data/acpi/q35/APIC.xapic b/tests/data/acpi/q35/APIC.xapic index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..c1969c35aa12b61d25e0134bbb8d2187ba42d663 100644 GIT binary patch literal 2686 zcmXZeQ+OOv7=Yo~aI?wAcAeU0vPDuQZHm;k?bNny+g57ZPHkIh=b!JKoA-S43@*-G z{Lu+-N@3~J zSf&g{M`KJ3+H6?1ES4*W<;!D*3K$!UadB9&B37z|l`CVFDp<8D#>Znq0#>Vr)vIG- zBG#yZHEUw6T3EX_CM98=I#{tllk*svisYJ`m&W0NM>v?(@ghRvH}ix$|j zCAMmXty^Q8HrTc;wrhv&+hd0g*s&va>V%y;W0x-2wJUb(hTXekj~>{wC-&-vy?bMy zKG?S}_UniJ`{RHCn4F9Q2jZYXICwA)8G=KH;;>;jd^nC6fg?xas8Kk2G>#dAW5?pS zaX5ZFPMClbC*q_@IC(NonSxWN;#ZrFeuH{zyExOp>f z*@9cQ;hfjf8Nu3fl$H}2Vkd-vkLeYk%=9yovp4`NCR9y)}F595&|c=RY9 zJBG)P- zElRtp7Ny-(i_%urqO`keQQAYbDDA0Ql=f0BN_(porF~S3(!Q!iX+PDXw7+UmIzY83 z9jIEA4pJ>j2dfsPLsW~>p{hmcFx8@TxN1>4LbYgele0}R{tY{ee%8iO>pNrYvugUz Y81RgpG2$6JW5}~=7X9ge`jQv^2Net*5C8xG literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/DSDT.xapic b/tests/data/acpi/q35/DSDT.xapic index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..119fc90f1f8a7b6934df6fd95609446e627ce15d 100644 GIT binary patch literal 35652 zcmb8&cYIT27YFd0F48n@(*b2u!M*4n?yL@=rL-Vu(YAofa6|zW5rv|FII-d$1?%2> zEAFkhaqqo1&c5f|dlG;5Jn{2+<&WO;q|fs`=SkC^=H}8w+9H!9CtH^1hS0=tLtAlZ zT1&W?{&_6R;+T(t#=LGF%p_m?>TpN=h>Z|3s!b| zx?A_L+PiBat--KeV|Gh(OG&t-lk+S_xD-7Ics{lth2iO*84xF_gQ_uT&K1?U(Sk5u4Uuj zR+?o|HCyk@)$sk@-aWLjE!bh-#gu*&mD1AKIw{51>GKE1=Z;N{Pvlwc-4)|Q5t{6L zjZ&$4sw$pluy0_!r_<`RJf3>bENd1WN2gG>_Ud~oQ@93qrTo#_#lvtBav+3SUvSxGY=2Xi&I$*Eas&#TW zQB9V7{cJjB#Vn6^wB@0@s5$SS`)FxPxNWj0YlGkCr7sN+!gSwFDW(sR;`XI&(Q))$ z@Pyw-U$`tDghM6KarB8$b5pA)YooJ_2jNijl&0dA#>lkdc28(Rc)V4(RZBQJE~R}8 zkNW##vw22rk!Oy@M*B8=bDveXLy*=ao5fa)KXl66&caAWOQfwSr+0#UYiz83^5eG3 zW17|!ebF@J;c!!ot%DEg>>blH*XkY8Gsl-g-vLYP$B~~Nw*6LLUaDsqf3VgS^$zTr z>l+ZuPfxM3t*%(-sxHgw>+-fVhU=_Ce+L~svDrKdoVJgLA1s0J7xp)DOY7v8{PFXb z=4YkRqtlwuJU(hUv4`S1E8owz`%-97A0MRBpux(|PNO>LJIR?RBVI)lbDYoF>u73x z$ScXW=cd>zX|9ZTWqfLiWv`^E_DUM^N~*@5n`*C&SCDG)%J|e&XC+OwSJIGI#~#C_6FAh@S9UHi;*?~{hOPoHa_KG!~d?tRh__nGC| zXO?T9S?+z(5cf$x3*qbOckR>f-X{%lpV_W`X1n&8?cOI1ai2M^edf6Knd9Ck4RN2j zu6^dZ_L=M6Ck=6*0oOhQu6+jF`=lZ6GtafpJl8(+-20>M&yZI} zWbRPc%Au~6L)|NBh%1M=Rt|Hm9Ohn0LtHuBwQ{&?<#6{(8sf?ku9YKPD@V9j(hygU zv{%Nv%t(7>{Ac_~XJz~cHw}4Z{3|%hm2;FU=O}kh8ag?>)IfvKKP$^EP#RK2_FQV9&RiME9_^{zK%J@aA?}kJsKeSTse!^&ZlE-bcSUZX zG>q?)8mKeZUP%oUrg8&yrrJ5VfzmL(PimmfTze%oP?*XM)R}6pH&AD)y^*nQE`(21>*DKB<8^bM2MXKw&C3P-m*W zk{c)udduQQUisl+(4bF_DXJ`G>q?)8mKeZUP%oUrg8&yrrImHfzmL(Pimmf zTze%oP?*XM)R}6pH&AD)y^TmDE6CDmPGPs=bmMC=KKLqz3BDwO3LDg{j;?ovHRpZlE-b?~@v+GuK{84HTww z19hg_E4hKvFuqS}pw3)-B{fi($_><+YOmx5O2ha*sew9k?UmF(VJbIJXR5uD8z>Fq z`=kcy%(Yii1BI#FK%J@fN^YPujPH{gs594INevXHaszdy+AFz%(lEYHYM?ZN21+Ar zpftn=N<(O%u#y@mtmFm?E4hKfN@}36k{T$i=fx=2^ zpsU(9se#gnzGC*B$qkf-^ks+-d1d^*r3Ol)_ec3K!Q~6mcpVi>=9iEofNkQtk zlS2F<%pW3Ni_X1FigH}XAL{u-gSW7taT1*k=*?X0TRNLgvSjx8vI;92Cxu%xX+mpB zUXCy8qzo(5J`=RaTFtll(&=MkZ1HSguEh}*(MqRYCJdn85rXkk9)3Dq!zY8hRCZh5 zAYZ{rIaX#WbvKKCep~dDn9g1l=Gy0h`nUwDCRmu)5ov6*mT>G_YTuH}=c6o|5pK1| zMICLeZJyP$r3OyVw@dbr%1$Rw{_pG|$R4t@hp0Zx9x6=_8Ups?(?ahxAcMAGOm* zRr=_^q>oDaI-NfKKcugN^mTUnI+eceU((k}`g)x{<3FUYhxGM!`g)bV{$JA9OZo<# ze!zc7-vH?w?DP#PeZ#+`Z=m#P{G&{#4>;-LKRoEy3i@_;&fmIkE6lLJ<>|oR*TU&< zV_%+|qu(_Q&bciqXMA7gyE*y=#NeFUl5)oP8Jz;=@3Z*E=(iGsb8bt@8Q(XBZjOFc zF*xV8q@3}6Fwo7>?=J@D+?JFx9@m519Q{&baL#Q>Ipc9!I&iMzrzothMzX;RdoBq!!|CZKhTl`__qwh{?PTAp>Da8$kEr=bw z@Sx%&4w!$~!XsuLFyCtTgj*(zmxpV%&sXo+*p zjqTm1zn?MP-Vs&gRGA$Nw=|ZNl$LNE&Pzw>h0!;{lk4_L>Gk!@wpN5oN=oK%=;5$* zPH$GvY+nk;Wlo&Rak&$xaa`fV=^R%&aR$d#PCS6)YA5z`T;s%<9M?LrkK>>dXK@^I zVn4@WC(h0-|N1ZsA<2ok}P+UsobIo}iOa1vAOZ^2LOZ|l$OZ@{mmih;AEcF+0 zEcFlOSn40bvD815W2t`_$5Q`rj-~z)983KpIhOiIaV+&0Q(PwXZ^5zDKbm8ye+59w)V~eKQvbFbOa0q%EcI{CvDCi<$5Q`}983K>aV+)k%(2uzmSd^E zgyM3kzm#LCzl>w4zno*Kzk*|_zmj9Azlvk2znWvIzlLL}zm{XEe;1CW{#`ki`gh}4 z>ffDXseccSrT#rRmiqUixI*d=axC?SIF|au983KXj-~!6$5MYC$5MYi$5MX-$5MYI z$5Q_|j-~$b983KZIF|aGIF|aGIhOh-axC??P+TeXPvThWZ{=9(Z{t|%pUkn;KZRqd ze{YVZ{;3>G{nI#>`uE{j>fe`RslT0Lsed}hQvZG&Oa1$EEcJJAEcJI%TqX5)aV+)E z;8^OP$+6Twi({$(0FI^p138xZ58_zrpUttOYiY zssAvJrT!Sj)l&cA983L2a4hxD=UD1rz_HZ7kYlO;NRFlcqd1oOkLFnFU&OK0e+Dl^&iKv)PFq3QvXtlYoz{V983M(983MnIhOiQ;8^NEkz=WU1;OY-hss9X$Yo-1*983LYaxC@t za4hwo#j(`CmSd^^Y>uV=b2ygz&*fO^KaXRn|9p<6{tGyk`Y+^I>c5C%ssCb*rT$Ae zmil`s4ody&IF|a?b1d~=%CXen$FbCZ8OKupS8y!#U&*o5e-+14|J58z{nv0T z^c5L)ssC<{rT%+3miq7ISn9uzW2ygsj-~zwIF|Z1P#l)}ALLl-e~4qL|6z`$ z{zo{L`XA+3>VJ%5ssC|~rT!;4minLMSn7X@W2ygXj-~!*IF|aKVJu2ssCk;rT$kqmik}iSn7X`W2t`=$5Q|6983Lga4hw|$+6V` z7ROTm+Z;>%?{F;jzss@I{~pCrssDYBrTz~%mij;BSnB_XW2ygRj-~!jIF|Z9i>@7I;sDAj-~z|IF|Z<fONV5mD2_B@|1KI@-GVB3ug9iib0quha zUVA_r;X$T7pq=o*XAfvAJjk*Kv=<)u?E!6u2if+3cEf`ldqCUaL9RWJ{RDWxPYC!k zdG}Qxgko^p| z2eO|L_CWSC(jLfuM%jb9IfV@wbWK$-vwh6;v1#!O&iL6UKda=6qV&!53@~PO_73gQ zpWx?}F<&lS3}t*~!uY<7Yb zGi!Zae$OmV%$gPRbjGZ%_09e>dOAI8XJ!@Cjh(TXI;p*7eIq?r?k!rYZ>49;GcW7S z?CJ9LQ=-da$v)q^rE%Z!)A88MRa|A4wXlooT36j$X-u=9u+wwunZDGRao5l%Y2Ct^ ze8Fcl&AH-}!5P*}ejYxP610~l-<)AlJqu?fzoVNn!xP&k`~T&RPX2f?e7f^ubCTRQ zF<*+lm8Z_tH`3jlw7T}?d(gA?5;`wK|LCj*J+i%h{P?Ex5>3I$d09TMMXv($>jQ;3 zbTRAXEZ&SYd(K=svoo#9YF|D+jet`71q2sBC+8D@$72Io9dhoZ!~>WIux7@}=p}v5 zm;FyQe6BsArKH%JKcV?j=!9mxHeZVN%IQiu?a|5egqKR!4%(ZKSLaJbFI9UL^zy&< z=xlhxOH0#U8hUBktK^qW)PCvocEU?f*Iqh$>DsHJO9iw?XT%a-Muzq>(96(XHC;fU zJvsrM@CFRf-T?FlXs?DIP}-v_s1u&ot35AzUhUP|*9*HJFPY$F+AnX>gFEr{%|tI# zdqI8)OMN|j;Q4&IJ|B8M?S=T|Fy&=|N9~nA4fSQAm!-WhU9O-#KX`uo!fy2Z==rr5 zp^F%_mknNawyrN5y=?78>Cy)6<$#xyqrDvTaUVcnGUUGA_my2Gm@=8ni z^$PX%pjR{!ULc^o0D1xKmGX-d%A=Pw5?)@O_VUon(_R_BI-xvzO(Wsu=W8z?y?pJJ z^UD*;qZc(2UO|EO3eYRiUIo8Cp*(t3BjFVmYOfHzLhV)Z3lz$umo*aJz=7Huh~7Z$ zRq-nn%A?mc65gOe+8c!4AnjH2OBBkZ7d8@JQIYnF&@0kj4PCaOy}{rO9<05==nd9h zEnUo^y&>QY8KS)*=nc_ckgk!`-cay{4%OaJ^oD9LL>GQ&Zy0#PhG}mYdc(9ArprOJ zHypg-!?iaYz2Vx6&_yEJ8v)*k5!xGp-U#hQ>CzGHjRbGxNbQY8Z>09>=zuW9kdtT(e!o%Z^s?Aw>r z>FosGPCIFDC-ipGUUX;E+Znu_ch=s{=MvC1o#r@OA_mvn(a zqMw(PXs-ml677|in)T8D^GkT8_OoOBd0L8IsrJgsOs@>QvNBy?8G2>fD=#;_a`4K_ zwO5W_x%Mh5Os@jGiVE#jpjV;2%1YC#1h2AEdzI)_YOkuw^s2zCs?uH+dR5x1t~R}D z@T#k|SB+k^_G)TOuLiuD8tv7fSEIe!TGOiqueMfuwdmDqFSv{8?E>B|yJ&A0^mfr+ zXjjwQ6}(+{)!we??W(=-Zl<>zc)RVUz1`5;O?#2uO>cMbcHdolyQ8lm?FHUmdueYk^!CzTY0&iOlEK8!zhF>% zLG*&!D+`$(T{D>QLLu$(rM!vrezDx&u6|iH{pe~R}nEix@s`t zMIyRBzSuV5MYLBLH9fj)FyTd`+T*Kd6JAt%RduFE*9|7TI=Xa?p3cJgCcYdt;niuc zy598Y!oh@BU#~sBzBS?1YpPUL$&q+6#^| zy>Z};8>hW-=#A4}XuRo-2XFj%?Ttroy!OHqOm6~s6DDYH0(uj)7ils*`V$a|uSZjp z_L|UZ(q6RL^qRqIZq{Bidd=Fan`n9y!J9ZydlS){sJzOO7Sn41ucbwME$FpquXK{> zO#*MyB<)Q?Z<6-PT1~GNyw+CjwW8Omz4A8GqpMI8U*EPi?X{uTroD>ErbmAzB;ie- zti8$TP1auJ6w{jm-jpfYn}XgH?N#k2>FopFKKp2IAN2OoUT|O2+ZVij_toCM=|54wHKaldegz1K3#j$(VMQl$bP1`A9(xir@j5q+fRGZ{Y`Iw@b=$dd;6oezxL`n zOppF1Oyc{kqeFWg=yfQss-)BOI>GDg)Ltigo!TqyGQBSFy1KO2gm z(B2I6W@xW`rs>TDZ{|$x%|vge_9|wX-YoED&C=d1^k!+V@&MC20K5YZ(B1*)9iY9c z15NKh@D4msdk3O-p!TW{GQESqJLn+o9faON+N+sudb7csJzIOT(VMNk+Bv2-2fR6R zv^NL6Iob=(H9flAA@Th-cdqv4qBmE2p?Rh^54?Hvv^NjEdD;sfYB zfftKuFNR)Bd!>h)-r?XKez^7yNAGa$l^tPvM}T+45!yQfy(6?&KHv1_gExP^_U5BE zUwah`Om6{r3l?Z^0eTCxSGmyi7J|2Mq4pM{w@`akN1EP|;2n9S_KrmFNbOZ0WqL<} zchphZI|{v{v{!Sq=^YK;(MN0VX!MTOUhN{&TLj*sMcP}0-XiS#po^8UietkI~KfSkJa9>=pC!Q$P&|A0^X7(+FOF&675BgGri-$ zJMK8`9f#g=+N(R>^o|Gb_~W&AJbK3~ucl+aTGH+tRLD_?GU%fVZ|TzkvWTduu|6HM;}@J={EdncfGg7zv;G`$nS zJMl#AorvCv+N)Y&dMm(Nu|j(*&|9Is>XoLq61YcG6?>74@J zDW_=f6!cEfUgT8MI~BZBPu1S3=$)#)=xL^R8hEFjroGe9J576ar<>mC;GKTD_D)Cd zbmi5SoMC!rfOp0j+B*ZiGqhK_#`M;Jw`Ps@)}XgWdu3;u-kIQ?d8YQxMDI-PmG_ul z4|qL2+Ur5DM|%}#nci98opqM>&O+}j?NzQdy|v)2U8}vd=&jXW)!C+ZHh5>Bt-Z6+ zJ6n6z=a}9(;GJ`h_Rc}?9PQPdYkKE`cka2`I~TokwO4zd>757OdFN^GJoL`fUhsU= zJ0HCB&)44h=$)^<&;_P<0eBZ&puG#wyFh#43r+7r@GiVidl#a2q4pvdnchXNbdBj<1Ku^) zXzv>IuF+ojTGP80ylb!3-nHmmtG&o|rgt59*IlQ*>(IMSd(rDn?|SgAzg~OSqj$ab z>TWQ-8^F8a2JPK|-VMqNmE350H-dNLjoP~ry&JVxdXwqh1l~#f?m6}?-vS9zQ1-3H!mw`uP- z^lsB$)$OKtJ9xL>uD#pQyIp(LcbMKC;N5YD_U=IM4(-+4X?k~pcjukjyA!=TwO4zW z>D>k1U3Y2kF7)owUhrUd1D(_Xv28Jfgiv(0fFCm5-X)U^pf^oLhmK*RlIC^FN62; z%i4Pxy_dCD`HJbi0^TdHXzvyDUeR9FtETrVc(1;yy;sqDReRO1nci#Qz4n^+UPJFS z?bU2Dy-nb4+N8Zr=xx$o?dzuZI(V zz4@m0-bC+B?Sn-iQh2C4*i@a@mZ-e*t+uC~@y|=X&eaH0P0q>o6wD%5r z?`W^?UDJCPym#N#-n;0%tGsB*d#3juc<;TZz4y?2PkW{Bo8J52z5l-U-be3!?Uj9C zdLMxI!3Wy=0KE^iSN@^teF)x%A8PMI^gh&H#Yd+15qKYcq`i;O`$&70ADiCC;C=kD z_C7}MW9?OaVtSu|_sJ*P`vkpDv{(J9>3s^`r=M!?Q}jO7Ud?Bw_ZfJfeWtz7(ECh# zwV#{b=iq(*x%NIs?{n=1zc9To!29A0?R|mX7upMbX?kCR_vM$``x3n`wHN-%^u7Y` ztFN^86?$K3FY>kNeGT5%Uu*Ac^uE?!^c&Or2E1>+(cU-ceWSg)Z%yx8@V@<4d*7n> zt@7$hzB9e=!29ky?R|&dciJoc-t@i)@B8ny_dR;wYp?7F)B6FuAAZo@59s}%z49MT z??>={{84*9qW7crDt-e1~_{%v}HgZKB}+WQ;5zyI;N>oWLng4*wEAnzDZQf=99Zs6;8{r!S|$EP=! z&J0*qKNY|^_=x|{vmf*HL!NON{O3lK<)J@CN`I>_@n->P=*q-tI1_)Mg5rN+jaLN{ z|7DX#I#+4ZTpo8Wk2{w~a`6#!(JIL0F>;k9&6VQLmEz8oBDwg8xo8#SN-=VkC(V`W z&XwxUl`6UTh`DGL5_|&n2T0Hu5=?;RnlA;?pzt}Tp5y!kC=;AL9PrVS9Q`{1Kha=xN{AVTzte_vLFxpQT?b7e^`K4LCf1-Y_}T;Zg-{O(+ScP_u=;v?pwRglYX z=z?aq}gx%h~=XcgqjHgZLi=E`yB%5mq)kz9PlT(k;u&}%cx%h~=Xcgqj)wxQO_pg9ESHPVsAi4O6xo8#S3K+SP_pdy6t~__HJjumJ%tfmp zSDuk8dH>3H=gN2I%9mVx#9Xura^)MjlJ~Cycdi0=t^&!$N6ba5AXkBrD|!DabmuB` z=PHz3e8gO|3UU=1xsvy+==iyLyuA%N+LnRj>_aCffZ?p(tq7auVft%6*`jaPWIbmV)}d?~&ZdsNAv z;avoF{pZWj-o10()UZ6%CPka3&|l;)Vdj6{wlV2XSJ1- mbl7i^NW0m-t)#{o&{xc36_QgLvHI+wEFP5GK?XlWtp5RGJ|f`& literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/FACP.xapic b/tests/data/acpi/q35/FACP.xapic index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2d3659c9c6753d07c3d48742343cb8e8cc034de7 100644 GIT binary patch literal 244 zcmZ>BbPo8!z`($~)yd!4BUr&HBEVSz2pEB4AU24G0Y(N+hD|^Y6El!tgNU*~X%LSC z$X0-fGcm9T0LA|E|L2FOWMD7?GM2WmFfej3F#P0!h{7ddihwku0+2v57svwxMxcSn X_QAxFX+{NzJ3wNL4G8yu_%Hwf>QN2> literal 0 HcmV?d00001 diff --git a/tests/data/acpi/q35/SRAT.xapic b/tests/data/acpi/q35/SRAT.xapic index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..1a91cfa65fdbebe1756d63d80022c2af767e5d3f 100644 GIT binary patch literal 5080 zcmaLbd6bS-9KiAS9m_Bb!whB^ODQIzkhDk{WhpVupdq1%l!~-aq1~F4H7%5Avt?^h zSz6I1OVggM&?eD}ni*#ppIrBx=iKM>{oOzBdCz;Etjy*eauOqv=+gA|Em~*QNYBn_ zQ6qOnBauknd)}V+99jwgbCh`uE`p2VVz@Yt#U*e_9EVHc(l{QM!DVp*E{DtGM4W^x z;EK2sPR1#?GOmJCaaCLmSI7BxqtJagj`{JpCO!e5h-=~6I1QhK>)^WhWLyu|$EV;^ zaRb~CH^Qgk#`tvH1fPM=#Ao5NaZ`K_Zidgr=i%l!9q0ds6uK|xGrs`0#I0~^+y-BW zFT!o{#kd`Ak2CNkI1^{#4!9%kgfGR}xHIm8FT-8&<+vN}j(gxM@RhhH?uDTCW zHSUYA!Pnw`_&R(&z5(~g1MrP_AifFTjBmlW;z4*Yz75}w@4!RwP&^FZiSNR9<9qPE z_&$6;9*#%gk$4myjmO{z@L2pH9)};o599H80-lH`;mLRkegsd&kK)Jh zf&avR;lJ@ecpu)64-|Gx^1*-Z|K@H->v{2LJsRjSfnFrgiw1hJKrbHXv4LJ9&`Sn- zT%eZ<^wNPIALwNQy= X-Patchwork-Id: 12572005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BACFAC433F5 for ; Wed, 20 Oct 2021 10:31:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 822E8610FF for ; Wed, 20 Oct 2021 10:31:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 822E8610FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:35060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8sz-00024c-IB for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:31:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47918) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h8-0003CA-9y for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35864) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h5-0002nT-6k for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725174; 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=Ye8xamo/xFWVL8QWKzRp1k9WG6eLXO+rQQkUJvOw6N4=; b=A16N4qqo7hmw8E7zja2JymXRIzM9R8NYvWMwRcn/PoaERPQp13pO5nJ0xUARQBStBAOiN1 wFiGn8ACxbStWIkiEo/VjnojgKN/+hAKQQuPUaXf3C1z7gMwe9vFRIZKkIvbO2HMJdXl0N W7xOwvfLImLSrQVrSIsCkJVG4rSjFUo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-5600E1q6NyGA8bCIPxJPaw-1; Wed, 20 Oct 2021 06:19:33 -0400 X-MC-Unique: 5600E1q6NyGA8bCIPxJPaw-1 Received: by mail-ed1-f69.google.com with SMTP id cy14-20020a0564021c8e00b003db8c9a6e30so20531907edb.1 for ; Wed, 20 Oct 2021 03:19:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ye8xamo/xFWVL8QWKzRp1k9WG6eLXO+rQQkUJvOw6N4=; b=BQpb0hg+GWgKFst/jVZojQrU6s4+pAywlO59NS9KXN3zpgKaGVuyAwiFUWzHCLBBJg ZjfkGmkw13MYZieqbyEii3otTNX/P7ZDj1VpTzMJVLqU6vq2r1vVhSJCZBhNGBEi3kOx 3G2lz22R1qMfCuDbGo7e6nls5iV28/EP+5i5SBlbXw8bdcXJdUgzuDjOuhX69DlCj/Gw CYu8YZaSNKPa/NdtaqvOwUnEsk/Gqnseo2O48tqRjhhakzT/1ZYp3mAfcUSshJLaG7C7 B7f7jZKd+mVj3sa9oAwN8q6GCxQoCGRQ3dsQ89iH786bGGLU4az/YgaDqiJPZBvkx0Ta +Qvg== X-Gm-Message-State: AOAM530/tZdcmpP7HrA/uvmy5bCBa/Q9uDfiIN2LSdSOmLVMIYDLGQdO StE29+EI5PW4s48Eee0x9KbZS3EDRrWOr4p5NVYQgI9S5dZRbi/Y51QOzNJejUHQydK4GrFg4Oy QDpDT3VxzpWER7lI33D7OkiYZDRiGO9i/ckgLFhuuOSnsEN5I4joa1W1RoJFu X-Received: by 2002:a50:d8c7:: with SMTP id y7mr61401321edj.133.1634725171886; Wed, 20 Oct 2021 03:19:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEIPvi0bIji9GKMEZnxcLvIkAKtJeQOhStso3RjQqoQpZhaJhwUEsJAng2inQ5kjIYsddgkQ== X-Received: by 2002:a50:d8c7:: with SMTP id y7mr61401280edj.133.1634725171646; Wed, 20 Oct 2021 03:19:31 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id p3sm823104ejy.94.2021.10.20.03.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:31 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:29 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 06/44] tests: acpi: whitelist new expected table tests/data/acpi/q35/DMAR.dmar Message-ID: <20211020101844.988480-7-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-7-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + tests/data/acpi/q35/DMAR.dmar | 0 2 files changed, 1 insertion(+) create mode 100644 tests/data/acpi/q35/DMAR.dmar diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..a2843335c8 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/DMAR.dmar", diff --git a/tests/data/acpi/q35/DMAR.dmar b/tests/data/acpi/q35/DMAR.dmar new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 20 10:19:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572021 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38163C433EF for ; Wed, 20 Oct 2021 10:36:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F1EAB61260 for ; Wed, 20 Oct 2021 10:36:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F1EAB61260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8x4-0007pt-3B for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:36:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h9-0003Fc-Fv for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50492) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8h7-0002py-Ua for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725177; 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=45RxJNq+cSGim9pNSbreOrNLOePsLo5J2oFWYQMFyvE=; b=QNpIRvTUSFz0MzDPWI215AWZkcUEpfokcvTecpTXHMDPYulWg0gTGj2kFKdd8iwMrgaSn7 SCUtMFCvLpInZ5gqoT6CpT2jdkC5N7zUUD94OC9i0cl/Cm+pzSOaBUIDGetARG1bsG9ueR 5gQByF83bmXUx7cUMSbiNBpQ5869tBo= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-497-wYEv29DmMMm7OGRdGeaoaw-1; Wed, 20 Oct 2021 06:19:35 -0400 X-MC-Unique: wYEv29DmMMm7OGRdGeaoaw-1 Received: by mail-ed1-f70.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20616742edv.9 for ; Wed, 20 Oct 2021 03:19:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=45RxJNq+cSGim9pNSbreOrNLOePsLo5J2oFWYQMFyvE=; b=KxjRvnGyh39ar4a5mxQisAbG114MxDaJc1++ya7qmeA1tI7BXS/3/0y54uOODTHSe1 DjB7FDvgmPhK2lGSqewZ5o622Vx/MbijU6cFOLwVeNAS2SlOiKB/ytOcOn9QXUnS5egB td/uM1dOy/D1o0pI3AudW2fnKXrGHCel4KF3wNtaqZXdvUP5nxADeS/UbHHuGwxX5h7L 8JtH3ETCI0dEuvg5SJN7jUPWsc46bGIAla6QWGy+KF6K/YCVaNII9+fHnTRljj5B7g/J xdAl7TUQvikyaC5RMN2x4E8JAryEtwQ1D8BYXLHpean26e8H3S6Soe5knc8IruqEicV8 aUlg== X-Gm-Message-State: AOAM533VQ/uPY9s9jFraO8jdxx1IlqHW6rtLpeTSWAxiqhmjn6KmHhpF 3Fc7VAJVFd3GC0q/28rqfucH2u5RMKPGckoC8+PhP9BbD+UZmD2CbrOEX+OHbD5Gh17g9HDOV35 0Sa32DVCBINnUk0ahykJv5LvWpBQELrcGCq8BNDnLlYwwMBz8WPUR1RwFtnc5 X-Received: by 2002:a17:907:1b0a:: with SMTP id mp10mr45328127ejc.29.1634725174416; Wed, 20 Oct 2021 03:19:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydEQfRzt61EYsJp4akm4vrIL9U/EvwYjp3yxEkUwAjBT1g9C9q2E2WuCQ6EHVcmNrEA6/1RA== X-Received: by 2002:a17:907:1b0a:: with SMTP id mp10mr45328099ejc.29.1634725174191; Wed, 20 Oct 2021 03:19:34 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id s16sm969499edd.32.2021.10.20.03.19.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:33 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 07/44] tests: acpi: add testcase for intel_iommu (DMAR table) Message-ID: <20211020101844.988480-8-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-8-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 87a94a59fa..0361c84c5e 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1090,6 +1090,18 @@ static void test_acpi_q35_tcg_nohpet(void) free_test_data(&data); } +static void test_acpi_q35_kvm_dmar(void) +{ + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_Q35; + data.variant = ".dmar"; + test_acpi_one("-machine kernel-irqchip=split -accel kvm" + " -device intel-iommu,intremap=on,device-iotlb=on", &data); + free_test_data(&data); +} + static void test_acpi_piix4_tcg_numamem(void) { test_data data; @@ -1583,6 +1595,7 @@ int main(int argc, char *argv[]) } if (has_kvm) { qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); + qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); } } else if (strcmp(arch, "aarch64") == 0) { qtest_add_func("acpi/virt", test_acpi_virt_tcg); From patchwork Wed Oct 20 10:19:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572017 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BB85C433F5 for ; Wed, 20 Oct 2021 10:34:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AA9CE6128B for ; Wed, 20 Oct 2021 10:34:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AA9CE6128B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40880 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8vg-00068J-NI for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:34:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hC-0003QI-Th for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hB-0002sq-2j for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725180; 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=DojFyI8EvkqW3utABMlfyrMcp5+zRY2rAvm55Ie1TK0=; b=DG1EmT0tVODytU58ol5NnbMkPCu9ysq8NyN0DFDrMiIqOW0hkSooLtJrv3KZ0qwl4t26b2 IbbRYhstQRwo2pq4xnzGYOGQV0JHU6UqIgQdjjt789GCRRWeUvLKJWR9REilAsF2Pv7tyi EZGlQMZuZnPG8R9ZCqDxdzw3oTWI4ms= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-jzpyBquOOtWYb4iOq7Xf3A-1; Wed, 20 Oct 2021 06:19:38 -0400 X-MC-Unique: jzpyBquOOtWYb4iOq7Xf3A-1 Received: by mail-ed1-f69.google.com with SMTP id x5-20020a50f185000000b003db0f796903so20523015edl.18 for ; Wed, 20 Oct 2021 03:19:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DojFyI8EvkqW3utABMlfyrMcp5+zRY2rAvm55Ie1TK0=; b=InVfwQpvHTKQAbMLVElVchKtnG6TT54oxseQp14gIJkI8A5tiT3c/TKmg7aZ7F6FOH AhMQrFSWXPvgwMjaP0RFs63j0b/jI5i+YJ8SSIG29lujQTOyt/uni/4ztU8pTYQok1eJ Rz+VDKbeG8KA+s5eXRlfHmbzp2E9okEu+9Gve8ThIY4f0bonRrxCUXKEbLkW7UznUDBJ NXZsCIaVCbwqtBE6FD19GYgM000tH623tLBjTIB8YJixDxscpGzEFLKkKFlMkYT3kvEv deUWyzZuhvbOG19hlFsum2xDqDwB2yo99V4I8q6hjRtWc4jbRd5fox/bJ31xsvpMcbCR dN9w== X-Gm-Message-State: AOAM530+cAjXKAeDiAfnmzUBN/h5K++oELuMedaRvrO/hVCqfVJScctX T6fWRkJf4AeJStSLYpXCmqDz54FDALE/GskntioTpoPqn6OJd36pIQCOTQ+tPDzv0iK/YAfweEV 9YNOWFYl+pYvlQSVGsWjAzvbb4c9mnx2Y3PbG3FUqx2G5mj09PRPTT8tNYdht X-Received: by 2002:a05:6402:447:: with SMTP id p7mr61037963edw.261.1634725177425; Wed, 20 Oct 2021 03:19:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7sLPt1sHod/PbcuROnDfc+Mti47qldjbvNbTRIJ1sC8cHASd0/Wf+io6v5zTy6k0lgQE3Yw== X-Received: by 2002:a05:6402:447:: with SMTP id p7mr61037921edw.261.1634725177220; Wed, 20 Oct 2021 03:19:37 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id bw12sm827021ejb.9.2021.10.20.03.19.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:36 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:34 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 08/44] tests: acpi: add expected blob for DMAR table Message-ID: <20211020101844.988480-9-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov [000h 0000 4] Signature : "DMAR" [DMA Remapping table] [004h 0004 4] Table Length : 00000078 [008h 0008 1] Revision : 01 [009h 0009 1] Checksum : 15 [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 [024h 0036 1] Host Address Width : 26 [025h 0037 1] Flags : 01 [026h 0038 10] Reserved : 00 00 00 00 00 00 00 00 00 00 [030h 0048 2] Subtable Type : 0000 [Hardware Unit Definition] [032h 0050 2] Length : 0040 [034h 0052 1] Flags : 00 [035h 0053 1] Reserved : 00 [036h 0054 2] PCI Segment Number : 0000 [038h 0056 8] Register Base Address : 00000000FED90000 [040h 0064 1] Device Scope Type : 03 [IOAPIC Device] [041h 0065 1] Entry Length : 08 [042h 0066 2] Reserved : 0000 [044h 0068 1] Enumeration ID : 00 [045h 0069 1] PCI Bus Number : FF [046h 0070 2] PCI Path : 00,00 [048h 0072 1] Device Scope Type : 01 [PCI Endpoint Device] [049h 0073 1] Entry Length : 08 [04Ah 0074 2] Reserved : 0000 [04Ch 0076 1] Enumeration ID : 00 [04Dh 0077 1] PCI Bus Number : 00 [04Eh 0078 2] PCI Path : 00,00 [050h 0080 1] Device Scope Type : 01 [PCI Endpoint Device] [051h 0081 1] Entry Length : 08 [052h 0082 2] Reserved : 0000 [054h 0084 1] Enumeration ID : 00 [055h 0085 1] PCI Bus Number : 00 [056h 0086 2] PCI Path : 01,00 [058h 0088 1] Device Scope Type : 01 [PCI Endpoint Device] [059h 0089 1] Entry Length : 08 [05Ah 0090 2] Reserved : 0000 [05Ch 0092 1] Enumeration ID : 00 [05Dh 0093 1] PCI Bus Number : 00 [05Eh 0094 2] PCI Path : 1F,00 [060h 0096 1] Device Scope Type : 01 [PCI Endpoint Device] [061h 0097 1] Entry Length : 08 [062h 0098 2] Reserved : 0000 [064h 0100 1] Enumeration ID : 00 [065h 0101 1] PCI Bus Number : 00 [066h 0102 2] PCI Path : 1F,02 [068h 0104 1] Device Scope Type : 01 [PCI Endpoint Device] [069h 0105 1] Entry Length : 08 [06Ah 0106 2] Reserved : 0000 [06Ch 0108 1] Enumeration ID : 00 [06Dh 0109 1] PCI Bus Number : 00 [06Eh 0110 2] PCI Path : 1F,03 [070h 0112 2] Subtable Type : 0002 [Root Port ATS Capability] [072h 0114 2] Length : 0008 [074h 0116 1] Flags : 01 [075h 0117 1] Reserved : 00 [076h 0118 2] PCI Segment Number : 0000 Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-9-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/DMAR.dmar | Bin 0 -> 120 bytes 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/q35/DMAR.dmar b/tests/data/acpi/q35/DMAR.dmar index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0dca6e68ad8a8ca5b981bcfbc745385a63e9f216 100644 GIT binary patch literal 120 zcmZ?qbquOtU|?Vrb@F%i2v%^42yj*a0!E-1hz+9EKm;5(Kv_5cff&pjK;l18KZphb W2+atk X-Patchwork-Id: 12572039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94E4EC433EF for ; Wed, 20 Oct 2021 10:38:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 46A84600CC for ; Wed, 20 Oct 2021 10:38:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 46A84600CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8zc-0003bO-CE for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:38:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hI-0003Vs-MR for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hE-0002uW-Aj for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725182; 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=NYKn9Og3lz4o30x/1JiH1NpvUb3mCz2MPvSBP82Jf0k=; b=DACpa+6ahkfMHFBkPiqAgZQriZicgx1IGVuXb4ifyLxpDnCBrUHFgydy2ZGMYsPt5UVsOX AbweG2bRwMTJpNk1DLXKjgtZhLD+QRPkoJbQIRGvs5oGEtD2D8n+g4MsP7n+zBsV+/3jbQ rdk2FH35JVVKc/y00Ro8dGydtGo479A= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-4zgMl_REObqrxW46VvW24Q-1; Wed, 20 Oct 2021 06:19:41 -0400 X-MC-Unique: 4zgMl_REObqrxW46VvW24Q-1 Received: by mail-ed1-f72.google.com with SMTP id l10-20020a056402230a00b003db6977b694so20504018eda.23 for ; Wed, 20 Oct 2021 03:19:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NYKn9Og3lz4o30x/1JiH1NpvUb3mCz2MPvSBP82Jf0k=; b=X8BJraTnpAxtodNrIqWwTKnpJq4hEsYaZ62luLuwnL54SdCbfhlxmEOdHozJ7/eKdy AHF06CuzkwEPicbdvgPCNoEiwgoWuJaMfQjpDL3S+uThV8ej+T69inIzot1Yf1iZpHuq RY4gXXG6sVMYyngQkO9HdrGdptxjdnTUo3DcZ0+Zcyx4oUl/P7vZKaBczS+zE4PZmydV wZsuGK28AFw+7uUUz+jjp4yceOSiA5YDQtgMWltbUeO5cQhMMVlIjSzWq4TTCPSLFKCf Mrqky/ybhzTD5XCj6VOHtow77xEJgx50PoXLPtn41k1RpDyoghkaK63YoNg3g6AMHY07 Z3nA== X-Gm-Message-State: AOAM531O13V8JycvxkvbWW4M4StKCTewUpNkAWbkTNtCloinfH1iwSvb fki4YpcjMYW8xp51eD/9wWux4FXiQoQCmwUuJ/JVHKQT9qhFrruPKEych7MErtFCIyYjQgh2G9K rQ+RdA8fK/RIXqkJ3pOwwHiRUCWUlavZw1ZqnUd3FFcVo2gl/EqElLYhCqtrV X-Received: by 2002:aa7:d8c7:: with SMTP id k7mr56181768eds.85.1634725179970; Wed, 20 Oct 2021 03:19:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrg8Sncz6ysTvkwLqL+Jj9JHWaPqdCjpcuK+3QGE4WkABc1TghPDCCHx05op6OLt+3zS7F0g== X-Received: by 2002:aa7:d8c7:: with SMTP id k7mr56181744eds.85.1634725179761; Wed, 20 Oct 2021 03:19:39 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id e7sm1021511edk.3.2021.10.20.03.19.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:39 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 09/44] tests: acpi: whitelist expected blobs for new acpi/q35/ivrs testcase Message-ID: <20211020101844.988480-10-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-10-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.ivrs | 0 tests/data/acpi/q35/IVRS.ivrs | 0 3 files changed, 2 insertions(+) create mode 100644 tests/data/acpi/q35/DSDT.ivrs create mode 100644 tests/data/acpi/q35/IVRS.ivrs diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h index dfb8523c8b..4fe8e8272a 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.ivrs", +"tests/data/acpi/q35/IVRS.ivrs", diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/data/acpi/q35/IVRS.ivrs b/tests/data/acpi/q35/IVRS.ivrs new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 20 10:19:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572043 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2257C433F5 for ; Wed, 20 Oct 2021 10:39:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7B20360FD9 for ; Wed, 20 Oct 2021 10:39:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7B20360FD9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md90G-000528-I0 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:39:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47992) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hJ-0003XT-54 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43619) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hH-0002wq-Db for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725185; 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=JGBYmvhDt6E8gZOldDQh567mQwOZUysQwDU9UgiIntM=; b=cCCf2ecLSWjKG71P05gI2iE9nnwVMPxBPqlM9jp6TKWvHpBLvqOPrtePnOC0Z2OIc0cwQn tv94tP9dGOcxktrEQ0m4Evu3Bols1UFp8t0MC00nCgsQjEJgRA93lYyIUNcgmmk8bGJfoD Qfucf3F+IKU8gK17C+Yhiy6ezwT6D2A= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-370-lCEo4AZiMda3M1_Qt5zJFw-1; Wed, 20 Oct 2021 06:19:44 -0400 X-MC-Unique: lCEo4AZiMda3M1_Qt5zJFw-1 Received: by mail-ed1-f71.google.com with SMTP id v2-20020a50f082000000b003db24e28d59so20505183edl.5 for ; Wed, 20 Oct 2021 03:19:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JGBYmvhDt6E8gZOldDQh567mQwOZUysQwDU9UgiIntM=; b=ZoKJZ4XwrnLPYFgxD/x0ax0PCMsbVuN+GJxZkmopJsdwlJYsgPi/1wFqxD19U170ny SjYEHZg8yAVQlr2j/e51FNkL2olllx7i8Fn3F7KlK8cq+Gtfw2cErqjqeDTjpykLQNBB yz7GU+K0tUbLLJhpva/azEJAAJks0tFrQTgVhH7k8r0APKPDncbm1PtIn9RNMSwxT1Iu MJ/xqJHNgsFEwUFcK9J11nt4oUDSuHnx6oe/RsrsYIJczFwx6AAUcpzC+zuxygqSdAP6 6S+ly6om2pHGN89zJqb4MZO1QL1sqZFKU45R90S50hKgT9R8ZanJB4KV1iPp186isk4i hZBQ== X-Gm-Message-State: AOAM530G22p3kOsT4pLOzPGiqSeUM+sav1q//Aam0mn2jCU6aexVLFkl AipEPPdzcCv4oh1Wbrf+aKUhi7Uio0n9jx5VU2v2XE7dm2uOMwP1yiANi0PpuXv4T0GiKAmEd2Z qLm4t1UTp/CXn13XgPk3mrwbZ6gqww2f6hR3aCpAOoJhdwTpzNZaHk3l29ghO X-Received: by 2002:a17:906:480a:: with SMTP id w10mr46484408ejq.262.1634725182453; Wed, 20 Oct 2021 03:19:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEe4wrDIarrs0GEw622lySSiyk5EOl7E+LjemrW363uqF2jd5iCgYTZm2aZz2ydAIw4113rg== X-Received: by 2002:a17:906:480a:: with SMTP id w10mr46484390ejq.262.1634725182276; Wed, 20 Oct 2021 03:19:42 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id a1sm943218edu.43.2021.10.20.03.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:41 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:39 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 10/44] tests: acpi: add testcase for amd-iommu (IVRS table) Message-ID: <20211020101844.988480-11-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-11-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 0361c84c5e..ef28bb41f3 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1102,6 +1102,18 @@ static void test_acpi_q35_kvm_dmar(void) free_test_data(&data); } +static void test_acpi_q35_tcg_ivrs(void) +{ + test_data data; + + memset(&data, 0, sizeof(data)); + data.machine = MACHINE_Q35; + data.variant = ".ivrs"; + data.tcg_only = true, + test_acpi_one(" -device amd-iommu", &data); + free_test_data(&data); +} + static void test_acpi_piix4_tcg_numamem(void) { test_data data; @@ -1581,6 +1593,7 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/smm-compat-nosmm", test_acpi_q35_tcg_smm_compat_nosmm); qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet); + qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs); qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm); qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat); From patchwork Wed Oct 20 10:19:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFD66C433F5 for ; Wed, 20 Oct 2021 10:43:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4AE1D611B0 for ; Wed, 20 Oct 2021 10:43:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4AE1D611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md94a-0001DK-7B for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:43:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hL-0003cT-A8 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hI-0002ze-Jr for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725187; 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=Ny6i22dSZQC3mrPDi4s6PRK4pnVtAekpF8G2Yb/TCEg=; b=RRZtTVTltCT2M4paGnhaIyEn8rLt7fTSIOGzu52NSCC2dxo4hSnWYiM61+r/aBcR6nm2z7 IU7VC2aynDn3uj98hVniEyk693PpomPGpXgnRadvxacvXX9yq+W16umebWLN42lh6NAR2I pXPBGcejND4BKfWWhE4SxiCpAYoMjXU= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-504-6BSCQqMeMJWfoXNlEFPKxg-1; Wed, 20 Oct 2021 06:19:46 -0400 X-MC-Unique: 6BSCQqMeMJWfoXNlEFPKxg-1 Received: by mail-ed1-f72.google.com with SMTP id p20-20020a50cd94000000b003db23619472so20586146edi.19 for ; Wed, 20 Oct 2021 03:19:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ny6i22dSZQC3mrPDi4s6PRK4pnVtAekpF8G2Yb/TCEg=; b=t8CM442meGynZT5hGjGfpfEUukFaiZKkZD1ncI15SkT7pfvu3q+TdcKrSwMsR25dnW GOto99cmwtRPBLzi+q61BO28q8zAVIQm1Ax+9T511y1PQHTSnTeLMiCZqNzR6Hve7Bs2 PMRd5IKetrVfMIwLyrPlRqRsjCqrrszoBbCVpT+QRYqBx35sK6wj3/IOCmpmUuIpyRD6 kmZM6PIQX7kMqHf/G9e+2XpB+QzHKg0Yr5XZsV+uq+7GF3rSdKG6EgiI/69xYlPibdL5 qNeoKauFAUH1A7NgmV4NgQT3GxdGT97WSl4OhStA33U6YbBMFxRXuEZDgYmqjwqKFPOm dvHA== X-Gm-Message-State: AOAM530dxZi81wrayZnE0qMpFwV1mLsQJk3XkodFwTK/47uAToeu93OZ TLK0E2wLEwwWGQhS0/VAXIzs+pLJsoYMr74UZ6rSOrkMMd0TYyoGjyWAdyPukWBfUGWkWtGz7pI ozlvmSj5dq7A5yceWFcBkMRUY8iF/NfRTsb8qmFrrCwl74OLTOPKutyOYtO8I X-Received: by 2002:a05:6402:5112:: with SMTP id m18mr60428046edd.101.1634725184944; Wed, 20 Oct 2021 03:19:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCv+aI6kT8FxdrtkExnIjkiQuMZCMRwCjT39eRxiXiqYdzl4zGlAgghalQixxr253scbwKQw== X-Received: by 2002:a05:6402:5112:: with SMTP id m18mr60428013edd.101.1634725184662; Wed, 20 Oct 2021 03:19:44 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id m15sm1038878edd.5.2021.10.20.03.19.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:44 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:42 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 11/44] tests: acpi: update expected blobs Message-ID: <20211020101844.988480-12-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov DSDT: + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + } New IVRS table: [000h 0000 4] Signature : "IVRS" [I/O Virtualization Reporting Structure] [004h 0004 4] Table Length : 00000068 [008h 0008 1] Revision : 01 [009h 0009 1] Checksum : 43 [00Ah 0010 6] Oem ID : "BOCHS " [010h 0016 8] Oem Table ID : "BXPC " [018h 0024 4] Oem Revision : 00000001 [01Ch 0028 4] Asl Compiler ID : "BXPC" [020h 0032 4] Asl Compiler Revision : 00000001 [024h 0036 4] Virtualization Info : 00002800 [028h 0040 8] Reserved : 0000000000000000 [030h 0048 1] Subtable Type : 10 [Hardware Definition Block] [031h 0049 1] Flags : D1 [032h 0050 2] Length : 0038 [034h 0052 2] DeviceId : 0010 [036h 0054 2] Capability Offset : 0040 [038h 0056 8] Base Address : 00000000FED80000 [040h 0064 2] PCI Segment Group : 0000 [042h 0066 2] Virtualization Info : 0000 [044h 0068 4] Reserved : 00000044 [048h 0072 1] Entry Type : 02 [049h 0073 2] Device ID : 0000 [04Bh 0075 1] Data Setting : 00 [04Ch 0076 1] Entry Type : 02 [04Dh 0077 2] Device ID : 0008 [04Fh 0079 1] Data Setting : 00 [050h 0080 1] Entry Type : 02 [051h 0081 2] Device ID : 0010 [053h 0083 1] Data Setting : 00 [054h 0084 1] Entry Type : 02 [055h 0085 2] Device ID : 00F8 [057h 0087 1] Data Setting : 00 [058h 0088 1] Entry Type : 02 [059h 0089 2] Device ID : 00FA [05Bh 0091 1] Data Setting : 00 [05Ch 0092 1] Entry Type : 02 [05Dh 0093 2] Device ID : 00FB [05Fh 0095 1] Data Setting : 00 [060h 0096 1] Entry Type : 48 [061h 0097 2] Device ID : 0000 [063h 0099 1] Data Setting : 00 [064h 0100 1] Handle : 00 [065h 0101 2] Source Used Device ID : 00A0 [067h 0103 1] Variety : 01 Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-12-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.ivrs | Bin 0 -> 8306 bytes tests/data/acpi/q35/IVRS.ivrs | Bin 0 -> 104 bytes 3 files changed, 2 deletions(-) diff --git a/tests/data/acpi/q35/DSDT.ivrs b/tests/data/acpi/q35/DSDT.ivrs index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b0eafe90e5832935557ec5e6802c0147c88f379c 100644 GIT binary patch literal 8306 zcmb7JOKcm*8J^`sS}m8-lAKLj4?W=zfLoCk@fbxO1*Dn5-Fp1J;Tp& zsF;NxdzG!a@%!EI%P@TR)6m$C*rl(WTbH(@k8gyR7=f-`iY$vxoa%f(sPudLuI0PU zlG$%GJ-d9@GR?j#&XQ)o>~)yg-)efSus+-02;9`oH<;^PSRJ<0gWcSs<@8$rI`{3$ z>0f+#;ob6`pa1ihH{Y;Q0G!2N6MxS|bO=8Tt(9=-d@;CUd_;79ZFRW##eiQHZ4O-49~jM+3e^!xK@H2SMJWzPG| zX_-Q0)ol3Hu2gA28>#B;HT-Ui*^J$NkYTCbb%)}`SE_BV=y$w+vG77a=$2VTEn!4W z+aH9M6Ataq2O%4TnbGKg4d*`}Y_s2O+w9-}OCPWUYeDoaXU%^yM}4{bfTb8iZ@%{o z^@hf~w|}x3l>2;$QGNwo@td8^gcVx0v$pVTQUVFp+kbAY;sGq~Q4+mJuVk6y)>7RF zS;!2dZd_)U@%Kyu)q49+wl=m7SqqCA%e2yGXoPzEXV?Ais?41d_uJ60j+Lz&?&;(>!zTt;+3>{Rij}|&_=rD8HXhp% zJIE!C>vUkZmxoJ(tJZ9kPbXNGZAamaZN?6^O~2{ZSi$b&uMzE1eYwzskGbucsY`wi!W#Zhxd5z_5YPS*y>M}?oXs~=Xg??Zr30xcz3&44Cjq?DN zAu*AkV-uVSY#b3&LKBQL0p(1D#6)j6Hp!W?2T4Xu2~7$npqz=2n6e7ymB8{mDbAG8 zlwiuvBUE*!HJxeBl+d(b%FZKHb5IbA10Ri~xtv^1TTt`niEGo$IuXgV{xPK2sXybG24X=^%dT_-|S zXI9gh)pTZcod{K(^P0|iP3OF>6QQbeLDRXQ>0HotB2;xcnodX4>F7EUsycI;&YY$* zr|U$h>db38^P0}Qt`niEb5YZ|sOenPbs|)C7Brm&O=m&ZiBQ$Kr0HDJbS~*S5vn?m zX*!Q-I*;i(5vn@zC4r|;zK51Ioy)pTgsRTtn$F{z&f~gHgsRRHoLP?FgeN$&62I(D z2&VfmB&HW*PioAQ8uO&iM5r=PY0Og^^OVj+s4`D$%+nh4w9Z7RG9S~Jk7>-ubS6TT z`8a1vmwB8sV$!cw44b8RiI>`2&F5Mfg+STVW0xbnJ`cVN(L&R zye1haLa7r5DzKah16818paRO7WS|J8P8g`bawZH^fs%m=C})y^B9!+N1}dAz;Y%GRDqI#3Mglifg+STVW0xbnJ`cVN(L&RoJj_XQ0jz%3M^;B zKouw%sDN@N87M-j69y``0?L_Wpa`W- z7^uKf}LawZul zLa7r5DzKah16818paRO7WS|J8P8g`bawZH^fs%m=C})y^B9uB|paRR8Fi-_b1}dPO zNd}5g>V$y`EN8+%6(|{~fN~}oC_PNRBNTC_*{5WS|JKRCKZr3uQxl!2el2pnphj&(NQ8 z@A^-lP11jd(D|B$_;F%0-FPl|5uhF4ShlW{LY;IyTU^w@owYQ5! zmbn8fQ+Teq>2~G-=#+BvR_3!AHpf?j-e)(d%}V3gj6U4878sqO6CEtQtk2>bp)8j? zY%JH%Vvvb$2f1U`;%D=0E(v#Icz-jziLrW7Sm5hG2h;`hrd-JNy=K5ZqH}AHw=B?l z6a&KT@OZf&bOPh%ZrledPwjE_%2;(Qo_y!(6{UKGSFfOdYV}HCdi6?gzeU=`QW}=~ zV(nJq5z4ztd6$=W$I81$ly~Fu-k5j`3tHbQjL zm6xxMm9HLAz8aUWjh9b9Liw6fzQ)Vf#>&@@C|`@q*T>7xJVN=pQohd1*T>4&k0@V{ z%Qwc$&ptx=hEl%4%Qwc#H;yRZK=~BC%Erq(qP%>0;IjhLU98{gZG{;=R#B+U2Plu11iFBfEYPyN%bXiY_FP({WqD@cdoO-yP zy}uB&D%fhlwu+s^n!mI0ve=zySQj6z`1_q|AfHkTlM~*Qb^Wbk_TlW6Juo^9E^>p!5N%!;mGZ5wX09T;w> z^@@Q7@Dd$r21~kb%fljjo{&j5sIC_Q_sZQO)|#8`rWrA6#8ZFnBG-csiB4wAuHP(` zR!h_kv2m0x*>^^a2eeEDDw9+K&(Fz&ksgPl6{zC1T8@O%r2pOi^u3pF|MiJYIjLTnn z`N3r)VwWQ$jM(;9>-KL4p>b;mO<}Y%UXlwQZ^TU*F5en&#ckR7dN?=OwnixPbu{hz z@X3jhqx&B1+@L;gvuoSv)$JFD&riVklY!f}V!I+D8oY^rvMaKL#(lGG%NcD>2?m(5vH(80M+H>wWwZ zJ=2)~_+fhBxi$~z>BbCbmAko&WiqTb(06EI9-F4!42fa8SFRRLVe-`dYQI`K%i X-Patchwork-Id: 12572083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C62ADC433EF for ; Wed, 20 Oct 2021 10:54:41 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A3C86115B for ; Wed, 20 Oct 2021 10:54:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4A3C86115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58716 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9F2-0003tM-1Q for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:54:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hP-0003lz-Ay for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:35264) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hL-00031r-8Z for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725190; 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=qOZtE7xnygrqomoULUMXxJIooXP/byLxi3JGgtUneLc=; b=S9ds9ugxZoJirrHi6dDmsMe9BDmj6KJGeep0ZiHCFTaKoJEn3NRGe/lt7TRBhIl2ImkTZY efAzHdqSX2s9w0yugGpVPNMNK0WCdCAxRQAO11G3H5339sILhnpYHDl4/UyWmrNVUmmX52 I7fkbfIBfUbx/hOz9reVCQPhqdBVOAY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-556-uEu1UaqTOxCtNURfkZ2FaQ-1; Wed, 20 Oct 2021 06:19:49 -0400 X-MC-Unique: uEu1UaqTOxCtNURfkZ2FaQ-1 Received: by mail-ed1-f70.google.com with SMTP id v2-20020a50f082000000b003db24e28d59so20505395edl.5 for ; Wed, 20 Oct 2021 03:19:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qOZtE7xnygrqomoULUMXxJIooXP/byLxi3JGgtUneLc=; b=ERyDUqQ2795wvmXvQX7XdsoPr26I3UxERgZBJAwW3Nw5/GAvUYN+UofL2JGohBuuw3 t6efcvlAW9quj2ei3ib5lXmu1/CuehdCzYGo6FBKiKpxM7FRqJmTg96mG2Xtxxzy0rh9 fjxupBjt8KaPaKp2igU2GmlgRA7/6tNEHeV2eot13BvwNW1cGbN/JGo9TUP6QvT9LOd5 Cl7LW1D1lj+1apZQPqQn5DOiVBmq6hjdn/0Hh+PacTV9Zkb5BWVSJFUrExiUr444JNQs 31MY/a74Tm0TXjhlM4NwfeeAo4pfHaq/lDX2AI2aZPgsq/S+7BS5zqKY1xZmrQrDUx7c micg== X-Gm-Message-State: AOAM533jOUcTdmFyquIQARF3oNMkjdk7/U0BRItSthnnh2O6eBHkLaRB tShpxQMWzvFQfNd4zuiRNIN5ZI8lvMZn1BQwxdaAJFHisFz5FXuHPCHEC7BVIAxl0/jdcSHsxgb 8l/+yNfr5rsrFK6bmlarZ7NlMaZNMFHWHAC4RhwZAJWf29SLre6wCt7u6poQz X-Received: by 2002:a17:906:4895:: with SMTP id v21mr46367694ejq.299.1634725187839; Wed, 20 Oct 2021 03:19:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaxNuXtxKPOoblZTM5Eq+klWYS4xA2nSVAPqJaAtcZr92FL8Tx0y2NMrVyABECWZpfkdOPxQ== X-Received: by 2002:a17:906:4895:: with SMTP id v21mr46367671ejq.299.1634725187649; Wed, 20 Oct 2021 03:19:47 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id q14sm809717eji.63.2021.10.20.03.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:47 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 12/44] tests: acpi: arm/virt: drop redundant test_acpi_one() in test_acpi_virt_tcg() Message-ID: <20211020101844.988480-13-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov follow up call with smbios options generates the same ACPI tables, so there is no need to run smbios-less variant at all. Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-13-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index ef28bb41f3..873eb9c037 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -1430,9 +1430,6 @@ static void test_acpi_virt_tcg(void) .scan_len = 128ULL * 1024 * 1024, }; - test_acpi_one("-cpu cortex-a57", &data); - free_test_data(&data); - data.smbios_cpu_max_speed = 2900; data.smbios_cpu_curr_speed = 2700; test_acpi_one("-cpu cortex-a57 " From patchwork Wed Oct 20 10:19:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572023 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9079DC433EF for ; Wed, 20 Oct 2021 10:36:23 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48A0560F8F for ; Wed, 20 Oct 2021 10:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 48A0560F8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8xK-00005D-Ar for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:36:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hT-0003xf-CF for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:56117) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hO-00035N-AF for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725193; 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=X5r2KJQH0mFVuWmoeGDJsGfJGfPX7snxmFOMGZkQyOY=; b=VuiAuZE23Qq0Bs7mehDBwuIXIpXguuShGDCDQnT9cwWvJgSwx0rpxM2wWZhPS+lv2u5WgI GUTfMpdKlaqE05DrQxAlnhqdF1u+s3RD5/mOLjzn8pRojidItA/qx9/VSYzbgTBDvw2BNd 5rfkoDFLlQeuHoQZsUqScT2+5ed5ORk= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-580-mizFOYSVPFiG-_2GQagF4w-1; Wed, 20 Oct 2021 06:19:52 -0400 X-MC-Unique: mizFOYSVPFiG-_2GQagF4w-1 Received: by mail-ed1-f71.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20617375edv.9 for ; Wed, 20 Oct 2021 03:19:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=X5r2KJQH0mFVuWmoeGDJsGfJGfPX7snxmFOMGZkQyOY=; b=XZKywCbw+Gua8adkjID3sMVNTdMVU2Uv4KVb60eN91T2EoUsYdkmFZlN7uDdefyrGT r3Kgt4pkeY3LWm//Otqnrit6csAzdbYIF8GqAV7vpmqSg/xkDX9VLgEXRQB1ZnPeHw9j 31vRKWpvRN9f+RfaqlGjYNSe29vaN7UE+GDtBkwx+SJoofGc54yQaIgA7Mrr7jARdtGX U38NWpa/J2iqSXMPdkGaBPGv2h0wneOdatQpk9mQ2g/7WlC6EyO94/GH9DqsTrke5ca0 QFRSsqcJB75vEgwTJVeIhDIDEKp/uyO9mt11gCjjzVLhXlyflbz14ENYKfIB026YHknn ChOA== X-Gm-Message-State: AOAM5319Q4sML3teCGlo6w5QRjxLXXL4n7I8YhP9qcRn1mrbtA3DD7c9 6nK3WyyxGZQBFBURVkRQ6+nqhhf6wf4fanUY6y3fm1M9usoigLT9j8RDpmfsbURgz+JWpYFPaj4 lVJiUpJ5+kW2+XcG1q05Q3UzT9WYYulFBFLG0TyYvN4WUm3l0thLX2ZAZp1o3 X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr60491463edb.138.1634725190803; Wed, 20 Oct 2021 03:19:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynevnzD3actdH3sQEd30E3XPDlg9uEWIMJW3wlpK5gXY1QviKKjZVqCfghNKlysy1CR7r5PQ== X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr60491439edb.138.1634725190590; Wed, 20 Oct 2021 03:19:50 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id h10sm930692edf.85.2021.10.20.03.19.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:50 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 13/44] tests: arm-cpu-features: use qtest_has_kvm() API Message-ID: <20211020101844.988480-14-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , qemu-arm@nongnu.org, Igor Mammedov , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov and drop custom function that were doing the job Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-14-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/arm-cpu-features.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index 90a87f0ea9..f76652143a 100644 --- a/tests/qtest/arm-cpu-features.c +++ b/tests/qtest/arm-cpu-features.c @@ -26,21 +26,6 @@ " 'arguments': { 'type': 'full', " #define QUERY_TAIL "}}" -static bool kvm_enabled(QTestState *qts) -{ - QDict *resp, *qdict; - bool enabled; - - resp = qtest_qmp(qts, "{ 'execute': 'query-kvm' }"); - g_assert(qdict_haskey(resp, "return")); - qdict = qdict_get_qdict(resp, "return"); - g_assert(qdict_haskey(qdict, "enabled")); - enabled = qdict_get_bool(qdict, "enabled"); - qobject_unref(resp); - - return enabled; -} - static QDict *do_query_no_props(QTestState *qts, const char *cpu_type) { return qtest_qmp(qts, QUERY_HEAD "'model': { 'name': %s }" @@ -506,14 +491,6 @@ static void test_query_cpu_model_expansion_kvm(const void *data) qts = qtest_init(MACHINE_KVM "-cpu max"); - /* - * These tests target the 'host' CPU type, so KVM must be enabled. - */ - if (!kvm_enabled(qts)) { - qtest_quit(qts); - return; - } - /* Enabling and disabling kvm-no-adjvtime should always work. */ assert_has_feature_disabled(qts, "host", "kvm-no-adjvtime"); assert_set_feature(qts, "host", "kvm-no-adjvtime", true); @@ -637,7 +614,11 @@ int main(int argc, char **argv) * order avoid attempting to run an AArch32 QEMU with KVM on * AArch64 hosts. That won't work and isn't easy to detect. */ - if (g_str_equal(qtest_get_arch(), "aarch64")) { + if (g_str_equal(qtest_get_arch(), "aarch64") && qtest_has_accel("kvm")) { + /* + * This tests target the 'host' CPU type, so register it only if + * KVM is available. + */ qtest_add_data_func("/arm/kvm/query-cpu-model-expansion", NULL, test_query_cpu_model_expansion_kvm); } From patchwork Wed Oct 20 10:19:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 081D9C433EF for ; Wed, 20 Oct 2021 10:31:27 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BB63E610FF for ; Wed, 20 Oct 2021 10:31:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BB63E610FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8sX-00011m-Sc for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:31:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hT-0003yl-Q0 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39348) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hR-00036s-TL for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:19:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725196; 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=/OOFXRgq8TSDvZxZeGhYdPtX8D2UWjeyH5vg2OkC7lM=; b=dPoGTY3CX2fztONgpESaw2B14OZ5LJ/zDiHOqkng/I9pbfIiDu0rmgjljsVEecYFPyjS1t c6wHRj5jkpZwskpyWoA80YNbgTcSPyepOhBrCmtRIp4vlJRWyS7BHArOyQrbqLH+L9a2fo Z41egscX/rOKtJ8GoPiJkU37foVR3ec= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-96-9TNictlzPhOIKGnODFHsog-1; Wed, 20 Oct 2021 06:19:55 -0400 X-MC-Unique: 9TNictlzPhOIKGnODFHsog-1 Received: by mail-ed1-f69.google.com with SMTP id e14-20020a056402088e00b003db6ebb9526so20453231edy.22 for ; Wed, 20 Oct 2021 03:19:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/OOFXRgq8TSDvZxZeGhYdPtX8D2UWjeyH5vg2OkC7lM=; b=BSHfI2y3YrwUlGkt125t5qVBSgB7sFAN5u4z/57JXImYw4R9oMkFqZzsL0nkS9c1Br 4e497N4Kix8C41QHsQYs7KhH8yfv3FEBLFmOwGkzgY9I95i/bOgdtrLkAzrsgkxkl3Y5 vvh3lITsO8nxqaZJ60erFJFCZ0wfAtCQLU1QTAck9w/XX6DKEbNBbhYASYO72bdmKj03 jK9gopHc/F7ETkgK94HeiWFi9uUCJJHDgHW45cPOEqqQ8c2eqTUDnh3TUFIz/7Kia91/ WnDGQUM7YYRCxkBWGUSfZQhRqPgjTefjtGqgUK4QLqx/19xwdbUfl42XgmKf+QY+w1bA Px5Q== X-Gm-Message-State: AOAM533Mcy7harr8PNjtdurNs2Esp7rLc2fd2sGIyKIyQGmsAd8Dhz4E 7dG7sdR60CUszlNo/1r1KkPHYcWYCRYzbKwK8AkYAnouq6DtCKSMjtsAsxqt1+3ZTkBi1aRw1Vt hn9KMunx+hkq9Ucc3PaUfaJgEEfBFbwhKS7Lv0ZkVOjSTN5GWkKKvWY2PQq/z X-Received: by 2002:a17:906:2c57:: with SMTP id f23mr44000076ejh.474.1634725193872; Wed, 20 Oct 2021 03:19:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+B62galMurEt709Mcn6JuGM5EUKW8ZQvyPWGkarctPqwyKylsKMjLg6K/yLQbQla7JyRc8g== X-Received: by 2002:a17:906:2c57:: with SMTP id f23mr44000026ejh.474.1634725193458; Wed, 20 Oct 2021 03:19:53 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id z4sm822737ejw.46.2021.10.20.03.19.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:53 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:50 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 14/44] tests: migration-test: use qtest_has_accel() API Message-ID: <20211020101844.988480-15-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Juan Quintela , "Dr. David Alan Gilbert" , Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov Signed-off-by: Igor Mammedov Suggested-by: Thomas Huth Message-Id: <20210902113551.461632-15-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/migration-test.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index cc5e83d98a..7b42f6fd90 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -1420,6 +1420,7 @@ static bool kvm_dirty_ring_supported(void) int main(int argc, char **argv) { char template[] = "/tmp/migration-test-XXXXXX"; + const bool has_kvm = qtest_has_accel("kvm"); int ret; g_test_init(&argc, &argv, NULL); @@ -1434,8 +1435,7 @@ int main(int argc, char **argv) * some reason) */ if (g_str_equal(qtest_get_arch(), "ppc64") && - (access("/sys/module/kvm_hv", F_OK) || - access("/dev/kvm", R_OK | W_OK))) { + (!has_kvm || access("/sys/module/kvm_hv", F_OK))) { g_test_message("Skipping test: kvm_hv not available"); return g_test_run(); } @@ -1444,16 +1444,9 @@ int main(int argc, char **argv) * Similar to ppc64, s390x seems to be touchy with TCG, so disable it * there until the problems are resolved */ - if (g_str_equal(qtest_get_arch(), "s390x")) { -#if defined(HOST_S390X) - if (access("/dev/kvm", R_OK | W_OK)) { - g_test_message("Skipping test: kvm not available"); - return g_test_run(); - } -#else - g_test_message("Skipping test: Need s390x host to work properly"); + if (g_str_equal(qtest_get_arch(), "s390x") && !has_kvm) { + g_test_message("Skipping test: s390x host with KVM is required"); return g_test_run(); -#endif } tmpfs = mkdtemp(template); From patchwork Wed Oct 20 10:19:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B727C433F5 for ; Wed, 20 Oct 2021 10:43:26 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90CAF610EA for ; Wed, 20 Oct 2021 10:43:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 90CAF610EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55718 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md948-0007v0-EE for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:43:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48204) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hV-00046K-Lf for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hT-00039B-Sw for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725199; 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=+l55gFO3MSoGNl8FmX8HypllSa9dmHDnz4W6+bwhZI4=; b=OthCx010L4LBa2V+lG5XPqxSuoF9idxaF2WyHsg2WLuy+9+PoSSm+jIKZvvKZwn2kiZAV2 2uaGCr+bPP0gFNCLZ4I9NRodOa+MpcD8/Gh1i2jekYI+qGL74OdStisQ9U4OFm45Hxq6U+ KYLYrHr2Ud7e1OgWU5M2EZTERWVWJTo= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-mUL5cKY8MM6CNfgmYXfAMw-1; Wed, 20 Oct 2021 06:19:58 -0400 X-MC-Unique: mUL5cKY8MM6CNfgmYXfAMw-1 Received: by mail-ed1-f70.google.com with SMTP id u23-20020a50a417000000b003db23c7e5e2so20548706edb.8 for ; Wed, 20 Oct 2021 03:19:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+l55gFO3MSoGNl8FmX8HypllSa9dmHDnz4W6+bwhZI4=; b=ZWPB4FxCE6TPdYv45QR9f3zNGnYNrtTbMWKeELRIy20CkaoR8xoh3j4isyZXWXHVkB MUx341c5ojCEK/feTrJCBaPClPJXQfTBzBWBlElA4tn2QqCC/PDj/D4WHn6v2ZanO6VP ryHG4tOSHnMBnHLsZnZnZ1vni5M8Eb8Y49/v1nNOQhKAdopb85f9A08fLSVwbTXgOB4A SdJXj0svsmPOBykj7/xlgpZNdjkJUxFZvVxoSK5RaFPUyQmHqOe5YEoudmI7bSYb0gTd l7bcyk1xZko39swkdcBTIUg3VA6hKZhqzgt1NFDLu0WX0gOqSdXi1UIP7zW79S19dsPf M/jA== X-Gm-Message-State: AOAM533viVxHQm8eq4Yt107YKcujQkmWSZ/AAvx7QBnqJ4xSFEdE4e21 88I9mlmcnyMPi4ba8trqW5Nb3dYFKvZaiSxrObISuiYt0Xo7ULArardw5XSUNhCLyebLTKT1ikU yTAsnheOLEeYNhOF8eRIgbDePfSn+lDdX0Le183OXv2vG+FWR8ONNFf0QCM11 X-Received: by 2002:a50:e0c3:: with SMTP id j3mr60891038edl.97.1634725196573; Wed, 20 Oct 2021 03:19:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTE+JjuSKXno5yI3FLNa2ZuyhYOgF1xhd7gV0embkulesqjtPXm+a66ER68hgbLRUq+XOUQg== X-Received: by 2002:a50:e0c3:: with SMTP id j3mr60891006edl.97.1634725196339; Wed, 20 Oct 2021 03:19:56 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id u16sm823409ejy.16.2021.10.20.03.19.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:55 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 15/44] tests: bios-tables-test: use qtest_has_accel() API to register TCG only tests Message-ID: <20211020101844.988480-16-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Igor Mammedov .. only if TCG is available Signed-off-by: Igor Mammedov Message-Id: <20210902113551.461632-16-imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 873eb9c037..6e21a650d2 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -722,13 +722,6 @@ static void test_acpi_one(const char *params, test_data *data) char *args; bool use_uefi = data->uefi_fl1 && data->uefi_fl2; -#ifndef CONFIG_TCG - if (data->tcg_only) { - g_test_skip("TCG disabled, skipping ACPI tcg_only test"); - return; - } -#endif /* CONFIG_TCG */ - args = test_acpi_create_args(data, params, use_uefi); data->qts = qtest_init(args); test_acpi_load_tables(data, use_uefi); @@ -1544,6 +1537,7 @@ int main(int argc, char *argv[]) { const char *arch = qtest_get_arch(); const bool has_kvm = qtest_has_accel("kvm"); + const bool has_tcg = qtest_has_accel("tcg"); int ret; g_test_init(&argc, &argv, NULL); @@ -1590,7 +1584,6 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/q35/smm-compat-nosmm", test_acpi_q35_tcg_smm_compat_nosmm); qtest_add_func("acpi/q35/nohpet", test_acpi_q35_tcg_nohpet); - qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs); qtest_add_func("acpi/piix4/dimmpxm", test_acpi_piix4_tcg_dimm_pxm); qtest_add_func("acpi/q35/dimmpxm", test_acpi_q35_tcg_dimm_pxm); qtest_add_func("acpi/piix4/acpihmat", test_acpi_piix4_tcg_acpi_hmat); @@ -1600,19 +1593,24 @@ int main(int argc, char *argv[]) qtest_add_func("acpi/microvm/rtc", test_acpi_microvm_rtc_tcg); qtest_add_func("acpi/microvm/ioapic2", test_acpi_microvm_ioapic2_tcg); qtest_add_func("acpi/microvm/oem-fields", test_acpi_oem_fields_microvm); - if (strcmp(arch, "x86_64") == 0) { - qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg); + if (has_tcg) { + qtest_add_func("acpi/q35/ivrs", test_acpi_q35_tcg_ivrs); + if (strcmp(arch, "x86_64") == 0) { + qtest_add_func("acpi/microvm/pcie", test_acpi_microvm_pcie_tcg); + } } if (has_kvm) { qtest_add_func("acpi/q35/kvm/xapic", test_acpi_q35_kvm_xapic); qtest_add_func("acpi/q35/kvm/dmar", test_acpi_q35_kvm_dmar); } } else if (strcmp(arch, "aarch64") == 0) { - qtest_add_func("acpi/virt", test_acpi_virt_tcg); - qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem); - qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); - qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); - qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); + if (has_tcg) { + qtest_add_func("acpi/virt", test_acpi_virt_tcg); + qtest_add_func("acpi/virt/numamem", test_acpi_virt_tcg_numamem); + qtest_add_func("acpi/virt/memhp", test_acpi_virt_tcg_memhp); + qtest_add_func("acpi/virt/pxb", test_acpi_virt_tcg_pxb); + qtest_add_func("acpi/virt/oem-fields", test_acpi_oem_fields_virt); + } } ret = g_test_run(); boot_sector_cleanup(disk); From patchwork Wed Oct 20 10:19:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34983C433EF for ; Wed, 20 Oct 2021 10:46:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BA671610EA for ; Wed, 20 Oct 2021 10:46:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BA671610EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:36068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md97U-0005P3-FM for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:46:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ha-0004Le-8z for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:58425) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hX-0003Bk-44 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725202; 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=2YfMqludtVxGe6ZQMypK2Vw2Q7PYFz1rFSXdv5+28mU=; b=ewT7L0B9K4xxtYrMTOvAonHXIM2IPwLHHdeWvBbv8Wi+ZO4hPgyxBLRUy3T8dqOTrKtZYN jm74EYxbVY0yXjxb0ABMgSmYl9QRFTwmYAB0fPuPddXxkt2ug0O4hrJCEqKrXZVVWWh1jA nzx2JlxFVFM57+7aq3y47OUHu0aj/sk= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-195-VRs5mt77PWmfM07TA2u3-A-1; Wed, 20 Oct 2021 06:20:01 -0400 X-MC-Unique: VRs5mt77PWmfM07TA2u3-A-1 Received: by mail-ed1-f72.google.com with SMTP id x5-20020a50f185000000b003db0f796903so20523856edl.18 for ; Wed, 20 Oct 2021 03:20:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=2YfMqludtVxGe6ZQMypK2Vw2Q7PYFz1rFSXdv5+28mU=; b=CJ8Fr+444SOnxea+DT3ZU0qSkRZ3YBToWpOb6JYXiq6kG3lskGqQ51OAPYHFTnX6gL meHeNhCs9bE7/9aPM4WsnQrXNfeA+vh4bX/AMu9qU2FJoGfyCSU+Oto/lNYT1wesJVTh EOH/e1Y+ehjUsUZMJum+aw2SjRgXw/79fzrEORaGoyty5yQY2zOwABTIhjgWyy16W0gi sC5lZ6yUcsOwRx63hjIdrYegdXf3iqDf7WTwabcY4at1uBt/lO/y6v8umUyzgDL7XSte 2FKyPvS2heBnOEAMutKUpgnzfz9mWM9W9Mr+JVw2HrNfss5E9eUGQytewtSgEgE55gwN c/yA== X-Gm-Message-State: AOAM532FsxPmNHzPdicy9cyVNrWI6U9KiKd0WPO1dYA1RNaYQdVKWaWX 1GhNu89vDd47Rktmff439w2M4avrCaTOX/xxoKZ4q+bX1nurgMa1GZTWCwVe11Q7M52Bf1301h/ 7ih3ZG1a2n+09p+OJIOqtxjLZ4uW2F4z382lz2thg37iiLONGzM8CTxFX7M/w X-Received: by 2002:a17:906:eb05:: with SMTP id mb5mr46378364ejb.88.1634725199424; Wed, 20 Oct 2021 03:19:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3Io84OnIvAOJ47jcYs3m93WjSsZ1JB4xY/ytCO/PAyWkw/3NRJucdmIVoS1Tzf9HFAaLnZw== X-Received: by 2002:a17:906:eb05:: with SMTP id mb5mr46378334ejb.88.1634725199192; Wed, 20 Oct 2021 03:19:59 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id ke24sm792999ejc.73.2021.10.20.03.19.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:19:58 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:56 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 16/44] vdpa: Skip protected ram IOMMU mappings Message-ID: <20211020101844.988480-17-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Stefano Garzarella , Eugenio =?utf-8?b?UMOpcmV6?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eugenio Pérez Following the logic of commit 56918a126ae ("memory: Add RAM_PROTECTED flag to skip IOMMU mappings") with VFIO, skip memory sections inaccessible via normal mechanisms, including DMA. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20211014141236.923287-2-eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella --- hw/virtio/vhost-vdpa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 47d7a5a23d..ea1aa71ad8 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -28,6 +28,7 @@ static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section) { return (!memory_region_is_ram(section->mr) && !memory_region_is_iommu(section->mr)) || + memory_region_is_protected(section->mr) || /* vhost-vDPA doesn't allow MMIO to be mapped */ memory_region_is_ram_device(section->mr) || /* From patchwork Wed Oct 20 10:19:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82784C433EF for ; Wed, 20 Oct 2021 10:35:16 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 18F1D61260 for ; Wed, 20 Oct 2021 10:35:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 18F1D61260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8wF-0006up-3E for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:35:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hb-0004NB-Qe for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:25323) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ha-0003E3-7i for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725205; 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=QiJ0iHIZ1ouAmADpp/YMcXYNacyY5H2Zjhw9Phv+fQ0=; b=D8GK+p2qvR0jnLnCcZnpDA5ApGHcnlpxP0vyVL1GZPXwrZAQAEg7x8PKBxHE97+XIQ1vw6 KLHzHY33+CXSwb5iKyVBwKJ+Gi53+gps/65FOi7l3rRsi4C5Op2KKq47s0MbTkKZdFgyVx 9XQ/hWRrbecLbJog9tVvblH/frGR7/4= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-1kR-ezE0N--TatzENKUUKA-1; Wed, 20 Oct 2021 06:20:04 -0400 X-MC-Unique: 1kR-ezE0N--TatzENKUUKA-1 Received: by mail-ed1-f70.google.com with SMTP id t18-20020a056402021200b003db9e6b0e57so20535284edv.10 for ; Wed, 20 Oct 2021 03:20:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=QiJ0iHIZ1ouAmADpp/YMcXYNacyY5H2Zjhw9Phv+fQ0=; b=KczwBhhi4Pa/hKcPxM4cqLh3iMzQE2Otxc3IN5hm7GZRuCGMcdnqoAaLvUYRsvP0ZI VU90rTuAX2ITG1KsaXBRAq+VfKunR6AXmzASVMfTDycObT6poYl365h4X0D4oSgrOro2 ekY6FWYV5WYV6UzmmCHs/nv0C2y3dnwBW7zpk7ljU6kFOD5u1XvqtSMoJQIkGTCcrAob 9TvzbKl/bazra54PsUGE36CRA0bot64u6eK/Xzq6WTV6RRsVJlyWM9gpkUVbyTZJMNWl +QEXaZ1F9p/BGjUk6LcR5w6gGzW7WqtUv5yaeOhiVUPrph+YXriguG8GBYdiEaVXuKqi 0bQw== X-Gm-Message-State: AOAM5314zv+Jg/bvCQ1G0fChPqNIawwGKDclBpp7e0lPxt4sJPoKxis4 0DP1MaQ2WpnrnmG7sD4u3zAf4CKKXmKNt0LFEHJ8NHW/rLSWrIGIVBvJmtkT4Y91nLmEXhPEc+L s4HzDv8sCNYg5WX585cDLSFEXWqEn36vkKfPLTzsg222YjsQJ8PDhBqAcEaqF X-Received: by 2002:a05:6402:1c94:: with SMTP id cy20mr61495767edb.144.1634725202930; Wed, 20 Oct 2021 03:20:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKpCrjtT++ML6oQXSfAq1NLBKAjhAt/Oe8FxM7FsLfcYarOzBRcEFDOCoHmpk2O3suYsWkaA== X-Received: by 2002:a05:6402:1c94:: with SMTP id cy20mr61495740edb.144.1634725202757; Wed, 20 Oct 2021 03:20:02 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id m3sm1016985edc.11.2021.10.20.03.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:02 -0700 (PDT) Date: Wed, 20 Oct 2021 06:19:59 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 17/44] vdpa: Add vhost_vdpa_section_end Message-ID: <20211020101844.988480-18-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Stefano Garzarella , Eugenio =?utf-8?b?UMOpcmV6?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eugenio Pérez Abstract this operation, that will be reused when validating the region against the iova range that the device supports. Signed-off-by: Eugenio Pérez Acked-by: Jason Wang Message-Id: <20211014141236.923287-3-eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella --- hw/virtio/vhost-vdpa.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index ea1aa71ad8..be7c63b4ba 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -24,6 +24,19 @@ #include "trace.h" #include "qemu-common.h" +/* + * Return one past the end of the end of section. Be careful with uint64_t + * conversions! + */ +static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section) +{ + Int128 llend = int128_make64(section->offset_within_address_space); + llend = int128_add(llend, section->size); + llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); + + return llend; +} + static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section) { return (!memory_region_is_ram(section->mr) && @@ -160,10 +173,7 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - llend = int128_make64(section->offset_within_address_space); - llend = int128_add(llend, section->size); - llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); - + llend = vhost_vdpa_section_end(section); if (int128_ge(int128_make64(iova), llend)) { return; } @@ -221,9 +231,7 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); - llend = int128_make64(section->offset_within_address_space); - llend = int128_add(llend, section->size); - llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); + llend = vhost_vdpa_section_end(section); trace_vhost_vdpa_listener_region_del(v, iova, int128_get64(llend)); From patchwork Wed Oct 20 10:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 399ADC433F5 for ; Wed, 20 Oct 2021 11:06:31 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0840613BD for ; Wed, 20 Oct 2021 11:06:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C0840613BD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9QR-0000GG-NJ for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:06:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hf-0004P6-3q for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39761) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hd-0003Ga-5m for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725208; 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=SNO/Ubc5qnNCiHvqjeTYPPDTin7dvOXmm+Ua7nTQFpU=; b=YW/CBlvH+7E9XSglxgI23Sd7bDQUJ+F+bC5PAwGewpgdPyN0QekXz9YbuRBD4T88fRAZPc udcjoDawEmG7rFtMCVV1Q1jv+vbrN0bTgRDMda0m8iULYKcqZX+ksMyhH6FYqKdFAOWT+B PooLMU98YF7uEIurDItx0xlM/hUeluo= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-TopGRAKKNDGmOdSc3clJPw-1; Wed, 20 Oct 2021 06:20:07 -0400 X-MC-Unique: TopGRAKKNDGmOdSc3clJPw-1 Received: by mail-ed1-f69.google.com with SMTP id u17-20020a50d511000000b003daa3828c13so20513299edi.12 for ; Wed, 20 Oct 2021 03:20:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=SNO/Ubc5qnNCiHvqjeTYPPDTin7dvOXmm+Ua7nTQFpU=; b=fbSVZds/xQ0Si1fCk2Ge85sVDPBN8n7UooSsodDlipSM+x9I1O5xeXt1dTCx12E5Sw MBJtnowEGzdMQcmIsfdmfAbqsRiHqgGPNOWIJCU38mvox9rLijvuiVpcTDrRtNI3Mt2E GM0Bq307nCeYfbT5XcEJPUwM0xDdXVdlbN3D/8nOP7PJTv/2w/GD9QSo/azPafIuQVtr S75Lnb+yhU/ueeMtnAK81Ix5cJX+OIftf4jCtYklqrzEOyadxOFvv9C0QnOR0zGREQ6E uaqhO+zkJdQH6LhlbLVkePIgvcxEaOA/mbNxHBhcQQF1FhqaOwmBPHBMmOn4ev/4JEjr zEvw== X-Gm-Message-State: AOAM532tEL5UvmMA2xxUJxcf9YO44ZbH9nBvTXk3Yvy76hdG9w26VvKx /0mpQ7qoC5Uj4er0d/7enrueXrHcdWixR5lHAb7kDUSrqzA05Lu1/8SxPTBR/HdNeGGDfTcnffD w6hdVUVV8gblOWvGachDqXGnm1weTip+nnKS/bKTFmTbDrwoHa7IqrbpM8idV X-Received: by 2002:a17:907:7d8b:: with SMTP id oz11mr43231223ejc.476.1634725205676; Wed, 20 Oct 2021 03:20:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe3H0vvA/Ktrb30Iaownbf2JEmsPT8/RiulFdYDmrxrdQjXpT+dGwRgiCoSRipUQzTkPaUQQ== X-Received: by 2002:a17:907:7d8b:: with SMTP id oz11mr43231196ejc.476.1634725205399; Wed, 20 Oct 2021 03:20:05 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id l10sm946875edk.30.2021.10.20.03.20.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:05 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:03 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 18/44] vdpa: Check for iova range at mappings changes Message-ID: <20211020101844.988480-19-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Stefano Garzarella , Eugenio =?utf-8?b?UMOpcmV6?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eugenio Pérez Check vdpa device range before updating memory regions so we don't add any outside of it, and report the invalid change if any. Signed-off-by: Eugenio Pérez Message-Id: <20211014141236.923287-4-eperezma@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Reviewed-by: Stefano Garzarella --- include/hw/virtio/vhost-vdpa.h | 2 ++ hw/virtio/vhost-vdpa.c | 62 ++++++++++++++++++++++++++-------- hw/virtio/trace-events | 1 + 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index a8963da2d9..c288cf7ecb 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -13,6 +13,7 @@ #define HW_VIRTIO_VHOST_VDPA_H #include "hw/virtio/virtio.h" +#include "standard-headers/linux/vhost_types.h" typedef struct VhostVDPAHostNotifier { MemoryRegion mr; @@ -24,6 +25,7 @@ typedef struct vhost_vdpa { uint32_t msg_type; bool iotlb_batch_begin_sent; MemoryListener listener; + struct vhost_vdpa_iova_range iova_range; struct vhost_dev *dev; VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX]; } VhostVDPA; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index be7c63b4ba..47c48f4ba8 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -37,20 +37,36 @@ static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section) return llend; } -static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section) +static bool vhost_vdpa_listener_skipped_section(MemoryRegionSection *section, + uint64_t iova_min, + uint64_t iova_max) { - return (!memory_region_is_ram(section->mr) && - !memory_region_is_iommu(section->mr)) || - memory_region_is_protected(section->mr) || - /* vhost-vDPA doesn't allow MMIO to be mapped */ - memory_region_is_ram_device(section->mr) || - /* - * Sizing an enabled 64-bit BAR can cause spurious mappings to - * addresses in the upper part of the 64-bit address space. These - * are never accessed by the CPU and beyond the address width of - * some IOMMU hardware. TODO: VDPA should tell us the IOMMU width. - */ - section->offset_within_address_space & (1ULL << 63); + Int128 llend; + + if ((!memory_region_is_ram(section->mr) && + !memory_region_is_iommu(section->mr)) || + memory_region_is_protected(section->mr) || + /* vhost-vDPA doesn't allow MMIO to be mapped */ + memory_region_is_ram_device(section->mr)) { + return true; + } + + if (section->offset_within_address_space < iova_min) { + error_report("RAM section out of device range (min=0x%" PRIx64 + ", addr=0x%" HWADDR_PRIx ")", + iova_min, section->offset_within_address_space); + return true; + } + + llend = vhost_vdpa_section_end(section); + if (int128_gt(llend, int128_make64(iova_max))) { + error_report("RAM section out of device range (max=0x%" PRIx64 + ", end addr=0x%" PRIx64 ")", + iova_max, int128_get64(llend)); + return true; + } + + return false; } static int vhost_vdpa_dma_map(struct vhost_vdpa *v, hwaddr iova, hwaddr size, @@ -162,7 +178,8 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener, void *vaddr; int ret; - if (vhost_vdpa_listener_skipped_section(section)) { + if (vhost_vdpa_listener_skipped_section(section, v->iova_range.first, + v->iova_range.last)) { return; } @@ -220,7 +237,8 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener, Int128 llend, llsize; int ret; - if (vhost_vdpa_listener_skipped_section(section)) { + if (vhost_vdpa_listener_skipped_section(section, v->iova_range.first, + v->iova_range.last)) { return; } @@ -288,6 +306,19 @@ static void vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status) vhost_vdpa_call(dev, VHOST_VDPA_SET_STATUS, &s); } +static void vhost_vdpa_get_iova_range(struct vhost_vdpa *v) +{ + int ret = vhost_vdpa_call(v->dev, VHOST_VDPA_GET_IOVA_RANGE, + &v->iova_range); + if (ret != 0) { + v->iova_range.first = 0; + v->iova_range.last = UINT64_MAX; + } + + trace_vhost_vdpa_get_iova_range(v->dev, v->iova_range.first, + v->iova_range.last); +} + static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) { struct vhost_vdpa *v; @@ -300,6 +331,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) v->listener = vhost_vdpa_memory_listener; v->msg_type = VHOST_IOTLB_MSG_V2; + vhost_vdpa_get_iova_range(v); vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER); diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 8ed19e9d0c..650e521e35 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -52,6 +52,7 @@ vhost_vdpa_set_vring_call(void *dev, unsigned int index, int fd) "dev: %p index: vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRIx64 vhost_vdpa_set_owner(void *dev) "dev: %p" vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64 +vhost_vdpa_get_iova_range(void *dev, uint64_t first, uint64_t last) "dev: %p first: 0x%"PRIx64" last: 0x%"PRIx64 # virtio.c virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u" From patchwork Wed Oct 20 10:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572063 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B04C433EF for ; Wed, 20 Oct 2021 10:51:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75ABB60F22 for ; Wed, 20 Oct 2021 10:51:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 75ABB60F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49332 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9BU-0005l9-De for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hi-0004Pg-DK for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hg-0003Jc-TD for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725212; 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=A7I3owIbz1hLTkvG+O1oeRq8T2bvra3NbCuqdt9S6fE=; b=N3RMdzZ60ZjWYgoEfvaPpVGjYhQ61im38ZHrN3nh7JPxNYjK+XUsAmVZAaqxk+wkWarnND fRYAI6JijXNp1vMD4ZYx5yWHEGgXh5w/f9zhptsDhrl1xLoUZNs/qECv9t++u+QDabGLJ+ qy2H4tBzcJwmCuKUd9NXDWhYvj3cE+s= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-588--FVG5KQ9OLSXY5FkGgjKHg-1; Wed, 20 Oct 2021 06:20:10 -0400 X-MC-Unique: -FVG5KQ9OLSXY5FkGgjKHg-1 Received: by mail-ed1-f72.google.com with SMTP id f4-20020a50e084000000b003db585bc274so20480302edl.17 for ; Wed, 20 Oct 2021 03:20:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=A7I3owIbz1hLTkvG+O1oeRq8T2bvra3NbCuqdt9S6fE=; b=w9GLSYDz0FJE1/myAhQIXe4453a7d0or40VMg7t4OY1MsO+MSDyjnruSQl8cfF3PIK 7B2a9Ula30M694btRG47b9g5o1wwynXzjYZ8uG7H4Hc94ENYfRICSyvdfixJxFd67n+n srCVeJToQu7DIiel7kzTra56X2n59ukJeq2KrU+CNxd4A1xq5nYp+4MFKfvctAxuT1/J CaA8WbiRWmh5ddsLVFc8NrOwKXmDu3tqBhyQVYQn4+tSavQaUCrB5cKlr4r3sK4dL6lz Ww5FYP6r4VhWl7u0LsObe7Y0Y3+WKV0PaqCHTI01Yamz664zpFipxCfDFWc5a4hywqlM ESJw== X-Gm-Message-State: AOAM531rQVcwfLAs1KkCVRULJGCWgCQNUNOB94sg8EmrFhgZf0E1gRRY BdOf9+zZ5wnnB8idN7CId7NCrZFvf8d6ai46WdzedD8vALY+Y3DTECvIIoP+D1ptn09vsL242ap Qy3BRn8Z9eRW0NVetNJbFH3E/TPCszOCfh1BsO+VhMDjtlJEDWqKTvpip9hNa X-Received: by 2002:a05:6402:42ce:: with SMTP id i14mr62789764edc.5.1634725208514; Wed, 20 Oct 2021 03:20:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCIuvA6l8ORedk+zYheKbUkSIKpydsNNa+TWQmTgDqcmwYjt3uWGjecU8BxI0JiuaDbUdKlw== X-Received: by 2002:a05:6402:42ce:: with SMTP id i14mr62789743edc.5.1634725208328; Wed, 20 Oct 2021 03:20:08 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id b7sm857374ejl.10.2021.10.20.03.20.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:07 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:05 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 19/44] virtio-iommu: Remove the non transitional name Message-ID: <20211020101844.988480-20-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jean-Philippe Brucker , Cornelia Huck , Andrea Bolognani , Eric Auger Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger Remove the non transitional name for virtio iommu. Like other devices introduced after 1.0 spec, the virtio-iommu does not need it. Signed-off-by: Eric Auger Reported-by: Andrea Bolognani Reviewed-by: Cornelia Huck Message-Id: <20211013191755.767468-2-eric.auger@redhat.com> Reviewed-by: Jean-Philippe Brucker Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-iommu-pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 770c286be7..86fa4e6c28 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -100,7 +100,6 @@ static void virtio_iommu_pci_instance_init(Object *obj) static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .base_name = TYPE_VIRTIO_IOMMU_PCI, .generic_name = "virtio-iommu-pci", - .non_transitional_name = "virtio-iommu-pci-non-transitional", .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init, .class_init = virtio_iommu_pci_class_init, From patchwork Wed Oct 20 10:20:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4281DC433F5 for ; Wed, 20 Oct 2021 11:09:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C5F2D6138F for ; Wed, 20 Oct 2021 11:09:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C5F2D6138F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:57192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9Te-0006Rl-Oo for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:09:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hk-0004Q1-KO for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:19 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hj-0003LQ-0K for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725214; 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=2oaB/YSoqgr6XdYYhUq9BpuWK0l58b7kZ1rtp8COlWY=; b=CtIkSWXzB887vCTPaa1rLQVI7ljIPIpZ0EngYIHEhAgy9Nr7sRp2o70rEqwSaHvXa4mCCm aRoDbW+xihwef82Q/nvbtknJaL+WfayiN95ej1pYjoIddtaG/DJPcz49q55G5dR9TtDD+6 XDow+ieYEH0eTXqXLQYO7VJ2ugJ41sw= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-Ic5BVvxCPryaNCe5EF-rJQ-1; Wed, 20 Oct 2021 06:20:13 -0400 X-MC-Unique: Ic5BVvxCPryaNCe5EF-rJQ-1 Received: by mail-ed1-f70.google.com with SMTP id l10-20020a056402230a00b003db6977b694so20505290eda.23 for ; Wed, 20 Oct 2021 03:20:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=2oaB/YSoqgr6XdYYhUq9BpuWK0l58b7kZ1rtp8COlWY=; b=xLRWSP/YyoeD0I71wZr6zdqhQieumBw4L6HbRlhBEDcaoUuy6tCXyGHbkwgJgUHXgn Pfc35qEdiBV6/2GXQOubWnra0QYQPdot6UZ4cZmEL/DSRfuDIYML2Uwvd8OmxkGNi2wu gNzPlEoJgZM+xsRQa1JKHYo+J0PQMiAphh1jdkVyMHlRYo0Xg4f53MgYiJXRM5K/jeeT UFjmZwnhLZFJZ98+N3YU6IIzbpdmDfy1rzDJisTeLcGXgu1YBnUhvk/szVaxBhkA2muQ IHI1feh2mMPLgKsGkCul/ovxYTM4xz3FQxby2UahFBoIQh1xrESMpDkCAGhiCNtM0L3J yLNQ== X-Gm-Message-State: AOAM532J6C7AHbgua7Rm7V/SiRnYPJLeJfN3Ft9gj/uvcfwQbyIvz1mY Nbi0Kpn99wLUvLtOTJv6Qyy93WBzRWziQfjfdptG6aXWz9qm0VheIPW5sj2mln22RhQky3mD5qe TDe2fvGdsZnbF89UUSpiBwCeo6KpVfnfKDcnxhPzLPOw7qDjj4xe8z6vy1RX5 X-Received: by 2002:a17:906:4e4a:: with SMTP id g10mr43717894ejw.524.1634725211504; Wed, 20 Oct 2021 03:20:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVihFRFyLGt/T+IJCK/gCpPjwxd9b3VLjMHsGiemR8cXoIjExv7u8fChzYEy5o/nwX9d/1JA== X-Received: by 2002:a17:906:4e4a:: with SMTP id g10mr43717876ejw.524.1634725211336; Wed, 20 Oct 2021 03:20:11 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id m6sm836459ejl.42.2021.10.20.03.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:10 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:08 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 20/44] virtio-iommu: Drop base_name and change generic_name Message-ID: <20211020101844.988480-21-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jean-Philippe Brucker , Cornelia Huck , Eric Auger Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Eric Auger Drop base_name and turn generic_name into "virtio-iommu-pci". This is more in line with other modern-only devices. Signed-off-by: Eric Auger Suggested-by: Cornelia Huck Reviewed-by: Cornelia Huck Message-Id: <20211013191755.767468-3-eric.auger@redhat.com> Reviewed-by: Jean-Philippe Brucker Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-iommu.h | 2 +- hw/virtio/virtio-iommu-pci.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h index 273e35c04b..e2339e5b72 100644 --- a/include/hw/virtio/virtio-iommu.h +++ b/include/hw/virtio/virtio-iommu.h @@ -26,7 +26,7 @@ #include "qom/object.h" #define TYPE_VIRTIO_IOMMU "virtio-iommu-device" -#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base" +#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-pci" OBJECT_DECLARE_SIMPLE_TYPE(VirtIOIOMMU, VIRTIO_IOMMU) #define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region" diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 86fa4e6c28..a160ae6b41 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -98,8 +98,7 @@ static void virtio_iommu_pci_instance_init(Object *obj) } static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { - .base_name = TYPE_VIRTIO_IOMMU_PCI, - .generic_name = "virtio-iommu-pci", + .generic_name = TYPE_VIRTIO_IOMMU_PCI, .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init, .class_init = virtio_iommu_pci_class_init, From patchwork Wed Oct 20 10:20:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF24BC433EF for ; Wed, 20 Oct 2021 11:12:50 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A7BA760E76 for ; Wed, 20 Oct 2021 11:12:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A7BA760E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:36318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9Wb-0003MN-QJ for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:12:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hp-0004RE-2h for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23447) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hn-0003On-Ev for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725218; 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=ZvsHGqUvEzawW0OH5Cw6jRuRtAArFcbkyalTetDkgLs=; b=Y/Eq+RNPzmrwnosGSrFEUXn0xw9mf1WBHYp1NS/8IGpDTRVJozdQDPvY9n7U9Oaw7p1a8E OtbzPdhiywJhl5gqf5yPcrZQH2lccA73ZZpYVBjPqag2SGV9D/VhmNikACGlOP6IVKT6dB 4M/aJdlPxlthvvaTz5HEC3B/UzwXQgQ= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-377-ncuMOGNINNeiliGN5Osf5w-1; Wed, 20 Oct 2021 06:20:17 -0400 X-MC-Unique: ncuMOGNINNeiliGN5Osf5w-1 Received: by mail-ed1-f71.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20618627edv.9 for ; Wed, 20 Oct 2021 03:20:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ZvsHGqUvEzawW0OH5Cw6jRuRtAArFcbkyalTetDkgLs=; b=Sx87zVXcR+hPqje1OwBhBWAHTkCxsvuHWs2HZL4PXOl+KNxAEgi4jwv6FAf+LWwRzv Q9wHYIT//7F2m8MwIP01IO36swrssoHyOKW9M/Sh8pCXzvuNEtxkgczoa8bRefX5LXjK w/YSlY0lysnNSx5Xrxst116SlV5SQh2m8idLSPyY+SghkGEt+7FYE5vY4ycZl2w0Wj5x Gv2bdCob+27rtwf5baLuFR9xvQH3nri4gdBTVWKzde4cBQr+CzYGCSm+f5LRoJlqd6h0 xGCK/0VZvZB3lzS2SAGSDJOLnKJK+KnHzJMDza880RoRhegicg715iekQ/BxggZ3qT/L dqQg== X-Gm-Message-State: AOAM531v+p3LqTXpG8HSnFn+r0OefHNlYK7ja1ua5cWFFEf2f0IxaiRO XPaytLYpDe8EB8fxiGEVe76n91qj+DZVjdRQHYdt/gF7wA0L4uQbzATcWk5Hp8TXFKun2CEFlAR k0CBcbSQgnO4oPWg6pRac6Is2j8ZxqN/YGwA3lrOMAxxTxDmjf3rp5cjpAp0i X-Received: by 2002:a05:6402:2682:: with SMTP id w2mr61456731edd.185.1634725214966; Wed, 20 Oct 2021 03:20:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQy583AmKX2slw7zHi91/whr0PCck3FwQyvGpPBuu3KeIiOdzWNjHCsbyWe2JlaEFhI22nDg== X-Received: by 2002:a05:6402:2682:: with SMTP id w2mr61456686edd.185.1634725214719; Wed, 20 Oct 2021 03:20:14 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id e22sm997194edu.35.2021.10.20.03.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:14 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:11 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 21/44] libvhost-user: fix VHOST_USER_REM_MEM_REG skipping mmap_addr Message-ID: <20211020101844.988480-22-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , David Hildenbrand , qemu-stable@nongnu.org, Coiby Xu , Raphael Norwitz , Stefan Hajnoczi , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: David Hildenbrand We end up not copying the mmap_addr of all existing regions, resulting in a SEGFAULT once we actually try to map/access anything within our memory regions. Fixes: 875b9fd97b34 ("Support individual region unmap in libvhost-user") Cc: qemu-stable@nongnu.org Cc: Michael S. Tsirkin Cc: Raphael Norwitz Cc: "Marc-André Lureau" Cc: Stefan Hajnoczi Cc: Paolo Bonzini Cc: Coiby Xu Signed-off-by: David Hildenbrand Message-Id: <20211011201047.62587-1-david@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Raphael Norwitz Reviewed-by: Stefan Hajnoczi --- subprojects/libvhost-user/libvhost-user.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/libvhost-user/libvhost-user.c b/subprojects/libvhost-user/libvhost-user.c index bf09693255..787f4d2d4f 100644 --- a/subprojects/libvhost-user/libvhost-user.c +++ b/subprojects/libvhost-user/libvhost-user.c @@ -816,6 +816,7 @@ vu_rem_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { shadow_regions[j].gpa = dev->regions[i].gpa; shadow_regions[j].size = dev->regions[i].size; shadow_regions[j].qva = dev->regions[i].qva; + shadow_regions[j].mmap_addr = dev->regions[i].mmap_addr; shadow_regions[j].mmap_offset = dev->regions[i].mmap_offset; j++; } else { From patchwork Wed Oct 20 10:20:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572093 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9439C433EF for ; Wed, 20 Oct 2021 11:00:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 60D7B611B0 for ; Wed, 20 Oct 2021 11:00:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 60D7B611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38988 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9L5-0001YC-B0 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:00:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48432) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i6-0004nS-82 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:48795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hu-0003VO-Bw for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725225; 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=EpF7at57/5nWwGoTd9m+XJz9rpHOa+ik4ru0SH8rVvg=; b=ghwidI8bqrBoonYYBhUPyk5gP695SqzxOGItUrKtwpodEQF+f1qJ1ijvDl26vdxJljaPVp 8RIMG/TdsbvJ7QEpCwYyvWv65gkFJqEI/5iux9TofPGsIgYMgx2qub/jkSqIsvhlP07m2y CoG7TBxIvKTH154GF41iq+XEb4E/baI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-251-997ixgnYPY-Fxo3Jco6Gqg-1; Wed, 20 Oct 2021 06:20:19 -0400 X-MC-Unique: 997ixgnYPY-Fxo3Jco6Gqg-1 Received: by mail-ed1-f70.google.com with SMTP id e14-20020a056402088e00b003db6ebb9526so20454381edy.22 for ; Wed, 20 Oct 2021 03:20:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=EpF7at57/5nWwGoTd9m+XJz9rpHOa+ik4ru0SH8rVvg=; b=5Q1uePDAgjVhFNSmUA2+2YLNSCZoH5CfLN8nCa+KtIY5akb7e4b7/r8gfPtR2+mDvA p7q16yisMf3TTCNcYeYNeUCn6lRmGMGixLE3IsstrQdCPpxGRIKBysvhK8Z3LM20a6DI QcXOWZzr//Yw8odxIPngq5x4tKqPXlD/PHD8dljVPqNUu1L4OfXclf6S/GFdL9gmCY/x 9oE6tAdKTn0L065qdGYQa6gVIofrwKRLe5IvSMcIgeE9plCUaw16RdSsquoDRsp0L5Tr eYw/fJ9aptqDscnf4gWhVskWfOFktyMZuKkA0brSXNY6btrP4SDf/op+0Alc92xrh8Xf yxjg== X-Gm-Message-State: AOAM531eeJcJaDDMx0ma50xaW3BfFxXcwKaXiv2yPGy4HJsgYaeI+i66 dG5rEGervy57y7D/fR670z9+I0BIqt8DTLci754X4fzzPng7H3I24i0VwBj2EBQiCspAmk7bWoh 3vy4t/n6Z0UqDvl2eR5gP8sggFnSmM64ZBnM/nxmVx9IU7p960oF2DO6hBT7t X-Received: by 2002:a17:907:e88:: with SMTP id ho8mr10290179ejc.359.1634725217869; Wed, 20 Oct 2021 03:20:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzgNKEjNYHwz07XHE8OIG2yg41D3IEzSyvvUO+f3J+nbaycPhOaUoipjuPTi3xZC8U/zx42Q== X-Received: by 2002:a17:907:e88:: with SMTP id ho8mr10290142ejc.359.1634725217568; Wed, 20 Oct 2021 03:20:17 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id f22sm948933edu.26.2021.10.20.03.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:17 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:15 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 22/44] vhost-user-rng: Add vhost-user-rng implementation Message-ID: <20211020101844.988480-23-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Mathieu Poirier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mathieu Poirier Introduce a random number generator (RNG) backend that communicates with a vhost-user server to retrieve entropy. That way other VMM that comply with the vhost user protocl can use the same vhost-user daemon without having to write yet another RNG driver. Reviewed-by: Alex Bennée Signed-off-by: Mathieu Poirier Message-Id: <20211012205904.4106769-2-mathieu.poirier@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-user-rng.h | 33 ++++ hw/virtio/vhost-user-rng.c | 289 +++++++++++++++++++++++++++++ hw/virtio/Kconfig | 5 + hw/virtio/meson.build | 1 + 4 files changed, 328 insertions(+) create mode 100644 include/hw/virtio/vhost-user-rng.h create mode 100644 hw/virtio/vhost-user-rng.c diff --git a/include/hw/virtio/vhost-user-rng.h b/include/hw/virtio/vhost-user-rng.h new file mode 100644 index 0000000000..071539996d --- /dev/null +++ b/include/hw/virtio/vhost-user-rng.h @@ -0,0 +1,33 @@ +/* + * Vhost-user RNG virtio device + * + * Copyright (c) 2021 Mathieu Poirier + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef _QEMU_VHOST_USER_RNG_H +#define _QEMU_VHOST_USER_RNG_H + +#include "hw/virtio/virtio.h" +#include "hw/virtio/vhost.h" +#include "hw/virtio/vhost-user.h" +#include "chardev/char-fe.h" + +#define TYPE_VHOST_USER_RNG "vhost-user-rng" +OBJECT_DECLARE_SIMPLE_TYPE(VHostUserRNG, VHOST_USER_RNG) + +struct VHostUserRNG { + /*< private >*/ + VirtIODevice parent; + CharBackend chardev; + struct vhost_virtqueue *vhost_vq; + struct vhost_dev vhost_dev; + VhostUserState vhost_user; + VirtQueue *req_vq; + bool connected; + + /*< public >*/ +}; + +#endif /* _QEMU_VHOST_USER_RNG_H */ diff --git a/hw/virtio/vhost-user-rng.c b/hw/virtio/vhost-user-rng.c new file mode 100644 index 0000000000..209ee5bf9a --- /dev/null +++ b/hw/virtio/vhost-user-rng.c @@ -0,0 +1,289 @@ +/* + * Vhost-user RNG virtio device + * + * Copyright (c) 2021 Mathieu Poirier + * + * Implementation seriously tailored on vhost-user-i2c.c + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/virtio-bus.h" +#include "hw/virtio/vhost-user-rng.h" +#include "qemu/error-report.h" +#include "standard-headers/linux/virtio_ids.h" + +static void vu_rng_start(VirtIODevice *vdev) +{ + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); + int ret; + int i; + + if (!k->set_guest_notifiers) { + error_report("binding does not support guest notifiers"); + return; + } + + ret = vhost_dev_enable_notifiers(&rng->vhost_dev, vdev); + if (ret < 0) { + error_report("Error enabling host notifiers: %d", -ret); + return; + } + + ret = k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, true); + if (ret < 0) { + error_report("Error binding guest notifier: %d", -ret); + goto err_host_notifiers; + } + + rng->vhost_dev.acked_features = vdev->guest_features; + ret = vhost_dev_start(&rng->vhost_dev, vdev); + if (ret < 0) { + error_report("Error starting vhost-user-rng: %d", -ret); + goto err_guest_notifiers; + } + + /* + * guest_notifier_mask/pending not used yet, so just unmask + * everything here. virtio-pci will do the right thing by + * enabling/disabling irqfd. + */ + for (i = 0; i < rng->vhost_dev.nvqs; i++) { + vhost_virtqueue_mask(&rng->vhost_dev, vdev, i, false); + } + + return; + +err_guest_notifiers: + k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, false); +err_host_notifiers: + vhost_dev_disable_notifiers(&rng->vhost_dev, vdev); +} + +static void vu_rng_stop(VirtIODevice *vdev) +{ + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); + VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus); + int ret; + + if (!k->set_guest_notifiers) { + return; + } + + vhost_dev_stop(&rng->vhost_dev, vdev); + + ret = k->set_guest_notifiers(qbus->parent, rng->vhost_dev.nvqs, false); + if (ret < 0) { + error_report("vhost guest notifier cleanup failed: %d", ret); + return; + } + + vhost_dev_disable_notifiers(&rng->vhost_dev, vdev); +} + +static void vu_rng_set_status(VirtIODevice *vdev, uint8_t status) +{ + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK; + + if (!vdev->vm_running) { + should_start = false; + } + + if (rng->vhost_dev.started == should_start) { + return; + } + + if (should_start) { + vu_rng_start(vdev); + } else { + vu_rng_stop(vdev); + } +} + +static uint64_t vu_rng_get_features(VirtIODevice *vdev, + uint64_t requested_features, Error **errp) +{ + /* No feature bits used yet */ + return requested_features; +} + +static void vu_rng_handle_output(VirtIODevice *vdev, VirtQueue *vq) +{ + /* + * Not normally called; it's the daemon that handles the queue; + * however virtio's cleanup path can call this. + */ +} + +static void vu_rng_guest_notifier_mask(VirtIODevice *vdev, int idx, bool mask) +{ + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + + vhost_virtqueue_mask(&rng->vhost_dev, vdev, idx, mask); +} + +static bool vu_rng_guest_notifier_pending(VirtIODevice *vdev, int idx) +{ + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + + return vhost_virtqueue_pending(&rng->vhost_dev, idx); +} + +static void vu_rng_connect(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + + if (rng->connected) { + return; + } + + rng->connected = true; + + /* restore vhost state */ + if (virtio_device_started(vdev, vdev->status)) { + vu_rng_start(vdev); + } +} + +static void vu_rng_disconnect(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserRNG *rng = VHOST_USER_RNG(vdev); + + if (!rng->connected) { + return; + } + + rng->connected = false; + + if (rng->vhost_dev.started) { + vu_rng_stop(vdev); + } +} + +static void vu_rng_event(void *opaque, QEMUChrEvent event) +{ + DeviceState *dev = opaque; + + switch (event) { + case CHR_EVENT_OPENED: + vu_rng_connect(dev); + break; + case CHR_EVENT_CLOSED: + vu_rng_disconnect(dev); + break; + case CHR_EVENT_BREAK: + case CHR_EVENT_MUX_IN: + case CHR_EVENT_MUX_OUT: + /* Ignore */ + break; + } +} + +static void vu_rng_device_realize(DeviceState *dev, Error **errp) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserRNG *rng = VHOST_USER_RNG(dev); + int ret; + + if (!rng->chardev.chr) { + error_setg(errp, "missing chardev"); + return; + } + + if (!vhost_user_init(&rng->vhost_user, &rng->chardev, errp)) { + return; + } + + virtio_init(vdev, "vhost-user-rng", VIRTIO_ID_RNG, 0); + + rng->req_vq = virtio_add_queue(vdev, 4, vu_rng_handle_output); + if (!rng->req_vq) { + error_setg_errno(errp, -1, "virtio_add_queue() failed"); + goto virtio_add_queue_failed; + } + + rng->vhost_dev.nvqs = 1; + rng->vhost_dev.vqs = g_new0(struct vhost_virtqueue, rng->vhost_dev.nvqs); + ret = vhost_dev_init(&rng->vhost_dev, &rng->vhost_user, + VHOST_BACKEND_TYPE_USER, 0, errp); + if (ret < 0) { + error_setg_errno(errp, -ret, "vhost_dev_init() failed"); + goto vhost_dev_init_failed; + } + + qemu_chr_fe_set_handlers(&rng->chardev, NULL, NULL, vu_rng_event, NULL, + dev, NULL, true); + + return; + +vhost_dev_init_failed: + virtio_delete_queue(rng->req_vq); +virtio_add_queue_failed: + virtio_cleanup(vdev); + vhost_user_cleanup(&rng->vhost_user); +} + +static void vu_rng_device_unrealize(DeviceState *dev) +{ + VirtIODevice *vdev = VIRTIO_DEVICE(dev); + VHostUserRNG *rng = VHOST_USER_RNG(dev); + + vu_rng_set_status(vdev, 0); + + vhost_dev_cleanup(&rng->vhost_dev); + g_free(rng->vhost_dev.vqs); + rng->vhost_dev.vqs = NULL; + virtio_delete_queue(rng->req_vq); + virtio_cleanup(vdev); + vhost_user_cleanup(&rng->vhost_user); +} + +static const VMStateDescription vu_rng_vmstate = { + .name = "vhost-user-rng", + .unmigratable = 1, +}; + +static Property vu_rng_properties[] = { + DEFINE_PROP_CHR("chardev", VHostUserRNG, chardev), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vu_rng_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass); + + device_class_set_props(dc, vu_rng_properties); + dc->vmsd = &vu_rng_vmstate; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + + vdc->realize = vu_rng_device_realize; + vdc->unrealize = vu_rng_device_unrealize; + vdc->get_features = vu_rng_get_features; + vdc->set_status = vu_rng_set_status; + vdc->guest_notifier_mask = vu_rng_guest_notifier_mask; + vdc->guest_notifier_pending = vu_rng_guest_notifier_pending; +} + +static const TypeInfo vu_rng_info = { + .name = TYPE_VHOST_USER_RNG, + .parent = TYPE_VIRTIO_DEVICE, + .instance_size = sizeof(VHostUserRNG), + .class_init = vu_rng_class_init, +}; + +static void vu_rng_register_types(void) +{ + type_register_static(&vu_rng_info); +} + +type_init(vu_rng_register_types) diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig index 35ab45e209..c144d42f9b 100644 --- a/hw/virtio/Kconfig +++ b/hw/virtio/Kconfig @@ -63,3 +63,8 @@ config VHOST_USER_I2C bool default y depends on VIRTIO && VHOST_USER + +config VHOST_USER_RNG + bool + default y + depends on VIRTIO && VHOST_USER diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index bc352a6009..ae6b2cde10 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -27,6 +27,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c')) virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_true: files('vhost-user-i2c-pci.c')) +virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) virtio_pci_ss = ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c')) From patchwork Wed Oct 20 10:20:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572061 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BFAEC433F5 for ; Wed, 20 Oct 2021 10:49:05 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3027F60F22 for ; Wed, 20 Oct 2021 10:49:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3027F60F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md99c-0002ln-8u for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:49:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ht-0004TC-Ih for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49613) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hr-0003Sv-Mr for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725223; 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=jYEn3VZIxvZ4Dxo5UlkZgMWK5p2ofZWjA/KPLo/RDe4=; b=Y7JvgTubUZlnqNhLspX2xTzgWIcPOEztlxo0oONgSQyToP+k1R1GokEGTrJDMBISFo6Ldo VBlaz0aVN52DmbsoenA40N5qb3dW/tUY44M1RxiLB+QVerG6gScknN0NXURAfwJxRbFjXH SuSYJ/evFzIznAb+OW13I/0T7yey/BU= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-540-1_EMN9N1MxSigoTpv_HveQ-1; Wed, 20 Oct 2021 06:20:21 -0400 X-MC-Unique: 1_EMN9N1MxSigoTpv_HveQ-1 Received: by mail-ed1-f69.google.com with SMTP id r25-20020a05640216d900b003dca3501ab4so4076734edx.15 for ; Wed, 20 Oct 2021 03:20:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=jYEn3VZIxvZ4Dxo5UlkZgMWK5p2ofZWjA/KPLo/RDe4=; b=8QGUkDXf5pTl3cBktLYvQn+lO5zZ4daZ+8cphAPHUjBVtH8ZY+19FFbYCMY1/qIX/f PYb2zRQQ9mjlYEZUjq5MWqV1DAJg15ITesNKLx+OwNd62iaQ0vKW05jOi9CA1nlwG3Z2 obH89m7LXkiz5Di9+Y9QBxH+6+1frtRzZumjVfHI3r+jHubEQz21TjQHoEsuPj8X84PG aHY7KDOyg/a5+wSygQPRgzdEGdT4PHgmzw0I0gOhFwqdMZGd9vs8cwFc2RLNR+HL5jfW YRbIFiPsP5ZKn0iT22DAkQfpC5MQr2+KzygtrTrCFvSALRbFUbXEkTDeGO4IcE4CThEG 5KLg== X-Gm-Message-State: AOAM530R+G1LrVEokAHS7VAemIjdezwKNQMHLaPspFvp1UTvPUt/vISa n+0DkKZrR1B1BlOn9XJL1M3ZfIrDv7OcCzhkVQ0vkVGnvxwRD5h4G4pqY8zkBVtQ3Ol6tgX19RC 6D1f4tQ8/nbcp/ah3ri+vcQFaBCFAL78fvHJQGLw6sH1tLXaNNXp+UHJn6dBb X-Received: by 2002:a05:6402:3509:: with SMTP id b9mr60813697edd.187.1634725220375; Wed, 20 Oct 2021 03:20:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwObBB94UsPTaD0oYjPUbshve/3p0dsa5jv4zPSx+uecUmI0Ceka5k4Ns06ihgQVVv033Q0PQ== X-Received: by 2002:a05:6402:3509:: with SMTP id b9mr60813667edd.187.1634725220155; Wed, 20 Oct 2021 03:20:20 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id w1sm415196edd.17.2021.10.20.03.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:19 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:17 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 23/44] vhost-user-rng-pci: Add vhost-user-rng-pci implementation Message-ID: <20211020101844.988480-24-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Mathieu Poirier Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mathieu Poirier This patch provides a PCI bus interface to the vhost-user-rng backend. Reviewed-by: Alex Bennée Signed-off-by: Mathieu Poirier Message-Id: <20211012205904.4106769-3-mathieu.poirier@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user-rng-pci.c | 79 ++++++++++++++++++++++++++++++++++ hw/virtio/meson.build | 1 + 2 files changed, 80 insertions(+) create mode 100644 hw/virtio/vhost-user-rng-pci.c diff --git a/hw/virtio/vhost-user-rng-pci.c b/hw/virtio/vhost-user-rng-pci.c new file mode 100644 index 0000000000..c83dc86813 --- /dev/null +++ b/hw/virtio/vhost-user-rng-pci.c @@ -0,0 +1,79 @@ +/* + * Vhost-user RNG virtio device PCI glue + * + * Copyright (c) 2021 Mathieu Poirier + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "hw/qdev-properties.h" +#include "hw/virtio/vhost-user-rng.h" +#include "virtio-pci.h" + +struct VHostUserRNGPCI { + VirtIOPCIProxy parent_obj; + VHostUserRNG vdev; +}; + +typedef struct VHostUserRNGPCI VHostUserRNGPCI; + +#define TYPE_VHOST_USER_RNG_PCI "vhost-user-rng-pci-base" + +DECLARE_INSTANCE_CHECKER(VHostUserRNGPCI, VHOST_USER_RNG_PCI, + TYPE_VHOST_USER_RNG_PCI) + +static Property vhost_user_rng_pci_properties[] = { + DEFINE_PROP_UINT32("vectors", VirtIOPCIProxy, nvectors, + DEV_NVECTORS_UNSPECIFIED), + DEFINE_PROP_END_OF_LIST(), +}; + +static void vhost_user_rng_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp) +{ + VHostUserRNGPCI *dev = VHOST_USER_RNG_PCI(vpci_dev); + DeviceState *vdev = DEVICE(&dev->vdev); + + if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) { + vpci_dev->nvectors = 1; + } + + qdev_realize(vdev, BUS(&vpci_dev->bus), errp); +} + +static void vhost_user_rng_pci_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + VirtioPCIClass *k = VIRTIO_PCI_CLASS(klass); + PCIDeviceClass *pcidev_k = PCI_DEVICE_CLASS(klass); + k->realize = vhost_user_rng_pci_realize; + set_bit(DEVICE_CATEGORY_INPUT, dc->categories); + device_class_set_props(dc, vhost_user_rng_pci_properties); + pcidev_k->vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET; + pcidev_k->device_id = 0; /* Set by virtio-pci based on virtio id */ + pcidev_k->revision = 0x00; + pcidev_k->class_id = PCI_CLASS_OTHERS; +} + +static void vhost_user_rng_pci_instance_init(Object *obj) +{ + VHostUserRNGPCI *dev = VHOST_USER_RNG_PCI(obj); + + virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev), + TYPE_VHOST_USER_RNG); +} + +static const VirtioPCIDeviceTypeInfo vhost_user_rng_pci_info = { + .base_name = TYPE_VHOST_USER_RNG_PCI, + .non_transitional_name = "vhost-user-rng-pci", + .instance_size = sizeof(VHostUserRNGPCI), + .instance_init = vhost_user_rng_pci_instance_init, + .class_init = vhost_user_rng_pci_class_init, +}; + +static void vhost_user_rng_pci_register(void) +{ + virtio_pci_types_register(&vhost_user_rng_pci_info); +} + +type_init(vhost_user_rng_pci_register); diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build index ae6b2cde10..521f7d64a8 100644 --- a/hw/virtio/meson.build +++ b/hw/virtio/meson.build @@ -28,6 +28,7 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c')) virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_true: files('vhost-user-i2c-pci.c')) virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c')) +virtio_ss.add(when: ['CONFIG_VHOST_USER_RNG', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-rng-pci.c')) virtio_pci_ss = ss.source_set() virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c')) From patchwork Wed Oct 20 10:20:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 447B0C433F5 for ; Wed, 20 Oct 2021 11:16:28 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCEE961373 for ; Wed, 20 Oct 2021 11:16:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CCEE961373 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:42764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9a6-0007jO-S0 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:16:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i0-0004fn-IN for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54173) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hw-0003XJ-5X for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725227; 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=ovgGFzduCrnIeJvjYt5D1svpWOkcO96pV6pxkCNnsKE=; b=BxCLpIgDqhJ/y1ocI2vibBYRaQuGBqx44/sam6r/t2rcjX7ga8ZA70wxnnBQpQl1pZU94j T9k2EKpO+SsuX/zifFLU6wPxJSHWD1c68ziKNzCQQmB5ljXUZhOszklFr6jSVo3hR9RwFl +k8BxOLRjkLyxD7SbEoGm0tfOgmMW40= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-602-wq3HI3P3OlK9GVaJFhiPzA-1; Wed, 20 Oct 2021 06:20:25 -0400 X-MC-Unique: wq3HI3P3OlK9GVaJFhiPzA-1 Received: by mail-ed1-f71.google.com with SMTP id u17-20020a50d511000000b003daa3828c13so20514298edi.12 for ; Wed, 20 Oct 2021 03:20:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ovgGFzduCrnIeJvjYt5D1svpWOkcO96pV6pxkCNnsKE=; b=zLCRg1T/2xkP5e8PIYrvQRevAPWAsyTSoi5/Vsizbq02JCclVOE77FiXDiiyXnflsT Oxpdd7QsP8qP3en2cQQeSzCiz4F5IVMNg5GeGVpx90os2IPmx2vNgMMBKLY+xK2iiXpt oZtll5m47u19D6pSzsz+cA5VUKNYkLGx1koozEtv0yjFf4rOn1U42YaeWdCAdYLl2wB8 7NoQuEsOZQ+WGjrHQmFT7BYGdw7StCPqJpNKDgLBZblUZmKjYXWwDwb8PFzmZVTQ9P9l qo/O1+CHsURPEjJIh0pnRMO3TaiiIQ4iVvaAC02wdAvBQ2KRUcMIku/8G8zvVTpjIZUR lqtQ== X-Gm-Message-State: AOAM531kgLvJUqf7spPmwgPpatV5Q976mNypjuKgbUF+4XnE7OfUAt9G Thfrxp6RbEHsmEc6rc1SHEI/0/x0J/PlLYYmrKW/AKBNZUczQypw1z2qKMUuWLUnHijICN4WJVi oPJj3n95W2N3Cx4WxYS0E36OOll8NFauz8DucLkEdvzy4W0zwOlpqBntKGloS X-Received: by 2002:a50:e183:: with SMTP id k3mr62562068edl.22.1634725223531; Wed, 20 Oct 2021 03:20:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBe5essEzHiEgNYxnMItTUZJNzxqFpoSl/oiY7OPXStM8IxtVRmLVXktJWkDpxbr8YlnrVzQ== X-Received: by 2002:a50:e183:: with SMTP id k3mr62562040edl.22.1634725223368; Wed, 20 Oct 2021 03:20:23 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id lf17sm831268ejb.25.2021.10.20.03.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:22 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:20 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 24/44] docs: Add documentation for vhost based RNG implementation Message-ID: <20211020101844.988480-25-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Alex =?utf-8?q?Benn=C3=A9e?= , Stefan Hajnoczi , Mathieu Poirier , Markus Armbruster Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Mathieu Poirier Add description and example for the vhost-user based RNG implementation. Signed-off-by: Mathieu Poirier Message-Id: <20211012205904.4106769-4-mathieu.poirier@linaro.org> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- docs/system/device-emulation.rst | 1 + docs/system/devices/vhost-user-rng.rst | 39 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 docs/system/devices/vhost-user-rng.rst diff --git a/docs/system/device-emulation.rst b/docs/system/device-emulation.rst index 7afcfd8064..19944f526c 100644 --- a/docs/system/device-emulation.rst +++ b/docs/system/device-emulation.rst @@ -88,3 +88,4 @@ Emulated Devices devices/usb.rst devices/vhost-user.rst devices/virtio-pmem.rst + devices/vhost-user-rng.rst diff --git a/docs/system/devices/vhost-user-rng.rst b/docs/system/devices/vhost-user-rng.rst new file mode 100644 index 0000000000..a145d4105c --- /dev/null +++ b/docs/system/devices/vhost-user-rng.rst @@ -0,0 +1,39 @@ +QEMU vhost-user-rng - RNG emulation +=================================== + +Background +---------- + +What follows builds on the material presented in vhost-user.rst - it should +be reviewed before moving forward with the content in this file. + +Description +----------- + +The vhost-user-rng device implementation was designed to work with a random +number generator daemon such as the one found in the vhost-device crate of +the rust-vmm project available on github [1]. + +[1]. https://github.com/rust-vmm/vhost-device + +Examples +-------- + +The daemon should be started first: + +:: + + host# vhost-device-rng --socket-path=rng.sock -c 1 -m 512 -p 1000 + +The QEMU invocation needs to create a chardev socket the device can +use to communicate as well as share the guests memory over a memfd. + +:: + + host# qemu-system \ + -chardev socket,path=$(PATH)/rng.sock,id=rng0 \ + -device vhost-user-rng-pci,chardev=rng0 \ + -m 4096 \ + -object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \ + -numa node,memdev=mem \ + ... From patchwork Wed Oct 20 10:20:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60195C433F5 for ; Wed, 20 Oct 2021 10:52:42 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 089F660EE5 for ; Wed, 20 Oct 2021 10:52:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 089F660EE5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:53348 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9D5-00007N-K3 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:52:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i0-0004iX-OG for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28674) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8hy-0003aY-S3 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725230; 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=8WUvKS8fdXJA9x2sA/adDQPr/E4an91R5a8EOdVOfhc=; b=Z31Vm85cxNRPHLPShT24YP1PIRHQf6tdPtHdpI0PSj3Auxh8V2odEHbirBhohXS/PX5Nnm zW9HK3c0h+K153y05NFovigEgaYIPJ19xIcSwdFazngs+QJL2I8Jpqr3cgJn9t2lEde/vu XL1PWd1we4UzYehH0G4mwGQZ5a8Od/Y= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-299-_Xpn6GiFP6CBHU-jvGrnVw-1; Wed, 20 Oct 2021 06:20:27 -0400 X-MC-Unique: _Xpn6GiFP6CBHU-jvGrnVw-1 Received: by mail-ed1-f71.google.com with SMTP id v2-20020a50f082000000b003db24e28d59so20507132edl.5 for ; Wed, 20 Oct 2021 03:20:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8WUvKS8fdXJA9x2sA/adDQPr/E4an91R5a8EOdVOfhc=; b=ZabIqBCeeLV6RD/gMdmcXphJ7dH6PVGszZj89hNL1A8xGgqAOs15UdNfkbp1QwZMm5 CEEmYDdwTkgU012lICamaav0oGVnM9BYtBY4Yd07LzoQrxU8tjzLLWcdHRkGBYw8TGIf fDyAFIFQLl+JTsx/GVTBuFCpWp145m3di4jgybnOqaOEo1W9aC6f/uLWzjCi/0wGwOH3 i/7YRo7HUkj7+n13pwkqEeOLSZ84SQpLRWSjULDdgBX9MBGwr++bG7h71WrfApLJCdxn eLWLGb5z/otkW9j7fNVPfLj7Y7W14WJnYvK2Dy8vOUJWF2x8aQJYoYifvBlQbk0GIrv6 iE/A== X-Gm-Message-State: AOAM531uX8pzeABgHV5EX4MhbNWg7T1ZlskR1NDHZpY8aPC2uMsthF0M 0E4VtHtEI8vfQTk+YDShrtGWrN1/buqZHam2Q51ipMrFfTeVrIT/Ced6PMVmNoQW6c6jDL2fuud 6iy1Bi8t2zA8FH6n4FIKuPvZX9azAn3G8jYu3hXpDc8qNnHYoX2wS7dZZlDzj X-Received: by 2002:a50:e60a:: with SMTP id y10mr61655440edm.233.1634725226328; Wed, 20 Oct 2021 03:20:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxa/kpu0UT7+u4BdJxxMGuLAEw+T0HuE+EVqn0IfquQRqKFCF2ox1HHyrz+KfCjfM34NRygA== X-Received: by 2002:a50:e60a:: with SMTP id y10mr61655403edm.233.1634725226031; Wed, 20 Oct 2021 03:20:26 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id w7sm970886ede.8.2021.10.20.03.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:25 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:23 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 25/44] vhost-user: fix duplicated notifier MR init Message-ID: <20211020101844.988480-26-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yuwei Zhang , Peter Maydell , tiwei.bie@intel.com, Xueming Li , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Xueming Li In case of device resume after suspend, VQ notifier MR still valid. Duplicated registrations explode memory block list and slow down device resume. Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers") Cc: tiwei.bie@intel.com Cc: qemu-stable@nongnu.org Cc: Yuwei Zhang Signed-off-by: Xueming Li Message-Id: <20211008080215.590292-1-xuemingl@nvidia.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 2c8556237f..bf6e50223c 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1526,8 +1526,9 @@ static int vhost_user_slave_handle_vring_host_notifier(struct vhost_dev *dev, name = g_strdup_printf("vhost-user/host-notifier@%p mmaps[%d]", user, queue_idx); - memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name, - page_size, addr); + if (!n->mr.ram) /* Don't init again after suspend. */ + memory_region_init_ram_device_ptr(&n->mr, OBJECT(vdev), name, + page_size, addr); g_free(name); if (virtio_queue_set_host_notifier_mr(vdev, queue_idx, &n->mr, true)) { From patchwork Wed Oct 20 10:20:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F070CC433EF for ; Wed, 20 Oct 2021 10:54:43 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 946C660F22 for ; Wed, 20 Oct 2021 10:54:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 946C660F22 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9F4-00042r-I9 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:54:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i2-0004mN-2o for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24165) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i0-0003bL-AL for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725231; 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=/9dVY/FdYgobEPIXwfeyLGyGilitrT6maCqqauzoxr8=; b=Sw1fwT5mmtS+YlfwyenCI66dDS+qdo1PTvQ1qLBiCsQTDzWASUYkXFSb2YPhulqwYrmx8w urzb75gG0YkDjZbkDgOCBVXlVmOPzQ2LYGJ01+ta7MgVU6Zd0o2Ggks8VkJynDXJ3jUXu3 ATAMOIaoNGHLYeEMgzhmuwKOFQYibzM= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-502-6QuaIj_2OZauN7-sKlMsUw-1; Wed, 20 Oct 2021 06:20:30 -0400 X-MC-Unique: 6QuaIj_2OZauN7-sKlMsUw-1 Received: by mail-ed1-f72.google.com with SMTP id u23-20020a50a417000000b003db23c7e5e2so20550287edb.8 for ; Wed, 20 Oct 2021 03:20:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=/9dVY/FdYgobEPIXwfeyLGyGilitrT6maCqqauzoxr8=; b=Q7wE62EhjMazXTt6pfFRSoRLiedizBlkQUkeuKkXECK8RVM3ZqXP5TSQGyvYU9hiFp 4CHGyB/s1MC6C9Oovo79cPnn7mfwAmhIKG58o+eaIep2cSH8EvZVqhUGfqyL3aCOHfsu xcV2esK/yPcjjVR3omXEXJnf6PdhDf3J01PYjHCi/cX4OQtDrvp8Tee2qWWgttgNr6e4 O/xi8s3b6chFpUsg8QNr0j8fwvICZ7prO5ese+GvGmNntbLo7Cgj5OohM5+nrsGMWShg BgFVm8FaT40h+RMIzduvSNOfQoHJFD51MzTCfS/2DbxvFylh2IMd5w2z09dlaDJHRfGX zotA== X-Gm-Message-State: AOAM5333L3knudda+c2oq2va8lnKlsjEOqQEUiyaJRLKJe6Tu3jou2QX rhZnN3zENDrNFm/ony/P1yWyWzQty5Vd+kG9GOdXtImbcfpKKNFDxwxfbagdzdzGrUVDlkikaJc h84hFZG7wl1PQh2RUWFs+qevtMeBBcodpJqbpHjsJD0W29pQ9N/ytVvILDdIF X-Received: by 2002:a17:906:34c3:: with SMTP id h3mr46167669ejb.10.1634725229028; Wed, 20 Oct 2021 03:20:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwahFq2ZHFFXrZFt2R4tFM6Fb3G13eUBeu7Ozi1S5ZfZXybYXUaI5RljNWTN3mGFUzAWIHKVA== X-Received: by 2002:a17:906:34c3:: with SMTP id h3mr46167640ejb.10.1634725228796; Wed, 20 Oct 2021 03:20:28 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id h10sm931715edf.85.2021.10.20.03.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:28 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:26 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 26/44] failover: fix a regression introduced by JSON'ification of -device Message-ID: <20211020101844.988480-27-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Jason Wang , kwolf@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier The hide_device helper can be called several times for the same devices as it shouldn't change any state and should only return an information. But not to rely anymore on QemuOpts we have introduced a new field to store the parameters of the device and don't allow to update it once it is done. And as the function is called several times, we ends with: warning: Cannot attach more than one primary device to 'virtio0' That is not only a warning as it prevents to hide the device and breaks failover. Fix that by checking the device id. Now, we fail only if the virtio-net device is really used by two different devices, for instance: -device virtio-net-pci,id=virtio0,failover=on,... \ -device vfio-pci,id=hostdev0,failover_pair_id=virtio0,... \ -device e1000e,id=e1000e0,failover_pair_id=virtio0,... \ will exit with: Cannot attach more than one primary device to 'virtio0': 'hostdev0' and 'e1000e0' Fixes: 259a10dbcb4f ("virtio-net: Store failover primary opts pointer locally") Cc: kwolf@redhat.com Signed-off-by: Laurent Vivier Message-Id: <20211019071532.682717-2-lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Kevin Wolf Reviewed-by: Kevin Wolf --- hw/net/virtio-net.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 09e173a558..83642c85b2 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3304,15 +3304,27 @@ static bool failover_hide_primary_device(DeviceListener *listener, return false; } + /* + * The hide helper can be called several times for a given device. + * Check there is only one primary for a virtio-net device but + * don't duplicate the qdict several times if it's called for the same + * device. + */ if (n->primary_opts) { - error_setg(errp, "Cannot attach more than one primary device to '%s'", - n->netclient_name); - return false; + const char *old, *new; + /* devices with failover_pair_id always have an id */ + old = qdict_get_str(n->primary_opts, "id"); + new = qdict_get_str(device_opts, "id"); + if (strcmp(old, new) != 0) { + error_setg(errp, "Cannot attach more than one primary device to " + "'%s': '%s' and '%s'", n->netclient_name, old, new); + return false; + } + } else { + n->primary_opts = qdict_clone_shallow(device_opts); + n->primary_opts_from_json = from_json; } - n->primary_opts = qdict_clone_shallow(device_opts); - n->primary_opts_from_json = from_json; - /* failover_primary_hidden is set during feature negotiation */ return qatomic_read(&n->failover_primary_hidden); } From patchwork Wed Oct 20 10:20:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BFF2C433EF for ; Wed, 20 Oct 2021 11:19:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4C1C61057 for ; Wed, 20 Oct 2021 11:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E4C1C61057 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9dI-0003vc-UO for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:19:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48430) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i5-0004nN-4y for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44264) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i3-0003hQ-KN for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725235; 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=Yj3JiZzos9wfmafHbbhWyjt5GZKs2MQbtgHmoUqM9p0=; b=Kl+pIYIZewt9QKVyVjvv1b1hiPLhcsUfUYYTAO7v2h58T/7Cdh4V5rg+UOrgdQG/X832kt hoYR54MEhSwQxXi3fNOHKpjwELZ7FtABDGMmhdyu7G9PUqvdJGBuk7FyeFyHBH64qaCgQv oTq4LF2BNKgsGG0P5fbJ38dMqEQs8Mc= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-65-i8c97qYhNpmUWxHpXbyJjA-1; Wed, 20 Oct 2021 06:20:33 -0400 X-MC-Unique: i8c97qYhNpmUWxHpXbyJjA-1 Received: by mail-ed1-f72.google.com with SMTP id g28-20020a50d0dc000000b003dae69dfe3aso20517552edf.7 for ; Wed, 20 Oct 2021 03:20:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Yj3JiZzos9wfmafHbbhWyjt5GZKs2MQbtgHmoUqM9p0=; b=sgKLBLpswRCzWHZrK2Zl1rdrylrxgs1mx8UgtGsIVQadernoBTb+HyKUue/le9WZDU 2pL8yLKpPS+VfkoxKytL8liLARWCcZ5JjYYnG2AAIiZcHRp4FKmL6maiI9awLkFi7qZl OOh8XO6YG6zyJfcmuUZ15ptdmGDw202tzOXIBKKIqAGqBTBIfW3jUzBL9D0aUui3L3FX D6jqKzT1/y+Kc3DXBOutfgOmDSYr2X2cE3/AipEtGI19hNS0H3kIu8e4fYJvAYHG1ZtF UBwxz9+dMHJEXHyozpQoDuGOaUqIL32x1frC5e9C7yFlB11/QSoEKYWupad8HGUAhThb AGJA== X-Gm-Message-State: AOAM531dv/vT/oOUcXML9xPSNS1JZCbIlV3dJnKfzXKZY8KwoxUzEuNV M8Zf0nfouqjYZR4yZCdXG5LZW/z5IWBXV0WnRlZwz8hSEOG8yLbBda0oznC/fQRLt6scWzXcdFr ikkVlpGXRCmi2yxZ7m4r1kUPePc0trBWOvkpEPAxfmeYCwEdOdHq8V7Asjg8j X-Received: by 2002:a17:907:971e:: with SMTP id jg30mr45041160ejc.169.1634725232115; Wed, 20 Oct 2021 03:20:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhIgydcQQGt/U1Xvpc84XOVU9AFYeaCsmYROJIkLCgLNGR/zG0oCbyJj46t+t0WIxfB8gFVg== X-Received: by 2002:a17:907:971e:: with SMTP id jg30mr45041118ejc.169.1634725231781; Wed, 20 Oct 2021 03:20:31 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id c6sm811707ejb.41.2021.10.20.03.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:31 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:28 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 27/44] vhost-user-blk-test: pass vhost-user socket fds to QSD Message-ID: <20211020101844.988480-28-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Coiby Xu , Raphael Norwitz , Stefan Hajnoczi , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi qemu-storage-daemon is launched with the vhost-user listen socket path. The path is first unlinked before opening the listen socket. This prevents stale UNIX domain socket files from stopping socket initialization. This behavior is undesirable in vhost-user-blk-test and the cause of a bug: There is a race condition in vhost-user-blk-test when QEMU launches before QSD. It connects to the old socket that QSD unlinks and the vhost-user connection is never serviced, resulting in a hang. Pass the listen socket fd to QSD to maintain listen socket continuity and prevent the lost connection. Fixes: 806952026df41939680abe92b329715b9b4e01cc ("test: new qTest case to test the vhost-user-blk-server") Cc: Raphael Norwitz Cc: Michael S. Tsirkin Cc: Thomas Huth Cc: Coiby Xu Signed-off-by: Stefan Hajnoczi Message-Id: <20211019135655.83067-1-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- tests/qtest/vhost-user-blk-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/vhost-user-blk-test.c b/tests/qtest/vhost-user-blk-test.c index 6f108a1b62..62e670f39b 100644 --- a/tests/qtest/vhost-user-blk-test.c +++ b/tests/qtest/vhost-user-blk-test.c @@ -906,9 +906,9 @@ static void start_vhost_user_blk(GString *cmd_line, int vus_instances, img_path = drive_create(); g_string_append_printf(storage_daemon_command, "--blockdev driver=file,node-name=disk%d,filename=%s " - "--export type=vhost-user-blk,id=disk%d,addr.type=unix,addr.path=%s," + "--export type=vhost-user-blk,id=disk%d,addr.type=fd,addr.str=%d," "node-name=disk%i,writable=on,num-queues=%d ", - i, img_path, i, sock_path, i, num_queues); + i, img_path, i, fd, i, num_queues); g_string_append_printf(cmd_line, "-chardev socket,id=char%d,path=%s ", i + 1, sock_path); From patchwork Wed Oct 20 10:20:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572041 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3E97C433F5 for ; Wed, 20 Oct 2021 10:38:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8572F600CC for ; Wed, 20 Oct 2021 10:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8572F600CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md8zp-0004R0-GX for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:38:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i8-0004nY-1v for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43995) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i6-0003ja-Gc for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725237; 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=vDSmLhCNyhjwq4dSlabAJpt3Pwq7xbTenlNw9fzietw=; b=WJkHJmRAulFLJMv9lCYLaHPo55XSzzB1qgVty26a4Tx6Nc1EjA3VwVDZ+o2zKbeuf9Trli gUlDRmnRVO4Bj4GrQh7F2GwqDVQ3xeApTyY+msutj9qjtQzH2SDBd1ECY/XFpt2HiOSiIw U/y4sDHV+dBPWU2QFMqe2WaO/0FW9LM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-178-SXsq0n3LO_K9oywTJiWfXg-1; Wed, 20 Oct 2021 06:20:36 -0400 X-MC-Unique: SXsq0n3LO_K9oywTJiWfXg-1 Received: by mail-ed1-f69.google.com with SMTP id t18-20020a056402021200b003db9e6b0e57so20536882edv.10 for ; Wed, 20 Oct 2021 03:20:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vDSmLhCNyhjwq4dSlabAJpt3Pwq7xbTenlNw9fzietw=; b=ScZtN8wabdxe24G/WgAtOWbhEZr1Xifp1buCMJiQMWOU19R6Xxv9Q/3jQFhLGczVn+ HtR73dth4Ux7CbRVV4ErYJp1RNS1NtI4WT6JJmh3F0xL+v+xSSDf3XrHoyMcG2Eedggz hdZpSiRrB/Jti0uU5WXFEyRuYGap32erec+BzzKZX804gb4PDjza3KWZnzwC+uEeWBKN fHy7aGnHmxnp89e3NAhPgeWiSVZxCaGgVXBjIjV+hLGX2BJjsvq6a/sVoxKoGMOF8qvQ DnxoaqgU5AtuPvQ5O4Ref4RJbwIlOm3oC3CXzxxRgE9FAk9mnCCa4qqIJuY3abdql/qe lGDA== X-Gm-Message-State: AOAM5329rkEAdoXDx9JeiyMzcoUVIzlztYKXKM9QUQa9gYY4q8lFo86v karvFoYE+kbXrc0AaC0UauSZJXq3nDknNuORNWPoqN1VpgOcHGOoEbqLlberEoLnjbn5RCFU29H QSlXEDCDAnsValNZ5Gpd39/sfUG8fFvWc7vm1OZ3G+sfxXVRCo3LiMOZE9Kg8 X-Received: by 2002:a17:906:3c51:: with SMTP id i17mr45960946ejg.86.1634725235235; Wed, 20 Oct 2021 03:20:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7JRFEWGQ6DDwx+gRfMsI75tVOzEbxYUnSz2T3yGmmGkoM/VdDqyCe11cNXSVUcLrxfbkVcg== X-Received: by 2002:a17:906:3c51:: with SMTP id i17mr45960907ejg.86.1634725234999; Wed, 20 Oct 2021 03:20:34 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id b2sm950425edv.73.2021.10.20.03.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:34 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:32 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 28/44] qdev/qbus: remove failover specific code Message-ID: <20211020101844.988480-29-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Daniel =?utf-8?b?UC4gQmVycmFuZ8Op?= , Eduardo Habkost , Jason Wang , Paolo Bonzini , Kevin Wolf , Jens Freimann Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Laurent Vivier Commit f3a850565693 ("qdev/qbus: add hidden device support") has introduced a generic way to hide a device but it has modified qdev_device_add() to check a specific option of the failover device, "failover_pair_id", before calling the generic mechanism. It's not needed (and not generic) to do that in qdev_device_add() because this is also checked by the failover_hide_primary_device() function that uses the generic mechanism to hide the device. Cc: Jens Freimann Signed-off-by: Laurent Vivier Message-Id: <20211019071532.682717-3-lvivier@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Kevin Wolf --- hw/net/virtio-net.c | 12 +++++++++++- softmmu/qdev-monitor.c | 18 ++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 83642c85b2..3dd2896ff9 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3299,7 +3299,17 @@ static bool failover_hide_primary_device(DeviceListener *listener, if (!device_opts) { return false; } - standby_id = qdict_get_try_str(device_opts, "failover_pair_id"); + + if (!qdict_haskey(device_opts, "failover_pair_id")) { + return false; + } + + if (!qdict_haskey(device_opts, "id")) { + error_setg(errp, "Device with failover_pair_id needs to have id"); + return false; + } + + standby_id = qdict_get_str(device_opts, "failover_pair_id"); if (g_strcmp0(standby_id, n->netclient_name) != 0) { return false; } diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c index 89c473cb22..4851de51a5 100644 --- a/softmmu/qdev-monitor.c +++ b/softmmu/qdev-monitor.c @@ -639,19 +639,13 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts, } } - if (qdict_haskey(opts, "failover_pair_id")) { - if (!qdict_haskey(opts, "id")) { - error_setg(errp, "Device with failover_pair_id don't have id"); - return NULL; - } - if (qdev_should_hide_device(opts, from_json, errp)) { - if (bus && !qbus_is_hotpluggable(bus)) { - error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); - } - return NULL; - } else if (*errp) { - return NULL; + if (qdev_should_hide_device(opts, from_json, errp)) { + if (bus && !qbus_is_hotpluggable(bus)) { + error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name); } + return NULL; + } else if (*errp) { + return NULL; } if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) { From patchwork Wed Oct 20 10:20:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572089 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FD6FC433EF for ; Wed, 20 Oct 2021 10:56:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 647C16128B for ; Wed, 20 Oct 2021 10:56:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 647C16128B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:33396 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9HE-0005st-Ee for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:56:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iC-0004oA-Ey for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21366) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8i9-0003mb-9u for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725240; 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=qnz3ddsuLkeNXQ5UcNuezViBVj40PhXYoAPj2DQFzuw=; b=LpqKESAomhCJ6TZbbPkz8EvUsezXNI8YSLa6bn6lCDc/JHnypDM0EJqesKFy7ZF2V2VGVX udWLkm219gkVNZxDFTUi3n/0G/8C7QeWyjaIgjz4kf6JEcnRPK3JdPOeWYIgzJDZCKjw3z TzGThK6sx0Imjn8h7iFBgBiwCO9sZTA= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-121-oO9aU9phN9mrahf_wSvVaA-1; Wed, 20 Oct 2021 06:20:39 -0400 X-MC-Unique: oO9aU9phN9mrahf_wSvVaA-1 Received: by mail-ed1-f71.google.com with SMTP id l10-20020a056402230a00b003db6977b694so20506448eda.23 for ; Wed, 20 Oct 2021 03:20:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qnz3ddsuLkeNXQ5UcNuezViBVj40PhXYoAPj2DQFzuw=; b=cp3MjCqPl4bPr5cML6mNda80s2a72Y0DCx+lHHM3yemIB78pqNzRT9XPpk1IPYEGDN WvPjCYy9ZUP/nTwXNBMk3vuZhnFcOo7wGDS0OjFs/tq8xtvBa4F6CkaUNVJyFra46Ah1 z1rraI22u1h3msQh2pCZtWyvSmsIxYtcGocHl0vZyk1Hm35Vj1X3y54oUHuATVa66Oh4 gn9KYfnXzzbzin0jCIPhQNqsLZY1+lFRLQ2/di7SFW7Yajeb9T06dzK0sY3B5KYwVPjO zJ3n0U406MAFwswtjH+FOLGsB9luDLMdSO3grH78Uuz62h4qI5xpu0yEsSfKZ+v3yIkG KNeg== X-Gm-Message-State: AOAM53292JSqFx0N1S11Z/tqKHRIlOqCuOUdsOcgxGAFvwnDY0NNLQeX Rf96aqZi7ijNPdmZ3NGyxNT6GKTZ0u0WfacU0Z4vk/bEOtMwWGOlAh1jUul0y6+x08j16e0onUn kdiSeT0NJzvL7CeRFEzJUyq7I2ATH10UkdT6+UwRvy3e6y25ogQso4cKXQHeD X-Received: by 2002:a17:906:1290:: with SMTP id k16mr45500029ejb.566.1634725237978; Wed, 20 Oct 2021 03:20:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYrd8OF9qpnel84m84xay2dwpgbP4B/SRxvdFw2zCQEIk70Hm+hPK0o6IOWFVxnxnMmXa34A== X-Received: by 2002:a17:906:1290:: with SMTP id k16mr45499994ejb.566.1634725237732; Wed, 20 Oct 2021 03:20:37 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id u16sm824396ejy.16.2021.10.20.03.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:37 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:35 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 29/44] rebuild-expected-aml.sh: allow partial target list Message-ID: <20211020101844.988480-30-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Only rebuild AML for configured targets. Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/rebuild-expected-aml.sh | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh index fc78770544..dcf2e2f221 100755 --- a/tests/data/acpi/rebuild-expected-aml.sh +++ b/tests/data/acpi/rebuild-expected-aml.sh @@ -12,7 +12,7 @@ # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. -qemu_bins="./qemu-system-x86_64 ./qemu-system-aarch64" +qemu_arches="x86_64 aarch64" if [ ! -e "tests/qtest/bios-tables-test" ]; then echo "Test: bios-tables-test is required! Run make check before this script." @@ -20,6 +20,26 @@ if [ ! -e "tests/qtest/bios-tables-test" ]; then exit 1; fi +if grep TARGET_DIRS= config-host.mak; then + for arch in $qemu_arches; do + if grep TARGET_DIRS= config-host.mak | grep "$arch"-softmmu; + then + qemu_bins="$qemu_bins ./qemu-system-$arch" + fi + done +else + echo "config-host.mak missing!" + echo "Run this script from the build directory." + exit 1; +fi + +if [ -z "$qemu_bins" ]; then + echo "Only the following architectures are currently supported: $qemu_arches" + echo "None of these configured!" + echo "To fix, run configure --target-list=x86_64-softmmu,aarch64-softmmu" + exit 1; +fi + for qemu in $qemu_bins; do if [ ! -e $qemu ]; then echo "Run 'make' to build the following QEMU executables: $qemu_bins" From patchwork Wed Oct 20 10:20:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572097 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C879C433F5 for ; Wed, 20 Oct 2021 11:03:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AE60061373 for ; Wed, 20 Oct 2021 11:03:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AE60061373 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:41796 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9NX-0003oJ-Rr for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:03:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iE-0004ps-Ou for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iC-0003o6-4e for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725243; 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=hgj6U65prU55+Vw6GV3Frlkold3q2yJFqxxjdTh9XFs=; b=G5jmBxMw7GUmtXylb8Hy8BOw2qrkXqupjYor29zpvU2WQh1DHgm0cUliakesgWGFt/4b5G IuoJmnkKKpUAITFl/c9zsPCFqiI7vrPxgD7EiSJpxDfwVk26Ju0jP3ZRpUgixwQ0tbSdB9 69zLvascdV+cweeiH6FMu54wkc63X6Y= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-Km0Wl8-MO0qPS1IVBMoZVg-1; Wed, 20 Oct 2021 06:20:42 -0400 X-MC-Unique: Km0Wl8-MO0qPS1IVBMoZVg-1 Received: by mail-ed1-f70.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20619581edv.9 for ; Wed, 20 Oct 2021 03:20:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hgj6U65prU55+Vw6GV3Frlkold3q2yJFqxxjdTh9XFs=; b=D9qxkIZRUDtVBCbExRkgJol8jE240BQYVKYFJP2AqZpfMKycR6vL0zzl+BLc12NyUX LiT3ZeNVnAlmxw7aGNobHtAARw9KqBVoV/Eh7U8iNgDPWM7MG+79xaZxskXWMr3Bl1BM SrD7w0Qp/kjHNhCqLxFn5yGnp/mbNHVO2zpw++7qn/vf9oKyz3aSgL89KSkQXgcpMBPn c/wwe/8JuoguT8dK6IdqjWRwNqQIpQ2cbrfWnV3jnjf1IK6QMWfIS5DigGPI4SmmxGpT G5M8KCKvLJtlw/qXf1KuXq6Yc6F9A1TH0EUR2xpeqe4fU+KA0Qz+r9BZYs36czcjfqyl uQug== X-Gm-Message-State: AOAM532b1l9rrH7SmD6Sk85JHu/9ljvOhzEq2KLXAnKstcpsQ0DRYf0U 596JYxQv2Fu1nt1k0u7gNtGcxmvyw9jKlGqG9azCGoZzYU5hjbMN2SYHDbtYYerTs4eMskAD0vP KNrrgbDenUcQOyhz3pgnHXxHoNlMIl7aleNoXL2XAE7NCGX4C7reckXhgiSyZ X-Received: by 2002:a50:d558:: with SMTP id f24mr9912172edj.305.1634725240481; Wed, 20 Oct 2021 03:20:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYKTDix0I8Mw9Koyhwc0DH4kp66SE6LDnPt2KEZyMOD6tMBPWSHzKtJR/jZ5g57yUvs8Hjng== X-Received: by 2002:a50:d558:: with SMTP id f24mr9912148edj.305.1634725240253; Wed, 20 Oct 2021 03:20:40 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id kd8sm831694ejc.69.2021.10.20.03.20.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:39 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:37 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 30/44] bios-tables-test: don't disassemble empty files Message-ID: <20211020101844.988480-31-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" A recommended way to populate new tables is to have an empty expected file. In this case, attempts to disassemble will fail but it is useful to disassemble the actual files. Detect and skip decompile step in this case. Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 6e21a650d2..798f68c737 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -271,19 +271,28 @@ static void dump_aml_files(test_data *data, bool rebuild) } } +static bool create_tmp_asl(AcpiSdtTable *sdt) +{ + GError *error = NULL; + gint fd; + + fd = g_file_open_tmp("asl-XXXXXX.dsl", &sdt->asl_file, &error); + g_assert_no_error(error); + close(fd); + + return false; +} + static bool load_asl(GArray *sdts, AcpiSdtTable *sdt) { AcpiSdtTable *temp; GError *error = NULL; GString *command_line = g_string_new(iasl); - gint fd; gchar *out, *out_err; gboolean ret; int i; - fd = g_file_open_tmp("asl-XXXXXX.dsl", &sdt->asl_file, &error); - g_assert_no_error(error); - close(fd); + create_tmp_asl(sdt); /* build command line */ g_string_append_printf(command_line, " -p %s ", sdt->asl_file); @@ -463,11 +472,20 @@ static void test_acpi_asl(test_data *data) err = load_asl(data->tables, sdt); asl = normalize_asl(sdt->asl); - exp_err = load_asl(exp_data.tables, exp_sdt); - exp_asl = normalize_asl(exp_sdt->asl); + /* + * If expected file is empty - it's likely that it was a stub just + * created for step 1 above: we do want to decompile the actual one. + */ + if (exp_sdt->aml_len) { + exp_err = load_asl(exp_data.tables, exp_sdt); + exp_asl = normalize_asl(exp_sdt->asl); + } else { + exp_err = create_tmp_asl(exp_sdt); + exp_asl = g_string_new(""); + } /* TODO: check for warnings */ - g_assert(!err || exp_err); + g_assert(!err || exp_err || !exp_sdt->aml_len); if (g_strcmp0(asl->str, exp_asl->str)) { sdt->tmp_files_retain = true; From patchwork Wed Oct 20 10:20:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC74FC433EF for ; Wed, 20 Oct 2021 11:07:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6FA966138F for ; Wed, 20 Oct 2021 11:07:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6FA966138F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:50160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9RK-0001RR-3C for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:07:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iI-0004rf-4K for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iE-0003q3-Jx for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725246; 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=IaTVAxVRtUqiDhm0qAmv+3+o3GLdoBq3LLcABwSRz5g=; b=GSuelxxjKXg3RXqudMEjVfGKdZa5PCjGHLPnjMxAQQ8TPSSLfE6gi2Z5I7S2bBx96o+Us0 6VCkDH99zPfJezRy+zZ/Kxkj29PG1YBh7M1zSmmp2yrU3e2iMMBbzMou0ujsKF0bcxKbQN lON564+V8RA/NyHgcNBZbXPSHPaUhtk= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-rIn23gzUM02_-j4Fte3pjw-1; Wed, 20 Oct 2021 06:20:44 -0400 X-MC-Unique: rIn23gzUM02_-j4Fte3pjw-1 Received: by mail-ed1-f69.google.com with SMTP id a3-20020a50da43000000b003dca31dcfc2so4118649edk.14 for ; Wed, 20 Oct 2021 03:20:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=IaTVAxVRtUqiDhm0qAmv+3+o3GLdoBq3LLcABwSRz5g=; b=cSJPQRPGPUFaAwUsa8cpdmefbdItq1Xcm+Pgn+iQOUmYoqGiYVfjpeAUAHGwjXKq94 TiORsGKG0pRErxQQnhW8IQhHD85T09Q3iV7iaRCze5HkzFLExhI6KTK3kuLNLhHfXT7a HwF0LEAJlEGVIXGAzIZhrFOBxrXaHxmCunwckI6e/BuKNt263yKXHd3rP6R3v6PUBspo xkRei+23Zq9a3PWCEj9u2M30yLJuSSGDa451D9cXOw6pjWSZorGtt3w9EP70nC+iqDVC kEkkMXTdA/aOOzREi5E2unwahmAy+slSGgKoQNs5Ih6XwzF3kVdgBDzM5eqgzWhb46Lx 5WqA== X-Gm-Message-State: AOAM5305Skd9w0RCGy3biOmwcdQCkaQ7SsTYqWp4xc0QIY7TTAGEkJiY dvEAiJv0FMjL0anVIS5muZgv0btN80KLiRCJNprBTx4aJV4TcroX5OOlC+2AAwBNFOoHqCrmceq jcpLEkINPmjunud9tLjyM04GM0ntpnjk8nOAAic3XiKb9Tr+fAou2rtaNHoGL X-Received: by 2002:a17:907:9908:: with SMTP id ka8mr46250824ejc.164.1634725243124; Wed, 20 Oct 2021 03:20:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAVX2YHVEetkWOf8X7Gdx7CsNP0oc1/Ig9z+3Q4ws4TGTkuNLxYsE0Lb5v9jcQT0g7C20ylg== X-Received: by 2002:a17:907:9908:: with SMTP id ka8mr46250798ejc.164.1634725242960; Wed, 20 Oct 2021 03:20:42 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id f20sm933464edq.20.2021.10.20.03.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:42 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:40 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 31/44] vhost-vdpa: open device fd in net_init_vhost_vdpa() Message-ID: <20211020101844.988480-32-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang , Stefano Garzarella Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch switches to open device fd in net_init_vhost_vpda(). This is used to prepare for the multiqueue support. Reviewed-by: Stefano Garzarella Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-2-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 6dc68d8677..fd4ff5a0fb 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -170,24 +170,19 @@ static NetClientInfo net_vhost_vdpa_info = { }; static int net_vhost_vdpa_init(NetClientState *peer, const char *device, - const char *name, const char *vhostdev) + const char *name, int vdpa_device_fd) { NetClientState *nc = NULL; VhostVDPAState *s; - int vdpa_device_fd = -1; int ret = 0; assert(name); nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device, name); snprintf(nc->info_str, sizeof(nc->info_str), TYPE_VHOST_VDPA); s = DO_UPCAST(VhostVDPAState, nc, nc); - vdpa_device_fd = qemu_open_old(vhostdev, O_RDWR); - if (vdpa_device_fd == -1) { - return -errno; - } + s->vhost_vdpa.device_fd = vdpa_device_fd; ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa); if (ret) { - qemu_close(vdpa_device_fd); qemu_del_net_client(nc); } return ret; @@ -197,8 +192,20 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { const NetdevVhostVDPAOptions *opts; + int vdpa_device_fd, ret; assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); opts = &netdev->u.vhost_vdpa; - return net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, opts->vhostdev); + + vdpa_device_fd = qemu_open_old(opts->vhostdev, O_RDWR); + if (vdpa_device_fd == -1) { + return -errno; + } + + ret = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd); + if (ret) { + qemu_close(vdpa_device_fd); + } + + return ret; } From patchwork Wed Oct 20 10:20:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEFFCC433EF for ; Wed, 20 Oct 2021 10:44:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 644CB611B0 for ; Wed, 20 Oct 2021 10:44:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 644CB611B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md94r-0001vo-Hm for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:44:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iJ-0004rl-DJ for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:53 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39872) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iH-0003sV-MS for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725248; 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=p0wp6QQXK0B/oRobBtVecuCtguwgYRX9yyTp76ndhxE=; b=iwEXczAU5rz9eScB0+y9OuLsLV6cFDSyXb7AWBsAAYHG7147my2DyyC4ac1oHsjDXOct3N wzJJZ4OFQW3Ln/mAIeMbGhuyJGv8FTzYMKYcOlfcvqnvnKw3+364oc6tBgwf0cpA8cTwfj AWQPWVo9na7bEB9lAeiQWI/nh8uR+X8= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-rpQuufJ8NYmtaX2prK38KA-1; Wed, 20 Oct 2021 06:20:47 -0400 X-MC-Unique: rpQuufJ8NYmtaX2prK38KA-1 Received: by mail-ed1-f72.google.com with SMTP id c25-20020a056402143900b003dc19782ea8so17062439edx.3 for ; Wed, 20 Oct 2021 03:20:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=p0wp6QQXK0B/oRobBtVecuCtguwgYRX9yyTp76ndhxE=; b=Mv3N5KPz2WfqB6Ny+v8hCgQ0wDmpDSyYzqNoSexY/3HTjjgjj6+6jZBPbUXrqYwppR 3PlLVcwdHzAl01F42h2kCO810WYSV0GvARX5ezZGFRg3jzt17o8hHMzoE8DcewKXTmXG fiP+BncYukuZ6NxXn7rpDQG+nv+FmApc7jX5v8LxjI6B/vS1M37G0MBqEN1Nc3k9ZiNX i1ACkg+wnGL/Ss6mbymri4lJrz/iSJDzSse1Tlv0l5H8l61YlUmlehGIbHKaWxzkmBZf U/kxAjMTxMtB5UfsRyctnQ+qffOCiTWzQZU/e4asMiQmydEOiBx0g8pMC1avO3i46EQO HtiQ== X-Gm-Message-State: AOAM5338/VNKcpkMU02lzWFJuX/GtvucH4ApMMqdwewVfnojCCKUwvl2 k0vN1sYTSXVlVusUabb8xnC4epjcDWjuaE12Jj/tWxxxzMZSVgwrvhtnD3fw/QOdrVAiV8ccc9f rUsKhkXK2vcVevTtZjBAGigb9pkace8AbzYwXe60Qxeo/xl66Bgar5NusJ7WL X-Received: by 2002:a17:906:9554:: with SMTP id g20mr43656538ejy.173.1634725245856; Wed, 20 Oct 2021 03:20:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk435jWqTYFzmcfdMaXD7wSn+9wfSpkhcPJD0ASpl1dgW3zc2uctn7+XadVq9w7qWIJg21QQ== X-Received: by 2002:a17:906:9554:: with SMTP id g20mr43656513ejy.173.1634725245643; Wed, 20 Oct 2021 03:20:45 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id u16sm824580ejy.16.2021.10.20.03.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:45 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:43 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 32/44] vhost-vdpa: classify one time request Message-ID: <20211020101844.988480-33-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang Vhost-vdpa uses one device multiqueue queue (pairs) model. So we need to classify the one time request (e.g SET_OWNER) and make sure those request were only called once per device. This is used for multiqueue support. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-3-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 53 ++++++++++++++++++++++++++++++---- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index c288cf7ecb..3ce79a646d 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -22,6 +22,7 @@ typedef struct VhostVDPAHostNotifier { typedef struct vhost_vdpa { int device_fd; + int index; uint32_t msg_type; bool iotlb_batch_begin_sent; MemoryListener listener; diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 47c48f4ba8..ceb53613ba 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -319,6 +319,13 @@ static void vhost_vdpa_get_iova_range(struct vhost_vdpa *v) v->iova_range.last); } +static bool vhost_vdpa_one_time_request(struct vhost_dev *dev) +{ + struct vhost_vdpa *v = dev->opaque; + + return v->index != 0; +} + static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) { struct vhost_vdpa *v; @@ -332,6 +339,11 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp) v->msg_type = VHOST_IOTLB_MSG_V2; vhost_vdpa_get_iova_range(v); + + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER); @@ -442,6 +454,10 @@ static int vhost_vdpa_memslots_limit(struct vhost_dev *dev) static int vhost_vdpa_set_mem_table(struct vhost_dev *dev, struct vhost_memory *mem) { + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + trace_vhost_vdpa_set_mem_table(dev, mem->nregions, mem->padding); if (trace_event_get_state_backends(TRACE_VHOST_VDPA_SET_MEM_TABLE) && trace_event_get_state_backends(TRACE_VHOST_VDPA_DUMP_REGIONS)) { @@ -465,6 +481,11 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev, uint64_t features) { int ret; + + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + trace_vhost_vdpa_set_features(dev, features); ret = vhost_vdpa_call(dev, VHOST_SET_FEATURES, &features); uint8_t status = 0; @@ -489,9 +510,12 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev) } features &= f; - r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features); - if (r) { - return -EFAULT; + + if (vhost_vdpa_one_time_request(dev)) { + r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features); + if (r) { + return -EFAULT; + } } dev->backend_cap = features; @@ -600,11 +624,21 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) { struct vhost_vdpa *v = dev->opaque; trace_vhost_vdpa_dev_start(dev, started); + + if (started) { + vhost_vdpa_host_notifiers_init(dev); + vhost_vdpa_set_vring_ready(dev); + } else { + vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs); + } + + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + if (started) { uint8_t status = 0; memory_listener_register(&v->listener, &address_space_memory); - vhost_vdpa_host_notifiers_init(dev); - vhost_vdpa_set_vring_ready(dev); vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK); vhost_vdpa_call(dev, VHOST_VDPA_GET_STATUS, &status); @@ -613,7 +647,6 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) vhost_vdpa_reset_device(dev); vhost_vdpa_add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER); - vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs); memory_listener_unregister(&v->listener); return 0; @@ -623,6 +656,10 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base, struct vhost_log *log) { + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + trace_vhost_vdpa_set_log_base(dev, base, log->size, log->refcnt, log->fd, log->log); return vhost_vdpa_call(dev, VHOST_SET_LOG_BASE, &base); @@ -688,6 +725,10 @@ static int vhost_vdpa_get_features(struct vhost_dev *dev, static int vhost_vdpa_set_owner(struct vhost_dev *dev) { + if (vhost_vdpa_one_time_request(dev)) { + return 0; + } + trace_vhost_vdpa_set_owner(dev); return vhost_vdpa_call(dev, VHOST_SET_OWNER, NULL); } From patchwork Wed Oct 20 10:20:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51ACFC433F5 for ; Wed, 20 Oct 2021 11:26:34 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 069AB611EF for ; Wed, 20 Oct 2021 11:26:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 069AB611EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:55046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9jt-0000S5-5v for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:26:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iN-0004uP-Ft for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iK-0003uy-GZ for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725251; 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=PfjOqB9kjBvbXknqljRNhTP69fh+V4ztljrYZwt0Bno=; b=gkSMh0hCeBNQRCljJ+vAjVAE2GIZnY/LouMlw7OO0U8Zuu9pPCvR+Nl0lustlypOTkcLST x7h16KY54oC3W7USxB7MmbseMDUq5HXFtrvI16hz89e1zT7nq+pXWRMtyDUGgPUiH1Vp82 sX4eAjmaA/mEpuO/k50W9qLxcyKU5Nc= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-525-QmFtfQzVNAyJXrMei_dbcQ-1; Wed, 20 Oct 2021 06:20:49 -0400 X-MC-Unique: QmFtfQzVNAyJXrMei_dbcQ-1 Received: by mail-ed1-f70.google.com with SMTP id l22-20020aa7c316000000b003dbbced0731so20532409edq.6 for ; Wed, 20 Oct 2021 03:20:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PfjOqB9kjBvbXknqljRNhTP69fh+V4ztljrYZwt0Bno=; b=vrlpbAVnARppkZ5Di+bsQvaA7OC7KEEfLHsVew9O3sUPHy2W8VCb2pxfUYC2jiTBnL /zbPkbIfUyd6P4WFXLKxvW38ZXc+zDXNfX7TbxHLPHY0vVcDDN2rwWRZZqt8NkAI9Ytj sVuF23E6MNGf6n9HOIN/1Ep+6bXyjsq03RV/imce9ta/V8rjIbu6Gl2bMrmigGk37Z9g jfDkeO3MMbBnXTfr+S147U0FmCeSWEJL9+Dk58ZvGLhCdHQqL3XdJmh8brwZHnKKNfmc CByIheTLZ2MIq6k7jRIjLLcWoVX+0MUjLxqsjgNzBpvp8VUiS3iKjQxrTp5WDqGSJiln 7XvQ== X-Gm-Message-State: AOAM533SiA5O+E/A197eW7Gfn5QU0cg57rjltEc73uiJzWIhs7SqBkiY 330zrOFHk16Jli+OMfsuxlWn24HbEW4xk0uyvsV4k6HzxAvXZr1khsBvL2mYpJ5yFaNuhA3aJpp vY4AwHPcfLbH0dS/Owu6FWR9FO7BhOyUlzon0OqoK3/m9y98NlMt+NPwBfJPs X-Received: by 2002:a17:906:3ac6:: with SMTP id z6mr44869028ejd.196.1634725248333; Wed, 20 Oct 2021 03:20:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUxRK8PgXjZSti2rOFUf1L/1fal+M+u+HX4MndySFTYSGrpvOSTeDFbWShWlx6G/fbBUbwdg== X-Received: by 2002:a17:906:3ac6:: with SMTP id z6mr44869001ejd.196.1634725248127; Wed, 20 Oct 2021 03:20:48 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id z4sm1028795edd.46.2021.10.20.03.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:47 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:45 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 33/44] vhost-vdpa: prepare for the multiqueue support Message-ID: <20211020101844.988480-34-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang Unlike vhost-kernel, vhost-vdpa adapts a single device multiqueue model. So we need to simply use virtqueue index as the vhost virtqueue index. This is a must for multiqueue to work for vhost-vdpa. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-4-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index ceb53613ba..8948fd316b 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -546,8 +546,8 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx) { assert(idx >= dev->vq_index && idx < dev->vq_index + dev->nvqs); - trace_vhost_vdpa_get_vq_index(dev, idx, idx - dev->vq_index); - return idx - dev->vq_index; + trace_vhost_vdpa_get_vq_index(dev, idx, idx); + return idx; } static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev) From patchwork Wed Oct 20 10:20:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29EFCC433F5 for ; Wed, 20 Oct 2021 11:10:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C960F613A0 for ; Wed, 20 Oct 2021 11:10:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C960F613A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:58902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9Um-0007Ys-Sn for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:10:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48556) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iP-0004ww-Du for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35345) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iM-0003wV-T2 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:20:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725253; 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=UTgVRpCR0nUBmFYLzdqJBENq3kGLdgdi4jGn1zHZWuU=; b=S4eY6elapz1l6enAli5N44Owp7WH958PzoJ0izDPgp7XyOYtNEqNYZHZbJMb3UP96JhUs0 XzpCzqo3dU4A+oq1+QM1AWZuzwa3nbjglqNJnP3lygvclIBg9J3tWt2zz0dWk6TDQ8TLsQ DeOHqFvpu2p3vatq35I6uvG4GeizybQ= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-443-wYlXZztlObqytxEpUoJiug-1; Wed, 20 Oct 2021 06:20:52 -0400 X-MC-Unique: wYlXZztlObqytxEpUoJiug-1 Received: by mail-ed1-f70.google.com with SMTP id c30-20020a50f61e000000b003daf3955d5aso20542749edn.4 for ; Wed, 20 Oct 2021 03:20:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UTgVRpCR0nUBmFYLzdqJBENq3kGLdgdi4jGn1zHZWuU=; b=PZ73w9DEitPPqdzpARvcvjsfZeZ50/u3v7pMq2wF3aVi9fZahrq2KD1KrGuLl9XdGO clBnPzd2xEjjJrTvFmOGqOzAWDHYUqfwUG4yXwZeVpM5Vc4rRK3Wqe6JNYmzUZrD4lUN jx7St61rtCLbJiSZ13GjFduhFsEs+8w9BVgihrnk5n3dR9DbxXn7ekRcWYfocZUftp6h iVTzm7yCDzQwf1eU5o0lpV5zDrGyOTi85DOhh0ZLzK4GgqES95ecctUpiNCclpP+Uvc7 SLCVGwV/vnd0wlOGLP47C/r8iYZqj61KFeA5FJLNubrEmTWCLfA9wE8B76d8d96LHnKr E5vg== X-Gm-Message-State: AOAM533zVq1FG/tDa2zydhTDQLrMYUWAlYvC5sBKMoiHaQiczuKwwKMZ LrqV9ASrcVxetZZ2y5mg3wEuaeRqlltdWEZyqtg094FQr8xwEWWLBWg97a5Y58HbwZfvMybdzCt bq7XflnrKMcmdaw70bdnbtwh/oI8zcJ+2EIBcBCUJ07k09zv4coURrRDY9AwQ X-Received: by 2002:a05:6402:35d6:: with SMTP id z22mr60301147edc.227.1634725250815; Wed, 20 Oct 2021 03:20:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEUPs8r6vEptz0MxgP6AxxNrexTFjrycgOrlcu0tFgVAHiOPXMLpLo+sUiCdB/jNZBNfvLCQ== X-Received: by 2002:a05:6402:35d6:: with SMTP id z22mr60301128edc.227.1634725250652; Wed, 20 Oct 2021 03:20:50 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id v21sm803031ejk.92.2021.10.20.03.20.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:50 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:48 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 34/44] vhost-vdpa: let net_vhost_vdpa_init() returns NetClientState * Message-ID: <20211020101844.988480-35-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch switches to let net_vhost_vdpa_init() to return NetClientState *. This is used for the callers to allocate multiqueue NetClientState for multiqueue support. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-5-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/vhost-vdpa.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index fd4ff5a0fb..151f60184d 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -169,8 +169,10 @@ static NetClientInfo net_vhost_vdpa_info = { .check_peer_type = vhost_vdpa_check_peer_type, }; -static int net_vhost_vdpa_init(NetClientState *peer, const char *device, - const char *name, int vdpa_device_fd) +static NetClientState *net_vhost_vdpa_init(NetClientState *peer, + const char *device, + const char *name, + int vdpa_device_fd) { NetClientState *nc = NULL; VhostVDPAState *s; @@ -184,15 +186,17 @@ static int net_vhost_vdpa_init(NetClientState *peer, const char *device, ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa); if (ret) { qemu_del_net_client(nc); + return NULL; } - return ret; + return nc; } int net_init_vhost_vdpa(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { const NetdevVhostVDPAOptions *opts; - int vdpa_device_fd, ret; + int vdpa_device_fd; + NetClientState *nc; assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); opts = &netdev->u.vhost_vdpa; @@ -202,10 +206,11 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, return -errno; } - ret = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd); - if (ret) { + nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd); + if (!nc) { qemu_close(vdpa_device_fd); + return -1; } - return ret; + return 0; } From patchwork Wed Oct 20 10:20:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6705CC433EF for ; Wed, 20 Oct 2021 11:28:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CDF061212 for ; Wed, 20 Oct 2021 11:28:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0CDF061212 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:59266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9ls-0003MY-5g for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:28:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48578) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iS-00058j-DU for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33654) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iQ-00040c-KB for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725258; 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=V3zgkgL9B3Vw0keIC20IKijqN9D0BqQFsfEDVquxzJQ=; b=TlXjfYLWXtEQsGQIA7O4fh1Ka/w4wSXCrhpiHqpJ9C5BiA7xTZElRPx2uTVH5P74LBMCHj oVvuh7mtanAhUrp801nC+Is2CESlVaTpiMREgg02uvL2ws/XUKbMJLVOFCdspiWvY8uDRU 3igFLzyQiGrZBGMRGpUCDMZBCzOS7rs= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-384--SYae-lqNFmbf-ZHalrjCg-1; Wed, 20 Oct 2021 06:20:54 -0400 X-MC-Unique: -SYae-lqNFmbf-ZHalrjCg-1 Received: by mail-ed1-f71.google.com with SMTP id s12-20020a50dacc000000b003dbf7a78e88so17491493edj.2 for ; Wed, 20 Oct 2021 03:20:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=V3zgkgL9B3Vw0keIC20IKijqN9D0BqQFsfEDVquxzJQ=; b=OHHFn4t6YBmYq1fn4a7FQcgDafWMr972dqJCDoW8YYNRHbbdCCKofO442IDeH4q1Yt ibPWshSlR00RfRnsWdztRaTFGZECMYYzmy8m7U5sEdXrdF37V0xSOLLuY+UjgCwqnWIA bV1bugfgZf8ADawdH9oHtgfeD/4cXpZuvi7Oyo7BbSpuIuAHGI4p31xK4u6SVifVni/1 aW3PBYyMJ/TDt44Td/nAN5nezwXIx3GCXdjJecrNWyq7f407aYtH5XHhFsP/2tXxPfX2 uiNuT0PlHP14Pz8J3AhL0pu0QPzVfBhjmJGaindtELa9VeNZZ3J1HoYmQhhtE8AHxMDB PJlQ== X-Gm-Message-State: AOAM531GZC4cD+EY6vP8rT0vBnUSSaXF3Tseh7nTEBYZqpI2VRTSDK7n mWij9gmK+oEBepw5xCUavV3LEAvEPhfiS3vjV5n+TLOcIYPGr9cBvNXg3wkbq0eRB68ErPL4q7J xx8NKqcF05VxXkbyV+aJlX6GWtG0UVaO4pgDAw/8bAETPJpbeuOsGCNLYyu0c X-Received: by 2002:a17:907:e94:: with SMTP id ho20mr45952457ejc.243.1634725253379; Wed, 20 Oct 2021 03:20:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVcy2vx3AjDaLv03O049q5gKnoxEg/JBe+VhIycZ8qzdi9ovNxUYHD75o3YlHVSxNvWKFq0A== X-Received: by 2002:a17:907:e94:: with SMTP id ho20mr45952441ejc.243.1634725253187; Wed, 20 Oct 2021 03:20:53 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id s24sm937248edy.38.2021.10.20.03.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:52 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:51 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 35/44] net: introduce control client Message-ID: <20211020101844.988480-36-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch introduces a boolean for the device has control queue which can accepts control command via network queue. The first user would be the control virtqueue support for vhost. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-6-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/net/net.h | 5 +++++ net/net.c | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/include/net/net.h b/include/net/net.h index 986288eb07..523136c7ac 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -105,6 +105,7 @@ struct NetClientState { int vnet_hdr_len; bool is_netdev; bool do_not_pad; /* do not pad to the minimum ethernet frame length */ + bool is_datapath; QTAILQ_HEAD(, NetFilterState) filters; }; @@ -136,6 +137,10 @@ NetClientState *qemu_new_net_client(NetClientInfo *info, NetClientState *peer, const char *model, const char *name); +NetClientState *qemu_new_net_control_client(NetClientInfo *info, + NetClientState *peer, + const char *model, + const char *name); NICState *qemu_new_nic(NetClientInfo *info, NICConf *conf, const char *model, diff --git a/net/net.c b/net/net.c index 52c99196c6..f0d14dbfc1 100644 --- a/net/net.c +++ b/net/net.c @@ -239,7 +239,8 @@ static void qemu_net_client_setup(NetClientState *nc, NetClientState *peer, const char *model, const char *name, - NetClientDestructor *destructor) + NetClientDestructor *destructor, + bool is_datapath) { nc->info = info; nc->model = g_strdup(model); @@ -258,6 +259,7 @@ static void qemu_net_client_setup(NetClientState *nc, nc->incoming_queue = qemu_new_net_queue(qemu_deliver_packet_iov, nc); nc->destructor = destructor; + nc->is_datapath = is_datapath; QTAILQ_INIT(&nc->filters); } @@ -272,7 +274,23 @@ NetClientState *qemu_new_net_client(NetClientInfo *info, nc = g_malloc0(info->size); qemu_net_client_setup(nc, info, peer, model, name, - qemu_net_client_destructor); + qemu_net_client_destructor, true); + + return nc; +} + +NetClientState *qemu_new_net_control_client(NetClientInfo *info, + NetClientState *peer, + const char *model, + const char *name) +{ + NetClientState *nc; + + assert(info->size >= sizeof(NetClientState)); + + nc = g_malloc0(info->size); + qemu_net_client_setup(nc, info, peer, model, name, + qemu_net_client_destructor, false); return nc; } @@ -297,7 +315,7 @@ NICState *qemu_new_nic(NetClientInfo *info, for (i = 0; i < queues; i++) { qemu_net_client_setup(&nic->ncs[i], info, peers[i], model, name, - NULL); + NULL, true); nic->ncs[i].queue_index = i; } From patchwork Wed Oct 20 10:20:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9348C433EF for ; Wed, 20 Oct 2021 11:17:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EC126103D for ; Wed, 20 Oct 2021 11:17:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6EC126103D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:47524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9Pu-0007y9-RI for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:05:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iT-00058o-3Q for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iR-00040i-48 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725258; 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=JuroMvBcXiNLBW7beY861j3G2/83t+PnZfmt852Mzro=; b=c+siUhBXTNPg9kYlXHL7D9jzapKFoWTBb76TH+tV3VodUFIwU1BVeZvgJJW567SZ3Vd+KP 6Bn1JEDUEnjQcPbE4915YMrq3fbYP1GIh6z6St9vg0zdkHxusHSG/zXHLNByQl29VMY6Mz JdhC5FzL889qfKEplXAPejzkLgj3/eQ= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-196-WSxwEhB8MoOGm1wYEs01xg-1; Wed, 20 Oct 2021 06:20:57 -0400 X-MC-Unique: WSxwEhB8MoOGm1wYEs01xg-1 Received: by mail-ed1-f71.google.com with SMTP id t28-20020a508d5c000000b003dad7fc5caeso3353482edt.11 for ; Wed, 20 Oct 2021 03:20:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JuroMvBcXiNLBW7beY861j3G2/83t+PnZfmt852Mzro=; b=INxBhMdwYayzaYtip8E3w1DTSBQVqY0VA/nypez5CoGw56tpeKHeX5aYFueBZboPEr navmYSB4JPgTdW1YR35CI8ZeZP447ONOQcN1odAwcVsKVikPnuGJeVrK+NJ2qnNuoe4n VQW+V39GyYxrwudh459m7VaGSknOBkf/nrk6jcGa1Hov7b5qeeSE51PwO7SLMYBN+TvG cpIexjhTD1mwSJR7+xusXfyyxho7jAb0PX7khY2fnIMqhop0uviFw4iC/3TWvneXCCU4 HT9UA5khcOblUvGdqnzfo2nkgwvPj3rOdkUaWKq39CmQaCxfyq3+7dBDfrl8vxhq3mBe LEMw== X-Gm-Message-State: AOAM5303n3f+O6cJGRdzGlT9A2d3YFifPEedj47JDh1Cj1nlptlVSBXJ xc6pdde6FjDEwB1DanVQVH3rNRDEpBT0Rny7d+q3HYcNGKEzUc8I1/QlzU8FDTLXFRaCql5GUnq znAHfiuMrWWT+J8Xq9KKkSVi9gWJG3JSLH3ZVvM9r5cGP9DAukPIWbrL0b+G2 X-Received: by 2002:a17:906:d196:: with SMTP id c22mr42611084ejz.231.1634725255654; Wed, 20 Oct 2021 03:20:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRJYUjWV9uLKEVfaeKDfEzR2KHENDR/Xn3o+Tp1/6myD52W5Ii56Krdx5xyHxorzMeNquVlw== X-Received: by 2002:a17:906:d196:: with SMTP id c22mr42611060ejz.231.1634725255400; Wed, 20 Oct 2021 03:20:55 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id hp3sm403966ejc.61.2021.10.20.03.20.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:55 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:53 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 36/44] vhost-net: control virtqueue support Message-ID: <20211020101844.988480-37-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang We assume there's no cvq in the past, this is not true when we need control virtqueue support for vhost-user backends. So this patch implements the control virtqueue support for vhost-net. As datapath, the control virtqueue is also required to be coupled with the NetClientState. The vhost_net_start/stop() are tweaked to accept the number of datapath queue pairs plus the the number of control virtqueue for us to start and stop the vhost device. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-7-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/net/vhost_net.h | 6 ++++-- hw/net/vhost_net-stub.c | 4 ++-- hw/net/vhost_net.c | 43 ++++++++++++++++++++++++++++++----------- hw/net/virtio-net.c | 4 ++-- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/include/net/vhost_net.h b/include/net/vhost_net.h index fba40cf695..387e913e4e 100644 --- a/include/net/vhost_net.h +++ b/include/net/vhost_net.h @@ -21,8 +21,10 @@ typedef struct VhostNetOptions { uint64_t vhost_net_get_max_queues(VHostNetState *net); struct vhost_net *vhost_net_init(VhostNetOptions *options); -int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, int total_queues); -void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, int total_queues); +int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, + int data_queue_pairs, int cvq); +void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, + int data_queue_pairs, int cvq); void vhost_net_cleanup(VHostNetState *net); diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c index a7f4252630..89d71cfb8e 100644 --- a/hw/net/vhost_net-stub.c +++ b/hw/net/vhost_net-stub.c @@ -33,13 +33,13 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - int total_queues) + int data_queue_pairs, int cvq) { return -ENOSYS; } void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, - int total_queues) + int data_queue_pairs, int cvq) { } diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 386ec2eaa2..e1e9d1ec89 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -315,11 +315,14 @@ static void vhost_net_stop_one(struct vhost_net *net, } int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, - int total_queues) + int data_queue_pairs, int cvq) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); + int total_notifiers = data_queue_pairs * 2 + cvq; + VirtIONet *n = VIRTIO_NET(dev); + int nvhosts = data_queue_pairs + cvq; struct vhost_net *net; int r, e, i; NetClientState *peer; @@ -329,9 +332,14 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, return -ENOSYS; } - for (i = 0; i < total_queues; i++) { + for (i = 0; i < nvhosts; i++) { + + if (i < data_queue_pairs) { + peer = qemu_get_peer(ncs, i); + } else { /* Control Virtqueue */ + peer = qemu_get_peer(ncs, n->max_queues); + } - peer = qemu_get_peer(ncs, i); net = get_vhost_net(peer); vhost_net_set_vq_index(net, i * 2); @@ -344,14 +352,18 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, } } - r = k->set_guest_notifiers(qbus->parent, total_queues * 2, true); + r = k->set_guest_notifiers(qbus->parent, total_notifiers, true); if (r < 0) { error_report("Error binding guest notifier: %d", -r); goto err; } - for (i = 0; i < total_queues; i++) { - peer = qemu_get_peer(ncs, i); + for (i = 0; i < nvhosts; i++) { + if (i < data_queue_pairs) { + peer = qemu_get_peer(ncs, i); + } else { + peer = qemu_get_peer(ncs, n->max_queues); + } r = vhost_net_start_one(get_vhost_net(peer), dev); if (r < 0) { @@ -375,7 +387,7 @@ err_start: peer = qemu_get_peer(ncs , i); vhost_net_stop_one(get_vhost_net(peer), dev); } - e = k->set_guest_notifiers(qbus->parent, total_queues * 2, false); + e = k->set_guest_notifiers(qbus->parent, total_notifiers, false); if (e < 0) { fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", e); fflush(stderr); @@ -385,18 +397,27 @@ err: } void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, - int total_queues) + int data_queue_pairs, int cvq) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(dev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); + VirtIONet *n = VIRTIO_NET(dev); + NetClientState *peer; + int total_notifiers = data_queue_pairs * 2 + cvq; + int nvhosts = data_queue_pairs + cvq; int i, r; - for (i = 0; i < total_queues; i++) { - vhost_net_stop_one(get_vhost_net(ncs[i].peer), dev); + for (i = 0; i < nvhosts; i++) { + if (i < data_queue_pairs) { + peer = qemu_get_peer(ncs, i); + } else { + peer = qemu_get_peer(ncs, n->max_queues); + } + vhost_net_stop_one(get_vhost_net(peer), dev); } - r = k->set_guest_notifiers(qbus->parent, total_queues * 2, false); + r = k->set_guest_notifiers(qbus->parent, total_notifiers, false); if (r < 0) { fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r); fflush(stderr); diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 3dd2896ff9..5ee6729662 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -285,14 +285,14 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) } n->vhost_started = 1; - r = vhost_net_start(vdev, n->nic->ncs, queues); + r = vhost_net_start(vdev, n->nic->ncs, queues, 0); if (r < 0) { error_report("unable to start vhost net: %d: " "falling back on userspace virtio", -r); n->vhost_started = 0; } } else { - vhost_net_stop(vdev, n->nic->ncs, queues); + vhost_net_stop(vdev, n->nic->ncs, queues, 0); n->vhost_started = 0; } } From patchwork Wed Oct 20 10:20:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572119 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C90C433F5 for ; Wed, 20 Oct 2021 11:13:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 172E360E76 for ; Wed, 20 Oct 2021 11:13:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 172E360E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:38018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9X6-0004Ud-Jq for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:13:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iZ-0005JB-2F for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iW-00043m-3j for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725262; 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=wQesCsdUsLN+LNqo4fIIbYcMhVk342ubVnNZXwhjm6Y=; b=Vxj9lM9AVeP2Dq13TLpvBQAXFQIumg+i+8VHwcsnW8TokkiHE1TrnX4boqsRWkw6LGs0Ox jw0v1h61su0pbPgjBlWhIMNXQRn+FR4Lx1ODjqpbsbTk3k8x01SBWj0HOHOl3YZRNHQyyb 35d7TpXOLu/UESISqBT9wOXP2MoxCXk= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-GBvKhxr7OqqMET0bdiVEoQ-1; Wed, 20 Oct 2021 06:21:00 -0400 X-MC-Unique: GBvKhxr7OqqMET0bdiVEoQ-1 Received: by mail-ed1-f71.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20620360edv.9 for ; Wed, 20 Oct 2021 03:21:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=wQesCsdUsLN+LNqo4fIIbYcMhVk342ubVnNZXwhjm6Y=; b=X5aBXRM+R3bEU3u2JXbZ2fcYlIQL+bUi7hHyg8P0AmYMotHmOTNETnQ+Pm5Xmd0xBg sp5Dl1WsTwJQR0QzuzAt8iDqXZ7qMmlRU1Xg+ggERTLQHcPgipARFRQXlA+KDDjLjnhP FU0k8erGOIsnrtmX0l8MNF0KUWTv4z/JAOK4C4nHioAp6bZiEpsBA+uteciWTHPfDGJk TiB6dg3XomYAJfGbY1lytz9/4ZMAzDcB8qCtJnmOd5/fnPaA185kqD5MmG4MmKLK+Wez QnQK+U3yq5GTqKkiYtbp8tD6UpqzbaKoAq2nt84yDISic08wgdBgZURx/IrZImri8R3x yg5w== X-Gm-Message-State: AOAM530F5PunkjodWkQO8xTMzVMU+l6QMUqBFXPUZegnkvkMICMtBWX9 CGrnkxkiZpY6NRF57xJelY2iljl41yq+PsEhjpfKQloYRRVibLl47Q43SbjTLZgQ1Ur3wzH7NdI Yk998xxKwFWV6Hp7uV7PuqsdpgEKAChRFjZRqV1kNklXyauq1R9PJDmr8i3dW X-Received: by 2002:a50:e1cf:: with SMTP id m15mr61646730edl.181.1634725258569; Wed, 20 Oct 2021 03:20:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfAOCNHJ2WYXSSZrrs232VwdqyldPqpBnaWyOLlUbIIYSMeV/r8hUv9rEgPVaes5pWUB3cPQ== X-Received: by 2002:a50:e1cf:: with SMTP id m15mr61646688edl.181.1634725258039; Wed, 20 Oct 2021 03:20:58 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id r22sm797479ejd.109.2021.10.20.03.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:20:57 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:55 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 37/44] virtio-net: use "queue_pairs" instead of "queues" when possible Message-ID: <20211020101844.988480-38-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang Most of the time, "queues" really means queue pairs. So this patch switch to use "queue_pairs" to avoid confusion. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-8-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-net.h | 4 +- hw/net/vhost_net.c | 6 +- hw/net/virtio-net.c | 150 ++++++++++++++++----------------- 3 files changed, 80 insertions(+), 80 deletions(-) diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 74a10ebe85..2903b79a92 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -194,8 +194,8 @@ struct VirtIONet { NICConf nic_conf; DeviceState *qdev; int multiqueue; - uint16_t max_queues; - uint16_t curr_queues; + uint16_t max_queue_pairs; + uint16_t curr_queue_pairs; size_t config_size; char *netclient_name; char *netclient_type; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e1e9d1ec89..2b594b4642 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -337,7 +337,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, if (i < data_queue_pairs) { peer = qemu_get_peer(ncs, i); } else { /* Control Virtqueue */ - peer = qemu_get_peer(ncs, n->max_queues); + peer = qemu_get_peer(ncs, n->max_queue_pairs); } net = get_vhost_net(peer); @@ -362,7 +362,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, if (i < data_queue_pairs) { peer = qemu_get_peer(ncs, i); } else { - peer = qemu_get_peer(ncs, n->max_queues); + peer = qemu_get_peer(ncs, n->max_queue_pairs); } r = vhost_net_start_one(get_vhost_net(peer), dev); @@ -412,7 +412,7 @@ void vhost_net_stop(VirtIODevice *dev, NetClientState *ncs, if (i < data_queue_pairs) { peer = qemu_get_peer(ncs, i); } else { - peer = qemu_get_peer(ncs, n->max_queues); + peer = qemu_get_peer(ncs, n->max_queue_pairs); } vhost_net_stop_one(get_vhost_net(peer), dev); } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5ee6729662..7594f7ea92 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -54,7 +54,7 @@ #define VIRTIO_NET_RX_QUEUE_DEFAULT_SIZE 256 #define VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE 256 -/* for now, only allow larger queues; with virtio-1, guest can downsize */ +/* for now, only allow larger queue_pairs; with virtio-1, guest can downsize */ #define VIRTIO_NET_RX_QUEUE_MIN_SIZE VIRTIO_NET_RX_QUEUE_DEFAULT_SIZE #define VIRTIO_NET_TX_QUEUE_MIN_SIZE VIRTIO_NET_TX_QUEUE_DEFAULT_SIZE @@ -131,7 +131,7 @@ static void virtio_net_get_config(VirtIODevice *vdev, uint8_t *config) int ret = 0; memset(&netcfg, 0 , sizeof(struct virtio_net_config)); virtio_stw_p(vdev, &netcfg.status, n->status); - virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queues); + virtio_stw_p(vdev, &netcfg.max_virtqueue_pairs, n->max_queue_pairs); virtio_stw_p(vdev, &netcfg.mtu, n->net_conf.mtu); memcpy(netcfg.mac, n->mac, ETH_ALEN); virtio_stl_p(vdev, &netcfg.speed, n->net_conf.speed); @@ -243,7 +243,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) { VirtIODevice *vdev = VIRTIO_DEVICE(n); NetClientState *nc = qemu_get_queue(n->nic); - int queues = n->multiqueue ? n->max_queues : 1; + int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1; if (!get_vhost_net(nc->peer)) { return; @@ -266,7 +266,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) /* Any packets outstanding? Purge them to avoid touching rings * when vhost is running. */ - for (i = 0; i < queues; i++) { + for (i = 0; i < queue_pairs; i++) { NetClientState *qnc = qemu_get_subqueue(n->nic, i); /* Purge both directions: TX and RX. */ @@ -285,14 +285,14 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) } n->vhost_started = 1; - r = vhost_net_start(vdev, n->nic->ncs, queues, 0); + r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, 0); if (r < 0) { error_report("unable to start vhost net: %d: " "falling back on userspace virtio", -r); n->vhost_started = 0; } } else { - vhost_net_stop(vdev, n->nic->ncs, queues, 0); + vhost_net_stop(vdev, n->nic->ncs, queue_pairs, 0); n->vhost_started = 0; } } @@ -309,11 +309,11 @@ static int virtio_net_set_vnet_endian_one(VirtIODevice *vdev, } static bool virtio_net_set_vnet_endian(VirtIODevice *vdev, NetClientState *ncs, - int queues, bool enable) + int queue_pairs, bool enable) { int i; - for (i = 0; i < queues; i++) { + for (i = 0; i < queue_pairs; i++) { if (virtio_net_set_vnet_endian_one(vdev, ncs[i].peer, enable) < 0 && enable) { while (--i >= 0) { @@ -330,7 +330,7 @@ static bool virtio_net_set_vnet_endian(VirtIODevice *vdev, NetClientState *ncs, static void virtio_net_vnet_endian_status(VirtIONet *n, uint8_t status) { VirtIODevice *vdev = VIRTIO_DEVICE(n); - int queues = n->multiqueue ? n->max_queues : 1; + int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1; if (virtio_net_started(n, status)) { /* Before using the device, we tell the network backend about the @@ -339,14 +339,14 @@ static void virtio_net_vnet_endian_status(VirtIONet *n, uint8_t status) * virtio-net code. */ n->needs_vnet_hdr_swap = virtio_net_set_vnet_endian(vdev, n->nic->ncs, - queues, true); + queue_pairs, true); } else if (virtio_net_started(n, vdev->status)) { /* After using the device, we need to reset the network backend to * the default (guest native endianness), otherwise the guest may * lose network connectivity if it is rebooted into a different * endianness. */ - virtio_net_set_vnet_endian(vdev, n->nic->ncs, queues, false); + virtio_net_set_vnet_endian(vdev, n->nic->ncs, queue_pairs, false); } } @@ -368,12 +368,12 @@ static void virtio_net_set_status(struct VirtIODevice *vdev, uint8_t status) virtio_net_vnet_endian_status(n, status); virtio_net_vhost_status(n, status); - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { NetClientState *ncs = qemu_get_subqueue(n->nic, i); bool queue_started; q = &n->vqs[i]; - if ((!n->multiqueue && i != 0) || i >= n->curr_queues) { + if ((!n->multiqueue && i != 0) || i >= n->curr_queue_pairs) { queue_status = 0; } else { queue_status = status; @@ -540,7 +540,7 @@ static void virtio_net_reset(VirtIODevice *vdev) n->nouni = 0; n->nobcast = 0; /* multiqueue is disabled by default */ - n->curr_queues = 1; + n->curr_queue_pairs = 1; timer_del(n->announce_timer.tm); n->announce_timer.round = 0; n->status &= ~VIRTIO_NET_S_ANNOUNCE; @@ -556,7 +556,7 @@ static void virtio_net_reset(VirtIODevice *vdev) memset(n->vlans, 0, MAX_VLAN >> 3); /* Flush any async TX */ - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { NetClientState *nc = qemu_get_subqueue(n->nic, i); if (nc->peer) { @@ -610,7 +610,7 @@ static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs, sizeof(struct virtio_net_hdr); } - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { nc = qemu_get_subqueue(n->nic, i); if (peer_has_vnet_hdr(n) && @@ -655,7 +655,7 @@ static int peer_attach(VirtIONet *n, int index) return 0; } - if (n->max_queues == 1) { + if (n->max_queue_pairs == 1) { return 0; } @@ -681,7 +681,7 @@ static int peer_detach(VirtIONet *n, int index) return tap_disable(nc->peer); } -static void virtio_net_set_queues(VirtIONet *n) +static void virtio_net_set_queue_pairs(VirtIONet *n) { int i; int r; @@ -690,8 +690,8 @@ static void virtio_net_set_queues(VirtIONet *n) return; } - for (i = 0; i < n->max_queues; i++) { - if (i < n->curr_queues) { + for (i = 0; i < n->max_queue_pairs; i++) { + if (i < n->curr_queue_pairs) { r = peer_attach(n, i); assert(!r); } else { @@ -905,7 +905,7 @@ static void virtio_net_set_features(VirtIODevice *vdev, uint64_t features) virtio_net_apply_guest_offloads(n); } - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { NetClientState *nc = qemu_get_subqueue(n->nic, i); if (!get_vhost_net(nc->peer)) { @@ -1232,7 +1232,7 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n, VirtIODevice *vdev = VIRTIO_DEVICE(n); struct virtio_net_rss_config cfg; size_t s, offset = 0, size_get; - uint16_t queues, i; + uint16_t queue_pairs, i; struct { uint16_t us; uint8_t b; @@ -1274,7 +1274,7 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n, } n->rss_data.default_queue = do_rss ? virtio_lduw_p(vdev, &cfg.unclassified_queue) : 0; - if (n->rss_data.default_queue >= n->max_queues) { + if (n->rss_data.default_queue >= n->max_queue_pairs) { err_msg = "Invalid default queue"; err_value = n->rss_data.default_queue; goto error; @@ -1303,14 +1303,14 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n, size_get = sizeof(temp); s = iov_to_buf(iov, iov_cnt, offset, &temp, size_get); if (s != size_get) { - err_msg = "Can't get queues"; + err_msg = "Can't get queue_pairs"; err_value = (uint32_t)s; goto error; } - queues = do_rss ? virtio_lduw_p(vdev, &temp.us) : n->curr_queues; - if (queues == 0 || queues > n->max_queues) { - err_msg = "Invalid number of queues"; - err_value = queues; + queue_pairs = do_rss ? virtio_lduw_p(vdev, &temp.us) : n->curr_queue_pairs; + if (queue_pairs == 0 || queue_pairs > n->max_queue_pairs) { + err_msg = "Invalid number of queue_pairs"; + err_value = queue_pairs; goto error; } if (temp.b > VIRTIO_NET_RSS_MAX_KEY_SIZE) { @@ -1325,7 +1325,7 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n, } if (!temp.b && !n->rss_data.hash_types) { virtio_net_disable_rss(n); - return queues; + return queue_pairs; } offset += size_get; size_get = temp.b; @@ -1358,7 +1358,7 @@ static uint16_t virtio_net_handle_rss(VirtIONet *n, trace_virtio_net_rss_enable(n->rss_data.hash_types, n->rss_data.indirections_len, temp.b); - return queues; + return queue_pairs; error: trace_virtio_net_rss_error(err_msg, err_value); virtio_net_disable_rss(n); @@ -1369,15 +1369,15 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd, struct iovec *iov, unsigned int iov_cnt) { VirtIODevice *vdev = VIRTIO_DEVICE(n); - uint16_t queues; + uint16_t queue_pairs; virtio_net_disable_rss(n); if (cmd == VIRTIO_NET_CTRL_MQ_HASH_CONFIG) { - queues = virtio_net_handle_rss(n, iov, iov_cnt, false); - return queues ? VIRTIO_NET_OK : VIRTIO_NET_ERR; + queue_pairs = virtio_net_handle_rss(n, iov, iov_cnt, false); + return queue_pairs ? VIRTIO_NET_OK : VIRTIO_NET_ERR; } if (cmd == VIRTIO_NET_CTRL_MQ_RSS_CONFIG) { - queues = virtio_net_handle_rss(n, iov, iov_cnt, true); + queue_pairs = virtio_net_handle_rss(n, iov, iov_cnt, true); } else if (cmd == VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET) { struct virtio_net_ctrl_mq mq; size_t s; @@ -1388,24 +1388,24 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd, if (s != sizeof(mq)) { return VIRTIO_NET_ERR; } - queues = virtio_lduw_p(vdev, &mq.virtqueue_pairs); + queue_pairs = virtio_lduw_p(vdev, &mq.virtqueue_pairs); } else { return VIRTIO_NET_ERR; } - if (queues < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN || - queues > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX || - queues > n->max_queues || + if (queue_pairs < VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN || + queue_pairs > VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX || + queue_pairs > n->max_queue_pairs || !n->multiqueue) { return VIRTIO_NET_ERR; } - n->curr_queues = queues; - /* stop the backend before changing the number of queues to avoid handling a + n->curr_queue_pairs = queue_pairs; + /* stop the backend before changing the number of queue_pairs to avoid handling a * disabled queue */ virtio_net_set_status(vdev, vdev->status); - virtio_net_set_queues(n); + virtio_net_set_queue_pairs(n); return VIRTIO_NET_OK; } @@ -1483,7 +1483,7 @@ static bool virtio_net_can_receive(NetClientState *nc) return false; } - if (nc->queue_index >= n->curr_queues) { + if (nc->queue_index >= n->curr_queue_pairs) { return false; } @@ -2763,11 +2763,11 @@ static void virtio_net_del_queue(VirtIONet *n, int index) virtio_del_queue(vdev, index * 2 + 1); } -static void virtio_net_change_num_queues(VirtIONet *n, int new_max_queues) +static void virtio_net_change_num_queue_pairs(VirtIONet *n, int new_max_queue_pairs) { VirtIODevice *vdev = VIRTIO_DEVICE(n); int old_num_queues = virtio_get_num_queues(vdev); - int new_num_queues = new_max_queues * 2 + 1; + int new_num_queues = new_max_queue_pairs * 2 + 1; int i; assert(old_num_queues >= 3); @@ -2800,12 +2800,12 @@ static void virtio_net_change_num_queues(VirtIONet *n, int new_max_queues) static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue) { - int max = multiqueue ? n->max_queues : 1; + int max = multiqueue ? n->max_queue_pairs : 1; n->multiqueue = multiqueue; - virtio_net_change_num_queues(n, max); + virtio_net_change_num_queue_pairs(n, max); - virtio_net_set_queues(n); + virtio_net_set_queue_pairs(n); } static int virtio_net_post_load_device(void *opaque, int version_id) @@ -2838,7 +2838,7 @@ static int virtio_net_post_load_device(void *opaque, int version_id) */ n->saved_guest_offloads = n->curr_guest_offloads; - virtio_net_set_queues(n); + virtio_net_set_queue_pairs(n); /* Find the first multicast entry in the saved MAC filter */ for (i = 0; i < n->mac_table.in_use; i++) { @@ -2851,7 +2851,7 @@ static int virtio_net_post_load_device(void *opaque, int version_id) /* nc.link_down can't be migrated, so infer link_down according * to link status bit in n->status */ link_down = (n->status & VIRTIO_NET_S_LINK_UP) == 0; - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { qemu_get_subqueue(n->nic, i)->link_down = link_down; } @@ -2916,9 +2916,9 @@ static const VMStateDescription vmstate_virtio_net_queue_tx_waiting = { }, }; -static bool max_queues_gt_1(void *opaque, int version_id) +static bool max_queue_pairs_gt_1(void *opaque, int version_id) { - return VIRTIO_NET(opaque)->max_queues > 1; + return VIRTIO_NET(opaque)->max_queue_pairs > 1; } static bool has_ctrl_guest_offloads(void *opaque, int version_id) @@ -2943,13 +2943,13 @@ static bool mac_table_doesnt_fit(void *opaque, int version_id) struct VirtIONetMigTmp { VirtIONet *parent; VirtIONetQueue *vqs_1; - uint16_t curr_queues_1; + uint16_t curr_queue_pairs_1; uint8_t has_ufo; uint32_t has_vnet_hdr; }; /* The 2nd and subsequent tx_waiting flags are loaded later than - * the 1st entry in the queues and only if there's more than one + * the 1st entry in the queue_pairs and only if there's more than one * entry. We use the tmp mechanism to calculate a temporary * pointer and count and also validate the count. */ @@ -2959,9 +2959,9 @@ static int virtio_net_tx_waiting_pre_save(void *opaque) struct VirtIONetMigTmp *tmp = opaque; tmp->vqs_1 = tmp->parent->vqs + 1; - tmp->curr_queues_1 = tmp->parent->curr_queues - 1; - if (tmp->parent->curr_queues == 0) { - tmp->curr_queues_1 = 0; + tmp->curr_queue_pairs_1 = tmp->parent->curr_queue_pairs - 1; + if (tmp->parent->curr_queue_pairs == 0) { + tmp->curr_queue_pairs_1 = 0; } return 0; @@ -2974,9 +2974,9 @@ static int virtio_net_tx_waiting_pre_load(void *opaque) /* Reuse the pointer setup from save */ virtio_net_tx_waiting_pre_save(opaque); - if (tmp->parent->curr_queues > tmp->parent->max_queues) { - error_report("virtio-net: curr_queues %x > max_queues %x", - tmp->parent->curr_queues, tmp->parent->max_queues); + if (tmp->parent->curr_queue_pairs > tmp->parent->max_queue_pairs) { + error_report("virtio-net: curr_queue_pairs %x > max_queue_pairs %x", + tmp->parent->curr_queue_pairs, tmp->parent->max_queue_pairs); return -EINVAL; } @@ -2990,7 +2990,7 @@ static const VMStateDescription vmstate_virtio_net_tx_waiting = { .pre_save = virtio_net_tx_waiting_pre_save, .fields = (VMStateField[]) { VMSTATE_STRUCT_VARRAY_POINTER_UINT16(vqs_1, struct VirtIONetMigTmp, - curr_queues_1, + curr_queue_pairs_1, vmstate_virtio_net_queue_tx_waiting, struct VirtIONetQueue), VMSTATE_END_OF_LIST() @@ -3132,9 +3132,9 @@ static const VMStateDescription vmstate_virtio_net_device = { VMSTATE_UINT8(nobcast, VirtIONet), VMSTATE_WITH_TMP(VirtIONet, struct VirtIONetMigTmp, vmstate_virtio_net_has_ufo), - VMSTATE_SINGLE_TEST(max_queues, VirtIONet, max_queues_gt_1, 0, + VMSTATE_SINGLE_TEST(max_queue_pairs, VirtIONet, max_queue_pairs_gt_1, 0, vmstate_info_uint16_equal, uint16_t), - VMSTATE_UINT16_TEST(curr_queues, VirtIONet, max_queues_gt_1), + VMSTATE_UINT16_TEST(curr_queue_pairs, VirtIONet, max_queue_pairs_gt_1), VMSTATE_WITH_TMP(VirtIONet, struct VirtIONetMigTmp, vmstate_virtio_net_tx_waiting), VMSTATE_UINT64_TEST(curr_guest_offloads, VirtIONet, @@ -3411,16 +3411,16 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) return; } - n->max_queues = MAX(n->nic_conf.peers.queues, 1); - if (n->max_queues * 2 + 1 > VIRTIO_QUEUE_MAX) { - error_setg(errp, "Invalid number of queues (= %" PRIu32 "), " + n->max_queue_pairs = MAX(n->nic_conf.peers.queues, 1); + if (n->max_queue_pairs * 2 + 1 > VIRTIO_QUEUE_MAX) { + error_setg(errp, "Invalid number of queue_pairs (= %" PRIu32 "), " "must be a positive integer less than %d.", - n->max_queues, (VIRTIO_QUEUE_MAX - 1) / 2); + n->max_queue_pairs, (VIRTIO_QUEUE_MAX - 1) / 2); virtio_cleanup(vdev); return; } - n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queues); - n->curr_queues = 1; + n->vqs = g_malloc0(sizeof(VirtIONetQueue) * n->max_queue_pairs); + n->curr_queue_pairs = 1; n->tx_timeout = n->net_conf.txtimer; if (n->net_conf.tx && strcmp(n->net_conf.tx, "timer") @@ -3434,7 +3434,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) n->net_conf.tx_queue_size = MIN(virtio_net_max_tx_queue_size(n), n->net_conf.tx_queue_size); - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { virtio_net_add_queue(n, i); } @@ -3458,13 +3458,13 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) object_get_typename(OBJECT(dev)), dev->id, n); } - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { n->nic->ncs[i].do_not_pad = true; } peer_test_vnet_hdr(n); if (peer_has_vnet_hdr(n)) { - for (i = 0; i < n->max_queues; i++) { + for (i = 0; i < n->max_queue_pairs; i++) { qemu_using_vnet_hdr(qemu_get_subqueue(n->nic, i)->peer, true); } n->host_hdr_len = sizeof(struct virtio_net_hdr); @@ -3506,7 +3506,7 @@ static void virtio_net_device_unrealize(DeviceState *dev) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VirtIONet *n = VIRTIO_NET(dev); - int i, max_queues; + int i, max_queue_pairs; if (virtio_has_feature(n->host_features, VIRTIO_NET_F_RSS)) { virtio_net_unload_ebpf(n); @@ -3531,12 +3531,12 @@ static void virtio_net_device_unrealize(DeviceState *dev) assert(n->primary_opts == NULL); } - max_queues = n->multiqueue ? n->max_queues : 1; - for (i = 0; i < max_queues; i++) { + max_queue_pairs = n->multiqueue ? n->max_queue_pairs : 1; + for (i = 0; i < max_queue_pairs; i++) { virtio_net_del_queue(n, i); } /* delete also control vq */ - virtio_del_queue(vdev, max_queues * 2); + virtio_del_queue(vdev, max_queue_pairs * 2); qemu_announce_timer_del(&n->announce_timer, false); g_free(n->vqs); qemu_del_nic(n->nic); From patchwork Wed Oct 20 10:20:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23834C433F5 for ; Wed, 20 Oct 2021 11:09:20 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0A3D6138F for ; Wed, 20 Oct 2021 11:09:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0A3D6138F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:56190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9TC-0005df-Su for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:09:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48646) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ia-0005O1-Of for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iW-000453-B2 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725263; 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=Ai2Qvc212R3zI/Nbr9LDsjvIFwluFt8YV+JlbaRw4oQ=; b=gbt0Mj2HTP6+EaKeJax1vQhIaXhcwybveMuUyV9vFgdvRqci1OvGabD9Xvybmlye9WcWZv 7tjH1CUN5O16aEMYwUp2Es6PwU1DAl8abHvGnUfHdJAOk6tsi0+lZEfrL5CbuQaiBx+irU w3mQDIKlvyjieF6G0vXckUaMHDr1R38= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-124-dcuxVrUiMlSW26ZyYUlMtg-1; Wed, 20 Oct 2021 06:21:02 -0400 X-MC-Unique: dcuxVrUiMlSW26ZyYUlMtg-1 Received: by mail-ed1-f70.google.com with SMTP id u10-20020a50d94a000000b003dc51565894so13849965edj.21 for ; Wed, 20 Oct 2021 03:21:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Ai2Qvc212R3zI/Nbr9LDsjvIFwluFt8YV+JlbaRw4oQ=; b=n+bDhC9J/3abrz6BDH9SkYo3AjMj88gRryx6rC8+3OR+87tnYrKBb3Plw2N+2WwErh mMPbSLB2M8R0dnPnfnBHcoTfHkhSYM8q4fLFLq3XWH0mbkpWwR0zcL2VDHe1Hv25UYy/ gYcVqkfe1/BFJM5jAIxT7CW2mBp6MXKjIk9DcuwDtNLSDXs54DQir53CDAVAAdXHGvbq AI7A4q1E006j177MHfLx8XA1g10r1ry9HETeVfGEVU0nroHRGrLGj+MdUeVhzgzq0QD8 oOt+EBAkn2+uNNexk//G4xCB2Xtoqashi0avuMS9sUuqKJBxAav5FiZ9k8axNXfC/KH5 /T+w== X-Gm-Message-State: AOAM5301Jq0w1vtqf4ItF9NHTgxNxPpcdMQJwPmGCi8CFW8+xun/W3FV f4/Cs2k27bmJirybmW3sSAkK7E97lLnagP7ihMzivmhCdRWkxbcdLhcIKow68cGCCLTDaLwR0kA ROwXOalupz90XUHKmV5VefXbpgzHR8RUUKP4XqV65zqbyul1ColXzJzuSeEGz X-Received: by 2002:a17:906:8283:: with SMTP id h3mr46267206ejx.460.1634725260959; Wed, 20 Oct 2021 03:21:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGz0O/YTz7Bq0Bh4Kr6ooDUD7e7Q9DpKzEe8bcP96p5pn9tUYuP7sNTedH9X1bQbyPnicd3Q== X-Received: by 2002:a17:906:8283:: with SMTP id h3mr46267184ejx.460.1634725260646; Wed, 20 Oct 2021 03:21:00 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id z19sm818212ejw.44.2021.10.20.03.20.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:00 -0700 (PDT) Date: Wed, 20 Oct 2021 06:20:58 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 38/44] vhost: record the last virtqueue index for the virtio device Message-ID: <20211020101844.988480-39-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch introduces a new field in the vhost_dev structure to record the last virtqueue index for the virtio device. This will be useful for the vhost backends with 1:N model to start or stop the device after all the vhost_dev structures were started or stopped. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-9-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/vhost.h | 2 ++ hw/net/vhost_net.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/hw/virtio/vhost.h b/include/hw/virtio/vhost.h index 1a9fc65089..3fa0b554ef 100644 --- a/include/hw/virtio/vhost.h +++ b/include/hw/virtio/vhost.h @@ -74,6 +74,8 @@ struct vhost_dev { unsigned int nvqs; /* the first virtqueue which would be used by this vhost dev */ int vq_index; + /* the last vq index for the virtio device (not vhost) */ + int last_index; /* if non-zero, minimum required value for max_queues */ int num_queues; uint64_t features; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 2b594b4642..3aabab06ea 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -231,9 +231,11 @@ fail: return NULL; } -static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index) +static void vhost_net_set_vq_index(struct vhost_net *net, int vq_index, + int last_index) { net->dev.vq_index = vq_index; + net->dev.last_index = last_index; } static int vhost_net_start_one(struct vhost_net *net, @@ -324,9 +326,13 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, VirtIONet *n = VIRTIO_NET(dev); int nvhosts = data_queue_pairs + cvq; struct vhost_net *net; - int r, e, i; + int r, e, i, last_index = data_qps * 2; NetClientState *peer; + if (!cvq) { + last_index -= 1; + } + if (!k->set_guest_notifiers) { error_report("binding does not support guest notifiers"); return -ENOSYS; @@ -341,7 +347,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, } net = get_vhost_net(peer); - vhost_net_set_vq_index(net, i * 2); + vhost_net_set_vq_index(net, i * 2, last_index); /* Suppress the masking guest notifiers on vhost user * because vhost user doesn't interrupt masking/unmasking From patchwork Wed Oct 20 10:21:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35B16C433EF for ; Wed, 20 Oct 2021 10:48:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D5ACC6115B for ; Wed, 20 Oct 2021 10:48:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D5ACC6115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:43046 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md99G-0001bd-83 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:48:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ic-0005T4-L6 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:25991) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iZ-00048V-TL for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725267; 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=Nnn/3HRVnUNWCx0Wv3BkTqbCVqECd/CHiliKI8a4Djg=; b=GHLZdZAmtVY/X5X3lw1AH6warmxLB+q3ABBJ/Y6dXz9E6b4ZTsEI73Ok0I3AXq1hNtt+i1 EUShCHYaS4FLSwjPcVL3cpSEuxmFCeXfz53L1X+1mNbDBNF4++4AUaF75Tu0Rme61KM02p B9KtEm1Xqi/XaKYhYAbfgP2eO8f8UaU= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-TUqOgmeqNBSAiAG0pcQIQg-1; Wed, 20 Oct 2021 06:21:05 -0400 X-MC-Unique: TUqOgmeqNBSAiAG0pcQIQg-1 Received: by mail-ed1-f70.google.com with SMTP id t18-20020a056402021200b003db9e6b0e57so20538087edv.10 for ; Wed, 20 Oct 2021 03:21:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Nnn/3HRVnUNWCx0Wv3BkTqbCVqECd/CHiliKI8a4Djg=; b=J33vNcbb8xeX68FdxsECfH1+2V27qM+N7070N+7BP8NAF0vZ5T6ODTzvblh+BeNwTG OV2YMfXkDCWO34WneqZuvYPuiD5PAVwQJBD+R+0rnXvOSEP3u3IDS5NYUb0XnoC5MpO8 jClvkCMoE8XKe/XLb33gjWtZvH03A5u0moT9aX3vHGGKUqQSum9wbV92pyhX7GN5ohNb OPw+sjWG+/Kq3141PYvZSEw8UXVL38naq5GwAQ6wnUXk9MZhBomtrKybfJ91E2QXYbOV nCa8GF3bm+ERtkYFLxFB0/tmhYMOWPT2OxjKkARsim0Pla6Do8um9r9NKQOzoHuDRiGr FSwg== X-Gm-Message-State: AOAM532tXls2RZtTT11/CdJSeHevWDqlQ4TIqs/6CXerDtcyfyMSs9eT sY1A//eiiAW/ZxDQGmOnR5uvB5VboHxaDiz1UsQzVcIXNHjWxXsVCA2xUviVYAGb4aRu8ikSJIb 0y72PiXb5aDJEcPkruJL6TVDWi14So2Z/GNOa1YFMKZArMCsKPQ+lJJmn13YR X-Received: by 2002:aa7:c6d4:: with SMTP id b20mr58452811eds.270.1634725264144; Wed, 20 Oct 2021 03:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTSFqeTW17BJe5pe82UO646zyJPweqIgjGDH9bhXwnk1H4iczJSNV1dNeQTZlMJ+Ph82SY8w== X-Received: by 2002:aa7:c6d4:: with SMTP id b20mr58452798eds.270.1634725263956; Wed, 20 Oct 2021 03:21:03 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id k3sm841093ejk.7.2021.10.20.03.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:03 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:00 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 39/44] virtio-net: vhost control virtqueue support Message-ID: <20211020101844.988480-40-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch implements the control virtqueue support for vhost. This requires virtio-net to figure out the datapath queue pairs and control virtqueue via is_datapath and pass the number of those two types of virtqueues to vhost_net_start()/vhost_net_stop(). Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-10-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- include/hw/virtio/virtio-net.h | 1 + hw/net/vhost_net.c | 2 +- hw/net/virtio-net.c | 23 +++++++++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 2903b79a92..eb87032627 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -196,6 +196,7 @@ struct VirtIONet { int multiqueue; uint16_t max_queue_pairs; uint16_t curr_queue_pairs; + uint16_t max_ncs; size_t config_size; char *netclient_name; char *netclient_type; diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 3aabab06ea..0d888f29a6 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -326,7 +326,7 @@ int vhost_net_start(VirtIODevice *dev, NetClientState *ncs, VirtIONet *n = VIRTIO_NET(dev); int nvhosts = data_queue_pairs + cvq; struct vhost_net *net; - int r, e, i, last_index = data_qps * 2; + int r, e, i, last_index = data_queue_pairs * 2; NetClientState *peer; if (!cvq) { diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 7594f7ea92..f2014d5ea0 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -244,6 +244,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) VirtIODevice *vdev = VIRTIO_DEVICE(n); NetClientState *nc = qemu_get_queue(n->nic); int queue_pairs = n->multiqueue ? n->max_queue_pairs : 1; + int cvq = n->max_ncs - n->max_queue_pairs; if (!get_vhost_net(nc->peer)) { return; @@ -285,14 +286,14 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) } n->vhost_started = 1; - r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, 0); + r = vhost_net_start(vdev, n->nic->ncs, queue_pairs, cvq); if (r < 0) { error_report("unable to start vhost net: %d: " "falling back on userspace virtio", -r); n->vhost_started = 0; } } else { - vhost_net_stop(vdev, n->nic->ncs, queue_pairs, 0); + vhost_net_stop(vdev, n->nic->ncs, queue_pairs, cvq); n->vhost_started = 0; } } @@ -3411,9 +3412,23 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp) return; } - n->max_queue_pairs = MAX(n->nic_conf.peers.queues, 1); + n->max_ncs = MAX(n->nic_conf.peers.queues, 1); + + /* + * Figure out the datapath queue pairs since the backend could + * provide control queue via peers as well. + */ + if (n->nic_conf.peers.queues) { + for (i = 0; i < n->max_ncs; i++) { + if (n->nic_conf.peers.ncs[i]->is_datapath) { + ++n->max_queue_pairs; + } + } + } + n->max_queue_pairs = MAX(n->max_queue_pairs, 1); + if (n->max_queue_pairs * 2 + 1 > VIRTIO_QUEUE_MAX) { - error_setg(errp, "Invalid number of queue_pairs (= %" PRIu32 "), " + error_setg(errp, "Invalid number of queue pairs (= %" PRIu32 "), " "must be a positive integer less than %d.", n->max_queue_pairs, (VIRTIO_QUEUE_MAX - 1) / 2); virtio_cleanup(vdev); From patchwork Wed Oct 20 10:21:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB95CC433EF for ; Wed, 20 Oct 2021 10:51:38 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B60B611C7 for ; Wed, 20 Oct 2021 10:51:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5B60B611C7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:51654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9C5-0007Pm-18 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:51:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8if-0005XS-7o for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:28650) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ic-0004AO-Bv for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725269; 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=YJsgTbxusJEGwvcKU1z3gMDRkDDpf7ocrUnSpqvRLnQ=; b=dinH1ItTWYg+WCKpTV8Z8BNku6zXx1FWMRIWdyg1HVqGk58KaZ4raaKlX+byvEc9c0WA0K 1/BY/3Gfu3hRwG7uNJdctZ/NqGGwvE3mX8jbdFkt2ZPzkzIFOVJx2k9CHtebopyLo6m3dp 43m04BydMx+8zl5OF2gFqx2/WiJqaQE= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-RAv6SNg9Pe2BDWX3UxGaFA-1; Wed, 20 Oct 2021 06:21:08 -0400 X-MC-Unique: RAv6SNg9Pe2BDWX3UxGaFA-1 Received: by mail-ed1-f72.google.com with SMTP id c25-20020a056402143900b003dc19782ea8so17063220edx.3 for ; Wed, 20 Oct 2021 03:21:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YJsgTbxusJEGwvcKU1z3gMDRkDDpf7ocrUnSpqvRLnQ=; b=FwM8u5KgMm4+5jBUOvU2RIsVxtvWgcJzhlbrv2W995wqJin49+J454x8RnV0+s3wFB JDQCb6HKeW3tyUvfRmO4/90vjHpqFPNzUkb+cZTRoinwKgnKZyCNN/UGk01COO2zezUK 1f9465xtSWfyALAeznFiLQrqI95bNzD58GTlhgjzjaMEkjZfH0KyiuJqhPGcifApGW3C blSbNSmKu+9oPp5kq5aIsRd3WT2xQU3SZI8xZ01qsTPMJVNp9a8YGlyTMLLLkpLUmwKL 7ueBe2TAFcClw0WCwfN6MTnMb7wTqZV1LsSJuDtT7407E8TdjSMSZuci9ieT8nbjVYQ8 Q6mA== X-Gm-Message-State: AOAM532NCWZKKdjDgQGVWfq11/xa6mkPu1QL+x5FFpqpzdiRmwLQfeGr a1pk4p6weOpgPn9QoXselUw/Aj+tnP+CTpEClOGy7OqRLB/BCFjESFGj2nXjjNJL+wGa410zg2y PsXCNJsv2ZiSiiHA8s0YhoxNx/SQhUimDPmqz2943alTEmneeqG0qDxo6+XiJ X-Received: by 2002:a17:907:3d9e:: with SMTP id he30mr39798432ejc.348.1634725266649; Wed, 20 Oct 2021 03:21:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYcW3XVpQiHJ/OIjUGbr+tmFDBHO6KNN0EYU+C25wyKDhJw4yAHivZNSO76PWcvPIWHNg7LQ== X-Received: by 2002:a17:907:3d9e:: with SMTP id he30mr39798404ejc.348.1634725266397; Wed, 20 Oct 2021 03:21:06 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id g22sm816655ejd.33.2021.10.20.03.21.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:05 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:04 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 40/44] vhost-vdpa: multiqueue support Message-ID: <20211020101844.988480-41-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Jason Wang Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Jason Wang This patch implements the multiqueue support for vhost-vdpa. This is done simply by reading the number of queue pairs from the config space and initialize the datapath and control path net client. Signed-off-by: Jason Wang Message-Id: <20211020045600.16082-11-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost-vdpa.c | 2 +- net/vhost-vdpa.c | 105 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 97 insertions(+), 10 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8948fd316b..12661fd5b1 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -632,7 +632,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) vhost_vdpa_host_notifiers_uninit(dev, dev->nvqs); } - if (vhost_vdpa_one_time_request(dev)) { + if (dev->vq_index + dev->nvqs != dev->last_index) { return 0; } diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 151f60184d..49ab322511 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -18,6 +18,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" #include "qapi/error.h" +#include #include #include #include "standard-headers/linux/virtio_net.h" @@ -51,6 +52,14 @@ const int vdpa_feature_bits[] = { VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_MTU, + VIRTIO_NET_F_CTRL_RX, + VIRTIO_NET_F_CTRL_RX_EXTRA, + VIRTIO_NET_F_CTRL_VLAN, + VIRTIO_NET_F_GUEST_ANNOUNCE, + VIRTIO_NET_F_CTRL_MAC_ADDR, + VIRTIO_NET_F_RSS, + VIRTIO_NET_F_MQ, + VIRTIO_NET_F_CTRL_VQ, VIRTIO_F_IOMMU_PLATFORM, VIRTIO_F_RING_PACKED, VIRTIO_NET_F_RSS, @@ -81,7 +90,8 @@ static int vhost_vdpa_net_check_device_id(struct vhost_net *net) return ret; } -static int vhost_vdpa_add(NetClientState *ncs, void *be) +static int vhost_vdpa_add(NetClientState *ncs, void *be, + int queue_pair_index, int nvqs) { VhostNetOptions options; struct vhost_net *net = NULL; @@ -94,7 +104,7 @@ static int vhost_vdpa_add(NetClientState *ncs, void *be) options.net_backend = ncs; options.opaque = be; options.busyloop_timeout = 0; - options.nvqs = 2; + options.nvqs = nvqs; net = vhost_net_init(&options); if (!net) { @@ -172,18 +182,28 @@ static NetClientInfo net_vhost_vdpa_info = { static NetClientState *net_vhost_vdpa_init(NetClientState *peer, const char *device, const char *name, - int vdpa_device_fd) + int vdpa_device_fd, + int queue_pair_index, + int nvqs, + bool is_datapath) { NetClientState *nc = NULL; VhostVDPAState *s; int ret = 0; assert(name); - nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device, name); + if (is_datapath) { + nc = qemu_new_net_client(&net_vhost_vdpa_info, peer, device, + name); + } else { + nc = qemu_new_net_control_client(&net_vhost_vdpa_info, peer, + device, name); + } snprintf(nc->info_str, sizeof(nc->info_str), TYPE_VHOST_VDPA); s = DO_UPCAST(VhostVDPAState, nc, nc); s->vhost_vdpa.device_fd = vdpa_device_fd; - ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa); + s->vhost_vdpa.index = queue_pair_index; + ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, nvqs); if (ret) { qemu_del_net_client(nc); return NULL; @@ -191,12 +211,52 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, return nc; } +static int vhost_vdpa_get_max_queue_pairs(int fd, int *has_cvq, Error **errp) +{ + unsigned long config_size = offsetof(struct vhost_vdpa_config, buf); + struct vhost_vdpa_config *config; + __virtio16 *max_queue_pairs; + uint64_t features; + int ret; + + ret = ioctl(fd, VHOST_GET_FEATURES, &features); + if (ret) { + error_setg(errp, "Fail to query features from vhost-vDPA device"); + return ret; + } + + if (features & (1 << VIRTIO_NET_F_CTRL_VQ)) { + *has_cvq = 1; + } else { + *has_cvq = 0; + } + + if (features & (1 << VIRTIO_NET_F_MQ)) { + config = g_malloc0(config_size + sizeof(*max_queue_pairs)); + config->off = offsetof(struct virtio_net_config, max_virtqueue_pairs); + config->len = sizeof(*max_queue_pairs); + + ret = ioctl(fd, VHOST_VDPA_GET_CONFIG, config); + if (ret) { + error_setg(errp, "Fail to get config from vhost-vDPA device"); + return -ret; + } + + max_queue_pairs = (__virtio16 *)&config->buf; + + return lduw_le_p(max_queue_pairs); + } + + return 1; +} + int net_init_vhost_vdpa(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { const NetdevVhostVDPAOptions *opts; int vdpa_device_fd; - NetClientState *nc; + NetClientState **ncs, *nc; + int queue_pairs, i, has_cvq = 0; assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); opts = &netdev->u.vhost_vdpa; @@ -206,11 +266,38 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name, return -errno; } - nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, vdpa_device_fd); - if (!nc) { + queue_pairs = vhost_vdpa_get_max_queue_pairs(vdpa_device_fd, + &has_cvq, errp); + if (queue_pairs < 0) { qemu_close(vdpa_device_fd); - return -1; + return queue_pairs; } + ncs = g_malloc0(sizeof(*ncs) * queue_pairs); + + for (i = 0; i < queue_pairs; i++) { + ncs[i] = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, + vdpa_device_fd, i, 2, true); + if (!ncs[i]) + goto err; + } + + if (has_cvq) { + nc = net_vhost_vdpa_init(peer, TYPE_VHOST_VDPA, name, + vdpa_device_fd, i, 1, false); + if (!nc) + goto err; + } + + g_free(ncs); return 0; + +err: + if (i) { + qemu_del_net_client(ncs[0]); + } + qemu_close(vdpa_device_fd); + g_free(ncs); + + return -1; } From patchwork Wed Oct 20 10:21:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35CA4C433F5 for ; Wed, 20 Oct 2021 11:32:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BC2ED61359 for ; Wed, 20 Oct 2021 11:32:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BC2ED61359 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:36114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9pu-0006zL-H4 for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:32:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ik-0005Yi-7X for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54276) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8if-0004Cz-33 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725272; 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=pGEZ/L+Yp8m5ztCcbynN5mOeOFC9ShXK5GG60ZVmNHw=; b=EdmKI01AcsR0Ca2vg7MBjaDSHUZcgtuM4kgF1OoJSfktpIQ6lsgFJz2OPerCgBZDI0lKGa 4hWsDM1q7accDsP4cttota5FdwDTsLtmb7qY94y1uGEWOSp8Ujrcq92StmbYWTQ5rv67gj KJURaVbtDW7KMN1Aw+8SK5Utg+UXh28= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-9S82xQcTNISPBdWTx8dBQQ-1; Wed, 20 Oct 2021 06:21:11 -0400 X-MC-Unique: 9S82xQcTNISPBdWTx8dBQQ-1 Received: by mail-ed1-f71.google.com with SMTP id e14-20020a056402088e00b003db6ebb9526so20456381edy.22 for ; Wed, 20 Oct 2021 03:21:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=pGEZ/L+Yp8m5ztCcbynN5mOeOFC9ShXK5GG60ZVmNHw=; b=no91No7qICOE8+EPPF6E8WhDhNcfaR4reb5Rz66tOUxs4VpQLBKVZiOgxlakNO61zg gTNm1w7+2h/xzL0xjDWyYnFpiTgmdjsY8DAAuAWan1qCZvoLweZzrlwJYlmWD1l+r6ZQ i2cuDAIEgX1GXEm3j/3/jj6S4ec/65gXhc1T/EY6iW9+WJaXRDR9a4cI82sKj0vT7ycm lT1E9O7AFkg/yIg94BcnQbJDtGGjmlCNd9EsuZu86NHR/kvA/vojXNAXWTI2e5Y3Djyh jfsRJUYu8Z3Zx3q0qUj9baJvUp5y1Z4tPM55GLG2E45eSx6M2coaMeKLciOR8igwFq4W vsUg== X-Gm-Message-State: AOAM532v+WQdyxDcjalTRUKcbI639aDdY7WGPLeUC+5kBPhgMm6steSx Tlr+82Hqq/ETF06riZgYqb9/VERYEDsEoEnBVV7enFRKweP3UISoHaLJGuG8E6q3gYuLd8Hc7aP JV9BVWyqhrNI0j00GJl7HLygT6mFNmb8ImQ8Jc3gwjya0AEUV8CZmJy+l+u1l X-Received: by 2002:aa7:cb8a:: with SMTP id r10mr61676728edt.237.1634725269845; Wed, 20 Oct 2021 03:21:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFe1gm8EX6fWxvqHrN6h6LLNthkjEh+3XmfnDLG1TqO/SHaO0sPJ9WkTj4Sjseck2lPgorUQ== X-Received: by 2002:aa7:cb8a:: with SMTP id r10mr61676690edt.237.1634725269604; Wed, 20 Oct 2021 03:21:09 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id o10sm941920edj.79.2021.10.20.03.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:09 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:06 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 41/44] pci: fix PCI resource reserve capability on BE Message-ID: <20211020101844.988480-42-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Thomas Huth , jing2.liu@linux.intel.com, zuban32s@gmail.com, Philippe =?utf-8?q?Mathieu-D?= =?utf-8?q?aud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" PCI resource reserve capability should use LE format as all other PCI things. If we don't then seabios won't boot: === PCI new allocation pass #1 === PCI: check devices PCI: QEMU resource reserve cap: size 10000000000000 type io PCI: secondary bus 1 size 10000000000000 type io PCI: secondary bus 1 size 00200000 type mem PCI: secondary bus 1 size 00200000 type prefmem === PCI new allocation pass #2 === PCI: out of I/O address space This became more important since we started reserving IO by default, previously no one noticed. Fixes: e2a6290aab ("hw/pcie-root-port: Fix hotplug for PCI devices requiring IO") Cc: marcel.apfelbaum@gmail.com Fixes: 226263fb5c ("hw/pci: add QEMU-specific PCI capability to the Generic PCI Express Root Port") Cc: zuban32s@gmail.com Fixes: 6755e618d0 ("hw/pci: add PCI resource reserve capability to legacy PCI bridge") Cc: jing2.liu@linux.intel.com Tested-by: Thomas Huth Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé --- hw/pci/pci_bridge.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c index d1f902ee86..da34c8ebcd 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -448,11 +448,11 @@ int pci_bridge_qemu_reserve_cap_init(PCIDevice *dev, int cap_offset, PCIBridgeQemuCap cap = { .len = cap_len, .type = REDHAT_PCI_CAP_RESOURCE_RESERVE, - .bus_res = res_reserve.bus, - .io = res_reserve.io, - .mem = res_reserve.mem_non_pref, - .mem_pref_32 = res_reserve.mem_pref_32, - .mem_pref_64 = res_reserve.mem_pref_64 + .bus_res = cpu_to_le32(res_reserve.bus), + .io = cpu_to_le64(res_reserve.io), + .mem = cpu_to_le32(res_reserve.mem_non_pref), + .mem_pref_32 = cpu_to_le32(res_reserve.mem_pref_32), + .mem_pref_64 = cpu_to_le64(res_reserve.mem_pref_64) }; int offset = pci_add_capability(dev, PCI_CAP_ID_VNDR, From patchwork Wed Oct 20 10:21:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFFE1C433F5 for ; Wed, 20 Oct 2021 10:55:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 557D26115B for ; Wed, 20 Oct 2021 10:55:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 557D26115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:60066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9FS-0004nK-8q for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 06:55:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8il-0005ZG-Fg for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42599) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8ij-0004Es-Pn for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725276; 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=MJsmD3QRv8SGmtAedpltN89f3tDK3M7g7adwY4lsG8s=; b=KA4a81Ya6MVw2K+K7wzghFbDShPpm+szg8ua6GodHcmXBNdjId2uVCQZrcJtlGk22VdWnf yoaEnWw1BHrnkBzvzk422P3TZYXmg4X3mZBwIoZ0bVwopNHQ75Fkh0+SdYvd7CPgjp6qcx I509RDsCp/WjDiq9jwFoTfYEIi2cOlI= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-265-dUhSQ29lN4Wd3y45Iy9QGQ-1; Wed, 20 Oct 2021 06:21:14 -0400 X-MC-Unique: dUhSQ29lN4Wd3y45Iy9QGQ-1 Received: by mail-ed1-f70.google.com with SMTP id cy14-20020a0564021c8e00b003db8c9a6e30so20535847edb.1 for ; Wed, 20 Oct 2021 03:21:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=MJsmD3QRv8SGmtAedpltN89f3tDK3M7g7adwY4lsG8s=; b=46PIFON+I+k0E5oHiNI/NujRl5Tiz7aNCvq1oHMnWclZBrs3BllNMPmO7QzpXaFhDE 67LlTdLjww86WUryufyl9b5kutRS1zXv0tGlOL0zpjebAcF+rIjwMbavG7hexNp7bI9l Q13aVs082G858W6K2It0mwTrgouwn3L5+md8hVLvukCSCkTufjZmvGcZwsnpS9Fn/9RW SUZgT13fOPjGwxW/Jiv1ani+RvLOvtw7ytqVR8v1rmqQm2RnjfHFV4cST6TXQftR2W4d +46EV6U8MbJFfik07TY1ZTJ8BN+RQYmxc+lPWVpZEyIkXPl8LoAjX7mv0TDVIjQqYPBa 4/9Q== X-Gm-Message-State: AOAM533ED8/aJiFW22WgRmYOo3ew0ibeUdGCz3W3nGSjl8ZrRGUXkCDD AplpJCuqQrxQzdcjmhZMpM7Ad0KPyv6LWq60eqiFhdnmEat5GxJTmUbGfDobweU6BqzHx9tyxCI AzN5YONesoM3A7CSn9kDPzHojauaiZID+T+czlBFG0CdLXCI0fEKUw7oaYzav X-Received: by 2002:a17:906:58ce:: with SMTP id e14mr4156465ejs.261.1634725273250; Wed, 20 Oct 2021 03:21:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJQu7NTa1ClIkHwkuR6m3rhQArX0CWOiV8ZEelAhqTgH4XFf8KBTK+JuZhY5tZ4OnukmPk+Q== X-Received: by 2002:a17:906:58ce:: with SMTP id e14mr4156442ejs.261.1634725273020; Wed, 20 Oct 2021 03:21:13 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id kd8sm832457ejc.69.2021.10.20.03.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:12 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:09 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 42/44] tests/acpi/bios-tables-test: add and allow changes to a new q35 DSDT table blob Message-ID: <20211020101844.988480-43-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We are adding a new unit test to cover the acpi hotplug support in q35 for multi-function bridges. This test uses a new table DSDT.multi-bridge. We need to allow changes in DSDT acpi table for addition of this new unit test. Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-2-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Igor Mammedov --- tests/qtest/bios-tables-test-allowed-diff.h | 1 + tests/data/acpi/q35/DSDT.multi-bridge | 0 2 files changed, 1 insertion(+) create mode 100644 tests/data/acpi/q35/DSDT.multi-bridge 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", diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge new file mode 100644 index 0000000000..e69de29bb2 From patchwork Wed Oct 20 10:21:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 959ABC433F5 for ; Wed, 20 Oct 2021 11:03:09 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E634C61373 for ; Wed, 20 Oct 2021 11:03:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E634C61373 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:40054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9ND-0002Km-ND for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:03:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8in-0005ab-QC for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:22 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:49316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8im-0004Gz-0h for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725279; 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=ysZp7mMPII4pmn1rmH7HJMbN4B1aNJgaVcvJsZja2WQ=; b=CEdBr0bjaDV7mF43NopmMr4BtZxi6o5EeVR1foEGXLleEMJvd/tsVDsIzlKvVStp35J3xB o2WtspDu7GLNZ8V/kat09/D39gVadpcz+rYDOobf7605zy1NO7ZelzblGq7mNuSmrr2p86 QAg78oYxPCINv0NwHprtQ97B1fwXXus= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-JKOb20bYMA2tgsPUjMn2SA-1; Wed, 20 Oct 2021 06:21:17 -0400 X-MC-Unique: JKOb20bYMA2tgsPUjMn2SA-1 Received: by mail-ed1-f70.google.com with SMTP id h19-20020aa7de13000000b003db6ad5245bso20621027edv.9 for ; Wed, 20 Oct 2021 03:21:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ysZp7mMPII4pmn1rmH7HJMbN4B1aNJgaVcvJsZja2WQ=; b=YktdIFagQDPYsQojeNUOkJf9Ff+4F8+AiIN6/0h9uN0WrfTx7Cwb6usZj65KTNeAEe ii0YE6vTpPLaR5bxO1Sz36rHaclJJBj9TmcuAQsKm92BX/Vkig4WPeE6xOBgXpT0i0Bi 6A51i28JtyXtSjaO8yHwPwGI0DqYu8xW0oIOLJrVWJzfhiiX9fIvx97kcEXCFcSQc3Gf ayJeTkysRZVc9jLzC4G+EvBCQlSVCfs9Z9MhOfcOlX/j+sNmxCbPvysyDFLkTU//91xs b67XUuODyqCCw/nfVhd53MAMuI5GXROqzrH6dRACIzDrA8BTEDlhsyZudPnrgOxex0ox Qagg== X-Gm-Message-State: AOAM5312UbOqI8DiaEKpWI2FN3W6UA4c75JNiohIG+dAiUH7csQNpuDD LEDNjEZWqmS09rt/dIUK1PJFOBfKH4OCVScekdvhOE2YeNOIC2xgiGDdnnK8/aGtv2LWedkCxFQ mTe71mIyPi5UYR9znQP+Qpvy6utJ2HZewGmAGxwUdVlLuI0+nqeUZ89Pv/49r X-Received: by 2002:a17:906:8397:: with SMTP id p23mr46609789ejx.43.1634725276218; Wed, 20 Oct 2021 03:21:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCm9HB2iyexI9c5CfYq0QjIZXEcE9/5hEcKY7cLzNK+Yag9nhR6gR0Oq4P/V485gxtMDlGig== X-Received: by 2002:a17:906:8397:: with SMTP id p23mr46609762ejx.43.1634725275942; Wed, 20 Oct 2021 03:21:15 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id p10sm949683edj.91.2021.10.20.03.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:15 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:13 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 43/44] tests/acpi/pcihp: add unit tests for hotplug on multifunction bridges for q35 Message-ID: <20211020101844.988480-44-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha commit d7346e614f4ec ("acpi: x86: pcihp: add support hotplug on multifunction bridges") added ACPI hotplug descriptions for cold plugged bridges for functions other than 0. For all other devices, the ACPI hotplug descriptions are limited to function 0 only. This change adds unit tests for this feature. This test adds the following devices to qemu and then checks the changes introduced in the DSDT table due to the addition of the following devices: (a) a multifunction bridge device (b) a bridge device with function 1 (c) a non-bridge device with function 2 In the DSDT table, we should see AML hotplug descriptions for (a) and (b). For (a) we should find a hotplug AML description for function 0. The following diff compares the DSDT table AML with the new unit test before and after the change d7346e614f4ec is introduced. In other words, this diff reflects the changes that occurs in the DSDT table due to the change d7346e614f4ec . @@ -1,60 +1,38 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20190509 (64-bit version) * Copyright (c) 2000 - 2019 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT.multi-bridge, Thu Oct 7 18:56:05 2021 + * Disassembly of /tmp/aml-AN0DA1, Thu Oct 7 18:56:05 2021 * * Original Table Header: * Signature "DSDT" - * Length 0x000020FE (8446) + * Length 0x00002187 (8583) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xDE + * Checksum 0x8D * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { - /* - * iASL Warning: There was 1 external control method found during - * disassembly, but only 0 were resolved (1 unresolved). Additional - * ACPI tables may be required to properly disassemble the code. This - * resulting disassembler output file may not compile because the - * disassembler did not know how many arguments to assign to the - * unresolved methods. Note: SSDTs can be dynamically loaded at - * runtime and may or may not be available via the host OS. - * - * In addition, the -fe option can be used to specify a file containing - * control method external declarations with the associated method - * argument counts. Each line of the file must be of the form: - * External (, MethodObj, ) - * Invocation: - * iasl -fe refs.txt -d dsdt.aml - * - * The following methods were unresolved and many not compile properly - * because the disassembler had to guess at the number of arguments - * required for each: - */ - External (_SB_.PCI0.S19_.PCNT, MethodObj) // Warning: Unknown method, guessing 1 arguments - Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } Method (DBUG, 1, NotSerialized) { ToHexString (Arg0, Local0) ToBuffer (Local0, Local0) Local1 = (SizeOf (Local0) - One) Local2 = Zero While ((Local2 < Local1)) { @@ -3322,24 +3300,60 @@ Method (DVNT, 2, NotSerialized) { If ((Arg0 & One)) { Notify (S00, Arg1) } } Method (PCNT, 0, NotSerialized) { BNUM = One DVNT (PCIU, One) DVNT (PCID, 0x03) } } + Device (S19) + { + Name (_ADR, 0x00030001) // _ADR: Address + Name (BSEL, Zero) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + Method (PCNT, 0, NotSerialized) { - ^S19.PCNT (^S10.PCNT ()) + ^S19.PCNT () + ^S10.PCNT () } } } } Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-3-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Igor Mammedov --- tests/qtest/bios-tables-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 798f68c737..258874167e 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -870,6 +870,23 @@ static void test_acpi_q35_tcg_bridge(void) free_test_data(&data); } +static void test_acpi_q35_multif_bridge(void) +{ + test_data data = { + .machine = MACHINE_Q35, + .variant = ".multi-bridge", + }; + test_acpi_one("-device pcie-root-port,id=pcie-root-port-0," + "multifunction=on," + "port=0x0,chassis=1,addr=0x2,bus=pcie.0 " + "-device pcie-root-port,id=pcie-root-port-1," + "port=0x1,chassis=2,addr=0x3.0x1,bus=pcie.0 " + "-device virtio-balloon,id=balloon0," + "bus=pcie.0,addr=0x4.0x2", + &data); + free_test_data(&data); +} + static void test_acpi_q35_tcg_mmio64(void) { test_data data = { @@ -1581,6 +1598,7 @@ int main(int argc, char *argv[]) test_acpi_piix4_no_acpi_pci_hotplug); qtest_add_func("acpi/q35", test_acpi_q35_tcg); qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge); + qtest_add_func("acpi/q35/multif-bridge", test_acpi_q35_multif_bridge); qtest_add_func("acpi/q35/mmio64", test_acpi_q35_tcg_mmio64); qtest_add_func("acpi/piix4/ipmi", test_acpi_piix4_tcg_ipmi); qtest_add_func("acpi/q35/ipmi", test_acpi_q35_tcg_ipmi); From patchwork Wed Oct 20 10:21:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 12572101 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05128C433EF for ; Wed, 20 Oct 2021 11:06:48 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2B26613A0 for ; Wed, 20 Oct 2021 11:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A2B26613A0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:48652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1md9Qk-0000LR-PA for qemu-devel@archiver.kernel.org; Wed, 20 Oct 2021 07:06:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8iq-0005gv-O0 for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:48876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1md8io-0004KG-FD for qemu-devel@nongnu.org; Wed, 20 Oct 2021 06:21:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634725281; 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=8YzxcP6eWW0MzKgpH9P2B9MCLwBZUNGvG/OLjjN9aos=; b=AmFucOp9PEH2F7NIQ64s3zn7PQ9lbcYj6CQZ3RxyzBiGiBT4sRiEQv4K8+8g2Flqi41gXP gDaOnAh+CSa6YolN7OtDEe4ct3SaWN3KnJhDGNa2trsAgGa/r08kM7AYcakbDkV15g4n6t ma6ehDjDf/7FkAV12LdkuNeMZz2osU8= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-28-TQFVjRfeNU-Bre0YfLPKNA-1; Wed, 20 Oct 2021 06:21:20 -0400 X-MC-Unique: TQFVjRfeNU-Bre0YfLPKNA-1 Received: by mail-ed1-f69.google.com with SMTP id r25-20020a05640216d900b003dca3501ab4so4078888edx.15 for ; Wed, 20 Oct 2021 03:21:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8YzxcP6eWW0MzKgpH9P2B9MCLwBZUNGvG/OLjjN9aos=; b=oyMhcfYHg2FYP7MHpfCHLkydfVtpDb3YMF2KaDxl7tAVJ/ujsCQU1ddDfUW3aEyZFp OcinFHW1e4H/1Ui62yBE63h2Prm++ZmjMbwM8TiIRUmwhDh6qiSBgf09MDAO6dPeCT+i qB/y0z5KqD36aWpOu8+moT6sbejKfG1b+Lpo5tsPX10vRT8052ZhTsL+fjxY35k1ngZ7 mWK9wvYWBOpjnmubKO0674oPzpoJ2RhZwal/ZxPNQrTK9KzwRQqetluXM/HocY4H6+So E830XJTKwFYnhiUertrzAQ0WTDMAsIZAzRu1F3RTP8DSs13DgTVxSF5U3pXmQo/Ob7oL M35A== X-Gm-Message-State: AOAM531tY3pLhUeSgOP0kVgm7DqGTl7yWfwl2QCrdV1gg4QD5MgvTAwU D0hjNLd3SmBn42MdFQHb6iFsXgqm8auZ+aa12nVZtx6iejfKn7E1AwiexWjguZCNP6HzbHX2UFB GsNtdYpzhDfc+bey28imJDAgpM6+qYy+M+DfwOi+OIXlVC1sqCFZ7vyuc1LbM X-Received: by 2002:a05:6402:5252:: with SMTP id t18mr59522802edd.129.1634725278910; Wed, 20 Oct 2021 03:21:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2JRXe5k6x1Lwo4oBTgNURb5H8LguWcQGz6loN/Pwg5M49A1Dl3gvued+bXHVRakxLKqlZAw== X-Received: by 2002:a05:6402:5252:: with SMTP id t18mr59522774edd.129.1634725278610; Wed, 20 Oct 2021 03:21:18 -0700 (PDT) Received: from redhat.com ([2.55.24.172]) by smtp.gmail.com with ESMTPSA id y22sm1000567edc.76.2021.10.20.03.21.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Oct 2021 03:21:18 -0700 (PDT) Date: Wed, 20 Oct 2021 06:21:16 -0400 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 44/44] tests/acpi/bios-tables-test: update DSDT blob for multifunction bridge test Message-ID: <20211020101844.988480-45-mst@redhat.com> References: <20211020101844.988480-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20211020101844.988480-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline 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: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ani Sinha , Peter Maydell , Igor Mammedov Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Ani Sinha We added a new unit test for testing acpi hotplug on multifunction bridges in q35 machines. Here, we update the DSDT table gloden master blob for this unit test. The test adds the following devices to qemu and then checks the changes introduced in the DSDT table due to the addition of the following devices: (a) a multifunction bridge device (b) a bridge device with function 1 (c) a non-bridge device with function 2 In the DSDT table, we should see AML hotplug descriptions for (a) and (b). For (a) we should find a hotplug AML description for function 0. Following is the ASL diff between the original DSDT table and the modified DSDT table due to the unit test. We see that multifunction bridge on bus 2 and single function bridge on bus 3 function 1 are described, not the non-bridge balloon device on bus 4, function 2. @@ -1,30 +1,30 @@ /* * Intel ACPI Component Architecture * AML/ASL+ Disassembler version 20190509 (64-bit version) * Copyright (c) 2000 - 2019 Intel Corporation * * Disassembling to symbolic ASL+ operators * - * Disassembly of tests/data/acpi/q35/DSDT, Thu Oct 7 18:29:19 2021 + * Disassembly of /tmp/aml-C7JCA1, Thu Oct 7 18:29:19 2021 * * Original Table Header: * Signature "DSDT" - * Length 0x00002061 (8289) + * Length 0x00002187 (8583) * Revision 0x01 **** 32-bit table (V1), no 64-bit math support - * Checksum 0xF9 + * Checksum 0x8D * OEM ID "BOCHS " * OEM Table ID "BXPC " * OEM Revision 0x00000001 (1) * Compiler ID "BXPC" * Compiler Version 0x00000001 (1) */ DefinitionBlock ("", "DSDT", 1, "BOCHS ", "BXPC ", 0x00000001) { Scope (\) { OperationRegion (DBG, SystemIO, 0x0402, One) Field (DBG, ByteAcc, NoLock, Preserve) { DBGB, 8 } @@ -3265,23 +3265,95 @@ Method (_S1D, 0, NotSerialized) // _S1D: S1 Device State { Return (Zero) } Method (_S2D, 0, NotSerialized) // _S2D: S2 Device State { Return (Zero) } Method (_S3D, 0, NotSerialized) // _S3D: S3 Device State { Return (Zero) } } + Device (S10) + { + Name (_ADR, 0x00020000) // _ADR: Address + Name (BSEL, One) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = One + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + + Device (S19) + { + Name (_ADR, 0x00030001) // _ADR: Address + Name (BSEL, Zero) + Device (S00) + { + Name (_SUN, Zero) // _SUN: Slot User Number + Name (_ADR, Zero) // _ADR: Address + Method (_EJ0, 1, NotSerialized) // _EJx: Eject Device, x=0-9 + { + PCEJ (BSEL, _SUN) + } + + Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method + { + Return (PDSM (Arg0, Arg1, Arg2, Arg3, BSEL, _SUN)) + } + } + + Method (DVNT, 2, NotSerialized) + { + If ((Arg0 & One)) + { + Notify (S00, Arg1) + } + } + + Method (PCNT, 0, NotSerialized) + { + BNUM = Zero + DVNT (PCIU, One) + DVNT (PCID, 0x03) + } + } + Method (PCNT, 0, NotSerialized) { + ^S19.PCNT () + ^S10.PCNT () } } } } Signed-off-by: Ani Sinha Message-Id: <20211007135750.1277213-4-ani@anisinha.ca> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Acked-by: Igor Mammedov --- tests/qtest/bios-tables-test-allowed-diff.h | 1 - tests/data/acpi/q35/DSDT.multi-bridge | Bin 0 -> 8583 bytes 2 files changed, 1 deletion(-) diff --git a/tests/data/acpi/q35/DSDT.multi-bridge b/tests/data/acpi/q35/DSDT.multi-bridge index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..a24c713d22102a1a1583b5c902edffe1694e5cfe 100644 GIT binary patch literal 8583 zcmcIpOKcm*8J^`sS}j-7l3Gc&>_n`S^pzr^>^%DjO78Myi4?`9;si8G%5qxCPLV|t z14)bkvH~QIfd)<31U=FL1N7FOdaZ$8+M90;&{Ge+wvgpJq&UJ!9r+w&I z4X>IrJC&+$=kHpk+400#-0bB2CNn$RRiC*V)1A%0OWeB3JpaO4zn<*vr57xxUHj*` zuUAk1{Id&h=I{LMAHTeH)k*+x7Jp6rJr~lUd%bI|cKgmJy?x_dqVsEO{e@3@{IY0s z=t|h7mfN;yqOR5kSKEir`OUn?Yn*M=8#ynxhPu3FkY2S;f3VD$O@l+fKMjY&zlc-j zyv>}NDO48CN~744Dh+5ORqcaHqg7)zV|Twvu|)fZL-E3k#k!wuH2qH2eWnw%@+_p5 zZb(f#?{qDv+qXaNby=^Q8V(1nKlgEOhy8BHX8-zca=-@Gyr?a0&AmTEwcP!NB^X0B z-+h9rq491Xu2h43hYvB*ucDMjwYe3ux|Z#%&p#QLKti<-pIR^Y0E>GRNA;*mra56P zmW?j!GQ%hvm)T|fJrhH=_Ti(o&Fv%B{DQ_Zt>hURq4wd~jYext_MH&-+t9F%HCr~` zioX>%%`*qQ=d<2s?TC{E8lyRZb1!}`&df6o=RDSIc}LZxqWj0Y4q3`x1Gho&$bVO;(5%1zu6XUT#5p(kSm_Yg+jg7G*Wj3jRLPw z->zjFRsW@I+bC>!>&$(u;T6xv+K*5)9EN*@2;VmL8THZr9yJe``*m#wOcU+Wf{Z~R9I#l^x z#(99skeKM7V`H2NY!newLSu|G0p(1D#6&e58|O?}L7Wj&LgRu7C}$!hrp$tQC9u4o z1ZPTULNI0V2vwa)O=prbB{V6RvUr55&M8gj6lY54l&%w@s&iV?Ij!lO)^#FOb()$^ zQ`2ecIuWWm@di>xdPdVZqw7Sd>a;YSmZsCvbs|)CrZk-?O=n8iiBQ#vccF4WZB3`G z>qMyPoYi#BYC30iod{K(bDGXMP3N4h6QQbeUeh_R>73VfB2;xcnodX4>F7EUsyfq} z&a|d8t?NXn>da_5Gn&qft`niEb3xO&py^!Dbs|)Cx|&W`)9LCu5vn>DHJyu^&P81( zLRIIIrgKTtxuokvsOrR*1fD+m9$MCPF6%lGsya_-I!|aiPv|-ksya_{Wb5b46z&RGFtV<|&PNN@pTenWr`8X^nYWXChRY4{6MYH0DD( z6QRm{m@}ozJj|K$9sjUk$`?06V#+(Xs^whOa<1w*5sI893^cD8XgR1NH8)cO=SUnG zC<3GvK^%ch3Ii25Zb=3smaNY}QUN_OP=rz%3{+sHfhtfkPyszMP=u&P8mPcV5#>}3 zR6vgm6d@|&SQx0lMp2}ZL&-n|REDZf7^vu$Ghv_#lnfN1bVV{ygiR6seC3>2Z%2?G^a&V+#~P%=;f= z3{*fllMEE0)CmI>Sk8ojDo`>|0p(0GP=rz^ z3{+q_69%e4$v_2^Gs!>^N}VuJf#pmXr~)Me6;RG314Srx!axOM_lrzad5lWpfP=V!47^ngz0~Jut zBm+e#b;3XemNQ|X3X}{~Ksl2P6rt1!0~J`#gn=qhGEf2KOfpb}QYQ>lU^x>8szAv= z1(Y+%KoLrvFi?TzOcu&LjgxD0RX>5h(_WNHtJ|s(~U@3{+vlKouq#sKO)z zRhTePg$V;ym}H;|lMGa0!ax-!3{+u~fhtTgP=yHtRhTePg-HggFv&m_CJYpjyt^<^ zM7U#oFv&m>;x@>Tm~w1kporwy!axzpu_XgVD94rz6d{(1Rywdy*0+27pVa~VLwb9P z{^Z*?e*9#d{!67*4O;Io8qKXd9Cxcg2agWE$*}gaRiyJ09m;g5nC?P#3#$SBnd{cU z9u`?<23E>_s=DPhX8>sC(sNeo!znhySAyPVx2VlZ;#du@?^*MV&QL@XOD`MK_(sUf zB@Y|RHMAIHqU<2OWG#F+$7bSiH-`5&!<;37Ua%YcHyS(o=hsy)cp;iznYYdqK%w;MohPPt9I%Cuc9T4{M}dETv(& zFVb$s9w5D^r1yAwZzR2UOnNU$?~jPLu%Pv=)%!|%pQran()-7x_oMX1(e#N2NMBUa z7kT>PNc!S2>5EbN(rEhR1Eeo0=}SC)X(WB=nDnJ6eR(wf)B~h1E9uKTeR(8(`Iz+O zD1Bu#{qzH*uPEs&Jbh&(edU<+6{Jtlt86sABht&42R-NpK?-sVp6DUUxiucPip zr?HjRyTiA}Sa+grVs~TnGNX5g50J6$MBBvf#^xE8fN7pdVfZQ;>rS*y>~3t{xO#W^ zR2l0|v`y@8Y#uD?-QoLXtUJ**vAeP7dP(mNA2nm$iMEN|jXkH!dUyEJ8S758>D@V} z?yqMb&Ih#uwpy^QV#l%O?`*yxb|)&<#rrG%jb<^BPpO5;32&P98r#{*Yj1|HUi(${ z^;h0_?b_?Rue`z9hS%6wkDk_9%PJdR+F#m+ja7Yk5-pv7Xw~UaOOmVyOJt08g&rpM@0OOlz^j|b$S}Qn@j@mx4B2jI zT>jk8^e!7AyBr$bknMcFVgI(*H9p-%Q#aflP00n1HsYrAmp>hC#ckRBqCeByv4%+V zML6kt|Ix9Lqx&B2-lQ6L*tH#0b^F==(_=9HWZ?GgTJdmfU~mzPTPLOs_mO&;djjJFxI>|=&`^3yWbKL#({pD;F|6&r0O=#|k%4D-b5 z+V4F_&ot&gewZG3uFU~G-IxKjd@G%@Oor74`VMvHuxZ*#kr=kOf5kn8$y06=JH^~t z7R`8?Nc2oOn+dwaCw?@ia?ddLd0^KV4aCuopxCie8X8`mSE?bL+M<}Ld{c<;m7Y&o zf4(`(Vpt-;Z%7C17~Zq**@lUB1MejKzQ*Ny_E9{GJtW5d!#7#^b^0tG4(YR)elezP zzna*_`lGnQ{-9mCgMHa=#FaZQ+pt6`8zQ?m7Oy9PUrbVqta-KA*OBQ`<-BrCcIzA`?_P_v5gbhru@N0 zqz}$@GE)fywd4G$PR2}FF$;@$h@Pe^q{R8j{oBw!e4=#06TUaQRjh5}F*-|VZ04#J zJ4q)=Z*j+8zR0)sHkRlvwhvQ5E+_VkF(f|>a?gnXcg$cg<6zBa*tEpSS$T4fPTGfM zGgyn50LPeF!21RtF+UX@2HSO%LA(8KrbDhko1+Bj;0nH|u&-$kXm=A2@ztaDjQ?W2 z73-(2?-}fU>S*6xrDu_a2JNQORg}GLL?^x#7lk|@RSnw_g`mLyQz7h_LfjQz=r5iK P)}F_He7!|yIezv(me~h+ 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 dabc024f53..dfb8523c8b 100644 --- a/tests/qtest/bios-tables-test-allowed-diff.h +++ b/tests/qtest/bios-tables-test-allowed-diff.h @@ -1,2 +1 @@ /* List of comma-separated changed AML files to ignore */ -"tests/data/acpi/q35/DSDT.multi-bridge",