From patchwork Tue Oct 1 09:12:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11168313 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E1CB15AB for ; Tue, 1 Oct 2019 09:13:48 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4919921920 for ; Tue, 1 Oct 2019 09:13:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="afiIUeYw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4919921920 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFECi-0004FD-Ui; Tue, 01 Oct 2019 09:12:20 +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 1iFECi-0004F6-7y for xen-devel@lists.xenproject.org; Tue, 01 Oct 2019 09:12:20 +0000 X-Inumbo-ID: 90fe7ffb-e42b-11e9-96f6-12813bfff9fa Received: from esa2.hc3370-68.iphmx.com (unknown [216.71.145.153]) by localhost (Halon) with ESMTPS id 90fe7ffb-e42b-11e9-96f6-12813bfff9fa; Tue, 01 Oct 2019 09:12:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569921140; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Fuqos8FL1CuT4r9A4knatA4mZaGfXspr1OwtKlMT21w=; b=afiIUeYwZxSU6cdC7nqeDNu2kkKXUCs9UZKa0sPauRtu15Zk4QBN2+Xz xCluIrv/9WmJHGqnJ1IhO4SIfDHkM8QSbh/EUShTWFhoWL1OaOq00N+F1 ZXAz5ULAGLchGSd9xXAj+rPASG/PeWwJIA3Yx9knEGYLV2y98xELMGW1o o=; Authentication-Results: esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa2.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=esa2.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 (esa2.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=esa2.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: fSQgL098U1Cd4QVGjSZQNOmFlrHot04JxdYnBYlvzvvUmcB7M2plJTntMMdhGSRj9VE56NZzY1 ZMGd3ocFTpYfDH1lFxpIk76/AbUtUmKV2HUNaycrE9Vv+Iynz7D4zswJvVl2semhd3Zc8dEhy3 yUZ5t/uFl5cmeKRDeCWMWBGpH5vddWoXQ+7JZJpUNBhuUIbmBL/cZUn9MiNNc6Ht7x8khOkqlB RyEgBNvnPPgao64LS/EKkH/tOzRwocKCU2+6DoApOZUZhJhRGu50D0LcQ/xel62vbxRkgFKTct pnU= X-SBRS: 2.7 X-MesageID: 6295631 X-Ironport-Server: esa2.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,570,1559534400"; d="scan'208";a="6295631" From: Paul Durrant To: Date: Tue, 1 Oct 2019 10:12:14 +0100 Message-ID: <20191001091214.3287-1-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH-for-4.13] libxl: choose an appropriate default for passthrough... 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: Anthony PERARD , Juergen Gross , Paul Durrant , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" ...if there is no IOMMU or it is globally disabled. Without this patch, the following assertion may be hit: xl: libxl_create.c:589: libxl__domain_make: Assertion `info->passthrough != LIBXL_PASSTHROUGH_ENABLED' failed. This is because libxl__domain_create_info_setdefault() currently only sets an appropriate value for 'passthrough' in the case that 'cap_hvm_directio' is true, which is not the case unless an IOMMU is present and enabled in the system. This is normally masked by xl choosing a default value, but that will not happen if xl is not used (e.g. when using libvirt) or when a stub domain is being created. Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD Cc: Juergen Gross --- tools/libxl/libxl_create.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index b58e030376..3bdb6c51b6 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -68,7 +68,11 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc, c_info->passthrough = ((c_info->type == LIBXL_DOMAIN_TYPE_PV) || !info.cap_iommu_hap_pt_share) ? LIBXL_PASSTHROUGH_SYNC_PT : LIBXL_PASSTHROUGH_SHARE_PT; - } + } else if (!info.cap_hvm_directio) + c_info->passthrough = LIBXL_PASSTHROUGH_DISABLED; + + /* An explicit setting should now have been chosen */ + assert(c_info->passthrough != LIBXL_PASSTHROUGH_ENABLED); return 0; }