* [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls @ 2025-11-14 9:58 Anirudh Rayabharam 2025-11-15 6:22 ` Wei Liu 2025-11-16 8:17 ` kernel test robot 0 siblings, 2 replies; 8+ messages in thread From: Anirudh Rayabharam @ 2025-11-14 9:58 UTC (permalink / raw) To: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li Cc: anirudh, linux-hyperv, linux-kernel From: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> Allow MSHV_ROOT_HVCALL IOCTL on the /dev/mshv fd. This IOCTL would execute a passthrough hypercall targeting the root/parent partition i.e. HV_PARTITION_ID_SELF. This will be useful for the VMM to query things like supported synthetic processor features, supported VMM capabiliites etc. While at it, add HVCALL_GET_PARTITION_PROPERTY_EX to the allowed list of passthrough hypercalls. Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> --- drivers/hv/mshv_root_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c index 20eda00a1b5a..98f56322cd19 100644 --- a/drivers/hv/mshv_root_main.c +++ b/drivers/hv/mshv_root_main.c @@ -122,6 +122,7 @@ static struct miscdevice mshv_dev = { */ static u16 mshv_passthru_hvcalls[] = { HVCALL_GET_PARTITION_PROPERTY, + HVCALL_GET_PARTITION_PROPERTY_EX, HVCALL_SET_PARTITION_PROPERTY, HVCALL_INSTALL_INTERCEPT, HVCALL_GET_VP_REGISTERS, @@ -159,6 +160,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, unsigned int pages_order; void *input_pg = NULL; void *output_pg = NULL; + u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF; if (copy_from_user(&args, user_args, sizeof(args))) return -EFAULT; @@ -180,7 +182,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, is_async = mshv_hvcall_is_async(args.code); if (is_async) { /* async hypercalls can only be called from partition fd */ - if (!partition_locked) + if (!partition || !partition_locked) return -EINVAL; ret = mshv_init_async_handler(partition); if (ret) @@ -208,7 +210,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, * NOTE: This only works because all the allowed hypercalls' input * structs begin with a u64 partition_id field. */ - *(u64 *)input_pg = partition->pt_id; + *(u64 *)input_pg = pt_id; if (args.reps) status = hv_do_rep_hypercall(args.code, args.reps, 0, @@ -226,7 +228,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, } if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) { - ret = hv_call_deposit_pages(NUMA_NO_NODE, partition->pt_id, 1); + ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1); if (!ret) ret = -EAGAIN; } else if (!hv_result_success(status)) { @@ -2048,6 +2050,9 @@ static long mshv_dev_ioctl(struct file *filp, unsigned int ioctl, case MSHV_CREATE_PARTITION: return mshv_ioctl_create_partition((void __user *)arg, misc->this_device); + case MSHV_ROOT_HVCALL: + return mshv_ioctl_passthru_hvcall(NULL, false, + (void __user *)arg); } return -ENOTTY; -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-14 9:58 [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls Anirudh Rayabharam @ 2025-11-15 6:22 ` Wei Liu 2025-11-15 7:39 ` Anirudh Rayabharam 2025-11-16 8:17 ` kernel test robot 1 sibling, 1 reply; 8+ messages in thread From: Wei Liu @ 2025-11-15 6:22 UTC (permalink / raw) To: Anirudh Rayabharam Cc: K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li, linux-hyperv, linux-kernel On Fri, Nov 14, 2025 at 09:58:52AM +0000, Anirudh Rayabharam wrote: > From: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> > > Allow MSHV_ROOT_HVCALL IOCTL on the /dev/mshv fd. This IOCTL would > execute a passthrough hypercall targeting the root/parent partition > i.e. HV_PARTITION_ID_SELF. > > This will be useful for the VMM to query things like supported > synthetic processor features, supported VMM capabiliites etc. > > While at it, add HVCALL_GET_PARTITION_PROPERTY_EX to the allowed list of > passthrough hypercalls. > > Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> This doesn't apply to hyperv-next. What's its base? Wei > --- > drivers/hv/mshv_root_main.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c > index 20eda00a1b5a..98f56322cd19 100644 > --- a/drivers/hv/mshv_root_main.c > +++ b/drivers/hv/mshv_root_main.c > @@ -122,6 +122,7 @@ static struct miscdevice mshv_dev = { > */ > static u16 mshv_passthru_hvcalls[] = { > HVCALL_GET_PARTITION_PROPERTY, > + HVCALL_GET_PARTITION_PROPERTY_EX, > HVCALL_SET_PARTITION_PROPERTY, > HVCALL_INSTALL_INTERCEPT, > HVCALL_GET_VP_REGISTERS, > @@ -159,6 +160,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > unsigned int pages_order; > void *input_pg = NULL; > void *output_pg = NULL; > + u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF; > > if (copy_from_user(&args, user_args, sizeof(args))) > return -EFAULT; > @@ -180,7 +182,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > is_async = mshv_hvcall_is_async(args.code); > if (is_async) { > /* async hypercalls can only be called from partition fd */ > - if (!partition_locked) > + if (!partition || !partition_locked) > return -EINVAL; > ret = mshv_init_async_handler(partition); > if (ret) > @@ -208,7 +210,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > * NOTE: This only works because all the allowed hypercalls' input > * structs begin with a u64 partition_id field. > */ > - *(u64 *)input_pg = partition->pt_id; > + *(u64 *)input_pg = pt_id; > > if (args.reps) > status = hv_do_rep_hypercall(args.code, args.reps, 0, > @@ -226,7 +228,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > } > > if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) { > - ret = hv_call_deposit_pages(NUMA_NO_NODE, partition->pt_id, 1); > + ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1); > if (!ret) > ret = -EAGAIN; > } else if (!hv_result_success(status)) { > @@ -2048,6 +2050,9 @@ static long mshv_dev_ioctl(struct file *filp, unsigned int ioctl, > case MSHV_CREATE_PARTITION: > return mshv_ioctl_create_partition((void __user *)arg, > misc->this_device); > + case MSHV_ROOT_HVCALL: > + return mshv_ioctl_passthru_hvcall(NULL, false, > + (void __user *)arg); > } > > return -ENOTTY; > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-15 6:22 ` Wei Liu @ 2025-11-15 7:39 ` Anirudh Rayabharam 2025-11-15 7:46 ` Wei Liu 0 siblings, 1 reply; 8+ messages in thread From: Anirudh Rayabharam @ 2025-11-15 7:39 UTC (permalink / raw) To: Wei Liu Cc: K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Long Li, linux-hyperv, linux-kernel On Sat, Nov 15, 2025 at 06:22:40AM +0000, Wei Liu wrote: > On Fri, Nov 14, 2025 at 09:58:52AM +0000, Anirudh Rayabharam wrote: > > From: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> > > > > Allow MSHV_ROOT_HVCALL IOCTL on the /dev/mshv fd. This IOCTL would > > execute a passthrough hypercall targeting the root/parent partition > > i.e. HV_PARTITION_ID_SELF. > > > > This will be useful for the VMM to query things like supported > > synthetic processor features, supported VMM capabiliites etc. > > > > While at it, add HVCALL_GET_PARTITION_PROPERTY_EX to the allowed list of > > passthrough hypercalls. > > > > Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> > > This doesn't apply to hyperv-next. What's its base? Hmmm... I remember doing this on hyperv-next. This the parent I see: commit f2329fd987a0da4759c307c46fd27c4d05bb7433 Author: Naman Jain <namjain@linux.microsoft.com> Date: Thu Nov 13 04:41:49 2025 +0000 Drivers: hv: Introduce mshv_vtl driver No worries, I can rebase it on hyperv-next and send it again. Thanks, Anirudh. > > Wei > > > --- > > drivers/hv/mshv_root_main.c | 11 ++++++++--- > > 1 file changed, 8 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c > > index 20eda00a1b5a..98f56322cd19 100644 > > --- a/drivers/hv/mshv_root_main.c > > +++ b/drivers/hv/mshv_root_main.c > > @@ -122,6 +122,7 @@ static struct miscdevice mshv_dev = { > > */ > > static u16 mshv_passthru_hvcalls[] = { > > HVCALL_GET_PARTITION_PROPERTY, > > + HVCALL_GET_PARTITION_PROPERTY_EX, > > HVCALL_SET_PARTITION_PROPERTY, > > HVCALL_INSTALL_INTERCEPT, > > HVCALL_GET_VP_REGISTERS, > > @@ -159,6 +160,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > > unsigned int pages_order; > > void *input_pg = NULL; > > void *output_pg = NULL; > > + u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF; > > > > if (copy_from_user(&args, user_args, sizeof(args))) > > return -EFAULT; > > @@ -180,7 +182,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > > is_async = mshv_hvcall_is_async(args.code); > > if (is_async) { > > /* async hypercalls can only be called from partition fd */ > > - if (!partition_locked) > > + if (!partition || !partition_locked) > > return -EINVAL; > > ret = mshv_init_async_handler(partition); > > if (ret) > > @@ -208,7 +210,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > > * NOTE: This only works because all the allowed hypercalls' input > > * structs begin with a u64 partition_id field. > > */ > > - *(u64 *)input_pg = partition->pt_id; > > + *(u64 *)input_pg = pt_id; > > > > if (args.reps) > > status = hv_do_rep_hypercall(args.code, args.reps, 0, > > @@ -226,7 +228,7 @@ static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, > > } > > > > if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) { > > - ret = hv_call_deposit_pages(NUMA_NO_NODE, partition->pt_id, 1); > > + ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1); > > if (!ret) > > ret = -EAGAIN; > > } else if (!hv_result_success(status)) { > > @@ -2048,6 +2050,9 @@ static long mshv_dev_ioctl(struct file *filp, unsigned int ioctl, > > case MSHV_CREATE_PARTITION: > > return mshv_ioctl_create_partition((void __user *)arg, > > misc->this_device); > > + case MSHV_ROOT_HVCALL: > > + return mshv_ioctl_passthru_hvcall(NULL, false, > > + (void __user *)arg); > > } > > > > return -ENOTTY; > > -- > > 2.34.1 > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-15 7:39 ` Anirudh Rayabharam @ 2025-11-15 7:46 ` Wei Liu 0 siblings, 0 replies; 8+ messages in thread From: Wei Liu @ 2025-11-15 7:46 UTC (permalink / raw) To: Anirudh Rayabharam Cc: Wei Liu, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Long Li, linux-hyperv, linux-kernel On Sat, Nov 15, 2025 at 01:09:12PM +0530, Anirudh Rayabharam wrote: > On Sat, Nov 15, 2025 at 06:22:40AM +0000, Wei Liu wrote: > > On Fri, Nov 14, 2025 at 09:58:52AM +0000, Anirudh Rayabharam wrote: > > > From: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> > > > > > > Allow MSHV_ROOT_HVCALL IOCTL on the /dev/mshv fd. This IOCTL would > > > execute a passthrough hypercall targeting the root/parent partition > > > i.e. HV_PARTITION_ID_SELF. > > > > > > This will be useful for the VMM to query things like supported > > > synthetic processor features, supported VMM capabiliites etc. > > > > > > While at it, add HVCALL_GET_PARTITION_PROPERTY_EX to the allowed list of > > > passthrough hypercalls. > > > > > > Signed-off-by: Anirudh Rayabharam (Microsoft) <anirudh@anirudhrb.com> > > > > This doesn't apply to hyperv-next. What's its base? > > Hmmm... I remember doing this on hyperv-next. This the parent I see: > > commit f2329fd987a0da4759c307c46fd27c4d05bb7433 > Author: Naman Jain <namjain@linux.microsoft.com> > Date: Thu Nov 13 04:41:49 2025 +0000 > > Drivers: hv: Introduce mshv_vtl driver > > No worries, I can rebase it on hyperv-next and send it again. I pulled in some patches from hyperv-fixes to hyperv-next. That's probably why. But you will see that eventually during a merge later anyway, so it is good to just rebase and resend. Wei > > Thanks, > Anirudh. > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-14 9:58 [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls Anirudh Rayabharam 2025-11-15 6:22 ` Wei Liu @ 2025-11-16 8:17 ` kernel test robot 2025-11-17 17:34 ` Wei Liu 1 sibling, 1 reply; 8+ messages in thread From: kernel test robot @ 2025-11-16 8:17 UTC (permalink / raw) To: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li Cc: llvm, oe-kbuild-all, anirudh, linux-hyperv, linux-kernel Hi Anirudh, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v6.18-rc5] [cannot apply to next-20251114] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039 base: linus/master patch link: https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX' 125 | HVCALL_GET_PARTITION_PROPERTY_EX, | ^ >> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 175 | for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^~~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:52: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ^~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:61: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ^~~~ drivers/hv/mshv_root_main.c:179:11: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') 179 | if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/array_size.h:11:32: note: expanded from macro 'ARRAY_SIZE' 11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | ^ include/linux/compiler.h:55:47: note: expanded from macro 'if' 55 | #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) ) | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ include/linux/compiler.h:57:86: note: expanded from macro '__trace_if_var' 57 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond)) | ~~~~~~~~~~~~~~~~~^~~~~ include/linux/compiler.h:68:3: note: expanded from macro '__trace_if_value' 68 | (cond) ? \ | ^~~~ 5 errors generated. vim +/HVCALL_GET_PARTITION_PROPERTY_EX +125 drivers/hv/mshv_root_main.c 117 118 /* 119 * Only allow hypercalls that have a u64 partition id as the first member of 120 * the input structure. 121 * These are sorted by value. 122 */ 123 static u16 mshv_passthru_hvcalls[] = { 124 HVCALL_GET_PARTITION_PROPERTY, > 125 HVCALL_GET_PARTITION_PROPERTY_EX, 126 HVCALL_SET_PARTITION_PROPERTY, 127 HVCALL_INSTALL_INTERCEPT, 128 HVCALL_GET_VP_REGISTERS, 129 HVCALL_SET_VP_REGISTERS, 130 HVCALL_TRANSLATE_VIRTUAL_ADDRESS, 131 HVCALL_CLEAR_VIRTUAL_INTERRUPT, 132 HVCALL_REGISTER_INTERCEPT_RESULT, 133 HVCALL_ASSERT_VIRTUAL_INTERRUPT, 134 HVCALL_GET_GPA_PAGES_ACCESS_STATES, 135 HVCALL_SIGNAL_EVENT_DIRECT, 136 HVCALL_POST_MESSAGE_DIRECT, 137 HVCALL_GET_VP_CPUID_VALUES, 138 }; 139 140 static bool mshv_hvcall_is_async(u16 code) 141 { 142 switch (code) { 143 case HVCALL_SET_PARTITION_PROPERTY: 144 return true; 145 default: 146 break; 147 } 148 return false; 149 } 150 151 static int mshv_ioctl_passthru_hvcall(struct mshv_partition *partition, 152 bool partition_locked, 153 void __user *user_args) 154 { 155 u64 status; 156 int ret = 0, i; 157 bool is_async; 158 struct mshv_root_hvcall args; 159 struct page *page; 160 unsigned int pages_order; 161 void *input_pg = NULL; 162 void *output_pg = NULL; 163 u64 pt_id = partition ? partition->pt_id : HV_PARTITION_ID_SELF; 164 165 if (copy_from_user(&args, user_args, sizeof(args))) 166 return -EFAULT; 167 168 if (args.status || !args.in_ptr || args.in_sz < sizeof(u64) || 169 mshv_field_nonzero(args, rsvd) || args.in_sz > HV_HYP_PAGE_SIZE) 170 return -EINVAL; 171 172 if (args.out_ptr && (!args.out_sz || args.out_sz > HV_HYP_PAGE_SIZE)) 173 return -EINVAL; 174 > 175 for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) 176 if (args.code == mshv_passthru_hvcalls[i]) 177 break; 178 179 if (i >= ARRAY_SIZE(mshv_passthru_hvcalls)) 180 return -EINVAL; 181 182 is_async = mshv_hvcall_is_async(args.code); 183 if (is_async) { 184 /* async hypercalls can only be called from partition fd */ 185 if (!partition || !partition_locked) 186 return -EINVAL; 187 ret = mshv_init_async_handler(partition); 188 if (ret) 189 return ret; 190 } 191 192 pages_order = args.out_ptr ? 1 : 0; 193 page = alloc_pages(GFP_KERNEL, pages_order); 194 if (!page) 195 return -ENOMEM; 196 input_pg = page_address(page); 197 198 if (args.out_ptr) 199 output_pg = (char *)input_pg + PAGE_SIZE; 200 else 201 output_pg = NULL; 202 203 if (copy_from_user(input_pg, (void __user *)args.in_ptr, 204 args.in_sz)) { 205 ret = -EFAULT; 206 goto free_pages_out; 207 } 208 209 /* 210 * NOTE: This only works because all the allowed hypercalls' input 211 * structs begin with a u64 partition_id field. 212 */ 213 *(u64 *)input_pg = pt_id; 214 215 if (args.reps) 216 status = hv_do_rep_hypercall(args.code, args.reps, 0, 217 input_pg, output_pg); 218 else 219 status = hv_do_hypercall(args.code, input_pg, output_pg); 220 221 if (hv_result(status) == HV_STATUS_CALL_PENDING) { 222 if (is_async) { 223 mshv_async_hvcall_handler(partition, &status); 224 } else { /* Paranoia check. This shouldn't happen! */ 225 ret = -EBADFD; 226 goto free_pages_out; 227 } 228 } 229 230 if (hv_result(status) == HV_STATUS_INSUFFICIENT_MEMORY) { 231 ret = hv_call_deposit_pages(NUMA_NO_NODE, pt_id, 1); 232 if (!ret) 233 ret = -EAGAIN; 234 } else if (!hv_result_success(status)) { 235 ret = hv_result_to_errno(status); 236 } 237 238 /* 239 * Always return the status and output data regardless of result. 240 * The VMM may need it to determine how to proceed. E.g. the status may 241 * contain the number of reps completed if a rep hypercall partially 242 * succeeded. 243 */ 244 args.status = hv_result(status); 245 args.reps = args.reps ? hv_repcomp(status) : 0; 246 if (copy_to_user(user_args, &args, sizeof(args))) 247 ret = -EFAULT; 248 249 if (output_pg && 250 copy_to_user((void __user *)args.out_ptr, output_pg, args.out_sz)) 251 ret = -EFAULT; 252 253 free_pages_out: 254 free_pages((unsigned long)input_pg, pages_order); 255 256 return ret; 257 } 258 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-16 8:17 ` kernel test robot @ 2025-11-17 17:34 ` Wei Liu 2025-11-17 17:41 ` Nuno Das Neves 0 siblings, 1 reply; 8+ messages in thread From: Wei Liu @ 2025-11-17 17:34 UTC (permalink / raw) To: kernel test robot, nunodasneves Cc: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, Long Li, llvm, oe-kbuild-all, linux-hyperv, linux-kernel +Nuno On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote: > Hi Anirudh, > > kernel test robot noticed the following build errors: > > [auto build test ERROR on linus/master] > [also build test ERROR on v6.18-rc5] > [cannot apply to next-20251114] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039 > base: linus/master > patch link: https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com > patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls > config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config) > compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/reproduce) > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > the same patch/commit), kindly add following tags > | Reported-by: kernel test robot <lkp@intel.com> > | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > >> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX' > 125 | HVCALL_GET_PARTITION_PROPERTY_EX, > | ^ Anirudh, please check this. > >> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') > 175 | for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This is from the original patch. Perhaps adding the explicit declaration of the array size would help. Wei ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-17 17:34 ` Wei Liu @ 2025-11-17 17:41 ` Nuno Das Neves 2025-11-17 17:57 ` Anirudh Rayabharam 0 siblings, 1 reply; 8+ messages in thread From: Nuno Das Neves @ 2025-11-17 17:41 UTC (permalink / raw) To: Wei Liu, kernel test robot Cc: Anirudh Rayabharam, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Long Li, llvm, oe-kbuild-all, linux-hyperv, linux-kernel On 11/17/2025 9:34 AM, Wei Liu wrote: > +Nuno > > On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote: >> Hi Anirudh, >> >> kernel test robot noticed the following build errors: >> >> [auto build test ERROR on linus/master] >> [also build test ERROR on v6.18-rc5] >> [cannot apply to next-20251114] >> [If your patch is applied to the wrong git tree, kindly drop us a note. >> And when submitting patch, we suggest to use '--base' as documented in >> https://git-scm.com/docs/git-format-patch#_base_tree_information] >> >> url: https://github.com/intel-lab-lkp/linux/commits/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039 >> base: linus/master >> patch link: https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com >> patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls >> config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config) >> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) >> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/reproduce) >> >> If you fix the issue in a separate patch/commit (i.e. not just a new version of >> the same patch/commit), kindly add following tags >> | Reported-by: kernel test robot <lkp@intel.com> >> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/ >> >> All errors (new ones prefixed by >>): >> >>>> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX' >> 125 | HVCALL_GET_PARTITION_PROPERTY_EX, >> | ^ > > Anirudh, please check this. > This is introduced in hyperv-next, in: 59aeea195948 mshv: Add the HVCALL_GET_PARTITION_PROPERTY_EX hypercall But the bot applies the patch to linus/master, that is probably why. >>>> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') >> 175 | for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > This is from the original patch. Perhaps adding the explicit declaration > of the array size would help. > I think this is just due to the earlier error... Nuno > Wei ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls 2025-11-17 17:41 ` Nuno Das Neves @ 2025-11-17 17:57 ` Anirudh Rayabharam 0 siblings, 0 replies; 8+ messages in thread From: Anirudh Rayabharam @ 2025-11-17 17:57 UTC (permalink / raw) To: Nuno Das Neves Cc: Wei Liu, kernel test robot, K. Y. Srinivasan, Haiyang Zhang, Dexuan Cui, Long Li, llvm, oe-kbuild-all, linux-hyperv, linux-kernel On Mon, Nov 17, 2025 at 09:41:19AM -0800, Nuno Das Neves wrote: > On 11/17/2025 9:34 AM, Wei Liu wrote: > > +Nuno > > > > On Sun, Nov 16, 2025 at 04:17:08PM +0800, kernel test robot wrote: > >> Hi Anirudh, > >> > >> kernel test robot noticed the following build errors: > >> > >> [auto build test ERROR on linus/master] > >> [also build test ERROR on v6.18-rc5] > >> [cannot apply to next-20251114] > >> [If your patch is applied to the wrong git tree, kindly drop us a note. > >> And when submitting patch, we suggest to use '--base' as documented in > >> https://git-scm.com/docs/git-format-patch#_base_tree_information] > >> > >> url: https://github.com/intel-lab-lkp/linux/commits/Anirudh-Rayabharam/Drivers-hv-ioctl-for-self-targeted-passthrough-hvcalls/20251114-182039 > >> base: linus/master > >> patch link: https://lore.kernel.org/r/20251114095853.3482596-1-anirudh%40anirudhrb.com > >> patch subject: [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls > >> config: x86_64-buildonly-randconfig-005-20251116 (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/config) > >> compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) > >> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511161617.KcDzR4sA-lkp@intel.com/reproduce) > >> > >> If you fix the issue in a separate patch/commit (i.e. not just a new version of > >> the same patch/commit), kindly add following tags > >> | Reported-by: kernel test robot <lkp@intel.com> > >> | Closes: https://lore.kernel.org/oe-kbuild-all/202511161617.KcDzR4sA-lkp@intel.com/ > >> > >> All errors (new ones prefixed by >>): > >> > >>>> drivers/hv/mshv_root_main.c:125:2: error: use of undeclared identifier 'HVCALL_GET_PARTITION_PROPERTY_EX' > >> 125 | HVCALL_GET_PARTITION_PROPERTY_EX, > >> | ^ > > > > Anirudh, please check this. > > > This is introduced in hyperv-next, in: > 59aeea195948 mshv: Add the HVCALL_GET_PARTITION_PROPERTY_EX hypercall > > But the bot applies the patch to linus/master, that is probably why. Right. In the v2 of this patch, I used the --base argument to git format-patch as suggested by the tool above. That should help it apply the patch in the right tree. Let's see if it still complains. Anirudh > > >>>> drivers/hv/mshv_root_main.c:175:18: error: invalid application of 'sizeof' to an incomplete type 'u16[]' (aka 'unsigned short[]') > >> 175 | for (i = 0; i < ARRAY_SIZE(mshv_passthru_hvcalls); ++i) > >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > This is from the original patch. Perhaps adding the explicit declaration > > of the array size would help. > > > > I think this is just due to the earlier error... > > Nuno > > > Wei > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-11-17 17:58 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-14 9:58 [PATCH] Drivers: hv: ioctl for self targeted passthrough hvcalls Anirudh Rayabharam 2025-11-15 6:22 ` Wei Liu 2025-11-15 7:39 ` Anirudh Rayabharam 2025-11-15 7:46 ` Wei Liu 2025-11-16 8:17 ` kernel test robot 2025-11-17 17:34 ` Wei Liu 2025-11-17 17:41 ` Nuno Das Neves 2025-11-17 17:57 ` Anirudh Rayabharam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox