Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp573681rdb; Wed, 17 Jan 2024 10:24:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGm8Xb2YcBR/hIt9x/nckIpaWdZyfJlNBmB36YhZuceJ3+t3zasPMlKMqUJROOwMjjzTBqj X-Received: by 2002:a25:b192:0:b0:dbe:9e2b:a9be with SMTP id h18-20020a25b192000000b00dbe9e2ba9bemr3141355ybj.45.1705515864486; Wed, 17 Jan 2024 10:24:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705515864; cv=pass; d=google.com; s=arc-20160816; b=t981Nz67wJcsniVx6nbvM1N4MN1WiF+sFSf8GRDrS8uxmneau8pAPNKyw1lKaqMPs6 bS4IuLTMSRwxQ3BemTDaBQeWMsYEwK5m2yKGYkjt7ti9+E2dqszTEZ1ez6ZBdNGn8Btp 3aNu5L8aDmQ0R/aN457XY/oN4sRdnpMpQ87F7dFsg6v51q6u/5gNcOZ8En8UJe390jkz SMuI5vH5yZN1tGgOTJOdyANUKAE+oxo2cK3h8cOUhrBCJOkFqSogEggCkxtSDgQIjfyE VPMjSSyNVZlF6vTd9RnUuKy2TSTADUJBDenkXnmWIb5P5e1XCXFZZAGB9CdJnuWrWzrz vwqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8KNRogNawE98vzU6hLj1KXDSyquhagx1/Y27JreKsQM=; fh=BcQbdMDYKEj3jWqzAdBhNDO1dQXbF4mu4Zo1fW9VU/k=; b=U1naFAapp+ZboVohQPDQA0KhERjUCYu+CZalJ9IKrI4X1/G3UBQb0e6ambMyVdqyN6 iYabum2gvSJ+vjjKzlA1SWPbKk22QLioWpFiJC4pdL6skViLsISYEuCM2xD6SyZLPf1Z qB2Rj6hA81/uIi66uHg7Rsckdd3Ase1YGcJSA7+VDq7eb8eJ9WTCZKjSF25U8S5KdZg4 i4qwaEgWX+zlWYQqli0k5Hr0p107k5q0tW1Q9alzW/UN3aFrAyeQQs6cILizERRoduTG aVqRTgc7pX7jU6r45uxvofAeBQ6cMizVnfgGSTUQpTFYSb4KAseMFzKMpK0lbiKf+R46 euCA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lGTWGj3C; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a2-20020a0cb342000000b0068188c58637si306841qvf.353.2024.01.17.10.24.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 10:24:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lGTWGj3C; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-29314-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29314-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0EACE1C21C8C for ; Wed, 17 Jan 2024 18:24:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E85722F0F; Wed, 17 Jan 2024 18:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lGTWGj3C" Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CC4D22EE1 for ; Wed, 17 Jan 2024 18:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705515855; cv=none; b=EobWrDQSzfLEnPLD0a0lkgB9pvEhl4kCXCLJqsUow4sDIyBi5uBYY3MQ5tyGoAeOmZuivVx8TKC8+GFAllAZr7W4B01sYqb0idCCXaQKGxZ9CgncyNxAq7llQWNZSyehtxHZ8ZzwuPHBm2mgcxlhxnse/NJ8ptCpIALWNMxOyE4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705515855; c=relaxed/simple; bh=NFXD5kQKTGpTDVg2zunNmAEEapzyoqNHUtXRSN2eqjQ=; h=Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version: References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc: Content-Type:Content-Transfer-Encoding; b=ThMKcLqxw1mGBsExOoIN7v/kHJHhyT9W4sG2uTzj9/in0sNgscFSwjZy7++0z85QAImxY4y2fFmu/vXAj6zWaGFAJHOeGPddLRSba6DNTFkJPsfGnV6nldK2u56oxzjkBPYL6dlD5yFYuxO0Mw4t3LQBEizyYoJCNJqQcwkHbe4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lGTWGj3C; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-33761776af9so2022084f8f.0 for ; Wed, 17 Jan 2024 10:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705515852; x=1706120652; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8KNRogNawE98vzU6hLj1KXDSyquhagx1/Y27JreKsQM=; b=lGTWGj3C02mWksDEhvegvWIsDb0MhaTwVioAwsOsCUheIQcg+z31ozUzmOuEo4CaFC iBeQm5gzinUUx7DiQa/3K2EyLzqJcMdjyYD+J242bOTAszTd/4KYYfn7XWQXEJT695Bp t1CLNQpGXaptgalKMkUlqW7qqosxPaM/G8ja7chHNN9913XtBZTBLAY+wtTZMG+389V5 jcqb9zZe87yKXYzyRNYDDihbFwOjxpdIkBNLygEjh1vnRYBSFQ5ccP03bjFfmVawrZAa RSLYIVPJ49OxcwAno77GkARDGVhIq8hUmRWBV4blDUrFDV6nsMzxeulw/0pUMaufb2Iv klxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705515852; x=1706120652; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8KNRogNawE98vzU6hLj1KXDSyquhagx1/Y27JreKsQM=; b=HSlNhEtG/8uN4HtJ9/94+ZmDqd7YFbanxQprf3LFYaQXjuDXdWcNealit/hW/lg6xb nQXLpV3Zgz5Rfn8mEqDWRPsAK2NblZPxswARXJSqCvI/0aBvEfHkZWQmiOrfkTvclVFE eNIJjDUx0D3eoA1QCMYd7Ks9qD9OMsVPBd8SWtWPQP9LuCjh3kwLY/f3/YZY4yGgPoF2 0w4q9Q5/Vhq0VlOkGy4lAzOZIt5YLVZazw2C00k23zkepnNwdTBTJ6u23H2sFyrlewmu NF3ljTQxE5VRi7P0agrJSVjOzk3SxfafN4aLH2kGbaC6e3x4rzg+IKgygDsl5UJ8CdIF DkCQ== X-Gm-Message-State: AOJu0YxXOK+EhJubcX2QBCdCPRLHrJ5fmRA6/BbCleltoDlfgaQhTjMB hAUOccIN/lrzN1U3sEeK2xFJW6UOZLg1jUkZsxYpY31v X-Received: by 2002:a5d:4111:0:b0:337:c4c8:92d with SMTP id l17-20020a5d4111000000b00337c4c8092dmr1411467wrp.0.1705515852542; Wed, 17 Jan 2024 10:24:12 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240117031212.1104034-1-nunes.erico@gmail.com> <20240117031212.1104034-4-nunes.erico@gmail.com> In-Reply-To: <20240117031212.1104034-4-nunes.erico@gmail.com> From: Vasily Khoruzhick Date: Wed, 17 Jan 2024 10:23:45 -0800 Message-ID: Subject: Re: [PATCH v1 3/6] drm/lima: set bus_stop bit before hard reset To: Erico Nunes Cc: Qiang Yu , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , christian.koenig@amd.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jan 16, 2024 at 7:12=E2=80=AFPM Erico Nunes = wrote: > > This is required for reliable hard resets. Otherwise, doing a hard reset > while a task is still running (such as a task which is being stopped by > the drm_sched timeout handler) may result in random mmu write timeouts > or lockups which cause the entire gpu to hang. It looks like Mali driver is doing the same, so it totally makes sense. > Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick > --- > drivers/gpu/drm/lima/lima_pp.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_p= p.c > index a8f8f63b8295..ac097dd75072 100644 > --- a/drivers/gpu/drm/lima/lima_pp.c > +++ b/drivers/gpu/drm/lima/lima_pp.c > @@ -168,6 +168,11 @@ static void lima_pp_write_frame(struct lima_ip *ip, = u32 *frame, u32 *wb) > } > } > > +static int lima_pp_bus_stop_poll(struct lima_ip *ip) > +{ > + return !!(pp_read(LIMA_PP_STATUS) & LIMA_PP_STATUS_BUS_STOPPED); > +} > + > static int lima_pp_hard_reset_poll(struct lima_ip *ip) > { > pp_write(LIMA_PP_PERF_CNT_0_LIMIT, 0xC01A0000); > @@ -181,6 +186,14 @@ static int lima_pp_hard_reset(struct lima_ip *ip) > > pp_write(LIMA_PP_PERF_CNT_0_LIMIT, 0xC0FFE000); > pp_write(LIMA_PP_INT_MASK, 0); > + > + pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_STOP_BUS); > + ret =3D lima_poll_timeout(ip, lima_pp_bus_stop_poll, 10, 100); > + if (ret) { > + dev_err(dev->dev, "pp %s bus stop timeout\n", lima_ip_nam= e(ip)); > + return ret; > + } > + > pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_FORCE_RESET); > ret =3D lima_poll_timeout(ip, lima_pp_hard_reset_poll, 10, 100); > if (ret) { > -- > 2.43.0 >