From patchwork Wed Jan 21 03:44:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Xiantao" X-Patchwork-Id: 3384 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0L3ePIJ014651 for ; Tue, 20 Jan 2009 19:40:26 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756696AbZAUDpA (ORCPT ); Tue, 20 Jan 2009 22:45:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756850AbZAUDpA (ORCPT ); Tue, 20 Jan 2009 22:45:00 -0500 Received: from mga01.intel.com ([192.55.52.88]:51377 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756696AbZAUDo4 (ORCPT ); Tue, 20 Jan 2009 22:44:56 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 20 Jan 2009 19:34:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.37,298,1231142400"; d="scan'208,223";a="658785461" Received: from unknown (HELO azsmsx601.amr.corp.intel.com) ([10.2.121.193]) by fmsmga001.fm.intel.com with ESMTP; 20 Jan 2009 19:45:21 -0800 Received: from pdsmsx601.ccr.corp.intel.com (172.16.12.94) by azsmsx601.amr.corp.intel.com (10.2.121.193) with Microsoft SMTP Server (TLS) id 8.1.311.2; Tue, 20 Jan 2009 20:44:52 -0700 Received: from pdsmsx503.ccr.corp.intel.com ([172.16.12.95]) by pdsmsx601.ccr.corp.intel.com ([172.16.12.94]) with mapi; Wed, 21 Jan 2009 11:44:50 +0800 From: "Zhang, Xiantao" To: "kvm-ia64@vger.kernel.org" CC: Avi Kivity , "kvm@vger.kernel.org" , "linux-ia64@vger.kernel.org" Date: Wed, 21 Jan 2009 11:44:49 +0800 Subject: [PATCH 02/03] KVM: ia64: Add the support for translating PAL Call's pointer args. Thread-Topic: [PATCH 02/03] KVM: ia64: Add the support for translating PAL Call's pointer args. Thread-Index: Acl7epwj7BI10YM8QG2jjkeoTYVwGA== Message-ID: <706158FABBBA044BAD4FE898A02E4BC2223BCE98@pdsmsx503.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From 635b75a4df55771f65ce7c40268a18d528114769 Mon Sep 17 00:00:00 2001 From: Xiantao Zhang Date: Thu, 15 Jan 2009 18:08:36 +0800 Subject: [PATCH] KVM: ia64: Add the support for translating PAL Call's pointer args. Add the support to translate PAL Call's pointer args. Signed-off-by: Xiantao Zhang --- arch/ia64/kvm/process.c | 48 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 45 insertions(+), 3 deletions(-) diff --git a/arch/ia64/kvm/process.c b/arch/ia64/kvm/process.c index e206244..6ed0347 100644 --- a/arch/ia64/kvm/process.c +++ b/arch/ia64/kvm/process.c @@ -549,18 +549,60 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim, inject_guest_interruption(vcpu, vector); } +static unsigned long kvm_trans_pal_call_args(struct kvm_vcpu *vcpu, + unsigned long arg) +{ + struct thash_data *data; + unsigned long gpa, poff; + + if (!is_physical_mode(vcpu)) { + /* Depends on caller to provide the DTR or DTC mapping.*/ + data = vtlb_lookup(vcpu, arg, D_TLB); + if (data) + gpa = data->page_flags & _PAGE_PPN_MASK; + else { + data = vhpt_lookup(arg); + if (!data) + return 0; + gpa = data->gpaddr & _PAGE_PPN_MASK; + } + + poff = arg & (PSIZE(data->ps) - 1); + arg = PAGEALIGN(gpa, data->ps) | poff; + } + arg = kvm_gpa_to_mpa(arg << 1 >> 1); + + return (unsigned long)__va(arg); +} + static void set_pal_call_data(struct kvm_vcpu *vcpu) { struct exit_ctl_data *p = &vcpu->arch.exit_data; + unsigned long gr28 = vcpu_get_gr(vcpu, 28); + unsigned long gr29 = vcpu_get_gr(vcpu, 29); + unsigned long gr30 = vcpu_get_gr(vcpu, 30); /*FIXME:For static and stacked convention, firmware * has put the parameters in gr28-gr31 before * break to vmm !!*/ - p->u.pal_data.gr28 = vcpu_get_gr(vcpu, 28); - p->u.pal_data.gr29 = vcpu_get_gr(vcpu, 29); - p->u.pal_data.gr30 = vcpu_get_gr(vcpu, 30); + switch (gr28) { + case PAL_PERF_MON_INFO: + case PAL_HALT_INFO: + p->u.pal_data.gr29 = kvm_trans_pal_call_args(vcpu, gr29); + p->u.pal_data.gr30 = vcpu_get_gr(vcpu, 30); + break; + case PAL_BRAND_INFO: + p->u.pal_data.gr29 = gr29;; + p->u.pal_data.gr30 = kvm_trans_pal_call_args(vcpu, gr30); + break; + default: + p->u.pal_data.gr29 = gr29;; + p->u.pal_data.gr30 = vcpu_get_gr(vcpu, 30); + } + p->u.pal_data.gr28 = gr28; p->u.pal_data.gr31 = vcpu_get_gr(vcpu, 31); + p->exit_reason = EXIT_REASON_PAL_CALL; }