[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/platform: make XENPF_get_dom0_console actually usable


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 14 Feb 2023 08:21:30 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ulJXw170r8WN8WSBOaLWRs33tLp8RRxGLUjOt9zeFtk=; b=hQEJBRQHlPVB87+migtbcE2SoV9UvhjWp29XNZD2UuzpfYsxsA7RfADfBe7KP5KZ4rpLiVB1X3ax/6HvhpU1GMwMWLzR3qYqDeUOpH/yUdRa3LG4+gxyrf2JWjBN8B8szx2G7wacPKePNaTM16bPJxKJ9KseK0St9Lna0F6rs1VzMRJR6/b5sSXrzMvXj7mqbpSrNNpsuHtNNqPE+htWHIcAkHcRuJTP1ZjPwzoYfR8+vJsvGomqjy1EpQ5lyBn45xzIEmmph0pSnMRv2n/CgetfkWdWE8TqZuWa0a6WmHjgJDOPkrXy56eEMLTSwF1qgc2iijg0IulDYnRRMXcR9Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WTpYR0udfnr+mPhtWKDZhMUYO/RJKIjoXZ85e19DdpWwPzIWfizvAfm8Fw8+pIw4rYJviV2WmWoRQUDalrtQpyMNtWyZX5aEZgt4aGROHA7kkvsmebZP8xOn4YFqnPELp3hY36lT9EvitmkBKutu/MF6aSI5WfkdBqFuq0ZaKDqWDXfLxWJJ4d4lIUCEMRtrbDDYC32UtuwS7JZ+AAWb8UX1sZc7/PIBzYmEuNGuK/VrloeeERA5ZL0FGaAEkKcxxawGKFxQ/87w+C4RLWKwiED/ZZF/4EyKvAy8J2gdYmW9F/DS1HtseyvH1/IIjERdfCG5RosCNGiLkPC68wTCOw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 14 Feb 2023 07:22:19 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.02.2023 15:51, Jan Beulich wrote:
> struct dom0_vga_console_info has been extended in the past, and it may
> be extended again. The use in PV Dom0's start info already covers for
> that by supplying the size of the provided data. For the recently
> introduced platform-op size needs providing similarly. Go the easiest
> available route and simply supply size via the hypercall return value.
> 
> While there also add a build-time check that possibly future growth of
> the struct won't affect xen_platform_op_t's size.
> 
> Fixes: 4dd160583c79 ("x86/platform: introduce hypercall to get initial video 
> console settings")
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Noticed while trying to actually use the new hypercall in Linux.
> 
> --- a/xen/arch/x86/platform_hypercall.c
> +++ b/xen/arch/x86/platform_hypercall.c
> @@ -841,6 +841,8 @@ ret_t do_platform_op(
>  
>  #ifdef CONFIG_VIDEO
>      case XENPF_get_dom0_console:
> +        BUILD_BUG_ON(sizeof(op->u.dom0_console) > sizeof(op->u.pad));
> +        ret = sizeof(op->u.dom0_console);
>          if ( !fill_console_start_info(&op->u.dom0_console) )
>          {
>              ret = -ENODEV;
> 

Thinking about it, I've added the hunk below.

Jan

--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -605,7 +605,11 @@ struct xenpf_symdata {
 typedef struct xenpf_symdata xenpf_symdata_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_symdata_t);
 
-/* Fetch the video console information and mode setup by Xen. */
+/*
+ * Fetch the video console information and mode setup by Xen.  A non-
+ * negative return value indicates the size of the (part of the) structure
+ * which was filled.
+ */
 #define XENPF_get_dom0_console 64
 typedef struct dom0_vga_console_info xenpf_dom0_console_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_dom0_console_t);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.