From patchwork Tue Jan 17 02:09:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 9519799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61F2560210 for ; Tue, 17 Jan 2017 02:13:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42D88281C3 for ; Tue, 17 Jan 2017 02:13:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34244282EC; Tue, 17 Jan 2017 02:13:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E6518281C3 for ; Tue, 17 Jan 2017 02:13:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTJDt-0004tT-76; Tue, 17 Jan 2017 02:10:09 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cTJDs-0004tN-Lx for xen-devel@lists.xen.org; Tue, 17 Jan 2017 02:10:09 +0000 Received: from [85.158.143.35] by server-4.bemta-6.messagelabs.com id 07/46-25093-FFC7D785; Tue, 17 Jan 2017 02:10:07 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAKsWRWlGSWpSXmKPExsWSoa+lp/uvpjb CYM5aU4slHxezODB6HN39mymAMYo1My8pvyKBNWN281TGgjtBFWvWnGFrYHzt0MXIxcEi0MIs MWPuO5YuRk4ORoF4iXf3F7CC2EICTUwSP2ekgdhsAtYSr+bcYQexRQRkJVZ3zWEHaWYWmMAk0 fH/LVhCWMBCYum264xdjBxAU1UlVr43AQnzCnhLPH6ynRnElhCQkzh5bDIrRFxQ4uTMJ2B7mQ UkJA6+eAFVoyQxc1sDG8h8CYEORonmv4uZIQ7Skrh85CAbyHwJAV+Jm0/rIOp9JRr7Glkg6s8 ySexu/wXVfI5NYsWrt6wQzi42ibYJmxkhWnIkPp99wQZhZ0u8ndTCAmEvYZLY/7UWwj7LJrFg lRqELSPx7PY5ZohBu1klfs7fxQ5yhhAwvH7NcYaIz+CV+PL1CNTqNWwS7xZ8ZISEi5TE+x0no WwZiQ0z5kAdO5FNYtWf24wTGFVmIQXILKQAWcDItIpRozi1qCy1SNfYSC+pKDM9oyQ3MTNH19 DATC83tbg4MT01JzGpWC85P3cTIzAlMADBDsbT6wIPMUpyMCmJ8l7Nr40Q4kvKT6nMSCzOiC8 qzUktPsQow8GhJMFbXQ2UEyxKTU+tSMvMASYnmLQEB4+SCO9ykDRvcUFibnFmOkTqFKOilDhv OUhCACSRUZoH1wZLiJcYZaWEeRmBDhHiKUgtys0sQZV/xSjOwagkzLseZApPZl4J3PRXQIuZg BZf16kGWVySiJCSamAMbJnHMm3edMWpDYwOeyYknec/zG87ReWepVpBR41eQSZn9D27Q6Uaaw 3UeO9Venj/MOE9xd2zLqHVISr96bX6Cccn3O102fF8hs9J/1D1v2cDfv1SFFtaW5dSvYyJW// 1kbQOsTn/5fyklX7sznqg1vv129WMQJaFN2Tvs/xibGfmyWrOdlZiKc5INNRiLipOBABJSpRO gwMAAA== X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-7.tower-21.messagelabs.com!1484619005!53030472!1 X-Originating-IP: [104.47.42.46] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 13822 invoked from network); 17 Jan 2017 02:10:06 -0000 Received: from mail-by2nam03on0046.outbound.protection.outlook.com (HELO NAM03-BY2-obe.outbound.protection.outlook.com) (104.47.42.46) by server-7.tower-21.messagelabs.com with AES256-SHA256 encrypted SMTP; 17 Jan 2017 02:10:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=vTINyq7KiPR8jS+oeghdiDq/gNNYjjukcZujvH91hsI=; b=d7cg3yXBfeenV28Xn5AqgpotUOb8fFPUh2I057ZsAPGTyjamZLMTj5gpvzFBGVyAecy9nQwaCyMcc3Fr3PdTX2C0ryLxT+Z1MkGAfKCXFxDOPuXpKrvjzdsHiZiB/1uhWmDDFxiyEGyFg6NrR4t8aQ8xslXD7cxzno/GXzvpPdI= Received: from localhost.localdomain (114.109.128.54) by DM5PR12MB1449.namprd12.prod.outlook.com (10.172.38.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Tue, 17 Jan 2017 02:09:59 +0000 From: Suravee Suthikulpanit To: Date: Mon, 16 Jan 2017 20:09:10 -0600 Message-ID: <1484618950-785-1-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: SG2PR0302CA0020.apcprd03.prod.outlook.com (10.170.129.30) To DM5PR12MB1449.namprd12.prod.outlook.com (10.172.38.138) X-MS-Office365-Filtering-Correlation-Id: a249d932-71d3-46bf-efce-08d43e7df2b9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:DM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mBeYMEFYV5MkskWdp9uMm9z0s5etek+F/VFfRdNF+bGECZvbP/ug6uN43NxD8IrJqkhArhl5qChWrSg== X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 31:rSnV5SvrIis0ah5cheNDgR4dlT6plZokC7mJwPTeKY+hMOM0KrvMyXuO2YWmUrHODrXSlrkAgkFKTxjoxdXXAWukj1swCC/0U2D3rngvwyJiuWFwJTNA/wA/Tnz4osNr1+dCgxH9UhZise+b82Pfq1y1fdU+a+FnKbZ3gQV6htRW5Zm66erOOeoiojxqIjqcwxn4gN2BAagQ1BbGl8S/jGqTleRbjU4FoLJuEac2rSWgUt7PT/rb6gEMAMvPpN4D; 20:/n/O8ri+guUybyaU3RR8nMFGqk7Wdhl/TQzMIB9RcXFrprkI1rYV9lkU8W53OxdMu42FOSNfOqVT9ssC40sl2oL0DzmbQUZOQI7b3D+PsfeFbqqVO0kjLJHOtaq1Xx+PJD3jjcLwo7qdUHroAaOOiSoBB3MlKNosCinzh4DFFNEo4TKR0sQVYJmNESvs25dTEA6qaa+5SqNmUbttQi9h8HLZQIbZ+qBpRAuG79PZ3bd5Z6NGIupjs2HMR2Dtw4KzQKF3prm2GRgeRX0LGlaCc7JvVxTIFvqxbpOG+r0md5oM/oo3NWhKJXs1F79DmmxPFlD6IlZHk9XOlwvjSsyUyo4H6Ftc/bTOKj/+aSM+3Ogug45GWHl9+2EG8pxQT5qY24B+1upO5bW71XbYXMDckErJtr+t+a9c6LGYwx3EvVIJvlEaQgeGnbr0gFWvV7vrktXMC0NJnwO+9TKniOTJ6LDtUhwuRsrZBmzRFJMRslGxaX35Vy4TvYI9hXKAvZT7 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(70601490899591)(146099531331640)(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6041248)(20161123560025)(20161123555025)(20161123558021)(20161123564025)(20161123562025)(6072148); SRVR:DM5PR12MB1449; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1449; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1449; 4:jXfEhc/1Mxe71fbLtosGcDyGMGkilQXg1qInanJOv+G0dJnByvXrQx2RzVWj+TkLEM5olxhm4D8aqL8EFOeJ9vjNTFAD+qVHZ+EsIy6da2hawMKKwvpYgkt2o/j6xkMcNAzNhJt076R77QYa7NmQoGGjcSaP/5UUJVP4XJuhs/nAvlZhU4CEUAqC8tMNVnMBMj9XxB5YKaQdLzZLp8mC+OLsqcsbSax/Dq8KmdfHvbilAbPxG7q62HU7SfAbO/Z2dKs+IAAuIonbLNPw6StM4QS9i9pw00VFYEyUX3B+h0Yy7hymr7otwUPY2OC0kIxzC1vSp25+qfKY/MnNA5DgSk0+sznnuzvKb4X3kbOCJNqmPa247kYrTyYjNV8hiMtiimU2q8sO4FMP16YnEuPbaBj29YiUkVDg6GrV0tgm3rGNPCf3w0Xj9+qCT94hyLm+HL5p3UsH43zA5Egt6sOrJEMNVgIobvbThy1YiuLioAwGZbzUhbtH3YmTfQhUub4ob2Z+JJ84x+Sc+BAgQkymHLpUbhgeZutiX3vviTtNrfEjEiS0pmxy08R+MKqIfToF+PDuyAzFiVXrdG3xdpkFINXOx4t5fxAtl/bmhlJcQc8osUujdo2N1Y/R2G9jh1SCD5fZn3Toa+oVhC/5koISs56hxftYOJGw2wRpnnigR8qrteZ+7aVUZsKLCCaMRbbMmGg/p8pMEU7y5KznSvHD/Obse/DtB6QbFEsoqRONJ+jkJIn5qdxDYe7+W0dIs2OmeOPWrRm+VNFAolioEjY35w== X-Forefront-PRVS: 01901B3451 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(39410400002)(39850400002)(39860400002)(39840400002)(189002)(199003)(52084003)(5660300001)(6666003)(92566002)(50466002)(6916009)(54906002)(8666007)(33646002)(189998001)(6506006)(5003940100001)(6486002)(110136003)(25786008)(38730400001)(50986999)(97736004)(2351001)(8676002)(81166006)(7736002)(305945005)(101416001)(86362001)(42186005)(68736007)(3846002)(6116002)(66066001)(106356001)(105586002)(81156014)(36756003)(50226002)(47776003)(4326007)(48376002)(6512007)(2906002)(30001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1449; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR12MB1449; 23:aavZb46FlM6Y1AEb33ehxdk+kvpkcGX6uGVFg8VJg?= =?us-ascii?Q?Mbag2zSkzZYlozxTYf2gGswpd4BPvJOfk32NPj4GQ6fsSJlOIY0EGOF9gQb8?= =?us-ascii?Q?n+4w3/4pXK7cpEFEwwkfZt4he7Z3vfONaqmKzUQSWV+ocOWRc0+deb97Sy9d?= =?us-ascii?Q?96eFeBHNYfwDR7G/7xHxZzgWCaugg2LY2FPP2FXbGssLpmhrDky7YWMc6Hmn?= =?us-ascii?Q?5uvLmLFAC1ZKFkJco436t7A/V53LDNaza8HdQdpOvHeXQErvKUG2n5D0ieL/?= =?us-ascii?Q?OlYwoYG8jV+Bc/i0h/6SIA4+m1Q6+bjO6A3Kd20O0W1XANtVCzHXAiK6rd6w?= =?us-ascii?Q?wKHYc/dxRi1nYDSHxp/rPNSToce67+cdYhlosyTsZgqStpbIEJcJXYSrp2fD?= =?us-ascii?Q?0TxG6zPHd6vap8L9ilchItZ2Gc4Nf4wwmeCVRzy0zr3P55rCoEhoSFOAgo+f?= =?us-ascii?Q?vtof8rpATyHwTIwb7Jv9l2q1ZYImgKhjwpr4p/WRfmM45FJspElQh6f6Xmu6?= =?us-ascii?Q?ObxA1HRHeBUfZ4W33rLvvxmSX3XNREpwzuTRMr/oU2M2pYEtZwhO4no3cixV?= =?us-ascii?Q?6HGHoRlQqPevCAOEItC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Fhb4gA==; 20:UwXcA6ouSHJh9xYmGpRVtP7snYN2BEisGv6AFKOcP+UUYY3DQNYVggGkqEjA8MGEmnR0Evc2iTr8B7CdCTt+F/6dQwm7Urxxjfbk8M4776LQFmA0VyWKvVwUxLQVb6hLew6iEqx8dEUj46KHIW+GkEvIOOSW+606VBNdbOtV3I/MdzVdeiv8BeEq4X3E8DhaSf6LR7BijBcWWo20ZWA4YPcsOdqXGFE/BO6bhJG1TdcBsP0RHqMOr4hBw0YX4OyC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 02:09:59.8832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1449 Cc: kevin.tian@intel.com, JBeulich@suse.com, konrad.wilk@oracle.com, Jun Nakajima , andrew.cooper3@citrix.com, Suravee Suthikulpanit , sherry.hurwitz@amd.com, Boris Ostrovsky Subject: [Xen-devel] [PATCH V4] x86/HVM: Introduce struct hvm_pi_ops X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The current function pointers in struct vmx_domain for managing hvm posted interrupt can be used also by SVM AVIC. Therefore, this patch introduces the struct hvm_pi_ops in the struct hvm_domain to hold them. Signed-off-by: Suravee Suthikulpanit Cc: Andrew Cooper Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: Jan Beulich Cc: Jun Nakajima Cc: Kevin Tian --- Changes in V4: * Re-word comments for the struct hvm_pi_ops. * Move the comment for VMX per Kevin's request. xen/arch/x86/hvm/vmx/vmx.c | 75 ++++++++++++++++++++++++++++++-------- xen/include/asm-x86/hvm/domain.h | 29 +++++++++++++++ xen/include/asm-x86/hvm/hvm.h | 4 +- xen/include/asm-x86/hvm/vmx/vmcs.h | 59 ------------------------------ 4 files changed, 90 insertions(+), 77 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 7b2c50c..3db4ed9 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -198,18 +198,61 @@ static void vmx_pi_do_resume(struct vcpu *v) spin_unlock_irqrestore(pi_blocking_list_lock, flags); } +/* + * To handle posted interrupts correctly, we need to set the following + * state: + * + * * The PI notification vector (NV) + * * The PI notification destination processor (NDST) + * * The PI "suppress notification" bit (SN) + * * The vcpu pi "blocked" list + * + * VMX implements the runstate transitions as the following: + * + * A: ... -> running + * - SN = 0 + * - NDST = v->processor + * If a VM is currently running, we want the PI delivered to the guest vcpu + * on the proper pcpu. + * + * B: running -> ... + * - SN = 1 + * + * C: ... -> blocked + * - SN = 0 + * - NV = pi_wakeup_vector + * - Add vcpu to blocked list + * If the vm is blocked, we want the PI delivered to Xen so that it can + * wake it up. + * + * D: ... -> vmentry + * - SN = 0 + * - NV = posted_intr_vector + * - Take vcpu off blocked list + * + * If the VM is currently either preempted or offline (i.e., not running + * because of some reason other than blocking waiting for an interrupt), + * there's nothing Xen can do -- we want the interrupt pending bit set in + * the guest, but we don't want to bother Xen with an interrupt (SN clear). + * + * There's a brief window of time between vmx_intr_assist() and checking + * softirqs where if an interrupt comes in it may be lost; so we need Xen + * to get an interrupt and raise a softirq so that it will go through the + * vmx_intr_assist() path again (SN clear, NV = posted_interrupt). + */ + /* This function is called when pcidevs_lock is held */ void vmx_pi_hooks_assign(struct domain *d) { if ( !iommu_intpost || !has_hvm_container_domain(d) ) return; - ASSERT(!d->arch.hvm_domain.vmx.vcpu_block); + ASSERT(!d->arch.hvm_domain.pi_ops.vcpu_block); - d->arch.hvm_domain.vmx.vcpu_block = vmx_vcpu_block; - d->arch.hvm_domain.vmx.pi_switch_from = vmx_pi_switch_from; - d->arch.hvm_domain.vmx.pi_switch_to = vmx_pi_switch_to; - d->arch.hvm_domain.vmx.pi_do_resume = vmx_pi_do_resume; + d->arch.hvm_domain.pi_ops.vcpu_block = vmx_vcpu_block; + d->arch.hvm_domain.pi_ops.switch_from = vmx_pi_switch_from; + d->arch.hvm_domain.pi_ops.switch_to = vmx_pi_switch_to; + d->arch.hvm_domain.pi_ops.do_resume = vmx_pi_do_resume; } /* This function is called when pcidevs_lock is held */ @@ -218,12 +261,12 @@ void vmx_pi_hooks_deassign(struct domain *d) if ( !iommu_intpost || !has_hvm_container_domain(d) ) return; - ASSERT(d->arch.hvm_domain.vmx.vcpu_block); + ASSERT(d->arch.hvm_domain.pi_ops.vcpu_block); - d->arch.hvm_domain.vmx.vcpu_block = NULL; - d->arch.hvm_domain.vmx.pi_switch_from = NULL; - d->arch.hvm_domain.vmx.pi_switch_to = NULL; - d->arch.hvm_domain.vmx.pi_do_resume = NULL; + d->arch.hvm_domain.pi_ops.vcpu_block = NULL; + d->arch.hvm_domain.pi_ops.switch_from = NULL; + d->arch.hvm_domain.pi_ops.switch_to = NULL; + d->arch.hvm_domain.pi_ops.do_resume = NULL; } static int vmx_domain_initialise(struct domain *d) @@ -901,8 +944,8 @@ static void vmx_ctxt_switch_from(struct vcpu *v) vmx_restore_host_msrs(); vmx_save_dr(v); - if ( v->domain->arch.hvm_domain.vmx.pi_switch_from ) - v->domain->arch.hvm_domain.vmx.pi_switch_from(v); + if ( v->domain->arch.hvm_domain.pi_ops.switch_from ) + v->domain->arch.hvm_domain.pi_ops.switch_from(v); } static void vmx_ctxt_switch_to(struct vcpu *v) @@ -916,8 +959,8 @@ static void vmx_ctxt_switch_to(struct vcpu *v) vmx_restore_guest_msrs(v); vmx_restore_dr(v); - if ( v->domain->arch.hvm_domain.vmx.pi_switch_to ) - v->domain->arch.hvm_domain.vmx.pi_switch_to(v); + if ( v->domain->arch.hvm_domain.pi_ops.switch_to ) + v->domain->arch.hvm_domain.pi_ops.switch_to(v); } @@ -3963,8 +4006,8 @@ void vmx_vmenter_helper(const struct cpu_user_regs *regs) struct hvm_vcpu_asid *p_asid; bool_t need_flush; - if ( curr->domain->arch.hvm_domain.vmx.pi_do_resume ) - curr->domain->arch.hvm_domain.vmx.pi_do_resume(curr); + if ( curr->domain->arch.hvm_domain.pi_ops.do_resume ) + curr->domain->arch.hvm_domain.pi_ops.do_resume(curr); if ( !cpu_has_vmx_vpid ) goto out; diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h index f34d784..de1f930 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -72,6 +72,33 @@ struct hvm_ioreq_server { bool_t bufioreq_atomic; }; +/* + * This structure defines function hooks to support hardware-assisted + * virtual interrupt delivery to guest. (e.g. VMX PI and SVM AVIC). + * + * These hooks are defined by the underlying arch-specific code + * as needed. For example: + * - When the domain is enabled with virtual IPI delivery + * - When the domain is enabled with virtual I/O int delivery + * and actually has a physical device assigned . + */ +struct hvm_pi_ops { + /* Hook into ctx_switch_from. */ + void (*switch_from) (struct vcpu *v); + + /* Hook into ctx_switch_to */ + void (*switch_to) (struct vcpu *v); + + /* + * Hook into arch_vcpu_block(), which is called + * from vcpu_block() and vcpu_do_poll(). + */ + void (*vcpu_block) (struct vcpu *); + + /* Hook into the vmentry path. */ + void (*do_resume) (struct vcpu *v); +}; + struct hvm_domain { /* Guest page range used for non-default ioreq servers */ struct { @@ -148,6 +175,8 @@ struct hvm_domain { struct list_head list; } write_map; + struct hvm_pi_ops pi_ops; + union { struct vmx_domain vmx; struct svm_domain svm; diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 7e7462e..b1e4c75 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -638,8 +638,8 @@ unsigned long hvm_cr4_guest_reserved_bits(const struct vcpu *v, bool_t restore); struct vcpu *v_ = (v); \ struct domain *d_ = v_->domain; \ if ( has_hvm_container_domain(d_) && \ - (cpu_has_vmx && d_->arch.hvm_domain.vmx.vcpu_block) ) \ - d_->arch.hvm_domain.vmx.vcpu_block(v_); \ + (d_->arch.hvm_domain.pi_ops.vcpu_block) ) \ + d_->arch.hvm_domain.pi_ops.vcpu_block(v_); \ }) #endif /* __ASM_X86_HVM_HVM_H__ */ diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h index 997f4f5..4ec8b08 100644 --- a/xen/include/asm-x86/hvm/vmx/vmcs.h +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h @@ -77,65 +77,6 @@ struct vmx_domain { unsigned long apic_access_mfn; /* VMX_DOMAIN_* */ unsigned int status; - - /* - * To handle posted interrupts correctly, we need to set the following - * state: - * - * * The PI notification vector (NV) - * * The PI notification destination processor (NDST) - * * The PI "suppress notification" bit (SN) - * * The vcpu pi "blocked" list - * - * If a VM is currently running, we want the PI delivered to the guest vcpu - * on the proper pcpu (NDST = v->processor, SN clear). - * - * If the vm is blocked, we want the PI delivered to Xen so that it can - * wake it up (SN clear, NV = pi_wakeup_vector, vcpu on block list). - * - * If the VM is currently either preempted or offline (i.e., not running - * because of some reason other than blocking waiting for an interrupt), - * there's nothing Xen can do -- we want the interrupt pending bit set in - * the guest, but we don't want to bother Xen with an interrupt (SN clear). - * - * There's a brief window of time between vmx_intr_assist() and checking - * softirqs where if an interrupt comes in it may be lost; so we need Xen - * to get an interrupt and raise a softirq so that it will go through the - * vmx_intr_assist() path again (SN clear, NV = posted_interrupt). - * - * The way we implement this now is by looking at what needs to happen on - * the following runstate transitions: - * - * A: runnable -> running - * - SN = 0 - * - NDST = v->processor - * B: running -> runnable - * - SN = 1 - * C: running -> blocked - * - NV = pi_wakeup_vector - * - Add vcpu to blocked list - * D: blocked -> runnable - * - NV = posted_intr_vector - * - Take vcpu off blocked list - * - * For transitions A and B, we add hooks into vmx_ctxt_switch_{from,to} - * paths. - * - * For transition C, we add a new arch hook, arch_vcpu_block(), which is - * called from vcpu_block() and vcpu_do_poll(). - * - * For transition D, rather than add an extra arch hook on vcpu_wake, we - * add a hook on the vmentry path which checks to see if either of the two - * actions need to be taken. - * - * These hooks only need to be called when the domain in question actually - * has a physical device assigned to it, so we set and clear the callbacks - * as appropriate when device assignment changes. - */ - void (*vcpu_block) (struct vcpu *); - void (*pi_switch_from) (struct vcpu *v); - void (*pi_switch_to) (struct vcpu *v); - void (*pi_do_resume) (struct vcpu *v); }; struct pi_desc {