From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753455AbbFIFce (ORCPT ); Tue, 9 Jun 2015 01:32:34 -0400 Received: from mga01.intel.com ([192.55.52.88]:48882 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753633AbbFIFaP (ORCPT ); Tue, 9 Jun 2015 01:30:15 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,577,1427785200"; d="scan'208";a="743414957" 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 05/10] iommu, x86: Save the mode (posted or remapped) of an IRTE Date: Tue, 9 Jun 2015 13:20:32 +0800 Message-Id: <1433827237-3382-6-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 Add a new field to struct irq_2_iommu, which captures whether the associated IRTE is in posted mode or remapped mode. We update this field when the IRTE is written into the table. Suggested-by: Thomas Gleixner Signed-off-by: Feng Wu Reviewed-by: Thomas Gleixner Acked-by: Joerg Roedel --- drivers/iommu/intel_irq_remapping.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c index a643eec..68bce0a 100644 --- a/drivers/iommu/intel_irq_remapping.c +++ b/drivers/iommu/intel_irq_remapping.c @@ -18,6 +18,11 @@ #include "irq_remapping.h" +enum irq_mode { + IRQ_REMAPPING, + IRQ_POSTING, +}; + struct ioapic_scope { struct intel_iommu *iommu; unsigned int id; @@ -37,6 +42,7 @@ struct irq_2_iommu { u16 irte_index; u16 sub_handle; u8 irte_mask; + enum irq_mode mode; }; struct intel_ir_data { @@ -104,6 +110,7 @@ static int alloc_irte(struct intel_iommu *iommu, int irq, irq_iommu->irte_index = index; irq_iommu->sub_handle = 0; irq_iommu->irte_mask = mask; + irq_iommu->mode = IRQ_REMAPPING; } raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags); @@ -144,6 +151,9 @@ static int modify_irte(struct irq_2_iommu *irq_iommu, __iommu_flush_cache(iommu, irte, sizeof(*irte)); rc = qi_flush_iec(iommu, index, 0); + + /* Update iommu mode according to the IRTE mode */ + irq_iommu->mode = irte->pst ? IRQ_POSTING : IRQ_REMAPPING; raw_spin_unlock_irqrestore(&irq_2_ir_lock, flags); return rc; -- 2.1.0