From patchwork Wed Oct 9 18:21:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11181823 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 D43E71575 for ; Wed, 9 Oct 2019 18:22:57 +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 AFBE020B7C for ; Wed, 9 Oct 2019 18:22:57 +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="UaNnOFeb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AFBE020B7C Authentication-Results: mail.kernel.org; dmarc=fail (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 1iIGaO-0004nB-Jz; Wed, 09 Oct 2019 18:21:20 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iIGaN-0004n6-01 for xen-devel@lists.xenproject.org; Wed, 09 Oct 2019 18:21:19 +0000 X-Inumbo-ID: 95b5d2fe-eac1-11e9-8c93-bc764e2007e4 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 95b5d2fe-eac1-11e9-8c93-bc764e2007e4; Wed, 09 Oct 2019 18:21:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1570645277; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ldl6YHcJrVzRUQIzaQ3nEPvYcf1wT9Dp6gt6RGGOclA=; b=UaNnOFebDbp1ibJ4aoA2eJMb51tmJnb11zYxkOLWdMWyRYtafzas+BgJ lUj47P9FpRBmH0DSxqmfcdJ8h0rMmTMNf+/dSNa21GfL5RlvwglQOcytR AzpZJ8pYHzAYz6OQAH5eElAqKzxqHofWiuDTHCe0O2TfsLvGx9XLu/Z1j U=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@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 andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@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="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@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 ip4:168.245.78.127 ~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="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 7cqhtTykc0ySA7acD+2I53JM1QLKS+70yzFNZdC0JTOmVdf6aJ+4Ay7dNQ3abRP0eJ6VSCvtbr blBuLyEFCJnB1RFwR/Pm6CsV+Eb9gQS9khwsnioFiTerrgj3bsaWcChd3pvHvK7nH5Tqu8Dwhp VHirvoJK4+/4fAxf0G1Rs011ajsVcC85u5RfXBGnE6LjLcoHl3vWNY5WGj82XA47BlnM902WEo q3NjkdBbYVfIxuJ+C3wsFOqF98uYHqpxMgil10XIv3zl8xVsKcES0uovQNQQLvset7FwASDh6J f0g= X-SBRS: 2.7 X-MesageID: 6941273 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.67,277,1566878400"; d="scan'208";a="6941273" From: Andrew Cooper To: Xen-devel Date: Wed, 9 Oct 2019 19:21:14 +0100 Message-ID: <20191009182114.9376-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/hvm: Fix the use of "hap=0" following c/s c0902a9a143a 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: Juergen Gross , Wei Liu , Paul Durrant , Andrew Cooper , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" c/s c0902a9a143a refactored hvm_enable() a little, but dropped the logic which cleared hap_supported in the case that the user had asked for it off. This results in Xen booting up, claiming: (XEN) HVM: Hardware Assisted Paging (HAP) detected but disabled but with HAP advertised via sysctl, and XEN_DOMCTL_CDF_hap being accepted in domain_create(). Signed-off-by: Andrew Cooper Reviewed-by: Paul Durrant Reviewed-by: Wei Liu Acked-by: Jan Beulich --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné CC: Paul Durrant CC: Juergen Gross This is a regression from 4.12, so should be fixed before 4.13 ships. --- xen/arch/x86/hvm/hvm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index c22cb39cf3..9acd359c99 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -142,7 +142,7 @@ static struct notifier_block cpu_nfb = { .notifier_call = cpu_callback }; -static bool __init hap_supported(const struct hvm_function_table *fns) +static bool __init hap_supported(struct hvm_function_table *fns) { if ( !fns->hap_supported ) { @@ -152,6 +152,7 @@ static bool __init hap_supported(const struct hvm_function_table *fns) if ( !opt_hap_enabled ) { + fns->hap_supported = 0; printk("HVM: Hardware Assisted Paging (HAP) detected but disabled\n"); return false; } @@ -175,7 +176,7 @@ static int __init hvm_enable(void) hvm_enabled = 1; printk("HVM: %s enabled\n", fns->name); - if ( !hap_supported(fns) ) + if ( !hap_supported(&hvm_funcs) ) clear_iommu_hap_pt_share(); else {