Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp612241imm; Wed, 26 Sep 2018 04:12:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60U6H3hwfM0H9Rbjeo6OcKVJ7ii74S1JDXYHMe9KjaxL02u3kASux1Xh7Af+HuvERq8Y3Y9 X-Received: by 2002:a62:b0e:: with SMTP id t14-v6mr5768979pfi.36.1537960366821; Wed, 26 Sep 2018 04:12:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537960366; cv=none; d=google.com; s=arc-20160816; b=xWjyWJBZa1L71Iu2HfddwOCSn4tr5glU06Z4g35WugoSOQDQEhVnieJszcP3/AxlDx vGP7RUuUxKEv7XGHXbDZEgyqZp53npm6yngpimpYhZ/Q0XDT2O1FbKK/1s2fi7pZyYEX rr3kKz7iYooMUP9fcAiaItARtdLEGyqqVbaBlC0A8qvyU8bh14KKf19WIQ4cmcSPLDVK lFBc+i12LUMfEFOnLeTdDaKa1XGdpbrmaroaVQuvOcQd7pz0+Eq5BckSMr+rPNpKUkka SgO9FdoSiYfkMSfDSs3ifhyxUfSoH2oOQfHi2+Ez8Vyp79nVRjI4NDt19IiHXkvTgBYH ahUg== 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=7BTtQH8DUMRuCzFcwXKXaM1lpS2XTlbAXhUOa0B6vSU=; b=dgeNz/S5nywMm3tNLrZQztei3AiObMv7uyiT6hIVY3ZdrmgDhzz9Qhxu7yb/sDq4cA W2gqI+8/siLuS2DQJYc6IoNw/VNXSZhnjso0shuzUCIhpRsuXA1XFUoh04se4dYhxTW+ Y6xuxH5EyKNaCuHGXRPeLRLJZWsgau8ghNCWrun195xt1VFNQOKMxxh02mUYT7dyRXix qSNBC0OnGVqledryCK183KxdjpQxavzTJvsjSW4FNm5V/XoE/x5fJc3qtwnwVBUA9uLD 7KUgPRkmLAuW0kE1ogxd9MatSiCupQ+mYd9NVLHSJnGQo26KdBr3WfIHWeyfA2FhGUWY Ox7w== 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 l63-v6si4668989pgd.598.2018.09.26.04.12.30; Wed, 26 Sep 2018 04:12:46 -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; 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 S1727722AbeIZRYR (ORCPT + 99 others); Wed, 26 Sep 2018 13:24:17 -0400 Received: from mga02.intel.com ([134.134.136.20]:16864 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726595AbeIZRYR (ORCPT ); Wed, 26 Sep 2018 13:24:17 -0400 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; 26 Sep 2018 04:11:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,306,1534834800"; d="scan'208";a="236057646" Received: from imahmed1-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.50.69]) by orsmga004.jf.intel.com with ESMTP; 26 Sep 2018 04:11:40 -0700 Date: Wed, 26 Sep 2018 14:11:39 +0300 From: Jarkko Sakkinen To: Borislav Petkov Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, serge.ayoun@intel.com, shay.katz-zamir@intel.com, linux-sgx@vger.kernel.org, andriy.shevchenko@linux.intel.com, Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Konrad Rzeszutek Wilk , David Woodhouse , David Wang , "Kirill A. Shutemov" , "Levin, Alexander (Sasha Levin)" , Jia Zhang , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH v14 04/19] x86/cpufeatures: Add SGX feature bits Message-ID: <20180926111139.GA12037@linux.intel.com> References: <20180925130845.9962-1-jarkko.sakkinen@linux.intel.com> <20180925130845.9962-5-jarkko.sakkinen@linux.intel.com> <20180925164854.GF23986@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180925164854.GF23986@zn.tnic> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo 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 Tue, Sep 25, 2018 at 06:48:54PM +0200, Borislav Petkov wrote: > > + eax = cpuid_eax(SGX_CPUID); > > + > > + if (eax & _X86_FEATURE_SGX1) > > + set_cpu_cap(c, X86_FEATURE_SGX1); > > + > > + if (eax & _X86_FEATURE_SGX2) > > + set_cpu_cap(c, X86_FEATURE_SGX2); > > + > > + if (eax & _X86_FEATURE_SGX_ENCLV) > > + set_cpu_cap(c, X86_FEATURE_SGX_ENCLV); > > + > > + if (eax & _X86_FEATURE_SGX_ENCLS_C) > > + set_cpu_cap(c, X86_FEATURE_SGX_ENCLS_C); > > > Look at arch/x86/kernel/cpu/scattered.c for how to do this properly. Thank you. I guess I understand what you want me to do i.e. + { X86_FEATURE_SGX1, CPUID_EAX, 0, 0x00000012, 0 }, + { X86_FEATURE_SGX2, CPUID_EAX, 1, 0x00000012, 0 }, + { X86_FEATURE_ENCLV, CPUID_EAX, 5, 0x00000012, 0 }, + { X86_FEATURE_ENCLS_C, CPUID_EAX, 6, 0x00000012, 0 }, What puzzles me is that I cannot find any call site for get_scattered_cpuid_leaf(): $ git grep get_scattered arch/x86/kernel/cpu/cpu.h:extern u32 get_scattered_cpuid_leaf(unsigned int level, arch/x86/kernel/cpu/scattered.c:u32 get_scattered_cpuid_leaf(unsigned int level, unsigned int sub_leaf, arch/x86/kernel/cpu/scattered.c:EXPORT_SYMBOL_GPL(get_scattered_cpuid_leaf); /Jarkko