From patchwork Wed Jun 2 16:52:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12295387 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=-8.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 2508BC47083 for ; Wed, 2 Jun 2021 17:04:56 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 EE3A461C8F for ; Wed, 2 Jun 2021 17:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE3A461C8F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=ZS/01B44T9bQ8VYxWA6urfhXacy4kZm705oKZe9XHrg=; b=M/VeYWGtVETqLk hRLGXUZYkfl7iXITIIsgjYLro2D/KjUWVHrfD3ZZcfaqaoxgO9NPzWY5I1qmM79Nr/CW4gVyCOVZQ TidIgvr5zAqbFnnW0A+TJcK7001vG6tFqo7qfsCdKAuNdzID+T/kqieOnSOo+FWOHC8f/BZn5HaBg x1lHC/6/KX49GEImEHUb1vm8cHbSHhTQjROgp/o6exefyA4Tq5qd1B8YniBl8v2hBr+OQkKoEiPm6 w1JVCHFF0a2SyNyZOIaQs4xGCK1WZ5G2Q5gcxupGuzKU+FHDI0/qQhqKgO//PX9N6xQyXC7iO2t25 uN2okRUPpYeqWUYM8y2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1loUGX-005LK9-6j; Wed, 02 Jun 2021 17:02:50 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1loU3Z-005FuB-Mj for linux-arm-kernel@lists.infradead.org; Wed, 02 Jun 2021 16:49:30 +0000 Received: by mail-pj1-x1032.google.com with SMTP id ei4so1978994pjb.3 for ; Wed, 02 Jun 2021 09:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y93PyBWiX9T4fVaYbqL1PL4Vs5/tKflWEP5FMSYoi74=; b=KCn3ESFyQZHxobIfkg3xhpJSrDW16XjKJ/fDxGo7guGgZUjCdanOaRHsGOtW91LUIK WIGz6UW/OhhNgue+Yf0Xdp1LK5EJm16MMd+yr+ZMP+PY2uAqumY+th6XSQqBfqpyUGT/ ogb7vcJ2wOeUxau+ZAIQdPkPKjdAinIVFHvcjDzGVOnZsZsmZx7YuEr2xhV5xn3vmSv4 vhN6XgmZR8QsIDVmbeQKpzmtbeMvXY87brGKKXx2jIYg4rYvaPtAu+MHU4PWeIMzJ6SN BcblGy7n0VeJ9Dgd6B8qs5zwHZxfKbsDgGsDjyFgojiwXKig/Da61u/sZW4MZy/soZPY CXuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=y93PyBWiX9T4fVaYbqL1PL4Vs5/tKflWEP5FMSYoi74=; b=eL+bReUcUr9ioeEoiqrreiJaX07gpttx8bFcXAHYjpm/gC9NErnHVQuwr1FJzj7652 2wK2T2N44fbB/tDwzqkLACBBvMG4/nbNcDtNUH8TfyL/tcIUDfaEtWf/kGixxCO29FzJ K/08N0da+4OAUmDe2W3utkGzZqGml+2OiNqTIiLmErooreRNWcKycXKUT1/HiB3V4Rs1 YcrBweURksIoDyAgQfTNW1tyiNxpbG6CVko8QJsT93KGYkhqREY+Ir02tdGpVc8fCNrK +RBxUURAZEgL8Ip5NzGVS2ZSxyPNovszbyY538b8SP6HrCf+qhmlajCi3DfDi1aI5ku5 QM3g== X-Gm-Message-State: AOAM530iw6tyjo9clv9Bq6nw0HeKIk05kPn670ReKRxuYL8NJ4TIB+i1 G2C/0XXGRDeNsNL32lb7SR8= X-Google-Smtp-Source: ABdhPJxfv0BXHqo8MWWsEtUhi2Oy1PldNa2hrafNv/QLMkM2vfMSO20e1U11gvjznblyTVjICttw+A== X-Received: by 2002:a17:90a:fa95:: with SMTP id cu21mr292230pjb.210.1622652564566; Wed, 02 Jun 2021 09:49:24 -0700 (PDT) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id x193sm166388pfd.54.2021.06.02.09.49.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 09:49:23 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [RESEND PATCH v4 0/6] iommu/arm-smmu: adreno-smmu page fault handling Date: Wed, 2 Jun 2021 09:52:43 -0700 Message-Id: <20210602165313.553291-1-robdclark@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210602_094925_800536_71926C7F X-CRM114-Status: GOOD ( 16.20 ) 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: , Cc: Konrad Dybcio , Akhil P Oommen , open list , Eric Anholt , Iskren Chernev , AngeloGioacchino Del Regno , Marijn Suijten , Lee Jones , Rob Clark , Sai Prakash Ranjan , Jonathan Marek , Will Deacon , Zhenzhong Duan , Joerg Roedel , linux-arm-msm@vger.kernel.org, Sharat Masetty , Bjorn Andersson , "moderated list:ARM SMMU DRIVERS" , Jordan Crouse , Robin Murphy , Douglas Anderson , "open list:IOMMU DRIVERS" , "Kristian H. Kristensen" , freedreno@lists.freedesktop.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Rob Clark (Resend, first attempt seems to not have entirely shown up in patchwork and had a random already merged patch tagging along because 00*patch picks up things I forgot to delete) This picks up an earlier series[1] from Jordan, and adds additional support needed to generate GPU devcore dumps on iova faults. Original description: This is a stack to add an Adreno GPU specific handler for pagefaults. The first patch starts by wiring up report_iommu_fault for arm-smmu. The next patch adds a adreno-smmu-priv function hook to capture a handful of important debugging registers such as TTBR0, CONTEXTIDR, FSYNR0 and others. This is used by the third patch to print more detailed information on page fault such as the TTBR0 for the pagetable that caused the fault and the source of the fault as determined by a combination of the FSYNR1 register and an internal GPU register. This code provides a solid base that we can expand on later for even more extensive GPU side page fault debugging capabilities. v4: [Rob] Add support to stall SMMU on fault, and let the GPU driver resume translation after it has had a chance to snapshot the GPUs state v3: Always clear FSR even if the target driver is going to handle resume v2: Fix comment wording and function pointer check per Rob Clark [1] https://lore.kernel.org/dri-devel/20210225175135.91922-1-jcrouse@codeaurora.org/ Jordan Crouse (3): iommu/arm-smmu: Add support for driver IOMMU fault handlers iommu/arm-smmu-qcom: Add an adreno-smmu-priv callback to get pagefault info drm/msm: Improve the a6xx page fault handler Rob Clark (3): iommu/arm-smmu-qcom: Add stall support drm/msm: Add crashdump support for stalled SMMU drm/msm: devcoredump iommu fault support drivers/gpu/drm/msm/adreno/a2xx_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/a3xx_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/a4xx_gpu.c | 2 +- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 9 +- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 101 +++++++++++++++++++- drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 2 +- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 43 +++++++-- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 15 +++ drivers/gpu/drm/msm/msm_debugfs.c | 2 +- drivers/gpu/drm/msm/msm_gem.h | 1 + drivers/gpu/drm/msm/msm_gem_submit.c | 1 + drivers/gpu/drm/msm/msm_gpu.c | 55 ++++++++++- drivers/gpu/drm/msm/msm_gpu.h | 19 +++- drivers/gpu/drm/msm/msm_gpummu.c | 5 + drivers/gpu/drm/msm/msm_iommu.c | 22 ++++- drivers/gpu/drm/msm/msm_mmu.h | 5 +- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 50 ++++++++++ drivers/iommu/arm/arm-smmu/arm-smmu.c | 9 +- drivers/iommu/arm/arm-smmu/arm-smmu.h | 2 + include/linux/adreno-smmu-priv.h | 38 +++++++- 20 files changed, 354 insertions(+), 31 deletions(-)