From patchwork Thu Sep 29 01:19:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 77104 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp79882qgf; Wed, 28 Sep 2016 18:22:13 -0700 (PDT) X-Received: by 10.107.167.8 with SMTP id q8mr232411ioe.110.1475112133544; Wed, 28 Sep 2016 18:22:13 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id z133si80342itf.70.2016.09.28.18.22.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Sep 2016 18:22:13 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0x-0001ft-Ua; Thu, 29 Sep 2016 01:19:55 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bpQ0w-0001df-Og for xen-devel@lists.xen.org; Thu, 29 Sep 2016 01:19:54 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id EA/25-28857-A3C6CE75; Thu, 29 Sep 2016 01:19:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfSOsa5lzpt wg2kbVC2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oyHB46wF1wQqWg5cJC1gXGmYBcjJ4eQwERG iQ9XrboYuThYBOYxS1z/MIMZJCEh0M8qcWOnGoQdI3F26j2oeJXEj7U7WCGa1SSWHV7IDNIsJ NDEJNH25iY7SIJNQEfixaSdbCC2iIC0xLXPlxlBipgFJjFJzJm3iBEkISwQKbF3+mewBhYBVY kTL46ATeUVsJHYNeU0C8Q2TYnps16DbeYEin9o+cUMsdlaYtm3zSwTGAUWMDKsYtQoTi0qSy3 SNTLUSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDC0GINjB+GdZwCFGSQ4mJVFe Tp834UJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeL2ygXKCRanpqRVpmTnAIIdJS3DwKInwvsoCS vMWFyTmFmemQ6ROMRpzbPl9bS0Tx7ap99YyCbHk5eelSonzRoFMEgApzSjNgxsEi75LjLJSwr yMQKcJ8RSkFuVmlqDKv2IU52BUEuZNAJnCk5lXArfvFdApTECnLD3xAuSUkkSElFQDY93BsiR fz/Dfu/WMPjyK93S4N1nw7wE/55lObQe6Vur7OR3J2MN0SN1XeYHUsiyPhadqbafZG0SJ250s mTnn+lT25plzP3ny8EWYz/5ocHP934+PD5Zc1jmp4PnOuIblo/NGtTWFbTIpy7qW2G46bHDqH FeMr5mjeMF81QOy8+t+v/Gxt95zW4mlOCPRUIu5qDgRANNIjU+5AgAA X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-7.tower-27.messagelabs.com!1475111992!57477603!1 X-Originating-IP: [209.85.220.51] X-SpamReason: No, hits=0.0 required=7.0 tests=UPPERCASE_25_50 X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56696 invoked from network); 29 Sep 2016 01:19:53 -0000 Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by server-7.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 29 Sep 2016 01:19:53 -0000 Received: by mail-pa0-f51.google.com with SMTP id oz2so21905637pac.2 for ; Wed, 28 Sep 2016 18:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PgSQwkSaALplDC3suQ8OMXXRXTB5/4TpqbkbCTBPBO0=; b=M3rhuLpz2OqbBDauw1pzpz29md4zt3Zy3rHlMW3j/1i/cbymfiu6C1uVndTudni447 yHMRuD6C9VfnjOJzeUf68o4M9kUW3ae9taMiCTzpX6+KmUAZiF/Zws3DH0vVS/bcu/T0 XrCcIscajQvIPsBbt2mB7COKqNyPQZoQw+bOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PgSQwkSaALplDC3suQ8OMXXRXTB5/4TpqbkbCTBPBO0=; b=Lu+4KRDLXYA9w/y6YP522PhDQmlfmvmdjXyjYViL4/3Ejxt4B9c87PGufiZTS8TlxE hM6lEBoHHkl9ln+vScZC08BojPpuk8Dxx95T8f/3KJ5OkyzCEu3OPSC6g09a5ndUdM8F mIktrGabKYgTHdgbBbxECWWPu8DiwApIFPup1lH0nYbhJF0JITiSfeaF8IY21XzShH5R dBNefrhVVRKOeZkOrgPsMXO94PC/lJ+UtPiS3g9jGrcO/DhnQUl1hxA7ZRI9zvk9yN8L 0JV5Rgws3pmEILferEzuSi50bKQc0+h1V6ZQqUCDenWIq2pzZ2jw+001ZWvKenBWyk9d iMtQ== X-Gm-Message-State: AA6/9RkFpzpdHFeQZAbC0p3CL+stJ2oZO8gfUNWIGJ/elrt+D3LGx7zceulbSYFnWjT/0Dey X-Received: by 10.66.216.102 with SMTP id op6mr28416625pac.46.1475111991943; Wed, 28 Sep 2016 18:19:51 -0700 (PDT) Received: from HZA160860128-A.china.huawei.com ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id wd7sm15228744pab.2.2016.09.28.18.19.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 28 Sep 2016 18:19:51 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Wed, 28 Sep 2016 18:19:00 -0700 Message-Id: <20160929011902.7784-15-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.10.0.windows.1 In-Reply-To: <20160929011902.7784-1-shannon.zhao@linaro.org> References: <20160929011902.7784-1-shannon.zhao@linaro.org> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, Andrew Cooper , ian.jackson@eu.citrix.com, julien.grall@arm.com, Shannon Zhao , Jan Beulich , zhaoshenglong@huawei.com, boris.ostrovsky@oracle.com Subject: [Xen-devel] [PATCH v8 14/16] public/hvm/params.h: Add macros for HVM_PARAM_CALLBACK_TYPE_PPI 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" Add macros for HVM_PARAM_CALLBACK_TYPE_PPI operation values and update them in evtchn_fixup(). Also use HVM_PARAM_CALLBACK_IRQ_TYPE_MASK in hvm_set_callback_via(). Cc: Jan Beulich Cc: Andrew Cooper Signed-off-by: Shannon Zhao --- xen/arch/arm/domain_build.c | 9 ++++++--- xen/arch/x86/hvm/irq.c | 2 +- xen/include/public/hvm/params.h | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index f1c5526..ce97359 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2064,9 +2064,12 @@ static void evtchn_fixup(struct domain *d, struct kernel_info *kinfo) d->arch.evtchn_irq); /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ */ - val = (u64)HVM_PARAM_CALLBACK_TYPE_PPI << 56; - val |= (2 << 8); /* Active-low level-sensitive */ - val |= d->arch.evtchn_irq & 0xff; + val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI, + HVM_PARAM_CALLBACK_IRQ_TYPE_MASK); + /* Active-low level-sensitive */ + val |= MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL, + HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK); + val |= d->arch.evtchn_irq; d->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ] = val; /* diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c index 5323d7c..e597114 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)MASK_EXTR(via, HVM_PARAM_CALLBACK_IRQ_TYPE_MASK) + 1; if ( ((via_type == HVMIRQ_callback_gsi) && (via == 0)) || (via_type > HVMIRQ_callback_vector) ) via_type = HVMIRQ_callback_none; diff --git a/xen/include/public/hvm/params.h b/xen/include/public/hvm/params.h index f7338a3..3f54a49 100644 --- a/xen/include/public/hvm/params.h +++ b/xen/include/public/hvm/params.h @@ -30,6 +30,7 @@ */ #define HVM_PARAM_CALLBACK_IRQ 0 +#define HVM_PARAM_CALLBACK_IRQ_TYPE_MASK xen_mk_ullong(0xFF00000000000000) /* * How should CPU0 event-channel notifications be delivered? * @@ -66,6 +67,8 @@ * This is only used by ARM/ARM64 and masking/eoi the interrupt associated to * the notification is handled by the interrupt controller. */ +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_MASK 0xFF00 +#define HVM_PARAM_CALLBACK_TYPE_PPI_FLAG_LOW_LEVEL 2 #endif /*