Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp683397ybl; Fri, 30 Aug 2019 05:44:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHYpSgI67zbGgOi0IT+abobEOHXSGgOjQ4H5abXvAFBf21+/m8yVr9LYgDVm9qMycHUdiC X-Received: by 2002:aa7:8a0a:: with SMTP id m10mr18415112pfa.100.1567169092353; Fri, 30 Aug 2019 05:44:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567169092; cv=none; d=google.com; s=arc-20160816; b=MRo1ckOaS//49llK8+4CNVx04AxAvbrBaVGCwspipzpMbI3yXTSw0Qq4U58ddBLxh5 CMxTCbLZMujk6dHmKr0pwccMcT4Ay+vdVSCzeIhXTM7mQQx81+eFia5bBYBckseVx6YH 61BrY4Su/NXTD8airFH6/tPYAZ8c7kg7mA8059R7AOd9t1YhuizqZHxeetNO7jkH2dt5 IUIhlq6eo9npzy5zixCNQQcBnQiLyeRnlzxa9WFD18n1+39nfkqhzVqD1KOsSBMbQTTC pPHy/BPrHC57KSC61d7X4aENjGqdeJFvNsalhCFoj/3ltxRcc1Z6R6Y9+RjWtJWpfI8F kHfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3ZitNgFXrdayf4EBPMRNk2dQMSxsOg5aQdjNQBrLxV0=; b=BiYjjw9AQa+Ic6V/kEf566KaUFQGV5krgvD3Jdr0D3tyxNuN7XX8jelA2C1Nzhv8DT xzMgStaUD/G5pjk1baGAgqGGXbybUNGZJ4wktCQzi4hOLkklP7ltwklk96dYFZIBWLm/ D7WWel3OUNtmanADfAm2MGiW7EMhkCHCoNEHPulvw9hzMen09+Sy8i3tmkgizjIV+/JJ 7H+Ie8a+rUenG12i9A92F99LSSjV5aEZ08RbZWRlkFABSsYvLq/zlsA9EtAiGepra8NT hB9BSX2/r1XNCojABDuvhncrEhPIexZm2SF9G4kGW4gaH9PuNfTR9D+krQoVKl5WHRIi sMAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=O3LIh1Vn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si5677452pfo.1.2019.08.30.05.44.36; Fri, 30 Aug 2019 05:44:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=O3LIh1Vn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728029AbfH3Mng (ORCPT + 99 others); Fri, 30 Aug 2019 08:43:36 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:38360 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727603AbfH3Mng (ORCPT ); Fri, 30 Aug 2019 08:43:36 -0400 Received: by mail-qt1-f195.google.com with SMTP id b2so3936938qtq.5 for ; Fri, 30 Aug 2019 05:43:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=3ZitNgFXrdayf4EBPMRNk2dQMSxsOg5aQdjNQBrLxV0=; b=O3LIh1VnGlkPOZRjsHo4nMuWtoEGAiQRYYoD6NNlNcGuu0FBYUlVYR6rh1cRtKftVu bT0oSnDd+W+W9nEf4LCrq0Z6XgY6fv2097uMGoIARrHecLnNcbEfoTF5tNdkG4mKMTyh d3qBjBhPbET10i0VH4df7MtHrExDfBIk8ELqFSBsx0Vgzq4SH/+xhTaobO1jGFgWOlxO 2HPbu/l6Z6CCz+aMERDdMW3DXnp3MNiwVFPSdQoKWx4kiExb8Yu0RA7iLKFMKMcofpvT J253asUJtCWT6ATk/krqzemDRS4bnNEU3czn+uiR1hCHPsDh0ouB8YywBj2f4MR7mKkW grBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=3ZitNgFXrdayf4EBPMRNk2dQMSxsOg5aQdjNQBrLxV0=; b=jirltCO4Rz6r+daFZ9zA3HEOl2axF0PRmcY7+iVCPqP/byBnowOIRZM2Sj3wovoeAD Ccfig2s/Vtw8qjKVDrMPudCWY8nG6Wjj+hb5AGR5wIcgH2WFbudNCrF0yUskTSF8r8uL Wk5wp91h7CmkrJysGgrECZaUYAlCHA2EFkLuS4UU9dbowVRSOdw2E1I3XPn4KsCZkP/u wajfIa7dmymLZUygyn0Psn06Rtam/sw4K/LBr5TneKHi25B2rqbagARFDKznOTmJAC41 6iXIhe0TQvonVwoBPc9qlrkhk8ZBBE5EF5UIrqug55mVUvFczsyQNXr19YSmUoHNHVgf dljg== X-Gm-Message-State: APjAAAUtRq1OUI4OAlnYZKHMpnpwQ3JMX2PmMFh8hLdyUbv7dZbHeFVe agyIw9o3JAQW3TvslMa7bHaySg== X-Received: by 2002:ac8:478b:: with SMTP id k11mr15016996qtq.323.1567169015108; Fri, 30 Aug 2019 05:43:35 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-167-216-168.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.167.216.168]) by smtp.gmail.com with ESMTPSA id d134sm2141239qkg.133.2019.08.30.05.43.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 30 Aug 2019 05:43:34 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1i3gFa-0003Cg-4Q; Fri, 30 Aug 2019 09:43:34 -0300 Date: Fri, 30 Aug 2019 09:43:34 -0300 From: Jason Gunthorpe To: Seunghun Han Cc: Jarkko Sakkinen , Peter Huewe , "open list:TPM DEVICE DRIVER" , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] tpm: tpm_crb: enhance resource mapping mechanism for supporting AMD's fTPM Message-ID: <20190830124334.GA10004@ziepe.ca> References: <20190830095639.4562-1-kkamagui@gmail.com> <20190830095639.4562-3-kkamagui@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190830095639.4562-3-kkamagui@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 30, 2019 at 06:56:39PM +0900, Seunghun Han wrote: > I got an AMD system which had a Ryzen Threadripper 1950X and MSI > mainboard, and I had a problem with AMD's fTPM. My machine showed an error > message below, and the fTPM didn't work because of it. > > [  5.732084] tpm_crb MSFT0101:00: can't request region for resource > [mem 0x79b4f000-0x79b4ffff] > [  5.732089] tpm_crb: probe of MSFT0101:00 failed with error -16 > > When I saw the iomem, I found two fTPM regions were in the ACPI NVS area.  > The regions are below. > > 79a39000-79b6afff : ACPI Non-volatile Storage > 79b4b000-79b4bfff : MSFT0101:00 > 79b4f000-79b4ffff : MSFT0101:00 > > After analyzing this issue, I found that crb_map_io() function called > devm_ioremap_resource() and it failed. The ACPI NVS didn't allow the TPM > CRB driver to assign a resource in it because a busy bit was set to > the ACPI NVS area. > > To support AMD's fTPM, I added a function to check intersects between > the TPM region and ACPI NVS before it mapped the region. If some > intersects are detected, the function just calls devm_ioremap() for > a workaround. If there is no intersect, it calls devm_ioremap_resource(). > > Signed-off-by: Seunghun Han > --- > drivers/char/tpm/tpm_crb.c | 25 +++++++++++++++++++++++-- > 1 file changed, 23 insertions(+), 2 deletions(-) This still seems to result in two drivers controlling the same memory. Does this create bugs and races during resume? Jason