Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3084262pxk; Mon, 7 Sep 2020 02:42:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1lDcE4BtS5SWpxCeUsb5/E6Ckek1yp28YW8o++1r2qv+AHa5BP3wcPVkq+tG60/VQn8Uv X-Received: by 2002:aa7:c053:: with SMTP id k19mr16737222edo.326.1599471766709; Mon, 07 Sep 2020 02:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599471766; cv=none; d=google.com; s=arc-20160816; b=XFUc9zST17tNv35N8ArME1iPFb4WWjl1dNGm+Er3zHz0S4oeby0gz5X/0z9WCE4Z66 FK1gPuK8AI/7oVc3DazR9EucPVdUDEKEVqbJe0UBRwtCsKeWXLCBSeiSPgAbrcmjMsiW Ow6quejUiMpIJCF62mNhnLse8rh0NMvoYKvJ7pfOZYuAY0zd6e0w5UzdoE6xpbmneF15 LJ+qSs7Om1VcrCaMTA4idUWFVpFBK7HHUN7f7fYQAPxkG9dZef0e1uAe8w9pNJjQhP5l 3WNrALKWpt+RasT9lEm0Di6tZCkfk2BK11iMwGpOg4Vbmrrrtqvfkp7oH3bZekfQ/Nzl yfvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=iEi2PpCpW1XTh73eAFdMmNwr+VxQ34mxDVTwMiiEGSs=; b=K0kr+/A6j8n2jNVyc4HBpJqEbTVw1NaSVt4ouQStbpWXBCv/pMFngVpBNIGAT9S/eT WbB2lRSRhKDDZ15ArOyfWyUld5nitnaEb+28BvEy8gTk2KAGZ8Pbo14Q32XJkNoDw9Mx b9IbMsuboZPagTo5rXdcSdZI1Cv54jYsp0qTPg0vJwl3vKhZApStXPp4kJv73iKInN86 zbLKwxv1fD/ig43xpBVyJE/a2IiUlbTt5SybyO3Ajzb3yMFFi+4S+3Jqh9/pTUbhbLLx rAhreaY9tPXaA2fvBhQopuaDSr35LW2f/I3MIYsVgoAQlDSYO8P61PlxVFmMPYBFLKWN HMUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Wzpn72Fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si10419032ejm.633.2020.09.07.02.42.24; Mon, 07 Sep 2020 02:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Wzpn72Fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728505AbgIGJjb (ORCPT + 99 others); Mon, 7 Sep 2020 05:39:31 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:31396 "EHLO mx0b-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728362AbgIGJj3 (ORCPT ); Mon, 7 Sep 2020 05:39:29 -0400 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0879WOUR162479; Mon, 7 Sep 2020 05:39:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=iEi2PpCpW1XTh73eAFdMmNwr+VxQ34mxDVTwMiiEGSs=; b=Wzpn72Fo+3Da0BhEZYl1nHHA+nza3T6p5ZAF1daIwt+dyWY4196FxxOAJN0XbIVb7QAd tTTlpAUtzo7vERe55hzAEAFun66OrcW62tQG6lRYpc+7dnWwYfrkt/GCwSFwq1SRu4ow 8Joxo2usSQebhK+DJMualzsyr7obdtJjFvQ43cb+DGQ5Ys82qbJOo5ghJTdvEmLO5zst BgWPVbscZMrGAeUIj2FlsLWr7jYkVoVgB5gSMUSnxMXScQCLHMm7FuijzOM/vkZKCn4Q 1B2erEtEBm6RQhlEnpsIMm1Nt00pq3/ha7J2I0ty6JSviRF7rOKaL22l/3kC/mw17ySN 1w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 33dhnrh85w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Sep 2020 05:39:18 -0400 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0879WZ6p163168; Mon, 7 Sep 2020 05:39:17 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 33dhnrh84d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Sep 2020 05:39:17 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0879cjrJ009706; Mon, 7 Sep 2020 09:39:15 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma04fra.de.ibm.com with ESMTP id 33cm5hgwjj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 07 Sep 2020 09:39:14 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0879dCMt30998946 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 Sep 2020 09:39:12 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC999A4062; Mon, 7 Sep 2020 09:39:11 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F360A405B; Mon, 7 Sep 2020 09:39:11 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.86.222]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 7 Sep 2020 09:39:11 +0000 (GMT) From: Pierre Morel To: linux-kernel@vger.kernel.org Cc: pasic@linux.ibm.com, borntraeger@de.ibm.com, frankja@linux.ibm.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, kvm@vger.kernel.org, linux-s390@vger.kernel.org, virtualization@lists.linux-foundation.org, thomas.lendacky@amd.com, david@gibson.dropbear.id.au, linuxram@us.ibm.com, hca@linux.ibm.com, gor@linux.ibm.com Subject: [PATCH v11 2/2] s390: virtio: PV needs VIRTIO I/O device protection Date: Mon, 7 Sep 2020 11:39:07 +0200 Message-Id: <1599471547-28631-3-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1599471547-28631-1-git-send-email-pmorel@linux.ibm.com> References: <1599471547-28631-1-git-send-email-pmorel@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-09-07_04:2020-09-07,2020-09-07 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 mlxlogscore=999 spamscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 adultscore=0 clxscore=1015 mlxscore=0 suspectscore=1 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009070093 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If protected virtualization is active on s390, VIRTIO has only retricted access to the guest memory. Define CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS and export arch_has_restricted_virtio_memory_access to advertize VIRTIO if that's the case, preventing a host error on access attempt. Signed-off-by: Pierre Morel Reviewed-by: Cornelia Huck --- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index b29fcc66ec39..938246200d39 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -820,6 +820,7 @@ menu "Virtualization" config PROTECTED_VIRTUALIZATION_GUEST def_bool n prompt "Protected virtualization guest support" + select ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS help Select this option, if you want to be able to run this kernel as a protected virtualization KVM guest. diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 0d282081dc1f..f40b9b63d3d6 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -160,6 +160,16 @@ bool force_dma_unencrypted(struct device *dev) return is_prot_virt_guest(); } +#ifdef CONFIG_ARCH_HAS_RESTRICTED_VIRTIO_MEMORY_ACCESS + +int arch_has_restricted_virtio_memory_access(void) +{ + return is_prot_virt_guest(); +} +EXPORT_SYMBOL(arch_has_restricted_virtio_memory_access); + +#endif + /* protected virtualization */ static void pv_init(void) { -- 2.17.1