From nobody Sat May 11 20:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1646758000642929.2480939169172; Tue, 8 Mar 2022 08:46:40 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-523-4kO8lZ66Nwms96Vm97Fdzw-1; Tue, 08 Mar 2022 11:46:38 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6403C3C18532; Tue, 8 Mar 2022 16:46:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F13646A3A7; Tue, 8 Mar 2022 16:46:35 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BC89B1932104; Tue, 8 Mar 2022 16:46:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 374F4194F4B3 for ; Tue, 8 Mar 2022 16:46:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 2BBA2463EA6; Tue, 8 Mar 2022 16:46:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27B31463EA4 for ; Tue, 8 Mar 2022 16:46:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F906802809 for ; Tue, 8 Mar 2022 16:46:33 +0000 (UTC) Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-75-OhPwcSiNOo21Y2wqyhVJTA-1; Tue, 08 Mar 2022 11:46:31 -0500 Received: by mail-pj1-f49.google.com with SMTP id bx5so17701770pjb.3 for ; Tue, 08 Mar 2022 08:46:31 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.121.168]) by smtp.googlemail.com with ESMTPSA id pi16-20020a17090b1e5000b001bd1ffaf2basm3566459pjb.0.2022.03.08.08.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 08:46:29 -0800 (PST) X-MC-Unique: 4kO8lZ66Nwms96Vm97Fdzw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: OhPwcSiNOo21Y2wqyhVJTA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QnH0u2mloT38DdZYDMhYJlsD1hmCTcvE54mpXM2UaYs=; b=ecJSFV0KuIU64+FqnW7GEq3srKHlbq2cTRAwd5NJN6PTt3fkjWOxTGC24jf5QRXGVK r7+QU9wARd6piaMPENylOd1ivHyAXAcFVswT1wYWslLym4Sv1QnPmpcbYi+eoJSdzUP3 MnMkZ1jo18Cv0nmwWi9J5c/kRxl1Dg+4JHaKutNzDNmgdIZbMj9dgg7Psa6OzEFOYjst wvjwnhCwwwbbXbRGrZa2UMNMZLuby6qM6r5QKMdYyAad4b5szkuwPG3SkTQIk4DC2Hc8 OwhQjU5WP0GfEKaGhD1eZEKSXyECIjqNeT+D6tAzaAU5JLE0GSegAEXn2udOHp9LKh9T AO/A== X-Gm-Message-State: AOAM533/UANviEk7a/ph16/Zi7dl1ytB6Q1RBwrRxFesl5wVJ+SUZWq2 K135Y8OZIx7aSdhWy+NJ9gaYnqeu3SeEZQ== X-Google-Smtp-Source: ABdhPJzFeF9W0p4KZqbkXuK/nio/Jnk2dYgaMI+/Ji1Y6TGt3YUl86tUDwaaQehbpZZxkW+o33BJTg== X-Received: by 2002:a17:902:7043:b0:14f:47:a455 with SMTP id h3-20020a170902704300b0014f0047a455mr18291726plt.44.1646757989766; Tue, 08 Mar 2022 08:46:29 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [libvirt] [PATCH RESEND v2 1/4] qemu: capablities: detect acpi-pci-hotplug-with-bridge-support Date: Tue, 8 Mar 2022 22:15:50 +0530 Message-Id: <20220308164553.2312425-2-ani@anisinha.ca> In-Reply-To: <20220308164553.2312425-1-ani@anisinha.ca> References: <20220308164553.2312425-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mst@redhat.com, jusual@redhat.com, qemu-devel@nongnu.org, laine@redhat.com, Ani Sinha , imammedo@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1646758001881100001 Content-Type: text/plain; charset="utf-8" qemu added support for i440fx specific global boolean flag PIIX4_PM.acpi-pci-hotplug-with-bridge-support around version 2.1. This flag is enabled by default. When disabled, it turns off acpi pci hotplug for cold plugged pci bridges in i440fx machine types. Very recently, in qemu version 6.1, the same global option was also added for q35 machine types as well. ICH9-LPC.acpi-pci-hotplug-with-bridge-support This option turns on or off acpi based hotplug for cold plugged pcie bridges like pcie root ports. This flag is also enabled by default. Please refer to the following qemu changes: c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug") 17858a16950860 ("hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35") This patch adds the corresponding qemu capabilities in libvirt. For i440fx, the capability is detected as QEMU_CAPS_PIIX_ACPI_HOTPLUG_BRIDGE. For q35, the capability is detected as QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE. Please note that the test specific qemu capabilities .replies files has already been updated as a part of regular refreshing them when a new qemu version is released. Hence, no updates to those files are required. Signed-off-by: Ani Sinha --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 3 +++ tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 + 5 files changed, 10 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 529e9ceaf5..08d5d733ce 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -665,6 +665,9 @@ VIR_ENUM_IMPL(virQEMUCaps, "virtio-mem-pci.prealloc", /* QEMU_CAPS_DEVICE_VIRTIO_MEM_PC= I_PREALLOC */ "calc-dirty-rate", /* QEMU_CAPS_CALC_DIRTY_RATE */ "dirtyrate-param.mode", /* QEMU_CAPS_DIRTYRATE_MODE */ + + /* 425 */ + "ich9.acpi-hotplug-bridge", /* QEMU_CAPS_ICH9_ACPI_HOTPLUG_B= RIDGE */ ); =20 =20 @@ -1551,6 +1554,7 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsVirtioGpu[] =3D { static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsICH9[] =3D= { { "disable_s3", QEMU_CAPS_ICH9_DISABLE_S3, NULL }, { "disable_s4", QEMU_CAPS_ICH9_DISABLE_S4, NULL }, + { "acpi-pci-hotplug-with-bridge-support", QEMU_CAPS_ICH9_ACPI_HOTPLUG_= BRIDGE, NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsUSBNECXHCI= [] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f6188b42de..51dc668913 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -641,6 +641,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_CALC_DIRTY_RATE, /* accepts calc-dirty-rate */ QEMU_CAPS_DIRTYRATE_MODE , /* calc-dirty-rate accepts mode parameter */ =20 + /* 425 */ + QEMU_CAPS_ICH9_ACPI_HOTPLUG_BRIDGE, /* -M q35 ICH9-LPC.acpi-pci-hotplu= g-with-bridge-support */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.1.0.x86_64.xml index ba1aecc37e..51e1e07d2f 100644 --- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml @@ -239,6 +239,7 @@ + 6001000 0 43100243 diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_6.2.0.x86_64.xml index d77907af55..7b665c82e8 100644 --- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml @@ -241,6 +241,7 @@ + 6002000 0 43100244 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0.x86_64.xml index ae800abcc4..692e2f14da 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml @@ -243,6 +243,7 @@ + 6002050 0 43100243 --=20 2.25.1 From nobody Sat May 11 20:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1646758007233605.7751095480611; Tue, 8 Mar 2022 08:46:47 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-211-ZbC2cw1ePdyTFg5VR825TA-1; Tue, 08 Mar 2022 11:46:42 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8393E80281D; Tue, 8 Mar 2022 16:46:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CB20463ED2; Tue, 8 Mar 2022 16:46:39 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2DFBD1932104; Tue, 8 Mar 2022 16:46:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DA431194F4B3 for ; Tue, 8 Mar 2022 16:46:37 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BC98B7BA6DF; Tue, 8 Mar 2022 16:46:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B870B7BA6D9 for ; Tue, 8 Mar 2022 16:46:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9894F3C1852D for ; Tue, 8 Mar 2022 16:46:37 +0000 (UTC) Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-HhJGwbitOfWL5DCWSwpeJw-1; Tue, 08 Mar 2022 11:46:35 -0500 Received: by mail-pj1-f46.google.com with SMTP id kx6-20020a17090b228600b001bf859159bfso2722529pjb.1 for ; Tue, 08 Mar 2022 08:46:34 -0800 (PST) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.121.168]) by smtp.googlemail.com with ESMTPSA id pi16-20020a17090b1e5000b001bd1ffaf2basm3566459pjb.0.2022.03.08.08.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 08:46:32 -0800 (PST) X-MC-Unique: ZbC2cw1ePdyTFg5VR825TA-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: HhJGwbitOfWL5DCWSwpeJw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t7+dd7lleHcdSBykz0CoP15bE42Y+6fLlVwKCGX1IBo=; b=SsanAGPzhw9bClLrNQvQYGA+vLBiontqe0QWupccdayMR6Axvp+zdUjVjY+R5QnpZ0 l1Hx+zeIZGZFMDtFceqPPoPyTztuOQVWUvHp7+sbeMht7hR92ktiZ40tfwvsws+ZHRWK VVJuVl225l4pNi1fxqK7cycHSwk6tPh7efzuiUJjpZz8JtNlMX9ojrnZVyc435L1J6Cx HECVbgdV0ZazkmNVp5oQ93UrNiMIkTPVoAkrO/S+E8ORK0UvbDXCOabFym2Iy1845zWr jDs6SSXDfghMRV6uiCWN2OuEFZJzVMDgljiv5HFS2neR69pHUWpfzi0OqZ9xbb3XH1H1 ekKw== X-Gm-Message-State: AOAM533slJhAu1zZxkdu4O2P84fAFyTWqdES6Qitm289Th5yE17ROU+/ LS+laYKtx7O7H2ySNu43QKFridmBgXMHFg== X-Google-Smtp-Source: ABdhPJzYJp5mZ15ASVYARR/8xVggsPA80ZkXPIBKFdvPo6uZGKbiaX9hvYXFdjgp74XjeYrFcDGkHg== X-Received: by 2002:a17:90b:240e:b0:1b9:2963:d5a1 with SMTP id nr14-20020a17090b240e00b001b92963d5a1mr5599743pjb.227.1646757993399; Tue, 08 Mar 2022 08:46:33 -0800 (PST) From: Ani Sinha To: libvir-list@redhat.com Subject: [libvirt] [PATCH RESEND v2 2/4] conf: introduce support for acpi-bridge-hotplug feature Date: Tue, 8 Mar 2022 22:15:51 +0530 Message-Id: <20220308164553.2312425-3-ani@anisinha.ca> In-Reply-To: <20220308164553.2312425-1-ani@anisinha.ca> References: <20220308164553.2312425-1-ani@anisinha.ca> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mst@redhat.com, jusual@redhat.com, qemu-devel@nongnu.org, laine@redhat.com, Ani Sinha , imammedo@redhat.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1646758008868100001 Content-Type: text/plain; charset="utf-8" This change introduces a new libvirt sub-element under that can be used to configure all pci related features. Currently the only sub-sub element supported by this sub-element is 'acpi-bridge-hotplug' as shown below: The above option is only available for the QEMU driver, for x86 guests only. It is a global option, affecting all PCI bridge controllers on the guest. The 'acpi-bridge-hotplug' option enables or disables ACPI hotplug support for cold-plugged pci bridges. Examples of bridges include the PCI-PCI bridge (pci-bridge controller) for pc (i440fx) machinetypes, or PCIe-PCI bridges and pcie-root-port controllers for q35 machinetypes. For pc machinetypes in x86, this option has been available in QEMU since version 2.1. Please see the following changes in qemu repo: 9e047b982452c6 ("piix4: add acpi pci hotplug support") 133a2da488062e ("pc: acpi: generate AML only for PCI0 devices if PCI bridge hotplug is disabled") For q35 machinetypes, this was introduced in QEMU 6.1 with the following changes in qemu repo: (a) c0e427d6eb5fef ("hw/acpi/ich9: Enable ACPI PCI hot-plug") (b) 17858a16950860 ("hw/acpi/ich9: Set ACPI PCI hot-plug as default on Q35") The reasons for enabling ACPI based hotplug for PCIe (q35) based machines (as opposed to native hotplug) are outlined in (b). There are use cases where users would still want to use native hotplug. Therefore, this config option enables users to choose either ACPI based hotplug or native hotplug for bridges (for example for pcie root port controller in q35 machines). Qemu capability validation checks have also been added along with related unit tests to exercise the new conf option. Signed-off-by: Ani Sinha --- docs/formatdomain.rst | 32 +++++++ docs/schemas/domaincommon.rng | 15 ++++ src/conf/domain_conf.c | 89 ++++++++++++++++++- src/conf/domain_conf.h | 9 ++ src/qemu/qemu_validate.c | 42 +++++++++ .../aarch64-acpi-hotplug-bridge-disable.xml | 13 +++ .../pc-i440fx-acpi-hotplug-bridge-disable.xml | 36 ++++++++ .../pc-i440fx-acpi-hotplug-bridge-enable.xml | 36 ++++++++ .../q35-acpi-hotplug-bridge-disable.xml | 53 +++++++++++ .../q35-acpi-hotplug-bridge-enable.xml | 53 +++++++++++ ...i-hotplug-bridge-disable.x86_64-latest.xml | 1 + ...pi-hotplug-bridge-enable.x86_64-latest.xml | 1 + ...i-hotplug-bridge-disable.x86_64-latest.xml | 1 + ...pi-hotplug-bridge-enable.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 4 + 15 files changed, 385 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disa= ble.xml create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-di= sable.xml create mode 100644 tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-en= able.xml create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-disable.= xml create mode 100644 tests/qemuxml2argvdata/q35-acpi-hotplug-bridge-enable.x= ml create mode 120000 tests/qemuxml2xmloutdata/pc-i440fx-acpi-hotplug-bridge-= disable.x86_64-latest.xml create mode 120000 tests/qemuxml2xmloutdata/pc-i440fx-acpi-hotplug-bridge-= enable.x86_64-latest.xml create mode 120000 tests/qemuxml2xmloutdata/q35-acpi-hotplug-bridge-disabl= e.x86_64-latest.xml create mode 120000 tests/qemuxml2xmloutdata/q35-acpi-hotplug-bridge-enable= .x86_64-latest.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 9202cd3107..864dfd8bd8 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -1879,6 +1879,9 @@ Hypervisors may allow certain CPU / machine features = to be toggled on/off. + + + @@ -1997,6 +2000,35 @@ are: passthrough Enable IOMMU mappings allowing PCI passthrough on, off; mod= e - optional string sync_pt or share_pt :since:`6.3.0` =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D =20 +``pci`` + Various PCI bus related features of the hypervisor. + + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + Feature Description = Value Since + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + acpi-bridge-hotplug Enable ACPI based hotplug on the cold-plugged PCI = bridges (pc) and pcie-root-ports (q35) (also see notes) on, off :since:`8.2= .0` + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + + Note: + pc machine types (i440fx) have ACPI hotplug enabled by + default on cold plugged bridges (bridges that were present in the + VM's domain definition before it was started). `acpi-bridge-hotplug` + xml option can be used to disable hotplug for these bridges. + Disabling ACPI hotplug leaves only SHPC hotplug enabled; many OSes don't + support SHPC hotplug, so this may have the effect of completely + disabling hotplug. + + On q35 machinetypes earlier than pc-q35-6.1, ACPI hotplug for cold + plugged bridges is disabled by default, and native PCIe hotplug is + enabled instead. Starting with the pc-q35-6.1 machinetype, ACPI + hotplug is enabled on cold plugged bridges by default while native + PCIe hotplug is disabled or not advertized to the OS. From QEMU binary + version 6.1 and above, it is possible to revert this default behavior + using `acpi-bridge-hotplug` xml feature as described above. Enabling + ACPI hotplug will disable or suppress advertizing native PCIe hotplug. + Disabling ACPI hotplug will re-enable PCIe native hotplug or start + advertizing its availability to the OS once more. + ``pmu`` Depending on the ``state`` attribute (values ``on``, ``off``, default `= `on``) enable or disable the performance monitoring unit for the guest. diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 964b0c9e2f..5f00b3ab60 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6198,6 +6198,9 @@ + + + @@ -6432,6 +6435,18 @@ =20 + + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34fec887a3..c9938f3cf1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -181,6 +181,7 @@ VIR_ENUM_IMPL(virDomainFeature, "sbbc", "ibs", "tcg", + "pci", ); =20 VIR_ENUM_IMPL(virDomainCapabilitiesPolicy, @@ -223,6 +224,11 @@ VIR_ENUM_IMPL(virDomainXen, "passthrough", ); =20 +VIR_ENUM_IMPL(virDomainPCI, + VIR_DOMAIN_PCI_LAST, + "acpi-bridge-hotplug", +); + VIR_ENUM_IMPL(virDomainXenPassthroughMode, VIR_DOMAIN_XEN_PASSTHROUGH_MODE_LAST, "default", @@ -17419,6 +17425,36 @@ virDomainFeaturesKVMDefParse(virDomainDef *def, return 0; } =20 +static int +virDomainFeaturesPCIDefParse(virDomainDef *def, + xmlNodePtr node) +{ + def->features[VIR_DOMAIN_FEATURE_PCI] =3D VIR_TRISTATE_SWITCH_ON; + + node =3D xmlFirstElementChild(node); + while (node) { + int feature; + virTristateSwitch value; + + feature =3D virDomainPCITypeFromString((const char *)node->name); + if (feature < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported PCI feature: %s"), + node->name); + return -1; + } + + if (virXMLPropTristateSwitch(node, "state", VIR_XML_PROP_REQUIRED, + &value) < 0) + return -1; + + def->pci_features[feature] =3D value; + + node =3D xmlNextElementSibling(node); + } + + return 0; +} =20 static int virDomainFeaturesXENDefParse(virDomainDef *def, @@ -17747,6 +17783,10 @@ virDomainFeaturesDefParse(virDomainDef *def, return -1; break; =20 + case VIR_DOMAIN_FEATURE_PCI: + if (virDomainFeaturesPCIDefParse(def, nodes[i]) < 0) + return -1; + case VIR_DOMAIN_FEATURE_LAST: break; } @@ -17755,7 +17795,6 @@ virDomainFeaturesDefParse(virDomainDef *def, return 0; } =20 - static int virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDef *def) { @@ -21419,6 +21458,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDef = *src, case VIR_DOMAIN_FEATURE_HTM: case VIR_DOMAIN_FEATURE_NESTED_HV: case VIR_DOMAIN_FEATURE_CCF_ASSIST: + case VIR_DOMAIN_FEATURE_PCI: if (src->features[i] !=3D dst->features[i]) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("State of feature '%s' differs: " @@ -21686,6 +21726,29 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= *src, } } =20 + /* pci */ + if (src->features[VIR_DOMAIN_FEATURE_PCI] =3D=3D VIR_TRISTATE_SWITCH_O= N) { + for (i =3D 0; i < VIR_DOMAIN_PCI_LAST; i++) { + switch ((virDomainPCI) i) { + case VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG: + if (src->pci_features[i] !=3D dst->pci_features[i]) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of PCI feature '%s' differs: " + "source: '%s', destination: '%s'"), + virDomainPCITypeToString(i), + virTristateSwitchTypeToString(src->pci_= features[i]), + virTristateSwitchTypeToString(dst->pci_= features[i])); + return false; + } + + break; + + case VIR_DOMAIN_PCI_LAST: + break; + } + } + } + /* smm */ if (src->features[VIR_DOMAIN_FEATURE_SMM] =3D=3D VIR_TRISTATE_SWITCH_O= N) { if (src->tseg_specified !=3D dst->tseg_specified) { @@ -27912,6 +27975,30 @@ virDomainDefFormatFeatures(virBuffer *buf, virDomainFeatureTCGFormat(&childBuf, def); break; =20 + case VIR_DOMAIN_FEATURE_PCI: + if (def->features[i] !=3D VIR_TRISTATE_SWITCH_ON) + break; + + virBufferAddLit(&childBuf, "\n"); + virBufferAdjustIndent(&childBuf, 2); + for (j =3D 0; j < VIR_DOMAIN_PCI_LAST; j++) { + switch ((virDomainPCI) j) { + case VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG: + if (def->pci_features[j] !=3D VIR_TRISTATE_SWITCH_ABSE= NT) + virBufferAsprintf(&childBuf, "<%s state=3D'%s'/>\n= ", + virDomainPCITypeToString(j), + virTristateSwitchTypeToString( + def->pci_features[j])); + break; + + case VIR_DOMAIN_PCI_LAST: + break; + } + } + virBufferAdjustIndent(&childBuf, -2); + virBufferAddLit(&childBuf, "\n"); + break; + case VIR_DOMAIN_FEATURE_LAST: break; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9fcf842ee7..0cc97de7a8 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2072,6 +2072,7 @@ typedef enum { VIR_DOMAIN_FEATURE_SBBC, VIR_DOMAIN_FEATURE_IBS, VIR_DOMAIN_FEATURE_TCG, + VIR_DOMAIN_FEATURE_PCI, =20 VIR_DOMAIN_FEATURE_LAST } virDomainFeature; @@ -2097,6 +2098,12 @@ typedef enum { VIR_DOMAIN_HYPERV_LAST } virDomainHyperv; =20 +typedef enum { + VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG =3D 0, + + VIR_DOMAIN_PCI_LAST +} virDomainPCI; + typedef enum { VIR_DOMAIN_KVM_HIDDEN =3D 0, VIR_DOMAIN_KVM_DEDICATED, @@ -2848,6 +2855,7 @@ struct _virDomainDef { int caps_features[VIR_DOMAIN_PROCES_CAPS_FEATURE_LAST]; int hyperv_features[VIR_DOMAIN_HYPERV_LAST]; virDomainFeatureKVM *kvm_features; + int pci_features[VIR_DOMAIN_PCI_LAST]; int msrs_features[VIR_DOMAIN_MSRS_LAST]; int xen_features[VIR_DOMAIN_XEN_LAST]; virDomainXenPassthroughMode xen_passthrough_mode; @@ -3979,6 +3987,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode); VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode); VIR_ENUM_DECL(virDomainGraphicsVNCSharePolicy); VIR_ENUM_DECL(virDomainHyperv); +VIR_ENUM_DECL(virDomainPCI); VIR_ENUM_DECL(virDomainKVM); VIR_ENUM_DECL(virDomainXen); VIR_ENUM_DECL(virDomainXenPassthroughMode); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f27e480696..e7c992f9e9 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -173,6 +173,43 @@ qemuValidateDomainDefPSeriesFeature(const virDomainDef= *def, return 0; } =20 +static int +qemuValidateDomainDefPCIFeature(const virDomainDef *def, + virQEMUCaps *qemuCaps, + int feature) +{ + size_t i; + + if (def->features[feature] =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + return 0; + + for (i =3D 0; i < VIR_DOMAIN_PCI_LAST; i++) { + if (def->pci_features[i] =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + continue; + + switch ((virDomainPCI) i) { + case VIR_DOMAIN_PCI_ACPI_BRIDGE_HOTPLUG: + if (!ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("acpi-bridge-hotplug is not available= for architecture '%s'"), + virArchToString(def->os.arch)); + return -1; + } + + if (qemuDomainIsQ35(def) && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_ICH9_ACPI_HOTPLUG_= BRIDGE)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("acpi-bridge-hotplug is not available= with this QEMU binary")); + return -1; + } + break; + + case VIR_DOMAIN_PCI_LAST: + break; + } + } + return 0; +} =20 static int qemuValidateDomainDefFeatures(const virDomainDef *def, @@ -311,6 +348,11 @@ qemuValidateDomainDefFeatures(const virDomainDef *def, } break; =20 + case VIR_DOMAIN_FEATURE_PCI: + if (qemuValidateDomainDefPCIFeature(def, qemuCaps, i) < 0) + return -1; + break; + case VIR_DOMAIN_FEATURE_SMM: case VIR_DOMAIN_FEATURE_KVM: case VIR_DOMAIN_FEATURE_XEN: diff --git a/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.xml= b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.xml new file mode 100644 index 0000000000..47107e93f3 --- /dev/null +++ b/tests/qemuxml2argvdata/aarch64-acpi-hotplug-bridge-disable.xml @@ -0,0 +1,13 @@ + + test + 1048576 + 1 + + hvm + + + + + + + diff --git a/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.x= ml b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.xml new file mode 100644 index 0000000000..1b63ff9539 --- /dev/null +++ b/tests/qemuxml2argvdata/pc-i440fx-acpi-hotplug-bridge-disable.xml @@ -0,0 +1,36 @@ + + i440fx + 56f5055c-1b8d-490c-844a-ad646a1caaaa + 1048576 + 1048576 + 1 + + hvm + + + + + + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + +