From mboxrd@z Thu Jan 1 00:00:00 1970 From: Feng Wu Subject: [RFC v2 02/15] iommu: Add iommu_intpost to control VT-d Posted-Interrupts feature Date: Fri, 8 May 2015 17:07:05 +0800 Message-ID: <1431076038-7497-3-git-send-email-feng.wu@intel.com> References: <1431076038-7497-1-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1431076038-7497-1-git-send-email-feng.wu@intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: kevin.tian@intel.com, keir@xen.org, george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, jbeulich@suse.com, yang.z.zhang@intel.com, Feng Wu List-Id: xen-devel@lists.xenproject.org VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. With VT-d Posted-Interrupts enabled, external interrupts from direct-assigned devices can be delivered to guests without VMM intervention when guest is running in non-root mode. This patch adds variable 'iommu_intpost' to control whether enable VT-d posted-interrupt or not in the generic IOMMU code. Signed-off-by: Feng Wu --- xen/drivers/passthrough/iommu.c | 11 ++++++++++- xen/include/xen/iommu.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 92ea26f..302e3e4 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -39,6 +39,7 @@ static void iommu_dump_p2m_table(unsigned char key); * no-snoop Disable VT-d Snoop Control * no-qinval Disable VT-d Queued Invalidation * no-intremap Disable VT-d Interrupt Remapping + * no-intpost Disable VT-d Interrupt posting */ custom_param("iommu", parse_iommu_param); bool_t __initdata iommu_enable = 1; @@ -51,6 +52,7 @@ bool_t __read_mostly iommu_passthrough; bool_t __read_mostly iommu_snoop = 1; bool_t __read_mostly iommu_qinval = 1; bool_t __read_mostly iommu_intremap = 1; +bool_t __read_mostly iommu_intpost = 0; bool_t __read_mostly iommu_hap_pt_share = 1; bool_t __read_mostly iommu_debug; bool_t __read_mostly amd_iommu_perdev_intremap = 1; @@ -94,7 +96,11 @@ static void __init parse_iommu_param(char *s) else if ( !strcmp(s, "qinval") ) iommu_qinval = val; else if ( !strcmp(s, "intremap") ) + { iommu_intremap = val; + if ( iommu_intremap == 0 ) + iommu_intpost = 0; + } else if ( !strcmp(s, "debug") ) { iommu_debug = val; @@ -272,7 +278,10 @@ int __init iommu_setup(void) iommu_enabled = (rc == 0); } if ( !iommu_enabled ) + { iommu_intremap = 0; + iommu_intpost = 0; + } if ( (force_iommu && !iommu_enabled) || (force_intremap && !iommu_intremap) ) @@ -341,7 +350,7 @@ void iommu_crash_shutdown(void) const struct iommu_ops *ops = iommu_get_ops(); if ( iommu_enabled ) ops->crash_shutdown(); - iommu_enabled = iommu_intremap = 0; + iommu_enabled = iommu_intremap = iommu_intpost = 0; } bool_t iommu_has_feature(struct domain *d, enum iommu_feature feature) diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index bf4aff0..91063bb 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -31,7 +31,7 @@ extern bool_t iommu_enable, iommu_enabled; extern bool_t force_iommu, iommu_verbose; extern bool_t iommu_workaround_bios_bug, iommu_passthrough; -extern bool_t iommu_snoop, iommu_qinval, iommu_intremap; +extern bool_t iommu_snoop, iommu_qinval, iommu_intremap, iommu_intpost; extern bool_t iommu_hap_pt_share; extern bool_t iommu_debug; extern bool_t amd_iommu_perdev_intremap; -- 2.1.0