Received: by 10.223.176.5 with SMTP id f5csp728261wra; Fri, 9 Feb 2018 06:19:15 -0800 (PST) X-Google-Smtp-Source: AH8x225V3hQACVeOt7ESOfDdqZkeBT4afjaee4SnamGTuaLJUjhKouzvPeJWyh8KIf7KOjJEoow8 X-Received: by 10.101.97.165 with SMTP id i5mr2508207pgv.55.1518185955049; Fri, 09 Feb 2018 06:19:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518185955; cv=none; d=google.com; s=arc-20160816; b=Ik72NM8N6kk6L8gEEw0pBzWz6ANEixdNQWLwYrui1ROYG8FRaoAzaNcpRbK7T4iTuz L6s4XDOKMHHzcgMv1+KO8F93u39Rc/fX0o5We3e6bzbttPcMjUnXiYxABh1ip5wKZbp4 mnCCpwmAf9ANdmJWAPdcIW3RVcmWgEDwHMC2VhYnowkL2B2bOlLaNQoz+lrtXweIuj5o j5Rdw820jidQAnbRLipBGqqvfHVSf++X7c2my5syOBMKkGgUaoKsDU6VZAuW5pU6AjAB cTJs0M1eJPSH//vW9n25dj9T2C0yBAHAZQ7Pwm8USqTM4OWLTZkRrF/f4o/3S9nrdMSz Evxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=BYSIzYMXyOnOTYT9wpBwi3MNMNz+O7IicWR7He7qxYY=; b=Y7QwROSUj+OwZ3KIfJZxRkAK+ddaJdMPwz0fcxJ+EAgmMxjiD7KthO15zu7xg5Yxgw J4ySQiW7vXUOiFuenx3XOC/IGB0zTqY829v0ItQ+A3CldYLku8LgIm3nM6ZeIGGJTFUS YzPuwHCIgQSELtlRpSrgOcofFPh39mLHTEpo0IUpNQf8eJDeZwS3xLaGjB1ZiTxOMS9d UQVOgq2y+Nu5c0QxCKF40srVReYDCEBSG2vziw5iG5OVUs2UZ0XRceHJio71A4rA59Qk 6+lGisjFmjS/ECR26OXD5XgZi/PYxmwqA4G1vMeclH4/wyhZ2oppcf+iOVytuu7jnAww dGig== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61-v6si1608734plz.417.2018.02.09.06.19.01; Fri, 09 Feb 2018 06:19:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751139AbeBINkg (ORCPT + 99 others); Fri, 9 Feb 2018 08:40:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48216 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750942AbeBINkf (ORCPT ); Fri, 9 Feb 2018 08:40:35 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6DAD8101B; Fri, 9 Feb 2018 13:40:34 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Neuling , Michael Ellerman , Balbir Singh Subject: [PATCH 4.9 01/92] powerpc/pseries: Add H_GET_CPU_CHARACTERISTICS flags & wrapper Date: Fri, 9 Feb 2018 14:38:30 +0100 Message-Id: <20180209133931.331247603@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180209133931.211869118@linuxfoundation.org> References: <20180209133931.211869118@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Neuling commit 191eccb1580939fb0d47deb405b82a85b0379070 upstream. A new hypervisor call has been defined to communicate various characteristics of the CPU to guests. Add definitions for the hcall number, flags and a wrapper function. Signed-off-by: Michael Neuling Signed-off-by: Michael Ellerman [Balbir fixed conflicts in backport] Signed-off-by: Balbir Singh Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/include/asm/hvcall.h | 17 +++++++++++++++++ arch/powerpc/include/asm/plpar_wrappers.h | 14 ++++++++++++++ 2 files changed, 31 insertions(+) --- a/arch/powerpc/include/asm/hvcall.h +++ b/arch/powerpc/include/asm/hvcall.h @@ -240,6 +240,7 @@ #define H_GET_HCA_INFO 0x1B8 #define H_GET_PERF_COUNT 0x1BC #define H_MANAGE_TRACE 0x1C0 +#define H_GET_CPU_CHARACTERISTICS 0x1C8 #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 #define H_QUERY_INT_STATE 0x1E4 #define H_POLL_PENDING 0x1D8 @@ -306,6 +307,17 @@ #define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE 3 #define H_SET_MODE_RESOURCE_LE 4 +/* H_GET_CPU_CHARACTERISTICS return values */ +#define H_CPU_CHAR_SPEC_BAR_ORI31 (1ull << 63) // IBM bit 0 +#define H_CPU_CHAR_BCCTRL_SERIALISED (1ull << 62) // IBM bit 1 +#define H_CPU_CHAR_L1D_FLUSH_ORI30 (1ull << 61) // IBM bit 2 +#define H_CPU_CHAR_L1D_FLUSH_TRIG2 (1ull << 60) // IBM bit 3 +#define H_CPU_CHAR_L1D_THREAD_PRIV (1ull << 59) // IBM bit 4 + +#define H_CPU_BEHAV_FAVOUR_SECURITY (1ull << 63) // IBM bit 0 +#define H_CPU_BEHAV_L1D_FLUSH_PR (1ull << 62) // IBM bit 1 +#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ull << 61) // IBM bit 2 + #ifndef __ASSEMBLY__ /** @@ -433,6 +445,11 @@ static inline unsigned long cmo_get_page } #endif /* CONFIG_PPC_PSERIES */ +struct h_cpu_char_result { + u64 character; + u64 behaviour; +}; + #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_HVCALL_H */ --- a/arch/powerpc/include/asm/plpar_wrappers.h +++ b/arch/powerpc/include/asm/plpar_wrappers.h @@ -340,4 +340,18 @@ static inline long plapr_set_watchpoint0 return plpar_set_mode(0, H_SET_MODE_RESOURCE_SET_DAWR, dawr0, dawrx0); } +static inline long plpar_get_cpu_characteristics(struct h_cpu_char_result *p) +{ + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; + long rc; + + rc = plpar_hcall(H_GET_CPU_CHARACTERISTICS, retbuf); + if (rc == H_SUCCESS) { + p->character = retbuf[0]; + p->behaviour = retbuf[1]; + } + + return rc; +} + #endif /* _ASM_POWERPC_PLPAR_WRAPPERS_H */