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

Re: [PATCH v4 1/8] x86/boot: make "vga=current" work with graphics modes


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 5 Apr 2022 10:36:34 +0200
  • 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=Yk0fV4nj4m406HYCG/W4dHjIJKapYN2w3JVb2ycNGbQ=; b=Af9Ur295PC2uJ5CAJTsVRqdCeskByauSm5iu7ukATZm4jD3OsKYJyt+cAClXx7nZrZp9kLAODQo9zPK+2rO5NRW4jCZnZQB6fVgQnAWIs8qePtWhkC8euERmPiSQOVhMcQKMLVLNH82g7SDtK2uoF2eFNWO1QSmsO6/P2qg+E8mnke75l70NYNcGzH69ihNDGR81mSmaJDesX7RrD5zmht/Y2J9hk6VkqkzUTibh8PmKmr1BA0IHEdivshoDwv0VcND1pNblND6KocwLKbOGnoH8HisUmoy9v5d4H0lXqIkBwRF3Yx/MIcZBknKWwufGN48ZQUyhj5sAMNusYc1jqQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lmUZptHR1/R0/o5YIGwjZ+6fln/YMIa1ZdMwYkTgmVpmYO3rBIFr73aWPKy3fBDKiKyHw3r17obY75Dc95DRTobU5RwMjEmBSnNw6i6Ok9dXQ8FWinUHQ8YFbxQDoDxF4JqXf4p/cTm2Uh95ARde5VMBoypzel3ojGBxTF3SaAR+O0R3C5zsNim1zEnUkWkb0Cl1t3zR2KWRCbGxAJE513c/+EYFNLIODdgJoXKD/HPNQi3OiBzLdp15sTcrl6Rp0xaNcRBk4lkUOG1TpkKnX/G7YQ61nRNUZY+JALLxtNe7FT5cdji9BveWcC68TTl6zt82Xqye4l/g8odOmPhpbw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 05 Apr 2022 08:36:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 05.04.2022 10:24, Roger Pau Monné wrote:
> On Mon, Apr 04, 2022 at 05:50:57PM +0200, Jan Beulich wrote:
>> (reducing Cc list some)
>>
>> On 04.04.2022 16:49, Roger Pau Monné wrote:
>>> On Thu, Mar 31, 2022 at 11:44:10AM +0200, Jan Beulich wrote:
>>>> GrUB2 can be told to leave the screen in the graphics mode it has been
>>>> using (or any other one), via "set gfxpayload=keep" (or suitable
>>>> variants thereof). In this case we can avoid doing another mode switch
>>>> ourselves. This in particular avoids possibly setting the screen to a
>>>> less desirable mode: On one of my test systems the set of modes
>>>> reported available by the VESA BIOS depends on whether the interposed
>>>> KVM switch has that machine set as the active one. If it's not active,
>>>> only modes up to 1024x768 get reported, while when active 1280x1024
>>>> modes are also included. For things to always work with an explicitly
>>>> specified mode (via the "vga=" option), that mode therefore needs be a
>>>> 1024x768 one.
> 
> So this patch helps you by not having to set a mode and just relying
> on the mode set by GrUB?

Yes, but it goes beyond that: The modes offered by VESA on the particular
system don't include the higher resolution one under certain circumstances,
so I cannot tell Xen to switch to that mode. By not having to tell Xen a
specific mode (but rather inherit that set / left active by the boot
loader), I can leverage the better mode in most cases, but things will
still work if I turn on (or reset) the system with another machine being
the presently selected one at the KVM switch.

But yes, beyond the particular quirk on this system the benefit is one
less mode switch and hence less screen flickering and slightly faster
boot.

>>>> --- a/xen/arch/x86/boot/video.S
>>>> +++ b/xen/arch/x86/boot/video.S
>>>> @@ -575,7 +575,6 @@ set14:  movw    $0x1111, %ax
>>>>          movb    $0x01, %ah              # Define cursor scan lines 11-12
>>>>          movw    $0x0b0c, %cx
>>>>          int     $0x10
>>>> -set_current:
>>>>          stc
>>>>          ret
>>>>  
>>>> @@ -693,6 +692,39 @@ vga_modes:
>>>>          .word   VIDEO_80x60, 0x50,0x3c,0        # 80x60
>>>>  vga_modes_end:
>>>>  
>>>> +# If the current mode is a VESA graphics one, obtain its parameters.
>>>> +set_current:
>>>> +        leaw    vesa_glob_info, %di
>>>> +        movw    $0x4f00, %ax
>>>> +        int     $0x10
>>>> +        cmpw    $0x004f, %ax
>>>> +        jne     .Lsetc_done
>>>
>>> You don't seem to make use of the information fetched here? I guess
>>> this is somehow required to access the other functions?
>>
>> See the similar logic at check_vesa. The information is used later, by
>> mode_params (half way into mopar_gr). Quite likely this could be done
>> just in a single place, but that would require some restructuring of
>> the code, which I'd like to avoid doing here.
> 
> I didn't realize check_vesa and set_current where mutually
> exclusive.
> 
>>>> +        movw    $0x4f03, %ax
>>>
>>> It would help readability to have defines for those values, ie:
>>> VESA_GET_CURRENT_MODE or some such (not that you need to do it here,
>>> just a comment).
>>
>> Right - this applies to all of our BIOS interfacing code, I guess.
>>
>>>> +        int     $0x10
>>>> +        cmpw    $0x004f, %ax
>>>> +        jne     .Lsetc_done
>>>> +
>>>> +        leaw    vesa_mode_info, %di     # Get mode information structure
>>>> +        movw    %bx, %cx
>>>> +        movw    $0x4f01, %ax
>>>> +        int     $0x10
>>>> +        cmpw    $0x004f, %ax
>>>> +        jne     .Lsetc_done
>>>> +
>>>> +        movb    (%di), %al              # Check mode attributes
>>>> +        andb    $0x9b, %al
>>>> +        cmpb    $0x9b, %al
>>>
>>> So you also check that the reserved D1 bit is set to 1 as mandated by
>>> the spec. This is slightly different than what's done in check_vesa,
>>> would you mind adding a define for this an unifying with check_vesa?
>>
>> Well, see the v2 changelog comment. I'm somewhat hesitant to do that
>> here; I'd prefer to consolidate this in a separate patch.
> 
> Sorry, didn't notice that v2 comment before.
> 
> It's my understanding that the main difference this patch introduces
> is that set_current now fetches the currently set mode, so that we
> avoid further mode changes if the mode set already matches the
> selected one, or if Xen is to use the already set mode?

Not exactly: You either tell Xen to use the current mode ("vga=current")
or you tell Xen to use a specific mode ("vga=<mode>"). Checking whether
the present mode is the (specific) one Xen was told to switch to would
require yet more work. But skipping a requested mode switch can also
have unintended consequences, so I wouldn't even be certain we would
want to go such a route.

Jan




 


Rackspace

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