From nobody Tue Nov 11 07:09:28 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1569492250; cv=none; d=zoho.com; s=zohoarc; b=m+EagZOeMGjVy7UzkuBRTCSD8Ia5i1Ys45fPIuHOHr8rw7Fb1hL3e8+XSSsb0KdomSe/dJ1KNETztYrJekX5g4V3ECf2Pk4VKURAg4owQ7i0QNTTYCAXDwKEelVBsb/tJ2nhTXTQCUGFPNAcYKqfzJjm6BXYtslwmwDjUO6JrA8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569492250; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=GpxuptkxFf3oRVFjQmUKuHNuScR4A3pOY4FVMiwDH6I=; b=Al0xmqkw07mhtIlKyuhj8w0Fjodd46hcBD6lVNLtS+Wj5mhnoTxtBKkeCeMGuHETws1kDZMVlLljN/G2uD1/Cq0cc2vCBn4djlhLf9Q/LvB6km4NW7GeeUaE3jgvmRzKI/ISii53u61PXxGK5Daq9kgzDfvnvp8voiyuDUlE1mU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1569492250009634.4079087907747; Thu, 26 Sep 2019 03:04:10 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQcL-0005e7-I6; Thu, 26 Sep 2019 10:03:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iDQcJ-0005do-TA for xen-devel@lists.xenproject.org; Thu, 26 Sep 2019 10:03:20 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by localhost (Halon) with ESMTPS id dc667050-e044-11e9-964d-12813bfff9fa; Thu, 26 Sep 2019 10:03:18 +0000 (UTC) X-Inumbo-ID: dc667050-e044-11e9-964d-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569492199; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WVMPze2Myz22GLhKiReOVR3N1VDCT6fqUUjsf9O0hJY=; b=LeUVMj+7Pydf9YP3QMAuErNj153nrtwwViCCtGLZlcxXrm9Z3Nf3BlHY UNS+yv4ww1N+KfELBoNY5jgEgkXTHtyGbZBmP8zBZ9MXn2iCxlCMsWusH 00se57ZgNsrKqt+9jGwB8PG4FFrnQJLX+8AIP9RpL+StUs0vcFe0Ijnoz A=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=paul.durrant@citrix.com; spf=Pass smtp.mailfrom=Paul.Durrant@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of paul.durrant@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Paul.Durrant@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="Paul.Durrant@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: WEkMoh8dAka5Gb1BFYIU+6fuOyfl9tuJOPDHDGoBAxNOzACEd9QnLmmLCj2vzkB1iCGWYGs7ZD Nab6wlFtveYfc5+lteQyr7SD/n0j0bUKR8Ysmu1NhieufQfaliZgy6VF5Gozd6sq5G/9b9xlXZ umB3FoOsOhQShqZzfJJaDkxf9gq+9ZLSvBXgab0/GuVkcfCGRnimdNT+WifFq0oejbU0vc27Ld afUJ2qBvs/ciIpXuXmPxvu8iG84mUNZZsKxDlZNiTk+ciGiHej2JuCz45ZUVs/5ix8KEa451IQ 8EQ= X-SBRS: 2.7 X-MesageID: 6173953 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,551,1559534400"; d="scan'208";a="6173953" From: Paul Durrant To: Date: Thu, 26 Sep 2019 11:03:08 +0100 Message-ID: <20190926100308.33936-1-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] iommu: avoid triggering ASSERT_UNREACHABLE() on ARM... X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Oleksandr , Julien Grall , Paul Durrant , Jan Beulich Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) ...when the IOMMU is not enabled. 80ff3d338dc9 "iommu: tidy up iommu_use_hap_pt() and need_iommu_pt_sync() macros" introduced CONFIG_IOMMU_FORCE_PT_SHARE, which causes the global 'iommu_hap_pt_share' option to be replaced with a #define-d value of true. In this configuration, calling clear_iommu_hap_pt_share() will result trigger the aforementioned ASSERT. CONFIG_IOMMU_FORCE_PT_SHARE is always selected for ARM builds and, because clear_iommu_hap_pt_share() is called by the common iommu_setup() function if the IOMMU is not enabled, it is no longer safe to disable the IOMMU on ARM systems. However, running with the IOMMU disabled is a valid configuration for ARM systems, so this patch rectifies the problem by removing the call to clear_iommu_hap_pt_share() from common code. As a side effect of this, however, it becomes possible on x86 systems for iommu_enabled to be false but iommu_hap_pt_share to be true. Thus the code in sysctl.c needs to be changed to make sure that XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share is not erroneously advertised when the IOMMU has been disabled. Signed-off-by: Paul Durrant Reported-by: Oleksandr Acked-by: Julien Grall Reported-by: Oleksandr Tyshchenko Reviewed-by: Jan Beulich Tested-by: Oleksandr Tyshchenko --- Cc: Andrew Cooper Cc: George Dunlap Cc: Ian Jackson Cc: Jan Beulich Cc: Julien Grall Cc: Konrad Rzeszutek Wilk Cc: Stefano Stabellini Cc: Tim Deegan Cc: Wei Liu --- xen/common/sysctl.c | 6 ++++-- xen/drivers/passthrough/iommu.c | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index e8763c7fdf..f88a285e7f 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -268,9 +268,11 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_= sysctl) pi->max_mfn =3D get_upper_mfn_bound(); arch_do_physinfo(pi); if ( iommu_enabled ) + { pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_directio; - if ( iommu_hap_pt_share ) - pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share; + if ( iommu_hap_pt_share ) + pi->capabilities |=3D XEN_SYSCTL_PHYSCAP_iommu_hap_pt_shar= e; + } =20 if ( copy_to_guest(u_sysctl, op, 1) ) ret =3D -EFAULT; diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index e8fddc2dc7..c33ca70ec9 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -456,7 +456,6 @@ int __init iommu_setup(void) if ( !iommu_enabled ) { iommu_intremap =3D 0; - clear_iommu_hap_pt_share(); } =20 if ( (force_iommu && !iommu_enabled) || --=20 2.20.1.2.gb21ebb671 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel