From patchwork Tue Jan 8 22:30:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 155009 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp32942jaa; Tue, 8 Jan 2019 14:34:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN63EYT3/HQuVBJIUNvVbcl2tNdVQIKf9K8s3ELeWnhSXV3nHq5m2PDoPj5cY6cFHphAV9HV X-Received: by 2002:a5d:4dc8:: with SMTP id f8mr2914748wru.45.1546986887030; Tue, 08 Jan 2019 14:34:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546986887; cv=none; d=google.com; s=arc-20160816; b=yc8PZ9d3uAMnhAAGXRmKvBk4a+jLq7hBXHeeQF1Gmzl0kpEn2OjaZq28IMc+Q/5QTk oVj8e9cX/U7wOvshjQFLaSCy6ly3xwhdpE1xdXhXTUj/5q8/aN4rHSROlQA/ZfU73Xtd WQP3NcnL+F62jd4y8m9OUu5mbeMyF66bnpgXHIpBLYbN+DEXaSPg3D1C5+poiBMU/rf0 Ysnn5PwaV1ViDv4fF/2ZBEvw1ruSCYr89ofq/9L+Y9zutcN/h88AchXYAusDZh12jonE f4DU8+7KQVO7W1o+qFW/vDaqAeiRiBM+2i/pZDWhw8mtkPZ9iDaGr4jzpBtNm6rKLHIl oRwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=q39li6splH2Yf4gr+YNRn+Uk8lT+2zbq9YESKjSFOLY=; b=Av1/9dh18f41EH0mZgG0JO2zIlzmOaTw0zsvBERP20gz/k2ZJZLMvNzL9Ym+N0aWLA dDNE78OdaHeWr5p2vweRFaeqSNYbJxCU+Bg9J6U7ArIT4QOXj8s5DhxEmoyhcZUrl3v7 LfyCtj5lvGGbNldNXcOcqvd0D+1zRaRDIFxBzRHW8FM7BFHGjjj9JTlzXNV+3V2efu0f SkyBZj3cAddKVxBJHgw/05seqqW+PR+8WfSGtA0mjKoBpF1ihfDGBXVbVAdsNDnl1vLH cYYUvPz+pzcJzAIssXPMyxGdiodmr0kxNfxyHi8GsQsOf9JTCijQsDtzPYzA10i6W10O 92gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UF407mYg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i1si7435951wmg.3.2019.01.08.14.34.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 08 Jan 2019 14:34:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UF407mYg; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:39987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggzxN-00014z-VM for patch@linaro.org; Tue, 08 Jan 2019 17:34:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ggzuO-0007tl-Vy for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:31:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ggzuO-00046F-15 for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:31:40 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:38110) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ggzuN-00045D-Rt for qemu-devel@nongnu.org; Tue, 08 Jan 2019 17:31:39 -0500 Received: by mail-pl1-x643.google.com with SMTP id e5so2563135plb.5 for ; Tue, 08 Jan 2019 14:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q39li6splH2Yf4gr+YNRn+Uk8lT+2zbq9YESKjSFOLY=; b=UF407mYgQtMhHiVhNrNEL0XjYPW8fTAF5n3W5F6tLCwpty3DBYBgapu8SHrp1VrhmE 8Aoibud0z0rlbrkrMY8XucSh2lVpt13zRyxMOIA1X5KFlEJ43jp1x745BCI0CFrvNmka Pbw/EGNbIgSOl7WgJWSqJiKErT6Epsiny9XOw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=q39li6splH2Yf4gr+YNRn+Uk8lT+2zbq9YESKjSFOLY=; b=ISv1jp3LJFpEvMQsjMR/8YqVhomAMk9By7uJT/a2DPv9Qm+oWZYfJm1f8YcR+KCx43 jzT4NIpLb8imb6Ap10VhIwqtUWyDozO6umDs/uqJ0rIZpsr9xCk/9OkBBsOAvwjxr5w8 DFpXNQmMa6QXsPEZX9PpETC4IYF4hiGQrMlLAdZMkjykrGjFfYUInrF7U4eLLIrWxHbe ZLd/kdE7ZjeO6ML0h5+3qMaoxcISLqVdMPWqTW+IML24cB9BF1HqMykTc0aCVqOoF79w gthfnrEOGbBSQ5itIpGNrxZ/hxOUn4Uctq1h3LDDp2K/fQU9UjUa3pTnEYWc+hvSkqJQ RhQQ== X-Gm-Message-State: AJcUukcKtGFUYwXozyB0nKiy+IL/cB9KCd2UIdTmL/PQya3UHlCq/b+M 37l9MoLW+pLTRjp4zfh3IwBBmeKHCtg= X-Received: by 2002:a17:902:7296:: with SMTP id d22mr3640158pll.265.1546986698401; Tue, 08 Jan 2019 14:31:38 -0800 (PST) Received: from cloudburst.lan (2001-44b8-2176-c800-8cc6-2630-7d99-5ef1.static.ipv6.internode.on.net. [2001:44b8:2176:c800:8cc6:2630:7d99:5ef1]) by smtp.gmail.com with ESMTPSA id w128sm100686177pfw.79.2019.01.08.14.31.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 Jan 2019 14:31:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 9 Jan 2019 08:30:59 +1000 Message-Id: <20190108223129.5570-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190108223129.5570-1-richard.henderson@linaro.org> References: <20190108223129.5570-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::643 Subject: [Qemu-devel] [PATCH v3 01/31] target/arm: Add state for the ARMv8.3-PAuth extension X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Add storage space for the 5 encryption keys. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson ---- v2: Remove pointless double migration. Use a struct to make it clear which half is which. --- target/arm/cpu.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 6f606eb97b..8b891bbc30 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -201,11 +201,16 @@ typedef struct ARMVectorReg { uint64_t d[2 * ARM_MAX_VQ] QEMU_ALIGNED(16); } ARMVectorReg; -/* In AArch32 mode, predicate registers do not exist at all. */ #ifdef TARGET_AARCH64 +/* In AArch32 mode, predicate registers do not exist at all. */ typedef struct ARMPredicateReg { uint64_t p[2 * ARM_MAX_VQ / 8] QEMU_ALIGNED(16); } ARMPredicateReg; + +/* In AArch32 mode, PAC keys do not exist at all. */ +typedef struct ARMPACKey { + uint64_t lo, hi; +} ARMPACKey; #endif @@ -605,6 +610,14 @@ typedef struct CPUARMState { uint32_t cregs[16]; } iwmmxt; +#ifdef TARGET_AARCH64 + ARMPACKey apia_key; + ARMPACKey apib_key; + ARMPACKey apda_key; + ARMPACKey apdb_key; + ARMPACKey apga_key; +#endif + #if defined(CONFIG_USER_ONLY) /* For usermode syscall translation. */ int eabi; @@ -3264,6 +3277,21 @@ static inline bool isar_feature_aa64_fcma(const ARMISARegisters *id) return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, FCMA) != 0; } +static inline bool isar_feature_aa64_pauth(const ARMISARegisters *id) +{ + /* + * Note that while QEMU will only implement the architected algorithm + * QARMA, and thus APA+GPA, the host cpu for kvm may use implementation + * defined algorithms, and thus API+GPI, and this predicate controls + * migration of the 128-bit keys. + */ + return (id->id_aa64isar1 & + (FIELD_DP64(0, ID_AA64ISAR1, APA, -1) | + FIELD_DP64(0, ID_AA64ISAR1, API, -1) | + FIELD_DP64(0, ID_AA64ISAR1, GPA, -1) | + FIELD_DP64(0, ID_AA64ISAR1, GPI, -1))) != 0; +} + static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id) { /* We always set the AdvSIMD and FP fields identically wrt FP16. */