From: Tim Deegan Subject: Re: [PATCH 02/38] arm: handy function to print a walk of the hypervisor page tables Date: Thu, 7 Jun 2012 13:39:22 +0100 Message-ID: <20120607123922.GR70339@ocelot.phlegethon.org> References: <1338565113.17466.141.camel@zakaz.uk.xensource.com> <1338565207-2888-1-git-send-email-ian.campbell@citrix.com> <1338565207-2888-2-git-send-email-ian.campbell@citrix.com> <20120607084517.GA70339@ocelot.phlegethon.org> <1339070260.18523.14.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1339070260.18523.14.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org At 12:57 +0100 on 07 Jun (1339073860), Ian Campbell wrote: > On Thu, 2012-06-07 at 09:45 +0100, Tim Deegan wrote: > > Hi, > > > > At 15:39 +0000 on 01 Jun (1338565171), Ian Campbell wrote: > > > +void dump_pt_walk(uint32_t addr) > > > +{ > > > + paddr_t second_ma, third_ma; > > > + lpae_t *first = NULL, *second = NULL, *third = NULL; > > > + uint64_t httbr = READ_CP64(HTTBR); > > > + > > > + printk("Walking Hypervisor VA %#"PRIx32" via HTTBR %#"PRIx64"\n", > > > + addr, httbr); > > > + > > > + BUG_ON( (lpae_t *)(unsigned long)(httbr - xen_phys_offset) != xen_pgtable ); > > > + first = xen_pgtable; > > > + printk("1ST[%#03"PRIx32"] = %p[%#03"PRIx32"] = %#llx = %#016llx\n", > > > + first_table_offset(addr), > > > + first, first_table_offset(addr), > > > + virt_to_maddr(&first[first_table_offset(addr)]), > > > + first[first_table_offset(addr)].bits); > > > + > > > + if ( !first[first_table_offset(addr)].pt.valid || > > > + !first[first_table_offset(addr)].pt.table ) > > > + goto done; > > > > This could probably be a for loop rather than open-coding three > > almost-identical printks. > > The *_table_offsets macro names are different at each stage, I suppose I > could open code the equivalent shifts, but I'd rather keep using the > access macros. Ah, OK. In that case, open-coded is fine. Tim.