Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35990659rwd; Mon, 10 Jul 2023 16:11:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlEF5v28e6FM3DNLzUKobsqYXsZkYSyECH5WYMmjVq1qsclMcUgugzvEElMe/A6C6tx0PvAv X-Received: by 2002:a05:6a20:4320:b0:118:e011:5e4c with SMTP id h32-20020a056a20432000b00118e0115e4cmr17735647pzk.57.1689030679920; Mon, 10 Jul 2023 16:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689030679; cv=none; d=google.com; s=arc-20160816; b=sFIbLgTIHAAD3m+gWTfXEdnc/K9cWF7tiO2GzqaJJIx1/BO04PgELHHq3Qzn6s82GO dkriyhDgr8KLZObqKXQq8RnB7JlR7wT72Me0YVYpPQ4OT8lx6sFTaxgQ45Xh6FnuTOQN ApjKv6JIUWDegIbvYTGwiinjdswaHM1jCsuSNCUDj0EzDkYq6nta23FI4kG0I67TsU2X jXiz7XdHA7uJXgWJjBXFUVNX0sTA2NA7P9dGlBu0/YKO1bcBGw0lOA1HJ7Kqm2yKPQ1T oW2nMgx7rZoIcWZSvIcZJcYjpB3UmpnQqlIUlG+nhnuYrzz/B6k8VYFD2dqGlTFEo/90 kkwA== 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=HI8k53mx6a+SBgFQ/f/qfSHWNve1uJ/xemrTchPlpS4=; fh=yJbEMzYo+UaEtwoc/S6jLu0YxvrrJh7sx4yhVtnSQvQ=; b=g5oHToK2zQf1S3XrBzVw/oTyYlScpbVqCLin8SS35xdCR8YGScuhsq9YKM2Fy6cYTu 2N56xXoTyTD9Tt5FwVBsTK5m9hmkpuie0WhMxO3IgJoFdXKWc1JPdGwImRe1+chbCsbD E5Gg9yTXajG1R/9fQ8vIMZwOA7cD6FTksui3gnQ5aDZAM3rmoQTdx1sqd+J17sMv1pdS YSb2eVb8Vy4Hao+BQGp/3ZXVyasQQYsGRT4pi8KSg4xB3NOv1qrllLh1WAzAWIYwrBed ucmH+8WfoArfC+VLaogF2rSx4PMpYJjxJUsSQcBko8D4flScUGSSPjjlVwEAI2UQk0CM yQ0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a0qf+l4D; 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 g11-20020a63520b000000b0054f993d7f29si341535pgb.563.2023.07.10.16.11.07; Mon, 10 Jul 2023 16:11:19 -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=a0qf+l4D; 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 S229564AbjGJWHH (ORCPT + 99 others); Mon, 10 Jul 2023 18:07:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGJWHG (ORCPT ); Mon, 10 Jul 2023 18:07:06 -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 6D288189; Mon, 10 Jul 2023 15:07:04 -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)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00D7D6121C; Mon, 10 Jul 2023 22:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D07CC433C7; Mon, 10 Jul 2023 22:07:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689026823; bh=JwxVQHx9gqapTMxUVVaLahra5zu3RExdERFNjdP9byA=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=a0qf+l4DrH31EyUiB9zNiZMT54ShRaVXPwmmZoTM79hfWzCb4kA2y6o70m86nh2M1 yDR3Y9zZRVI4Wh7uBV+rb6CnXo77wvaozUt8xGRu5OYcHHwwaZlWzokjgU0ZMzZp/E xN0tpMiiw5b1YK8xZPGP4iJfcCKyyYWLju5HtYU0AF6J0pH6qKV6EnzCI0Y/CS5kmt jQ4zSXK4KNVavdQcbkdYoD+FwAa3kaEy29YO1KlOrUdEK3bQll1Td8msDalavXp1TK ShG956GYf2ABBWuOUhNncwAWmjqMv7k2qJrHIipUq71xtUuRSvXYBqa/I39gT7A9hh kRZO19MIkmGvg== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 11 Jul 2023 01:06:59 +0300 Message-Id: Cc: , Subject: Re: [PATCH v3] 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: <20230710202845.190917-1-valentin.david@gmail.com> In-Reply-To: <20230710202845.190917-1-valentin.david@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 Mon Jul 10, 2023 at 11:27 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 > ``` > > Fixes: 4d2732882703 ("tpm_crb: Add support for CRB devices based on Pluto= n") > > Signed-off-by: Valentin David > --- > v3: Add fixes tag > --- > 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 Reviewed-by: Jarkko Sakkinen BR, Jarkko