From patchwork Wed Jan 8 10:38:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11323171 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 56AD81398 for ; Wed, 8 Jan 2020 10:40:25 +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 3286420705 for ; Wed, 8 Jan 2020 10:40:25 +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="N0GfuyaW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3286420705 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 1ip8kD-0007xG-UO; Wed, 08 Jan 2020 10:39:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ip8kC-0007x7-0v for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 10:39:20 +0000 X-Inumbo-ID: 193036a0-3203-11ea-bf56-bc764e2007e4 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 193036a0-3203-11ea-bf56-bc764e2007e4; Wed, 08 Jan 2020 10:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578479948; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ba4ra9nZdllESORCXLcGcHMgte79HZx546Vj9gUeQJk=; b=N0GfuyaWWR5994xiDC1fhU1axbZ7VrIbz8eay0N7CW+COJOBhmEaLPKM wzSs8z3m5/OPo1ccCRO98Dufn80uxu6C5jbnoEsusTPSYGz0+VhN5k1Tu /CX23Lk5hw/sROdEdHVAsk0bNgSV/Wz6ao7YB9q0P8f4fBQLw1xWUqnEm 8=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@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 (esa3.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=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: 7jiqfmdepobmiVldalbVvA7XJ2NiDBNqSr9cq58kdW8Cdcj57QGOgPZSqS+OxEzuvFdbiOzHtu 7zdCjOkjsbIW78iZl2PqrBNHI+/lfwTp35o2gb/iNBfVK/KGOvGWOzvlo66a1k510/zcpMy2OT KEc4pWHSdqWQIpJkY8FPK99jQGc6ZjTaptTR5piMLG/oIDsp99M3OrafjzdemDygbnmLu+LxPg //Y7MJVfoe8idE39+dvdudlCzEoK8m/i2eeRFqfemNmLyJgBMbegT+JL6zyG4UUl5XOTVpA1Jk KxU= X-SBRS: 2.7 X-MesageID: 10603608 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,409,1571716800"; d="scan'208";a="10603608" From: Roger Pau Monne To: Date: Wed, 8 Jan 2020 11:38:56 +0100 Message-ID: <20200108103857.77236-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200108103857.77236-1-roger.pau@citrix.com> References: <20200108103857.77236-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/2] nvmx: fix handling of interrupts 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: Kevin Tian , Jun Nakajima , Wei Liu , Andrew Cooper , Jan Beulich , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When doing a virtual vmexit (ie: a vmexit handled by the L1 VMM) interrupts shouldn't be injected using the virtual interrupt delivery mechanism, and instead should be signaled in the vmcs using the exit reason and the interruption-information field if the "Acknowledge interrupt on exit" vmexit control is set. Remove the nvmx_update_apicv helper: it's bogus to attempt to inject interrupts on virtual vmexit using the virtual interrupt delivery assistance, and it's also bogus to ack interrupts without checking if the vmexit "Acknowledge interrupt on exit" vmexit control is set. nvmx_intr_intercept already handles interrupts correctly on virtual vmexit. Note that this fixes the usage of x2APIC by the L1 VMM, at least when the L1 VMM is Xen. Signed-off-by: Roger Pau Monné --- xen/arch/x86/hvm/vmx/vvmx.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index d8ab167d62..af48b0beef 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1316,35 +1316,6 @@ static void sync_exception_state(struct vcpu *v) } } -static void nvmx_update_apicv(struct vcpu *v) -{ - struct nestedvmx *nvmx = &vcpu_2_nvmx(v); - unsigned long reason = get_vvmcs(v, VM_EXIT_REASON); - uint32_t intr_info = get_vvmcs(v, VM_EXIT_INTR_INFO); - - if ( reason == EXIT_REASON_EXTERNAL_INTERRUPT && - nvmx->intr.source == hvm_intsrc_lapic && - (intr_info & INTR_INFO_VALID_MASK) ) - { - uint16_t status; - uint32_t rvi, ppr; - uint32_t vector = intr_info & 0xff; - struct vlapic *vlapic = vcpu_vlapic(v); - - vlapic_ack_pending_irq(v, vector, 1); - - ppr = vlapic_set_ppr(vlapic); - WARN_ON((ppr & 0xf0) != (vector & 0xf0)); - - status = vector << VMX_GUEST_INTR_STATUS_SVI_OFFSET; - rvi = vlapic_has_pending_irq(v); - if ( rvi != -1 ) - status |= rvi & VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK; - - __vmwrite(GUEST_INTR_STATUS, status); - } -} - static void virtual_vmexit(struct cpu_user_regs *regs) { struct vcpu *v = current; @@ -1393,9 +1364,6 @@ static void virtual_vmexit(struct cpu_user_regs *regs) /* updating host cr0 to sync TS bit */ __vmwrite(HOST_CR0, v->arch.hvm.vmx.host_cr0); - if ( cpu_has_vmx_virtual_intr_delivery ) - nvmx_update_apicv(v); - nvcpu->nv_vmswitch_in_progress = 0; } From patchwork Wed Jan 8 10:38:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Roger_Pau_Monn=C3=A9?= X-Patchwork-Id: 11323173 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 59BAD1580 for ; Wed, 8 Jan 2020 10:40:25 +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 32731206F0 for ; Wed, 8 Jan 2020 10:40:25 +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="VD1xrchE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32731206F0 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 1ip8kI-0007yF-C6; Wed, 08 Jan 2020 10:39:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ip8kH-0007xm-1A for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 10:39:25 +0000 X-Inumbo-ID: 19d012ce-3203-11ea-bf56-bc764e2007e4 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 19d012ce-3203-11ea-bf56-bc764e2007e4; Wed, 08 Jan 2020 10:39:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578479949; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=UTOC1SLaRcRa8O25+Sabf5ebK+DXQWP5BRGRflW7lg0=; b=VD1xrchE7aebqlo0is2hE0sNzuTO28YT7llh28Ahut2LOozSbDNd2+gL +bPG7Do3b4fXhPwD0Lced/R0jtrdZ2ZRbCQS6d2c7oelJTGT+hf4oTVX2 cQt+zkm+CwABfGGC940JcCwZ6MBcNY3H8IjeMoKMeFX/fuLXgibF/OY0/ I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@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 (esa6.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=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: cQwm1PuzisoVEkLdpEdO+jzliCGBV4ULVdKS07BcOVb4OL0eiqrWfUM1zBjEV4pw690lX6IJGu E7Aht0/V1qfoXdznquRFZcRnkB4wVEEM7skQoZFoNQfQcJOWdbVOafX4s+LdIX0e3x7UyPGOtk IqTyZDDBjQ2wYzv37JUQJWquUmfJfh6dlEzpcTURqH8rLSVq9TSgBY/NA4hz/rbEsuXILpDAiF UaAko0hsXAPhxJnmAfWwN3+ZdZBQj6HpINDG2EB3DrM7VXeyLGMv1XMchh7KlHm8ZLDNLRltZe Aug= X-SBRS: 2.7 X-MesageID: 11047490 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,409,1571716800"; d="scan'208";a="11047490" From: Roger Pau Monne To: Date: Wed, 8 Jan 2020 11:38:57 +0100 Message-ID: <20200108103857.77236-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200108103857.77236-1-roger.pau@citrix.com> References: <20200108103857.77236-1-roger.pau@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/2] Revert "tools/libxc: disable x2APIC when using nested virtualization" 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: Ian Jackson , Wei Liu , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This reverts commit 7b3c5b70a32303b46d0d051e695f18d72cce5ed0 and re-enables the usage of x2APIC with nested virtualization. Signed-off-by: Roger Pau Monné Acked-by: Wei Liu --- tools/libxc/xc_cpuid_x86.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index ac38c1406e..2540aa1e1c 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -653,17 +653,6 @@ int xc_cpuid_apply_policy(xc_interface *xch, uint32_t domid, p->extd.itsc = true; p->basic.vmx = true; p->extd.svm = true; - - /* - * BODGE: don't announce x2APIC mode when using nested virtualization, - * as it doesn't work properly. This should be removed once the - * underlying bug(s) are fixed. - */ - rc = xc_hvm_param_get(xch, domid, HVM_PARAM_NESTEDHVM, &val); - if ( rc ) - goto out; - if ( val ) - p->basic.x2apic = false; } rc = x86_cpuid_copy_to_buffer(p, leaves, &nr_leaves);