Commit 9eece498 authored by Juergen Gross's avatar Juergen Gross Committed by Ingo Molnar
Browse files

x86/paravirt: Replace io_delay() hook with a bool



The io_delay() paravirt hook is in no way performance critical and all users
setting it to a different function than native_io_delay() are using an empty
function as replacement.

Allow replacing the hook with a bool indicating whether native_io_delay()
should be called.

  [ bp: Massage commit message. ]

Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://patch.msgid.link/20260119182632.596369-3-jgross@suse.com
parent 36c1eb95
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -242,11 +242,16 @@ extern int io_delay_type;
extern void io_delay_init(void);

#if defined(CONFIG_PARAVIRT)
#include <asm/paravirt.h>
#include <asm/paravirt-base.h>
#else
#define call_io_delay() true
#endif

static inline void slow_down_io(void)
{
	if (!call_io_delay())
		return;

	native_io_delay();
#ifdef REALLY_SLOW_IO
	native_io_delay();
@@ -255,8 +260,6 @@ static inline void slow_down_io(void)
#endif
}

#endif

#define BUILDIO(bwl, type)						\
static inline void out##bwl##_p(type value, u16 port)			\
{									\
+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ struct pv_info {
#ifdef CONFIG_PARAVIRT_XXL
	u16 extra_user_64bit_cs;  /* __USER_CS if none */
#endif
	bool io_delay;

	const char *name;
};

@@ -26,6 +28,10 @@ u64 _paravirt_ident_64(u64);
#endif
#define paravirt_nop	((void *)nop_func)

#ifdef CONFIG_PARAVIRT
#define call_io_delay() pv_info.io_delay
#endif

#ifdef CONFIG_PARAVIRT_SPINLOCKS
void paravirt_set_cap(void);
#else
+0 −11
Original line number Diff line number Diff line
@@ -19,17 +19,6 @@
#include <linux/cpumask.h>
#include <asm/frame.h>

/* The paravirtualized I/O functions */
static inline void slow_down_io(void)
{
	PVOP_VCALL0(pv_ops, cpu.io_delay);
#ifdef REALLY_SLOW_IO
	PVOP_VCALL0(pv_ops, cpu.io_delay);
	PVOP_VCALL0(pv_ops, cpu.io_delay);
	PVOP_VCALL0(pv_ops, cpu.io_delay);
#endif
}

void native_flush_tlb_local(void);
void native_flush_tlb_global(void);
void native_flush_tlb_one_user(unsigned long addr);
+0 −2
Original line number Diff line number Diff line
@@ -30,8 +30,6 @@ struct pv_lazy_ops {

struct pv_cpu_ops {
	/* hooks for various privileged instructions */
	void (*io_delay)(void);

#ifdef CONFIG_PARAVIRT_XXL
	unsigned long (*get_debugreg)(int regno);
	void (*set_debugreg)(int regno, unsigned long value);
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ arch_initcall(activate_jump_labels);
static void __init vmware_paravirt_ops_setup(void)
{
	pv_info.name = "VMware hypervisor";
	pv_ops.cpu.io_delay = paravirt_nop;
	pv_info.io_delay = false;

	if (vmware_tsc_khz == 0)
		return;
Loading