Received: by 2002:ab2:60d1:0:b0:1f7:5705:b850 with SMTP id i17csp1050541lqm; Thu, 2 May 2024 04:00:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBo7NWZGgKC+d79chdblU/8ZD+BH1porux1cbhHiucem5CcDzhc2Qzw7J2hxNE1aLMN9OxfyDcM96R+23tXfnqTrgtz5x2Aa+wZMiiqA== X-Google-Smtp-Source: AGHT+IEXoH0izI0+kNY7oVqR0r2N69JqSdaIy5F+nuA3BWcBiEfQou+d+cJDkENCLHvHmIxnh4e4 X-Received: by 2002:a17:902:f541:b0:1e3:c610:597d with SMTP id h1-20020a170902f54100b001e3c610597dmr6168863plf.60.1714647628309; Thu, 02 May 2024 04:00:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714647628; cv=pass; d=google.com; s=arc-20160816; b=QFyLfHoBAUMepFQCzsa1ifgASmNUsJYRYAOZqLtYGk0y3W3//qqZ/MZc+CA8cB8eij ZU2OI1g8XwWkMa+O0KZ+GU7vfYYj3nAcQsrPbbW44NDyDnYGse3pIkG2EPv/zx4SRxnb xbJrdVqzU/BiA7wOTukgIPmAz29DSn0zEmnY5kFGeaHOddOjlo6Guayui0YBxkHMnc7r SlsBc/vO2pEtXWnQBUClwVfhOMhqdYtHg8gBxXssNEKikAmOiSZDM9XwYRFrxVEYjcSE sggKSfHJQ8BxtLQdhOZdVtsiAR/V8S/bBsCYs+dWssNjCYXR7vKeuf9e0w8KK03fvbLw 5yqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=hHF+gRyhRIrK2WUCWEz9eEjUFbM1vQ/hSb38ZvRDtR8=; fh=a7kCZ+k0zAe704XWDEgdHExq2ZvUrYGmRi9KGI58Srk=; b=TaeLX7SJnrhguoDtVaa2+z5bjqJSYyHyjYB9Q1veE2fJ2H/dlvKNcjkxTHARHHTj8B jSOQwC9Vpfkcc/n10//TOzIxE1Lj0txRZwpAwTHL+ivcvbNQoRk5f9dvQGlnz6iyLkVg A+4fOXJOiBe8bIH5zw1sKReyO4uNReo9DvfRhbPQTOhKe7Ez6fXtl58ldyPo1BHgouzF f/e7cFNOoF4aAE5Pb+MISRAhJvzEtVXRILwc9UoGEvZzRLVCgRiWpsJoI/6jOJCC7Rjn FCv4sIHJCZh713IQ0LXd+HSotlz2iPVO+yDlMyrgVCSYvRtF5SbeNKqeUGGteLW4FDiT GjLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YylKf3Ma; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-166357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b1-20020a170903228100b001eb74a5e037si781862plh.367.2024.05.02.04.00.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 May 2024 04:00:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-166357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YylKf3Ma; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-166357-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-166357-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id A31C0B21BFB for ; Thu, 2 May 2024 10:59:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2ECFD604CE; Thu, 2 May 2024 10:59:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YylKf3Ma" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4BDCA54BCF; Thu, 2 May 2024 10:59:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714647558; cv=none; b=BT4OJH8V4/gr148D2zRLatDwxv522QUcv5lvBbWcC+WH5PvIZe9BhTAa8HCcbjH5qkvQBy4yNHaq5ltnQ7iTcpFaZZDVG8LcbFR1FSk1xLrNa8jqRCCAyY3igTrLJLJSxce6Pn00AKjVOYv2v3Cn+HXRbo+6ifNBiZLGxXKUh0o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714647558; c=relaxed/simple; bh=Y5YX9kg+ODGEoBN60bkL/He4nPO4DwUsWL3sBMIgIQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AE7jqPaSqyN8QCKpaTAK92610y2y93RYl4PtrDz9vOhP8oh0Ihm6YDIIXLU7kd6HtXdjbE4exAN9enc/LuoCwASrUqJicBYVtr56Pyx+6h1ooyYtotEqhzRAM9kvxPA4qKTTmrzsZbi/URdbU3ZAZoU7Du2Venqx35pH25uF7to= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YylKf3Ma; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714647557; x=1746183557; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y5YX9kg+ODGEoBN60bkL/He4nPO4DwUsWL3sBMIgIQ8=; b=YylKf3Manl4mv3Zjx+XQBjXhoh+/jfCeE3zGQHR7pAhY44MKRIf6ipw/ IEaWnXHCxPOChPgdazjdrzvD7wzVzVs5ZOxo2jkwXfq7VNWvb1E3HrnCJ uEAhly1XqQnV6DVFE1IfjoNCEIb8+UPxlHps6uxnFs0gbUcPHEk1P9OmZ dcUZKU0iZ33nJa7M9so9aFNSdOoNriNCcD5hyw0PNsVinqrwgZyWJ2pkh p4U4aLMdJDCzSzEBNhfu2v/NC6m0iNYZIUekUbmp0eq9diuT3j0lqcSr5 hJ1ulMppTi7T8S+7wraRtFT3oNg2EC0jcCvbTpWyuJvW1PLvOHQTUS8P9 g==; X-CSE-ConnectionGUID: LXMe54JJQVWYqii7EGrvPg== X-CSE-MsgGUID: 8AnAb2CqRiGwwRwBGp6Rtg== X-IronPort-AV: E=McAfee;i="6600,9927,11061"; a="14228558" X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="14228558" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 03:59:16 -0700 X-CSE-ConnectionGUID: u7ce1+ubTFqyGopPfYt/pA== X-CSE-MsgGUID: vvoLsr5cS9uqc6tHscOMBQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,247,1708416000"; d="scan'208";a="50278870" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.251.208.210]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 May 2024 03:59:11 -0700 From: Adrian Hunter To: linux-kernel@vger.kernel.org Cc: "Chang S. Bae" , Masami Hiramatsu , Nikolay Borisov , Borislav Petkov , Ingo Molnar , "H. Peter Anvin" , Dave Hansen , Thomas Gleixner , x86@kernel.org, Arnaldo Carvalho de Melo , Jiri Olsa , Namhyung Kim , Ian Rogers , linux-perf-users@vger.kernel.org Subject: [PATCH 01/10] x86/insn: Add Key Locker instructions to the opcode map Date: Thu, 2 May 2024 13:58:44 +0300 Message-Id: <20240502105853.5338-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240502105853.5338-1-adrian.hunter@intel.com> References: <20240502105853.5338-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit From: "Chang S. Bae" The x86 instruction decoder needs to know these new instructions that are going to be used in the crypto library as well as the x86 core code. Add the following: LOADIWKEY: Load a CPU-internal wrapping key. ENCODEKEY128: Wrap a 128-bit AES key to a key handle. ENCODEKEY256: Wrap a 256-bit AES key to a key handle. AESENC128KL: Encrypt a 128-bit block of data using a 128-bit AES key indicated by a key handle. AESENC256KL: Encrypt a 128-bit block of data using a 256-bit AES key indicated by a key handle. AESDEC128KL: Decrypt a 128-bit block of data using a 128-bit AES key indicated by a key handle. AESDEC256KL: Decrypt a 128-bit block of data using a 256-bit AES key indicated by a key handle. AESENCWIDE128KL: Encrypt 8 128-bit blocks of data using a 128-bit AES key indicated by a key handle. AESENCWIDE256KL: Encrypt 8 128-bit blocks of data using a 256-bit AES key indicated by a key handle. AESDECWIDE128KL: Decrypt 8 128-bit blocks of data using a 128-bit AES key indicated by a key handle. AESDECWIDE256KL: Decrypt 8 128-bit blocks of data using a 256-bit AES key indicated by a key handle. The detail can be found in Intel Software Developer Manual. Signed-off-by: Chang S. Bae Reviewed-by: Dan Williams Signed-off-by: Adrian Hunter --- arch/x86/lib/x86-opcode-map.txt | 11 +++++++---- tools/arch/x86/lib/x86-opcode-map.txt | 11 +++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/arch/x86/lib/x86-opcode-map.txt b/arch/x86/lib/x86-opcode-map.txt index 12af572201a2..c94988d5130d 100644 --- a/arch/x86/lib/x86-opcode-map.txt +++ b/arch/x86/lib/x86-opcode-map.txt @@ -800,11 +800,12 @@ cb: sha256rnds2 Vdq,Wdq | vrcp28ss/d Vx,Hx,Wx (66),(ev) cc: sha256msg1 Vdq,Wdq | vrsqrt28ps/d Vx,Wx (66),(ev) cd: sha256msg2 Vdq,Wdq | vrsqrt28ss/d Vx,Hx,Wx (66),(ev) cf: vgf2p8mulb Vx,Wx (66) +d8: AESENCWIDE128KL Qpi (F3),(000),(00B) | AESENCWIDE256KL Qpi (F3),(000),(10B) | AESDECWIDE128KL Qpi (F3),(000),(01B) | AESDECWIDE256KL Qpi (F3),(000),(11B) db: VAESIMC Vdq,Wdq (66),(v1) -dc: vaesenc Vx,Hx,Wx (66) -dd: vaesenclast Vx,Hx,Wx (66) -de: vaesdec Vx,Hx,Wx (66) -df: vaesdeclast Vx,Hx,Wx (66) +dc: vaesenc Vx,Hx,Wx (66) | LOADIWKEY Vx,Hx (F3) | AESENC128KL Vpd,Qpi (F3) +dd: vaesenclast Vx,Hx,Wx (66) | AESDEC128KL Vpd,Qpi (F3) +de: vaesdec Vx,Hx,Wx (66) | AESENC256KL Vpd,Qpi (F3) +df: vaesdeclast Vx,Hx,Wx (66) | AESDEC256KL Vpd,Qpi (F3) f0: MOVBE Gy,My | MOVBE Gw,Mw (66) | CRC32 Gd,Eb (F2) | CRC32 Gd,Eb (66&F2) f1: MOVBE My,Gy | MOVBE Mw,Gw (66) | CRC32 Gd,Ey (F2) | CRC32 Gd,Ew (66&F2) f2: ANDN Gy,By,Ey (v) @@ -814,6 +815,8 @@ f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) | WRSSD/Q My, f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) f9: MOVDIRI My,Gy +fa: ENCODEKEY128 Ew,Ew (F3) +fb: ENCODEKEY256 Ew,Ew (F3) EndTable Table: 3-byte opcode 2 (0x0f 0x3a) diff --git a/tools/arch/x86/lib/x86-opcode-map.txt b/tools/arch/x86/lib/x86-opcode-map.txt index 12af572201a2..c94988d5130d 100644 --- a/tools/arch/x86/lib/x86-opcode-map.txt +++ b/tools/arch/x86/lib/x86-opcode-map.txt @@ -800,11 +800,12 @@ cb: sha256rnds2 Vdq,Wdq | vrcp28ss/d Vx,Hx,Wx (66),(ev) cc: sha256msg1 Vdq,Wdq | vrsqrt28ps/d Vx,Wx (66),(ev) cd: sha256msg2 Vdq,Wdq | vrsqrt28ss/d Vx,Hx,Wx (66),(ev) cf: vgf2p8mulb Vx,Wx (66) +d8: AESENCWIDE128KL Qpi (F3),(000),(00B) | AESENCWIDE256KL Qpi (F3),(000),(10B) | AESDECWIDE128KL Qpi (F3),(000),(01B) | AESDECWIDE256KL Qpi (F3),(000),(11B) db: VAESIMC Vdq,Wdq (66),(v1) -dc: vaesenc Vx,Hx,Wx (66) -dd: vaesenclast Vx,Hx,Wx (66) -de: vaesdec Vx,Hx,Wx (66) -df: vaesdeclast Vx,Hx,Wx (66) +dc: vaesenc Vx,Hx,Wx (66) | LOADIWKEY Vx,Hx (F3) | AESENC128KL Vpd,Qpi (F3) +dd: vaesenclast Vx,Hx,Wx (66) | AESDEC128KL Vpd,Qpi (F3) +de: vaesdec Vx,Hx,Wx (66) | AESENC256KL Vpd,Qpi (F3) +df: vaesdeclast Vx,Hx,Wx (66) | AESDEC256KL Vpd,Qpi (F3) f0: MOVBE Gy,My | MOVBE Gw,Mw (66) | CRC32 Gd,Eb (F2) | CRC32 Gd,Eb (66&F2) f1: MOVBE My,Gy | MOVBE Mw,Gw (66) | CRC32 Gd,Ey (F2) | CRC32 Gd,Ew (66&F2) f2: ANDN Gy,By,Ey (v) @@ -814,6 +815,8 @@ f6: ADCX Gy,Ey (66) | ADOX Gy,Ey (F3) | MULX By,Gy,rDX,Ey (F2),(v) | WRSSD/Q My, f7: BEXTR Gy,Ey,By (v) | SHLX Gy,Ey,By (66),(v) | SARX Gy,Ey,By (F3),(v) | SHRX Gy,Ey,By (F2),(v) f8: MOVDIR64B Gv,Mdqq (66) | ENQCMD Gv,Mdqq (F2) | ENQCMDS Gv,Mdqq (F3) f9: MOVDIRI My,Gy +fa: ENCODEKEY128 Ew,Ew (F3) +fb: ENCODEKEY256 Ew,Ew (F3) EndTable Table: 3-byte opcode 2 (0x0f 0x3a) -- 2.34.1