Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp661604lqo; Fri, 10 May 2024 10:39:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+J8c8Ttz8ThPHc9kxH9ynGq+4mWrYCCL0LVe7mKIJtD0zk9lOLLh3DEm1TB55IQgyDRkyP8Zw1H4moDpQSfR+M3clIWvGUhqY27k3IA== X-Google-Smtp-Source: AGHT+IHeEUqlR4WkhI7PJMbfbOYPeNF94icDfoAZc+LWuueHTaLEfrtEIgkrSjFqPq+mbEDdca5E X-Received: by 2002:a05:622a:2288:b0:43a:9715:9e17 with SMTP id d75a77b69052e-43dfdb0800bmr33362331cf.14.1715362761981; Fri, 10 May 2024 10:39:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715362761; cv=pass; d=google.com; s=arc-20160816; b=k+EQXy7QGJvQLcw+nTb0PE0dD5rnTV6kfh+AU587WPpW9ZInt9PLj4dhua2ywcGG0k A54T/exr8Thfd1jY324XFjpe5DeayxKX5ALb0JQvIxNxLO0By52r7RhKbjl6/NY0HL+j /Oy91ZNMqC4Zcqpub/3GuugAmA8s6hxfPEf7rqrZdrDpQuBwZfHf1pYWmPSQzML+/GZc cqPoXVjTLMps9luVrH+nNbU6LMp0ljWUdkfqmzuM9emaWzBc6DB4+sk3J2j5a5PCYUrE PKpBARv1wULsrPgukJp3t7NE05vUiBE5uNt5jUwq0ZY0EFimddbkS5rjnP+b101gDz6x O58Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=z0VltB2Hvfk8CsgxOW0/hP0I9raK/6ln4is4V8Bvz/M=; fh=m4YRVInCcPf/BLu8yJ15xGNiBdP2YgDzVpmKOOWamgs=; b=msDqfp7SOv8p8kwGAUP9E5pnkXyIXbh/bW1zdZXhF0vK/sCw4bq3HKq1hBsxjaAms8 lvy0NXTbGLmL3KUp6m/FjXSxfHjmG4En9JuaK9yd3yDq7aUfdcWl3zZUa++pShzZKiPZ WPDBtQxXwJLyGHcuBHfTI79f97usUhnDb8zilamnBfFTsRJTNYL4myBbMnIlS4pLOrcX MFAZfkyOO/1BrOSNqwNDIiJZam/3tG9eGVO0Ww8diHqvukwvB5wJaFi48HpjG3VW0XU2 +AbWdKYBukLBdw+H66Ub3bnZHRArVaU1/K2wvYLKUXp13EnzXcbEhvUcF9nRK4M48M3y 9nCg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=q1QsG7EL; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-176057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df56eb438si39708841cf.778.2024.05.10.10.39.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 10:39:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=q1QsG7EL; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-176057-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A0F711C22115 for ; Fri, 10 May 2024 17:39:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 836B91BDCF; Fri, 10 May 2024 17:39:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b="q1QsG7EL" Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2BCF51BDC8; Fri, 10 May 2024 17:39:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.17.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715362755; cv=none; b=G5bOouK3BqAGTXzF2Ay25SYTbZ/K/g+f673EGJzGYozuHJvR09XoNzmDhpmaYhb880TOxLMSJV9BMcFxlh7Rani9gedqIygPEaDO9XtEe5PU141iLOTFblIU8KlIPAdskeCWLTxBmTkfFusXh+9HKn93k5KPoi6xEtFaoqD7Vps= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715362755; c=relaxed/simple; bh=u3APilzbMNtqOZMLPN2WV/6Lb05zx0rNSqQPRAygaTE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IcqEyneVpTE9iKJns7uDU/xe87uqO5Za3XM43+LVKUYNO7nzh7wHEgjzQhNcCdGHgjZpEiEc2H/cH7u+WDbONAFQ3gNlDeyastE33u7Wdsj7WLG3kHObwFSYNOjDnbvrIA9nX5p58AyLQxZA+B55DMsXV4ZglYlO/2CUZ1/peOQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=w_armin@gmx.de header.b=q1QsG7EL; arc=none smtp.client-ip=212.227.17.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1715362737; x=1715967537; i=w_armin@gmx.de; bh=z0VltB2Hvfk8CsgxOW0/hP0I9raK/6ln4is4V8Bvz/M=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:To:Cc: References:From:In-Reply-To:Content-Type: Content-Transfer-Encoding:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=q1QsG7EL+UPPn6cf4zE876oS0SyFmcFqq7a7tvXUVFiALaxlalhyY4zGNqmNv46O QqLCSCZwEXxkeC7YgGlq4GZKNIM7aPH2FP5R8WepVJfrvySgxcFZTDZumJwD3O8ST HuHhlbhbmHZsF8Hffu1UbOFZmZwXNYNJjlhL7sZ+9PwGatx4xfCtxjk4YrRZuwccX oX2f2D2gttPaY7vz3vBesmicWgkYof23/eWQtbH5WslUTTW8bMW/wiEi08nNcFXa5 713UrvgvC0BPW9jH5lE/ZOBsEOTQdvxkwo1mOEcq35SuYbvsf1ZqfmYs2b6L74qTr OuQSJ5KSf9ljcAD9EQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [141.30.226.129] ([141.30.226.129]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MRmfi-1sBUUt37gw-00SQJw; Fri, 10 May 2024 19:38:57 +0200 Message-ID: <22937f20-93fd-4ae2-a5cb-31e5a477ac37@gmx.de> Date: Fri, 10 May 2024 19:38:56 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/2] ACPI: EC: Install address space handler at the namespace root To: Andy Shevchenko Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux ACPI , LKML , Hans de Goede , Mario Limonciello , Heikki Krogerus References: <5787281.DvuYhMxLoT@kreacher> <4926735.31r3eYUQgx@kreacher> <568291fc-fd79-4f08-9eb7-aed7f5a32345@gmx.de> Content-Language: en-US From: Armin Wolf In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:zvM5SKIObVOLAeidcXB2jTJIhDe9MC097JNe9+0mhy+IhwUw9m4 Wi66lz/zofhdpEijFL4tcTNIoIyMuK+goEIw8TKf9AfMS2cO+TcuwghbaI2b/QdaD3sWTxy +mIGKWNPpuuDRJPQzrWj60LHsa5u0DdiFC8M7aacMtjDz7A8VM9VfLxTesnk6uEB870zf78 L5UepzfbOvVhWX0yoUoSA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:1K6PtlAGIfw=;2BcAVPpb1fvsHbnQxxUrenpuOAx EQ5BFX3d+fsO+xwVpINiKqlaB8f4dQSg7CZPlEqsBOcisrYkhn7IuCaqaAvchgH9lWcur2J5B EYEGuGse3/4cBxkLzsaiqsCanyfnvE+hHqTeXYrTTDNJS5/9tIpydZH0kU1uOshWcDYR4kS2k w9DYDqo6KiiqU0fJlnn4RiafWCuHcJM5LF11E56YWWhrWP9VoeTzqOZLPm9USfrP0qt0DMRyM 1QZMohlboSAf/sfZDqu0vB0dCNCH6owBUhP7PnW1WSs2mIDXZBlIaHbDSbHKzTtdyihymAmm3 xYhQYOWMVebi4zlpotf8/k7Q/CBt/F74al35DdRmzN2+6iG0+CqSJWOQOY5sgRzjImKJLNOnG JE52jAUZQq2zutaFFtaDmGPrf1DlXtf/siFBluH6eFTJhAlPS4aP6+M9pxUKEnetVbQUfWiA1 BZ1KXcw2VLLKhymPVbvcHO6mFcvUOscmaX0RdmLdTeW72OGigCbgKpRG+d7UalA57ruuYMm/K SKHwnd1CdxW3AbD8ul8bmFYDOqTNRLf7GaFYE7XVHSUqjvevA85u+UZAxo0RU+kHlIW620h5y K6fHnacNELWzasFy/e4O/LC2iPjXYx3PCUEGTgxPzthvlEcDHCryJT+Uu5+LebUu1Pb+iKzjB Wt/C/ytF89IWXk32ns5lJ6ExoETiQ6T+DxPe77IwvQ+Fniy7tsSLlKrjFalzYF7Tv+uWjDvYW qP7eukc7oQBwGhpFAjUIjVNpMZxDKR8DR3JNDwhuGbXJ/kmKZNIi3Z9hiT8QIZP53coWHTGp2 IB6icSkdXNb0cifCCU8lqvxK62J86SXHsCX2UhxDpJsO4= Am 10.05.24 um 19:29 schrieb Andy Shevchenko: > On Fri, May 10, 2024 at 06:52:41PM +0200, Armin Wolf wrote: >> Am 10.05.24 um 18:41 schrieb Rafael J. Wysocki: >>> On Fri, May 10, 2024 at 6:10=E2=80=AFPM Armin Wolf wr= ote: >>>> Am 10.05.24 um 16:03 schrieb Rafael J. Wysocki: >>>> >>>>> From: Rafael J. Wysocki >>>>> >>>>> It is reported that _DSM evaluation fails in ucsi_acpi_dsm() on Leno= vo >>>>> IdeaPad Pro 5 due to a missing address space handler for the EC addr= ess >>>>> space: >>>>> >>>>> ACPI Error: No handler for Region [ECSI] (000000007b8176ee) [Emb= eddedControl] (20230628/evregion-130) >>>>> >>>>> This happens because the EC driver only registers the EC address spa= ce >>>>> handler for operation regions defined in the EC device scope of the >>>>> ACPI namespace while the operation region being accessed by the _DSM >>>>> in question is located beyond that scope. >>>>> >>>>> To address this, modify the ACPI EC driver to install the EC address >>>>> space handler at the root of the ACPI namespace. >>>>> >>>>> Note that this change is consistent with some examples in the ACPI >>>>> specification in which EC operation regions located outside the EC >>>>> device scope are used (for example, see Section 9.17.15 in ACPI 6.5)= , >>>>> so the current behavior of the EC driver is arguably questionable. >>>> Hi, >>>> >>>> the patch itself looks good to me, but i wonder what happens if multi= ple >>>> ACPI EC devices are present. How would we handle such a situation? >>> I'm wondering if this is a theoretical question or do you have any >>> existing or planned systems in mind? >>> >>> ec_read(), ec_write() and ec_transaction() use only the first EC that >>> has been found anyway. >> Its a theoretical question, i do not know of any systems which have mor= e than >> one ACPI EC device. > The specification is clear about this case in the "ACPI Embedded Control= ler > Interface Specification": > > "The ACPI standard supports multiple embedded controllers in a system, > each with its own resources. Each embedded controller has a flat > byte-addressable I/O space, currently defined as 256 bytes." > > However, I haven't checked deeper, so it might be a leftover in the docu= mentation. > > The OperationRegion() has no reference to the EC (or in general, device)= which > we need to speak to. The only possibility to declare OpRegion() for the = second+ > EC is to use vendor specific RegionSpace, AFAIU. So, even if ACPI specif= ication > supports 2+ ECs, it doesn't support OpRegion():s for them under the same > RegionSpace. > > That said, the commit message might be extended to summarize this, but a= t > the same time I see no way how this series can break anything even in 2+= ECs > environments. Consider the following execution flow when the second EC probes: 1. acpi_install_address_space_handler_no_reg() fails with AE_ALREADY_EXIST= S since the first EC has already installed a handler at ACPI_ROOT_OBJECT. 2. ec_install_handlers() fails with -ENODEV. 3. acpi_ec_setup() fails with -ENODEV. 4. acpi_ec_add() fails with -ENODEV. 5. Probe of seconds EC fails with -ENODEV. This might cause problems if the second EC is supposed to for example hand= le EC query events. Of course if we only support a single EC, then this situation cannot happe= n. >> This patch would prevent any ACPI ECs other than the first one from pro= bing, >> since they would fail to register their address space handler. >> I am just curious if/how we want to handle such situations.