From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932787AbbFIFcG (ORCPT ); Tue, 9 Jun 2015 01:32:06 -0400 Received: from mga01.intel.com ([192.55.52.88]:61007 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932160AbbFIFaT (ORCPT ); Tue, 9 Jun 2015 01:30:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,577,1427785200"; d="scan'208";a="743414972" From: Feng Wu To: joro@8bytes.org, dwmw2@infradead.org, tglx@linutronix.de Cc: jiang.liu@linux.intel.com, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Feng Wu Subject: [v10 06/10] iommu, x86: Avoid migrating VT-d posted interrupts Date: Tue, 9 Jun 2015 13:20:33 +0800 Message-Id: <1433827237-3382-7-git-send-email-feng.wu@intel.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1433827237-3382-1-git-send-email-feng.wu@intel.com> References: <1433827237-3382-1-git-send-email-feng.wu@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the interrupt is configured in posted mode, the destination of the interrupt is set in the Posted-Interrupts Descriptor and the migration of these interrupts happens during vCPU scheduling. We still update the cached irte, which will be used when changing back to remapping mode, but we avoid writing the table entry. Signed-off-by: Feng Wu Reviewed-by: Jiang Liu Acked-by: David Woodhouse Reviewed-by: Thomas Gleixner Acked-by: Joerg Roedel --- drivers/iommu/intel_irq_remapping.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index 68bce0a..3bcb459 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -1003,7 +1003,10 @@ intel_ir_set_affinity(struct irq_data *data, const struct cpumask *mask, */ irte->vector = cfg->vector; irte->dest_id = IRTE_DEST(cfg->dest_apicid); - modify_irte(&ir_data->irq_2_iommu, irte); + + /* Update the hardware only if the interrupt is in remapped mode. */ + if (ir_data->irq_2_iommu.mode == IRQ_REMAPPING) + modify_irte(&ir_data->irq_2_iommu, irte); /* * After this point, all the interrupts will start arriving -- 2.1.0