Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp589373pxa; Wed, 19 Aug 2020 09:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGRX4B/RK/PgmQVXbroJAe0VxtDBm3ezv4Ska8xEmciatHOwid86WzRxKkEcHT1O5hJLfI X-Received: by 2002:a17:906:ecf9:: with SMTP id qt25mr26727006ejb.478.1597854461248; Wed, 19 Aug 2020 09:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597854461; cv=none; d=google.com; s=arc-20160816; b=ClhpqhOXKluxMTKNVwA01mlRfeAveoH4KKtN7f9G+y5wL4BwB4swOPewRS/wZFKn4Q 4OsU70xfO3ddzzhRPybEeWD1aoePCd/EOyt3PZmK97Bjt6dY3uA2MEK1haiNqm9A0reR G4/0rh/x6usDWH65aC9GMRdDcn1OJZlzR4a5vfqtcwbhRUlMG/kt1MUG4AaWj2YciQvA NACbokBy+/85O9jZGk9axTr7vpw2EDFbLUeS9B4E8og08E9gzu+bCvEt5et13DcccbXG wmbhnH03L6l0XA+NzBr87M2WEZPJwHydb8Riw61yY6u8Z6V9kmZ7zHnCRCQ3qHtaq4gl 3Mcg== 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=K1juP4O56OpR+1pGnhU0wOY9m5Yds3UI4Ybc3g8AT94=; b=gyoKGY1HSp+aTvpUpthE2ppY1E4+6ldCNL7U2l2e0BLyHcxZ7OUBGqT4Pry9tXrisi KB6cjmQF4ynNTg6ohATYfYVQv7qzSewy5NAJ5Xz2jhkDxs9a/nSp6Tai93mdTZI6HzPk zuhzr48BIkMOr+X67NVL5lYk9TZ5hapo59K22pL0FOgsvlLnaohFPfx4lciVPHO2kfcT wan/eNKlvbTwtXJehE6DSKfs9kgDsqoWWoLsrNAWH4NMoJb3/QdpUWNxqxiczjNqEVOy 1L90tYhdMILfULkNwDo8HqNJUViYfPP5NnxoH42VDXGHaazTUwnzkHmaoXkcH7vU64NJ KBOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="XF/FOeN8"; 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 ch17si15463141ejb.627.2020.08.19.09.27.17; Wed, 19 Aug 2020 09:27:41 -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="XF/FOeN8"; 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 S1727069AbgHSQX7 (ORCPT + 99 others); Wed, 19 Aug 2020 12:23:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58462 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726973AbgHSQXm (ORCPT ); Wed, 19 Aug 2020 12:23:42 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 07JG1rX8005630; Wed, 19 Aug 2020 12:23:37 -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=K1juP4O56OpR+1pGnhU0wOY9m5Yds3UI4Ybc3g8AT94=; b=XF/FOeN8v7PK4DNs3MQDP3eP9tCMMgHxWH1l9q37pPHXfB3fOuAfH3+yHolodg5t+eVq xhQBB+4ChC1xOrDCQWNw+Uagq81HYn/bLEa71BfGelAdrUt8kfF0EgvElGhFjRF5B0wf OkcRNhevwliTdHoOTWaize1O1PrZoZz5ua2pOGzzITcmHl6Imqyn5SPiCkfQ7VeCnaDW CnhtERrg0TdXHMfTJHoD6Yyrpa1icOOzEj2TI+SUY+Fx7Sk32BYQWQ2GUBtXA+iPp8TP wF03sYji/KW9RpDi1o7JLVu98j/a9s53bobVZ8W+H3d2ZajaOI4d1+D3/vbzt7o0FMp5 JA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3304ruew8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 12:23:36 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 07JG1vxh005752; Wed, 19 Aug 2020 12:23:36 -0400 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3304ruew45-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 12:23:36 -0400 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 07JGGtcx019296; Wed, 19 Aug 2020 16:23:24 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma03fra.de.ibm.com with ESMTP id 3304c919t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 16:23:24 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 07JGNLX323527920 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Aug 2020 16:23:21 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB7175204E; Wed, 19 Aug 2020 16:23:21 +0000 (GMT) Received: from oc3016276355.ibm.com (unknown [9.145.33.131]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 28F2652051; Wed, 19 Aug 2020 16:23:21 +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 v9 2/2] s390: virtio: PV needs VIRTIO I/O device protection Date: Wed, 19 Aug 2020 18:23:18 +0200 Message-Id: <1597854198-2871-3-git-send-email-pmorel@linux.ibm.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1597854198-2871-1-git-send-email-pmorel@linux.ibm.com> References: <1597854198-2871-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-08-19_09:2020-08-19,2020-08-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=959 priorityscore=1501 suspectscore=1 phishscore=0 spamscore=0 impostorscore=0 adultscore=0 mlxscore=0 clxscore=1015 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008190133 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 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 --- arch/s390/Kconfig | 1 + arch/s390/mm/init.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 9cfd8de907cb..c12422c26389 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 6dc7c3b60ef6..8febd73ed6ca 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -45,6 +45,7 @@ #include #include #include +#include pgd_t swapper_pg_dir[PTRS_PER_PGD] __section(.bss..swapper_pg_dir); @@ -161,6 +162,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.25.1