qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support
@ 2020-03-30  3:25 hang.yuan
  2020-03-30  3:53 ` Colin Xu
  0 siblings, 1 reply; 4+ messages in thread
From: hang.yuan @ 2020-03-30  3:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Hang Yuan, colin.xu, wenchao.wang

From: Hang Yuan <hang.yuan@linux.intel.com>

Add ROM and ROM device memory region support in HAX. Their memory region is
read only and write access will generate EPT violation. The violation will be
handled in the HAX kernel with the following patch.

https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28

v2: fix coding style problems

Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
---
 target/i386/hax-mem.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c
index 6bb5a24917..a8bfd37977 100644
--- a/target/i386/hax-mem.c
+++ b/target/i386/hax-mem.c
@@ -175,13 +175,10 @@ static void hax_process_section(MemoryRegionSection *section, uint8_t flags)
     uint64_t host_va;
     uint32_t max_mapping_size;
 
-    /* We only care about RAM and ROM regions */
-    if (!memory_region_is_ram(mr)) {
-        if (memory_region_is_romd(mr)) {
-            /* HAXM kernel module does not support ROMD yet  */
-            warn_report("Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64,
-                        start_pa, start_pa + size);
-        }
+    /* We only care about RAM/ROM regions and ROM device */
+    if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) {
+        flags |= HAX_RAM_INFO_ROM;
+    } else if (!memory_region_is_ram(mr)) {
         return;
     }
 
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support
  2020-03-30  3:25 [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support hang.yuan
@ 2020-03-30  3:53 ` Colin Xu
  2020-04-28  2:45   ` Colin Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Xu @ 2020-03-30  3:53 UTC (permalink / raw)
  To: hang.yuan, qemu-devel; +Cc: wenchao.wang

Looks good to me.

Reviewed-by: Colin Xu <colin.xu@intel.com>

On 2020-03-30 11:25, hang.yuan@linux.intel.com wrote:
> From: Hang Yuan <hang.yuan@linux.intel.com>
>
> Add ROM and ROM device memory region support in HAX. Their memory region is
> read only and write access will generate EPT violation. The violation will be
> handled in the HAX kernel with the following patch.
>
> https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28
>
> v2: fix coding style problems
>
> Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
> ---
>   target/i386/hax-mem.c | 11 ++++-------
>   1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c
> index 6bb5a24917..a8bfd37977 100644
> --- a/target/i386/hax-mem.c
> +++ b/target/i386/hax-mem.c
> @@ -175,13 +175,10 @@ static void hax_process_section(MemoryRegionSection *section, uint8_t flags)
>       uint64_t host_va;
>       uint32_t max_mapping_size;
>   
> -    /* We only care about RAM and ROM regions */
> -    if (!memory_region_is_ram(mr)) {
> -        if (memory_region_is_romd(mr)) {
> -            /* HAXM kernel module does not support ROMD yet  */
> -            warn_report("Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64,
> -                        start_pa, start_pa + size);
> -        }
> +    /* We only care about RAM/ROM regions and ROM device */
> +    if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) {
> +        flags |= HAX_RAM_INFO_ROM;
> +    } else if (!memory_region_is_ram(mr)) {
>           return;
>       }
>   

-- 
Best Regards,
Colin Xu



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support
  2020-03-30  3:53 ` Colin Xu
