Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp961317imp; Wed, 20 Feb 2019 12:19:56 -0800 (PST) X-Google-Smtp-Source: AHgI3IbHeZ61+SKAB/pb///+KIu2IyFozd8Ss13ZPynIpuWkFO6W9PuDCs1tYNHgrzxa8QR0NFze X-Received: by 2002:a17:902:8ecb:: with SMTP id x11mr1750232plo.40.1550693996589; Wed, 20 Feb 2019 12:19:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550693996; cv=none; d=google.com; s=arc-20160816; b=LCkQd7i8AP8kmJ+eJ+EVRAtPOsy1jVw5LXHOzUglBodmrsnLF3OViIfYAD9Zr1gxZl N1cVFc8VadT4Cf7gClpernj28ARxLaBfonG3gyy85h0dhuo7YJzVZgND9pmTxa3Vflm0 P107DhMhJZUR0Fp/wN+VoIh7za3WMZ/FgghN0LmVRSU7Y4P5yChGOnOhJAv84Yhl0Ym/ nw+yzksDn4IFYLzv63numsZXL6z68RrDqTlE5HIOBVsbXyz/Rto3yPIT8erfBVz8I+ZN MEjyAlyDgX8Yv1gHXR4Ytf48R6hbNp+12goc0fX8TNqTlViT0LcA08PXnDKl41XizVNs Xq+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SgHD9NVfwS2nZ8X3B3FNB8zCOkq9pVflU3V9h8Ufw4Y=; b=UXKiO3hGFlJd/1bPolz4RlLt7N3gghBkGQ8PtBUuihXK1p59k5XJcO5BljebRnYCEs nWDWY233PSJ7LDAK6u2GE3LvU8dJ5sWYEmhUI8SFwKfFdJRPGf2NyFppWI1nUK/9Fbz0 RZrSr3OBNWjqb0iMz1+v/4V0UGJu8dUS1EESYEIwEpDSacRejqS+9AX2KU1dRXbvy3bY 8Vd+m4s9+r+cNeYw/wOHJCIv8n3EKoTD6AOqGJn/QVc7p4j0y8M7/KkEBNLcVuT5mWW5 5TtuiEhJh+6vv33Gx3Gqy7vFw/KKnEhT+JbQeHru88oxFu/vtaSGlsLUqzEuDt0ob5va QwtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=H4Q1jVpb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si18700422pgi.513.2019.02.20.12.19.41; Wed, 20 Feb 2019 12:19:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=H4Q1jVpb; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727086AbfBTUSy (ORCPT + 99 others); Wed, 20 Feb 2019 15:18:54 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:53246 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728049AbfBTUSu (ORCPT ); Wed, 20 Feb 2019 15:18:50 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1KK8ZDJ081724; Wed, 20 Feb 2019 20:18:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=SgHD9NVfwS2nZ8X3B3FNB8zCOkq9pVflU3V9h8Ufw4Y=; b=H4Q1jVpbdxB8niJnlfhNM+b5amup3s7H37wbFI/ZDHxpSsaYmKa3ISPDKi4+d/uywI30 zgHvqvHNlUtjcFM/7J1ozxcJobITDFgmeRJuBkmiH98AuGKExNSthwPQOorHk2OfSGmU sw1NNy0xYv6FJOQr09yCgp3QRQw0MFoMzrG58SMh40Fz0a9rh1x9NKvlBwfspxT/LVob 9cPrfPGZrQWA9F9VXDKB4BCtsJTM316KKRAzSTPINDv97b4poPUR0A/zG3NjtCP1NTxS drXjhXRxZRrDqmHAJnk5HpH+Kd//qhGz18JjNfX5i4JLlT4f5Z8KI5XW2lTXZ4y/9psH ug== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2qp9xu3xne-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Feb 2019 20:18:36 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x1KKIUR3019979 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Feb 2019 20:18:30 GMT Received: from abhmp0022.oracle.com (abhmp0022.oracle.com [141.146.116.28]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1KKIUhI018949; Wed, 20 Feb 2019 20:18:30 GMT Received: from paddy.lan (/94.61.137.133) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Feb 2019 12:18:29 -0800 From: Joao Martins To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ankur Arora , Boris Ostrovsky , Joao Martins , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org Subject: [PATCH RFC 30/39] KVM: x86/xen: add additional evtchn ops Date: Wed, 20 Feb 2019 20:16:00 +0000 Message-Id: <20190220201609.28290-31-joao.m.martins@oracle.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190220201609.28290-1-joao.m.martins@oracle.com> References: <20190220201609.28290-1-joao.m.martins@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9173 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902200138 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ankur Arora Add support for changing event channel affinity (EVTCHNOP_bind_vcpu) and closing an event (EVTCHNOP_close). We just piggy back on the functionality already implemented for guest event channels. Signed-off-by: Ankur Arora --- arch/x86/kvm/xen.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c index 1988ed3866bf..666dd6d1f5a3 100644 --- a/arch/x86/kvm/xen.c +++ b/arch/x86/kvm/xen.c @@ -2188,6 +2188,38 @@ static int shim_hcall_evtchn(int op, void *p) ret = shim_hcall_evtchn_send(xen_shim, send); break; } + case EVTCHNOP_bind_virq: { + struct evtchn_bind_virq *un; + + un = (struct evtchn_bind_virq *) p; + + evt.fd = -1; + evt.port = 0; + evt.type = XEN_EVTCHN_TYPE_VIRQ; + ret = kvm_xen_eventfd_assign(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, &evt); + un->port = evt.port; + break; + } + case EVTCHNOP_bind_vcpu: { + struct evtchn_bind_vcpu *bind_vcpu; + + bind_vcpu = (struct evtchn_bind_vcpu *) p; + + evt.port = bind_vcpu->port; + evt.vcpu = bind_vcpu->vcpu; + ret = kvm_xen_eventfd_update(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, &evt); + break; + } + case EVTCHNOP_close: { + struct evtchn_close *cls; + + cls = (struct evtchn_close *) p; + ret = kvm_xen_eventfd_deassign(NULL, &xen_shim->port_to_evt, + &xen_shim->xen_lock, cls->port); + break; + } default: ret = -EINVAL; break; -- 2.11.0