Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp207221pxb; Fri, 9 Apr 2021 23:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzknXNWQ2z/IyvZiV4S4/D1of1C1iDmWWGOB+fxmU4i0eYI2NIK+NTLN6tr7jCdiJS4A3ak X-Received: by 2002:a17:902:bb96:b029:e6:23d:44ac with SMTP id m22-20020a170902bb96b02900e6023d44acmr15922549pls.50.1618037839769; Fri, 09 Apr 2021 23:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618037839; cv=none; d=google.com; s=arc-20160816; b=wPfEhc4D92uMxBKmCK9uRwIKoSAUQ1V0c66roNmHjX7yl2qhBWpHrYRfs8QtsmVcVk bDEf1S+ZLDuIWKNcuKYYmTwxg/vGDc5SjcxKxHoSiQOVwVyDIJrYw9nNlOsEeT8rdzMs oNckvx/yEFNy+KVlvfwsewGFr4b0jy2wmUefsQhwuIS741LYhts6jHz7QUHU/yLJc7hU JqMQjO3VjnjwrsesBlw9dDPe3AZdWi6W0SFOtPTIzfgqtwp/+tqTTjWbYb5+sasL4MxA EkkU4ME5vafV0l6ghn7pApDvcT5o2JYrrd3GeAQcowIzS7JIJdrx5C0z5IvtJ6lktO8T AGGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:autocrypt:from :references:cc:to:subject:sender:dkim-signature; bh=69v/xKDkKDVCv+vp6CQW+QiOX+E1rN7FFRDWueCafvo=; b=mJ9SKEAMyPzlFqd5we+GEpFgnbeFKg3gGM57pUqQhMMQnQZA3F/0cYFNn2dP4iQfHT JF8tYTfTHAF1yC6itikJNRd6Xu8/3bV2zbx186/8BLWYXBfJ/DAbm1wmARuXRvafC6XZ VZW0Z9etpFYyMSpWYAOUF1QzDozC/+wcX69tHPiHfAnjn3laZa8Js+qbHRDwu6MtHXCj pYhFLaZEGtE6Inx3lDke1PcEFXOrzBeQA1PDqdDAtyl8g0MGRlxU4ADGk3/eAr0SGt1q oEku9TDeWNVqmifrhb0Ihypj/MD8URg/6c3iwCNrWao8f7DA524+RWxKySeZyym1v/Je 6jog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gc4dkBYt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n124si5222472pga.76.2021.04.09.23.57.07; Fri, 09 Apr 2021 23:57:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gc4dkBYt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233606AbhDJG4v (ORCPT + 99 others); Sat, 10 Apr 2021 02:56:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhDJG4s (ORCPT ); Sat, 10 Apr 2021 02:56:48 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E97C061762; Fri, 9 Apr 2021 23:56:34 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id f75-20020a9d03d10000b0290280def9ab76so2767138otf.12; Fri, 09 Apr 2021 23:56:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=69v/xKDkKDVCv+vp6CQW+QiOX+E1rN7FFRDWueCafvo=; b=Gc4dkBYtifAXKh3RHfECQuQGpi9IQOjQNqARZLHPSrzAP5v2S0mk9s4SP/4tHEpn7u O/+nrlFgKT0YSNuvy5x+puqruIK/aA8f2saxzA79KHmiXVeS0ktpEZZ3Cr8Zi4O20QnF vpuhISk/WPTxSroMN9cNbMj8X0sOJigy1HmezAo/itXogwvyOOfkoREAFjN4No61goJB 3sjmlgpJpIbEXSNrzPGcpLkUarariYSHIpv0rv6yuNODkzeGWgC86q+WpSNEBuWhKsF/ PCp4MMPtC9JLIIab5o4BhS7lt+mWs2gfxcharLizFOb6ZxSm+T4wiRP6KlHQf19cNinS xfQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=69v/xKDkKDVCv+vp6CQW+QiOX+E1rN7FFRDWueCafvo=; b=DMFKLlgw/M/Rv6+RU/rGVpAcsKDxWCSipH8TklbwSxb1iapAUJoRc58aofGO6nhrTk XBCuSkc9Vpv+i+eJYKWlzW+vkeVDeS7FKbFj49bIo6WBkaQJxNY0Yb8WQBDAe7Zuzpuz gbEYwtqw4ZByQH9CPRan20dyeZk5LswfYJDvMjlQjAlFsgUaf70lJ8QUa5Y2oCZgVivA aG+RaaSe2nLS7ToT4pI0XQJ2xoJJWfO6Dx4RWa2NfI5IUqpSCE07T+/se8mQJijv7F2u U0nPZkUv1Tx1X/v32I6oOSsNZkSAh0HKidanY7rRq4CrPQOp2BJXxYK9sOg41oUSstFL C3xQ== X-Gm-Message-State: AOAM530H5ZWg1KwsYPGOoNNBZ66wvHyJ3zq7QLbxtqc++yFiZnoMVdR5 mluh3M0xqHLM9PPMHyJtpCc= X-Received: by 2002:a9d:bf8:: with SMTP id 111mr6550391oth.306.1618037793451; Fri, 09 Apr 2021 23:56:33 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id l26sm1159294otd.21.2021.04.09.23.56.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Apr 2021 23:56:32 -0700 (PDT) Sender: Guenter Roeck Subject: Re: [PATCH v2] platform/x86: add Gigabyte WMI temperature driver To: =?UTF-8?Q?Thomas_Wei=c3=9fschuh?= Cc: Hans de Goede , Jean Delvare , platform-driver-x86@vger.kernel.org, Mark Gross , linux-kernel@vger.kernel.org, =?UTF-8?Q?Barnab=c3=a1s_P=c5=91cze?= , Matthew Garrett References: <20210405204810.339763-1-linux@weissschuh.net> <44fbb57c-88ee-62f0-c72c-507cad17eb7d@redhat.com> <123d021b-b86b-4356-b234-fb46fa260193@t-8ch.de> <6993d257-fdc1-2be6-555d-86c6b8c9d18d@redhat.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w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VROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: Date: Fri, 9 Apr 2021 23:56:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/8/21 11:02 PM, Thomas Weißschuh wrote: > On Do, 2021-04-08T08:00-0700, Guenter Roeck wrote: >> On 4/8/21 2:36 AM, Hans de Goede wrote: >>> On 4/7/21 9:43 PM, Thomas Weißschuh wrote: >>>> On Mi, 2021-04-07T17:54+0200, Hans de Goede wrote: >>> Jean, Guenter, >>> >>> Thomas has been working on a WMI driver to expose various motherboard >>> temperatures on a gigabyte board where the IO-addresses for the it87 chip >>> are reserved by ACPI. We are discussing how best to deal with this, there >>> are some ACPI methods to directly access the super-IO registers (with locking >>> to protect against other ACPI accesses). This reminded me of an idea I had >>> a while ago to solve a similar issue with an other superIO chip, abstract >>> the superIO register access-es using some reg_ops struct and allow an ACPI/WMI >>> driver to provide alternative reg_ops: >>> https://bugzilla.kernel.org/show_bug.cgi?id=204807#c47 >>> >>> Do you think this is a good idea (or a bad one)? And would something like that >>> be acceptable to you ? >>> >> >> The upstream it87 driver is severely out of date. I had an out-of-tree driver >> with various improvements which I didn't upstream, first because no one was willing >> to review changes and then because it had deviated too much. I pulled it from >> public view because I got pounded for not upstreaming it, because people started >> demanding support (not asking, demanding) for it, and because Gigabyte stopped >> providing datasheets for the more recent ITE chips and it became effectively >> unmaintainable. >> >> Some ITE chips have issues which can cause system hangs if accessed directly. >> I put some work to remedy that into the non-upstream driver, but that was all >> just guesswork. Gigabyte knows about the problem (or so I was told from someone >> who has an NDA with them), but I didn't get them or ITE to even acknowledge it >> to me. I even had a support case open with Gigabyte for a while, but all I could >> get out of them is that they don't support Linux and what I would have to reproduce >> the problem with Windows for them to provide assistance (even though, again, >> they knew about it). >> >> As for using ACPI locks or WMI to ensure that ACPI leaves the chip alone while >> the driver accesses chips directly: That is an option, but it has (at least) >> two problems. >> >> First, ACPI access methods are not well documented or standardized. I had tried >> to find useful means to do that some time ago, but I gave up because each board >> (even from the same vendor) handles locking and accesses differently. We would >> end up with lots of board specific code. Coincidentally, that was for ASUS boards >> and the nct6775 driver. > > At least for all the Gigabyte ACPI tables I have looked at all access is done > via two-byte "OperationRegion" over the Index/Data addresses, a "Field" with > two entries for these and an "IndexField" that is actually used to perform the > accesses. > As the IndexField is synchronized via "Lock" it should take a lock on the > OperationRegion itself. > > So I think we should be technically fine with validating these assumption and > then also taking locks on the OperationRegion. > > If it is reasonable to do so is another question. > You'd still have to validate this for each individual board unless you get confirmation from Gigabyte that the mechanism is consistent on their boards. Then you'd have to handle other vendors using it87 chips, and those are just as close-lipped as Gigabyte. Ultimately it would require acpi match tables to match the various boards and access methods. I had experimented with this this a long time ago but gave up on it after concluding that it was unmaintainable. >> Second, access through ACPI is only one of the issues. Turns out there are two >> ITE chips on many of the Gigabyte boards nowadays, and the two chips talk to each >> other using I2C. My out-of-tree driver tried to remedy that by blocking those >> accesses while the driver used the chip, but, again, without Gigabyte / ITE >> support this was never a perfect solution, and there was always the risk that >> the board ended up hanging because that access was blocked for too long. >> Recent ITE chips solve that problem by providing memory mapped access to the >> chip registers, but that is only useful if one has a datasheet. > > Are both of these chips available at the two well-known registers 0x2e and > 0x4e? > The ones I know of are, yes. Oh, that reminds me, there is another bug. Here are my comments about that: /* * On various Gigabyte AM4 boards (AB350, AX370), the second Super-IO chip * (IT8792E) needs to be in configuration mode before accessing the first * due to a bug in IT8792E which otherwise results in LPC bus access errors. * This needs to be done before accessing the first Super-IO chip since * the second chip may have been accessed prior to loading this driver. * * The problem is also reported to affect IT8795E, which is used on X299 boards * and has the same chip ID as IT8792E (0x8733). It also appears to affect * systems with IT8790E, which is used on some Z97X-Gaming boards as well as * Z87X-OC. * DMI entries for those systems will be added as they become available and * as the problem is confirmed to affect those boards. */ > Would this too-long blocking also occur when only accessing single registers > for read-only access? I don't know. Remember, zero support from Gigabyte / ITE. Guenter