[PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format

Petr Beneš posted 9 patches 3 months, 1 week ago
[PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Petr Beneš 3 months, 1 week ago
From: Petr Beneš <w1benny@gmail.com>

Encapsulate the altp2m options within a struct. This change is preparatory
and sets the groundwork for introducing additional parameter in subsequent
commit.

Signed-off-by: Petr Beneš <w1benny@gmail.com>
Acked-by: Julien Grall <jgrall@amazon.com> # arm
Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
---
 tools/libs/light/libxl_create.c     | 6 +++---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
 xen/arch/arm/domain.c               | 2 +-
 xen/arch/x86/domain.c               | 4 ++--
 xen/arch/x86/hvm/hvm.c              | 2 +-
 xen/include/public/domctl.h         | 4 +++-
 6 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_create.c
index edeadd57ef..569e3d21ed 100644
--- a/tools/libs/light/libxl_create.c
+++ b/tools/libs/light/libxl_create.c
@@ -680,17 +680,17 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config,
         LOG(DETAIL, "altp2m: %s", libxl_altp2m_mode_to_string(b_info->altp2m));
         switch(b_info->altp2m) {
         case LIBXL_ALTP2M_MODE_MIXED:
-            create.altp2m_opts |=
+            create.altp2m.opts |=
                 XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_mixed);
             break;

         case LIBXL_ALTP2M_MODE_EXTERNAL:
-            create.altp2m_opts |=
+            create.altp2m.opts |=
                 XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_external);
             break;

         case LIBXL_ALTP2M_MODE_LIMITED:
-            create.altp2m_opts |=
+            create.altp2m.opts |=
                 XEN_DOMCTL_ALTP2M_mode(XEN_DOMCTL_ALTP2M_limited);
             break;

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index a529080129..e6c977521f 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -231,7 +231,9 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
 		.grant_opts =
 		    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
-		.altp2m_opts = Int32_val(VAL_ALTP2M_OPTS),
+		.altp2m = {
+			.opts = Int32_val(VAL_ALTP2M_OPTS),
+		},
 		.vmtrace_size = vmtrace_size,
 		.cpupool_id = Int32_val(VAL_CPUPOOL_ID),
 	};
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 8bde2f730d..5234b627d0 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -688,7 +688,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }

-    if ( config->altp2m_opts )
+    if ( config->altp2m.opts )
     {
         dprintk(XENLOG_INFO, "Altp2m not supported\n");
         return -EINVAL;
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ccadfe0c9e..a4f2e7bad1 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -637,7 +637,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
     bool hap = config->flags & XEN_DOMCTL_CDF_hap;
     bool nested_virt = config->flags & XEN_DOMCTL_CDF_nested_virt;
     unsigned int max_vcpus;
-    unsigned int altp2m_mode = MASK_EXTR(config->altp2m_opts,
+    unsigned int altp2m_mode = MASK_EXTR(config->altp2m.opts,
                                          XEN_DOMCTL_ALTP2M_mode_mask);

     if ( hvm ? !hvm_enabled : !IS_ENABLED(CONFIG_PV) )
@@ -717,7 +717,7 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
         return -EINVAL;
     }

-    if ( config->altp2m_opts & ~XEN_DOMCTL_ALTP2M_mode_mask )
+    if ( config->altp2m.opts & ~XEN_DOMCTL_ALTP2M_mode_mask )
     {
         dprintk(XENLOG_INFO, "Invalid altp2m options selected: %#x\n",
                 config->flags);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8334ab1711..a66ebaaceb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -659,7 +659,7 @@ int hvm_domain_initialise(struct domain *d,
     d->arch.hvm.params[HVM_PARAM_TRIPLE_FAULT_REASON] = SHUTDOWN_reboot;

     /* Set altp2m based on domctl flags. */
-    switch ( MASK_EXTR(config->altp2m_opts, XEN_DOMCTL_ALTP2M_mode_mask) )
+    switch ( MASK_EXTR(config->altp2m.opts, XEN_DOMCTL_ALTP2M_mode_mask) )
     {
     case XEN_DOMCTL_ALTP2M_mixed:
         d->arch.hvm.params[HVM_PARAM_ALTP2M] = XEN_ALTP2M_mixed;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2a49fe46ce..dea399aa8e 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -86,6 +86,7 @@ struct xen_domctl_createdomain {

     uint32_t grant_opts;

+    struct {
 /*
  * Enable altp2m mixed mode.
  *
@@ -102,7 +103,8 @@ struct xen_domctl_createdomain {
 /* Altp2m mode signaling uses bits [0, 1]. */
 #define XEN_DOMCTL_ALTP2M_mode_mask  (0x3U)
 #define XEN_DOMCTL_ALTP2M_mode(m)    ((m) & XEN_DOMCTL_ALTP2M_mode_mask)
-    uint32_t altp2m_opts;
+        uint32_t opts;
+    } altp2m;

     /* Per-vCPU buffer size in bytes.  0 to disable. */
     uint32_t vmtrace_size;
--
2.34.1


Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Anthony PERARD 3 months, 1 week ago
On Mon, Jun 10, 2024 at 05:10:41PM +0000, Petr Beneš wrote:
> From: Petr Beneš <w1benny@gmail.com>
> 
> Encapsulate the altp2m options within a struct. This change is preparatory
> and sets the groundwork for introducing additional parameter in subsequent
> commit.
> 
> Signed-off-by: Petr Beneš <w1benny@gmail.com>
> Acked-by: Julien Grall <jgrall@amazon.com> # arm
> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
> ---
>  tools/libs/light/libxl_create.c     | 6 +++---

Acked-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,

-- 


Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech
Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Jan Beulich 3 months, 1 week ago
On 10.06.2024 19:10, Petr Beneš wrote:
> From: Petr Beneš <w1benny@gmail.com>
> 
> Encapsulate the altp2m options within a struct. This change is preparatory
> and sets the groundwork for introducing additional parameter in subsequent
> commit.
> 
> Signed-off-by: Petr Beneš <w1benny@gmail.com>
> Acked-by: Julien Grall <jgrall@amazon.com> # arm
> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor

Looks like you lost Christian's ack for ...

> ---
>  tools/libs/light/libxl_create.c     | 6 +++---
>  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-

... the adjustment of this file?

Jan

Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Petr Beneš 3 months, 1 week ago
On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 10.06.2024 19:10, Petr Beneš wrote:
> > From: Petr Beneš <w1benny@gmail.com>
> >
> > Encapsulate the altp2m options within a struct. This change is preparatory
> > and sets the groundwork for introducing additional parameter in subsequent
> > commit.
> >
> > Signed-off-by: Petr Beneš <w1benny@gmail.com>
> > Acked-by: Julien Grall <jgrall@amazon.com> # arm
> > Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
>
> Looks like you lost Christian's ack for ...
>
> > ---
> >  tools/libs/light/libxl_create.c     | 6 +++---
> >  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
>
> ... the adjustment of this file?

In the cover email, Christian only acked:

> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---

P.
Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Jan Beulich 3 months, 1 week ago
On 11.06.2024 10:00, Petr Beneš wrote:
> On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> On 10.06.2024 19:10, Petr Beneš wrote:
>>> From: Petr Beneš <w1benny@gmail.com>
>>>
>>> Encapsulate the altp2m options within a struct. This change is preparatory
>>> and sets the groundwork for introducing additional parameter in subsequent
>>> commit.
>>>
>>> Signed-off-by: Petr Beneš <w1benny@gmail.com>
>>> Acked-by: Julien Grall <jgrall@amazon.com> # arm
>>> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
>>
>> Looks like you lost Christian's ack for ...
>>
>>> ---
>>>  tools/libs/light/libxl_create.c     | 6 +++---
>>>  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
>>
>> ... the adjustment of this file?
> 
> In the cover email, Christian only acked:
> 
>> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
>> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
>> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---

Right, but above I was talking about the last of these three files.

Jan

Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Christian Lindig 3 months ago

> On 11 Jun 2024, at 10:14, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 11.06.2024 10:00, Petr Beneš wrote:
>> On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
>>> 
>>> On 10.06.2024 19:10, Petr Beneš wrote:
>>>> From: Petr Beneš <w1benny@gmail.com>
>>>> 
>>>> Encapsulate the altp2m options within a struct. This change is preparatory
>>>> and sets the groundwork for introducing additional parameter in subsequent
>>>> commit.
>>>> 
>>>> Signed-off-by: Petr Beneš <w1benny@gmail.com>
>>>> Acked-by: Julien Grall <jgrall@amazon.com> # arm
>>>> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
>>> 
>>> Looks like you lost Christian's ack for ...
>>> 
>>>> ---
>>>> tools/libs/light/libxl_create.c     | 6 +++---
>>>> tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
>>> 
>>> ... the adjustment of this file?
>> 
>> In the cover email, Christian only acked:
>> 
>>> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
>>> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
>>> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---
> 
> Right, but above I was talking about the last of these three files.
> 
> Jan

Consider all of this Acked by me. I think this email-based workflow when we are going through several iterations are quite a burden.

— C
Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Petr Beneš 3 months, 1 week ago
On Tue, Jun 11, 2024 at 11:14 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 11.06.2024 10:00, Petr Beneš wrote:
> > On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 10.06.2024 19:10, Petr Beneš wrote:
> >>> From: Petr Beneš <w1benny@gmail.com>
> >>>
> >>> Encapsulate the altp2m options within a struct. This change is preparatory
> >>> and sets the groundwork for introducing additional parameter in subsequent
> >>> commit.
> >>>
> >>> Signed-off-by: Petr Beneš <w1benny@gmail.com>
> >>> Acked-by: Julien Grall <jgrall@amazon.com> # arm
> >>> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
> >>
> >> Looks like you lost Christian's ack for ...
> >>
> >>> ---
> >>>  tools/libs/light/libxl_create.c     | 6 +++---
> >>>  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
> >>
> >> ... the adjustment of this file?
> >
> > In the cover email, Christian only acked:
> >
> >> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
> >> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
> >> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---
>
> Right, but above I was talking about the last of these three files.
>
> Jan

Ouch. It didn't occur to me that Ack on cover email acks each of the
files in every separate patch. My thinking was it acks only the
patches where those three are together. Anyway, it makes sense. I'll
resend v7.

P.
Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Jan Beulich 3 months, 1 week ago
On 11.06.2024 11:34, Petr Beneš wrote:
> On Tue, Jun 11, 2024 at 11:14 AM Jan Beulich <jbeulich@suse.com> wrote:
>> On 11.06.2024 10:00, Petr Beneš wrote:
>>> On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
>>>> On 10.06.2024 19:10, Petr Beneš wrote:
>>>>> From: Petr Beneš <w1benny@gmail.com>
>>>>>
>>>>> Encapsulate the altp2m options within a struct. This change is preparatory
>>>>> and sets the groundwork for introducing additional parameter in subsequent
>>>>> commit.
>>>>>
>>>>> Signed-off-by: Petr Beneš <w1benny@gmail.com>
>>>>> Acked-by: Julien Grall <jgrall@amazon.com> # arm
>>>>> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
>>>>
>>>> Looks like you lost Christian's ack for ...
>>>>
>>>>> ---
>>>>>  tools/libs/light/libxl_create.c     | 6 +++---
>>>>>  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
>>>>
>>>> ... the adjustment of this file?
>>>
>>> In the cover email, Christian only acked:
>>>
>>>> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
>>>> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
>>>> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---
>>
>> Right, but above I was talking about the last of these three files.
>>
>> Jan
> 
> Ouch. It didn't occur to me that Ack on cover email acks each of the
> files in every separate patch. My thinking was it acks only the
> patches where those three are together. Anyway, it makes sense. I'll
> resend v7.

Well, no need to just for this. Yet if a v7 turns out necessary, please
make sure you have the ack recorded.

Jan

Re: [PATCH for-4.19? v6 3/9] xen: Refactor altp2m options into a structured format
Posted by Petr Beneš 3 months, 1 week ago
On Tue, Jun 11, 2024 at 11:36 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 11.06.2024 11:34, Petr Beneš wrote:
> > On Tue, Jun 11, 2024 at 11:14 AM Jan Beulich <jbeulich@suse.com> wrote:
> >> On 11.06.2024 10:00, Petr Beneš wrote:
> >>> On Tue, Jun 11, 2024 at 8:41 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>>> On 10.06.2024 19:10, Petr Beneš wrote:
> >>>>> From: Petr Beneš <w1benny@gmail.com>
> >>>>>
> >>>>> Encapsulate the altp2m options within a struct. This change is preparatory
> >>>>> and sets the groundwork for introducing additional parameter in subsequent
> >>>>> commit.
> >>>>>
> >>>>> Signed-off-by: Petr Beneš <w1benny@gmail.com>
> >>>>> Acked-by: Julien Grall <jgrall@amazon.com> # arm
> >>>>> Reviewed-by: Jan Beulich <jbeulich@suse.com> # hypervisor
> >>>>
> >>>> Looks like you lost Christian's ack for ...
> >>>>
> >>>>> ---
> >>>>>  tools/libs/light/libxl_create.c     | 6 +++---
> >>>>>  tools/ocaml/libs/xc/xenctrl_stubs.c | 4 +++-
> >>>>
> >>>> ... the adjustment of this file?
> >>>
> >>> In the cover email, Christian only acked:
> >>>
> >>>> tools/ocaml/libs/xc/xenctrl.ml       |   2 +
> >>>> tools/ocaml/libs/xc/xenctrl.mli      |   2 +
> >>>> tools/ocaml/libs/xc/xenctrl_stubs.c  |  40 +++++++---
> >>
> >> Right, but above I was talking about the last of these three files.
> >>
> >> Jan
> >
> > Ouch. It didn't occur to me that Ack on cover email acks each of the
> > files in every separate patch. My thinking was it acks only the
> > patches where those three are together. Anyway, it makes sense. I'll
> > resend v7.
>
> Well, no need to just for this. Yet if a v7 turns out necessary, please
> make sure you have the ack recorded.
>
> Jan

Noted.

P.