Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2047789ybg; Fri, 5 Jun 2020 04:21:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/oXykIq8CuiReqrrrGIJqnT7Y+oNwj6ud82oI2IZI1o+O2yvEO8j1ygV/WRJ7XDLbMGs7 X-Received: by 2002:a17:906:a881:: with SMTP id ha1mr8053015ejb.178.1591356116955; Fri, 05 Jun 2020 04:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591356116; cv=none; d=google.com; s=arc-20160816; b=Y1+xyhP759L7GlYZOj6z5+boxHKYZy2Ty3i9C5GT3I2zg+9wJDamdFhIHajo0OS7TB anOtHxLSJ0EzwmAxiNGzlcyGtmn7IvSV8yPVJEqEtNXy3o/6X1tECeYv0XRjoNu3WuHw B0Dr3GG757+MR5OfANX4pWtGkinodvZfvu1QeWOo7ncyOwNEjRLmzfBVVc+Wmo9I/lfm NTGqTolBVpEMttC7bF0GC8I/EttmGcH7YNRz9oLBT/MiRu/BQK2bK+A4OFHVTcK7eu4h /EdWfY95dTtgLLm/Kx0jINXp/RK3T+eIx+U//5l+jbBQb90kLFQWgTsHsVH/eEZFPyiG P5Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=AdXhySUJBdcCdBSN6U254mmotu47JBDg9uVsjV6OWac=; b=SF463QTzs0m7fKD5c6hrOlT/qlLC6F/AW9k6/Xn+C5Kwf2ySHhgoOHSL+qeXDmLppy vauEbp1d+vQmYqZx0eEqTsB0d3IANVb2L//agCFGj9tbAp+hcnpCPLpvIaSSzqXgJBLx 9QI7+vWCL7Kxj4WoawpiI1rcxLGiV99CMmbpDhjTWstVeA8gJh7Cnp+J94RPG6K5T12O uesIlyuzsqvKJ69BlaoaWzJ1U0KgNHuidLahNzHKrZQwAldkR3K00vGPIw+6yDp8SKx2 dc98d5c4XEkzMI3FHgvlPX0XignFEEVgASa73YR5/WZVwgAQdSCnJU4pMGnI55eZNPcC q8RA== ARC-Authentication-Results: i=1; mx.google.com; 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 w24si3383617edv.588.2020.06.05.04.21.33; Fri, 05 Jun 2020 04:21:56 -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; 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 S1726862AbgFELRU (ORCPT + 99 others); Fri, 5 Jun 2020 07:17:20 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:53692 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbgFELRU (ORCPT ); Fri, 5 Jun 2020 07:17:20 -0400 Received: from 89-64-83-87.dynamic.chello.pl (89.64.83.87) (HELO kreacher.localnet) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.415) id 01eedc837bead76a; Fri, 5 Jun 2020 13:17:17 +0200 From: "Rafael J. Wysocki" To: Enric Balletbo i Serra Cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , ACPI Devel Maling List , Len Brown , Collabora Kernel ML , Guenter Roeck , Benson Leung , Dmitry Torokhov , Gwendal Grignou , vbendeb@chromium.org, Andy Shevchenko , Ayman Bagabas , Benjamin Tissoires , =?utf-8?B?Qmxhxb4=?= Hrastnik , Darren Hart , Dmitry Torokhov , Greg Kroah-Hartman , Hans de Goede , Jeremy Soller , Mattias Jacobsson <2pi@mok.nu>, Mauro Carvalho Chehab , Rajat Jain , Srinivas Pandruvada , platform-driver-x86@vger.kernel.org Subject: Re: [PATCH v4] platform: x86: Add ACPI driver for ChromeOS Date: Fri, 05 Jun 2020 13:17:15 +0200 Message-ID: <10490419.gsntqH5CaE@kreacher> In-Reply-To: References: <20200413134611.478441-1-enric.balletbo@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, April 14, 2020 4:35:38 PM CEST Enric Balletbo i Serra wrote: > Hi Rafael, > > On 13/4/20 22:41, Rafael J. Wysocki wrote: > > On Mon, Apr 13, 2020 at 3:46 PM Enric Balletbo i Serra > > wrote: > >> > >> This driver attaches to the ChromeOS ACPI device and then exports the values > >> reported by the ACPI in a sysfs directory. These values are not exported > >> via the standard ACPI tables, hence a specific driver is needed to do > >> it. > > > > So how exactly are they exported? > > > > They are exported through sysfs. > > >> The ACPI values are presented in the string form (numbers as decimal > >> values) or binary blobs, and can be accessed as the contents of the > >> appropriate read only files in the standard ACPI devices sysfs directory tree. > > > > My understanding based on a cursory look at the patch is that there is > > an ACPI device with _HID equal to "GGL0001" and one or more special > > methods under it that return values which you want to export over > > sysfs as binary attributes. They appear to be read-only. > > > > Exactly, there is an ACPI device equal to "GGL0001" and one special method > called MLST that returns a list of the other control methods supported by the > Chrome OS hardware device. The driver calls the special MLST method and goes > through the list. > > > I guess that these data are to be consubed by user space? > > > > Yes, this is used by user space, to be more specific ChromeOS userspace uses it. Well, let me start over. The subject and changelog of this patch are not precise enough IMO and there is not enough information in the latter. It is not clear what "ACPI driver for ChromeOS" means. There may be many ACPI drivers in a Linux-based system as a rule. It is unclear what the ChromeOS ACPI device is and why it is there. Is there any documentation of it you can point me to? It is unclear what you mean by "These values are not exported via the standard ACPI tables". It looks like (but it is not actually documented in any way) the idea is to get to the ACPI device object with _HID returning "GGL0001", evaluate the MLST method under it and then evaluate the methods listed by it and export the data returned by them via sysfs, under the "GGL0001" device on the "acpi" bus. Is this correct? If so, there is a couple of issues here. First off, GGL0001 is not a valid ACPI device ID, because the GGL prefix is not present in the list at https://uefi.org/acpi_id_list There are two ways to address that. One would be to take the GOOG prefix (present in the list above), append a proper unique number (if I were to guess, I would say that 0001 had been reserved already) to it and then put the resulting device ID into the firmware, to be returned _HID for the device in question (you can add a _CID returning "GGL0001" so it can be found by the old invalid ID at least from the kernel). The other one would be to properly register the GGL prefix for Google and establish a process for allocating IDs with that prefix internally. Next, device attributes in sysfs are part of the kernel ABI and once defined, they cannot change (exceptions happen, but rarely), so you must guarantee that whatever appears in there, will always be present for devices with the given device ID in the future in the same format. Can you actually guarantee that? If so, what is that guarantee based on? Thanks!