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

Re: [PATCH 1/2] x86: Parse Multiboot2 framebuffer information


  • To: Tu Dinh Ngoc <dinhngoc.tu@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 9 Feb 2022 14:38:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=cdxoP0qrEd4fbAQscg9PUIZpavjxZTYZp9nObyNZY1A=; b=ha+cKjhlO9J0TbKsS0diOlAtaQRJJ9seNu8wzNgtxPtXjEjFFIy1HR73fe+uf68qCGP1599ybJmOXPyM5cu/2IqHxsQkAq06/nyyXPD1y9j5Ahv0g4l3JSv6KHd4KFZSSGl5jKwH2AZ2z3EQXYvrNzn1YAgmSkrshS8WiKro00QXmP3ufxE1n84Us0SArFQwK3OhBmvyhFSWy/l+xUjR62zj1WORSc/MzNbi9ImoxGXJpFjM9iokO9JuYbGsyokdVnkXU8weEGRPZlkXYb+YTs6rNYmQ1e9OFp8ZHwRrPf97oJay0QmnFnww99QksFKCM5PJeNNsQdYHF5MU1wKtRg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0vx5vM3GauyzPE/qsM+N7ufpud/UzLzlUxVVjyHjhAIBqPQ1iMt14IehazJQphmoEENVw73xjBgiWVMJa0QSnb46paV9Gh/Jlrl9yuiECFRwyAqiRnD081FBkXNBm3P9jUWY1lTtg9hZKBpXIjLamwS2HhJZ8AuJ6u1TMAD0CZ9Pn8qY4mmP9zkbI25moUX46ONIkbjQOBwpBWy/HnmbzJ0f2mryxtBQBaRuQSX9g3ipiNcudsS4E9rVXVBXa3g6CHvR94eJKlYKRER2eRpqILedLdoRzIMiy5icyf6Ywxsg5hl83zGcNKDGZtA9H9tcL8Orieg1tbjYbKHxrMgYg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 09 Feb 2022 13:38:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.02.2022 14:09, Tu Dinh Ngoc wrote:
> --- a/xen/arch/x86/boot/reloc.c
> +++ b/xen/arch/x86/boot/reloc.c
> @@ -156,6 +156,8 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)
>      multiboot_info_t *mbi_out;
>      u32 ptr;
>      unsigned int i, mod_idx = 0;
> +    u64 fbaddr;
> +    u8 fbtype;

Style: Despite adjacent pre-existing code doing so, new code should
not be using u<N> anymore, but use uint<N>_t instead.

> @@ -254,6 +256,26 @@ static multiboot_info_t *mbi2_reloc(u32 mbi_in)
>              ++mod_idx;
>              break;
>  
> +        case MULTIBOOT2_TAG_TYPE_FRAMEBUFFER:
> +            fbaddr = get_mb2_data(tag, framebuffer, framebuffer_addr);
> +            fbtype = get_mb2_data(tag, framebuffer, framebuffer_type);
> +            if (fbaddr == 0 || fbtype != MULTIBOOT2_FRAMEBUFFER_TYPE_RGB)

Style: Blanks needed immediately inside the parentheses.

> +                break;
> +            mbi_out->flags |= MBI_FB;
> +            mbi_out->fb.addr = fbaddr;
> +            mbi_out->fb.pitch = get_mb2_data(tag, framebuffer, 
> framebuffer_pitch);
> +            mbi_out->fb.width = get_mb2_data(tag, framebuffer, 
> framebuffer_width);
> +            mbi_out->fb.height = get_mb2_data(tag, framebuffer, 
> framebuffer_height);
> +            mbi_out->fb.bpp = get_mb2_data(tag, framebuffer, 
> framebuffer_bpp);
> +            mbi_out->fb.type = fbtype;
> +            mbi_out->fb.red_pos = get_mb2_data(tag, framebuffer, 
> framebuffer_red_field_position);
> +            mbi_out->fb.red_size = get_mb2_data(tag, framebuffer, 
> framebuffer_red_mask_size);
> +            mbi_out->fb.green_pos = get_mb2_data(tag, framebuffer, 
> framebuffer_green_field_position);
> +            mbi_out->fb.green_size = get_mb2_data(tag, framebuffer, 
> framebuffer_green_mask_size);
> +            mbi_out->fb.blue_pos = get_mb2_data(tag, framebuffer, 
> framebuffer_blue_field_position);
> +            mbi_out->fb.blue_size = get_mb2_data(tag, framebuffer, 
> framebuffer_blue_mask_size);
> +            break;

Some of these lines are overly long. Much like you don't have
frambuffer_ prefixes on multiboot_info_t field names, you could
omit them on multiboot2_tag_framebuffer_t, which would reduce line
length some already. You're likely still not going to get around
wrapping some of the lines.

> --- a/xen/include/xen/multiboot.h
> +++ b/xen/include/xen/multiboot.h
> @@ -42,6 +42,7 @@
>  #define MBI_BIOSCONFIG (_AC(1,u) << 8)
>  #define MBI_LOADERNAME (_AC(1,u) << 9)
>  #define MBI_APM        (_AC(1,u) << 10)
> +#define MBI_FB         (_AC(1,u) << 11)

>From what I can see in grub's multiboot.h bit 11 is VBE_INFO, while
bit 12 is FRAMEBUFFER_INFO.

> @@ -101,6 +102,22 @@ typedef struct {
>  
>      /* Valid if flags sets MBI_APM */
>      u32 apm_table;
> +
> +    /* Valid if flags sets MBI_FB */
> +    struct {
> +        u64 addr;
> +        u32 pitch;
> +        u32 width;
> +        u32 height;
> +        u8 bpp;
> +        u8 type;
> +        u8 red_pos;
> +        u8 red_size;
> +        u8 green_pos;
> +        u8 green_size;
> +        u8 blue_pos;
> +        u8 blue_size;
> +    } fb;
>  } multiboot_info_t;

What you add is not MB1-compatible (VBE fields come first). Furthermore
the addition means mbi_reloc() will suddenly copy more data, which I
don't think can be assumed to be fully compatible.

Jan




 


Rackspace

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