From patchwork Mon May 5 01:28:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 4111301 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 679269F44A for ; Mon, 5 May 2014 01:28:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B92EA20414 for ; Mon, 5 May 2014 01:28:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C185C20254 for ; Mon, 5 May 2014 01:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754169AbaEEB21 (ORCPT ); Sun, 4 May 2014 21:28:27 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:55044 "EHLO e23smtp08.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754091AbaEEB2E (ORCPT ); Sun, 4 May 2014 21:28:04 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 5 May 2014 11:28:02 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 5 May 2014 11:28:00 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id ED9972CE8055; Mon, 5 May 2014 11:27:59 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s4516i0H51839214; Mon, 5 May 2014 11:06:44 +1000 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s451RwlA013873; Mon, 5 May 2014 11:27:59 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s451Rw86013866; Mon, 5 May 2014 11:27:58 +1000 Received: from shangw (haven.au.ibm.com [9.190.164.82]) by ozlabs.au.ibm.com (Postfix) with ESMTP id A30A2A0117; Mon, 5 May 2014 11:27:58 +1000 (EST) Received: by shangw (Postfix, from userid 1000) id 908FD3E0370; Mon, 5 May 2014 11:28:20 +1000 (EST) From: Gavin Shan To: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Cc: alex.williamson@redhat.com, benh@kernel.crashing.org, aik@ozlabs.ru, qiudayu@linux.vnet.ibm.com, Gavin Shan Subject: [PATCH 17/22] powerpc/kvm: Connect EEH RTAS emulation backend Date: Mon, 5 May 2014 11:28:06 +1000 Message-Id: <1399253291-3975-18-git-send-email-gwshan@linux.vnet.ibm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1399253291-3975-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1399253291-3975-1-git-send-email-gwshan@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14050501-5140-0000-0000-0000050CCCF4 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The patch intends to connect the KVM module with the backend for EEH RTAS emulation. In turn, we can handle the EEH RTAS services from the guest. Signed-off-by: Gavin Shan --- arch/powerpc/include/asm/kvm_ppc.h | 7 +++++++ arch/powerpc/kvm/book3s_rtas.c | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h index 4096f16..18b51a1 100644 --- a/arch/powerpc/include/asm/kvm_ppc.h +++ b/arch/powerpc/include/asm/kvm_ppc.h @@ -29,6 +29,9 @@ #include #include #include +#ifdef CONFIG_KVM_EEH +#include +#endif #ifdef CONFIG_PPC_BOOK3S #include #else @@ -166,6 +169,10 @@ int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq); extern int kvm_vm_ioctl_rtas_define_token(struct kvm *kvm, void __user *argp); extern int kvmppc_rtas_hcall(struct kvm_vcpu *vcpu); extern void kvmppc_rtas_tokens_free(struct kvm *kvm); +#ifdef CONFIG_KVM_EEH +extern void kvmppc_eeh_rtas(struct kvm_vcpu *vcpu, + struct rtas_args *args, int flag); +#endif extern int kvmppc_xics_set_xive(struct kvm *kvm, u32 irq, u32 server, u32 priority); extern int kvmppc_xics_get_xive(struct kvm *kvm, u32 irq, u32 *server, diff --git a/arch/powerpc/kvm/book3s_rtas.c b/arch/powerpc/kvm/book3s_rtas.c index 7a05315..17bdb4a 100644 --- a/arch/powerpc/kvm/book3s_rtas.c +++ b/arch/powerpc/kvm/book3s_rtas.c @@ -16,6 +16,8 @@ #include #include #include +#include +#include #ifdef CONFIG_KVM_XICS static void kvm_rtas_set_xive(struct kvm_vcpu *vcpu, struct rtas_args *args) @@ -103,6 +105,24 @@ out: } #endif /* CONFIG_KVM_XICS */ +#ifdef CONFIG_KVM_EEH + +#define KVM_RTAS_EEH_FUNC(name, flag) \ +static void kvm_rtas_eeh_##name(struct kvm_vcpu *vcpu, \ + struct rtas_args *args) \ +{ \ + kvmppc_eeh_rtas(vcpu, args, flag); \ +} + +KVM_RTAS_EEH_FUNC(set_option, eeh_rtas_set_option) +KVM_RTAS_EEH_FUNC(set_reset, eeh_rtas_set_slot_reset) +KVM_RTAS_EEH_FUNC(read_state2, eeh_rtas_read_slot_reset_state2) +KVM_RTAS_EEH_FUNC(addr_info2, eeh_rtas_get_config_addr_info2) +KVM_RTAS_EEH_FUNC(error_detail, eeh_rtas_slot_error_detail) +KVM_RTAS_EEH_FUNC(configure_pe, eeh_rtas_configure_pe) + +#endif /* CONFIG_KVM_EEH */ + struct rtas_handler { void (*handler)(struct kvm_vcpu *vcpu, struct rtas_args *args); char *name; @@ -115,6 +135,26 @@ static struct rtas_handler rtas_handlers[] = { { .name = "ibm,int-off", .handler = kvm_rtas_int_off }, { .name = "ibm,int-on", .handler = kvm_rtas_int_on }, #endif +#ifdef CONFIG_KVM_EEH + { .name = "ibm,set-eeh-option", + .handler = kvm_rtas_eeh_set_option + }, + { .name = "ibm,set-slot-reset", + .handler = kvm_rtas_eeh_set_reset + }, + { .name = "ibm,read-slot-reset-state2", + .handler = kvm_rtas_eeh_read_state2 + }, + { .name = "ibm,get-config-addr-info2", + .handler = kvm_rtas_eeh_addr_info2 + }, + { .name = "ibm,slot-error-detail", + .handler = kvm_rtas_eeh_error_detail + }, + { .name = "ibm,configure-pe", + .handler = kvm_rtas_eeh_configure_pe + } +#endif /* CONFIG_KVM_EEH */ }; struct rtas_token_definition {