From nobody Thu Dec 26 17:39:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1721651091683546.7667650334492; Mon, 22 Jul 2024 05:24:51 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D4706CE3; Mon, 22 Jul 2024 08:24:47 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 63E96B13; Mon, 22 Jul 2024 08:23:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 57B5BA39; Mon, 22 Jul 2024 08:23:41 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 777579ED for ; Mon, 22 Jul 2024 08:23:40 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-76-2vlw3W1DN8-eI4xUoJtE7Q-1; Mon, 22 Jul 2024 08:23:38 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D2E7D1955D50 for ; Mon, 22 Jul 2024 12:23:37 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02DB33000188 for ; Mon, 22 Jul 2024 12:23:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721651020; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N5N7Xu+q7RTZgpUGgH2mBorHHy8j/gMbCgW8+LBtY5U=; b=VvSCdat8fEJpZnr2tAW074RsFIp/1gq2MAIg3OaipsEf7cObnuPltv/h6Q1IIgiStokaOP rniszpxfxNFWKAjSL6lCW4jSu6BaCKcUSjT9pqjskdflpIk1lvEACQ5eIX8P9JSVYL8Piq h+ilkje27EqjSltdhKp3hpr4tx1KVhk= X-MC-Unique: 2vlw3W1DN8-eI4xUoJtE7Q-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 1/5] qemu_capabilities: Introduce QEMU_CAPS_DEVICE_ACPI_ERST Date: Mon, 22 Jul 2024 14:23:29 +0200 Message-ID: <52964a696992f6c1f6fdc63266250e9477f3a213.1721650895.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5BHDAU2PVD35RIJ72UM5V7WV6YLJLGHJ X-Message-ID-Hash: 5BHDAU2PVD35RIJ72UM5V7WV6YLJLGHJ X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1721651092976116600 Content-Type: text/plain; charset="utf-8"; x-default="true" This capability tracks whether QEMU has acpi-erst device. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml | 1 + tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml | 1 + tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml | 1 + 19 files changed, 20 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 17db563b09..29dfe8d35a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -712,6 +712,7 @@ VIR_ENUM_IMPL(virQEMUCaps, /* 460 */ "sev-snp-guest", /* QEMU_CAPS_SEV_SNP_GUEST */ "netdev.user", /* QEMU_CAPS_NETDEV_USER */ + "acpi-erst", /* QEMU_CAPS_DEVICE_ACPI_ERST */ ); =20 =20 @@ -1398,6 +1399,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "virtio-sound-pci", QEMU_CAPS_DEVICE_VIRTIO_SOUND }, { "virtio-sound-device", QEMU_CAPS_DEVICE_VIRTIO_SOUND }, { "sev-snp-guest", QEMU_CAPS_SEV_SNP_GUEST }, + { "acpi-erst", QEMU_CAPS_DEVICE_ACPI_ERST }, }; =20 =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 910181993c..51d951771d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -691,6 +691,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 460 */ QEMU_CAPS_SEV_SNP_GUEST, /* -object sev-snp-guest */ QEMU_CAPS_NETDEV_USER, /* -netdev user */ + QEMU_CAPS_DEVICE_ACPI_ERST, /* -device acpi-erst */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml b/tests/= qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml index 69d0701dc9..13b67cc7bf 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64+hvf.xml @@ -159,6 +159,7 @@ + 6002092 61700243 v7.0.0-rc2 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_7.0.0_aarch64.xml index eaed5601ed..a9fe9a2014 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_aarch64.xml @@ -159,6 +159,7 @@ + 6002092 61700243 v7.0.0-rc2 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.0.0_ppc64.xml index a49d45a68a..92636bc7d4 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_ppc64.xml @@ -157,6 +157,7 @@ + 7000000 42900243 v7.0.0 diff --git a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.0.0_x86_64.xml index 5c57ae8eb8..fea02f7728 100644 --- a/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.0.0_x86_64.xml @@ -187,6 +187,7 @@ + 7000000 43100243 v7.0.0 diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml b/tests/qemuca= pabilitiesdata/caps_7.1.0_ppc64.xml index 5aeb56bac6..a851d89974 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_ppc64.xml @@ -158,6 +158,7 @@ + 7001000 42900244 v7.1.0 diff --git a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.1.0_x86_64.xml index 3c589a4d61..555120e958 100644 --- a/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.1.0_x86_64.xml @@ -191,6 +191,7 @@ + 7001000 43100244 v7.1.0 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml b/tests/qemucapa= bilitiesdata/caps_7.2.0_ppc.xml index c5e1b23fb7..998c548556 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_ppc.xml @@ -153,6 +153,7 @@ + 7002000 0 qemu-7.2.0-6.fc37 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml b/tests/q= emucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml index f78e596fcc..ca25a5549e 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64+hvf.xml @@ -195,6 +195,7 @@ + 7002000 43100245 v7.2.0 diff --git a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_7.2.0_x86_64.xml index 9b37253d4f..8b835e6187 100644 --- a/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_7.2.0_x86_64.xml @@ -195,6 +195,7 @@ + 7002000 43100245 v7.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.0.0_x86_64.xml index bd391ca0b6..3ac9e96066 100644 --- a/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.0.0_x86_64.xml @@ -199,6 +199,7 @@ + 8000000 43100244 v8.0.0 diff --git a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.1.0_x86_64.xml index 4b7809f635..476195d147 100644 --- a/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.1.0_x86_64.xml @@ -201,6 +201,7 @@ + 8001000 43100245 v8.1.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml b/tests/qemu= capabilitiesdata/caps_8.2.0_aarch64.xml index b856bc55b3..0043443880 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_aarch64.xml @@ -168,6 +168,7 @@ + 8002000 61700246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml b/tests/qemuc= apabilitiesdata/caps_8.2.0_armv7l.xml index 1b95b2de85..16377a74e3 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_armv7l.xml @@ -175,6 +175,7 @@ + 8002000 0 qemu-8.2.0-7.fc39 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml b/tests/= qemucapabilitiesdata/caps_8.2.0_loongarch64.xml index aaf8f32485..eb80be7a06 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_loongarch64.xml @@ -158,6 +158,7 @@ + 8002000 106300246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_8.2.0_x86_64.xml index a1a5d6fd0f..25cb22aafc 100644 --- a/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_8.2.0_x86_64.xml @@ -204,6 +204,7 @@ + 8002000 43100246 v8.2.0 diff --git a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.0.0_x86_64.xml index ab841db53b..b646377dec 100644 --- a/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.0.0_x86_64.xml @@ -206,6 +206,7 @@ + 9000000 43100245 v9.0.0 diff --git a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml b/tests/qemuc= apabilitiesdata/caps_9.1.0_x86_64.xml index 05cba09035..dc548583a5 100644 --- a/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_9.1.0_x86_64.xml @@ -204,6 +204,7 @@ + 9000050 43100246 v9.0.0-1388-g80e8f06021-dirty --=20 2.44.2 From nobody Thu Dec 26 17:39:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1721651196844163.3869748244473; Mon, 22 Jul 2024 05:26:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A0B3A77; Mon, 22 Jul 2024 08:26:35 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8D1A7D55; Mon, 22 Jul 2024 08:23:50 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id CED04A2E; Mon, 22 Jul 2024 08:23:43 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id E5179A2E for ; Mon, 22 Jul 2024 08:23:41 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-33-b-RN97szOLCbQ88Q1kHVEA-1; Mon, 22 Jul 2024 08:23:39 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2D27E1955D4D for ; Mon, 22 Jul 2024 12:23:39 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1BC6E3000188 for ; Mon, 22 Jul 2024 12:23:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721651021; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RbTMM64sUKXbuaeRMKQQtlRTg3GYPbZ8nkWPHLxm3WY=; b=Tg8/NhMpRhyR+sA0cESm562ju17vlk3x39vUIQt8BQcGcahylcbe70cXozOLHvmH71xZLu Gbul1DEQrKQRJUl/TD6Tejvi4qdHjA5N9fLXI6Mo8ZFK21zU9thOz1Hd876D5A7u2kpA5e 3mMW535+XEfBAbKvUApfB8xNQkgO8R8= X-MC-Unique: b-RN97szOLCbQ88Q1kHVEA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH 2/5] conf: Introduce pstore device Date: Mon, 22 Jul 2024 14:23:30 +0200 Message-ID: <33c3997909b8fdee96f258be3ae2533dad37c265.1721650895.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 4SR4F2WAJ2B7LZBFD3FKHXGE5V7APLSM X-Message-ID-Hash: 4SR4F2WAJ2B7LZBFD3FKHXGE5V7APLSM X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1721651198265116600 Content-Type: text/plain; charset="utf-8"; x-default="true" The aim of pstore device is to provide a bit of NVRAM storage for guest kernel to record oops/panic logs just before the it crashes. Typical usage includes usage in combination with a watchdog so that the logs can be inspected after the watchdog rebooted the machine. While Linux kernel (and possibly Windows too) support many backends, in QEMU there's just 'acpi-erst' device so stick with that for now. The device must be attached to a PCI bus and needs two additional values (well, corresponding memory-backend-file needs them): size and path. Despite using memory-backeng-file this does NOT add any additional RAM to the guest and thus I've decided to expose it as another device type instead of memory model. Signed-off-by: Michal Privoznik Reviewed-by: Kristina Hanicova --- docs/formatdomain.rst | 32 ++++ src/ch/ch_domain.c | 1 + src/conf/domain_conf.c | 153 ++++++++++++++++++ src/conf/domain_conf.h | 19 +++ src/conf/domain_postparse.c | 1 + src/conf/domain_validate.c | 30 ++++ src/conf/schemas/domaincommon.rng | 25 +++ src/conf/virconftypes.h | 2 + src/hyperv/hyperv_driver.c | 1 + src/libvirt_private.syms | 2 + src/libxl/libxl_driver.c | 6 + src/lxc/lxc_driver.c | 6 + src/qemu/qemu_command.c | 1 + src/qemu/qemu_domain.c | 3 + src/qemu/qemu_domain_address.c | 11 ++ src/qemu/qemu_driver.c | 3 + src/qemu/qemu_hotplug.c | 5 + src/qemu/qemu_validate.c | 26 +++ src/test/test_driver.c | 1 + .../pstore-acpi-erst.x86_64-latest.args | 36 +++++ .../pstore-acpi-erst.x86_64-latest.xml | 1 + tests/qemuxmlconfdata/pstore-acpi-erst.xml | 53 ++++++ tests/qemuxmlconftest.c | 1 + 23 files changed, 419 insertions(+) create mode 100644 tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.ar= gs create mode 120000 tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.xml create mode 100644 tests/qemuxmlconfdata/pstore-acpi-erst.xml diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 10584dfe83..8b35005c9e 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -8659,6 +8659,38 @@ The optional attribute ``backend`` is required if th= e ``type`` is ``qemu``, the ... =20 =20 +Pstore +~~~~~~~~~ + +Pstore is an oops/panic logger that writes its logs to a block device and +non-block device before the system crashes. Currently only ACPI Error Reco= rd +Serialization Table, ERST, is supported. This feature is designed for stor= ing +error records in persistent storage for future reference and/or debugging. +:since:`Since v10.6.0` + +:: + + ... + + /tmp/guest_acpi_esrt + 8 +
+ + ... + +The ``pstore`` element has one mandatory attribute ``backend`` which selec= ts +desired backend (only ``acpi-erst`` is accepted for now). Then it has the +following child elements: + +``path`` + Represents a path in the host that backs the pstore device in the guest.= It + is mandatory. + +``size`` + Configures the size of the persistent storage available to the guest. It= is + mandatory. + + Security label -------------- =20 diff --git a/src/ch/ch_domain.c b/src/ch/ch_domain.c index 8e3e205c8c..e1e14554a8 100644 --- a/src/ch/ch_domain.c +++ b/src/ch/ch_domain.c @@ -180,6 +180,7 @@ chValidateDomainDeviceDef(const virDomainDeviceDef *dev, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Cloud-Hypervisor doesn't support '%1$s' device"), virDomainDeviceTypeToString(dev->type)); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6733857a3a..12ae8a9526 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -337,6 +337,7 @@ VIR_ENUM_IMPL(virDomainDevice, "vsock", "audio", "crypto", + "pstore", ); =20 VIR_ENUM_IMPL(virDomainDiskDevice, @@ -1513,6 +1514,11 @@ VIR_ENUM_IMPL(virDomainLaunchSecurity, "s390-pv", ); =20 +VIR_ENUM_IMPL(virDomainPstoreBackend, + VIR_DOMAIN_PSTORE_BACKEND_LAST, + "acpi-erst", +); + typedef enum { VIR_DOMAIN_NET_VHOSTUSER_MODE_NONE, VIR_DOMAIN_NET_VHOSTUSER_MODE_CLIENT, @@ -3548,6 +3554,16 @@ void virDomainMemoryDefFree(virDomainMemoryDef *def) g_free(def); } =20 +void virDomainPstoreDefFree(virDomainPstoreDef *def) +{ + if (!def) + return; + + g_free(def->path); + virDomainDeviceInfoClear(&def->info); + g_free(def); +} + void virDomainDeviceDefFree(virDomainDeviceDef *def) { if (!def) @@ -3632,6 +3648,9 @@ void virDomainDeviceDefFree(virDomainDeviceDef *def) case VIR_DOMAIN_DEVICE_CRYPTO: virDomainCryptoDefFree(def->data.crypto); break; + case VIR_DOMAIN_DEVICE_PSTORE: + virDomainPstoreDefFree(def->data.pstore); + break; case VIR_DOMAIN_DEVICE_LAST: case VIR_DOMAIN_DEVICE_NONE: break; @@ -3997,6 +4016,8 @@ void virDomainDefFree(virDomainDef *def) =20 virDomainIOMMUDefFree(def->iommu); =20 + virDomainPstoreDefFree(def->pstore); + g_free(def->idmap.uidmap); g_free(def->idmap.gidmap); =20 @@ -4554,6 +4575,8 @@ virDomainDeviceGetInfo(const virDomainDeviceDef *devi= ce) return &device->data.vsock->info; case VIR_DOMAIN_DEVICE_CRYPTO: return &device->data.crypto->info; + case VIR_DOMAIN_DEVICE_PSTORE: + return &device->data.pstore->info; =20 /* The following devices do not contain virDomainDeviceInfo */ case VIR_DOMAIN_DEVICE_LEASE: @@ -4659,6 +4682,9 @@ virDomainDeviceSetData(virDomainDeviceDef *device, case VIR_DOMAIN_DEVICE_CRYPTO: device->data.crypto =3D devicedata; break; + case VIR_DOMAIN_DEVICE_PSTORE: + device->data.pstore =3D devicedata; + break; case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LAST: break; @@ -4877,6 +4903,13 @@ virDomainDeviceInfoIterateFlags(virDomainDef *def, return rc; } =20 + device.type =3D VIR_DOMAIN_DEVICE_PSTORE; + if (def->pstore) { + device.data.pstore =3D def->pstore; + if ((rc =3D cb(def, &device, &def->pstore->info, opaque)) !=3D 0) + return rc; + } + /* If the flag below is set, make sure @cb can handle @info being NULL= */ if (iteratorFlags & DOMAIN_DEVICE_ITERATE_MISSING_INFO) { device.type =3D VIR_DOMAIN_DEVICE_GRAPHICS; @@ -4936,6 +4969,7 @@ virDomainDeviceInfoIterateFlags(virDomainDef *def, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: break; } #endif @@ -14006,6 +14040,40 @@ virDomainCryptoDefParseXML(virDomainXMLOption *xml= opt, } =20 =20 +static virDomainPstoreDef * +virDomainPstoreDefParseXML(virDomainXMLOption *xmlopt, + xmlNodePtr node, + xmlXPathContextPtr ctxt, + unsigned int flags) +{ + g_autoptr(virDomainPstoreDef) def =3D NULL; + VIR_XPATH_NODE_AUTORESTORE(ctxt) + + def =3D g_new0(virDomainPstoreDef, 1); + + ctxt->node =3D node; + + if (virXMLPropEnum(node, "backend", + virDomainPstoreBackendTypeFromString, + VIR_XML_PROP_REQUIRED, + &def->backend) < 0) { + return NULL; + } + + def->path =3D virXPathString("string(./path)", ctxt); + + if (virDomainParseMemory("./size", "./size/@unit", ctxt, + &def->size, true, false) < 0) { + return NULL; + } + + if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags)= < 0) + return NULL; + + return g_steal_pointer(&def); +} + + static int virDomainDeviceDefParseType(const char *typestr, virDomainDeviceType *type) @@ -14185,6 +14253,12 @@ virDomainDeviceDefParse(const char *xmlStr, flags))) return NULL; break; + case VIR_DOMAIN_DEVICE_PSTORE: + if (!(dev->data.pstore =3D virDomainPstoreDefParseXML(xmlopt, node, + ctxt, flags)))= { + return NULL; + } + break; case VIR_DOMAIN_DEVICE_NONE: case VIR_DOMAIN_DEVICE_LAST: break; @@ -19532,6 +19606,22 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt, } VIR_FREE(nodes); =20 + if ((n =3D virXPathNodeSet("./devices/pstore", ctxt, &nodes)) < 0) + return NULL; + + if (n > 1) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("only a single pstore device is supported")); + return NULL; + } + + if (n > 0) { + if (!(def->pstore =3D virDomainPstoreDefParseXML(xmlopt, nodes[0], + ctxt, flags))) + return NULL; + } + VIR_FREE(nodes); + /* analysis of the user namespace mapping */ if ((n =3D virXPathNodeSet("./idmap/uid", ctxt, &nodes)) < 0) return NULL; @@ -21404,6 +21494,33 @@ virDomainVsockDefCheckABIStability(virDomainVsockD= ef *src, } =20 =20 +static bool +virDomainPstoreDefCheckABIStability(virDomainPstoreDef *src, + virDomainPstoreDef *dst) +{ + if (src->backend !=3D dst->backend) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target pstore device backend '%1$s' does not mat= ch source '%2$s'"), + virDomainPstoreBackendTypeToString(dst->backend), + virDomainPstoreBackendTypeToString(src->backend)); + return false; + } + + if (src->size !=3D dst->size) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target pstore size '%1$llu' does not match sourc= e '%2$llu'"), + dst->size, + src->size); + return false; + } + + if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) + return false; + + return true; +} + + static bool virDomainDefVcpuCheckAbiStability(virDomainDef *src, virDomainDef *dst) @@ -21863,6 +21980,17 @@ virDomainDefCheckABIStabilityFlags(virDomainDef *s= rc, !virDomainVsockDefCheckABIStability(src->vsock, dst->vsock)) goto error; =20 + if (!!src->pstore !=3D !!dst->pstore) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target domain pstore device count does not match= source")); + goto error; + } + + if (src->pstore && + !virDomainPstoreDefCheckABIStability(src->pstore, dst->pstore)) { + goto error; + } + if (xmlopt && xmlopt->abi.domain && !xmlopt->abi.domain(src, dst)) goto error; @@ -21903,6 +22031,7 @@ virDomainDefCheckABIStabilityFlags(virDomainDef *sr= c, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: break; } #endif @@ -27849,6 +27978,26 @@ virDomainDefFormatFeatures(virBuffer *buf, return 0; } =20 +static int +virDomainPstoreDefFormat(virBuffer *buf, + virDomainPstoreDef *pstore, + unsigned int flags) +{ + g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + + virBufferAsprintf(&attrBuf, " backend=3D'%s'", + virDomainPstoreBackendTypeToString(pstore->backend)); + + virBufferAsprintf(&childBuf, "%s\n", pstore->path); + virBufferAsprintf(&childBuf, "%llu\n", pstor= e->size); + virDomainDeviceInfoFormat(&childBuf, &pstore->info, flags); + + virXMLFormatElement(buf, "pstore", &attrBuf, &childBuf); + return 0; +} + + int virDomainDefFormatInternal(virDomainDef *def, virDomainXMLOption *xmlopt, @@ -28320,6 +28469,9 @@ virDomainDefFormatInternalSetRootName(virDomainDef = *def, if (def->vsock) virDomainVsockDefFormat(buf, def->vsock); =20 + if (def->pstore) + virDomainPstoreDefFormat(buf, def->pstore, flags); + virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); =20 @@ -28479,6 +28631,7 @@ virDomainDeviceIsUSB(virDomainDeviceDef *dev, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: break; } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8283493dfc..546c14e7b0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -87,6 +87,7 @@ typedef enum { VIR_DOMAIN_DEVICE_VSOCK, VIR_DOMAIN_DEVICE_AUDIO, VIR_DOMAIN_DEVICE_CRYPTO, + VIR_DOMAIN_DEVICE_PSTORE, =20 VIR_DOMAIN_DEVICE_LAST } virDomainDeviceType; @@ -120,6 +121,7 @@ struct _virDomainDeviceDef { virDomainVsockDef *vsock; virDomainAudioDef *audio; virDomainCryptoDef *crypto; + virDomainPstoreDef *pstore; } data; }; =20 @@ -2983,6 +2985,19 @@ struct _virDomainVirtioOptions { virTristateSwitch page_per_vq; }; =20 +typedef enum { + VIR_DOMAIN_PSTORE_BACKEND_ACPI_ERST, + + VIR_DOMAIN_PSTORE_BACKEND_LAST +} virDomainPstoreBackend; + +struct _virDomainPstoreDef { + virDomainPstoreBackend backend; + unsigned long long size; + char *path; + virDomainDeviceInfo info; +}; + =20 #define SCSI_SUPER_WIDE_BUS_MAX_CONT_UNIT 64 #define SCSI_WIDE_BUS_MAX_CONT_UNIT 16 @@ -3159,6 +3174,7 @@ struct _virDomainDef { virDomainRedirFilterDef *redirfilter; virDomainIOMMUDef *iommu; virDomainVsockDef *vsock; + virDomainPstoreDef *pstore; =20 void *namespaceData; virXMLNamespace ns; @@ -3598,6 +3614,8 @@ void virDomainVsockDefFree(virDomainVsockDef *vsock); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainVsockDef, virDomainVsockDefFree); void virDomainCryptoDefFree(virDomainCryptoDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainCryptoDef, virDomainCryptoDefFree); +void virDomainPstoreDefFree(virDomainPstoreDef *def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainPstoreDef, virDomainPstoreDefFree); void virDomainNetTeamingInfoFree(virDomainNetTeamingInfo *teaming); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainNetTeamingInfo, virDomainNetTeaming= InfoFree); void virDomainNetPortForwardFree(virDomainNetPortForward *pf); @@ -4268,6 +4286,7 @@ VIR_ENUM_DECL(virDomainCryptoBackend); VIR_ENUM_DECL(virDomainShmemModel); VIR_ENUM_DECL(virDomainShmemRole); VIR_ENUM_DECL(virDomainLaunchSecurity); +VIR_ENUM_DECL(virDomainPstoreBackend); /* from libvirt.h */ VIR_ENUM_DECL(virDomainState); VIR_ENUM_DECL(virDomainNostateReason); diff --git a/src/conf/domain_postparse.c b/src/conf/domain_postparse.c index 112795ea65..bf33f29638 100644 --- a/src/conf/domain_postparse.c +++ b/src/conf/domain_postparse.c @@ -757,6 +757,7 @@ virDomainDeviceDefPostParseCommon(virDomainDeviceDef *d= ev, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: ret =3D 0; break; =20 diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 8209e8fdae..39b8d67928 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -3022,6 +3022,33 @@ virDomainTPMDevValidate(const virDomainTPMDef *tpm) } =20 =20 +static int +virDomainPstoreDefValidate(const virDomainPstoreDef *pstore) +{ + if (pstore->backend !=3D VIR_DOMAIN_PSTORE_BACKEND_ACPI_ERST) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported backend for pstore device: %1$s"), + virDomainPstoreBackendTypeToString(pstore->backend)= ); + return -1; + } + + if (pstore->path =3D=3D NULL || pstore->path[0] =3D=3D '\0') { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing path for ACPI ERST pstore device")); + return -1; + } + + if (pstore->size < 4 || + !VIR_IS_POW2(pstore->size)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid size of ACPI ERST pstore device")); + return -1; + } + + return 0; +} + + static int virDomainDeviceInfoValidate(const virDomainDeviceDef *dev) { @@ -3132,6 +3159,9 @@ virDomainDeviceDefValidateInternal(const virDomainDev= iceDef *dev, case VIR_DOMAIN_DEVICE_TPM: return virDomainTPMDevValidate(dev->data.tpm); =20 + case VIR_DOMAIN_DEVICE_PSTORE: + return virDomainPstoreDefValidate(dev->data.pstore); + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_WATCHDOG: case VIR_DOMAIN_DEVICE_HUB: diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index ab5374d5f0..200009efa5 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -6255,6 +6255,28 @@ =20 + + + + acpi-erst + + + + + + + + + + + + + + + + + + @@ -6724,6 +6746,9 @@ + + + diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h index d8e7c5278c..f18ebcca10 100644 --- a/src/conf/virconftypes.h +++ b/src/conf/virconftypes.h @@ -260,6 +260,8 @@ typedef struct _virDomainVsockDef virDomainVsockDef; =20 typedef struct _virDomainCryptoDef virDomainCryptoDef; =20 +typedef struct _virDomainPstoreDef virDomainPstoreDef; + typedef struct _virDomainWatchdogDef virDomainWatchdogDef; =20 typedef struct _virDomainXMLOption virDomainXMLOption; diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 7580c6a06c..43ccb9cbd7 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -3133,6 +3133,7 @@ hypervDomainAttachDeviceFlags(virDomainPtr domain, co= nst char *xml, unsigned int case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_INTERNAL_ERROR, _("Attaching devices of type %1$d is not implemente= d"), dev->type); return -1; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c35366c9e1..d15d6a6a9d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -616,6 +616,8 @@ virDomainPausedReasonTypeToString; virDomainPMSuspendedReasonTypeFromString; virDomainPMSuspendedReasonTypeToString; virDomainProcessCapsFeatureTypeToString; +virDomainPstoreBackendTypeFromString; +virDomainPstoreBackendTypeToString; virDomainRedirdevBusTypeFromString; virDomainRedirdevBusTypeToString; virDomainRedirdevDefFind; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 7dcae58413..e72553603d 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -3505,6 +3505,7 @@ libxlDomainAttachDeviceLive(libxlDriverPrivate *drive= r, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%1$s' cannot be attached"), virDomainDeviceTypeToString(dev->type)); @@ -3613,6 +3614,7 @@ libxlDomainAttachDeviceConfig(virDomainDef *vmdef, vi= rDomainDeviceDef *dev) case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent attach of device is not supported= ")); return -1; @@ -3981,6 +3983,7 @@ libxlDomainDetachDeviceLive(libxlDriverPrivate *drive= r, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%1$s' cannot be detached"), virDomainDeviceTypeToString(dev->type)); @@ -4071,6 +4074,7 @@ libxlDomainDetachDeviceConfig(virDomainDef *vmdef, vi= rDomainDeviceDef *dev) case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent detach of device is not supported= ")); return -1; @@ -4133,6 +4137,7 @@ libxlDomainUpdateDeviceLive(virDomainObj *vm, virDoma= inDeviceDef *dev) case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%1$s' cannot be updated"), virDomainDeviceTypeToString(dev->type)); @@ -4195,6 +4200,7 @@ libxlDomainUpdateDeviceConfig(virDomainDef *vmdef, vi= rDomainDeviceDef *dev) case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent update of device is not supported= ")); return -1; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index f76d09e8a9..534e257f30 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -3056,6 +3056,7 @@ lxcDomainAttachDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent attach of device is not supported")); break; @@ -3121,6 +3122,7 @@ lxcDomainUpdateDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent update of device is not supported")); break; @@ -3202,6 +3204,7 @@ lxcDomainDetachDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_CRYPTO: case VIR_DOMAIN_DEVICE_AUDIO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("persistent detach of device is not supported")); break; @@ -3303,6 +3306,7 @@ lxcDomainAttachDeviceMknodHelper(pid_t pid G_GNUC_UNU= SED, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected device type %1$d"), data->def->type); @@ -3974,6 +3978,7 @@ lxcDomainAttachDeviceLive(virLXCDriver *driver, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%1$s' cannot be attached"), virDomainDeviceTypeToString(dev->type)); @@ -4391,6 +4396,7 @@ lxcDomainDetachDeviceLive(virLXCDriver *driver, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("device type '%1$s' cannot be detached"), virDomainDeviceTypeToString(dev->type)); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 684de3f701..def124cc27 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -973,6 +973,7 @@ qemuBuildVirtioDevGetConfigDev(const virDomainDeviceDef= *device, case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: default: break; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2134b11038..a8d7a1e525 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6358,6 +6358,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDef *dev, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: ret =3D 0; break; =20 @@ -10360,6 +10361,7 @@ qemuDomainPrepareChardevSourceOne(virDomainDeviceDe= f *dev, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: break; } =20 @@ -12290,6 +12292,7 @@ qemuDomainDeviceBackendChardevForeachOne(virDomainD= eviceDef *dev, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: /* no chardev backend */ break; } diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 251f5b7e1a..970ae3949d 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -470,6 +470,7 @@ qemuDomainDeviceSupportZPCI(virDomainDeviceDef *device) case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: break; =20 case VIR_DOMAIN_DEVICE_NONE: @@ -1002,6 +1003,9 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDev= iceDef *dev, } break; =20 + case VIR_DOMAIN_DEVICE_PSTORE: + return pciFlags; + /* These devices don't ever connect with PCI */ case VIR_DOMAIN_DEVICE_NVRAM: case VIR_DOMAIN_DEVICE_TPM: @@ -2424,6 +2428,13 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def, } } =20 + if (def->pstore && + virDeviceInfoPCIAddressIsWanted(&def->pstore->info)) { + if (qemuDomainPCIAddressReserveNextAddr(addrs, + &def->pstore->info) < 0) + return -1; + } + return 0; } =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9f3013e231..e473018ef2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6863,6 +6863,7 @@ qemuDomainAttachDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("persistent attach of device '%1$s' is not suppo= rted"), @@ -7081,6 +7082,7 @@ qemuDomainDetachDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("persistent detach of device '%1$s' is not suppor= ted"), @@ -7206,6 +7208,7 @@ qemuDomainUpdateDeviceConfig(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("persistent update of device '%1$s' is not suppor= ted"), diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 1f4620d833..af4229d507 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3452,6 +3452,7 @@ qemuDomainAttachDeviceLive(virDomainObj *vm, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("live attach of device '%1$s' is not supported"), @@ -5282,6 +5283,7 @@ qemuDomainRemoveAuditDevice(virDomainObj *vm, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: /* libvirt doesn't yet support detaching these devices */ break; @@ -5386,6 +5388,7 @@ qemuDomainRemoveDevice(virQEMUDriver *driver, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("don't know how to remove a %1$s device"), @@ -6270,6 +6273,7 @@ qemuDomainDetachDeviceLive(virDomainObj *vm, case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("live detach of device '%1$s' is not supported"), @@ -7259,6 +7263,7 @@ qemuDomainUpdateDeviceLive(virDomainObj *vm, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("live update of device '%1$s' is not supported"), diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 8840306bfd..0e8f0f977f 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4669,6 +4669,29 @@ qemuValidateDomainDeviceDefCrypto(virDomainCryptoDef= *crypto, } =20 =20 +static int +qemuValidateDomainDeviceDefPstore(virDomainPstoreDef *pstore, + const virDomainDef *def G_GNUC_UNUSED, + virQEMUCaps *qemuCaps) +{ + if (pstore->backend =3D=3D VIR_DOMAIN_PSTORE_BACKEND_ACPI_ERST && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_ACPI_ERST)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("acpi-erst backend of pstore device is not suppor= ted")); + return -1; + } + + if (pstore->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + pstore->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("ACPI ERST device must reside on a PCI bus")); + return -1; + } + + return 0; +} + + static int qemuSoundCodecTypeToCaps(int type) { @@ -5372,6 +5395,9 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, case VIR_DOMAIN_DEVICE_CRYPTO: return qemuValidateDomainDeviceDefCrypto(dev->data.crypto, def, qe= muCaps); =20 + case VIR_DOMAIN_DEVICE_PSTORE: + return qemuValidateDomainDeviceDefPstore(dev->data.pstore, def, qe= muCaps); + case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_PANIC: case VIR_DOMAIN_DEVICE_NONE: diff --git a/src/test/test_driver.c b/src/test/test_driver.c index df6a86ea44..7cb77f044d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -10294,6 +10294,7 @@ testDomainUpdateDevice(virDomainDef *vmdef, case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_CRYPTO: + case VIR_DOMAIN_DEVICE_PSTORE: case VIR_DOMAIN_DEVICE_LAST: virReportError(VIR_ERR_OPERATION_UNSUPPORTED, _("persistent update of device '%1$s' is not suppor= ted"), diff --git a/tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.args b/te= sts/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.args new file mode 100644 index 0000000000..d7c4708acb --- /dev/null +++ b/tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.args @@ -0,0 +1,36 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/var/lib/libvirt/qemu/domain--1-guest \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.local/share \ +XDG_CACHE_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.cache \ +XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-guest/.config \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3Dguest,debug-threads=3Don \ +-S \ +-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/va= r/lib/libvirt/qemu/domain--1-guest/master-key.aes"}' \ +-machine pc-q35-9.0,usb=3Doff,dump-guest-core=3Doff,memory-backend=3Dpc.ra= m,acpi=3Don \ +-accel kvm \ +-cpu qemu64 \ +-m size=3D1048576k \ +-object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":1073741824}= ' \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 63840878-0deb-4095-97e6-fc444d9bc9fa \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device '{"driver":"pcie-root-port","port":8,"chassis":1,"id":"pci.1","bus= ":"pcie.0","multifunction":true,"addr":"0x1"}' \ +-device '{"driver":"pcie-pci-bridge","id":"pci.2","bus":"pci.1","addr":"0x= 0"}' \ +-device '{"driver":"pcie-root-port","port":9,"chassis":3,"id":"pci.3","bus= ":"pcie.0","addr":"0x1.0x1"}' \ +-audiodev '{"id":"audio1","driver":"none"}' \ +-global ICH9-LPC.noreboot=3Doff \ +-watchdog-action reset \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.xml b/tes= ts/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.xml new file mode 120000 index 0000000000..11ade68605 --- /dev/null +++ b/tests/qemuxmlconfdata/pstore-acpi-erst.x86_64-latest.xml @@ -0,0 +1 @@ +pstore-acpi-erst.xml \ No newline at end of file diff --git a/tests/qemuxmlconfdata/pstore-acpi-erst.xml b/tests/qemuxmlconf= data/pstore-acpi-erst.xml new file mode 100644 index 0000000000..9b9ba266b2 --- /dev/null +++ b/tests/qemuxmlconfdata/pstore-acpi-erst.xml @@ -0,0 +1,53 @@ + + guest + 63840878-0deb-4095-97e6-fc444d9bc9fa + 1048576 + 1048576 + 1 + + hvm + + + + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + +
+ + + +
+ + + + +
+ + + +