@ 2020-04-28  2:45   ` Colin Xu
  2020-04-28  8:11     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Xu @ 2020-04-28  2:45 UTC (permalink / raw)
  To: Colin Xu, Paolo Bonzini; +Cc: hang.yuan, qemu-devel, Wang, Wenchao


Hi Paolo,

Would you please queue this one?
--
Best Regards,
Colin Xu

On Mon, 30 Mar 2020, Colin Xu wrote:

> Looks good to me.
>
> Reviewed-by: Colin Xu <colin.xu@intel.com>
>
> On 2020-03-30 11:25, hang.yuan@linux.intel.com wrote:
>> From: Hang Yuan <hang.yuan@linux.intel.com>
>>
>> Add ROM and ROM device memory region support in HAX. Their memory region is
>> read only and write access will generate EPT violation. The violation will be
>> handled in the HAX kernel with the following patch.
>>
>> https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28
>>
>> v2: fix coding style problems
>>
>> Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
>> ---
>>   target/i386/hax-mem.c | 11 ++++-------
>>   1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c
>> index 6bb5a24917..a8bfd37977 100644
>> --- a/target/i386/hax-mem.c
>> +++ b/target/i386/hax-mem.c
>> @@ -175,13 +175,10 @@ static void hax_process_section(MemoryRegionSection *section, uint8_t flags)
>>       uint64_t host_va;
>>       uint32_t max_mapping_size;
>>
>> -    /* We only care about RAM and ROM regions */
>> -    if (!memory_region_is_ram(mr)) {
>> -        if (memory_region_is_romd(mr)) {
>> -            /* HAXM kernel module does not support ROMD yet  */
>> -            warn_report("Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64,
>> -                        start_pa, start_pa + size);
>> -        }
>> +    /* We only care about RAM/ROM regions and ROM device */
>> +    if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) {
>> +        flags |= HAX_RAM_INFO_ROM;
>> +    } else if (!memory_region_is_ram(mr)) {
>>           return;
>>       }
>>
>
> -- 
> Best Regards,
> Colin Xu
>
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support
  2020-04-28  2:45   ` Colin Xu
@ 2020-04-28  8:11     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  8:11 UTC (permalink / raw)
  To: Colin Xu, Paolo Bonzini; +Cc: hang.yuan, qemu-devel, Wang, Wenchao

On 4/28/20 4:45 AM, Colin Xu wrote:
> 
> Hi Paolo,
> 
> Would you please queue this one?
> -- 
> Best Regards,
> Colin Xu
> 
> On Mon, 30 Mar 2020, Colin Xu wrote:
> 
>> Looks good to me.
>>
>> Reviewed-by: Colin Xu <colin.xu@intel.com>
>>
>> On 2020-03-30 11:25, hang.yuan@linux.intel.com wrote:
>>> From: Hang Yuan <hang.yuan@linux.intel.com>
>>>
>>> Add ROM and ROM device memory region support in HAX. Their memory 
>>> region is
>>> read only and write access will generate EPT violation. The violation 
>>> will be
>>> handled in the HAX kernel with the following patch.

"will be"? This patch is 10 months old.

>>>
>>> https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28 
>>>
>>>
>>> v2: fix coding style problems

^ This line goes ...

>>>
>>> Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
>>> ---

... here after the '---'.

>>>   target/i386/hax-mem.c | 11 ++++-------
>>>   1 file changed, 4 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c
>>> index 6bb5a24917..a8bfd37977 100644
>>> --- a/target/i386/hax-mem.c
>>> +++ b/target/i386/hax-mem.c
>>> @@ -175,13 +175,10 @@ static void 
>>> hax_process_section(MemoryRegionSection *section, uint8_t flags)
>>>       uint64_t host_va;
>>>       uint32_t max_mapping_size;
>>>
>>> -    /* We only care about RAM and ROM regions */
>>> -    if (!memory_region_is_ram(mr)) {
>>> -        if (memory_region_is_romd(mr)) {
>>> -            /* HAXM kernel module does not support ROMD yet  */
>>> -            warn_report("Ignoring ROMD region 0x%016" PRIx64 
>>> "->0x%016" PRIx64,
>>> -                        start_pa, start_pa + size);

Don't you need to check for some kmod version before removing this check?

>>> -        }
>>> +    /* We only care about RAM/ROM regions and ROM device */
>>> +    if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) {

Redundant parenthesis.

>>> +        flags |= HAX_RAM_INFO_ROM;
>>> +    } else if (!memory_region_is_ram(mr)) {
>>>           return;
>>>       }

If you move the 'if (RAM) return' first, the code becomes easier to review.

>>>
>>
>> -- 
>> Best Regards,
>> Colin Xu
>>
>>
>>
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-28  8:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30  3:25 [PATCH v2] [Qemu-devel] target/i386: HAX: Enable ROM/ROM device memory region support hang.yuan
2020-03-30  3:53 ` Colin Xu
2020-04-28  2:45   ` Colin Xu
2020-04-28  8:11     ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).