Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1770982imu; Tue, 6 Nov 2018 04:11:04 -0800 (PST) X-Google-Smtp-Source: AJdET5dpJicaiF2p7yUflu4vu3IGp3JRjW+dWUTXWh1c0VA/rWQXPMnW/fqaT6qJUDRwVST8v7Ad X-Received: by 2002:a17:902:7b93:: with SMTP id w19-v6mr11458436pll.80.1541506263972; Tue, 06 Nov 2018 04:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541506263; cv=none; d=google.com; s=arc-20160816; b=x17TrwT/Aa0gck5BC7YKRcMPiowqQQqmkMYRVHA48BclmxEdDrbf7WpR2FyD60OxgE pOtnk069YHX5ITrRvvm0vG5f8PpfqvcCHmqata3WyWX6O5CbRYkVulAAxW3jQt/VAh3f hUQAfr9SDArqcW3y0sbI4e94KFCW0MrLfZldgJxW+YsLdiN1JcSYZ7CvLvb5zg9QT6p+ Png/JjGaELwv1XQ7L7Y23coaB8/QlHs3hYEYO3+JGqZxtQi4tbEapeniwrRXffM8u/M8 ekTvrw0pS3IEYzv50HrSwjO0MUY11mRlg/28IdRFzxsDXelKR/kvLN30SviBn7ym7Y1n FpVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tlYBa8fnT2PuzESWFkwVcKMu/DE23jK+iqdAbsfwXiA=; b=tajpTHXV95Bli6AocHlYvsXr6q6S9Ph03qFcyJp12vXqeILqOUJ1SVLZ9C1NuRxezp U9y9x1o5vrUyd7+Hf3psrbyIeRODCJrr2+M8gam83Qvd20jWyrNGdm7xiN6Zigrh74dv CBwfTQ+u//P9W6RlAv+WQ/ZtZ+xQpcY5PeYbdVzoLMhp5/1CEGXkTDMrLwKk2jKhasNH g3TH5JlN0ZATEsUObSC/MS+Tt+6+x13PX+CdWtVfwX30gq5xkCA9VQqVQ2RJxRNGWe59 i12pJqBBA1VsTdCPw0o/bslGWnj+ij1xHyvWrz83TP3fI2aURbA5Z6uMOcfBGU6I/dri jY1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si31377936plh.157.2018.11.06.04.10.49; Tue, 06 Nov 2018 04:11:03 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388035AbeKFVfW (ORCPT + 99 others); Tue, 6 Nov 2018 16:35:22 -0500 Received: from mga02.intel.com ([134.134.136.20]:62411 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387454AbeKFVfW (ORCPT ); Tue, 6 Nov 2018 16:35:22 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Nov 2018 04:10:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,471,1534834800"; d="scan'208";a="247391838" Received: from btyborox-mobl.ger.corp.intel.com (HELO localhost) ([10.249.254.134]) by orsmga004.jf.intel.com with ESMTP; 06 Nov 2018 04:10:17 -0800 Date: Tue, 6 Nov 2018 14:10:16 +0200 From: Jarkko Sakkinen To: Andy Shevchenko Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Platform Driver , linux-sgx@vger.kernel.org, Dave Hansen , sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, haitao.huang@intel.com, mark.shanahan@intel.com, Andy Shevchenko , suresh.b.siddha@intel.com, Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Reinette Chatre , "Rafael J. Wysocki" , "Kirill A. Shutemov" , Linux Kernel Mailing List Subject: Re: [PATCH v15 16/23] x86/sgx: Enumerate and track EPC sections Message-ID: <20181106121016.GA12789@linux.intel.com> References: <20181102231320.29164-1-jarkko.sakkinen@linux.intel.com> <20181102231320.29164-17-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Nov 03, 2018 at 03:22:34PM +0200, Andy Shevchenko wrote: > On Sat, Nov 3, 2018 at 1:17 AM Jarkko Sakkinen > wrote: > > > > From: Sean Christopherson > > > > Enumerate Enclave Page Cache (EPC) sections via CPUID and add the data > > structures necessary to track EPC pages so that they can be allocated, > > freed and managed. As a system may have multiple EPC sections, invoke > > CPUID on SGX sub-leafs until an invalid leaf is encountered. > > > > On NUMA systems, a node can have at most one bank. A bank can be at > > most part of two nodes. SGX supports both nodes with a single memory > > controller and also sub-cluster nodes with severals memory controllers > > on a single die. > > > > For simplicity, support a maximum of eight EPC sections. Current > > client hardware supports only a single section, while upcoming server > > hardware will support at most eight sections. Bounding the number of > > sections also allows the section ID to be embedded along with a page's > > offset in a single unsigned long, enabling easy retrieval of both the > > VA and PA for a given page. > > > + iounmap(section->va); > > > + section->va = ioremap_cache(addr, size); > > + if (!section->va) > > + return -ENOMEM; > > I forgot if it's a place in code on which we discussed ioremap() vs. > memremap() call. > And I forgot why the conclusion is to leave ioremap(). > > Sorry, if I'm mistaken. As far as I can tell you are not mistaken. It happened that in the patch set version that you gave this comment I first the fixed missing __iomem annotations because I like to do other changes on top of code that has no known regressions. Then I guess I simply forgot to replace it with memremap(). I will do it for the next version. /Jarkko