From patchwork Tue Sep 27 15:27:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 9352099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 11DFC600CB for ; Tue, 27 Sep 2016 15:30:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03CB028FE1 for ; Tue, 27 Sep 2016 15:30:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC2B529251; Tue, 27 Sep 2016 15:30:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.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.wl.linuxfoundation.org (Postfix) with ESMTPS id 63BB92925B for ; Tue, 27 Sep 2016 15:30:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bouIT-00057D-Ch; Tue, 27 Sep 2016 15:27:53 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bouIR-000574-Sz for xen-devel@lists.xen.org; Tue, 27 Sep 2016 15:27:51 +0000 Received: from [85.158.139.211] by server-2.bemta-5.messagelabs.com id 15/78-15996-7FF8AE75; Tue, 27 Sep 2016 15:27:51 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfSOke63/lf hBn+m6Vgs+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmH1i1jLzgiUnH09mG2BsZewS5GLg4hgQmM Ei/W/GECcVgE5jFLvLx+jA3EkRDoZ5Xo/viTvYuRE8iJkdh28w1QFQeQXS5xcIMPSFhIQE1i2 eGFzBCTGpkkDu17zQiSYBPQkXgxaScbiC0iIC1x7fNlRpAiZoFJTBJz5i1iBBkkLBAp8eS0Fk gNi4CqxOf2zcwgNq+AjcSmbzdYIPZqSkyf9RoszingJdH59TMrxGJPiaaWfvYJjAILGBlWMWo UpxaVpRbpGpnoJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEhlY9AwPjDsabk/0O MUpyMCmJ8mq0vwoX4kvKT6nMSCzOiC8qzUktPsQow8GhJMGb3weUEyxKTU+tSMvMAQY5TFqCg 0dJhFcLGOhCvMUFibnFmekQqVOMxhxbfl9by8Sxbeq9tUxCLHn5ealS4rwLQSYJgJRmlObBDY JF3yVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrweIFN4MvNK4Pa9AjqFCeiUpSdegJxSkoi QkmpgzNZ78/fBGVE1rw8v4vMd1z9+zuh2a+PC13EuK831DCW27G+2UA2XXnMkjCXCdZrpCeXY w0943k14u7B3jks2IzdH8NzUKQuYj39h2Nl5iWPJ8QQOpbyVLTs4X4aySdf9iud7dbnj28E7b yr/H058++CwQW/eQu0rd/5qiRo19p5680PwacPdACWW4oxEQy3mouJEACLj7Vy5AgAA X-Env-Sender: shannon.zhao@linaro.org X-Msg-Ref: server-6.tower-206.messagelabs.com!1474990069!61537483!1 X-Originating-IP: [209.85.220.50] 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 47765 invoked from network); 27 Sep 2016 15:27:50 -0000 Received: from mail-pa0-f50.google.com (HELO mail-pa0-f50.google.com) (209.85.220.50) by server-6.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2016 15:27:50 -0000 Received: by mail-pa0-f50.google.com with SMTP id gp7so6686263pac.1 for ; Tue, 27 Sep 2016 08:27:50 -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=LB3dQ2ECr68IFRGaH2R1tYAnNjshCtT81WgKMjJx23k=; b=QJcG8Ero95Gu4cU+JDuCk2neJHExf8n+qrju5EESkIl6riYJkNZYI4rw0MJU239sFi x0h0Z0oL4G2DLhfZB08g7rKUBxXI/Y4GuvEFcCh8U2fF8zy6feY6QahJaFuGM7hOMBe3 2+mlwizG+97EVjoHhWNjarxL4zKp3Ynmp9WpU= 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=LB3dQ2ECr68IFRGaH2R1tYAnNjshCtT81WgKMjJx23k=; b=JJPXv9CbWuwgqg+IdIINH+gSZLzpzlh0nOa7Gs9ANTLbY57GzIQiARzn5l2MUEYpDz CeySS4GfMKMqKtSmdcnAxHykEpbLhm18LscFvqKac0QSnwWiJ8mmQ71+9j8VFTmXjJMl tXFcY4T4vRIi7+OhHkCTqE9OHN3Q0IaYm+WG0zk2ZUXdqplzu28QxhpdaqTPy3Ik1PDY Q2GBIDpuXMJQU5TwPPjfXQ2J0HfsZE6AQiYsIe509GTF1viMhVJjhz/gAFs4pKssbmLy zAvqe4QOjOn4b4t9Bv2Dy3xnGPZ7MbmCzjBCoZfcjeHEmAxQXaJXl7iI631dKITAg/c4 xq+Q== X-Gm-Message-State: AA6/9RmdIPgghygrlJ1xt0YncZMSS3TQfrKLKZ+ixPO2pTT8joYfIRZmif0+QJhjgfI8BSRI X-Received: by 10.66.14.66 with SMTP id n2mr34013097pac.69.1474990069084; Tue, 27 Sep 2016 08:27:49 -0700 (PDT) Received: from HZA160860128-A.china.huawei.com ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id q8sm5802272pac.32.2016.09.27.08.27.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Sep 2016 08:27:47 -0700 (PDT) From: Shannon Zhao To: xen-devel@lists.xen.org Date: Tue, 27 Sep 2016 08:27:12 -0700 Message-Id: <20160927152712.81604-1-shannon.zhao@linaro.org> X-Mailer: git-send-email 2.10.0.windows.1 In-Reply-To: <1474548753-12596-15-git-send-email-zhaoshenglong@huawei.com> References: <1474548753-12596-15-git-send-email-zhaoshenglong@huawei.com> 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 v7 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 35ab08d..0cf7dc3 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2016,9 +2016,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..8b126e2 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 0xFF00000000000000ULL /* * 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 /*