From patchwork Thu Apr 7 08:20:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 65241 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp334856lbc; Thu, 7 Apr 2016 01:35:53 -0700 (PDT) X-Received: by 10.66.171.75 with SMTP id as11mr3126716pac.36.1460018152935; Thu, 07 Apr 2016 01:35:52 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si10327217pfa.10.2016.04.07.01.35.52; Thu, 07 Apr 2016 01:35:52 -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 S1755379AbcDGIfu (ORCPT + 29 others); Thu, 7 Apr 2016 04:35:50 -0400 Received: from mail-bn1bon0083.outbound.protection.outlook.com ([157.56.111.83]:49755 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751260AbcDGIfr (ORCPT ); Thu, 7 Apr 2016 04:35:47 -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=/Q54S4Tt18s0RJk8KIkpqkbm3Oz8E+dOFy450SnEW6c=; b=sQOG5RyGq1n6XQewVAmDgY0M9JySpvptUCfe7nuL4eNUJ9BnH/nLdjYz4MxObdKom5FT6irnRVknv7l6amoVioAGk3cFapbM/aaq37KJgUnrLIa+b4IvzS6JhN1ElrWSIO+ube5pBFtdaYmJ9cxZTZVBNPUEpGFYbJ0pkNpeGuM= 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 SN1PR12MB0445.namprd12.prod.outlook.com (10.162.105.139) with Microsoft SMTP Server (TLS) id 15.1.447.15; Thu, 7 Apr 2016 08:21:19 +0000 From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PART1 RFC v4 03/11] KVM: x86: Introducing kvm_x86_ops VCPU blocking/unblocking hooks Date: Thu, 7 Apr 2016 03:20:24 -0500 Message-ID: <1460017232-17429-4-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: KL1PR02CA0009.apcprd02.prod.outlook.com (10.165.15.19) To SN1PR12MB0445.namprd12.prod.outlook.com (10.162.105.139) X-MS-Office365-Filtering-Correlation-Id: 0b2c7e61-5f68-43ce-93ba-08d35ebd9dc2 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 2:BKGjw7H1LSIsS4Z5aROBjfjViwcOdPqHXSUZb8eMgdmQc0EKwXvlrnjSZlLCO9qtFsyB5jNWA96mL/Iwqxa9BxMPU0Vs6Ph/MxsrRy+Z24J6mi3D0BSExBGXfCjCRoB191XFbwYKTgKhUc3Q2IctmvRB9PdYFXhBy10g+256JuEaxAnGVrk8HvTg61hEcyA3; 3:NY0aDCxg0iklkPkgwOqQuEweX+zu2FqcXFWFsnB5otSi0XADGxbRJXEgoGiD0f3nQ4DuTnxXz7czDp5Zk838hyYuwqM6Fd6EUVYCRnGc5w9qhjh940GC21K6FXee0WZW; 25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LycRE9J/o52Uc6Fk9ZEaSdbeuP4hdQJPTOFliSAXrVagDUoPFPdq6ldXz60dfCstHKKyb6gD3I2+wQt3+OYrC2PzurT0rauDV2Z9C42TYIgrEoCKRnX3TgzuUmfA0ZLozasr5ymmsbP1jxjWh241Z1GEKA+bnBOOpJcPNGxnnTKSslVzdE9J3MiJgj3LMCkx8SGcjMR8r1WGkyUTtvWhbY+SkqrOvEu/nlJyHwzq8NlhvdeiVLFpQlls4o5jxbXu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:SN1PR12MB0445; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0445; X-Forefront-PRVS: 0905A6B2C7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(50226001)(86362001)(19580395003)(2201001)(229853001)(19580405001)(81166005)(66066001)(5008740100001)(6116002)(1096002)(586003)(42186005)(3846002)(48376002)(2906002)(50466002)(5001770100001)(4326007)(36756003)(2950100001)(47776003)(5003940100001)(76176999)(92566002)(50986999)(77096005)(189998001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0445; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 23:2cs95G0P6LtDU+Iq6uw1MbypWgdReD7OjIuE+Homb0ghEueOt4eDHMv/ewM7//8P9Li7BFvR/AuHzoi0p9GCxuTT5AyOu8idJWT9ZGgjjG0C7EdHmTIiRfyMqRhQMGvXmoi0QJmZCnZhqMPmXXuFieEMM218fAeWGKZ3yxTSMdh9Gece0JZXu++S1mZ3f/91uVSubx+1QB/nENgXoOZS40EzX75KkaoZtx3DYxL/9HBvaBO65o/LOxxBN5bvOBcSvQRi0Ud94sLIKYyLUf0jAgGX95zOSe7KPUXl6sSg0+8Z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XzUGN3rX+1OJ/Gt0Q6D6Zz/V10mz/Xv7IVOqjCI4PtMdc X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2016 08:21:19.1566 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0445 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 22bd70c..2268f4c 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 */