|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/3] x86: move / split usercopy.c to / into arch-specific library
On 08.12.2025 22:48, Grygorii Strashko wrote:
>
>
> On 08.12.25 14:05, Jan Beulich wrote:
>> The file wasn't correctly named for our purposes anyway. Split it into its
>> "guest" and "unsafe" parts, thus allowing the latter to not be linked in
>> at all (for presently having no caller). The building of the "guest" part
>> can then (later) become conditional upon PV=y.
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> xen/arch/x86/Makefile | 4 ----
>> xen/arch/x86/lib/Makefile | 2 ++
>> xen/arch/x86/{usercopy.c => lib/copy-guest.c} | 12 +---------
>> xen/arch/x86/lib/copy-unsafe.c | 22 +++++++++++++++++++
>> 4 files changed, 25 insertions(+), 15 deletions(-)
>> rename xen/arch/x86/{usercopy.c => lib/copy-guest.c} (94%)
>> create mode 100644 xen/arch/x86/lib/copy-unsafe.c
>>
>> diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
>> index 61e2293a467e..dfb258d7ac1c 100644
>> --- a/xen/arch/x86/Makefile
>> +++ b/xen/arch/x86/Makefile
>> @@ -72,7 +72,6 @@ obj-y += time.o
>> obj-y += traps-setup.o
>> obj-y += traps.o
>> obj-$(CONFIG_INTEL) += tsx.o
>> -obj-y += usercopy.o
>> obj-y += x86_emulate.o
>> obj-$(CONFIG_TBOOT) += tboot.o
>> obj-y += hpet.o
>> @@ -93,9 +92,6 @@ hostprogs-y += efi/mkreloc
>>
>> $(obj)/efi/mkreloc: HOSTCFLAGS += -I$(srctree)/include
>>
>> -# Allows usercopy.c to include itself
>> -$(obj)/usercopy.o: CFLAGS-y += -iquote .
>> -
>> ifneq ($(CONFIG_HVM),y)
>> $(obj)/x86_emulate.o: CFLAGS-y += -Wno-unused-label
>> endif
>> diff --git a/xen/arch/x86/lib/Makefile b/xen/arch/x86/lib/Makefile
>> index ddf7e19bdc1d..8fe2dfd88553 100644
>> --- a/xen/arch/x86/lib/Makefile
>> +++ b/xen/arch/x86/lib/Makefile
>> @@ -1 +1,3 @@
>> +lib-y += copy-guest.o
>> +lib-y += copy-unsafe.o
>> lib-y += generic-hweightl.o
>> diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/lib/copy-guest.c
>> similarity index 94%
>> rename from xen/arch/x86/usercopy.c
>> rename to xen/arch/x86/lib/copy-guest.c
>> index a24b52cc66c1..25eeb35427e2 100644
>> --- a/xen/arch/x86/usercopy.c
>> +++ b/xen/arch/x86/lib/copy-guest.c
>> @@ -1,4 +1,4 @@
>> -/*
>> +/*
>> * User address space access functions.
>> *
>> * Copyright 1997 Andi Kleen <ak@xxxxxx>
>> @@ -6,8 +6,6 @@
>> * Copyright 2002 Andi Kleen <ak@xxxxxxx>
>> */
>>
>> -#include <xen/lib.h>
>> -#include <xen/sched.h>
>
> This will not build :(
>
> CC arch/x86/lib/copy-guest.o
> In file included from ././include/xen/config.h:27,
> from <command-line>:
> arch/x86/lib/copy-guest.c: In function ‘copy_to_guest_pv’:
> ./arch/x86/include/asm/config.h:270:32: error: invalid use of undefined type
> ‘struct vcpu’
> 270 | (ARG_XLAT_VIRT_START + ((v)->vcpu_id << ARG_XLAT_VA_SHIFT))
>
Hmm, yes. It does build here, but of course I have many other patches in
place. The issue looks to be that for me access_ok() isn't a macro anymore,
but a function.
Thanks for pointing out,
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |