From nobody Tue Feb 10 07:42:40 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1666774973; cv=none; d=zohomail.com; s=zohoarc; b=nyU3FU4PI1nEqapO/NSTGVuxm0l0t7q1dqCOhoRPO205FyChXnGJxqp1x0ZHyubnQfzBUNWu6YHNLvaPG4uEwtNzxRaga/5R/bgyqf6JFcvRiArEPaD3jCKrFyqi26KJUQpGfTjJtkbwrwkEe4l5qYIw4TNv9iju6qcB6fgDbyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666774973; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RSyNDNyP588Efkhc/If9+u59f4TkyEPg4UO3cris5og=; b=MzUkzVRts3gmuC3C4nnLF6UEQFpbxMZuvfWQX+CRsxru04FGbqwHtV7ITA0d6F9xhIn3md/RVTGigP0MTDngMFGU4yaBHRWS+T713BMLwi4LArR416cyvMOaubcBH4TdqRKABHs3LZsLJzsmWRrtp5s5M9AbWG2J4zTUT+nz8qs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666774973612451.4151582941646; Wed, 26 Oct 2022 02:02:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oncDr-0005y8-LD; Wed, 26 Oct 2022 04:57:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oncDn-0005di-DO for qemu-devel@nongnu.org; Wed, 26 Oct 2022 04:57:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oncDZ-0000Vy-PF for qemu-devel@nongnu.org; Wed, 26 Oct 2022 04:57:11 -0400 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-533-hqd4oYXfPTODMcUb1S9WoQ-1; Wed, 26 Oct 2022 04:56:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3FA86800B30; Wed, 26 Oct 2022 08:56:39 +0000 (UTC) Received: from localhost (unknown [10.39.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C08740C2140; Wed, 26 Oct 2022 08:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666774617; 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=RSyNDNyP588Efkhc/If9+u59f4TkyEPg4UO3cris5og=; b=Lik7A1qS7gZ9eNPHkOpUfljqqW8iiZ/Xx6jU2JEMjS/o+sR7neVxZwc9x5o+TYWrmXTfGc YV8V++gxH2NvvkMHace/kHEM+sXU99DZiBbLKF04Lk1z9tn5hStuLF6Sm9/BqdbhqlHK5/ gFFIRFr+xOdaUb0x4hoPkoeDsoo9jfo= X-MC-Unique: hqd4oYXfPTODMcUb1S9WoQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Cornelia Huck , Halil Pasic , Christian Borntraeger , Eric Farman , Thomas Huth , David Hildenbrand , qemu-s390x@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , Janosch Frank Subject: [PULL v3 09/11] s390x: Add KVM PV dump interface Date: Wed, 26 Oct 2022 12:55:37 +0400 Message-Id: <20221026085540.254253-10-marcandre.lureau@redhat.com> In-Reply-To: <20221026085540.254253-1-marcandre.lureau@redhat.com> References: <20221026085540.254253-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.517, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1666774974638100001 From: Janosch Frank Let's add a few bits of code which hide the new KVM PV dump API from us via new functions. Signed-off-by: Janosch Frank Reviewed-by: Janis Schoetterl-Glausch Reviewed-by: Steffen Eiden [ Marc-Andr=C3=A9: fix up for compilation issue ] Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20221017083822.43118-10-frankja@linux.ibm.com> --- include/hw/s390x/pv.h | 9 ++++++++ hw/s390x/pv.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/include/hw/s390x/pv.h b/include/hw/s390x/pv.h index e5ea0eca16..9360aa1091 100644 --- a/include/hw/s390x/pv.h +++ b/include/hw/s390x/pv.h @@ -51,6 +51,10 @@ uint64_t kvm_s390_pv_dmp_get_size_cpu(void); uint64_t kvm_s390_pv_dmp_get_size_mem_state(void); uint64_t kvm_s390_pv_dmp_get_size_completion_data(void); bool kvm_s390_pv_info_basic_valid(void); +int kvm_s390_dump_init(void); +int kvm_s390_dump_cpu(S390CPU *cpu, void *buff); +int kvm_s390_dump_mem_state(uint64_t addr, size_t len, void *dest); +int kvm_s390_dump_completion_data(void *buff); #else /* CONFIG_KVM */ static inline bool s390_is_pv(void) { return false; } static inline int s390_pv_query_info(void) { return 0; } @@ -66,6 +70,11 @@ static inline uint64_t kvm_s390_pv_dmp_get_size_cpu(void= ) { return 0; } static inline uint64_t kvm_s390_pv_dmp_get_size_mem_state(void) { return 0= ; } static inline uint64_t kvm_s390_pv_dmp_get_size_completion_data(void) { re= turn 0; } static inline bool kvm_s390_pv_info_basic_valid(void) { return false; } +static inline int kvm_s390_dump_init(void) { return 0; } +static inline int kvm_s390_dump_cpu(S390CPU *cpu, void *buff) { return 0; } +static inline int kvm_s390_dump_mem_state(uint64_t addr, size_t len, + void *dest) { return 0; } +static inline int kvm_s390_dump_completion_data(void *buff) { return 0; } #endif /* CONFIG_KVM */ =20 int s390_pv_kvm_init(ConfidentialGuestSupport *cgs, Error **errp); diff --git a/hw/s390x/pv.c b/hw/s390x/pv.c index 4c012f2eeb..728ba24547 100644 --- a/hw/s390x/pv.c +++ b/hw/s390x/pv.c @@ -175,6 +175,57 @@ bool kvm_s390_pv_info_basic_valid(void) return info_valid; } =20 +static int s390_pv_dump_cmd(uint64_t subcmd, uint64_t uaddr, uint64_t gadd= r, + uint64_t len) +{ + struct kvm_s390_pv_dmp dmp =3D { + .subcmd =3D subcmd, + .buff_addr =3D uaddr, + .buff_len =3D len, + .gaddr =3D gaddr, + }; + int ret; + + ret =3D s390_pv_cmd(KVM_PV_DUMP, (void *)&dmp); + if (ret) { + error_report("KVM DUMP command %ld failed", subcmd); + } + return ret; +} + +int kvm_s390_dump_cpu(S390CPU *cpu, void *buff) +{ + struct kvm_s390_pv_dmp dmp =3D { + .subcmd =3D KVM_PV_DUMP_CPU, + .buff_addr =3D (uint64_t)buff, + .gaddr =3D 0, + .buff_len =3D info_dump.dump_cpu_buffer_len, + }; + struct kvm_pv_cmd pv =3D { + .cmd =3D KVM_PV_DUMP, + .data =3D (uint64_t)&dmp, + }; + + return kvm_vcpu_ioctl(CPU(cpu), KVM_S390_PV_CPU_COMMAND, &pv); +} + +int kvm_s390_dump_init(void) +{ + return s390_pv_dump_cmd(KVM_PV_DUMP_INIT, 0, 0, 0); +} + +int kvm_s390_dump_mem_state(uint64_t gaddr, size_t len, void *dest) +{ + return s390_pv_dump_cmd(KVM_PV_DUMP_CONFIG_STOR_STATE, (uint64_t)dest, + gaddr, len); +} + +int kvm_s390_dump_completion_data(void *buff) +{ + return s390_pv_dump_cmd(KVM_PV_DUMP_COMPLETE, (uint64_t)buff, 0, + info_dump.dump_config_finalize_len); +} + #define TYPE_S390_PV_GUEST "s390-pv-guest" OBJECT_DECLARE_SIMPLE_TYPE(S390PVGuest, S390_PV_GUEST) =20 --=20 2.37.3