Re: [PATCH] [v2] xen: avoid link error on ARM

From: Juergen Gross
Date: Tue Mar 05 2019 - 11:57:02 EST


On 05/03/2019 17:49, Arnd Bergmann wrote:
> On Tue, Mar 5, 2019 at 3:57 PM Juergen Gross <jgross@xxxxxxxx> wrote:
>> On 05/03/2019 14:43, Boris Ostrovsky wrote:
>>> On 3/5/19 8:30 AM, Arnd Bergmann wrote:
>
>>>> @@ -809,15 +789,7 @@ static long privcmd_ioctl_mmap_resource(struct file *file, void __user *udata)
>>>> goto out;
>>>>
>>>> if (xen_feature(XENFEAT_auto_translated_physmap)) {
>>>> - struct remap_pfn r = {
>>>> - .mm = vma->vm_mm,
>>>> - .pages = vma->vm_private_data,
>>>> - .prot = vma->vm_page_prot,
>>>> - };
>>>> -
>>>> - rc = apply_to_page_range(r.mm, kdata.addr,
>>>> - kdata.num << PAGE_SHIFT,
>>>> - remap_pfn_fn, &r);
>>>> + rc = xen_remap_vma_range(vma, kdata.addr, kdata.num << PAGE_SHIFT);
>>>
>>> I wonder whether drivers/xen/xlate_mmu.c might be a good place for these
>>> routines.
>>
>> Hmm, probably. This would require a stub in the header to avoid
>> problems in case of CONFIG_XEN_AUTO_XLATE not defined, though
>> (the #ifdef is already there).
>>
>> I think this is the cleanest solution.
>
> Putting it into xlate_mmu.c was my first attempt, but I was not sure how to
> solve the dependency on CONFIG_XEN_AUTO_XLATE. So
> xen_feature(XENFEAT_auto_translated_physmap)) would be guaranteed
> to return false if CONFIG_XEN_AUTO_XLATE is disabled?

Yes.


Juergen