Message ID | 1175c88c-876e-fe5c-ed5f-c8f53b2703f3@sec.in.tum.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 08/08/17 13:17, Sergej Proskurin wrote: >>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c >>> index c07999b518..904abafcae 100644 >>> --- a/xen/arch/arm/traps.c >>> +++ b/xen/arch/arm/traps.c >>> @@ -2688,6 +2688,8 @@ static bool try_map_mmio(gfn_t gfn) >>> return !map_regions_p2mt(d, gfn, 1, mfn, p2m_mmio_direct_c); >>> } >>> >>> +#include <asm/guest_walk.h> >>> + >>> static void do_trap_data_abort_guest(struct cpu_user_regs *regs, >>> const union hsr hsr) >>> { >>> @@ -2725,6 +2727,17 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, >>> return; /* Try again */ >>> } >>> >>> + { >>> + paddr_t ipa, pipa; >>> + rc = gva_to_ipa(info.gva, &info.ipa, GV2M_READ); > > There is no ipa field in mmio_info_t. But even if you used info.gpa > instead, the test that you have provided is unfortunately flawed: Well, I copied the wrong code... info.ipa should be replaced by pipa. >>> + BUG_ON(rc); >>> + printk("guest_walk_tables: gva 0x%x pipa 0x%llx\n", >>> + info.gva, pipa); >>> + rc = guest_walk_tables(current, info.gva, &ipa, NULL); >>> + BUG_ON(rc); >>> + BUG_ON(ipa != pipa); > > In your test-case you don't initialize pipa at all, however you test for > it in BUG_ON, which is the reason why it fails. I have adopted your test > case and it runs on ARMv7 (non-LPAE guest) and ARMv8 (LPAE guest) > without any issues. It would be great if you would verify this behaviour > by applying the following patch to the arm-gpt-walk-v7 patch [0] as before: I am afraid that whilst there was a bug in the code to compare ipa != pipa. If you looked at the log I provided, it was failing before: d0: guestcopy: failed to get table entry. And this does not even involve pipa... If you wonder your patch below does not help it also. Cheers,
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 4ee07fcea3..f2758ebd45 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -139,6 +139,8 @@ int access_guest_memory_by_ipa(struct domain *d, paddr_t gpa, void *buf, return -EINVAL; } + printk("%s: gpa 0x%"PRIpaddr"\n", __FUNCTION__, gpa); + page = get_page_from_gfn(d, paddr_to_pfn(gpa), &p2mt, P2M_ALLOC); if ( !page ) { diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index c07999b518..9b0b79a3fe 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2688,6 +2688,8 @@ static bool try_map_mmio(gfn_t gfn) return !map_regions_p2mt(d, gfn, 1, mfn, p2m_mmio_direct_c); } +#include <asm/guest_walk.h> + static void do_trap_data_abort_guest(struct cpu_user_regs *regs, const union hsr hsr) { @@ -2725,6 +2727,17 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs, return; /* Try again */ } + { + paddr_t ipa; + rc = gva_to_ipa(info.gva, &info.gpa, GV2M_READ); + BUG_ON(rc); + printk("guest_walk_tables: gva 0x%"PRIvaddr" pipa 0x%"PRIpaddr"\n", + info.gva, info.gpa); + rc = guest_walk_tables(current, info.gva, &ipa, NULL); + BUG_ON(rc); + BUG_ON(ipa != info.gpa); + } + switch ( fsc ) {