# Re: \[PATCH v3 9/9\] xen: use hw\_pte\_t for PTE range callbacks

- From: sashiko-bot@kernel.org
- Date: 2026-09-22 17:30:10 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2026/09/17623817
- Thread: https://ratatoskr.run/intel-gfx/2026/09/17623735/t.md

```text
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] xen: missing hw_pte_t conversion for x86 Xen callbacks
--

commit cf1ba61f002ea6950852250dfd8d5d0a5b979c23
Author: Muhammad Usama Anjum [ref]

xen: use hw_pte_t for PTE range callbacks

This commit updates Xen callbacks to use the hw_pte_t pointer type, matching
the updated generic PTE range and remapping helpers. It maintains software
PTE values as pte_t to support architectures that select the distinct
hw_pte_t wrapper.

>     Generic PTE range and remapping helpers now pass pointers to PTE table
>     storage as hw_pte_t *. Update the Xen callbacks to match those interfaces.
>     
>     Keep software PTE values as pte_t and continue to access them through the
>     existing PTE helpers. This is required when Xen is built for an
>     architecture that selects the distinct hw_pte_t wrapper.
>     
>     Reviewed-by: Juergen Gross [ref]
>     Signed-off-by: Muhammad Usama Anjum [ref]

[Severity: Low]
Were some x86-specific Xen callbacks missed in this conversion?

Looking at the source, these two callbacks appear to still use the old
pte_t * type signature instead of hw_pte_t *:

arch/x86/xen/grant-table.c:gnttab_apply()
arch/x86/xen/mmu_pv.c:remap_area_pfn_pte_fn()

While this currently compiles because x86 aliases hw_pte_t to pte_t, it looks
like it violates the generic API contract since they are passed to
apply_to_page_range(). Could this cause a build or CFI failure if x86
ever opts into ARCH_HAS_HW_PTE_T?

> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index 1dcc4675580ed..b013bcad99b5b 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -301,7 +301,7 @@ void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map)
>  
>  /* ------------------------------------------------------------------ */
>  
> -static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data)
> +static int find_grant_ptes(hw_pte_t *pte, unsigned long addr, void *data)
>  {
>  	struct gntdev_grant_map *map = data;

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-pte0-v3-0-5670b8cb9059@arm.com?part=9
```
