Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3059851pxk; Mon, 28 Sep 2020 07:26:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1w28BdA7CYIcUywxOEdlWV+5v+peBvQgQ3VjfbQy57KHB6aaApSafSNO9upcIHXxTX9tO X-Received: by 2002:a50:f081:: with SMTP id v1mr2129614edl.161.1601303191801; Mon, 28 Sep 2020 07:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601303191; cv=none; d=google.com; s=arc-20160816; b=MtJwaaHyrCFDqwQI8j9RudYecsXCxdZMah4bFviYE4n7a/Xn25T/HR6PjbdIvkDCxK L5Kq86MYWLSD+j/gHz7apUhNAxQ/HhToWd3n5x6kgkCWjMxflLvjwrptfFJW4GdeKhGF /09qGUkTbAGfmhQIgKz82RDRxI3mzEjw9NY1JFCssmC1Blb3m7MlHsQcsxsCCLKOSyTa A3I09gCZx3Gpili4c+GH1QggktAxhgAeGf2DAOfvWOulsB+HEAAKY5MHWmrVfVGw11tX fzGMy3E7FZBTpmUfL6yB9YBK8xdvZVPNs6vQ/VDypzPR1IstXqCk+AdcKYnxnTEeXtU+ 2WKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=w2L7IXw6H9Vmzm62wwHtbhr248qcQlsYiwJaT+6UuJA=; b=srUyicxHUIKkXuUgvGKHbQJ2IL9G9pTAU1CWu0xrfBKsDe+KEeA4xZtc9lCk/O8VQL UDbUJ9VudYAtmYaP+kyV1qV2OpEVV8ZvEPJQUiE5GB8M1QrjMKEsODL/2HrxCZAAKSy/ A+sMtc9oNY+8v19FPMt1gRLJbHU77tt6lPXIP4g9TFjj5jZ0R3fbDKJKcPWy8PY/WWrr /Jtn6LAdDSJHvCHyozM7dBPnPmAInBz2ET933sWInM4CpwGYJd/Y15Jw86OTVCeEs0TN 7d5CK8R9uq2jV4+zJai4yQ3wEOCIRG4Lwa3bdEt1l0wWa38ydH+o+YjpCjAGC6P+lz99 z9hA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bw3si725350ejb.515.2020.09.28.07.26.08; Mon, 28 Sep 2020 07:26:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbgI1OXF (ORCPT + 99 others); Mon, 28 Sep 2020 10:23:05 -0400 Received: from mga04.intel.com ([192.55.52.120]:42270 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726325AbgI1OXF (ORCPT ); Mon, 28 Sep 2020 10:23:05 -0400 IronPort-SDR: wGEzRi1fMh39GIt3WIW6Pr7Z4lzVW7ypVEINpU9r/GXZhG9M6jsm2xcabLP9pRKpiDCykZ/8kb fnYileett1qA== X-IronPort-AV: E=McAfee;i="6000,8403,9757"; a="159380168" X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="159380168" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 07:09:57 -0700 IronPort-SDR: YHKFCeCMdY+V43id/m9w5v+iLoHJB+6rsO9/fuI+9KrFSlgtL8srMAz2VH3zvDGshvmrjsrV+h IF8kcM28ZpTw== X-IronPort-AV: E=Sophos;i="5.77,313,1596524400"; d="scan'208";a="514269821" Received: from schuethe-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.34.214]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 07:09:54 -0700 Date: Mon, 28 Sep 2020 17:09:55 +0300 From: Jarkko Sakkinen To: Ard Biesheuvel Cc: Christophe Leroy , Jason Gunthorpe , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linux-integrity , "open list:LINUX FOR POWERPC (32-BIT AND 64-BIT)" , Peter Huewe , Linux Kernel Mailing List Subject: Re: [PATCH] tpm: of: avoid __va() translation for event log address Message-ID: <20200928140955.GA70098@linux.intel.com> References: <20200922094128.26245-1-ardb@kernel.org> <20200925055626.GC165011@linux.intel.com> <20200925102920.GA180915@linux.intel.com> <20200925120018.GH9916@ziepe.ca> <20200927234434.GA5283@linux.intel.com> <9be9c7e7-c424-d241-2255-ad854221bd2e@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 28, 2020 at 08:20:18AM +0200, Ard Biesheuvel wrote: > On Mon, 28 Sep 2020 at 07:56, Christophe Leroy > wrote: > > > > > > > > Le 28/09/2020 ? 01:44, Jarkko Sakkinen a ?crit : > > > On Fri, Sep 25, 2020 at 09:00:18AM -0300, Jason Gunthorpe wrote: > > >> On Fri, Sep 25, 2020 at 01:29:20PM +0300, Jarkko Sakkinen wrote: > > >>> On Fri, Sep 25, 2020 at 09:00:56AM +0200, Ard Biesheuvel wrote: > > >>>> On Fri, 25 Sep 2020 at 07:56, Jarkko Sakkinen > > >>>> wrote: > > >>>>> > > >>>>> On Tue, Sep 22, 2020 at 11:41:28AM +0200, Ard Biesheuvel wrote: > > >>>>>> The TPM event log is provided to the OS by the firmware, by loading > > >>>>>> it into an area in memory and passing the physical address via a node > > >>>>>> in the device tree. > > >>>>>> > > >>>>>> Currently, we use __va() to access the memory via the kernel's linear > > >>>>>> map: however, it is not guaranteed that the linear map covers this > > >>>>>> particular address, as we may be running under HIGHMEM on a 32-bit > > >>>>>> architecture, or running firmware that uses a memory type for the > > >>>>>> event log that is omitted from the linear map (such as EfiReserved). > > >>>>> > > >>>>> Makes perfect sense to the level that I wonder if this should have a > > >>>>> fixes tag and/or needs to be backported to the stable kernels? > > >>>>> > > >>>> > > >>>> AIUI, the code was written specifically for ppc64, which is a > > >>>> non-highmem, non-EFI architecture. However, when we start reusing this > > >>>> driver for ARM, this issue could pop up. > > >>>> > > >>>> The code itself has been refactored a couple of times, so I think it > > >>>> will require different versions of the patch for different generations > > >>>> of stable kernels. > > >>>> > > >>>> So perhaps just add Cc: , and wait and see how > > >>>> far back it applies cleanly? > > >>> > > >>> Yeah, I think I'll cc it with some note before the diffstat. > > >>> > > >>> I'm thinking to cap it to only 5.x kernels (at least first) unless it is > > >>> dead easy to backport below that. > > >> > > >> I have this vauge recollection of pointing at this before and being > > >> told that it had to be __va for some PPC reason? > > >> > > >> Do check with the PPC people first, I see none on the CC list. > > >> > > >> Jason > > > > > > Thanks, added arch/powerpc maintainers. > > > > > > > As far as I can see, memremap() won't work on PPC32 at least: > > > > IIUC, memremap() calls arch_memremap_wb() > > arch_memremap_wb() calls ioremap_cache() > > In case of failure, then ioremap_wt() and ioremap_wc() are tried. > > > > All ioremap calls end up in __ioremap_caller() which will return NULL in case you try to ioremap RAM. > > > > So the statement "So instead, use memremap(), which will reuse the linear mapping if > > it is valid, or create another mapping otherwise." seems to be wrong, at least for PPC32. > > > > Even for PPC64 which doesn't seem to have the RAM check, I can't see that it will "reuse the linear > > mapping". > > > > It is there, please look again. Before any of the above happens, > memremap() will call try_ram_remap() for regions that are covered by a > IORESOURCE_SYSTEM_RAM, and map it using __va() if its PFN is valid and > it is not highmem. > > So as far as I can tell, this change has no effect on PPC at all > unless its RAM is not described as IORESOURCE_SYSTEM_RAM. Any chance for someone to test this on PPC32? /Jarkko