From patchwork Fri Sep 22 03:02:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lan,Tianyu" X-Patchwork-Id: 9965611 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 7E37C600C5 for ; Fri, 22 Sep 2017 09:12:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79BA9297BA for ; Fri, 22 Sep 2017 09:12:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D2222980B; Fri, 22 Sep 2017 09:12:53 +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=-2.7 required=2.0 tests=BAYES_00, DATE_IN_PAST_06_12, RCVD_IN_DNSWL_MED 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 C6FAE297BA for ; Fri, 22 Sep 2017 09:12:52 +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 1dvJz5-0004y0-S5; Fri, 22 Sep 2017 09:10:55 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJz4-0004w0-RQ for xen-devel@lists.xen.org; Fri, 22 Sep 2017 09:10:54 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id FE/43-02046-E93D4C95; Fri, 22 Sep 2017 09:10:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrFLMWRWlGSWpSXmKPExsVywNykQnfm5SO RBp8/aFos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBlTTnazFfQKVUw695m1gbGDr4uRi0NIYDqj xOa919i7GDk5JAR4JY4sm8HaxcgBZAdIfL0YBFHTAVSz7igbSA2bgLrEicUTGUFsEQFpiWufL zOCFDELrGCS6F/2mRUkISwQLPFmzhdmkEEsAqoSx25Jg4R5BVwlzn65ALVLQWLKw/fMIDYnUP xX33YmEFtIwEWidel+pgmMvAsYGVYxahSnFpWlFukamuglFWWmZ5TkJmbm6BoaGOvlphYXJ6a n5iQmFesl5+duYgSGAwMQ7GBcsd3zEKMkB5OSKO/780cihfiS8lMqMxKLM+KLSnNSiw8xynBw KEnwnrgElBMsSk1PrUjLzAEGJkxagoNHSYT3Hkiat7ggMbc4Mx0idYpRl6Pj5t0/TEIsefl5q VLivItBigRAijJK8+BGwKLkEqOslDAvI9BRQjwFqUW5mSWo8q8YxTkYlYR5n4JM4cnMK4Hb9A roCCagI8pXgx1RkoiQkmpgtP5+qjMkp6IkIKg6d4scS+HxWbM5Aje8bj2vo6rI69tccPqs475 XPL9L+gPeZLaqGSScnNm6sGSp3tz1eldau/rfrE/ceOdCKC/33+0PlNsSLnLWv57IO6+349fX rbfyor0nR3ib8uRl3WkL+fany7P48X7L9YI3P94M2uN3e8FWgUajipUSSizFGYmGWsxFxYkAK qP0mY0CAAA= X-Env-Sender: tianyu.lan@intel.com X-Msg-Ref: server-7.tower-31.messagelabs.com!1506071447!108468085!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.8 required=7.0 tests=DATE_IN_PAST_06_12 X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24374 invoked from network); 22 Sep 2017 09:10:49 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-7.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 22 Sep 2017 09:10:49 -0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2017 02:10:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.42,427,1500966000"; d="scan'208"; a="1197902209" Received: from sky-ws.sh.intel.com (HELO localhost) ([10.239.48.141]) by fmsmga001.fm.intel.com with ESMTP; 22 Sep 2017 02:10:37 -0700 From: Lan Tianyu To: xen-devel@lists.xen.org Date: Thu, 21 Sep 2017 23:02:02 -0400 Message-Id: <1506049330-11196-22-git-send-email-tianyu.lan@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1506049330-11196-1-git-send-email-tianyu.lan@intel.com> References: <1506049330-11196-1-git-send-email-tianyu.lan@intel.com> Cc: Lan Tianyu , kevin.tian@intel.com, sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, jbeulich@suse.com, roger.pau@citrix.com, chao.gao@intel.com Subject: [Xen-devel] [PATCH V3 21/29] VIOMMU: Introduce callback of checking irq remapping mode 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 This patch is to add callback for vIOAPIC and vMSI to check whether interrupt remapping is enabled. Signed-off-by: Lan Tianyu --- xen/common/viommu.c | 15 +++++++++++++++ xen/include/xen/viommu.h | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/xen/common/viommu.c b/xen/common/viommu.c index 0708e43..ff95465 100644 --- a/xen/common/viommu.c +++ b/xen/common/viommu.c @@ -194,6 +194,21 @@ int viommu_get_irq_info(struct domain *d, return viommu->ops->get_irq_info(d, request, irq_info); } +bool viommu_check_irq_remapping(struct domain *d, + struct arch_irq_remapping_request *request) +{ + struct viommu *viommu = d->viommu; + + if ( !viommu ) + return false; + + ASSERT(viommu->ops); + if ( !viommu->ops->check_irq_remapping ) + return false; + + return viommu->ops->check_irq_remapping(d, request); +} + /* * Local variables: * mode: C diff --git a/xen/include/xen/viommu.h b/xen/include/xen/viommu.h index beb40cd..b5ac1e6 100644 --- a/xen/include/xen/viommu.h +++ b/xen/include/xen/viommu.h @@ -26,6 +26,8 @@ struct arch_irq_remapping_request; struct viommu_ops { int (*create)(struct domain *d, struct viommu *viommu); + bool (*check_irq_remapping)(struct domain *d, + struct arch_irq_remapping_request *request); int (*destroy)(struct viommu *viommu); int (*handle_irq_request)(struct domain *d, struct arch_irq_remapping_request *request); @@ -57,6 +59,8 @@ int viommu_handle_irq_request(struct domain *d, int viommu_get_irq_info(struct domain *d, struct arch_irq_remapping_request *request, struct arch_irq_remapping_info *irq_info); +bool viommu_check_irq_remapping(struct domain *d, + struct arch_irq_remapping_request *request); #else static inline int viommu_register_type(uint64_t type, struct viommu_ops *ops) { @@ -75,6 +79,12 @@ viommu_get_irq_info(struct domain *d, { return -EINVAL; } +static inline bool +viommu_check_irq_remapping(struct domain *d, + struct arch_irq_remapping_request *request) +{ + return false; +} #endif #endif /* __XEN_VIOMMU_H__ */