From patchwork Mon Sep 11 05:57:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Hongfei X-Patchwork-Id: 721666 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 17208EE7FF4 for ; Mon, 11 Sep 2023 05:59:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjIKF70 (ORCPT ); Mon, 11 Sep 2023 01:59:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjIKF7Y (ORCPT ); Mon, 11 Sep 2023 01:59:24 -0400 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2119.outbound.protection.outlook.com [40.107.117.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BFFCD2; Sun, 10 Sep 2023 22:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hszEYDJ24Nyff4Py/ljW4qDwx+B4uvYKuULeNgX7LvCKgPdZwdmSvw1zAktesVTxHESlDdsMjkiBmvVndjbNPacWCr2LN4TB0gGP4sTa6zJobUS0GD/BxON8zw4FgZhCJKpRZxUg9arOd9zd3vhubHjDX8J0WoII727Q1SP84RF6WNbsdluohfVVkRcxLhxfFa+759OvDDDph/rS00nMmAQnHiqnTntjmNkHPlN7s7P7oovMlsz4fQllXi75Sxi1nD/82qYd5ejqbCveqvBFsUetxJQwDKvtZYK2MZY/e1ar0K7qhzPwkwJ2nBijWli9fLfmgbFz9Ox7CuXHM/BuDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vb8PoTPYckGyQbxiYXlK40vldOSLOGu/bVZ/ziPyTpY=; b=kDxVTa1zEc3ZozmyijDhuizme++Mf25YeFaIdFSFIV5gjIy/Uro1/kHVFMRlVkc76S0rt5MePUjvz0eEcU6LstK/v1dCdcleuOlms/u78R9EyspiLOcnt5Bj32mUHeau5afCvw8riPFd90OSY1bdcQj/R8PFELX7GdpfqPveaPBFRvlEdPxUJey7ivd/+7pNCrC/DBDlXmxTbwn4iKf1J0i/wB3li6Ef2S+e/8CFW+Cm0Ye8E6KrCuG6ZxlfPh9SowaDLBwB1k8p041rW6R4TVBM75D0ElM4PE51f6ioNXQAhc/9+AeEDcaeN8fL1qQXtoEJ3BFzfbeSl9dXHS+JGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vb8PoTPYckGyQbxiYXlK40vldOSLOGu/bVZ/ziPyTpY=; b=FZKSnn5IRxQYhSj9Pj/7NBTTQnQ8QtXcUtNxl8oPWma/ECmKEX3HpLNpZNiZI9Z+PPf78fVhSpsbYAv2mupNkYmETAJYks/5iSXhtmUzjJfTvoZqL1cIOzUt3DGP1HTQZf8n5/XGrnM2Q58BwRyyUH+lpWcvsZpqoZJPBNrw51sf26iEPtRjlfuAkemIKbgqtGxlLLUmjZOXFNxBB6ATiLKXgObTJHs62QVo77Mf64b7gsYDsfTiAcxHvyV0qjbzk5PyYPR4auwH4PwOxKL3UJ1iSigIeWk9mcRhncdZ5qtzSuHsPxXLq8Sdn8mAIKPv+eoArtNILdTdDuIQPp/6iw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) by SI2PR06MB5170.apcprd06.prod.outlook.com (2603:1096:4:1bd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Mon, 11 Sep 2023 05:59:16 +0000 Received: from TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::5bef:53ac:2a7c:6f4e]) by TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::5bef:53ac:2a7c:6f4e%3]) with mapi id 15.20.6768.029; Mon, 11 Sep 2023 05:59:16 +0000 From: Lu Hongfei To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Lu Hongfei , Bean Huo , Can Guo , Arthur Simchaev , Stanley Chu , Manivannan Sadhasivam , Asutosh Das , "Bao D. Nguyen" , Po-Wen Kao , Eric Biggers , Keoseong Park , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v3 1/3] scsi: ufs: core: add wb buffer resize related attr_idn Date: Mon, 11 Sep 2023 13:57:06 +0800 Message-Id: <20230911055810.879-2-luhongfei@vivo.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20230911055810.879-1-luhongfei@vivo.com> References: <20230911055810.879-1-luhongfei@vivo.com> X-ClientProxiedBy: SG2PR06CA0234.apcprd06.prod.outlook.com (2603:1096:4:ac::18) To TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB6697:EE_|SI2PR06MB5170:EE_ X-MS-Office365-Filtering-Correlation-Id: e6ada313-b73a-43b8-a50e-08dbb28c3b74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mzOwoOeEK53eK41x1zDyKmfLoAiIR76SvZOWRVueSVT8hbbF5K6O2OYc955NrqEP2mahMTWFH+sGlMMlH/7kOpsArQ4gC6ycejGNogASAoZMoO/BiYcVvM8DA1lsK9+WmDAiBQxwFFTr1Dj5MHF7vJ+xHWkm8UJEWNU6Q5QeA0DHqJ4zsNBKyG2gE2lM4VXg2w0KaSuH3++KQRr6Vik4/6xR0GsRTyFiMKxkcifokY7DOVjiQ8lD6cGD+KtTKdM1ykwgGOmAjjqYI8js6uQvLhXhPjpWX4XrzVNjI+QYPwruo+ds9ocH2aeDzXgUqpat3q0GNBLRgA2ukABNvc3sLTmfdV/BLcrUfW3WISkwXPPS2xryx6xbq2wfZixrE2YZP2NLlLAZYFxUO9/mbd+ljDZb/zFhgVlVb38OKaLDjL6VXG/Ig0TwTJEnlgrvHhsVhjpd32CHgO2DNwnU9pZ7L1XYIyHwj7t+mkxwxFDt9j37LsGTxgBItul7XBJu8/I1uPlXcY1TQHwXSUY9EfMF92Yc4jz7JFljcfX6iQ4gboQT7DTkAt4wjxk5GaoyJVXogWUtrQ9yjM9vF8ZwsvN6Xx4WUPl+k9fSMOUsSExI2eP4eFofp3kZRTSDU7m6mWgNnjha975ROuP4S85AJh5KPg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB6697.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(376002)(366004)(136003)(39860400002)(346002)(186009)(451199024)(1800799009)(6666004)(4744005)(7416002)(110136005)(66946007)(66556008)(66476007)(478600001)(107886003)(5660300002)(8936002)(8676002)(6512007)(4326008)(26005)(1076003)(2616005)(83380400001)(41300700001)(316002)(2906002)(38350700002)(86362001)(38100700002)(6486002)(6506007)(52116002)(921005)(36756003); DIR:OUT; SFP:1102; X-MS-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wXbNxfo6kqz6hj7Bo16bfxgHIPZTPFLHe/do0XuHqq8sJDUtpuiz5MGUJpQVz9zktGMt1uiJ/DH10ZiU55Jhppibqo2tbs6sK+WfIb8k4AtJTVeGPPtHBvc5VoSneDpttAd+nXpEeVeghlpn4oRqwMXtchNr4g6NzMIHQtcrFAbb8e00pi6zFSQNRhYgHosBn01nhxmxE8lmjptN0MXPUkzSjqjvg5TnD5N6gMzkjrjufFSg960ijYwVax8qpFGQ4TKs70aYMPe0VQ/OMzRoUbQ47wXT85i5FhkV1hRW0V7PAmPU2Gf4aBBiIbgbaKNlN1NSYQu9QBvKeCCi3hFlN4Y1zDUK2AhnWKvXwuA9IN+f/wBoFMugyMpoYbMeL4v6yzZ9bcoWbnfB97OAhkyD5Yw6+PaokffjR7tgW5C+HuJikKKbxp/wz87jKvIE8bE9P8/XrhwhWlpQ/r4dUgO7WIERMilGyoNT5GUJ6g5wk6bUDQsKEnJTeOC7DgFE81osWxorVqfMccoExw+8uqVWV3lVOWOYVR/QFVYNBZlAJN0FgNgxJWTS+v4t3DsrEVzRLS X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6ada313-b73a-43b8-a50e-08dbb28c3b74 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6697.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 05:59:16.7617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LMsPdrisdMQTqo3Okp1qlskBNqgpCVKmgJrmE8r90fMFW1rGWax5VdisilXggMzc4jEb+kPqLQk91PrLTDkhGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SI2PR06MB5170 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org As we know, the ballot for resizing the WriteBooster buffer has been approved. UFS will support the WB buffer resize function, and UFS driver can add definitions for attr_idn related to this function to support this feature. Signed-off-by: Lu Hongfei --- include/ufs/ufs.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ufs/ufs.h b/include/ufs/ufs.h index 0cced88f4531..d174702ae960 100644 --- a/include/ufs/ufs.h +++ b/include/ufs/ufs.h @@ -179,7 +179,10 @@ enum attr_idn { QUERY_ATTR_IDN_WB_BUFF_LIFE_TIME_EST = 0x1E, QUERY_ATTR_IDN_CURR_WB_BUFF_SIZE = 0x1F, QUERY_ATTR_IDN_EXT_IID_EN = 0x2A, - QUERY_ATTR_IDN_TIMESTAMP = 0x30 + QUERY_ATTR_IDN_TIMESTAMP = 0x30, + QUERY_ATTR_IDN_WB_BUF_RESIZE_HINT = 0x3C, + QUERY_ATTR_IDN_WB_BUF_RESIZE_EN = 0x3D, + QUERY_ATTR_IDN_WB_BUF_RESIZE_STATUS = 0x3E, }; /* Descriptor idn for Query requests */ From patchwork Mon Sep 11 05:57:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lu Hongfei X-Patchwork-Id: 721662 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 104B0EE7FF4 for ; Mon, 11 Sep 2023 06:03:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232388AbjIKGDY (ORCPT ); Mon, 11 Sep 2023 02:03:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjIKGDY (ORCPT ); Mon, 11 Sep 2023 02:03:24 -0400 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2123.outbound.protection.outlook.com [40.107.215.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA71BCCA; Sun, 10 Sep 2023 23:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gd1ZHP+kvQBcybqhsdI2o1cIrY5CKQAhbf4YaIAru/6+exUFg7lxSDbSwizY6tADQJs5wORb4v2T4p2+dGWylqkz310YCMnIQ5Eidw8yEmf2mid9qdbWwqjXbTLvIo3fz275YFeYMSIBdtxh27I9jS7tu8IOkTzoizHeqR33GaLQ+ao/J9mR6ZTCGhk5UvGUfB6R5xB0SojPlLunN20p/E05uyEZFNEn0Edvu47j7Wpm1zINU+Y255E8H4Kija2rRNuIuqxzRtnjiwlJHzka6SluAleGtkGAu4/bFX/rSx2YhjB0/wI+fV8NDUwHuwF8AUDMNS9bERDU0FhfhbpxWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Q7Dj6MV8nNkR1UwpIiC2lqwGABf+zapLZechNgC9OU0=; b=W3rBzst0F4iy7Yu2D53arJHnIvpV5vQDZf8Ocd1hi4DeegOxdJxVkXuI2s6ZPF7jbQ6CGryOVGHkGEMvX1TnTCI/JOHiD7Ve/1Dd3zOYmtujSP9ioriH3BlNJyom/VTWpBM1nwxZ6ZJtlGOkBqUEyKadnotJDJa3/+tpO1QpzinGLxAfRuLdHEGRtZkJkpdw8Zh3ZDxPlnzS1bGc9AymbS84p5qOR2cuC+wViiRtHpEWjHNk3uJZiDQ9fJsl10qMoNza3HmQbY9L2SKK7UZgo6j7fU8V8ysjT0RtzNRZ0pExM7SshxXJo7cEZrQdVGFBOm9DGDXxNIfBX+U7yjz8rA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Q7Dj6MV8nNkR1UwpIiC2lqwGABf+zapLZechNgC9OU0=; b=UuRhQ8H4B3neongWRGGxh46e7gsTA+3Cw/Exk+yCpS7dI+xYvjX2KgrANzqXSXG4lCiuUp+JXV18noa642noGnyBlLPwhHjPD1vu8HxwCQCKWfc5wf38We1JtY67f18RQ5AeqyATutlztGVBo2+muoSxTf5FURMYBC6bhczRIFOyt3x7ZUWffP598JZ5b8vPreSpni0lmMxBxfQFh58YS/4C2ldspdzifaKvFwzYisPNWjHUnWUS4EG46F1veFKvkfg7ArmjzkPmiATAd7E0yOXchbooH/jmC3bDx1n96bJEPkGkBKA1DKhgSyA9Jx7kJ3FbE6ZuFc8w+J8yO1xH3w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) by SEYPR06MB5645.apcprd06.prod.outlook.com (2603:1096:101:c2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.36; Mon, 11 Sep 2023 06:02:13 +0000 Received: from TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::5bef:53ac:2a7c:6f4e]) by TYZPR06MB6697.apcprd06.prod.outlook.com ([fe80::5bef:53ac:2a7c:6f4e%3]) with mapi id 15.20.6768.029; Mon, 11 Sep 2023 06:02:12 +0000 From: Lu Hongfei To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" , Lu Hongfei , Bean Huo , Can Guo , Arthur Simchaev , Stanley Chu , Manivannan Sadhasivam , Asutosh Das , "Bao D. Nguyen" , Po-Wen Kao , Eric Biggers , Keoseong Park , linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org Cc: opensource.kernel@vivo.com Subject: [PATCH v3 3/3] scsi: ufs: core: Add sysfs attributes to get the hint information and status of WB buffer resize Date: Mon, 11 Sep 2023 13:57:08 +0800 Message-Id: <20230911055810.879-4-luhongfei@vivo.com> X-Mailer: git-send-email 2.27.0.windows.1 In-Reply-To: <20230911055810.879-1-luhongfei@vivo.com> References: <20230911055810.879-1-luhongfei@vivo.com> X-ClientProxiedBy: SG2PR06CA0234.apcprd06.prod.outlook.com (2603:1096:4:ac::18) To TYZPR06MB6697.apcprd06.prod.outlook.com (2603:1096:400:451::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB6697:EE_|SEYPR06MB5645:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f983df7-6569-4a2b-58ce-08dbb28ca415 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SyDfhisxoLncAJZSjxdCoXN5nBppd+COQ0u4jqQdKvskga0wlncKusuzgKimj73KkikwbAA5h6JxGK9LHCO8Vh+7xRZe+6hA9rpq4q1pk7qcv+Pd/4Q3LVyvzyEyghk7pFwyCSxCLDFdGkkIuSKALCDQ25FLfJD6mNuxh7wn7463G5HKBu2GP4u7cDXIDD7cx4V54oAbnahhynY3NS+mZ7jto58/3/jRAD+1rbfOBiy2tLRpmzVPHUQLseImGuun1svOcMvCg3b1gGqqusT4k7YIQ2dVD91/lw3m/DRxPRmsVvmHxMG6hZYjAypYhIxFunlhNCWOcSjNFRG0+pmmC9yyU6D0MO89dqcTBCgOpZSsJph2Z/H/M8tT7TkEC6la7nlJa5iFKKmYQBQ3esSl/5hkLUxY+jzJCIuVUEtIGJ3M5YjhYGM8gF30ahrklTx0L4r6aZpuKTQXz8hw8N9Y3slzkMr6GDLl8jiZgq8z2J8im/SCTM/nDhp0mABBhbXJKGlDpOTWjj8D6jrjj4FatoCboj2vo3pSaLoVpGSXekCXKijzWtgX1sbaDx2WAQHbbPtfoZiNmFkS6OvMfuFsAhVVlOitZbfQnthUf6i2q4Kjc21vEBthLXTIk/17dEG4xSZeE9Cg5zu8hpW10ByTY94fTqv5mFzWBaZACU/dFBI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYZPR06MB6697.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(346002)(39860400002)(376002)(366004)(396003)(136003)(1800799009)(186009)(451199024)(2616005)(1076003)(36756003)(107886003)(41300700001)(6486002)(86362001)(6512007)(26005)(83380400001)(6506007)(52116002)(6666004)(921005)(4326008)(5660300002)(66476007)(66946007)(66556008)(316002)(7416002)(110136005)(8936002)(2906002)(38100700002)(38350700002)(478600001)(8676002)(15583001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VGg05Jzwza/XAbnlREVDF2tTGP554Mvd2TvUKb+wyAb9NAEZDuo+j3OkAj5SHyXM6iao3FGtk4L8m/1Wda+7X37/NgL+tLkEt57YtRbGr6y/fOqbZa2Oo8hJcVvnoPLWVe7JG8TMOAt2SIwSIOQhzWKSqsfxfxOEpsrXqMtycOCEe/mnHkixJHI8XBTsnaYl5bT7KW+mxxNcyxmPi2Q+2qewpquSeFVarSpDXTcWFQuoLeFlt+BSobFLIhplaK6QW07W+UlY2LUCixbbvWSXRTDdKmNfnB3e5yUOgXYA1MxQaSytLcaRRfA5KGVMWVPNIhWcSugwAfvAZuxZBwHZyBX+BI6U8Az+UCO9XLxel7YGhtLZrVPP8rQ6iPdIA3mQgcbXNZvBHJcpv+tmN2V02DfLPiB8oWmRWI1yyzal0XF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SMYGU/lpXeoR23g41pI+7DdZxrwB3PbBe4KRVsKpRCBGSRV4U93a0QSOmpSGWWmmLu8VE5YsnQfuTZsuv5f+4pA3YMB X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f983df7-6569-4a2b-58ce-08dbb28ca415 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6697.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2023 06:02:12.2503 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JpahU8NAtvsmxVdAVYRhxDfObr0/lZho1oTq09DqO8DY5DoT4teFGPqH/tv0tzhq7J437bHXLEeQtaUQd0Erow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5645 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The host can get the hint information and status of WB buffer resize through sysfs. To achieve this goal, two sysfs nodes have been added: 1. wb_buf_resize_hint 2. wb_buf_resize_status The host can read wb_buf_resize_hint, obtain the hint information about which type of resize for wb buffer, and enable wb buffer resize based on the hint information. Considering that this process may take a long time, the host can confirm the resize status by reading wb_buf_resize_status. The detailed definition of the two nodes can be found in the sysfs documentation. Signed-off-by: Lu Hongfei --- Documentation/ABI/testing/sysfs-driver-ufs | 35 ++++++++++++++++++++ drivers/ufs/core/ufs-sysfs.c | 38 ++++++++++++++++++++++ 2 files changed, 73 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-ufs b/Documentation/ABI/testing/sysfs-driver-ufs index b8bd7e844cb0..4b03f4b8cd49 100644 --- a/Documentation/ABI/testing/sysfs-driver-ufs +++ b/Documentation/ABI/testing/sysfs-driver-ufs @@ -1454,6 +1454,41 @@ Description: The file is write only. +What: /sys/bus/platform/drivers/ufshcd/*/wb_buf_resize_hint +What: /sys/bus/platform/devices/*.ufs/wb_buf_resize_hint +Date: Sept 2023 +Contact: Lu Hongfei +Description: + wb_buf_resize_hint indicates hint information about which type of resize for + WriteBooster Buffer is recommended by the device. + + ====== ====================================== + 00h Recommend keep the buffer size + 01h Recommend to decrease the buffer size + 02h Recommend to increase the buffer size + Others: Reserved + ====== ====================================== + + The file is read only. + +What: /sys/bus/platform/drivers/ufshcd/*/wb_buf_resize_status +What: /sys/bus/platform/devices/*.ufs/wb_buf_resize_status +Date: Sept 2023 +Contact: Lu Hongfei +Description: + The host can check the Resize operation status of the WriteBooster Buffer + by reading this file. + + ====== ======================================== + 00h Idle (resize operation is not issued) + 01h Resize operation in progress + 02h Resize operation completed successfully + 03h Resize operation general failure + Others Reserved + ====== ======================================== + + The file is read only. + Contact: Daniil Lunev What: /sys/bus/platform/drivers/ufshcd/*/capabilities/ What: /sys/bus/platform/devices/*.ufs/capabilities/ diff --git a/drivers/ufs/core/ufs-sysfs.c b/drivers/ufs/core/ufs-sysfs.c index c14da6770316..e416b9802ad3 100644 --- a/drivers/ufs/core/ufs-sysfs.c +++ b/drivers/ufs/core/ufs-sysfs.c @@ -359,6 +359,40 @@ static ssize_t wb_buf_resize_control_store(struct device *dev, return count; } +static ssize_t wb_buf_resize_hint_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + u32 value; + u8 index = ufshcd_wb_get_query_index(hba); + + if (ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR, + QUERY_ATTR_IDN_WB_BUF_RESIZE_HINT, index, 0, &value)) { + dev_err(hba->dev, "Read WB Buffer Resize Hint info failed\n"); + return -EINVAL; + } + + return sysfs_emit(buf, "%u\n", value); +} + +static ssize_t wb_buf_resize_status_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct ufs_hba *hba = dev_get_drvdata(dev); + u32 value; + u8 index = ufshcd_wb_get_query_index(hba); + + if (ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_READ_ATTR, + QUERY_ATTR_IDN_WB_BUF_RESIZE_STATUS, index, 0, &value)) { + dev_err(hba->dev, "Read WB Buffer Resize Status info failed\n"); + return -EINVAL; + } + + return sysfs_emit(buf, "%u\n", value); +} + static DEVICE_ATTR_RW(rpm_lvl); static DEVICE_ATTR_RO(rpm_target_dev_state); static DEVICE_ATTR_RO(rpm_target_link_state); @@ -370,6 +404,8 @@ static DEVICE_ATTR_RW(wb_on); static DEVICE_ATTR_RW(enable_wb_buf_flush); static DEVICE_ATTR_RW(wb_flush_threshold); static DEVICE_ATTR_WO(wb_buf_resize_control); +static DEVICE_ATTR_RO(wb_buf_resize_hint); +static DEVICE_ATTR_RO(wb_buf_resize_status); static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_rpm_lvl.attr, @@ -383,6 +419,8 @@ static struct attribute *ufs_sysfs_ufshcd_attrs[] = { &dev_attr_enable_wb_buf_flush.attr, &dev_attr_wb_flush_threshold.attr, &dev_attr_wb_buf_resize_control.attr, + &dev_attr_wb_buf_resize_hint.attr, + &dev_attr_wb_buf_resize_status.attr, NULL };