hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/arch/x86/include/asm/xen/hypercall.h
....@@ -38,11 +38,11 @@
3838 #include <linux/errno.h>
3939 #include <linux/string.h>
4040 #include <linux/types.h>
41
+#include <linux/pgtable.h>
4142
4243 #include <trace/events/xen.h>
4344
4445 #include <asm/page.h>
45
-#include <asm/pgtable.h>
4646 #include <asm/smap.h>
4747 #include <asm/nospec-branch.h>
4848
....@@ -82,7 +82,7 @@
8282 * - clobber the rest
8383 *
8484 * The result certainly isn't pretty, and it really shows up cpp's
85
- * weakness as as macro language. Sorry. (But let's just give thanks
85
+ * weakness as a macro language. Sorry. (But let's just give thanks
8686 * there aren't more than 5 arguments...)
8787 */
8888
....@@ -217,6 +217,22 @@
217217 return (long)__res;
218218 }
219219
220
+static __always_inline void __xen_stac(void)
221
+{
222
+ /*
223
+ * Suppress objtool seeing the STAC/CLAC and getting confused about it
224
+ * calling random code with AC=1.
225
+ */
226
+ asm volatile(ANNOTATE_IGNORE_ALTERNATIVE
227
+ ASM_STAC ::: "memory", "flags");
228
+}
229
+
230
+static __always_inline void __xen_clac(void)
231
+{
232
+ asm volatile(ANNOTATE_IGNORE_ALTERNATIVE
233
+ ASM_CLAC ::: "memory", "flags");
234
+}
235
+
220236 static inline long
221237 privcmd_call(unsigned int call,
222238 unsigned long a1, unsigned long a2,
....@@ -225,9 +241,9 @@
225241 {
226242 long res;
227243
228
- stac();
244
+ __xen_stac();
229245 res = xen_single_call(call, a1, a2, a3, a4, a5);
230
- clac();
246
+ __xen_clac();
231247
232248 return res;
233249 }
....@@ -335,15 +351,11 @@
335351 return _hypercall4(int, update_va_mapping, va,
336352 new_val.pte, new_val.pte >> 32, flags);
337353 }
338
-extern int __must_check xen_event_channel_op_compat(int, void *);
339354
340355 static inline int
341356 HYPERVISOR_event_channel_op(int cmd, void *arg)
342357 {
343
- int rc = _hypercall2(int, event_channel_op, cmd, arg);
344
- if (unlikely(rc == -ENOSYS))
345
- rc = xen_event_channel_op_compat(cmd, arg);
346
- return rc;
358
+ return _hypercall2(int, event_channel_op, cmd, arg);
347359 }
348360
349361 static inline int
....@@ -358,15 +370,10 @@
358370 return _hypercall3(int, console_io, cmd, count, str);
359371 }
360372
361
-extern int __must_check xen_physdev_op_compat(int, void *);
362
-
363373 static inline int
364374 HYPERVISOR_physdev_op(int cmd, void *arg)
365375 {
366
- int rc = _hypercall2(int, physdev_op, cmd, arg);
367
- if (unlikely(rc == -ENOSYS))
368
- rc = xen_physdev_op_compat(cmd, arg);
369
- return rc;
376
+ return _hypercall2(int, physdev_op, cmd, arg);
370377 }
371378
372379 static inline int
....@@ -433,9 +440,9 @@
433440 domid_t dom, unsigned int nr_bufs, struct xen_dm_op_buf *bufs)
434441 {
435442 int ret;
436
- stac();
443
+ __xen_stac();
437444 ret = _hypercall3(int, dm_op, dom, nr_bufs, bufs);
438
- clac();
445
+ __xen_clac();
439446 return ret;
440447 }
441448