target/i386: HAX: Enable ROM/ROM device memory region support
PATCH v2 1/1 target/i386: HAX: Enable ROM/ROM device memory region support
From: Hang Yuan <[email protected]>
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
--- target/i386/hax-mem.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
target/i386/hax-mem.c +4 -7
@@ -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 ; }
Signature · 1 line
2.21.0
Looks good to me.
Quoted 37 lines · On 2020-03-30 11:25, [email protected] wrote:
From: Hang Yuan <[email protected]>
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 <[email protected]>--- target/i386/hax-mem.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)target/i386/hax-mem.c +4
-7@@ -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 ; }
Signature · 2 lines
Best Regards, Colin Xu
Hi Paolo,
Would you please queue this one?
--
Best Regards,
Colin Xu
Quoted 49 lines · Colin Xu
Looks good to me.
Reviewed-by Colin Xu <[email protected]>Quoted 37 lines · On 2020-03-30 11:25, [email protected] wrote:
From: Hang Yuan <[email protected]>
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 <[email protected]>--- target/i386/hax-mem.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)target/i386/hax-mem.c +4
-7@@ -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 ; }Signature · 2 lines
Best Regards, Colin Xu
Quoted 20 lines · Colin Xu
Hi Paolo,
Would you please queue this one?
Signature · 2 lines
Best Regards, Colin XuQuoted 10 lines · Colin Xu
Looks good to me.
Reviewed-by Colin Xu <[email protected]>Quoted 5 lines · On 2020-03-30 11:25, [email protected] wrote:
From: Hang Yuan <[email protected]>
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.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
https://github.com/intel/haxm/commit/33ceea09a1655fca12c47f1e112b1d269357ff28
v2: fix coding style problems
^ This line goes ...
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Signed-off-by Hang Yuan <[email protected]>---
... here after the '---'.
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
target/i386/hax-mem.c| 11 ++++-------1 file changed, 4 insertions(+), 7 deletions(-)target/i386/hax-mem.c +0
-0@@ -175,13 +175,10 @@ static void hax_process_section(MemoryRegionSection *section, uint8_t flags) uint64_t host_va; uint32_t max_mapping_size;
Quoted 7 lines
Quoted 7 lines
target/i386/hax-mem.c static void hax_process_section(MemoryRegionSection *section, uint8_t flags) · line 183
Quoted 7 lines
target/i386/hax-mem.c +0
-6- /* 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?
Quoted 3 lines
Quoted 3 lines
target/i386/hax-mem.c static void hax_process_section(MemoryRegionSection *section, uint8_t flags) · line 179
Quoted 3 lines
target/i386/hax-mem.c +2
-1- } + /* We only care about RAM/ROM regions and ROM device */ + if (memory_region_is_rom(mr) || (memory_region_is_romd(mr))) {
Redundant parenthesis.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
target/i386/hax-mem.c +2
-0+ 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.
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
Signature · 2 lines
Best Regards, Colin Xu