All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v3 4/9] x86/PVH: provide VGA console info to Dom0
Date: Tue, 21 Sep 2021 09:18:05 +0200	[thread overview]
Message-ID: <215e2ea4-cb49-7d94-7f97-c6b81e522a60@suse.com> (raw)
In-Reply-To: <e4959bab-0e0b-1037-c5da-3d2f14592c20@suse.com>

Like PV Dom0 in order to use the console if in a mode other than text
80x25 the kernel needs to be provided information about this mode. Bump
HVM start info's "current" version to 2 and use a previously reserved
32-bit field to provide struct dom0_vga_console_info's position and
size.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v3: New.

--- a/xen/arch/x86/hvm/dom0_build.c
+++ b/xen/arch/x86/hvm/dom0_build.c
@@ -19,6 +19,7 @@
  */
 
 #include <xen/acpi.h>
+#include <xen/console.h>
 #include <xen/init.h>
 #include <xen/libelf.h>
 #include <xen/multiboot.h>
@@ -549,6 +550,11 @@ static int __init pvh_load_kernel(struct
     paddr_t last_addr;
     struct hvm_start_info start_info = { 0 };
     struct hvm_modlist_entry mod = { 0 };
+#ifdef CONFIG_VIDEO
+    struct dom0_vga_console_info vga_info = { 0 };
+#else
+    struct {} __maybe_unused vga_info;
+#endif
     struct vcpu *v = d->vcpu[0];
     int rc;
 
@@ -598,7 +604,7 @@ static int __init pvh_load_kernel(struct
      * split into smaller allocations, done as a single region in order to
      * simplify it.
      */
-    last_addr = find_memory(d, &elf, sizeof(start_info) +
+    last_addr = find_memory(d, &elf, sizeof(start_info) + sizeof(vga_info) +
                             (initrd ? ROUNDUP(initrd->mod_end, PAGE_SIZE) +
                                       sizeof(mod)
                                     : 0) +
@@ -672,6 +678,22 @@ static int __init pvh_load_kernel(struct
         last_addr += sizeof(mod);
     }
 
+#ifdef CONFIG_VIDEO
+    if ( fill_console_start_info(&vga_info) )
+    {
+        rc = hvm_copy_to_guest_phys(last_addr + sizeof(start_info),
+                                    &vga_info, sizeof(vga_info), v);
+        if ( !rc )
+        {
+            start_info.version = 2;
+            start_info.vga_info.offset = sizeof(start_info);
+            start_info.vga_info.size = sizeof(vga_info);
+        }
+        else
+            printk("Unable to copy VGA info to guest\n");
+    }
+#endif
+
     start_info.magic = XEN_HVM_START_MAGIC_VALUE;
     start_info.flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
     rc = hvm_copy_to_guest_phys(last_addr, &start_info, sizeof(start_info), v);
--- a/xen/include/public/arch-x86/hvm/start_info.h
+++ b/xen/include/public/arch-x86/hvm/start_info.h
@@ -33,7 +33,7 @@
  *    | magic          | Contains the magic value XEN_HVM_START_MAGIC_VALUE
  *    |                | ("xEn3" with the 0x80 bit of the "E" set).
  *  4 +----------------+
- *    | version        | Version of this structure. Current version is 1. New
+ *    | version        | Version of this structure. Current version is 2. New
  *    |                | versions are guaranteed to be backwards-compatible.
  *  8 +----------------+
  *    | flags          | SIF_xxx flags.
@@ -55,7 +55,15 @@
  *    |                | if there is no memory map being provided. Only
  *    |                | present in version 1 and newer of the structure.
  * 52 +----------------+
- *    | reserved       | Version 1 and newer only.
+ *    | vga_info.offset| Offset of struct dom0_vga_console_info from base of
+ *    |                | struct hvm_start_info. Optional and only present in
+ *    |                | version 2 and newer of the structure when
+ *    |                | SIF_INITDOMAIN is set; zero if absent.
+ * 54 +----------------+
+ *    | vga_info.size  | Size of present parts of struct dom0_vga_console_info.
+ *    |                | Optional and only present in version 2 and newer of
+ *    |                | the structure when SIF_INITDOMAIN is set; zero if
+ *    |                | absent.
  * 56 +----------------+
  *
  * The layout of each entry in the module structure is the following:
@@ -139,7 +147,15 @@ struct hvm_start_info {
     uint32_t memmap_entries;    /* Number of entries in the memmap table.    */
                                 /* Value will be zero if there is no memory  */
                                 /* map being provided.                       */
-    uint32_t reserved;          /* Must be zero.                             */
+    /*
+     * The following sub-structure is only present in version 2 and newer
+     * when SIF_INITDOMAIN is set. It is reserved in version 1 or when
+     * SIF_INITDOMAIN is clear, and absent in version 0.
+     */
+    struct {                    /* Coord-s of struct dom0_vga_console_info.  */
+        uint16_t offset;        /* ... from base of struct hvm_start_info.   */
+        uint16_t size;          /* ... of present parts of the struct.       */
+    } vga_info;
 };
 
 struct hvm_modlist_entry {



  parent reply	other threads:[~2021-09-21  7:18 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-21  7:15 [PATCH v3 0/9] x86/PVH: Dom0 building adjustments Jan Beulich
2021-09-21  7:16 ` [PATCH v3 1/9] x86/PVH: improve Dom0 memory size calculation Jan Beulich
2021-09-22 11:59   ` Roger Pau Monné
2021-09-29 10:53     ` Jan Beulich
2021-09-21  7:17 ` [PATCH v3 2/9] x86/PV: properly set shadow allocation for Dom0 Jan Beulich
2021-09-22 13:01   ` Roger Pau Monné
2021-09-22 13:31   ` Andrew Cooper
2021-09-22 13:50     ` Jan Beulich
2021-09-22 14:25       ` Roger Pau Monné
2021-09-22 14:28         ` Jan Beulich
2021-09-21  7:17 ` [PATCH v3 3/9] x86/PVH: permit more physdevop-s to be used by Dom0 Jan Beulich
2021-09-22 14:22   ` Roger Pau Monné
2021-09-24 12:18     ` Jan Beulich
2021-09-21  7:18 ` Jan Beulich [this message]
2021-09-22 15:01   ` [PATCH v3 4/9] x86/PVH: provide VGA console info to Dom0 Roger Pau Monné
2021-09-22 17:03     ` Andrew Cooper
2021-09-23  9:58       ` Jan Beulich
2021-09-23  9:46     ` Jan Beulich
2021-09-23 13:22       ` Roger Pau Monné
2021-09-21  7:19 ` [PATCH v3 5/9] x86/PVH: actually show Dom0's register state from debug key '0' Jan Beulich
2021-09-22 15:48   ` Roger Pau Monné
2021-09-23 10:21     ` Jan Beulich
2021-09-23 14:27       ` Roger Pau Monné
2021-09-21  7:19 ` [PATCH v3 6/9] x86/HVM: convert hvm_virtual_to_linear_addr() to be remote-capable Jan Beulich
2021-09-23  8:09   ` Roger Pau Monné
2021-09-23 10:34     ` Jan Beulich
2021-09-23 14:28       ` Roger Pau Monné
2021-09-21  7:20 ` [PATCH v3 7/9] x86/PVH: actually show Dom0's stacks from debug key '0' Jan Beulich
2021-09-23 10:31   ` Roger Pau Monné
2021-09-23 10:38     ` Roger Pau Monné
2021-09-23 10:47     ` Jan Beulich
2021-09-23 14:43       ` Roger Pau Monné
2021-09-21  7:20 ` [PATCH v3 8/9] x86/HVM: skip offline vCPU-s when dumping VMCBs/VMCSes Jan Beulich
2021-09-23  8:23   ` Roger Pau Monné
2021-09-23 11:27     ` Jan Beulich
2021-09-23 14:46       ` Roger Pau Monné
2021-09-21  7:21 ` [PATCH v3 9/9] x86/P2M: relax permissions of PVH Dom0's MMIO entries Jan Beulich
2021-09-23 11:10   ` Roger Pau Monné
2021-09-23 11:32     ` Jan Beulich
2021-09-23 11:54       ` Roger Pau Monné
2021-09-23 12:15         ` Jan Beulich
2021-09-23 15:15           ` Roger Pau Monné
2021-09-23 15:22             ` Jan Beulich
2021-09-23 15:32               ` Roger Pau Monné

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=215e2ea4-cb49-7d94-7f97-c6b81e522a60@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.