From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f176.google.com (mail-dy1-f176.google.com [74.125.82.176]) (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 224C5325495 for ; Thu, 16 Apr 2026 17:26:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776360363; cv=none; b=FqcoBSpgfH31nppG4F/3mghJ7SnjkU2V1+YeZufwrbATB2dUMQwuuyGLUiqFEtHcT6b43rhRZl78NzdXbcjLowNrcmGdR2BBBO/U1JMeXyPne4nNPU9EUCXLkN1Zd+9mnVmAsVeEKKcjyOud1of4Zyf9dvbWBTarFYosgvUpd/A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776360363; c=relaxed/simple; bh=8TutVFT0hECdtwHYPD7KRgv2J2Fan8VcWdgBQxNgxhM=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=bgV1LzfjbjLaD9j55OeiGJ7X57uIqT20P5Z8DsbuKEqJGEAjSfAoU+scyDTP4XYAt9fY2grAaJCCsgYPZhxRJJ6iDShSfyy98dlM2rUjwBt3t63lKZZVbge8q0tmkr8JIw5xYBb0wRu/vNjzPIIx50SnKxwg0DFaNbwJbX16aAc= 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=P+gvUDm2; arc=none smtp.client-ip=74.125.82.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P+gvUDm2" Received: by mail-dy1-f176.google.com with SMTP id 5a478bee46e88-2bd801b40dbso359136eec.0 for ; Thu, 16 Apr 2026 10:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776360361; x=1776965161; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:to:subject:cc :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=p+oSOpmEaL2AL0jPocX9orqw+4TcJ8hn5aq7jtSVezk=; b=P+gvUDm2uOvDRPh9BglHdTSlMraj0q0MQr4v2JWmdqTLLauXtZSg7Ju7r/sZ6Ifwwo mAN8YHornl8pYMYb3F2S8C5tnU9boO8Kx3oYAvdkxNvxNCvQQEDKU/Tt2eYTNIwbqITx 9lqsExKRnAo/IgeBLIrFdyfLT8AwerXEwaisEJnroC877YVLnk9ukH3EVAYcKgxwVmaW 0H4P++GlfGznoCrsPIiARpcvCiqLDnhqrnsQIHSnKQpKzUt1+IEj2Vbdpvg/pxBf7t2F eIN+2lXnjgzpEniZdue7z27iM7UONAH1yf6+KrBf8UhrCIrJzXbkMpUnFf4WolpXa7RM kGcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776360361; x=1776965161; h=content-transfer-encoding:in-reply-to:from:references:to:subject:cc :user-agent:mime-version:date:message-id:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=p+oSOpmEaL2AL0jPocX9orqw+4TcJ8hn5aq7jtSVezk=; b=qAB7LtdGw+rkYArZEyzBPLnVx8YZswz5bkuAUFqp+9AcRLHGeRQUVwzVjc+yQX8uL4 Lgejm2dFM/aRjCYA+AlVygEAWdPhk06+mV9MBdU06Vhn9viF0Sz6BiqGZkwXWvjNVaT/ 91sOjOvI3qzvwQiuFGnieVYFmVcEwT6hJMxmfNPxNExSQxXtGF2Dmy2KgdNah4xKhiKh rhKYru49cyALx8ttFEee9A8N76MyR1oVT6pbmr1MVjMRkjBPUbTO7s7jIkLzGQi8Hi9G MY4RKu9cXKlTX4T4HNeCpYThYiHUVNzDAMwR8HZzx59XSn0XbTf8irfutPrxXgfQvCFP YxSw== X-Forwarded-Encrypted: i=1; AFNElJ+NCmua0PXMWl7YC5HBHU7B3N1r7CHBbcy28GH+Ep3QSBDWKzlSYRbYxVUeEzvwM2gjP+mcDtc7a9uppaU=@vger.kernel.org X-Gm-Message-State: AOJu0YyGBfWMM9mKIC5pfHuGlCO5ijOORRe1oHmJTCHx8P7KzmrQVeIB /M3wrTsOvrDTFcyszlf67b79tVko+uTmXFLmv/EQ15qgC66cOQ6N2tdJI3w6BA== X-Gm-Gg: AeBDiet9mke7IsWe/qqtp0JC21r0LgFaYRBpyxz2CefaBkGnMI0t/dvqDs43PV5URyE CqBhbPrWCTkjGtFRKyjUgPEqDV+cr6SQvR+P6wN4ARC6EWQ+mukme6GyTJDRnU5S4Vw+4aLOTcY QwVnmdT7V12s9zw5vO9GwlXRt4NvG+BrY6zogYePfjOXawqEkph34lbvXBe45ojnRl0lRAlMRWy 8+twkTm30V81jhuc5h7i7k5nNQ8RgfHzBRHNrSBPjRGGFo70/sDFaaJgNeYh91uVgGzXshEPJHu Fd0e2MzsmVH00DSOLsORuN398MRkl5oe+mF34rkCZe9nSmCR3pA3PlQHfxb3Yk56RdoNTSZRfGq 6rtT0vGgH2kfFRy8Z2NhfX/6iOlUFvnXm37UbD8QicWWldrIpeGDm3Ixw2jPiZlHCSSVU7tr9hJ 2lfofkFWZyky692iypmXInuDUvHLDUBvqzDnpx162U3iolA/iTMNeTN//x958WG8xEF7U= X-Received: by 2002:a05:7301:168e:b0:2da:b53f:8c9f with SMTP id 5a478bee46e88-2e2e09350f6mr35840eec.0.1776360361060; Thu, 16 Apr 2026 10:26:01 -0700 (PDT) Received: from [192.168.0.100] ([163.125.228.136]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2de8eb848b8sm8199551eec.16.2026.04.16.10.25.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Apr 2026 10:26:00 -0700 (PDT) Message-ID: <166964d1-2d16-43e8-b4d7-27b4a5e6286d@gmail.com> Date: Fri, 17 Apr 2026 01:25:52 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: yangyccccc@gmail.com, "alexander.shishkin@linux.intel.com" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Sanman Pradhan , Suzuki K Poulose , Jie Zhan , liusizhe5@huawei.com Subject: Re: [PATCH v2 1/2] hwtracing: hisi_ptt: Propagate DMA reset timeout in trace_start() To: "Pradhan, Sanman" , "jonathan.cameron@huawei.com" References: <20260414172451.14331-1-sanman.pradhan@hpe.com> <20260414172451.14331-2-sanman.pradhan@hpe.com> From: Yicong Yang In-Reply-To: <20260414172451.14331-2-sanman.pradhan@hpe.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit +cc Suzuki and Sizhe.. On 2026/4/15 01:25, Pradhan, Sanman wrote: > From: Sanman Pradhan > > hisi_ptt_wait_dma_reset_done() discards the return value of > readl_poll_timeout_atomic(). If the DMA engine does not complete its > reset within the timeout, hisi_ptt_trace_start() proceeds to start > tracing regardless. > > Return a bool from hisi_ptt_wait_dma_reset_done(), consistent with the > other wait helpers in this driver. On timeout, log an error, de-assert > the reset bit, and return -ETIMEDOUT. Move ctrl->started to the > successful path so a failed start does not leave the trace marked as > active. > > Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device") > Cc: stable@vger.kernel.org > Signed-off-by: Sanman Pradhan looks good to me. Reviewed-by: Yicong Yang I see the Suzuki has sent out the PR for 7.1, so this may wait after the merge window... thanks. > --- > v2: > - Return bool for consistency with other wait helpers > - Add pci_err() on timeout > - De-assert RST before returning on timeout > - Move ctrl->started to the successful path > > drivers/hwtracing/ptt/hisi_ptt.c | 20 +++++++++++++------- > 1 file changed, 13 insertions(+), 7 deletions(-) > > diff --git a/drivers/hwtracing/ptt/hisi_ptt.c b/drivers/hwtracing/ptt/hisi_ptt.c > index 94c371c491357..b5d851281fbf0 100644 > --- a/drivers/hwtracing/ptt/hisi_ptt.c > +++ b/drivers/hwtracing/ptt/hisi_ptt.c > @@ -171,13 +171,13 @@ static bool hisi_ptt_wait_trace_hw_idle(struct hisi_ptt *hisi_ptt) > HISI_PTT_WAIT_TRACE_TIMEOUT_US); > } > > -static void hisi_ptt_wait_dma_reset_done(struct hisi_ptt *hisi_ptt) > +static bool hisi_ptt_wait_dma_reset_done(struct hisi_ptt *hisi_ptt) > { > u32 val; > > - readl_poll_timeout_atomic(hisi_ptt->iobase + HISI_PTT_TRACE_WR_STS, > - val, !val, HISI_PTT_RESET_POLL_INTERVAL_US, > - HISI_PTT_RESET_TIMEOUT_US); > + return !readl_poll_timeout_atomic(hisi_ptt->iobase + HISI_PTT_TRACE_WR_STS, > + val, !val, HISI_PTT_RESET_POLL_INTERVAL_US, > + HISI_PTT_RESET_TIMEOUT_US); > } > > static void hisi_ptt_trace_end(struct hisi_ptt *hisi_ptt) > @@ -202,14 +202,18 @@ static int hisi_ptt_trace_start(struct hisi_ptt *hisi_ptt) > return -EBUSY; > } > > - ctrl->started = true; > - > /* Reset the DMA before start tracing */ > val = readl(hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); > val |= HISI_PTT_TRACE_CTRL_RST; > writel(val, hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); > > - hisi_ptt_wait_dma_reset_done(hisi_ptt); > + if (!hisi_ptt_wait_dma_reset_done(hisi_ptt)) { > + pci_err(hisi_ptt->pdev, "timed out waiting for DMA reset\n"); > + val = readl(hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); > + val &= ~HISI_PTT_TRACE_CTRL_RST; > + writel(val, hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); > + return -ETIMEDOUT; > + } > > val = readl(hisi_ptt->iobase + HISI_PTT_TRACE_CTRL); > val &= ~HISI_PTT_TRACE_CTRL_RST; > @@ -234,6 +238,8 @@ static int hisi_ptt_trace_start(struct hisi_ptt *hisi_ptt) > if (!hisi_ptt->trace_ctrl.is_port) > val |= HISI_PTT_TRACE_CTRL_FILTER_MODE; > > + ctrl->started = true; > + > /* Start the Trace */ > val |= HISI_PTT_TRACE_CTRL_EN; > writel(val, hisi_ptt->iobase + HISI_PTT_TRACE_CTRL);