Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753394AbbEKJyV (ORCPT ); Mon, 11 May 2015 05:54:21 -0400 Received: from g2t1383g.austin.hp.com ([15.217.136.92]:51384 "EHLO g2t1383g.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752583AbbEKJyQ (ORCPT ); Mon, 11 May 2015 05:54:16 -0400 From: "Li, Zhen-Hua" To: , , , , , Cc: , , , , , , , , , , , , , , , Subject: [PATCH v11 03/10] iommu/vt-d: Function to get existing context entry Date: Mon, 11 May 2015 17:52:47 +0800 Message-Id: <1431337974-545-4-git-send-email-zhen-hual@hp.com> X-Mailer: git-send-email 2.0.0-rc0 In-Reply-To: <1431337974-545-1-git-send-email-zhen-hual@hp.com> References: <1431337974-545-1-git-send-email-zhen-hual@hp.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1700 Lines: 54 Interface for when a new domain in the old kernel needs some values from the panicked kernel's context entries. Signed-off-by: Li, Zhen-Hua --- drivers/iommu/intel-iommu.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 1e7ceb5..07e6118 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -367,6 +367,10 @@ static inline int first_pte_in_page(struct dma_pte *pte) * do the same thing as crashdump kernel. */ +static struct context_entry *device_to_existing_context_entry( + struct intel_iommu *iommu, + u8 bus, u8 devfn); + /* * This domain is a statically identity mapping domain. @@ -4810,3 +4814,22 @@ static void __init check_tylersburg_isoch(void) printk(KERN_WARNING "DMAR: Recommended TLB entries for ISOCH unit is 16; your BIOS set %d\n", vtisochctrl); } + +static struct context_entry *device_to_existing_context_entry( + struct intel_iommu *iommu, + u8 bus, u8 devfn) +{ + struct root_entry *root; + struct context_entry *context; + struct context_entry *ret = NULL; + unsigned long flags; + + spin_lock_irqsave(&iommu->lock, flags); + root = &iommu->root_entry[bus]; + context = get_context_addr_from_root(root); + if (context && context_present(context+devfn)) + ret = &context[devfn]; + spin_unlock_irqrestore(&iommu->lock, flags); + return ret; +} + -- 2.0.0-rc0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/