From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C439C4360C for ; Wed, 3 Mar 2021 01:21:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 210AB64FA9 for ; Wed, 3 Mar 2021 01:21:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242533AbhCCBQU (ORCPT ); Tue, 2 Mar 2021 20:16:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1838896AbhCBPzJ (ORCPT ); Tue, 2 Mar 2021 10:55:09 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D8D2C061788 for ; Tue, 2 Mar 2021 07:54:26 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id e2so18401418ilu.0 for ; Tue, 02 Mar 2021 07:54:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cosmicpenguin-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=x2eE6P8J5KaO4DD0hNyzGz7Bru3WjGacf4IWFcF96JbCi3uflZJ3KWwSD3mb8vBH8Y a+6uictKWrojWO3H0XIV7GkIWxXJj8H/PIPNZorNQlkt6nuV7LxoNdwPgRDoAI/Gs6k/ vltvTCdwZe0e8BxrWARFh4IgpX5RvemqQjmiLruck622jgL4pwslhEMGk8nrZ+T7bVaH j90QXNGuFzpXHZCd5Z/KHbfqh5zk14zaSDsGL+aCNySc+X9JAtxAwpSF32Dmozx8TFS4 cGaxFEfZ245lWW5UEgzedysJtgECdzW7klS6VkJoGydEc00k/b3sBm0j7V/JHYD4iRes JH+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=AGB2qTNN/RI/U8LMhKW4udf+OCppoK1GcCs3KCz1PLmmP0bVJ1xxRL00Uh5DIz8DwT bpU6Q5JmPAhtZWHKKEB6Nka3FJ1MCjoy3Ve/CiXwUAnpIDI7s7X4d6H1nTYY4ILNOyLx GEcwJQQvpGZveLUfy3qRSwTnyL3fPyDjVJte+CfNn1iDWsrLUulH/V0slkYidn0tjfGR MsRUXvGPF4Cx5QYfzMzGDCB9vRcKjrk0nLH2uW0akz1Zdr63S7uN5wNN1ILqU3zObkBF n1GqJ+Wr1rP+91yTnSEYWL3DGSEXoJNoYV95OsPiJiLqQL4NGXpox6N3BKFZ7aH6jNBP ExWQ== X-Gm-Message-State: AOAM5323CF/e1q4+KwriM5t8EF2PrQcB5Lcp2Sp0qUtJyvuC0aTx8kBJ W6hM/lyh+mFFwRs0x+I9QouSAA== X-Google-Smtp-Source: ABdhPJxklLSBBngic8Uzfbl/eBdoqe4frY99R/xM56OTzhIiYdli7cBeVq1FMv0i41nQlHiUfRCgwg== X-Received: by 2002:a92:c54e:: with SMTP id a14mr18413282ilj.285.1614700465998; Tue, 02 Mar 2021 07:54:25 -0800 (PST) Received: from cosmicpenguin.net (c-71-237-100-236.hsd1.co.comcast.net. [71.237.100.236]) by smtp.gmail.com with ESMTPSA id k23sm11935810iol.36.2021.03.02.07.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 07:54:25 -0800 (PST) Date: Tue, 2 Mar 2021 08:54:23 -0700 From: Jordan Crouse To: Robin Murphy Cc: Jordan Crouse , linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers Message-ID: <20210302155423.3e7xlal3phcz26bh@cosmicpenguin.net> Mail-Followup-To: Robin Murphy , Jordan Crouse , linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210225175135.91922-1-jcrouse@codeaurora.org> <20210225175135.91922-2-jcrouse@codeaurora.org> <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On Tue, Mar 02, 2021 at 12:17:24PM +0000, Robin Murphy wrote: > On 2021-02-25 17:51, Jordan Crouse wrote: > > Call report_iommu_fault() to allow upper-level drivers to register their > > own fault handlers. > > > > Signed-off-by: Jordan Crouse > > --- > > > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > index d8c6bfde6a61..0f3a9b5f3284 100644 > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > @@ -408,6 +408,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); > > struct arm_smmu_device *smmu = smmu_domain->smmu; > > int idx = smmu_domain->cfg.cbndx; > > + int ret; > > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > > if (!(fsr & ARM_SMMU_FSR_FAULT)) > > @@ -417,8 +418,12 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > iova = arm_smmu_cb_readq(smmu, idx, ARM_SMMU_CB_FAR); > > cbfrsynra = arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(idx)); > > - dev_err_ratelimited(smmu->dev, > > - "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > + ret = report_iommu_fault(domain, dev, iova, > > Beware that "dev" here is not a struct device, so this isn't right. I'm not > entirely sure what we *should* be passing here, since we can't easily > attribute a context fault to a specific client device, and passing the IOMMU > device seems a bit dubious too, so maybe just NULL? Agreed. The GPU doesn't use it and I doubt anything else would either since the SMMU device is opaque to the leaf driver. Jordan > Robin. > > > + fsynr & ARM_SMMU_FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ); > > + > > + if (ret == -ENOSYS) > > + dev_err_ratelimited(smmu->dev, > > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > fsr, iova, fsynr, cbfrsynra, idx); > > arm_smmu_cb_write(smmu, idx, ARM_SMMU_CB_FSR, fsr); > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C91BAC433E0 for ; Tue, 2 Mar 2021 15:54:38 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1F9A864F1B for ; Tue, 2 Mar 2021 15:54:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F9A864F1B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cosmicpenguin.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A9DD54EC25; Tue, 2 Mar 2021 15:54:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O_8nni27qaEp; Tue, 2 Mar 2021 15:54:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTP id 276F34EBC1; Tue, 2 Mar 2021 15:54:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0FAC2C000B; Tue, 2 Mar 2021 15:54:36 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id C2AACC0001 for ; Tue, 2 Mar 2021 15:54:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A173B605DB for ; Tue, 2 Mar 2021 15:54:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=cosmicpenguin-net.20150623.gappssmtp.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Q3uW08aoTUfU for ; Tue, 2 Mar 2021 15:54:33 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by smtp3.osuosl.org (Postfix) with ESMTPS id 56E7A605A8 for ; Tue, 2 Mar 2021 15:54:33 +0000 (UTC) Received: by mail-il1-f194.google.com with SMTP id d5so18439020iln.6 for ; Tue, 02 Mar 2021 07:54:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cosmicpenguin-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=x2eE6P8J5KaO4DD0hNyzGz7Bru3WjGacf4IWFcF96JbCi3uflZJ3KWwSD3mb8vBH8Y a+6uictKWrojWO3H0XIV7GkIWxXJj8H/PIPNZorNQlkt6nuV7LxoNdwPgRDoAI/Gs6k/ vltvTCdwZe0e8BxrWARFh4IgpX5RvemqQjmiLruck622jgL4pwslhEMGk8nrZ+T7bVaH j90QXNGuFzpXHZCd5Z/KHbfqh5zk14zaSDsGL+aCNySc+X9JAtxAwpSF32Dmozx8TFS4 cGaxFEfZ245lWW5UEgzedysJtgECdzW7klS6VkJoGydEc00k/b3sBm0j7V/JHYD4iRes JH+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=Ezr0cbSQtA3GRVMbQBABvtXcwUWn3mP6qBy3q0buCPAI4bIB9kZMOz70OsmKEPjry1 TI7RuOle1e+9iIokpW2L3ByUoNnGBYVkEVYFkz+b7EYyBe3IzAXU0kmQgwjXpu4rDaWt LXL+uGCoOChpQjK9TDMNMTgXb2e+mRzQuSZ9EDX7rM6rB/s9v/FUzsRdZNdLZ1ZjM9s/ die/yQW+o8muWcW3DO/nQyZhouEohEjxPJcJNHOi8UsfEdfY/mDq7XZJbGvL+CktPpow +USFPFnrhnhkGcH1AW0MICPuGy1KG0OjTPh5OWPtguNkUcSOj/3heaQADmfFotqP1YBK AnUA== X-Gm-Message-State: AOAM5338Ib+V2hKNSkW+yeBBIbLFLnhAanP6ywKSu0Rr25zO4viEoN9M y9/ykoErACY6hnn4PmS/ZG0WaQ== X-Google-Smtp-Source: ABdhPJxklLSBBngic8Uzfbl/eBdoqe4frY99R/xM56OTzhIiYdli7cBeVq1FMv0i41nQlHiUfRCgwg== X-Received: by 2002:a92:c54e:: with SMTP id a14mr18413282ilj.285.1614700465998; Tue, 02 Mar 2021 07:54:25 -0800 (PST) Received: from cosmicpenguin.net (c-71-237-100-236.hsd1.co.comcast.net. [71.237.100.236]) by smtp.gmail.com with ESMTPSA id k23sm11935810iol.36.2021.03.02.07.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 07:54:25 -0800 (PST) Date: Tue, 2 Mar 2021 08:54:23 -0700 From: Jordan Crouse To: Robin Murphy Subject: Re: [PATCH v3 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers Message-ID: <20210302155423.3e7xlal3phcz26bh@cosmicpenguin.net> Mail-Followup-To: Robin Murphy , Jordan Crouse , linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210225175135.91922-1-jcrouse@codeaurora.org> <20210225175135.91922-2-jcrouse@codeaurora.org> <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> Cc: linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Jordan Crouse , Will Deacon , linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Tue, Mar 02, 2021 at 12:17:24PM +0000, Robin Murphy wrote: > On 2021-02-25 17:51, Jordan Crouse wrote: > > Call report_iommu_fault() to allow upper-level drivers to register their > > own fault handlers. > > > > Signed-off-by: Jordan Crouse > > --- > > > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > index d8c6bfde6a61..0f3a9b5f3284 100644 > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > @@ -408,6 +408,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); > > struct arm_smmu_device *smmu = smmu_domain->smmu; > > int idx = smmu_domain->cfg.cbndx; > > + int ret; > > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > > if (!(fsr & ARM_SMMU_FSR_FAULT)) > > @@ -417,8 +418,12 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > iova = arm_smmu_cb_readq(smmu, idx, ARM_SMMU_CB_FAR); > > cbfrsynra = arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(idx)); > > - dev_err_ratelimited(smmu->dev, > > - "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > + ret = report_iommu_fault(domain, dev, iova, > > Beware that "dev" here is not a struct device, so this isn't right. I'm not > entirely sure what we *should* be passing here, since we can't easily > attribute a context fault to a specific client device, and passing the IOMMU > device seems a bit dubious too, so maybe just NULL? Agreed. The GPU doesn't use it and I doubt anything else would either since the SMMU device is opaque to the leaf driver. Jordan > Robin. > > > + fsynr & ARM_SMMU_FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ); > > + > > + if (ret == -ENOSYS) > > + dev_err_ratelimited(smmu->dev, > > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > fsr, iova, fsynr, cbfrsynra, idx); > > arm_smmu_cb_write(smmu, idx, ARM_SMMU_CB_FSR, fsr); > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AA5CC433DB for ; Wed, 3 Mar 2021 19:18:22 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 913D364EEC for ; Wed, 3 Mar 2021 19:18:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 913D364EEC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=cosmicpenguin.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4D6TJwYHVYGxJYxnx1OXmSNg4ztMYbPVWCNdgzpQx1E=; b=Bx+j0S4nSWELnh7D2WTQNv54n 3oRnQHi/L469aK85PFXKVjfssIRtPQnPqLquqfH9g0+x0qFsmFD0BxjjPZdstLA3qDKfmfaKjs/VJ JngcIFA+ky3Gdfbb+DikqUQVgA9iCGZAIiQ6NcSKLUSqnaEb88qrD676HuC8nLVvXG8Co9YI31+4g yab35QlUd9u8rMJR9U0jUd7yxIVFEjdfQuOtWjrqKYmd1Adf4X14MUW01yBMV+ISrlvF1+Ib2nprw byo5YaQH3m59ehkAouAo0AlDo/8dp1lhB1PMMq2mPQTkcnbRVti33omxTZGWAW5IgvgimwDEuTHmO PJ46tr5tQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lHWyH-006AaS-Ph; Wed, 03 Mar 2021 19:15:47 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lHT2l-005Hpa-A2 for linux-arm-kernel@desiato.infradead.org; Wed, 03 Mar 2021 15:04:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=E+7yh6G6DrXLT5HPoFZf+R6ucD mV7odWUh4EEGEW24EVbjVz+CCWmv0dJanhaA3b1HHcVKapZ1hhZUtCNuXAUBXGTeH3M9KprmqkykB 8hVsqOHbCewVB+Q9CTjB7hpODJm3Nkyr5wkq915nR2BgkHxt3fYgkIn8mILKGUcJHKshbFj/36IHH eed969SPJSdJzbujfB77jFviSYyOaCniySzU/zoLGpivA4c+zubtnU6X4pQd61kmyq82FkWzvxPsn Y3p3dicK2clbVGYhxvaCrVw14LSxTX/HLUSYACU0zUFrFXnn34Gl5gO4qM4LyZwHlOmD718Nw9E8N haFlUq2g==; Received: from mail-il1-x143.google.com ([2607:f8b0:4864:20::143]) by casper.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lH7N6-00HOQn-2n for linux-arm-kernel@lists.infradead.org; Tue, 02 Mar 2021 15:55:49 +0000 Received: by mail-il1-x143.google.com with SMTP id k2so18419106ili.4 for ; Tue, 02 Mar 2021 07:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cosmicpenguin-net.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=x2eE6P8J5KaO4DD0hNyzGz7Bru3WjGacf4IWFcF96JbCi3uflZJ3KWwSD3mb8vBH8Y a+6uictKWrojWO3H0XIV7GkIWxXJj8H/PIPNZorNQlkt6nuV7LxoNdwPgRDoAI/Gs6k/ vltvTCdwZe0e8BxrWARFh4IgpX5RvemqQjmiLruck622jgL4pwslhEMGk8nrZ+T7bVaH j90QXNGuFzpXHZCd5Z/KHbfqh5zk14zaSDsGL+aCNySc+X9JAtxAwpSF32Dmozx8TFS4 cGaxFEfZ245lWW5UEgzedysJtgECdzW7klS6VkJoGydEc00k/b3sBm0j7V/JHYD4iRes JH+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=4YmTDrctAKsG8cdbZH7XiMulPHMmL+Exyv4xwBQWD5M=; b=QPBVGwjpH6++LOgmCkoLj9TBgZ3ccnZc4Cl2gY1bUnl9totEbPv3VNFAq2Dbq1qnGh llH4Vs80XjJGkDa2VOJ898LejNQYF0qJ7qSGE2gGpz+e2blT/niRP51zS6AtDstSeBpd 110QT2ZWmvSU+84nl3U1taujs53Ojciqm8U0ABQI6+ybjq+z4NQCvJDHhBbRBUBjk3Sj ZcPhWOt5F9wKweSAzQ4bgJsGs1xsHwiP7ztelesV2IOKPk/x7zMmM21pEyDk+/9LubQs TwqhS5KHETGnGABtrYeZbVL4FFxS4ecIco0NMQ6Y7MG9cdRk4R19DTZh8+4L0ipmfB0O E7yg== X-Gm-Message-State: AOAM533CNMwY1MJA+qE7pFavUpD1NL2sjleR/Lc9X49s9QHWOXAaI6Lz S0s1qAHOEvuJC3tM/DStwO9sXQ== X-Google-Smtp-Source: ABdhPJxklLSBBngic8Uzfbl/eBdoqe4frY99R/xM56OTzhIiYdli7cBeVq1FMv0i41nQlHiUfRCgwg== X-Received: by 2002:a92:c54e:: with SMTP id a14mr18413282ilj.285.1614700465998; Tue, 02 Mar 2021 07:54:25 -0800 (PST) Received: from cosmicpenguin.net (c-71-237-100-236.hsd1.co.comcast.net. [71.237.100.236]) by smtp.gmail.com with ESMTPSA id k23sm11935810iol.36.2021.03.02.07.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Mar 2021 07:54:25 -0800 (PST) Date: Tue, 2 Mar 2021 08:54:23 -0700 From: Jordan Crouse To: Robin Murphy Cc: Jordan Crouse , linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 1/3] iommu/arm-smmu: Add support for driver IOMMU fault handlers Message-ID: <20210302155423.3e7xlal3phcz26bh@cosmicpenguin.net> Mail-Followup-To: Robin Murphy , Jordan Crouse , linux-arm-msm@vger.kernel.org, iommu@lists.linux-foundation.org, Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210225175135.91922-1-jcrouse@codeaurora.org> <20210225175135.91922-2-jcrouse@codeaurora.org> <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2d3c7595-0186-7231-96dc-ae52414480ee@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210302_155549_758111_AC07F7F2 X-CRM114-Status: GOOD ( 21.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Mar 02, 2021 at 12:17:24PM +0000, Robin Murphy wrote: > On 2021-02-25 17:51, Jordan Crouse wrote: > > Call report_iommu_fault() to allow upper-level drivers to register their > > own fault handlers. > > > > Signed-off-by: Jordan Crouse > > --- > > > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +++++++-- > > 1 file changed, 7 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > index d8c6bfde6a61..0f3a9b5f3284 100644 > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > @@ -408,6 +408,7 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > struct arm_smmu_domain *smmu_domain = to_smmu_domain(domain); > > struct arm_smmu_device *smmu = smmu_domain->smmu; > > int idx = smmu_domain->cfg.cbndx; > > + int ret; > > fsr = arm_smmu_cb_read(smmu, idx, ARM_SMMU_CB_FSR); > > if (!(fsr & ARM_SMMU_FSR_FAULT)) > > @@ -417,8 +418,12 @@ static irqreturn_t arm_smmu_context_fault(int irq, void *dev) > > iova = arm_smmu_cb_readq(smmu, idx, ARM_SMMU_CB_FAR); > > cbfrsynra = arm_smmu_gr1_read(smmu, ARM_SMMU_GR1_CBFRSYNRA(idx)); > > - dev_err_ratelimited(smmu->dev, > > - "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > + ret = report_iommu_fault(domain, dev, iova, > > Beware that "dev" here is not a struct device, so this isn't right. I'm not > entirely sure what we *should* be passing here, since we can't easily > attribute a context fault to a specific client device, and passing the IOMMU > device seems a bit dubious too, so maybe just NULL? Agreed. The GPU doesn't use it and I doubt anything else would either since the SMMU device is opaque to the leaf driver. Jordan > Robin. > > > + fsynr & ARM_SMMU_FSYNR0_WNR ? IOMMU_FAULT_WRITE : IOMMU_FAULT_READ); > > + > > + if (ret == -ENOSYS) > > + dev_err_ratelimited(smmu->dev, > > + "Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n", > > fsr, iova, fsynr, cbfrsynra, idx); > > arm_smmu_cb_write(smmu, idx, ARM_SMMU_CB_FSR, fsr); > > > _______________________________________________ > iommu mailing list > iommu@lists.linux-foundation.org > https://lists.linuxfoundation.org/mailman/listinfo/iommu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel