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

Re: [PATCH v3 08/12] xen/riscv: rework G-stage mode handling





On 4/21/26 11:39 AM, Jan Beulich wrote:
On 10.04.2026 17:54, Oleksii Kurochko wrote:
--- a/xen/arch/riscv/p2m.c
+++ b/xen/arch/riscv/p2m.c
@@ -45,12 +45,27 @@ struct p2m_pte_ctx {
      unsigned int level;          /* Paging level at which the PTE resides. */
  };
-static struct gstage_mode_desc __ro_after_init max_gstage_mode = {
-    .mode = HGATP_MODE_OFF,
-    .paging_levels = 0,
-    .name = "Bare",
+/* Values should be sorted by ->mode in this array */
+static const struct gstage_mode_desc modes[] = {

As before, I'm of the clear opinion that this is too generic an identifier
for use at file scope.

I can rename it to gstage_modes or p2m_modes to make it better suite file scope.

--- a/xen/include/public/arch-riscv.h
+++ b/xen/include/public/arch-riscv.h
@@ -56,6 +56,11 @@ typedef struct vcpu_guest_context vcpu_guest_context_t;
  DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
struct xen_arch_domainconfig {
+    /*
+     * G-stage MMU mode for the guest (e.g. "sv39", "sv48", "sv57").
+     * Must be set; an empty string is invalid.
+     */
+    char gstage_mode[8];
  };

I have to say that I find it odd to use a string literal for this purpose.
Specifying the number of wanted address bits would feel more natural. Plus
the strings named aren't valid G-stage modes afaict - they lack the x4.

I will change it to unsigned char gstage_mode and put there on of the value of HGATP_MODE_SV39X4, HGATP_MODE_SV48X4. Or just address bits as you suggested will be fine too.

~ Oleksii





 


Rackspace

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