From patchwork Thu Mar 19 05:36:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Zhen-Hua" X-Patchwork-Id: 6046471 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 670259F2A9 for ; Thu, 19 Mar 2015 05:38:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9676020389 for ; Thu, 19 Mar 2015 05:38:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3CE5C2049D for ; Thu, 19 Mar 2015 05:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751461AbbCSFh2 (ORCPT ); Thu, 19 Mar 2015 01:37:28 -0400 Received: from g4t3427.houston.hp.com ([15.201.208.55]:50752 "EHLO g4t3427.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177AbbCSFhV (ORCPT ); Thu, 19 Mar 2015 01:37:21 -0400 Received: from g4t3433.houston.hp.com (g4t3433.houston.hp.com [16.210.25.219]) by g4t3427.houston.hp.com (Postfix) with ESMTP id 4A56F5E; Thu, 19 Mar 2015 05:37:21 +0000 (UTC) Received: from localhost.localdomain (linuxtest.chn.hp.com [16.155.255.10]) by g4t3433.houston.hp.com (Postfix) with ESMTP id C522695; Thu, 19 Mar 2015 05:37:15 +0000 (UTC) From: "Li, Zhen-Hua" To: , , , , , Cc: , , , , , , , , , , , , , , , Subject: [PATCH v9 03/10] iommu/vt-d: Function to get old context entry Date: Thu, 19 Mar 2015 13:36:21 +0800 Message-Id: <1426743388-26908-4-git-send-email-zhen-hual@hp.com> X-Mailer: git-send-email 2.0.0-rc0 In-Reply-To: <1426743388-26908-1-git-send-email-zhen-hual@hp.com> References: <1426743388-26908-1-git-send-email-zhen-hual@hp.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Interface for when a new domain in the crashdump kernel needs some values from the panicked kernel's context entries. Signed-off-by: Li, Zhen-Hua --- drivers/iommu/intel-iommu.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 577d5de..f7dbe70 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -369,6 +369,10 @@ static inline int first_pte_in_page(struct dma_pte *pte) * */ +static struct context_entry *device_to_existing_context_entry( + struct intel_iommu *iommu, + u8 bus, u8 devfn); + #endif /* CONFIG_CRASH_DUMP */ @@ -4796,3 +4800,26 @@ 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); } + +#ifdef CONFIG_CRASH_DUMP + +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; + unsigned long flags; + + ret = NULL; + 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; +} + +#endif /* CONFIG_CRASH_DUMP */