From nobody Tue Feb 10 05:46:43 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=OtwU8Q/bgr4PBayGkSlA2ckEl4pg8JeVhs/gSDnwavNfH+/STNcWTfmbMFfNVm5Rn9B4GNLuklN0fheUS8R+GFM91DSNTEp4Rd+dyEyaO/guAyQDyvQRC8nuUiw7wLvG7qMw4j2AA0Gd2Tzogmx5wlQRk3SxtDw8+LJdnVkm53g= 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=kDgdeRtde1si1UIwWVHfHeWDauCf5o4zQrQaHVpTixw=; b=jLXr2lKhjIS7WxMMma/tvIzsuKi8lIvAkhNzb9mabOuScgbjsGTdo+AFldV+1voO1rR0sOfoD2bJKqYB3Sxuthx5bpvKzfABLXiLbMLQPCle1Q3HM2c2/iuJ4ffI5zP+wzhn5EIXxmdiMEt12FAlMsnZGT8TTDvMv5h63BLLgJI= 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 1605125269030902.9479575387899; Wed, 11 Nov 2020 12:07:49 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.25212.52885 (Exim 4.92) (envelope-from ) id 1kcwOz-0003UL-As; Wed, 11 Nov 2020 20:07:33 +0000 Received: by outflank-mailman (output) from mailman id 25212.52885; 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-0003Ty-1d; Wed, 11 Nov 2020 20:07:33 +0000 Received: by outflank-mailman (input) for mailman id 25212; Wed, 11 Nov 2020 20:07:31 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcwOw-0003OZ-VU for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 20:07:30 +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 1kcwOw-0000pY-Ng; Wed, 11 Nov 2020 20:07:30 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kcwOw-0003OZ-VU for xen-devel@lists.xenproject.org; Wed, 11 Nov 2020 20:07:30 +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 1kcwOw-0000pY-Ng; Wed, 11 Nov 2020 20:07:30 +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 07/10] viridian: add ExProcessorMasks variant of the IPI hypercall Date: Wed, 11 Nov 2020 20:07:18 +0000 Message-Id: <20201111200721.30551-8-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 A previous patch introduced variants of the flush hypercalls that take a 'Virtual Processor Set' as an argument rather than a simple 64-bit mask. This patch introduces a similar variant of the HVCALL_SEND_IPI hypercall (HVCALL_SEND_IPI_EX). NOTE: As with HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE/LIST_EX, a guest should not yet issue the HVCALL_SEND_IPI_EX hypercall as support for 'ExProcessorMasks' is not yet advertised via CPUID. 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 | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridi= an/viridian.c index 1226e1596a1c..e899dd1e9f55 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -865,6 +865,67 @@ static int hvcall_ipi(union hypercall_input *input, return 0; } =20 +static int hvcall_ipi_ex(union hypercall_input *input, + union hypercall_output *output, + unsigned long input_params_gpa, + unsigned long output_params_gpa) +{ + struct hypercall_vpmask *vpmask =3D &this_cpu(hypercall_vpmask); + struct { + uint32_t vector; + uint8_t target_vtl; + uint8_t reserved_zero[3]; + struct hv_vpset set; + } input_params; + struct hypercall_vpset *vpset =3D &this_cpu(hypercall_vpset); + struct hv_vpset *set =3D &vpset->set; + size_t size; + int rc; + + /* These hypercalls should never use the fast-call convention. */ + if ( input->fast ) + return -EINVAL; + + /* Get input parameters. */ + if ( hvm_copy_from_guest_phys(&input_params, input_params_gpa, + sizeof(input_params)) !=3D HVMTRANS_okay= ) + return -EINVAL; + + if ( input_params.target_vtl || + input_params.reserved_zero[0] || + input_params.reserved_zero[1] || + input_params.reserved_zero[2] ) + return HV_STATUS_INVALID_PARAMETER; + + if ( input_params.vector < 0x10 || input_params.vector > 0xff ) + return HV_STATUS_INVALID_PARAMETER; + + *set =3D input_params.set; + if ( set->format =3D=3D HV_GENERIC_SET_SPARSE_4K ) + { + unsigned long offset =3D offsetof(typeof(input_params), + set.bank_contents); + + size =3D sizeof(*set->bank_contents) * hv_vpset_nr_banks(set); + if ( hvm_copy_from_guest_phys(&set->bank_contents, + input_params_gpa + offset, + size) !=3D HVMTRANS_okay) + return -EINVAL; + + size +=3D sizeof(*set); + } + else + size =3D sizeof(*set); + + rc =3D hv_vpset_to_vpmask(set, size, vpmask); + if ( rc ) + return rc; + + send_ipi(vpmask, input_params.vector); + + return 0; +} + int viridian_hypercall(struct cpu_user_regs *regs) { struct vcpu *curr =3D current; @@ -919,6 +980,11 @@ int viridian_hypercall(struct cpu_user_regs *regs) output_params_gpa); break; =20 + case HVCALL_SEND_IPI_EX: + rc =3D hvcall_ipi_ex(&input, &output, input_params_gpa, + output_params_gpa); + break; + default: gprintk(XENLOG_WARNING, "unimplemented hypercall %04x\n", input.call_code); --=20 2.20.1