Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/libkdumpfile/addrxlat.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,11 @@ typedef enum _addrxlat_optidx {
*/
ADDRXLAT_OPT_rootpgt,

/** User land root page table address. Used *only* in aarch64 case.
* Type: full address
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is confusing. I don't see anything architecture-specific here, and in fact the option should also be very useful on IBM POWER.

*/
ADDRXLAT_OPT_user_rootpgt,

/** Xen p2m root machine frame number.
* Type: address
*/
Expand Down Expand Up @@ -928,6 +933,14 @@ addrxlat_opt_rootpgt(addrxlat_opt_t *opt, const addrxlat_fulladdr_t *val)
opt->val.fulladdr = *val;
}

/** Helper to set @xref ADDRXLAT_OPT_user_rootpgt in a type-safe manner. */
static inline void
addrxlat_opt_user_rootpgt(addrxlat_opt_t *opt, const addrxlat_fulladdr_t *val)
{
opt->idx = ADDRXLAT_OPT_user_rootpgt;
opt->val.fulladdr = *val;
}

/** Helper to set @xref ADDRXLAT_OPT_xen_p2m_mfn in a type-safe manner. */
static inline void
addrxlat_opt_xen_p2m_mfn(addrxlat_opt_t *opt, unsigned long val)
Expand Down
14 changes: 11 additions & 3 deletions python/addrxlat.c
Original file line number Diff line number Diff line change
Expand Up @@ -4312,23 +4312,24 @@ sys_os_init(PyObject *_self, PyObject *args, PyObject *kwargs)
"page_shift",
"phys_base",
"rootpgt",
"user_rootpgt",
"xen_p2m_mfn",
"xen_xlat",
NULL
};
PyObject *ctxobj;
PyObject *arch, *type, *ver, *page_shift, *phys_base,
*rootpgt, *xen_p2m_mfn, *xen_xlat, *phys_bits, *virt_bits;
*rootpgt, *user_rootpgt, *xen_p2m_mfn, *xen_xlat, *phys_bits, *virt_bits;
addrxlat_ctx_t *ctx;
addrxlat_opt_t opts[ADDRXLAT_OPT_NUM], *p;
addrxlat_status status;

arch = type = ver = page_shift = phys_base = rootpgt =
xen_p2m_mfn = xen_xlat = phys_bits = virt_bits = Py_None;
if (!PyArg_ParseTupleAndKeywords(
args, kwargs, "O|OOOOOOOOOO:os_init", keywords,
args, kwargs, "O|OOOOOOOOOOO:os_init", keywords,
&ctxobj, &arch, &type, &ver, &phys_bits, &virt_bits,
&page_shift, &phys_base, &rootpgt, &xen_p2m_mfn,
&page_shift, &phys_base, &rootpgt, &user_rootpgt, &xen_p2m_mfn,
&xen_xlat))
return NULL;

Expand Down Expand Up @@ -4394,6 +4395,13 @@ sys_os_init(PyObject *_self, PyObject *args, PyObject *kwargs)
addrxlat_opt_rootpgt(p, faddr);
++p;
}
if (user_rootpgt != Py_None) {
addrxlat_fulladdr_t *faddr = fulladdr_AsPointer(user_rootpgt);
if (!faddr)
return NULL;
addrxlat_opt_user_rootpgt(p, faddr);
++p;
}
if (xen_p2m_mfn != Py_None) {
addrxlat_opt_xen_p2m_mfn(
p, Number_AsUnsignedLongLong(xen_p2m_mfn));
Expand Down
4 changes: 4 additions & 0 deletions src/addrxlat/aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ map_linux_aarch64(struct os_init_data *ctl)
return status;
}

meth = &ctl->sys->meth[ADDRXLAT_SYS_METH_UPGT];
if (opt_isset(ctl->popt, user_rootpgt))
meth->param.pgt.root = ctl->popt.user_rootpgt;

status = sys_set_physmaps(ctl, PHYSADDR_MASK);
if (status != ADDRXLAT_OK)
return status;
Expand Down
1 change: 1 addition & 0 deletions src/addrxlat/addrxlat-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ struct parsed_opts {
unsigned long page_shift; /**< Value of OPT_page_shift. */
addrxlat_addr_t phys_base; /**< Value of OPT_phys_base. */
addrxlat_fulladdr_t rootpgt; /**< Value of OPT_rootpgt. */
addrxlat_fulladdr_t user_rootpgt; /**< Value of OPT_user_rootpgt. */
unsigned long xen_p2m_mfn; /**< Value of OPT_xen_p2m_mfn. */
bool xen_xlat; /**< Value of OPT_xen_xlat. */
};
Expand Down
4 changes: 4 additions & 0 deletions src/addrxlat/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ parse_opt(struct parsed_opts *popt, const addrxlat_opt_t *opt)
popt->rootpgt = opt->val.fulladdr;
break;

case ADDRXLAT_OPT_user_rootpgt:
popt->user_rootpgt = opt->val.fulladdr;
break;

case ADDRXLAT_OPT_xen_p2m_mfn:
popt->xen_p2m_mfn = opt->val.num;
break;
Expand Down