From: Ian Campbell <ian.campbell@citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH V2 20/40] arm: dump guest s1 walk on data abort which is not a stage 2 issue.
Date: Tue, 26 Jun 2012 10:29:44 +0000 [thread overview]
Message-ID: <1340706604-1313-20-git-send-email-ian.campbell@citrix.com> (raw)
In-Reply-To: <1340706604-1313-1-git-send-email-ian.campbell@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---
xen/arch/arm/traps.c | 75 +++++++++++++++++++++++++++++++++++---
xen/include/asm-arm/processor.h | 1 +
2 files changed, 70 insertions(+), 6 deletions(-)
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 40bb375..d8eb5a9 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -28,6 +28,7 @@
#include <xen/errno.h>
#include <xen/hypercall.h>
#include <xen/softirq.h>
+#include <xen/domain_page.h>
#include <public/xen.h>
#include <asm/regs.h>
#include <asm/cpregs.h>
@@ -528,6 +529,62 @@ static void do_cp15_64(struct cpu_user_regs *regs,
}
+void dump_guest_s1_walk(struct domain *d, uint32_t addr)
+{
+ uint32_t ttbcr = READ_CP32(TTBCR);
+ uint32_t ttbr0 = READ_CP32(TTBR0);
+ paddr_t paddr;
+ uint32_t offset;
+ uint32_t *first = NULL, *second = NULL;
+
+ printk("dom%d VA 0x%08"PRIx32"\n", d->domain_id, addr);
+ printk(" TTBCR: 0x%08"PRIx32"\n", ttbcr);
+ printk(" TTBR0: 0x%08"PRIx32" = 0x%"PRIpaddr"\n",
+ ttbr0, p2m_lookup(d, ttbr0 & PAGE_MASK));
+
+ if ( ttbcr & TTBCR_EAE )
+ {
+ printk("Cannot handle LPAE guest PT walk\n");
+ return;
+ }
+ if ( (ttbcr & TTBCR_N_MASK) != 0 )
+ {
+ printk("Cannot handle TTBR1 guest walks\n");
+ return;
+ }
+
+ paddr = p2m_lookup(d, ttbr0 & PAGE_MASK);
+ if ( paddr == INVALID_PADDR )
+ {
+ printk("Failed TTBR0 maddr lookup\n");
+ goto done;
+ }
+ first = map_domain_page(paddr>>PAGE_SHIFT);
+
+ offset = addr >> (12+10);
+ printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
+ offset, paddr, first[offset]);
+ if ( !(first[offset] & 0x1) ||
+ !(first[offset] & 0x2) )
+ goto done;
+
+ paddr = p2m_lookup(d, first[offset] & PAGE_MASK);
+
+ if ( paddr == INVALID_PADDR )
+ {
+ printk("Failed L1 entry maddr lookup\n");
+ goto done;
+ }
+ second = map_domain_page(paddr>>PAGE_SHIFT);
+ offset = (addr >> 12) & 0x3FF;
+ printk("2ND[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
+ offset, paddr, second[offset]);
+
+done:
+ if (second) unmap_domain_page(second);
+ if (first) unmap_domain_page(first);
+}
+
static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
struct hsr_dabt dabt)
{
@@ -535,11 +592,12 @@ static void do_trap_data_abort_guest(struct cpu_user_regs *regs,
int level = -1;
mmio_info_t info;
+ info.dabt = dabt;
+ info.gva = READ_CP32(HDFAR);
+
if (dabt.s1ptw)
goto bad_data_abort;
- info.dabt = dabt;
- info.gva = READ_CP32(HDFAR);
info.gpa = gva_to_ipa(info.gva);
if (handle_mmio(&info))
@@ -553,18 +611,23 @@ bad_data_abort:
msg = decode_fsc( dabt.dfsc, &level);
printk("Guest data abort: %s%s%s\n"
- " gva=%"PRIx32" gpa=%"PRIpaddr"\n",
+ " gva=%"PRIx32"\n",
msg, dabt.s1ptw ? " S2 during S1" : "",
fsc_level_str(level),
- info.gva, info.gpa);
- if (dabt.valid)
+ info.gva);
+ if ( !dabt.s1ptw )
+ printk(" gpa=%"PRIpaddr"\n", info.gpa);
+ if ( dabt.valid )
printk(" size=%d sign=%d write=%d reg=%d\n",
dabt.size, dabt.sign, dabt.write, dabt.reg);
else
printk(" instruction syndrome invalid\n");
printk(" eat=%d cm=%d s1ptw=%d dfsc=%d\n",
dabt.eat, dabt.cache, dabt.s1ptw, dabt.dfsc);
-
+ if ( !dabt.s1ptw )
+ dump_p2m_lookup(current->domain, info.gpa);
+ else
+ dump_guest_s1_walk(current->domain, info.gva);
show_execution_state(regs);
panic("Unhandled guest data abort\n");
}
diff --git a/xen/include/asm-arm/processor.h b/xen/include/asm-arm/processor.h
index ec6fb48..81924a4 100644
--- a/xen/include/asm-arm/processor.h
+++ b/xen/include/asm-arm/processor.h
@@ -25,6 +25,7 @@
#define PSR_JAZELLE (1<<24) /* Jazelle Mode */
/* TTBCR Translation Table Base Control Register */
+#define TTBCR_EAE 0x80000000
#define TTBCR_N_MASK 0x07
#define TTBCR_N_16KB 0x00
#define TTBCR_N_8KB 0x01
--
1.7.9.1
next prev parent reply other threads:[~2012-06-26 10:29 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-26 10:29 [PATCH 00/40 V2] arm: boot a dom1 to "Calibrating delay loop" then hang Ian Campbell
2012-06-26 10:29 ` [PATCH V2 01/40] arm: allocate top level p2m page for all non-idle domains Ian Campbell
2012-06-26 10:29 ` [PATCH V2 02/40] arm: handy function to print a walk of a page table Ian Campbell
2012-06-26 10:29 ` [PATCH V2 03/40] arm: correct and expand TLB flush CP15 registers Ian Campbell
2012-06-26 10:29 ` [PATCH V2 04/40] arm: restore stack on return from trap Ian Campbell
2012-06-26 10:29 ` [PATCH V2 05/40] arm: enable interrupts while handling traps Ian Campbell
2012-06-26 10:29 ` [PATCH V2 06/40] arm: hook up domctl and memory_op Ian Campbell
2012-06-26 10:29 ` [PATCH V2 07/40] arm: allocate and setup a guest vcpu Ian Campbell
2012-06-26 10:29 ` [PATCH V2 08/40] arm: print domid as part of debug trap Ian Campbell
2012-06-26 10:29 ` [PATCH V2 09/40] arm: remove unnecessarily verbose print from p2m_load_VTTBR Ian Campbell
2012-06-26 10:29 ` [PATCH V2 10/40] arm: implement p2m lookup Ian Campbell
2012-06-26 10:29 ` [PATCH V2 11/40] arm: remove hard tabs from init_idle_domain Ian Campbell
2012-06-26 10:29 ` [PATCH V2 12/40] arm: stub out sync_vcpu_execstate Ian Campbell
2012-06-26 10:29 ` [PATCH V2 13/40] arm: implement stub version of flush_tlb_mask Ian Campbell
2012-06-26 10:29 ` [PATCH V2 14/40] arm: do not set max_vcpus = 8 in arch_domain_create Ian Campbell
2012-06-26 10:29 ` [PATCH V2 15/40] arm: Add simple cpu_{sibling, core}_mask Ian Campbell
2012-06-26 10:29 ` [PATCH V2 16/40] arm: allow p2m to be created with specific MATTR Ian Campbell
2012-06-28 12:46 ` Ian Campbell
2012-06-28 13:00 ` Stefano Stabellini
2012-06-26 10:29 ` [PATCH V2 17/40] arm: implement vpl011 (UART) emulator Ian Campbell
2012-06-28 11:00 ` Tim Deegan
2012-06-26 10:29 ` [PATCH V2 18/40] arm: context switch a bunch of guest state Ian Campbell
2012-06-26 10:29 ` [PATCH V2 19/40] arm: dump a page table walk when va_to_par fails Ian Campbell
2012-06-26 10:29 ` Ian Campbell [this message]
2012-06-26 10:29 ` [PATCH V2 21/40] arm: implement vcpu_show_execution_state Ian Campbell
2012-06-28 13:04 ` Stefano Stabellini
2012-06-26 10:29 ` [PATCH V2 22/40] arm: use correct attributes for mappings in copy_from_paddr() Ian Campbell
2012-06-26 10:29 ` [PATCH V2 23/40] arm: map fixmaps non-executable Ian Campbell
2012-06-26 10:29 ` [PATCH V2 24/40] arm: fix locking in create_p2m_entries Ian Campbell
2012-06-26 10:29 ` [PATCH V2 25/40] arm: split pending SPIs (global) out from pending PPIs and SGIs (per CPU) Ian Campbell
2012-06-28 13:08 ` Stefano Stabellini
2012-06-26 10:29 ` [PATCH V2 26/40] arm: use interrupt safe spin locks in vgic_vcpu_inject_irq Ian Campbell
2012-06-28 13:06 ` Stefano Stabellini
2012-06-26 10:29 ` [PATCH V2 27/40] arm: map GICV in all domains, not just dom0 Ian Campbell
2012-06-26 10:29 ` [PATCH V2 28/40] arm: enable data-cache at the same time as enabling the MMU, not before Ian Campbell
2012-06-28 11:02 ` Tim Deegan
2012-06-26 10:29 ` [PATCH V2 29/40] arm: Upgrade guest barriers to Outer-Shareable. Enable Protected Table Walk Ian Campbell
2012-06-26 10:29 ` [PATCH V2 30/40] arm: gic.lock can be taken in interrupt context, so lock appropriately Ian Campbell
2012-06-26 10:29 ` [PATCH V2 31/40] arm: context switch virtual timer registers Ian Campbell
2012-06-26 10:29 ` [PATCH V2 32/40] arm: the hyp timer seems to work in newer model versions, default to using it Ian Campbell
2012-06-26 10:29 ` [PATCH V2 33/40] arm: unwind allocations etc on arch_domain_create_failure Ian Campbell
2012-06-28 11:05 ` Tim Deegan
2012-06-26 10:29 ` [PATCH V2 34/40] HACK: arm: initial XENMAPSPACE_gmfn_foreign Ian Campbell
2012-06-26 10:29 ` [PATCH V2 35/40] arm: move PSR flag definitions into interface, for tools use Ian Campbell
2012-06-26 10:30 ` [PATCH V2 36/40] libxc: add ARM support to xc_dom (PV domain building) Ian Campbell
2012-06-26 10:30 ` [PATCH V2 37/40] arm: implement VGCF_online Ian Campbell
2012-06-28 11:06 ` Tim Deegan
2012-06-26 10:30 ` [PATCH V2 38/40] arm: fix typo s/approprately/appropriately/g Ian Campbell
2012-06-26 10:30 ` [PATCH V2 39/40] HACK: add simple xcbuild Ian Campbell
2012-06-26 10:30 ` [PATCH V2 40/40] HACK: arm: disable hypercall continuations Ian Campbell
2012-06-26 15:26 ` [PATCH 00/40 V2] arm: boot a dom1 to "Calibrating delay loop" then hang Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340706604-1313-20-git-send-email-ian.campbell@citrix.com \
--to=ian.campbell@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).