From patchwork Thu Aug 8 22:21:58 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: 170872 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9165375ile; Thu, 8 Aug 2019 15:22:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyt1c4Rv7kjZoAu1qu9E6AUmoXgvKNemnC+3xFEGP7HfEmJmpXwxigNCV5p/eEBwi6mlUwE X-Received: by 2002:aa7:8201:: with SMTP id k1mr17455647pfi.97.1565302941323; Thu, 08 Aug 2019 15:22:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565302941; cv=none; d=google.com; s=arc-20160816; b=RRJLL63d8mYUdx8Si8RDEpprtIQ0yGTDH4Bq6mJCWD339vzCmVpwNvCEWVtahw9eot zVCp3SANft2KfYWANp0qssNTe6CdB03tExB439pq6q6zhQogl4DrOEPEJL1hO06UvBE+ AOJAjHi6mKiuoYQgMQJ1TK1H1Yn75rM3ckQOz5zxn/oYF4vRjO5XntUzh1DFw2MEUkEb 1bBGC9bmHY9X2SnoJbvzqoh/lJYwpPBLX5KEHpCqrHeJOxTO3pbLD6qNTUBEYssdFhDk Fhh2DQU/WDbIoFoswKXfu5f0aQpN82UoFcr6rz5DNzVlnKvM/htbDQtxHvgoqTcUaaSG 1Tlg== 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=hHKKLsqUqjaN4zdH4toaGsz1B2wnSPmoncENhi431FU=; b=a10ga9G6h/wuydsXhTRpz9vOdRZs1JsApIO8zdYsVZeiz4WNLXTGla9qarpG6gyHL1 CsCgjBIdePQFrQeW5KMNEubKmyLJvbn3xtJlU8dyfLjsxYP0HJCrBJlij8CaxkLBeNoi NBmhX+LpIAlVAEDl2Jk6dkaZUXHbR60616hhcdgtEFXxHY6Xwvz4zCaqFdAFL99nKdre EKxbOny4I1+2X7lijDGEYXe+PN/o5wWAXuxsmUnXL8+EPJjforZW60mIXXbAMKZLezWv pcFjJbLnXqbAimXJO5hTQHGI4xY7GsHPW0PyAUK+xSNdUDZyWdFV3HRg+D1x0Uq8lXDz yg9g== 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 g1si48571131plg.353.2019.08.08.15.22.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Aug 2019 15:22:21 -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 6564D6ECD5; Thu, 8 Aug 2019 22:22:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-f65.google.com (mail-ot1-f65.google.com [209.85.210.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id B38DC6ECD3 for ; Thu, 8 Aug 2019 22:22:12 +0000 (UTC) Received: by mail-ot1-f65.google.com with SMTP id r21so119114962otq.6 for ; Thu, 08 Aug 2019 15:22:12 -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=UpyT+Why+/m435rOz7NzCAgLp1lFXGESsqeBXgIEbKc=; b=ZsR63saxpVQTpbmPNS238OXBpGvdzi8vU+aoJ+Sx3vk885XFfUN5ewB1ewfhOjrd9u djSSThNFdWBOrUwcAJ7qOYGUiNkiBX8YqVxGOogg6J8QhiApBNV3YHDOAqeGi0QinOPc Pnw5VbeZYg1WzEm/Vwp1pKGsBcpJubnTOHLA9LwaQLzeR0nBsG+l/hTNlmEKkuQUT41o Uq52nzpo55QtzQBYabbmthS6ZZAoSK5Gng58/XyslIeterMYH6KKgmp4DjFh2PRTEoCe A9sLvKwyR9XPYlZDb6XAsZu+Z9un+BUHZ9KX/6cucP4D53YvFcpQwflC93C0w54DUB4u Skig== X-Gm-Message-State: APjAAAUrxHElh5j5Pe0/8sbDhMIaUjq9qJkBxBrwbjRZANevp62gbh0c Vicb7GYVnt9k7Vl2erCrfbOqQyQ= X-Received: by 2002:a5d:924e:: with SMTP id e14mr16641446iol.215.1565302931039; Thu, 08 Aug 2019 15:22:11 -0700 (PDT) Received: from xps15.herring.priv ([64.188.179.254]) by smtp.googlemail.com with ESMTPSA id i4sm118528553iog.31.2019.08.08.15.22.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 08 Aug 2019 15:22:10 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 7/9] drm/panfrost: Convert MMU IRQ handler to threaded handler Date: Thu, 8 Aug 2019 16:21:58 -0600 Message-Id: <20190808222200.13176-8-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190808222200.13176-1-robh@kernel.org> References: <20190808222200.13176-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 , Robin Murphy , Steven Price , David Airlie , Boris Brezillon , Alyssa Rosenzweig , Sean Paul 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 Reviewed-by: Steven Price Acked-by: Alyssa Rosenzweig Signed-off-by: Rob Herring --- 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 13757427b886..b609ee55a872 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -305,12 +305,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++) { @@ -355,6 +363,7 @@ static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data) status &= ~mask; } + mmu_write(pfdev, MMU_INT_MASK, ~0); return IRQ_HANDLED; }; @@ -373,8 +382,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");