From patchwork Wed Jan 27 03:25:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zheng, Jiajia" X-Patchwork-Id: 43765 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 70F87B7E04 for ; Wed, 27 Jan 2010 14:34:42 +1100 (EST) Received: from localhost ([127.0.0.1]:46012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZyZZ-0002uz-F2 for incoming@patchwork.ozlabs.org; Tue, 26 Jan 2010 22:28:05 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZyYG-0002su-8O for qemu-devel@nongnu.org; Tue, 26 Jan 2010 22:26:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZyYB-0002oa-Kr for qemu-devel@nongnu.org; Tue, 26 Jan 2010 22:26:43 -0500 Received: from [199.232.76.173] (port=46870 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZyYB-0002oG-5w for qemu-devel@nongnu.org; Tue, 26 Jan 2010 22:26:39 -0500 Received: from mga11.intel.com ([192.55.52.93]:40204) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZyYA-0001Kv-S6 for qemu-devel@nongnu.org; Tue, 26 Jan 2010 22:26:39 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 26 Jan 2010 19:25:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.49,349,1262592000"; d="scan'208";a="767620601" Received: from pgsmsx602.gar.corp.intel.com ([10.221.43.81]) by fmsmga001.fm.intel.com with ESMTP; 26 Jan 2010 19:26:30 -0800 Received: from shzsmsx502.ccr.corp.intel.com (10.239.4.97) by pgsmsx602.gar.corp.intel.com (10.221.43.81) with Microsoft SMTP Server (TLS) id 8.2.176.0; Wed, 27 Jan 2010 11:25:26 +0800 Received: from shzsmsx502.ccr.corp.intel.com ([10.239.4.97]) by shzsmsx502.ccr.corp.intel.com ([10.239.4.97]) with mapi; Wed, 27 Jan 2010 11:25:24 +0800 From: "Zheng, Jiajia" To: "avi@redhat.com" , "lmr@redhat.com" , "qemu-devel@nongnu.org" Date: Wed, 27 Jan 2010 11:25:23 +0800 Thread-Topic: [Patch] Support translating Guest physical address to Host virtual address. Thread-Index: AcqfAFyGNsSn2L3zRAyVNrvcxlr28w== Message-ID: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: zh-CN, en-US MIME-Version: 1.0 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: "Kleen, Andi" , "Li, Haicheng" , Max Asbock , "You, Yongkang" Subject: [Qemu-devel] [Patch] Support translating Guest physical address to Host virtual address. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add command p2v to translate Guest physical address to Host virtual address. Signed-off-by: Max Asbock Jiajia Zheng diff --git a/monitor.c b/monitor.c index b33b01f..83d9ac7 100644 --- a/monitor.c +++ b/monitor.c @@ -668,6 +668,11 @@ static void do_info_uuid(Monitor *mon, QObject **ret_data) *ret_data = qobject_from_jsonf("{ 'UUID': %s }", uuid); } +static void do_info_p2v(Monitor *mon) +{ + monitor_printf(mon, "p2v implemented\n"); +} + /* get the current CPU defined by the user */ static int mon_set_cpu(int cpu_index) { @@ -2283,6 +2288,14 @@ static void do_inject_mce(Monitor *mon, const QDict *qdict) break; } } +static void do_p2v(Monitor *mon, const QDict *qdict) +{ + target_long size = 4096; + target_long addr = qdict_get_int(qdict, "addr"); + + monitor_printf(mon, "Guest physical address %p is mapped at host virtual address %p\n", (void *)addr, cpu_physical_memory_map( (target_phys_addr_t)addr, (target_phys_addr_t *)&size, 0)); +} + #endif static void do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data) @@ -2659,6 +2672,13 @@ static const mon_cmd_t info_cmds[] = { .mhandler.info = do_info_qdm, }, { + .name = "p2v", + .args_type = "", + .params = "", + .help = "translate guest physical to host virtual address", + .mhandler.info = do_info_p2v, + }, + { .name = "roms", .args_type = "", .params = "", diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 9e3ea3c..ab9743c 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -326,6 +326,16 @@ Start gdbserver session (default @var{port}=1234) ETEXI { + .name = "p2v", + .args_type = "fmt:/,addr:l", + .params = "/fmt addr", + .help = "translate guest physical 'addr' to host virtual address", + .mhandler.cmd = do_p2v, + }, +STEXI +ETEXI + + { .name = "x", .args_type = "fmt:/,addr:l", .params = "/fmt addr",