From patchwork Tue Oct 1 14:57: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: 11169009 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 46D6B1747 for ; Tue, 1 Oct 2019 15:04:08 +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 1FFBE20679 for ; Tue, 1 Oct 2019 15:04:08 +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="IRbJkyg/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1FFBE20679 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 1iFJfP-00058D-Bc; Tue, 01 Oct 2019 15:02:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFJae-0004Ok-GM for xen-devel@lists.xenproject.org; Tue, 01 Oct 2019 14:57:24 +0000 X-Inumbo-ID: c4100ac8-e45b-11e9-b588-bc764e2007e4 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by localhost (Halon) with ESMTPS id c4100ac8-e45b-11e9-b588-bc764e2007e4; Tue, 01 Oct 2019 14:57:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1569941839; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5GIZbrW/7UHOKzPnQwF1sYeQLthDe/gD90GMyjCPdmA=; b=IRbJkyg/wlMNUY0iKIqJ867fsKhgZTF2xjOEgbscc4lbwSxrtFpq4EhB SQHjzlesjrBxL3WjkVMVRNcFYFO/OJw393zAwwjW3IaT+ZO0ff0lGe4MO ONKEQNUqXfpR6qWKvwl3gN5zbZW3CbjmTawsASyLMh/PoOYpMCb1MJiaQ s=; Authentication-Results: esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="paul.durrant@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.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=esa5.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 (esa5.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=esa5.hc3370-68.iphmx.com; envelope-from="Paul.Durrant@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: OSGpm651Otu5wXR8ZPAaipv5MhhxGpJLMigU5Nx5Nj3fEtvpwyTRB1owgELfZmY1OoEphXfA2+ aKCWd96+NkMSNWz3eEp9xCeyd5nAWZ3gJ5gsIc8KVJ+uiHGNmYbgMo6png1zmCxcWCOzAwSNyv tbdBX2SMAtxaxKaxyBOR5Oz5RSN6uM/XZZOF+FNZXyRXQO1AMPOSj9eF1j+pbqx4FrbStzjLWA qktBUsSqSZ3rrCugf4a3fHdZQjwHI3nL5xLRajBb9J1tfa9+7fLxihd3ehe+CvWPkxZO4CNstu Dbw= X-SBRS: 2.7 X-MesageID: 6557830 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.64,571,1559534400"; d="scan'208";a="6557830" From: Paul Durrant To: Date: Tue, 1 Oct 2019 15:57:14 +0100 Message-ID: <20191001145714.556-3-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb671 In-Reply-To: <20191001145714.556-1-paul.durrant@citrix.com> References: <20191001145714.556-1-paul.durrant@citrix.com> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 01 Oct 2019 15:02:16 +0000 Subject: [Xen-devel] [PATCH-for-4.13 v2 2/2] 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_UNKNOWN' 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 v2: - re-base --- 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 5f2972bc03..62e13f3e7c 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_UNKNOWN); return 0; }