On 17.02.2026 11:25, Oleksii Kurochko wrote:
> On 2/16/26 3:57 PM, Jan Beulich wrote:
>> On 12.02.2026 17:21, Oleksii Kurochko wrote:
>>> --- /dev/null
>>> +++ b/xen/arch/riscv/guestcopy.c
>>> @@ -0,0 +1,112 @@
>>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>> +
>>> +#include <xen/domain_page.h>
>>> +#include <xen/page-size.h>
>>> +#include <xen/sched.h>
>>> +#include <xen/string.h>
>>> +
>>> +#include <asm/guest_access.h>
>>> +
>>> +#define COPY_from_guest     (0U << 0)
>>> +#define COPY_to_guest       (1U << 0)
>>> +#define COPY_ipa            (0U << 1)
>> Like already asked elsewhere - is "ipa" a term commonly in use on RISC-V?
>> To me it's Arm terminology, which you don't want to copy as is.
> 
> As we discussed in another patch thread, IPA isn't really used for RISC-V
> and I will rename it to GPA.
> 
>> Also, don't you prefer to use BIT() everywhere else?
> 
> Yes, BIT() would be better for consistency.
> 
>>> +#define COPY_linear         (1U << 1)
>>> +
>>> +typedef union
>>> +{
>>> +    struct
>>> +    {
>>> +        struct vcpu *v;
>>> +    } gva;
>>> +
>>> +    struct
>>> +    {
>>> +        struct domain *d;
>>> +    } gpa;
>>> +} copy_info_t;
>>> +
>>> +#define GVA_INFO(vcpu) ((copy_info_t) { .gva = { vcpu } })
>>> +#define GPA_INFO(domain) ((copy_info_t) { .gpa = { domain } })
>>> +
>>> +static struct page_info *translate_get_page(copy_info_t info, uint64_t 
>>> addr,
>> The caller has to pass in a domain here. I therefore recommend against
>> use of copy_info_t for this function. Or wait, this is misleading, as
>> the consuming part ...
>>
>>> +                                            bool linear, bool write)
>>> +{
>>> +    p2m_type_t p2mt;
>>> +    struct page_info *page;
>>> +
>>> +    if ( linear )
>>> +        BUG_ON("unimplemeted\n");
>> ... of "linear" is missing here.
> 
> Yes, for this once cases it will be used vcpu as an argument passed by 
> "copy_info_t info".
> I will add the comment above suggested below BUG_ON(linear).
> 
> Btw, I think it makes sense to change linear to GVA to be more close to 
> RISC-V spec?

And to better match the rename to GPA that you talk about above.

Jan

Reply via email to