From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 22EE0C433F5 for ; Mon, 31 Jan 2022 11:12:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PK3fchLQMrFG536+vEwlHqXIXUS7zDm9VSK+j+0hld0=; b=Iiv0ppIx+Zm+9L arp+VjC7YTz9IRn6ZlCyAUgN6DV3PDKBWw8r9fG16nLOk/56VhjqMITxpmlyJTNkQq4otTg2quQnx bpHIsweSjwANwKU3eipkxhoNpnwwdQhGHBbJbLd0lSA1rFkqHVTkRy/tSWt05D1ivd60QHlRuDate BxKCrFGq/UuAq6Snn1rqcLtHOjWjwSO01SpyAMRCmS5nt71mZ/h+RzuaNopM/fC35eVG5qU6KfJvK d0nKCQYpjjmxZ+kqOVlmgYTzzpUkM4XeKq55mCUB9KIWwgyP3hAoGdHt0PiIiciAef5GPUjULo2fY NsJ12Vs+qPoBwgmQQa5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUba-0094Wf-7x; Mon, 31 Jan 2022 11:12:18 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUbE-0094PE-J2; Mon, 31 Jan 2022 11:11:58 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 3C1B71F4323B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643627515; bh=bih+YpN7Bu9FDncTaHYjpoZqdzNV5LPiHw6/cv1cfhQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hKRtf4cDoo1ygR4TE6AVz3KwgVq9I2wipi4rIcHIGgpe4sBTYjAxOsd2Kf7TyyOys tcCjMJOIJjFy9IwzerMUjdbmP1MW8aRsU1mwqccSQAZGK6MiYYTIVzUU62IJS2evjN v2ybCwImU3qGLqu44MtMpNG+od93c0ze1Jo0k/1WMx5nW1fjzNx4bBNE4dch9yN2in oGRNDJQQjPrfD61oTV/yKPQa7DwOXZzaLfqi9zaMpRFiXS7vY6pcD8Ge8UnXnJhO+p lLERwen3qfXz8zdm4FsGqmtK2XkAK6LBUbHVT0wKUOcY3i1JRCEjeN/hM8NjeMiXXt QKJ6fsA1asRpw== Message-ID: <0846872b-03da-ee5d-6a9d-e6c9fa754191@collabora.com> Date: Mon, 31 Jan 2022 12:11:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v22 5/7] soc: mediatek: SVS: add debug commands Content-Language: en-US To: Roger Lu , Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Rob Herring , Nicolas Boichat , Stephen Boyd , Philipp Zabel Cc: Fan Chen , HenryC Chen , Xiaoqing Liu , Charles Yang , Angus Lin , Mark Rutland , Nishanth Menon , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com, Guenter Roeck References: <20220127033956.24585-1-roger.lu@mediatek.com> <20220127033956.24585-6-roger.lu@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20220127033956.24585-6-roger.lu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_031156_879699_CFE84535 X-CRM114-Status: GOOD ( 15.87 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Il 27/01/22 04:39, Roger Lu ha scritto: > The purpose of SVS is to help find the suitable voltages > for DVFS. Therefore, if SVS bank voltages are concerned > to be wrong, we can adjust SVS bank voltages by this patch. > > Signed-off-by: Roger Lu Hello Roger, I was thinking about what this patch is adding... and I have a few considerations. It's nice to have a debugging mechanism to read the status and dump registers, as that's very helpful when doing heavy debugging of the IP... but adding the possibility to write a voltage offset may be very dangerous: think about the case in which, either for misconfiguration, or for any other reason, the debugfs entry that allows writing voffset becomes user-writable, or a user writes an impossibly high voffset. In case a very low (negative) voffset is entered, the platform would crash (denial of service); if a very high voffset is entered, hardware damage may occur. For this reason, there are two proposals: 1. If you want to keep the debugfs voffset write, please constrain the permissible voffset to an acceptable range that at least makes it unlikely to damage the HW; Moreover, since voffset write is a feature that would be used in very limited debugging cases, I think that this should be implemented over a build-time configuration barrier... something like CONFIG_MTK_SVS_DEBUG_ALLOW_WRITE, or similar; 2. Since it's very unlikely for someone to really play that much with a voltage offset during runtime, and since this looks like something very machine specific (perhaps addressing board-specific quirks?), I would suggest to add this as a device-tree parameter instead, such as "mediatek,svs-voffset", as it is indeed possible to specify both positive or negative values in DT. I would prefer proposal 2, as it looks generally cleaner and way less risky. Regards, Angelo _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A9316C433F5 for ; Mon, 31 Jan 2022 11:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DsRpx+MXe/uCIuD81h8/ce5BRaU3Cjcz16Bfia0paUI=; b=ipX3x0vY+ED8Jz FLUuRS0Zwfh4K4YlQ17AjS6iKnnfNPUiiNzvWVPVTb3PF7aXUtqsOO38x+GG40BIe+dYh0gZzH7nY doJqClaiwaCboXF7U6HqsWwxaP++BnTRtw8b4ZWlIZPgoqXZxuinlyY7aSrMCK+GWm3VeV4RI2Qd5 Nkint8JXixXWvvl/3frOiHt1K3YhdYtoVBPF59RGmP4LZ4moAFrAQ0TQdN6dDET080OVOSyxLjWgz 0y619sad0DsLityBC56YvNuVXkh7Bj3/EneAv3WMsEv7ChseDtAid5vmDnAXgJoe09Yfw+h3smgXK /e1YEbxURNF/GphZ1yug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUbL-0094RT-O3; Mon, 31 Jan 2022 11:12:03 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nEUbE-0094PE-J2; Mon, 31 Jan 2022 11:11:58 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 3C1B71F4323B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643627515; bh=bih+YpN7Bu9FDncTaHYjpoZqdzNV5LPiHw6/cv1cfhQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hKRtf4cDoo1ygR4TE6AVz3KwgVq9I2wipi4rIcHIGgpe4sBTYjAxOsd2Kf7TyyOys tcCjMJOIJjFy9IwzerMUjdbmP1MW8aRsU1mwqccSQAZGK6MiYYTIVzUU62IJS2evjN v2ybCwImU3qGLqu44MtMpNG+od93c0ze1Jo0k/1WMx5nW1fjzNx4bBNE4dch9yN2in oGRNDJQQjPrfD61oTV/yKPQa7DwOXZzaLfqi9zaMpRFiXS7vY6pcD8Ge8UnXnJhO+p lLERwen3qfXz8zdm4FsGqmtK2XkAK6LBUbHVT0wKUOcY3i1JRCEjeN/hM8NjeMiXXt QKJ6fsA1asRpw== Message-ID: <0846872b-03da-ee5d-6a9d-e6c9fa754191@collabora.com> Date: Mon, 31 Jan 2022 12:11:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v22 5/7] soc: mediatek: SVS: add debug commands Content-Language: en-US To: Roger Lu , Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Rob Herring , Nicolas Boichat , Stephen Boyd , Philipp Zabel Cc: Fan Chen , HenryC Chen , Xiaoqing Liu , Charles Yang , Angus Lin , Mark Rutland , Nishanth Menon , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com, Guenter Roeck References: <20220127033956.24585-1-roger.lu@mediatek.com> <20220127033956.24585-6-roger.lu@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20220127033956.24585-6-roger.lu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220131_031156_879699_CFE84535 X-CRM114-Status: GOOD ( 15.87 ) 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Il 27/01/22 04:39, Roger Lu ha scritto: > The purpose of SVS is to help find the suitable voltages > for DVFS. Therefore, if SVS bank voltages are concerned > to be wrong, we can adjust SVS bank voltages by this patch. > > Signed-off-by: Roger Lu Hello Roger, I was thinking about what this patch is adding... and I have a few considerations. It's nice to have a debugging mechanism to read the status and dump registers, as that's very helpful when doing heavy debugging of the IP... but adding the possibility to write a voltage offset may be very dangerous: think about the case in which, either for misconfiguration, or for any other reason, the debugfs entry that allows writing voffset becomes user-writable, or a user writes an impossibly high voffset. In case a very low (negative) voffset is entered, the platform would crash (denial of service); if a very high voffset is entered, hardware damage may occur. For this reason, there are two proposals: 1. If you want to keep the debugfs voffset write, please constrain the permissible voffset to an acceptable range that at least makes it unlikely to damage the HW; Moreover, since voffset write is a feature that would be used in very limited debugging cases, I think that this should be implemented over a build-time configuration barrier... something like CONFIG_MTK_SVS_DEBUG_ALLOW_WRITE, or similar; 2. Since it's very unlikely for someone to really play that much with a voltage offset during runtime, and since this looks like something very machine specific (perhaps addressing board-specific quirks?), I would suggest to add this as a device-tree parameter instead, such as "mediatek,svs-voffset", as it is indeed possible to specify both positive or negative values in DT. I would prefer proposal 2, as it looks generally cleaner and way less risky. Regards, Angelo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B602C433EF for ; Mon, 31 Jan 2022 11:31:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377979AbiAaL1w (ORCPT ); Mon, 31 Jan 2022 06:27:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378098AbiAaLTn (ORCPT ); Mon, 31 Jan 2022 06:19:43 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 927A1C0612F4; Mon, 31 Jan 2022 03:11:56 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 3C1B71F4323B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1643627515; bh=bih+YpN7Bu9FDncTaHYjpoZqdzNV5LPiHw6/cv1cfhQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=hKRtf4cDoo1ygR4TE6AVz3KwgVq9I2wipi4rIcHIGgpe4sBTYjAxOsd2Kf7TyyOys tcCjMJOIJjFy9IwzerMUjdbmP1MW8aRsU1mwqccSQAZGK6MiYYTIVzUU62IJS2evjN v2ybCwImU3qGLqu44MtMpNG+od93c0ze1Jo0k/1WMx5nW1fjzNx4bBNE4dch9yN2in oGRNDJQQjPrfD61oTV/yKPQa7DwOXZzaLfqi9zaMpRFiXS7vY6pcD8Ge8UnXnJhO+p lLERwen3qfXz8zdm4FsGqmtK2XkAK6LBUbHVT0wKUOcY3i1JRCEjeN/hM8NjeMiXXt QKJ6fsA1asRpw== Message-ID: <0846872b-03da-ee5d-6a9d-e6c9fa754191@collabora.com> Date: Mon, 31 Jan 2022 12:11:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v22 5/7] soc: mediatek: SVS: add debug commands Content-Language: en-US To: Roger Lu , Matthias Brugger , Enric Balletbo Serra , Kevin Hilman , Rob Herring , Nicolas Boichat , Stephen Boyd , Philipp Zabel Cc: Fan Chen , HenryC Chen , Xiaoqing Liu , Charles Yang , Angus Lin , Mark Rutland , Nishanth Menon , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Project_Global_Chrome_Upstream_Group@mediatek.com, Guenter Roeck References: <20220127033956.24585-1-roger.lu@mediatek.com> <20220127033956.24585-6-roger.lu@mediatek.com> From: AngeloGioacchino Del Regno In-Reply-To: <20220127033956.24585-6-roger.lu@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 27/01/22 04:39, Roger Lu ha scritto: > The purpose of SVS is to help find the suitable voltages > for DVFS. Therefore, if SVS bank voltages are concerned > to be wrong, we can adjust SVS bank voltages by this patch. > > Signed-off-by: Roger Lu Hello Roger, I was thinking about what this patch is adding... and I have a few considerations. It's nice to have a debugging mechanism to read the status and dump registers, as that's very helpful when doing heavy debugging of the IP... but adding the possibility to write a voltage offset may be very dangerous: think about the case in which, either for misconfiguration, or for any other reason, the debugfs entry that allows writing voffset becomes user-writable, or a user writes an impossibly high voffset. In case a very low (negative) voffset is entered, the platform would crash (denial of service); if a very high voffset is entered, hardware damage may occur. For this reason, there are two proposals: 1. If you want to keep the debugfs voffset write, please constrain the permissible voffset to an acceptable range that at least makes it unlikely to damage the HW; Moreover, since voffset write is a feature that would be used in very limited debugging cases, I think that this should be implemented over a build-time configuration barrier... something like CONFIG_MTK_SVS_DEBUG_ALLOW_WRITE, or similar; 2. Since it's very unlikely for someone to really play that much with a voltage offset during runtime, and since this looks like something very machine specific (perhaps addressing board-specific quirks?), I would suggest to add this as a device-tree parameter instead, such as "mediatek,svs-voffset", as it is indeed possible to specify both positive or negative values in DT. I would prefer proposal 2, as it looks generally cleaner and way less risky. Regards, Angelo