From patchwork Wed Jun 29 15:37:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffen Eiden X-Patchwork-Id: 12900317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F27C0C433EF for ; Wed, 29 Jun 2022 15:37:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 49E3D8E000B; Wed, 29 Jun 2022 11:37:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 44F698E0009; Wed, 29 Jun 2022 11:37:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2EE8B8E000B; Wed, 29 Jun 2022 11:37:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1F57C8E0009 for ; Wed, 29 Jun 2022 11:37:50 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id D421A120966 for ; Wed, 29 Jun 2022 15:37:49 +0000 (UTC) X-FDA: 79631678658.06.9D99CC3 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf24.hostedemail.com (Postfix) with ESMTP id 3CED4180031 for ; Wed, 29 Jun 2022 15:37:49 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 25TFME8n018538; Wed, 29 Jun 2022 15:37:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=pp1; bh=gCllJp/av1A6ZU7E969OL9N50tPZz7C4Q38xnV/jwn8=; b=MwWj9WcU5SbDBpfvMLlAniuKFJlKAv9D9zdfsCNM+YOt/CAHjChhsG6xP/ryTn9+gcQE JB0Ol2SY6lkn3V2qPxZ95oumbOa5c2xBO0FvvmPzUS6c0GWtpKl0qniT6z1wx/r2YMRS /XTJ9abOV4Zt44XSDOnBCfWFInuO3OD84jtvqVTyHk1vWtNnjElsr6cGmVe1SXohyHJe 6f1Wxd48JhBdxqwUNZSRVVlP8Jva6TMi0rgGLYgh9IRPwY+hA8WdkMk3/2B+K+YbVPqH 8LAd3dwa1+dbTw1T+y+U5BDqtaVco9Xft+7kgO84Y0kDKQkqa3DMd6Br6GP7OBEoISK0 Pg== Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3h0sarrmg6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jun 2022 15:37:48 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 25TFaJct025865; Wed, 29 Jun 2022 15:37:46 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04fra.de.ibm.com with ESMTP id 3gwt0951u0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 29 Jun 2022 15:37:46 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 25TFbnF331064364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 29 Jun 2022 15:37:49 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94EEB4C040; Wed, 29 Jun 2022 15:37:42 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3992C4C044; Wed, 29 Jun 2022 15:37:42 +0000 (GMT) Received: from a46lp73.lnxne.boe (unknown [9.152.108.100]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 29 Jun 2022 15:37:42 +0000 (GMT) From: Steffen Eiden To: Heiko Carstens , Alexander Gordeev , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Vasily Gorbik , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: nrb@linux.ibm.com Subject: [RFC PATCH] s390: Autoload uvdevice module based on CPU feature Date: Wed, 29 Jun 2022 17:37:41 +0200 Message-Id: <20220629153741.195789-1-seiden@linux.ibm.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: pJ64-rQTM0yw2XlnM4ICE4faMVNyowst X-Proofpoint-GUID: pJ64-rQTM0yw2XlnM4ICE4faMVNyowst X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-06-29_17,2022-06-28_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxlogscore=999 malwarescore=0 impostorscore=0 phishscore=0 spamscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 mlxscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2206290056 ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MwWj9WcU; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf24.hostedemail.com: domain of seiden@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=seiden@linux.ibm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656517069; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=gCllJp/av1A6ZU7E969OL9N50tPZz7C4Q38xnV/jwn8=; b=pPJ6B2UUoOB1ZiBnrjjDVBrPGtFYBEPAewKS6y+CNwv0KXreF6dS+ApLKcMXmGXLs1kqpP qwoabd+e1FLf5zEIX/JxvCbN6CdZI5Xzss5cKvAsq9ySO3dTeFY6qrtWPeEGo9sq0iujQX ljxkBMf4EMXjVG6vskbmaq3iYILE7LI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656517069; a=rsa-sha256; cv=none; b=intGfEhSVa80lSAlSM1LucDQ1sVt7PbXKoPrIeKqgsdYu7ml+08IRISGbWKxoVZoBcT0TH PdcMZIrH3TGcXZKhTxDJNTHvGbd5tLRnye//iflZ3GSX0k+kxoJRhuBZpE7585rOza6K0Z SpdyJwIOCWjmAyHwLJKXnteWTHknaE8= X-Stat-Signature: 4askyd6fx7rgdcjemgiccs9ac5ksjw86 X-Rspamd-Queue-Id: 3CED4180031 X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=MwWj9WcU; dmarc=pass (policy=none) header.from=ibm.com; spf=pass (imf24.hostedemail.com: domain of seiden@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=seiden@linux.ibm.com X-Rspamd-Server: rspam12 X-HE-Tag: 1656517069-204367 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With this patch the uvdevice will be automatically loaded when the facility 158 is present. This is accomplished by using ``module_cpu_feature_match`` and adding HWCAP_UV connected to to facility 158. Signed-off-by: Steffen Eiden --- arch/s390/include/asm/elf.h | 2 ++ arch/s390/kernel/processor.c | 5 +++++ drivers/s390/char/uvdevice.c | 5 ++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index 70a30ae258b7..3a5e89ce4fd0 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h @@ -115,6 +115,7 @@ enum { HWCAP_NR_NNPA = 20, HWCAP_NR_PCI_MIO = 21, HWCAP_NR_SIE = 22, + HWCAP_NR_UV = 23, HWCAP_NR_MAX }; @@ -142,6 +143,7 @@ enum { #define HWCAP_NNPA BIT(HWCAP_NR_NNPA) #define HWCAP_PCI_MIO BIT(HWCAP_NR_PCI_MIO) #define HWCAP_SIE BIT(HWCAP_NR_SIE) +#define HWCAP_UV BIT(HWCAP_NR_UV) /* * These are used to set parameters in the core dumps. diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c index aa0e0e7fc773..3ca528cb3819 100644 --- a/arch/s390/kernel/processor.c +++ b/arch/s390/kernel/processor.c @@ -141,6 +141,7 @@ static void show_cpu_summary(struct seq_file *m, void *v) [HWCAP_NR_NNPA] = "nnpa", [HWCAP_NR_PCI_MIO] = "pcimio", [HWCAP_NR_SIE] = "sie", + [HWCAP_NR_UV] = "uv", }; int i, cpu; @@ -249,6 +250,10 @@ static int __init setup_hwcaps(void) if (sclp.has_sief2) elf_hwcap |= HWCAP_SIE; + /* IBM Secure Execution (Ultravisor) support */ + if (test_facility(158)) { + elf_hwcap |= HWCAP_UV; + return 0; } arch_initcall(setup_hwcaps); diff --git a/drivers/s390/char/uvdevice.c b/drivers/s390/char/uvdevice.c index 66505d7166a6..fddbfc1e27a2 100644 --- a/drivers/s390/char/uvdevice.c +++ b/drivers/s390/char/uvdevice.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -244,12 +245,10 @@ static void __exit uvio_dev_exit(void) static int __init uvio_dev_init(void) { - if (!test_facility(158)) - return -ENXIO; return misc_register(&uvio_dev_miscdev); } -module_init(uvio_dev_init); +module_cpu_feature_match(UV, uvio_dev_init); module_exit(uvio_dev_exit); MODULE_AUTHOR("IBM Corporation");