Re: [PATCH v1 06/17] xen/riscv: map IMSIC interrupt file for vCPUs

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 10.08.2026 10:50, Oleksii Kurochko wrote:
> On 8/6/26 4:48 PM, Jan Beulich wrote:
>> On 20.07.2026 18:02, Oleksii Kurochko wrote:
>>> +#ifdef IMSIC_DEBUG
>>> +    printk("%s: %pv: ga(%#lx) -> pa(%#lx), cpu(%#x), guest_file_id(%d) "
>>> +           "base_addr(%#lx) offset(%#lx)\n", __func__, v, gaddr, paddr, cpu,
>>> +           vsfile_id, imsic_cfg.msi[cpu].base_addr, imsic_cfg.msi[cpu].offset);
>>> +#endif
>>> +
>>> +    res = map_regions_p2mt(d, gaddr_to_gfn(gaddr),
>>> +                           PFN_DOWN(IMSIC_MMIO_PAGE_SZ), maddr_to_mfn(paddr),
>>> +                           arch_dt_passthrough_p2m_type());
>>> +    if ( res )
>>> +        printk("%s: Failed to map %#lx to the guest at %#lx\n",
>>> +               __func__, paddr, gaddr);
>>
>> I think you mean to use PRIpaddr with paddr_t (oddly enough there's no
>> PRIgaddr).
> 
> I’m wondering if it wouldn’t be better to use paddr_t for gaddr as well, 
> since technically it is a guest *physical address*. In that case, 
> PRIpaddr could be used to print both paddr and gaddr variables.
> 
> Also, could this be the reason why PRIgaddr doesn’t exist? Basically, a 
> GPA could be considered a physical address, while for a GVA there is 
> already PRIvaddr.

Well. There's nothing wrong with guest {physical,virtual} addresses to be
a different width compared to the host's. They could be both smaller and
(in principle) larger. As long as higher-bitness guests can't be run on a
smaller-bitness hypervisor, using paddr_t for gaddr-s is okay(ish).

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.