From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33CFA606A329 for ; Mon, 30 Nov 2026 14:27:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=j7kfwtGa Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEDFF10E878; Mon, 30 Nov 2026 14:27:37 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BD1410E878 for ; Mon, 30 Nov 2026 14:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796048851; x=1827584851; h=message-id:date:subject:from:to:references:in-reply-to: content-transfer-encoding:mime-version; bh=2TvMPIDspSRWkDc/geypMO599xJqutb8vs1hL8ip6GY=; b=j7kfwtGa1kkuE76D/4fd+skmWasHYXFpdQ7o42feVooFApLmO2Gwyo8a eYs+FJyJGb0sSVort1wQQisnIcw19FftqeF05SFACPmpoI+2CBogMHxbX +5m7W8Wh2RJ6/7Ud9NeBHKQTnWMLUmk0lBl9c2a3CbJB3FNA3LdrGny/Q kjPpZLaZOAH/q+wD+rhTWN3NbTC1oUd7vjcbp/LVV+SnYFVwy4Kjb2zBw EcMFKRAGe6hu6FvIf6tC5cCMVEveYUw4zC06PYRn2xPNOEAK8UPrLdElm sx2WtUFqMxtxn+6Jia5mho//HuLZTXArtq0ofbWnxf6UI3sHn1883DzKN A==; X-CSE-ConnectionGUID: GwvbojCvQ7Wp4Yl/Pz+Gxw== X-CSE-MsgGUID: g854RIK2RxKy5acSZQbGJw== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4844245" X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="4844245" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 06:27:31 -0800 X-CSE-ConnectionGUID: fufQjNTNS0G1ttdeUrQH0A== X-CSE-MsgGUID: EvPQYOR2Rv2w+r6Il2lOWQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,242,1787036400"; d="scan'208";a="12940459" Received: from fmsmsx901.amr.corp.intel.com ([10.18.126.90]) by fmviesa004.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 06:27:31 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx901.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 06:27:30 -0800 Received: from fmsedg901.ED.cps.intel.com (10.1.192.143) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 06:27:30 -0800 Received: from SN4PR0501CU005.outbound.protection.outlook.com (40.93.194.31) by edgegateway.intel.com (192.55.55.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Mon, 30 Nov 2026 06:27:30 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Nk2kJq/gbA/dFagZ4pRr71XLJSjKsB20SuHdnc0Ot5YDuiSw2E7d0GUDNZBolJ9UIzylCPFoAjLrCvP1iBwPMDjEfKUWj+JnrPDgLqsjyFZzSdRpG7hDPOh+OZ/XfytUCjoy1+yIKKMhgsVjgRkxEzN6Fek44AsfjOo5+Efp+P0lStsxdatijFHZpI75Ufa/ZftQOBgeE6KNMnTDeC3wC7iEY6o4vwteZdNMA61EgmnEqaEGvmcHqhn47+ZSGajIjYrxuRuiippO0krtf3IIu5YvydrKAizrC8tHOg7DWPMg/zvcKUOqJMbwpg3WOy5sVhnWfjzcs7CLvU0/1hPqPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=2TvMPIDspSRWkDc/geypMO599xJqutb8vs1hL8ip6GY=; b=fBQZUMFCG6+VioZM+pIrdCd0SzocDnpC7oCMWX1BttND/T7NzpOY02s55+2O5iNGXYHAYxAciwrFba/lL+JrnR3bcM9K02dmo4NFtnwGwG/epLT7GM8Qoim+WuklUvSGnqJVRhrMhaZm8kAUgj375jDtl4FBbDw0yDw2/G/1m8X3d0cIzegm9Y+CS4btpK9B4zNtok995MFQ5zRDXiPfH6xA1Yx8ESGYMq1/tmVUxSIMsB5E+M4mhRvuZ/bKCeZj5hddBdOQ5DKO95Nd+b1ennzyCHOnzka6xbgsV+7SaWUUktX2lsIKYfPTAJpFKko9uiT2xuRXnAAP1umus77vVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from FT1PR11MB960200.namprd11.prod.outlook.com (2603:10b6:170:25::23) by SA3PR11MB7485.namprd11.prod.outlook.com (2603:10b6:806:31c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Mon, 30 Nov 2026 14:27:25 +0000 Received: from FT1PR11MB960200.namprd11.prod.outlook.com ([fe80::cfb1:f811:62bb:fa65]) by FT1PR11MB960200.namprd11.prod.outlook.com ([fe80::cfb1:f811:62bb:fa65%5]) with mapi id 15.21.0662.012; Mon, 30 Nov 2026 14:27:25 +0000 Message-ID: <2aaab6d3-0943-441c-a1e0-760ef9ad2a67@intel.com> Date: Mon, 30 Nov 2026 19:57:18 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 05/10] drm/xe/hwmon: Expose pwm[1-3]_enable From: "Poosa, Karthik" To: , References: <20261128055923.3316956-1-karthik.poosa@intel.com> <20261128055923.3316956-6-karthik.poosa@intel.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA5PR01CA0122.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:1a7::12) To FT1PR11MB960200.namprd11.prod.outlook.com (2603:10b6:170:25::23) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: FT1PR11MB960200:EE_|SA3PR11MB7485:EE_ X-MS-Office365-Filtering-Correlation-Id: 0cf82ae6-a28d-4158-a126-08df4eee0df6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|23010399003|1800799024|376014|10067099003|56012099006|261028144727099003|261102123227099003|261026140227099003|261026121527099003|261021121427099003|261022105027099003|261022075727099003|261022115727099003|261009223027099003|18002099003|22082099003|4143699003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: VNPXpIWX1MaJMozd411JPIYuTPNfx78IvGEgLf51VvdzuMbwzqkc4E9AyN802ufUekfkwfe/wb6wEL+mZffC1QqetR1Ecp43XPcPDEVvLNkWxwWX+G/Yj5gVZt9JXWpiR89m8qpONseYEm6Y4Pr+lXN3WJEDGsbrEeb3Ef4eEY18HO6d/jc1l3TJK8YAm1D88YDaRVe6m459GA1JRt1JfaDuJV54WvHF9IJQm8I8wF4IOEaWdcvIpgKGHx3XfORHIXQX2iAVmOnzNEM/wpvXlprJi/JPMVNSRUgoXgQhV2Jwkdy7TDeLu1POyYhL/pDPuqBSmhV23wgZtoOkSfanqtTuXqIaglVu98KBOkm3MOtxw3zV2VRDxDJyQGk6POx+48pdOc9czx09LpIzIIw5TcEXT9pP+h0jUi3H5vQRsEumY+XNhLT54OslYPuT3zXAQjaOQQKTmWOqgDywii7CuZTZLD8pKcocFYDHoBL0ei7KymhRA+8h857z5A0ou1mSht65LcMbn3iHx2n4tvYX/0e3x9yesfR2KKJeTgnhobFJV0x+alOBa4vkVSjvn5WT1ZTpcGCEVZH5LRean/wtvSXmMFk07SPtAgyLWnaooL2+UYOJEU+Sdh2WTq6oT1fjeiLbQELkoBmtOcV4HPuUE6qxVIRlky2ILDi5ltbs9f8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:FT1PR11MB960200.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(23010399003)(1800799024)(376014)(10067099003)(56012099006)(261028144727099003)(261102123227099003)(261026140227099003)(261026121527099003)(261021121427099003)(261022105027099003)(261022075727099003)(261022115727099003)(261009223027099003)(18002099003)(22082099003)(4143699003)(11063799006)(6133799003)(3023799007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N05QREc3UlZpdWNpZlRMdlNNYU9zVDFDT01mMThKQ3krTXR1bjlMWUExZ3RB?= =?utf-8?B?czRwb2RFdEdpM0tlSTh4d1dDZEtJSDE4bHNUU3ExTjRmYWxuRThoT0JKNm4y?= =?utf-8?B?Y1N0RE01UFVwRkpCV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lJMHJCZHRNNWVaa0FyZnM2dmVGRGtF?= =?utf-8?B?S2ZSNzZiaUNCWThhc1R5Q2U1SGVIMWhUZWFESDRBZGVjbVJVcDRGN0RQcXZh?= =?utf-8?B?QkM3bFl3cEhjZnNDNElpVkNQNjBhMmVlUmM3bUVDOU0yYzlETXhhNXUvTHpP?= =?utf-8?B?bnk2d2ljSWdpdDdhb0czMGdMN0hvd1R3Q1pXcnA4aTRiS2U1cjduaW54OXQz?= =?utf-8?B?K092WkZzRWVXN1V2R01nRUtWMFpSSi9NSkQ2dGNNR3IxR0RYNDExemdweGIz?= =?utf-8?B?Z2FQVzcyblF2U0s3ZW51UmxJZzNvZ0J2TEI0dFJUb3Byb3dLZmpXdjFqSzla?= =?utf-8?B?QmF5TmhMRnU3cDRZM3VyaG9jWldUZUYrVzJHeEF3UTdpSFdOUUM2WjV4OHB2?= =?utf-8?B?T1FlWWdOYW9aUzUzcE1kY0pPdEJnV3BpMTNRSGY5cXpXYlgzUDdCZz09?= X-Exchange-RoutingPolicyChecked: eExz07CTDBSOT7GqCiMefSL1awLbj0OPGKzJDaHcrTdDuhUseoFZvHIJfgZ+Ne/sV9GDW7+GX2hbRE/kHshzgTeBfM3S2+bQRfgF454a7rv1ORqdAveVzzD9oXfMOEovyJHS3/xybeuAYOrJuaCuzTZ/v1Bm8fgiej65vtf0XdcaQU4b/643bP+qCQklQII6BS2N3+VaseuU3BneLsQWFtsL3LqDQpEnv77IEQCfulw+G6TDJuXGFhMS35Vo6bayuLdLdaGrpm1NrY8eEkaveLazKg291xe+eopjTf9XJEa1NRby9nD4QR6bthOalfBIh0wo4/3R4d3C9Pqsi/Tzgw== X-MS-Exchange-CrossTenant-Network-Message-Id: 0cf82ae6-a28d-4158-a126-08df4eee0df6 X-MS-Exchange-CrossTenant-AuthSource: FT1PR11MB960200.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2026 14:27:25.6446 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Ny75HoNf3hwIasF9oGdZB4J0Ope9ndTQ/umbeoWjjYzrwQLgo4aq6eaA1GimnfdAVPLUcsmkBMeFWediCYxodA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR11MB7485 X-OriginatorOrg: intel.com X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 30-11-2026 16:57, Poosa, Karthik wrote: > > On 28-11-2026 11:43, sashiko-bot@kernel.org wrote: >> Thank you for your contribution! Sashiko AI review found 3 potential >> issues to consider: >> - [Medium] drm/xe/hwmon: wrong pwm readback in xe_hwmon_pwm_read() for >>    non-stock modes >> - [Medium] drm/xe/hwmon: xe_hwmon_set_user_fan_pwm() clobbers user table >>    in mode 0 >> - [Low] drm/xe/hwmon: missing point count check in >>    xe_hwmon_fan_set_auto() >> -- >> >> commit 562936f0b505f7da573995f262799f779e7aab25 >> Author: Karthik Poosa >> >> drm/xe/hwmon: Expose pwm[1-3]_enable >> >> This commit exposes the pwm[1-3]_enable hwmon sysfs attributes to select >> between full-speed, manual user-table, and automatic firmware fan >> control >> modes, and documents them in the Xe hwmon ABI. >> >>> diff --git a/drivers/gpu/drm/xe/xe_hwmon.c >>> b/drivers/gpu/drm/xe/xe_hwmon.c >>> index 78ef926feffcb..b6214ef933165 100644 >>> --- a/drivers/gpu/drm/xe/xe_hwmon.c >>> +++ b/drivers/gpu/drm/xe/xe_hwmon.c >> [ ... ] >> >>> @@ -1209,9 +1230,88 @@ static int xe_hwmon_fan_set_auto(struct >>> xe_hwmon *hwmon, u8 fan) >>>                    PCODE_MBOX(FAN_SPEED_CONTROL, >>> FSC_WRITE_NUM_FAN_CONTROL_POINTS, fan), >>>                    0); >>>       if (ret) >>> -        return ret; >>> +        goto fail; >>>         fi->fan_table[USER_FAN_TABLE].point_count = 0; >>> +    fi->pwm_enable_mode = XE_FAN_PWM_AUTO_STOCK_TABLE; >>> +    fi->is_full_speed = false; >>> +    return 0; >> [Severity: Low] >> Should xe_hwmon_fan_set_auto() call xe_hwmon_get_fan_point_count() to >> verify >> that firmware cleared the user point count to 0 before marking >> XE_FAN_PWM_AUTO_STOCK_TABLE active?  The v5 changelog notes that user >> point >> counts are verified after auto-mode writes as well as table >> activation, and >> both xe_hwmon_activate_user_fan_table() and >> xe_hwmon_set_user_fan_pwm() do >> this check. >> >> [ ... ] > > Changed will be updated, I've initally added then removed as > > it was not necessary, A successful return of setting user point to 0 > is enough. > >> >>> @@ -2054,12 +2168,20 @@ static int xe_hwmon_get_pwm_from_pmt(struct >>> xe_hwmon *hwmon, int channel, long * >>>           return -EOPNOTSUPP; >>>       } >>>   -    xe_dbg(hwmon->xe, "fan %d PMT active PWM value: %u\n", >>> channel, pwm); >>> +    xe_dbg(hwmon->xe, "fan %d: active pwm from PMT: %u\n", channel, >>> pwm); >>>         *val = pwm; >>>       return 0; >>>   } >>>   +static enum fan_table_type xe_hwmon_get_active_fan_table(struct >>> xe_hwmon *hwmon, u8 fan) >>> +{ >>> +    if (hwmon->fi[fan].pwm_enable_mode == XE_FAN_PWM_AUTO_STOCK_TABLE) >>> +        return STOCK_FAN_TABLE; >>> +    else >>> +        return USER_FAN_TABLE; >>> +} >>> + >>>   static int >>>   xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 attr, int channel, >>> long *val) >>>   { >>> @@ -2074,8 +2196,9 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, u32 >>> attr, int channel, long *val) >>>       switch (attr) { >>>       case hwmon_pwm_input: >>>           /* If the user fan table is not populated, get active >>> stock pwm */ >>> -        if (!fi->fan_table[USER_FAN_TABLE].point_count) { >>> -            xe_dbg(hwmon->xe, "user fan table not active for fan >>> %d\n", channel); >>> +        if (xe_hwmon_get_active_fan_table(hwmon, channel) == >>> STOCK_FAN_TABLE) { >>> +            xe_dbg(hwmon->xe, "getting active pwm for fan %d from >>> stock table\n", >>> +                   channel); >>>               switch (hwmon->xe->info.platform) { >>>               case XE_BATTLEMAGE: >>>                   ret = xe_hwmon_get_pwm_from_pmt(hwmon, channel, >>> &pwm); >>> @@ -2084,13 +2207,18 @@ xe_hwmon_pwm_read(struct xe_hwmon *hwmon, >>> u32 attr, int channel, long *val) >>>                   ret = xe_hwmon_get_stock_table_pwm(hwmon, channel, >>> &pwm); >>>                   break; >>>               } >>> -            if (ret) >>> +            if (ret) { >>> +                xe_err(hwmon->xe, "failed to get active pwm for fan >>> %d, ret=%d\n", >>> +                       channel, ret); >>>                   goto unlock; >>> +            } >>>           } else { >>>               /* >>>                * pwmN writes set every user-table point to the same >>> speed, >>>                * so the first point gives the cached manual PWM >>> percentage. >>>                */ >>> +            xe_dbg(hwmon->xe, "getting active pwm for fan %d from >>> user table cache\n", >>> +                   channel); >>>               pwm = fi->fan_table[USER_FAN_TABLE].fcp[0].speed; >>>           } >> [Severity: Medium] >> Can reading hwmon_pwm_input return the wrong PWM duty value when >> pwm_enable_mode is not XE_FAN_PWM_AUTO_STOCK_TABLE? >> >> When pwm[1-3]_enable is switched from 2 to 1 before any flat write to >> pwm[1-3], xe_hwmon_activate_user_fan_table() populates USER_FAN_TABLE >> from >> STOCK_FAN_TABLE with a multi-point temperature curve.  In that state the >> points in USER_FAN_TABLE do not share a single speed, so reading >> fi->fan_table[USER_FAN_TABLE].fcp[0].speed always reports the lowest >> temperature breakpoint speed instead of reading PMT on Battlemage or >> interpolating the active table against package temperature. > okay, we can return active pwm, that fan curve is not flat. >> >> In addition, xe_hwmon_get_active_fan_table() returns USER_FAN_TABLE when >> fi->pwm_enable_mode is XE_FAN_PWM_UNINITIALIZED.  If a mode >> transition and >> its xe_hwmon_fan_set_auto() fallback fail after clearing >> fi->fan_table[USER_FAN_TABLE].point_count to 0, reading pwm[1-3] returns >> stale or zero fcp[0].speed instead of -ENODATA. >> >> [ ... ] > okay, XE_FAN_PWM_UNINITIALIZED state shall be added. >>> @@ -2125,7 +2263,48 @@ xe_hwmon_pwm_write(struct xe_hwmon *hwmon, >>> u32 attr, int channel, long val) >>>               ret = -EINVAL; >>>               break; >>>           } >>> -        ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, (u8)val); >>> +        ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, (u8)val, >>> false); >>> +        break; >>> +    case hwmon_pwm_enable: >>> +        if (val == XE_FAN_PWM_FULL_SPEED) { >>> +            ret = xe_hwmon_set_user_fan_pwm(hwmon, channel, U8_MAX, >>> true); >>> +            if (ret) { >>> +                xe_warn(hwmon->xe, >>> +                    "full speed enable for fan %d failed, ret=%d\n", >>> +                    channel, ret); >>> +                break; >>> +            } >>> +        } else if (val == XE_FAN_PWM_MANUAL_USER_TABLE) { >>> +            enum fan_table_type source = >>> fi->fan_table[USER_FAN_TABLE].point_count ? >>> +                USER_FAN_TABLE : STOCK_FAN_TABLE; >>> + >>> +            /* >>> +             * Manual fan speed control using user fan table. >>> +             * If user fan table is not programmed, it would be >>> initialized with >>> +             * clamped stock points which allows manual control >>> with some >>> +             * default points. >>> +             */ >>> +            ret = xe_hwmon_activate_user_fan_table(hwmon, channel, >>> false, source); >> [Severity: Medium] >> Does setting pwm[1-3]_enable to 0 (XE_FAN_PWM_FULL_SPEED) overwrite >> fi->fan_table[USER_FAN_TABLE] and leave the fan pinned at 100% when >> subsequently switching to mode 1 (XE_FAN_PWM_MANUAL_USER_TABLE)? > yes, after switching to mode 1, user is expected to set the fan curve > through fixed pwm ie. using pwmF or through fan curve points ie. > pwmF_auto_pointX_temp or pwmF_auto_pointX_pwm >> Calling xe_hwmon_set_user_fan_pwm(hwmon, channel, U8_MAX, true) replaces >> fi->fan_table[USER_FAN_TABLE].fcp[0..1] with 100% speed points and sets >> fi->fan_table[USER_FAN_TABLE].point_count to MIN_FAN_CONTROL_POINTS.  >> When >> userspace later writes 1 to pwm[1-3]_enable, point_count is non-zero, so >> source becomes USER_FAN_TABLE instead of STOCK_FAN_TABLE (or any >> previously >> configured user table) and xe_hwmon_activate_user_fan_table() >> re-applies the >> 100% full-speed table. > yes. Xe is not storing the table between the pwm1_enable mode switches. > It shall be done by the UMD above it. on a second look, I think we could use xe_hwmon_activate_user_fan_table() to avoid overwriting the user table cache.