Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp847739imu; Mon, 5 Nov 2018 09:38:17 -0800 (PST) X-Google-Smtp-Source: AJdET5cq0hF9E4udj/otXLLOZ7pZS7q8JyGTbpVR9ZIST0P0l/Z3ueTR6K9T8dPfYxWmlTvajWV/ X-Received: by 2002:a63:5765:: with SMTP id h37mr9845586pgm.423.1541439497345; Mon, 05 Nov 2018 09:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541439497; cv=none; d=google.com; s=arc-20160816; b=AFhfeV/xf6NohFXK+jJ4NWmKrIdmNBGQnyO1i2hFX+KaHIbOkNJBw+gZH1x6ZNnkJG yd20LGTmX7ykFMvPx6wUfr4GMPoc5Q+E0RkjSjGOWgmGkdnsLr/gl85UIUxJEUkd49aA yM1H01Ra0cEzXeIi5iW49i1lXtJ01u5UZM2X8s6azD5ml42/Sy2AbL3WJKtzq7zJG2IN ud5oE5dQOM6Bs634lXJ4zR3Wa5FiAuRE6qWTAnokjDb4FBqWC81IwAOv+Ai9SDmjzGbR LkvC8UMf4bhE1HUSwcLBafWUjVSsVnJ3u8edAs3RHyD7LoSlAZhcY1JPvbiZ1fuCevlv XvRA== 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=CmDL61j9Q0XmwHY7U8caMpaen2wmzc9qlv5wDBgW9NM=; b=Z1b/1K4zpYSOY7UEF8zU40Tbx2T2o5LSs9F508EBQp3//XtWwoSSe1MS7xxd/TJpX/ lC4jdjeF07Nh58oWfS4sx4ADeuVNGrv7hvMZQv5hqbDxjDRcUN7uQlVIL4GrGzc1VGkr 8fil+uRPyenDlurVz1HtJaSm8ksnmzODTWH0T5oOg+EVmx38fVsstkUtH6/upPbQMDB1 +bOr+e0jFR5nzJXFm2hida9Djdp0PX2n+AIQhUvG2LWUgN8H4QSqusV9yYJse5U4KOv6 +kM0lNiZaATE4gkKaEAKkZbn6wIkVN8t96J+FZy6+HMzHghHDSHuzciibmu/auIuCu1b 41Rw== 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 d16-v6si44300986pgd.555.2018.11.05.09.38.01; Mon, 05 Nov 2018 09:38:17 -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 S2387678AbeKFC4w (ORCPT + 99 others); Mon, 5 Nov 2018 21:56:52 -0500 Received: from mga14.intel.com ([192.55.52.115]:46489 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387515AbeKFC4w (ORCPT ); Mon, 5 Nov 2018 21:56:52 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2018 09:36:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,468,1534834800"; d="scan'208";a="271544497" Received: from wenjiewa-mobl2.ccr.corp.intel.com (HELO localhost) ([10.249.254.60]) by orsmga005.jf.intel.com with ESMTP; 05 Nov 2018 09:35:58 -0800 Date: Mon, 5 Nov 2018 19:35:57 +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: <20181105173557.GF4502@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. Thanks for pointing this out. It very well might I have either 1. forgotten to do the switch. 2. had some open about it that I forgot to ask. Anyway, I'll check this and at minimum document the reason to the change log if there is one to keep the ioremap(). /Jarkko