Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp807833ybg; Wed, 10 Jun 2020 14:24:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz35GjUIIKAy7m70KnsCdpDpFm8mRV/D2pFb6RnvLCnEvpUlfp807EpgASQukNkEdaQxkVZ X-Received: by 2002:a05:6402:1ac1:: with SMTP id ba1mr4062047edb.91.1591824298706; Wed, 10 Jun 2020 14:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591824298; cv=none; d=google.com; s=arc-20160816; b=ZmXIHE48mkKudEMFvDeze5CglaJXLYBOqnujDJDTPPdYwepinnd7suXRYUZ1EZ4nYu KNewXqbQHPJmZ+RPORjUOqBqIE5tBqa7fhmD6aliA12XDsw6PzsG/NMGCpC09sC7rrMQ xkO9rkGoN+TyoScqJCiDPgaYzUz0pzutNAu6u5Fi2hv3eFmG3gFKGP863v2iz2gRpZQV 6BDgk+2L4sRRXBxXa1wYkqVaYHBGOgqnxX3x/NY3MIQvR7heasCXisTs3uw8ab1/Yy/t soICbBy5MJO8I0iSjGk+FCsW65s2N7CJJOaTaHuXwMXoiINVNEt3qf+djZEGxD3vcjIX lSqQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=iXfOobVTYeSXZXcMpK1916R3P9Lo27gXnHuZwjps7ow=; b=rgdDh5qMaZ7dUjZ5QNNP14Vg1FHzFZxh5ZuRNRWzMXmxJzPBYleAzhooKmDr+Sxt3Q 5EdYY8BfMmO/UeX0WtrOgwFjNzfknagxx9mKdiUPcZj2pyiPsuEm9oz6MLx7Lz1SR/0U 53KSgoYTIm6hMHpyfz9IO/S7E9tLNFGMcQVeIRDJfLw9ambMSjJUylKZZw8IczrFvbPt nlokX+Yb/sCeKWPq89BpMrG8p5DuuCs1a8FnIpOe1oeAYTFn2CQu+vIN1PSc2SxemuBM QX/W3SDuQ5P5hejoTQylKxNyS0TZxD4YtgVYCvexzZ26LGvTzs4WQAuR93m8xcSGtHkN /V9Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by19si762064ejb.216.2020.06.10.14.24.35; Wed, 10 Jun 2020 14:24:58 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726260AbgFJVVy (ORCPT + 99 others); Wed, 10 Jun 2020 17:21:54 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:40206 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726119AbgFJVVx (ORCPT ); Wed, 10 Jun 2020 17:21:53 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id 517902A2AC5 Subject: Re: [PATCH v4] platform: x86: Add ACPI driver for ChromeOS To: "Rafael J. Wysocki" 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?Q?Bla=c5=be_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 References: <20200413134611.478441-1-enric.balletbo@collabora.com> <10490419.gsntqH5CaE@kreacher> From: Enric Balletbo i Serra Message-ID: <4e7f8bf3-b72b-d418-ec95-e1f8c3d61261@collabora.com> Date: Wed, 10 Jun 2020 23:21:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <10490419.gsntqH5CaE@kreacher> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Rafael, Many thanks for your feedback. See my answers inline. On 5/6/20 13:17, Rafael J. Wysocki wrote: > 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. > Ok, I can improve that. > 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? > I'm afraid, I don't think there is any documentation, I'll ask around. > 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? > Yes, this is 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). As Dmitry said, this is not going to happen. > The other one would > be to properly register the GGL prefix for Google and establish a process for > allocating IDs with that prefix internally. > IIUC I think this is the option we should go, although I am not really sure how to do it (I will investigate or ask). To give you some references, if I'm not wrong, this prefix is used in all or almost all Intel Chromebook devices (auron, cyan, eve, fizz, hatch, octopus, poppy, strago ...) The ACPI source for this device can be found here [1], and, if not all, almost all Intel based Chromebooks are shipped with the firmware that supports this. > 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? > Although is not really documented, can we say that this is a standard "de facto" assuming that there are lots of devices in the field and for a long time with that? Can this be a guarantee? > Thanks! > > > Thanks! [1] https://chromium.googlesource.com/chromiumos/third_party/coreboot/+/refs/heads/chromeos-2016.05/src/vendorcode/google/chromeos/acpi/chromeos.asl