From nobody Tue Feb 10 03:38:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1605125269; cv=none; d=zohomail.com; s=zohoarc; b=hEv46rcbFjM7RGkwO2HIEWp4uGkvGo3FAxvj7Hm0tePdVR8YJPI+i54vahGpkej9DXibQf5JG3oZLJqnYY21E3GDtQ4jQWQ9+kzj4Req66h5VFBqUyT6wkh9qQzmLWMGBy1tzNmiIUNr0fOa5JpnkV/HQ5ogXqIsbtsQPOunZq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605125269; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=stmR7sdZ5bFjPwpJLLdb8Wsgj3DfsdGgh+34uXEOX4k=; b=jn+YLLp6tKpG6vvd1Ix8xij7FWtNmvPXWZz9xX60GyEFuHbhgbNqr5NrpJodkh+DwPS+iBSgSUax0bYllo7US718M4rnKmLd5lPwbv4RcHl8q+DyRpiqyURmq9BRrpFYbhpWFHzB9SQOthpfVKcKMhYCeTwN8UXkHRRKpsIsEjg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1605125269491868.1684570429023; Wed, 11 Nov 2020 12:07:49 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.25213.52891 (Exim 4.92) (envelope-from ) id 1kcwP0-0003VP-7c; Wed, 11 Nov 2020 20:07:34 +0000 Received: by outflank-mailman (output) from mailman id 25213.52891; Wed, 11 Nov 2020 20:07:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcwOz-0003Uy-HF; Wed, 11 Nov 2020 20:07:33 +0000 Received: by outflank-mailman (input) for mailman id 25213; Wed, 11 Nov 2020 20:07:32 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcwOy-0003RR-2w for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 20:07:32 +0000 Received: from host109-146-187-185.range109-146.btcentralplus.com ([109.146.187.185] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcwOx-0000pY-Qt; Wed, 11 Nov 2020 20:07:32 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcwOy-0003RR-2w for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 20:07:32 +0000 Received: from host109-146-187-185.range109-146.btcentralplus.com ([109.146.187.185] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcwOx-0000pY-Qt; Wed, 11 Nov 2020 20:07:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" From: Paul Durrant To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Wei Liu , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 08/10] viridian: log initial invocation of each type of hypercall Date: Wed, 11 Nov 2020 20:07:19 +0000 Message-Id: <20201111200721.30551-9-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201111200721.30551-1-paul@xen.org> References: <20201111200721.30551-1-paul@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Paul Durrant To make is simpler to observe which viridian hypercalls are issued by a particular Windows guest, this patch adds a per-domain mask to track them. Each type of hypercall causes a different bit to be set in the mask and when the bit transitions from clear to set, a log line is emitted showing the name of the hypercall and the domain that issued it. Signed-off-by: Paul Durrant --- Cc: Wei Liu Cc: Jan Beulich Cc: Andrew Cooper Cc: "Roger Pau Monn=C3=A9" --- xen/arch/x86/hvm/viridian/viridian.c | 21 +++++++++++++++++++++ xen/include/asm-x86/hvm/viridian.h | 8 ++++++++ 2 files changed, 29 insertions(+) diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridi= an/viridian.c index e899dd1e9f55..670fec3a4870 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -930,6 +930,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) { struct vcpu *curr =3D current; struct domain *currd =3D curr->domain; + struct viridian_domain *vd =3D currd->arch.hvm.viridian; int mode =3D hvm_guest_x86_mode(curr); unsigned long input_params_gpa, output_params_gpa; int rc =3D 0; @@ -957,6 +958,10 @@ int viridian_hypercall(struct cpu_user_regs *regs) switch ( input.call_code ) { case HVCALL_NOTIFY_LONG_SPIN_WAIT: + if ( !test_and_set_bit(_HCALL_spin_wait, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "d%d: VIRIDIAN HVCALL_NOTIFY_LONG_SPIN_WA= IT\n", + currd->domain_id); + /* * See section 14.5.1 of the specification. */ @@ -965,22 +970,38 @@ int viridian_hypercall(struct cpu_user_regs *regs) =20 case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE: case HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST: + if ( !test_and_set_bit(_HCALL_flush, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_FLUSH_VIRTUAL_ADDRE= SS_SPACE/LIST\n", + currd); + rc =3D hvcall_flush(&input, &output, input_params_gpa, output_params_gpa); break; =20 case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX: case HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX: + if ( !test_and_set_bit(_HCALL_flush_ex, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_FLUSH_VIRTUAL_ADDRE= SS_SPACE/LIST_EX\n", + currd); + rc =3D hvcall_flush_ex(&input, &output, input_params_gpa, output_params_gpa); break; =20 case HVCALL_SEND_IPI: + if ( !test_and_set_bit(_HCALL_ipi, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_SEND_IPI\n", + currd); + rc =3D hvcall_ipi(&input, &output, input_params_gpa, output_params_gpa); break; =20 case HVCALL_SEND_IPI_EX: + if ( !test_and_set_bit(_HCALL_ipi_ex, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_SEND_IPI_EX\n", + currd); + rc =3D hvcall_ipi_ex(&input, &output, input_params_gpa, output_params_gpa); break; diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/v= iridian.h index cbf77d9c760b..d176c4b9153b 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -59,6 +59,14 @@ struct viridian_domain { union hv_guest_os_id guest_os_id; union hv_vp_assist_page_msr hypercall_gpa; + unsigned long hypercall_flags; + +#define _HCALL_spin_wait 0 +#define _HCALL_flush 1 +#define _HCALL_flush_ex 2 +#define _HCALL_ipi 3 +#define _HCALL_ipi_ex 4 + struct viridian_time_ref_count time_ref_count; struct viridian_page reference_tsc; }; --=20 2.20.1