From patchwork Wed May 4 19:09:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 67168 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp357498qge; Wed, 4 May 2016 12:10:55 -0700 (PDT) X-Received: by 10.66.229.33 with SMTP id sn1mr14435915pac.49.1462389054953; Wed, 04 May 2016 12:10:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si6356323paz.87.2016.05.04.12.10.54; Wed, 04 May 2016 12:10:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739AbcEDTKl (ORCPT + 29 others); Wed, 4 May 2016 15:10:41 -0400 Received: from mail-by2on0093.outbound.protection.outlook.com ([207.46.100.93]:44256 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754519AbcEDTKh (ORCPT ); Wed, 4 May 2016 15:10:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=EOANqzAhEVcwUF9jMUknEt+QQDpvEe7HreX4z8uFbro=; b=d3c8TgTSyDdp/LxoiIJJRBarkKJF1w1v/4xO9e1KZC69M7WfwlNw27DJYjZINHVOQLBII2ofzd7YwQzgkARKKv/B0Qizb1P4RAxmsprSoeK/mpp4o2dL+TNIZIGoxZBIwwNq4EY4kq4vdoapYCp9CNL7ozlnuvElYaDkJXd5h9w= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=amd.com; Received: from ssuthiku-cz-dev.amd.com (165.204.77.1) by BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) with Microsoft SMTP Server (TLS) id 15.1.477.8; Wed, 4 May 2016 19:10:28 +0000 From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PART1 V5 04/13] KVM: x86: Introducing kvm_x86_ops VCPU blocking/unblocking hooks Date: Wed, 4 May 2016 14:09:43 -0500 Message-ID: <1462388992-25242-5-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1462388992-25242-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BY2PR21CA0014.namprd21.prod.outlook.com (10.162.74.152) To BLUPR12MB0433.namprd12.prod.outlook.com (10.162.92.139) X-MS-Office365-Filtering-Correlation-Id: 4674f97b-eadf-4ebe-21ed-08d3744fc577 X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 2:JkhyDm/AYHk3jn4jO+kGh/KfqTKnMbqsbcWRwARxLuvqZf5vbmd36JzZhz5ndLTFN3v59FBBfPeaHhS4xRvpPE9u5vslYSqwbhGW3FkjjsIFppBqGpWradhM2qK7T8aKmGnCmbvx5KEs7sEAhtQTDkzuxAPEa34gBbY8AHz3fKAWVQhrfPSIv+wqzXwhnnir; 3:N1x5wwLD5VunL3NehMsXd0H7y8inNdsGq4z/xFygGxqgbAHm2zwf7h7ZNpatSwfOOhfDS5o5DnKmyZp1smjjPVOg8jNqMcOmOiCTAnXrn8ZH2+O9WDVR1Dyzdzkq4Xkk; 25:N0Gw7/fkoAZxhHk2myO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EJYzgaS4CVC1NCzeiOE/9c2uVC7SCKEPLgfw9xzIFN4vu/zkqMcXnbSDaVT2Q1udObYwKQEoaCDflTcTVfhdP+0nJtohxRBr/sSFSFO53a6n2ztFEYCecprpeOln9+2jtJfiQ4alqq0sWre8MPCBGvm98JkExWlLQB20SKtiCtjV16RqbiBjbF0dv8k0OoN79rwww9mpOK0m5ODQVdQT/XQi4j/mQahz/jVX4lnsk/TdIcloE+dFotiit9pEAsgh2AIRzAGwbQJ/2YqVGDaWVi5gE8utGr8d4kgSa7G X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(9101528026)(9101521098)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026); SRVR:BLUPR12MB0433; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0433; X-Forefront-PRVS: 093290AD39 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(50986999)(76176999)(50226002)(47776003)(66066001)(229853001)(36756003)(189998001)(19580395003)(19580405001)(2906002)(2950100001)(5003940100001)(53416004)(2201001)(5004730100002)(92566002)(4326007)(5001770100001)(77096005)(586003)(42186005)(5008740100001)(81166005)(48376002)(3846002)(6116002)(86362001)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0433; H:ssuthiku-cz-dev.amd.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0433; 23:zOI01nN1ywxMcS8rm08d2owEZ0tlZHpAuoNwfyT11BvoqpE5FBmC2Mmxv8TFyEYyh9LwOgoJEjbiVTCeRr9RjWdRL7loX4TvLbBTp5xStjS1OIOTRW5VxkDq1PQ0PVXA7zPuRnaBEf2fLlSenF6a/Zr9epXb70gzQZh9aC4DM6o2a/X96+UktL5eh/8GIEP2ObTg+ZuuKDvnjz3g4qhS2nEpNrDhJwVvqYJ0RMBbCD0n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Xr9hsB3qu3qzc1icYaCjbzCQOsOslKpC2o1Koo6kQrP3en8m4QhQ=; 20:JdIjPTagUlxrZPoJ/leVsfbBLRL8w36lVD+ZhlWFROvJPwjwaD7g7bk52toyWAoToQACPOqh76b+g2qwYs5bGIxEdFExxpnC4Ojz+EMIOw7WyLoqzb3pbCt9CzTto9PTsYZeHcEQB4vjBSkVAbkBSc+i3EjLvSaR41xYiDZ6K9o98ltoQyNHNFFUa7VdrVGxq3ICsxZiJx1y+ymW7cHnXqSfeIaxBWNqCXdH7hcrBEJolOe3+TTWDnMemiecAzCY X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 May 2016 19:10:28.5713 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0433 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding new function pointer in struct kvm_x86_ops, and calling them from the kvm_arch_vcpu[blocking/unblocking]. Signed-off-by: Suravee Suthikulpanit Reviewed-by: Paolo Bonzini --- arch/x86/include/asm/kvm_host.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 1.9.1 diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 353d61b..1454859 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -993,6 +993,10 @@ struct kvm_x86_ops { */ int (*pre_block)(struct kvm_vcpu *vcpu); void (*post_block)(struct kvm_vcpu *vcpu); + + void (*vcpu_blocking)(struct kvm_vcpu *vcpu); + void (*vcpu_unblocking)(struct kvm_vcpu *vcpu); + int (*update_pi_irte)(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, bool set); }; @@ -1344,7 +1348,16 @@ bool kvm_intr_is_single_vcpu(struct kvm *kvm, struct kvm_lapic_irq *irq, void kvm_set_msi_irq(struct kvm_kernel_irq_routing_entry *e, struct kvm_lapic_irq *irq); -static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) {} -static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) {} +static inline void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu) +{ + if (kvm_x86_ops->vcpu_blocking) + kvm_x86_ops->vcpu_blocking(vcpu); +} + +static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu) +{ + if (kvm_x86_ops->vcpu_unblocking) + kvm_x86_ops->vcpu_unblocking(vcpu); +} #endif /* _ASM_X86_KVM_HOST_H */