On 26.02.2025 23:47, dm...@proton.me wrote:
> @@ -562,10 +560,9 @@ static void __serial_rx(char c)
>          rc = vpl011_rx_char_xen(d, c);
>  #endif
>  
> -#ifdef CONFIG_X86
> -    if ( pv_shim && pv_console )
> -        consoled_guest_tx(c);
> -#endif
> +    if ( consoled_is_enabled() )
> +        /* Deliver input to the PV shim console. */
> +        rc = consoled_guest_tx(c);

With this being the only call site of consoled_guest_tx(), ...

> --- a/xen/include/xen/consoled.h
> +++ b/xen/include/xen/consoled.h
> @@ -1,12 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
>  #ifndef __XEN_CONSOLED_H__
>  #define __XEN_CONSOLED_H__
>  
>  #include <public/io/console.h>
>  
> +#ifdef CONFIG_PV_SHIM
> +
>  void consoled_set_ring_addr(struct xencons_interface *ring);
>  struct xencons_interface *consoled_get_ring_addr(void);
> -void consoled_guest_rx(void);
> -void consoled_guest_tx(char c);
> +int consoled_guest_rx(void);
> +int consoled_guest_tx(char c);
> +bool consoled_is_enabled(void);
> +
> +#else
> +
> +static inline int consoled_guest_tx(char c)
> +{
> +    ASSERT_UNREACHABLE();
> +    return -ENODEV;
> +}

... why is this stub needed when we have ...

> +#define consoled_is_enabled()   (false)

... this compile-time-constant predicate? All that's needed is a visible
declaration of the function, for compilation to succeed. DCE will then take
care of eliminating the function call, and hence things will link fine.

Jan

Reply via email to