Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp672221lqo; Fri, 10 May 2024 11:01:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWXknPi9ZACW66fM+oY3jnrxdxgwDXZHcnODnfA7z7UF/xxFAO/WIr0yma42fZUqC7ejAoldIybDmRaUuL9rsE9fehTO7K3MLlxHmELxw== X-Google-Smtp-Source: AGHT+IH/1xr6HNzNLEdC4c1jTDt/WIBeQY1hG5m3TNoJbKFpI4ep26f5pBId78TiDyTiW0qbFKOi X-Received: by 2002:aca:1104:0:b0:3c9:6c1f:64f8 with SMTP id 5614622812f47-3c997067ea1mr3372644b6e.33.1715364077809; Fri, 10 May 2024 11:01:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715364077; cv=pass; d=google.com; s=arc-20160816; b=txWceZGXnoPqVXHoewYQM2280aLobCahZM+haMs/N7YAFLOZpIs+cd1t8TuvgIurD0 W+OyY93LN8OgJS8bY6n+DS2IMgpRmETCky34AhCQYVjefMR+K8i5DLO6Op6wizzeHbqh m2ND+uOu7rayLjZMUSKSW9UOpmrHdcnpTGaRVdal9ZffO5yrtUiOAIBRLV+jtSS2BYmg Wtl6/hDJauRHP9QtW+6VmQbFUC7kyYhal9Dip4J53j9473A7pTB7rdp1N7kL4z0/Xmw7 7hQ/glCMU0ue77RY1wYCLUgP9WUzkfoCkXtVVApsARuQ5c4M3MjBcil5YIwTWYyAUy79 T9SA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=v9uctJVOcCNbBvCrKgG1a+8S50VDj5LmtHhmNaf7BqI=; fh=LETtw+hQNX0FQN+blZz47MUIn5Idbg1CgBouAeTj2tg=; b=xTGDBR90l4hNpOjEowkXkf8pVfZSVTMt8xFJvNgK5C71Bd4i8BIBeobawltfmcMwIV GVwFByS14Z6nQgeT6XJohoUDbHnPwChhHE3ieyYDVuSDA6hHxmxMkrZxuv6vSC4ndpyI HqkcqFExJoTLK3blDHIJzTRyy3ZgOFSw1Qfk39BlvgjzXvBswZOTXvJSgnJKGzQI1Lv1 7giQ3wX56YdTrlrhGX+R1Sbxo3VN+ZheolcbpH5/8BKLQjKUq9P8dlD28qCe9MVTf7wR GUfXhfzctx65wtK7Y9KZ+/VQpnvqwB61qHzPQV3Dn5XvcEc1TjB1sJ4BJutoA72NjT3d Xpbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dHOSuOGc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2b682bsi40231526d6.330.2024.05.10.11.01.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 11:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dHOSuOGc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 74E401C21444 for ; Fri, 10 May 2024 18:01:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE124224FD; Fri, 10 May 2024 18:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dHOSuOGc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F1927182C3; Fri, 10 May 2024 18:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715364070; cv=none; b=T08QFvTJ61ohH58+9CjOGk/k90NgSrJ8QgOMyNNYwG+eK6mzRFFOIrxRPSp4PuaX+ZJvLTD50IOy0oujeMgdhgm6SfMW1MFJA3KzH0wEWIEplLdxsvIJSNnaznNkNGKjA3ifXdIGCXBieYzLl3j24mG6U9IxOcAznzMH5KjsF78= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715364070; c=relaxed/simple; bh=s5ik5p4oyGVznfPViE0HOJRAYlX1f0xzznl1M2KmICc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=KO6711YBKVHG3flbuuocmbXrvKgnNeQ6BP6cQ54BdDYqBUiM9/oZi68knDlXrZ6ipP6AHStELuSBOIXpIEomVvF6z4SY4UW/WjEldLvUaFPWoJvS3HPW02ZTrpytxiUvUiMjZY2/itAohdZ32wK7Cmm2BrvkWrDvHgodhT52aJQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dHOSuOGc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7634EC32783; Fri, 10 May 2024 18:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715364069; bh=s5ik5p4oyGVznfPViE0HOJRAYlX1f0xzznl1M2KmICc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=dHOSuOGcjSMLUBk4OGaPgzR1AzzYjLgLpcJihdGJLZ6V5YBWKA36ja43qkVRmbH6K qUSkyDHH4HG/M4TMjcvuWf6jHtdlTGywIJ9bha956hsEZ8I6aukppx6VwnAXFpDa6h /kn/9TPJROUBe5E39BQGShoa8x0hCzxyCGkWZvoyZbHpfRHC/lj8ruPUz28KxIjWoy a//BS7YsD+G/r3W+Yr1uenw+51Tw3Se5dHHf3Rq8wIsP6hHKM4kgIH9Mb47N9jnSGb IeXzQG2vxBwQTfkU+Ps9xYuEZo8kK66Hw0Lsa03vraYRMSSF/TkmuRqrVPo/iCkL6a hKgy9jVXRalmw== Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5b209a2c390so319118eaf.1; Fri, 10 May 2024 11:01:09 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUwfnB4bFnTUl6dV9AQQ7dgcWt4tO2tpYXb4hymHpZAsOl1HtirOI7G0n+sAJSw0xtnu7o8xDH1plrvFjHXVCmcFkK67xOqdvTupvo0aniYKJ5WlIAoGsLyhtgn0zCtmgwthXtz15ibbg== X-Gm-Message-State: AOJu0YyW8ZEpl3hbeLUShcmB1wF53z33xiGTZAYFMWruDmt2Llmu9j/U JWoyFAdHIK6JXBzwuqB9kwK1UHieVuEn14TQFsr2V8drItB3+m0LYVmC2ETJDx+2bC/hFyxcdRr d1tFhtNGP9XszTTIwfy7nDPcgaAs= X-Received: by 2002:a4a:d692:0:b0:5b2:f29:93f0 with SMTP id 006d021491bc7-5b2815e3c4dmr3690279eaf.0.1715364068757; Fri, 10 May 2024 11:01:08 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <5787281.DvuYhMxLoT@kreacher> <4926735.31r3eYUQgx@kreacher> <568291fc-fd79-4f08-9eb7-aed7f5a32345@gmx.de> <22937f20-93fd-4ae2-a5cb-31e5a477ac37@gmx.de> In-Reply-To: <22937f20-93fd-4ae2-a5cb-31e5a477ac37@gmx.de> From: "Rafael J. Wysocki" Date: Fri, 10 May 2024 20:00:57 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v1 1/2] ACPI: EC: Install address space handler at the namespace root To: Armin Wolf Cc: Andy Shevchenko , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux ACPI , LKML , Hans de Goede , Mario Limonciello , Heikki Krogerus Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, May 10, 2024 at 7:39=E2=80=AFPM Armin Wolf wrote: > > 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 w= rote: > >>>> 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 Len= ovo > >>>>> IdeaPad Pro 5 due to a missing address space handler for the EC add= ress > >>>>> space: > >>>>> > >>>>> ACPI Error: No handler for Region [ECSI] (000000007b8176ee) [Em= beddedControl] (20230628/evregion-130) > >>>>> > >>>>> This happens because the EC driver only registers the EC address sp= ace > >>>>> handler for operation regions defined in the EC device scope of the > >>>>> ACPI namespace while the operation region being accessed by the _DS= M > >>>>> in question is located beyond that scope. > >>>>> > >>>>> To address this, modify the ACPI EC driver to install the EC addres= s > >>>>> 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 mult= iple > >>>> 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 mo= re than > >> one ACPI EC device. > > The specification is clear about this case in the "ACPI Embedded Contro= ller > > 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 doc= umentation. > > > > 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 speci= fication > > supports 2+ ECs, it doesn't support OpRegion():s for them under the sam= e > > RegionSpace. > > > > That said, the commit message might be extended to summarize this, but = at > > 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_EXIS= TS 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 han= dle EC query events. > Of course if we only support a single EC, then this situation cannot happ= en. This is kind of moot though until a system with 2 ECs is available. It is hard to say whether or not it is supported until it can be tested.