From patchwork Fri Aug 2 19:51:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 170449 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp1223170ile; Fri, 2 Aug 2019 12:52:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQOTQnrb2RvSNxUGvEC8k1ZqPbwtKra8fjtiGOh5IUxwAGcZ3mO0TqNLls8AnpTEeRHGt/ X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr5676914pjb.37.1564775526537; Fri, 02 Aug 2019 12:52:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564775526; cv=none; d=google.com; s=arc-20160816; b=prF/cC4HY85w2Q3jS4BhmDgTY6VPMFPSvOTagUw6SZNDbA3ccklrvDiI4SV96w0WhQ H3XNoZCzjFqLiuGVuQ+2srH7vHcgUhqiO3+T3Wud6SsWT+kvrMuQGTXXsadZhixNfTIm na4oN/9ukgH3Z8zSD1O9goPxbdQHgQ/7cq5pAg5qxWvpkaIc7gpb2y5Zsb1Bua481hYB ZDyUQ8tLIFffeVqbjNvIDQg1LWnA7ij+htz6UBfRzNMbNoqEEMjWch0WSH0j9JKCURhw kJtc79dRR0wkjcRgGoLi+UMmWAZdWofBv0PR4yPU2vgGzPQnEPEb49OrehN0dVZy5kHu 2zjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=K4Fn1u901w0mLvO9WOb9z3aV1FI1MT9IqPNoow5/Cq8=; b=oBjhbq+6B13bWd2SxRVI3vezo+eW7XzCAQKcS3TKNWztj8yfIG0EfDxdXioe7uhYkf Ja7S4kUJN7G8l+0JpjLrRIbM6OzP5PqgiB3uH9NKwGIwn3WbGlqPzgtQmOtQraFupF6w W53Oaa3uTntXdrzGpMHxmS0kMNf/47iHKraaLmIqJMO8r1nTqLjNJPHQmeLqMJYBXGe3 FjKk8c2n60WFsfeBLbBwwFCMLCcs7E7a4/MTjiAj5Oe4AMTiU06/qEN1kBgYTffGLXPC U3qf2JkrNzZeJjjUdDiBrfTmaFc7SVDW0OVfvc5imOMnmCgHMcdHpaQMlnwr5L+2FlAX ZOPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u15si40276708pfh.213.2019.08.02.12.52.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 02 Aug 2019 12:52:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8F8486EE62; Fri, 2 Aug 2019 19:52:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27F476EDD3 for ; Fri, 2 Aug 2019 19:52:01 +0000 (UTC) Received: by mail-io1-f65.google.com with SMTP id z3so13548441iog.0 for ; Fri, 02 Aug 2019 12:52:01 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bxVSBC926M3SRnMO8CwUdz8aDNatmwoyY19OmNEvvRc=; b=nxA/eKhqAtBLF6MZk2bfRNmHEQ/nDsUhgCKdejQYMOdKlOHPNxWiT2g/e4fxo0GLSE smZD2LFGEKkkzXYw2c+IE7xJtwE2Ff5TB3b4BOosCs1IVK2mDsmF9zbjd4IFgv5ofjpT DwsUwdFFjOeOW2pPYFSbxYlwSXaxssWcpC8HbpsqVnACDWd0mid+5wYiL8/flhvdP3ME 6OplG76AHUM3kDPwgEnnXBkeCsB6ys2zNTAlXf//sWmlYluZT/NiLSLwJwwuoNt2rIWD dK5qYYuKLvTP3t5+arJav+xvpvWo4nXS5EWuqGjim9lkVvcbeNI8hP5Co5y5dU2stpoc OAHA== X-Gm-Message-State: APjAAAXS21K+UKg8qr4xaSUaqJivhTFNMXa8++7Qn1QFITkmvqUFbXKN zXg/HjKbAUf+q8xWX2auBxraK6k= X-Received: by 2002:a6b:cd86:: with SMTP id d128mr126555145iog.234.1564775520066; Fri, 02 Aug 2019 12:52:00 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id s4sm98419934iop.25.2019.08.02.12.51.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 12:51:59 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 6/8] drm/panfrost: Convert MMU IRQ handler to threaded handler Date: Fri, 2 Aug 2019 13:51:48 -0600 Message-Id: <20190802195150.23207-7-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190802195150.23207-1-robh@kernel.org> References: <20190802195150.23207-1-robh@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomeu Vizoso , Maxime Ripard , Sean Paul , Steven Price , David Airlie , Boris Brezillon , Alyssa Rosenzweig , Robin Murphy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In preparation to handle mapping of page faults, we need the MMU handler to be threaded as code paths take a mutex. As the IRQ may be shared, we can't use the default handler and must disable the MMU interrupts locally. Cc: Tomeu Vizoso Cc: Boris Brezillon Cc: Robin Murphy Cc: Steven Price Cc: Alyssa Rosenzweig Signed-off-by: Rob Herring Reviewed-by: Steven Price --- drivers/gpu/drm/panfrost/panfrost_mmu.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c index eba6ce785ef0..7d44328b280f 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -300,12 +300,20 @@ static const char *access_type_name(struct panfrost_device *pfdev, static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data) { struct panfrost_device *pfdev = data; - u32 status = mmu_read(pfdev, MMU_INT_STAT); - int i; - if (!status) + if (!mmu_read(pfdev, MMU_INT_STAT)) return IRQ_NONE; + mmu_write(pfdev, MMU_INT_MASK, 0); + return IRQ_WAKE_THREAD; +} + +static irqreturn_t panfrost_mmu_irq_handler_thread(int irq, void *data) +{ + struct panfrost_device *pfdev = data; + u32 status = mmu_read(pfdev, MMU_INT_RAWSTAT); + int i; + dev_err(pfdev->dev, "mmu irq status=%x\n", status); for (i = 0; status; i++) { @@ -350,6 +358,7 @@ static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data) status &= ~mask; } + mmu_write(pfdev, MMU_INT_MASK, ~0); return IRQ_HANDLED; }; @@ -368,8 +377,9 @@ int panfrost_mmu_init(struct panfrost_device *pfdev) if (irq <= 0) return -ENODEV; - err = devm_request_irq(pfdev->dev, irq, panfrost_mmu_irq_handler, - IRQF_SHARED, "mmu", pfdev); + err = devm_request_threaded_irq(pfdev->dev, irq, panfrost_mmu_irq_handler, + panfrost_mmu_irq_handler_thread, + IRQF_SHARED, "mmu", pfdev); if (err) { dev_err(pfdev->dev, "failed to request mmu irq");