From patchwork Mon Feb 29 20:39:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Rzeszutek Wilk X-Patchwork-Id: 8458011 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0740FC0553 for ; Mon, 29 Feb 2016 20:42:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1AD06201B4 for ; Mon, 29 Feb 2016 20:42:39 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1978520173 for ; Mon, 29 Feb 2016 20:42:38 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aaUbk-0003Zf-76; Mon, 29 Feb 2016 20:39:56 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1aaUbj-0003ZZ-G3 for xen-devel@lists.xenproject.org; Mon, 29 Feb 2016 20:39:55 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 50/AE-03306-A9CA4D65; Mon, 29 Feb 2016 20:39:54 +0000 X-Env-Sender: konrad@char.us.oracle.com X-Msg-Ref: server-8.tower-31.messagelabs.com!1456778392!25986383!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19284 invoked from network); 29 Feb 2016 20:39:53 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-8.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 29 Feb 2016 20:39:53 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u1TKdms6008885 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 29 Feb 2016 20:39:49 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u1TKdlk6013417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 29 Feb 2016 20:39:48 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id u1TKdk4Y007131; Mon, 29 Feb 2016 20:39:47 GMT Received: from char.us.oracle.com (/10.137.176.158) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 29 Feb 2016 12:39:46 -0800 Received: by char.us.oracle.com (Postfix, from userid 1000) id A2CF56A0047; Mon, 29 Feb 2016 15:39:45 -0500 (EST) From: Konrad Rzeszutek Wilk To: xen-devel@lists.xenproject.org Date: Mon, 29 Feb 2016 15:39:36 -0500 Message-Id: <1456778376-2983-1-git-send-email-konrad.wilk@oracle.com> X-Mailer: git-send-email 2.4.3 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: Andrew Cooper , boris.ostrovsky@oracle.com, Keir Fraser , Jan Beulich , Konrad Rzeszutek Wilk Subject: [Xen-devel] [PATCH] x86: Update HVM_PARAM_CALLBACK_IRQ X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Couple of updates: - Add an macro to make it easier to use the vector callback. - Fix the odditity in Xen internal usage of an enum which offset by one compared to the #defines. Make it the same. - This also clears up the printing of the Callback in the irq_dump() to match up with the #defines. Reported-by: Boris Ostrovsky Signed-off-by: Konrad Rzeszutek Wilk --- xen/arch/x86/hvm/irq.c | 2 +- xen/include/asm-x86/hvm/irq.h | 12 ++++++++---- xen/include/public/hvm/hvm_op.h | 3 ++- xen/include/public/hvm/params.h | 15 +++++++++++++++ 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c index 5323d7c..0c6ead4 100644 --- a/xen/arch/x86/hvm/irq.c +++ b/xen/arch/x86/hvm/irq.c @@ -325,7 +325,7 @@ void hvm_set_callback_via(struct domain *d, uint64_t via) unsigned int gsi=0, pdev=0, pintx=0; uint8_t via_type; - via_type = (uint8_t)(via >> 56) + 1; + via_type = (uint8_t)(via >> HVM_PARAM_CALLBACK_TYPE_SHIFT); if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) || (via_type > HVMIRQ_callback_vector) ) via_type = HVMIRQ_callback_none; diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h index 73b8fb0..2a301db 100644 --- a/xen/include/asm-x86/hvm/irq.h +++ b/xen/include/asm-x86/hvm/irq.h @@ -26,6 +26,8 @@ #include #include +#include + struct hvm_irq { /* * Virtual interrupt wires for a single PCI bus. @@ -50,11 +52,13 @@ struct hvm_irq { /* Virtual interrupt and via-link for paravirtual platform driver. */ uint32_t callback_via_asserted; union { + /* These MUST match with HVM_PARAM_CALLBACK_IRQ types. */ enum { - HVMIRQ_callback_none, - HVMIRQ_callback_gsi, - HVMIRQ_callback_pci_intx, - HVMIRQ_callback_vector + HVMIRQ_callback_gsi = HVM_PARAM_CALLBACK_TYPE_GSI, + HVMIRQ_callback_pci_intx = HVM_PARAM_CALLBACK_TYPE_PCI_INTX, + HVMIRQ_callback_vector = HVM_PARAM_CALLBACK_TYPE_VECTOR, + /* Will change if we add more types. */ + HVMIRQ_callback_none = HVM_PARAM_CALLBACK_TYPE_NUM, } callback_via_type; }; union { diff --git a/xen/include/public/hvm/hvm_op.h b/xen/include/public/hvm/hvm_op.h index 1606185..5908f39 100644 --- a/xen/include/public/hvm/hvm_op.h +++ b/xen/include/public/hvm/hvm_op.h @@ -386,7 +386,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); * channel upcalls on the specified . If set, * this vector will be used in preference to the * domain global callback via (see - * HVM_PARAM_CALLBACK_IRQ). + * HVM_PARAM_CALLBACK_IRQ and + * HVM_PARAM_CALLBACK_VECTOR). */ #define HVMOP_set_evtchn_upcall_vector 23 struct xen_hvm_evtchn_upcall_vector { diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index 73d4718..5c7fbc5 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -56,6 +56,21 @@ */ /* + * In the future this may change. + */ +#define HVM_PARAM_CALLBACK_TYPE_NUM HVM_PARAM_CALLBACK_TYPE_VECTOR + 1 +/* + * The val[63:56] convenience shift. + */ +#define HVM_PARAM_CALLBACK_TYPE_SHIFT 56 + +/* + * Wrapper around for HVM_PARAM_CALLBACK_TYPE_VECTOR. + */ +#define HVM_PARAM_CALLBACK_VECTOR(x) \ + (((uint64_t)HVM_PARAM_CALLBACK_TYPE_VECTOR) << \ + HVM_PARAM_CALLBACK_TYPE_SHIFT | (x)) +/* * These are not used by Xen. They are here for convenience of HVM-guest * xenbus implementations. */