From patchwork Fri Mar 18 06:09:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 64025 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp870597lbc; Thu, 17 Mar 2016 23:14:55 -0700 (PDT) X-Received: by 10.98.19.2 with SMTP id b2mr19085158pfj.93.1458281694920; Thu, 17 Mar 2016 23:14:54 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id co4si66782pad.101.2016.03.17.23.14.54; Thu, 17 Mar 2016 23:14: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; 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; dkim=pass header.i=@amdcloud.onmicrosoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752817AbcCRGOi (ORCPT + 30 others); Fri, 18 Mar 2016 02:14:38 -0400 Received: from mail-bn1on0058.outbound.protection.outlook.com ([157.56.110.58]:33350 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756851AbcCRGKy (ORCPT ); Fri, 18 Mar 2016 02:10:54 -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=J/6nu+mPYmfTXJWMvtqt3qSxyf+E6FSxr6JAx15S6sY=; b=4kVDlvHCORJZQyKP7DsXcuekM92n5Y0+G1aydpeHFjLJSVuiS2bpktOWyrpSP+Q5IYcQcS1+/AB92ea+awc8w7Mok+LEb2WHac3g8qo6s93TCwmNMbBU1SJcPSWGCfojsTroqLWQg/KCyeT+ETL4cMjc11ya+Dos6oH/xO6vkXo= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=amd.com; Received: from localhost.localdomain (124.121.8.20) by BY1PR12MB0437.namprd12.prod.outlook.com (10.162.147.139) with Microsoft SMTP Server (TLS) id 15.1.443.12; Fri, 18 Mar 2016 06:10:42 +0000 From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PART1 RFC v3 03/12] KVM: x86: Introducing kvm_x86_ops VCPU blocking/unblocking hooks Date: Fri, 18 Mar 2016 01:09:39 -0500 Message-ID: <1458281388-14452-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458281388-14452-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1458281388-14452-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: SG2PR04CA0047.apcprd04.prod.outlook.com (25.169.49.143) To BY1PR12MB0437.namprd12.prod.outlook.com (25.162.147.139) X-MS-Office365-Filtering-Correlation-Id: 85bd600e-fff7-43d1-ad04-08d34ef40e3b X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 2:MokR91p3wEeDZhMJQBph7pS57sNbqHjF8oauplxkyd3MJAQmG5ajj05lsCY9ug10YYKTSzW9YZqVD0wAmq8CSAHD3IX8RmWa2XL2b57QrvVhJUyU2JGB9Kcuu2i012oJun1VCC5WwCWa+K8bw4ykHfBTo1WPq05bLnjYfAPOFafh/xrmFioQHOSm64yvyAwj; 3:cc/nJqGn494CkCOPVq3KWmXfHCEyNP2puieHWfj8fStXv7lQTb/dQ0tYbzpbzph2PoIVw5LBCOBjrTSphRzXgYlOddu7dJ9WMcZdRx5tv/oYEW3sIth9apEi9DO03w0v; 25:3VDheXAt77WyW3bpIe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/Rr6btazYaypE+3ir/wFWKoNICLvfOutuHE1q3qCidM5FRq; 4:Q7BAgvL+fviJqx03xs7OhjdEehRFQXnTloeaWswaSkVWZYRo+8HPqAbY54g74kuhImvBl4/IEFwgTbLNhly/TGt46tBaY6z7S6rwJfEx+ULuTB7DihcoXgbHXrxX7xb+7P6WReT+POpltNpXAIImmW687/lLM+5qXFRsnaFp4EmkbNLxoTQgeENI56Rrd1yLf8bQFdzXb884/ZC+7W7OtUnzMRL3R7qHhJBAjudxTn3HNat0LIttujBQjbVfOqqqaYhIBD+NK6oiDjLE79cWvSBBwcGWPFXUv9zlUtjC7xHBzGcS9dbPDIST5rYp5NGrTG0p8udW+Nnbt3wmYZcRik7V59ox8qNV8jk1MjKWyzawNLbkgRpQmXb/diZYffB1 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BY1PR12MB0437; BCL:0; PCL:0; RULEID:; SRVR:BY1PR12MB0437; X-Forefront-PRVS: 088552DE73 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(189998001)(66066001)(19580395003)(19580405001)(47776003)(42186005)(3846002)(5001770100001)(50226001)(6116002)(2201001)(86362001)(575784001)(586003)(229853001)(2950100001)(36756003)(5004730100002)(77096005)(81166005)(5003940100001)(4326007)(50466002)(92566002)(48376002)(5008740100001)(76176999)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR12MB0437; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY1PR12MB0437; 23:NceaDJkJ6fp/oMLIyQ7+XBZuzit0Dc3H7GbXwUdT8BWtVOY4Lxp4kl+RPTA+FHNhn6YsUOxLomuyBzRJk2WgxVWtgpmfVWqGSwLre3JStb4YQEWUjq6bJ7LL+qFlEHMbx5++B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pbyUKvYadop61l9zDbqKf02yEzHu4hMZGxuft2Xd/i29WexrYHp0rSex+1y9xVS+A5CwNWYQ5fkIb4iXL8AdcRKdVt7H0Mo71o5Mt1zWQ6LcszntAbFcUEqPYEDA66cP5FvIagetIGViC1DfdSzZ7XO8PQ5T82ihvjoLeL+9bhBhsfknMQ9VL2sgBxt9RWy1UdyamKLe3LeOurNqyEIBoEZ6kobd2uzeTz2Uiy0ThWamtjxtiwT5K6 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2016 06:10:42.5429 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR12MB0437 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 --- 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 4b0dd0f..87eac2a 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -972,6 +972,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); }; @@ -1323,7 +1327,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 */