qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Qemu-devel] [Patch] Support translating Guest physical address to H


From: Zheng, Jiajia
Subject: RE: [Qemu-devel] [Patch] Support translating Guest physical address to Host virtual address.
Date: Wed, 3 Feb 2010 12:04:26 +0800

Hi, 
Any futher comments for this patch so that we can modify?

thanks, 
jiajia

Max Asbock wrote:
> On Wed, 2010-01-27 at 15:39 -0600, Anthony Liguori wrote:
>> On 01/26/2010 09:25 PM, Zheng, Jiajia wrote:
>>> Add command p2v to translate Guest physical address to Host virtual
>>> address. 
>>> 
>> 
>> For what purpose?
>> 
>>> Signed-off-by: Max Asbock<address@hidden>
>>>             Jiajia Zheng<address@hidden>
>>> ---
>>> 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");
>>> +}
>>> 
>> 
>> These should be implemented as QMP commands.
>> 
>>>   /* 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));  
>>> 
>> 
>> This isn't quite right.  It assumes TARGET_PAGE_SIZE is 4k which is
>> certainly not always true.  It also assumes that
>> cpu_physical_memory_map() something that has some meaning which isn't
>> necessarily the case.  It could be a pointer to a bounce buffer.
>> 
>> Could you give an end-to-end description of how you expect this
>> mechanism to be used so we can work out a more appropriate set of
>> interfaces.  I assume this is MCE related.
>> 
> 
> The purpose of this is to translate a guest physical address to a host
> virtual address.
> This was indeed used for MCE testing. The p2v command provides one
> step in a chain of translations from guest virtual to guest physical
> to host virtual to host physical. Host physical is then used to
> inject a machine check error. As a consequence the HPOISON code on
> the host and the MCE injection code in qemu are exercised.
> I was always assuming that this implementation perhaps isn't the most
> optimal, but it simply worked for our test case.
> 
> What would an appropriate method be to get a host virtual address for
> guest physical address that represents a page of RAM?
> 
> thanks,
> Max





reply via email to

[Prev in Thread] Current Thread [Next in Thread]