From patchwork Mon Sep 19 05:52:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 9338559 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 0E77A607D0 for ; Mon, 19 Sep 2016 05:56:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1829290CE for ; Mon, 19 Sep 2016 05:56:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E66E6290DD; Mon, 19 Sep 2016 05:56:30 +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 2F523290CE for ; Mon, 19 Sep 2016 05:56:30 +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 1blrW4-0004F3-Rw; Mon, 19 Sep 2016 05:53:20 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1blrW3-0004Ef-NF for xen-devel@lists.xen.org; Mon, 19 Sep 2016 05:53:19 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id D5/E7-29421-F4D7FD75; Mon, 19 Sep 2016 05:53:19 +0000 X-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.com!1474264395!59047536!2 X-Originating-IP: [104.47.34.86] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7355 invoked from network); 19 Sep 2016 05:53:17 -0000 Received: from mail-by2nam01on0086.outbound.protection.outlook.com (HELO NAM01-BY2-obe.outbound.protection.outlook.com) (104.47.34.86) by server-4.tower-27.messagelabs.com with AES256-SHA256 encrypted SMTP; 19 Sep 2016 05:53:17 -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=tH9fNp/LJAXBamlBToFJCajUZPIe+IQiBRHoLWrjyxI=; b=OnMIxbziH7DkRrfnnM9lRKdLWYukMqb3kMjI9mVWFfbJoeyYFewz8YEBUE8aCQM6S6uZkJ1yrubh1Ok2E2A9oLCvPM+weZMHFaguMkFTobor3ruYx3DScc02KVmkED8ZYjEQVWeN6dxHcZ0Mvuf1IprZ6GBKgsz/GUDkf+zQd9I= Received: from localhost.localdomain (114.109.128.54) by BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.629.8; Mon, 19 Sep 2016 05:53:14 +0000 From: Suravee Suthikulpanit To: Date: Mon, 19 Sep 2016 00:52:40 -0500 Message-ID: <1474264368-4104-2-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1474264368-4104-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: HK2PR02CA0002.apcprd02.prod.outlook.com (10.163.104.140) To BN6PR12MB1442.namprd12.prod.outlook.com (10.172.24.19) X-MS-Office365-Filtering-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nCS5yeLtVQ9WAzDb9LHbK9LIt0YMkk59IRbj0VcXHP1ln4UWzCy/km47bHcnW+awbneMcas6IlbLNV0vjSUbasl6IB8YRs6bvaiemk34EYMsV/o=; 20:7mU93VEF1M3KWe6r9kV1l2V+tJ3ly+x2bRu+ORmOs+qGXOAJ74I+IBbk6HLs1YIA3Ti8o6/ylb9xmIrwdPl3D96O6cuT3n01IbfxAGDuP3wCj+6Ye9mbDqeGDFuzS3I2ak6Mo1EYZRbHfX3/xCRe6EdyiCRPN8aN4SiBkGCwdFrlXpzoU7aXpse1hEOsz2b6ZrcVWI5mrjAc4xFZRz2irYo0jBsRm9qkjvnXIa1r7yPgw4RZCraPPj30x0RPtpeCGJjAyTuNl8fGtkwGPzkiSmVsNa4wIy9wQMaH3SvQU1FIme4CB26uFcEIN3YTRXHquiQwyhmKhWytrfNbPH/rRwfB5CNqKk3Z7M0LLMXuWSlCYS1V/cVyIQgPasj5U2G6z5I1fRtfbLLtxdQQcgGHTzaOYE9cqXJUrSTpTTwelI7cqonE5XzQq6HcE7kNz2PcYl4J7voQq4/1AGtViX2adcro/dhViheTE7UrR3rLtc+VWfQD687T/QOTPtTe2tqQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BN6PR12MB1442; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1442; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 4:+yhPe/TmuI77ySDwqg5h2JlhEEyRviE0d9mG2blEE7D+SXEnJHfy17sjuh6X3UxVl7gvRX97FgJ0gqXuZS+13dXM5vxgjd8PhQVpyYoZAAYmINiA8xq0HBsXbyhm6JlzYUSNKqcHNfSY3Lbb+20XbCDqyxOP/EpFZpKmnQl507xzAFxD887eMUnjLm7vXdbeoxnUHGD0BIPT4raXvWeYRoL9Hu8LHZZFu8hKDgF/1+6rn9Me0qCP/idPMg7/ormZzboPOutIqB4UPGsmhNjW4uXh4xnPvCmlI1KjBMFxJyQxlJkktt44aRbBbzUBHCVflO1ZVmmeIb/8Vcq45poaIhnrwkjK+5KDrmBOsl/7UPe/+uaPqumTvjuAt1T5z7REJQDMkdURUV4SmF8v02qWOEqPEEFY4IEMgfV+u8JMtf0WxIG4Nt0XB4jNb4lblPMc X-Forefront-PRVS: 0070A8666B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(86362001)(4326007)(6116002)(3846002)(42186005)(101416001)(586003)(2906002)(68736007)(189998001)(50226002)(50466002)(47776003)(97736004)(66066001)(48376002)(50986999)(76176999)(36756003)(5660300001)(81166006)(81156014)(2351001)(229853001)(110136003)(92566002)(2950100001)(105586002)(106356001)(19580405001)(7846002)(7736002)(19580395003)(5003940100001)(33646002)(8666005)(8676002)(305945005)(77096005)(7059030)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1442; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR12MB1442; 23:joMMF5QnL1X+WxV49cmFxEAnZs1CD/seAu1TT2Dip?= =?us-ascii?Q?l6Q/ZfFi7pHvjIuoPGVIyrLkuWMefzWe76SaNlw5VrltT4VyMPWwVopbiKmu?= =?us-ascii?Q?zKWWax9CMlk4R18im+XUNA8DJW712FMXtE9svAmstf1J0t4Iffpz49oyRwJc?= =?us-ascii?Q?vnfDbs2mNxTNCgXsWo00EYhVJjlTwdz/428u+nclACtYF55R8qHKnzmsbZHy?= =?us-ascii?Q?R08rXErqVA5uWVpbo5H/WI18Ws9IWoKIwv8c7piHlLiwEjVFmMaTSsWKraXL?= =?us-ascii?Q?TwDOGBNG/HG6XmFEeej+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=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 6:YjEGhtHMZ1h3XnfWDe8cTBty5PHjk09v6MpwWLkqX+dr/UORHqRnqrniemEuO75/pGXOq9A9+m8CNkGSHvij/44EW7cXs4jXbEe+etn84dVPVENitviKI+JkevuYcIO1yFRLADb1r7N6j0703O+8raJpmmwI7ms6Xnb6fWiFoXkYft29NCLYQbfDp2mqAVpjD8wLSkZavglOy1f8z1RPKA/VeQ0pfQNm2z6bHq1UNNPfxm0qmV4Mu2kegnWjiIUFcCZLVVGYo+GI70J4WH+7q0aQR82W50MWxNbLYnQkVFlcrJBgdh3OvumB+2tLQc4+1DKqkgqI3SGjg+IL0z6IUQ==; 5:D1ojRLJkGN4MdFWVtJYJojKkhuSMap4BKpugnbuDG/oOlCDurdFyaGfWl8M66nbs+QQXWp5qUpeubddoyxXt/IRpTzYx+YROsth9S5+UR08dwNP88nGh5qWJbJJWDPjLvzTWcjImi5pTN8Z4i92brw==; 24:rSVP1d4kG7+kgTHJyl766W48G88EZOaxbFfA3jEMoc32A6/noGP80ihd2uUfA0cLfKuQkfiWiD8UFY5+Dp6Kzb5eGshHu2nf6nmMd/T1GEI=; 7:Mi9VuSPN5842SSEmV8yMzhFYtJi5x5HwvnKoqq+SIy9vyNjvwBNqKfRx/sw4/d3eB3EBIadeQu06ov59ypQmTb6xj1yH8irsiY1/rhyp9kliCxaWX/AwfhyAT/eTOK+zc4fim/qCTgWPvGjP1gLe4zakVoM1XRSkVWEwKR7/wSE4RwBFJjy80R+sNl4Mi7alRXbBAwnryUf1wAJQHRXvvxM7Jdq60AU+gCiST3qi8KCQSfgqDWaW6QnxRGCSsJPs8iM5WPuUB6+jXNf6s0Q4omrb1CVTZgw2gVfR97b0L6wJyh8BzfwS4m68ikYWj6eb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1442; 20:47aeKsYqs42WiocVmOi56Hxt5Z4bl26TH2f/Tn67BkpYmg30ZzaH3GQ+JJRttlVoXIziSZgm0WD1h+Vicg5jufca7nUKMCtcUWwpIwmvSN+Q20Tgk4OiLTJVHVamdT46log+YaNEfrwlfTYaWefNDxiIceajqxRh457B/FyaCUOeNVDU/5sPUWG77xZVD8gLkrZBbE2YvuIdqmfEV1ulP/MrWfKvSinLuaHjbGk3p8kuTy4b8aPEm/jFrWcOQned X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2016 05:53:14.5771 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1442 Cc: andrew.cooper3@citrix.com, Suravee Suthikulpanit , jbeulich@suse.com, sherry.hurwitz@amd.com Subject: [Xen-devel] [RFC PATCH 1/9] 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 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 --- xen/arch/x86/hvm/vmx/vmx.c | 32 +++++++++---------- xen/include/asm-x86/hvm/domain.h | 63 ++++++++++++++++++++++++++++++++++++++ xen/include/asm-x86/hvm/hvm.h | 4 +-- xen/include/asm-x86/hvm/vmx/vmcs.h | 59 ----------------------------------- 4 files changed, 81 insertions(+), 77 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 2759e6f..8620697 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -204,12 +204,12 @@ 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.pi_switch_from = vmx_pi_switch_from; + d->arch.hvm_domain.pi_ops.pi_switch_to = vmx_pi_switch_to; + d->arch.hvm_domain.pi_ops.pi_do_resume = vmx_pi_do_resume; } /* This function is called when pcidevs_lock is held */ @@ -218,12 +218,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.pi_switch_from = NULL; + d->arch.hvm_domain.pi_ops.pi_switch_to = NULL; + d->arch.hvm_domain.pi_ops.pi_do_resume = NULL; } static int vmx_domain_initialise(struct domain *d) @@ -901,8 +901,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.pi_switch_from ) + v->domain->arch.hvm_domain.pi_ops.pi_switch_from(v); } static void vmx_ctxt_switch_to(struct vcpu *v) @@ -916,8 +916,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.pi_switch_to ) + v->domain->arch.hvm_domain.pi_ops.pi_switch_to(v); } @@ -3914,8 +3914,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.pi_do_resume ) + curr->domain->arch.hvm_domain.pi_ops.pi_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..779927b 100644 --- a/xen/include/asm-x86/hvm/domain.h +++ b/xen/include/asm-x86/hvm/domain.h @@ -72,6 +72,67 @@ struct hvm_ioreq_server { bool_t bufioreq_atomic; }; +struct hvm_pi_ops { + /* + * 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 hvm_domain { /* Guest page range used for non-default ioreq servers */ struct { @@ -148,6 +209,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 81b60d5..c832d9a 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -621,8 +621,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 {