From patchwork Tue Feb 6 10:16:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 10202711 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E2EB76020F for ; Tue, 6 Feb 2018 10:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D980B289F8 for ; Tue, 6 Feb 2018 10:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7E9E289E3; Tue, 6 Feb 2018 10:17:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BECF2891A for ; Tue, 6 Feb 2018 10:17:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=KggqdqsBJvq512MfZMG1DxtlO0/x2ueiIRjCQG5ynh8=; b=l3N Tl3frCtoLTQEmKNLR00D5HkKQgWDPxFsTjFpz4fJH96Ou4qGXmS3T2TlAtLgDnLr+iT0upZ6+24p5 5IKhtE5kAzAtFe0KmN7ujAJJ70U2Pqt4QCoSQR9GvqKOLwF2GgEQ1VBbGWvVttnGFhq7kyjwR3L79 ylTSmKCUMnQ9Z355ya5OJY4oCarXDN43UZWYg9u8wO2AJKeWq2392QyBtY58ifxcPejggXrHXrNwT WOWp9xsZrE0qS//h4Noz55xMwK9S3BgYHrGJcUhWJR9zlZnt3SDnzQDn5BcSLuq1i3QaUotiC1t2B vfhKInY+CtoKGMwiH64WOv2c95svR+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ej0JT-00007C-3U; Tue, 06 Feb 2018 10:17:19 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ej0JP-0008TD-Er for linux-arm-kernel@lists.infradead.org; Tue, 06 Feb 2018 10:17:17 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 7669D60558; Tue, 6 Feb 2018 10:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517912224; bh=fLkyEnXZVznEYS1Zv6BY0S+SDESdvU96NfMAUfdhpaU=; h=From:To:Cc:Subject:Date:From; b=nS5+ypmbE6BN9rEABucB0W9uSC9h/JqT3o1D7/arG7B37QonUe0rihP7FrL7RQcMY Jn6zwBvS0cSParMEFLiL7EpqMl4brDBCjRuTuH/ik1k4/sNGgaq0BK1YJREnEuoiKc mbDQBFqRqwi7ALcHvk2myhDu1rvS+64bgqlLFPEs= Received: from blr-ubuntu-41.ap.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.18.19]) (using TLSv1.1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: vivek.gautam@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 6E6EE60558; Tue, 6 Feb 2018 10:17:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1517912223; bh=fLkyEnXZVznEYS1Zv6BY0S+SDESdvU96NfMAUfdhpaU=; h=From:To:Cc:Subject:Date:From; b=ZX9mkWS1d3P0IQb2440ADzKsENPXFSTJzg8PQnLy2NHuG62lbdwMMRnnlThX2vk1u ytJLw+ADcWqXGRs+9VhUSLTT+yE3cfjnbfHQLfZNbfZtiOEph/wNP4NpLkcZTSRMBY /xZQQSDFR0YbwnYUG2xIZ2orLevBAjMUlk8wdDjo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 6E6EE60558 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=vivek.gautam@codeaurora.org From: Vivek Gautam To: will.deacon@arm.com, robin.murphy@arm.com, joro@8bytes.org, iommu@lists.linux-foundation.org Subject: [PATCH RFC 1/1] iommu/arm-smmu: Fix context fault message considering non-NTS Date: Tue, 6 Feb 2018 15:46:53 +0530 Message-Id: <1517912213-3962-1-git-send-email-vivek.gautam@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vivek Gautam , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP SMMU_CBn_FSYNR0 definition from SMMU v2 architecture document says that, the S1CBNDX[23:16] field is only valid if SMMU_IDR0.NTS==1. So, update the fsynr in context bank fault handler, so that the fault message displays cbndx only when we have nested translations enabled. Otherwise, it is confusing when 'cb' gives the actual context bank, while the 'fsynr' gives a different value. Example, on a sdm845 system: Before this patch - arm-smmu 15000000.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0fb600, fsynr=0x3c0020, cb=0 After this patch - arm-smmu 15000000.apps-smmu: Unhandled context fault: fsr=0x402, iova=0x9e0aa000, fsynr=0x20, cb=0 Signed-off-by: Vivek Gautam Cc: Robin Murphy --- Hi Robin, Does it make sense to mask fsynr like this? Would it still be confusing for CB==0? Tagging the patch as RFC to get your comments. If looks good, then i will send the patch for your ack. Thanks. drivers/iommu/arm-smmu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 69e7c60792a8..827659515b22 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c @@ -550,6 +550,9 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) fsynr = readl_relaxed(cb_base + ARM_SMMU_CB_FSYNR0); iova = readq_relaxed(cb_base + ARM_SMMU_CB_FAR); + if (!smmu->features & ARM_SMMU_FEAT_TRANS_NESTED) + fsynr &= 0xffff; + dev_err_ratelimited(smmu->dev, "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cb=%d\n", fsr, iova, fsynr, cfg->cbndx);