Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35383400rwd; Mon, 10 Jul 2023 06:47:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlHazmWHFE2doCAlvGs7qu32yMpp3h2+dHNv5bkcC7GUQ0rg37oNVLwt8XCZu3cSetQROSay X-Received: by 2002:a05:6a21:328a:b0:12c:efd8:de4c with SMTP id yt10-20020a056a21328a00b0012cefd8de4cmr11989055pzb.18.1688996831799; Mon, 10 Jul 2023 06:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688996831; cv=none; d=google.com; s=arc-20160816; b=l/lx/OekAevQTYzoNw7GnsHxo96viyDfQ6UgR0oo1TjfOo9SkTtpZF+9VaJO4MtQjU atgmI07Miai0vxpaAbJN9w8w5hCU6jmy4vnkxMVfVSGyvZCBSRtEPFo2MfEAyr/KUiUM YTRd3i8ZguG8MCNquHafvlLsqmqllbUUXy3IswP639071sZ/pstJLMHZO/g+4lQXu8mi xNL8lgXEfslS+UKWKM8BurdcxvJANXEDc8RjpAyBYg8epHKt6+xgtbM6tu/OAoIRAxWF c6ExXb1MRqctfwenoHiJXtjMRJVBoA7OxmHd//1VsZVaVtXJiwrzXTBdUvhnwhIkwU9H jyow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:subject:cc :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=prJ1iDbBAzxbedzKTY+zGJhGoWcNyRCma0/8/mvyDOo=; fh=yJbEMzYo+UaEtwoc/S6jLu0YxvrrJh7sx4yhVtnSQvQ=; b=C94J+L6mwy9u9QwhUEOGV+15hLOVM1I18DCAKD2YzbgTsYTZr9AKY5rJKKy+1K4Hlo FgEanzYXodqKR3BkoUZN+NqHMUWMe/08Dg3Ini1j9evmgpttkIbxJz5Fm/DLzcULB9je HL068e7gS3hJ9TmFa8xJl+91/3xCsgt2kGweyt6OzQhPxYTBX/xgZJzC0QFX/Q31hrc1 X3Gl/gCHsoJYYVcZxKYH7yaDhSZ951z4tNioIx9Fkohc5jr5LNxoQrpW7MZllmqFGvOa leBb9sFIvAEV3peMVM3sfdiTHCr+ZiyAFAIiVJ80Vy8XIGLb6isYToElOmphYJJdMR1Q PQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j6KZ0TjP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s34-20020a056a0017a200b0064d545c8466si9683985pfg.287.2023.07.10.06.46.59; Mon, 10 Jul 2023 06:47:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=j6KZ0TjP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232891AbjGJNeb (ORCPT + 99 others); Mon, 10 Jul 2023 09:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232902AbjGJNeT (ORCPT ); Mon, 10 Jul 2023 09:34:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E20EE79; Mon, 10 Jul 2023 06:34:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D5BCF60FF4; Mon, 10 Jul 2023 13:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2E69C433C9; Mon, 10 Jul 2023 13:34:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1688996042; bh=pVxBdWCdEp7vxQUapSYR0qDalqiMWNMErASB1VrWpxY=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=j6KZ0TjPxiupJkKmZDpTjYR+37NUEKuymsUa5+2V3oBljnMLtuhg/gcWOnqaFh8xV IalhPYIHarTc0dTdmtRNIfQOU6BqDhzaTh5ETl6CJtdDHoMUg9eopON3armO3+K/ev 66Pymb56FSCH/hXvAfQoePjJDWgCPz+8mCFt+YfHIX1IRr06Sc3qSVLP+RRI57EFAp CAQZin/y4nJXJPPxXV3if4jiIFcwDWS2yQoYPpaT1cwtc2g3lJJTYV8k3Ll8/TQFhP vkVDQ7I+80+ZrKqkjh4ETa6MvAopekszQ3P7ck8QXiq9FqJmS4LrCbdEgB396z843g fnHr5GbhWu6hg== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 10 Jul 2023 16:33:58 +0300 Message-Id: Cc: , Subject: Re: [PATCH v2] tpm: Do not remap from ACPI resouces again for Pluton TPM From: "Jarkko Sakkinen" To: "Valentin David" , "Peter Huewe" , "Jason Gunthorpe" X-Mailer: aerc 0.14.0 References: <20230701153329.6476-1-valentin.david@gmail.com> <20230706191409.737080-1-valentin.david@gmail.com> In-Reply-To: <20230706191409.737080-1-valentin.david@gmail.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu Jul 6, 2023 at 10:13 PM EEST, Valentin David wrote: > For Pluton TPM devices, it was assumed that there was no ACPI memory > regions. This is not true for ASUS ROG Ally. ACPI advertises > 0xfd500000-0xfd5fffff. > > Since remapping is already done in `crb_map_pluton`, remapping again > in `crb_map_io` causes EBUSY error: > ``` > [ 3.510453] tpm_crb MSFT0101:00: can't request region for resource [me= m 0xfd500000-0xfd5fffff] > [ 3.510463] tpm_crb: probe of MSFT0101:00 failed with error -16 > ``` > > Signed-off-by: Valentin David Please add a fixes tag. > --- > v2: add missing sign-off in commit message > --- > drivers/char/tpm/tpm_crb.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c > index d43a0d7b97a8..1a5d09b18513 100644 > --- a/drivers/char/tpm/tpm_crb.c > +++ b/drivers/char/tpm/tpm_crb.c > @@ -563,15 +563,18 @@ static int crb_map_io(struct acpi_device *device, s= truct crb_priv *priv, > u32 rsp_size; > int ret; > =20 > - INIT_LIST_HEAD(&acpi_resource_list); > - ret =3D acpi_dev_get_resources(device, &acpi_resource_list, > - crb_check_resource, iores_array); > - if (ret < 0) > - return ret; > - acpi_dev_free_resource_list(&acpi_resource_list); > - > - /* Pluton doesn't appear to define ACPI memory regions */ > + /* > + * Pluton sometimes does not define ACPI memory regions. > + * Mapping is then done in crb_map_pluton > + */ > if (priv->sm !=3D ACPI_TPM2_COMMAND_BUFFER_WITH_PLUTON) { > + INIT_LIST_HEAD(&acpi_resource_list); > + ret =3D acpi_dev_get_resources(device, &acpi_resource_list, > + crb_check_resource, iores_array); > + if (ret < 0) > + return ret; > + acpi_dev_free_resource_list(&acpi_resource_list); > + > if (resource_type(iores_array) !=3D IORESOURCE_MEM) { > dev_err(dev, FW_BUG "TPM2 ACPI table does not define a memory resourc= e\n"); > return -EINVAL; > --=20 > 2.41.0 I don't see anything else to complain about. BR, Jarkko