From nobody Sun May 19 06:04:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1655357878; cv=none; d=zohomail.com; s=zohoarc; b=TSuNld7uOOVtkzfBP8W4qM+vTnbKT/9jGTFVwYD0nkHJaa9rkkNXDBVb9zPfwtQMT6KZuPyS6LPB040c499wP98b8Z0KSRHdazdiJRbIsz9y+3gScb5jqn2JD05KzlaDd7JmgNpKgCWMD8g8/ycpTUgQoanZCAinySktS2y5mHU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655357878; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=dts+yl7uUGQYgHpGD+VRq8p1wRFkW3OYpt27WoT5mBw=; b=bbrN54czFNMhi5SZ/sGqpPFzSKeV0G/dnlkNTgaZwVbxllHoMpJDCBVBfXKq+vGB8KbnDekBZIzmLUFLNfxZTtcVYGyyTZ0WzuP/TAvTsGasjvt+V/Q/pFxs+3EMf92sQ24aUa9dlQz4QNIdfSHa+L6fiJyVvKYwetYaRqLuREU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655357878195808.6399115652557; Wed, 15 Jun 2022 22:37:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.350408.576750 (Exim 4.92) (envelope-from ) id 1o1iC7-0000YR-Pm; Thu, 16 Jun 2022 05:37:27 +0000 Received: by outflank-mailman (output) from mailman id 350408.576750; Thu, 16 Jun 2022 05:37:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o1iC7-0000YK-L2; Thu, 16 Jun 2022 05:37:27 +0000 Received: by outflank-mailman (input) for mailman id 350408; Thu, 16 Jun 2022 05:37:26 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o1iC6-0000YE-Lj for xen-devel@lists.xenproject.org; Thu, 16 Jun 2022 05:37:26 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 65c10bbd-ed36-11ec-bd2c-47488cf2e6aa; Thu, 16 Jun 2022 07:37:25 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EEB6221BC3; Thu, 16 Jun 2022 05:37:22 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B8DAE139C4; Thu, 16 Jun 2022 05:37:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PojHK5LBqmKVRwAAMHmgww (envelope-from ); Thu, 16 Jun 2022 05:37:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 65c10bbd-ed36-11ec-bd2c-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655357842; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=dts+yl7uUGQYgHpGD+VRq8p1wRFkW3OYpt27WoT5mBw=; b=Wx6s/9DMRIBUq5O2Ke+thHwBX/osV+aWHUpiZvIt+G+IFpLzMjvbRDuj/MJ050pNFTctl4 8dE8pXdY3hRNQ0SbDIBUrxQXzeDaHSrwPiWsXhR6K0w0nwLIfI2c4YaTL8lAgab2z9P8Ij zoMmc13vZ8d1+vQZkTY/g1lOkI6qGa8= From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: viresh.kumar@linaro.org, hch@infradead.org, Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Subject: [PATCH v2] xen: don't require virtio with grants for non-PV guests Date: Thu, 16 Jun 2022 07:37:15 +0200 Message-Id: <20220616053715.3166-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1655357880848100001 Content-Type: text/plain; charset="utf-8" Commit fa1f57421e0b ("xen/virtio: Enable restricted memory access using Xen grant mappings") introduced a new requirement for using virtio devices: the backend now needs to support the VIRTIO_F_ACCESS_PLATFORM feature. This is an undue requirement for non-PV guests, as those can be operated with existing backends without any problem, as long as those backends are running in dom0. Per default allow virtio devices without grant support for non-PV guests. Add a new config item to always force use of grants for virtio. Fixes: fa1f57421e0b ("xen/virtio: Enable restricted memory access using Xen= grant mappings") Reported-by: Viresh Kumar Signed-off-by: Juergen Gross --- V2: - remove command line parameter (Christoph Hellwig) --- drivers/xen/Kconfig | 9 +++++++++ include/xen/xen.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/xen/Kconfig b/drivers/xen/Kconfig index bfd5f4f706bc..a65bd92121a5 100644 --- a/drivers/xen/Kconfig +++ b/drivers/xen/Kconfig @@ -355,4 +355,13 @@ config XEN_VIRTIO =20 If in doubt, say n. =20 +config XEN_VIRTIO_FORCE_GRANT + bool "Require Xen virtio support to use grants" + depends on XEN_VIRTIO + help + Require virtio for Xen guests to use grant mappings. + This will avoid the need to give the backend the right to map all + of the guest memory. This will need support on the backend side + (e.g. qemu or kernel, depending on the virtio device types used). + endmenu diff --git a/include/xen/xen.h b/include/xen/xen.h index 0780a81e140d..4d4188f20337 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -56,7 +56,7 @@ extern u64 xen_saved_max_mem_size; =20 static inline void xen_set_restricted_virtio_memory_access(void) { - if (IS_ENABLED(CONFIG_XEN_VIRTIO) && xen_domain()) + if (IS_ENABLED(CONFIG_XEN_VIRTIO_FORCE_GRANT) || xen_pv_domain()) platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS); } =20 --=20 2.35.3