[XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'

Nicola Vetrini posted 1 patch 8 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/23c5b1a1ffc755b5db17d699a08fc86e1f0cc788.1691659744.git.nicola.vetrini@bugseng.com
There is a newer version of this series
xen/arch/arm/traps.c | 57 --------------------------------------------
1 file changed, 57 deletions(-)
[XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'
Posted by Nicola Vetrini 8 months, 3 weeks ago
The function in question has no callers and its removal has already
been proposed (and acked) as part of this larger series [1].
There have been further bugfixes to that function [2], but they do not add
any caller, hence it can be removed.

[1] https://lore.kernel.org/xen-devel/1395766541-23979-27-git-send-email-julien.grall@linaro.org/
[2] https://lore.kernel.org/xen-devel/20160720161017.4508-1-jtd@galois.com/

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Suggested-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/traps.c | 57 --------------------------------------------
 1 file changed, 57 deletions(-)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 7baddfdc57b3..46c9a4031b30 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1686,63 +1686,6 @@ void handle_ro_raz(struct cpu_user_regs *regs,
     handle_ro_read_val(regs, regidx, read, hsr, min_el, 0);
 }
 
-void dump_guest_s1_walk(struct domain *d, vaddr_t addr)
-{
-    register_t ttbcr = READ_SYSREG(TCR_EL1);
-    uint64_t ttbr0 = READ_SYSREG64(TTBR0_EL1);
-    uint32_t offset;
-    uint32_t *first = NULL, *second = NULL;
-    mfn_t mfn;
-
-    mfn = gfn_to_mfn(d, gaddr_to_gfn(ttbr0));
-
-    printk("dom%d VA 0x%08"PRIvaddr"\n", d->domain_id, addr);
-    printk("    TTBCR: 0x%"PRIregister"\n", ttbcr);
-    printk("    TTBR0: 0x%016"PRIx64" = 0x%"PRIpaddr"\n",
-           ttbr0, mfn_to_maddr(mfn));
-
-    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;
-    }
-
-    if ( mfn_eq(mfn, INVALID_MFN) )
-    {
-        printk("Failed TTBR0 maddr lookup\n");
-        goto done;
-    }
-    first = map_domain_page(mfn);
-
-    offset = addr >> (12+8);
-    printk("1ST[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
-           offset, mfn_to_maddr(mfn), first[offset]);
-    if ( !(first[offset] & 0x1) ||
-          (first[offset] & 0x2) )
-        goto done;
-
-    mfn = gfn_to_mfn(d, gaddr_to_gfn(first[offset]));
-
-    if ( mfn_eq(mfn, INVALID_MFN) )
-    {
-        printk("Failed L1 entry maddr lookup\n");
-        goto done;
-    }
-    second = map_domain_page(mfn);
-    offset = (addr >> 12) & 0x3FF;
-    printk("2ND[0x%"PRIx32"] (0x%"PRIpaddr") = 0x%08"PRIx32"\n",
-           offset, mfn_to_maddr(mfn), second[offset]);
-
-done:
-    if ( second ) unmap_domain_page(second);
-    if ( first ) unmap_domain_page(first);
-}
-
 /*
  * Return the value of the hypervisor fault address register.
  *
-- 
2.34.1
Re: [XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'
Posted by Julien Grall 8 months, 3 weeks ago
Hi,

On 10/08/2023 10:29, Nicola Vetrini wrote:
> The function in question has no callers and its removal has already
> been proposed (and acked) as part of this larger series [1].

This is useful information after for the reviewer to know it was already 
acked, but it is not really past commit. So I would move it after ---.

> There have been further bugfixes to that function [2], but they do not add
> any caller, hence it can be removed.

If you want to mention bugfixes, then it is best to refer to a commit 
rather than the e-mail thread.

> 
> [1] https://lore.kernel.org/xen-devel/1395766541-23979-27-git-send-email-julien.grall@linaro.org/
> [2] https://lore.kernel.org/xen-devel/20160720161017.4508-1-jtd@galois.com/
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> Suggested-by: Julien Grall <julien.grall@linaro.org>

Aside the e-mail address, you want to order tag in chronogical order. 
This was suggested by me then you wrote the patch. So it Suggested-by 
should be first.

Other than that, I would like Bertrand/Stefano to confirm if they are Ok 
with the removal.

Cheers,

-- 
Julien Grall
Re: [XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'
Posted by Stefano Stabellini 8 months, 2 weeks ago
On Thu, 10 Aug 2023, Julien Grall wrote:
> Hi,
> 
> On 10/08/2023 10:29, Nicola Vetrini wrote:
> > The function in question has no callers and its removal has already
> > been proposed (and acked) as part of this larger series [1].
> 
> This is useful information after for the reviewer to know it was already
> acked, but it is not really past commit. So I would move it after ---.
> 
> > There have been further bugfixes to that function [2], but they do not add
> > any caller, hence it can be removed.
> 
> If you want to mention bugfixes, then it is best to refer to a commit rather
> than the e-mail thread.
> 
> > 
> > [1]
> > https://lore.kernel.org/xen-devel/1395766541-23979-27-git-send-email-julien.grall@linaro.org/
> > [2] https://lore.kernel.org/xen-devel/20160720161017.4508-1-jtd@galois.com/
> > 
> > Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> > Suggested-by: Julien Grall <julien.grall@linaro.org>
> 
> Aside the e-mail address, you want to order tag in chronogical order. This was
> suggested by me then you wrote the patch. So it Suggested-by should be first.
> 
> Other than that, I would like Bertrand/Stefano to confirm if they are Ok with
> the removal.

Fine by me
Re: [XEN PATCH] xen/arm: traps: remove unused function 'dump_guest_s1_walk'
Posted by Nicola Vetrini 8 months, 3 weeks ago
On 10/08/2023 11:29, Nicola Vetrini wrote:
> The function in question has no callers and its removal has already
> been proposed (and acked) as part of this larger series [1].
> There have been further bugfixes to that function [2], but they do not 
> add
> any caller, hence it can be removed.
> 
> [1] 
> https://lore.kernel.org/xen-devel/1395766541-23979-27-git-send-email-julien.grall@linaro.org/
> [2] 
> https://lore.kernel.org/xen-devel/20160720161017.4508-1-jtd@galois.com/
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
> Suggested-by: Julien Grall <julien.grall@linaro.org>
> ---

Wrong mail address for Julien, sorry

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)